modern-text 0.2.39 → 0.2.41
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 +18 -10
- package/dist/index.js +3 -3
- package/dist/index.mjs +18 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -880,7 +880,15 @@ function listStyle() {
|
|
|
880
880
|
paths,
|
|
881
881
|
update: (text) => {
|
|
882
882
|
paths.length = 0;
|
|
883
|
-
const { paragraphs, computedStyle: style,
|
|
883
|
+
const { paragraphs, computedStyle: style, isVertical } = text;
|
|
884
|
+
let fontSize = text.fontSize;
|
|
885
|
+
paragraphs.forEach((p) => {
|
|
886
|
+
p.fragments.forEach((f) => {
|
|
887
|
+
f.characters.forEach((c) => {
|
|
888
|
+
fontSize = Math.max(fontSize, c.computedStyle.fontSize);
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
});
|
|
884
892
|
let listStyleSize = style.listStyleSize;
|
|
885
893
|
let image;
|
|
886
894
|
if (!isNone(style.listStyleImage)) {
|
|
@@ -903,25 +911,25 @@ function listStyle() {
|
|
|
903
911
|
const imagePaths = modernPath2d.parseSvg(image);
|
|
904
912
|
const imageBox = modernPath2d.getPathsBoundingBox(imagePaths);
|
|
905
913
|
paragraphs.forEach((paragraph) => {
|
|
906
|
-
const box = paragraph.
|
|
914
|
+
const box = paragraph.lineBox;
|
|
907
915
|
if (box) {
|
|
908
916
|
const m = new modernPath2d.Matrix3();
|
|
909
917
|
if (isVertical) {
|
|
910
|
-
const scale = parseScale(listStyleSize, style.fontSize,
|
|
911
|
-
const reScale =
|
|
918
|
+
const scale = parseScale(listStyleSize, style.fontSize, fontSize);
|
|
919
|
+
const reScale = fontSize / imageBox.height * scale;
|
|
912
920
|
m.translate(-imageBox.left, -imageBox.top);
|
|
913
921
|
m.rotate(Math.PI / 2);
|
|
914
922
|
m.scale(reScale, reScale);
|
|
915
|
-
m.translate(
|
|
916
|
-
m.translate(box.left, box.top - padding);
|
|
923
|
+
m.translate(fontSize / 2 - imageBox.height * reScale / 2, 0);
|
|
924
|
+
m.translate(box.left + (box.width - fontSize) / 2, box.top - padding);
|
|
917
925
|
} else {
|
|
918
|
-
const scale = parseScale(listStyleSize, style.fontSize,
|
|
919
|
-
const reScale =
|
|
926
|
+
const scale = parseScale(listStyleSize, style.fontSize, fontSize);
|
|
927
|
+
const reScale = fontSize / imageBox.height * scale;
|
|
920
928
|
m.translate(-imageBox.left, -imageBox.top);
|
|
921
929
|
m.translate(-imageBox.width, 0);
|
|
922
930
|
m.scale(reScale, reScale);
|
|
923
|
-
m.translate(0,
|
|
924
|
-
m.translate(box.left - padding, box.top);
|
|
931
|
+
m.translate(0, fontSize / 2 - imageBox.height * reScale / 2);
|
|
932
|
+
m.translate(box.left - padding, box.top + (box.height - fontSize) / 2);
|
|
925
933
|
}
|
|
926
934
|
paths.push(...imagePaths.map((p) => p.clone().matrix(m)));
|
|
927
935
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(f,st){typeof exports=="object"&&typeof module<"u"?st(exports):typeof define=="function"&&define.amd?define(["exports"],st):(f=typeof globalThis<"u"?globalThis:f||self,st(f.modernText={}))})(this,function(f){"use strict";var fa=Object.defineProperty;var pa=(f,st,Tt)=>st in f?fa(f,st,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):f[st]=Tt;var L=(f,st,Tt)=>pa(f,typeof st!="symbol"?st+"":st,Tt);function st(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:s,stops:a}=oi(t,e.left,e.top,e.width,e.height),l=i.createLinearGradient(r,n,o,s);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function Tt(i,t,e){i!=null&&i.color&&(i.color=st(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=st(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=st(e,i.textStrokeColor,t))}function oi(i,t,e,r,n){var g;const o=((g=i.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),p=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+p,x1:t+r/2+u,y1:e+n/2-p,stops:Array.from(l).map(m=>{let w=m[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(m[3].replace("%",""))/100,color:w}})}}function Ce(i){const{ctx:t,path:e,fontSize:r,clipRect:n}=i;t.save(),t.beginPath();const o=e.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*r,shadowOffsetY:(i.shadowOffsetY??0)*r,shadowBlur:(i.shadowBlur??0)*r,shadowColor:i.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,s),t.restore()}function Dr(i,t,e){const{left:r,top:n,width:o,height:s}=e,a=i.canvas;a.dataset.viewbox=`${r} ${n} ${o} ${s}`,a.dataset.pixelRatio=String(t),a.width=Math.max(1,Math.ceil(o*t)),a.height=Math.max(1,Math.ceil(s*t)),a.style.marginTop=`${n}px`,a.style.marginLeft=`${r}px`,a.style.width=`${o}px`,a.style.height=`${s}px`,i.clearRect(0,0,i.canvas.width,i.canvas.height),i.scale(t,t),i.translate(-r,-n)}function Nr(i,t){const{paragraphs:e,computedStyle:r,renderBoundingBox:n}=t;Tt(r,n,i),e.forEach(o=>{Tt(o.computedStyle,o.lineBox,i),o.fragments.forEach(s=>{Tt(s.computedStyle,s.inlineBox,i)})})}var ot=Uint8Array,wt=Uint16Array,Ve=Int32Array,Se=new ot([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pe=new ot([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qe=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zr=function(i,t){for(var e=new wt(31),r=0;r<31;++r)e[r]=t+=1<<i[r-1];for(var n=new Ve(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}},Er=zr(Se,2),Ur=Er.b,We=Er.r;Ur[28]=258,We[258]=28;for(var Lr=zr(Pe,0),ai=Lr.b,$r=Lr.r,He=new wt(32768),j=0;j<32768;++j){var $t=(j&43690)>>1|(j&21845)<<1;$t=($t&52428)>>2|($t&13107)<<2,$t=($t&61680)>>4|($t&3855)<<4,He[j]=(($t&65280)>>8|($t&255)<<8)>>1}for(var Ot=function(i,t,e){for(var r=i.length,n=0,o=new wt(t);n<r;++n)i[n]&&++o[i[n]-1];var s=new wt(t);for(n=1;n<t;++n)s[n]=s[n-1]+o[n-1]<<1;var a;if(e){a=new wt(1<<t);var l=15-t;for(n=0;n<r;++n)if(i[n])for(var h=n<<4|i[n],c=t-i[n],u=s[i[n]-1]++<<c,p=u|(1<<c)-1;u<=p;++u)a[He[u]>>l]=h}else for(a=new wt(r),n=0;n<r;++n)i[n]&&(a[n]=He[s[i[n]-1]++]>>15-i[n]);return a},kt=new ot(288),j=0;j<144;++j)kt[j]=8;for(var j=144;j<256;++j)kt[j]=9;for(var j=256;j<280;++j)kt[j]=7;for(var j=280;j<288;++j)kt[j]=8;for(var oe=new ot(32),j=0;j<32;++j)oe[j]=5;var li=Ot(kt,9,0),hi=Ot(kt,9,1),ci=Ot(oe,5,0),ui=Ot(oe,5,1),Qe=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},Ct=function(i,t,e){var r=t/8|0;return(i[r]|i[r+1]<<8)>>(t&7)&e},Xe=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ye=function(i){return(i+7)/8|0},kr=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new ot(i.subarray(t,e))},fi=["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"],St=function(i,t,e){var r=new Error(t||fi[i]);if(r.code=i,Error.captureStackTrace&&Error.captureStackTrace(r,St),!e)throw r;return r},pi=function(i,t,e,r){var n=i.length,o=0;if(!n||t.f&&!t.l)return e||new ot(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new ot(n*3));var h=function(Dt){var Nt=e.length;if(Dt>Nt){var Lt=new ot(Math.max(Nt*2,Dt));Lt.set(e),e=Lt}},c=t.f||0,u=t.p||0,p=t.b||0,g=t.l,m=t.d,w=t.m,d=t.n,x=n*8;do{if(!g){c=Ct(i,u,1);var C=Ct(i,u+1,3);if(u+=3,C)if(C==1)g=hi,m=ui,w=9,d=5;else if(C==2){var M=Ct(i,u,31)+257,A=Ct(i,u+10,15)+4,P=M+Ct(i,u+5,31)+1;u+=14;for(var _=new ot(P),z=new ot(19),q=0;q<A;++q)z[qe[q]]=Ct(i,u+q*3,7);u+=A*3;for(var $=Qe(z),mt=(1<<$)-1,D=Ot(z,$,1),q=0;q<P;){var I=D[Ct(i,u,mt)];u+=I&15;var S=I>>4;if(S<16)_[q++]=S;else{var k=0,U=0;for(S==16?(U=3+Ct(i,u,3),u+=2,k=_[q-1]):S==17?(U=3+Ct(i,u,7),u+=3):S==18&&(U=11+Ct(i,u,127),u+=7);U--;)_[q++]=k}}var J=_.subarray(0,M),W=_.subarray(M);w=Qe(J),d=Qe(W),g=Ot(J,w,1),m=Ot(W,d,1)}else St(1);else{var S=Ye(u)+4,T=i[S-4]|i[S-3]<<8,v=S+T;if(v>n){l&&St(0);break}a&&h(p+T),e.set(i.subarray(S,v),p),t.b=p+=T,t.p=u=v*8,t.f=c;continue}if(u>x){l&&St(0);break}}a&&h(p+131072);for(var xt=(1<<w)-1,F=(1<<d)-1,K=u;;K=u){var k=g[Xe(i,u)&xt],B=k>>4;if(u+=k&15,u>x){l&&St(0);break}if(k||St(2),B<256)e[p++]=B;else if(B==256){K=u,g=null;break}else{var G=B-254;if(B>264){var q=B-257,N=Se[q];G=Ct(i,u,(1<<N)-1)+Ur[q],u+=N}var X=m[Xe(i,u)&F],H=X>>4;X||St(3),u+=X&15;var W=ai[H];if(H>3){var N=Pe[H];W+=Xe(i,u)&(1<<N)-1,u+=N}if(u>x){l&&St(0);break}a&&h(p+131072);var tt=p+G;if(p<W){var Xt=o-W,Yt=Math.min(W,tt);for(Xt+p<0&&St(3);p<Yt;++p)e[p]=r[Xt+p]}for(;p<tt;++p)e[p]=e[p-W]}}t.l=g,t.p=K,t.b=p,t.f=c,g&&(c=1,t.m=w,t.d=m,t.n=d)}while(!c);return p!=e.length&&s?kr(e,0,p):e.subarray(0,p)},Et=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8},ae=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8,i[r+2]|=e>>16},Ze=function(i,t){for(var e=[],r=0;r<i.length;++r)i[r]&&e.push({s:r,f:i[r]});var n=e.length,o=e.slice();if(!n)return{t:Gr,l:0};if(n==1){var s=new ot(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,M){return v.f-M.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 p=o[0].s,r=1;r<n;++r)o[r].s>p&&(p=o[r].s);var g=new wt(p+1),m=Ke(e[c-1],g,0);if(m>t){var r=0,w=0,d=m-t,x=1<<d;for(o.sort(function(M,A){return g[A.s]-g[M.s]||M.f-A.f});r<n;++r){var C=o[r].s;if(g[C]>t)w+=x-(1<<m-g[C]),g[C]=t;else break}for(w>>=d;w>0;){var S=o[r].s;g[S]<t?w-=1<<t-g[S]++-1:++r}for(;r>=0&&w;--r){var T=o[r].s;g[T]==t&&(--g[T],++w)}m=t}return{t:new ot(g),l:m}},Ke=function(i,t,e){return i.s==-1?Math.max(Ke(i.l,t,e+1),Ke(i.r,t,e+1)):t[i.s]=e},Br=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new wt(++t),r=0,n=i[0],o=1,s=function(l){e[r++]=l},a=1;a<=t;++a)if(i[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(n),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(n);o=1,n=i[a]}return{c:e.subarray(0,r),n:t}},le=function(i,t){for(var e=0,r=0;r<t.length;++r)e+=i[r]*t[r];return e},jr=function(i,t,e){var r=e.length,n=Ye(t+2);i[n]=r&255,i[n+1]=r>>8,i[n+2]=i[n]^255,i[n+3]=i[n+1]^255;for(var o=0;o<r;++o)i[n+o+4]=e[o];return(n+4+r)*8},Fr=function(i,t,e,r,n,o,s,a,l,h,c){Et(t,c++,e),++n[256];for(var u=Ze(n,15),p=u.t,g=u.l,m=Ze(o,15),w=m.t,d=m.l,x=Br(p),C=x.c,S=x.n,T=Br(w),v=T.c,M=T.n,A=new wt(19),P=0;P<C.length;++P)++A[C[P]&31];for(var P=0;P<v.length;++P)++A[v[P]&31];for(var _=Ze(A,7),z=_.t,q=_.l,$=19;$>4&&!z[qe[$-1]];--$);var mt=h+5<<3,D=le(n,kt)+le(o,oe)+s,I=le(n,p)+le(o,w)+s+14+3*$+le(A,z)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&mt<=D&&mt<=I)return jr(t,c,i.subarray(l,l+h));var k,U,J,W;if(Et(t,c,1+(I<D)),c+=2,I<D){k=Ot(p,g,0),U=p,J=Ot(w,d,0),W=w;var xt=Ot(z,q,0);Et(t,c,S-257),Et(t,c+5,M-1),Et(t,c+10,$-4),c+=14;for(var P=0;P<$;++P)Et(t,c+3*P,z[qe[P]]);c+=3*$;for(var F=[C,v],K=0;K<2;++K)for(var B=F[K],P=0;P<B.length;++P){var G=B[P]&31;Et(t,c,xt[G]),c+=z[G],G>15&&(Et(t,c,B[P]>>5&127),c+=B[P]>>12)}}else k=li,U=kt,J=ci,W=oe;for(var P=0;P<a;++P){var N=r[P];if(N>255){var G=N>>18&31;ae(t,c,k[G+257]),c+=U[G+257],G>7&&(Et(t,c,N>>23&31),c+=Se[G]);var X=N&31;ae(t,c,J[X]),c+=W[X],X>3&&(ae(t,c,N>>5&8191),c+=Pe[X])}else ae(t,c,k[N]),c+=U[N]}return ae(t,c,k[256]),c+U[256]},di=new Ve([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gr=new ot(0),gi=function(i,t,e,r,n,o){var s=o.z||i.length,a=new ot(r+s+5*(1+Math.ceil(s/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=di[t-1],p=u>>13,g=u&8191,m=(1<<e)-1,w=o.p||new wt(32768),d=o.h||new wt(m+1),x=Math.ceil(e/3),C=2*x,S=function(se){return(i[se]^i[se+1]<<x^i[se+2]<<C)&m},T=new Ve(25e3),v=new wt(288),M=new wt(32),A=0,P=0,_=o.i||0,z=0,q=o.w||0,$=0;_+2<s;++_){var mt=S(_),D=_&32767,I=d[mt];if(w[D]=I,d[mt]=D,q<=_){var k=s-_;if((A>7e3||z>24576)&&(k>423||!h)){c=Fr(i,l,0,T,v,M,P,z,$,_-$,c),z=A=P=0,$=_;for(var U=0;U<286;++U)v[U]=0;for(var U=0;U<30;++U)M[U]=0}var J=2,W=0,xt=g,F=D-I&32767;if(k>2&&mt==S(_-F))for(var K=Math.min(p,k)-1,B=Math.min(32767,_),G=Math.min(258,k);F<=B&&--xt&&D!=I;){if(i[_+J]==i[_+J-F]){for(var N=0;N<G&&i[_+N]==i[_+N-F];++N);if(N>J){if(J=N,W=F,N>K)break;for(var X=Math.min(F,N-2),H=0,U=0;U<X;++U){var tt=_-F+U&32767,Xt=w[tt],Yt=tt-Xt&32767;Yt>H&&(H=Yt,I=tt)}}}D=I,I=w[D],F+=D-I&32767}if(W){T[z++]=268435456|We[J]<<18|$r[W];var Dt=We[J]&31,Nt=$r[W]&31;P+=Se[Dt]+Pe[Nt],++v[257+Dt],++M[Nt],q=_+J,++A}else T[z++]=i[_],++v[i[_]]}}for(_=Math.max(_,q);_<s;++_)T[z++]=i[_],++v[i[_]];c=Fr(i,l,h,T,v,M,P,z,$,_-$,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=d,o.p=w,o.i=_,o.w=q)}else{for(var _=o.w||0;_<s+h;_+=65535){var Lt=_+65535;Lt>=s&&(l[c/8|0]=h,Lt=s),c=jr(l,c+1,i.subarray(_,Lt))}o.i=s}return kr(a,0,r+Ye(c)+n)},Rr=function(){var i=1,t=0;return{p:function(e){for(var r=i,n=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)n+=r+=e[s];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}i=r,t=n},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},yi=function(i,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ot(o.length+i.length);s.set(o),s.set(i,o.length),i=s,n.w=o.length}return gi(i,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,r,n)},Vr=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},mi=function(i,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=r<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var n=Rr();n.p(t.dictionary),Vr(i,2,n.d())}},wi=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&St(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&St(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function vi(i,t){t||(t={});var e=Rr();e.p(i);var r=yi(i,t,t.dictionary?6:2,4);return mi(r,t),Vr(r,r.length-4,e.d()),r}function bi(i,t){return pi(i.subarray(wi(i,t),-4),{i:2},t,t)}var Mi=typeof TextDecoder<"u"&&new TextDecoder,xi=0;try{Mi.decode(Gr,{stream:!0}),xi=1}catch{}const Ci="modern-font";function he(i,t){if(!i)throw new Error(`[${Ci}] ${t}`)}function Si(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function Gt(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var qr=Object.defineProperty,Pi=(i,t,e)=>t in i?qr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,at=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&qr(t,e,n),n},_i=(i,t,e)=>(Pi(i,t+"",e),e);const _e={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function lt(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class rt extends DataView{constructor(t,e,r,n){super(Si(t),e,r),this.littleEndian=n,_i(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/,s=>s.toUpperCase())}`,o=this[n](e,r);return this.cursor+=_e[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,s=r.length;o<s;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())}`,s=this[o](r,e,n);return this.cursor+=_e[t.toLowerCase()],s}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,s;n<o;++n)s=t.charCodeAt(n)||0,s>127?this.writeUint16(s):this.writeUint8(s);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=Gt(t);r=n.byteLength;for(let 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}}at([lt()],rt.prototype,"readInt8"),at([lt()],rt.prototype,"readInt16"),at([lt()],rt.prototype,"readInt32"),at([lt()],rt.prototype,"readUint8"),at([lt()],rt.prototype,"readUint16"),at([lt()],rt.prototype,"readUint32"),at([lt()],rt.prototype,"readFloat32"),at([lt()],rt.prototype,"readFloat64"),at([lt()],rt.prototype,"writeInt8"),at([lt()],rt.prototype,"writeInt16"),at([lt()],rt.prototype,"writeInt32"),at([lt()],rt.prototype,"writeUint8"),at([lt()],rt.prototype,"writeUint16"),at([lt()],rt.prototype,"writeUint32"),at([lt()],rt.prototype,"writeFloat32"),at([lt()],rt.prototype,"writeFloat64");var Ti=Object.defineProperty,Oi=(i,t,e)=>t in i?Ti(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ii=(i,t,e)=>(Oi(i,t+"",e),e);const Wr=new WeakMap;function y(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let s=Wr.get(n);s||(s={columns:[],byteLength:0},Wr.set(n,s));const a={...t,name:o,byteLength:e*_e[r],offset:t.offset??s.columns.reduce((l,h)=>l+h.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,h)=>l+_e[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){Ii(this,"view"),this.view=new rt(t,e,r,n)}}function Ai(i){let t="";for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Te(i){i=Ai(i);const t=[];for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Di(i){let t="";for(let e=0,r=i.length;e<r;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function Ni(i){let t="";for(let e=0,r=i.length;e<r;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}class Oe 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 Hr=Object.defineProperty,zi=(i,t,e)=>t in i?Hr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ft=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Hr(t,e,n),n},Qr=(i,t,e)=>(zi(i,typeof t!="symbol"?t+"":t,e),e);const ht=class ei extends Oe{constructor(){super(...arguments),Qr(this,"format","EmbeddedOpenType"),Qr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=Te(n.fontFamily||""),s=o.length,a=Te(n.fontStyle||""),l=a.length,h=Te(n.version||""),c=h.length,u=Te(n.fullName||""),p=u.length,g=86+s+4+l+4+c+4+p+2+t.view.byteLength,m=new ei(new ArrayBuffer(g),0,g,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(m.FontPANOSE=w.fontPANOSE,m.Italic=w.fsSelection,m.Weight=w.usWeightClass,m.fsType=w.fsType,m.UnicodeRange=w.ulUnicodeRange,m.CodePageRange=w.ulCodePageRange),m.view.writeUint16(s),m.view.writeBytes(o),m.view.writeUint16(0),m.view.writeUint16(l),m.view.writeBytes(a),m.view.writeUint16(0),m.view.writeUint16(c),m.view.writeBytes(h),m.view.writeUint16(0),m.view.writeUint16(p),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};ft([y("uint32")],ht.prototype,"EOTSize"),ft([y("uint32")],ht.prototype,"FontDataSize"),ft([y("uint32")],ht.prototype,"Version"),ft([y("uint32")],ht.prototype,"Flags"),ft([y({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([y("uint8")],ht.prototype,"Charset"),ft([y("uint8")],ht.prototype,"Italic"),ft([y("uint32")],ht.prototype,"Weight"),ft([y("uint16")],ht.prototype,"fsType"),ft([y("uint16")],ht.prototype,"MagicNumber"),ft([y({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([y({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([y("uint32")],ht.prototype,"CheckSumAdjustment"),ft([y({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([y("uint16")],ht.prototype,"Padding1");let Ei=ht;var Ui=Object.defineProperty,Ie=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ui(t,e,n),n};class Zt extends Mt{constructor(t,e){super(t,e,16)}}Ie([y({type:"char",size:4})],Zt.prototype,"tag"),Ie([y("uint32")],Zt.prototype,"checkSum"),Ie([y("uint32")],Zt.prototype,"offset"),Ie([y("uint32")],Zt.prototype,"length");const Je=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Li=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 $i=Object.defineProperty,ki=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ce=(i,t,e)=>(ki(i,typeof t!="symbol"?t+"":t,e),e);class tr{constructor(t){ce(this,"index"),ce(this,"name"),ce(this,"isComposite",!1),ce(this,"components",[]),ce(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 s=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=s,yScale:l=s}=n,h=this.pathCommands,c=[];for(let u=0,p=h.length;u<p;u+=1){const g=h[u];g.type==="M"?c.push({type:"M",x:t+g.x*a,y:e+-g.y*l}):g.type==="L"?c.push({type:"L",x:t+g.x*a,y:e+-g.y*l}):g.type==="Q"?c.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="C"?c.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*l,x2:t+g.x2*a,y2:e+-g.y2*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="Z"&&c.push({type:"Z"})}return c}}class Bi extends tr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,p,g,m;const w=[],d=[];let x=0,C=!1,S=!1,T=s,v=0,M=0;function A(D,I){w.push({type:"L",x:D,y:I})}function P(D,I,k,U,J,W){w.push({type:"C",x1:D,y1:I,x2:k,y2:U,x:J,y:W})}function _(D,I){S&&h!==2&&z(),S=!0,w.push({type:"M",x:D,y:I})}function z(){w.push({type:"Z"})}function q(D){w.push(...D)}function $(){d.length%2!==0&&!C&&(T=d.shift()+o),x+=d.length>>1,d.length=0,C=!0}function mt(D){let I,k,U,J,W,xt,F,K,B,G,N,X,H=0;for(;H<D.length;){let tt=D[H++];switch(tt){case 1:$();break;case 3:$();break;case 4:d.length>1&&!C&&(T=d.shift()+o,C=!0),M+=d.pop(),_(v,M);break;case 5:for(;d.length>0;)v+=d.shift(),M+=d.shift(),A(v,M);break;case 6:for(;d.length>0&&(v+=d.shift(),A(v,M),d.length!==0);)M+=d.shift(),A(v,M);break;case 7:for(;d.length>0&&(M+=d.shift(),A(v,M),d.length!==0);)v+=d.shift(),A(v,M);break;case 8:for(;d.length>0;)u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+d.shift(),P(u,p,g,m,v,M);break;case 10:W=d.pop()+l,xt=t.subrs[W],xt&&mt(xt);break;case 11:return;case 12:switch(tt=D[H],H+=1,tt){case 35:u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),F=g+d.shift(),K=m+d.shift(),B=F+d.shift(),G=K+d.shift(),N=B+d.shift(),X=G+d.shift(),v=N+d.shift(),M=X+d.shift(),d.shift(),P(u,p,g,m,F,K),P(B,G,N,X,v,M);break;case 34:u=v+d.shift(),p=M,g=u+d.shift(),m=p+d.shift(),F=g+d.shift(),K=m,B=F+d.shift(),G=m,N=B+d.shift(),X=M,v=N+d.shift(),P(u,p,g,m,F,K),P(B,G,N,X,v,M);break;case 36:u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),F=g+d.shift(),K=m,B=F+d.shift(),G=m,N=B+d.shift(),X=G+d.shift(),v=N+d.shift(),P(u,p,g,m,F,K),P(B,G,N,X,v,M);break;case 37:u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),F=g+d.shift(),K=m+d.shift(),B=F+d.shift(),G=K+d.shift(),N=B+d.shift(),X=G+d.shift(),Math.abs(N-v)>Math.abs(X-M)?v=N+d.shift():M=X+d.shift(),P(u,p,g,m,F,K),P(B,G,N,X,v,M);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+tt}`),d.length=0}break;case 14:if(d.length>=4){const Xt=Je[d.pop()],Yt=Je[d.pop()],Dt=d.pop(),Nt=d.pop();if(Xt&&Yt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Xt),se=t.charset.indexOf(Yt);n.components.push({glyphIndex:se,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Nt,dy:Dt}),q(r.get(se).pathCommands);const Or=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let Ir=0;Ir<Or.length;Ir+=1){const zt=Or[Ir];zt.type!=="Z"&&(zt.x+=Nt,zt.y+=Dt),(zt.type==="Q"||zt.type==="C")&&(zt.x1+=Nt,zt.y1+=Dt),zt.type==="C"&&(zt.x2+=Nt,zt.y2+=Dt)}q(Or)}}else d.length>0&&!C&&(T=d.shift()+o,C=!0);S&&h!==2&&(z(),S=!1);break;case 18:$();break;case 19:case 20:$(),H+=x+7>>3;break;case 21:d.length>2&&!C&&(T=d.shift()+o,C=!0),M+=d.pop(),v+=d.pop(),_(v,M);break;case 22:d.length>1&&!C&&(T=d.shift()+o,C=!0),v+=d.pop(),_(v,M);break;case 23:$();break;case 24:for(;d.length>2;)u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+d.shift(),P(u,p,g,m,v,M);v+=d.shift(),M+=d.shift(),A(v,M);break;case 25:for(;d.length>6;)v+=d.shift(),M+=d.shift(),A(v,M);u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+d.shift(),P(u,p,g,m,v,M);break;case 26:for(d.length%2&&(v+=d.shift());d.length>0;)u=v,p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g,M=m+d.shift(),P(u,p,g,m,v,M);break;case 27:for(d.length%2&&(M+=d.shift());d.length>0;)u=v+d.shift(),p=M,g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m,P(u,p,g,m,v,M);break;case 28:I=D[H],k=D[H+1],d.push((I<<24|k<<16)>>16),H+=2;break;case 29:W=d.pop()+a,xt=t.gsubrs[W],xt&&mt(xt);break;case 30:for(;d.length>0&&(u=v,p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+(d.length===1?d.shift():0),P(u,p,g,m,v,M),d.length!==0);)u=v+d.shift(),p=M,g=u+d.shift(),m=p+d.shift(),M=m+d.shift(),v=g+(d.length===1?d.shift():0),P(u,p,g,m,v,M);break;case 31:for(;d.length>0&&(u=v+d.shift(),p=M,g=u+d.shift(),m=p+d.shift(),M=m+d.shift(),v=g+(d.length===1?d.shift():0),P(u,p,g,m,v,M),d.length!==0);)u=v,p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+(d.length===1?d.shift():0),P(u,p,g,m,v,M);break;default:tt<32?console.warn(`Glyph ${c}: unknown operator ${tt}`):tt<247?d.push(tt-139):tt<251?(I=D[H],H+=1,d.push((tt-247)*256+I+108)):tt<255?(I=D[H],H+=1,d.push(-(tt-251)*256-I-108)):(I=D[H],k=D[H+1],U=D[H+2],J=D[H+3],H+=4,d.push((I<<24|k<<16|U<<8|J)/65536))}}}mt(e),this.pathCommands=w,C&&(this.advanceWidth=T)}}var ji=Object.defineProperty,Fi=(i,t,e)=>t in i?ji(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Gi=(i,t,e)=>(Fi(i,t+"",e),e);class er{constructor(t){this._sfnt=t,Gi(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 Ri extends er{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Bi({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Xr=Object.defineProperty,Vi=(i,t,e)=>t in i?Xr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Yr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Xr(t,e,n),n},Ae=(i,t,e)=>(Vi(i,typeof t!="symbol"?t+"":t,e),e);class De extends Mt{constructor(t,e,r,n){super(t,e,r,n),Ae(this,"_offsets"),Ae(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,s=e+1;o<s;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],s=r+e[t+1]-n;return this._isString?this.view.readString(n,s):this.view.readBytes(n,s)}}Yr([y("uint16")],De.prototype,"count"),Yr([y("uint8")],De.prototype,"offsetSize");class Ne extends De{constructor(){super(...arguments),Ae(this,"_isString",!1)}}class Zr extends De{constructor(){super(...arguments),Ae(this,"_isString",!0)}}const qi=[".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"],Wi=[".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"],Hi=[".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"],Qi=[".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 ze(i,t){return t<=390?qi[t]:i[t-391]}var Xi=Object.defineProperty,Yi=(i,t,e)=>t in i?Xi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Kr=(i,t,e)=>(Yi(i,typeof t!="symbol"?t+"":t,e),e);function R(i,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:i,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class Jr extends Mt{constructor(){super(...arguments),Kr(this,"_dict"),Kr(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),s=o>>4,a=o&15;if(s===r||(e+=n[s],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,s;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(),s=e.readUint8(),r<<24|n<<16|o<<8|s;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,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 ze(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Zi=Object.defineProperty,rr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Zi(t,e,n),n};class Ee extends Jr{}rr([R(19)],Ee.prototype,"subrs"),rr([R(20)],Ee.prototype,"defaultWidthX"),rr([R(21)],Ee.prototype,"nominalWidthX");var Ki=Object.defineProperty,Y=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ki(t,e,n),n};class Q extends Jr{}Y([R(0,"string")],Q.prototype,"version"),Y([R(1,"string")],Q.prototype,"notice"),Y([R(1200,"string")],Q.prototype,"copyright"),Y([R(2,"string")],Q.prototype,"fullName"),Y([R(3,"string")],Q.prototype,"familyName"),Y([R(4,"string")],Q.prototype,"weight"),Y([R(1201)],Q.prototype,"isFixedPitch"),Y([R(1202)],Q.prototype,"italicAngle"),Y([R(1203,"number",-100)],Q.prototype,"underlinePosition"),Y([R(1204,"number",50)],Q.prototype,"underlineThickness"),Y([R(1205)],Q.prototype,"paintType"),Y([R(1206,"number",2)],Q.prototype,"charstringType"),Y([R(1207,"number[]",[.001,0,0,.001,0,0])],Q.prototype,"fontMatrix"),Y([R(13)],Q.prototype,"uniqueId"),Y([R(5,"number[]",[0,0,0,0])],Q.prototype,"fontBBox"),Y([R(1208)],Q.prototype,"strokeWidth"),Y([R(14)],Q.prototype,"xuid"),Y([R(15)],Q.prototype,"charset"),Y([R(16)],Q.prototype,"encoding"),Y([R(17)],Q.prototype,"charStrings"),Y([R(18,"number[]",[0,0])],Q.prototype,"private");var Ji=Object.defineProperty,ts=(i,t,e)=>t in i?Ji(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,nr=(i,t,e)=>(ts(i,typeof t!="symbol"?t+"":t,e),e);function nt(i,t=i){return e=>{ue.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(ue.prototype,t,{get(){return this.get(i)},set(r){return this.set(i,r)},configurable:!0,enumerable:!0})}}const tn=class xe{constructor(t){nr(this,"tables",new Map),nr(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}),s=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||s;return o}getPathCommands(t,e,r,n,o){var s;return(s=this.charToGlyph(t))==null?void 0:s.getPathCommands(e,r,n,o,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,o={},s){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];s.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 xe(this.tableViews)}delete(t){const e=xe.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=xe.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=xe.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}};nr(tn,"tableDefinitions",new Map);let ue=tn;class ct extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var en=Object.defineProperty,es=Object.getOwnPropertyDescriptor,rs=(i,t,e)=>t in i?en(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fe=(i,t,e,r)=>{for(var n=r>1?void 0:r?es(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&en(t,e,n),n},ir=(i,t,e)=>(rs(i,typeof t!="symbol"?t+"":t,e),e);f.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),ir(this,"_glyphs"),ir(this,"privateDict"),ir(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Ri(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new Zr(e,n),this.topDictIndex=new Ne(e,this.nameIndex.endOffset),this.stringIndex=new Zr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ne(e,this.stringIndex.endOffset),this.topDict=new Q(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new Ee(e,r+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ne(e,r+s+this.privateDict.subrs))),this.charStringsIndex=new Ne(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Wi:this.topDict.charset===1?this.charset=Hi:this.topDict.charset===2?this.charset=Qi:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Je:this.topDict.encoding===1?this.encoding=Li:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let o,s,a;e-=1;const l=[".notdef"],h=n.readUint8();if(h===0)for(o=0;o<e;o+=1)s=n.readUint16(),l.push(ze(r,s));else if(h===1)for(;l.length<=e;)for(s=n.readUint16(),a=n.readUint8(),o=0;o<=a;o+=1)l.push(ze(r,s)),s+=1;else if(h===2)for(;l.length<=e;)for(s=n.readUint16(),a=n.readUint16(),o=0;o<=a;o+=1)l.push(ze(r,s)),s+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const o={},s=e.readUint8();if(s===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),o[n]=r}else if(s===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const l=e.readUint8(),h=e.readUint8();for(let c=l;c<=l+h;c+=1)o[c]=n,n+=1}}else console.warn(`unknown encoding format:${s}`);return o}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},fe([y("uint8")],f.Cff.prototype,"majorVersion",2),fe([y("uint8")],f.Cff.prototype,"minorVersion",2),fe([y("uint8")],f.Cff.prototype,"headerSize",2),fe([y("uint8")],f.Cff.prototype,"offsetSize",2),f.Cff=fe([nt("CFF ","cff")],f.Cff);var ns=Object.defineProperty,Ue=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ns(t,e,n),n};const pe=class ri extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ri;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}};Ue([y("uint16")],pe.prototype,"format"),Ue([y("uint16")],pe.prototype,"length"),Ue([y("uint16")],pe.prototype,"language"),Ue([y({type:"uint8",size:256})],pe.prototype,"glyphIndexArray");let sr=pe;var is=Object.defineProperty,or=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&is(t,e,n),n};class de 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,s=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)>=s.length?l=0:(l=s[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,p=o[c].entryCount;u<p;u++)if(o[c].idRangeOffset+u>=s.length?l=0:(l=s[o[c].idRangeOffset+u],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<t){const g=(h<<8|u+o[c].firstCode)%65535;e.set(g,l)}}return e}}or([y("uint16")],de.prototype,"format"),or([y("uint16")],de.prototype,"length"),or([y("uint16")],de.prototype,"language");function rn(i){return i>32767?i-65536:i<-32767?i+65536:i}function ar(i,t){let e;const r=[];let n={};return i.forEach((o,s)=>{t&&s>t||((!e||s!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:s,startId:o,delta:rn(o-s)}):(n.start=Number(s),n.startId=o,n.delta=rn(o-s))),e={unicode:s,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var ss=Object.defineProperty,Rt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ss(t,e,n),n};const Bt=class ni 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=ar(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,s=new ni(new ArrayBuffer(24+e.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=r*2,s.searchRange=o,s.entrySelector=n,s.rangeShift=2*r-o,s.endCode=[...e.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...e.map(a=>a.start),65535],s.idDelta=[...e.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:r},()=>0),s}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,s=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(s[h]===0)t.set(c,(c+a[h])%65536);else{const p=h+s[h]/2+(c-n[h])-r,g=l[p];g!==0?t.set(c,(g+a[h])%65536):t.set(c,0)}return t.delete(65535),t}};Rt([y("uint16")],Bt.prototype,"format"),Rt([y("uint16")],Bt.prototype,"length"),Rt([y("uint16")],Bt.prototype,"language"),Rt([y("uint16")],Bt.prototype,"segCountX2"),Rt([y("uint16")],Bt.prototype,"searchRange"),Rt([y("uint16")],Bt.prototype,"entrySelector"),Rt([y("uint16")],Bt.prototype,"rangeShift");let lr=Bt;var os=Object.defineProperty,ge=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&os(t,e,n),n};class Vt 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}}ge([y("uint16")],Vt.prototype,"format"),ge([y("uint16")],Vt.prototype,"length"),ge([y("uint16")],Vt.prototype,"language"),ge([y("uint16")],Vt.prototype,"firstCode"),ge([y("uint16")],Vt.prototype,"entryCount");var as=Object.defineProperty,ye=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&as(t,e,n),n};const Kt=class ii 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=ar(t),r=new ii(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 s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,s++)}return t}};ye([y("uint16")],Kt.prototype,"format"),ye([y("uint16")],Kt.prototype,"reserved"),ye([y("uint32")],Kt.prototype,"length"),ye([y("uint32")],Kt.prototype,"language"),ye([y("uint32")],Kt.prototype,"nGroups");let hr=Kt;var ls=Object.defineProperty,cr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ls(t,e,n),n};class me 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(s=>{t.set(s.unicodeValue,s.glyphID)})}return t}}cr([y("uint16")],me.prototype,"format"),cr([y("uint32")],me.prototype,"length"),cr([y("uint32")],me.prototype,"numVarSelectorRecords");var nn=Object.defineProperty,hs=Object.getOwnPropertyDescriptor,cs=(i,t,e)=>t in i?nn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ur=(i,t,e,r)=>{for(var n=r>1?void 0:r?hs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&nn(t,e,n),n},sn=(i,t,e)=>(cs(i,typeof t!="symbol"?t+"":t,e),e);f.Cmap=class extends ct{constructor(){super(...arguments),sn(this,"_unicodeToGlyphIndexMap"),sn(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),r=lr.from(t),n=sr.from(t),o=e?hr.from(t):void 0,s=4+(o?32:24),a=s+r.view.byteLength,l=a+n.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},o&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new f.Cmap(new ArrayBuffer(4+8*h.length+r.view.byteLength+n.view.byteLength+((o==null?void 0:o.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(u=>{c.view.writeUint16(u.platformID),c.view.writeUint16(u.platformSpecificID),c.view.writeUint32(u.offset)}),c.view.writeBytes(r.view,s),c.view.writeBytes(n.view,a),o&&c.view.writeBytes(o.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,o=r.length;n<o;n++){const s=r[n],a=e.get(s);t.has(a)?t.get(a).push(s):t.set(a,[s])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new sr(this.view.buffer,e.offset);break;case 2:n=new de(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new lr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Vt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new hr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new me(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,l,h,c,u;const t=this.readSubtables(),e=(a=t.find(p=>p.format===0))==null?void 0:a.view,r=(l=t.find(p=>p.platformID===3&&p.platformSpecificID===3&&p.format===2))==null?void 0:l.view,n=(h=t.find(p=>p.platformID===3&&p.platformSpecificID===1&&p.format===4))==null?void 0:h.view,o=(c=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:c.view,s=(u=t.find(p=>p.platformID===0&&p.platformSpecificID===5&&p.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}},ur([y("uint16")],f.Cmap.prototype,"version",2),ur([y("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=ur([nt("cmap")],f.Cmap);class us extends tr{_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 he(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],s={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(s)}return r}_parseGlyphCoordinate(t,e,r,n,o){let s;return(e&n)>0?(s=t.view.readUint8(),e&o||(s=-s),s=r+s):(e&o)>0?s=r:s=r+t.view.readInt16(),s}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let w=0;w<n;w++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();he(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let w=0;w<l;++w)h.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;he(u<2e4,`Bad numberOfCoordinates:${c}`);const p=[];let g,m=0;for(;m<u;)if(g=t.view.readUint8(),p.push(g),m++,g&8&&m<u){const w=t.view.readUint8();for(let d=0;d<w;d++)p.push(g),m++}if(he(p.length===u,`Bad flags length: ${p.length}, numberOfCoordinates: ${u}`),a.length>0){const w=[];let d;if(u>0){for(let S=0;S<u;S+=1)g=p[S],d={},d.onCurve=!!(g&1),d.lastPointOfContour=a.includes(S),w.push(d);let x=0;for(let S=0;S<u;S+=1)g=p[S],d=w[S],d.x=this._parseGlyphCoordinate(t,g,x,2,16),x=d.x;let C=0;for(let S=0;S<u;S+=1)g=p[S],d=w[S],d.y=this._parseGlyphCoordinate(t,g,C,4,32),C=d.y}this.points=w}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{he(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 p=h.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};p=this._transformPoints([p],g)[0],g.dx=u.x-p.x,g.dy=u.y-p.y,c=this._transformPoints(h.points,g)}this.points=this.points.concat(c)}}const o=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const h=s[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 p=0,g=h.length;p<g;++p)if(c=u,u=h[(p+1)%g],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let m=u;u.onCurve||(m={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:m.x,y:m.y})}o.push({type:"Z"})}this.pathCommands=o}}class fs extends er{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new us({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var on=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,ds=(i,t,e)=>t in i?on(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,gs=(i,t,e,r)=>{for(var n=r>1?void 0:r?ps(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&on(t,e,n),n},ys=(i,t,e)=>(ds(i,t+"",e),e);const Jt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends ct{constructor(){super(...arguments),ys(this,"_glyphs")}static from(t){const e=t.reduce((n,o)=>n+o.byteLength,0),r=new f.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new fs(this._sfnt))}},f.Glyf=gs([nt("glyf")],f.Glyf);var ms=Object.defineProperty,ws=Object.getOwnPropertyDescriptor,vs=(i,t,e,r)=>{for(var n=r>1?void 0:r?ws(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ms(t,e,n),n};f.Gpos=class extends ct{},f.Gpos=vs([nt("GPOS","gpos")],f.Gpos);var bs=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,qt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ms(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&bs(t,e,n),n};f.Gsub=class extends ct{},qt([y("uint16")],f.Gsub.prototype,"majorVersion",2),qt([y("uint16")],f.Gsub.prototype,"minorVersion",2),qt([y("uint16")],f.Gsub.prototype,"scriptListOffset",2),qt([y("uint16")],f.Gsub.prototype,"featureListOffset",2),qt([y("uint16")],f.Gsub.prototype,"lookupListOffset",2),qt([y("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=qt([nt("GSUB","gsub")],f.Gsub);var xs=Object.defineProperty,Cs=Object.getOwnPropertyDescriptor,et=(i,t,e,r)=>{for(var n=r>1?void 0:r?Cs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&xs(t,e,n),n};f.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([y("fixed")],f.Head.prototype,"version",2),et([y("fixed")],f.Head.prototype,"fontRevision",2),et([y("uint32")],f.Head.prototype,"checkSumAdjustment",2),et([y("uint32")],f.Head.prototype,"magickNumber",2),et([y("uint16")],f.Head.prototype,"flags",2),et([y("uint16")],f.Head.prototype,"unitsPerEm",2),et([y({type:"longDateTime"})],f.Head.prototype,"created",2),et([y({type:"longDateTime"})],f.Head.prototype,"modified",2),et([y("int16")],f.Head.prototype,"xMin",2),et([y("int16")],f.Head.prototype,"yMin",2),et([y("int16")],f.Head.prototype,"xMax",2),et([y("int16")],f.Head.prototype,"yMax",2),et([y("uint16")],f.Head.prototype,"macStyle",2),et([y("uint16")],f.Head.prototype,"lowestRecPPEM",2),et([y("int16")],f.Head.prototype,"fontDirectionHint",2),et([y("int16")],f.Head.prototype,"indexToLocFormat",2),et([y("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=et([nt("head")],f.Head);var Ss=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,pt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ps(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ss(t,e,n),n};f.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([y("fixed")],f.Hhea.prototype,"version",2),pt([y("int16")],f.Hhea.prototype,"ascent",2),pt([y("int16")],f.Hhea.prototype,"descent",2),pt([y("int16")],f.Hhea.prototype,"lineGap",2),pt([y("uint16")],f.Hhea.prototype,"advanceWidthMax",2),pt([y("int16")],f.Hhea.prototype,"minLeftSideBearing",2),pt([y("int16")],f.Hhea.prototype,"minRightSideBearing",2),pt([y("int16")],f.Hhea.prototype,"xMaxExtent",2),pt([y("int16")],f.Hhea.prototype,"caretSlopeRise",2),pt([y("int16")],f.Hhea.prototype,"caretSlopeRun",2),pt([y("int16")],f.Hhea.prototype,"caretOffset",2),pt([y({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),pt([y("int16")],f.Hhea.prototype,"metricDataFormat",2),pt([y("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=pt([nt("hhea")],f.Hhea);var an=Object.defineProperty,_s=Object.getOwnPropertyDescriptor,Ts=(i,t,e)=>t in i?an(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Os=(i,t,e,r)=>{for(var n=r>1?void 0:r?_s(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&an(t,e,n),n},Is=(i,t,e)=>(Ts(i,t+"",e),e);f.Hmtx=class extends ct{constructor(){super(...arguments),Is(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((o,s)=>(s<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},f.Hmtx=Os([nt("hmtx")],f.Hmtx);var As=Object.defineProperty,Ds=Object.getOwnPropertyDescriptor,Ns=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ds(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&As(t,e,n),n};f.Kern=class extends ct{},f.Kern=Ns([nt("kern","kern")],f.Kern);var ln=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Es=(i,t,e)=>t in i?ln(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Us=(i,t,e,r)=>{for(var n=r>1?void 0:r?zs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ln(t,e,n),n},Ls=(i,t,e)=>(Es(i,t+"",e),e);f.Loca=class extends ct{constructor(){super(...arguments),Ls(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new f.Loca(new ArrayBuffer(r));return t.forEach(o=>{e?n.view.writeUint32(o):n.view.writeUint16(o/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},f.Loca=Us([nt("loca")],f.Loca);var $s=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,ut=(i,t,e,r)=>{for(var n=r>1?void 0:r?ks(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&$s(t,e,n),n};f.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([y("fixed")],f.Maxp.prototype,"version",2),ut([y("uint16")],f.Maxp.prototype,"numGlyphs",2),ut([y("uint16")],f.Maxp.prototype,"maxPoints",2),ut([y("uint16")],f.Maxp.prototype,"maxContours",2),ut([y("uint16")],f.Maxp.prototype,"maxComponentPoints",2),ut([y("uint16")],f.Maxp.prototype,"maxComponentContours",2),ut([y("uint16")],f.Maxp.prototype,"maxZones",2),ut([y("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),ut([y("uint16")],f.Maxp.prototype,"maxStorage",2),ut([y("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),ut([y("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),ut([y("uint16")],f.Maxp.prototype,"maxStackElements",2),ut([y("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),ut([y("uint16")],f.Maxp.prototype,"maxComponentElements",2),ut([y("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=ut([nt("maxp")],f.Maxp);var hn=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,js=(i,t,e)=>t in i?hn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Le=(i,t,e,r)=>{for(var n=r>1?void 0:r?Bs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&hn(t,e,n),n},Fs=(i,t,e)=>(js(i,t+"",e),e);const cn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},fr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Gs={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},un={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends ct{constructor(){super(...arguments),Fs(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let l=0;l<t;++l)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const r=this.stringOffset;for(let l=0;l<t;++l){const h=e[l];h.name=this.view.readBytes(r+h.offset,h.length)}let n=fr.Macintosh,o=Gs.Default,s=0;e.some(l=>l.platform===fr.Microsoft&&l.encoding===un.UCS2&&l.language===1033)&&(n=fr.Microsoft,o=un.UCS2,s=1033);const a={};for(let l=0;l<t;++l){const h=e[l];h.platform===n&&h.encoding===o&&h.language===s&&cn[h.nameId]&&(a[cn[h.nameId]]=s===0?Di(h.name):Ni(h.name))}return a}},Le([y("uint16")],f.Name.prototype,"format",2),Le([y("uint16")],f.Name.prototype,"count",2),Le([y("uint16")],f.Name.prototype,"stringOffset",2),f.Name=Le([nt("name")],f.Name);var Rs=Object.defineProperty,Vs=Object.getOwnPropertyDescriptor,O=(i,t,e,r)=>{for(var n=r>1?void 0:r?Vs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Rs(t,e,n),n};f.Os2=class extends ct{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},O([y("uint16")],f.Os2.prototype,"version",2),O([y("int16")],f.Os2.prototype,"xAvgCharWidth",2),O([y("uint16")],f.Os2.prototype,"usWeightClass",2),O([y("uint16")],f.Os2.prototype,"usWidthClass",2),O([y("uint16")],f.Os2.prototype,"fsType",2),O([y("uint16")],f.Os2.prototype,"ySubscriptXSize",2),O([y("uint16")],f.Os2.prototype,"ySubscriptYSize",2),O([y("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),O([y("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),O([y("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),O([y("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),O([y("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),O([y("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),O([y("uint16")],f.Os2.prototype,"yStrikeoutSize",2),O([y("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),O([y("uint16")],f.Os2.prototype,"sFamilyClass",2),O([y({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),O([y({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),O([y({type:"uint8"})],f.Os2.prototype,"bWeight",2),O([y({type:"uint8"})],f.Os2.prototype,"bProportion",2),O([y({type:"uint8"})],f.Os2.prototype,"bContrast",2),O([y({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),O([y({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),O([y({type:"uint8"})],f.Os2.prototype,"bLetterform",2),O([y({type:"uint8"})],f.Os2.prototype,"bMidline",2),O([y({type:"uint8"})],f.Os2.prototype,"bXHeight",2),O([y({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),O([y({type:"char",size:4})],f.Os2.prototype,"achVendID",2),O([y("uint16")],f.Os2.prototype,"fsSelection",2),O([y("uint16")],f.Os2.prototype,"usFirstCharIndex",2),O([y("uint16")],f.Os2.prototype,"usLastCharIndex",2),O([y("int16")],f.Os2.prototype,"sTypoAscender",2),O([y("int16")],f.Os2.prototype,"sTypoDescender",2),O([y("int16")],f.Os2.prototype,"sTypoLineGap",2),O([y("uint16")],f.Os2.prototype,"usWinAscent",2),O([y("uint16")],f.Os2.prototype,"usWinDescent",2),O([y({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),O([y({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),O([y("int16")],f.Os2.prototype,"sCapHeight",2),O([y("uint16")],f.Os2.prototype,"usDefaultChar",2),O([y("uint16")],f.Os2.prototype,"usBreakChar",2),O([y("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=O([nt("OS/2","os2")],f.Os2);var qs=Object.defineProperty,Ws=Object.getOwnPropertyDescriptor,It=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ws(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&qs(t,e,n),n};f.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},It([y("fixed")],f.Post.prototype,"format",2),It([y("fixed")],f.Post.prototype,"italicAngle",2),It([y("int16")],f.Post.prototype,"underlinePosition",2),It([y("int16")],f.Post.prototype,"underlineThickness",2),It([y("uint32")],f.Post.prototype,"isFixedPitch",2),It([y("uint32")],f.Post.prototype,"minMemType42",2),It([y("uint32")],f.Post.prototype,"maxMemType42",2),It([y("uint32")],f.Post.prototype,"minMemType1",2),It([y("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=It([nt("post")],f.Post);var Hs=Object.defineProperty,Qs=Object.getOwnPropertyDescriptor,dt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Qs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Hs(t,e,n),n};f.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([y("fixed")],f.Vhea.prototype,"version",2),dt([y("int16")],f.Vhea.prototype,"vertTypoAscender",2),dt([y("int16")],f.Vhea.prototype,"vertTypoDescender",2),dt([y("int16")],f.Vhea.prototype,"vertTypoLineGap",2),dt([y("int16")],f.Vhea.prototype,"advanceHeightMax",2),dt([y("int16")],f.Vhea.prototype,"minTopSideBearing",2),dt([y("int16")],f.Vhea.prototype,"minBottomSideBearing",2),dt([y("int16")],f.Vhea.prototype,"yMaxExtent",2),dt([y("int16")],f.Vhea.prototype,"caretSlopeRise",2),dt([y("int16")],f.Vhea.prototype,"caretSlopeRun",2),dt([y("int16")],f.Vhea.prototype,"caretOffset",2),dt([y({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),dt([y("int16")],f.Vhea.prototype,"metricDataFormat",2),dt([y("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=dt([nt("vhea")],f.Vhea);var fn=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,Ys=(i,t,e)=>t in i?fn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zs=(i,t,e,r)=>{for(var n=r>1?void 0:r?Xs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&fn(t,e,n),n},Ks=(i,t,e)=>(Ys(i,t+"",e),e);f.Vmtx=class extends ct{constructor(){super(...arguments),Ks(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var o;const t=this._sfnt.maxp.numGlyphs,e=((o=this._sfnt.vhea)==null?void 0:o.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((s,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},f.Vmtx=Zs([nt("vmtx")],f.Vmtx);var pn=Object.defineProperty,Js=(i,t,e)=>t in i?pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,we=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&pn(t,e,n),n},$e=(i,t,e)=>(Js(i,typeof t!="symbol"?t+"":t,e),e);class it extends Oe{constructor(){super(...arguments),$e(this,"format","TrueType"),$e(this,"mimeType","font/ttf"),$e(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checksum(t){const e=Gt(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let o=0,s=r/4;o<s;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,p)=>u+e(p.byteLength),0),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const s=Math.log(2);o.searchRange=Math.floor(Math.log(r)/s)*16,o.entrySelector=Math.floor(o.searchRange/s),o.rangeShift=r*16-o.searchRange;let a=12+r*16,l=0;const h=o.getDirectories();t.tableViews.forEach((u,p)=>{const g=h[l++];g.tag=p,g.checkSum=this.checksum(u),g.offset=a,g.length=u.byteLength,o.view.writeBytes(u,a),a+=e(g.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 Zt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e(it,"signature",new Set([65536,1953658213,1954115633])),we([y("uint32")],it.prototype,"scalerType"),we([y("uint16")],it.prototype,"numTables"),we([y("uint16")],it.prototype,"searchRange"),we([y("uint16")],it.prototype,"entrySelector"),we([y("uint16")],it.prototype,"rangeShift");var to=Object.defineProperty,eo=(i,t,e)=>t in i?to(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,pr=(i,t,e)=>(eo(i,typeof t!="symbol"?t+"":t,e),e);class ke extends it{constructor(){super(...arguments),pr(this,"format","OpenType"),pr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}pr(ke,"signature",new Set([1330926671]));var ro=Object.defineProperty,ve=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ro(t,e,n),n};class Wt extends Mt{constructor(t,e){super(t,e,20)}}ve([y({type:"char",size:4})],Wt.prototype,"tag"),ve([y("uint32")],Wt.prototype,"offset"),ve([y("uint32")],Wt.prototype,"compLength"),ve([y("uint32")],Wt.prototype,"origLength"),ve([y("uint32")],Wt.prototype,"origChecksum");var dn=Object.defineProperty,no=(i,t,e)=>t in i?dn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&dn(t,e,n),n},Be=(i,t,e)=>(no(i,typeof t!="symbol"?t+"":t,e),e);const gt=class Ar extends Oe{constructor(){super(...arguments),Be(this,"format","WOFF"),Be(this,"mimeType","font/woff"),Be(this,"_sfnt")}get subfontFormat(){return it.is(this.flavor)?"TrueType":ke.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checkSum(t){const e=Gt(t),r=e.byteLength,n=Math.floor(r/4);let o=0,s=0;for(;s<n;)o+=e.getUint32(4*s++,!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,p)=>{const g=Gt(vi(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:p,view:g.byteLength<u.byteLength?g:u,rawView:u})});const o=n.length,s=n.reduce((u,p)=>u+r(p.view.byteLength),0),a=new Ar(new ArrayBuffer(44+20*o+s+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((u,p)=>u+r(p.rawView.byteLength),0);let l=44+o*20,h=0;const c=a.getDirectories();return n.forEach(u=>{const p=c[h++];p.tag=u.tag,p.offset=l,p.compLength=u.view.byteLength,p.origChecksum=Ar.checkSum(u.rawView),p.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Wt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,s=e.origLength,a=n+o;return t[r]=o>=s?new DataView(this.view.buffer,n,o):new DataView(bi(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Be(gt,"signature",new Set([2001684038])),vt([y("uint32")],gt.prototype,"signature"),vt([y("uint32")],gt.prototype,"flavor"),vt([y("uint32")],gt.prototype,"length"),vt([y("uint16")],gt.prototype,"numTables"),vt([y("uint16")],gt.prototype,"reserved"),vt([y("uint32")],gt.prototype,"totalSfntSize"),vt([y("uint16")],gt.prototype,"majorVersion"),vt([y("uint16")],gt.prototype,"minorVersion"),vt([y("uint32")],gt.prototype,"metaOffset"),vt([y("uint32")],gt.prototype,"metaLength"),vt([y("uint32")],gt.prototype,"metaOrigLength"),vt([y("uint32")],gt.prototype,"privOffset"),vt([y("uint32")],gt.prototype,"privLength");let Ut=gt;function gn(i){if(it.is(i))return new it(i);if(ke.is(i))return new ke(i);if(Ut.is(i))return new Ut(i)}var io=Object.defineProperty,so=(i,t,e)=>t in i?io(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,be=(i,t,e)=>(so(i,typeof t!="symbol"?t+"":t,e),e);const yn=class si{constructor(){be(this,"fallbackFont"),be(this,"_loading",new Map),be(this,"_loaded",new Map),be(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...si.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,st){typeof exports=="object"&&typeof module<"u"?st(exports):typeof define=="function"&&define.amd?define(["exports"],st):(f=typeof globalThis<"u"?globalThis:f||self,st(f.modernText={}))})(this,function(f){"use strict";var fa=Object.defineProperty;var pa=(f,st,Tt)=>st in f?fa(f,st,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):f[st]=Tt;var L=(f,st,Tt)=>pa(f,typeof st!="symbol"?st+"":st,Tt);function st(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:s,stops:a}=oi(t,e.left,e.top,e.width,e.height),l=i.createLinearGradient(r,n,o,s);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function Tt(i,t,e){i!=null&&i.color&&(i.color=st(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=st(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=st(e,i.textStrokeColor,t))}function oi(i,t,e,r,n){var g;const o=((g=i.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),p=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+p,x1:t+r/2+u,y1:e+n/2-p,stops:Array.from(l).map(m=>{let w=m[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(m[3].replace("%",""))/100,color:w}})}}function Ce(i){const{ctx:t,path:e,fontSize:r,clipRect:n}=i;t.save(),t.beginPath();const o=e.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*r,shadowOffsetY:(i.shadowOffsetY??0)*r,shadowBlur:(i.shadowBlur??0)*r,shadowColor:i.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,s),t.restore()}function Dr(i,t,e){const{left:r,top:n,width:o,height:s}=e,a=i.canvas;a.dataset.viewbox=`${r} ${n} ${o} ${s}`,a.dataset.pixelRatio=String(t),a.width=Math.max(1,Math.ceil(o*t)),a.height=Math.max(1,Math.ceil(s*t)),a.style.marginTop=`${n}px`,a.style.marginLeft=`${r}px`,a.style.width=`${o}px`,a.style.height=`${s}px`,i.clearRect(0,0,i.canvas.width,i.canvas.height),i.scale(t,t),i.translate(-r,-n)}function Nr(i,t){const{paragraphs:e,computedStyle:r,renderBoundingBox:n}=t;Tt(r,n,i),e.forEach(o=>{Tt(o.computedStyle,o.lineBox,i),o.fragments.forEach(s=>{Tt(s.computedStyle,s.inlineBox,i)})})}var ot=Uint8Array,wt=Uint16Array,Ve=Int32Array,Se=new ot([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pe=new ot([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qe=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zr=function(i,t){for(var e=new wt(31),r=0;r<31;++r)e[r]=t+=1<<i[r-1];for(var n=new Ve(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}},Er=zr(Se,2),Ur=Er.b,We=Er.r;Ur[28]=258,We[258]=28;for(var Lr=zr(Pe,0),ai=Lr.b,$r=Lr.r,He=new wt(32768),j=0;j<32768;++j){var $t=(j&43690)>>1|(j&21845)<<1;$t=($t&52428)>>2|($t&13107)<<2,$t=($t&61680)>>4|($t&3855)<<4,He[j]=(($t&65280)>>8|($t&255)<<8)>>1}for(var Ot=function(i,t,e){for(var r=i.length,n=0,o=new wt(t);n<r;++n)i[n]&&++o[i[n]-1];var s=new wt(t);for(n=1;n<t;++n)s[n]=s[n-1]+o[n-1]<<1;var a;if(e){a=new wt(1<<t);var l=15-t;for(n=0;n<r;++n)if(i[n])for(var h=n<<4|i[n],c=t-i[n],u=s[i[n]-1]++<<c,p=u|(1<<c)-1;u<=p;++u)a[He[u]>>l]=h}else for(a=new wt(r),n=0;n<r;++n)i[n]&&(a[n]=He[s[i[n]-1]++]>>15-i[n]);return a},kt=new ot(288),j=0;j<144;++j)kt[j]=8;for(var j=144;j<256;++j)kt[j]=9;for(var j=256;j<280;++j)kt[j]=7;for(var j=280;j<288;++j)kt[j]=8;for(var oe=new ot(32),j=0;j<32;++j)oe[j]=5;var li=Ot(kt,9,0),hi=Ot(kt,9,1),ci=Ot(oe,5,0),ui=Ot(oe,5,1),Qe=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},Ct=function(i,t,e){var r=t/8|0;return(i[r]|i[r+1]<<8)>>(t&7)&e},Xe=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ye=function(i){return(i+7)/8|0},kr=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new ot(i.subarray(t,e))},fi=["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"],St=function(i,t,e){var r=new Error(t||fi[i]);if(r.code=i,Error.captureStackTrace&&Error.captureStackTrace(r,St),!e)throw r;return r},pi=function(i,t,e,r){var n=i.length,o=0;if(!n||t.f&&!t.l)return e||new ot(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new ot(n*3));var h=function(Dt){var Nt=e.length;if(Dt>Nt){var Lt=new ot(Math.max(Nt*2,Dt));Lt.set(e),e=Lt}},c=t.f||0,u=t.p||0,p=t.b||0,g=t.l,m=t.d,w=t.m,d=t.n,S=n*8;do{if(!g){c=Ct(i,u,1);var x=Ct(i,u+1,3);if(u+=3,x)if(x==1)g=hi,m=ui,w=9,d=5;else if(x==2){var M=Ct(i,u,31)+257,A=Ct(i,u+10,15)+4,P=M+Ct(i,u+5,31)+1;u+=14;for(var _=new ot(P),z=new ot(19),q=0;q<A;++q)z[qe[q]]=Ct(i,u+q*3,7);u+=A*3;for(var $=Qe(z),mt=(1<<$)-1,D=Ot(z,$,1),q=0;q<P;){var I=D[Ct(i,u,mt)];u+=I&15;var C=I>>4;if(C<16)_[q++]=C;else{var k=0,U=0;for(C==16?(U=3+Ct(i,u,3),u+=2,k=_[q-1]):C==17?(U=3+Ct(i,u,7),u+=3):C==18&&(U=11+Ct(i,u,127),u+=7);U--;)_[q++]=k}}var J=_.subarray(0,M),W=_.subarray(M);w=Qe(J),d=Qe(W),g=Ot(J,w,1),m=Ot(W,d,1)}else St(1);else{var C=Ye(u)+4,T=i[C-4]|i[C-3]<<8,v=C+T;if(v>n){l&&St(0);break}a&&h(p+T),e.set(i.subarray(C,v),p),t.b=p+=T,t.p=u=v*8,t.f=c;continue}if(u>S){l&&St(0);break}}a&&h(p+131072);for(var xt=(1<<w)-1,F=(1<<d)-1,K=u;;K=u){var k=g[Xe(i,u)&xt],B=k>>4;if(u+=k&15,u>S){l&&St(0);break}if(k||St(2),B<256)e[p++]=B;else if(B==256){K=u,g=null;break}else{var G=B-254;if(B>264){var q=B-257,N=Se[q];G=Ct(i,u,(1<<N)-1)+Ur[q],u+=N}var X=m[Xe(i,u)&F],H=X>>4;X||St(3),u+=X&15;var W=ai[H];if(H>3){var N=Pe[H];W+=Xe(i,u)&(1<<N)-1,u+=N}if(u>S){l&&St(0);break}a&&h(p+131072);var tt=p+G;if(p<W){var Xt=o-W,Yt=Math.min(W,tt);for(Xt+p<0&&St(3);p<Yt;++p)e[p]=r[Xt+p]}for(;p<tt;++p)e[p]=e[p-W]}}t.l=g,t.p=K,t.b=p,t.f=c,g&&(c=1,t.m=w,t.d=m,t.n=d)}while(!c);return p!=e.length&&s?kr(e,0,p):e.subarray(0,p)},Et=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8},ae=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8,i[r+2]|=e>>16},Ze=function(i,t){for(var e=[],r=0;r<i.length;++r)i[r]&&e.push({s:r,f:i[r]});var n=e.length,o=e.slice();if(!n)return{t:Gr,l:0};if(n==1){var s=new ot(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,M){return v.f-M.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 p=o[0].s,r=1;r<n;++r)o[r].s>p&&(p=o[r].s);var g=new wt(p+1),m=Ke(e[c-1],g,0);if(m>t){var r=0,w=0,d=m-t,S=1<<d;for(o.sort(function(M,A){return g[A.s]-g[M.s]||M.f-A.f});r<n;++r){var x=o[r].s;if(g[x]>t)w+=S-(1<<m-g[x]),g[x]=t;else break}for(w>>=d;w>0;){var C=o[r].s;g[C]<t?w-=1<<t-g[C]++-1:++r}for(;r>=0&&w;--r){var T=o[r].s;g[T]==t&&(--g[T],++w)}m=t}return{t:new ot(g),l:m}},Ke=function(i,t,e){return i.s==-1?Math.max(Ke(i.l,t,e+1),Ke(i.r,t,e+1)):t[i.s]=e},Br=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new wt(++t),r=0,n=i[0],o=1,s=function(l){e[r++]=l},a=1;a<=t;++a)if(i[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(n),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(n);o=1,n=i[a]}return{c:e.subarray(0,r),n:t}},le=function(i,t){for(var e=0,r=0;r<t.length;++r)e+=i[r]*t[r];return e},jr=function(i,t,e){var r=e.length,n=Ye(t+2);i[n]=r&255,i[n+1]=r>>8,i[n+2]=i[n]^255,i[n+3]=i[n+1]^255;for(var o=0;o<r;++o)i[n+o+4]=e[o];return(n+4+r)*8},Fr=function(i,t,e,r,n,o,s,a,l,h,c){Et(t,c++,e),++n[256];for(var u=Ze(n,15),p=u.t,g=u.l,m=Ze(o,15),w=m.t,d=m.l,S=Br(p),x=S.c,C=S.n,T=Br(w),v=T.c,M=T.n,A=new wt(19),P=0;P<x.length;++P)++A[x[P]&31];for(var P=0;P<v.length;++P)++A[v[P]&31];for(var _=Ze(A,7),z=_.t,q=_.l,$=19;$>4&&!z[qe[$-1]];--$);var mt=h+5<<3,D=le(n,kt)+le(o,oe)+s,I=le(n,p)+le(o,w)+s+14+3*$+le(A,z)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&mt<=D&&mt<=I)return jr(t,c,i.subarray(l,l+h));var k,U,J,W;if(Et(t,c,1+(I<D)),c+=2,I<D){k=Ot(p,g,0),U=p,J=Ot(w,d,0),W=w;var xt=Ot(z,q,0);Et(t,c,C-257),Et(t,c+5,M-1),Et(t,c+10,$-4),c+=14;for(var P=0;P<$;++P)Et(t,c+3*P,z[qe[P]]);c+=3*$;for(var F=[x,v],K=0;K<2;++K)for(var B=F[K],P=0;P<B.length;++P){var G=B[P]&31;Et(t,c,xt[G]),c+=z[G],G>15&&(Et(t,c,B[P]>>5&127),c+=B[P]>>12)}}else k=li,U=kt,J=ci,W=oe;for(var P=0;P<a;++P){var N=r[P];if(N>255){var G=N>>18&31;ae(t,c,k[G+257]),c+=U[G+257],G>7&&(Et(t,c,N>>23&31),c+=Se[G]);var X=N&31;ae(t,c,J[X]),c+=W[X],X>3&&(ae(t,c,N>>5&8191),c+=Pe[X])}else ae(t,c,k[N]),c+=U[N]}return ae(t,c,k[256]),c+U[256]},di=new Ve([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gr=new ot(0),gi=function(i,t,e,r,n,o){var s=o.z||i.length,a=new ot(r+s+5*(1+Math.ceil(s/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=di[t-1],p=u>>13,g=u&8191,m=(1<<e)-1,w=o.p||new wt(32768),d=o.h||new wt(m+1),S=Math.ceil(e/3),x=2*S,C=function(se){return(i[se]^i[se+1]<<S^i[se+2]<<x)&m},T=new Ve(25e3),v=new wt(288),M=new wt(32),A=0,P=0,_=o.i||0,z=0,q=o.w||0,$=0;_+2<s;++_){var mt=C(_),D=_&32767,I=d[mt];if(w[D]=I,d[mt]=D,q<=_){var k=s-_;if((A>7e3||z>24576)&&(k>423||!h)){c=Fr(i,l,0,T,v,M,P,z,$,_-$,c),z=A=P=0,$=_;for(var U=0;U<286;++U)v[U]=0;for(var U=0;U<30;++U)M[U]=0}var J=2,W=0,xt=g,F=D-I&32767;if(k>2&&mt==C(_-F))for(var K=Math.min(p,k)-1,B=Math.min(32767,_),G=Math.min(258,k);F<=B&&--xt&&D!=I;){if(i[_+J]==i[_+J-F]){for(var N=0;N<G&&i[_+N]==i[_+N-F];++N);if(N>J){if(J=N,W=F,N>K)break;for(var X=Math.min(F,N-2),H=0,U=0;U<X;++U){var tt=_-F+U&32767,Xt=w[tt],Yt=tt-Xt&32767;Yt>H&&(H=Yt,I=tt)}}}D=I,I=w[D],F+=D-I&32767}if(W){T[z++]=268435456|We[J]<<18|$r[W];var Dt=We[J]&31,Nt=$r[W]&31;P+=Se[Dt]+Pe[Nt],++v[257+Dt],++M[Nt],q=_+J,++A}else T[z++]=i[_],++v[i[_]]}}for(_=Math.max(_,q);_<s;++_)T[z++]=i[_],++v[i[_]];c=Fr(i,l,h,T,v,M,P,z,$,_-$,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=d,o.p=w,o.i=_,o.w=q)}else{for(var _=o.w||0;_<s+h;_+=65535){var Lt=_+65535;Lt>=s&&(l[c/8|0]=h,Lt=s),c=jr(l,c+1,i.subarray(_,Lt))}o.i=s}return kr(a,0,r+Ye(c)+n)},Rr=function(){var i=1,t=0;return{p:function(e){for(var r=i,n=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)n+=r+=e[s];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}i=r,t=n},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},yi=function(i,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ot(o.length+i.length);s.set(o),s.set(i,o.length),i=s,n.w=o.length}return gi(i,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,r,n)},Vr=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},mi=function(i,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=r<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var n=Rr();n.p(t.dictionary),Vr(i,2,n.d())}},wi=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&St(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&St(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function vi(i,t){t||(t={});var e=Rr();e.p(i);var r=yi(i,t,t.dictionary?6:2,4);return mi(r,t),Vr(r,r.length-4,e.d()),r}function bi(i,t){return pi(i.subarray(wi(i,t),-4),{i:2},t,t)}var Mi=typeof TextDecoder<"u"&&new TextDecoder,xi=0;try{Mi.decode(Gr,{stream:!0}),xi=1}catch{}const Ci="modern-font";function he(i,t){if(!i)throw new Error(`[${Ci}] ${t}`)}function Si(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function Gt(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var qr=Object.defineProperty,Pi=(i,t,e)=>t in i?qr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,at=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&qr(t,e,n),n},_i=(i,t,e)=>(Pi(i,t+"",e),e);const _e={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function lt(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class rt extends DataView{constructor(t,e,r,n){super(Si(t),e,r),this.littleEndian=n,_i(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/,s=>s.toUpperCase())}`,o=this[n](e,r);return this.cursor+=_e[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,s=r.length;o<s;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())}`,s=this[o](r,e,n);return this.cursor+=_e[t.toLowerCase()],s}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,s;n<o;++n)s=t.charCodeAt(n)||0,s>127?this.writeUint16(s):this.writeUint8(s);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=Gt(t);r=n.byteLength;for(let 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}}at([lt()],rt.prototype,"readInt8"),at([lt()],rt.prototype,"readInt16"),at([lt()],rt.prototype,"readInt32"),at([lt()],rt.prototype,"readUint8"),at([lt()],rt.prototype,"readUint16"),at([lt()],rt.prototype,"readUint32"),at([lt()],rt.prototype,"readFloat32"),at([lt()],rt.prototype,"readFloat64"),at([lt()],rt.prototype,"writeInt8"),at([lt()],rt.prototype,"writeInt16"),at([lt()],rt.prototype,"writeInt32"),at([lt()],rt.prototype,"writeUint8"),at([lt()],rt.prototype,"writeUint16"),at([lt()],rt.prototype,"writeUint32"),at([lt()],rt.prototype,"writeFloat32"),at([lt()],rt.prototype,"writeFloat64");var Ti=Object.defineProperty,Oi=(i,t,e)=>t in i?Ti(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ii=(i,t,e)=>(Oi(i,t+"",e),e);const Wr=new WeakMap;function y(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let s=Wr.get(n);s||(s={columns:[],byteLength:0},Wr.set(n,s));const a={...t,name:o,byteLength:e*_e[r],offset:t.offset??s.columns.reduce((l,h)=>l+h.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,h)=>l+_e[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){Ii(this,"view"),this.view=new rt(t,e,r,n)}}function Ai(i){let t="";for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Te(i){i=Ai(i);const t=[];for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Di(i){let t="";for(let e=0,r=i.length;e<r;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function Ni(i){let t="";for(let e=0,r=i.length;e<r;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}class Oe 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 Hr=Object.defineProperty,zi=(i,t,e)=>t in i?Hr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ft=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Hr(t,e,n),n},Qr=(i,t,e)=>(zi(i,typeof t!="symbol"?t+"":t,e),e);const ht=class ei extends Oe{constructor(){super(...arguments),Qr(this,"format","EmbeddedOpenType"),Qr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=Te(n.fontFamily||""),s=o.length,a=Te(n.fontStyle||""),l=a.length,h=Te(n.version||""),c=h.length,u=Te(n.fullName||""),p=u.length,g=86+s+4+l+4+c+4+p+2+t.view.byteLength,m=new ei(new ArrayBuffer(g),0,g,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(m.FontPANOSE=w.fontPANOSE,m.Italic=w.fsSelection,m.Weight=w.usWeightClass,m.fsType=w.fsType,m.UnicodeRange=w.ulUnicodeRange,m.CodePageRange=w.ulCodePageRange),m.view.writeUint16(s),m.view.writeBytes(o),m.view.writeUint16(0),m.view.writeUint16(l),m.view.writeBytes(a),m.view.writeUint16(0),m.view.writeUint16(c),m.view.writeBytes(h),m.view.writeUint16(0),m.view.writeUint16(p),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};ft([y("uint32")],ht.prototype,"EOTSize"),ft([y("uint32")],ht.prototype,"FontDataSize"),ft([y("uint32")],ht.prototype,"Version"),ft([y("uint32")],ht.prototype,"Flags"),ft([y({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([y("uint8")],ht.prototype,"Charset"),ft([y("uint8")],ht.prototype,"Italic"),ft([y("uint32")],ht.prototype,"Weight"),ft([y("uint16")],ht.prototype,"fsType"),ft([y("uint16")],ht.prototype,"MagicNumber"),ft([y({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([y({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([y("uint32")],ht.prototype,"CheckSumAdjustment"),ft([y({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([y("uint16")],ht.prototype,"Padding1");let Ei=ht;var Ui=Object.defineProperty,Ie=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ui(t,e,n),n};class Zt extends Mt{constructor(t,e){super(t,e,16)}}Ie([y({type:"char",size:4})],Zt.prototype,"tag"),Ie([y("uint32")],Zt.prototype,"checkSum"),Ie([y("uint32")],Zt.prototype,"offset"),Ie([y("uint32")],Zt.prototype,"length");const Je=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Li=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 $i=Object.defineProperty,ki=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ce=(i,t,e)=>(ki(i,typeof t!="symbol"?t+"":t,e),e);class tr{constructor(t){ce(this,"index"),ce(this,"name"),ce(this,"isComposite",!1),ce(this,"components",[]),ce(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 s=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=s,yScale:l=s}=n,h=this.pathCommands,c=[];for(let u=0,p=h.length;u<p;u+=1){const g=h[u];g.type==="M"?c.push({type:"M",x:t+g.x*a,y:e+-g.y*l}):g.type==="L"?c.push({type:"L",x:t+g.x*a,y:e+-g.y*l}):g.type==="Q"?c.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="C"?c.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*l,x2:t+g.x2*a,y2:e+-g.y2*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="Z"&&c.push({type:"Z"})}return c}}class Bi extends tr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,p,g,m;const w=[],d=[];let S=0,x=!1,C=!1,T=s,v=0,M=0;function A(D,I){w.push({type:"L",x:D,y:I})}function P(D,I,k,U,J,W){w.push({type:"C",x1:D,y1:I,x2:k,y2:U,x:J,y:W})}function _(D,I){C&&h!==2&&z(),C=!0,w.push({type:"M",x:D,y:I})}function z(){w.push({type:"Z"})}function q(D){w.push(...D)}function $(){d.length%2!==0&&!x&&(T=d.shift()+o),S+=d.length>>1,d.length=0,x=!0}function mt(D){let I,k,U,J,W,xt,F,K,B,G,N,X,H=0;for(;H<D.length;){let tt=D[H++];switch(tt){case 1:$();break;case 3:$();break;case 4:d.length>1&&!x&&(T=d.shift()+o,x=!0),M+=d.pop(),_(v,M);break;case 5:for(;d.length>0;)v+=d.shift(),M+=d.shift(),A(v,M);break;case 6:for(;d.length>0&&(v+=d.shift(),A(v,M),d.length!==0);)M+=d.shift(),A(v,M);break;case 7:for(;d.length>0&&(M+=d.shift(),A(v,M),d.length!==0);)v+=d.shift(),A(v,M);break;case 8:for(;d.length>0;)u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+d.shift(),P(u,p,g,m,v,M);break;case 10:W=d.pop()+l,xt=t.subrs[W],xt&&mt(xt);break;case 11:return;case 12:switch(tt=D[H],H+=1,tt){case 35:u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),F=g+d.shift(),K=m+d.shift(),B=F+d.shift(),G=K+d.shift(),N=B+d.shift(),X=G+d.shift(),v=N+d.shift(),M=X+d.shift(),d.shift(),P(u,p,g,m,F,K),P(B,G,N,X,v,M);break;case 34:u=v+d.shift(),p=M,g=u+d.shift(),m=p+d.shift(),F=g+d.shift(),K=m,B=F+d.shift(),G=m,N=B+d.shift(),X=M,v=N+d.shift(),P(u,p,g,m,F,K),P(B,G,N,X,v,M);break;case 36:u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),F=g+d.shift(),K=m,B=F+d.shift(),G=m,N=B+d.shift(),X=G+d.shift(),v=N+d.shift(),P(u,p,g,m,F,K),P(B,G,N,X,v,M);break;case 37:u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),F=g+d.shift(),K=m+d.shift(),B=F+d.shift(),G=K+d.shift(),N=B+d.shift(),X=G+d.shift(),Math.abs(N-v)>Math.abs(X-M)?v=N+d.shift():M=X+d.shift(),P(u,p,g,m,F,K),P(B,G,N,X,v,M);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+tt}`),d.length=0}break;case 14:if(d.length>=4){const Xt=Je[d.pop()],Yt=Je[d.pop()],Dt=d.pop(),Nt=d.pop();if(Xt&&Yt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Xt),se=t.charset.indexOf(Yt);n.components.push({glyphIndex:se,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Nt,dy:Dt}),q(r.get(se).pathCommands);const Or=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let Ir=0;Ir<Or.length;Ir+=1){const zt=Or[Ir];zt.type!=="Z"&&(zt.x+=Nt,zt.y+=Dt),(zt.type==="Q"||zt.type==="C")&&(zt.x1+=Nt,zt.y1+=Dt),zt.type==="C"&&(zt.x2+=Nt,zt.y2+=Dt)}q(Or)}}else d.length>0&&!x&&(T=d.shift()+o,x=!0);C&&h!==2&&(z(),C=!1);break;case 18:$();break;case 19:case 20:$(),H+=S+7>>3;break;case 21:d.length>2&&!x&&(T=d.shift()+o,x=!0),M+=d.pop(),v+=d.pop(),_(v,M);break;case 22:d.length>1&&!x&&(T=d.shift()+o,x=!0),v+=d.pop(),_(v,M);break;case 23:$();break;case 24:for(;d.length>2;)u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+d.shift(),P(u,p,g,m,v,M);v+=d.shift(),M+=d.shift(),A(v,M);break;case 25:for(;d.length>6;)v+=d.shift(),M+=d.shift(),A(v,M);u=v+d.shift(),p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+d.shift(),P(u,p,g,m,v,M);break;case 26:for(d.length%2&&(v+=d.shift());d.length>0;)u=v,p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g,M=m+d.shift(),P(u,p,g,m,v,M);break;case 27:for(d.length%2&&(M+=d.shift());d.length>0;)u=v+d.shift(),p=M,g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m,P(u,p,g,m,v,M);break;case 28:I=D[H],k=D[H+1],d.push((I<<24|k<<16)>>16),H+=2;break;case 29:W=d.pop()+a,xt=t.gsubrs[W],xt&&mt(xt);break;case 30:for(;d.length>0&&(u=v,p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+(d.length===1?d.shift():0),P(u,p,g,m,v,M),d.length!==0);)u=v+d.shift(),p=M,g=u+d.shift(),m=p+d.shift(),M=m+d.shift(),v=g+(d.length===1?d.shift():0),P(u,p,g,m,v,M);break;case 31:for(;d.length>0&&(u=v+d.shift(),p=M,g=u+d.shift(),m=p+d.shift(),M=m+d.shift(),v=g+(d.length===1?d.shift():0),P(u,p,g,m,v,M),d.length!==0);)u=v,p=M+d.shift(),g=u+d.shift(),m=p+d.shift(),v=g+d.shift(),M=m+(d.length===1?d.shift():0),P(u,p,g,m,v,M);break;default:tt<32?console.warn(`Glyph ${c}: unknown operator ${tt}`):tt<247?d.push(tt-139):tt<251?(I=D[H],H+=1,d.push((tt-247)*256+I+108)):tt<255?(I=D[H],H+=1,d.push(-(tt-251)*256-I-108)):(I=D[H],k=D[H+1],U=D[H+2],J=D[H+3],H+=4,d.push((I<<24|k<<16|U<<8|J)/65536))}}}mt(e),this.pathCommands=w,x&&(this.advanceWidth=T)}}var ji=Object.defineProperty,Fi=(i,t,e)=>t in i?ji(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Gi=(i,t,e)=>(Fi(i,t+"",e),e);class er{constructor(t){this._sfnt=t,Gi(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 Ri extends er{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Bi({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Xr=Object.defineProperty,Vi=(i,t,e)=>t in i?Xr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Yr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Xr(t,e,n),n},Ae=(i,t,e)=>(Vi(i,typeof t!="symbol"?t+"":t,e),e);class De extends Mt{constructor(t,e,r,n){super(t,e,r,n),Ae(this,"_offsets"),Ae(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,s=e+1;o<s;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],s=r+e[t+1]-n;return this._isString?this.view.readString(n,s):this.view.readBytes(n,s)}}Yr([y("uint16")],De.prototype,"count"),Yr([y("uint8")],De.prototype,"offsetSize");class Ne extends De{constructor(){super(...arguments),Ae(this,"_isString",!1)}}class Zr extends De{constructor(){super(...arguments),Ae(this,"_isString",!0)}}const qi=[".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"],Wi=[".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"],Hi=[".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"],Qi=[".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 ze(i,t){return t<=390?qi[t]:i[t-391]}var Xi=Object.defineProperty,Yi=(i,t,e)=>t in i?Xi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Kr=(i,t,e)=>(Yi(i,typeof t!="symbol"?t+"":t,e),e);function R(i,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:i,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class Jr extends Mt{constructor(){super(...arguments),Kr(this,"_dict"),Kr(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),s=o>>4,a=o&15;if(s===r||(e+=n[s],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,s;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(),s=e.readUint8(),r<<24|n<<16|o<<8|s;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,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 ze(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Zi=Object.defineProperty,rr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Zi(t,e,n),n};class Ee extends Jr{}rr([R(19)],Ee.prototype,"subrs"),rr([R(20)],Ee.prototype,"defaultWidthX"),rr([R(21)],Ee.prototype,"nominalWidthX");var Ki=Object.defineProperty,Y=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ki(t,e,n),n};class Q extends Jr{}Y([R(0,"string")],Q.prototype,"version"),Y([R(1,"string")],Q.prototype,"notice"),Y([R(1200,"string")],Q.prototype,"copyright"),Y([R(2,"string")],Q.prototype,"fullName"),Y([R(3,"string")],Q.prototype,"familyName"),Y([R(4,"string")],Q.prototype,"weight"),Y([R(1201)],Q.prototype,"isFixedPitch"),Y([R(1202)],Q.prototype,"italicAngle"),Y([R(1203,"number",-100)],Q.prototype,"underlinePosition"),Y([R(1204,"number",50)],Q.prototype,"underlineThickness"),Y([R(1205)],Q.prototype,"paintType"),Y([R(1206,"number",2)],Q.prototype,"charstringType"),Y([R(1207,"number[]",[.001,0,0,.001,0,0])],Q.prototype,"fontMatrix"),Y([R(13)],Q.prototype,"uniqueId"),Y([R(5,"number[]",[0,0,0,0])],Q.prototype,"fontBBox"),Y([R(1208)],Q.prototype,"strokeWidth"),Y([R(14)],Q.prototype,"xuid"),Y([R(15)],Q.prototype,"charset"),Y([R(16)],Q.prototype,"encoding"),Y([R(17)],Q.prototype,"charStrings"),Y([R(18,"number[]",[0,0])],Q.prototype,"private");var Ji=Object.defineProperty,ts=(i,t,e)=>t in i?Ji(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,nr=(i,t,e)=>(ts(i,typeof t!="symbol"?t+"":t,e),e);function nt(i,t=i){return e=>{ue.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(ue.prototype,t,{get(){return this.get(i)},set(r){return this.set(i,r)},configurable:!0,enumerable:!0})}}const tn=class xe{constructor(t){nr(this,"tables",new Map),nr(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}),s=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||s;return o}getPathCommands(t,e,r,n,o){var s;return(s=this.charToGlyph(t))==null?void 0:s.getPathCommands(e,r,n,o,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,o={},s){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];s.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 xe(this.tableViews)}delete(t){const e=xe.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=xe.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=xe.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}};nr(tn,"tableDefinitions",new Map);let ue=tn;class ct extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var en=Object.defineProperty,es=Object.getOwnPropertyDescriptor,rs=(i,t,e)=>t in i?en(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fe=(i,t,e,r)=>{for(var n=r>1?void 0:r?es(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&en(t,e,n),n},ir=(i,t,e)=>(rs(i,typeof t!="symbol"?t+"":t,e),e);f.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),ir(this,"_glyphs"),ir(this,"privateDict"),ir(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Ri(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new Zr(e,n),this.topDictIndex=new Ne(e,this.nameIndex.endOffset),this.stringIndex=new Zr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ne(e,this.stringIndex.endOffset),this.topDict=new Q(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new Ee(e,r+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ne(e,r+s+this.privateDict.subrs))),this.charStringsIndex=new Ne(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Wi:this.topDict.charset===1?this.charset=Hi:this.topDict.charset===2?this.charset=Qi:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Je:this.topDict.encoding===1?this.encoding=Li:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let o,s,a;e-=1;const l=[".notdef"],h=n.readUint8();if(h===0)for(o=0;o<e;o+=1)s=n.readUint16(),l.push(ze(r,s));else if(h===1)for(;l.length<=e;)for(s=n.readUint16(),a=n.readUint8(),o=0;o<=a;o+=1)l.push(ze(r,s)),s+=1;else if(h===2)for(;l.length<=e;)for(s=n.readUint16(),a=n.readUint16(),o=0;o<=a;o+=1)l.push(ze(r,s)),s+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const o={},s=e.readUint8();if(s===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),o[n]=r}else if(s===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const l=e.readUint8(),h=e.readUint8();for(let c=l;c<=l+h;c+=1)o[c]=n,n+=1}}else console.warn(`unknown encoding format:${s}`);return o}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},fe([y("uint8")],f.Cff.prototype,"majorVersion",2),fe([y("uint8")],f.Cff.prototype,"minorVersion",2),fe([y("uint8")],f.Cff.prototype,"headerSize",2),fe([y("uint8")],f.Cff.prototype,"offsetSize",2),f.Cff=fe([nt("CFF ","cff")],f.Cff);var ns=Object.defineProperty,Ue=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ns(t,e,n),n};const pe=class ri extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ri;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}};Ue([y("uint16")],pe.prototype,"format"),Ue([y("uint16")],pe.prototype,"length"),Ue([y("uint16")],pe.prototype,"language"),Ue([y({type:"uint8",size:256})],pe.prototype,"glyphIndexArray");let sr=pe;var is=Object.defineProperty,or=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&is(t,e,n),n};class de 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,s=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)>=s.length?l=0:(l=s[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,p=o[c].entryCount;u<p;u++)if(o[c].idRangeOffset+u>=s.length?l=0:(l=s[o[c].idRangeOffset+u],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<t){const g=(h<<8|u+o[c].firstCode)%65535;e.set(g,l)}}return e}}or([y("uint16")],de.prototype,"format"),or([y("uint16")],de.prototype,"length"),or([y("uint16")],de.prototype,"language");function rn(i){return i>32767?i-65536:i<-32767?i+65536:i}function ar(i,t){let e;const r=[];let n={};return i.forEach((o,s)=>{t&&s>t||((!e||s!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:s,startId:o,delta:rn(o-s)}):(n.start=Number(s),n.startId=o,n.delta=rn(o-s))),e={unicode:s,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var ss=Object.defineProperty,Rt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ss(t,e,n),n};const Bt=class ni 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=ar(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,s=new ni(new ArrayBuffer(24+e.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=r*2,s.searchRange=o,s.entrySelector=n,s.rangeShift=2*r-o,s.endCode=[...e.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...e.map(a=>a.start),65535],s.idDelta=[...e.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:r},()=>0),s}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,s=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(s[h]===0)t.set(c,(c+a[h])%65536);else{const p=h+s[h]/2+(c-n[h])-r,g=l[p];g!==0?t.set(c,(g+a[h])%65536):t.set(c,0)}return t.delete(65535),t}};Rt([y("uint16")],Bt.prototype,"format"),Rt([y("uint16")],Bt.prototype,"length"),Rt([y("uint16")],Bt.prototype,"language"),Rt([y("uint16")],Bt.prototype,"segCountX2"),Rt([y("uint16")],Bt.prototype,"searchRange"),Rt([y("uint16")],Bt.prototype,"entrySelector"),Rt([y("uint16")],Bt.prototype,"rangeShift");let lr=Bt;var os=Object.defineProperty,ge=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&os(t,e,n),n};class Vt 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}}ge([y("uint16")],Vt.prototype,"format"),ge([y("uint16")],Vt.prototype,"length"),ge([y("uint16")],Vt.prototype,"language"),ge([y("uint16")],Vt.prototype,"firstCode"),ge([y("uint16")],Vt.prototype,"entryCount");var as=Object.defineProperty,ye=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&as(t,e,n),n};const Kt=class ii 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=ar(t),r=new ii(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 s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,s++)}return t}};ye([y("uint16")],Kt.prototype,"format"),ye([y("uint16")],Kt.prototype,"reserved"),ye([y("uint32")],Kt.prototype,"length"),ye([y("uint32")],Kt.prototype,"language"),ye([y("uint32")],Kt.prototype,"nGroups");let hr=Kt;var ls=Object.defineProperty,cr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ls(t,e,n),n};class me 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(s=>{t.set(s.unicodeValue,s.glyphID)})}return t}}cr([y("uint16")],me.prototype,"format"),cr([y("uint32")],me.prototype,"length"),cr([y("uint32")],me.prototype,"numVarSelectorRecords");var nn=Object.defineProperty,hs=Object.getOwnPropertyDescriptor,cs=(i,t,e)=>t in i?nn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ur=(i,t,e,r)=>{for(var n=r>1?void 0:r?hs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&nn(t,e,n),n},sn=(i,t,e)=>(cs(i,typeof t!="symbol"?t+"":t,e),e);f.Cmap=class extends ct{constructor(){super(...arguments),sn(this,"_unicodeToGlyphIndexMap"),sn(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),r=lr.from(t),n=sr.from(t),o=e?hr.from(t):void 0,s=4+(o?32:24),a=s+r.view.byteLength,l=a+n.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},o&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new f.Cmap(new ArrayBuffer(4+8*h.length+r.view.byteLength+n.view.byteLength+((o==null?void 0:o.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(u=>{c.view.writeUint16(u.platformID),c.view.writeUint16(u.platformSpecificID),c.view.writeUint32(u.offset)}),c.view.writeBytes(r.view,s),c.view.writeBytes(n.view,a),o&&c.view.writeBytes(o.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,o=r.length;n<o;n++){const s=r[n],a=e.get(s);t.has(a)?t.get(a).push(s):t.set(a,[s])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new sr(this.view.buffer,e.offset);break;case 2:n=new de(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new lr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Vt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new hr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new me(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,l,h,c,u;const t=this.readSubtables(),e=(a=t.find(p=>p.format===0))==null?void 0:a.view,r=(l=t.find(p=>p.platformID===3&&p.platformSpecificID===3&&p.format===2))==null?void 0:l.view,n=(h=t.find(p=>p.platformID===3&&p.platformSpecificID===1&&p.format===4))==null?void 0:h.view,o=(c=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:c.view,s=(u=t.find(p=>p.platformID===0&&p.platformSpecificID===5&&p.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}},ur([y("uint16")],f.Cmap.prototype,"version",2),ur([y("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=ur([nt("cmap")],f.Cmap);class us extends tr{_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 he(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],s={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(s)}return r}_parseGlyphCoordinate(t,e,r,n,o){let s;return(e&n)>0?(s=t.view.readUint8(),e&o||(s=-s),s=r+s):(e&o)>0?s=r:s=r+t.view.readInt16(),s}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let w=0;w<n;w++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();he(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let w=0;w<l;++w)h.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;he(u<2e4,`Bad numberOfCoordinates:${c}`);const p=[];let g,m=0;for(;m<u;)if(g=t.view.readUint8(),p.push(g),m++,g&8&&m<u){const w=t.view.readUint8();for(let d=0;d<w;d++)p.push(g),m++}if(he(p.length===u,`Bad flags length: ${p.length}, numberOfCoordinates: ${u}`),a.length>0){const w=[];let d;if(u>0){for(let C=0;C<u;C+=1)g=p[C],d={},d.onCurve=!!(g&1),d.lastPointOfContour=a.includes(C),w.push(d);let S=0;for(let C=0;C<u;C+=1)g=p[C],d=w[C],d.x=this._parseGlyphCoordinate(t,g,S,2,16),S=d.x;let x=0;for(let C=0;C<u;C+=1)g=p[C],d=w[C],d.y=this._parseGlyphCoordinate(t,g,x,4,32),x=d.y}this.points=w}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{he(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 p=h.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};p=this._transformPoints([p],g)[0],g.dx=u.x-p.x,g.dy=u.y-p.y,c=this._transformPoints(h.points,g)}this.points=this.points.concat(c)}}const o=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const h=s[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 p=0,g=h.length;p<g;++p)if(c=u,u=h[(p+1)%g],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let m=u;u.onCurve||(m={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:m.x,y:m.y})}o.push({type:"Z"})}this.pathCommands=o}}class fs extends er{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new us({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var on=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,ds=(i,t,e)=>t in i?on(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,gs=(i,t,e,r)=>{for(var n=r>1?void 0:r?ps(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&on(t,e,n),n},ys=(i,t,e)=>(ds(i,t+"",e),e);const Jt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends ct{constructor(){super(...arguments),ys(this,"_glyphs")}static from(t){const e=t.reduce((n,o)=>n+o.byteLength,0),r=new f.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new fs(this._sfnt))}},f.Glyf=gs([nt("glyf")],f.Glyf);var ms=Object.defineProperty,ws=Object.getOwnPropertyDescriptor,vs=(i,t,e,r)=>{for(var n=r>1?void 0:r?ws(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ms(t,e,n),n};f.Gpos=class extends ct{},f.Gpos=vs([nt("GPOS","gpos")],f.Gpos);var bs=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,qt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ms(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&bs(t,e,n),n};f.Gsub=class extends ct{},qt([y("uint16")],f.Gsub.prototype,"majorVersion",2),qt([y("uint16")],f.Gsub.prototype,"minorVersion",2),qt([y("uint16")],f.Gsub.prototype,"scriptListOffset",2),qt([y("uint16")],f.Gsub.prototype,"featureListOffset",2),qt([y("uint16")],f.Gsub.prototype,"lookupListOffset",2),qt([y("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=qt([nt("GSUB","gsub")],f.Gsub);var xs=Object.defineProperty,Cs=Object.getOwnPropertyDescriptor,et=(i,t,e,r)=>{for(var n=r>1?void 0:r?Cs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&xs(t,e,n),n};f.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([y("fixed")],f.Head.prototype,"version",2),et([y("fixed")],f.Head.prototype,"fontRevision",2),et([y("uint32")],f.Head.prototype,"checkSumAdjustment",2),et([y("uint32")],f.Head.prototype,"magickNumber",2),et([y("uint16")],f.Head.prototype,"flags",2),et([y("uint16")],f.Head.prototype,"unitsPerEm",2),et([y({type:"longDateTime"})],f.Head.prototype,"created",2),et([y({type:"longDateTime"})],f.Head.prototype,"modified",2),et([y("int16")],f.Head.prototype,"xMin",2),et([y("int16")],f.Head.prototype,"yMin",2),et([y("int16")],f.Head.prototype,"xMax",2),et([y("int16")],f.Head.prototype,"yMax",2),et([y("uint16")],f.Head.prototype,"macStyle",2),et([y("uint16")],f.Head.prototype,"lowestRecPPEM",2),et([y("int16")],f.Head.prototype,"fontDirectionHint",2),et([y("int16")],f.Head.prototype,"indexToLocFormat",2),et([y("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=et([nt("head")],f.Head);var Ss=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,pt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ps(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ss(t,e,n),n};f.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([y("fixed")],f.Hhea.prototype,"version",2),pt([y("int16")],f.Hhea.prototype,"ascent",2),pt([y("int16")],f.Hhea.prototype,"descent",2),pt([y("int16")],f.Hhea.prototype,"lineGap",2),pt([y("uint16")],f.Hhea.prototype,"advanceWidthMax",2),pt([y("int16")],f.Hhea.prototype,"minLeftSideBearing",2),pt([y("int16")],f.Hhea.prototype,"minRightSideBearing",2),pt([y("int16")],f.Hhea.prototype,"xMaxExtent",2),pt([y("int16")],f.Hhea.prototype,"caretSlopeRise",2),pt([y("int16")],f.Hhea.prototype,"caretSlopeRun",2),pt([y("int16")],f.Hhea.prototype,"caretOffset",2),pt([y({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),pt([y("int16")],f.Hhea.prototype,"metricDataFormat",2),pt([y("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=pt([nt("hhea")],f.Hhea);var an=Object.defineProperty,_s=Object.getOwnPropertyDescriptor,Ts=(i,t,e)=>t in i?an(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Os=(i,t,e,r)=>{for(var n=r>1?void 0:r?_s(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&an(t,e,n),n},Is=(i,t,e)=>(Ts(i,t+"",e),e);f.Hmtx=class extends ct{constructor(){super(...arguments),Is(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((o,s)=>(s<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},f.Hmtx=Os([nt("hmtx")],f.Hmtx);var As=Object.defineProperty,Ds=Object.getOwnPropertyDescriptor,Ns=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ds(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&As(t,e,n),n};f.Kern=class extends ct{},f.Kern=Ns([nt("kern","kern")],f.Kern);var ln=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Es=(i,t,e)=>t in i?ln(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Us=(i,t,e,r)=>{for(var n=r>1?void 0:r?zs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ln(t,e,n),n},Ls=(i,t,e)=>(Es(i,t+"",e),e);f.Loca=class extends ct{constructor(){super(...arguments),Ls(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new f.Loca(new ArrayBuffer(r));return t.forEach(o=>{e?n.view.writeUint32(o):n.view.writeUint16(o/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},f.Loca=Us([nt("loca")],f.Loca);var $s=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,ut=(i,t,e,r)=>{for(var n=r>1?void 0:r?ks(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&$s(t,e,n),n};f.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([y("fixed")],f.Maxp.prototype,"version",2),ut([y("uint16")],f.Maxp.prototype,"numGlyphs",2),ut([y("uint16")],f.Maxp.prototype,"maxPoints",2),ut([y("uint16")],f.Maxp.prototype,"maxContours",2),ut([y("uint16")],f.Maxp.prototype,"maxComponentPoints",2),ut([y("uint16")],f.Maxp.prototype,"maxComponentContours",2),ut([y("uint16")],f.Maxp.prototype,"maxZones",2),ut([y("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),ut([y("uint16")],f.Maxp.prototype,"maxStorage",2),ut([y("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),ut([y("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),ut([y("uint16")],f.Maxp.prototype,"maxStackElements",2),ut([y("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),ut([y("uint16")],f.Maxp.prototype,"maxComponentElements",2),ut([y("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=ut([nt("maxp")],f.Maxp);var hn=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,js=(i,t,e)=>t in i?hn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Le=(i,t,e,r)=>{for(var n=r>1?void 0:r?Bs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&hn(t,e,n),n},Fs=(i,t,e)=>(js(i,t+"",e),e);const cn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},fr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Gs={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},un={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends ct{constructor(){super(...arguments),Fs(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let l=0;l<t;++l)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const r=this.stringOffset;for(let l=0;l<t;++l){const h=e[l];h.name=this.view.readBytes(r+h.offset,h.length)}let n=fr.Macintosh,o=Gs.Default,s=0;e.some(l=>l.platform===fr.Microsoft&&l.encoding===un.UCS2&&l.language===1033)&&(n=fr.Microsoft,o=un.UCS2,s=1033);const a={};for(let l=0;l<t;++l){const h=e[l];h.platform===n&&h.encoding===o&&h.language===s&&cn[h.nameId]&&(a[cn[h.nameId]]=s===0?Di(h.name):Ni(h.name))}return a}},Le([y("uint16")],f.Name.prototype,"format",2),Le([y("uint16")],f.Name.prototype,"count",2),Le([y("uint16")],f.Name.prototype,"stringOffset",2),f.Name=Le([nt("name")],f.Name);var Rs=Object.defineProperty,Vs=Object.getOwnPropertyDescriptor,O=(i,t,e,r)=>{for(var n=r>1?void 0:r?Vs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Rs(t,e,n),n};f.Os2=class extends ct{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},O([y("uint16")],f.Os2.prototype,"version",2),O([y("int16")],f.Os2.prototype,"xAvgCharWidth",2),O([y("uint16")],f.Os2.prototype,"usWeightClass",2),O([y("uint16")],f.Os2.prototype,"usWidthClass",2),O([y("uint16")],f.Os2.prototype,"fsType",2),O([y("uint16")],f.Os2.prototype,"ySubscriptXSize",2),O([y("uint16")],f.Os2.prototype,"ySubscriptYSize",2),O([y("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),O([y("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),O([y("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),O([y("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),O([y("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),O([y("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),O([y("uint16")],f.Os2.prototype,"yStrikeoutSize",2),O([y("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),O([y("uint16")],f.Os2.prototype,"sFamilyClass",2),O([y({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),O([y({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),O([y({type:"uint8"})],f.Os2.prototype,"bWeight",2),O([y({type:"uint8"})],f.Os2.prototype,"bProportion",2),O([y({type:"uint8"})],f.Os2.prototype,"bContrast",2),O([y({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),O([y({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),O([y({type:"uint8"})],f.Os2.prototype,"bLetterform",2),O([y({type:"uint8"})],f.Os2.prototype,"bMidline",2),O([y({type:"uint8"})],f.Os2.prototype,"bXHeight",2),O([y({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),O([y({type:"char",size:4})],f.Os2.prototype,"achVendID",2),O([y("uint16")],f.Os2.prototype,"fsSelection",2),O([y("uint16")],f.Os2.prototype,"usFirstCharIndex",2),O([y("uint16")],f.Os2.prototype,"usLastCharIndex",2),O([y("int16")],f.Os2.prototype,"sTypoAscender",2),O([y("int16")],f.Os2.prototype,"sTypoDescender",2),O([y("int16")],f.Os2.prototype,"sTypoLineGap",2),O([y("uint16")],f.Os2.prototype,"usWinAscent",2),O([y("uint16")],f.Os2.prototype,"usWinDescent",2),O([y({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),O([y({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),O([y("int16")],f.Os2.prototype,"sCapHeight",2),O([y("uint16")],f.Os2.prototype,"usDefaultChar",2),O([y("uint16")],f.Os2.prototype,"usBreakChar",2),O([y("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=O([nt("OS/2","os2")],f.Os2);var qs=Object.defineProperty,Ws=Object.getOwnPropertyDescriptor,It=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ws(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&qs(t,e,n),n};f.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},It([y("fixed")],f.Post.prototype,"format",2),It([y("fixed")],f.Post.prototype,"italicAngle",2),It([y("int16")],f.Post.prototype,"underlinePosition",2),It([y("int16")],f.Post.prototype,"underlineThickness",2),It([y("uint32")],f.Post.prototype,"isFixedPitch",2),It([y("uint32")],f.Post.prototype,"minMemType42",2),It([y("uint32")],f.Post.prototype,"maxMemType42",2),It([y("uint32")],f.Post.prototype,"minMemType1",2),It([y("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=It([nt("post")],f.Post);var Hs=Object.defineProperty,Qs=Object.getOwnPropertyDescriptor,dt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Qs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Hs(t,e,n),n};f.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([y("fixed")],f.Vhea.prototype,"version",2),dt([y("int16")],f.Vhea.prototype,"vertTypoAscender",2),dt([y("int16")],f.Vhea.prototype,"vertTypoDescender",2),dt([y("int16")],f.Vhea.prototype,"vertTypoLineGap",2),dt([y("int16")],f.Vhea.prototype,"advanceHeightMax",2),dt([y("int16")],f.Vhea.prototype,"minTopSideBearing",2),dt([y("int16")],f.Vhea.prototype,"minBottomSideBearing",2),dt([y("int16")],f.Vhea.prototype,"yMaxExtent",2),dt([y("int16")],f.Vhea.prototype,"caretSlopeRise",2),dt([y("int16")],f.Vhea.prototype,"caretSlopeRun",2),dt([y("int16")],f.Vhea.prototype,"caretOffset",2),dt([y({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),dt([y("int16")],f.Vhea.prototype,"metricDataFormat",2),dt([y("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=dt([nt("vhea")],f.Vhea);var fn=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,Ys=(i,t,e)=>t in i?fn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zs=(i,t,e,r)=>{for(var n=r>1?void 0:r?Xs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&fn(t,e,n),n},Ks=(i,t,e)=>(Ys(i,t+"",e),e);f.Vmtx=class extends ct{constructor(){super(...arguments),Ks(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var o;const t=this._sfnt.maxp.numGlyphs,e=((o=this._sfnt.vhea)==null?void 0:o.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((s,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},f.Vmtx=Zs([nt("vmtx")],f.Vmtx);var pn=Object.defineProperty,Js=(i,t,e)=>t in i?pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,we=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&pn(t,e,n),n},$e=(i,t,e)=>(Js(i,typeof t!="symbol"?t+"":t,e),e);class it extends Oe{constructor(){super(...arguments),$e(this,"format","TrueType"),$e(this,"mimeType","font/ttf"),$e(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checksum(t){const e=Gt(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let o=0,s=r/4;o<s;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,p)=>u+e(p.byteLength),0),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const s=Math.log(2);o.searchRange=Math.floor(Math.log(r)/s)*16,o.entrySelector=Math.floor(o.searchRange/s),o.rangeShift=r*16-o.searchRange;let a=12+r*16,l=0;const h=o.getDirectories();t.tableViews.forEach((u,p)=>{const g=h[l++];g.tag=p,g.checkSum=this.checksum(u),g.offset=a,g.length=u.byteLength,o.view.writeBytes(u,a),a+=e(g.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 Zt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e(it,"signature",new Set([65536,1953658213,1954115633])),we([y("uint32")],it.prototype,"scalerType"),we([y("uint16")],it.prototype,"numTables"),we([y("uint16")],it.prototype,"searchRange"),we([y("uint16")],it.prototype,"entrySelector"),we([y("uint16")],it.prototype,"rangeShift");var to=Object.defineProperty,eo=(i,t,e)=>t in i?to(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,pr=(i,t,e)=>(eo(i,typeof t!="symbol"?t+"":t,e),e);class ke extends it{constructor(){super(...arguments),pr(this,"format","OpenType"),pr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}pr(ke,"signature",new Set([1330926671]));var ro=Object.defineProperty,ve=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ro(t,e,n),n};class Wt extends Mt{constructor(t,e){super(t,e,20)}}ve([y({type:"char",size:4})],Wt.prototype,"tag"),ve([y("uint32")],Wt.prototype,"offset"),ve([y("uint32")],Wt.prototype,"compLength"),ve([y("uint32")],Wt.prototype,"origLength"),ve([y("uint32")],Wt.prototype,"origChecksum");var dn=Object.defineProperty,no=(i,t,e)=>t in i?dn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&dn(t,e,n),n},Be=(i,t,e)=>(no(i,typeof t!="symbol"?t+"":t,e),e);const gt=class Ar extends Oe{constructor(){super(...arguments),Be(this,"format","WOFF"),Be(this,"mimeType","font/woff"),Be(this,"_sfnt")}get subfontFormat(){return it.is(this.flavor)?"TrueType":ke.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checkSum(t){const e=Gt(t),r=e.byteLength,n=Math.floor(r/4);let o=0,s=0;for(;s<n;)o+=e.getUint32(4*s++,!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,p)=>{const g=Gt(vi(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:p,view:g.byteLength<u.byteLength?g:u,rawView:u})});const o=n.length,s=n.reduce((u,p)=>u+r(p.view.byteLength),0),a=new Ar(new ArrayBuffer(44+20*o+s+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((u,p)=>u+r(p.rawView.byteLength),0);let l=44+o*20,h=0;const c=a.getDirectories();return n.forEach(u=>{const p=c[h++];p.tag=u.tag,p.offset=l,p.compLength=u.view.byteLength,p.origChecksum=Ar.checkSum(u.rawView),p.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Wt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,s=e.origLength,a=n+o;return t[r]=o>=s?new DataView(this.view.buffer,n,o):new DataView(bi(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Be(gt,"signature",new Set([2001684038])),vt([y("uint32")],gt.prototype,"signature"),vt([y("uint32")],gt.prototype,"flavor"),vt([y("uint32")],gt.prototype,"length"),vt([y("uint16")],gt.prototype,"numTables"),vt([y("uint16")],gt.prototype,"reserved"),vt([y("uint32")],gt.prototype,"totalSfntSize"),vt([y("uint16")],gt.prototype,"majorVersion"),vt([y("uint16")],gt.prototype,"minorVersion"),vt([y("uint32")],gt.prototype,"metaOffset"),vt([y("uint32")],gt.prototype,"metaLength"),vt([y("uint32")],gt.prototype,"metaOrigLength"),vt([y("uint32")],gt.prototype,"privOffset"),vt([y("uint32")],gt.prototype,"privLength");let Ut=gt;function gn(i){if(it.is(i))return new it(i);if(ke.is(i))return new ke(i);if(Ut.is(i))return new Ut(i)}var io=Object.defineProperty,so=(i,t,e)=>t in i?io(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,be=(i,t,e)=>(so(i,typeof t!="symbol"?t+"":t,e),e);const yn=class si{constructor(){be(this,"fallbackFont"),be(this,"_loading",new Map),be(this,"_loaded",new Map),be(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...si.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;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...s}=e,{family:a,url:l}=t;if(this._loaded.has(l))return r&&(this._loading.forEach(c=>c.cancel()),this._loading.clear()),this._loaded.get(l);let h=this._loading.get(l);return h||(h=this._createRequest(l,s),this._loading.set(l,h)),r&&this._loading.forEach((c,u)=>{c!==h&&(c.cancel(),this._loading.delete(u))}),h.when.then(c=>{const u={...t,font:gn(c)??c};return this._loaded.has(l)||(this._loaded.set(l,u),new Set(Array.isArray(a)?a:[a]).forEach(p=>{this._namesUrls.set(p,l),typeof document<"u"&&(n&&this.injectFontFace(p,c),o&&this.injectStyleTag(p,l))})),u}).catch(c=>{if(c instanceof DOMException&&c.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw c}).finally(()=>{this._loading.delete(l)})}};be(yn,"defaultRequestInit",{cache:"force-cache"});let mn=yn;const wn=new mn;function vn(i,t){const{cmap:e,loca:r,hmtx:n,vmtx:o,glyf:s}=i,a=e.unicodeToGlyphIndexMap,l=r.locations,h=n.metrics,c=o==null?void 0:o.metrics,u=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,d)=>w-d),p=new Map;u.forEach(w=>{const d=a.get(w)??0;let x=p.get(d);x||p.set(d,x=new Set),x.add(w)});const g=[],m=w=>{const d=h[w],x=(c==null?void 0:c[w])??{advanceHeight:0,topSideBearing:0},C=l[w],S=l[w+1]??C,T={...d,...x,rawGlyphIndex:w,glyphIndex:g.length,unicodes:Array.from(p.get(w)??[]),view:new DataView(s.view.buffer,s.view.byteOffset+C,S-C)};return g.push(T),T};return m(0),u.forEach(w=>m(a.get(w))),g.slice().forEach(w=>{const{view:d}=w;if(!d.byteLength||d.getInt16(0)>=0)return;let C=10,S;do{S=d.getUint16(C);const T=C+2,v=d.getUint16(T);C+=4,Jt.ARG_1_AND_2_ARE_WORDS&S?C+=4:C+=2,Jt.WE_HAVE_A_SCALE&S?C+=2:Jt.WE_HAVE_AN_X_AND_Y_SCALE&S?C+=4:Jt.WE_HAVE_A_TWO_BY_TWO&S&&(C+=8);const M=m(v);d.setUint16(T,M.glyphIndex)}while(Jt.MORE_COMPONENTS&S)}),g}function bn(i,t){const e=vn(i,t),r=e.length,{head:n,maxp:o,hhea:s,vhea:a}=i;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,o.numGlyphs=r;let l=0;i.loca=f.Loca.from([...e.map(p=>{const g=l;return l+=p.view.byteLength,g}),l],n.indexToLocFormat);const h=e.reduce((p,g,m)=>(g.unicodes.forEach(w=>p.set(w,m)),p),new Map);i.cmap=f.Cmap.from(h),i.glyf=f.Glyf.from(e.map(p=>p.view)),s.numOfLongHorMetrics=r,i.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=r,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function oo(i,t){let e,r;if(i instanceof it)e=i.sfnt.clone(),r="ttf";else if(i instanceof Ut)e=i.sfnt.clone(),r="woff";else{const o=Gt(i);if(it.is(o))e=new it(o).sfnt,r="ttf-buffer";else if(Ut.is(o))e=new Ut(o).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=bn(e,t);switch(r){case"ttf":return it.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return it.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const ao={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function dr(i,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:p=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=r,i.lineWidth=n,i.lineCap=o,i.lineJoin=ao[s],i.miterLimit=a,i.setLineDash(l),i.lineDashOffset=h,i.shadowOffsetX=c,i.shadowOffsetY=u,i.shadowBlur=p,i.shadowColor=g}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}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),s=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*s),e.y-(n*s+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 V{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){if(t.length===0)return new V;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 V(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new V(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var lo=Object.defineProperty,ho=(i,t,e)=>t in i?lo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,co=(i,t,e)=>(ho(i,t+"",e),e);class yt{constructor(t=1,e=0,r=0,n=0,o=1,s=0,a=0,l=0,h=1){co(this,"elements",[]),this.set(t,e,r,n,o,s,a,l,h)}set(t,e,r,n,o,s,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]=s,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,s=r[0],a=r[3],l=r[6],h=r[1],c=r[4],u=r[7],p=r[2],g=r[5],m=r[8],w=n[0],d=n[3],x=n[6],C=n[1],S=n[4],T=n[7],v=n[2],M=n[5],A=n[8];return o[0]=s*w+a*C+l*v,o[3]=s*d+a*S+l*M,o[6]=s*x+a*T+l*A,o[1]=h*w+c*C+u*v,o[4]=h*d+c*S+u*M,o[7]=h*x+c*T+u*A,o[2]=p*w+g*C+m*v,o[5]=p*d+g*S+m*M,o[8]=p*x+g*T+m*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*s-a*h,p=a*l-c*o,g=h*o-s*l,m=e*u+r*p+n*g;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/m;return t[0]=u*w,t[1]=(n*h-c*r)*w,t[2]=(a*r-n*s)*w,t[3]=p*w,t[4]=(c*e-n*l)*w,t[5]=(n*o-a*e)*w,t[6]=g*w,t[7]=(r*l-h*e)*w,t[8]=(s*e-r*o)*w,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(gr.makeScale(t,e)),this}rotate(t){return this.premultiply(gr.makeRotation(-t)),this}translate(t,e){return this.premultiply(gr.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 gr=new yt;function Mn(i,t,e,r){const n=i*e+t*r,o=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+r*r);let s=Math.acos(Math.max(-1,Math.min(1,n/o)));return i*r-t*e<0&&(s=-s),s}function xn(i,t,e,r,n,o,s,a){if(t===0||e===0){i.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(s.x-a.x)/2,h=(s.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,u=-Math.sin(r)*l+Math.cos(r)*h;let p=t*t,g=e*e;const m=c*c,w=u*u,d=m/p+w/g;if(d>1){const z=Math.sqrt(d);t=z*t,e=z*e,p=t*t,g=e*e}const x=p*w+g*m,C=(p*g-x)/x;let S=Math.sqrt(Math.max(0,C));n===o&&(S=-S);const T=S*t*u/e,v=-S*e*c/t,M=Math.cos(r)*T-Math.sin(r)*v+(s.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*v+(s.y+a.y)/2,P=Mn(1,0,(c-T)/t,(u-v)/e),_=Mn((c-T)/t,(u-v)/e,(-c-T)/t,(-u-v)/e)%(Math.PI*2);i.ellipse(M,A,t,e,r,P,P+_,o===1)}function te(i,t){return i-(t-i)}function yr(i,t){const e=new b,r=new b;for(let n=0,o=i.length;n<o;n++){const s=i[n];if(s.type==="m"||s.type==="M")s.type==="m"?e.add(s):e.copy(s),t.moveTo(e.x,e.y),r.copy(e);else if(s.type==="h"||s.type==="H")s.type==="h"?e.x+=s.x:e.x=s.x,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="v"||s.type==="V")s.type==="v"?e.y+=s.y:e.y=s.y,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="l"||s.type==="L")s.type==="l"?e.add(s):e.copy(s),t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="c"||s.type==="C")s.type==="c"?(t.bezierCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(t.quadraticCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x,e.y+s.y),r.x=e.x+s.x1,r.y=e.y+s.y1,e.add(s)):(t.quadraticCurveTo(s.x1,s.y1,s.x,s.y),r.x=s.x1,r.y=s.y1,e.copy(s));else if(s.type==="t"||s.type==="T"){const a=te(e.x,r.x),l=te(e.y,r.y);r.x=a,r.y=l,s.type==="t"?(t.quadraticCurveTo(a,l,e.x+s.x,e.y+s.y),e.add(s)):(t.quadraticCurveTo(a,l,s.x,s.y),e.copy(s))}else if(s.type==="a"||s.type==="A"){const a=e.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;e.add(s)}else{if(e.equals(s))continue;e.copy(s)}r.copy(e),xn(t,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,e)}else s.type==="z"||s.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",s)}}const Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Pt(i,t,e=0){let a=0,l=!0,h="",c="";const u=[];function p(d,x,C){const S=new SyntaxError(`Unexpected character "${d}" at index ${x}.`);throw S.partial=C,S}function g(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let m;const w=i.length;for(let d=0;d<w;d++){if(m=i[d],Array.isArray(t)&&t.includes(u.length%e)&&Z.FLAGS.test(m)){a=1,h=m,g();continue}if(a===0){if(Z.WHITESPACE.test(m))continue;if(Z.DIGIT.test(m)||Z.SIGN.test(m)){a=1,h=m;continue}if(Z.POINT.test(m)){a=2,h=m;continue}Z.COMMA.test(m)&&(l&&p(m,d,u),l=!0)}if(a===1){if(Z.DIGIT.test(m)){h+=m;continue}if(Z.POINT.test(m)){h+=m,a=2;continue}if(Z.EXP.test(m)){a=3;continue}Z.SIGN.test(m)&&h.length===1&&Z.SIGN.test(h[0])&&p(m,d,u)}if(a===2){if(Z.DIGIT.test(m)){h+=m;continue}if(Z.EXP.test(m)){a=3;continue}Z.POINT.test(m)&&h[h.length-1]==="."&&p(m,d,u)}if(a===3){if(Z.DIGIT.test(m)){c+=m;continue}if(Z.SIGN.test(m)){if(c===""){c+=m;continue}c.length===1&&Z.SIGN.test(c)&&p(m,d,u)}}Z.WHITESPACE.test(m)?(g(),a=0,l=!1):Z.COMMA.test(m)?(g(),a=0,l=!0):Z.SIGN.test(m)?(g(),a=1,h=m):Z.POINT.test(m)?(g(),a=2,h=m):p(m,d,u)}return g(),u}function Cn(i){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=i.length;n<o;n++){const s=i[n];switch(s.type){case"m":case"M":if(s.x===e.x&&s.y===e.y)continue;r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y,t.x=s.x,t.y=s.y;break;case"h":case"H":r+=`${s.type} ${s.x}`,e.x=s.x;break;case"v":case"V":r+=`${s.type} ${s.y}`,e.y=s.y;break;case"l":case"L":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"c":case"C":r+=`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"s":case"S":r+=`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"q":case"Q":r+=`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"t":case"T":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"a":case"A":r+=`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"z":case"Z":r+=s.type,e.x=t.x,e.y=t.y;break}}return r}const uo=/[a-df-z][^a-df-z]*/gi;function mr(i){const t=[],e=i.match(uo);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=Pt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:s,x:l[h],y:l[h+1]}):t.push({type:s==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Pt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:s,x:l[h]});break;case"v":case"V":l=Pt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:s,y:l[h]});break;case"l":case"L":l=Pt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:s,x:l[h],y:l[h+1]});break;case"c":case"C":l=Pt(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:s,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=Pt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:s,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Pt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:s,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Pt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:s,x:l[h],y:l[h+1]});break;case"a":case"A":l=Pt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:s,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:s});break;default:console.warn(o)}}return t}var fo=Object.defineProperty,po=(i,t,e)=>t in i?fo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wr=(i,t,e)=>(po(i,typeof t!="symbol"?t+"":t,e),e);class _t{constructor(){wr(this,"arcLengthDivisions",200),wr(this,"_cacheArcLengths"),wr(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 s=1;s<=t;s++)r=this.getPoint(s/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 s;e?s=e:s=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]-s,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===s)return n/(o-1);const c=r[n],p=r[n+1]-c,g=(s-c)/p;return(n+g)/(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 s=this.getPoint(o);if(s.distanceTo(t)<e)return o;s.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.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new V(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 Cn(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)}}class je extends _t{constructor(t,e,r=0,n=Math.PI*2){super(),this.center=t,this.radius=e,this.start=r,this.end=n}getPoint(t){const{radius:e,center:r}=this;return r.clone().add(this.getNormal(t).clone().scale(e))}getTangent(t,e=new b){const{x:r,y:n}=this.getNormal(t);return e.set(-n,r)}getNormal(t,e=new b){const{start:r,end:n}=this,o=t*(n-r)+r-.5*Math.PI;return e.set(Math.cos(o),Math.sin(o))}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){return t.x=Math.min(t.x,this.center.x-this.radius),t.y=Math.min(t.y,this.center.y-this.radius),e.x=Math.max(e.x,this.center.x+this.radius),e.y=Math.max(e.y,this.center.y+this.radius),{min:t,max:e}}}function Sn(i,t,e,r,n){const o=(r-t)*.5,s=(n-e)*.5,a=i*i,l=i*a;return(2*e-2*r+o+s)*l+(-3*e+3*r-2*o-s)*a+o*i+e}function go(i,t){const e=1-i;return e*e*t}function yo(i,t){return 2*(1-i)*i*t}function mo(i,t){return i*i*t}function Pn(i,t,e,r){return go(i,t)+yo(i,e)+mo(i,r)}function wo(i,t){const e=1-i;return e*e*e*t}function vo(i,t){const e=1-i;return 3*e*e*i*t}function bo(i,t){return 3*(1-i)*i*i*t}function Mo(i,t){return i*i*i*t}function _n(i,t,e,r,n){return wo(i,t)+vo(i,e)+bo(i,r)+Mo(i,n)}class Tn extends _t{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:s}=this;return e.set(_n(t,r.x,n.x,o.x,s.x),_n(t,r.y,n.y,o.y,s.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),s=(-e+o)/(2*t),a=(-e-o)/(2*t);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(t=b.MAX,e=b.MIN){const r=this.start,n=this.startControl,o=this.endControl,s=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(s.y-o.y)),h=[0,1,...a,...l];return((u,p)=>{for(const g of u)for(let m=0;m<=p;m++){const w=m/p-.5,d=Math.min(1,Math.max(0,g+w)),x=this.getPoint(d);t.x=Math.min(t.x,x.x),t.y=Math.min(t.y,x.y),e.x=Math.max(e.x,x.x),e.y=Math.max(e.y,x.y)}})(h,10),{min:t,max:e}}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 xo=new yt,On=new yt,In=new yt,Fe=new b;class An extends _t{constructor(t=new b,e=1,r=1,n=0,o=0,s=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=s,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 s=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(s),l=this.center.y+this.radiusY*Math.sin(s);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,p=l-this.center.y;a=u*h-p*c+this.center.x,l=u*c+p*h+this.center.y}return e.set(a,l)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:s,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),p=Math.abs(n-o),g=p>Math.PI?1:0,m=s?1:0,w=a*180/Math.PI;if(p>=2*Math.PI){const d=n+Math.PI,x=l+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),C=h+e*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:m,x,y:C},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:m,x:c,y:u}]}else{const d=l+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),x=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:w,largeArcFlag:g,sweepFlag:m,x:d,y:x}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:s,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,n,o,s,a,!l),this}matrix(t){return Fe.set(this.center.x,this.center.y),Fe.applyMatrix3(t),this.center.x=Fe.x,this.center.y=Fe.y,Po(t)?Co(this,t):So(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){const{center:r,radiusX:n,radiusY:o,rotation:s}=this,{x:a,y:l}=r,h=Math.cos(s),c=Math.sin(s),u=Math.sqrt(n*n*h*h+o*o*c*c),p=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-p),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,l+p),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Co(i,t){const e=i.radiusX,r=i.radiusY,n=Math.cos(i.rotation),o=Math.sin(i.rotation),s=new b(e*n,e*o),a=new b(-r*o,r*n),l=s.applyMatrix3(t),h=a.applyMatrix3(t),c=xo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=On.copy(c).invert(),m=In.copy(u).transpose().multiply(u).elements,w=_o(m[0],m[1],m[4]),d=Math.sqrt(w.rt1),x=Math.sqrt(w.rt2);if(i.radiusX=1/d,i.radiusY=1/x,i.rotation=Math.atan2(w.sn,w.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const S=On.set(d,0,0,0,x,0,0,0,1),T=In.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=S.multiply(T).multiply(c),M=A=>{const{x:P,y:_}=new b(Math.cos(A),Math.sin(A)).applyMatrix3(v);return Math.atan2(_,P)};i.startAngle=M(i.startAngle),i.endAngle=M(i.endAngle),Dn(t)&&(i.clockwise=!i.clockwise)}}function So(i,t){const e=Nn(t),r=zn(t);i.radiusX*=e,i.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=n,Dn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Dn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Po(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Nn(i),n=zn(i);return Math.abs(e/(r*n))>Number.EPSILON}function Nn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function zn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function _o(i,t,e){let r,n,o,s,a;const l=i+e,h=i-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,n=i*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,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(t)===0?(o=1,s=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),s=a*o),h>0&&(a=o,o=-s,s=a),{rt1:r,rt2:n,cs:o,sn:s}}class Ht extends _t{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}}var To=Object.defineProperty,Oo=(i,t,e)=>t in i?To(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Io=(i,t,e)=>(Oo(i,t+"",e),e);class Ao extends _t{constructor(t,e,r=0,n=1){super(),this.center=t,this.size=e,this.start=r,this.end=n,Io(this,"curveT",0),this.update()}update(){const{x:t,y:e}=this.center,r=new b(t+.5*this.size,e-.5*this.size),n=new b(t-.5*this.size,e-.5*this.size),o=new b(t,e+.5*this.size),s=new je(r,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),a=new je(n,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),l=new je(o,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),h=new b(t,e+this.size),c=new b(t+this.size,e),u=new b().lerpVectors(c,h,.75),p=new b(t-this.size,e),g=new b().lerpVectors(p,h,.75),m=new Ht(c,u),w=new Ht(g,p);return this.curves=[s,m,l,w,a],this}getPoint(t){return this.getCurve(t).getPoint(this.curveT)}getPointAt(t){return this.getPoint(t)}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=9*Math.PI/8+1.5;let r;const n=.5*Math.PI;return e<n?(r=0,this.curveT=e/n):e<n+.75?(r=1,this.curveT=(e-n)/.75):e<5*Math.PI/8+.75?(r=2,this.curveT=(e-n-.75)/(Math.PI/8)):e<5*Math.PI/8+1.5?(r=3,this.curveT=(e-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(e-5*Math.PI/8-1.5)/n),this.curves[r]}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}}var Do=Object.defineProperty,No=(i,t,e)=>t in i?Do(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vr=(i,t,e)=>(No(i,typeof t!="symbol"?t+"":t,e),e);class zo extends _t{constructor(t,e=0,r=0,n=0,o=1){super(),this.center=t,this.radius=e,this.number=r,this.start=n,this.end=o,vr(this,"curves",[]),vr(this,"curveT",0),vr(this,"points",[]),this.update()}update(){for(let t=0;t<this.number;t++){let e=t*2*Math.PI/this.number;e-=.5*Math.PI,this.points.push(new b(this.radius*Math.cos(e),this.radius*Math.sin(e)).add(this.center))}for(let t=0;t<this.number;t++)this.curves.push(new Ht(this.points[t],this.points[(t+1)%this.number]));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1);const r=e*this.number,n=Math.floor(r);return this.curveT=r-n,this.curves[n]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}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 En extends _t{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(Pn(t,r.x,n.x,o.x),Pn(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,s=.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,s,l),t.y=Math.min(t.y,r.y,o.y,a,h),e.x=Math.max(e.x,r.x,o.x,s,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 Eo=Object.defineProperty,Uo=(i,t,e)=>t in i?Eo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Un=(i,t,e)=>(Uo(i,typeof t!="symbol"?t+"":t,e),e);class Ln extends _t{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,Un(this,"curves",[]),Un(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 s=0;s<4;s++)this.curves.push(new Ht(o[s].clone(),o[(s+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 $n extends _t{constructor(t=[]){super(),this.points=t}getPoint(t,e=new b){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),s=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(Sn(s,a.x,l.x,h.x,c.x),Sn(s,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 Lo=Object.defineProperty,$o=(i,t,e)=>t in i?Lo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>($o(i,typeof t!="symbol"?t+"":t,e),e);class ee extends _t{constructor(t){super(),Me(this,"curves",[]),Me(this,"startPoint"),Me(this,"currentPoint",new b),Me(this,"autoClose",!1),Me(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 yr(t,this),this}addData(t){return this.addCommands(mr(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 s=n[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/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,s=r.length;o<s;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 Ht(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 Ht(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,s){return this.currentPoint.equals({x:o,y:s})||this.curves.push(new Tn(this.currentPoint.clone(),new b(t,e),new b(r,n),new b(o,s))),this._setCurrentPoint({x:o,y:s}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new En(this.currentPoint.clone(),new b(t,e),new b(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,s){return this.ellipse(t,e,r,r,0,n,o,s),this}relativeArc(t,e,r,n,o,s){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,s),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,s,a,l=!0){const h=new An(new b(t,e),r,n,o,s,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,s,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,n,o,s,a,l),this}rect(t,e,r,n){return this.curves.push(new Ln(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 $n([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 V(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 ko(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Bo(i,t,e,r){const n=t.clone().sub(i),o=r.clone().sub(e),s=e.clone().sub(i),a=n.cross(o);if(a===0)return new b((i.x+e.x)/2,(i.y+e.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new b((i.x+e.x)/2,(i.y+e.y)/2):new b(i.x+l*n.x,i.y+l*n.y)}var jo=Object.defineProperty,Fo=(i,t,e)=>t in i?jo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,br=(i,t,e)=>(Fo(i,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){br(this,"currentPath",new ee),br(this,"paths",[this.currentPath]),br(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof bt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new ee().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 ee().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,s){return this.currentPath.bezierCurveTo(t,e,r,n,o,s),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,s){return this.currentPath.arc(t,e,r,n,o,s),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,s,a,l){return this.currentPath.ellipse(t,e,r,n,o,s,a,l),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(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],p=h[h.length-1]??u;r.push({start:c?p:u,end:c?u:p,index:l})});const s=[];return r.forEach((a,l)=>{s[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&s[l].push(h.index)})}),e.forEach((a,l)=>{const h=n[l];o[l].forEach(u=>{const p=a.getTForPoint(u),g=a.getNormal(p).scale(h?t:-t);u.add(g)})}),s.forEach((a,l)=>{const h=o[l];a.forEach(c=>{const u=o[c],p=Bo(h[h.length-1],h[h.length-2]??h[h.length-1],u[0],u[1]??u[0]);p&&(h[h.length-1].copy(p),u[0].copy(p))})}),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 s=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),p=u.clone().scale(a?s:-s),g=u.clone().scale(a?-s:s);l.push(c.clone().add(p),c.clone().add(g),c.clone().add({x:s,y:0}),c.clone().add({x:-s,y:0}),c.clone().add({x:0,y:s}),c.clone().add({x:0,y:-s}),c.clone().add({x:s,y:s}),c.clone().add({x:-s,y:-s}))}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 V(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(),dr(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(),dr(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[ko(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:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*e,l.height=a*e,l.style.width=`${s}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 Mr="px",kn=90,Bn=["mm","cm","in","pt","pc","px"],xr={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 E(i){let t="px";if(typeof i=="string"||i instanceof String)for(let r=0,n=Bn.length;r<n;r++){const o=Bn[r];if(i.endsWith(o)){t=o,i=i.substring(0,i.length-o.length);break}}let e;return t==="px"&&Mr!=="px"?e=xr.in[Mr]/kn:(e=xr[t][Mr],e<0&&(e=xr[t].in*kn)),e*Number.parseFloat(i)}const Go=new yt,Ge=new yt,jn=new yt,Fn=new yt;function Ro(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const r=Vo(i);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Vo(i){const t=new yt,e=Go;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(E(i.getAttribute("x")),E(i.getAttribute("y"))),i.hasAttribute("transform")){const r=i.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),h=Pt(o.slice(s+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,p=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],p=h[2]),Ge.makeTranslation(-u,-p),jn.makeRotation(c),Fn.multiplyMatrices(jn,Ge),Ge.makeTranslation(u,p),e.multiplyMatrices(Ge,Fn)}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 qo(i){return new bt().addPath(new ee().arc(E(i.getAttribute("cx")||0),E(i.getAttribute("cy")||0),E(i.getAttribute("r")||0),0,Math.PI*2))}function Wo(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const r=i.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=r.style.length,a=0;a<s;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let s=0;s<n.length;s++)t[n[s]]=Object.assign(t[n[s]]||{},{...o})}}function Ho(i){return new bt().addPath(new ee().ellipse(E(i.getAttribute("cx")||0),E(i.getAttribute("cy")||0),E(i.getAttribute("rx")||0),E(i.getAttribute("ry")||0),0,0,Math.PI*2))}function Qo(i){return new bt().moveTo(E(i.getAttribute("x1")||0),E(i.getAttribute("y1")||0)).lineTo(E(i.getAttribute("x2")||0),E(i.getAttribute("y2")||0))}function Xo(i){const t=new bt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Yo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Zo(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Yo,(n,o,s)=>{const a=E(o),l=E(s);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!0,t}const Ko=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jo(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Ko,(n,o,s)=>{const a=E(o),l=E(s);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!1,t}function ta(i){const t=E(i.getAttribute("x")||0),e=E(i.getAttribute("y")||0),r=E(i.getAttribute("rx")||i.getAttribute("ry")||0),n=E(i.getAttribute("ry")||i.getAttribute("rx")||0),o=E(i.getAttribute("width")),s=E(i.getAttribute("height")),a=1-.551915024494,l=new bt;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+s-n),(r!==0||n!==0)&&l.bezierCurveTo(t+o,e+s-n*a,t+o-r*a,e+s,t+o-r,e+s),l.lineTo(t+r,e+s),(r!==0||n!==0)&&l.bezierCurveTo(t+r*a,e+s,t,e+s-n*a,t,e+s-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 At(i,t,e){t=Object.assign({},t);let r={};if(i.hasAttribute("class")){const h=i.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]}`])}i.hasAttribute("id")&&(r=Object.assign(r,e[`#${i.getAttribute("id")}`]));for(let h=i.style.length,c=0;c<h;c++){const u=i.style.item(c),p=i.style.getPropertyValue(u);t[u]=p,r[u]=p}function n(h,c,u=o){i.hasAttribute(h)&&(t[c]=u(i.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 s(h){return Math.max(0,Math.min(1,E(h)))}function a(h){return Math.max(0,E(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>E(c))}return n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),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",E),n("visibility","visibility"),t}function Cr(i,t,e=[],r={}){var u;if(i.nodeType!==1)return e;let n=!1,o=null,s={...t};switch(i.nodeName){case"svg":s=At(i,s,r);break;case"style":Wo(i,r);break;case"g":s=At(i,s,r);break;case"path":s=At(i,s,r),i.hasAttribute("d")&&(o=Xo(i));break;case"rect":s=At(i,s,r),o=ta(i);break;case"polygon":s=At(i,s,r),o=Zo(i);break;case"polyline":s=At(i,s,r),o=Jo(i);break;case"circle":s=At(i,s,r),o=qo(i);break;case"ellipse":s=At(i,s,r),o=Ho(i);break;case"line":s=At(i,s,r),o=Qo(i);break;case"defs":n=!0;break;case"use":{s=At(i,s,r);const g=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),m=(u=i.viewportElement)==null?void 0:u.getElementById(g);m?Cr(m,s,e,r):console.warn(`'use node' references non-existent node id: ${g}`);break}default:console.warn(i);break}if(s.display==="none")return e;Object.assign(t,s);const a=new yt,l=[],h=Ro(i,a,l);o&&(o.matrix(a),e.push(o),o.style=t);const c=i.childNodes;for(let p=0,g=c.length;p<g;p++){const m=c[p];n&&m.nodeName!=="style"&&m.nodeName!=="defs"||Cr(m,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Gn="data:image/svg+xml;",Rn=`${Gn}base64,`,Vn=`${Gn}charset=utf8,`;function qn(i){if(typeof i=="string"){let t;return i.startsWith(Rn)?(i=i.substring(Rn.length,i.length),t=atob(i)):i.startsWith(Vn)?(i=i.substring(Vn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Sr(i){return Cr(qn(i),{})}function Qt(i,t=!0){if(!i.length)return;const e=b.MAX,r=b.MIN;return i.forEach(n=>n.getMinMax(e,r,t)),new V(e.x,e.y,r.x-e.x,r.y-e.y)}function Pr(i){const{x:t,y:e,width:r,height:n}=Qt(i),o=i.map(s=>s.toSvgPathString()).join("");return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}function ea(i){return`data:image/svg+xml;base64,${btoa(Pr(i))}`}function ra(i){return new DOMParser().parseFromString(Pr(i),"image/svg+xml").documentElement}function na(i,t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:s,height:a}=Qt(i),l=document.createElement("canvas");l.width=s*e,l.height=a*e,l.style.width=`${s}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-n,-o),i.forEach(c=>{c.drawTo(h,r)})),l}const ia=new Set(["©","®","÷"]),sa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),Wn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Hn{constructor(t,e,r){L(this,"lineBox",new V);L(this,"inlineBox",new V);L(this,"glyphBox");L(this,"center");L(this,"underlinePosition",0);L(this,"underlineThickness",0);L(this,"yStrikeoutPosition",0);L(this,"yStrikeoutSize",0);L(this,"baseline",0);L(this,"centerDiviation",0);L(this,"path",new bt);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_font(){var e;const t=(e=wn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof it)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:o,post:s}=t,{content:a,computedStyle:l}=this,{fontSize:h}=l,c=e/h,u=t.getAdvanceWidth(a,h),p=(r+Math.abs(n))/c,g=r/c,m=(r-o.yStrikeoutPosition)/c,w=o.yStrikeoutSize/c,d=(r-s.underlinePosition)/c,x=s.underlineThickness/c;return this.inlineBox.width=u,this.inlineBox.height=p,this.underlinePosition=d,this.underlineThickness=x,this.yStrikeoutPosition=m,this.yStrikeoutSize=w,this.baseline=g,this.centerDiviation=p/2-g,this}updatePath(){var T;const t=this._font();if(!t)return this;const{isVertical:e,content:r,computedStyle:n,baseline:o,inlineBox:s}=this.updateGlyph(t),{os2:a,ascender:l,descender:h}=t,c=a.sTypoAscender,{left:u,top:p}=s,{fontSize:g,fontStyle:m}=n;let w=u,d=p+o,x;const C=new bt;if(e&&(w+=(s.height-s.width)/2,Math.abs(s.width-s.height)>.1&&(d-=(l-c)/(l+Math.abs(h))*s.height),x=void 0),e&&!ia.has(r)&&(r.codePointAt(0)<=256||sa.has(r))){C.addCommands(t.getPathCommands(r,w,p+o-(s.height-s.width)/2,g)??[]);const v={y:p-(s.height-s.width)/2+s.height/2,x:w+s.width/2};m==="italic"&&this._italic(C,e?{x:v.x,y:p-(s.height-s.width)/2+o}:void 0),C.rotate(90,v)}else x!==void 0?(C.addCommands(t.glyphs.get(x).getPathCommands(w,d,g)),m==="italic"&&this._italic(C,e?{x:w+s.width/2,y:p+c/(l+Math.abs(h))*s.height}:void 0)):(C.addCommands(t.getPathCommands(r,w,d,g)??[]),m==="italic"&&this._italic(C,e?{x:w+s.height/2,y:d}:void 0));C.addCommands(this._decoration());const S=n.fontWeight??400;return S in Wn&&C.bold(Wn[S]*g*.05),C.style={fill:n.color,stroke:n.textStrokeWidth?n.textStrokeColor:"none",strokeWidth:n.textStrokeWidth?n.textStrokeWidth*g*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this.center=(T=this.glyphBox)==null?void 0:T.getCenterPoint(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:o}=this.computedStyle,{left:s,top:a,width:l,height:h}=this.inlineBox,c=.1*o;let u;switch(n){case"underline":t?u=s:u=a+e;break;case"line-through":t?u=s+l/2:u=a+r;break;case"none":default:return[]}return t?[{type:"M",x:u,y:a},{type:"L",x:u,y:a+h},{type:"L",x:u+c,y:a+h},{type:"L",x:u+c,y:a},{type:"Z"}]:[{type:"M",x:s,y:u},{type:"L",x:s+l,y:u},{type:"L",x:s+l,y:u+c},{type:"L",x:s,y:u+c},{type:"Z"}]}_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 V(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){Ce({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function re(i){return!i||i==="none"}function Re(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}class Qn{constructor(t,e={},r){L(this,"inlineBox",new V);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,...Re(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Hn(r,e++,this));return this.characters=t,this}}class ne{constructor(t,e){L(this,"lineBox",new V);L(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Re(this.parentStyle),...Re(this.style)},this}addFragment(t,e){const r=new Qn(t,e,this);return this.fragments.push(r),r}}class Xn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{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(s=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(s.style)),s.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 s;return(s=n.parentNode)==null?void 0:s.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((l,h)=>{var p;const c=l.getBoundingClientRect();r.push({paragraphIndex:s,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});const u=l.firstChild;if(u instanceof window.Text){const g=document.createRange();g.selectNodeContents(u);const m=u.data?u.data.length:0;let w=0;for(;w<=m;){g.setStart(u,Math.max(w-1,0)),g.setEnd(u,w);const d=((p=g.getClientRects)==null?void 0:p.call(g))??[g.getBoundingClientRect()];let x=d[d.length-1];d.length>1&&x.width<2&&(x=d[d.length-2]);const C=g.toString();C!==""&&x&&x.width+x.height!==0&&n.push({content:C,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:w-1,top:x.top,left:x.left,height:x.height,width:x.width,textWidth:-1,textHeight:-1}),w++}}})}),{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 s=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],p=o[s];u.inlineBox.left=p.left,u.inlineBox.top=p.top,u.inlineBox.width=p.width,u.inlineBox.height=p.height;const g=u.fontHeight;u.lineBox.left=p.left,u.lineBox.top=p.top+(p.height-g)/2,u.lineBox.height=g,u.lineBox.width=p.width,s++}),{paragraphs:e,boundingBox:new V(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Yn{constructor(t){this._text=t}parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new ne({},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 ne({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new ne({},e);n.forEach(s=>{if(typeof s=="string")o.addFragment(s);else{const{content:a,...l}=s;a!==void 0&&o.addFragment(a,l)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...s}=n,a=new ne(s,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,...s}=n;if(o!==void 0){const a=new ne(s,e);a.addFragment(o),r.push(a)}}}return r}}function oa(i){return i}const aa="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function la(i,t,e){if(i==="cover")return 0;if(typeof i=="string")if(i.endsWith("%")){const r=Number(i.substring(0,i.length-1))/100;return Math.ceil(r*e/t)}else return i.endsWith("rem")?Number(i.substring(0,i.length-3)):Math.ceil(Number(i)/t);else return Math.ceil(i/t)}function ha(i,t,e){return typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function ca(i,t,e,r){let n;r?n={x:e.width/t.height,y:e.height/t.width}:n={x:e.width/t.width,y:e.height/t.height};const o=e.getCenterPoint().add(i.getCenterPoint().sub(t.getCenterPoint()).scale(n.x,n.y)).sub({x:i.width/2*n.x,y:i.height/2*n.y}),s=new yt;return s.translate(-i.left,-i.top),r&&(s.translate(-i.width/2,-i.height/2),s.rotate(Math.PI/2),s.translate(i.width/2,i.height/2)),s.scale(n.x,n.y),s.translate(o.x,o.y),s}function Zn(){const i=[],t=[],e=new Map;function r(n){let o=e.get(n);return o||(o=Sr(n),e.set(n,o)),o}return{name:"highlight",paths:i,update:n=>{i.length=0;const{characters:o}=n;let s;const a=[];let l;o.forEach(h=>{const{isVertical:c,computedStyle:u}=h;!re(u.highlightImage)&&h.glyphBox&&(u.highlightSize!=="1rem"&&(l==null?void 0:l.highlightImage)===u.highlightImage&&(l==null?void 0:l.highlightSize)===u.highlightSize&&(l==null?void 0:l.highlightStrokeWidth)===u.highlightStrokeWidth&&(l==null?void 0:l.highlightOverflow)===u.highlightOverflow&&s.length&&(c?s[0].inlineBox.left===h.inlineBox.left:s[0].inlineBox.top===h.inlineBox.top)&&s[0].fontSize===h.fontSize?s.push(h):(s=[],s.push(h),a.push(s))),l=u}),a.filter(h=>h.length).map(h=>{const c=h[0];return{style:c.computedStyle,baseline:c.baseline,box:V.from(...h.map(u=>u.glyphBox))}}).forEach(h=>{const{style:c,box:u,baseline:p}=h,{fontSize:g,writingMode:m}=c,w=m.includes("vertical"),d=ha(c.highlightStrokeWidth,g,u.width),x=la(c.highlightSize,g,u.width),C=re(c.highlightOverflow)?x?"hidden":"visible":c.highlightOverflow,S=r(re(c.highlightReferImage)?aa:c.highlightReferImage),T=r(c.highlightImage),v=Qt(T,!0),M=Qt(S,!1),A=x?g*x:w?u.height:u.width,P=p*.8,_=ca(v,M,new V(u.left,u.top,w?P:A,w?A:P),w),z=g/v.width*2,q=Math.ceil(u.width/A);for(let $=0;$<q;$++){const mt=_.clone().translate($*A,0);T.forEach(D=>{const I=D.clone().matrix(mt);I.style.strokeWidth&&(I.style.strokeWidth*=z*d),I.style.strokeMiterlimit&&(I.style.strokeMiterlimit*=z),I.style.strokeDashoffset&&(I.style.strokeDashoffset*=z),I.style.strokeDasharray&&(I.style.strokeDasharray=I.style.strokeDasharray.map(k=>k*z)),i.push(I),t[i.length-1]=C==="hidden"?new V(u.left,u.top-u.height,u.width,u.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{i.forEach((s,a)=>{Ce({ctx:n,path:s,clipRect:t[a],fontSize:o.computedStyle.fontSize})})}}}function Kn(i,t,e){return i==="cover"?1:typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function Jn(){const i=[];return{name:"listStyle",paths:i,update:t=>{i.length=0;const{paragraphs:e,computedStyle:r,fontSize:n,isVertical:o}=t;let s=r.listStyleSize,a;if(!re(r.listStyleImage))a=r.listStyleImage;else if(!re(r.listStyleType)){const u=n*.38/2;switch(s=s==="cover"?u*2:s,r.listStyleType){case"disc":a=`<svg width="${u*2}" height="${u*2}" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
}`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...s}=e,{family:a,url:l}=t;if(this._loaded.has(l))return r&&(this._loading.forEach(c=>c.cancel()),this._loading.clear()),this._loaded.get(l);let h=this._loading.get(l);return h||(h=this._createRequest(l,s),this._loading.set(l,h)),r&&this._loading.forEach((c,u)=>{c!==h&&(c.cancel(),this._loading.delete(u))}),h.when.then(c=>{const u={...t,font:gn(c)??c};return this._loaded.has(l)||(this._loaded.set(l,u),new Set(Array.isArray(a)?a:[a]).forEach(p=>{this._namesUrls.set(p,l),typeof document<"u"&&(n&&this.injectFontFace(p,c),o&&this.injectStyleTag(p,l))})),u}).catch(c=>{if(c instanceof DOMException&&c.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw c}).finally(()=>{this._loading.delete(l)})}};be(yn,"defaultRequestInit",{cache:"force-cache"});let mn=yn;const wn=new mn;function vn(i,t){const{cmap:e,loca:r,hmtx:n,vmtx:o,glyf:s}=i,a=e.unicodeToGlyphIndexMap,l=r.locations,h=n.metrics,c=o==null?void 0:o.metrics,u=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,d)=>w-d),p=new Map;u.forEach(w=>{const d=a.get(w)??0;let S=p.get(d);S||p.set(d,S=new Set),S.add(w)});const g=[],m=w=>{const d=h[w],S=(c==null?void 0:c[w])??{advanceHeight:0,topSideBearing:0},x=l[w],C=l[w+1]??x,T={...d,...S,rawGlyphIndex:w,glyphIndex:g.length,unicodes:Array.from(p.get(w)??[]),view:new DataView(s.view.buffer,s.view.byteOffset+x,C-x)};return g.push(T),T};return m(0),u.forEach(w=>m(a.get(w))),g.slice().forEach(w=>{const{view:d}=w;if(!d.byteLength||d.getInt16(0)>=0)return;let x=10,C;do{C=d.getUint16(x);const T=x+2,v=d.getUint16(T);x+=4,Jt.ARG_1_AND_2_ARE_WORDS&C?x+=4:x+=2,Jt.WE_HAVE_A_SCALE&C?x+=2:Jt.WE_HAVE_AN_X_AND_Y_SCALE&C?x+=4:Jt.WE_HAVE_A_TWO_BY_TWO&C&&(x+=8);const M=m(v);d.setUint16(T,M.glyphIndex)}while(Jt.MORE_COMPONENTS&C)}),g}function bn(i,t){const e=vn(i,t),r=e.length,{head:n,maxp:o,hhea:s,vhea:a}=i;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,o.numGlyphs=r;let l=0;i.loca=f.Loca.from([...e.map(p=>{const g=l;return l+=p.view.byteLength,g}),l],n.indexToLocFormat);const h=e.reduce((p,g,m)=>(g.unicodes.forEach(w=>p.set(w,m)),p),new Map);i.cmap=f.Cmap.from(h),i.glyf=f.Glyf.from(e.map(p=>p.view)),s.numOfLongHorMetrics=r,i.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=r,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function oo(i,t){let e,r;if(i instanceof it)e=i.sfnt.clone(),r="ttf";else if(i instanceof Ut)e=i.sfnt.clone(),r="woff";else{const o=Gt(i);if(it.is(o))e=new it(o).sfnt,r="ttf-buffer";else if(Ut.is(o))e=new Ut(o).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=bn(e,t);switch(r){case"ttf":return it.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return it.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const ao={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function dr(i,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:p=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=r,i.lineWidth=n,i.lineCap=o,i.lineJoin=ao[s],i.miterLimit=a,i.setLineDash(l),i.lineDashOffset=h,i.shadowOffsetX=c,i.shadowOffsetY=u,i.shadowBlur=p,i.shadowColor=g}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}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),s=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*s),e.y-(n*s+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 V{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){if(t.length===0)return new V;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 V(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new V(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var lo=Object.defineProperty,ho=(i,t,e)=>t in i?lo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,co=(i,t,e)=>(ho(i,t+"",e),e);class yt{constructor(t=1,e=0,r=0,n=0,o=1,s=0,a=0,l=0,h=1){co(this,"elements",[]),this.set(t,e,r,n,o,s,a,l,h)}set(t,e,r,n,o,s,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]=s,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,s=r[0],a=r[3],l=r[6],h=r[1],c=r[4],u=r[7],p=r[2],g=r[5],m=r[8],w=n[0],d=n[3],S=n[6],x=n[1],C=n[4],T=n[7],v=n[2],M=n[5],A=n[8];return o[0]=s*w+a*x+l*v,o[3]=s*d+a*C+l*M,o[6]=s*S+a*T+l*A,o[1]=h*w+c*x+u*v,o[4]=h*d+c*C+u*M,o[7]=h*S+c*T+u*A,o[2]=p*w+g*x+m*v,o[5]=p*d+g*C+m*M,o[8]=p*S+g*T+m*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*s-a*h,p=a*l-c*o,g=h*o-s*l,m=e*u+r*p+n*g;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/m;return t[0]=u*w,t[1]=(n*h-c*r)*w,t[2]=(a*r-n*s)*w,t[3]=p*w,t[4]=(c*e-n*l)*w,t[5]=(n*o-a*e)*w,t[6]=g*w,t[7]=(r*l-h*e)*w,t[8]=(s*e-r*o)*w,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(gr.makeScale(t,e)),this}rotate(t){return this.premultiply(gr.makeRotation(-t)),this}translate(t,e){return this.premultiply(gr.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 gr=new yt;function Mn(i,t,e,r){const n=i*e+t*r,o=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+r*r);let s=Math.acos(Math.max(-1,Math.min(1,n/o)));return i*r-t*e<0&&(s=-s),s}function xn(i,t,e,r,n,o,s,a){if(t===0||e===0){i.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(s.x-a.x)/2,h=(s.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,u=-Math.sin(r)*l+Math.cos(r)*h;let p=t*t,g=e*e;const m=c*c,w=u*u,d=m/p+w/g;if(d>1){const z=Math.sqrt(d);t=z*t,e=z*e,p=t*t,g=e*e}const S=p*w+g*m,x=(p*g-S)/S;let C=Math.sqrt(Math.max(0,x));n===o&&(C=-C);const T=C*t*u/e,v=-C*e*c/t,M=Math.cos(r)*T-Math.sin(r)*v+(s.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*v+(s.y+a.y)/2,P=Mn(1,0,(c-T)/t,(u-v)/e),_=Mn((c-T)/t,(u-v)/e,(-c-T)/t,(-u-v)/e)%(Math.PI*2);i.ellipse(M,A,t,e,r,P,P+_,o===1)}function te(i,t){return i-(t-i)}function yr(i,t){const e=new b,r=new b;for(let n=0,o=i.length;n<o;n++){const s=i[n];if(s.type==="m"||s.type==="M")s.type==="m"?e.add(s):e.copy(s),t.moveTo(e.x,e.y),r.copy(e);else if(s.type==="h"||s.type==="H")s.type==="h"?e.x+=s.x:e.x=s.x,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="v"||s.type==="V")s.type==="v"?e.y+=s.y:e.y=s.y,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="l"||s.type==="L")s.type==="l"?e.add(s):e.copy(s),t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="c"||s.type==="C")s.type==="c"?(t.bezierCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(t.quadraticCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x,e.y+s.y),r.x=e.x+s.x1,r.y=e.y+s.y1,e.add(s)):(t.quadraticCurveTo(s.x1,s.y1,s.x,s.y),r.x=s.x1,r.y=s.y1,e.copy(s));else if(s.type==="t"||s.type==="T"){const a=te(e.x,r.x),l=te(e.y,r.y);r.x=a,r.y=l,s.type==="t"?(t.quadraticCurveTo(a,l,e.x+s.x,e.y+s.y),e.add(s)):(t.quadraticCurveTo(a,l,s.x,s.y),e.copy(s))}else if(s.type==="a"||s.type==="A"){const a=e.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;e.add(s)}else{if(e.equals(s))continue;e.copy(s)}r.copy(e),xn(t,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,e)}else s.type==="z"||s.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",s)}}const Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Pt(i,t,e=0){let a=0,l=!0,h="",c="";const u=[];function p(d,S,x){const C=new SyntaxError(`Unexpected character "${d}" at index ${S}.`);throw C.partial=x,C}function g(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let m;const w=i.length;for(let d=0;d<w;d++){if(m=i[d],Array.isArray(t)&&t.includes(u.length%e)&&Z.FLAGS.test(m)){a=1,h=m,g();continue}if(a===0){if(Z.WHITESPACE.test(m))continue;if(Z.DIGIT.test(m)||Z.SIGN.test(m)){a=1,h=m;continue}if(Z.POINT.test(m)){a=2,h=m;continue}Z.COMMA.test(m)&&(l&&p(m,d,u),l=!0)}if(a===1){if(Z.DIGIT.test(m)){h+=m;continue}if(Z.POINT.test(m)){h+=m,a=2;continue}if(Z.EXP.test(m)){a=3;continue}Z.SIGN.test(m)&&h.length===1&&Z.SIGN.test(h[0])&&p(m,d,u)}if(a===2){if(Z.DIGIT.test(m)){h+=m;continue}if(Z.EXP.test(m)){a=3;continue}Z.POINT.test(m)&&h[h.length-1]==="."&&p(m,d,u)}if(a===3){if(Z.DIGIT.test(m)){c+=m;continue}if(Z.SIGN.test(m)){if(c===""){c+=m;continue}c.length===1&&Z.SIGN.test(c)&&p(m,d,u)}}Z.WHITESPACE.test(m)?(g(),a=0,l=!1):Z.COMMA.test(m)?(g(),a=0,l=!0):Z.SIGN.test(m)?(g(),a=1,h=m):Z.POINT.test(m)?(g(),a=2,h=m):p(m,d,u)}return g(),u}function Cn(i){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=i.length;n<o;n++){const s=i[n];switch(s.type){case"m":case"M":if(s.x===e.x&&s.y===e.y)continue;r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y,t.x=s.x,t.y=s.y;break;case"h":case"H":r+=`${s.type} ${s.x}`,e.x=s.x;break;case"v":case"V":r+=`${s.type} ${s.y}`,e.y=s.y;break;case"l":case"L":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"c":case"C":r+=`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"s":case"S":r+=`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"q":case"Q":r+=`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"t":case"T":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"a":case"A":r+=`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"z":case"Z":r+=s.type,e.x=t.x,e.y=t.y;break}}return r}const uo=/[a-df-z][^a-df-z]*/gi;function mr(i){const t=[],e=i.match(uo);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=Pt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:s,x:l[h],y:l[h+1]}):t.push({type:s==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Pt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:s,x:l[h]});break;case"v":case"V":l=Pt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:s,y:l[h]});break;case"l":case"L":l=Pt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:s,x:l[h],y:l[h+1]});break;case"c":case"C":l=Pt(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:s,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=Pt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:s,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Pt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:s,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Pt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:s,x:l[h],y:l[h+1]});break;case"a":case"A":l=Pt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:s,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:s});break;default:console.warn(o)}}return t}var fo=Object.defineProperty,po=(i,t,e)=>t in i?fo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wr=(i,t,e)=>(po(i,typeof t!="symbol"?t+"":t,e),e);class _t{constructor(){wr(this,"arcLengthDivisions",200),wr(this,"_cacheArcLengths"),wr(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 s=1;s<=t;s++)r=this.getPoint(s/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 s;e?s=e:s=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]-s,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===s)return n/(o-1);const c=r[n],p=r[n+1]-c,g=(s-c)/p;return(n+g)/(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 s=this.getPoint(o);if(s.distanceTo(t)<e)return o;s.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.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new V(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 Cn(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)}}class je extends _t{constructor(t,e,r=0,n=Math.PI*2){super(),this.center=t,this.radius=e,this.start=r,this.end=n}getPoint(t){const{radius:e,center:r}=this;return r.clone().add(this.getNormal(t).clone().scale(e))}getTangent(t,e=new b){const{x:r,y:n}=this.getNormal(t);return e.set(-n,r)}getNormal(t,e=new b){const{start:r,end:n}=this,o=t*(n-r)+r-.5*Math.PI;return e.set(Math.cos(o),Math.sin(o))}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){return t.x=Math.min(t.x,this.center.x-this.radius),t.y=Math.min(t.y,this.center.y-this.radius),e.x=Math.max(e.x,this.center.x+this.radius),e.y=Math.max(e.y,this.center.y+this.radius),{min:t,max:e}}}function Sn(i,t,e,r,n){const o=(r-t)*.5,s=(n-e)*.5,a=i*i,l=i*a;return(2*e-2*r+o+s)*l+(-3*e+3*r-2*o-s)*a+o*i+e}function go(i,t){const e=1-i;return e*e*t}function yo(i,t){return 2*(1-i)*i*t}function mo(i,t){return i*i*t}function Pn(i,t,e,r){return go(i,t)+yo(i,e)+mo(i,r)}function wo(i,t){const e=1-i;return e*e*e*t}function vo(i,t){const e=1-i;return 3*e*e*i*t}function bo(i,t){return 3*(1-i)*i*i*t}function Mo(i,t){return i*i*i*t}function _n(i,t,e,r,n){return wo(i,t)+vo(i,e)+bo(i,r)+Mo(i,n)}class Tn extends _t{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:s}=this;return e.set(_n(t,r.x,n.x,o.x,s.x),_n(t,r.y,n.y,o.y,s.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),s=(-e+o)/(2*t),a=(-e-o)/(2*t);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(t=b.MAX,e=b.MIN){const r=this.start,n=this.startControl,o=this.endControl,s=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(s.y-o.y)),h=[0,1,...a,...l];return((u,p)=>{for(const g of u)for(let m=0;m<=p;m++){const w=m/p-.5,d=Math.min(1,Math.max(0,g+w)),S=this.getPoint(d);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 xo=new yt,On=new yt,In=new yt,Fe=new b;class An extends _t{constructor(t=new b,e=1,r=1,n=0,o=0,s=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=s,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 s=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(s),l=this.center.y+this.radiusY*Math.sin(s);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,p=l-this.center.y;a=u*h-p*c+this.center.x,l=u*c+p*h+this.center.y}return e.set(a,l)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:s,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),p=Math.abs(n-o),g=p>Math.PI?1:0,m=s?1:0,w=a*180/Math.PI;if(p>=2*Math.PI){const d=n+Math.PI,S=l+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),x=h+e*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:m,x:S,y:x},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:m,x:c,y:u}]}else{const d=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:w,largeArcFlag:g,sweepFlag:m,x:d,y:S}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:s,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,n,o,s,a,!l),this}matrix(t){return Fe.set(this.center.x,this.center.y),Fe.applyMatrix3(t),this.center.x=Fe.x,this.center.y=Fe.y,Po(t)?Co(this,t):So(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){const{center:r,radiusX:n,radiusY:o,rotation:s}=this,{x:a,y:l}=r,h=Math.cos(s),c=Math.sin(s),u=Math.sqrt(n*n*h*h+o*o*c*c),p=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-p),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,l+p),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Co(i,t){const e=i.radiusX,r=i.radiusY,n=Math.cos(i.rotation),o=Math.sin(i.rotation),s=new b(e*n,e*o),a=new b(-r*o,r*n),l=s.applyMatrix3(t),h=a.applyMatrix3(t),c=xo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=On.copy(c).invert(),m=In.copy(u).transpose().multiply(u).elements,w=_o(m[0],m[1],m[4]),d=Math.sqrt(w.rt1),S=Math.sqrt(w.rt2);if(i.radiusX=1/d,i.radiusY=1/S,i.rotation=Math.atan2(w.sn,w.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const C=On.set(d,0,0,0,S,0,0,0,1),T=In.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=C.multiply(T).multiply(c),M=A=>{const{x:P,y:_}=new b(Math.cos(A),Math.sin(A)).applyMatrix3(v);return Math.atan2(_,P)};i.startAngle=M(i.startAngle),i.endAngle=M(i.endAngle),Dn(t)&&(i.clockwise=!i.clockwise)}}function So(i,t){const e=Nn(t),r=zn(t);i.radiusX*=e,i.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=n,Dn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Dn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Po(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Nn(i),n=zn(i);return Math.abs(e/(r*n))>Number.EPSILON}function Nn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function zn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function _o(i,t,e){let r,n,o,s,a;const l=i+e,h=i-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,n=i*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,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(t)===0?(o=1,s=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),s=a*o),h>0&&(a=o,o=-s,s=a),{rt1:r,rt2:n,cs:o,sn:s}}class Ht extends _t{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}}var To=Object.defineProperty,Oo=(i,t,e)=>t in i?To(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Io=(i,t,e)=>(Oo(i,t+"",e),e);class Ao extends _t{constructor(t,e,r=0,n=1){super(),this.center=t,this.size=e,this.start=r,this.end=n,Io(this,"curveT",0),this.update()}update(){const{x:t,y:e}=this.center,r=new b(t+.5*this.size,e-.5*this.size),n=new b(t-.5*this.size,e-.5*this.size),o=new b(t,e+.5*this.size),s=new je(r,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),a=new je(n,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),l=new je(o,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),h=new b(t,e+this.size),c=new b(t+this.size,e),u=new b().lerpVectors(c,h,.75),p=new b(t-this.size,e),g=new b().lerpVectors(p,h,.75),m=new Ht(c,u),w=new Ht(g,p);return this.curves=[s,m,l,w,a],this}getPoint(t){return this.getCurve(t).getPoint(this.curveT)}getPointAt(t){return this.getPoint(t)}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=9*Math.PI/8+1.5;let r;const n=.5*Math.PI;return e<n?(r=0,this.curveT=e/n):e<n+.75?(r=1,this.curveT=(e-n)/.75):e<5*Math.PI/8+.75?(r=2,this.curveT=(e-n-.75)/(Math.PI/8)):e<5*Math.PI/8+1.5?(r=3,this.curveT=(e-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(e-5*Math.PI/8-1.5)/n),this.curves[r]}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}}var Do=Object.defineProperty,No=(i,t,e)=>t in i?Do(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vr=(i,t,e)=>(No(i,typeof t!="symbol"?t+"":t,e),e);class zo extends _t{constructor(t,e=0,r=0,n=0,o=1){super(),this.center=t,this.radius=e,this.number=r,this.start=n,this.end=o,vr(this,"curves",[]),vr(this,"curveT",0),vr(this,"points",[]),this.update()}update(){for(let t=0;t<this.number;t++){let e=t*2*Math.PI/this.number;e-=.5*Math.PI,this.points.push(new b(this.radius*Math.cos(e),this.radius*Math.sin(e)).add(this.center))}for(let t=0;t<this.number;t++)this.curves.push(new Ht(this.points[t],this.points[(t+1)%this.number]));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1);const r=e*this.number,n=Math.floor(r);return this.curveT=r-n,this.curves[n]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}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 En extends _t{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(Pn(t,r.x,n.x,o.x),Pn(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,s=.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,s,l),t.y=Math.min(t.y,r.y,o.y,a,h),e.x=Math.max(e.x,r.x,o.x,s,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 Eo=Object.defineProperty,Uo=(i,t,e)=>t in i?Eo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Un=(i,t,e)=>(Uo(i,typeof t!="symbol"?t+"":t,e),e);class Ln extends _t{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,Un(this,"curves",[]),Un(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 s=0;s<4;s++)this.curves.push(new Ht(o[s].clone(),o[(s+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 $n extends _t{constructor(t=[]){super(),this.points=t}getPoint(t,e=new b){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),s=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(Sn(s,a.x,l.x,h.x,c.x),Sn(s,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 Lo=Object.defineProperty,$o=(i,t,e)=>t in i?Lo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>($o(i,typeof t!="symbol"?t+"":t,e),e);class ee extends _t{constructor(t){super(),Me(this,"curves",[]),Me(this,"startPoint"),Me(this,"currentPoint",new b),Me(this,"autoClose",!1),Me(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 yr(t,this),this}addData(t){return this.addCommands(mr(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 s=n[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/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,s=r.length;o<s;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 Ht(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 Ht(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,s){return this.currentPoint.equals({x:o,y:s})||this.curves.push(new Tn(this.currentPoint.clone(),new b(t,e),new b(r,n),new b(o,s))),this._setCurrentPoint({x:o,y:s}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new En(this.currentPoint.clone(),new b(t,e),new b(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,s){return this.ellipse(t,e,r,r,0,n,o,s),this}relativeArc(t,e,r,n,o,s){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,s),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,s,a,l=!0){const h=new An(new b(t,e),r,n,o,s,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,s,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,n,o,s,a,l),this}rect(t,e,r,n){return this.curves.push(new Ln(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 $n([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 V(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 ko(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Bo(i,t,e,r){const n=t.clone().sub(i),o=r.clone().sub(e),s=e.clone().sub(i),a=n.cross(o);if(a===0)return new b((i.x+e.x)/2,(i.y+e.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new b((i.x+e.x)/2,(i.y+e.y)/2):new b(i.x+l*n.x,i.y+l*n.y)}var jo=Object.defineProperty,Fo=(i,t,e)=>t in i?jo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,br=(i,t,e)=>(Fo(i,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){br(this,"currentPath",new ee),br(this,"paths",[this.currentPath]),br(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof bt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new ee().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 ee().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,s){return this.currentPath.bezierCurveTo(t,e,r,n,o,s),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,s){return this.currentPath.arc(t,e,r,n,o,s),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,s,a,l){return this.currentPath.ellipse(t,e,r,n,o,s,a,l),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(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],p=h[h.length-1]??u;r.push({start:c?p:u,end:c?u:p,index:l})});const s=[];return r.forEach((a,l)=>{s[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&s[l].push(h.index)})}),e.forEach((a,l)=>{const h=n[l];o[l].forEach(u=>{const p=a.getTForPoint(u),g=a.getNormal(p).scale(h?t:-t);u.add(g)})}),s.forEach((a,l)=>{const h=o[l];a.forEach(c=>{const u=o[c],p=Bo(h[h.length-1],h[h.length-2]??h[h.length-1],u[0],u[1]??u[0]);p&&(h[h.length-1].copy(p),u[0].copy(p))})}),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 s=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),p=u.clone().scale(a?s:-s),g=u.clone().scale(a?-s:s);l.push(c.clone().add(p),c.clone().add(g),c.clone().add({x:s,y:0}),c.clone().add({x:-s,y:0}),c.clone().add({x:0,y:s}),c.clone().add({x:0,y:-s}),c.clone().add({x:s,y:s}),c.clone().add({x:-s,y:-s}))}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 V(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(),dr(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(),dr(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[ko(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:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*e,l.height=a*e,l.style.width=`${s}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 Mr="px",kn=90,Bn=["mm","cm","in","pt","pc","px"],xr={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 E(i){let t="px";if(typeof i=="string"||i instanceof String)for(let r=0,n=Bn.length;r<n;r++){const o=Bn[r];if(i.endsWith(o)){t=o,i=i.substring(0,i.length-o.length);break}}let e;return t==="px"&&Mr!=="px"?e=xr.in[Mr]/kn:(e=xr[t][Mr],e<0&&(e=xr[t].in*kn)),e*Number.parseFloat(i)}const Go=new yt,Ge=new yt,jn=new yt,Fn=new yt;function Ro(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const r=Vo(i);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Vo(i){const t=new yt,e=Go;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(E(i.getAttribute("x")),E(i.getAttribute("y"))),i.hasAttribute("transform")){const r=i.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),h=Pt(o.slice(s+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,p=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],p=h[2]),Ge.makeTranslation(-u,-p),jn.makeRotation(c),Fn.multiplyMatrices(jn,Ge),Ge.makeTranslation(u,p),e.multiplyMatrices(Ge,Fn)}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 qo(i){return new bt().addPath(new ee().arc(E(i.getAttribute("cx")||0),E(i.getAttribute("cy")||0),E(i.getAttribute("r")||0),0,Math.PI*2))}function Wo(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const r=i.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=r.style.length,a=0;a<s;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let s=0;s<n.length;s++)t[n[s]]=Object.assign(t[n[s]]||{},{...o})}}function Ho(i){return new bt().addPath(new ee().ellipse(E(i.getAttribute("cx")||0),E(i.getAttribute("cy")||0),E(i.getAttribute("rx")||0),E(i.getAttribute("ry")||0),0,0,Math.PI*2))}function Qo(i){return new bt().moveTo(E(i.getAttribute("x1")||0),E(i.getAttribute("y1")||0)).lineTo(E(i.getAttribute("x2")||0),E(i.getAttribute("y2")||0))}function Xo(i){const t=new bt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Yo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Zo(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Yo,(n,o,s)=>{const a=E(o),l=E(s);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!0,t}const Ko=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jo(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Ko,(n,o,s)=>{const a=E(o),l=E(s);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!1,t}function ta(i){const t=E(i.getAttribute("x")||0),e=E(i.getAttribute("y")||0),r=E(i.getAttribute("rx")||i.getAttribute("ry")||0),n=E(i.getAttribute("ry")||i.getAttribute("rx")||0),o=E(i.getAttribute("width")),s=E(i.getAttribute("height")),a=1-.551915024494,l=new bt;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+s-n),(r!==0||n!==0)&&l.bezierCurveTo(t+o,e+s-n*a,t+o-r*a,e+s,t+o-r,e+s),l.lineTo(t+r,e+s),(r!==0||n!==0)&&l.bezierCurveTo(t+r*a,e+s,t,e+s-n*a,t,e+s-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 At(i,t,e){t=Object.assign({},t);let r={};if(i.hasAttribute("class")){const h=i.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]}`])}i.hasAttribute("id")&&(r=Object.assign(r,e[`#${i.getAttribute("id")}`]));for(let h=i.style.length,c=0;c<h;c++){const u=i.style.item(c),p=i.style.getPropertyValue(u);t[u]=p,r[u]=p}function n(h,c,u=o){i.hasAttribute(h)&&(t[c]=u(i.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 s(h){return Math.max(0,Math.min(1,E(h)))}function a(h){return Math.max(0,E(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>E(c))}return n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),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",E),n("visibility","visibility"),t}function Cr(i,t,e=[],r={}){var u;if(i.nodeType!==1)return e;let n=!1,o=null,s={...t};switch(i.nodeName){case"svg":s=At(i,s,r);break;case"style":Wo(i,r);break;case"g":s=At(i,s,r);break;case"path":s=At(i,s,r),i.hasAttribute("d")&&(o=Xo(i));break;case"rect":s=At(i,s,r),o=ta(i);break;case"polygon":s=At(i,s,r),o=Zo(i);break;case"polyline":s=At(i,s,r),o=Jo(i);break;case"circle":s=At(i,s,r),o=qo(i);break;case"ellipse":s=At(i,s,r),o=Ho(i);break;case"line":s=At(i,s,r),o=Qo(i);break;case"defs":n=!0;break;case"use":{s=At(i,s,r);const g=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),m=(u=i.viewportElement)==null?void 0:u.getElementById(g);m?Cr(m,s,e,r):console.warn(`'use node' references non-existent node id: ${g}`);break}default:console.warn(i);break}if(s.display==="none")return e;Object.assign(t,s);const a=new yt,l=[],h=Ro(i,a,l);o&&(o.matrix(a),e.push(o),o.style=t);const c=i.childNodes;for(let p=0,g=c.length;p<g;p++){const m=c[p];n&&m.nodeName!=="style"&&m.nodeName!=="defs"||Cr(m,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Gn="data:image/svg+xml;",Rn=`${Gn}base64,`,Vn=`${Gn}charset=utf8,`;function qn(i){if(typeof i=="string"){let t;return i.startsWith(Rn)?(i=i.substring(Rn.length,i.length),t=atob(i)):i.startsWith(Vn)?(i=i.substring(Vn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Sr(i){return Cr(qn(i),{})}function Qt(i,t=!0){if(!i.length)return;const e=b.MAX,r=b.MIN;return i.forEach(n=>n.getMinMax(e,r,t)),new V(e.x,e.y,r.x-e.x,r.y-e.y)}function Pr(i){const{x:t,y:e,width:r,height:n}=Qt(i),o=i.map(s=>s.toSvgPathString()).join("");return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}function ea(i){return`data:image/svg+xml;base64,${btoa(Pr(i))}`}function ra(i){return new DOMParser().parseFromString(Pr(i),"image/svg+xml").documentElement}function na(i,t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:s,height:a}=Qt(i),l=document.createElement("canvas");l.width=s*e,l.height=a*e,l.style.width=`${s}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-n,-o),i.forEach(c=>{c.drawTo(h,r)})),l}const ia=new Set(["©","®","÷"]),sa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),Wn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Hn{constructor(t,e,r){L(this,"lineBox",new V);L(this,"inlineBox",new V);L(this,"glyphBox");L(this,"center");L(this,"underlinePosition",0);L(this,"underlineThickness",0);L(this,"yStrikeoutPosition",0);L(this,"yStrikeoutSize",0);L(this,"baseline",0);L(this,"centerDiviation",0);L(this,"path",new bt);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_font(){var e;const t=(e=wn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof it)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:o,post:s}=t,{content:a,computedStyle:l}=this,{fontSize:h}=l,c=e/h,u=t.getAdvanceWidth(a,h),p=(r+Math.abs(n))/c,g=r/c,m=(r-o.yStrikeoutPosition)/c,w=o.yStrikeoutSize/c,d=(r-s.underlinePosition)/c,S=s.underlineThickness/c;return this.inlineBox.width=u,this.inlineBox.height=p,this.underlinePosition=d,this.underlineThickness=S,this.yStrikeoutPosition=m,this.yStrikeoutSize=w,this.baseline=g,this.centerDiviation=p/2-g,this}updatePath(){var T;const t=this._font();if(!t)return this;const{isVertical:e,content:r,computedStyle:n,baseline:o,inlineBox:s}=this.updateGlyph(t),{os2:a,ascender:l,descender:h}=t,c=a.sTypoAscender,{left:u,top:p}=s,{fontSize:g,fontStyle:m}=n;let w=u,d=p+o,S;const x=new bt;if(e&&(w+=(s.height-s.width)/2,Math.abs(s.width-s.height)>.1&&(d-=(l-c)/(l+Math.abs(h))*s.height),S=void 0),e&&!ia.has(r)&&(r.codePointAt(0)<=256||sa.has(r))){x.addCommands(t.getPathCommands(r,w,p+o-(s.height-s.width)/2,g)??[]);const v={y:p-(s.height-s.width)/2+s.height/2,x:w+s.width/2};m==="italic"&&this._italic(x,e?{x:v.x,y:p-(s.height-s.width)/2+o}:void 0),x.rotate(90,v)}else S!==void 0?(x.addCommands(t.glyphs.get(S).getPathCommands(w,d,g)),m==="italic"&&this._italic(x,e?{x:w+s.width/2,y:p+c/(l+Math.abs(h))*s.height}:void 0)):(x.addCommands(t.getPathCommands(r,w,d,g)??[]),m==="italic"&&this._italic(x,e?{x:w+s.height/2,y:d}:void 0));x.addCommands(this._decoration());const C=n.fontWeight??400;return C in Wn&&x.bold(Wn[C]*g*.05),x.style={fill:n.color,stroke:n.textStrokeWidth?n.textStrokeColor:"none",strokeWidth:n.textStrokeWidth?n.textStrokeWidth*g*.03:0},this.path=x,this.glyphBox=this.getGlyphBoundingBox(),this.center=(T=this.glyphBox)==null?void 0:T.getCenterPoint(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:o}=this.computedStyle,{left:s,top:a,width:l,height:h}=this.inlineBox,c=.1*o;let u;switch(n){case"underline":t?u=s:u=a+e;break;case"line-through":t?u=s+l/2:u=a+r;break;case"none":default:return[]}return t?[{type:"M",x:u,y:a},{type:"L",x:u,y:a+h},{type:"L",x:u+c,y:a+h},{type:"L",x:u+c,y:a},{type:"Z"}]:[{type:"M",x:s,y:u},{type:"L",x:s+l,y:u},{type:"L",x:s+l,y:u+c},{type:"L",x:s,y:u+c},{type:"Z"}]}_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 V(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){Ce({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function re(i){return!i||i==="none"}function Re(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}class Qn{constructor(t,e={},r){L(this,"inlineBox",new V);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,...Re(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Hn(r,e++,this));return this.characters=t,this}}class ne{constructor(t,e){L(this,"lineBox",new V);L(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Re(this.parentStyle),...Re(this.style)},this}addFragment(t,e){const r=new Qn(t,e,this);return this.fragments.push(r),r}}class Xn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{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(s=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(s.style)),s.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 s;return(s=n.parentNode)==null?void 0:s.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((l,h)=>{var p;const c=l.getBoundingClientRect();r.push({paragraphIndex:s,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});const u=l.firstChild;if(u instanceof window.Text){const g=document.createRange();g.selectNodeContents(u);const m=u.data?u.data.length:0;let w=0;for(;w<=m;){g.setStart(u,Math.max(w-1,0)),g.setEnd(u,w);const d=((p=g.getClientRects)==null?void 0:p.call(g))??[g.getBoundingClientRect()];let S=d[d.length-1];d.length>1&&S.width<2&&(S=d[d.length-2]);const x=g.toString();x!==""&&S&&S.width+S.height!==0&&n.push({content:x,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:w-1,top:S.top,left:S.left,height:S.height,width:S.width,textWidth:-1,textHeight:-1}),w++}}})}),{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 s=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],p=o[s];u.inlineBox.left=p.left,u.inlineBox.top=p.top,u.inlineBox.width=p.width,u.inlineBox.height=p.height;const g=u.fontHeight;u.lineBox.left=p.left,u.lineBox.top=p.top+(p.height-g)/2,u.lineBox.height=g,u.lineBox.width=p.width,s++}),{paragraphs:e,boundingBox:new V(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Yn{constructor(t){this._text=t}parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new ne({},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 ne({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new ne({},e);n.forEach(s=>{if(typeof s=="string")o.addFragment(s);else{const{content:a,...l}=s;a!==void 0&&o.addFragment(a,l)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...s}=n,a=new ne(s,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,...s}=n;if(o!==void 0){const a=new ne(s,e);a.addFragment(o),r.push(a)}}}return r}}function oa(i){return i}const aa="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function la(i,t,e){if(i==="cover")return 0;if(typeof i=="string")if(i.endsWith("%")){const r=Number(i.substring(0,i.length-1))/100;return Math.ceil(r*e/t)}else return i.endsWith("rem")?Number(i.substring(0,i.length-3)):Math.ceil(Number(i)/t);else return Math.ceil(i/t)}function ha(i,t,e){return typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function ca(i,t,e,r){let n;r?n={x:e.width/t.height,y:e.height/t.width}:n={x:e.width/t.width,y:e.height/t.height};const o=e.getCenterPoint().add(i.getCenterPoint().sub(t.getCenterPoint()).scale(n.x,n.y)).sub({x:i.width/2*n.x,y:i.height/2*n.y}),s=new yt;return s.translate(-i.left,-i.top),r&&(s.translate(-i.width/2,-i.height/2),s.rotate(Math.PI/2),s.translate(i.width/2,i.height/2)),s.scale(n.x,n.y),s.translate(o.x,o.y),s}function Zn(){const i=[],t=[],e=new Map;function r(n){let o=e.get(n);return o||(o=Sr(n),e.set(n,o)),o}return{name:"highlight",paths:i,update:n=>{i.length=0;const{characters:o}=n;let s;const a=[];let l;o.forEach(h=>{const{isVertical:c,computedStyle:u}=h;!re(u.highlightImage)&&h.glyphBox&&(u.highlightSize!=="1rem"&&(l==null?void 0:l.highlightImage)===u.highlightImage&&(l==null?void 0:l.highlightSize)===u.highlightSize&&(l==null?void 0:l.highlightStrokeWidth)===u.highlightStrokeWidth&&(l==null?void 0:l.highlightOverflow)===u.highlightOverflow&&s.length&&(c?s[0].inlineBox.left===h.inlineBox.left:s[0].inlineBox.top===h.inlineBox.top)&&s[0].fontSize===h.fontSize?s.push(h):(s=[],s.push(h),a.push(s))),l=u}),a.filter(h=>h.length).map(h=>{const c=h[0];return{style:c.computedStyle,baseline:c.baseline,box:V.from(...h.map(u=>u.glyphBox))}}).forEach(h=>{const{style:c,box:u,baseline:p}=h,{fontSize:g,writingMode:m}=c,w=m.includes("vertical"),d=ha(c.highlightStrokeWidth,g,u.width),S=la(c.highlightSize,g,u.width),x=re(c.highlightOverflow)?S?"hidden":"visible":c.highlightOverflow,C=r(re(c.highlightReferImage)?aa:c.highlightReferImage),T=r(c.highlightImage),v=Qt(T,!0),M=Qt(C,!1),A=S?g*S:w?u.height:u.width,P=p*.8,_=ca(v,M,new V(u.left,u.top,w?P:A,w?A:P),w),z=g/v.width*2,q=Math.ceil(u.width/A);for(let $=0;$<q;$++){const mt=_.clone().translate($*A,0);T.forEach(D=>{const I=D.clone().matrix(mt);I.style.strokeWidth&&(I.style.strokeWidth*=z*d),I.style.strokeMiterlimit&&(I.style.strokeMiterlimit*=z),I.style.strokeDashoffset&&(I.style.strokeDashoffset*=z),I.style.strokeDasharray&&(I.style.strokeDasharray=I.style.strokeDasharray.map(k=>k*z)),i.push(I),t[i.length-1]=x==="hidden"?new V(u.left,u.top-u.height,u.width,u.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{i.forEach((s,a)=>{Ce({ctx:n,path:s,clipRect:t[a],fontSize:o.computedStyle.fontSize})})}}}function Kn(i,t,e){return i==="cover"?1:typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function Jn(){const i=[];return{name:"listStyle",paths:i,update:t=>{i.length=0;const{paragraphs:e,computedStyle:r,isVertical:n}=t;let o=t.fontSize;e.forEach(u=>{u.fragments.forEach(p=>{p.characters.forEach(g=>{o=Math.max(o,g.computedStyle.fontSize)})})});let s=r.listStyleSize,a;if(!re(r.listStyleImage))a=r.listStyleImage;else if(!re(r.listStyleType)){const u=o*.38/2;switch(s=s==="cover"?u*2:s,r.listStyleType){case"disc":a=`<svg width="${u*2}" height="${u*2}" xmlns="http://www.w3.org/2000/svg">
|
|
5
5
|
<circle cx="${u}" cy="${u}" r="${u}" fill="${r.color}" />
|
|
6
|
-
</svg>`;break}}if(!a)return;const l=
|
|
6
|
+
</svg>`;break}}if(!a)return;const l=o*.45,h=Sr(a),c=Qt(h);e.forEach(u=>{const p=u.lineBox;if(p){const g=new yt;if(n){const m=Kn(s,r.fontSize,o),w=o/c.height*m;g.translate(-c.left,-c.top),g.rotate(Math.PI/2),g.scale(w,w),g.translate(o/2-c.height*w/2,0),g.translate(p.left+(p.width-o)/2,p.top-l)}else{const m=Kn(s,r.fontSize,o),w=o/c.height*m;g.translate(-c.left,-c.top),g.translate(-c.width,0),g.scale(w,w),g.translate(0,o/2-c.height*w/2),g.translate(p.left-l,p.top+(p.height-o)/2)}i.push(...h.map(m=>m.clone().matrix(g)))}})}}}const jt=new b,ie=new yt,Ft=new yt;function ti(){return{name:"render",getBoundingBox:i=>{const{characters:t,fontSize:e,effects:r}=i,n=[];return t.forEach(o=>{r==null||r.forEach(s=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),l=_r(i,s);jt.set(a.left,a.top),jt.applyMatrix3(l),a.left=jt.x,a.top=jt.y,jt.set(a.right,a.bottom),jt.applyMatrix3(l),a.width=jt.x-a.left,a.height=jt.y-a.top;const h=(s.shadowOffsetX??0)*e,c=(s.shadowOffsetY??0)*e,u=Math.max(.1,s.textStrokeWidth??0)*e;a.left+=h-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?V.from(...n):void 0},render:(i,t)=>{const{characters:e,paragraphs:r,renderBoundingBox:n,effects:o,style:s}=t;function a(l,h){i.fillStyle=l,i.fillRect(h.left,h.top,h.width,h.height)}s!=null&&s.backgroundColor&&a(s.backgroundColor,new V(0,0,i.canvas.width,i.canvas.height)),r.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&a(l.style.backgroundColor,l.lineBox)}),o?o.forEach(l=>{Tt(l,n,i),i.save();const[h,c,u,p,g,m]=_r(t,l).transpose().elements;i.transform(h,p,c,g,u,m),e.forEach(w=>{var d;(d=w.parent.style)!=null&&d.backgroundColor&&a(w.parent.style.backgroundColor,w.inlineBox),w.drawTo(i,l)}),i.restore()}):r.forEach(l=>{l.fragments.forEach(h=>{var c;(c=h.style)!=null&&c.backgroundColor&&a(h.computedStyle.backgroundColor,h.inlineBox),h.characters.forEach(u=>{u.drawTo(i)})})})}}}function _r(i,t){const{fontSize:e,renderBoundingBox:r}=i,n=(t.offsetX??0)*e,o=(t.offsetY??0)*e,s=Math.PI*2,a=(t.skewX??0)/360*s,l=(t.skewY??0)/360*s,{left:h,top:c,width:u,height:p}=r,g=h+u/2,m=c+p/2;return ie.identity(),Ft.makeTranslation(n,o),ie.multiply(Ft),Ft.makeTranslation(g,m),ie.multiply(Ft),Ft.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),ie.multiply(Ft),Ft.makeTranslation(-g,-m),ie.multiply(Ft),ie.clone()}const Tr={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textTransform:"none",textOrientation:"mixed",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,listStyleType:"none",listStyleImage:"none",listStyleSize:"cover",listStylePosition:"outside",highlightReferImage:"none",highlightImage:"none",highlightSize:"cover",highlightStrokeWidth:"100%",highlightOverflow:"none"};class ua{constructor(t={}){L(this,"content");L(this,"style");L(this,"effects");L(this,"measureDom");L(this,"needsUpdate",!0);L(this,"computedStyle",{...Tr});L(this,"paragraphs",[]);L(this,"boundingBox",new V);L(this,"renderBoundingBox",new V);L(this,"parser",new Yn(this));L(this,"measurer",new Xn(this));L(this,"plugins",new Map);const{content:e="",style:r={},measureDom:n,effects:o}=t;this.content=e,this.style=r,this.measureDom=n,this.effects=o,this.use(ti()).use(Zn()).use(Jn())}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}measure(t=this.measureDom){this.computedStyle={...Tr,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);return this.paragraphs=e,r}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const r=this.characters;r.forEach(a=>a.update());const n=[...this.plugins.values()];n.sort((a,l)=>(a.updateOrder??0)-(l.updateOrder??0)).forEach(a=>{var l;(l=a.update)==null||l.call(a,this)});const o=b.MAX,s=b.MIN;return r.forEach(a=>{if(!a.getGlyphMinMax(o,s)){const{inlineBox:l}=a,h=new b(l.left,l.top),c=new b(l.left+l.width,l.top+l.height);o.min(h,c),s.max(h,c)}}),this.renderBoundingBox=new V(o.x,o.y,s.x-o.x,s.y-o.y),this.renderBoundingBox=V.from(this.renderBoundingBox,...n.map(a=>a.getBoundingBox?a.getBoundingBox(this):Qt(a.paths??[])).filter(Boolean)),this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Dr(n,r,this.renderBoundingBox),Nr(n,this),[...this.plugins.values()].sort((s,a)=>(s.renderOrder??0)-(a.renderOrder??0)).forEach(s=>{var a;s.render?(a=s.render)==null||a.call(s,n,this):s.paths&&s.paths.forEach(l=>{Ce({ctx:n,path:l,fontSize:this.computedStyle.fontSize})})}),this):this}}f.BoundingBox=V,f.Character=Hn,f.CircleCurve=je,f.CmapSubtableFormat0=sr,f.CmapSubtableFormat12=hr,f.CmapSubtableFormat14=me,f.CmapSubtableFormat2=de,f.CmapSubtableFormat4=lr,f.CmapSubtableFormat6=Vt,f.CubicBezierCurve=Tn,f.Curve=_t,f.CurvePath=ee,f.EllipseCurve=An,f.Eot=Ei,f.Font=Oe,f.Fonts=mn,f.Fragment=Qn,f.Glyph=tr,f.GlyphSet=er,f.HeartCurve=Ao,f.LineCurve=Ht,f.Matrix3=yt,f.Measurer=Xn,f.Paragraph=ne,f.Parser=Yn,f.Path2D=bt,f.PloygonCurve=zo,f.QuadraticBezierCurve=En,f.RectangularCurve=Ln,f.Sfnt=ue,f.SplineCurve=$n,f.TableDirectory=Zt,f.Text=ua,f.Ttf=it,f.Vector2=b,f.Woff=Ut,f.WoffTableDirectoryEntry=Wt,f.addPathCommandsToPath2D=yr,f.componentFlags=Jt,f.createCmapSegments=ar,f.defaultTextStyles=Tr,f.definePlugin=oa,f.defineSfntTable=nt,f.drawPath=Ce,f.filterEmpty=Re,f.fonts=wn,f.getPathsBoundingBox=Qt,f.getTransform2D=_r,f.highlight=Zn,f.isNone=re,f.listStyle=Jn,f.minify=oo,f.minifyGlyphs=vn,f.minifySfnt=bn,f.parse=gn,f.parseArcCommand=xn,f.parseColor=st,f.parsePathDataArgs=Pt,f.parseSvg=Sr,f.parseSvgToDom=qn,f.pathCommandsToPathData=Cn,f.pathDataToPathCommands=mr,f.pathsToCanvas=na,f.pathsToSvg=ra,f.pathsToSvgString=Pr,f.pathsToSvgUrl=ea,f.render=ti,f.setCanvasContext=dr,f.setupView=Dr,f.uploadColor=Tt,f.uploadColors=Nr,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -880,7 +880,15 @@ function listStyle() {
|
|
|
880
880
|
paths,
|
|
881
881
|
update: (text) => {
|
|
882
882
|
paths.length = 0;
|
|
883
|
-
const { paragraphs, computedStyle: style,
|
|
883
|
+
const { paragraphs, computedStyle: style, isVertical } = text;
|
|
884
|
+
let fontSize = text.fontSize;
|
|
885
|
+
paragraphs.forEach((p) => {
|
|
886
|
+
p.fragments.forEach((f) => {
|
|
887
|
+
f.characters.forEach((c) => {
|
|
888
|
+
fontSize = Math.max(fontSize, c.computedStyle.fontSize);
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
});
|
|
884
892
|
let listStyleSize = style.listStyleSize;
|
|
885
893
|
let image;
|
|
886
894
|
if (!isNone(style.listStyleImage)) {
|
|
@@ -903,25 +911,25 @@ function listStyle() {
|
|
|
903
911
|
const imagePaths = parseSvg(image);
|
|
904
912
|
const imageBox = getPathsBoundingBox(imagePaths);
|
|
905
913
|
paragraphs.forEach((paragraph) => {
|
|
906
|
-
const box = paragraph.
|
|
914
|
+
const box = paragraph.lineBox;
|
|
907
915
|
if (box) {
|
|
908
916
|
const m = new Matrix3();
|
|
909
917
|
if (isVertical) {
|
|
910
|
-
const scale = parseScale(listStyleSize, style.fontSize,
|
|
911
|
-
const reScale =
|
|
918
|
+
const scale = parseScale(listStyleSize, style.fontSize, fontSize);
|
|
919
|
+
const reScale = fontSize / imageBox.height * scale;
|
|
912
920
|
m.translate(-imageBox.left, -imageBox.top);
|
|
913
921
|
m.rotate(Math.PI / 2);
|
|
914
922
|
m.scale(reScale, reScale);
|
|
915
|
-
m.translate(
|
|
916
|
-
m.translate(box.left, box.top - padding);
|
|
923
|
+
m.translate(fontSize / 2 - imageBox.height * reScale / 2, 0);
|
|
924
|
+
m.translate(box.left + (box.width - fontSize) / 2, box.top - padding);
|
|
917
925
|
} else {
|
|
918
|
-
const scale = parseScale(listStyleSize, style.fontSize,
|
|
919
|
-
const reScale =
|
|
926
|
+
const scale = parseScale(listStyleSize, style.fontSize, fontSize);
|
|
927
|
+
const reScale = fontSize / imageBox.height * scale;
|
|
920
928
|
m.translate(-imageBox.left, -imageBox.top);
|
|
921
929
|
m.translate(-imageBox.width, 0);
|
|
922
930
|
m.scale(reScale, reScale);
|
|
923
|
-
m.translate(0,
|
|
924
|
-
m.translate(box.left - padding, box.top);
|
|
931
|
+
m.translate(0, fontSize / 2 - imageBox.height * reScale / 2);
|
|
932
|
+
m.translate(box.left - padding, box.top + (box.height - fontSize) / 2);
|
|
925
933
|
}
|
|
926
934
|
paths.push(...imagePaths.map((p) => p.clone().matrix(m)));
|
|
927
935
|
}
|