modern-text 0.2.14 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +6 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -265,7 +265,7 @@ class Character {
|
|
|
265
265
|
commands = this._rotation90(commands, point);
|
|
266
266
|
} else {
|
|
267
267
|
if (glyphIndex !== void 0) {
|
|
268
|
-
commands = font.
|
|
268
|
+
commands = font.glyphs.get(glyphIndex).getPathCommands(x, y, fontSize);
|
|
269
269
|
if (fontStyle === "italic") {
|
|
270
270
|
commands = this._italic(
|
|
271
271
|
commands,
|
|
@@ -372,6 +372,11 @@ class Character {
|
|
|
372
372
|
[cmd.x1, cmd.y1] = cb(cmd.x1, cmd.y1);
|
|
373
373
|
[cmd.x, cmd.y] = cb(cmd.x, cmd.y);
|
|
374
374
|
break;
|
|
375
|
+
case "C":
|
|
376
|
+
[cmd.x1, cmd.y1] = cb(cmd.x1, cmd.y1);
|
|
377
|
+
[cmd.x2, cmd.y2] = cb(cmd.x2, cmd.y2);
|
|
378
|
+
[cmd.x, cmd.y] = cb(cmd.x, cmd.y);
|
|
379
|
+
break;
|
|
375
380
|
}
|
|
376
381
|
return cmd;
|
|
377
382
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(f,H){typeof exports=="object"&&typeof module<"u"?H(exports):typeof define=="function"&&define.amd?define(["exports"],H):(f=typeof globalThis<"u"?globalThis:f||self,H(f.modernText={}))})(this,function(f){"use strict";var so=Object.defineProperty;var oo=(f,H,dt)=>H in f?so(f,H,{enumerable:!0,configurable:!0,writable:!0,value:dt}):f[H]=dt;var I=(f,H,dt)=>oo(f,typeof H!="symbol"?H+"":H,dt);function H(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:o,stops:a}=wr(t,e.left,e.top,e.width,e.height),c=i.createLinearGradient(n,r,s,o);return a.forEach(h=>c.addColorStop(h.offset,h.color)),c}return t}function dt(i,t,e){i!=null&&i.color&&(i.color=H(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=H(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=H(e,i.textStrokeColor,t))}function wr(i,t,e,n,r){var y;const s=((y=i.match(/linear-gradient\((.+)\)$/))==null?void 0:y[1])??"",o=s.split(",")[0],a=o.includes("deg")?o:"0deg",c=s.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),l=(Number(a.replace("deg",""))||0)*Math.PI/180,u=n*Math.sin(l),p=r*Math.cos(l);return{x0:t+n/2-u,y0:e+r/2+p,x1:t+n/2+u,y1:e+r/2-p,stops:Array.from(c).map(g=>{let m=g[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(g[3].replace("%",""))/100,color:m}})}}function Se(i){const{ctx:t,path:e,fontSize:n,clipRect:r}=i;t.save(),t.beginPath();const s=e.style;e.style={...s,fill:i.color??s.fill,stroke:i.textStrokeColor??s.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*n:s.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*n,shadowOffsetY:(i.shadowOffsetY??0)*n,shadowBlur:(i.shadowBlur??0)*n,shadowColor:i.shadowColor};const o=(i.offsetX??0)*n,a=(i.offsetY??0)*n;t.translate(o,a),r&&(t.rect(r.x,r.y,r.width,r.height),t.clip(),t.beginPath()),e.drawTo(t),t.restore()}var z=Uint8Array,it=Uint16Array,Me=Int32Array,le=new z([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]),ue=new z([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]),Ce=new z([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nn=function(i,t){for(var e=new it(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var r=new Me(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)r[s]=s-e[n]<<5|n;return{b:e,r}},rn=nn(le,2),sn=rn.b,Te=rn.r;sn[28]=258,Te[258]=28;for(var on=nn(ue,0),vr=on.b,an=on.r,Oe=new it(32768),D=0;D<32768;++D){var Mt=(D&43690)>>1|(D&21845)<<1;Mt=(Mt&52428)>>2|(Mt&13107)<<2,Mt=(Mt&61680)>>4|(Mt&3855)<<4,Oe[D]=((Mt&65280)>>8|(Mt&255)<<8)>>1}for(var gt=function(i,t,e){for(var n=i.length,r=0,s=new it(t);r<n;++r)i[r]&&++s[i[r]-1];var o=new it(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(e){a=new it(1<<t);var c=15-t;for(r=0;r<n;++r)if(i[r])for(var h=r<<4|i[r],l=t-i[r],u=o[i[r]-1]++<<l,p=u|(1<<l)-1;u<=p;++u)a[Oe[u]>>c]=h}else for(a=new it(n),r=0;r<n;++r)i[r]&&(a[r]=Oe[o[i[r]-1]++]>>15-i[r]);return a},Ct=new z(288),D=0;D<144;++D)Ct[D]=8;for(var D=144;D<256;++D)Ct[D]=9;for(var D=256;D<280;++D)Ct[D]=7;for(var D=280;D<288;++D)Ct[D]=8;for(var Wt=new z(32),D=0;D<32;++D)Wt[D]=5;var br=gt(Ct,9,0),xr=gt(Ct,9,1),_r=gt(Wt,5,0),Pr=gt(Wt,5,1),Ae=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},ft=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},$e=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ie=function(i){return(i+7)/8|0},hn=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new z(i.subarray(t,e))},Sr=["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"],pt=function(i,t,e){var n=new Error(t||Sr[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,pt),!e)throw n;return n},Mr=function(i,t,e,n){var r=i.length,s=0;if(!r||t.f&&!t.l)return e||new z(0);var o=!e,a=o||t.i!=2,c=t.i;o&&(e=new z(r*3));var h=function(ae){var he=e.length;if(ae>he){var zt=new z(Math.max(he*2,ae));zt.set(e),e=zt}},l=t.f||0,u=t.p||0,p=t.b||0,y=t.l,g=t.d,m=t.m,w=t.n,x=r*8;do{if(!y){l=ft(i,u,1);var _=ft(i,u+1,3);if(u+=3,_)if(_==1)y=xr,g=Pr,m=9,w=5;else if(_==2){var O=ft(i,u,31)+257,A=ft(i,u+10,15)+4,P=O+ft(i,u+5,31)+1;u+=14;for(var S=new z(P),U=new z(19),N=0;N<A;++N)U[Ce[N]]=ft(i,u+N*3,7);u+=A*3;for(var K=Ae(U),Ot=(1<<K)-1,ot=gt(U,K,1),N=0;N<P;){var nt=ot[ft(i,u,Ot)];u+=nt&15;var v=nt>>4;if(v<16)S[N++]=v;else{var V=0,L=0;for(v==16?(L=3+ft(i,u,3),u+=2,V=S[N-1]):v==17?(L=3+ft(i,u,7),u+=3):v==18&&(L=11+ft(i,u,127),u+=7);L--;)S[N++]=V}}var rt=S.subarray(0,O),k=S.subarray(O);m=Ae(rt),w=Ae(k),y=gt(rt,m,1),g=gt(k,w,1)}else pt(1);else{var v=Ie(u)+4,T=i[v-4]|i[v-3]<<8,C=v+T;if(C>r){c&&pt(0);break}a&&h(p+T),e.set(i.subarray(v,C),p),t.b=p+=T,t.p=u=C*8,t.f=l;continue}if(u>x){c&&pt(0);break}}a&&h(p+131072);for(var oe=(1<<m)-1,ut=(1<<w)-1,St=u;;St=u){var V=y[$e(i,u)&oe],at=V>>4;if(u+=V&15,u>x){c&&pt(0);break}if(V||pt(2),at<256)e[p++]=at;else if(at==256){St=u,y=null;break}else{var ht=at-254;if(at>264){var N=at-257,B=le[N];ht=ft(i,u,(1<<B)-1)+sn[N],u+=B}var bt=g[$e(i,u)&ut],kt=bt>>4;bt||pt(3),u+=bt&15;var k=vr[kt];if(kt>3){var B=ue[kt];k+=$e(i,u)&(1<<B)-1,u+=B}if(u>x){c&&pt(0);break}a&&h(p+131072);var Ht=p+ht;if(p<k){var xe=s-k,_e=Math.min(k,Ht);for(xe+p<0&&pt(3);p<_e;++p)e[p]=n[xe+p]}for(;p<Ht;++p)e[p]=e[p-k]}}t.l=y,t.p=St,t.b=p,t.f=l,y&&(l=1,t.m=m,t.d=g,t.n=w)}while(!l);return p!=e.length&&o?hn(e,0,p):e.subarray(0,p)},xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8},Xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8,i[n+2]|=e>>16},De=function(i,t){for(var e=[],n=0;n<i.length;++n)i[n]&&e.push({s:n,f:i[n]});var r=e.length,s=e.slice();if(!r)return{t:fn,l:0};if(r==1){var o=new z(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(C,O){return C.f-O.f}),e.push({s:-1,f:25001});var a=e[0],c=e[1],h=0,l=1,u=2;for(e[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=r-1;)a=e[e[h].f<e[u].f?h++:u++],c=e[h!=l&&e[h].f<e[u].f?h++:u++],e[l++]={s:-1,f:a.f+c.f,l:a,r:c};for(var p=s[0].s,n=1;n<r;++n)s[n].s>p&&(p=s[n].s);var y=new it(p+1),g=Ee(e[l-1],y,0);if(g>t){var n=0,m=0,w=g-t,x=1<<w;for(s.sort(function(O,A){return y[A.s]-y[O.s]||O.f-A.f});n<r;++n){var _=s[n].s;if(y[_]>t)m+=x-(1<<g-y[_]),y[_]=t;else break}for(m>>=w;m>0;){var v=s[n].s;y[v]<t?m-=1<<t-y[v]++-1:++n}for(;n>=0&&m;--n){var T=s[n].s;y[T]==t&&(--y[T],++m)}g=t}return{t:new z(y),l:g}},Ee=function(i,t,e){return i.s==-1?Math.max(Ee(i.l,t,e+1),Ee(i.r,t,e+1)):t[i.s]=e},cn=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new it(++t),n=0,r=i[0],s=1,o=function(c){e[n++]=c},a=1;a<=t;++a)if(i[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=i[a]}return{c:e.subarray(0,n),n:t}},qt=function(i,t){for(var e=0,n=0;n<t.length;++n)e+=i[n]*t[n];return e},ln=function(i,t,e){var n=e.length,r=Ie(t+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var s=0;s<n;++s)i[r+s+4]=e[s];return(r+4+n)*8},un=function(i,t,e,n,r,s,o,a,c,h,l){xt(t,l++,e),++r[256];for(var u=De(r,15),p=u.t,y=u.l,g=De(s,15),m=g.t,w=g.l,x=cn(p),_=x.c,v=x.n,T=cn(m),C=T.c,O=T.n,A=new it(19),P=0;P<_.length;++P)++A[_[P]&31];for(var P=0;P<C.length;++P)++A[C[P]&31];for(var S=De(A,7),U=S.t,N=S.l,K=19;K>4&&!U[Ce[K-1]];--K);var Ot=h+5<<3,ot=qt(r,Ct)+qt(s,Wt)+o,nt=qt(r,p)+qt(s,m)+o+14+3*K+qt(A,U)+2*A[16]+3*A[17]+7*A[18];if(c>=0&&Ot<=ot&&Ot<=nt)return ln(t,l,i.subarray(c,c+h));var V,L,rt,k;if(xt(t,l,1+(nt<ot)),l+=2,nt<ot){V=gt(p,y,0),L=p,rt=gt(m,w,0),k=m;var oe=gt(U,N,0);xt(t,l,v-257),xt(t,l+5,O-1),xt(t,l+10,K-4),l+=14;for(var P=0;P<K;++P)xt(t,l+3*P,U[Ce[P]]);l+=3*K;for(var ut=[_,C],St=0;St<2;++St)for(var at=ut[St],P=0;P<at.length;++P){var ht=at[P]&31;xt(t,l,oe[ht]),l+=U[ht],ht>15&&(xt(t,l,at[P]>>5&127),l+=at[P]>>12)}}else V=br,L=Ct,rt=_r,k=Wt;for(var P=0;P<a;++P){var B=n[P];if(B>255){var ht=B>>18&31;Xt(t,l,V[ht+257]),l+=L[ht+257],ht>7&&(xt(t,l,B>>23&31),l+=le[ht]);var bt=B&31;Xt(t,l,rt[bt]),l+=k[bt],bt>3&&(Xt(t,l,B>>5&8191),l+=ue[bt])}else Xt(t,l,V[B]),l+=L[B]}return Xt(t,l,V[256]),l+L[256]},Cr=new Me([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fn=new z(0),Tr=function(i,t,e,n,r,s){var o=s.z||i.length,a=new z(n+o+5*(1+Math.ceil(o/7e3))+r),c=a.subarray(n,a.length-r),h=s.l,l=(s.r||0)&7;if(t){l&&(c[0]=s.r>>3);for(var u=Cr[t-1],p=u>>13,y=u&8191,g=(1<<e)-1,m=s.p||new it(32768),w=s.h||new it(g+1),x=Math.ceil(e/3),_=2*x,v=function(tn){return(i[tn]^i[tn+1]<<x^i[tn+2]<<_)&g},T=new Me(25e3),C=new it(288),O=new it(32),A=0,P=0,S=s.i||0,U=0,N=s.w||0,K=0;S+2<o;++S){var Ot=v(S),ot=S&32767,nt=w[Ot];if(m[ot]=nt,w[Ot]=ot,N<=S){var V=o-S;if((A>7e3||U>24576)&&(V>423||!h)){l=un(i,c,0,T,C,O,P,U,K,S-K,l),U=A=P=0,K=S;for(var L=0;L<286;++L)C[L]=0;for(var L=0;L<30;++L)O[L]=0}var rt=2,k=0,oe=y,ut=ot-nt&32767;if(V>2&&Ot==v(S-ut))for(var St=Math.min(p,V)-1,at=Math.min(32767,S),ht=Math.min(258,V);ut<=at&&--oe&&ot!=nt;){if(i[S+rt]==i[S+rt-ut]){for(var B=0;B<ht&&i[S+B]==i[S+B-ut];++B);if(B>rt){if(rt=B,k=ut,B>St)break;for(var bt=Math.min(ut,B-2),kt=0,L=0;L<bt;++L){var Ht=S-ut+L&32767,xe=m[Ht],_e=Ht-xe&32767;_e>kt&&(kt=_e,nt=Ht)}}}ot=nt,nt=m[ot],ut+=ot-nt&32767}if(k){T[U++]=268435456|Te[rt]<<18|an[k];var ae=Te[rt]&31,he=an[k]&31;P+=le[ae]+ue[he],++C[257+ae],++O[he],N=S+rt,++A}else T[U++]=i[S],++C[i[S]]}}for(S=Math.max(S,N);S<o;++S)T[U++]=i[S],++C[i[S]];l=un(i,c,h,T,C,O,P,U,K,S-K,l),h||(s.r=l&7|c[l/8|0]<<3,l-=7,s.h=w,s.p=m,s.i=S,s.w=N)}else{for(var S=s.w||0;S<o+h;S+=65535){var zt=S+65535;zt>=o&&(c[l/8|0]=h,zt=o),l=ln(c,l+1,i.subarray(S,zt))}s.i=o}return hn(a,0,n+Ie(l)+r)},pn=function(){var i=1,t=0;return{p:function(e){for(var n=i,r=t,s=e.length|0,o=0;o!=s;){for(var a=Math.min(o+2655,s);o<a;++o)r+=n+=e[o];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,t=r},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},Or=function(i,t,e,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new z(s.length+i.length);o.set(s),o.set(i,s.length),i=o,r.w=s.length}return Tr(i,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,n,r)},dn=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},Ar=function(i,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=n<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var r=pn();r.p(t.dictionary),dn(i,2,r.d())}},$r=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&pt(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&pt(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ir(i,t){t||(t={});var e=pn();e.p(i);var n=Or(i,t,t.dictionary?6:2,4);return Ar(n,t),dn(n,n.length-4,e.d()),n}function Dr(i,t){return Mr(i.subarray($r(i,t),-4),{i:2},t,t)}var Er=typeof TextDecoder<"u"&&new TextDecoder,Ur=0;try{Er.decode(fn,{stream:!0}),Ur=1}catch{}const Lr="modern-font";function jt(i,t){if(!i)throw new Error(`[${Lr}] ${t}`)}function Br(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function At(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var gn=Object.defineProperty,Fr=(i,t,e)=>t in i?gn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,W=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&gn(t,e,r),r},Nr=(i,t,e)=>(Fr(i,t+"",e),e);const fe={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function X(){return function(i,t){Object.defineProperty(i.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 R extends DataView{constructor(t,e,n,r){super(Br(t),e,n),this.littleEndian=r,Nr(this,"cursor",0)}getColumn(t){if(t.size){const e=Array.from({length:t.size},(n,r)=>this.read(t.type,t.offset+r));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}setColumn(t,e){t.size?Array.from({length:t.size},(n,r)=>{this.write(t.type,e[r],t.offset+r)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,n=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,n);case"longDateTime":return this.readLongDateTime(e,n)}const r=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,s=this[r](e,n);return this.cursor+=fe[t],s}readUint24(t=this.cursor){const[e,n,r]=this.readBytes(t,3);return(e<<16)+(n<<8)+r}readBytes(t,e){e==null&&(e=t,t=this.cursor);const n=[];for(let r=0;r<e;++r)n.push(this.getUint8(t+r));return this.cursor=t+e,n}readString(t,e){e===void 0&&(e=t,t=this.cursor);let n="";for(let r=0;r<e;++r)n+=String.fromCharCode(this.readUint8(t+r));return this.cursor=t+e,n}readFixed(t,e){const n=this.readInt32(t,e)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,e){const n=this.readUint32(t+4,e),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(t){return this.readString(t,1)}write(t,e,n=this.cursor,r=this.littleEndian){switch(t){case"char":return this.writeChar(e,n);case"fixed":return this.writeFixed(e,n);case"longDateTime":return this.writeLongDateTime(e,n)}const s=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[s](n,e,r);return this.cursor+=fe[t.toLowerCase()],o}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let r=0,s=t.length,o;r<s;++r)o=t.charCodeAt(r)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=n,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 r=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(r,e+4),this}writeBytes(t,e=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let r=0;r<n;++r)this.setUint8(e+r,t[r])}else{const r=At(t);n=r.byteLength;for(let s=0;s<n;++s)this.setUint8(e+s,r.getUint8(s))}return this.cursor=e+n,this}seek(t){return this.cursor=t,this}}W([X()],R.prototype,"readInt8"),W([X()],R.prototype,"readInt16"),W([X()],R.prototype,"readInt32"),W([X()],R.prototype,"readUint8"),W([X()],R.prototype,"readUint16"),W([X()],R.prototype,"readUint32"),W([X()],R.prototype,"readFloat32"),W([X()],R.prototype,"readFloat64"),W([X()],R.prototype,"writeInt8"),W([X()],R.prototype,"writeInt16"),W([X()],R.prototype,"writeInt32"),W([X()],R.prototype,"writeUint8"),W([X()],R.prototype,"writeUint16"),W([X()],R.prototype,"writeUint32"),W([X()],R.prototype,"writeFloat32"),W([X()],R.prototype,"writeFloat64");var Gr=Object.defineProperty,Rr=(i,t,e)=>t in i?Gr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Vr=(i,t,e)=>(Rr(i,t+"",e),e);const yn=new WeakMap;function d(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:n}=t;return(r,s)=>{if(typeof s!="string")return;let o=yn.get(r);o||(o={columns:[],byteLength:0},yn.set(r,o));const a={...t,name:s,byteLength:e*fe[n],offset:t.offset??o.columns.reduce((c,h)=>c+h.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((c,h)=>c+fe[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.getColumn(a)},set(c){this.view.setColumn(a,c)},configurable:!0,enumerable:!0})}}class yt{constructor(t,e,n,r){Vr(this,"view"),this.view=new R(t,e,n,r)}}function kr(i){let t="";for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),r!==0&&(t+=String.fromCharCode(r));return t}function pe(i){i=kr(i);const t=[];for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),t.push(r>>8),t.push(r&255);return t}function Hr(i){let t="";for(let e=0,n=i.length;e<n;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function zr(i){let t="";for(let e=0,n=i.length;e<n;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}var Wr=Object.defineProperty,Xr=(i,t,e)=>t in i?Wr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,qr=(i,t,e)=>(Xr(i,t+"",e),e);class de extends yt{constructor(){super(...arguments),qr(this,"mimeType","font/opentype")}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 mn=Object.defineProperty,jr=(i,t,e)=>t in i?mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Q=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&mn(t,e,r),r},Yr=(i,t,e)=>(jr(i,t+"",e),e);const q=class pr extends de{constructor(){super(...arguments),Yr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,r=e.name.getNames(),s=pe(r.fontFamily||""),o=s.length,a=pe(r.fontStyle||""),c=a.length,h=pe(r.version||""),l=h.length,u=pe(r.fullName||""),p=u.length,y=86+o+4+c+4+l+4+p+2+t.view.byteLength,g=new pr(new ArrayBuffer(y),0,y,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(g.FontPANOSE=m.fontPANOSE,g.Italic=m.fsSelection,g.Weight=m.usWeightClass,g.fsType=m.fsType,g.UnicodeRange=m.ulUnicodeRange,g.CodePageRange=m.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(s),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(p),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};Q([d("uint32")],q.prototype,"EOTSize"),Q([d("uint32")],q.prototype,"FontDataSize"),Q([d("uint32")],q.prototype,"Version"),Q([d("uint32")],q.prototype,"Flags"),Q([d({type:"uint8",size:10})],q.prototype,"FontPANOSE"),Q([d("uint8")],q.prototype,"Charset"),Q([d("uint8")],q.prototype,"Italic"),Q([d("uint32")],q.prototype,"Weight"),Q([d("uint16")],q.prototype,"fsType"),Q([d("uint16")],q.prototype,"MagicNumber"),Q([d({type:"uint8",size:16})],q.prototype,"UnicodeRange"),Q([d({type:"uint8",size:8})],q.prototype,"CodePageRange"),Q([d("uint32")],q.prototype,"CheckSumAdjustment"),Q([d({type:"uint8",size:16})],q.prototype,"Reserved"),Q([d("uint16")],q.prototype,"Padding1");let Kr=q;var Qr=Object.defineProperty,ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Qr(t,e,r),r};class Ft extends yt{constructor(t,e){super(t,e,16)}}ge([d({type:"char",size:4})],Ft.prototype,"tag"),ge([d("uint32")],Ft.prototype,"checkSum"),ge([d("uint32")],Ft.prototype,"offset"),ge([d("uint32")],Ft.prototype,"length");var Zr=Object.defineProperty,ye=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Zr(t,e,r),r};const Yt=class dr extends yt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new dr;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((n,r)=>{r<256&&n<256&&e.view.writeUint8(n,6+r)}),e}getUnicodeGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,n)=>{t.set(n,e)}),t}};ye([d("uint16")],Yt.prototype,"format"),ye([d("uint16")],Yt.prototype,"length"),ye([d("uint16")],Yt.prototype,"language"),ye([d({type:"uint8",size:256})],Yt.prototype,"glyphIndexArray");let Ue=Yt;var Jr=Object.defineProperty,Le=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Jr(t,e,r),r};class Kt extends yt{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,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-n)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const n=(this.view.byteLength-e)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(t){const e=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,s=this.subHeaders,o=this.glyphIndexArray,a=n.findIndex(h=>h===r);let c=0;for(let h=0;h<256;h++)if(n[h]===0)h>=a||h<s[0].firstCode||h>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(h-s[0].firstCode)>=o.length?c=0:(c=o[s[0].idRangeOffset+(h-s[0].firstCode)],c!==0&&(c=c+s[0].idDelta)),c!==0&&c<t&&e.set(h,c);else{const l=n[h];for(let u=0,p=s[l].entryCount;u<p;u++)if(s[l].idRangeOffset+u>=o.length?c=0:(c=o[s[l].idRangeOffset+u],c!==0&&(c=c+s[l].idDelta)),c!==0&&c<t){const y=(h<<8|u+s[l].firstCode)%65535;e.set(y,c)}}return e}}Le([d("uint16")],Kt.prototype,"format"),Le([d("uint16")],Kt.prototype,"length"),Le([d("uint16")],Kt.prototype,"language");function wn(i){return i>32767?i-65536:i<-32767?i+65536:i}function Be(i,t){let e;const n=[];let r={};return i.forEach((s,o)=>{t&&o>t||((!e||o!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(r.end=e.unicode,n.push(r),r={start:o,startId:s,delta:wn(s-o)}):(r.start=Number(o),r.startId=s,r.delta=wn(s-o))),e={unicode:o,glyphIndex:s})}),e&&(r.end=e.unicode,n.push(r)),n}var ti=Object.defineProperty,$t=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ti(t,e,r),r};const Tt=class gr extends yt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=Be(t,65535),n=e.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,o=new gr(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=n*2,o.searchRange=s,o.entrySelector=r,o.rangeShift=2*n-s,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:n},()=>0),o}getUnicodeGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,o=this.idRangeOffset,a=this.idDelta,c=this.glyphIndexArray;for(let h=0;h<e;++h)for(let l=r[h],u=s[h];l<=u;++l)if(o[h]===0)t.set(l,(l+a[h])%65536);else{const p=h+o[h]/2+(l-r[h])-n,y=c[p];y!==0?t.set(l,(y+a[h])%65536):t.set(l,0)}return t.delete(65535),t}};$t([d("uint16")],Tt.prototype,"format"),$t([d("uint16")],Tt.prototype,"length"),$t([d("uint16")],Tt.prototype,"language"),$t([d("uint16")],Tt.prototype,"segCountX2"),$t([d("uint16")],Tt.prototype,"searchRange"),$t([d("uint16")],Tt.prototype,"entrySelector"),$t([d("uint16")],Tt.prototype,"rangeShift");let Fe=Tt;var ei=Object.defineProperty,Qt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ei(t,e,r),r};class It extends yt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((n,r)=>{e.set(r,n)}),e}}Qt([d("uint16")],It.prototype,"format"),Qt([d("uint16")],It.prototype,"length"),Qt([d("uint16")],It.prototype,"language"),Qt([d("uint16")],It.prototype,"firstCode"),Qt([d("uint16")],It.prototype,"entryCount");var ni=Object.defineProperty,Zt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ni(t,e,r),r};const Nt=class yr extends yt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=Be(t),n=new yr(new ArrayBuffer(16+e.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=e.length,e.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeGlyphIndexMap(){const t=new Map,e=this.groups;for(let n=0,r=e.length;n<r;n++){const s=e[n];let o=s.startGlyphCode,a=s.startCharCode;const c=s.endCharCode;for(;a<=c;)t.set(a++,o++)}return t}};Zt([d("uint16")],Nt.prototype,"format"),Zt([d("uint16")],Nt.prototype,"reserved"),Zt([d("uint32")],Nt.prototype,"length"),Zt([d("uint32")],Nt.prototype,"language"),Zt([d("uint32")],Nt.prototype,"nGroups");let Ne=Nt;var ri=Object.defineProperty,Ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ri(t,e,r),r};class Jt extends yt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const n=this.view.readUint32();e.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const n=this.view.readUint32();e.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let n=0,r=e.length;n<r;n++){const{uVSMappings:s}=e[n];s.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}Ge([d("uint16")],Jt.prototype,"format"),Ge([d("uint32")],Jt.prototype,"length"),Ge([d("uint32")],Jt.prototype,"numVarSelectorRecords");var ii=Object.defineProperty,si=(i,t,e)=>t in i?ii(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Re=(i,t,e)=>(si(i,typeof t!="symbol"?t+"":t,e),e);function j(i,t=i){return e=>{te.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(te.prototype,t,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const vn=class ce{constructor(t){Re(this,"tables",new Map),Re(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get names(){return this.name.getNames()}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}charToGlyphIndex(t){return this.cmap.unicodeGlyphIndexMap.get(t.codePointAt(0))??0}charToGlyph(t){return this.glyf.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=this.cmap.unicodeGlyphIndexMap,n=[];for(const r of t){const s=r.codePointAt(0);n.push(e.get(s)??0)}return n}textToGlyphs(t){const e=this.glyf.glyphs,n=this.textToGlyphIndexes(t),r=n.length,s=Array.from({length:r}),o=e.get(0);for(let a=0;a<r;a+=1)s[a]=e.get(n[a])||o;return s}getPathCommands(t,e,n,r,s){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,n,r,s,this)}getAdvanceWidth(t,e,n){return this.forEachGlyph(t,0,0,e,n,()=>{})}forEachGlyph(t,e=0,n=0,r=72,s={},o){const a=1/this.unitsPerEm*r,c=this.textToGlyphs(t);for(let h=0;h<c.length;h+=1){const l=c[h];o.call(this,l,e,n,r,s),l.advanceWidth&&(e+=l.advanceWidth*a),s.letterSpacing?e+=s.letterSpacing*r:s.tracking&&(e+=s.tracking/1e3*r)}return e}clone(){return new ce(this.tableViews)}delete(t){const e=ce.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=ce.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ce.tableDefinitions.get(t);if(!e)return;let n=this.tables.get(e.prop);if(!n){const r=e.class;if(r){const s=this.tableViews.get(t);s?n=new r(s.buffer,s.byteOffset,s.byteLength).setSfnt(this):n=new r().setSfnt(this),this.tables.set(e.prop,n)}}return n}};Re(vn,"tableDefinitions",new Map);let te=vn;class Z extends yt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var bn=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,ai=(i,t,e)=>t in i?bn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t,e,n)=>{for(var r=n>1?void 0:n?oi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&bn(t,e,r),r},hi=(i,t,e)=>(ai(i,t+"",e),e);f.Cmap=class extends Z{constructor(){super(...arguments),hi(this,"_unicodeGlyphIndexMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),n=Fe.from(t),r=Ue.from(t),s=e?Ne.from(t):void 0,o=4+(s?32:24),a=o+n.view.byteLength,c=a+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},s&&{platformID:3,platformSpecificID:10,offset:c}].filter(Boolean),l=new f.Cmap(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return l.numberSubtables=h.length,l.view.seek(4),h.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(n.view,o),l.view.writeBytes(r.view,a),s&&l.view.writeBytes(s.view,c),l}get unicodeGlyphIndexMap(){return this._unicodeGlyphIndexMap||(this._unicodeGlyphIndexMap=this._getUnicodeGlyphIndexMap()),this._unicodeGlyphIndexMap}_getSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new Ue(this.view.buffer,e.offset);break;case 2:r=new Kt(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new Fe(this.view.buffer,e.offset,this.view.readUint16());break;case 6:r=new It(this.view.buffer,e.offset,this.view.readUint16());break;case 12:r=new Ne(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new Jt(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:n,view:r}})}_getUnicodeGlyphIndexMap(){var a,c,h,l,u;const t=this._getSubtables(),e=(a=t.find(p=>p.format===0))==null?void 0:a.view,n=(c=t.find(p=>p.platformID===3&&p.platformSpecificID===3&&p.format===2))==null?void 0:c.view,r=(h=t.find(p=>p.platformID===3&&p.platformSpecificID===1&&p.format===4))==null?void 0:h.view,s=(l=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:l.view,o=(u=t.find(p=>p.platformID===0&&p.platformSpecificID===5&&p.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeGlyphIndexMap())??[]])}},Ve([d("uint16")],f.Cmap.prototype,"version",2),Ve([d("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=Ve([j("cmap")],f.Cmap);var ci=Object.defineProperty,li=(i,t,e)=>t in i?ci(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ui=(i,t,e)=>(li(i,t+"",e),e);class xn{constructor(t){ui(this,"pathCommands",[]);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,this.unicode=e.unicode,this.unicodes=e.unicodes||(e.unicode!==void 0?[e.unicode]:[]),e.xMin!==void 0&&(this.xMin=e.xMin),e.yMin!==void 0&&(this.yMin=e.yMin),e.xMax!==void 0&&(this.xMax=e.xMax),e.yMax!==void 0&&(this.yMax=e.yMax),e.advanceWidth!==void 0&&(this.advanceWidth=e.advanceWidth),e.leftSideBearing!==void 0&&(this.leftSideBearing=e.leftSideBearing),e.points!==void 0&&(this.points=e.points)}_parseContours(t){const e=[];let n=[];for(let r=0;r<t.length;r+=1){const s=t[r];n.push(s),s.lastPointOfContour&&(e.push(n),n=[])}return jt(n.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const n=[];for(let r=0;r<t.length;r+=1){const s=t[r],o={x:e.xScale*s.x+e.scale10*s.y+e.dx,y:e.scale01*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(o)}return n}_parseGlyphCoordinate(t,e,n,r,s){let o;return(e&r)>0?(o=t.view.readUint8(),e&s||(o=-o),o=n+o):(e&s)>0?o=n:o=n+t.view.readInt16(),o}_parse(t,e,n){t.view.seek(e);const r=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),r>0){const a=this.endPointIndices=[];for(let m=0;m<r;m++)a.push(t.view.readUint16());const c=this.instructionLength=t.view.readUint16();jt(c<5e3,`Bad instructionLength:${c}`);const h=this.instructions=[];for(let m=0;m<c;++m)h.push(t.view.readUint8());const l=t.view.byteOffset,u=a[a.length-1]+1;jt(u<2e4,`Bad numberOfCoordinates:${l}`);const p=[];let y,g=0;for(;g<u;)if(y=t.view.readUint8(),p.push(y),g++,y&8&&g<u){const m=t.view.readUint8();for(let w=0;w<m;w++)p.push(y),g++}if(jt(p.length===u,`Bad flags length: ${p.length}, numberOfCoordinates: ${u}`),a.length>0){const m=[];let w;if(u>0){for(let v=0;v<u;v+=1)y=p[v],w={},w.onCurve=!!(y&1),w.lastPointOfContour=a.includes(v),m.push(w);let x=0;for(let v=0;v<u;v+=1)y=p[v],w=m[v],w.x=this._parseGlyphCoordinate(t,y,x,2,16),x=w.x;let _=0;for(let v=0;v<u;v+=1)y=p[v],w=m[v],w.y=this._parseGlyphCoordinate(t,y,_,4,32),_=w.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,c=!0;for(;c;){a=t.view.readUint16();const h={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=t.view.readInt16(),h.dy=t.view.readInt16()):h.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(h.dx=t.view.readInt8(),h.dy=t.view.readInt8()):h.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?h.xScale=h.yScale=t.view.readInt16()/16384:(a&64)>0?(h.xScale=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384):(a&128)>0&&(h.xScale=t.view.readInt16()/16384,h.scale01=t.view.readInt16()/16384,h.scale10=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384),this.components.push(h),c=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const c=this.components[a],h=n.get(c.glyphIndex);if(h.getPathCommands(),h.points){let l;if(c.matchedPoints===void 0)l=this._transformPoints(h.points,c);else{jt(c.matchedPoints[0]>this.points.length-1||c.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[c.matchedPoints[0]];let p=h.points[c.matchedPoints[1]];const y={xScale:c.xScale,scale01:c.scale01,scale10:c.scale10,yScale:c.yScale,dx:0,dy:0};p=this._transformPoints([p],y)[0],y.dx=u.x-p.x,y.dy=u.y-p.y,l=this._transformPoints(h.points,y)}this.points=this.points.concat(l)}}const s=[],o=this._parseContours(this.points);for(let a=0,c=o.length;a<c;++a){const h=o[a];let l=h[h.length-1],u=h[0];l.onCurve?s.push({type:"M",x:l.x,y:l.y}):u.onCurve?s.push({type:"M",x:u.x,y:u.y}):s.push({type:"M",x:(l.x+u.x)*.5,y:(l.y+u.y)*.5});for(let p=0,y=h.length;p<y;++p)if(l=u,u=h[(p+1)%y],l.onCurve)s.push({type:"L",x:l.x,y:l.y});else{let g=u;u.onCurve||(g={x:(l.x+u.x)*.5,y:(l.y+u.y)*.5}),s.push({type:"Q",x1:l.x,y1:l.y,x:g.x,y:g.y})}s.push({type:"Z"})}this.pathCommands=s}getPathCommands(t=0,e=0,n=72,r={},s){const o=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:a=o,yScale:c=o}=r,h=this.pathCommands,l=[];for(let u=0,p=h.length;u<p;u+=1){const y=h[u];y.type==="M"?l.push({type:"M",x:t+y.x*a,y:e+-y.y*c}):y.type==="L"?l.push({type:"L",x:t+y.x*a,y:e+-y.y*c}):y.type==="Q"?l.push({type:"Q",x1:t+y.x1*a,y1:e+-y.y1*c,x:t+y.x*a,y:e+-y.y*c}):y.type==="Z"&&l.push({type:"Z"})}return l}}var fi=Object.defineProperty,pi=(i,t,e)=>t in i?fi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,di=(i,t,e)=>(pi(i,t+"",e),e);class _n{constructor(t){this._sfnt=t,di(this,"_items",[])}get length(){return this._sfnt.loca.locations.length}get(t){const e=this._items[t];let n;if(e)n=e;else{n=new xn({index:t});const r=this._sfnt.loca.locations,s=this._sfnt.hmtx.metrics,o=s[t],a=r[t];o&&(n.advanceWidth=s[t].advanceWidth,n.leftSideBearing=s[t].leftSideBearing),a!==r[t+1]&&n._parse(this._sfnt.glyf,a,this),this._items[t]=n}return n}}var Pn=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,yi=(i,t,e)=>t in i?Pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mi=(i,t,e,n)=>{for(var r=n>1?void 0:n?gi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Pn(t,e,r),r},wi=(i,t,e)=>(yi(i,t+"",e),e);const Gt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends Z{constructor(){super(...arguments),wi(this,"_glyphs")}static from(t){const e=t.reduce((r,s)=>r+s.byteLength,0),n=new f.Glyf(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs||(this._glyphs=new _n(this._sfnt)),this._glyphs}},f.Glyf=mi([j("glyf")],f.Glyf);var vi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,xi=(i,t,e,n)=>{for(var r=n>1?void 0:n?bi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&vi(t,e,r),r};f.Gpos=class extends Z{},f.Gpos=xi([j("GPOS","gpos")],f.Gpos);var _i=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,Dt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Pi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&_i(t,e,r),r};f.Gsub=class extends Z{},Dt([d("uint16")],f.Gsub.prototype,"majorVersion",2),Dt([d("uint16")],f.Gsub.prototype,"minorVersion",2),Dt([d("uint16")],f.Gsub.prototype,"scriptListOffset",2),Dt([d("uint16")],f.Gsub.prototype,"featureListOffset",2),Dt([d("uint16")],f.Gsub.prototype,"lookupListOffset",2),Dt([d("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Dt([j("GSUB","gsub")],f.Gsub);var Si=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,G=(i,t,e,n)=>{for(var r=n>1?void 0:n?Mi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Si(t,e,r),r};f.Head=class extends Z{constructor(t=new ArrayBuffer(54),e){super(t,e,54)}},G([d("fixed")],f.Head.prototype,"version",2),G([d("fixed")],f.Head.prototype,"fontRevision",2),G([d("uint32")],f.Head.prototype,"checkSumAdjustment",2),G([d("uint32")],f.Head.prototype,"magickNumber",2),G([d("uint16")],f.Head.prototype,"flags",2),G([d("uint16")],f.Head.prototype,"unitsPerEm",2),G([d({type:"longDateTime"})],f.Head.prototype,"created",2),G([d({type:"longDateTime"})],f.Head.prototype,"modified",2),G([d("int16")],f.Head.prototype,"xMin",2),G([d("int16")],f.Head.prototype,"yMin",2),G([d("int16")],f.Head.prototype,"xMax",2),G([d("int16")],f.Head.prototype,"yMax",2),G([d("uint16")],f.Head.prototype,"macStyle",2),G([d("uint16")],f.Head.prototype,"lowestRecPPEM",2),G([d("int16")],f.Head.prototype,"fontDirectionHint",2),G([d("int16")],f.Head.prototype,"indexToLocFormat",2),G([d("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=G([j("head")],f.Head);var Ci=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,J=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ti(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Ci(t,e,r),r};f.Hhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},J([d("fixed")],f.Hhea.prototype,"version",2),J([d("int16")],f.Hhea.prototype,"ascent",2),J([d("int16")],f.Hhea.prototype,"descent",2),J([d("int16")],f.Hhea.prototype,"lineGap",2),J([d("uint16")],f.Hhea.prototype,"advanceWidthMax",2),J([d("int16")],f.Hhea.prototype,"minLeftSideBearing",2),J([d("int16")],f.Hhea.prototype,"minRightSideBearing",2),J([d("int16")],f.Hhea.prototype,"xMaxExtent",2),J([d("int16")],f.Hhea.prototype,"caretSlopeRise",2),J([d("int16")],f.Hhea.prototype,"caretSlopeRun",2),J([d("int16")],f.Hhea.prototype,"caretOffset",2),J([d({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),J([d("int16")],f.Hhea.prototype,"metricDataFormat",2),J([d("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=J([j("hhea")],f.Hhea);var Sn=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,Ai=(i,t,e)=>t in i?Sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$i=(i,t,e,n)=>{for(var r=n>1?void 0:n?Oi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Sn(t,e,r),r},Ii=(i,t,e)=>(Ai(i,t+"",e),e);f.Hmtx=class extends Z{constructor(){super(...arguments),Ii(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Hmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let n=0;return this.view.seek(0),Array.from({length:t}).map((r,s)=>(s<e&&(n=this.view.readUint16()),{advanceWidth:n,leftSideBearing:this.view.readUint16()}))}},f.Hmtx=$i([j("hmtx")],f.Hmtx);var Di=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,Ui=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ei(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Di(t,e,r),r};f.Kern=class extends Z{},f.Kern=Ui([j("kern","kern")],f.Kern);var Mn=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,Bi=(i,t,e)=>t in i?Mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Li(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Mn(t,e,r),r},Ni=(i,t,e)=>(Bi(i,t+"",e),e);f.Loca=class extends Z{constructor(){super(...arguments),Ni(this,"_locations")}static from(t,e=1){const n=t.length*(e?4:2),r=new f.Loca(new ArrayBuffer(n));return t.forEach(s=>{e?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations||(this._locations=this._getLocations()),this._locations}_getLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat;return this.view.seek(0),Array.from({length:t}).map(()=>e?this.view.readUint32():this.view.readUint16()*2)}},f.Loca=Fi([j("loca")],f.Loca);var Gi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,Y=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ri(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Gi(t,e,r),r};f.Maxp=class extends Z{constructor(t=new ArrayBuffer(32),e){super(t,e,32)}},Y([d("fixed")],f.Maxp.prototype,"version",2),Y([d("uint16")],f.Maxp.prototype,"numGlyphs",2),Y([d("uint16")],f.Maxp.prototype,"maxPoints",2),Y([d("uint16")],f.Maxp.prototype,"maxContours",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentPoints",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentContours",2),Y([d("uint16")],f.Maxp.prototype,"maxZones",2),Y([d("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),Y([d("uint16")],f.Maxp.prototype,"maxStorage",2),Y([d("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),Y([d("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),Y([d("uint16")],f.Maxp.prototype,"maxStackElements",2),Y([d("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentElements",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=Y([j("maxp")],f.Maxp);var Vi=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,me=(i,t,e,n)=>{for(var r=n>1?void 0:n?ki(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Vi(t,e,r),r};const Cn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},ke={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Hi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Tn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends Z{getNames(){const t=this.count;this.view.seek(6);const e=[];for(let c=0;c<t;++c)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let c=0;c<t;++c){const h=e[c];h.name=this.view.readBytes(n+h.offset,h.length)}let r=ke.Macintosh,s=Hi.Default,o=0;e.some(c=>c.platform===ke.Microsoft&&c.encoding===Tn.UCS2&&c.language===1033)&&(r=ke.Microsoft,s=Tn.UCS2,o=1033);const a={};for(let c=0;c<t;++c){const h=e[c];h.platform===r&&h.encoding===s&&h.language===o&&Cn[h.nameId]&&(a[Cn[h.nameId]]=o===0?Hr(h.name):zr(h.name))}return a}},me([d("uint16")],f.Name.prototype,"format",2),me([d("uint16")],f.Name.prototype,"count",2),me([d("uint16")],f.Name.prototype,"stringOffset",2),f.Name=me([j("name")],f.Name);var zi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,M=(i,t,e,n)=>{for(var r=n>1?void 0:n?Wi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&zi(t,e,r),r};f.Os2=class extends Z{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},M([d("uint16")],f.Os2.prototype,"version",2),M([d("int16")],f.Os2.prototype,"xAvgCharWidth",2),M([d("uint16")],f.Os2.prototype,"usWeightClass",2),M([d("uint16")],f.Os2.prototype,"usWidthClass",2),M([d("uint16")],f.Os2.prototype,"fsType",2),M([d("uint16")],f.Os2.prototype,"ySubscriptXSize",2),M([d("uint16")],f.Os2.prototype,"ySubscriptYSize",2),M([d("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),M([d("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),M([d("uint16")],f.Os2.prototype,"yStrikeoutSize",2),M([d("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),M([d("uint16")],f.Os2.prototype,"sFamilyClass",2),M([d({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),M([d({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),M([d({type:"uint8"})],f.Os2.prototype,"bWeight",2),M([d({type:"uint8"})],f.Os2.prototype,"bProportion",2),M([d({type:"uint8"})],f.Os2.prototype,"bContrast",2),M([d({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),M([d({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),M([d({type:"uint8"})],f.Os2.prototype,"bLetterform",2),M([d({type:"uint8"})],f.Os2.prototype,"bMidline",2),M([d({type:"uint8"})],f.Os2.prototype,"bXHeight",2),M([d({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),M([d({type:"char",size:4})],f.Os2.prototype,"achVendID",2),M([d("uint16")],f.Os2.prototype,"fsSelection",2),M([d("uint16")],f.Os2.prototype,"usFirstCharIndex",2),M([d("uint16")],f.Os2.prototype,"usLastCharIndex",2),M([d("int16")],f.Os2.prototype,"sTypoAscender",2),M([d("int16")],f.Os2.prototype,"sTypoDescender",2),M([d("int16")],f.Os2.prototype,"sTypoLineGap",2),M([d("uint16")],f.Os2.prototype,"usWinAscent",2),M([d("uint16")],f.Os2.prototype,"usWinDescent",2),M([d({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),M([d({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),M([d("int16")],f.Os2.prototype,"sCapHeight",2),M([d("uint16")],f.Os2.prototype,"usDefaultChar",2),M([d("uint16")],f.Os2.prototype,"usBreakChar",2),M([d("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=M([j("OS/2","os2")],f.Os2);var Xi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,mt=(i,t,e,n)=>{for(var r=n>1?void 0:n?qi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Xi(t,e,r),r};f.Post=class extends Z{constructor(t=new ArrayBuffer(32),e,n){super(t,e,n)}},mt([d("fixed")],f.Post.prototype,"format",2),mt([d("fixed")],f.Post.prototype,"italicAngle",2),mt([d("int16")],f.Post.prototype,"underlinePosition",2),mt([d("int16")],f.Post.prototype,"underlineThickness",2),mt([d("uint32")],f.Post.prototype,"isFixedPitch",2),mt([d("uint32")],f.Post.prototype,"minMemType42",2),mt([d("uint32")],f.Post.prototype,"maxMemType42",2),mt([d("uint32")],f.Post.prototype,"minMemType1",2),mt([d("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=mt([j("post")],f.Post);var ji=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,tt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Yi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&ji(t,e,r),r};f.Vhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},tt([d("fixed")],f.Vhea.prototype,"version",2),tt([d("int16")],f.Vhea.prototype,"vertTypoAscender",2),tt([d("int16")],f.Vhea.prototype,"vertTypoDescender",2),tt([d("int16")],f.Vhea.prototype,"vertTypoLineGap",2),tt([d("int16")],f.Vhea.prototype,"advanceHeightMax",2),tt([d("int16")],f.Vhea.prototype,"minTopSideBearing",2),tt([d("int16")],f.Vhea.prototype,"minBottomSideBearing",2),tt([d("int16")],f.Vhea.prototype,"yMaxExtent",2),tt([d("int16")],f.Vhea.prototype,"caretSlopeRise",2),tt([d("int16")],f.Vhea.prototype,"caretSlopeRun",2),tt([d("int16")],f.Vhea.prototype,"caretOffset",2),tt([d({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),tt([d("int16")],f.Vhea.prototype,"metricDataFormat",2),tt([d("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=tt([j("vhea")],f.Vhea);var On=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Qi=(i,t,e)=>t in i?On(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ki(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&On(t,e,r),r},Ji=(i,t,e)=>(Qi(i,t+"",e),e);f.Vmtx=class extends Z{constructor(){super(...arguments),Ji(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Vmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){var r;const t=this._sfnt.maxp.numGlyphs,e=((r=this._sfnt.vhea)==null?void 0:r.numOfLongVerMetrics)??0;this.view.seek(0);let n=0;return Array.from({length:t}).map((s,o)=>(o<e&&(n=this.view.readUint16()),{advanceHeight:n,topSideBearing:this.view.readUint8()}))}},f.Vmtx=Zi([j("vmtx")],f.Vmtx);var An=Object.defineProperty,ts=(i,t,e)=>t in i?An(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&An(t,e,r),r},He=(i,t,e)=>(ts(i,typeof t!="symbol"?t+"":t,e),e);const Et=class Pe extends de{constructor(){super(...arguments),He(this,"mimeType","font/ttf"),He(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checksum(t){const e=At(t);let n=e.byteLength;for(;n%4;)n++;let r=0;for(let s=0,o=n/4;s<o;s+=4)s*4<n-4&&(r+=e.getUint32(s*4,!1));return r&4294967295}static from(t){const e=u=>u+3&-4,n=t.tableViews.size,r=t.tableViews.values().reduce((u,p)=>u+e(p.byteLength),0),s=new Pe(new ArrayBuffer(12+n*16+r)),o=Math.log(2);s.scalerType=65536,s.numTables=n,s.searchRange=Math.floor(Math.log(n)/o)*16,s.entrySelector=Math.floor(s.searchRange/o),s.rangeShift=n*16-s.searchRange;let a=12+n*16,c=0;const h=s.getDirectories();t.tableViews.forEach((u,p)=>{const y=h[c++];y.tag=p,y.checkSum=Pe.checksum(u),y.offset=a,y.length=u.byteLength,s.view.writeBytes(u,a),a+=e(y.length)});const l=s.createSfnt().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-Pe.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Ft(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}};He(Et,"FLAGS",new Set([65536,1953658213,1954115633,1330926671])),ee([d("uint32")],Et.prototype,"scalerType"),ee([d("uint16")],Et.prototype,"numTables"),ee([d("uint16")],Et.prototype,"searchRange"),ee([d("uint16")],Et.prototype,"entrySelector"),ee([d("uint16")],Et.prototype,"rangeShift");let _t=Et;var es=Object.defineProperty,ne=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&es(t,e,r),r};class Ut extends yt{constructor(t,e){super(t,e,20)}}ne([d({type:"char",size:4})],Ut.prototype,"tag"),ne([d("uint32")],Ut.prototype,"offset"),ne([d("uint32")],Ut.prototype,"compLength"),ne([d("uint32")],Ut.prototype,"origLength"),ne([d("uint32")],Ut.prototype,"origChecksum");var $n=Object.defineProperty,ns=(i,t,e)=>t in i?$n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,st=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&$n(t,e,r),r},ze=(i,t,e)=>(ns(i,typeof t!="symbol"?t+"":t,e),e);const et=class en extends de{constructor(){super(...arguments),ze(this,"mimeType","font/woff"),ze(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checkSum(t){const e=At(t),n=e.byteLength,r=Math.floor(n/4);let s=0,o=0;for(;o<r;)s+=e.getUint32(4*o++,!1);let a=n-r*4;if(a){let c=r*4;for(;a>0;)s+=e.getUint8(c)<<a*8,c++,a--}return s%4294967296}static from(t,e=new ArrayBuffer(0)){const n=u=>u+3&-4,r=[];t.tableViews.forEach((u,p)=>{const y=At(Ir(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));r.push({tag:p,view:y.byteLength<u.byteLength?y:u,rawView:u})});const s=r.length,o=r.reduce((u,p)=>u+n(p.view.byteLength),0),a=new en(new ArrayBuffer(44+20*s+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=s,a.totalSfntSize=12+16*s+r.reduce((u,p)=>u+n(p.rawView.byteLength),0);let c=44+s*20,h=0;const l=a.getDirectories();return r.forEach(u=>{const p=l[h++];p.tag=u.tag,p.offset=c,p.compLength=u.view.byteLength,p.origChecksum=en.checkSum(u.rawView),p.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,c),c+=n(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Ut(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>{const n=e.tag,r=this.view.byteOffset+e.offset,s=e.compLength,o=e.origLength,a=r+s;return t[n]=s>=o?new DataView(this.view.buffer,r,s):new DataView(Dr(new Uint8Array(this.view.buffer.slice(r,a))).buffer),t},{}))}};ze(et,"FLAGS",new Set([2001684038])),st([d("uint32")],et.prototype,"signature"),st([d("uint32")],et.prototype,"flavor"),st([d("uint32")],et.prototype,"length"),st([d("uint16")],et.prototype,"numTables"),st([d("uint16")],et.prototype,"reserved"),st([d("uint32")],et.prototype,"totalSfntSize"),st([d("uint16")],et.prototype,"majorVersion"),st([d("uint16")],et.prototype,"minorVersion"),st([d("uint32")],et.prototype,"metaOffset"),st([d("uint32")],et.prototype,"metaLength"),st([d("uint32")],et.prototype,"metaOrigLength"),st([d("uint32")],et.prototype,"privOffset"),st([d("uint32")],et.prototype,"privLength");let Pt=et;var rs=Object.defineProperty,is=(i,t,e)=>t in i?rs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,re=(i,t,e)=>(is(i,typeof t!="symbol"?t+"":t,e),e);const In=class mr{constructor(){re(this,"fallbackFont"),re(this,"_loading",new Map),re(this,"_loaded",new Map),re(this,"_namesUrls",new Map)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...mr.defaultRequestInit,...e,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
|
|
1
|
+
(function(p,it){typeof exports=="object"&&typeof module<"u"?it(exports):typeof define=="function"&&define.amd?define(["exports"],it):(p=typeof globalThis<"u"?globalThis:p||self,it(p.modernText={}))})(this,function(p){"use strict";var Ho=Object.defineProperty;var Wo=(p,it,Ct)=>it in p?Ho(p,it,{enumerable:!0,configurable:!0,writable:!0,value:Ct}):p[it]=Ct;var F=(p,it,Ct)=>Wo(p,typeof it!="symbol"?it+"":it,Ct);function it(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:o,stops:a}=Vn(t,e.left,e.top,e.width,e.height),h=s.createLinearGradient(r,n,i,o);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Ct(s,t,e){s!=null&&s.color&&(s.color=it(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=it(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=it(e,s.textStrokeColor,t))}function Vn(s,t,e,r,n){var m;const i=((m=s.match(/linear-gradient\((.+)\)$/))==null?void 0:m[1])??"",o=i.split(",")[0],a=o.includes("deg")?o:"0deg",h=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),u=(Number(a.replace("deg",""))||0)*Math.PI/180,c=r*Math.sin(u),d=n*Math.cos(u);return{x0:t+r/2-c,y0:e+n/2+d,x1:t+r/2+c,y1:e+n/2-d,stops:Array.from(h).map(g=>{let w=g[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(g[3].replace("%",""))/100,color:w}})}}function Fe(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const i=e.style;e.style={...i,fill:s.color??i.fill,stroke:s.textStrokeColor??i.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:i.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};const o=(s.offsetX??0)*r,a=(s.offsetY??0)*r;t.translate(o,a),n&&(t.rect(n.x,n.y,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t),t.restore()}var ot=Uint8Array,mt=Uint16Array,Ne=Int32Array,we=new ot([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]),ve=new ot([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]),ke=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),br=function(s,t){for(var e=new mt(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new Ne(e[30]),r=1;r<30;++r)for(var i=e[r];i<e[r+1];++i)n[i]=i-e[r]<<5|r;return{b:e,r:n}},xr=br(we,2),_r=xr.b,Ge=xr.r;_r[28]=258,Ge[258]=28;for(var Sr=br(ve,0),Hn=Sr.b,Pr=Sr.r,Re=new mt(32768),N=0;N<32768;++N){var Ft=(N&43690)>>1|(N&21845)<<1;Ft=(Ft&52428)>>2|(Ft&13107)<<2,Ft=(Ft&61680)>>4|(Ft&3855)<<4,Re[N]=((Ft&65280)>>8|(Ft&255)<<8)>>1}for(var Mt=function(s,t,e){for(var r=s.length,n=0,i=new mt(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new mt(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new mt(1<<t);var h=15-t;for(n=0;n<r;++n)if(s[n])for(var l=n<<4|s[n],u=t-s[n],c=o[s[n]-1]++<<u,d=c|(1<<u)-1;c<=d;++c)a[Re[c]>>h]=l}else for(a=new mt(r),n=0;n<r;++n)s[n]&&(a[n]=Re[o[s[n]-1]++]>>15-s[n]);return a},Nt=new ot(288),N=0;N<144;++N)Nt[N]=8;for(var N=144;N<256;++N)Nt[N]=9;for(var N=256;N<280;++N)Nt[N]=7;for(var N=280;N<288;++N)Nt[N]=8;for(var ee=new ot(32),N=0;N<32;++N)ee[N]=5;var Wn=Mt(Nt,9,0),Xn=Mt(Nt,9,1),jn=Mt(ee,5,0),Yn=Mt(ee,5,1),ze=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},St=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},qe=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},Ve=function(s){return(s+7)/8|0},Cr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ot(s.subarray(t,e))},Kn=["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"],Pt=function(s,t,e){var r=new Error(t||Kn[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,Pt),!e)throw r;return r},Zn=function(s,t,e,r){var n=s.length,i=0;if(!n||t.f&&!t.l)return e||new ot(0);var o=!e,a=o||t.i!=2,h=t.i;o&&(e=new ot(n*3));var l=function(It){var Et=e.length;if(It>Et){var Bt=new ot(Math.max(Et*2,It));Bt.set(e),e=Bt}},u=t.f||0,c=t.p||0,d=t.b||0,m=t.l,g=t.d,w=t.m,f=t.n,P=n*8;do{if(!m){u=St(s,c,1);var _=St(s,c+1,3);if(c+=3,_)if(_==1)m=Xn,g=Yn,w=9,f=5;else if(_==2){var b=St(s,c,31)+257,A=St(s,c+10,15)+4,C=b+St(s,c+5,31)+1;c+=14;for(var M=new ot(C),L=new ot(19),X=0;X<A;++X)L[ke[X]]=St(s,c+X*3,7);c+=A*3;for(var j=ze(L),xt=(1<<j)-1,E=Mt(L,j,1),X=0;X<C;){var U=E[St(s,c,xt)];c+=U&15;var x=U>>4;if(x<16)M[X++]=x;else{var q=0,D=0;for(x==16?(D=3+St(s,c,3),c+=2,q=M[X-1]):x==17?(D=3+St(s,c,7),c+=3):x==18&&(D=11+St(s,c,127),c+=7);D--;)M[X++]=q}}var J=M.subarray(0,b),V=M.subarray(b);w=ze(J),f=ze(V),m=Mt(J,w,1),g=Mt(V,f,1)}else Pt(1);else{var x=Ve(c)+4,O=s[x-4]|s[x-3]<<8,v=x+O;if(v>n){h&&Pt(0);break}a&&l(d+O),e.set(s.subarray(x,v),d),t.b=d+=O,t.p=c=v*8,t.f=u;continue}if(c>P){h&&Pt(0);break}}a&&l(d+131072);for(var _t=(1<<w)-1,k=(1<<f)-1,Q=c;;Q=c){var q=m[qe(s,c)&_t],B=q>>4;if(c+=q&15,c>P){h&&Pt(0);break}if(q||Pt(2),B<256)e[d++]=B;else if(B==256){Q=c,m=null;break}else{var G=B-254;if(B>264){var X=B-257,I=we[X];G=St(s,c,(1<<I)-1)+_r[X],c+=I}var Y=g[qe(s,c)&k],H=Y>>4;Y||Pt(3),c+=Y&15;var V=Hn[H];if(H>3){var I=ve[H];V+=qe(s,c)&(1<<I)-1,c+=I}if(c>P){h&&Pt(0);break}a&&l(d+131072);var tt=d+G;if(d<V){var Xt=i-V,jt=Math.min(V,tt);for(Xt+d<0&&Pt(3);d<jt;++d)e[d]=r[Xt+d]}for(;d<tt;++d)e[d]=e[d-V]}}t.l=m,t.p=Q,t.b=d,t.f=u,m&&(u=1,t.m=w,t.d=g,t.n=f)}while(!u);return d!=e.length&&o?Cr(e,0,d):e.subarray(0,d)},$t=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},re=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},He=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,i=e.slice();if(!n)return{t:Ar,l:0};if(n==1){var o=new ot(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(v,b){return v.f-b.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],l=0,u=1,c=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=n-1;)a=e[e[l].f<e[c].f?l++:c++],h=e[l!=u&&e[l].f<e[c].f?l++:c++],e[u++]={s:-1,f:a.f+h.f,l:a,r:h};for(var d=i[0].s,r=1;r<n;++r)i[r].s>d&&(d=i[r].s);var m=new mt(d+1),g=We(e[u-1],m,0);if(g>t){var r=0,w=0,f=g-t,P=1<<f;for(i.sort(function(b,A){return m[A.s]-m[b.s]||b.f-A.f});r<n;++r){var _=i[r].s;if(m[_]>t)w+=P-(1<<g-m[_]),m[_]=t;else break}for(w>>=f;w>0;){var x=i[r].s;m[x]<t?w-=1<<t-m[x]++-1:++r}for(;r>=0&&w;--r){var O=i[r].s;m[O]==t&&(--m[O],++w)}g=t}return{t:new ot(m),l:g}},We=function(s,t,e){return s.s==-1?Math.max(We(s.l,t,e+1),We(s.r,t,e+1)):t[s.s]=e},Mr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new mt(++t),r=0,n=s[0],i=1,o=function(h){e[r++]=h},a=1;a<=t;++a)if(s[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=s[a]}return{c:e.subarray(0,r),n:t}},ne=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Or=function(s,t,e){var r=e.length,n=Ve(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var i=0;i<r;++i)s[n+i+4]=e[i];return(n+4+r)*8},Tr=function(s,t,e,r,n,i,o,a,h,l,u){$t(t,u++,e),++n[256];for(var c=He(n,15),d=c.t,m=c.l,g=He(i,15),w=g.t,f=g.l,P=Mr(d),_=P.c,x=P.n,O=Mr(w),v=O.c,b=O.n,A=new mt(19),C=0;C<_.length;++C)++A[_[C]&31];for(var C=0;C<v.length;++C)++A[v[C]&31];for(var M=He(A,7),L=M.t,X=M.l,j=19;j>4&&!L[ke[j-1]];--j);var xt=l+5<<3,E=ne(n,Nt)+ne(i,ee)+o,U=ne(n,d)+ne(i,w)+o+14+3*j+ne(A,L)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&xt<=E&&xt<=U)return Or(t,u,s.subarray(h,h+l));var q,D,J,V;if($t(t,u,1+(U<E)),u+=2,U<E){q=Mt(d,m,0),D=d,J=Mt(w,f,0),V=w;var _t=Mt(L,X,0);$t(t,u,x-257),$t(t,u+5,b-1),$t(t,u+10,j-4),u+=14;for(var C=0;C<j;++C)$t(t,u+3*C,L[ke[C]]);u+=3*j;for(var k=[_,v],Q=0;Q<2;++Q)for(var B=k[Q],C=0;C<B.length;++C){var G=B[C]&31;$t(t,u,_t[G]),u+=L[G],G>15&&($t(t,u,B[C]>>5&127),u+=B[C]>>12)}}else q=Wn,D=Nt,J=jn,V=ee;for(var C=0;C<a;++C){var I=r[C];if(I>255){var G=I>>18&31;re(t,u,q[G+257]),u+=D[G+257],G>7&&($t(t,u,I>>23&31),u+=we[G]);var Y=I&31;re(t,u,J[Y]),u+=V[Y],Y>3&&(re(t,u,I>>5&8191),u+=ve[Y])}else re(t,u,q[I]),u+=D[I]}return re(t,u,q[256]),u+D[256]},Qn=new Ne([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ar=new ot(0),Jn=function(s,t,e,r,n,i){var o=i.z||s.length,a=new ot(r+o+5*(1+Math.ceil(o/7e3))+n),h=a.subarray(r,a.length-n),l=i.l,u=(i.r||0)&7;if(t){u&&(h[0]=i.r>>3);for(var c=Qn[t-1],d=c>>13,m=c&8191,g=(1<<e)-1,w=i.p||new mt(32768),f=i.h||new mt(g+1),P=Math.ceil(e/3),_=2*P,x=function(te){return(s[te]^s[te+1]<<P^s[te+2]<<_)&g},O=new Ne(25e3),v=new mt(288),b=new mt(32),A=0,C=0,M=i.i||0,L=0,X=i.w||0,j=0;M+2<o;++M){var xt=x(M),E=M&32767,U=f[xt];if(w[E]=U,f[xt]=E,X<=M){var q=o-M;if((A>7e3||L>24576)&&(q>423||!l)){u=Tr(s,h,0,O,v,b,C,L,j,M-j,u),L=A=C=0,j=M;for(var D=0;D<286;++D)v[D]=0;for(var D=0;D<30;++D)b[D]=0}var J=2,V=0,_t=m,k=E-U&32767;if(q>2&&xt==x(M-k))for(var Q=Math.min(d,q)-1,B=Math.min(32767,M),G=Math.min(258,q);k<=B&&--_t&&E!=U;){if(s[M+J]==s[M+J-k]){for(var I=0;I<G&&s[M+I]==s[M+I-k];++I);if(I>J){if(J=I,V=k,I>Q)break;for(var Y=Math.min(k,I-2),H=0,D=0;D<Y;++D){var tt=M-k+D&32767,Xt=w[tt],jt=tt-Xt&32767;jt>H&&(H=jt,U=tt)}}}E=U,U=w[E],k+=E-U&32767}if(V){O[L++]=268435456|Ge[J]<<18|Pr[V];var It=Ge[J]&31,Et=Pr[V]&31;C+=we[It]+ve[Et],++v[257+It],++b[Et],X=M+J,++A}else O[L++]=s[M],++v[s[M]]}}for(M=Math.max(M,X);M<o;++M)O[L++]=s[M],++v[s[M]];u=Tr(s,h,l,O,v,b,C,L,j,M-j,u),l||(i.r=u&7|h[u/8|0]<<3,u-=7,i.h=f,i.p=w,i.i=M,i.w=X)}else{for(var M=i.w||0;M<o+l;M+=65535){var Bt=M+65535;Bt>=o&&(h[u/8|0]=l,Bt=o),u=Or(h,u+1,s.subarray(M,Bt))}i.i=o}return Cr(a,0,r+Ve(u)+n)},Ir=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,i=e.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)n+=r+=e[o];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},ts=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ot(i.length+s.length);o.set(i),o.set(s,i.length),s=o,n.w=i.length}return Jn(s,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+t.mem,e,r,n)},Er=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},es=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Ir();n.p(t.dictionary),Er(s,2,n.d())}},rs=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&Pt(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&Pt(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function ns(s,t){t||(t={});var e=Ir();e.p(s);var r=ts(s,t,t.dictionary?6:2,4);return es(r,t),Er(r,r.length-4,e.d()),r}function ss(s,t){return Zn(s.subarray(rs(s,t),-4),{i:2},t,t)}var is=typeof TextDecoder<"u"&&new TextDecoder,os=0;try{is.decode(Ar,{stream:!0}),os=1}catch{}const as="modern-font";function se(s,t){if(!s)throw new Error(`[${as}] ${t}`)}function ls(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function Gt(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Ur=Object.defineProperty,hs=(s,t,e)=>t in s?Ur(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,at=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ur(t,e,n),n},cs=(s,t,e)=>(hs(s,t+"",e),e);const be={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function lt(){return function(s,t){Object.defineProperty(s.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 rt extends DataView{constructor(t,e,r,n){super(ls(t),e,r),this.littleEndian=n,cs(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));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,n)=>{this.write(t.type,e[n],t.offset+n)}):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 n=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,i=this[n](e,r);return this.cursor+=be[t],i}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let i=0,o=r.length;i<o;i++)n+=String.fromCharCode(r[i]);return n}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),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=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 i=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[i](r,e,n);return this.cursor+=be[t.toLowerCase()],o}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,i=t.length,o;n<i;++n)o=t.charCodeAt(n)||0,o>127?this.writeUint16(o):this.writeUint8(o);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 n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=Gt(t);r=n.byteLength;for(let i=0;i<r;++i)this.setUint8(e+i,n.getUint8(i))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}at([lt()],rt.prototype,"readInt8"),at([lt()],rt.prototype,"readInt16"),at([lt()],rt.prototype,"readInt32"),at([lt()],rt.prototype,"readUint8"),at([lt()],rt.prototype,"readUint16"),at([lt()],rt.prototype,"readUint32"),at([lt()],rt.prototype,"readFloat32"),at([lt()],rt.prototype,"readFloat64"),at([lt()],rt.prototype,"writeInt8"),at([lt()],rt.prototype,"writeInt16"),at([lt()],rt.prototype,"writeInt32"),at([lt()],rt.prototype,"writeUint8"),at([lt()],rt.prototype,"writeUint16"),at([lt()],rt.prototype,"writeUint32"),at([lt()],rt.prototype,"writeFloat32"),at([lt()],rt.prototype,"writeFloat64");var us=Object.defineProperty,fs=(s,t,e)=>t in s?us(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ps=(s,t,e)=>(fs(s,t+"",e),e);const $r=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,i)=>{if(typeof i!="string")return;let o=$r.get(n);o||(o={columns:[],byteLength:0},$r.set(n,o));const a={...t,name:i,byteLength:e*be[r],offset:t.offset??o.columns.reduce((h,l)=>h+l.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((h,l)=>h+be[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class wt{constructor(t,e,r,n){ps(this,"view"),this.view=new rt(t,e,r,n)}}function ds(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function xe(s){s=ds(s);const t=[];for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function gs(s){let t="";for(let e=0,r=s.length;e<r;e++)s[e]<127?t+=String.fromCharCode(s[e]):t+=`%${(256+s[e]).toString(16).slice(1)}`;return unescape(t)}function ms(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}class _e extends wt{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 Dr=Object.defineProperty,ys=(s,t,e)=>t in s?Dr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ft=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Dr(t,e,n),n},Lr=(s,t,e)=>(ys(s,typeof t!="symbol"?t+"":t,e),e);const ht=class kn extends _e{constructor(){super(...arguments),Lr(this,"format","EmbeddedOpenType"),Lr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=xe(n.fontFamily||""),o=i.length,a=xe(n.fontStyle||""),h=a.length,l=xe(n.version||""),u=l.length,c=xe(n.fullName||""),d=c.length,m=86+o+4+h+4+u+4+d+2+t.view.byteLength,g=new kn(new ArrayBuffer(m),0,m,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(g.FontPANOSE=w.fontPANOSE,g.Italic=w.fsSelection,g.Weight=w.usWeightClass,g.fsType=w.fsType,g.UnicodeRange=w.ulUnicodeRange,g.CodePageRange=w.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(i),g.view.writeUint16(0),g.view.writeUint16(h),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(u),g.view.writeBytes(l),g.view.writeUint16(0),g.view.writeUint16(d),g.view.writeBytes(c),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};ft([y("uint32")],ht.prototype,"EOTSize"),ft([y("uint32")],ht.prototype,"FontDataSize"),ft([y("uint32")],ht.prototype,"Version"),ft([y("uint32")],ht.prototype,"Flags"),ft([y({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([y("uint8")],ht.prototype,"Charset"),ft([y("uint8")],ht.prototype,"Italic"),ft([y("uint32")],ht.prototype,"Weight"),ft([y("uint16")],ht.prototype,"fsType"),ft([y("uint16")],ht.prototype,"MagicNumber"),ft([y({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([y({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([y("uint32")],ht.prototype,"CheckSumAdjustment"),ft([y({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([y("uint16")],ht.prototype,"Padding1");let ws=ht;var vs=Object.defineProperty,Se=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&vs(t,e,n),n};class Yt extends wt{constructor(t,e){super(t,e,16)}}Se([y({type:"char",size:4})],Yt.prototype,"tag"),Se([y("uint32")],Yt.prototype,"checkSum"),Se([y("uint32")],Yt.prototype,"offset"),Se([y("uint32")],Yt.prototype,"length");const Xe=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],bs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"];var xs=Object.defineProperty,_s=(s,t,e)=>t in s?xs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Dt=(s,t,e)=>(_s(s,typeof t!="symbol"?t+"":t,e),e);class je{constructor(t){Dt(this,"index"),Dt(this,"name"),Dt(this,"unicode",0),Dt(this,"unicodes",[]),Dt(this,"advanceWidth",0),Dt(this,"leftSideBearing",0),Dt(this,"isComposite",!1),Dt(this,"components",[]),Dt(this,"pathCommands",[]);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,this.unicode=e.unicode??0,this.unicodes=e.unicodes??(e.unicode!==void 0?[e.unicode]:[])}getPathCommands(t=0,e=0,r=72,n={},i){const o=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=o,yScale:h=o}=n,l=this.pathCommands,u=[];for(let c=0,d=l.length;c<d;c+=1){const m=l[c];m.type==="M"?u.push({type:"M",x:t+m.x*a,y:e+-m.y*h}):m.type==="L"?u.push({type:"L",x:t+m.x*a,y:e+-m.y*h}):m.type==="Q"?u.push({type:"Q",x1:t+m.x1*a,y1:e+-m.y1*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="C"?u.push({type:"C",x1:t+m.x1*a,y1:e+-m.y1*h,x2:t+m.x2*a,y2:e+-m.y2*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="Z"&&u.push({type:"Z"})}return u}}class Ss extends je{parse(t,e,r){const n=this,{nominalWidthX:i,defaultWidthX:o,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,u=this.index;let c,d,m,g;const w=[],f=[];let P=0,_=!1,x=!1,O=o,v=0,b=0;function A(E,U){w.push({type:"L",x:E,y:U})}function C(E,U,q,D,J,V){w.push({type:"C",x1:E,y1:U,x2:q,y2:D,x:J,y:V})}function M(E,U){x&&l!==2&&L(),x=!0,w.push({type:"M",x:E,y:U})}function L(){w.push({type:"Z"})}function X(E){w.push(...E)}function j(){f.length%2!==0&&!_&&(O=f.shift()+i),P+=f.length>>1,f.length=0,_=!0}function xt(E){let U,q,D,J,V,_t,k,Q,B,G,I,Y,H=0;for(;H<E.length;){let tt=E[H++];switch(tt){case 1:j();break;case 3:j();break;case 4:f.length>1&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),M(v,b);break;case 5:for(;f.length>0;)v+=f.shift(),b+=f.shift(),A(v,b);break;case 6:for(;f.length>0&&(v+=f.shift(),A(v,b),f.length!==0);)b+=f.shift(),A(v,b);break;case 7:for(;f.length>0&&(b+=f.shift(),A(v,b),f.length!==0);)v+=f.shift(),A(v,b);break;case 8:for(;f.length>0;)c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);break;case 10:V=f.pop()+h,_t=t.subrs[V],_t&&xt(_t);break;case 11:return;case 12:switch(tt=E[H],H+=1,tt){case 35:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),b=Y+f.shift(),f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 34:c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=b,v=I+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 36:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 37:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),Math.abs(I-v)>Math.abs(Y-b)?v=I+f.shift():b=Y+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+tt}`),f.length=0}break;case 14:if(f.length>=4){const Xt=Xe[f.pop()],jt=Xe[f.pop()],It=f.pop(),Et=f.pop();if(Xt&&jt){n.isComposite=!0,n.components=[];const Bt=t.charset.indexOf(Xt),te=t.charset.indexOf(jt);n.components.push({glyphIndex:te,dx:0,dy:0}),n.components.push({glyphIndex:Bt,dx:Et,dy:It}),X(r.get(te).pathCommands);const yr=JSON.parse(JSON.stringify(r.get(Bt).pathCommands));for(let wr=0;wr<yr.length;wr+=1){const Ut=yr[wr];Ut.type!=="Z"&&(Ut.x+=Et,Ut.y+=It),(Ut.type==="Q"||Ut.type==="C")&&(Ut.x1+=Et,Ut.y1+=It),Ut.type==="C"&&(Ut.x2+=Et,Ut.y2+=It)}X(yr)}}else f.length>0&&!_&&(O=f.shift()+i,_=!0);x&&l!==2&&(L(),x=!1);break;case 18:j();break;case 19:case 20:j(),H+=P+7>>3;break;case 21:f.length>2&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),v+=f.pop(),M(v,b);break;case 22:f.length>1&&!_&&(O=f.shift()+i,_=!0),v+=f.pop(),M(v,b);break;case 23:j();break;case 24:for(;f.length>2;)c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);v+=f.shift(),b+=f.shift(),A(v,b);break;case 25:for(;f.length>6;)v+=f.shift(),b+=f.shift(),A(v,b);c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);break;case 26:for(f.length%2&&(v+=f.shift());f.length>0;)c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m,b=g+f.shift(),C(c,d,m,g,v,b);break;case 27:for(f.length%2&&(b+=f.shift());f.length>0;)c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g,C(c,d,m,g,v,b);break;case 28:U=E[H],q=E[H+1],f.push((U<<24|q<<16)>>16),H+=2;break;case 29:V=f.pop()+a,_t=t.gsubrs[V],_t&&xt(_t);break;case 30:for(;f.length>0&&(c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,d,m,g,v,b),f.length!==0);)c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,d,m,g,v,b);break;case 31:for(;f.length>0&&(c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,d,m,g,v,b),f.length!==0);)c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,d,m,g,v,b);break;default:tt<32?console.warn(`Glyph ${u}: unknown operator ${tt}`):tt<247?f.push(tt-139):tt<251?(U=E[H],H+=1,f.push((tt-247)*256+U+108)):tt<255?(U=E[H],H+=1,f.push(-(tt-251)*256-U-108)):(U=E[H],q=E[H+1],D=E[H+2],J=E[H+3],H+=4,f.push((U<<24|q<<16|D<<8|J)/65536))}}}xt(e),this.pathCommands=w,_&&(this.advanceWidth=O)}}var Ps=Object.defineProperty,Cs=(s,t,e)=>t in s?Ps(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ms=(s,t,e)=>(Cs(s,t+"",e),e);class Ye{constructor(t){this._sfnt=t,Ms(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth??(r.advanceWidth=n.advanceWidth),r.leftSideBearing??(r.leftSideBearing=n.leftSideBearing));const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[t]=r}return r}}class Os extends Ye{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Ss({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Br=Object.defineProperty,Ts=(s,t,e)=>t in s?Br(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Br(t,e,n),n},Pe=(s,t,e)=>(Ts(s,typeof t!="symbol"?t+"":t,e),e);class Ce extends wt{constructor(t,e,r,n){super(t,e,r,n),Pe(this,"_offsets"),Pe(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_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 n=[];for(let i=0,o=e+1;i<o;i++){const a=this.view;let h=0;for(let l=0;l<r;l++)h<<=8,h+=a.readUint8();n.push(h)}return n}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,n=r+e[t],o=r+e[t+1]-n;return this._isString?this.view.readString(n,o):this.view.readBytes(n,o)}}Fr([y("uint16")],Ce.prototype,"count"),Fr([y("uint8")],Ce.prototype,"offsetSize");class Me extends Ce{constructor(){super(...arguments),Pe(this,"_isString",!1)}}class Nr extends Ce{constructor(){super(...arguments),Pe(this,"_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"],Es=[".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"],Us=[".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 Oe(s,t){return t<=390?As[t]:s[t-391]}var $s=Object.defineProperty,Ds=(s,t,e)=>t in s?$s(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,kr=(s,t,e)=>(Ds(s,typeof t!="symbol"?t+"":t,e),e);function R(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const i={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(o){this._setProp(i,o)},configurable:!0,enumerable:!0})}}class Gr extends wt{constructor(){super(...arguments),kr(this,"_dict"),kr(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),o=i>>4,a=i&15;if(o===r||(e+=n[o],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,i,o;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),r<<24|n<<16|i<<8|o;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,n={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),n[i]=e,e=[]):e.push(this._readOperand(i))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Oe(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ls=Object.defineProperty,Ke=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ls(t,e,n),n};class Te extends Gr{}Ke([R(19)],Te.prototype,"subrs"),Ke([R(20)],Te.prototype,"defaultWidthX"),Ke([R(21)],Te.prototype,"nominalWidthX");var Bs=Object.defineProperty,K=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Bs(t,e,n),n};class W extends Gr{}K([R(0,"string")],W.prototype,"version"),K([R(1,"string")],W.prototype,"notice"),K([R(1200,"string")],W.prototype,"copyright"),K([R(2,"string")],W.prototype,"fullName"),K([R(3,"string")],W.prototype,"familyName"),K([R(4,"string")],W.prototype,"weight"),K([R(1201)],W.prototype,"isFixedPitch"),K([R(1202)],W.prototype,"italicAngle"),K([R(1203,"number",-100)],W.prototype,"underlinePosition"),K([R(1204,"number",50)],W.prototype,"underlineThickness"),K([R(1205)],W.prototype,"paintType"),K([R(1206,"number",2)],W.prototype,"charstringType"),K([R(1207,"number[]",[.001,0,0,.001,0,0])],W.prototype,"fontMatrix"),K([R(13)],W.prototype,"uniqueId"),K([R(5,"number[]",[0,0,0,0])],W.prototype,"fontBBox"),K([R(1208)],W.prototype,"strokeWidth"),K([R(14)],W.prototype,"xuid"),K([R(15)],W.prototype,"charset"),K([R(16)],W.prototype,"encoding"),K([R(17)],W.prototype,"charStrings"),K([R(18,"number[]",[0,0])],W.prototype,"private");var Fs=Object.defineProperty,Ns=(s,t,e)=>t in s?Fs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ze=(s,t,e)=>(Ns(s,typeof t!="symbol"?t+"":t,e),e);function nt(s,t=s){return e=>{ie.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(ie.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const Rr=class ye{constructor(t){Ze(this,"tables",new Map),Ze(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}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 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:n}=this.cff;e=n.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),n=r.length,i=Array.from({length:n}),o=e.get(0);for(let a=0;a<n;a+=1)i[a]=e.get(r[a])||o;return i}getPathCommands(t,e,r,n,i){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,r,n,i,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,i={},o){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const u=h[l];o.call(this,u,e,r,n,i),u.advanceWidth&&(e+=u.advanceWidth*a),i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e}clone(){return new ye(this.tableViews)}delete(t){const e=ye.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=ye.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ye.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const i=this.tableViews.get(t);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};Ze(Rr,"tableDefinitions",new Map);let ie=Rr;class ct extends wt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var zr=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,Gs=(s,t,e)=>t in s?zr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,oe=(s,t,e,r)=>{for(var n=r>1?void 0:r?ks(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&zr(t,e,n),n},Qe=(s,t,e)=>(Gs(s,typeof t!="symbol"?t+"":t,e),e);p.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),Qe(this,"_glyphs"),Qe(this,"privateDict"),Qe(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Os(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new Nr(e,n),this.topDictIndex=new Me(e,this.nameIndex.endOffset),this.stringIndex=new Nr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Me(e,this.stringIndex.endOffset),this.topDict=new W(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 Te(e,r+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Me(e,r+o+this.privateDict.subrs))),this.charStringsIndex=new Me(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Is:this.topDict.charset===1?this.charset=Es:this.topDict.charset===2?this.charset=Us:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Xe:this.topDict.encoding===1?this.encoding=bs:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let i,o,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(i=0;i<e;i+=1)o=n.readUint16(),h.push(Oe(r,o));else if(l===1)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint8(),i=0;i<=a;i+=1)h.push(Oe(r,o)),o+=1;else if(l===2)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint16(),i=0;i<=a;i+=1)h.push(Oe(r,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const i={},o=e.readUint8();if(o===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),i[n]=r}else if(o===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const h=e.readUint8(),l=e.readUint8();for(let u=h;u<=h+l;u+=1)i[u]=n,n+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},oe([y("uint8")],p.Cff.prototype,"majorVersion",2),oe([y("uint8")],p.Cff.prototype,"minorVersion",2),oe([y("uint8")],p.Cff.prototype,"headerSize",2),oe([y("uint8")],p.Cff.prototype,"offsetSize",2),p.Cff=oe([nt("CFF ","cff")],p.Cff);var Rs=Object.defineProperty,Ae=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Rs(t,e,n),n};const ae=class Gn extends wt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new Gn;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};Ae([y("uint16")],ae.prototype,"format"),Ae([y("uint16")],ae.prototype,"length"),Ae([y("uint16")],ae.prototype,"language"),Ae([y({type:"uint8",size:256})],ae.prototype,"glyphIndexArray");let Je=ae;var zs=Object.defineProperty,tr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&zs(t,e,n),n};class le extends wt{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,n=this.maxSubHeaderKey,i=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(l=>l===n);let h=0;for(let l=0;l<256;l++)if(r[l]===0)l>=a||l<i[0].firstCode||l>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(l-i[0].firstCode)>=o.length?h=0:(h=o[i[0].idRangeOffset+(l-i[0].firstCode)],h!==0&&(h=h+i[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const u=r[l];for(let c=0,d=i[u].entryCount;c<d;c++)if(i[u].idRangeOffset+c>=o.length?h=0:(h=o[i[u].idRangeOffset+c],h!==0&&(h=h+i[u].idDelta)),h!==0&&h<t){const m=(l<<8|c+i[u].firstCode)%65535;e.set(m,h)}}return e}}tr([y("uint16")],le.prototype,"format"),tr([y("uint16")],le.prototype,"length"),tr([y("uint16")],le.prototype,"language");function qr(s){return s>32767?s-65536:s<-32767?s+65536:s}function er(s,t){let e;const r=[];let n={};return s.forEach((i,o)=>{t&&o>t||((!e||o!==e.unicode+1||i!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:o,startId:i,delta:qr(i-o)}):(n.start=Number(o),n.startId=i,n.delta=qr(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var qs=Object.defineProperty,Rt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&qs(t,e,n),n};const kt=class Rn extends wt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=er(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new Rn(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=i,o.entrySelector=n,o.rangeShift=2*r-i,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,o=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let u=n[l],c=i[l];u<=c;++u)if(o[l]===0)t.set(u,(u+a[l])%65536);else{const d=l+o[l]/2+(u-n[l])-r,m=h[d];m!==0?t.set(u,(m+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Rt([y("uint16")],kt.prototype,"format"),Rt([y("uint16")],kt.prototype,"length"),Rt([y("uint16")],kt.prototype,"language"),Rt([y("uint16")],kt.prototype,"segCountX2"),Rt([y("uint16")],kt.prototype,"searchRange"),Rt([y("uint16")],kt.prototype,"entrySelector"),Rt([y("uint16")],kt.prototype,"rangeShift");let rr=kt;var Vs=Object.defineProperty,he=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Vs(t,e,n),n};class zt extends wt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}he([y("uint16")],zt.prototype,"format"),he([y("uint16")],zt.prototype,"length"),he([y("uint16")],zt.prototype,"language"),he([y("uint16")],zt.prototype,"firstCode"),he([y("uint16")],zt.prototype,"entryCount");var Hs=Object.defineProperty,ce=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Hs(t,e,n),n};const Kt=class zn extends wt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=er(t),r=new zn(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const i=e[r];let o=i.startGlyphCode,a=i.startCharCode;const h=i.endCharCode;for(;a<=h;)t.set(a++,o++)}return t}};ce([y("uint16")],Kt.prototype,"format"),ce([y("uint16")],Kt.prototype,"reserved"),ce([y("uint32")],Kt.prototype,"length"),ce([y("uint32")],Kt.prototype,"language"),ce([y("uint32")],Kt.prototype,"nGroups");let nr=Kt;var Ws=Object.defineProperty,sr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ws(t,e,n),n};class ue extends wt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:i}=e[r];i.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}sr([y("uint16")],ue.prototype,"format"),sr([y("uint32")],ue.prototype,"length"),sr([y("uint32")],ue.prototype,"numVarSelectorRecords");var Vr=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,js=(s,t,e)=>t in s?Vr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ir=(s,t,e,r)=>{for(var n=r>1?void 0:r?Xs(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Vr(t,e,n),n},Hr=(s,t,e)=>(js(s,typeof t!="symbol"?t+"":t,e),e);p.Cmap=class extends ct{constructor(){super(...arguments),Hr(this,"_unicodeToGlyphIndexMap"),Hr(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(c=>c>65535),r=rr.from(t),n=Je.from(t),i=e?nr.from(t):void 0,o=4+(i?32:24),a=o+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),u=new p.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((i==null?void 0:i.view.byteLength)??0)));return u.numberSubtables=l.length,u.view.seek(4),l.forEach(c=>{u.view.writeUint16(c.platformID),u.view.writeUint16(c.platformSpecificID),u.view.writeUint32(c.offset)}),u.view.writeBytes(r.view,o),u.view.writeBytes(n.view,a),i&&u.view.writeBytes(i.view,h),u}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,i=r.length;n<i;n++){const o=r[n],a=e.get(o);t.has(a)?t.get(a).push(o):t.set(a,[o])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new Je(this.view.buffer,e.offset);break;case 2:n=new le(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new rr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new zt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new nr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new ue(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,h,l,u,c;const t=this.readSubtables(),e=(a=t.find(d=>d.format===0))==null?void 0:a.view,r=(h=t.find(d=>d.platformID===3&&d.platformSpecificID===3&&d.format===2))==null?void 0:h.view,n=(l=t.find(d=>d.platformID===3&&d.platformSpecificID===1&&d.format===4))==null?void 0:l.view,i=(u=t.find(d=>d.platformID===3&&d.platformSpecificID===10&&d.format===12))==null?void 0:u.view,o=(c=t.find(d=>d.platformID===0&&d.platformSpecificID===5&&d.format===14))==null?void 0:c.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}},ir([y("uint16")],p.Cmap.prototype,"version",2),ir([y("uint16")],p.Cmap.prototype,"numberSubtables",2),p.Cmap=ir([nt("cmap")],p.Cmap);class Ys extends je{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const i=t[n];r.push(i),i.lastPointOfContour&&(e.push(r),r=[])}return se(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const i=t[n],o={x:e.xScale*i.x+e.scale10*i.y+e.dx,y:e.scale01*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(t,e,r,n,i){let o;return(e&n)>0?(o=t.view.readUint8(),e&i||(o=-o),o=r+o):(e&i)>0?o=r:o=r+t.view.readInt16(),o}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let w=0;w<n;w++)a.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();se(h<5e3,`Bad instructionLength:${h}`);const l=this.instructions=[];for(let w=0;w<h;++w)l.push(t.view.readUint8());const u=t.view.byteOffset,c=a[a.length-1]+1;se(c<2e4,`Bad numberOfCoordinates:${u}`);const d=[];let m,g=0;for(;g<c;)if(m=t.view.readUint8(),d.push(m),g++,m&8&&g<c){const w=t.view.readUint8();for(let f=0;f<w;f++)d.push(m),g++}if(se(d.length===c,`Bad flags length: ${d.length}, numberOfCoordinates: ${c}`),a.length>0){const w=[];let f;if(c>0){for(let x=0;x<c;x+=1)m=d[x],f={},f.onCurve=!!(m&1),f.lastPointOfContour=a.includes(x),w.push(f);let P=0;for(let x=0;x<c;x+=1)m=d[x],f=w[x],f.x=this._parseGlyphCoordinate(t,m,P,2,16),P=f.x;let _=0;for(let x=0;x<c;x+=1)m=d[x],f=w[x],f.y=this._parseGlyphCoordinate(t,m,_,4,32),_=f.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let u;if(h.matchedPoints===void 0)u=this._transformPoints(l.points,h);else{se(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const c=this.points[h.matchedPoints[0]];let d=l.points[h.matchedPoints[1]];const m={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};d=this._transformPoints([d],m)[0],m.dx=c.x-d.x,m.dy=c.y-d.y,u=this._transformPoints(l.points,m)}this.points=this.points.concat(u)}}const i=[],o=this._parseContours(this.points);for(let a=0,h=o.length;a<h;++a){const l=o[a];let u=l[l.length-1],c=l[0];u.onCurve?i.push({type:"M",x:u.x,y:u.y}):c.onCurve?i.push({type:"M",x:c.x,y:c.y}):i.push({type:"M",x:(u.x+c.x)*.5,y:(u.y+c.y)*.5});for(let d=0,m=l.length;d<m;++d)if(u=c,c=l[(d+1)%m],u.onCurve)i.push({type:"L",x:u.x,y:u.y});else{let g=c;c.onCurve||(g={x:(u.x+c.x)*.5,y:(u.y+c.y)*.5}),i.push({type:"Q",x1:u.x,y1:u.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class Ks extends Ye{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new Ys({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var Wr=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Qs=(s,t,e)=>t in s?Wr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Js=(s,t,e,r)=>{for(var n=r>1?void 0:r?Zs(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Wr(t,e,n),n},ti=(s,t,e)=>(Qs(s,t+"",e),e);const Zt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};p.Glyf=class extends ct{constructor(){super(...arguments),ti(this,"_glyphs")}static from(t){const e=t.reduce((n,i)=>n+i.byteLength,0),r=new p.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new Ks(this._sfnt))}},p.Glyf=Js([nt("glyf")],p.Glyf);var ei=Object.defineProperty,ri=Object.getOwnPropertyDescriptor,ni=(s,t,e,r)=>{for(var n=r>1?void 0:r?ri(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&ei(t,e,n),n};p.Gpos=class extends ct{},p.Gpos=ni([nt("GPOS","gpos")],p.Gpos);var si=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,qt=(s,t,e,r)=>{for(var n=r>1?void 0:r?ii(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&si(t,e,n),n};p.Gsub=class extends ct{},qt([y("uint16")],p.Gsub.prototype,"majorVersion",2),qt([y("uint16")],p.Gsub.prototype,"minorVersion",2),qt([y("uint16")],p.Gsub.prototype,"scriptListOffset",2),qt([y("uint16")],p.Gsub.prototype,"featureListOffset",2),qt([y("uint16")],p.Gsub.prototype,"lookupListOffset",2),qt([y("uint16")],p.Gsub.prototype,"featureVariationsOffset",2),p.Gsub=qt([nt("GSUB","gsub")],p.Gsub);var oi=Object.defineProperty,ai=Object.getOwnPropertyDescriptor,et=(s,t,e,r)=>{for(var n=r>1?void 0:r?ai(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&oi(t,e,n),n};p.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([y("fixed")],p.Head.prototype,"version",2),et([y("fixed")],p.Head.prototype,"fontRevision",2),et([y("uint32")],p.Head.prototype,"checkSumAdjustment",2),et([y("uint32")],p.Head.prototype,"magickNumber",2),et([y("uint16")],p.Head.prototype,"flags",2),et([y("uint16")],p.Head.prototype,"unitsPerEm",2),et([y({type:"longDateTime"})],p.Head.prototype,"created",2),et([y({type:"longDateTime"})],p.Head.prototype,"modified",2),et([y("int16")],p.Head.prototype,"xMin",2),et([y("int16")],p.Head.prototype,"yMin",2),et([y("int16")],p.Head.prototype,"xMax",2),et([y("int16")],p.Head.prototype,"yMax",2),et([y("uint16")],p.Head.prototype,"macStyle",2),et([y("uint16")],p.Head.prototype,"lowestRecPPEM",2),et([y("int16")],p.Head.prototype,"fontDirectionHint",2),et([y("int16")],p.Head.prototype,"indexToLocFormat",2),et([y("int16")],p.Head.prototype,"glyphDataFormat",2),p.Head=et([nt("head")],p.Head);var li=Object.defineProperty,hi=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?hi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&li(t,e,n),n};p.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([y("fixed")],p.Hhea.prototype,"version",2),pt([y("int16")],p.Hhea.prototype,"ascent",2),pt([y("int16")],p.Hhea.prototype,"descent",2),pt([y("int16")],p.Hhea.prototype,"lineGap",2),pt([y("uint16")],p.Hhea.prototype,"advanceWidthMax",2),pt([y("int16")],p.Hhea.prototype,"minLeftSideBearing",2),pt([y("int16")],p.Hhea.prototype,"minRightSideBearing",2),pt([y("int16")],p.Hhea.prototype,"xMaxExtent",2),pt([y("int16")],p.Hhea.prototype,"caretSlopeRise",2),pt([y("int16")],p.Hhea.prototype,"caretSlopeRun",2),pt([y("int16")],p.Hhea.prototype,"caretOffset",2),pt([y({type:"int16",size:4})],p.Hhea.prototype,"reserved",2),pt([y("int16")],p.Hhea.prototype,"metricDataFormat",2),pt([y("uint16")],p.Hhea.prototype,"numOfLongHorMetrics",2),p.Hhea=pt([nt("hhea")],p.Hhea);var Xr=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,ui=(s,t,e)=>t in s?Xr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fi=(s,t,e,r)=>{for(var n=r>1?void 0:r?ci(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Xr(t,e,n),n},pi=(s,t,e)=>(ui(s,t+"",e),e);p.Hmtx=class extends ct{constructor(){super(...arguments),pi(this,"_metrics")}static from(t){const e=t.length*4,r=new p.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((i,o)=>(o<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},p.Hmtx=fi([nt("hmtx")],p.Hmtx);var di=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,mi=(s,t,e,r)=>{for(var n=r>1?void 0:r?gi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&di(t,e,n),n};p.Kern=class extends ct{},p.Kern=mi([nt("kern","kern")],p.Kern);var jr=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,wi=(s,t,e)=>t in s?jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vi=(s,t,e,r)=>{for(var n=r>1?void 0:r?yi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&jr(t,e,n),n},bi=(s,t,e)=>(wi(s,t+"",e),e);p.Loca=class extends ct{constructor(){super(...arguments),bi(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new p.Loca(new ArrayBuffer(r));return t.forEach(i=>{e?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},p.Loca=vi([nt("loca")],p.Loca);var xi=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,ut=(s,t,e,r)=>{for(var n=r>1?void 0:r?_i(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&xi(t,e,n),n};p.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([y("fixed")],p.Maxp.prototype,"version",2),ut([y("uint16")],p.Maxp.prototype,"numGlyphs",2),ut([y("uint16")],p.Maxp.prototype,"maxPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxContours",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentContours",2),ut([y("uint16")],p.Maxp.prototype,"maxZones",2),ut([y("uint16")],p.Maxp.prototype,"maxTwilightPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxStorage",2),ut([y("uint16")],p.Maxp.prototype,"maxFunctionDefs",2),ut([y("uint16")],p.Maxp.prototype,"maxInstructionDefs",2),ut([y("uint16")],p.Maxp.prototype,"maxStackElements",2),ut([y("uint16")],p.Maxp.prototype,"maxSizeOfInstructions",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentElements",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentDepth",2),p.Maxp=ut([nt("maxp")],p.Maxp);var Yr=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,Pi=(s,t,e)=>t in s?Yr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ie=(s,t,e,r)=>{for(var n=r>1?void 0:r?Si(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Yr(t,e,n),n},Ci=(s,t,e)=>(Pi(s,t+"",e),e);const Kr={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},or={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Mi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Zr={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};p.Name=class extends ct{constructor(){super(...arguments),Ci(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const r=this.stringOffset;for(let h=0;h<t;++h){const l=e[h];l.name=this.view.readBytes(r+l.offset,l.length)}let n=or.Macintosh,i=Mi.Default,o=0;e.some(h=>h.platform===or.Microsoft&&h.encoding===Zr.UCS2&&h.language===1033)&&(n=or.Microsoft,i=Zr.UCS2,o=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===i&&l.language===o&&Kr[l.nameId]&&(a[Kr[l.nameId]]=o===0?gs(l.name):ms(l.name))}return a}},Ie([y("uint16")],p.Name.prototype,"format",2),Ie([y("uint16")],p.Name.prototype,"count",2),Ie([y("uint16")],p.Name.prototype,"stringOffset",2),p.Name=Ie([nt("name")],p.Name);var Oi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,T=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ti(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Oi(t,e,n),n};p.Os2=class extends ct{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},T([y("uint16")],p.Os2.prototype,"version",2),T([y("int16")],p.Os2.prototype,"xAvgCharWidth",2),T([y("uint16")],p.Os2.prototype,"usWeightClass",2),T([y("uint16")],p.Os2.prototype,"usWidthClass",2),T([y("uint16")],p.Os2.prototype,"fsType",2),T([y("uint16")],p.Os2.prototype,"ySubscriptXSize",2),T([y("uint16")],p.Os2.prototype,"ySubscriptYSize",2),T([y("uint16")],p.Os2.prototype,"ySubscriptXOffset",2),T([y("uint16")],p.Os2.prototype,"ySubscriptYOffset",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptXSize",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptYSize",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptXOffset",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptYOffset",2),T([y("uint16")],p.Os2.prototype,"yStrikeoutSize",2),T([y("uint16")],p.Os2.prototype,"yStrikeoutPosition",2),T([y("uint16")],p.Os2.prototype,"sFamilyClass",2),T([y({type:"uint8"})],p.Os2.prototype,"bFamilyType",2),T([y({type:"uint8"})],p.Os2.prototype,"bSerifStyle",2),T([y({type:"uint8"})],p.Os2.prototype,"bWeight",2),T([y({type:"uint8"})],p.Os2.prototype,"bProportion",2),T([y({type:"uint8"})],p.Os2.prototype,"bContrast",2),T([y({type:"uint8"})],p.Os2.prototype,"bStrokeVariation",2),T([y({type:"uint8"})],p.Os2.prototype,"bArmStyle",2),T([y({type:"uint8"})],p.Os2.prototype,"bLetterform",2),T([y({type:"uint8"})],p.Os2.prototype,"bMidline",2),T([y({type:"uint8"})],p.Os2.prototype,"bXHeight",2),T([y({type:"uint8",size:16})],p.Os2.prototype,"ulUnicodeRange",2),T([y({type:"char",size:4})],p.Os2.prototype,"achVendID",2),T([y("uint16")],p.Os2.prototype,"fsSelection",2),T([y("uint16")],p.Os2.prototype,"usFirstCharIndex",2),T([y("uint16")],p.Os2.prototype,"usLastCharIndex",2),T([y("int16")],p.Os2.prototype,"sTypoAscender",2),T([y("int16")],p.Os2.prototype,"sTypoDescender",2),T([y("int16")],p.Os2.prototype,"sTypoLineGap",2),T([y("uint16")],p.Os2.prototype,"usWinAscent",2),T([y("uint16")],p.Os2.prototype,"usWinDescent",2),T([y({offset:72,type:"uint8",size:8})],p.Os2.prototype,"ulCodePageRange",2),T([y({offset:72,type:"int16"})],p.Os2.prototype,"sxHeight",2),T([y("int16")],p.Os2.prototype,"sCapHeight",2),T([y("uint16")],p.Os2.prototype,"usDefaultChar",2),T([y("uint16")],p.Os2.prototype,"usBreakChar",2),T([y("uint16")],p.Os2.prototype,"usMaxContext",2),p.Os2=T([nt("OS/2","os2")],p.Os2);var Ai=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,Ot=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ii(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ai(t,e,n),n};p.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},Ot([y("fixed")],p.Post.prototype,"format",2),Ot([y("fixed")],p.Post.prototype,"italicAngle",2),Ot([y("int16")],p.Post.prototype,"underlinePosition",2),Ot([y("int16")],p.Post.prototype,"underlineThickness",2),Ot([y("uint32")],p.Post.prototype,"isFixedPitch",2),Ot([y("uint32")],p.Post.prototype,"minMemType42",2),Ot([y("uint32")],p.Post.prototype,"maxMemType42",2),Ot([y("uint32")],p.Post.prototype,"minMemType1",2),Ot([y("uint32")],p.Post.prototype,"maxMemType1",2),p.Post=Ot([nt("post")],p.Post);var Ei=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,dt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ui(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ei(t,e,n),n};p.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([y("fixed")],p.Vhea.prototype,"version",2),dt([y("int16")],p.Vhea.prototype,"vertTypoAscender",2),dt([y("int16")],p.Vhea.prototype,"vertTypoDescender",2),dt([y("int16")],p.Vhea.prototype,"vertTypoLineGap",2),dt([y("int16")],p.Vhea.prototype,"advanceHeightMax",2),dt([y("int16")],p.Vhea.prototype,"minTopSideBearing",2),dt([y("int16")],p.Vhea.prototype,"minBottomSideBearing",2),dt([y("int16")],p.Vhea.prototype,"yMaxExtent",2),dt([y("int16")],p.Vhea.prototype,"caretSlopeRise",2),dt([y("int16")],p.Vhea.prototype,"caretSlopeRun",2),dt([y("int16")],p.Vhea.prototype,"caretOffset",2),dt([y({type:"int16",size:4})],p.Vhea.prototype,"reserved",2),dt([y("int16")],p.Vhea.prototype,"metricDataFormat",2),dt([y("int16")],p.Vhea.prototype,"numOfLongVerMetrics",2),p.Vhea=dt([nt("vhea")],p.Vhea);var Qr=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,Di=(s,t,e)=>t in s?Qr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Li=(s,t,e,r)=>{for(var n=r>1?void 0:r?$i(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Qr(t,e,n),n},Bi=(s,t,e)=>(Di(s,t+"",e),e);p.Vmtx=class extends ct{constructor(){super(...arguments),Bi(this,"_metrics")}static from(t){const e=t.length*4,r=new p.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var i;const t=this._sfnt.maxp.numGlyphs,e=((i=this._sfnt.vhea)==null?void 0:i.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((o,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},p.Vmtx=Li([nt("vmtx")],p.Vmtx);var Jr=Object.defineProperty,Fi=(s,t,e)=>t in s?Jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Jr(t,e,n),n},Ee=(s,t,e)=>(Fi(s,typeof t!="symbol"?t+"":t,e),e);class st extends _e{constructor(){super(...arguments),Ee(this,"format","TrueType"),Ee(this,"mimeType","font/ttf"),Ee(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checksum(t){const e=Gt(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let i=0,o=r/4;i<o;i+=4)i*4<r-4&&(n+=e.getUint32(i*4,!1));return n&4294967295}static from(t){const e=c=>c+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((c,d)=>c+e(d.byteLength),0),i=new this(new ArrayBuffer(12+r*16+n));i.scalerType=65536,i.numTables=r;const o=Math.log(2);i.searchRange=Math.floor(Math.log(r)/o)*16,i.entrySelector=Math.floor(i.searchRange/o),i.rangeShift=r*16-i.searchRange;let a=12+r*16,h=0;const l=i.getDirectories();t.tableViews.forEach((c,d)=>{const m=l[h++];m.tag=d,m.checkSum=this.checksum(c),m.offset=a,m.length=c.byteLength,i.view.writeBytes(c,a),a+=e(m.length)});const u=i.createSfnt().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(i.view),i}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Yt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ie(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Ee(st,"signature",new Set([65536,1953658213,1954115633])),fe([y("uint32")],st.prototype,"scalerType"),fe([y("uint16")],st.prototype,"numTables"),fe([y("uint16")],st.prototype,"searchRange"),fe([y("uint16")],st.prototype,"entrySelector"),fe([y("uint16")],st.prototype,"rangeShift");var Ni=Object.defineProperty,ki=(s,t,e)=>t in s?Ni(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ar=(s,t,e)=>(ki(s,typeof t!="symbol"?t+"":t,e),e);class Ue extends st{constructor(){super(...arguments),ar(this,"format","OpenType"),ar(this,"mimeType","font/otf")}static from(t){return super.from(t)}}ar(Ue,"signature",new Set([1330926671]));var Gi=Object.defineProperty,pe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Gi(t,e,n),n};class Vt extends wt{constructor(t,e){super(t,e,20)}}pe([y({type:"char",size:4})],Vt.prototype,"tag"),pe([y("uint32")],Vt.prototype,"offset"),pe([y("uint32")],Vt.prototype,"compLength"),pe([y("uint32")],Vt.prototype,"origLength"),pe([y("uint32")],Vt.prototype,"origChecksum");var tn=Object.defineProperty,Ri=(s,t,e)=>t in s?tn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,yt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&tn(t,e,n),n},$e=(s,t,e)=>(Ri(s,typeof t!="symbol"?t+"":t,e),e);const gt=class vr extends _e{constructor(){super(...arguments),$e(this,"format","WOFF"),$e(this,"mimeType","font/woff"),$e(this,"_sfnt")}get subfontFormat(){return st.is(this.flavor)?"TrueType":Ue.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checkSum(t){const e=Gt(t),r=e.byteLength,n=Math.floor(r/4);let i=0,o=0;for(;o<n;)i+=e.getUint32(4*o++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)i+=e.getUint8(h)<<a*8,h++,a--}return i%4294967296}static from(t,e=new ArrayBuffer(0)){const r=c=>c+3&-4,n=[];t.tableViews.forEach((c,d)=>{const m=Gt(ns(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:d,view:m.byteLength<c.byteLength?m:c,rawView:c})});const i=n.length,o=n.reduce((c,d)=>c+r(d.view.byteLength),0),a=new vr(new ArrayBuffer(44+20*i+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=i,a.totalSfntSize=12+16*i+n.reduce((c,d)=>c+r(d.rawView.byteLength),0);let h=44+i*20,l=0;const u=a.getDirectories();return n.forEach(c=>{const d=u[l++];d.tag=c.tag,d.offset=h,d.compLength=c.view.byteLength,d.origChecksum=vr.checkSum(c.rawView),d.origLength=c.rawView.byteLength,a.view.writeBytes(c.view,h),h+=r(d.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Vt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ie(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,i=e.compLength,o=e.origLength,a=n+i;return t[r]=i>=o?new DataView(this.view.buffer,n,i):new DataView(ss(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};$e(gt,"signature",new Set([2001684038])),yt([y("uint32")],gt.prototype,"signature"),yt([y("uint32")],gt.prototype,"flavor"),yt([y("uint32")],gt.prototype,"length"),yt([y("uint16")],gt.prototype,"numTables"),yt([y("uint16")],gt.prototype,"reserved"),yt([y("uint32")],gt.prototype,"totalSfntSize"),yt([y("uint16")],gt.prototype,"majorVersion"),yt([y("uint16")],gt.prototype,"minorVersion"),yt([y("uint32")],gt.prototype,"metaOffset"),yt([y("uint32")],gt.prototype,"metaLength"),yt([y("uint32")],gt.prototype,"metaOrigLength"),yt([y("uint32")],gt.prototype,"privOffset"),yt([y("uint32")],gt.prototype,"privLength");let Lt=gt;function en(s){if(st.is(s))return new st(s);if(Ue.is(s))return new Ue(s);if(Lt.is(s))return new Lt(s)}var zi=Object.defineProperty,qi=(s,t,e)=>t in s?zi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,de=(s,t,e)=>(qi(s,typeof t!="symbol"?t+"":t,e),e);const rn=class qn{constructor(){de(this,"fallbackFont"),de(this,"_loading",new Map),de(this,"_loaded",new Map),de(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...qn.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
|
|
2
2
|
font-family: "${t}";
|
|
3
3
|
src: url(${e});
|
|
4
|
-
}`)),document.head.appendChild(n),this}parse(t){if(_t.is(t))return new _t(t);if(Pt.is(t))return new Pt(t)}get(t){let e;if(t){const n=this._namesUrls.get(t)??t;e=this._loaded.get(n)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:s=!0,...o}=e,{family:a,url:c}=t;if(this._loaded.has(c))return n&&(this._loading.forEach(l=>l.cancel()),this._loading.clear()),this._loaded.get(c);let h=this._loading.get(c);return h||(h=this._createRequest(c,o),this._loading.set(c,h)),n&&this._loading.forEach((l,u)=>{l!==h&&(l.cancel(),this._loading.delete(u))}),h.when.then(l=>{const u={...t,font:this.parse(l)??l};return this._loaded.has(c)||(this._loaded.set(c,u),new Set(Array.isArray(a)?a:[a]).forEach(p=>{this._namesUrls.set(p,c),typeof document<"u"&&(r&&this.injectFontFace(p,l),s&&this.injectStyleTag(p,c))})),u}).catch(l=>{if(l instanceof DOMException&&l.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw l}).finally(()=>{this._loading.delete(c)})}};re(In,"defaultRequestInit",{cache:"force-cache"});let Dn=In;const En=new Dn;function Un(i,t){const{cmap:e,loca:n,hmtx:r,vmtx:s,glyf:o}=i,a=e.unicodeGlyphIndexMap,c=n.locations,h=r.metrics,l=s==null?void 0:s.metrics,u=Array.from(new Set(t.split("").map(m=>m.codePointAt(0)).filter(m=>m!==void 0&&a.has(m)))).sort((m,w)=>m-w),p=new Map;u.forEach(m=>{const w=a.get(m)??0;let x=p.get(w);x||p.set(w,x=new Set),x.add(m)});const y=[],g=m=>{const w=h[m],x=(l==null?void 0:l[m])??{advanceHeight:0,topSideBearing:0},_=c[m],v=c[m+1]??_,T={...w,...x,rawGlyphIndex:m,glyphIndex:y.length,unicodes:Array.from(p.get(m)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,v-_)};return y.push(T),T};return g(0),u.forEach(m=>g(a.get(m))),y.slice().forEach(m=>{const{view:w}=m;if(!w.byteLength||w.getInt16(0)>=0)return;let _=10,v;do{v=w.getUint16(_);const T=_+2,C=w.getUint16(T);_+=4,Gt.ARG_1_AND_2_ARE_WORDS&v?_+=4:_+=2,Gt.WE_HAVE_A_SCALE&v?_+=2:Gt.WE_HAVE_AN_X_AND_Y_SCALE&v?_+=4:Gt.WE_HAVE_A_TWO_BY_TWO&v&&(_+=8);const O=g(C);w.setUint16(T,O.glyphIndex)}while(Gt.MORE_COMPONENTS&v)}),y}function Ln(i,t){const e=Un(i,t),n=e.length,{head:r,maxp:s,hhea:o,vhea:a}=i;r.checkSumAdjustment=0,r.magickNumber=1594834165,r.indexToLocFormat=1,s.numGlyphs=n;let c=0;i.loca=f.Loca.from([...e.map(p=>{const y=c;return c+=p.view.byteLength,y}),c],r.indexToLocFormat);const h=e.reduce((p,y,g)=>(y.unicodes.forEach(m=>p.set(m,g)),p),new Map);i.cmap=f.Cmap.from(h),i.glyf=f.Glyf.from(e.map(p=>p.view)),o.numOfLongHorMetrics=n,i.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=n),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=n,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function ss(i,t){let e,n;if(i instanceof _t)e=i.sfnt.clone(),n="ttf";else if(i instanceof Pt)e=i.sfnt.clone(),n="woff";else{const s=At(i);if(_t.is(s))e=new _t(s).sfnt,n="ttf-buffer";else if(Pt.is(s))e=new Pt(s).sfnt,n="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const r=Ln(e,t);switch(n){case"ttf":return _t.from(r);case"woff":return Pt.from(r);case"ttf-buffer":return _t.from(r).view.buffer;case"woff-buffer":default:return Pt.from(r).view.buffer}}const os={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function as(i,t){const{fill:e="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:s="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:c,strokeDashoffset:h=0,shadowOffsetX:l=0,shadowOffsetY:u=0,shadowBlur:p=0,shadowColor:y="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=n,i.lineWidth=r,i.lineCap=s,i.lineJoin=os[o],i.miterLimit=a,c&&i.setLineDash(c),i.lineDashOffset=h,i.shadowOffsetX=l,i.shadowOffsetY=u,i.shadowBlur=p,i.shadowColor=y}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new b(this.x,this.y)}}class E{constructor(t=0,e=0,n=0,r=0){this.left=t,this.top=e,this.width=n,this.height=r}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){const e=t[0],n=t.slice(1).reduce((r,s)=>(r.left=Math.min(r.left,s.left),r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new E(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new E(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var hs=Object.defineProperty,cs=(i,t,e)=>t in i?hs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ls=(i,t,e)=>(cs(i,t+"",e),e);class ct{constructor(t=1,e=0,n=0,r=0,s=1,o=0,a=0,c=0,h=1){ls(this,"elements",[]),this.set(t,e,n,r,s,o,a,c,h)}set(t,e,n,r,s,o,a,c,h){const l=this.elements;return l[0]=t,l[1]=r,l[2]=a,l[3]=e,l[4]=s,l[5]=c,l[6]=n,l[7]=o,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,o=n[0],a=n[3],c=n[6],h=n[1],l=n[4],u=n[7],p=n[2],y=n[5],g=n[8],m=r[0],w=r[3],x=r[6],_=r[1],v=r[4],T=r[7],C=r[2],O=r[5],A=r[8];return s[0]=o*m+a*_+c*C,s[3]=o*w+a*v+c*O,s[6]=o*x+a*T+c*A,s[1]=h*m+l*_+u*C,s[4]=h*w+l*v+u*O,s[7]=h*x+l*T+u*A,s[2]=p*m+y*_+g*C,s[5]=p*w+y*v+g*O,s[8]=p*x+y*T+g*A,this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],c=t[6],h=t[7],l=t[8],u=l*o-a*h,p=a*c-l*s,y=h*s-o*c,g=e*u+n*p+r*y;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return t[0]=u*m,t[1]=(r*h-l*n)*m,t[2]=(a*n-r*o)*m,t[3]=p*m,t[4]=(l*e-r*c)*m,t[5]=(r*s-a*e)*m,t[6]=y*m,t[7]=(n*c-h*e)*m,t[8]=(o*e-n*s)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(We.makeScale(t,e)),this}rotate(t){return this.premultiply(We.makeRotation(-t)),this}translate(t,e){return this.premultiply(We.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const We=new ct;function Bn(i,t,e,n){const r=i*e+t*n,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+n*n);let o=Math.acos(Math.max(-1,Math.min(1,r/s)));return i*n-t*e<0&&(o=-o),o}function us(i,t,e,n,r,s,o,a){if(t===0||e===0){i.lineTo(a.x,a.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const c=(o.x-a.x)/2,h=(o.y-a.y)/2,l=Math.cos(n)*c+Math.sin(n)*h,u=-Math.sin(n)*c+Math.cos(n)*h;let p=t*t,y=e*e;const g=l*l,m=u*u,w=g/p+m/y;if(w>1){const U=Math.sqrt(w);t=U*t,e=U*e,p=t*t,y=e*e}const x=p*m+y*g,_=(p*y-x)/x;let v=Math.sqrt(Math.max(0,_));r===s&&(v=-v);const T=v*t*u/e,C=-v*e*l/t,O=Math.cos(n)*T-Math.sin(n)*C+(o.x+a.x)/2,A=Math.sin(n)*T+Math.cos(n)*C+(o.y+a.y)/2,P=Bn(1,0,(l-T)/t,(u-C)/e),S=Bn((l-T)/t,(u-C)/e,(-l-T)/t,(-u-C)/e)%(Math.PI*2);i.ellipse(O,A,t,e,n,P,P+S,s===1)}function Rt(i,t){return i-(t-i)}function Fn(i,t){const e=new b,n=new b;for(let r=0,s=i.length;r<s;r++){const o=i[r];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),n.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),n.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),n.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),n.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),n.x=e.x+o.x1,n.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),n.x=o.x1,n.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=Rt(e.x,n.x),c=Rt(e.y,n.y);n.x=a,n.y=c,o.type==="t"?(t.quadraticCurveTo(a,c,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,c,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}n.copy(e),us(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const F={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function wt(i,t,e=0){let a=0,c=!0,h="",l="";const u=[];function p(w,x,_){const v=new SyntaxError(`Unexpected character "${w}" at index ${x}.`);throw v.partial=_,v}function y(){h!==""&&(l===""?u.push(Number(h)):u.push(Number(h)*10**Number(l))),h="",l=""}let g;const m=i.length;for(let w=0;w<m;w++){if(g=i[w],Array.isArray(t)&&t.includes(u.length%e)&&F.FLAGS.test(g)){a=1,h=g,y();continue}if(a===0){if(F.WHITESPACE.test(g))continue;if(F.DIGIT.test(g)||F.SIGN.test(g)){a=1,h=g;continue}if(F.POINT.test(g)){a=2,h=g;continue}F.COMMA.test(g)&&(c&&p(g,w,u),c=!0)}if(a===1){if(F.DIGIT.test(g)){h+=g;continue}if(F.POINT.test(g)){h+=g,a=2;continue}if(F.EXP.test(g)){a=3;continue}F.SIGN.test(g)&&h.length===1&&F.SIGN.test(h[0])&&p(g,w,u)}if(a===2){if(F.DIGIT.test(g)){h+=g;continue}if(F.EXP.test(g)){a=3;continue}F.POINT.test(g)&&h[h.length-1]==="."&&p(g,w,u)}if(a===3){if(F.DIGIT.test(g)){l+=g;continue}if(F.SIGN.test(g)){if(l===""){l+=g;continue}l.length===1&&F.SIGN.test(l)&&p(g,w,u)}}F.WHITESPACE.test(g)?(y(),a=0,c=!1):F.COMMA.test(g)?(y(),a=0,c=!0):F.SIGN.test(g)?(y(),a=1,h=g):F.POINT.test(g)?(y(),a=2,h=g):p(g,w,u)}return y(),u}function fs(i){switch(i.type){case"m":case"M":return`${i.type} ${i.x} ${i.y}`;case"h":case"H":return`${i.type} ${i.x}`;case"v":case"V":return`${i.type} ${i.y}`;case"l":case"L":return`${i.type} ${i.x} ${i.y}`;case"c":case"C":return`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"s":case"S":return`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"q":case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":case"T":return`${i.type} ${i.x} ${i.y}`;case"a":case"A":return`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`;case"z":case"Z":return i.type;default:return""}}function ps(i){let t="";for(let e=0,n=i.length;e<n;e++)t+=`${fs(i[e])} `;return t}const ds=/[a-df-z][^a-df-z]*/gi;function Nn(i){const t=[],e=i.match(ds);if(!e)return t;for(let n=0,r=e.length;n<r;n++){const s=e[n],o=s.charAt(0),a=s.slice(1).trim();let c;switch(o){case"m":case"M":c=wt(a);for(let h=0,l=c.length;h<l;h+=2)h===0?t.push({type:o,x:c[h],y:c[h+1]}):t.push({type:o==="m"?"l":"L",x:c[h],y:c[h+1]});break;case"h":case"H":c=wt(a);for(let h=0,l=c.length;h<l;h++)t.push({type:o,x:c[h]});break;case"v":case"V":c=wt(a);for(let h=0,l=c.length;h<l;h++)t.push({type:o,y:c[h]});break;case"l":case"L":c=wt(a);for(let h=0,l=c.length;h<l;h+=2)t.push({type:o,x:c[h],y:c[h+1]});break;case"c":case"C":c=wt(a);for(let h=0,l=c.length;h<l;h+=6)t.push({type:o,x1:c[h],y1:c[h+1],x2:c[h+2],y2:c[h+3],x:c[h+4],y:c[h+5]});break;case"s":case"S":c=wt(a);for(let h=0,l=c.length;h<l;h+=4)t.push({type:o,x2:c[h],y2:c[h+1],x:c[h+2],y:c[h+3]});break;case"q":case"Q":c=wt(a);for(let h=0,l=c.length;h<l;h+=4)t.push({type:o,x1:c[h],y1:c[h+1],x:c[h+2],y:c[h+3]});break;case"t":case"T":c=wt(a);for(let h=0,l=c.length;h<l;h+=2)t.push({type:o,x:c[h],y:c[h+1]});break;case"a":case"A":c=wt(a,[3,4],7);for(let h=0,l=c.length;h<l;h+=7)t.push({type:o,rx:c[h],ry:c[h+1],angle:c[h+2],largeArcFlag:c[h+3],sweepFlag:c[h+4],x:c[h+5],y:c[h+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(s)}}return t}var gs=Object.defineProperty,ys=(i,t,e)=>t in i?gs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xe=(i,t,e)=>(ys(i,typeof t!="symbol"?t+"":t,e),e);class Lt{constructor(){Xe(this,"arcLengthDivisions",200),Xe(this,"_cacheArcLengths"),Xe(this,"_needsUpdate",!1)}getPointAt(t,e=new b){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let n,r=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),s+=n.distanceTo(r),e.push(s),r=n;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const s=n.length;let o;e?o=e:o=t*n[s-1];let a=0,c=s-1,h;for(;a<=c;)if(r=Math.floor(a+(c-a)/2),h=n[r]-o,h<0)a=r+1;else if(h>0)c=r-1;else{c=r;break}if(r=c,n[r]===o)return r/(s-1);const l=n[r],p=n[r+1]-l,y=(o-l)/p;return(r+y)/(s-1)}getTangent(t,e=new b){const r=Math.max(0,t-1e-4),s=Math.min(1,t+1e-4);return e.copy(this.getPoint(s).sub(this.getPoint(r)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUtoTmapping(t),e)}transformPoint(t){return this}transform(t){return this.transformPoint(e=>e.applyMatrix3(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(n=>{t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x),e.y=Math.max(e.y,n.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}getData(){return ps(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Gn(i,t,e,n,r){const s=(n-t)*.5,o=(r-e)*.5,a=i*i,c=i*a;return(2*e-2*n+s+o)*c+(-3*e+3*n-2*s-o)*a+s*i+e}function ms(i,t){const e=1-i;return e*e*t}function ws(i,t){return 2*(1-i)*i*t}function vs(i,t){return i*i*t}function Rn(i,t,e,n){return ms(i,t)+ws(i,e)+vs(i,n)}function bs(i,t){const e=1-i;return e*e*e*t}function xs(i,t){const e=1-i;return 3*e*e*i*t}function _s(i,t){return 3*(1-i)*i*i*t}function Ps(i,t){return i*i*i*t}function Vn(i,t,e,n,r){return bs(i,t)+xs(i,e)+_s(i,n)+Ps(i,r)}class Ss extends Lt{constructor(t=new b,e=new b,n=new b,r=new b){super(),this.start=t,this.startControl=e,this.endControl=n,this.end=r}getPoint(t,e=new b){const{start:n,startControl:r,endControl:s,end:o}=this;return e.set(Vn(t,n.x,r.x,s.x,o.x),Vn(t,n.y,r.y,s.y,o.y)),e}transformPoint(t){return t(this.start),t(this.startControl),t(this.endControl),t(this.end),this}_solveQuadratic(t,e,n){const r=e*e-4*t*n;if(r<0)return[];const s=Math.sqrt(r),o=(-e+s)/(2*t),a=(-e-s)/(2*t);return[o,a].filter(c=>c>=0&&c<=1)}getMinMax(t=b.MAX,e=b.MIN){const n=this.start,r=this.startControl,s=this.endControl,o=this.end,a=this._solveQuadratic(3*(r.x-n.x),6*(s.x-r.x),3*(o.x-s.x)),c=this._solveQuadratic(3*(r.y-n.y),6*(s.y-r.y),3*(o.y-s.y)),h=[0,1,...a,...c];return((u,p)=>{for(const y of u)for(let g=0;g<=p;g++){const m=g/p-.5,w=Math.min(1,Math.max(0,y+m)),x=this.getPoint(w);t.x=Math.min(t.x,x.x),t.y=Math.min(t.y,x.y),e.x=Math.max(e.x,x.x),e.y=Math.max(e.y,x.y)}})(h,10),{min:t,max:e}}getCommands(){const{start:t,startControl:e,endControl:n,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(t){const{startControl:e,endControl:n,end:r}=this;return t.bezierCurveTo(e.x,e.y,n.x,n.y,r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Ms=new ct,kn=new ct,Hn=new ct,we=new b;class Cs extends Lt{constructor(t=new b,e=1,n=1,r=0,s=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=n,this.rotation=r,this.startAngle=s,this.endAngle=o,this.clockwise=a}getPoint(t,e=new b){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.clockwise&&!s&&(r===n?r=-n:r=r-n);const o=this.startAngle+t*r;let a=this.center.x+this.radiusX*Math.cos(o),c=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const h=Math.cos(this.rotation),l=Math.sin(this.rotation),u=a-this.center.x,p=c-this.center.y;a=u*h-p*l+this.center.x,c=u*l+p*h+this.center.y}return e.set(a,c)}getCommands(){const{center:t,radiusX:e,radiusY:n,startAngle:r,endAngle:s,clockwise:o,rotation:a}=this,{x:c,y:h}=t,l=c+e*Math.cos(r)*Math.cos(a)-n*Math.sin(r)*Math.sin(a),u=h+e*Math.cos(r)*Math.sin(a)+n*Math.sin(r)*Math.cos(a),p=Math.abs(r-s),y=p>Math.PI?1:0,g=o?1:0,m=a*180/Math.PI;if(p>=2*Math.PI){const w=r+Math.PI,x=c+e*Math.cos(w)*Math.cos(a)-n*Math.sin(w)*Math.sin(a),_=h+e*Math.cos(w)*Math.sin(a)+n*Math.sin(w)*Math.cos(a);return[{type:"M",x:l,y:u},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:0,sweepFlag:g,x,y:_},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:0,sweepFlag:g,x:l,y:u}]}else{const w=c+e*Math.cos(s)*Math.cos(a)-n*Math.sin(s)*Math.sin(a),x=h+e*Math.cos(s)*Math.sin(a)+n*Math.sin(s)*Math.cos(a);return[{type:"M",x:l,y:u},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:y,sweepFlag:g,x:w,y:x}]}}drawTo(t){const{center:e,radiusX:n,radiusY:r,rotation:s,startAngle:o,endAngle:a,clockwise:c}=this;return t.ellipse(e.x,e.y,n,r,s,o,a,!c),this}transform(t){return we.set(this.center.x,this.center.y),we.applyMatrix3(t),this.center.x=we.x,this.center.y=we.y,As(t)?Ts(this,t):Os(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=b.MAX,e=b.MIN){const{center:n,radiusX:r,radiusY:s,rotation:o}=this,{x:a,y:c}=n,h=Math.cos(o),l=Math.sin(o),u=Math.sqrt(r*r*h*h+s*s*l*l),p=Math.sqrt(r*r*l*l+s*s*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,c-p),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,c+p),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Ts(i,t){const e=i.radiusX,n=i.radiusY,r=Math.cos(i.rotation),s=Math.sin(i.rotation),o=new b(e*r,e*s),a=new b(-n*s,n*r),c=o.applyMatrix3(t),h=a.applyMatrix3(t),l=Ms.set(c.x,h.x,0,c.y,h.y,0,0,0,1),u=kn.copy(l).invert(),g=Hn.copy(u).transpose().multiply(u).elements,m=$s(g[0],g[1],g[4]),w=Math.sqrt(m.rt1),x=Math.sqrt(m.rt2);if(i.radiusX=1/w,i.radiusY=1/x,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const v=kn.set(w,0,0,0,x,0,0,0,1),T=Hn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),C=v.multiply(T).multiply(l),O=A=>{const{x:P,y:S}=new b(Math.cos(A),Math.sin(A)).applyMatrix3(C);return Math.atan2(S,P)};i.startAngle=O(i.startAngle),i.endAngle=O(i.endAngle),zn(t)&&(i.clockwise=!i.clockwise)}}function Os(i,t){const e=Wn(t),n=Xn(t);i.radiusX*=e,i.radiusY*=n;const r=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=r,zn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function zn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function As(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=Wn(i),r=Xn(i);return Math.abs(e/(n*r))>Number.EPSILON}function Wn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Xn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function $s(i,t,e){let n,r,s,o,a;const c=i+e,h=i-e,l=Math.sqrt(h*h+4*t*t);return c>0?(n=.5*(c+l),a=1/n,r=i*a*e-t*a*t):c<0?r=.5*(c-l):(n=.5*l,r=-.5*l),h>0?s=h+l:s=h-l,Math.abs(s)>2*Math.abs(t)?(a=-2*t/s,o=1/Math.sqrt(1+a*a),s=a*o):Math.abs(t)===0?(s=1,o=0):(a=-.5*s/t,s=1/Math.sqrt(1+a*a),o=a*s),h>0&&(a=s,s=-o,o=a),{rt1:n,rt2:r,cs:s,sn:o}}class qe extends Lt{constructor(t=new b,e=new b){super(),this.start=t,this.end=e}getPoint(t,e=new b){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new b){return this.getPoint(t,e)}getTangent(t,e=new b){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new b){return this.getTangent(t,e)}getNormal(t,e=new b){const{x:n,y:r}=this.getPoint(t).sub(this.start);return e.set(r,-n).normalize()}transformPoint(t){return t(this.start),t(this.end),this}getMinMax(t=b.MAX,e=b.MIN){const{start:n,end:r}=this;return t.x=Math.min(t.x,n.x,r.x),t.y=Math.min(t.y,n.y,r.y),e.x=Math.max(e.x,n.x,r.x),e.y=Math.max(e.y,n.y,r.y),{min:t,max:e}}getCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{end:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class Is extends Lt{constructor(t=new b,e=new b,n=new b){super(),this.start=t,this.control=e,this.end=n}getPoint(t,e=new b){const{start:n,control:r,end:s}=this;return e.set(Rn(t,n.x,r.x,s.x),Rn(t,n.y,r.y,s.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=b.MAX,e=b.MIN){const{start:n,control:r,end:s}=this,o=.5*(n.x+r.x),a=.5*(n.y+r.y),c=.5*(n.x+s.x),h=.5*(n.y+s.y);return t.x=Math.min(t.x,n.x,s.x,o,c),t.y=Math.min(t.y,n.y,s.y,a,h),e.x=Math.max(e.x,n.x,s.x,o,c),e.y=Math.max(e.y,n.y,s.y,a,h),{min:t,max:e}}getCommands(){const{start:t,control:e,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:n.x,y:n.y}]}drawTo(t){const{control:e,end:n}=this;return t.quadraticCurveTo(e.x,e.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var Ds=Object.defineProperty,Es=(i,t,e)=>t in i?Ds(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,qn=(i,t,e)=>(Es(i,typeof t!="symbol"?t+"":t,e),e);class Us extends Lt{constructor(t,e,n=1,r=0,s=1){super(),this.center=t,this.rx=e,this.aspectRatio=n,this.start=r,this.end=s,qn(this,"curves",[]),qn(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,n=this.rx,r=this.rx/this.aspectRatio,s=[new b(t-n,e-r),new b(t+n,e-r),new b(t+n,e+r),new b(t-n,e+r)];for(let o=0;o<4;o++)this.curves.push(new qe(s[o].clone(),s[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let n;return e<this.aspectRatio?(n=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(n=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(n=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[n]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Ls extends Lt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new b){const{points:n}=this,r=(n.length-1)*t,s=Math.floor(r),o=r-s,a=n[s===0?s:s-1],c=n[s],h=n[s>n.length-2?n.length-1:s+1],l=n[s>n.length-3?n.length-1:s+2];return e.set(Gn(o,a.x,c.x,h.x,l.x),Gn(o,a.y,c.y,h.y,l.y)),e}transformPoint(t){return this.points.forEach(e=>t(e)),this}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this}}var Bs=Object.defineProperty,Fs=(i,t,e)=>t in i?Bs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ie=(i,t,e)=>(Fs(i,typeof t!="symbol"?t+"":t,e),e);class se extends Lt{constructor(t){super(),ie(this,"curves",[]),ie(this,"startPoint"),ie(this,"currentPoint",new b),ie(this,"autoClose",!1),ie(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++){const{x:r,y:s}=t[e];this.lineTo(r,s)}return this}addCommands(t){return Fn(t,this),this}addData(t){return this.addCommands(Nn(t)),this}getPoint(t,e=new b){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,a=this.curves[s],c=a.getLength();return a.getPointAt(c===0?0:1-o/c,e)}s++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],n=this.curves;let r;for(let s=0,o=n.length;s<o;s++){const c=n[s].getPoints(t);for(let h=0;h<c.length;h++){const l=c[h];r!=null&&r.equals(l)||(e.push(l),r=l)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new qe(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new qe(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,n,r,s,o){return this.currentPoint.equals({x:s,y:o})||this.curves.push(new Ss(this.currentPoint.clone(),new b(t,e),new b(n,r),new b(s,o))),this._setCurrentPoint({x:s,y:o}),this}quadraticCurveTo(t,e,n,r){return this.currentPoint.equals({x:n,y:r})||this.curves.push(new Is(this.currentPoint.clone(),new b(t,e),new b(n,r))),this._setCurrentPoint({x:n,y:r}),this}arc(t,e,n,r,s,o){return this.ellipse(t,e,n,n,0,r,s,o),this}relativeArc(t,e,n,r,s,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,n,r,s,o),this}arcTo(t,e,n,r,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,r,s,o,a,c=!0){const h=new Cs(new b(t,e),n,r,s,o,a,!c);if(this.curves.length>0){const l=h.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}return this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,e,n,r,s,o,a,c){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,n,r,s,o,a,c),this}rect(t,e,n,r){return this.curves.push(new Us(new b(t+n/2,e+r/2),n/2,n/r)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Ls([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){var n;const e=(n=this.curves[0])==null?void 0:n.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Ns(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var Gs=Object.defineProperty,Rs=(i,t,e)=>t in i?Gs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,je=(i,t,e)=>(Rs(i,typeof t!="symbol"?t+"":t,e),e);class lt{constructor(t){je(this,"currentPath",new se),je(this,"paths",[this.currentPath]),je(this,"style",{}),t&&(t instanceof lt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof lt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new se().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:n,curves:r}=this.currentPath;return n.equals({x:t,y:e})||(r.length?(this.currentPath=new se().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,n,r,s,o){return this.currentPath.bezierCurveTo(t,e,n,r,s,o),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}arc(t,e,n,r,s,o){return this.currentPath.arc(t,e,n,r,s,o),this}arcTo(t,e,n,r,s){return this.currentPath.arcTo(t,e,n,r,s),this}ellipse(t,e,n,r,s,o,a,c){return this.currentPath.ellipse(t,e,n,r,s,o,a,c),this}rect(t,e,n,r){return this.currentPath.rect(t,e,n,r),this}addCommands(t){return Fn(t,this),this}addData(t){return this.addCommands(Nn(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(n=>t(n))),this}transformPoint(t){return this.forEachCurve(e=>e.transformPoint(t)),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=b.MAX,e=b.MIN,n=!0){if(this.forEachCurve(r=>r.getMinMax(t,e)),n){const r=this.strokeWidth/2;t.x-=r,t.y-=r,e.x+=r,e.y+=r}return{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:n}=this.getMinMax(void 0,void 0,t);return new E(e.x,e.y,n.x-e.x,n.y-e.y)}getCommands(){return this.paths.flatMap(t=>t.getCommands())}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgPathXml(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const r in t)t[r]!==void 0&&(e[Ns(r)]=t[r]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let n="";for(const r in e)e[r]!==void 0&&(n+=`${r}:${e[r]};`);return`<path d="${this.getData()}" style="${n}"></path>`}getSvgXml(){const{x:t,y:e,width:n,height:r}=this.getBoundingBox(),s=this.getSvgPathXml();return`<svg viewBox="${t} ${e} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${s}</svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgXml())}`}drawTo(t,e=!0){const{fill:n="#000",stroke:r="none"}=this.style;e&&as(t,this.style),this.paths.forEach(s=>{s.drawTo(t)}),n!=="none"&&t.fill(),r!=="none"&&t.stroke()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}toSvg(){return new DOMParser().parseFromString(this.getSvgXml(),"image/svg+xml").documentElement}toCanvas(t=2){const{left:e,top:n,width:r,height:s}=this.getBoundingBox(),o=document.createElement("canvas");o.width=r*t,o.height=s*t,o.style.width=`${r}px`,o.style.height=`${s}px`;const a=o.getContext("2d");return a&&(a.scale(t,t),a.translate(-e,-n),this.drawTo(a)),o}clone(){return new this.constructor().copy(this)}}const Ye="px",jn=90,Yn=["mm","cm","in","pt","pc","px"],Ke={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function $(i){let t="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=Yn.length;n<r;n++){const s=Yn[n];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&Ye!=="px"?e=Ke.in[Ye]/jn:(e=Ke[t][Ye],e<0&&(e=Ke[t].in*jn)),e*Number.parseFloat(i)}const Vs=new ct,ve=new ct,Kn=new ct,Qn=new ct;function ks(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Hs(i);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function Hs(i){const t=new ct,e=Vs;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate($(i.getAttribute("x")),$(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const s=n[r].trim();if(s==="")continue;const o=s.indexOf("("),a=s.length;if(o>0&&o<a){const c=s.slice(0,o),h=wt(s.slice(o+1));switch(e.identity(),c){case"translate":if(h.length>=1){const l=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(l,u)}break;case"rotate":if(h.length>=1){let l=0,u=0,p=0;l=h[0]*Math.PI/180,h.length>=3&&(u=h[1],p=h[2]),ve.makeTranslation(-u,-p),Kn.makeRotation(l),Qn.multiplyMatrices(Kn,ve),ve.makeTranslation(u,p),e.multiplyMatrices(ve,Qn)}break;case"scale":h.length>=1&&e.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&e.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&e.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&e.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}t.premultiply(e)}}return t}function zs(i){return new lt().addPath(new se().arc($(i.getAttribute("cx")||0),$(i.getAttribute("cy")||0),$(i.getAttribute("r")||0),0,Math.PI*2))}function Ws(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const n=i.sheet.cssRules[e];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim());for(let s=0;s<r.length;s++){const o=Object.fromEntries(Object.entries(n.style).filter(([,a])=>a!==""));t[r[s]]=Object.assign(t[r[s]]||{},o)}}}function Xs(i){return new lt().addPath(new se().ellipse($(i.getAttribute("cx")||0),$(i.getAttribute("cy")||0),$(i.getAttribute("rx")||0),$(i.getAttribute("ry")||0),0,0,Math.PI*2))}function qs(i){return new lt().moveTo($(i.getAttribute("x1")||0),$(i.getAttribute("y1")||0)).lineTo($(i.getAttribute("x2")||0),$(i.getAttribute("y2")||0))}function js(i){const t=new lt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Ys=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ks(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Ys,(r,s,o)=>{const a=$(s),c=$(o);return e===0?t.moveTo(a,c):t.lineTo(a,c),e++,r}),t.currentPath.autoClose=!0,t}const Qs=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Zs(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Qs,(r,s,o)=>{const a=$(s),c=$(o);return e===0?t.moveTo(a,c):t.lineTo(a,c),e++,r}),t.currentPath.autoClose=!1,t}function Js(i){const t=$(i.getAttribute("x")||0),e=$(i.getAttribute("y")||0),n=$(i.getAttribute("rx")||i.getAttribute("ry")||0),r=$(i.getAttribute("ry")||i.getAttribute("rx")||0),s=$(i.getAttribute("width")),o=$(i.getAttribute("height")),a=1-.551915024494,c=new lt;return c.moveTo(t+n,e),c.lineTo(t+s-n,e),(n!==0||r!==0)&&c.bezierCurveTo(t+s-n*a,e,t+s,e+r*a,t+s,e+r),c.lineTo(t+s,e+o-r),(n!==0||r!==0)&&c.bezierCurveTo(t+s,e+o-r*a,t+s-n*a,e+o,t+s-n,e+o),c.lineTo(t+n,e+o),(n!==0||r!==0)&&c.bezierCurveTo(t+n*a,e+o,t,e+o-r*a,t,e+o-r),c.lineTo(t,e+r),(n!==0||r!==0)&&c.bezierCurveTo(t,e+r*a,t+n*a,e,t+n,e),c}function vt(i,t,e){t=Object.assign({},t);let n={};if(i.hasAttribute("class")){const c=i.getAttribute("class").split(/\s/).filter(Boolean).map(h=>h.trim());for(let h=0;h<c.length;h++)n=Object.assign(n,e[`.${c[h]}`])}i.hasAttribute("id")&&(n=Object.assign(n,e[`#${i.getAttribute("id")}`]));function r(c,h,l){l===void 0&&(l=function(p){return p.startsWith("url")&&console.warn("url access in attributes is not implemented."),p}),i.hasAttribute(c)&&(t[h]=l(i.getAttribute(c))),n[c]&&(t[h]=l(n[c])),i.style&&i.style[c]!==""&&(t[h]=l(i.style[c]))}function s(c){return Math.max(0,Math.min(1,$(c)))}function o(c){return Math.max(0,$(c))}function a(c){return c.split(" ").filter(h=>h!=="").map(h=>$(h))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",o),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",o),r("stroke-dasharray","strokeDasharray",a),r("stroke-dashoffset","strokeDashoffset",$),r("visibility","visibility"),t}function Qe(i,t,e=[]){var l;if(i.nodeType!==1)return e;let n=!1,r=null;const s={};switch(i.nodeName){case"svg":t=vt(i,t,s);break;case"style":Ws(i,s);break;case"g":t=vt(i,t,s);break;case"path":t=vt(i,t,s),i.hasAttribute("d")&&(r=js(i));break;case"rect":t=vt(i,t,s),r=Js(i);break;case"polygon":t=vt(i,t,s),r=Ks(i);break;case"polyline":t=vt(i,t,s),r=Zs(i);break;case"circle":t=vt(i,t,s),r=zs(i);break;case"ellipse":t=vt(i,t,s),r=Xs(i);break;case"line":t=vt(i,t,s),r=qs(i);break;case"defs":n=!0;break;case"use":{t=vt(i,t,s);const p=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),y=(l=i.viewportElement)==null?void 0:l.getElementById(p);y?Qe(y,t,e):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(i);break}const o=new ct,a=[],c=ks(i,o,a);r&&(r.transform(o),e.push(r),r.style=t);const h=i.childNodes;for(let u=0,p=h.length;u<p;u++){const y=h[u];n&&y.nodeName!=="style"&&y.nodeName!=="defs"||Qe(y,t,e)}return c&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Zn="data:image/svg+xml;",Jn=`${Zn}base64,`,tr=`${Zn}charset=utf8,`;function er(i){if(typeof i=="string"){let t;return i.startsWith(Jn)?(i=i.substring(Jn.length,i.length),t=atob(i)):i.startsWith(tr)?(i=i.substring(tr.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function to(i){return Qe(er(i),{})}function be(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function nr(i,t){const{x:e,y:n}=i,r=Math.sin(t),s=Math.cos(t);return{x:e*s-n*r,y:e*r+n*s}}function Ze(i,t,e,n){const r=i.x-t.x,s=i.y-t.y;return{x:t.x+(r+Math.tan(e)*s),y:t.y+(s+Math.tan(n)*r)}}function rr(i,t,e,n){const r=e<0?t.x-i.x+t.x:i.x,s=n<0?t.y-i.y+t.y:i.y;return{x:r*Math.abs(e),y:s*Math.abs(n)}}function ir(i,t,e=0,n=0,r=0,s=1,o=1){let a=Array.isArray(i)?i:[i];const c=-e/180*Math.PI,{x:h,y:l}=t;return(s!==1||o!==1)&&(a=a.map(u=>rr(u,t,s,o))),(n||r)&&(a=a.map(u=>Ze(u,t,n,r))),a=a.map(u=>{const p=u.x-h,y=-(u.y-l);return u=nr({x:p,y},c),{x:h+u.x,y:l-u.y}}),a[0]}const eo=new Set(["©","®","÷"]),no=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class sr{constructor(t,e,n){I(this,"boundingBox",new E);I(this,"textWidth",0);I(this,"textHeight",0);I(this,"path",new lt);this.content=t,this.index=e,this.parent=n}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=En.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Pt||t instanceof _t)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:n,descender:r,os2:s,post:o}=t,{content:a,computedStyle:c,boundingBox:h,isVertical:l}=this,{left:u,top:p,height:y}=h,{fontSize:g}=c,m=e/g,w=t.getAdvanceWidth(a,g),x=(n+Math.abs(r))/m,_=n/m,v=(n-s.yStrikeoutPosition)/m,T=s.yStrikeoutSize/m,C=(n-o.underlinePosition)/m,O=o.underlineThickness/m;return this.glyphWidth=w,this.glyphHeight=x,this.underlinePosition=C,this.underlineThickness=O,this.yStrikeoutPosition=v,this.yStrikeoutSize=T,this.baseline=_,this.centerDiviation=.5*y-_,this.glyphBox=l?new E(u,p,x,w):new E(u,p,w,x),this.centerPoint=this.glyphBox.getCenterPoint(),this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:n,textWidth:r,textHeight:s,boundingBox:o,computedStyle:a,baseline:c,glyphHeight:h,glyphWidth:l}=this.updateGlyph(t),{os2:u,ascender:p,descender:y}=t,g=p,m=y,w=u.sTypoAscender,{left:x,top:_}=o,{fontSize:v,fontStyle:T}=a;let C=x,O=_+c,A,P;if(e&&(C+=(h-l)/2,Math.abs(r-s)>.1&&(O-=(g-w)/(g+Math.abs(m))*h),A=void 0),e&&!eo.has(n)&&(n.codePointAt(0)<=256||no.has(n))){P=t.getPathCommands(n,C,_+c-(h-l)/2,v)??[];const U={y:_-(h-l)/2+h/2,x:C+l/2};T==="italic"&&(P=this._italic(P,e?{x:U.x,y:_-(h-l)/2+c}:void 0)),P=this._rotation90(P,U)}else A!==void 0?(P=t.glyf.glyphs.get(A).getPathCommands(C,O,v),T==="italic"&&(P=this._italic(P,e?{x:C+l/2,y:_+w/(g+Math.abs(m))*h}:void 0))):(P=t.getPathCommands(n,C,O,v)??[],T==="italic"&&(P=this._italic(P,e?{x:C+h/2,y:O}:void 0)));P.push(...this._decoration());const S=new lt(P);return S.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*v*.03:0},this.path=S,this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:n}=this,{textDecoration:r,fontSize:s}=this.computedStyle,{left:o,top:a,width:c,height:h}=this.boundingBox,l=.1*s;let u;switch(r){case"underline":t?u=o:u=a+e;break;case"line-through":t?u=o+c/2:u=a+n;break;case"none":default:return[]}return t?[{type:"M",x:u,y:a},{type:"L",x:u,y:a+h},{type:"L",x:u+l,y:a+h},{type:"L",x:u+l,y:a},{type:"Z"}]:[{type:"M",x:o,y:u},{type:"L",x:o+c,y:u},{type:"L",x:o+c,y:u+l},{type:"L",x:o,y:u+l},{type:"Z"}]}_italic(t,e){const{baseline:n,glyphWidth:r}=this,{left:s,top:o}=this.boundingBox,a=e||{y:o+n,x:s+r/2};return this._transform(t,(c,h)=>{const l=Ze({x:c,y:h},a,-.24,0);return[l.x,l.y]})}_rotation90(t,e){return this._transform(t,(n,r)=>{const s=ir({x:n,y:r},e,90);return[s.x,s.y]})}_transform(t,e){return t.map(n=>{const r={...n};switch(r.type){case"L":case"M":[r.x,r.y]=e(r.x,r.y);break;case"Q":[r.x1,r.y1]=e(r.x1,r.y1),[r.x,r.y]=e(r.x,r.y);break}return r})}getMinMax(t,e){return this.path.getMinMax(t,e)}getBoundingBox(){return this.path.getBoundingBox()}drawTo(t,e={}){Se({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class or{constructor(t,e={},n){I(this,"boundingBox",new E);I(this,"highlight");this.content=t,this.style=e,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...be(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new sr(n,e++,this));return this.characters=t,this}}class Vt{constructor(t,e){I(this,"boundingBox",new E);I(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...be(this.parentStyle),...be(this.style)},this}addFragment(t,e){const n=new or(t,e,this);return this.fragments.push(n),n}}class Bt{constructor(t){this._text=t}}class ar extends Bt{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class hr extends Bt{getBoundingBox(){const{characters:t,effects:e}=this._text,n=[];return t.forEach(r=>{const s=r.computedStyle.fontSize;e==null||e.forEach(o=>{const a=(o.offsetX??0)*s,c=(o.offsetY??0)*s,h=(o.shadowOffsetX??0)*s,l=(o.shadowOffsetY??0)*s,u=Math.max(.1,o.textStrokeWidth??0)*s,p=r.boundingBox.clone();p.left+=a+h-u,p.top+=c+l-u,p.width+=u*2,p.height+=u*2,n.push(p)})}),E.from(...n)}draw(t){const{ctx:e}=t,{effects:n,characters:r,boundingBox:s}=this._text;return n&&(n.forEach(o=>{dt(o,s,e)}),r.forEach(o=>{n.forEach(a=>{o.drawTo(e,a)})})),this}}class cr extends Bt{constructor(){super(...arguments);I(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new E;const e=b.MAX,n=b.MIN;return this.paths.forEach(r=>r.path.getMinMax(e,n)),new E(e.x,e.y,n.x-e.x,n.y-e.y)}highlight(){const{characters:e}=this._text;let n;const r=[];let s;e.forEach(o=>{const a=o.parent.highlight;a!=null&&a.url&&((s==null?void 0:s.url)===a.url&&n.length&&n[0].boundingBox.top===o.boundingBox.top&&n[0].fontSize===o.fontSize?n.push(o):(n=[],n.push(o),r.push(n))),s=a}),this.paths=r.filter(o=>o.length).map(o=>({url:o[0].parent.highlight.url,box:E.from(...o.map(a=>a.boundingBox)),baseline:Math.max(...o.map(a=>a.baseline)),fontSize:o[0].fontSize})).map(o=>this._parseGroup(o)).flat()}_parseSvg(e){const n=er(e),r=to(n),s=b.MAX,o=b.MIN;return r.forEach(a=>a.getMinMax(s,o)),{paths:r,box:new E(s.x,s.y,o.x-s.x,o.y-s.y),viewBox:new E(...n.getAttribute("viewBox").split(" ").map(Number))}}_parseGroup(e){const{url:n,box:r,baseline:s,fontSize:o}=e,{box:a,viewBox:c,paths:h}=this._parseSvg(n),l=c.top+c.height/2,u=[],p=l>a.top?0:1;function y(g,m){g.style.strokeWidth&&(g.style.strokeWidth*=m),g.style.strokeMiterlimit&&(g.style.strokeMiterlimit*=m),g.style.strokeDashoffset&&(g.style.strokeDashoffset*=m),g.style.strokeDasharray&&(g.style.strokeDasharray=g.style.strokeDasharray.map(w=>w*m))}if(p===0){const g={x:r.left-o*.2,y:r.top},m=(r.width+o*.2*2)/a.width,w=r.height/a.height,x=new ct().translate(-a.x,-a.y).scale(m,w).translate(g.x,g.y);h.forEach(_=>{const v=_.clone().transform(x);y(v,m),u.push({path:v})})}else if(p===1){const g=o/a.width,m=a.width*g,w=Math.ceil(r.width/m),x={x:r.left,y:r.top+s+o*.1},_=new ct().translate(-a.x,-a.y).scale(g,g).translate(x.x,x.y);for(let v=0;v<w;v++){const T=_.clone().translate(v*m,0);h.forEach(C=>{const O=C.clone().transform(T);y(O,g),u.push({clipRect:r,path:O})})}}return u}draw({ctx:e}){return this.paths.forEach(n=>{Se({ctx:e,path:n.path,clipRect:n.clipRect,fontSize:this._text.computedStyle.fontSize})}),this}}class lr extends Bt{_styleToDomStyle(t){const e={...t};for(const n in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(n)?e[n]=`${t[n]}px`:e[n]=t[n];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,n=document.createDocumentFragment(),r=document.createElement("section");Object.assign(r.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const s=document.createElement("ul");return Object.assign(s.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(c=>{const h=document.createElement("span");Object.assign(h.style,this._styleToDomStyle(c.style)),h.appendChild(document.createTextNode(c.content)),a.appendChild(h)}),s.appendChild(a)}),r.appendChild(s),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}}}_measureDom(t){const e=[],n=[],r=[];return t.querySelectorAll("li").forEach((s,o)=>{const a=s.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),s.querySelectorAll("span").forEach((c,h)=>{var p;const l=s.getBoundingClientRect();n.push({paragraphIndex:o,fragmentIndex:h,left:l.left,top:l.top,width:l.width,height:l.height});const u=c.firstChild;if(u instanceof window.Text){const y=document.createRange();y.selectNodeContents(u);const g=u.data?u.data.length:0;let m=0;for(;m<=g;){y.setStart(u,Math.max(m-1,0)),y.setEnd(u,m);const w=((p=y.getClientRects)==null?void 0:p.call(y))??[y.getBoundingClientRect()];let x=w[w.length-1];w.length>1&&x.width<2&&(x=w[w.length-2]);const _=y.toString();_!==""&&x&&x.width+x.height!==0&&r.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:h,characterIndex:m-1,top:x.top,left:x.left,height:x.height,width:x.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:n,characters:r}}measureDom(t){const{paragraphs:e}=this._text,n=t.getBoundingClientRect(),r=t.querySelector("ul"),s=window.getComputedStyle(t).writingMode.includes("vertical"),o=r.style.lineHeight;r.style.lineHeight="4000px";const a=[[]];let c=a[0];const{characters:h}=this._measureDom(t);h.length>0&&(c.push(h[0]),h.reduce((y,g)=>{const m=s?"left":"top";return Math.abs(g[m]-y[m])>4e3/2&&(c=[],a.push(c)),c.push(g),g})),r.style.lineHeight=o;const l=this._measureDom(t);l.paragraphs.forEach(y=>{const g=e[y.paragraphIndex];g.boundingBox.left=y.left,g.boundingBox.top=y.top,g.boundingBox.width=y.width,g.boundingBox.height=y.height}),l.fragments.forEach(y=>{const g=e[y.paragraphIndex].fragments[y.fragmentIndex];g.boundingBox.left=y.left,g.boundingBox.top=y.top,g.boundingBox.width=y.width,g.boundingBox.height=y.height});const u=[];let p=0;return a.forEach(y=>{y.forEach(g=>{const m=l.characters[p],{paragraphIndex:w,fragmentIndex:x,characterIndex:_}=m;u.push({...m,newParagraphIndex:w,textWidth:g.width,textHeight:g.height,left:m.left-n.left,top:m.top-n.top});const v=e[w].fragments[x].characters[_];v.boundingBox.left=u[p].left,v.boundingBox.top=u[p].top,v.boundingBox.width=u[p].width,v.boundingBox.height=u[p].height,v.textWidth=u[p].textWidth,v.textHeight=u[p].textHeight,p++})}),{paragraphs:e,boundingBox:new E(0,0,n.width,n.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const n=this.measureDom(t);return e==null||e(),n}}class ur extends Bt{parse(){let{content:t,computedStyle:e}=this._text;const n=[];if(typeof t=="string"){const r=new Vt({},e);r.addFragment(t),n.push(r)}else{t=Array.isArray(t)?t:[t];for(const r of t)if(typeof r=="string"){const s=new Vt({},e);s.addFragment(r),n.push(s)}else if(Array.isArray(r)){const s=new Vt({},e);r.forEach(o=>{if(typeof o=="string")s.addFragment(o);else{const{content:a,highlight:c,...h}=o;if(a!==void 0){const l=s.addFragment(a,h);l.highlight=c}}}),n.push(s)}else if("fragments"in r){const{fragments:s,...o}=r,a=new Vt(o,e);s.forEach(c=>{const{content:h,highlight:l,...u}=c;if(h!==void 0){const p=a.addFragment(h,u);p.highlight=l}}),n.push(a)}else if("content"in r){const{content:s,highlight:o,...a}=r;if(s!==void 0){const c=new Vt(a,e),h=c.addFragment(s);h.highlight=o,n.push(c)}}}return n}}class ro extends Bt{}class fr extends Bt{setupView(t){const{ctx:e,pixelRatio:n}=t,{renderBoundingBox:r}=this._text,{left:s,top:o,width:a,height:c}=r,h=e.canvas;return h.dataset.viewbox=`${s} ${o} ${a} ${c}`,h.dataset.pixelRatio=String(n),h.width=Math.max(1,Math.ceil(a*n)),h.height=Math.max(1,Math.ceil(c*n)),h.style.marginTop=`${o}px`,h.style.marginLeft=`${s}px`,h.style.width=`${a}px`,h.style.height=`${c}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(n,n),e.translate(-s,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:n,computedStyle:r,renderBoundingBox:s}=this._text,{width:o,height:a}=s;return dt(r,new E(0,0,o,a),e),n.forEach(c=>{dt(c.computedStyle,c.boundingBox,e),c.fragments.forEach(h=>{dt(h.computedStyle,h.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:n,paragraphs:r}=this._text;function s(o,a,c,h,l){e.fillStyle=o,e.fillRect(a,c,h,l)}return n!=null&&n.backgroundColor&&s(n.backgroundColor,0,0,e.canvas.width,e.canvas.height),r.forEach(o=>{var a;(a=o.style)!=null&&a.backgroundColor&&s(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(c=>{var h;(h=c.style)!=null&&h.backgroundColor&&s(c.computedStyle.backgroundColor,...c.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:n}=this._text;return n.forEach(r=>{r.drawTo(e)}),this}}const Je={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class io{constructor(t={}){I(this,"content");I(this,"style");I(this,"effects");I(this,"deformation");I(this,"measureDom");I(this,"needsUpdate",!0);I(this,"computedStyle",{...Je});I(this,"paragraphs",[]);I(this,"boundingBox",new E);I(this,"renderBoundingBox",new E);I(this,"parser",new ur(this));I(this,"measurer",new lr(this));I(this,"deformer",new ar(this));I(this,"effector",new hr(this));I(this,"highlighter",new cr(this));I(this,"renderer2D",new fr(this));const{content:e="",style:n={},effects:r,deformation:s,measureDom:o}=t;this.content=e,this.style=n,this.effects=r,this.deformation=s,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...Je,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const n=this.measurer.measure(t);return this.paragraphs=e,n}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const n=this.characters;n.forEach(o=>o.update()),this.highlighter.highlight(),this.deformation&&this.deformer.deform();const r=b.MAX,s=b.MIN;return n.forEach(o=>o.getMinMax(r,s)),this.renderBoundingBox=new E(r.x,r.y,s.x-r.x,s.y-r.y),this}render(t){var s,o;const{view:e,pixelRatio:n=2}=t,r=e.getContext("2d");return r?(this.needsUpdate&&this.update(),(s=this.effects)!=null&&s.length?this.renderBoundingBox=E.from(this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()):this.renderBoundingBox=E.from(this.renderBoundingBox,this.highlighter.getBoundingBox()),this.renderer2D.setupView({pixelRatio:n,ctx:r}),this.renderer2D.uploadColors({ctx:r}),this.highlighter.draw({ctx:r}),(o=this.effects)!=null&&o.length?this.effector.draw({ctx:r}):this.renderer2D.draw({ctx:r}),this):this}}f.Character=sr,f.CmapSubtableFormat0=Ue,f.CmapSubtableFormat12=Ne,f.CmapSubtableFormat14=Jt,f.CmapSubtableFormat2=Kt,f.CmapSubtableFormat4=Fe,f.CmapSubtableFormat6=It,f.Deformer=ar,f.Effector=hr,f.Eot=Kr,f.Font=de,f.Fonts=Dn,f.Fragment=or,f.Glyph=xn,f.GlyphSet=_n,f.Highlighter=cr,f.Measurer=lr,f.Paragraph=Vt,f.Parser=ur,f.Reflector=ro,f.Renderer2D=fr,f.Sfnt=te,f.TableDirectory=Ft,f.Text=io,f.Ttf=_t,f.Woff=Pt,f.WoffTableDirectoryEntry=Ut,f.componentFlags=Gt,f.createCmapSegments=Be,f.defaultTextStyles=Je,f.defineSfntTable=j,f.drawPath=Se,f.filterEmpty=be,f.fonts=En,f.getPointPosition=ir,f.getRotationPoint=nr,f.getScalePoint=rr,f.getSkewPoint=Ze,f.minify=ss,f.minifyGlyphs=Un,f.minifySfnt=Ln,f.parseColor=H,f.uploadColor=dt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
}`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:i=!0,...o}=e,{family:a,url:h}=t;if(this._loaded.has(h))return r&&(this._loading.forEach(u=>u.cancel()),this._loading.clear()),this._loaded.get(h);let l=this._loading.get(h);return l||(l=this._createRequest(h,o),this._loading.set(h,l)),r&&this._loading.forEach((u,c)=>{u!==l&&(u.cancel(),this._loading.delete(c))}),l.when.then(u=>{const c={...t,font:en(u)??u};return this._loaded.has(h)||(this._loaded.set(h,c),new Set(Array.isArray(a)?a:[a]).forEach(d=>{this._namesUrls.set(d,h),typeof document<"u"&&(n&&this.injectFontFace(d,u),i&&this.injectStyleTag(d,h))})),c}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw u}).finally(()=>{this._loading.delete(h)})}};de(rn,"defaultRequestInit",{cache:"force-cache"});let nn=rn;const sn=new nn;function on(s,t){const{cmap:e,loca:r,hmtx:n,vmtx:i,glyf:o}=s,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,u=i==null?void 0:i.metrics,c=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,f)=>w-f),d=new Map;c.forEach(w=>{const f=a.get(w)??0;let P=d.get(f);P||d.set(f,P=new Set),P.add(w)});const m=[],g=w=>{const f=l[w],P=(u==null?void 0:u[w])??{advanceHeight:0,topSideBearing:0},_=h[w],x=h[w+1]??_,O={...f,...P,rawGlyphIndex:w,glyphIndex:m.length,unicodes:Array.from(d.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,x-_)};return m.push(O),O};return g(0),c.forEach(w=>g(a.get(w))),m.slice().forEach(w=>{const{view:f}=w;if(!f.byteLength||f.getInt16(0)>=0)return;let _=10,x;do{x=f.getUint16(_);const O=_+2,v=f.getUint16(O);_+=4,Zt.ARG_1_AND_2_ARE_WORDS&x?_+=4:_+=2,Zt.WE_HAVE_A_SCALE&x?_+=2:Zt.WE_HAVE_AN_X_AND_Y_SCALE&x?_+=4:Zt.WE_HAVE_A_TWO_BY_TWO&x&&(_+=8);const b=g(v);f.setUint16(O,b.glyphIndex)}while(Zt.MORE_COMPONENTS&x)}),m}function an(s,t){const e=on(s,t),r=e.length,{head:n,maxp:i,hhea:o,vhea:a}=s;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,i.numGlyphs=r;let h=0;s.loca=p.Loca.from([...e.map(d=>{const m=h;return h+=d.view.byteLength,m}),h],n.indexToLocFormat);const l=e.reduce((d,m,g)=>(m.unicodes.forEach(w=>d.set(w,g)),d),new Map);s.cmap=p.Cmap.from(l),s.glyf=p.Glyf.from(e.map(d=>d.view)),o.numOfLongHorMetrics=r,s.hmtx=p.Hmtx.from(e.map(d=>({advanceWidth:d.advanceWidth,leftSideBearing:d.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),s.vmtx&&(s.vmtx=p.Vmtx.from(e.map(d=>({advanceHeight:d.advanceHeight,topSideBearing:d.topSideBearing}))));const c=new p.Post;return c.format=3,c.italicAngle=0,c.underlinePosition=0,c.underlineThickness=0,c.isFixedPitch=0,c.minMemType42=0,c.minMemType42=0,c.minMemType1=0,c.maxMemType1=r,s.post=c,s.delete("GPOS"),s.delete("GSUB"),s.delete("hdmx"),s}function Vi(s,t){let e,r;if(s instanceof st)e=s.sfnt.clone(),r="ttf";else if(s instanceof Lt)e=s.sfnt.clone(),r="woff";else{const i=Gt(s);if(st.is(i))e=new st(i).sfnt,r="ttf-buffer";else if(Lt.is(i))e=new Lt(i).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=an(e,t);switch(r){case"ttf":return st.from(n);case"woff":return Lt.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return Lt.from(n).view.buffer}}const Hi={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Wi(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:h,strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:c=0,shadowBlur:d=0,shadowColor:m="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=Hi[o],s.miterLimit=a,h&&s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=u,s.shadowOffsetY=c,s.shadowBlur=d,s.shadowColor=m}class S{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new S(1/0,1/0)}static get MIN(){return new S(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new S(this.x,this.y)}}class z{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){const e=t[0],r=t.slice(1).reduce((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new z(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new S((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new z(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var Xi=Object.defineProperty,ji=(s,t,e)=>t in s?Xi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Yi=(s,t,e)=>(ji(s,t+"",e),e);class vt{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,h=0,l=1){Yi(this,"elements",[]),this.set(t,e,r,n,i,o,a,h,l)}set(t,e,r,n,i,o,a,h,l){const u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=i,u[5]=h,u[6]=r,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,i=this.elements,o=r[0],a=r[3],h=r[6],l=r[1],u=r[4],c=r[7],d=r[2],m=r[5],g=r[8],w=n[0],f=n[3],P=n[6],_=n[1],x=n[4],O=n[7],v=n[2],b=n[5],A=n[8];return i[0]=o*w+a*_+h*v,i[3]=o*f+a*x+h*b,i[6]=o*P+a*O+h*A,i[1]=l*w+u*_+c*v,i[4]=l*f+u*x+c*b,i[7]=l*P+u*O+c*A,i[2]=d*w+m*_+g*v,i[5]=d*f+m*x+g*b,i[8]=d*P+m*O+g*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],h=t[6],l=t[7],u=t[8],c=u*o-a*l,d=a*h-u*i,m=l*i-o*h,g=e*c+r*d+n*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/g;return t[0]=c*w,t[1]=(n*l-u*r)*w,t[2]=(a*r-n*o)*w,t[3]=d*w,t[4]=(u*e-n*h)*w,t[5]=(n*i-a*e)*w,t[6]=m*w,t[7]=(r*h-l*e)*w,t[8]=(o*e-r*i)*w,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(lr.makeScale(t,e)),this}rotate(t){return this.premultiply(lr.makeRotation(-t)),this}translate(t,e){return this.premultiply(lr.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const lr=new vt;function ln(s,t,e,r){const n=s*e+t*r,i=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let o=Math.acos(Math.max(-1,Math.min(1,n/i)));return s*r-t*e<0&&(o=-o),o}function Ki(s,t,e,r,n,i,o,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(o.x-a.x)/2,l=(o.y-a.y)/2,u=Math.cos(r)*h+Math.sin(r)*l,c=-Math.sin(r)*h+Math.cos(r)*l;let d=t*t,m=e*e;const g=u*u,w=c*c,f=g/d+w/m;if(f>1){const L=Math.sqrt(f);t=L*t,e=L*e,d=t*t,m=e*e}const P=d*w+m*g,_=(d*m-P)/P;let x=Math.sqrt(Math.max(0,_));n===i&&(x=-x);const O=x*t*c/e,v=-x*e*u/t,b=Math.cos(r)*O-Math.sin(r)*v+(o.x+a.x)/2,A=Math.sin(r)*O+Math.cos(r)*v+(o.y+a.y)/2,C=ln(1,0,(u-O)/t,(c-v)/e),M=ln((u-O)/t,(c-v)/e,(-u-O)/t,(-c-v)/e)%(Math.PI*2);s.ellipse(b,A,t,e,r,C,C+M,i===1)}function Qt(s,t){return s-(t-s)}function hn(s,t){const e=new S,r=new S;for(let n=0,i=s.length;n<i;n++){const o=s[n];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(Qt(e.x,r.x),Qt(e.y,r.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(Qt(e.x,r.x),Qt(e.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),r.x=e.x+o.x1,r.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=Qt(e.x,r.x),h=Qt(e.y,r.y);r.x=a,r.y=h,o.type==="t"?(t.quadraticCurveTo(a,h,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,h,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}r.copy(e),Ki(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Tt(s,t,e=0){let a=0,h=!0,l="",u="";const c=[];function d(f,P,_){const x=new SyntaxError(`Unexpected character "${f}" at index ${P}.`);throw x.partial=_,x}function m(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let g;const w=s.length;for(let f=0;f<w;f++){if(g=s[f],Array.isArray(t)&&t.includes(c.length%e)&&Z.FLAGS.test(g)){a=1,l=g,m();continue}if(a===0){if(Z.WHITESPACE.test(g))continue;if(Z.DIGIT.test(g)||Z.SIGN.test(g)){a=1,l=g;continue}if(Z.POINT.test(g)){a=2,l=g;continue}Z.COMMA.test(g)&&(h&&d(g,f,c),h=!0)}if(a===1){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.POINT.test(g)){l+=g,a=2;continue}if(Z.EXP.test(g)){a=3;continue}Z.SIGN.test(g)&&l.length===1&&Z.SIGN.test(l[0])&&d(g,f,c)}if(a===2){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.EXP.test(g)){a=3;continue}Z.POINT.test(g)&&l[l.length-1]==="."&&d(g,f,c)}if(a===3){if(Z.DIGIT.test(g)){u+=g;continue}if(Z.SIGN.test(g)){if(u===""){u+=g;continue}u.length===1&&Z.SIGN.test(u)&&d(g,f,c)}}Z.WHITESPACE.test(g)?(m(),a=0,h=!1):Z.COMMA.test(g)?(m(),a=0,h=!0):Z.SIGN.test(g)?(m(),a=1,l=g):Z.POINT.test(g)?(m(),a=2,l=g):d(g,f,c)}return m(),c}function Zi(s){switch(s.type){case"m":case"M":return`${s.type} ${s.x} ${s.y}`;case"h":case"H":return`${s.type} ${s.x}`;case"v":case"V":return`${s.type} ${s.y}`;case"l":case"L":return`${s.type} ${s.x} ${s.y}`;case"c":case"C":return`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"s":case"S":return`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"q":case"Q":return`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`;case"t":case"T":return`${s.type} ${s.x} ${s.y}`;case"a":case"A":return`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`;case"z":case"Z":return s.type;default:return""}}function Qi(s){let t="";for(let e=0,r=s.length;e<r;e++)t+=`${Zi(s[e])} `;return t}const Ji=/[a-df-z][^a-df-z]*/gi;function cn(s){const t=[],e=s.match(Ji);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const i=e[r],o=i.charAt(0),a=i.slice(1).trim();let h;switch(o){case"m":case"M":h=Tt(a);for(let l=0,u=h.length;l<u;l+=2)l===0?t.push({type:o,x:h[l],y:h[l+1]}):t.push({type:o==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Tt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Tt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Tt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"c":case"C":h=Tt(a);for(let l=0,u=h.length;l<u;l+=6)t.push({type:o,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Tt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Tt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Tt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"a":case"A":h=Tt(a,[3,4],7);for(let l=0,u=h.length;l<u;l+=7)t.push({type:o,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(i)}}return t}var to=Object.defineProperty,eo=(s,t,e)=>t in s?to(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,hr=(s,t,e)=>(eo(s,typeof t!="symbol"?t+"":t,e),e);class Ht{constructor(){hr(this,"arcLengthDivisions",200),hr(this,"_cacheArcLengths"),hr(this,"_needsUpdate",!1)}getPointAt(t,e=new S){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),i+=r.distanceTo(n),e.push(i),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const r=this.getLengths();let n=0;const i=r.length;let o;e?o=e:o=t*r[i-1];let a=0,h=i-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-o,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===o)return n/(i-1);const u=r[n],d=r[n+1]-u,m=(o-u)/d;return(n+m)/(i-1)}getTangent(t,e=new S){const n=Math.max(0,t-1e-4),i=Math.min(1,t+1e-4);return e.copy(this.getPoint(i).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUtoTmapping(t),e)}transformPoint(t){return this}transform(t){return this.transformPoint(e=>e.applyMatrix3(t)),this}getMinMax(t=S.MAX,e=S.MIN){return this.getPoints().forEach(r=>{t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new z(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}getData(){return Qi(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function un(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,h=s*a;return(2*e-2*r+i+o)*h+(-3*e+3*r-2*i-o)*a+i*s+e}function ro(s,t){const e=1-s;return e*e*t}function no(s,t){return 2*(1-s)*s*t}function so(s,t){return s*s*t}function fn(s,t,e,r){return ro(s,t)+no(s,e)+so(s,r)}function io(s,t){const e=1-s;return e*e*e*t}function oo(s,t){const e=1-s;return 3*e*e*s*t}function ao(s,t){return 3*(1-s)*s*s*t}function lo(s,t){return s*s*s*t}function pn(s,t,e,r,n){return io(s,t)+oo(s,e)+ao(s,r)+lo(s,n)}class ho extends Ht{constructor(t=new S,e=new S,r=new S,n=new S){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new S){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(pn(t,r.x,n.x,i.x,o.x),pn(t,r.y,n.y,i.y,o.y)),e}transformPoint(t){return t(this.start),t(this.startControl),t(this.endControl),t(this.end),this}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const i=Math.sqrt(n),o=(-e+i)/(2*t),a=(-e-i)/(2*t);return[o,a].filter(h=>h>=0&&h<=1)}getMinMax(t=S.MAX,e=S.MIN){const r=this.start,n=this.startControl,i=this.endControl,o=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(o.x-i.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.y)),l=[0,1,...a,...h];return((c,d)=>{for(const m of c)for(let g=0;g<=d;g++){const w=g/d-.5,f=Math.min(1,Math.max(0,m+w)),P=this.getPoint(f);t.x=Math.min(t.x,P.x),t.y=Math.min(t.y,P.y),e.x=Math.max(e.x,P.x),e.y=Math.max(e.y,P.y)}})(l,10),{min:t,max:e}}getCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{startControl:e,endControl:r,end:n}=this;return t.bezierCurveTo(e.x,e.y,r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const co=new vt,dn=new vt,gn=new vt,De=new S;class uo extends Ht{constructor(t=new S,e=1,r=1,n=0,i=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=o,this.clockwise=a}getPoint(t,e=new S){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const i=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(i?n=0:n=r),this.clockwise&&!i&&(n===r?n=-r:n=n-r);const o=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(o),h=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const l=Math.cos(this.rotation),u=Math.sin(this.rotation),c=a-this.center.x,d=h-this.center.y;a=c*l-d*u+this.center.x,h=c*u+d*l+this.center.y}return e.set(a,h)}getCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:i,clockwise:o,rotation:a}=this,{x:h,y:l}=t,u=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),c=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),d=Math.abs(n-i),m=d>Math.PI?1:0,g=o?1:0,w=a*180/Math.PI;if(d>=2*Math.PI){const f=n+Math.PI,P=h+e*Math.cos(f)*Math.cos(a)-r*Math.sin(f)*Math.sin(a),_=l+e*Math.cos(f)*Math.sin(a)+r*Math.sin(f)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:P,y:_},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:u,y:c}]}else{const f=h+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),P=l+e*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:m,sweepFlag:g,x:f,y:P}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,i,o,a,!h),this}transform(t){return De.set(this.center.x,this.center.y),De.applyMatrix3(t),this.center.x=De.x,this.center.y=De.y,go(t)?fo(this,t):po(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=S.MAX,e=S.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:h}=r,l=Math.cos(o),u=Math.sin(o),c=Math.sqrt(n*n*l*l+i*i*u*u),d=Math.sqrt(n*n*u*u+i*i*l*l);return t.x=Math.min(t.x,a-c),t.y=Math.min(t.y,h-d),e.x=Math.max(e.x,a+c),e.y=Math.max(e.y,h+d),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function fo(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new S(e*n,e*i),a=new S(-r*i,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),u=co.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=dn.copy(u).invert(),g=gn.copy(c).transpose().multiply(c).elements,w=mo(g[0],g[1],g[4]),f=Math.sqrt(w.rt1),P=Math.sqrt(w.rt2);if(s.radiusX=1/f,s.radiusY=1/P,s.rotation=Math.atan2(w.sn,w.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=dn.set(f,0,0,0,P,0,0,0,1),O=gn.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(O).multiply(u),b=A=>{const{x:C,y:M}=new S(Math.cos(A),Math.sin(A)).applyMatrix3(v);return Math.atan2(M,C)};s.startAngle=b(s.startAngle),s.endAngle=b(s.endAngle),mn(t)&&(s.clockwise=!s.clockwise)}}function po(s,t){const e=yn(t),r=wn(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,mn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function mn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function go(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=yn(s),n=wn(s);return Math.abs(e/(r*n))>Number.EPSILON}function yn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function wn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function mo(s,t,e){let r,n,i,o,a;const h=s+e,l=s-e,u=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+u),a=1/r,n=s*a*e-t*a*t):h<0?n=.5*(h-u):(r=.5*u,n=-.5*u),l>0?i=l+u:i=l-u,Math.abs(i)>2*Math.abs(t)?(a=-2*t/i,o=1/Math.sqrt(1+a*a),i=a*o):Math.abs(t)===0?(i=1,o=0):(a=-.5*i/t,i=1/Math.sqrt(1+a*a),o=a*i),l>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class cr extends Ht{constructor(t=new S,e=new S){super(),this.start=t,this.end=e}getPoint(t,e=new S){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new S){return this.getPoint(t,e)}getTangent(t,e=new S){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new S){return this.getTangent(t,e)}getNormal(t,e=new S){const{x:r,y:n}=this.getPoint(t).sub(this.start);return e.set(n,-r).normalize()}transformPoint(t){return t(this.start),t(this.end),this}getMinMax(t=S.MAX,e=S.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}getCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{end:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class yo extends Ht{constructor(t=new S,e=new S,r=new S){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new S){const{start:r,control:n,end:i}=this;return e.set(fn(t,r.x,n.x,i.x),fn(t,r.y,n.y,i.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=S.MAX,e=S.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+i.x),l=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,h),t.y=Math.min(t.y,r.y,i.y,a,l),e.x=Math.max(e.x,r.x,i.x,o,h),e.y=Math.max(e.y,r.y,i.y,a,l),{min:t,max:e}}getCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{control:e,end:r}=this;return t.quadraticCurveTo(e.x,e.y,r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var wo=Object.defineProperty,vo=(s,t,e)=>t in s?wo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vn=(s,t,e)=>(vo(s,typeof t!="symbol"?t+"":t,e),e);class bo extends Ht{constructor(t,e,r=1,n=0,i=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=i,vn(this,"curves",[]),vn(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,n=this.rx/this.aspectRatio,i=[new S(t-r,e-n),new S(t+r,e-n),new S(t+r,e+n),new S(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new cr(i[o].clone(),i[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=S.MAX,e=S.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class xo extends Ht{constructor(t=[]){super(),this.points=t}getPoint(t,e=new S){const{points:r}=this,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],h=r[i],l=r[i>r.length-2?r.length-1:i+1],u=r[i>r.length-3?r.length-1:i+2];return e.set(un(o,a.x,h.x,l.x,u.x),un(o,a.y,h.y,l.y,u.y)),e}transformPoint(t){return this.points.forEach(e=>t(e)),this}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var _o=Object.defineProperty,So=(s,t,e)=>t in s?_o(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(s,t,e)=>(So(s,typeof t!="symbol"?t+"":t,e),e);class me extends Ht{constructor(t){super(),ge(this,"curves",[]),ge(this,"startPoint"),ge(this,"currentPoint",new S),ge(this,"autoClose",!1),ge(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:n,y:i}=t[e];this.lineTo(n,i)}return this}addCommands(t){return hn(t,this),this}addData(t){return this.addCommands(cn(t)),this}getPoint(t,e=new S){const r=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=r){const o=n[i]-r,a=this.curves[i],h=a.getLength();return a.getPointAt(h===0?0:1-o/h,e)}i++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let i=0,o=r.length;i<o;i++){const h=r[i].getPoints(t);for(let l=0;l<h.length;l++){const u=h[l];n!=null&&n.equals(u)||(e.push(u),n=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new cr(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new cr(this.currentPoint.clone(),new S(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPoint.equals({x:i,y:o})||this.curves.push(new ho(this.currentPoint.clone(),new S(t,e),new S(r,n),new S(i,o))),this._setCurrentPoint({x:i,y:o}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new yo(this.currentPoint.clone(),new S(t,e),new S(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,i,o){return this.ellipse(t,e,r,r,0,n,i,o),this}relativeArc(t,e,r,n,i,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,i,o),this}arcTo(t,e,r,n,i){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,i,o,a,h=!0){const l=new uo(new S(t,e),r,n,i,o,a,!h);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,i,o,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,i,o,a,h),this}rect(t,e,r,n){return this.curves.push(new bo(new S(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new xo([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=S.MAX,e=S.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new z(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Po(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var Co=Object.defineProperty,Mo=(s,t,e)=>t in s?Co(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ur=(s,t,e)=>(Mo(s,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){ur(this,"currentPath",new me),ur(this,"paths",[this.currentPath]),ur(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof bt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new me().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r.equals({x:t,y:e})||(n.length?(this.currentPath=new me().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPath.bezierCurveTo(t,e,r,n,i,o),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,i,o){return this.currentPath.arc(t,e,r,n,i,o),this}arcTo(t,e,r,n,i){return this.currentPath.arcTo(t,e,r,n,i),this}ellipse(t,e,r,n,i,o,a,h){return this.currentPath.ellipse(t,e,r,n,i,o,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return hn(t,this),this}addData(t){return this.addCommands(cn(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(r=>t(r))),this}transformPoint(t){return this.forEachCurve(e=>e.transformPoint(t)),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=S.MAX,e=S.MIN,r=!0){if(this.forEachCurve(n=>n.getMinMax(t,e)),r){const n=this.strokeWidth/2;t.x-=n,t.y-=n,e.x+=n,e.y+=n}return{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new z(e.x,e.y,r.x-e.x,r.y-e.y)}getCommands(){return this.paths.flatMap(t=>t.getCommands())}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgPathXml(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[Po(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.getData()}" style="${r}"></path>`}getSvgXml(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),i=this.getSvgPathXml();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgXml())}`}drawTo(t,e=!0){const{fill:r="#000",stroke:n="none"}=this.style;e&&Wi(t,this.style),this.paths.forEach(i=>{i.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}toSvg(){return new DOMParser().parseFromString(this.getSvgXml(),"image/svg+xml").documentElement}toCanvas(t=2){const{left:e,top:r,width:n,height:i}=this.getBoundingBox(),o=document.createElement("canvas");o.width=n*t,o.height=i*t,o.style.width=`${n}px`,o.style.height=`${i}px`;const a=o.getContext("2d");return a&&(a.scale(t,t),a.translate(-e,-r),this.drawTo(a)),o}clone(){return new this.constructor().copy(this)}}const fr="px",bn=90,xn=["mm","cm","in","pt","pc","px"],pr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function $(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=xn.length;r<n;r++){const i=xn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&fr!=="px"?e=pr.in[fr]/bn:(e=pr[t][fr],e<0&&(e=pr[t].in*bn)),e*Number.parseFloat(s)}const Oo=new vt,Le=new vt,_n=new vt,Sn=new vt;function To(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Ao(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ao(s){const t=new vt,e=Oo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate($(s.getAttribute("x")),$(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const o=i.indexOf("("),a=i.length;if(o>0&&o<a){const h=i.slice(0,o),l=Tt(i.slice(o+1));switch(e.identity(),h){case"translate":if(l.length>=1){const u=l[0];let c=0;l.length>=2&&(c=l[1]),e.translate(u,c)}break;case"rotate":if(l.length>=1){let u=0,c=0,d=0;u=l[0]*Math.PI/180,l.length>=3&&(c=l[1],d=l[2]),Le.makeTranslation(-c,-d),_n.makeRotation(u),Sn.multiplyMatrices(_n,Le),Le.makeTranslation(c,d),e.multiplyMatrices(Le,Sn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Io(s){return new bt().addPath(new me().arc($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("r")||0),0,Math.PI*2))}function Eo(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim());for(let i=0;i<n.length;i++){const o=Object.fromEntries(Object.entries(r.style).filter(([,a])=>a!==""));t[n[i]]=Object.assign(t[n[i]]||{},o)}}}function Uo(s){return new bt().addPath(new me().ellipse($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("rx")||0),$(s.getAttribute("ry")||0),0,0,Math.PI*2))}function $o(s){return new bt().moveTo($(s.getAttribute("x1")||0),$(s.getAttribute("y1")||0)).lineTo($(s.getAttribute("x2")||0),$(s.getAttribute("y2")||0))}function Do(s){const t=new bt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Lo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Bo(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Lo,(n,i,o)=>{const a=$(i),h=$(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Fo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function No(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Fo,(n,i,o)=>{const a=$(i),h=$(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ko(s){const t=$(s.getAttribute("x")||0),e=$(s.getAttribute("y")||0),r=$(s.getAttribute("rx")||s.getAttribute("ry")||0),n=$(s.getAttribute("ry")||s.getAttribute("rx")||0),i=$(s.getAttribute("width")),o=$(s.getAttribute("height")),a=1-.551915024494,h=new bt;return h.moveTo(t+r,e),h.lineTo(t+i-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),h.lineTo(t+i,e+o-n),(r!==0||n!==0)&&h.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),h.lineTo(t+r,e+o),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function At(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<h.length;l++)r=Object.assign(r,e[`.${h[l]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));function n(h,l,u){u===void 0&&(u=function(d){return d.startsWith("url")&&console.warn("url access in attributes is not implemented."),d}),s.hasAttribute(h)&&(t[l]=u(s.getAttribute(h))),r[h]&&(t[l]=u(r[h])),s.style&&s.style[h]!==""&&(t[l]=u(s.style[h]))}function i(h){return Math.max(0,Math.min(1,$(h)))}function o(h){return Math.max(0,$(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>$(l))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",o),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",o),n("stroke-dasharray","strokeDasharray",a),n("stroke-dashoffset","strokeDashoffset",$),n("visibility","visibility"),t}function dr(s,t,e=[]){var u;if(s.nodeType!==1)return e;let r=!1,n=null;const i={};switch(s.nodeName){case"svg":t=At(s,t,i);break;case"style":Eo(s,i);break;case"g":t=At(s,t,i);break;case"path":t=At(s,t,i),s.hasAttribute("d")&&(n=Do(s));break;case"rect":t=At(s,t,i),n=ko(s);break;case"polygon":t=At(s,t,i),n=Bo(s);break;case"polyline":t=At(s,t,i),n=No(s);break;case"circle":t=At(s,t,i),n=Io(s);break;case"ellipse":t=At(s,t,i),n=Uo(s);break;case"line":t=At(s,t,i),n=$o(s);break;case"defs":r=!0;break;case"use":{t=At(s,t,i);const d=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),m=(u=s.viewportElement)==null?void 0:u.getElementById(d);m?dr(m,t,e):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(s);break}const o=new vt,a=[],h=To(s,o,a);n&&(n.transform(o),e.push(n),n.style=t);const l=s.childNodes;for(let c=0,d=l.length;c<d;c++){const m=l[c];r&&m.nodeName!=="style"&&m.nodeName!=="defs"||dr(m,t,e)}return h&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Pn="data:image/svg+xml;",Cn=`${Pn}base64,`,Mn=`${Pn}charset=utf8,`;function On(s){if(typeof s=="string"){let t;return s.startsWith(Cn)?(s=s.substring(Cn.length,s.length),t=atob(s)):s.startsWith(Mn)?(s=s.substring(Mn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Go(s){return dr(On(s),{})}function Be(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}function Tn(s,t){const{x:e,y:r}=s,n=Math.sin(t),i=Math.cos(t);return{x:e*i-r*n,y:e*n+r*i}}function gr(s,t,e,r){const n=s.x-t.x,i=s.y-t.y;return{x:t.x+(n+Math.tan(e)*i),y:t.y+(i+Math.tan(r)*n)}}function An(s,t,e,r){const n=e<0?t.x-s.x+t.x:s.x,i=r<0?t.y-s.y+t.y:s.y;return{x:n*Math.abs(e),y:i*Math.abs(r)}}function In(s,t,e=0,r=0,n=0,i=1,o=1){let a=Array.isArray(s)?s:[s];const h=-e/180*Math.PI,{x:l,y:u}=t;return(i!==1||o!==1)&&(a=a.map(c=>An(c,t,i,o))),(r||n)&&(a=a.map(c=>gr(c,t,r,n))),a=a.map(c=>{const d=c.x-l,m=-(c.y-u);return c=Tn({x:d,y:m},h),{x:l+c.x,y:u-c.y}}),a[0]}const Ro=new Set(["©","®","÷"]),zo=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class En{constructor(t,e,r){F(this,"boundingBox",new z);F(this,"textWidth",0);F(this,"textHeight",0);F(this,"path",new bt);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=sn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Lt||t instanceof st)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:i,post:o}=t,{content:a,computedStyle:h,boundingBox:l,isVertical:u}=this,{left:c,top:d,height:m}=l,{fontSize:g}=h,w=e/g,f=t.getAdvanceWidth(a,g),P=(r+Math.abs(n))/w,_=r/w,x=(r-i.yStrikeoutPosition)/w,O=i.yStrikeoutSize/w,v=(r-o.underlinePosition)/w,b=o.underlineThickness/w;return this.glyphWidth=f,this.glyphHeight=P,this.underlinePosition=v,this.underlineThickness=b,this.yStrikeoutPosition=x,this.yStrikeoutSize=O,this.baseline=_,this.centerDiviation=.5*m-_,this.glyphBox=u?new z(c,d,P,f):new z(c,d,f,P),this.centerPoint=this.glyphBox.getCenterPoint(),this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:r,textWidth:n,textHeight:i,boundingBox:o,computedStyle:a,baseline:h,glyphHeight:l,glyphWidth:u}=this.updateGlyph(t),{os2:c,ascender:d,descender:m}=t,g=d,w=m,f=c.sTypoAscender,{left:P,top:_}=o,{fontSize:x,fontStyle:O}=a;let v=P,b=_+h,A,C;if(e&&(v+=(l-u)/2,Math.abs(n-i)>.1&&(b-=(g-f)/(g+Math.abs(w))*l),A=void 0),e&&!Ro.has(r)&&(r.codePointAt(0)<=256||zo.has(r))){C=t.getPathCommands(r,v,_+h-(l-u)/2,x)??[];const L={y:_-(l-u)/2+l/2,x:v+u/2};O==="italic"&&(C=this._italic(C,e?{x:L.x,y:_-(l-u)/2+h}:void 0)),C=this._rotation90(C,L)}else A!==void 0?(C=t.glyphs.get(A).getPathCommands(v,b,x),O==="italic"&&(C=this._italic(C,e?{x:v+u/2,y:_+f/(g+Math.abs(w))*l}:void 0))):(C=t.getPathCommands(r,v,b,x)??[],O==="italic"&&(C=this._italic(C,e?{x:v+l/2,y:b}:void 0)));C.push(...this._decoration());const M=new bt(C);return M.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*x*.03:0},this.path=M,this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:i}=this.computedStyle,{left:o,top:a,width:h,height:l}=this.boundingBox,u=.1*i;let c;switch(n){case"underline":t?c=o:c=a+e;break;case"line-through":t?c=o+h/2:c=a+r;break;case"none":default:return[]}return t?[{type:"M",x:c,y:a},{type:"L",x:c,y:a+l},{type:"L",x:c+u,y:a+l},{type:"L",x:c+u,y:a},{type:"Z"}]:[{type:"M",x:o,y:c},{type:"L",x:o+h,y:c},{type:"L",x:o+h,y:c+u},{type:"L",x:o,y:c+u},{type:"Z"}]}_italic(t,e){const{baseline:r,glyphWidth:n}=this,{left:i,top:o}=this.boundingBox,a=e||{y:o+r,x:i+n/2};return this._transform(t,(h,l)=>{const u=gr({x:h,y:l},a,-.24,0);return[u.x,u.y]})}_rotation90(t,e){return this._transform(t,(r,n)=>{const i=In({x:r,y:n},e,90);return[i.x,i.y]})}_transform(t,e){return t.map(r=>{const n={...r};switch(n.type){case"L":case"M":[n.x,n.y]=e(n.x,n.y);break;case"Q":[n.x1,n.y1]=e(n.x1,n.y1),[n.x,n.y]=e(n.x,n.y);break;case"C":[n.x1,n.y1]=e(n.x1,n.y1),[n.x2,n.y2]=e(n.x2,n.y2),[n.x,n.y]=e(n.x,n.y);break}return n})}getMinMax(t,e){return this.path.getMinMax(t,e)}getBoundingBox(){return this.path.getBoundingBox()}drawTo(t,e={}){Fe({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class Un{constructor(t,e={},r){F(this,"boundingBox",new z);F(this,"highlight");this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Be(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new En(r,e++,this));return this.characters=t,this}}class Jt{constructor(t,e){F(this,"boundingBox",new z);F(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Be(this.parentStyle),...Be(this.style)},this}addFragment(t,e){const r=new Un(t,e,this);return this.fragments.push(r),r}}class Wt{constructor(t){this._text=t}}class $n extends Wt{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class Dn extends Wt{getBoundingBox(){const{characters:t,effects:e}=this._text,r=[];return t.forEach(n=>{const i=n.computedStyle.fontSize;e==null||e.forEach(o=>{const a=(o.offsetX??0)*i,h=(o.offsetY??0)*i,l=(o.shadowOffsetX??0)*i,u=(o.shadowOffsetY??0)*i,c=Math.max(.1,o.textStrokeWidth??0)*i,d=n.boundingBox.clone();d.left+=a+l-c,d.top+=h+u-c,d.width+=c*2,d.height+=c*2,r.push(d)})}),z.from(...r)}draw(t){const{ctx:e}=t,{effects:r,characters:n,boundingBox:i}=this._text;return r&&(r.forEach(o=>{Ct(o,i,e)}),n.forEach(o=>{r.forEach(a=>{o.drawTo(e,a)})})),this}}class Ln extends Wt{constructor(){super(...arguments);F(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new z;const e=S.MAX,r=S.MIN;return this.paths.forEach(n=>n.path.getMinMax(e,r)),new z(e.x,e.y,r.x-e.x,r.y-e.y)}highlight(){const{characters:e}=this._text;let r;const n=[];let i;e.forEach(o=>{const a=o.parent.highlight;a!=null&&a.url&&((i==null?void 0:i.url)===a.url&&r.length&&r[0].boundingBox.top===o.boundingBox.top&&r[0].fontSize===o.fontSize?r.push(o):(r=[],r.push(o),n.push(r))),i=a}),this.paths=n.filter(o=>o.length).map(o=>({url:o[0].parent.highlight.url,box:z.from(...o.map(a=>a.boundingBox)),baseline:Math.max(...o.map(a=>a.baseline)),fontSize:o[0].fontSize})).map(o=>this._parseGroup(o)).flat()}_parseSvg(e){const r=On(e),n=Go(r),i=S.MAX,o=S.MIN;return n.forEach(a=>a.getMinMax(i,o)),{paths:n,box:new z(i.x,i.y,o.x-i.x,o.y-i.y),viewBox:new z(...r.getAttribute("viewBox").split(" ").map(Number))}}_parseGroup(e){const{url:r,box:n,baseline:i,fontSize:o}=e,{box:a,viewBox:h,paths:l}=this._parseSvg(r),u=h.top+h.height/2,c=[],d=u>a.top?0:1;function m(g,w){g.style.strokeWidth&&(g.style.strokeWidth*=w),g.style.strokeMiterlimit&&(g.style.strokeMiterlimit*=w),g.style.strokeDashoffset&&(g.style.strokeDashoffset*=w),g.style.strokeDasharray&&(g.style.strokeDasharray=g.style.strokeDasharray.map(f=>f*w))}if(d===0){const g={x:n.left-o*.2,y:n.top},w=(n.width+o*.2*2)/a.width,f=n.height/a.height,P=new vt().translate(-a.x,-a.y).scale(w,f).translate(g.x,g.y);l.forEach(_=>{const x=_.clone().transform(P);m(x,w),c.push({path:x})})}else if(d===1){const g=o/a.width,w=a.width*g,f=Math.ceil(n.width/w),P={x:n.left,y:n.top+i+o*.1},_=new vt().translate(-a.x,-a.y).scale(g,g).translate(P.x,P.y);for(let x=0;x<f;x++){const O=_.clone().translate(x*w,0);l.forEach(v=>{const b=v.clone().transform(O);m(b,g),c.push({clipRect:n,path:b})})}}return c}draw({ctx:e}){return this.paths.forEach(r=>{Fe({ctx:e,path:r.path,clipRect:r.clipRect,fontSize:this._text.computedStyle.fontSize})}),this}}class Bn extends Wt{_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const i=document.createElement("ul");return Object.assign(i.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),a.appendChild(l)}),i.appendChild(a)}),n.appendChild(i),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((i,o)=>{const a=i.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll("span").forEach((h,l)=>{var d;const u=i.getBoundingClientRect();r.push({paragraphIndex:o,fragmentIndex:l,left:u.left,top:u.top,width:u.width,height:u.height});const c=h.firstChild;if(c instanceof window.Text){const m=document.createRange();m.selectNodeContents(c);const g=c.data?c.data.length:0;let w=0;for(;w<=g;){m.setStart(c,Math.max(w-1,0)),m.setEnd(c,w);const f=((d=m.getClientRects)==null?void 0:d.call(m))??[m.getBoundingClientRect()];let P=f[f.length-1];f.length>1&&P.width<2&&(P=f[f.length-2]);const _=m.toString();_!==""&&P&&P.width+P.height!==0&&n.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:P.top,left:P.left,height:P.height,width:P.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=t.querySelector("ul"),i=window.getComputedStyle(t).writingMode.includes("vertical"),o=n.style.lineHeight;n.style.lineHeight="4000px";const a=[[]];let h=a[0];const{characters:l}=this._measureDom(t);l.length>0&&(h.push(l[0]),l.reduce((m,g)=>{const w=i?"left":"top";return Math.abs(g[w]-m[w])>4e3/2&&(h=[],a.push(h)),h.push(g),g})),n.style.lineHeight=o;const u=this._measureDom(t);u.paragraphs.forEach(m=>{const g=e[m.paragraphIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height}),u.fragments.forEach(m=>{const g=e[m.paragraphIndex].fragments[m.fragmentIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height});const c=[];let d=0;return a.forEach(m=>{m.forEach(g=>{const w=u.characters[d],{paragraphIndex:f,fragmentIndex:P,characterIndex:_}=w;c.push({...w,newParagraphIndex:f,textWidth:g.width,textHeight:g.height,left:w.left-r.left,top:w.top-r.top});const x=e[f].fragments[P].characters[_];x.boundingBox.left=c[d].left,x.boundingBox.top=c[d].top,x.boundingBox.width=c[d].width,x.boundingBox.height=c[d].height,x.textWidth=c[d].textWidth,x.textHeight=c[d].textHeight,d++})}),{paragraphs:e,boundingBox:new z(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Fn extends Wt{parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new Jt({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const i=new Jt({},e);i.addFragment(n),r.push(i)}else if(Array.isArray(n)){const i=new Jt({},e);n.forEach(o=>{if(typeof o=="string")i.addFragment(o);else{const{content:a,highlight:h,...l}=o;if(a!==void 0){const u=i.addFragment(a,l);u.highlight=h}}}),r.push(i)}else if("fragments"in n){const{fragments:i,...o}=n,a=new Jt(o,e);i.forEach(h=>{const{content:l,highlight:u,...c}=h;if(l!==void 0){const d=a.addFragment(l,c);d.highlight=u}}),r.push(a)}else if("content"in n){const{content:i,highlight:o,...a}=n;if(i!==void 0){const h=new Jt(a,e),l=h.addFragment(i);l.highlight=o,r.push(h)}}}return r}}class qo extends Wt{}class Nn extends Wt{setupView(t){const{ctx:e,pixelRatio:r}=t,{renderBoundingBox:n}=this._text,{left:i,top:o,width:a,height:h}=n,l=e.canvas;return l.dataset.viewbox=`${i} ${o} ${a} ${h}`,l.dataset.pixelRatio=String(r),l.width=Math.max(1,Math.ceil(a*r)),l.height=Math.max(1,Math.ceil(h*r)),l.style.marginTop=`${o}px`,l.style.marginLeft=`${i}px`,l.style.width=`${a}px`,l.style.height=`${h}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(r,r),e.translate(-i,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:r,computedStyle:n,renderBoundingBox:i}=this._text,{width:o,height:a}=i;return Ct(n,new z(0,0,o,a),e),r.forEach(h=>{Ct(h.computedStyle,h.boundingBox,e),h.fragments.forEach(l=>{Ct(l.computedStyle,l.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:r,paragraphs:n}=this._text;function i(o,a,h,l,u){e.fillStyle=o,e.fillRect(a,h,l,u)}return r!=null&&r.backgroundColor&&i(r.backgroundColor,0,0,e.canvas.width,e.canvas.height),n.forEach(o=>{var a;(a=o.style)!=null&&a.backgroundColor&&i(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(h=>{var l;(l=h.style)!=null&&l.backgroundColor&&i(h.computedStyle.backgroundColor,...h.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:r}=this._text;return r.forEach(n=>{n.drawTo(e)}),this}}const mr={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class Vo{constructor(t={}){F(this,"content");F(this,"style");F(this,"effects");F(this,"deformation");F(this,"measureDom");F(this,"needsUpdate",!0);F(this,"computedStyle",{...mr});F(this,"paragraphs",[]);F(this,"boundingBox",new z);F(this,"renderBoundingBox",new z);F(this,"parser",new Fn(this));F(this,"measurer",new Bn(this));F(this,"deformer",new $n(this));F(this,"effector",new Dn(this));F(this,"highlighter",new Ln(this));F(this,"renderer2D",new Nn(this));const{content:e="",style:r={},effects:n,deformation:i,measureDom:o}=t;this.content=e,this.style=r,this.effects=n,this.deformation=i,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...mr,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);return this.paragraphs=e,r}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const r=this.characters;r.forEach(o=>o.update()),this.highlighter.highlight(),this.deformation&&this.deformer.deform();const n=S.MAX,i=S.MIN;return r.forEach(o=>o.getMinMax(n,i)),this.renderBoundingBox=new z(n.x,n.y,i.x-n.x,i.y-n.y),this}render(t){var i,o;const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),(i=this.effects)!=null&&i.length?this.renderBoundingBox=z.from(this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()):this.renderBoundingBox=z.from(this.renderBoundingBox,this.highlighter.getBoundingBox()),this.renderer2D.setupView({pixelRatio:r,ctx:n}),this.renderer2D.uploadColors({ctx:n}),this.highlighter.draw({ctx:n}),(o=this.effects)!=null&&o.length?this.effector.draw({ctx:n}):this.renderer2D.draw({ctx:n}),this):this}}p.Character=En,p.CmapSubtableFormat0=Je,p.CmapSubtableFormat12=nr,p.CmapSubtableFormat14=ue,p.CmapSubtableFormat2=le,p.CmapSubtableFormat4=rr,p.CmapSubtableFormat6=zt,p.Deformer=$n,p.Effector=Dn,p.Eot=ws,p.Font=_e,p.Fonts=nn,p.Fragment=Un,p.Glyph=je,p.GlyphSet=Ye,p.Highlighter=Ln,p.Measurer=Bn,p.Paragraph=Jt,p.Parser=Fn,p.Reflector=qo,p.Renderer2D=Nn,p.Sfnt=ie,p.TableDirectory=Yt,p.Text=Vo,p.Ttf=st,p.Woff=Lt,p.WoffTableDirectoryEntry=Vt,p.componentFlags=Zt,p.createCmapSegments=er,p.defaultTextStyles=mr,p.defineSfntTable=nt,p.drawPath=Fe,p.filterEmpty=Be,p.fonts=sn,p.getPointPosition=In,p.getRotationPoint=Tn,p.getScalePoint=An,p.getSkewPoint=gr,p.minify=Vi,p.minifyGlyphs=on,p.minifySfnt=an,p.parse=en,p.parseColor=it,p.uploadColor=Ct,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -264,7 +264,7 @@ class Character {
|
|
|
264
264
|
commands = this._rotation90(commands, point);
|
|
265
265
|
} else {
|
|
266
266
|
if (glyphIndex !== void 0) {
|
|
267
|
-
commands = font.
|
|
267
|
+
commands = font.glyphs.get(glyphIndex).getPathCommands(x, y, fontSize);
|
|
268
268
|
if (fontStyle === "italic") {
|
|
269
269
|
commands = this._italic(
|
|
270
270
|
commands,
|
|
@@ -371,6 +371,11 @@ class Character {
|
|
|
371
371
|
[cmd.x1, cmd.y1] = cb(cmd.x1, cmd.y1);
|
|
372
372
|
[cmd.x, cmd.y] = cb(cmd.x, cmd.y);
|
|
373
373
|
break;
|
|
374
|
+
case "C":
|
|
375
|
+
[cmd.x1, cmd.y1] = cb(cmd.x1, cmd.y1);
|
|
376
|
+
[cmd.x2, cmd.y2] = cb(cmd.x2, cmd.y2);
|
|
377
|
+
[cmd.x, cmd.y] = cb(cmd.x, cmd.y);
|
|
378
|
+
break;
|
|
374
379
|
}
|
|
375
380
|
return cmd;
|
|
376
381
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.15",
|
|
5
5
|
"packageManager": "pnpm@9.9.0",
|
|
6
6
|
"description": "Measure and render text in a way that describes the DOM.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"prepare": "simple-git-hooks"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"modern-font": "^0.
|
|
60
|
+
"modern-font": "^0.2.0",
|
|
61
61
|
"modern-path2d": "^0.1.16"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|