modern-text 0.5.2 → 0.5.3
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 +1 -2
- package/dist/index.js +3 -3
- package/dist/index.mjs +1 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -769,12 +769,11 @@ function highlight() {
|
|
|
769
769
|
line = "underline";
|
|
770
770
|
const viewBox = svgDom.getAttribute("viewBox");
|
|
771
771
|
if (viewBox) {
|
|
772
|
-
const aCenter = aBox.y + aBox.height / 2;
|
|
773
772
|
const [_x, y, _w, h] = viewBox.split(" ").map((v) => Number(v));
|
|
774
773
|
const viewCenter = y + h / 2;
|
|
775
774
|
if (aBox.y < viewCenter && aBox.y + aBox.height > viewCenter) {
|
|
776
775
|
line = "line-through";
|
|
777
|
-
} else if (
|
|
776
|
+
} else if (aBox.y + aBox.height < viewCenter) {
|
|
778
777
|
line = "overline";
|
|
779
778
|
} else {
|
|
780
779
|
line = "underline";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(F,lt){typeof exports=="object"&&typeof module<"u"?lt(exports):typeof define=="function"&&define.amd?define(["exports"],lt):(F=typeof globalThis<"u"?globalThis:F||self,lt(F.modernText={}))})(this,function(F){"use strict";var da=Object.defineProperty;var ga=(F,lt,$t)=>lt in F?da(F,lt,{enumerable:!0,configurable:!0,writable:!0,value:$t}):F[lt]=$t;var $=(F,lt,$t)=>ga(F,typeof lt!="symbol"?lt+"":lt,$t);function lt(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:i,stops:a}=hs(t,e.left,e.top,e.width,e.height),l=s.createLinearGradient(r,n,o,i);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function $t(s,t,e){s!=null&&s.color&&(s.color=lt(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=lt(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=lt(e,s.textStrokeColor,t))}function hs(s,t,e,r,n){var d;const o=((d=s.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",i=o.split(",")[0],a=i.includes("deg")?i:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),f=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+f,x1:t+r/2+u,y1:e+n/2-f,stops:Array.from(l).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 Jt(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const o=e.style,i={...o,fill:s.color??o.fill,stroke:s.textStrokeColor??o.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,i),t.restore()}function Dr(s,t,e){const{left:r,top:n,width:o,height:i}=e,a=s.canvas;a.dataset.viewBox=`${r} ${n} ${o} ${i}`,a.dataset.pixelRatio=String(t);const l=o,h=i;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(h*t)),a.style.width=`${l}px`,a.style.height=`${h}px`,s.clearRect(0,0,a.width,a.height),s.scale(t,t),s.translate(-r,-n)}function Ur(s,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;$t(r,n,s),e.forEach(o=>{$t(o.computedStyle,o.lineBox,s),o.fragments.forEach(i=>{$t(i.computedStyle,i.inlineBox,s)})})}var ht=Uint8Array,Ct=Uint16Array,Ke=Int32Array,Oe=new ht([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]),Ae=new ht([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]),Qe=new ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Er=function(s,t){for(var e=new Ct(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new Ke(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)n[o]=o-e[r]<<5|r;return{b:e,r:n}},kr=Er(Oe,2),Lr=kr.b,Je=kr.r;Lr[28]=258,Je[258]=28;for(var Fr=Er(Ae,0),cs=Fr.b,Nr=Fr.r,tr=new Ct(32768),j=0;j<32768;++j){var qt=(j&43690)>>1|(j&21845)<<1;qt=(qt&52428)>>2|(qt&13107)<<2,qt=(qt&61680)>>4|(qt&3855)<<4,tr[j]=((qt&65280)>>8|(qt&255)<<8)>>1}for(var Bt=function(s,t,e){for(var r=s.length,n=0,o=new Ct(t);n<r;++n)s[n]&&++o[s[n]-1];var i=new Ct(t);for(n=1;n<t;++n)i[n]=i[n-1]+o[n-1]<<1;var a;if(e){a=new Ct(1<<t);var l=15-t;for(n=0;n<r;++n)if(s[n])for(var h=n<<4|s[n],c=t-s[n],u=i[s[n]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[tr[u]>>l]=h}else for(a=new Ct(r),n=0;n<r;++n)s[n]&&(a[n]=tr[i[s[n]-1]++]>>15-s[n]);return a},Gt=new ht(288),j=0;j<144;++j)Gt[j]=8;for(var j=144;j<256;++j)Gt[j]=9;for(var j=256;j<280;++j)Gt[j]=7;for(var j=280;j<288;++j)Gt[j]=8;for(var he=new ht(32),j=0;j<32;++j)he[j]=5;var us=Bt(Gt,9,0),fs=Bt(Gt,9,1),ps=Bt(he,5,0),ds=Bt(he,5,1),er=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},Tt=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},rr=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},nr=function(s){return(s+7)/8|0},zr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ht(s.subarray(t,e))},gs=["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"],Ot=function(s,t,e){var r=new Error(t||gs[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,Ot),!e)throw r;return r},ys=function(s,t,e,r){var n=s.length,o=0;if(!n||t.f&&!t.l)return e||new ht(0);var i=!e,a=i||t.i!=2,l=t.i;i&&(e=new ht(n*3));var h=function(kt){var Lt=e.length;if(kt>Lt){var zt=new ht(Math.max(Lt*2,kt));zt.set(e),e=zt}},c=t.f||0,u=t.p||0,f=t.b||0,d=t.l,g=t.d,m=t.m,p=t.n,S=n*8;do{if(!d){c=Tt(s,u,1);var P=Tt(s,u+1,3);if(u+=3,P)if(P==1)d=fs,g=ds,m=9,p=5;else if(P==2){var w=Tt(s,u,31)+257,D=Tt(s,u+10,15)+4,_=w+Tt(s,u+5,31)+1;u+=14;for(var M=new ht(_),H=new ht(19),U=0;U<D;++U)H[Qe[U]]=Tt(s,u+U*3,7);u+=D*3;for(var q=er(H),I=(1<<q)-1,E=Bt(H,q,1),U=0;U<_;){var k=E[Tt(s,u,I)];u+=k&15;var C=k>>4;if(C<16)M[U++]=C;else{var W=0,B=0;for(C==16?(B=3+Tt(s,u,3),u+=2,W=M[U-1]):C==17?(B=3+Tt(s,u,7),u+=3):C==18&&(B=11+Tt(s,u,127),u+=7);B--;)M[U++]=W}}var N=M.subarray(0,w),z=M.subarray(w);m=er(N),p=er(z),d=Bt(N,m,1),g=Bt(z,p,1)}else Ot(1);else{var C=nr(u)+4,x=s[C-4]|s[C-3]<<8,v=C+x;if(v>n){l&&Ot(0);break}a&&h(f+x),e.set(s.subarray(C,v),f),t.b=f+=x,t.p=u=v*8,t.f=c;continue}if(u>S){l&&Ot(0);break}}a&&h(f+131072);for(var nt=(1<<m)-1,T=(1<<p)-1,Z=u;;Z=u){var W=d[rr(s,u)&nt],G=W>>4;if(u+=W&15,u>S){l&&Ot(0);break}if(W||Ot(2),G<256)e[f++]=G;else if(G==256){Z=u,d=null;break}else{var X=G-254;if(G>264){var U=G-257,L=Oe[U];X=Tt(s,u,(1<<L)-1)+Lr[U],u+=L}var J=g[rr(s,u)&T],K=J>>4;J||Ot(3),u+=J&15;var z=cs[K];if(K>3){var L=Ae[K];z+=rr(s,u)&(1<<L)-1,u+=L}if(u>S){l&&Ot(0);break}a&&h(f+131072);var st=f+X;if(f<z){var Kt=o-z,Qt=Math.min(z,st);for(Kt+f<0&&Ot(3);f<Qt;++f)e[f]=r[Kt+f]}for(;f<st;++f)e[f]=e[f-z]}}t.l=d,t.p=Z,t.b=f,t.f=c,d&&(c=1,t.m=m,t.d=g,t.n=p)}while(!c);return f!=e.length&&i?zr(e,0,f):e.subarray(0,f)},Nt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ce=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},sr=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,o=e.slice();if(!n)return{t:Wr,l:0};if(n==1){var i=new ht(e[0].s+1);return i[e[0].s]=1,{t:i,l:1}}e.sort(function(v,w){return v.f-w.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,c=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=e[e[h].f<e[u].f?h++:u++],l=e[h!=c&&e[h].f<e[u].f?h++:u++],e[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=o[0].s,r=1;r<n;++r)o[r].s>f&&(f=o[r].s);var d=new Ct(f+1),g=ir(e[c-1],d,0);if(g>t){var r=0,m=0,p=g-t,S=1<<p;for(o.sort(function(w,D){return d[D.s]-d[w.s]||w.f-D.f});r<n;++r){var P=o[r].s;if(d[P]>t)m+=S-(1<<g-d[P]),d[P]=t;else break}for(m>>=p;m>0;){var C=o[r].s;d[C]<t?m-=1<<t-d[C]++-1:++r}for(;r>=0&&m;--r){var x=o[r].s;d[x]==t&&(--d[x],++m)}g=t}return{t:new ht(d),l:g}},ir=function(s,t,e){return s.s==-1?Math.max(ir(s.l,t,e+1),ir(s.r,t,e+1)):t[s.s]=e},qr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new Ct(++t),r=0,n=s[0],o=1,i=function(l){e[r++]=l},a=1;a<=t;++a)if(s[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(n),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(n);o=1,n=s[a]}return{c:e.subarray(0,r),n:t}},ue=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Gr=function(s,t,e){var r=e.length,n=nr(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 o=0;o<r;++o)s[n+o+4]=e[o];return(n+4+r)*8},Rr=function(s,t,e,r,n,o,i,a,l,h,c){Nt(t,c++,e),++n[256];for(var u=sr(n,15),f=u.t,d=u.l,g=sr(o,15),m=g.t,p=g.l,S=qr(f),P=S.c,C=S.n,x=qr(m),v=x.c,w=x.n,D=new Ct(19),_=0;_<P.length;++_)++D[P[_]&31];for(var _=0;_<v.length;++_)++D[v[_]&31];for(var M=sr(D,7),H=M.t,U=M.l,q=19;q>4&&!H[Qe[q-1]];--q);var I=h+5<<3,E=ue(n,Gt)+ue(o,he)+i,k=ue(n,f)+ue(o,m)+i+14+3*q+ue(D,H)+2*D[16]+3*D[17]+7*D[18];if(l>=0&&I<=E&&I<=k)return Gr(t,c,s.subarray(l,l+h));var W,B,N,z;if(Nt(t,c,1+(k<E)),c+=2,k<E){W=Bt(f,d,0),B=f,N=Bt(m,p,0),z=m;var nt=Bt(H,U,0);Nt(t,c,C-257),Nt(t,c+5,w-1),Nt(t,c+10,q-4),c+=14;for(var _=0;_<q;++_)Nt(t,c+3*_,H[Qe[_]]);c+=3*q;for(var T=[P,v],Z=0;Z<2;++Z)for(var G=T[Z],_=0;_<G.length;++_){var X=G[_]&31;Nt(t,c,nt[X]),c+=H[X],X>15&&(Nt(t,c,G[_]>>5&127),c+=G[_]>>12)}}else W=us,B=Gt,N=ps,z=he;for(var _=0;_<a;++_){var L=r[_];if(L>255){var X=L>>18&31;ce(t,c,W[X+257]),c+=B[X+257],X>7&&(Nt(t,c,L>>23&31),c+=Oe[X]);var J=L&31;ce(t,c,N[J]),c+=z[J],J>3&&(ce(t,c,L>>5&8191),c+=Ae[J])}else ce(t,c,W[L]),c+=B[L]}return ce(t,c,W[256]),c+B[256]},ms=new Ke([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Wr=new ht(0),ws=function(s,t,e,r,n,o){var i=o.z||s.length,a=new ht(r+i+5*(1+Math.ceil(i/7e3))+n),l=a.subarray(r,a.length-n),h=o.l,c=(o.r||0)&7;if(t){c&&(l[0]=o.r>>3);for(var u=ms[t-1],f=u>>13,d=u&8191,g=(1<<e)-1,m=o.p||new Ct(32768),p=o.h||new Ct(g+1),S=Math.ceil(e/3),P=2*S,C=function(le){return(s[le]^s[le+1]<<S^s[le+2]<<P)&g},x=new Ke(25e3),v=new Ct(288),w=new Ct(32),D=0,_=0,M=o.i||0,H=0,U=o.w||0,q=0;M+2<i;++M){var I=C(M),E=M&32767,k=p[I];if(m[E]=k,p[I]=E,U<=M){var W=i-M;if((D>7e3||H>24576)&&(W>423||!h)){c=Rr(s,l,0,x,v,w,_,H,q,M-q,c),H=D=_=0,q=M;for(var B=0;B<286;++B)v[B]=0;for(var B=0;B<30;++B)w[B]=0}var N=2,z=0,nt=d,T=E-k&32767;if(W>2&&I==C(M-T))for(var Z=Math.min(f,W)-1,G=Math.min(32767,M),X=Math.min(258,W);T<=G&&--nt&&E!=k;){if(s[M+N]==s[M+N-T]){for(var L=0;L<X&&s[M+L]==s[M+L-T];++L);if(L>N){if(N=L,z=T,L>Z)break;for(var J=Math.min(T,L-2),K=0,B=0;B<J;++B){var st=M-T+B&32767,Kt=m[st],Qt=st-Kt&32767;Qt>K&&(K=Qt,k=st)}}}E=k,k=m[E],T+=E-k&32767}if(z){x[H++]=268435456|Je[N]<<18|Nr[z];var kt=Je[N]&31,Lt=Nr[z]&31;_+=Oe[kt]+Ae[Lt],++v[257+kt],++w[Lt],U=M+N,++D}else x[H++]=s[M],++v[s[M]]}}for(M=Math.max(M,U);M<i;++M)x[H++]=s[M],++v[s[M]];c=Rr(s,l,h,x,v,w,_,H,q,M-q,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=p,o.p=m,o.i=M,o.w=U)}else{for(var M=o.w||0;M<i+h;M+=65535){var zt=M+65535;zt>=i&&(l[c/8|0]=h,zt=i),c=Gr(l,c+1,s.subarray(M,zt))}o.i=i}return zr(a,0,r+nr(c)+n)},Vr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,o=e.length|0,i=0;i!=o;){for(var a=Math.min(i+2655,o);i<a;++i)n+=r+=e[i];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}}},vs=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),i=new ht(o.length+s.length);i.set(o),i.set(s,o.length),s=i,n.w=o.length}return ws(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)},Xr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},xs=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=Vr();n.p(t.dictionary),Xr(s,2,n.d())}},bs=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&Ot(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&Ot(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function Ss(s,t){t||(t={});var e=Vr();e.p(s);var r=vs(s,t,t.dictionary?6:2,4);return xs(r,t),Xr(r,r.length-4,e.d()),r}function Ps(s,t){return ys(s.subarray(bs(s,t),-4),{i:2},t,t)}var Cs=typeof TextDecoder<"u"&&new TextDecoder,_s=0;try{Cs.decode(Wr,{stream:!0}),_s=1}catch{}const Ms="modern-font";function fe(s,t){if(!s)throw new Error(`[${Ms}] ${t}`)}function Ts(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 te(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var jr=Object.defineProperty,Os=(s,t,e)=>t in s?jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ct=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&jr(t,e,n),n},As=(s,t,e)=>(Os(s,t+"",e),e);const Ie={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ut(){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 ot extends DataView{constructor(t,e,r,n){super(Ts(t),e,r),this.littleEndian=n,As(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/,i=>i.toUpperCase())}`,o=this[n](e,r);return this.cursor+=Ie[t],o}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 o=0,i=r.length;o<i;o++)n+=String.fromCharCode(r[o]);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 o=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,i=this[o](r,e,n);return this.cursor+=Ie[t.toLowerCase()],i}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,i;n<o;++n)i=t.charCodeAt(n)||0,i>127?this.writeUint16(i):this.writeUint8(i);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=te(t);r=n.byteLength;for(let o=0;o<r;++o)this.setUint8(e+o,n.getUint8(o))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}ct([ut()],ot.prototype,"readInt8"),ct([ut()],ot.prototype,"readInt16"),ct([ut()],ot.prototype,"readInt32"),ct([ut()],ot.prototype,"readUint8"),ct([ut()],ot.prototype,"readUint16"),ct([ut()],ot.prototype,"readUint32"),ct([ut()],ot.prototype,"readFloat32"),ct([ut()],ot.prototype,"readFloat64"),ct([ut()],ot.prototype,"writeInt8"),ct([ut()],ot.prototype,"writeInt16"),ct([ut()],ot.prototype,"writeInt32"),ct([ut()],ot.prototype,"writeUint8"),ct([ut()],ot.prototype,"writeUint16"),ct([ut()],ot.prototype,"writeUint32"),ct([ut()],ot.prototype,"writeFloat32"),ct([ut()],ot.prototype,"writeFloat64");var Is=Object.defineProperty,$s=(s,t,e)=>t in s?Is(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Bs=(s,t,e)=>($s(s,t+"",e),e);const Hr=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let i=Hr.get(n);i||(i={columns:[],byteLength:0},Hr.set(n,i));const a={...t,name:o,byteLength:e*Ie[r],offset:t.offset??i.columns.reduce((l,h)=>l+h.byteLength,0)};i.columns.push(a),i.byteLength=i.columns.reduce((l,h)=>l+Ie[h.type]*(h.size??1),0),Object.defineProperty(n.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Mt{constructor(t,e,r,n){Bs(this,"view"),this.view=new ot(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 $e(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 Us(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 Es(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 or extends Mt{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 Yr=Object.defineProperty,ks=(s,t,e)=>t in s?Yr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Yr(t,e,n),n},Zr=(s,t,e)=>(ks(s,typeof t!="symbol"?t+"":t,e),e);const wt=class ss extends or{constructor(){super(...arguments),Zr(this,"format","EmbeddedOpenType"),Zr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=$e(n.fontFamily||""),i=o.length,a=$e(n.fontStyle||""),l=a.length,h=$e(n.version||""),c=h.length,u=$e(n.fullName||""),f=u.length,d=86+i+4+l+4+c+4+f+2+t.view.byteLength,g=new ss(new ArrayBuffer(d),0,d,!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(i),g.view.writeBytes(o),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(f),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};mt([y("uint32")],wt.prototype,"EOTSize"),mt([y("uint32")],wt.prototype,"FontDataSize"),mt([y("uint32")],wt.prototype,"Version"),mt([y("uint32")],wt.prototype,"Flags"),mt([y({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),mt([y("uint8")],wt.prototype,"Charset"),mt([y("uint8")],wt.prototype,"Italic"),mt([y("uint32")],wt.prototype,"Weight"),mt([y("uint16")],wt.prototype,"fsType"),mt([y("uint16")],wt.prototype,"MagicNumber"),mt([y({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),mt([y({type:"uint8",size:8})],wt.prototype,"CodePageRange"),mt([y("uint32")],wt.prototype,"CheckSumAdjustment"),mt([y({type:"uint8",size:16})],wt.prototype,"Reserved"),mt([y("uint16")],wt.prototype,"Padding1");var Ls=Object.defineProperty,Be=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Ls(t,e,n),n};class pe extends Mt{constructor(t,e){super(t,e,16)}}Be([y({type:"char",size:4})],pe.prototype,"tag"),Be([y("uint32")],pe.prototype,"checkSum"),Be([y("uint32")],pe.prototype,"offset"),Be([y("uint32")],pe.prototype,"length");const ar=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Fs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Ns=Object.defineProperty,zs=(s,t,e)=>t in s?Ns(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,de=(s,t,e)=>(zs(s,typeof t!="symbol"?t+"":t,e),e);class Kr{constructor(t){de(this,"index"),de(this,"name"),de(this,"isComposite",!1),de(this,"components",[]),de(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,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},o){const i=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=i,yScale:l=i}=n,h=this.pathCommands,c=[];for(let u=0,f=h.length;u<f;u+=1){const d=h[u];d.type==="M"?c.push({type:"M",x:t+d.x*a,y:e+-d.y*l}):d.type==="L"?c.push({type:"L",x:t+d.x*a,y:e+-d.y*l}):d.type==="Q"?c.push({type:"Q",x1:t+d.x1*a,y1:e+-d.y1*l,x:t+d.x*a,y:e+-d.y*l}):d.type==="C"?c.push({type:"C",x1:t+d.x1*a,y1:e+-d.y1*l,x2:t+d.x2*a,y2:e+-d.y2*l,x:t+d.x*a,y:e+-d.y*l}):d.type==="Z"&&c.push({type:"Z"})}return c}}class qs extends Kr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:i,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,f,d,g;const m=[],p=[];let S=0,P=!1,C=!1,x=i,v=0,w=0;function D(E,k){m.push({type:"L",x:E,y:k})}function _(E,k,W,B,N,z){m.push({type:"C",x1:E,y1:k,x2:W,y2:B,x:N,y:z})}function M(E,k){C&&h!==2&&H(),C=!0,m.push({type:"M",x:E,y:k})}function H(){m.push({type:"Z"})}function U(E){m.push(...E)}function q(){p.length%2!==0&&!P&&(x=p.shift()+o),S+=p.length>>1,p.length=0,P=!0}function I(E){let k,W,B,N,z,nt,T,Z,G,X,L,J,K=0;for(;K<E.length;){let st=E[K++];switch(st){case 1:q();break;case 3:q();break;case 4:p.length>1&&!P&&(x=p.shift()+o,P=!0),w+=p.pop(),M(v,w);break;case 5:for(;p.length>0;)v+=p.shift(),w+=p.shift(),D(v,w);break;case 6:for(;p.length>0&&(v+=p.shift(),D(v,w),p.length!==0);)w+=p.shift(),D(v,w);break;case 7:for(;p.length>0&&(w+=p.shift(),D(v,w),p.length!==0);)v+=p.shift(),D(v,w);break;case 8:for(;p.length>0;)u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+p.shift(),_(u,f,d,g,v,w);break;case 10:z=p.pop()+l,nt=t.subrs[z],nt&&I(nt);break;case 11:return;case 12:switch(st=E[K],K+=1,st){case 35:u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),T=d+p.shift(),Z=g+p.shift(),G=T+p.shift(),X=Z+p.shift(),L=G+p.shift(),J=X+p.shift(),v=L+p.shift(),w=J+p.shift(),p.shift(),_(u,f,d,g,T,Z),_(G,X,L,J,v,w);break;case 34:u=v+p.shift(),f=w,d=u+p.shift(),g=f+p.shift(),T=d+p.shift(),Z=g,G=T+p.shift(),X=g,L=G+p.shift(),J=w,v=L+p.shift(),_(u,f,d,g,T,Z),_(G,X,L,J,v,w);break;case 36:u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),T=d+p.shift(),Z=g,G=T+p.shift(),X=g,L=G+p.shift(),J=X+p.shift(),v=L+p.shift(),_(u,f,d,g,T,Z),_(G,X,L,J,v,w);break;case 37:u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),T=d+p.shift(),Z=g+p.shift(),G=T+p.shift(),X=Z+p.shift(),L=G+p.shift(),J=X+p.shift(),Math.abs(L-v)>Math.abs(J-w)?v=L+p.shift():w=J+p.shift(),_(u,f,d,g,T,Z),_(G,X,L,J,v,w);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+st}`),p.length=0}break;case 14:if(p.length>=4){const Kt=ar[p.pop()],Qt=ar[p.pop()],kt=p.pop(),Lt=p.pop();if(Kt&&Qt){n.isComposite=!0,n.components=[];const zt=t.charset.indexOf(Kt),le=t.charset.indexOf(Qt);n.components.push({glyphIndex:le,dx:0,dy:0}),n.components.push({glyphIndex:zt,dx:Lt,dy:kt}),U(r.get(le).pathCommands);const Ir=JSON.parse(JSON.stringify(r.get(zt).pathCommands));for(let $r=0;$r<Ir.length;$r+=1){const Ft=Ir[$r];Ft.type!=="Z"&&(Ft.x+=Lt,Ft.y+=kt),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Lt,Ft.y1+=kt),Ft.type==="C"&&(Ft.x2+=Lt,Ft.y2+=kt)}U(Ir)}}else p.length>0&&!P&&(x=p.shift()+o,P=!0);C&&h!==2&&(H(),C=!1);break;case 18:q();break;case 19:case 20:q(),K+=S+7>>3;break;case 21:p.length>2&&!P&&(x=p.shift()+o,P=!0),w+=p.pop(),v+=p.pop(),M(v,w);break;case 22:p.length>1&&!P&&(x=p.shift()+o,P=!0),v+=p.pop(),M(v,w);break;case 23:q();break;case 24:for(;p.length>2;)u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+p.shift(),_(u,f,d,g,v,w);v+=p.shift(),w+=p.shift(),D(v,w);break;case 25:for(;p.length>6;)v+=p.shift(),w+=p.shift(),D(v,w);u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+p.shift(),_(u,f,d,g,v,w);break;case 26:for(p.length%2&&(v+=p.shift());p.length>0;)u=v,f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d,w=g+p.shift(),_(u,f,d,g,v,w);break;case 27:for(p.length%2&&(w+=p.shift());p.length>0;)u=v+p.shift(),f=w,d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g,_(u,f,d,g,v,w);break;case 28:k=E[K],W=E[K+1],p.push((k<<24|W<<16)>>16),K+=2;break;case 29:z=p.pop()+a,nt=t.gsubrs[z],nt&&I(nt);break;case 30:for(;p.length>0&&(u=v,f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+(p.length===1?p.shift():0),_(u,f,d,g,v,w),p.length!==0);)u=v+p.shift(),f=w,d=u+p.shift(),g=f+p.shift(),w=g+p.shift(),v=d+(p.length===1?p.shift():0),_(u,f,d,g,v,w);break;case 31:for(;p.length>0&&(u=v+p.shift(),f=w,d=u+p.shift(),g=f+p.shift(),w=g+p.shift(),v=d+(p.length===1?p.shift():0),_(u,f,d,g,v,w),p.length!==0);)u=v,f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+(p.length===1?p.shift():0),_(u,f,d,g,v,w);break;default:st<32?console.warn(`Glyph ${c}: unknown operator ${st}`):st<247?p.push(st-139):st<251?(k=E[K],K+=1,p.push((st-247)*256+k+108)):st<255?(k=E[K],K+=1,p.push(-(st-251)*256-k-108)):(k=E[K],W=E[K+1],B=E[K+2],N=E[K+3],K+=4,p.push((k<<24|W<<16|B<<8|N)/65536))}}}I(e),this.pathCommands=m,P&&(this.advanceWidth=x)}}var Gs=Object.defineProperty,Rs=(s,t,e)=>t in s?Gs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ws=(s,t,e)=>(Rs(s,t+"",e),e);class Qr{constructor(t){this._sfnt=t,Ws(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 o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??(r.unicode=o[0]),r.unicodes??(r.unicodes=o)),this._items[t]=r}return r}}class Vs extends Qr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new qs({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Jr=Object.defineProperty,Xs=(s,t,e)=>t in s?Jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,tn=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Jr(t,e,n),n},De=(s,t,e)=>(Xs(s,typeof t!="symbol"?t+"":t,e),e);class Ue extends Mt{constructor(t,e,r,n){super(t,e,r,n),De(this,"_offsets"),De(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 o=0,i=e+1;o<i;o++){const a=this.view;let l=0;for(let h=0;h<r;h++)l<<=8,l+=a.readUint8();n.push(l)}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],i=r+e[t+1]-n;return this._isString?this.view.readString(n,i):this.view.readBytes(n,i)}}tn([y("uint16")],Ue.prototype,"count"),tn([y("uint8")],Ue.prototype,"offsetSize");class Ee extends Ue{constructor(){super(...arguments),De(this,"_isString",!1)}}class en extends Ue{constructor(){super(...arguments),De(this,"_isString",!0)}}const js=[".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"],Hs=[".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"],Ys=[".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"],Zs=[".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 ke(s,t){return t<=390?js[t]:s[t-391]}var Ks=Object.defineProperty,Qs=(s,t,e)=>t in s?Ks(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,rn=(s,t,e)=>(Qs(s,typeof t!="symbol"?t+"":t,e),e);function Y(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(i){this._setProp(o,i)},configurable:!0,enumerable:!0})}}class nn extends Mt{constructor(){super(...arguments),rn(this,"_dict"),rn(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 o=t.readUint8(),i=o>>4,a=o&15;if(i===r||(e+=n[i],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,i;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),o=e.readUint8(),i=e.readUint8(),r<<24|n<<16|o<<8|i;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 o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),n[o]=e,e=[]):e.push(this._readOperand(o))}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 ke(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Js=Object.defineProperty,lr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Js(t,e,n),n};class Le extends nn{}lr([Y(19)],Le.prototype,"subrs"),lr([Y(20)],Le.prototype,"defaultWidthX"),lr([Y(21)],Le.prototype,"nominalWidthX");var ti=Object.defineProperty,tt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ti(t,e,n),n};class Q extends nn{}tt([Y(0,"string")],Q.prototype,"version"),tt([Y(1,"string")],Q.prototype,"notice"),tt([Y(1200,"string")],Q.prototype,"copyright"),tt([Y(2,"string")],Q.prototype,"fullName"),tt([Y(3,"string")],Q.prototype,"familyName"),tt([Y(4,"string")],Q.prototype,"weight"),tt([Y(1201)],Q.prototype,"isFixedPitch"),tt([Y(1202)],Q.prototype,"italicAngle"),tt([Y(1203,"number",-100)],Q.prototype,"underlinePosition"),tt([Y(1204,"number",50)],Q.prototype,"underlineThickness"),tt([Y(1205)],Q.prototype,"paintType"),tt([Y(1206,"number",2)],Q.prototype,"charstringType"),tt([Y(1207,"number[]",[.001,0,0,.001,0,0])],Q.prototype,"fontMatrix"),tt([Y(13)],Q.prototype,"uniqueId"),tt([Y(5,"number[]",[0,0,0,0])],Q.prototype,"fontBBox"),tt([Y(1208)],Q.prototype,"strokeWidth"),tt([Y(14)],Q.prototype,"xuid"),tt([Y(15)],Q.prototype,"charset"),tt([Y(16)],Q.prototype,"encoding"),tt([Y(17)],Q.prototype,"charStrings"),tt([Y(18,"number[]",[0,0])],Q.prototype,"private");var ei=Object.defineProperty,ri=(s,t,e)=>t in s?ei(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,hr=(s,t,e)=>(ri(s,typeof t!="symbol"?t+"":t,e),e);function ft(s,t=s){return e=>{Fe.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(Fe.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const sn=class Te{constructor(t){hr(this,"tables",new Map),hr(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,o=Array.from({length:n}),i=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||i;return o}getPathCommands(t,e,r,n,o){const i=[];return this.forEachGlyph(t,e,r,n,o,(a,l,h,c,u)=>{i.push(...a.getPathCommands(l,h,c,u,this))}),i}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,o={},i){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];i.call(this,c,e,r,n,o),c.advanceWidth&&(e+=c.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*n:o.tracking&&(e+=o.tracking/1e3*n)}return e}clone(){return new Te(this.tableViews)}delete(t){const e=Te.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Te.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Te.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const o=this.tableViews.get(t);if(!o)return;r=new n(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};hr(sn,"tableDefinitions",new Map);let Fe=sn;class pt extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var on=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,si=(s,t,e)=>t in s?on(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(s,t,e,r)=>{for(var n=r>1?void 0:r?ni(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&on(t,e,n),n},cr=(s,t,e)=>(si(s,typeof t!="symbol"?t+"":t,e),e);let ee=class extends pt{constructor(s,t,e,r){super(s,t,e,r),cr(this,"_glyphs"),cr(this,"privateDict"),cr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Vs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var s;return((s=this.privateDict)==null?void 0:s.defaultWidthX)??0}get nominalWidthX(){var s;return((s=this.privateDict)==null?void 0:s.nominalWidthX)??0}get subrs(){var s;return((s=this.subrsIndex)==null?void 0:s.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const s=this.view,{buffer:t,byteOffset:e}=s,r=e+4;this.nameIndex=new en(t,r),this.topDictIndex=new Ee(t,this.nameIndex.endOffset),this.stringIndex=new en(t,this.topDictIndex.endOffset),this.globalSubrIndex=new Ee(t,this.stringIndex.endOffset),this.topDict=new Q(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const n=this.topDict.private[0],o=this.topDict.private[1];n&&(this.privateDict=new Le(t,e+o,n).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ee(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new Ee(t,e+this.topDict.charStrings);const i=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Hs:this.topDict.charset===1?this.charset=Ys:this.topDict.charset===2?this.charset=Zs:this.charset=this._readCharset(e+this.topDict.charset,i,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=ar:this.topDict.encoding===1?this.encoding=Fs:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(s,t,e){const r=this.view;r.seek(s);let n,o,i;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(n=0;n<t;n+=1)o=r.readUint16(),a.push(ke(e,o));else if(l===1)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint8(),n=0;n<=i;n+=1)a.push(ke(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint16(),n=0;n<=i;n+=1)a.push(ke(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(s){const t=this.view;t.seek(s);let e,r;const n={},o=t.readUint8();if(o===0){const i=t.readUint8();for(e=0;e<i;e+=1)r=t.readUint8(),n[r]=e}else if(o===1){const i=t.readUint8();for(r=1,e=0;e<i;e+=1){const a=t.readUint8(),l=t.readUint8();for(let h=a;h<=a+l;h+=1)n[h]=r,r+=1}}else console.warn(`unknown encoding format:${o}`);return n}_calcSubroutineBias(s){let t;return s.length<1240?t=107:s.length<33900?t=1131:t=32768,t}};ge([y("uint8")],ee.prototype,"majorVersion",2),ge([y("uint8")],ee.prototype,"minorVersion",2),ge([y("uint8")],ee.prototype,"headerSize",2),ge([y("uint8")],ee.prototype,"offsetSize",2),ee=ge([ft("CFF ","cff")],ee);var ii=Object.defineProperty,Ne=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ii(t,e,n),n};const ye=class is extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new is;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}};Ne([y("uint16")],ye.prototype,"format"),Ne([y("uint16")],ye.prototype,"length"),Ne([y("uint16")],ye.prototype,"language"),Ne([y({type:"uint8",size:256})],ye.prototype,"glyphIndexArray");let an=ye;var oi=Object.defineProperty,ur=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&oi(t,e,n),n};class ze extends Mt{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,o=this.subHeaders,i=this.glyphIndexArray,a=r.findIndex(h=>h===n);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<o[0].firstCode||h>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(h-o[0].firstCode)>=i.length?l=0:(l=i[o[0].idRangeOffset+(h-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(h,l);else{const c=r[h];for(let u=0,f=o[c].entryCount;u<f;u++)if(o[c].idRangeOffset+u>=i.length?l=0:(l=i[o[c].idRangeOffset+u],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<t){const d=(h<<8|u+o[c].firstCode)%65535;e.set(d,l)}}return e}}ur([y("uint16")],ze.prototype,"format"),ur([y("uint16")],ze.prototype,"length"),ur([y("uint16")],ze.prototype,"language");function ln(s){return s>32767?s-65536:s<-32767?s+65536:s}function hn(s,t){let e;const r=[];let n={};return s.forEach((o,i)=>{t&&i>t||((!e||i!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:i,startId:o,delta:ln(o-i)}):(n.start=Number(i),n.startId=o,n.delta=ln(o-i))),e={unicode:i,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var ai=Object.defineProperty,jt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ai(t,e,n),n};const Rt=class os extends Mt{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=hn(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,i=new os(new ArrayBuffer(24+e.length*8));return i.format=4,i.length=i.view.byteLength,i.language=0,i.segCountX2=r*2,i.searchRange=o,i.entrySelector=n,i.rangeShift=2*r-o,i.endCode=[...e.map(a=>a.end),65535],i.reservedPad=0,i.startCode=[...e.map(a=>a.start),65535],i.idDelta=[...e.map(a=>a.delta),1],i.idRangeOffset=Array.from({length:r},()=>0),i}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,i=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<e;++h)for(let c=n[h],u=o[h];c<=u;++c)if(i[h]===0)t.set(c,(c+a[h])%65536);else{const f=h+i[h]/2+(c-n[h])-r,d=l[f];d!==0?t.set(c,(d+a[h])%65536):t.set(c,0)}return t.delete(65535),t}};jt([y("uint16")],Rt.prototype,"format"),jt([y("uint16")],Rt.prototype,"length"),jt([y("uint16")],Rt.prototype,"language"),jt([y("uint16")],Rt.prototype,"segCountX2"),jt([y("uint16")],Rt.prototype,"searchRange"),jt([y("uint16")],Rt.prototype,"entrySelector"),jt([y("uint16")],Rt.prototype,"rangeShift");let cn=Rt;var li=Object.defineProperty,me=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&li(t,e,n),n};class re extends Mt{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}}me([y("uint16")],re.prototype,"format"),me([y("uint16")],re.prototype,"length"),me([y("uint16")],re.prototype,"language"),me([y("uint16")],re.prototype,"firstCode"),me([y("uint16")],re.prototype,"entryCount");var hi=Object.defineProperty,we=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&hi(t,e,n),n};const ne=class as extends Mt{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=hn(t),r=new as(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 o=e[r];let i=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,i++)}return t}};we([y("uint16")],ne.prototype,"format"),we([y("uint16")],ne.prototype,"reserved"),we([y("uint32")],ne.prototype,"length"),we([y("uint32")],ne.prototype,"language"),we([y("uint32")],ne.prototype,"nGroups");let un=ne;var ci=Object.defineProperty,fr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ci(t,e,n),n};class qe extends Mt{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:o}=e[r];o.forEach(i=>{t.set(i.unicodeValue,i.glyphID)})}return t}}fr([y("uint16")],qe.prototype,"format"),fr([y("uint32")],qe.prototype,"length"),fr([y("uint32")],qe.prototype,"numVarSelectorRecords");var fn=Object.defineProperty,ui=Object.getOwnPropertyDescriptor,fi=(s,t,e)=>t in s?fn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,pr=(s,t,e,r)=>{for(var n=r>1?void 0:r?ui(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&fn(t,e,n),n},pn=(s,t,e)=>(fi(s,typeof t!="symbol"?t+"":t,e),e);let ve=class extends pt{constructor(){super(...arguments),pn(this,"_unicodeToGlyphIndexMap"),pn(this,"_glyphIndexToUnicodesMap")}static from(s){const t=Array.from(s.keys()).some(c=>c>65535),e=cn.from(s),r=an.from(s),n=t?un.from(s):void 0,o=4+(n?32:24),i=o+e.view.byteLength,a=i+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:i},{platformID:3,platformSpecificID:1,offset:o},n&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),h=new ve(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+((n==null?void 0:n.view.byteLength)??0)));return h.numberSubtables=l.length,h.view.seek(4),l.forEach(c=>{h.view.writeUint16(c.platformID),h.view.writeUint16(c.platformSpecificID),h.view.writeUint32(c.offset)}),h.view.writeBytes(e.view,o),h.view.writeBytes(r.view,i),n&&h.view.writeBytes(n.view,a),h}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,n=e.length;r<n;r++){const o=e[r],i=t.get(o);s.has(i)?s.get(i).push(o):s.set(i,[o])}this._glyphIndexToUnicodesMap=s}return this._glyphIndexToUnicodesMap}readSubtables(){const s=this.numberSubtables;return this.view.seek(4),Array.from({length:s},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const e=this.view.readUint16();let r;switch(e){case 0:r=new an(this.view.buffer,t.offset);break;case 2:r=new ze(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new cn(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new re(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new un(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new qe(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){var i,a,l,h,c;const s=this.readSubtables(),t=(i=s.find(u=>u.format===0))==null?void 0:i.view,e=(a=s.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:a.view,r=(l=s.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:l.view,n=(h=s.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:h.view,o=(c=s.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:c.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(e==null?void 0:e.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}};pr([y("uint16")],ve.prototype,"version",2),pr([y("uint16")],ve.prototype,"numberSubtables",2),ve=pr([ft("cmap")],ve);class pi extends Kr{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const o=t[n];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return fe(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 o=t[n],i={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(i)}return r}_parseGlyphCoordinate(t,e,r,n,o){let i;return(e&n)>0?(i=t.view.readUint8(),e&o||(i=-i),i=r+i):(e&o)>0?i=r:i=r+t.view.readInt16(),i}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 m=0;m<n;m++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();fe(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;fe(u<2e4,`Bad numberOfCoordinates:${c}`);const f=[];let d,g=0;for(;g<u;)if(d=t.view.readUint8(),f.push(d),g++,d&8&&g<u){const m=t.view.readUint8();for(let p=0;p<m;p++)f.push(d),g++}if(fe(f.length===u,`Bad flags length: ${f.length}, numberOfCoordinates: ${u}`),a.length>0){const m=[];let p;if(u>0){for(let C=0;C<u;C+=1)d=f[C],p={},p.onCurve=!!(d&1),p.lastPointOfContour=a.includes(C),m.push(p);let S=0;for(let C=0;C<u;C+=1)d=f[C],p=m[C],p.x=this._parseGlyphCoordinate(t,d,S,2,16),S=p.x;let P=0;for(let C=0;C<u;C+=1)d=f[C],p=m[C],p.y=this._parseGlyphCoordinate(t,d,P,4,32),P=p.y}this.points=m}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){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),l=!!(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 l=this.components[a],h=r.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{fe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let f=h.points[l.matchedPoints[1]];const d={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};f=this._transformPoints([f],d)[0],d.dx=u.x-f.x,d.dy=u.y-f.y,c=this._transformPoints(h.points,d)}this.points=this.points.concat(c)}}const o=[],i=this._parseContours(this.points);for(let a=0,l=i.length;a<l;++a){const h=i[a];let c=h[h.length-1],u=h[0];c.onCurve?o.push({type:"M",x:c.x,y:c.y}):u.onCurve?o.push({type:"M",x:u.x,y:u.y}):o.push({type:"M",x:(c.x+u.x)*.5,y:(c.y+u.y)*.5});for(let f=0,d=h.length;f<d;++f)if(c=u,u=h[(f+1)%d],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let g=u;u.onCurve||(g={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:g.x,y:g.y})}o.push({type:"Z"})}this.pathCommands=o}}class di extends Qr{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new pi({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var dn=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,yi=(s,t,e)=>t in s?dn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mi=(s,t,e,r)=>{for(var n=r>1?void 0:r?gi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&dn(t,e,n),n},wi=(s,t,e)=>(yi(s,t+"",e),e);let dr=class extends pt{constructor(){super(...arguments),wi(this,"_glyphs")}static from(s){const t=s.reduce((r,n)=>r+n.byteLength,0),e=new dr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeBytes(r)}),e}get glyphs(){return this._glyphs??(this._glyphs=new di(this._sfnt))}};dr=mi([ft("glyf")],dr);var vi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,bi=(s,t,e,r)=>{for(var n=r>1?void 0:r?xi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&vi(t,e,n),n};let gn=class extends pt{};gn=bi([ft("GPOS","gpos")],gn);var Si=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,Ht=(s,t,e,r)=>{for(var n=r>1?void 0:r?Pi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Si(t,e,n),n};let Wt=class extends pt{};Ht([y("uint16")],Wt.prototype,"majorVersion",2),Ht([y("uint16")],Wt.prototype,"minorVersion",2),Ht([y("uint16")],Wt.prototype,"scriptListOffset",2),Ht([y("uint16")],Wt.prototype,"featureListOffset",2),Ht([y("uint16")],Wt.prototype,"lookupListOffset",2),Ht([y("uint16")],Wt.prototype,"featureVariationsOffset",2),Wt=Ht([ft("GSUB","gsub")],Wt);var Ci=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,it=(s,t,e,r)=>{for(var n=r>1?void 0:r?_i(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Ci(t,e,n),n};let rt=class extends pt{constructor(s=new ArrayBuffer(54),t){super(s,t,Math.min(54,s.byteLength-(t??0)))}};it([y("fixed")],rt.prototype,"version",2),it([y("fixed")],rt.prototype,"fontRevision",2),it([y("uint32")],rt.prototype,"checkSumAdjustment",2),it([y("uint32")],rt.prototype,"magickNumber",2),it([y("uint16")],rt.prototype,"flags",2),it([y("uint16")],rt.prototype,"unitsPerEm",2),it([y({type:"longDateTime"})],rt.prototype,"created",2),it([y({type:"longDateTime"})],rt.prototype,"modified",2),it([y("int16")],rt.prototype,"xMin",2),it([y("int16")],rt.prototype,"yMin",2),it([y("int16")],rt.prototype,"xMax",2),it([y("int16")],rt.prototype,"yMax",2),it([y("uint16")],rt.prototype,"macStyle",2),it([y("uint16")],rt.prototype,"lowestRecPPEM",2),it([y("int16")],rt.prototype,"fontDirectionHint",2),it([y("int16")],rt.prototype,"indexToLocFormat",2),it([y("int16")],rt.prototype,"glyphDataFormat",2),rt=it([ft("head")],rt);var Mi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,vt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ti(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Mi(t,e,n),n};let dt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};vt([y("fixed")],dt.prototype,"version",2),vt([y("int16")],dt.prototype,"ascent",2),vt([y("int16")],dt.prototype,"descent",2),vt([y("int16")],dt.prototype,"lineGap",2),vt([y("uint16")],dt.prototype,"advanceWidthMax",2),vt([y("int16")],dt.prototype,"minLeftSideBearing",2),vt([y("int16")],dt.prototype,"minRightSideBearing",2),vt([y("int16")],dt.prototype,"xMaxExtent",2),vt([y("int16")],dt.prototype,"caretSlopeRise",2),vt([y("int16")],dt.prototype,"caretSlopeRun",2),vt([y("int16")],dt.prototype,"caretOffset",2),vt([y({type:"int16",size:4})],dt.prototype,"reserved",2),vt([y("int16")],dt.prototype,"metricDataFormat",2),vt([y("uint16")],dt.prototype,"numOfLongHorMetrics",2),dt=vt([ft("hhea")],dt);var yn=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,Ai=(s,t,e)=>t in s?yn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ii=(s,t,e,r)=>{for(var n=r>1?void 0:r?Oi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&yn(t,e,n),n},$i=(s,t,e)=>(Ai(s,t+"",e),e);let gr=class extends pt{constructor(){super(...arguments),$i(this,"_metrics")}static from(s){const t=s.length*4,e=new gr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:s}).map((n,o)=>(o<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};gr=Ii([ft("hmtx")],gr);var Bi=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,Ui=(s,t,e,r)=>{for(var n=r>1?void 0:r?Di(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Bi(t,e,n),n};let mn=class extends pt{};mn=Ui([ft("kern","kern")],mn);var wn=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,ki=(s,t,e)=>t in s?wn(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?Ei(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&wn(t,e,n),n},Fi=(s,t,e)=>(ki(s,t+"",e),e);let yr=class extends pt{constructor(){super(...arguments),Fi(this,"_locations")}static from(s,t=1){const e=s.length*(t?4:2),r=new yr(new ArrayBuffer(e));return s.forEach(n=>{t?r.view.writeUint32(n):r.view.writeUint16(n/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:s}).map(()=>t?e.readUint32():e.readUint16()*2)}};yr=Li([ft("loca")],yr);var Ni=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,gt=(s,t,e,r)=>{for(var n=r>1?void 0:r?zi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Ni(t,e,n),n};let at=class extends pt{constructor(s=new ArrayBuffer(32),t){super(s,t,Math.min(32,s.byteLength-(t??0)))}};gt([y("fixed")],at.prototype,"version",2),gt([y("uint16")],at.prototype,"numGlyphs",2),gt([y("uint16")],at.prototype,"maxPoints",2),gt([y("uint16")],at.prototype,"maxContours",2),gt([y("uint16")],at.prototype,"maxComponentPoints",2),gt([y("uint16")],at.prototype,"maxComponentContours",2),gt([y("uint16")],at.prototype,"maxZones",2),gt([y("uint16")],at.prototype,"maxTwilightPoints",2),gt([y("uint16")],at.prototype,"maxStorage",2),gt([y("uint16")],at.prototype,"maxFunctionDefs",2),gt([y("uint16")],at.prototype,"maxInstructionDefs",2),gt([y("uint16")],at.prototype,"maxStackElements",2),gt([y("uint16")],at.prototype,"maxSizeOfInstructions",2),gt([y("uint16")],at.prototype,"maxComponentElements",2),gt([y("uint16")],at.prototype,"maxComponentDepth",2),at=gt([ft("maxp")],at);var vn=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,Gi=(s,t,e)=>t in s?vn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ge=(s,t,e,r)=>{for(var n=r>1?void 0:r?qi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&vn(t,e,n),n},Ri=(s,t,e)=>(Gi(s,t+"",e),e);const xn={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"},mr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Wi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},bn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let xe=class extends pt{constructor(){super(...arguments),Ri(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const s=this.count;this.view.seek(6);const t=[];for(let a=0;a<s;++a)t.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 e=this.stringOffset;for(let a=0;a<s;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let r=mr.Macintosh,n=Wi.Default,o=0;t.some(a=>a.platform===mr.Microsoft&&a.encoding===bn.UCS2&&a.language===1033)&&(r=mr.Microsoft,n=bn.UCS2,o=1033);const i={};for(let a=0;a<s;++a){const l=t[a];l.platform===r&&l.encoding===n&&l.language===o&&xn[l.nameId]&&(i[xn[l.nameId]]=o===0?Us(l.name):Es(l.name))}return i}};Ge([y("uint16")],xe.prototype,"format",2),Ge([y("uint16")],xe.prototype,"count",2),Ge([y("uint16")],xe.prototype,"stringOffset",2),xe=Ge([ft("name")],xe);var Vi=Object.defineProperty,Xi=Object.getOwnPropertyDescriptor,A=(s,t,e,r)=>{for(var n=r>1?void 0:r?Xi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Vi(t,e,n),n};let O=class extends pt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};A([y("uint16")],O.prototype,"version",2),A([y("int16")],O.prototype,"xAvgCharWidth",2),A([y("uint16")],O.prototype,"usWeightClass",2),A([y("uint16")],O.prototype,"usWidthClass",2),A([y("uint16")],O.prototype,"fsType",2),A([y("uint16")],O.prototype,"ySubscriptXSize",2),A([y("uint16")],O.prototype,"ySubscriptYSize",2),A([y("uint16")],O.prototype,"ySubscriptXOffset",2),A([y("uint16")],O.prototype,"ySubscriptYOffset",2),A([y("uint16")],O.prototype,"ySuperscriptXSize",2),A([y("uint16")],O.prototype,"ySuperscriptYSize",2),A([y("uint16")],O.prototype,"ySuperscriptXOffset",2),A([y("uint16")],O.prototype,"ySuperscriptYOffset",2),A([y("uint16")],O.prototype,"yStrikeoutSize",2),A([y("uint16")],O.prototype,"yStrikeoutPosition",2),A([y("uint16")],O.prototype,"sFamilyClass",2),A([y({type:"uint8"})],O.prototype,"bFamilyType",2),A([y({type:"uint8"})],O.prototype,"bSerifStyle",2),A([y({type:"uint8"})],O.prototype,"bWeight",2),A([y({type:"uint8"})],O.prototype,"bProportion",2),A([y({type:"uint8"})],O.prototype,"bContrast",2),A([y({type:"uint8"})],O.prototype,"bStrokeVariation",2),A([y({type:"uint8"})],O.prototype,"bArmStyle",2),A([y({type:"uint8"})],O.prototype,"bLetterform",2),A([y({type:"uint8"})],O.prototype,"bMidline",2),A([y({type:"uint8"})],O.prototype,"bXHeight",2),A([y({type:"uint8",size:16})],O.prototype,"ulUnicodeRange",2),A([y({type:"char",size:4})],O.prototype,"achVendID",2),A([y("uint16")],O.prototype,"fsSelection",2),A([y("uint16")],O.prototype,"usFirstCharIndex",2),A([y("uint16")],O.prototype,"usLastCharIndex",2),A([y("int16")],O.prototype,"sTypoAscender",2),A([y("int16")],O.prototype,"sTypoDescender",2),A([y("int16")],O.prototype,"sTypoLineGap",2),A([y("uint16")],O.prototype,"usWinAscent",2),A([y("uint16")],O.prototype,"usWinDescent",2),A([y({offset:72,type:"uint8",size:8})],O.prototype,"ulCodePageRange",2),A([y({offset:72,type:"int16"})],O.prototype,"sxHeight",2),A([y("int16")],O.prototype,"sCapHeight",2),A([y("uint16")],O.prototype,"usDefaultChar",2),A([y("uint16")],O.prototype,"usBreakChar",2),A([y("uint16")],O.prototype,"usMaxContext",2),O=A([ft("OS/2","os2")],O);var ji=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,Dt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Hi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&ji(t,e,n),n};let At=class extends pt{constructor(s=new ArrayBuffer(32),t,e){super(s,t,e)}};Dt([y("fixed")],At.prototype,"format",2),Dt([y("fixed")],At.prototype,"italicAngle",2),Dt([y("int16")],At.prototype,"underlinePosition",2),Dt([y("int16")],At.prototype,"underlineThickness",2),Dt([y("uint32")],At.prototype,"isFixedPitch",2),Dt([y("uint32")],At.prototype,"minMemType42",2),Dt([y("uint32")],At.prototype,"maxMemType42",2),Dt([y("uint32")],At.prototype,"minMemType1",2),Dt([y("uint32")],At.prototype,"maxMemType1",2),At=Dt([ft("post")],At);var Yi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,xt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Zi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Yi(t,e,n),n};let yt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};xt([y("fixed")],yt.prototype,"version",2),xt([y("int16")],yt.prototype,"vertTypoAscender",2),xt([y("int16")],yt.prototype,"vertTypoDescender",2),xt([y("int16")],yt.prototype,"vertTypoLineGap",2),xt([y("int16")],yt.prototype,"advanceHeightMax",2),xt([y("int16")],yt.prototype,"minTopSideBearing",2),xt([y("int16")],yt.prototype,"minBottomSideBearing",2),xt([y("int16")],yt.prototype,"yMaxExtent",2),xt([y("int16")],yt.prototype,"caretSlopeRise",2),xt([y("int16")],yt.prototype,"caretSlopeRun",2),xt([y("int16")],yt.prototype,"caretOffset",2),xt([y({type:"int16",size:4})],yt.prototype,"reserved",2),xt([y("int16")],yt.prototype,"metricDataFormat",2),xt([y("int16")],yt.prototype,"numOfLongVerMetrics",2),yt=xt([ft("vhea")],yt);var Sn=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Qi=(s,t,e)=>t in s?Sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ji=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ki(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Sn(t,e,n),n},to=(s,t,e)=>(Qi(s,t+"",e),e);let wr=class extends pt{constructor(){super(...arguments),to(this,"_metrics")}static from(s){const t=s.length*4,e=new wr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var n;const s=this._sfnt.maxp.numGlyphs,t=((n=this._sfnt.vhea)==null?void 0:n.numOfLongVerMetrics)??0,e=this.view;e.seek(0);let r=0;return Array.from({length:s}).map((o,i)=>(i<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};wr=Ji([ft("vmtx")],wr);var Pn=Object.defineProperty,eo=(s,t,e)=>t in s?Pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,be=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Pn(t,e,n),n},Re=(s,t,e)=>(eo(s,typeof t!="symbol"?t+"":t,e),e);class It extends or{constructor(){super(...arguments),Re(this,"format","TrueType"),Re(this,"mimeType","font/ttf"),Re(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(te(t).getUint32(0))}static checksum(t){const e=te(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let o=0,i=r/4;o<i;o+=4)o*4<r-4&&(n+=e.getUint32(o*4,!1));return n&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((u,f)=>u+e(f.byteLength),0),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const i=Math.log(2);o.searchRange=Math.floor(Math.log(r)/i)*16,o.entrySelector=Math.floor(o.searchRange/i),o.rangeShift=r*16-o.searchRange;let a=12+r*16,l=0;const h=o.getDirectories();t.tableViews.forEach((u,f)=>{const d=h[l++];d.tag=f,d.checkSum=this.checksum(u),d.offset=a,d.length=u.byteLength,o.view.writeBytes(u,a),a+=e(d.length)});const c=o.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new pe(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new Fe(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Re(It,"signature",new Set([65536,1953658213,1954115633])),be([y("uint32")],It.prototype,"scalerType"),be([y("uint16")],It.prototype,"numTables"),be([y("uint16")],It.prototype,"searchRange"),be([y("uint16")],It.prototype,"entrySelector"),be([y("uint16")],It.prototype,"rangeShift");var ro=Object.defineProperty,no=(s,t,e)=>t in s?ro(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vr=(s,t,e)=>(no(s,typeof t!="symbol"?t+"":t,e),e);class We extends It{constructor(){super(...arguments),vr(this,"format","OpenType"),vr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}vr(We,"signature",new Set([1330926671]));var so=Object.defineProperty,Se=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&so(t,e,n),n};class se extends Mt{constructor(t,e){super(t,e,20)}}Se([y({type:"char",size:4})],se.prototype,"tag"),Se([y("uint32")],se.prototype,"offset"),Se([y("uint32")],se.prototype,"compLength"),Se([y("uint32")],se.prototype,"origLength"),Se([y("uint32")],se.prototype,"origChecksum");var Cn=Object.defineProperty,io=(s,t,e)=>t in s?Cn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,_t=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Cn(t,e,n),n},Ve=(s,t,e)=>(io(s,typeof t!="symbol"?t+"":t,e),e);const bt=class Br extends or{constructor(){super(...arguments),Ve(this,"format","WOFF"),Ve(this,"mimeType","font/woff"),Ve(this,"_sfnt")}get subfontFormat(){return It.is(this.flavor)?"TrueType":We.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(te(t).getUint32(0))}static checkSum(t){const e=te(t),r=e.byteLength,n=Math.floor(r/4);let o=0,i=0;for(;i<n;)o+=e.getUint32(4*i++,!1);let a=r-n*4;if(a){let l=n*4;for(;a>0;)o+=e.getUint8(l)<<a*8,l++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,f)=>{const d=te(Ss(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:f,view:d.byteLength<u.byteLength?d:u,rawView:u})});const o=n.length,i=n.reduce((u,f)=>u+r(f.view.byteLength),0),a=new Br(new ArrayBuffer(44+20*o+i+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((u,f)=>u+r(f.rawView.byteLength),0);let l=44+o*20,h=0;const c=a.getDirectories();return n.forEach(u=>{const f=c[h++];f.tag=u.tag,f.offset=l,f.compLength=u.view.byteLength,f.origChecksum=Br.checkSum(u.rawView),f.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(f.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new se(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new Fe(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,i=e.origLength,a=n+o;return t[r]=o>=i?new DataView(this.view.buffer,n,o):new DataView(Ps(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Ve(bt,"signature",new Set([2001684038])),_t([y("uint32")],bt.prototype,"signature"),_t([y("uint32")],bt.prototype,"flavor"),_t([y("uint32")],bt.prototype,"length"),_t([y("uint16")],bt.prototype,"numTables"),_t([y("uint16")],bt.prototype,"reserved"),_t([y("uint32")],bt.prototype,"totalSfntSize"),_t([y("uint16")],bt.prototype,"majorVersion"),_t([y("uint16")],bt.prototype,"minorVersion"),_t([y("uint32")],bt.prototype,"metaOffset"),_t([y("uint32")],bt.prototype,"metaLength"),_t([y("uint32")],bt.prototype,"metaOrigLength"),_t([y("uint32")],bt.prototype,"privOffset"),_t([y("uint32")],bt.prototype,"privLength");let xr=bt;function oo(s,t=!0){if(It.is(s))return new It(s);if(We.is(s))return new We(s);if(xr.is(s))return new xr(s);if(t)throw new Error("Failed to parseFont")}var ao=Object.defineProperty,lo=(s,t,e)=>t in s?ao(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Pe=(s,t,e)=>(lo(s,typeof t!="symbol"?t+"":t,e),e);const _n=class ls{constructor(){Pe(this,"fallbackFont"),Pe(this,"loading",new Map),Pe(this,"loaded",new Map),Pe(this,"familyToUrl",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...ls.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 {
|
|
1
|
+
(function(F,lt){typeof exports=="object"&&typeof module<"u"?lt(exports):typeof define=="function"&&define.amd?define(["exports"],lt):(F=typeof globalThis<"u"?globalThis:F||self,lt(F.modernText={}))})(this,function(F){"use strict";var da=Object.defineProperty;var ga=(F,lt,$t)=>lt in F?da(F,lt,{enumerable:!0,configurable:!0,writable:!0,value:$t}):F[lt]=$t;var $=(F,lt,$t)=>ga(F,typeof lt!="symbol"?lt+"":lt,$t);function lt(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:i,stops:a}=hs(t,e.left,e.top,e.width,e.height),l=s.createLinearGradient(r,n,o,i);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function $t(s,t,e){s!=null&&s.color&&(s.color=lt(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=lt(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=lt(e,s.textStrokeColor,t))}function hs(s,t,e,r,n){var d;const o=((d=s.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",i=o.split(",")[0],a=i.includes("deg")?i:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),f=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+f,x1:t+r/2+u,y1:e+n/2-f,stops:Array.from(l).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 Jt(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const o=e.style,i={...o,fill:s.color??o.fill,stroke:s.textStrokeColor??o.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,i),t.restore()}function Dr(s,t,e){const{left:r,top:n,width:o,height:i}=e,a=s.canvas;a.dataset.viewBox=`${r} ${n} ${o} ${i}`,a.dataset.pixelRatio=String(t);const l=o,h=i;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(h*t)),a.style.width=`${l}px`,a.style.height=`${h}px`,s.clearRect(0,0,a.width,a.height),s.scale(t,t),s.translate(-r,-n)}function Ur(s,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;$t(r,n,s),e.forEach(o=>{$t(o.computedStyle,o.lineBox,s),o.fragments.forEach(i=>{$t(i.computedStyle,i.inlineBox,s)})})}var ht=Uint8Array,Ct=Uint16Array,Ke=Int32Array,Oe=new ht([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]),Ae=new ht([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]),Qe=new ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Er=function(s,t){for(var e=new Ct(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new Ke(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)n[o]=o-e[r]<<5|r;return{b:e,r:n}},kr=Er(Oe,2),Lr=kr.b,Je=kr.r;Lr[28]=258,Je[258]=28;for(var Fr=Er(Ae,0),cs=Fr.b,Nr=Fr.r,tr=new Ct(32768),j=0;j<32768;++j){var qt=(j&43690)>>1|(j&21845)<<1;qt=(qt&52428)>>2|(qt&13107)<<2,qt=(qt&61680)>>4|(qt&3855)<<4,tr[j]=((qt&65280)>>8|(qt&255)<<8)>>1}for(var Bt=function(s,t,e){for(var r=s.length,n=0,o=new Ct(t);n<r;++n)s[n]&&++o[s[n]-1];var i=new Ct(t);for(n=1;n<t;++n)i[n]=i[n-1]+o[n-1]<<1;var a;if(e){a=new Ct(1<<t);var l=15-t;for(n=0;n<r;++n)if(s[n])for(var h=n<<4|s[n],c=t-s[n],u=i[s[n]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[tr[u]>>l]=h}else for(a=new Ct(r),n=0;n<r;++n)s[n]&&(a[n]=tr[i[s[n]-1]++]>>15-s[n]);return a},Gt=new ht(288),j=0;j<144;++j)Gt[j]=8;for(var j=144;j<256;++j)Gt[j]=9;for(var j=256;j<280;++j)Gt[j]=7;for(var j=280;j<288;++j)Gt[j]=8;for(var he=new ht(32),j=0;j<32;++j)he[j]=5;var us=Bt(Gt,9,0),fs=Bt(Gt,9,1),ps=Bt(he,5,0),ds=Bt(he,5,1),er=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},Tt=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},rr=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},nr=function(s){return(s+7)/8|0},zr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ht(s.subarray(t,e))},gs=["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"],Ot=function(s,t,e){var r=new Error(t||gs[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,Ot),!e)throw r;return r},ys=function(s,t,e,r){var n=s.length,o=0;if(!n||t.f&&!t.l)return e||new ht(0);var i=!e,a=i||t.i!=2,l=t.i;i&&(e=new ht(n*3));var h=function(kt){var Lt=e.length;if(kt>Lt){var zt=new ht(Math.max(Lt*2,kt));zt.set(e),e=zt}},c=t.f||0,u=t.p||0,f=t.b||0,d=t.l,g=t.d,m=t.m,p=t.n,S=n*8;do{if(!d){c=Tt(s,u,1);var P=Tt(s,u+1,3);if(u+=3,P)if(P==1)d=fs,g=ds,m=9,p=5;else if(P==2){var w=Tt(s,u,31)+257,D=Tt(s,u+10,15)+4,_=w+Tt(s,u+5,31)+1;u+=14;for(var M=new ht(_),H=new ht(19),U=0;U<D;++U)H[Qe[U]]=Tt(s,u+U*3,7);u+=D*3;for(var q=er(H),I=(1<<q)-1,E=Bt(H,q,1),U=0;U<_;){var k=E[Tt(s,u,I)];u+=k&15;var C=k>>4;if(C<16)M[U++]=C;else{var R=0,B=0;for(C==16?(B=3+Tt(s,u,3),u+=2,R=M[U-1]):C==17?(B=3+Tt(s,u,7),u+=3):C==18&&(B=11+Tt(s,u,127),u+=7);B--;)M[U++]=R}}var z=M.subarray(0,w),N=M.subarray(w);m=er(z),p=er(N),d=Bt(z,m,1),g=Bt(N,p,1)}else Ot(1);else{var C=nr(u)+4,x=s[C-4]|s[C-3]<<8,v=C+x;if(v>n){l&&Ot(0);break}a&&h(f+x),e.set(s.subarray(C,v),f),t.b=f+=x,t.p=u=v*8,t.f=c;continue}if(u>S){l&&Ot(0);break}}a&&h(f+131072);for(var it=(1<<m)-1,T=(1<<p)-1,X=u;;X=u){var R=d[rr(s,u)&it],W=R>>4;if(u+=R&15,u>S){l&&Ot(0);break}if(R||Ot(2),W<256)e[f++]=W;else if(W==256){X=u,d=null;break}else{var Y=W-254;if(W>264){var U=W-257,L=Oe[U];Y=Tt(s,u,(1<<L)-1)+Lr[U],u+=L}var J=g[rr(s,u)&T],K=J>>4;J||Ot(3),u+=J&15;var N=cs[K];if(K>3){var L=Ae[K];N+=rr(s,u)&(1<<L)-1,u+=L}if(u>S){l&&Ot(0);break}a&&h(f+131072);var nt=f+Y;if(f<N){var Kt=o-N,Qt=Math.min(N,nt);for(Kt+f<0&&Ot(3);f<Qt;++f)e[f]=r[Kt+f]}for(;f<nt;++f)e[f]=e[f-N]}}t.l=d,t.p=X,t.b=f,t.f=c,d&&(c=1,t.m=m,t.d=g,t.n=p)}while(!c);return f!=e.length&&i?zr(e,0,f):e.subarray(0,f)},Nt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ce=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},sr=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,o=e.slice();if(!n)return{t:Wr,l:0};if(n==1){var i=new ht(e[0].s+1);return i[e[0].s]=1,{t:i,l:1}}e.sort(function(v,w){return v.f-w.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,c=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=e[e[h].f<e[u].f?h++:u++],l=e[h!=c&&e[h].f<e[u].f?h++:u++],e[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=o[0].s,r=1;r<n;++r)o[r].s>f&&(f=o[r].s);var d=new Ct(f+1),g=ir(e[c-1],d,0);if(g>t){var r=0,m=0,p=g-t,S=1<<p;for(o.sort(function(w,D){return d[D.s]-d[w.s]||w.f-D.f});r<n;++r){var P=o[r].s;if(d[P]>t)m+=S-(1<<g-d[P]),d[P]=t;else break}for(m>>=p;m>0;){var C=o[r].s;d[C]<t?m-=1<<t-d[C]++-1:++r}for(;r>=0&&m;--r){var x=o[r].s;d[x]==t&&(--d[x],++m)}g=t}return{t:new ht(d),l:g}},ir=function(s,t,e){return s.s==-1?Math.max(ir(s.l,t,e+1),ir(s.r,t,e+1)):t[s.s]=e},qr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new Ct(++t),r=0,n=s[0],o=1,i=function(l){e[r++]=l},a=1;a<=t;++a)if(s[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(n),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(n);o=1,n=s[a]}return{c:e.subarray(0,r),n:t}},ue=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Gr=function(s,t,e){var r=e.length,n=nr(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 o=0;o<r;++o)s[n+o+4]=e[o];return(n+4+r)*8},Rr=function(s,t,e,r,n,o,i,a,l,h,c){Nt(t,c++,e),++n[256];for(var u=sr(n,15),f=u.t,d=u.l,g=sr(o,15),m=g.t,p=g.l,S=qr(f),P=S.c,C=S.n,x=qr(m),v=x.c,w=x.n,D=new Ct(19),_=0;_<P.length;++_)++D[P[_]&31];for(var _=0;_<v.length;++_)++D[v[_]&31];for(var M=sr(D,7),H=M.t,U=M.l,q=19;q>4&&!H[Qe[q-1]];--q);var I=h+5<<3,E=ue(n,Gt)+ue(o,he)+i,k=ue(n,f)+ue(o,m)+i+14+3*q+ue(D,H)+2*D[16]+3*D[17]+7*D[18];if(l>=0&&I<=E&&I<=k)return Gr(t,c,s.subarray(l,l+h));var R,B,z,N;if(Nt(t,c,1+(k<E)),c+=2,k<E){R=Bt(f,d,0),B=f,z=Bt(m,p,0),N=m;var it=Bt(H,U,0);Nt(t,c,C-257),Nt(t,c+5,w-1),Nt(t,c+10,q-4),c+=14;for(var _=0;_<q;++_)Nt(t,c+3*_,H[Qe[_]]);c+=3*q;for(var T=[P,v],X=0;X<2;++X)for(var W=T[X],_=0;_<W.length;++_){var Y=W[_]&31;Nt(t,c,it[Y]),c+=H[Y],Y>15&&(Nt(t,c,W[_]>>5&127),c+=W[_]>>12)}}else R=us,B=Gt,z=ps,N=he;for(var _=0;_<a;++_){var L=r[_];if(L>255){var Y=L>>18&31;ce(t,c,R[Y+257]),c+=B[Y+257],Y>7&&(Nt(t,c,L>>23&31),c+=Oe[Y]);var J=L&31;ce(t,c,z[J]),c+=N[J],J>3&&(ce(t,c,L>>5&8191),c+=Ae[J])}else ce(t,c,R[L]),c+=B[L]}return ce(t,c,R[256]),c+B[256]},ms=new Ke([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Wr=new ht(0),ws=function(s,t,e,r,n,o){var i=o.z||s.length,a=new ht(r+i+5*(1+Math.ceil(i/7e3))+n),l=a.subarray(r,a.length-n),h=o.l,c=(o.r||0)&7;if(t){c&&(l[0]=o.r>>3);for(var u=ms[t-1],f=u>>13,d=u&8191,g=(1<<e)-1,m=o.p||new Ct(32768),p=o.h||new Ct(g+1),S=Math.ceil(e/3),P=2*S,C=function(le){return(s[le]^s[le+1]<<S^s[le+2]<<P)&g},x=new Ke(25e3),v=new Ct(288),w=new Ct(32),D=0,_=0,M=o.i||0,H=0,U=o.w||0,q=0;M+2<i;++M){var I=C(M),E=M&32767,k=p[I];if(m[E]=k,p[I]=E,U<=M){var R=i-M;if((D>7e3||H>24576)&&(R>423||!h)){c=Rr(s,l,0,x,v,w,_,H,q,M-q,c),H=D=_=0,q=M;for(var B=0;B<286;++B)v[B]=0;for(var B=0;B<30;++B)w[B]=0}var z=2,N=0,it=d,T=E-k&32767;if(R>2&&I==C(M-T))for(var X=Math.min(f,R)-1,W=Math.min(32767,M),Y=Math.min(258,R);T<=W&&--it&&E!=k;){if(s[M+z]==s[M+z-T]){for(var L=0;L<Y&&s[M+L]==s[M+L-T];++L);if(L>z){if(z=L,N=T,L>X)break;for(var J=Math.min(T,L-2),K=0,B=0;B<J;++B){var nt=M-T+B&32767,Kt=m[nt],Qt=nt-Kt&32767;Qt>K&&(K=Qt,k=nt)}}}E=k,k=m[E],T+=E-k&32767}if(N){x[H++]=268435456|Je[z]<<18|Nr[N];var kt=Je[z]&31,Lt=Nr[N]&31;_+=Oe[kt]+Ae[Lt],++v[257+kt],++w[Lt],U=M+z,++D}else x[H++]=s[M],++v[s[M]]}}for(M=Math.max(M,U);M<i;++M)x[H++]=s[M],++v[s[M]];c=Rr(s,l,h,x,v,w,_,H,q,M-q,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=p,o.p=m,o.i=M,o.w=U)}else{for(var M=o.w||0;M<i+h;M+=65535){var zt=M+65535;zt>=i&&(l[c/8|0]=h,zt=i),c=Gr(l,c+1,s.subarray(M,zt))}o.i=i}return zr(a,0,r+nr(c)+n)},Vr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,o=e.length|0,i=0;i!=o;){for(var a=Math.min(i+2655,o);i<a;++i)n+=r+=e[i];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}}},vs=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),i=new ht(o.length+s.length);i.set(o),i.set(s,o.length),s=i,n.w=o.length}return ws(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)},Xr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},xs=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=Vr();n.p(t.dictionary),Xr(s,2,n.d())}},bs=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&Ot(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&Ot(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function Ss(s,t){t||(t={});var e=Vr();e.p(s);var r=vs(s,t,t.dictionary?6:2,4);return xs(r,t),Xr(r,r.length-4,e.d()),r}function Ps(s,t){return ys(s.subarray(bs(s,t),-4),{i:2},t,t)}var Cs=typeof TextDecoder<"u"&&new TextDecoder,_s=0;try{Cs.decode(Wr,{stream:!0}),_s=1}catch{}const Ms="modern-font";function fe(s,t){if(!s)throw new Error(`[${Ms}] ${t}`)}function Ts(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 te(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var jr=Object.defineProperty,Os=(s,t,e)=>t in s?jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ct=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&jr(t,e,n),n},As=(s,t,e)=>(Os(s,t+"",e),e);const Ie={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ut(){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 ot extends DataView{constructor(t,e,r,n){super(Ts(t),e,r),this.littleEndian=n,As(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/,i=>i.toUpperCase())}`,o=this[n](e,r);return this.cursor+=Ie[t],o}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 o=0,i=r.length;o<i;o++)n+=String.fromCharCode(r[o]);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 o=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,i=this[o](r,e,n);return this.cursor+=Ie[t.toLowerCase()],i}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,i;n<o;++n)i=t.charCodeAt(n)||0,i>127?this.writeUint16(i):this.writeUint8(i);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=te(t);r=n.byteLength;for(let o=0;o<r;++o)this.setUint8(e+o,n.getUint8(o))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}ct([ut()],ot.prototype,"readInt8"),ct([ut()],ot.prototype,"readInt16"),ct([ut()],ot.prototype,"readInt32"),ct([ut()],ot.prototype,"readUint8"),ct([ut()],ot.prototype,"readUint16"),ct([ut()],ot.prototype,"readUint32"),ct([ut()],ot.prototype,"readFloat32"),ct([ut()],ot.prototype,"readFloat64"),ct([ut()],ot.prototype,"writeInt8"),ct([ut()],ot.prototype,"writeInt16"),ct([ut()],ot.prototype,"writeInt32"),ct([ut()],ot.prototype,"writeUint8"),ct([ut()],ot.prototype,"writeUint16"),ct([ut()],ot.prototype,"writeUint32"),ct([ut()],ot.prototype,"writeFloat32"),ct([ut()],ot.prototype,"writeFloat64");var Is=Object.defineProperty,$s=(s,t,e)=>t in s?Is(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Bs=(s,t,e)=>($s(s,t+"",e),e);const Hr=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let i=Hr.get(n);i||(i={columns:[],byteLength:0},Hr.set(n,i));const a={...t,name:o,byteLength:e*Ie[r],offset:t.offset??i.columns.reduce((l,h)=>l+h.byteLength,0)};i.columns.push(a),i.byteLength=i.columns.reduce((l,h)=>l+Ie[h.type]*(h.size??1),0),Object.defineProperty(n.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Mt{constructor(t,e,r,n){Bs(this,"view"),this.view=new ot(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 $e(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 Us(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 Es(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 or extends Mt{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 Yr=Object.defineProperty,ks=(s,t,e)=>t in s?Yr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Yr(t,e,n),n},Zr=(s,t,e)=>(ks(s,typeof t!="symbol"?t+"":t,e),e);const wt=class ss extends or{constructor(){super(...arguments),Zr(this,"format","EmbeddedOpenType"),Zr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=$e(n.fontFamily||""),i=o.length,a=$e(n.fontStyle||""),l=a.length,h=$e(n.version||""),c=h.length,u=$e(n.fullName||""),f=u.length,d=86+i+4+l+4+c+4+f+2+t.view.byteLength,g=new ss(new ArrayBuffer(d),0,d,!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(i),g.view.writeBytes(o),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(f),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};mt([y("uint32")],wt.prototype,"EOTSize"),mt([y("uint32")],wt.prototype,"FontDataSize"),mt([y("uint32")],wt.prototype,"Version"),mt([y("uint32")],wt.prototype,"Flags"),mt([y({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),mt([y("uint8")],wt.prototype,"Charset"),mt([y("uint8")],wt.prototype,"Italic"),mt([y("uint32")],wt.prototype,"Weight"),mt([y("uint16")],wt.prototype,"fsType"),mt([y("uint16")],wt.prototype,"MagicNumber"),mt([y({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),mt([y({type:"uint8",size:8})],wt.prototype,"CodePageRange"),mt([y("uint32")],wt.prototype,"CheckSumAdjustment"),mt([y({type:"uint8",size:16})],wt.prototype,"Reserved"),mt([y("uint16")],wt.prototype,"Padding1");var Ls=Object.defineProperty,Be=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Ls(t,e,n),n};class pe extends Mt{constructor(t,e){super(t,e,16)}}Be([y({type:"char",size:4})],pe.prototype,"tag"),Be([y("uint32")],pe.prototype,"checkSum"),Be([y("uint32")],pe.prototype,"offset"),Be([y("uint32")],pe.prototype,"length");const ar=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Fs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Ns=Object.defineProperty,zs=(s,t,e)=>t in s?Ns(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,de=(s,t,e)=>(zs(s,typeof t!="symbol"?t+"":t,e),e);class Kr{constructor(t){de(this,"index"),de(this,"name"),de(this,"isComposite",!1),de(this,"components",[]),de(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,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},o){const i=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=i,yScale:l=i}=n,h=this.pathCommands,c=[];for(let u=0,f=h.length;u<f;u+=1){const d=h[u];d.type==="M"?c.push({type:"M",x:t+d.x*a,y:e+-d.y*l}):d.type==="L"?c.push({type:"L",x:t+d.x*a,y:e+-d.y*l}):d.type==="Q"?c.push({type:"Q",x1:t+d.x1*a,y1:e+-d.y1*l,x:t+d.x*a,y:e+-d.y*l}):d.type==="C"?c.push({type:"C",x1:t+d.x1*a,y1:e+-d.y1*l,x2:t+d.x2*a,y2:e+-d.y2*l,x:t+d.x*a,y:e+-d.y*l}):d.type==="Z"&&c.push({type:"Z"})}return c}}class qs extends Kr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:i,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,f,d,g;const m=[],p=[];let S=0,P=!1,C=!1,x=i,v=0,w=0;function D(E,k){m.push({type:"L",x:E,y:k})}function _(E,k,R,B,z,N){m.push({type:"C",x1:E,y1:k,x2:R,y2:B,x:z,y:N})}function M(E,k){C&&h!==2&&H(),C=!0,m.push({type:"M",x:E,y:k})}function H(){m.push({type:"Z"})}function U(E){m.push(...E)}function q(){p.length%2!==0&&!P&&(x=p.shift()+o),S+=p.length>>1,p.length=0,P=!0}function I(E){let k,R,B,z,N,it,T,X,W,Y,L,J,K=0;for(;K<E.length;){let nt=E[K++];switch(nt){case 1:q();break;case 3:q();break;case 4:p.length>1&&!P&&(x=p.shift()+o,P=!0),w+=p.pop(),M(v,w);break;case 5:for(;p.length>0;)v+=p.shift(),w+=p.shift(),D(v,w);break;case 6:for(;p.length>0&&(v+=p.shift(),D(v,w),p.length!==0);)w+=p.shift(),D(v,w);break;case 7:for(;p.length>0&&(w+=p.shift(),D(v,w),p.length!==0);)v+=p.shift(),D(v,w);break;case 8:for(;p.length>0;)u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+p.shift(),_(u,f,d,g,v,w);break;case 10:N=p.pop()+l,it=t.subrs[N],it&&I(it);break;case 11:return;case 12:switch(nt=E[K],K+=1,nt){case 35:u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),T=d+p.shift(),X=g+p.shift(),W=T+p.shift(),Y=X+p.shift(),L=W+p.shift(),J=Y+p.shift(),v=L+p.shift(),w=J+p.shift(),p.shift(),_(u,f,d,g,T,X),_(W,Y,L,J,v,w);break;case 34:u=v+p.shift(),f=w,d=u+p.shift(),g=f+p.shift(),T=d+p.shift(),X=g,W=T+p.shift(),Y=g,L=W+p.shift(),J=w,v=L+p.shift(),_(u,f,d,g,T,X),_(W,Y,L,J,v,w);break;case 36:u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),T=d+p.shift(),X=g,W=T+p.shift(),Y=g,L=W+p.shift(),J=Y+p.shift(),v=L+p.shift(),_(u,f,d,g,T,X),_(W,Y,L,J,v,w);break;case 37:u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),T=d+p.shift(),X=g+p.shift(),W=T+p.shift(),Y=X+p.shift(),L=W+p.shift(),J=Y+p.shift(),Math.abs(L-v)>Math.abs(J-w)?v=L+p.shift():w=J+p.shift(),_(u,f,d,g,T,X),_(W,Y,L,J,v,w);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),p.length=0}break;case 14:if(p.length>=4){const Kt=ar[p.pop()],Qt=ar[p.pop()],kt=p.pop(),Lt=p.pop();if(Kt&&Qt){n.isComposite=!0,n.components=[];const zt=t.charset.indexOf(Kt),le=t.charset.indexOf(Qt);n.components.push({glyphIndex:le,dx:0,dy:0}),n.components.push({glyphIndex:zt,dx:Lt,dy:kt}),U(r.get(le).pathCommands);const Ir=JSON.parse(JSON.stringify(r.get(zt).pathCommands));for(let $r=0;$r<Ir.length;$r+=1){const Ft=Ir[$r];Ft.type!=="Z"&&(Ft.x+=Lt,Ft.y+=kt),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Lt,Ft.y1+=kt),Ft.type==="C"&&(Ft.x2+=Lt,Ft.y2+=kt)}U(Ir)}}else p.length>0&&!P&&(x=p.shift()+o,P=!0);C&&h!==2&&(H(),C=!1);break;case 18:q();break;case 19:case 20:q(),K+=S+7>>3;break;case 21:p.length>2&&!P&&(x=p.shift()+o,P=!0),w+=p.pop(),v+=p.pop(),M(v,w);break;case 22:p.length>1&&!P&&(x=p.shift()+o,P=!0),v+=p.pop(),M(v,w);break;case 23:q();break;case 24:for(;p.length>2;)u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+p.shift(),_(u,f,d,g,v,w);v+=p.shift(),w+=p.shift(),D(v,w);break;case 25:for(;p.length>6;)v+=p.shift(),w+=p.shift(),D(v,w);u=v+p.shift(),f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+p.shift(),_(u,f,d,g,v,w);break;case 26:for(p.length%2&&(v+=p.shift());p.length>0;)u=v,f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d,w=g+p.shift(),_(u,f,d,g,v,w);break;case 27:for(p.length%2&&(w+=p.shift());p.length>0;)u=v+p.shift(),f=w,d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g,_(u,f,d,g,v,w);break;case 28:k=E[K],R=E[K+1],p.push((k<<24|R<<16)>>16),K+=2;break;case 29:N=p.pop()+a,it=t.gsubrs[N],it&&I(it);break;case 30:for(;p.length>0&&(u=v,f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+(p.length===1?p.shift():0),_(u,f,d,g,v,w),p.length!==0);)u=v+p.shift(),f=w,d=u+p.shift(),g=f+p.shift(),w=g+p.shift(),v=d+(p.length===1?p.shift():0),_(u,f,d,g,v,w);break;case 31:for(;p.length>0&&(u=v+p.shift(),f=w,d=u+p.shift(),g=f+p.shift(),w=g+p.shift(),v=d+(p.length===1?p.shift():0),_(u,f,d,g,v,w),p.length!==0);)u=v,f=w+p.shift(),d=u+p.shift(),g=f+p.shift(),v=d+p.shift(),w=g+(p.length===1?p.shift():0),_(u,f,d,g,v,w);break;default:nt<32?console.warn(`Glyph ${c}: unknown operator ${nt}`):nt<247?p.push(nt-139):nt<251?(k=E[K],K+=1,p.push((nt-247)*256+k+108)):nt<255?(k=E[K],K+=1,p.push(-(nt-251)*256-k-108)):(k=E[K],R=E[K+1],B=E[K+2],z=E[K+3],K+=4,p.push((k<<24|R<<16|B<<8|z)/65536))}}}I(e),this.pathCommands=m,P&&(this.advanceWidth=x)}}var Gs=Object.defineProperty,Rs=(s,t,e)=>t in s?Gs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ws=(s,t,e)=>(Rs(s,t+"",e),e);class Qr{constructor(t){this._sfnt=t,Ws(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 o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??(r.unicode=o[0]),r.unicodes??(r.unicodes=o)),this._items[t]=r}return r}}class Vs extends Qr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new qs({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Jr=Object.defineProperty,Xs=(s,t,e)=>t in s?Jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,tn=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Jr(t,e,n),n},De=(s,t,e)=>(Xs(s,typeof t!="symbol"?t+"":t,e),e);class Ue extends Mt{constructor(t,e,r,n){super(t,e,r,n),De(this,"_offsets"),De(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 o=0,i=e+1;o<i;o++){const a=this.view;let l=0;for(let h=0;h<r;h++)l<<=8,l+=a.readUint8();n.push(l)}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],i=r+e[t+1]-n;return this._isString?this.view.readString(n,i):this.view.readBytes(n,i)}}tn([y("uint16")],Ue.prototype,"count"),tn([y("uint8")],Ue.prototype,"offsetSize");class Ee extends Ue{constructor(){super(...arguments),De(this,"_isString",!1)}}class en extends Ue{constructor(){super(...arguments),De(this,"_isString",!0)}}const js=[".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"],Hs=[".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"],Ys=[".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"],Zs=[".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 ke(s,t){return t<=390?js[t]:s[t-391]}var Ks=Object.defineProperty,Qs=(s,t,e)=>t in s?Ks(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,rn=(s,t,e)=>(Qs(s,typeof t!="symbol"?t+"":t,e),e);function Z(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(i){this._setProp(o,i)},configurable:!0,enumerable:!0})}}class nn extends Mt{constructor(){super(...arguments),rn(this,"_dict"),rn(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 o=t.readUint8(),i=o>>4,a=o&15;if(i===r||(e+=n[i],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,i;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),o=e.readUint8(),i=e.readUint8(),r<<24|n<<16|o<<8|i;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 o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),n[o]=e,e=[]):e.push(this._readOperand(o))}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 ke(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Js=Object.defineProperty,lr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Js(t,e,n),n};class Le extends nn{}lr([Z(19)],Le.prototype,"subrs"),lr([Z(20)],Le.prototype,"defaultWidthX"),lr([Z(21)],Le.prototype,"nominalWidthX");var ti=Object.defineProperty,tt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ti(t,e,n),n};class Q extends nn{}tt([Z(0,"string")],Q.prototype,"version"),tt([Z(1,"string")],Q.prototype,"notice"),tt([Z(1200,"string")],Q.prototype,"copyright"),tt([Z(2,"string")],Q.prototype,"fullName"),tt([Z(3,"string")],Q.prototype,"familyName"),tt([Z(4,"string")],Q.prototype,"weight"),tt([Z(1201)],Q.prototype,"isFixedPitch"),tt([Z(1202)],Q.prototype,"italicAngle"),tt([Z(1203,"number",-100)],Q.prototype,"underlinePosition"),tt([Z(1204,"number",50)],Q.prototype,"underlineThickness"),tt([Z(1205)],Q.prototype,"paintType"),tt([Z(1206,"number",2)],Q.prototype,"charstringType"),tt([Z(1207,"number[]",[.001,0,0,.001,0,0])],Q.prototype,"fontMatrix"),tt([Z(13)],Q.prototype,"uniqueId"),tt([Z(5,"number[]",[0,0,0,0])],Q.prototype,"fontBBox"),tt([Z(1208)],Q.prototype,"strokeWidth"),tt([Z(14)],Q.prototype,"xuid"),tt([Z(15)],Q.prototype,"charset"),tt([Z(16)],Q.prototype,"encoding"),tt([Z(17)],Q.prototype,"charStrings"),tt([Z(18,"number[]",[0,0])],Q.prototype,"private");var ei=Object.defineProperty,ri=(s,t,e)=>t in s?ei(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,hr=(s,t,e)=>(ri(s,typeof t!="symbol"?t+"":t,e),e);function ft(s,t=s){return e=>{Fe.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(Fe.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const sn=class Te{constructor(t){hr(this,"tables",new Map),hr(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,o=Array.from({length:n}),i=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||i;return o}getPathCommands(t,e,r,n,o){const i=[];return this.forEachGlyph(t,e,r,n,o,(a,l,h,c,u)=>{i.push(...a.getPathCommands(l,h,c,u,this))}),i}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,o={},i){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];i.call(this,c,e,r,n,o),c.advanceWidth&&(e+=c.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*n:o.tracking&&(e+=o.tracking/1e3*n)}return e}clone(){return new Te(this.tableViews)}delete(t){const e=Te.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Te.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Te.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const o=this.tableViews.get(t);if(!o)return;r=new n(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};hr(sn,"tableDefinitions",new Map);let Fe=sn;class pt extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var on=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,si=(s,t,e)=>t in s?on(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(s,t,e,r)=>{for(var n=r>1?void 0:r?ni(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&on(t,e,n),n},cr=(s,t,e)=>(si(s,typeof t!="symbol"?t+"":t,e),e);let ee=class extends pt{constructor(s,t,e,r){super(s,t,e,r),cr(this,"_glyphs"),cr(this,"privateDict"),cr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Vs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var s;return((s=this.privateDict)==null?void 0:s.defaultWidthX)??0}get nominalWidthX(){var s;return((s=this.privateDict)==null?void 0:s.nominalWidthX)??0}get subrs(){var s;return((s=this.subrsIndex)==null?void 0:s.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const s=this.view,{buffer:t,byteOffset:e}=s,r=e+4;this.nameIndex=new en(t,r),this.topDictIndex=new Ee(t,this.nameIndex.endOffset),this.stringIndex=new en(t,this.topDictIndex.endOffset),this.globalSubrIndex=new Ee(t,this.stringIndex.endOffset),this.topDict=new Q(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const n=this.topDict.private[0],o=this.topDict.private[1];n&&(this.privateDict=new Le(t,e+o,n).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ee(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new Ee(t,e+this.topDict.charStrings);const i=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Hs:this.topDict.charset===1?this.charset=Ys:this.topDict.charset===2?this.charset=Zs:this.charset=this._readCharset(e+this.topDict.charset,i,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=ar:this.topDict.encoding===1?this.encoding=Fs:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(s,t,e){const r=this.view;r.seek(s);let n,o,i;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(n=0;n<t;n+=1)o=r.readUint16(),a.push(ke(e,o));else if(l===1)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint8(),n=0;n<=i;n+=1)a.push(ke(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint16(),n=0;n<=i;n+=1)a.push(ke(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(s){const t=this.view;t.seek(s);let e,r;const n={},o=t.readUint8();if(o===0){const i=t.readUint8();for(e=0;e<i;e+=1)r=t.readUint8(),n[r]=e}else if(o===1){const i=t.readUint8();for(r=1,e=0;e<i;e+=1){const a=t.readUint8(),l=t.readUint8();for(let h=a;h<=a+l;h+=1)n[h]=r,r+=1}}else console.warn(`unknown encoding format:${o}`);return n}_calcSubroutineBias(s){let t;return s.length<1240?t=107:s.length<33900?t=1131:t=32768,t}};ge([y("uint8")],ee.prototype,"majorVersion",2),ge([y("uint8")],ee.prototype,"minorVersion",2),ge([y("uint8")],ee.prototype,"headerSize",2),ge([y("uint8")],ee.prototype,"offsetSize",2),ee=ge([ft("CFF ","cff")],ee);var ii=Object.defineProperty,Ne=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ii(t,e,n),n};const ye=class is extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new is;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}};Ne([y("uint16")],ye.prototype,"format"),Ne([y("uint16")],ye.prototype,"length"),Ne([y("uint16")],ye.prototype,"language"),Ne([y({type:"uint8",size:256})],ye.prototype,"glyphIndexArray");let an=ye;var oi=Object.defineProperty,ur=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&oi(t,e,n),n};class ze extends Mt{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,o=this.subHeaders,i=this.glyphIndexArray,a=r.findIndex(h=>h===n);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<o[0].firstCode||h>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(h-o[0].firstCode)>=i.length?l=0:(l=i[o[0].idRangeOffset+(h-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(h,l);else{const c=r[h];for(let u=0,f=o[c].entryCount;u<f;u++)if(o[c].idRangeOffset+u>=i.length?l=0:(l=i[o[c].idRangeOffset+u],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<t){const d=(h<<8|u+o[c].firstCode)%65535;e.set(d,l)}}return e}}ur([y("uint16")],ze.prototype,"format"),ur([y("uint16")],ze.prototype,"length"),ur([y("uint16")],ze.prototype,"language");function ln(s){return s>32767?s-65536:s<-32767?s+65536:s}function hn(s,t){let e;const r=[];let n={};return s.forEach((o,i)=>{t&&i>t||((!e||i!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:i,startId:o,delta:ln(o-i)}):(n.start=Number(i),n.startId=o,n.delta=ln(o-i))),e={unicode:i,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var ai=Object.defineProperty,jt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ai(t,e,n),n};const Rt=class os extends Mt{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=hn(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,i=new os(new ArrayBuffer(24+e.length*8));return i.format=4,i.length=i.view.byteLength,i.language=0,i.segCountX2=r*2,i.searchRange=o,i.entrySelector=n,i.rangeShift=2*r-o,i.endCode=[...e.map(a=>a.end),65535],i.reservedPad=0,i.startCode=[...e.map(a=>a.start),65535],i.idDelta=[...e.map(a=>a.delta),1],i.idRangeOffset=Array.from({length:r},()=>0),i}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,i=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<e;++h)for(let c=n[h],u=o[h];c<=u;++c)if(i[h]===0)t.set(c,(c+a[h])%65536);else{const f=h+i[h]/2+(c-n[h])-r,d=l[f];d!==0?t.set(c,(d+a[h])%65536):t.set(c,0)}return t.delete(65535),t}};jt([y("uint16")],Rt.prototype,"format"),jt([y("uint16")],Rt.prototype,"length"),jt([y("uint16")],Rt.prototype,"language"),jt([y("uint16")],Rt.prototype,"segCountX2"),jt([y("uint16")],Rt.prototype,"searchRange"),jt([y("uint16")],Rt.prototype,"entrySelector"),jt([y("uint16")],Rt.prototype,"rangeShift");let cn=Rt;var li=Object.defineProperty,me=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&li(t,e,n),n};class re extends Mt{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}}me([y("uint16")],re.prototype,"format"),me([y("uint16")],re.prototype,"length"),me([y("uint16")],re.prototype,"language"),me([y("uint16")],re.prototype,"firstCode"),me([y("uint16")],re.prototype,"entryCount");var hi=Object.defineProperty,we=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&hi(t,e,n),n};const ne=class as extends Mt{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=hn(t),r=new as(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 o=e[r];let i=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,i++)}return t}};we([y("uint16")],ne.prototype,"format"),we([y("uint16")],ne.prototype,"reserved"),we([y("uint32")],ne.prototype,"length"),we([y("uint32")],ne.prototype,"language"),we([y("uint32")],ne.prototype,"nGroups");let un=ne;var ci=Object.defineProperty,fr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ci(t,e,n),n};class qe extends Mt{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:o}=e[r];o.forEach(i=>{t.set(i.unicodeValue,i.glyphID)})}return t}}fr([y("uint16")],qe.prototype,"format"),fr([y("uint32")],qe.prototype,"length"),fr([y("uint32")],qe.prototype,"numVarSelectorRecords");var fn=Object.defineProperty,ui=Object.getOwnPropertyDescriptor,fi=(s,t,e)=>t in s?fn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,pr=(s,t,e,r)=>{for(var n=r>1?void 0:r?ui(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&fn(t,e,n),n},pn=(s,t,e)=>(fi(s,typeof t!="symbol"?t+"":t,e),e);let ve=class extends pt{constructor(){super(...arguments),pn(this,"_unicodeToGlyphIndexMap"),pn(this,"_glyphIndexToUnicodesMap")}static from(s){const t=Array.from(s.keys()).some(c=>c>65535),e=cn.from(s),r=an.from(s),n=t?un.from(s):void 0,o=4+(n?32:24),i=o+e.view.byteLength,a=i+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:i},{platformID:3,platformSpecificID:1,offset:o},n&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),h=new ve(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+((n==null?void 0:n.view.byteLength)??0)));return h.numberSubtables=l.length,h.view.seek(4),l.forEach(c=>{h.view.writeUint16(c.platformID),h.view.writeUint16(c.platformSpecificID),h.view.writeUint32(c.offset)}),h.view.writeBytes(e.view,o),h.view.writeBytes(r.view,i),n&&h.view.writeBytes(n.view,a),h}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,n=e.length;r<n;r++){const o=e[r],i=t.get(o);s.has(i)?s.get(i).push(o):s.set(i,[o])}this._glyphIndexToUnicodesMap=s}return this._glyphIndexToUnicodesMap}readSubtables(){const s=this.numberSubtables;return this.view.seek(4),Array.from({length:s},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const e=this.view.readUint16();let r;switch(e){case 0:r=new an(this.view.buffer,t.offset);break;case 2:r=new ze(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new cn(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new re(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new un(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new qe(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){var i,a,l,h,c;const s=this.readSubtables(),t=(i=s.find(u=>u.format===0))==null?void 0:i.view,e=(a=s.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:a.view,r=(l=s.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:l.view,n=(h=s.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:h.view,o=(c=s.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:c.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(e==null?void 0:e.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}};pr([y("uint16")],ve.prototype,"version",2),pr([y("uint16")],ve.prototype,"numberSubtables",2),ve=pr([ft("cmap")],ve);class pi extends Kr{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const o=t[n];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return fe(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 o=t[n],i={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(i)}return r}_parseGlyphCoordinate(t,e,r,n,o){let i;return(e&n)>0?(i=t.view.readUint8(),e&o||(i=-i),i=r+i):(e&o)>0?i=r:i=r+t.view.readInt16(),i}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 m=0;m<n;m++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();fe(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;fe(u<2e4,`Bad numberOfCoordinates:${c}`);const f=[];let d,g=0;for(;g<u;)if(d=t.view.readUint8(),f.push(d),g++,d&8&&g<u){const m=t.view.readUint8();for(let p=0;p<m;p++)f.push(d),g++}if(fe(f.length===u,`Bad flags length: ${f.length}, numberOfCoordinates: ${u}`),a.length>0){const m=[];let p;if(u>0){for(let C=0;C<u;C+=1)d=f[C],p={},p.onCurve=!!(d&1),p.lastPointOfContour=a.includes(C),m.push(p);let S=0;for(let C=0;C<u;C+=1)d=f[C],p=m[C],p.x=this._parseGlyphCoordinate(t,d,S,2,16),S=p.x;let P=0;for(let C=0;C<u;C+=1)d=f[C],p=m[C],p.y=this._parseGlyphCoordinate(t,d,P,4,32),P=p.y}this.points=m}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){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),l=!!(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 l=this.components[a],h=r.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{fe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let f=h.points[l.matchedPoints[1]];const d={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};f=this._transformPoints([f],d)[0],d.dx=u.x-f.x,d.dy=u.y-f.y,c=this._transformPoints(h.points,d)}this.points=this.points.concat(c)}}const o=[],i=this._parseContours(this.points);for(let a=0,l=i.length;a<l;++a){const h=i[a];let c=h[h.length-1],u=h[0];c.onCurve?o.push({type:"M",x:c.x,y:c.y}):u.onCurve?o.push({type:"M",x:u.x,y:u.y}):o.push({type:"M",x:(c.x+u.x)*.5,y:(c.y+u.y)*.5});for(let f=0,d=h.length;f<d;++f)if(c=u,u=h[(f+1)%d],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let g=u;u.onCurve||(g={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:g.x,y:g.y})}o.push({type:"Z"})}this.pathCommands=o}}class di extends Qr{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new pi({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var dn=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,yi=(s,t,e)=>t in s?dn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mi=(s,t,e,r)=>{for(var n=r>1?void 0:r?gi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&dn(t,e,n),n},wi=(s,t,e)=>(yi(s,t+"",e),e);let dr=class extends pt{constructor(){super(...arguments),wi(this,"_glyphs")}static from(s){const t=s.reduce((r,n)=>r+n.byteLength,0),e=new dr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeBytes(r)}),e}get glyphs(){return this._glyphs??(this._glyphs=new di(this._sfnt))}};dr=mi([ft("glyf")],dr);var vi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,bi=(s,t,e,r)=>{for(var n=r>1?void 0:r?xi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&vi(t,e,n),n};let gn=class extends pt{};gn=bi([ft("GPOS","gpos")],gn);var Si=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,Ht=(s,t,e,r)=>{for(var n=r>1?void 0:r?Pi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Si(t,e,n),n};let Wt=class extends pt{};Ht([y("uint16")],Wt.prototype,"majorVersion",2),Ht([y("uint16")],Wt.prototype,"minorVersion",2),Ht([y("uint16")],Wt.prototype,"scriptListOffset",2),Ht([y("uint16")],Wt.prototype,"featureListOffset",2),Ht([y("uint16")],Wt.prototype,"lookupListOffset",2),Ht([y("uint16")],Wt.prototype,"featureVariationsOffset",2),Wt=Ht([ft("GSUB","gsub")],Wt);var Ci=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,st=(s,t,e,r)=>{for(var n=r>1?void 0:r?_i(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Ci(t,e,n),n};let rt=class extends pt{constructor(s=new ArrayBuffer(54),t){super(s,t,Math.min(54,s.byteLength-(t??0)))}};st([y("fixed")],rt.prototype,"version",2),st([y("fixed")],rt.prototype,"fontRevision",2),st([y("uint32")],rt.prototype,"checkSumAdjustment",2),st([y("uint32")],rt.prototype,"magickNumber",2),st([y("uint16")],rt.prototype,"flags",2),st([y("uint16")],rt.prototype,"unitsPerEm",2),st([y({type:"longDateTime"})],rt.prototype,"created",2),st([y({type:"longDateTime"})],rt.prototype,"modified",2),st([y("int16")],rt.prototype,"xMin",2),st([y("int16")],rt.prototype,"yMin",2),st([y("int16")],rt.prototype,"xMax",2),st([y("int16")],rt.prototype,"yMax",2),st([y("uint16")],rt.prototype,"macStyle",2),st([y("uint16")],rt.prototype,"lowestRecPPEM",2),st([y("int16")],rt.prototype,"fontDirectionHint",2),st([y("int16")],rt.prototype,"indexToLocFormat",2),st([y("int16")],rt.prototype,"glyphDataFormat",2),rt=st([ft("head")],rt);var Mi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,vt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ti(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Mi(t,e,n),n};let dt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};vt([y("fixed")],dt.prototype,"version",2),vt([y("int16")],dt.prototype,"ascent",2),vt([y("int16")],dt.prototype,"descent",2),vt([y("int16")],dt.prototype,"lineGap",2),vt([y("uint16")],dt.prototype,"advanceWidthMax",2),vt([y("int16")],dt.prototype,"minLeftSideBearing",2),vt([y("int16")],dt.prototype,"minRightSideBearing",2),vt([y("int16")],dt.prototype,"xMaxExtent",2),vt([y("int16")],dt.prototype,"caretSlopeRise",2),vt([y("int16")],dt.prototype,"caretSlopeRun",2),vt([y("int16")],dt.prototype,"caretOffset",2),vt([y({type:"int16",size:4})],dt.prototype,"reserved",2),vt([y("int16")],dt.prototype,"metricDataFormat",2),vt([y("uint16")],dt.prototype,"numOfLongHorMetrics",2),dt=vt([ft("hhea")],dt);var yn=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,Ai=(s,t,e)=>t in s?yn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ii=(s,t,e,r)=>{for(var n=r>1?void 0:r?Oi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&yn(t,e,n),n},$i=(s,t,e)=>(Ai(s,t+"",e),e);let gr=class extends pt{constructor(){super(...arguments),$i(this,"_metrics")}static from(s){const t=s.length*4,e=new gr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:s}).map((n,o)=>(o<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};gr=Ii([ft("hmtx")],gr);var Bi=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,Ui=(s,t,e,r)=>{for(var n=r>1?void 0:r?Di(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Bi(t,e,n),n};let mn=class extends pt{};mn=Ui([ft("kern","kern")],mn);var wn=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,ki=(s,t,e)=>t in s?wn(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?Ei(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&wn(t,e,n),n},Fi=(s,t,e)=>(ki(s,t+"",e),e);let yr=class extends pt{constructor(){super(...arguments),Fi(this,"_locations")}static from(s,t=1){const e=s.length*(t?4:2),r=new yr(new ArrayBuffer(e));return s.forEach(n=>{t?r.view.writeUint32(n):r.view.writeUint16(n/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:s}).map(()=>t?e.readUint32():e.readUint16()*2)}};yr=Li([ft("loca")],yr);var Ni=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,gt=(s,t,e,r)=>{for(var n=r>1?void 0:r?zi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Ni(t,e,n),n};let at=class extends pt{constructor(s=new ArrayBuffer(32),t){super(s,t,Math.min(32,s.byteLength-(t??0)))}};gt([y("fixed")],at.prototype,"version",2),gt([y("uint16")],at.prototype,"numGlyphs",2),gt([y("uint16")],at.prototype,"maxPoints",2),gt([y("uint16")],at.prototype,"maxContours",2),gt([y("uint16")],at.prototype,"maxComponentPoints",2),gt([y("uint16")],at.prototype,"maxComponentContours",2),gt([y("uint16")],at.prototype,"maxZones",2),gt([y("uint16")],at.prototype,"maxTwilightPoints",2),gt([y("uint16")],at.prototype,"maxStorage",2),gt([y("uint16")],at.prototype,"maxFunctionDefs",2),gt([y("uint16")],at.prototype,"maxInstructionDefs",2),gt([y("uint16")],at.prototype,"maxStackElements",2),gt([y("uint16")],at.prototype,"maxSizeOfInstructions",2),gt([y("uint16")],at.prototype,"maxComponentElements",2),gt([y("uint16")],at.prototype,"maxComponentDepth",2),at=gt([ft("maxp")],at);var vn=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,Gi=(s,t,e)=>t in s?vn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ge=(s,t,e,r)=>{for(var n=r>1?void 0:r?qi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&vn(t,e,n),n},Ri=(s,t,e)=>(Gi(s,t+"",e),e);const xn={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"},mr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Wi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},bn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let xe=class extends pt{constructor(){super(...arguments),Ri(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const s=this.count;this.view.seek(6);const t=[];for(let a=0;a<s;++a)t.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 e=this.stringOffset;for(let a=0;a<s;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let r=mr.Macintosh,n=Wi.Default,o=0;t.some(a=>a.platform===mr.Microsoft&&a.encoding===bn.UCS2&&a.language===1033)&&(r=mr.Microsoft,n=bn.UCS2,o=1033);const i={};for(let a=0;a<s;++a){const l=t[a];l.platform===r&&l.encoding===n&&l.language===o&&xn[l.nameId]&&(i[xn[l.nameId]]=o===0?Us(l.name):Es(l.name))}return i}};Ge([y("uint16")],xe.prototype,"format",2),Ge([y("uint16")],xe.prototype,"count",2),Ge([y("uint16")],xe.prototype,"stringOffset",2),xe=Ge([ft("name")],xe);var Vi=Object.defineProperty,Xi=Object.getOwnPropertyDescriptor,A=(s,t,e,r)=>{for(var n=r>1?void 0:r?Xi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Vi(t,e,n),n};let O=class extends pt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};A([y("uint16")],O.prototype,"version",2),A([y("int16")],O.prototype,"xAvgCharWidth",2),A([y("uint16")],O.prototype,"usWeightClass",2),A([y("uint16")],O.prototype,"usWidthClass",2),A([y("uint16")],O.prototype,"fsType",2),A([y("uint16")],O.prototype,"ySubscriptXSize",2),A([y("uint16")],O.prototype,"ySubscriptYSize",2),A([y("uint16")],O.prototype,"ySubscriptXOffset",2),A([y("uint16")],O.prototype,"ySubscriptYOffset",2),A([y("uint16")],O.prototype,"ySuperscriptXSize",2),A([y("uint16")],O.prototype,"ySuperscriptYSize",2),A([y("uint16")],O.prototype,"ySuperscriptXOffset",2),A([y("uint16")],O.prototype,"ySuperscriptYOffset",2),A([y("uint16")],O.prototype,"yStrikeoutSize",2),A([y("uint16")],O.prototype,"yStrikeoutPosition",2),A([y("uint16")],O.prototype,"sFamilyClass",2),A([y({type:"uint8"})],O.prototype,"bFamilyType",2),A([y({type:"uint8"})],O.prototype,"bSerifStyle",2),A([y({type:"uint8"})],O.prototype,"bWeight",2),A([y({type:"uint8"})],O.prototype,"bProportion",2),A([y({type:"uint8"})],O.prototype,"bContrast",2),A([y({type:"uint8"})],O.prototype,"bStrokeVariation",2),A([y({type:"uint8"})],O.prototype,"bArmStyle",2),A([y({type:"uint8"})],O.prototype,"bLetterform",2),A([y({type:"uint8"})],O.prototype,"bMidline",2),A([y({type:"uint8"})],O.prototype,"bXHeight",2),A([y({type:"uint8",size:16})],O.prototype,"ulUnicodeRange",2),A([y({type:"char",size:4})],O.prototype,"achVendID",2),A([y("uint16")],O.prototype,"fsSelection",2),A([y("uint16")],O.prototype,"usFirstCharIndex",2),A([y("uint16")],O.prototype,"usLastCharIndex",2),A([y("int16")],O.prototype,"sTypoAscender",2),A([y("int16")],O.prototype,"sTypoDescender",2),A([y("int16")],O.prototype,"sTypoLineGap",2),A([y("uint16")],O.prototype,"usWinAscent",2),A([y("uint16")],O.prototype,"usWinDescent",2),A([y({offset:72,type:"uint8",size:8})],O.prototype,"ulCodePageRange",2),A([y({offset:72,type:"int16"})],O.prototype,"sxHeight",2),A([y("int16")],O.prototype,"sCapHeight",2),A([y("uint16")],O.prototype,"usDefaultChar",2),A([y("uint16")],O.prototype,"usBreakChar",2),A([y("uint16")],O.prototype,"usMaxContext",2),O=A([ft("OS/2","os2")],O);var ji=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,Dt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Hi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&ji(t,e,n),n};let At=class extends pt{constructor(s=new ArrayBuffer(32),t,e){super(s,t,e)}};Dt([y("fixed")],At.prototype,"format",2),Dt([y("fixed")],At.prototype,"italicAngle",2),Dt([y("int16")],At.prototype,"underlinePosition",2),Dt([y("int16")],At.prototype,"underlineThickness",2),Dt([y("uint32")],At.prototype,"isFixedPitch",2),Dt([y("uint32")],At.prototype,"minMemType42",2),Dt([y("uint32")],At.prototype,"maxMemType42",2),Dt([y("uint32")],At.prototype,"minMemType1",2),Dt([y("uint32")],At.prototype,"maxMemType1",2),At=Dt([ft("post")],At);var Yi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,xt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Zi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Yi(t,e,n),n};let yt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};xt([y("fixed")],yt.prototype,"version",2),xt([y("int16")],yt.prototype,"vertTypoAscender",2),xt([y("int16")],yt.prototype,"vertTypoDescender",2),xt([y("int16")],yt.prototype,"vertTypoLineGap",2),xt([y("int16")],yt.prototype,"advanceHeightMax",2),xt([y("int16")],yt.prototype,"minTopSideBearing",2),xt([y("int16")],yt.prototype,"minBottomSideBearing",2),xt([y("int16")],yt.prototype,"yMaxExtent",2),xt([y("int16")],yt.prototype,"caretSlopeRise",2),xt([y("int16")],yt.prototype,"caretSlopeRun",2),xt([y("int16")],yt.prototype,"caretOffset",2),xt([y({type:"int16",size:4})],yt.prototype,"reserved",2),xt([y("int16")],yt.prototype,"metricDataFormat",2),xt([y("int16")],yt.prototype,"numOfLongVerMetrics",2),yt=xt([ft("vhea")],yt);var Sn=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Qi=(s,t,e)=>t in s?Sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ji=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ki(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Sn(t,e,n),n},to=(s,t,e)=>(Qi(s,t+"",e),e);let wr=class extends pt{constructor(){super(...arguments),to(this,"_metrics")}static from(s){const t=s.length*4,e=new wr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var n;const s=this._sfnt.maxp.numGlyphs,t=((n=this._sfnt.vhea)==null?void 0:n.numOfLongVerMetrics)??0,e=this.view;e.seek(0);let r=0;return Array.from({length:s}).map((o,i)=>(i<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};wr=Ji([ft("vmtx")],wr);var Pn=Object.defineProperty,eo=(s,t,e)=>t in s?Pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,be=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Pn(t,e,n),n},Re=(s,t,e)=>(eo(s,typeof t!="symbol"?t+"":t,e),e);class It extends or{constructor(){super(...arguments),Re(this,"format","TrueType"),Re(this,"mimeType","font/ttf"),Re(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(te(t).getUint32(0))}static checksum(t){const e=te(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let o=0,i=r/4;o<i;o+=4)o*4<r-4&&(n+=e.getUint32(o*4,!1));return n&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((u,f)=>u+e(f.byteLength),0),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const i=Math.log(2);o.searchRange=Math.floor(Math.log(r)/i)*16,o.entrySelector=Math.floor(o.searchRange/i),o.rangeShift=r*16-o.searchRange;let a=12+r*16,l=0;const h=o.getDirectories();t.tableViews.forEach((u,f)=>{const d=h[l++];d.tag=f,d.checkSum=this.checksum(u),d.offset=a,d.length=u.byteLength,o.view.writeBytes(u,a),a+=e(d.length)});const c=o.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new pe(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new Fe(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Re(It,"signature",new Set([65536,1953658213,1954115633])),be([y("uint32")],It.prototype,"scalerType"),be([y("uint16")],It.prototype,"numTables"),be([y("uint16")],It.prototype,"searchRange"),be([y("uint16")],It.prototype,"entrySelector"),be([y("uint16")],It.prototype,"rangeShift");var ro=Object.defineProperty,no=(s,t,e)=>t in s?ro(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vr=(s,t,e)=>(no(s,typeof t!="symbol"?t+"":t,e),e);class We extends It{constructor(){super(...arguments),vr(this,"format","OpenType"),vr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}vr(We,"signature",new Set([1330926671]));var so=Object.defineProperty,Se=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&so(t,e,n),n};class se extends Mt{constructor(t,e){super(t,e,20)}}Se([y({type:"char",size:4})],se.prototype,"tag"),Se([y("uint32")],se.prototype,"offset"),Se([y("uint32")],se.prototype,"compLength"),Se([y("uint32")],se.prototype,"origLength"),Se([y("uint32")],se.prototype,"origChecksum");var Cn=Object.defineProperty,io=(s,t,e)=>t in s?Cn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,_t=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Cn(t,e,n),n},Ve=(s,t,e)=>(io(s,typeof t!="symbol"?t+"":t,e),e);const bt=class Br extends or{constructor(){super(...arguments),Ve(this,"format","WOFF"),Ve(this,"mimeType","font/woff"),Ve(this,"_sfnt")}get subfontFormat(){return It.is(this.flavor)?"TrueType":We.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(te(t).getUint32(0))}static checkSum(t){const e=te(t),r=e.byteLength,n=Math.floor(r/4);let o=0,i=0;for(;i<n;)o+=e.getUint32(4*i++,!1);let a=r-n*4;if(a){let l=n*4;for(;a>0;)o+=e.getUint8(l)<<a*8,l++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,f)=>{const d=te(Ss(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:f,view:d.byteLength<u.byteLength?d:u,rawView:u})});const o=n.length,i=n.reduce((u,f)=>u+r(f.view.byteLength),0),a=new Br(new ArrayBuffer(44+20*o+i+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((u,f)=>u+r(f.rawView.byteLength),0);let l=44+o*20,h=0;const c=a.getDirectories();return n.forEach(u=>{const f=c[h++];f.tag=u.tag,f.offset=l,f.compLength=u.view.byteLength,f.origChecksum=Br.checkSum(u.rawView),f.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(f.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new se(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new Fe(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,i=e.origLength,a=n+o;return t[r]=o>=i?new DataView(this.view.buffer,n,o):new DataView(Ps(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Ve(bt,"signature",new Set([2001684038])),_t([y("uint32")],bt.prototype,"signature"),_t([y("uint32")],bt.prototype,"flavor"),_t([y("uint32")],bt.prototype,"length"),_t([y("uint16")],bt.prototype,"numTables"),_t([y("uint16")],bt.prototype,"reserved"),_t([y("uint32")],bt.prototype,"totalSfntSize"),_t([y("uint16")],bt.prototype,"majorVersion"),_t([y("uint16")],bt.prototype,"minorVersion"),_t([y("uint32")],bt.prototype,"metaOffset"),_t([y("uint32")],bt.prototype,"metaLength"),_t([y("uint32")],bt.prototype,"metaOrigLength"),_t([y("uint32")],bt.prototype,"privOffset"),_t([y("uint32")],bt.prototype,"privLength");let xr=bt;function oo(s,t=!0){if(It.is(s))return new It(s);if(We.is(s))return new We(s);if(xr.is(s))return new xr(s);if(t)throw new Error("Failed to parseFont")}var ao=Object.defineProperty,lo=(s,t,e)=>t in s?ao(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Pe=(s,t,e)=>(lo(s,typeof t!="symbol"?t+"":t,e),e);const _n=class ls{constructor(){Pe(this,"fallbackFont"),Pe(this,"loading",new Map),Pe(this,"loaded",new Map),Pe(this,"familyToUrl",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...ls.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(r),this}get(t){let e;return t&&(e=this.loaded.get(this.familyToUrl.get(t)??t)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){const e=this.familyToUrl.get(t)??t;return this.familyToUrl.delete(e),this.loaded.delete(e),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...i}=e,{src:a}=t;if(this.loaded.has(a))return r&&(this.loading.forEach(f=>f.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,i),this.loading.set(a,l)),r&&this.loading.forEach((f,d)=>{f!==l&&(f.cancel(),this.loading.delete(d))}),l.when.then(f=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const d=u(f);return e.noAdd||this.loaded.set(t.src,d),d.familySet.forEach(g=>{this.familyToUrl.set(g,a),typeof document<"u"&&(n&&this.injectFontFace(g,f),o&&this.injectStyleTag(g,a))}),d}}).catch(f=>{if(f instanceof DOMException&&f.message==="The user aborted a request.")return u();throw f}).finally(()=>{this.loading.delete(a)});function h(){return t.family?Array.isArray(t.family)?t.family:[t.family]:[]}function c(f){return h().forEach(d=>{f.familySet.add(d)}),f}function u(f=new ArrayBuffer(0)){let d;function g(){return d||(d=f.byteLength?oo(f,!1):void 0),d}function m(){const p=g();if(p instanceof It||p instanceof xr)return p.sfnt}return{...t,buffer:f,familySet:new Set(h()),getFont:g,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}};Pe(_n,"defaultRequestInit",{cache:"force-cache"});let ho=_n;const co=new ho,uo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Mn(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:d="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=o,s.lineJoin=uo[i],s.miterLimit=a,s.setLineDash(l),s.lineDashOffset=h,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=f,s.shadowColor=d}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)}get array(){return[this.x,this.y]}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}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,o=-(this.y-e.y),i=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*i),e.y-(n*i+o*a)),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}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,o=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}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 b(this.x,this.y)}}class R{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}get center(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new R;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,o)=>(n.left=Math.min(n.left,o.left),n.top=Math.min(n.top,o.top),n.right=Math.max(n.right,o.right),n.bottom=Math.max(n.bottom,o.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 R(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new R(this.left,this.top,this.width,this.height)}}var fo=Object.defineProperty,po=(s,t,e)=>t in s?fo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,go=(s,t,e)=>(po(s,t+"",e),e);class St{constructor(t=1,e=0,r=0,n=0,o=1,i=0,a=0,l=0,h=1){go(this,"elements",[]),this.set(t,e,r,n,o,i,a,l,h)}set(t,e,r,n,o,i,a,l,h){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=o,c[5]=l,c[6]=r,c[7]=i,c[8]=h,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,o=this.elements,i=r[0],a=r[3],l=r[6],h=r[1],c=r[4],u=r[7],f=r[2],d=r[5],g=r[8],m=n[0],p=n[3],S=n[6],P=n[1],C=n[4],x=n[7],v=n[2],w=n[5],D=n[8];return o[0]=i*m+a*P+l*v,o[3]=i*p+a*C+l*w,o[6]=i*S+a*x+l*D,o[1]=h*m+c*P+u*v,o[4]=h*p+c*C+u*w,o[7]=h*S+c*x+u*D,o[2]=f*m+d*P+g*v,o[5]=f*p+d*C+g*w,o[8]=f*S+d*x+g*D,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*i-a*h,f=a*l-c*o,d=h*o-i*l,g=e*u+r*f+n*d;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]=(n*h-c*r)*m,t[2]=(a*r-n*i)*m,t[3]=f*m,t[4]=(c*e-n*l)*m,t[5]=(n*o-a*e)*m,t[6]=d*m,t[7]=(r*l-h*e)*m,t[8]=(i*e-r*o)*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(br.makeScale(t,e)),this}rotate(t){return this.premultiply(br.makeRotation(-t)),this}translate(t,e){return this.premultiply(br.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 br=new St;function Tn(s,t,e,r){const n=s*e+t*r,o=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let i=Math.acos(Math.max(-1,Math.min(1,n/o)));return s*r-t*e<0&&(i=-i),i}function yo(s,t,e,r,n,o,i,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 l=(i.x-a.x)/2,h=(i.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,u=-Math.sin(r)*l+Math.cos(r)*h;let f=t*t,d=e*e;const g=c*c,m=u*u,p=g/f+m/d;if(p>1){const H=Math.sqrt(p);t=H*t,e=H*e,f=t*t,d=e*e}const S=f*m+d*g,P=(f*d-S)/S;let C=Math.sqrt(Math.max(0,P));n===o&&(C=-C);const x=C*t*u/e,v=-C*e*c/t,w=Math.cos(r)*x-Math.sin(r)*v+(i.x+a.x)/2,D=Math.sin(r)*x+Math.cos(r)*v+(i.y+a.y)/2,_=Tn(1,0,(c-x)/t,(u-v)/e),M=Tn((c-x)/t,(u-v)/e,(-c-x)/t,(-u-v)/e)%(Math.PI*2);s.ellipse(w,D,t,e,r,_,_+M,o===1)}function ie(s,t){return s-(t-s)}function On(s,t){const e=new b,r=new b;for(let n=0,o=s.length;n<o;n++){const i=s[n];if(i.type==="m"||i.type==="M")i.type==="m"?e.add(i):e.copy(i),t.moveTo(e.x,e.y),r.copy(e);else if(i.type==="h"||i.type==="H")i.type==="h"?e.x+=i.x:e.x=i.x,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="v"||i.type==="V")i.type==="v"?e.y+=i.y:e.y=i.y,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="l"||i.type==="L")i.type==="l"?e.add(i):e.copy(i),t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="c"||i.type==="C")i.type==="c"?(t.bezierCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(t.bezierCurveTo(ie(e.x,r.x),ie(e.y,r.y),e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(ie(e.x,r.x),ie(e.y,r.y),i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(t.quadraticCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x,e.y+i.y),r.x=e.x+i.x1,r.y=e.y+i.y1,e.add(i)):(t.quadraticCurveTo(i.x1,i.y1,i.x,i.y),r.x=i.x1,r.y=i.y1,e.copy(i));else if(i.type==="t"||i.type==="T"){const a=ie(e.x,r.x),l=ie(e.y,r.y);r.x=a,r.y=l,i.type==="t"?(t.quadraticCurveTo(a,l,e.x+i.x,e.y+i.y),e.add(i)):(t.quadraticCurveTo(a,l,i.x,i.y),e.copy(i))}else if(i.type==="a"||i.type==="A"){const a=e.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;e.add(i)}else{if(e.equals(i))continue;e.copy(i)}r.copy(e),yo(t,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,e)}else i.type==="z"||i.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",i)}}const et={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(s,t,e=0){let a=0,l=!0,h="",c="";const u=[];function f(p,S,P){const C=new SyntaxError(`Unexpected character "${p}" at index ${S}.`);throw C.partial=P,C}function d(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let g;const m=s.length;for(let p=0;p<m;p++){if(g=s[p],Array.isArray(t)&&t.includes(u.length%e)&&et.FLAGS.test(g)){a=1,h=g,d();continue}if(a===0){if(et.WHITESPACE.test(g))continue;if(et.DIGIT.test(g)||et.SIGN.test(g)){a=1,h=g;continue}if(et.POINT.test(g)){a=2,h=g;continue}et.COMMA.test(g)&&(l&&f(g,p,u),l=!0)}if(a===1){if(et.DIGIT.test(g)){h+=g;continue}if(et.POINT.test(g)){h+=g,a=2;continue}if(et.EXP.test(g)){a=3;continue}et.SIGN.test(g)&&h.length===1&&et.SIGN.test(h[0])&&f(g,p,u)}if(a===2){if(et.DIGIT.test(g)){h+=g;continue}if(et.EXP.test(g)){a=3;continue}et.POINT.test(g)&&h[h.length-1]==="."&&f(g,p,u)}if(a===3){if(et.DIGIT.test(g)){c+=g;continue}if(et.SIGN.test(g)){if(c===""){c+=g;continue}c.length===1&&et.SIGN.test(c)&&f(g,p,u)}}et.WHITESPACE.test(g)?(d(),a=0,l=!1):et.COMMA.test(g)?(d(),a=0,l=!0):et.SIGN.test(g)?(d(),a=1,h=g):et.POINT.test(g)?(d(),a=2,h=g):f(g,p,u)}return d(),u}function mo(s){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=s.length;n<o;n++){const i=s[n];switch(i.type){case"m":case"M":if(i.x===e.x&&i.y===e.y)continue;r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y,t.x=i.x,t.y=i.y;break;case"h":case"H":r+=`${i.type} ${i.x}`,e.x=i.x;break;case"v":case"V":r+=`${i.type} ${i.y}`,e.y=i.y;break;case"l":case"L":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"c":case"C":r+=`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"s":case"S":r+=`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"q":case"Q":r+=`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"t":case"T":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"a":case"A":r+=`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"z":case"Z":r+=i.type,e.x=t.x,e.y=t.y;break}}return r}const wo=/[a-df-z][^a-df-z]*/gi;function An(s){const t=[],e=s.match(wo);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],i=o.charAt(0),a=o.slice(1).trim();let l;switch(i){case"m":case"M":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:i,x:l[h],y:l[h+1]}):t.push({type:i==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,x:l[h]});break;case"v":case"V":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,y:l[h]});break;case"l":case"L":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"c":case"C":l=Ut(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:i,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"a":case"A":l=Ut(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:i,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":t.push({type:i});break;default:console.warn(o)}}return t}var vo=Object.defineProperty,xo=(s,t,e)=>t in s?vo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Sr=(s,t,e)=>(xo(s,typeof t!="symbol"?t+"":t,e),e);class Yt{constructor(){Sr(this,"arcLengthDivisions",200),Sr(this,"_cacheArcLengths"),Sr(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new b){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}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}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),o=0;e.push(0);for(let i=1;i<=t;i++)r=this.getPoint(i/t),o+=r.distanceTo(n),e.push(o),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const o=r.length;let i;e?i=e:i=t*r[o-1];let a=0,l=o-1,h;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),h=r[n]-i,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===i)return n/(o-1);const c=r[n],f=r[n+1]-c,d=(i-c)/f;return(n+d)/(o-1)}getTangent(t,e=new b){const n=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new b){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,o=(r+n)/2;for(;n-r>e;){o=(r+n)/2;const i=this.getPoint(o);if(i.distanceTo(t)<e)return o;i.x<t.x?r=o:n=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new R(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}toData(){return mo(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function In(s,t,e,r,n){const o=(r-t)*.5,i=(n-e)*.5,a=s*s,l=s*a;return(2*e-2*r+o+i)*l+(-3*e+3*r-2*o-i)*a+o*s+e}function bo(s,t){const e=1-s;return e*e*t}function So(s,t){return 2*(1-s)*s*t}function Po(s,t){return s*s*t}function $n(s,t,e,r){return bo(s,t)+So(s,e)+Po(s,r)}function Co(s,t){const e=1-s;return e*e*e*t}function _o(s,t){const e=1-s;return 3*e*e*s*t}function Mo(s,t){return 3*(1-s)*s*s*t}function To(s,t){return s*s*s*t}function Bn(s,t,e,r,n){return Co(s,t)+_o(s,e)+Mo(s,r)+To(s,n)}class Oo extends Yt{constructor(t=new b,e=new b,r=new b,n=new b){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new b){const{start:r,startControl:n,endControl:o,end:i}=this;return e.set(Bn(t,r.x,n.x,o.x,i.x),Bn(t,r.y,n.y,o.y,i.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const o=Math.sqrt(n),i=(-e+o)/(2*t),a=(-e-o)/(2*t);return[i,a].filter(l=>l>=0&&l<=1)}getMinMax(t=b.MAX,e=b.MIN){const r=this.start,n=this.startControl,o=this.endControl,i=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(i.x-o.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(i.y-o.y)),h=[0,1,...a,...l];return((u,f)=>{for(const d of u)for(let g=0;g<=f;g++){const m=g/f-.5,p=Math.min(1,Math.max(0,d+m)),S=this.getPoint(p);t.x=Math.min(t.x,S.x),t.y=Math.min(t.y,S.y),e.x=Math.max(e.x,S.x),e.y=Math.max(e.y,S.y)}})(h,10),{min:t,max:e}}toCommands(){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{start:e,startControl:r,endControl:n,end:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,o.x,o.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 Ao=new St,Dn=new St,Un=new St,Xe=new b;class Io extends Yt{constructor(t=new b,e=1,r=1,n=0,o=0,i=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=i,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new b){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(o?n=0:n=r),this.clockwise&&!o&&(n===r?n=-r:n=n-r);const i=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(i),l=this.center.y+this.radiusY*Math.sin(i);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,f=l-this.center.y;a=u*h-f*c+this.center.x,l=u*c+f*h+this.center.y}return e.set(a,l)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:i,rotation:a}=this,{x:l,y:h}=t,c=l+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=h+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),f=Math.abs(n-o),d=f>Math.PI?1:0,g=i?1:0,m=a*180/Math.PI;if(f>=2*Math.PI){const p=n+Math.PI,S=l+e*Math.cos(p)*Math.cos(a)-r*Math.sin(p)*Math.sin(a),P=h+e*Math.cos(p)*Math.sin(a)+r*Math.sin(p)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:S,y:P},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const p=l+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),S=h+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:d,sweepFlag:g,x:p,y:S}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:i,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,n,o,i,a,!l),this}matrix(t){return Xe.set(this.center.x,this.center.y),Xe.applyMatrix3(t),this.center.x=Xe.x,this.center.y=Xe.y,Do(t)?$o(this,t):Bo(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){const{center:r,radiusX:n,radiusY:o,rotation:i}=this,{x:a,y:l}=r,h=Math.cos(i),c=Math.sin(i),u=Math.sqrt(n*n*h*h+o*o*c*c),f=Math.sqrt(n*n*c*c+o*o*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,l-f),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,l+f),{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 $o(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),o=Math.sin(s.rotation),i=new b(e*n,e*o),a=new b(-r*o,r*n),l=i.applyMatrix3(t),h=a.applyMatrix3(t),c=Ao.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=Dn.copy(c).invert(),g=Un.copy(u).transpose().multiply(u).elements,m=Uo(g[0],g[1],g[4]),p=Math.sqrt(m.rt1),S=Math.sqrt(m.rt2);if(s.radiusX=1/p,s.radiusY=1/S,s.rotation=Math.atan2(m.sn,m.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const C=Dn.set(p,0,0,0,S,0,0,0,1),x=Un.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),v=C.multiply(x).multiply(c),w=D=>{const{x:_,y:M}=new b(Math.cos(D),Math.sin(D)).applyMatrix3(v);return Math.atan2(M,_)};s.startAngle=w(s.startAngle),s.endAngle=w(s.endAngle),En(t)&&(s.clockwise=!s.clockwise)}}function Bo(s,t){const e=kn(t),r=Ln(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,En(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function En(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Do(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=kn(s),n=Ln(s);return Math.abs(e/(r*n))>Number.EPSILON}function kn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ln(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Uo(s,t,e){let r,n,o,i,a;const l=s+e,h=s-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,n=s*a*e-t*a*t):l<0?n=.5*(l-c):(r=.5*c,n=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,i=1/Math.sqrt(1+a*a),o=a*i):Math.abs(t)===0?(o=1,i=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),i=a*o),h>0&&(a=o,o=-i,i=a),{rt1:r,rt2:n,cs:o,sn:i}}class Pr extends Yt{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).scale(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)}getControlPoints(){return[this.start,this.end]}getMinMax(t=b.MAX,e=b.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}}toCommands(){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{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class Eo extends Yt{constructor(t=new b,e=new b,r=new b){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new b){const{start:r,control:n,end:o}=this;return e.set($n(t,r.x,n.x,o.x),$n(t,r.y,n.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=b.MAX,e=b.MIN){const{start:r,control:n,end:o}=this,i=.5*(r.x+n.x),a=.5*(r.y+n.y),l=.5*(r.x+o.x),h=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,i,l),t.y=Math.min(t.y,r.y,o.y,a,h),e.x=Math.max(e.x,r.x,o.x,i,l),e.y=Math.max(e.y,r.y,o.y,a,h),{min:t,max:e}}toCommands(){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{start:e,control:r,end:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.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 ko=Object.defineProperty,Lo=(s,t,e)=>t in s?ko(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fn=(s,t,e)=>(Lo(s,typeof t!="symbol"?t+"":t,e),e);class Fo extends Yt{constructor(t,e,r=1,n=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=o,Fn(this,"curves",[]),Fn(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,o=[new b(t-r,e-n),new b(t+r,e-n),new b(t+r,e+n),new b(t-r,e+n)];for(let i=0;i<4;i++)this.curves.push(new Pr(o[i].clone(),o[(i+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)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class No extends Yt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new b){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),i=n-o,a=r[o===0?o:o-1],l=r[o],h=r[o>r.length-2?r.length-1:o+1],c=r[o>r.length-3?r.length-1:o+2];return e.set(In(i,a.x,l.x,h.x,c.x),In(i,a.y,l.y,h.y,c.y)),e}getControlPoints(){return this.points}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 zo=Object.defineProperty,qo=(s,t,e)=>t in s?zo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ce=(s,t,e)=>(qo(s,typeof t!="symbol"?t+"":t,e),e);class _e extends Yt{constructor(t){super(),Ce(this,"curves",[]),Ce(this,"startPoint"),Ce(this,"currentPoint",new b),Ce(this,"autoClose",!1),Ce(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:o}=t[e];this.lineTo(n,o)}return this}addCommands(t){return On(t,this),this}addData(t){return this.addCommands(An(t)),this}getPoint(t,e=new b){const r=t*this.getLength(),n=this.getCurveLengths();let o=0;for(;o<n.length;){if(n[o]>=r){const i=n[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-i/l,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}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 o=0,i=r.length;o<i;o++){const l=r[o].getPoints(t);for(let h=0;h<l.length;h++){const c=l[h];n!=null&&n.equals(c)||(e.push(c),n=c)}}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 Pr(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 Pr(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPoint.equals({x:o,y:i})||this.curves.push(new Oo(this.currentPoint.clone(),new b(t,e),new b(r,n),new b(o,i))),this._setCurrentPoint({x:o,y:i}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new Eo(this.currentPoint.clone(),new b(t,e),new b(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,i){return this.ellipse(t,e,r,r,0,n,o,i),this}relativeArc(t,e,r,n,o,i){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,i),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,i,a,l=!0){const h=new Io(new b(t,e),r,n,o,i,a,!l);if(this.curves.length>0){const c=h.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,e,r,n,o,i,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,n,o,i,a,l),this}rect(t,e,r,n){return this.curves.push(new Fo(new b(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new No([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new R(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}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 Go(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Ro(s,t,e,r){const n=t.clone().sub(s),o=r.clone().sub(e),i=e.clone().sub(s),a=n.cross(o);if(a===0)return new b((s.x+e.x)/2,(s.y+e.y)/2);const l=i.cross(o)/a;return Math.abs(l)>1?new b((s.x+e.x)/2,(s.y+e.y)/2):new b(s.x+l*n.x,s.y+l*n.y)}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,Cr=(s,t,e)=>(Vo(s,typeof t!="symbol"?t+"":t,e),e);class Pt{constructor(t,e={}){Cr(this,"currentPath",new _e),Cr(this,"paths",[this.currentPath]),Cr(this,"style"),t&&(t instanceof Pt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t)),this.style=e}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 Pt?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 _e().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 _e().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,o,i){return this.currentPath.bezierCurveTo(t,e,r,n,o,i),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,i){return this.currentPath.arc(t,e,r,n,o,i),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,i,a,l){return this.currentPath.ellipse(t,e,r,n,o,i,a,l),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return On(t,this),this}addData(t){return this.addCommands(An(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],n=[],o=[];e.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();o[l]=h,n[l]=c;const u=h[0],f=h[h.length-1]??u;r.push({start:c?f:u,end:c?u:f,index:l})});const i=[];return r.forEach((a,l)=>{i[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&i[l].push(h.index)})}),e.forEach((a,l)=>{const h=n[l];o[l].forEach(u=>{const f=a.getTForPoint(u),d=a.getNormal(f).scale(h?t:-t);u.add(d)})}),i.forEach((a,l)=>{const h=o[l];a.forEach(c=>{const u=o[c],f=Ro(h[h.length-1],h[h.length-2]??h[h.length-1],u[0],u[1]??u[0]);f&&(h[h.length-1].copy(f),u[0].copy(f))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=b.MAX,e=b.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(o=>{if(o.getMinMax(t,e),r&&n>1){const i=n/2,a=o.isClockwise(),l=[];for(let h=0;h<=1;h+=1/o.arcLengthDivisions){const c=o.getPoint(h),u=o.getNormal(h),f=u.clone().scale(a?i:-i),d=u.clone().scale(a?-i:i);l.push(c.clone().add(f),c.clone().add(d),c.clone().add({x:i,y:0}),c.clone().add({x:-i,y:0}),c.clone().add({x:0,y:i}),c.clone().add({x:0,y:-i}),c.clone().add({x:i,y:i}),c.clone().add({x:-i,y:-i}))}t.min(...l),e.max(...l)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new R(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),Mn(t,e),this.paths.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),Mn(t,e),this.getControlPoints().forEach(o=>{t.moveTo(o.x,o.y),t.arc(o.x,o.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){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[Go(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.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),o=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:i,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=i*e,l.height=a*e,l.style.width=`${i}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-n,-o),this.drawTo(h,r)),l}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const _r="px",Nn=90,zn=["mm","cm","in","pt","pc","px"],Mr={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 V(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=zn.length;r<n;r++){const o=zn[r];if(s.endsWith(o)){t=o,s=s.substring(0,s.length-o.length);break}}let e;return t==="px"&&_r!=="px"?e=Mr.in[_r]/Nn:(e=Mr[t][_r],e<0&&(e=Mr[t].in*Nn)),e*Number.parseFloat(s)}const Xo=new St,je=new St,qn=new St,Gn=new St;function jo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Ho(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ho(s){const t=new St,e=Xo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(V(s.getAttribute("x")),V(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const i=o.indexOf("("),a=o.length;if(i>0&&i<a){const l=o.slice(0,i),h=Ut(o.slice(i+1));switch(e.identity(),l){case"translate":if(h.length>=1){const c=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(c,u)}break;case"rotate":if(h.length>=1){let c=0,u=0,f=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],f=h[2]),je.makeTranslation(-u,-f),qn.makeRotation(c),Gn.multiplyMatrices(qn,je),je.makeTranslation(u,f),e.multiplyMatrices(je,Gn)}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 Yo(s){return new Pt().addPath(new _e().arc(V(s.getAttribute("cx")||0),V(s.getAttribute("cy")||0),V(s.getAttribute("r")||0),0,Math.PI*2))}function Zo(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()),o={};for(let i=r.style.length,a=0;a<i;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let i=0;i<n.length;i++)t[n[i]]=Object.assign(t[n[i]]||{},{...o})}}function Ko(s){return new Pt().addPath(new _e().ellipse(V(s.getAttribute("cx")||0),V(s.getAttribute("cy")||0),V(s.getAttribute("rx")||0),V(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Qo(s){return new Pt().moveTo(V(s.getAttribute("x1")||0),V(s.getAttribute("y1")||0)).lineTo(V(s.getAttribute("x2")||0),V(s.getAttribute("y2")||0))}function Jo(s){const t=new Pt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const ta=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ea(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(ta,(n,o,i)=>{const a=V(o),l=V(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!0,t}const ra=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function na(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(ra,(n,o,i)=>{const a=V(o),l=V(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!1,t}function sa(s){const t=V(s.getAttribute("x")||0),e=V(s.getAttribute("y")||0),r=V(s.getAttribute("rx")||s.getAttribute("ry")||0),n=V(s.getAttribute("ry")||s.getAttribute("rx")||0),o=V(s.getAttribute("width")),i=V(s.getAttribute("height")),a=1-.551915024494,l=new Pt;return l.moveTo(t+r,e),l.lineTo(t+o-r,e),(r!==0||n!==0)&&l.bezierCurveTo(t+o-r*a,e,t+o,e+n*a,t+o,e+n),l.lineTo(t+o,e+i-n),(r!==0||n!==0)&&l.bezierCurveTo(t+o,e+i-n*a,t+o-r*a,e+i,t+o-r,e+i),l.lineTo(t+r,e+i),(r!==0||n!==0)&&l.bezierCurveTo(t+r*a,e+i,t,e+i-n*a,t,e+i-n),l.lineTo(t,e+n),(r!==0||n!==0)&&l.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),l}function Et(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)r=Object.assign(r,e[`.${h[c]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let h=s.style.length,c=0;c<h;c++){const u=s.style.item(c),f=s.style.getPropertyValue(u);t[u]=f,r[u]=f}function n(h,c,u=o){s.hasAttribute(h)&&(t[c]=u(s.getAttribute(h))),r[h]&&(t[c]=u(r[h]))}function o(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function i(h){return Math.max(0,Math.min(1,V(h)))}function a(h){return Math.max(0,V(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>V(c))}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",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",l),n("stroke-dashoffset","strokeDashoffset",V),n("visibility","visibility"),t}function Tr(s,t,e=[],r={}){var u;if(s.nodeType!==1)return e;let n=!1,o=null,i={...t};switch(s.nodeName){case"svg":i=Et(s,i,r);break;case"style":Zo(s,r);break;case"g":i=Et(s,i,r);break;case"path":i=Et(s,i,r),s.hasAttribute("d")&&(o=Jo(s));break;case"rect":i=Et(s,i,r),o=sa(s);break;case"polygon":i=Et(s,i,r),o=ea(s);break;case"polyline":i=Et(s,i,r),o=na(s);break;case"circle":i=Et(s,i,r),o=Yo(s);break;case"ellipse":i=Et(s,i,r),o=Ko(s);break;case"line":i=Et(s,i,r),o=Qo(s);break;case"defs":n=!0;break;case"use":{i=Et(s,i,r);const d=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=s.viewportElement)==null?void 0:u.getElementById(d);g?Tr(g,i,e,r):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(s);break}if(i.display==="none")return e;Object.assign(t,i);const a=new St,l=[],h=jo(s,a,l);o&&(o.matrix(a),e.push(o),o.style=t);const c=s.childNodes;for(let f=0,d=c.length;f<d;f++){const g=c[f];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Tr(g,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Rn="data:image/svg+xml;",Wn=`${Rn}base64,`,Vn=`${Rn}charset=utf8,`;function Xn(s){if(typeof s=="string"){let t;return s.startsWith(Wn)?(s=s.substring(Wn.length,s.length),t=atob(s)):s.startsWith(Vn)?(s=s.substring(Vn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function jn(s){return Tr(Xn(s),{})}function He(s,t=!0){if(!s.length)return;const e=b.MAX,r=b.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new R(e.x,e.y,r.x-e.x,r.y-e.y)}const ia=new Set(["©","®","÷"]),oa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),aa={1:"italic",32:"bold"},la={1:"italic",2:"bold"},Hn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Yn{constructor(t,e,r){$(this,"path",new Pt);$(this,"lineBox",new R);$(this,"inlineBox",new R);$(this,"glyphBox");$(this,"advanceWidth",0);$(this,"advanceHeight",0);$(this,"underlinePosition",0);$(this,"underlineThickness",0);$(this,"strikeoutPosition",0);$(this,"strikeoutSize",0);$(this,"ascender",0);$(this,"descender",0);$(this,"typoAscender",0);$(this,"typoDescender",0);$(this,"typoLineGap",0);$(this,"winAscent",0);$(this,"winDescent",0);$(this,"xHeight",0);$(this,"capHeight",0);$(this,"baseline",0);$(this,"centerDiviation",0);$(this,"fontStyle");this.content=t,this.index=e,this.parent=r}get center(){var t;return(t=this.glyphBox)==null?void 0:t.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSfnt(t){const e=this.computedStyle.fontFamily,r=t??co,n=e?r.get(e):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{hhea:e,os2:r,post:n,head:o}=t,i=o.unitsPerEm,a=e.ascent,l=e.descent,{content:h,computedStyle:c,isVertical:u}=this,{fontSize:f}=c,d=i/f,g=t.getAdvanceWidth(h,f),m=(a+Math.abs(l))/d,p=a/d;return this.advanceWidth=g,this.advanceHeight=m,this.inlineBox.width=u?m:g,this.inlineBox.height=u?g:m,this.underlinePosition=(a-n.underlinePosition)/d,this.underlineThickness=n.underlineThickness/d,this.strikeoutPosition=(a-r.yStrikeoutPosition)/d,this.strikeoutSize=r.yStrikeoutSize/d,this.ascender=a/d,this.descender=l/d,this.typoAscender=r.sTypoAscender/d,this.typoDescender=r.sTypoDescender/d,this.typoLineGap=r.sTypoLineGap/d,this.winAscent=r.usWinAscent/d,this.winDescent=r.usWinDescent/d,this.xHeight=r.sxHeight/d,this.capHeight=r.sCapHeight/d,this.baseline=p,this.centerDiviation=m/2-p,this.fontStyle=aa[r.fsSelection]??la[o.macStyle],this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:n,computedStyle:o,baseline:i,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u,advanceWidth:f,advanceHeight:d}=this,{left:g,top:m}=a,p=o.fontStyle==="italic"&&u!=="italic";let S=g,P=m+i,C;const x=new Pt;if(r&&(S+=(d-f)/2,Math.abs(f-d)>.1&&(P-=(l-c)/(l+Math.abs(h))*d),C=void 0),r&&!ia.has(n)&&(n.codePointAt(0)<=256||oa.has(n))){x.addCommands(e.getPathCommands(n,S,m+i-(d-f)/2,o.fontSize));const w={y:m-(d-f)/2+d/2,x:S+f/2};p&&this._italic(x,r?{x:w.x,y:m-(d-f)/2+i}:void 0),x.rotate(90,w)}else C!==void 0?(x.addCommands(e.glyphs.get(C).getPathCommands(S,P,o.fontSize)),p&&this._italic(x,r?{x:S+f/2,y:m+c/(l+Math.abs(h))*d}:void 0)):(x.addCommands(e.getPathCommands(n,S,P,o.fontSize)),p&&this._italic(x,r?{x:S+d/2,y:P}:void 0));const v=o.fontWeight??400;return v in Hn&&(v===700||v==="bold")&&u!=="bold"&&x.bold(Hn[v]*o.fontSize*.05),x.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=x,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(t,e){t.skew(-.24,0,e||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(t,e,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(t,e,r)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:r,max:n}=e;return new R(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){const r=this.computedStyle;Jt({ctx:t,path:this.path,fontSize:r.fontSize,color:r.color,...e})}}function Zt(s){return!s||s==="none"}function Zn(s,t){const e=Object.keys(s),r=Object.keys(t);return Array.from(new Set([...e,...r])).every(o=>s[o]===t[o])}function Me(s){const t=s.startsWith("#")?s.slice(1):s;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const r=t.length===3?t.split("").map(a=>a+a).join(""):t,n=Number.parseInt(r.slice(0,2),16),o=Number.parseInt(r.slice(2,4),16),i=Number.parseInt(r.slice(4,6),16);return`rgb(${n}, ${o}, ${i})`}function Ye(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}class Kn{constructor(t,e={},r){$(this,"inlineBox",new R);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,...Ye(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Yn(r,e++,this));return this.characters=t,this}}class oe{constructor(t,e){$(this,"lineBox",new R);$(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Ye(this.parentStyle),...Ye(this.style)},this}addFragment(t,e){const r=new Kn(t,e,this);return this.fragments.push(r),r}}function ha(s){return s}class Qn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","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,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(i=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(i.style)),i.fragments.forEach(l=>{const h=document.createElement("span");Object.assign(h.style,this._styleToDomStyle(l.style)),h.appendChild(document.createTextNode(l.content)),/\s/.test(l.content)&&(h.style.whiteSpace="pre"),a.appendChild(h)}),o.appendChild(a)}),n.appendChild(o),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var i;return(i=n.parentNode)==null?void 0:i.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,i)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((l,h)=>{var f;const c=l.getBoundingClientRect();r.push({paragraphIndex:i,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});const u=l.firstChild;if(u instanceof window.Text){const d=document.createRange();d.selectNodeContents(u);const g=u.data?u.data.length:0;let m=0;for(;m<=g;){d.setStart(u,Math.max(m-1,0)),d.setEnd(u,m);const p=((f=d.getClientRects)==null?void 0:f.call(d))??[d.getBoundingClientRect()];let S=p[p.length-1];p.length>1&&S.width<2&&(S=p[p.length-2]);const P=d.toString();P!==""&&S&&S.width+S.height!==0&&n.push({content:P,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:m-1,top:S.top,left:S.left,height:S.height,width:S.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=this._measureDom(t);n.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),n.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let i=0;return n.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const u=e[l].fragments[h].characters[c],{fontHeight:f,isVertical:d}=u,g=o[i];u.inlineBox.left=g.left,u.inlineBox.top=g.top,u.inlineBox.width=g.width,u.inlineBox.height=g.height,d?(u.lineBox.left=g.left+(g.width-f)/2,u.lineBox.top=g.top,u.lineBox.width=f,u.lineBox.height=g.height):(u.lineBox.left=g.left,u.lineBox.top=g.top+(g.height-f)/2,u.lineBox.width=g.width,u.lineBox.height=f),i++}),{paragraphs:e,boundingBox:new R(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}}function ca(s,t,e){if(s==="cover")return 0;if(typeof s=="string")if(s.endsWith("%")){const r=Number(s.substring(0,s.length-1))/100;return Math.ceil(r*e/t)}else return s.endsWith("rem")?Number(s.substring(0,s.length-3)):Math.ceil(Number(s)/t);else return Math.ceil(s/t)}function ua(s,t,e){return typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Jn(){const s=[],t=[],e=new Map;function r(n){let o=e.get(n);if(!o){const i=Xn(n),a=jn(i);o={dom:i,paths:a},e.set(n,o)}return o}return{name:"highlight",paths:s,update:n=>{s.length=0;const o=[];let i,a;n.forEachCharacter(l=>{const{isVertical:h,computedStyle:c,inlineBox:u,fontSize:f}=l;!Zt(c.highlightImage)&&l.glyphBox&&(c.highlightSize!=="1rem"&&(!a||a.highlightImage===c.highlightImage&&Zn(a.highlightImageColors,c.highlightImageColors)&&a.highlightLine===c.highlightLine&&a.highlightSize===c.highlightSize&&a.highlightThickness===c.highlightThickness&&a.highlightOverflow===c.highlightOverflow)&&(i!=null&&i.length)&&(h?i[0].inlineBox.left===u.left:i[0].inlineBox.top===u.top)&&i[0].fontSize===f?i.push(l):(i=[],i.push(l),o.push(i))),a=c}),o.filter(l=>l.length).map(l=>({char:l[0],groupBox:R.from(...l.map(c=>c.glyphBox))})).forEach(l=>{const{char:h,groupBox:c}=l,{computedStyle:u}=h,{fontSize:f,writingMode:d,highlightThickness:g,highlightSize:m,highlightLine:p,highlightOverflow:S,highlightImage:P,highlightImageColors:C}=u,x=d.includes("vertical"),v=ua(g,f,c.width),w=ca(m,f,c.width),D=Zt(S)?w?"hidden":"visible":S,_=Object.keys(C).reduce((B,N)=>{let z=C[N];const nt=Me(N),T=Me(z);return nt&&(N=nt),T&&(z=T),B[N]=z,B},{}),{paths:M,dom:H}=r(P),U=He(M,!0),q=f/U.width*2,I=new R().copy(c);I.width=w?f*w:x?c.height:c.width,I.height=x?c.width:c.height;const E=x?I.height:I.width;let k;if(Zt(p))if(U.width/U.height>4){k="underline";const B=H.getAttribute("viewBox");if(B){const N=U.y+U.height/2,[z,nt,T,Z]=B.split(" ").map(X=>Number(X)),G=nt+Z/2;U.y<G&&U.y+U.height>G?k="line-through":G>N?k="overline":k="underline"}}else k="outline";else k=p;switch(k){case"outline":{const B=I.width*.2,N=I.height*.2;I.width+=B,I.height+=N,x?(I.x-=N/2,I.y-=B/2,I.x+=I.height):(I.x-=B/2,I.y-=N/2);break}case"overline":I.height=U.height*q,x?I.x=h.inlineBox.left+h.inlineBox.width:I.y=h.inlineBox.top;break;case"line-through":I.height=U.height*q,x?I.x=h.inlineBox.left+h.inlineBox.width-h.strikeoutPosition+I.height/2:I.y=h.inlineBox.top+h.strikeoutPosition-I.height/2;break;case"underline":I.height=U.height*q,x?I.x=h.inlineBox.left+h.inlineBox.width-h.underlinePosition:I.y=h.inlineBox.top+h.underlinePosition;break}const W=new St().translate(-U.x,-U.y).scale(I.width/U.width,I.height/U.height);x&&W.rotate(-Math.PI/2),W.translate(I.x,I.y);for(let B=0,N=Math.ceil(c.width/E);B<N;B++){const z=W.clone().translate(B*E,0);M.forEach(nt=>{const T=nt.clone().matrix(z);T.style.strokeWidth&&(T.style.strokeWidth*=q*v),T.style.strokeMiterlimit&&(T.style.strokeMiterlimit*=q),T.style.strokeDashoffset&&(T.style.strokeDashoffset*=q),T.style.strokeDasharray&&(T.style.strokeDasharray=T.style.strokeDasharray.map(Z=>Z*q)),T.style.fill&&T.style.fill in _&&(T.style.fill=_[T.style.fill]),T.style.stroke&&T.style.stroke in _&&(T.style.stroke=_[T.style.stroke]),s.push(T),t[s.length-1]=D==="hidden"?new R(c.left,c.top-c.height,c.width,c.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{s.forEach((i,a)=>{if(Jt({ctx:n,path:i,clipRect:t[a],fontSize:o.computedStyle.fontSize}),o.debug){const l=He([i]);l&&n.strokeRect(l.x,l.y,l.width,l.height)}})}}}function ts(s,t,e){return s==="cover"?1:typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function es(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,o=n*.45;e.forEach(i=>{const{computedStyle:a}=i,{listStyleImage:l,listStyleImageColors:h,listStyleSize:c,listStyleType:u,color:f}=a,d=Object.keys(h).reduce((x,v)=>{let w=h[v];const D=Me(v),_=Me(w);return D&&(v=D),_&&(w=_),x[v]=w,x},{});let g=c,m;if(!Zt(l))m=l;else if(!Zt(u)){const x=n*.38/2;switch(g=g==="cover"?x*2:g,u){case"disc":m=`<svg width="${x*2}" height="${x*2}" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
}`)),document.head.appendChild(r),this}get(t){let e;return t&&(e=this.loaded.get(this.familyToUrl.get(t)??t)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){const e=this.familyToUrl.get(t)??t;return this.familyToUrl.delete(e),this.loaded.delete(e),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...i}=e,{src:a}=t;if(this.loaded.has(a))return r&&(this.loading.forEach(f=>f.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,i),this.loading.set(a,l)),r&&this.loading.forEach((f,d)=>{f!==l&&(f.cancel(),this.loading.delete(d))}),l.when.then(f=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const d=u(f);return e.noAdd||this.loaded.set(t.src,d),d.familySet.forEach(g=>{this.familyToUrl.set(g,a),typeof document<"u"&&(n&&this.injectFontFace(g,f),o&&this.injectStyleTag(g,a))}),d}}).catch(f=>{if(f instanceof DOMException&&f.message==="The user aborted a request.")return u();throw f}).finally(()=>{this.loading.delete(a)});function h(){return t.family?Array.isArray(t.family)?t.family:[t.family]:[]}function c(f){return h().forEach(d=>{f.familySet.add(d)}),f}function u(f=new ArrayBuffer(0)){let d;function g(){return d||(d=f.byteLength?oo(f,!1):void 0),d}function m(){const p=g();if(p instanceof It||p instanceof xr)return p.sfnt}return{...t,buffer:f,familySet:new Set(h()),getFont:g,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}};Pe(_n,"defaultRequestInit",{cache:"force-cache"});let ho=_n;const co=new ho,uo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Mn(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:d="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=o,s.lineJoin=uo[i],s.miterLimit=a,s.setLineDash(l),s.lineDashOffset=h,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=f,s.shadowColor=d}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)}get array(){return[this.x,this.y]}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}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,o=-(this.y-e.y),i=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*i),e.y-(n*i+o*a)),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}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,o=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}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 b(this.x,this.y)}}class G{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}get center(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new G;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,o)=>(n.left=Math.min(n.left,o.left),n.top=Math.min(n.top,o.top),n.right=Math.max(n.right,o.right),n.bottom=Math.max(n.bottom,o.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 G(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new G(this.left,this.top,this.width,this.height)}}var fo=Object.defineProperty,po=(s,t,e)=>t in s?fo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,go=(s,t,e)=>(po(s,t+"",e),e);class St{constructor(t=1,e=0,r=0,n=0,o=1,i=0,a=0,l=0,h=1){go(this,"elements",[]),this.set(t,e,r,n,o,i,a,l,h)}set(t,e,r,n,o,i,a,l,h){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=o,c[5]=l,c[6]=r,c[7]=i,c[8]=h,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,o=this.elements,i=r[0],a=r[3],l=r[6],h=r[1],c=r[4],u=r[7],f=r[2],d=r[5],g=r[8],m=n[0],p=n[3],S=n[6],P=n[1],C=n[4],x=n[7],v=n[2],w=n[5],D=n[8];return o[0]=i*m+a*P+l*v,o[3]=i*p+a*C+l*w,o[6]=i*S+a*x+l*D,o[1]=h*m+c*P+u*v,o[4]=h*p+c*C+u*w,o[7]=h*S+c*x+u*D,o[2]=f*m+d*P+g*v,o[5]=f*p+d*C+g*w,o[8]=f*S+d*x+g*D,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*i-a*h,f=a*l-c*o,d=h*o-i*l,g=e*u+r*f+n*d;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]=(n*h-c*r)*m,t[2]=(a*r-n*i)*m,t[3]=f*m,t[4]=(c*e-n*l)*m,t[5]=(n*o-a*e)*m,t[6]=d*m,t[7]=(r*l-h*e)*m,t[8]=(i*e-r*o)*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(br.makeScale(t,e)),this}rotate(t){return this.premultiply(br.makeRotation(-t)),this}translate(t,e){return this.premultiply(br.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 br=new St;function Tn(s,t,e,r){const n=s*e+t*r,o=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let i=Math.acos(Math.max(-1,Math.min(1,n/o)));return s*r-t*e<0&&(i=-i),i}function yo(s,t,e,r,n,o,i,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 l=(i.x-a.x)/2,h=(i.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,u=-Math.sin(r)*l+Math.cos(r)*h;let f=t*t,d=e*e;const g=c*c,m=u*u,p=g/f+m/d;if(p>1){const H=Math.sqrt(p);t=H*t,e=H*e,f=t*t,d=e*e}const S=f*m+d*g,P=(f*d-S)/S;let C=Math.sqrt(Math.max(0,P));n===o&&(C=-C);const x=C*t*u/e,v=-C*e*c/t,w=Math.cos(r)*x-Math.sin(r)*v+(i.x+a.x)/2,D=Math.sin(r)*x+Math.cos(r)*v+(i.y+a.y)/2,_=Tn(1,0,(c-x)/t,(u-v)/e),M=Tn((c-x)/t,(u-v)/e,(-c-x)/t,(-u-v)/e)%(Math.PI*2);s.ellipse(w,D,t,e,r,_,_+M,o===1)}function ie(s,t){return s-(t-s)}function On(s,t){const e=new b,r=new b;for(let n=0,o=s.length;n<o;n++){const i=s[n];if(i.type==="m"||i.type==="M")i.type==="m"?e.add(i):e.copy(i),t.moveTo(e.x,e.y),r.copy(e);else if(i.type==="h"||i.type==="H")i.type==="h"?e.x+=i.x:e.x=i.x,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="v"||i.type==="V")i.type==="v"?e.y+=i.y:e.y=i.y,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="l"||i.type==="L")i.type==="l"?e.add(i):e.copy(i),t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="c"||i.type==="C")i.type==="c"?(t.bezierCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(t.bezierCurveTo(ie(e.x,r.x),ie(e.y,r.y),e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(ie(e.x,r.x),ie(e.y,r.y),i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(t.quadraticCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x,e.y+i.y),r.x=e.x+i.x1,r.y=e.y+i.y1,e.add(i)):(t.quadraticCurveTo(i.x1,i.y1,i.x,i.y),r.x=i.x1,r.y=i.y1,e.copy(i));else if(i.type==="t"||i.type==="T"){const a=ie(e.x,r.x),l=ie(e.y,r.y);r.x=a,r.y=l,i.type==="t"?(t.quadraticCurveTo(a,l,e.x+i.x,e.y+i.y),e.add(i)):(t.quadraticCurveTo(a,l,i.x,i.y),e.copy(i))}else if(i.type==="a"||i.type==="A"){const a=e.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;e.add(i)}else{if(e.equals(i))continue;e.copy(i)}r.copy(e),yo(t,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,e)}else i.type==="z"||i.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",i)}}const et={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(s,t,e=0){let a=0,l=!0,h="",c="";const u=[];function f(p,S,P){const C=new SyntaxError(`Unexpected character "${p}" at index ${S}.`);throw C.partial=P,C}function d(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let g;const m=s.length;for(let p=0;p<m;p++){if(g=s[p],Array.isArray(t)&&t.includes(u.length%e)&&et.FLAGS.test(g)){a=1,h=g,d();continue}if(a===0){if(et.WHITESPACE.test(g))continue;if(et.DIGIT.test(g)||et.SIGN.test(g)){a=1,h=g;continue}if(et.POINT.test(g)){a=2,h=g;continue}et.COMMA.test(g)&&(l&&f(g,p,u),l=!0)}if(a===1){if(et.DIGIT.test(g)){h+=g;continue}if(et.POINT.test(g)){h+=g,a=2;continue}if(et.EXP.test(g)){a=3;continue}et.SIGN.test(g)&&h.length===1&&et.SIGN.test(h[0])&&f(g,p,u)}if(a===2){if(et.DIGIT.test(g)){h+=g;continue}if(et.EXP.test(g)){a=3;continue}et.POINT.test(g)&&h[h.length-1]==="."&&f(g,p,u)}if(a===3){if(et.DIGIT.test(g)){c+=g;continue}if(et.SIGN.test(g)){if(c===""){c+=g;continue}c.length===1&&et.SIGN.test(c)&&f(g,p,u)}}et.WHITESPACE.test(g)?(d(),a=0,l=!1):et.COMMA.test(g)?(d(),a=0,l=!0):et.SIGN.test(g)?(d(),a=1,h=g):et.POINT.test(g)?(d(),a=2,h=g):f(g,p,u)}return d(),u}function mo(s){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=s.length;n<o;n++){const i=s[n];switch(i.type){case"m":case"M":if(i.x===e.x&&i.y===e.y)continue;r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y,t.x=i.x,t.y=i.y;break;case"h":case"H":r+=`${i.type} ${i.x}`,e.x=i.x;break;case"v":case"V":r+=`${i.type} ${i.y}`,e.y=i.y;break;case"l":case"L":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"c":case"C":r+=`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"s":case"S":r+=`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"q":case"Q":r+=`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"t":case"T":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"a":case"A":r+=`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"z":case"Z":r+=i.type,e.x=t.x,e.y=t.y;break}}return r}const wo=/[a-df-z][^a-df-z]*/gi;function An(s){const t=[],e=s.match(wo);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],i=o.charAt(0),a=o.slice(1).trim();let l;switch(i){case"m":case"M":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:i,x:l[h],y:l[h+1]}):t.push({type:i==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,x:l[h]});break;case"v":case"V":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,y:l[h]});break;case"l":case"L":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"c":case"C":l=Ut(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:i,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"a":case"A":l=Ut(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:i,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":t.push({type:i});break;default:console.warn(o)}}return t}var vo=Object.defineProperty,xo=(s,t,e)=>t in s?vo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Sr=(s,t,e)=>(xo(s,typeof t!="symbol"?t+"":t,e),e);class Yt{constructor(){Sr(this,"arcLengthDivisions",200),Sr(this,"_cacheArcLengths"),Sr(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new b){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}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}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),o=0;e.push(0);for(let i=1;i<=t;i++)r=this.getPoint(i/t),o+=r.distanceTo(n),e.push(o),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const o=r.length;let i;e?i=e:i=t*r[o-1];let a=0,l=o-1,h;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),h=r[n]-i,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===i)return n/(o-1);const c=r[n],f=r[n+1]-c,d=(i-c)/f;return(n+d)/(o-1)}getTangent(t,e=new b){const n=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new b){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,o=(r+n)/2;for(;n-r>e;){o=(r+n)/2;const i=this.getPoint(o);if(i.distanceTo(t)<e)return o;i.x<t.x?r=o:n=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new G(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}toData(){return mo(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function In(s,t,e,r,n){const o=(r-t)*.5,i=(n-e)*.5,a=s*s,l=s*a;return(2*e-2*r+o+i)*l+(-3*e+3*r-2*o-i)*a+o*s+e}function bo(s,t){const e=1-s;return e*e*t}function So(s,t){return 2*(1-s)*s*t}function Po(s,t){return s*s*t}function $n(s,t,e,r){return bo(s,t)+So(s,e)+Po(s,r)}function Co(s,t){const e=1-s;return e*e*e*t}function _o(s,t){const e=1-s;return 3*e*e*s*t}function Mo(s,t){return 3*(1-s)*s*s*t}function To(s,t){return s*s*s*t}function Bn(s,t,e,r,n){return Co(s,t)+_o(s,e)+Mo(s,r)+To(s,n)}class Oo extends Yt{constructor(t=new b,e=new b,r=new b,n=new b){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new b){const{start:r,startControl:n,endControl:o,end:i}=this;return e.set(Bn(t,r.x,n.x,o.x,i.x),Bn(t,r.y,n.y,o.y,i.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const o=Math.sqrt(n),i=(-e+o)/(2*t),a=(-e-o)/(2*t);return[i,a].filter(l=>l>=0&&l<=1)}getMinMax(t=b.MAX,e=b.MIN){const r=this.start,n=this.startControl,o=this.endControl,i=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(i.x-o.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(i.y-o.y)),h=[0,1,...a,...l];return((u,f)=>{for(const d of u)for(let g=0;g<=f;g++){const m=g/f-.5,p=Math.min(1,Math.max(0,d+m)),S=this.getPoint(p);t.x=Math.min(t.x,S.x),t.y=Math.min(t.y,S.y),e.x=Math.max(e.x,S.x),e.y=Math.max(e.y,S.y)}})(h,10),{min:t,max:e}}toCommands(){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{start:e,startControl:r,endControl:n,end:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,o.x,o.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 Ao=new St,Dn=new St,Un=new St,Xe=new b;class Io extends Yt{constructor(t=new b,e=1,r=1,n=0,o=0,i=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=i,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new b){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(o?n=0:n=r),this.clockwise&&!o&&(n===r?n=-r:n=n-r);const i=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(i),l=this.center.y+this.radiusY*Math.sin(i);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,f=l-this.center.y;a=u*h-f*c+this.center.x,l=u*c+f*h+this.center.y}return e.set(a,l)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:i,rotation:a}=this,{x:l,y:h}=t,c=l+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=h+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),f=Math.abs(n-o),d=f>Math.PI?1:0,g=i?1:0,m=a*180/Math.PI;if(f>=2*Math.PI){const p=n+Math.PI,S=l+e*Math.cos(p)*Math.cos(a)-r*Math.sin(p)*Math.sin(a),P=h+e*Math.cos(p)*Math.sin(a)+r*Math.sin(p)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:S,y:P},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const p=l+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),S=h+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:d,sweepFlag:g,x:p,y:S}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:i,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,n,o,i,a,!l),this}matrix(t){return Xe.set(this.center.x,this.center.y),Xe.applyMatrix3(t),this.center.x=Xe.x,this.center.y=Xe.y,Do(t)?$o(this,t):Bo(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){const{center:r,radiusX:n,radiusY:o,rotation:i}=this,{x:a,y:l}=r,h=Math.cos(i),c=Math.sin(i),u=Math.sqrt(n*n*h*h+o*o*c*c),f=Math.sqrt(n*n*c*c+o*o*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,l-f),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,l+f),{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 $o(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),o=Math.sin(s.rotation),i=new b(e*n,e*o),a=new b(-r*o,r*n),l=i.applyMatrix3(t),h=a.applyMatrix3(t),c=Ao.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=Dn.copy(c).invert(),g=Un.copy(u).transpose().multiply(u).elements,m=Uo(g[0],g[1],g[4]),p=Math.sqrt(m.rt1),S=Math.sqrt(m.rt2);if(s.radiusX=1/p,s.radiusY=1/S,s.rotation=Math.atan2(m.sn,m.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const C=Dn.set(p,0,0,0,S,0,0,0,1),x=Un.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),v=C.multiply(x).multiply(c),w=D=>{const{x:_,y:M}=new b(Math.cos(D),Math.sin(D)).applyMatrix3(v);return Math.atan2(M,_)};s.startAngle=w(s.startAngle),s.endAngle=w(s.endAngle),En(t)&&(s.clockwise=!s.clockwise)}}function Bo(s,t){const e=kn(t),r=Ln(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,En(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function En(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Do(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=kn(s),n=Ln(s);return Math.abs(e/(r*n))>Number.EPSILON}function kn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ln(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Uo(s,t,e){let r,n,o,i,a;const l=s+e,h=s-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,n=s*a*e-t*a*t):l<0?n=.5*(l-c):(r=.5*c,n=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,i=1/Math.sqrt(1+a*a),o=a*i):Math.abs(t)===0?(o=1,i=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),i=a*o),h>0&&(a=o,o=-i,i=a),{rt1:r,rt2:n,cs:o,sn:i}}class Pr extends Yt{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).scale(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)}getControlPoints(){return[this.start,this.end]}getMinMax(t=b.MAX,e=b.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}}toCommands(){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{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class Eo extends Yt{constructor(t=new b,e=new b,r=new b){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new b){const{start:r,control:n,end:o}=this;return e.set($n(t,r.x,n.x,o.x),$n(t,r.y,n.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=b.MAX,e=b.MIN){const{start:r,control:n,end:o}=this,i=.5*(r.x+n.x),a=.5*(r.y+n.y),l=.5*(r.x+o.x),h=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,i,l),t.y=Math.min(t.y,r.y,o.y,a,h),e.x=Math.max(e.x,r.x,o.x,i,l),e.y=Math.max(e.y,r.y,o.y,a,h),{min:t,max:e}}toCommands(){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{start:e,control:r,end:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.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 ko=Object.defineProperty,Lo=(s,t,e)=>t in s?ko(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fn=(s,t,e)=>(Lo(s,typeof t!="symbol"?t+"":t,e),e);class Fo extends Yt{constructor(t,e,r=1,n=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=o,Fn(this,"curves",[]),Fn(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,o=[new b(t-r,e-n),new b(t+r,e-n),new b(t+r,e+n),new b(t-r,e+n)];for(let i=0;i<4;i++)this.curves.push(new Pr(o[i].clone(),o[(i+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)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class No extends Yt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new b){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),i=n-o,a=r[o===0?o:o-1],l=r[o],h=r[o>r.length-2?r.length-1:o+1],c=r[o>r.length-3?r.length-1:o+2];return e.set(In(i,a.x,l.x,h.x,c.x),In(i,a.y,l.y,h.y,c.y)),e}getControlPoints(){return this.points}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 zo=Object.defineProperty,qo=(s,t,e)=>t in s?zo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ce=(s,t,e)=>(qo(s,typeof t!="symbol"?t+"":t,e),e);class _e extends Yt{constructor(t){super(),Ce(this,"curves",[]),Ce(this,"startPoint"),Ce(this,"currentPoint",new b),Ce(this,"autoClose",!1),Ce(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:o}=t[e];this.lineTo(n,o)}return this}addCommands(t){return On(t,this),this}addData(t){return this.addCommands(An(t)),this}getPoint(t,e=new b){const r=t*this.getLength(),n=this.getCurveLengths();let o=0;for(;o<n.length;){if(n[o]>=r){const i=n[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-i/l,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}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 o=0,i=r.length;o<i;o++){const l=r[o].getPoints(t);for(let h=0;h<l.length;h++){const c=l[h];n!=null&&n.equals(c)||(e.push(c),n=c)}}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 Pr(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 Pr(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPoint.equals({x:o,y:i})||this.curves.push(new Oo(this.currentPoint.clone(),new b(t,e),new b(r,n),new b(o,i))),this._setCurrentPoint({x:o,y:i}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new Eo(this.currentPoint.clone(),new b(t,e),new b(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,i){return this.ellipse(t,e,r,r,0,n,o,i),this}relativeArc(t,e,r,n,o,i){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,i),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,i,a,l=!0){const h=new Io(new b(t,e),r,n,o,i,a,!l);if(this.curves.length>0){const c=h.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,e,r,n,o,i,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,n,o,i,a,l),this}rect(t,e,r,n){return this.curves.push(new Fo(new b(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new No([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new G(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}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 Go(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Ro(s,t,e,r){const n=t.clone().sub(s),o=r.clone().sub(e),i=e.clone().sub(s),a=n.cross(o);if(a===0)return new b((s.x+e.x)/2,(s.y+e.y)/2);const l=i.cross(o)/a;return Math.abs(l)>1?new b((s.x+e.x)/2,(s.y+e.y)/2):new b(s.x+l*n.x,s.y+l*n.y)}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,Cr=(s,t,e)=>(Vo(s,typeof t!="symbol"?t+"":t,e),e);class Pt{constructor(t,e={}){Cr(this,"currentPath",new _e),Cr(this,"paths",[this.currentPath]),Cr(this,"style"),t&&(t instanceof Pt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t)),this.style=e}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 Pt?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 _e().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 _e().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,o,i){return this.currentPath.bezierCurveTo(t,e,r,n,o,i),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,i){return this.currentPath.arc(t,e,r,n,o,i),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,i,a,l){return this.currentPath.ellipse(t,e,r,n,o,i,a,l),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return On(t,this),this}addData(t){return this.addCommands(An(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],n=[],o=[];e.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();o[l]=h,n[l]=c;const u=h[0],f=h[h.length-1]??u;r.push({start:c?f:u,end:c?u:f,index:l})});const i=[];return r.forEach((a,l)=>{i[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&i[l].push(h.index)})}),e.forEach((a,l)=>{const h=n[l];o[l].forEach(u=>{const f=a.getTForPoint(u),d=a.getNormal(f).scale(h?t:-t);u.add(d)})}),i.forEach((a,l)=>{const h=o[l];a.forEach(c=>{const u=o[c],f=Ro(h[h.length-1],h[h.length-2]??h[h.length-1],u[0],u[1]??u[0]);f&&(h[h.length-1].copy(f),u[0].copy(f))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=b.MAX,e=b.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(o=>{if(o.getMinMax(t,e),r&&n>1){const i=n/2,a=o.isClockwise(),l=[];for(let h=0;h<=1;h+=1/o.arcLengthDivisions){const c=o.getPoint(h),u=o.getNormal(h),f=u.clone().scale(a?i:-i),d=u.clone().scale(a?-i:i);l.push(c.clone().add(f),c.clone().add(d),c.clone().add({x:i,y:0}),c.clone().add({x:-i,y:0}),c.clone().add({x:0,y:i}),c.clone().add({x:0,y:-i}),c.clone().add({x:i,y:i}),c.clone().add({x:-i,y:-i}))}t.min(...l),e.max(...l)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new G(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),Mn(t,e),this.paths.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),Mn(t,e),this.getControlPoints().forEach(o=>{t.moveTo(o.x,o.y),t.arc(o.x,o.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){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[Go(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.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),o=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:i,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=i*e,l.height=a*e,l.style.width=`${i}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-n,-o),this.drawTo(h,r)),l}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const _r="px",Nn=90,zn=["mm","cm","in","pt","pc","px"],Mr={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 V(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=zn.length;r<n;r++){const o=zn[r];if(s.endsWith(o)){t=o,s=s.substring(0,s.length-o.length);break}}let e;return t==="px"&&_r!=="px"?e=Mr.in[_r]/Nn:(e=Mr[t][_r],e<0&&(e=Mr[t].in*Nn)),e*Number.parseFloat(s)}const Xo=new St,je=new St,qn=new St,Gn=new St;function jo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Ho(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ho(s){const t=new St,e=Xo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(V(s.getAttribute("x")),V(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const i=o.indexOf("("),a=o.length;if(i>0&&i<a){const l=o.slice(0,i),h=Ut(o.slice(i+1));switch(e.identity(),l){case"translate":if(h.length>=1){const c=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(c,u)}break;case"rotate":if(h.length>=1){let c=0,u=0,f=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],f=h[2]),je.makeTranslation(-u,-f),qn.makeRotation(c),Gn.multiplyMatrices(qn,je),je.makeTranslation(u,f),e.multiplyMatrices(je,Gn)}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 Yo(s){return new Pt().addPath(new _e().arc(V(s.getAttribute("cx")||0),V(s.getAttribute("cy")||0),V(s.getAttribute("r")||0),0,Math.PI*2))}function Zo(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()),o={};for(let i=r.style.length,a=0;a<i;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let i=0;i<n.length;i++)t[n[i]]=Object.assign(t[n[i]]||{},{...o})}}function Ko(s){return new Pt().addPath(new _e().ellipse(V(s.getAttribute("cx")||0),V(s.getAttribute("cy")||0),V(s.getAttribute("rx")||0),V(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Qo(s){return new Pt().moveTo(V(s.getAttribute("x1")||0),V(s.getAttribute("y1")||0)).lineTo(V(s.getAttribute("x2")||0),V(s.getAttribute("y2")||0))}function Jo(s){const t=new Pt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const ta=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ea(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(ta,(n,o,i)=>{const a=V(o),l=V(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!0,t}const ra=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function na(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(ra,(n,o,i)=>{const a=V(o),l=V(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!1,t}function sa(s){const t=V(s.getAttribute("x")||0),e=V(s.getAttribute("y")||0),r=V(s.getAttribute("rx")||s.getAttribute("ry")||0),n=V(s.getAttribute("ry")||s.getAttribute("rx")||0),o=V(s.getAttribute("width")),i=V(s.getAttribute("height")),a=1-.551915024494,l=new Pt;return l.moveTo(t+r,e),l.lineTo(t+o-r,e),(r!==0||n!==0)&&l.bezierCurveTo(t+o-r*a,e,t+o,e+n*a,t+o,e+n),l.lineTo(t+o,e+i-n),(r!==0||n!==0)&&l.bezierCurveTo(t+o,e+i-n*a,t+o-r*a,e+i,t+o-r,e+i),l.lineTo(t+r,e+i),(r!==0||n!==0)&&l.bezierCurveTo(t+r*a,e+i,t,e+i-n*a,t,e+i-n),l.lineTo(t,e+n),(r!==0||n!==0)&&l.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),l}function Et(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)r=Object.assign(r,e[`.${h[c]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let h=s.style.length,c=0;c<h;c++){const u=s.style.item(c),f=s.style.getPropertyValue(u);t[u]=f,r[u]=f}function n(h,c,u=o){s.hasAttribute(h)&&(t[c]=u(s.getAttribute(h))),r[h]&&(t[c]=u(r[h]))}function o(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function i(h){return Math.max(0,Math.min(1,V(h)))}function a(h){return Math.max(0,V(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>V(c))}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",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",l),n("stroke-dashoffset","strokeDashoffset",V),n("visibility","visibility"),t}function Tr(s,t,e=[],r={}){var u;if(s.nodeType!==1)return e;let n=!1,o=null,i={...t};switch(s.nodeName){case"svg":i=Et(s,i,r);break;case"style":Zo(s,r);break;case"g":i=Et(s,i,r);break;case"path":i=Et(s,i,r),s.hasAttribute("d")&&(o=Jo(s));break;case"rect":i=Et(s,i,r),o=sa(s);break;case"polygon":i=Et(s,i,r),o=ea(s);break;case"polyline":i=Et(s,i,r),o=na(s);break;case"circle":i=Et(s,i,r),o=Yo(s);break;case"ellipse":i=Et(s,i,r),o=Ko(s);break;case"line":i=Et(s,i,r),o=Qo(s);break;case"defs":n=!0;break;case"use":{i=Et(s,i,r);const d=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=s.viewportElement)==null?void 0:u.getElementById(d);g?Tr(g,i,e,r):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(s);break}if(i.display==="none")return e;Object.assign(t,i);const a=new St,l=[],h=jo(s,a,l);o&&(o.matrix(a),e.push(o),o.style=t);const c=s.childNodes;for(let f=0,d=c.length;f<d;f++){const g=c[f];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Tr(g,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Rn="data:image/svg+xml;",Wn=`${Rn}base64,`,Vn=`${Rn}charset=utf8,`;function Xn(s){if(typeof s=="string"){let t;return s.startsWith(Wn)?(s=s.substring(Wn.length,s.length),t=atob(s)):s.startsWith(Vn)?(s=s.substring(Vn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function jn(s){return Tr(Xn(s),{})}function He(s,t=!0){if(!s.length)return;const e=b.MAX,r=b.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new G(e.x,e.y,r.x-e.x,r.y-e.y)}const ia=new Set(["©","®","÷"]),oa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),aa={1:"italic",32:"bold"},la={1:"italic",2:"bold"},Hn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Yn{constructor(t,e,r){$(this,"path",new Pt);$(this,"lineBox",new G);$(this,"inlineBox",new G);$(this,"glyphBox");$(this,"advanceWidth",0);$(this,"advanceHeight",0);$(this,"underlinePosition",0);$(this,"underlineThickness",0);$(this,"strikeoutPosition",0);$(this,"strikeoutSize",0);$(this,"ascender",0);$(this,"descender",0);$(this,"typoAscender",0);$(this,"typoDescender",0);$(this,"typoLineGap",0);$(this,"winAscent",0);$(this,"winDescent",0);$(this,"xHeight",0);$(this,"capHeight",0);$(this,"baseline",0);$(this,"centerDiviation",0);$(this,"fontStyle");this.content=t,this.index=e,this.parent=r}get center(){var t;return(t=this.glyphBox)==null?void 0:t.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSfnt(t){const e=this.computedStyle.fontFamily,r=t??co,n=e?r.get(e):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{hhea:e,os2:r,post:n,head:o}=t,i=o.unitsPerEm,a=e.ascent,l=e.descent,{content:h,computedStyle:c,isVertical:u}=this,{fontSize:f}=c,d=i/f,g=t.getAdvanceWidth(h,f),m=(a+Math.abs(l))/d,p=a/d;return this.advanceWidth=g,this.advanceHeight=m,this.inlineBox.width=u?m:g,this.inlineBox.height=u?g:m,this.underlinePosition=(a-n.underlinePosition)/d,this.underlineThickness=n.underlineThickness/d,this.strikeoutPosition=(a-r.yStrikeoutPosition)/d,this.strikeoutSize=r.yStrikeoutSize/d,this.ascender=a/d,this.descender=l/d,this.typoAscender=r.sTypoAscender/d,this.typoDescender=r.sTypoDescender/d,this.typoLineGap=r.sTypoLineGap/d,this.winAscent=r.usWinAscent/d,this.winDescent=r.usWinDescent/d,this.xHeight=r.sxHeight/d,this.capHeight=r.sCapHeight/d,this.baseline=p,this.centerDiviation=m/2-p,this.fontStyle=aa[r.fsSelection]??la[o.macStyle],this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:n,computedStyle:o,baseline:i,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u,advanceWidth:f,advanceHeight:d}=this,{left:g,top:m}=a,p=o.fontStyle==="italic"&&u!=="italic";let S=g,P=m+i,C;const x=new Pt;if(r&&(S+=(d-f)/2,Math.abs(f-d)>.1&&(P-=(l-c)/(l+Math.abs(h))*d),C=void 0),r&&!ia.has(n)&&(n.codePointAt(0)<=256||oa.has(n))){x.addCommands(e.getPathCommands(n,S,m+i-(d-f)/2,o.fontSize));const w={y:m-(d-f)/2+d/2,x:S+f/2};p&&this._italic(x,r?{x:w.x,y:m-(d-f)/2+i}:void 0),x.rotate(90,w)}else C!==void 0?(x.addCommands(e.glyphs.get(C).getPathCommands(S,P,o.fontSize)),p&&this._italic(x,r?{x:S+f/2,y:m+c/(l+Math.abs(h))*d}:void 0)):(x.addCommands(e.getPathCommands(n,S,P,o.fontSize)),p&&this._italic(x,r?{x:S+d/2,y:P}:void 0));const v=o.fontWeight??400;return v in Hn&&(v===700||v==="bold")&&u!=="bold"&&x.bold(Hn[v]*o.fontSize*.05),x.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=x,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(t,e){t.skew(-.24,0,e||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(t,e,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(t,e,r)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:r,max:n}=e;return new G(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){const r=this.computedStyle;Jt({ctx:t,path:this.path,fontSize:r.fontSize,color:r.color,...e})}}function Zt(s){return!s||s==="none"}function Zn(s,t){const e=Object.keys(s),r=Object.keys(t);return Array.from(new Set([...e,...r])).every(o=>s[o]===t[o])}function Me(s){const t=s.startsWith("#")?s.slice(1):s;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const r=t.length===3?t.split("").map(a=>a+a).join(""):t,n=Number.parseInt(r.slice(0,2),16),o=Number.parseInt(r.slice(2,4),16),i=Number.parseInt(r.slice(4,6),16);return`rgb(${n}, ${o}, ${i})`}function Ye(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}class Kn{constructor(t,e={},r){$(this,"inlineBox",new G);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,...Ye(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Yn(r,e++,this));return this.characters=t,this}}class oe{constructor(t,e){$(this,"lineBox",new G);$(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Ye(this.parentStyle),...Ye(this.style)},this}addFragment(t,e){const r=new Kn(t,e,this);return this.fragments.push(r),r}}function ha(s){return s}class Qn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","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,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(i=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(i.style)),i.fragments.forEach(l=>{const h=document.createElement("span");Object.assign(h.style,this._styleToDomStyle(l.style)),h.appendChild(document.createTextNode(l.content)),/\s/.test(l.content)&&(h.style.whiteSpace="pre"),a.appendChild(h)}),o.appendChild(a)}),n.appendChild(o),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var i;return(i=n.parentNode)==null?void 0:i.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,i)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((l,h)=>{var f;const c=l.getBoundingClientRect();r.push({paragraphIndex:i,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});const u=l.firstChild;if(u instanceof window.Text){const d=document.createRange();d.selectNodeContents(u);const g=u.data?u.data.length:0;let m=0;for(;m<=g;){d.setStart(u,Math.max(m-1,0)),d.setEnd(u,m);const p=((f=d.getClientRects)==null?void 0:f.call(d))??[d.getBoundingClientRect()];let S=p[p.length-1];p.length>1&&S.width<2&&(S=p[p.length-2]);const P=d.toString();P!==""&&S&&S.width+S.height!==0&&n.push({content:P,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:m-1,top:S.top,left:S.left,height:S.height,width:S.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=this._measureDom(t);n.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),n.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let i=0;return n.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const u=e[l].fragments[h].characters[c],{fontHeight:f,isVertical:d}=u,g=o[i];u.inlineBox.left=g.left,u.inlineBox.top=g.top,u.inlineBox.width=g.width,u.inlineBox.height=g.height,d?(u.lineBox.left=g.left+(g.width-f)/2,u.lineBox.top=g.top,u.lineBox.width=f,u.lineBox.height=g.height):(u.lineBox.left=g.left,u.lineBox.top=g.top+(g.height-f)/2,u.lineBox.width=g.width,u.lineBox.height=f),i++}),{paragraphs:e,boundingBox:new G(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}}function ca(s,t,e){if(s==="cover")return 0;if(typeof s=="string")if(s.endsWith("%")){const r=Number(s.substring(0,s.length-1))/100;return Math.ceil(r*e/t)}else return s.endsWith("rem")?Number(s.substring(0,s.length-3)):Math.ceil(Number(s)/t);else return Math.ceil(s/t)}function ua(s,t,e){return typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Jn(){const s=[],t=[],e=new Map;function r(n){let o=e.get(n);if(!o){const i=Xn(n),a=jn(i);o={dom:i,paths:a},e.set(n,o)}return o}return{name:"highlight",paths:s,update:n=>{s.length=0;const o=[];let i,a;n.forEachCharacter(l=>{const{isVertical:h,computedStyle:c,inlineBox:u,fontSize:f}=l;!Zt(c.highlightImage)&&l.glyphBox&&(c.highlightSize!=="1rem"&&(!a||a.highlightImage===c.highlightImage&&Zn(a.highlightImageColors,c.highlightImageColors)&&a.highlightLine===c.highlightLine&&a.highlightSize===c.highlightSize&&a.highlightThickness===c.highlightThickness&&a.highlightOverflow===c.highlightOverflow)&&(i!=null&&i.length)&&(h?i[0].inlineBox.left===u.left:i[0].inlineBox.top===u.top)&&i[0].fontSize===f?i.push(l):(i=[],i.push(l),o.push(i))),a=c}),o.filter(l=>l.length).map(l=>({char:l[0],groupBox:G.from(...l.map(c=>c.glyphBox))})).forEach(l=>{const{char:h,groupBox:c}=l,{computedStyle:u}=h,{fontSize:f,writingMode:d,highlightThickness:g,highlightSize:m,highlightLine:p,highlightOverflow:S,highlightImage:P,highlightImageColors:C}=u,x=d.includes("vertical"),v=ua(g,f,c.width),w=ca(m,f,c.width),D=Zt(S)?w?"hidden":"visible":S,_=Object.keys(C).reduce((B,z)=>{let N=C[z];const it=Me(z),T=Me(N);return it&&(z=it),T&&(N=T),B[z]=N,B},{}),{paths:M,dom:H}=r(P),U=He(M,!0),q=f/U.width*2,I=new G().copy(c);I.width=w?f*w:x?c.height:c.width,I.height=x?c.width:c.height;const E=x?I.height:I.width;let k;if(Zt(p))if(U.width/U.height>4){k="underline";const B=H.getAttribute("viewBox");if(B){const[z,N,it,T]=B.split(" ").map(W=>Number(W)),X=N+T/2;U.y<X&&U.y+U.height>X?k="line-through":U.y+U.height<X?k="overline":k="underline"}}else k="outline";else k=p;switch(k){case"outline":{const B=I.width*.2,z=I.height*.2;I.width+=B,I.height+=z,x?(I.x-=z/2,I.y-=B/2,I.x+=I.height):(I.x-=B/2,I.y-=z/2);break}case"overline":I.height=U.height*q,x?I.x=h.inlineBox.left+h.inlineBox.width:I.y=h.inlineBox.top;break;case"line-through":I.height=U.height*q,x?I.x=h.inlineBox.left+h.inlineBox.width-h.strikeoutPosition+I.height/2:I.y=h.inlineBox.top+h.strikeoutPosition-I.height/2;break;case"underline":I.height=U.height*q,x?I.x=h.inlineBox.left+h.inlineBox.width-h.underlinePosition:I.y=h.inlineBox.top+h.underlinePosition;break}const R=new St().translate(-U.x,-U.y).scale(I.width/U.width,I.height/U.height);x&&R.rotate(-Math.PI/2),R.translate(I.x,I.y);for(let B=0,z=Math.ceil(c.width/E);B<z;B++){const N=R.clone().translate(B*E,0);M.forEach(it=>{const T=it.clone().matrix(N);T.style.strokeWidth&&(T.style.strokeWidth*=q*v),T.style.strokeMiterlimit&&(T.style.strokeMiterlimit*=q),T.style.strokeDashoffset&&(T.style.strokeDashoffset*=q),T.style.strokeDasharray&&(T.style.strokeDasharray=T.style.strokeDasharray.map(X=>X*q)),T.style.fill&&T.style.fill in _&&(T.style.fill=_[T.style.fill]),T.style.stroke&&T.style.stroke in _&&(T.style.stroke=_[T.style.stroke]),s.push(T),t[s.length-1]=D==="hidden"?new G(c.left,c.top-c.height,c.width,c.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{s.forEach((i,a)=>{if(Jt({ctx:n,path:i,clipRect:t[a],fontSize:o.computedStyle.fontSize}),o.debug){const l=He([i]);l&&n.strokeRect(l.x,l.y,l.width,l.height)}})}}}function ts(s,t,e){return s==="cover"?1:typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function es(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,o=n*.45;e.forEach(i=>{const{computedStyle:a}=i,{listStyleImage:l,listStyleImageColors:h,listStyleSize:c,listStyleType:u,color:f}=a,d=Object.keys(h).reduce((x,v)=>{let w=h[v];const D=Me(v),_=Me(w);return D&&(v=D),_&&(w=_),x[v]=w,x},{});let g=c,m;if(!Zt(l))m=l;else if(!Zt(u)){const x=n*.38/2;switch(g=g==="cover"?x*2:g,u){case"disc":m=`<svg width="${x*2}" height="${x*2}" xmlns="http://www.w3.org/2000/svg">
|
|
5
5
|
<circle cx="${x}" cy="${x}" r="${x}" fill="${f}" />
|
|
6
|
-
</svg>`;break}}if(!m)return;const p=jn(m),S=He(p),P=i.lineBox,C=i.fragments[0].inlineBox;if(C){const x=new St;if(r){const v=ts(g,n,n),w=n/S.height*v;x.translate(-S.left,-S.top),x.rotate(Math.PI/2),x.scale(w,w),x.translate(n/2-S.height*w/2,0),x.translate(P.left+(P.width-n)/2,C.top-o)}else{const v=ts(g,n,n),w=n/S.height*v;x.translate(-S.left,-S.top),x.translate(-S.width,0),x.scale(w,w),x.translate(0,n/2-S.height*w/2),x.translate(C.left-o,P.top+(P.height-n)/2)}s.push(...p.map(v=>{const w=v.clone();return w.matrix(x),w.style.fill&&w.style.fill in d&&(w.style.fill=d[w.style.fill]),w.style.stroke&&w.style.stroke in d&&(w.style.stroke=d[w.style.stroke]),w}))}})}}}const Vt=new b,ae=new St,Xt=new St;function rs(){return{name:"render",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(o=>{r==null||r.forEach(i=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),l=Ze(s,i);Vt.set(a.left,a.top),Vt.applyMatrix3(l),a.left=Vt.x,a.top=Vt.y,Vt.set(a.right,a.bottom),Vt.applyMatrix3(l),a.width=Vt.x-a.left,a.height=Vt.y-a.top;const h=(i.shadowOffsetX??0)*e,c=(i.shadowOffsetY??0)*e,u=Math.max(.1,i.textStrokeWidth??0)*e;a.left+=h-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?
|
|
6
|
+
</svg>`;break}}if(!m)return;const p=jn(m),S=He(p),P=i.lineBox,C=i.fragments[0].inlineBox;if(C){const x=new St;if(r){const v=ts(g,n,n),w=n/S.height*v;x.translate(-S.left,-S.top),x.rotate(Math.PI/2),x.scale(w,w),x.translate(n/2-S.height*w/2,0),x.translate(P.left+(P.width-n)/2,C.top-o)}else{const v=ts(g,n,n),w=n/S.height*v;x.translate(-S.left,-S.top),x.translate(-S.width,0),x.scale(w,w),x.translate(0,n/2-S.height*w/2),x.translate(C.left-o,P.top+(P.height-n)/2)}s.push(...p.map(v=>{const w=v.clone();return w.matrix(x),w.style.fill&&w.style.fill in d&&(w.style.fill=d[w.style.fill]),w.style.stroke&&w.style.stroke in d&&(w.style.stroke=d[w.style.stroke]),w}))}})}}}const Vt=new b,ae=new St,Xt=new St;function rs(){return{name:"render",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(o=>{r==null||r.forEach(i=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),l=Ze(s,i);Vt.set(a.left,a.top),Vt.applyMatrix3(l),a.left=Vt.x,a.top=Vt.y,Vt.set(a.right,a.bottom),Vt.applyMatrix3(l),a.width=Vt.x-a.left,a.height=Vt.y-a.top;const h=(i.shadowOffsetX??0)*e,c=(i.shadowOffsetY??0)*e,u=Math.max(.1,i.textStrokeWidth??0)*e;a.left+=h-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?G.from(...n):void 0},render:(s,t)=>{const{paragraphs:e,glyphBox:r,effects:n,style:o}=t;function i(a,l){s.fillStyle=a,s.fillRect(l.left,l.top,l.width,l.height)}o!=null&&o.backgroundColor&&i(o.backgroundColor,new G(0,0,s.canvas.width,s.canvas.height)),e.forEach(a=>{var l;(l=a.style)!=null&&l.backgroundColor&&i(a.style.backgroundColor,a.lineBox)}),n?n.forEach(a=>{$t(a,r,s),s.save();const[l,h,c,u,f,d]=Ze(t,a).transpose().elements;s.transform(l,u,h,f,c,d),t.forEachCharacter(g=>{var m;(m=g.parent.style)!=null&&m.backgroundColor&&i(g.parent.style.backgroundColor,g.inlineBox),g.drawTo(s,a)}),s.restore()}):e.forEach(a=>{a.fragments.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&i(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(s)})})}),t.debug&&e.forEach(a=>{s.strokeRect(a.lineBox.x,a.lineBox.y,a.lineBox.width,a.lineBox.height)})}}}function Ze(s,t){const{fontSize:e,glyphBox:r}=s,n=(t.translateX??0)*e,o=(t.translateY??0)*e,i=Math.PI*2,a=(t.skewX??0)/360*i,l=(t.skewY??0)/360*i,{left:h,top:c,width:u,height:f}=r,d=h+u/2,g=c+f/2;return ae.identity(),Xt.makeTranslation(n,o),ae.multiply(Xt),Xt.makeTranslation(d,g),ae.multiply(Xt),Xt.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),ae.multiply(Xt),Xt.makeTranslation(-d,-g),ae.multiply(Xt),ae.clone()}function ns(){const s=[];return{name:"textDecoration",paths:s,update:t=>{s.length=0;const e=[];let r,n;t.forEachCharacter(o=>{const{computedStyle:i,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:u,strikeoutSize:f}=o;if(Zt(i.textDecoration))n=void 0;else{let d=!1;if((n==null?void 0:n.textDecoration)===i.textDecoration&&(n==null?void 0:n.writingMode)===i.writingMode&&(n==null?void 0:n.color)===i.color&&(a?r[0].inlineBox.left===l.left:r[0].inlineBox.top===l.top))switch(i.textDecoration){case"underline":r[0].underlinePosition===h&&r[0].underlineThickness===c&&(d=!0);break;case"line-through":r[0].strikeoutPosition===u&&r[0].strikeoutSize===f&&(d=!0);break}d?r.push(o):(r=[],r.push(o),e.push(r)),n=i}}),e.forEach(o=>{const{computedStyle:i,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:u}=o[0],{textDecoration:f,color:d}=i,{left:g,top:m,width:p,height:S}=G.from(...o.map(w=>w.inlineBox));let P=a?g+p:m;const C=a?-1:1;let x=0;switch(f){case"overline":x=h*2;break;case"underline":P+=C*l,x=h*2;break;case"line-through":P+=C*c,x=u*2;break}P-=x;let v;a?v=new Pt([{type:"M",x:P,y:m},{type:"L",x:P,y:m+S},{type:"L",x:P+x,y:m+S},{type:"L",x:P+x,y:m},{type:"Z"}],{fill:d}):v=new Pt([{type:"M",x:g,y:P},{type:"L",x:g+p,y:P},{type:"L",x:g+p,y:P+x},{type:"L",x:g,y:P+x},{type:"Z"}],{fill:d}),s.push(v)})},render:(t,e)=>{const{effects:r,computedStyle:n}=e;r?r.forEach(o=>{t.save();const[i,a,l,h,c,u]=Ze(e,o).transpose().elements;t.transform(i,h,a,c,l,u),s.forEach(f=>{Jt({ctx:t,path:f,fontSize:n.fontSize,...o})}),t.restore()}):s.forEach(o=>{Jt({ctx:t,path:o,fontSize:n.fontSize})})}}}const Or={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",listStyleType:"none",listStyleImage:"none",listStyleImageColors:{},listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightImageColors:{},highlightLine:"none",highlightSize:"cover",highlightThickness:"100%",highlightOverflow:"none",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,translateX:0,translateY:0,skewX:0,skewY:0};class Ar{constructor(t={}){$(this,"debug");$(this,"content");$(this,"style");$(this,"effects");$(this,"measureDom");$(this,"needsUpdate",!0);$(this,"computedStyle",{...Or});$(this,"paragraphs",[]);$(this,"lineBox",new G);$(this,"rawGlyphBox",new G);$(this,"glyphBox",new G);$(this,"pathBox",new G);$(this,"boundingBox",new G);$(this,"measurer",new Qn(this));$(this,"plugins",new Map);$(this,"fonts");this.debug=t.debug??!1,this.content=t.content??"",this.style=t.style??{},this.measureDom=t.measureDom,this.effects=t.effects,this.fonts=t.fonts,this.use(es()).use(ns()).use(Jn()).use(rs())}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((e,r)=>{e.fragments.forEach((n,o)=>{n.characters.forEach((i,a)=>{t(i,{paragraphIndex:r,fragmentIndex:o,characterIndex:a})})})}),this}updateParagraphs(){this.computedStyle={...Or,...this.style};let{content:t,computedStyle:e}=this;const r=[];if(typeof t=="string"){const n=new oe({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const o=new oe({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new oe({},e);n.forEach(i=>{if(typeof i=="string")o.addFragment(i);else{const{content:a,...l}=i;a!==void 0&&o.addFragment(a,l)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...i}=n,a=new oe(i,e);o.forEach(l=>{const{content:h,...c}=l;h!==void 0&&a.addFragment(h,c)}),r.push(a)}else if("content"in n){const{content:o,...i}=n;if(o!==void 0){const a=new oe(i,e);a.addFragment(o),r.push(a)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const e={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),[...this.plugins.values()].sort((o,i)=>(o.updateOrder??0)-(i.updateOrder??0)).forEach(o=>{var i;(i=o.update)==null||i.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in e)r[o]=this[o],this[o]=e[o];return r}getGlyphBox(){const t=b.MAX,e=b.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,e)){const{inlineBox:n}=r,o=new b(n.left,n.top),i=new b(n.left+n.width,n.top+n.height);t.min(o,i),e.max(o,i)}}),new G(t.x,t.y,e.x-t.x,e.y-t.y)}updatePathBox(){const t=[...this.plugins.values()];return this.pathBox=G.from(this.glyphBox,...t.map(e=>e.getBoundingBox?e.getBoundingBox(this):He(e.paths??[])).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:e,pathBox:r}=this,n=Math.min(r.left,r.left+t.left-e.left),o=Math.min(r.top,r.top+t.top-e.top),i=Math.max(r.right,r.right+t.right-e.right),a=Math.max(r.bottom,r.bottom+t.bottom-e.bottom);return this.boundingBox=new G(n,o,i-n,a-o),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const e in t)this[e]=t[e];return this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Dr(n,r,this.boundingBox),Ur(n,this),[...this.plugins.values()].sort((i,a)=>(i.renderOrder??0)-(a.renderOrder??0)).forEach(i=>{var a;if(i.render)(a=i.render)==null||a.call(i,n,this);else if(i.paths){const l=this.computedStyle;i.paths.forEach(h=>{Jt({ctx:n,path:h,fontSize:l.fontSize})})}}),this):this}}function fa(s){return new Ar(s).measure()}function pa(s){return new Ar(s).render(s)}F.Character=Yn,F.Fragment=Kn,F.Measurer=Qn,F.Paragraph=oe,F.Text=Ar,F.defaultTextStyles=Or,F.definePlugin=ha,F.drawPath=Jt,F.filterEmpty=Ye,F.getTransform2D=Ze,F.hexToRgb=Me,F.highlight=Jn,F.isEqualObject=Zn,F.isNone=Zt,F.listStyle=es,F.measureText=fa,F.parseColor=lt,F.render=rs,F.renderText=pa,F.setupView=Dr,F.textDecoration=ns,F.uploadColor=$t,F.uploadColors=Ur,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -767,12 +767,11 @@ function highlight() {
|
|
|
767
767
|
line = "underline";
|
|
768
768
|
const viewBox = svgDom.getAttribute("viewBox");
|
|
769
769
|
if (viewBox) {
|
|
770
|
-
const aCenter = aBox.y + aBox.height / 2;
|
|
771
770
|
const [_x, y, _w, h] = viewBox.split(" ").map((v) => Number(v));
|
|
772
771
|
const viewCenter = y + h / 2;
|
|
773
772
|
if (aBox.y < viewCenter && aBox.y + aBox.height > viewCenter) {
|
|
774
773
|
line = "line-through";
|
|
775
|
-
} else if (
|
|
774
|
+
} else if (aBox.y + aBox.height < viewCenter) {
|
|
776
775
|
line = "overline";
|
|
777
776
|
} else {
|
|
778
777
|
line = "underline";
|