/** * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. * @license MIT * * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) * @license MIT * * Originally forked from (with the author's permission): * Fabrice Bellard's javascript vt100 for jslinux: * http://bellard.org/jslinux/ * Copyright (c) 2011 Fabrice Bellard */ /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var Po=Object.create;var _n=Object.defineProperty;var Go=Object.getOwnPropertyDescriptor;var No=Object.getOwnPropertyNames;var Ho=Object.getPrototypeOf,_o=Object.prototype.hasOwnProperty;var tt=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(f,p)=>(typeof require<"u"?require:f)[p]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var Ur=(s,f)=>()=>(f||s((f={exports:{}}).exports,f),f.exports);var zo=(s,f,p,h)=>{if(f&&typeof f=="object"||typeof f=="function")for(let v of No(f))!_o.call(s,v)&&v!==p&&_n(s,v,{get:()=>f[v],enumerable:!(h=Go(f,v))||h.enumerable});return s};var Wo=(s,f,p)=>(p=s!=null?Po(Ho(s)):{},zo(f||!s||!s.__esModule?_n(p,"default",{value:s,enumerable:!0}):p,s));var Wn=Ur((Or,zn)=>{(function(s,f){typeof Or=="object"&&typeof zn<"u"?f(Or):typeof define=="function"&&define.amd?define(["exports"],f):f(s.opentype=s.opentype||{})})(Or,(function(s){"use strict";var f=0,p=-3;function h(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function v(e,r){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=r,this.destLen=0,this.ltree=new h,this.dtree=new h}var x=new h,S=new h,L=new Uint8Array(30),k=new Uint16Array(30),D=new Uint8Array(30),V=new Uint16Array(30),N=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),W=new h,X=new Uint8Array(320);function ve(e,r,t,n){var a,i;for(a=0;a>>=1,r}function Se(e,r,t){if(!r)return t;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<>>16-r;return e.tag>>>=r,e.bitcount-=r,n+t}function Ar(e,r){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<>>=1,++a,t+=r.table[a],n-=r.table[a];while(n>=0);return e.tag=i,e.bitcount-=a,r.trans[t+n]}function ua(e,r,t){var n,a,i,o,l,u;for(n=Se(e,5,257),a=Se(e,5,1),i=Se(e,4,4),o=0;o<19;++o)X[o]=0;for(o=0;o8;)e.sourceIndex--,e.bitcount-=8;if(r=e.source[e.sourceIndex+1],r=256*r+e.source[e.sourceIndex],t=e.source[e.sourceIndex+3],t=256*t+e.source[e.sourceIndex+2],r!==(~t&65535))return p;for(e.sourceIndex+=4,n=r;n;--n)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,f}function fa(e,r){var t=new v(e,r),n,a,i;do{switch(n=oa(t),a=Se(t,2,0),a){case 0:i=la(t);break;case 1:i=St(t,x,S);break;case 2:ua(t,t.ltree,t.dtree),i=St(t,t.ltree,t.dtree);break;default:i=p}if(i!==f)throw new Error("Data error")}while(!n);return t.destLenthis.x2&&(this.x2=e)),typeof r=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=r,this.y2=r),rthis.y2&&(this.y2=r))},ke.prototype.addX=function(e){this.addPoint(e,null)},ke.prototype.addY=function(e){this.addPoint(null,e)},ke.prototype.addBezier=function(e,r,t,n,a,i,o,l){var u=this,c=[e,r],d=[t,n],y=[a,i],g=[o,l];this.addPoint(e,r),this.addPoint(o,l);for(var m=0;m<=1;m++){var T=6*c[m]-12*d[m]+6*y[m],O=-3*c[m]+9*d[m]-9*y[m]+3*g[m],F=3*d[m]-3*c[m];if(O===0){if(T===0)continue;var U=-F/T;0=0&&c>0&&(u+=" "),u+=t(d)}return u}for(var a="",i=0;i=0&&e<=255,"Byte value should be between 0 and 255."),[e]},M.BYTE=ge(1),E.CHAR=function(e){return[e.charCodeAt(0)]},M.CHAR=ge(1),E.CHARARRAY=function(e){for(var r=[],t=0;t>8&255,e&255]},M.USHORT=ge(2),E.SHORT=function(e){return e>=Ft&&(e=-(2*Ft-e)),[e>>8&255,e&255]},M.SHORT=ge(2),E.UINT24=function(e){return[e>>16&255,e>>8&255,e&255]},M.UINT24=ge(3),E.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]},M.ULONG=ge(4),E.LONG=function(e){return e>=Lt&&(e=-(2*Lt-e)),[e>>24&255,e>>16&255,e>>8&255,e&255]},M.LONG=ge(4),E.FIXED=E.ULONG,M.FIXED=M.ULONG,E.FWORD=E.SHORT,M.FWORD=M.SHORT,E.UFWORD=E.USHORT,M.UFWORD=M.USHORT,E.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,e&255]},M.LONGDATETIME=ge(8),E.TAG=function(e){return G.argument(e.length===4,"Tag should be exactly 4 ASCII characters."),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]},M.TAG=ge(4),E.Card8=E.BYTE,M.Card8=M.BYTE,E.Card16=E.USHORT,M.Card16=M.USHORT,E.OffSize=E.BYTE,M.OffSize=M.BYTE,E.SID=E.USHORT,M.SID=M.USHORT,E.NUMBER=function(e){return e>=-107&&e<=107?[e+139]:e>=108&&e<=1131?(e=e-108,[(e>>8)+247,e&255]):e>=-1131&&e<=-108?(e=-e-108,[(e>>8)+251,e&255]):e>=-32768&&e<=32767?E.NUMBER16(e):E.NUMBER32(e)},M.NUMBER=function(e){return E.NUMBER(e).length},E.NUMBER16=function(e){return[28,e>>8&255,e&255]},M.NUMBER16=ge(3),E.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,e&255]},M.NUMBER32=ge(5),E.REAL=function(e){var r=e.toString(),t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(r);if(t){var n=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));r=(Math.round(e*n)/n).toString()}for(var a="",i=0,o=r.length;i>8&255,r[r.length]=n&255}return r},M.UTF16=function(e){return e.length*2};var Mr={"x-mac-croatian":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\u0160\u2122\xB4\xA8\u2260\u017D\xD8\u221E\xB1\u2264\u2265\u2206\xB5\u2202\u2211\u220F\u0161\u222B\xAA\xBA\u03A9\u017E\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u0106\xAB\u010C\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u0110\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\uF8FF\xA9\u2044\u20AC\u2039\u203A\xC6\xBB\u2013\xB7\u201A\u201E\u2030\xC2\u0107\xC1\u010D\xC8\xCD\xCE\xCF\xCC\xD3\xD4\u0111\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u03C0\xCB\u02DA\xB8\xCA\xE6\u02C7","x-mac-cyrillic":"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u2020\xB0\u0490\xA3\xA7\u2022\xB6\u0406\xAE\xA9\u2122\u0402\u0452\u2260\u0403\u0453\u221E\xB1\u2264\u2265\u0456\xB5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040A\u045A\u0458\u0405\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\u040B\u045B\u040C\u045C\u0455\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u201E\u040E\u045E\u040F\u045F\u2116\u0401\u0451\u044F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E","x-mac-gaelic":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u1E02\xB1\u2264\u2265\u1E03\u010A\u010B\u1E0A\u1E0B\u1E1E\u1E1F\u0120\u0121\u1E40\xE6\xF8\u1E41\u1E56\u1E57\u027C\u0192\u017F\u1E60\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\u1E61\u1E9B\xFF\u0178\u1E6A\u20AC\u2039\u203A\u0176\u0177\u1E6B\xB7\u1EF2\u1EF3\u204A\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\u2663\xD2\xDA\xDB\xD9\u0131\xDD\xFD\u0174\u0175\u1E84\u1E85\u1E80\u1E81\u1E82\u1E83","x-mac-greek":"\xC4\xB9\xB2\xC9\xB3\xD6\xDC\u0385\xE0\xE2\xE4\u0384\xA8\xE7\xE9\xE8\xEA\xEB\xA3\u2122\xEE\xEF\u2022\xBD\u2030\xF4\xF6\xA6\u20AC\xF9\xFB\xFC\u2020\u0393\u0394\u0398\u039B\u039E\u03A0\xDF\xAE\xA9\u03A3\u03AA\xA7\u2260\xB0\xB7\u0391\xB1\u2264\u2265\xA5\u0392\u0395\u0396\u0397\u0399\u039A\u039C\u03A6\u03AB\u03A8\u03A9\u03AC\u039D\xAC\u039F\u03A1\u2248\u03A4\xAB\xBB\u2026\xA0\u03A5\u03A7\u0386\u0388\u0153\u2013\u2015\u201C\u201D\u2018\u2019\xF7\u0389\u038A\u038C\u038E\u03AD\u03AE\u03AF\u03CC\u038F\u03CD\u03B1\u03B2\u03C8\u03B4\u03B5\u03C6\u03B3\u03B7\u03B9\u03BE\u03BA\u03BB\u03BC\u03BD\u03BF\u03C0\u03CE\u03C1\u03C3\u03C4\u03B8\u03C9\u03C2\u03C7\u03C5\u03B6\u03CA\u03CB\u0390\u03B0\xAD","x-mac-icelandic":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\xDD\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\u20AC\xD0\xF0\xDE\xFE\xFD\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7","x-mac-inuit":"\u1403\u1404\u1405\u1406\u140A\u140B\u1431\u1432\u1433\u1434\u1438\u1439\u1449\u144E\u144F\u1450\u1451\u1455\u1456\u1466\u146D\u146E\u146F\u1470\u1472\u1473\u1483\u148B\u148C\u148D\u148E\u1490\u1491\xB0\u14A1\u14A5\u14A6\u2022\xB6\u14A7\xAE\xA9\u2122\u14A8\u14AA\u14AB\u14BB\u14C2\u14C3\u14C4\u14C5\u14C7\u14C8\u14D0\u14EF\u14F0\u14F1\u14F2\u14F4\u14F5\u1505\u14D5\u14D6\u14D7\u14D8\u14DA\u14DB\u14EA\u1528\u1529\u152A\u152B\u152D\u2026\xA0\u152E\u153E\u1555\u1556\u1557\u2013\u2014\u201C\u201D\u2018\u2019\u1558\u1559\u155A\u155D\u1546\u1547\u1548\u1549\u154B\u154C\u1550\u157F\u1580\u1581\u1582\u1583\u1584\u1585\u158F\u1590\u1591\u1592\u1593\u1594\u1595\u1671\u1672\u1673\u1674\u1675\u1676\u1596\u15A0\u15A1\u15A2\u15A3\u15A4\u15A5\u15A6\u157C\u0141\u0142","x-mac-ce":"\xC4\u0100\u0101\xC9\u0104\xD6\xDC\xE1\u0105\u010C\xE4\u010D\u0106\u0107\xE9\u0179\u017A\u010E\xED\u010F\u0112\u0113\u0116\xF3\u0117\xF4\xF6\xF5\xFA\u011A\u011B\xFC\u2020\xB0\u0118\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\u0119\xA8\u2260\u0123\u012E\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145\u0146\u0143\xAC\u221A\u0144\u0147\u2206\xAB\xBB\u2026\xA0\u0148\u0150\xD5\u0151\u014C\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156\u0157\u0160\u201A\u201E\u0161\u015A\u015B\xC1\u0164\u0165\xCD\u017D\u017E\u016A\xD3\xD4\u016B\u016E\xDA\u016F\u0170\u0171\u0172\u0173\xDD\xFD\u0137\u017B\u0141\u017C\u0122\u02C7",macintosh:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\u20AC\u2039\u203A\uFB01\uFB02\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7","x-mac-romanian":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\u0102\u0218\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\u0103\u0219\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\u20AC\u2039\u203A\u021A\u021B\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7","x-mac-turkish":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u011E\u011F\u0130\u0131\u015E\u015F\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\uF8A0\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"};Ve.MACSTRING=function(e,r,t,n){var a=Mr[n];if(a!==void 0){for(var i="",o=0;o=128&&(i=t[i],i===void 0))return;n[a]=i}return n}},M.MACSTRING=function(e,r){var t=E.MACSTRING(e,r);return t!==void 0?t.length:0};function Br(e){return e>=-128&&e<=127}function ca(e,r,t){for(var n=0,a=e.length;r>8&255,u+256&255)}return i}E.VARDELTAS=function(e){for(var r=0,t=[];r=-128&&n<=127?r=va(e,r,t):r=da(e,r,t)}return t},E.INDEX=function(e){for(var r=1,t=[r],n=[],a=0;a>8,r[y+1]=g&255,r=r.concat(n[d])}return r},M.TABLE=function(e){for(var r=0,t=e.fields.length,n=0;n0)return new b(this.data,this.offset+r).parseStruct(e)},b.prototype.parsePointer32=function(e){var r=this.parseOffset32();if(r>0)return new b(this.data,this.offset+r).parseStruct(e)},b.prototype.parseListOfLists=function(e){for(var r=this,t=this.parseOffset16List(),n=t.length,a=this.relativeOffset,i=new Array(n),o=0;o>1,r.skip("uShort",3),e.glyphIndexMap={};for(var o=new w.Parser(t,n+a+14),l=new w.Parser(t,n+a+16+i*2),u=new w.Parser(t,n+a+16+i*4),c=new w.Parser(t,n+a+16+i*6),d=n+a+16+i*8,y=0;y=0;a-=1){var i=w.getUShort(e,r+4+a*8),o=w.getUShort(e,r+4+a*8+2);if(i===3&&(o===0||o===1||o===10)){n=w.getULong(e,r+4+a*8+4);break}}if(n===-1)throw new Error("No valid cmap sub-tables found.");var l=new w.Parser(e,r+n);if(t.format=l.parseUShort(),t.format===12)Ta(t,l);else if(t.format===4)ka(t,l,e,r,n);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function La(e,r,t){e.segments.push({end:r,start:r,delta:-(r-t),offset:0,glyphIndex:t})}function Ea(e){e.segments.push({end:65535,start:65535,delta:1,offset:0})}function Ua(e){var r=!0,t;for(t=e.length-1;t>0;t-=1){var n=e.get(t);if(n.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),r=!1;break}}var a=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:r?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:r?12:20}];r||(a=a.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),a=a.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 A.Table("cmap",a);for(i.segments=[],t=0;t0?(i=e.parseByte(),(r&a)===0&&(i=-i),i=t+i):(r&a)>0?i=t:i=t+e.parseShort(),i}function Ra(e,r,t){var n=new w.Parser(r,t);e.numberOfContours=n.parseShort(),e._xMin=n.parseShort(),e._yMin=n.parseShort(),e._xMax=n.parseShort(),e._yMax=n.parseShort();var a,i;if(e.numberOfContours>0){for(var o=e.endPointIndices=[],l=0;l0)for(var y=n.parseByte(),g=0;g0){var m=[],T;if(c>0){for(var O=0;O=0,m.push(T);for(var F=0,U=0;U0?(a&2)>0?(R.dx=n.parseShort(),R.dy=n.parseShort()):R.matchedPoints=[n.parseUShort(),n.parseUShort()]:(a&2)>0?(R.dx=n.parseChar(),R.dy=n.parseChar()):R.matchedPoints=[n.parseByte(),n.parseByte()],(a&8)>0?R.xScale=R.yScale=n.parseF2Dot14():(a&64)>0?(R.xScale=n.parseF2Dot14(),R.yScale=n.parseF2Dot14()):(a&128)>0&&(R.xScale=n.parseF2Dot14(),R.scale01=n.parseF2Dot14(),R.scale10=n.parseF2Dot14(),R.yScale=n.parseF2Dot14()),e.components.push(R),H=!!(a&32)}if(a&256){e.instructionLength=n.parseUShort(),e.instructions=[];for(var B=0;Br.points.length-1||n.matchedPoints[1]>a.points.length-1)throw Error("Matched points out of range in "+r.name);var o=r.points[n.matchedPoints[0]],l=a.points[n.matchedPoints[1]],u={xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:0,dy:0};l=Hr([l],u)[0],u.dx=o.x-l.x,u.dy=o.y-l.y,i=Hr(a.points,u)}r.points=r.points.concat(i)}}return Dt(r.points)}function Ma(e,r,t,n){for(var a=new qe.GlyphSet(n),i=0;i>4,o=a&15;if(i===t||(r+=n[i],o===t))break;r+=n[o]}return parseFloat(r)}function _a(e,r){var t,n,a,i;if(r===28)return t=e.parseByte(),n=e.parseByte(),t<<8|n;if(r===29)return t=e.parseByte(),n=e.parseByte(),a=e.parseByte(),i=e.parseByte(),t<<24|n<<16|a<<8|i;if(r===30)return Ha(e);if(r>=32&&r<=246)return r-139;if(r>=247&&r<=250)return t=e.parseByte(),(r-247)*256+t+108;if(r>=251&&r<=254)return t=e.parseByte(),-(r-251)*256-t-108;throw new Error("Invalid b0 "+r)}function za(e){for(var r={},t=0;t>1,u.length=0,d=!0}function ue(q){for(var K,se,le,pe,de,J,j,re,te,ne,oe,he,Y=0;Y1&&!d&&(H=u.shift()+U,d=!0),m+=u.pop(),R(g,m);break;case 5:for(;u.length>0;)g+=u.shift(),m+=u.shift(),l.lineTo(g,m);break;case 6:for(;u.length>0&&(g+=u.shift(),l.lineTo(g,m),u.length!==0);)m+=u.shift(),l.lineTo(g,m);break;case 7:for(;u.length>0&&(m+=u.shift(),l.lineTo(g,m),u.length!==0);)g+=u.shift(),l.lineTo(g,m);break;case 8:for(;u.length>0;)n=g+u.shift(),a=m+u.shift(),i=n+u.shift(),o=a+u.shift(),g=i+u.shift(),m=o+u.shift(),l.curveTo(n,a,i,o,g,m);break;case 10:de=u.pop()+O,J=T[de],J&&ue(J);break;case 11:return;case 12:switch(ae=q[Y],Y+=1,ae){case 35:n=g+u.shift(),a=m+u.shift(),i=n+u.shift(),o=a+u.shift(),j=i+u.shift(),re=o+u.shift(),te=j+u.shift(),ne=re+u.shift(),oe=te+u.shift(),he=ne+u.shift(),g=oe+u.shift(),m=he+u.shift(),u.shift(),l.curveTo(n,a,i,o,j,re),l.curveTo(te,ne,oe,he,g,m);break;case 34:n=g+u.shift(),a=m,i=n+u.shift(),o=a+u.shift(),j=i+u.shift(),re=o,te=j+u.shift(),ne=o,oe=te+u.shift(),he=m,g=oe+u.shift(),l.curveTo(n,a,i,o,j,re),l.curveTo(te,ne,oe,he,g,m);break;case 36:n=g+u.shift(),a=m+u.shift(),i=n+u.shift(),o=a+u.shift(),j=i+u.shift(),re=o,te=j+u.shift(),ne=o,oe=te+u.shift(),he=ne+u.shift(),g=oe+u.shift(),l.curveTo(n,a,i,o,j,re),l.curveTo(te,ne,oe,he,g,m);break;case 37:n=g+u.shift(),a=m+u.shift(),i=n+u.shift(),o=a+u.shift(),j=i+u.shift(),re=o+u.shift(),te=j+u.shift(),ne=re+u.shift(),oe=te+u.shift(),he=ne+u.shift(),Math.abs(oe-g)>Math.abs(he-m)?g=oe+u.shift():m=he+u.shift(),l.curveTo(n,a,i,o,j,re),l.curveTo(te,ne,oe,he,g,m);break;default:console.log("Glyph "+r.index+": unknown operator 1200"+ae),u.length=0}break;case 14:u.length>0&&!d&&(H=u.shift()+U,d=!0),y&&(l.closePath(),y=!1);break;case 18:B();break;case 19:case 20:B(),Y+=c+7>>3;break;case 21:u.length>2&&!d&&(H=u.shift()+U,d=!0),m+=u.pop(),g+=u.pop(),R(g,m);break;case 22:u.length>1&&!d&&(H=u.shift()+U,d=!0),g+=u.pop(),R(g,m);break;case 23:B();break;case 24:for(;u.length>2;)n=g+u.shift(),a=m+u.shift(),i=n+u.shift(),o=a+u.shift(),g=i+u.shift(),m=o+u.shift(),l.curveTo(n,a,i,o,g,m);g+=u.shift(),m+=u.shift(),l.lineTo(g,m);break;case 25:for(;u.length>6;)g+=u.shift(),m+=u.shift(),l.lineTo(g,m);n=g+u.shift(),a=m+u.shift(),i=n+u.shift(),o=a+u.shift(),g=i+u.shift(),m=o+u.shift(),l.curveTo(n,a,i,o,g,m);break;case 26:for(u.length%2&&(g+=u.shift());u.length>0;)n=g,a=m+u.shift(),i=n+u.shift(),o=a+u.shift(),g=i,m=o+u.shift(),l.curveTo(n,a,i,o,g,m);break;case 27:for(u.length%2&&(m+=u.shift());u.length>0;)n=g+u.shift(),a=m,i=n+u.shift(),o=a+u.shift(),g=i+u.shift(),m=o,l.curveTo(n,a,i,o,g,m);break;case 28:K=q[Y],se=q[Y+1],u.push((K<<24|se<<16)>>16),Y+=2;break;case 29:de=u.pop()+e.gsubrsBias,J=e.gsubrs[de],J&&ue(J);break;case 30:for(;u.length>0&&(n=g,a=m+u.shift(),i=n+u.shift(),o=a+u.shift(),g=i+u.shift(),m=o+(u.length===1?u.shift():0),l.curveTo(n,a,i,o,g,m),u.length!==0);)n=g+u.shift(),a=m,i=n+u.shift(),o=a+u.shift(),m=o+u.shift(),g=i+(u.length===1?u.shift():0),l.curveTo(n,a,i,o,g,m);break;case 31:for(;u.length>0&&(n=g+u.shift(),a=m,i=n+u.shift(),o=a+u.shift(),m=o+u.shift(),g=i+(u.length===1?u.shift():0),l.curveTo(n,a,i,o,g,m),u.length!==0);)n=g,a=m+u.shift(),i=n+u.shift(),o=a+u.shift(),g=i+u.shift(),m=o+(u.length===1?u.shift():0),l.curveTo(n,a,i,o,g,m);break;default:ae<32?console.log("Glyph "+r.index+": unknown operator "+ae):ae<247?u.push(ae-139):ae<251?(K=q[Y],Y+=1,u.push((ae-247)*256+K+108)):ae<255?(K=q[Y],Y+=1,u.push(-(ae-251)*256-K-108)):(K=q[Y],se=q[Y+1],le=q[Y+2],pe=q[Y+3],Y+=4,u.push((K<<24|se<<16|le<<8|pe)/65536))}}}return ue(t),r.advanceWidth=H,l}function Za(e,r,t,n){var a=[],i,o=new w.Parser(e,r),l=o.parseCard8();if(l===0)for(var u=0;u=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+i+" (FD count "+n+")");a.push(i)}else if(l===3){var c=o.parseCard16(),d=o.parseCard16();if(d!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+d);for(var y,g=0;g=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+i+" (FD count "+n+")");if(y>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+y);for(;d=0&&(t=n),n=r.indexOf(e),n>=0?t=n+br.length:(t=br.length+r.length,r.push(e)),t}function Ja(){return new A.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 Ka(e){var r=new A.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);r.names=[];for(var t=0;t=t.begin&&e=1&&(t.ulCodePageRange1=n.parseULong(),t.ulCodePageRange2=n.parseULong()),t.version>=2&&(t.sxHeight=n.parseShort(),t.sCapHeight=n.parseShort(),t.usDefaultChar=n.parseUShort(),t.usBreakChar=n.parseUShort(),t.usMaxContent=n.parseUShort()),t}function Fi(e){return new A.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 Xr={parse:ki,make:Fi,unicodeRanges:qr,getUnicodeRange:Ti};function Li(e,r){var t={},n=new w.Parser(e,r);switch(t.version=n.parseVersion(),t.italicAngle=n.parseFixed(),t.underlinePosition=n.parseShort(),t.underlineThickness=n.parseShort(),t.isFixedPitch=n.parseULong(),t.minMemType42=n.parseULong(),t.maxMemType42=n.parseULong(),t.minMemType1=n.parseULong(),t.maxMemType1=n.parseULong(),t.version){case 1:t.names=Me.slice();break;case 2:t.numberOfGlyphs=n.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(var a=0;a=Me.length){var o=n.parseChar();t.names.push(n.parseString(o))}break;case 2.5:t.numberOfGlyphs=n.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(var l=0;ly.value.tag?1:-1}),r.fields=r.fields.concat(n),r.fields=r.fields.concat(a),r}function hn(e,r,t){for(var n=0;n0){var i=e.glyphs.get(a);return i.getMetrics()}}return t}function wi(e){for(var r=0,t=0;tF||u===void 0)&&F>0&&(u=F),c 123 are reserved for internal usage");if(O.name!==".notdef"){var P=O.getMetrics();r.push(P.xMin),t.push(P.yMin),n.push(P.xMax),a.push(P.yMax),o.push(P.leftSideBearing),l.push(P.rightSideBearing),i.push(O.advanceWidth)}}var I={xMin:Math.min.apply(null,r),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,n),yMax:Math.max.apply(null,a),advanceWidthMax:Math.max.apply(null,i),advanceWidthAvg:wi(i),minLeftSideBearing:Math.min.apply(null,o),maxLeftSideBearing:Math.max.apply(null,o),minRightSideBearing:Math.min.apply(null,l)};I.ascender=e.ascender,I.descender=e.descender;var H=Yt.make({flags:3,unitsPerEm:e.unitsPerEm,xMin:I.xMin,yMin:I.yMin,xMax:I.xMax,yMax:I.yMax,lowestRecPPEM:3,createdTimestamp:e.createdTimestamp}),R=Zt.make({ascender:I.ascender,descender:I.descender,advanceWidthMax:I.advanceWidthMax,minLeftSideBearing:I.minLeftSideBearing,minRightSideBearing:I.minRightSideBearing,xMaxExtent:I.maxLeftSideBearing+(I.xMax-I.xMin),numberOfHMetrics:e.glyphs.length}),B=Kt.make(e.glyphs.length),ue=Xr.make({xAvgCharWidth:Math.round(I.advanceWidthAvg),usWeightClass:e.tables.os2.usWeightClass,usWidthClass:e.tables.os2.usWidthClass,usFirstCharIndex:u,usLastCharIndex:c,ulUnicodeRange1:d,ulUnicodeRange2:y,ulUnicodeRange3:g,ulUnicodeRange4:m,fsSelection:e.tables.os2.fsSelection,sTypoAscender:I.ascender,sTypoDescender:I.descender,sTypoLineGap:0,usWinAscent:I.yMax,usWinDescent:Math.abs(I.yMin),ulCodePageRange1:1,sxHeight:hn(e,"xyvw",{yMax:Math.round(I.ascender/2)}).yMax,sCapHeight:hn(e,"HIKLEFJMNTZBDPRAGOQSUVWXY",I).yMax,usDefaultChar:e.hasChar(" ")?32:0,usBreakChar:e.hasChar(" ")?32:0}),q=Qt.make(e.glyphs),K=It.make(e.glyphs),se=e.getEnglishName("fontFamily"),le=e.getEnglishName("fontSubfamily"),pe=se+" "+le,de=e.getEnglishName("postScriptName");de||(de=se.replace(/\s/g,"")+"-"+le);var J={};for(var j in e.names)J[j]=e.names[j];J.uniqueID||(J.uniqueID={en:e.getEnglishName("manufacturer")+":"+pe}),J.postScriptName||(J.postScriptName={en:de}),J.preferredFamily||(J.preferredFamily=e.names.fontFamily),J.preferredSubfamily||(J.preferredSubfamily=e.names.fontSubfamily);var re=[],te=an.make(J,re),ne=re.length>0?Jt.make(re):void 0,oe=sn.make(),he=Xt.make(e.glyphs,{version:e.getEnglishName("version"),fullName:pe,familyName:se,weightName:le,postScriptName:de,unitsPerEm:e.unitsPerEm,fontBBox:[0,I.yMin,I.ascender,I.advanceWidthMax]}),Y=e.metas&&Object.keys(e.metas).length>0?un.make(e.metas):void 0,ae=[H,R,B,ue,te,K,oe,he,q];ne&&ae.push(ne),e.tables.gsub&&ae.push(on.make(e.tables.gsub)),Y&&ae.push(Y);for(var et=pn(ae),Mo=et.encode(),Bo=Yr(Mo),rt=et.fields,Hn=!1,Er=0;Er>>1,i=e[a].tag;if(i===r)return a;i>>1,i=e[a];if(i===r)return a;i>>1;t=e[i];var o=t.start;if(o===r)return t;o0)return t=e[n-1],r>t.end?0:t}function rr(e,r){this.font=e,this.tableName=r}rr.prototype={searchTag:Zr,binSearch:cn,getTable:function(e){var r=this.font.tables[this.tableName];return!r&&e&&(r=this.font.tables[this.tableName]=this.createDefaultTable()),r},getScriptNames:function(){var e=this.getTable();return e?e.scripts.map(function(r){return r.tag}):[]},getDefaultScriptName:function(){var e=this.getTable();if(e){for(var r=!1,t=0;t=0)return n[a].script;if(r){var i={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return n.splice(-1-a,0,i),i.script}}},getLangSysTable:function(e,r,t){var n=this.getScriptTable(e,t);if(n){if(!r||r==="dflt"||r==="DFLT")return n.defaultLangSys;var a=Zr(n.langSysRecords,r);if(a>=0)return n.langSysRecords[a].langSys;if(t){var i={tag:r,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return n.langSysRecords.splice(-1-a,0,i),i.langSys}}},getFeatureTable:function(e,r,t,n){var a=this.getLangSysTable(e,r,n);if(a){for(var i,o=a.featureIndexes,l=this.font.tables[this.tableName].features,u=0;u=l[c-1].tag,"Features must be added in alphabetical order."),i={tag:t,feature:{params:0,lookupListIndexes:[]}},l.push(i),o.push(c),i.feature}}},getLookupTables:function(e,r,t,n,a){var i=this.getFeatureTable(e,r,t,a),o=[];if(i){for(var l,u=i.lookupListIndexes,c=this.font.tables[this.tableName].lookups,d=0;d=0?t:-1;case 2:var n=vn(e.ranges,r);return n?n.index+r-n.start:-1}},expandCoverage:function(e){if(e.format===1)return e.glyphs;for(var r=[],t=e.ranges,n=0;n=0){for(var d=i.ligatureSets[c],y=0;y2)){var t=this.font,n=this._prepState;if(!n||n.ppem!==r){var a=this._fpgmState;if(!a){Ie.prototype=zi,a=this._fpgmState=new Ie("fpgm",t.tables.fpgm),a.funcs=[],a.font=t,s.DEBUG&&(console.log("---EXEC FPGM---"),a.step=-1);try{Pe(a)}catch(c){console.log("Hinting error in FPGM:"+c),this._errorState=3;return}}Ie.prototype=a,n=this._prepState=new Ie("prep",t.tables.prep),n.ppem=r;var i=t.tables.cvt;if(i)for(var o=n.cvt=new Array(i.length),l=r/t.unitsPerEm,u=0;u1))try{return yn(e,n)}catch(c){this._errorState<1&&(console.log("Hinting error:"+c),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}},yn=function(e,r){var t=r.ppem/r.font.unitsPerEm,n=t,a=e.components,i,o,l;if(Ie.prototype=r,!a)l=new Ie("glyf",e.instructions),s.DEBUG&&(console.log("---EXEC GLYPH---"),l.step=-1),Qr(e,l,t,n),o=l.gZone;else{var u=r.font;o=[],i=[];for(var c=0;c=176&&i<=183)n+=i-176+1;else if(i>=184&&i<=191)n+=(i-184+1)*2;else if(r&&a===1&&i===27)break;while(a>0);e.ip=n}function kn(e,r){s.DEBUG&&console.log(r.step,"SVTCA["+e.axis+"]"),r.fv=r.pv=r.dpv=e}function Fn(e,r){s.DEBUG&&console.log(r.step,"SPVTCA["+e.axis+"]"),r.pv=r.dpv=e}function Ln(e,r){s.DEBUG&&console.log(r.step,"SFVTCA["+e.axis+"]"),r.fv=e}function En(e,r){var t=r.stack,n=t.pop(),a=t.pop(),i=r.z2[n],o=r.z1[a];s.DEBUG&&console.log("SPVTL["+e+"]",n,a);var l,u;e?(l=i.y-o.y,u=o.x-i.x):(l=o.x-i.x,u=o.y-i.y),r.pv=r.dpv=nr(l,u)}function Un(e,r){var t=r.stack,n=t.pop(),a=t.pop(),i=r.z2[n],o=r.z1[a];s.DEBUG&&console.log("SFVTL["+e+"]",n,a);var l,u;e?(l=i.y-o.y,u=o.x-i.x):(l=o.x-i.x,u=o.y-i.y),r.fv=nr(l,u)}function Wi(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"SPVFS[]",t,n),e.pv=e.dpv=nr(n,t)}function Vi(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"SPVFS[]",t,n),e.fv=nr(n,t)}function qi(e){var r=e.stack,t=e.pv;s.DEBUG&&console.log(e.step,"GPV[]"),r.push(t.x*16384),r.push(t.y*16384)}function Xi(e){var r=e.stack,t=e.fv;s.DEBUG&&console.log(e.step,"GFV[]"),r.push(t.x*16384),r.push(t.y*16384)}function Yi(e){e.fv=e.pv,s.DEBUG&&console.log(e.step,"SFVTPV[]")}function Zi(e){var r=e.stack,t=r.pop(),n=r.pop(),a=r.pop(),i=r.pop(),o=r.pop(),l=e.z0,u=e.z1,c=l[t],d=l[n],y=u[a],g=u[i],m=e.z2[o];s.DEBUG&&console.log("ISECT[], ",t,n,a,i,o);var T=c.x,O=c.y,F=d.x,U=d.y,P=y.x,I=y.y,H=g.x,R=g.y,B=(T-F)*(I-R)-(O-U)*(P-H),ue=T*U-O*F,q=P*R-I*H;m.x=(ue*(P-H)-q*(T-F))/B,m.y=(ue*(I-R)-q*(O-U))/B}function Qi(e){e.rp0=e.stack.pop(),s.DEBUG&&console.log(e.step,"SRP0[]",e.rp0)}function Ji(e){e.rp1=e.stack.pop(),s.DEBUG&&console.log(e.step,"SRP1[]",e.rp1)}function Ki(e){e.rp2=e.stack.pop(),s.DEBUG&&console.log(e.step,"SRP2[]",e.rp2)}function ji(e){var r=e.stack.pop();switch(s.DEBUG&&console.log(e.step,"SZP0[]",r),e.zp0=r,r){case 0:e.tZone||Fr(e),e.z0=e.tZone;break;case 1:e.z0=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function $i(e){var r=e.stack.pop();switch(s.DEBUG&&console.log(e.step,"SZP1[]",r),e.zp1=r,r){case 0:e.tZone||Fr(e),e.z1=e.tZone;break;case 1:e.z1=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function es(e){var r=e.stack.pop();switch(s.DEBUG&&console.log(e.step,"SZP2[]",r),e.zp2=r,r){case 0:e.tZone||Fr(e),e.z2=e.tZone;break;case 1:e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function rs(e){var r=e.stack.pop();switch(s.DEBUG&&console.log(e.step,"SZPS[]",r),e.zp0=e.zp1=e.zp2=r,r){case 0:e.tZone||Fr(e),e.z0=e.z1=e.z2=e.tZone;break;case 1:e.z0=e.z1=e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function ts(e){e.loop=e.stack.pop(),s.DEBUG&&console.log(e.step,"SLOOP[]",e.loop)}function ns(e){s.DEBUG&&console.log(e.step,"RTG[]"),e.round=xn}function as(e){s.DEBUG&&console.log(e.step,"RTHG[]"),e.round=Ni}function is(e){var r=e.stack.pop();s.DEBUG&&console.log(e.step,"SMD[]",r),e.minDis=r/64}function ss(e){s.DEBUG&&console.log(e.step,"ELSE[]"),Tn(e,!1)}function os(e){var r=e.stack.pop();s.DEBUG&&console.log(e.step,"JMPR[]",r),e.ip+=r-1}function us(e){var r=e.stack.pop();s.DEBUG&&console.log(e.step,"SCVTCI[]",r),e.cvCutIn=r/64}function ls(e){var r=e.stack;s.DEBUG&&console.log(e.step,"DUP[]"),r.push(r[r.length-1])}function Jr(e){s.DEBUG&&console.log(e.step,"POP[]"),e.stack.pop()}function fs(e){s.DEBUG&&console.log(e.step,"CLEAR[]"),e.stack.length=0}function ps(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"SWAP[]"),r.push(t),r.push(n)}function hs(e){var r=e.stack;s.DEBUG&&console.log(e.step,"DEPTH[]"),r.push(r.length)}function cs(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"LOOPCALL[]",t,n);var a=e.ip,i=e.prog;e.prog=e.funcs[t];for(var o=0;o1?"loop "+(r.loop-l)+": ":"")+"SHP["+(e?"rp1":"rp2")+"]",c)}r.loop=1}function wn(e,r){var t=r.stack,n=e?r.rp1:r.rp2,a=(e?r.z0:r.z1)[n],i=r.fv,o=r.pv,l=t.pop(),u=r.z2[r.contours[l]],c=u;s.DEBUG&&console.log(r.step,"SHC["+e+"]",l);var d=o.distance(a,a,!1,!0);do c!==a&&i.setRelative(c,c,d,o),c=c.nextPointOnContour;while(c!==u)}function Rn(e,r){var t=r.stack,n=e?r.rp1:r.rp2,a=(e?r.z0:r.z1)[n],i=r.fv,o=r.pv,l=t.pop();s.DEBUG&&console.log(r.step,"SHZ["+e+"]",l);var u;switch(l){case 0:u=r.tZone;break;case 1:u=r.gZone;break;default:throw new Error("Invalid zone")}for(var c,d=o.distance(a,a,!1,!0),y=u.length-2,g=0;g1?"loop "+(e.loop-t)+": ":"")+"SHPIX[]",o,a),n.setRelative(l,l,a),n.touch(l)}e.loop=1}function bs(e){for(var r=e.stack,t=e.rp1,n=e.rp2,a=e.loop,i=e.z0[t],o=e.z1[n],l=e.fv,u=e.dpv,c=e.z2;a--;){var d=r.pop(),y=c[d];s.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-a)+": ":"")+"IP[]",d,t,"<->",n),l.interpolate(y,i,o,u),l.touch(y)}e.loop=1}function Dn(e,r){var t=r.stack,n=t.pop()/64,a=t.pop(),i=r.z1[a],o=r.z0[r.rp0],l=r.fv,u=r.pv;l.setRelative(i,o,n,u),l.touch(i),s.DEBUG&&console.log(r.step,"MSIRP["+e+"]",n,a),r.rp1=r.rp0,r.rp2=a,e&&(r.rp0=a)}function xs(e){for(var r=e.stack,t=e.rp0,n=e.z0[t],a=e.loop,i=e.fv,o=e.pv,l=e.z1;a--;){var u=r.pop(),c=l[u];s.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-a)+": ":"")+"ALIGNRP[]",u),i.setRelative(c,n,0,o),i.touch(c)}e.loop=1}function Ss(e){s.DEBUG&&console.log(e.step,"RTDG[]"),e.round=Gi}function An(e,r){var t=r.stack,n=t.pop(),a=t.pop(),i=r.z0[a],o=r.fv,l=r.pv,u=r.cvt[n];s.DEBUG&&console.log(r.step,"MIAP["+e+"]",n,"(",u,")",a);var c=l.distance(i,ar);e&&(Math.abs(c-u)",l),r.stack.push(Math.round(l*64))}function Os(e){s.DEBUG&&console.log(e.step,"MPPEM[]"),e.stack.push(e.ppem)}function Is(e){s.DEBUG&&console.log(e.step,"FLIPON[]"),e.autoFlip=!0}function Cs(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"LT[]",t,n),r.push(nt?1:0)}function Ds(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"GTEQ[]",t,n),r.push(n>=t?1:0)}function As(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"EQ[]",t,n),r.push(t===n?1:0)}function Ms(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"NEQ[]",t,n),r.push(t!==n?1:0)}function Bs(e){var r=e.stack,t=r.pop();s.DEBUG&&console.log(e.step,"ODD[]",t),r.push(Math.trunc(t)%2?1:0)}function Ps(e){var r=e.stack,t=r.pop();s.DEBUG&&console.log(e.step,"EVEN[]",t),r.push(Math.trunc(t)%2?0:1)}function Gs(e){var r=e.stack.pop(),t;s.DEBUG&&console.log(e.step,"IF[]",r),r||(Tn(e,!0),s.DEBUG&&console.log(e.step,t===27?"ELSE[]":"EIF[]"))}function Ns(e){s.DEBUG&&console.log(e.step,"EIF[]")}function Hs(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"AND[]",t,n),r.push(t&&n?1:0)}function _s(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"OR[]",t,n),r.push(t||n?1:0)}function zs(e){var r=e.stack,t=r.pop();s.DEBUG&&console.log(e.step,"NOT[]",t),r.push(t?0:1)}function Kr(e,r){var t=r.stack,n=t.pop(),a=r.fv,i=r.pv,o=r.ppem,l=r.deltaBase+(e-1)*16,u=r.deltaShift,c=r.z0;s.DEBUG&&console.log(r.step,"DELTAP["+e+"]",n,t);for(var d=0;d>4);if(m===o){var T=(g&15)-8;T>=0&&T++,s.DEBUG&&console.log(r.step,"DELTAPFIX",y,"by",T*u);var O=c[y];a.setRelative(O,O,T*u,i)}}}function Ws(e){var r=e.stack,t=r.pop();s.DEBUG&&console.log(e.step,"SDB[]",t),e.deltaBase=t}function Vs(e){var r=e.stack,t=r.pop();s.DEBUG&&console.log(e.step,"SDS[]",t),e.deltaShift=Math.pow(.5,t)}function qs(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"ADD[]",t,n),r.push(n+t)}function Xs(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"SUB[]",t,n),r.push(n-t)}function Ys(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"DIV[]",t,n),r.push(n*64/t)}function Zs(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"MUL[]",t,n),r.push(n*t/64)}function Qs(e){var r=e.stack,t=r.pop();s.DEBUG&&console.log(e.step,"ABS[]",t),r.push(Math.abs(t))}function Js(e){var r=e.stack,t=r.pop();s.DEBUG&&console.log(e.step,"NEG[]",t),r.push(-t)}function Ks(e){var r=e.stack,t=r.pop();s.DEBUG&&console.log(e.step,"FLOOR[]",t),r.push(Math.floor(t/64)*64)}function js(e){var r=e.stack,t=r.pop();s.DEBUG&&console.log(e.step,"CEILING[]",t),r.push(Math.ceil(t/64)*64)}function Lr(e,r){var t=r.stack,n=t.pop();s.DEBUG&&console.log(r.step,"ROUND[]"),t.push(r.round(n/64)*64)}function $s(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"WCVTF[]",t,n),e.cvt[n]=t*e.ppem/e.font.unitsPerEm}function jr(e,r){var t=r.stack,n=t.pop(),a=r.ppem,i=r.deltaBase+(e-1)*16,o=r.deltaShift;s.DEBUG&&console.log(r.step,"DELTAC["+e+"]",n,t);for(var l=0;l>4);if(d===a){var y=(c&15)-8;y>=0&&y++;var g=y*o;s.DEBUG&&console.log(r.step,"DELTACFIX",u,"by",g),r.cvt[u]+=g}}}function eo(e){var r=e.stack.pop();s.DEBUG&&console.log(e.step,"SROUND[]",r),e.round=Sn;var t;switch(r&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(e.srPeriod=t,r&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*t;break;case 32:e.srPhase=.5*t;break;case 48:e.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}r&=15,r===0?e.srThreshold=0:e.srThreshold=(r/8-.5)*t}function ro(e){var r=e.stack.pop();s.DEBUG&&console.log(e.step,"S45ROUND[]",r),e.round=Sn;var t;switch(r&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(e.srPeriod=t,r&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*t;break;case 32:e.srPhase=.5*t;break;case 48:e.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}r&=15,r===0?e.srThreshold=0:e.srThreshold=(r/8-.5)*t}function to(e){s.DEBUG&&console.log(e.step,"ROFF[]"),e.round=Pi}function no(e){s.DEBUG&&console.log(e.step,"RUTG[]"),e.round=Hi}function ao(e){s.DEBUG&&console.log(e.step,"RDTG[]"),e.round=_i}function io(e){var r=e.stack.pop();s.DEBUG&&console.log(e.step,"SCANCTRL[]",r)}function Pn(e,r){var t=r.stack,n=t.pop(),a=t.pop(),i=r.z2[n],o=r.z1[a];s.DEBUG&&console.log(r.step,"SDPVTL["+e+"]",n,a);var l,u;e?(l=i.y-o.y,u=o.x-i.x):(l=o.x-i.x,u=o.y-i.y),r.dpv=nr(l,u)}function so(e){var r=e.stack,t=r.pop(),n=0;s.DEBUG&&console.log(e.step,"GETINFO[]",t),t&1&&(n=35),t&32&&(n|=4096),r.push(n)}function oo(e){var r=e.stack,t=r.pop(),n=r.pop(),a=r.pop();s.DEBUG&&console.log(e.step,"ROLL[]"),r.push(n),r.push(t),r.push(a)}function uo(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"MAX[]",t,n),r.push(Math.max(n,t))}function lo(e){var r=e.stack,t=r.pop(),n=r.pop();s.DEBUG&&console.log(e.step,"MIN[]",t,n),r.push(Math.min(n,t))}function fo(e){var r=e.stack.pop();s.DEBUG&&console.log(e.step,"SCANTYPE[]",r)}function po(e){var r=e.stack.pop(),t=e.stack.pop();switch(s.DEBUG&&console.log(e.step,"INSTCTRL[]",r,t),r){case 1:e.inhibitGridFit=!!t;return;case 2:e.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function Ce(e,r){var t=r.stack,n=r.prog,a=r.ip;s.DEBUG&&console.log(r.step,"PUSHB["+e+"]");for(var i=0;i=0?1:-1,F=Math.abs(F),e&&(P=i.cvt[l],n&&Math.abs(F-P)":"_")+(n?"R":"_")+(a===0?"Gr":a===1?"Bl":a===2?"Wh":"")+"]",e?l+"("+i.cvt[l]+","+P+")":"",u,"(d =",O,"->",U*F,")"),i.rp1=i.rp0,i.rp2=u,r&&(i.rp0=u)}mn=[kn.bind(void 0,Fe),kn.bind(void 0,Te),Fn.bind(void 0,Fe),Fn.bind(void 0,Te),Ln.bind(void 0,Fe),Ln.bind(void 0,Te),En.bind(void 0,0),En.bind(void 0,1),Un.bind(void 0,0),Un.bind(void 0,1),Wi,Vi,qi,Xi,Yi,Zi,Qi,Ji,Ki,ji,$i,es,rs,ts,ns,as,is,ss,os,us,void 0,void 0,ls,Jr,fs,ps,hs,ds,gs,void 0,void 0,void 0,cs,vs,ms,void 0,On.bind(void 0,0),On.bind(void 0,1),In.bind(void 0,Fe),In.bind(void 0,Te),Cn.bind(void 0,0),Cn.bind(void 0,1),wn.bind(void 0,0),wn.bind(void 0,1),Rn.bind(void 0,0),Rn.bind(void 0,1),ys,bs,Dn.bind(void 0,0),Dn.bind(void 0,1),xs,Ss,An.bind(void 0,0),An.bind(void 0,1),Ts,ks,Fs,Ls,Es,Us,Mn.bind(void 0,0),Mn.bind(void 0,1),void 0,Bn.bind(void 0,0),Bn.bind(void 0,1),Os,void 0,Is,void 0,void 0,Cs,ws,Rs,Ds,As,Ms,Bs,Ps,Gs,Ns,Hs,_s,zs,Kr.bind(void 0,1),Ws,Vs,qs,Xs,Ys,Zs,Qs,Js,Ks,js,Lr.bind(void 0,0),Lr.bind(void 0,1),Lr.bind(void 0,2),Lr.bind(void 0,3),void 0,void 0,void 0,void 0,$s,Kr.bind(void 0,2),Kr.bind(void 0,3),jr.bind(void 0,1),jr.bind(void 0,2),jr.bind(void 0,3),eo,ro,void 0,void 0,to,void 0,no,ao,Jr,Jr,void 0,void 0,void 0,void 0,void 0,io,Pn.bind(void 0,0),Pn.bind(void 0,1),so,void 0,oo,uo,lo,fo,po,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,Ce.bind(void 0,1),Ce.bind(void 0,2),Ce.bind(void 0,3),Ce.bind(void 0,4),Ce.bind(void 0,5),Ce.bind(void 0,6),Ce.bind(void 0,7),Ce.bind(void 0,8),we.bind(void 0,1),we.bind(void 0,2),we.bind(void 0,3),we.bind(void 0,4),we.bind(void 0,5),we.bind(void 0,6),we.bind(void 0,7),we.bind(void 0,8),C.bind(void 0,0,0,0,0,0),C.bind(void 0,0,0,0,0,1),C.bind(void 0,0,0,0,0,2),C.bind(void 0,0,0,0,0,3),C.bind(void 0,0,0,0,1,0),C.bind(void 0,0,0,0,1,1),C.bind(void 0,0,0,0,1,2),C.bind(void 0,0,0,0,1,3),C.bind(void 0,0,0,1,0,0),C.bind(void 0,0,0,1,0,1),C.bind(void 0,0,0,1,0,2),C.bind(void 0,0,0,1,0,3),C.bind(void 0,0,0,1,1,0),C.bind(void 0,0,0,1,1,1),C.bind(void 0,0,0,1,1,2),C.bind(void 0,0,0,1,1,3),C.bind(void 0,0,1,0,0,0),C.bind(void 0,0,1,0,0,1),C.bind(void 0,0,1,0,0,2),C.bind(void 0,0,1,0,0,3),C.bind(void 0,0,1,0,1,0),C.bind(void 0,0,1,0,1,1),C.bind(void 0,0,1,0,1,2),C.bind(void 0,0,1,0,1,3),C.bind(void 0,0,1,1,0,0),C.bind(void 0,0,1,1,0,1),C.bind(void 0,0,1,1,0,2),C.bind(void 0,0,1,1,0,3),C.bind(void 0,0,1,1,1,0),C.bind(void 0,0,1,1,1,1),C.bind(void 0,0,1,1,1,2),C.bind(void 0,0,1,1,1,3),C.bind(void 0,1,0,0,0,0),C.bind(void 0,1,0,0,0,1),C.bind(void 0,1,0,0,0,2),C.bind(void 0,1,0,0,0,3),C.bind(void 0,1,0,0,1,0),C.bind(void 0,1,0,0,1,1),C.bind(void 0,1,0,0,1,2),C.bind(void 0,1,0,0,1,3),C.bind(void 0,1,0,1,0,0),C.bind(void 0,1,0,1,0,1),C.bind(void 0,1,0,1,0,2),C.bind(void 0,1,0,1,0,3),C.bind(void 0,1,0,1,1,0),C.bind(void 0,1,0,1,1,1),C.bind(void 0,1,0,1,1,2),C.bind(void 0,1,0,1,1,3),C.bind(void 0,1,1,0,0,0),C.bind(void 0,1,1,0,0,1),C.bind(void 0,1,1,0,0,2),C.bind(void 0,1,1,0,0,3),C.bind(void 0,1,1,0,1,0),C.bind(void 0,1,1,0,1,1),C.bind(void 0,1,1,0,1,2),C.bind(void 0,1,1,0,1,3),C.bind(void 0,1,1,1,0,0),C.bind(void 0,1,1,1,0,1),C.bind(void 0,1,1,1,0,2),C.bind(void 0,1,1,1,0,3),C.bind(void 0,1,1,1,1,0),C.bind(void 0,1,1,1,1,1),C.bind(void 0,1,1,1,1,2),C.bind(void 0,1,1,1,1,3)];function z(e){e=e||{},e.empty||(Ye(e.familyName,"When creating a new Font object, familyName is required."),Ye(e.styleName,"When creating a new Font object, styleName is required."),Ye(e.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),Ye(e.ascender,"When creating a new Font object, ascender is required."),Ye(e.descender,"When creating a new Font object, descender is required."),Ye(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 qe.GlyphSet(this,e.glyphs||[]),this.encoding=new Ct(this),this.position=new kr(this),this.substitution=new ye(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 bn(this)}})}z.prototype.hasChar=function(e){return this.encoding.charToGlyphIndex(e)!==null},z.prototype.charToGlyphIndex=function(e){return this.encoding.charToGlyphIndex(e)},z.prototype.charToGlyph=function(e){var r=this.charToGlyphIndex(e),t=this.glyphs.get(r);return t||(t=this.glyphs.get(0)),t},z.prototype.stringToGlyphs=function(e,r){var t=this;r=r||this.defaultRenderOptions;for(var n=[],a=0;a0,"No English "+a+" specified.")}n("fontFamily"),n("weightName"),n("manufacturer"),n("copyright"),n("version"),t(this.unitsPerEm>0,"No unitsPerEm specified.")},z.prototype.toTables=function(){return Di.fontToTable(this)},z.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},z.prototype.toArrayBuffer=function(){for(var e=this.toTables(),r=e.encode(),t=new ArrayBuffer(r.length),n=new Uint8Array(t),a=0;a1&&console.warn("Only the first kern subtable is supported."),e.skip("uLong");var n=e.parseUShort(),a=n&255;if(e.skip("uShort"),a===0){var i=e.parseUShort();e.skip("uShort",3);for(var o=0;o"u",n=t?Co:wo;n(e,function(a,i){if(a)return r(a);var o;try{o=$r(i)}catch(l){return r(l,null)}return r(null,o)})}function Ao(e){var r=tt("fs"),t=r.readFileSync(e);return $r(gn(t))}s.Font=z,s.Glyph=fe,s.Path=Z,s.BoundingBox=ke,s._parse=w,s.parse=$r,s.load=Do,s.loadSync=Ao,Object.defineProperty(s,"__esModule",{value:!0})}))});var Zn=Ur((Au,Yn)=>{"use strict";Yn.exports=function(s){s.prototype[Symbol.iterator]=function*(){for(let f=this.head;f;f=f.next)yield f.value}}});var Jn=Ur((Mu,Qn)=>{"use strict";Qn.exports=_;_.Node=He;_.create=_;function _(s){var f=this;if(f instanceof _||(f=new _),f.tail=null,f.head=null,f.length=0,s&&typeof s.forEach=="function")s.forEach(function(v){f.push(v)});else if(arguments.length>0)for(var p=0,h=arguments.length;p1)p=f;else if(this.head)h=this.head.next,p=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var v=0;h!==null;v++)p=s(p,h.value,v),h=h.next;return p};_.prototype.reduceReverse=function(s,f){var p,h=this.tail;if(arguments.length>1)p=f;else if(this.tail)h=this.tail.prev,p=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var v=this.length-1;h!==null;v--)p=s(p,h.value,v),h=h.prev;return p};_.prototype.toArray=function(){for(var s=new Array(this.length),f=0,p=this.head;p!==null;f++)s[f]=p.value,p=p.next;return s};_.prototype.toArrayReverse=function(){for(var s=new Array(this.length),f=0,p=this.tail;p!==null;f++)s[f]=p.value,p=p.prev;return s};_.prototype.slice=function(s,f){f=f||this.length,f<0&&(f+=this.length),s=s||0,s<0&&(s+=this.length);var p=new _;if(fthis.length&&(f=this.length);for(var h=0,v=this.head;v!==null&&hthis.length&&(f=this.length);for(var h=this.length,v=this.tail;v!==null&&h>f;h--)v=v.prev;for(;v!==null&&h>s;h--,v=v.prev)p.push(v.value);return p};_.prototype.splice=function(s,f,...p){s>this.length&&(s=this.length-1),s<0&&(s=this.length+s);for(var h=0,v=this.head;v!==null&&h{"use strict";var jo=Jn(),_e=Symbol("max"),Ue=Symbol("length"),Je=Symbol("lengthCalculator"),lr=Symbol("allowStale"),ze=Symbol("maxAge"),Ee=Symbol("dispose"),Kn=Symbol("noDisposeOnSet"),$=Symbol("lruList"),xe=Symbol("cache"),$n=Symbol("updateAgeOnGet"),ht=()=>1,vt=class{constructor(f){if(typeof f=="number"&&(f={max:f}),f||(f={}),f.max&&(typeof f.max!="number"||f.max<0))throw new TypeError("max must be a non-negative number");let p=this[_e]=f.max||1/0,h=f.length||ht;if(this[Je]=typeof h!="function"?ht:h,this[lr]=f.stale||!1,f.maxAge&&typeof f.maxAge!="number")throw new TypeError("maxAge must be a number");this[ze]=f.maxAge||0,this[Ee]=f.dispose,this[Kn]=f.noDisposeOnSet||!1,this[$n]=f.updateAgeOnGet||!1,this.reset()}set max(f){if(typeof f!="number"||f<0)throw new TypeError("max must be a non-negative number");this[_e]=f||1/0,ur(this)}get max(){return this[_e]}set allowStale(f){this[lr]=!!f}get allowStale(){return this[lr]}set maxAge(f){if(typeof f!="number")throw new TypeError("maxAge must be a non-negative number");this[ze]=f,ur(this)}get maxAge(){return this[ze]}set lengthCalculator(f){typeof f!="function"&&(f=ht),f!==this[Je]&&(this[Je]=f,this[Ue]=0,this[$].forEach(p=>{p.length=this[Je](p.value,p.key),this[Ue]+=p.length})),ur(this)}get lengthCalculator(){return this[Je]}get length(){return this[Ue]}get itemCount(){return this[$].length}rforEach(f,p){p=p||this;for(let h=this[$].tail;h!==null;){let v=h.prev;jn(this,f,h,p),h=v}}forEach(f,p){p=p||this;for(let h=this[$].head;h!==null;){let v=h.next;jn(this,f,h,p),h=v}}keys(){return this[$].toArray().map(f=>f.key)}values(){return this[$].toArray().map(f=>f.value)}reset(){this[Ee]&&this[$]&&this[$].length&&this[$].forEach(f=>this[Ee](f.key,f.value)),this[xe]=new Map,this[$]=new jo,this[Ue]=0}dump(){return this[$].map(f=>Rr(this,f)?!1:{k:f.key,v:f.value,e:f.now+(f.maxAge||0)}).toArray().filter(f=>f)}dumpLru(){return this[$]}set(f,p,h){if(h=h||this[ze],h&&typeof h!="number")throw new TypeError("maxAge must be a number");let v=h?Date.now():0,x=this[Je](p,f);if(this[xe].has(f)){if(x>this[_e])return Ke(this,this[xe].get(f)),!1;let k=this[xe].get(f).value;return this[Ee]&&(this[Kn]||this[Ee](f,k.value)),k.now=v,k.maxAge=h,k.value=p,this[Ue]+=x-k.length,k.length=x,this.get(f),ur(this),!0}let S=new dt(f,p,x,v,h);return S.length>this[_e]?(this[Ee]&&this[Ee](f,p),!1):(this[Ue]+=S.length,this[$].unshift(S),this[xe].set(f,this[$].head),ur(this),!0)}has(f){if(!this[xe].has(f))return!1;let p=this[xe].get(f).value;return!Rr(this,p)}get(f){return ct(this,f,!0)}peek(f){return ct(this,f,!1)}pop(){let f=this[$].tail;return f?(Ke(this,f),f.value):null}del(f){Ke(this,this[xe].get(f))}load(f){this.reset();let p=Date.now();for(let h=f.length-1;h>=0;h--){let v=f[h],x=v.e||0;if(x===0)this.set(v.k,v.v);else{let S=x-p;S>0&&this.set(v.k,v.v,S)}}}prune(){this[xe].forEach((f,p)=>ct(this,p,!1))}},ct=(s,f,p)=>{let h=s[xe].get(f);if(h){let v=h.value;if(Rr(s,v)){if(Ke(s,h),!s[lr])return}else p&&(s[$n]&&(h.value.now=Date.now()),s[$].unshiftNode(h));return v.value}},Rr=(s,f)=>{if(!f||!f.maxAge&&!s[ze])return!1;let p=Date.now()-f.now;return f.maxAge?p>f.maxAge:s[ze]&&p>s[ze]},ur=s=>{if(s[Ue]>s[_e])for(let f=s[$].tail;s[Ue]>s[_e]&&f!==null;){let p=f.prev;Ke(s,f),f=p}},Ke=(s,f)=>{if(f){let p=f.value;s[Ee]&&s[Ee](p.key,p.value),s[Ue]-=p.length,s[xe].delete(p.key),s[$].removeNode(f)}},dt=class{constructor(f,p,h,v,x){this.key=f,this.value=p,this.length=h,this.now=v,this.maxAge=x||0}},jn=(s,f,p,h)=>{let v=p.value;Rr(s,v)&&(Ke(s,p),s[lr]||(v=void 0)),v&&f.call(h,v.value,v.key,s)};ea.exports=vt});var ta=Wo(Wn());function ir(s){let f={individual:{},range:[]},p=new WeakMap;for(let h of s)at(f,h,p);return f}function at(s,f,p){for(let[h,v]of Object.entries(f.individual))if(s.individual[h])Ze(s.individual[h],v,p);else{let x=!1;for(let[S,{range:L,entry:k}]of s.range.entries()){let D=nt(Number(h),L);if(D.both!==null){x=!0,s.individual[h]=v,Ze(s.individual[h],ie(k),p),s.range.splice(S,1);for(let V of D.second)Array.isArray(V)?s.range.push({range:V,entry:ie(k)}):s.individual[V]=ie(k)}}x||(s.individual[h]=v)}for(let{range:h,entry:v}of f.range){let x=[h];for(let S=0;Sf.lookup.index||s.lookup.index===f.lookup.index&&s.lookup.subIndex>f.lookup.subIndex)&&(s.lookup=f.lookup),f.forward&&(s.forward?at(s.forward,f.forward,p):s.forward=f.forward),f.reverse&&(s.reverse?at(s.reverse,f.reverse,p):s.reverse=f.reverse))}function Vo(s,f){let p={first:[],second:[],both:null};if(s[0]f[1]){let h=Math.max(s[0],f[1]),v=s[1];p.first.push(Ge(h,v))}else if(f[1]>s[1]){let h=Math.max(s[1],f[0]),v=f[1];p.second.push(Ge(h,v))}return p}function nt(s,f){if(sf[1])return{first:[s],second:[f],both:null};let p={first:[],second:[],both:s};return f[0]s&&p.second.push(Ge(s+1,f[1])),p}function Ge(s,f){return f-s===1?s:[s,f]}function ie(s,f=new Map){if(f.has(s))return f.get(s);let p={};return f.set(s,p),s.forward&&(p.forward=Vn(s.forward,f)),s.reverse&&(p.reverse=Vn(s.reverse,f)),s.lookup&&(p.lookup={contextRange:s.lookup.contextRange.slice(),index:s.lookup.index,length:s.lookup.length,subIndex:s.lookup.subIndex,substitutions:s.lookup.substitutions.slice()}),p}function Vn(s,f=new Map){let p={};for(let[h,v]of Object.entries(s.individual))p[h]=ie(v,f);return{individual:p,range:s.range.map(({range:h,entry:v})=>({range:h.slice(),entry:ie(v,f)}))}}function sr(s,f,p,h){let v=f[h],x=s[v];if(!x)return;let S=x.lookup;if(x.reverse){let k=qo(x.reverse,f,p);(!S&&k||k&&S&&(S.index>k.index||S.index===k.index&&S.subIndex>k.subIndex))&&(S=k)}if(++h>=f.length||!x.forward)return S;let L=sr(x.forward,f,p,h);return(!S&&L||L&&S&&(S.index>L.index||S.index===L.index&&S.subIndex>L.subIndex))&&(S=L),S}function qo(s,f,p){let h=s[f[--p]],v=h&&h.lookup;for(;h&&((!v&&h.lookup||h.lookup&&v&&v.index>h.lookup.index)&&(v=h.lookup),!(--p<0||!h.reverse));)h=h.reverse[f[p]];return v}function Ir(s,f,p){let h=!1;for(let v=0;vv.start<=f&&v.end>=f);return h?h.index:null}}function ce(s){switch(s.format){case 1:return s.glyphs.map((p,h)=>({glyphId:p,index:h}));case 2:let f=[];for(let[p,h]of s.ranges.entries())h.end===h.start?f.push({glyphId:h.start,index:p}):f.push({glyphId:[h.start,h.end+1],index:p});return f}}function qn(s,f){let p=f[0],h=Cr(s,p),v=f[0]+1,x=new Map;for(;v({entry:k,substitutions:[...S.substitutions,D]})))}return x}function Re(s,f){let p=[],h=new Set;for(let v of f){if(h.has(v.entry))continue;h.add(v.entry),v.entry.forward||(v.entry.forward={individual:{},range:[]});let x={};for(let S of s)Array.isArray(S)?v.entry.forward.range.push({entry:x,range:S}):v.entry.forward.individual[S]=x;p.push({entry:x,substitutions:v.substitutions})}return p}function De(s,f){let p=[],h=new Set;for(let v of f){if(h.has(v.entry))continue;h.add(v.entry),v.entry.reverse||(v.entry.reverse={individual:{},range:[]});let x={};for(let S of s)Array.isArray(S)?v.entry.reverse.range.push({entry:x,range:S}):v.entry.reverse.individual[S]=x;p.push({entry:x,substitutions:v.substitutions})}return p}function Ne(s,f,p,h,v){let x=[];if(!Array.isArray(v))s.individual[v]={},x.push({entry:s.individual[v],substitution:Yo(f,p,h,v)});else{let S=Xo(f,p,h,v);for(let[L,k]of S){let D={};Array.isArray(L)?s.range.push({range:L,entry:D}):s.individual[L]={},x.push({entry:D,substitution:k})}}return x}function Xo(s,f,p,h){for(let v of s.filter(x=>x.sequenceIndex===p))for(let x of f[v.lookupListIndex].subtables){let S=qn(x,h);if(!Array.from(S.values()).every(L=>L!==null))return S}return new Map([[h,null]])}function Yo(s,f,p,h){for(let v of s.filter(x=>x.sequenceIndex===p))for(let x of f[v.lookupListIndex].subtables){let S=Cr(x,h);if(S!==null)return S}return null}function st(s,f,p){let h={individual:{},range:[]},v=ce(s.coverage);for(let{glyphId:x,index:S}of v){let L=s.chainRuleSets[S];if(L)for(let[k,D]of L.entries()){let V=Ne(h,D.lookupRecords,f,0,x).map(({entry:N,substitution:W})=>({entry:N,substitutions:[W]}));for(let[N,W]of D.input.entries())V=Qe([W],N+1,V,D.lookupRecords,f);for(let N of D.lookahead)V=Re([N],V);for(let N of D.backtrack)V=De([N],V);for(let{entry:N,substitutions:W}of V)N.lookup={substitutions:W,length:D.input.length+1,index:p,subIndex:k,contextRange:[-1*D.backtrack.length,1+D.input.length+D.lookahead.length]}}}return h}function ut(s,f){switch(s.format){case 2:return Array.isArray(f)?Zo(s,f):new Map([[f,ot(s,f)]]);default:return new Map([[f,null]])}}function Zo(s,f){let p=f[0],h=ot(s,p),v=f[0]+1,x=new Map;for(;v=f)return p.classId;return null}function wr(s,f){switch(s.format){case 2:let p=[];for(let h of s.ranges)h.classId===f&&(h.end===h.start?p.push(h.start):p.push([h.start,h.end+1]));return p;default:return[]}}function lt(s,f,p){let h=[],v=ce(s.coverage);for(let{glyphId:x}of v){let S=ut(s.inputClassDef,x);for(let[L,k]of S.entries()){if(k===null)continue;let D=s.chainClassSet[k];if(D)for(let[V,N]of D.entries()){let W={individual:{},range:[]},X=Ne(W,N.lookupRecords,f,0,L).map(({entry:ve,substitution:Ae})=>({entry:ve,substitutions:[Ae]}));for(let[ve,Ae]of N.input.entries())X=Qe(wr(s.inputClassDef,Ae),ve+1,X,N.lookupRecords,f);for(let ve of N.lookahead)X=Re(wr(s.lookaheadClassDef,ve),X);for(let ve of N.backtrack)X=De(wr(s.backtrackClassDef,ve),X);for(let{entry:ve,substitutions:Ae}of X)ve.lookup={substitutions:Ae,index:p,subIndex:V,length:N.input.length+1,contextRange:[-1*N.backtrack.length,1+N.input.length+N.lookahead.length]};h.push(W)}}}return ir(h)}function ft(s,f,p){let h={individual:{},range:[]},v=ce(s.inputCoverage[0]);for(let{glyphId:x}of v){let S=Ne(h,s.lookupRecords,f,0,x).map(({entry:L,substitution:k})=>({entry:L,substitutions:[k]}));for(let[L,k]of s.inputCoverage.slice(1).entries())S=Qe(ce(k).map(D=>D.glyphId),L+1,S,s.lookupRecords,f);for(let L of s.lookaheadCoverage)S=Re(ce(L).map(k=>k.glyphId),S);for(let L of s.backtrackCoverage)S=De(ce(L).map(k=>k.glyphId),S);for(let{entry:L,substitutions:k}of S)L.lookup={substitutions:k,index:p,subIndex:0,length:s.inputCoverage.length,contextRange:[-1*s.backtrackCoverage.length,s.inputCoverage.length+s.lookaheadCoverage.length]}}return h}function pt(s,f){let p={individual:{},range:[]},h=ce(s.coverage);for(let{glyphId:v,index:x}of h){let S={};Array.isArray(v)?p.range.push({entry:S,range:v}):p.individual[v]=S;let L=[{entry:S,substitutions:[s.substitutes[x]]}];for(let k of s.lookaheadCoverage)L=Re(ce(k).map(D=>D.glyphId),L);for(let k of s.backtrackCoverage)L=De(ce(k).map(D=>D.glyphId),L);for(let{entry:k,substitutions:D}of L)k.lookup={substitutions:D,index:f,subIndex:0,length:1,contextRange:[-1*s.backtrackCoverage.length,1+s.lookaheadCoverage.length]}}return p}function or(s,f=new Map){let p={};for(let[h,v]of Object.entries(s.individual))p[h]=Xn(v,f);for(let{range:h,entry:v}of s.range){let x=Xn(v,f);for(let S=h[0];S0&&(this._cache=new $o({max:p.cacheSize,length:((L,k)=>k.length)}));let v=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(L=>L.tag==="calt")||[]).reduce((L,k)=>[...L,...k.feature.lookupListIndexes],[]),x=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],S=x.filter((L,k)=>v.some(D=>D===k));for(let[L,k]of S.entries()){let D=[];switch(k.lookupType){case 6:for(let[N,W]of k.subtables.entries())switch(W.substFormat){case 1:D.push(st(W,x,N));break;case 2:D.push(lt(W,x,N));break;case 3:D.push(ft(W,x,N));break}break;case 8:for(let[N,W]of k.subtables.entries())D.push(pt(W,N));break}let V=or(ir(D));this._lookupTrees.push({tree:V,processForward:k.lookupType!==8});for(let N of Object.keys(V))this._glyphLookups[N]||(this._glyphLookups[N]=[]),this._glyphLookups[N].push(L)}}findLigatures(f){let p=this._cache&&this._cache.get(f);if(p&&!Array.isArray(p))return p;let h=[];for(let S of f)h.push(this._font.charToGlyphIndex(S));if(this._lookupTrees.length===0)return{inputGlyphs:h,outputGlyphs:h,contextRanges:[]};let v=this._findInternal(h.slice()),x={inputGlyphs:h,outputGlyphs:v.sequence,contextRanges:v.ranges};return this._cache&&this._cache.set(f,x),x}findLigatureRanges(f){if(this._lookupTrees.length===0)return[];let p=this._cache&&this._cache.get(f);if(p)return Array.isArray(p)?p:p.contextRanges;let h=[];for(let x of f)h.push(this._font.charToGlyphIndex(x));let v=this._findInternal(h);return this._cache&&this._cache.set(f,v.ranges),v.ranges}_findInternal(f){let p=[],h=this._getNextLookup(f,0);for(;h.index!==null;){let v=this._lookupTrees[h.index];if(v.processForward){let x=h.last;for(let S=h.first;S=x&&(x=S+L.length+1),S+=L.length-1}}}else for(let x=h.last-1;x>=h.first;x--){let S=sr(v.tree,f,x,x);if(S){for(let L=0;L=p){(h.index===null||L<=h.index)&&(h.index=L,h.first>v&&(h.first=v),h.last=v+1);break}}}return h}};function na(s,f){let p=ta.parse(s);return new gt(p,{cacheSize:0,...f})}function yt(s){if(typeof s!="string")throw new Error("Font family must be a string");let f={input:s,offset:0},p=[],h="";for(;f.offset=6||!/[\dA-Fa-f]/.test(p))return s.offset--,mt(f);f+=p}return mt(f)}function mt(s){return String.fromCodePoint(parseInt(s,16))}var je;async function bt(s,f){if(!je){if(typeof navigator<"u"&&"fonts"in navigator){try{let v=await navigator.permissions.request?.({name:"local-fonts"});if(v&&v.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(v){if(v.name!=="TypeError")throw v}let h={};try{let v=await navigator.fonts.query();for(let x of v)h.hasOwnProperty(x.family)||(h[x.family]=[]),h[x.family].push(x);je=Promise.resolve(h)}catch(v){console.error(v.name,v.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let h={};try{let v=await window.queryLocalFonts();for(let x of v)h.hasOwnProperty(x.family)||(h[x.family]=[]),h[x.family].push(x);je=Promise.resolve(h)}catch(v){console.error(v.name,v.message)}}je||(je=Promise.resolve({}))}let p=await je;for(let h of yt(s)){if(tu.includes(h))return;if(p.hasOwnProperty(h)&&p[h].length>0){let v=p[h][0];if("blob"in v){let S=await(await v.blob()).arrayBuffer();return na(S,{cacheSize:f})}return}}}var tu=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"];var nu=1e5;function ia(s,f=[]){let p,h,v=0,x;return s.registerCharacterJoiner(S=>{let L=s.options.fontFamily;if(L&&(v===0||p!==L)){h=void 0,v=1,p=L;let k=p;bt(k,nu).then(D=>{k===s.options.fontFamily&&(v=2,h=D,D&&s.refresh(0,s.rows-1))}).catch(D=>{k===s.options.fontFamily&&(v=3,s.options.logLevel==="debug"&&console.debug(x,new Error("Failure while loading font")),h=void 0,x=D)})}return h&&v===2?h.findLigatureRanges(S).map(k=>[k[0],k[1]]):au(S,f)})}function au(s,f){let p=[];for(let h=0;h","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","