modern-text 0.2.3 → 0.2.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 +127 -96
- package/dist/index.d.cts +19 -9
- package/dist/index.d.mts +19 -9
- package/dist/index.d.ts +19 -9
- package/dist/index.js +2 -2
- package/dist/index.mjs +127 -94
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(f,K){typeof exports=="object"&&typeof module<"u"?K(exports):typeof define=="function"&&define.amd?define(["exports"],K):(f=typeof globalThis<"u"?globalThis:f||self,K(f.modernText={}))})(this,function(f){"use strict";var uo=Object.defineProperty;var fo=(f,K,vt)=>K in f?uo(f,K,{enumerable:!0,configurable:!0,writable:!0,value:vt}):f[K]=vt;var E=(f,K,vt)=>fo(f,typeof K!="symbol"?K+"":K,vt);function K(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:o,stops:c}=Sr(t,e.left,e.top,e.width,e.height),h=i.createLinearGradient(n,r,s,o);return c.forEach(a=>h.addColorStop(a.offset,a.color)),h}return t}function vt(i,t,e){i!=null&&i.color&&(i.color=K(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=K(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=K(e,i.textStrokeColor,t))}function Sr(i,t,e,n,r){var d;const s=((d=i.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",o=s.split(",")[0],c=o.includes("deg")?o:"0deg",h=s.replace(c,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),l=(Number(c.replace("deg",""))||0)*Math.PI/180,u=n*Math.sin(l),g=r*Math.cos(l);return{x0:t+n/2-u,y0:e+r/2+g,x1:t+n/2+u,y1:e+r/2-g,stops:Array.from(h).map(y=>{let m=y[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(y[3].replace("%",""))/100,color:m}})}}function Ce(i){const{ctx:t,paths:e,fontSize:n}=i;e.forEach(r=>{var l;t.save(),t.beginPath();const s=((l=r.userData)==null?void 0:l.style)??{},o=i.color??s.fill??"none",c=i.textStrokeColor??s.stroke??"none";t.fillStyle=o!=="none"?o:"#000",t.strokeStyle=c!=="none"?c:"#000",t.lineWidth=i.textStrokeWidth?i.textStrokeWidth*n:s.strokeWidth?s.strokeWidth*n*.03:0,t.lineCap=s.strokeLineCap??"round",t.lineJoin=s.strokeLineJoin??"miter",t.miterLimit=s.strokeMiterLimit??0,t.shadowOffsetX=(i.shadowOffsetX??0)*n,t.shadowOffsetY=(i.shadowOffsetY??0)*n,t.shadowBlur=(i.shadowBlur??0)*n,t.shadowColor=i.shadowColor??"rgba(0, 0, 0, 0)";const h=(i.offsetX??0)*n,a=(i.offsetY??0)*n;t.translate(h,a),r.drawTo(t),o!=="none"&&t.fill(),c!=="none"&&t.stroke(),t.restore()})}var Q=Uint8Array,ht=Uint16Array,Te=Int32Array,le=new Q([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]),ue=new Q([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]),Ae=new Q([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sn=function(i,t){for(var e=new ht(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var r=new Te(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)r[s]=s-e[n]<<5|n;return{b:e,r}},on=sn(le,2),an=on.b,Oe=on.r;an[28]=258,Oe[258]=28;for(var hn=sn(ue,0),Cr=hn.b,cn=hn.r,$e=new ht(32768),U=0;U<32768;++U){var At=(U&43690)>>1|(U&21845)<<1;At=(At&52428)>>2|(At&13107)<<2,At=(At&61680)>>4|(At&3855)<<4,$e[U]=((At&65280)>>8|(At&255)<<8)>>1}for(var wt=function(i,t,e){for(var n=i.length,r=0,s=new ht(t);r<n;++r)i[r]&&++s[i[r]-1];var o=new ht(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var c;if(e){c=new ht(1<<t);var h=15-t;for(r=0;r<n;++r)if(i[r])for(var a=r<<4|i[r],l=t-i[r],u=o[i[r]-1]++<<l,g=u|(1<<l)-1;u<=g;++u)c[$e[u]>>h]=a}else for(c=new ht(n),r=0;r<n;++r)i[r]&&(c[r]=$e[o[i[r]-1]++]>>15-i[r]);return c},Ot=new Q(288),U=0;U<144;++U)Ot[U]=8;for(var U=144;U<256;++U)Ot[U]=9;for(var U=256;U<280;++U)Ot[U]=7;for(var U=280;U<288;++U)Ot[U]=8;for(var qt=new Q(32),U=0;U<32;++U)qt[U]=5;var Tr=wt(Ot,9,0),Ar=wt(Ot,9,1),Or=wt(qt,5,0),$r=wt(qt,5,1),Ie=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},dt=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},Le=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},De=function(i){return(i+7)/8|0},ln=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new Q(i.subarray(t,e))},Ir=["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"],yt=function(i,t,e){var n=new Error(t||Ir[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,yt),!e)throw n;return n},Lr=function(i,t,e,n){var r=i.length,s=0;if(!r||t.f&&!t.l)return e||new Q(0);var o=!e,c=o||t.i!=2,h=t.i;o&&(e=new Q(r*3));var a=function(ae){var he=e.length;if(ae>he){var kt=new Q(Math.max(he*2,ae));kt.set(e),e=kt}},l=t.f||0,u=t.p||0,g=t.b||0,d=t.l,y=t.d,m=t.m,v=t.n,x=r*8;do{if(!d){l=dt(i,u,1);var _=dt(i,u+1,3);if(u+=3,_)if(_==1)d=Ar,y=$r,m=9,v=5;else if(_==2){var O=dt(i,u,31)+257,$=dt(i,u+10,15)+4,C=O+dt(i,u+5,31)+1;u+=14;for(var P=new Q(C),L=new Q(19),N=0;N<$;++N)L[Ae[N]]=dt(i,u+N*3,7);u+=$*3;for(var H=Ie(L),V=(1<<H)-1,k=wt(L,H,1),N=0;N<C;){var q=k[dt(i,u,V)];u+=q&15;var b=q>>4;if(b<16)P[N++]=b;else{var W=0,A=0;for(b==16?(A=3+dt(i,u,3),u+=2,W=P[N-1]):b==17?(A=3+dt(i,u,7),u+=3):b==18&&(A=11+dt(i,u,127),u+=7);A--;)P[N++]=W}}var D=P.subarray(0,O),I=P.subarray(O);m=Ie(D),v=Ie(I),d=wt(D,m,1),y=wt(I,v,1)}else yt(1);else{var b=De(u)+4,M=i[b-4]|i[b-3]<<8,T=b+M;if(T>r){h&&yt(0);break}c&&a(g+M),e.set(i.subarray(b,T),g),t.b=g+=M,t.p=u=T*8,t.f=l;continue}if(u>x){h&&yt(0);break}}c&&a(g+131072);for(var Y=(1<<m)-1,z=(1<<v)-1,gt=u;;gt=u){var W=d[Le(i,u)&Y],ft=W>>4;if(u+=W&15,u>x){h&&yt(0);break}if(W||yt(2),ft<256)e[g++]=ft;else if(ft==256){gt=u,d=null;break}else{var pt=ft-254;if(ft>264){var N=ft-257,G=le[N];pt=dt(i,u,(1<<G)-1)+an[N],u+=G}var Pt=y[Le(i,u)&z],Wt=Pt>>4;Pt||yt(3),u+=Pt&15;var I=Cr[Wt];if(Wt>3){var G=ue[Wt];I+=Le(i,u)&(1<<G)-1,u+=G}if(u>x){h&&yt(0);break}c&&a(g+131072);var Xt=g+pt;if(g<I){var Me=s-I,Pe=Math.min(I,Xt);for(Me+g<0&&yt(3);g<Pe;++g)e[g]=n[Me+g]}for(;g<Xt;++g)e[g]=e[g-I]}}t.l=d,t.p=gt,t.b=g,t.f=l,d&&(l=1,t.m=m,t.d=y,t.n=v)}while(!l);return g!=e.length&&o?ln(e,0,g):e.subarray(0,g)},St=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8},jt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8,i[n+2]|=e>>16},Ee=function(i,t){for(var e=[],n=0;n<i.length;++n)i[n]&&e.push({s:n,f:i[n]});var r=e.length,s=e.slice();if(!r)return{t:gn,l:0};if(r==1){var o=new Q(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(T,O){return T.f-O.f}),e.push({s:-1,f:25001});var c=e[0],h=e[1],a=0,l=1,u=2;for(e[0]={s:-1,f:c.f+h.f,l:c,r:h};l!=r-1;)c=e[e[a].f<e[u].f?a++:u++],h=e[a!=l&&e[a].f<e[u].f?a++:u++],e[l++]={s:-1,f:c.f+h.f,l:c,r:h};for(var g=s[0].s,n=1;n<r;++n)s[n].s>g&&(g=s[n].s);var d=new ht(g+1),y=Ue(e[l-1],d,0);if(y>t){var n=0,m=0,v=y-t,x=1<<v;for(s.sort(function(O,$){return d[$.s]-d[O.s]||O.f-$.f});n<r;++n){var _=s[n].s;if(d[_]>t)m+=x-(1<<y-d[_]),d[_]=t;else break}for(m>>=v;m>0;){var b=s[n].s;d[b]<t?m-=1<<t-d[b]++-1:++n}for(;n>=0&&m;--n){var M=s[n].s;d[M]==t&&(--d[M],++m)}y=t}return{t:new Q(d),l:y}},Ue=function(i,t,e){return i.s==-1?Math.max(Ue(i.l,t,e+1),Ue(i.r,t,e+1)):t[i.s]=e},un=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new ht(++t),n=0,r=i[0],s=1,o=function(h){e[n++]=h},c=1;c<=t;++c)if(i[c]==r&&c!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=i[c]}return{c:e.subarray(0,n),n:t}},Yt=function(i,t){for(var e=0,n=0;n<t.length;++n)e+=i[n]*t[n];return e},fn=function(i,t,e){var n=e.length,r=De(t+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var s=0;s<n;++s)i[r+s+4]=e[s];return(r+4+n)*8},pn=function(i,t,e,n,r,s,o,c,h,a,l){St(t,l++,e),++r[256];for(var u=Ee(r,15),g=u.t,d=u.l,y=Ee(s,15),m=y.t,v=y.l,x=un(g),_=x.c,b=x.n,M=un(m),T=M.c,O=M.n,$=new ht(19),C=0;C<_.length;++C)++$[_[C]&31];for(var C=0;C<T.length;++C)++$[T[C]&31];for(var P=Ee($,7),L=P.t,N=P.l,H=19;H>4&&!L[Ae[H-1]];--H);var V=a+5<<3,k=Yt(r,Ot)+Yt(s,qt)+o,q=Yt(r,g)+Yt(s,m)+o+14+3*H+Yt($,L)+2*$[16]+3*$[17]+7*$[18];if(h>=0&&V<=k&&V<=q)return fn(t,l,i.subarray(h,h+a));var W,A,D,I;if(St(t,l,1+(q<k)),l+=2,q<k){W=wt(g,d,0),A=g,D=wt(m,v,0),I=m;var Y=wt(L,N,0);St(t,l,b-257),St(t,l+5,O-1),St(t,l+10,H-4),l+=14;for(var C=0;C<H;++C)St(t,l+3*C,L[Ae[C]]);l+=3*H;for(var z=[_,T],gt=0;gt<2;++gt)for(var ft=z[gt],C=0;C<ft.length;++C){var pt=ft[C]&31;St(t,l,Y[pt]),l+=L[pt],pt>15&&(St(t,l,ft[C]>>5&127),l+=ft[C]>>12)}}else W=Tr,A=Ot,D=Or,I=qt;for(var C=0;C<c;++C){var G=n[C];if(G>255){var pt=G>>18&31;jt(t,l,W[pt+257]),l+=A[pt+257],pt>7&&(St(t,l,G>>23&31),l+=le[pt]);var Pt=G&31;jt(t,l,D[Pt]),l+=I[Pt],Pt>3&&(jt(t,l,G>>5&8191),l+=ue[Pt])}else jt(t,l,W[G]),l+=A[G]}return jt(t,l,W[256]),l+A[256]},Dr=new Te([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gn=new Q(0),Er=function(i,t,e,n,r,s){var o=s.z||i.length,c=new Q(n+o+5*(1+Math.ceil(o/7e3))+r),h=c.subarray(n,c.length-r),a=s.l,l=(s.r||0)&7;if(t){l&&(h[0]=s.r>>3);for(var u=Dr[t-1],g=u>>13,d=u&8191,y=(1<<e)-1,m=s.p||new ht(32768),v=s.h||new ht(y+1),x=Math.ceil(e/3),_=2*x,b=function(nn){return(i[nn]^i[nn+1]<<x^i[nn+2]<<_)&y},M=new Te(25e3),T=new ht(288),O=new ht(32),$=0,C=0,P=s.i||0,L=0,N=s.w||0,H=0;P+2<o;++P){var V=b(P),k=P&32767,q=v[V];if(m[k]=q,v[V]=k,N<=P){var W=o-P;if(($>7e3||L>24576)&&(W>423||!a)){l=pn(i,h,0,M,T,O,C,L,H,P-H,l),L=$=C=0,H=P;for(var A=0;A<286;++A)T[A]=0;for(var A=0;A<30;++A)O[A]=0}var D=2,I=0,Y=d,z=k-q&32767;if(W>2&&V==b(P-z))for(var gt=Math.min(g,W)-1,ft=Math.min(32767,P),pt=Math.min(258,W);z<=ft&&--Y&&k!=q;){if(i[P+D]==i[P+D-z]){for(var G=0;G<pt&&i[P+G]==i[P+G-z];++G);if(G>D){if(D=G,I=z,G>gt)break;for(var Pt=Math.min(z,G-2),Wt=0,A=0;A<Pt;++A){var Xt=P-z+A&32767,Me=m[Xt],Pe=Xt-Me&32767;Pe>Wt&&(Wt=Pe,q=Xt)}}}k=q,q=m[k],z+=k-q&32767}if(I){M[L++]=268435456|Oe[D]<<18|cn[I];var ae=Oe[D]&31,he=cn[I]&31;C+=le[ae]+ue[he],++T[257+ae],++O[he],N=P+D,++$}else M[L++]=i[P],++T[i[P]]}}for(P=Math.max(P,N);P<o;++P)M[L++]=i[P],++T[i[P]];l=pn(i,h,a,M,T,O,C,L,H,P-H,l),a||(s.r=l&7|h[l/8|0]<<3,l-=7,s.h=v,s.p=m,s.i=P,s.w=N)}else{for(var P=s.w||0;P<o+a;P+=65535){var kt=P+65535;kt>=o&&(h[l/8|0]=a,kt=o),l=fn(h,l+1,i.subarray(P,kt))}s.i=o}return ln(c,0,n+De(l)+r)},dn=function(){var i=1,t=0;return{p:function(e){for(var n=i,r=t,s=e.length|0,o=0;o!=s;){for(var c=Math.min(o+2655,s);o<c;++o)r+=n+=e[o];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,t=r},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},Ur=function(i,t,e,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new Q(s.length+i.length);o.set(s),o.set(i,s.length),i=o,r.w=s.length}return Er(i,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,n,r)},yn=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},Fr=function(i,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=n<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var r=dn();r.p(t.dictionary),yn(i,2,r.d())}},Br=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&yt(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&yt(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Nr(i,t){t||(t={});var e=dn();e.p(i);var n=Ur(i,t,t.dictionary?6:2,4);return Fr(n,t),yn(n,n.length-4,e.d()),n}function Gr(i,t){return Lr(i.subarray(Br(i,t),-4),{i:2},t,t)}var Rr=typeof TextDecoder<"u"&&new TextDecoder,Vr=0;try{Rr.decode(gn,{stream:!0}),Vr=1}catch{}const zr="modern-font";function Kt(i,t){if(!i)throw new Error(`[${zr}] ${t}`)}function Hr(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function It(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var mn=Object.defineProperty,Wr=(i,t,e)=>t in i?mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Z=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&mn(t,e,r),r},Xr=(i,t,e)=>(Wr(i,t+"",e),e);const fe={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function J(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class j extends DataView{constructor(t,e,n,r){super(Hr(t),e,n),this.littleEndian=r,Xr(this,"cursor",0)}getColumn(t){if(t.size){const e=Array.from({length:t.size},(n,r)=>this.read(t.type,t.offset+r));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}setColumn(t,e){t.size?Array.from({length:t.size},(n,r)=>{this.write(t.type,e[r],t.offset+r)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,n=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,n);case"longDateTime":return this.readLongDateTime(e,n)}const r=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,s=this[r](e,n);return this.cursor+=fe[t],s}readUint24(t=this.cursor){const[e,n,r]=this.readBytes(t,3);return(e<<16)+(n<<8)+r}readBytes(t,e){e==null&&(e=t,t=this.cursor);const n=[];for(let r=0;r<e;++r)n.push(this.getUint8(t+r));return this.cursor=t+e,n}readString(t,e){e===void 0&&(e=t,t=this.cursor);let n="";for(let r=0;r<e;++r)n+=String.fromCharCode(this.readUint8(t+r));return this.cursor=t+e,n}readFixed(t,e){const n=this.readInt32(t,e)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,e){const n=this.readUint32(t+4,e),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(t){return this.readString(t,1)}write(t,e,n=this.cursor,r=this.littleEndian){switch(t){case"char":return this.writeChar(e,n);case"fixed":return this.writeFixed(e,n);case"longDateTime":return this.writeLongDateTime(e,n)}const s=`set${t.replace(/^\S/,c=>c.toUpperCase())}`,o=this[s](n,e,r);return this.cursor+=fe[t.toLowerCase()],o}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let r=0,s=t.length,o;r<s;++r)o=t.charCodeAt(r)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=n,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 r=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(r,e+4),this}writeBytes(t,e=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let r=0;r<n;++r)this.setUint8(e+r,t[r])}else{const r=It(t);n=r.byteLength;for(let s=0;s<n;++s)this.setUint8(e+s,r.getUint8(s))}return this.cursor=e+n,this}seek(t){return this.cursor=t,this}}Z([J()],j.prototype,"readInt8"),Z([J()],j.prototype,"readInt16"),Z([J()],j.prototype,"readInt32"),Z([J()],j.prototype,"readUint8"),Z([J()],j.prototype,"readUint16"),Z([J()],j.prototype,"readUint32"),Z([J()],j.prototype,"readFloat32"),Z([J()],j.prototype,"readFloat64"),Z([J()],j.prototype,"writeInt8"),Z([J()],j.prototype,"writeInt16"),Z([J()],j.prototype,"writeInt32"),Z([J()],j.prototype,"writeUint8"),Z([J()],j.prototype,"writeUint16"),Z([J()],j.prototype,"writeUint32"),Z([J()],j.prototype,"writeFloat32"),Z([J()],j.prototype,"writeFloat64");var kr=Object.defineProperty,qr=(i,t,e)=>t in i?kr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,jr=(i,t,e)=>(qr(i,t+"",e),e);const vn=new WeakMap;function p(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:n}=t;return(r,s)=>{if(typeof s!="string")return;let o=vn.get(r);o||(o={columns:[],byteLength:0},vn.set(r,o));const c={...t,name:s,byteLength:e*fe[n],offset:t.offset??o.columns.reduce((h,a)=>h+a.byteLength,0)};o.columns.push(c),o.byteLength=o.columns.reduce((h,a)=>h+fe[a.type]*(a.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.getColumn(c)},set(h){this.view.setColumn(c,h)},configurable:!0,enumerable:!0})}}class bt{constructor(t,e,n,r){jr(this,"view"),this.view=new j(t,e,n,r)}}function Yr(i){let t="";for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),r!==0&&(t+=String.fromCharCode(r));return t}function pe(i){i=Yr(i);const t=[];for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),t.push(r>>8),t.push(r&255);return t}function Kr(i){let t="";for(let e=0,n=i.length;e<n;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function Qr(i){let t="";for(let e=0,n=i.length;e<n;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}var Zr=Object.defineProperty,Jr=(i,t,e)=>t in i?Zr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ti=(i,t,e)=>(Jr(i,t+"",e),e);class ge extends bt{constructor(){super(...arguments),ti(this,"mimeType","font/opentype")}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 wn=Object.defineProperty,ei=(i,t,e)=>t in i?wn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,rt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&wn(t,e,r),r},ni=(i,t,e)=>(ei(i,t+"",e),e);const tt=class br extends ge{constructor(){super(...arguments),ni(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,r=e.name.getNames(),s=pe(r.fontFamily||""),o=s.length,c=pe(r.fontStyle||""),h=c.length,a=pe(r.version||""),l=a.length,u=pe(r.fullName||""),g=u.length,d=86+o+4+h+4+l+4+g+2+t.view.byteLength,y=new br(new ArrayBuffer(d),0,d,!0);y.EOTSize=y.view.byteLength,y.FontDataSize=t.view.byteLength,y.Version=131073,y.Flags=0,y.Charset=1,y.MagicNumber=20556,y.Padding1=0,y.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(y.FontPANOSE=m.fontPANOSE,y.Italic=m.fsSelection,y.Weight=m.usWeightClass,y.fsType=m.fsType,y.UnicodeRange=m.ulUnicodeRange,y.CodePageRange=m.ulCodePageRange),y.view.writeUint16(o),y.view.writeBytes(s),y.view.writeUint16(0),y.view.writeUint16(h),y.view.writeBytes(c),y.view.writeUint16(0),y.view.writeUint16(l),y.view.writeBytes(a),y.view.writeUint16(0),y.view.writeUint16(g),y.view.writeBytes(u),y.view.writeUint16(0),y.view.writeUint16(0),y.view.writeBytes(t.view),y}};rt([p("uint32")],tt.prototype,"EOTSize"),rt([p("uint32")],tt.prototype,"FontDataSize"),rt([p("uint32")],tt.prototype,"Version"),rt([p("uint32")],tt.prototype,"Flags"),rt([p({type:"uint8",size:10})],tt.prototype,"FontPANOSE"),rt([p("uint8")],tt.prototype,"Charset"),rt([p("uint8")],tt.prototype,"Italic"),rt([p("uint32")],tt.prototype,"Weight"),rt([p("uint16")],tt.prototype,"fsType"),rt([p("uint16")],tt.prototype,"MagicNumber"),rt([p({type:"uint8",size:16})],tt.prototype,"UnicodeRange"),rt([p({type:"uint8",size:8})],tt.prototype,"CodePageRange"),rt([p("uint32")],tt.prototype,"CheckSumAdjustment"),rt([p({type:"uint8",size:16})],tt.prototype,"Reserved"),rt([p("uint16")],tt.prototype,"Padding1");let ri=tt;var ii=Object.defineProperty,de=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ii(t,e,r),r};class Gt extends bt{constructor(t,e){super(t,e,16)}}de([p({type:"char",size:4})],Gt.prototype,"tag"),de([p("uint32")],Gt.prototype,"checkSum"),de([p("uint32")],Gt.prototype,"offset"),de([p("uint32")],Gt.prototype,"length");var si=Object.defineProperty,ye=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&si(t,e,r),r};const Qt=class xr extends bt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new xr;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((n,r)=>{r<256&&n<256&&e.view.writeUint8(n,6+r)}),e}getUnicodeGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,n)=>{t.set(n,e)}),t}};ye([p("uint16")],Qt.prototype,"format"),ye([p("uint16")],Qt.prototype,"length"),ye([p("uint16")],Qt.prototype,"language"),ye([p({type:"uint8",size:256})],Qt.prototype,"glyphIndexArray");let Fe=Qt;var oi=Object.defineProperty,Be=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&oi(t,e,r),r};class Zt extends bt{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,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-n)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const n=(this.view.byteLength-e)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(t){const e=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,s=this.subHeaders,o=this.glyphIndexArray,c=n.findIndex(a=>a===r);let h=0;for(let a=0;a<256;a++)if(n[a]===0)a>=c||a<s[0].firstCode||a>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(a-s[0].firstCode)>=o.length?h=0:(h=o[s[0].idRangeOffset+(a-s[0].firstCode)],h!==0&&(h=h+s[0].idDelta)),h!==0&&h<t&&e.set(a,h);else{const l=n[a];for(let u=0,g=s[l].entryCount;u<g;u++)if(s[l].idRangeOffset+u>=o.length?h=0:(h=o[s[l].idRangeOffset+u],h!==0&&(h=h+s[l].idDelta)),h!==0&&h<t){const d=(a<<8|u+s[l].firstCode)%65535;e.set(d,h)}}return e}}Be([p("uint16")],Zt.prototype,"format"),Be([p("uint16")],Zt.prototype,"length"),Be([p("uint16")],Zt.prototype,"language");function bn(i){return i>32767?i-65536:i<-32767?i+65536:i}function Ne(i,t){let e;const n=[];let r={};return i.forEach((s,o)=>{t&&o>t||((!e||o!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(r.end=e.unicode,n.push(r),r={start:o,startId:s,delta:bn(s-o)}):(r.start=Number(o),r.startId=s,r.delta=bn(s-o))),e={unicode:o,glyphIndex:s})}),e&&(r.end=e.unicode,n.push(r)),n}var ai=Object.defineProperty,Lt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ai(t,e,r),r};const $t=class _r extends bt{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(n=>this.view.writeUint16(n))}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=Ne(t,65535),n=e.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,o=new _r(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=n*2,o.searchRange=s,o.entrySelector=r,o.rangeShift=2*n-s,o.endCode=[...e.map(c=>c.end),65535],o.reservedPad=0,o.startCode=[...e.map(c=>c.start),65535],o.idDelta=[...e.map(c=>c.delta),1],o.idRangeOffset=Array.from({length:n},()=>0),o}getUnicodeGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,o=this.idRangeOffset,c=this.idDelta,h=this.glyphIndexArray;for(let a=0;a<e;++a)for(let l=r[a],u=s[a];l<=u;++l)if(o[a]===0)t.set(l,(l+c[a])%65536);else{const g=a+o[a]/2+(l-r[a])-n,d=h[g];d!==0?t.set(l,(d+c[a])%65536):t.set(l,0)}return t.delete(65535),t}};Lt([p("uint16")],$t.prototype,"format"),Lt([p("uint16")],$t.prototype,"length"),Lt([p("uint16")],$t.prototype,"language"),Lt([p("uint16")],$t.prototype,"segCountX2"),Lt([p("uint16")],$t.prototype,"searchRange"),Lt([p("uint16")],$t.prototype,"entrySelector"),Lt([p("uint16")],$t.prototype,"rangeShift");let Ge=$t;var hi=Object.defineProperty,Jt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&hi(t,e,r),r};class Dt extends bt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((n,r)=>{e.set(r,n)}),e}}Jt([p("uint16")],Dt.prototype,"format"),Jt([p("uint16")],Dt.prototype,"length"),Jt([p("uint16")],Dt.prototype,"language"),Jt([p("uint16")],Dt.prototype,"firstCode"),Jt([p("uint16")],Dt.prototype,"entryCount");var ci=Object.defineProperty,te=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ci(t,e,r),r};const Rt=class Mr extends bt{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=Ne(t),n=new Mr(new ArrayBuffer(16+e.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=e.length,e.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeGlyphIndexMap(){const t=new Map,e=this.groups;for(let n=0,r=e.length;n<r;n++){const s=e[n];let o=s.startGlyphCode,c=s.startCharCode;const h=s.endCharCode;for(;c<=h;)t.set(c++,o++)}return t}};te([p("uint16")],Rt.prototype,"format"),te([p("uint16")],Rt.prototype,"reserved"),te([p("uint32")],Rt.prototype,"length"),te([p("uint32")],Rt.prototype,"language"),te([p("uint32")],Rt.prototype,"nGroups");let Re=Rt;var li=Object.defineProperty,Ve=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&li(t,e,r),r};class ee extends bt{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 n=this.view.readUint32();e.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const n=this.view.readUint32();e.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let n=0,r=e.length;n<r;n++){const{uVSMappings:s}=e[n];s.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}Ve([p("uint16")],ee.prototype,"format"),Ve([p("uint32")],ee.prototype,"length"),Ve([p("uint32")],ee.prototype,"numVarSelectorRecords");var ui=Object.defineProperty,fi=(i,t,e)=>t in i?ui(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ze=(i,t,e)=>(fi(i,typeof t!="symbol"?t+"":t,e),e);function et(i,t=i){return e=>{ne.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(ne.prototype,t,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const xn=class ce{constructor(t){ze(this,"tables",new Map),ze(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get names(){return this.name.getNames()}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}charToGlyphIndex(t){return this.cmap.unicodeGlyphIndexMap.get(t.codePointAt(0))??0}charToGlyph(t){return this.glyf.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=this.cmap.unicodeGlyphIndexMap,n=[];for(const r of t){const s=r.codePointAt(0);n.push(e.get(s)??0)}return n}textToGlyphs(t){const e=this.glyf.glyphs,n=this.textToGlyphIndexes(t),r=n.length,s=Array.from({length:r}),o=e.get(0);for(let c=0;c<r;c+=1)s[c]=e.get(n[c])||o;return s}getPathCommands(t,e,n,r,s){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,n,r,s,this)}getAdvanceWidth(t,e,n){return this.forEachGlyph(t,0,0,e,n,()=>{})}forEachGlyph(t,e=0,n=0,r=72,s={},o){const c=1/this.unitsPerEm*r,h=this.textToGlyphs(t);for(let a=0;a<h.length;a+=1){const l=h[a];o.call(this,l,e,n,r,s),l.advanceWidth&&(e+=l.advanceWidth*c),s.letterSpacing?e+=s.letterSpacing*r:s.tracking&&(e+=s.tracking/1e3*r)}return e}clone(){return new ce(this.tableViews)}delete(t){const e=ce.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=ce.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ce.tableDefinitions.get(t);if(!e)return;let n=this.tables.get(e.prop);if(!n){const r=e.class;if(r){const s=this.tableViews.get(t);s?n=new r(s.buffer,s.byteOffset,s.byteLength).setSfnt(this):n=new r().setSfnt(this),this.tables.set(e.prop,n)}}return n}};ze(xn,"tableDefinitions",new Map);let ne=xn;class it extends bt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var _n=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,gi=(i,t,e)=>t in i?_n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,He=(i,t,e,n)=>{for(var r=n>1?void 0:n?pi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&_n(t,e,r),r},di=(i,t,e)=>(gi(i,t+"",e),e);f.Cmap=class extends it{constructor(){super(...arguments),di(this,"_unicodeGlyphIndexMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),n=Ge.from(t),r=Fe.from(t),s=e?Re.from(t):void 0,o=4+(s?32:24),c=o+n.view.byteLength,h=c+r.view.byteLength,a=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:c},{platformID:3,platformSpecificID:1,offset:o},s&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),l=new f.Cmap(new ArrayBuffer(4+8*a.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return l.numberSubtables=a.length,l.view.seek(4),a.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(n.view,o),l.view.writeBytes(r.view,c),s&&l.view.writeBytes(s.view,h),l}get unicodeGlyphIndexMap(){return this._unicodeGlyphIndexMap||(this._unicodeGlyphIndexMap=this._getUnicodeGlyphIndexMap()),this._unicodeGlyphIndexMap}_getSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new Fe(this.view.buffer,e.offset);break;case 2:r=new Zt(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new Ge(this.view.buffer,e.offset,this.view.readUint16());break;case 6:r=new Dt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:r=new Re(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new ee(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:n,view:r}})}_getUnicodeGlyphIndexMap(){var c,h,a,l,u;const t=this._getSubtables(),e=(c=t.find(g=>g.format===0))==null?void 0:c.view,n=(h=t.find(g=>g.platformID===3&&g.platformSpecificID===3&&g.format===2))==null?void 0:h.view,r=(a=t.find(g=>g.platformID===3&&g.platformSpecificID===1&&g.format===4))==null?void 0:a.view,s=(l=t.find(g=>g.platformID===3&&g.platformSpecificID===10&&g.format===12))==null?void 0:l.view,o=(u=t.find(g=>g.platformID===0&&g.platformSpecificID===5&&g.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeGlyphIndexMap())??[]])}},He([p("uint16")],f.Cmap.prototype,"version",2),He([p("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=He([et("cmap")],f.Cmap);var yi=Object.defineProperty,mi=(i,t,e)=>t in i?yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vi=(i,t,e)=>(mi(i,t+"",e),e);class Mn{constructor(t){vi(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,this.unicode=e.unicode,this.unicodes=e.unicodes||(e.unicode!==void 0?[e.unicode]:[]),e.xMin!==void 0&&(this.xMin=e.xMin),e.yMin!==void 0&&(this.yMin=e.yMin),e.xMax!==void 0&&(this.xMax=e.xMax),e.yMax!==void 0&&(this.yMax=e.yMax),e.advanceWidth!==void 0&&(this.advanceWidth=e.advanceWidth),e.leftSideBearing!==void 0&&(this.leftSideBearing=e.leftSideBearing),e.points!==void 0&&(this.points=e.points)}_parseContours(t){const e=[];let n=[];for(let r=0;r<t.length;r+=1){const s=t[r];n.push(s),s.lastPointOfContour&&(e.push(n),n=[])}return Kt(n.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const n=[];for(let r=0;r<t.length;r+=1){const s=t[r],o={x:e.xScale*s.x+e.scale10*s.y+e.dx,y:e.scale01*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(o)}return n}_parseGlyphCoordinate(t,e,n,r,s){let o;return(e&r)>0?(o=t.view.readUint8(),e&s||(o=-o),o=n+o):(e&s)>0?o=n:o=n+t.view.readInt16(),o}_parse(t,e,n){t.view.seek(e);const r=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(),r>0){const c=this.endPointIndices=[];for(let m=0;m<r;m++)c.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();Kt(h<5e3,`Bad instructionLength:${h}`);const a=this.instructions=[];for(let m=0;m<h;++m)a.push(t.view.readUint8());const l=t.view.byteOffset,u=c[c.length-1]+1;Kt(u<2e4,`Bad numberOfCoordinates:${l}`);const g=[];let d,y=0;for(;y<u;)if(d=t.view.readUint8(),g.push(d),y++,d&8&&y<u){const m=t.view.readUint8();for(let v=0;v<m;v++)g.push(d),y++}if(Kt(g.length===u,`Bad flags length: ${g.length}, numberOfCoordinates: ${u}`),c.length>0){const m=[];let v;if(u>0){for(let b=0;b<u;b+=1)d=g[b],v={},v.onCurve=!!(d&1),v.lastPointOfContour=c.includes(b),m.push(v);let x=0;for(let b=0;b<u;b+=1)d=g[b],v=m[b],v.x=this._parseGlyphCoordinate(t,d,x,2,16),x=v.x;let _=0;for(let b=0;b<u;b+=1)d=g[b],v=m[b],v.y=this._parseGlyphCoordinate(t,d,_,4,32),_=v.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let c,h=!0;for(;h;){c=t.view.readUint16();const a={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(c&1)>0?(c&2)>0?(a.dx=t.view.readInt16(),a.dy=t.view.readInt16()):a.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(c&2)>0?(a.dx=t.view.readInt8(),a.dy=t.view.readInt8()):a.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(c&8)>0?a.xScale=a.yScale=t.view.readInt16()/16384:(c&64)>0?(a.xScale=t.view.readInt16()/16384,a.yScale=t.view.readInt16()/16384):(c&128)>0&&(a.xScale=t.view.readInt16()/16384,a.scale01=t.view.readInt16()/16384,a.scale10=t.view.readInt16()/16384,a.yScale=t.view.readInt16()/16384),this.components.push(a),h=!!(c&32)}if(c&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let a=0;a<this.instructionLength;a+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let c=0;c<this.components.length;c+=1){const h=this.components[c],a=n.get(h.glyphIndex);if(a.getPathCommands(),a.points){let l;if(h.matchedPoints===void 0)l=this._transformPoints(a.points,h);else{Kt(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>a.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[h.matchedPoints[0]];let g=a.points[h.matchedPoints[1]];const d={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};g=this._transformPoints([g],d)[0],d.dx=u.x-g.x,d.dy=u.y-g.y,l=this._transformPoints(a.points,d)}this.points=this.points.concat(l)}}const s=[],o=this._parseContours(this.points);for(let c=0,h=o.length;c<h;++c){const a=o[c];let l=a[a.length-1],u=a[0];l.onCurve?s.push({type:"M",x:l.x,y:l.y}):u.onCurve?s.push({type:"M",x:u.x,y:u.y}):s.push({type:"M",x:(l.x+u.x)*.5,y:(l.y+u.y)*.5});for(let g=0,d=a.length;g<d;++g)if(l=u,u=a[(g+1)%d],l.onCurve)s.push({type:"L",x:l.x,y:l.y});else{let y=u;u.onCurve||(y={x:(l.x+u.x)*.5,y:(l.y+u.y)*.5}),s.push({type:"Q",x1:l.x,y1:l.y,x:y.x,y:y.y})}s.push({type:"Z"})}this.pathCommands=s}getPathCommands(t=0,e=0,n=72,r={},s){const o=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:c=o,yScale:h=o}=r,a=this.pathCommands,l=[];for(let u=0,g=a.length;u<g;u+=1){const d=a[u];d.type==="M"?l.push({type:"M",x:t+d.x*c,y:e+-d.y*h}):d.type==="L"?l.push({type:"L",x:t+d.x*c,y:e+-d.y*h}):d.type==="Q"?l.push({type:"Q",x1:t+d.x1*c,y1:e+-d.y1*h,x:t+d.x*c,y:e+-d.y*h}):d.type==="Z"&&l.push({type:"Z"})}return l}}var wi=Object.defineProperty,bi=(i,t,e)=>t in i?wi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,xi=(i,t,e)=>(bi(i,t+"",e),e);class Pn{constructor(t){this._sfnt=t,xi(this,"_items",[])}get length(){return this._sfnt.loca.locations.length}get(t){const e=this._items[t];let n;if(e)n=e;else{n=new Mn({index:t});const r=this._sfnt.loca.locations,s=this._sfnt.hmtx.metrics,o=s[t],c=r[t];o&&(n.advanceWidth=s[t].advanceWidth,n.leftSideBearing=s[t].leftSideBearing),c!==r[t+1]&&n._parse(this._sfnt.glyf,c,this),this._items[t]=n}return n}}var Sn=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,Mi=(i,t,e)=>t in i?Sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Pi=(i,t,e,n)=>{for(var r=n>1?void 0:n?_i(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Sn(t,e,r),r},Si=(i,t,e)=>(Mi(i,t+"",e),e);const Vt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends it{constructor(){super(...arguments),Si(this,"_glyphs")}static from(t){const e=t.reduce((r,s)=>r+s.byteLength,0),n=new f.Glyf(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs||(this._glyphs=new Pn(this._sfnt)),this._glyphs}},f.Glyf=Pi([et("glyf")],f.Glyf);var Ci=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Ai=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ti(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Ci(t,e,r),r};f.Gpos=class extends it{},f.Gpos=Ai([et("GPOS","gpos")],f.Gpos);var Oi=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,Et=(i,t,e,n)=>{for(var r=n>1?void 0:n?$i(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Oi(t,e,r),r};f.Gsub=class extends it{},Et([p("uint16")],f.Gsub.prototype,"majorVersion",2),Et([p("uint16")],f.Gsub.prototype,"minorVersion",2),Et([p("uint16")],f.Gsub.prototype,"scriptListOffset",2),Et([p("uint16")],f.Gsub.prototype,"featureListOffset",2),Et([p("uint16")],f.Gsub.prototype,"lookupListOffset",2),Et([p("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Et([et("GSUB","gsub")],f.Gsub);var Ii=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,X=(i,t,e,n)=>{for(var r=n>1?void 0:n?Li(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Ii(t,e,r),r};f.Head=class extends it{constructor(t=new ArrayBuffer(54),e){super(t,e,54)}},X([p("fixed")],f.Head.prototype,"version",2),X([p("fixed")],f.Head.prototype,"fontRevision",2),X([p("uint32")],f.Head.prototype,"checkSumAdjustment",2),X([p("uint32")],f.Head.prototype,"magickNumber",2),X([p("uint16")],f.Head.prototype,"flags",2),X([p("uint16")],f.Head.prototype,"unitsPerEm",2),X([p({type:"longDateTime"})],f.Head.prototype,"created",2),X([p({type:"longDateTime"})],f.Head.prototype,"modified",2),X([p("int16")],f.Head.prototype,"xMin",2),X([p("int16")],f.Head.prototype,"yMin",2),X([p("int16")],f.Head.prototype,"xMax",2),X([p("int16")],f.Head.prototype,"yMax",2),X([p("uint16")],f.Head.prototype,"macStyle",2),X([p("uint16")],f.Head.prototype,"lowestRecPPEM",2),X([p("int16")],f.Head.prototype,"fontDirectionHint",2),X([p("int16")],f.Head.prototype,"indexToLocFormat",2),X([p("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=X([et("head")],f.Head);var Di=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,st=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ei(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Di(t,e,r),r};f.Hhea=class extends it{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},st([p("fixed")],f.Hhea.prototype,"version",2),st([p("int16")],f.Hhea.prototype,"ascent",2),st([p("int16")],f.Hhea.prototype,"descent",2),st([p("int16")],f.Hhea.prototype,"lineGap",2),st([p("uint16")],f.Hhea.prototype,"advanceWidthMax",2),st([p("int16")],f.Hhea.prototype,"minLeftSideBearing",2),st([p("int16")],f.Hhea.prototype,"minRightSideBearing",2),st([p("int16")],f.Hhea.prototype,"xMaxExtent",2),st([p("int16")],f.Hhea.prototype,"caretSlopeRise",2),st([p("int16")],f.Hhea.prototype,"caretSlopeRun",2),st([p("int16")],f.Hhea.prototype,"caretOffset",2),st([p({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),st([p("int16")],f.Hhea.prototype,"metricDataFormat",2),st([p("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=st([et("hhea")],f.Hhea);var Cn=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,Fi=(i,t,e)=>t in i?Cn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Bi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ui(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Cn(t,e,r),r},Ni=(i,t,e)=>(Fi(i,t+"",e),e);f.Hmtx=class extends it{constructor(){super(...arguments),Ni(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Hmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let n=0;return this.view.seek(0),Array.from({length:t}).map((r,s)=>(s<e&&(n=this.view.readUint16()),{advanceWidth:n,leftSideBearing:this.view.readUint16()}))}},f.Hmtx=Bi([et("hmtx")],f.Hmtx);var Gi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,Vi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ri(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Gi(t,e,r),r};f.Kern=class extends it{},f.Kern=Vi([et("kern","kern")],f.Kern);var Tn=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,Hi=(i,t,e)=>t in i?Tn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wi=(i,t,e,n)=>{for(var r=n>1?void 0:n?zi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Tn(t,e,r),r},Xi=(i,t,e)=>(Hi(i,t+"",e),e);f.Loca=class extends it{constructor(){super(...arguments),Xi(this,"_locations")}static from(t,e=1){const n=t.length*(e?4:2),r=new f.Loca(new ArrayBuffer(n));return t.forEach(s=>{e?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations||(this._locations=this._getLocations()),this._locations}_getLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat;return this.view.seek(0),Array.from({length:t}).map(()=>e?this.view.readUint32():this.view.readUint16()*2)}},f.Loca=Wi([et("loca")],f.Loca);var ki=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,nt=(i,t,e,n)=>{for(var r=n>1?void 0:n?qi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&ki(t,e,r),r};f.Maxp=class extends it{constructor(t=new ArrayBuffer(32),e){super(t,e,32)}},nt([p("fixed")],f.Maxp.prototype,"version",2),nt([p("uint16")],f.Maxp.prototype,"numGlyphs",2),nt([p("uint16")],f.Maxp.prototype,"maxPoints",2),nt([p("uint16")],f.Maxp.prototype,"maxContours",2),nt([p("uint16")],f.Maxp.prototype,"maxComponentPoints",2),nt([p("uint16")],f.Maxp.prototype,"maxComponentContours",2),nt([p("uint16")],f.Maxp.prototype,"maxZones",2),nt([p("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),nt([p("uint16")],f.Maxp.prototype,"maxStorage",2),nt([p("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),nt([p("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),nt([p("uint16")],f.Maxp.prototype,"maxStackElements",2),nt([p("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),nt([p("uint16")],f.Maxp.prototype,"maxComponentElements",2),nt([p("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=nt([et("maxp")],f.Maxp);var ji=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,me=(i,t,e,n)=>{for(var r=n>1?void 0:n?Yi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&ji(t,e,r),r};const An={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"},We={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Ki={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},On={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends it{getNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let h=0;h<t;++h){const a=e[h];a.name=this.view.readBytes(n+a.offset,a.length)}let r=We.Macintosh,s=Ki.Default,o=0;e.some(h=>h.platform===We.Microsoft&&h.encoding===On.UCS2&&h.language===1033)&&(r=We.Microsoft,s=On.UCS2,o=1033);const c={};for(let h=0;h<t;++h){const a=e[h];a.platform===r&&a.encoding===s&&a.language===o&&An[a.nameId]&&(c[An[a.nameId]]=o===0?Kr(a.name):Qr(a.name))}return c}},me([p("uint16")],f.Name.prototype,"format",2),me([p("uint16")],f.Name.prototype,"count",2),me([p("uint16")],f.Name.prototype,"stringOffset",2),f.Name=me([et("name")],f.Name);var Qi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,S=(i,t,e,n)=>{for(var r=n>1?void 0:n?Zi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Qi(t,e,r),r};f.Os2=class extends it{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},S([p("uint16")],f.Os2.prototype,"version",2),S([p("int16")],f.Os2.prototype,"xAvgCharWidth",2),S([p("uint16")],f.Os2.prototype,"usWeightClass",2),S([p("uint16")],f.Os2.prototype,"usWidthClass",2),S([p("uint16")],f.Os2.prototype,"fsType",2),S([p("uint16")],f.Os2.prototype,"ySubscriptXSize",2),S([p("uint16")],f.Os2.prototype,"ySubscriptYSize",2),S([p("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),S([p("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),S([p("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),S([p("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),S([p("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),S([p("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),S([p("uint16")],f.Os2.prototype,"yStrikeoutSize",2),S([p("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),S([p("uint16")],f.Os2.prototype,"sFamilyClass",2),S([p({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),S([p({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),S([p({type:"uint8"})],f.Os2.prototype,"bWeight",2),S([p({type:"uint8"})],f.Os2.prototype,"bProportion",2),S([p({type:"uint8"})],f.Os2.prototype,"bContrast",2),S([p({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),S([p({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),S([p({type:"uint8"})],f.Os2.prototype,"bLetterform",2),S([p({type:"uint8"})],f.Os2.prototype,"bMidline",2),S([p({type:"uint8"})],f.Os2.prototype,"bXHeight",2),S([p({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),S([p({type:"char",size:4})],f.Os2.prototype,"achVendID",2),S([p("uint16")],f.Os2.prototype,"fsSelection",2),S([p("uint16")],f.Os2.prototype,"usFirstCharIndex",2),S([p("uint16")],f.Os2.prototype,"usLastCharIndex",2),S([p("int16")],f.Os2.prototype,"sTypoAscender",2),S([p("int16")],f.Os2.prototype,"sTypoDescender",2),S([p("int16")],f.Os2.prototype,"sTypoLineGap",2),S([p("uint16")],f.Os2.prototype,"usWinAscent",2),S([p("uint16")],f.Os2.prototype,"usWinDescent",2),S([p({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),S([p({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),S([p("int16")],f.Os2.prototype,"sCapHeight",2),S([p("uint16")],f.Os2.prototype,"usDefaultChar",2),S([p("uint16")],f.Os2.prototype,"usBreakChar",2),S([p("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=S([et("OS/2","os2")],f.Os2);var Ji=Object.defineProperty,ts=Object.getOwnPropertyDescriptor,xt=(i,t,e,n)=>{for(var r=n>1?void 0:n?ts(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Ji(t,e,r),r};f.Post=class extends it{constructor(t=new ArrayBuffer(32),e,n){super(t,e,n)}},xt([p("fixed")],f.Post.prototype,"format",2),xt([p("fixed")],f.Post.prototype,"italicAngle",2),xt([p("int16")],f.Post.prototype,"underlinePosition",2),xt([p("int16")],f.Post.prototype,"underlineThickness",2),xt([p("uint32")],f.Post.prototype,"isFixedPitch",2),xt([p("uint32")],f.Post.prototype,"minMemType42",2),xt([p("uint32")],f.Post.prototype,"maxMemType42",2),xt([p("uint32")],f.Post.prototype,"minMemType1",2),xt([p("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=xt([et("post")],f.Post);var es=Object.defineProperty,ns=Object.getOwnPropertyDescriptor,ot=(i,t,e,n)=>{for(var r=n>1?void 0:n?ns(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&es(t,e,r),r};f.Vhea=class extends it{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},ot([p("fixed")],f.Vhea.prototype,"version",2),ot([p("int16")],f.Vhea.prototype,"vertTypoAscender",2),ot([p("int16")],f.Vhea.prototype,"vertTypoDescender",2),ot([p("int16")],f.Vhea.prototype,"vertTypoLineGap",2),ot([p("int16")],f.Vhea.prototype,"advanceHeightMax",2),ot([p("int16")],f.Vhea.prototype,"minTopSideBearing",2),ot([p("int16")],f.Vhea.prototype,"minBottomSideBearing",2),ot([p("int16")],f.Vhea.prototype,"yMaxExtent",2),ot([p("int16")],f.Vhea.prototype,"caretSlopeRise",2),ot([p("int16")],f.Vhea.prototype,"caretSlopeRun",2),ot([p("int16")],f.Vhea.prototype,"caretOffset",2),ot([p({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),ot([p("int16")],f.Vhea.prototype,"metricDataFormat",2),ot([p("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=ot([et("vhea")],f.Vhea);var $n=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,is=(i,t,e)=>t in i?$n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ss=(i,t,e,n)=>{for(var r=n>1?void 0:n?rs(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&$n(t,e,r),r},os=(i,t,e)=>(is(i,t+"",e),e);f.Vmtx=class extends it{constructor(){super(...arguments),os(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Vmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){var r;const t=this._sfnt.maxp.numGlyphs,e=((r=this._sfnt.vhea)==null?void 0:r.numOfLongVerMetrics)??0;this.view.seek(0);let n=0;return Array.from({length:t}).map((s,o)=>(o<e&&(n=this.view.readUint16()),{advanceHeight:n,topSideBearing:this.view.readUint8()}))}},f.Vmtx=ss([et("vmtx")],f.Vmtx);var In=Object.defineProperty,as=(i,t,e)=>t in i?In(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,re=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&In(t,e,r),r},Xe=(i,t,e)=>(as(i,typeof t!="symbol"?t+"":t,e),e);const Ut=class Se extends ge{constructor(){super(...arguments),Xe(this,"mimeType","font/ttf"),Xe(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(It(t).getUint32(0))}static checksum(t){const e=It(t);let n=e.byteLength;for(;n%4;)n++;let r=0;for(let s=0,o=n/4;s<o;s+=4)s*4<n-4&&(r+=e.getUint32(s*4,!1));return r&4294967295}static from(t){const e=u=>u+3&-4,n=t.tableViews.size,r=t.tableViews.values().reduce((u,g)=>u+e(g.byteLength),0),s=new Se(new ArrayBuffer(12+n*16+r)),o=Math.log(2);s.scalerType=65536,s.numTables=n,s.searchRange=Math.floor(Math.log(n)/o)*16,s.entrySelector=Math.floor(s.searchRange/o),s.rangeShift=n*16-s.searchRange;let c=12+n*16,h=0;const a=s.getDirectories();t.tableViews.forEach((u,g)=>{const d=a[h++];d.tag=g,d.checkSum=Se.checksum(u),d.offset=c,d.length=u.byteLength,s.view.writeBytes(u,c),c+=e(d.length)});const l=s.createSfnt().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-Se.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Gt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ne(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}};Xe(Ut,"FLAGS",new Set([65536,1953658213,1954115633,1330926671])),re([p("uint32")],Ut.prototype,"scalerType"),re([p("uint16")],Ut.prototype,"numTables"),re([p("uint16")],Ut.prototype,"searchRange"),re([p("uint16")],Ut.prototype,"entrySelector"),re([p("uint16")],Ut.prototype,"rangeShift");let Ct=Ut;var hs=Object.defineProperty,ie=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&hs(t,e,r),r};class Ft extends bt{constructor(t,e){super(t,e,20)}}ie([p({type:"char",size:4})],Ft.prototype,"tag"),ie([p("uint32")],Ft.prototype,"offset"),ie([p("uint32")],Ft.prototype,"compLength"),ie([p("uint32")],Ft.prototype,"origLength"),ie([p("uint32")],Ft.prototype,"origChecksum");var Ln=Object.defineProperty,cs=(i,t,e)=>t in i?Ln(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ct=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Ln(t,e,r),r},ke=(i,t,e)=>(cs(i,typeof t!="symbol"?t+"":t,e),e);const at=class rn extends ge{constructor(){super(...arguments),ke(this,"mimeType","font/woff"),ke(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(It(t).getUint32(0))}static checkSum(t){const e=It(t),n=e.byteLength,r=Math.floor(n/4);let s=0,o=0;for(;o<r;)s+=e.getUint32(4*o++,!1);let c=n-r*4;if(c){let h=r*4;for(;c>0;)s+=e.getUint8(h)<<c*8,h++,c--}return s%4294967296}static from(t,e=new ArrayBuffer(0)){const n=u=>u+3&-4,r=[];t.tableViews.forEach((u,g)=>{const d=It(Nr(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));r.push({tag:g,view:d.byteLength<u.byteLength?d:u,rawView:u})});const s=r.length,o=r.reduce((u,g)=>u+n(g.view.byteLength),0),c=new rn(new ArrayBuffer(44+20*s+o+e.byteLength));c.signature=2001684038,c.flavor=65536,c.length=c.view.byteLength,c.numTables=s,c.totalSfntSize=12+16*s+r.reduce((u,g)=>u+n(g.rawView.byteLength),0);let h=44+s*20,a=0;const l=c.getDirectories();return r.forEach(u=>{const g=l[a++];g.tag=u.tag,g.offset=h,g.compLength=u.view.byteLength,g.origChecksum=rn.checkSum(u.rawView),g.origLength=u.rawView.byteLength,c.view.writeBytes(u.view,h),h+=n(g.compLength)}),c.view.writeBytes(e),c}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Ft(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ne(this.getDirectories().reduce((t,e)=>{const n=e.tag,r=this.view.byteOffset+e.offset,s=e.compLength,o=e.origLength,c=r+s;return t[n]=s>=o?new DataView(this.view.buffer,r,s):new DataView(Gr(new Uint8Array(this.view.buffer.slice(r,c))).buffer),t},{}))}};ke(at,"FLAGS",new Set([2001684038])),ct([p("uint32")],at.prototype,"signature"),ct([p("uint32")],at.prototype,"flavor"),ct([p("uint32")],at.prototype,"length"),ct([p("uint16")],at.prototype,"numTables"),ct([p("uint16")],at.prototype,"reserved"),ct([p("uint32")],at.prototype,"totalSfntSize"),ct([p("uint16")],at.prototype,"majorVersion"),ct([p("uint16")],at.prototype,"minorVersion"),ct([p("uint32")],at.prototype,"metaOffset"),ct([p("uint32")],at.prototype,"metaLength"),ct([p("uint32")],at.prototype,"metaOrigLength"),ct([p("uint32")],at.prototype,"privOffset"),ct([p("uint32")],at.prototype,"privLength");let Tt=at;var ls=Object.defineProperty,us=(i,t,e)=>t in i?ls(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,se=(i,t,e)=>(us(i,typeof t!="symbol"?t+"":t,e),e);const Dn=class Pr{constructor(){se(this,"fallbackFont"),se(this,"_loading",new Map),se(this,"_loaded",new Map),se(this,"_namesUrls",new Map)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...Pr.defaultRequestInit,...e,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
|
|
1
|
+
(function(f,z){typeof exports=="object"&&typeof module<"u"?z(exports):typeof define=="function"&&define.amd?define(["exports"],z):(f=typeof globalThis<"u"?globalThis:f||self,z(f.modernText={}))})(this,function(f){"use strict";var no=Object.defineProperty;var ro=(f,z,yt)=>z in f?no(f,z,{enumerable:!0,configurable:!0,writable:!0,value:yt}):f[z]=yt;var $=(f,z,yt)=>ro(f,typeof z!="symbol"?z+"":z,yt);function z(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:o,stops:h}=dr(t,e.left,e.top,e.width,e.height),c=i.createLinearGradient(n,r,s,o);return h.forEach(a=>c.addColorStop(a.offset,a.color)),c}return t}function yt(i,t,e){i!=null&&i.color&&(i.color=z(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=z(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=z(e,i.textStrokeColor,t))}function dr(i,t,e,n,r){var g;const s=((g=i.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",o=s.split(",")[0],h=o.includes("deg")?o:"0deg",c=s.replace(h,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),l=(Number(h.replace("deg",""))||0)*Math.PI/180,u=n*Math.sin(l),y=r*Math.cos(l);return{x0:t+n/2-u,y0:e+r/2+y,x1:t+n/2+u,y1:e+r/2-y,stops:Array.from(c).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 Se(i){const{ctx:t,paths:e,fontSize:n}=i;e.forEach(r=>{var l;t.save(),t.beginPath();const s=((l=r.userData)==null?void 0:l.style)??{},o=i.color??s.fill??"none",h=i.textStrokeColor??s.stroke??"none";t.fillStyle=o!=="none"?o:"#000",t.strokeStyle=h!=="none"?h:"#000",t.lineWidth=i.textStrokeWidth?i.textStrokeWidth*n:s.strokeWidth?s.strokeWidth*n*.03:0,t.lineCap=s.strokeLineCap??"round",t.lineJoin=s.strokeLineJoin??"miter",t.miterLimit=s.strokeMiterLimit??0,t.shadowOffsetX=(i.shadowOffsetX??0)*n,t.shadowOffsetY=(i.shadowOffsetY??0)*n,t.shadowBlur=(i.shadowBlur??0)*n,t.shadowColor=i.shadowColor??"rgba(0, 0, 0, 0)";const c=(i.offsetX??0)*n,a=(i.offsetY??0)*n;t.translate(c,a),r.drawTo(t),o!=="none"&&t.fill(),h!=="none"&&t.stroke(),t.restore()})}var k=Uint8Array,it=Uint16Array,Pe=Int32Array,he=new k([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]),ce=new k([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]),Ce=new k([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nn=function(i,t){for(var e=new it(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var r=new Pe(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)r[s]=s-e[n]<<5|n;return{b:e,r}},rn=nn(he,2),sn=rn.b,Te=rn.r;sn[28]=258,Te[258]=28;for(var on=nn(ce,0),mr=on.b,an=on.r,Oe=new it(32768),I=0;I<32768;++I){var Pt=(I&43690)>>1|(I&21845)<<1;Pt=(Pt&52428)>>2|(Pt&13107)<<2,Pt=(Pt&61680)>>4|(Pt&3855)<<4,Oe[I]=((Pt&65280)>>8|(Pt&255)<<8)>>1}for(var gt=function(i,t,e){for(var n=i.length,r=0,s=new it(t);r<n;++r)i[r]&&++s[i[r]-1];var o=new it(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var h;if(e){h=new it(1<<t);var c=15-t;for(r=0;r<n;++r)if(i[r])for(var a=r<<4|i[r],l=t-i[r],u=o[i[r]-1]++<<l,y=u|(1<<l)-1;u<=y;++u)h[Oe[u]>>c]=a}else for(h=new it(n),r=0;r<n;++r)i[r]&&(h[r]=Oe[o[i[r]-1]++]>>15-i[r]);return h},Ct=new k(288),I=0;I<144;++I)Ct[I]=8;for(var I=144;I<256;++I)Ct[I]=9;for(var I=256;I<280;++I)Ct[I]=7;for(var I=280;I<288;++I)Ct[I]=8;for(var Wt=new k(32),I=0;I<32;++I)Wt[I]=5;var vr=gt(Ct,9,0),wr=gt(Ct,9,1),br=gt(Wt,5,0),xr=gt(Wt,5,1),Ae=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},ft=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},$e=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ie=function(i){return(i+7)/8|0},hn=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new k(i.subarray(t,e))},_r=["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"],pt=function(i,t,e){var n=new Error(t||_r[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,pt),!e)throw n;return n},Mr=function(i,t,e,n){var r=i.length,s=0;if(!r||t.f&&!t.l)return e||new k(0);var o=!e,h=o||t.i!=2,c=t.i;o&&(e=new k(r*3));var a=function(se){var oe=e.length;if(se>oe){var kt=new k(Math.max(oe*2,se));kt.set(e),e=kt}},l=t.f||0,u=t.p||0,y=t.b||0,g=t.l,d=t.d,m=t.m,v=t.n,_=r*8;do{if(!g){l=ft(i,u,1);var x=ft(i,u+1,3);if(u+=3,x)if(x==1)g=wr,d=xr,m=9,v=5;else if(x==2){var O=ft(i,u,31)+257,A=ft(i,u+10,15)+4,M=O+ft(i,u+5,31)+1;u+=14;for(var S=new k(M),B=new k(19),N=0;N<A;++N)B[Ce[N]]=ft(i,u+N*3,7);u+=A*3;for(var K=Ae(B),Ot=(1<<K)-1,ot=gt(B,K,1),N=0;N<M;){var nt=ot[ft(i,u,Ot)];u+=nt&15;var w=nt>>4;if(w<16)S[N++]=w;else{var V=0,U=0;for(w==16?(U=3+ft(i,u,3),u+=2,V=S[N-1]):w==17?(U=3+ft(i,u,7),u+=3):w==18&&(U=11+ft(i,u,127),u+=7);U--;)S[N++]=V}}var rt=S.subarray(0,O),H=S.subarray(O);m=Ae(rt),v=Ae(H),g=gt(rt,m,1),d=gt(H,v,1)}else pt(1);else{var w=Ie(u)+4,C=i[w-4]|i[w-3]<<8,T=w+C;if(T>r){c&&pt(0);break}h&&a(y+C),e.set(i.subarray(w,T),y),t.b=y+=C,t.p=u=T*8,t.f=l;continue}if(u>_){c&&pt(0);break}}h&&a(y+131072);for(var ie=(1<<m)-1,ut=(1<<v)-1,St=u;;St=u){var V=g[$e(i,u)&ie],at=V>>4;if(u+=V&15,u>_){c&&pt(0);break}if(V||pt(2),at<256)e[y++]=at;else if(at==256){St=u,g=null;break}else{var ht=at-254;if(at>264){var N=at-257,E=he[N];ht=ft(i,u,(1<<E)-1)+sn[N],u+=E}var bt=d[$e(i,u)&ut],Ht=bt>>4;bt||pt(3),u+=bt&15;var H=mr[Ht];if(Ht>3){var E=ce[Ht];H+=$e(i,u)&(1<<E)-1,u+=E}if(u>_){c&&pt(0);break}h&&a(y+131072);var zt=y+ht;if(y<H){var xe=s-H,_e=Math.min(H,zt);for(xe+y<0&&pt(3);y<_e;++y)e[y]=n[xe+y]}for(;y<zt;++y)e[y]=e[y-H]}}t.l=g,t.p=St,t.b=y,t.f=l,g&&(l=1,t.m=m,t.d=d,t.n=v)}while(!l);return y!=e.length&&o?hn(e,0,y):e.subarray(0,y)},xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8},Xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8,i[n+2]|=e>>16},De=function(i,t){for(var e=[],n=0;n<i.length;++n)i[n]&&e.push({s:n,f:i[n]});var r=e.length,s=e.slice();if(!r)return{t:fn,l:0};if(r==1){var o=new k(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(T,O){return T.f-O.f}),e.push({s:-1,f:25001});var h=e[0],c=e[1],a=0,l=1,u=2;for(e[0]={s:-1,f:h.f+c.f,l:h,r:c};l!=r-1;)h=e[e[a].f<e[u].f?a++:u++],c=e[a!=l&&e[a].f<e[u].f?a++:u++],e[l++]={s:-1,f:h.f+c.f,l:h,r:c};for(var y=s[0].s,n=1;n<r;++n)s[n].s>y&&(y=s[n].s);var g=new it(y+1),d=Le(e[l-1],g,0);if(d>t){var n=0,m=0,v=d-t,_=1<<v;for(s.sort(function(O,A){return g[A.s]-g[O.s]||O.f-A.f});n<r;++n){var x=s[n].s;if(g[x]>t)m+=_-(1<<d-g[x]),g[x]=t;else break}for(m>>=v;m>0;){var w=s[n].s;g[w]<t?m-=1<<t-g[w]++-1:++n}for(;n>=0&&m;--n){var C=s[n].s;g[C]==t&&(--g[C],++m)}d=t}return{t:new k(g),l:d}},Le=function(i,t,e){return i.s==-1?Math.max(Le(i.l,t,e+1),Le(i.r,t,e+1)):t[i.s]=e},cn=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new it(++t),n=0,r=i[0],s=1,o=function(c){e[n++]=c},h=1;h<=t;++h)if(i[h]==r&&h!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=i[h]}return{c:e.subarray(0,n),n:t}},qt=function(i,t){for(var e=0,n=0;n<t.length;++n)e+=i[n]*t[n];return e},ln=function(i,t,e){var n=e.length,r=Ie(t+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var s=0;s<n;++s)i[r+s+4]=e[s];return(r+4+n)*8},un=function(i,t,e,n,r,s,o,h,c,a,l){xt(t,l++,e),++r[256];for(var u=De(r,15),y=u.t,g=u.l,d=De(s,15),m=d.t,v=d.l,_=cn(y),x=_.c,w=_.n,C=cn(m),T=C.c,O=C.n,A=new it(19),M=0;M<x.length;++M)++A[x[M]&31];for(var M=0;M<T.length;++M)++A[T[M]&31];for(var S=De(A,7),B=S.t,N=S.l,K=19;K>4&&!B[Ce[K-1]];--K);var Ot=a+5<<3,ot=qt(r,Ct)+qt(s,Wt)+o,nt=qt(r,y)+qt(s,m)+o+14+3*K+qt(A,B)+2*A[16]+3*A[17]+7*A[18];if(c>=0&&Ot<=ot&&Ot<=nt)return ln(t,l,i.subarray(c,c+a));var V,U,rt,H;if(xt(t,l,1+(nt<ot)),l+=2,nt<ot){V=gt(y,g,0),U=y,rt=gt(m,v,0),H=m;var ie=gt(B,N,0);xt(t,l,w-257),xt(t,l+5,O-1),xt(t,l+10,K-4),l+=14;for(var M=0;M<K;++M)xt(t,l+3*M,B[Ce[M]]);l+=3*K;for(var ut=[x,T],St=0;St<2;++St)for(var at=ut[St],M=0;M<at.length;++M){var ht=at[M]&31;xt(t,l,ie[ht]),l+=B[ht],ht>15&&(xt(t,l,at[M]>>5&127),l+=at[M]>>12)}}else V=vr,U=Ct,rt=br,H=Wt;for(var M=0;M<h;++M){var E=n[M];if(E>255){var ht=E>>18&31;Xt(t,l,V[ht+257]),l+=U[ht+257],ht>7&&(xt(t,l,E>>23&31),l+=he[ht]);var bt=E&31;Xt(t,l,rt[bt]),l+=H[bt],bt>3&&(Xt(t,l,E>>5&8191),l+=ce[bt])}else Xt(t,l,V[E]),l+=U[E]}return Xt(t,l,V[256]),l+U[256]},Sr=new Pe([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fn=new k(0),Pr=function(i,t,e,n,r,s){var o=s.z||i.length,h=new k(n+o+5*(1+Math.ceil(o/7e3))+r),c=h.subarray(n,h.length-r),a=s.l,l=(s.r||0)&7;if(t){l&&(c[0]=s.r>>3);for(var u=Sr[t-1],y=u>>13,g=u&8191,d=(1<<e)-1,m=s.p||new it(32768),v=s.h||new it(d+1),_=Math.ceil(e/3),x=2*_,w=function(tn){return(i[tn]^i[tn+1]<<_^i[tn+2]<<x)&d},C=new Pe(25e3),T=new it(288),O=new it(32),A=0,M=0,S=s.i||0,B=0,N=s.w||0,K=0;S+2<o;++S){var Ot=w(S),ot=S&32767,nt=v[Ot];if(m[ot]=nt,v[Ot]=ot,N<=S){var V=o-S;if((A>7e3||B>24576)&&(V>423||!a)){l=un(i,c,0,C,T,O,M,B,K,S-K,l),B=A=M=0,K=S;for(var U=0;U<286;++U)T[U]=0;for(var U=0;U<30;++U)O[U]=0}var rt=2,H=0,ie=g,ut=ot-nt&32767;if(V>2&&Ot==w(S-ut))for(var St=Math.min(y,V)-1,at=Math.min(32767,S),ht=Math.min(258,V);ut<=at&&--ie&&ot!=nt;){if(i[S+rt]==i[S+rt-ut]){for(var E=0;E<ht&&i[S+E]==i[S+E-ut];++E);if(E>rt){if(rt=E,H=ut,E>St)break;for(var bt=Math.min(ut,E-2),Ht=0,U=0;U<bt;++U){var zt=S-ut+U&32767,xe=m[zt],_e=zt-xe&32767;_e>Ht&&(Ht=_e,nt=zt)}}}ot=nt,nt=m[ot],ut+=ot-nt&32767}if(H){C[B++]=268435456|Te[rt]<<18|an[H];var se=Te[rt]&31,oe=an[H]&31;M+=he[se]+ce[oe],++T[257+se],++O[oe],N=S+rt,++A}else C[B++]=i[S],++T[i[S]]}}for(S=Math.max(S,N);S<o;++S)C[B++]=i[S],++T[i[S]];l=un(i,c,a,C,T,O,M,B,K,S-K,l),a||(s.r=l&7|c[l/8|0]<<3,l-=7,s.h=v,s.p=m,s.i=S,s.w=N)}else{for(var S=s.w||0;S<o+a;S+=65535){var kt=S+65535;kt>=o&&(c[l/8|0]=a,kt=o),l=ln(c,l+1,i.subarray(S,kt))}s.i=o}return hn(h,0,n+Ie(l)+r)},pn=function(){var i=1,t=0;return{p:function(e){for(var n=i,r=t,s=e.length|0,o=0;o!=s;){for(var h=Math.min(o+2655,s);o<h;++o)r+=n+=e[o];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,t=r},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},Cr=function(i,t,e,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new k(s.length+i.length);o.set(s),o.set(i,s.length),i=o,r.w=s.length}return Pr(i,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,n,r)},yn=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},Tr=function(i,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=n<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var r=pn();r.p(t.dictionary),yn(i,2,r.d())}},Or=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&pt(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&pt(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ar(i,t){t||(t={});var e=pn();e.p(i);var n=Cr(i,t,t.dictionary?6:2,4);return Tr(n,t),yn(n,n.length-4,e.d()),n}function $r(i,t){return Mr(i.subarray(Or(i,t),-4),{i:2},t,t)}var Ir=typeof TextDecoder<"u"&&new TextDecoder,Dr=0;try{Ir.decode(fn,{stream:!0}),Dr=1}catch{}const Lr="modern-font";function jt(i,t){if(!i)throw new Error(`[${Lr}] ${t}`)}function Ur(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function At(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var gn=Object.defineProperty,Er=(i,t,e)=>t in i?gn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,W=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&gn(t,e,r),r},Fr=(i,t,e)=>(Er(i,t+"",e),e);const le={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function X(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class R extends DataView{constructor(t,e,n,r){super(Ur(t),e,n),this.littleEndian=r,Fr(this,"cursor",0)}getColumn(t){if(t.size){const e=Array.from({length:t.size},(n,r)=>this.read(t.type,t.offset+r));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}setColumn(t,e){t.size?Array.from({length:t.size},(n,r)=>{this.write(t.type,e[r],t.offset+r)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,n=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,n);case"longDateTime":return this.readLongDateTime(e,n)}const r=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,s=this[r](e,n);return this.cursor+=le[t],s}readUint24(t=this.cursor){const[e,n,r]=this.readBytes(t,3);return(e<<16)+(n<<8)+r}readBytes(t,e){e==null&&(e=t,t=this.cursor);const n=[];for(let r=0;r<e;++r)n.push(this.getUint8(t+r));return this.cursor=t+e,n}readString(t,e){e===void 0&&(e=t,t=this.cursor);let n="";for(let r=0;r<e;++r)n+=String.fromCharCode(this.readUint8(t+r));return this.cursor=t+e,n}readFixed(t,e){const n=this.readInt32(t,e)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,e){const n=this.readUint32(t+4,e),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(t){return this.readString(t,1)}write(t,e,n=this.cursor,r=this.littleEndian){switch(t){case"char":return this.writeChar(e,n);case"fixed":return this.writeFixed(e,n);case"longDateTime":return this.writeLongDateTime(e,n)}const s=`set${t.replace(/^\S/,h=>h.toUpperCase())}`,o=this[s](n,e,r);return this.cursor+=le[t.toLowerCase()],o}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let r=0,s=t.length,o;r<s;++r)o=t.charCodeAt(r)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=n,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 r=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(r,e+4),this}writeBytes(t,e=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let r=0;r<n;++r)this.setUint8(e+r,t[r])}else{const r=At(t);n=r.byteLength;for(let s=0;s<n;++s)this.setUint8(e+s,r.getUint8(s))}return this.cursor=e+n,this}seek(t){return this.cursor=t,this}}W([X()],R.prototype,"readInt8"),W([X()],R.prototype,"readInt16"),W([X()],R.prototype,"readInt32"),W([X()],R.prototype,"readUint8"),W([X()],R.prototype,"readUint16"),W([X()],R.prototype,"readUint32"),W([X()],R.prototype,"readFloat32"),W([X()],R.prototype,"readFloat64"),W([X()],R.prototype,"writeInt8"),W([X()],R.prototype,"writeInt16"),W([X()],R.prototype,"writeInt32"),W([X()],R.prototype,"writeUint8"),W([X()],R.prototype,"writeUint16"),W([X()],R.prototype,"writeUint32"),W([X()],R.prototype,"writeFloat32"),W([X()],R.prototype,"writeFloat64");var Br=Object.defineProperty,Nr=(i,t,e)=>t in i?Br(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Gr=(i,t,e)=>(Nr(i,t+"",e),e);const dn=new WeakMap;function p(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:n}=t;return(r,s)=>{if(typeof s!="string")return;let o=dn.get(r);o||(o={columns:[],byteLength:0},dn.set(r,o));const h={...t,name:s,byteLength:e*le[n],offset:t.offset??o.columns.reduce((c,a)=>c+a.byteLength,0)};o.columns.push(h),o.byteLength=o.columns.reduce((c,a)=>c+le[a.type]*(a.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.getColumn(h)},set(c){this.view.setColumn(h,c)},configurable:!0,enumerable:!0})}}class dt{constructor(t,e,n,r){Gr(this,"view"),this.view=new R(t,e,n,r)}}function Rr(i){let t="";for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),r!==0&&(t+=String.fromCharCode(r));return t}function ue(i){i=Rr(i);const t=[];for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),t.push(r>>8),t.push(r&255);return t}function Vr(i){let t="";for(let e=0,n=i.length;e<n;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function Hr(i){let t="";for(let e=0,n=i.length;e<n;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}var zr=Object.defineProperty,kr=(i,t,e)=>t in i?zr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wr=(i,t,e)=>(kr(i,t+"",e),e);class fe extends dt{constructor(){super(...arguments),Wr(this,"mimeType","font/opentype")}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 mn=Object.defineProperty,Xr=(i,t,e)=>t in i?mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Q=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&mn(t,e,r),r},qr=(i,t,e)=>(Xr(i,t+"",e),e);const q=class ur extends fe{constructor(){super(...arguments),qr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,r=e.name.getNames(),s=ue(r.fontFamily||""),o=s.length,h=ue(r.fontStyle||""),c=h.length,a=ue(r.version||""),l=a.length,u=ue(r.fullName||""),y=u.length,g=86+o+4+c+4+l+4+y+2+t.view.byteLength,d=new ur(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(o),d.view.writeBytes(s),d.view.writeUint16(0),d.view.writeUint16(c),d.view.writeBytes(h),d.view.writeUint16(0),d.view.writeUint16(l),d.view.writeBytes(a),d.view.writeUint16(0),d.view.writeUint16(y),d.view.writeBytes(u),d.view.writeUint16(0),d.view.writeUint16(0),d.view.writeBytes(t.view),d}};Q([p("uint32")],q.prototype,"EOTSize"),Q([p("uint32")],q.prototype,"FontDataSize"),Q([p("uint32")],q.prototype,"Version"),Q([p("uint32")],q.prototype,"Flags"),Q([p({type:"uint8",size:10})],q.prototype,"FontPANOSE"),Q([p("uint8")],q.prototype,"Charset"),Q([p("uint8")],q.prototype,"Italic"),Q([p("uint32")],q.prototype,"Weight"),Q([p("uint16")],q.prototype,"fsType"),Q([p("uint16")],q.prototype,"MagicNumber"),Q([p({type:"uint8",size:16})],q.prototype,"UnicodeRange"),Q([p({type:"uint8",size:8})],q.prototype,"CodePageRange"),Q([p("uint32")],q.prototype,"CheckSumAdjustment"),Q([p({type:"uint8",size:16})],q.prototype,"Reserved"),Q([p("uint16")],q.prototype,"Padding1");let jr=q;var Yr=Object.defineProperty,pe=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Yr(t,e,r),r};class Bt extends dt{constructor(t,e){super(t,e,16)}}pe([p({type:"char",size:4})],Bt.prototype,"tag"),pe([p("uint32")],Bt.prototype,"checkSum"),pe([p("uint32")],Bt.prototype,"offset"),pe([p("uint32")],Bt.prototype,"length");var Kr=Object.defineProperty,ye=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Kr(t,e,r),r};const Yt=class fr extends dt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new fr;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((n,r)=>{r<256&&n<256&&e.view.writeUint8(n,6+r)}),e}getUnicodeGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,n)=>{t.set(n,e)}),t}};ye([p("uint16")],Yt.prototype,"format"),ye([p("uint16")],Yt.prototype,"length"),ye([p("uint16")],Yt.prototype,"language"),ye([p({type:"uint8",size:256})],Yt.prototype,"glyphIndexArray");let Ue=Yt;var Qr=Object.defineProperty,Ee=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Qr(t,e,r),r};class Kt extends dt{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,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-n)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const n=(this.view.byteLength-e)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(t){const e=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,s=this.subHeaders,o=this.glyphIndexArray,h=n.findIndex(a=>a===r);let c=0;for(let a=0;a<256;a++)if(n[a]===0)a>=h||a<s[0].firstCode||a>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(a-s[0].firstCode)>=o.length?c=0:(c=o[s[0].idRangeOffset+(a-s[0].firstCode)],c!==0&&(c=c+s[0].idDelta)),c!==0&&c<t&&e.set(a,c);else{const l=n[a];for(let u=0,y=s[l].entryCount;u<y;u++)if(s[l].idRangeOffset+u>=o.length?c=0:(c=o[s[l].idRangeOffset+u],c!==0&&(c=c+s[l].idDelta)),c!==0&&c<t){const g=(a<<8|u+s[l].firstCode)%65535;e.set(g,c)}}return e}}Ee([p("uint16")],Kt.prototype,"format"),Ee([p("uint16")],Kt.prototype,"length"),Ee([p("uint16")],Kt.prototype,"language");function vn(i){return i>32767?i-65536:i<-32767?i+65536:i}function Fe(i,t){let e;const n=[];let r={};return i.forEach((s,o)=>{t&&o>t||((!e||o!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(r.end=e.unicode,n.push(r),r={start:o,startId:s,delta:vn(s-o)}):(r.start=Number(o),r.startId=s,r.delta=vn(s-o))),e={unicode:o,glyphIndex:s})}),e&&(r.end=e.unicode,n.push(r)),n}var Zr=Object.defineProperty,$t=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Zr(t,e,r),r};const Tt=class pr extends dt{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(n=>this.view.writeUint16(n))}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=Fe(t,65535),n=e.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,o=new pr(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=n*2,o.searchRange=s,o.entrySelector=r,o.rangeShift=2*n-s,o.endCode=[...e.map(h=>h.end),65535],o.reservedPad=0,o.startCode=[...e.map(h=>h.start),65535],o.idDelta=[...e.map(h=>h.delta),1],o.idRangeOffset=Array.from({length:n},()=>0),o}getUnicodeGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,o=this.idRangeOffset,h=this.idDelta,c=this.glyphIndexArray;for(let a=0;a<e;++a)for(let l=r[a],u=s[a];l<=u;++l)if(o[a]===0)t.set(l,(l+h[a])%65536);else{const y=a+o[a]/2+(l-r[a])-n,g=c[y];g!==0?t.set(l,(g+h[a])%65536):t.set(l,0)}return t.delete(65535),t}};$t([p("uint16")],Tt.prototype,"format"),$t([p("uint16")],Tt.prototype,"length"),$t([p("uint16")],Tt.prototype,"language"),$t([p("uint16")],Tt.prototype,"segCountX2"),$t([p("uint16")],Tt.prototype,"searchRange"),$t([p("uint16")],Tt.prototype,"entrySelector"),$t([p("uint16")],Tt.prototype,"rangeShift");let Be=Tt;var Jr=Object.defineProperty,Qt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Jr(t,e,r),r};class It extends dt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((n,r)=>{e.set(r,n)}),e}}Qt([p("uint16")],It.prototype,"format"),Qt([p("uint16")],It.prototype,"length"),Qt([p("uint16")],It.prototype,"language"),Qt([p("uint16")],It.prototype,"firstCode"),Qt([p("uint16")],It.prototype,"entryCount");var ti=Object.defineProperty,Zt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ti(t,e,r),r};const Nt=class yr extends dt{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=Fe(t),n=new yr(new ArrayBuffer(16+e.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=e.length,e.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeGlyphIndexMap(){const t=new Map,e=this.groups;for(let n=0,r=e.length;n<r;n++){const s=e[n];let o=s.startGlyphCode,h=s.startCharCode;const c=s.endCharCode;for(;h<=c;)t.set(h++,o++)}return t}};Zt([p("uint16")],Nt.prototype,"format"),Zt([p("uint16")],Nt.prototype,"reserved"),Zt([p("uint32")],Nt.prototype,"length"),Zt([p("uint32")],Nt.prototype,"language"),Zt([p("uint32")],Nt.prototype,"nGroups");let Ne=Nt;var ei=Object.defineProperty,Ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ei(t,e,r),r};class Jt extends dt{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 n=this.view.readUint32();e.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const n=this.view.readUint32();e.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let n=0,r=e.length;n<r;n++){const{uVSMappings:s}=e[n];s.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}Ge([p("uint16")],Jt.prototype,"format"),Ge([p("uint32")],Jt.prototype,"length"),Ge([p("uint32")],Jt.prototype,"numVarSelectorRecords");var ni=Object.defineProperty,ri=(i,t,e)=>t in i?ni(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Re=(i,t,e)=>(ri(i,typeof t!="symbol"?t+"":t,e),e);function j(i,t=i){return e=>{te.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(te.prototype,t,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const wn=class ae{constructor(t){Re(this,"tables",new Map),Re(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get names(){return this.name.getNames()}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}charToGlyphIndex(t){return this.cmap.unicodeGlyphIndexMap.get(t.codePointAt(0))??0}charToGlyph(t){return this.glyf.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=this.cmap.unicodeGlyphIndexMap,n=[];for(const r of t){const s=r.codePointAt(0);n.push(e.get(s)??0)}return n}textToGlyphs(t){const e=this.glyf.glyphs,n=this.textToGlyphIndexes(t),r=n.length,s=Array.from({length:r}),o=e.get(0);for(let h=0;h<r;h+=1)s[h]=e.get(n[h])||o;return s}getPathCommands(t,e,n,r,s){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,n,r,s,this)}getAdvanceWidth(t,e,n){return this.forEachGlyph(t,0,0,e,n,()=>{})}forEachGlyph(t,e=0,n=0,r=72,s={},o){const h=1/this.unitsPerEm*r,c=this.textToGlyphs(t);for(let a=0;a<c.length;a+=1){const l=c[a];o.call(this,l,e,n,r,s),l.advanceWidth&&(e+=l.advanceWidth*h),s.letterSpacing?e+=s.letterSpacing*r:s.tracking&&(e+=s.tracking/1e3*r)}return e}clone(){return new ae(this.tableViews)}delete(t){const e=ae.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=ae.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ae.tableDefinitions.get(t);if(!e)return;let n=this.tables.get(e.prop);if(!n){const r=e.class;if(r){const s=this.tableViews.get(t);s?n=new r(s.buffer,s.byteOffset,s.byteLength).setSfnt(this):n=new r().setSfnt(this),this.tables.set(e.prop,n)}}return n}};Re(wn,"tableDefinitions",new Map);let te=wn;class Z extends dt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var bn=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,si=(i,t,e)=>t in i?bn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t,e,n)=>{for(var r=n>1?void 0:n?ii(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&bn(t,e,r),r},oi=(i,t,e)=>(si(i,t+"",e),e);f.Cmap=class extends Z{constructor(){super(...arguments),oi(this,"_unicodeGlyphIndexMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),n=Be.from(t),r=Ue.from(t),s=e?Ne.from(t):void 0,o=4+(s?32:24),h=o+n.view.byteLength,c=h+r.view.byteLength,a=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:h},{platformID:3,platformSpecificID:1,offset:o},s&&{platformID:3,platformSpecificID:10,offset:c}].filter(Boolean),l=new f.Cmap(new ArrayBuffer(4+8*a.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return l.numberSubtables=a.length,l.view.seek(4),a.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(n.view,o),l.view.writeBytes(r.view,h),s&&l.view.writeBytes(s.view,c),l}get unicodeGlyphIndexMap(){return this._unicodeGlyphIndexMap||(this._unicodeGlyphIndexMap=this._getUnicodeGlyphIndexMap()),this._unicodeGlyphIndexMap}_getSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new Ue(this.view.buffer,e.offset);break;case 2:r=new Kt(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new Be(this.view.buffer,e.offset,this.view.readUint16());break;case 6:r=new It(this.view.buffer,e.offset,this.view.readUint16());break;case 12:r=new Ne(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new Jt(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:n,view:r}})}_getUnicodeGlyphIndexMap(){var h,c,a,l,u;const t=this._getSubtables(),e=(h=t.find(y=>y.format===0))==null?void 0:h.view,n=(c=t.find(y=>y.platformID===3&&y.platformSpecificID===3&&y.format===2))==null?void 0:c.view,r=(a=t.find(y=>y.platformID===3&&y.platformSpecificID===1&&y.format===4))==null?void 0:a.view,s=(l=t.find(y=>y.platformID===3&&y.platformSpecificID===10&&y.format===12))==null?void 0:l.view,o=(u=t.find(y=>y.platformID===0&&y.platformSpecificID===5&&y.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeGlyphIndexMap())??[]])}},Ve([p("uint16")],f.Cmap.prototype,"version",2),Ve([p("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=Ve([j("cmap")],f.Cmap);var ai=Object.defineProperty,hi=(i,t,e)=>t in i?ai(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ci=(i,t,e)=>(hi(i,t+"",e),e);class xn{constructor(t){ci(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,this.unicode=e.unicode,this.unicodes=e.unicodes||(e.unicode!==void 0?[e.unicode]:[]),e.xMin!==void 0&&(this.xMin=e.xMin),e.yMin!==void 0&&(this.yMin=e.yMin),e.xMax!==void 0&&(this.xMax=e.xMax),e.yMax!==void 0&&(this.yMax=e.yMax),e.advanceWidth!==void 0&&(this.advanceWidth=e.advanceWidth),e.leftSideBearing!==void 0&&(this.leftSideBearing=e.leftSideBearing),e.points!==void 0&&(this.points=e.points)}_parseContours(t){const e=[];let n=[];for(let r=0;r<t.length;r+=1){const s=t[r];n.push(s),s.lastPointOfContour&&(e.push(n),n=[])}return jt(n.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const n=[];for(let r=0;r<t.length;r+=1){const s=t[r],o={x:e.xScale*s.x+e.scale10*s.y+e.dx,y:e.scale01*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(o)}return n}_parseGlyphCoordinate(t,e,n,r,s){let o;return(e&r)>0?(o=t.view.readUint8(),e&s||(o=-o),o=n+o):(e&s)>0?o=n:o=n+t.view.readInt16(),o}_parse(t,e,n){t.view.seek(e);const r=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(),r>0){const h=this.endPointIndices=[];for(let m=0;m<r;m++)h.push(t.view.readUint16());const c=this.instructionLength=t.view.readUint16();jt(c<5e3,`Bad instructionLength:${c}`);const a=this.instructions=[];for(let m=0;m<c;++m)a.push(t.view.readUint8());const l=t.view.byteOffset,u=h[h.length-1]+1;jt(u<2e4,`Bad numberOfCoordinates:${l}`);const y=[];let g,d=0;for(;d<u;)if(g=t.view.readUint8(),y.push(g),d++,g&8&&d<u){const m=t.view.readUint8();for(let v=0;v<m;v++)y.push(g),d++}if(jt(y.length===u,`Bad flags length: ${y.length}, numberOfCoordinates: ${u}`),h.length>0){const m=[];let v;if(u>0){for(let w=0;w<u;w+=1)g=y[w],v={},v.onCurve=!!(g&1),v.lastPointOfContour=h.includes(w),m.push(v);let _=0;for(let w=0;w<u;w+=1)g=y[w],v=m[w],v.x=this._parseGlyphCoordinate(t,g,_,2,16),_=v.x;let x=0;for(let w=0;w<u;w+=1)g=y[w],v=m[w],v.y=this._parseGlyphCoordinate(t,g,x,4,32),x=v.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let h,c=!0;for(;c;){h=t.view.readUint16();const a={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(h&1)>0?(h&2)>0?(a.dx=t.view.readInt16(),a.dy=t.view.readInt16()):a.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(h&2)>0?(a.dx=t.view.readInt8(),a.dy=t.view.readInt8()):a.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(h&8)>0?a.xScale=a.yScale=t.view.readInt16()/16384:(h&64)>0?(a.xScale=t.view.readInt16()/16384,a.yScale=t.view.readInt16()/16384):(h&128)>0&&(a.xScale=t.view.readInt16()/16384,a.scale01=t.view.readInt16()/16384,a.scale10=t.view.readInt16()/16384,a.yScale=t.view.readInt16()/16384),this.components.push(a),c=!!(h&32)}if(h&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let a=0;a<this.instructionLength;a+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let h=0;h<this.components.length;h+=1){const c=this.components[h],a=n.get(c.glyphIndex);if(a.getPathCommands(),a.points){let l;if(c.matchedPoints===void 0)l=this._transformPoints(a.points,c);else{jt(c.matchedPoints[0]>this.points.length-1||c.matchedPoints[1]>a.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[c.matchedPoints[0]];let y=a.points[c.matchedPoints[1]];const g={xScale:c.xScale,scale01:c.scale01,scale10:c.scale10,yScale:c.yScale,dx:0,dy:0};y=this._transformPoints([y],g)[0],g.dx=u.x-y.x,g.dy=u.y-y.y,l=this._transformPoints(a.points,g)}this.points=this.points.concat(l)}}const s=[],o=this._parseContours(this.points);for(let h=0,c=o.length;h<c;++h){const a=o[h];let l=a[a.length-1],u=a[0];l.onCurve?s.push({type:"M",x:l.x,y:l.y}):u.onCurve?s.push({type:"M",x:u.x,y:u.y}):s.push({type:"M",x:(l.x+u.x)*.5,y:(l.y+u.y)*.5});for(let y=0,g=a.length;y<g;++y)if(l=u,u=a[(y+1)%g],l.onCurve)s.push({type:"L",x:l.x,y:l.y});else{let d=u;u.onCurve||(d={x:(l.x+u.x)*.5,y:(l.y+u.y)*.5}),s.push({type:"Q",x1:l.x,y1:l.y,x:d.x,y:d.y})}s.push({type:"Z"})}this.pathCommands=s}getPathCommands(t=0,e=0,n=72,r={},s){const o=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:h=o,yScale:c=o}=r,a=this.pathCommands,l=[];for(let u=0,y=a.length;u<y;u+=1){const g=a[u];g.type==="M"?l.push({type:"M",x:t+g.x*h,y:e+-g.y*c}):g.type==="L"?l.push({type:"L",x:t+g.x*h,y:e+-g.y*c}):g.type==="Q"?l.push({type:"Q",x1:t+g.x1*h,y1:e+-g.y1*c,x:t+g.x*h,y:e+-g.y*c}):g.type==="Z"&&l.push({type:"Z"})}return l}}var li=Object.defineProperty,ui=(i,t,e)=>t in i?li(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fi=(i,t,e)=>(ui(i,t+"",e),e);class _n{constructor(t){this._sfnt=t,fi(this,"_items",[])}get length(){return this._sfnt.loca.locations.length}get(t){const e=this._items[t];let n;if(e)n=e;else{n=new xn({index:t});const r=this._sfnt.loca.locations,s=this._sfnt.hmtx.metrics,o=s[t],h=r[t];o&&(n.advanceWidth=s[t].advanceWidth,n.leftSideBearing=s[t].leftSideBearing),h!==r[t+1]&&n._parse(this._sfnt.glyf,h,this),this._items[t]=n}return n}}var Mn=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,yi=(i,t,e)=>t in i?Mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,gi=(i,t,e,n)=>{for(var r=n>1?void 0:n?pi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Mn(t,e,r),r},di=(i,t,e)=>(yi(i,t+"",e),e);const Gt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends Z{constructor(){super(...arguments),di(this,"_glyphs")}static from(t){const e=t.reduce((r,s)=>r+s.byteLength,0),n=new f.Glyf(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs||(this._glyphs=new _n(this._sfnt)),this._glyphs}},f.Glyf=gi([j("glyf")],f.Glyf);var mi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,wi=(i,t,e,n)=>{for(var r=n>1?void 0:n?vi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&mi(t,e,r),r};f.Gpos=class extends Z{},f.Gpos=wi([j("GPOS","gpos")],f.Gpos);var bi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,Dt=(i,t,e,n)=>{for(var r=n>1?void 0:n?xi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&bi(t,e,r),r};f.Gsub=class extends Z{},Dt([p("uint16")],f.Gsub.prototype,"majorVersion",2),Dt([p("uint16")],f.Gsub.prototype,"minorVersion",2),Dt([p("uint16")],f.Gsub.prototype,"scriptListOffset",2),Dt([p("uint16")],f.Gsub.prototype,"featureListOffset",2),Dt([p("uint16")],f.Gsub.prototype,"lookupListOffset",2),Dt([p("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Dt([j("GSUB","gsub")],f.Gsub);var _i=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,G=(i,t,e,n)=>{for(var r=n>1?void 0:n?Mi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&_i(t,e,r),r};f.Head=class extends Z{constructor(t=new ArrayBuffer(54),e){super(t,e,54)}},G([p("fixed")],f.Head.prototype,"version",2),G([p("fixed")],f.Head.prototype,"fontRevision",2),G([p("uint32")],f.Head.prototype,"checkSumAdjustment",2),G([p("uint32")],f.Head.prototype,"magickNumber",2),G([p("uint16")],f.Head.prototype,"flags",2),G([p("uint16")],f.Head.prototype,"unitsPerEm",2),G([p({type:"longDateTime"})],f.Head.prototype,"created",2),G([p({type:"longDateTime"})],f.Head.prototype,"modified",2),G([p("int16")],f.Head.prototype,"xMin",2),G([p("int16")],f.Head.prototype,"yMin",2),G([p("int16")],f.Head.prototype,"xMax",2),G([p("int16")],f.Head.prototype,"yMax",2),G([p("uint16")],f.Head.prototype,"macStyle",2),G([p("uint16")],f.Head.prototype,"lowestRecPPEM",2),G([p("int16")],f.Head.prototype,"fontDirectionHint",2),G([p("int16")],f.Head.prototype,"indexToLocFormat",2),G([p("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=G([j("head")],f.Head);var Si=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,J=(i,t,e,n)=>{for(var r=n>1?void 0:n?Pi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Si(t,e,r),r};f.Hhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},J([p("fixed")],f.Hhea.prototype,"version",2),J([p("int16")],f.Hhea.prototype,"ascent",2),J([p("int16")],f.Hhea.prototype,"descent",2),J([p("int16")],f.Hhea.prototype,"lineGap",2),J([p("uint16")],f.Hhea.prototype,"advanceWidthMax",2),J([p("int16")],f.Hhea.prototype,"minLeftSideBearing",2),J([p("int16")],f.Hhea.prototype,"minRightSideBearing",2),J([p("int16")],f.Hhea.prototype,"xMaxExtent",2),J([p("int16")],f.Hhea.prototype,"caretSlopeRise",2),J([p("int16")],f.Hhea.prototype,"caretSlopeRun",2),J([p("int16")],f.Hhea.prototype,"caretOffset",2),J([p({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),J([p("int16")],f.Hhea.prototype,"metricDataFormat",2),J([p("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=J([j("hhea")],f.Hhea);var Sn=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Ti=(i,t,e)=>t in i?Sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Oi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ci(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Sn(t,e,r),r},Ai=(i,t,e)=>(Ti(i,t+"",e),e);f.Hmtx=class extends Z{constructor(){super(...arguments),Ai(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Hmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let n=0;return this.view.seek(0),Array.from({length:t}).map((r,s)=>(s<e&&(n=this.view.readUint16()),{advanceWidth:n,leftSideBearing:this.view.readUint16()}))}},f.Hmtx=Oi([j("hmtx")],f.Hmtx);var $i=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,Di=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ii(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&$i(t,e,r),r};f.Kern=class extends Z{},f.Kern=Di([j("kern","kern")],f.Kern);var Pn=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,Ui=(i,t,e)=>t in i?Pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ei=(i,t,e,n)=>{for(var r=n>1?void 0:n?Li(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Pn(t,e,r),r},Fi=(i,t,e)=>(Ui(i,t+"",e),e);f.Loca=class extends Z{constructor(){super(...arguments),Fi(this,"_locations")}static from(t,e=1){const n=t.length*(e?4:2),r=new f.Loca(new ArrayBuffer(n));return t.forEach(s=>{e?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations||(this._locations=this._getLocations()),this._locations}_getLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat;return this.view.seek(0),Array.from({length:t}).map(()=>e?this.view.readUint32():this.view.readUint16()*2)}},f.Loca=Ei([j("loca")],f.Loca);var Bi=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,Y=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ni(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Bi(t,e,r),r};f.Maxp=class extends Z{constructor(t=new ArrayBuffer(32),e){super(t,e,32)}},Y([p("fixed")],f.Maxp.prototype,"version",2),Y([p("uint16")],f.Maxp.prototype,"numGlyphs",2),Y([p("uint16")],f.Maxp.prototype,"maxPoints",2),Y([p("uint16")],f.Maxp.prototype,"maxContours",2),Y([p("uint16")],f.Maxp.prototype,"maxComponentPoints",2),Y([p("uint16")],f.Maxp.prototype,"maxComponentContours",2),Y([p("uint16")],f.Maxp.prototype,"maxZones",2),Y([p("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),Y([p("uint16")],f.Maxp.prototype,"maxStorage",2),Y([p("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),Y([p("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),Y([p("uint16")],f.Maxp.prototype,"maxStackElements",2),Y([p("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),Y([p("uint16")],f.Maxp.prototype,"maxComponentElements",2),Y([p("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=Y([j("maxp")],f.Maxp);var Gi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,ge=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ri(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Gi(t,e,r),r};const Cn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},He={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Vi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Tn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends Z{getNames(){const t=this.count;this.view.seek(6);const e=[];for(let c=0;c<t;++c)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let c=0;c<t;++c){const a=e[c];a.name=this.view.readBytes(n+a.offset,a.length)}let r=He.Macintosh,s=Vi.Default,o=0;e.some(c=>c.platform===He.Microsoft&&c.encoding===Tn.UCS2&&c.language===1033)&&(r=He.Microsoft,s=Tn.UCS2,o=1033);const h={};for(let c=0;c<t;++c){const a=e[c];a.platform===r&&a.encoding===s&&a.language===o&&Cn[a.nameId]&&(h[Cn[a.nameId]]=o===0?Vr(a.name):Hr(a.name))}return h}},ge([p("uint16")],f.Name.prototype,"format",2),ge([p("uint16")],f.Name.prototype,"count",2),ge([p("uint16")],f.Name.prototype,"stringOffset",2),f.Name=ge([j("name")],f.Name);var Hi=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,P=(i,t,e,n)=>{for(var r=n>1?void 0:n?zi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Hi(t,e,r),r};f.Os2=class extends Z{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},P([p("uint16")],f.Os2.prototype,"version",2),P([p("int16")],f.Os2.prototype,"xAvgCharWidth",2),P([p("uint16")],f.Os2.prototype,"usWeightClass",2),P([p("uint16")],f.Os2.prototype,"usWidthClass",2),P([p("uint16")],f.Os2.prototype,"fsType",2),P([p("uint16")],f.Os2.prototype,"ySubscriptXSize",2),P([p("uint16")],f.Os2.prototype,"ySubscriptYSize",2),P([p("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),P([p("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),P([p("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),P([p("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),P([p("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),P([p("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),P([p("uint16")],f.Os2.prototype,"yStrikeoutSize",2),P([p("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),P([p("uint16")],f.Os2.prototype,"sFamilyClass",2),P([p({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),P([p({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),P([p({type:"uint8"})],f.Os2.prototype,"bWeight",2),P([p({type:"uint8"})],f.Os2.prototype,"bProportion",2),P([p({type:"uint8"})],f.Os2.prototype,"bContrast",2),P([p({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),P([p({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),P([p({type:"uint8"})],f.Os2.prototype,"bLetterform",2),P([p({type:"uint8"})],f.Os2.prototype,"bMidline",2),P([p({type:"uint8"})],f.Os2.prototype,"bXHeight",2),P([p({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),P([p({type:"char",size:4})],f.Os2.prototype,"achVendID",2),P([p("uint16")],f.Os2.prototype,"fsSelection",2),P([p("uint16")],f.Os2.prototype,"usFirstCharIndex",2),P([p("uint16")],f.Os2.prototype,"usLastCharIndex",2),P([p("int16")],f.Os2.prototype,"sTypoAscender",2),P([p("int16")],f.Os2.prototype,"sTypoDescender",2),P([p("int16")],f.Os2.prototype,"sTypoLineGap",2),P([p("uint16")],f.Os2.prototype,"usWinAscent",2),P([p("uint16")],f.Os2.prototype,"usWinDescent",2),P([p({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),P([p({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),P([p("int16")],f.Os2.prototype,"sCapHeight",2),P([p("uint16")],f.Os2.prototype,"usDefaultChar",2),P([p("uint16")],f.Os2.prototype,"usBreakChar",2),P([p("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=P([j("OS/2","os2")],f.Os2);var ki=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,mt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Wi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&ki(t,e,r),r};f.Post=class extends Z{constructor(t=new ArrayBuffer(32),e,n){super(t,e,n)}},mt([p("fixed")],f.Post.prototype,"format",2),mt([p("fixed")],f.Post.prototype,"italicAngle",2),mt([p("int16")],f.Post.prototype,"underlinePosition",2),mt([p("int16")],f.Post.prototype,"underlineThickness",2),mt([p("uint32")],f.Post.prototype,"isFixedPitch",2),mt([p("uint32")],f.Post.prototype,"minMemType42",2),mt([p("uint32")],f.Post.prototype,"maxMemType42",2),mt([p("uint32")],f.Post.prototype,"minMemType1",2),mt([p("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=mt([j("post")],f.Post);var Xi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,tt=(i,t,e,n)=>{for(var r=n>1?void 0:n?qi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Xi(t,e,r),r};f.Vhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},tt([p("fixed")],f.Vhea.prototype,"version",2),tt([p("int16")],f.Vhea.prototype,"vertTypoAscender",2),tt([p("int16")],f.Vhea.prototype,"vertTypoDescender",2),tt([p("int16")],f.Vhea.prototype,"vertTypoLineGap",2),tt([p("int16")],f.Vhea.prototype,"advanceHeightMax",2),tt([p("int16")],f.Vhea.prototype,"minTopSideBearing",2),tt([p("int16")],f.Vhea.prototype,"minBottomSideBearing",2),tt([p("int16")],f.Vhea.prototype,"yMaxExtent",2),tt([p("int16")],f.Vhea.prototype,"caretSlopeRise",2),tt([p("int16")],f.Vhea.prototype,"caretSlopeRun",2),tt([p("int16")],f.Vhea.prototype,"caretOffset",2),tt([p({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),tt([p("int16")],f.Vhea.prototype,"metricDataFormat",2),tt([p("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=tt([j("vhea")],f.Vhea);var On=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,Yi=(i,t,e)=>t in i?On(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ki=(i,t,e,n)=>{for(var r=n>1?void 0:n?ji(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&On(t,e,r),r},Qi=(i,t,e)=>(Yi(i,t+"",e),e);f.Vmtx=class extends Z{constructor(){super(...arguments),Qi(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Vmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){var r;const t=this._sfnt.maxp.numGlyphs,e=((r=this._sfnt.vhea)==null?void 0:r.numOfLongVerMetrics)??0;this.view.seek(0);let n=0;return Array.from({length:t}).map((s,o)=>(o<e&&(n=this.view.readUint16()),{advanceHeight:n,topSideBearing:this.view.readUint8()}))}},f.Vmtx=Ki([j("vmtx")],f.Vmtx);var An=Object.defineProperty,Zi=(i,t,e)=>t in i?An(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&An(t,e,r),r},ze=(i,t,e)=>(Zi(i,typeof t!="symbol"?t+"":t,e),e);const Lt=class Me extends fe{constructor(){super(...arguments),ze(this,"mimeType","font/ttf"),ze(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checksum(t){const e=At(t);let n=e.byteLength;for(;n%4;)n++;let r=0;for(let s=0,o=n/4;s<o;s+=4)s*4<n-4&&(r+=e.getUint32(s*4,!1));return r&4294967295}static from(t){const e=u=>u+3&-4,n=t.tableViews.size,r=t.tableViews.values().reduce((u,y)=>u+e(y.byteLength),0),s=new Me(new ArrayBuffer(12+n*16+r)),o=Math.log(2);s.scalerType=65536,s.numTables=n,s.searchRange=Math.floor(Math.log(n)/o)*16,s.entrySelector=Math.floor(s.searchRange/o),s.rangeShift=n*16-s.searchRange;let h=12+n*16,c=0;const a=s.getDirectories();t.tableViews.forEach((u,y)=>{const g=a[c++];g.tag=y,g.checkSum=Me.checksum(u),g.offset=h,g.length=u.byteLength,s.view.writeBytes(u,h),h+=e(g.length)});const l=s.createSfnt().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-Me.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Bt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}};ze(Lt,"FLAGS",new Set([65536,1953658213,1954115633,1330926671])),ee([p("uint32")],Lt.prototype,"scalerType"),ee([p("uint16")],Lt.prototype,"numTables"),ee([p("uint16")],Lt.prototype,"searchRange"),ee([p("uint16")],Lt.prototype,"entrySelector"),ee([p("uint16")],Lt.prototype,"rangeShift");let _t=Lt;var Ji=Object.defineProperty,ne=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Ji(t,e,r),r};class Ut extends dt{constructor(t,e){super(t,e,20)}}ne([p({type:"char",size:4})],Ut.prototype,"tag"),ne([p("uint32")],Ut.prototype,"offset"),ne([p("uint32")],Ut.prototype,"compLength"),ne([p("uint32")],Ut.prototype,"origLength"),ne([p("uint32")],Ut.prototype,"origChecksum");var $n=Object.defineProperty,ts=(i,t,e)=>t in i?$n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,st=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&$n(t,e,r),r},ke=(i,t,e)=>(ts(i,typeof t!="symbol"?t+"":t,e),e);const et=class en extends fe{constructor(){super(...arguments),ke(this,"mimeType","font/woff"),ke(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checkSum(t){const e=At(t),n=e.byteLength,r=Math.floor(n/4);let s=0,o=0;for(;o<r;)s+=e.getUint32(4*o++,!1);let h=n-r*4;if(h){let c=r*4;for(;h>0;)s+=e.getUint8(c)<<h*8,c++,h--}return s%4294967296}static from(t,e=new ArrayBuffer(0)){const n=u=>u+3&-4,r=[];t.tableViews.forEach((u,y)=>{const g=At(Ar(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));r.push({tag:y,view:g.byteLength<u.byteLength?g:u,rawView:u})});const s=r.length,o=r.reduce((u,y)=>u+n(y.view.byteLength),0),h=new en(new ArrayBuffer(44+20*s+o+e.byteLength));h.signature=2001684038,h.flavor=65536,h.length=h.view.byteLength,h.numTables=s,h.totalSfntSize=12+16*s+r.reduce((u,y)=>u+n(y.rawView.byteLength),0);let c=44+s*20,a=0;const l=h.getDirectories();return r.forEach(u=>{const y=l[a++];y.tag=u.tag,y.offset=c,y.compLength=u.view.byteLength,y.origChecksum=en.checkSum(u.rawView),y.origLength=u.rawView.byteLength,h.view.writeBytes(u.view,c),c+=n(y.compLength)}),h.view.writeBytes(e),h}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Ut(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>{const n=e.tag,r=this.view.byteOffset+e.offset,s=e.compLength,o=e.origLength,h=r+s;return t[n]=s>=o?new DataView(this.view.buffer,r,s):new DataView($r(new Uint8Array(this.view.buffer.slice(r,h))).buffer),t},{}))}};ke(et,"FLAGS",new Set([2001684038])),st([p("uint32")],et.prototype,"signature"),st([p("uint32")],et.prototype,"flavor"),st([p("uint32")],et.prototype,"length"),st([p("uint16")],et.prototype,"numTables"),st([p("uint16")],et.prototype,"reserved"),st([p("uint32")],et.prototype,"totalSfntSize"),st([p("uint16")],et.prototype,"majorVersion"),st([p("uint16")],et.prototype,"minorVersion"),st([p("uint32")],et.prototype,"metaOffset"),st([p("uint32")],et.prototype,"metaLength"),st([p("uint32")],et.prototype,"metaOrigLength"),st([p("uint32")],et.prototype,"privOffset"),st([p("uint32")],et.prototype,"privLength");let Mt=et;var es=Object.defineProperty,ns=(i,t,e)=>t in i?es(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,re=(i,t,e)=>(ns(i,typeof t!="symbol"?t+"":t,e),e);const In=class gr{constructor(){re(this,"fallbackFont"),re(this,"_loading",new Map),re(this,"_loaded",new Map),re(this,"_namesUrls",new Map)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...gr.defaultRequestInit,...e,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
|
|
2
2
|
font-family: "${t}";
|
|
3
3
|
src: url(${e});
|
|
4
|
-
}`)),document.head.appendChild(n),this}parse(t){if(Ct.is(t))return new Ct(t);if(Tt.is(t))return new Tt(t)}get(t){let e;if(t){const n=this._namesUrls.get(t)??t;e=this._loaded.get(n)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:s=!0,...o}=e,{family:c,url:h}=t;if(this._loaded.has(h))return n&&(this._loading.forEach(l=>l.cancel()),this._loading.clear()),this._loaded.get(h);let a=this._loading.get(h);return a||(a=this._createRequest(h,o),this._loading.set(h,a)),n&&this._loading.forEach((l,u)=>{l!==a&&(l.cancel(),this._loading.delete(u))}),a.when.then(l=>{const u={...t,font:this.parse(l)??l};return this._loaded.has(h)||(this._loaded.set(h,u),new Set(Array.isArray(c)?c:[c]).forEach(g=>{this._namesUrls.set(g,h),typeof document<"u"&&(r&&this.injectFontFace(g,l),s&&this.injectStyleTag(g,h))})),u}).catch(l=>{if(l instanceof DOMException&&l.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw l}).finally(()=>{this._loading.delete(h)})}};se(Dn,"defaultRequestInit",{cache:"force-cache"});let En=Dn;const Un=new En;function Fn(i,t){const{cmap:e,loca:n,hmtx:r,vmtx:s,glyf:o}=i,c=e.unicodeGlyphIndexMap,h=n.locations,a=r.metrics,l=s==null?void 0:s.metrics,u=Array.from(new Set(t.split("").map(m=>m.codePointAt(0)).filter(m=>m!==void 0&&c.has(m)))).sort((m,v)=>m-v),g=new Map;u.forEach(m=>{const v=c.get(m)??0;let x=g.get(v);x||g.set(v,x=new Set),x.add(m)});const d=[],y=m=>{const v=a[m],x=(l==null?void 0:l[m])??{advanceHeight:0,topSideBearing:0},_=h[m],b=h[m+1]??_,M={...v,...x,rawGlyphIndex:m,glyphIndex:d.length,unicodes:Array.from(g.get(m)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,b-_)};return d.push(M),M};return y(0),u.forEach(m=>y(c.get(m))),d.slice().forEach(m=>{const{view:v}=m;if(!v.byteLength||v.getInt16(0)>=0)return;let _=10,b;do{b=v.getUint16(_);const M=_+2,T=v.getUint16(M);_+=4,Vt.ARG_1_AND_2_ARE_WORDS&b?_+=4:_+=2,Vt.WE_HAVE_A_SCALE&b?_+=2:Vt.WE_HAVE_AN_X_AND_Y_SCALE&b?_+=4:Vt.WE_HAVE_A_TWO_BY_TWO&b&&(_+=8);const O=y(T);v.setUint16(M,O.glyphIndex)}while(Vt.MORE_COMPONENTS&b)}),d}function Bn(i,t){const e=Fn(i,t),n=e.length,{head:r,maxp:s,hhea:o,vhea:c}=i;r.checkSumAdjustment=0,r.magickNumber=1594834165,r.indexToLocFormat=1,s.numGlyphs=n;let h=0;i.loca=f.Loca.from([...e.map(g=>{const d=h;return h+=g.view.byteLength,d}),h],r.indexToLocFormat);const a=e.reduce((g,d,y)=>(d.unicodes.forEach(m=>g.set(m,y)),g),new Map);i.cmap=f.Cmap.from(a),i.glyf=f.Glyf.from(e.map(g=>g.view)),o.numOfLongHorMetrics=n,i.hmtx=f.Hmtx.from(e.map(g=>({advanceWidth:g.advanceWidth,leftSideBearing:g.leftSideBearing}))),c&&(c.numOfLongVerMetrics=n),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(g=>({advanceHeight:g.advanceHeight,topSideBearing:g.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=n,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function fs(i,t){let e,n;if(i instanceof Ct)e=i.sfnt.clone(),n="ttf";else if(i instanceof Tt)e=i.sfnt.clone(),n="woff";else{const s=It(i);if(Ct.is(s))e=new Ct(s).sfnt,n="ttf-buffer";else if(Tt.is(s))e=new Tt(s).sfnt,n="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const r=Bn(e,t);switch(n){case"ttf":return Ct.from(r);case"woff":return Tt.from(r);case"ttf-buffer":return Ct.from(r).view.buffer;case"woff-buffer":default:return Tt.from(r).view.buffer}}class w{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new w(1/0,1/0)}static get MIN(){return new w(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new w(this.x,this.y)}}class F{constructor(t=0,e=0,n=0,r=0){this.left=t,this.top=e,this.width=n,this.height=r}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){const e=t[0],n=t.slice(1).reduce((r,s)=>(r.left=Math.min(r.left,s.left),r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r),{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 F(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new w((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new F(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var ps=Object.defineProperty,gs=(i,t,e)=>t in i?ps(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ds=(i,t,e)=>(gs(i,t+"",e),e);class lt{constructor(t=1,e=0,n=0,r=0,s=1,o=0,c=0,h=0,a=1){ds(this,"elements",[]),this.set(t,e,n,r,s,o,c,h,a)}set(t,e,n,r,s,o,c,h,a){const l=this.elements;return l[0]=t,l[1]=r,l[2]=c,l[3]=e,l[4]=s,l[5]=h,l[6]=n,l[7]=o,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,o=n[0],c=n[3],h=n[6],a=n[1],l=n[4],u=n[7],g=n[2],d=n[5],y=n[8],m=r[0],v=r[3],x=r[6],_=r[1],b=r[4],M=r[7],T=r[2],O=r[5],$=r[8];return s[0]=o*m+c*_+h*T,s[3]=o*v+c*b+h*O,s[6]=o*x+c*M+h*$,s[1]=a*m+l*_+u*T,s[4]=a*v+l*b+u*O,s[7]=a*x+l*M+u*$,s[2]=g*m+d*_+y*T,s[5]=g*v+d*b+y*O,s[8]=g*x+d*M+y*$,this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],c=t[5],h=t[6],a=t[7],l=t[8],u=l*o-c*a,g=c*h-l*s,d=a*s-o*h,y=e*u+n*g+r*d;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/y;return t[0]=u*m,t[1]=(r*a-l*n)*m,t[2]=(c*n-r*o)*m,t[3]=g*m,t[4]=(l*e-r*h)*m,t[5]=(r*s-c*e)*m,t[6]=d*m,t[7]=(n*h-a*e)*m,t[8]=(o*e-n*s)*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(qe.makeScale(t,e)),this}rotate(t){return this.premultiply(qe.makeRotation(-t)),this}translate(t,e){return this.premultiply(qe.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),n=Math.sin(t);return this.set(e,-n,0,n,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 n=0;n<9;n++)this.elements[n]=t[n+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const qe=new lt;function Nn(i,t,e,n){const r=i*e+t*n,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+n*n);let o=Math.acos(Math.max(-1,Math.min(1,r/s)));return i*n-t*e<0&&(o=-o),o}function ys(i,t,e,n,r,s,o,c){if(t===0||e===0){i.lineTo(c.x,c.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(o.x-c.x)/2,a=(o.y-c.y)/2,l=Math.cos(n)*h+Math.sin(n)*a,u=-Math.sin(n)*h+Math.cos(n)*a;let g=t*t,d=e*e;const y=l*l,m=u*u,v=y/g+m/d;if(v>1){const L=Math.sqrt(v);t=L*t,e=L*e,g=t*t,d=e*e}const x=g*m+d*y,_=(g*d-x)/x;let b=Math.sqrt(Math.max(0,_));r===s&&(b=-b);const M=b*t*u/e,T=-b*e*l/t,O=Math.cos(n)*M-Math.sin(n)*T+(o.x+c.x)/2,$=Math.sin(n)*M+Math.cos(n)*T+(o.y+c.y)/2,C=Nn(1,0,(l-M)/t,(u-T)/e),P=Nn((l-M)/t,(u-T)/e,(-l-M)/t,(-u-T)/e)%(Math.PI*2);i.currentPath.absellipse(O,$,t,e,C,C+P,s===0,n)}function zt(i,t){return i-(t-i)}function ms(i,t){const e=new w,n=new w,r=new w;let s=!0,o=!1;for(let c=0,h=i.length;c<h;c++){const a=i[c];if(s&&(o=!0,s=!1),a.type==="m"||a.type==="M")a.type==="m"?(e.x+=a.x,e.y+=a.y):(e.x=a.x,e.y=a.y),n.x=e.x,n.y=e.y,t.moveTo(e.x,e.y),r.copy(e);else if(a.type==="h"||a.type==="H")a.type==="h"?e.x+=a.x:e.x=a.x,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="v"||a.type==="V")a.type==="v"?e.y+=a.y:e.y=a.y,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="l"||a.type==="L")a.type==="l"?(e.x+=a.x,e.y+=a.y):(e.x=a.x,e.y=a.y),n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="c"||a.type==="C")a.type==="c"?(t.bezierCurveTo(e.x+a.x1,e.y+a.y1,e.x+a.x2,e.y+a.y2,e.x+a.x,e.y+a.y),n.x=e.x+a.x2,n.y=e.y+a.y2,e.x+=a.x,e.y+=a.y):(t.bezierCurveTo(a.x1,a.y1,a.x2,a.y2,a.x,a.y),n.x=a.x2,n.y=a.y2,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="s"||a.type==="S")a.type==="s"?(t.bezierCurveTo(zt(e.x,n.x),zt(e.y,n.y),e.x+a.x2,e.y+a.y2,e.x+a.x,e.y+a.y),n.x=e.x+a.x2,n.y=e.y+a.y2,e.x+=a.x,e.y+=a.y):(t.bezierCurveTo(zt(e.x,n.x),zt(e.y,n.y),a.x2,a.y2,a.x,a.y),n.x=a.x2,n.y=a.y2,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="q"||a.type==="Q")a.type==="q"?(t.quadraticCurveTo(e.x+a.x1,e.y+a.y1,e.x+a.x,e.y+a.y),n.x=e.x+a.x1,n.y=e.y+a.y1,e.x+=a.x,e.y+=a.y):(t.quadraticCurveTo(a.x1,a.y1,a.x,a.y),n.x=a.x1,n.y=a.y1,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="t"||a.type==="T"){const l=zt(e.x,n.x),u=zt(e.y,n.y);n.x=l,n.y=u,a.type==="t"?(t.quadraticCurveTo(l,u,e.x+a.x,e.y+a.y),e.x+=a.x,e.y+=a.y):(t.quadraticCurveTo(l,u,a.x,a.y),e.x=a.x,e.y=a.y),o&&r.copy(e)}else if(a.type==="a"||a.type==="A"){if(a.type==="a"){if(a.x===0&&a.y===0)continue;e.x+=a.x,e.y+=a.y}else{if(a.x===e.x&&a.y===e.y)continue;e.x=a.x,e.y=a.y}const l=e.clone();n.x=e.x,n.y=e.y,ys(t,a.rx,a.ry,a.angle,a.largeArcFlag,a.sweepFlag,l,e),o&&r.copy(e)}else a.type==="z"||a.type==="Z"?(t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(e.copy(r),t.currentPath.currentPoint.copy(e),s=!0)):console.warn("Unsupported commands",a);o=!1}}const R={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function _t(i,t,e=0){let c=0,h=!0,a="",l="";const u=[];function g(v,x,_){const b=new SyntaxError(`Unexpected character "${v}" at index ${x}.`);throw b.partial=_,b}function d(){a!==""&&(l===""?u.push(Number(a)):u.push(Number(a)*10**Number(l))),a="",l=""}let y;const m=i.length;for(let v=0;v<m;v++){if(y=i[v],Array.isArray(t)&&t.includes(u.length%e)&&R.FLAGS.test(y)){c=1,a=y,d();continue}if(c===0){if(R.WHITESPACE.test(y))continue;if(R.DIGIT.test(y)||R.SIGN.test(y)){c=1,a=y;continue}if(R.POINT.test(y)){c=2,a=y;continue}R.COMMA.test(y)&&(h&&g(y,v,u),h=!0)}if(c===1){if(R.DIGIT.test(y)){a+=y;continue}if(R.POINT.test(y)){a+=y,c=2;continue}if(R.EXP.test(y)){c=3;continue}R.SIGN.test(y)&&a.length===1&&R.SIGN.test(a[0])&&g(y,v,u)}if(c===2){if(R.DIGIT.test(y)){a+=y;continue}if(R.EXP.test(y)){c=3;continue}R.POINT.test(y)&&a[a.length-1]==="."&&g(y,v,u)}if(c===3){if(R.DIGIT.test(y)){l+=y;continue}if(R.SIGN.test(y)){if(l===""){l+=y;continue}l.length===1&&R.SIGN.test(l)&&g(y,v,u)}}R.WHITESPACE.test(y)?(d(),c=0,h=!1):R.COMMA.test(y)?(d(),c=0,h=!0):R.SIGN.test(y)?(d(),c=1,a=y):R.POINT.test(y)?(d(),c=2,a=y):g(y,v,u)}return d(),u}function vs(i){switch(i.type){case"m":case"M":return`${i.type} ${i.x} ${i.y}`;case"h":case"H":return`${i.type} ${i.x}`;case"v":case"V":return`${i.type} ${i.y}`;case"l":case"L":return`${i.type} ${i.x} ${i.y}`;case"c":case"C":return`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"s":case"S":return`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"q":case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":case"T":return`${i.type} ${i.x} ${i.y}`;case"a":case"A":return`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`;case"z":case"Z":return i.type;default:return""}}function ws(i){let t="";for(let e=0,n=i.length;e<n;e++)t+=`${vs(i[e])} `;return t}const bs=/[a-df-z][^a-df-z]*/gi;function xs(i){const t=[],e=i.match(bs);if(!e)return t;for(let n=0,r=e.length;n<r;n++){const s=e[n],o=s.charAt(0),c=s.slice(1).trim();let h;switch(o){case"m":case"M":h=_t(c);for(let a=0,l=h.length;a<l;a+=2)a===0?t.push({type:o,x:h[a],y:h[a+1]}):t.push({type:o==="m"?"l":"L",x:h[a],y:h[a+1]});break;case"h":case"H":h=_t(c);for(let a=0,l=h.length;a<l;a++)t.push({type:o,x:h[a]});break;case"v":case"V":h=_t(c);for(let a=0,l=h.length;a<l;a++)t.push({type:o,y:h[a]});break;case"l":case"L":h=_t(c);for(let a=0,l=h.length;a<l;a+=2)t.push({type:o,x:h[a],y:h[a+1]});break;case"c":case"C":h=_t(c);for(let a=0,l=h.length;a<l;a+=6)t.push({type:o,x1:h[a],y1:h[a+1],x2:h[a+2],y2:h[a+3],x:h[a+4],y:h[a+5]});break;case"s":case"S":h=_t(c);for(let a=0,l=h.length;a<l;a+=4)t.push({type:o,x2:h[a],y2:h[a+1],x:h[a+2],y:h[a+3]});break;case"q":case"Q":h=_t(c);for(let a=0,l=h.length;a<l;a+=4)t.push({type:o,x1:h[a],y1:h[a+1],x:h[a+2],y:h[a+3]});break;case"t":case"T":h=_t(c);for(let a=0,l=h.length;a<l;a+=2)t.push({type:o,x:h[a],y:h[a+1]});break;case"a":case"A":h=_t(c,[3,4],7);for(let a=0,l=h.length;a<l;a+=7)t.push({type:o,rx:h[a],ry:h[a+1],angle:h[a+2],largeArcFlag:h[a+3],sweepFlag:h[a+4],x:h[a+5],y:h[a+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(s)}}return t}var _s=Object.defineProperty,Ms=(i,t,e)=>t in i?_s(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,je=(i,t,e)=>(Ms(i,typeof t!="symbol"?t+"":t,e),e);class mt{constructor(){je(this,"arcLengthDivisions",200),je(this,"_cacheArcLengths"),je(this,"_needsUpdate",!1)}getPointAt(t,e=new w){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/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 n,r=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),s+=n.distanceTo(r),e.push(s),r=n;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const s=n.length;let o;e?o=e:o=t*n[s-1];let c=0,h=s-1,a;for(;c<=h;)if(r=Math.floor(c+(h-c)/2),a=n[r]-o,a<0)c=r+1;else if(a>0)h=r-1;else{h=r;break}if(r=h,n[r]===o)return r/(s-1);const l=n[r],g=n[r+1]-l,d=(o-l)/g;return(r+d)/(s-1)}getTangent(t,e=new w){let r=t-1e-4,s=t+1e-4;return r<0&&(r=0),s>1&&(s=1),e.copy(this.getPoint(s)).sub(this.getPoint(r)).normalize()}getTangentAt(t,e=new w){return this.getTangent(this.getUtoTmapping(t),e)}transform(t){return this}getDivisions(t){return t}getMinMax(t=w.MAX,e=w.MIN){return this.getPoints().forEach(n=>{t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x),e.y=Math.max(e.y,n.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new F(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return[]}getData(){return ws(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}class ve extends mt{constructor(t,e,n=0,r=Math.PI*2){super(),this.center=t,this.radius=e,this.start=n,this.end=r}getPoint(t){const{radius:e,center:n}=this;return n.clone().add(this.getNormal(t).clone().multiplyScalar(e))}getTangent(t){const{x:e,y:n}=this.getNormal(t);return new w(-n,e)}getNormal(t){const{start:e,end:n}=this,r=t*(n-e)+e-.5*Math.PI;return new w(Math.cos(r),Math.sin(r))}getMinMax(t=w.MAX,e=w.MIN){return t.x=Math.min(t.x,this.center.x-this.radius),t.y=Math.min(t.y,this.center.y-this.radius),e.x=Math.max(e.x,this.center.x+this.radius),e.y=Math.max(e.y,this.center.y+this.radius),{min:t,max:e}}}function Gn(i,t,e,n,r){const s=(n-t)*.5,o=(r-e)*.5,c=i*i,h=i*c;return(2*e-2*n+s+o)*h+(-3*e+3*n-2*s-o)*c+s*i+e}function Ps(i,t){const e=1-i;return e*e*t}function Ss(i,t){return 2*(1-i)*i*t}function Cs(i,t){return i*i*t}function Rn(i,t,e,n){return Ps(i,t)+Ss(i,e)+Cs(i,n)}function Ts(i,t){const e=1-i;return e*e*e*t}function As(i,t){const e=1-i;return 3*e*e*i*t}function Os(i,t){return 3*(1-i)*i*i*t}function $s(i,t){return i*i*i*t}function Vn(i,t,e,n,r){return Ts(i,t)+As(i,e)+Os(i,n)+$s(i,r)}class zn extends mt{constructor(t=new w,e=new w,n=new w,r=new w){super(),this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new w){const{v0:n,v1:r,v2:s,v3:o}=this;return e.set(Vn(t,n.x,r.x,s.x,o.x),Vn(t,n.y,r.y,s.y,o.y)),e}transform(t){return this.v0.applyMatrix3(t),this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this.v3.applyMatrix3(t),this}getMinMax(t=w.MAX,e=w.MIN){const{v0:n,v1:r,v2:s,v3:o}=this;return t.x=Math.min(t.x,n.x,r.x,s.x,o.x),t.y=Math.min(t.y,n.y,r.y,s.y,o.y),e.x=Math.max(e.x,n.x,r.x,s.x,o.x),e.y=Math.max(e.y,n.y,r.y,s.y,o.y),{min:t,max:e}}getCommands(){const{v0:t,v1:e,v2:n,v3:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(t){const{v1:e,v2:n,v3:r}=this;return t.bezierCurveTo(e.x,e.y,n.x,n.y,r.x,r.y),this}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}}const Is=new lt,Hn=new lt,Wn=new lt,we=new w;class Xn extends mt{constructor(t=0,e=0,n=1,r=1,s=0,o=Math.PI*2,c=!1,h=0){super(),this.x=t,this.y=e,this.radiusX=n,this.radiusY=r,this.startAngle=s,this.endAngle=o,this.clockwise=c,this.rotation=h}getPoint(t,e=new w){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.clockwise&&!s&&(r===n?r=-n:r=r-n);const o=this.startAngle+t*r;let c=this.x+this.radiusX*Math.cos(o),h=this.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const a=Math.cos(this.rotation),l=Math.sin(this.rotation),u=c-this.x,g=h-this.y;c=u*a-g*l+this.x,h=u*l+g*a+this.y}return e.set(c,h)}getDivisions(t=12){return t*2}getCommands(){const{x:t,y:e,radiusX:n,radiusY:r,startAngle:s,endAngle:o,clockwise:c,rotation:h}=this,a=t+n*Math.cos(s)*Math.cos(h)-r*Math.sin(s)*Math.sin(h),l=e+n*Math.cos(s)*Math.sin(h)+r*Math.sin(s)*Math.cos(h),u=Math.abs(s-o),g=u>Math.PI?1:0,d=c?1:0,y=h*180/Math.PI;if(u>=2*Math.PI){const m=s+Math.PI,v=t+n*Math.cos(m)*Math.cos(h)-r*Math.sin(m)*Math.sin(h),x=e+n*Math.cos(m)*Math.sin(h)+r*Math.sin(m)*Math.cos(h);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:y,largeArcFlag:0,sweepFlag:d,x:v,y:x},{type:"A",rx:n,ry:r,angle:y,largeArcFlag:0,sweepFlag:d,x:a,y:l}]}else{const m=t+n*Math.cos(o)*Math.cos(h)-r*Math.sin(o)*Math.sin(h),v=e+n*Math.cos(o)*Math.sin(h)+r*Math.sin(o)*Math.cos(h);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:y,largeArcFlag:g,sweepFlag:d,x:m,y:v}]}}drawTo(t){const{x:e,y:n,radiusX:r,radiusY:s,rotation:o,startAngle:c,endAngle:h,clockwise:a}=this;return t.ellipse(e,n,r,s,o,c,h,!a),this}transform(t){return we.set(this.x,this.y),we.applyMatrix3(t),this.x=we.x,this.y=we.y,Es(t)?Ls(this,t):Ds(this,t),this}getMinMax(t=w.MAX,e=w.MIN){const{x:n,y:r,radiusX:s,radiusY:o,rotation:c}=this,h=Math.cos(c),a=Math.sin(c),l=Math.sqrt(s*s*h*h+o*o*a*a),u=Math.sqrt(s*s*a*a+o*o*h*h);return t.x=Math.min(t.x,n-l),t.y=Math.min(t.y,r-u),e.x=Math.max(e.x,n+l),e.y=Math.max(e.y,r+u),{min:t,max:e}}copy(t){return super.copy(t),this.x=t.x,this.y=t.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 Ls(i,t){const e=i.radiusX,n=i.radiusY,r=Math.cos(i.rotation),s=Math.sin(i.rotation),o=new w(e*r,e*s),c=new w(-n*s,n*r),h=o.applyMatrix3(t),a=c.applyMatrix3(t),l=Is.set(h.x,a.x,0,h.y,a.y,0,0,0,1),u=Hn.copy(l).invert(),y=Wn.copy(u).transpose().multiply(u).elements,m=Us(y[0],y[1],y[4]),v=Math.sqrt(m.rt1),x=Math.sqrt(m.rt2);if(i.radiusX=1/v,i.radiusY=1/x,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const b=Hn.set(v,0,0,0,x,0,0,0,1),M=Wn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),T=b.multiply(M).multiply(l),O=$=>{const{x:C,y:P}=new w(Math.cos($),Math.sin($)).applyMatrix3(T);return Math.atan2(P,C)};i.startAngle=O(i.startAngle),i.endAngle=O(i.endAngle),kn(t)&&(i.clockwise=!i.clockwise)}}function Ds(i,t){const e=qn(t),n=jn(t);i.radiusX*=e,i.radiusY*=n;const r=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=r,kn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function kn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Es(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=qn(i),r=jn(i);return Math.abs(e/(n*r))>Number.EPSILON}function qn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function jn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Us(i,t,e){let n,r,s,o,c;const h=i+e,a=i-e,l=Math.sqrt(a*a+4*t*t);return h>0?(n=.5*(h+l),c=1/n,r=i*c*e-t*c*t):h<0?r=.5*(h-l):(n=.5*l,r=-.5*l),a>0?s=a+l:s=a-l,Math.abs(s)>2*Math.abs(t)?(c=-2*t/s,o=1/Math.sqrt(1+c*c),s=c*o):Math.abs(t)===0?(s=1,o=0):(c=-.5*s/t,s=1/Math.sqrt(1+c*c),o=c*s),a>0&&(c=s,s=-o,o=c),{rt1:n,rt2:r,cs:s,sn:o}}class Bt extends mt{constructor(t=new w,e=new w){super(),this.v1=t,this.v2=e}getPoint(t,e=new w){return t===1?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(t).add(this.v1)),e}getPointAt(t,e=new w){return this.getPoint(t,e)}getTangent(t,e=new w){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e=new w){return this.getTangent(t,e)}transform(t){return this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this}getDivisions(){return 1}getMinMax(t=w.MAX,e=w.MIN){const{v1:n,v2:r}=this;return t.x=Math.min(t.x,n.x,r.x),t.y=Math.min(t.y,n.y,r.y),e.x=Math.max(e.x,n.x,r.x),e.y=Math.max(e.y,n.y,r.y),{min:t,max:e}}getCommands(){const{v1:t,v2:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{v2:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}}var Fs=Object.defineProperty,Bs=(i,t,e)=>t in i?Fs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Yn=(i,t,e)=>(Bs(i,typeof t!="symbol"?t+"":t,e),e);class Ns extends mt{constructor(t,e,n=0,r=1){super(),this.center=t,this.size=e,this.start=n,this.end=r,Yn(this,"curves"),Yn(this,"pointT",0);const{x:s,y:o}=this.center,c=new w(s+.5*this.size,o-.5*this.size),h=new w(s-.5*this.size,o-.5*this.size),a=new w(s,o+.5*this.size),l=new ve(c,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),u=new ve(h,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),g=new ve(a,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),d=new w(s,o+this.size),y=new w(s+this.size,o),m=new w().lerpVectors(y,d,.75),v=new w(s-this.size,o),x=new w().lerpVectors(v,d,.75),_=new Bt(y,m),b=new Bt(x,v);this.curves=[l,_,g,b,u]}getPoint(t){return this.getCurrentLine(t).getPoint(this.pointT)}getPointAt(t){return this.getPoint(t)}getCurrentLine(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=9*Math.PI/8+1.5;let n;const r=.5*Math.PI;return e<r?(n=0,this.pointT=e/r):e<r+.75?(n=1,this.pointT=(e-r)/.75):e<5*Math.PI/8+.75?(n=2,this.pointT=(e-r-.75)/(Math.PI/8)):e<5*Math.PI/8+1.5?(n=3,this.pointT=(e-5*Math.PI/8-.75)/.75):(n=4,this.pointT=(e-5*Math.PI/8-1.5)/r),this.curves[n]}getTangent(t){return this.getCurrentLine(t).getTangent(this.pointT).normalize()}getNormal(t){const e=this.getCurrentLine(t);return new w(e.v2.y-e.v1.y,-(e.v2.x-e.v1.x)).normalize()}transform(t){return this.curves.forEach(e=>e.transform(t)),this}getMinMax(t=w.MAX,e=w.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}var Gs=Object.defineProperty,Rs=(i,t,e)=>t in i?Gs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Kn=(i,t,e)=>(Rs(i,typeof t!="symbol"?t+"":t,e),e);class Vs extends mt{constructor(t,e=0,n=0,r=0,s=1){super(),this.center=t,this.radius=e,this.num=n,this.start=r,this.end=s,Kn(this,"curves",[]),Kn(this,"points",[]);for(let o=0;o<this.num;o++){let c=o*2*Math.PI/this.num;c-=.5*Math.PI;const h=new w(this.radius*Math.cos(c),this.radius*Math.sin(c));h.add(this.center),this.points.push(h)}for(let o=0;o<this.num;o++)this.curves.push(new Bt(this.points[o],this.points[(o+1)%this.num]))}getPoint(t){return this.getCurrentLine(t),this.currentLine.getPoint(this.pointK)}getPointAt(t){return this.getPoint(t)}getCurrentLine(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1);const n=e*this.num,r=Math.floor(n);return this.pointK=n-r,this.currentLine=this.curves[r],this.currentLine}getTangent(t){return this.getCurrentLine(t).getTangent(0).normalize()}getNormal(t){const e=this.getCurrentLine(t);return new w(e.v2.y-e.v1.y,-(e.v2.x-e.v1.x)).normalize()}transform(t){return this.curves.forEach(e=>e.transform(t)),this}getMinMax(t=w.MAX,e=w.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Qn extends mt{constructor(t=new w,e=new w,n=new w){super(),this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new w){const{v0:n,v1:r,v2:s}=this;return e.set(Rn(t,n.x,r.x,s.x),Rn(t,n.y,r.y,s.y)),e}transform(t){return this.v0.applyMatrix3(t),this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this}getMinMax(t=w.MAX,e=w.MIN){const{v0:n,v1:r,v2:s}=this,o=.5*(n.x+r.x),c=.5*(n.y+r.y),h=.5*(n.x+s.x),a=.5*(n.y+s.y);return t.x=Math.min(t.x,n.x,s.x,o,h),t.y=Math.min(t.y,n.y,s.y,c,a),e.x=Math.max(e.x,n.x,s.x,o,h),e.y=Math.max(e.y,n.y,s.y,c,a),{min:t,max:e}}getCommands(){const{v0:t,v1:e,v2:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:n.x,y:n.y}]}drawTo(t){const{v1:e,v2:n}=this;return t.quadraticCurveTo(e.x,e.y,n.x,n.y),this}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}}var zs=Object.defineProperty,Hs=(i,t,e)=>t in i?zs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zn=(i,t,e)=>(Hs(i,typeof t!="symbol"?t+"":t,e),e);class Jn extends mt{constructor(t,e,n=1,r=0,s=1){super(),this.center=t,this.rx=e,this.aspectRatio=n,this.start=r,this.end=s,Zn(this,"curves",[]),Zn(this,"pointT",0);const{x:o,y:c}=this.center,h=this.rx,a=this.rx/this.aspectRatio,l=[new w(o-h,c-a),new w(o+h,c-a),new w(o+h,c+a),new w(o-h,c+a)];for(let u=0;u<4;u++)this.curves.push(new Bt(l[u].clone(),l[(u+1)%4].clone()))}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}getPoint(t){return this.getCurrentLine(t).getPoint(this.pointT)}getPointAt(t){return this.getPoint(t)}getCurrentLine(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let n;return e<this.aspectRatio?(n=0,this.pointT=e/this.aspectRatio):e<this.aspectRatio+1?(n=1,this.pointT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(n=2,this.pointT=(e-this.aspectRatio-1)/this.aspectRatio):(n=3,this.pointT=(e-2*this.aspectRatio-1)/1),this.curves[n]}getTangent(t){return this.getCurrentLine(t).getTangent(0).normalize()}getNormal(t){const{v1:e,v2:n}=this.getCurrentLine(t);return new w(n.y-e.y,-(n.x-e.x)).normalize()}transform(t){return this.curves.forEach(e=>e.transform(t)),this}getMinMax(t=w.MAX,e=w.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class tr extends mt{constructor(t=[]){super(),this.points=t}getDivisions(t=12){return t*this.points.length}getPoint(t,e=new w){const{points:n}=this,r=(n.length-1)*t,s=Math.floor(r),o=r-s,c=n[s===0?s:s-1],h=n[s],a=n[s>n.length-2?n.length-1:s+1],l=n[s>n.length-3?n.length-1:s+2];return e.set(Gn(o,c.x,h.x,a.x,l.x),Gn(o,c.y,h.y,a.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this}}var Ws=Object.defineProperty,Xs=(i,t,e)=>t in i?Ws(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,be=(i,t,e)=>(Xs(i,typeof t!="symbol"?t+"":t,e),e);class oe extends mt{constructor(t){super(),be(this,"curves",[]),be(this,"currentPoint",new w),be(this,"autoClose",!1),be(this,"_cacheLengths",[]),t&&this.setFromPoints(t)}addCurve(t){return this.curves.push(t),this}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new Bt(e,t)),this}getPoint(t,e=new w){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,c=this.curves[s],h=c.getLength();return c.getPointAt(h===0?0:1-o/h,e)}s++}return e}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 n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],c=o.getPoints(o.getDivisions(t));for(let h=0;h<c.length;h++){const a=c[h];n&&n.equals(a)||(e.push(a),n=a)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}bezierCurveTo(t,e,n,r,s,o){return this.curves.push(new zn(this.currentPoint.clone(),new w(t,e),new w(n,r),new w(s,o))),this.currentPoint.set(s,o),this}lineTo(t,e){return this.curves.push(new Bt(this.currentPoint.clone(),new w(t,e))),this.currentPoint.set(t,e),this}moveTo(t,e){return this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){return this.curves.push(new Qn(this.currentPoint.clone(),new w(t,e),new w(n,r))),this.currentPoint.set(n,r),this}rect(t,e,n,r){return this.curves.push(new Jn(new w(t+n/2,e+r/2),n/2,n/r)),this.currentPoint.set(t,e),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t);return this.curves.push(new tr(e)),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,s,o=!1){const c=this.currentPoint;return this.absarc(t+c.x,e+c.y,n,r,s,o),this}absarc(t,e,n,r,s,o=!1){return this.absellipse(t,e,n,n,r,s,o),this}ellipse(t,e,n,r,s,o,c=!1,h=0){const a=this.currentPoint;return this.absellipse(t+a.x,e+a.y,n,r,s,o,c,h),this}absellipse(t,e,n,r,s,o,c=!1,h=0){const a=new Xn(t,e,n,r,s,o,c,h);if(this.curves.length>0){const l=a.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}return this.curves.push(a),this.currentPoint.copy(a.getPoint(1)),this}getCommands(){return this.curves.flatMap(t=>t.getCommands())}getMinMax(t=w.MAX,e=w.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}drawTo(t){var n;const e=(n=this.curves[0])==null?void 0:n.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}var ks=Object.defineProperty,qs=(i,t,e)=>t in i?ks(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ye=(i,t,e)=>(qs(i,typeof t!="symbol"?t+"":t,e),e);class ut{constructor(t){Ye(this,"currentPath",new oe),Ye(this,"paths",[this.currentPath]),Ye(this,"userData"),t&&(t instanceof ut?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}addPath(t){return t instanceof ut?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){return this.currentPath.closePath(),this}moveTo(t,e){const{currentPoint:n,curves:r}=this.currentPath;return(n.x!==t||n.y!==e)&&(r.length?(this.currentPath=new oe().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,n,r,s,o){return this.currentPath.bezierCurveTo(t,e,n,r,s,o),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}arc(t,e,n,r,s,o){return this.currentPath.absarc(t,e,n,r,s,!o),this}arcTo(t,e,n,r,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,r,s,o,c,h){return this.currentPath.absellipse(t,e,n,r,o,c,!h,s),this}rect(t,e,n,r){return this.currentPath.rect(t,e,n,r),this}addCommands(t){return ms(t,this),this}addData(t){return this.addCommands(xs(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(n=>t(n))),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=w.MAX,e=w.MIN){return this.forEachCurve(n=>n.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new F(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.paths.flatMap(t=>t.curves.flatMap(e=>e.getCommands()))}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgString(){const{x:t,y:e,width:n,height:r}=this.getBoundingBox(),s=1;return`<svg viewBox="${t-s} ${e-s} ${n+s*2} ${r+s*2}" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="currentColor" d="${this.getData()}"></path></svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgString())}`}drawTo(t){this.paths.forEach(e=>{e.drawTo(t)})}strokeTo(t){this.drawTo(t),t.stroke()}fillTo(t){this.drawTo(t),t.fill()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.userData=t.userData,this}toCanvas(t=!0){const e=document.createElement("canvas"),{left:n,top:r,width:s,height:o}=this.getBoundingBox();e.width=s,e.height=o;const c=e.getContext("2d");return c&&(c.translate(-n,-r),t?this.fillTo(c):this.strokeTo(c)),e}clone(){return new this.constructor().copy(this)}}const Ke="px",er=90,nr=["mm","cm","in","pt","pc","px"],Qe={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 B(i){let t="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=nr.length;n<r;n++){const s=nr[n];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&Ke!=="px"?e=Qe.in[Ke]/er:(e=Qe[t][Ke],e<0&&(e=Qe[t].in*er)),e*Number.parseFloat(i)}const js=new lt,xe=new lt,rr=new lt,ir=new lt;function Ys(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Ks(i);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function Ks(i){const t=new lt,e=js;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(B(i.getAttribute("x")),B(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const s=n[r].trim();if(s==="")continue;const o=s.indexOf("("),c=s.length;if(o>0&&o<c){const h=s.slice(0,o),a=_t(s.slice(o+1));switch(e.identity(),h){case"translate":if(a.length>=1){const l=a[0];let u=0;a.length>=2&&(u=a[1]),e.translate(l,u)}break;case"rotate":if(a.length>=1){let l=0,u=0,g=0;l=a[0]*Math.PI/180,a.length>=3&&(u=a[1],g=a[2]),xe.makeTranslation(-u,-g),rr.makeRotation(l),ir.multiplyMatrices(rr,xe),xe.makeTranslation(u,g),e.multiplyMatrices(xe,ir)}break;case"scale":a.length>=1&&e.scale(a[0],a[1]??a[0]);break;case"skewX":a.length===1&&e.set(1,Math.tan(a[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":a.length===1&&e.set(1,0,0,Math.tan(a[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":a.length===6&&e.set(a[0],a[2],a[4],a[1],a[3],a[5],0,0,1);break}}t.premultiply(e)}}return t}function Qs(i){return new ut().addPath(new oe().absarc(B(i.getAttribute("cx")||0),B(i.getAttribute("cy")||0),B(i.getAttribute("r")||0),0,Math.PI*2))}function Zs(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const n=i.sheet.cssRules[e];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim());for(let s=0;s<r.length;s++){const o=Object.fromEntries(Object.entries(n.style).filter(([,c])=>c!==""));t[r[s]]=Object.assign(t[r[s]]||{},o)}}}function Js(i){return new ut().addPath(new oe().absellipse(B(i.getAttribute("cx")||0),B(i.getAttribute("cy")||0),B(i.getAttribute("rx")||0),B(i.getAttribute("ry")||0),0,Math.PI*2))}function to(i){return new ut().moveTo(B(i.getAttribute("x1")||0),B(i.getAttribute("y1")||0)).lineTo(B(i.getAttribute("x2")||0),B(i.getAttribute("y2")||0))}function eo(i){const t=new ut,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const no=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ro(i){var n;const t=new ut;let e=0;return(n=i.getAttribute("points"))==null||n.replace(no,(r,s,o)=>{const c=B(s),h=B(o);return e===0?t.moveTo(c,h):t.lineTo(c,h),e++,r}),t.currentPath.autoClose=!0,t}const io=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function so(i){var n;const t=new ut;let e=0;return(n=i.getAttribute("points"))==null||n.replace(io,(r,s,o)=>{const c=B(s),h=B(o);return e===0?t.moveTo(c,h):t.lineTo(c,h),e++,r}),t.currentPath.autoClose=!1,t}function oo(i){const t=B(i.getAttribute("x")||0),e=B(i.getAttribute("y")||0),n=B(i.getAttribute("rx")||i.getAttribute("ry")||0),r=B(i.getAttribute("ry")||i.getAttribute("rx")||0),s=B(i.getAttribute("width")),o=B(i.getAttribute("height")),c=1-.551915024494,h=new ut;return h.moveTo(t+n,e),h.lineTo(t+s-n,e),(n!==0||r!==0)&&h.bezierCurveTo(t+s-n*c,e,t+s,e+r*c,t+s,e+r),h.lineTo(t+s,e+o-r),(n!==0||r!==0)&&h.bezierCurveTo(t+s,e+o-r*c,t+s-n*c,e+o,t+s-n,e+o),h.lineTo(t+n,e+o),(n!==0||r!==0)&&h.bezierCurveTo(t+n*c,e+o,t,e+o-r*c,t,e+o-r),h.lineTo(t,e+r),(n!==0||r!==0)&&h.bezierCurveTo(t,e+r*c,t+n*c,e,t+n,e),h}function Mt(i,t,e){t=Object.assign({},t);let n={};if(i.hasAttribute("class")){const c=i.getAttribute("class").split(/\s/).filter(Boolean).map(h=>h.trim());for(let h=0;h<c.length;h++)n=Object.assign(n,e[`.${c[h]}`])}i.hasAttribute("id")&&(n=Object.assign(n,e[`#${i.getAttribute("id")}`]));function r(c,h,a){a===void 0&&(a=function(u){return u.startsWith("url")&&console.warn("url access in attributes is not implemented."),u}),i.hasAttribute(c)&&(t[h]=a(i.getAttribute(c))),n[c]&&(t[h]=a(n[c])),i.style&&i.style[c]!==""&&(t[h]=a(i.style[c]))}function s(c){return Math.max(0,Math.min(1,B(c)))}function o(c){return Math.max(0,B(c))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-dashoffset","strokeDashoffset"),r("stroke-dasharray","strokeDasharray"),r("stroke-linecap","strokeLineCap"),r("stroke-linejoin","strokeLineJoin"),r("stroke-miterlimit","strokeMiterLimit",o),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",o),r("visibility","visibility"),t}function Ze(i,t,e=[]){var l;if(i.nodeType!==1)return e;let n=!1,r=null;const s={};switch(i.nodeName){case"svg":t=Mt(i,t,s);break;case"style":Zs(i,s);break;case"g":t=Mt(i,t,s);break;case"path":t=Mt(i,t,s),i.hasAttribute("d")&&(r=eo(i));break;case"rect":t=Mt(i,t,s),r=oo(i);break;case"polygon":t=Mt(i,t,s),r=ro(i);break;case"polyline":t=Mt(i,t,s),r=so(i);break;case"circle":t=Mt(i,t,s),r=Qs(i);break;case"ellipse":t=Mt(i,t,s),r=Js(i);break;case"line":t=Mt(i,t,s),r=to(i);break;case"defs":n=!0;break;case"use":{t=Mt(i,t,s);const g=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=(l=i.viewportElement)==null?void 0:l.getElementById(g);d?Ze(d,t,e):console.warn(`'use node' references non-existent node id: ${g}`);break}default:console.warn(i);break}const o=new lt,c=[],h=Ys(i,o,c);r&&(r.transform(o),e.push(r),r.userData={node:i,style:t});const a=i.childNodes;for(let u=0,g=a.length;u<g;u++){const d=a[u];n&&d.nodeName!=="style"&&d.nodeName!=="defs"||Ze(d,t,e)}return h&&(c.pop(),c.length>0?o.copy(c[c.length-1]):o.identity()),e}const sr="data:image/svg+xml;",or=`${sr}base64,`,ar=`${sr}charset=utf8,`;function Je(i){if(typeof i=="string"){let t;return i.startsWith(or)?(i=i.substring(or.length,i.length),t=atob(i)):i.startsWith(ar)?(i=i.substring(ar.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function hr(i){return Ze(Je(i),{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4})}function _e(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function cr(i,t){const{x:e,y:n}=i,r=Math.sin(t),s=Math.cos(t);return{x:e*s-n*r,y:e*r+n*s}}function tn(i,t,e,n){const r=i.x-t.x,s=i.y-t.y;return{x:t.x+(r+Math.tan(e)*s),y:t.y+(s+Math.tan(n)*r)}}function lr(i,t,e,n){const r=e<0?t.x-i.x+t.x:i.x,s=n<0?t.y-i.y+t.y:i.y;return{x:r*Math.abs(e),y:s*Math.abs(n)}}function ur(i,t,e=0,n=0,r=0,s=1,o=1){let c=Array.isArray(i)?i:[i];const h=-e/180*Math.PI,{x:a,y:l}=t;return(s!==1||o!==1)&&(c=c.map(u=>lr(u,t,s,o))),(n||r)&&(c=c.map(u=>tn(u,t,n,r))),c=c.map(u=>{const g=u.x-a,d=-(u.y-l);return u=cr({x:g,y:d},h),{x:a+u.x,y:l-u.y}}),c[0]}const ao=new Set(["©","®","÷"]),ho=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class fr{constructor(t,e,n){E(this,"boundingBox",new F);E(this,"path",new ut);E(this,"textWidth",0);E(this,"textHeight",0);this.content=t,this.index=e,this.parent=n}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_updateFont(){var e;const t=(e=Un.get(this.computedStyle.fontFamily))==null?void 0:e.font;return(t instanceof Tt||t instanceof Ct)&&(this.font=t.sfnt),this}_updateGlyph(t){const{content:e,computedStyle:n,boundingBox:r,isVertical:s}=this,{left:o,top:c,height:h}=r,{fontSize:a}=n,{unitsPerEm:l,ascender:u,descender:g,os2:d,post:y}=t,m=l/a,v=t.getAdvanceWidth(e,a),x=(u+Math.abs(g))/m,_=u/m,b=(u-d.yStrikeoutPosition)/m,M=d.yStrikeoutSize/m,T=(u-y.underlinePosition)/m,O=y.underlineThickness/m;return this.glyphWidth=v,this.glyphHeight=x,this.underlinePosition=T,this.underlineThickness=O,this.yStrikeoutPosition=b,this.yStrikeoutSize=M,this.baseline=_,this.centerDiviation=.5*h-_,this.glyphBox=s?new F(o,c,x,v):new F(o,c,v,x),this.centerPoint=this.glyphBox.getCenterPoint(),this}updatePath(){const t=this._updateFont().font;if(!t)return this;const{isVertical:e,content:n,textWidth:r,textHeight:s,boundingBox:o,computedStyle:c,baseline:h,glyphHeight:a,glyphWidth:l,yStrikeoutPosition:u,underlinePosition:g}=this._updateGlyph(t),{os2:d,ascender:y,descender:m}=t,v=y,x=m,_=d.sTypoAscender,{left:b,top:M,width:T,height:O}=o,{fontSize:$,fontStyle:C,textDecoration:P}=c;let L=b,N=M+h,H,V;if(e&&(L+=(a-l)/2,Math.abs(r-s)>.1&&(N-=(v-_)/(v+Math.abs(x))*a),H=void 0),e&&!ao.has(n)&&(n.codePointAt(0)<=256||ho.has(n))){V=t.getPathCommands(n,L,M+h-(a-l)/2,$)??[];const A={y:M-(a-l)/2+a/2,x:L+l/2};C==="italic"&&q(V,e?{x:A.x,y:M-(a-l)/2+h}:null),W(V,A)}else H!==void 0?(V=t.glyf.glyphs.get(H).getPathCommands(L,N,$),C==="italic"&&q(V,e?{x:L+l/2,y:M+_/(v+Math.abs(x))*a}:null)):(V=t.getPathCommands(n,L,N,$)??[],C==="italic"&&q(V,e?{x:L+a/2,y:N}:null));const k=.1*$;if(e){const A=(D,I)=>[{type:"M",x:D,y:M},{type:"L",x:D,y:M+O},{type:"L",x:D+I,y:M+O},{type:"L",x:D+I,y:M},{type:"Z"}];switch(P){case"underline":V.push(...A(b,k));break;case"line-through":V.push(...A(b+T/2,k));break}}else{const A=(D,I)=>[{type:"M",x:b,y:D},{type:"L",x:b+T,y:D},{type:"L",x:b+T,y:D+I},{type:"L",x:b,y:D+I},{type:"Z"}];switch(P){case"underline":V.push(...A(M+g,k));break;case"line-through":V.push(...A(M+u,k));break}}return this.path=new ut(V),this;function q(A,D){const I=D||{y:M+h,x:b+l/2};A.forEach(Y=>{["","1","2"].forEach(z=>{if(Y[`x${z}`]){const gt=tn({x:Y[`x${z}`],y:Y[`y${z}`]},I,-.24,0);Y[`x${z}`]=gt.x,Y[`y${z}`]=gt.y}})})}function W(A,D){A.forEach(I=>{["","1","2"].forEach(Y=>{if(I[`x${Y}`]){const z=ur({x:I[`x${Y}`],y:I[`y${Y}`]},D,90);I[`x${Y}`]=z.x,I[`y${Y}`]=z.y}})})}}update(){return this.updatePath(),this}drawTo(t,e={}){Ce({ctx:t,paths:[this.path],fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class pr{constructor(t,e={},n){E(this,"boundingBox",new F);E(this,"highlight");this.content=t,this.style=e,this.parent=n,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,..._e(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new fr(n,e++,this));return this.characters=t,this}}class Ht{constructor(t,e){E(this,"boundingBox",new F);E(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={..._e(this.parentStyle),..._e(this.style)},this}addFragment(t,e){const n=new pr(t,e,this);return this.fragments.push(n),n}}class Nt{constructor(t){this._text=t}}class gr extends Nt{deform(){}}class dr extends Nt{getBoundingBox(){const{characters:t,effects:e}=this._text,n=[];return t.forEach(r=>{const s=r.computedStyle.fontSize;e==null||e.forEach(o=>{const c=(o.offsetX??0)*s,h=(o.offsetY??0)*s,a=(o.shadowOffsetX??0)*s,l=(o.shadowOffsetY??0)*s,u=Math.max(.1,o.textStrokeWidth??0)*s,g=r.boundingBox.clone();g.left+=c+a-u,g.top+=h+l-u,g.width+=u*2,g.height+=u*2,n.push(g)})}),F.from(...n)}draw(t){const{ctx:e}=t,{effects:n,characters:r,boundingBox:s}=this._text;return n&&(n.forEach(o=>{vt(o,s,e)}),r.forEach(o=>{n.forEach(c=>{o.drawTo(e,c)})})),this}}class yr extends Nt{constructor(){super(...arguments);E(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new F;const e=w.MAX,n=w.MIN;return this.paths.forEach(r=>r.getMinMax(e,n)),new F(e.x,e.y,n.x-e.x,n.y-e.y)}highlight(){const{characters:e,computedStyle:n}=this._text,r=n.fontSize;let s;const o=[];let c;e.forEach(h=>{const a=h.parent.highlight;a!=null&&a.url&&((c==null?void 0:c.url)===a.url?s.push(h):(s=[],s.push(h),o.push(s))),c=a}),this.paths=o.filter(h=>h.length).map(h=>({url:h[0].parent.highlight.url,box:F.from(...h.map(a=>a.glyphBox)),baseline:Math.max(...h.map(a=>a.baseline))})).map(h=>this._parseGroup(h,r)).flat()}_parseSvg(e){const n=Je(e),r=hr(n),s=w.MAX,o=w.MIN;r.forEach(g=>g.getMinMax(s,o));const{x:c,y:h,width:a,height:l}=new F(s.x,s.y,o.x-s.x,o.y-s.y),u=n.getAttribute("viewBox").split(" ").map(Number);return{paths:r,box:new F(c,h,a,l),viewBox:new F(...u)}}_parseGroup(e,n){const{url:r,box:s,baseline:o}=e,{box:c,viewBox:h,paths:a}=this._parseSvg(r),l=[],u=c.height/h.height>.3?0:1;if(u===0){const g={x:s.left-n*.2,y:s.top},d=(s.width+n*.2*2)/c.width,y=s.height/c.height,m=new lt().translate(-c.x,-c.y).scale(d,y).translate(g.x,g.y);a.forEach(v=>{l.push(v.clone().transform(m))})}else if(u===1){const g=n/c.width*2,d=c.width*g,y=Math.ceil(s.width/d),m=d*y,v={x:s.left+(s.width-m)/2+n*.1,y:s.top+o+n*.1},x=new lt().translate(-c.x,-c.y).scale(g,g).translate(v.x,v.y);for(let _=0;_<y;_++){const b=x.clone().translate(_*d,0);a.forEach(M=>{l.push(M.clone().transform(b))})}}return l}draw({ctx:e}){return Ce({ctx:e,paths:this.paths,fontSize:this._text.computedStyle.fontSize,fill:!1}),this}}class mr extends Nt{_styleToDomStyle(t){const e={...t};for(const n in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(n)?e[n]=`${t[n]}px`:e[n]=t[n];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,n=document.createDocumentFragment(),r=document.createElement("section");Object.assign(r.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const s=document.createElement("ul");return Object.assign(s.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const c=document.createElement("li");Object.assign(c.style,this._styleToDomStyle(o.style)),o.fragments.forEach(h=>{const a=document.createElement("span");Object.assign(a.style,this._styleToDomStyle(h.style)),a.appendChild(document.createTextNode(h.content)),c.appendChild(a)}),s.appendChild(c)}),r.appendChild(s),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}}}_measureDom(t){const e=[],n=[],r=[];return t.querySelectorAll("li").forEach((s,o)=>{const c=s.getBoundingClientRect();e.push({paragraphIndex:o,left:c.left,top:c.top,width:c.width,height:c.height}),s.querySelectorAll("span").forEach((h,a)=>{var g;const l=s.getBoundingClientRect();n.push({paragraphIndex:o,fragmentIndex:a,left:l.left,top:l.top,width:l.width,height:l.height});const u=h.firstChild;if(u instanceof window.Text){const d=document.createRange();d.selectNodeContents(u);const y=u.data?u.data.length:0;let m=0;for(;m<=y;){d.setStart(u,Math.max(m-1,0)),d.setEnd(u,m);const v=((g=d.getClientRects)==null?void 0:g.call(d))??[d.getBoundingClientRect()];let x=v[v.length-1];v.length>1&&x.width<2&&(x=v[v.length-2]);const _=d.toString();_!==""&&x&&x.width+x.height!==0&&r.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:a,characterIndex:m-1,top:x.top,left:x.left,height:x.height,width:x.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:n,characters:r}}measureDom(t){const{paragraphs:e}=this._text,n=t.getBoundingClientRect(),r=t.querySelector("ul"),s=window.getComputedStyle(t).writingMode.includes("vertical"),o=r.style.lineHeight;r.style.lineHeight="4000px";const c=[[]];let h=c[0];const{characters:a}=this._measureDom(t);a.length>0&&(h.push(a[0]),a.reduce((d,y)=>{const m=s?"left":"top";return Math.abs(y[m]-d[m])>4e3/2&&(h=[],c.push(h)),h.push(y),y})),r.style.lineHeight=o;const l=this._measureDom(t);l.paragraphs.forEach(d=>{const y=e[d.paragraphIndex];y.boundingBox.left=d.left,y.boundingBox.top=d.top,y.boundingBox.width=d.width,y.boundingBox.height=d.height}),l.fragments.forEach(d=>{const y=e[d.paragraphIndex].fragments[d.fragmentIndex];y.boundingBox.left=d.left,y.boundingBox.top=d.top,y.boundingBox.width=d.width,y.boundingBox.height=d.height});const u=[];let g=0;return c.forEach(d=>{d.forEach(y=>{const m=l.characters[g],{paragraphIndex:v,fragmentIndex:x,characterIndex:_}=m;u.push({...m,newParagraphIndex:v,textWidth:y.width,textHeight:y.height,left:m.left-n.left,top:m.top-n.top});const b=e[v].fragments[x].characters[_];b.boundingBox.left=u[g].left,b.boundingBox.top=u[g].top,b.boundingBox.width=u[g].width,b.boundingBox.height=u[g].height,b.textWidth=u[g].textWidth,b.textHeight=u[g].textHeight,g++})}),{paragraphs:e,boundingBox:new F(0,0,n.width,n.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const n=this.measureDom(t);return e==null||e(),n}}class vr extends Nt{parse(){let{content:t,computedStyle:e}=this._text;const n=[];if(typeof t=="string"){const r=new Ht({},e);r.addFragment(t),n.push(r)}else{t=Array.isArray(t)?t:[t];for(const r of t)if(typeof r=="string"){const s=new Ht({},e);s.addFragment(r),n.push(s)}else if(Array.isArray(r)){const s=new Ht({},e);r.forEach(o=>{if(typeof o=="string")s.addFragment(o);else{const{content:c,highlight:h,...a}=o;if(c!==void 0){const l=s.addFragment(c,a);l.highlight=h}}}),n.push(s)}else if("fragments"in r){const{fragments:s,...o}=r,c=new Ht(o,e);s.forEach(h=>{const{content:a,highlight:l,...u}=h;if(a!==void 0){const g=c.addFragment(a,u);g.highlight=l}}),n.push(c)}else if("content"in r){const{content:s,highlight:o,...c}=r;if(s!==void 0){const h=new Ht(c,e),a=h.addFragment(s);a.highlight=o,n.push(h)}}}return n}}class co extends Nt{}class wr extends Nt{setupView(t){const{ctx:e,pixelRatio:n}=t,{renderBoundingBox:r}=this._text,{left:s,top:o,width:c,height:h}=r,a=e.canvas;return a.dataset.viewbox=`${s} ${o} ${c} ${h}`,a.dataset.pixelRatio=String(n),a.width=Math.max(1,Math.ceil(c*n)),a.height=Math.max(1,Math.ceil(h*n)),a.style.marginTop=`${o}px`,a.style.marginLeft=`${s}px`,a.style.width=`${c}px`,a.style.height=`${h}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(n,n),e.translate(-s,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:n,computedStyle:r,renderBoundingBox:s}=this._text,{width:o,height:c}=s;return vt(r,new F(0,0,o,c),e),n.forEach(h=>{vt(h.computedStyle,h.boundingBox,e),h.fragments.forEach(a=>{vt(a.computedStyle,a.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:n,paragraphs:r}=this._text;function s(o,c,h,a,l){e.fillStyle=o,e.fillRect(c,h,a,l)}return n!=null&&n.backgroundColor&&s(n.backgroundColor,0,0,e.canvas.width,e.canvas.height),r.forEach(o=>{var c;(c=o.style)!=null&&c.backgroundColor&&s(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(h=>{var a;(a=h.style)!=null&&a.backgroundColor&&s(h.computedStyle.backgroundColor,...h.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:n}=this._text;return n.forEach(r=>{r.drawTo(e)}),this}}const en={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class lo{constructor(t={}){E(this,"content");E(this,"style");E(this,"effects");E(this,"deformation");E(this,"measureDom");E(this,"needsUpdate",!0);E(this,"computedStyle",{...en});E(this,"paragraphs",[]);E(this,"boundingBox",new F);E(this,"renderBoundingBox",new F);E(this,"_parser",new vr(this));E(this,"_measurer",new mr(this));E(this,"_deformer",new gr(this));E(this,"_effector",new dr(this));E(this,"_highlighter",new yr(this));E(this,"_renderer2D",new wr(this));const{content:e="",style:n={},effects:r,deformation:s,measureDom:o}=t;this.content=e,this.style=n,this.effects=r,this.deformation=s,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){return this.computedStyle={...en,...this.style},this.paragraphs=this._parser.parse(),this._measurer.measure(t)}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e,this.characters.forEach(s=>s.update()),this.deformation&&this._deformer.deform(),this._highlighter.highlight();const n=w.MAX,r=w.MIN;return this.characters.forEach(s=>s.path.getMinMax(n,r)),this.renderBoundingBox=new F(n.x,n.y,r.x-n.x,r.y-n.y),this}render(t){var s,o;const{view:e,pixelRatio:n=2}=t,r=e.getContext("2d");return r?(this.needsUpdate&&this.update(),(s=this.effects)!=null&&s.length?this.renderBoundingBox=F.from(this.boundingBox,this.renderBoundingBox,this._effector.getBoundingBox(),this._highlighter.getBoundingBox()):this.renderBoundingBox=F.from(this.boundingBox,this.renderBoundingBox,this._highlighter.getBoundingBox()),this._renderer2D.setupView({pixelRatio:n,ctx:r}),this._renderer2D.uploadColors({ctx:r}),this._highlighter.draw({ctx:r}),(o=this.effects)!=null&&o.length?this._effector.draw({ctx:r}):this._renderer2D.draw({ctx:r}),this):this}}f.BoundingBox=F,f.Character=fr,f.CircleCurve=ve,f.CmapSubtableFormat0=Fe,f.CmapSubtableFormat12=Re,f.CmapSubtableFormat14=ee,f.CmapSubtableFormat2=Zt,f.CmapSubtableFormat4=Ge,f.CmapSubtableFormat6=Dt,f.CubicBezierCurve=zn,f.Curve=mt,f.CurvePath=oe,f.Deformer=gr,f.Effector=dr,f.EllipseCurve=Xn,f.Eot=ri,f.Font=ge,f.Fonts=En,f.Fragment=pr,f.Glyph=Mn,f.GlyphSet=Pn,f.HeartCurve=Ns,f.Highlighter=yr,f.LineCurve=Bt,f.Matrix3=lt,f.Measurer=mr,f.Paragraph=Ht,f.Parser=vr,f.Path2D=ut,f.PloygonCurve=Vs,f.Point2D=w,f.QuadraticBezierCurve=Qn,f.RectangularCurve=Jn,f.Reflector=co,f.Renderer2D=wr,f.Sfnt=ne,f.SplineCurve=tr,f.TableDirectory=Gt,f.Text=lo,f.Ttf=Ct,f.Woff=Tt,f.WoffTableDirectoryEntry=Ft,f.componentFlags=Vt,f.createCmapSegments=Ne,f.defaultTextStyles=en,f.defineSfntTable=et,f.drawPaths=Ce,f.filterEmpty=_e,f.fonts=Un,f.getPointPosition=ur,f.getRotationPoint=cr,f.getScalePoint=lr,f.getSkewPoint=tn,f.minify=fs,f.minifyGlyphs=Fn,f.minifySfnt=Bn,f.parseColor=K,f.parseSvg=hr,f.parseSvgToDom=Je,f.uploadColor=vt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
}`)),document.head.appendChild(n),this}parse(t){if(_t.is(t))return new _t(t);if(Mt.is(t))return new Mt(t)}get(t){let e;if(t){const n=this._namesUrls.get(t)??t;e=this._loaded.get(n)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:s=!0,...o}=e,{family:h,url:c}=t;if(this._loaded.has(c))return n&&(this._loading.forEach(l=>l.cancel()),this._loading.clear()),this._loaded.get(c);let a=this._loading.get(c);return a||(a=this._createRequest(c,o),this._loading.set(c,a)),n&&this._loading.forEach((l,u)=>{l!==a&&(l.cancel(),this._loading.delete(u))}),a.when.then(l=>{const u={...t,font:this.parse(l)??l};return this._loaded.has(c)||(this._loaded.set(c,u),new Set(Array.isArray(h)?h:[h]).forEach(y=>{this._namesUrls.set(y,c),typeof document<"u"&&(r&&this.injectFontFace(y,l),s&&this.injectStyleTag(y,c))})),u}).catch(l=>{if(l instanceof DOMException&&l.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw l}).finally(()=>{this._loading.delete(c)})}};re(In,"defaultRequestInit",{cache:"force-cache"});let Dn=In;const Ln=new Dn;function Un(i,t){const{cmap:e,loca:n,hmtx:r,vmtx:s,glyf:o}=i,h=e.unicodeGlyphIndexMap,c=n.locations,a=r.metrics,l=s==null?void 0:s.metrics,u=Array.from(new Set(t.split("").map(m=>m.codePointAt(0)).filter(m=>m!==void 0&&h.has(m)))).sort((m,v)=>m-v),y=new Map;u.forEach(m=>{const v=h.get(m)??0;let _=y.get(v);_||y.set(v,_=new Set),_.add(m)});const g=[],d=m=>{const v=a[m],_=(l==null?void 0:l[m])??{advanceHeight:0,topSideBearing:0},x=c[m],w=c[m+1]??x,C={...v,..._,rawGlyphIndex:m,glyphIndex:g.length,unicodes:Array.from(y.get(m)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+x,w-x)};return g.push(C),C};return d(0),u.forEach(m=>d(h.get(m))),g.slice().forEach(m=>{const{view:v}=m;if(!v.byteLength||v.getInt16(0)>=0)return;let x=10,w;do{w=v.getUint16(x);const C=x+2,T=v.getUint16(C);x+=4,Gt.ARG_1_AND_2_ARE_WORDS&w?x+=4:x+=2,Gt.WE_HAVE_A_SCALE&w?x+=2:Gt.WE_HAVE_AN_X_AND_Y_SCALE&w?x+=4:Gt.WE_HAVE_A_TWO_BY_TWO&w&&(x+=8);const O=d(T);v.setUint16(C,O.glyphIndex)}while(Gt.MORE_COMPONENTS&w)}),g}function En(i,t){const e=Un(i,t),n=e.length,{head:r,maxp:s,hhea:o,vhea:h}=i;r.checkSumAdjustment=0,r.magickNumber=1594834165,r.indexToLocFormat=1,s.numGlyphs=n;let c=0;i.loca=f.Loca.from([...e.map(y=>{const g=c;return c+=y.view.byteLength,g}),c],r.indexToLocFormat);const a=e.reduce((y,g,d)=>(g.unicodes.forEach(m=>y.set(m,d)),y),new Map);i.cmap=f.Cmap.from(a),i.glyf=f.Glyf.from(e.map(y=>y.view)),o.numOfLongHorMetrics=n,i.hmtx=f.Hmtx.from(e.map(y=>({advanceWidth:y.advanceWidth,leftSideBearing:y.leftSideBearing}))),h&&(h.numOfLongVerMetrics=n),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(y=>({advanceHeight:y.advanceHeight,topSideBearing:y.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=n,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function rs(i,t){let e,n;if(i instanceof _t)e=i.sfnt.clone(),n="ttf";else if(i instanceof Mt)e=i.sfnt.clone(),n="woff";else{const s=At(i);if(_t.is(s))e=new _t(s).sfnt,n="ttf-buffer";else if(Mt.is(s))e=new Mt(s).sfnt,n="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const r=En(e,t);switch(n){case"ttf":return _t.from(r);case"woff":return Mt.from(r);case"ttf-buffer":return _t.from(r).view.buffer;case"woff-buffer":default:return Mt.from(r).view.buffer}}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new b(this.x,this.y)}}class L{constructor(t=0,e=0,n=0,r=0){this.left=t,this.top=e,this.width=n,this.height=r}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){const e=t[0],n=t.slice(1).reduce((r,s)=>(r.left=Math.min(r.left,s.left),r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r),{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(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new L(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var is=Object.defineProperty,ss=(i,t,e)=>t in i?is(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,os=(i,t,e)=>(ss(i,t+"",e),e);class ct{constructor(t=1,e=0,n=0,r=0,s=1,o=0,h=0,c=0,a=1){os(this,"elements",[]),this.set(t,e,n,r,s,o,h,c,a)}set(t,e,n,r,s,o,h,c,a){const l=this.elements;return l[0]=t,l[1]=r,l[2]=h,l[3]=e,l[4]=s,l[5]=c,l[6]=n,l[7]=o,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,o=n[0],h=n[3],c=n[6],a=n[1],l=n[4],u=n[7],y=n[2],g=n[5],d=n[8],m=r[0],v=r[3],_=r[6],x=r[1],w=r[4],C=r[7],T=r[2],O=r[5],A=r[8];return s[0]=o*m+h*x+c*T,s[3]=o*v+h*w+c*O,s[6]=o*_+h*C+c*A,s[1]=a*m+l*x+u*T,s[4]=a*v+l*w+u*O,s[7]=a*_+l*C+u*A,s[2]=y*m+g*x+d*T,s[5]=y*v+g*w+d*O,s[8]=y*_+g*C+d*A,this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],h=t[5],c=t[6],a=t[7],l=t[8],u=l*o-h*a,y=h*c-l*s,g=a*s-o*c,d=e*u+n*y+r*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]=(r*a-l*n)*m,t[2]=(h*n-r*o)*m,t[3]=y*m,t[4]=(l*e-r*c)*m,t[5]=(r*s-h*e)*m,t[6]=g*m,t[7]=(n*c-a*e)*m,t[8]=(o*e-n*s)*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(We.makeScale(t,e)),this}rotate(t){return this.premultiply(We.makeRotation(-t)),this}translate(t,e){return this.premultiply(We.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),n=Math.sin(t);return this.set(e,-n,0,n,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 n=0;n<9;n++)this.elements[n]=t[n+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const We=new ct;function Fn(i,t,e,n){const r=i*e+t*n,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+n*n);let o=Math.acos(Math.max(-1,Math.min(1,r/s)));return i*n-t*e<0&&(o=-o),o}function as(i,t,e,n,r,s,o,h){if(t===0||e===0){i.lineTo(h.x,h.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const c=(o.x-h.x)/2,a=(o.y-h.y)/2,l=Math.cos(n)*c+Math.sin(n)*a,u=-Math.sin(n)*c+Math.cos(n)*a;let y=t*t,g=e*e;const d=l*l,m=u*u,v=d/y+m/g;if(v>1){const B=Math.sqrt(v);t=B*t,e=B*e,y=t*t,g=e*e}const _=y*m+g*d,x=(y*g-_)/_;let w=Math.sqrt(Math.max(0,x));r===s&&(w=-w);const C=w*t*u/e,T=-w*e*l/t,O=Math.cos(n)*C-Math.sin(n)*T+(o.x+h.x)/2,A=Math.sin(n)*C+Math.cos(n)*T+(o.y+h.y)/2,M=Fn(1,0,(l-C)/t,(u-T)/e),S=Fn((l-C)/t,(u-T)/e,(-l-C)/t,(-u-T)/e)%(Math.PI*2);i.currentPath.absellipse(O,A,t,e,M,M+S,s===0,n)}function Rt(i,t){return i-(t-i)}function hs(i,t){const e=new b,n=new b,r=new b;let s=!0,o=!1;for(let h=0,c=i.length;h<c;h++){const a=i[h];if(s&&(o=!0,s=!1),a.type==="m"||a.type==="M")a.type==="m"?(e.x+=a.x,e.y+=a.y):(e.x=a.x,e.y=a.y),n.x=e.x,n.y=e.y,t.moveTo(e.x,e.y),r.copy(e);else if(a.type==="h"||a.type==="H")a.type==="h"?e.x+=a.x:e.x=a.x,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="v"||a.type==="V")a.type==="v"?e.y+=a.y:e.y=a.y,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="l"||a.type==="L")a.type==="l"?(e.x+=a.x,e.y+=a.y):(e.x=a.x,e.y=a.y),n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="c"||a.type==="C")a.type==="c"?(t.bezierCurveTo(e.x+a.x1,e.y+a.y1,e.x+a.x2,e.y+a.y2,e.x+a.x,e.y+a.y),n.x=e.x+a.x2,n.y=e.y+a.y2,e.x+=a.x,e.y+=a.y):(t.bezierCurveTo(a.x1,a.y1,a.x2,a.y2,a.x,a.y),n.x=a.x2,n.y=a.y2,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="s"||a.type==="S")a.type==="s"?(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),e.x+a.x2,e.y+a.y2,e.x+a.x,e.y+a.y),n.x=e.x+a.x2,n.y=e.y+a.y2,e.x+=a.x,e.y+=a.y):(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),a.x2,a.y2,a.x,a.y),n.x=a.x2,n.y=a.y2,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="q"||a.type==="Q")a.type==="q"?(t.quadraticCurveTo(e.x+a.x1,e.y+a.y1,e.x+a.x,e.y+a.y),n.x=e.x+a.x1,n.y=e.y+a.y1,e.x+=a.x,e.y+=a.y):(t.quadraticCurveTo(a.x1,a.y1,a.x,a.y),n.x=a.x1,n.y=a.y1,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="t"||a.type==="T"){const l=Rt(e.x,n.x),u=Rt(e.y,n.y);n.x=l,n.y=u,a.type==="t"?(t.quadraticCurveTo(l,u,e.x+a.x,e.y+a.y),e.x+=a.x,e.y+=a.y):(t.quadraticCurveTo(l,u,a.x,a.y),e.x=a.x,e.y=a.y),o&&r.copy(e)}else if(a.type==="a"||a.type==="A"){if(a.type==="a"){if(a.x===0&&a.y===0)continue;e.x+=a.x,e.y+=a.y}else{if(a.x===e.x&&a.y===e.y)continue;e.x=a.x,e.y=a.y}const l=e.clone();n.x=e.x,n.y=e.y,as(t,a.rx,a.ry,a.angle,a.largeArcFlag,a.sweepFlag,l,e),o&&r.copy(e)}else a.type==="z"||a.type==="Z"?(t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(e.copy(r),t.currentPath.currentPoint.copy(e),s=!0)):console.warn("Unsupported commands",a);o=!1}}const F={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function vt(i,t,e=0){let h=0,c=!0,a="",l="";const u=[];function y(v,_,x){const w=new SyntaxError(`Unexpected character "${v}" at index ${_}.`);throw w.partial=x,w}function g(){a!==""&&(l===""?u.push(Number(a)):u.push(Number(a)*10**Number(l))),a="",l=""}let d;const m=i.length;for(let v=0;v<m;v++){if(d=i[v],Array.isArray(t)&&t.includes(u.length%e)&&F.FLAGS.test(d)){h=1,a=d,g();continue}if(h===0){if(F.WHITESPACE.test(d))continue;if(F.DIGIT.test(d)||F.SIGN.test(d)){h=1,a=d;continue}if(F.POINT.test(d)){h=2,a=d;continue}F.COMMA.test(d)&&(c&&y(d,v,u),c=!0)}if(h===1){if(F.DIGIT.test(d)){a+=d;continue}if(F.POINT.test(d)){a+=d,h=2;continue}if(F.EXP.test(d)){h=3;continue}F.SIGN.test(d)&&a.length===1&&F.SIGN.test(a[0])&&y(d,v,u)}if(h===2){if(F.DIGIT.test(d)){a+=d;continue}if(F.EXP.test(d)){h=3;continue}F.POINT.test(d)&&a[a.length-1]==="."&&y(d,v,u)}if(h===3){if(F.DIGIT.test(d)){l+=d;continue}if(F.SIGN.test(d)){if(l===""){l+=d;continue}l.length===1&&F.SIGN.test(l)&&y(d,v,u)}}F.WHITESPACE.test(d)?(g(),h=0,c=!1):F.COMMA.test(d)?(g(),h=0,c=!0):F.SIGN.test(d)?(g(),h=1,a=d):F.POINT.test(d)?(g(),h=2,a=d):y(d,v,u)}return g(),u}function cs(i){switch(i.type){case"m":case"M":return`${i.type} ${i.x} ${i.y}`;case"h":case"H":return`${i.type} ${i.x}`;case"v":case"V":return`${i.type} ${i.y}`;case"l":case"L":return`${i.type} ${i.x} ${i.y}`;case"c":case"C":return`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"s":case"S":return`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"q":case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":case"T":return`${i.type} ${i.x} ${i.y}`;case"a":case"A":return`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`;case"z":case"Z":return i.type;default:return""}}function ls(i){let t="";for(let e=0,n=i.length;e<n;e++)t+=`${cs(i[e])} `;return t}const us=/[a-df-z][^a-df-z]*/gi;function fs(i){const t=[],e=i.match(us);if(!e)return t;for(let n=0,r=e.length;n<r;n++){const s=e[n],o=s.charAt(0),h=s.slice(1).trim();let c;switch(o){case"m":case"M":c=vt(h);for(let a=0,l=c.length;a<l;a+=2)a===0?t.push({type:o,x:c[a],y:c[a+1]}):t.push({type:o==="m"?"l":"L",x:c[a],y:c[a+1]});break;case"h":case"H":c=vt(h);for(let a=0,l=c.length;a<l;a++)t.push({type:o,x:c[a]});break;case"v":case"V":c=vt(h);for(let a=0,l=c.length;a<l;a++)t.push({type:o,y:c[a]});break;case"l":case"L":c=vt(h);for(let a=0,l=c.length;a<l;a+=2)t.push({type:o,x:c[a],y:c[a+1]});break;case"c":case"C":c=vt(h);for(let a=0,l=c.length;a<l;a+=6)t.push({type:o,x1:c[a],y1:c[a+1],x2:c[a+2],y2:c[a+3],x:c[a+4],y:c[a+5]});break;case"s":case"S":c=vt(h);for(let a=0,l=c.length;a<l;a+=4)t.push({type:o,x2:c[a],y2:c[a+1],x:c[a+2],y:c[a+3]});break;case"q":case"Q":c=vt(h);for(let a=0,l=c.length;a<l;a+=4)t.push({type:o,x1:c[a],y1:c[a+1],x:c[a+2],y:c[a+3]});break;case"t":case"T":c=vt(h);for(let a=0,l=c.length;a<l;a+=2)t.push({type:o,x:c[a],y:c[a+1]});break;case"a":case"A":c=vt(h,[3,4],7);for(let a=0,l=c.length;a<l;a+=7)t.push({type:o,rx:c[a],ry:c[a+1],angle:c[a+2],largeArcFlag:c[a+3],sweepFlag:c[a+4],x:c[a+5],y:c[a+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(s)}}return t}var ps=Object.defineProperty,ys=(i,t,e)=>t in i?ps(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xe=(i,t,e)=>(ys(i,typeof t!="symbol"?t+"":t,e),e);class Et{constructor(){Xe(this,"arcLengthDivisions",200),Xe(this,"_cacheArcLengths"),Xe(this,"_needsUpdate",!1)}getPointAt(t,e=new b){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/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 n,r=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),s+=n.distanceTo(r),e.push(s),r=n;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const s=n.length;let o;e?o=e:o=t*n[s-1];let h=0,c=s-1,a;for(;h<=c;)if(r=Math.floor(h+(c-h)/2),a=n[r]-o,a<0)h=r+1;else if(a>0)c=r-1;else{c=r;break}if(r=c,n[r]===o)return r/(s-1);const l=n[r],y=n[r+1]-l,g=(o-l)/y;return(r+g)/(s-1)}getTangent(t,e=new b){let r=t-1e-4,s=t+1e-4;return r<0&&(r=0),s>1&&(s=1),e.copy(this.getPoint(s)).sub(this.getPoint(r)).normalize()}getTangentAt(t,e=new b){return this.getTangent(this.getUtoTmapping(t),e)}transform(t){return this}getDivisions(t){return t}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(n=>{t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x),e.y=Math.max(e.y,n.y)}),{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)}getCommands(){return[]}getData(){return ls(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Bn(i,t,e,n,r){const s=(n-t)*.5,o=(r-e)*.5,h=i*i,c=i*h;return(2*e-2*n+s+o)*c+(-3*e+3*n-2*s-o)*h+s*i+e}function gs(i,t){const e=1-i;return e*e*t}function ds(i,t){return 2*(1-i)*i*t}function ms(i,t){return i*i*t}function Nn(i,t,e,n){return gs(i,t)+ds(i,e)+ms(i,n)}function vs(i,t){const e=1-i;return e*e*e*t}function ws(i,t){const e=1-i;return 3*e*e*i*t}function bs(i,t){return 3*(1-i)*i*i*t}function xs(i,t){return i*i*i*t}function Gn(i,t,e,n,r){return vs(i,t)+ws(i,e)+bs(i,n)+xs(i,r)}class _s extends Et{constructor(t=new b,e=new b,n=new b,r=new b){super(),this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new b){const{v0:n,v1:r,v2:s,v3:o}=this;return e.set(Gn(t,n.x,r.x,s.x,o.x),Gn(t,n.y,r.y,s.y,o.y)),e}transform(t){return this.v0.applyMatrix3(t),this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this.v3.applyMatrix3(t),this}getMinMax(t=b.MAX,e=b.MIN){const{v0:n,v1:r,v2:s,v3:o}=this;return t.x=Math.min(t.x,n.x,r.x,s.x,o.x),t.y=Math.min(t.y,n.y,r.y,s.y,o.y),e.x=Math.max(e.x,n.x,r.x,s.x,o.x),e.y=Math.max(e.y,n.y,r.y,s.y,o.y),{min:t,max:e}}getCommands(){const{v0:t,v1:e,v2:n,v3:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(t){const{v1:e,v2:n,v3:r}=this;return t.bezierCurveTo(e.x,e.y,n.x,n.y,r.x,r.y),this}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}}const Ms=new ct,Rn=new ct,Vn=new ct,de=new b;class Ss extends Et{constructor(t=0,e=0,n=1,r=1,s=0,o=Math.PI*2,h=!1,c=0){super(),this.x=t,this.y=e,this.radiusX=n,this.radiusY=r,this.startAngle=s,this.endAngle=o,this.clockwise=h,this.rotation=c}getPoint(t,e=new b){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.clockwise&&!s&&(r===n?r=-n:r=r-n);const o=this.startAngle+t*r;let h=this.x+this.radiusX*Math.cos(o),c=this.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const a=Math.cos(this.rotation),l=Math.sin(this.rotation),u=h-this.x,y=c-this.y;h=u*a-y*l+this.x,c=u*l+y*a+this.y}return e.set(h,c)}getDivisions(t=12){return t*2}getCommands(){const{x:t,y:e,radiusX:n,radiusY:r,startAngle:s,endAngle:o,clockwise:h,rotation:c}=this,a=t+n*Math.cos(s)*Math.cos(c)-r*Math.sin(s)*Math.sin(c),l=e+n*Math.cos(s)*Math.sin(c)+r*Math.sin(s)*Math.cos(c),u=Math.abs(s-o),y=u>Math.PI?1:0,g=h?1:0,d=c*180/Math.PI;if(u>=2*Math.PI){const m=s+Math.PI,v=t+n*Math.cos(m)*Math.cos(c)-r*Math.sin(m)*Math.sin(c),_=e+n*Math.cos(m)*Math.sin(c)+r*Math.sin(m)*Math.cos(c);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:d,largeArcFlag:0,sweepFlag:g,x:v,y:_},{type:"A",rx:n,ry:r,angle:d,largeArcFlag:0,sweepFlag:g,x:a,y:l}]}else{const m=t+n*Math.cos(o)*Math.cos(c)-r*Math.sin(o)*Math.sin(c),v=e+n*Math.cos(o)*Math.sin(c)+r*Math.sin(o)*Math.cos(c);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:d,largeArcFlag:y,sweepFlag:g,x:m,y:v}]}}drawTo(t){const{x:e,y:n,radiusX:r,radiusY:s,rotation:o,startAngle:h,endAngle:c,clockwise:a}=this;return t.ellipse(e,n,r,s,o,h,c,!a),this}transform(t){return de.set(this.x,this.y),de.applyMatrix3(t),this.x=de.x,this.y=de.y,Ts(t)?Ps(this,t):Cs(this,t),this}getMinMax(t=b.MAX,e=b.MIN){const{x:n,y:r,radiusX:s,radiusY:o,rotation:h}=this,c=Math.cos(h),a=Math.sin(h),l=Math.sqrt(s*s*c*c+o*o*a*a),u=Math.sqrt(s*s*a*a+o*o*c*c);return t.x=Math.min(t.x,n-l),t.y=Math.min(t.y,r-u),e.x=Math.max(e.x,n+l),e.y=Math.max(e.y,r+u),{min:t,max:e}}copy(t){return super.copy(t),this.x=t.x,this.y=t.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 Ps(i,t){const e=i.radiusX,n=i.radiusY,r=Math.cos(i.rotation),s=Math.sin(i.rotation),o=new b(e*r,e*s),h=new b(-n*s,n*r),c=o.applyMatrix3(t),a=h.applyMatrix3(t),l=Ms.set(c.x,a.x,0,c.y,a.y,0,0,0,1),u=Rn.copy(l).invert(),d=Vn.copy(u).transpose().multiply(u).elements,m=Os(d[0],d[1],d[4]),v=Math.sqrt(m.rt1),_=Math.sqrt(m.rt2);if(i.radiusX=1/v,i.radiusY=1/_,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const w=Rn.set(v,0,0,0,_,0,0,0,1),C=Vn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),T=w.multiply(C).multiply(l),O=A=>{const{x:M,y:S}=new b(Math.cos(A),Math.sin(A)).applyMatrix3(T);return Math.atan2(S,M)};i.startAngle=O(i.startAngle),i.endAngle=O(i.endAngle),Hn(t)&&(i.clockwise=!i.clockwise)}}function Cs(i,t){const e=zn(t),n=kn(t);i.radiusX*=e,i.radiusY*=n;const r=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=r,Hn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Hn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Ts(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=zn(i),r=kn(i);return Math.abs(e/(n*r))>Number.EPSILON}function zn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function kn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Os(i,t,e){let n,r,s,o,h;const c=i+e,a=i-e,l=Math.sqrt(a*a+4*t*t);return c>0?(n=.5*(c+l),h=1/n,r=i*h*e-t*h*t):c<0?r=.5*(c-l):(n=.5*l,r=-.5*l),a>0?s=a+l:s=a-l,Math.abs(s)>2*Math.abs(t)?(h=-2*t/s,o=1/Math.sqrt(1+h*h),s=h*o):Math.abs(t)===0?(s=1,o=0):(h=-.5*s/t,s=1/Math.sqrt(1+h*h),o=h*s),a>0&&(h=s,s=-o,o=h),{rt1:n,rt2:r,cs:s,sn:o}}class qe extends Et{constructor(t=new b,e=new b){super(),this.v1=t,this.v2=e}getPoint(t,e=new b){return t===1?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(t).add(this.v1)),e}getPointAt(t,e=new b){return this.getPoint(t,e)}getTangent(t,e=new b){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e=new b){return this.getTangent(t,e)}transform(t){return this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this}getDivisions(){return 1}getMinMax(t=b.MAX,e=b.MIN){const{v1:n,v2:r}=this;return t.x=Math.min(t.x,n.x,r.x),t.y=Math.min(t.y,n.y,r.y),e.x=Math.max(e.x,n.x,r.x),e.y=Math.max(e.y,n.y,r.y),{min:t,max:e}}getCommands(){const{v1:t,v2:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{v2:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}}class As extends Et{constructor(t=new b,e=new b,n=new b){super(),this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new b){const{v0:n,v1:r,v2:s}=this;return e.set(Nn(t,n.x,r.x,s.x),Nn(t,n.y,r.y,s.y)),e}transform(t){return this.v0.applyMatrix3(t),this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this}getMinMax(t=b.MAX,e=b.MIN){const{v0:n,v1:r,v2:s}=this,o=.5*(n.x+r.x),h=.5*(n.y+r.y),c=.5*(n.x+s.x),a=.5*(n.y+s.y);return t.x=Math.min(t.x,n.x,s.x,o,c),t.y=Math.min(t.y,n.y,s.y,h,a),e.x=Math.max(e.x,n.x,s.x,o,c),e.y=Math.max(e.y,n.y,s.y,h,a),{min:t,max:e}}getCommands(){const{v0:t,v1:e,v2:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:n.x,y:n.y}]}drawTo(t){const{v1:e,v2:n}=this;return t.quadraticCurveTo(e.x,e.y,n.x,n.y),this}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}}var $s=Object.defineProperty,Is=(i,t,e)=>t in i?$s(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wn=(i,t,e)=>(Is(i,typeof t!="symbol"?t+"":t,e),e);class Ds extends Et{constructor(t,e,n=1,r=0,s=1){super(),this.center=t,this.rx=e,this.aspectRatio=n,this.start=r,this.end=s,Wn(this,"curves",[]),Wn(this,"pointT",0);const{x:o,y:h}=this.center,c=this.rx,a=this.rx/this.aspectRatio,l=[new b(o-c,h-a),new b(o+c,h-a),new b(o+c,h+a),new b(o-c,h+a)];for(let u=0;u<4;u++)this.curves.push(new qe(l[u].clone(),l[(u+1)%4].clone()))}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}getPoint(t){return this.getCurrentLine(t).getPoint(this.pointT)}getPointAt(t){return this.getPoint(t)}getCurrentLine(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let n;return e<this.aspectRatio?(n=0,this.pointT=e/this.aspectRatio):e<this.aspectRatio+1?(n=1,this.pointT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(n=2,this.pointT=(e-this.aspectRatio-1)/this.aspectRatio):(n=3,this.pointT=(e-2*this.aspectRatio-1)/1),this.curves[n]}getTangent(t){return this.getCurrentLine(t).getTangent(0).normalize()}getNormal(t){const{v1:e,v2:n}=this.getCurrentLine(t);return new b(n.y-e.y,-(n.x-e.x)).normalize()}transform(t){return this.curves.forEach(e=>e.transform(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Ls extends Et{constructor(t=[]){super(),this.points=t}getDivisions(t=12){return t*this.points.length}getPoint(t,e=new b){const{points:n}=this,r=(n.length-1)*t,s=Math.floor(r),o=r-s,h=n[s===0?s:s-1],c=n[s],a=n[s>n.length-2?n.length-1:s+1],l=n[s>n.length-3?n.length-1:s+2];return e.set(Bn(o,h.x,c.x,a.x,l.x),Bn(o,h.y,c.y,a.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this}}var Us=Object.defineProperty,Es=(i,t,e)=>t in i?Us(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,me=(i,t,e)=>(Es(i,typeof t!="symbol"?t+"":t,e),e);class ve extends Et{constructor(t){super(),me(this,"curves",[]),me(this,"currentPoint",new b),me(this,"autoClose",!1),me(this,"_cacheLengths",[]),t&&this.setFromPoints(t)}addCurve(t){return this.curves.push(t),this}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new qe(e,t)),this}getPoint(t,e=new b){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,h=this.curves[s],c=h.getLength();return h.getPointAt(c===0?0:1-o/c,e)}s++}return e}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 n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],h=o.getPoints(o.getDivisions(t));for(let c=0;c<h.length;c++){const a=h[c];n&&n.equals(a)||(e.push(a),n=a)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}bezierCurveTo(t,e,n,r,s,o){return this.curves.push(new _s(this.currentPoint.clone(),new b(t,e),new b(n,r),new b(s,o))),this.currentPoint.set(s,o),this}lineTo(t,e){return this.curves.push(new qe(this.currentPoint.clone(),new b(t,e))),this.currentPoint.set(t,e),this}moveTo(t,e){return this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){return this.curves.push(new As(this.currentPoint.clone(),new b(t,e),new b(n,r))),this.currentPoint.set(n,r),this}rect(t,e,n,r){return this.curves.push(new Ds(new b(t+n/2,e+r/2),n/2,n/r)),this.currentPoint.set(t,e),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t);return this.curves.push(new Ls(e)),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,s,o=!1){const h=this.currentPoint;return this.absarc(t+h.x,e+h.y,n,r,s,o),this}absarc(t,e,n,r,s,o=!1){return this.absellipse(t,e,n,n,r,s,o),this}ellipse(t,e,n,r,s,o,h=!1,c=0){const a=this.currentPoint;return this.absellipse(t+a.x,e+a.y,n,r,s,o,h,c),this}absellipse(t,e,n,r,s,o,h=!1,c=0){const a=new Ss(t,e,n,r,s,o,h,c);if(this.curves.length>0){const l=a.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}return this.curves.push(a),this.currentPoint.copy(a.getPoint(1)),this}getCommands(){return this.curves.flatMap(t=>t.getCommands())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}drawTo(t){var n;const e=(n=this.curves[0])==null?void 0:n.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}var Fs=Object.defineProperty,Bs=(i,t,e)=>t in i?Fs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,je=(i,t,e)=>(Bs(i,typeof t!="symbol"?t+"":t,e),e);class lt{constructor(t){je(this,"currentPath",new ve),je(this,"paths",[this.currentPath]),je(this,"userData"),t&&(t instanceof lt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}addPath(t){return t instanceof lt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){return this.currentPath.closePath(),this}moveTo(t,e){const{currentPoint:n,curves:r}=this.currentPath;return(n.x!==t||n.y!==e)&&(r.length?(this.currentPath=new ve().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,n,r,s,o){return this.currentPath.bezierCurveTo(t,e,n,r,s,o),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}arc(t,e,n,r,s,o){return this.currentPath.absarc(t,e,n,r,s,!o),this}arcTo(t,e,n,r,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,r,s,o,h,c){return this.currentPath.absellipse(t,e,n,r,o,h,!c,s),this}rect(t,e,n,r){return this.currentPath.rect(t,e,n,r),this}addCommands(t){return hs(t,this),this}addData(t){return this.addCommands(fs(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(n=>t(n))),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.forEachCurve(n=>n.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)}getCommands(){return this.paths.flatMap(t=>t.curves.flatMap(e=>e.getCommands()))}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgString(){const{x:t,y:e,width:n,height:r}=this.getBoundingBox(),s=1;return`<svg viewBox="${t-s} ${e-s} ${n+s*2} ${r+s*2}" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="currentColor" d="${this.getData()}"></path></svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgString())}`}drawTo(t){this.paths.forEach(e=>{e.drawTo(t)})}strokeTo(t){this.drawTo(t),t.stroke()}fillTo(t){this.drawTo(t),t.fill()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.userData=t.userData,this}toCanvas(t=!0){const e=document.createElement("canvas"),{left:n,top:r,width:s,height:o}=this.getBoundingBox();e.width=s,e.height=o;const h=e.getContext("2d");return h&&(h.translate(-n,-r),t?this.fillTo(h):this.strokeTo(h)),e}clone(){return new this.constructor().copy(this)}}const Ye="px",Xn=90,qn=["mm","cm","in","pt","pc","px"],Ke={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 D(i){let t="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=qn.length;n<r;n++){const s=qn[n];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&Ye!=="px"?e=Ke.in[Ye]/Xn:(e=Ke[t][Ye],e<0&&(e=Ke[t].in*Xn)),e*Number.parseFloat(i)}const Ns=new ct,we=new ct,jn=new ct,Yn=new ct;function Gs(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Rs(i);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function Rs(i){const t=new ct,e=Ns;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(D(i.getAttribute("x")),D(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const s=n[r].trim();if(s==="")continue;const o=s.indexOf("("),h=s.length;if(o>0&&o<h){const c=s.slice(0,o),a=vt(s.slice(o+1));switch(e.identity(),c){case"translate":if(a.length>=1){const l=a[0];let u=0;a.length>=2&&(u=a[1]),e.translate(l,u)}break;case"rotate":if(a.length>=1){let l=0,u=0,y=0;l=a[0]*Math.PI/180,a.length>=3&&(u=a[1],y=a[2]),we.makeTranslation(-u,-y),jn.makeRotation(l),Yn.multiplyMatrices(jn,we),we.makeTranslation(u,y),e.multiplyMatrices(we,Yn)}break;case"scale":a.length>=1&&e.scale(a[0],a[1]??a[0]);break;case"skewX":a.length===1&&e.set(1,Math.tan(a[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":a.length===1&&e.set(1,0,0,Math.tan(a[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":a.length===6&&e.set(a[0],a[2],a[4],a[1],a[3],a[5],0,0,1);break}}t.premultiply(e)}}return t}function Vs(i){return new lt().addPath(new ve().absarc(D(i.getAttribute("cx")||0),D(i.getAttribute("cy")||0),D(i.getAttribute("r")||0),0,Math.PI*2))}function Hs(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const n=i.sheet.cssRules[e];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim());for(let s=0;s<r.length;s++){const o=Object.fromEntries(Object.entries(n.style).filter(([,h])=>h!==""));t[r[s]]=Object.assign(t[r[s]]||{},o)}}}function zs(i){return new lt().addPath(new ve().absellipse(D(i.getAttribute("cx")||0),D(i.getAttribute("cy")||0),D(i.getAttribute("rx")||0),D(i.getAttribute("ry")||0),0,Math.PI*2))}function ks(i){return new lt().moveTo(D(i.getAttribute("x1")||0),D(i.getAttribute("y1")||0)).lineTo(D(i.getAttribute("x2")||0),D(i.getAttribute("y2")||0))}function Ws(i){const t=new lt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Xs=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function qs(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Xs,(r,s,o)=>{const h=D(s),c=D(o);return e===0?t.moveTo(h,c):t.lineTo(h,c),e++,r}),t.currentPath.autoClose=!0,t}const js=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ys(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(js,(r,s,o)=>{const h=D(s),c=D(o);return e===0?t.moveTo(h,c):t.lineTo(h,c),e++,r}),t.currentPath.autoClose=!1,t}function Ks(i){const t=D(i.getAttribute("x")||0),e=D(i.getAttribute("y")||0),n=D(i.getAttribute("rx")||i.getAttribute("ry")||0),r=D(i.getAttribute("ry")||i.getAttribute("rx")||0),s=D(i.getAttribute("width")),o=D(i.getAttribute("height")),h=1-.551915024494,c=new lt;return c.moveTo(t+n,e),c.lineTo(t+s-n,e),(n!==0||r!==0)&&c.bezierCurveTo(t+s-n*h,e,t+s,e+r*h,t+s,e+r),c.lineTo(t+s,e+o-r),(n!==0||r!==0)&&c.bezierCurveTo(t+s,e+o-r*h,t+s-n*h,e+o,t+s-n,e+o),c.lineTo(t+n,e+o),(n!==0||r!==0)&&c.bezierCurveTo(t+n*h,e+o,t,e+o-r*h,t,e+o-r),c.lineTo(t,e+r),(n!==0||r!==0)&&c.bezierCurveTo(t,e+r*h,t+n*h,e,t+n,e),c}function wt(i,t,e){t=Object.assign({},t);let n={};if(i.hasAttribute("class")){const h=i.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)n=Object.assign(n,e[`.${h[c]}`])}i.hasAttribute("id")&&(n=Object.assign(n,e[`#${i.getAttribute("id")}`]));function r(h,c,a){a===void 0&&(a=function(u){return u.startsWith("url")&&console.warn("url access in attributes is not implemented."),u}),i.hasAttribute(h)&&(t[c]=a(i.getAttribute(h))),n[h]&&(t[c]=a(n[h])),i.style&&i.style[h]!==""&&(t[c]=a(i.style[h]))}function s(h){return Math.max(0,Math.min(1,D(h)))}function o(h){return Math.max(0,D(h))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-dashoffset","strokeDashoffset"),r("stroke-dasharray","strokeDasharray"),r("stroke-linecap","strokeLineCap"),r("stroke-linejoin","strokeLineJoin"),r("stroke-miterlimit","strokeMiterLimit",o),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",o),r("visibility","visibility"),t}function Qe(i,t,e=[]){var l;if(i.nodeType!==1)return e;let n=!1,r=null;const s={};switch(i.nodeName){case"svg":t=wt(i,t,s);break;case"style":Hs(i,s);break;case"g":t=wt(i,t,s);break;case"path":t=wt(i,t,s),i.hasAttribute("d")&&(r=Ws(i));break;case"rect":t=wt(i,t,s),r=Ks(i);break;case"polygon":t=wt(i,t,s),r=qs(i);break;case"polyline":t=wt(i,t,s),r=Ys(i);break;case"circle":t=wt(i,t,s),r=Vs(i);break;case"ellipse":t=wt(i,t,s),r=zs(i);break;case"line":t=wt(i,t,s),r=ks(i);break;case"defs":n=!0;break;case"use":{t=wt(i,t,s);const y=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(l=i.viewportElement)==null?void 0:l.getElementById(y);g?Qe(g,t,e):console.warn(`'use node' references non-existent node id: ${y}`);break}default:console.warn(i);break}const o=new ct,h=[],c=Gs(i,o,h);r&&(r.transform(o),e.push(r),r.userData={node:i,style:t});const a=i.childNodes;for(let u=0,y=a.length;u<y;u++){const g=a[u];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Qe(g,t,e)}return c&&(h.pop(),h.length>0?o.copy(h[h.length-1]):o.identity()),e}const Kn="data:image/svg+xml;",Qn=`${Kn}base64,`,Zn=`${Kn}charset=utf8,`;function Jn(i){if(typeof i=="string"){let t;return i.startsWith(Qn)?(i=i.substring(Qn.length,i.length),t=atob(i)):i.startsWith(Zn)?(i=i.substring(Zn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Qs(i){return Qe(Jn(i),{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4})}function be(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function tr(i,t){const{x:e,y:n}=i,r=Math.sin(t),s=Math.cos(t);return{x:e*s-n*r,y:e*r+n*s}}function Ze(i,t,e,n){const r=i.x-t.x,s=i.y-t.y;return{x:t.x+(r+Math.tan(e)*s),y:t.y+(s+Math.tan(n)*r)}}function er(i,t,e,n){const r=e<0?t.x-i.x+t.x:i.x,s=n<0?t.y-i.y+t.y:i.y;return{x:r*Math.abs(e),y:s*Math.abs(n)}}function nr(i,t,e=0,n=0,r=0,s=1,o=1){let h=Array.isArray(i)?i:[i];const c=-e/180*Math.PI,{x:a,y:l}=t;return(s!==1||o!==1)&&(h=h.map(u=>er(u,t,s,o))),(n||r)&&(h=h.map(u=>Ze(u,t,n,r))),h=h.map(u=>{const y=u.x-a,g=-(u.y-l);return u=tr({x:y,y:g},c),{x:a+u.x,y:l-u.y}}),h[0]}const Zs=new Set(["©","®","÷"]),Js=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class rr{constructor(t,e,n){$(this,"boundingBox",new L);$(this,"path",new lt);$(this,"textWidth",0);$(this,"textHeight",0);this.content=t,this.index=e,this.parent=n}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=Ln.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Mt||t instanceof _t)return t.sfnt}_updateGlyph(t){const{content:e,computedStyle:n,boundingBox:r,isVertical:s}=this,{left:o,top:h,height:c}=r,{fontSize:a}=n,{unitsPerEm:l,ascender:u,descender:y,os2:g,post:d}=t,m=l/a,v=t.getAdvanceWidth(e,a),_=(u+Math.abs(y))/m,x=u/m,w=(u-g.yStrikeoutPosition)/m,C=g.yStrikeoutSize/m,T=(u-d.underlinePosition)/m,O=d.underlineThickness/m;return this.glyphWidth=v,this.glyphHeight=_,this.underlinePosition=T,this.underlineThickness=O,this.yStrikeoutPosition=w,this.yStrikeoutSize=C,this.baseline=x,this.centerDiviation=.5*c-x,this.glyphBox=s?new L(o,h,_,v):new L(o,h,v,_),this.centerPoint=this.glyphBox.getCenterPoint(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:n}=this,{textDecoration:r,fontSize:s}=this.computedStyle,{left:o,top:h,width:c,height:a}=this.boundingBox,l=.1*s;let u;switch(r){case"underline":t?u=o:u=h+e;break;case"line-through":t?u=o+c/2:u=h+n;break;case"none":default:return[]}return t?[{type:"M",x:u,y:h},{type:"L",x:u,y:h+a},{type:"L",x:u+l,y:h+a},{type:"L",x:u+l,y:h},{type:"Z"}]:[{type:"M",x:o,y:u},{type:"L",x:o+c,y:u},{type:"L",x:o+c,y:u+l},{type:"L",x:o,y:u+l},{type:"Z"}]}_transform(t,e){return t.map(n=>{const r={...n};switch(r.type){case"L":case"M":[r.x,r.y]=e(r.x,r.y);break;case"Q":[r.x1,r.y1]=e(r.x1,r.y1),[r.x,r.y]=e(r.x,r.y);break}return r})}_italic(t,e){const{baseline:n,glyphWidth:r}=this,{left:s,top:o}=this.boundingBox,h=e||{y:o+n,x:s+r/2};return this._transform(t,(c,a)=>{const l=Ze({x:c,y:a},h,-.24,0);return[l.x,l.y]})}_rotation90(t,e){return this._transform(t,(n,r)=>{const s=nr({x:n,y:r},e,90);return[s.x,s.y]})}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:n,textWidth:r,textHeight:s,boundingBox:o,computedStyle:h,baseline:c,glyphHeight:a,glyphWidth:l}=this._updateGlyph(t),{os2:u,ascender:y,descender:g}=t,d=y,m=g,v=u.sTypoAscender,{left:_,top:x}=o,{fontSize:w,fontStyle:C}=h;let T=_,O=x+c,A,M;if(e&&(T+=(a-l)/2,Math.abs(r-s)>.1&&(O-=(d-v)/(d+Math.abs(m))*a),A=void 0),e&&!Zs.has(n)&&(n.codePointAt(0)<=256||Js.has(n))){M=t.getPathCommands(n,T,x+c-(a-l)/2,w)??[];const S={y:x-(a-l)/2+a/2,x:T+l/2};C==="italic"&&(M=this._italic(M,e?{x:S.x,y:x-(a-l)/2+c}:void 0)),M=this._rotation90(M,S)}else A!==void 0?(M=t.glyf.glyphs.get(A).getPathCommands(T,O,w),C==="italic"&&(M=this._italic(M,e?{x:T+l/2,y:x+v/(d+Math.abs(m))*a}:void 0))):(M=t.getPathCommands(n,T,O,w)??[],C==="italic"&&(M=this._italic(M,e?{x:T+a/2,y:O}:void 0)));return M.push(...this._decoration()),this.commands=M,this.path=new lt(M),this}update(){return this.updatePath(),this}getMinMax(t=b.MAX,e=b.MIN){let n={x:0,y:0};return this.commands.forEach(r=>{switch(r.type){case"L":case"M":t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y),n={x:r.x,y:r.y};break;case"Q":{const s=.5*(n.x+r.x1),o=.5*(n.y+r.y1),h=.5*(n.x+r.x),c=.5*(n.y+r.y);t.x=Math.min(t.x,n.x,r.x,s,h),t.y=Math.min(t.y,n.y,r.y,o,c),e.x=Math.max(e.x,n.x,r.x,s,h),e.y=Math.max(e.y,n.y,r.y,o,c),n={x:r.x,y:r.y};break}}}),{min:t,max:e}}drawTo(t,e={}){Se({ctx:t,paths:[this.path],fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class ir{constructor(t,e={},n){$(this,"boundingBox",new L);$(this,"highlight");this.content=t,this.style=e,this.parent=n,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,...be(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new rr(n,e++,this));return this.characters=t,this}}class Vt{constructor(t,e){$(this,"boundingBox",new L);$(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...be(this.parentStyle),...be(this.style)},this}addFragment(t,e){const n=new ir(t,e,this);return this.fragments.push(n),n}}class Ft{constructor(t){this._text=t}}class sr extends Ft{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class or extends Ft{getBoundingBox(){const{characters:t,effects:e}=this._text,n=[];return t.forEach(r=>{const s=r.computedStyle.fontSize;e==null||e.forEach(o=>{const h=(o.offsetX??0)*s,c=(o.offsetY??0)*s,a=(o.shadowOffsetX??0)*s,l=(o.shadowOffsetY??0)*s,u=Math.max(.1,o.textStrokeWidth??0)*s,y=r.boundingBox.clone();y.left+=h+a-u,y.top+=c+l-u,y.width+=u*2,y.height+=u*2,n.push(y)})}),L.from(...n)}draw(t){const{ctx:e}=t,{effects:n,characters:r,boundingBox:s}=this._text;return n&&(n.forEach(o=>{yt(o,s,e)}),r.forEach(o=>{n.forEach(h=>{o.drawTo(e,h)})})),this}}class ar extends Ft{constructor(){super(...arguments);$(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new L;const e=b.MAX,n=b.MIN;return this.paths.forEach(r=>r.getMinMax(e,n)),new L(e.x,e.y,n.x-e.x,n.y-e.y)}highlight(){const{characters:e,computedStyle:n}=this._text,r=n.fontSize;let s;const o=[];let h;e.forEach(c=>{const a=c.parent.highlight;a!=null&&a.url&&((h==null?void 0:h.url)===a.url?s.push(c):(s=[],s.push(c),o.push(s))),h=a}),this.paths=o.filter(c=>c.length).map(c=>({url:c[0].parent.highlight.url,box:L.from(...c.map(a=>a.glyphBox)),baseline:Math.max(...c.map(a=>a.baseline))})).map(c=>this._parseGroup(c,r)).flat()}_parseSvg(e){const n=Jn(e),r=Qs(n),s=b.MAX,o=b.MIN;r.forEach(y=>y.getMinMax(s,o));const{x:h,y:c,width:a,height:l}=new L(s.x,s.y,o.x-s.x,o.y-s.y),u=n.getAttribute("viewBox").split(" ").map(Number);return{paths:r,box:new L(h,c,a,l),viewBox:new L(...u)}}_parseGroup(e,n){const{url:r,box:s,baseline:o}=e,{box:h,viewBox:c,paths:a}=this._parseSvg(r),l=[],u=h.height/c.height>.3?0:1;if(u===0){const y={x:s.left-n*.2,y:s.top},g=(s.width+n*.2*2)/h.width,d=s.height/h.height,m=new ct().translate(-h.x,-h.y).scale(g,d).translate(y.x,y.y);a.forEach(v=>{l.push(v.clone().transform(m))})}else if(u===1){const y=n/h.width*2,g=h.width*y,d=Math.ceil(s.width/g),m=g*d,v={x:s.left+(s.width-m)/2+n*.1,y:s.top+o+n*.1},_=new ct().translate(-h.x,-h.y).scale(y,y).translate(v.x,v.y);for(let x=0;x<d;x++){const w=_.clone().translate(x*g,0);a.forEach(C=>{l.push(C.clone().transform(w))})}}return l}draw({ctx:e}){return Se({ctx:e,paths:this.paths,fontSize:this._text.computedStyle.fontSize,fill:!1}),this}}class hr extends Ft{_styleToDomStyle(t){const e={...t};for(const n in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(n)?e[n]=`${t[n]}px`:e[n]=t[n];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,n=document.createDocumentFragment(),r=document.createElement("section");Object.assign(r.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const s=document.createElement("ul");return Object.assign(s.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const h=document.createElement("li");Object.assign(h.style,this._styleToDomStyle(o.style)),o.fragments.forEach(c=>{const a=document.createElement("span");Object.assign(a.style,this._styleToDomStyle(c.style)),a.appendChild(document.createTextNode(c.content)),h.appendChild(a)}),s.appendChild(h)}),r.appendChild(s),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}}}_measureDom(t){const e=[],n=[],r=[];return t.querySelectorAll("li").forEach((s,o)=>{const h=s.getBoundingClientRect();e.push({paragraphIndex:o,left:h.left,top:h.top,width:h.width,height:h.height}),s.querySelectorAll("span").forEach((c,a)=>{var y;const l=s.getBoundingClientRect();n.push({paragraphIndex:o,fragmentIndex:a,left:l.left,top:l.top,width:l.width,height:l.height});const u=c.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 v=((y=g.getClientRects)==null?void 0:y.call(g))??[g.getBoundingClientRect()];let _=v[v.length-1];v.length>1&&_.width<2&&(_=v[v.length-2]);const x=g.toString();x!==""&&_&&_.width+_.height!==0&&r.push({content:x,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:a,characterIndex:m-1,top:_.top,left:_.left,height:_.height,width:_.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:n,characters:r}}measureDom(t){const{paragraphs:e}=this._text,n=t.getBoundingClientRect(),r=t.querySelector("ul"),s=window.getComputedStyle(t).writingMode.includes("vertical"),o=r.style.lineHeight;r.style.lineHeight="4000px";const h=[[]];let c=h[0];const{characters:a}=this._measureDom(t);a.length>0&&(c.push(a[0]),a.reduce((g,d)=>{const m=s?"left":"top";return Math.abs(d[m]-g[m])>4e3/2&&(c=[],h.push(c)),c.push(d),d})),r.style.lineHeight=o;const l=this._measureDom(t);l.paragraphs.forEach(g=>{const d=e[g.paragraphIndex];d.boundingBox.left=g.left,d.boundingBox.top=g.top,d.boundingBox.width=g.width,d.boundingBox.height=g.height}),l.fragments.forEach(g=>{const d=e[g.paragraphIndex].fragments[g.fragmentIndex];d.boundingBox.left=g.left,d.boundingBox.top=g.top,d.boundingBox.width=g.width,d.boundingBox.height=g.height});const u=[];let y=0;return h.forEach(g=>{g.forEach(d=>{const m=l.characters[y],{paragraphIndex:v,fragmentIndex:_,characterIndex:x}=m;u.push({...m,newParagraphIndex:v,textWidth:d.width,textHeight:d.height,left:m.left-n.left,top:m.top-n.top});const w=e[v].fragments[_].characters[x];w.boundingBox.left=u[y].left,w.boundingBox.top=u[y].top,w.boundingBox.width=u[y].width,w.boundingBox.height=u[y].height,w.textWidth=u[y].textWidth,w.textHeight=u[y].textHeight,y++})}),{paragraphs:e,boundingBox:new L(0,0,n.width,n.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const n=this.measureDom(t);return e==null||e(),n}}class cr extends Ft{parse(){let{content:t,computedStyle:e}=this._text;const n=[];if(typeof t=="string"){const r=new Vt({},e);r.addFragment(t),n.push(r)}else{t=Array.isArray(t)?t:[t];for(const r of t)if(typeof r=="string"){const s=new Vt({},e);s.addFragment(r),n.push(s)}else if(Array.isArray(r)){const s=new Vt({},e);r.forEach(o=>{if(typeof o=="string")s.addFragment(o);else{const{content:h,highlight:c,...a}=o;if(h!==void 0){const l=s.addFragment(h,a);l.highlight=c}}}),n.push(s)}else if("fragments"in r){const{fragments:s,...o}=r,h=new Vt(o,e);s.forEach(c=>{const{content:a,highlight:l,...u}=c;if(a!==void 0){const y=h.addFragment(a,u);y.highlight=l}}),n.push(h)}else if("content"in r){const{content:s,highlight:o,...h}=r;if(s!==void 0){const c=new Vt(h,e),a=c.addFragment(s);a.highlight=o,n.push(c)}}}return n}}class to extends Ft{}class lr extends Ft{setupView(t){const{ctx:e,pixelRatio:n}=t,{renderBoundingBox:r}=this._text,{left:s,top:o,width:h,height:c}=r,a=e.canvas;return a.dataset.viewbox=`${s} ${o} ${h} ${c}`,a.dataset.pixelRatio=String(n),a.width=Math.max(1,Math.ceil(h*n)),a.height=Math.max(1,Math.ceil(c*n)),a.style.marginTop=`${o}px`,a.style.marginLeft=`${s}px`,a.style.width=`${h}px`,a.style.height=`${c}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(n,n),e.translate(-s,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:n,computedStyle:r,renderBoundingBox:s}=this._text,{width:o,height:h}=s;return yt(r,new L(0,0,o,h),e),n.forEach(c=>{yt(c.computedStyle,c.boundingBox,e),c.fragments.forEach(a=>{yt(a.computedStyle,a.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:n,paragraphs:r}=this._text;function s(o,h,c,a,l){e.fillStyle=o,e.fillRect(h,c,a,l)}return n!=null&&n.backgroundColor&&s(n.backgroundColor,0,0,e.canvas.width,e.canvas.height),r.forEach(o=>{var h;(h=o.style)!=null&&h.backgroundColor&&s(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(c=>{var a;(a=c.style)!=null&&a.backgroundColor&&s(c.computedStyle.backgroundColor,...c.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:n}=this._text;return n.forEach(r=>{r.drawTo(e)}),this}}const Je={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class eo{constructor(t={}){$(this,"content");$(this,"style");$(this,"effects");$(this,"deformation");$(this,"measureDom");$(this,"needsUpdate",!0);$(this,"computedStyle",{...Je});$(this,"paragraphs",[]);$(this,"boundingBox",new L);$(this,"renderBoundingBox",new L);$(this,"_parser",new cr(this));$(this,"_measurer",new hr(this));$(this,"_deformer",new sr(this));$(this,"_effector",new or(this));$(this,"_highlighter",new ar(this));$(this,"_renderer2D",new lr(this));const{content:e="",style:n={},effects:r,deformation:s,measureDom:o}=t;this.content=e,this.style=n,this.effects=r,this.deformation=s,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...Je,...this.style};const e=this.paragraphs;this.paragraphs=this._parser.parse();const n=this._measurer.measure(t);return this.paragraphs=e,n}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e,this.characters.forEach(s=>s.update()),this.deformation&&this._deformer.deform(),this._highlighter.highlight();const n=b.MAX,r=b.MIN;return this.characters.forEach(s=>s.getMinMax(n,r)),this.renderBoundingBox=new L(n.x,n.y,r.x-n.x,r.y-n.y),this}render(t){var s,o;const{view:e,pixelRatio:n=2}=t,r=e.getContext("2d");return r?(this.needsUpdate&&this.update(),(s=this.effects)!=null&&s.length?this.renderBoundingBox=L.from(this.boundingBox,this.renderBoundingBox,this._effector.getBoundingBox(),this._highlighter.getBoundingBox()):this.renderBoundingBox=L.from(this.boundingBox,this.renderBoundingBox,this._highlighter.getBoundingBox()),this._renderer2D.setupView({pixelRatio:n,ctx:r}),this._renderer2D.uploadColors({ctx:r}),this._highlighter.draw({ctx:r}),(o=this.effects)!=null&&o.length?this._effector.draw({ctx:r}):this._renderer2D.draw({ctx:r}),this):this}}f.Character=rr,f.CmapSubtableFormat0=Ue,f.CmapSubtableFormat12=Ne,f.CmapSubtableFormat14=Jt,f.CmapSubtableFormat2=Kt,f.CmapSubtableFormat4=Be,f.CmapSubtableFormat6=It,f.Deformer=sr,f.Effector=or,f.Eot=jr,f.Font=fe,f.Fonts=Dn,f.Fragment=ir,f.Glyph=xn,f.GlyphSet=_n,f.Highlighter=ar,f.Measurer=hr,f.Paragraph=Vt,f.Parser=cr,f.Reflector=to,f.Renderer2D=lr,f.Sfnt=te,f.TableDirectory=Bt,f.Text=eo,f.Ttf=_t,f.Woff=Mt,f.WoffTableDirectoryEntry=Ut,f.componentFlags=Gt,f.createCmapSegments=Fe,f.defaultTextStyles=Je,f.defineSfntTable=j,f.drawPaths=Se,f.filterEmpty=be,f.fonts=Ln,f.getPointPosition=nr,f.getRotationPoint=tr,f.getScalePoint=er,f.getSkewPoint=Ze,f.minify=rs,f.minifyGlyphs=Un,f.minifySfnt=En,f.parseColor=z,f.uploadColor=yt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|