modern-text 0.4.3 → 0.4.4

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
@@ -652,7 +652,7 @@ function parseStrokeWidthScale(strokeWidth, fontSize, total) {
652
652
  return strokeWidth / total;
653
653
  }
654
654
  }
655
- function getTransformMatrix(a, b, c, isVertical) {
655
+ function getTransformMatrix(a, b, c, isVertical, type) {
656
656
  let scale;
657
657
  if (!isVertical) {
658
658
  scale = {
@@ -667,10 +667,18 @@ function getTransformMatrix(a, b, c, isVertical) {
667
667
  }
668
668
  const offset = c.center.add(
669
669
  a.center.sub(b.center).scale(scale.x, scale.y)
670
- ).sub({
671
- x: a.width / 2 * scale.x,
672
- y: a.height / 2 * scale.y
673
- });
670
+ );
671
+ if (type === "line") {
672
+ offset.sub({
673
+ x: a.width / 2 * scale.x,
674
+ y: a.height * scale.y
675
+ });
676
+ } else {
677
+ offset.sub({
678
+ x: a.width / 2 * scale.x,
679
+ y: a.height / 2 * scale.y
680
+ });
681
+ }
674
682
  const m = new modernPath2d.Matrix3();
675
683
  m.translate(-a.left, -a.top);
676
684
  if (isVertical) {
@@ -718,12 +726,12 @@ function highlight() {
718
726
  groups.filter((characters) => characters.length).map((characters) => {
719
727
  const char = characters[0];
720
728
  return {
721
- style: char.computedStyle,
722
- unitHeight: char.typoAscender + char.typoDescender,
723
- box: modernPath2d.BoundingBox.from(...characters.map((c) => c.glyphBox))
729
+ char,
730
+ groupBox: modernPath2d.BoundingBox.from(...characters.map((c) => c.glyphBox))
724
731
  };
725
732
  }).forEach((group2) => {
726
- const { style, box: groupBox, unitHeight } = group2;
733
+ const { char, groupBox } = group2;
734
+ const style = char.computedStyle;
727
735
  const { fontSize, writingMode } = style;
728
736
  const isVertical = writingMode.includes("vertical");
729
737
  const strokeWidthScale = parseStrokeWidthScale(style.highlightStrokeWidth, fontSize, groupBox.width);
@@ -734,11 +742,21 @@ function highlight() {
734
742
  const box = modernPath2d.getPathsBoundingBox(svgPaths, true);
735
743
  const refBox = modernPath2d.getPathsBoundingBox(refPaths, false);
736
744
  const unitWidth = charsPerRepeat ? fontSize * charsPerRepeat : isVertical ? groupBox.height : groupBox.width;
745
+ let unitHeight;
746
+ let type;
747
+ if (box.height / refBox.height > 0.8) {
748
+ type = "block";
749
+ unitHeight = groupBox.height;
750
+ } else {
751
+ type = "line";
752
+ unitHeight = char.inlineBox.top - groupBox.top + char.underlinePosition;
753
+ }
737
754
  const transform = getTransformMatrix(
738
755
  box,
739
756
  refBox,
740
757
  new modernPath2d.BoundingBox(groupBox.left, groupBox.top, isVertical ? unitHeight : unitWidth, isVertical ? unitWidth : unitHeight),
741
- isVertical
758
+ isVertical,
759
+ type
742
760
  );
743
761
  const styleScale = fontSize / box.width * 2;
744
762
  const total = Math.ceil(groupBox.width / unitWidth);
@@ -970,10 +988,10 @@ function textDecoration() {
970
988
  let group;
971
989
  let prevStyle;
972
990
  text.forEachCharacter((character) => {
973
- const { computedStyle: style, underlinePosition, underlineThickness, strikeoutPosition, strikeoutSize } = character;
991
+ const { computedStyle: style, isVertical, inlineBox, underlinePosition, underlineThickness, strikeoutPosition, strikeoutSize } = character;
974
992
  if (!isNone(style.textDecoration)) {
975
993
  let flag = false;
976
- if (prevStyle?.textDecoration === style.textDecoration && prevStyle?.writingMode === style.writingMode) {
994
+ if (prevStyle?.textDecoration === style.textDecoration && prevStyle?.writingMode === style.writingMode && (isVertical ? group[0].inlineBox.left === inlineBox.left : group[0].inlineBox.top === inlineBox.top)) {
977
995
  switch (style.textDecoration) {
978
996
  case "underline":
979
997
  if (group[0].underlinePosition === underlinePosition && group[0].underlineThickness === underlineThickness) {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- (function(z,at){typeof exports=="object"&&typeof module<"u"?at(exports):typeof define=="function"&&define.amd?define(["exports"],at):(z=typeof globalThis<"u"?globalThis:z||self,at(z.modernText={}))})(this,function(z){"use strict";var da=Object.defineProperty;var ga=(z,at,Ot)=>at in z?da(z,at,{enumerable:!0,configurable:!0,writable:!0,value:Ot}):z[at]=Ot;var D=(z,at,Ot)=>ga(z,typeof at!="symbol"?at+"":at,Ot);function at(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:i,stops:a}=os(t,e.left,e.top,e.width,e.height),l=s.createLinearGradient(r,n,o,i);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function Ot(s,t,e){s!=null&&s.color&&(s.color=at(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=at(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=at(e,s.textStrokeColor,t))}function os(s,t,e,r,n){var g;const o=((g=s.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",i=o.split(",")[0],a=i.includes("deg")?i:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),f=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+f,x1:t+r/2+u,y1:e+n/2-f,stops:Array.from(l).map(d=>{let m=d[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(d[3].replace("%",""))/100,color:m}})}}function Jt(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const o=e.style,i={...o,fill:s.color??o.fill,stroke:s.textStrokeColor??o.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,i),t.restore()}function Nr(s,t,e){const{left:r,top:n,width:o,height:i}=e,a=s.canvas;a.dataset.viewBox=`${r} ${n} ${o} ${i}`,a.dataset.pixelRatio=String(t);const l=o,h=i;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(h*t)),a.style.width=`${l}px`,a.style.height=`${h}px`,s.clearRect(0,0,a.width,a.height),s.scale(t,t),s.translate(-r,-n)}function zr(s,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;Ot(r,n,s),e.forEach(o=>{Ot(o.computedStyle,o.lineBox,s),o.fragments.forEach(i=>{Ot(i.computedStyle,i.inlineBox,s)})})}var lt=Uint8Array,St=Uint16Array,He=Int32Array,_e=new lt([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 lt([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]),Ze=new lt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ur=function(s,t){for(var e=new St(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new He(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)n[o]=o-e[r]<<5|r;return{b:e,r:n}},Lr=Ur(_e,2),Er=Lr.b,Ke=Lr.r;Er[28]=258,Ke[258]=28;for(var $r=Ur(Ie,0),as=$r.b,kr=$r.r,Je=new St(32768),j=0;j<32768;++j){var Ft=(j&43690)>>1|(j&21845)<<1;Ft=(Ft&52428)>>2|(Ft&13107)<<2,Ft=(Ft&61680)>>4|(Ft&3855)<<4,Je[j]=((Ft&65280)>>8|(Ft&255)<<8)>>1}for(var Nt=function(s,t,e){for(var r=s.length,n=0,o=new St(t);n<r;++n)s[n]&&++o[s[n]-1];var i=new St(t);for(n=1;n<t;++n)i[n]=i[n-1]+o[n-1]<<1;var a;if(e){a=new St(1<<t);var l=15-t;for(n=0;n<r;++n)if(s[n])for(var h=n<<4|s[n],c=t-s[n],u=i[s[n]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[Je[u]>>l]=h}else for(a=new St(r),n=0;n<r;++n)s[n]&&(a[n]=Je[i[s[n]-1]++]>>15-s[n]);return a},Gt=new lt(288),j=0;j<144;++j)Gt[j]=8;for(var j=144;j<256;++j)Gt[j]=9;for(var j=256;j<280;++j)Gt[j]=7;for(var j=280;j<288;++j)Gt[j]=8;for(var he=new lt(32),j=0;j<32;++j)he[j]=5;var ls=Nt(Gt,9,0),hs=Nt(Gt,9,1),cs=Nt(he,5,0),us=Nt(he,5,1),tr=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},_t=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},er=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},rr=function(s){return(s+7)/8|0},Br=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new lt(s.subarray(t,e))},fs=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],It=function(s,t,e){var r=new Error(t||fs[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,It),!e)throw r;return r},ps=function(s,t,e,r){var n=s.length,o=0;if(!n||t.f&&!t.l)return e||new lt(0);var i=!e,a=i||t.i!=2,l=t.i;i&&(e=new lt(n*3));var h=function(Et){var $t=e.length;if(Et>$t){var jt=new lt(Math.max($t*2,Et));jt.set(e),e=jt}},c=t.f||0,u=t.p||0,f=t.b||0,g=t.l,d=t.d,m=t.m,p=t.n,b=n*8;do{if(!g){c=_t(s,u,1);var M=_t(s,u+1,3);if(u+=3,M)if(M==1)g=hs,d=us,m=9,p=5;else if(M==2){var x=_t(s,u,31)+257,A=_t(s,u+10,15)+4,C=x+_t(s,u+5,31)+1;u+=14;for(var P=new lt(C),$=new lt(19),R=0;R<A;++R)$[Ze[R]]=_t(s,u+R*3,7);u+=A*3;for(var W=tr($),Y=(1<<W)-1,O=Nt($,W,1),R=0;R<C;){var U=O[_t(s,u,Y)];u+=U&15;var S=U>>4;if(S<16)P[R++]=S;else{var V=0,k=0;for(S==16?(k=3+_t(s,u,3),u+=2,V=P[R-1]):S==17?(k=3+_t(s,u,7),u+=3):S==18&&(k=11+_t(s,u,127),u+=7);k--;)P[R++]=V}}var rt=P.subarray(0,x),Q=P.subarray(x);m=tr(rt),p=tr(Q),g=Nt(rt,m,1),d=Nt(Q,p,1)}else It(1);else{var S=rr(u)+4,I=s[S-4]|s[S-3]<<8,w=S+I;if(w>n){l&&It(0);break}a&&h(f+I),e.set(s.subarray(S,w),f),t.b=f+=I,t.p=u=w*8,t.f=c;continue}if(u>b){l&&It(0);break}}a&&h(f+131072);for(var Tt=(1<<m)-1,F=(1<<p)-1,tt=u;;tt=u){var V=g[er(s,u)&Tt],B=V>>4;if(u+=V&15,u>b){l&&It(0);break}if(V||It(2),B<256)e[f++]=B;else if(B==256){tt=u,g=null;break}else{var G=B-254;if(B>264){var R=B-257,N=_e[R];G=_t(s,u,(1<<N)-1)+Er[R],u+=N}var Z=d[er(s,u)&F],X=Z>>4;Z||It(3),u+=Z&15;var Q=as[X];if(X>3){var N=Ie[X];Q+=er(s,u)&(1<<N)-1,u+=N}if(u>b){l&&It(0);break}a&&h(f+131072);var nt=f+G;if(f<Q){var Zt=o-Q,Kt=Math.min(Q,nt);for(Zt+f<0&&It(3);f<Kt;++f)e[f]=r[Zt+f]}for(;f<nt;++f)e[f]=e[f-Q]}}t.l=g,t.p=tt,t.b=f,t.f=c,g&&(c=1,t.m=m,t.d=d,t.n=p)}while(!c);return f!=e.length&&i?Br(e,0,f):e.subarray(0,f)},Bt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ce=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},nr=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,o=e.slice();if(!n)return{t:qr,l:0};if(n==1){var i=new lt(e[0].s+1);return i[e[0].s]=1,{t:i,l:1}}e.sort(function(w,x){return w.f-x.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,c=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=e[e[h].f<e[u].f?h++:u++],l=e[h!=c&&e[h].f<e[u].f?h++:u++],e[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=o[0].s,r=1;r<n;++r)o[r].s>f&&(f=o[r].s);var g=new St(f+1),d=sr(e[c-1],g,0);if(d>t){var r=0,m=0,p=d-t,b=1<<p;for(o.sort(function(x,A){return g[A.s]-g[x.s]||x.f-A.f});r<n;++r){var M=o[r].s;if(g[M]>t)m+=b-(1<<d-g[M]),g[M]=t;else break}for(m>>=p;m>0;){var S=o[r].s;g[S]<t?m-=1<<t-g[S]++-1:++r}for(;r>=0&&m;--r){var I=o[r].s;g[I]==t&&(--g[I],++m)}d=t}return{t:new lt(g),l:d}},sr=function(s,t,e){return s.s==-1?Math.max(sr(s.l,t,e+1),sr(s.r,t,e+1)):t[s.s]=e},jr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new St(++t),r=0,n=s[0],o=1,i=function(l){e[r++]=l},a=1;a<=t;++a)if(s[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(n),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(n);o=1,n=s[a]}return{c:e.subarray(0,r),n:t}},ue=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Fr=function(s,t,e){var r=e.length,n=rr(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var o=0;o<r;++o)s[n+o+4]=e[o];return(n+4+r)*8},Gr=function(s,t,e,r,n,o,i,a,l,h,c){Bt(t,c++,e),++n[256];for(var u=nr(n,15),f=u.t,g=u.l,d=nr(o,15),m=d.t,p=d.l,b=jr(f),M=b.c,S=b.n,I=jr(m),w=I.c,x=I.n,A=new St(19),C=0;C<M.length;++C)++A[M[C]&31];for(var C=0;C<w.length;++C)++A[w[C]&31];for(var P=nr(A,7),$=P.t,R=P.l,W=19;W>4&&!$[Ze[W-1]];--W);var Y=h+5<<3,O=ue(n,Gt)+ue(o,he)+i,U=ue(n,f)+ue(o,m)+i+14+3*W+ue(A,$)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&Y<=O&&Y<=U)return Fr(t,c,s.subarray(l,l+h));var V,k,rt,Q;if(Bt(t,c,1+(U<O)),c+=2,U<O){V=Nt(f,g,0),k=f,rt=Nt(m,p,0),Q=m;var Tt=Nt($,R,0);Bt(t,c,S-257),Bt(t,c+5,x-1),Bt(t,c+10,W-4),c+=14;for(var C=0;C<W;++C)Bt(t,c+3*C,$[Ze[C]]);c+=3*W;for(var F=[M,w],tt=0;tt<2;++tt)for(var B=F[tt],C=0;C<B.length;++C){var G=B[C]&31;Bt(t,c,Tt[G]),c+=$[G],G>15&&(Bt(t,c,B[C]>>5&127),c+=B[C]>>12)}}else V=ls,k=Gt,rt=cs,Q=he;for(var C=0;C<a;++C){var N=r[C];if(N>255){var G=N>>18&31;ce(t,c,V[G+257]),c+=k[G+257],G>7&&(Bt(t,c,N>>23&31),c+=_e[G]);var Z=N&31;ce(t,c,rt[Z]),c+=Q[Z],Z>3&&(ce(t,c,N>>5&8191),c+=Ie[Z])}else ce(t,c,V[N]),c+=k[N]}return ce(t,c,V[256]),c+k[256]},ds=new He([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qr=new lt(0),gs=function(s,t,e,r,n,o){var i=o.z||s.length,a=new lt(r+i+5*(1+Math.ceil(i/7e3))+n),l=a.subarray(r,a.length-n),h=o.l,c=(o.r||0)&7;if(t){c&&(l[0]=o.r>>3);for(var u=ds[t-1],f=u>>13,g=u&8191,d=(1<<e)-1,m=o.p||new St(32768),p=o.h||new St(d+1),b=Math.ceil(e/3),M=2*b,S=function(le){return(s[le]^s[le+1]<<b^s[le+2]<<M)&d},I=new He(25e3),w=new St(288),x=new St(32),A=0,C=0,P=o.i||0,$=0,R=o.w||0,W=0;P+2<i;++P){var Y=S(P),O=P&32767,U=p[Y];if(m[O]=U,p[Y]=O,R<=P){var V=i-P;if((A>7e3||$>24576)&&(V>423||!h)){c=Gr(s,l,0,I,w,x,C,$,W,P-W,c),$=A=C=0,W=P;for(var k=0;k<286;++k)w[k]=0;for(var k=0;k<30;++k)x[k]=0}var rt=2,Q=0,Tt=g,F=O-U&32767;if(V>2&&Y==S(P-F))for(var tt=Math.min(f,V)-1,B=Math.min(32767,P),G=Math.min(258,V);F<=B&&--Tt&&O!=U;){if(s[P+rt]==s[P+rt-F]){for(var N=0;N<G&&s[P+N]==s[P+N-F];++N);if(N>rt){if(rt=N,Q=F,N>tt)break;for(var Z=Math.min(F,N-2),X=0,k=0;k<Z;++k){var nt=P-F+k&32767,Zt=m[nt],Kt=nt-Zt&32767;Kt>X&&(X=Kt,U=nt)}}}O=U,U=m[O],F+=O-U&32767}if(Q){I[$++]=268435456|Ke[rt]<<18|kr[Q];var Et=Ke[rt]&31,$t=kr[Q]&31;C+=_e[Et]+Ie[$t],++w[257+Et],++x[$t],R=P+rt,++A}else I[$++]=s[P],++w[s[P]]}}for(P=Math.max(P,R);P<i;++P)I[$++]=s[P],++w[s[P]];c=Gr(s,l,h,I,w,x,C,$,W,P-W,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=p,o.p=m,o.i=P,o.w=R)}else{for(var P=o.w||0;P<i+h;P+=65535){var jt=P+65535;jt>=i&&(l[c/8|0]=h,jt=i),c=Fr(l,c+1,s.subarray(P,jt))}o.i=i}return Br(a,0,r+rr(c)+n)},Rr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,o=e.length|0,i=0;i!=o;){for(var a=Math.min(i+2655,o);i<a;++i)n+=r+=e[i];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},ys=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),i=new lt(o.length+s.length);i.set(o),i.set(s,o.length),s=i,n.w=o.length}return gs(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)},Wr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},ms=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Rr();n.p(t.dictionary),Wr(s,2,n.d())}},ws=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&It(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&It(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function xs(s,t){t||(t={});var e=Rr();e.p(s);var r=ys(s,t,t.dictionary?6:2,4);return ms(r,t),Wr(r,r.length-4,e.d()),r}function vs(s,t){return ps(s.subarray(ws(s,t),-4),{i:2},t,t)}var bs=typeof TextDecoder<"u"&&new TextDecoder,Ms=0;try{bs.decode(qr,{stream:!0}),Ms=1}catch{}const Ss="modern-font";function fe(s,t){if(!s)throw new Error(`[${Ss}] ${t}`)}function Cs(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function te(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Vr=Object.defineProperty,Ps=(s,t,e)=>t in s?Vr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ht=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Vr(t,e,n),n},Ts=(s,t,e)=>(Ps(s,t+"",e),e);const De={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ct(){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 it extends DataView{constructor(t,e,r,n){super(Cs(t),e,r),this.littleEndian=n,Ts(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,i=>i.toUpperCase())}`,o=this[n](e,r);return this.cursor+=De[t],o}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let o=0,i=r.length;o<i;o++)n+=String.fromCharCode(r[o]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const o=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,i=this[o](r,e,n);return this.cursor+=De[t.toLowerCase()],i}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,i;n<o;++n)i=t.charCodeAt(n)||0,i>127?this.writeUint16(i):this.writeUint8(i);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=te(t);r=n.byteLength;for(let o=0;o<r;++o)this.setUint8(e+o,n.getUint8(o))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}ht([ct()],it.prototype,"readInt8"),ht([ct()],it.prototype,"readInt16"),ht([ct()],it.prototype,"readInt32"),ht([ct()],it.prototype,"readUint8"),ht([ct()],it.prototype,"readUint16"),ht([ct()],it.prototype,"readUint32"),ht([ct()],it.prototype,"readFloat32"),ht([ct()],it.prototype,"readFloat64"),ht([ct()],it.prototype,"writeInt8"),ht([ct()],it.prototype,"writeInt16"),ht([ct()],it.prototype,"writeInt32"),ht([ct()],it.prototype,"writeUint8"),ht([ct()],it.prototype,"writeUint16"),ht([ct()],it.prototype,"writeUint32"),ht([ct()],it.prototype,"writeFloat32"),ht([ct()],it.prototype,"writeFloat64");var _s=Object.defineProperty,Is=(s,t,e)=>t in s?_s(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ds=(s,t,e)=>(Is(s,t+"",e),e);const Qr=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let i=Qr.get(n);i||(i={columns:[],byteLength:0},Qr.set(n,i));const a={...t,name:o,byteLength:e*De[r],offset:t.offset??i.columns.reduce((l,h)=>l+h.byteLength,0)};i.columns.push(a),i.byteLength=i.columns.reduce((l,h)=>l+De[h.type]*(h.size??1),0),Object.defineProperty(n.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Pt{constructor(t,e,r,n){Ds(this,"view"),this.view=new it(t,e,r,n)}}function As(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Ae(s){s=As(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 Os(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 Ns(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}class ir extends Pt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var Xr=Object.defineProperty,zs=(s,t,e)=>t in s?Xr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,yt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Xr(t,e,n),n},Yr=(s,t,e)=>(zs(s,typeof t!="symbol"?t+"":t,e),e);const mt=class es extends ir{constructor(){super(...arguments),Yr(this,"format","EmbeddedOpenType"),Yr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=Ae(n.fontFamily||""),i=o.length,a=Ae(n.fontStyle||""),l=a.length,h=Ae(n.version||""),c=h.length,u=Ae(n.fullName||""),f=u.length,g=86+i+4+l+4+c+4+f+2+t.view.byteLength,d=new es(new ArrayBuffer(g),0,g,!0);d.EOTSize=d.view.byteLength,d.FontDataSize=t.view.byteLength,d.Version=131073,d.Flags=0,d.Charset=1,d.MagicNumber=20556,d.Padding1=0,d.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(d.FontPANOSE=m.fontPANOSE,d.Italic=m.fsSelection,d.Weight=m.usWeightClass,d.fsType=m.fsType,d.UnicodeRange=m.ulUnicodeRange,d.CodePageRange=m.ulCodePageRange),d.view.writeUint16(i),d.view.writeBytes(o),d.view.writeUint16(0),d.view.writeUint16(l),d.view.writeBytes(a),d.view.writeUint16(0),d.view.writeUint16(c),d.view.writeBytes(h),d.view.writeUint16(0),d.view.writeUint16(f),d.view.writeBytes(u),d.view.writeUint16(0),d.view.writeUint16(0),d.view.writeBytes(t.view),d}};yt([y("uint32")],mt.prototype,"EOTSize"),yt([y("uint32")],mt.prototype,"FontDataSize"),yt([y("uint32")],mt.prototype,"Version"),yt([y("uint32")],mt.prototype,"Flags"),yt([y({type:"uint8",size:10})],mt.prototype,"FontPANOSE"),yt([y("uint8")],mt.prototype,"Charset"),yt([y("uint8")],mt.prototype,"Italic"),yt([y("uint32")],mt.prototype,"Weight"),yt([y("uint16")],mt.prototype,"fsType"),yt([y("uint16")],mt.prototype,"MagicNumber"),yt([y({type:"uint8",size:16})],mt.prototype,"UnicodeRange"),yt([y({type:"uint8",size:8})],mt.prototype,"CodePageRange"),yt([y("uint32")],mt.prototype,"CheckSumAdjustment"),yt([y({type:"uint8",size:16})],mt.prototype,"Reserved"),yt([y("uint16")],mt.prototype,"Padding1");var Us=Object.defineProperty,Oe=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Us(t,e,n),n};class pe extends Pt{constructor(t,e){super(t,e,16)}}Oe([y({type:"char",size:4})],pe.prototype,"tag"),Oe([y("uint32")],pe.prototype,"checkSum"),Oe([y("uint32")],pe.prototype,"offset"),Oe([y("uint32")],pe.prototype,"length");const or=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Es=Object.defineProperty,$s=(s,t,e)=>t in s?Es(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,de=(s,t,e)=>($s(s,typeof t!="symbol"?t+"":t,e),e);class Hr{constructor(t){de(this,"index"),de(this,"name"),de(this,"isComposite",!1),de(this,"components",[]),de(this,"pathCommands",[]);const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},o){const i=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=i,yScale:l=i}=n,h=this.pathCommands,c=[];for(let u=0,f=h.length;u<f;u+=1){const g=h[u];g.type==="M"?c.push({type:"M",x:t+g.x*a,y:e+-g.y*l}):g.type==="L"?c.push({type:"L",x:t+g.x*a,y:e+-g.y*l}):g.type==="Q"?c.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="C"?c.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*l,x2:t+g.x2*a,y2:e+-g.y2*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="Z"&&c.push({type:"Z"})}return c}}class ks extends Hr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:i,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,f,g,d;const m=[],p=[];let b=0,M=!1,S=!1,I=i,w=0,x=0;function A(O,U){m.push({type:"L",x:O,y:U})}function C(O,U,V,k,rt,Q){m.push({type:"C",x1:O,y1:U,x2:V,y2:k,x:rt,y:Q})}function P(O,U){S&&h!==2&&$(),S=!0,m.push({type:"M",x:O,y:U})}function $(){m.push({type:"Z"})}function R(O){m.push(...O)}function W(){p.length%2!==0&&!M&&(I=p.shift()+o),b+=p.length>>1,p.length=0,M=!0}function Y(O){let U,V,k,rt,Q,Tt,F,tt,B,G,N,Z,X=0;for(;X<O.length;){let nt=O[X++];switch(nt){case 1:W();break;case 3:W();break;case 4:p.length>1&&!M&&(I=p.shift()+o,M=!0),x+=p.pop(),P(w,x);break;case 5:for(;p.length>0;)w+=p.shift(),x+=p.shift(),A(w,x);break;case 6:for(;p.length>0&&(w+=p.shift(),A(w,x),p.length!==0);)x+=p.shift(),A(w,x);break;case 7:for(;p.length>0&&(x+=p.shift(),A(w,x),p.length!==0);)w+=p.shift(),A(w,x);break;case 8:for(;p.length>0;)u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+p.shift(),C(u,f,g,d,w,x);break;case 10:Q=p.pop()+l,Tt=t.subrs[Q],Tt&&Y(Tt);break;case 11:return;case 12:switch(nt=O[X],X+=1,nt){case 35:u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),F=g+p.shift(),tt=d+p.shift(),B=F+p.shift(),G=tt+p.shift(),N=B+p.shift(),Z=G+p.shift(),w=N+p.shift(),x=Z+p.shift(),p.shift(),C(u,f,g,d,F,tt),C(B,G,N,Z,w,x);break;case 34:u=w+p.shift(),f=x,g=u+p.shift(),d=f+p.shift(),F=g+p.shift(),tt=d,B=F+p.shift(),G=d,N=B+p.shift(),Z=x,w=N+p.shift(),C(u,f,g,d,F,tt),C(B,G,N,Z,w,x);break;case 36:u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),F=g+p.shift(),tt=d,B=F+p.shift(),G=d,N=B+p.shift(),Z=G+p.shift(),w=N+p.shift(),C(u,f,g,d,F,tt),C(B,G,N,Z,w,x);break;case 37:u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),F=g+p.shift(),tt=d+p.shift(),B=F+p.shift(),G=tt+p.shift(),N=B+p.shift(),Z=G+p.shift(),Math.abs(N-w)>Math.abs(Z-x)?w=N+p.shift():x=Z+p.shift(),C(u,f,g,d,F,tt),C(B,G,N,Z,w,x);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),p.length=0}break;case 14:if(p.length>=4){const Zt=or[p.pop()],Kt=or[p.pop()],Et=p.pop(),$t=p.pop();if(Zt&&Kt){n.isComposite=!0,n.components=[];const jt=t.charset.indexOf(Zt),le=t.charset.indexOf(Kt);n.components.push({glyphIndex:le,dx:0,dy:0}),n.components.push({glyphIndex:jt,dx:$t,dy:Et}),R(r.get(le).pathCommands);const Dr=JSON.parse(JSON.stringify(r.get(jt).pathCommands));for(let Ar=0;Ar<Dr.length;Ar+=1){const kt=Dr[Ar];kt.type!=="Z"&&(kt.x+=$t,kt.y+=Et),(kt.type==="Q"||kt.type==="C")&&(kt.x1+=$t,kt.y1+=Et),kt.type==="C"&&(kt.x2+=$t,kt.y2+=Et)}R(Dr)}}else p.length>0&&!M&&(I=p.shift()+o,M=!0);S&&h!==2&&($(),S=!1);break;case 18:W();break;case 19:case 20:W(),X+=b+7>>3;break;case 21:p.length>2&&!M&&(I=p.shift()+o,M=!0),x+=p.pop(),w+=p.pop(),P(w,x);break;case 22:p.length>1&&!M&&(I=p.shift()+o,M=!0),w+=p.pop(),P(w,x);break;case 23:W();break;case 24:for(;p.length>2;)u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+p.shift(),C(u,f,g,d,w,x);w+=p.shift(),x+=p.shift(),A(w,x);break;case 25:for(;p.length>6;)w+=p.shift(),x+=p.shift(),A(w,x);u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+p.shift(),C(u,f,g,d,w,x);break;case 26:for(p.length%2&&(w+=p.shift());p.length>0;)u=w,f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g,x=d+p.shift(),C(u,f,g,d,w,x);break;case 27:for(p.length%2&&(x+=p.shift());p.length>0;)u=w+p.shift(),f=x,g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d,C(u,f,g,d,w,x);break;case 28:U=O[X],V=O[X+1],p.push((U<<24|V<<16)>>16),X+=2;break;case 29:Q=p.pop()+a,Tt=t.gsubrs[Q],Tt&&Y(Tt);break;case 30:for(;p.length>0&&(u=w,f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+(p.length===1?p.shift():0),C(u,f,g,d,w,x),p.length!==0);)u=w+p.shift(),f=x,g=u+p.shift(),d=f+p.shift(),x=d+p.shift(),w=g+(p.length===1?p.shift():0),C(u,f,g,d,w,x);break;case 31:for(;p.length>0&&(u=w+p.shift(),f=x,g=u+p.shift(),d=f+p.shift(),x=d+p.shift(),w=g+(p.length===1?p.shift():0),C(u,f,g,d,w,x),p.length!==0);)u=w,f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+(p.length===1?p.shift():0),C(u,f,g,d,w,x);break;default:nt<32?console.warn(`Glyph ${c}: unknown operator ${nt}`):nt<247?p.push(nt-139):nt<251?(U=O[X],X+=1,p.push((nt-247)*256+U+108)):nt<255?(U=O[X],X+=1,p.push(-(nt-251)*256-U-108)):(U=O[X],V=O[X+1],k=O[X+2],rt=O[X+3],X+=4,p.push((U<<24|V<<16|k<<8|rt)/65536))}}}Y(e),this.pathCommands=m,M&&(this.advanceWidth=I)}}var Bs=Object.defineProperty,js=(s,t,e)=>t in s?Bs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fs=(s,t,e)=>(js(s,t+"",e),e);class Zr{constructor(t){this._sfnt=t,Fs(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??(r.unicode=o[0]),r.unicodes??(r.unicodes=o)),this._items[t]=r}return r}}class Gs extends Zr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new ks({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Kr=Object.defineProperty,qs=(s,t,e)=>t in s?Kr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Jr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Kr(t,e,n),n},Ne=(s,t,e)=>(qs(s,typeof t!="symbol"?t+"":t,e),e);class ze extends Pt{constructor(t,e,r,n){super(t,e,r,n),Ne(this,"_offsets"),Ne(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let o=0,i=e+1;o<i;o++){const a=this.view;let l=0;for(let h=0;h<r;h++)l<<=8,l+=a.readUint8();n.push(l)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],i=r+e[t+1]-n;return this._isString?this.view.readString(n,i):this.view.readBytes(n,i)}}Jr([y("uint16")],ze.prototype,"count"),Jr([y("uint8")],ze.prototype,"offsetSize");class Ue extends ze{constructor(){super(...arguments),Ne(this,"_isString",!1)}}class tn extends ze{constructor(){super(...arguments),Ne(this,"_isString",!0)}}const Rs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","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"],Ws=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Vs=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Qs=[".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?Rs[t]:s[t-391]}var Xs=Object.defineProperty,Ys=(s,t,e)=>t in s?Xs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,en=(s,t,e)=>(Ys(s,typeof t!="symbol"?t+"":t,e),e);function q(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(i){this._setProp(o,i)},configurable:!0,enumerable:!0})}}class rn extends Pt{constructor(){super(...arguments),en(this,"_dict"),en(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),i=o>>4,a=o&15;if(i===r||(e+=n[i],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,i;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),o=e.readUint8(),i=e.readUint8(),r<<24|n<<16|o<<8|i;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),n[o]=e,e=[]):e.push(this._readOperand(o))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Le(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Hs=Object.defineProperty,ar=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Hs(t,e,n),n};class Ee extends rn{}ar([q(19)],Ee.prototype,"subrs"),ar([q(20)],Ee.prototype,"defaultWidthX"),ar([q(21)],Ee.prototype,"nominalWidthX");var Zs=Object.defineProperty,K=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Zs(t,e,n),n};class H extends rn{}K([q(0,"string")],H.prototype,"version"),K([q(1,"string")],H.prototype,"notice"),K([q(1200,"string")],H.prototype,"copyright"),K([q(2,"string")],H.prototype,"fullName"),K([q(3,"string")],H.prototype,"familyName"),K([q(4,"string")],H.prototype,"weight"),K([q(1201)],H.prototype,"isFixedPitch"),K([q(1202)],H.prototype,"italicAngle"),K([q(1203,"number",-100)],H.prototype,"underlinePosition"),K([q(1204,"number",50)],H.prototype,"underlineThickness"),K([q(1205)],H.prototype,"paintType"),K([q(1206,"number",2)],H.prototype,"charstringType"),K([q(1207,"number[]",[.001,0,0,.001,0,0])],H.prototype,"fontMatrix"),K([q(13)],H.prototype,"uniqueId"),K([q(5,"number[]",[0,0,0,0])],H.prototype,"fontBBox"),K([q(1208)],H.prototype,"strokeWidth"),K([q(14)],H.prototype,"xuid"),K([q(15)],H.prototype,"charset"),K([q(16)],H.prototype,"encoding"),K([q(17)],H.prototype,"charStrings"),K([q(18,"number[]",[0,0])],H.prototype,"private");var Ks=Object.defineProperty,Js=(s,t,e)=>t in s?Ks(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,lr=(s,t,e)=>(Js(s,typeof t!="symbol"?t+"":t,e),e);function ut(s,t=s){return e=>{$e.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty($e.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const nn=class Te{constructor(t){lr(this,"tables",new Map),lr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,o=Array.from({length:n}),i=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||i;return o}getPathCommands(t,e,r,n,o){var i;return(i=this.charToGlyph(t))==null?void 0:i.getPathCommands(e,r,n,o,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,o={},i){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];i.call(this,c,e,r,n,o),c.advanceWidth&&(e+=c.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*n:o.tracking&&(e+=o.tracking/1e3*n)}return e}clone(){return new Te(this.tableViews)}delete(t){const e=Te.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Te.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Te.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const o=this.tableViews.get(t);if(!o)return;r=new n(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};lr(nn,"tableDefinitions",new Map);let $e=nn;class ft extends Pt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var sn=Object.defineProperty,ti=Object.getOwnPropertyDescriptor,ei=(s,t,e)=>t in s?sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(s,t,e,r)=>{for(var n=r>1?void 0:r?ti(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&sn(t,e,n),n},hr=(s,t,e)=>(ei(s,typeof t!="symbol"?t+"":t,e),e);let ee=class extends ft{constructor(s,t,e,r){super(s,t,e,r),hr(this,"_glyphs"),hr(this,"privateDict"),hr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Gs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var s;return((s=this.privateDict)==null?void 0:s.defaultWidthX)??0}get nominalWidthX(){var s;return((s=this.privateDict)==null?void 0:s.nominalWidthX)??0}get subrs(){var s;return((s=this.subrsIndex)==null?void 0:s.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const s=this.view,{buffer:t,byteOffset:e}=s,r=e+4;this.nameIndex=new tn(t,r),this.topDictIndex=new Ue(t,this.nameIndex.endOffset),this.stringIndex=new tn(t,this.topDictIndex.endOffset),this.globalSubrIndex=new Ue(t,this.stringIndex.endOffset),this.topDict=new H(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const n=this.topDict.private[0],o=this.topDict.private[1];n&&(this.privateDict=new Ee(t,e+o,n).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ue(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new Ue(t,e+this.topDict.charStrings);const i=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Ws:this.topDict.charset===1?this.charset=Vs:this.topDict.charset===2?this.charset=Qs:this.charset=this._readCharset(e+this.topDict.charset,i,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=or: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,o,i;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(n=0;n<t;n+=1)o=r.readUint16(),a.push(Le(e,o));else if(l===1)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint8(),n=0;n<=i;n+=1)a.push(Le(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint16(),n=0;n<=i;n+=1)a.push(Le(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(s){const t=this.view;t.seek(s);let e,r;const n={},o=t.readUint8();if(o===0){const i=t.readUint8();for(e=0;e<i;e+=1)r=t.readUint8(),n[r]=e}else if(o===1){const i=t.readUint8();for(r=1,e=0;e<i;e+=1){const a=t.readUint8(),l=t.readUint8();for(let h=a;h<=a+l;h+=1)n[h]=r,r+=1}}else console.warn(`unknown encoding format:${o}`);return n}_calcSubroutineBias(s){let t;return s.length<1240?t=107:s.length<33900?t=1131:t=32768,t}};ge([y("uint8")],ee.prototype,"majorVersion",2),ge([y("uint8")],ee.prototype,"minorVersion",2),ge([y("uint8")],ee.prototype,"headerSize",2),ge([y("uint8")],ee.prototype,"offsetSize",2),ee=ge([ut("CFF ","cff")],ee);var ri=Object.defineProperty,ke=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ri(t,e,n),n};const ye=class rs extends Pt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new rs;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};ke([y("uint16")],ye.prototype,"format"),ke([y("uint16")],ye.prototype,"length"),ke([y("uint16")],ye.prototype,"language"),ke([y({type:"uint8",size:256})],ye.prototype,"glyphIndexArray");let on=ye;var ni=Object.defineProperty,cr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ni(t,e,n),n};class Be extends Pt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,o=this.subHeaders,i=this.glyphIndexArray,a=r.findIndex(h=>h===n);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<o[0].firstCode||h>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(h-o[0].firstCode)>=i.length?l=0:(l=i[o[0].idRangeOffset+(h-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(h,l);else{const c=r[h];for(let u=0,f=o[c].entryCount;u<f;u++)if(o[c].idRangeOffset+u>=i.length?l=0:(l=i[o[c].idRangeOffset+u],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<t){const g=(h<<8|u+o[c].firstCode)%65535;e.set(g,l)}}return e}}cr([y("uint16")],Be.prototype,"format"),cr([y("uint16")],Be.prototype,"length"),cr([y("uint16")],Be.prototype,"language");function an(s){return s>32767?s-65536:s<-32767?s+65536:s}function ln(s,t){let e;const r=[];let n={};return s.forEach((o,i)=>{t&&i>t||((!e||i!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:i,startId:o,delta:an(o-i)}):(n.start=Number(i),n.startId=o,n.delta=an(o-i))),e={unicode:i,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var si=Object.defineProperty,Qt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&si(t,e,n),n};const qt=class ns extends Pt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=ln(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,i=new ns(new ArrayBuffer(24+e.length*8));return i.format=4,i.length=i.view.byteLength,i.language=0,i.segCountX2=r*2,i.searchRange=o,i.entrySelector=n,i.rangeShift=2*r-o,i.endCode=[...e.map(a=>a.end),65535],i.reservedPad=0,i.startCode=[...e.map(a=>a.start),65535],i.idDelta=[...e.map(a=>a.delta),1],i.idRangeOffset=Array.from({length:r},()=>0),i}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,i=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<e;++h)for(let c=n[h],u=o[h];c<=u;++c)if(i[h]===0)t.set(c,(c+a[h])%65536);else{const f=h+i[h]/2+(c-n[h])-r,g=l[f];g!==0?t.set(c,(g+a[h])%65536):t.set(c,0)}return t.delete(65535),t}};Qt([y("uint16")],qt.prototype,"format"),Qt([y("uint16")],qt.prototype,"length"),Qt([y("uint16")],qt.prototype,"language"),Qt([y("uint16")],qt.prototype,"segCountX2"),Qt([y("uint16")],qt.prototype,"searchRange"),Qt([y("uint16")],qt.prototype,"entrySelector"),Qt([y("uint16")],qt.prototype,"rangeShift");let hn=qt;var ii=Object.defineProperty,me=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ii(t,e,n),n};class re extends Pt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}me([y("uint16")],re.prototype,"format"),me([y("uint16")],re.prototype,"length"),me([y("uint16")],re.prototype,"language"),me([y("uint16")],re.prototype,"firstCode"),me([y("uint16")],re.prototype,"entryCount");var oi=Object.defineProperty,we=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&oi(t,e,n),n};const ne=class ss extends Pt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=ln(t),r=new ss(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const o=e[r];let i=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,i++)}return t}};we([y("uint16")],ne.prototype,"format"),we([y("uint16")],ne.prototype,"reserved"),we([y("uint32")],ne.prototype,"length"),we([y("uint32")],ne.prototype,"language"),we([y("uint32")],ne.prototype,"nGroups");let cn=ne;var ai=Object.defineProperty,ur=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ai(t,e,n),n};class je extends Pt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:o}=e[r];o.forEach(i=>{t.set(i.unicodeValue,i.glyphID)})}return t}}ur([y("uint16")],je.prototype,"format"),ur([y("uint32")],je.prototype,"length"),ur([y("uint32")],je.prototype,"numVarSelectorRecords");var un=Object.defineProperty,li=Object.getOwnPropertyDescriptor,hi=(s,t,e)=>t in s?un(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fr=(s,t,e,r)=>{for(var n=r>1?void 0:r?li(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&un(t,e,n),n},fn=(s,t,e)=>(hi(s,typeof t!="symbol"?t+"":t,e),e);let xe=class extends ft{constructor(){super(...arguments),fn(this,"_unicodeToGlyphIndexMap"),fn(this,"_glyphIndexToUnicodesMap")}static from(s){const t=Array.from(s.keys()).some(c=>c>65535),e=hn.from(s),r=on.from(s),n=t?cn.from(s):void 0,o=4+(n?32:24),i=o+e.view.byteLength,a=i+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:i},{platformID:3,platformSpecificID:1,offset:o},n&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),h=new xe(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+((n==null?void 0:n.view.byteLength)??0)));return h.numberSubtables=l.length,h.view.seek(4),l.forEach(c=>{h.view.writeUint16(c.platformID),h.view.writeUint16(c.platformSpecificID),h.view.writeUint32(c.offset)}),h.view.writeBytes(e.view,o),h.view.writeBytes(r.view,i),n&&h.view.writeBytes(n.view,a),h}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,n=e.length;r<n;r++){const o=e[r],i=t.get(o);s.has(i)?s.get(i).push(o):s.set(i,[o])}this._glyphIndexToUnicodesMap=s}return this._glyphIndexToUnicodesMap}readSubtables(){const s=this.numberSubtables;return this.view.seek(4),Array.from({length:s},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const e=this.view.readUint16();let r;switch(e){case 0:r=new on(this.view.buffer,t.offset);break;case 2:r=new Be(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new hn(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new re(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new cn(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new je(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){var i,a,l,h,c;const s=this.readSubtables(),t=(i=s.find(u=>u.format===0))==null?void 0:i.view,e=(a=s.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:a.view,r=(l=s.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:l.view,n=(h=s.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:h.view,o=(c=s.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:c.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(e==null?void 0:e.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}};fr([y("uint16")],xe.prototype,"version",2),fr([y("uint16")],xe.prototype,"numberSubtables",2),xe=fr([ut("cmap")],xe);class ci extends Hr{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const o=t[n];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return fe(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const o=t[n],i={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(i)}return r}_parseGlyphCoordinate(t,e,r,n,o){let i;return(e&n)>0?(i=t.view.readUint8(),e&o||(i=-i),i=r+i):(e&o)>0?i=r:i=r+t.view.readInt16(),i}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let m=0;m<n;m++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();fe(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;fe(u<2e4,`Bad numberOfCoordinates:${c}`);const f=[];let g,d=0;for(;d<u;)if(g=t.view.readUint8(),f.push(g),d++,g&8&&d<u){const m=t.view.readUint8();for(let p=0;p<m;p++)f.push(g),d++}if(fe(f.length===u,`Bad flags length: ${f.length}, numberOfCoordinates: ${u}`),a.length>0){const m=[];let p;if(u>0){for(let S=0;S<u;S+=1)g=f[S],p={},p.onCurve=!!(g&1),p.lastPointOfContour=a.includes(S),m.push(p);let b=0;for(let S=0;S<u;S+=1)g=f[S],p=m[S],p.x=this._parseGlyphCoordinate(t,g,b,2,16),b=p.x;let M=0;for(let S=0;S<u;S+=1)g=f[S],p=m[S],p.y=this._parseGlyphCoordinate(t,g,M,4,32),M=p.y}this.points=m}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=t.view.readUint16();const h={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=t.view.readInt16(),h.dy=t.view.readInt16()):h.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(h.dx=t.view.readInt8(),h.dy=t.view.readInt8()):h.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?h.xScale=h.yScale=t.view.readInt16()/16384:(a&64)>0?(h.xScale=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384):(a&128)>0&&(h.xScale=t.view.readInt16()/16384,h.scale01=t.view.readInt16()/16384,h.scale10=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=r.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{fe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let f=h.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};f=this._transformPoints([f],g)[0],g.dx=u.x-f.x,g.dy=u.y-f.y,c=this._transformPoints(h.points,g)}this.points=this.points.concat(c)}}const o=[],i=this._parseContours(this.points);for(let a=0,l=i.length;a<l;++a){const h=i[a];let c=h[h.length-1],u=h[0];c.onCurve?o.push({type:"M",x:c.x,y:c.y}):u.onCurve?o.push({type:"M",x:u.x,y:u.y}):o.push({type:"M",x:(c.x+u.x)*.5,y:(c.y+u.y)*.5});for(let f=0,g=h.length;f<g;++f)if(c=u,u=h[(f+1)%g],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let d=u;u.onCurve||(d={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:d.x,y:d.y})}o.push({type:"Z"})}this.pathCommands=o}}class ui extends Zr{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new ci({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var pn=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,pi=(s,t,e)=>t in s?pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,di=(s,t,e,r)=>{for(var n=r>1?void 0:r?fi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&pn(t,e,n),n},gi=(s,t,e)=>(pi(s,t+"",e),e);let pr=class extends ft{constructor(){super(...arguments),gi(this,"_glyphs")}static from(s){const t=s.reduce((r,n)=>r+n.byteLength,0),e=new pr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeBytes(r)}),e}get glyphs(){return this._glyphs??(this._glyphs=new ui(this._sfnt))}};pr=di([ut("glyf")],pr);var yi=Object.defineProperty,mi=Object.getOwnPropertyDescriptor,wi=(s,t,e,r)=>{for(var n=r>1?void 0:r?mi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&yi(t,e,n),n};let dn=class extends ft{};dn=wi([ut("GPOS","gpos")],dn);var xi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,Xt=(s,t,e,r)=>{for(var n=r>1?void 0:r?vi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&xi(t,e,n),n};let Rt=class extends ft{};Xt([y("uint16")],Rt.prototype,"majorVersion",2),Xt([y("uint16")],Rt.prototype,"minorVersion",2),Xt([y("uint16")],Rt.prototype,"scriptListOffset",2),Xt([y("uint16")],Rt.prototype,"featureListOffset",2),Xt([y("uint16")],Rt.prototype,"lookupListOffset",2),Xt([y("uint16")],Rt.prototype,"featureVariationsOffset",2),Rt=Xt([ut("GSUB","gsub")],Rt);var bi=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,st=(s,t,e,r)=>{for(var n=r>1?void 0:r?Mi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&bi(t,e,n),n};let et=class extends ft{constructor(s=new ArrayBuffer(54),t){super(s,t,Math.min(54,s.byteLength-(t??0)))}};st([y("fixed")],et.prototype,"version",2),st([y("fixed")],et.prototype,"fontRevision",2),st([y("uint32")],et.prototype,"checkSumAdjustment",2),st([y("uint32")],et.prototype,"magickNumber",2),st([y("uint16")],et.prototype,"flags",2),st([y("uint16")],et.prototype,"unitsPerEm",2),st([y({type:"longDateTime"})],et.prototype,"created",2),st([y({type:"longDateTime"})],et.prototype,"modified",2),st([y("int16")],et.prototype,"xMin",2),st([y("int16")],et.prototype,"yMin",2),st([y("int16")],et.prototype,"xMax",2),st([y("int16")],et.prototype,"yMax",2),st([y("uint16")],et.prototype,"macStyle",2),st([y("uint16")],et.prototype,"lowestRecPPEM",2),st([y("int16")],et.prototype,"fontDirectionHint",2),st([y("int16")],et.prototype,"indexToLocFormat",2),st([y("int16")],et.prototype,"glyphDataFormat",2),et=st([ut("head")],et);var Si=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,wt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ci(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Si(t,e,n),n};let pt=class extends ft{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};wt([y("fixed")],pt.prototype,"version",2),wt([y("int16")],pt.prototype,"ascent",2),wt([y("int16")],pt.prototype,"descent",2),wt([y("int16")],pt.prototype,"lineGap",2),wt([y("uint16")],pt.prototype,"advanceWidthMax",2),wt([y("int16")],pt.prototype,"minLeftSideBearing",2),wt([y("int16")],pt.prototype,"minRightSideBearing",2),wt([y("int16")],pt.prototype,"xMaxExtent",2),wt([y("int16")],pt.prototype,"caretSlopeRise",2),wt([y("int16")],pt.prototype,"caretSlopeRun",2),wt([y("int16")],pt.prototype,"caretOffset",2),wt([y({type:"int16",size:4})],pt.prototype,"reserved",2),wt([y("int16")],pt.prototype,"metricDataFormat",2),wt([y("uint16")],pt.prototype,"numOfLongHorMetrics",2),pt=wt([ut("hhea")],pt);var gn=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,Ti=(s,t,e)=>t in s?gn(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?Pi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&gn(t,e,n),n},Ii=(s,t,e)=>(Ti(s,t+"",e),e);let dr=class extends ft{constructor(){super(...arguments),Ii(this,"_metrics")}static from(s){const t=s.length*4,e=new dr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:s}).map((n,o)=>(o<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};dr=_i([ut("hmtx")],dr);var Di=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,Oi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ai(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Di(t,e,n),n};let yn=class extends ft{};yn=Oi([ut("kern","kern")],yn);var mn=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,zi=(s,t,e)=>t in s?mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ui=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ni(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&mn(t,e,n),n},Li=(s,t,e)=>(zi(s,t+"",e),e);let gr=class extends ft{constructor(){super(...arguments),Li(this,"_locations")}static from(s,t=1){const e=s.length*(t?4:2),r=new gr(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)}};gr=Ui([ut("loca")],gr);var Ei=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,dt=(s,t,e,r)=>{for(var n=r>1?void 0:r?$i(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Ei(t,e,n),n};let ot=class extends ft{constructor(s=new ArrayBuffer(32),t){super(s,t,Math.min(32,s.byteLength-(t??0)))}};dt([y("fixed")],ot.prototype,"version",2),dt([y("uint16")],ot.prototype,"numGlyphs",2),dt([y("uint16")],ot.prototype,"maxPoints",2),dt([y("uint16")],ot.prototype,"maxContours",2),dt([y("uint16")],ot.prototype,"maxComponentPoints",2),dt([y("uint16")],ot.prototype,"maxComponentContours",2),dt([y("uint16")],ot.prototype,"maxZones",2),dt([y("uint16")],ot.prototype,"maxTwilightPoints",2),dt([y("uint16")],ot.prototype,"maxStorage",2),dt([y("uint16")],ot.prototype,"maxFunctionDefs",2),dt([y("uint16")],ot.prototype,"maxInstructionDefs",2),dt([y("uint16")],ot.prototype,"maxStackElements",2),dt([y("uint16")],ot.prototype,"maxSizeOfInstructions",2),dt([y("uint16")],ot.prototype,"maxComponentElements",2),dt([y("uint16")],ot.prototype,"maxComponentDepth",2),ot=dt([ut("maxp")],ot);var wn=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Bi=(s,t,e)=>t in s?wn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fe=(s,t,e,r)=>{for(var n=r>1?void 0:r?ki(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&wn(t,e,n),n},ji=(s,t,e)=>(Bi(s,t+"",e),e);const xn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},yr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Fi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},vn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let ve=class extends ft{constructor(){super(...arguments),ji(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=yr.Macintosh,n=Fi.Default,o=0;t.some(a=>a.platform===yr.Microsoft&&a.encoding===vn.UCS2&&a.language===1033)&&(r=yr.Microsoft,n=vn.UCS2,o=1033);const i={};for(let a=0;a<s;++a){const l=t[a];l.platform===r&&l.encoding===n&&l.language===o&&xn[l.nameId]&&(i[xn[l.nameId]]=o===0?Os(l.name):Ns(l.name))}return i}};Fe([y("uint16")],ve.prototype,"format",2),Fe([y("uint16")],ve.prototype,"count",2),Fe([y("uint16")],ve.prototype,"stringOffset",2),ve=Fe([ut("name")],ve);var Gi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,_=(s,t,e,r)=>{for(var n=r>1?void 0:r?qi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Gi(t,e,n),n};let T=class extends ft{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};_([y("uint16")],T.prototype,"version",2),_([y("int16")],T.prototype,"xAvgCharWidth",2),_([y("uint16")],T.prototype,"usWeightClass",2),_([y("uint16")],T.prototype,"usWidthClass",2),_([y("uint16")],T.prototype,"fsType",2),_([y("uint16")],T.prototype,"ySubscriptXSize",2),_([y("uint16")],T.prototype,"ySubscriptYSize",2),_([y("uint16")],T.prototype,"ySubscriptXOffset",2),_([y("uint16")],T.prototype,"ySubscriptYOffset",2),_([y("uint16")],T.prototype,"ySuperscriptXSize",2),_([y("uint16")],T.prototype,"ySuperscriptYSize",2),_([y("uint16")],T.prototype,"ySuperscriptXOffset",2),_([y("uint16")],T.prototype,"ySuperscriptYOffset",2),_([y("uint16")],T.prototype,"yStrikeoutSize",2),_([y("uint16")],T.prototype,"yStrikeoutPosition",2),_([y("uint16")],T.prototype,"sFamilyClass",2),_([y({type:"uint8"})],T.prototype,"bFamilyType",2),_([y({type:"uint8"})],T.prototype,"bSerifStyle",2),_([y({type:"uint8"})],T.prototype,"bWeight",2),_([y({type:"uint8"})],T.prototype,"bProportion",2),_([y({type:"uint8"})],T.prototype,"bContrast",2),_([y({type:"uint8"})],T.prototype,"bStrokeVariation",2),_([y({type:"uint8"})],T.prototype,"bArmStyle",2),_([y({type:"uint8"})],T.prototype,"bLetterform",2),_([y({type:"uint8"})],T.prototype,"bMidline",2),_([y({type:"uint8"})],T.prototype,"bXHeight",2),_([y({type:"uint8",size:16})],T.prototype,"ulUnicodeRange",2),_([y({type:"char",size:4})],T.prototype,"achVendID",2),_([y("uint16")],T.prototype,"fsSelection",2),_([y("uint16")],T.prototype,"usFirstCharIndex",2),_([y("uint16")],T.prototype,"usLastCharIndex",2),_([y("int16")],T.prototype,"sTypoAscender",2),_([y("int16")],T.prototype,"sTypoDescender",2),_([y("int16")],T.prototype,"sTypoLineGap",2),_([y("uint16")],T.prototype,"usWinAscent",2),_([y("uint16")],T.prototype,"usWinDescent",2),_([y({offset:72,type:"uint8",size:8})],T.prototype,"ulCodePageRange",2),_([y({offset:72,type:"int16"})],T.prototype,"sxHeight",2),_([y("int16")],T.prototype,"sCapHeight",2),_([y("uint16")],T.prototype,"usDefaultChar",2),_([y("uint16")],T.prototype,"usBreakChar",2),_([y("uint16")],T.prototype,"usMaxContext",2),T=_([ut("OS/2","os2")],T);var Ri=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,zt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Wi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Ri(t,e,n),n};let Dt=class extends ft{constructor(s=new ArrayBuffer(32),t,e){super(s,t,e)}};zt([y("fixed")],Dt.prototype,"format",2),zt([y("fixed")],Dt.prototype,"italicAngle",2),zt([y("int16")],Dt.prototype,"underlinePosition",2),zt([y("int16")],Dt.prototype,"underlineThickness",2),zt([y("uint32")],Dt.prototype,"isFixedPitch",2),zt([y("uint32")],Dt.prototype,"minMemType42",2),zt([y("uint32")],Dt.prototype,"maxMemType42",2),zt([y("uint32")],Dt.prototype,"minMemType1",2),zt([y("uint32")],Dt.prototype,"maxMemType1",2),Dt=zt([ut("post")],Dt);var Vi=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,xt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Qi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Vi(t,e,n),n};let gt=class extends ft{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};xt([y("fixed")],gt.prototype,"version",2),xt([y("int16")],gt.prototype,"vertTypoAscender",2),xt([y("int16")],gt.prototype,"vertTypoDescender",2),xt([y("int16")],gt.prototype,"vertTypoLineGap",2),xt([y("int16")],gt.prototype,"advanceHeightMax",2),xt([y("int16")],gt.prototype,"minTopSideBearing",2),xt([y("int16")],gt.prototype,"minBottomSideBearing",2),xt([y("int16")],gt.prototype,"yMaxExtent",2),xt([y("int16")],gt.prototype,"caretSlopeRise",2),xt([y("int16")],gt.prototype,"caretSlopeRun",2),xt([y("int16")],gt.prototype,"caretOffset",2),xt([y({type:"int16",size:4})],gt.prototype,"reserved",2),xt([y("int16")],gt.prototype,"metricDataFormat",2),xt([y("int16")],gt.prototype,"numOfLongVerMetrics",2),gt=xt([ut("vhea")],gt);var bn=Object.defineProperty,Xi=Object.getOwnPropertyDescriptor,Yi=(s,t,e)=>t in s?bn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Hi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Xi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&bn(t,e,n),n},Zi=(s,t,e)=>(Yi(s,t+"",e),e);let mr=class extends ft{constructor(){super(...arguments),Zi(this,"_metrics")}static from(s){const t=s.length*4,e=new mr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var n;const s=this._sfnt.maxp.numGlyphs,t=((n=this._sfnt.vhea)==null?void 0:n.numOfLongVerMetrics)??0,e=this.view;e.seek(0);let r=0;return Array.from({length:s}).map((o,i)=>(i<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};mr=Hi([ut("vmtx")],mr);var Mn=Object.defineProperty,Ki=(s,t,e)=>t in s?Mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,be=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Mn(t,e,n),n},Ge=(s,t,e)=>(Ki(s,typeof t!="symbol"?t+"":t,e),e);class At extends ir{constructor(){super(...arguments),Ge(this,"format","TrueType"),Ge(this,"mimeType","font/ttf"),Ge(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(te(t).getUint32(0))}static checksum(t){const e=te(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let o=0,i=r/4;o<i;o+=4)o*4<r-4&&(n+=e.getUint32(o*4,!1));return n&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((u,f)=>u+e(f.byteLength),0),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const i=Math.log(2);o.searchRange=Math.floor(Math.log(r)/i)*16,o.entrySelector=Math.floor(o.searchRange/i),o.rangeShift=r*16-o.searchRange;let a=12+r*16,l=0;const h=o.getDirectories();t.tableViews.forEach((u,f)=>{const g=h[l++];g.tag=f,g.checkSum=this.checksum(u),g.offset=a,g.length=u.byteLength,o.view.writeBytes(u,a),a+=e(g.length)});const c=o.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new pe(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new $e(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Ge(At,"signature",new Set([65536,1953658213,1954115633])),be([y("uint32")],At.prototype,"scalerType"),be([y("uint16")],At.prototype,"numTables"),be([y("uint16")],At.prototype,"searchRange"),be([y("uint16")],At.prototype,"entrySelector"),be([y("uint16")],At.prototype,"rangeShift");var Ji=Object.defineProperty,to=(s,t,e)=>t in s?Ji(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,wr=(s,t,e)=>(to(s,typeof t!="symbol"?t+"":t,e),e);class qe extends At{constructor(){super(...arguments),wr(this,"format","OpenType"),wr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}wr(qe,"signature",new Set([1330926671]));var eo=Object.defineProperty,Me=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&eo(t,e,n),n};class se extends Pt{constructor(t,e){super(t,e,20)}}Me([y({type:"char",size:4})],se.prototype,"tag"),Me([y("uint32")],se.prototype,"offset"),Me([y("uint32")],se.prototype,"compLength"),Me([y("uint32")],se.prototype,"origLength"),Me([y("uint32")],se.prototype,"origChecksum");var Sn=Object.defineProperty,ro=(s,t,e)=>t in s?Sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ct=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Sn(t,e,n),n},Re=(s,t,e)=>(ro(s,typeof t!="symbol"?t+"":t,e),e);const vt=class Or extends ir{constructor(){super(...arguments),Re(this,"format","WOFF"),Re(this,"mimeType","font/woff"),Re(this,"_sfnt")}get subfontFormat(){return At.is(this.flavor)?"TrueType":qe.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(te(t).getUint32(0))}static checkSum(t){const e=te(t),r=e.byteLength,n=Math.floor(r/4);let o=0,i=0;for(;i<n;)o+=e.getUint32(4*i++,!1);let a=r-n*4;if(a){let l=n*4;for(;a>0;)o+=e.getUint8(l)<<a*8,l++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,f)=>{const g=te(xs(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:f,view:g.byteLength<u.byteLength?g:u,rawView:u})});const o=n.length,i=n.reduce((u,f)=>u+r(f.view.byteLength),0),a=new Or(new ArrayBuffer(44+20*o+i+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((u,f)=>u+r(f.rawView.byteLength),0);let l=44+o*20,h=0;const c=a.getDirectories();return n.forEach(u=>{const f=c[h++];f.tag=u.tag,f.offset=l,f.compLength=u.view.byteLength,f.origChecksum=Or.checkSum(u.rawView),f.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(f.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new se(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new $e(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,i=e.origLength,a=n+o;return t[r]=o>=i?new DataView(this.view.buffer,n,o):new DataView(vs(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Re(vt,"signature",new Set([2001684038])),Ct([y("uint32")],vt.prototype,"signature"),Ct([y("uint32")],vt.prototype,"flavor"),Ct([y("uint32")],vt.prototype,"length"),Ct([y("uint16")],vt.prototype,"numTables"),Ct([y("uint16")],vt.prototype,"reserved"),Ct([y("uint32")],vt.prototype,"totalSfntSize"),Ct([y("uint16")],vt.prototype,"majorVersion"),Ct([y("uint16")],vt.prototype,"minorVersion"),Ct([y("uint32")],vt.prototype,"metaOffset"),Ct([y("uint32")],vt.prototype,"metaLength"),Ct([y("uint32")],vt.prototype,"metaOrigLength"),Ct([y("uint32")],vt.prototype,"privOffset"),Ct([y("uint32")],vt.prototype,"privLength");let xr=vt;function no(s,t=!0){if(At.is(s))return new At(s);if(qe.is(s))return new qe(s);if(xr.is(s))return new xr(s);if(t)throw new Error("Failed to parseFont")}var so=Object.defineProperty,io=(s,t,e)=>t in s?so(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Se=(s,t,e)=>(io(s,typeof t!="symbol"?t+"":t,e),e);const Cn=class is{constructor(){Se(this,"fallbackFont"),Se(this,"loading",new Map),Se(this,"loaded",new Map),Se(this,"familyToUrl",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...is.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
1
+ (function(U,ot){typeof exports=="object"&&typeof module<"u"?ot(exports):typeof define=="function"&&define.amd?define(["exports"],ot):(U=typeof globalThis<"u"?globalThis:U||self,ot(U.modernText={}))})(this,function(U){"use strict";var da=Object.defineProperty;var ga=(U,ot,Ot)=>ot in U?da(U,ot,{enumerable:!0,configurable:!0,writable:!0,value:Ot}):U[ot]=Ot;var O=(U,ot,Ot)=>ga(U,typeof ot!="symbol"?ot+"":ot,Ot);function ot(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:i,stops:a}=os(t,e.left,e.top,e.width,e.height),l=s.createLinearGradient(r,n,o,i);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function Ot(s,t,e){s!=null&&s.color&&(s.color=ot(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=ot(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=ot(e,s.textStrokeColor,t))}function os(s,t,e,r,n){var g;const o=((g=s.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",i=o.split(",")[0],a=i.includes("deg")?i:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),f=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+f,x1:t+r/2+u,y1:e+n/2-f,stops:Array.from(l).map(d=>{let m=d[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(d[3].replace("%",""))/100,color:m}})}}function Jt(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const o=e.style,i={...o,fill:s.color??o.fill,stroke:s.textStrokeColor??o.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,i),t.restore()}function Nr(s,t,e){const{left:r,top:n,width:o,height:i}=e,a=s.canvas;a.dataset.viewBox=`${r} ${n} ${o} ${i}`,a.dataset.pixelRatio=String(t);const l=o,h=i;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(h*t)),a.style.width=`${l}px`,a.style.height=`${h}px`,s.clearRect(0,0,a.width,a.height),s.scale(t,t),s.translate(-r,-n)}function zr(s,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;Ot(r,n,s),e.forEach(o=>{Ot(o.computedStyle,o.lineBox,s),o.fragments.forEach(i=>{Ot(i.computedStyle,i.inlineBox,s)})})}var at=Uint8Array,St=Uint16Array,He=Int32Array,_e=new at([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ie=new at([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ze=new at([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ur=function(s,t){for(var e=new St(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new He(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)n[o]=o-e[r]<<5|r;return{b:e,r:n}},Lr=Ur(_e,2),Er=Lr.b,Ke=Lr.r;Er[28]=258,Ke[258]=28;for(var $r=Ur(Ie,0),as=$r.b,kr=$r.r,Je=new St(32768),G=0;G<32768;++G){var Ft=(G&43690)>>1|(G&21845)<<1;Ft=(Ft&52428)>>2|(Ft&13107)<<2,Ft=(Ft&61680)>>4|(Ft&3855)<<4,Je[G]=((Ft&65280)>>8|(Ft&255)<<8)>>1}for(var Nt=function(s,t,e){for(var r=s.length,n=0,o=new St(t);n<r;++n)s[n]&&++o[s[n]-1];var i=new St(t);for(n=1;n<t;++n)i[n]=i[n-1]+o[n-1]<<1;var a;if(e){a=new St(1<<t);var l=15-t;for(n=0;n<r;++n)if(s[n])for(var h=n<<4|s[n],c=t-s[n],u=i[s[n]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[Je[u]>>l]=h}else for(a=new St(r),n=0;n<r;++n)s[n]&&(a[n]=Je[i[s[n]-1]++]>>15-s[n]);return a},Gt=new at(288),G=0;G<144;++G)Gt[G]=8;for(var G=144;G<256;++G)Gt[G]=9;for(var G=256;G<280;++G)Gt[G]=7;for(var G=280;G<288;++G)Gt[G]=8;for(var he=new at(32),G=0;G<32;++G)he[G]=5;var ls=Nt(Gt,9,0),hs=Nt(Gt,9,1),cs=Nt(he,5,0),us=Nt(he,5,1),tr=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},_t=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},er=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},rr=function(s){return(s+7)/8|0},Br=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new at(s.subarray(t,e))},fs=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],It=function(s,t,e){var r=new Error(t||fs[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,It),!e)throw r;return r},ps=function(s,t,e,r){var n=s.length,o=0;if(!n||t.f&&!t.l)return e||new at(0);var i=!e,a=i||t.i!=2,l=t.i;i&&(e=new at(n*3));var h=function(Et){var $t=e.length;if(Et>$t){var jt=new at(Math.max($t*2,Et));jt.set(e),e=jt}},c=t.f||0,u=t.p||0,f=t.b||0,g=t.l,d=t.d,m=t.m,p=t.n,b=n*8;do{if(!g){c=_t(s,u,1);var M=_t(s,u+1,3);if(u+=3,M)if(M==1)g=hs,d=us,m=9,p=5;else if(M==2){var x=_t(s,u,31)+257,A=_t(s,u+10,15)+4,C=x+_t(s,u+5,31)+1;u+=14;for(var P=new at(C),E=new at(19),V=0;V<A;++V)E[Ze[V]]=_t(s,u+V*3,7);u+=A*3;for(var B=tr(E),Mt=(1<<B)-1,N=Nt(E,B,1),V=0;V<C;){var D=N[_t(s,u,Mt)];u+=D&15;var S=D>>4;if(S<16)P[V++]=S;else{var j=0,k=0;for(S==16?(k=3+_t(s,u,3),u+=2,j=P[V-1]):S==17?(k=3+_t(s,u,7),u+=3):S==18&&(k=11+_t(s,u,127),u+=7);k--;)P[V++]=j}}var et=P.subarray(0,x),Q=P.subarray(x);m=tr(et),p=tr(Q),g=Nt(et,m,1),d=Nt(Q,p,1)}else It(1);else{var S=rr(u)+4,I=s[S-4]|s[S-3]<<8,w=S+I;if(w>n){l&&It(0);break}a&&h(f+I),e.set(s.subarray(S,w),f),t.b=f+=I,t.p=u=w*8,t.f=c;continue}if(u>b){l&&It(0);break}}a&&h(f+131072);for(var Tt=(1<<m)-1,q=(1<<p)-1,J=u;;J=u){var j=g[er(s,u)&Tt],F=j>>4;if(u+=j&15,u>b){l&&It(0);break}if(j||It(2),F<256)e[f++]=F;else if(F==256){J=u,g=null;break}else{var R=F-254;if(F>264){var V=F-257,z=_e[V];R=_t(s,u,(1<<z)-1)+Er[V],u+=z}var H=d[er(s,u)&q],X=H>>4;H||It(3),u+=H&15;var Q=as[X];if(X>3){var z=Ie[X];Q+=er(s,u)&(1<<z)-1,u+=z}if(u>b){l&&It(0);break}a&&h(f+131072);var rt=f+R;if(f<Q){var Zt=o-Q,Kt=Math.min(Q,rt);for(Zt+f<0&&It(3);f<Kt;++f)e[f]=r[Zt+f]}for(;f<rt;++f)e[f]=e[f-Q]}}t.l=g,t.p=J,t.b=f,t.f=c,g&&(c=1,t.m=m,t.d=d,t.n=p)}while(!c);return f!=e.length&&i?Br(e,0,f):e.subarray(0,f)},Bt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ce=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},nr=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,o=e.slice();if(!n)return{t:qr,l:0};if(n==1){var i=new at(e[0].s+1);return i[e[0].s]=1,{t:i,l:1}}e.sort(function(w,x){return w.f-x.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,c=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=e[e[h].f<e[u].f?h++:u++],l=e[h!=c&&e[h].f<e[u].f?h++:u++],e[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=o[0].s,r=1;r<n;++r)o[r].s>f&&(f=o[r].s);var g=new St(f+1),d=sr(e[c-1],g,0);if(d>t){var r=0,m=0,p=d-t,b=1<<p;for(o.sort(function(x,A){return g[A.s]-g[x.s]||x.f-A.f});r<n;++r){var M=o[r].s;if(g[M]>t)m+=b-(1<<d-g[M]),g[M]=t;else break}for(m>>=p;m>0;){var S=o[r].s;g[S]<t?m-=1<<t-g[S]++-1:++r}for(;r>=0&&m;--r){var I=o[r].s;g[I]==t&&(--g[I],++m)}d=t}return{t:new at(g),l:d}},sr=function(s,t,e){return s.s==-1?Math.max(sr(s.l,t,e+1),sr(s.r,t,e+1)):t[s.s]=e},jr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new St(++t),r=0,n=s[0],o=1,i=function(l){e[r++]=l},a=1;a<=t;++a)if(s[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(n),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(n);o=1,n=s[a]}return{c:e.subarray(0,r),n:t}},ue=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Fr=function(s,t,e){var r=e.length,n=rr(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var o=0;o<r;++o)s[n+o+4]=e[o];return(n+4+r)*8},Gr=function(s,t,e,r,n,o,i,a,l,h,c){Bt(t,c++,e),++n[256];for(var u=nr(n,15),f=u.t,g=u.l,d=nr(o,15),m=d.t,p=d.l,b=jr(f),M=b.c,S=b.n,I=jr(m),w=I.c,x=I.n,A=new St(19),C=0;C<M.length;++C)++A[M[C]&31];for(var C=0;C<w.length;++C)++A[w[C]&31];for(var P=nr(A,7),E=P.t,V=P.l,B=19;B>4&&!E[Ze[B-1]];--B);var Mt=h+5<<3,N=ue(n,Gt)+ue(o,he)+i,D=ue(n,f)+ue(o,m)+i+14+3*B+ue(A,E)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&Mt<=N&&Mt<=D)return Fr(t,c,s.subarray(l,l+h));var j,k,et,Q;if(Bt(t,c,1+(D<N)),c+=2,D<N){j=Nt(f,g,0),k=f,et=Nt(m,p,0),Q=m;var Tt=Nt(E,V,0);Bt(t,c,S-257),Bt(t,c+5,x-1),Bt(t,c+10,B-4),c+=14;for(var C=0;C<B;++C)Bt(t,c+3*C,E[Ze[C]]);c+=3*B;for(var q=[M,w],J=0;J<2;++J)for(var F=q[J],C=0;C<F.length;++C){var R=F[C]&31;Bt(t,c,Tt[R]),c+=E[R],R>15&&(Bt(t,c,F[C]>>5&127),c+=F[C]>>12)}}else j=ls,k=Gt,et=cs,Q=he;for(var C=0;C<a;++C){var z=r[C];if(z>255){var R=z>>18&31;ce(t,c,j[R+257]),c+=k[R+257],R>7&&(Bt(t,c,z>>23&31),c+=_e[R]);var H=z&31;ce(t,c,et[H]),c+=Q[H],H>3&&(ce(t,c,z>>5&8191),c+=Ie[H])}else ce(t,c,j[z]),c+=k[z]}return ce(t,c,j[256]),c+k[256]},ds=new He([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qr=new at(0),gs=function(s,t,e,r,n,o){var i=o.z||s.length,a=new at(r+i+5*(1+Math.ceil(i/7e3))+n),l=a.subarray(r,a.length-n),h=o.l,c=(o.r||0)&7;if(t){c&&(l[0]=o.r>>3);for(var u=ds[t-1],f=u>>13,g=u&8191,d=(1<<e)-1,m=o.p||new St(32768),p=o.h||new St(d+1),b=Math.ceil(e/3),M=2*b,S=function(le){return(s[le]^s[le+1]<<b^s[le+2]<<M)&d},I=new He(25e3),w=new St(288),x=new St(32),A=0,C=0,P=o.i||0,E=0,V=o.w||0,B=0;P+2<i;++P){var Mt=S(P),N=P&32767,D=p[Mt];if(m[N]=D,p[Mt]=N,V<=P){var j=i-P;if((A>7e3||E>24576)&&(j>423||!h)){c=Gr(s,l,0,I,w,x,C,E,B,P-B,c),E=A=C=0,B=P;for(var k=0;k<286;++k)w[k]=0;for(var k=0;k<30;++k)x[k]=0}var et=2,Q=0,Tt=g,q=N-D&32767;if(j>2&&Mt==S(P-q))for(var J=Math.min(f,j)-1,F=Math.min(32767,P),R=Math.min(258,j);q<=F&&--Tt&&N!=D;){if(s[P+et]==s[P+et-q]){for(var z=0;z<R&&s[P+z]==s[P+z-q];++z);if(z>et){if(et=z,Q=q,z>J)break;for(var H=Math.min(q,z-2),X=0,k=0;k<H;++k){var rt=P-q+k&32767,Zt=m[rt],Kt=rt-Zt&32767;Kt>X&&(X=Kt,D=rt)}}}N=D,D=m[N],q+=N-D&32767}if(Q){I[E++]=268435456|Ke[et]<<18|kr[Q];var Et=Ke[et]&31,$t=kr[Q]&31;C+=_e[Et]+Ie[$t],++w[257+Et],++x[$t],V=P+et,++A}else I[E++]=s[P],++w[s[P]]}}for(P=Math.max(P,V);P<i;++P)I[E++]=s[P],++w[s[P]];c=Gr(s,l,h,I,w,x,C,E,B,P-B,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=p,o.p=m,o.i=P,o.w=V)}else{for(var P=o.w||0;P<i+h;P+=65535){var jt=P+65535;jt>=i&&(l[c/8|0]=h,jt=i),c=Fr(l,c+1,s.subarray(P,jt))}o.i=i}return Br(a,0,r+rr(c)+n)},Rr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,o=e.length|0,i=0;i!=o;){for(var a=Math.min(i+2655,o);i<a;++i)n+=r+=e[i];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},ys=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),i=new at(o.length+s.length);i.set(o),i.set(s,o.length),s=i,n.w=o.length}return gs(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)},Wr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},ms=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Rr();n.p(t.dictionary),Wr(s,2,n.d())}},ws=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&It(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&It(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function xs(s,t){t||(t={});var e=Rr();e.p(s);var r=ys(s,t,t.dictionary?6:2,4);return ms(r,t),Wr(r,r.length-4,e.d()),r}function vs(s,t){return ps(s.subarray(ws(s,t),-4),{i:2},t,t)}var bs=typeof TextDecoder<"u"&&new TextDecoder,Ms=0;try{bs.decode(qr,{stream:!0}),Ms=1}catch{}const Ss="modern-font";function fe(s,t){if(!s)throw new Error(`[${Ss}] ${t}`)}function Cs(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function te(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Vr=Object.defineProperty,Ps=(s,t,e)=>t in s?Vr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,lt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Vr(t,e,n),n},Ts=(s,t,e)=>(Ps(s,t+"",e),e);const De={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ht(){return function(s,t){Object.defineProperty(s.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class st extends DataView{constructor(t,e,r,n){super(Cs(t),e,r),this.littleEndian=n,Ts(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,i=>i.toUpperCase())}`,o=this[n](e,r);return this.cursor+=De[t],o}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let o=0,i=r.length;o<i;o++)n+=String.fromCharCode(r[o]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const o=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,i=this[o](r,e,n);return this.cursor+=De[t.toLowerCase()],i}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,i;n<o;++n)i=t.charCodeAt(n)||0,i>127?this.writeUint16(i):this.writeUint8(i);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=te(t);r=n.byteLength;for(let o=0;o<r;++o)this.setUint8(e+o,n.getUint8(o))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}lt([ht()],st.prototype,"readInt8"),lt([ht()],st.prototype,"readInt16"),lt([ht()],st.prototype,"readInt32"),lt([ht()],st.prototype,"readUint8"),lt([ht()],st.prototype,"readUint16"),lt([ht()],st.prototype,"readUint32"),lt([ht()],st.prototype,"readFloat32"),lt([ht()],st.prototype,"readFloat64"),lt([ht()],st.prototype,"writeInt8"),lt([ht()],st.prototype,"writeInt16"),lt([ht()],st.prototype,"writeInt32"),lt([ht()],st.prototype,"writeUint8"),lt([ht()],st.prototype,"writeUint16"),lt([ht()],st.prototype,"writeUint32"),lt([ht()],st.prototype,"writeFloat32"),lt([ht()],st.prototype,"writeFloat64");var _s=Object.defineProperty,Is=(s,t,e)=>t in s?_s(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ds=(s,t,e)=>(Is(s,t+"",e),e);const Qr=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let i=Qr.get(n);i||(i={columns:[],byteLength:0},Qr.set(n,i));const a={...t,name:o,byteLength:e*De[r],offset:t.offset??i.columns.reduce((l,h)=>l+h.byteLength,0)};i.columns.push(a),i.byteLength=i.columns.reduce((l,h)=>l+De[h.type]*(h.size??1),0),Object.defineProperty(n.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Pt{constructor(t,e,r,n){Ds(this,"view"),this.view=new st(t,e,r,n)}}function As(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Ae(s){s=As(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 Os(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 Ns(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}class ir extends Pt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var Xr=Object.defineProperty,zs=(s,t,e)=>t in s?Xr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,gt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Xr(t,e,n),n},Yr=(s,t,e)=>(zs(s,typeof t!="symbol"?t+"":t,e),e);const yt=class es extends ir{constructor(){super(...arguments),Yr(this,"format","EmbeddedOpenType"),Yr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=Ae(n.fontFamily||""),i=o.length,a=Ae(n.fontStyle||""),l=a.length,h=Ae(n.version||""),c=h.length,u=Ae(n.fullName||""),f=u.length,g=86+i+4+l+4+c+4+f+2+t.view.byteLength,d=new es(new ArrayBuffer(g),0,g,!0);d.EOTSize=d.view.byteLength,d.FontDataSize=t.view.byteLength,d.Version=131073,d.Flags=0,d.Charset=1,d.MagicNumber=20556,d.Padding1=0,d.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(d.FontPANOSE=m.fontPANOSE,d.Italic=m.fsSelection,d.Weight=m.usWeightClass,d.fsType=m.fsType,d.UnicodeRange=m.ulUnicodeRange,d.CodePageRange=m.ulCodePageRange),d.view.writeUint16(i),d.view.writeBytes(o),d.view.writeUint16(0),d.view.writeUint16(l),d.view.writeBytes(a),d.view.writeUint16(0),d.view.writeUint16(c),d.view.writeBytes(h),d.view.writeUint16(0),d.view.writeUint16(f),d.view.writeBytes(u),d.view.writeUint16(0),d.view.writeUint16(0),d.view.writeBytes(t.view),d}};gt([y("uint32")],yt.prototype,"EOTSize"),gt([y("uint32")],yt.prototype,"FontDataSize"),gt([y("uint32")],yt.prototype,"Version"),gt([y("uint32")],yt.prototype,"Flags"),gt([y({type:"uint8",size:10})],yt.prototype,"FontPANOSE"),gt([y("uint8")],yt.prototype,"Charset"),gt([y("uint8")],yt.prototype,"Italic"),gt([y("uint32")],yt.prototype,"Weight"),gt([y("uint16")],yt.prototype,"fsType"),gt([y("uint16")],yt.prototype,"MagicNumber"),gt([y({type:"uint8",size:16})],yt.prototype,"UnicodeRange"),gt([y({type:"uint8",size:8})],yt.prototype,"CodePageRange"),gt([y("uint32")],yt.prototype,"CheckSumAdjustment"),gt([y({type:"uint8",size:16})],yt.prototype,"Reserved"),gt([y("uint16")],yt.prototype,"Padding1");var Us=Object.defineProperty,Oe=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Us(t,e,n),n};class pe extends Pt{constructor(t,e){super(t,e,16)}}Oe([y({type:"char",size:4})],pe.prototype,"tag"),Oe([y("uint32")],pe.prototype,"checkSum"),Oe([y("uint32")],pe.prototype,"offset"),Oe([y("uint32")],pe.prototype,"length");const or=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Es=Object.defineProperty,$s=(s,t,e)=>t in s?Es(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,de=(s,t,e)=>($s(s,typeof t!="symbol"?t+"":t,e),e);class Hr{constructor(t){de(this,"index"),de(this,"name"),de(this,"isComposite",!1),de(this,"components",[]),de(this,"pathCommands",[]);const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},o){const i=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=i,yScale:l=i}=n,h=this.pathCommands,c=[];for(let u=0,f=h.length;u<f;u+=1){const g=h[u];g.type==="M"?c.push({type:"M",x:t+g.x*a,y:e+-g.y*l}):g.type==="L"?c.push({type:"L",x:t+g.x*a,y:e+-g.y*l}):g.type==="Q"?c.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="C"?c.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*l,x2:t+g.x2*a,y2:e+-g.y2*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="Z"&&c.push({type:"Z"})}return c}}class ks extends Hr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:i,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,f,g,d;const m=[],p=[];let b=0,M=!1,S=!1,I=i,w=0,x=0;function A(N,D){m.push({type:"L",x:N,y:D})}function C(N,D,j,k,et,Q){m.push({type:"C",x1:N,y1:D,x2:j,y2:k,x:et,y:Q})}function P(N,D){S&&h!==2&&E(),S=!0,m.push({type:"M",x:N,y:D})}function E(){m.push({type:"Z"})}function V(N){m.push(...N)}function B(){p.length%2!==0&&!M&&(I=p.shift()+o),b+=p.length>>1,p.length=0,M=!0}function Mt(N){let D,j,k,et,Q,Tt,q,J,F,R,z,H,X=0;for(;X<N.length;){let rt=N[X++];switch(rt){case 1:B();break;case 3:B();break;case 4:p.length>1&&!M&&(I=p.shift()+o,M=!0),x+=p.pop(),P(w,x);break;case 5:for(;p.length>0;)w+=p.shift(),x+=p.shift(),A(w,x);break;case 6:for(;p.length>0&&(w+=p.shift(),A(w,x),p.length!==0);)x+=p.shift(),A(w,x);break;case 7:for(;p.length>0&&(x+=p.shift(),A(w,x),p.length!==0);)w+=p.shift(),A(w,x);break;case 8:for(;p.length>0;)u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+p.shift(),C(u,f,g,d,w,x);break;case 10:Q=p.pop()+l,Tt=t.subrs[Q],Tt&&Mt(Tt);break;case 11:return;case 12:switch(rt=N[X],X+=1,rt){case 35:u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),q=g+p.shift(),J=d+p.shift(),F=q+p.shift(),R=J+p.shift(),z=F+p.shift(),H=R+p.shift(),w=z+p.shift(),x=H+p.shift(),p.shift(),C(u,f,g,d,q,J),C(F,R,z,H,w,x);break;case 34:u=w+p.shift(),f=x,g=u+p.shift(),d=f+p.shift(),q=g+p.shift(),J=d,F=q+p.shift(),R=d,z=F+p.shift(),H=x,w=z+p.shift(),C(u,f,g,d,q,J),C(F,R,z,H,w,x);break;case 36:u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),q=g+p.shift(),J=d,F=q+p.shift(),R=d,z=F+p.shift(),H=R+p.shift(),w=z+p.shift(),C(u,f,g,d,q,J),C(F,R,z,H,w,x);break;case 37:u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),q=g+p.shift(),J=d+p.shift(),F=q+p.shift(),R=J+p.shift(),z=F+p.shift(),H=R+p.shift(),Math.abs(z-w)>Math.abs(H-x)?w=z+p.shift():x=H+p.shift(),C(u,f,g,d,q,J),C(F,R,z,H,w,x);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+rt}`),p.length=0}break;case 14:if(p.length>=4){const Zt=or[p.pop()],Kt=or[p.pop()],Et=p.pop(),$t=p.pop();if(Zt&&Kt){n.isComposite=!0,n.components=[];const jt=t.charset.indexOf(Zt),le=t.charset.indexOf(Kt);n.components.push({glyphIndex:le,dx:0,dy:0}),n.components.push({glyphIndex:jt,dx:$t,dy:Et}),V(r.get(le).pathCommands);const Dr=JSON.parse(JSON.stringify(r.get(jt).pathCommands));for(let Ar=0;Ar<Dr.length;Ar+=1){const kt=Dr[Ar];kt.type!=="Z"&&(kt.x+=$t,kt.y+=Et),(kt.type==="Q"||kt.type==="C")&&(kt.x1+=$t,kt.y1+=Et),kt.type==="C"&&(kt.x2+=$t,kt.y2+=Et)}V(Dr)}}else p.length>0&&!M&&(I=p.shift()+o,M=!0);S&&h!==2&&(E(),S=!1);break;case 18:B();break;case 19:case 20:B(),X+=b+7>>3;break;case 21:p.length>2&&!M&&(I=p.shift()+o,M=!0),x+=p.pop(),w+=p.pop(),P(w,x);break;case 22:p.length>1&&!M&&(I=p.shift()+o,M=!0),w+=p.pop(),P(w,x);break;case 23:B();break;case 24:for(;p.length>2;)u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+p.shift(),C(u,f,g,d,w,x);w+=p.shift(),x+=p.shift(),A(w,x);break;case 25:for(;p.length>6;)w+=p.shift(),x+=p.shift(),A(w,x);u=w+p.shift(),f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+p.shift(),C(u,f,g,d,w,x);break;case 26:for(p.length%2&&(w+=p.shift());p.length>0;)u=w,f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g,x=d+p.shift(),C(u,f,g,d,w,x);break;case 27:for(p.length%2&&(x+=p.shift());p.length>0;)u=w+p.shift(),f=x,g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d,C(u,f,g,d,w,x);break;case 28:D=N[X],j=N[X+1],p.push((D<<24|j<<16)>>16),X+=2;break;case 29:Q=p.pop()+a,Tt=t.gsubrs[Q],Tt&&Mt(Tt);break;case 30:for(;p.length>0&&(u=w,f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+(p.length===1?p.shift():0),C(u,f,g,d,w,x),p.length!==0);)u=w+p.shift(),f=x,g=u+p.shift(),d=f+p.shift(),x=d+p.shift(),w=g+(p.length===1?p.shift():0),C(u,f,g,d,w,x);break;case 31:for(;p.length>0&&(u=w+p.shift(),f=x,g=u+p.shift(),d=f+p.shift(),x=d+p.shift(),w=g+(p.length===1?p.shift():0),C(u,f,g,d,w,x),p.length!==0);)u=w,f=x+p.shift(),g=u+p.shift(),d=f+p.shift(),w=g+p.shift(),x=d+(p.length===1?p.shift():0),C(u,f,g,d,w,x);break;default:rt<32?console.warn(`Glyph ${c}: unknown operator ${rt}`):rt<247?p.push(rt-139):rt<251?(D=N[X],X+=1,p.push((rt-247)*256+D+108)):rt<255?(D=N[X],X+=1,p.push(-(rt-251)*256-D-108)):(D=N[X],j=N[X+1],k=N[X+2],et=N[X+3],X+=4,p.push((D<<24|j<<16|k<<8|et)/65536))}}}Mt(e),this.pathCommands=m,M&&(this.advanceWidth=I)}}var Bs=Object.defineProperty,js=(s,t,e)=>t in s?Bs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fs=(s,t,e)=>(js(s,t+"",e),e);class Zr{constructor(t){this._sfnt=t,Fs(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??(r.unicode=o[0]),r.unicodes??(r.unicodes=o)),this._items[t]=r}return r}}class Gs extends Zr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new ks({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Kr=Object.defineProperty,qs=(s,t,e)=>t in s?Kr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Jr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Kr(t,e,n),n},Ne=(s,t,e)=>(qs(s,typeof t!="symbol"?t+"":t,e),e);class ze extends Pt{constructor(t,e,r,n){super(t,e,r,n),Ne(this,"_offsets"),Ne(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let o=0,i=e+1;o<i;o++){const a=this.view;let l=0;for(let h=0;h<r;h++)l<<=8,l+=a.readUint8();n.push(l)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],i=r+e[t+1]-n;return this._isString?this.view.readString(n,i):this.view.readBytes(n,i)}}Jr([y("uint16")],ze.prototype,"count"),Jr([y("uint8")],ze.prototype,"offsetSize");class Ue extends ze{constructor(){super(...arguments),Ne(this,"_isString",!1)}}class tn extends ze{constructor(){super(...arguments),Ne(this,"_isString",!0)}}const Rs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","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"],Ws=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Vs=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Qs=[".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?Rs[t]:s[t-391]}var Xs=Object.defineProperty,Ys=(s,t,e)=>t in s?Xs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,en=(s,t,e)=>(Ys(s,typeof t!="symbol"?t+"":t,e),e);function W(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(i){this._setProp(o,i)},configurable:!0,enumerable:!0})}}class rn extends Pt{constructor(){super(...arguments),en(this,"_dict"),en(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),i=o>>4,a=o&15;if(i===r||(e+=n[i],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,i;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),o=e.readUint8(),i=e.readUint8(),r<<24|n<<16|o<<8|i;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),n[o]=e,e=[]):e.push(this._readOperand(o))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Le(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Hs=Object.defineProperty,ar=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Hs(t,e,n),n};class Ee extends rn{}ar([W(19)],Ee.prototype,"subrs"),ar([W(20)],Ee.prototype,"defaultWidthX"),ar([W(21)],Ee.prototype,"nominalWidthX");var Zs=Object.defineProperty,Z=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Zs(t,e,n),n};class Y extends rn{}Z([W(0,"string")],Y.prototype,"version"),Z([W(1,"string")],Y.prototype,"notice"),Z([W(1200,"string")],Y.prototype,"copyright"),Z([W(2,"string")],Y.prototype,"fullName"),Z([W(3,"string")],Y.prototype,"familyName"),Z([W(4,"string")],Y.prototype,"weight"),Z([W(1201)],Y.prototype,"isFixedPitch"),Z([W(1202)],Y.prototype,"italicAngle"),Z([W(1203,"number",-100)],Y.prototype,"underlinePosition"),Z([W(1204,"number",50)],Y.prototype,"underlineThickness"),Z([W(1205)],Y.prototype,"paintType"),Z([W(1206,"number",2)],Y.prototype,"charstringType"),Z([W(1207,"number[]",[.001,0,0,.001,0,0])],Y.prototype,"fontMatrix"),Z([W(13)],Y.prototype,"uniqueId"),Z([W(5,"number[]",[0,0,0,0])],Y.prototype,"fontBBox"),Z([W(1208)],Y.prototype,"strokeWidth"),Z([W(14)],Y.prototype,"xuid"),Z([W(15)],Y.prototype,"charset"),Z([W(16)],Y.prototype,"encoding"),Z([W(17)],Y.prototype,"charStrings"),Z([W(18,"number[]",[0,0])],Y.prototype,"private");var Ks=Object.defineProperty,Js=(s,t,e)=>t in s?Ks(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,lr=(s,t,e)=>(Js(s,typeof t!="symbol"?t+"":t,e),e);function ct(s,t=s){return e=>{$e.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty($e.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const nn=class Te{constructor(t){lr(this,"tables",new Map),lr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,o=Array.from({length:n}),i=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||i;return o}getPathCommands(t,e,r,n,o){var i;return(i=this.charToGlyph(t))==null?void 0:i.getPathCommands(e,r,n,o,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,o={},i){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];i.call(this,c,e,r,n,o),c.advanceWidth&&(e+=c.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*n:o.tracking&&(e+=o.tracking/1e3*n)}return e}clone(){return new Te(this.tableViews)}delete(t){const e=Te.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Te.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Te.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const o=this.tableViews.get(t);if(!o)return;r=new n(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};lr(nn,"tableDefinitions",new Map);let $e=nn;class ut extends Pt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var sn=Object.defineProperty,ti=Object.getOwnPropertyDescriptor,ei=(s,t,e)=>t in s?sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(s,t,e,r)=>{for(var n=r>1?void 0:r?ti(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&sn(t,e,n),n},hr=(s,t,e)=>(ei(s,typeof t!="symbol"?t+"":t,e),e);let ee=class extends ut{constructor(s,t,e,r){super(s,t,e,r),hr(this,"_glyphs"),hr(this,"privateDict"),hr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Gs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var s;return((s=this.privateDict)==null?void 0:s.defaultWidthX)??0}get nominalWidthX(){var s;return((s=this.privateDict)==null?void 0:s.nominalWidthX)??0}get subrs(){var s;return((s=this.subrsIndex)==null?void 0:s.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const s=this.view,{buffer:t,byteOffset:e}=s,r=e+4;this.nameIndex=new tn(t,r),this.topDictIndex=new Ue(t,this.nameIndex.endOffset),this.stringIndex=new tn(t,this.topDictIndex.endOffset),this.globalSubrIndex=new Ue(t,this.stringIndex.endOffset),this.topDict=new Y(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const n=this.topDict.private[0],o=this.topDict.private[1];n&&(this.privateDict=new Ee(t,e+o,n).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ue(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new Ue(t,e+this.topDict.charStrings);const i=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Ws:this.topDict.charset===1?this.charset=Vs:this.topDict.charset===2?this.charset=Qs:this.charset=this._readCharset(e+this.topDict.charset,i,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=or: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,o,i;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(n=0;n<t;n+=1)o=r.readUint16(),a.push(Le(e,o));else if(l===1)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint8(),n=0;n<=i;n+=1)a.push(Le(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint16(),n=0;n<=i;n+=1)a.push(Le(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(s){const t=this.view;t.seek(s);let e,r;const n={},o=t.readUint8();if(o===0){const i=t.readUint8();for(e=0;e<i;e+=1)r=t.readUint8(),n[r]=e}else if(o===1){const i=t.readUint8();for(r=1,e=0;e<i;e+=1){const a=t.readUint8(),l=t.readUint8();for(let h=a;h<=a+l;h+=1)n[h]=r,r+=1}}else console.warn(`unknown encoding format:${o}`);return n}_calcSubroutineBias(s){let t;return s.length<1240?t=107:s.length<33900?t=1131:t=32768,t}};ge([y("uint8")],ee.prototype,"majorVersion",2),ge([y("uint8")],ee.prototype,"minorVersion",2),ge([y("uint8")],ee.prototype,"headerSize",2),ge([y("uint8")],ee.prototype,"offsetSize",2),ee=ge([ct("CFF ","cff")],ee);var ri=Object.defineProperty,ke=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ri(t,e,n),n};const ye=class rs extends Pt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new rs;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};ke([y("uint16")],ye.prototype,"format"),ke([y("uint16")],ye.prototype,"length"),ke([y("uint16")],ye.prototype,"language"),ke([y({type:"uint8",size:256})],ye.prototype,"glyphIndexArray");let on=ye;var ni=Object.defineProperty,cr=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ni(t,e,n),n};class Be extends Pt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,o=this.subHeaders,i=this.glyphIndexArray,a=r.findIndex(h=>h===n);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<o[0].firstCode||h>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(h-o[0].firstCode)>=i.length?l=0:(l=i[o[0].idRangeOffset+(h-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(h,l);else{const c=r[h];for(let u=0,f=o[c].entryCount;u<f;u++)if(o[c].idRangeOffset+u>=i.length?l=0:(l=i[o[c].idRangeOffset+u],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<t){const g=(h<<8|u+o[c].firstCode)%65535;e.set(g,l)}}return e}}cr([y("uint16")],Be.prototype,"format"),cr([y("uint16")],Be.prototype,"length"),cr([y("uint16")],Be.prototype,"language");function an(s){return s>32767?s-65536:s<-32767?s+65536:s}function ln(s,t){let e;const r=[];let n={};return s.forEach((o,i)=>{t&&i>t||((!e||i!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:i,startId:o,delta:an(o-i)}):(n.start=Number(i),n.startId=o,n.delta=an(o-i))),e={unicode:i,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var si=Object.defineProperty,Qt=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&si(t,e,n),n};const qt=class ns extends Pt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=ln(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,i=new ns(new ArrayBuffer(24+e.length*8));return i.format=4,i.length=i.view.byteLength,i.language=0,i.segCountX2=r*2,i.searchRange=o,i.entrySelector=n,i.rangeShift=2*r-o,i.endCode=[...e.map(a=>a.end),65535],i.reservedPad=0,i.startCode=[...e.map(a=>a.start),65535],i.idDelta=[...e.map(a=>a.delta),1],i.idRangeOffset=Array.from({length:r},()=>0),i}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,i=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<e;++h)for(let c=n[h],u=o[h];c<=u;++c)if(i[h]===0)t.set(c,(c+a[h])%65536);else{const f=h+i[h]/2+(c-n[h])-r,g=l[f];g!==0?t.set(c,(g+a[h])%65536):t.set(c,0)}return t.delete(65535),t}};Qt([y("uint16")],qt.prototype,"format"),Qt([y("uint16")],qt.prototype,"length"),Qt([y("uint16")],qt.prototype,"language"),Qt([y("uint16")],qt.prototype,"segCountX2"),Qt([y("uint16")],qt.prototype,"searchRange"),Qt([y("uint16")],qt.prototype,"entrySelector"),Qt([y("uint16")],qt.prototype,"rangeShift");let hn=qt;var ii=Object.defineProperty,me=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ii(t,e,n),n};class re extends Pt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}me([y("uint16")],re.prototype,"format"),me([y("uint16")],re.prototype,"length"),me([y("uint16")],re.prototype,"language"),me([y("uint16")],re.prototype,"firstCode"),me([y("uint16")],re.prototype,"entryCount");var oi=Object.defineProperty,we=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&oi(t,e,n),n};const ne=class ss extends Pt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=ln(t),r=new ss(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const o=e[r];let i=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,i++)}return t}};we([y("uint16")],ne.prototype,"format"),we([y("uint16")],ne.prototype,"reserved"),we([y("uint32")],ne.prototype,"length"),we([y("uint32")],ne.prototype,"language"),we([y("uint32")],ne.prototype,"nGroups");let cn=ne;var ai=Object.defineProperty,ur=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&ai(t,e,n),n};class je extends Pt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:o}=e[r];o.forEach(i=>{t.set(i.unicodeValue,i.glyphID)})}return t}}ur([y("uint16")],je.prototype,"format"),ur([y("uint32")],je.prototype,"length"),ur([y("uint32")],je.prototype,"numVarSelectorRecords");var un=Object.defineProperty,li=Object.getOwnPropertyDescriptor,hi=(s,t,e)=>t in s?un(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fr=(s,t,e,r)=>{for(var n=r>1?void 0:r?li(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&un(t,e,n),n},fn=(s,t,e)=>(hi(s,typeof t!="symbol"?t+"":t,e),e);let xe=class extends ut{constructor(){super(...arguments),fn(this,"_unicodeToGlyphIndexMap"),fn(this,"_glyphIndexToUnicodesMap")}static from(s){const t=Array.from(s.keys()).some(c=>c>65535),e=hn.from(s),r=on.from(s),n=t?cn.from(s):void 0,o=4+(n?32:24),i=o+e.view.byteLength,a=i+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:i},{platformID:3,platformSpecificID:1,offset:o},n&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),h=new xe(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+((n==null?void 0:n.view.byteLength)??0)));return h.numberSubtables=l.length,h.view.seek(4),l.forEach(c=>{h.view.writeUint16(c.platformID),h.view.writeUint16(c.platformSpecificID),h.view.writeUint32(c.offset)}),h.view.writeBytes(e.view,o),h.view.writeBytes(r.view,i),n&&h.view.writeBytes(n.view,a),h}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,n=e.length;r<n;r++){const o=e[r],i=t.get(o);s.has(i)?s.get(i).push(o):s.set(i,[o])}this._glyphIndexToUnicodesMap=s}return this._glyphIndexToUnicodesMap}readSubtables(){const s=this.numberSubtables;return this.view.seek(4),Array.from({length:s},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const e=this.view.readUint16();let r;switch(e){case 0:r=new on(this.view.buffer,t.offset);break;case 2:r=new Be(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new hn(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new re(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new cn(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new je(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){var i,a,l,h,c;const s=this.readSubtables(),t=(i=s.find(u=>u.format===0))==null?void 0:i.view,e=(a=s.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:a.view,r=(l=s.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:l.view,n=(h=s.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:h.view,o=(c=s.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:c.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(e==null?void 0:e.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}};fr([y("uint16")],xe.prototype,"version",2),fr([y("uint16")],xe.prototype,"numberSubtables",2),xe=fr([ct("cmap")],xe);class ci extends Hr{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const o=t[n];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return fe(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const o=t[n],i={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(i)}return r}_parseGlyphCoordinate(t,e,r,n,o){let i;return(e&n)>0?(i=t.view.readUint8(),e&o||(i=-i),i=r+i):(e&o)>0?i=r:i=r+t.view.readInt16(),i}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let m=0;m<n;m++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();fe(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;fe(u<2e4,`Bad numberOfCoordinates:${c}`);const f=[];let g,d=0;for(;d<u;)if(g=t.view.readUint8(),f.push(g),d++,g&8&&d<u){const m=t.view.readUint8();for(let p=0;p<m;p++)f.push(g),d++}if(fe(f.length===u,`Bad flags length: ${f.length}, numberOfCoordinates: ${u}`),a.length>0){const m=[];let p;if(u>0){for(let S=0;S<u;S+=1)g=f[S],p={},p.onCurve=!!(g&1),p.lastPointOfContour=a.includes(S),m.push(p);let b=0;for(let S=0;S<u;S+=1)g=f[S],p=m[S],p.x=this._parseGlyphCoordinate(t,g,b,2,16),b=p.x;let M=0;for(let S=0;S<u;S+=1)g=f[S],p=m[S],p.y=this._parseGlyphCoordinate(t,g,M,4,32),M=p.y}this.points=m}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=t.view.readUint16();const h={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=t.view.readInt16(),h.dy=t.view.readInt16()):h.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(h.dx=t.view.readInt8(),h.dy=t.view.readInt8()):h.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?h.xScale=h.yScale=t.view.readInt16()/16384:(a&64)>0?(h.xScale=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384):(a&128)>0&&(h.xScale=t.view.readInt16()/16384,h.scale01=t.view.readInt16()/16384,h.scale10=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=r.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{fe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let f=h.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};f=this._transformPoints([f],g)[0],g.dx=u.x-f.x,g.dy=u.y-f.y,c=this._transformPoints(h.points,g)}this.points=this.points.concat(c)}}const o=[],i=this._parseContours(this.points);for(let a=0,l=i.length;a<l;++a){const h=i[a];let c=h[h.length-1],u=h[0];c.onCurve?o.push({type:"M",x:c.x,y:c.y}):u.onCurve?o.push({type:"M",x:u.x,y:u.y}):o.push({type:"M",x:(c.x+u.x)*.5,y:(c.y+u.y)*.5});for(let f=0,g=h.length;f<g;++f)if(c=u,u=h[(f+1)%g],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let d=u;u.onCurve||(d={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:d.x,y:d.y})}o.push({type:"Z"})}this.pathCommands=o}}class ui extends Zr{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new ci({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var pn=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,pi=(s,t,e)=>t in s?pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,di=(s,t,e,r)=>{for(var n=r>1?void 0:r?fi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&pn(t,e,n),n},gi=(s,t,e)=>(pi(s,t+"",e),e);let pr=class extends ut{constructor(){super(...arguments),gi(this,"_glyphs")}static from(s){const t=s.reduce((r,n)=>r+n.byteLength,0),e=new pr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeBytes(r)}),e}get glyphs(){return this._glyphs??(this._glyphs=new ui(this._sfnt))}};pr=di([ct("glyf")],pr);var yi=Object.defineProperty,mi=Object.getOwnPropertyDescriptor,wi=(s,t,e,r)=>{for(var n=r>1?void 0:r?mi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&yi(t,e,n),n};let dn=class extends ut{};dn=wi([ct("GPOS","gpos")],dn);var xi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,Xt=(s,t,e,r)=>{for(var n=r>1?void 0:r?vi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&xi(t,e,n),n};let Rt=class extends ut{};Xt([y("uint16")],Rt.prototype,"majorVersion",2),Xt([y("uint16")],Rt.prototype,"minorVersion",2),Xt([y("uint16")],Rt.prototype,"scriptListOffset",2),Xt([y("uint16")],Rt.prototype,"featureListOffset",2),Xt([y("uint16")],Rt.prototype,"lookupListOffset",2),Xt([y("uint16")],Rt.prototype,"featureVariationsOffset",2),Rt=Xt([ct("GSUB","gsub")],Rt);var bi=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,nt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Mi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&bi(t,e,n),n};let tt=class extends ut{constructor(s=new ArrayBuffer(54),t){super(s,t,Math.min(54,s.byteLength-(t??0)))}};nt([y("fixed")],tt.prototype,"version",2),nt([y("fixed")],tt.prototype,"fontRevision",2),nt([y("uint32")],tt.prototype,"checkSumAdjustment",2),nt([y("uint32")],tt.prototype,"magickNumber",2),nt([y("uint16")],tt.prototype,"flags",2),nt([y("uint16")],tt.prototype,"unitsPerEm",2),nt([y({type:"longDateTime"})],tt.prototype,"created",2),nt([y({type:"longDateTime"})],tt.prototype,"modified",2),nt([y("int16")],tt.prototype,"xMin",2),nt([y("int16")],tt.prototype,"yMin",2),nt([y("int16")],tt.prototype,"xMax",2),nt([y("int16")],tt.prototype,"yMax",2),nt([y("uint16")],tt.prototype,"macStyle",2),nt([y("uint16")],tt.prototype,"lowestRecPPEM",2),nt([y("int16")],tt.prototype,"fontDirectionHint",2),nt([y("int16")],tt.prototype,"indexToLocFormat",2),nt([y("int16")],tt.prototype,"glyphDataFormat",2),tt=nt([ct("head")],tt);var Si=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,mt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ci(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Si(t,e,n),n};let ft=class extends ut{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};mt([y("fixed")],ft.prototype,"version",2),mt([y("int16")],ft.prototype,"ascent",2),mt([y("int16")],ft.prototype,"descent",2),mt([y("int16")],ft.prototype,"lineGap",2),mt([y("uint16")],ft.prototype,"advanceWidthMax",2),mt([y("int16")],ft.prototype,"minLeftSideBearing",2),mt([y("int16")],ft.prototype,"minRightSideBearing",2),mt([y("int16")],ft.prototype,"xMaxExtent",2),mt([y("int16")],ft.prototype,"caretSlopeRise",2),mt([y("int16")],ft.prototype,"caretSlopeRun",2),mt([y("int16")],ft.prototype,"caretOffset",2),mt([y({type:"int16",size:4})],ft.prototype,"reserved",2),mt([y("int16")],ft.prototype,"metricDataFormat",2),mt([y("uint16")],ft.prototype,"numOfLongHorMetrics",2),ft=mt([ct("hhea")],ft);var gn=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,Ti=(s,t,e)=>t in s?gn(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?Pi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&gn(t,e,n),n},Ii=(s,t,e)=>(Ti(s,t+"",e),e);let dr=class extends ut{constructor(){super(...arguments),Ii(this,"_metrics")}static from(s){const t=s.length*4,e=new dr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:s}).map((n,o)=>(o<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};dr=_i([ct("hmtx")],dr);var Di=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,Oi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ai(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Di(t,e,n),n};let yn=class extends ut{};yn=Oi([ct("kern","kern")],yn);var mn=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,zi=(s,t,e)=>t in s?mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ui=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ni(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&mn(t,e,n),n},Li=(s,t,e)=>(zi(s,t+"",e),e);let gr=class extends ut{constructor(){super(...arguments),Li(this,"_locations")}static from(s,t=1){const e=s.length*(t?4:2),r=new gr(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)}};gr=Ui([ct("loca")],gr);var Ei=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?$i(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Ei(t,e,n),n};let it=class extends ut{constructor(s=new ArrayBuffer(32),t){super(s,t,Math.min(32,s.byteLength-(t??0)))}};pt([y("fixed")],it.prototype,"version",2),pt([y("uint16")],it.prototype,"numGlyphs",2),pt([y("uint16")],it.prototype,"maxPoints",2),pt([y("uint16")],it.prototype,"maxContours",2),pt([y("uint16")],it.prototype,"maxComponentPoints",2),pt([y("uint16")],it.prototype,"maxComponentContours",2),pt([y("uint16")],it.prototype,"maxZones",2),pt([y("uint16")],it.prototype,"maxTwilightPoints",2),pt([y("uint16")],it.prototype,"maxStorage",2),pt([y("uint16")],it.prototype,"maxFunctionDefs",2),pt([y("uint16")],it.prototype,"maxInstructionDefs",2),pt([y("uint16")],it.prototype,"maxStackElements",2),pt([y("uint16")],it.prototype,"maxSizeOfInstructions",2),pt([y("uint16")],it.prototype,"maxComponentElements",2),pt([y("uint16")],it.prototype,"maxComponentDepth",2),it=pt([ct("maxp")],it);var wn=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Bi=(s,t,e)=>t in s?wn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fe=(s,t,e,r)=>{for(var n=r>1?void 0:r?ki(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&wn(t,e,n),n},ji=(s,t,e)=>(Bi(s,t+"",e),e);const xn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},yr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Fi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},vn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let ve=class extends ut{constructor(){super(...arguments),ji(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=yr.Macintosh,n=Fi.Default,o=0;t.some(a=>a.platform===yr.Microsoft&&a.encoding===vn.UCS2&&a.language===1033)&&(r=yr.Microsoft,n=vn.UCS2,o=1033);const i={};for(let a=0;a<s;++a){const l=t[a];l.platform===r&&l.encoding===n&&l.language===o&&xn[l.nameId]&&(i[xn[l.nameId]]=o===0?Os(l.name):Ns(l.name))}return i}};Fe([y("uint16")],ve.prototype,"format",2),Fe([y("uint16")],ve.prototype,"count",2),Fe([y("uint16")],ve.prototype,"stringOffset",2),ve=Fe([ct("name")],ve);var Gi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,_=(s,t,e,r)=>{for(var n=r>1?void 0:r?qi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Gi(t,e,n),n};let T=class extends ut{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};_([y("uint16")],T.prototype,"version",2),_([y("int16")],T.prototype,"xAvgCharWidth",2),_([y("uint16")],T.prototype,"usWeightClass",2),_([y("uint16")],T.prototype,"usWidthClass",2),_([y("uint16")],T.prototype,"fsType",2),_([y("uint16")],T.prototype,"ySubscriptXSize",2),_([y("uint16")],T.prototype,"ySubscriptYSize",2),_([y("uint16")],T.prototype,"ySubscriptXOffset",2),_([y("uint16")],T.prototype,"ySubscriptYOffset",2),_([y("uint16")],T.prototype,"ySuperscriptXSize",2),_([y("uint16")],T.prototype,"ySuperscriptYSize",2),_([y("uint16")],T.prototype,"ySuperscriptXOffset",2),_([y("uint16")],T.prototype,"ySuperscriptYOffset",2),_([y("uint16")],T.prototype,"yStrikeoutSize",2),_([y("uint16")],T.prototype,"yStrikeoutPosition",2),_([y("uint16")],T.prototype,"sFamilyClass",2),_([y({type:"uint8"})],T.prototype,"bFamilyType",2),_([y({type:"uint8"})],T.prototype,"bSerifStyle",2),_([y({type:"uint8"})],T.prototype,"bWeight",2),_([y({type:"uint8"})],T.prototype,"bProportion",2),_([y({type:"uint8"})],T.prototype,"bContrast",2),_([y({type:"uint8"})],T.prototype,"bStrokeVariation",2),_([y({type:"uint8"})],T.prototype,"bArmStyle",2),_([y({type:"uint8"})],T.prototype,"bLetterform",2),_([y({type:"uint8"})],T.prototype,"bMidline",2),_([y({type:"uint8"})],T.prototype,"bXHeight",2),_([y({type:"uint8",size:16})],T.prototype,"ulUnicodeRange",2),_([y({type:"char",size:4})],T.prototype,"achVendID",2),_([y("uint16")],T.prototype,"fsSelection",2),_([y("uint16")],T.prototype,"usFirstCharIndex",2),_([y("uint16")],T.prototype,"usLastCharIndex",2),_([y("int16")],T.prototype,"sTypoAscender",2),_([y("int16")],T.prototype,"sTypoDescender",2),_([y("int16")],T.prototype,"sTypoLineGap",2),_([y("uint16")],T.prototype,"usWinAscent",2),_([y("uint16")],T.prototype,"usWinDescent",2),_([y({offset:72,type:"uint8",size:8})],T.prototype,"ulCodePageRange",2),_([y({offset:72,type:"int16"})],T.prototype,"sxHeight",2),_([y("int16")],T.prototype,"sCapHeight",2),_([y("uint16")],T.prototype,"usDefaultChar",2),_([y("uint16")],T.prototype,"usBreakChar",2),_([y("uint16")],T.prototype,"usMaxContext",2),T=_([ct("OS/2","os2")],T);var Ri=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,zt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Wi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Ri(t,e,n),n};let Dt=class extends ut{constructor(s=new ArrayBuffer(32),t,e){super(s,t,e)}};zt([y("fixed")],Dt.prototype,"format",2),zt([y("fixed")],Dt.prototype,"italicAngle",2),zt([y("int16")],Dt.prototype,"underlinePosition",2),zt([y("int16")],Dt.prototype,"underlineThickness",2),zt([y("uint32")],Dt.prototype,"isFixedPitch",2),zt([y("uint32")],Dt.prototype,"minMemType42",2),zt([y("uint32")],Dt.prototype,"maxMemType42",2),zt([y("uint32")],Dt.prototype,"minMemType1",2),zt([y("uint32")],Dt.prototype,"maxMemType1",2),Dt=zt([ct("post")],Dt);var Vi=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,wt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Qi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&Vi(t,e,n),n};let dt=class extends ut{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.byteLength-(t??0)))}};wt([y("fixed")],dt.prototype,"version",2),wt([y("int16")],dt.prototype,"vertTypoAscender",2),wt([y("int16")],dt.prototype,"vertTypoDescender",2),wt([y("int16")],dt.prototype,"vertTypoLineGap",2),wt([y("int16")],dt.prototype,"advanceHeightMax",2),wt([y("int16")],dt.prototype,"minTopSideBearing",2),wt([y("int16")],dt.prototype,"minBottomSideBearing",2),wt([y("int16")],dt.prototype,"yMaxExtent",2),wt([y("int16")],dt.prototype,"caretSlopeRise",2),wt([y("int16")],dt.prototype,"caretSlopeRun",2),wt([y("int16")],dt.prototype,"caretOffset",2),wt([y({type:"int16",size:4})],dt.prototype,"reserved",2),wt([y("int16")],dt.prototype,"metricDataFormat",2),wt([y("int16")],dt.prototype,"numOfLongVerMetrics",2),dt=wt([ct("vhea")],dt);var bn=Object.defineProperty,Xi=Object.getOwnPropertyDescriptor,Yi=(s,t,e)=>t in s?bn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Hi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Xi(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=(r?i(t,e,n):i(n))||n);return r&&n&&bn(t,e,n),n},Zi=(s,t,e)=>(Yi(s,t+"",e),e);let mr=class extends ut{constructor(){super(...arguments),Zi(this,"_metrics")}static from(s){const t=s.length*4,e=new mr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var n;const s=this._sfnt.maxp.numGlyphs,t=((n=this._sfnt.vhea)==null?void 0:n.numOfLongVerMetrics)??0,e=this.view;e.seek(0);let r=0;return Array.from({length:s}).map((o,i)=>(i<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};mr=Hi([ct("vmtx")],mr);var Mn=Object.defineProperty,Ki=(s,t,e)=>t in s?Mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,be=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Mn(t,e,n),n},Ge=(s,t,e)=>(Ki(s,typeof t!="symbol"?t+"":t,e),e);class At extends ir{constructor(){super(...arguments),Ge(this,"format","TrueType"),Ge(this,"mimeType","font/ttf"),Ge(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(te(t).getUint32(0))}static checksum(t){const e=te(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let o=0,i=r/4;o<i;o+=4)o*4<r-4&&(n+=e.getUint32(o*4,!1));return n&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((u,f)=>u+e(f.byteLength),0),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const i=Math.log(2);o.searchRange=Math.floor(Math.log(r)/i)*16,o.entrySelector=Math.floor(o.searchRange/i),o.rangeShift=r*16-o.searchRange;let a=12+r*16,l=0;const h=o.getDirectories();t.tableViews.forEach((u,f)=>{const g=h[l++];g.tag=f,g.checkSum=this.checksum(u),g.offset=a,g.length=u.byteLength,o.view.writeBytes(u,a),a+=e(g.length)});const c=o.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new pe(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new $e(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Ge(At,"signature",new Set([65536,1953658213,1954115633])),be([y("uint32")],At.prototype,"scalerType"),be([y("uint16")],At.prototype,"numTables"),be([y("uint16")],At.prototype,"searchRange"),be([y("uint16")],At.prototype,"entrySelector"),be([y("uint16")],At.prototype,"rangeShift");var Ji=Object.defineProperty,to=(s,t,e)=>t in s?Ji(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,wr=(s,t,e)=>(to(s,typeof t!="symbol"?t+"":t,e),e);class qe extends At{constructor(){super(...arguments),wr(this,"format","OpenType"),wr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}wr(qe,"signature",new Set([1330926671]));var eo=Object.defineProperty,Me=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&eo(t,e,n),n};class se extends Pt{constructor(t,e){super(t,e,20)}}Me([y({type:"char",size:4})],se.prototype,"tag"),Me([y("uint32")],se.prototype,"offset"),Me([y("uint32")],se.prototype,"compLength"),Me([y("uint32")],se.prototype,"origLength"),Me([y("uint32")],se.prototype,"origChecksum");var Sn=Object.defineProperty,ro=(s,t,e)=>t in s?Sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ct=(s,t,e,r)=>{for(var n=void 0,o=s.length-1,i;o>=0;o--)(i=s[o])&&(n=i(t,e,n)||n);return n&&Sn(t,e,n),n},Re=(s,t,e)=>(ro(s,typeof t!="symbol"?t+"":t,e),e);const xt=class Or extends ir{constructor(){super(...arguments),Re(this,"format","WOFF"),Re(this,"mimeType","font/woff"),Re(this,"_sfnt")}get subfontFormat(){return At.is(this.flavor)?"TrueType":qe.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(te(t).getUint32(0))}static checkSum(t){const e=te(t),r=e.byteLength,n=Math.floor(r/4);let o=0,i=0;for(;i<n;)o+=e.getUint32(4*i++,!1);let a=r-n*4;if(a){let l=n*4;for(;a>0;)o+=e.getUint8(l)<<a*8,l++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,f)=>{const g=te(xs(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:f,view:g.byteLength<u.byteLength?g:u,rawView:u})});const o=n.length,i=n.reduce((u,f)=>u+r(f.view.byteLength),0),a=new Or(new ArrayBuffer(44+20*o+i+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((u,f)=>u+r(f.rawView.byteLength),0);let l=44+o*20,h=0;const c=a.getDirectories();return n.forEach(u=>{const f=c[h++];f.tag=u.tag,f.offset=l,f.compLength=u.view.byteLength,f.origChecksum=Or.checkSum(u.rawView),f.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(f.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new se(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new $e(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,i=e.origLength,a=n+o;return t[r]=o>=i?new DataView(this.view.buffer,n,o):new DataView(vs(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Re(xt,"signature",new Set([2001684038])),Ct([y("uint32")],xt.prototype,"signature"),Ct([y("uint32")],xt.prototype,"flavor"),Ct([y("uint32")],xt.prototype,"length"),Ct([y("uint16")],xt.prototype,"numTables"),Ct([y("uint16")],xt.prototype,"reserved"),Ct([y("uint32")],xt.prototype,"totalSfntSize"),Ct([y("uint16")],xt.prototype,"majorVersion"),Ct([y("uint16")],xt.prototype,"minorVersion"),Ct([y("uint32")],xt.prototype,"metaOffset"),Ct([y("uint32")],xt.prototype,"metaLength"),Ct([y("uint32")],xt.prototype,"metaOrigLength"),Ct([y("uint32")],xt.prototype,"privOffset"),Ct([y("uint32")],xt.prototype,"privLength");let xr=xt;function no(s,t=!0){if(At.is(s))return new At(s);if(qe.is(s))return new qe(s);if(xr.is(s))return new xr(s);if(t)throw new Error("Failed to parseFont")}var so=Object.defineProperty,io=(s,t,e)=>t in s?so(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Se=(s,t,e)=>(io(s,typeof t!="symbol"?t+"":t,e),e);const Cn=class is{constructor(){Se(this,"fallbackFont"),Se(this,"loading",new Map),Se(this,"loaded",new Map),Se(this,"familyToUrl",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...is.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
2
2
  font-family: "${t}";
3
3
  src: url(${e});
4
- }`)),document.head.appendChild(r),this}get(t){let e;return t&&(e=this.loaded.get(this.familyToUrl.get(t)??t)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){const e=this.familyToUrl.get(t)??t;return this.familyToUrl.delete(e),this.loaded.delete(e),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...i}=e,{src:a}=t;if(this.loaded.has(a))return r&&(this.loading.forEach(f=>f.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,i),this.loading.set(a,l)),r&&this.loading.forEach((f,g)=>{f!==l&&(f.cancel(),this.loading.delete(g))}),l.when.then(f=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const g=u(f);return e.noAdd||this.loaded.set(t.src,g),g.familySet.forEach(d=>{this.familyToUrl.set(d,a),typeof document<"u"&&(n&&this.injectFontFace(d,f),o&&this.injectStyleTag(d,a))}),g}}).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(g=>{f.familySet.add(g)}),f}function u(f=new ArrayBuffer(0)){let g;function d(){return g||(g=f.byteLength?no(f,!1):void 0),g}function m(){const p=d();if(p instanceof At||p instanceof xr)return p.sfnt}return{...t,buffer:f,familySet:new Set(h()),getFont:d,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}};Se(Cn,"defaultRequestInit",{cache:"force-cache"});let oo=Cn;const ao=new oo,lo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Pn(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=o,s.lineJoin=lo[i],s.miterLimit=a,s.setLineDash(l),s.lineDashOffset=h,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=f,s.shadowColor=g}class v{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new v(1/0,1/0)}static get MIN(){return new v(-1/0,-1/0)}get array(){return[this.x,this.y]}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,o=-(this.y-e.y),i=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*i),e.y-(n*i+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,o=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new v(this.x,this.y)}}class L{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 L;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,o)=>(n.left=Math.min(n.left,o.left),n.top=Math.min(n.top,o.top),n.right=Math.max(n.right,o.right),n.bottom=Math.max(n.bottom,o.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new L(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 L(this.left,this.top,this.width,this.height)}}var ho=Object.defineProperty,co=(s,t,e)=>t in s?ho(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,uo=(s,t,e)=>(co(s,t+"",e),e);class bt{constructor(t=1,e=0,r=0,n=0,o=1,i=0,a=0,l=0,h=1){uo(this,"elements",[]),this.set(t,e,r,n,o,i,a,l,h)}set(t,e,r,n,o,i,a,l,h){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=o,c[5]=l,c[6]=r,c[7]=i,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,o=this.elements,i=r[0],a=r[3],l=r[6],h=r[1],c=r[4],u=r[7],f=r[2],g=r[5],d=r[8],m=n[0],p=n[3],b=n[6],M=n[1],S=n[4],I=n[7],w=n[2],x=n[5],A=n[8];return o[0]=i*m+a*M+l*w,o[3]=i*p+a*S+l*x,o[6]=i*b+a*I+l*A,o[1]=h*m+c*M+u*w,o[4]=h*p+c*S+u*x,o[7]=h*b+c*I+u*A,o[2]=f*m+g*M+d*w,o[5]=f*p+g*S+d*x,o[8]=f*b+g*I+d*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*i-a*h,f=a*l-c*o,g=h*o-i*l,d=e*u+r*f+n*g;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=u*m,t[1]=(n*h-c*r)*m,t[2]=(a*r-n*i)*m,t[3]=f*m,t[4]=(c*e-n*l)*m,t[5]=(n*o-a*e)*m,t[6]=g*m,t[7]=(r*l-h*e)*m,t[8]=(i*e-r*o)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(vr.makeScale(t,e)),this}rotate(t){return this.premultiply(vr.makeRotation(-t)),this}translate(t,e){return this.premultiply(vr.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 vr=new bt;function Tn(s,t,e,r){const n=s*e+t*r,o=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let i=Math.acos(Math.max(-1,Math.min(1,n/o)));return s*r-t*e<0&&(i=-i),i}function fo(s,t,e,r,n,o,i,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(i.x-a.x)/2,h=(i.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,u=-Math.sin(r)*l+Math.cos(r)*h;let f=t*t,g=e*e;const d=c*c,m=u*u,p=d/f+m/g;if(p>1){const $=Math.sqrt(p);t=$*t,e=$*e,f=t*t,g=e*e}const b=f*m+g*d,M=(f*g-b)/b;let S=Math.sqrt(Math.max(0,M));n===o&&(S=-S);const I=S*t*u/e,w=-S*e*c/t,x=Math.cos(r)*I-Math.sin(r)*w+(i.x+a.x)/2,A=Math.sin(r)*I+Math.cos(r)*w+(i.y+a.y)/2,C=Tn(1,0,(c-I)/t,(u-w)/e),P=Tn((c-I)/t,(u-w)/e,(-c-I)/t,(-u-w)/e)%(Math.PI*2);s.ellipse(x,A,t,e,r,C,C+P,o===1)}function ie(s,t){return s-(t-s)}function _n(s,t){const e=new v,r=new v;for(let n=0,o=s.length;n<o;n++){const i=s[n];if(i.type==="m"||i.type==="M")i.type==="m"?e.add(i):e.copy(i),t.moveTo(e.x,e.y),r.copy(e);else if(i.type==="h"||i.type==="H")i.type==="h"?e.x+=i.x:e.x=i.x,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="v"||i.type==="V")i.type==="v"?e.y+=i.y:e.y=i.y,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="l"||i.type==="L")i.type==="l"?e.add(i):e.copy(i),t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="c"||i.type==="C")i.type==="c"?(t.bezierCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(t.bezierCurveTo(ie(e.x,r.x),ie(e.y,r.y),e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(ie(e.x,r.x),ie(e.y,r.y),i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(t.quadraticCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x,e.y+i.y),r.x=e.x+i.x1,r.y=e.y+i.y1,e.add(i)):(t.quadraticCurveTo(i.x1,i.y1,i.x,i.y),r.x=i.x1,r.y=i.y1,e.copy(i));else if(i.type==="t"||i.type==="T"){const a=ie(e.x,r.x),l=ie(e.y,r.y);r.x=a,r.y=l,i.type==="t"?(t.quadraticCurveTo(a,l,e.x+i.x,e.y+i.y),e.add(i)):(t.quadraticCurveTo(a,l,i.x,i.y),e.copy(i))}else if(i.type==="a"||i.type==="A"){const a=e.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;e.add(i)}else{if(e.equals(i))continue;e.copy(i)}r.copy(e),fo(t,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,e)}else i.type==="z"||i.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",i)}}const J={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(s,t,e=0){let a=0,l=!0,h="",c="";const u=[];function f(p,b,M){const S=new SyntaxError(`Unexpected character "${p}" at index ${b}.`);throw S.partial=M,S}function g(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let d;const m=s.length;for(let p=0;p<m;p++){if(d=s[p],Array.isArray(t)&&t.includes(u.length%e)&&J.FLAGS.test(d)){a=1,h=d,g();continue}if(a===0){if(J.WHITESPACE.test(d))continue;if(J.DIGIT.test(d)||J.SIGN.test(d)){a=1,h=d;continue}if(J.POINT.test(d)){a=2,h=d;continue}J.COMMA.test(d)&&(l&&f(d,p,u),l=!0)}if(a===1){if(J.DIGIT.test(d)){h+=d;continue}if(J.POINT.test(d)){h+=d,a=2;continue}if(J.EXP.test(d)){a=3;continue}J.SIGN.test(d)&&h.length===1&&J.SIGN.test(h[0])&&f(d,p,u)}if(a===2){if(J.DIGIT.test(d)){h+=d;continue}if(J.EXP.test(d)){a=3;continue}J.POINT.test(d)&&h[h.length-1]==="."&&f(d,p,u)}if(a===3){if(J.DIGIT.test(d)){c+=d;continue}if(J.SIGN.test(d)){if(c===""){c+=d;continue}c.length===1&&J.SIGN.test(c)&&f(d,p,u)}}J.WHITESPACE.test(d)?(g(),a=0,l=!1):J.COMMA.test(d)?(g(),a=0,l=!0):J.SIGN.test(d)?(g(),a=1,h=d):J.POINT.test(d)?(g(),a=2,h=d):f(d,p,u)}return g(),u}function po(s){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=s.length;n<o;n++){const i=s[n];switch(i.type){case"m":case"M":if(i.x===e.x&&i.y===e.y)continue;r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y,t.x=i.x,t.y=i.y;break;case"h":case"H":r+=`${i.type} ${i.x}`,e.x=i.x;break;case"v":case"V":r+=`${i.type} ${i.y}`,e.y=i.y;break;case"l":case"L":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"c":case"C":r+=`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"s":case"S":r+=`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"q":case"Q":r+=`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"t":case"T":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"a":case"A":r+=`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"z":case"Z":r+=i.type,e.x=t.x,e.y=t.y;break}}return r}const go=/[a-df-z][^a-df-z]*/gi;function In(s){const t=[],e=s.match(go);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],i=o.charAt(0),a=o.slice(1).trim();let l;switch(i){case"m":case"M":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:i,x:l[h],y:l[h+1]}):t.push({type:i==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,x:l[h]});break;case"v":case"V":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,y:l[h]});break;case"l":case"L":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"c":case"C":l=Ut(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:i,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"a":case"A":l=Ut(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:i,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":t.push({type:i});break;default:console.warn(o)}}return t}var yo=Object.defineProperty,mo=(s,t,e)=>t in s?yo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,br=(s,t,e)=>(mo(s,typeof t!="symbol"?t+"":t,e),e);class Yt{constructor(){br(this,"arcLengthDivisions",200),br(this,"_cacheArcLengths"),br(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new v){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),o=0;e.push(0);for(let i=1;i<=t;i++)r=this.getPoint(i/t),o+=r.distanceTo(n),e.push(o),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const o=r.length;let i;e?i=e:i=t*r[o-1];let a=0,l=o-1,h;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),h=r[n]-i,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===i)return n/(o-1);const c=r[n],f=r[n+1]-c,g=(i-c)/f;return(n+g)/(o-1)}getTangent(t,e=new v){const n=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new v){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,o=(r+n)/2;for(;n-r>e;){o=(r+n)/2;const i=this.getPoint(o);if(i.distanceTo(t)<e)return o;i.x<t.x?r=o:n=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=v.MAX,e=v.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new L(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 po(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Dn(s,t,e,r,n){const o=(r-t)*.5,i=(n-e)*.5,a=s*s,l=s*a;return(2*e-2*r+o+i)*l+(-3*e+3*r-2*o-i)*a+o*s+e}function wo(s,t){const e=1-s;return e*e*t}function xo(s,t){return 2*(1-s)*s*t}function vo(s,t){return s*s*t}function An(s,t,e,r){return wo(s,t)+xo(s,e)+vo(s,r)}function bo(s,t){const e=1-s;return e*e*e*t}function Mo(s,t){const e=1-s;return 3*e*e*s*t}function So(s,t){return 3*(1-s)*s*s*t}function Co(s,t){return s*s*s*t}function On(s,t,e,r,n){return bo(s,t)+Mo(s,e)+So(s,r)+Co(s,n)}class Po extends Yt{constructor(t=new v,e=new v,r=new v,n=new v){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new v){const{start:r,startControl:n,endControl:o,end:i}=this;return e.set(On(t,r.x,n.x,o.x,i.x),On(t,r.y,n.y,o.y,i.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const o=Math.sqrt(n),i=(-e+o)/(2*t),a=(-e-o)/(2*t);return[i,a].filter(l=>l>=0&&l<=1)}getMinMax(t=v.MAX,e=v.MIN){const r=this.start,n=this.startControl,o=this.endControl,i=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(i.x-o.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(i.y-o.y)),h=[0,1,...a,...l];return((u,f)=>{for(const g of u)for(let d=0;d<=f;d++){const m=d/f-.5,p=Math.min(1,Math.max(0,g+m)),b=this.getPoint(p);t.x=Math.min(t.x,b.x),t.y=Math.min(t.y,b.y),e.x=Math.max(e.x,b.x),e.y=Math.max(e.y,b.y)}})(h,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{start:e,startControl:r,endControl:n,end:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,o.x,o.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const To=new bt,Nn=new bt,zn=new bt,We=new v;class _o extends Yt{constructor(t=new v,e=1,r=1,n=0,o=0,i=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=i,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new v){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(o?n=0:n=r),this.clockwise&&!o&&(n===r?n=-r:n=n-r);const i=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(i),l=this.center.y+this.radiusY*Math.sin(i);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,f=l-this.center.y;a=u*h-f*c+this.center.x,l=u*c+f*h+this.center.y}return e.set(a,l)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:i,rotation:a}=this,{x:l,y:h}=t,c=l+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=h+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),f=Math.abs(n-o),g=f>Math.PI?1:0,d=i?1:0,m=a*180/Math.PI;if(f>=2*Math.PI){const p=n+Math.PI,b=l+e*Math.cos(p)*Math.cos(a)-r*Math.sin(p)*Math.sin(a),M=h+e*Math.cos(p)*Math.sin(a)+r*Math.sin(p)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:d,x:b,y:M},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:d,x:c,y:u}]}else{const p=l+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),b=h+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:g,sweepFlag:d,x:p,y:b}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:i,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,n,o,i,a,!l),this}matrix(t){return We.set(this.center.x,this.center.y),We.applyMatrix3(t),this.center.x=We.x,this.center.y=We.y,Ao(t)?Io(this,t):Do(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=v.MAX,e=v.MIN){const{center:r,radiusX:n,radiusY:o,rotation:i}=this,{x:a,y:l}=r,h=Math.cos(i),c=Math.sin(i),u=Math.sqrt(n*n*h*h+o*o*c*c),f=Math.sqrt(n*n*c*c+o*o*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,l-f),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,l+f),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Io(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),o=Math.sin(s.rotation),i=new v(e*n,e*o),a=new v(-r*o,r*n),l=i.applyMatrix3(t),h=a.applyMatrix3(t),c=To.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=Nn.copy(c).invert(),d=zn.copy(u).transpose().multiply(u).elements,m=Oo(d[0],d[1],d[4]),p=Math.sqrt(m.rt1),b=Math.sqrt(m.rt2);if(s.radiusX=1/p,s.radiusY=1/b,s.rotation=Math.atan2(m.sn,m.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const S=Nn.set(p,0,0,0,b,0,0,0,1),I=zn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=S.multiply(I).multiply(c),x=A=>{const{x:C,y:P}=new v(Math.cos(A),Math.sin(A)).applyMatrix3(w);return Math.atan2(P,C)};s.startAngle=x(s.startAngle),s.endAngle=x(s.endAngle),Un(t)&&(s.clockwise=!s.clockwise)}}function Do(s,t){const e=Ln(t),r=En(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,Un(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function Un(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Ao(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Ln(s),n=En(s);return Math.abs(e/(r*n))>Number.EPSILON}function Ln(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function En(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Oo(s,t,e){let r,n,o,i,a;const l=s+e,h=s-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,n=s*a*e-t*a*t):l<0?n=.5*(l-c):(r=.5*c,n=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,i=1/Math.sqrt(1+a*a),o=a*i):Math.abs(t)===0?(o=1,i=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),i=a*o),h>0&&(a=o,o=-i,i=a),{rt1:r,rt2:n,cs:o,sn:i}}class Mr extends Yt{constructor(t=new v,e=new v){super(),this.start=t,this.end=e}getPoint(t,e=new v){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new v){return this.getPoint(t,e)}getTangent(t,e=new v){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new v){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class No extends Yt{constructor(t=new v,e=new v,r=new v){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new v){const{start:r,control:n,end:o}=this;return e.set(An(t,r.x,n.x,o.x),An(t,r.y,n.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,control:n,end:o}=this,i=.5*(r.x+n.x),a=.5*(r.y+n.y),l=.5*(r.x+o.x),h=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,i,l),t.y=Math.min(t.y,r.y,o.y,a,h),e.x=Math.max(e.x,r.x,o.x,i,l),e.y=Math.max(e.y,r.y,o.y,a,h),{min:t,max:e}}toCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{start:e,control:r,end:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var zo=Object.defineProperty,Uo=(s,t,e)=>t in s?zo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,$n=(s,t,e)=>(Uo(s,typeof t!="symbol"?t+"":t,e),e);class Lo extends Yt{constructor(t,e,r=1,n=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=o,$n(this,"curves",[]),$n(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,n=this.rx/this.aspectRatio,o=[new v(t-r,e-n),new v(t+r,e-n),new v(t+r,e+n),new v(t-r,e+n)];for(let i=0;i<4;i++)this.curves.push(new Mr(o[i].clone(),o[(i+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Eo extends Yt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new v){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),i=n-o,a=r[o===0?o:o-1],l=r[o],h=r[o>r.length-2?r.length-1:o+1],c=r[o>r.length-3?r.length-1:o+2];return e.set(Dn(i,a.x,l.x,h.x,c.x),Dn(i,a.y,l.y,h.y,c.y)),e}getControlPoints(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var $o=Object.defineProperty,ko=(s,t,e)=>t in s?$o(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ce=(s,t,e)=>(ko(s,typeof t!="symbol"?t+"":t,e),e);class Pe extends Yt{constructor(t){super(),Ce(this,"curves",[]),Ce(this,"startPoint"),Ce(this,"currentPoint",new v),Ce(this,"autoClose",!1),Ce(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:n,y:o}=t[e];this.lineTo(n,o)}return this}addCommands(t){return _n(t,this),this}addData(t){return this.addCommands(In(t)),this}getPoint(t,e=new v){const r=t*this.getLength(),n=this.getCurveLengths();let o=0;for(;o<n.length;){if(n[o]>=r){const i=n[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-i/l,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let o=0,i=r.length;o<i;o++){const l=r[o].getPoints(t);for(let h=0;h<l.length;h++){const c=l[h];n!=null&&n.equals(c)||(e.push(c),n=c)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new Mr(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new Mr(this.currentPoint.clone(),new v(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPoint.equals({x:o,y:i})||this.curves.push(new Po(this.currentPoint.clone(),new v(t,e),new v(r,n),new v(o,i))),this._setCurrentPoint({x:o,y:i}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new No(this.currentPoint.clone(),new v(t,e),new v(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,i){return this.ellipse(t,e,r,r,0,n,o,i),this}relativeArc(t,e,r,n,o,i){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,i),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,i,a,l=!0){const h=new _o(new v(t,e),r,n,o,i,a,!l);if(this.curves.length>0){const c=h.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,e,r,n,o,i,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,n,o,i,a,l),this}rect(t,e,r,n){return this.curves.push(new Lo(new v(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Eo([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new L(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Bo(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function jo(s,t,e,r){const n=t.clone().sub(s),o=r.clone().sub(e),i=e.clone().sub(s),a=n.cross(o);if(a===0)return new v((s.x+e.x)/2,(s.y+e.y)/2);const l=i.cross(o)/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)}var Fo=Object.defineProperty,Go=(s,t,e)=>t in s?Fo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Sr=(s,t,e)=>(Go(s,typeof t!="symbol"?t+"":t,e),e);class Mt{constructor(t){Sr(this,"currentPath",new Pe),Sr(this,"paths",[this.currentPath]),Sr(this,"style",{}),t&&(t instanceof Mt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof Mt?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 Pe().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r.equals({x:t,y:e})||(n.length?(this.currentPath=new Pe().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPath.bezierCurveTo(t,e,r,n,o,i),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,i){return this.currentPath.arc(t,e,r,n,o,i),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,i,a,l){return this.currentPath.ellipse(t,e,r,n,o,i,a,l),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return _n(t,this),this}addData(t){return this.addCommands(In(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],n=[],o=[];e.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();o[l]=h,n[l]=c;const u=h[0],f=h[h.length-1]??u;r.push({start:c?f:u,end:c?u:f,index:l})});const i=[];return r.forEach((a,l)=>{i[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&i[l].push(h.index)})}),e.forEach((a,l)=>{const h=n[l];o[l].forEach(u=>{const f=a.getTForPoint(u),g=a.getNormal(f).scale(h?t:-t);u.add(g)})}),i.forEach((a,l)=>{const h=o[l];a.forEach(c=>{const u=o[c],f=jo(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(o=>{if(o.getMinMax(t,e),r&&n>1){const i=n/2,a=o.isClockwise(),l=[];for(let h=0;h<=1;h+=1/o.arcLengthDivisions){const c=o.getPoint(h),u=o.getNormal(h),f=u.clone().scale(a?i:-i),g=u.clone().scale(a?-i:i);l.push(c.clone().add(f),c.clone().add(g),c.clone().add({x:i,y:0}),c.clone().add({x:-i,y:0}),c.clone().add({x:0,y:i}),c.clone().add({x:0,y:-i}),c.clone().add({x:i,y:i}),c.clone().add({x:-i,y:-i}))}t.min(...l),e.max(...l)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new L(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),Pn(t,e),this.paths.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),Pn(t,e),this.getControlPoints().forEach(o=>{t.moveTo(o.x,o.y),t.arc(o.x,o.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[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(),o=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:i,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=i*e,l.height=a*e,l.style.width=`${i}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-n,-o),this.drawTo(h,r)),l}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const Cr="px",kn=90,Bn=["mm","cm","in","pt","pc","px"],Pr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function E(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Bn.length;r<n;r++){const o=Bn[r];if(s.endsWith(o)){t=o,s=s.substring(0,s.length-o.length);break}}let e;return t==="px"&&Cr!=="px"?e=Pr.in[Cr]/kn:(e=Pr[t][Cr],e<0&&(e=Pr[t].in*kn)),e*Number.parseFloat(s)}const qo=new bt,Ve=new bt,jn=new bt,Fn=new bt;function Ro(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Wo(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Wo(s){const t=new bt,e=qo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(E(s.getAttribute("x")),E(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const i=o.indexOf("("),a=o.length;if(i>0&&i<a){const l=o.slice(0,i),h=Ut(o.slice(i+1));switch(e.identity(),l){case"translate":if(h.length>=1){const c=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(c,u)}break;case"rotate":if(h.length>=1){let c=0,u=0,f=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],f=h[2]),Ve.makeTranslation(-u,-f),jn.makeRotation(c),Fn.multiplyMatrices(jn,Ve),Ve.makeTranslation(u,f),e.multiplyMatrices(Ve,Fn)}break;case"scale":h.length>=1&&e.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&e.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&e.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&e.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}t.premultiply(e)}}return t}function Vo(s){return new Mt().addPath(new Pe().arc(E(s.getAttribute("cx")||0),E(s.getAttribute("cy")||0),E(s.getAttribute("r")||0),0,Math.PI*2))}function Qo(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim()),o={};for(let i=r.style.length,a=0;a<i;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let i=0;i<n.length;i++)t[n[i]]=Object.assign(t[n[i]]||{},{...o})}}function Xo(s){return new Mt().addPath(new Pe().ellipse(E(s.getAttribute("cx")||0),E(s.getAttribute("cy")||0),E(s.getAttribute("rx")||0),E(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Yo(s){return new Mt().moveTo(E(s.getAttribute("x1")||0),E(s.getAttribute("y1")||0)).lineTo(E(s.getAttribute("x2")||0),E(s.getAttribute("y2")||0))}function Ho(s){const t=new Mt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Zo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ko(s){var r;const t=new Mt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Zo,(n,o,i)=>{const a=E(o),l=E(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!0,t}const Jo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ta(s){var r;const t=new Mt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Jo,(n,o,i)=>{const a=E(o),l=E(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!1,t}function ea(s){const t=E(s.getAttribute("x")||0),e=E(s.getAttribute("y")||0),r=E(s.getAttribute("rx")||s.getAttribute("ry")||0),n=E(s.getAttribute("ry")||s.getAttribute("rx")||0),o=E(s.getAttribute("width")),i=E(s.getAttribute("height")),a=1-.551915024494,l=new Mt;return l.moveTo(t+r,e),l.lineTo(t+o-r,e),(r!==0||n!==0)&&l.bezierCurveTo(t+o-r*a,e,t+o,e+n*a,t+o,e+n),l.lineTo(t+o,e+i-n),(r!==0||n!==0)&&l.bezierCurveTo(t+o,e+i-n*a,t+o-r*a,e+i,t+o-r,e+i),l.lineTo(t+r,e+i),(r!==0||n!==0)&&l.bezierCurveTo(t+r*a,e+i,t,e+i-n*a,t,e+i-n),l.lineTo(t,e+n),(r!==0||n!==0)&&l.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),l}function Lt(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)r=Object.assign(r,e[`.${h[c]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let h=s.style.length,c=0;c<h;c++){const u=s.style.item(c),f=s.style.getPropertyValue(u);t[u]=f,r[u]=f}function n(h,c,u=o){s.hasAttribute(h)&&(t[c]=u(s.getAttribute(h))),r[h]&&(t[c]=u(r[h]))}function o(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function i(h){return Math.max(0,Math.min(1,E(h)))}function a(h){return Math.max(0,E(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>E(c))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",l),n("stroke-dashoffset","strokeDashoffset",E),n("visibility","visibility"),t}function Tr(s,t,e=[],r={}){var u;if(s.nodeType!==1)return e;let n=!1,o=null,i={...t};switch(s.nodeName){case"svg":i=Lt(s,i,r);break;case"style":Qo(s,r);break;case"g":i=Lt(s,i,r);break;case"path":i=Lt(s,i,r),s.hasAttribute("d")&&(o=Ho(s));break;case"rect":i=Lt(s,i,r),o=ea(s);break;case"polygon":i=Lt(s,i,r),o=Ko(s);break;case"polyline":i=Lt(s,i,r),o=ta(s);break;case"circle":i=Lt(s,i,r),o=Vo(s);break;case"ellipse":i=Lt(s,i,r),o=Xo(s);break;case"line":i=Lt(s,i,r),o=Yo(s);break;case"defs":n=!0;break;case"use":{i=Lt(s,i,r);const g=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=(u=s.viewportElement)==null?void 0:u.getElementById(g);d?Tr(d,i,e,r):console.warn(`'use node' references non-existent node id: ${g}`);break}default:console.warn(s);break}if(i.display==="none")return e;Object.assign(t,i);const a=new bt,l=[],h=Ro(s,a,l);o&&(o.matrix(a),e.push(o),o.style=t);const c=s.childNodes;for(let f=0,g=c.length;f<g;f++){const d=c[f];n&&d.nodeName!=="style"&&d.nodeName!=="defs"||Tr(d,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Gn="data:image/svg+xml;",qn=`${Gn}base64,`,Rn=`${Gn}charset=utf8,`;function ra(s){if(typeof s=="string"){let t;return s.startsWith(qn)?(s=s.substring(qn.length,s.length),t=atob(s)):s.startsWith(Rn)?(s=s.substring(Rn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Wn(s){return Tr(ra(s),{})}function Qe(s,t=!0){if(!s.length)return;const e=v.MAX,r=v.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new L(e.x,e.y,r.x-e.x,r.y-e.y)}const na=new Set(["©","®","÷"]),sa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),ia={1:"italic",32:"bold"},oa={1:"italic",2:"bold"},Vn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Qn{constructor(t,e,r){D(this,"path",new Mt);D(this,"lineBox",new L);D(this,"inlineBox",new L);D(this,"glyphBox");D(this,"underlinePosition",0);D(this,"underlineThickness",0);D(this,"strikeoutPosition",0);D(this,"strikeoutSize",0);D(this,"ascender",0);D(this,"descender",0);D(this,"typoAscender",0);D(this,"typoDescender",0);D(this,"typoLineGap",0);D(this,"winAscent",0);D(this,"winDescent",0);D(this,"xHeight",0);D(this,"capHeight",0);D(this,"baseline",0);D(this,"centerDiviation",0);D(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??ao,n=e?r.get(e):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{hhea:e,os2:r,post:n,head:o}=t,i=o.unitsPerEm,a=e.ascent,l=e.descent,{content:h,computedStyle:c}=this,{fontSize:u}=c,f=i/u,g=t.getAdvanceWidth(h,u),d=(a+Math.abs(l))/f,m=a/f;return this.inlineBox.width=g,this.inlineBox.height=d,this.underlinePosition=(a-n.underlinePosition)/f,this.underlineThickness=n.underlineThickness/f,this.strikeoutPosition=(a-r.yStrikeoutPosition)/f,this.strikeoutSize=r.yStrikeoutSize/f,this.ascender=a/f,this.descender=l/f,this.typoAscender=r.sTypoAscender/f,this.typoDescender=r.sTypoDescender/f,this.typoLineGap=r.sTypoLineGap/f,this.winAscent=r.usWinAscent/f,this.winDescent=r.usWinDescent/f,this.xHeight=r.sxHeight/f,this.capHeight=r.sCapHeight/f,this.baseline=m,this.centerDiviation=d/2-m,this.fontStyle=ia[r.fsSelection]??oa[o.macStyle],this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:n,computedStyle:o,baseline:i,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u}=this,{left:f,top:g}=a,d=o.fontStyle==="italic"&&u!=="italic";let m=f,p=g+i,b;const M=new Mt;if(r&&(m+=(a.height-a.width)/2,Math.abs(a.width-a.height)>.1&&(p-=(l-c)/(l+Math.abs(h))*a.height),b=void 0),r&&!na.has(n)&&(n.codePointAt(0)<=256||sa.has(n))){M.addCommands(e.getPathCommands(n,m,g+i-(a.height-a.width)/2,o.fontSize)??[]);const I={y:g-(a.height-a.width)/2+a.height/2,x:m+a.width/2};d&&this._italic(M,r?{x:I.x,y:g-(a.height-a.width)/2+i}:void 0),M.rotate(90,I)}else b!==void 0?(M.addCommands(e.glyphs.get(b).getPathCommands(m,p,o.fontSize)),d&&this._italic(M,r?{x:m+a.width/2,y:g+c/(l+Math.abs(h))*a.height}:void 0)):(M.addCommands(e.getPathCommands(n,m,p,o.fontSize)??[]),d&&this._italic(M,r?{x:m+a.height/2,y:p}:void 0));const S=o.fontWeight??400;return S in Vn&&(S===700||S==="bold")&&u!=="bold"&&M.bold(Vn[S]*o.fontSize*.05),M.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=M,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 L(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){Jt({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function Ht(s){return!s||s==="none"}function Xe(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}class Xn{constructor(t,e={},r){D(this,"inlineBox",new L);this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Xe(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Qn(r,e++,this));return this.characters=t,this}}class oe{constructor(t,e){D(this,"lineBox",new L);D(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Xe(this.parentStyle),...Xe(this.style)},this}addFragment(t,e){const r=new Xn(t,e,this);return this.fragments.push(r),r}}function aa(s){return s}class Yn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(i=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(i.style)),i.fragments.forEach(l=>{const h=document.createElement("span");Object.assign(h.style,this._styleToDomStyle(l.style)),h.appendChild(document.createTextNode(l.content)),/\s/.test(l.content)&&(h.style.whiteSpace="pre"),a.appendChild(h)}),o.appendChild(a)}),n.appendChild(o),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var i;return(i=n.parentNode)==null?void 0:i.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,i)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((l,h)=>{var f;const c=l.getBoundingClientRect();r.push({paragraphIndex:i,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});const u=l.firstChild;if(u instanceof window.Text){const g=document.createRange();g.selectNodeContents(u);const d=u.data?u.data.length:0;let m=0;for(;m<=d;){g.setStart(u,Math.max(m-1,0)),g.setEnd(u,m);const p=((f=g.getClientRects)==null?void 0:f.call(g))??[g.getBoundingClientRect()];let b=p[p.length-1];p.length>1&&b.width<2&&(b=p[p.length-2]);const M=g.toString();M!==""&&b&&b.width+b.height!==0&&n.push({content:M,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:m-1,top:b.top,left:b.left,height:b.height,width:b.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=this._measureDom(t);n.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),n.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let i=0;return n.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const u=e[l].fragments[h].characters[c],f=o[i];u.inlineBox.left=f.left,u.inlineBox.top=f.top,u.inlineBox.width=f.width,u.inlineBox.height=f.height;const g=u.fontHeight;u.lineBox.left=f.left,u.lineBox.top=f.top+(f.height-g)/2,u.lineBox.height=g,u.lineBox.width=f.width,i++}),{paragraphs:e,boundingBox:new L(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}const la="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function ha(s,t,e){if(s==="cover")return 0;if(typeof s=="string")if(s.endsWith("%")){const r=Number(s.substring(0,s.length-1))/100;return Math.ceil(r*e/t)}else return s.endsWith("rem")?Number(s.substring(0,s.length-3)):Math.ceil(Number(s)/t);else return Math.ceil(s/t)}function ca(s,t,e){return typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function ua(s,t,e,r){let n;r?n={x:e.width/t.height,y:e.height/t.width}:n={x:e.width/t.width,y:e.height/t.height};const o=e.center.add(s.center.sub(t.center).scale(n.x,n.y)).sub({x:s.width/2*n.x,y:s.height/2*n.y}),i=new bt;return i.translate(-s.left,-s.top),r&&(i.translate(-s.width/2,-s.height/2),i.rotate(Math.PI/2),i.translate(s.width/2,s.height/2)),i.scale(n.x,n.y),i.translate(o.x,o.y),i}function Hn(){const s=[],t=[],e=new Map;function r(n){let o=e.get(n);return o||(o=Wn(n),e.set(n,o)),o}return{name:"highlight",paths:s,update:n=>{s.length=0;const o=[];let i,a;n.forEachCharacter(l=>{const{isVertical:h,computedStyle:c,inlineBox:u,fontSize:f}=l;!Ht(c.highlightImage)&&l.glyphBox&&(c.highlightSize!=="1rem"&&(a==null?void 0:a.highlightImage)===c.highlightImage&&(a==null?void 0:a.highlightSize)===c.highlightSize&&(a==null?void 0:a.highlightStrokeWidth)===c.highlightStrokeWidth&&(a==null?void 0:a.highlightOverflow)===c.highlightOverflow&&(i!=null&&i.length)&&(h?i[0].inlineBox.left===u.left:i[0].inlineBox.top===u.top)&&i[0].fontSize===f?i.push(l):(i=[],i.push(l),o.push(i))),a=c}),o.filter(l=>l.length).map(l=>{const h=l[0];return{style:h.computedStyle,unitHeight:h.typoAscender+h.typoDescender,box:L.from(...l.map(c=>c.glyphBox))}}).forEach(l=>{const{style:h,box:c,unitHeight:u}=l,{fontSize:f,writingMode:g}=h,d=g.includes("vertical"),m=ca(h.highlightStrokeWidth,f,c.width),p=ha(h.highlightSize,f,c.width),b=Ht(h.highlightOverflow)?p?"hidden":"visible":h.highlightOverflow,M=r(Ht(h.highlightReferImage)?la:h.highlightReferImage),S=r(h.highlightImage),I=Qe(S,!0),w=Qe(M,!1),x=p?f*p:d?c.height:c.width,A=ua(I,w,new L(c.left,c.top,d?u:x,d?x:u),d),C=f/I.width*2,P=Math.ceil(c.width/x);for(let $=0;$<P;$++){const R=A.clone().translate($*x,0);S.forEach(W=>{const Y=W.clone().matrix(R);Y.style.strokeWidth&&(Y.style.strokeWidth*=C*m),Y.style.strokeMiterlimit&&(Y.style.strokeMiterlimit*=C),Y.style.strokeDashoffset&&(Y.style.strokeDashoffset*=C),Y.style.strokeDasharray&&(Y.style.strokeDasharray=Y.style.strokeDasharray.map(O=>O*C)),s.push(Y),t[s.length-1]=b==="hidden"?new L(c.left,c.top-c.height,c.width,c.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{s.forEach((i,a)=>{Jt({ctx:n,path:i,clipRect:t[a],fontSize:o.computedStyle.fontSize})})}}}function Zn(s,t,e){return s==="cover"?1:typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Kn(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,o=n*.45;e.forEach(i=>{const{computedStyle:a}=i;let l=a.listStyleSize,h;if(!Ht(a.listStyleImage))h=a.listStyleImage;else if(!Ht(a.listStyleType)){const d=n*.38/2;switch(l=l==="cover"?d*2:l,a.listStyleType){case"disc":h=`<svg width="${d*2}" height="${d*2}" xmlns="http://www.w3.org/2000/svg">
4
+ }`)),document.head.appendChild(r),this}get(t){let e;return t&&(e=this.loaded.get(this.familyToUrl.get(t)??t)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){const e=this.familyToUrl.get(t)??t;return this.familyToUrl.delete(e),this.loaded.delete(e),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...i}=e,{src:a}=t;if(this.loaded.has(a))return r&&(this.loading.forEach(f=>f.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,i),this.loading.set(a,l)),r&&this.loading.forEach((f,g)=>{f!==l&&(f.cancel(),this.loading.delete(g))}),l.when.then(f=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const g=u(f);return e.noAdd||this.loaded.set(t.src,g),g.familySet.forEach(d=>{this.familyToUrl.set(d,a),typeof document<"u"&&(n&&this.injectFontFace(d,f),o&&this.injectStyleTag(d,a))}),g}}).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(g=>{f.familySet.add(g)}),f}function u(f=new ArrayBuffer(0)){let g;function d(){return g||(g=f.byteLength?no(f,!1):void 0),g}function m(){const p=d();if(p instanceof At||p instanceof xr)return p.sfnt}return{...t,buffer:f,familySet:new Set(h()),getFont:d,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}};Se(Cn,"defaultRequestInit",{cache:"force-cache"});let oo=Cn;const ao=new oo,lo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Pn(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=o,s.lineJoin=lo[i],s.miterLimit=a,s.setLineDash(l),s.lineDashOffset=h,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=f,s.shadowColor=g}class v{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new v(1/0,1/0)}static get MIN(){return new v(-1/0,-1/0)}get array(){return[this.x,this.y]}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,o=-(this.y-e.y),i=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*i),e.y-(n*i+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,o=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new v(this.x,this.y)}}class L{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 L;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,o)=>(n.left=Math.min(n.left,o.left),n.top=Math.min(n.top,o.top),n.right=Math.max(n.right,o.right),n.bottom=Math.max(n.bottom,o.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new L(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 L(this.left,this.top,this.width,this.height)}}var ho=Object.defineProperty,co=(s,t,e)=>t in s?ho(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,uo=(s,t,e)=>(co(s,t+"",e),e);class vt{constructor(t=1,e=0,r=0,n=0,o=1,i=0,a=0,l=0,h=1){uo(this,"elements",[]),this.set(t,e,r,n,o,i,a,l,h)}set(t,e,r,n,o,i,a,l,h){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=o,c[5]=l,c[6]=r,c[7]=i,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,o=this.elements,i=r[0],a=r[3],l=r[6],h=r[1],c=r[4],u=r[7],f=r[2],g=r[5],d=r[8],m=n[0],p=n[3],b=n[6],M=n[1],S=n[4],I=n[7],w=n[2],x=n[5],A=n[8];return o[0]=i*m+a*M+l*w,o[3]=i*p+a*S+l*x,o[6]=i*b+a*I+l*A,o[1]=h*m+c*M+u*w,o[4]=h*p+c*S+u*x,o[7]=h*b+c*I+u*A,o[2]=f*m+g*M+d*w,o[5]=f*p+g*S+d*x,o[8]=f*b+g*I+d*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*i-a*h,f=a*l-c*o,g=h*o-i*l,d=e*u+r*f+n*g;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=u*m,t[1]=(n*h-c*r)*m,t[2]=(a*r-n*i)*m,t[3]=f*m,t[4]=(c*e-n*l)*m,t[5]=(n*o-a*e)*m,t[6]=g*m,t[7]=(r*l-h*e)*m,t[8]=(i*e-r*o)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(vr.makeScale(t,e)),this}rotate(t){return this.premultiply(vr.makeRotation(-t)),this}translate(t,e){return this.premultiply(vr.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 vr=new vt;function Tn(s,t,e,r){const n=s*e+t*r,o=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let i=Math.acos(Math.max(-1,Math.min(1,n/o)));return s*r-t*e<0&&(i=-i),i}function fo(s,t,e,r,n,o,i,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(i.x-a.x)/2,h=(i.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,u=-Math.sin(r)*l+Math.cos(r)*h;let f=t*t,g=e*e;const d=c*c,m=u*u,p=d/f+m/g;if(p>1){const E=Math.sqrt(p);t=E*t,e=E*e,f=t*t,g=e*e}const b=f*m+g*d,M=(f*g-b)/b;let S=Math.sqrt(Math.max(0,M));n===o&&(S=-S);const I=S*t*u/e,w=-S*e*c/t,x=Math.cos(r)*I-Math.sin(r)*w+(i.x+a.x)/2,A=Math.sin(r)*I+Math.cos(r)*w+(i.y+a.y)/2,C=Tn(1,0,(c-I)/t,(u-w)/e),P=Tn((c-I)/t,(u-w)/e,(-c-I)/t,(-u-w)/e)%(Math.PI*2);s.ellipse(x,A,t,e,r,C,C+P,o===1)}function ie(s,t){return s-(t-s)}function _n(s,t){const e=new v,r=new v;for(let n=0,o=s.length;n<o;n++){const i=s[n];if(i.type==="m"||i.type==="M")i.type==="m"?e.add(i):e.copy(i),t.moveTo(e.x,e.y),r.copy(e);else if(i.type==="h"||i.type==="H")i.type==="h"?e.x+=i.x:e.x=i.x,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="v"||i.type==="V")i.type==="v"?e.y+=i.y:e.y=i.y,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="l"||i.type==="L")i.type==="l"?e.add(i):e.copy(i),t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="c"||i.type==="C")i.type==="c"?(t.bezierCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(t.bezierCurveTo(ie(e.x,r.x),ie(e.y,r.y),e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(ie(e.x,r.x),ie(e.y,r.y),i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(t.quadraticCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x,e.y+i.y),r.x=e.x+i.x1,r.y=e.y+i.y1,e.add(i)):(t.quadraticCurveTo(i.x1,i.y1,i.x,i.y),r.x=i.x1,r.y=i.y1,e.copy(i));else if(i.type==="t"||i.type==="T"){const a=ie(e.x,r.x),l=ie(e.y,r.y);r.x=a,r.y=l,i.type==="t"?(t.quadraticCurveTo(a,l,e.x+i.x,e.y+i.y),e.add(i)):(t.quadraticCurveTo(a,l,i.x,i.y),e.copy(i))}else if(i.type==="a"||i.type==="A"){const a=e.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;e.add(i)}else{if(e.equals(i))continue;e.copy(i)}r.copy(e),fo(t,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,e)}else i.type==="z"||i.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",i)}}const K={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(s,t,e=0){let a=0,l=!0,h="",c="";const u=[];function f(p,b,M){const S=new SyntaxError(`Unexpected character "${p}" at index ${b}.`);throw S.partial=M,S}function g(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let d;const m=s.length;for(let p=0;p<m;p++){if(d=s[p],Array.isArray(t)&&t.includes(u.length%e)&&K.FLAGS.test(d)){a=1,h=d,g();continue}if(a===0){if(K.WHITESPACE.test(d))continue;if(K.DIGIT.test(d)||K.SIGN.test(d)){a=1,h=d;continue}if(K.POINT.test(d)){a=2,h=d;continue}K.COMMA.test(d)&&(l&&f(d,p,u),l=!0)}if(a===1){if(K.DIGIT.test(d)){h+=d;continue}if(K.POINT.test(d)){h+=d,a=2;continue}if(K.EXP.test(d)){a=3;continue}K.SIGN.test(d)&&h.length===1&&K.SIGN.test(h[0])&&f(d,p,u)}if(a===2){if(K.DIGIT.test(d)){h+=d;continue}if(K.EXP.test(d)){a=3;continue}K.POINT.test(d)&&h[h.length-1]==="."&&f(d,p,u)}if(a===3){if(K.DIGIT.test(d)){c+=d;continue}if(K.SIGN.test(d)){if(c===""){c+=d;continue}c.length===1&&K.SIGN.test(c)&&f(d,p,u)}}K.WHITESPACE.test(d)?(g(),a=0,l=!1):K.COMMA.test(d)?(g(),a=0,l=!0):K.SIGN.test(d)?(g(),a=1,h=d):K.POINT.test(d)?(g(),a=2,h=d):f(d,p,u)}return g(),u}function po(s){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=s.length;n<o;n++){const i=s[n];switch(i.type){case"m":case"M":if(i.x===e.x&&i.y===e.y)continue;r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y,t.x=i.x,t.y=i.y;break;case"h":case"H":r+=`${i.type} ${i.x}`,e.x=i.x;break;case"v":case"V":r+=`${i.type} ${i.y}`,e.y=i.y;break;case"l":case"L":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"c":case"C":r+=`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"s":case"S":r+=`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"q":case"Q":r+=`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"t":case"T":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"a":case"A":r+=`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"z":case"Z":r+=i.type,e.x=t.x,e.y=t.y;break}}return r}const go=/[a-df-z][^a-df-z]*/gi;function In(s){const t=[],e=s.match(go);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],i=o.charAt(0),a=o.slice(1).trim();let l;switch(i){case"m":case"M":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:i,x:l[h],y:l[h+1]}):t.push({type:i==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,x:l[h]});break;case"v":case"V":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,y:l[h]});break;case"l":case"L":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"c":case"C":l=Ut(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:i,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"a":case"A":l=Ut(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:i,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":t.push({type:i});break;default:console.warn(o)}}return t}var yo=Object.defineProperty,mo=(s,t,e)=>t in s?yo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,br=(s,t,e)=>(mo(s,typeof t!="symbol"?t+"":t,e),e);class Yt{constructor(){br(this,"arcLengthDivisions",200),br(this,"_cacheArcLengths"),br(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new v){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),o=0;e.push(0);for(let i=1;i<=t;i++)r=this.getPoint(i/t),o+=r.distanceTo(n),e.push(o),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const o=r.length;let i;e?i=e:i=t*r[o-1];let a=0,l=o-1,h;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),h=r[n]-i,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===i)return n/(o-1);const c=r[n],f=r[n+1]-c,g=(i-c)/f;return(n+g)/(o-1)}getTangent(t,e=new v){const n=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new v){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,o=(r+n)/2;for(;n-r>e;){o=(r+n)/2;const i=this.getPoint(o);if(i.distanceTo(t)<e)return o;i.x<t.x?r=o:n=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=v.MAX,e=v.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new L(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 po(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Dn(s,t,e,r,n){const o=(r-t)*.5,i=(n-e)*.5,a=s*s,l=s*a;return(2*e-2*r+o+i)*l+(-3*e+3*r-2*o-i)*a+o*s+e}function wo(s,t){const e=1-s;return e*e*t}function xo(s,t){return 2*(1-s)*s*t}function vo(s,t){return s*s*t}function An(s,t,e,r){return wo(s,t)+xo(s,e)+vo(s,r)}function bo(s,t){const e=1-s;return e*e*e*t}function Mo(s,t){const e=1-s;return 3*e*e*s*t}function So(s,t){return 3*(1-s)*s*s*t}function Co(s,t){return s*s*s*t}function On(s,t,e,r,n){return bo(s,t)+Mo(s,e)+So(s,r)+Co(s,n)}class Po extends Yt{constructor(t=new v,e=new v,r=new v,n=new v){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new v){const{start:r,startControl:n,endControl:o,end:i}=this;return e.set(On(t,r.x,n.x,o.x,i.x),On(t,r.y,n.y,o.y,i.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const o=Math.sqrt(n),i=(-e+o)/(2*t),a=(-e-o)/(2*t);return[i,a].filter(l=>l>=0&&l<=1)}getMinMax(t=v.MAX,e=v.MIN){const r=this.start,n=this.startControl,o=this.endControl,i=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(i.x-o.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(i.y-o.y)),h=[0,1,...a,...l];return((u,f)=>{for(const g of u)for(let d=0;d<=f;d++){const m=d/f-.5,p=Math.min(1,Math.max(0,g+m)),b=this.getPoint(p);t.x=Math.min(t.x,b.x),t.y=Math.min(t.y,b.y),e.x=Math.max(e.x,b.x),e.y=Math.max(e.y,b.y)}})(h,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{start:e,startControl:r,endControl:n,end:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,o.x,o.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const To=new vt,Nn=new vt,zn=new vt,We=new v;class _o extends Yt{constructor(t=new v,e=1,r=1,n=0,o=0,i=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=i,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new v){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(o?n=0:n=r),this.clockwise&&!o&&(n===r?n=-r:n=n-r);const i=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(i),l=this.center.y+this.radiusY*Math.sin(i);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,f=l-this.center.y;a=u*h-f*c+this.center.x,l=u*c+f*h+this.center.y}return e.set(a,l)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:i,rotation:a}=this,{x:l,y:h}=t,c=l+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=h+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),f=Math.abs(n-o),g=f>Math.PI?1:0,d=i?1:0,m=a*180/Math.PI;if(f>=2*Math.PI){const p=n+Math.PI,b=l+e*Math.cos(p)*Math.cos(a)-r*Math.sin(p)*Math.sin(a),M=h+e*Math.cos(p)*Math.sin(a)+r*Math.sin(p)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:d,x:b,y:M},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:d,x:c,y:u}]}else{const p=l+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),b=h+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:g,sweepFlag:d,x:p,y:b}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:i,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,n,o,i,a,!l),this}matrix(t){return We.set(this.center.x,this.center.y),We.applyMatrix3(t),this.center.x=We.x,this.center.y=We.y,Ao(t)?Io(this,t):Do(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=v.MAX,e=v.MIN){const{center:r,radiusX:n,radiusY:o,rotation:i}=this,{x:a,y:l}=r,h=Math.cos(i),c=Math.sin(i),u=Math.sqrt(n*n*h*h+o*o*c*c),f=Math.sqrt(n*n*c*c+o*o*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,l-f),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,l+f),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Io(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),o=Math.sin(s.rotation),i=new v(e*n,e*o),a=new v(-r*o,r*n),l=i.applyMatrix3(t),h=a.applyMatrix3(t),c=To.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=Nn.copy(c).invert(),d=zn.copy(u).transpose().multiply(u).elements,m=Oo(d[0],d[1],d[4]),p=Math.sqrt(m.rt1),b=Math.sqrt(m.rt2);if(s.radiusX=1/p,s.radiusY=1/b,s.rotation=Math.atan2(m.sn,m.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const S=Nn.set(p,0,0,0,b,0,0,0,1),I=zn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=S.multiply(I).multiply(c),x=A=>{const{x:C,y:P}=new v(Math.cos(A),Math.sin(A)).applyMatrix3(w);return Math.atan2(P,C)};s.startAngle=x(s.startAngle),s.endAngle=x(s.endAngle),Un(t)&&(s.clockwise=!s.clockwise)}}function Do(s,t){const e=Ln(t),r=En(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,Un(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function Un(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Ao(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Ln(s),n=En(s);return Math.abs(e/(r*n))>Number.EPSILON}function Ln(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function En(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Oo(s,t,e){let r,n,o,i,a;const l=s+e,h=s-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,n=s*a*e-t*a*t):l<0?n=.5*(l-c):(r=.5*c,n=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,i=1/Math.sqrt(1+a*a),o=a*i):Math.abs(t)===0?(o=1,i=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),i=a*o),h>0&&(a=o,o=-i,i=a),{rt1:r,rt2:n,cs:o,sn:i}}class Mr extends Yt{constructor(t=new v,e=new v){super(),this.start=t,this.end=e}getPoint(t,e=new v){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new v){return this.getPoint(t,e)}getTangent(t,e=new v){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new v){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class No extends Yt{constructor(t=new v,e=new v,r=new v){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new v){const{start:r,control:n,end:o}=this;return e.set(An(t,r.x,n.x,o.x),An(t,r.y,n.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,control:n,end:o}=this,i=.5*(r.x+n.x),a=.5*(r.y+n.y),l=.5*(r.x+o.x),h=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,i,l),t.y=Math.min(t.y,r.y,o.y,a,h),e.x=Math.max(e.x,r.x,o.x,i,l),e.y=Math.max(e.y,r.y,o.y,a,h),{min:t,max:e}}toCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{start:e,control:r,end:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var zo=Object.defineProperty,Uo=(s,t,e)=>t in s?zo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,$n=(s,t,e)=>(Uo(s,typeof t!="symbol"?t+"":t,e),e);class Lo extends Yt{constructor(t,e,r=1,n=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=o,$n(this,"curves",[]),$n(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,n=this.rx/this.aspectRatio,o=[new v(t-r,e-n),new v(t+r,e-n),new v(t+r,e+n),new v(t-r,e+n)];for(let i=0;i<4;i++)this.curves.push(new Mr(o[i].clone(),o[(i+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Eo extends Yt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new v){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),i=n-o,a=r[o===0?o:o-1],l=r[o],h=r[o>r.length-2?r.length-1:o+1],c=r[o>r.length-3?r.length-1:o+2];return e.set(Dn(i,a.x,l.x,h.x,c.x),Dn(i,a.y,l.y,h.y,c.y)),e}getControlPoints(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var $o=Object.defineProperty,ko=(s,t,e)=>t in s?$o(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ce=(s,t,e)=>(ko(s,typeof t!="symbol"?t+"":t,e),e);class Pe extends Yt{constructor(t){super(),Ce(this,"curves",[]),Ce(this,"startPoint"),Ce(this,"currentPoint",new v),Ce(this,"autoClose",!1),Ce(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:n,y:o}=t[e];this.lineTo(n,o)}return this}addCommands(t){return _n(t,this),this}addData(t){return this.addCommands(In(t)),this}getPoint(t,e=new v){const r=t*this.getLength(),n=this.getCurveLengths();let o=0;for(;o<n.length;){if(n[o]>=r){const i=n[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-i/l,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let o=0,i=r.length;o<i;o++){const l=r[o].getPoints(t);for(let h=0;h<l.length;h++){const c=l[h];n!=null&&n.equals(c)||(e.push(c),n=c)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new Mr(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new Mr(this.currentPoint.clone(),new v(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPoint.equals({x:o,y:i})||this.curves.push(new Po(this.currentPoint.clone(),new v(t,e),new v(r,n),new v(o,i))),this._setCurrentPoint({x:o,y:i}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new No(this.currentPoint.clone(),new v(t,e),new v(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,i){return this.ellipse(t,e,r,r,0,n,o,i),this}relativeArc(t,e,r,n,o,i){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,i),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,i,a,l=!0){const h=new _o(new v(t,e),r,n,o,i,a,!l);if(this.curves.length>0){const c=h.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,e,r,n,o,i,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,n,o,i,a,l),this}rect(t,e,r,n){return this.curves.push(new Lo(new v(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Eo([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new L(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Bo(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function jo(s,t,e,r){const n=t.clone().sub(s),o=r.clone().sub(e),i=e.clone().sub(s),a=n.cross(o);if(a===0)return new v((s.x+e.x)/2,(s.y+e.y)/2);const l=i.cross(o)/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)}var Fo=Object.defineProperty,Go=(s,t,e)=>t in s?Fo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Sr=(s,t,e)=>(Go(s,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){Sr(this,"currentPath",new Pe),Sr(this,"paths",[this.currentPath]),Sr(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof bt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new Pe().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r.equals({x:t,y:e})||(n.length?(this.currentPath=new Pe().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,o,i){return this.currentPath.bezierCurveTo(t,e,r,n,o,i),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,i){return this.currentPath.arc(t,e,r,n,o,i),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,i,a,l){return this.currentPath.ellipse(t,e,r,n,o,i,a,l),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return _n(t,this),this}addData(t){return this.addCommands(In(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],n=[],o=[];e.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();o[l]=h,n[l]=c;const u=h[0],f=h[h.length-1]??u;r.push({start:c?f:u,end:c?u:f,index:l})});const i=[];return r.forEach((a,l)=>{i[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&i[l].push(h.index)})}),e.forEach((a,l)=>{const h=n[l];o[l].forEach(u=>{const f=a.getTForPoint(u),g=a.getNormal(f).scale(h?t:-t);u.add(g)})}),i.forEach((a,l)=>{const h=o[l];a.forEach(c=>{const u=o[c],f=jo(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(o=>{if(o.getMinMax(t,e),r&&n>1){const i=n/2,a=o.isClockwise(),l=[];for(let h=0;h<=1;h+=1/o.arcLengthDivisions){const c=o.getPoint(h),u=o.getNormal(h),f=u.clone().scale(a?i:-i),g=u.clone().scale(a?-i:i);l.push(c.clone().add(f),c.clone().add(g),c.clone().add({x:i,y:0}),c.clone().add({x:-i,y:0}),c.clone().add({x:0,y:i}),c.clone().add({x:0,y:-i}),c.clone().add({x:i,y:i}),c.clone().add({x:-i,y:-i}))}t.min(...l),e.max(...l)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new L(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),Pn(t,e),this.paths.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),Pn(t,e),this.getControlPoints().forEach(o=>{t.moveTo(o.x,o.y),t.arc(o.x,o.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[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(),o=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:i,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=i*e,l.height=a*e,l.style.width=`${i}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-n,-o),this.drawTo(h,r)),l}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const Cr="px",kn=90,Bn=["mm","cm","in","pt","pc","px"],Pr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function $(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Bn.length;r<n;r++){const o=Bn[r];if(s.endsWith(o)){t=o,s=s.substring(0,s.length-o.length);break}}let e;return t==="px"&&Cr!=="px"?e=Pr.in[Cr]/kn:(e=Pr[t][Cr],e<0&&(e=Pr[t].in*kn)),e*Number.parseFloat(s)}const qo=new vt,Ve=new vt,jn=new vt,Fn=new vt;function Ro(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Wo(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Wo(s){const t=new vt,e=qo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate($(s.getAttribute("x")),$(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const i=o.indexOf("("),a=o.length;if(i>0&&i<a){const l=o.slice(0,i),h=Ut(o.slice(i+1));switch(e.identity(),l){case"translate":if(h.length>=1){const c=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(c,u)}break;case"rotate":if(h.length>=1){let c=0,u=0,f=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],f=h[2]),Ve.makeTranslation(-u,-f),jn.makeRotation(c),Fn.multiplyMatrices(jn,Ve),Ve.makeTranslation(u,f),e.multiplyMatrices(Ve,Fn)}break;case"scale":h.length>=1&&e.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&e.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&e.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&e.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}t.premultiply(e)}}return t}function Vo(s){return new bt().addPath(new Pe().arc($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("r")||0),0,Math.PI*2))}function Qo(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim()),o={};for(let i=r.style.length,a=0;a<i;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let i=0;i<n.length;i++)t[n[i]]=Object.assign(t[n[i]]||{},{...o})}}function Xo(s){return new bt().addPath(new Pe().ellipse($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("rx")||0),$(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Yo(s){return new bt().moveTo($(s.getAttribute("x1")||0),$(s.getAttribute("y1")||0)).lineTo($(s.getAttribute("x2")||0),$(s.getAttribute("y2")||0))}function Ho(s){const t=new bt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Zo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ko(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Zo,(n,o,i)=>{const a=$(o),l=$(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!0,t}const Jo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ta(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Jo,(n,o,i)=>{const a=$(o),l=$(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!1,t}function ea(s){const t=$(s.getAttribute("x")||0),e=$(s.getAttribute("y")||0),r=$(s.getAttribute("rx")||s.getAttribute("ry")||0),n=$(s.getAttribute("ry")||s.getAttribute("rx")||0),o=$(s.getAttribute("width")),i=$(s.getAttribute("height")),a=1-.551915024494,l=new bt;return l.moveTo(t+r,e),l.lineTo(t+o-r,e),(r!==0||n!==0)&&l.bezierCurveTo(t+o-r*a,e,t+o,e+n*a,t+o,e+n),l.lineTo(t+o,e+i-n),(r!==0||n!==0)&&l.bezierCurveTo(t+o,e+i-n*a,t+o-r*a,e+i,t+o-r,e+i),l.lineTo(t+r,e+i),(r!==0||n!==0)&&l.bezierCurveTo(t+r*a,e+i,t,e+i-n*a,t,e+i-n),l.lineTo(t,e+n),(r!==0||n!==0)&&l.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),l}function Lt(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)r=Object.assign(r,e[`.${h[c]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let h=s.style.length,c=0;c<h;c++){const u=s.style.item(c),f=s.style.getPropertyValue(u);t[u]=f,r[u]=f}function n(h,c,u=o){s.hasAttribute(h)&&(t[c]=u(s.getAttribute(h))),r[h]&&(t[c]=u(r[h]))}function o(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function i(h){return Math.max(0,Math.min(1,$(h)))}function a(h){return Math.max(0,$(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>$(c))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",l),n("stroke-dashoffset","strokeDashoffset",$),n("visibility","visibility"),t}function Tr(s,t,e=[],r={}){var u;if(s.nodeType!==1)return e;let n=!1,o=null,i={...t};switch(s.nodeName){case"svg":i=Lt(s,i,r);break;case"style":Qo(s,r);break;case"g":i=Lt(s,i,r);break;case"path":i=Lt(s,i,r),s.hasAttribute("d")&&(o=Ho(s));break;case"rect":i=Lt(s,i,r),o=ea(s);break;case"polygon":i=Lt(s,i,r),o=Ko(s);break;case"polyline":i=Lt(s,i,r),o=ta(s);break;case"circle":i=Lt(s,i,r),o=Vo(s);break;case"ellipse":i=Lt(s,i,r),o=Xo(s);break;case"line":i=Lt(s,i,r),o=Yo(s);break;case"defs":n=!0;break;case"use":{i=Lt(s,i,r);const g=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=(u=s.viewportElement)==null?void 0:u.getElementById(g);d?Tr(d,i,e,r):console.warn(`'use node' references non-existent node id: ${g}`);break}default:console.warn(s);break}if(i.display==="none")return e;Object.assign(t,i);const a=new vt,l=[],h=Ro(s,a,l);o&&(o.matrix(a),e.push(o),o.style=t);const c=s.childNodes;for(let f=0,g=c.length;f<g;f++){const d=c[f];n&&d.nodeName!=="style"&&d.nodeName!=="defs"||Tr(d,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Gn="data:image/svg+xml;",qn=`${Gn}base64,`,Rn=`${Gn}charset=utf8,`;function ra(s){if(typeof s=="string"){let t;return s.startsWith(qn)?(s=s.substring(qn.length,s.length),t=atob(s)):s.startsWith(Rn)?(s=s.substring(Rn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Wn(s){return Tr(ra(s),{})}function Qe(s,t=!0){if(!s.length)return;const e=v.MAX,r=v.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new L(e.x,e.y,r.x-e.x,r.y-e.y)}const na=new Set(["©","®","÷"]),sa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),ia={1:"italic",32:"bold"},oa={1:"italic",2:"bold"},Vn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Qn{constructor(t,e,r){O(this,"path",new bt);O(this,"lineBox",new L);O(this,"inlineBox",new L);O(this,"glyphBox");O(this,"underlinePosition",0);O(this,"underlineThickness",0);O(this,"strikeoutPosition",0);O(this,"strikeoutSize",0);O(this,"ascender",0);O(this,"descender",0);O(this,"typoAscender",0);O(this,"typoDescender",0);O(this,"typoLineGap",0);O(this,"winAscent",0);O(this,"winDescent",0);O(this,"xHeight",0);O(this,"capHeight",0);O(this,"baseline",0);O(this,"centerDiviation",0);O(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??ao,n=e?r.get(e):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{hhea:e,os2:r,post:n,head:o}=t,i=o.unitsPerEm,a=e.ascent,l=e.descent,{content:h,computedStyle:c}=this,{fontSize:u}=c,f=i/u,g=t.getAdvanceWidth(h,u),d=(a+Math.abs(l))/f,m=a/f;return this.inlineBox.width=g,this.inlineBox.height=d,this.underlinePosition=(a-n.underlinePosition)/f,this.underlineThickness=n.underlineThickness/f,this.strikeoutPosition=(a-r.yStrikeoutPosition)/f,this.strikeoutSize=r.yStrikeoutSize/f,this.ascender=a/f,this.descender=l/f,this.typoAscender=r.sTypoAscender/f,this.typoDescender=r.sTypoDescender/f,this.typoLineGap=r.sTypoLineGap/f,this.winAscent=r.usWinAscent/f,this.winDescent=r.usWinDescent/f,this.xHeight=r.sxHeight/f,this.capHeight=r.sCapHeight/f,this.baseline=m,this.centerDiviation=d/2-m,this.fontStyle=ia[r.fsSelection]??oa[o.macStyle],this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:n,computedStyle:o,baseline:i,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u}=this,{left:f,top:g}=a,d=o.fontStyle==="italic"&&u!=="italic";let m=f,p=g+i,b;const M=new bt;if(r&&(m+=(a.height-a.width)/2,Math.abs(a.width-a.height)>.1&&(p-=(l-c)/(l+Math.abs(h))*a.height),b=void 0),r&&!na.has(n)&&(n.codePointAt(0)<=256||sa.has(n))){M.addCommands(e.getPathCommands(n,m,g+i-(a.height-a.width)/2,o.fontSize)??[]);const I={y:g-(a.height-a.width)/2+a.height/2,x:m+a.width/2};d&&this._italic(M,r?{x:I.x,y:g-(a.height-a.width)/2+i}:void 0),M.rotate(90,I)}else b!==void 0?(M.addCommands(e.glyphs.get(b).getPathCommands(m,p,o.fontSize)),d&&this._italic(M,r?{x:m+a.width/2,y:g+c/(l+Math.abs(h))*a.height}:void 0)):(M.addCommands(e.getPathCommands(n,m,p,o.fontSize)??[]),d&&this._italic(M,r?{x:m+a.height/2,y:p}:void 0));const S=o.fontWeight??400;return S in Vn&&(S===700||S==="bold")&&u!=="bold"&&M.bold(Vn[S]*o.fontSize*.05),M.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=M,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 L(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){Jt({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function Ht(s){return!s||s==="none"}function Xe(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}class Xn{constructor(t,e={},r){O(this,"inlineBox",new L);this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Xe(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Qn(r,e++,this));return this.characters=t,this}}class oe{constructor(t,e){O(this,"lineBox",new L);O(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Xe(this.parentStyle),...Xe(this.style)},this}addFragment(t,e){const r=new Xn(t,e,this);return this.fragments.push(r),r}}function aa(s){return s}class Yn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(i=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(i.style)),i.fragments.forEach(l=>{const h=document.createElement("span");Object.assign(h.style,this._styleToDomStyle(l.style)),h.appendChild(document.createTextNode(l.content)),/\s/.test(l.content)&&(h.style.whiteSpace="pre"),a.appendChild(h)}),o.appendChild(a)}),n.appendChild(o),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var i;return(i=n.parentNode)==null?void 0:i.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,i)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((l,h)=>{var f;const c=l.getBoundingClientRect();r.push({paragraphIndex:i,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});const u=l.firstChild;if(u instanceof window.Text){const g=document.createRange();g.selectNodeContents(u);const d=u.data?u.data.length:0;let m=0;for(;m<=d;){g.setStart(u,Math.max(m-1,0)),g.setEnd(u,m);const p=((f=g.getClientRects)==null?void 0:f.call(g))??[g.getBoundingClientRect()];let b=p[p.length-1];p.length>1&&b.width<2&&(b=p[p.length-2]);const M=g.toString();M!==""&&b&&b.width+b.height!==0&&n.push({content:M,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:m-1,top:b.top,left:b.left,height:b.height,width:b.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=this._measureDom(t);n.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),n.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let i=0;return n.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const u=e[l].fragments[h].characters[c],f=o[i];u.inlineBox.left=f.left,u.inlineBox.top=f.top,u.inlineBox.width=f.width,u.inlineBox.height=f.height;const g=u.fontHeight;u.lineBox.left=f.left,u.lineBox.top=f.top+(f.height-g)/2,u.lineBox.height=g,u.lineBox.width=f.width,i++}),{paragraphs:e,boundingBox:new L(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}const la="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function ha(s,t,e){if(s==="cover")return 0;if(typeof s=="string")if(s.endsWith("%")){const r=Number(s.substring(0,s.length-1))/100;return Math.ceil(r*e/t)}else return s.endsWith("rem")?Number(s.substring(0,s.length-3)):Math.ceil(Number(s)/t);else return Math.ceil(s/t)}function ca(s,t,e){return typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function ua(s,t,e,r,n){let o;r?o={x:e.width/t.height,y:e.height/t.width}:o={x:e.width/t.width,y:e.height/t.height};const i=e.center.add(s.center.sub(t.center).scale(o.x,o.y));n==="line"?i.sub({x:s.width/2*o.x,y:s.height*o.y}):i.sub({x:s.width/2*o.x,y:s.height/2*o.y});const a=new vt;return a.translate(-s.left,-s.top),r&&(a.translate(-s.width/2,-s.height/2),a.rotate(Math.PI/2),a.translate(s.width/2,s.height/2)),a.scale(o.x,o.y),a.translate(i.x,i.y),a}function Hn(){const s=[],t=[],e=new Map;function r(n){let o=e.get(n);return o||(o=Wn(n),e.set(n,o)),o}return{name:"highlight",paths:s,update:n=>{s.length=0;const o=[];let i,a;n.forEachCharacter(l=>{const{isVertical:h,computedStyle:c,inlineBox:u,fontSize:f}=l;!Ht(c.highlightImage)&&l.glyphBox&&(c.highlightSize!=="1rem"&&(a==null?void 0:a.highlightImage)===c.highlightImage&&(a==null?void 0:a.highlightSize)===c.highlightSize&&(a==null?void 0:a.highlightStrokeWidth)===c.highlightStrokeWidth&&(a==null?void 0:a.highlightOverflow)===c.highlightOverflow&&(i!=null&&i.length)&&(h?i[0].inlineBox.left===u.left:i[0].inlineBox.top===u.top)&&i[0].fontSize===f?i.push(l):(i=[],i.push(l),o.push(i))),a=c}),o.filter(l=>l.length).map(l=>({char:l[0],groupBox:L.from(...l.map(c=>c.glyphBox))})).forEach(l=>{const{char:h,groupBox:c}=l,u=h.computedStyle,{fontSize:f,writingMode:g}=u,d=g.includes("vertical"),m=ca(u.highlightStrokeWidth,f,c.width),p=ha(u.highlightSize,f,c.width),b=Ht(u.highlightOverflow)?p?"hidden":"visible":u.highlightOverflow,M=r(Ht(u.highlightReferImage)?la:u.highlightReferImage),S=r(u.highlightImage),I=Qe(S,!0),w=Qe(M,!1),x=p?f*p:d?c.height:c.width;let A,C;I.height/w.height>.8?(C="block",A=c.height):(C="line",A=h.inlineBox.top-c.top+h.underlinePosition);const P=ua(I,w,new L(c.left,c.top,d?A:x,d?x:A),d,C),E=f/I.width*2,V=Math.ceil(c.width/x);for(let B=0;B<V;B++){const Mt=P.clone().translate(B*x,0);S.forEach(N=>{const D=N.clone().matrix(Mt);D.style.strokeWidth&&(D.style.strokeWidth*=E*m),D.style.strokeMiterlimit&&(D.style.strokeMiterlimit*=E),D.style.strokeDashoffset&&(D.style.strokeDashoffset*=E),D.style.strokeDasharray&&(D.style.strokeDasharray=D.style.strokeDasharray.map(j=>j*E)),s.push(D),t[s.length-1]=b==="hidden"?new L(c.left,c.top-c.height,c.width,c.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{s.forEach((i,a)=>{Jt({ctx:n,path:i,clipRect:t[a],fontSize:o.computedStyle.fontSize})})}}}function Zn(s,t,e){return s==="cover"?1:typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Kn(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,o=n*.45;e.forEach(i=>{const{computedStyle:a}=i;let l=a.listStyleSize,h;if(!Ht(a.listStyleImage))h=a.listStyleImage;else if(!Ht(a.listStyleType)){const d=n*.38/2;switch(l=l==="cover"?d*2:l,a.listStyleType){case"disc":h=`<svg width="${d*2}" height="${d*2}" xmlns="http://www.w3.org/2000/svg">
5
5
  <circle cx="${d}" cy="${d}" r="${d}" fill="${a.color}" />
6
- </svg>`;break}}if(!h)return;const c=Wn(h),u=Qe(c),f=i.lineBox,g=i.fragments[0].inlineBox;if(g){const d=new bt;if(r){const m=Zn(l,n,n),p=n/u.height*m;d.translate(-u.left,-u.top),d.rotate(Math.PI/2),d.scale(p,p),d.translate(n/2-u.height*p/2,0),d.translate(f.left+(f.width-n)/2,g.top-o)}else{const m=Zn(l,n,n),p=n/u.height*m;d.translate(-u.left,-u.top),d.translate(-u.width,0),d.scale(p,p),d.translate(0,n/2-u.height*p/2),d.translate(g.left-o,f.top+(f.height-n)/2)}s.push(...c.map(m=>m.clone().matrix(d)))}})}}}const Wt=new v,ae=new bt,Vt=new bt;function Jn(){return{name:"render",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(o=>{r==null||r.forEach(i=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),l=Ye(s,i);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=(i.shadowOffsetX??0)*e,c=(i.shadowOffsetY??0)*e,u=Math.max(.1,i.textStrokeWidth??0)*e;a.left+=h-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?L.from(...n):void 0},render:(s,t)=>{const{paragraphs:e,glyphBox:r,effects:n,style:o}=t;function i(a,l){s.fillStyle=a,s.fillRect(l.left,l.top,l.width,l.height)}o!=null&&o.backgroundColor&&i(o.backgroundColor,new L(0,0,s.canvas.width,s.canvas.height)),e.forEach(a=>{var l;(l=a.style)!=null&&l.backgroundColor&&i(a.style.backgroundColor,a.lineBox)}),n?n.forEach(a=>{Ot(a,r,s),s.save();const[l,h,c,u,f,g]=Ye(t,a).transpose().elements;s.transform(l,u,h,f,c,g),t.forEachCharacter(d=>{var m;(m=d.parent.style)!=null&&m.backgroundColor&&i(d.parent.style.backgroundColor,d.inlineBox),d.drawTo(s,a)}),s.restore()}):e.forEach(a=>{a.fragments.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&i(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(s)})})})}}}function Ye(s,t){const{fontSize:e,glyphBox:r}=s,n=(t.translateX??0)*e,o=(t.translateY??0)*e,i=Math.PI*2,a=(t.skewX??0)/360*i,l=(t.skewY??0)/360*i,{left:h,top:c,width:u,height:f}=r,g=h+u/2,d=c+f/2;return ae.identity(),Vt.makeTranslation(n,o),ae.multiply(Vt),Vt.makeTranslation(g,d),ae.multiply(Vt),Vt.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),ae.multiply(Vt),Vt.makeTranslation(-g,-d),ae.multiply(Vt),ae.clone()}function ts(){const s=[];return{name:"textDecoration",paths:s,update:t=>{s.length=0;const e=[];let r,n;t.forEachCharacter(o=>{const{computedStyle:i,underlinePosition:a,underlineThickness:l,strikeoutPosition:h,strikeoutSize:c}=o;if(Ht(i.textDecoration))n=void 0;else{let u=!1;if((n==null?void 0:n.textDecoration)===i.textDecoration&&(n==null?void 0:n.writingMode)===i.writingMode)switch(i.textDecoration){case"underline":r[0].underlinePosition===a&&r[0].underlineThickness===l&&(u=!0);break;case"line-through":r[0].strikeoutPosition===h&&r[0].strikeoutSize===c&&(u=!0);break}u?r.push(o):(r=[],r.push(o),e.push(r)),n=i}}),e.forEach(o=>{const{computedStyle:i,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:u}=o[0],{textDecoration:f}=i,{left:g,top:d,width:m,height:p}=L.from(...o.map(S=>S.inlineBox));let b=a?g:d,M=0;switch(f){case"underline":b+=l,M=h*2;break;case"line-through":b+=c,M=u*2;break}b-=M,a?s.push(new Mt([{type:"M",x:b,y:d},{type:"L",x:b,y:d+p},{type:"L",x:b+M,y:d+p},{type:"L",x:b+M,y:d},{type:"Z"}])):s.push(new Mt([{type:"M",x:g,y:b},{type:"L",x:g+m,y:b},{type:"L",x:g+m,y:b+M},{type:"L",x:g,y:b+M},{type:"Z"}]))})},render:(t,e)=>{const{effects:r,fontSize:n}=e;r?r.forEach(o=>{t.save();const[i,a,l,h,c,u]=Ye(e,o).transpose().elements;t.transform(i,h,a,c,l,u),s.forEach(f=>{Jt({ctx:t,path:f,fontSize:n,...o})}),t.restore()}):s.forEach(o=>{Jt({ctx:t,path:o,fontSize:n})})}}}const _r={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",listStyleType:"none",listStyleImage:"none",listStyleSize:"cover",listStylePosition:"outside",highlightReferImage:"none",highlightImage:"none",highlightSize:"cover",highlightStrokeWidth:"100%",highlightOverflow:"none",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,translateX:0,translateY:0,skewX:0,skewY:0};class Ir{constructor(t={}){D(this,"content");D(this,"style");D(this,"effects");D(this,"measureDom");D(this,"needsUpdate",!0);D(this,"computedStyle",{..._r});D(this,"paragraphs",[]);D(this,"lineBox",new L);D(this,"rawGlyphBox",new L);D(this,"glyphBox",new L);D(this,"pathBox",new L);D(this,"boundingBox",new L);D(this,"measurer",new Yn(this));D(this,"plugins",new Map);D(this,"fonts");const{content:e="",style:r={},measureDom:n,effects:o,fonts:i}=t;this.content=e,this.style=r,this.measureDom=n,this.effects=o,this.fonts=i,this.use(Kn()).use(ts()).use(Hn()).use(Jn())}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((e,r)=>{e.fragments.forEach((n,o)=>{n.characters.forEach((i,a)=>{t(i,{paragraphIndex:r,fragmentIndex:o,characterIndex:a})})})}),this}updateParagraphs(){this.computedStyle={..._r,...this.style};let{content:t,computedStyle:e}=this;const r=[];if(typeof t=="string"){const n=new oe({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const o=new oe({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new oe({},e);n.forEach(i=>{if(typeof i=="string")o.addFragment(i);else{const{content:a,...l}=i;a!==void 0&&o.addFragment(a,l)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...i}=n,a=new oe(i,e);o.forEach(l=>{const{content:h,...c}=l;h!==void 0&&a.addFragment(h,c)}),r.push(a)}else if("content"in n){const{content:o,...i}=n;if(o!==void 0){const a=new oe(i,e);a.addFragment(o),r.push(a)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const e={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),[...this.plugins.values()].sort((o,i)=>(o.updateOrder??0)-(i.updateOrder??0)).forEach(o=>{var i;(i=o.update)==null||i.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in e)r[o]=this[o],this[o]=e[o];return r}getGlyphBox(){const t=v.MAX,e=v.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,e)){const{inlineBox:n}=r,o=new v(n.left,n.top),i=new v(n.left+n.width,n.top+n.height);t.min(o,i),e.max(o,i)}}),new L(t.x,t.y,e.x-t.x,e.y-t.y)}updatePathBox(){const t=[...this.plugins.values()];return this.pathBox=L.from(this.glyphBox,...t.map(e=>e.getBoundingBox?e.getBoundingBox(this):Qe(e.paths??[])).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:e,pathBox:r}=this,n=Math.min(r.left,r.left+t.left-e.left),o=Math.min(r.top,r.top+t.top-e.top),i=Math.max(r.right,r.right+t.right-e.right),a=Math.max(r.bottom,r.bottom+t.bottom-e.bottom);return this.boundingBox=new L(n,o,i-n,a-o),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const e in t)this[e]=t[e];return this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Nr(n,r,this.boundingBox),zr(n,this),[...this.plugins.values()].sort((i,a)=>(i.renderOrder??0)-(a.renderOrder??0)).forEach(i=>{var a;i.render?(a=i.render)==null||a.call(i,n,this):i.paths&&i.paths.forEach(l=>{Jt({ctx:n,path:l,fontSize:this.computedStyle.fontSize})})}),this):this}}function fa(s){return new Ir(s).measure()}function pa(s){return new Ir(s).render(s)}z.Character=Qn,z.Fragment=Xn,z.Measurer=Yn,z.Paragraph=oe,z.Text=Ir,z.defaultTextStyles=_r,z.definePlugin=aa,z.drawPath=Jt,z.filterEmpty=Xe,z.getTransform2D=Ye,z.highlight=Hn,z.isNone=Ht,z.listStyle=Kn,z.measureText=fa,z.parseColor=at,z.render=Jn,z.renderText=pa,z.setupView=Nr,z.textDecoration=ts,z.uploadColor=Ot,z.uploadColors=zr,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});
6
+ </svg>`;break}}if(!h)return;const c=Wn(h),u=Qe(c),f=i.lineBox,g=i.fragments[0].inlineBox;if(g){const d=new vt;if(r){const m=Zn(l,n,n),p=n/u.height*m;d.translate(-u.left,-u.top),d.rotate(Math.PI/2),d.scale(p,p),d.translate(n/2-u.height*p/2,0),d.translate(f.left+(f.width-n)/2,g.top-o)}else{const m=Zn(l,n,n),p=n/u.height*m;d.translate(-u.left,-u.top),d.translate(-u.width,0),d.scale(p,p),d.translate(0,n/2-u.height*p/2),d.translate(g.left-o,f.top+(f.height-n)/2)}s.push(...c.map(m=>m.clone().matrix(d)))}})}}}const Wt=new v,ae=new vt,Vt=new vt;function Jn(){return{name:"render",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(o=>{r==null||r.forEach(i=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),l=Ye(s,i);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=(i.shadowOffsetX??0)*e,c=(i.shadowOffsetY??0)*e,u=Math.max(.1,i.textStrokeWidth??0)*e;a.left+=h-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?L.from(...n):void 0},render:(s,t)=>{const{paragraphs:e,glyphBox:r,effects:n,style:o}=t;function i(a,l){s.fillStyle=a,s.fillRect(l.left,l.top,l.width,l.height)}o!=null&&o.backgroundColor&&i(o.backgroundColor,new L(0,0,s.canvas.width,s.canvas.height)),e.forEach(a=>{var l;(l=a.style)!=null&&l.backgroundColor&&i(a.style.backgroundColor,a.lineBox)}),n?n.forEach(a=>{Ot(a,r,s),s.save();const[l,h,c,u,f,g]=Ye(t,a).transpose().elements;s.transform(l,u,h,f,c,g),t.forEachCharacter(d=>{var m;(m=d.parent.style)!=null&&m.backgroundColor&&i(d.parent.style.backgroundColor,d.inlineBox),d.drawTo(s,a)}),s.restore()}):e.forEach(a=>{a.fragments.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&i(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(s)})})})}}}function Ye(s,t){const{fontSize:e,glyphBox:r}=s,n=(t.translateX??0)*e,o=(t.translateY??0)*e,i=Math.PI*2,a=(t.skewX??0)/360*i,l=(t.skewY??0)/360*i,{left:h,top:c,width:u,height:f}=r,g=h+u/2,d=c+f/2;return ae.identity(),Vt.makeTranslation(n,o),ae.multiply(Vt),Vt.makeTranslation(g,d),ae.multiply(Vt),Vt.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),ae.multiply(Vt),Vt.makeTranslation(-g,-d),ae.multiply(Vt),ae.clone()}function ts(){const s=[];return{name:"textDecoration",paths:s,update:t=>{s.length=0;const e=[];let r,n;t.forEachCharacter(o=>{const{computedStyle:i,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:u,strikeoutSize:f}=o;if(Ht(i.textDecoration))n=void 0;else{let g=!1;if((n==null?void 0:n.textDecoration)===i.textDecoration&&(n==null?void 0:n.writingMode)===i.writingMode&&(a?r[0].inlineBox.left===l.left:r[0].inlineBox.top===l.top))switch(i.textDecoration){case"underline":r[0].underlinePosition===h&&r[0].underlineThickness===c&&(g=!0);break;case"line-through":r[0].strikeoutPosition===u&&r[0].strikeoutSize===f&&(g=!0);break}g?r.push(o):(r=[],r.push(o),e.push(r)),n=i}}),e.forEach(o=>{const{computedStyle:i,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:u}=o[0],{textDecoration:f}=i,{left:g,top:d,width:m,height:p}=L.from(...o.map(S=>S.inlineBox));let b=a?g:d,M=0;switch(f){case"underline":b+=l,M=h*2;break;case"line-through":b+=c,M=u*2;break}b-=M,a?s.push(new bt([{type:"M",x:b,y:d},{type:"L",x:b,y:d+p},{type:"L",x:b+M,y:d+p},{type:"L",x:b+M,y:d},{type:"Z"}])):s.push(new bt([{type:"M",x:g,y:b},{type:"L",x:g+m,y:b},{type:"L",x:g+m,y:b+M},{type:"L",x:g,y:b+M},{type:"Z"}]))})},render:(t,e)=>{const{effects:r,fontSize:n}=e;r?r.forEach(o=>{t.save();const[i,a,l,h,c,u]=Ye(e,o).transpose().elements;t.transform(i,h,a,c,l,u),s.forEach(f=>{Jt({ctx:t,path:f,fontSize:n,...o})}),t.restore()}):s.forEach(o=>{Jt({ctx:t,path:o,fontSize:n})})}}}const _r={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",listStyleType:"none",listStyleImage:"none",listStyleSize:"cover",listStylePosition:"outside",highlightReferImage:"none",highlightImage:"none",highlightSize:"cover",highlightStrokeWidth:"100%",highlightOverflow:"none",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,translateX:0,translateY:0,skewX:0,skewY:0};class Ir{constructor(t={}){O(this,"content");O(this,"style");O(this,"effects");O(this,"measureDom");O(this,"needsUpdate",!0);O(this,"computedStyle",{..._r});O(this,"paragraphs",[]);O(this,"lineBox",new L);O(this,"rawGlyphBox",new L);O(this,"glyphBox",new L);O(this,"pathBox",new L);O(this,"boundingBox",new L);O(this,"measurer",new Yn(this));O(this,"plugins",new Map);O(this,"fonts");const{content:e="",style:r={},measureDom:n,effects:o,fonts:i}=t;this.content=e,this.style=r,this.measureDom=n,this.effects=o,this.fonts=i,this.use(Kn()).use(ts()).use(Hn()).use(Jn())}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((e,r)=>{e.fragments.forEach((n,o)=>{n.characters.forEach((i,a)=>{t(i,{paragraphIndex:r,fragmentIndex:o,characterIndex:a})})})}),this}updateParagraphs(){this.computedStyle={..._r,...this.style};let{content:t,computedStyle:e}=this;const r=[];if(typeof t=="string"){const n=new oe({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const o=new oe({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new oe({},e);n.forEach(i=>{if(typeof i=="string")o.addFragment(i);else{const{content:a,...l}=i;a!==void 0&&o.addFragment(a,l)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...i}=n,a=new oe(i,e);o.forEach(l=>{const{content:h,...c}=l;h!==void 0&&a.addFragment(h,c)}),r.push(a)}else if("content"in n){const{content:o,...i}=n;if(o!==void 0){const a=new oe(i,e);a.addFragment(o),r.push(a)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const e={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),[...this.plugins.values()].sort((o,i)=>(o.updateOrder??0)-(i.updateOrder??0)).forEach(o=>{var i;(i=o.update)==null||i.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in e)r[o]=this[o],this[o]=e[o];return r}getGlyphBox(){const t=v.MAX,e=v.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,e)){const{inlineBox:n}=r,o=new v(n.left,n.top),i=new v(n.left+n.width,n.top+n.height);t.min(o,i),e.max(o,i)}}),new L(t.x,t.y,e.x-t.x,e.y-t.y)}updatePathBox(){const t=[...this.plugins.values()];return this.pathBox=L.from(this.glyphBox,...t.map(e=>e.getBoundingBox?e.getBoundingBox(this):Qe(e.paths??[])).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:e,pathBox:r}=this,n=Math.min(r.left,r.left+t.left-e.left),o=Math.min(r.top,r.top+t.top-e.top),i=Math.max(r.right,r.right+t.right-e.right),a=Math.max(r.bottom,r.bottom+t.bottom-e.bottom);return this.boundingBox=new L(n,o,i-n,a-o),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const e in t)this[e]=t[e];return this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Nr(n,r,this.boundingBox),zr(n,this),[...this.plugins.values()].sort((i,a)=>(i.renderOrder??0)-(a.renderOrder??0)).forEach(i=>{var a;i.render?(a=i.render)==null||a.call(i,n,this):i.paths&&i.paths.forEach(l=>{Jt({ctx:n,path:l,fontSize:this.computedStyle.fontSize})})}),this):this}}function fa(s){return new Ir(s).measure()}function pa(s){return new Ir(s).render(s)}U.Character=Qn,U.Fragment=Xn,U.Measurer=Yn,U.Paragraph=oe,U.Text=Ir,U.defaultTextStyles=_r,U.definePlugin=aa,U.drawPath=Jt,U.filterEmpty=Xe,U.getTransform2D=Ye,U.highlight=Hn,U.isNone=Ht,U.listStyle=Kn,U.measureText=fa,U.parseColor=ot,U.render=Jn,U.renderText=pa,U.setupView=Nr,U.textDecoration=ts,U.uploadColor=Ot,U.uploadColors=zr,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -650,7 +650,7 @@ function parseStrokeWidthScale(strokeWidth, fontSize, total) {
650
650
  return strokeWidth / total;
651
651
  }
652
652
  }
653
- function getTransformMatrix(a, b, c, isVertical) {
653
+ function getTransformMatrix(a, b, c, isVertical, type) {
654
654
  let scale;
655
655
  if (!isVertical) {
656
656
  scale = {
@@ -665,10 +665,18 @@ function getTransformMatrix(a, b, c, isVertical) {
665
665
  }
666
666
  const offset = c.center.add(
667
667
  a.center.sub(b.center).scale(scale.x, scale.y)
668
- ).sub({
669
- x: a.width / 2 * scale.x,
670
- y: a.height / 2 * scale.y
671
- });
668
+ );
669
+ if (type === "line") {
670
+ offset.sub({
671
+ x: a.width / 2 * scale.x,
672
+ y: a.height * scale.y
673
+ });
674
+ } else {
675
+ offset.sub({
676
+ x: a.width / 2 * scale.x,
677
+ y: a.height / 2 * scale.y
678
+ });
679
+ }
672
680
  const m = new Matrix3();
673
681
  m.translate(-a.left, -a.top);
674
682
  if (isVertical) {
@@ -716,12 +724,12 @@ function highlight() {
716
724
  groups.filter((characters) => characters.length).map((characters) => {
717
725
  const char = characters[0];
718
726
  return {
719
- style: char.computedStyle,
720
- unitHeight: char.typoAscender + char.typoDescender,
721
- box: BoundingBox.from(...characters.map((c) => c.glyphBox))
727
+ char,
728
+ groupBox: BoundingBox.from(...characters.map((c) => c.glyphBox))
722
729
  };
723
730
  }).forEach((group2) => {
724
- const { style, box: groupBox, unitHeight } = group2;
731
+ const { char, groupBox } = group2;
732
+ const style = char.computedStyle;
725
733
  const { fontSize, writingMode } = style;
726
734
  const isVertical = writingMode.includes("vertical");
727
735
  const strokeWidthScale = parseStrokeWidthScale(style.highlightStrokeWidth, fontSize, groupBox.width);
@@ -732,11 +740,21 @@ function highlight() {
732
740
  const box = getPathsBoundingBox(svgPaths, true);
733
741
  const refBox = getPathsBoundingBox(refPaths, false);
734
742
  const unitWidth = charsPerRepeat ? fontSize * charsPerRepeat : isVertical ? groupBox.height : groupBox.width;
743
+ let unitHeight;
744
+ let type;
745
+ if (box.height / refBox.height > 0.8) {
746
+ type = "block";
747
+ unitHeight = groupBox.height;
748
+ } else {
749
+ type = "line";
750
+ unitHeight = char.inlineBox.top - groupBox.top + char.underlinePosition;
751
+ }
735
752
  const transform = getTransformMatrix(
736
753
  box,
737
754
  refBox,
738
755
  new BoundingBox(groupBox.left, groupBox.top, isVertical ? unitHeight : unitWidth, isVertical ? unitWidth : unitHeight),
739
- isVertical
756
+ isVertical,
757
+ type
740
758
  );
741
759
  const styleScale = fontSize / box.width * 2;
742
760
  const total = Math.ceil(groupBox.width / unitWidth);
@@ -968,10 +986,10 @@ function textDecoration() {
968
986
  let group;
969
987
  let prevStyle;
970
988
  text.forEachCharacter((character) => {
971
- const { computedStyle: style, underlinePosition, underlineThickness, strikeoutPosition, strikeoutSize } = character;
989
+ const { computedStyle: style, isVertical, inlineBox, underlinePosition, underlineThickness, strikeoutPosition, strikeoutSize } = character;
972
990
  if (!isNone(style.textDecoration)) {
973
991
  let flag = false;
974
- if (prevStyle?.textDecoration === style.textDecoration && prevStyle?.writingMode === style.writingMode) {
992
+ if (prevStyle?.textDecoration === style.textDecoration && prevStyle?.writingMode === style.writingMode && (isVertical ? group[0].inlineBox.left === inlineBox.left : group[0].inlineBox.top === inlineBox.top)) {
975
993
  switch (style.textDecoration) {
976
994
  case "underline":
977
995
  if (group[0].underlinePosition === underlinePosition && group[0].underlineThickness === underlineThickness) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "0.4.3",
4
+ "version": "0.4.4",
5
5
  "packageManager": "pnpm@9.9.0",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",