var vn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),bt=vn(()=>{});String.prototype.codePointAt||function(){var e=function(){try{var r={},n=Object.defineProperty,a=n(r,r,r)&&n}catch{}return a}(),t=function(r){if(this==null)throw TypeError();var n=String(this),a=n.length,o=r?Number(r):0;if(o!=o&&(o=0),!(o<0||o>=a)){var s=n.charCodeAt(o),u;return s>=55296&&s<=56319&&a>o+1&&(u=n.charCodeAt(o+1),u>=56320&&u<=57343)?(s-55296)*1024+u-56320+65536:s}};e?e(String.prototype,"codePointAt",{value:t,configurable:!0,writable:!0}):String.prototype.codePointAt=t}();var St=0,xr=-3;function Oe(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function gn(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new Oe,this.dtree=new Oe}var br=new Oe,Sr=new Oe,Et=new Uint8Array(30),Ct=new Uint16Array(30),Er=new Uint8Array(30),Cr=new Uint16Array(30),mn=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lt=new Oe,oe=new Uint8Array(320);function Tr(e,t,r,n){var a,o;for(a=0;a>>=1,t}function se(e,t,r){if(!t)return r;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<>>16-t;return e.tag>>>=t,e.bitcount-=t,n+r}function ct(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<>>=1,++a,r+=t.table[a],n-=t.table[a];while(n>=0);return e.tag=o,e.bitcount-=a,t.trans[r+n]}function bn(e,t,r){var n,a,o,s,u,i;for(n=se(e,5,257),a=se(e,5,1),o=se(e,4,4),s=0;s<19;++s)oe[s]=0;for(s=0;s8;)e.sourceIndex--,e.bitcount-=8;if(t=e.source[e.sourceIndex+1],t=256*t+e.source[e.sourceIndex],r=e.source[e.sourceIndex+3],r=256*r+e.source[e.sourceIndex+2],t!==(~r&65535))return xr;for(e.sourceIndex+=4,n=t;n;--n)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,St}function En(e,t){var r=new gn(e,t),n,a,o;do{switch(n=xn(r),a=se(r,2,0),a){case 0:o=Sn(r);break;case 1:o=Mt(r,br,Sr);break;case 2:bn(r,r.ltree,r.dtree),o=Mt(r,r.ltree,r.dtree);break;default:o=xr}if(o!==St)throw new Error("Data error")}while(!n);return r.destLenthis.x2&&(this.x2=e)),typeof t=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),tthis.y2&&(this.y2=t))};ce.prototype.addX=function(e){this.addPoint(e,null)};ce.prototype.addY=function(e){this.addPoint(null,e)};ce.prototype.addBezier=function(e,t,r,n,a,o,s,u){var i=[e,t],p=[r,n],l=[a,o],h=[s,u];this.addPoint(e,t),this.addPoint(s,u);for(var c=0;c<=1;c++){var f=6*i[c]-12*p[c]+6*l[c],v=-3*i[c]+9*p[c]-9*l[c]+3*h[c],x=3*p[c]-3*i[c];if(v===0){if(f===0)continue;var m=-x/f;0=0&&i>0&&(u+=" "),u+=t(p)}return u}for(var n="",a=0;a=0&&e<=255,"Byte value should be between 0 and 255."),[e]};D.BYTE=ne(1);g.CHAR=function(e){return[e.charCodeAt(0)]};D.CHAR=ne(1);g.CHARARRAY=function(e){typeof e>"u"&&(e="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var t=[],r=0;r"u"?0:e.length};g.USHORT=function(e){return[e>>8&255,e&255]};D.USHORT=ne(2);g.SHORT=function(e){return e>=Pt&&(e=-(2*Pt-e)),[e>>8&255,e&255]};D.SHORT=ne(2);g.UINT24=function(e){return[e>>16&255,e>>8&255,e&255]};D.UINT24=ne(3);g.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]};D.ULONG=ne(4);g.LONG=function(e){return e>=Nt&&(e=-(2*Nt-e)),[e>>24&255,e>>16&255,e>>8&255,e&255]};D.LONG=ne(4);g.FIXED=g.ULONG;D.FIXED=D.ULONG;g.FWORD=g.SHORT;D.FWORD=D.SHORT;g.UFWORD=g.USHORT;D.UFWORD=D.USHORT;g.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,e&255]};D.LONGDATETIME=ne(8);g.TAG=function(e){return k.argument(e.length===4,"Tag should be exactly 4 ASCII characters."),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]};D.TAG=ne(4);g.Card8=g.BYTE;D.Card8=D.BYTE;g.Card16=g.USHORT;D.Card16=D.USHORT;g.OffSize=g.BYTE;D.OffSize=D.BYTE;g.SID=g.USHORT;D.SID=D.USHORT;g.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?g.NUMBER16(e):g.NUMBER32(e)};D.NUMBER=function(e){return g.NUMBER(e).length};g.NUMBER16=function(e){return[28,e>>8&255,e&255]};D.NUMBER16=ne(3);g.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,e&255]};D.NUMBER32=ne(5);g.REAL=function(e){var t=e.toString(),r=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);if(r){var n=parseFloat("1e"+((r[2]?+r[2]:0)+r[1].length));t=(Math.round(e*n)/n).toString()}for(var a="",o=0,s=t.length;o>8&255,t[t.length]=n&255}return t};D.UTF16=function(e){return e.length*2};var ht={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Te.MACSTRING=function(e,t,r,n){var a=ht[n];if(a!==void 0){for(var o="",s=0;s=128&&(o=r[o],o===void 0))return;n[a]=o}return n}};D.MACSTRING=function(e,t){var r=g.MACSTRING(e,t);return r!==void 0?r.length:0};function ft(e){return e>=-128&&e<=127}function kn(e,t,r){for(var n=0,a=e.length;t>8&255,i+256&255)}return o}g.VARDELTAS=function(e){for(var t=0,r=[];t=-128&&n<=127?t=Un(e,t,r):t=Dn(e,t,r)}return r};g.INDEX=function(e){for(var t=1,r=[t],n=[],a=0;a>8,t[h+1]=c&255,t=t.concat(n[l])}return t};D.TABLE=function(e){for(var t=0,r=e.fields.length,n=0;n0)return new d(this.data,this.offset+t).parseStruct(e)};d.prototype.parsePointer32=function(e){var t=this.parseOffset32();if(t>0)return new d(this.data,this.offset+t).parseStruct(e)};d.prototype.parseListOfLists=function(e){for(var t=this.parseOffset16List(),r=t.length,n=this.relativeOffset,a=new Array(r),o=0;o>1,t.skip("uShort",3),e.glyphIndexMap={};for(var s=new C.Parser(r,n+a+14),u=new C.Parser(r,n+a+16+o*2),i=new C.Parser(r,n+a+16+o*4),p=new C.Parser(r,n+a+16+o*6),l=n+a+16+o*8,h=0;h=0;a-=1){var o=C.getUShort(e,t+4+a*8),s=C.getUShort(e,t+4+a*8+2);if(o===3&&(s===0||s===1||s===10)||o===0&&(s===0||s===1||s===2||s===3||s===4)){n=C.getULong(e,t+4+a*8+4);break}}if(n===-1)throw new Error("No valid cmap sub-tables found.");var u=new C.Parser(e,t+n);if(r.format=u.parseUShort(),r.format===12)Ln(r,u);else if(r.format===4)In(r,u,e,t,n);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+r.format+").");return r}function Gn(e,t,r){e.segments.push({end:t,start:t,delta:-(t-r),offset:0,glyphIndex:r})}function Pn(e){e.segments.push({end:65535,start:65535,delta:1,offset:0})}function Nn(e){var t=!0,r;for(r=e.length-1;r>0;r-=1){var n=e.get(r);if(n.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),t=!1;break}}var a=[{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||(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 o=new b.Table("cmap",a);for(o.segments=[],r=0;r>4,s=a&15;if(o===r||(t+=n[o],s===r))break;t+=n[s]}return parseFloat(t)}function $n(e,t){var r,n,a,o;if(t===28)return r=e.parseByte(),n=e.parseByte(),r<<8|n;if(t===29)return r=e.parseByte(),n=e.parseByte(),a=e.parseByte(),o=e.parseByte(),r<<24|n<<16|a<<8|o;if(t===30)return Jn(e);if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.parseByte(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.parseByte(),-(t-251)*256-r-108;throw new Error("Invalid b0 "+t)}function ea(e){for(var t={},r=0;r>1,i.length=0,l=!0}function O(T){for(var P,Y,j,J,$,M,N,W,q,_,H,V,w=0;w1&&!l&&(B=i.shift()+y,l=!0),f+=i.pop(),A(c,f);break;case 5:for(;i.length>0;)c+=i.shift(),f+=i.shift(),u.lineTo(c,f);break;case 6:for(;i.length>0&&(c+=i.shift(),u.lineTo(c,f),i.length!==0);)f+=i.shift(),u.lineTo(c,f);break;case 7:for(;i.length>0&&(f+=i.shift(),u.lineTo(c,f),i.length!==0);)c+=i.shift(),u.lineTo(c,f);break;case 8:for(;i.length>0;)n=c+i.shift(),a=f+i.shift(),o=n+i.shift(),s=a+i.shift(),c=o+i.shift(),f=s+i.shift(),u.curveTo(n,a,o,s,c,f);break;case 10:$=i.pop()+x,M=v[$],M&&O(M);break;case 11:return;case 12:switch(X=T[w],w+=1,X){case 35:n=c+i.shift(),a=f+i.shift(),o=n+i.shift(),s=a+i.shift(),N=o+i.shift(),W=s+i.shift(),q=N+i.shift(),_=W+i.shift(),H=q+i.shift(),V=_+i.shift(),c=H+i.shift(),f=V+i.shift(),i.shift(),u.curveTo(n,a,o,s,N,W),u.curveTo(q,_,H,V,c,f);break;case 34:n=c+i.shift(),a=f,o=n+i.shift(),s=a+i.shift(),N=o+i.shift(),W=s,q=N+i.shift(),_=s,H=q+i.shift(),V=f,c=H+i.shift(),u.curveTo(n,a,o,s,N,W),u.curveTo(q,_,H,V,c,f);break;case 36:n=c+i.shift(),a=f+i.shift(),o=n+i.shift(),s=a+i.shift(),N=o+i.shift(),W=s,q=N+i.shift(),_=s,H=q+i.shift(),V=_+i.shift(),c=H+i.shift(),u.curveTo(n,a,o,s,N,W),u.curveTo(q,_,H,V,c,f);break;case 37:n=c+i.shift(),a=f+i.shift(),o=n+i.shift(),s=a+i.shift(),N=o+i.shift(),W=s+i.shift(),q=N+i.shift(),_=W+i.shift(),H=q+i.shift(),V=_+i.shift(),Math.abs(H-c)>Math.abs(V-f)?c=H+i.shift():f=V+i.shift(),u.curveTo(n,a,o,s,N,W),u.curveTo(q,_,H,V,c,f);break;default:console.log("Glyph "+t.index+": unknown operator 1200"+X),i.length=0}break;case 14:i.length>0&&!l&&(B=i.shift()+y,l=!0),h&&(u.closePath(),h=!1);break;case 18:F();break;case 19:case 20:F(),w+=p+7>>3;break;case 21:i.length>2&&!l&&(B=i.shift()+y,l=!0),f+=i.pop(),c+=i.pop(),A(c,f);break;case 22:i.length>1&&!l&&(B=i.shift()+y,l=!0),c+=i.pop(),A(c,f);break;case 23:F();break;case 24:for(;i.length>2;)n=c+i.shift(),a=f+i.shift(),o=n+i.shift(),s=a+i.shift(),c=o+i.shift(),f=s+i.shift(),u.curveTo(n,a,o,s,c,f);c+=i.shift(),f+=i.shift(),u.lineTo(c,f);break;case 25:for(;i.length>6;)c+=i.shift(),f+=i.shift(),u.lineTo(c,f);n=c+i.shift(),a=f+i.shift(),o=n+i.shift(),s=a+i.shift(),c=o+i.shift(),f=s+i.shift(),u.curveTo(n,a,o,s,c,f);break;case 26:for(i.length%2&&(c+=i.shift());i.length>0;)n=c,a=f+i.shift(),o=n+i.shift(),s=a+i.shift(),c=o,f=s+i.shift(),u.curveTo(n,a,o,s,c,f);break;case 27:for(i.length%2&&(f+=i.shift());i.length>0;)n=c+i.shift(),a=f,o=n+i.shift(),s=a+i.shift(),c=o+i.shift(),f=s,u.curveTo(n,a,o,s,c,f);break;case 28:P=T[w],Y=T[w+1],i.push((P<<24|Y<<16)>>16),w+=2;break;case 29:$=i.pop()+e.gsubrsBias,M=e.gsubrs[$],M&&O(M);break;case 30:for(;i.length>0&&(n=c,a=f+i.shift(),o=n+i.shift(),s=a+i.shift(),c=o+i.shift(),f=s+(i.length===1?i.shift():0),u.curveTo(n,a,o,s,c,f),i.length!==0);)n=c+i.shift(),a=f,o=n+i.shift(),s=a+i.shift(),f=s+i.shift(),c=o+(i.length===1?i.shift():0),u.curveTo(n,a,o,s,c,f);break;case 31:for(;i.length>0&&(n=c+i.shift(),a=f,o=n+i.shift(),s=a+i.shift(),f=s+i.shift(),c=o+(i.length===1?i.shift():0),u.curveTo(n,a,o,s,c,f),i.length!==0);)n=c,a=f+i.shift(),o=n+i.shift(),s=a+i.shift(),c=o+i.shift(),f=s+(i.length===1?i.shift():0),u.curveTo(n,a,o,s,c,f);break;default:X<32?console.log("Glyph "+t.index+": unknown operator "+X):X<247?i.push(X-139):X<251?(P=T[w],w+=1,i.push((X-247)*256+P+108)):X<255?(P=T[w],w+=1,i.push(-(X-251)*256-P-108)):(P=T[w],Y=T[w+1],j=T[w+2],J=T[w+3],w+=4,i.push((P<<24|Y<<16|j<<8|J)/65536))}}}return O(r),t.advanceWidth=B,u}function oa(e,t,r,n){var a=[],o,s=new C.Parser(e,t),u=s.parseCard8();if(u===0)for(var i=0;i=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+n+")");a.push(o)}else if(u===3){var p=s.parseCard16(),l=s.parseCard16();if(l!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+l);for(var h,c=0;c=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+n+")");if(h>r)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+h);for(;l=0&&(r=n),n=t.indexOf(e),n>=0?r=n+_e.length:(r=_e.length+t.length,t.push(e)),r}function ia(){return new b.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 ua(e){var t=new b.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);t.names=[];for(var r=0;r=r.begin&&e=1&&(r.ulCodePageRange1=n.parseULong(),r.ulCodePageRange2=n.parseULong()),r.version>=2&&(r.sxHeight=n.parseShort(),r.sCapHeight=n.parseShort(),r.usDefaultChar=n.parseUShort(),r.usBreakChar=n.parseUShort(),r.usMaxContent=n.parseUShort()),r}function Ga(e){return new b.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 yt={parse:Ma,make:Ga,unicodeRanges:mt,getUnicodeRange:Ia};function Pa(e,t){var r={},n=new C.Parser(e,t);switch(r.version=n.parseVersion(),r.italicAngle=n.parseFixed(),r.underlinePosition=n.parseShort(),r.underlineThickness=n.parseShort(),r.isFixedPitch=n.parseULong(),r.minMemType42=n.parseULong(),r.maxMemType42=n.parseULong(),r.minMemType1=n.parseULong(),r.maxMemType1=n.parseULong(),r.version){case 1:r.names=xe.slice();break;case 2:r.numberOfGlyphs=n.parseUShort(),r.glyphNameIndex=new Array(r.numberOfGlyphs);for(var a=0;a=xe.length){var s=n.parseChar();r.names.push(n.parseString(s))}break;case 2.5:r.numberOfGlyphs=n.parseUShort(),r.offset=new Array(r.numberOfGlyphs);for(var u=0;uh.value.tag?1:-1}),t.fields=t.fields.concat(n),t.fields=t.fields.concat(a),t}function Qt(e,t,r){for(var n=0;n0){var o=e.glyphs.get(a);return o.getMetrics()}}return r}function _a(e){for(var t=0,r=0;rm||i===void 0)&&m>0&&(i=m),p 123 are reserved for internal usage");if(x.name!==".notdef"){var U=x.getMetrics();t.push(U.xMin),r.push(U.yMin),n.push(U.xMax),a.push(U.yMax),s.push(U.leftSideBearing),u.push(U.rightSideBearing),o.push(x.advanceWidth)}}var S={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,r),xMax:Math.max.apply(null,n),yMax:Math.max.apply(null,a),advanceWidthMax:Math.max.apply(null,o),advanceWidthAvg:_a(o),minLeftSideBearing:Math.min.apply(null,s),maxLeftSideBearing:Math.max.apply(null,s),minRightSideBearing:Math.min.apply(null,u)};S.ascender=e.ascender,S.descender=e.descender;var B=Nr.make({flags:3,unitsPerEm:e.unitsPerEm,xMin:S.xMin,yMin:S.yMin,xMax:S.xMax,yMax:S.yMax,lowestRecPPEM:3,createdTimestamp:e.createdTimestamp}),A=Hr.make({ascender:S.ascender,descender:S.descender,advanceWidthMax:S.advanceWidthMax,minLeftSideBearing:S.minLeftSideBearing,minRightSideBearing:S.minRightSideBearing,xMaxExtent:S.maxLeftSideBearing+(S.xMax-S.xMin),numberOfHMetrics:e.glyphs.length}),F=qr.make(e.glyphs.length),O=yt.make(Object.assign({xAvgCharWidth:Math.round(S.advanceWidthAvg),usFirstCharIndex:i,usLastCharIndex:p,ulUnicodeRange1:l,ulUnicodeRange2:h,ulUnicodeRange3:c,ulUnicodeRange4:f,sTypoAscender:S.ascender,sTypoDescender:S.descender,sTypoLineGap:0,usWinAscent:S.yMax,usWinDescent:Math.abs(S.yMin),ulCodePageRange1:1,sxHeight:Qt(e,"xyvw",{yMax:Math.round(S.ascender/2)}).yMax,sCapHeight:Qt(e,"HIKLEFJMNTZBDPRAGOQSUVWXY",S).yMax,usDefaultChar:e.hasChar(" ")?32:0,usBreakChar:e.hasChar(" ")?32:0},e.tables.os2)),T=zr.make(e.glyphs),P=Dr.make(e.glyphs),Y=e.getEnglishName("fontFamily"),j=e.getEnglishName("fontSubfamily"),J=Y+" "+j,$=e.getEnglishName("postScriptName");$||($=Y.replace(/\s/g,"")+"-"+j);var M={};for(var N in e.names)M[N]=e.names[N];M.uniqueID||(M.uniqueID={en:e.getEnglishName("manufacturer")+":"+J}),M.postScriptName||(M.postScriptName={en:$}),M.preferredFamily||(M.preferredFamily=e.names.fontFamily),M.preferredSubfamily||(M.preferredSubfamily=e.names.fontSubfamily);var W=[],q=jr.make(M,W),_=W.length>0?Wr.make(W):void 0,H=Zr.make(),V=Pr.make(e.glyphs,{version:e.getEnglishName("version"),fullName:J,familyName:Y,weightName:j,postScriptName:$,unitsPerEm:e.unitsPerEm,fontBBox:[0,S.yMin,S.ascender,S.advanceWidthMax]}),w=e.metas&&Object.keys(e.metas).length>0?Kr.make(e.metas):void 0,X=[B,A,F,O,q,P,H,V,T];_&&X.push(_),e.tables.gsub&&X.push(Qr.make(e.tables.gsub)),w&&X.push(w);for(var et=Jr(X),fn=et.encode(),dn=Dt(fn),tt=et.fields,wt=!1,Pe=0;Pe>>1,o=e[a].tag;if(o===t)return a;o>>1,o=e[a];if(o===t)return a;o>>1;r=e[o];var s=r.start;if(s===t)return r;s0)return r=e[n-1],t>r.end?0:r}function we(e,t){this.font=e,this.tableName=t}we.prototype={searchTag:at,binSearch:Kt,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(t){return t.tag}):[]},getDefaultScriptName:function(){var e=this.getTable();if(e){for(var t=!1,r=0;r=0)return n[a].script;if(t){var o={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return n.splice(-1-a,0,o),o.script}}},getLangSysTable:function(e,t,r){var n=this.getScriptTable(e,r);if(n){if(!t||t==="dflt"||t==="DFLT")return n.defaultLangSys;var a=at(n.langSysRecords,t);if(a>=0)return n.langSysRecords[a].langSys;if(r){var o={tag:t,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return n.langSysRecords.splice(-1-a,0,o),o.langSys}}},getFeatureTable:function(e,t,r,n){var a=this.getLangSysTable(e,t,n);if(a){for(var o,s=a.featureIndexes,u=this.font.tables[this.tableName].features,i=0;i=u[p-1].tag,"Features must be added in alphabetical order."),o={tag:r,feature:{params:0,lookupListIndexes:[]}},u.push(o),s.push(p),o.feature}}},getLookupTables:function(e,t,r,n,a){var o=this.getFeatureTable(e,t,r,a),s=[];if(o){for(var u,i=o.lookupListIndexes,p=this.font.tables[this.tableName].lookups,l=0;l=0?r:-1;case 2:var n=Jt(e.ranges,t);return n?n.index+t-n.start:-1}},expandCoverage:function(e){if(e.format===1)return e.glyphs;for(var t=[],r=e.ranges,n=0;n1,'Multiple: "by" must be an array of two or more ids');var a=this.getLookupTables(r,n,e,2,!0)[0],o=At(a,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});k.assert(o.coverage.format===1,"Multiple: unable to modify coverage table format "+o.coverage.format);var s=t.sub,u=this.binSearch(o.coverage.glyphs,s);u<0&&(u=-1-u,o.coverage.glyphs.splice(u,0,s),o.sequences.splice(u,0,0)),o.sequences[u]=t.by};Q.prototype.addAlternate=function(e,t,r,n){var a=this.getLookupTables(r,n,e,3,!0)[0],o=At(a,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});k.assert(o.coverage.format===1,"Alternate: unable to modify coverage table format "+o.coverage.format);var s=t.sub,u=this.binSearch(o.coverage.glyphs,s);u<0&&(u=-1-u,o.coverage.glyphs.splice(u,0,s),o.alternateSets.splice(u,0,0)),o.alternateSets[u]=t.by};Q.prototype.addLigature=function(e,t,r,n){var a=this.getLookupTables(r,n,e,4,!0)[0],o=a.subtables[0];o||(o={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},a.subtables[0]=o),k.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);var s=t.sub[0],u=t.sub.slice(1),i={ligGlyph:t.by,components:u},p=this.binSearch(o.coverage.glyphs,s);if(p>=0){for(var l=o.ligatureSets[p],h=0;h0?(o=e.parseByte(),!(t&a)&&(o=-o),o=r+o):(t&a)>0?o=r:o=r+e.parseShort(),o}function en(e,t,r){var n=new C.Parser(t,r);e.numberOfContours=n.parseShort(),e._xMin=n.parseShort(),e._yMin=n.parseShort(),e._xMax=n.parseShort(),e._yMax=n.parseShort();var a,o;if(e.numberOfContours>0){for(var s=e.endPointIndices=[],u=0;u0)for(var h=n.parseByte(),c=0;c0){var f=[],v;if(p>0){for(var x=0;x=0,f.push(v);for(var m=0,y=0;y0?(a&2)>0?(A.dx=n.parseShort(),A.dy=n.parseShort()):A.matchedPoints=[n.parseUShort(),n.parseUShort()]:(a&2)>0?(A.dx=n.parseChar(),A.dy=n.parseChar()):A.matchedPoints=[n.parseByte(),n.parseByte()],(a&8)>0?A.xScale=A.yScale=n.parseF2Dot14():(a&64)>0?(A.xScale=n.parseF2Dot14(),A.yScale=n.parseF2Dot14()):(a&128)>0&&(A.xScale=n.parseF2Dot14(),A.scale01=n.parseF2Dot14(),A.scale10=n.parseF2Dot14(),A.yScale=n.parseF2Dot14()),e.components.push(A),B=!!(a&32)}if(a&256){e.instructionLength=n.parseUShort(),e.instructions=[];for(var F=0;Ft.points.length-1||n.matchedPoints[1]>a.points.length-1)throw Error("Matched points out of range in "+t.name);var s=t.points[n.matchedPoints[0]],u=a.points[n.matchedPoints[1]],i={xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:0,dy:0};u=ot([u],i)[0],i.dx=s.x-u.x,i.dy=s.y-u.y,o=ot(a.points,i)}t.points=t.points.concat(o)}}return tn(t.points)}function Ka(e,t,r,n){for(var a=new ue.GlyphSet(n),o=0;o2)){var r=this.font,n=this._prepState;if(!n||n.ppem!==t){var a=this._fpgmState;if(!a){ve.prototype=oo,a=this._fpgmState=new ve("fpgm",r.tables.fpgm),a.funcs=[],a.font=r,exports.DEBUG&&(console.log("---EXEC FPGM---"),a.step=-1);try{Se(a)}catch(p){console.log("Hinting error in FPGM:"+p),this._errorState=3;return}}ve.prototype=a,n=this._prepState=new ve("prep",r.tables.prep),n.ppem=t;var o=r.tables.cvt;if(o)for(var s=n.cvt=new Array(o.length),u=t/r.unitsPerEm,i=0;i1))try{return on(e,n)}catch(p){this._errorState<1&&(console.log("Hinting error:"+p),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}};on=function(e,t){var r=t.ppem/t.font.unitsPerEm,n=r,a=e.components,o,s,u;if(ve.prototype=t,!a)u=new ve("glyf",e.instructions),exports.DEBUG&&(console.log("---EXEC GLYPH---"),u.step=-1),xt(e,u,r,n),s=u.gZone;else{var i=t.font;s=[],o=[];for(var p=0;p=176&&o<=183)n+=o-176+1;else if(o>=184&&o<=191)n+=(o-184+1)*2;else if(t&&a===1&&o===27)break;while(a>0);e.ip=n}function er(e,t){exports.DEBUG&&console.log(t.step,"SVTCA["+e.axis+"]"),t.fv=t.pv=t.dpv=e}function tr(e,t){exports.DEBUG&&console.log(t.step,"SPVTCA["+e.axis+"]"),t.pv=t.dpv=e}function rr(e,t){exports.DEBUG&&console.log(t.step,"SFVTCA["+e.axis+"]"),t.fv=e}function nr(e,t){var r=t.stack,n=r.pop(),a=r.pop(),o=t.z2[n],s=t.z1[a];exports.DEBUG&&console.log("SPVTL["+e+"]",n,a);var u,i;e?(u=o.y-s.y,i=s.x-o.x):(u=s.x-o.x,i=s.y-o.y),t.pv=t.dpv=Me(u,i)}function ar(e,t){var r=t.stack,n=r.pop(),a=r.pop(),o=t.z2[n],s=t.z1[a];exports.DEBUG&&console.log("SFVTL["+e+"]",n,a);var u,i;e?(u=o.y-s.y,i=s.x-o.x):(u=s.x-o.x,i=s.y-o.y),t.fv=Me(u,i)}function so(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"SPVFS[]",r,n),e.pv=e.dpv=Me(n,r)}function io(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"SPVFS[]",r,n),e.fv=Me(n,r)}function uo(e){var t=e.stack,r=e.pv;exports.DEBUG&&console.log(e.step,"GPV[]"),t.push(r.x*16384),t.push(r.y*16384)}function lo(e){var t=e.stack,r=e.fv;exports.DEBUG&&console.log(e.step,"GFV[]"),t.push(r.x*16384),t.push(r.y*16384)}function po(e){e.fv=e.pv,exports.DEBUG&&console.log(e.step,"SFVTPV[]")}function co(e){var t=e.stack,r=t.pop(),n=t.pop(),a=t.pop(),o=t.pop(),s=t.pop(),u=e.z0,i=e.z1,p=u[r],l=u[n],h=i[a],c=i[o],f=e.z2[s];exports.DEBUG&&console.log("ISECT[], ",r,n,a,o,s);var v=p.x,x=p.y,m=l.x,y=l.y,U=h.x,S=h.y,B=c.x,A=c.y,F=(v-m)*(S-A)-(x-y)*(U-B),O=v*y-x*m,T=U*A-S*B;f.x=(O*(U-B)-T*(v-m))/F,f.y=(O*(S-A)-T*(x-y))/F}function ho(e){e.rp0=e.stack.pop(),exports.DEBUG&&console.log(e.step,"SRP0[]",e.rp0)}function fo(e){e.rp1=e.stack.pop(),exports.DEBUG&&console.log(e.step,"SRP1[]",e.rp1)}function vo(e){e.rp2=e.stack.pop(),exports.DEBUG&&console.log(e.step,"SRP2[]",e.rp2)}function go(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"SZP0[]",t),e.zp0=t,t){case 0:e.tZone||Je(e),e.z0=e.tZone;break;case 1:e.z0=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function mo(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"SZP1[]",t),e.zp1=t,t){case 0:e.tZone||Je(e),e.z1=e.tZone;break;case 1:e.z1=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function yo(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"SZP2[]",t),e.zp2=t,t){case 0:e.tZone||Je(e),e.z2=e.tZone;break;case 1:e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function xo(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"SZPS[]",t),e.zp0=e.zp1=e.zp2=t,t){case 0:e.tZone||Je(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 bo(e){e.loop=e.stack.pop(),exports.DEBUG&&console.log(e.step,"SLOOP[]",e.loop)}function So(e){exports.DEBUG&&console.log(e.step,"RTG[]"),e.round=un}function Eo(e){exports.DEBUG&&console.log(e.step,"RTHG[]"),e.round=ro}function Co(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SMD[]",t),e.minDis=t/64}function To(e){exports.DEBUG&&console.log(e.step,"ELSE[]"),pn(e,!1)}function ko(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"JMPR[]",t),e.ip+=t-1}function Uo(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SCVTCI[]",t),e.cvCutIn=t/64}function Do(e){var t=e.stack;exports.DEBUG&&console.log(e.step,"DUP[]"),t.push(t[t.length-1])}function st(e){exports.DEBUG&&console.log(e.step,"POP[]"),e.stack.pop()}function Ao(e){exports.DEBUG&&console.log(e.step,"CLEAR[]"),e.stack.length=0}function Oo(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"SWAP[]"),t.push(r),t.push(n)}function Bo(e){var t=e.stack;exports.DEBUG&&console.log(e.step,"DEPTH[]"),t.push(t.length)}function Ro(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"LOOPCALL[]",r,n);var a=e.ip,o=e.prog;e.prog=e.funcs[r];for(var s=0;s1?"loop "+(t.loop-u)+": ":"")+"SHP["+(e?"rp1":"rp2")+"]",p)}t.loop=1}function ur(e,t){var r=t.stack,n=e?t.rp1:t.rp2,a=(e?t.z0:t.z1)[n],o=t.fv,s=t.pv,u=r.pop(),i=t.z2[t.contours[u]],p=i;exports.DEBUG&&console.log(t.step,"SHC["+e+"]",u);var l=s.distance(a,a,!1,!0);do p!==a&&o.setRelative(p,p,l,s),p=p.nextPointOnContour;while(p!==i)}function lr(e,t){var r=t.stack,n=e?t.rp1:t.rp2,a=(e?t.z0:t.z1)[n],o=t.fv,s=t.pv,u=r.pop();exports.DEBUG&&console.log(t.step,"SHZ["+e+"]",u);var i;switch(u){case 0:i=t.tZone;break;case 1:i=t.gZone;break;default:throw new Error("Invalid zone")}for(var p,l=s.distance(a,a,!1,!0),h=i.length-2,c=0;c1?"loop "+(e.loop-r)+": ":"")+"SHPIX[]",s,a),n.setRelative(u,u,a),n.touch(u)}e.loop=1}function Go(e){for(var t=e.stack,r=e.rp1,n=e.rp2,a=e.loop,o=e.z0[r],s=e.z1[n],u=e.fv,i=e.dpv,p=e.z2;a--;){var l=t.pop(),h=p[l];exports.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-a)+": ":"")+"IP[]",l,r,"<->",n),u.interpolate(h,o,s,i),u.touch(h)}e.loop=1}function pr(e,t){var r=t.stack,n=r.pop()/64,a=r.pop(),o=t.z1[a],s=t.z0[t.rp0],u=t.fv,i=t.pv;u.setRelative(o,s,n,i),u.touch(o),exports.DEBUG&&console.log(t.step,"MSIRP["+e+"]",n,a),t.rp1=t.rp0,t.rp2=a,e&&(t.rp0=a)}function Po(e){for(var t=e.stack,r=e.rp0,n=e.z0[r],a=e.loop,o=e.fv,s=e.pv,u=e.z1;a--;){var i=t.pop(),p=u[i];exports.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-a)+": ":"")+"ALIGNRP[]",i),o.setRelative(p,n,0,s),o.touch(p)}e.loop=1}function No(e){exports.DEBUG&&console.log(e.step,"RTDG[]"),e.round=to}function cr(e,t){var r=t.stack,n=r.pop(),a=r.pop(),o=t.z0[a],s=t.fv,u=t.pv,i=t.cvt[n];exports.DEBUG&&console.log(t.step,"MIAP["+e+"]",n,"(",i,")",a);var p=u.distance(o,Fe);e&&(Math.abs(p-i)",u),t.stack.push(Math.round(u*64))}function Vo(e){exports.DEBUG&&console.log(e.step,"MPPEM[]"),e.stack.push(e.ppem)}function Yo(e){exports.DEBUG&&console.log(e.step,"FLIPON[]"),e.autoFlip=!0}function jo(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"LT[]",r,n),t.push(nr?1:0)}function Ko(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"GTEQ[]",r,n),t.push(n>=r?1:0)}function Jo(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"EQ[]",r,n),t.push(r===n?1:0)}function $o(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"NEQ[]",r,n),t.push(r!==n?1:0)}function es(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"ODD[]",r),t.push(Math.trunc(r)%2?1:0)}function ts(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"EVEN[]",r),t.push(Math.trunc(r)%2?0:1)}function rs(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"IF[]",t),t||(pn(e,!0),exports.DEBUG&&console.log(e.step,"EIF[]"))}function ns(e){exports.DEBUG&&console.log(e.step,"EIF[]")}function as(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"AND[]",r,n),t.push(r&&n?1:0)}function os(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"OR[]",r,n),t.push(r||n?1:0)}function ss(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"NOT[]",r),t.push(r?0:1)}function it(e,t){var r=t.stack,n=r.pop(),a=t.fv,o=t.pv,s=t.ppem,u=t.deltaBase+(e-1)*16,i=t.deltaShift,p=t.z0;exports.DEBUG&&console.log(t.step,"DELTAP["+e+"]",n,r);for(var l=0;l>4);if(f===s){var v=(c&15)-8;v>=0&&v++,exports.DEBUG&&console.log(t.step,"DELTAPFIX",h,"by",v*i);var x=p[h];a.setRelative(x,x,v*i,o)}}}function is(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"SDB[]",r),e.deltaBase=r}function us(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"SDS[]",r),e.deltaShift=Math.pow(.5,r)}function ls(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"ADD[]",r,n),t.push(n+r)}function ps(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"SUB[]",r,n),t.push(n-r)}function cs(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"DIV[]",r,n),t.push(n*64/r)}function hs(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"MUL[]",r,n),t.push(n*r/64)}function fs(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"ABS[]",r),t.push(Math.abs(r))}function ds(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"NEG[]",r),t.push(-r)}function vs(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"FLOOR[]",r),t.push(Math.floor(r/64)*64)}function gs(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"CEILING[]",r),t.push(Math.ceil(r/64)*64)}function qe(e,t){var r=t.stack,n=r.pop();exports.DEBUG&&console.log(t.step,"ROUND[]"),r.push(t.round(n/64)*64)}function ms(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"WCVTF[]",r,n),e.cvt[n]=r*e.ppem/e.font.unitsPerEm}function ut(e,t){var r=t.stack,n=r.pop(),a=t.ppem,o=t.deltaBase+(e-1)*16,s=t.deltaShift;exports.DEBUG&&console.log(t.step,"DELTAC["+e+"]",n,r);for(var u=0;u>4);if(l===a){var h=(p&15)-8;h>=0&&h++;var c=h*s;exports.DEBUG&&console.log(t.step,"DELTACFIX",i,"by",c),t.cvt[i]+=c}}}function ys(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SROUND[]",t),e.round=ln;var r;switch(t&192){case 0:r=.5;break;case 64:r=1;break;case 128:r=2;break;default:throw new Error("invalid SROUND value")}switch(e.srPeriod=r,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*r;break;case 32:e.srPhase=.5*r;break;case 48:e.srPhase=.75*r;break;default:throw new Error("invalid SROUND value")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*r}function xs(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"S45ROUND[]",t),e.round=ln;var r;switch(t&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 new Error("invalid S45ROUND value")}switch(e.srPeriod=r,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*r;break;case 32:e.srPhase=.5*r;break;case 48:e.srPhase=.75*r;break;default:throw new Error("invalid S45ROUND value")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*r}function bs(e){exports.DEBUG&&console.log(e.step,"ROFF[]"),e.round=eo}function Ss(e){exports.DEBUG&&console.log(e.step,"RUTG[]"),e.round=no}function Es(e){exports.DEBUG&&console.log(e.step,"RDTG[]"),e.round=ao}function Cs(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SCANCTRL[]",t)}function dr(e,t){var r=t.stack,n=r.pop(),a=r.pop(),o=t.z2[n],s=t.z1[a];exports.DEBUG&&console.log(t.step,"SDPVTL["+e+"]",n,a);var u,i;e?(u=o.y-s.y,i=s.x-o.x):(u=s.x-o.x,i=s.y-o.y),t.dpv=Me(u,i)}function Ts(e){var t=e.stack,r=t.pop(),n=0;exports.DEBUG&&console.log(e.step,"GETINFO[]",r),r&1&&(n=35),r&32&&(n|=4096),t.push(n)}function ks(e){var t=e.stack,r=t.pop(),n=t.pop(),a=t.pop();exports.DEBUG&&console.log(e.step,"ROLL[]"),t.push(n),t.push(r),t.push(a)}function Us(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"MAX[]",r,n),t.push(Math.max(n,r))}function Ds(e){var t=e.stack,r=t.pop(),n=t.pop();exports.DEBUG&&console.log(e.step,"MIN[]",r,n),t.push(Math.min(n,r))}function As(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SCANTYPE[]",t)}function Os(e){var t=e.stack.pop(),r=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"INSTCTRL[]",t,r),t){case 1:e.inhibitGridFit=!!r;return;case 2:e.ignoreCvt=!!r;return;default:throw new Error("invalid INSTCTRL[] selector")}}function he(e,t){var r=t.stack,n=t.prog,a=t.ip;exports.DEBUG&&console.log(t.step,"PUSHB["+e+"]");for(var o=0;o=0?1:-1,m=Math.abs(m),e&&(U=o.cvt[u],n&&Math.abs(m-U)":"_")+(n?"R":"_")+(a===0?"Gr":a===1?"Bl":a===2?"Wh":"")+"]",e?u+"("+o.cvt[u]+","+U+")":"",i,"(d =",x,"->",y*m,")"),o.rp1=o.rp0,o.rp2=i,t&&(o.rp0=i)}an=[er.bind(void 0,le),er.bind(void 0,ie),tr.bind(void 0,le),tr.bind(void 0,ie),rr.bind(void 0,le),rr.bind(void 0,ie),nr.bind(void 0,0),nr.bind(void 0,1),ar.bind(void 0,0),ar.bind(void 0,1),so,io,uo,lo,po,co,ho,fo,vo,go,mo,yo,xo,bo,So,Eo,Co,To,ko,Uo,void 0,void 0,Do,st,Ao,Oo,Bo,wo,Lo,void 0,void 0,void 0,Ro,Fo,Io,void 0,or.bind(void 0,0),or.bind(void 0,1),sr.bind(void 0,le),sr.bind(void 0,ie),ir.bind(void 0,0),ir.bind(void 0,1),ur.bind(void 0,0),ur.bind(void 0,1),lr.bind(void 0,0),lr.bind(void 0,1),Mo,Go,pr.bind(void 0,0),pr.bind(void 0,1),Po,No,cr.bind(void 0,0),cr.bind(void 0,1),Ho,zo,Wo,qo,_o,Xo,hr.bind(void 0,0),hr.bind(void 0,1),void 0,fr.bind(void 0,0),fr.bind(void 0,1),Vo,void 0,Yo,void 0,void 0,jo,Zo,Qo,Ko,Jo,$o,es,ts,rs,ns,as,os,ss,it.bind(void 0,1),is,us,ls,ps,cs,hs,fs,ds,vs,gs,qe.bind(void 0,0),qe.bind(void 0,1),qe.bind(void 0,2),qe.bind(void 0,3),void 0,void 0,void 0,void 0,ms,it.bind(void 0,2),it.bind(void 0,3),ut.bind(void 0,1),ut.bind(void 0,2),ut.bind(void 0,3),ys,xs,void 0,void 0,bs,void 0,Ss,Es,st,st,void 0,void 0,void 0,void 0,void 0,Cs,dr.bind(void 0,0),dr.bind(void 0,1),Ts,void 0,ks,Us,Ds,As,Os,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,he.bind(void 0,1),he.bind(void 0,2),he.bind(void 0,3),he.bind(void 0,4),he.bind(void 0,5),he.bind(void 0,6),he.bind(void 0,7),he.bind(void 0,8),fe.bind(void 0,1),fe.bind(void 0,2),fe.bind(void 0,3),fe.bind(void 0,4),fe.bind(void 0,5),fe.bind(void 0,6),fe.bind(void 0,7),fe.bind(void 0,8),E.bind(void 0,0,0,0,0,0),E.bind(void 0,0,0,0,0,1),E.bind(void 0,0,0,0,0,2),E.bind(void 0,0,0,0,0,3),E.bind(void 0,0,0,0,1,0),E.bind(void 0,0,0,0,1,1),E.bind(void 0,0,0,0,1,2),E.bind(void 0,0,0,0,1,3),E.bind(void 0,0,0,1,0,0),E.bind(void 0,0,0,1,0,1),E.bind(void 0,0,0,1,0,2),E.bind(void 0,0,0,1,0,3),E.bind(void 0,0,0,1,1,0),E.bind(void 0,0,0,1,1,1),E.bind(void 0,0,0,1,1,2),E.bind(void 0,0,0,1,1,3),E.bind(void 0,0,1,0,0,0),E.bind(void 0,0,1,0,0,1),E.bind(void 0,0,1,0,0,2),E.bind(void 0,0,1,0,0,3),E.bind(void 0,0,1,0,1,0),E.bind(void 0,0,1,0,1,1),E.bind(void 0,0,1,0,1,2),E.bind(void 0,0,1,0,1,3),E.bind(void 0,0,1,1,0,0),E.bind(void 0,0,1,1,0,1),E.bind(void 0,0,1,1,0,2),E.bind(void 0,0,1,1,0,3),E.bind(void 0,0,1,1,1,0),E.bind(void 0,0,1,1,1,1),E.bind(void 0,0,1,1,1,2),E.bind(void 0,0,1,1,1,3),E.bind(void 0,1,0,0,0,0),E.bind(void 0,1,0,0,0,1),E.bind(void 0,1,0,0,0,2),E.bind(void 0,1,0,0,0,3),E.bind(void 0,1,0,0,1,0),E.bind(void 0,1,0,0,1,1),E.bind(void 0,1,0,0,1,2),E.bind(void 0,1,0,0,1,3),E.bind(void 0,1,0,1,0,0),E.bind(void 0,1,0,1,0,1),E.bind(void 0,1,0,1,0,2),E.bind(void 0,1,0,1,0,3),E.bind(void 0,1,0,1,1,0),E.bind(void 0,1,0,1,1,1),E.bind(void 0,1,0,1,1,2),E.bind(void 0,1,0,1,1,3),E.bind(void 0,1,1,0,0,0),E.bind(void 0,1,1,0,0,1),E.bind(void 0,1,1,0,0,2),E.bind(void 0,1,1,0,0,3),E.bind(void 0,1,1,0,1,0),E.bind(void 0,1,1,0,1,1),E.bind(void 0,1,1,0,1,2),E.bind(void 0,1,1,0,1,3),E.bind(void 0,1,1,1,0,0),E.bind(void 0,1,1,1,0,1),E.bind(void 0,1,1,1,0,2),E.bind(void 0,1,1,1,0,3),E.bind(void 0,1,1,1,1,0),E.bind(void 0,1,1,1,1,1),E.bind(void 0,1,1,1,1,2),E.bind(void 0,1,1,1,1,3)];function Ue(e){this.char=e,this.state={},this.activeState=null}function Ot(e,t,r){this.contextName=r,this.startIndex=e,this.endOffset=t}function Bs(e,t,r){this.contextName=e,this.openRange=null,this.ranges=[],this.checkStart=t,this.checkEnd=r}function te(e,t){this.context=e,this.index=t,this.length=e.length,this.current=e[t],this.backtrack=e.slice(0,t),this.lookahead=e.slice(t+1)}function $e(e){this.eventId=e,this.subscribers=[]}function Rs(e){var t=this,r=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];r.forEach(function(a){Object.defineProperty(t.events,a,{value:new $e(a)})}),e&&r.forEach(function(a){var o=e[a];typeof o=="function"&&t.events[a].subscribe(o)});var n=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];n.forEach(function(a){t.events[a].subscribe(t.updateContextsRanges)})}function L(e){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],Rs.call(this,e)}Ue.prototype.setState=function(e,t){return this.state[e]=t,this.activeState={key:e,value:this.state[e]},this.activeState};Ue.prototype.getState=function(e){return this.state[e]||null};L.prototype.inboundIndex=function(e){return e>=0&&e0&&e<=this.lookahead.length):return this.lookahead[e-1];default:return null}};L.prototype.rangeToText=function(e){if(e instanceof Ot)return this.getRangeTokens(e).map(function(t){return t.char}).join("")};L.prototype.getText=function(){return this.tokens.map(function(e){return e.char}).join("")};L.prototype.getContext=function(e){var t=this.registeredContexts[e];return t||null};L.prototype.on=function(e,t){var r=this.events[e];return r?r.subscribe(t):null};L.prototype.dispatch=function(e,t){var r=this,n=this.events[e];n instanceof $e&&n.subscribers.forEach(function(a){a.apply(r,t||[])})};L.prototype.registerContextChecker=function(e,t,r){if(this.getContext(e))return{FAIL:"context name '"+e+"' is already registered."};if(typeof t!="function")return{FAIL:"missing context start check."};if(typeof r!="function")return{FAIL:"missing context end check."};var n=new Bs(e,t,r);return this.registeredContexts[e]=n,this.contextCheckers.push(n),n};L.prototype.getRangeTokens=function(e){var t=e.startIndex+e.endOffset;return[].concat(this.tokens.slice(e.startIndex,t))};L.prototype.getContextRanges=function(e){var t=this.getContext(e);return t?t.ranges:{FAIL:"context checker '"+e+"' is not registered."}};L.prototype.resetContextsRanges=function(){var e=this.registeredContexts;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];r.ranges=[]}};L.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var e=this.tokens.map(function(n){return n.char}),t=0;t=a.start&&e<=a.end){var o=e-a.start;return a.index+o}}break;default:return-1}return-1}function ws(e,t){var r=Ge(e,t.coverage);return r===-1?null:e+t.deltaGlyphId}function Ls(e,t){var r=Ge(e,t.coverage);return r===-1?null:t.substitute[r]}function lt(e,t){for(var r=[],n=0;n=0;r--){var n=t[r],a=cn(n),o=me(n);if(!a&&!o)return!0;if(a)return!1}return!1}function Zs(e){if(cn(e.current))return!1;for(var t=0;t0}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm>0};R.prototype.toTables=function(){return Va.fontToTable(this)};R.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()};R.prototype.toArrayBuffer=function(){for(var e=this.toTables(),t=e.encode(),r=new ArrayBuffer(t.length),n=new Uint8Array(r),a=0;a=1.2&&(a.markGlyphSets=r.parsePointer(yi)),a}var bi={parse:xi},re=new Array(10);re[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(d.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(d.coverage),values:this.parseValueRecordList()};k.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")};re[2]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();k.assert(t===1||t===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var r=this.parsePointer(d.coverage),n=this.parseUShort(),a=this.parseUShort();if(t===1)return{posFormat:t,coverage:r,valueFormat1:n,valueFormat2:a,pairSets:this.parseList(d.pointer(d.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(n),value2:this.parseValueRecord(a)}})))};if(t===2){var o=this.parsePointer(d.classDef),s=this.parsePointer(d.classDef),u=this.parseUShort(),i=this.parseUShort();return{posFormat:t,coverage:r,valueFormat1:n,valueFormat2:a,classDef1:o,classDef2:s,class1Count:u,class2Count:i,classRecords:this.parseList(u,d.list(i,function(){return{value1:this.parseValueRecord(n),value2:this.parseValueRecord(a)}}))}}};re[3]=function(){return{error:"GPOS Lookup 3 not supported"}};re[4]=function(){return{error:"GPOS Lookup 4 not supported"}};re[5]=function(){return{error:"GPOS Lookup 5 not supported"}};re[6]=function(){return{error:"GPOS Lookup 6 not supported"}};re[7]=function(){return{error:"GPOS Lookup 7 not supported"}};re[8]=function(){return{error:"GPOS Lookup 8 not supported"}};re[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function Si(e,t){t=t||0;var r=new d(e,t),n=r.parseVersion(1);return k.argument(n===1||n===1.1,"Unsupported GPOS table version "+n),n===1?{version:n,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(re)}:{version:n,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(re),variations:r.parseFeatureVariationsList()}}var Ei=new Array(10);function Ci(e){return new b.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new b.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new b.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new b.LookupList(e.lookups,Ei)}])}var Ti={parse:Si,make:Ci};function ki(e){var t={};e.skip("uShort");var r=e.parseUShort();k.argument(r===0,"Unsupported kern sub-table version."),e.skip("uShort",2);var n=e.parseUShort();e.skip("uShort",3);for(var 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 o=e.parseUShort();e.skip("uShort",3);for(var s=0;s"u",a=n&&!r.isUrl?Ri:Fi;return new Promise(function(o,s){a(e,function(u,i){if(u){if(t)return t(u);s(u)}var p;try{p=Ft(i,r)}catch(l){if(t)return t(l,null);s(l)}if(t)return t(null,p);o(p)})})}function Ii(e,t){var r=bt(),n=r.readFileSync(e);return Ft($r(n),t)}var Mi=Object.freeze({__proto__:null,Font:R,Glyph:Z,Path:G,BoundingBox:ce,_parse:C,parse:Ft,load:Li,loadSync:Ii}),Gi=Mi;export{ae as Bidi,ce as BoundingBox,R as Font,Z as Glyph,G as Path,C as _parse,Gi as default,Li as load,Ii as loadSync,Ft as parse};