modern-text 0.4.0 → 0.4.2

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 CHANGED
@@ -176,11 +176,9 @@ class Character {
176
176
  }
177
177
  _getFontSfnt(fonts) {
178
178
  const fontFamily = this.computedStyle.fontFamily;
179
- let sfnt;
180
- if (fontFamily) {
181
- sfnt = fonts?.get(fontFamily)?.getSfnt() ?? modernFont.fonts.get(fontFamily)?.getSfnt();
182
- }
183
- return sfnt;
179
+ const _fonts = fonts ?? modernFont.fonts;
180
+ const font = fontFamily ? _fonts.get(fontFamily) : _fonts.fallbackFont;
181
+ return font?.getSfnt();
184
182
  }
185
183
  updateGlyph(sfnt = this._getFontSfnt()) {
186
184
  if (!sfnt) {
@@ -1187,10 +1185,10 @@ class Text {
1187
1185
  }
1188
1186
  updateBoundingBox() {
1189
1187
  const { lineBox, rawGlyphBox, pathBox } = this;
1190
- const left = pathBox.left + lineBox.left - rawGlyphBox.left;
1191
- const top = pathBox.top + lineBox.top - rawGlyphBox.top;
1192
- const right = pathBox.right + lineBox.right - rawGlyphBox.right;
1193
- const bottom = pathBox.bottom + lineBox.bottom - rawGlyphBox.bottom;
1188
+ const left = Math.min(pathBox.left, pathBox.left + lineBox.left - rawGlyphBox.left);
1189
+ const top = Math.min(pathBox.top, pathBox.top + lineBox.top - rawGlyphBox.top);
1190
+ const right = Math.max(pathBox.right, pathBox.right + lineBox.right - rawGlyphBox.right);
1191
+ const bottom = Math.max(pathBox.bottom, pathBox.bottom + lineBox.bottom - rawGlyphBox.bottom);
1194
1192
  this.boundingBox = new modernPath2d.BoundingBox(
1195
1193
  left,
1196
1194
  top,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(z,ot){typeof exports=="object"&&typeof module<"u"?ot(exports):typeof define=="function"&&define.amd?define(["exports"],ot):(z=typeof globalThis<"u"?globalThis:z||self,ot(z.modernText={}))})(this,function(z){"use strict";var pa=Object.defineProperty;var da=(z,ot,Ot)=>ot in z?pa(z,ot,{enumerable:!0,configurable:!0,writable:!0,value:Ot}):z[ot]=Ot;var U=(z,ot,Ot)=>da(z,typeof ot!="symbol"?ot+"":ot,Ot);function ot(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:i,stops:a}=is(t,e.left,e.top,e.width,e.height),h=s.createLinearGradient(r,n,o,i);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Ot(s,t,e){s!=null&&s.color&&(s.color=ot(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=ot(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=ot(e,s.textStrokeColor,t))}function is(s,t,e,r,n){var g;const o=((g=s.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",i=o.split(",")[0],a=i.includes("deg")?i:"0deg",h=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),u=(Number(a.replace("deg",""))||0)*Math.PI/180,c=r*Math.sin(u),p=n*Math.cos(u);return{x0:t+r/2-c,y0:e+n/2+p,x1:t+r/2+c,y1:e+n/2-p,stops:Array.from(h).map(d=>{let m=d[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(d[3].replace("%",""))/100,color:m}})}}function Te(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const o=e.style,i={...o,fill:s.color??o.fill,stroke:s.textStrokeColor??o.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,i),t.restore()}function Nr(s,t,e){const{left:r,top:n,width:o,height:i}=e,a=s.canvas;a.dataset.viewBox=`${r} ${n} ${o} ${i}`,a.dataset.pixelRatio=String(t);const h=o,l=i;a.width=Math.max(1,Math.ceil(h*t)),a.height=Math.max(1,Math.ceil(l*t)),a.style.width=`${h}px`,a.style.height=`${l}px`,s.clearRect(0,0,a.width,a.height),s.scale(t,t),s.translate(-r,-n)}function zr(s,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;Ot(r,n,s),e.forEach(o=>{Ot(o.computedStyle,o.lineBox,s),o.fragments.forEach(i=>{Ot(i.computedStyle,i.inlineBox,s)})})}var at=Uint8Array,Mt=Uint16Array,Ye=Int32Array,_e=new at([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]),Ie=new at([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]),He=new at([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ur=function(s,t){for(var e=new Mt(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new Ye(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}},Lr=Ur(_e,2),Er=Lr.b,Ze=Lr.r;Er[28]=258,Ze[258]=28;for(var $r=Ur(Ie,0),os=$r.b,kr=$r.r,Ke=new Mt(32768),G=0;G<32768;++G){var Ft=(G&43690)>>1|(G&21845)<<1;Ft=(Ft&52428)>>2|(Ft&13107)<<2,Ft=(Ft&61680)>>4|(Ft&3855)<<4,Ke[G]=((Ft&65280)>>8|(Ft&255)<<8)>>1}for(var Nt=function(s,t,e){for(var r=s.length,n=0,o=new Mt(t);n<r;++n)s[n]&&++o[s[n]-1];var i=new Mt(t);for(n=1;n<t;++n)i[n]=i[n-1]+o[n-1]<<1;var a;if(e){a=new Mt(1<<t);var h=15-t;for(n=0;n<r;++n)if(s[n])for(var l=n<<4|s[n],u=t-s[n],c=i[s[n]-1]++<<u,p=c|(1<<u)-1;c<=p;++c)a[Ke[c]>>h]=l}else for(a=new Mt(r),n=0;n<r;++n)s[n]&&(a[n]=Ke[i[s[n]-1]++]>>15-s[n]);return a},Gt=new at(288),G=0;G<144;++G)Gt[G]=8;for(var G=144;G<256;++G)Gt[G]=9;for(var G=256;G<280;++G)Gt[G]=7;for(var G=280;G<288;++G)Gt[G]=8;for(var le=new at(32),G=0;G<32;++G)le[G]=5;var as=Nt(Gt,9,0),ls=Nt(Gt,9,1),hs=Nt(le,5,0),cs=Nt(le,5,1),Je=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},_t=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},tr=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},er=function(s){return(s+7)/8|0},Br=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new at(s.subarray(t,e))},us=["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"],It=function(s,t,e){var r=new Error(t||us[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,It),!e)throw r;return r},fs=function(s,t,e,r){var n=s.length,o=0;if(!n||t.f&&!t.l)return e||new at(0);var i=!e,a=i||t.i!=2,h=t.i;i&&(e=new at(n*3));var l=function(Et){var $t=e.length;if(Et>$t){var jt=new at(Math.max($t*2,Et));jt.set(e),e=jt}},u=t.f||0,c=t.p||0,p=t.b||0,g=t.l,d=t.d,m=t.m,f=t.n,b=n*8;do{if(!g){u=_t(s,c,1);var P=_t(s,c+1,3);if(c+=3,P)if(P==1)g=ls,d=cs,m=9,f=5;else if(P==2){var x=_t(s,c,31)+257,A=_t(s,c+10,15)+4,S=x+_t(s,c+5,31)+1;c+=14;for(var C=new at(S),L=new at(19),W=0;W<A;++W)L[He[W]]=_t(s,c+W*3,7);c+=A*3;for(var B=Je(L),bt=(1<<B)-1,O=Nt(L,B,1),W=0;W<S;){var D=O[_t(s,c,bt)];c+=D&15;var M=D>>4;if(M<16)C[W++]=M;else{var j=0,k=0;for(M==16?(k=3+_t(s,c,3),c+=2,j=C[W-1]):M==17?(k=3+_t(s,c,7),c+=3):M==18&&(k=11+_t(s,c,127),c+=7);k--;)C[W++]=j}}var et=C.subarray(0,x),Q=C.subarray(x);m=Je(et),f=Je(Q),g=Nt(et,m,1),d=Nt(Q,f,1)}else It(1);else{var M=er(c)+4,T=s[M-4]|s[M-3]<<8,w=M+T;if(w>n){h&&It(0);break}a&&l(p+T),e.set(s.subarray(M,w),p),t.b=p+=T,t.p=c=w*8,t.f=u;continue}if(c>b){h&&It(0);break}}a&&l(p+131072);for(var Tt=(1<<m)-1,q=(1<<f)-1,J=c;;J=c){var j=g[tr(s,c)&Tt],F=j>>4;if(c+=j&15,c>b){h&&It(0);break}if(j||It(2),F<256)e[p++]=F;else if(F==256){J=c,g=null;break}else{var R=F-254;if(F>264){var W=F-257,N=_e[W];R=_t(s,c,(1<<N)-1)+Er[W],c+=N}var H=d[tr(s,c)&q],X=H>>4;H||It(3),c+=H&15;var Q=os[X];if(X>3){var N=Ie[X];Q+=tr(s,c)&(1<<N)-1,c+=N}if(c>b){h&&It(0);break}a&&l(p+131072);var rt=p+R;if(p<Q){var Ht=o-Q,Zt=Math.min(Q,rt);for(Ht+p<0&&It(3);p<Zt;++p)e[p]=r[Ht+p]}for(;p<rt;++p)e[p]=e[p-Q]}}t.l=g,t.p=J,t.b=p,t.f=u,g&&(u=1,t.m=m,t.d=d,t.n=f)}while(!u);return p!=e.length&&i?Br(e,0,p):e.subarray(0,p)},Bt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},he=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},rr=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,o=e.slice();if(!n)return{t:qr,l:0};if(n==1){var i=new at(e[0].s+1);return i[e[0].s]=1,{t:i,l:1}}e.sort(function(w,x){return w.f-x.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],l=0,u=1,c=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=n-1;)a=e[e[l].f<e[c].f?l++:c++],h=e[l!=u&&e[l].f<e[c].f?l++:c++],e[u++]={s:-1,f:a.f+h.f,l:a,r:h};for(var p=o[0].s,r=1;r<n;++r)o[r].s>p&&(p=o[r].s);var g=new Mt(p+1),d=nr(e[u-1],g,0);if(d>t){var r=0,m=0,f=d-t,b=1<<f;for(o.sort(function(x,A){return g[A.s]-g[x.s]||x.f-A.f});r<n;++r){var P=o[r].s;if(g[P]>t)m+=b-(1<<d-g[P]),g[P]=t;else break}for(m>>=f;m>0;){var M=o[r].s;g[M]<t?m-=1<<t-g[M]++-1:++r}for(;r>=0&&m;--r){var T=o[r].s;g[T]==t&&(--g[T],++m)}d=t}return{t:new at(g),l:d}},nr=function(s,t,e){return s.s==-1?Math.max(nr(s.l,t,e+1),nr(s.r,t,e+1)):t[s.s]=e},jr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new Mt(++t),r=0,n=s[0],o=1,i=function(h){e[r++]=h},a=1;a<=t;++a)if(s[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(n),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(n);o=1,n=s[a]}return{c:e.subarray(0,r),n:t}},ce=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Fr=function(s,t,e){var r=e.length,n=er(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var o=0;o<r;++o)s[n+o+4]=e[o];return(n+4+r)*8},Gr=function(s,t,e,r,n,o,i,a,h,l,u){Bt(t,u++,e),++n[256];for(var c=rr(n,15),p=c.t,g=c.l,d=rr(o,15),m=d.t,f=d.l,b=jr(p),P=b.c,M=b.n,T=jr(m),w=T.c,x=T.n,A=new Mt(19),S=0;S<P.length;++S)++A[P[S]&31];for(var S=0;S<w.length;++S)++A[w[S]&31];for(var C=rr(A,7),L=C.t,W=C.l,B=19;B>4&&!L[He[B-1]];--B);var bt=l+5<<3,O=ce(n,Gt)+ce(o,le)+i,D=ce(n,p)+ce(o,m)+i+14+3*B+ce(A,L)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&bt<=O&&bt<=D)return Fr(t,u,s.subarray(h,h+l));var j,k,et,Q;if(Bt(t,u,1+(D<O)),u+=2,D<O){j=Nt(p,g,0),k=p,et=Nt(m,f,0),Q=m;var Tt=Nt(L,W,0);Bt(t,u,M-257),Bt(t,u+5,x-1),Bt(t,u+10,B-4),u+=14;for(var S=0;S<B;++S)Bt(t,u+3*S,L[He[S]]);u+=3*B;for(var q=[P,w],J=0;J<2;++J)for(var F=q[J],S=0;S<F.length;++S){var R=F[S]&31;Bt(t,u,Tt[R]),u+=L[R],R>15&&(Bt(t,u,F[S]>>5&127),u+=F[S]>>12)}}else j=as,k=Gt,et=hs,Q=le;for(var S=0;S<a;++S){var N=r[S];if(N>255){var R=N>>18&31;he(t,u,j[R+257]),u+=k[R+257],R>7&&(Bt(t,u,N>>23&31),u+=_e[R]);var H=N&31;he(t,u,et[H]),u+=Q[H],H>3&&(he(t,u,N>>5&8191),u+=Ie[H])}else he(t,u,j[N]),u+=k[N]}return he(t,u,j[256]),u+k[256]},ps=new Ye([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qr=new at(0),ds=function(s,t,e,r,n,o){var i=o.z||s.length,a=new at(r+i+5*(1+Math.ceil(i/7e3))+n),h=a.subarray(r,a.length-n),l=o.l,u=(o.r||0)&7;if(t){u&&(h[0]=o.r>>3);for(var c=ps[t-1],p=c>>13,g=c&8191,d=(1<<e)-1,m=o.p||new Mt(32768),f=o.h||new Mt(d+1),b=Math.ceil(e/3),P=2*b,M=function(ae){return(s[ae]^s[ae+1]<<b^s[ae+2]<<P)&d},T=new Ye(25e3),w=new Mt(288),x=new Mt(32),A=0,S=0,C=o.i||0,L=0,W=o.w||0,B=0;C+2<i;++C){var bt=M(C),O=C&32767,D=f[bt];if(m[O]=D,f[bt]=O,W<=C){var j=i-C;if((A>7e3||L>24576)&&(j>423||!l)){u=Gr(s,h,0,T,w,x,S,L,B,C-B,u),L=A=S=0,B=C;for(var k=0;k<286;++k)w[k]=0;for(var k=0;k<30;++k)x[k]=0}var et=2,Q=0,Tt=g,q=O-D&32767;if(j>2&&bt==M(C-q))for(var J=Math.min(p,j)-1,F=Math.min(32767,C),R=Math.min(258,j);q<=F&&--Tt&&O!=D;){if(s[C+et]==s[C+et-q]){for(var N=0;N<R&&s[C+N]==s[C+N-q];++N);if(N>et){if(et=N,Q=q,N>J)break;for(var H=Math.min(q,N-2),X=0,k=0;k<H;++k){var rt=C-q+k&32767,Ht=m[rt],Zt=rt-Ht&32767;Zt>X&&(X=Zt,D=rt)}}}O=D,D=m[O],q+=O-D&32767}if(Q){T[L++]=268435456|Ze[et]<<18|kr[Q];var Et=Ze[et]&31,$t=kr[Q]&31;S+=_e[Et]+Ie[$t],++w[257+Et],++x[$t],W=C+et,++A}else T[L++]=s[C],++w[s[C]]}}for(C=Math.max(C,W);C<i;++C)T[L++]=s[C],++w[s[C]];u=Gr(s,h,l,T,w,x,S,L,B,C-B,u),l||(o.r=u&7|h[u/8|0]<<3,u-=7,o.h=f,o.p=m,o.i=C,o.w=W)}else{for(var C=o.w||0;C<i+l;C+=65535){var jt=C+65535;jt>=i&&(h[u/8|0]=l,jt=i),u=Fr(h,u+1,s.subarray(C,jt))}o.i=i}return Br(a,0,r+er(u)+n)},Rr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,o=e.length|0,i=0;i!=o;){for(var a=Math.min(i+2655,o);i<a;++i)n+=r+=e[i];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},gs=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),i=new at(o.length+s.length);i.set(o),i.set(s,o.length),s=i,n.w=o.length}return ds(s,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+t.mem,e,r,n)},Vr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},ys=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Rr();n.p(t.dictionary),Vr(s,2,n.d())}},ms=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&It(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&It(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function ws(s,t){t||(t={});var e=Rr();e.p(s);var r=gs(s,t,t.dictionary?6:2,4);return ys(r,t),Vr(r,r.length-4,e.d()),r}function xs(s,t){return fs(s.subarray(ms(s,t),-4),{i:2},t,t)}var vs=typeof TextDecoder<"u"&&new TextDecoder,bs=0;try{vs.decode(qr,{stream:!0}),bs=1}catch{}const Ms="modern-font";function ue(s,t){if(!s)throw new Error(`[${Ms}] ${t}`)}function Ss(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function Kt(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Wr=Object.defineProperty,Cs=(s,t,e)=>t in s?Wr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,lt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Wr(t,e,n),n},Ps=(s,t,e)=>(Cs(s,t+"",e),e);const De={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ht(){return function(s,t){Object.defineProperty(s.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class st extends DataView{constructor(t,e,r,n){super(Ss(t),e,r),this.littleEndian=n,Ps(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,i=>i.toUpperCase())}`,o=this[n](e,r);return this.cursor+=De[t],o}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let o=0,i=r.length;o<i;o++)n+=String.fromCharCode(r[o]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const o=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,i=this[o](r,e,n);return this.cursor+=De[t.toLowerCase()],i}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,i;n<o;++n)i=t.charCodeAt(n)||0,i>127?this.writeUint16(i):this.writeUint8(i);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=Kt(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}}lt([ht()],st.prototype,"readInt8"),lt([ht()],st.prototype,"readInt16"),lt([ht()],st.prototype,"readInt32"),lt([ht()],st.prototype,"readUint8"),lt([ht()],st.prototype,"readUint16"),lt([ht()],st.prototype,"readUint32"),lt([ht()],st.prototype,"readFloat32"),lt([ht()],st.prototype,"readFloat64"),lt([ht()],st.prototype,"writeInt8"),lt([ht()],st.prototype,"writeInt16"),lt([ht()],st.prototype,"writeInt32"),lt([ht()],st.prototype,"writeUint8"),lt([ht()],st.prototype,"writeUint16"),lt([ht()],st.prototype,"writeUint32"),lt([ht()],st.prototype,"writeFloat32"),lt([ht()],st.prototype,"writeFloat64");var Ts=Object.defineProperty,_s=(s,t,e)=>t in s?Ts(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Is=(s,t,e)=>(_s(s,t+"",e),e);const Qr=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let i=Qr.get(n);i||(i={columns:[],byteLength:0},Qr.set(n,i));const a={...t,name:o,byteLength:e*De[r],offset:t.offset??i.columns.reduce((h,l)=>h+l.byteLength,0)};i.columns.push(a),i.byteLength=i.columns.reduce((h,l)=>h+De[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class Ct{constructor(t,e,r,n){Is(this,"view"),this.view=new st(t,e,r,n)}}function Ds(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Ae(s){s=Ds(s);const t=[];for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function As(s){let t="";for(let e=0,r=s.length;e<r;e++)s[e]<127?t+=String.fromCharCode(s[e]):t+=`%${(256+s[e]).toString(16).slice(1)}`;return unescape(t)}function Os(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}class sr extends Ct{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 Xr=Object.defineProperty,Ns=(s,t,e)=>t in s?Xr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,gt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Xr(t,e,n),n},Yr=(s,t,e)=>(Ns(s,typeof t!="symbol"?t+"":t,e),e);const yt=class ts extends sr{constructor(){super(...arguments),Yr(this,"format","EmbeddedOpenType"),Yr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=Ae(n.fontFamily||""),i=o.length,a=Ae(n.fontStyle||""),h=a.length,l=Ae(n.version||""),u=l.length,c=Ae(n.fullName||""),p=c.length,g=86+i+4+h+4+u+4+p+2+t.view.byteLength,d=new ts(new ArrayBuffer(g),0,g,!0);d.EOTSize=d.view.byteLength,d.FontDataSize=t.view.byteLength,d.Version=131073,d.Flags=0,d.Charset=1,d.MagicNumber=20556,d.Padding1=0,d.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(d.FontPANOSE=m.fontPANOSE,d.Italic=m.fsSelection,d.Weight=m.usWeightClass,d.fsType=m.fsType,d.UnicodeRange=m.ulUnicodeRange,d.CodePageRange=m.ulCodePageRange),d.view.writeUint16(i),d.view.writeBytes(o),d.view.writeUint16(0),d.view.writeUint16(h),d.view.writeBytes(a),d.view.writeUint16(0),d.view.writeUint16(u),d.view.writeBytes(l),d.view.writeUint16(0),d.view.writeUint16(p),d.view.writeBytes(c),d.view.writeUint16(0),d.view.writeUint16(0),d.view.writeBytes(t.view),d}};gt([y("uint32")],yt.prototype,"EOTSize"),gt([y("uint32")],yt.prototype,"FontDataSize"),gt([y("uint32")],yt.prototype,"Version"),gt([y("uint32")],yt.prototype,"Flags"),gt([y({type:"uint8",size:10})],yt.prototype,"FontPANOSE"),gt([y("uint8")],yt.prototype,"Charset"),gt([y("uint8")],yt.prototype,"Italic"),gt([y("uint32")],yt.prototype,"Weight"),gt([y("uint16")],yt.prototype,"fsType"),gt([y("uint16")],yt.prototype,"MagicNumber"),gt([y({type:"uint8",size:16})],yt.prototype,"UnicodeRange"),gt([y({type:"uint8",size:8})],yt.prototype,"CodePageRange"),gt([y("uint32")],yt.prototype,"CheckSumAdjustment"),gt([y({type:"uint8",size:16})],yt.prototype,"Reserved"),gt([y("uint16")],yt.prototype,"Padding1");var zs=Object.defineProperty,Oe=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&zs(t,e,n),n};class fe extends Ct{constructor(t,e){super(t,e,16)}}Oe([y({type:"char",size:4})],fe.prototype,"tag"),Oe([y("uint32")],fe.prototype,"checkSum"),Oe([y("uint32")],fe.prototype,"offset"),Oe([y("uint32")],fe.prototype,"length");const ir=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Us=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Ls=Object.defineProperty,Es=(s,t,e)=>t in s?Ls(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,pe=(s,t,e)=>(Es(s,typeof t!="symbol"?t+"":t,e),e);class Hr{constructor(t){pe(this,"index"),pe(this,"name"),pe(this,"isComposite",!1),pe(this,"components",[]),pe(this,"pathCommands",[]);const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},o){const i=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=i,yScale:h=i}=n,l=this.pathCommands,u=[];for(let c=0,p=l.length;c<p;c+=1){const g=l[c];g.type==="M"?u.push({type:"M",x:t+g.x*a,y:e+-g.y*h}):g.type==="L"?u.push({type:"L",x:t+g.x*a,y:e+-g.y*h}):g.type==="Q"?u.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="C"?u.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*h,x2:t+g.x2*a,y2:e+-g.y2*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="Z"&&u.push({type:"Z"})}return u}}class $s extends Hr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:i,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,u=this.index;let c,p,g,d;const m=[],f=[];let b=0,P=!1,M=!1,T=i,w=0,x=0;function A(O,D){m.push({type:"L",x:O,y:D})}function S(O,D,j,k,et,Q){m.push({type:"C",x1:O,y1:D,x2:j,y2:k,x:et,y:Q})}function C(O,D){M&&l!==2&&L(),M=!0,m.push({type:"M",x:O,y:D})}function L(){m.push({type:"Z"})}function W(O){m.push(...O)}function B(){f.length%2!==0&&!P&&(T=f.shift()+o),b+=f.length>>1,f.length=0,P=!0}function bt(O){let D,j,k,et,Q,Tt,q,J,F,R,N,H,X=0;for(;X<O.length;){let rt=O[X++];switch(rt){case 1:B();break;case 3:B();break;case 4:f.length>1&&!P&&(T=f.shift()+o,P=!0),x+=f.pop(),C(w,x);break;case 5:for(;f.length>0;)w+=f.shift(),x+=f.shift(),A(w,x);break;case 6:for(;f.length>0&&(w+=f.shift(),A(w,x),f.length!==0);)x+=f.shift(),A(w,x);break;case 7:for(;f.length>0&&(x+=f.shift(),A(w,x),f.length!==0);)w+=f.shift(),A(w,x);break;case 8:for(;f.length>0;)c=w+f.shift(),p=x+f.shift(),g=c+f.shift(),d=p+f.shift(),w=g+f.shift(),x=d+f.shift(),S(c,p,g,d,w,x);break;case 10:Q=f.pop()+h,Tt=t.subrs[Q],Tt&&bt(Tt);break;case 11:return;case 12:switch(rt=O[X],X+=1,rt){case 35:c=w+f.shift(),p=x+f.shift(),g=c+f.shift(),d=p+f.shift(),q=g+f.shift(),J=d+f.shift(),F=q+f.shift(),R=J+f.shift(),N=F+f.shift(),H=R+f.shift(),w=N+f.shift(),x=H+f.shift(),f.shift(),S(c,p,g,d,q,J),S(F,R,N,H,w,x);break;case 34:c=w+f.shift(),p=x,g=c+f.shift(),d=p+f.shift(),q=g+f.shift(),J=d,F=q+f.shift(),R=d,N=F+f.shift(),H=x,w=N+f.shift(),S(c,p,g,d,q,J),S(F,R,N,H,w,x);break;case 36:c=w+f.shift(),p=x+f.shift(),g=c+f.shift(),d=p+f.shift(),q=g+f.shift(),J=d,F=q+f.shift(),R=d,N=F+f.shift(),H=R+f.shift(),w=N+f.shift(),S(c,p,g,d,q,J),S(F,R,N,H,w,x);break;case 37:c=w+f.shift(),p=x+f.shift(),g=c+f.shift(),d=p+f.shift(),q=g+f.shift(),J=d+f.shift(),F=q+f.shift(),R=J+f.shift(),N=F+f.shift(),H=R+f.shift(),Math.abs(N-w)>Math.abs(H-x)?w=N+f.shift():x=H+f.shift(),S(c,p,g,d,q,J),S(F,R,N,H,w,x);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+rt}`),f.length=0}break;case 14:if(f.length>=4){const Ht=ir[f.pop()],Zt=ir[f.pop()],Et=f.pop(),$t=f.pop();if(Ht&&Zt){n.isComposite=!0,n.components=[];const jt=t.charset.indexOf(Ht),ae=t.charset.indexOf(Zt);n.components.push({glyphIndex:ae,dx:0,dy:0}),n.components.push({glyphIndex:jt,dx:$t,dy:Et}),W(r.get(ae).pathCommands);const Dr=JSON.parse(JSON.stringify(r.get(jt).pathCommands));for(let Ar=0;Ar<Dr.length;Ar+=1){const kt=Dr[Ar];kt.type!=="Z"&&(kt.x+=$t,kt.y+=Et),(kt.type==="Q"||kt.type==="C")&&(kt.x1+=$t,kt.y1+=Et),kt.type==="C"&&(kt.x2+=$t,kt.y2+=Et)}W(Dr)}}else f.length>0&&!P&&(T=f.shift()+o,P=!0);M&&l!==2&&(L(),M=!1);break;case 18:B();break;case 19:case 20:B(),X+=b+7>>3;break;case 21:f.length>2&&!P&&(T=f.shift()+o,P=!0),x+=f.pop(),w+=f.pop(),C(w,x);break;case 22:f.length>1&&!P&&(T=f.shift()+o,P=!0),w+=f.pop(),C(w,x);break;case 23:B();break;case 24:for(;f.length>2;)c=w+f.shift(),p=x+f.shift(),g=c+f.shift(),d=p+f.shift(),w=g+f.shift(),x=d+f.shift(),S(c,p,g,d,w,x);w+=f.shift(),x+=f.shift(),A(w,x);break;case 25:for(;f.length>6;)w+=f.shift(),x+=f.shift(),A(w,x);c=w+f.shift(),p=x+f.shift(),g=c+f.shift(),d=p+f.shift(),w=g+f.shift(),x=d+f.shift(),S(c,p,g,d,w,x);break;case 26:for(f.length%2&&(w+=f.shift());f.length>0;)c=w,p=x+f.shift(),g=c+f.shift(),d=p+f.shift(),w=g,x=d+f.shift(),S(c,p,g,d,w,x);break;case 27:for(f.length%2&&(x+=f.shift());f.length>0;)c=w+f.shift(),p=x,g=c+f.shift(),d=p+f.shift(),w=g+f.shift(),x=d,S(c,p,g,d,w,x);break;case 28:D=O[X],j=O[X+1],f.push((D<<24|j<<16)>>16),X+=2;break;case 29:Q=f.pop()+a,Tt=t.gsubrs[Q],Tt&&bt(Tt);break;case 30:for(;f.length>0&&(c=w,p=x+f.shift(),g=c+f.shift(),d=p+f.shift(),w=g+f.shift(),x=d+(f.length===1?f.shift():0),S(c,p,g,d,w,x),f.length!==0);)c=w+f.shift(),p=x,g=c+f.shift(),d=p+f.shift(),x=d+f.shift(),w=g+(f.length===1?f.shift():0),S(c,p,g,d,w,x);break;case 31:for(;f.length>0&&(c=w+f.shift(),p=x,g=c+f.shift(),d=p+f.shift(),x=d+f.shift(),w=g+(f.length===1?f.shift():0),S(c,p,g,d,w,x),f.length!==0);)c=w,p=x+f.shift(),g=c+f.shift(),d=p+f.shift(),w=g+f.shift(),x=d+(f.length===1?f.shift():0),S(c,p,g,d,w,x);break;default:rt<32?console.warn(`Glyph ${u}: unknown operator ${rt}`):rt<247?f.push(rt-139):rt<251?(D=O[X],X+=1,f.push((rt-247)*256+D+108)):rt<255?(D=O[X],X+=1,f.push(-(rt-251)*256-D-108)):(D=O[X],j=O[X+1],k=O[X+2],et=O[X+3],X+=4,f.push((D<<24|j<<16|k<<8|et)/65536))}}}bt(e),this.pathCommands=m,P&&(this.advanceWidth=T)}}var ks=Object.defineProperty,Bs=(s,t,e)=>t in s?ks(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,js=(s,t,e)=>(Bs(s,t+"",e),e);class Zr{constructor(t){this._sfnt=t,js(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 Fs extends Zr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new $s({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Kr=Object.defineProperty,Gs=(s,t,e)=>t in s?Kr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Jr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Kr(t,e,n),n},Ne=(s,t,e)=>(Gs(s,typeof t!="symbol"?t+"":t,e),e);class ze extends Ct{constructor(t,e,r,n){super(t,e,r,n),Ne(this,"_offsets"),Ne(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let o=0,i=e+1;o<i;o++){const a=this.view;let h=0;for(let l=0;l<r;l++)h<<=8,h+=a.readUint8();n.push(h)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],i=r+e[t+1]-n;return this._isString?this.view.readString(n,i):this.view.readBytes(n,i)}}Jr([y("uint16")],ze.prototype,"count"),Jr([y("uint8")],ze.prototype,"offsetSize");class Ue extends ze{constructor(){super(...arguments),Ne(this,"_isString",!1)}}class tn extends ze{constructor(){super(...arguments),Ne(this,"_isString",!0)}}const qs=[".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"],Rs=[".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"],Vs=[".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"],Ws=[".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 Le(s,t){return t<=390?qs[t]:s[t-391]}var Qs=Object.defineProperty,Xs=(s,t,e)=>t in s?Qs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,en=(s,t,e)=>(Xs(s,typeof t!="symbol"?t+"":t,e),e);function V(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(i){this._setProp(o,i)},configurable:!0,enumerable:!0})}}class rn extends Ct{constructor(){super(...arguments),en(this,"_dict"),en(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),i=o>>4,a=o&15;if(i===r||(e+=n[i],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,i;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),o=e.readUint8(),i=e.readUint8(),r<<24|n<<16|o<<8|i;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),n[o]=e,e=[]):e.push(this._readOperand(o))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Le(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ys=Object.defineProperty,or=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Ys(t,e,n),n};class Ee extends rn{}or([V(19)],Ee.prototype,"subrs"),or([V(20)],Ee.prototype,"defaultWidthX"),or([V(21)],Ee.prototype,"nominalWidthX");var Hs=Object.defineProperty,Z=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Hs(t,e,n),n};class Y extends rn{}Z([V(0,"string")],Y.prototype,"version"),Z([V(1,"string")],Y.prototype,"notice"),Z([V(1200,"string")],Y.prototype,"copyright"),Z([V(2,"string")],Y.prototype,"fullName"),Z([V(3,"string")],Y.prototype,"familyName"),Z([V(4,"string")],Y.prototype,"weight"),Z([V(1201)],Y.prototype,"isFixedPitch"),Z([V(1202)],Y.prototype,"italicAngle"),Z([V(1203,"number",-100)],Y.prototype,"underlinePosition"),Z([V(1204,"number",50)],Y.prototype,"underlineThickness"),Z([V(1205)],Y.prototype,"paintType"),Z([V(1206,"number",2)],Y.prototype,"charstringType"),Z([V(1207,"number[]",[.001,0,0,.001,0,0])],Y.prototype,"fontMatrix"),Z([V(13)],Y.prototype,"uniqueId"),Z([V(5,"number[]",[0,0,0,0])],Y.prototype,"fontBBox"),Z([V(1208)],Y.prototype,"strokeWidth"),Z([V(14)],Y.prototype,"xuid"),Z([V(15)],Y.prototype,"charset"),Z([V(16)],Y.prototype,"encoding"),Z([V(17)],Y.prototype,"charStrings"),Z([V(18,"number[]",[0,0])],Y.prototype,"private");var Zs=Object.defineProperty,Ks=(s,t,e)=>t in s?Zs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ar=(s,t,e)=>(Ks(s,typeof t!="symbol"?t+"":t,e),e);function ct(s,t=s){return e=>{$e.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty($e.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const nn=class Pe{constructor(t){ar(this,"tables",new Map),ar(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,o=Array.from({length:n}),i=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||i;return o}getPathCommands(t,e,r,n,o){var i;return(i=this.charToGlyph(t))==null?void 0:i.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={},i){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const u=h[l];i.call(this,u,e,r,n,o),u.advanceWidth&&(e+=u.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*n:o.tracking&&(e+=o.tracking/1e3*n)}return e}clone(){return new Pe(this.tableViews)}delete(t){const e=Pe.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Pe.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Pe.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}};ar(nn,"tableDefinitions",new Map);let $e=nn;class ut extends Ct{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var sn=Object.defineProperty,Js=Object.getOwnPropertyDescriptor,ti=(s,t,e)=>t in s?sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,de=(s,t,e,r)=>{for(var n=r>1?void 0:r?Js(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&sn(t,e,n),n},lr=(s,t,e)=>(ti(s,typeof t!="symbol"?t+"":t,e),e);let Jt=class extends ut{constructor(s,t,e,r){super(s,t,e,r),lr(this,"_glyphs"),lr(this,"privateDict"),lr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Fs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var s;return((s=this.privateDict)==null?void 0:s.defaultWidthX)??0}get nominalWidthX(){var s;return((s=this.privateDict)==null?void 0:s.nominalWidthX)??0}get subrs(){var s;return((s=this.subrsIndex)==null?void 0:s.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const s=this.view,{buffer:t,byteOffset:e}=s,r=e+4;this.nameIndex=new tn(t,r),this.topDictIndex=new Ue(t,this.nameIndex.endOffset),this.stringIndex=new tn(t,this.topDictIndex.endOffset),this.globalSubrIndex=new Ue(t,this.stringIndex.endOffset),this.topDict=new Y(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const n=this.topDict.private[0],o=this.topDict.private[1];n&&(this.privateDict=new Ee(t,e+o,n).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ue(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new Ue(t,e+this.topDict.charStrings);const i=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Rs:this.topDict.charset===1?this.charset=Vs:this.topDict.charset===2?this.charset=Ws:this.charset=this._readCharset(e+this.topDict.charset,i,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=ir:this.topDict.encoding===1?this.encoding=Us:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(s,t,e){const r=this.view;r.seek(s);let n,o,i;t-=1;const a=[".notdef"],h=r.readUint8();if(h===0)for(n=0;n<t;n+=1)o=r.readUint16(),a.push(Le(e,o));else if(h===1)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint8(),n=0;n<=i;n+=1)a.push(Le(e,o)),o+=1;else if(h===2)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint16(),n=0;n<=i;n+=1)a.push(Le(e,o)),o+=1;else throw new Error(`Unknown charset format ${h}`);return a}_readEncoding(s){const t=this.view;t.seek(s);let e,r;const n={},o=t.readUint8();if(o===0){const i=t.readUint8();for(e=0;e<i;e+=1)r=t.readUint8(),n[r]=e}else if(o===1){const i=t.readUint8();for(r=1,e=0;e<i;e+=1){const a=t.readUint8(),h=t.readUint8();for(let l=a;l<=a+h;l+=1)n[l]=r,r+=1}}else console.warn(`unknown encoding format:${o}`);return n}_calcSubroutineBias(s){let t;return s.length<1240?t=107:s.length<33900?t=1131:t=32768,t}};de([y("uint8")],Jt.prototype,"majorVersion",2),de([y("uint8")],Jt.prototype,"minorVersion",2),de([y("uint8")],Jt.prototype,"headerSize",2),de([y("uint8")],Jt.prototype,"offsetSize",2),Jt=de([ct("CFF ","cff")],Jt);var ei=Object.defineProperty,ke=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ei(t,e,n),n};const ge=class es extends Ct{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new es;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}};ke([y("uint16")],ge.prototype,"format"),ke([y("uint16")],ge.prototype,"length"),ke([y("uint16")],ge.prototype,"language"),ke([y({type:"uint8",size:256})],ge.prototype,"glyphIndexArray");let on=ge;var ri=Object.defineProperty,hr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ri(t,e,n),n};class Be extends Ct{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,o=this.subHeaders,i=this.glyphIndexArray,a=r.findIndex(l=>l===n);let h=0;for(let l=0;l<256;l++)if(r[l]===0)l>=a||l<o[0].firstCode||l>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(l-o[0].firstCode)>=i.length?h=0:(h=i[o[0].idRangeOffset+(l-o[0].firstCode)],h!==0&&(h=h+o[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const u=r[l];for(let c=0,p=o[u].entryCount;c<p;c++)if(o[u].idRangeOffset+c>=i.length?h=0:(h=i[o[u].idRangeOffset+c],h!==0&&(h=h+o[u].idDelta)),h!==0&&h<t){const g=(l<<8|c+o[u].firstCode)%65535;e.set(g,h)}}return e}}hr([y("uint16")],Be.prototype,"format"),hr([y("uint16")],Be.prototype,"length"),hr([y("uint16")],Be.prototype,"language");function an(s){return s>32767?s-65536:s<-32767?s+65536:s}function ln(s,t){let e;const r=[];let n={};return s.forEach((o,i)=>{t&&i>t||((!e||i!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:i,startId:o,delta:an(o-i)}):(n.start=Number(i),n.startId=o,n.delta=an(o-i))),e={unicode:i,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var ni=Object.defineProperty,Qt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ni(t,e,n),n};const qt=class rs extends Ct{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=ln(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,i=new rs(new ArrayBuffer(24+e.length*8));return i.format=4,i.length=i.view.byteLength,i.language=0,i.segCountX2=r*2,i.searchRange=o,i.entrySelector=n,i.rangeShift=2*r-o,i.endCode=[...e.map(a=>a.end),65535],i.reservedPad=0,i.startCode=[...e.map(a=>a.start),65535],i.idDelta=[...e.map(a=>a.delta),1],i.idRangeOffset=Array.from({length:r},()=>0),i}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,i=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let u=n[l],c=o[l];u<=c;++u)if(i[l]===0)t.set(u,(u+a[l])%65536);else{const p=l+i[l]/2+(u-n[l])-r,g=h[p];g!==0?t.set(u,(g+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Qt([y("uint16")],qt.prototype,"format"),Qt([y("uint16")],qt.prototype,"length"),Qt([y("uint16")],qt.prototype,"language"),Qt([y("uint16")],qt.prototype,"segCountX2"),Qt([y("uint16")],qt.prototype,"searchRange"),Qt([y("uint16")],qt.prototype,"entrySelector"),Qt([y("uint16")],qt.prototype,"rangeShift");let hn=qt;var si=Object.defineProperty,ye=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&si(t,e,n),n};class te extends Ct{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}}ye([y("uint16")],te.prototype,"format"),ye([y("uint16")],te.prototype,"length"),ye([y("uint16")],te.prototype,"language"),ye([y("uint16")],te.prototype,"firstCode"),ye([y("uint16")],te.prototype,"entryCount");var ii=Object.defineProperty,me=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ii(t,e,n),n};const ee=class ns extends Ct{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=ln(t),r=new ns(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const o=e[r];let i=o.startGlyphCode,a=o.startCharCode;const h=o.endCharCode;for(;a<=h;)t.set(a++,i++)}return t}};me([y("uint16")],ee.prototype,"format"),me([y("uint16")],ee.prototype,"reserved"),me([y("uint32")],ee.prototype,"length"),me([y("uint32")],ee.prototype,"language"),me([y("uint32")],ee.prototype,"nGroups");let cn=ee;var oi=Object.defineProperty,cr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&oi(t,e,n),n};class je extends Ct{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:o}=e[r];o.forEach(i=>{t.set(i.unicodeValue,i.glyphID)})}return t}}cr([y("uint16")],je.prototype,"format"),cr([y("uint32")],je.prototype,"length"),cr([y("uint32")],je.prototype,"numVarSelectorRecords");var un=Object.defineProperty,ai=Object.getOwnPropertyDescriptor,li=(s,t,e)=>t in s?un(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ur=(s,t,e,r)=>{for(var n=r>1?void 0:r?ai(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&un(t,e,n),n},fn=(s,t,e)=>(li(s,typeof t!="symbol"?t+"":t,e),e);let we=class extends ut{constructor(){super(...arguments),fn(this,"_unicodeToGlyphIndexMap"),fn(this,"_glyphIndexToUnicodesMap")}static from(s){const t=Array.from(s.keys()).some(u=>u>65535),e=hn.from(s),r=on.from(s),n=t?cn.from(s):void 0,o=4+(n?32:24),i=o+e.view.byteLength,a=i+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:i},{platformID:3,platformSpecificID:1,offset:o},n&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),l=new we(new ArrayBuffer(4+8*h.length+e.view.byteLength+r.view.byteLength+((n==null?void 0:n.view.byteLength)??0)));return l.numberSubtables=h.length,l.view.seek(4),h.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(e.view,o),l.view.writeBytes(r.view,i),n&&l.view.writeBytes(n.view,a),l}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,n=e.length;r<n;r++){const o=e[r],i=t.get(o);s.has(i)?s.get(i).push(o):s.set(i,[o])}this._glyphIndexToUnicodesMap=s}return this._glyphIndexToUnicodesMap}readSubtables(){const s=this.numberSubtables;return this.view.seek(4),Array.from({length:s},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const e=this.view.readUint16();let r;switch(e){case 0:r=new on(this.view.buffer,t.offset);break;case 2:r=new Be(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new hn(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new te(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new cn(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new je(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){var i,a,h,l,u;const s=this.readSubtables(),t=(i=s.find(c=>c.format===0))==null?void 0:i.view,e=(a=s.find(c=>c.platformID===3&&c.platformSpecificID===3&&c.format===2))==null?void 0:a.view,r=(h=s.find(c=>c.platformID===3&&c.platformSpecificID===1&&c.format===4))==null?void 0:h.view,n=(l=s.find(c=>c.platformID===3&&c.platformSpecificID===10&&c.format===12))==null?void 0:l.view,o=(u=s.find(c=>c.platformID===0&&c.platformSpecificID===5&&c.format===14))==null?void 0:u.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(e==null?void 0:e.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}};ur([y("uint16")],we.prototype,"version",2),ur([y("uint16")],we.prototype,"numberSubtables",2),we=ur([ct("cmap")],we);class hi extends Hr{_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 ue(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const o=t[n],i={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(i)}return r}_parseGlyphCoordinate(t,e,r,n,o){let i;return(e&n)>0?(i=t.view.readUint8(),e&o||(i=-i),i=r+i):(e&o)>0?i=r:i=r+t.view.readInt16(),i}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let m=0;m<n;m++)a.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();ue(h<5e3,`Bad instructionLength:${h}`);const l=this.instructions=[];for(let m=0;m<h;++m)l.push(t.view.readUint8());const u=t.view.byteOffset,c=a[a.length-1]+1;ue(c<2e4,`Bad numberOfCoordinates:${u}`);const p=[];let g,d=0;for(;d<c;)if(g=t.view.readUint8(),p.push(g),d++,g&8&&d<c){const m=t.view.readUint8();for(let f=0;f<m;f++)p.push(g),d++}if(ue(p.length===c,`Bad flags length: ${p.length}, numberOfCoordinates: ${c}`),a.length>0){const m=[];let f;if(c>0){for(let M=0;M<c;M+=1)g=p[M],f={},f.onCurve=!!(g&1),f.lastPointOfContour=a.includes(M),m.push(f);let b=0;for(let M=0;M<c;M+=1)g=p[M],f=m[M],f.x=this._parseGlyphCoordinate(t,g,b,2,16),b=f.x;let P=0;for(let M=0;M<c;M+=1)g=p[M],f=m[M],f.y=this._parseGlyphCoordinate(t,g,P,4,32),P=f.y}this.points=m}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let u;if(h.matchedPoints===void 0)u=this._transformPoints(l.points,h);else{ue(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const c=this.points[h.matchedPoints[0]];let p=l.points[h.matchedPoints[1]];const g={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};p=this._transformPoints([p],g)[0],g.dx=c.x-p.x,g.dy=c.y-p.y,u=this._transformPoints(l.points,g)}this.points=this.points.concat(u)}}const o=[],i=this._parseContours(this.points);for(let a=0,h=i.length;a<h;++a){const l=i[a];let u=l[l.length-1],c=l[0];u.onCurve?o.push({type:"M",x:u.x,y:u.y}):c.onCurve?o.push({type:"M",x:c.x,y:c.y}):o.push({type:"M",x:(u.x+c.x)*.5,y:(u.y+c.y)*.5});for(let p=0,g=l.length;p<g;++p)if(u=c,c=l[(p+1)%g],u.onCurve)o.push({type:"L",x:u.x,y:u.y});else{let d=c;c.onCurve||(d={x:(u.x+c.x)*.5,y:(u.y+c.y)*.5}),o.push({type:"Q",x1:u.x,y1:u.y,x:d.x,y:d.y})}o.push({type:"Z"})}this.pathCommands=o}}class ci extends Zr{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new hi({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var pn=Object.defineProperty,ui=Object.getOwnPropertyDescriptor,fi=(s,t,e)=>t in s?pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,pi=(s,t,e,r)=>{for(var n=r>1?void 0:r?ui(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&pn(t,e,n),n},di=(s,t,e)=>(fi(s,t+"",e),e);let fr=class extends ut{constructor(){super(...arguments),di(this,"_glyphs")}static from(s){const t=s.reduce((r,n)=>r+n.byteLength,0),e=new fr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeBytes(r)}),e}get glyphs(){return this._glyphs??(this._glyphs=new ci(this._sfnt))}};fr=pi([ct("glyf")],fr);var gi=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,mi=(s,t,e,r)=>{for(var n=r>1?void 0:r?yi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&gi(t,e,n),n};let dn=class extends ut{};dn=mi([ct("GPOS","gpos")],dn);var wi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,Xt=(s,t,e,r)=>{for(var n=r>1?void 0:r?xi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&wi(t,e,n),n};let Rt=class extends ut{};Xt([y("uint16")],Rt.prototype,"majorVersion",2),Xt([y("uint16")],Rt.prototype,"minorVersion",2),Xt([y("uint16")],Rt.prototype,"scriptListOffset",2),Xt([y("uint16")],Rt.prototype,"featureListOffset",2),Xt([y("uint16")],Rt.prototype,"lookupListOffset",2),Xt([y("uint16")],Rt.prototype,"featureVariationsOffset",2),Rt=Xt([ct("GSUB","gsub")],Rt);var vi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,nt=(s,t,e,r)=>{for(var n=r>1?void 0:r?bi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&vi(t,e,n),n};let tt=class extends ut{constructor(s=new ArrayBuffer(54),t){super(s,t,Math.min(54,s.byteLength-(t??0)))}};nt([y("fixed")],tt.prototype,"version",2),nt([y("fixed")],tt.prototype,"fontRevision",2),nt([y("uint32")],tt.prototype,"checkSumAdjustment",2),nt([y("uint32")],tt.prototype,"magickNumber",2),nt([y("uint16")],tt.prototype,"flags",2),nt([y("uint16")],tt.prototype,"unitsPerEm",2),nt([y({type:"longDateTime"})],tt.prototype,"created",2),nt([y({type:"longDateTime"})],tt.prototype,"modified",2),nt([y("int16")],tt.prototype,"xMin",2),nt([y("int16")],tt.prototype,"yMin",2),nt([y("int16")],tt.prototype,"xMax",2),nt([y("int16")],tt.prototype,"yMax",2),nt([y("uint16")],tt.prototype,"macStyle",2),nt([y("uint16")],tt.prototype,"lowestRecPPEM",2),nt([y("int16")],tt.prototype,"fontDirectionHint",2),nt([y("int16")],tt.prototype,"indexToLocFormat",2),nt([y("int16")],tt.prototype,"glyphDataFormat",2),tt=nt([ct("head")],tt);var Mi=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,mt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Si(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Mi(t,e,n),n};let ft=class extends ut{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};mt([y("fixed")],ft.prototype,"version",2),mt([y("int16")],ft.prototype,"ascent",2),mt([y("int16")],ft.prototype,"descent",2),mt([y("int16")],ft.prototype,"lineGap",2),mt([y("uint16")],ft.prototype,"advanceWidthMax",2),mt([y("int16")],ft.prototype,"minLeftSideBearing",2),mt([y("int16")],ft.prototype,"minRightSideBearing",2),mt([y("int16")],ft.prototype,"xMaxExtent",2),mt([y("int16")],ft.prototype,"caretSlopeRise",2),mt([y("int16")],ft.prototype,"caretSlopeRun",2),mt([y("int16")],ft.prototype,"caretOffset",2),mt([y({type:"int16",size:4})],ft.prototype,"reserved",2),mt([y("int16")],ft.prototype,"metricDataFormat",2),mt([y("uint16")],ft.prototype,"numOfLongHorMetrics",2),ft=mt([ct("hhea")],ft);var gn=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Pi=(s,t,e)=>t in s?gn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ti=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ci(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&gn(t,e,n),n},_i=(s,t,e)=>(Pi(s,t+"",e),e);let pr=class extends ut{constructor(){super(...arguments),_i(this,"_metrics")}static from(s){const t=s.length*4,e=new pr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:s}).map((n,o)=>(o<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};pr=Ti([ct("hmtx")],pr);var Ii=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,Ai=(s,t,e,r)=>{for(var n=r>1?void 0:r?Di(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Ii(t,e,n),n};let yn=class extends ut{};yn=Ai([ct("kern","kern")],yn);var mn=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,Ni=(s,t,e)=>t in s?mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,zi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Oi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&mn(t,e,n),n},Ui=(s,t,e)=>(Ni(s,t+"",e),e);let dr=class extends ut{constructor(){super(...arguments),Ui(this,"_locations")}static from(s,t=1){const e=s.length*(t?4:2),r=new dr(new ArrayBuffer(e));return s.forEach(n=>{t?r.view.writeUint32(n):r.view.writeUint16(n/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:s}).map(()=>t?e.readUint32():e.readUint16()*2)}};dr=zi([ct("loca")],dr);var Li=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ei(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Li(t,e,n),n};let it=class extends ut{constructor(s=new ArrayBuffer(32),t){super(s,t,Math.min(32,s.byteLength-(t??0)))}};pt([y("fixed")],it.prototype,"version",2),pt([y("uint16")],it.prototype,"numGlyphs",2),pt([y("uint16")],it.prototype,"maxPoints",2),pt([y("uint16")],it.prototype,"maxContours",2),pt([y("uint16")],it.prototype,"maxComponentPoints",2),pt([y("uint16")],it.prototype,"maxComponentContours",2),pt([y("uint16")],it.prototype,"maxZones",2),pt([y("uint16")],it.prototype,"maxTwilightPoints",2),pt([y("uint16")],it.prototype,"maxStorage",2),pt([y("uint16")],it.prototype,"maxFunctionDefs",2),pt([y("uint16")],it.prototype,"maxInstructionDefs",2),pt([y("uint16")],it.prototype,"maxStackElements",2),pt([y("uint16")],it.prototype,"maxSizeOfInstructions",2),pt([y("uint16")],it.prototype,"maxComponentElements",2),pt([y("uint16")],it.prototype,"maxComponentDepth",2),it=pt([ct("maxp")],it);var wn=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,ki=(s,t,e)=>t in s?wn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fe=(s,t,e,r)=>{for(var n=r>1?void 0:r?$i(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&wn(t,e,n),n},Bi=(s,t,e)=>(ki(s,t+"",e),e);const xn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},gr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},ji={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},vn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let xe=class extends ut{constructor(){super(...arguments),Bi(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const s=this.count;this.view.seek(6);const t=[];for(let a=0;a<s;++a)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const e=this.stringOffset;for(let a=0;a<s;++a){const h=t[a];h.name=this.view.readBytes(e+h.offset,h.length)}let r=gr.Macintosh,n=ji.Default,o=0;t.some(a=>a.platform===gr.Microsoft&&a.encoding===vn.UCS2&&a.language===1033)&&(r=gr.Microsoft,n=vn.UCS2,o=1033);const i={};for(let a=0;a<s;++a){const h=t[a];h.platform===r&&h.encoding===n&&h.language===o&&xn[h.nameId]&&(i[xn[h.nameId]]=o===0?As(h.name):Os(h.name))}return i}};Fe([y("uint16")],xe.prototype,"format",2),Fe([y("uint16")],xe.prototype,"count",2),Fe([y("uint16")],xe.prototype,"stringOffset",2),xe=Fe([ct("name")],xe);var Fi=Object.defineProperty,Gi=Object.getOwnPropertyDescriptor,I=(s,t,e,r)=>{for(var n=r>1?void 0:r?Gi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Fi(t,e,n),n};let _=class extends ut{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};I([y("uint16")],_.prototype,"version",2),I([y("int16")],_.prototype,"xAvgCharWidth",2),I([y("uint16")],_.prototype,"usWeightClass",2),I([y("uint16")],_.prototype,"usWidthClass",2),I([y("uint16")],_.prototype,"fsType",2),I([y("uint16")],_.prototype,"ySubscriptXSize",2),I([y("uint16")],_.prototype,"ySubscriptYSize",2),I([y("uint16")],_.prototype,"ySubscriptXOffset",2),I([y("uint16")],_.prototype,"ySubscriptYOffset",2),I([y("uint16")],_.prototype,"ySuperscriptXSize",2),I([y("uint16")],_.prototype,"ySuperscriptYSize",2),I([y("uint16")],_.prototype,"ySuperscriptXOffset",2),I([y("uint16")],_.prototype,"ySuperscriptYOffset",2),I([y("uint16")],_.prototype,"yStrikeoutSize",2),I([y("uint16")],_.prototype,"yStrikeoutPosition",2),I([y("uint16")],_.prototype,"sFamilyClass",2),I([y({type:"uint8"})],_.prototype,"bFamilyType",2),I([y({type:"uint8"})],_.prototype,"bSerifStyle",2),I([y({type:"uint8"})],_.prototype,"bWeight",2),I([y({type:"uint8"})],_.prototype,"bProportion",2),I([y({type:"uint8"})],_.prototype,"bContrast",2),I([y({type:"uint8"})],_.prototype,"bStrokeVariation",2),I([y({type:"uint8"})],_.prototype,"bArmStyle",2),I([y({type:"uint8"})],_.prototype,"bLetterform",2),I([y({type:"uint8"})],_.prototype,"bMidline",2),I([y({type:"uint8"})],_.prototype,"bXHeight",2),I([y({type:"uint8",size:16})],_.prototype,"ulUnicodeRange",2),I([y({type:"char",size:4})],_.prototype,"achVendID",2),I([y("uint16")],_.prototype,"fsSelection",2),I([y("uint16")],_.prototype,"usFirstCharIndex",2),I([y("uint16")],_.prototype,"usLastCharIndex",2),I([y("int16")],_.prototype,"sTypoAscender",2),I([y("int16")],_.prototype,"sTypoDescender",2),I([y("int16")],_.prototype,"sTypoLineGap",2),I([y("uint16")],_.prototype,"usWinAscent",2),I([y("uint16")],_.prototype,"usWinDescent",2),I([y({offset:72,type:"uint8",size:8})],_.prototype,"ulCodePageRange",2),I([y({offset:72,type:"int16"})],_.prototype,"sxHeight",2),I([y("int16")],_.prototype,"sCapHeight",2),I([y("uint16")],_.prototype,"usDefaultChar",2),I([y("uint16")],_.prototype,"usBreakChar",2),I([y("uint16")],_.prototype,"usMaxContext",2),_=I([ct("OS/2","os2")],_);var qi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,zt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ri(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&qi(t,e,n),n};let Dt=class extends ut{constructor(s=new ArrayBuffer(32),t,e){super(s,t,e)}};zt([y("fixed")],Dt.prototype,"format",2),zt([y("fixed")],Dt.prototype,"italicAngle",2),zt([y("int16")],Dt.prototype,"underlinePosition",2),zt([y("int16")],Dt.prototype,"underlineThickness",2),zt([y("uint32")],Dt.prototype,"isFixedPitch",2),zt([y("uint32")],Dt.prototype,"minMemType42",2),zt([y("uint32")],Dt.prototype,"maxMemType42",2),zt([y("uint32")],Dt.prototype,"minMemType1",2),zt([y("uint32")],Dt.prototype,"maxMemType1",2),Dt=zt([ct("post")],Dt);var Vi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,wt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Wi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Vi(t,e,n),n};let dt=class extends ut{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};wt([y("fixed")],dt.prototype,"version",2),wt([y("int16")],dt.prototype,"vertTypoAscender",2),wt([y("int16")],dt.prototype,"vertTypoDescender",2),wt([y("int16")],dt.prototype,"vertTypoLineGap",2),wt([y("int16")],dt.prototype,"advanceHeightMax",2),wt([y("int16")],dt.prototype,"minTopSideBearing",2),wt([y("int16")],dt.prototype,"minBottomSideBearing",2),wt([y("int16")],dt.prototype,"yMaxExtent",2),wt([y("int16")],dt.prototype,"caretSlopeRise",2),wt([y("int16")],dt.prototype,"caretSlopeRun",2),wt([y("int16")],dt.prototype,"caretOffset",2),wt([y({type:"int16",size:4})],dt.prototype,"reserved",2),wt([y("int16")],dt.prototype,"metricDataFormat",2),wt([y("int16")],dt.prototype,"numOfLongVerMetrics",2),dt=wt([ct("vhea")],dt);var bn=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,Xi=(s,t,e)=>t in s?bn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Yi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Qi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&bn(t,e,n),n},Hi=(s,t,e)=>(Xi(s,t+"",e),e);let yr=class extends ut{constructor(){super(...arguments),Hi(this,"_metrics")}static from(s){const t=s.length*4,e=new yr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var n;const s=this._sfnt.maxp.numGlyphs,t=((n=this._sfnt.vhea)==null?void 0:n.numOfLongVerMetrics)??0,e=this.view;e.seek(0);let r=0;return Array.from({length:s}).map((o,i)=>(i<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};yr=Yi([ct("vmtx")],yr);var Mn=Object.defineProperty,Zi=(s,t,e)=>t in s?Mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ve=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Mn(t,e,n),n},Ge=(s,t,e)=>(Zi(s,typeof t!="symbol"?t+"":t,e),e);class At extends sr{constructor(){super(...arguments),Ge(this,"format","TrueType"),Ge(this,"mimeType","font/ttf"),Ge(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(Kt(t).getUint32(0))}static checksum(t){const e=Kt(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let o=0,i=r/4;o<i;o+=4)o*4<r-4&&(n+=e.getUint32(o*4,!1));return n&4294967295}static from(t){const e=c=>c+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((c,p)=>c+e(p.byteLength),0),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const i=Math.log(2);o.searchRange=Math.floor(Math.log(r)/i)*16,o.entrySelector=Math.floor(o.searchRange/i),o.rangeShift=r*16-o.searchRange;let a=12+r*16,h=0;const l=o.getDirectories();t.tableViews.forEach((c,p)=>{const g=l[h++];g.tag=p,g.checkSum=this.checksum(c),g.offset=a,g.length=c.byteLength,o.view.writeBytes(c,a),a+=e(g.length)});const u=o.createSfnt().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new fe(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new $e(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Ge(At,"signature",new Set([65536,1953658213,1954115633])),ve([y("uint32")],At.prototype,"scalerType"),ve([y("uint16")],At.prototype,"numTables"),ve([y("uint16")],At.prototype,"searchRange"),ve([y("uint16")],At.prototype,"entrySelector"),ve([y("uint16")],At.prototype,"rangeShift");var Ki=Object.defineProperty,Ji=(s,t,e)=>t in s?Ki(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mr=(s,t,e)=>(Ji(s,typeof t!="symbol"?t+"":t,e),e);class qe extends At{constructor(){super(...arguments),mr(this,"format","OpenType"),mr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}mr(qe,"signature",new Set([1330926671]));var to=Object.defineProperty,be=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&to(t,e,n),n};class re extends Ct{constructor(t,e){super(t,e,20)}}be([y({type:"char",size:4})],re.prototype,"tag"),be([y("uint32")],re.prototype,"offset"),be([y("uint32")],re.prototype,"compLength"),be([y("uint32")],re.prototype,"origLength"),be([y("uint32")],re.prototype,"origChecksum");var Sn=Object.defineProperty,eo=(s,t,e)=>t in s?Sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,St=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Sn(t,e,n),n},Re=(s,t,e)=>(eo(s,typeof t!="symbol"?t+"":t,e),e);const xt=class Or extends sr{constructor(){super(...arguments),Re(this,"format","WOFF"),Re(this,"mimeType","font/woff"),Re(this,"_sfnt")}get subfontFormat(){return At.is(this.flavor)?"TrueType":qe.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(Kt(t).getUint32(0))}static checkSum(t){const e=Kt(t),r=e.byteLength,n=Math.floor(r/4);let o=0,i=0;for(;i<n;)o+=e.getUint32(4*i++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)o+=e.getUint8(h)<<a*8,h++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=c=>c+3&-4,n=[];t.tableViews.forEach((c,p)=>{const g=Kt(ws(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:p,view:g.byteLength<c.byteLength?g:c,rawView:c})});const o=n.length,i=n.reduce((c,p)=>c+r(p.view.byteLength),0),a=new Or(new ArrayBuffer(44+20*o+i+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((c,p)=>c+r(p.rawView.byteLength),0);let h=44+o*20,l=0;const u=a.getDirectories();return n.forEach(c=>{const p=u[l++];p.tag=c.tag,p.offset=h,p.compLength=c.view.byteLength,p.origChecksum=Or.checkSum(c.rawView),p.origLength=c.rawView.byteLength,a.view.writeBytes(c.view,h),h+=r(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new re(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new $e(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,i=e.origLength,a=n+o;return t[r]=o>=i?new DataView(this.view.buffer,n,o):new DataView(xs(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Re(xt,"signature",new Set([2001684038])),St([y("uint32")],xt.prototype,"signature"),St([y("uint32")],xt.prototype,"flavor"),St([y("uint32")],xt.prototype,"length"),St([y("uint16")],xt.prototype,"numTables"),St([y("uint16")],xt.prototype,"reserved"),St([y("uint32")],xt.prototype,"totalSfntSize"),St([y("uint16")],xt.prototype,"majorVersion"),St([y("uint16")],xt.prototype,"minorVersion"),St([y("uint32")],xt.prototype,"metaOffset"),St([y("uint32")],xt.prototype,"metaLength"),St([y("uint32")],xt.prototype,"metaOrigLength"),St([y("uint32")],xt.prototype,"privOffset"),St([y("uint32")],xt.prototype,"privLength");let wr=xt;function ro(s,t=!0){if(At.is(s))return new At(s);if(qe.is(s))return new qe(s);if(wr.is(s))return new wr(s);if(t)throw new Error("Failed to parseFont")}var no=Object.defineProperty,so=(s,t,e)=>t in s?no(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Me=(s,t,e)=>(so(s,typeof t!="symbol"?t+"":t,e),e);const Cn=class ss{constructor(){Me(this,"fallbackFont"),Me(this,"loading",new Map),Me(this,"loaded",new Map),Me(this,"familyToUrl",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...ss.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
2
2
  font-family: "${t}";
3
3
  src: url(${e});
4
- }`)),document.head.appendChild(r),this}get(t){let e;return t&&(e=this.loaded.get(this.familyToUrl.get(t)??t)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){const e=this.familyToUrl.get(t)??t;return this.familyToUrl.delete(e),this.loaded.delete(e),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...i}=e,{src:a}=t;if(this.loaded.has(a))return r&&(this.loading.forEach(p=>p.cancel()),this.loading.clear()),u(this.loaded.get(a));let h=this.loading.get(a);return h||(h=this._createRequest(a,i),this.loading.set(a,h)),r&&this.loading.forEach((p,g)=>{p!==h&&(p.cancel(),this.loading.delete(g))}),h.when.then(p=>{if(this.loaded.has(a))return u(this.loaded.get(a));{const g=c(p);return e.noAdd||this.loaded.set(t.src,g),g.familySet.forEach(d=>{this.familyToUrl.set(d,a),typeof document<"u"&&(n&&this.injectFontFace(d,p),o&&this.injectStyleTag(d,a))}),g}}).catch(p=>{if(p instanceof DOMException&&p.message==="The user aborted a request.")return c();throw p}).finally(()=>{this.loading.delete(a)});function l(){return t.family?Array.isArray(t.family)?t.family:[t.family]:[]}function u(p){return l().forEach(g=>{p.familySet.add(g)}),p}function c(p=new ArrayBuffer(0)){let g;function d(){return g||(g=p.byteLength?ro(p,!1):void 0),g}function m(){const f=d();if(f instanceof At||f instanceof wr)return f.sfnt}return{...t,buffer:p,familySet:new Set(l()),getFont:d,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}};Me(Cn,"defaultRequestInit",{cache:"force-cache"});let io=Cn;const oo=new io,ao={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Pn(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:h=[],strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:c=0,shadowBlur:p=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=o,s.lineJoin=ao[i],s.miterLimit=a,s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=u,s.shadowOffsetY=c,s.shadowBlur=p,s.shadowColor=g}class v{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new v(1/0,1/0)}static get MIN(){return new v(-1/0,-1/0)}get array(){return[this.x,this.y]}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,o=-(this.y-e.y),i=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*i),e.y-(n*i+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,o=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new v(this.x,this.y)}}class E{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new v((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new E;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 E(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new E(this.left,this.top,this.width,this.height)}}var lo=Object.defineProperty,ho=(s,t,e)=>t in s?lo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,co=(s,t,e)=>(ho(s,t+"",e),e);class vt{constructor(t=1,e=0,r=0,n=0,o=1,i=0,a=0,h=0,l=1){co(this,"elements",[]),this.set(t,e,r,n,o,i,a,h,l)}set(t,e,r,n,o,i,a,h,l){const u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=o,u[5]=h,u[6]=r,u[7]=i,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,o=this.elements,i=r[0],a=r[3],h=r[6],l=r[1],u=r[4],c=r[7],p=r[2],g=r[5],d=r[8],m=n[0],f=n[3],b=n[6],P=n[1],M=n[4],T=n[7],w=n[2],x=n[5],A=n[8];return o[0]=i*m+a*P+h*w,o[3]=i*f+a*M+h*x,o[6]=i*b+a*T+h*A,o[1]=l*m+u*P+c*w,o[4]=l*f+u*M+c*x,o[7]=l*b+u*T+c*A,o[2]=p*m+g*P+d*w,o[5]=p*f+g*M+d*x,o[8]=p*b+g*T+d*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],h=t[6],l=t[7],u=t[8],c=u*i-a*l,p=a*h-u*o,g=l*o-i*h,d=e*c+r*p+n*g;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=c*m,t[1]=(n*l-u*r)*m,t[2]=(a*r-n*i)*m,t[3]=p*m,t[4]=(u*e-n*h)*m,t[5]=(n*o-a*e)*m,t[6]=g*m,t[7]=(r*h-l*e)*m,t[8]=(i*e-r*o)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(xr.makeScale(t,e)),this}rotate(t){return this.premultiply(xr.makeRotation(-t)),this}translate(t,e){return this.premultiply(xr.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 xr=new vt;function Tn(s,t,e,r){const n=s*e+t*r,o=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let i=Math.acos(Math.max(-1,Math.min(1,n/o)));return s*r-t*e<0&&(i=-i),i}function uo(s,t,e,r,n,o,i,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(i.x-a.x)/2,l=(i.y-a.y)/2,u=Math.cos(r)*h+Math.sin(r)*l,c=-Math.sin(r)*h+Math.cos(r)*l;let p=t*t,g=e*e;const d=u*u,m=c*c,f=d/p+m/g;if(f>1){const L=Math.sqrt(f);t=L*t,e=L*e,p=t*t,g=e*e}const b=p*m+g*d,P=(p*g-b)/b;let M=Math.sqrt(Math.max(0,P));n===o&&(M=-M);const T=M*t*c/e,w=-M*e*u/t,x=Math.cos(r)*T-Math.sin(r)*w+(i.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*w+(i.y+a.y)/2,S=Tn(1,0,(u-T)/t,(c-w)/e),C=Tn((u-T)/t,(c-w)/e,(-u-T)/t,(-c-w)/e)%(Math.PI*2);s.ellipse(x,A,t,e,r,S,S+C,o===1)}function ne(s,t){return s-(t-s)}function _n(s,t){const e=new v,r=new v;for(let n=0,o=s.length;n<o;n++){const i=s[n];if(i.type==="m"||i.type==="M")i.type==="m"?e.add(i):e.copy(i),t.moveTo(e.x,e.y),r.copy(e);else if(i.type==="h"||i.type==="H")i.type==="h"?e.x+=i.x:e.x=i.x,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="v"||i.type==="V")i.type==="v"?e.y+=i.y:e.y=i.y,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="l"||i.type==="L")i.type==="l"?e.add(i):e.copy(i),t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="c"||i.type==="C")i.type==="c"?(t.bezierCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(t.bezierCurveTo(ne(e.x,r.x),ne(e.y,r.y),e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(ne(e.x,r.x),ne(e.y,r.y),i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(t.quadraticCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x,e.y+i.y),r.x=e.x+i.x1,r.y=e.y+i.y1,e.add(i)):(t.quadraticCurveTo(i.x1,i.y1,i.x,i.y),r.x=i.x1,r.y=i.y1,e.copy(i));else if(i.type==="t"||i.type==="T"){const a=ne(e.x,r.x),h=ne(e.y,r.y);r.x=a,r.y=h,i.type==="t"?(t.quadraticCurveTo(a,h,e.x+i.x,e.y+i.y),e.add(i)):(t.quadraticCurveTo(a,h,i.x,i.y),e.copy(i))}else if(i.type==="a"||i.type==="A"){const a=e.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;e.add(i)}else{if(e.equals(i))continue;e.copy(i)}r.copy(e),uo(t,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,e)}else i.type==="z"||i.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",i)}}const K={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(s,t,e=0){let a=0,h=!0,l="",u="";const c=[];function p(f,b,P){const M=new SyntaxError(`Unexpected character "${f}" at index ${b}.`);throw M.partial=P,M}function g(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let d;const m=s.length;for(let f=0;f<m;f++){if(d=s[f],Array.isArray(t)&&t.includes(c.length%e)&&K.FLAGS.test(d)){a=1,l=d,g();continue}if(a===0){if(K.WHITESPACE.test(d))continue;if(K.DIGIT.test(d)||K.SIGN.test(d)){a=1,l=d;continue}if(K.POINT.test(d)){a=2,l=d;continue}K.COMMA.test(d)&&(h&&p(d,f,c),h=!0)}if(a===1){if(K.DIGIT.test(d)){l+=d;continue}if(K.POINT.test(d)){l+=d,a=2;continue}if(K.EXP.test(d)){a=3;continue}K.SIGN.test(d)&&l.length===1&&K.SIGN.test(l[0])&&p(d,f,c)}if(a===2){if(K.DIGIT.test(d)){l+=d;continue}if(K.EXP.test(d)){a=3;continue}K.POINT.test(d)&&l[l.length-1]==="."&&p(d,f,c)}if(a===3){if(K.DIGIT.test(d)){u+=d;continue}if(K.SIGN.test(d)){if(u===""){u+=d;continue}u.length===1&&K.SIGN.test(u)&&p(d,f,c)}}K.WHITESPACE.test(d)?(g(),a=0,h=!1):K.COMMA.test(d)?(g(),a=0,h=!0):K.SIGN.test(d)?(g(),a=1,l=d):K.POINT.test(d)?(g(),a=2,l=d):p(d,f,c)}return g(),c}function fo(s){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=s.length;n<o;n++){const i=s[n];switch(i.type){case"m":case"M":if(i.x===e.x&&i.y===e.y)continue;r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y,t.x=i.x,t.y=i.y;break;case"h":case"H":r+=`${i.type} ${i.x}`,e.x=i.x;break;case"v":case"V":r+=`${i.type} ${i.y}`,e.y=i.y;break;case"l":case"L":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"c":case"C":r+=`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"s":case"S":r+=`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"q":case"Q":r+=`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"t":case"T":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"a":case"A":r+=`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"z":case"Z":r+=i.type,e.x=t.x,e.y=t.y;break}}return r}const po=/[a-df-z][^a-df-z]*/gi;function In(s){const t=[],e=s.match(po);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],i=o.charAt(0),a=o.slice(1).trim();let h;switch(i){case"m":case"M":h=Ut(a);for(let l=0,u=h.length;l<u;l+=2)l===0?t.push({type:i,x:h[l],y:h[l+1]}):t.push({type:i==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Ut(a);for(let l=0,u=h.length;l<u;l++)t.push({type:i,x:h[l]});break;case"v":case"V":h=Ut(a);for(let l=0,u=h.length;l<u;l++)t.push({type:i,y:h[l]});break;case"l":case"L":h=Ut(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:i,x:h[l],y:h[l+1]});break;case"c":case"C":h=Ut(a);for(let l=0,u=h.length;l<u;l+=6)t.push({type:i,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Ut(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:i,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Ut(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:i,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Ut(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:i,x:h[l],y:h[l+1]});break;case"a":case"A":h=Ut(a,[3,4],7);for(let l=0,u=h.length;l<u;l+=7)t.push({type:i,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:i});break;default:console.warn(o)}}return t}var go=Object.defineProperty,yo=(s,t,e)=>t in s?go(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vr=(s,t,e)=>(yo(s,typeof t!="symbol"?t+"":t,e),e);class Yt{constructor(){vr(this,"arcLengthDivisions",200),vr(this,"_cacheArcLengths"),vr(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 v){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),o=0;e.push(0);for(let i=1;i<=t;i++)r=this.getPoint(i/t),o+=r.distanceTo(n),e.push(o),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const o=r.length;let i;e?i=e:i=t*r[o-1];let a=0,h=o-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-i,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===i)return n/(o-1);const u=r[n],p=r[n+1]-u,g=(i-u)/p;return(n+g)/(o-1)}getTangent(t,e=new v){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 v){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,o=(r+n)/2;for(;n-r>e;){o=(r+n)/2;const i=this.getPoint(o);if(i.distanceTo(t)<e)return o;i.x<t.x?r=o:n=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=v.MAX,e=v.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(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 fo(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Dn(s,t,e,r,n){const o=(r-t)*.5,i=(n-e)*.5,a=s*s,h=s*a;return(2*e-2*r+o+i)*h+(-3*e+3*r-2*o-i)*a+o*s+e}function mo(s,t){const e=1-s;return e*e*t}function wo(s,t){return 2*(1-s)*s*t}function xo(s,t){return s*s*t}function An(s,t,e,r){return mo(s,t)+wo(s,e)+xo(s,r)}function vo(s,t){const e=1-s;return e*e*e*t}function bo(s,t){const e=1-s;return 3*e*e*s*t}function Mo(s,t){return 3*(1-s)*s*s*t}function So(s,t){return s*s*s*t}function On(s,t,e,r,n){return vo(s,t)+bo(s,e)+Mo(s,r)+So(s,n)}class Co extends Yt{constructor(t=new v,e=new v,r=new v,n=new v){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new v){const{start:r,startControl:n,endControl:o,end:i}=this;return e.set(On(t,r.x,n.x,o.x,i.x),On(t,r.y,n.y,o.y,i.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const o=Math.sqrt(n),i=(-e+o)/(2*t),a=(-e-o)/(2*t);return[i,a].filter(h=>h>=0&&h<=1)}getMinMax(t=v.MAX,e=v.MIN){const r=this.start,n=this.startControl,o=this.endControl,i=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(i.x-o.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(i.y-o.y)),l=[0,1,...a,...h];return((c,p)=>{for(const g of c)for(let d=0;d<=p;d++){const m=d/p-.5,f=Math.min(1,Math.max(0,g+m)),b=this.getPoint(f);t.x=Math.min(t.x,b.x),t.y=Math.min(t.y,b.y),e.x=Math.max(e.x,b.x),e.y=Math.max(e.y,b.y)}})(l,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 Po=new vt,Nn=new vt,zn=new vt,Ve=new v;class To extends Yt{constructor(t=new v,e=1,r=1,n=0,o=0,i=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=i,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new v){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(o?n=0:n=r),this.clockwise&&!o&&(n===r?n=-r:n=n-r);const i=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(i),h=this.center.y+this.radiusY*Math.sin(i);if(this.rotation!==0){const l=Math.cos(this.rotation),u=Math.sin(this.rotation),c=a-this.center.x,p=h-this.center.y;a=c*l-p*u+this.center.x,h=c*u+p*l+this.center.y}return e.set(a,h)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:i,rotation:a}=this,{x:h,y:l}=t,u=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),c=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),p=Math.abs(n-o),g=p>Math.PI?1:0,d=i?1:0,m=a*180/Math.PI;if(p>=2*Math.PI){const f=n+Math.PI,b=h+e*Math.cos(f)*Math.cos(a)-r*Math.sin(f)*Math.sin(a),P=l+e*Math.cos(f)*Math.sin(a)+r*Math.sin(f)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:d,x:b,y:P},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:d,x:u,y:c}]}else{const f=h+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),b=l+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:g,sweepFlag:d,x:f,y:b}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:i,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,o,i,a,!h),this}matrix(t){return Ve.set(this.center.x,this.center.y),Ve.applyMatrix3(t),this.center.x=Ve.x,this.center.y=Ve.y,Do(t)?_o(this,t):Io(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=v.MAX,e=v.MIN){const{center:r,radiusX:n,radiusY:o,rotation:i}=this,{x:a,y:h}=r,l=Math.cos(i),u=Math.sin(i),c=Math.sqrt(n*n*l*l+o*o*u*u),p=Math.sqrt(n*n*u*u+o*o*l*l);return t.x=Math.min(t.x,a-c),t.y=Math.min(t.y,h-p),e.x=Math.max(e.x,a+c),e.y=Math.max(e.y,h+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 _o(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),o=Math.sin(s.rotation),i=new v(e*n,e*o),a=new v(-r*o,r*n),h=i.applyMatrix3(t),l=a.applyMatrix3(t),u=Po.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=Nn.copy(u).invert(),d=zn.copy(c).transpose().multiply(c).elements,m=Ao(d[0],d[1],d[4]),f=Math.sqrt(m.rt1),b=Math.sqrt(m.rt2);if(s.radiusX=1/f,s.radiusY=1/b,s.rotation=Math.atan2(m.sn,m.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const M=Nn.set(f,0,0,0,b,0,0,0,1),T=zn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=M.multiply(T).multiply(u),x=A=>{const{x:S,y:C}=new v(Math.cos(A),Math.sin(A)).applyMatrix3(w);return Math.atan2(C,S)};s.startAngle=x(s.startAngle),s.endAngle=x(s.endAngle),Un(t)&&(s.clockwise=!s.clockwise)}}function Io(s,t){const e=Ln(t),r=En(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,Un(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function Un(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Do(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Ln(s),n=En(s);return Math.abs(e/(r*n))>Number.EPSILON}function Ln(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function En(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Ao(s,t,e){let r,n,o,i,a;const h=s+e,l=s-e,u=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+u),a=1/r,n=s*a*e-t*a*t):h<0?n=.5*(h-u):(r=.5*u,n=-.5*u),l>0?o=l+u:o=l-u,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,i=1/Math.sqrt(1+a*a),o=a*i):Math.abs(t)===0?(o=1,i=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),i=a*o),l>0&&(a=o,o=-i,i=a),{rt1:r,rt2:n,cs:o,sn:i}}class br extends Yt{constructor(t=new v,e=new v){super(),this.start=t,this.end=e}getPoint(t,e=new v){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new v){return this.getPoint(t,e)}getTangent(t,e=new v){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new v){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class Oo extends Yt{constructor(t=new v,e=new v,r=new v){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new v){const{start:r,control:n,end:o}=this;return e.set(An(t,r.x,n.x,o.x),An(t,r.y,n.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,control:n,end:o}=this,i=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+o.x),l=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,i,h),t.y=Math.min(t.y,r.y,o.y,a,l),e.x=Math.max(e.x,r.x,o.x,i,h),e.y=Math.max(e.y,r.y,o.y,a,l),{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 No=Object.defineProperty,zo=(s,t,e)=>t in s?No(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,$n=(s,t,e)=>(zo(s,typeof t!="symbol"?t+"":t,e),e);class Uo extends Yt{constructor(t,e,r=1,n=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=o,$n(this,"curves",[]),$n(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 v(t-r,e-n),new v(t+r,e-n),new v(t+r,e+n),new v(t-r,e+n)];for(let i=0;i<4;i++)this.curves.push(new br(o[i].clone(),o[(i+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=v.MAX,e=v.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 Lo extends Yt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new v){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),i=n-o,a=r[o===0?o:o-1],h=r[o],l=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return e.set(Dn(i,a.x,h.x,l.x,u.x),Dn(i,a.y,h.y,l.y,u.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 Eo=Object.defineProperty,$o=(s,t,e)=>t in s?Eo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Se=(s,t,e)=>($o(s,typeof t!="symbol"?t+"":t,e),e);class Ce extends Yt{constructor(t){super(),Se(this,"curves",[]),Se(this,"startPoint"),Se(this,"currentPoint",new v),Se(this,"autoClose",!1),Se(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 _n(t,this),this}addData(t){return this.addCommands(In(t)),this}getPoint(t,e=new v){const r=t*this.getLength(),n=this.getCurveLengths();let o=0;for(;o<n.length;){if(n[o]>=r){const i=n[o]-r,a=this.curves[o],h=a.getLength();return a.getPointAt(h===0?0:1-i/h,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let o=0,i=r.length;o<i;o++){const h=r[o].getPoints(t);for(let l=0;l<h.length;l++){const u=h[l];n!=null&&n.equals(u)||(e.push(u),n=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new br(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 br(this.currentPoint.clone(),new v(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPoint.equals({x:o,y:i})||this.curves.push(new Co(this.currentPoint.clone(),new v(t,e),new v(r,n),new v(o,i))),this._setCurrentPoint({x:o,y:i}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new Oo(this.currentPoint.clone(),new v(t,e),new v(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,i){return this.ellipse(t,e,r,r,0,n,o,i),this}relativeArc(t,e,r,n,o,i){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,i),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,i,a,h=!0){const l=new To(new v(t,e),r,n,o,i,a,!h);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,o,i,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,o,i,a,h),this}rect(t,e,r,n){return this.curves.push(new Uo(new v(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Lo([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}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(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Bo(s,t,e,r){const n=t.clone().sub(s),o=r.clone().sub(e),i=e.clone().sub(s),a=n.cross(o);if(a===0)return new v((s.x+e.x)/2,(s.y+e.y)/2);const h=i.cross(o)/a;return Math.abs(h)>1?new v((s.x+e.x)/2,(s.y+e.y)/2):new v(s.x+h*n.x,s.y+h*n.y)}var jo=Object.defineProperty,Fo=(s,t,e)=>t in s?jo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Mr=(s,t,e)=>(Fo(s,typeof t!="symbol"?t+"":t,e),e);class Pt{constructor(t){Mr(this,"currentPath",new Ce),Mr(this,"paths",[this.currentPath]),Mr(this,"style",{}),t&&(t instanceof Pt?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 Pt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new Ce().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 Ce().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPath.bezierCurveTo(t,e,r,n,o,i),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,i){return this.currentPath.arc(t,e,r,n,o,i),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,i,a,h){return this.currentPath.ellipse(t,e,r,n,o,i,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return _n(t,this),this}addData(t){return this.addCommands(In(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,h)=>{const l=a.getControlPoints(),u=a.isClockwise();o[h]=l,n[h]=u;const c=l[0],p=l[l.length-1]??c;r.push({start:u?p:c,end:u?c:p,index:h})});const i=[];return r.forEach((a,h)=>{i[h]=[],r.forEach((l,u)=>{u!==h&&l.start.equals(a.end)&&i[h].push(l.index)})}),e.forEach((a,h)=>{const l=n[h];o[h].forEach(c=>{const p=a.getTForPoint(c),g=a.getNormal(p).scale(l?t:-t);c.add(g)})}),i.forEach((a,h)=>{const l=o[h];a.forEach(u=>{const c=o[u],p=Bo(l[l.length-1],l[l.length-2]??l[l.length-1],c[0],c[1]??c[0]);p&&(l[l.length-1].copy(p),c[0].copy(p))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=v.MAX,e=v.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(o=>{if(o.getMinMax(t,e),r&&n>1){const i=n/2,a=o.isClockwise(),h=[];for(let l=0;l<=1;l+=1/o.arcLengthDivisions){const u=o.getPoint(l),c=o.getNormal(l),p=c.clone().scale(a?i:-i),g=c.clone().scale(a?-i:i);h.push(u.clone().add(p),u.clone().add(g),u.clone().add({x:i,y:0}),u.clone().add({x:-i,y:0}),u.clone().add({x:0,y:i}),u.clone().add({x:0,y:-i}),u.clone().add({x:i,y:i}),u.clone().add({x:-i,y:-i}))}t.min(...h),e.max(...h)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new E(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(),Pn(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(),Pn(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:i,height:a}=this.getBoundingBox(),h=document.createElement("canvas");h.width=i*e,h.height=a*e,h.style.width=`${i}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-o),this.drawTo(l,r)),h}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 Sr="px",kn=90,Bn=["mm","cm","in","pt","pc","px"],Cr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function $(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Bn.length;r<n;r++){const o=Bn[r];if(s.endsWith(o)){t=o,s=s.substring(0,s.length-o.length);break}}let e;return t==="px"&&Sr!=="px"?e=Cr.in[Sr]/kn:(e=Cr[t][Sr],e<0&&(e=Cr[t].in*kn)),e*Number.parseFloat(s)}const Go=new vt,We=new vt,jn=new vt,Fn=new vt;function qo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Ro(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ro(s){const t=new vt,e=Go;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate($(s.getAttribute("x")),$(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const i=o.indexOf("("),a=o.length;if(i>0&&i<a){const h=o.slice(0,i),l=Ut(o.slice(i+1));switch(e.identity(),h){case"translate":if(l.length>=1){const u=l[0];let c=0;l.length>=2&&(c=l[1]),e.translate(u,c)}break;case"rotate":if(l.length>=1){let u=0,c=0,p=0;u=l[0]*Math.PI/180,l.length>=3&&(c=l[1],p=l[2]),We.makeTranslation(-c,-p),jn.makeRotation(u),Fn.multiplyMatrices(jn,We),We.makeTranslation(c,p),e.multiplyMatrices(We,Fn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Vo(s){return new Pt().addPath(new Ce().arc($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("r")||0),0,Math.PI*2))}function Wo(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim()),o={};for(let i=r.style.length,a=0;a<i;a++){const h=r.style.item(a);o[h]=r.style.getPropertyValue(h)}for(let i=0;i<n.length;i++)t[n[i]]=Object.assign(t[n[i]]||{},{...o})}}function Qo(s){return new Pt().addPath(new Ce().ellipse($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("rx")||0),$(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Xo(s){return new Pt().moveTo($(s.getAttribute("x1")||0),$(s.getAttribute("y1")||0)).lineTo($(s.getAttribute("x2")||0),$(s.getAttribute("y2")||0))}function Yo(s){const t=new Pt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Ho=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Zo(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Ho,(n,o,i)=>{const a=$(o),h=$(i);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Ko=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jo(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Ko,(n,o,i)=>{const a=$(o),h=$(i);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ta(s){const t=$(s.getAttribute("x")||0),e=$(s.getAttribute("y")||0),r=$(s.getAttribute("rx")||s.getAttribute("ry")||0),n=$(s.getAttribute("ry")||s.getAttribute("rx")||0),o=$(s.getAttribute("width")),i=$(s.getAttribute("height")),a=1-.551915024494,h=new Pt;return h.moveTo(t+r,e),h.lineTo(t+o-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+o-r*a,e,t+o,e+n*a,t+o,e+n),h.lineTo(t+o,e+i-n),(r!==0||n!==0)&&h.bezierCurveTo(t+o,e+i-n*a,t+o-r*a,e+i,t+o-r,e+i),h.lineTo(t+r,e+i),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+i,t,e+i-n*a,t,e+i-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function Lt(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const l=s.getAttribute("class").split(/\s/).filter(Boolean).map(u=>u.trim());for(let u=0;u<l.length;u++)r=Object.assign(r,e[`.${l[u]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let l=s.style.length,u=0;u<l;u++){const c=s.style.item(u),p=s.style.getPropertyValue(c);t[c]=p,r[c]=p}function n(l,u,c=o){s.hasAttribute(l)&&(t[u]=c(s.getAttribute(l))),r[l]&&(t[u]=c(r[l]))}function o(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function i(l){return Math.max(0,Math.min(1,$(l)))}function a(l){return Math.max(0,$(l))}function h(l){return l.split(" ").filter(u=>u!=="").map(u=>$(u))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",h),n("stroke-dashoffset","strokeDashoffset",$),n("visibility","visibility"),t}function Pr(s,t,e=[],r={}){var c;if(s.nodeType!==1)return e;let n=!1,o=null,i={...t};switch(s.nodeName){case"svg":i=Lt(s,i,r);break;case"style":Wo(s,r);break;case"g":i=Lt(s,i,r);break;case"path":i=Lt(s,i,r),s.hasAttribute("d")&&(o=Yo(s));break;case"rect":i=Lt(s,i,r),o=ta(s);break;case"polygon":i=Lt(s,i,r),o=Zo(s);break;case"polyline":i=Lt(s,i,r),o=Jo(s);break;case"circle":i=Lt(s,i,r),o=Vo(s);break;case"ellipse":i=Lt(s,i,r),o=Qo(s);break;case"line":i=Lt(s,i,r),o=Xo(s);break;case"defs":n=!0;break;case"use":{i=Lt(s,i,r);const g=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=(c=s.viewportElement)==null?void 0:c.getElementById(g);d?Pr(d,i,e,r):console.warn(`'use node' references non-existent node id: ${g}`);break}default:console.warn(s);break}if(i.display==="none")return e;Object.assign(t,i);const a=new vt,h=[],l=qo(s,a,h);o&&(o.matrix(a),e.push(o),o.style=t);const u=s.childNodes;for(let p=0,g=u.length;p<g;p++){const d=u[p];n&&d.nodeName!=="style"&&d.nodeName!=="defs"||Pr(d,t,e,r)}return l&&(h.pop(),h.length>0?a.copy(h[h.length-1]):a.identity()),e}const Gn="data:image/svg+xml;",qn=`${Gn}base64,`,Rn=`${Gn}charset=utf8,`;function ea(s){if(typeof s=="string"){let t;return s.startsWith(qn)?(s=s.substring(qn.length,s.length),t=atob(s)):s.startsWith(Rn)?(s=s.substring(Rn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Vn(s){return Pr(ea(s),{})}function Qe(s,t=!0){if(!s.length)return;const e=v.MAX,r=v.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new E(e.x,e.y,r.x-e.x,r.y-e.y)}const ra=new Set(["©","®","÷"]),na=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),sa={1:"italic",32:"bold"},ia={1:"italic",2:"bold"},Wn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Qn{constructor(t,e,r){U(this,"lineBox",new E);U(this,"inlineBox",new E);U(this,"glyphBox");U(this,"underlinePosition",0);U(this,"underlineThickness",0);U(this,"yStrikeoutPosition",0);U(this,"yStrikeoutSize",0);U(this,"baseline",0);U(this,"centerDiviation",0);U(this,"path",new Pt);this.content=t,this.index=e,this.parent=r}get center(){var t;return(t=this.glyphBox)==null?void 0:t.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSfnt(t){var n,o;const e=this.computedStyle.fontFamily;let r;return e&&(r=((n=t==null?void 0:t.get(e))==null?void 0:n.getSfnt())??((o=oo.get(e))==null?void 0:o.getSfnt())),r}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:o,post:i}=t,{content:a,computedStyle:h}=this,{fontSize:l}=h,u=e/l,c=t.getAdvanceWidth(a,l),p=(r+Math.abs(n))/u,g=r/u,d=(r-o.yStrikeoutPosition)/u,m=o.yStrikeoutSize/u,f=(r-i.underlinePosition)/u,b=i.underlineThickness/u;return this.inlineBox.width=c,this.inlineBox.height=p,this.underlinePosition=f,this.underlineThickness=b,this.yStrikeoutPosition=d,this.yStrikeoutSize=m,this.baseline=g,this.centerDiviation=p/2-g,this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:n,computedStyle:o,baseline:i,inlineBox:a}=this,{os2:h,head:l,ascender:u,descender:c}=e,p=h.sTypoAscender,g=sa[h.fsSelection]??ia[l.macStyle],{left:d,top:m}=a,f=o.fontStyle==="italic"&&g!=="italic";let b=d,P=m+i,M;const T=new Pt;if(r&&(b+=(a.height-a.width)/2,Math.abs(a.width-a.height)>.1&&(P-=(u-p)/(u+Math.abs(c))*a.height),M=void 0),r&&!ra.has(n)&&(n.codePointAt(0)<=256||na.has(n))){T.addCommands(e.getPathCommands(n,b,m+i-(a.height-a.width)/2,o.fontSize)??[]);const x={y:m-(a.height-a.width)/2+a.height/2,x:b+a.width/2};f&&this._italic(T,r?{x:x.x,y:m-(a.height-a.width)/2+i}:void 0),T.rotate(90,x)}else M!==void 0?(T.addCommands(e.glyphs.get(M).getPathCommands(b,P,o.fontSize)),f&&this._italic(T,r?{x:b+a.width/2,y:m+p/(u+Math.abs(c))*a.height}:void 0)):(T.addCommands(e.getPathCommands(n,b,P,o.fontSize)??[]),f&&this._italic(T,r?{x:b+a.height/2,y:P}:void 0));T.addCommands(this._decoration());const w=o.fontWeight??400;return w in Wn&&(w===700||w==="bold")&&g!=="bold"&&T.bold(Wn[w]*o.fontSize*.05),T.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=T,this.glyphBox=this.getGlyphBoundingBox(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:o}=this.computedStyle,{left:i,top:a,width:h,height:l}=this.inlineBox,u=.1*o;let c;switch(n){case"underline":t?c=i:c=a+e;break;case"line-through":t?c=i+h/2:c=a+r;break;case"none":default:return[]}return t?[{type:"M",x:c,y:a},{type:"L",x:c,y:a+l},{type:"L",x:c+u,y:a+l},{type:"L",x:c+u,y:a},{type:"Z"}]:[{type:"M",x:i,y:c},{type:"L",x:i+h,y:c},{type:"L",x:i+h,y:c+u},{type:"L",x:i,y:c+u},{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 E(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){Te({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function se(s){return!s||s==="none"}function Xe(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}class Xn{constructor(t,e={},r){U(this,"inlineBox",new E);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,...Xe(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Qn(r,e++,this));return this.characters=t,this}}class ie{constructor(t,e){U(this,"lineBox",new E);U(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Xe(this.parentStyle),...Xe(this.style)},this}addFragment(t,e){const r=new Xn(t,e,this);return this.fragments.push(r),r}}function oa(s){return s}class Yn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(i=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(i.style)),i.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),/\s/.test(h.content)&&(l.style.whiteSpace="pre"),a.appendChild(l)}),o.appendChild(a)}),n.appendChild(o),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var i;return(i=n.parentNode)==null?void 0:i.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,i)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((h,l)=>{var p;const u=h.getBoundingClientRect();r.push({paragraphIndex:i,fragmentIndex:l,left:u.left,top:u.top,width:u.width,height:u.height});const c=h.firstChild;if(c instanceof window.Text){const g=document.createRange();g.selectNodeContents(c);const d=c.data?c.data.length:0;let m=0;for(;m<=d;){g.setStart(c,Math.max(m-1,0)),g.setEnd(c,m);const f=((p=g.getClientRects)==null?void 0:p.call(g))??[g.getBoundingClientRect()];let b=f[f.length-1];f.length>1&&b.width<2&&(b=f[f.length-2]);const P=g.toString();P!==""&&b&&b.width+b.height!==0&&n.push({content:P,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:l,characterIndex:m-1,top:b.top,left:b.left,height:b.height,width:b.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=this._measureDom(t);n.paragraphs.forEach(a=>{const h=e[a.paragraphIndex];h.lineBox.left=a.left-r.left,h.lineBox.top=a.top-r.top,h.lineBox.width=a.width,h.lineBox.height=a.height}),n.fragments.forEach(a=>{const h=e[a.paragraphIndex].fragments[a.fragmentIndex];h.inlineBox.left=a.left-r.left,h.inlineBox.top=a.top-r.top,h.inlineBox.width=a.width,h.inlineBox.height=a.height});const o=[];let i=0;return n.characters.forEach(a=>{const{paragraphIndex:h,fragmentIndex:l,characterIndex:u}=a;o.push({...a,newParagraphIndex:h,left:a.left-r.left,top:a.top-r.top});const c=e[h].fragments[l].characters[u],p=o[i];c.inlineBox.left=p.left,c.inlineBox.top=p.top,c.inlineBox.width=p.width,c.inlineBox.height=p.height;const g=c.fontHeight;c.lineBox.left=p.left,c.lineBox.top=p.top+(p.height-g)/2,c.lineBox.height=g,c.lineBox.width=p.width,i++}),{paragraphs:e,boundingBox:new E(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}}const aa="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function la(s,t,e){if(s==="cover")return 0;if(typeof s=="string")if(s.endsWith("%")){const r=Number(s.substring(0,s.length-1))/100;return Math.ceil(r*e/t)}else return s.endsWith("rem")?Number(s.substring(0,s.length-3)):Math.ceil(Number(s)/t);else return Math.ceil(s/t)}function ha(s,t,e){return typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function ca(s,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.center.add(s.center.sub(t.center).scale(n.x,n.y)).sub({x:s.width/2*n.x,y:s.height/2*n.y}),i=new vt;return i.translate(-s.left,-s.top),r&&(i.translate(-s.width/2,-s.height/2),i.rotate(Math.PI/2),i.translate(s.width/2,s.height/2)),i.scale(n.x,n.y),i.translate(o.x,o.y),i}function Hn(){const s=[],t=[],e=new Map;function r(n){let o=e.get(n);return o||(o=Vn(n),e.set(n,o)),o}return{name:"highlight",paths:s,update:n=>{s.length=0;const{characters:o}=n;let i;const a=[];let h;o.forEach(l=>{const{isVertical:u,computedStyle:c}=l;!se(c.highlightImage)&&l.glyphBox&&(c.highlightSize!=="1rem"&&(h==null?void 0:h.highlightImage)===c.highlightImage&&(h==null?void 0:h.highlightSize)===c.highlightSize&&(h==null?void 0:h.highlightStrokeWidth)===c.highlightStrokeWidth&&(h==null?void 0:h.highlightOverflow)===c.highlightOverflow&&(i!=null&&i.length)&&(u?i[0].inlineBox.left===l.inlineBox.left:i[0].inlineBox.top===l.inlineBox.top)&&i[0].fontSize===l.fontSize?i.push(l):(i=[],i.push(l),a.push(i))),h=c}),a.filter(l=>l.length).map(l=>{const u=l[0];return{style:u.computedStyle,baseline:u.baseline,box:E.from(...l.map(c=>c.glyphBox))}}).forEach(l=>{const{style:u,box:c,baseline:p}=l,{fontSize:g,writingMode:d}=u,m=d.includes("vertical"),f=ha(u.highlightStrokeWidth,g,c.width),b=la(u.highlightSize,g,c.width),P=se(u.highlightOverflow)?b?"hidden":"visible":u.highlightOverflow,M=r(se(u.highlightReferImage)?aa:u.highlightReferImage),T=r(u.highlightImage),w=Qe(T,!0),x=Qe(M,!1),A=b?g*b:m?c.height:c.width,S=p*.8,C=ca(w,x,new E(c.left,c.top,m?S:A,m?A:S),m),L=g/w.width*2,W=Math.ceil(c.width/A);for(let B=0;B<W;B++){const bt=C.clone().translate(B*A,0);T.forEach(O=>{const D=O.clone().matrix(bt);D.style.strokeWidth&&(D.style.strokeWidth*=L*f),D.style.strokeMiterlimit&&(D.style.strokeMiterlimit*=L),D.style.strokeDashoffset&&(D.style.strokeDashoffset*=L),D.style.strokeDasharray&&(D.style.strokeDasharray=D.style.strokeDasharray.map(j=>j*L)),s.push(D),t[s.length-1]=P==="hidden"?new E(c.left,c.top-c.height,c.width,c.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{s.forEach((i,a)=>{Te({ctx:n,path:i,clipRect:t[a],fontSize:o.computedStyle.fontSize})})}}}function Zn(s,t,e){return s==="cover"?1:typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Kn(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,o=n*.45;e.forEach(i=>{const{computedStyle:a}=i;let h=a.listStyleSize,l;if(!se(a.listStyleImage))l=a.listStyleImage;else if(!se(a.listStyleType)){const d=n*.38/2;switch(h=h==="cover"?d*2:h,a.listStyleType){case"disc":l=`<svg width="${d*2}" height="${d*2}" xmlns="http://www.w3.org/2000/svg">
4
+ }`)),document.head.appendChild(r),this}get(t){let e;return t&&(e=this.loaded.get(this.familyToUrl.get(t)??t)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){const e=this.familyToUrl.get(t)??t;return this.familyToUrl.delete(e),this.loaded.delete(e),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...i}=e,{src:a}=t;if(this.loaded.has(a))return r&&(this.loading.forEach(p=>p.cancel()),this.loading.clear()),u(this.loaded.get(a));let h=this.loading.get(a);return h||(h=this._createRequest(a,i),this.loading.set(a,h)),r&&this.loading.forEach((p,g)=>{p!==h&&(p.cancel(),this.loading.delete(g))}),h.when.then(p=>{if(this.loaded.has(a))return u(this.loaded.get(a));{const g=c(p);return e.noAdd||this.loaded.set(t.src,g),g.familySet.forEach(d=>{this.familyToUrl.set(d,a),typeof document<"u"&&(n&&this.injectFontFace(d,p),o&&this.injectStyleTag(d,a))}),g}}).catch(p=>{if(p instanceof DOMException&&p.message==="The user aborted a request.")return c();throw p}).finally(()=>{this.loading.delete(a)});function l(){return t.family?Array.isArray(t.family)?t.family:[t.family]:[]}function u(p){return l().forEach(g=>{p.familySet.add(g)}),p}function c(p=new ArrayBuffer(0)){let g;function d(){return g||(g=p.byteLength?ro(p,!1):void 0),g}function m(){const f=d();if(f instanceof At||f instanceof wr)return f.sfnt}return{...t,buffer:p,familySet:new Set(l()),getFont:d,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}};Me(Cn,"defaultRequestInit",{cache:"force-cache"});let io=Cn;const oo=new io,ao={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Pn(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:h=[],strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:c=0,shadowBlur:p=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=o,s.lineJoin=ao[i],s.miterLimit=a,s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=u,s.shadowOffsetY=c,s.shadowBlur=p,s.shadowColor=g}class v{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new v(1/0,1/0)}static get MIN(){return new v(-1/0,-1/0)}get array(){return[this.x,this.y]}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,o=-(this.y-e.y),i=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*i),e.y-(n*i+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,o=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new v(this.x,this.y)}}class E{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new v((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new E;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 E(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new E(this.left,this.top,this.width,this.height)}}var lo=Object.defineProperty,ho=(s,t,e)=>t in s?lo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,co=(s,t,e)=>(ho(s,t+"",e),e);class vt{constructor(t=1,e=0,r=0,n=0,o=1,i=0,a=0,h=0,l=1){co(this,"elements",[]),this.set(t,e,r,n,o,i,a,h,l)}set(t,e,r,n,o,i,a,h,l){const u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=o,u[5]=h,u[6]=r,u[7]=i,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,o=this.elements,i=r[0],a=r[3],h=r[6],l=r[1],u=r[4],c=r[7],p=r[2],g=r[5],d=r[8],m=n[0],f=n[3],b=n[6],P=n[1],M=n[4],T=n[7],w=n[2],x=n[5],A=n[8];return o[0]=i*m+a*P+h*w,o[3]=i*f+a*M+h*x,o[6]=i*b+a*T+h*A,o[1]=l*m+u*P+c*w,o[4]=l*f+u*M+c*x,o[7]=l*b+u*T+c*A,o[2]=p*m+g*P+d*w,o[5]=p*f+g*M+d*x,o[8]=p*b+g*T+d*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],h=t[6],l=t[7],u=t[8],c=u*i-a*l,p=a*h-u*o,g=l*o-i*h,d=e*c+r*p+n*g;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=c*m,t[1]=(n*l-u*r)*m,t[2]=(a*r-n*i)*m,t[3]=p*m,t[4]=(u*e-n*h)*m,t[5]=(n*o-a*e)*m,t[6]=g*m,t[7]=(r*h-l*e)*m,t[8]=(i*e-r*o)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(xr.makeScale(t,e)),this}rotate(t){return this.premultiply(xr.makeRotation(-t)),this}translate(t,e){return this.premultiply(xr.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 xr=new vt;function Tn(s,t,e,r){const n=s*e+t*r,o=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let i=Math.acos(Math.max(-1,Math.min(1,n/o)));return s*r-t*e<0&&(i=-i),i}function uo(s,t,e,r,n,o,i,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(i.x-a.x)/2,l=(i.y-a.y)/2,u=Math.cos(r)*h+Math.sin(r)*l,c=-Math.sin(r)*h+Math.cos(r)*l;let p=t*t,g=e*e;const d=u*u,m=c*c,f=d/p+m/g;if(f>1){const L=Math.sqrt(f);t=L*t,e=L*e,p=t*t,g=e*e}const b=p*m+g*d,P=(p*g-b)/b;let M=Math.sqrt(Math.max(0,P));n===o&&(M=-M);const T=M*t*c/e,w=-M*e*u/t,x=Math.cos(r)*T-Math.sin(r)*w+(i.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*w+(i.y+a.y)/2,S=Tn(1,0,(u-T)/t,(c-w)/e),C=Tn((u-T)/t,(c-w)/e,(-u-T)/t,(-c-w)/e)%(Math.PI*2);s.ellipse(x,A,t,e,r,S,S+C,o===1)}function ne(s,t){return s-(t-s)}function _n(s,t){const e=new v,r=new v;for(let n=0,o=s.length;n<o;n++){const i=s[n];if(i.type==="m"||i.type==="M")i.type==="m"?e.add(i):e.copy(i),t.moveTo(e.x,e.y),r.copy(e);else if(i.type==="h"||i.type==="H")i.type==="h"?e.x+=i.x:e.x=i.x,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="v"||i.type==="V")i.type==="v"?e.y+=i.y:e.y=i.y,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="l"||i.type==="L")i.type==="l"?e.add(i):e.copy(i),t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="c"||i.type==="C")i.type==="c"?(t.bezierCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(t.bezierCurveTo(ne(e.x,r.x),ne(e.y,r.y),e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(ne(e.x,r.x),ne(e.y,r.y),i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(t.quadraticCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x,e.y+i.y),r.x=e.x+i.x1,r.y=e.y+i.y1,e.add(i)):(t.quadraticCurveTo(i.x1,i.y1,i.x,i.y),r.x=i.x1,r.y=i.y1,e.copy(i));else if(i.type==="t"||i.type==="T"){const a=ne(e.x,r.x),h=ne(e.y,r.y);r.x=a,r.y=h,i.type==="t"?(t.quadraticCurveTo(a,h,e.x+i.x,e.y+i.y),e.add(i)):(t.quadraticCurveTo(a,h,i.x,i.y),e.copy(i))}else if(i.type==="a"||i.type==="A"){const a=e.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;e.add(i)}else{if(e.equals(i))continue;e.copy(i)}r.copy(e),uo(t,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,e)}else i.type==="z"||i.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",i)}}const K={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(s,t,e=0){let a=0,h=!0,l="",u="";const c=[];function p(f,b,P){const M=new SyntaxError(`Unexpected character "${f}" at index ${b}.`);throw M.partial=P,M}function g(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let d;const m=s.length;for(let f=0;f<m;f++){if(d=s[f],Array.isArray(t)&&t.includes(c.length%e)&&K.FLAGS.test(d)){a=1,l=d,g();continue}if(a===0){if(K.WHITESPACE.test(d))continue;if(K.DIGIT.test(d)||K.SIGN.test(d)){a=1,l=d;continue}if(K.POINT.test(d)){a=2,l=d;continue}K.COMMA.test(d)&&(h&&p(d,f,c),h=!0)}if(a===1){if(K.DIGIT.test(d)){l+=d;continue}if(K.POINT.test(d)){l+=d,a=2;continue}if(K.EXP.test(d)){a=3;continue}K.SIGN.test(d)&&l.length===1&&K.SIGN.test(l[0])&&p(d,f,c)}if(a===2){if(K.DIGIT.test(d)){l+=d;continue}if(K.EXP.test(d)){a=3;continue}K.POINT.test(d)&&l[l.length-1]==="."&&p(d,f,c)}if(a===3){if(K.DIGIT.test(d)){u+=d;continue}if(K.SIGN.test(d)){if(u===""){u+=d;continue}u.length===1&&K.SIGN.test(u)&&p(d,f,c)}}K.WHITESPACE.test(d)?(g(),a=0,h=!1):K.COMMA.test(d)?(g(),a=0,h=!0):K.SIGN.test(d)?(g(),a=1,l=d):K.POINT.test(d)?(g(),a=2,l=d):p(d,f,c)}return g(),c}function fo(s){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=s.length;n<o;n++){const i=s[n];switch(i.type){case"m":case"M":if(i.x===e.x&&i.y===e.y)continue;r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y,t.x=i.x,t.y=i.y;break;case"h":case"H":r+=`${i.type} ${i.x}`,e.x=i.x;break;case"v":case"V":r+=`${i.type} ${i.y}`,e.y=i.y;break;case"l":case"L":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"c":case"C":r+=`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"s":case"S":r+=`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"q":case"Q":r+=`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"t":case"T":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"a":case"A":r+=`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"z":case"Z":r+=i.type,e.x=t.x,e.y=t.y;break}}return r}const po=/[a-df-z][^a-df-z]*/gi;function In(s){const t=[],e=s.match(po);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],i=o.charAt(0),a=o.slice(1).trim();let h;switch(i){case"m":case"M":h=Ut(a);for(let l=0,u=h.length;l<u;l+=2)l===0?t.push({type:i,x:h[l],y:h[l+1]}):t.push({type:i==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Ut(a);for(let l=0,u=h.length;l<u;l++)t.push({type:i,x:h[l]});break;case"v":case"V":h=Ut(a);for(let l=0,u=h.length;l<u;l++)t.push({type:i,y:h[l]});break;case"l":case"L":h=Ut(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:i,x:h[l],y:h[l+1]});break;case"c":case"C":h=Ut(a);for(let l=0,u=h.length;l<u;l+=6)t.push({type:i,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Ut(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:i,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Ut(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:i,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Ut(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:i,x:h[l],y:h[l+1]});break;case"a":case"A":h=Ut(a,[3,4],7);for(let l=0,u=h.length;l<u;l+=7)t.push({type:i,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:i});break;default:console.warn(o)}}return t}var go=Object.defineProperty,yo=(s,t,e)=>t in s?go(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vr=(s,t,e)=>(yo(s,typeof t!="symbol"?t+"":t,e),e);class Yt{constructor(){vr(this,"arcLengthDivisions",200),vr(this,"_cacheArcLengths"),vr(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 v){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),o=0;e.push(0);for(let i=1;i<=t;i++)r=this.getPoint(i/t),o+=r.distanceTo(n),e.push(o),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const o=r.length;let i;e?i=e:i=t*r[o-1];let a=0,h=o-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-i,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===i)return n/(o-1);const u=r[n],p=r[n+1]-u,g=(i-u)/p;return(n+g)/(o-1)}getTangent(t,e=new v){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 v){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,o=(r+n)/2;for(;n-r>e;){o=(r+n)/2;const i=this.getPoint(o);if(i.distanceTo(t)<e)return o;i.x<t.x?r=o:n=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=v.MAX,e=v.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(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 fo(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Dn(s,t,e,r,n){const o=(r-t)*.5,i=(n-e)*.5,a=s*s,h=s*a;return(2*e-2*r+o+i)*h+(-3*e+3*r-2*o-i)*a+o*s+e}function mo(s,t){const e=1-s;return e*e*t}function wo(s,t){return 2*(1-s)*s*t}function xo(s,t){return s*s*t}function An(s,t,e,r){return mo(s,t)+wo(s,e)+xo(s,r)}function vo(s,t){const e=1-s;return e*e*e*t}function bo(s,t){const e=1-s;return 3*e*e*s*t}function Mo(s,t){return 3*(1-s)*s*s*t}function So(s,t){return s*s*s*t}function On(s,t,e,r,n){return vo(s,t)+bo(s,e)+Mo(s,r)+So(s,n)}class Co extends Yt{constructor(t=new v,e=new v,r=new v,n=new v){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new v){const{start:r,startControl:n,endControl:o,end:i}=this;return e.set(On(t,r.x,n.x,o.x,i.x),On(t,r.y,n.y,o.y,i.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const o=Math.sqrt(n),i=(-e+o)/(2*t),a=(-e-o)/(2*t);return[i,a].filter(h=>h>=0&&h<=1)}getMinMax(t=v.MAX,e=v.MIN){const r=this.start,n=this.startControl,o=this.endControl,i=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(i.x-o.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(i.y-o.y)),l=[0,1,...a,...h];return((c,p)=>{for(const g of c)for(let d=0;d<=p;d++){const m=d/p-.5,f=Math.min(1,Math.max(0,g+m)),b=this.getPoint(f);t.x=Math.min(t.x,b.x),t.y=Math.min(t.y,b.y),e.x=Math.max(e.x,b.x),e.y=Math.max(e.y,b.y)}})(l,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 Po=new vt,Nn=new vt,zn=new vt,Ve=new v;class To extends Yt{constructor(t=new v,e=1,r=1,n=0,o=0,i=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=i,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new v){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(o?n=0:n=r),this.clockwise&&!o&&(n===r?n=-r:n=n-r);const i=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(i),h=this.center.y+this.radiusY*Math.sin(i);if(this.rotation!==0){const l=Math.cos(this.rotation),u=Math.sin(this.rotation),c=a-this.center.x,p=h-this.center.y;a=c*l-p*u+this.center.x,h=c*u+p*l+this.center.y}return e.set(a,h)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:i,rotation:a}=this,{x:h,y:l}=t,u=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),c=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),p=Math.abs(n-o),g=p>Math.PI?1:0,d=i?1:0,m=a*180/Math.PI;if(p>=2*Math.PI){const f=n+Math.PI,b=h+e*Math.cos(f)*Math.cos(a)-r*Math.sin(f)*Math.sin(a),P=l+e*Math.cos(f)*Math.sin(a)+r*Math.sin(f)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:d,x:b,y:P},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:d,x:u,y:c}]}else{const f=h+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),b=l+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:g,sweepFlag:d,x:f,y:b}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:i,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,o,i,a,!h),this}matrix(t){return Ve.set(this.center.x,this.center.y),Ve.applyMatrix3(t),this.center.x=Ve.x,this.center.y=Ve.y,Do(t)?_o(this,t):Io(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=v.MAX,e=v.MIN){const{center:r,radiusX:n,radiusY:o,rotation:i}=this,{x:a,y:h}=r,l=Math.cos(i),u=Math.sin(i),c=Math.sqrt(n*n*l*l+o*o*u*u),p=Math.sqrt(n*n*u*u+o*o*l*l);return t.x=Math.min(t.x,a-c),t.y=Math.min(t.y,h-p),e.x=Math.max(e.x,a+c),e.y=Math.max(e.y,h+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 _o(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),o=Math.sin(s.rotation),i=new v(e*n,e*o),a=new v(-r*o,r*n),h=i.applyMatrix3(t),l=a.applyMatrix3(t),u=Po.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=Nn.copy(u).invert(),d=zn.copy(c).transpose().multiply(c).elements,m=Ao(d[0],d[1],d[4]),f=Math.sqrt(m.rt1),b=Math.sqrt(m.rt2);if(s.radiusX=1/f,s.radiusY=1/b,s.rotation=Math.atan2(m.sn,m.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const M=Nn.set(f,0,0,0,b,0,0,0,1),T=zn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=M.multiply(T).multiply(u),x=A=>{const{x:S,y:C}=new v(Math.cos(A),Math.sin(A)).applyMatrix3(w);return Math.atan2(C,S)};s.startAngle=x(s.startAngle),s.endAngle=x(s.endAngle),Un(t)&&(s.clockwise=!s.clockwise)}}function Io(s,t){const e=Ln(t),r=En(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,Un(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function Un(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Do(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Ln(s),n=En(s);return Math.abs(e/(r*n))>Number.EPSILON}function Ln(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function En(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Ao(s,t,e){let r,n,o,i,a;const h=s+e,l=s-e,u=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+u),a=1/r,n=s*a*e-t*a*t):h<0?n=.5*(h-u):(r=.5*u,n=-.5*u),l>0?o=l+u:o=l-u,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,i=1/Math.sqrt(1+a*a),o=a*i):Math.abs(t)===0?(o=1,i=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),i=a*o),l>0&&(a=o,o=-i,i=a),{rt1:r,rt2:n,cs:o,sn:i}}class br extends Yt{constructor(t=new v,e=new v){super(),this.start=t,this.end=e}getPoint(t,e=new v){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new v){return this.getPoint(t,e)}getTangent(t,e=new v){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new v){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class Oo extends Yt{constructor(t=new v,e=new v,r=new v){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new v){const{start:r,control:n,end:o}=this;return e.set(An(t,r.x,n.x,o.x),An(t,r.y,n.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,control:n,end:o}=this,i=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+o.x),l=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,i,h),t.y=Math.min(t.y,r.y,o.y,a,l),e.x=Math.max(e.x,r.x,o.x,i,h),e.y=Math.max(e.y,r.y,o.y,a,l),{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 No=Object.defineProperty,zo=(s,t,e)=>t in s?No(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,$n=(s,t,e)=>(zo(s,typeof t!="symbol"?t+"":t,e),e);class Uo extends Yt{constructor(t,e,r=1,n=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=o,$n(this,"curves",[]),$n(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 v(t-r,e-n),new v(t+r,e-n),new v(t+r,e+n),new v(t-r,e+n)];for(let i=0;i<4;i++)this.curves.push(new br(o[i].clone(),o[(i+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=v.MAX,e=v.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 Lo extends Yt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new v){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),i=n-o,a=r[o===0?o:o-1],h=r[o],l=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return e.set(Dn(i,a.x,h.x,l.x,u.x),Dn(i,a.y,h.y,l.y,u.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 Eo=Object.defineProperty,$o=(s,t,e)=>t in s?Eo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Se=(s,t,e)=>($o(s,typeof t!="symbol"?t+"":t,e),e);class Ce extends Yt{constructor(t){super(),Se(this,"curves",[]),Se(this,"startPoint"),Se(this,"currentPoint",new v),Se(this,"autoClose",!1),Se(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 _n(t,this),this}addData(t){return this.addCommands(In(t)),this}getPoint(t,e=new v){const r=t*this.getLength(),n=this.getCurveLengths();let o=0;for(;o<n.length;){if(n[o]>=r){const i=n[o]-r,a=this.curves[o],h=a.getLength();return a.getPointAt(h===0?0:1-i/h,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let o=0,i=r.length;o<i;o++){const h=r[o].getPoints(t);for(let l=0;l<h.length;l++){const u=h[l];n!=null&&n.equals(u)||(e.push(u),n=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new br(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 br(this.currentPoint.clone(),new v(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPoint.equals({x:o,y:i})||this.curves.push(new Co(this.currentPoint.clone(),new v(t,e),new v(r,n),new v(o,i))),this._setCurrentPoint({x:o,y:i}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new Oo(this.currentPoint.clone(),new v(t,e),new v(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,i){return this.ellipse(t,e,r,r,0,n,o,i),this}relativeArc(t,e,r,n,o,i){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,i),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,i,a,h=!0){const l=new To(new v(t,e),r,n,o,i,a,!h);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,o,i,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,o,i,a,h),this}rect(t,e,r,n){return this.curves.push(new Uo(new v(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Lo([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}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(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Bo(s,t,e,r){const n=t.clone().sub(s),o=r.clone().sub(e),i=e.clone().sub(s),a=n.cross(o);if(a===0)return new v((s.x+e.x)/2,(s.y+e.y)/2);const h=i.cross(o)/a;return Math.abs(h)>1?new v((s.x+e.x)/2,(s.y+e.y)/2):new v(s.x+h*n.x,s.y+h*n.y)}var jo=Object.defineProperty,Fo=(s,t,e)=>t in s?jo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Mr=(s,t,e)=>(Fo(s,typeof t!="symbol"?t+"":t,e),e);class Pt{constructor(t){Mr(this,"currentPath",new Ce),Mr(this,"paths",[this.currentPath]),Mr(this,"style",{}),t&&(t instanceof Pt?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 Pt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new Ce().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 Ce().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPath.bezierCurveTo(t,e,r,n,o,i),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,i){return this.currentPath.arc(t,e,r,n,o,i),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,i,a,h){return this.currentPath.ellipse(t,e,r,n,o,i,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return _n(t,this),this}addData(t){return this.addCommands(In(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,h)=>{const l=a.getControlPoints(),u=a.isClockwise();o[h]=l,n[h]=u;const c=l[0],p=l[l.length-1]??c;r.push({start:u?p:c,end:u?c:p,index:h})});const i=[];return r.forEach((a,h)=>{i[h]=[],r.forEach((l,u)=>{u!==h&&l.start.equals(a.end)&&i[h].push(l.index)})}),e.forEach((a,h)=>{const l=n[h];o[h].forEach(c=>{const p=a.getTForPoint(c),g=a.getNormal(p).scale(l?t:-t);c.add(g)})}),i.forEach((a,h)=>{const l=o[h];a.forEach(u=>{const c=o[u],p=Bo(l[l.length-1],l[l.length-2]??l[l.length-1],c[0],c[1]??c[0]);p&&(l[l.length-1].copy(p),c[0].copy(p))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=v.MAX,e=v.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(o=>{if(o.getMinMax(t,e),r&&n>1){const i=n/2,a=o.isClockwise(),h=[];for(let l=0;l<=1;l+=1/o.arcLengthDivisions){const u=o.getPoint(l),c=o.getNormal(l),p=c.clone().scale(a?i:-i),g=c.clone().scale(a?-i:i);h.push(u.clone().add(p),u.clone().add(g),u.clone().add({x:i,y:0}),u.clone().add({x:-i,y:0}),u.clone().add({x:0,y:i}),u.clone().add({x:0,y:-i}),u.clone().add({x:i,y:i}),u.clone().add({x:-i,y:-i}))}t.min(...h),e.max(...h)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new E(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(),Pn(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(),Pn(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:i,height:a}=this.getBoundingBox(),h=document.createElement("canvas");h.width=i*e,h.height=a*e,h.style.width=`${i}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-o),this.drawTo(l,r)),h}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 Sr="px",kn=90,Bn=["mm","cm","in","pt","pc","px"],Cr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function $(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Bn.length;r<n;r++){const o=Bn[r];if(s.endsWith(o)){t=o,s=s.substring(0,s.length-o.length);break}}let e;return t==="px"&&Sr!=="px"?e=Cr.in[Sr]/kn:(e=Cr[t][Sr],e<0&&(e=Cr[t].in*kn)),e*Number.parseFloat(s)}const Go=new vt,We=new vt,jn=new vt,Fn=new vt;function qo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Ro(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ro(s){const t=new vt,e=Go;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate($(s.getAttribute("x")),$(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const i=o.indexOf("("),a=o.length;if(i>0&&i<a){const h=o.slice(0,i),l=Ut(o.slice(i+1));switch(e.identity(),h){case"translate":if(l.length>=1){const u=l[0];let c=0;l.length>=2&&(c=l[1]),e.translate(u,c)}break;case"rotate":if(l.length>=1){let u=0,c=0,p=0;u=l[0]*Math.PI/180,l.length>=3&&(c=l[1],p=l[2]),We.makeTranslation(-c,-p),jn.makeRotation(u),Fn.multiplyMatrices(jn,We),We.makeTranslation(c,p),e.multiplyMatrices(We,Fn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Vo(s){return new Pt().addPath(new Ce().arc($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("r")||0),0,Math.PI*2))}function Wo(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim()),o={};for(let i=r.style.length,a=0;a<i;a++){const h=r.style.item(a);o[h]=r.style.getPropertyValue(h)}for(let i=0;i<n.length;i++)t[n[i]]=Object.assign(t[n[i]]||{},{...o})}}function Qo(s){return new Pt().addPath(new Ce().ellipse($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("rx")||0),$(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Xo(s){return new Pt().moveTo($(s.getAttribute("x1")||0),$(s.getAttribute("y1")||0)).lineTo($(s.getAttribute("x2")||0),$(s.getAttribute("y2")||0))}function Yo(s){const t=new Pt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Ho=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Zo(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Ho,(n,o,i)=>{const a=$(o),h=$(i);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Ko=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jo(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Ko,(n,o,i)=>{const a=$(o),h=$(i);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ta(s){const t=$(s.getAttribute("x")||0),e=$(s.getAttribute("y")||0),r=$(s.getAttribute("rx")||s.getAttribute("ry")||0),n=$(s.getAttribute("ry")||s.getAttribute("rx")||0),o=$(s.getAttribute("width")),i=$(s.getAttribute("height")),a=1-.551915024494,h=new Pt;return h.moveTo(t+r,e),h.lineTo(t+o-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+o-r*a,e,t+o,e+n*a,t+o,e+n),h.lineTo(t+o,e+i-n),(r!==0||n!==0)&&h.bezierCurveTo(t+o,e+i-n*a,t+o-r*a,e+i,t+o-r,e+i),h.lineTo(t+r,e+i),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+i,t,e+i-n*a,t,e+i-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function Lt(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const l=s.getAttribute("class").split(/\s/).filter(Boolean).map(u=>u.trim());for(let u=0;u<l.length;u++)r=Object.assign(r,e[`.${l[u]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let l=s.style.length,u=0;u<l;u++){const c=s.style.item(u),p=s.style.getPropertyValue(c);t[c]=p,r[c]=p}function n(l,u,c=o){s.hasAttribute(l)&&(t[u]=c(s.getAttribute(l))),r[l]&&(t[u]=c(r[l]))}function o(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function i(l){return Math.max(0,Math.min(1,$(l)))}function a(l){return Math.max(0,$(l))}function h(l){return l.split(" ").filter(u=>u!=="").map(u=>$(u))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",h),n("stroke-dashoffset","strokeDashoffset",$),n("visibility","visibility"),t}function Pr(s,t,e=[],r={}){var c;if(s.nodeType!==1)return e;let n=!1,o=null,i={...t};switch(s.nodeName){case"svg":i=Lt(s,i,r);break;case"style":Wo(s,r);break;case"g":i=Lt(s,i,r);break;case"path":i=Lt(s,i,r),s.hasAttribute("d")&&(o=Yo(s));break;case"rect":i=Lt(s,i,r),o=ta(s);break;case"polygon":i=Lt(s,i,r),o=Zo(s);break;case"polyline":i=Lt(s,i,r),o=Jo(s);break;case"circle":i=Lt(s,i,r),o=Vo(s);break;case"ellipse":i=Lt(s,i,r),o=Qo(s);break;case"line":i=Lt(s,i,r),o=Xo(s);break;case"defs":n=!0;break;case"use":{i=Lt(s,i,r);const g=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=(c=s.viewportElement)==null?void 0:c.getElementById(g);d?Pr(d,i,e,r):console.warn(`'use node' references non-existent node id: ${g}`);break}default:console.warn(s);break}if(i.display==="none")return e;Object.assign(t,i);const a=new vt,h=[],l=qo(s,a,h);o&&(o.matrix(a),e.push(o),o.style=t);const u=s.childNodes;for(let p=0,g=u.length;p<g;p++){const d=u[p];n&&d.nodeName!=="style"&&d.nodeName!=="defs"||Pr(d,t,e,r)}return l&&(h.pop(),h.length>0?a.copy(h[h.length-1]):a.identity()),e}const Gn="data:image/svg+xml;",qn=`${Gn}base64,`,Rn=`${Gn}charset=utf8,`;function ea(s){if(typeof s=="string"){let t;return s.startsWith(qn)?(s=s.substring(qn.length,s.length),t=atob(s)):s.startsWith(Rn)?(s=s.substring(Rn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Vn(s){return Pr(ea(s),{})}function Qe(s,t=!0){if(!s.length)return;const e=v.MAX,r=v.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new E(e.x,e.y,r.x-e.x,r.y-e.y)}const ra=new Set(["©","®","÷"]),na=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),sa={1:"italic",32:"bold"},ia={1:"italic",2:"bold"},Wn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Qn{constructor(t,e,r){U(this,"lineBox",new E);U(this,"inlineBox",new E);U(this,"glyphBox");U(this,"underlinePosition",0);U(this,"underlineThickness",0);U(this,"yStrikeoutPosition",0);U(this,"yStrikeoutSize",0);U(this,"baseline",0);U(this,"centerDiviation",0);U(this,"path",new Pt);this.content=t,this.index=e,this.parent=r}get center(){var t;return(t=this.glyphBox)==null?void 0:t.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSfnt(t){const e=this.computedStyle.fontFamily,r=t??oo,n=e?r.get(e):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:o,post:i}=t,{content:a,computedStyle:h}=this,{fontSize:l}=h,u=e/l,c=t.getAdvanceWidth(a,l),p=(r+Math.abs(n))/u,g=r/u,d=(r-o.yStrikeoutPosition)/u,m=o.yStrikeoutSize/u,f=(r-i.underlinePosition)/u,b=i.underlineThickness/u;return this.inlineBox.width=c,this.inlineBox.height=p,this.underlinePosition=f,this.underlineThickness=b,this.yStrikeoutPosition=d,this.yStrikeoutSize=m,this.baseline=g,this.centerDiviation=p/2-g,this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:n,computedStyle:o,baseline:i,inlineBox:a}=this,{os2:h,head:l,ascender:u,descender:c}=e,p=h.sTypoAscender,g=sa[h.fsSelection]??ia[l.macStyle],{left:d,top:m}=a,f=o.fontStyle==="italic"&&g!=="italic";let b=d,P=m+i,M;const T=new Pt;if(r&&(b+=(a.height-a.width)/2,Math.abs(a.width-a.height)>.1&&(P-=(u-p)/(u+Math.abs(c))*a.height),M=void 0),r&&!ra.has(n)&&(n.codePointAt(0)<=256||na.has(n))){T.addCommands(e.getPathCommands(n,b,m+i-(a.height-a.width)/2,o.fontSize)??[]);const x={y:m-(a.height-a.width)/2+a.height/2,x:b+a.width/2};f&&this._italic(T,r?{x:x.x,y:m-(a.height-a.width)/2+i}:void 0),T.rotate(90,x)}else M!==void 0?(T.addCommands(e.glyphs.get(M).getPathCommands(b,P,o.fontSize)),f&&this._italic(T,r?{x:b+a.width/2,y:m+p/(u+Math.abs(c))*a.height}:void 0)):(T.addCommands(e.getPathCommands(n,b,P,o.fontSize)??[]),f&&this._italic(T,r?{x:b+a.height/2,y:P}:void 0));T.addCommands(this._decoration());const w=o.fontWeight??400;return w in Wn&&(w===700||w==="bold")&&g!=="bold"&&T.bold(Wn[w]*o.fontSize*.05),T.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=T,this.glyphBox=this.getGlyphBoundingBox(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:o}=this.computedStyle,{left:i,top:a,width:h,height:l}=this.inlineBox,u=.1*o;let c;switch(n){case"underline":t?c=i:c=a+e;break;case"line-through":t?c=i+h/2:c=a+r;break;case"none":default:return[]}return t?[{type:"M",x:c,y:a},{type:"L",x:c,y:a+l},{type:"L",x:c+u,y:a+l},{type:"L",x:c+u,y:a},{type:"Z"}]:[{type:"M",x:i,y:c},{type:"L",x:i+h,y:c},{type:"L",x:i+h,y:c+u},{type:"L",x:i,y:c+u},{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 E(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){Te({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function se(s){return!s||s==="none"}function Xe(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}class Xn{constructor(t,e={},r){U(this,"inlineBox",new E);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,...Xe(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Qn(r,e++,this));return this.characters=t,this}}class ie{constructor(t,e){U(this,"lineBox",new E);U(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Xe(this.parentStyle),...Xe(this.style)},this}addFragment(t,e){const r=new Xn(t,e,this);return this.fragments.push(r),r}}function oa(s){return s}class Yn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(i=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(i.style)),i.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),/\s/.test(h.content)&&(l.style.whiteSpace="pre"),a.appendChild(l)}),o.appendChild(a)}),n.appendChild(o),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var i;return(i=n.parentNode)==null?void 0:i.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,i)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((h,l)=>{var p;const u=h.getBoundingClientRect();r.push({paragraphIndex:i,fragmentIndex:l,left:u.left,top:u.top,width:u.width,height:u.height});const c=h.firstChild;if(c instanceof window.Text){const g=document.createRange();g.selectNodeContents(c);const d=c.data?c.data.length:0;let m=0;for(;m<=d;){g.setStart(c,Math.max(m-1,0)),g.setEnd(c,m);const f=((p=g.getClientRects)==null?void 0:p.call(g))??[g.getBoundingClientRect()];let b=f[f.length-1];f.length>1&&b.width<2&&(b=f[f.length-2]);const P=g.toString();P!==""&&b&&b.width+b.height!==0&&n.push({content:P,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:l,characterIndex:m-1,top:b.top,left:b.left,height:b.height,width:b.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=this._measureDom(t);n.paragraphs.forEach(a=>{const h=e[a.paragraphIndex];h.lineBox.left=a.left-r.left,h.lineBox.top=a.top-r.top,h.lineBox.width=a.width,h.lineBox.height=a.height}),n.fragments.forEach(a=>{const h=e[a.paragraphIndex].fragments[a.fragmentIndex];h.inlineBox.left=a.left-r.left,h.inlineBox.top=a.top-r.top,h.inlineBox.width=a.width,h.inlineBox.height=a.height});const o=[];let i=0;return n.characters.forEach(a=>{const{paragraphIndex:h,fragmentIndex:l,characterIndex:u}=a;o.push({...a,newParagraphIndex:h,left:a.left-r.left,top:a.top-r.top});const c=e[h].fragments[l].characters[u],p=o[i];c.inlineBox.left=p.left,c.inlineBox.top=p.top,c.inlineBox.width=p.width,c.inlineBox.height=p.height;const g=c.fontHeight;c.lineBox.left=p.left,c.lineBox.top=p.top+(p.height-g)/2,c.lineBox.height=g,c.lineBox.width=p.width,i++}),{paragraphs:e,boundingBox:new E(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}}const aa="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function la(s,t,e){if(s==="cover")return 0;if(typeof s=="string")if(s.endsWith("%")){const r=Number(s.substring(0,s.length-1))/100;return Math.ceil(r*e/t)}else return s.endsWith("rem")?Number(s.substring(0,s.length-3)):Math.ceil(Number(s)/t);else return Math.ceil(s/t)}function ha(s,t,e){return typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function ca(s,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.center.add(s.center.sub(t.center).scale(n.x,n.y)).sub({x:s.width/2*n.x,y:s.height/2*n.y}),i=new vt;return i.translate(-s.left,-s.top),r&&(i.translate(-s.width/2,-s.height/2),i.rotate(Math.PI/2),i.translate(s.width/2,s.height/2)),i.scale(n.x,n.y),i.translate(o.x,o.y),i}function Hn(){const s=[],t=[],e=new Map;function r(n){let o=e.get(n);return o||(o=Vn(n),e.set(n,o)),o}return{name:"highlight",paths:s,update:n=>{s.length=0;const{characters:o}=n;let i;const a=[];let h;o.forEach(l=>{const{isVertical:u,computedStyle:c}=l;!se(c.highlightImage)&&l.glyphBox&&(c.highlightSize!=="1rem"&&(h==null?void 0:h.highlightImage)===c.highlightImage&&(h==null?void 0:h.highlightSize)===c.highlightSize&&(h==null?void 0:h.highlightStrokeWidth)===c.highlightStrokeWidth&&(h==null?void 0:h.highlightOverflow)===c.highlightOverflow&&(i!=null&&i.length)&&(u?i[0].inlineBox.left===l.inlineBox.left:i[0].inlineBox.top===l.inlineBox.top)&&i[0].fontSize===l.fontSize?i.push(l):(i=[],i.push(l),a.push(i))),h=c}),a.filter(l=>l.length).map(l=>{const u=l[0];return{style:u.computedStyle,baseline:u.baseline,box:E.from(...l.map(c=>c.glyphBox))}}).forEach(l=>{const{style:u,box:c,baseline:p}=l,{fontSize:g,writingMode:d}=u,m=d.includes("vertical"),f=ha(u.highlightStrokeWidth,g,c.width),b=la(u.highlightSize,g,c.width),P=se(u.highlightOverflow)?b?"hidden":"visible":u.highlightOverflow,M=r(se(u.highlightReferImage)?aa:u.highlightReferImage),T=r(u.highlightImage),w=Qe(T,!0),x=Qe(M,!1),A=b?g*b:m?c.height:c.width,S=p*.8,C=ca(w,x,new E(c.left,c.top,m?S:A,m?A:S),m),L=g/w.width*2,W=Math.ceil(c.width/A);for(let B=0;B<W;B++){const bt=C.clone().translate(B*A,0);T.forEach(O=>{const D=O.clone().matrix(bt);D.style.strokeWidth&&(D.style.strokeWidth*=L*f),D.style.strokeMiterlimit&&(D.style.strokeMiterlimit*=L),D.style.strokeDashoffset&&(D.style.strokeDashoffset*=L),D.style.strokeDasharray&&(D.style.strokeDasharray=D.style.strokeDasharray.map(j=>j*L)),s.push(D),t[s.length-1]=P==="hidden"?new E(c.left,c.top-c.height,c.width,c.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{s.forEach((i,a)=>{Te({ctx:n,path:i,clipRect:t[a],fontSize:o.computedStyle.fontSize})})}}}function Zn(s,t,e){return s==="cover"?1:typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Kn(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,o=n*.45;e.forEach(i=>{const{computedStyle:a}=i;let h=a.listStyleSize,l;if(!se(a.listStyleImage))l=a.listStyleImage;else if(!se(a.listStyleType)){const d=n*.38/2;switch(h=h==="cover"?d*2:h,a.listStyleType){case"disc":l=`<svg width="${d*2}" height="${d*2}" xmlns="http://www.w3.org/2000/svg">
5
5
  <circle cx="${d}" cy="${d}" r="${d}" fill="${a.color}" />
6
- </svg>`;break}}if(!l)return;const u=Vn(l),c=Qe(u),p=i.lineBox,g=i.fragments[0].inlineBox;if(g){const d=new vt;if(r){const m=Zn(h,n,n),f=n/c.height*m;d.translate(-c.left,-c.top),d.rotate(Math.PI/2),d.scale(f,f),d.translate(n/2-c.height*f/2,0),d.translate(p.left+(p.width-n)/2,g.top-o)}else{const m=Zn(h,n,n),f=n/c.height*m;d.translate(-c.left,-c.top),d.translate(-c.width,0),d.scale(f,f),d.translate(0,n/2-c.height*f/2),d.translate(g.left-o,p.top+(p.height-n)/2)}s.push(...u.map(m=>m.clone().matrix(d)))}})}}}const Vt=new v,oe=new vt,Wt=new vt;function Jn(){return{name:"render",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(o=>{r==null||r.forEach(i=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),h=Tr(s,i);Vt.set(a.left,a.top),Vt.applyMatrix3(h),a.left=Vt.x,a.top=Vt.y,Vt.set(a.right,a.bottom),Vt.applyMatrix3(h),a.width=Vt.x-a.left,a.height=Vt.y-a.top;const l=(i.shadowOffsetX??0)*e,u=(i.shadowOffsetY??0)*e,c=Math.max(.1,i.textStrokeWidth??0)*e;a.left+=l-c,a.top+=u-c,a.width+=c*2,a.height+=c*2,n.push(a)})}),n.length?E.from(...n):void 0},render:(s,t)=>{const{characters:e,paragraphs:r,glyphBox:n,effects:o,style:i}=t;function a(h,l){s.fillStyle=h,s.fillRect(l.left,l.top,l.width,l.height)}i!=null&&i.backgroundColor&&a(i.backgroundColor,new E(0,0,s.canvas.width,s.canvas.height)),r.forEach(h=>{var l;(l=h.style)!=null&&l.backgroundColor&&a(h.style.backgroundColor,h.lineBox)}),o?o.forEach(h=>{Ot(h,n,s),s.save();const[l,u,c,p,g,d]=Tr(t,h).transpose().elements;s.transform(l,p,u,g,c,d),e.forEach(m=>{var f;(f=m.parent.style)!=null&&f.backgroundColor&&a(m.parent.style.backgroundColor,m.inlineBox),m.drawTo(s,h)}),s.restore()}):r.forEach(h=>{h.fragments.forEach(l=>{var u;(u=l.style)!=null&&u.backgroundColor&&a(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(s)})})})}}}function Tr(s,t){const{fontSize:e,glyphBox:r}=s,n=(t.translateX??0)*e,o=(t.translateY??0)*e,i=Math.PI*2,a=(t.skewX??0)/360*i,h=(t.skewY??0)/360*i,{left:l,top:u,width:c,height:p}=r,g=l+c/2,d=u+p/2;return oe.identity(),Wt.makeTranslation(n,o),oe.multiply(Wt),Wt.makeTranslation(g,d),oe.multiply(Wt),Wt.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),oe.multiply(Wt),Wt.makeTranslation(-g,-d),oe.multiply(Wt),oe.clone()}const _r={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",listStyleType:"none",listStyleImage:"none",listStyleSize:"cover",listStylePosition:"outside",highlightReferImage:"none",highlightImage:"none",highlightSize:"cover",highlightStrokeWidth:"100%",highlightOverflow:"none",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,translateX:0,translateY:0,skewX:0,skewY:0};class Ir{constructor(t={}){U(this,"content");U(this,"style");U(this,"effects");U(this,"measureDom");U(this,"needsUpdate",!0);U(this,"computedStyle",{..._r});U(this,"paragraphs",[]);U(this,"lineBox",new E);U(this,"rawGlyphBox",new E);U(this,"glyphBox",new E);U(this,"pathBox",new E);U(this,"boundingBox",new E);U(this,"measurer",new Yn(this));U(this,"plugins",new Map);U(this,"fonts");const{content:e="",style:r={},measureDom:n,effects:o,fonts:i}=t;this.content=e,this.style=r,this.measureDom=n,this.effects=o,this.fonts=i,this.use(Jn()).use(Hn()).use(Kn())}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}updateParagraphs(){this.computedStyle={..._r,...this.style};let{content:t,computedStyle:e}=this;const r=[];if(typeof t=="string"){const n=new ie({},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 ie({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new ie({},e);n.forEach(i=>{if(typeof i=="string")o.addFragment(i);else{const{content:a,...h}=i;a!==void 0&&o.addFragment(a,h)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...i}=n,a=new ie(i,e);o.forEach(h=>{const{content:l,...u}=h;l!==void 0&&a.addFragment(l,u)}),r.push(a)}else if("content"in n){const{content:o,...i}=n;if(o!==void 0){const a=new ie(i,e);a.addFragment(o),r.push(a)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const e={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),[...this.plugins.values()].sort((o,i)=>(o.updateOrder??0)-(i.updateOrder??0)).forEach(o=>{var i;(i=o.update)==null||i.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in e)r[o]=this[o],this[o]=e[o];return r}getGlyphBox(){const t=v.MAX,e=v.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,e)){const{inlineBox:n}=r,o=new v(n.left,n.top),i=new v(n.left+n.width,n.top+n.height);t.min(o,i),e.max(o,i)}}),new E(t.x,t.y,e.x-t.x,e.y-t.y)}updatePathBox(){const t=[...this.plugins.values()];return this.pathBox=E.from(this.glyphBox,...t.map(e=>e.getBoundingBox?e.getBoundingBox(this):Qe(e.paths??[])).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:e,pathBox:r}=this,n=r.left+t.left-e.left,o=r.top+t.top-e.top,i=r.right+t.right-e.right,a=r.bottom+t.bottom-e.bottom;return this.boundingBox=new E(n,o,i-n,a-o),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const e in t)this[e]=t[e];return this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Nr(n,r,this.boundingBox),zr(n,this),[...this.plugins.values()].sort((i,a)=>(i.renderOrder??0)-(a.renderOrder??0)).forEach(i=>{var a;i.render?(a=i.render)==null||a.call(i,n,this):i.paths&&i.paths.forEach(h=>{Te({ctx:n,path:h,fontSize:this.computedStyle.fontSize})})}),this):this}}function ua(s){return new Ir(s).measure()}function fa(s){return new Ir(s).render(s)}z.Character=Qn,z.Fragment=Xn,z.Measurer=Yn,z.Paragraph=ie,z.Text=Ir,z.defaultTextStyles=_r,z.definePlugin=oa,z.drawPath=Te,z.filterEmpty=Xe,z.getTransform2D=Tr,z.highlight=Hn,z.isNone=se,z.listStyle=Kn,z.measureText=ua,z.parseColor=ot,z.render=Jn,z.renderText=fa,z.setupView=Nr,z.uploadColor=Ot,z.uploadColors=zr,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});
6
+ </svg>`;break}}if(!l)return;const u=Vn(l),c=Qe(u),p=i.lineBox,g=i.fragments[0].inlineBox;if(g){const d=new vt;if(r){const m=Zn(h,n,n),f=n/c.height*m;d.translate(-c.left,-c.top),d.rotate(Math.PI/2),d.scale(f,f),d.translate(n/2-c.height*f/2,0),d.translate(p.left+(p.width-n)/2,g.top-o)}else{const m=Zn(h,n,n),f=n/c.height*m;d.translate(-c.left,-c.top),d.translate(-c.width,0),d.scale(f,f),d.translate(0,n/2-c.height*f/2),d.translate(g.left-o,p.top+(p.height-n)/2)}s.push(...u.map(m=>m.clone().matrix(d)))}})}}}const Vt=new v,oe=new vt,Wt=new vt;function Jn(){return{name:"render",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(o=>{r==null||r.forEach(i=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),h=Tr(s,i);Vt.set(a.left,a.top),Vt.applyMatrix3(h),a.left=Vt.x,a.top=Vt.y,Vt.set(a.right,a.bottom),Vt.applyMatrix3(h),a.width=Vt.x-a.left,a.height=Vt.y-a.top;const l=(i.shadowOffsetX??0)*e,u=(i.shadowOffsetY??0)*e,c=Math.max(.1,i.textStrokeWidth??0)*e;a.left+=l-c,a.top+=u-c,a.width+=c*2,a.height+=c*2,n.push(a)})}),n.length?E.from(...n):void 0},render:(s,t)=>{const{characters:e,paragraphs:r,glyphBox:n,effects:o,style:i}=t;function a(h,l){s.fillStyle=h,s.fillRect(l.left,l.top,l.width,l.height)}i!=null&&i.backgroundColor&&a(i.backgroundColor,new E(0,0,s.canvas.width,s.canvas.height)),r.forEach(h=>{var l;(l=h.style)!=null&&l.backgroundColor&&a(h.style.backgroundColor,h.lineBox)}),o?o.forEach(h=>{Ot(h,n,s),s.save();const[l,u,c,p,g,d]=Tr(t,h).transpose().elements;s.transform(l,p,u,g,c,d),e.forEach(m=>{var f;(f=m.parent.style)!=null&&f.backgroundColor&&a(m.parent.style.backgroundColor,m.inlineBox),m.drawTo(s,h)}),s.restore()}):r.forEach(h=>{h.fragments.forEach(l=>{var u;(u=l.style)!=null&&u.backgroundColor&&a(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(s)})})})}}}function Tr(s,t){const{fontSize:e,glyphBox:r}=s,n=(t.translateX??0)*e,o=(t.translateY??0)*e,i=Math.PI*2,a=(t.skewX??0)/360*i,h=(t.skewY??0)/360*i,{left:l,top:u,width:c,height:p}=r,g=l+c/2,d=u+p/2;return oe.identity(),Wt.makeTranslation(n,o),oe.multiply(Wt),Wt.makeTranslation(g,d),oe.multiply(Wt),Wt.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),oe.multiply(Wt),Wt.makeTranslation(-g,-d),oe.multiply(Wt),oe.clone()}const _r={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",listStyleType:"none",listStyleImage:"none",listStyleSize:"cover",listStylePosition:"outside",highlightReferImage:"none",highlightImage:"none",highlightSize:"cover",highlightStrokeWidth:"100%",highlightOverflow:"none",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,translateX:0,translateY:0,skewX:0,skewY:0};class Ir{constructor(t={}){U(this,"content");U(this,"style");U(this,"effects");U(this,"measureDom");U(this,"needsUpdate",!0);U(this,"computedStyle",{..._r});U(this,"paragraphs",[]);U(this,"lineBox",new E);U(this,"rawGlyphBox",new E);U(this,"glyphBox",new E);U(this,"pathBox",new E);U(this,"boundingBox",new E);U(this,"measurer",new Yn(this));U(this,"plugins",new Map);U(this,"fonts");const{content:e="",style:r={},measureDom:n,effects:o,fonts:i}=t;this.content=e,this.style=r,this.measureDom=n,this.effects=o,this.fonts=i,this.use(Jn()).use(Hn()).use(Kn())}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}updateParagraphs(){this.computedStyle={..._r,...this.style};let{content:t,computedStyle:e}=this;const r=[];if(typeof t=="string"){const n=new ie({},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 ie({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new ie({},e);n.forEach(i=>{if(typeof i=="string")o.addFragment(i);else{const{content:a,...h}=i;a!==void 0&&o.addFragment(a,h)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...i}=n,a=new ie(i,e);o.forEach(h=>{const{content:l,...u}=h;l!==void 0&&a.addFragment(l,u)}),r.push(a)}else if("content"in n){const{content:o,...i}=n;if(o!==void 0){const a=new ie(i,e);a.addFragment(o),r.push(a)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const e={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),[...this.plugins.values()].sort((o,i)=>(o.updateOrder??0)-(i.updateOrder??0)).forEach(o=>{var i;(i=o.update)==null||i.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in e)r[o]=this[o],this[o]=e[o];return r}getGlyphBox(){const t=v.MAX,e=v.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,e)){const{inlineBox:n}=r,o=new v(n.left,n.top),i=new v(n.left+n.width,n.top+n.height);t.min(o,i),e.max(o,i)}}),new E(t.x,t.y,e.x-t.x,e.y-t.y)}updatePathBox(){const t=[...this.plugins.values()];return this.pathBox=E.from(this.glyphBox,...t.map(e=>e.getBoundingBox?e.getBoundingBox(this):Qe(e.paths??[])).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:e,pathBox:r}=this,n=Math.min(r.left,r.left+t.left-e.left),o=Math.min(r.top,r.top+t.top-e.top),i=Math.max(r.right,r.right+t.right-e.right),a=Math.max(r.bottom,r.bottom+t.bottom-e.bottom);return this.boundingBox=new E(n,o,i-n,a-o),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const e in t)this[e]=t[e];return this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Nr(n,r,this.boundingBox),zr(n,this),[...this.plugins.values()].sort((i,a)=>(i.renderOrder??0)-(a.renderOrder??0)).forEach(i=>{var a;i.render?(a=i.render)==null||a.call(i,n,this):i.paths&&i.paths.forEach(h=>{Te({ctx:n,path:h,fontSize:this.computedStyle.fontSize})})}),this):this}}function ua(s){return new Ir(s).measure()}function fa(s){return new Ir(s).render(s)}z.Character=Qn,z.Fragment=Xn,z.Measurer=Yn,z.Paragraph=ie,z.Text=Ir,z.defaultTextStyles=_r,z.definePlugin=oa,z.drawPath=Te,z.filterEmpty=Xe,z.getTransform2D=Tr,z.highlight=Hn,z.isNone=se,z.listStyle=Kn,z.measureText=ua,z.parseColor=ot,z.render=Jn,z.renderText=fa,z.setupView=Nr,z.uploadColor=Ot,z.uploadColors=zr,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -174,11 +174,9 @@ class Character {
174
174
  }
175
175
  _getFontSfnt(fonts$1) {
176
176
  const fontFamily = this.computedStyle.fontFamily;
177
- let sfnt;
178
- if (fontFamily) {
179
- sfnt = fonts$1?.get(fontFamily)?.getSfnt() ?? fonts.get(fontFamily)?.getSfnt();
180
- }
181
- return sfnt;
177
+ const _fonts = fonts$1 ?? fonts;
178
+ const font = fontFamily ? _fonts.get(fontFamily) : _fonts.fallbackFont;
179
+ return font?.getSfnt();
182
180
  }
183
181
  updateGlyph(sfnt = this._getFontSfnt()) {
184
182
  if (!sfnt) {
@@ -1185,10 +1183,10 @@ class Text {
1185
1183
  }
1186
1184
  updateBoundingBox() {
1187
1185
  const { lineBox, rawGlyphBox, pathBox } = this;
1188
- const left = pathBox.left + lineBox.left - rawGlyphBox.left;
1189
- const top = pathBox.top + lineBox.top - rawGlyphBox.top;
1190
- const right = pathBox.right + lineBox.right - rawGlyphBox.right;
1191
- const bottom = pathBox.bottom + lineBox.bottom - rawGlyphBox.bottom;
1186
+ const left = Math.min(pathBox.left, pathBox.left + lineBox.left - rawGlyphBox.left);
1187
+ const top = Math.min(pathBox.top, pathBox.top + lineBox.top - rawGlyphBox.top);
1188
+ const right = Math.max(pathBox.right, pathBox.right + lineBox.right - rawGlyphBox.right);
1189
+ const bottom = Math.max(pathBox.bottom, pathBox.bottom + lineBox.bottom - rawGlyphBox.bottom);
1192
1190
  this.boundingBox = new BoundingBox(
1193
1191
  left,
1194
1192
  top,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "packageManager": "pnpm@9.9.0",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",