modern-text 1.0.3 → 1.0.5

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
@@ -539,7 +539,7 @@ class Measurer {
539
539
  const _style = {};
540
540
  for (const key in style) {
541
541
  const value = style[key];
542
- if (Measurer.notZeroStyles.has(key) && !value) ; else if (Measurer.pxStyles.has(key)) {
542
+ if (Measurer.notZeroStyles.has(key) && value === 0) ; else if (typeof value === "number" && Measurer.pxStyles.has(key)) {
543
543
  _style[key] = `${value}px`;
544
544
  } else {
545
545
  _style[key] = value;
@@ -1706,9 +1706,9 @@ class Text extends EventEmitter {
1706
1706
  }
1707
1707
  }
1708
1708
 
1709
- function measureText(options) {
1709
+ function measureText(options, load) {
1710
1710
  const text = new Text(options);
1711
- if (options.load) {
1711
+ if (load) {
1712
1712
  return text.load().then(() => {
1713
1713
  return text.measure();
1714
1714
  });
@@ -1716,9 +1716,9 @@ function measureText(options) {
1716
1716
  return text.measure();
1717
1717
  }
1718
1718
 
1719
- function renderText(options) {
1719
+ function renderText(options, load) {
1720
1720
  const text = new Text(options);
1721
- if (options.load) {
1721
+ if (load) {
1722
1722
  return text.load().then(() => {
1723
1723
  return text.render(options);
1724
1724
  });
package/dist/index.d.cts CHANGED
@@ -264,20 +264,12 @@ declare function uploadColors(ctx: CanvasRenderingContext2D, text: Text$1): void
264
264
 
265
265
  declare function definePlugin(options: TextPlugin): TextPlugin;
266
266
 
267
- declare function measureText(options: TextOptions & {
268
- load: true;
269
- }): Promise<MeasureResult>;
270
- declare function measureText(options: TextOptions & {
271
- load?: false;
272
- }): MeasureResult;
267
+ declare function measureText(options: TextOptions, load: true): Promise<MeasureResult>;
268
+ declare function measureText(options: TextOptions): MeasureResult;
273
269
 
274
270
  type RenderTextOptions = TextOptions & TextRenderOptions;
275
- declare function renderText(options: RenderTextOptions & {
276
- load: true;
277
- }): Promise<void>;
278
- declare function renderText(options: RenderTextOptions & {
279
- load?: false;
280
- }): void;
271
+ declare function renderText(options: RenderTextOptions, load: true): Promise<void>;
272
+ declare function renderText(options: RenderTextOptions): void;
281
273
 
282
274
  declare function getHighlightStyle(style: IDOCStyleDeclaration): IDOCHighlightDeclaration;
283
275
  declare function highlight(): TextPlugin;
package/dist/index.d.mts CHANGED
@@ -264,20 +264,12 @@ declare function uploadColors(ctx: CanvasRenderingContext2D, text: Text$1): void
264
264
 
265
265
  declare function definePlugin(options: TextPlugin): TextPlugin;
266
266
 
267
- declare function measureText(options: TextOptions & {
268
- load: true;
269
- }): Promise<MeasureResult>;
270
- declare function measureText(options: TextOptions & {
271
- load?: false;
272
- }): MeasureResult;
267
+ declare function measureText(options: TextOptions, load: true): Promise<MeasureResult>;
268
+ declare function measureText(options: TextOptions): MeasureResult;
273
269
 
274
270
  type RenderTextOptions = TextOptions & TextRenderOptions;
275
- declare function renderText(options: RenderTextOptions & {
276
- load: true;
277
- }): Promise<void>;
278
- declare function renderText(options: RenderTextOptions & {
279
- load?: false;
280
- }): void;
271
+ declare function renderText(options: RenderTextOptions, load: true): Promise<void>;
272
+ declare function renderText(options: RenderTextOptions): void;
281
273
 
282
274
  declare function getHighlightStyle(style: IDOCStyleDeclaration): IDOCHighlightDeclaration;
283
275
  declare function highlight(): TextPlugin;
package/dist/index.d.ts CHANGED
@@ -264,20 +264,12 @@ declare function uploadColors(ctx: CanvasRenderingContext2D, text: Text$1): void
264
264
 
265
265
  declare function definePlugin(options: TextPlugin): TextPlugin;
266
266
 
267
- declare function measureText(options: TextOptions & {
268
- load: true;
269
- }): Promise<MeasureResult>;
270
- declare function measureText(options: TextOptions & {
271
- load?: false;
272
- }): MeasureResult;
267
+ declare function measureText(options: TextOptions, load: true): Promise<MeasureResult>;
268
+ declare function measureText(options: TextOptions): MeasureResult;
273
269
 
274
270
  type RenderTextOptions = TextOptions & TextRenderOptions;
275
- declare function renderText(options: RenderTextOptions & {
276
- load: true;
277
- }): Promise<void>;
278
- declare function renderText(options: RenderTextOptions & {
279
- load?: false;
280
- }): void;
271
+ declare function renderText(options: RenderTextOptions, load: true): Promise<void>;
272
+ declare function renderText(options: RenderTextOptions): void;
281
273
 
282
274
  declare function getHighlightStyle(style: IDOCStyleDeclaration): IDOCHighlightDeclaration;
283
275
  declare function highlight(): TextPlugin;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- (function(E,lt){typeof exports=="object"&&typeof module<"u"?lt(exports):typeof define=="function"&&define.amd?define(["exports"],lt):(E=typeof globalThis<"u"?globalThis:E||self,lt(E.modernText={}))})(this,function(E){"use strict";var aa=Object.defineProperty;var la=(E,lt,kt)=>lt in E?aa(E,lt,{enumerable:!0,configurable:!0,writable:!0,value:kt}):E[lt]=kt;var A=(E,lt,kt)=>la(E,typeof lt!="symbol"?lt+"":lt,kt);function lt(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:o,stops:a}=ls(t,e.left,e.top,e.width,e.height),l=s.createLinearGradient(r,n,i,o);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function kt(s,t,e){s!=null&&s.color&&(s.color=lt(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=lt(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=lt(e,s.textStrokeColor,t))}function ls(s,t,e,r,n){var p;const i=((p=s.match(/linear-gradient\((.+)\)$/))==null?void 0:p[1])??"",o=i.split(",")[0],a=o.includes("deg")?o:"0deg",l=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),f=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+f,x1:t+r/2+u,y1:e+n/2-f,stops:Array.from(l).map(g=>{let m=g[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(g[3].replace("%",""))/100,color:m}})}}function te(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const i=e.style,o={...i,fill:s.color??i.fill,stroke:s.textStrokeColor??i.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:i.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,o),t.restore()}function $r(s,t,e){const{left:r,top:n,width:i,height:o}=e,a=s.canvas;a.dataset.viewBox=`${r} ${n} ${i} ${o}`,a.dataset.pixelRatio=String(t);const l=i,h=o;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(h*t)),a.style.width=`${l}px`,a.style.height=`${h}px`,s.clearRect(0,0,a.width,a.height),s.scale(t,t),s.translate(-r,-n)}function Lr(s,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;kt(r,n,s),e.forEach(i=>{kt(i.computedStyle,i.lineBox,s),i.fragments.forEach(o=>{kt(o.computedStyle,o.inlineBox,s)})})}var ht=Uint8Array,Pt=Uint16Array,er=Int32Array,Oe=new ht([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ie=new ht([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),rr=new ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fr=function(s,t){for(var e=new Pt(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new er(e[30]),r=1;r<30;++r)for(var i=e[r];i<e[r+1];++i)n[i]=i-e[r]<<5|r;return{b:e,r:n}},zr=Fr(Oe,2),Nr=zr.b,nr=zr.r;Nr[28]=258,nr[258]=28;for(var qr=Fr(Ie,0),hs=qr.b,Gr=qr.r,sr=new Pt(32768),X=0;X<32768;++X){var Gt=(X&43690)>>1|(X&21845)<<1;Gt=(Gt&52428)>>2|(Gt&13107)<<2,Gt=(Gt&61680)>>4|(Gt&3855)<<4,sr[X]=((Gt&65280)>>8|(Gt&255)<<8)>>1}for(var Bt=function(s,t,e){for(var r=s.length,n=0,i=new Pt(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new Pt(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new Pt(1<<t);var l=15-t;for(n=0;n<r;++n)if(s[n])for(var h=n<<4|s[n],c=t-s[n],u=o[s[n]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[sr[u]>>l]=h}else for(a=new Pt(r),n=0;n<r;++n)s[n]&&(a[n]=sr[o[s[n]-1]++]>>15-s[n]);return a},Rt=new ht(288),X=0;X<144;++X)Rt[X]=8;for(var X=144;X<256;++X)Rt[X]=9;for(var X=256;X<280;++X)Rt[X]=7;for(var X=280;X<288;++X)Rt[X]=8;for(var ue=new ht(32),X=0;X<32;++X)ue[X]=5;var cs=Bt(Rt,9,0),us=Bt(Rt,9,1),fs=Bt(ue,5,0),ps=Bt(ue,5,1),ir=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},Tt=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},or=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},ar=function(s){return(s+7)/8|0},Rr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ht(s.subarray(t,e))},ds=["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"],At=function(s,t,e){var r=new Error(t||ds[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,At),!e)throw r;return r},gs=function(s,t,e,r){var n=s.length,i=0;if(!n||t.f&&!t.l)return e||new ht(0);var o=!e,a=o||t.i!=2,l=t.i;o&&(e=new ht(n*3));var h=function($t){var Lt=e.length;if($t>Lt){var qt=new ht(Math.max(Lt*2,$t));qt.set(e),e=qt}},c=t.f||0,u=t.p||0,f=t.b||0,p=t.l,g=t.d,m=t.m,d=t.n,_=n*8;do{if(!p){c=Tt(s,u,1);var b=Tt(s,u+1,3);if(u+=3,b)if(b==1)p=us,g=ps,m=9,d=5;else if(b==2){var x=Tt(s,u,31)+257,O=Tt(s,u+10,15)+4,P=x+Tt(s,u+5,31)+1;u+=14;for(var M=new ht(P),W=new ht(19),H=0;H<O;++H)W[rr[H]]=Tt(s,u+H*3,7);u+=O*3;for(var D=ir(W),et=(1<<D)-1,C=Bt(W,D,1),H=0;H<P;){var F=C[Tt(s,u,et)];u+=F&15;var S=F>>4;if(S<16)M[H++]=S;else{var q=0,z=0;for(S==16?(z=3+Tt(s,u,3),u+=2,q=M[H-1]):S==17?(z=3+Tt(s,u,7),u+=3):S==18&&(z=11+Tt(s,u,127),u+=7);z--;)M[H++]=q}}var U=M.subarray(0,x),L=M.subarray(x);m=ir(U),d=ir(L),p=Bt(U,m,1),g=Bt(L,d,1)}else At(1);else{var S=ar(u)+4,T=s[S-4]|s[S-3]<<8,w=S+T;if(w>n){l&&At(0);break}a&&h(f+T),e.set(s.subarray(S,w),f),t.b=f+=T,t.p=u=w*8,t.f=c;continue}if(u>_){l&&At(0);break}}a&&h(f+131072);for(var nt=(1<<m)-1,I=(1<<d)-1,Z=u;;Z=u){var q=p[or(s,u)&nt],R=q>>4;if(u+=q&15,u>_){l&&At(0);break}if(q||At(2),R<256)e[f++]=R;else if(R==256){Z=u,p=null;break}else{var G=R-254;if(R>264){var H=R-257,$=Oe[H];G=Tt(s,u,(1<<$)-1)+Nr[H],u+=$}var Q=g[or(s,u)&I],Y=Q>>4;Q||At(3),u+=Q&15;var L=hs[Y];if(Y>3){var $=Ie[Y];L+=or(s,u)&(1<<$)-1,u+=$}if(u>_){l&&At(0);break}a&&h(f+131072);var st=f+G;if(f<L){var Qt=i-L,Jt=Math.min(L,st);for(Qt+f<0&&At(3);f<Jt;++f)e[f]=r[Qt+f]}for(;f<st;++f)e[f]=e[f-L]}}t.l=p,t.p=Z,t.b=f,t.f=c,p&&(c=1,t.m=m,t.d=g,t.n=d)}while(!c);return f!=e.length&&o?Rr(e,0,f):e.subarray(0,f)},zt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},fe=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},lr=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,i=e.slice();if(!n)return{t:jr,l:0};if(n==1){var o=new ht(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(w,x){return w.f-x.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,c=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=e[e[h].f<e[u].f?h++:u++],l=e[h!=c&&e[h].f<e[u].f?h++:u++],e[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=i[0].s,r=1;r<n;++r)i[r].s>f&&(f=i[r].s);var p=new Pt(f+1),g=hr(e[c-1],p,0);if(g>t){var r=0,m=0,d=g-t,_=1<<d;for(i.sort(function(x,O){return p[O.s]-p[x.s]||x.f-O.f});r<n;++r){var b=i[r].s;if(p[b]>t)m+=_-(1<<g-p[b]),p[b]=t;else break}for(m>>=d;m>0;){var S=i[r].s;p[S]<t?m-=1<<t-p[S]++-1:++r}for(;r>=0&&m;--r){var T=i[r].s;p[T]==t&&(--p[T],++m)}g=t}return{t:new ht(p),l:g}},hr=function(s,t,e){return s.s==-1?Math.max(hr(s.l,t,e+1),hr(s.r,t,e+1)):t[s.s]=e},Vr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new Pt(++t),r=0,n=s[0],i=1,o=function(l){e[r++]=l},a=1;a<=t;++a)if(s[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=s[a]}return{c:e.subarray(0,r),n:t}},pe=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Wr=function(s,t,e){var r=e.length,n=ar(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var i=0;i<r;++i)s[n+i+4]=e[i];return(n+4+r)*8},Xr=function(s,t,e,r,n,i,o,a,l,h,c){zt(t,c++,e),++n[256];for(var u=lr(n,15),f=u.t,p=u.l,g=lr(i,15),m=g.t,d=g.l,_=Vr(f),b=_.c,S=_.n,T=Vr(m),w=T.c,x=T.n,O=new Pt(19),P=0;P<b.length;++P)++O[b[P]&31];for(var P=0;P<w.length;++P)++O[w[P]&31];for(var M=lr(O,7),W=M.t,H=M.l,D=19;D>4&&!W[rr[D-1]];--D);var et=h+5<<3,C=pe(n,Rt)+pe(i,ue)+o,F=pe(n,f)+pe(i,m)+o+14+3*D+pe(O,W)+2*O[16]+3*O[17]+7*O[18];if(l>=0&&et<=C&&et<=F)return Wr(t,c,s.subarray(l,l+h));var q,z,U,L;if(zt(t,c,1+(F<C)),c+=2,F<C){q=Bt(f,p,0),z=f,U=Bt(m,d,0),L=m;var nt=Bt(W,H,0);zt(t,c,S-257),zt(t,c+5,x-1),zt(t,c+10,D-4),c+=14;for(var P=0;P<D;++P)zt(t,c+3*P,W[rr[P]]);c+=3*D;for(var I=[b,w],Z=0;Z<2;++Z)for(var R=I[Z],P=0;P<R.length;++P){var G=R[P]&31;zt(t,c,nt[G]),c+=W[G],G>15&&(zt(t,c,R[P]>>5&127),c+=R[P]>>12)}}else q=cs,z=Rt,U=fs,L=ue;for(var P=0;P<a;++P){var $=r[P];if($>255){var G=$>>18&31;fe(t,c,q[G+257]),c+=z[G+257],G>7&&(zt(t,c,$>>23&31),c+=Oe[G]);var Q=$&31;fe(t,c,U[Q]),c+=L[Q],Q>3&&(fe(t,c,$>>5&8191),c+=Ie[Q])}else fe(t,c,q[$]),c+=z[$]}return fe(t,c,q[256]),c+z[256]},ys=new er([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),jr=new ht(0),ms=function(s,t,e,r,n,i){var o=i.z||s.length,a=new ht(r+o+5*(1+Math.ceil(o/7e3))+n),l=a.subarray(r,a.length-n),h=i.l,c=(i.r||0)&7;if(t){c&&(l[0]=i.r>>3);for(var u=ys[t-1],f=u>>13,p=u&8191,g=(1<<e)-1,m=i.p||new Pt(32768),d=i.h||new Pt(g+1),_=Math.ceil(e/3),b=2*_,S=function(ce){return(s[ce]^s[ce+1]<<_^s[ce+2]<<b)&g},T=new er(25e3),w=new Pt(288),x=new Pt(32),O=0,P=0,M=i.i||0,W=0,H=i.w||0,D=0;M+2<o;++M){var et=S(M),C=M&32767,F=d[et];if(m[C]=F,d[et]=C,H<=M){var q=o-M;if((O>7e3||W>24576)&&(q>423||!h)){c=Xr(s,l,0,T,w,x,P,W,D,M-D,c),W=O=P=0,D=M;for(var z=0;z<286;++z)w[z]=0;for(var z=0;z<30;++z)x[z]=0}var U=2,L=0,nt=p,I=C-F&32767;if(q>2&&et==S(M-I))for(var Z=Math.min(f,q)-1,R=Math.min(32767,M),G=Math.min(258,q);I<=R&&--nt&&C!=F;){if(s[M+U]==s[M+U-I]){for(var $=0;$<G&&s[M+$]==s[M+$-I];++$);if($>U){if(U=$,L=I,$>Z)break;for(var Q=Math.min(I,$-2),Y=0,z=0;z<Q;++z){var st=M-I+z&32767,Qt=m[st],Jt=st-Qt&32767;Jt>Y&&(Y=Jt,F=st)}}}C=F,F=m[C],I+=C-F&32767}if(L){T[W++]=268435456|nr[U]<<18|Gr[L];var $t=nr[U]&31,Lt=Gr[L]&31;P+=Oe[$t]+Ie[Lt],++w[257+$t],++x[Lt],H=M+U,++O}else T[W++]=s[M],++w[s[M]]}}for(M=Math.max(M,H);M<o;++M)T[W++]=s[M],++w[s[M]];c=Xr(s,l,h,T,w,x,P,W,D,M-D,c),h||(i.r=c&7|l[c/8|0]<<3,c-=7,i.h=d,i.p=m,i.i=M,i.w=H)}else{for(var M=i.w||0;M<o+h;M+=65535){var qt=M+65535;qt>=o&&(l[c/8|0]=h,qt=o),c=Wr(l,c+1,s.subarray(M,qt))}i.i=o}return Rr(a,0,r+ar(c)+n)},Hr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,i=e.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)n+=r+=e[o];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},ws=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ht(i.length+s.length);o.set(i),o.set(s,i.length),s=o,n.w=i.length}return ms(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)},Yr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},xs=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Hr();n.p(t.dictionary),Yr(s,2,n.d())}},vs=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&At(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&At(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function bs(s,t){t||(t={});var e=Hr();e.p(s);var r=ws(s,t,t.dictionary?6:2,4);return xs(r,t),Yr(r,r.length-4,e.d()),r}function Ss(s,t){return gs(s.subarray(vs(s,t),-4),{i:2},t,t)}var Cs=typeof TextDecoder<"u"&&new TextDecoder,Ps=0;try{Cs.decode(jr,{stream:!0}),Ps=1}catch{}const Ms="modern-font";function de(s,t){if(!s)throw new Error(`[${Ms}] ${t}`)}function _s(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 ee(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}function Ts(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 ke(s){s=Ts(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}var Zr=Object.defineProperty,Is=(s,t,e)=>t in s?Zr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ct=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Zr(t,e,n),n},ks=(s,t,e)=>(Is(s,t+"",e),e);const Be={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ut(){return function(s,t){Object.defineProperty(s.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class ot extends DataView{constructor(t,e,r,n){super(_s(t),e,r),this.littleEndian=n,ks(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,i=this[n](e,r);return this.cursor+=Be[t],i}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let i=0,o=r.length;i<o;i++)n+=String.fromCharCode(r[i]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const i=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[i](r,e,n);return this.cursor+=Be[t.toLowerCase()],o}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,i=t.length,o;n<i;++n)o=t.charCodeAt(n)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=ee(t);r=n.byteLength;for(let i=0;i<r;++i)this.setUint8(e+i,n.getUint8(i))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}ct([ut()],ot.prototype,"readInt8"),ct([ut()],ot.prototype,"readInt16"),ct([ut()],ot.prototype,"readInt32"),ct([ut()],ot.prototype,"readUint8"),ct([ut()],ot.prototype,"readUint16"),ct([ut()],ot.prototype,"readUint32"),ct([ut()],ot.prototype,"readFloat32"),ct([ut()],ot.prototype,"readFloat64"),ct([ut()],ot.prototype,"writeInt8"),ct([ut()],ot.prototype,"writeInt16"),ct([ut()],ot.prototype,"writeInt32"),ct([ut()],ot.prototype,"writeUint8"),ct([ut()],ot.prototype,"writeUint16"),ct([ut()],ot.prototype,"writeUint32"),ct([ut()],ot.prototype,"writeFloat32"),ct([ut()],ot.prototype,"writeFloat64");var Bs=Object.defineProperty,Es=(s,t,e)=>t in s?Bs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ds=(s,t,e)=>(Es(s,t+"",e),e);const Kr=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,i)=>{if(typeof i!="string")return;let o=Kr.get(n);o||(o={columns:[],byteLength:0},Kr.set(n,o));const a={...t,name:i,byteLength:e*Be[r],offset:t.offset??o.columns.reduce((l,h)=>l+h.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((l,h)=>l+Be[h.type]*(h.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class _t{constructor(t,e,r,n){Ds(this,"view"),this.view=new ot(t,e,r,n)}}class cr extends _t{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 Qr=Object.defineProperty,Us=(s,t,e)=>t in s?Qr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Qr(t,e,n),n},Jr=(s,t,e)=>(Us(s,typeof t!="symbol"?t+"":t,e),e);const wt=class ns extends cr{constructor(){super(...arguments),Jr(this,"format","EmbeddedOpenType"),Jr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=ke(n.fontFamily||""),o=i.length,a=ke(n.fontStyle||""),l=a.length,h=ke(n.version||""),c=h.length,u=ke(n.fullName||""),f=u.length,p=86+o+4+l+4+c+4+f+2+t.view.byteLength,g=new ns(new ArrayBuffer(p),0,p,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(g.FontPANOSE=m.fontPANOSE,g.Italic=m.fsSelection,g.Weight=m.usWeightClass,g.fsType=m.fsType,g.UnicodeRange=m.ulUnicodeRange,g.CodePageRange=m.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(i),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(f),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};mt([y("uint32")],wt.prototype,"EOTSize"),mt([y("uint32")],wt.prototype,"FontDataSize"),mt([y("uint32")],wt.prototype,"Version"),mt([y("uint32")],wt.prototype,"Flags"),mt([y({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),mt([y("uint8")],wt.prototype,"Charset"),mt([y("uint8")],wt.prototype,"Italic"),mt([y("uint32")],wt.prototype,"Weight"),mt([y("uint16")],wt.prototype,"fsType"),mt([y("uint16")],wt.prototype,"MagicNumber"),mt([y({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),mt([y({type:"uint8",size:8})],wt.prototype,"CodePageRange"),mt([y("uint32")],wt.prototype,"CheckSumAdjustment"),mt([y({type:"uint8",size:16})],wt.prototype,"Reserved"),mt([y("uint16")],wt.prototype,"Padding1");var $s=Object.defineProperty,Ee=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&$s(t,e,n),n};class ge extends _t{constructor(t,e){super(t,e,16)}}Ee([y({type:"char",size:4})],ge.prototype,"tag"),Ee([y("uint32")],ge.prototype,"checkSum"),Ee([y("uint32")],ge.prototype,"offset"),Ee([y("uint32")],ge.prototype,"length");const ur=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Ls=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Fs=Object.defineProperty,zs=(s,t,e)=>t in s?Fs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ye=(s,t,e)=>(zs(s,typeof t!="symbol"?t+"":t,e),e);class tn{constructor(t){ye(this,"index"),ye(this,"name"),ye(this,"isComposite",!1),ye(this,"components",[]),ye(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={},i){const o=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=o,yScale:l=o}=n,h=this.pathCommands,c=[];for(let u=0,f=h.length;u<f;u+=1){const p=h[u];p.type==="M"?c.push({type:"M",x:t+p.x*a,y:e+-p.y*l}):p.type==="L"?c.push({type:"L",x:t+p.x*a,y:e+-p.y*l}):p.type==="Q"?c.push({type:"Q",x1:t+p.x1*a,y1:e+-p.y1*l,x:t+p.x*a,y:e+-p.y*l}):p.type==="C"?c.push({type:"C",x1:t+p.x1*a,y1:e+-p.y1*l,x2:t+p.x2*a,y2:e+-p.y2*l,x:t+p.x*a,y:e+-p.y*l}):p.type==="Z"&&c.push({type:"Z"})}return c}}class Ns extends tn{parse(t,e,r){const n=this,{nominalWidthX:i,defaultWidthX:o,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,f,p,g;const m=[],d=[];let _=0,b=!1,S=!1,T=o,w=0,x=0;function O(C,F){m.push({type:"L",x:C,y:F})}function P(C,F,q,z,U,L){m.push({type:"C",x1:C,y1:F,x2:q,y2:z,x:U,y:L})}function M(C,F){S&&h!==2&&W(),S=!0,m.push({type:"M",x:C,y:F})}function W(){m.push({type:"Z"})}function H(C){m.push(...C)}function D(){d.length%2!==0&&!b&&(T=d.shift()+i),_+=d.length>>1,d.length=0,b=!0}function et(C){let F,q,z,U,L,nt,I,Z,R,G,$,Q,Y=0;for(;Y<C.length;){let st=C[Y++];switch(st){case 1:D();break;case 3:D();break;case 4:d.length>1&&!b&&(T=d.shift()+i,b=!0),x+=d.pop(),M(w,x);break;case 5:for(;d.length>0;)w+=d.shift(),x+=d.shift(),O(w,x);break;case 6:for(;d.length>0&&(w+=d.shift(),O(w,x),d.length!==0);)x+=d.shift(),O(w,x);break;case 7:for(;d.length>0&&(x+=d.shift(),O(w,x),d.length!==0);)w+=d.shift(),O(w,x);break;case 8:for(;d.length>0;)u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+d.shift(),P(u,f,p,g,w,x);break;case 10:L=d.pop()+l,nt=t.subrs[L],nt&&et(nt);break;case 11:return;case 12:switch(st=C[Y],Y+=1,st){case 35:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),I=p+d.shift(),Z=g+d.shift(),R=I+d.shift(),G=Z+d.shift(),$=R+d.shift(),Q=G+d.shift(),w=$+d.shift(),x=Q+d.shift(),d.shift(),P(u,f,p,g,I,Z),P(R,G,$,Q,w,x);break;case 34:u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),I=p+d.shift(),Z=g,R=I+d.shift(),G=g,$=R+d.shift(),Q=x,w=$+d.shift(),P(u,f,p,g,I,Z),P(R,G,$,Q,w,x);break;case 36:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),I=p+d.shift(),Z=g,R=I+d.shift(),G=g,$=R+d.shift(),Q=G+d.shift(),w=$+d.shift(),P(u,f,p,g,I,Z),P(R,G,$,Q,w,x);break;case 37:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),I=p+d.shift(),Z=g+d.shift(),R=I+d.shift(),G=Z+d.shift(),$=R+d.shift(),Q=G+d.shift(),Math.abs($-w)>Math.abs(Q-x)?w=$+d.shift():x=Q+d.shift(),P(u,f,p,g,I,Z),P(R,G,$,Q,w,x);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+st}`),d.length=0}break;case 14:if(d.length>=4){const Qt=ur[d.pop()],Jt=ur[d.pop()],$t=d.pop(),Lt=d.pop();if(Qt&&Jt){n.isComposite=!0,n.components=[];const qt=t.charset.indexOf(Qt),ce=t.charset.indexOf(Jt);n.components.push({glyphIndex:ce,dx:0,dy:0}),n.components.push({glyphIndex:qt,dx:Lt,dy:$t}),H(r.get(ce).pathCommands);const Er=JSON.parse(JSON.stringify(r.get(qt).pathCommands));for(let Dr=0;Dr<Er.length;Dr+=1){const Ft=Er[Dr];Ft.type!=="Z"&&(Ft.x+=Lt,Ft.y+=$t),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Lt,Ft.y1+=$t),Ft.type==="C"&&(Ft.x2+=Lt,Ft.y2+=$t)}H(Er)}}else d.length>0&&!b&&(T=d.shift()+i,b=!0);S&&h!==2&&(W(),S=!1);break;case 18:D();break;case 19:case 20:D(),Y+=_+7>>3;break;case 21:d.length>2&&!b&&(T=d.shift()+i,b=!0),x+=d.pop(),w+=d.pop(),M(w,x);break;case 22:d.length>1&&!b&&(T=d.shift()+i,b=!0),w+=d.pop(),M(w,x);break;case 23:D();break;case 24:for(;d.length>2;)u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+d.shift(),P(u,f,p,g,w,x);w+=d.shift(),x+=d.shift(),O(w,x);break;case 25:for(;d.length>6;)w+=d.shift(),x+=d.shift(),O(w,x);u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+d.shift(),P(u,f,p,g,w,x);break;case 26:for(d.length%2&&(w+=d.shift());d.length>0;)u=w,f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p,x=g+d.shift(),P(u,f,p,g,w,x);break;case 27:for(d.length%2&&(x+=d.shift());d.length>0;)u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g,P(u,f,p,g,w,x);break;case 28:F=C[Y],q=C[Y+1],d.push((F<<24|q<<16)>>16),Y+=2;break;case 29:L=d.pop()+a,nt=t.gsubrs[L],nt&&et(nt);break;case 30:for(;d.length>0&&(u=w,f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+(d.length===1?d.shift():0),P(u,f,p,g,w,x),d.length!==0);)u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),x=g+d.shift(),w=p+(d.length===1?d.shift():0),P(u,f,p,g,w,x);break;case 31:for(;d.length>0&&(u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),x=g+d.shift(),w=p+(d.length===1?d.shift():0),P(u,f,p,g,w,x),d.length!==0);)u=w,f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+(d.length===1?d.shift():0),P(u,f,p,g,w,x);break;default:st<32?console.warn(`Glyph ${c}: unknown operator ${st}`):st<247?d.push(st-139):st<251?(F=C[Y],Y+=1,d.push((st-247)*256+F+108)):st<255?(F=C[Y],Y+=1,d.push(-(st-251)*256-F-108)):(F=C[Y],q=C[Y+1],z=C[Y+2],U=C[Y+3],Y+=4,d.push((F<<24|q<<16|z<<8|U)/65536))}}}et(e),this.pathCommands=m,b&&(this.advanceWidth=T)}}var qs=Object.defineProperty,Gs=(s,t,e)=>t in s?qs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Rs=(s,t,e)=>(Gs(s,t+"",e),e);class en{constructor(t){this._sfnt=t,Rs(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[t]=r}return r}}class Vs extends en{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Ns({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var rn=Object.defineProperty,Ws=(s,t,e)=>t in s?rn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,nn=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&rn(t,e,n),n},De=(s,t,e)=>(Ws(s,typeof t!="symbol"?t+"":t,e),e);class Ue extends _t{constructor(t,e,r,n){super(t,e,r,n),De(this,"_offsets"),De(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let i=0,o=e+1;i<o;i++){const a=this.view;let l=0;for(let h=0;h<r;h++)l<<=8,l+=a.readUint8();n.push(l)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],o=r+e[t+1]-n;return this._isString?this.view.readString(n,o):this.view.readBytes(n,o)}}nn([y("uint16")],Ue.prototype,"count"),nn([y("uint8")],Ue.prototype,"offsetSize");class $e extends Ue{constructor(){super(...arguments),De(this,"_isString",!1)}}class sn extends Ue{constructor(){super(...arguments),De(this,"_isString",!0)}}const Xs=[".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"],js=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Hs=[".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"],Ys=[".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?Xs[t]:s[t-391]}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,on=(s,t,e)=>(Ks(s,typeof t!="symbol"?t+"":t,e),e);function j(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const i={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(o){this._setProp(i,o)},configurable:!0,enumerable:!0})}}class an extends _t{constructor(){super(...arguments),on(this,"_dict"),on(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),o=i>>4,a=i&15;if(o===r||(e+=n[o],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,i,o;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),r<<24|n<<16|i<<8|o;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),n[i]=e,e=[]):e.push(this._readOperand(i))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Le(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Qs=Object.defineProperty,fr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Qs(t,e,n),n};class Fe extends an{}fr([j(19)],Fe.prototype,"subrs"),fr([j(20)],Fe.prototype,"defaultWidthX"),fr([j(21)],Fe.prototype,"nominalWidthX");var Js=Object.defineProperty,J=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Js(t,e,n),n};class K extends an{}J([j(0,"string")],K.prototype,"version"),J([j(1,"string")],K.prototype,"notice"),J([j(1200,"string")],K.prototype,"copyright"),J([j(2,"string")],K.prototype,"fullName"),J([j(3,"string")],K.prototype,"familyName"),J([j(4,"string")],K.prototype,"weight"),J([j(1201)],K.prototype,"isFixedPitch"),J([j(1202)],K.prototype,"italicAngle"),J([j(1203,"number",-100)],K.prototype,"underlinePosition"),J([j(1204,"number",50)],K.prototype,"underlineThickness"),J([j(1205)],K.prototype,"paintType"),J([j(1206,"number",2)],K.prototype,"charstringType"),J([j(1207,"number[]",[.001,0,0,.001,0,0])],K.prototype,"fontMatrix"),J([j(13)],K.prototype,"uniqueId"),J([j(5,"number[]",[0,0,0,0])],K.prototype,"fontBBox"),J([j(1208)],K.prototype,"strokeWidth"),J([j(14)],K.prototype,"xuid"),J([j(15)],K.prototype,"charset"),J([j(16)],K.prototype,"encoding"),J([j(17)],K.prototype,"charStrings"),J([j(18,"number[]",[0,0])],K.prototype,"private");var ti=Object.defineProperty,ei=(s,t,e)=>t in s?ti(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,pr=(s,t,e)=>(ei(s,typeof t!="symbol"?t+"":t,e),e);function ft(s,t=s){return e=>{ze.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(ze.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const ln=class Ae{constructor(t){pr(this,"tables",new Map),pr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,i=Array.from({length:n}),o=e.get(0);for(let a=0;a<n;a+=1)i[a]=e.get(r[a])||o;return i}getPathCommands(t,e,r,n,i){const o=[];return this.forEachGlyph(t,e,r,n,i,(a,l,h,c,u)=>{o.push(...a.getPathCommands(l,h,c,u,this))}),o}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,i={},o){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];o.call(this,c,e,r,n,i),c.advanceWidth&&(e+=c.advanceWidth*a),i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e}clone(){return new Ae(this.tableViews)}delete(t){const e=Ae.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Ae.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Ae.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const i=this.tableViews.get(t);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};pr(ln,"tableDefinitions",new Map);let ze=ln;class pt extends _t{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var hn=Object.defineProperty,ri=Object.getOwnPropertyDescriptor,ni=(s,t,e)=>t in s?hn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,me=(s,t,e,r)=>{for(var n=r>1?void 0:r?ri(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&hn(t,e,n),n},dr=(s,t,e)=>(ni(s,typeof t!="symbol"?t+"":t,e),e);let re=class extends pt{constructor(s,t,e,r){super(s,t,e,r),dr(this,"_glyphs"),dr(this,"privateDict"),dr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Vs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var s;return((s=this.privateDict)==null?void 0:s.defaultWidthX)??0}get nominalWidthX(){var s;return((s=this.privateDict)==null?void 0:s.nominalWidthX)??0}get subrs(){var s;return((s=this.subrsIndex)==null?void 0:s.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const s=this.view,{buffer:t,byteOffset:e}=s,r=e+4;this.nameIndex=new sn(t,r),this.topDictIndex=new $e(t,this.nameIndex.endOffset),this.stringIndex=new sn(t,this.topDictIndex.endOffset),this.globalSubrIndex=new $e(t,this.stringIndex.endOffset),this.topDict=new K(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const n=this.topDict.private[0],i=this.topDict.private[1];n&&(this.privateDict=new Fe(t,e+i,n).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new $e(t,e+i+this.privateDict.subrs))),this.charStringsIndex=new $e(t,e+this.topDict.charStrings);const o=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=js:this.topDict.charset===1?this.charset=Hs:this.topDict.charset===2?this.charset=Ys:this.charset=this._readCharset(e+this.topDict.charset,o,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=ur:this.topDict.encoding===1?this.encoding=Ls:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(s,t,e){const r=this.view;r.seek(s);let n,i,o;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(n=0;n<t;n+=1)i=r.readUint16(),a.push(Le(e,i));else if(l===1)for(;a.length<=t;)for(i=r.readUint16(),o=r.readUint8(),n=0;n<=o;n+=1)a.push(Le(e,i)),i+=1;else if(l===2)for(;a.length<=t;)for(i=r.readUint16(),o=r.readUint16(),n=0;n<=o;n+=1)a.push(Le(e,i)),i+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(s){const t=this.view;t.seek(s);let e,r;const n={},i=t.readUint8();if(i===0){const o=t.readUint8();for(e=0;e<o;e+=1)r=t.readUint8(),n[r]=e}else if(i===1){const o=t.readUint8();for(r=1,e=0;e<o;e+=1){const a=t.readUint8(),l=t.readUint8();for(let h=a;h<=a+l;h+=1)n[h]=r,r+=1}}else console.warn(`unknown encoding format:${i}`);return n}_calcSubroutineBias(s){let t;return s.length<1240?t=107:s.length<33900?t=1131:t=32768,t}};me([y("uint8")],re.prototype,"majorVersion",2),me([y("uint8")],re.prototype,"minorVersion",2),me([y("uint8")],re.prototype,"headerSize",2),me([y("uint8")],re.prototype,"offsetSize",2),re=me([ft("CFF ","cff")],re);var si=Object.defineProperty,Ne=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&si(t,e,n),n};const we=class ss extends _t{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ss;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};Ne([y("uint16")],we.prototype,"format"),Ne([y("uint16")],we.prototype,"length"),Ne([y("uint16")],we.prototype,"language"),Ne([y({type:"uint8",size:256})],we.prototype,"glyphIndexArray");let cn=we;var ii=Object.defineProperty,gr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ii(t,e,n),n};class qe extends _t{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,i=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(h=>h===n);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<i[0].firstCode||h>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(h-i[0].firstCode)>=o.length?l=0:(l=o[i[0].idRangeOffset+(h-i[0].firstCode)],l!==0&&(l=l+i[0].idDelta)),l!==0&&l<t&&e.set(h,l);else{const c=r[h];for(let u=0,f=i[c].entryCount;u<f;u++)if(i[c].idRangeOffset+u>=o.length?l=0:(l=o[i[c].idRangeOffset+u],l!==0&&(l=l+i[c].idDelta)),l!==0&&l<t){const p=(h<<8|u+i[c].firstCode)%65535;e.set(p,l)}}return e}}gr([y("uint16")],qe.prototype,"format"),gr([y("uint16")],qe.prototype,"length"),gr([y("uint16")],qe.prototype,"language");function un(s){return s>32767?s-65536:s<-32767?s+65536:s}function fn(s,t){let e;const r=[];let n={};return s.forEach((i,o)=>{t&&o>t||((!e||o!==e.unicode+1||i!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:o,startId:i,delta:un(i-o)}):(n.start=Number(o),n.startId=i,n.delta=un(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var oi=Object.defineProperty,Ht=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&oi(t,e,n),n};const Vt=class is extends _t{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=fn(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new is(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=i,o.entrySelector=n,o.rangeShift=2*r-i,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,o=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<e;++h)for(let c=n[h],u=i[h];c<=u;++c)if(o[h]===0)t.set(c,(c+a[h])%65536);else{const f=h+o[h]/2+(c-n[h])-r,p=l[f];p!==0?t.set(c,(p+a[h])%65536):t.set(c,0)}return t.delete(65535),t}};Ht([y("uint16")],Vt.prototype,"format"),Ht([y("uint16")],Vt.prototype,"length"),Ht([y("uint16")],Vt.prototype,"language"),Ht([y("uint16")],Vt.prototype,"segCountX2"),Ht([y("uint16")],Vt.prototype,"searchRange"),Ht([y("uint16")],Vt.prototype,"entrySelector"),Ht([y("uint16")],Vt.prototype,"rangeShift");let pn=Vt;var ai=Object.defineProperty,xe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ai(t,e,n),n};class ne extends _t{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}}xe([y("uint16")],ne.prototype,"format"),xe([y("uint16")],ne.prototype,"length"),xe([y("uint16")],ne.prototype,"language"),xe([y("uint16")],ne.prototype,"firstCode"),xe([y("uint16")],ne.prototype,"entryCount");var li=Object.defineProperty,ve=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&li(t,e,n),n};const se=class os extends _t{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=fn(t),r=new os(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const i=e[r];let o=i.startGlyphCode,a=i.startCharCode;const l=i.endCharCode;for(;a<=l;)t.set(a++,o++)}return t}};ve([y("uint16")],se.prototype,"format"),ve([y("uint16")],se.prototype,"reserved"),ve([y("uint32")],se.prototype,"length"),ve([y("uint32")],se.prototype,"language"),ve([y("uint32")],se.prototype,"nGroups");let dn=se;var hi=Object.defineProperty,yr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&hi(t,e,n),n};class Ge extends _t{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:i}=e[r];i.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}yr([y("uint16")],Ge.prototype,"format"),yr([y("uint32")],Ge.prototype,"length"),yr([y("uint32")],Ge.prototype,"numVarSelectorRecords");var gn=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,ui=(s,t,e)=>t in s?gn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mr=(s,t,e,r)=>{for(var n=r>1?void 0:r?ci(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&gn(t,e,n),n},yn=(s,t,e)=>(ui(s,typeof t!="symbol"?t+"":t,e),e);let be=class extends pt{constructor(){super(...arguments),yn(this,"_unicodeToGlyphIndexMap"),yn(this,"_glyphIndexToUnicodesMap")}static from(s){const t=Array.from(s.keys()).some(c=>c>65535),e=pn.from(s),r=cn.from(s),n=t?dn.from(s):void 0,i=4+(n?32:24),o=i+e.view.byteLength,a=o+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:i},{platformID:1,platformSpecificID:0,offset:o},{platformID:3,platformSpecificID:1,offset:i},n&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),h=new be(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+((n==null?void 0:n.view.byteLength)??0)));return h.numberSubtables=l.length,h.view.seek(4),l.forEach(c=>{h.view.writeUint16(c.platformID),h.view.writeUint16(c.platformSpecificID),h.view.writeUint32(c.offset)}),h.view.writeBytes(e.view,i),h.view.writeBytes(r.view,o),n&&h.view.writeBytes(n.view,a),h}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,n=e.length;r<n;r++){const i=e[r],o=t.get(i);s.has(o)?s.get(o).push(i):s.set(o,[i])}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 cn(this.view.buffer,t.offset);break;case 2:r=new qe(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new pn(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new ne(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new dn(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new Ge(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){var o,a,l,h,c;const s=this.readSubtables(),t=(o=s.find(u=>u.format===0))==null?void 0:o.view,e=(a=s.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:a.view,r=(l=s.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:l.view,n=(h=s.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:h.view,i=(c=s.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:c.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(e==null?void 0:e.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[]])}};mr([y("uint16")],be.prototype,"version",2),mr([y("uint16")],be.prototype,"numberSubtables",2),be=mr([ft("cmap")],be);class fi extends tn{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const i=t[n];r.push(i),i.lastPointOfContour&&(e.push(r),r=[])}return de(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const i=t[n],o={x:e.xScale*i.x+e.scale10*i.y+e.dx,y:e.scale01*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(t,e,r,n,i){let o;return(e&n)>0?(o=t.view.readUint8(),e&i||(o=-o),o=r+o):(e&i)>0?o=r:o=r+t.view.readInt16(),o}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let m=0;m<n;m++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();de(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;de(u<2e4,`Bad numberOfCoordinates:${c}`);const f=[];let p,g=0;for(;g<u;)if(p=t.view.readUint8(),f.push(p),g++,p&8&&g<u){const m=t.view.readUint8();for(let d=0;d<m;d++)f.push(p),g++}if(de(f.length===u,`Bad flags length: ${f.length}, numberOfCoordinates: ${u}`),a.length>0){const m=[];let d;if(u>0){for(let S=0;S<u;S+=1)p=f[S],d={},d.onCurve=!!(p&1),d.lastPointOfContour=a.includes(S),m.push(d);let _=0;for(let S=0;S<u;S+=1)p=f[S],d=m[S],d.x=this._parseGlyphCoordinate(t,p,_,2,16),_=d.x;let b=0;for(let S=0;S<u;S+=1)p=f[S],d=m[S],d.y=this._parseGlyphCoordinate(t,p,b,4,32),b=d.y}this.points=m}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=t.view.readUint16();const h={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=t.view.readInt16(),h.dy=t.view.readInt16()):h.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(h.dx=t.view.readInt8(),h.dy=t.view.readInt8()):h.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?h.xScale=h.yScale=t.view.readInt16()/16384:(a&64)>0?(h.xScale=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384):(a&128)>0&&(h.xScale=t.view.readInt16()/16384,h.scale01=t.view.readInt16()/16384,h.scale10=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=r.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{de(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let f=h.points[l.matchedPoints[1]];const p={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};f=this._transformPoints([f],p)[0],p.dx=u.x-f.x,p.dy=u.y-f.y,c=this._transformPoints(h.points,p)}this.points=this.points.concat(c)}}const i=[],o=this._parseContours(this.points);for(let a=0,l=o.length;a<l;++a){const h=o[a];let c=h[h.length-1],u=h[0];c.onCurve?i.push({type:"M",x:c.x,y:c.y}):u.onCurve?i.push({type:"M",x:u.x,y:u.y}):i.push({type:"M",x:(c.x+u.x)*.5,y:(c.y+u.y)*.5});for(let f=0,p=h.length;f<p;++f)if(c=u,u=h[(f+1)%p],c.onCurve)i.push({type:"L",x:c.x,y:c.y});else{let g=u;u.onCurve||(g={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),i.push({type:"Q",x1:c.x,y1:c.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class pi extends en{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new fi({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var mn=Object.defineProperty,di=Object.getOwnPropertyDescriptor,gi=(s,t,e)=>t in s?mn(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?di(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&mn(t,e,n),n},mi=(s,t,e)=>(gi(s,t+"",e),e);let wr=class extends pt{constructor(){super(...arguments),mi(this,"_glyphs")}static from(s){const t=s.reduce((r,n)=>r+n.byteLength,0),e=new wr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeBytes(r)}),e}get glyphs(){return this._glyphs??(this._glyphs=new pi(this._sfnt))}};wr=yi([ft("glyf")],wr);var wi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,vi=(s,t,e,r)=>{for(var n=r>1?void 0:r?xi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&wi(t,e,n),n};let wn=class extends pt{};wn=vi([ft("GPOS","gpos")],wn);var bi=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,Yt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Si(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&bi(t,e,n),n};let Wt=class extends pt{};Yt([y("uint16")],Wt.prototype,"majorVersion",2),Yt([y("uint16")],Wt.prototype,"minorVersion",2),Yt([y("uint16")],Wt.prototype,"scriptListOffset",2),Yt([y("uint16")],Wt.prototype,"featureListOffset",2),Yt([y("uint16")],Wt.prototype,"lookupListOffset",2),Yt([y("uint16")],Wt.prototype,"featureVariationsOffset",2),Wt=Yt([ft("GSUB","gsub")],Wt);var Ci=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,it=(s,t,e,r)=>{for(var n=r>1?void 0:r?Pi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ci(t,e,n),n};let rt=class extends pt{constructor(s=new ArrayBuffer(54),t){super(s,t,Math.min(54,s.byteLength-(t??0)))}};it([y("fixed")],rt.prototype,"version",2),it([y("fixed")],rt.prototype,"fontRevision",2),it([y("uint32")],rt.prototype,"checkSumAdjustment",2),it([y("uint32")],rt.prototype,"magickNumber",2),it([y("uint16")],rt.prototype,"flags",2),it([y("uint16")],rt.prototype,"unitsPerEm",2),it([y({type:"longDateTime"})],rt.prototype,"created",2),it([y({type:"longDateTime"})],rt.prototype,"modified",2),it([y("int16")],rt.prototype,"xMin",2),it([y("int16")],rt.prototype,"yMin",2),it([y("int16")],rt.prototype,"xMax",2),it([y("int16")],rt.prototype,"yMax",2),it([y("uint16")],rt.prototype,"macStyle",2),it([y("uint16")],rt.prototype,"lowestRecPPEM",2),it([y("int16")],rt.prototype,"fontDirectionHint",2),it([y("int16")],rt.prototype,"indexToLocFormat",2),it([y("int16")],rt.prototype,"glyphDataFormat",2),rt=it([ft("head")],rt);var Mi=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,xt=(s,t,e,r)=>{for(var n=r>1?void 0:r?_i(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Mi(t,e,n),n};let dt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};xt([y("fixed")],dt.prototype,"version",2),xt([y("int16")],dt.prototype,"ascent",2),xt([y("int16")],dt.prototype,"descent",2),xt([y("int16")],dt.prototype,"lineGap",2),xt([y("uint16")],dt.prototype,"advanceWidthMax",2),xt([y("int16")],dt.prototype,"minLeftSideBearing",2),xt([y("int16")],dt.prototype,"minRightSideBearing",2),xt([y("int16")],dt.prototype,"xMaxExtent",2),xt([y("int16")],dt.prototype,"caretSlopeRise",2),xt([y("int16")],dt.prototype,"caretSlopeRun",2),xt([y("int16")],dt.prototype,"caretOffset",2),xt([y({type:"int16",size:4})],dt.prototype,"reserved",2),xt([y("int16")],dt.prototype,"metricDataFormat",2),xt([y("uint16")],dt.prototype,"numOfLongHorMetrics",2),dt=xt([ft("hhea")],dt);var xn=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Ai=(s,t,e)=>t in s?xn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Oi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ti(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&xn(t,e,n),n},Ii=(s,t,e)=>(Ai(s,t+"",e),e);let xr=class extends pt{constructor(){super(...arguments),Ii(this,"_metrics")}static from(s){const t=s.length*4,e=new xr(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,i)=>(i<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};xr=Oi([ft("hmtx")],xr);var ki=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Ei=(s,t,e,r)=>{for(var n=r>1?void 0:r?Bi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&ki(t,e,n),n};let vn=class extends pt{};vn=Ei([ft("kern","kern")],vn);var bn=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,Ui=(s,t,e)=>t in s?bn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,$i=(s,t,e,r)=>{for(var n=r>1?void 0:r?Di(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&bn(t,e,n),n},Li=(s,t,e)=>(Ui(s,t+"",e),e);let vr=class extends pt{constructor(){super(...arguments),Li(this,"_locations")}static from(s,t=1){const e=s.length*(t?4:2),r=new vr(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)}};vr=$i([ft("loca")],vr);var Fi=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,gt=(s,t,e,r)=>{for(var n=r>1?void 0:r?zi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Fi(t,e,n),n};let at=class extends pt{constructor(s=new ArrayBuffer(32),t){super(s,t,Math.min(32,s.byteLength-(t??0)))}};gt([y("fixed")],at.prototype,"version",2),gt([y("uint16")],at.prototype,"numGlyphs",2),gt([y("uint16")],at.prototype,"maxPoints",2),gt([y("uint16")],at.prototype,"maxContours",2),gt([y("uint16")],at.prototype,"maxComponentPoints",2),gt([y("uint16")],at.prototype,"maxComponentContours",2),gt([y("uint16")],at.prototype,"maxZones",2),gt([y("uint16")],at.prototype,"maxTwilightPoints",2),gt([y("uint16")],at.prototype,"maxStorage",2),gt([y("uint16")],at.prototype,"maxFunctionDefs",2),gt([y("uint16")],at.prototype,"maxInstructionDefs",2),gt([y("uint16")],at.prototype,"maxStackElements",2),gt([y("uint16")],at.prototype,"maxSizeOfInstructions",2),gt([y("uint16")],at.prototype,"maxComponentElements",2),gt([y("uint16")],at.prototype,"maxComponentDepth",2),at=gt([ft("maxp")],at);var Sn=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,qi=(s,t,e)=>t in s?Sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Re=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ni(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Sn(t,e,n),n},Gi=(s,t,e)=>(qi(s,t+"",e),e);const Cn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},br={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Ri={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Pn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let Se=class extends pt{constructor(){super(...arguments),Gi(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const s=this.count;this.view.seek(6);const t=[];for(let a=0;a<s;++a)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const e=this.stringOffset;for(let a=0;a<s;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let r=br.Macintosh,n=Ri.Default,i=0;t.some(a=>a.platform===br.Microsoft&&a.encoding===Pn.UCS2&&a.language===1033)&&(r=br.Microsoft,n=Pn.UCS2,i=1033);const o={};for(let a=0;a<s;++a){const l=t[a];l.platform===r&&l.encoding===n&&l.language===i&&Cn[l.nameId]&&(o[Cn[l.nameId]]=i===0?As(l.name):Os(l.name))}return o}};Re([y("uint16")],Se.prototype,"format",2),Re([y("uint16")],Se.prototype,"count",2),Re([y("uint16")],Se.prototype,"stringOffset",2),Se=Re([ft("name")],Se);var Vi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,B=(s,t,e,r)=>{for(var n=r>1?void 0:r?Wi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Vi(t,e,n),n};let k=class extends pt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};B([y("uint16")],k.prototype,"version",2),B([y("int16")],k.prototype,"xAvgCharWidth",2),B([y("uint16")],k.prototype,"usWeightClass",2),B([y("uint16")],k.prototype,"usWidthClass",2),B([y("uint16")],k.prototype,"fsType",2),B([y("uint16")],k.prototype,"ySubscriptXSize",2),B([y("uint16")],k.prototype,"ySubscriptYSize",2),B([y("uint16")],k.prototype,"ySubscriptXOffset",2),B([y("uint16")],k.prototype,"ySubscriptYOffset",2),B([y("uint16")],k.prototype,"ySuperscriptXSize",2),B([y("uint16")],k.prototype,"ySuperscriptYSize",2),B([y("uint16")],k.prototype,"ySuperscriptXOffset",2),B([y("uint16")],k.prototype,"ySuperscriptYOffset",2),B([y("uint16")],k.prototype,"yStrikeoutSize",2),B([y("uint16")],k.prototype,"yStrikeoutPosition",2),B([y("uint16")],k.prototype,"sFamilyClass",2),B([y({type:"uint8"})],k.prototype,"bFamilyType",2),B([y({type:"uint8"})],k.prototype,"bSerifStyle",2),B([y({type:"uint8"})],k.prototype,"bWeight",2),B([y({type:"uint8"})],k.prototype,"bProportion",2),B([y({type:"uint8"})],k.prototype,"bContrast",2),B([y({type:"uint8"})],k.prototype,"bStrokeVariation",2),B([y({type:"uint8"})],k.prototype,"bArmStyle",2),B([y({type:"uint8"})],k.prototype,"bLetterform",2),B([y({type:"uint8"})],k.prototype,"bMidline",2),B([y({type:"uint8"})],k.prototype,"bXHeight",2),B([y({type:"uint8",size:16})],k.prototype,"ulUnicodeRange",2),B([y({type:"char",size:4})],k.prototype,"achVendID",2),B([y("uint16")],k.prototype,"fsSelection",2),B([y("uint16")],k.prototype,"usFirstCharIndex",2),B([y("uint16")],k.prototype,"usLastCharIndex",2),B([y("int16")],k.prototype,"sTypoAscender",2),B([y("int16")],k.prototype,"sTypoDescender",2),B([y("int16")],k.prototype,"sTypoLineGap",2),B([y("uint16")],k.prototype,"usWinAscent",2),B([y("uint16")],k.prototype,"usWinDescent",2),B([y({offset:72,type:"uint8",size:8})],k.prototype,"ulCodePageRange",2),B([y({offset:72,type:"int16"})],k.prototype,"sxHeight",2),B([y("int16")],k.prototype,"sCapHeight",2),B([y("uint16")],k.prototype,"usDefaultChar",2),B([y("uint16")],k.prototype,"usBreakChar",2),B([y("uint16")],k.prototype,"usMaxContext",2),k=B([ft("OS/2","os2")],k);var Xi=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,Et=(s,t,e,r)=>{for(var n=r>1?void 0:r?ji(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Xi(t,e,n),n};let Ot=class extends pt{constructor(s=new ArrayBuffer(32),t,e){super(s,t,e)}};Et([y("fixed")],Ot.prototype,"format",2),Et([y("fixed")],Ot.prototype,"italicAngle",2),Et([y("int16")],Ot.prototype,"underlinePosition",2),Et([y("int16")],Ot.prototype,"underlineThickness",2),Et([y("uint32")],Ot.prototype,"isFixedPitch",2),Et([y("uint32")],Ot.prototype,"minMemType42",2),Et([y("uint32")],Ot.prototype,"maxMemType42",2),Et([y("uint32")],Ot.prototype,"minMemType1",2),Et([y("uint32")],Ot.prototype,"maxMemType1",2),Ot=Et([ft("post")],Ot);var Hi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,vt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Yi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Hi(t,e,n),n};let yt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};vt([y("fixed")],yt.prototype,"version",2),vt([y("int16")],yt.prototype,"vertTypoAscender",2),vt([y("int16")],yt.prototype,"vertTypoDescender",2),vt([y("int16")],yt.prototype,"vertTypoLineGap",2),vt([y("int16")],yt.prototype,"advanceHeightMax",2),vt([y("int16")],yt.prototype,"minTopSideBearing",2),vt([y("int16")],yt.prototype,"minBottomSideBearing",2),vt([y("int16")],yt.prototype,"yMaxExtent",2),vt([y("int16")],yt.prototype,"caretSlopeRise",2),vt([y("int16")],yt.prototype,"caretSlopeRun",2),vt([y("int16")],yt.prototype,"caretOffset",2),vt([y({type:"int16",size:4})],yt.prototype,"reserved",2),vt([y("int16")],yt.prototype,"metricDataFormat",2),vt([y("int16")],yt.prototype,"numOfLongVerMetrics",2),yt=vt([ft("vhea")],yt);var Mn=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,Ki=(s,t,e)=>t in s?Mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Qi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Zi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Mn(t,e,n),n},Ji=(s,t,e)=>(Ki(s,t+"",e),e);let Sr=class extends pt{constructor(){super(...arguments),Ji(this,"_metrics")}static from(s){const t=s.length*4,e=new Sr(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((i,o)=>(o<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};Sr=Qi([ft("vmtx")],Sr);var _n=Object.defineProperty,to=(s,t,e)=>t in s?_n(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ce=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&_n(t,e,n),n},Ve=(s,t,e)=>(to(s,typeof t!="symbol"?t+"":t,e),e);class It extends cr{constructor(){super(...arguments),Ve(this,"format","TrueType"),Ve(this,"mimeType","font/ttf"),Ve(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(ee(t).getUint32(0))}static checksum(t){const e=ee(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let i=0,o=r/4;i<o;i+=4)i*4<r-4&&(n+=e.getUint32(i*4,!1));return n&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,n=Array.from(t.tableViews.values()).reduce((u,f)=>u+e(f.byteLength),0),i=new this(new ArrayBuffer(12+r*16+n));i.scalerType=65536,i.numTables=r;const o=Math.log(2);i.searchRange=Math.floor(Math.log(r)/o)*16,i.entrySelector=Math.floor(i.searchRange/o),i.rangeShift=r*16-i.searchRange;let a=12+r*16,l=0;const h=i.getDirectories();t.tableViews.forEach((u,f)=>{const p=h[l++];p.tag=f,p.checkSum=this.checksum(u),p.offset=a,p.length=u.byteLength,i.view.writeBytes(u,a),a+=e(p.length)});const c=i.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(i.view),i}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new ge(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ze(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Ve(It,"signature",new Set([65536,1953658213,1954115633])),Ce([y("uint32")],It.prototype,"scalerType"),Ce([y("uint16")],It.prototype,"numTables"),Ce([y("uint16")],It.prototype,"searchRange"),Ce([y("uint16")],It.prototype,"entrySelector"),Ce([y("uint16")],It.prototype,"rangeShift");var eo=Object.defineProperty,ro=(s,t,e)=>t in s?eo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Cr=(s,t,e)=>(ro(s,typeof t!="symbol"?t+"":t,e),e);class We extends It{constructor(){super(...arguments),Cr(this,"format","OpenType"),Cr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}Cr(We,"signature",new Set([1330926671]));var no=Object.defineProperty,Pe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&no(t,e,n),n};class ie extends _t{constructor(t,e){super(t,e,20)}}Pe([y({type:"char",size:4})],ie.prototype,"tag"),Pe([y("uint32")],ie.prototype,"offset"),Pe([y("uint32")],ie.prototype,"compLength"),Pe([y("uint32")],ie.prototype,"origLength"),Pe([y("uint32")],ie.prototype,"origChecksum");var Tn=Object.defineProperty,so=(s,t,e)=>t in s?Tn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Mt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Tn(t,e,n),n},Xe=(s,t,e)=>(so(s,typeof t!="symbol"?t+"":t,e),e);const bt=class Ur extends cr{constructor(){super(...arguments),Xe(this,"format","WOFF"),Xe(this,"mimeType","font/woff"),Xe(this,"_sfnt")}get subfontFormat(){return It.is(this.flavor)?"TrueType":We.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ee(t).getUint32(0))}static checkSum(t){const e=ee(t),r=e.byteLength,n=Math.floor(r/4);let i=0,o=0;for(;o<n;)i+=e.getUint32(4*o++,!1);let a=r-n*4;if(a){let l=n*4;for(;a>0;)i+=e.getUint8(l)<<a*8,l++,a--}return i%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,f)=>{const p=ee(bs(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:f,view:p.byteLength<u.byteLength?p:u,rawView:u})});const i=n.length,o=n.reduce((u,f)=>u+r(f.view.byteLength),0),a=new Ur(new ArrayBuffer(44+20*i+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=i,a.totalSfntSize=12+16*i+n.reduce((u,f)=>u+r(f.rawView.byteLength),0);let l=44+i*20,h=0;const c=a.getDirectories();return n.forEach(u=>{const f=c[h++];f.tag=u.tag,f.offset=l,f.compLength=u.view.byteLength,f.origChecksum=Ur.checkSum(u.rawView),f.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(f.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new ie(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ze(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,i=e.compLength,o=e.origLength,a=n+i;return t[r]=i>=o?new DataView(this.view.buffer,n,i):new DataView(Ss(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Xe(bt,"signature",new Set([2001684038])),Mt([y("uint32")],bt.prototype,"signature"),Mt([y("uint32")],bt.prototype,"flavor"),Mt([y("uint32")],bt.prototype,"length"),Mt([y("uint16")],bt.prototype,"numTables"),Mt([y("uint16")],bt.prototype,"reserved"),Mt([y("uint32")],bt.prototype,"totalSfntSize"),Mt([y("uint16")],bt.prototype,"majorVersion"),Mt([y("uint16")],bt.prototype,"minorVersion"),Mt([y("uint32")],bt.prototype,"metaOffset"),Mt([y("uint32")],bt.prototype,"metaLength"),Mt([y("uint32")],bt.prototype,"metaOrigLength"),Mt([y("uint32")],bt.prototype,"privOffset"),Mt([y("uint32")],bt.prototype,"privLength");let Pr=bt;function io(s,t=!0){if(It.is(s))return new It(s);if(We.is(s))return new We(s);if(Pr.is(s))return new Pr(s);if(t)throw new Error("Failed to parseFont")}var oo=Object.defineProperty,ao=(s,t,e)=>t in s?oo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Me=(s,t,e)=>(ao(s,typeof t!="symbol"?t+"":t,e),e);const An=class as{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,{...as.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
- font-family: "${t}";
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:i=!0,...o}=e,{src:a}=t;if(this.loaded.has(a))return r&&(this.loading.forEach(f=>f.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,o),this.loading.set(a,l)),r&&this.loading.forEach((f,p)=>{f!==l&&(f.cancel(),this.loading.delete(p))}),l.when.then(f=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const p=u(f);return e.noAdd||this.loaded.set(t.src,p),p.familySet.forEach(g=>{this.familyToUrl.set(g,a),typeof document<"u"&&(n&&this.injectFontFace(g,f),i&&this.injectStyleTag(g,a))}),p}}).catch(f=>{if(f instanceof DOMException&&f.message==="The user aborted a request.")return u();throw f}).finally(()=>{this.loading.delete(a)});function h(){return t.family?Array.isArray(t.family)?t.family:[t.family]:[]}function c(f){return h().forEach(p=>{f.familySet.add(p)}),f}function u(f=new ArrayBuffer(0)){let p;function g(){return p||(p=f.byteLength?io(f,!1):void 0),p}function m(){const d=g();if(d instanceof It||d instanceof Pr)return d.sfnt}return{...t,buffer:f,familySet:new Set(h()),getFont:g,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}};Me(An,"defaultRequestInit",{cache:"force-cache"});let lo=An;const ho=new lo,co={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Mr(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:p="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=co[o],s.miterLimit=a,s.setLineDash(l),s.lineDashOffset=h,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=f,s.shadowColor=p}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,i=-(this.y-e.y),o=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-i*o),e.y-(n*o+i*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,i=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=i*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,i=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*i),this.y=r.y+(i+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 N{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 N;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new N(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 N(this.left,this.top,this.width,this.height)}}class St{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,l=0,h=1){A(this,"elements",[]);this.set(t,e,r,n,i,o,a,l,h)}set(t,e,r,n,i,o,a,l,h){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=i,c[5]=l,c[6]=r,c[7]=o,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,i=this.elements,o=r[0],a=r[3],l=r[6],h=r[1],c=r[4],u=r[7],f=r[2],p=r[5],g=r[8],m=n[0],d=n[3],_=n[6],b=n[1],S=n[4],T=n[7],w=n[2],x=n[5],O=n[8];return i[0]=o*m+a*b+l*w,i[3]=o*d+a*S+l*x,i[6]=o*_+a*T+l*O,i[1]=h*m+c*b+u*w,i[4]=h*d+c*S+u*x,i[7]=h*_+c*T+u*O,i[2]=f*m+p*b+g*w,i[5]=f*d+p*S+g*x,i[8]=f*_+p*T+g*O,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*o-a*h,f=a*l-c*i,p=h*i-o*l,g=e*u+r*f+n*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return t[0]=u*m,t[1]=(n*h-c*r)*m,t[2]=(a*r-n*o)*m,t[3]=f*m,t[4]=(c*e-n*l)*m,t[5]=(n*i-a*e)*m,t[6]=p*m,t[7]=(r*l-h*e)*m,t[8]=(o*e-r*i)*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(_r.makeScale(t,e)),this}rotate(t){return this.premultiply(_r.makeRotation(-t)),this}translate(t,e){return this.premultiply(_r.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 _r=new St;function On(s,t,e,r){const n=s*e+t*r,i=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let o=Math.acos(Math.max(-1,Math.min(1,n/i)));return s*r-t*e<0&&(o=-o),o}function uo(s,t,e,r,n,i,o,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(o.x-a.x)/2,h=(o.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,u=-Math.sin(r)*l+Math.cos(r)*h;let f=t*t,p=e*e;const g=c*c,m=u*u,d=g/f+m/p;if(d>1){const W=Math.sqrt(d);t=W*t,e=W*e,f=t*t,p=e*e}const _=f*m+p*g,b=(f*p-_)/_;let S=Math.sqrt(Math.max(0,b));n===i&&(S=-S);const T=S*t*u/e,w=-S*e*c/t,x=Math.cos(r)*T-Math.sin(r)*w+(o.x+a.x)/2,O=Math.sin(r)*T+Math.cos(r)*w+(o.y+a.y)/2,P=On(1,0,(c-T)/t,(u-w)/e),M=On((c-T)/t,(u-w)/e,(-c-T)/t,(-u-w)/e)%(Math.PI*2);s.ellipse(x,O,t,e,r,P,P+M,i===0)}function oe(s,t){return s-(t-s)}function In(s,t){const e=new v,r=new v;for(let n=0,i=s.length;n<i;n++){const o=s[n];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),r.x=e.x+o.x1,r.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=oe(e.x,r.x),l=oe(e.y,r.y);r.x=a,r.y=l,o.type==="t"?(t.quadraticCurveTo(a,l,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,l,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}r.copy(e),uo(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const tt={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Dt(s,t,e=0){let a=0,l=!0,h="",c="";const u=[];function f(d,_,b){const S=new SyntaxError(`Unexpected character "${d}" at index ${_}.`);throw S.partial=b,S}function p(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let g;const m=s.length;for(let d=0;d<m;d++){if(g=s[d],Array.isArray(t)&&t.includes(u.length%e)&&tt.FLAGS.test(g)){a=1,h=g,p();continue}if(a===0){if(tt.WHITESPACE.test(g))continue;if(tt.DIGIT.test(g)||tt.SIGN.test(g)){a=1,h=g;continue}if(tt.POINT.test(g)){a=2,h=g;continue}tt.COMMA.test(g)&&(l&&f(g,d,u),l=!0)}if(a===1){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.POINT.test(g)){h+=g,a=2;continue}if(tt.EXP.test(g)){a=3;continue}tt.SIGN.test(g)&&h.length===1&&tt.SIGN.test(h[0])&&f(g,d,u)}if(a===2){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.EXP.test(g)){a=3;continue}tt.POINT.test(g)&&h[h.length-1]==="."&&f(g,d,u)}if(a===3){if(tt.DIGIT.test(g)){c+=g;continue}if(tt.SIGN.test(g)){if(c===""){c+=g;continue}c.length===1&&tt.SIGN.test(c)&&f(g,d,u)}}tt.WHITESPACE.test(g)?(p(),a=0,l=!1):tt.COMMA.test(g)?(p(),a=0,l=!0):tt.SIGN.test(g)?(p(),a=1,h=g):tt.POINT.test(g)?(p(),a=2,h=g):f(g,d,u)}return p(),u}function fo(s){let t,e;const r=[];for(let n=0,i=s.length;n<i;n++){const o=s[n];switch(o.type){case"m":case"M":if(o.x.toFixed(4)===(e==null?void 0:e.x.toFixed(4))&&o.y.toFixed(4)===(e==null?void 0:e.y.toFixed(4)))continue;r.push(`${o.type} ${o.x} ${o.y}`),e={x:o.x,y:o.y},t={x:o.x,y:o.y};break;case"h":case"H":r.push(`${o.type} ${o.x}`),e={x:o.x,y:(e==null?void 0:e.y)??0};break;case"v":case"V":r.push(`${o.type} ${o.y}`),e={x:(e==null?void 0:e.x)??0,y:o.y};break;case"l":case"L":r.push(`${o.type} ${o.x} ${o.y}`),e={x:o.x,y:o.y};break;case"c":case"C":r.push(`${o.type} ${o.x1} ${o.y1} ${o.x2} ${o.y2} ${o.x} ${o.y}`),e={x:o.x,y:o.y};break;case"s":case"S":r.push(`${o.type} ${o.x2} ${o.y2} ${o.x} ${o.y}`),e={x:o.x,y:o.y};break;case"q":case"Q":r.push(`${o.type} ${o.x1} ${o.y1} ${o.x} ${o.y}`),e={x:o.x,y:o.y};break;case"t":case"T":r.push(`${o.type} ${o.x} ${o.y}`),e={x:o.x,y:o.y};break;case"a":case"A":r.push(`${o.type} ${o.rx} ${o.ry} ${o.angle} ${o.largeArcFlag} ${o.sweepFlag} ${o.x} ${o.y}`),e={x:o.x,y:o.y};break;case"z":case"Z":r.push(o.type),t&&(e={x:t.x,y:t.y});break}}return r.join(" ")}const po=/[a-df-z][^a-df-z]*/gi;function kn(s){const t=[],e=s.match(po);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const i=e[r],o=i.charAt(0),a=i.slice(1).trim();let l;switch(o){case"m":case"M":l=Dt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:o,x:l[h],y:l[h+1]}):t.push({type:o==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Dt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:o,x:l[h]});break;case"v":case"V":l=Dt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:o,y:l[h]});break;case"l":case"L":l=Dt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:o,x:l[h],y:l[h+1]});break;case"c":case"C":l=Dt(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:o,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Dt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:o,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Dt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:o,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Dt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:o,x:l[h],y:l[h+1]});break;case"a":case"A":l=Dt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:o,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(i)}}return t}class Zt{constructor(){A(this,"arcLengthDivisions",200);A(this,"_cacheArcLengths");A(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),i=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),i+=r.distanceTo(n),e.push(i),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const i=r.length;let o;e?o=e:o=t*r[i-1];let a=0,l=i-1,h;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),h=r[n]-o,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===o)return n/(i-1);const c=r[n],f=r[n+1]-c,p=(o-c)/f;return(n+p)/(i-1)}getTangent(t,e=new v){const n=Math.max(0,t-1e-4),i=Math.min(1,t+1e-4);return e.copy(this.getPoint(i).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}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,i=(r+n)/2;for(;n-r>e;){i=(r+n)/2;const o=this.getPoint(i);if(o.distanceTo(t)<e)return i;o.x<t.x?r=i:n=i}return i}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 N(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 Bn(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,l=s*a;return(2*e-2*r+i+o)*l+(-3*e+3*r-2*i-o)*a+i*s+e}function go(s,t){const e=1-s;return e*e*t}function yo(s,t){return 2*(1-s)*s*t}function mo(s,t){return s*s*t}function En(s,t,e,r){return go(s,t)+yo(s,e)+mo(s,r)}function wo(s,t){const e=1-s;return e*e*e*t}function xo(s,t){const e=1-s;return 3*e*e*s*t}function vo(s,t){return 3*(1-s)*s*s*t}function bo(s,t){return s*s*s*t}function Dn(s,t,e,r,n){return wo(s,t)+xo(s,e)+vo(s,r)+bo(s,n)}class So extends Zt{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:i,end:o}=this;return e.set(Dn(t,r.x,n.x,i.x,o.x),Dn(t,r.y,n.y,i.y,o.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 i=Math.sqrt(n),o=(-e+i)/(2*t),a=(-e-i)/(2*t);return[o,a].filter(l=>l>=0&&l<=1)}getMinMax(t=v.MAX,e=v.MIN){const r=this.start,n=this.startControl,i=this.endControl,o=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(o.x-i.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.y)),h=[0,1,...a,...l];return((u,f)=>{for(const p of u)for(let g=0;g<=f;g++){const m=g/f-.5,d=Math.min(1,Math.max(0,p+m)),_=this.getPoint(d);t.x=Math.min(t.x,_.x),t.y=Math.min(t.y,_.y),e.x=Math.max(e.x,_.x),e.y=Math.max(e.y,_.y)}})(h,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{start:e,startControl:r,endControl:n,end:i}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,i.x,i.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Co=new St,Un=new St,$n=new St,je=new v;class Po extends Zt{constructor(t=new v,e=1,r=1,n=0,i=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=o,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new v){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const i=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(i?n=0:n=r),this.clockwise&&!i&&(n===r?n=-r:n=n-r);const o=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(o),l=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,f=l-this.center.y;a=u*h-f*c+this.center.x,l=u*c+f*h+this.center.y}return e.set(a,l)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:i,clockwise:o,rotation:a}=this,{x:l,y:h}=t,c=l+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=h+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),f=Math.abs(n-i),p=f>Math.PI?1:0,g=o?1:0,m=a*180/Math.PI;if(f>=2*Math.PI){const d=n+Math.PI,_=l+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),b=h+e*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:_,y:b},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const d=l+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),_=h+e*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:p,sweepFlag:g,x:d,y:_}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,n,i,o,a,!l),this}matrix(t){return je.set(this.center.x,this.center.y),je.applyMatrix3(t),this.center.x=je.x,this.center.y=je.y,To(t)?Mo(this,t):_o(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=v.MAX,e=v.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:l}=r,h=Math.cos(o),c=Math.sin(o),u=Math.sqrt(n*n*h*h+i*i*c*c),f=Math.sqrt(n*n*c*c+i*i*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,l-f),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,l+f),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Mo(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new v(e*n,e*i),a=new v(-r*i,r*n),l=o.applyMatrix3(t),h=a.applyMatrix3(t),c=Co.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=Un.copy(c).invert(),g=$n.copy(u).transpose().multiply(u).elements,m=Ao(g[0],g[1],g[4]),d=Math.sqrt(m.rt1),_=Math.sqrt(m.rt2);if(s.radiusX=1/d,s.radiusY=1/_,s.rotation=Math.atan2(m.sn,m.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const S=Un.set(d,0,0,0,_,0,0,0,1),T=$n.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=S.multiply(T).multiply(c),x=O=>{const{x:P,y:M}=new v(Math.cos(O),Math.sin(O)).applyMatrix3(w);return Math.atan2(M,P)};s.startAngle=x(s.startAngle),s.endAngle=x(s.endAngle),Ln(t)&&(s.clockwise=!s.clockwise)}}function _o(s,t){const e=Fn(t),r=zn(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,Ln(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function Ln(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function To(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Fn(s),n=zn(s);return Math.abs(e/(r*n))>Number.EPSILON}function Fn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function zn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Ao(s,t,e){let r,n,i,o,a;const l=s+e,h=s-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,n=s*a*e-t*a*t):l<0?n=.5*(l-c):(r=.5*c,n=-.5*c),h>0?i=h+c:i=h-c,Math.abs(i)>2*Math.abs(t)?(a=-2*t/i,o=1/Math.sqrt(1+a*a),i=a*o):Math.abs(t)===0?(i=1,o=0):(a=-.5*i/t,i=1/Math.sqrt(1+a*a),o=a*i),h>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class Tr extends Zt{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 Zt{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:i}=this;return e.set(En(t,r.x,n.x,i.x),En(t,r.y,n.y,i.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),l=.5*(r.x+i.x),h=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,l),t.y=Math.min(t.y,r.y,i.y,a,h),e.x=Math.max(e.x,r.x,i.x,o,l),e.y=Math.max(e.y,r.y,i.y,a,h),{min:t,max:e}}toCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{start:e,control:r,end:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}class Io extends Zt{constructor(e,r,n=1,i=0,o=1){super();A(this,"curves",[]);A(this,"curveT",0);this.center=e,this.rx=r,this.aspectRatio=n,this.start=i,this.end=o,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:e,y:r}=this.center,n=this.rx,i=this.rx/this.aspectRatio,o=[new v(e-n,r-i),new v(e+n,r-i),new v(e+n,r+i),new v(e-n,r+i)];for(let a=0;a<4;a++)this.curves.push(new Tr(o[a].clone(),o[(a+1)%4].clone()));return this}getCurve(e){let r=(e*(this.end-this.start)+this.start)%1;r<0&&(r+=1),r*=(1+this.aspectRatio)*2;let n;return r<this.aspectRatio?(n=0,this.curveT=r/this.aspectRatio):r<this.aspectRatio+1?(n=1,this.curveT=(r-this.aspectRatio)/1):r<2*this.aspectRatio+1?(n=2,this.curveT=(r-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=(r-2*this.aspectRatio-1)/1),this.curves[n]}getPoint(e,r){return this.getCurve(e).getPoint(this.curveT,r)}getPointAt(e,r){return this.getPoint(e,r)}getTangent(e,r){return this.getCurve(e).getTangent(this.curveT,r)}getNormal(e,r){return this.getCurve(e).getNormal(this.curveT,r)}getControlPoints(){return this.curves.flatMap(e=>e.getControlPoints())}getMinMax(e=v.MAX,r=v.MIN){return this.curves.forEach(n=>n.getMinMax(e,r)),{min:e,max:r}}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){return this.curves.forEach(r=>r.drawTo(e)),this}}class ko extends Zt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new v){const{points:r}=this,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],l=r[i],h=r[i>r.length-2?r.length-1:i+1],c=r[i>r.length-3?r.length-1:i+2];return e.set(Bn(o,a.x,l.x,h.x,c.x),Bn(o,a.y,l.y,h.y,c.y)),e}getControlPoints(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}class _e extends Zt{constructor(e){super();A(this,"curves",[]);A(this,"startPoint");A(this,"currentPoint");A(this,"autoClose",!1);A(this,"_cacheLengths",[]);e&&this.addPoints(e)}addCurve(e){return this.curves.push(e),this}addPoints(e){this.moveTo(e[0].x,e[0].y);for(let r=1,n=e.length;r<n;r++){const{x:i,y:o}=e[r];this.lineTo(i,o)}return this}addCommands(e){return In(e,this),this}addData(e){return this.addCommands(kn(e)),this}getPoint(e,r=new v){const n=e*this.getLength(),i=this.getCurveLengths();let o=0;for(;o<i.length;){if(i[o]>=n){const a=i[o]-n,l=this.curves[o],h=l.getLength();return l.getPointAt(h===0?0:1-a/h,r)}o++}return r}getControlPoints(){return this.curves.flatMap(e=>e.getControlPoints())}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const e=[];let r=0;for(let n=0,i=this.curves.length;n<i;n++)r+=this.curves[n].getLength(),e.push(r);return this._cacheLengths=e,e}getSpacedPoints(e=40){const r=[];for(let n=0;n<=e;n++)r.push(this.getPoint(n/e));return this.autoClose&&r.push(r[0]),r}getPoints(e=12){const r=[],n=this.curves;let i;for(let o=0,a=n.length;o<a;o++){const h=n[o].getPoints(e);for(let c=0;c<h.length;c++){const u=h[c];i!=null&&i.equals(u)||(r.push(u),i=u)}}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r}_setCurrentPoint(e){return this.currentPoint=new v(e.x,e.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const e=this.startPoint;if(e){const r=this.currentPoint;r&&!e.equals(r)&&(this.curves.push(new Tr(r.clone(),e)),r.copy(e)),this.startPoint=void 0}return this}moveTo(e,r){return this.currentPoint=new v(e,r),this.startPoint=this.currentPoint.clone(),this}lineTo(e,r){const n=this.currentPoint;return n!=null&&n.equals({x:e,y:r})||this.curves.push(new Tr((n==null?void 0:n.clone())??new v,new v(e,r))),this._setCurrentPoint({x:e,y:r}),this}bezierCurveTo(e,r,n,i,o,a){const l=this.currentPoint;return l!=null&&l.equals({x:o,y:a})||this.curves.push(new So((l==null?void 0:l.clone())??new v,new v(e,r),new v(n,i),new v(o,a))),this._setCurrentPoint({x:o,y:a}),this}quadraticCurveTo(e,r,n,i){const o=this.currentPoint;return o!=null&&o.equals({x:n,y:i})||this.curves.push(new Oo((o==null?void 0:o.clone())??new v,new v(e,r),new v(n,i))),this._setCurrentPoint({x:n,y:i}),this}arc(e,r,n,i,o,a){return this.ellipse(e,r,n,n,0,i,o,a),this}relativeArc(e,r,n,i,o,a){const l=this.currentPoint??new v;return this.arc(e+l.x,r+l.y,n,i,o,a),this}arcTo(e,r,n,i,o){return console.warn("Method arcTo not supported yet"),this}ellipse(e,r,n,i,o,a,l,h=!0){const c=new Po(new v(e,r),n,i,o,a,l,!h);if(this.curves.length>0){const u=c.getPoint(0);(!this.currentPoint||!u.equals(this.currentPoint))&&this.lineTo(u.x,u.y)}return this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(e,r,n,i,o,a,l,h){const c=this.currentPoint??new v;return this.ellipse(e+c.x,r+c.y,n,i,o,a,l,h),this}rect(e,r,n,i){return this.curves.push(new Io(new v(e+n/2,r+i/2),n/2,n/i)),this._setCurrentPoint({x:e,y:r}),this}splineThru(e){const r=this.currentPoint??new v;return this.curves.push(new ko([r].concat(e))),this._setCurrentPoint(e[e.length-1]),this}getMinMax(e=v.MAX,r=v.MIN){return this.curves.forEach(n=>n.getMinMax(e,r)),{min:e,max:r}}getBoundingBox(){const{min:e,max:r}=this.getMinMax();return new N(e.x,e.y,r.x-e.x,r.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const r=(n=this.curves[0])==null?void 0:n.getPoint(0);return r&&e.moveTo(r.x,r.y),this.curves.forEach(i=>i.drawTo(e)),this.autoClose&&e.closePath(),this}copy(e){var r;super.copy(e),this.curves=[];for(let n=0,i=e.curves.length;n<i;n++)this.curves.push(e.curves[n].clone());return this.autoClose=e.autoClose,this.currentPoint=(r=e.currentPoint)==null?void 0:r.clone(),this}}function Bo(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Eo(s,t,e,r){const n=t.clone().sub(s),i=r.clone().sub(e),o=e.clone().sub(s),a=n.cross(i);if(a===0)return new v((s.x+e.x)/2,(s.y+e.y)/2);const l=o.cross(i)/a;return Math.abs(l)>1?new v((s.x+e.x)/2,(s.y+e.y)/2):new v(s.x+l*n.x,s.y+l*n.y)}class Ct{constructor(t,e={}){A(this,"currentPath",new _e);A(this,"paths",[this.currentPath]);A(this,"style");t&&(t instanceof Ct?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t)),this.style=e}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof Ct?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new _e().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r!=null&&r.equals({x:t,y:e})||(n.length?(this.currentPath=new _e().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPath.bezierCurveTo(t,e,r,n,i,o),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,i,o){return this.currentPath.arc(t,e,r,n,i,o),this}arcTo(t,e,r,n,i){return this.currentPath.arcTo(t,e,r,n,i),this}ellipse(t,e,r,n,i,o,a,l){return this.currentPath.ellipse(t,e,r,n,i,o,a,l),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return In(t,this),this}addData(t){return this.addCommands(kn(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=[],i=[];e.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();i[l]=h,n[l]=c;const u=h[0],f=h[h.length-1]??u;r.push({start:c?f:u,end:c?u:f,index:l})});const o=[];return r.forEach((a,l)=>{o[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&o[l].push(h.index)})}),e.forEach((a,l)=>{const h=n[l];i[l].forEach(u=>{const f=a.getTForPoint(u),p=a.getNormal(f).scale(h?t:-t);u.add(p)})}),o.forEach((a,l)=>{const h=i[l];a.forEach(c=>{const u=i[c],f=Eo(h[h.length-1],h[h.length-2]??h[h.length-1],u[0],u[1]??u[0]);f&&(h[h.length-1].copy(f),u[0].copy(f))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=v.MAX,e=v.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(i=>{if(i.getMinMax(t,e),r&&n>1){const o=n/2,a=i.isClockwise(),l=[];for(let h=0;h<=1;h+=1/i.arcLengthDivisions){const c=i.getPoint(h),u=i.getNormal(h),f=u.clone().scale(a?o:-o),p=u.clone().scale(a?-o:o);l.push(c.clone().add(f),c.clone().add(p),c.clone().add({x:o,y:0}),c.clone().add({x:-o,y:0}),c.clone().add({x:0,y:o}),c.clone().add({x:0,y:-o}),c.clone().add({x:o,y:o}),c.clone().add({x:-o,y:-o}))}t.min(...l),e.max(...l)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new N(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(),Mr(t,e),this.paths.forEach(i=>{i.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(),Mr(t,e),this.getControlPoints().forEach(i=>{t.moveTo(i.x,i.y),t.arc(i.x,i.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[Bo(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(),i=this.toSVGPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</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:i,width:o,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=o*e,l.height=a*e,l.style.width=`${o}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-n,-i),this.drawTo(h,r)),l}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const Do="px",Uo=90,Nn=["mm","cm","in","pt","pc","px"],qn={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function V(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Nn.length;r<n;r++){const i=Nn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return e=qn[t][Do],e<0&&(e=qn[t].in*Uo),e*Number.parseFloat(s)}const $o=new St,He=new St,Gn=new St,Rn=new St;function Lo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Fo(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Fo(s){const t=new St,e=$o;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(V(s.getAttribute("x")),V(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const o=i.indexOf("("),a=i.length;if(o>0&&o<a){const l=i.slice(0,o),h=Dt(i.slice(o+1));switch(e.identity(),l){case"translate":if(h.length>=1){const c=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(c,u)}break;case"rotate":if(h.length>=1){let c=0,u=0,f=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],f=h[2]),He.makeTranslation(-u,-f),Gn.makeRotation(c),Rn.multiplyMatrices(Gn,He),He.makeTranslation(u,f),e.multiplyMatrices(He,Rn)}break;case"scale":h.length>=1&&e.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&e.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&e.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&e.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}t.premultiply(e)}}return t}function zo(s){return new Ct().addPath(new _e().arc(V(s.getAttribute("cx")||0),V(s.getAttribute("cy")||0),V(s.getAttribute("r")||0),0,Math.PI*2))}function No(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(o=>o.trim()),i={};for(let o=r.style.length,a=0;a<o;a++){const l=r.style.item(a);i[l]=r.style.getPropertyValue(l)}for(let o=0;o<n.length;o++)t[n[o]]=Object.assign(t[n[o]]||{},{...i})}}function qo(s){return new Ct().addPath(new _e().ellipse(V(s.getAttribute("cx")||0),V(s.getAttribute("cy")||0),V(s.getAttribute("rx")||0),V(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Go(s){return new Ct().moveTo(V(s.getAttribute("x1")||0),V(s.getAttribute("y1")||0)).lineTo(V(s.getAttribute("x2")||0),V(s.getAttribute("y2")||0))}function Ro(s){const t=new Ct,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Vo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Wo(s){var r;const t=new Ct;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Vo,(n,i,o)=>{const a=V(i),l=V(o);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!0,t}const Xo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function jo(s){var r;const t=new Ct;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Xo,(n,i,o)=>{const a=V(i),l=V(o);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!1,t}function Ho(s){const t=V(s.getAttribute("x")||0),e=V(s.getAttribute("y")||0),r=V(s.getAttribute("rx")||s.getAttribute("ry")||0),n=V(s.getAttribute("ry")||s.getAttribute("rx")||0),i=V(s.getAttribute("width")),o=V(s.getAttribute("height")),a=1-.551915024494,l=new Ct;return l.moveTo(t+r,e),l.lineTo(t+i-r,e),(r!==0||n!==0)&&l.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),l.lineTo(t+i,e+o-n),(r!==0||n!==0)&&l.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),l.lineTo(t+r,e+o),(r!==0||n!==0)&&l.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),l.lineTo(t,e+n),(r!==0||n!==0)&&l.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),l}function Ut(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)r=Object.assign(r,e[`.${h[c]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let h=s.style.length,c=0;c<h;c++){const u=s.style.item(c),f=s.style.getPropertyValue(u);t[u]=f,r[u]=f}function n(h,c,u=i){s.hasAttribute(h)&&(t[c]=u(s.getAttribute(h))),r[h]&&(t[c]=u(r[h]))}function i(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function o(h){return Math.max(0,Math.min(1,V(h)))}function a(h){return Math.max(0,V(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>V(c))}return n("fill","fill"),n("fill-opacity","fillOpacity",o),n("fill-rule","fillRule"),n("opacity","opacity",o),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",o),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",l),n("stroke-dashoffset","strokeDashoffset",V),n("visibility","visibility"),t}function Ar(s,t,e=[],r={}){var u;if(s.nodeType!==1)return e;let n=!1,i=null,o={...t};switch(s.nodeName){case"svg":o=Ut(s,o,r);break;case"style":No(s,r);break;case"g":o=Ut(s,o,r);break;case"path":o=Ut(s,o,r),s.hasAttribute("d")&&(i=Ro(s));break;case"rect":o=Ut(s,o,r),i=Ho(s);break;case"polygon":o=Ut(s,o,r),i=Wo(s);break;case"polyline":o=Ut(s,o,r),i=jo(s);break;case"circle":o=Ut(s,o,r),i=zo(s);break;case"ellipse":o=Ut(s,o,r),i=qo(s);break;case"line":o=Ut(s,o,r),i=Go(s);break;case"defs":n=!0;break;case"use":{o=Ut(s,o,r);const p=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=s.viewportElement)==null?void 0:u.getElementById(p);g?Ar(g,o,e,r):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(s);break}if(o.display==="none")return e;Object.assign(t,o);const a=new St,l=[],h=Lo(s,a,l);i&&(i.matrix(a),e.push(i),i.style=t);const c=s.childNodes;for(let f=0,p=c.length;f<p;f++){const g=c[f];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Ar(g,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Vn="data:image/svg+xml;",Wn=`${Vn}base64,`,Xn=`${Vn}charset=utf8,`;function jn(s){if(typeof s=="string"){let t;s.startsWith(Wn)?(s=s.substring(Wn.length,s.length),t=atob(s)):s.startsWith(Xn)?(s=s.substring(Xn.length,s.length),t=decodeURIComponent(s)):t=s;const e=new DOMParser().parseFromString(t,"text/xml"),r=e.querySelector("parsererror");if(r)throw new Error(`${r.textContent??"parser error"}
5
- ${t}`);return e.documentElement}else return s}function Hn(s){return Ar(jn(s),{})}function Te(s,t=!0){if(!s.length)return;const e=v.MAX,r=v.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new N(e.x,e.y,r.x-e.x,r.y-e.y)}const Yo=new Set(["©","®","÷"]),Zo=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),Ko={1:"italic",32:"bold"},Qo={1:"italic",2:"bold"},Yn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Zn{constructor(t,e,r){A(this,"path",new Ct);A(this,"lineBox",new N);A(this,"inlineBox",new N);A(this,"glyphBox");A(this,"advanceWidth",0);A(this,"advanceHeight",0);A(this,"underlinePosition",0);A(this,"underlineThickness",0);A(this,"strikeoutPosition",0);A(this,"strikeoutSize",0);A(this,"ascender",0);A(this,"descender",0);A(this,"typoAscender",0);A(this,"typoDescender",0);A(this,"typoLineGap",0);A(this,"winAscent",0);A(this,"winDescent",0);A(this,"xHeight",0);A(this,"capHeight",0);A(this,"baseline",0);A(this,"centerDiviation",0);A(this,"fontStyle");this.content=t,this.index=e,this.parent=r}get center(){var t;return(t=this.glyphBox)==null?void 0:t.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSfnt(t){const e=this.computedStyle.fontFamily,r=t??ho,n=e?r.get(e):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{hhea:e,os2:r,post:n,head:i}=t,o=i.unitsPerEm,a=e.ascent,l=e.descent,{content:h,computedStyle:c,isVertical:u}=this,{fontSize:f}=c,p=o/f,g=t.getAdvanceWidth(h,f),m=(a+Math.abs(l))/p,d=a/p;return this.advanceWidth=g,this.advanceHeight=m,this.inlineBox.width=u?m:g,this.inlineBox.height=u?g:m,this.underlinePosition=(a-n.underlinePosition)/p,this.underlineThickness=n.underlineThickness/p,this.strikeoutPosition=(a-r.yStrikeoutPosition)/p,this.strikeoutSize=r.yStrikeoutSize/p,this.ascender=a/p,this.descender=l/p,this.typoAscender=r.sTypoAscender/p,this.typoDescender=r.sTypoDescender/p,this.typoLineGap=r.sTypoLineGap/p,this.winAscent=r.usWinAscent/p,this.winDescent=r.usWinDescent/p,this.xHeight=r.sxHeight/p,this.capHeight=r.sCapHeight/p,this.baseline=d,this.centerDiviation=m/2-d,this.fontStyle=Ko[r.fsSelection]??Qo[i.macStyle],this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:n,computedStyle:i,baseline:o,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u,advanceWidth:f,advanceHeight:p}=this,{left:g,top:m}=a,d=i.fontStyle==="italic"&&u!=="italic";let _=g,b=m+o,S;const T=new Ct;if(r&&(_+=(p-f)/2,Math.abs(f-p)>.1&&(b-=(l-c)/(l+Math.abs(h))*p),S=void 0),r&&!Yo.has(n)&&(n.codePointAt(0)<=256||Zo.has(n))){T.addCommands(e.getPathCommands(n,_,m+o-(p-f)/2,i.fontSize));const x={y:m-(p-f)/2+p/2,x:_+f/2};d&&this._italic(T,r?{x:x.x,y:m-(p-f)/2+o}:void 0),T.rotate(90,x)}else S!==void 0?(T.addCommands(e.glyphs.get(S).getPathCommands(_,b,i.fontSize)),d&&this._italic(T,r?{x:_+f/2,y:m+c/(l+Math.abs(h))*p}:void 0)):(T.addCommands(e.getPathCommands(n,_,b,i.fontSize)),d&&this._italic(T,r?{x:_+p/2,y:b}:void 0));const w=i.fontWeight??400;return w in Yn&&(w===700||w==="bold")&&u!=="bold"&&T.bold(Yn[w]*i.fontSize*.05),T.style={fill:i.color,stroke:i.textStrokeWidth?i.textStrokeColor:"none",strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:0},this.path=T,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(t,e){t.skew(-.24,0,e||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(t,e,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(t,e,r)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:r,max:n}=e;return new N(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){const r=this.computedStyle,n={ctx:t,path:this.path,fontSize:r.fontSize,color:r.color,...e};if(this.glyphBox)te(n);else{t.save(),t.beginPath();const i=this.path.style,o={...i,fill:n.color??i.fill,stroke:n.textStrokeColor??i.stroke,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize:i.strokeWidth,shadowOffsetX:(n.shadowOffsetX??0)*n.fontSize,shadowOffsetY:(n.shadowOffsetY??0)*n.fontSize,shadowBlur:(n.shadowBlur??0)*n.fontSize,shadowColor:n.shadowColor};Mr(t,o),t.font=`${n.fontSize}px ${n.fontFamily}`,this.isVertical?(t.textBaseline="middle",t.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(t.textBaseline="alphabetic",t.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),t.restore()}}}function Ye(s,t){return typeof s=="number"?s:s.endsWith("%")?(s=s.substring(0,s.length-1),Math.ceil(Number(s)/100*t.total)):s.endsWith("rem")?(s=s.substring(0,s.length-3),Number(s)*t.fontSize):s.endsWith("em")?(s=s.substring(0,s.length-2),Number(s)*t.fontSize):Number(s)}function Or(s){const t=Nt(s)?{}:s;return Object.keys(t).reduce((e,r)=>{let n=t[r];const i=Ir(r),o=Ir(n);return i&&(r=i),o&&(n=o),e[r]=n,e},{})}function Nt(s){return!s||s==="none"}function Kn(s,t){const e=Object.keys(s),r=Object.keys(t);return Array.from(new Set([...e,...r])).every(i=>Kt(s[i],t[i]))}function Kt(s,t){const e=typeof s;return e===typeof t?e==="object"?Kn(s,t):s===t:!1}function Ir(s){const t=s.startsWith("#")?s.slice(1):s;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const r=t.length===3?t.split("").map(a=>a+a).join(""):t,n=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),o=Number.parseInt(r.slice(4,6),16);return`rgb(${n}, ${i}, ${o})`}function Ze(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}function Ke(s){return s.startsWith("http://")||s.startsWith("https://")||s.startsWith("blob://")}class Qn{constructor(t,e={},r){A(this,"inlineBox",new N);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,...Ze(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Zn(r,e++,this));return this.characters=t,this}}class ae{constructor(t,e){A(this,"lineBox",new N);A(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Ze(this.parentStyle),...Ze(this.style)},this}addFragment(t,e){const r=new Qn(t,e,this);return this.fragments.push(r),r}}function Jo(s){return s}const he=class he{_styleToDomStyle(t){const e={};for(const r in t){const n=t[r];he.notZeroStyles.has(r)&&!n||(he.pxStyles.has(r)?e[r]=`${n}px`:e[r]=n)}return e}createParagraphDom(t,e){const r=document.createDocumentFragment(),n=document.createElement("section"),i={...e},o=e.writingMode.includes("horizontal");switch(e.textAlign){case"start":case"left":i.justifyContent="start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="end";break}switch(e.verticalAlign){case"top":i.alignItems="top";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="end";break}const a=!!(i.justifyContent||i.alignItems);Object.assign(n.style,{boxSizing:"border-box",display:a?"inline-flex":void 0,width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(i),position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&o?"100%":void 0,height:a&&!o?"100%":void 0}),t.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(u=>{const f=document.createElement("span");Object.assign(f.style,{verticalAlign:"inherit",...this._styleToDomStyle(u.style)}),f.appendChild(document.createTextNode(u.content)),c.appendChild(f)}),l.appendChild(c)}),n.appendChild(l),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var h;return(h=n.parentNode)==null?void 0:h.removeChild(n)}}}measureDomText(t){const e=document.createRange();e.selectNodeContents(t);const r=t.data??"";let n=0;return Array.from(r).map(i=>{var u;const o=n+=r.substring(n).indexOf(i),a=o+i.length;n+=i.length,e.setStart(t,Math.max(o,0)),e.setEnd(t,a);const l=((u=e.getClientRects)==null?void 0:u.call(e))??[e.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=e.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((i,o)=>{const a=i.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();r.push({paragraphIndex:o,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let u=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(f=>{n.push({...f,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(f=>{f.firstChild instanceof window.Text&&this.measureDomText(f.firstChild).forEach(p=>{n.push({...p,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:e,fragments:r,characters:n}}measureParagraphDom(t,e){const r=e.getBoundingClientRect(),n=this.measureDom(e);n.paragraphs.forEach(a=>{const l=t[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),n.fragments.forEach(a=>{const l=t[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const i=[];let o=0;return n.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;i.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const u=t[l].fragments[h].characters[c],{fontHeight:f,isVertical:p}=u,g=i[o];u.inlineBox.left=g.left,u.inlineBox.top=g.top,u.inlineBox.width=g.width,u.inlineBox.height=g.height,p?(u.lineBox.left=g.left+(g.width-f)/2,u.lineBox.top=g.top,u.lineBox.width=f,u.lineBox.height=g.height):(u.lineBox.left=g.left,u.lineBox.top=g.top+(g.height-f)/2,u.lineBox.width=g.width,u.lineBox.height=f),o++}),{paragraphs:t,boundingBox:new N(0,0,r.width,r.height)}}measure(t,e,r){let n;r||({dom:r,destory:n}=this.createParagraphDom(t,e));const i=this.measureParagraphDom(t,r);return n==null||n(),i}};A(he,"notZeroStyles",new Set(["width","height"])),A(he,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let Qe=he;function ta(){return{overflow:"visible",visibility:"visible",filter:"none",left:0,top:0,width:0,height:0,rotate:0,opacity:1,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",backgroundImage:"none",backgroundColor:"transparent",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,borderRadius:0,borderColor:"transparent",borderWidth:1}}function ea(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing: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:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%",scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0}}function ra(){return{...ta(),...ea()}}class na{constructor(){A(this,"eventListeners",new Map)}addEventListener(t,e,r){const n={value:e,options:r},i=this.eventListeners.get(t);return i?Array.isArray(i)?i.push(n):this.eventListeners.set(t,[i,n]):this.eventListeners.set(t,n),this}removeEventListener(t,e,r){var i,o;if(!e)return this.eventListeners.delete(t),this;const n=this.eventListeners.get(t);if(!n)return this;if(Array.isArray(n)){const a=[];for(let l=0,h=n.length;l<h;l++){const c=n[l];(c.value!==e||typeof r=="object"&&(r!=null&&r.once)&&(typeof c.options=="boolean"||!((i=c.options)!=null&&i.once)))&&a.push(c)}a.length?this.eventListeners.set(t,a.length===1?a[0]:a):this.eventListeners.delete(t)}else n.value===e&&(typeof r=="boolean"||!(r!=null&&r.once)||typeof n.options=="boolean"||(o=n.options)!=null&&o.once)&&this.eventListeners.delete(t);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(t){return this.eventListeners.has(t)}dispatchEvent(t,e){var n,i;const r=this.eventListeners.get(t);if(r){if(Array.isArray(r))for(let o=r.length,a=0;a<o;a++){const l=r[a];typeof l.options=="object"&&((n=l.options)!=null&&n.once)&&this.off(t,l.value,l.options),l.value.apply(this,[e])}else typeof r.options=="object"&&((i=r.options)!=null&&i.once)&&this.off(t,r.value,r.options),r.value.apply(this,[e]);return!0}else return!1}on(t,e,r){return this.addEventListener(t,e,r)}once(t,e){return this.addEventListener(t,e,{once:!0})}off(t,e,r){return this.removeEventListener(t,e,r)}emit(t,e){this.dispatchEvent(t,e)}}function Je(s){const{highlight:t,highlightImage:e,highlightReferImage:r,highlightColormap:n,highlightLine:i,highlightSize:o,highlightThickness:a}=s;return{image:(t==null?void 0:t.image)??e??"none",referImage:(t==null?void 0:t.referImage)??r??"none",colormap:(t==null?void 0:t.colormap)??n??"none",line:(t==null?void 0:t.line)??i??"none",size:(t==null?void 0:t.size)??o??"cover",thickness:(t==null?void 0:t.thickness)??a??"100%"}}function Jn(){const s=[],t=[],e=new Map,r=new Map;async function n(o){if(!e.has(o)){e.set(o,o);try{e.set(o,await fetch(o).then(a=>a.text()))}catch(a){console.warn(a),e.delete(o)}}}function i(o){let a=r.get(o);if(!a){const l=jn(Ke(o)?e.get(o)??o:o),h=Hn(l);a={dom:l,paths:h},r.set(o,a)}return a}return{name:"highlight",paths:s,load:async o=>{const a=new Set;o.forEachCharacter(l=>{const{computedStyle:h}=l,{image:c,referImage:u}=Je(h);Ke(c)&&a.add(c),Ke(u)&&a.add(u)}),await Promise.all(Array.from(a).map(l=>n(l)))},update:o=>{t.length=0,s.length=0;let a=[],l,h;o.forEachCharacter(c=>{const{computedStyle:u}=c,f=Je(u),{image:p,colormap:g,line:m,size:d,thickness:_}=f;if(Nt(p))l!=null&&l.length&&(l=[],a.push(l));else{const{inlineBox:b,isVertical:S}=c,{fontSize:T}=u;(!h||Kt(h.image,p)&&Kt(h.colormap,g)&&Kt(h.line,m)&&Kt(h.size,d)&&Kt(h.thickness,_))&&(l!=null&&l.length)&&(S?l[0].inlineBox.left===b.left:l[0].inlineBox.top===b.top)&&l[0].fontSize===T?l.push(c):(l=[],l.push(c),a.push(l))}h=f}),a=a.filter(c=>c.length);for(let c=0;c<a.length;c++){const u=a[c],f=u[0],p=N.from(...u.filter(U=>U.glyphBox).map(U=>U.glyphBox)),{computedStyle:g}=f,{fontSize:m,writingMode:d}=g,{image:_,referImage:b,colormap:S,line:T,size:w,thickness:x}=Je(g),O=d.includes("vertical"),P=Ye(x,{fontSize:m,total:p.width})/p.width,M=Or(S),{paths:W,dom:H}=i(_),D=Te(W,!0),et=m/D.width*2,C=new N().copy(p);O&&(C.width=p.height,C.height=p.width,C.left=p.left+p.width);const F=Math.floor(C.width);let q=F;if(w!=="cover"&&(q=Ye(w,{fontSize:m,total:p.width})||F,C.width=q),!Nt(b)&&Nt(T)){const U=Te(i(b).paths,!0);D.copy(U)}else{let U;if(Nt(T))if(D.width/D.height>4){U="underline";const L=H.getAttribute("viewBox");if(L){const[nt,I,Z,R]=L.split(" ").map($=>Number($)),G=I+R/2;D.y<G&&D.y+D.height>G?U="line-through":D.y+D.height<G?U="overline":U="underline"}}else U="outline";else U=T;switch(U){case"outline":{const L=C.width*.2,nt=C.height*.2;C.width+=L,C.height+=nt,O?(C.x-=nt/2,C.y-=L/2,C.x+=C.height):(C.x-=L/2,C.y-=nt/2);break}case"overline":C.height=D.height*et,O?C.x=f.inlineBox.left+f.inlineBox.width:C.y=f.inlineBox.top;break;case"line-through":C.height=D.height*et,O?C.x=f.inlineBox.left+f.inlineBox.width-f.strikeoutPosition+C.height/2:C.y=f.inlineBox.top+f.strikeoutPosition-C.height/2;break;case"underline":C.height=D.height*et,O?C.x=f.inlineBox.left+f.inlineBox.width-f.underlinePosition:C.y=f.inlineBox.top+f.underlinePosition;break}}const z=new St().translate(-D.x,-D.y).scale(C.width/D.width,C.height/D.height);O&&z.rotate(-Math.PI/2),z.translate(C.x,C.y);for(let U=0;U<Math.ceil(F/q);U++){const L=z.clone();O?L.translate(0,U*C.width):L.translate(U*C.width,0),W.forEach(nt=>{const I=nt.clone().matrix(L);I.style.strokeWidth&&(I.style.strokeWidth*=et*P),I.style.strokeMiterlimit&&(I.style.strokeMiterlimit*=et),I.style.strokeDashoffset&&(I.style.strokeDashoffset*=et),I.style.strokeDasharray&&(I.style.strokeDasharray=I.style.strokeDasharray.map(Z=>Z*et)),I.style.fill&&I.style.fill in M&&(I.style.fill=M[I.style.fill]),I.style.stroke&&I.style.stroke in M&&(I.style.stroke=M[I.style.stroke]),s.push(I),F!==q&&(O?t[s.length-1]=new N(p.left-p.width*2,p.top,p.width*4,p.height):t[s.length-1]=new N(p.left,p.top-p.height*2,p.width,p.height*4))})}}},renderOrder:-1,render:(o,a)=>{s.forEach((l,h)=>{if(te({ctx:o,path:l,fontSize:a.computedStyle.fontSize,clipRect:t[h]}),a.debug){const c=Te([l]);c&&o.strokeRect(c.x,c.y,c.width,c.height)}})}}}function sa(s,t){return`<svg width="${s*2}" height="${s*2}" xmlns="http://www.w3.org/2000/svg">
6
- <circle cx="${s}" cy="${s}" r="${s}" fill="${t}" />
7
- </svg>`}function ts(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,i=n*.45;e.forEach(o=>{const{computedStyle:a}=o,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:u,listStyleType:f}=a,p=Or(c);let g=u,m;if(!Nt(h))m=h;else if(!Nt(f)){const S=n*.38/2;switch(g=g==="cover"?S*2:g,f){case"disc":m=sa(S,String(l));break}}if(!m)return;const d=Hn(m),_=Te(d);let b;o.fragments.forEach(S=>{S.characters.forEach(T=>{const{inlineBox:w}=T;if(r?(b==null?void 0:b.inlineBox.left)!==w.left:(b==null?void 0:b.inlineBox.top)!==w.top){b=T;const x=g==="cover"?1:Ye(g,{total:n,fontSize:n})/n,O=new St;if(r){const P=n/_.height*x;O.translate(-_.left,-_.top).rotate(Math.PI/2).scale(P,P).translate(w.left+(w.width-_.height*P)/2,w.top-i)}else{const P=n/_.height*x;O.translate(-_.left,-_.top).scale(P,P).translate(w.left-_.width*P-i,w.top+(w.height-_.height*P)/2)}s.push(...d.map(P=>{const M=P.clone();return M.matrix(O),M.style.fill&&M.style.fill in p&&(M.style.fill=p[M.style.fill]),M.style.stroke&&M.style.stroke in p&&(M.style.stroke=p[M.style.stroke]),M}))}})})})}}}const Xt=new v,le=new St,jt=new St;function es(){return{name:"render",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(i=>{r==null||r.forEach(o=>{if(!i.glyphBox)return;const a=i.glyphBox.clone(),l=tr(s,o);Xt.set(a.left,a.top),Xt.applyMatrix3(l),a.left=Xt.x,a.top=Xt.y,Xt.set(a.right,a.bottom),Xt.applyMatrix3(l),a.width=Xt.x-a.left,a.height=Xt.y-a.top;const h=(o.shadowOffsetX??0)*e,c=(o.shadowOffsetY??0)*e,u=Math.max(.1,o.textStrokeWidth??0)*e;a.left+=h-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?N.from(...n):void 0},render:(s,t)=>{const{paragraphs:e,glyphBox:r,effects:n,style:i}=t;function o(a,l){s.fillStyle=a,s.fillRect(l.left,l.top,l.width,l.height)}i!=null&&i.backgroundColor&&o(i.backgroundColor,new N(0,0,s.canvas.width,s.canvas.height)),e.forEach(a=>{var l;(l=a.style)!=null&&l.backgroundColor&&o(a.style.backgroundColor,a.lineBox)}),n?n.forEach(a=>{kt(a,r,s),s.save();const[l,h,c,u,f,p]=tr(t,a).transpose().elements;s.transform(l,u,h,f,c,p),t.forEachCharacter(g=>{var m;(m=g.parent.style)!=null&&m.backgroundColor&&o(g.parent.style.backgroundColor,g.inlineBox),g.drawTo(s,a)}),s.restore()}):e.forEach(a=>{a.fragments.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&o(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(s)})})}),t.debug&&e.forEach(a=>{s.strokeRect(a.lineBox.x,a.lineBox.y,a.lineBox.width,a.lineBox.height)})}}}function tr(s,t){const{fontSize:e,glyphBox:r}=s,n=(t.translateX??0)*e,i=(t.translateY??0)*e,o=Math.PI*2,a=(t.skewX??0)/360*o,l=(t.skewY??0)/360*o,{left:h,top:c,width:u,height:f}=r,p=h+u/2,g=c+f/2;return le.identity(),jt.makeTranslation(n,i),le.multiply(jt),jt.makeTranslation(p,g),le.multiply(jt),jt.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),le.multiply(jt),jt.makeTranslation(-p,-g),le.multiply(jt),le.clone()}function rs(){const s=[];return{name:"textDecoration",paths:s,update:t=>{s.length=0;const e=[];let r,n;t.forEachCharacter(i=>{const{computedStyle:o,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:u,strikeoutSize:f}=i,{color:p,textDecoration:g,writingMode:m}=o;if(Nt(g))n=void 0;else{let d=!1;if((n==null?void 0:n.textDecoration)===g&&(n==null?void 0:n.writingMode)===m&&(n==null?void 0:n.color)===p&&(a?r[0].inlineBox.left===l.left:r[0].inlineBox.top===l.top))switch(g){case"underline":r[0].underlinePosition===h&&r[0].underlineThickness===c&&(d=!0);break;case"line-through":r[0].strikeoutPosition===u&&r[0].strikeoutSize===f&&(d=!0);break}d?r.push(i):(r=[],r.push(i),e.push(r)),n=o}}),e.forEach(i=>{const{computedStyle:o,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:u}=i[0],{color:f,textDecoration:p}=o,{left:g,top:m,width:d,height:_}=N.from(...i.map(x=>x.inlineBox));let b=a?g+d:m;const S=a?-1:1;let T=0;switch(p){case"overline":T=h*2;break;case"underline":b+=S*l,T=h*2;break;case"line-through":b+=S*c,T=u*2;break}b-=T;let w;a?w=new Ct([{type:"M",x:b,y:m},{type:"L",x:b,y:m+_},{type:"L",x:b+T,y:m+_},{type:"L",x:b+T,y:m},{type:"Z"}],{fill:f}):w=new Ct([{type:"M",x:g,y:b},{type:"L",x:g+d,y:b},{type:"L",x:g+d,y:b+T},{type:"L",x:g,y:b+T},{type:"Z"}],{fill:f}),s.push(w)})},render:(t,e)=>{const{effects:r,computedStyle:n}=e;r?r.forEach(i=>{t.save();const[o,a,l,h,c,u]=tr(e,i).transpose().elements;t.transform(o,h,a,c,l,u),s.forEach(f=>{te({ctx:t,path:f,fontSize:n.fontSize,...i})}),t.restore()}):s.forEach(i=>{te({ctx:t,path:i,fontSize:n.fontSize})})}}}const kr=ra();class Br extends na{constructor(e={}){super();A(this,"debug");A(this,"content");A(this,"style");A(this,"effects");A(this,"measureDom");A(this,"needsUpdate",!0);A(this,"computedStyle",{...kr});A(this,"paragraphs",[]);A(this,"lineBox",new N);A(this,"rawGlyphBox",new N);A(this,"glyphBox",new N);A(this,"pathBox",new N);A(this,"boundingBox",new N);A(this,"measurer",new Qe);A(this,"plugins",new Map);A(this,"fonts");this.debug=e.debug??!1,this.content=e.content??"",this.style=e.style??{},this.measureDom=e.measureDom,this.effects=e.effects,this.fonts=e.fonts,this.use(ts()).use(rs()).use(Jn()).use(es()),this.updateParagraphs()}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(e=>e.fragments.flatMap(r=>r.characters))}use(e){return this.plugins.set(e.name,e),this}forEachCharacter(e){return this.paragraphs.forEach((r,n)=>{r.fragments.forEach((i,o)=>{i.characters.forEach((a,l)=>{e(a,{paragraphIndex:n,fragmentIndex:o,characterIndex:l})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(e=>{var r;return(r=e.load)==null?void 0:r.call(e,this)}))}updateParagraphs(){this.computedStyle={...kr,...this.style};let{content:e,computedStyle:r}=this;const n=[];if(typeof e=="string"){const i=new ae({},r);i.addFragment(e),n.push(i)}else{e=Array.isArray(e)?e:[e];for(const i of e)if(typeof i=="string"){const o=new ae({},r);o.addFragment(i),n.push(o)}else if(Array.isArray(i)){const o=new ae({},r);i.forEach(a=>{if(typeof a=="string")o.addFragment(a);else{const{content:l,...h}=a;l!==void 0&&o.addFragment(l,h)}}),n.push(o)}else if("fragments"in i){const{fragments:o,...a}=i,l=new ae(a,r);o.forEach(h=>{const{content:c,...u}=h;c!==void 0&&l.addFragment(c,u)}),n.push(l)}else if("content"in i){const{content:o,...a}=i;if(o!==void 0){const l=new ae(a,r);l.addFragment(o),n.push(l)}}}return this.paragraphs=n,this}measure(e=this.measureDom){const r={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const n=this.measurer.measure(this.paragraphs,this.computedStyle,e);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox,this.characters.forEach(i=>{i.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((i,o)=>(i.updateOrder??0)-(o.updateOrder??0)).forEach(i=>{var o;(o=i.update)==null||o.call(i,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const i in r)n[i]=this[i],this[i]=r[i];return this.emit("measure",{text:this,result:n}),n}getGlyphBox(){const e=v.MAX,r=v.MIN;return this.characters.forEach(n=>{if(!n.getGlyphMinMax(e,r)){const{inlineBox:i}=n,o=new v(i.left,i.top),a=new v(i.left+i.width,i.top+i.height);e.min(o,a),r.max(o,a)}}),new N(e.x,e.y,r.x-e.x,r.y-e.y)}updatePathBox(){return this.pathBox=N.from(this.glyphBox,...Array.from(this.plugins.values()).map(e=>e.getBoundingBox?e.getBoundingBox(this):Te(e.paths??[])).filter(Boolean)),this}updateBoundingBox(){const{lineBox:e,rawGlyphBox:r,pathBox:n}=this,i=Math.min(n.left,n.left+e.left-r.left),o=Math.min(n.top,n.top+e.top-r.top),a=Math.max(n.right,n.right+e.right-r.right),l=Math.max(n.bottom,n.bottom+e.bottom-r.bottom);return this.boundingBox=new N(i,o,a-i,l-o),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const e=this.measure();for(const r in e)this[r]=e[r];return this.emit("update",{text:this}),this.needsUpdate=!1,this}render(e){const{view:r,pixelRatio:n=2}=e,i=r.getContext("2d");i&&(this.needsUpdate&&this.update(),$r(i,n,this.boundingBox),Lr(i,this),Array.from(this.plugins.values()).sort((o,a)=>(o.renderOrder??0)-(a.renderOrder??0)).forEach(o=>{var a;if(o.render)(a=o.render)==null||a.call(o,i,this);else if(o.paths){const l=this.computedStyle;o.paths.forEach(h=>{te({ctx:i,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:r,pixelRatio:n}))}}function ia(s){const t=new Br(s);return s.load?t.load().then(()=>t.measure()):t.measure()}function oa(s){const t=new Br(s);return s.load?t.load().then(()=>t.render(s)):t.render(s)}E.Character=Zn,E.Fragment=Qn,E.Measurer=Qe,E.Paragraph=ae,E.Text=Br,E.definePlugin=Jo,E.drawPath=te,E.filterEmpty=Ze,E.getHighlightStyle=Je,E.getTransform2D=tr,E.hexToRgb=Ir,E.highlight=Jn,E.isEqualObject=Kn,E.isEqualValue=Kt,E.isNone=Nt,E.listStyle=ts,E.measureText=ia,E.needsFetch=Ke,E.parseColor=lt,E.parseColormap=Or,E.parseValueNumber=Ye,E.render=es,E.renderText=oa,E.setupView=$r,E.textDecoration=rs,E.textDefaultStyle=kr,E.uploadColor=kt,E.uploadColors=Lr,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
1
+ (function(E,lt){typeof exports=="object"&&typeof module<"u"?lt(exports):typeof define=="function"&&define.amd?define(["exports"],lt):(E=typeof globalThis<"u"?globalThis:E||self,lt(E.modernText={}))})(this,function(E){"use strict";var po=Object.defineProperty;var go=(E,lt,It)=>lt in E?po(E,lt,{enumerable:!0,configurable:!0,writable:!0,value:It}):E[lt]=It;var x=(E,lt,It)=>go(E,typeof lt!="symbol"?lt+"":lt,It);var Ht;function lt(o,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:s,stops:a}=zn(e,t.left,t.top,t.width,t.height),l=o.createLinearGradient(r,n,i,s);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return e}function It(o,e,t){o!=null&&o.color&&(o.color=lt(t,o.color,e)),o!=null&&o.backgroundColor&&(o.backgroundColor=lt(t,o.backgroundColor,e)),o!=null&&o.textStrokeColor&&(o.textStrokeColor=lt(t,o.textStrokeColor,e))}function zn(o,e,t,r,n){var p;const i=((p=o.match(/linear-gradient\((.+)\)$/))==null?void 0:p[1])??"",s=i.split(",")[0],a=s.includes("deg")?s:"0deg",l=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,f=r*Math.sin(c),u=n*Math.cos(c);return{x0:e+r/2-f,y0:t+n/2+u,x1:e+r/2+f,y1:t+n/2-u,stops:Array.from(l).map(g=>{let m=g[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(g[3].replace("%",""))/100,color:m}})}}function re(o){const{ctx:e,path:t,fontSize:r,clipRect:n}=o;e.save(),e.beginPath();const i=t.style,s={...i,fill:o.color??i.fill,stroke:o.textStrokeColor??i.stroke,strokeWidth:o.textStrokeWidth?o.textStrokeWidth*r:i.strokeWidth,shadowOffsetX:(o.shadowOffsetX??0)*r,shadowOffsetY:(o.shadowOffsetY??0)*r,shadowBlur:(o.shadowBlur??0)*r,shadowColor:o.shadowColor};n&&(e.rect(n.left,n.top,n.width,n.height),e.clip(),e.beginPath()),t.drawTo(e,s),e.restore()}function Or(o,e,t){const{left:r,top:n,width:i,height:s}=t,a=o.canvas;a.dataset.viewBox=`${r} ${n} ${i} ${s}`,a.dataset.pixelRatio=String(e);const l=i,h=s;a.width=Math.max(1,Math.ceil(l*e)),a.height=Math.max(1,Math.ceil(h*e)),a.style.width=`${l}px`,a.style.height=`${h}px`,o.clearRect(0,0,a.width,a.height),o.scale(e,e),o.translate(-r,-n)}function Ir(o,e){const{paragraphs:t,computedStyle:r,glyphBox:n}=e;It(r,n,o),t.forEach(i=>{It(i.computedStyle,i.lineBox,o),i.fragments.forEach(s=>{It(s.computedStyle,s.inlineBox,o)})})}var ht=Uint8Array,Pt=Uint16Array,Qe=Int32Array,_e=new ht([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Oe=new ht([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Je=new ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Br=function(o,e){for(var t=new Pt(31),r=0;r<31;++r)t[r]=e+=1<<o[r-1];for(var n=new Qe(t[30]),r=1;r<30;++r)for(var i=t[r];i<t[r+1];++i)n[i]=i-t[r]<<5|r;return{b:t,r:n}},Er=Br(_e,2),Ur=Er.b,tr=Er.r;Ur[28]=258,tr[258]=28;for(var Dr=Br(Oe,0),Fn=Dr.b,Lr=Dr.r,er=new Pt(32768),W=0;W<32768;++W){var jt=(W&43690)>>1|(W&21845)<<1;jt=(jt&52428)>>2|(jt&13107)<<2,jt=(jt&61680)>>4|(jt&3855)<<4,er[W]=((jt&65280)>>8|(jt&255)<<8)>>1}for(var Bt=function(o,e,t){for(var r=o.length,n=0,i=new Pt(e);n<r;++n)o[n]&&++i[o[n]-1];var s=new Pt(e);for(n=1;n<e;++n)s[n]=s[n-1]+i[n-1]<<1;var a;if(t){a=new Pt(1<<e);var l=15-e;for(n=0;n<r;++n)if(o[n])for(var h=n<<4|o[n],c=e-o[n],f=s[o[n]-1]++<<c,u=f|(1<<c)-1;f<=u;++f)a[er[f]>>l]=h}else for(a=new Pt(r),n=0;n<r;++n)o[n]&&(a[n]=er[s[o[n]-1]++]>>15-o[n]);return a},Gt=new ht(288),W=0;W<144;++W)Gt[W]=8;for(var W=144;W<256;++W)Gt[W]=9;for(var W=256;W<280;++W)Gt[W]=7;for(var W=280;W<288;++W)Gt[W]=8;for(var de=new ht(32),W=0;W<32;++W)de[W]=5;var Nn=Bt(Gt,9,0),qn=Bt(Gt,9,1),jn=Bt(de,5,0),Gn=Bt(de,5,1),rr=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},kt=function(o,e,t){var r=e/8|0;return(o[r]|o[r+1]<<8)>>(e&7)&t},nr=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},sr=function(o){return(o+7)/8|0},$r=function(o,e,t){return(t==null||t>o.length)&&(t=o.length),new ht(o.subarray(e,t))},Rn=["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"],At=function(o,e,t){var r=new Error(e||Rn[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,At),!t)throw r;return r},Vn=function(o,e,t,r){var n=o.length,i=0;if(!n||e.f&&!e.l)return t||new ht(0);var s=!t,a=s||e.i!=2,l=e.i;s&&(t=new ht(n*3));var h=function(Lt){var $t=t.length;if(Lt>$t){var qt=new ht(Math.max($t*2,Lt));qt.set(t),t=qt}},c=e.f||0,f=e.p||0,u=e.b||0,p=e.l,g=e.d,m=e.m,d=e.n,k=n*8;do{if(!p){c=kt(o,f,1);var S=kt(o,f+1,3);if(f+=3,S)if(S==1)p=qn,g=Gn,m=9,d=5;else if(S==2){var v=kt(o,f,31)+257,_=kt(o,f+10,15)+4,M=v+kt(o,f+5,31)+1;f+=14;for(var T=new ht(M),V=new ht(19),H=0;H<_;++H)V[Je[H]]=kt(o,f+H*3,7);f+=_*3;for(var U=rr(V),et=(1<<U)-1,P=Bt(V,U,1),H=0;H<M;){var z=P[kt(o,f,et)];f+=z&15;var C=z>>4;if(C<16)T[H++]=C;else{var q=0,F=0;for(C==16?(F=3+kt(o,f,3),f+=2,q=T[H-1]):C==17?(F=3+kt(o,f,7),f+=3):C==18&&(F=11+kt(o,f,127),f+=7);F--;)T[H++]=q}}var D=T.subarray(0,v),$=T.subarray(v);m=rr(D),d=rr($),p=Bt(D,m,1),g=Bt($,d,1)}else At(1);else{var C=sr(f)+4,A=o[C-4]|o[C-3]<<8,w=C+A;if(w>n){l&&At(0);break}a&&h(u+A),t.set(o.subarray(C,w),u),e.b=u+=A,e.p=f=w*8,e.f=c;continue}if(f>k){l&&At(0);break}}a&&h(u+131072);for(var nt=(1<<m)-1,O=(1<<d)-1,Z=f;;Z=f){var q=p[nr(o,f)&nt],G=q>>4;if(f+=q&15,f>k){l&&At(0);break}if(q||At(2),G<256)t[u++]=G;else if(G==256){Z=f,p=null;break}else{var j=G-254;if(G>264){var H=G-257,L=_e[H];j=kt(o,f,(1<<L)-1)+Ur[H],f+=L}var Q=g[nr(o,f)&O],Y=Q>>4;Q||At(3),f+=Q&15;var $=Fn[Y];if(Y>3){var L=Oe[Y];$+=nr(o,f)&(1<<L)-1,f+=L}if(f>k){l&&At(0);break}a&&h(u+131072);var st=u+j;if(u<$){var te=i-$,ee=Math.min($,st);for(te+u<0&&At(3);u<ee;++u)t[u]=r[te+u]}for(;u<st;++u)t[u]=t[u-$]}}e.l=p,e.p=Z,e.b=u,e.f=c,p&&(c=1,e.m=m,e.d=g,e.n=d)}while(!c);return u!=t.length&&s?$r(t,0,u):t.subarray(0,u)},Ft=function(o,e,t){t<<=e&7;var r=e/8|0;o[r]|=t,o[r+1]|=t>>8},ge=function(o,e,t){t<<=e&7;var r=e/8|0;o[r]|=t,o[r+1]|=t>>8,o[r+2]|=t>>16},ir=function(o,e){for(var t=[],r=0;r<o.length;++r)o[r]&&t.push({s:r,f:o[r]});var n=t.length,i=t.slice();if(!n)return{t:qr,l:0};if(n==1){var s=new ht(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(w,v){return w.f-v.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],h=0,c=1,f=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=t[t[h].f<t[f].f?h++:f++],l=t[h!=c&&t[h].f<t[f].f?h++:f++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var u=i[0].s,r=1;r<n;++r)i[r].s>u&&(u=i[r].s);var p=new Pt(u+1),g=or(t[c-1],p,0);if(g>e){var r=0,m=0,d=g-e,k=1<<d;for(i.sort(function(v,_){return p[_.s]-p[v.s]||v.f-_.f});r<n;++r){var S=i[r].s;if(p[S]>e)m+=k-(1<<g-p[S]),p[S]=e;else break}for(m>>=d;m>0;){var C=i[r].s;p[C]<e?m-=1<<e-p[C]++-1:++r}for(;r>=0&&m;--r){var A=i[r].s;p[A]==e&&(--p[A],++m)}g=e}return{t:new ht(p),l:g}},or=function(o,e,t){return o.s==-1?Math.max(or(o.l,e,t+1),or(o.r,e,t+1)):e[o.s]=t},zr=function(o){for(var e=o.length;e&&!o[--e];);for(var t=new Pt(++e),r=0,n=o[0],i=1,s=function(l){t[r++]=l},a=1;a<=e;++a)if(o[a]==n&&a!=e)++i;else{if(!n&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(n),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(n);i=1,n=o[a]}return{c:t.subarray(0,r),n:e}},ye=function(o,e){for(var t=0,r=0;r<e.length;++r)t+=o[r]*e[r];return t},Fr=function(o,e,t){var r=t.length,n=sr(e+2);o[n]=r&255,o[n+1]=r>>8,o[n+2]=o[n]^255,o[n+3]=o[n+1]^255;for(var i=0;i<r;++i)o[n+i+4]=t[i];return(n+4+r)*8},Nr=function(o,e,t,r,n,i,s,a,l,h,c){Ft(e,c++,t),++n[256];for(var f=ir(n,15),u=f.t,p=f.l,g=ir(i,15),m=g.t,d=g.l,k=zr(u),S=k.c,C=k.n,A=zr(m),w=A.c,v=A.n,_=new Pt(19),M=0;M<S.length;++M)++_[S[M]&31];for(var M=0;M<w.length;++M)++_[w[M]&31];for(var T=ir(_,7),V=T.t,H=T.l,U=19;U>4&&!V[Je[U-1]];--U);var et=h+5<<3,P=ye(n,Gt)+ye(i,de)+s,z=ye(n,u)+ye(i,m)+s+14+3*U+ye(_,V)+2*_[16]+3*_[17]+7*_[18];if(l>=0&&et<=P&&et<=z)return Fr(e,c,o.subarray(l,l+h));var q,F,D,$;if(Ft(e,c,1+(z<P)),c+=2,z<P){q=Bt(u,p,0),F=u,D=Bt(m,d,0),$=m;var nt=Bt(V,H,0);Ft(e,c,C-257),Ft(e,c+5,v-1),Ft(e,c+10,U-4),c+=14;for(var M=0;M<U;++M)Ft(e,c+3*M,V[Je[M]]);c+=3*U;for(var O=[S,w],Z=0;Z<2;++Z)for(var G=O[Z],M=0;M<G.length;++M){var j=G[M]&31;Ft(e,c,nt[j]),c+=V[j],j>15&&(Ft(e,c,G[M]>>5&127),c+=G[M]>>12)}}else q=Nn,F=Gt,D=jn,$=de;for(var M=0;M<a;++M){var L=r[M];if(L>255){var j=L>>18&31;ge(e,c,q[j+257]),c+=F[j+257],j>7&&(Ft(e,c,L>>23&31),c+=_e[j]);var Q=L&31;ge(e,c,D[Q]),c+=$[Q],Q>3&&(ge(e,c,L>>5&8191),c+=Oe[Q])}else ge(e,c,q[L]),c+=F[L]}return ge(e,c,q[256]),c+F[256]},Wn=new Qe([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qr=new ht(0),Xn=function(o,e,t,r,n,i){var s=i.z||o.length,a=new ht(r+s+5*(1+Math.ceil(s/7e3))+n),l=a.subarray(r,a.length-n),h=i.l,c=(i.r||0)&7;if(e){c&&(l[0]=i.r>>3);for(var f=Wn[e-1],u=f>>13,p=f&8191,g=(1<<t)-1,m=i.p||new Pt(32768),d=i.h||new Pt(g+1),k=Math.ceil(t/3),S=2*k,C=function(pe){return(o[pe]^o[pe+1]<<k^o[pe+2]<<S)&g},A=new Qe(25e3),w=new Pt(288),v=new Pt(32),_=0,M=0,T=i.i||0,V=0,H=i.w||0,U=0;T+2<s;++T){var et=C(T),P=T&32767,z=d[et];if(m[P]=z,d[et]=P,H<=T){var q=s-T;if((_>7e3||V>24576)&&(q>423||!h)){c=Nr(o,l,0,A,w,v,M,V,U,T-U,c),V=_=M=0,U=T;for(var F=0;F<286;++F)w[F]=0;for(var F=0;F<30;++F)v[F]=0}var D=2,$=0,nt=p,O=P-z&32767;if(q>2&&et==C(T-O))for(var Z=Math.min(u,q)-1,G=Math.min(32767,T),j=Math.min(258,q);O<=G&&--nt&&P!=z;){if(o[T+D]==o[T+D-O]){for(var L=0;L<j&&o[T+L]==o[T+L-O];++L);if(L>D){if(D=L,$=O,L>Z)break;for(var Q=Math.min(O,L-2),Y=0,F=0;F<Q;++F){var st=T-O+F&32767,te=m[st],ee=st-te&32767;ee>Y&&(Y=ee,z=st)}}}P=z,z=m[P],O+=P-z&32767}if($){A[V++]=268435456|tr[D]<<18|Lr[$];var Lt=tr[D]&31,$t=Lr[$]&31;M+=_e[Lt]+Oe[$t],++w[257+Lt],++v[$t],H=T+D,++_}else A[V++]=o[T],++w[o[T]]}}for(T=Math.max(T,H);T<s;++T)A[V++]=o[T],++w[o[T]];c=Nr(o,l,h,A,w,v,M,V,U,T-U,c),h||(i.r=c&7|l[c/8|0]<<3,c-=7,i.h=d,i.p=m,i.i=T,i.w=H)}else{for(var T=i.w||0;T<s+h;T+=65535){var qt=T+65535;qt>=s&&(l[c/8|0]=h,qt=s),c=Fr(l,c+1,o.subarray(T,qt))}i.i=s}return $r(a,0,r+sr(c)+n)},jr=function(){var o=1,e=0;return{p:function(t){for(var r=o,n=e,i=t.length|0,s=0;s!=i;){for(var a=Math.min(s+2655,i);s<a;++s)n+=r+=t[s];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}o=r,e=n},d:function(){return o%=65521,e%=65521,(o&255)<<24|(o&65280)<<8|(e&255)<<8|e>>8}}},Hn=function(o,e,t,r,n){if(!n&&(n={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),s=new ht(i.length+o.length);s.set(i),s.set(o,i.length),o=s,n.w=i.length}return Xn(o,e.level==null?6:e.level,e.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+e.mem,t,r,n)},Gr=function(o,e,t){for(;t;++e)o[e]=t,t>>>=8},Yn=function(o,e){var t=e.level,r=t==0?0:t<6?1:t==9?3:2;if(o[0]=120,o[1]=r<<6|(e.dictionary&&32),o[1]|=31-(o[0]<<8|o[1])%31,e.dictionary){var n=jr();n.p(e.dictionary),Gr(o,2,n.d())}},Zn=function(o,e){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&At(6,"invalid zlib data"),(o[1]>>5&1)==+!e&&At(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function Kn(o,e){e||(e={});var t=jr();t.p(o);var r=Hn(o,e,e.dictionary?6:2,4);return Yn(r,e),Gr(r,r.length-4,t.d()),r}function Qn(o,e){return Vn(o.subarray(Zn(o,e),-4),{i:2},e,e)}var Jn=typeof TextDecoder<"u"&&new TextDecoder,ts=0;try{Jn.decode(qr,{stream:!0}),ts=1}catch{}const es="modern-font";function me(o,e){if(!o)throw new Error(`[${es}] ${e}`)}function rs(o){if("buffer"in o){const e=o.buffer;return o.byteOffset>0||o.byteLength<o.buffer.byteLength?e.slice(o.byteOffset,o.byteOffset+o.byteLength):e}else return o}function ne(o){return"buffer"in o?new DataView(o.buffer,o.byteOffset,o.byteLength):new DataView(o)}function ns(o){let e="";for(let t=0,r=o.length,n;t<r;t++)n=o.charCodeAt(t),n!==0&&(e+=String.fromCharCode(n));return e}function Ie(o){o=ns(o);const e=[];for(let t=0,r=o.length,n;t<r;t++)n=o.charCodeAt(t),e.push(n>>8),e.push(n&255);return e}function ss(o){let e="";for(let t=0,r=o.length;t<r;t++)o[t]<127?e+=String.fromCharCode(o[t]):e+=`%${(256+o[t]).toString(16).slice(1)}`;return unescape(e)}function is(o){let e="";for(let t=0,r=o.length;t<r;t+=2)e+=String.fromCharCode((o[t]<<8)+o[t+1]);return e}var os=Object.defineProperty,ct=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&os(e,t,n),n};const Be={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ft(){return function(o,e){Object.defineProperty(o.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class ot extends DataView{constructor(t,r,n,i){super(rs(t),r,n);x(this,"cursor",0);this.littleEndian=i}readColumn(t){if(t.size){const r=Array.from({length:t.size},(n,i)=>this.read(t.type,t.offset+i));switch(t.type){case"char":return r.join("");default:return r}}else return this.read(t.type,t.offset)}writeColumn(t,r){t.size?Array.from({length:t.size},(n,i)=>{this.write(t.type,r[i],t.offset+i)}):this.write(t.type,r,t.offset)}read(t,r=this.cursor,n=this.littleEndian){var h;switch(t){case"char":return this.readChar(r);case"fixed":return this.readFixed(r,n);case"longDateTime":return this.readLongDateTime(r,n)}const i=`get${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,a=(h=s[i])==null?void 0:h.bind(s),l=a==null?void 0:a(r,n);return this.cursor+=Be[t],l}readUint24(t=this.cursor){const[r,n,i]=this.readBytes(t,3);return(r<<16)+(n<<8)+i}readBytes(t,r){r==null&&(r=t,t=this.cursor);const n=[];for(let i=0;i<r;++i)n.push(this.getUint8(t+i));return this.cursor=t+r,n}readString(t,r){const n=this.readBytes(t,r);let i="";for(let s=0,a=n.length;s<a;s++)i+=String.fromCharCode(n[s]);return i}readFixed(t,r){const n=this.readInt32(t,r)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,r){const n=this.readUint32(t+4,r),i=new Date;return i.setTime(n*1e3+-20775456e5),i}readChar(t){return this.readString(t,1)}write(t,r,n=this.cursor,i=this.littleEndian){var c;switch(t){case"char":return this.writeChar(r,n);case"fixed":return this.writeFixed(r,n);case"longDateTime":return this.writeLongDateTime(r,n)}const s=`set${t.replace(/^\S/,f=>f.toUpperCase())}`,a=this,l=(c=a[s])==null?void 0:c.bind(a),h=l==null?void 0:l(n,r,i);return this.cursor+=Be[t.toLowerCase()],h}writeString(t="",r=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(r);for(let i=0,s=t.length,a;i<s;++i)a=t.charCodeAt(i)||0,a>127?this.writeUint16(a):this.writeUint8(a);return this.cursor+=n,this}writeChar(t,r){return this.writeString(t,r)}writeFixed(t,r){return this.writeInt32(Math.round(t*65536),r),this}writeLongDateTime(t,r=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const i=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,r),this.writeUint32(i,r+4),this}writeBytes(t,r=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let i=0;i<n;++i)this.setUint8(r+i,t[i])}else{const i=ne(t);n=i.byteLength;for(let s=0;s<n;++s)this.setUint8(r+s,i.getUint8(s))}return this.cursor=r+n,this}seek(t){return this.cursor=t,this}}ct([ft()],ot.prototype,"readInt8"),ct([ft()],ot.prototype,"readInt16"),ct([ft()],ot.prototype,"readInt32"),ct([ft()],ot.prototype,"readUint8"),ct([ft()],ot.prototype,"readUint16"),ct([ft()],ot.prototype,"readUint32"),ct([ft()],ot.prototype,"readFloat32"),ct([ft()],ot.prototype,"readFloat64"),ct([ft()],ot.prototype,"writeInt8"),ct([ft()],ot.prototype,"writeInt16"),ct([ft()],ot.prototype,"writeInt32"),ct([ft()],ot.prototype,"writeUint8"),ct([ft()],ot.prototype,"writeUint16"),ct([ft()],ot.prototype,"writeUint32"),ct([ft()],ot.prototype,"writeFloat32"),ct([ft()],ot.prototype,"writeFloat64");const Rr=new WeakMap;function y(o){const e=typeof o=="object"?o:{type:o},{size:t=1,type:r}=e;return(n,i)=>{if(typeof i!="string")return;let s=Rr.get(n);s||(s={columns:[],byteLength:0},Rr.set(n,s));const a={...e,name:i,byteLength:t*Be[r],offset:e.offset??s.columns.reduce((l,h)=>l+h.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,h)=>l+Be[h.type]*(h.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Tt{constructor(e,t,r,n){x(this,"view");this.view=new ot(e,t,r,n)}}class ar extends Tt{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(e){return new FontFace(e,this.view.buffer)}}var as=Object.defineProperty,mt=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&as(e,t,n),n};const wt=class Un extends ar{constructor(){super(...arguments);x(this,"format","EmbeddedOpenType");x(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const r=t.sfnt,i=r.name.names,s=Ie(i.fontFamily||""),a=s.length,l=Ie(i.fontStyle||""),h=l.length,c=Ie(i.version||""),f=c.length,u=Ie(i.fullName||""),p=u.length,g=86+a+4+h+4+f+4+p+2+t.view.byteLength,m=new Un(new ArrayBuffer(g),0,g,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=r.head.checkSumAdjustment;const d=r.os2;return d&&(m.FontPANOSE=d.fontPANOSE,m.Italic=d.fsSelection,m.Weight=d.usWeightClass,m.fsType=d.fsType,m.UnicodeRange=d.ulUnicodeRange,m.CodePageRange=d.ulCodePageRange),m.view.writeUint16(a),m.view.writeBytes(s),m.view.writeUint16(0),m.view.writeUint16(h),m.view.writeBytes(l),m.view.writeUint16(0),m.view.writeUint16(f),m.view.writeBytes(c),m.view.writeUint16(0),m.view.writeUint16(p),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};mt([y("uint32")],wt.prototype,"EOTSize"),mt([y("uint32")],wt.prototype,"FontDataSize"),mt([y("uint32")],wt.prototype,"Version"),mt([y("uint32")],wt.prototype,"Flags"),mt([y({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),mt([y("uint8")],wt.prototype,"Charset"),mt([y("uint8")],wt.prototype,"Italic"),mt([y("uint32")],wt.prototype,"Weight"),mt([y("uint16")],wt.prototype,"fsType"),mt([y("uint16")],wt.prototype,"MagicNumber"),mt([y({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),mt([y({type:"uint8",size:8})],wt.prototype,"CodePageRange"),mt([y("uint32")],wt.prototype,"CheckSumAdjustment"),mt([y({type:"uint8",size:16})],wt.prototype,"Reserved"),mt([y("uint16")],wt.prototype,"Padding1");var ls=Object.defineProperty,Ee=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&ls(e,t,n),n};class we extends Tt{constructor(e,t){super(e,t,16)}}Ee([y({type:"char",size:4})],we.prototype,"tag"),Ee([y("uint32")],we.prototype,"checkSum"),Ee([y("uint32")],we.prototype,"offset"),Ee([y("uint32")],we.prototype,"length");const lr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],hs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class Vr{constructor(e){x(this,"index");x(this,"name");x(this,"isComposite",!1);x(this,"components",[]);x(this,"pathCommands",[]);const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.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=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,r=72,n={},i){const s=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=s,yScale:l=s}=n,h=this.pathCommands,c=[];for(let f=0,u=h.length;f<u;f+=1){const p=h[f];p.type==="M"?c.push({type:"M",x:e+p.x*a,y:t+-p.y*l}):p.type==="L"?c.push({type:"L",x:e+p.x*a,y:t+-p.y*l}):p.type==="Q"?c.push({type:"Q",x1:e+p.x1*a,y1:t+-p.y1*l,x:e+p.x*a,y:t+-p.y*l}):p.type==="C"?c.push({type:"C",x1:e+p.x1*a,y1:t+-p.y1*l,x2:e+p.x2*a,y2:t+-p.y2*l,x:e+p.x*a,y:t+-p.y*l}):p.type==="Z"&&c.push({type:"Z"})}return c}}class cs extends Vr{parse(e,t,r){const n=this,{nominalWidthX:i,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=e,h=e.topDict.paintType,c=this.index;let f,u,p,g;const m=[],d=[];let k=0,S=!1,C=!1,A=s,w=0,v=0;function _(P,z){m.push({type:"L",x:P,y:z})}function M(P,z,q,F,D,$){m.push({type:"C",x1:P,y1:z,x2:q,y2:F,x:D,y:$})}function T(P,z){C&&h!==2&&V(),C=!0,m.push({type:"M",x:P,y:z})}function V(){m.push({type:"Z"})}function H(P){m.push(...P)}function U(){d.length%2!==0&&!S&&(A=d.shift()+i),k+=d.length>>1,d.length=0,S=!0}function et(P){let z,q,F,D,$,nt,O,Z,G,j,L,Q,Y=0;for(;Y<P.length;){let st=P[Y++];switch(st){case 1:U();break;case 3:U();break;case 4:d.length>1&&!S&&(A=d.shift()+i,S=!0),v+=d.pop(),T(w,v);break;case 5:for(;d.length>0;)w+=d.shift(),v+=d.shift(),_(w,v);break;case 6:for(;d.length>0&&(w+=d.shift(),_(w,v),d.length!==0);)v+=d.shift(),_(w,v);break;case 7:for(;d.length>0&&(v+=d.shift(),_(w,v),d.length!==0);)w+=d.shift(),_(w,v);break;case 8:for(;d.length>0;)f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+d.shift(),M(f,u,p,g,w,v);break;case 10:$=d.pop()+l,nt=e.subrs[$],nt&&et(nt);break;case 11:return;case 12:switch(st=P[Y],Y+=1,st){case 35:f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),O=p+d.shift(),Z=g+d.shift(),G=O+d.shift(),j=Z+d.shift(),L=G+d.shift(),Q=j+d.shift(),w=L+d.shift(),v=Q+d.shift(),d.shift(),M(f,u,p,g,O,Z),M(G,j,L,Q,w,v);break;case 34:f=w+d.shift(),u=v,p=f+d.shift(),g=u+d.shift(),O=p+d.shift(),Z=g,G=O+d.shift(),j=g,L=G+d.shift(),Q=v,w=L+d.shift(),M(f,u,p,g,O,Z),M(G,j,L,Q,w,v);break;case 36:f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),O=p+d.shift(),Z=g,G=O+d.shift(),j=g,L=G+d.shift(),Q=j+d.shift(),w=L+d.shift(),M(f,u,p,g,O,Z),M(G,j,L,Q,w,v);break;case 37:f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),O=p+d.shift(),Z=g+d.shift(),G=O+d.shift(),j=Z+d.shift(),L=G+d.shift(),Q=j+d.shift(),Math.abs(L-w)>Math.abs(Q-v)?w=L+d.shift():v=Q+d.shift(),M(f,u,p,g,O,Z),M(G,j,L,Q,w,v);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+st}`),d.length=0}break;case 14:if(d.length>=4){const te=lr[d.pop()],ee=lr[d.pop()],Lt=d.pop(),$t=d.pop();if(te&&ee){n.isComposite=!0,n.components=[];const qt=e.charset.indexOf(te),pe=e.charset.indexOf(ee);n.components.push({glyphIndex:pe,dx:0,dy:0}),n.components.push({glyphIndex:qt,dx:$t,dy:Lt}),H(r.get(pe).pathCommands);const Ar=JSON.parse(JSON.stringify(r.get(qt).pathCommands));for(let _r=0;_r<Ar.length;_r+=1){const zt=Ar[_r];zt.type!=="Z"&&(zt.x+=$t,zt.y+=Lt),(zt.type==="Q"||zt.type==="C")&&(zt.x1+=$t,zt.y1+=Lt),zt.type==="C"&&(zt.x2+=$t,zt.y2+=Lt)}H(Ar)}}else d.length>0&&!S&&(A=d.shift()+i,S=!0);C&&h!==2&&(V(),C=!1);break;case 18:U();break;case 19:case 20:U(),Y+=k+7>>3;break;case 21:d.length>2&&!S&&(A=d.shift()+i,S=!0),v+=d.pop(),w+=d.pop(),T(w,v);break;case 22:d.length>1&&!S&&(A=d.shift()+i,S=!0),w+=d.pop(),T(w,v);break;case 23:U();break;case 24:for(;d.length>2;)f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+d.shift(),M(f,u,p,g,w,v);w+=d.shift(),v+=d.shift(),_(w,v);break;case 25:for(;d.length>6;)w+=d.shift(),v+=d.shift(),_(w,v);f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+d.shift(),M(f,u,p,g,w,v);break;case 26:for(d.length%2&&(w+=d.shift());d.length>0;)f=w,u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p,v=g+d.shift(),M(f,u,p,g,w,v);break;case 27:for(d.length%2&&(v+=d.shift());d.length>0;)f=w+d.shift(),u=v,p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g,M(f,u,p,g,w,v);break;case 28:z=P[Y],q=P[Y+1],d.push((z<<24|q<<16)>>16),Y+=2;break;case 29:$=d.pop()+a,nt=e.gsubrs[$],nt&&et(nt);break;case 30:for(;d.length>0&&(f=w,u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+(d.length===1?d.shift():0),M(f,u,p,g,w,v),d.length!==0);)f=w+d.shift(),u=v,p=f+d.shift(),g=u+d.shift(),v=g+d.shift(),w=p+(d.length===1?d.shift():0),M(f,u,p,g,w,v);break;case 31:for(;d.length>0&&(f=w+d.shift(),u=v,p=f+d.shift(),g=u+d.shift(),v=g+d.shift(),w=p+(d.length===1?d.shift():0),M(f,u,p,g,w,v),d.length!==0);)f=w,u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+(d.length===1?d.shift():0),M(f,u,p,g,w,v);break;default:st<32?console.warn(`Glyph ${c}: unknown operator ${st}`):st<247?d.push(st-139):st<251?(z=P[Y],Y+=1,d.push((st-247)*256+z+108)):st<255?(z=P[Y],Y+=1,d.push(-(st-251)*256-z-108)):(z=P[Y],q=P[Y+1],F=P[Y+2],D=P[Y+3],Y+=4,d.push((z<<24|q<<16|F<<8|D)/65536))}}}et(t),this.pathCommands=m,S&&(this.advanceWidth=A)}}class Wr{constructor(e){x(this,"_items",[]);this._sfnt=e}get(e){const t=this._items[e];let r;if(t)r=t;else{r=this._get(e);const n=this._sfnt.hmtx.metrics[e];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[e]=r}return r}}class fs extends Wr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,r=new cs({index:e});return r.parse(t,t.charStringsIndex.get(e),this),r.name=t.charset[e],r}}var us=Object.defineProperty,Xr=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&us(e,t,n),n};class Ue extends Tt{constructor(t,r,n,i){super(t,r,n,i);x(this,"_offsets");x(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,r=this.count,n=this.offsetSize;this.objectOffset=(r+1)*n+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[r]}readOffsets(){const t=this.view,r=this.count,n=this.offsetSize;t.seek(3);const i=[];for(let s=0,a=r+1;s<a;s++){const l=this.view;let h=0;for(let c=0;c<n;c++)h<<=8,h+=l.readUint8();i.push(h)}return i}readObjects(){const t=[];for(let r=0,n=this.count;r<n;r++)t.push(this.get(r));return t}get(t){const r=this.offsets,n=this.objectOffset,i=n+r[t],a=n+r[t+1]-i;return this._isString?this.view.readString(i,a):this.view.readBytes(i,a)}}Xr([y("uint16")],Ue.prototype,"count"),Xr([y("uint8")],Ue.prototype,"offsetSize");class De extends Ue{constructor(){super(...arguments);x(this,"_isString",!1)}}class Hr extends Ue{constructor(){super(...arguments);x(this,"_isString",!0)}}const ps=[".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"],ds=[".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"],gs=[".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"],ys=[".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(o,e){return e<=390?ps[e]:o[e-391]}function X(o,e="number",t){return(r,n)=>{if(typeof n!="string")return;const i={type:e,operator:o,default:t??e==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(s){this._setProp(i,s)},configurable:!0,enumerable:!0})}}class Yr extends Tt{constructor(){super(...arguments);x(this,"_dict");x(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let r="";const n=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=t.readUint8(),a=s>>4,l=s&15;if(a===n||(r+=i[a],l===n))break;r+=i[l]}return Number.parseFloat(r)}_readOperand(t){const r=this.view;let n,i,s,a;if(t===28)return n=r.readUint8(),i=r.readUint8(),n<<8|i;if(t===29)return n=r.readUint8(),i=r.readUint8(),s=r.readUint8(),a=r.readUint8(),n<<24|i<<16|s<<8|a;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return n=r.readUint8(),(t-247)*256+n+108;if(t>=251&&t<=254)return n=r.readUint8(),-(t-251)*256-n-108;throw new Error(`invalid b0 ${t}, at: ${r.cursor}`)}_readDict(){const t=this.view;t.seek(0);let r=[];const n=t.cursor+t.byteLength,i={};for(;t.cursor<n;){let s=t.readUint8();s<=21?(s===12&&(s=1200+t.readUint8()),i[s]=r,r=[]):r.push(this._readOperand(s))}return i}_getProp(t){var n;const r=this.dict[t.operator]??t.default;switch(t.type){case"number":return r[0];case"string":return Le(((n=this._stringIndex)==null?void 0:n.objects)??[],r[0]);case"number[]":return r}return r}_setProp(t,r){}}var ms=Object.defineProperty,hr=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&ms(e,t,n),n};class $e extends Yr{}hr([X(19)],$e.prototype,"subrs"),hr([X(20)],$e.prototype,"defaultWidthX"),hr([X(21)],$e.prototype,"nominalWidthX");var ws=Object.defineProperty,J=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&ws(e,t,n),n};class K extends Yr{}J([X(0,"string")],K.prototype,"version"),J([X(1,"string")],K.prototype,"notice"),J([X(1200,"string")],K.prototype,"copyright"),J([X(2,"string")],K.prototype,"fullName"),J([X(3,"string")],K.prototype,"familyName"),J([X(4,"string")],K.prototype,"weight"),J([X(1201)],K.prototype,"isFixedPitch"),J([X(1202)],K.prototype,"italicAngle"),J([X(1203,"number",-100)],K.prototype,"underlinePosition"),J([X(1204,"number",50)],K.prototype,"underlineThickness"),J([X(1205)],K.prototype,"paintType"),J([X(1206,"number",2)],K.prototype,"charstringType"),J([X(1207,"number[]",[.001,0,0,.001,0,0])],K.prototype,"fontMatrix"),J([X(13)],K.prototype,"uniqueId"),J([X(5,"number[]",[0,0,0,0])],K.prototype,"fontBBox"),J([X(1208)],K.prototype,"strokeWidth"),J([X(14)],K.prototype,"xuid"),J([X(15)],K.prototype,"charset"),J([X(16)],K.prototype,"encoding"),J([X(17)],K.prototype,"charStrings"),J([X(18,"number[]",[0,0])],K.prototype,"private");function ut(o,e=o){return t=>{se.tableDefinitions.set(o,{tag:o,prop:e,class:t}),Object.defineProperty(se.prototype,e,{get(){return this.get(o)},set(r){return this.set(o,r)},configurable:!0,enumerable:!0})}}const Jt=class Jt{constructor(e){x(this,"tables",new Map);x(this,"tableViews",new Map);(e instanceof Map?e:new Map(Object.entries(e))).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(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;t=n.indexOf(r[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const r of e)t.push(this.charToGlyphIndex(r));return t}textToGlyphs(e){const t=this.glyphs,r=this.textToGlyphIndexes(e),n=r.length,i=Array.from({length:n}),s=t.get(0);for(let a=0;a<n;a+=1)i[a]=t.get(r[a])||s;return i}getPathCommands(e,t,r,n,i){const s=[];return this.forEachGlyph(e,t,r,n,i,(a,l,h,c,f)=>{s.push(...a.getPathCommands(l,h,c,f,this))}),s}getAdvanceWidth(e,t,r){return this.forEachGlyph(e,0,0,t,r,()=>{})}forEachGlyph(e,t=0,r=0,n=72,i={},s){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(e);for(let h=0;h<l.length;h+=1){const c=l[h];s.call(this,c,t,r,n,i),c.advanceWidth&&(t+=c.advanceWidth*a),i.letterSpacing?t+=i.letterSpacing*n:i.tracking&&(t+=i.tracking/1e3*n)}return t}clone(){return new Jt(this.tableViews)}delete(e){const t=Jt.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const r=Jt.tableDefinitions.get(e);return r&&this.tables.set(r.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=Jt.tableDefinitions.get(e);if(!t)return;let r=this.tables.get(t.prop);if(!r){const n=t.class;if(n){const i=this.tableViews.get(e);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(t.prop,r)}}return r}};x(Jt,"tableDefinitions",new Map);let se=Jt;class pt extends Tt{setSfnt(e){return this._sfnt=e,this}getSfnt(){return this._sfnt}}var xs=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,xe=(o,e,t,r)=>{for(var n=r>1?void 0:r?vs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&xs(e,t,n),n};let ie=class extends pt{constructor(e,t,r,n){super(e,t,r,n);x(this,"_glyphs");x(this,"privateDict");x(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 e;return((e=this.privateDict)==null?void 0:e.defaultWidthX)??0}get nominalWidthX(){var e;return((e=this.privateDict)==null?void 0:e.nominalWidthX)??0}get subrs(){var e;return((e=this.subrsIndex)==null?void 0:e.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const e=this.view,{buffer:t,byteOffset:r}=e,n=r+4;this.nameIndex=new Hr(t,n),this.topDictIndex=new De(t,this.nameIndex.endOffset),this.stringIndex=new Hr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new De(t,this.stringIndex.endOffset),this.topDict=new K(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],s=this.topDict.private[1];i&&(this.privateDict=new $e(t,r+s,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new De(t,r+s+this.privateDict.subrs))),this.charStringsIndex=new De(t,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=ds:this.topDict.charset===1?this.charset=gs:this.topDict.charset===2?this.charset=ys:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=lr:this.topDict.encoding===1?this.encoding=hs:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(e,t,r){const n=this.view;n.seek(e);let i,s,a;t-=1;const l=[".notdef"],h=n.readUint8();if(h===0)for(i=0;i<t;i+=1)s=n.readUint16(),l.push(Le(r,s));else if(h===1)for(;l.length<=t;)for(s=n.readUint16(),a=n.readUint8(),i=0;i<=a;i+=1)l.push(Le(r,s)),s+=1;else if(h===2)for(;l.length<=t;)for(s=n.readUint16(),a=n.readUint16(),i=0;i<=a;i+=1)l.push(Le(r,s)),s+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(e){const t=this.view;t.seek(e);let r,n;const i={},s=t.readUint8();if(s===0){const a=t.readUint8();for(r=0;r<a;r+=1)n=t.readUint8(),i[n]=r}else if(s===1){const a=t.readUint8();for(n=1,r=0;r<a;r+=1){const l=t.readUint8(),h=t.readUint8();for(let c=l;c<=l+h;c+=1)i[c]=n,n+=1}}else console.warn(`unknown encoding format:${s}`);return i}_calcSubroutineBias(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}};xe([y("uint8")],ie.prototype,"majorVersion",2),xe([y("uint8")],ie.prototype,"minorVersion",2),xe([y("uint8")],ie.prototype,"headerSize",2),xe([y("uint8")],ie.prototype,"offsetSize",2),ie=xe([ut("CFF ","cff")],ie);var bs=Object.defineProperty,ze=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&bs(e,t,n),n};const ve=class Dn extends Tt{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new Dn;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((r,n)=>{n<256&&r<256&&t.view.writeUint8(r,6+n)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,r)=>{e.set(r,t)}),e}};ze([y("uint16")],ve.prototype,"format"),ze([y("uint16")],ve.prototype,"length"),ze([y("uint16")],ve.prototype,"language"),ze([y({type:"uint8",size:256})],ve.prototype,"glyphIndexArray");let Zr=ve;var Ss=Object.defineProperty,cr=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Ss(e,t,n),n};class Fe extends Tt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-r)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const r=(this.view.byteLength-t)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,i=this.subHeaders,s=this.glyphIndexArray,a=r.findIndex(h=>h===n);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<i[0].firstCode||h>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(h-i[0].firstCode)>=s.length?l=0:(l=s[i[0].idRangeOffset+(h-i[0].firstCode)],l!==0&&(l=l+i[0].idDelta)),l!==0&&l<e&&t.set(h,l);else{const c=r[h];for(let f=0,u=i[c].entryCount;f<u;f++)if(i[c].idRangeOffset+f>=s.length?l=0:(l=s[i[c].idRangeOffset+f],l!==0&&(l=l+i[c].idDelta)),l!==0&&l<e){const p=(h<<8|f+i[c].firstCode)%65535;t.set(p,l)}}return t}}cr([y("uint16")],Fe.prototype,"format"),cr([y("uint16")],Fe.prototype,"length"),cr([y("uint16")],Fe.prototype,"language");function Kr(o){return o>32767?o-65536:o<-32767?o+65536:o}function Qr(o,e){let t;const r=[];let n={};return o.forEach((i,s)=>{e&&s>e||((!t||s!==t.unicode+1||i!==t.glyphIndex+1)&&(t?(n.end=t.unicode,r.push(n),n={start:s,startId:i,delta:Kr(i-s)}):(n.start=Number(s),n.startId=i,n.delta=Kr(i-s))),t={unicode:s,glyphIndex:i})}),t&&(n.end=t.unicode,r.push(n)),r}var Cs=Object.defineProperty,Yt=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Cs(e,t,n),n};const Rt=class Ln extends Tt{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=Qr(e,65535),r=t.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,s=new Ln(new ArrayBuffer(24+t.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=r*2,s.searchRange=i,s.entrySelector=n,s.rangeShift=2*r-i,s.endCode=[...t.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...t.map(a=>a.start),65535],s.idDelta=[...t.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:r},()=>0),s}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<t;++h)for(let c=n[h],f=i[h];c<=f;++c)if(s[h]===0)e.set(c,(c+a[h])%65536);else{const u=h+s[h]/2+(c-n[h])-r,p=l[u];p!==0?e.set(c,(p+a[h])%65536):e.set(c,0)}return e.delete(65535),e}};Yt([y("uint16")],Rt.prototype,"format"),Yt([y("uint16")],Rt.prototype,"length"),Yt([y("uint16")],Rt.prototype,"language"),Yt([y("uint16")],Rt.prototype,"segCountX2"),Yt([y("uint16")],Rt.prototype,"searchRange"),Yt([y("uint16")],Rt.prototype,"entrySelector"),Yt([y("uint16")],Rt.prototype,"rangeShift");let Jr=Rt;var Ps=Object.defineProperty,be=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Ps(e,t,n),n};class oe extends Tt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((r,n)=>{t.set(n,r)}),t}}be([y("uint16")],oe.prototype,"format"),be([y("uint16")],oe.prototype,"length"),be([y("uint16")],oe.prototype,"language"),be([y("uint16")],oe.prototype,"firstCode"),be([y("uint16")],oe.prototype,"entryCount");var Ms=Object.defineProperty,Se=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Ms(e,t,n),n};const ae=class $n extends Tt{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=Qr(e),r=new $n(new ArrayBuffer(16+t.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=t.length,t.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let r=0,n=t.length;r<n;r++){const i=t[r];let s=i.startGlyphCode,a=i.startCharCode;const l=i.endCharCode;for(;a<=l;)e.set(a++,s++)}return e}};Se([y("uint16")],ae.prototype,"format"),Se([y("uint16")],ae.prototype,"reserved"),Se([y("uint32")],ae.prototype,"length"),Se([y("uint32")],ae.prototype,"language"),Se([y("uint32")],ae.prototype,"nGroups");let tn=ae;var Ts=Object.defineProperty,fr=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Ts(e,t,n),n};class Ne extends Tt{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const r=this.view.readUint32();t.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const r=this.view.readUint32();t.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let r=0,n=t.length;r<n;r++){const{uVSMappings:i}=t[r];i.forEach(s=>{e.set(s.unicodeValue,s.glyphID)})}return e}}fr([y("uint16")],Ne.prototype,"format"),fr([y("uint32")],Ne.prototype,"length"),fr([y("uint32")],Ne.prototype,"numVarSelectorRecords");var ks=Object.defineProperty,As=Object.getOwnPropertyDescriptor,ur=(o,e,t,r)=>{for(var n=r>1?void 0:r?As(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ks(e,t,n),n};let Ce=class extends pt{constructor(){super(...arguments);x(this,"_unicodeToGlyphIndexMap");x(this,"_glyphIndexToUnicodesMap")}static from(e){const t=Array.from(e.keys()).some(f=>f>65535),r=Jr.from(e),n=Zr.from(e),i=t?tn.from(e):void 0,s=4+(i?32:24),a=s+r.view.byteLength,l=a+n.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},i&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new Ce(new ArrayBuffer(4+8*h.length+r.view.byteLength+n.view.byteLength+((i==null?void 0:i.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(f=>{c.view.writeUint16(f.platformID),c.view.writeUint16(f.platformSpecificID),c.view.writeUint32(f.offset)}),c.view.writeBytes(r.view,s),c.view.writeBytes(n.view,a),i&&c.view.writeBytes(i.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const e=new Map,t=this.unicodeToGlyphIndexMap,r=Array.from(t.keys());for(let n=0,i=r.length;n<i;n++){const s=r[n],a=t.get(s);e.has(a)?e.get(a).push(s):e.set(a,[s])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){const e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new Zr(this.view.buffer,t.offset);break;case 2:n=new Fe(this.view.buffer,t.offset,this.view.readUint16());break;case 4:n=new Jr(this.view.buffer,t.offset,this.view.readUint16());break;case 6:n=new oe(this.view.buffer,t.offset,this.view.readUint16());break;case 12:n=new tn(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:n=new Ne(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,l,h,c,f;const e=this.readSubtables(),t=(a=e.find(u=>u.format===0))==null?void 0:a.view,r=(l=e.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:l.view,n=(h=e.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:h.view,i=(c=e.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:c.view,s=(f=e.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:f.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}};ur([y("uint16")],Ce.prototype,"version",2),ur([y("uint16")],Ce.prototype,"numberSubtables",2),Ce=ur([ut("cmap")],Ce);class _s extends Vr{_parseContours(e){const t=[];let r=[];for(let n=0;n<e.length;n+=1){const i=e[n];r.push(i),i.lastPointOfContour&&(t.push(r),r=[])}return me(r.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const r=[];for(let n=0;n<e.length;n+=1){const i=e[n],s={x:t.xScale*i.x+t.scale10*i.y+t.dx,y:t.scale01*i.x+t.yScale*i.y+t.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(s)}return r}_parseGlyphCoordinate(e,t,r,n,i){let s;return(t&n)>0?(s=e.view.readUint8(),t&i||(s=-s),s=r+s):(t&i)>0?s=r:s=r+e.view.readInt16(),s}parse(e,t,r){e.view.seek(t);const n=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let m=0;m<n;m++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();me(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(e.view.readUint8());const c=e.view.byteOffset,f=a[a.length-1]+1;me(f<2e4,`Bad numberOfCoordinates:${c}`);const u=[];let p,g=0;for(;g<f;)if(p=e.view.readUint8(),u.push(p),g++,p&8&&g<f){const m=e.view.readUint8();for(let d=0;d<m;d++)u.push(p),g++}if(me(u.length===f,`Bad flags length: ${u.length}, numberOfCoordinates: ${f}`),a.length>0){const m=[];let d;if(f>0){for(let C=0;C<f;C+=1)p=u[C],d={},d.onCurve=!!(p&1),d.lastPointOfContour=a.includes(C),m.push(d);let k=0;for(let C=0;C<f;C+=1)p=u[C],d=m[C],d.x=this._parseGlyphCoordinate(e,p,k,2,16),k=d.x;let S=0;for(let C=0;C<f;C+=1)p=u[C],d=m[C],d.y=this._parseGlyphCoordinate(e,p,S,4,32),S=d.y}this.points=m}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const h={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=e.view.readInt16(),h.dy=e.view.readInt16()):h.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(h.dx=e.view.readInt8(),h.dy=e.view.readInt8()):h.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?h.xScale=h.yScale=e.view.readInt16()/16384:(a&64)>0?(h.xScale=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384):(a&128)>0&&(h.xScale=e.view.readInt16()/16384,h.scale01=e.view.readInt16()/16384,h.scale10=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=r.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{me(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const f=this.points[l.matchedPoints[0]];let u=h.points[l.matchedPoints[1]];const p={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};u=this._transformPoints([u],p)[0],p.dx=f.x-u.x,p.dy=f.y-u.y,c=this._transformPoints(h.points,p)}this.points=this.points.concat(c)}}const i=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const h=s[a];let c=h[h.length-1],f=h[0];c.onCurve?i.push({type:"M",x:c.x,y:c.y}):f.onCurve?i.push({type:"M",x:f.x,y:f.y}):i.push({type:"M",x:(c.x+f.x)*.5,y:(c.y+f.y)*.5});for(let u=0,p=h.length;u<p;++u)if(c=f,f=h[(u+1)%p],c.onCurve)i.push({type:"L",x:c.x,y:c.y});else{let g=f;f.onCurve||(g={x:(c.x+f.x)*.5,y:(c.y+f.y)*.5}),i.push({type:"Q",x1:c.x,y1:c.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class Os extends Wr{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,r=t[e],n=new _s({index:e});return r!==t[e+1]&&n.parse(this._sfnt.glyf,r,this),n}}var Is=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Es=(o,e,t,r)=>{for(var n=r>1?void 0:r?Bs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Is(e,t,n),n};let pr=class extends pt{constructor(){super(...arguments);x(this,"_glyphs")}static from(e){const t=e.reduce((n,i)=>n+i.byteLength,0),r=new pr(new ArrayBuffer(t));return e.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new Os(this._sfnt))}};pr=Es([ut("glyf")],pr);var Us=Object.defineProperty,Ds=Object.getOwnPropertyDescriptor,Ls=(o,e,t,r)=>{for(var n=r>1?void 0:r?Ds(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Us(e,t,n),n};let en=class extends pt{};en=Ls([ut("GPOS","gpos")],en);var $s=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Zt=(o,e,t,r)=>{for(var n=r>1?void 0:r?zs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&$s(e,t,n),n};let Vt=class extends pt{};Zt([y("uint16")],Vt.prototype,"majorVersion",2),Zt([y("uint16")],Vt.prototype,"minorVersion",2),Zt([y("uint16")],Vt.prototype,"scriptListOffset",2),Zt([y("uint16")],Vt.prototype,"featureListOffset",2),Zt([y("uint16")],Vt.prototype,"lookupListOffset",2),Zt([y("uint16")],Vt.prototype,"featureVariationsOffset",2),Vt=Zt([ut("GSUB","gsub")],Vt);var Fs=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,it=(o,e,t,r)=>{for(var n=r>1?void 0:r?Ns(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Fs(e,t,n),n};let rt=class extends pt{constructor(o=new ArrayBuffer(54),e){super(o,e,Math.min(54,o.byteLength-(e??0)))}};it([y("fixed")],rt.prototype,"version",2),it([y("fixed")],rt.prototype,"fontRevision",2),it([y("uint32")],rt.prototype,"checkSumAdjustment",2),it([y("uint32")],rt.prototype,"magickNumber",2),it([y("uint16")],rt.prototype,"flags",2),it([y("uint16")],rt.prototype,"unitsPerEm",2),it([y({type:"longDateTime"})],rt.prototype,"created",2),it([y({type:"longDateTime"})],rt.prototype,"modified",2),it([y("int16")],rt.prototype,"xMin",2),it([y("int16")],rt.prototype,"yMin",2),it([y("int16")],rt.prototype,"xMax",2),it([y("int16")],rt.prototype,"yMax",2),it([y("uint16")],rt.prototype,"macStyle",2),it([y("uint16")],rt.prototype,"lowestRecPPEM",2),it([y("int16")],rt.prototype,"fontDirectionHint",2),it([y("int16")],rt.prototype,"indexToLocFormat",2),it([y("int16")],rt.prototype,"glyphDataFormat",2),rt=it([ut("head")],rt);var qs=Object.defineProperty,js=Object.getOwnPropertyDescriptor,xt=(o,e,t,r)=>{for(var n=r>1?void 0:r?js(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&qs(e,t,n),n};let dt=class extends pt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};xt([y("fixed")],dt.prototype,"version",2),xt([y("int16")],dt.prototype,"ascent",2),xt([y("int16")],dt.prototype,"descent",2),xt([y("int16")],dt.prototype,"lineGap",2),xt([y("uint16")],dt.prototype,"advanceWidthMax",2),xt([y("int16")],dt.prototype,"minLeftSideBearing",2),xt([y("int16")],dt.prototype,"minRightSideBearing",2),xt([y("int16")],dt.prototype,"xMaxExtent",2),xt([y("int16")],dt.prototype,"caretSlopeRise",2),xt([y("int16")],dt.prototype,"caretSlopeRun",2),xt([y("int16")],dt.prototype,"caretOffset",2),xt([y({type:"int16",size:4})],dt.prototype,"reserved",2),xt([y("int16")],dt.prototype,"metricDataFormat",2),xt([y("uint16")],dt.prototype,"numOfLongHorMetrics",2),dt=xt([ut("hhea")],dt);var Gs=Object.defineProperty,Rs=Object.getOwnPropertyDescriptor,Vs=(o,e,t,r)=>{for(var n=r>1?void 0:r?Rs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Gs(e,t,n),n};let dr=class extends pt{constructor(){super(...arguments);x(this,"_metrics")}static from(e){const t=e.length*4,r=new dr(new ArrayBuffer(t));return e.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:e}).map((i,s)=>(s<t&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}};dr=Vs([ut("hmtx")],dr);var Ws=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,Hs=(o,e,t,r)=>{for(var n=r>1?void 0:r?Xs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Ws(e,t,n),n};let rn=class extends pt{};rn=Hs([ut("kern","kern")],rn);var Ys=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Ks=(o,e,t,r)=>{for(var n=r>1?void 0:r?Zs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Ys(e,t,n),n};let gr=class extends pt{constructor(){super(...arguments);x(this,"_locations")}static from(e,t=1){const r=e.length*(t?4:2),n=new gr(new ArrayBuffer(r));return e.forEach(i=>{t?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:e}).map(()=>t?r.readUint32():r.readUint16()*2)}};gr=Ks([ut("loca")],gr);var Qs=Object.defineProperty,Js=Object.getOwnPropertyDescriptor,gt=(o,e,t,r)=>{for(var n=r>1?void 0:r?Js(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Qs(e,t,n),n};let at=class extends pt{constructor(o=new ArrayBuffer(32),e){super(o,e,Math.min(32,o.byteLength-(e??0)))}};gt([y("fixed")],at.prototype,"version",2),gt([y("uint16")],at.prototype,"numGlyphs",2),gt([y("uint16")],at.prototype,"maxPoints",2),gt([y("uint16")],at.prototype,"maxContours",2),gt([y("uint16")],at.prototype,"maxComponentPoints",2),gt([y("uint16")],at.prototype,"maxComponentContours",2),gt([y("uint16")],at.prototype,"maxZones",2),gt([y("uint16")],at.prototype,"maxTwilightPoints",2),gt([y("uint16")],at.prototype,"maxStorage",2),gt([y("uint16")],at.prototype,"maxFunctionDefs",2),gt([y("uint16")],at.prototype,"maxInstructionDefs",2),gt([y("uint16")],at.prototype,"maxStackElements",2),gt([y("uint16")],at.prototype,"maxSizeOfInstructions",2),gt([y("uint16")],at.prototype,"maxComponentElements",2),gt([y("uint16")],at.prototype,"maxComponentDepth",2),at=gt([ut("maxp")],at);var ti=Object.defineProperty,ei=Object.getOwnPropertyDescriptor,qe=(o,e,t,r)=>{for(var n=r>1?void 0:r?ei(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ti(e,t,n),n};const nn={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"},yr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},ri={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},sn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let Pe=class extends pt{constructor(){super(...arguments);x(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const e=this.count;this.view.seek(6);const t=[];for(let l=0;l<e;++l)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 r=this.stringOffset;for(let l=0;l<e;++l){const h=t[l];h.name=this.view.readBytes(r+h.offset,h.length)}let n=yr.Macintosh,i=ri.Default,s=0;t.some(l=>l.platform===yr.Microsoft&&l.encoding===sn.UCS2&&l.language===1033)&&(n=yr.Microsoft,i=sn.UCS2,s=1033);const a={};for(let l=0;l<e;++l){const h=t[l];h.platform===n&&h.encoding===i&&h.language===s&&nn[h.nameId]&&(a[nn[h.nameId]]=s===0?ss(h.name):is(h.name))}return a}};qe([y("uint16")],Pe.prototype,"format",2),qe([y("uint16")],Pe.prototype,"count",2),qe([y("uint16")],Pe.prototype,"stringOffset",2),Pe=qe([ut("name")],Pe);var ni=Object.defineProperty,si=Object.getOwnPropertyDescriptor,B=(o,e,t,r)=>{for(var n=r>1?void 0:r?si(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ni(e,t,n),n};let I=class extends pt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};B([y("uint16")],I.prototype,"version",2),B([y("int16")],I.prototype,"xAvgCharWidth",2),B([y("uint16")],I.prototype,"usWeightClass",2),B([y("uint16")],I.prototype,"usWidthClass",2),B([y("uint16")],I.prototype,"fsType",2),B([y("uint16")],I.prototype,"ySubscriptXSize",2),B([y("uint16")],I.prototype,"ySubscriptYSize",2),B([y("uint16")],I.prototype,"ySubscriptXOffset",2),B([y("uint16")],I.prototype,"ySubscriptYOffset",2),B([y("uint16")],I.prototype,"ySuperscriptXSize",2),B([y("uint16")],I.prototype,"ySuperscriptYSize",2),B([y("uint16")],I.prototype,"ySuperscriptXOffset",2),B([y("uint16")],I.prototype,"ySuperscriptYOffset",2),B([y("uint16")],I.prototype,"yStrikeoutSize",2),B([y("uint16")],I.prototype,"yStrikeoutPosition",2),B([y("uint16")],I.prototype,"sFamilyClass",2),B([y({type:"uint8"})],I.prototype,"bFamilyType",2),B([y({type:"uint8"})],I.prototype,"bSerifStyle",2),B([y({type:"uint8"})],I.prototype,"bWeight",2),B([y({type:"uint8"})],I.prototype,"bProportion",2),B([y({type:"uint8"})],I.prototype,"bContrast",2),B([y({type:"uint8"})],I.prototype,"bStrokeVariation",2),B([y({type:"uint8"})],I.prototype,"bArmStyle",2),B([y({type:"uint8"})],I.prototype,"bLetterform",2),B([y({type:"uint8"})],I.prototype,"bMidline",2),B([y({type:"uint8"})],I.prototype,"bXHeight",2),B([y({type:"uint8",size:16})],I.prototype,"ulUnicodeRange",2),B([y({type:"char",size:4})],I.prototype,"achVendID",2),B([y("uint16")],I.prototype,"fsSelection",2),B([y("uint16")],I.prototype,"usFirstCharIndex",2),B([y("uint16")],I.prototype,"usLastCharIndex",2),B([y("int16")],I.prototype,"sTypoAscender",2),B([y("int16")],I.prototype,"sTypoDescender",2),B([y("int16")],I.prototype,"sTypoLineGap",2),B([y("uint16")],I.prototype,"usWinAscent",2),B([y("uint16")],I.prototype,"usWinDescent",2),B([y({offset:72,type:"uint8",size:8})],I.prototype,"ulCodePageRange",2),B([y({offset:72,type:"int16"})],I.prototype,"sxHeight",2),B([y("int16")],I.prototype,"sCapHeight",2),B([y("uint16")],I.prototype,"usDefaultChar",2),B([y("uint16")],I.prototype,"usBreakChar",2),B([y("uint16")],I.prototype,"usMaxContext",2),I=B([ut("OS/2","os2")],I);var ii=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,Et=(o,e,t,r)=>{for(var n=r>1?void 0:r?oi(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ii(e,t,n),n};let _t=class extends pt{constructor(o=new ArrayBuffer(32),e,t){super(o,e,t)}};Et([y("fixed")],_t.prototype,"format",2),Et([y("fixed")],_t.prototype,"italicAngle",2),Et([y("int16")],_t.prototype,"underlinePosition",2),Et([y("int16")],_t.prototype,"underlineThickness",2),Et([y("uint32")],_t.prototype,"isFixedPitch",2),Et([y("uint32")],_t.prototype,"minMemType42",2),Et([y("uint32")],_t.prototype,"maxMemType42",2),Et([y("uint32")],_t.prototype,"minMemType1",2),Et([y("uint32")],_t.prototype,"maxMemType1",2),_t=Et([ut("post")],_t);var ai=Object.defineProperty,li=Object.getOwnPropertyDescriptor,vt=(o,e,t,r)=>{for(var n=r>1?void 0:r?li(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ai(e,t,n),n};let yt=class extends pt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};vt([y("fixed")],yt.prototype,"version",2),vt([y("int16")],yt.prototype,"vertTypoAscender",2),vt([y("int16")],yt.prototype,"vertTypoDescender",2),vt([y("int16")],yt.prototype,"vertTypoLineGap",2),vt([y("int16")],yt.prototype,"advanceHeightMax",2),vt([y("int16")],yt.prototype,"minTopSideBearing",2),vt([y("int16")],yt.prototype,"minBottomSideBearing",2),vt([y("int16")],yt.prototype,"yMaxExtent",2),vt([y("int16")],yt.prototype,"caretSlopeRise",2),vt([y("int16")],yt.prototype,"caretSlopeRun",2),vt([y("int16")],yt.prototype,"caretOffset",2),vt([y({type:"int16",size:4})],yt.prototype,"reserved",2),vt([y("int16")],yt.prototype,"metricDataFormat",2),vt([y("int16")],yt.prototype,"numOfLongVerMetrics",2),yt=vt([ut("vhea")],yt);var hi=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,fi=(o,e,t,r)=>{for(var n=r>1?void 0:r?ci(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&hi(e,t,n),n};let mr=class extends pt{constructor(){super(...arguments);x(this,"_metrics")}static from(e){const t=e.length*4,r=new mr(new ArrayBuffer(t));return e.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var i;const e=this._sfnt.maxp.numGlyphs,t=((i=this._sfnt.vhea)==null?void 0:i.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:e}).map((s,a)=>(a<t&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}};mr=fi([ut("vmtx")],mr);var ui=Object.defineProperty,Me=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&ui(e,t,n),n};class Ot extends ar{constructor(){super(...arguments);x(this,"format","TrueType");x(this,"mimeType","font/ttf");x(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(ne(t).getUint32(0))}static checksum(t){const r=ne(t);let n=r.byteLength;for(;n%4;)n++;let i=0;for(let s=0,a=n/4;s<a;s+=4)s*4<n-4&&(i+=r.getUint32(s*4,!1));return i&4294967295}static from(t){const r=u=>u+3&-4,n=t.tableViews.size,i=Array.from(t.tableViews.values()).reduce((u,p)=>u+r(p.byteLength),0),s=new this(new ArrayBuffer(12+n*16+i));s.scalerType=65536,s.numTables=n;const a=Math.log(2);s.searchRange=Math.floor(Math.log(n)/a)*16,s.entrySelector=Math.floor(s.searchRange/a),s.rangeShift=n*16-s.searchRange;let l=12+n*16,h=0;const c=s.getDirectories();t.tableViews.forEach((u,p)=>{const g=c[h++];g.tag=p,g.checkSum=this.checksum(u),g.offset=l,g.length=u.byteLength,s.view.writeBytes(u,l),l+=r(g.length)});const f=s.createSfnt().head;return f.checkSumAdjustment=0,f.checkSumAdjustment=2981146554-this.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const r=new we(this.view.buffer,t);return t+=r.view.byteLength,r})}createSfnt(){return new se(this.getDirectories().reduce((t,r)=>(t[r.tag]=new DataView(this.view.buffer,this.view.byteOffset+r.offset,r.length),t),{}))}}x(Ot,"signature",new Set([65536,1953658213,1954115633])),Me([y("uint32")],Ot.prototype,"scalerType"),Me([y("uint16")],Ot.prototype,"numTables"),Me([y("uint16")],Ot.prototype,"searchRange"),Me([y("uint16")],Ot.prototype,"entrySelector"),Me([y("uint16")],Ot.prototype,"rangeShift");class je extends Ot{constructor(){super(...arguments);x(this,"format","OpenType");x(this,"mimeType","font/otf")}static from(t){return super.from(t)}}x(je,"signature",new Set([1330926671]));var pi=Object.defineProperty,Te=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&pi(e,t,n),n};class le extends Tt{constructor(e,t){super(e,t,20)}}Te([y({type:"char",size:4})],le.prototype,"tag"),Te([y("uint32")],le.prototype,"offset"),Te([y("uint32")],le.prototype,"compLength"),Te([y("uint32")],le.prototype,"origLength"),Te([y("uint32")],le.prototype,"origChecksum");var di=Object.defineProperty,Mt=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&di(e,t,n),n};const bt=(Ht=class extends ar{constructor(){super(...arguments);x(this,"format","WOFF");x(this,"mimeType","font/woff");x(this,"_sfnt")}get subfontFormat(){return Ot.is(this.flavor)?"TrueType":je.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(ne(t).getUint32(0))}static checkSum(t){const r=ne(t),n=r.byteLength,i=Math.floor(n/4);let s=0,a=0;for(;a<i;)s+=r.getUint32(4*a++,!1);let l=n-i*4;if(l){let h=i*4;for(;l>0;)s+=r.getUint8(h)<<l*8,h++,l--}return s%4294967296}static from(t,r=new ArrayBuffer(0)){const n=u=>u+3&-4,i=[];t.tableViews.forEach((u,p)=>{const g=ne(Kn(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));i.push({tag:p,view:g.byteLength<u.byteLength?g:u,rawView:u})});const s=i.length,a=i.reduce((u,p)=>u+n(p.view.byteLength),0),l=new Ht(new ArrayBuffer(44+20*s+a+r.byteLength));l.signature=2001684038,l.flavor=65536,l.length=l.view.byteLength,l.numTables=s,l.totalSfntSize=12+16*s+i.reduce((u,p)=>u+n(p.rawView.byteLength),0);let h=44+s*20,c=0;const f=l.getDirectories();return i.forEach(u=>{const p=f[c++];p.tag=u.tag,p.offset=h,p.compLength=u.view.byteLength,p.origChecksum=Ht.checkSum(u.rawView),p.origLength=u.rawView.byteLength,l.view.writeBytes(u.view,h),h+=n(p.compLength)}),l.view.writeBytes(r),l}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const r=new le(this.view.buffer,t);return t+=r.view.byteLength,r})}createSfnt(){return new se(this.getDirectories().reduce((t,r)=>{const n=r.tag,i=this.view.byteOffset+r.offset,s=r.compLength,a=r.origLength,l=i+s;return t[n]=s>=a?new DataView(this.view.buffer,i,s):new DataView(Qn(new Uint8Array(this.view.buffer.slice(i,l))).buffer),t},{}))}},x(Ht,"signature",new Set([2001684038])),Ht);Mt([y("uint32")],bt.prototype,"signature"),Mt([y("uint32")],bt.prototype,"flavor"),Mt([y("uint32")],bt.prototype,"length"),Mt([y("uint16")],bt.prototype,"numTables"),Mt([y("uint16")],bt.prototype,"reserved"),Mt([y("uint32")],bt.prototype,"totalSfntSize"),Mt([y("uint16")],bt.prototype,"majorVersion"),Mt([y("uint16")],bt.prototype,"minorVersion"),Mt([y("uint32")],bt.prototype,"metaOffset"),Mt([y("uint32")],bt.prototype,"metaLength"),Mt([y("uint32")],bt.prototype,"metaOrigLength"),Mt([y("uint32")],bt.prototype,"privOffset"),Mt([y("uint32")],bt.prototype,"privLength");let wr=bt;function gi(o,e=!0){if(Ot.is(o))return new Ot(o);if(je.is(o))return new je(o);if(wr.is(o))return new wr(o);if(e)throw new Error("Failed to parseFont")}const Ke=class Ke{constructor(){x(this,"fallbackFont");x(this,"loading",new Map);x(this,"loaded",new Map);x(this,"familyToUrl",new Map)}_createRequest(e,t){const r=new AbortController;return{url:e,when:fetch(e,{...Ke.defaultRequestInit,...t,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(e,t){return document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
2
+ font-family: "${e}";
3
+ src: url(${t});
4
+ }`)),document.head.appendChild(r),this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(r=>this.familyToUrl.get(r.trim())??this.familyToUrl.get(r)??r)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((n,i)=>n||this.loaded.get(i),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(e,t={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:i=!0,...s}=t,{src:a}=e;if(this.loaded.has(a))return r&&(this.loading.forEach(u=>u.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,s),this.loading.set(a,l)),r&&this.loading.forEach((u,p)=>{u!==l&&(u.cancel(),this.loading.delete(p))}),l.when.then(u=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const p=f(u);return t.noAdd||this.loaded.set(e.src,p),p.familySet.forEach(g=>{this.familyToUrl.set(g,a),typeof document<"u"&&(n&&this.injectFontFace(g,u),i&&this.injectStyleTag(g,a))}),p}}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return f();throw u}).finally(()=>{this.loading.delete(a)});function h(){return e.family?Array.isArray(e.family)?e.family:[e.family]:[]}function c(u){return h().forEach(p=>{u.familySet.add(p)}),u}function f(u=new ArrayBuffer(0)){let p;function g(){return p||(p=u.byteLength?gi(u,!1):void 0),p}function m(){const d=g();if(d instanceof Ot||d instanceof wr)return d.sfnt}return{...e,buffer:u,familySet:new Set(h()),getFont:g,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}};x(Ke,"defaultRequestInit",{cache:"force-cache"});let xr=Ke;const yi=new xr,mi={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function vr(o,e){const{fill:t="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:f=0,shadowBlur:u=0,shadowColor:p="rgba(0, 0, 0, 0)"}=e;o.fillStyle=t,o.strokeStyle=r,o.lineWidth=n,o.lineCap=i,o.lineJoin=mi[s],o.miterLimit=a,o.setLineDash(l),o.lineDashOffset=h,o.shadowOffsetX=c,o.shadowOffsetY=f,o.shadowBlur=u,o.shadowColor=p}class b{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}get array(){return[this.x,this.y]}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const r=-e/180*Math.PI,n=this.x-t.x,i=-(this.y-t.y),s=Math.sin(r),a=Math.cos(r);return this.set(t.x+(n*a-i*s),t.y-(n*s+i*a)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,r={x:0,y:0}){const n=e<0?r.x-this.x+r.x:this.x,i=t<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(e),this.y=i*Math.abs(t),this}skew(e,t=0,r={x:0,y:0}){const n=this.x-r.x,i=this.y-r.y;return this.x=r.x+(n+Math.tan(e)*i),this.y=r.y+(i+Math.tan(t)*n),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,r=this.y,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6],this.y=n[1]*t+n[4]*r+n[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new b(this.x,this.y)}}class N{constructor(e=0,t=0,r=0,n=0){this.left=e,this.top=t,this.width=r,this.height=n}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new N;if(e.length===1)return e[0].clone();const t=e[0],r=e.slice(1).reduce((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new N(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new N(this.left,this.top,this.width,this.height)}}class St{constructor(e=1,t=0,r=0,n=0,i=1,s=0,a=0,l=0,h=1){x(this,"elements",[]);this.set(e,t,r,n,i,s,a,l,h)}set(e,t,r,n,i,s,a,l,h){const c=this.elements;return c[0]=e,c[1]=n,c[2]=a,c[3]=t,c[4]=i,c[5]=l,c[6]=r,c[7]=s,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,n=t.elements,i=this.elements,s=r[0],a=r[3],l=r[6],h=r[1],c=r[4],f=r[7],u=r[2],p=r[5],g=r[8],m=n[0],d=n[3],k=n[6],S=n[1],C=n[4],A=n[7],w=n[2],v=n[5],_=n[8];return i[0]=s*m+a*S+l*w,i[3]=s*d+a*C+l*v,i[6]=s*k+a*A+l*_,i[1]=h*m+c*S+f*w,i[4]=h*d+c*C+f*v,i[7]=h*k+c*A+f*_,i[2]=u*m+p*S+g*w,i[5]=u*d+p*C+g*v,i[8]=u*k+p*A+g*_,this}invert(){const e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],s=e[4],a=e[5],l=e[6],h=e[7],c=e[8],f=c*s-a*h,u=a*l-c*i,p=h*i-s*l,g=t*f+r*u+n*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return e[0]=f*m,e[1]=(n*h-c*r)*m,e[2]=(a*r-n*s)*m,e[3]=u*m,e[4]=(c*t-n*l)*m,e[5]=(n*i-a*t)*m,e[6]=p*m,e[7]=(r*l-h*t)*m,e[8]=(s*t-r*i)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply(br.makeScale(e,t)),this}rotate(e){return this.premultiply(br.makeRotation(-e)),this}translate(e,t){return this.premultiply(br.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const br=new St;function on(o,e,t,r){const n=o*t+e*r,i=Math.sqrt(o*o+e*e)*Math.sqrt(t*t+r*r);let s=Math.acos(Math.max(-1,Math.min(1,n/i)));return o*r-e*t<0&&(s=-s),s}function wi(o,e,t,r,n,i,s,a){if(e===0||t===0){o.lineTo(a.x,a.y);return}r=r*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const l=(s.x-a.x)/2,h=(s.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,f=-Math.sin(r)*l+Math.cos(r)*h;let u=e*e,p=t*t;const g=c*c,m=f*f,d=g/u+m/p;if(d>1){const V=Math.sqrt(d);e=V*e,t=V*t,u=e*e,p=t*t}const k=u*m+p*g,S=(u*p-k)/k;let C=Math.sqrt(Math.max(0,S));n===i&&(C=-C);const A=C*e*f/t,w=-C*t*c/e,v=Math.cos(r)*A-Math.sin(r)*w+(s.x+a.x)/2,_=Math.sin(r)*A+Math.cos(r)*w+(s.y+a.y)/2,M=on(1,0,(c-A)/e,(f-w)/t),T=on((c-A)/e,(f-w)/t,(-c-A)/e,(-f-w)/t)%(Math.PI*2);o.ellipse(v,_,e,t,r,M,M+T,i===0)}function he(o,e){return o-(e-o)}function an(o,e){const t=new b,r=new b;for(let n=0,i=o.length;n<i;n++){const s=o[n];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),e.moveTo(t.x,t.y),r.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,e.lineTo(t.x,t.y),r.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,e.lineTo(t.x,t.y),r.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),e.lineTo(t.x,t.y),r.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(e.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),r.x=t.x+s.x2,r.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(e.bezierCurveTo(he(t.x,r.x),he(t.y,r.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),r.x=t.x+s.x2,r.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(he(t.x,r.x),he(t.y,r.y),s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(e.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),r.x=t.x+s.x1,r.y=t.y+s.y1,t.add(s)):(e.quadraticCurveTo(s.x1,s.y1,s.x,s.y),r.x=s.x1,r.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const a=he(t.x,r.x),l=he(t.y,r.y);r.x=a,r.y=l,s.type==="t"?(e.quadraticCurveTo(a,l,t.x+s.x,t.y+s.y),t.add(s)):(e.quadraticCurveTo(a,l,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const a=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}r.copy(t),wi(e,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,t)}else s.type==="z"||s.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",s)}}const tt={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(o,e,t=0){let a=0,l=!0,h="",c="";const f=[];function u(d,k,S){const C=new SyntaxError(`Unexpected character "${d}" at index ${k}.`);throw C.partial=S,C}function p(){h!==""&&(c===""?f.push(Number(h)):f.push(Number(h)*10**Number(c))),h="",c=""}let g;const m=o.length;for(let d=0;d<m;d++){if(g=o[d],Array.isArray(e)&&e.includes(f.length%t)&&tt.FLAGS.test(g)){a=1,h=g,p();continue}if(a===0){if(tt.WHITESPACE.test(g))continue;if(tt.DIGIT.test(g)||tt.SIGN.test(g)){a=1,h=g;continue}if(tt.POINT.test(g)){a=2,h=g;continue}tt.COMMA.test(g)&&(l&&u(g,d,f),l=!0)}if(a===1){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.POINT.test(g)){h+=g,a=2;continue}if(tt.EXP.test(g)){a=3;continue}tt.SIGN.test(g)&&h.length===1&&tt.SIGN.test(h[0])&&u(g,d,f)}if(a===2){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.EXP.test(g)){a=3;continue}tt.POINT.test(g)&&h[h.length-1]==="."&&u(g,d,f)}if(a===3){if(tt.DIGIT.test(g)){c+=g;continue}if(tt.SIGN.test(g)){if(c===""){c+=g;continue}c.length===1&&tt.SIGN.test(c)&&u(g,d,f)}}tt.WHITESPACE.test(g)?(p(),a=0,l=!1):tt.COMMA.test(g)?(p(),a=0,l=!0):tt.SIGN.test(g)?(p(),a=1,h=g):tt.POINT.test(g)?(p(),a=2,h=g):u(g,d,f)}return p(),f}function xi(o){let e,t;const r=[];for(let n=0,i=o.length;n<i;n++){const s=o[n];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;r.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},e={x:s.x,y:s.y};break;case"h":case"H":r.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":r.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":r.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":r.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":r.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":r.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":r.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":r.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":r.push(s.type),e&&(t={x:e.x,y:e.y});break}}return r.join(" ")}const vi=/[a-df-z][^a-df-z]*/gi;function ln(o){const e=[],t=o.match(vi);if(!t)return e;for(let r=0,n=t.length;r<n;r++){const i=t[r],s=i.charAt(0),a=i.slice(1).trim();let l;switch(s){case"m":case"M":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)h===0?e.push({type:s,x:l[h],y:l[h+1]}):e.push({type:s==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Ut(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,x:l[h]});break;case"v":case"V":l=Ut(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,y:l[h]});break;case"l":case"L":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"c":case"C":l=Ut(a);for(let h=0,c=l.length;h<c;h+=6)e.push({type:s,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"a":case"A":l=Ut(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)e.push({type:s,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":e.push({type:s});break;default:console.warn(i)}}return e}class Kt{constructor(){x(this,"arcLengthDivisions",200);x(this,"_cacheArcLengths");x(this,"_needsUpdate",!1)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),r=this.getPoint(1);return(t.x-e.x)*(r.y-t.y)-(t.y-e.y)*(r.x-t.x)<0}getPointAt(e,t=new b){return this.getPoint(this.getUToTMapping(e),t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}forEachControlPoints(e){return this.getControlPoints().forEach(e),this}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===e+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const t=[];let r,n=this.getPoint(0),i=0;t.push(0);for(let s=1;s<=e;s++)r=this.getPoint(s/e),i+=r.distanceTo(n),t.push(i),n=r;return this._cacheArcLengths=t,t}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(e,t){const r=this.getLengths();let n=0;const i=r.length;let s;t?s=t:s=e*r[i-1];let a=0,l=i-1,h;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),h=r[n]-s,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===s)return n/(i-1);const c=r[n],u=r[n+1]-c,p=(s-c)/u;return(n+p)/(i-1)}getTangent(e,t=new b){const n=Math.max(0,e-1e-4),i=Math.min(1,e+1e-4);return t.copy(this.getPoint(i).sub(this.getPoint(n)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new b){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let r=0,n=1,i=(r+n)/2;for(;n-r>t;){i=(r+n)/2;const s=this.getPoint(i);if(s.distanceTo(e)<t)return i;s.x<e.x?r=i:n=i}return i}matrix(e){return this.forEachControlPoints(t=>t.applyMatrix3(e)),this}getMinMax(e=b.MAX,t=b.MIN){return this.getPoints().forEach(r=>{e.min(r),t.max(r)}),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new N(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.getPoints().map((e,t)=>t===0?{type:"M",x:e.x,y:e.y}:{type:"L",x:e.x,y:e.y})}toData(){return xi(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function hn(o,e,t,r,n){const i=(r-e)*.5,s=(n-t)*.5,a=o*o,l=o*a;return(2*t-2*r+i+s)*l+(-3*t+3*r-2*i-s)*a+i*o+t}function bi(o,e){const t=1-o;return t*t*e}function Si(o,e){return 2*(1-o)*o*e}function Ci(o,e){return o*o*e}function cn(o,e,t,r){return bi(o,e)+Si(o,t)+Ci(o,r)}function Pi(o,e){const t=1-o;return t*t*t*e}function Mi(o,e){const t=1-o;return 3*t*t*o*e}function Ti(o,e){return 3*(1-o)*o*o*e}function ki(o,e){return o*o*o*e}function fn(o,e,t,r,n){return Pi(o,e)+Mi(o,t)+Ti(o,r)+ki(o,n)}class Ai extends Kt{constructor(e=new b,t=new b,r=new b,n=new b){super(),this.start=e,this.startControl=t,this.endControl=r,this.end=n}getPoint(e,t=new b){const{start:r,startControl:n,endControl:i,end:s}=this;return t.set(fn(e,r.x,n.x,i.x,s.x),fn(e,r.y,n.y,i.y,s.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(e,t,r){const n=t*t-4*e*r;if(n<0)return[];const i=Math.sqrt(n),s=(-t+i)/(2*e),a=(-t-i)/(2*e);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(e=b.MAX,t=b.MIN){const r=this.start,n=this.startControl,i=this.endControl,s=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(s.x-i.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(s.y-i.y)),h=[0,1,...a,...l];return((f,u)=>{for(const p of f)for(let g=0;g<=u;g++){const m=g/u-.5,d=Math.min(1,Math.max(0,p+m)),k=this.getPoint(d);e.x=Math.min(e.x,k.x),e.y=Math.min(e.y,k.y),t.x=Math.max(t.x,k.x),t.y=Math.max(t.y,k.y)}})(h,10),{min:e,max:t}}toCommands(){const{start:e,startControl:t,endControl:r,end:n}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(e){const{start:t,startControl:r,endControl:n,end:i}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(r.x,r.y,n.x,n.y,i.x,i.y),this}copy(e){return super.copy(e),this.start.copy(e.start),this.startControl.copy(e.startControl),this.endControl.copy(e.endControl),this.end.copy(e.end),this}}const _i=new St,un=new St,pn=new St,Ge=new b;class Oi extends Kt{constructor(e=new b,t=1,r=1,n=0,i=0,s=Math.PI*2,a=!1){super(),this.center=e,this.radiusX=t,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=s,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(e,t=new b){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const i=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(i?n=0:n=r),this.clockwise&&!i&&(n===r?n=-r:n=n-r);const s=this.startAngle+e*n;let a=this.center.x+this.radiusX*Math.cos(s),l=this.center.y+this.radiusY*Math.sin(s);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),f=a-this.center.x,u=l-this.center.y;a=f*h-u*c+this.center.x,l=f*c+u*h+this.center.y}return t.set(a,l)}toCommands(){const{center:e,radiusX:t,radiusY:r,startAngle:n,endAngle:i,clockwise:s,rotation:a}=this,{x:l,y:h}=e,c=l+t*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),f=h+t*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),u=Math.abs(n-i),p=u>Math.PI?1:0,g=s?1:0,m=a*180/Math.PI;if(u>=2*Math.PI){const d=n+Math.PI,k=l+t*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),S=h+t*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:c,y:f},{type:"A",rx:t,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:k,y:S},{type:"A",rx:t,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:c,y:f}]}else{const d=l+t*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),k=h+t*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*Math.cos(a);return[{type:"M",x:c,y:f},{type:"A",rx:t,ry:r,angle:m,largeArcFlag:p,sweepFlag:g,x:d,y:k}]}}drawTo(e){const{center:t,radiusX:r,radiusY:n,rotation:i,startAngle:s,endAngle:a,clockwise:l}=this;return e.ellipse(t.x,t.y,r,n,i,s,a,!l),this}matrix(e){return Ge.set(this.center.x,this.center.y),Ge.applyMatrix3(e),this.center.x=Ge.x,this.center.y=Ge.y,Ei(e)?Ii(this,e):Bi(this,e),this}getControlPoints(){return[this.center]}getMinMax(e=b.MAX,t=b.MIN){const{center:r,radiusX:n,radiusY:i,rotation:s}=this,{x:a,y:l}=r,h=Math.cos(s),c=Math.sin(s),f=Math.sqrt(n*n*h*h+i*i*c*c),u=Math.sqrt(n*n*c*c+i*i*h*h);return e.x=Math.min(e.x,a-f),e.y=Math.min(e.y,l-u),t.x=Math.max(t.x,a+f),t.y=Math.max(t.y,l+u),{min:e,max:t}}copy(e){return super.copy(e),this.center.x=e.center.x,this.center.y=e.center.y,this.radiusX=e.radiusX,this.radiusY=e.radiusY,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this}}function Ii(o,e){const t=o.radiusX,r=o.radiusY,n=Math.cos(o.rotation),i=Math.sin(o.rotation),s=new b(t*n,t*i),a=new b(-r*i,r*n),l=s.applyMatrix3(e),h=a.applyMatrix3(e),c=_i.set(l.x,h.x,0,l.y,h.y,0,0,0,1),f=un.copy(c).invert(),g=pn.copy(f).transpose().multiply(f).elements,m=Ui(g[0],g[1],g[4]),d=Math.sqrt(m.rt1),k=Math.sqrt(m.rt2);if(o.radiusX=1/d,o.radiusY=1/k,o.rotation=Math.atan2(m.sn,m.cs),!((o.endAngle-o.startAngle)%(2*Math.PI)<Number.EPSILON)){const C=un.set(d,0,0,0,k,0,0,0,1),A=pn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=C.multiply(A).multiply(c),v=_=>{const{x:M,y:T}=new b(Math.cos(_),Math.sin(_)).applyMatrix3(w);return Math.atan2(T,M)};o.startAngle=v(o.startAngle),o.endAngle=v(o.endAngle),dn(e)&&(o.clockwise=!o.clockwise)}}function Bi(o,e){const t=gn(e),r=yn(e);o.radiusX*=t,o.radiusY*=r;const n=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);o.rotation+=n,dn(e)&&(o.startAngle*=-1,o.endAngle*=-1,o.clockwise=!o.clockwise)}function dn(o){const e=o.elements;return e[0]*e[4]-e[1]*e[3]<0}function Ei(o){const e=o.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const r=gn(o),n=yn(o);return Math.abs(t/(r*n))>Number.EPSILON}function gn(o){const e=o.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function yn(o){const e=o.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function Ui(o,e,t){let r,n,i,s,a;const l=o+t,h=o-t,c=Math.sqrt(h*h+4*e*e);return l>0?(r=.5*(l+c),a=1/r,n=o*a*t-e*a*e):l<0?n=.5*(l-c):(r=.5*c,n=-.5*c),h>0?i=h+c:i=h-c,Math.abs(i)>2*Math.abs(e)?(a=-2*e/i,s=1/Math.sqrt(1+a*a),i=a*s):Math.abs(e)===0?(i=1,s=0):(a=-.5*i/e,i=1/Math.sqrt(1+a*a),s=a*i),h>0&&(a=i,i=-s,s=a),{rt1:r,rt2:n,cs:i,sn:s}}class Sr extends Kt{constructor(e=new b,t=new b){super(),this.start=e,this.end=t}getPoint(e,t=new b){return e===1?t.copy(this.end):t.copy(this.end).sub(this.start).scale(e).add(this.start),t}getPointAt(e,t=new b){return this.getPoint(e,t)}getTangent(e,t=new b){return t.subVectors(this.end,this.start).normalize()}getTangentAt(e,t=new b){return this.getTangent(e,t)}getControlPoints(){return[this.start,this.end]}getMinMax(e=b.MAX,t=b.MIN){const{start:r,end:n}=this;return e.x=Math.min(e.x,r.x,n.x),e.y=Math.min(e.y,r.y,n.y),t.x=Math.max(t.x,r.x,n.x),t.y=Math.max(t.y,r.y,n.y),{min:e,max:t}}toCommands(){const{start:e,end:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}drawTo(e){const{start:t,end:r}=this;return e.lineTo(t.x,t.y),e.lineTo(r.x,r.y),this}copy(e){return super.copy(e),this.start.copy(e.start),this.end.copy(e.end),this}}class Di extends Kt{constructor(e=new b,t=new b,r=new b){super(),this.start=e,this.control=t,this.end=r}getPoint(e,t=new b){const{start:r,control:n,end:i}=this;return t.set(cn(e,r.x,n.x,i.x),cn(e,r.y,n.y,i.y)),t}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(e=b.MAX,t=b.MIN){const{start:r,control:n,end:i}=this,s=.5*(r.x+n.x),a=.5*(r.y+n.y),l=.5*(r.x+i.x),h=.5*(r.y+i.y);return e.x=Math.min(e.x,r.x,i.x,s,l),e.y=Math.min(e.y,r.y,i.y,a,h),t.x=Math.max(t.x,r.x,i.x,s,l),t.y=Math.max(t.y,r.y,i.y,a,h),{min:e,max:t}}toCommands(){const{start:e,control:t,end:r}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:r.x,y:r.y}]}drawTo(e){const{start:t,control:r,end:n}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(r.x,r.y,n.x,n.y),this}copy(e){return super.copy(e),this.start.copy(e.start),this.control.copy(e.control),this.end.copy(e.end),this}}class Li extends Kt{constructor(t,r,n=1,i=0,s=1){super();x(this,"curves",[]);x(this,"curveT",0);this.center=t,this.rx=r,this.aspectRatio=n,this.start=i,this.end=s,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:r}=this.center,n=this.rx,i=this.rx/this.aspectRatio,s=[new b(t-n,r-i),new b(t+n,r-i),new b(t+n,r+i),new b(t-n,r+i)];for(let a=0;a<4;a++)this.curves.push(new Sr(s[a].clone(),s[(a+1)%4].clone()));return this}getCurve(t){let r=(t*(this.end-this.start)+this.start)%1;r<0&&(r+=1),r*=(1+this.aspectRatio)*2;let n;return r<this.aspectRatio?(n=0,this.curveT=r/this.aspectRatio):r<this.aspectRatio+1?(n=1,this.curveT=(r-this.aspectRatio)/1):r<2*this.aspectRatio+1?(n=2,this.curveT=(r-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=(r-2*this.aspectRatio-1)/1),this.curves[n]}getPoint(t,r){return this.getCurve(t).getPoint(this.curveT,r)}getPointAt(t,r){return this.getPoint(t,r)}getTangent(t,r){return this.getCurve(t).getTangent(this.curveT,r)}getNormal(t,r){return this.getCurve(t).getNormal(this.curveT,r)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,r=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,r)),{min:t,max:r}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(r=>r.drawTo(t)),this}}class $i extends Kt{constructor(e=[]){super(),this.points=e}getPoint(e,t=new b){const{points:r}=this,n=(r.length-1)*e,i=Math.floor(n),s=n-i,a=r[i===0?i:i-1],l=r[i],h=r[i>r.length-2?r.length-1:i+1],c=r[i>r.length-3?r.length-1:i+2];return t.set(hn(s,a.x,l.x,h.x,c.x),hn(s,a.y,l.y,h.y,c.y)),t}getControlPoints(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++)this.points.push(e.points[t].clone());return this}}class ke extends Kt{constructor(t){super();x(this,"curves",[]);x(this,"startPoint");x(this,"currentPoint");x(this,"autoClose",!1);x(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 r=1,n=t.length;r<n;r++){const{x:i,y:s}=t[r];this.lineTo(i,s)}return this}addCommands(t){return an(t,this),this}addData(t){return this.addCommands(ln(t)),this}getPoint(t,r=new b){const n=t*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,l=this.curves[s],h=l.getLength();return l.getPointAt(h===0?0:1-a/h,r)}s++}return r}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 r=0;for(let n=0,i=this.curves.length;n<i;n++)r+=this.curves[n].getLength(),t.push(r);return this._cacheLengths=t,t}getSpacedPoints(t=40){const r=[];for(let n=0;n<=t;n++)r.push(this.getPoint(n/t));return this.autoClose&&r.push(r[0]),r}getPoints(t=12){const r=[],n=this.curves;let i;for(let s=0,a=n.length;s<a;s++){const h=n[s].getPoints(t);for(let c=0;c<h.length;c++){const f=h[c];i!=null&&i.equals(f)||(r.push(f),i=f)}}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r}_setCurrentPoint(t){return this.currentPoint=new b(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const r=this.currentPoint;r&&!t.equals(r)&&(this.curves.push(new Sr(r.clone(),t)),r.copy(t)),this.startPoint=void 0}return this}moveTo(t,r){return this.currentPoint=new b(t,r),this.startPoint=this.currentPoint.clone(),this}lineTo(t,r){const n=this.currentPoint;return n!=null&&n.equals({x:t,y:r})||this.curves.push(new Sr((n==null?void 0:n.clone())??new b,new b(t,r))),this._setCurrentPoint({x:t,y:r}),this}bezierCurveTo(t,r,n,i,s,a){const l=this.currentPoint;return l!=null&&l.equals({x:s,y:a})||this.curves.push(new Ai((l==null?void 0:l.clone())??new b,new b(t,r),new b(n,i),new b(s,a))),this._setCurrentPoint({x:s,y:a}),this}quadraticCurveTo(t,r,n,i){const s=this.currentPoint;return s!=null&&s.equals({x:n,y:i})||this.curves.push(new Di((s==null?void 0:s.clone())??new b,new b(t,r),new b(n,i))),this._setCurrentPoint({x:n,y:i}),this}arc(t,r,n,i,s,a){return this.ellipse(t,r,n,n,0,i,s,a),this}relativeArc(t,r,n,i,s,a){const l=this.currentPoint??new b;return this.arc(t+l.x,r+l.y,n,i,s,a),this}arcTo(t,r,n,i,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,r,n,i,s,a,l,h=!0){const c=new Oi(new b(t,r),n,i,s,a,l,!h);if(this.curves.length>0){const f=c.getPoint(0);(!this.currentPoint||!f.equals(this.currentPoint))&&this.lineTo(f.x,f.y)}return this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,r,n,i,s,a,l,h){const c=this.currentPoint??new b;return this.ellipse(t+c.x,r+c.y,n,i,s,a,l,h),this}rect(t,r,n,i){return this.curves.push(new Li(new b(t+n/2,r+i/2),n/2,n/i)),this._setCurrentPoint({x:t,y:r}),this}splineThru(t){const r=this.currentPoint??new b;return this.curves.push(new $i([r].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=b.MAX,r=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,r)),{min:t,max:r}}getBoundingBox(){const{min:t,max:r}=this.getMinMax();return new N(t.x,t.y,r.x-t.x,r.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var n;const r=(n=this.curves[0])==null?void 0:n.getPoint(0);return r&&t.moveTo(r.x,r.y),this.curves.forEach(i=>i.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var r;super.copy(t),this.curves=[];for(let n=0,i=t.curves.length;n<i;n++)this.curves.push(t.curves[n].clone());return this.autoClose=t.autoClose,this.currentPoint=(r=t.currentPoint)==null?void 0:r.clone(),this}}function zi(o){return o.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Fi(o,e,t,r){const n=e.clone().sub(o),i=r.clone().sub(t),s=t.clone().sub(o),a=n.cross(i);if(a===0)return new b((o.x+t.x)/2,(o.y+t.y)/2);const l=s.cross(i)/a;return Math.abs(l)>1?new b((o.x+t.x)/2,(o.y+t.y)/2):new b(o.x+l*n.x,o.y+l*n.y)}class Ct{constructor(e,t={}){x(this,"currentPath",new ke);x(this,"paths",[this.currentPath]);x(this,"style");e&&(e instanceof Ct?this.addPath(e):Array.isArray(e)?this.addCommands(e):this.addData(e)),this.style=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(e){return e instanceof Ct?this.paths.push(...e.paths.map(t=>t.clone())):this.paths.push(e),this}closePath(){const e=this.startPoint;return e&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new ke().moveTo(e.x,e.y),this.paths.push(this.currentPath))),this}moveTo(e,t){const{currentPoint:r,curves:n}=this.currentPath;return r!=null&&r.equals({x:e,y:t})||(n.length?(this.currentPath=new ke().moveTo(e,t),this.paths.push(this.currentPath)):this.currentPath.moveTo(e,t)),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}bezierCurveTo(e,t,r,n,i,s){return this.currentPath.bezierCurveTo(e,t,r,n,i,s),this}quadraticCurveTo(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this}arc(e,t,r,n,i,s){return this.currentPath.arc(e,t,r,n,i,s),this}arcTo(e,t,r,n,i){return this.currentPath.arcTo(e,t,r,n,i),this}ellipse(e,t,r,n,i,s,a,l){return this.currentPath.ellipse(e,t,r,n,i,s,a,l),this}rect(e,t,r,n){return this.currentPath.rect(e,t,r,n),this}addCommands(e){return an(e,this),this}addData(e){return this.addCommands(ln(e)),this}splineThru(e){return this.currentPath.splineThru(e),this}getControlPoints(){return this.paths.flatMap(e=>e.getControlPoints())}getCurves(){return this.paths.flatMap(e=>e.curves)}scale(e,t=e,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(e,t,r)}),this}skew(e,t=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(e,t,r)}),this}rotate(e,t={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(e,t)}),this}bold(e){if(e===0)return this;const t=this.getCurves(),r=[],n=[],i=[];t.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();i[l]=h,n[l]=c;const f=h[0],u=h[h.length-1]??f;r.push({start:c?u:f,end:c?f:u,index:l})});const s=[];return r.forEach((a,l)=>{s[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&s[l].push(h.index)})}),t.forEach((a,l)=>{const h=n[l];i[l].forEach(f=>{const u=a.getTForPoint(f),p=a.getNormal(u).scale(h?e:-e);f.add(p)})}),s.forEach((a,l)=>{const h=i[l];a.forEach(c=>{const f=i[c],u=Fi(h[h.length-1],h[h.length-2]??h[h.length-1],f[0],f[1]??f[0]);u&&(h[h.length-1].copy(u),f[0].copy(u))})}),this}matrix(e){return this.getCurves().forEach(t=>t.matrix(e)),this}getMinMax(e=b.MAX,t=b.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(i=>{if(i.getMinMax(e,t),r&&n>1){const s=n/2,a=i.isClockwise(),l=[];for(let h=0;h<=1;h+=1/i.arcLengthDivisions){const c=i.getPoint(h),f=i.getNormal(h),u=f.clone().scale(a?s:-s),p=f.clone().scale(a?-s:s);l.push(c.clone().add(u),c.clone().add(p),c.clone().add({x:s,y:0}),c.clone().add({x:-s,y:0}),c.clone().add({x:0,y:s}),c.clone().add({x:0,y:-s}),c.clone().add({x:s,y:s}),c.clone().add({x:-s,y:-s}))}e.min(...l),t.max(...l)}}),{min:e,max:t}}getBoundingBox(e=!0){const{min:t,max:r}=this.getMinMax(void 0,void 0,e);return new N(t.x,t.y,r.x-t.x,r.y-t.y)}drawTo(e,t={}){t={...this.style,...t};const{fill:r="#000",stroke:n="none"}=t;return e.beginPath(),e.save(),vr(e,t),this.paths.forEach(i=>{i.drawTo(e)}),r!=="none"&&e.fill(),n!=="none"&&e.stroke(),e.restore(),this}drawControlPointsTo(e,t={}){t={...this.style,...t};const{fill:r="#000",stroke:n="none"}=t;return e.beginPath(),e.save(),vr(e,t),this.getControlPoints().forEach(i=>{e.moveTo(i.x,i.y),e.arc(i.x,i.y,4,0,Math.PI*2)}),r!=="none"&&e.fill(),n!=="none"&&e.stroke(),e.restore(),this}toCommands(){return this.paths.flatMap(e=>e.toCommands())}toData(){return this.paths.map(e=>e.toData()).join(" ")}toSVGPathString(){const e={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},t={};for(const n in e)e[n]!==void 0&&(t[zi(n)]=e[n]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in t)t[n]!==void 0&&(r+=`${n}:${t[n]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSVGString(){const{x:e,y:t,width:r,height:n}=this.getBoundingBox(),i=this.toSVGPathString();return`<svg viewBox="${e} ${t} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...r}=e,{left:n,top:i,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*t,l.height=a*t,l.style.width=`${s}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(t,t),h.translate(-n,-i),this.drawTo(h,r)),l}copy(e){return this.currentPath=e.currentPath.clone(),this.paths=e.paths.map(t=>t.clone()),this.style={...e.style},this}clone(){return new this.constructor().copy(this)}}const Ni="px",qi=90,mn=["mm","cm","in","pt","pc","px"],wn={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 R(o){let e="px";if(typeof o=="string"||o instanceof String)for(let r=0,n=mn.length;r<n;r++){const i=mn[r];if(o.endsWith(i)){e=i,o=o.substring(0,o.length-i.length);break}}let t;return t=wn[e][Ni],t<0&&(t=wn[e].in*qi),t*Number.parseFloat(o)}const ji=new St,Re=new St,xn=new St,vn=new St;function Gi(o,e,t){if(!(o.hasAttribute("transform")||o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))))return null;const r=Ri(o);return t.length>0&&r.premultiply(t[t.length-1]),e.copy(r),t.push(r),r}function Ri(o){const e=new St,t=ji;if(o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))&&e.translate(R(o.getAttribute("x")),R(o.getAttribute("y"))),o.hasAttribute("transform")){const r=o.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const s=i.indexOf("("),a=i.length;if(s>0&&s<a){const l=i.slice(0,s),h=Ut(i.slice(s+1));switch(t.identity(),l){case"translate":if(h.length>=1){const c=h[0];let f=0;h.length>=2&&(f=h[1]),t.translate(c,f)}break;case"rotate":if(h.length>=1){let c=0,f=0,u=0;c=h[0]*Math.PI/180,h.length>=3&&(f=h[1],u=h[2]),Re.makeTranslation(-f,-u),xn.makeRotation(c),vn.multiplyMatrices(xn,Re),Re.makeTranslation(f,u),t.multiplyMatrices(Re,vn)}break;case"scale":h.length>=1&&t.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&t.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&t.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&t.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}e.premultiply(t)}}return e}function Vi(o){return new Ct().addPath(new ke().arc(R(o.getAttribute("cx")||0),R(o.getAttribute("cy")||0),R(o.getAttribute("r")||0),0,Math.PI*2))}function Wi(o,e){if(!(!o.sheet||!o.sheet.cssRules||!o.sheet.cssRules.length))for(let t=0;t<o.sheet.cssRules.length;t++){const r=o.sheet.cssRules[t];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),i={};for(let s=r.style.length,a=0;a<s;a++){const l=r.style.item(a);i[l]=r.style.getPropertyValue(l)}for(let s=0;s<n.length;s++)e[n[s]]=Object.assign(e[n[s]]||{},{...i})}}function Xi(o){return new Ct().addPath(new ke().ellipse(R(o.getAttribute("cx")||0),R(o.getAttribute("cy")||0),R(o.getAttribute("rx")||0),R(o.getAttribute("ry")||0),0,0,Math.PI*2))}function Hi(o){return new Ct().moveTo(R(o.getAttribute("x1")||0),R(o.getAttribute("y1")||0)).lineTo(R(o.getAttribute("x2")||0),R(o.getAttribute("y2")||0))}function Yi(o){const e=new Ct,t=o.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const Zi=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ki(o){var r;const e=new Ct;let t=0;return(r=o.getAttribute("points"))==null||r.replace(Zi,(n,i,s)=>{const a=R(i),l=R(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,n}),e.currentPath.autoClose=!0,e}const Qi=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ji(o){var r;const e=new Ct;let t=0;return(r=o.getAttribute("points"))==null||r.replace(Qi,(n,i,s)=>{const a=R(i),l=R(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,n}),e.currentPath.autoClose=!1,e}function to(o){const e=R(o.getAttribute("x")||0),t=R(o.getAttribute("y")||0),r=R(o.getAttribute("rx")||o.getAttribute("ry")||0),n=R(o.getAttribute("ry")||o.getAttribute("rx")||0),i=R(o.getAttribute("width")),s=R(o.getAttribute("height")),a=1-.551915024494,l=new Ct;return l.moveTo(e+r,t),l.lineTo(e+i-r,t),(r!==0||n!==0)&&l.bezierCurveTo(e+i-r*a,t,e+i,t+n*a,e+i,t+n),l.lineTo(e+i,t+s-n),(r!==0||n!==0)&&l.bezierCurveTo(e+i,t+s-n*a,e+i-r*a,t+s,e+i-r,t+s),l.lineTo(e+r,t+s),(r!==0||n!==0)&&l.bezierCurveTo(e+r*a,t+s,e,t+s-n*a,e,t+s-n),l.lineTo(e,t+n),(r!==0||n!==0)&&l.bezierCurveTo(e,t+n*a,e+r*a,t,e+r,t),l}function Dt(o,e,t){e=Object.assign({},e);let r={};if(o.hasAttribute("class")){const h=o.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)r=Object.assign(r,t[`.${h[c]}`])}o.hasAttribute("id")&&(r=Object.assign(r,t[`#${o.getAttribute("id")}`]));for(let h=o.style.length,c=0;c<h;c++){const f=o.style.item(c),u=o.style.getPropertyValue(f);e[f]=u,r[f]=u}function n(h,c,f=i){o.hasAttribute(h)&&(e[c]=f(o.getAttribute(h))),r[h]&&(e[c]=f(r[h]))}function i(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function s(h){return Math.max(0,Math.min(1,R(h)))}function a(h){return Math.max(0,R(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>R(c))}return n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",l),n("stroke-dashoffset","strokeDashoffset",R),n("visibility","visibility"),e}function Cr(o,e,t=[],r={}){var f;if(o.nodeType!==1)return t;let n=!1,i=null,s={...e};switch(o.nodeName){case"svg":s=Dt(o,s,r);break;case"style":Wi(o,r);break;case"g":s=Dt(o,s,r);break;case"path":s=Dt(o,s,r),o.hasAttribute("d")&&(i=Yi(o));break;case"rect":s=Dt(o,s,r),i=to(o);break;case"polygon":s=Dt(o,s,r),i=Ki(o);break;case"polyline":s=Dt(o,s,r),i=Ji(o);break;case"circle":s=Dt(o,s,r),i=Vi(o);break;case"ellipse":s=Dt(o,s,r),i=Xi(o);break;case"line":s=Dt(o,s,r),i=Hi(o);break;case"defs":n=!0;break;case"use":{s=Dt(o,s,r);const p=(o.getAttributeNS("http://www.w3.org/1999/xlink","href")||o.getAttribute("href")||"").substring(1),g=(f=o.viewportElement)==null?void 0:f.getElementById(p);g?Cr(g,s,t,r):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(o);break}if(s.display==="none")return t;Object.assign(e,s);const a=new St,l=[],h=Gi(o,a,l);i&&(i.matrix(a),t.push(i),i.style=e);const c=o.childNodes;for(let u=0,p=c.length;u<p;u++){const g=c[u];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Cr(g,e,t,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),t}const bn="data:image/svg+xml;",Sn=`${bn}base64,`,Cn=`${bn}charset=utf8,`;function Pn(o){if(typeof o=="string"){let e;o.startsWith(Sn)?(o=o.substring(Sn.length,o.length),e=atob(o)):o.startsWith(Cn)?(o=o.substring(Cn.length,o.length),e=decodeURIComponent(o)):e=o;const t=new DOMParser().parseFromString(e,"text/xml"),r=t.querySelector("parsererror");if(r)throw new Error(`${r.textContent??"parser error"}
5
+ ${e}`);return t.documentElement}else return o}function Mn(o){return Cr(Pn(o),{})}function Ae(o,e=!0){if(!o.length)return;const t=b.MAX,r=b.MIN;return o.forEach(n=>n.getMinMax(t,r,e)),new N(t.x,t.y,r.x-t.x,r.y-t.y)}const eo=new Set(["©","®","÷"]),ro=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),no={1:"italic",32:"bold"},so={1:"italic",2:"bold"},Tn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class kn{constructor(e,t,r){x(this,"path",new Ct);x(this,"lineBox",new N);x(this,"inlineBox",new N);x(this,"glyphBox");x(this,"advanceWidth",0);x(this,"advanceHeight",0);x(this,"underlinePosition",0);x(this,"underlineThickness",0);x(this,"strikeoutPosition",0);x(this,"strikeoutSize",0);x(this,"ascender",0);x(this,"descender",0);x(this,"typoAscender",0);x(this,"typoDescender",0);x(this,"typoLineGap",0);x(this,"winAscent",0);x(this,"winDescent",0);x(this,"xHeight",0);x(this,"capHeight",0);x(this,"baseline",0);x(this,"centerDiviation",0);x(this,"fontStyle");this.content=e,this.index=t,this.parent=r}get center(){var e;return(e=this.glyphBox)==null?void 0:e.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(e){const t=this.computedStyle.fontFamily,r=e??yi,n=t?r.get(t):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(e=this._getFontSfnt()){if(!e)return this;const{hhea:t,os2:r,post:n,head:i}=e,s=i.unitsPerEm,a=t.ascent,l=t.descent,{content:h,computedStyle:c,isVertical:f}=this,{fontSize:u}=c,p=s/u,g=e.getAdvanceWidth(h,u),m=(a+Math.abs(l))/p,d=a/p;return this.advanceWidth=g,this.advanceHeight=m,this.inlineBox.width=f?m:g,this.inlineBox.height=f?g:m,this.underlinePosition=(a-n.underlinePosition)/p,this.underlineThickness=n.underlineThickness/p,this.strikeoutPosition=(a-r.yStrikeoutPosition)/p,this.strikeoutSize=r.yStrikeoutSize/p,this.ascender=a/p,this.descender=l/p,this.typoAscender=r.sTypoAscender/p,this.typoDescender=r.sTypoDescender/p,this.typoLineGap=r.sTypoLineGap/p,this.winAscent=r.usWinAscent/p,this.winDescent=r.usWinDescent/p,this.xHeight=r.sxHeight/p,this.capHeight=r.sCapHeight/p,this.baseline=d,this.centerDiviation=m/2-d,this.fontStyle=no[r.fsSelection]??so[i.macStyle],this}update(e){const t=this._getFontSfnt(e);if(!t)return this;this.updateGlyph(t);const{isVertical:r,content:n,computedStyle:i,baseline:s,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:f,advanceWidth:u,advanceHeight:p}=this,{left:g,top:m}=a,d=i.fontStyle==="italic"&&f!=="italic";let k=g,S=m+s,C;const A=new Ct;if(r&&(k+=(p-u)/2,Math.abs(u-p)>.1&&(S-=(l-c)/(l+Math.abs(h))*p),C=void 0),r&&!eo.has(n)&&(n.codePointAt(0)<=256||ro.has(n))){A.addCommands(t.getPathCommands(n,k,m+s-(p-u)/2,i.fontSize));const v={y:m-(p-u)/2+p/2,x:k+u/2};d&&this._italic(A,r?{x:v.x,y:m-(p-u)/2+s}:void 0),A.rotate(90,v)}else C!==void 0?(A.addCommands(t.glyphs.get(C).getPathCommands(k,S,i.fontSize)),d&&this._italic(A,r?{x:k+u/2,y:m+c/(l+Math.abs(h))*p}:void 0)):(A.addCommands(t.getPathCommands(n,k,S,i.fontSize)),d&&this._italic(A,r?{x:k+p/2,y:S}:void 0));const w=i.fontWeight??400;return w in Tn&&(w===700||w==="bold")&&f!=="bold"&&A.bold(Tn[w]*i.fontSize*.05),A.style={fill:i.color,stroke:i.textStrokeWidth?i.textStrokeColor:"none",strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:0},this.path=A,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(e,t,r)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:r,max:n}=t;return new N(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(e,t={}){const r=this.computedStyle,n={ctx:e,path:this.path,fontSize:r.fontSize,color:r.color,...t};if(this.glyphBox)re(n);else{e.save(),e.beginPath();const i=this.path.style,s={...i,fill:n.color??i.fill,stroke:n.textStrokeColor??i.stroke,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize:i.strokeWidth,shadowOffsetX:(n.shadowOffsetX??0)*n.fontSize,shadowOffsetY:(n.shadowOffsetY??0)*n.fontSize,shadowBlur:(n.shadowBlur??0)*n.fontSize,shadowColor:n.shadowColor};vr(e,s),e.font=`${n.fontSize}px ${n.fontFamily}`,this.isVertical?(e.textBaseline="middle",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(e.textBaseline="alphabetic",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),e.restore()}}}function Ve(o,e){return typeof o=="number"?o:o.endsWith("%")?(o=o.substring(0,o.length-1),Math.ceil(Number(o)/100*e.total)):o.endsWith("rem")?(o=o.substring(0,o.length-3),Number(o)*e.fontSize):o.endsWith("em")?(o=o.substring(0,o.length-2),Number(o)*e.fontSize):Number(o)}function Pr(o){const e=Nt(o)?{}:o;return Object.keys(e).reduce((t,r)=>{let n=e[r];const i=Mr(r),s=Mr(n);return i&&(r=i),s&&(n=s),t[r]=n,t},{})}function Nt(o){return!o||o==="none"}function An(o,e){const t=Object.keys(o),r=Object.keys(e);return Array.from(new Set([...t,...r])).every(i=>Qt(o[i],e[i]))}function Qt(o,e){const t=typeof o;return t===typeof e?t==="object"?An(o,e):o===e:!1}function Mr(o){const e=o.startsWith("#")?o.slice(1):o;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(e))return null;const r=e.length===3?e.split("").map(a=>a+a).join(""):e,n=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),s=Number.parseInt(r.slice(4,6),16);return`rgb(${n}, ${i}, ${s})`}function We(o){if(!o)return o;const e={};for(const t in o)o[t]!==""&&o[t]!==void 0&&(e[t]=o[t]);return e}function Xe(o){return o.startsWith("http://")||o.startsWith("https://")||o.startsWith("blob://")}class _n{constructor(e,t={},r){x(this,"inlineBox",new N);this.content=e,this.style=t,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const e=this.computedStyle;return e.textTransform==="uppercase"?this.content.toUpperCase():e.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...We(this.style)},this}initCharacters(){const e=[];let t=0;for(const r of this.computedContent)e.push(new kn(r,t++,this));return this.characters=e,this}}class ce{constructor(e,t){x(this,"lineBox",new N);x(this,"fragments",[]);this.style=e,this.parentStyle=t,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...We(this.parentStyle),...We(this.style)},this}addFragment(e,t){const r=new _n(e,t,this);return this.fragments.push(r),r}}function io(o){return o}const ue=class ue{_styleToDomStyle(e){const t={};for(const r in e){const n=e[r];ue.notZeroStyles.has(r)&&n===0||(typeof n=="number"&&ue.pxStyles.has(r)?t[r]=`${n}px`:t[r]=n)}return t}createParagraphDom(e,t){const r=document.createDocumentFragment(),n=document.createElement("section"),i={...t},s=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":i.justifyContent="start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="end";break}switch(t.verticalAlign){case"top":i.alignItems="top";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="end";break}const a=!!(i.justifyContent||i.alignItems);Object.assign(n.style,{boxSizing:"border-box",display:a?"inline-flex":void 0,width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(i),position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&s?"100%":void 0,height:a&&!s?"100%":void 0}),e.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(f=>{const u=document.createElement("span");Object.assign(u.style,{verticalAlign:"inherit",...this._styleToDomStyle(f.style)}),u.appendChild(document.createTextNode(f.content)),c.appendChild(u)}),l.appendChild(c)}),n.appendChild(l),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var h;return(h=n.parentNode)==null?void 0:h.removeChild(n)}}}measureDomText(e){const t=document.createRange();t.selectNodeContents(e);const r=e.data??"";let n=0;return Array.from(r).map(i=>{var f;const s=n+=r.substring(n).indexOf(i),a=s+i.length;n+=i.length,t.setStart(e,Math.max(s,0)),t.setEnd(e,a);const l=((f=t.getClientRects)==null?void 0:f.call(t))??[t.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=t.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(e){const t=[],r=[],n=[];return e.querySelectorAll("li").forEach((i,s)=>{const a=i.getBoundingClientRect();t.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();r.push({paragraphIndex:s,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let f=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(u=>{n.push({...u,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(u=>{u.firstChild instanceof window.Text&&this.measureDomText(u.firstChild).forEach(p=>{n.push({...p,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:t,fragments:r,characters:n}}measureParagraphDom(e,t){const r=t.getBoundingClientRect(),n=this.measureDom(t);n.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),n.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const i=[];let s=0;return n.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;i.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const f=e[l].fragments[h].characters[c],{fontHeight:u,isVertical:p}=f,g=i[s];f.inlineBox.left=g.left,f.inlineBox.top=g.top,f.inlineBox.width=g.width,f.inlineBox.height=g.height,p?(f.lineBox.left=g.left+(g.width-u)/2,f.lineBox.top=g.top,f.lineBox.width=u,f.lineBox.height=g.height):(f.lineBox.left=g.left,f.lineBox.top=g.top+(g.height-u)/2,f.lineBox.width=g.width,f.lineBox.height=u),s++}),{paragraphs:e,boundingBox:new N(0,0,r.width,r.height)}}measure(e,t,r){let n;r||({dom:r,destory:n}=this.createParagraphDom(e,t));const i=this.measureParagraphDom(e,r);return n==null||n(),i}};x(ue,"notZeroStyles",new Set(["width","height"])),x(ue,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let He=ue;function oo(){return{overflow:"visible",visibility:"visible",filter:"none",left:0,top:0,width:0,height:0,rotate:0,opacity:1,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",backgroundImage:"none",backgroundColor:"transparent",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,borderRadius:0,borderColor:"transparent",borderWidth:1}}function ao(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing: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:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%",scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0}}function lo(){return{...oo(),...ao()}}class ho{constructor(){x(this,"eventListeners",new Map)}addEventListener(e,t,r){const n={value:t,options:r},i=this.eventListeners.get(e);return i?Array.isArray(i)?i.push(n):this.eventListeners.set(e,[i,n]):this.eventListeners.set(e,n),this}removeEventListener(e,t,r){var i,s;if(!t)return this.eventListeners.delete(e),this;const n=this.eventListeners.get(e);if(!n)return this;if(Array.isArray(n)){const a=[];for(let l=0,h=n.length;l<h;l++){const c=n[l];(c.value!==t||typeof r=="object"&&(r!=null&&r.once)&&(typeof c.options=="boolean"||!((i=c.options)!=null&&i.once)))&&a.push(c)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else n.value===t&&(typeof r=="boolean"||!(r!=null&&r.once)||typeof n.options=="boolean"||(s=n.options)!=null&&s.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,t){var n,i;const r=this.eventListeners.get(e);if(r){if(Array.isArray(r))for(let s=r.length,a=0;a<s;a++){const l=r[a];typeof l.options=="object"&&((n=l.options)!=null&&n.once)&&this.off(e,l.value,l.options),l.value.apply(this,[t])}else typeof r.options=="object"&&((i=r.options)!=null&&i.once)&&this.off(e,r.value,r.options),r.value.apply(this,[t]);return!0}else return!1}on(e,t,r){return this.addEventListener(e,t,r)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,r){return this.removeEventListener(e,t,r)}emit(e,t){this.dispatchEvent(e,t)}}function Ye(o){const{highlight:e,highlightImage:t,highlightReferImage:r,highlightColormap:n,highlightLine:i,highlightSize:s,highlightThickness:a}=o;return{image:(e==null?void 0:e.image)??t??"none",referImage:(e==null?void 0:e.referImage)??r??"none",colormap:(e==null?void 0:e.colormap)??n??"none",line:(e==null?void 0:e.line)??i??"none",size:(e==null?void 0:e.size)??s??"cover",thickness:(e==null?void 0:e.thickness)??a??"100%"}}function On(){const o=[],e=[],t=new Map,r=new Map;async function n(s){if(!t.has(s)){t.set(s,s);try{t.set(s,await fetch(s).then(a=>a.text()))}catch(a){console.warn(a),t.delete(s)}}}function i(s){let a=r.get(s);if(!a){const l=Pn(Xe(s)?t.get(s)??s:s),h=Mn(l);a={dom:l,paths:h},r.set(s,a)}return a}return{name:"highlight",paths:o,load:async s=>{const a=new Set;s.forEachCharacter(l=>{const{computedStyle:h}=l,{image:c,referImage:f}=Ye(h);Xe(c)&&a.add(c),Xe(f)&&a.add(f)}),await Promise.all(Array.from(a).map(l=>n(l)))},update:s=>{e.length=0,o.length=0;let a=[],l,h;s.forEachCharacter(c=>{const{computedStyle:f}=c,u=Ye(f),{image:p,colormap:g,line:m,size:d,thickness:k}=u;if(Nt(p))l!=null&&l.length&&(l=[],a.push(l));else{const{inlineBox:S,isVertical:C}=c,{fontSize:A}=f;(!h||Qt(h.image,p)&&Qt(h.colormap,g)&&Qt(h.line,m)&&Qt(h.size,d)&&Qt(h.thickness,k))&&(l!=null&&l.length)&&(C?l[0].inlineBox.left===S.left:l[0].inlineBox.top===S.top)&&l[0].fontSize===A?l.push(c):(l=[],l.push(c),a.push(l))}h=u}),a=a.filter(c=>c.length);for(let c=0;c<a.length;c++){const f=a[c],u=f[0],p=N.from(...f.filter(D=>D.glyphBox).map(D=>D.glyphBox)),{computedStyle:g}=u,{fontSize:m,writingMode:d}=g,{image:k,referImage:S,colormap:C,line:A,size:w,thickness:v}=Ye(g),_=d.includes("vertical"),M=Ve(v,{fontSize:m,total:p.width})/p.width,T=Pr(C),{paths:V,dom:H}=i(k),U=Ae(V,!0),et=m/U.width*2,P=new N().copy(p);_&&(P.width=p.height,P.height=p.width,P.left=p.left+p.width);const z=Math.floor(P.width);let q=z;if(w!=="cover"&&(q=Ve(w,{fontSize:m,total:p.width})||z,P.width=q),!Nt(S)&&Nt(A)){const D=Ae(i(S).paths,!0);U.copy(D)}else{let D;if(Nt(A))if(U.width/U.height>4){D="underline";const $=H.getAttribute("viewBox");if($){const[nt,O,Z,G]=$.split(" ").map(L=>Number(L)),j=O+G/2;U.y<j&&U.y+U.height>j?D="line-through":U.y+U.height<j?D="overline":D="underline"}}else D="outline";else D=A;switch(D){case"outline":{const $=P.width*.2,nt=P.height*.2;P.width+=$,P.height+=nt,_?(P.x-=nt/2,P.y-=$/2,P.x+=P.height):(P.x-=$/2,P.y-=nt/2);break}case"overline":P.height=U.height*et,_?P.x=u.inlineBox.left+u.inlineBox.width:P.y=u.inlineBox.top;break;case"line-through":P.height=U.height*et,_?P.x=u.inlineBox.left+u.inlineBox.width-u.strikeoutPosition+P.height/2:P.y=u.inlineBox.top+u.strikeoutPosition-P.height/2;break;case"underline":P.height=U.height*et,_?P.x=u.inlineBox.left+u.inlineBox.width-u.underlinePosition:P.y=u.inlineBox.top+u.underlinePosition;break}}const F=new St().translate(-U.x,-U.y).scale(P.width/U.width,P.height/U.height);_&&F.rotate(-Math.PI/2),F.translate(P.x,P.y);for(let D=0;D<Math.ceil(z/q);D++){const $=F.clone();_?$.translate(0,D*P.width):$.translate(D*P.width,0),V.forEach(nt=>{const O=nt.clone().matrix($);O.style.strokeWidth&&(O.style.strokeWidth*=et*M),O.style.strokeMiterlimit&&(O.style.strokeMiterlimit*=et),O.style.strokeDashoffset&&(O.style.strokeDashoffset*=et),O.style.strokeDasharray&&(O.style.strokeDasharray=O.style.strokeDasharray.map(Z=>Z*et)),O.style.fill&&O.style.fill in T&&(O.style.fill=T[O.style.fill]),O.style.stroke&&O.style.stroke in T&&(O.style.stroke=T[O.style.stroke]),o.push(O),z!==q&&(_?e[o.length-1]=new N(p.left-p.width*2,p.top,p.width*4,p.height):e[o.length-1]=new N(p.left,p.top-p.height*2,p.width,p.height*4))})}}},renderOrder:-1,render:(s,a)=>{o.forEach((l,h)=>{if(re({ctx:s,path:l,fontSize:a.computedStyle.fontSize,clipRect:e[h]}),a.debug){const c=Ae([l]);c&&s.strokeRect(c.x,c.y,c.width,c.height)}})}}}function co(o,e){return`<svg width="${o*2}" height="${o*2}" xmlns="http://www.w3.org/2000/svg">
6
+ <circle cx="${o}" cy="${o}" r="${o}" fill="${e}" />
7
+ </svg>`}function In(){const o=[];return{name:"listStyle",paths:o,update:e=>{o.length=0;const{paragraphs:t,isVertical:r,fontSize:n}=e,i=n*.45;t.forEach(s=>{const{computedStyle:a}=s,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:f,listStyleType:u}=a,p=Pr(c);let g=f,m;if(!Nt(h))m=h;else if(!Nt(u)){const C=n*.38/2;switch(g=g==="cover"?C*2:g,u){case"disc":m=co(C,String(l));break}}if(!m)return;const d=Mn(m),k=Ae(d);let S;s.fragments.forEach(C=>{C.characters.forEach(A=>{const{inlineBox:w}=A;if(r?(S==null?void 0:S.inlineBox.left)!==w.left:(S==null?void 0:S.inlineBox.top)!==w.top){S=A;const v=g==="cover"?1:Ve(g,{total:n,fontSize:n})/n,_=new St;if(r){const M=n/k.height*v;_.translate(-k.left,-k.top).rotate(Math.PI/2).scale(M,M).translate(w.left+(w.width-k.height*M)/2,w.top-i)}else{const M=n/k.height*v;_.translate(-k.left,-k.top).scale(M,M).translate(w.left-k.width*M-i,w.top+(w.height-k.height*M)/2)}o.push(...d.map(M=>{const T=M.clone();return T.matrix(_),T.style.fill&&T.style.fill in p&&(T.style.fill=p[T.style.fill]),T.style.stroke&&T.style.stroke in p&&(T.style.stroke=p[T.style.stroke]),T}))}})})})}}}const Wt=new b,fe=new St,Xt=new St;function Bn(){return{name:"render",getBoundingBox:o=>{const{characters:e,fontSize:t,effects:r}=o,n=[];return e.forEach(i=>{r==null||r.forEach(s=>{if(!i.glyphBox)return;const a=i.glyphBox.clone(),l=Ze(o,s);Wt.set(a.left,a.top),Wt.applyMatrix3(l),a.left=Wt.x,a.top=Wt.y,Wt.set(a.right,a.bottom),Wt.applyMatrix3(l),a.width=Wt.x-a.left,a.height=Wt.y-a.top;const h=(s.shadowOffsetX??0)*t,c=(s.shadowOffsetY??0)*t,f=Math.max(.1,s.textStrokeWidth??0)*t;a.left+=h-f,a.top+=c-f,a.width+=f*2,a.height+=f*2,n.push(a)})}),n.length?N.from(...n):void 0},render:(o,e)=>{const{paragraphs:t,glyphBox:r,effects:n,style:i}=e;function s(a,l){o.fillStyle=a,o.fillRect(l.left,l.top,l.width,l.height)}i!=null&&i.backgroundColor&&s(i.backgroundColor,new N(0,0,o.canvas.width,o.canvas.height)),t.forEach(a=>{var l;(l=a.style)!=null&&l.backgroundColor&&s(a.style.backgroundColor,a.lineBox)}),n?n.forEach(a=>{It(a,r,o),o.save();const[l,h,c,f,u,p]=Ze(e,a).transpose().elements;o.transform(l,f,h,u,c,p),e.forEachCharacter(g=>{var m;(m=g.parent.style)!=null&&m.backgroundColor&&s(g.parent.style.backgroundColor,g.inlineBox),g.drawTo(o,a)}),o.restore()}):t.forEach(a=>{a.fragments.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&s(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(o)})})}),e.debug&&t.forEach(a=>{o.strokeRect(a.lineBox.x,a.lineBox.y,a.lineBox.width,a.lineBox.height)})}}}function Ze(o,e){const{fontSize:t,glyphBox:r}=o,n=(e.translateX??0)*t,i=(e.translateY??0)*t,s=Math.PI*2,a=(e.skewX??0)/360*s,l=(e.skewY??0)/360*s,{left:h,top:c,width:f,height:u}=r,p=h+f/2,g=c+u/2;return fe.identity(),Xt.makeTranslation(n,i),fe.multiply(Xt),Xt.makeTranslation(p,g),fe.multiply(Xt),Xt.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),fe.multiply(Xt),Xt.makeTranslation(-p,-g),fe.multiply(Xt),fe.clone()}function En(){const o=[];return{name:"textDecoration",paths:o,update:e=>{o.length=0;const t=[];let r,n;e.forEachCharacter(i=>{const{computedStyle:s,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:f,strikeoutSize:u}=i,{color:p,textDecoration:g,writingMode:m}=s;if(Nt(g))n=void 0;else{let d=!1;if((n==null?void 0:n.textDecoration)===g&&(n==null?void 0:n.writingMode)===m&&(n==null?void 0:n.color)===p&&(a?r[0].inlineBox.left===l.left:r[0].inlineBox.top===l.top))switch(g){case"underline":r[0].underlinePosition===h&&r[0].underlineThickness===c&&(d=!0);break;case"line-through":r[0].strikeoutPosition===f&&r[0].strikeoutSize===u&&(d=!0);break}d?r.push(i):(r=[],r.push(i),t.push(r)),n=s}}),t.forEach(i=>{const{computedStyle:s,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:f}=i[0],{color:u,textDecoration:p}=s,{left:g,top:m,width:d,height:k}=N.from(...i.map(v=>v.inlineBox));let S=a?g+d:m;const C=a?-1:1;let A=0;switch(p){case"overline":A=h*2;break;case"underline":S+=C*l,A=h*2;break;case"line-through":S+=C*c,A=f*2;break}S-=A;let w;a?w=new Ct([{type:"M",x:S,y:m},{type:"L",x:S,y:m+k},{type:"L",x:S+A,y:m+k},{type:"L",x:S+A,y:m},{type:"Z"}],{fill:u}):w=new Ct([{type:"M",x:g,y:S},{type:"L",x:g+d,y:S},{type:"L",x:g+d,y:S+A},{type:"L",x:g,y:S+A},{type:"Z"}],{fill:u}),o.push(w)})},render:(e,t)=>{const{effects:r,computedStyle:n}=t;r?r.forEach(i=>{e.save();const[s,a,l,h,c,f]=Ze(t,i).transpose().elements;e.transform(s,h,a,c,l,f),o.forEach(u=>{re({ctx:e,path:u,fontSize:n.fontSize,...i})}),e.restore()}):o.forEach(i=>{re({ctx:e,path:i,fontSize:n.fontSize})})}}}const Tr=lo();class kr extends ho{constructor(t={}){super();x(this,"debug");x(this,"content");x(this,"style");x(this,"effects");x(this,"measureDom");x(this,"needsUpdate",!0);x(this,"computedStyle",{...Tr});x(this,"paragraphs",[]);x(this,"lineBox",new N);x(this,"rawGlyphBox",new N);x(this,"glyphBox",new N);x(this,"pathBox",new N);x(this,"boundingBox",new N);x(this,"measurer",new He);x(this,"plugins",new Map);x(this,"fonts");this.debug=t.debug??!1,this.content=t.content??"",this.style=t.style??{},this.measureDom=t.measureDom,this.effects=t.effects,this.fonts=t.fonts,this.use(In()).use(En()).use(On()).use(Bn()),this.updateParagraphs()}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(r=>r.characters))}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((r,n)=>{r.fragments.forEach((i,s)=>{i.characters.forEach((a,l)=>{t(a,{paragraphIndex:n,fragmentIndex:s,characterIndex:l})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>{var r;return(r=t.load)==null?void 0:r.call(t,this)}))}updateParagraphs(){this.computedStyle={...Tr,...this.style};let{content:t,computedStyle:r}=this;const n=[];if(typeof t=="string"){const i=new ce({},r);i.addFragment(t),n.push(i)}else{t=Array.isArray(t)?t:[t];for(const i of t)if(typeof i=="string"){const s=new ce({},r);s.addFragment(i),n.push(s)}else if(Array.isArray(i)){const s=new ce({},r);i.forEach(a=>{if(typeof a=="string")s.addFragment(a);else{const{content:l,...h}=a;l!==void 0&&s.addFragment(l,h)}}),n.push(s)}else if("fragments"in i){const{fragments:s,...a}=i,l=new ce(a,r);s.forEach(h=>{const{content:c,...f}=h;c!==void 0&&l.addFragment(c,f)}),n.push(l)}else if("content"in i){const{content:s,...a}=i;if(s!==void 0){const l=new ce(a,r);l.addFragment(s),n.push(l)}}}return this.paragraphs=n,this}measure(t=this.measureDom){const r={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const n=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox,this.characters.forEach(i=>{i.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((i,s)=>(i.updateOrder??0)-(s.updateOrder??0)).forEach(i=>{var s;(s=i.update)==null||s.call(i,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const i in r)n[i]=this[i],this[i]=r[i];return this.emit("measure",{text:this,result:n}),n}getGlyphBox(){const t=b.MAX,r=b.MIN;return this.characters.forEach(n=>{if(!n.getGlyphMinMax(t,r)){const{inlineBox:i}=n,s=new b(i.left,i.top),a=new b(i.left+i.width,i.top+i.height);t.min(s,a),r.max(s,a)}}),new N(t.x,t.y,r.x-t.x,r.y-t.y)}updatePathBox(){return this.pathBox=N.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>t.getBoundingBox?t.getBoundingBox(this):Ae(t.paths??[])).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:r,pathBox:n}=this,i=Math.min(n.left,n.left+t.left-r.left),s=Math.min(n.top,n.top+t.top-r.top),a=Math.max(n.right,n.right+t.right-r.right),l=Math.max(n.bottom,n.bottom+t.bottom-r.bottom);return this.boundingBox=new N(i,s,a-i,l-s),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const r in t)this[r]=t[r];return this.emit("update",{text:this}),this.needsUpdate=!1,this}render(t){const{view:r,pixelRatio:n=2}=t,i=r.getContext("2d");i&&(this.needsUpdate&&this.update(),Or(i,n,this.boundingBox),Ir(i,this),Array.from(this.plugins.values()).sort((s,a)=>(s.renderOrder??0)-(a.renderOrder??0)).forEach(s=>{var a;if(s.render)(a=s.render)==null||a.call(s,i,this);else if(s.paths){const l=this.computedStyle;s.paths.forEach(h=>{re({ctx:i,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:r,pixelRatio:n}))}}function fo(o,e){const t=new kr(o);return e?t.load().then(()=>t.measure()):t.measure()}function uo(o,e){const t=new kr(o);return e?t.load().then(()=>t.render(o)):t.render(o)}E.Character=kn,E.Fragment=_n,E.Measurer=He,E.Paragraph=ce,E.Text=kr,E.definePlugin=io,E.drawPath=re,E.filterEmpty=We,E.getHighlightStyle=Ye,E.getTransform2D=Ze,E.hexToRgb=Mr,E.highlight=On,E.isEqualObject=An,E.isEqualValue=Qt,E.isNone=Nt,E.listStyle=In,E.measureText=fo,E.needsFetch=Xe,E.parseColor=lt,E.parseColormap=Pr,E.parseValueNumber=Ve,E.render=Bn,E.renderText=uo,E.setupView=Or,E.textDecoration=En,E.textDefaultStyle=Tr,E.uploadColor=It,E.uploadColors=Ir,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -537,7 +537,7 @@ class Measurer {
537
537
  const _style = {};
538
538
  for (const key in style) {
539
539
  const value = style[key];
540
- if (Measurer.notZeroStyles.has(key) && !value) ; else if (Measurer.pxStyles.has(key)) {
540
+ if (Measurer.notZeroStyles.has(key) && value === 0) ; else if (typeof value === "number" && Measurer.pxStyles.has(key)) {
541
541
  _style[key] = `${value}px`;
542
542
  } else {
543
543
  _style[key] = value;
@@ -1704,9 +1704,9 @@ class Text extends EventEmitter {
1704
1704
  }
1705
1705
  }
1706
1706
 
1707
- function measureText(options) {
1707
+ function measureText(options, load) {
1708
1708
  const text = new Text(options);
1709
- if (options.load) {
1709
+ if (load) {
1710
1710
  return text.load().then(() => {
1711
1711
  return text.measure();
1712
1712
  });
@@ -1714,9 +1714,9 @@ function measureText(options) {
1714
1714
  return text.measure();
1715
1715
  }
1716
1716
 
1717
- function renderText(options) {
1717
+ function renderText(options, load) {
1718
1718
  const text = new Text(options);
1719
- if (options.load) {
1719
+ if (load) {
1720
1720
  return text.load().then(() => {
1721
1721
  return text.render(options);
1722
1722
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "1.0.3",
4
+ "version": "1.0.5",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",
@@ -57,21 +57,21 @@
57
57
  "prepare": "simple-git-hooks"
58
58
  },
59
59
  "dependencies": {
60
- "modern-font": "^0.3.4",
61
- "modern-idoc": "^0.1.3",
62
- "modern-path2d": "^1.0.0"
60
+ "modern-font": "^0.3.5",
61
+ "modern-idoc": "^0.1.4",
62
+ "modern-path2d": "^1.0.1"
63
63
  },
64
64
  "devDependencies": {
65
- "@antfu/eslint-config": "^3.12.0",
66
- "@types/node": "^22.10.2",
65
+ "@antfu/eslint-config": "^3.12.1",
66
+ "@types/node": "^22.10.3",
67
67
  "bumpp": "^9.9.2",
68
68
  "conventional-changelog-cli": "^5.0.0",
69
69
  "eslint": "^9.17.0",
70
- "lint-staged": "^15.2.11",
70
+ "lint-staged": "^15.3.0",
71
71
  "simple-git-hooks": "^2.11.1",
72
72
  "typescript": "^5.7.2",
73
- "unbuild": "^3.0.1",
74
- "vite": "^6.0.5",
73
+ "unbuild": "^3.2.0",
74
+ "vite": "^6.0.6",
75
75
  "vitest": "^2.1.8"
76
76
  },
77
77
  "simple-git-hooks": {