UNPKG

modern-text

Version:

Measure and render text in a way that describes the DOM.

1 lines 190 kB
(function(H,te){typeof exports=="object"&&typeof module<"u"?te(exports):typeof define=="function"&&define.amd?define(["exports"],te):(H=typeof globalThis<"u"?globalThis:H||self,te(H.modernText={}))})(this,function(H){"use strict";function te(n,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:i,x1:o,y1:s,stops:a}=ts(t,e.left,e.top,e.width,e.height),l=n.createLinearGradient(r,i,o,s);return a.forEach(c=>l.addColorStop(c.offset,c.color)),l}return t}function Te(n,t,e){n?.color&&(n.color=te(e,n.color,t)),n?.backgroundColor&&(n.backgroundColor=te(e,n.backgroundColor,t)),n?.textStrokeColor&&(n.textStrokeColor=te(e,n.textStrokeColor,t))}function ts(n,t,e,r,i){const o=n.match(/linear-gradient\((.+)\)$/)?.[1]??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),u=(Number(a.replace("deg",""))||0)*Math.PI/180,h=r*Math.sin(u),p=i*Math.cos(u);return{x0:t+r/2-h,y0:e+i/2+p,x1:t+r/2+h,y1:e+i/2-p,stops:Array.from(l).map(d=>{let f=d[2];return f.startsWith("(")?f=f.split(",").length>3?`rgba${f}`:`rgb${f}`:f=`#${f}`,{offset:Number(d[3].replace("%",""))/100,color:f}})}}function he(n){const{ctx:t,path:e,fontSize:r,clipRect:i}=n;t.save(),t.beginPath();const o=e.style,s={...o,fill:n.color??o.fill,stroke:n.textStrokeColor??o.stroke,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*r:o.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round",shadowOffsetX:(n.shadowOffsetX??0)*r,shadowOffsetY:(n.shadowOffsetY??0)*r,shadowBlur:(n.shadowBlur??0)*r,shadowColor:n.shadowColor};i&&(t.rect(i.left,i.top,i.width,i.height),t.clip(),t.beginPath()),e.drawTo(t,s),t.restore()}function dr(n,t,e){const{left:r,top:i,width:o,height:s}=e,a=n.canvas;a.dataset.viewBox=`${r} ${i} ${o} ${s}`,a.dataset.pixelRatio=String(t);const l=o,c=s;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(c*t)),a.style.width=`${l}px`,a.style.height=`${c}px`,n.clearRect(0,0,a.width,a.height),n.scale(t,t),n.translate(-r,-i)}function gr(n,t){const{paragraphs:e,computedStyle:r,glyphBox:i}=t;Te(r,i,n),e.forEach(o=>{Te(o.computedStyle,o.lineBox,n),o.fragments.forEach(s=>{Te(s.computedStyle,s.inlineBox,n)})})}var ut=Uint8Array,At=Uint16Array,Pn=Int32Array,Xe=new ut([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ze=new ut([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Tn=new ut([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yr=function(n,t){for(var e=new At(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var i=new Pn(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)i[o]=o-e[r]<<5|r;return{b:e,r:i}},mr=yr(Xe,2),xr=mr.b,_n=mr.r;xr[28]=258,_n[258]=28;for(var vr=yr(Ze,0),es=vr.b,wr=vr.r,kn=new At(32768),K=0;K<32768;++K){var ee=(K&43690)>>1|(K&21845)<<1;ee=(ee&52428)>>2|(ee&13107)<<2,ee=(ee&61680)>>4|(ee&3855)<<4,kn[K]=((ee&65280)>>8|(ee&255)<<8)>>1}for(var Rt=function(n,t,e){for(var r=n.length,i=0,o=new At(t);i<r;++i)n[i]&&++o[n[i]-1];var s=new At(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(e){a=new At(1<<t);var l=15-t;for(i=0;i<r;++i)if(n[i])for(var c=i<<4|n[i],u=t-n[i],h=s[n[i]-1]++<<u,p=h|(1<<u)-1;h<=p;++h)a[kn[h]>>l]=c}else for(a=new At(r),i=0;i<r;++i)n[i]&&(a[i]=kn[s[n[i]-1]++]>>15-n[i]);return a},ne=new ut(288),K=0;K<144;++K)ne[K]=8;for(var K=144;K<256;++K)ne[K]=9;for(var K=256;K<280;++K)ne[K]=7;for(var K=280;K<288;++K)ne[K]=8;for(var _e=new ut(32),K=0;K<32;++K)_e[K]=5;var ns=Rt(ne,9,0),rs=Rt(ne,9,1),is=Rt(_e,5,0),ss=Rt(_e,5,1),An=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},Ft=function(n,t,e){var r=t/8|0;return(n[r]|n[r+1]<<8)>>(t&7)&e},In=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},On=function(n){return(n+7)/8|0},br=function(n,t,e){return(e==null||e>n.length)&&(e=n.length),new ut(n.subarray(t,e))},os=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ut=function(n,t,e){var r=new Error(t||os[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Ut),!e)throw r;return r},as=function(n,t,e,r){var i=n.length,o=0;if(!i||t.f&&!t.l)return e||new ut(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new ut(i*3));var c=function(Mt){var _t=e.length;if(Mt>_t){var ht=new ut(Math.max(_t*2,Mt));ht.set(e),e=ht}},u=t.f||0,h=t.p||0,p=t.b||0,d=t.l,f=t.d,m=t.m,g=t.n,M=i*8;do{if(!d){u=Ft(n,h,1);var P=Ft(n,h+1,3);if(h+=3,P)if(P==1)d=rs,f=ss,m=9,g=5;else if(P==2){var x=Ft(n,h,31)+257,S=Ft(n,h+10,15)+4,b=x+Ft(n,h+5,31)+1;h+=14;for(var D=new ut(b),N=new ut(19),E=0;E<S;++E)N[Tn[E]]=Ft(n,h+E*3,7);h+=S*3;for(var L=An(N),z=(1<<L)-1,B=Rt(N,L,1),E=0;E<b;){var A=B[Ft(n,h,z)];h+=A&15;var w=A>>4;if(w<16)D[E++]=w;else{var W=0,I=0;for(w==16?(I=3+Ft(n,h,3),h+=2,W=D[E-1]):w==17?(I=3+Ft(n,h,7),h+=3):w==18&&(I=11+Ft(n,h,127),h+=7);I--;)D[E++]=W}}var U=D.subarray(0,x),j=D.subarray(x);m=An(U),g=An(j),d=Rt(U,m,1),f=Rt(j,g,1)}else Ut(1);else{var w=On(h)+4,C=n[w-4]|n[w-3]<<8,v=w+C;if(v>i){l&&Ut(0);break}a&&c(p+C),e.set(n.subarray(w,v),p),t.b=p+=C,t.p=h=v*8,t.f=u;continue}if(h>M){l&&Ut(0);break}}a&&c(p+131072);for(var O=(1<<m)-1,V=(1<<g)-1,_=h;;_=h){var W=d[In(n,h)&O],T=W>>4;if(h+=W&15,h>M){l&&Ut(0);break}if(W||Ut(2),T<256)e[p++]=T;else if(T==256){_=h,d=null;break}else{var F=T-254;if(T>264){var E=T-257,$=Xe[E];F=Ft(n,h,(1<<$)-1)+xr[E],h+=$}var q=f[In(n,h)&V],Z=q>>4;q||Ut(3),h+=q&15;var j=es[Z];if(Z>3){var $=Ze[Z];j+=In(n,h)&(1<<$)-1,h+=$}if(h>M){l&&Ut(0);break}a&&c(p+131072);var nt=p+F;if(p<j){var Zt=o-j,Dt=Math.min(j,nt);for(Zt+p<0&&Ut(3);p<Dt;++p)e[p]=r[Zt+p]}for(;p<nt;++p)e[p]=e[p-j]}}t.l=d,t.p=_,t.b=p,t.f=u,d&&(u=1,t.m=m,t.d=f,t.n=g)}while(!u);return p!=e.length&&s?br(e,0,p):e.subarray(0,p)},Yt=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8},ke=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8,n[r+2]|=e>>16},En=function(n,t){for(var e=[],r=0;r<n.length;++r)n[r]&&e.push({s:r,f:n[r]});var i=e.length,o=e.slice();if(!i)return{t:Pr,l:0};if(i==1){var s=new ut(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,x){return v.f-x.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],c=0,u=1,h=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=e[e[c].f<e[h].f?c++:h++],l=e[c!=u&&e[c].f<e[h].f?c++:h++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};for(var p=o[0].s,r=1;r<i;++r)o[r].s>p&&(p=o[r].s);var d=new At(p+1),f=Bn(e[u-1],d,0);if(f>t){var r=0,m=0,g=f-t,M=1<<g;for(o.sort(function(x,S){return d[S.s]-d[x.s]||x.f-S.f});r<i;++r){var P=o[r].s;if(d[P]>t)m+=M-(1<<f-d[P]),d[P]=t;else break}for(m>>=g;m>0;){var w=o[r].s;d[w]<t?m-=1<<t-d[w]++-1:++r}for(;r>=0&&m;--r){var C=o[r].s;d[C]==t&&(--d[C],++m)}f=t}return{t:new ut(d),l:f}},Bn=function(n,t,e){return n.s==-1?Math.max(Bn(n.l,t,e+1),Bn(n.r,t,e+1)):t[n.s]=e},Sr=function(n){for(var t=n.length;t&&!n[--t];);for(var e=new At(++t),r=0,i=n[0],o=1,s=function(l){e[r++]=l},a=1;a<=t;++a)if(n[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=n[a]}return{c:e.subarray(0,r),n:t}},Ae=function(n,t){for(var e=0,r=0;r<t.length;++r)e+=n[r]*t[r];return e},Cr=function(n,t,e){var r=e.length,i=On(t+2);n[i]=r&255,n[i+1]=r>>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var o=0;o<r;++o)n[i+o+4]=e[o];return(i+4+r)*8},Mr=function(n,t,e,r,i,o,s,a,l,c,u){Yt(t,u++,e),++i[256];for(var h=En(i,15),p=h.t,d=h.l,f=En(o,15),m=f.t,g=f.l,M=Sr(p),P=M.c,w=M.n,C=Sr(m),v=C.c,x=C.n,S=new At(19),b=0;b<P.length;++b)++S[P[b]&31];for(var b=0;b<v.length;++b)++S[v[b]&31];for(var D=En(S,7),N=D.t,E=D.l,L=19;L>4&&!N[Tn[L-1]];--L);var z=c+5<<3,B=Ae(i,ne)+Ae(o,_e)+s,A=Ae(i,p)+Ae(o,m)+s+14+3*L+Ae(S,N)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&z<=B&&z<=A)return Cr(t,u,n.subarray(l,l+c));var W,I,U,j;if(Yt(t,u,1+(A<B)),u+=2,A<B){W=Rt(p,d,0),I=p,U=Rt(m,g,0),j=m;var O=Rt(N,E,0);Yt(t,u,w-257),Yt(t,u+5,x-1),Yt(t,u+10,L-4),u+=14;for(var b=0;b<L;++b)Yt(t,u+3*b,N[Tn[b]]);u+=3*L;for(var V=[P,v],_=0;_<2;++_)for(var T=V[_],b=0;b<T.length;++b){var F=T[b]&31;Yt(t,u,O[F]),u+=N[F],F>15&&(Yt(t,u,T[b]>>5&127),u+=T[b]>>12)}}else W=ns,I=ne,U=is,j=_e;for(var b=0;b<a;++b){var $=r[b];if($>255){var F=$>>18&31;ke(t,u,W[F+257]),u+=I[F+257],F>7&&(Yt(t,u,$>>23&31),u+=Xe[F]);var q=$&31;ke(t,u,U[q]),u+=j[q],q>3&&(ke(t,u,$>>5&8191),u+=Ze[q])}else ke(t,u,W[$]),u+=I[$]}return ke(t,u,W[256]),u+I[256]},ls=new Pn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Pr=new ut(0),cs=function(n,t,e,r,i,o){var s=o.z||n.length,a=new ut(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),c=o.l,u=(o.r||0)&7;if(t){u&&(l[0]=o.r>>3);for(var h=ls[t-1],p=h>>13,d=h&8191,f=(1<<e)-1,m=o.p||new At(32768),g=o.h||new At(f+1),M=Math.ceil(e/3),P=2*M,w=function(kt){return(n[kt]^n[kt+1]<<M^n[kt+2]<<P)&f},C=new Pn(25e3),v=new At(288),x=new At(32),S=0,b=0,D=o.i||0,N=0,E=o.w||0,L=0;D+2<s;++D){var z=w(D),B=D&32767,A=g[z];if(m[B]=A,g[z]=B,E<=D){var W=s-D;if((S>7e3||N>24576)&&(W>423||!c)){u=Mr(n,l,0,C,v,x,b,N,L,D-L,u),N=S=b=0,L=D;for(var I=0;I<286;++I)v[I]=0;for(var I=0;I<30;++I)x[I]=0}var U=2,j=0,O=d,V=B-A&32767;if(W>2&&z==w(D-V))for(var _=Math.min(p,W)-1,T=Math.min(32767,D),F=Math.min(258,W);V<=T&&--O&&B!=A;){if(n[D+U]==n[D+U-V]){for(var $=0;$<F&&n[D+$]==n[D+$-V];++$);if($>U){if(U=$,j=V,$>_)break;for(var q=Math.min(V,$-2),Z=0,I=0;I<q;++I){var nt=D-V+I&32767,Zt=m[nt],Dt=nt-Zt&32767;Dt>Z&&(Z=Dt,A=nt)}}}B=A,A=m[B],V+=B-A&32767}if(j){C[N++]=268435456|_n[U]<<18|wr[j];var Mt=_n[U]&31,_t=wr[j]&31;b+=Xe[Mt]+Ze[_t],++v[257+Mt],++x[_t],E=D+U,++S}else C[N++]=n[D],++v[n[D]]}}for(D=Math.max(D,E);D<s;++D)C[N++]=n[D],++v[n[D]];u=Mr(n,l,c,C,v,x,b,N,L,D-L,u),c||(o.r=u&7|l[u/8|0]<<3,u-=7,o.h=g,o.p=m,o.i=D,o.w=E)}else{for(var D=o.w||0;D<s+c;D+=65535){var ht=D+65535;ht>=s&&(l[u/8|0]=c,ht=s),u=Cr(l,u+1,n.subarray(D,ht))}o.i=s}return br(a,0,r+On(u)+i)},Tr=function(){var n=1,t=0;return{p:function(e){for(var r=n,i=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)i+=r+=e[s];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}n=r,t=i},d:function(){return n%=65521,t%=65521,(n&255)<<24|(n&65280)<<8|(t&255)<<8|t>>8}}},hs=function(n,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ut(o.length+n.length);s.set(o),s.set(n,o.length),n=s,i.w=o.length}return cs(n,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+t.mem,e,r,i)},_r=function(n,t,e){for(;e;++t)n[t]=e,e>>>=8},us=function(n,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(n[0]=120,n[1]=r<<6|(t.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,t.dictionary){var i=Tr();i.p(t.dictionary),_r(n,2,i.d())}},fs=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Ut(6,"invalid zlib data"),(n[1]>>5&1)==1&&Ut(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function ps(n,t){t||(t={});var e=Tr();e.p(n);var r=hs(n,t,t.dictionary?6:2,4);return us(r,t),_r(r,r.length-4,e.d()),r}function ds(n,t){return as(n.subarray(fs(n),-4),{i:2},t,t)}var gs=typeof TextDecoder<"u"&&new TextDecoder,ys=0;try{gs.decode(Pr,{stream:!0}),ys=1}catch{}const ms="modern-font";function Ie(n,t){if(!n)throw new Error(`[${ms}] ${t}`)}function xs(n){if("buffer"in n){const t=n.buffer;return n.byteOffset>0||n.byteLength<n.buffer.byteLength?t.slice(n.byteOffset,n.byteOffset+n.byteLength):t}else return n}function ye(n){return"buffer"in n?new DataView(n.buffer,n.byteOffset,n.byteLength):new DataView(n)}function vs(n){let t="";for(let e=0,r=n.length,i;e<r;e++)i=n.charCodeAt(e),i!==0&&(t+=String.fromCharCode(i));return t}function Ye(n){n=vs(n);const t=[];for(let e=0,r=n.length,i;e<r;e++)i=n.charCodeAt(e),t.push(i>>8),t.push(i&255);return t}function ws(n){let t="";for(let e=0,r=n.length;e<r;e++)n[e]<127?t+=String.fromCharCode(n[e]):t+=`%${(256+n[e]).toString(16).slice(1)}`;return unescape(t)}function bs(n){let t="";for(let e=0,r=n.length;e<r;e+=2)t+=String.fromCharCode((n[e]<<8)+n[e+1]);return t}var Ss=Object.defineProperty,ft=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ss(t,e,i),i};const Ke={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(n,t){Object.defineProperty(n.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class lt extends DataView{constructor(t,e,r,i){super(xs(t),e,r),this.littleEndian=i}cursor=0;readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,i)=>this.read(t.type,t.offset+i));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,i)=>{this.write(t.type,e[i],t.offset+i)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const i=`get${t.replace(/^\S/,l=>l.toUpperCase())}`,o=this,a=o[i]?.bind(o)?.(e,r);return this.cursor+=Ke[t],a}readUint24(t=this.cursor){const[e,r,i]=this.readBytes(t,3);return(e<<16)+(r<<8)+i}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let i=0;i<e;++i)r.push(this.getUint8(t+i));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let i="";for(let o=0,s=r.length;o<s;o++)i+=String.fromCharCode(r[o]);return i}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),i=new Date;return i.setTime(r*1e3+-20775456e5),i}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,i=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const o=`set${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,l=s[o]?.bind(s)?.(r,e,i);return this.cursor+=Ke[t.toLowerCase()],l}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let i=0,o=t.length,s;i<o;++i)s=t.charCodeAt(i)||0,s>127?this.writeUint16(s):this.writeUint8(s);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const i=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(i,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let i=0;i<r;++i)this.setUint8(e+i,t[i])}else{const i=ye(t);r=i.byteLength;for(let o=0;o<r;++o)this.setUint8(e+o,i.getUint8(o))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}ft([pt()],lt.prototype,"readInt8"),ft([pt()],lt.prototype,"readInt16"),ft([pt()],lt.prototype,"readInt32"),ft([pt()],lt.prototype,"readUint8"),ft([pt()],lt.prototype,"readUint16"),ft([pt()],lt.prototype,"readUint32"),ft([pt()],lt.prototype,"readFloat32"),ft([pt()],lt.prototype,"readFloat64"),ft([pt()],lt.prototype,"writeInt8"),ft([pt()],lt.prototype,"writeInt16"),ft([pt()],lt.prototype,"writeInt32"),ft([pt()],lt.prototype,"writeUint8"),ft([pt()],lt.prototype,"writeUint16"),ft([pt()],lt.prototype,"writeUint32"),ft([pt()],lt.prototype,"writeFloat32"),ft([pt()],lt.prototype,"writeFloat64");const kr=new WeakMap;function y(n){const t=typeof n=="object"?n:{type:n},{size:e=1,type:r}=t;return(i,o)=>{if(typeof o!="string")return;let s=kr.get(i);s||(s={columns:[],byteLength:0},kr.set(i,s));const a={...t,name:o,byteLength:e*Ke[r],offset:t.offset??s.columns.reduce((l,c)=>l+c.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,c)=>l+Ke[c.type]*(c.size??1),0),Object.defineProperty(i.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Ot{view;constructor(t,e,r,i){this.view=new lt(t,e,r,i)}}class Dn extends Ot{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var Cs=Object.defineProperty,vt=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Cs(t,e,i),i};const wt=class Yi extends Dn{format="EmbeddedOpenType";mimeType="application/vnd.ms-fontobject";static from(t){const e=t.sfnt,i=e.name.names,o=Ye(i.fontFamily||""),s=o.length,a=Ye(i.fontStyle||""),l=a.length,c=Ye(i.version||""),u=c.length,h=Ye(i.fullName||""),p=h.length,d=86+s+4+l+4+u+4+p+2+t.view.byteLength,f=new Yi(new ArrayBuffer(d),0,d,!0);f.EOTSize=f.view.byteLength,f.FontDataSize=t.view.byteLength,f.Version=131073,f.Flags=0,f.Charset=1,f.MagicNumber=20556,f.Padding1=0,f.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(f.FontPANOSE=m.fontPANOSE,f.Italic=m.fsSelection,f.Weight=m.usWeightClass,f.fsType=m.fsType,f.UnicodeRange=m.ulUnicodeRange,f.CodePageRange=m.ulCodePageRange),f.view.writeUint16(s),f.view.writeBytes(o),f.view.writeUint16(0),f.view.writeUint16(l),f.view.writeBytes(a),f.view.writeUint16(0),f.view.writeUint16(u),f.view.writeBytes(c),f.view.writeUint16(0),f.view.writeUint16(p),f.view.writeBytes(h),f.view.writeUint16(0),f.view.writeUint16(0),f.view.writeBytes(t.view),f}};vt([y("uint32")],wt.prototype,"EOTSize"),vt([y("uint32")],wt.prototype,"FontDataSize"),vt([y("uint32")],wt.prototype,"Version"),vt([y("uint32")],wt.prototype,"Flags"),vt([y({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),vt([y("uint8")],wt.prototype,"Charset"),vt([y("uint8")],wt.prototype,"Italic"),vt([y("uint32")],wt.prototype,"Weight"),vt([y("uint16")],wt.prototype,"fsType"),vt([y("uint16")],wt.prototype,"MagicNumber"),vt([y({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),vt([y({type:"uint8",size:8})],wt.prototype,"CodePageRange"),vt([y("uint32")],wt.prototype,"CheckSumAdjustment"),vt([y({type:"uint8",size:16})],wt.prototype,"Reserved"),vt([y("uint16")],wt.prototype,"Padding1");var Ms=Object.defineProperty,Qe=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ms(t,e,i),i};class Oe extends Ot{constructor(t,e){super(t,e,16)}}Qe([y({type:"char",size:4})],Oe.prototype,"tag"),Qe([y("uint32")],Oe.prototype,"checkSum"),Qe([y("uint32")],Oe.prototype,"offset"),Qe([y("uint32")],Oe.prototype,"length");const Ln=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Ps=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class Ar{index;name;isComposite=!1;components=[];pathCommands=[];constructor(t){const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,i={},o){const s=1/(o?.unitsPerEm??1e3)*r,{xScale:a=s,yScale:l=s}=i,c=this.pathCommands,u=[];for(let h=0,p=c.length;h<p;h+=1){const d=c[h];d.type==="M"?u.push({type:"M",x:t+d.x*a,y:e+-d.y*l}):d.type==="L"?u.push({type:"L",x:t+d.x*a,y:e+-d.y*l}):d.type==="Q"?u.push({type:"Q",x1:t+d.x1*a,y1:e+-d.y1*l,x:t+d.x*a,y:e+-d.y*l}):d.type==="C"?u.push({type:"C",x1:t+d.x1*a,y1:e+-d.y1*l,x2:t+d.x2*a,y2:e+-d.y2*l,x:t+d.x*a,y:e+-d.y*l}):d.type==="Z"&&u.push({type:"Z"})}return u}}class Ts extends Ar{parse(t,e,r){const i=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=t,c=t.topDict.paintType,u=this.index;let h,p,d,f;const m=[],g=[];let M=0,P=!1,w=!1,C=s,v=0,x=0;function S(B,A){m.push({type:"L",x:B,y:A})}function b(B,A,W,I,U,j){m.push({type:"C",x1:B,y1:A,x2:W,y2:I,x:U,y:j})}function D(B,A){w&&c!==2&&N(),w=!0,m.push({type:"M",x:B,y:A})}function N(){m.push({type:"Z"})}function E(B){m.push(...B)}function L(){g.length%2!==0&&!P&&(C=g.shift()+o),M+=g.length>>1,g.length=0,P=!0}function z(B){let A,W,I,U,j,O,V,_,T,F,$,q,Z=0;for(;Z<B.length;){let nt=B[Z++];switch(nt){case 1:L();break;case 3:L();break;case 4:g.length>1&&!P&&(C=g.shift()+o,P=!0),x+=g.pop(),D(v,x);break;case 5:for(;g.length>0;)v+=g.shift(),x+=g.shift(),S(v,x);break;case 6:for(;g.length>0&&(v+=g.shift(),S(v,x),g.length!==0);)x+=g.shift(),S(v,x);break;case 7:for(;g.length>0&&(x+=g.shift(),S(v,x),g.length!==0);)v+=g.shift(),S(v,x);break;case 8:for(;g.length>0;)h=v+g.shift(),p=x+g.shift(),d=h+g.shift(),f=p+g.shift(),v=d+g.shift(),x=f+g.shift(),b(h,p,d,f,v,x);break;case 10:j=g.pop()+l,O=t.subrs[j],O&&z(O);break;case 11:return;case 12:switch(nt=B[Z],Z+=1,nt){case 35:h=v+g.shift(),p=x+g.shift(),d=h+g.shift(),f=p+g.shift(),V=d+g.shift(),_=f+g.shift(),T=V+g.shift(),F=_+g.shift(),$=T+g.shift(),q=F+g.shift(),v=$+g.shift(),x=q+g.shift(),g.shift(),b(h,p,d,f,V,_),b(T,F,$,q,v,x);break;case 34:h=v+g.shift(),p=x,d=h+g.shift(),f=p+g.shift(),V=d+g.shift(),_=f,T=V+g.shift(),F=f,$=T+g.shift(),q=x,v=$+g.shift(),b(h,p,d,f,V,_),b(T,F,$,q,v,x);break;case 36:h=v+g.shift(),p=x+g.shift(),d=h+g.shift(),f=p+g.shift(),V=d+g.shift(),_=f,T=V+g.shift(),F=f,$=T+g.shift(),q=F+g.shift(),v=$+g.shift(),b(h,p,d,f,V,_),b(T,F,$,q,v,x);break;case 37:h=v+g.shift(),p=x+g.shift(),d=h+g.shift(),f=p+g.shift(),V=d+g.shift(),_=f+g.shift(),T=V+g.shift(),F=_+g.shift(),$=T+g.shift(),q=F+g.shift(),Math.abs($-v)>Math.abs(q-x)?v=$+g.shift():x=q+g.shift(),b(h,p,d,f,V,_),b(T,F,$,q,v,x);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+nt}`),g.length=0}break;case 14:if(g.length>=4){const Zt=Ln[g.pop()],Dt=Ln[g.pop()],Mt=g.pop(),_t=g.pop();if(Zt&&Dt){i.isComposite=!0,i.components=[];const ht=t.charset.indexOf(Zt),kt=t.charset.indexOf(Dt);i.components.push({glyphIndex:kt,dx:0,dy:0}),i.components.push({glyphIndex:ht,dx:_t,dy:Mt}),E(r.get(kt).pathCommands);const Vt=JSON.parse(JSON.stringify(r.get(ht).pathCommands));for(let jt=0;jt<Vt.length;jt+=1){const Lt=Vt[jt];Lt.type!=="Z"&&(Lt.x+=_t,Lt.y+=Mt),(Lt.type==="Q"||Lt.type==="C")&&(Lt.x1+=_t,Lt.y1+=Mt),Lt.type==="C"&&(Lt.x2+=_t,Lt.y2+=Mt)}E(Vt)}}else g.length>0&&!P&&(C=g.shift()+o,P=!0);w&&c!==2&&(N(),w=!1);break;case 18:L();break;case 19:case 20:L(),Z+=M+7>>3;break;case 21:g.length>2&&!P&&(C=g.shift()+o,P=!0),x+=g.pop(),v+=g.pop(),D(v,x);break;case 22:g.length>1&&!P&&(C=g.shift()+o,P=!0),v+=g.pop(),D(v,x);break;case 23:L();break;case 24:for(;g.length>2;)h=v+g.shift(),p=x+g.shift(),d=h+g.shift(),f=p+g.shift(),v=d+g.shift(),x=f+g.shift(),b(h,p,d,f,v,x);v+=g.shift(),x+=g.shift(),S(v,x);break;case 25:for(;g.length>6;)v+=g.shift(),x+=g.shift(),S(v,x);h=v+g.shift(),p=x+g.shift(),d=h+g.shift(),f=p+g.shift(),v=d+g.shift(),x=f+g.shift(),b(h,p,d,f,v,x);break;case 26:for(g.length%2&&(v+=g.shift());g.length>0;)h=v,p=x+g.shift(),d=h+g.shift(),f=p+g.shift(),v=d,x=f+g.shift(),b(h,p,d,f,v,x);break;case 27:for(g.length%2&&(x+=g.shift());g.length>0;)h=v+g.shift(),p=x,d=h+g.shift(),f=p+g.shift(),v=d+g.shift(),x=f,b(h,p,d,f,v,x);break;case 28:A=B[Z],W=B[Z+1],g.push((A<<24|W<<16)>>16),Z+=2;break;case 29:j=g.pop()+a,O=t.gsubrs[j],O&&z(O);break;case 30:for(;g.length>0&&(h=v,p=x+g.shift(),d=h+g.shift(),f=p+g.shift(),v=d+g.shift(),x=f+(g.length===1?g.shift():0),b(h,p,d,f,v,x),g.length!==0);)h=v+g.shift(),p=x,d=h+g.shift(),f=p+g.shift(),x=f+g.shift(),v=d+(g.length===1?g.shift():0),b(h,p,d,f,v,x);break;case 31:for(;g.length>0&&(h=v+g.shift(),p=x,d=h+g.shift(),f=p+g.shift(),x=f+g.shift(),v=d+(g.length===1?g.shift():0),b(h,p,d,f,v,x),g.length!==0);)h=v,p=x+g.shift(),d=h+g.shift(),f=p+g.shift(),v=d+g.shift(),x=f+(g.length===1?g.shift():0),b(h,p,d,f,v,x);break;default:nt<32?console.warn(`Glyph ${u}: unknown operator ${nt}`):nt<247?g.push(nt-139):nt<251?(A=B[Z],Z+=1,g.push((nt-247)*256+A+108)):nt<255?(A=B[Z],Z+=1,g.push(-(nt-251)*256-A-108)):(A=B[Z],W=B[Z+1],I=B[Z+2],U=B[Z+3],Z+=4,g.push((A<<24|W<<16|I<<8|U)/65536))}}}z(e),this.pathCommands=m,P&&(this.advanceWidth=C)}}class Ir{constructor(t){this._sfnt=t}_items=[];get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const i=this._sfnt.hmtx.metrics[t];i&&(r.advanceWidth=r.advanceWidth||i.advanceWidth,r.leftSideBearing=r.leftSideBearing||i.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??=o[0],r.unicodes??=o),this._items[t]=r}return r}}class _s extends Ir{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Ts({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var ks=Object.defineProperty,Or=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&ks(t,e,i),i};class Je extends Ot{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(t,e,r,i){super(t,e,r,i),this._init()}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const i=[];for(let o=0,s=e+1;o<s;o++){const a=this.view;let l=0;for(let c=0;c<r;c++)l<<=8,l+=a.readUint8();i.push(l)}return i}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,i=r+e[t],s=r+e[t+1]-i;return this._isString?this.view.readString(i,s):this.view.readBytes(i,s)}}Or([y("uint16")],Je.prototype,"count"),Or([y("uint8")],Je.prototype,"offsetSize");class tn extends Je{_isString=!1}class Er extends Je{_isString=!0}const As=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Is=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Os=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Es=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function en(n,t){return t<=390?As[t]:n[t-391]}function Q(n,t="number",e){return(r,i)=>{if(typeof i!="string")return;const o={type:t,operator:n,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,i,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class Br extends Ot{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),s=o>>4,a=o&15;if(s===r||(e+=i[s],a===r))break;e+=i[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,i,o,s;if(t===28)return r=e.readUint8(),i=e.readUint8(),r<<8|i;if(t===29)return r=e.readUint8(),i=e.readUint8(),o=e.readUint8(),s=e.readUint8(),r<<24|i<<16|o<<8|s;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,i={};for(;t.cursor<r;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),i[o]=e,e=[]):e.push(this._readOperand(o))}return i}_getProp(t){const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return en(this._stringIndex?.objects??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Bs=Object.defineProperty,Fn=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Bs(t,e,i),i};class nn extends Br{}Fn([Q(19)],nn.prototype,"subrs"),Fn([Q(20)],nn.prototype,"defaultWidthX"),Fn([Q(21)],nn.prototype,"nominalWidthX");var Ds=Object.defineProperty,rt=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ds(t,e,i),i};class et extends Br{}rt([Q(0,"string")],et.prototype,"version"),rt([Q(1,"string")],et.prototype,"notice"),rt([Q(1200,"string")],et.prototype,"copyright"),rt([Q(2,"string")],et.prototype,"fullName"),rt([Q(3,"string")],et.prototype,"familyName"),rt([Q(4,"string")],et.prototype,"weight"),rt([Q(1201)],et.prototype,"isFixedPitch"),rt([Q(1202)],et.prototype,"italicAngle"),rt([Q(1203,"number",-100)],et.prototype,"underlinePosition"),rt([Q(1204,"number",50)],et.prototype,"underlineThickness"),rt([Q(1205)],et.prototype,"paintType"),rt([Q(1206,"number",2)],et.prototype,"charstringType"),rt([Q(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),rt([Q(13)],et.prototype,"uniqueId"),rt([Q(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),rt([Q(1208)],et.prototype,"strokeWidth"),rt([Q(14)],et.prototype,"xuid"),rt([Q(15)],et.prototype,"charset"),rt([Q(16)],et.prototype,"encoding"),rt([Q(17)],et.prototype,"charStrings"),rt([Q(18,"number[]",[0,0])],et.prototype,"private");function dt(n,t=n){return e=>{Kt.tableDefinitions.set(n,{tag:n,prop:t,class:e}),Object.defineProperty(Kt.prototype,t,{get(){return this.get(n)},set(r){return this.set(n,r)},configurable:!0,enumerable:!0})}}class Kt{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:i}=this.cff;e=i.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),i=r.length,o=Array.from({length:i}),s=e.get(0);for(let a=0;a<i;a+=1)o[a]=e.get(r[a])||s;return o}getPathCommands(t,e,r,i,o){const s=[];return this.forEachGlyph(t,e,r,i,o,(a,l,c,u,h)=>{s.push(...a.getPathCommands(l,c,u,h,this))}),s}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,i=72,o={},s){const a=1/this.unitsPerEm*i,l=this.textToGlyphs(t);for(let c=0;c<l.length;c+=1){const u=l[c];s.call(this,u,e,r,i,o),u.advanceWidth&&(e+=u.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*i:o.tracking&&(e+=o.tracking/1e3*i)}return e}constructor(t){(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,i)=>{this.tableViews.set(i,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}clone(){return new Kt(this.tableViews)}delete(t){const e=Kt.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Kt.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Kt.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const i=e.class;if(i){const o=this.tableViews.get(t);if(!o)return;r=new i(o.buffer,o.byteOffset,o.byteLength).setSFNT(this),this.tables.set(e.prop,r)}}return r}}class gt extends Ot{setSFNT(t){return this._sfnt=t,this}getSFNT(){return this._sfnt}}var Ls=Object.defineProperty,Fs=Object.getOwnPropertyDescriptor,Ee=(n,t,e,r)=>{for(var i=r>1?void 0:r?Fs(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&Ls(t,e,i),i};let me=class extends gt{_glyphs;get glyphs(){return this._glyphs??=new _s(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(n,t,e,r){super(n,t,e,r),this._init()}_init(){const n=this.view,{buffer:t,byteOffset:e}=n,r=e+4;this.nameIndex=new Er(t,r),this.topDictIndex=new tn(t,this.nameIndex.endOffset),this.stringIndex=new Er(t,this.topDictIndex.endOffset),this.globalSubrIndex=new tn(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new nn(t,e+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new tn(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new tn(t,e+this.topDict.charStrings);const s=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Is:this.topDict.charset===1?this.charset=Os:this.topDict.charset===2?this.charset=Es:this.charset=this._readCharset(e+this.topDict.charset,s,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Ln:this.topDict.encoding===1?this.encoding=Ps:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(n,t,e){const r=this.view;r.seek(n);let i,o,s;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(i=0;i<t;i+=1)o=r.readUint16(),a.push(en(e,o));else if(l===1)for(;a.length<=t;)for(o=r.readUint16(),s=r.readUint8(),i=0;i<=s;i+=1)a.push(en(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=r.readUint16(),s=r.readUint16(),i=0;i<=s;i+=1)a.push(en(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(n){const t=this.view;t.seek(n);let e,r;const i={},o=t.readUint8();if(o===0){const s=t.readUint8();for(e=0;e<s;e+=1)r=t.readUint8(),i[r]=e}else if(o===1){const s=t.readUint8();for(r=1,e=0;e<s;e+=1){const a=t.readUint8(),l=t.readUint8();for(let c=a;c<=a+l;c+=1)i[c]=r,r+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(n){let t;return n.length<1240?t=107:n.length<33900?t=1131:t=32768,t}};Ee([y("uint8")],me.prototype,"majorVersion",2),Ee([y("uint8")],me.prototype,"minorVersion",2),Ee([y("uint8")],me.prototype,"headerSize",2),Ee([y("uint8")],me.prototype,"offsetSize",2),me=Ee([dt("CFF ","cff")],me);var Us=Object.defineProperty,rn=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Us(t,e,i),i};const Be=class Ki extends Ot{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new Ki;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,i)=>{i<256&&r<256&&e.view.writeUint8(r,6+i)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};rn([y("uint16")],Be.prototype,"format"),rn([y("uint16")],Be.prototype,"length"),rn([y("uint16")],Be.prototype,"language"),rn([y({type:"uint8",size:256})],Be.prototype,"glyphIndexArray");let Dr=Be;var $s=Object.defineProperty,Un=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&$s(t,e,i),i};class sn extends Ot{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,i=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,a=r.findIndex(c=>c===i);let l=0;for(let c=0;c<256;c++)if(r[c]===0)c>=a||c<o[0].firstCode||c>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(c-o[0].firstCode)>=s.length?l=0:(l=s[o[0].idRangeOffset+(c-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(c,l);else{const u=r[c];for(let h=0,p=o[u].entryCount;h<p;h++)if(o[u].idRangeOffset+h>=s.length?l=0:(l=s[o[u].idRangeOffset+h],l!==0&&(l=l+o[u].idDelta)),l!==0&&l<t){const d=(c<<8|h+o[u].firstCode)%65535;e.set(d,l)}}return e}}Un([y("uint16")],sn.prototype,"format"),Un([y("uint16")],sn.prototype,"length"),Un([y("uint16")],sn.prototype,"language");function Lr(n){return n>32767?n-65536:n<-32767?n+65536:n}function Fr(n,t){let e;const r=[];let i={};re