modern-text 1.8.2 → 1.8.3
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 +1 -1
- package/dist/index.js +5 -5
- package/dist/index.mjs +2 -2
- package/dist/shared/{modern-text.C2aRxwl9.cjs → modern-text.XBrC1nBJ.cjs} +3 -3
- package/dist/shared/{modern-text.BpOqkWRj.mjs → modern-text.y0a7DPYV.mjs} +3 -3
- package/dist/web-components/index.cjs +1 -1
- package/dist/web-components/index.mjs +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(H,te){typeof exports=="object"&&typeof module<"u"?te(exports):typeof define=="function"&&define.amd?define(["exports"],te):(H=typeof globalThis<"u"?globalThis:H||self,te(H.modernText={}))})(this,(function(H){"use strict";function te(n,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:i,x1:o,y1:s,stops:a}=Ji(t,e.left,e.top,e.width,e.height),l=n.createLinearGradient(r,i,o,s);return a.forEach(c=>l.addColorStop(c.offset,c.color)),l}return t}function _e(n,t,e){n?.color&&(n.color=te(e,n.color,t)),n?.backgroundColor&&(n.backgroundColor=te(e,n.backgroundColor,t)),n?.textStrokeColor&&(n.textStrokeColor=te(e,n.textStrokeColor,t))}function Ji(n,t,e,r,i){const o=n.match(/linear-gradient\((.+)\)$/)?.[1]??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),u=(Number(a.replace("deg",""))||0)*Math.PI/180,h=r*Math.sin(u),f=i*Math.cos(u);return{x0:t+r/2-h,y0:e+i/2+f,x1:t+r/2+h,y1:e+i/2-f,stops:Array.from(l).map(g=>{let p=g[2];return p.startsWith("(")?p=p.split(",").length>3?`rgba${p}`:`rgb${p}`:p=`#${p}`,{offset:Number(g[3].replace("%",""))/100,color:p}})}}function he(n){const{ctx:t,path:e,fontSize:r,clipRect:i}=n;t.save(),t.beginPath();const o=e.style,s={...o,fill:n.color??o.fill,stroke:n.textStrokeColor??o.stroke,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*r:o.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round",shadowOffsetX:(n.shadowOffsetX??0)*r,shadowOffsetY:(n.shadowOffsetY??0)*r,shadowBlur:(n.shadowBlur??0)*r,shadowColor:n.shadowColor};i&&(t.rect(i.left,i.top,i.width,i.height),t.clip(),t.beginPath()),e.drawTo(t,s),t.restore()}function gr(n,t,e){const{left:r,top:i,width:o,height:s}=e,a=n.canvas;a.dataset.viewBox=`${r} ${i} ${o} ${s}`,a.dataset.pixelRatio=String(t);const l=o,c=s;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(c*t)),a.style.width=`${l}px`,a.style.height=`${c}px`,n.clearRect(0,0,a.width,a.height),n.scale(t,t),n.translate(-r,-i)}function yr(n,t){const{paragraphs:e,computedStyle:r,glyphBox:i}=t;_e(r,i,n),e.forEach(o=>{_e(o.computedStyle,o.lineBox,n),o.fragments.forEach(s=>{_e(s.computedStyle,s.inlineBox,n)})})}var ut=Uint8Array,At=Uint16Array,Pn=Int32Array,Xe=new ut([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]),Ze=new ut([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]),_n=new ut([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mr=function(n,t){for(var e=new At(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var i=new Pn(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)i[o]=o-e[r]<<5|r;return{b:e,r:i}},xr=mr(Xe,2),vr=xr.b,Tn=xr.r;vr[28]=258,Tn[258]=28;for(var wr=mr(Ze,0),ts=wr.b,br=wr.r,kn=new At(32768),K=0;K<32768;++K){var ee=(K&43690)>>1|(K&21845)<<1;ee=(ee&52428)>>2|(ee&13107)<<2,ee=(ee&61680)>>4|(ee&3855)<<4,kn[K]=((ee&65280)>>8|(ee&255)<<8)>>1}for(var Rt=(function(n,t,e){for(var r=n.length,i=0,o=new At(t);i<r;++i)n[i]&&++o[n[i]-1];var s=new At(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(e){a=new At(1<<t);var l=15-t;for(i=0;i<r;++i)if(n[i])for(var c=i<<4|n[i],u=t-n[i],h=s[n[i]-1]++<<u,f=h|(1<<u)-1;h<=f;++h)a[kn[h]>>l]=c}else for(a=new At(r),i=0;i<r;++i)n[i]&&(a[i]=kn[s[n[i]-1]++]>>15-n[i]);return a}),ne=new ut(288),K=0;K<144;++K)ne[K]=8;for(var K=144;K<256;++K)ne[K]=9;for(var K=256;K<280;++K)ne[K]=7;for(var K=280;K<288;++K)ne[K]=8;for(var Te=new ut(32),K=0;K<32;++K)Te[K]=5;var es=Rt(ne,9,0),ns=Rt(ne,9,1),rs=Rt(Te,5,0),is=Rt(Te,5,1),An=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},Ut=function(n,t,e){var r=t/8|0;return(n[r]|n[r+1]<<8)>>(t&7)&e},On=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},In=function(n){return(n+7)/8|0},Sr=function(n,t,e){return(e==null||e>n.length)&&(e=n.length),new ut(n.subarray(t,e))},ss=["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"],Lt=function(n,t,e){var r=new Error(t||ss[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Lt),!e)throw r;return r},os=function(n,t,e,r){var i=n.length,o=0;if(!i||t.f&&!t.l)return e||new ut(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new ut(i*3));var c=function(Mt){var Tt=e.length;if(Mt>Tt){var ht=new ut(Math.max(Tt*2,Mt));ht.set(e),e=ht}},u=t.f||0,h=t.p||0,f=t.b||0,g=t.l,p=t.d,y=t.m,d=t.n,M=i*8;do{if(!g){u=Ut(n,h,1);var P=Ut(n,h+1,3);if(h+=3,P)if(P==1)g=ns,p=is,y=9,d=5;else if(P==2){var x=Ut(n,h,31)+257,S=Ut(n,h+10,15)+4,b=x+Ut(n,h+5,31)+1;h+=14;for(var D=new ut(b),N=new ut(19),E=0;E<S;++E)N[_n[E]]=Ut(n,h+E*3,7);h+=S*3;for(var F=An(N),z=(1<<F)-1,B=Rt(N,F,1),E=0;E<b;){var A=B[Ut(n,h,z)];h+=A&15;var w=A>>4;if(w<16)D[E++]=w;else{var W=0,O=0;for(w==16?(O=3+Ut(n,h,3),h+=2,W=D[E-1]):w==17?(O=3+Ut(n,h,7),h+=3):w==18&&(O=11+Ut(n,h,127),h+=7);O--;)D[E++]=W}}var L=D.subarray(0,x),j=D.subarray(x);y=An(L),d=An(j),g=Rt(L,y,1),p=Rt(j,d,1)}else Lt(1);else{var w=In(h)+4,C=n[w-4]|n[w-3]<<8,v=w+C;if(v>i){l&&Lt(0);break}a&&c(f+C),e.set(n.subarray(w,v),f),t.b=f+=C,t.p=h=v*8,t.f=u;continue}if(h>M){l&&Lt(0);break}}a&&c(f+131072);for(var I=(1<<y)-1,V=(1<<d)-1,T=h;;T=h){var W=g[On(n,h)&I],_=W>>4;if(h+=W&15,h>M){l&&Lt(0);break}if(W||Lt(2),_<256)e[f++]=_;else if(_==256){T=h,g=null;break}else{var U=_-254;if(_>264){var E=_-257,$=Xe[E];U=Ut(n,h,(1<<$)-1)+vr[E],h+=$}var q=p[On(n,h)&V],Z=q>>4;q||Lt(3),h+=q&15;var j=ts[Z];if(Z>3){var $=Ze[Z];j+=On(n,h)&(1<<$)-1,h+=$}if(h>M){l&&Lt(0);break}a&&c(f+131072);var nt=f+U;if(f<j){var Zt=o-j,Dt=Math.min(j,nt);for(Zt+f<0&&Lt(3);f<Dt;++f)e[f]=r[Zt+f]}for(;f<nt;++f)e[f]=e[f-j]}}t.l=g,t.p=T,t.b=f,t.f=u,g&&(u=1,t.m=y,t.d=p,t.n=d)}while(!u);return f!=e.length&&s?Sr(e,0,f):e.subarray(0,f)},Yt=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8},ke=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8,n[r+2]|=e>>16},En=function(n,t){for(var e=[],r=0;r<n.length;++r)n[r]&&e.push({s:r,f:n[r]});var i=e.length,o=e.slice();if(!i)return{t:_r,l:0};if(i==1){var s=new ut(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,x){return v.f-x.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],c=0,u=1,h=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=e[e[c].f<e[h].f?c++:h++],l=e[c!=u&&e[c].f<e[h].f?c++:h++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=o[0].s,r=1;r<i;++r)o[r].s>f&&(f=o[r].s);var g=new At(f+1),p=Bn(e[u-1],g,0);if(p>t){var r=0,y=0,d=p-t,M=1<<d;for(o.sort(function(x,S){return g[S.s]-g[x.s]||x.f-S.f});r<i;++r){var P=o[r].s;if(g[P]>t)y+=M-(1<<p-g[P]),g[P]=t;else break}for(y>>=d;y>0;){var w=o[r].s;g[w]<t?y-=1<<t-g[w]++-1:++r}for(;r>=0&&y;--r){var C=o[r].s;g[C]==t&&(--g[C],++y)}p=t}return{t:new ut(g),l:p}},Bn=function(n,t,e){return n.s==-1?Math.max(Bn(n.l,t,e+1),Bn(n.r,t,e+1)):t[n.s]=e},Cr=function(n){for(var t=n.length;t&&!n[--t];);for(var e=new At(++t),r=0,i=n[0],o=1,s=function(l){e[r++]=l},a=1;a<=t;++a)if(n[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=n[a]}return{c:e.subarray(0,r),n:t}},Ae=function(n,t){for(var e=0,r=0;r<t.length;++r)e+=n[r]*t[r];return e},Mr=function(n,t,e){var r=e.length,i=In(t+2);n[i]=r&255,n[i+1]=r>>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var o=0;o<r;++o)n[i+o+4]=e[o];return(i+4+r)*8},Pr=function(n,t,e,r,i,o,s,a,l,c,u){Yt(t,u++,e),++i[256];for(var h=En(i,15),f=h.t,g=h.l,p=En(o,15),y=p.t,d=p.l,M=Cr(f),P=M.c,w=M.n,C=Cr(y),v=C.c,x=C.n,S=new At(19),b=0;b<P.length;++b)++S[P[b]&31];for(var b=0;b<v.length;++b)++S[v[b]&31];for(var D=En(S,7),N=D.t,E=D.l,F=19;F>4&&!N[_n[F-1]];--F);var z=c+5<<3,B=Ae(i,ne)+Ae(o,Te)+s,A=Ae(i,f)+Ae(o,y)+s+14+3*F+Ae(S,N)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&z<=B&&z<=A)return Mr(t,u,n.subarray(l,l+c));var W,O,L,j;if(Yt(t,u,1+(A<B)),u+=2,A<B){W=Rt(f,g,0),O=f,L=Rt(y,d,0),j=y;var I=Rt(N,E,0);Yt(t,u,w-257),Yt(t,u+5,x-1),Yt(t,u+10,F-4),u+=14;for(var b=0;b<F;++b)Yt(t,u+3*b,N[_n[b]]);u+=3*F;for(var V=[P,v],T=0;T<2;++T)for(var _=V[T],b=0;b<_.length;++b){var U=_[b]&31;Yt(t,u,I[U]),u+=N[U],U>15&&(Yt(t,u,_[b]>>5&127),u+=_[b]>>12)}}else W=es,O=ne,L=rs,j=Te;for(var b=0;b<a;++b){var $=r[b];if($>255){var U=$>>18&31;ke(t,u,W[U+257]),u+=O[U+257],U>7&&(Yt(t,u,$>>23&31),u+=Xe[U]);var q=$&31;ke(t,u,L[q]),u+=j[q],q>3&&(ke(t,u,$>>5&8191),u+=Ze[q])}else ke(t,u,W[$]),u+=O[$]}return ke(t,u,W[256]),u+O[256]},as=new Pn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),_r=new ut(0),ls=function(n,t,e,r,i,o){var s=o.z||n.length,a=new ut(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),c=o.l,u=(o.r||0)&7;if(t){u&&(l[0]=o.r>>3);for(var h=as[t-1],f=h>>13,g=h&8191,p=(1<<e)-1,y=o.p||new At(32768),d=o.h||new At(p+1),M=Math.ceil(e/3),P=2*M,w=function(kt){return(n[kt]^n[kt+1]<<M^n[kt+2]<<P)&p},C=new Pn(25e3),v=new At(288),x=new At(32),S=0,b=0,D=o.i||0,N=0,E=o.w||0,F=0;D+2<s;++D){var z=w(D),B=D&32767,A=d[z];if(y[B]=A,d[z]=B,E<=D){var W=s-D;if((S>7e3||N>24576)&&(W>423||!c)){u=Pr(n,l,0,C,v,x,b,N,F,D-F,u),N=S=b=0,F=D;for(var O=0;O<286;++O)v[O]=0;for(var O=0;O<30;++O)x[O]=0}var L=2,j=0,I=g,V=B-A&32767;if(W>2&&z==w(D-V))for(var T=Math.min(f,W)-1,_=Math.min(32767,D),U=Math.min(258,W);V<=_&&--I&&B!=A;){if(n[D+L]==n[D+L-V]){for(var $=0;$<U&&n[D+$]==n[D+$-V];++$);if($>L){if(L=$,j=V,$>T)break;for(var q=Math.min(V,$-2),Z=0,O=0;O<q;++O){var nt=D-V+O&32767,Zt=y[nt],Dt=nt-Zt&32767;Dt>Z&&(Z=Dt,A=nt)}}}B=A,A=y[B],V+=B-A&32767}if(j){C[N++]=268435456|Tn[L]<<18|br[j];var Mt=Tn[L]&31,Tt=br[j]&31;b+=Xe[Mt]+Ze[Tt],++v[257+Mt],++x[Tt],E=D+L,++S}else C[N++]=n[D],++v[n[D]]}}for(D=Math.max(D,E);D<s;++D)C[N++]=n[D],++v[n[D]];u=Pr(n,l,c,C,v,x,b,N,F,D-F,u),c||(o.r=u&7|l[u/8|0]<<3,u-=7,o.h=d,o.p=y,o.i=D,o.w=E)}else{for(var D=o.w||0;D<s+c;D+=65535){var ht=D+65535;ht>=s&&(l[u/8|0]=c,ht=s),u=Mr(l,u+1,n.subarray(D,ht))}o.i=s}return Sr(a,0,r+In(u)+i)},Tr=function(){var n=1,t=0;return{p:function(e){for(var r=n,i=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)i+=r+=e[s];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}n=r,t=i},d:function(){return n%=65521,t%=65521,(n&255)<<24|(n&65280)<<8|(t&255)<<8|t>>8}}},cs=function(n,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ut(o.length+n.length);s.set(o),s.set(n,o.length),n=s,i.w=o.length}return ls(n,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+t.mem,e,r,i)},kr=function(n,t,e){for(;e;++t)n[t]=e,e>>>=8},hs=function(n,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(n[0]=120,n[1]=r<<6|(t.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,t.dictionary){var i=Tr();i.p(t.dictionary),kr(n,2,i.d())}},us=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Lt(6,"invalid zlib data"),(n[1]>>5&1)==1&&Lt(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function fs(n,t){t||(t={});var e=Tr();e.p(n);var r=cs(n,t,t.dictionary?6:2,4);return hs(r,t),kr(r,r.length-4,e.d()),r}function ps(n,t){return os(n.subarray(us(n),-4),{i:2},t,t)}var ds=typeof TextDecoder<"u"&&new TextDecoder,gs=0;try{ds.decode(_r,{stream:!0}),gs=1}catch{}const ys="modern-font";function Oe(n,t){if(!n)throw new Error(`[${ys}] ${t}`)}function ms(n){if("buffer"in n){const t=n.buffer;return n.byteOffset>0||n.byteLength<n.buffer.byteLength?t.slice(n.byteOffset,n.byteOffset+n.byteLength):t}else return n}function ye(n){return"buffer"in n?new DataView(n.buffer,n.byteOffset,n.byteLength):new DataView(n)}function xs(n){let t="";for(let e=0,r=n.length,i;e<r;e++)i=n.charCodeAt(e),i!==0&&(t+=String.fromCharCode(i));return t}function Ye(n){n=xs(n);const t=[];for(let e=0,r=n.length,i;e<r;e++)i=n.charCodeAt(e),t.push(i>>8),t.push(i&255);return t}function vs(n){let t="";for(let e=0,r=n.length;e<r;e++)n[e]<127?t+=String.fromCharCode(n[e]):t+=`%${(256+n[e]).toString(16).slice(1)}`;return unescape(t)}function ws(n){let t="";for(let e=0,r=n.length;e<r;e+=2)t+=String.fromCharCode((n[e]<<8)+n[e+1]);return t}var bs=Object.defineProperty,ft=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&bs(t,e,i),i};const Ke={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(n,t){Object.defineProperty(n.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 lt extends DataView{constructor(t,e,r,i){super(ms(t),e,r),this.littleEndian=i}cursor=0;readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,i)=>this.read(t.type,t.offset+i));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,i)=>{this.write(t.type,e[i],t.offset+i)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const i=`get${t.replace(/^\S/,l=>l.toUpperCase())}`,o=this,a=o[i]?.bind(o)?.(e,r);return this.cursor+=Ke[t],a}readUint24(t=this.cursor){const[e,r,i]=this.readBytes(t,3);return(e<<16)+(r<<8)+i}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let i=0;i<e;++i)r.push(this.getUint8(t+i));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let i="";for(let o=0,s=r.length;o<s;o++)i+=String.fromCharCode(r[o]);return i}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),i=new Date;return i.setTime(r*1e3+-20775456e5),i}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,i=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const o=`set${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,l=s[o]?.bind(s)?.(r,e,i);return this.cursor+=Ke[t.toLowerCase()],l}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let i=0,o=t.length,s;i<o;++i)s=t.charCodeAt(i)||0,s>127?this.writeUint16(s):this.writeUint8(s);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const i=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(i,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let i=0;i<r;++i)this.setUint8(e+i,t[i])}else{const i=ye(t);r=i.byteLength;for(let o=0;o<r;++o)this.setUint8(e+o,i.getUint8(o))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}ft([pt()],lt.prototype,"readInt8"),ft([pt()],lt.prototype,"readInt16"),ft([pt()],lt.prototype,"readInt32"),ft([pt()],lt.prototype,"readUint8"),ft([pt()],lt.prototype,"readUint16"),ft([pt()],lt.prototype,"readUint32"),ft([pt()],lt.prototype,"readFloat32"),ft([pt()],lt.prototype,"readFloat64"),ft([pt()],lt.prototype,"writeInt8"),ft([pt()],lt.prototype,"writeInt16"),ft([pt()],lt.prototype,"writeInt32"),ft([pt()],lt.prototype,"writeUint8"),ft([pt()],lt.prototype,"writeUint16"),ft([pt()],lt.prototype,"writeUint32"),ft([pt()],lt.prototype,"writeFloat32"),ft([pt()],lt.prototype,"writeFloat64");const Ar=new WeakMap;function m(n){const t=typeof n=="object"?n:{type:n},{size:e=1,type:r}=t;return(i,o)=>{if(typeof o!="string")return;let s=Ar.get(i);s||(s={columns:[],byteLength:0},Ar.set(i,s));const a={...t,name:o,byteLength:e*Ke[r],offset:t.offset??s.columns.reduce((l,c)=>l+c.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,c)=>l+Ke[c.type]*(c.size??1),0),Object.defineProperty(i.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class It{view;constructor(t,e,r,i){this.view=new lt(t,e,r,i)}}class Dn extends It{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 Ss=Object.defineProperty,vt=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ss(t,e,i),i};const wt=class Zi extends Dn{format="EmbeddedOpenType";mimeType="application/vnd.ms-fontobject";static from(t){const e=t.sfnt,i=e.name.names,o=Ye(i.fontFamily||""),s=o.length,a=Ye(i.fontStyle||""),l=a.length,c=Ye(i.version||""),u=c.length,h=Ye(i.fullName||""),f=h.length,g=86+s+4+l+4+u+4+f+2+t.view.byteLength,p=new Zi(new ArrayBuffer(g),0,g,!0);p.EOTSize=p.view.byteLength,p.FontDataSize=t.view.byteLength,p.Version=131073,p.Flags=0,p.Charset=1,p.MagicNumber=20556,p.Padding1=0,p.CheckSumAdjustment=e.head.checkSumAdjustment;const y=e.os2;return y&&(p.FontPANOSE=y.fontPANOSE,p.Italic=y.fsSelection,p.Weight=y.usWeightClass,p.fsType=y.fsType,p.UnicodeRange=y.ulUnicodeRange,p.CodePageRange=y.ulCodePageRange),p.view.writeUint16(s),p.view.writeBytes(o),p.view.writeUint16(0),p.view.writeUint16(l),p.view.writeBytes(a),p.view.writeUint16(0),p.view.writeUint16(u),p.view.writeBytes(c),p.view.writeUint16(0),p.view.writeUint16(f),p.view.writeBytes(h),p.view.writeUint16(0),p.view.writeUint16(0),p.view.writeBytes(t.view),p}};vt([m("uint32")],wt.prototype,"EOTSize"),vt([m("uint32")],wt.prototype,"FontDataSize"),vt([m("uint32")],wt.prototype,"Version"),vt([m("uint32")],wt.prototype,"Flags"),vt([m({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),vt([m("uint8")],wt.prototype,"Charset"),vt([m("uint8")],wt.prototype,"Italic"),vt([m("uint32")],wt.prototype,"Weight"),vt([m("uint16")],wt.prototype,"fsType"),vt([m("uint16")],wt.prototype,"MagicNumber"),vt([m({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),vt([m({type:"uint8",size:8})],wt.prototype,"CodePageRange"),vt([m("uint32")],wt.prototype,"CheckSumAdjustment"),vt([m({type:"uint8",size:16})],wt.prototype,"Reserved"),vt([m("uint16")],wt.prototype,"Padding1");var Cs=Object.defineProperty,Qe=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Cs(t,e,i),i};class Ie extends It{constructor(t,e){super(t,e,16)}}Qe([m({type:"char",size:4})],Ie.prototype,"tag"),Qe([m("uint32")],Ie.prototype,"checkSum"),Qe([m("uint32")],Ie.prototype,"offset"),Qe([m("uint32")],Ie.prototype,"length");const Fn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Ms=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class Or{index;name;isComposite=!1;components=[];pathCommands=[];constructor(t){const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,i={},o){const s=1/(o?.unitsPerEm??1e3)*r,{xScale:a=s,yScale:l=s}=i,c=this.pathCommands,u=[];for(let h=0,f=c.length;h<f;h+=1){const g=c[h];g.type==="M"?u.push({type:"M",x:t+g.x*a,y:e+-g.y*l}):g.type==="L"?u.push({type:"L",x:t+g.x*a,y:e+-g.y*l}):g.type==="Q"?u.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="C"?u.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*l,x2:t+g.x2*a,y2:e+-g.y2*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="Z"&&u.push({type:"Z"})}return u}}class Ps extends Or{parse(t,e,r){const i=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=t,c=t.topDict.paintType,u=this.index;let h,f,g,p;const y=[],d=[];let M=0,P=!1,w=!1,C=s,v=0,x=0;function S(B,A){y.push({type:"L",x:B,y:A})}function b(B,A,W,O,L,j){y.push({type:"C",x1:B,y1:A,x2:W,y2:O,x:L,y:j})}function D(B,A){w&&c!==2&&N(),w=!0,y.push({type:"M",x:B,y:A})}function N(){y.push({type:"Z"})}function E(B){y.push(...B)}function F(){d.length%2!==0&&!P&&(C=d.shift()+o),M+=d.length>>1,d.length=0,P=!0}function z(B){let A,W,O,L,j,I,V,T,_,U,$,q,Z=0;for(;Z<B.length;){let nt=B[Z++];switch(nt){case 1:F();break;case 3:F();break;case 4:d.length>1&&!P&&(C=d.shift()+o,P=!0),x+=d.pop(),D(v,x);break;case 5:for(;d.length>0;)v+=d.shift(),x+=d.shift(),S(v,x);break;case 6:for(;d.length>0&&(v+=d.shift(),S(v,x),d.length!==0);)x+=d.shift(),S(v,x);break;case 7:for(;d.length>0&&(x+=d.shift(),S(v,x),d.length!==0);)v+=d.shift(),S(v,x);break;case 8:for(;d.length>0;)h=v+d.shift(),f=x+d.shift(),g=h+d.shift(),p=f+d.shift(),v=g+d.shift(),x=p+d.shift(),b(h,f,g,p,v,x);break;case 10:j=d.pop()+l,I=t.subrs[j],I&&z(I);break;case 11:return;case 12:switch(nt=B[Z],Z+=1,nt){case 35:h=v+d.shift(),f=x+d.shift(),g=h+d.shift(),p=f+d.shift(),V=g+d.shift(),T=p+d.shift(),_=V+d.shift(),U=T+d.shift(),$=_+d.shift(),q=U+d.shift(),v=$+d.shift(),x=q+d.shift(),d.shift(),b(h,f,g,p,V,T),b(_,U,$,q,v,x);break;case 34:h=v+d.shift(),f=x,g=h+d.shift(),p=f+d.shift(),V=g+d.shift(),T=p,_=V+d.shift(),U=p,$=_+d.shift(),q=x,v=$+d.shift(),b(h,f,g,p,V,T),b(_,U,$,q,v,x);break;case 36:h=v+d.shift(),f=x+d.shift(),g=h+d.shift(),p=f+d.shift(),V=g+d.shift(),T=p,_=V+d.shift(),U=p,$=_+d.shift(),q=U+d.shift(),v=$+d.shift(),b(h,f,g,p,V,T),b(_,U,$,q,v,x);break;case 37:h=v+d.shift(),f=x+d.shift(),g=h+d.shift(),p=f+d.shift(),V=g+d.shift(),T=p+d.shift(),_=V+d.shift(),U=T+d.shift(),$=_+d.shift(),q=U+d.shift(),Math.abs($-v)>Math.abs(q-x)?v=$+d.shift():x=q+d.shift(),b(h,f,g,p,V,T),b(_,U,$,q,v,x);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+nt}`),d.length=0}break;case 14:if(d.length>=4){const Zt=Fn[d.pop()],Dt=Fn[d.pop()],Mt=d.pop(),Tt=d.pop();if(Zt&&Dt){i.isComposite=!0,i.components=[];const ht=t.charset.indexOf(Zt),kt=t.charset.indexOf(Dt);i.components.push({glyphIndex:kt,dx:0,dy:0}),i.components.push({glyphIndex:ht,dx:Tt,dy:Mt}),E(r.get(kt).pathCommands);const Vt=JSON.parse(JSON.stringify(r.get(ht).pathCommands));for(let jt=0;jt<Vt.length;jt+=1){const Ft=Vt[jt];Ft.type!=="Z"&&(Ft.x+=Tt,Ft.y+=Mt),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Tt,Ft.y1+=Mt),Ft.type==="C"&&(Ft.x2+=Tt,Ft.y2+=Mt)}E(Vt)}}else d.length>0&&!P&&(C=d.shift()+o,P=!0);w&&c!==2&&(N(),w=!1);break;case 18:F();break;case 19:case 20:F(),Z+=M+7>>3;break;case 21:d.length>2&&!P&&(C=d.shift()+o,P=!0),x+=d.pop(),v+=d.pop(),D(v,x);break;case 22:d.length>1&&!P&&(C=d.shift()+o,P=!0),v+=d.pop(),D(v,x);break;case 23:F();break;case 24:for(;d.length>2;)h=v+d.shift(),f=x+d.shift(),g=h+d.shift(),p=f+d.shift(),v=g+d.shift(),x=p+d.shift(),b(h,f,g,p,v,x);v+=d.shift(),x+=d.shift(),S(v,x);break;case 25:for(;d.length>6;)v+=d.shift(),x+=d.shift(),S(v,x);h=v+d.shift(),f=x+d.shift(),g=h+d.shift(),p=f+d.shift(),v=g+d.shift(),x=p+d.shift(),b(h,f,g,p,v,x);break;case 26:for(d.length%2&&(v+=d.shift());d.length>0;)h=v,f=x+d.shift(),g=h+d.shift(),p=f+d.shift(),v=g,x=p+d.shift(),b(h,f,g,p,v,x);break;case 27:for(d.length%2&&(x+=d.shift());d.length>0;)h=v+d.shift(),f=x,g=h+d.shift(),p=f+d.shift(),v=g+d.shift(),x=p,b(h,f,g,p,v,x);break;case 28:A=B[Z],W=B[Z+1],d.push((A<<24|W<<16)>>16),Z+=2;break;case 29:j=d.pop()+a,I=t.gsubrs[j],I&&z(I);break;case 30:for(;d.length>0&&(h=v,f=x+d.shift(),g=h+d.shift(),p=f+d.shift(),v=g+d.shift(),x=p+(d.length===1?d.shift():0),b(h,f,g,p,v,x),d.length!==0);)h=v+d.shift(),f=x,g=h+d.shift(),p=f+d.shift(),x=p+d.shift(),v=g+(d.length===1?d.shift():0),b(h,f,g,p,v,x);break;case 31:for(;d.length>0&&(h=v+d.shift(),f=x,g=h+d.shift(),p=f+d.shift(),x=p+d.shift(),v=g+(d.length===1?d.shift():0),b(h,f,g,p,v,x),d.length!==0);)h=v,f=x+d.shift(),g=h+d.shift(),p=f+d.shift(),v=g+d.shift(),x=p+(d.length===1?d.shift():0),b(h,f,g,p,v,x);break;default:nt<32?console.warn(`Glyph ${u}: unknown operator ${nt}`):nt<247?d.push(nt-139):nt<251?(A=B[Z],Z+=1,d.push((nt-247)*256+A+108)):nt<255?(A=B[Z],Z+=1,d.push(-(nt-251)*256-A-108)):(A=B[Z],W=B[Z+1],O=B[Z+2],L=B[Z+3],Z+=4,d.push((A<<24|W<<16|O<<8|L)/65536))}}}z(e),this.pathCommands=y,P&&(this.advanceWidth=C)}}class Ir{constructor(t){this._sfnt=t}_items=[];get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const i=this._sfnt.hmtx.metrics[t];i&&(r.advanceWidth=r.advanceWidth||i.advanceWidth,r.leftSideBearing=r.leftSideBearing||i.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??=o[0],r.unicodes??=o),this._items[t]=r}return r}}class _s extends Ir{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Ps({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Ts=Object.defineProperty,Er=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ts(t,e,i),i};class Je extends It{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(t,e,r,i){super(t,e,r,i),this._init()}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const i=[];for(let o=0,s=e+1;o<s;o++){const a=this.view;let l=0;for(let c=0;c<r;c++)l<<=8,l+=a.readUint8();i.push(l)}return i}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,i=r+e[t],s=r+e[t+1]-i;return this._isString?this.view.readString(i,s):this.view.readBytes(i,s)}}Er([m("uint16")],Je.prototype,"count"),Er([m("uint8")],Je.prototype,"offsetSize");class tn extends Je{_isString=!1}class Br extends Je{_isString=!0}const ks=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],As=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Os=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Is=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function en(n,t){return t<=390?ks[t]:n[t-391]}function Q(n,t="number",e){return(r,i)=>{if(typeof i!="string")return;const o={type:t,operator:n,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,i,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class Dr extends It{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),s=o>>4,a=o&15;if(s===r||(e+=i[s],a===r))break;e+=i[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,i,o,s;if(t===28)return r=e.readUint8(),i=e.readUint8(),r<<8|i;if(t===29)return r=e.readUint8(),i=e.readUint8(),o=e.readUint8(),s=e.readUint8(),r<<24|i<<16|o<<8|s;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,i={};for(;t.cursor<r;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),i[o]=e,e=[]):e.push(this._readOperand(o))}return i}_getProp(t){const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return en(this._stringIndex?.objects??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Es=Object.defineProperty,Un=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Es(t,e,i),i};class nn extends Dr{}Un([Q(19)],nn.prototype,"subrs"),Un([Q(20)],nn.prototype,"defaultWidthX"),Un([Q(21)],nn.prototype,"nominalWidthX");var Bs=Object.defineProperty,rt=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Bs(t,e,i),i};class et extends Dr{}rt([Q(0,"string")],et.prototype,"version"),rt([Q(1,"string")],et.prototype,"notice"),rt([Q(1200,"string")],et.prototype,"copyright"),rt([Q(2,"string")],et.prototype,"fullName"),rt([Q(3,"string")],et.prototype,"familyName"),rt([Q(4,"string")],et.prototype,"weight"),rt([Q(1201)],et.prototype,"isFixedPitch"),rt([Q(1202)],et.prototype,"italicAngle"),rt([Q(1203,"number",-100)],et.prototype,"underlinePosition"),rt([Q(1204,"number",50)],et.prototype,"underlineThickness"),rt([Q(1205)],et.prototype,"paintType"),rt([Q(1206,"number",2)],et.prototype,"charstringType"),rt([Q(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),rt([Q(13)],et.prototype,"uniqueId"),rt([Q(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),rt([Q(1208)],et.prototype,"strokeWidth"),rt([Q(14)],et.prototype,"xuid"),rt([Q(15)],et.prototype,"charset"),rt([Q(16)],et.prototype,"encoding"),rt([Q(17)],et.prototype,"charStrings"),rt([Q(18,"number[]",[0,0])],et.prototype,"private");function dt(n,t=n){return e=>{Kt.tableDefinitions.set(n,{tag:n,prop:t,class:e}),Object.defineProperty(Kt.prototype,t,{get(){return this.get(n)},set(r){return this.set(n,r)},configurable:!0,enumerable:!0})}}class Kt{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:i}=this.cff;e=i.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),i=r.length,o=Array.from({length:i}),s=e.get(0);for(let a=0;a<i;a+=1)o[a]=e.get(r[a])||s;return o}getPathCommands(t,e,r,i,o){const s=[];return this.forEachGlyph(t,e,r,i,o,(a,l,c,u,h)=>{s.push(...a.getPathCommands(l,c,u,h,this))}),s}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,i=72,o={},s){const a=1/this.unitsPerEm*i,l=this.textToGlyphs(t);for(let c=0;c<l.length;c+=1){const u=l[c];s.call(this,u,e,r,i,o),u.advanceWidth&&(e+=u.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*i:o.tracking&&(e+=o.tracking/1e3*i)}return e}constructor(t){(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,i)=>{this.tableViews.set(i,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}clone(){return new Kt(this.tableViews)}delete(t){const e=Kt.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Kt.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Kt.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const i=e.class;if(i){const o=this.tableViews.get(t);if(!o)return;r=new i(o.buffer,o.byteOffset,o.byteLength).setSFNT(this),this.tables.set(e.prop,r)}}return r}}class gt extends It{setSFNT(t){return this._sfnt=t,this}getSFNT(){return this._sfnt}}var Ds=Object.defineProperty,Fs=Object.getOwnPropertyDescriptor,Ee=(n,t,e,r)=>{for(var i=r>1?void 0:r?Fs(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&Ds(t,e,i),i};let me=class extends gt{_glyphs;get glyphs(){return this._glyphs??=new _s(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(n,t,e,r){super(n,t,e,r),this._init()}_init(){const n=this.view,{buffer:t,byteOffset:e}=n,r=e+4;this.nameIndex=new Br(t,r),this.topDictIndex=new tn(t,this.nameIndex.endOffset),this.stringIndex=new Br(t,this.topDictIndex.endOffset),this.globalSubrIndex=new tn(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new nn(t,e+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new tn(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new tn(t,e+this.topDict.charStrings);const s=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=As:this.topDict.charset===1?this.charset=Os:this.topDict.charset===2?this.charset=Is:this.charset=this._readCharset(e+this.topDict.charset,s,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Fn:this.topDict.encoding===1?this.encoding=Ms:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(n,t,e){const r=this.view;r.seek(n);let i,o,s;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(i=0;i<t;i+=1)o=r.readUint16(),a.push(en(e,o));else if(l===1)for(;a.length<=t;)for(o=r.readUint16(),s=r.readUint8(),i=0;i<=s;i+=1)a.push(en(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=r.readUint16(),s=r.readUint16(),i=0;i<=s;i+=1)a.push(en(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(n){const t=this.view;t.seek(n);let e,r;const i={},o=t.readUint8();if(o===0){const s=t.readUint8();for(e=0;e<s;e+=1)r=t.readUint8(),i[r]=e}else if(o===1){const s=t.readUint8();for(r=1,e=0;e<s;e+=1){const a=t.readUint8(),l=t.readUint8();for(let c=a;c<=a+l;c+=1)i[c]=r,r+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(n){let t;return n.length<1240?t=107:n.length<33900?t=1131:t=32768,t}};Ee([m("uint8")],me.prototype,"majorVersion",2),Ee([m("uint8")],me.prototype,"minorVersion",2),Ee([m("uint8")],me.prototype,"headerSize",2),Ee([m("uint8")],me.prototype,"offsetSize",2),me=Ee([dt("CFF ","cff")],me);var Us=Object.defineProperty,rn=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Us(t,e,i),i};const Be=class Yi extends It{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new Yi;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,i)=>{i<256&&r<256&&e.view.writeUint8(r,6+i)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};rn([m("uint16")],Be.prototype,"format"),rn([m("uint16")],Be.prototype,"length"),rn([m("uint16")],Be.prototype,"language"),rn([m({type:"uint8",size:256})],Be.prototype,"glyphIndexArray");let Fr=Be;var Ls=Object.defineProperty,Ln=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ls(t,e,i),i};class sn extends It{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,i=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,a=r.findIndex(c=>c===i);let l=0;for(let c=0;c<256;c++)if(r[c]===0)c>=a||c<o[0].firstCode||c>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(c-o[0].firstCode)>=s.length?l=0:(l=s[o[0].idRangeOffset+(c-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(c,l);else{const u=r[c];for(let h=0,f=o[u].entryCount;h<f;h++)if(o[u].idRangeOffset+h>=s.length?l=0:(l=s[o[u].idRangeOffset+h],l!==0&&(l=l+o[u].idDelta)),l!==0&&l<t){const g=(c<<8|h+o[u].firstCode)%65535;e.set(g,l)}}return e}}Ln([m("uint16")],sn.prototype,"format"),Ln([m("uint16")],sn.prototype,"length"),Ln([m("uint16")],sn.prototype,"language");function Ur(n){return n>32767?n-65536:n<-32767?n+65536:n}function Lr(n,t){let e;const r=[];let i={};return n.forEach((o,s)=>{t&&s>t||((!e||s!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(i.end=e.unicode,r.push(i),i={start:s,startId:o,delta:Ur(o-s)}):(i.start=Number(s),i.startId=o,i.delta=Ur(o-s))),e={unicode:s,glyphIndex:o})}),e&&(i.end=e.unicode,r.push(i)),r}var $s=Object.defineProperty,ue=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&$s(t,e,i),i};const re=class Ki extends It{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=Lr(t,65535),r=e.length+1,i=Math.floor(Math.log(r)/Math.LN2),o=2*2**i,s=new Ki(new ArrayBuffer(24+e.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=r*2,s.searchRange=o,s.entrySelector=i,s.rangeShift=2*r-o,s.endCode=[...e.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...e.map(a=>a.start),65535],s.idDelta=[...e.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:r},()=>0),s}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,i=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let c=0;c<e;++c)for(let u=i[c],h=o[c];u<=h;++u)if(s[c]===0)t.set(u,(u+a[c])%65536);else{const f=c+s[c]/2+(u-i[c])-r,g=l[f];g!==0?t.set(u,(g+a[c])%65536):t.set(u,0)}return t.delete(65535),t}};ue([m("uint16")],re.prototype,"format"),ue([m("uint16")],re.prototype,"length"),ue([m("uint16")],re.prototype,"language"),ue([m("uint16")],re.prototype,"segCountX2"),ue([m("uint16")],re.prototype,"searchRange"),ue([m("uint16")],re.prototype,"entrySelector"),ue([m("uint16")],re.prototype,"rangeShift");let $r=re;var zs=Object.defineProperty,De=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&zs(t,e,i),i};class xe extends It{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,i)=>{e.set(i,r)}),e}}De([m("uint16")],xe.prototype,"format"),De([m("uint16")],xe.prototype,"length"),De([m("uint16")],xe.prototype,"language"),De([m("uint16")],xe.prototype,"firstCode"),De([m("uint16")],xe.prototype,"entryCount");var Ns=Object.defineProperty,Fe=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ns(t,e,i),i};const ve=class Qi extends It{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=Lr(t),r=new Qi(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(i=>{r.view.writeUint32(i.start),r.view.writeUint32(i.end),r.view.writeUint32(i.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,i=e.length;r<i;r++){const o=e[r];let s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,s++)}return t}};Fe([m("uint16")],ve.prototype,"format"),Fe([m("uint16")],ve.prototype,"reserved"),Fe([m("uint32")],ve.prototype,"length"),Fe([m("uint32")],ve.prototype,"language"),Fe([m("uint32")],ve.prototype,"nGroups");let zr=ve;var Vs=Object.defineProperty,$n=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Vs(t,e,i),i};class on extends It{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,i=e.length;r<i;r++){const{uVSMappings:o}=e[r];o.forEach(s=>{t.set(s.unicodeValue,s.glyphID)})}return t}}$n([m("uint16")],on.prototype,"format"),$n([m("uint32")],on.prototype,"length"),$n([m("uint32")],on.prototype,"numVarSelectorRecords");var js=Object.defineProperty,Rs=Object.getOwnPropertyDescriptor,zn=(n,t,e,r)=>{for(var i=r>1?void 0:r?Rs(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&js(t,e,i),i};let Ue=class extends gt{static from(n){const t=Array.from(n.keys()).some(u=>u>65535),e=$r.from(n),r=Fr.from(n),i=t?zr.from(n):void 0,o=4+(i?32:24),s=o+e.view.byteLength,a=s+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:s},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),c=new Ue(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+(i?.view.byteLength??0)));return c.numberSubtables=l.length,c.view.seek(4),l.forEach(u=>{c.view.writeUint16(u.platformID),c.view.writeUint16(u.platformSpecificID),c.view.writeUint32(u.offset)}),c.view.writeBytes(e.view,o),c.view.writeBytes(r.view,s),i&&c.view.writeBytes(i.view,a),c}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const n=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,i=e.length;r<i;r++){const o=e[r],s=t.get(o);n.has(s)?n.get(s).push(o):n.set(s,[o])}this._glyphIndexToUnicodesMap=n}return this._glyphIndexToUnicodesMap}readSubtables(){const n=this.numberSubtables;return this.view.seek(4),Array.from({length:n},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const e=this.view.readUint16();let r;switch(e){case 0:r=new Fr(this.view.buffer,t.offset);break;case 2:r=new sn(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new $r(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new xe(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new zr(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new on(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){const n=this.readSubtables(),t=n.find(s=>s.format===0)?.view,e=n.find(s=>s.platformID===3&&s.platformSpecificID===3&&s.format===2)?.view,r=n.find(s=>s.platformID===3&&s.platformSpecificID===1&&s.format===4)?.view,i=n.find(s=>s.platformID===3&&s.platformSpecificID===10&&s.format===12)?.view,o=n.find(s=>s.platformID===0&&s.platformSpecificID===5&&s.format===14)?.view;return new Map([...t?.getUnicodeToGlyphIndexMap()??[],...e?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...r?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...o?.getUnicodeToGlyphIndexMap()??[]])}};zn([m("uint16")],Ue.prototype,"version",2),zn([m("uint16")],Ue.prototype,"numberSubtables",2),Ue=zn([dt("cmap")],Ue);class Gs extends Or{_parseContours(t){const e=[];let r=[];for(let i=0;i<t.length;i+=1){const o=t[i];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return Oe(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let i=0;i<t.length;i+=1){const o=t[i],s={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(s)}return r}_parseGlyphCoordinate(t,e,r,i,o){let s;return(e&i)>0?(s=t.view.readUint8(),(e&o)===0&&(s=-s),s=r+s):(e&o)>0?s=r:s=r+t.view.readInt16(),s}parse(t,e,r){t.view.seek(e);const i=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(),i>0){const a=this.endPointIndices=[];for(let y=0;y<i;y++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();Oe(l<5e3,`Bad instructionLength:${l}`);const c=this.instructions=[];for(let y=0;y<l;++y)c.push(t.view.readUint8());const u=t.view.byteOffset,h=a[a.length-1]+1;Oe(h<2e4,`Bad numberOfCoordinates:${u}`);const f=[];let g,p=0;for(;p<h;)if(g=t.view.readUint8(),f.push(g),p++,g&8&&p<h){const y=t.view.readUint8();for(let d=0;d<y;d++)f.push(g),p++}if(Oe(f.length===h,`Bad flags length: ${f.length}, numberOfCoordinates: ${h}`),a.length>0){const y=[];let d;if(h>0){for(let w=0;w<h;w+=1)g=f[w],d={},d.onCurve=!!(g&1),d.lastPointOfContour=a.includes(w),y.push(d);let M=0;for(let w=0;w<h;w+=1)g=f[w],d=y[w],d.x=this._parseGlyphCoordinate(t,g,M,2,16),M=d.x;let P=0;for(let w=0;w<h;w+=1)g=f[w],d=y[w],d.y=this._parseGlyphCoordinate(t,g,P,4,32),P=d.y}this.points=y}else this.points=[]}else if(i===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=t.view.readUint16();const c={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(c.dx=t.view.readInt16(),c.dy=t.view.readInt16()):c.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(c.dx=t.view.readInt8(),c.dy=t.view.readInt8()):c.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?c.xScale=c.yScale=t.view.readInt16()/16384:(a&64)>0?(c.xScale=t.view.readInt16()/16384,c.yScale=t.view.readInt16()/16384):(a&128)>0&&(c.xScale=t.view.readInt16()/16384,c.scale01=t.view.readInt16()/16384,c.scale10=t.view.readInt16()/16384,c.yScale=t.view.readInt16()/16384),this.components.push(c),l=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let c=0;c<this.instructionLength;c+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],c=r.get(l.glyphIndex);if(c.getPathCommands(),c.points){let u;if(l.matchedPoints===void 0)u=this._transformPoints(c.points,l);else{Oe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>c.points.length-1,`Matched points out of range in ${this.name}`);const h=this.points[l.matchedPoints[0]];let f=c.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};f=this._transformPoints([f],g)[0],g.dx=h.x-f.x,g.dy=h.y-f.y,u=this._transformPoints(c.points,g)}this.points=this.points.concat(u)}}const o=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const c=s[a];let u=c[c.length-1],h=c[0];u.onCurve?o.push({type:"M",x:u.x,y:u.y}):h.onCurve?o.push({type:"M",x:h.x,y:h.y}):o.push({type:"M",x:(u.x+h.x)*.5,y:(u.y+h.y)*.5});for(let f=0,g=c.length;f<g;++f)if(u=h,h=c[(f+1)%g],u.onCurve)o.push({type:"L",x:u.x,y:u.y});else{let p=h;h.onCurve||(p={x:(u.x+h.x)*.5,y:(u.y+h.y)*.5}),o.push({type:"Q",x1:u.x,y1:u.y,x:p.x,y:p.y})}o.push({type:"Z"})}this.pathCommands=o}}class qs extends Ir{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],i=new Gs({index:t});return r!==e[t+1]&&i.parse(this._sfnt.glyf,r,this),i}}var Ws=Object.getOwnPropertyDescriptor,Hs=(n,t,e,r)=>{for(var i=r>1?void 0:r?Ws(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let Nn=class extends gt{static from(n){const t=n.reduce((r,i)=>r+i.byteLength,0),e=new Nn(new ArrayBuffer(t));return n.forEach(r=>{e.view.writeBytes(r)}),e}_glyphs;get glyphs(){return this._glyphs??=new qs(this._sfnt)}};Nn=Hs([dt("glyf")],Nn);var Xs=Object.getOwnPropertyDescriptor,Zs=(n,t,e,r)=>{for(var i=r>1?void 0:r?Xs(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let Nr=class extends gt{};Nr=Zs([dt("GPOS","gpos")],Nr);var Ys=Object.defineProperty,Ks=Object.getOwnPropertyDescriptor,fe=(n,t,e,r)=>{for(var i=r>1?void 0:r?Ks(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&Ys(t,e,i),i};let ie=class extends gt{};fe([m("uint16")],ie.prototype,"majorVersion",2),fe([m("uint16")],ie.prototype,"minorVersion",2),fe([m("uint16")],ie.prototype,"scriptListOffset",2),fe([m("uint16")],ie.prototype,"featureListOffset",2),fe([m("uint16")],ie.prototype,"lookupListOffset",2),fe([m("uint16")],ie.prototype,"featureVariationsOffset",2),ie=fe([dt("GSUB","gsub")],ie);var Qs=Object.defineProperty,Js=Object.getOwnPropertyDescriptor,ot=(n,t,e,r)=>{for(var i=r>1?void 0:r?Js(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&Qs(t,e,i),i};let st=class extends gt{constructor(n=new ArrayBuffer(54),t){super(n,t,Math.min(54,n.byteLength-(t??0)))}};ot([m("fixed")],st.prototype,"version",2),ot([m("fixed")],st.prototype,"fontRevision",2),ot([m("uint32")],st.prototype,"checkSumAdjustment",2),ot([m("uint32")],st.prototype,"magickNumber",2),ot([m("uint16")],st.prototype,"flags",2),ot([m("uint16")],st.prototype,"unitsPerEm",2),ot([m({type:"longDateTime"})],st.prototype,"created",2),ot([m({type:"longDateTime"})],st.prototype,"modified",2),ot([m("int16")],st.prototype,"xMin",2),ot([m("int16")],st.prototype,"yMin",2),ot([m("int16")],st.prototype,"xMax",2),ot([m("int16")],st.prototype,"yMax",2),ot([m("uint16")],st.prototype,"macStyle",2),ot([m("uint16")],st.prototype,"lowestRecPPEM",2),ot([m("int16")],st.prototype,"fontDirectionHint",2),ot([m("int16")],st.prototype,"indexToLocFormat",2),ot([m("int16")],st.prototype,"glyphDataFormat",2),st=ot([dt("head")],st);var to=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,bt=(n,t,e,r)=>{for(var i=r>1?void 0:r?eo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&to(t,e,i),i};let yt=class extends gt{constructor(n=new ArrayBuffer(36),t){super(n,t,Math.min(36,n.byteLength-(t??0)))}};bt([m("fixed")],yt.prototype,"version",2),bt([m("int16")],yt.prototype,"ascent",2),bt([m("int16")],yt.prototype,"descent",2),bt([m("int16")],yt.prototype,"lineGap",2),bt([m("uint16")],yt.prototype,"advanceWidthMax",2),bt([m("int16")],yt.prototype,"minLeftSideBearing",2),bt([m("int16")],yt.prototype,"minRightSideBearing",2),bt([m("int16")],yt.prototype,"xMaxExtent",2),bt([m("int16")],yt.prototype,"caretSlopeRise",2),bt([m("int16")],yt.prototype,"caretSlopeRun",2),bt([m("int16")],yt.prototype,"caretOffset",2),bt([m({type:"int16",size:4})],yt.prototype,"reserved",2),bt([m("int16")],yt.prototype,"metricDataFormat",2),bt([m("uint16")],yt.prototype,"numOfLongHorMetrics",2),yt=bt([dt("hhea")],yt);var no=Object.getOwnPropertyDescriptor,ro=(n,t,e,r)=>{for(var i=r>1?void 0:r?no(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let Vn=class extends gt{static from(n){const t=n.length*4,e=new Vn(new ArrayBuffer(t));return n.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const n=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:n}).map((i,o)=>(o<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};Vn=ro([dt("hmtx")],Vn);var io=Object.getOwnPropertyDescriptor,so=(n,t,e,r)=>{for(var i=r>1?void 0:r?io(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let Vr=class extends gt{};Vr=so([dt("kern","kern")],Vr);var oo=Object.getOwnPropertyDescriptor,ao=(n,t,e,r)=>{for(var i=r>1?void 0:r?oo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let jn=class extends gt{static from(n,t=1){const e=n.length*(t?4:2),r=new jn(new ArrayBuffer(e));return n.forEach(i=>{t?r.view.writeUint32(i):r.view.writeUint16(i/2)}),r}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){const n=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:n}).map(()=>t?e.readUint32():e.readUint16()*2)}};jn=ao([dt("loca")],jn);var lo=Object.defineProperty,co=Object.getOwnPropertyDescriptor,mt=(n,t,e,r)=>{for(var i=r>1?void 0:r?co(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&lo(t,e,i),i};let ct=class extends gt{constructor(n=new ArrayBuffer(32),t){super(n,t,Math.min(32,n.byteLength-(t??0)))}};mt([m("fixed")],ct.prototype,"version",2),mt([m("uint16")],ct.prototype,"numGlyphs",2),mt([m("uint16")],ct.prototype,"maxPoints",2),mt([m("uint16")],ct.prototype,"maxContours",2),mt([m("uint16")],ct.prototype,"maxComponentPoints",2),mt([m("uint16")],ct.prototype,"maxComponentContours",2),mt([m("uint16")],ct.prototype,"maxZones",2),mt([m("uint16")],ct.prototype,"maxTwilightPoints",2),mt([m("uint16")],ct.prototype,"maxStorage",2),mt([m("uint16")],ct.prototype,"maxFunctionDefs",2),mt([m("uint16")],ct.prototype,"maxInstructionDefs",2),mt([m("uint16")],ct.prototype,"maxStackElements",2),mt([m("uint16")],ct.prototype,"maxSizeOfInstructions",2),mt([m("uint16")],ct.prototype,"maxComponentElements",2),mt([m("uint16")],ct.prototype,"maxComponentDepth",2),ct=mt([dt("maxp")],ct);var ho=Object.defineProperty,uo=Object.getOwnPropertyDescriptor,an=(n,t,e,r)=>{for(var i=r>1?void 0:r?uo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&ho(t,e,i),i};const jr={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"},Rn={Macintosh:1,Microsoft:3},fo={Default:0},Rr={UCS2:1};let Le=class extends gt{_names;get names(){return this._names??=this.readNames()}readNames(){const n=this.count;this.view.seek(6);const t=[];for(let a=0;a<n;++a)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const e=this.stringOffset;for(let a=0;a<n;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let r=Rn.Macintosh,i=fo.Default,o=0;t.some(a=>a.platform===Rn.Microsoft&&a.encoding===Rr.UCS2&&a.language===1033)&&(r=Rn.Microsoft,i=Rr.UCS2,o=1033);const s={};for(let a=0;a<n;++a){const l=t[a];l.platform===r&&l.encoding===i&&l.language===o&&jr[l.nameId]&&(s[jr[l.nameId]]=o===0?vs(l.name):ws(l.name))}return s}};an([m("uint16")],Le.prototype,"format",2),an([m("uint16")],Le.prototype,"count",2),an([m("uint16")],Le.prototype,"stringOffset",2),Le=an([dt("name")],Le);var po=Object.defineProperty,go=Object.getOwnPropertyDescriptor,G=(n,t,e,r)=>{for(var i=r>1?void 0:r?go(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&po(t,e,i),i};let R=class extends gt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};G([m("uint16")],R.prototype,"version",2),G([m("int16")],R.prototype,"xAvgCharWidth",2),G([m("uint16")],R.prototype,"usWeightClass",2),G([m("uint16")],R.prototype,"usWidthClass",2),G([m("uint16")],R.prototype,"fsType",2),G([m("uint16")],R.prototype,"ySubscriptXSize",2),G([m("uint16")],R.prototype,"ySubscriptYSize",2),G([m("uint16")],R.prototype,"ySubscriptXOffset",2),G([m("uint16")],R.prototype,"ySubscriptYOffset",2),G([m("uint16")],R.prototype,"ySuperscriptXSize",2),G([m("uint16")],R.prototype,"ySuperscriptYSize",2),G([m("uint16")],R.prototype,"ySuperscriptXOffset",2),G([m("uint16")],R.prototype,"ySuperscriptYOffset",2),G([m("uint16")],R.prototype,"yStrikeoutSize",2),G([m("uint16")],R.prototype,"yStrikeoutPosition",2),G([m("uint16")],R.prototype,"sFamilyClass",2),G([m({type:"uint8"})],R.prototype,"bFamilyType",2),G([m({type:"uint8"})],R.prototype,"bSerifStyle",2),G([m({type:"uint8"})],R.prototype,"bWeight",2),G([m({type:"uint8"})],R.prototype,"bProportion",2),G([m({type:"uint8"})],R.prototype,"bContrast",2),G([m({type:"uint8"})],R.prototype,"bStrokeVariation",2),G([m({type:"uint8"})],R.prototype,"bArmStyle",2),G([m({type:"uint8"})],R.prototype,"bLetterform",2),G([m({type:"uint8"})],R.prototype,"bMidline",2),G([m({type:"uint8"})],R.prototype,"bXHeight",2),G([m({type:"uint8",size:16})],R.prototype,"ulUnicodeRange",2),G([m({type:"char",size:4})],R.prototype,"achVendID",2),G([m("uint16")],R.prototype,"fsSelection",2),G([m("uint16")],R.prototype,"usFirstCharIndex",2),G([m("uint16")],R.prototype,"usLastCharIndex",2),G([m("int16")],R.prototype,"sTypoAscender",2),G([m("int16")],R.prototype,"sTypoDescender",2),G([m("int16")],R.prototype,"sTypoLineGap",2),G([m("uint16")],R.prototype,"usWinAscent",2),G([m("uint16")],R.prototype,"usWinDescent",2),G([m({offset:72,type:"uint8",size:8})],R.prototype,"ulCodePageRange",2),G([m({offset:72,type:"int16"})],R.prototype,"sxHeight",2),G([m("int16")],R.prototype,"sCapHeight",2),G([m("uint16")],R.prototype,"usDefaultChar",2),G([m("uint16")],R.prototype,"usBreakChar",2),G([m("uint16")],R.prototype,"usMaxContext",2),R=G([dt("OS/2","os2")],R);var yo=Object.defineProperty,mo=Object.getOwnPropertyDescriptor,Gt=(n,t,e,r)=>{for(var i=r>1?void 0:r?mo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&yo(t,e,i),i};let $t=class extends gt{constructor(n=new ArrayBuffer(32),t,e){super(n,t,e)}};Gt([m("fixed")],$t.prototype,"format",2),Gt([m("fixed")],$t.prototype,"italicAngle",2),Gt([m("int16")],$t.prototype,"underlinePosition",2),Gt([m("int16")],$t.prototype,"underlineThickness",2),Gt([m("uint32")],$t.prototype,"isFixedPitch",2),Gt([m("uint32")],$t.prototype,"minMemType42",2),Gt([m("uint32")],$t.prototype,"maxMemType42",2),Gt([m("uint32")],$t.prototype,"minMemType1",2),Gt([m("uint32")],$t.prototype,"maxMemType1",2),$t=Gt([dt("post")],$t);var xo=Object.defineProperty,vo=Object.getOwnPropertyDescriptor,St=(n,t,e,r)=>{for(var i=r>1?void 0:r?vo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&xo(t,e,i),i};let xt=class extends gt{constructor(n=new ArrayBuffer(36),t){super(n,t,Math.min(36,n.byteLength-(t??0)))}};St([m("fixed")],xt.prototype,"version",2),St([m("int16")],xt.prototype,"vertTypoAscender",2),St([m("int16")],xt.prototype,"vertTypoDescender",2),St([m("int16")],xt.prototype,"vertTypoLineGap",2),St([m("int16")],xt.prototype,"advanceHeightMax",2),St([m("int16")],xt.prototype,"minTopSideBearing",2),St([m("int16")],xt.prototype,"minBottomSideBearing",2),St([m("int16")],xt.prototype,"yMaxExtent",2),St([m("int16")],xt.prototype,"caretSlopeRise",2),St([m("int16")],xt.prototype,"caretSlopeRun",2),St([m("int16")],xt.prototype,"caretOffset",2),St([m({type:"int16",size:4})],xt.prototype,"reserved",2),St([m("int16")],xt.prototype,"metricDataFormat",2),St([m("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=St([dt("vhea")],xt);var wo=Object.getOwnPropertyDescriptor,bo=(n,t,e,r)=>{for(var i=r>1?void 0:r?wo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let Gn=class extends gt{static from(n){const t=n.length*4,e=new Gn(new ArrayBuffer(t));return n.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const n=this._sfnt.maxp.numGlyphs,t=this._sfnt.vhea?.numOfLongVerMetrics??0,e=this.view;e.seek(0);let r=0;return Array.from({length:n}).map((i,o)=>(o<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};Gn=bo([dt("vmtx")],Gn);var So=Object.defineProperty,$e=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&So(t,e,i),i};class qt extends Dn{format="TrueType";mimeType="font/ttf";_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ye(t).getUint32(0))}static checksum(t){const e=ye(t);let r=e.byteLength;for(;r%4;)r++;let i=0;for(let o=0,s=r/4;o<s;o+=4)o*4<r-4&&(i+=e.getUint32(o*4,!1));return i&4294967295}static from(t){const e=h=>h+3&-4,r=t.tableViews.size,i=Array.from(t.tableViews.values()).reduce((h,f)=>h+e(f.byteLength),0),o=new this(new ArrayBuffer(12+r*16+i));o.scalerType=65536,o.numTables=r;const s=Math.log(2);o.searchRange=Math.floor(Math.log(r)/s)*16,o.entrySelector=Math.floor(o.searchRange/s),o.rangeShift=r*16-o.searchRange;let a=12+r*16,l=0;const c=o.getDirectories();t.tableViews.forEach((h,f)=>{const g=c[l++];g.tag=f,g.checkSum=this.checksum(h),g.offset=a,g.length=h.byteLength,o.view.writeBytes(h,a),a+=e(g.length)});const u=o.createSFNT().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Ie(this.view.buffer,t);return t+=e.view.byteLength,e})}createSFNT(){return new Kt(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e([m("uint32")],qt.prototype,"scalerType"),$e([m("uint16")],qt.prototype,"numTables"),$e([m("uint16")],qt.prototype,"searchRange"),$e([m("uint16")],qt.prototype,"entrySelector"),$e([m("uint16")],qt.prototype,"rangeShift");class qn extends qt{format="OpenType";mimeType="font/otf";static signature=new Set([1330926671]);static from(t){return super.from(t)}}var Co=Object.defineProperty,ze=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Co(t,e,i),i};class we extends It{constructor(t,e){super(t,e,20)}}ze([m({type:"char",size:4})],we.prototype,"tag"),ze([m("uint32")],we.prototype,"offset"),ze([m("uint32")],we.prototype,"compLength"),ze([m("uint32")],we.prototype,"origLength"),ze([m("uint32")],we.prototype,"origChecksum");var Mo=Object.defineProperty,Ot=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Mo(t,e,i),i};const Pt=class dr extends Dn{format="WOFF";mimeType="font/woff";get subfontFormat(){return qt.is(this.flavor)?"TrueType":qn.is(this.flavor)?"OpenType":"Open"}_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([2001684038]);static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ye(t).getUint32(0))}static checkSum(t){const e=ye(t),r=e.byteLength,i=Math.floor(r/4);let o=0,s=0;for(;s<i;)o+=e.getUint32(4*s++,!1);let a=r-i*4;if(a){let l=i*4;for(;a>0;)o+=e.getUint8(l)<<a*8,l++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=h=>h+3&-4,i=[];t.tableViews.forEach((h,f)=>{const g=ye(fs(new Uint8Array(h.buffer,h.byteOffset,h.byteLength)));i.push({tag:f,view:g.byteLength<h.byteLength?g:h,rawView:h})});const o=i.length,s=i.reduce((h,f)=>h+r(f.view.byteLength),0),a=new dr(new ArrayBuffer(44+20*o+s+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSFNTSize=12+16*o+i.reduce((h,f)=>h+r(f.rawView.byteLength),0);let l=44+o*20,c=0;const u=a.getDirectories();return i.forEach(h=>{const f=u[c++];f.tag=h.tag,f.offset=l,f.compLength=h.view.byteLength,f.origChecksum=dr.checkSum(h.rawView),f.origLength=h.rawView.byteLength,a.view.writeBytes(h.view,l),l+=r(f.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new we(this.view.buffer,t);return t+=e.view.byteLength,e})}createSFNT(){return new Kt(this.getDirectories().reduce((t,e)=>{const r=e.tag,i=this.view.byteOffset+e.offset,o=e.compLength,s=e.origLength,a=i+o;return t[r]=o>=s?new DataView(this.view.buffer,i,o):new DataView(ps(new Uint8Array(this.view.buffer.slice(i,a))).buffer),t},{}))}};Ot([m("uint32")],Pt.prototype,"signature"),Ot([m("uint32")],Pt.prototype,"flavor"),Ot([m("uint32")],Pt.prototype,"length"),Ot([m("uint16")],Pt.prototype,"numTables"),Ot([m("uint16")],Pt.prototype,"reserved"),Ot([m("uint32")],Pt.prototype,"totalSFNTSize"),Ot([m("uint16")],Pt.prototype,"majorVersion"),Ot([m("uint16")],Pt.prototype,"minorVersion"),Ot([m("uint32")],Pt.prototype,"metaOffset"),Ot([m("uint32")],Pt.prototype,"metaLength"),Ot([m("uint32")],Pt.prototype,"metaOrigLength"),Ot([m("uint32")],Pt.prototype,"privOffset"),Ot([m("uint32")],Pt.prototype,"privLength");let Wn=Pt;function Po(n,t=!0){if(qt.is(n))return new qt(n);if(qn.is(n))return new qn(n);if(Wn.is(n))return new Wn(n);if(t)throw new Error("Failed to parseFont")}function _o(n,t=!0){const e=Po(n,!1);if(e)return e;if(t)throw new Error("Failed to parseFont")}class Hn{static defaultRequestInit={cache:"force-cache"};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(t){this.fallbackFont=t}async loadFallbackFont(t,e={}){this.fallbackFont=await this.load(t,e)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...Hn.defaultRequestInit,...e,signal:r.signal}).then(i=>i.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
|
|
1
|
+
(function(H,te){typeof exports=="object"&&typeof module<"u"?te(exports):typeof define=="function"&&define.amd?define(["exports"],te):(H=typeof globalThis<"u"?globalThis:H||self,te(H.modernText={}))})(this,(function(H){"use strict";function te(n,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:i,x1:o,y1:s,stops:a}=rs(t,e.left,e.top,e.width,e.height),l=n.createLinearGradient(r,i,o,s);return a.forEach(c=>l.addColorStop(c.offset,c.color)),l}return t}function _e(n,t,e){n?.color&&(n.color=te(e,n.color,t)),n?.backgroundColor&&(n.backgroundColor=te(e,n.backgroundColor,t)),n?.textStrokeColor&&(n.textStrokeColor=te(e,n.textStrokeColor,t))}function rs(n,t,e,r,i){const o=n.match(/linear-gradient\((.+)\)$/)?.[1]??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),u=(Number(a.replace("deg",""))||0)*Math.PI/180,h=r*Math.sin(u),p=i*Math.cos(u);return{x0:t+r/2-h,y0:e+i/2+p,x1:t+r/2+h,y1:e+i/2-p,stops:Array.from(l).map(g=>{let f=g[2];return f.startsWith("(")?f=f.split(",").length>3?`rgba${f}`:`rgb${f}`:f=`#${f}`,{offset:Number(g[3].replace("%",""))/100,color:f}})}}function he(n){const{ctx:t,path:e,fontSize:r,clipRect:i}=n;t.save(),t.beginPath();const o=e.style,s={...o,fill:n.color??o.fill,stroke:n.textStrokeColor??o.stroke,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*r:o.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round",shadowOffsetX:(n.shadowOffsetX??0)*r,shadowOffsetY:(n.shadowOffsetY??0)*r,shadowBlur:(n.shadowBlur??0)*r,shadowColor:n.shadowColor};i&&(t.rect(i.left,i.top,i.width,i.height),t.clip(),t.beginPath()),e.drawTo(t,s),t.restore()}function yr(n,t,e){const{left:r,top:i,width:o,height:s}=e,a=n.canvas;a.dataset.viewBox=`${r} ${i} ${o} ${s}`,a.dataset.pixelRatio=String(t);const l=o,c=s;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(c*t)),a.style.width=`${l}px`,a.style.height=`${c}px`,n.clearRect(0,0,a.width,a.height),n.scale(t,t),n.translate(-r,-i)}function mr(n,t){const{paragraphs:e,computedStyle:r,glyphBox:i}=t;_e(r,i,n),e.forEach(o=>{_e(o.computedStyle,o.lineBox,n),o.fragments.forEach(s=>{_e(s.computedStyle,s.inlineBox,n)})})}var ut=Uint8Array,At=Uint16Array,_n=Int32Array,Xe=new ut([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]),Ze=new ut([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]),Tn=new ut([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xr=function(n,t){for(var e=new At(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var i=new _n(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)i[o]=o-e[r]<<5|r;return{b:e,r:i}},vr=xr(Xe,2),wr=vr.b,kn=vr.r;wr[28]=258,kn[258]=28;for(var br=xr(Ze,0),is=br.b,Sr=br.r,An=new At(32768),K=0;K<32768;++K){var ee=(K&43690)>>1|(K&21845)<<1;ee=(ee&52428)>>2|(ee&13107)<<2,ee=(ee&61680)>>4|(ee&3855)<<4,An[K]=((ee&65280)>>8|(ee&255)<<8)>>1}for(var Rt=(function(n,t,e){for(var r=n.length,i=0,o=new At(t);i<r;++i)n[i]&&++o[n[i]-1];var s=new At(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(e){a=new At(1<<t);var l=15-t;for(i=0;i<r;++i)if(n[i])for(var c=i<<4|n[i],u=t-n[i],h=s[n[i]-1]++<<u,p=h|(1<<u)-1;h<=p;++h)a[An[h]>>l]=c}else for(a=new At(r),i=0;i<r;++i)n[i]&&(a[i]=An[s[n[i]-1]++]>>15-n[i]);return a}),ne=new ut(288),K=0;K<144;++K)ne[K]=8;for(var K=144;K<256;++K)ne[K]=9;for(var K=256;K<280;++K)ne[K]=7;for(var K=280;K<288;++K)ne[K]=8;for(var Te=new ut(32),K=0;K<32;++K)Te[K]=5;var ss=Rt(ne,9,0),os=Rt(ne,9,1),as=Rt(Te,5,0),ls=Rt(Te,5,1),On=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},Ut=function(n,t,e){var r=t/8|0;return(n[r]|n[r+1]<<8)>>(t&7)&e},In=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},En=function(n){return(n+7)/8|0},Cr=function(n,t,e){return(e==null||e>n.length)&&(e=n.length),new ut(n.subarray(t,e))},cs=["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"],Lt=function(n,t,e){var r=new Error(t||cs[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Lt),!e)throw r;return r},hs=function(n,t,e,r){var i=n.length,o=0;if(!i||t.f&&!t.l)return e||new ut(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new ut(i*3));var c=function(Pt){var Tt=e.length;if(Pt>Tt){var ht=new ut(Math.max(Tt*2,Pt));ht.set(e),e=ht}},u=t.f||0,h=t.p||0,p=t.b||0,g=t.l,f=t.d,y=t.m,d=t.n,P=i*8;do{if(!g){u=Ut(n,h,1);var M=Ut(n,h+1,3);if(h+=3,M)if(M==1)g=os,f=ls,y=9,d=5;else if(M==2){var x=Ut(n,h,31)+257,S=Ut(n,h+10,15)+4,b=x+Ut(n,h+5,31)+1;h+=14;for(var D=new ut(b),N=new ut(19),E=0;E<S;++E)N[Tn[E]]=Ut(n,h+E*3,7);h+=S*3;for(var F=On(N),z=(1<<F)-1,B=Rt(N,F,1),E=0;E<b;){var A=B[Ut(n,h,z)];h+=A&15;var w=A>>4;if(w<16)D[E++]=w;else{var W=0,O=0;for(w==16?(O=3+Ut(n,h,3),h+=2,W=D[E-1]):w==17?(O=3+Ut(n,h,7),h+=3):w==18&&(O=11+Ut(n,h,127),h+=7);O--;)D[E++]=W}}var L=D.subarray(0,x),j=D.subarray(x);y=On(L),d=On(j),g=Rt(L,y,1),f=Rt(j,d,1)}else Lt(1);else{var w=En(h)+4,C=n[w-4]|n[w-3]<<8,v=w+C;if(v>i){l&&Lt(0);break}a&&c(p+C),e.set(n.subarray(w,v),p),t.b=p+=C,t.p=h=v*8,t.f=u;continue}if(h>P){l&&Lt(0);break}}a&&c(p+131072);for(var I=(1<<y)-1,V=(1<<d)-1,T=h;;T=h){var W=g[In(n,h)&I],_=W>>4;if(h+=W&15,h>P){l&&Lt(0);break}if(W||Lt(2),_<256)e[p++]=_;else if(_==256){T=h,g=null;break}else{var U=_-254;if(_>264){var E=_-257,$=Xe[E];U=Ut(n,h,(1<<$)-1)+wr[E],h+=$}var q=f[In(n,h)&V],Z=q>>4;q||Lt(3),h+=q&15;var j=is[Z];if(Z>3){var $=Ze[Z];j+=In(n,h)&(1<<$)-1,h+=$}if(h>P){l&&Lt(0);break}a&&c(p+131072);var nt=p+U;if(p<j){var Zt=o-j,Dt=Math.min(j,nt);for(Zt+p<0&&Lt(3);p<Dt;++p)e[p]=r[Zt+p]}for(;p<nt;++p)e[p]=e[p-j]}}t.l=g,t.p=T,t.b=p,t.f=u,g&&(u=1,t.m=y,t.d=f,t.n=d)}while(!u);return p!=e.length&&s?Cr(e,0,p):e.subarray(0,p)},Yt=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8},ke=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8,n[r+2]|=e>>16},Bn=function(n,t){for(var e=[],r=0;r<n.length;++r)n[r]&&e.push({s:r,f:n[r]});var i=e.length,o=e.slice();if(!i)return{t:Tr,l:0};if(i==1){var s=new ut(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,x){return v.f-x.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],c=0,u=1,h=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=e[e[c].f<e[h].f?c++:h++],l=e[c!=u&&e[c].f<e[h].f?c++:h++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};for(var p=o[0].s,r=1;r<i;++r)o[r].s>p&&(p=o[r].s);var g=new At(p+1),f=Dn(e[u-1],g,0);if(f>t){var r=0,y=0,d=f-t,P=1<<d;for(o.sort(function(x,S){return g[S.s]-g[x.s]||x.f-S.f});r<i;++r){var M=o[r].s;if(g[M]>t)y+=P-(1<<f-g[M]),g[M]=t;else break}for(y>>=d;y>0;){var w=o[r].s;g[w]<t?y-=1<<t-g[w]++-1:++r}for(;r>=0&&y;--r){var C=o[r].s;g[C]==t&&(--g[C],++y)}f=t}return{t:new ut(g),l:f}},Dn=function(n,t,e){return n.s==-1?Math.max(Dn(n.l,t,e+1),Dn(n.r,t,e+1)):t[n.s]=e},Pr=function(n){for(var t=n.length;t&&!n[--t];);for(var e=new At(++t),r=0,i=n[0],o=1,s=function(l){e[r++]=l},a=1;a<=t;++a)if(n[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=n[a]}return{c:e.subarray(0,r),n:t}},Ae=function(n,t){for(var e=0,r=0;r<t.length;++r)e+=n[r]*t[r];return e},Mr=function(n,t,e){var r=e.length,i=En(t+2);n[i]=r&255,n[i+1]=r>>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var o=0;o<r;++o)n[i+o+4]=e[o];return(i+4+r)*8},_r=function(n,t,e,r,i,o,s,a,l,c,u){Yt(t,u++,e),++i[256];for(var h=Bn(i,15),p=h.t,g=h.l,f=Bn(o,15),y=f.t,d=f.l,P=Pr(p),M=P.c,w=P.n,C=Pr(y),v=C.c,x=C.n,S=new At(19),b=0;b<M.length;++b)++S[M[b]&31];for(var b=0;b<v.length;++b)++S[v[b]&31];for(var D=Bn(S,7),N=D.t,E=D.l,F=19;F>4&&!N[Tn[F-1]];--F);var z=c+5<<3,B=Ae(i,ne)+Ae(o,Te)+s,A=Ae(i,p)+Ae(o,y)+s+14+3*F+Ae(S,N)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&z<=B&&z<=A)return Mr(t,u,n.subarray(l,l+c));var W,O,L,j;if(Yt(t,u,1+(A<B)),u+=2,A<B){W=Rt(p,g,0),O=p,L=Rt(y,d,0),j=y;var I=Rt(N,E,0);Yt(t,u,w-257),Yt(t,u+5,x-1),Yt(t,u+10,F-4),u+=14;for(var b=0;b<F;++b)Yt(t,u+3*b,N[Tn[b]]);u+=3*F;for(var V=[M,v],T=0;T<2;++T)for(var _=V[T],b=0;b<_.length;++b){var U=_[b]&31;Yt(t,u,I[U]),u+=N[U],U>15&&(Yt(t,u,_[b]>>5&127),u+=_[b]>>12)}}else W=ss,O=ne,L=as,j=Te;for(var b=0;b<a;++b){var $=r[b];if($>255){var U=$>>18&31;ke(t,u,W[U+257]),u+=O[U+257],U>7&&(Yt(t,u,$>>23&31),u+=Xe[U]);var q=$&31;ke(t,u,L[q]),u+=j[q],q>3&&(ke(t,u,$>>5&8191),u+=Ze[q])}else ke(t,u,W[$]),u+=O[$]}return ke(t,u,W[256]),u+O[256]},us=new _n([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Tr=new ut(0),fs=function(n,t,e,r,i,o){var s=o.z||n.length,a=new ut(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),c=o.l,u=(o.r||0)&7;if(t){u&&(l[0]=o.r>>3);for(var h=us[t-1],p=h>>13,g=h&8191,f=(1<<e)-1,y=o.p||new At(32768),d=o.h||new At(f+1),P=Math.ceil(e/3),M=2*P,w=function(kt){return(n[kt]^n[kt+1]<<P^n[kt+2]<<M)&f},C=new _n(25e3),v=new At(288),x=new At(32),S=0,b=0,D=o.i||0,N=0,E=o.w||0,F=0;D+2<s;++D){var z=w(D),B=D&32767,A=d[z];if(y[B]=A,d[z]=B,E<=D){var W=s-D;if((S>7e3||N>24576)&&(W>423||!c)){u=_r(n,l,0,C,v,x,b,N,F,D-F,u),N=S=b=0,F=D;for(var O=0;O<286;++O)v[O]=0;for(var O=0;O<30;++O)x[O]=0}var L=2,j=0,I=g,V=B-A&32767;if(W>2&&z==w(D-V))for(var T=Math.min(p,W)-1,_=Math.min(32767,D),U=Math.min(258,W);V<=_&&--I&&B!=A;){if(n[D+L]==n[D+L-V]){for(var $=0;$<U&&n[D+$]==n[D+$-V];++$);if($>L){if(L=$,j=V,$>T)break;for(var q=Math.min(V,$-2),Z=0,O=0;O<q;++O){var nt=D-V+O&32767,Zt=y[nt],Dt=nt-Zt&32767;Dt>Z&&(Z=Dt,A=nt)}}}B=A,A=y[B],V+=B-A&32767}if(j){C[N++]=268435456|kn[L]<<18|Sr[j];var Pt=kn[L]&31,Tt=Sr[j]&31;b+=Xe[Pt]+Ze[Tt],++v[257+Pt],++x[Tt],E=D+L,++S}else C[N++]=n[D],++v[n[D]]}}for(D=Math.max(D,E);D<s;++D)C[N++]=n[D],++v[n[D]];u=_r(n,l,c,C,v,x,b,N,F,D-F,u),c||(o.r=u&7|l[u/8|0]<<3,u-=7,o.h=d,o.p=y,o.i=D,o.w=E)}else{for(var D=o.w||0;D<s+c;D+=65535){var ht=D+65535;ht>=s&&(l[u/8|0]=c,ht=s),u=Mr(l,u+1,n.subarray(D,ht))}o.i=s}return Cr(a,0,r+En(u)+i)},kr=function(){var n=1,t=0;return{p:function(e){for(var r=n,i=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)i+=r+=e[s];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}n=r,t=i},d:function(){return n%=65521,t%=65521,(n&255)<<24|(n&65280)<<8|(t&255)<<8|t>>8}}},ps=function(n,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ut(o.length+n.length);s.set(o),s.set(n,o.length),n=s,i.w=o.length}return fs(n,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+t.mem,e,r,i)},Ar=function(n,t,e){for(;e;++t)n[t]=e,e>>>=8},ds=function(n,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(n[0]=120,n[1]=r<<6|(t.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,t.dictionary){var i=kr();i.p(t.dictionary),Ar(n,2,i.d())}},gs=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Lt(6,"invalid zlib data"),(n[1]>>5&1)==1&&Lt(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function ys(n,t){t||(t={});var e=kr();e.p(n);var r=ps(n,t,t.dictionary?6:2,4);return ds(r,t),Ar(r,r.length-4,e.d()),r}function ms(n,t){return hs(n.subarray(gs(n),-4),{i:2},t,t)}var xs=typeof TextDecoder<"u"&&new TextDecoder,vs=0;try{xs.decode(Tr,{stream:!0}),vs=1}catch{}const ws="modern-font";function Oe(n,t){if(!n)throw new Error(`[${ws}] ${t}`)}function bs(n){if("buffer"in n){const t=n.buffer;return n.byteOffset>0||n.byteLength<n.buffer.byteLength?t.slice(n.byteOffset,n.byteOffset+n.byteLength):t}else return n}function ye(n){return"buffer"in n?new DataView(n.buffer,n.byteOffset,n.byteLength):new DataView(n)}function Ss(n){let t="";for(let e=0,r=n.length,i;e<r;e++)i=n.charCodeAt(e),i!==0&&(t+=String.fromCharCode(i));return t}function Ye(n){n=Ss(n);const t=[];for(let e=0,r=n.length,i;e<r;e++)i=n.charCodeAt(e),t.push(i>>8),t.push(i&255);return t}function Cs(n){let t="";for(let e=0,r=n.length;e<r;e++)n[e]<127?t+=String.fromCharCode(n[e]):t+=`%${(256+n[e]).toString(16).slice(1)}`;return unescape(t)}function Ps(n){let t="";for(let e=0,r=n.length;e<r;e+=2)t+=String.fromCharCode((n[e]<<8)+n[e+1]);return t}var Ms=Object.defineProperty,ft=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ms(t,e,i),i};const Ke={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(n,t){Object.defineProperty(n.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 lt extends DataView{constructor(t,e,r,i){super(bs(t),e,r),this.littleEndian=i}cursor=0;readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,i)=>this.read(t.type,t.offset+i));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,i)=>{this.write(t.type,e[i],t.offset+i)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const i=`get${t.replace(/^\S/,l=>l.toUpperCase())}`,o=this,a=o[i]?.bind(o)?.(e,r);return this.cursor+=Ke[t],a}readUint24(t=this.cursor){const[e,r,i]=this.readBytes(t,3);return(e<<16)+(r<<8)+i}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let i=0;i<e;++i)r.push(this.getUint8(t+i));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let i="";for(let o=0,s=r.length;o<s;o++)i+=String.fromCharCode(r[o]);return i}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),i=new Date;return i.setTime(r*1e3+-20775456e5),i}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,i=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const o=`set${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,l=s[o]?.bind(s)?.(r,e,i);return this.cursor+=Ke[t.toLowerCase()],l}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let i=0,o=t.length,s;i<o;++i)s=t.charCodeAt(i)||0,s>127?this.writeUint16(s):this.writeUint8(s);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const i=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(i,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let i=0;i<r;++i)this.setUint8(e+i,t[i])}else{const i=ye(t);r=i.byteLength;for(let o=0;o<r;++o)this.setUint8(e+o,i.getUint8(o))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}ft([pt()],lt.prototype,"readInt8"),ft([pt()],lt.prototype,"readInt16"),ft([pt()],lt.prototype,"readInt32"),ft([pt()],lt.prototype,"readUint8"),ft([pt()],lt.prototype,"readUint16"),ft([pt()],lt.prototype,"readUint32"),ft([pt()],lt.prototype,"readFloat32"),ft([pt()],lt.prototype,"readFloat64"),ft([pt()],lt.prototype,"writeInt8"),ft([pt()],lt.prototype,"writeInt16"),ft([pt()],lt.prototype,"writeInt32"),ft([pt()],lt.prototype,"writeUint8"),ft([pt()],lt.prototype,"writeUint16"),ft([pt()],lt.prototype,"writeUint32"),ft([pt()],lt.prototype,"writeFloat32"),ft([pt()],lt.prototype,"writeFloat64");const Or=new WeakMap;function m(n){const t=typeof n=="object"?n:{type:n},{size:e=1,type:r}=t;return(i,o)=>{if(typeof o!="string")return;let s=Or.get(i);s||(s={columns:[],byteLength:0},Or.set(i,s));const a={...t,name:o,byteLength:e*Ke[r],offset:t.offset??s.columns.reduce((l,c)=>l+c.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,c)=>l+Ke[c.type]*(c.size??1),0),Object.defineProperty(i.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class It{view;constructor(t,e,r,i){this.view=new lt(t,e,r,i)}}class Fn extends It{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 _s=Object.defineProperty,vt=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&_s(t,e,i),i};const wt=class Ji extends Fn{format="EmbeddedOpenType";mimeType="application/vnd.ms-fontobject";static from(t){const e=t.sfnt,i=e.name.names,o=Ye(i.fontFamily||""),s=o.length,a=Ye(i.fontStyle||""),l=a.length,c=Ye(i.version||""),u=c.length,h=Ye(i.fullName||""),p=h.length,g=86+s+4+l+4+u+4+p+2+t.view.byteLength,f=new Ji(new ArrayBuffer(g),0,g,!0);f.EOTSize=f.view.byteLength,f.FontDataSize=t.view.byteLength,f.Version=131073,f.Flags=0,f.Charset=1,f.MagicNumber=20556,f.Padding1=0,f.CheckSumAdjustment=e.head.checkSumAdjustment;const y=e.os2;return y&&(f.FontPANOSE=y.fontPANOSE,f.Italic=y.fsSelection,f.Weight=y.usWeightClass,f.fsType=y.fsType,f.UnicodeRange=y.ulUnicodeRange,f.CodePageRange=y.ulCodePageRange),f.view.writeUint16(s),f.view.writeBytes(o),f.view.writeUint16(0),f.view.writeUint16(l),f.view.writeBytes(a),f.view.writeUint16(0),f.view.writeUint16(u),f.view.writeBytes(c),f.view.writeUint16(0),f.view.writeUint16(p),f.view.writeBytes(h),f.view.writeUint16(0),f.view.writeUint16(0),f.view.writeBytes(t.view),f}};vt([m("uint32")],wt.prototype,"EOTSize"),vt([m("uint32")],wt.prototype,"FontDataSize"),vt([m("uint32")],wt.prototype,"Version"),vt([m("uint32")],wt.prototype,"Flags"),vt([m({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),vt([m("uint8")],wt.prototype,"Charset"),vt([m("uint8")],wt.prototype,"Italic"),vt([m("uint32")],wt.prototype,"Weight"),vt([m("uint16")],wt.prototype,"fsType"),vt([m("uint16")],wt.prototype,"MagicNumber"),vt([m({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),vt([m({type:"uint8",size:8})],wt.prototype,"CodePageRange"),vt([m("uint32")],wt.prototype,"CheckSumAdjustment"),vt([m({type:"uint8",size:16})],wt.prototype,"Reserved"),vt([m("uint16")],wt.prototype,"Padding1");var Ts=Object.defineProperty,Qe=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ts(t,e,i),i};class Ie extends It{constructor(t,e){super(t,e,16)}}Qe([m({type:"char",size:4})],Ie.prototype,"tag"),Qe([m("uint32")],Ie.prototype,"checkSum"),Qe([m("uint32")],Ie.prototype,"offset"),Qe([m("uint32")],Ie.prototype,"length");const Un=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],ks=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class Ir{index;name;isComposite=!1;components=[];pathCommands=[];constructor(t){const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,i={},o){const s=1/(o?.unitsPerEm??1e3)*r,{xScale:a=s,yScale:l=s}=i,c=this.pathCommands,u=[];for(let h=0,p=c.length;h<p;h+=1){const g=c[h];g.type==="M"?u.push({type:"M",x:t+g.x*a,y:e+-g.y*l}):g.type==="L"?u.push({type:"L",x:t+g.x*a,y:e+-g.y*l}):g.type==="Q"?u.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="C"?u.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*l,x2:t+g.x2*a,y2:e+-g.y2*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="Z"&&u.push({type:"Z"})}return u}}class As extends Ir{parse(t,e,r){const i=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=t,c=t.topDict.paintType,u=this.index;let h,p,g,f;const y=[],d=[];let P=0,M=!1,w=!1,C=s,v=0,x=0;function S(B,A){y.push({type:"L",x:B,y:A})}function b(B,A,W,O,L,j){y.push({type:"C",x1:B,y1:A,x2:W,y2:O,x:L,y:j})}function D(B,A){w&&c!==2&&N(),w=!0,y.push({type:"M",x:B,y:A})}function N(){y.push({type:"Z"})}function E(B){y.push(...B)}function F(){d.length%2!==0&&!M&&(C=d.shift()+o),P+=d.length>>1,d.length=0,M=!0}function z(B){let A,W,O,L,j,I,V,T,_,U,$,q,Z=0;for(;Z<B.length;){let nt=B[Z++];switch(nt){case 1:F();break;case 3:F();break;case 4:d.length>1&&!M&&(C=d.shift()+o,M=!0),x+=d.pop(),D(v,x);break;case 5:for(;d.length>0;)v+=d.shift(),x+=d.shift(),S(v,x);break;case 6:for(;d.length>0&&(v+=d.shift(),S(v,x),d.length!==0);)x+=d.shift(),S(v,x);break;case 7:for(;d.length>0&&(x+=d.shift(),S(v,x),d.length!==0);)v+=d.shift(),S(v,x);break;case 8:for(;d.length>0;)h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+d.shift(),b(h,p,g,f,v,x);break;case 10:j=d.pop()+l,I=t.subrs[j],I&&z(I);break;case 11:return;case 12:switch(nt=B[Z],Z+=1,nt){case 35:h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),V=g+d.shift(),T=f+d.shift(),_=V+d.shift(),U=T+d.shift(),$=_+d.shift(),q=U+d.shift(),v=$+d.shift(),x=q+d.shift(),d.shift(),b(h,p,g,f,V,T),b(_,U,$,q,v,x);break;case 34:h=v+d.shift(),p=x,g=h+d.shift(),f=p+d.shift(),V=g+d.shift(),T=f,_=V+d.shift(),U=f,$=_+d.shift(),q=x,v=$+d.shift(),b(h,p,g,f,V,T),b(_,U,$,q,v,x);break;case 36:h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),V=g+d.shift(),T=f,_=V+d.shift(),U=f,$=_+d.shift(),q=U+d.shift(),v=$+d.shift(),b(h,p,g,f,V,T),b(_,U,$,q,v,x);break;case 37:h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),V=g+d.shift(),T=f+d.shift(),_=V+d.shift(),U=T+d.shift(),$=_+d.shift(),q=U+d.shift(),Math.abs($-v)>Math.abs(q-x)?v=$+d.shift():x=q+d.shift(),b(h,p,g,f,V,T),b(_,U,$,q,v,x);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+nt}`),d.length=0}break;case 14:if(d.length>=4){const Zt=Un[d.pop()],Dt=Un[d.pop()],Pt=d.pop(),Tt=d.pop();if(Zt&&Dt){i.isComposite=!0,i.components=[];const ht=t.charset.indexOf(Zt),kt=t.charset.indexOf(Dt);i.components.push({glyphIndex:kt,dx:0,dy:0}),i.components.push({glyphIndex:ht,dx:Tt,dy:Pt}),E(r.get(kt).pathCommands);const Vt=JSON.parse(JSON.stringify(r.get(ht).pathCommands));for(let jt=0;jt<Vt.length;jt+=1){const Ft=Vt[jt];Ft.type!=="Z"&&(Ft.x+=Tt,Ft.y+=Pt),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Tt,Ft.y1+=Pt),Ft.type==="C"&&(Ft.x2+=Tt,Ft.y2+=Pt)}E(Vt)}}else d.length>0&&!M&&(C=d.shift()+o,M=!0);w&&c!==2&&(N(),w=!1);break;case 18:F();break;case 19:case 20:F(),Z+=P+7>>3;break;case 21:d.length>2&&!M&&(C=d.shift()+o,M=!0),x+=d.pop(),v+=d.pop(),D(v,x);break;case 22:d.length>1&&!M&&(C=d.shift()+o,M=!0),v+=d.pop(),D(v,x);break;case 23:F();break;case 24:for(;d.length>2;)h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+d.shift(),b(h,p,g,f,v,x);v+=d.shift(),x+=d.shift(),S(v,x);break;case 25:for(;d.length>6;)v+=d.shift(),x+=d.shift(),S(v,x);h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+d.shift(),b(h,p,g,f,v,x);break;case 26:for(d.length%2&&(v+=d.shift());d.length>0;)h=v,p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g,x=f+d.shift(),b(h,p,g,f,v,x);break;case 27:for(d.length%2&&(x+=d.shift());d.length>0;)h=v+d.shift(),p=x,g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f,b(h,p,g,f,v,x);break;case 28:A=B[Z],W=B[Z+1],d.push((A<<24|W<<16)>>16),Z+=2;break;case 29:j=d.pop()+a,I=t.gsubrs[j],I&&z(I);break;case 30:for(;d.length>0&&(h=v,p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+(d.length===1?d.shift():0),b(h,p,g,f,v,x),d.length!==0);)h=v+d.shift(),p=x,g=h+d.shift(),f=p+d.shift(),x=f+d.shift(),v=g+(d.length===1?d.shift():0),b(h,p,g,f,v,x);break;case 31:for(;d.length>0&&(h=v+d.shift(),p=x,g=h+d.shift(),f=p+d.shift(),x=f+d.shift(),v=g+(d.length===1?d.shift():0),b(h,p,g,f,v,x),d.length!==0);)h=v,p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+(d.length===1?d.shift():0),b(h,p,g,f,v,x);break;default:nt<32?console.warn(`Glyph ${u}: unknown operator ${nt}`):nt<247?d.push(nt-139):nt<251?(A=B[Z],Z+=1,d.push((nt-247)*256+A+108)):nt<255?(A=B[Z],Z+=1,d.push(-(nt-251)*256-A-108)):(A=B[Z],W=B[Z+1],O=B[Z+2],L=B[Z+3],Z+=4,d.push((A<<24|W<<16|O<<8|L)/65536))}}}z(e),this.pathCommands=y,M&&(this.advanceWidth=C)}}class Er{constructor(t){this._sfnt=t}_items=[];get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const i=this._sfnt.hmtx.metrics[t];i&&(r.advanceWidth=r.advanceWidth||i.advanceWidth,r.leftSideBearing=r.leftSideBearing||i.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??=o[0],r.unicodes??=o),this._items[t]=r}return r}}class Os extends Er{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new As({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Is=Object.defineProperty,Br=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Is(t,e,i),i};class Je extends It{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(t,e,r,i){super(t,e,r,i),this._init()}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const i=[];for(let o=0,s=e+1;o<s;o++){const a=this.view;let l=0;for(let c=0;c<r;c++)l<<=8,l+=a.readUint8();i.push(l)}return i}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,i=r+e[t],s=r+e[t+1]-i;return this._isString?this.view.readString(i,s):this.view.readBytes(i,s)}}Br([m("uint16")],Je.prototype,"count"),Br([m("uint8")],Je.prototype,"offsetSize");class tn extends Je{_isString=!1}class Dr extends Je{_isString=!0}const Es=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Bs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Ds=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Fs=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function en(n,t){return t<=390?Es[t]:n[t-391]}function Q(n,t="number",e){return(r,i)=>{if(typeof i!="string")return;const o={type:t,operator:n,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,i,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class Fr extends It{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),s=o>>4,a=o&15;if(s===r||(e+=i[s],a===r))break;e+=i[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,i,o,s;if(t===28)return r=e.readUint8(),i=e.readUint8(),r<<8|i;if(t===29)return r=e.readUint8(),i=e.readUint8(),o=e.readUint8(),s=e.readUint8(),r<<24|i<<16|o<<8|s;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,i={};for(;t.cursor<r;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),i[o]=e,e=[]):e.push(this._readOperand(o))}return i}_getProp(t){const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return en(this._stringIndex?.objects??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Us=Object.defineProperty,Ln=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Us(t,e,i),i};class nn extends Fr{}Ln([Q(19)],nn.prototype,"subrs"),Ln([Q(20)],nn.prototype,"defaultWidthX"),Ln([Q(21)],nn.prototype,"nominalWidthX");var Ls=Object.defineProperty,rt=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ls(t,e,i),i};class et extends Fr{}rt([Q(0,"string")],et.prototype,"version"),rt([Q(1,"string")],et.prototype,"notice"),rt([Q(1200,"string")],et.prototype,"copyright"),rt([Q(2,"string")],et.prototype,"fullName"),rt([Q(3,"string")],et.prototype,"familyName"),rt([Q(4,"string")],et.prototype,"weight"),rt([Q(1201)],et.prototype,"isFixedPitch"),rt([Q(1202)],et.prototype,"italicAngle"),rt([Q(1203,"number",-100)],et.prototype,"underlinePosition"),rt([Q(1204,"number",50)],et.prototype,"underlineThickness"),rt([Q(1205)],et.prototype,"paintType"),rt([Q(1206,"number",2)],et.prototype,"charstringType"),rt([Q(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),rt([Q(13)],et.prototype,"uniqueId"),rt([Q(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),rt([Q(1208)],et.prototype,"strokeWidth"),rt([Q(14)],et.prototype,"xuid"),rt([Q(15)],et.prototype,"charset"),rt([Q(16)],et.prototype,"encoding"),rt([Q(17)],et.prototype,"charStrings"),rt([Q(18,"number[]",[0,0])],et.prototype,"private");function dt(n,t=n){return e=>{Kt.tableDefinitions.set(n,{tag:n,prop:t,class:e}),Object.defineProperty(Kt.prototype,t,{get(){return this.get(n)},set(r){return this.set(n,r)},configurable:!0,enumerable:!0})}}class Kt{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:i}=this.cff;e=i.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),i=r.length,o=Array.from({length:i}),s=e.get(0);for(let a=0;a<i;a+=1)o[a]=e.get(r[a])||s;return o}getPathCommands(t,e,r,i,o){const s=[];return this.forEachGlyph(t,e,r,i,o,(a,l,c,u,h)=>{s.push(...a.getPathCommands(l,c,u,h,this))}),s}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,i=72,o={},s){const a=1/this.unitsPerEm*i,l=this.textToGlyphs(t);for(let c=0;c<l.length;c+=1){const u=l[c];s.call(this,u,e,r,i,o),u.advanceWidth&&(e+=u.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*i:o.tracking&&(e+=o.tracking/1e3*i)}return e}constructor(t){(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,i)=>{this.tableViews.set(i,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}clone(){return new Kt(this.tableViews)}delete(t){const e=Kt.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Kt.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Kt.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const i=e.class;if(i){const o=this.tableViews.get(t);if(!o)return;r=new i(o.buffer,o.byteOffset,o.byteLength).setSFNT(this),this.tables.set(e.prop,r)}}return r}}class gt extends It{setSFNT(t){return this._sfnt=t,this}getSFNT(){return this._sfnt}}var $s=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Ee=(n,t,e,r)=>{for(var i=r>1?void 0:r?zs(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&$s(t,e,i),i};let me=class extends gt{_glyphs;get glyphs(){return this._glyphs??=new Os(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(n,t,e,r){super(n,t,e,r),this._init()}_init(){const n=this.view,{buffer:t,byteOffset:e}=n,r=e+4;this.nameIndex=new Dr(t,r),this.topDictIndex=new tn(t,this.nameIndex.endOffset),this.stringIndex=new Dr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new tn(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new nn(t,e+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new tn(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new tn(t,e+this.topDict.charStrings);const s=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Bs:this.topDict.charset===1?this.charset=Ds:this.topDict.charset===2?this.charset=Fs:this.charset=this._readCharset(e+this.topDict.charset,s,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Un:this.topDict.encoding===1?this.encoding=ks:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(n,t,e){const r=this.view;r.seek(n);let i,o,s;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(i=0;i<t;i+=1)o=r.readUint16(),a.push(en(e,o));else if(l===1)for(;a.length<=t;)for(o=r.readUint16(),s=r.readUint8(),i=0;i<=s;i+=1)a.push(en(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=r.readUint16(),s=r.readUint16(),i=0;i<=s;i+=1)a.push(en(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(n){const t=this.view;t.seek(n);let e,r;const i={},o=t.readUint8();if(o===0){const s=t.readUint8();for(e=0;e<s;e+=1)r=t.readUint8(),i[r]=e}else if(o===1){const s=t.readUint8();for(r=1,e=0;e<s;e+=1){const a=t.readUint8(),l=t.readUint8();for(let c=a;c<=a+l;c+=1)i[c]=r,r+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(n){let t;return n.length<1240?t=107:n.length<33900?t=1131:t=32768,t}};Ee([m("uint8")],me.prototype,"majorVersion",2),Ee([m("uint8")],me.prototype,"minorVersion",2),Ee([m("uint8")],me.prototype,"headerSize",2),Ee([m("uint8")],me.prototype,"offsetSize",2),me=Ee([dt("CFF ","cff")],me);var Ns=Object.defineProperty,rn=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Ns(t,e,i),i};const Be=class ts extends It{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ts;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,i)=>{i<256&&r<256&&e.view.writeUint8(r,6+i)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};rn([m("uint16")],Be.prototype,"format"),rn([m("uint16")],Be.prototype,"length"),rn([m("uint16")],Be.prototype,"language"),rn([m({type:"uint8",size:256})],Be.prototype,"glyphIndexArray");let Ur=Be;var Vs=Object.defineProperty,$n=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Vs(t,e,i),i};class sn extends It{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,i=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,a=r.findIndex(c=>c===i);let l=0;for(let c=0;c<256;c++)if(r[c]===0)c>=a||c<o[0].firstCode||c>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(c-o[0].firstCode)>=s.length?l=0:(l=s[o[0].idRangeOffset+(c-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(c,l);else{const u=r[c];for(let h=0,p=o[u].entryCount;h<p;h++)if(o[u].idRangeOffset+h>=s.length?l=0:(l=s[o[u].idRangeOffset+h],l!==0&&(l=l+o[u].idDelta)),l!==0&&l<t){const g=(c<<8|h+o[u].firstCode)%65535;e.set(g,l)}}return e}}$n([m("uint16")],sn.prototype,"format"),$n([m("uint16")],sn.prototype,"length"),$n([m("uint16")],sn.prototype,"language");function Lr(n){return n>32767?n-65536:n<-32767?n+65536:n}function $r(n,t){let e;const r=[];let i={};return n.forEach((o,s)=>{t&&s>t||((!e||s!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(i.end=e.unicode,r.push(i),i={start:s,startId:o,delta:Lr(o-s)}):(i.start=Number(s),i.startId=o,i.delta=Lr(o-s))),e={unicode:s,glyphIndex:o})}),e&&(i.end=e.unicode,r.push(i)),r}var js=Object.defineProperty,ue=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&js(t,e,i),i};const re=class es extends It{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=$r(t,65535),r=e.length+1,i=Math.floor(Math.log(r)/Math.LN2),o=2*2**i,s=new es(new ArrayBuffer(24+e.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=r*2,s.searchRange=o,s.entrySelector=i,s.rangeShift=2*r-o,s.endCode=[...e.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...e.map(a=>a.start),65535],s.idDelta=[...e.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:r},()=>0),s}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,i=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let c=0;c<e;++c)for(let u=i[c],h=o[c];u<=h;++u)if(s[c]===0)t.set(u,(u+a[c])%65536);else{const p=c+s[c]/2+(u-i[c])-r,g=l[p];g!==0?t.set(u,(g+a[c])%65536):t.set(u,0)}return t.delete(65535),t}};ue([m("uint16")],re.prototype,"format"),ue([m("uint16")],re.prototype,"length"),ue([m("uint16")],re.prototype,"language"),ue([m("uint16")],re.prototype,"segCountX2"),ue([m("uint16")],re.prototype,"searchRange"),ue([m("uint16")],re.prototype,"entrySelector"),ue([m("uint16")],re.prototype,"rangeShift");let zr=re;var Rs=Object.defineProperty,De=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Rs(t,e,i),i};class xe extends It{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,i)=>{e.set(i,r)}),e}}De([m("uint16")],xe.prototype,"format"),De([m("uint16")],xe.prototype,"length"),De([m("uint16")],xe.prototype,"language"),De([m("uint16")],xe.prototype,"firstCode"),De([m("uint16")],xe.prototype,"entryCount");var Gs=Object.defineProperty,Fe=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Gs(t,e,i),i};const ve=class ns extends It{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=$r(t),r=new ns(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(i=>{r.view.writeUint32(i.start),r.view.writeUint32(i.end),r.view.writeUint32(i.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,i=e.length;r<i;r++){const o=e[r];let s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,s++)}return t}};Fe([m("uint16")],ve.prototype,"format"),Fe([m("uint16")],ve.prototype,"reserved"),Fe([m("uint32")],ve.prototype,"length"),Fe([m("uint32")],ve.prototype,"language"),Fe([m("uint32")],ve.prototype,"nGroups");let Nr=ve;var qs=Object.defineProperty,zn=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&qs(t,e,i),i};class on extends It{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,i=e.length;r<i;r++){const{uVSMappings:o}=e[r];o.forEach(s=>{t.set(s.unicodeValue,s.glyphID)})}return t}}zn([m("uint16")],on.prototype,"format"),zn([m("uint32")],on.prototype,"length"),zn([m("uint32")],on.prototype,"numVarSelectorRecords");var Ws=Object.defineProperty,Hs=Object.getOwnPropertyDescriptor,Nn=(n,t,e,r)=>{for(var i=r>1?void 0:r?Hs(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&Ws(t,e,i),i};let Ue=class extends gt{static from(n){const t=Array.from(n.keys()).some(u=>u>65535),e=zr.from(n),r=Ur.from(n),i=t?Nr.from(n):void 0,o=4+(i?32:24),s=o+e.view.byteLength,a=s+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:s},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),c=new Ue(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+(i?.view.byteLength??0)));return c.numberSubtables=l.length,c.view.seek(4),l.forEach(u=>{c.view.writeUint16(u.platformID),c.view.writeUint16(u.platformSpecificID),c.view.writeUint32(u.offset)}),c.view.writeBytes(e.view,o),c.view.writeBytes(r.view,s),i&&c.view.writeBytes(i.view,a),c}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const n=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,i=e.length;r<i;r++){const o=e[r],s=t.get(o);n.has(s)?n.get(s).push(o):n.set(s,[o])}this._glyphIndexToUnicodesMap=n}return this._glyphIndexToUnicodesMap}readSubtables(){const n=this.numberSubtables;return this.view.seek(4),Array.from({length:n},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const e=this.view.readUint16();let r;switch(e){case 0:r=new Ur(this.view.buffer,t.offset);break;case 2:r=new sn(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new zr(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new xe(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new Nr(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new on(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){const n=this.readSubtables(),t=n.find(s=>s.format===0)?.view,e=n.find(s=>s.platformID===3&&s.platformSpecificID===3&&s.format===2)?.view,r=n.find(s=>s.platformID===3&&s.platformSpecificID===1&&s.format===4)?.view,i=n.find(s=>s.platformID===3&&s.platformSpecificID===10&&s.format===12)?.view,o=n.find(s=>s.platformID===0&&s.platformSpecificID===5&&s.format===14)?.view;return new Map([...t?.getUnicodeToGlyphIndexMap()??[],...e?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...r?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...o?.getUnicodeToGlyphIndexMap()??[]])}};Nn([m("uint16")],Ue.prototype,"version",2),Nn([m("uint16")],Ue.prototype,"numberSubtables",2),Ue=Nn([dt("cmap")],Ue);class Xs extends Ir{_parseContours(t){const e=[];let r=[];for(let i=0;i<t.length;i+=1){const o=t[i];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return Oe(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let i=0;i<t.length;i+=1){const o=t[i],s={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(s)}return r}_parseGlyphCoordinate(t,e,r,i,o){let s;return(e&i)>0?(s=t.view.readUint8(),(e&o)===0&&(s=-s),s=r+s):(e&o)>0?s=r:s=r+t.view.readInt16(),s}parse(t,e,r){t.view.seek(e);const i=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(),i>0){const a=this.endPointIndices=[];for(let y=0;y<i;y++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();Oe(l<5e3,`Bad instructionLength:${l}`);const c=this.instructions=[];for(let y=0;y<l;++y)c.push(t.view.readUint8());const u=t.view.byteOffset,h=a[a.length-1]+1;Oe(h<2e4,`Bad numberOfCoordinates:${u}`);const p=[];let g,f=0;for(;f<h;)if(g=t.view.readUint8(),p.push(g),f++,g&8&&f<h){const y=t.view.readUint8();for(let d=0;d<y;d++)p.push(g),f++}if(Oe(p.length===h,`Bad flags length: ${p.length}, numberOfCoordinates: ${h}`),a.length>0){const y=[];let d;if(h>0){for(let w=0;w<h;w+=1)g=p[w],d={},d.onCurve=!!(g&1),d.lastPointOfContour=a.includes(w),y.push(d);let P=0;for(let w=0;w<h;w+=1)g=p[w],d=y[w],d.x=this._parseGlyphCoordinate(t,g,P,2,16),P=d.x;let M=0;for(let w=0;w<h;w+=1)g=p[w],d=y[w],d.y=this._parseGlyphCoordinate(t,g,M,4,32),M=d.y}this.points=y}else this.points=[]}else if(i===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=t.view.readUint16();const c={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(c.dx=t.view.readInt16(),c.dy=t.view.readInt16()):c.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(c.dx=t.view.readInt8(),c.dy=t.view.readInt8()):c.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?c.xScale=c.yScale=t.view.readInt16()/16384:(a&64)>0?(c.xScale=t.view.readInt16()/16384,c.yScale=t.view.readInt16()/16384):(a&128)>0&&(c.xScale=t.view.readInt16()/16384,c.scale01=t.view.readInt16()/16384,c.scale10=t.view.readInt16()/16384,c.yScale=t.view.readInt16()/16384),this.components.push(c),l=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let c=0;c<this.instructionLength;c+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],c=r.get(l.glyphIndex);if(c.getPathCommands(),c.points){let u;if(l.matchedPoints===void 0)u=this._transformPoints(c.points,l);else{Oe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>c.points.length-1,`Matched points out of range in ${this.name}`);const h=this.points[l.matchedPoints[0]];let p=c.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};p=this._transformPoints([p],g)[0],g.dx=h.x-p.x,g.dy=h.y-p.y,u=this._transformPoints(c.points,g)}this.points=this.points.concat(u)}}const o=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const c=s[a];let u=c[c.length-1],h=c[0];u.onCurve?o.push({type:"M",x:u.x,y:u.y}):h.onCurve?o.push({type:"M",x:h.x,y:h.y}):o.push({type:"M",x:(u.x+h.x)*.5,y:(u.y+h.y)*.5});for(let p=0,g=c.length;p<g;++p)if(u=h,h=c[(p+1)%g],u.onCurve)o.push({type:"L",x:u.x,y:u.y});else{let f=h;h.onCurve||(f={x:(u.x+h.x)*.5,y:(u.y+h.y)*.5}),o.push({type:"Q",x1:u.x,y1:u.y,x:f.x,y:f.y})}o.push({type:"Z"})}this.pathCommands=o}}class Zs extends Er{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],i=new Xs({index:t});return r!==e[t+1]&&i.parse(this._sfnt.glyf,r,this),i}}var Ys=Object.getOwnPropertyDescriptor,Ks=(n,t,e,r)=>{for(var i=r>1?void 0:r?Ys(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let Vn=class extends gt{static from(n){const t=n.reduce((r,i)=>r+i.byteLength,0),e=new Vn(new ArrayBuffer(t));return n.forEach(r=>{e.view.writeBytes(r)}),e}_glyphs;get glyphs(){return this._glyphs??=new Zs(this._sfnt)}};Vn=Ks([dt("glyf")],Vn);var Qs=Object.getOwnPropertyDescriptor,Js=(n,t,e,r)=>{for(var i=r>1?void 0:r?Qs(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let Vr=class extends gt{};Vr=Js([dt("GPOS","gpos")],Vr);var to=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,fe=(n,t,e,r)=>{for(var i=r>1?void 0:r?eo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&to(t,e,i),i};let ie=class extends gt{};fe([m("uint16")],ie.prototype,"majorVersion",2),fe([m("uint16")],ie.prototype,"minorVersion",2),fe([m("uint16")],ie.prototype,"scriptListOffset",2),fe([m("uint16")],ie.prototype,"featureListOffset",2),fe([m("uint16")],ie.prototype,"lookupListOffset",2),fe([m("uint16")],ie.prototype,"featureVariationsOffset",2),ie=fe([dt("GSUB","gsub")],ie);var no=Object.defineProperty,ro=Object.getOwnPropertyDescriptor,ot=(n,t,e,r)=>{for(var i=r>1?void 0:r?ro(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&no(t,e,i),i};let st=class extends gt{constructor(n=new ArrayBuffer(54),t){super(n,t,Math.min(54,n.byteLength-(t??0)))}};ot([m("fixed")],st.prototype,"version",2),ot([m("fixed")],st.prototype,"fontRevision",2),ot([m("uint32")],st.prototype,"checkSumAdjustment",2),ot([m("uint32")],st.prototype,"magickNumber",2),ot([m("uint16")],st.prototype,"flags",2),ot([m("uint16")],st.prototype,"unitsPerEm",2),ot([m({type:"longDateTime"})],st.prototype,"created",2),ot([m({type:"longDateTime"})],st.prototype,"modified",2),ot([m("int16")],st.prototype,"xMin",2),ot([m("int16")],st.prototype,"yMin",2),ot([m("int16")],st.prototype,"xMax",2),ot([m("int16")],st.prototype,"yMax",2),ot([m("uint16")],st.prototype,"macStyle",2),ot([m("uint16")],st.prototype,"lowestRecPPEM",2),ot([m("int16")],st.prototype,"fontDirectionHint",2),ot([m("int16")],st.prototype,"indexToLocFormat",2),ot([m("int16")],st.prototype,"glyphDataFormat",2),st=ot([dt("head")],st);var io=Object.defineProperty,so=Object.getOwnPropertyDescriptor,bt=(n,t,e,r)=>{for(var i=r>1?void 0:r?so(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&io(t,e,i),i};let yt=class extends gt{constructor(n=new ArrayBuffer(36),t){super(n,t,Math.min(36,n.byteLength-(t??0)))}};bt([m("fixed")],yt.prototype,"version",2),bt([m("int16")],yt.prototype,"ascent",2),bt([m("int16")],yt.prototype,"descent",2),bt([m("int16")],yt.prototype,"lineGap",2),bt([m("uint16")],yt.prototype,"advanceWidthMax",2),bt([m("int16")],yt.prototype,"minLeftSideBearing",2),bt([m("int16")],yt.prototype,"minRightSideBearing",2),bt([m("int16")],yt.prototype,"xMaxExtent",2),bt([m("int16")],yt.prototype,"caretSlopeRise",2),bt([m("int16")],yt.prototype,"caretSlopeRun",2),bt([m("int16")],yt.prototype,"caretOffset",2),bt([m({type:"int16",size:4})],yt.prototype,"reserved",2),bt([m("int16")],yt.prototype,"metricDataFormat",2),bt([m("uint16")],yt.prototype,"numOfLongHorMetrics",2),yt=bt([dt("hhea")],yt);var oo=Object.getOwnPropertyDescriptor,ao=(n,t,e,r)=>{for(var i=r>1?void 0:r?oo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let jn=class extends gt{static from(n){const t=n.length*4,e=new jn(new ArrayBuffer(t));return n.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const n=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:n}).map((i,o)=>(o<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};jn=ao([dt("hmtx")],jn);var lo=Object.getOwnPropertyDescriptor,co=(n,t,e,r)=>{for(var i=r>1?void 0:r?lo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let jr=class extends gt{};jr=co([dt("kern","kern")],jr);var ho=Object.getOwnPropertyDescriptor,uo=(n,t,e,r)=>{for(var i=r>1?void 0:r?ho(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let Rn=class extends gt{static from(n,t=1){const e=n.length*(t?4:2),r=new Rn(new ArrayBuffer(e));return n.forEach(i=>{t?r.view.writeUint32(i):r.view.writeUint16(i/2)}),r}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){const n=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:n}).map(()=>t?e.readUint32():e.readUint16()*2)}};Rn=uo([dt("loca")],Rn);var fo=Object.defineProperty,po=Object.getOwnPropertyDescriptor,mt=(n,t,e,r)=>{for(var i=r>1?void 0:r?po(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&fo(t,e,i),i};let ct=class extends gt{constructor(n=new ArrayBuffer(32),t){super(n,t,Math.min(32,n.byteLength-(t??0)))}};mt([m("fixed")],ct.prototype,"version",2),mt([m("uint16")],ct.prototype,"numGlyphs",2),mt([m("uint16")],ct.prototype,"maxPoints",2),mt([m("uint16")],ct.prototype,"maxContours",2),mt([m("uint16")],ct.prototype,"maxComponentPoints",2),mt([m("uint16")],ct.prototype,"maxComponentContours",2),mt([m("uint16")],ct.prototype,"maxZones",2),mt([m("uint16")],ct.prototype,"maxTwilightPoints",2),mt([m("uint16")],ct.prototype,"maxStorage",2),mt([m("uint16")],ct.prototype,"maxFunctionDefs",2),mt([m("uint16")],ct.prototype,"maxInstructionDefs",2),mt([m("uint16")],ct.prototype,"maxStackElements",2),mt([m("uint16")],ct.prototype,"maxSizeOfInstructions",2),mt([m("uint16")],ct.prototype,"maxComponentElements",2),mt([m("uint16")],ct.prototype,"maxComponentDepth",2),ct=mt([dt("maxp")],ct);var go=Object.defineProperty,yo=Object.getOwnPropertyDescriptor,an=(n,t,e,r)=>{for(var i=r>1?void 0:r?yo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&go(t,e,i),i};const Rr={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"},Gn={Macintosh:1,Microsoft:3},mo={Default:0},Gr={UCS2:1};let Le=class extends gt{_names;get names(){return this._names??=this.readNames()}readNames(){const n=this.count;this.view.seek(6);const t=[];for(let a=0;a<n;++a)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const e=this.stringOffset;for(let a=0;a<n;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let r=Gn.Macintosh,i=mo.Default,o=0;t.some(a=>a.platform===Gn.Microsoft&&a.encoding===Gr.UCS2&&a.language===1033)&&(r=Gn.Microsoft,i=Gr.UCS2,o=1033);const s={};for(let a=0;a<n;++a){const l=t[a];l.platform===r&&l.encoding===i&&l.language===o&&Rr[l.nameId]&&(s[Rr[l.nameId]]=o===0?Cs(l.name):Ps(l.name))}return s}};an([m("uint16")],Le.prototype,"format",2),an([m("uint16")],Le.prototype,"count",2),an([m("uint16")],Le.prototype,"stringOffset",2),Le=an([dt("name")],Le);var xo=Object.defineProperty,vo=Object.getOwnPropertyDescriptor,G=(n,t,e,r)=>{for(var i=r>1?void 0:r?vo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&xo(t,e,i),i};let R=class extends gt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};G([m("uint16")],R.prototype,"version",2),G([m("int16")],R.prototype,"xAvgCharWidth",2),G([m("uint16")],R.prototype,"usWeightClass",2),G([m("uint16")],R.prototype,"usWidthClass",2),G([m("uint16")],R.prototype,"fsType",2),G([m("uint16")],R.prototype,"ySubscriptXSize",2),G([m("uint16")],R.prototype,"ySubscriptYSize",2),G([m("uint16")],R.prototype,"ySubscriptXOffset",2),G([m("uint16")],R.prototype,"ySubscriptYOffset",2),G([m("uint16")],R.prototype,"ySuperscriptXSize",2),G([m("uint16")],R.prototype,"ySuperscriptYSize",2),G([m("uint16")],R.prototype,"ySuperscriptXOffset",2),G([m("uint16")],R.prototype,"ySuperscriptYOffset",2),G([m("uint16")],R.prototype,"yStrikeoutSize",2),G([m("uint16")],R.prototype,"yStrikeoutPosition",2),G([m("uint16")],R.prototype,"sFamilyClass",2),G([m({type:"uint8"})],R.prototype,"bFamilyType",2),G([m({type:"uint8"})],R.prototype,"bSerifStyle",2),G([m({type:"uint8"})],R.prototype,"bWeight",2),G([m({type:"uint8"})],R.prototype,"bProportion",2),G([m({type:"uint8"})],R.prototype,"bContrast",2),G([m({type:"uint8"})],R.prototype,"bStrokeVariation",2),G([m({type:"uint8"})],R.prototype,"bArmStyle",2),G([m({type:"uint8"})],R.prototype,"bLetterform",2),G([m({type:"uint8"})],R.prototype,"bMidline",2),G([m({type:"uint8"})],R.prototype,"bXHeight",2),G([m({type:"uint8",size:16})],R.prototype,"ulUnicodeRange",2),G([m({type:"char",size:4})],R.prototype,"achVendID",2),G([m("uint16")],R.prototype,"fsSelection",2),G([m("uint16")],R.prototype,"usFirstCharIndex",2),G([m("uint16")],R.prototype,"usLastCharIndex",2),G([m("int16")],R.prototype,"sTypoAscender",2),G([m("int16")],R.prototype,"sTypoDescender",2),G([m("int16")],R.prototype,"sTypoLineGap",2),G([m("uint16")],R.prototype,"usWinAscent",2),G([m("uint16")],R.prototype,"usWinDescent",2),G([m({offset:72,type:"uint8",size:8})],R.prototype,"ulCodePageRange",2),G([m({offset:72,type:"int16"})],R.prototype,"sxHeight",2),G([m("int16")],R.prototype,"sCapHeight",2),G([m("uint16")],R.prototype,"usDefaultChar",2),G([m("uint16")],R.prototype,"usBreakChar",2),G([m("uint16")],R.prototype,"usMaxContext",2),R=G([dt("OS/2","os2")],R);var wo=Object.defineProperty,bo=Object.getOwnPropertyDescriptor,Gt=(n,t,e,r)=>{for(var i=r>1?void 0:r?bo(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&wo(t,e,i),i};let $t=class extends gt{constructor(n=new ArrayBuffer(32),t,e){super(n,t,e)}};Gt([m("fixed")],$t.prototype,"format",2),Gt([m("fixed")],$t.prototype,"italicAngle",2),Gt([m("int16")],$t.prototype,"underlinePosition",2),Gt([m("int16")],$t.prototype,"underlineThickness",2),Gt([m("uint32")],$t.prototype,"isFixedPitch",2),Gt([m("uint32")],$t.prototype,"minMemType42",2),Gt([m("uint32")],$t.prototype,"maxMemType42",2),Gt([m("uint32")],$t.prototype,"minMemType1",2),Gt([m("uint32")],$t.prototype,"maxMemType1",2),$t=Gt([dt("post")],$t);var So=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,St=(n,t,e,r)=>{for(var i=r>1?void 0:r?Co(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=(r?s(t,e,i):s(i))||i);return r&&i&&So(t,e,i),i};let xt=class extends gt{constructor(n=new ArrayBuffer(36),t){super(n,t,Math.min(36,n.byteLength-(t??0)))}};St([m("fixed")],xt.prototype,"version",2),St([m("int16")],xt.prototype,"vertTypoAscender",2),St([m("int16")],xt.prototype,"vertTypoDescender",2),St([m("int16")],xt.prototype,"vertTypoLineGap",2),St([m("int16")],xt.prototype,"advanceHeightMax",2),St([m("int16")],xt.prototype,"minTopSideBearing",2),St([m("int16")],xt.prototype,"minBottomSideBearing",2),St([m("int16")],xt.prototype,"yMaxExtent",2),St([m("int16")],xt.prototype,"caretSlopeRise",2),St([m("int16")],xt.prototype,"caretSlopeRun",2),St([m("int16")],xt.prototype,"caretOffset",2),St([m({type:"int16",size:4})],xt.prototype,"reserved",2),St([m("int16")],xt.prototype,"metricDataFormat",2),St([m("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=St([dt("vhea")],xt);var Po=Object.getOwnPropertyDescriptor,Mo=(n,t,e,r)=>{for(var i=r>1?void 0:r?Po(t,e):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(i)||i);return i};let qn=class extends gt{static from(n){const t=n.length*4,e=new qn(new ArrayBuffer(t));return n.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const n=this._sfnt.maxp.numGlyphs,t=this._sfnt.vhea?.numOfLongVerMetrics??0,e=this.view;e.seek(0);let r=0;return Array.from({length:n}).map((i,o)=>(o<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};qn=Mo([dt("vmtx")],qn);var _o=Object.defineProperty,$e=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&_o(t,e,i),i};class qt extends Fn{format="TrueType";mimeType="font/ttf";_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ye(t).getUint32(0))}static checksum(t){const e=ye(t);let r=e.byteLength;for(;r%4;)r++;let i=0;for(let o=0,s=r/4;o<s;o+=4)o*4<r-4&&(i+=e.getUint32(o*4,!1));return i&4294967295}static from(t){const e=h=>h+3&-4,r=t.tableViews.size,i=Array.from(t.tableViews.values()).reduce((h,p)=>h+e(p.byteLength),0),o=new this(new ArrayBuffer(12+r*16+i));o.scalerType=65536,o.numTables=r;const s=Math.log(2);o.searchRange=Math.floor(Math.log(r)/s)*16,o.entrySelector=Math.floor(o.searchRange/s),o.rangeShift=r*16-o.searchRange;let a=12+r*16,l=0;const c=o.getDirectories();t.tableViews.forEach((h,p)=>{const g=c[l++];g.tag=p,g.checkSum=this.checksum(h),g.offset=a,g.length=h.byteLength,o.view.writeBytes(h,a),a+=e(g.length)});const u=o.createSFNT().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Ie(this.view.buffer,t);return t+=e.view.byteLength,e})}createSFNT(){return new Kt(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e([m("uint32")],qt.prototype,"scalerType"),$e([m("uint16")],qt.prototype,"numTables"),$e([m("uint16")],qt.prototype,"searchRange"),$e([m("uint16")],qt.prototype,"entrySelector"),$e([m("uint16")],qt.prototype,"rangeShift");class Wn extends qt{format="OpenType";mimeType="font/otf";static signature=new Set([1330926671]);static from(t){return super.from(t)}}var To=Object.defineProperty,ze=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&To(t,e,i),i};class we extends It{constructor(t,e){super(t,e,20)}}ze([m({type:"char",size:4})],we.prototype,"tag"),ze([m("uint32")],we.prototype,"offset"),ze([m("uint32")],we.prototype,"compLength"),ze([m("uint32")],we.prototype,"origLength"),ze([m("uint32")],we.prototype,"origChecksum");var ko=Object.defineProperty,Ot=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&ko(t,e,i),i};const Mt=class gr extends Fn{format="WOFF";mimeType="font/woff";get subfontFormat(){return qt.is(this.flavor)?"TrueType":Wn.is(this.flavor)?"OpenType":"Open"}_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([2001684038]);static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ye(t).getUint32(0))}static checkSum(t){const e=ye(t),r=e.byteLength,i=Math.floor(r/4);let o=0,s=0;for(;s<i;)o+=e.getUint32(4*s++,!1);let a=r-i*4;if(a){let l=i*4;for(;a>0;)o+=e.getUint8(l)<<a*8,l++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=h=>h+3&-4,i=[];t.tableViews.forEach((h,p)=>{const g=ye(ys(new Uint8Array(h.buffer,h.byteOffset,h.byteLength)));i.push({tag:p,view:g.byteLength<h.byteLength?g:h,rawView:h})});const o=i.length,s=i.reduce((h,p)=>h+r(p.view.byteLength),0),a=new gr(new ArrayBuffer(44+20*o+s+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSFNTSize=12+16*o+i.reduce((h,p)=>h+r(p.rawView.byteLength),0);let l=44+o*20,c=0;const u=a.getDirectories();return i.forEach(h=>{const p=u[c++];p.tag=h.tag,p.offset=l,p.compLength=h.view.byteLength,p.origChecksum=gr.checkSum(h.rawView),p.origLength=h.rawView.byteLength,a.view.writeBytes(h.view,l),l+=r(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new we(this.view.buffer,t);return t+=e.view.byteLength,e})}createSFNT(){return new Kt(this.getDirectories().reduce((t,e)=>{const r=e.tag,i=this.view.byteOffset+e.offset,o=e.compLength,s=e.origLength,a=i+o;return t[r]=o>=s?new DataView(this.view.buffer,i,o):new DataView(ms(new Uint8Array(this.view.buffer.slice(i,a))).buffer),t},{}))}};Ot([m("uint32")],Mt.prototype,"signature"),Ot([m("uint32")],Mt.prototype,"flavor"),Ot([m("uint32")],Mt.prototype,"length"),Ot([m("uint16")],Mt.prototype,"numTables"),Ot([m("uint16")],Mt.prototype,"reserved"),Ot([m("uint32")],Mt.prototype,"totalSFNTSize"),Ot([m("uint16")],Mt.prototype,"majorVersion"),Ot([m("uint16")],Mt.prototype,"minorVersion"),Ot([m("uint32")],Mt.prototype,"metaOffset"),Ot([m("uint32")],Mt.prototype,"metaLength"),Ot([m("uint32")],Mt.prototype,"metaOrigLength"),Ot([m("uint32")],Mt.prototype,"privOffset"),Ot([m("uint32")],Mt.prototype,"privLength");let Hn=Mt;function Ao(n,t=!0){if(qt.is(n))return new qt(n);if(Wn.is(n))return new Wn(n);if(Hn.is(n))return new Hn(n);if(t)throw new Error("Failed to parseFont")}function Oo(n,t=!0){const e=Ao(n,!1);if(e)return e;if(t)throw new Error("Failed to parseFont")}class Xn{static defaultRequestInit={cache:"force-cache"};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(t){this.fallbackFont=t}async loadFallbackFont(t,e={}){this.fallbackFont=await this.load(t,e)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...Xn.defaultRequestInit,...e,signal:r.signal}).then(i=>i.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
|
|
2
2
|
font-family: "${t}";
|
|
3
3
|
src: url(${e});
|
|
4
|
-
}`)),document.head.appendChild(r),this}_parseUrls(t){const e=Array.from(new Set([...t.split(","),t]));return Array.from(new Set(e.map(r=>this.familyToUrl.get(r.trim())??this.familyToUrl.get(r)??r)))}get(t){let e;return t&&(e=this._parseUrls(t).reduce((i,o)=>i||this.loaded.get(o),void 0)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){return this._parseUrls(t).forEach(e=>{this.familyToUrl.delete(e),this.loaded.delete(e)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:i=!0,injectStyleTag:o=!0,...s}=e;let a,l;if(typeof t=="string"?a=t:{src:a,family:l}=t,this.loaded.has(a))return r&&(this.loading.forEach(g=>g.cancel()),this.loading.clear()),h(this.loaded.get(a));let c=this.loading.get(a);return c||(c=this._createRequest(a,s),this.loading.set(a,c)),r&&this.loading.forEach((g,p)=>{g!==c&&(g.cancel(),this.loading.delete(p))}),c.when.then(g=>{if(this.loaded.has(a))return h(this.loaded.get(a));{const p=f(g);return e.noAdd||this.loaded.set(a,p),p.familySet.forEach(y=>{this.familyToUrl.set(y,a),typeof document<"u"&&(i&&this.injectFontFace(y,g),o&&this.injectStyleTag(y,a))}),p}}).catch(g=>{if(g instanceof DOMException&&g.message==="The user aborted a request.")return f();throw g}).finally(()=>{this.loading.delete(a)});function u(){return l?Array.isArray(l)?l:[l]:[]}function h(g){return u().forEach(p=>{g.familySet.add(p)}),g}function f(g=new ArrayBuffer(0)){let p;function y(){return p||(p=g.byteLength?_o(g,!1):void 0),p}function d(){const M=y();if(M instanceof qt||M instanceof Wn)return M.sfnt}return{src:a,family:l,buffer:g,familySet:new Set(u()),getFont:y,getSFNT:d}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}}const To=new Hn;function ko(n,t,e=2){const r=t&&t.length,i=r?t[0]*e:n.length;let o=Gr(n,0,i,e,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(r&&(o=Bo(n,t,o,e)),n.length>80*e){a=n[0],l=n[1];let u=a,h=l;for(let f=e;f<i;f+=e){const g=n[f],p=n[f+1];g<a&&(a=g),p<l&&(l=p),g>u&&(u=g),p>h&&(h=p)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return Ne(o,s,e,a,l,c,0),s}function Gr(n,t,e,r,i){let o;if(i===Go(n,t,e,r)>0)for(let s=t;s<e;s+=r)o=Xr(s/r|0,n[s],n[s+1],o);else for(let s=e-r;s>=t;s-=r)o=Xr(s/r|0,n[s],n[s+1],o);return o&&be(o,o.next)&&(Re(o),o=o.next),o}function pe(n,t){if(!n)return n;t||(t=n);let e=n,r;do if(r=!1,!e.steiner&&(be(e,e.next)||J(e.prev,e,e.next)===0)){if(Re(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function Ne(n,t,e,r,i,o,s){if(!n)return;!s&&o&&$o(n,r,i,o);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(o?Oo(n,r,i,o):Ao(n)){t.push(l.i,n.i,c.i),Re(n),n=c.next,a=c.next;continue}if(n=c,n===a){s?s===1?(n=Io(pe(n),t),Ne(n,t,e,r,i,o,2)):s===2&&Eo(n,t,e,r,i,o):Ne(pe(n),t,e,r,i,o,1);break}}}function Ao(n){const t=n.prev,e=n,r=n.next;if(J(t,e,r)>=0)return!1;const i=t.x,o=e.x,s=r.x,a=t.y,l=e.y,c=r.y,u=Math.min(i,o,s),h=Math.min(a,l,c),f=Math.max(i,o,s),g=Math.max(a,l,c);let p=r.next;for(;p!==t;){if(p.x>=u&&p.x<=f&&p.y>=h&&p.y<=g&&Ve(i,a,o,l,s,c,p.x,p.y)&&J(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Oo(n,t,e,r){const i=n.prev,o=n,s=n.next;if(J(i,o,s)>=0)return!1;const a=i.x,l=o.x,c=s.x,u=i.y,h=o.y,f=s.y,g=Math.min(a,l,c),p=Math.min(u,h,f),y=Math.max(a,l,c),d=Math.max(u,h,f),M=Xn(g,p,t,e,r),P=Xn(y,d,t,e,r);let w=n.prevZ,C=n.nextZ;for(;w&&w.z>=M&&C&&C.z<=P;){if(w.x>=g&&w.x<=y&&w.y>=p&&w.y<=d&&w!==i&&w!==s&&Ve(a,u,l,h,c,f,w.x,w.y)&&J(w.prev,w,w.next)>=0||(w=w.prevZ,C.x>=g&&C.x<=y&&C.y>=p&&C.y<=d&&C!==i&&C!==s&&Ve(a,u,l,h,c,f,C.x,C.y)&&J(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;w&&w.z>=M;){if(w.x>=g&&w.x<=y&&w.y>=p&&w.y<=d&&w!==i&&w!==s&&Ve(a,u,l,h,c,f,w.x,w.y)&&J(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;C&&C.z<=P;){if(C.x>=g&&C.x<=y&&C.y>=p&&C.y<=d&&C!==i&&C!==s&&Ve(a,u,l,h,c,f,C.x,C.y)&&J(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Io(n,t){let e=n;do{const r=e.prev,i=e.next.next;!be(r,i)&&Wr(r,e,e.next,i)&&je(r,i)&&je(i,r)&&(t.push(r.i,e.i,i.i),Re(e),Re(e.next),e=n=i),e=e.next}while(e!==n);return pe(e)}function Eo(n,t,e,r,i,o){let s=n;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Vo(s,a)){let l=Hr(s,a);s=pe(s,s.next),l=pe(l,l.next),Ne(s,t,e,r,i,o,0),Ne(l,t,e,r,i,o,0);return}a=a.next}s=s.next}while(s!==n)}function Bo(n,t,e,r){const i=[];for(let o=0,s=t.length;o<s;o++){const a=t[o]*r,l=o<s-1?t[o+1]*r:n.length,c=Gr(n,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(No(c))}i.sort(Do);for(let o=0;o<i.length;o++)e=Fo(i[o],e);return e}function Do(n,t){let e=n.x-t.x;if(e===0&&(e=n.y-t.y,e===0)){const r=(n.next.y-n.y)/(n.next.x-n.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=r-i}return e}function Fo(n,t){const e=Uo(n,t);if(!e)return t;const r=Hr(e,n);return pe(r,r.next),pe(e,e.next)}function Uo(n,t){let e=t;const r=n.x,i=n.y;let o=-1/0,s;if(be(n,e))return e;do{if(be(n,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const h=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=r&&h>o&&(o=h,s=e.x<e.next.x?e:e.next,h===r))return s}e=e.next}while(e!==t);if(!s)return null;const a=s,l=s.x,c=s.y;let u=1/0;e=s;do{if(r>=e.x&&e.x>=l&&r!==e.x&&qr(i<c?r:o,i,l,c,i<c?o:r,i,e.x,e.y)){const h=Math.abs(i-e.y)/(r-e.x);je(e,n)&&(h<u||h===u&&(e.x>s.x||e.x===s.x&&Lo(s,e)))&&(s=e,u=h)}e=e.next}while(e!==a);return s}function Lo(n,t){return J(n.prev,n,t.prev)<0&&J(t.next,n,n.next)<0}function $o(n,t,e,r){let i=n;do i.z===0&&(i.z=Xn(i.x,i.y,t,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,zo(i)}function zo(n){let t,e=1;do{let r=n,i;n=null;let o=null;for(t=0;r;){t++;let s=r,a=0;for(let c=0;c<e&&(a++,s=s.nextZ,!!s);c++);let l=e;for(;a>0||l>0&&s;)a!==0&&(l===0||!s||r.z<=s.z)?(i=r,r=r.nextZ,a--):(i=s,s=s.nextZ,l--),o?o.nextZ=i:n=i,i.prevZ=o,o=i;r=s}o.nextZ=null,e*=2}while(t>1);return n}function Xn(n,t,e,r,i){return n=(n-e)*i|0,t=(t-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function No(n){let t=n,e=n;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function qr(n,t,e,r,i,o,s,a){return(i-s)*(t-a)>=(n-s)*(o-a)&&(n-s)*(r-a)>=(e-s)*(t-a)&&(e-s)*(o-a)>=(i-s)*(r-a)}function Ve(n,t,e,r,i,o,s,a){return!(n===s&&t===a)&&qr(n,t,e,r,i,o,s,a)}function Vo(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!jo(n,t)&&(je(n,t)&&je(t,n)&&Ro(n,t)&&(J(n.prev,n,t.prev)||J(n,t.prev,t))||be(n,t)&&J(n.prev,n,n.next)>0&&J(t.prev,t,t.next)>0)}function J(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function be(n,t){return n.x===t.x&&n.y===t.y}function Wr(n,t,e,r){const i=cn(J(n,t,e)),o=cn(J(n,t,r)),s=cn(J(e,r,n)),a=cn(J(e,r,t));return!!(i!==o&&s!==a||i===0&&ln(n,e,t)||o===0&&ln(n,r,t)||s===0&&ln(e,n,r)||a===0&&ln(e,t,r))}function ln(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function cn(n){return n>0?1:n<0?-1:0}function jo(n,t){let e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&Wr(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function je(n,t){return J(n.prev,n,n.next)<0?J(n,t,n.next)>=0&&J(n,n.prev,t)>=0:J(n,t,n.prev)<0||J(n,n.next,t)<0}function Ro(n,t){let e=n,r=!1;const i=(n.x+t.x)/2,o=(n.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&i<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==n);return r}function Hr(n,t){const e=Zn(n.i,n.x,n.y),r=Zn(t.i,t.x,t.y),i=n.next,o=t.prev;return n.next=t,t.prev=n,e.next=i,i.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function Xr(n,t,e,r){const i=Zn(n,t,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Re(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Zn(n,t,e){return{i:n,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Go(n,t,e,r){let i=0;for(let o=t,s=e-r;o<e;o+=r)i+=(n[s]-n[o])*(n[o+1]+n[s+1]),s=o;return i}function qo(n,t,e,r={}){const{radius:i=1}=r;n.moveTo(t,e),n.arc(t,e,i,0,Math.PI*2)}const Wo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Yn(n,t){const{fill:e="#000",stroke:r="none",strokeWidth:i=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:c=0,shadowOffsetX:u=0,shadowOffsetY:h=0,shadowBlur:f=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;n.fillStyle=e,n.strokeStyle=r,n.lineWidth=i,n.lineCap=o,n.lineJoin=Wo[s],n.miterLimit=a,n.setLineDash(l),n.lineDashOffset=c,n.shadowOffsetX=u,n.shadowOffsetY=h,n.shadowBlur=f,n.shadowColor=g}class k{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new k(1/0,1/0)}static get MIN(){return new k(-1/0,-1/0)}get array(){return[this.x,this.y]}finite(){return this.x=Number.isFinite(this.x)?this.x:0,this.y=Number.isFinite(this.y)?this.y:0,this}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,i=this.x-e.x,o=-(this.y-e.y),s=Math.sin(r),a=Math.cos(r);return this.set(e.x+(i*a-o*s),e.y-(i*s+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const i=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=i*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const i=this.x-r.x,o=this.y-r.y;return this.x=r.x+(i+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*i),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,i=t.elements;return this.x=i[0]*e+i[3]*r+i[6],this.y=i[1]*e+i[4]*r+i[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new k(this.x,this.y)}}class X{constructor(t=0,e=0,r=0,i=0){this.left=t,this.top=e,this.width=r,this.height=i}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new k((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new X;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((i,o)=>(i.left=Math.min(i.left,o.left),i.top=Math.min(i.top,o.top),i.right=Math.max(i.right,o.right),i.bottom=Math.max(i.bottom,o.bottom),i),{left:e?.left??0,top:e?.top??0,right:e?.right??0,bottom:e?.bottom??0});return new X(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new X(this.left,this.top,this.width,this.height)}}class Ct{elements=[];constructor(t=1,e=0,r=0,i=0,o=1,s=0,a=0,l=0,c=1){this.set(t,e,r,i,o,s,a,l,c)}set(t,e,r,i,o,s,a,l,c){const u=this.elements;return u[0]=t,u[1]=i,u[2]=a,u[3]=e,u[4]=o,u[5]=l,u[6]=r,u[7]=s,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,i=e.elements,o=this.elements,s=r[0],a=r[3],l=r[6],c=r[1],u=r[4],h=r[7],f=r[2],g=r[5],p=r[8],y=i[0],d=i[3],M=i[6],P=i[1],w=i[4],C=i[7],v=i[2],x=i[5],S=i[8];return o[0]=s*y+a*P+l*v,o[3]=s*d+a*w+l*x,o[6]=s*M+a*C+l*S,o[1]=c*y+u*P+h*v,o[4]=c*d+u*w+h*x,o[7]=c*M+u*C+h*S,o[2]=f*y+g*P+p*v,o[5]=f*d+g*w+p*x,o[8]=f*M+g*C+p*S,this}invert(){const t=this.elements,e=t[0],r=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*s-a*c,f=a*l-u*o,g=c*o-s*l,p=e*h+r*f+i*g;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/p;return t[0]=h*y,t[1]=(i*c-u*r)*y,t[2]=(a*r-i*s)*y,t[3]=f*y,t[4]=(u*e-i*l)*y,t[5]=(i*o-a*e)*y,t[6]=g*y,t[7]=(r*l-c*e)*y,t[8]=(s*e-r*o)*y,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(Kn.makeScale(t,e)),this}rotate(t){return this.premultiply(Kn.makeRotation(-t)),this}translate(t,e){return this.premultiply(Kn.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Kn=new Ct;function Zr(n,t,e,r){const i=n*e+t*r,o=Math.sqrt(n*n+t*t)*Math.sqrt(e*e+r*r);let s=Math.acos(Math.max(-1,Math.min(1,i/o)));return n*r-t*e<0&&(s=-s),s}function Ho(n,t,e,r,i,o,s,a){if(t===0||e===0){n.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(s.x-a.x)/2,c=(s.y-a.y)/2,u=Math.cos(r)*l+Math.sin(r)*c,h=-Math.sin(r)*l+Math.cos(r)*c;let f=t*t,g=e*e;const p=u*u,y=h*h,d=p/f+y/g;if(d>1){const N=Math.sqrt(d);t=N*t,e=N*e,f=t*t,g=e*e}const M=f*y+g*p,P=(f*g-M)/M;let w=Math.sqrt(Math.max(0,P));i===o&&(w=-w);const C=w*t*h/e,v=-w*e*u/t,x=Math.cos(r)*C-Math.sin(r)*v+(s.x+a.x)/2,S=Math.sin(r)*C+Math.cos(r)*v+(s.y+a.y)/2,b=Zr(1,0,(u-C)/t,(h-v)/e),D=Zr((u-C)/t,(h-v)/e,(-u-C)/t,(-h-v)/e)%(Math.PI*2);n.ellipse(x,S,t,e,r,b,b+D,o===0)}const it={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Wt(n,t,e=0){let a=0,l=!0,c="",u="";const h=[];function f(d,M,P){const w=new SyntaxError(`Unexpected character "${d}" at index ${M}.`);throw w.partial=P,w}function g(){c!==""&&(u===""?h.push(Number(c)):h.push(Number(c)*10**Number(u))),c="",u=""}let p;const y=n.length;for(let d=0;d<y;d++){if(p=n[d],Array.isArray(t)&&t.includes(h.length%e)&&it.FLAGS.test(p)){a=1,c=p,g();continue}if(a===0){if(it.WHITESPACE.test(p))continue;if(it.DIGIT.test(p)||it.SIGN.test(p)){a=1,c=p;continue}if(it.POINT.test(p)){a=2,c=p;continue}it.COMMA.test(p)&&(l&&f(p,d,h),l=!0)}if(a===1){if(it.DIGIT.test(p)){c+=p;continue}if(it.POINT.test(p)){c+=p,a=2;continue}if(it.EXP.test(p)){a=3;continue}it.SIGN.test(p)&&c.length===1&&it.SIGN.test(c[0])&&f(p,d,h)}if(a===2){if(it.DIGIT.test(p)){c+=p;continue}if(it.EXP.test(p)){a=3;continue}it.POINT.test(p)&&c[c.length-1]==="."&&f(p,d,h)}if(a===3){if(it.DIGIT.test(p)){u+=p;continue}if(it.SIGN.test(p)){if(u===""){u+=p;continue}u.length===1&&it.SIGN.test(u)&&f(p,d,h)}}it.WHITESPACE.test(p)?(g(),a=0,l=!1):it.COMMA.test(p)?(g(),a=0,l=!0):it.SIGN.test(p)?(g(),a=1,c=p):it.POINT.test(p)?(g(),a=2,c=p):f(p,d,h)}return g(),h}function Se(n,t){return n-(t-n)}function Yr(n,t){const e=new k,r=new k;for(let i=0,o=n.length;i<o;i++){const s=n[i];if(s.type==="m"||s.type==="M")s.type==="m"?e.add(s):e.copy(s),t.moveTo(e.x,e.y),r.copy(e);else if(s.type==="h"||s.type==="H")s.type==="h"?e.x+=s.x:e.x=s.x,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="v"||s.type==="V")s.type==="v"?e.y+=s.y:e.y=s.y,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="l"||s.type==="L")s.type==="l"?e.add(s):e.copy(s),t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="c"||s.type==="C")s.type==="c"?(t.bezierCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(t.bezierCurveTo(Se(e.x,r.x),Se(e.y,r.y),e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(Se(e.x,r.x),Se(e.y,r.y),s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(t.quadraticCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x,e.y+s.y),r.x=e.x+s.x1,r.y=e.y+s.y1,e.add(s)):(t.quadraticCurveTo(s.x1,s.y1,s.x,s.y),r.x=s.x1,r.y=s.y1,e.copy(s));else if(s.type==="t"||s.type==="T"){const a=Se(e.x,r.x),l=Se(e.y,r.y);r.x=a,r.y=l,s.type==="t"?(t.quadraticCurveTo(a,l,e.x+s.x,e.y+s.y),e.add(s)):(t.quadraticCurveTo(a,l,s.x,s.y),e.copy(s))}else if(s.type==="a"||s.type==="A"){const a=e.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;e.add(s)}else{if(e.equals(s))continue;e.copy(s)}r.copy(e),Ho(t,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,e)}else s.type==="z"||s.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",s)}}function Xo(n){let t,e;const r=[];for(let i=0,o=n.length;i<o;i++){const s=n[i];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===e?.x.toFixed(4)&&s.y.toFixed(4)===e?.y.toFixed(4))continue;r.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y},t={x:s.x,y:s.y};break;case"h":case"H":r.push(`${s.type} ${s.x}`),e={x:s.x,y:e?.y??0};break;case"v":case"V":r.push(`${s.type} ${s.y}`),e={x:e?.x??0,y:s.y};break;case"l":case"L":r.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"c":case"C":r.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"s":case"S":r.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"q":case"Q":r.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"t":case"T":r.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"a":case"A":r.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"z":case"Z":r.push(s.type),t&&(e={x:t.x,y:t.y});break}}return r.join(" ")}const Zo=/[a-df-z][^a-df-z]*/gi;function Kr(n){const t=[],e=n.match(Zo);if(!e)return t;for(let r=0,i=e.length;r<i;r++){const o=e[r],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=Wt(a);for(let c=0,u=l.length;c<u;c+=2)c===0?t.push({type:s,x:l[c],y:l[c+1]}):t.push({type:s==="m"?"l":"L",x:l[c],y:l[c+1]});break;case"h":case"H":l=Wt(a);for(let c=0,u=l.length;c<u;c++)t.push({type:s,x:l[c]});break;case"v":case"V":l=Wt(a);for(let c=0,u=l.length;c<u;c++)t.push({type:s,y:l[c]});break;case"l":case"L":l=Wt(a);for(let c=0,u=l.length;c<u;c+=2)t.push({type:s,x:l[c],y:l[c+1]});break;case"c":case"C":l=Wt(a);for(let c=0,u=l.length;c<u;c+=6)t.push({type:s,x1:l[c],y1:l[c+1],x2:l[c+2],y2:l[c+3],x:l[c+4],y:l[c+5]});break;case"s":case"S":l=Wt(a);for(let c=0,u=l.length;c<u;c+=4)t.push({type:s,x2:l[c],y2:l[c+1],x:l[c+2],y:l[c+3]});break;case"q":case"Q":l=Wt(a);for(let c=0,u=l.length;c<u;c+=4)t.push({type:s,x1:l[c],y1:l[c+1],x:l[c+2],y:l[c+3]});break;case"t":case"T":l=Wt(a);for(let c=0,u=l.length;c<u;c+=2)t.push({type:s,x:l[c],y:l[c+1]});break;case"a":case"A":l=Wt(a,[3,4],7);for(let c=0,u=l.length;c<u;c+=7)t.push({type:s,rx:l[c],ry:l[c+1],angle:l[c+2],largeArcFlag:l[c+3],sweepFlag:l[c+4],x:l[c+5],y:l[c+6]});break;case"z":case"Z":t.push({type:s});break;default:console.warn(o)}}return t}const Qr="data:image/svg+xml;",Jr=`${Qr}base64,`,ti=`${Qr}charset=utf8,`;function ei(n){if(typeof n=="string"){let t;n.startsWith(Jr)?(n=n.substring(Jr.length,n.length),t=atob(n)):n.startsWith(ti)?(n=n.substring(ti.length,n.length),t=decodeURIComponent(n)):t=n;const e=new DOMParser().parseFromString(t,"text/xml"),r=e.querySelector("parsererror");if(r)throw new Error(`${r.textContent??"parser error"}
|
|
5
|
-
${t}`);return e.documentElement}else return n}const Yo="px",Ko=90,ni=["mm","cm","in","pt","pc","px"],ri={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 Y(n){let t="px";if(typeof n=="string")for(let r=0,i=ni.length;r<i;r++){const o=ni[r];if(n.endsWith(o)){t=o,n=n.substring(0,n.length-o.length);break}}let e;return e=ri[t][Yo],e<0&&(e=ri[t].in*Ko),e*Number.parseFloat(n)}const Qo=new Ct,hn=new Ct,ii=new Ct,si=new Ct;function Jo(n,t,e){if(!(n.hasAttribute("transform")||n.nodeName==="use"&&(n.hasAttribute("x")||n.hasAttribute("y"))))return null;const r=ta(n);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function ta(n){const t=new Ct,e=Qo;if(n.nodeName==="use"&&(n.hasAttribute("x")||n.hasAttribute("y"))&&t.translate(Y(n.getAttribute("x")),Y(n.getAttribute("y"))),n.hasAttribute("transform")){const r=n.getAttribute("transform").split(")");for(let i=r.length-1;i>=0;i--){const o=r[i].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),c=Wt(o.slice(s+1));switch(e.identity(),l){case"translate":if(c.length>=1){const u=c[0];let h=0;c.length>=2&&(h=c[1]),e.translate(u,h)}break;case"rotate":if(c.length>=1){let u=0,h=0,f=0;u=c[0]*Math.PI/180,c.length>=3&&(h=c[1],f=c[2]),hn.makeTranslation(-h,-f),ii.makeRotation(u),si.multiplyMatrices(ii,hn),hn.makeTranslation(h,f),e.multiplyMatrices(hn,si)}break;case"scale":c.length>=1&&e.scale(c[0],c[1]??c[0]);break;case"skewX":c.length===1&&e.set(1,Math.tan(c[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":c.length===1&&e.set(1,0,0,Math.tan(c[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":c.length===6&&e.set(c[0],c[2],c[4],c[1],c[3],c[5],0,0,1);break}}t.premultiply(e)}}return t}function ea(n){return new _t().arc(Y(n.getAttribute("cx")||0),Y(n.getAttribute("cy")||0),Y(n.getAttribute("r")||0),0,Math.PI*2)}function na(n,t){if(!(!n.sheet||!n.sheet.cssRules||!n.sheet.cssRules.length))for(let e=0;e<n.sheet.cssRules.length;e++){const r=n.sheet.cssRules[e];if(r.type!==1)continue;const i=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=r.style.length,a=0;a<s;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let s=0;s<i.length;s++)t[i[s]]=Object.assign(t[i[s]]||{},{...o})}}function ra(n){return new _t().ellipse(Y(n.getAttribute("cx")||0),Y(n.getAttribute("cy")||0),Y(n.getAttribute("rx")||0),Y(n.getAttribute("ry")||0),0,0,Math.PI*2)}function ia(n){return new _t().moveTo(Y(n.getAttribute("x1")||0),Y(n.getAttribute("y1")||0)).lineTo(Y(n.getAttribute("x2")||0),Y(n.getAttribute("y2")||0))}function sa(n){const t=new _t,e=n.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const oa=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function aa(n){const t=new _t;let e=0;return n.getAttribute("points")?.replace(oa,(r,i,o)=>{const s=Y(i),a=Y(o);return e===0?t.moveTo(s,a):t.lineTo(s,a),e++,r}),t.currentCurve.autoClose=!0,t}const la=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ca(n){const t=new _t;let e=0;return n.getAttribute("points")?.replace(la,(r,i,o)=>{const s=Y(i),a=Y(o);return e===0?t.moveTo(s,a):t.lineTo(s,a),e++,r}),t.currentCurve.autoClose=!1,t}function ha(n){const t=Y(n.getAttribute("x")||0),e=Y(n.getAttribute("y")||0),r=Y(n.getAttribute("rx")||n.getAttribute("ry")||0),i=Y(n.getAttribute("ry")||n.getAttribute("rx")||0),o=Y(n.getAttribute("width")),s=Y(n.getAttribute("height")),a=1-.551915024494,l=new _t;return l.moveTo(t+r,e),l.lineTo(t+o-r,e),(r!==0||i!==0)&&l.bezierCurveTo(t+o-r*a,e,t+o,e+i*a,t+o,e+i),l.lineTo(t+o,e+s-i),(r!==0||i!==0)&&l.bezierCurveTo(t+o,e+s-i*a,t+o-r*a,e+s,t+o-r,e+s),l.lineTo(t+r,e+s),(r!==0||i!==0)&&l.bezierCurveTo(t+r*a,e+s,t,e+s-i*a,t,e+s-i),l.lineTo(t,e+i),(r!==0||i!==0)&&l.bezierCurveTo(t,e+i*a,t+r*a,e,t+r,e),l}function Ht(n,t,e){t=Object.assign({},t);let r={};if(n.hasAttribute("class")){const c=n.getAttribute("class").split(/\s/).filter(Boolean).map(u=>u.trim());for(let u=0;u<c.length;u++)r=Object.assign(r,e[`.${c[u]}`])}n.hasAttribute("id")&&(r=Object.assign(r,e[`#${n.getAttribute("id")}`]));for(let c=n.style.length,u=0;u<c;u++){const h=n.style.item(u),f=n.style.getPropertyValue(h);t[h]=f,r[h]=f}function i(c,u,h=o){n.hasAttribute(c)&&(t[u]=h(n.getAttribute(c))),r[c]&&(t[u]=h(r[c]))}function o(c){return c.startsWith("url")&&console.warn("url access in attributes is not implemented."),c}function s(c){return Math.max(0,Math.min(1,Y(c)))}function a(c){return Math.max(0,Y(c))}function l(c){return c.split(" ").filter(u=>u!=="").map(u=>Y(u))}return i("fill","fill"),i("fill-opacity","fillOpacity",s),i("fill-rule","fillRule"),i("opacity","opacity",s),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",s),i("stroke-width","strokeWidth",a),i("stroke-linecap","strokeLinecap"),i("stroke-linejoin","strokeLinejoin"),i("stroke-miterlimit","strokeMiterlimit",a),i("stroke-dasharray","strokeDasharray",l),i("stroke-dashoffset","strokeDashoffset",Y),i("visibility","visibility"),t}function Qn(n,t,e=[],r={}){if(n.nodeType!==1)return e;let i=!1,o=null,s={...t};switch(n.nodeName){case"svg":s=Ht(n,s,r);break;case"style":na(n,r);break;case"g":s=Ht(n,s,r);break;case"path":s=Ht(n,s,r),n.hasAttribute("d")&&(o=sa(n));break;case"rect":s=Ht(n,s,r),o=ha(n);break;case"polygon":s=Ht(n,s,r),o=aa(n);break;case"polyline":s=Ht(n,s,r),o=ca(n);break;case"circle":s=Ht(n,s,r),o=ea(n);break;case"ellipse":s=Ht(n,s,r),o=ra(n);break;case"line":s=Ht(n,s,r),o=ia(n);break;case"defs":i=!0;break;case"use":{s=Ht(n,s,r);const f=(n.getAttributeNS("http://www.w3.org/1999/xlink","href")||n.getAttribute("href")||"").substring(1),g=n.viewportElement?.getElementById(f);g?Qn(g,s,e,r):console.warn(`'use node' references non-existent node id: ${f}`);break}default:console.warn(n);break}if(s.display==="none")return e;const a=new Ct,l=[],c=Jo(n,a,l);o&&(o.applyTransform(a),e.push(o),o.style={...s});const u=n.childNodes;for(let h=0,f=u.length;h<f;h++){const g=u[h];i&&g.nodeName!=="style"&&g.nodeName!=="defs"||Qn(g,s,e,r)}return c&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}function oi(n){const t=ei(n);return new se(Qn(t,{}),t.getAttribute("viewBox")?.trim().split(" ").map(e=>Number(e)))}function ai(n,t,e,r,i){const o=(r-t)*.5,s=(i-e)*.5,a=n*n,l=n*a;return(2*e-2*r+o+s)*l+(-3*e+3*r-2*o-s)*a+o*n+e}function ua(n,t){const e=1-n;return e*e*e*t}function fa(n,t){const e=1-n;return 3*e*e*n*t}function pa(n,t){return 3*(1-n)*n*n*t}function da(n,t){return n*n*n*t}function li(n,t,e,r,i){return ua(n,t)+fa(n,e)+pa(n,r)+da(n,i)}function ci(n,t={}){let{vertices:e=[],indices:r=[],holes:i=[],verticesStride:o=2,verticesOffset:s=e.length/o,indicesOffset:a=r.length}=t;const l=ko(n,i,2);if(l.length){for(let u=0;u<l.length;u+=3)r[a++]=l[u]+s,r[a++]=l[u+1]+s,r[a++]=l[u+2]+s;let c=s*o;for(let u=0;u<n.length;u+=2)e[c]=n[u],e[c+1]=n[u+1],c+=o}return{vertices:e,indices:r}}const ga=8,un=11920929e-14,ya=1;function ma(n,t,e,r,i,o,s,a,l=.5,c=[]){const h=Math.min(.99,Math.max(0,l));let f=(ya-h)/1;return f*=f,Jn(n,t,e,r,i,o,s,a,c,f,0),c.push(s,a),c}function Jn(n,t,e,r,i,o,s,a,l,c,u){if(u>ga)return;const h=(n+e)/2,f=(t+r)/2,g=(e+i)/2,p=(r+o)/2,y=(i+s)/2,d=(o+a)/2,M=(h+g)/2,P=(f+p)/2,w=(g+y)/2,C=(p+d)/2,v=(M+w)/2,x=(P+C)/2;if(u>0){let S=s-n,b=a-t;const D=Math.abs((e-s)*b-(r-a)*S),N=Math.abs((i-s)*b-(o-a)*S);if(D>un&&N>un){if((D+N)*(D+N)<=c*(S*S+b*b)){l.push(v,x);return}}else if(D>un){if(D*D<=c*(S*S+b*b)){l.push(v,x);return}}else if(N>un){if(N*N<=c*(S*S+b*b)){l.push(v,x);return}}else if(S=v-(n+s)/2,b=x-(t+a)/2,S*S+b*b<=c){l.push(v,x);return}}Jn(n,t,h,f,M,P,v,x,l,c,u+1),Jn(v,x,w,C,y,d,s,a,l,c,u+1)}const xa=8,va=11920929e-14,wa=1;function ba(n,t,e,r,i,o,s=.5,a=[]){const c=Math.min(.99,Math.max(0,s));let u=(wa-c)/1;return u*=u,tr(a,n,t,e,r,i,o,u,0),a.push(i,o),a}function tr(n,t,e,r,i,o,s,a,l){if(l>xa)return;const c=(t+r)/2,u=(e+i)/2,h=(r+o)/2,f=(i+s)/2,g=(c+h)/2,p=(u+f)/2;let y=o-t,d=s-e;const M=Math.abs((r-o)*d-(i-s)*y);if(M>va){if(M*M<=a*(y*y+d*d)){n.push(g,p);return}}else if(y=g-(t+o)/2,d=p-(e+s)/2,y*y+d*d<=a){n.push(g,p);return}tr(n,t,e,c,u,g,p,a,l+1),tr(n,g,p,h,f,o,s,a,l+1)}function Sa(n){return n.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Ca(n,t,e,r){const i=t.clone().sub(n),o=r.clone().sub(e),s=e.clone().sub(n),a=i.cross(o);if(a===0)return new k((n.x+e.x)/2,(n.y+e.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new k((n.x+e.x)/2,(n.y+e.y)/2):new k(n.x+l*i.x,n.y+l*i.y)}function Ma(n){let t=0;const e=n.length/2;for(let r=0;r<e;r++){const i=n[2*r],o=n[2*r+1],s=(r+1)%e,a=n[2*s],l=n[2*s+1];t+=(a-i)*(l+o)}return t}function hi(n,t,e,r,i,o){return(e-n)*(o-t)-(i-n)*(r-t)}function Pa(n,t,e){const r=e.length;let i=0;for(let o=0,s=r-2;o<r;s=o,o+=2){const a=e[o],l=e[o+1],c=e[s],u=e[s+1];l<=t?u>t&&hi(c,u,a,l,n,t)>0&&i++:u<=t&&hi(c,u,a,l,n,t)<0&&i--}return i}function _a(n){const t=n.length,e=n.map((r,i)=>({index:i,parentIndex:null,wn:0}));for(let r=0;r<t;r++){let i=null;if(Ma(n[r])<0)continue;const o=[n[r][0],n[r][1]];for(let s=0;s<t;s++){if(r===s)continue;let a=0;for(let c=0;c<o.length&&(a=a||Pa(o[c],o[c+1],n[s]),!a);c+=2);const l=Math.abs(a);l!==0&&(!i||l>Math.abs(i.wn))&&(i={idx:s,wn:a})}i&&(e[r].parentIndex=i.idx,e[r].wn=i.wn)}return e}function Ta(n,t){const e=1-n;return e*e*t}function ka(n,t){return 2*(1-n)*n*t}function Aa(n,t){return n*n*t}function ui(n,t,e,r){return Ta(n,t)+ka(n,e)+Aa(n,r)}const Oa=1e-4,fi=1e-4;function Ia(n,t={}){const{vertices:e=[],indices:r=[],lineStyle:i={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=t,a=Oa;if(n.length===0)return{vertices:e,indices:r};const l=i;let c=l.alignment;if(i.alignment!==.5){let I=Ea(n);o&&(I*=-1),c=(c-.5)*I+.5}const u={x:n[0],y:n[1]},h={x:n[n.length-2],y:n[n.length-1]},f=s,g=Math.abs(u.x-h.x)<a&&Math.abs(u.y-h.y)<a;if(f){n=n.slice(),g&&(n.pop(),n.pop(),h.x=n[n.length-2],h.y=n[n.length-1]);const I=(u.x+h.x)*.5,V=(h.y+u.y)*.5;n.unshift(I,V),n.push(I,V)}const p=e,y=n.length/2;let d=n.length;const M=p.length/2,P=l.width/2,w=P*P,C=l.miterLimit*l.miterLimit;let v=n[0],x=n[1],S=n[2],b=n[3],D=0,N=0,E=-(x-b),F=v-S,z=0,B=0,A=Math.sqrt(E*E+F*F);E/=A,F/=A,E*=P,F*=P;const W=c,O=(1-W)*2,L=W*2;f||(l.cap==="round"?d+=de(v-E*(O-L)*.5,x-F*(O-L)*.5,v-E*O,x-F*O,v+E*L,x+F*L,p,!0)+2:l.cap==="square"&&(d+=pi(v,x,E,F,O,L,!0,p))),p.push(v-E*O,x-F*O),p.push(v+E*L,x+F*L);for(let I=1;I<y-1;++I){v=n[(I-1)*2],x=n[(I-1)*2+1],S=n[I*2],b=n[I*2+1],D=n[(I+1)*2],N=n[(I+1)*2+1],E=-(x-b),F=v-S,A=Math.sqrt(E*E+F*F),E/=A,F/=A,E*=P,F*=P,z=-(b-N),B=S-D,A=Math.sqrt(z*z+B*B),z/=A,B/=A,z*=P,B*=P;const V=S-v,T=x-b,_=S-D,U=N-b,$=V*_+T*U,q=T*_-U*V,Z=q<0;if(Math.abs(q)<.001*Math.abs($)){p.push(S-E*O,b-F*O),p.push(S+E*L,b+F*L),$>=0&&(l.join==="round"?d+=de(S,b,S-E*O,b-F*O,S-z*O,b-B*O,p,!1)+4:d+=2,p.push(S-z*L,b-B*L),p.push(S+z*O,b+B*O));continue}const nt=(-E+v)*(-F+b)-(-E+S)*(-F+x),Zt=(-z+D)*(-B+b)-(-z+S)*(-B+N),Dt=(V*Zt-_*nt)/q,Mt=(U*nt-T*Zt)/q,Tt=(Dt-S)*(Dt-S)+(Mt-b)*(Mt-b),ht=S+(Dt-S)*O,kt=b+(Mt-b)*O,Vt=S-(Dt-S)*L,jt=b-(Mt-b)*L,Ft=Math.min(V*V+T*T,_*_+U*U),Xi=Z?O:L,Yl=Ft+Xi*Xi*w;Tt<=Yl?l.join==="bevel"||Tt/w>C?(Z?(p.push(ht,kt),p.push(S+E*L,b+F*L),p.push(ht,kt),p.push(S+z*L,b+B*L)):(p.push(S-E*O,b-F*O),p.push(Vt,jt),p.push(S-z*O,b-B*O),p.push(Vt,jt)),d+=2):l.join==="round"?Z?(p.push(ht,kt),p.push(S+E*L,b+F*L),d+=de(S,b,S+E*L,b+F*L,S+z*L,b+B*L,p,!0)+4,p.push(ht,kt),p.push(S+z*L,b+B*L)):(p.push(S-E*O,b-F*O),p.push(Vt,jt),d+=de(S,b,S-E*O,b-F*O,S-z*O,b-B*O,p,!1)+4,p.push(S-z*O,b-B*O),p.push(Vt,jt)):(p.push(ht,kt),p.push(Vt,jt)):(p.push(S-E*O,b-F*O),p.push(S+E*L,b+F*L),l.join==="round"?Z?d+=de(S,b,S+E*L,b+F*L,S+z*L,b+B*L,p,!0)+2:d+=de(S,b,S-E*O,b-F*O,S-z*O,b-B*O,p,!1)+2:l.join==="miter"&&Tt/w<=C&&(Z?(p.push(Vt,jt),p.push(Vt,jt)):(p.push(ht,kt),p.push(ht,kt)),d+=2),p.push(S-z*O,b-B*O),p.push(S+z*L,b+B*L),d+=2)}v=n[(y-2)*2],x=n[(y-2)*2+1],S=n[(y-1)*2],b=n[(y-1)*2+1],E=-(x-b),F=v-S,A=Math.sqrt(E*E+F*F),E/=A,F/=A,E*=P,F*=P,p.push(S-E*O,b-F*O),p.push(S+E*L,b+F*L),f||(l.cap==="round"?d+=de(S-E*(O-L)*.5,b-F*(O-L)*.5,S-E*O,b-F*O,S+E*L,b+F*L,p,!1)+2:l.cap==="square"&&(d+=pi(S,b,E,F,O,L,!1,p)));const j=fi*fi;for(let I=M;I<d+M-2;++I)v=p[I*2],x=p[I*2+1],S=p[(I+1)*2],b=p[(I+1)*2+1],D=p[(I+2)*2],N=p[(I+2)*2+1],!(Math.abs(v*(b-N)+S*(N-x)+D*(x-b))<j)&&r.push(I,I+1,I+2);return{vertices:e,indices:r}}function Ea(n){const t=n.length;if(t<6)return 1;let e=0;for(let r=0,i=n[t-2],o=n[t-1];r<t;r+=2){const s=n[r],a=n[r+1];e+=(s-i)*(a+o),i=s,o=a}return e<0?-1:1}function pi(n,t,e,r,i,o,s,a){const l=n-e*i,c=t-r*i,u=n+e*o,h=t+r*o;let f,g;s?(f=r,g=-e):(f=-r,g=e);const p=l+f,y=c+g,d=u+f,M=h+g;return a.push(p,y),a.push(d,M),2}function de(n,t,e,r,i,o,s,a){const l=e-n,c=r-t;let u=Math.atan2(l,c),h=Math.atan2(i-n,o-t);a&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let f=u;const g=h-u,p=Math.abs(g),y=Math.sqrt(l*l+c*c),d=(15*p*Math.sqrt(y)/Math.PI>>0)+1,M=g/d;if(f+=M,a){s.push(n,t),s.push(e,r);for(let P=1,w=f;P<d;P++,w+=M)s.push(n,t),s.push(n+Math.sin(w)*y,t+Math.cos(w)*y);s.push(n,t),s.push(i,o)}else{s.push(e,r),s.push(n,t);for(let P=1,w=f;P<d;P++,w+=M)s.push(n+Math.sin(w)*y,t+Math.cos(w)*y),s.push(n,t);s.push(i,o),s.push(n,t)}return d*2}class Ce{arcLengthDivision=200;_arcLengths;getPointAt(t,e=new k){return this.getPoint(this.getUToTMapping(t),e)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(t){const e=typeof t=="function";return this.getControlPointRefs().forEach(r=>{e?t(r):r.applyMatrix3(t)}),this}getUnevenVertices(t=5,e=[]){const r=new k;for(let i=0,o=Math.max(1,t)-1;i<=o;i++)this.getPoint(i/o,r),e.push(r.x,r.y);return e}getSpacedVertices(t=5,e=[]){const r=new k;for(let i=0,o=Math.max(1,t)-1;i<=o;i++)this.getPointAt(i/o,r),e.push(r.x,r.y);return e}getAdaptiveVertices(t=[]){return this.getUnevenVertices(5,t)}_verticesToPoints(t,e=[]){for(let r=0,i=t.length;r<i;r+=2){const o=t[r],s=t[r+1];e.push(new k(o,s))}return e}getSpacedPoints(t,e=[]){const r=this.getSpacedVertices(t);return this._verticesToPoints(r,e),e}getUnevenPoints(t,e=[]){const r=this.getUnevenVertices(t);return this._verticesToPoints(r,e),e}getAdaptivePoints(t=[]){const e=this.getAdaptiveVertices();return this._verticesToPoints(e,t),t}getPoints(t,e=[]){let r;return t?r=this.getUnevenVertices(t):r=this.getAdaptiveVertices(),this._verticesToPoints(r,e),e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const t=this.arcLengthDivision,e=[0];for(let r=0,i=this.getPoint(0),o=1;o<=t;o++){const s=this.getPoint(o/t);r+=s.distanceTo(i),e.push(r),i=s}this._arcLengths=e}getUToTMapping(t,e){const r=this.getLengths(),i=r.length,o=e??t*r[i-1];if(i<2)return o/r[0];let s=0,a=0,l=i-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=r[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,r[s]===o)return s/(i-1);const u=r[s],f=r[s+1]-u,g=(o-u)/f;return(s+g)/(i-1)}getTangent(t,e=new k){const i=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(i)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new k){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,i=1,o=(r+i)/2;for(;i-r>e;){o=(r+i)/2;const s=this.getPoint(o);if(s.distanceTo(t)<e)return o;s.x<t.x?r=o:i=o}return o}getMinMax(t=k.MAX,e=k.MIN){const r=this.getPoints();for(let i=0,o=r.length;i<o;i++){const s=r[i];t.min(s),e.max(s)}return{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new X(t.x,t.y,e.x-t.x,e.y-t.y)}getFillVertices(t){return this.getAdaptiveVertices()}fillTriangulate(t){return ci(this.getFillVertices(t),t)}strokeTriangulate(t){return Ia(this.getAdaptiveVertices(),t)}toCommands(){const t=[],e=this.getPoints();for(let r=0,i=e.length;r<i;r++){const o=e[r];r===0?t.push({type:"M",x:o.x,y:o.y}):t.push({type:"L",x:o.x,y:o.y})}return t}toData(){return Xo(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivision=t.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const Ba=new Ct,di=new Ct,gi=new Ct,fn=new k;class er extends Ce{constructor(t=new k,e=new k,r=new k,i=0,o=0,s=Math.PI*2,a=!1){super(),this._center=t,this._radius=e,this._diff=r,this.rotate=i,this.startAngle=o,this.endAngle=s,this.clockwise=a}get cx(){return this._center.x}set cx(t){this._center.x=t}get cy(){return this._center.y}set cy(t){this._center.y=t}get rx(){return this._radius.x}set rx(t){this._radius.x=t}get ry(){return this._radius.y}set ry(t){this._radius.y=t}get dx(){return this._diff.x}set dx(t){this._diff.x=t}get dy(){return this._diff.y}set dy(t){this._diff.y=t}isClockwise(){return this.clockwise}_getDeltaAngle(){const t=Math.PI*2;let e=this.endAngle-this.startAngle;const r=Math.abs(e)<Number.EPSILON;return e=(e%t+t)%t,r?e=0:this.clockwise||(e=e===0?-t:e-t),e}getPoint(t,e=new k){const r=this._getDeltaAngle(),i=this.startAngle+t*r;let o=this.cx+this.rx*Math.cos(i),s=this.cy+this.ry*Math.sin(i);if(this.rotate!==0){const a=Math.cos(this.rotate),l=Math.sin(this.rotate),c=o-this.cx,u=s-this.cy;o=c*a-u*l+this.cx,s=c*l+u*a+this.cy}return e.set(o,s)}toCommands(){const{cx:t,cy:e,rx:r,ry:i,startAngle:o,endAngle:s,clockwise:a,rotate:l}=this,c=t+r*Math.cos(o)*Math.cos(l)-i*Math.sin(o)*Math.sin(l),u=e+r*Math.cos(o)*Math.sin(l)+i*Math.sin(o)*Math.cos(l),h=Math.abs(o-s),f=h>Math.PI?1:0,g=a?1:0,p=l*180/Math.PI;if(h>=2*Math.PI){const y=o+Math.PI,d=t+r*Math.cos(y)*Math.cos(l)-i*Math.sin(y)*Math.sin(l),M=e+r*Math.cos(y)*Math.sin(l)+i*Math.sin(y)*Math.cos(l);return[{type:"M",x:c,y:u},{type:"A",rx:r,ry:i,angle:p,largeArcFlag:0,sweepFlag:g,x:d,y:M},{type:"A",rx:r,ry:i,angle:p,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const y=t+r*Math.cos(s)*Math.cos(l)-i*Math.sin(s)*Math.sin(l),d=e+r*Math.cos(s)*Math.sin(l)+i*Math.sin(s)*Math.cos(l);return[{type:"M",x:c,y:u},{type:"A",rx:r,ry:i,angle:p,largeArcFlag:f,sweepFlag:g,x:y,y:d}]}}drawTo(t){const{cx:e,cy:r,rx:i,ry:o,rotate:s,startAngle:a,endAngle:l,clockwise:c}=this;return t.ellipse(e,r,i,o,s,a,l,!c),this}applyTransform(t){return fn.set(this.cx,this.cy),fn.applyMatrix3(t),this.cx=fn.x,this.cy=fn.y,Ua(t)?Da(this,t):Fa(this,t),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(t=[]){const{cx:e,cy:r,rx:i,ry:o,dx:s,dy:a,startAngle:l,endAngle:c,clockwise:u,rotate:h}=this,f=!u;let g=Math.abs(l-c);(!f&&l>c||f&&c>l)&&(g=2*Math.PI-g);const p=Math.max(12,Math.floor(12*i**(1/3)*(g/Math.PI)));let y=g/p,d=l;y*=f?-1:1;const M=Math.cos(f?h:-h),P=Math.sin(f?h:-h);for(let w=0;w<p+1;w++){const C=s+Math.cos(d)*i,v=a+Math.sin(d)*o,x=C*M-v*P,S=C*P+v*M;t.push(e+x,r+S),d+=y}return t}_getAdaptiveVerticesByCircle(t=[]){const{cx:e,cy:r,rx:i,ry:o,dx:s,dy:a,rotate:l,clockwise:c}=this;if(!(i>=0&&o>=0&&s>=0&&a>=0))return t;const u=Math.ceil(2.3*Math.sqrt(i+o)),h=u*8+(s?4:0)+(a?4:0),f=[];if(h===0)return t;{const y=f.length;if(u===0)f[y]=f[y+6]=e+s,f[y+1]=f[y+3]=r+a,f[y+2]=f[y+4]=e-s,f[y+5]=f[y+7]=r-a;else{let d=y,M=y+u*4+(s?2:0)+2,P=M,w=h,C=s+i,v=a,x=e+C,S=e-C,b=r+v;if(f[d++]=x,f[d++]=b,f[--M]=b,f[--M]=S,a){const N=r-v;f[P++]=S,f[P++]=N,f[--w]=N,f[--w]=x}for(let N=1;N<u;N++){const E=Math.PI/2*(N/u),F=s+Math.cos(E)*i,z=a+Math.sin(E)*o,B=e+F,A=e-F,W=r+z,O=r-z;f[d++]=B,f[d++]=W,f[--M]=W,f[--M]=A,f[P++]=A,f[P++]=O,f[--w]=O,f[--w]=B}C=s,v=a+o,x=e+C,S=e-C,b=r+v;const D=r-v;f[d++]=x,f[d++]=b,f[--w]=D,f[--w]=x,s&&(f[d++]=S,f[d++]=b,f[--w]=D,f[--w]=S)}}const g=Math.cos(c?-l:l),p=Math.sin(c?-l:l);for(let y=0;y<f.length;y+=2){const d=f[y],M=f[y+1],P=d-e,w=M-r,C=P*g-w*p,v=P*p+w*g;t.push(e+C,r+v)}return t}getAdaptiveVertices(t=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(t):this._getAdaptiveVerticesByArc(t)}copy(t){return super.copy(t),this.cx=t.cx,this.cy=t.cy,this.rx=t.rx,this.ry=t.ry,this.dx=t.dx,this.dy=t.dy,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotate=t.rotate,this}}function Da(n,t){const e=n.rx,r=n.ry,i=Math.cos(n.rotate),o=Math.sin(n.rotate),s=new k(e*i,e*o),a=new k(-r*o,r*i),l=s.applyMatrix3(t),c=a.applyMatrix3(t),u=Ba.set(l.x,c.x,0,l.y,c.y,0,0,0,1),h=di.copy(u).invert(),p=gi.copy(h).transpose().multiply(h).elements,y=La(p[0],p[1],p[4]),d=Math.sqrt(y.rt1),M=Math.sqrt(y.rt2);if(n.rx=1/d,n.ry=1/M,n.rotate=Math.atan2(y.sn,y.cs),!((n.endAngle-n.startAngle)%(2*Math.PI)<Number.EPSILON)){const w=di.set(d,0,0,0,M,0,0,0,1),C=gi.set(y.cs,y.sn,0,-y.sn,y.cs,0,0,0,1),v=w.multiply(C).multiply(u),x=S=>{const{x:b,y:D}=new k(Math.cos(S),Math.sin(S)).applyMatrix3(v);return Math.atan2(D,b)};n.startAngle=x(n.startAngle),n.endAngle=x(n.endAngle),yi(t)&&(n.clockwise=!n.clockwise)}}function Fa(n,t){const e=mi(t),r=xi(t);n.rx*=e,n.ry*=r;const i=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);n.rotate+=i,yi(t)&&(n.startAngle*=-1,n.endAngle*=-1,n.clockwise=!n.clockwise)}function yi(n){const t=n.elements;return t[0]*t[4]-t[1]*t[3]<0}function Ua(n){const t=n.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=mi(n),i=xi(n);return Math.abs(e/(r*i))>Number.EPSILON}function mi(n){const t=n.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function xi(n){const t=n.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function La(n,t,e){let r,i,o,s,a;const l=n+e,c=n-e,u=Math.sqrt(c*c+4*t*t);return l>0?(r=.5*(l+u),a=1/r,i=n*a*e-t*a*t):l<0?i=.5*(l-u):(r=.5*u,i=-.5*u),c>0?o=c+u:o=c-u,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(t)===0?(o=1,s=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),s=a*o),c>0&&(a=o,o=-s,s=a),{rt1:r,rt2:i,cs:o,sn:s}}class $a extends er{constructor(t=0,e=0,r=1,i=0,o=Math.PI*2,s=!1){super(new k(t,e),new k(r,r),new k,0,i,o,s)}drawTo(t){const{cx:e,cy:r,rx:i,startAngle:o,endAngle:s,clockwise:a}=this;return t.arc(e,r,i,o,s,!a),this}}class Qt extends Ce{constructor(t=new k,e=new k){super(),this.p1=t,this.p2=e}static from(t,e,r,i){return new Qt(new k(t,e),new k(r,i))}getPoint(t,e=new k){return t===1?e.copy(this.p2):e.copy(this.p2).sub(this.p1).scale(t).add(this.p1),e}getPointAt(t,e=new k){return this.getPoint(t,e)}getTangent(t,e=new k){return e.subVectors(this.p2,this.p1).normalize()}getTangentAt(t,e=new k){return this.getTangent(t,e)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(t=[]){return t.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),t}getMinMax(t=k.MAX,e=k.MIN){const{p1:r,p2:i}=this;return t.x=Math.min(t.x,r.x,i.x),t.y=Math.min(t.y,r.y,i.y),e.x=Math.max(e.x,r.x,i.x),e.y=Math.max(e.y,r.y,i.y),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,p2:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}getFillVertices(t={}){const e=Math.min(this.p1.x,this.p2.x),r=Math.max(this.p1.x,this.p2.x),i=Math.min(this.p1.y,this.p2.y),o=Math.max(this.p1.y,this.p2.y),s=e,a=i,l=r-e||t.style?.strokeWidth||0,c=o-i||t.style?.strokeWidth||0;return[s,a,s+l,a,s+l,a+c,s,a+c]}drawTo(t){const{p1:e,p2:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.p2.copy(t.p2),this}}class Ge extends Ce{constructor(t=[]){super(),this.curves=t}getFlatCurves(){return this.curves.flatMap(t=>t instanceof Ge?t.getFlatCurves():t)}addCurve(t){return this.curves.push(t),this}getPoint(t,e=new k){const r=t*this.getLength(),i=this.getLengths();let o=0;for(;o<i.length;){if(i[o]>=r){const s=i[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/l,e)}o++}return e}updateLengths(){const t=[];for(let e=0,r=0,i=this.curves.length;e<i;e++)r+=this.curves[e].getLength(),t.push(r);this._arcLengths=t}getControlPointRefs(){return this.curves.flatMap(t=>t.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(t,e){const r=[t[e-1],t[e]],i=[t[e+1],t[e+2]];return r[0]===i[0]&&r[1]===i[1]&&t.splice(e+1,2),t}getSpacedVertices(t=5,e=[]){let r;return this.curves.forEach(i=>{i.getSpacedVertices(t,e),r&&this._removeNextPointIfEqualPrevPoint(e,r),r=e.length-1}),e}getAdaptiveVertices(t=[]){let e;return this.curves.forEach(r=>{r.getAdaptiveVertices(t),e&&this._removeNextPointIfEqualPrevPoint(t,e),e=t.length-1}),t}strokeTriangulate(t){return this.curves.length===1?this.curves[0].strokeTriangulate(t):super.strokeTriangulate(t)}getFillVertices(t){if(this.curves.length===1)return this.curves[0].getFillVertices(t);{const e=[];let r;return this.curves.forEach(i=>{let o;i instanceof Qt?o=i.getAdaptiveVertices():o=i.getFillVertices(t),e.push(...o),r&&this._removeNextPointIfEqualPrevPoint(e,r),r=e.length-1}),e}}applyTransform(t){return this.curves.forEach(e=>e.applyTransform(t)),this}getMinMax(t=k.MAX,e=k.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new X(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this}copy(t){return super.copy(t),this.curves=t.curves.map(e=>e.clone()),this}}class nr extends Ce{constructor(t=new k,e=new k,r=new k,i=new k){super(),this.p1=t,this.cp1=e,this.cp2=r,this.p2=i}static from(t,e,r,i,o,s,a,l){return new nr(new k(t,e),new k(r,i),new k(o,s),new k(a,l))}getPoint(t,e=new k){const{p1:r,cp1:i,cp2:o,p2:s}=this;return e.set(li(t,r.x,i.x,o.x,s.x),li(t,r.y,i.y,o.y,s.y))}getAdaptiveVertices(t=[]){return ma(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,t)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(t,e,r){const i=e*e-4*t*r;if(i<0)return[];const o=Math.sqrt(i),s=(-e+o)/(2*t),a=(-e-o)/(2*t);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(t=k.MAX,e=k.MIN){const{p1:r,cp1:i,cp2:o,p2:s}=this,a=this._solveQuadratic(3*(i.x-r.x),6*(o.x-i.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(i.y-r.y),6*(o.y-i.y),3*(s.y-o.y)),c=[0,1,...a,...l];return((h,f)=>{for(const g of h)for(let p=0;p<=f;p++){const y=p/f-.5,d=Math.min(1,Math.max(0,g+y)),M=this.getPoint(d);t.x=Math.min(t.x,M.x),t.y=Math.min(t.y,M.y),e.x=Math.max(e.x,M.x),e.y=Math.max(e.y,M.y)}})(c,10),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp1:e,cp2:r,p2:i}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:i.x,y:i.y}]}drawTo(t){const{p1:e,cp1:r,cp2:i,p2:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,i.x,i.y,o.x,o.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp1.copy(t.cp1),this.cp2.copy(t.cp2),this.p2.copy(t.p2),this}}class za extends er{constructor(t=0,e=0,r=1,i=1,o=0,s=0,a=Math.PI*2,l=!1){super(new k(t,e),new k(r,i),new k,o,s,a,l)}drawTo(t){return t.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Na extends Ge{}class rr extends Ce{constructor(t=new k,e=new k,r=new k){super(),this.p1=t,this.cp=e,this.p2=r}static from(t,e,r,i,o,s){return new rr(new k(t,e),new k(r,i),new k(o,s))}getPoint(t,e=new k){const{p1:r,cp:i,p2:o}=this;return e.set(ui(t,r.x,i.x,o.x),ui(t,r.y,i.y,o.y)),e}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(t=[]){return ba(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,t)}getMinMax(t=k.MAX,e=k.MIN){const{p1:r,cp:i,p2:o}=this,s=.5*(r.x+i.x),a=.5*(r.y+i.y),l=.5*(r.x+o.x),c=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,s,l),t.y=Math.min(t.y,r.y,o.y,a,c),e.x=Math.max(e.x,r.x,o.x,s,l),e.y=Math.max(e.y,r.y,o.y,a,c),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp:e,p2:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{p1:e,cp:r,p2:i}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,i.x,i.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp.copy(t.cp),this.p2.copy(t.p2),this}}class Va extends Na{constructor(t=0,e=0,r=0,i=0){super(),this.x=t,this.y=e,this.width=r,this.height=i,this.update()}update(){const{x:t,y:e,width:r,height:i}=this,o=[new k(t,e),new k(t+r,e),new k(t+r,e+i),new k(t,e+i)];return this.curves=[new Qt(o[0],o[1]),new Qt(o[1],o[2]),new Qt(o[2],o[3]),new Qt(o[3],o[0])],this}drawTo(t){return t.rect(this.x,this.y,this.width,this.height),this}getFillVertices(t={}){const{x:e,y:r,width:i,height:o}=this;return[e,r,e+i,r,e+i,r+o,e,r+o]}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.update(),this}}class ja extends er{constructor(t=0,e=0,r=1,i=1,o=1){super(),this.x=t,this.y=e,this.width=r,this.height=i,this.radius=o,this.update()}update(){const{x:t,y:e,width:r,height:i,radius:o}=this,s=r/2,a=i/2,l=t+s,c=e+a,u=Math.max(0,Math.min(o,Math.min(s,a))),h=u;return this._center=new k(l,c),this._radius=new k(u,h),this._diff=new k(s-u,a-h),this}drawTo(t){const{x:e,y:r,width:i,height:o,radius:s}=this;return t.roundRect(e,r,i,o,s),this}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.radius=t.radius,this.update(),this}}class Ra extends Ce{constructor(t=[]){super(),this.points=t}getPoint(t,e=new k){const{points:r}=this,i=(r.length-1)*t,o=Math.floor(i),s=i-o,a=r[o===0?o:o-1],l=r[o],c=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return e.set(ai(s,a.x,l.x,c.x,u.x),ai(s,a.y,l.y,c.y,u.y)),e}getControlPointRefs(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}class pn extends Ge{startPoint;currentPoint;autoClose=!1;constructor(t){super(),t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:i,y:o}=t[e];this.lineTo(i,o)}return this}addCommands(t){return Yr(t,this),this}addData(t){return this.addCommands(Kr(t)),this}_closeVertices(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenVertices(t=40,e=[]){return this._closeVertices(super.getUnevenVertices(t,e))}getSpacedVertices(t=40,e=[]){return this._closeVertices(super.getSpacedVertices(t,e))}getAdaptiveVertices(t=[]){return this._closeVertices(super.getAdaptiveVertices(t))}getFillVertices(t){return this._closeVertices(super.getFillVertices(t))}_setCurrentPoint(t){return this.currentPoint=new k(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const e=t.getPoint(0);(!this.currentPoint||!e.equals(this.currentPoint))&&this.lineTo(e.x,e.y)}return this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;e&&!t.equals(e)&&(this.curves.push(new Qt(e.clone(),t.clone())),e.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint=new k(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){const r=this.currentPoint;return r?.equals({x:t,y:e})||this.curves.push(Qt.from(r?.x??0,r?.y??0,t,e)),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,i,o,s){const a=this.currentPoint;return a?.equals({x:o,y:s})||this.curves.push(nr.from(a?.x??0,a?.y??0,t,e,r,i,o,s)),this._setCurrentPoint({x:o,y:s}),this}quadraticCurveTo(t,e,r,i){const o=this.currentPoint;return o?.equals({x:r,y:i})||this.curves.push(rr.from(o?.x??0,o?.y??0,t,e,r,i)),this._setCurrentPoint({x:r,y:i}),this}arc(t,e,r,i,o,s){const a=new $a(t,e,r,i,o,!s);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint(a.getPoint(1)),this}relativeArc(t,e,r,i,o,s){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.arc(t,e,r,i,o,s),this}arcTo(t,e,r,i,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,i,o,s,a,l=!0){const c=new za(t,e,r,i,o,s,a,!l);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,e,r,i,o,s,a,l){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.ellipse(t,e,r,i,o,s,a,l),this}rect(t,e,r,i){const o=new Va(t,e,r,i);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint({x:t,y:e}),this}roundRect(t,e,r,i,o){const s=new ja(t,e,r,i,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){const e=this.currentPoint??new k;return this.curves.push(new Ra([e].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=t.currentPoint?.clone(),this}}class _t extends Ge{_meta;currentCurve=new pn;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}constructor(t,e={}){super(),this.curves.push(this.currentCurve),this.style=e,t&&(t instanceof _t?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(t){return this._meta=t,this}addPath(t){const e=this.curves.findIndex(r=>r===this.currentCurve);return e>-1&&this.curves.splice(e,1),t instanceof _t?this.curves.push(...t.curves.filter(r=>r.curves.length).map(r=>r.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new pn().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,e){return this.currentCurve.currentPoint?.equals({x:t,y:e})||(this.currentCurve.curves.length&&(this.currentCurve=new pn,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,e)),this}lineTo(t,e){return this.currentCurve.lineTo(t,e),this}bezierCurveTo(t,e,r,i,o,s){return this.currentCurve.bezierCurveTo(t,e,r,i,o,s),this}quadraticCurveTo(t,e,r,i){return this.currentCurve.quadraticCurveTo(t,e,r,i),this}arc(t,e,r,i,o,s){return this.currentCurve.arc(t,e,r,i,o,s),this}arcTo(t,e,r,i,o){return this.currentCurve.arcTo(t,e,r,i,o),this}ellipse(t,e,r,i,o,s,a,l){return this.currentCurve.ellipse(t,e,r,i,o,s,a,l),this}rect(t,e,r,i){return this.currentCurve.rect(t,e,r,i),this}roundRect(t,e,r,i,o){return this.currentCurve.roundRect(t,e,r,i,o),this}reset(){return this.currentCurve=new pn,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return Yr(t,this),this}addData(t){return this.addCommands(Kr(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,e=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getFlatCurves(),r=[],i=[],o=[];e.forEach((a,l)=>{const c=a.getControlPointRefs(),u=a.isClockwise();o[l]=c,i[l]=u;const h=c[0],f=c[c.length-1]??h;r.push({start:u?f:h,end:u?h:f,index:l})});const s=[];return r.forEach((a,l)=>{s[l]=[],r.forEach((c,u)=>{c.start&&a.end&&u!==l&&c.start?.equals(a.end)&&s[l].push(c.index)})}),e.forEach((a,l)=>{const c=i[l];o[l].forEach(u=>{u.add(a.getNormal(a.getTForPoint(u)).scale(c?t:-t))})}),s.forEach((a,l)=>{const c=o[l];a.forEach(u=>{const h=o[u],f=Ca(c[c.length-1],c[c.length-2]??c[c.length-1],h[0],h[1]??h[0]);f&&(c[c.length-1].copy(f),h[0].copy(f))})}),this}getMinMax(t=k.MAX,e=k.MIN,r=!0){const i=this.strokeWidth;return this.curves.forEach(o=>{if(o.getMinMax(t,e),r&&i>1){const s=i/2,a=o.isClockwise(),l=[];for(let c=0;c<=1;c+=1/o.arcLengthDivision){const u=o.getPoint(c),h=o.getNormal(c),f=h.clone().scale(a?s:-s),g=h.clone().scale(a?-s:s);l.push(u.clone().add(f),u.clone().add(g),u.clone().add({x:s,y:0}),u.clone().add({x:-s,y:0}),u.clone().add({x:0,y:s}),u.clone().add({x:0,y:-s}),u.clone().add({x:s,y:s}),u.clone().add({x:-s,y:-s}))}t.min(...l),e.max(...l)}}),{min:t.finite(),max:e.finite()}}strokeTriangulate(t){const e=t?.indices??[],r=t?.vertices??[];return this.curves.forEach(i=>{i.strokeTriangulate({...t,indices:e,vertices:r,style:{...this.style}})}),{indices:e,vertices:r}}fillTriangulate(t){const e={...t,style:{...this.style,...t?.style}},r=e.indices??[],i=e.vertices??[];if((e.style.fillRule??"nonzero")==="nonzero"){const s=this.curves.map(c=>c.getFillVertices(e)),a=_a(s),l=a.length;for(let c=0;c<l;c++){const u=a[c],h=s[c];if(u.wn||!h.length)continue;const f=h.slice(),g=[];for(let p=0;p<l;p++){const y=a[p];y.parentIndex===c&&(g.push(f.length/2),f.push(...s[y.index]))}ci(f,{...t,indices:r,vertices:i,holes:g,style:{...this.style}})}}else this.curves.forEach(s=>{s.fillTriangulate({...t,indices:r,vertices:i,style:{...this.style}})});return{indices:r,vertices:i}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new X(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:i="none"}=e;return t.beginPath(),t.save(),Yn(t,e),this.curves.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:i="none"}=e;return t.beginPath(),t.save(),Yn(t,e),this.getControlPointRefs().forEach(o=>{qo(t,o.x,o.y,{radius:4})}),r!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const i in t)t[i]!==void 0&&(e[Sa(i)]=t[i]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const i in e)e[i]!==void 0&&(r+=`${i}:${e[i]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class se{constructor(t=[],e){this.paths=t,this.viewBox=e}getBoundingBox(t=!0){if(!this.paths.length)return;const e=k.MAX,r=k.MIN;return this.paths.forEach(i=>i.getMinMax(e,r,t)),new X(e.x,e.y,r.x-e.x,r.y-e.y)}toTriangulatedSvgString(t=this.paths.map(r=>r.fillTriangulate()),e=0){let r="";const i={x:-e,y:-e},o={x:e,y:e};(Array.isArray(t)?t:[t]).forEach(({vertices:l,indices:c})=>{const u=h=>{const f=l[h*2],g=l[h*2+1];return i.x=Math.min(i.x,f+e),o.x=Math.max(o.x,f+e),i.y=Math.min(i.y,g+e),o.y=Math.max(o.y,g+e),[f,g]};for(let h=0,f=c.length;h<f;h+=3){const g=u(c[h]),p=u(c[h+1]),y=u(c[h+2]);r+=`<polygon points="${g.join(",")} ${p.join(",")} ${y.join(",")}" stroke="none" fill="black" />`}});const a=[i.x,i.y,o.x-i.x,o.y-i.y];return`<svg width="${a[2]}" height="${a[3]}" viewBox="${a.join(" ")}" xmlns="http://www.w3.org/2000/svg">${r}</svg>`}toTriangulatedSvg(t,e){return new DOMParser().parseFromString(this.toTriangulatedSvgString(t,e),"image/svg+xml").documentElement}toSvgString(){const{x:t,y:e,width:r,height:i}=this.getBoundingBox(),o=this.paths.map(s=>s.toSvgPathString()).join("");return`<svg viewBox="${t} ${e} ${r} ${i}" width="${r}px" height="${i}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...r}=t,{left:i,top:o,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*e,l.height=a*e,l.style.width=`${s}px`,l.style.height=`${a}px`;const c=l.getContext("2d");return c&&(c.scale(e,e),c.translate(-i,-o),this.paths.forEach(u=>{u.drawTo(c,r)})),l}}const Ga=new Set(["©","®","÷"]),qa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),Wa={1:"italic",32:"bold"},Ha={1:"italic",2:"bold"},vi={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class wi{constructor(t,e,r){this.content=t,this.index=e,this.parent=r}path=new _t().setMeta(this);lineBox=new X;inlineBox=new X;glyphBox;advanceWidth=0;advanceHeight=0;underlinePosition=0;underlineThickness=0;strikeoutPosition=0;strikeoutSize=0;ascender=0;descender=0;typoAscender=0;typoDescender=0;typoLineGap=0;winAscent=0;winDescent=0;xHeight=0;capHeight=0;baseline=0;centerDiviation=0;fontStyle;get compatibleGlyphBox(){const t=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new X(this.lineBox.left+this.lineBox.width/2-t/2,this.lineBox.top,t,this.lineBox.height):new X(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-t/2,this.lineBox.width,t))}get center(){return this.compatibleGlyphBox.center}get computedFill(){return this.parent.computedFill}get computedOutline(){return this.parent.computedOutline}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSFNT(t){const e=this.computedStyle.fontFamily,r=t??To;let o=(e?r.get(e):r.fallbackFont)?.getSFNT();return o?.textToGlyphIndexes(this.content).includes(0)&&(o=r.fallbackFont?.getSFNT()),o}updateGlyph(t=this._getFontSFNT()){if(!t)return this;const{hhea:e,os2:r,post:i,head:o}=t,s=o.unitsPerEm,a=e.ascent,l=e.descent,{content:c,computedStyle:u,isVertical:h}=this,{fontSize:f}=u,g=s/f,p=t.getAdvanceWidth(c,f),y=(a+Math.abs(l))/g,d=a/g;return this.advanceWidth=p,this.advanceHeight=y,this.inlineBox.width=h?y:p,this.inlineBox.height=h?p:y,this.underlinePosition=(a-i.underlinePosition)/g,this.underlineThickness=i.underlineThickness/g,this.strikeoutPosition=(a-r.yStrikeoutPosition)/g,this.strikeoutSize=r.yStrikeoutSize/g,this.ascender=a/g,this.descender=l/g,this.typoAscender=r.sTypoAscender/g,this.typoDescender=r.sTypoDescender/g,this.typoLineGap=r.sTypoLineGap/g,this.winAscent=r.usWinAscent/g,this.winDescent=r.usWinDescent/g,this.xHeight=r.sxHeight/g,this.capHeight=r.sCapHeight/g,this.baseline=d,this.centerDiviation=y/2-d,this.fontStyle=Wa[r.fsSelection]??Ha[o.macStyle],this}update(t){const e=this._getFontSFNT(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:i,computedStyle:o,baseline:s,inlineBox:a,ascender:l,descender:c,typoAscender:u,fontStyle:h,advanceWidth:f,advanceHeight:g}=this,{left:p,top:y}=a,d=o.fontStyle==="italic"&&h!=="italic";let M=p,P=y+s,w;const C=new _t().setMeta(this);if(r&&(M+=(g-f)/2,Math.abs(f-g)>.1&&(P-=(l-u)/(l+Math.abs(c))*g),w=void 0),r&&!Ga.has(i)&&(i.codePointAt(0)<=256||qa.has(i))){C.addCommands(e.getPathCommands(i,M,y+s-(g-f)/2,o.fontSize));const x={y:y-(g-f)/2+g/2,x:M+f/2};d&&this._italic(C,r?{x:x.x,y:y-(g-f)/2+s}:void 0),C.rotate(90,x)}else w!==void 0?(C.addCommands(e.glyphs.get(w).getPathCommands(M,P,o.fontSize)),d&&this._italic(C,r?{x:M+f/2,y:y+u/(l+Math.abs(c))*g}:void 0)):(C.addCommands(e.getPathCommands(i,M,P,o.fontSize)),d&&this._italic(C,r?{x:M+g/2,y:P}:void 0));const v=o.fontWeight??400;return v in vi&&(v===700||v==="bold")&&h!=="bold"&&C.bold(vi[v]*o.fontSize*.05),C.style={fill:this.computedFill??o.color,fillRule:"nonzero",stroke:this.computedOutline??(o.textStrokeWidth?o.textStrokeColor:"none"),strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(t,e){t.skew(-.24,0,e||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(t,e,r){if(this.path.curves[0]?.curves.length)return this.path.getMinMax(t,e,r)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:r,max:i}=e;return new X(r.x,r.y,i.x-r.x,i.y-r.y)}drawTo(t,e={}){const r=this.computedStyle,i={ctx:t,path:this.path,fontSize:r.fontSize,color:r.color,...e};if(this.glyphBox)he(i);else{t.save(),t.beginPath();const o=this.path.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*i.fontSize,shadowOffsetY:(i.shadowOffsetY??0)*i.fontSize,shadowBlur:(i.shadowBlur??0)*i.fontSize,shadowColor:i.shadowColor};Yn(t,s),t.font=`${i.fontSize}px ${i.fontFamily}`,this.isVertical?(t.textBaseline="middle",t.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(t.textBaseline="alphabetic",t.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),t.restore()}}}function ir(){const n=new Map;async function t(r){if(!n.has(r)){n.set(r,r);try{n.set(r,await fetch(r).then(i=>i.text()))}catch(i){console.warn(i),n.delete(r)}}}function e(r){return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("blob://")}return{loaded:n,needsLoad:e,load:t}}function sr(n){const t=new Map;function e(r){let i=t.get(r);if(!i){const o=ei(n.needsLoad(r)?n.loaded.get(r)??r:r),s=oi(o);i={dom:o,pathSet:s},t.set(r,i)}return i}return{parsed:t,parse:e}}var Xa={grad:.9,turn:360,rad:360/(2*Math.PI)},Jt=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},at=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*n)/e+0},Et=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),n>e?e:n>t?n:t},bi=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},Si=function(n){return{r:Et(n.r,0,255),g:Et(n.g,0,255),b:Et(n.b,0,255),a:Et(n.a)}},or=function(n){return{r:at(n.r),g:at(n.g),b:at(n.b),a:at(n.a,3)}},Za=/^#([0-9a-f]{3,8})$/i,dn=function(n){var t=n.toString(16);return t.length<2?"0"+t:t},Ci=function(n){var t=n.r,e=n.g,r=n.b,i=n.a,o=Math.max(t,e,r),s=o-Math.min(t,e,r),a=s?o===t?(e-r)/s:o===e?2+(r-t)/s:4+(t-e)/s:0;return{h:60*(a<0?a+6:a),s:o?s/o*100:0,v:o/255*100,a:i}},Mi=function(n){var t=n.h,e=n.s,r=n.v,i=n.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),s=r*(1-e),a=r*(1-(t-o)*e),l=r*(1-(1-t+o)*e),c=o%6;return{r:255*[r,a,s,s,l,r][c],g:255*[l,r,r,a,s,s][c],b:255*[s,s,l,r,r,a][c],a:i}},Pi=function(n){return{h:bi(n.h),s:Et(n.s,0,100),l:Et(n.l,0,100),a:Et(n.a)}},_i=function(n){return{h:at(n.h),s:at(n.s),l:at(n.l),a:at(n.a,3)}},Ti=function(n){return Mi((e=(t=n).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},qe=function(n){return{h:(t=Ci(n)).h,s:(i=(200-(e=t.s))*(r=t.v)/100)>0&&i<200?e*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,r,i},Ya=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ka=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qa=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ja=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ki={string:[[function(n){var t=Za.exec(n);return t?(n=t[1]).length<=4?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?at(parseInt(n[3]+n[3],16)/255,2):1}:n.length===6||n.length===8?{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16),a:n.length===8?at(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var t=Qa.exec(n)||Ja.exec(n);return t?t[2]!==t[4]||t[4]!==t[6]?null:Si({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(n){var t=Ya.exec(n)||Ka.exec(n);if(!t)return null;var e,r,i=Pi({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(Xa[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Ti(i)},"hsl"]],object:[[function(n){var t=n.r,e=n.g,r=n.b,i=n.a,o=i===void 0?1:i;return Jt(t)&&Jt(e)&&Jt(r)?Si({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(n){var t=n.h,e=n.s,r=n.l,i=n.a,o=i===void 0?1:i;if(!Jt(t)||!Jt(e)||!Jt(r))return null;var s=Pi({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Ti(s)},"hsl"],[function(n){var t=n.h,e=n.s,r=n.v,i=n.a,o=i===void 0?1:i;if(!Jt(t)||!Jt(e)||!Jt(r))return null;var s=(function(a){return{h:bi(a.h),s:Et(a.s,0,100),v:Et(a.v,0,100),a:Et(a.a)}})({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Mi(s)},"hsv"]]},Ai=function(n,t){for(var e=0;e<t.length;e++){var r=t[e][0](n);if(r)return[r,t[e][1]]}return[null,void 0]},tl=function(n){return typeof n=="string"?Ai(n.trim(),ki.string):typeof n=="object"&&n!==null?Ai(n,ki.object):[null,void 0]},ar=function(n,t){var e=qe(n);return{h:e.h,s:Et(e.s+100*t,0,100),l:e.l,a:e.a}},lr=function(n){return(299*n.r+587*n.g+114*n.b)/1e3/255},Oi=function(n,t){var e=qe(n);return{h:e.h,s:e.s,l:Et(e.l+100*t,0,100),a:e.a}},Ii=(function(){function n(t){this.parsed=tl(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return n.prototype.isValid=function(){return this.parsed!==null},n.prototype.brightness=function(){return at(lr(this.rgba),2)},n.prototype.isDark=function(){return lr(this.rgba)<.5},n.prototype.isLight=function(){return lr(this.rgba)>=.5},n.prototype.toHex=function(){return t=or(this.rgba),e=t.r,r=t.g,i=t.b,s=(o=t.a)<1?dn(at(255*o)):"","#"+dn(e)+dn(r)+dn(i)+s;var t,e,r,i,o,s},n.prototype.toRgb=function(){return or(this.rgba)},n.prototype.toRgbString=function(){return t=or(this.rgba),e=t.r,r=t.g,i=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+i+", "+o+")":"rgb("+e+", "+r+", "+i+")";var t,e,r,i,o},n.prototype.toHsl=function(){return _i(qe(this.rgba))},n.prototype.toHslString=function(){return t=_i(qe(this.rgba)),e=t.h,r=t.s,i=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+i+"%, "+o+")":"hsl("+e+", "+r+"%, "+i+"%)";var t,e,r,i,o},n.prototype.toHsv=function(){return t=Ci(this.rgba),{h:at(t.h),s:at(t.s),v:at(t.v),a:at(t.a,3)};var t},n.prototype.invert=function(){return Xt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},n.prototype.saturate=function(t){return t===void 0&&(t=.1),Xt(ar(this.rgba,t))},n.prototype.desaturate=function(t){return t===void 0&&(t=.1),Xt(ar(this.rgba,-t))},n.prototype.grayscale=function(){return Xt(ar(this.rgba,-1))},n.prototype.lighten=function(t){return t===void 0&&(t=.1),Xt(Oi(this.rgba,t))},n.prototype.darken=function(t){return t===void 0&&(t=.1),Xt(Oi(this.rgba,-t))},n.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},n.prototype.alpha=function(t){return typeof t=="number"?Xt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):at(this.rgba.a,3);var e},n.prototype.hue=function(t){var e=qe(this.rgba);return typeof t=="number"?Xt({h:t,s:e.s,l:e.l,a:e.a}):at(e.h)},n.prototype.isEqual=function(t){return this.toHex()===Xt(t).toHex()},n})(),Xt=function(n){return n instanceof Ii?n:new Ii(n)};function tt(n){return n==null||n==="none"}function Me(n,t=0,e=10**t){return Math.round(e*n)/e+0}function zt(n,t=!1){if(typeof n!="object"||!n)return n;if(Array.isArray(n))return t?n.map(r=>zt(r,t)):n;const e={};for(const r in n){const i=n[r];i!=null&&(t?e[r]=zt(i,t):e[r]=i)}return e}function el(n,t){const e={};return t.forEach(r=>{r in n&&(e[r]=n[r])}),e}function cr(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){const e=Array.from(new Set([...Object.keys(n),...Object.keys(t)]));return!e.length||e.every(r=>n[r]===t[r])}return!1}function nl(n,t,e){const r=t.length-1;if(r<0)return n===void 0?e:n;for(let i=0;i<r;i++){if(n==null)return e;n=n[t[i]]}return n==null||n[t[r]]===void 0?e:n[t[r]]}function rl(n,t,e){const r=t.length-1;for(let i=0;i<r;i++)typeof n[t[i]]!="object"&&(n[t[i]]={}),n=n[t[i]];n[t[r]]=e}function il(n,t,e){return n==null||!t||typeof t!="string"?e:n[t]!==void 0?n[t]:(t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,""),nl(n,t.split("."),e))}function sl(n,t,e){if(!(typeof n!="object"||!t))return t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,""),rl(n,t.split("."),e)}class ol{_observers=new Map;on(t,e){let r=this._observers.get(t);return r===void 0&&this._observers.set(t,r=new Set),r.add(e),this}once(t,e){const r=(...i)=>{this.off(t,r),e(...i)};return this.on(t,r),this}off(t,e){const r=this._observers.get(t);return r!==void 0&&(r.delete(e),r.size===0&&this._observers.delete(t)),this}emit(t,...e){return Array.from((this._observers.get(t)||new Map).values()).forEach(r=>r(...e)),this}destroy(){this._observers=new Map}}const hr=Symbol("properties"),Ei=Symbol("inited");function ur(n){let t;if(Object.hasOwn(n,hr))t=n[hr];else{const e=Object.getPrototypeOf(n);t=new Map(e?ur(e):void 0),n[hr]=t}return t}function al(n){return`__internal:${n}`}function ll(n,t={}){const e=al(n),{default:r,fallback:i,alias:o,internal:s}=t,a=()=>typeof r=="function"?r():r,l=()=>typeof i=="function"?i():i;function c(){let h;if(o&&o!==n?h=il(this,o):!s&&typeof this.getProperty<"u"?h=this.getProperty(n):h=this[e],h=h??l(),h===void 0&&r!==void 0&&!this[Ei]){this[Ei]=!0;const f=a();f!==void 0&&(u.call(this,f),h=f)}return h}function u(h){const f=c.call(this);o&&o!==n?sl(this,o,h):!s&&typeof this.setProperty<"u"?this.setProperty(n,h):this[e]=h,this.onUpdateProperty?.(n,h,f)}return{get:c,set:u}}function cl(n,t,e={}){ur(n).set(t,e);const r=ll(t,e);Object.defineProperty(n.prototype,t,{get(){return r.get.call(this)},set(i){r.set.call(this,i)},configurable:!0,enumerable:!0})}function oe(n){return function(t,e){if(typeof e!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");cl(t.constructor,e,n)}}class hl extends ol{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(t){super(),this.setProperties(t)}isDirty(t){return t?this._updatedProperties.has(t):this._updatedProperties.size>0}offsetGet(t){return this[t]}offsetSet(t,e){this[t]=e}getProperty(t,e){return this._propertyAccessor?.getProperty?this._propertyAccessor.getProperty(t,e):this._properties.get(t)??e}setProperty(t,e){this._propertyAccessor?.setProperty?.(t,e),this._properties.set(t,e)}getProperties(t){const e={};for(const[r,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!t||t.includes(r))&&(e[r]=this.getProperty(r));return e}setProperties(t){if(t&&typeof t=="object")for(const[e]of this.getPropertyDeclarations())e in t&&this.offsetSet(e,t[e]);return this}resetProperties(){for(const[t,e]of this.getPropertyDeclarations())this.offsetSet(t,typeof e.default=="function"?e.default():e.default);return this}getPropertyDeclarations(){return ur(this.constructor)}getPropertyDeclaration(t){return this.getPropertyDeclarations().get(t)}setPropertyAccessor(t){return this._propertyAccessor=t,this.getPropertyDeclarations().forEach((e,r)=>{const i=this.offsetGet(r),o=this._properties.get(r);i===void 0?o!==void 0&&this.offsetSet(r,o):i!==o&&this.offsetSet(r,i)}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(t=>globalThis.requestAnimationFrame(t)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(t){Promise.reject(t)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(t,e,r){this.requestUpdate(t,e,r)}requestUpdate(t,e,r){t!==void 0&&(this._updatedProperties.set(t,r),this._changedProperties.add(t),this._updateProperty(t,e,r),this.emit("updateProperty",t,e,r)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(t){}_updateProperty(t,e,r){}toJSON(){const t={};return this._properties.forEach((e,r)=>{e!==void 0&&(e&&typeof e=="object"?"toJSON"in e&&typeof e.toJSON=="function"?t[r]=e.toJSON():Array.isArray(e)?t[r]=[...e]:t[r]={...e}:t[r]=e)}),t}clone(){return new this.constructor(this.toJSON())}}function Bi(n){let t;return typeof n=="number"?t={r:n>>24&255,g:n>>16&255,b:n>>8&255,a:(n&255)/255}:t=n,Xt(t)}function ul(n){return{r:Me(n.r),g:Me(n.g),b:Me(n.b),a:Me(n.a,3)}}function gn(n){const t=n.toString(16);return t.length<2?`0${t}`:t}const fl="#000000FF";function pl(n){return Bi(n).isValid()}function Bt(n,t=!1){const e=Bi(n);if(!e.isValid()){if(typeof n=="string")return n;const a=`Failed to normalizeColor ${n}`;if(t)throw new Error(a);return console.warn(a),fl}const{r,g:i,b:o,a:s}=ul(e.rgba);return`#${gn(r)}${gn(i)}${gn(o)}${gn(Me(s*255))}`}var yn=yn||{};yn.parse=(function(){const n={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let t="";function e(T){const _=new Error(`${t}: ${T}`);throw _.source=t,_}function r(){const T=i();return t.length>0&&e("Invalid input not EOF"),T}function i(){return w(o)}function o(){return s("linear-gradient",n.linearGradient,l)||s("repeating-linear-gradient",n.repeatingLinearGradient,l)||s("radial-gradient",n.radialGradient,h)||s("repeating-radial-gradient",n.repeatingRadialGradient,h)}function s(T,_,U){return a(_,$=>{const q=U();return q&&(I(n.comma)||e("Missing comma before color stops")),{type:T,orientation:q,colorStops:w(C)}})}function a(T,_){const U=I(T);if(U){I(n.startCall)||e("Missing (");const $=_(U);return I(n.endCall)||e("Missing )"),$}}function l(){const T=c();if(T)return T;const _=j("position-keyword",n.positionKeywords,1);return _?{type:"directional",value:_.value}:u()}function c(){return j("directional",n.sideOrCorner,1)}function u(){return j("angular",n.angleValue,1)||j("angular",n.radianValue,1)}function h(){let T,_=f(),U;return _&&(T=[],T.push(_),U=t,I(n.comma)&&(_=f(),_?T.push(_):t=U)),T}function f(){let T=g()||p();if(T)T.at=d();else{const _=y();if(_){T=_;const U=d();U&&(T.at=U)}else{const U=d();if(U)T={type:"default-radial",at:U};else{const $=M();$&&(T={type:"default-radial",at:$})}}}return T}function g(){const T=j("shape",/^(circle)/i,0);return T&&(T.style=L()||y()),T}function p(){const T=j("shape",/^(ellipse)/i,0);return T&&(T.style=M()||A()||y()),T}function y(){return j("extent-keyword",n.extentKeywords,1)}function d(){if(j("position",/^at/,0)){const T=M();return T||e("Missing positioning value"),T}}function M(){const T=P();if(T.x||T.y)return{type:"position",value:T}}function P(){return{x:A(),y:A()}}function w(T){let _=T();const U=[];if(_)for(U.push(_);I(n.comma);)_=T(),_?U.push(_):e("One extra comma");return U}function C(){const T=v();return T||e("Expected color definition"),T.length=A(),T}function v(){return S()||F()||E()||D()||b()||N()||x()}function x(){return j("literal",n.literalColor,0)}function S(){return j("hex",n.hexColor,1)}function b(){return a(n.rgbColor,()=>({type:"rgb",value:w(B)}))}function D(){return a(n.rgbaColor,()=>({type:"rgba",value:w(B)}))}function N(){return a(n.varColor,()=>({type:"var",value:z()}))}function E(){return a(n.hslColor,()=>{I(n.percentageValue)&&e("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const _=B();I(n.comma);let U=I(n.percentageValue);const $=U?U[1]:null;I(n.comma),U=I(n.percentageValue);const q=U?U[1]:null;return(!$||!q)&&e("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[_,$,q]}})}function F(){return a(n.hslaColor,()=>{const T=B();I(n.comma);let _=I(n.percentageValue);const U=_?_[1]:null;I(n.comma),_=I(n.percentageValue);const $=_?_[1]:null;I(n.comma);const q=B();return(!U||!$)&&e("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[T,U,$,q]}})}function z(){return I(n.variableName)[1]}function B(){return I(n.number)[1]}function A(){return j("%",n.percentageValue,1)||W()||O()||L()}function W(){return j("position-keyword",n.positionKeywords,1)}function O(){return a(n.calcValue,()=>{let T=1,_=0;for(;T>0&&_<t.length;){const $=t.charAt(_);$==="("?T++:$===")"&&T--,_++}T>0&&e("Missing closing parenthesis in calc() expression");const U=t.substring(0,_-1);return V(_-1),{type:"calc",value:U}})}function L(){return j("px",n.pixelValue,1)||j("em",n.emValue,1)}function j(T,_,U){const $=I(_);if($)return{type:T,value:$[U]}}function I(T){let _,U;return U=/^\s+/.exec(t),U&&V(U[0].length),_=T.exec(t),_&&V(_[0].length),_}function V(T){t=t.substr(T)}return function(T){return t=T.toString().trim(),t.endsWith(";")&&(t=t.slice(0,-1)),r()}})();const dl=yn.parse.bind(yn);var mn=mn||{};mn.stringify=(function(){var n={"visit_linear-gradient":function(t){return n.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return n.visit_gradient(t)},"visit_radial-gradient":function(t){return n.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return n.visit_gradient(t)},visit_gradient:function(t){var e=n.visit(t.orientation);return e&&(e+=", "),t.type+"("+e+n.visit(t.colorStops)+")"},visit_shape:function(t){var e=t.value,r=n.visit(t.at),i=n.visit(t.style);return i&&(e+=" "+i),r&&(e+=" at "+r),e},"visit_default-radial":function(t){var e="",r=n.visit(t.at);return r&&(e+=r),e},"visit_extent-keyword":function(t){var e=t.value,r=n.visit(t.at);return r&&(e+=" at "+r),e},"visit_position-keyword":function(t){return t.value},visit_position:function(t){return n.visit(t.value.x)+" "+n.visit(t.value.y)},"visit_%":function(t){return t.value+"%"},visit_em:function(t){return t.value+"em"},visit_px:function(t){return t.value+"px"},visit_calc:function(t){return"calc("+t.value+")"},visit_literal:function(t){return n.visit_color(t.value,t)},visit_hex:function(t){return n.visit_color("#"+t.value,t)},visit_rgb:function(t){return n.visit_color("rgb("+t.value.join(", ")+")",t)},visit_rgba:function(t){return n.visit_color("rgba("+t.value.join(", ")+")",t)},visit_hsl:function(t){return n.visit_color("hsl("+t.value[0]+", "+t.value[1]+"%, "+t.value[2]+"%)",t)},visit_hsla:function(t){return n.visit_color("hsla("+t.value[0]+", "+t.value[1]+"%, "+t.value[2]+"%, "+t.value[3]+")",t)},visit_var:function(t){return n.visit_color("var("+t.value+")",t)},visit_color:function(t,e){var r=t,i=n.visit(e.length);return i&&(r+=" "+i),r},visit_angular:function(t){return t.value+"deg"},visit_directional:function(t){return"to "+t.value},visit_array:function(t){var e="",r=t.length;return t.forEach(function(i,o){e+=n.visit(i),o<r-1&&(e+=", ")}),e},visit_object:function(t){return t.width&&t.height?n.visit(t.width)+" "+n.visit(t.height):""},visit:function(t){if(!t)return"";if(t instanceof Array)return n.visit_array(t);if(typeof t=="object"&&!t.type)return n.visit_object(t);if(t.type){var e=n["visit_"+t.type];if(e)return e(t);throw Error("Missing visitor visit_"+t.type)}else throw Error("Invalid node.")}};return function(t){return n.visit(t)}})(),mn.stringify.bind(mn);function Di(n){const t=n.length-1;return n.map((e,r)=>{const i=e.value;let o=Me(r/t,3),s="#00000000";switch(e.type){case"rgb":s=Bt({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=Bt({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=Bt(e.value);break;case"hex":s=Bt(`#${e.value}`);break}switch(e.length?.type){case"%":o=Number(e.length.value)/100;break}return{offset:o,color:s}})}function Fi(n){let t=0;switch(n.orientation?.type){case"angular":t=Number(n.orientation.value);break}return{type:"linear-gradient",angle:t,stops:Di(n.colorStops)}}function Ui(n){return n.orientation?.map(t=>{switch(t?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:Di(n.colorStops)}}function xn(n){return n.startsWith("linear-gradient(")||n.startsWith("radial-gradient(")}function gl(n){return dl(n).map(t=>{switch(t?.type){case"linear-gradient":return Fi(t);case"repeating-linear-gradient":return{...Fi(t),repeat:!0};case"radial-gradient":return Ui(t);case"repeating-radial-gradient":return{...Ui(t),repeat:!0};default:return}}).filter(Boolean)}function yl(n){let t;return typeof n=="string"?t={color:n}:t=n,{color:Bt(t.color)}}function ml(n){let t;if(typeof n=="string"?t={image:n}:t=n,t.image){const{type:e,...r}=gl(t.image)[0]??{};switch(e){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return t}function xl(n){let t;return typeof n=="string"?t={image:n}:t=n,t}function vl(n){let t;return typeof n=="string"?t={preset:n}:t=n,{preset:t.preset,foregroundColor:tt(t.foregroundColor)?void 0:Bt(t.foregroundColor),backgroundColor:tt(t.backgroundColor)?void 0:Bt(t.backgroundColor)}}function wl(n){return!tt(n.color)}function bl(n){return typeof n=="string"?pl(n):wl(n)}function Sl(n){return!tt(n.image)&&xn(n.image)||!!n.linearGradient||!!n.radialGradient}function Cl(n){return typeof n=="string"?xn(n):Sl(n)}function Ml(n){return!tt(n.image)&&!xn(n.image)}function Pl(n){return typeof n=="string"?!xn(n):Ml(n)}function _l(n){return!tt(n.preset)}function Tl(n){return typeof n=="string"?!1:_l(n)}function We(n){const t=n&&typeof n=="object"?n.enabled:void 0;return bl(n)?zt({enabled:t,...yl(n)}):Cl(n)?zt({enabled:t,...ml(n)}):Pl(n)?zt({enabled:t,...xl(n)}):Tl(n)?zt({enabled:t,...vl(n)}):{}}function fr(n){return typeof n=="string"?{...We(n)}:{...We(n),...el(n,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function kl(){return{boxShadow:"none"}}function Al(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Ol(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function Il(){return{...Al(),...Ol(),...kl(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function El(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function Bl(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function Dl(){return{...El(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function Fl(){return{...Bl(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Ul(){return{...Fl(),...Dl(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function vn(n){return zt({...n,color:tt(n.color)?void 0:Bt(n.color),backgroundColor:tt(n.backgroundColor)?void 0:Bt(n.backgroundColor),borderColor:tt(n.borderColor)?void 0:Bt(n.borderColor),outlineColor:tt(n.outlineColor)?void 0:Bt(n.outlineColor),shadowColor:tt(n.shadowColor)?void 0:Bt(n.shadowColor)})}function Ll(){return{...Il(),...Ul()}}const $l=/\r\n|\n\r|\n|\r/,zl=new RegExp(`^(${$l.source})$`),Nl=`
|
|
6
|
-
`;function Vl(n){return zl.test(n)}function Li(n){const t=[];function e(){return t[t.length-1]}function r(a,l,c){const u=a?vn(a):{},h=l?We(l):void 0,f=c?fr(c):void 0,g=zt({...u,fill:h,outline:f,fragments:[]});return t[t.length-1]?.fragments.length===0?t[t.length-1]=g:t.push(g),g}function i(a="",l,c,u){const h=l?vn(l):{},f=c?We(c):void 0,g=u?fr(u):void 0;Array.from(a).forEach(p=>{if(Vl(p)){const{fragments:y,fill:d,outline:M,...P}=e()||r();y.length||y.push(zt({...h,fill:f,outline:g,content:Nl})),r(P,d,M)}else{const y=e()||r(),d=y.fragments[y.fragments.length-1];if(d){const{content:M,fill:P,outline:w,...C}=d;if(cr(f,P)&&cr(g,w)&&cr(h,C)){d.content=`${M}${p}`;return}}y.fragments.push(zt({...h,fill:f,outline:g,content:p}))}})}(Array.isArray(n)?n:[n]).forEach(a=>{if(typeof a=="string")r(),i(a);else if($i(a)){const{content:l,fill:c,outline:u,...h}=a;r(h,c,u),i(l)}else if(jl(a)){const{fragments:l,fill:c,outline:u,...h}=a;r(h,c,u),l.forEach(f=>{const{content:g,fill:p,outline:y,...d}=f;i(g,d,p,y)})}else Array.isArray(a)?(r(),a.forEach(l=>{if(typeof l=="string")i(l);else if($i(l)){const{content:c,fill:u,outline:h,...f}=l;i(c,f,u,h)}})):console.warn("Failed to parse text content",a)});const s=e();return s&&!s.fragments.length&&s.fragments.push({content:""}),t}function jl(n){return n&&typeof n=="object"&&"fragments"in n&&Array.isArray(n.fragments)}function $i(n){return n&&typeof n=="object"&&"content"in n&&typeof n.content=="string"}function Rl(n){return typeof n=="string"||Array.isArray(n)?{content:Li(n)}:zt({...n,content:Li(n.content??""),style:n.style?vn(n.style):void 0,effects:n.effects?n.effects.map(t=>vn(t)):void 0,measureDom:n.measureDom,fonts:n.fonts,fill:n.fill?We(n.fill):void 0,outline:n.outline?fr(n.outline):void 0})}function wn(n,t){return typeof n=="number"?n:n.endsWith("%")?(n=n.substring(0,n.length-1),Math.ceil(Number(n)/100*t.total)):n.endsWith("rem")?(n=n.substring(0,n.length-3),Number(n)*t.fontSize):n.endsWith("em")?(n=n.substring(0,n.length-2),Number(n)*t.fontSize):Number(n)}function bn(n){return tt(n)?{}:n}function zi(n,t){const e=Object.keys(n),r=Object.keys(t);return Array.from(new Set([...e,...r])).every(o=>ge(n[o],t[o]))}function ge(n,t){const e=typeof n;return e===typeof t?e==="object"?zi(n,t):n===t:!1}function Gl(n){const t=n.startsWith("#")?n.slice(1):n;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const r=t.length===3?t.split("").map(a=>a+a).join(""):t,i=Number.parseInt(r.slice(0,2),16),o=Number.parseInt(r.slice(2,4),16),s=Number.parseInt(r.slice(4,6),16);return`rgb(${i}, ${o}, ${s})`}function Sn(n){if(!n)return n;const t={};for(const e in n)n[e]!==""&&n[e]!==void 0&&(t[e]=n[e]);return t}class Ni{constructor(t,e={},r,i){this.content=t,this.style=e,this.index=r,this.parent=i,this.updateComputedStyle().initCharacters()}inlineBox=new X;fill;outline;get computedFill(){return this.fill??this.parent.computedFill}get computedOutline(){return this.outline??this.parent.computedOutline}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,...Sn(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new wi(r,e++,this));return this.characters=t,this}}class Vi{constructor(t,e,r){this.style=t,this.index=e,this.parent=r,this.updateComputedStyle()}lineBox=new X;fragments=[];fill;outline;get computedFill(){return this.fill??this.parent.fill}get computedOutline(){return this.outline??this.parent.outline}updateComputedStyle(){return this.computedStyle={...Sn(this.parent.computedStyle),...Sn(this.style)},this}}function ql(n){return n}class He{static notZeroStyles=new Set(["width","height"]);static pxStyles=new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","margin","marginLeft","marginTop","marginRight","marginBottom","padding","paddingLeft","paddingTop","paddingRight","paddingBottom"]);_toDomStyle(t){const e={};for(const r in t){const i=t[r];He.notZeroStyles.has(r)&&i===0||(typeof i=="number"&&He.pxStyles.has(r)?e[r]=`${i}px`:e[r]=i)}return e}createDom(t,e){const r=document.createElement("section"),i={...e},o=e.writingMode.includes("horizontal");switch(e.textAlign){case"start":case"left":i.justifyContent="flex-start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="flex-end";break}switch(e.verticalAlign){case"top":i.alignItems="flex-start";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="flex-end";break}const s=!!(i.justifyContent||i.alignItems);Object.assign(r.style,{...this._toDomStyle({...i,boxSizing:i.boxSizing??"border-box",display:i.display??(s?"inline-flex":void 0),width:i.width??"max-content",height:i.height??"max-content"}),whiteSpace:"pre-wrap",wordBreak:"break-all"});const a=document.createElement("ul");return Object.assign(a.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:s&&o?"100%":void 0,height:s&&!o?"100%":void 0}),t.forEach(l=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._toDomStyle(l.style)}),l.fragments.forEach(u=>{const h=document.createElement("span");Object.assign(h.style,{verticalAlign:"inherit",...this._toDomStyle(u.style)}),h.appendChild(document.createTextNode(u.content)),c.appendChild(h)}),a.appendChild(c)}),r.appendChild(a),r}measureDomText(t){const e=document.createRange();e.selectNodeContents(t);const r=t.data??"";let i=0;return Array.from(r).map(o=>{const s=i+=r.substring(i).indexOf(o),a=s+o.length;i+=o.length,e.setStart(t,Math.max(s,0)),e.setEnd(t,a);const l=e.getClientRects?.()??[e.getBoundingClientRect()];let c=l[l.length-1];l.length>1&&c.width<2&&(c=l[l.length-2]);const u=e.toString();if(u!==""&&c&&c.width+c.height!==0)return{content:u,top:c.top,left:c.left,height:c.height,width:c.width}}).filter(Boolean)}measureDom(t){const e=[],r=[],i=[];return t.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll(":scope > *").forEach((l,c)=>{const u=l.getBoundingClientRect();r.push({paragraphIndex:s,fragmentIndex:c,left:u.left,top:u.top,width:u.width,height:u.height});let h=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(f=>{i.push({...f,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:c,characterIndex:h++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(f=>{f.firstChild instanceof window.Text&&this.measureDomText(f.firstChild).forEach(g=>{i.push({...g,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:c,characterIndex:h++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:e,fragments:r,characters:i}}measureParagraphDom(t,e){const r=e.getBoundingClientRect(),i=this.measureDom(e);i.paragraphs.forEach(a=>{const l=t[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),i.fragments.forEach(a=>{const l=t[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let s=0;return i.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:c,characterIndex:u}=a;o.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const h=t[l].fragments[c].characters[u],{fontHeight:f,isVertical:g}=h,p=o[s];h.inlineBox.left=p.left,h.inlineBox.top=p.top,h.inlineBox.width=p.width,h.inlineBox.height=p.height,g?(h.lineBox.left=p.left+(p.width-f)/2,h.lineBox.top=p.top,h.lineBox.width=f,h.lineBox.height=p.height):(h.lineBox.left=p.left,h.lineBox.top=p.top+(p.height-f)/2,h.lineBox.width=p.width,h.lineBox.height=f),s++}),{paragraphs:t,boundingBox:new X(0,0,r.width,r.height)}}measure(t,e,r){let i;r||(r=this.createDom(t,e),Object.assign(r.style,{position:"fixed",visibility:"hidden"}),document.body.appendChild(r),i=()=>r?.parentNode?.removeChild(r));const o=this.measureParagraphDom(t,r);return i?.(),o}}function ji(){const n=new se,t=ir(),e=sr(t);return{name:"background",pathSet:n,load:async r=>{const{backgroundImage:i}=r.computedStyle;i&&t.needsLoad(i)&&await t.load(i)},update:r=>{n.paths.length=0;const{computedStyle:i,lineBox:o,isVertical:s}=r,{backgroundImage:a,backgroundSize:l,backgroundColormap:c}=i;if(tt(a))return;const{pathSet:u}=e.parse(a),h=u.getBoundingBox(!0);let f,g,p,y;s?{x:g,y:f,width:y,height:p}=o:{x:f,y:g,width:p,height:y}=o;const d=bn(c??"none"),M=u.paths.map(v=>{const x=v.clone();return x.style.fill&&x.style.fill in d&&(x.style.fill=d[x.style.fill]),x.style.stroke&&x.style.stroke in d&&(x.style.stroke=d[x.style.stroke]),x});let P,w;if(l==="rigid"){P=Math.max(r.fontSize*5/h.width),w=P;const v=new k;v.x=h.width-p/P,v.y=h.height-y/w,M.forEach(x=>{x.applyTransform(S=>{const b=S.x>h.left+h.width/2,D=S.y>h.top+h.height/2;b&&(S.x-=v.x),D&&(S.y-=v.y)})})}else P=p/h.width,w=y/h.height;const C=new Ct;C.translate(-h.x,-h.y),C.scale(P,w),s&&(C.translate(-p/2,-y/2),C.rotate(-Math.PI/2),C.translate(y/2,p/2)),C.translate(f,g),M.forEach(v=>{v.applyTransform(x=>{x.applyMatrix3(C)})}),n.paths.push(...M)},renderOrder:-2,render:(r,i)=>{const{boundingBox:o,computedStyle:s}=i;tt(s.backgroundColor)||(r.fillStyle=s.backgroundColor,r.fillRect(...o.array)),n.paths.forEach(a=>{if(he({ctx:r,path:a,fontSize:s.fontSize}),i.debug){const l=new se([a]).getBoundingBox();l&&r.strokeRect(l.x,l.y,l.width,l.height)}}),i.paragraphs.forEach(a=>{const{lineBox:l,style:c}=a;tt(c.backgroundColor)||(r.fillStyle=c.backgroundColor,r.fillRect(...l.array)),a.fragments.forEach(u=>{const{inlineBox:h,style:f}=u;tt(f.backgroundColor)||(r.fillStyle=f.backgroundColor,r.fillRect(...h.array))})})}}}function Cn(n){const{highlight:t,highlightImage:e,highlightReferImage:r,highlightColormap:i,highlightLine:o,highlightSize:s,highlightThickness:a}=n;return{image:t?.image??e??"none",referImage:t?.referImage??r??"none",colormap:t?.colormap??i??"none",line:t?.line??o??"none",size:t?.size??s??"cover",thickness:t?.thickness??a??"100%"}}function Ri(){const n=new se,t=[],e=ir(),r=sr(e);return{name:"highlight",pathSet:n,load:async i=>{const o=new Set;i.forEachCharacter(s=>{const{computedStyle:a}=s,{image:l,referImage:c}=Cn(a);l&&e.needsLoad(l)&&o.add(l),c&&e.needsLoad(c)&&o.add(c)}),await Promise.all(Array.from(o).map(s=>e.load(s)))},update:i=>{t.length=0,n.paths.length=0;let o=[],s,a;i.forEachCharacter(l=>{const{computedStyle:c}=l,u=Cn(c),{image:h,colormap:f,line:g,size:p,thickness:y}=u;if(tt(h))s?.length&&(s=[],o.push(s));else{const{inlineBox:d,isVertical:M}=l,{fontSize:P}=c;(!a||ge(a.image,h)&&ge(a.colormap,f)&&ge(a.line,g)&&ge(a.size,p)&&ge(a.thickness,y))&&s?.length&&(M?s[0].inlineBox.left===d.left:s[0].inlineBox.top===d.top)&&s[0].fontSize===P?s.push(l):(s=[],s.push(l),o.push(s))}a=u}),o=o.filter(l=>l.length);for(let l=0;l<o.length;l++){const c=o[l],u=c[0],h=X.from(...c.map(I=>I.compatibleGlyphBox));if(!h.height||!h.width)continue;const{computedStyle:f,isVertical:g,inlineBox:p,compatibleGlyphBox:y,strikeoutPosition:d,underlinePosition:M}=u,{fontSize:P}=f,{image:w,referImage:C,colormap:v,line:x,size:S,thickness:b}=Cn(f),D=wn(b,{fontSize:P,total:h.width})/h.width,N=bn(v),{pathSet:E,dom:F}=r.parse(w),z=E.getBoundingBox(!0),B=P/z.width*2,A=new X().copy(h);g&&(A.width=h.height,A.height=h.width,A.left=h.left+h.width);const W=Math.floor(A.width);let O=W;S!=="cover"&&(O=wn(S,{fontSize:P,total:h.width})||W,A.width=O);const L=!tt(C)&&tt(x);if(L)z.copy(r.parse(C).pathSet.getBoundingBox(!0));else{let I;if(tt(x))if(z.width/z.height>4){I="underline";const V=F.getAttribute("viewBox");if(V){const[T,_,U,$]=V.split(" ").map(Z=>Number(Z)),q=_+$/2;z.y<q&&z.y+z.height>q?I="line-through":z.y+z.height<q?I="overline":I="underline"}}else I="outline";else I=x;switch(I){case"outline":{const V=A.width*.2,T=A.height*.2;g?(A.x-=T/2,A.y-=V/2,A.x-=A.height):(A.x-=V/2,A.y-=T/2),A.width+=V,A.height+=T;break}case"overline":A.height=z.height*B,g?A.x=p.left+p.width:A.y=p.top;break;case"line-through":A.height=z.height*B,g?A.x=p.left+p.width-d+A.height/2:A.y=p.top+d-A.height/2;break;case"underline":A.height=z.height*B,g?A.x=y.left+y.width-M:A.y=p.top+M;break}}const j=new Ct;if(j.translate(-z.x,-z.y),j.scale(A.width/z.width,A.height/z.height),g){const I=A.width/2,V=A.height/2;L||j.translate(-I,-V),j.rotate(-Math.PI/2),L||j.translate(V,I)}j.translate(A.x,A.y);for(let I=0;I<Math.ceil(W/O);I++){const V=j.clone();g?V.translate(0,I*A.width):V.translate(I*A.width,0),E.paths.forEach(T=>{const _=T.clone().applyTransform(V);_.style.strokeWidth&&(_.style.strokeWidth*=B*D),_.style.strokeMiterlimit&&(_.style.strokeMiterlimit*=B),_.style.strokeDashoffset&&(_.style.strokeDashoffset*=B),_.style.strokeDasharray&&(_.style.strokeDasharray=_.style.strokeDasharray.map(U=>U*B)),_.style.fill&&_.style.fill in N&&(_.style.fill=N[_.style.fill]),_.style.stroke&&_.style.stroke in N&&(_.style.stroke=N[_.style.stroke]),n.paths.push(_),W!==O&&(g?t[n.paths.length-1]=new X(h.left-h.width*2,h.top,h.width*4,h.height):t[n.paths.length-1]=new X(h.left,h.top-h.height*2,h.width,h.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{const i=[];return n.paths.forEach((o,s)=>{const a=t[s];let l=o.getBoundingBox();if(a){const c=Math.max(l.x,a.x),u=Math.max(l.y,a.y),h=Math.min(l.right,a.right),f=Math.min(l.bottom,a.bottom);l=new X(c,u,h-c,f-u)}i.push(l)}),X.from(...i)},render:(i,o)=>{n.paths.forEach((s,a)=>{if(he({ctx:i,path:s,fontSize:o.computedStyle.fontSize,clipRect:t[a]}),o.debug){const l=new se([s]).getBoundingBox();l&&i.strokeRect(l.x,l.y,l.width,l.height)}})}}}function Wl(n,t){return`<svg width="${n*2}" height="${n*2}" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
}`)),document.head.appendChild(r),this}_parseUrls(t){const e=Array.from(new Set([...t.split(","),t]));return Array.from(new Set(e.map(r=>this.familyToUrl.get(r.trim())??this.familyToUrl.get(r)??r)))}get(t){let e;return t&&(e=this._parseUrls(t).reduce((i,o)=>i||this.loaded.get(o),void 0)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){return this._parseUrls(t).forEach(e=>{this.familyToUrl.delete(e),this.loaded.delete(e)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:i=!0,injectStyleTag:o=!0,...s}=e;let a,l;if(typeof t=="string"?a=t:{src:a,family:l}=t,this.loaded.has(a))return r&&(this.loading.forEach(g=>g.cancel()),this.loading.clear()),h(this.loaded.get(a));let c=this.loading.get(a);return c||(c=this._createRequest(a,s),this.loading.set(a,c)),r&&this.loading.forEach((g,f)=>{g!==c&&(g.cancel(),this.loading.delete(f))}),c.when.then(g=>{if(this.loaded.has(a))return h(this.loaded.get(a));{const f=p(g);return e.noAdd||this.loaded.set(a,f),f.familySet.forEach(y=>{this.familyToUrl.set(y,a),typeof document<"u"&&(i&&this.injectFontFace(y,g),o&&this.injectStyleTag(y,a))}),f}}).catch(g=>{if(g instanceof DOMException&&g.message==="The user aborted a request.")return p();throw g}).finally(()=>{this.loading.delete(a)});function u(){return l?Array.isArray(l)?l:[l]:[]}function h(g){return u().forEach(f=>{g.familySet.add(f)}),g}function p(g=new ArrayBuffer(0)){let f;function y(){return f||(f=g.byteLength?Oo(g,!1):void 0),f}function d(){const P=y();if(P instanceof qt||P instanceof Hn)return P.sfnt}return{src:a,family:l,buffer:g,familySet:new Set(u()),getFont:y,getSFNT:d}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}}const Io=new Xn;function Eo(n,t,e=2){const r=t&&t.length,i=r?t[0]*e:n.length;let o=qr(n,0,i,e,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(r&&(o=Lo(n,t,o,e)),n.length>80*e){a=n[0],l=n[1];let u=a,h=l;for(let p=e;p<i;p+=e){const g=n[p],f=n[p+1];g<a&&(a=g),f<l&&(l=f),g>u&&(u=g),f>h&&(h=f)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return Ne(o,s,e,a,l,c,0),s}function qr(n,t,e,r,i){let o;if(i===Xo(n,t,e,r)>0)for(let s=t;s<e;s+=r)o=Zr(s/r|0,n[s],n[s+1],o);else for(let s=e-r;s>=t;s-=r)o=Zr(s/r|0,n[s],n[s+1],o);return o&&be(o,o.next)&&(Re(o),o=o.next),o}function pe(n,t){if(!n)return n;t||(t=n);let e=n,r;do if(r=!1,!e.steiner&&(be(e,e.next)||J(e.prev,e,e.next)===0)){if(Re(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function Ne(n,t,e,r,i,o,s){if(!n)return;!s&&o&&jo(n,r,i,o);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(o?Do(n,r,i,o):Bo(n)){t.push(l.i,n.i,c.i),Re(n),n=c.next,a=c.next;continue}if(n=c,n===a){s?s===1?(n=Fo(pe(n),t),Ne(n,t,e,r,i,o,2)):s===2&&Uo(n,t,e,r,i,o):Ne(pe(n),t,e,r,i,o,1);break}}}function Bo(n){const t=n.prev,e=n,r=n.next;if(J(t,e,r)>=0)return!1;const i=t.x,o=e.x,s=r.x,a=t.y,l=e.y,c=r.y,u=Math.min(i,o,s),h=Math.min(a,l,c),p=Math.max(i,o,s),g=Math.max(a,l,c);let f=r.next;for(;f!==t;){if(f.x>=u&&f.x<=p&&f.y>=h&&f.y<=g&&Ve(i,a,o,l,s,c,f.x,f.y)&&J(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Do(n,t,e,r){const i=n.prev,o=n,s=n.next;if(J(i,o,s)>=0)return!1;const a=i.x,l=o.x,c=s.x,u=i.y,h=o.y,p=s.y,g=Math.min(a,l,c),f=Math.min(u,h,p),y=Math.max(a,l,c),d=Math.max(u,h,p),P=Zn(g,f,t,e,r),M=Zn(y,d,t,e,r);let w=n.prevZ,C=n.nextZ;for(;w&&w.z>=P&&C&&C.z<=M;){if(w.x>=g&&w.x<=y&&w.y>=f&&w.y<=d&&w!==i&&w!==s&&Ve(a,u,l,h,c,p,w.x,w.y)&&J(w.prev,w,w.next)>=0||(w=w.prevZ,C.x>=g&&C.x<=y&&C.y>=f&&C.y<=d&&C!==i&&C!==s&&Ve(a,u,l,h,c,p,C.x,C.y)&&J(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;w&&w.z>=P;){if(w.x>=g&&w.x<=y&&w.y>=f&&w.y<=d&&w!==i&&w!==s&&Ve(a,u,l,h,c,p,w.x,w.y)&&J(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;C&&C.z<=M;){if(C.x>=g&&C.x<=y&&C.y>=f&&C.y<=d&&C!==i&&C!==s&&Ve(a,u,l,h,c,p,C.x,C.y)&&J(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Fo(n,t){let e=n;do{const r=e.prev,i=e.next.next;!be(r,i)&&Hr(r,e,e.next,i)&&je(r,i)&&je(i,r)&&(t.push(r.i,e.i,i.i),Re(e),Re(e.next),e=n=i),e=e.next}while(e!==n);return pe(e)}function Uo(n,t,e,r,i,o){let s=n;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&qo(s,a)){let l=Xr(s,a);s=pe(s,s.next),l=pe(l,l.next),Ne(s,t,e,r,i,o,0),Ne(l,t,e,r,i,o,0);return}a=a.next}s=s.next}while(s!==n)}function Lo(n,t,e,r){const i=[];for(let o=0,s=t.length;o<s;o++){const a=t[o]*r,l=o<s-1?t[o+1]*r:n.length,c=qr(n,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(Go(c))}i.sort($o);for(let o=0;o<i.length;o++)e=zo(i[o],e);return e}function $o(n,t){let e=n.x-t.x;if(e===0&&(e=n.y-t.y,e===0)){const r=(n.next.y-n.y)/(n.next.x-n.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=r-i}return e}function zo(n,t){const e=No(n,t);if(!e)return t;const r=Xr(e,n);return pe(r,r.next),pe(e,e.next)}function No(n,t){let e=t;const r=n.x,i=n.y;let o=-1/0,s;if(be(n,e))return e;do{if(be(n,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const h=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=r&&h>o&&(o=h,s=e.x<e.next.x?e:e.next,h===r))return s}e=e.next}while(e!==t);if(!s)return null;const a=s,l=s.x,c=s.y;let u=1/0;e=s;do{if(r>=e.x&&e.x>=l&&r!==e.x&&Wr(i<c?r:o,i,l,c,i<c?o:r,i,e.x,e.y)){const h=Math.abs(i-e.y)/(r-e.x);je(e,n)&&(h<u||h===u&&(e.x>s.x||e.x===s.x&&Vo(s,e)))&&(s=e,u=h)}e=e.next}while(e!==a);return s}function Vo(n,t){return J(n.prev,n,t.prev)<0&&J(t.next,n,n.next)<0}function jo(n,t,e,r){let i=n;do i.z===0&&(i.z=Zn(i.x,i.y,t,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,Ro(i)}function Ro(n){let t,e=1;do{let r=n,i;n=null;let o=null;for(t=0;r;){t++;let s=r,a=0;for(let c=0;c<e&&(a++,s=s.nextZ,!!s);c++);let l=e;for(;a>0||l>0&&s;)a!==0&&(l===0||!s||r.z<=s.z)?(i=r,r=r.nextZ,a--):(i=s,s=s.nextZ,l--),o?o.nextZ=i:n=i,i.prevZ=o,o=i;r=s}o.nextZ=null,e*=2}while(t>1);return n}function Zn(n,t,e,r,i){return n=(n-e)*i|0,t=(t-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function Go(n){let t=n,e=n;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function Wr(n,t,e,r,i,o,s,a){return(i-s)*(t-a)>=(n-s)*(o-a)&&(n-s)*(r-a)>=(e-s)*(t-a)&&(e-s)*(o-a)>=(i-s)*(r-a)}function Ve(n,t,e,r,i,o,s,a){return!(n===s&&t===a)&&Wr(n,t,e,r,i,o,s,a)}function qo(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!Wo(n,t)&&(je(n,t)&&je(t,n)&&Ho(n,t)&&(J(n.prev,n,t.prev)||J(n,t.prev,t))||be(n,t)&&J(n.prev,n,n.next)>0&&J(t.prev,t,t.next)>0)}function J(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function be(n,t){return n.x===t.x&&n.y===t.y}function Hr(n,t,e,r){const i=cn(J(n,t,e)),o=cn(J(n,t,r)),s=cn(J(e,r,n)),a=cn(J(e,r,t));return!!(i!==o&&s!==a||i===0&&ln(n,e,t)||o===0&&ln(n,r,t)||s===0&&ln(e,n,r)||a===0&&ln(e,t,r))}function ln(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function cn(n){return n>0?1:n<0?-1:0}function Wo(n,t){let e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&Hr(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function je(n,t){return J(n.prev,n,n.next)<0?J(n,t,n.next)>=0&&J(n,n.prev,t)>=0:J(n,t,n.prev)<0||J(n,n.next,t)<0}function Ho(n,t){let e=n,r=!1;const i=(n.x+t.x)/2,o=(n.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&i<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==n);return r}function Xr(n,t){const e=Yn(n.i,n.x,n.y),r=Yn(t.i,t.x,t.y),i=n.next,o=t.prev;return n.next=t,t.prev=n,e.next=i,i.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function Zr(n,t,e,r){const i=Yn(n,t,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Re(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Yn(n,t,e){return{i:n,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Xo(n,t,e,r){let i=0;for(let o=t,s=e-r;o<e;o+=r)i+=(n[s]-n[o])*(n[o+1]+n[s+1]),s=o;return i}function Zo(n,t,e,r={}){const{radius:i=1}=r;n.moveTo(t,e),n.arc(t,e,i,0,Math.PI*2)}const Yo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Kn(n,t){const{fill:e="#000",stroke:r="none",strokeWidth:i=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:c=0,shadowOffsetX:u=0,shadowOffsetY:h=0,shadowBlur:p=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;n.fillStyle=e,n.strokeStyle=r,n.lineWidth=i,n.lineCap=o,n.lineJoin=Yo[s],n.miterLimit=a,n.setLineDash(l),n.lineDashOffset=c,n.shadowOffsetX=u,n.shadowOffsetY=h,n.shadowBlur=p,n.shadowColor=g}class k{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new k(1/0,1/0)}static get MIN(){return new k(-1/0,-1/0)}get array(){return[this.x,this.y]}finite(){return this.x=Number.isFinite(this.x)?this.x:0,this.y=Number.isFinite(this.y)?this.y:0,this}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,i=this.x-e.x,o=-(this.y-e.y),s=Math.sin(r),a=Math.cos(r);return this.set(e.x+(i*a-o*s),e.y-(i*s+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const i=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=i*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const i=this.x-r.x,o=this.y-r.y;return this.x=r.x+(i+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*i),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,i=t.elements;return this.x=i[0]*e+i[3]*r+i[6],this.y=i[1]*e+i[4]*r+i[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new k(this.x,this.y)}}class X{constructor(t=0,e=0,r=0,i=0){this.left=t,this.top=e,this.width=r,this.height=i}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new k((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new X;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((i,o)=>(i.left=Math.min(i.left,o.left),i.top=Math.min(i.top,o.top),i.right=Math.max(i.right,o.right),i.bottom=Math.max(i.bottom,o.bottom),i),{left:e?.left??0,top:e?.top??0,right:e?.right??0,bottom:e?.bottom??0});return new X(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new X(this.left,this.top,this.width,this.height)}}class Ct{elements=[];constructor(t=1,e=0,r=0,i=0,o=1,s=0,a=0,l=0,c=1){this.set(t,e,r,i,o,s,a,l,c)}set(t,e,r,i,o,s,a,l,c){const u=this.elements;return u[0]=t,u[1]=i,u[2]=a,u[3]=e,u[4]=o,u[5]=l,u[6]=r,u[7]=s,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,i=e.elements,o=this.elements,s=r[0],a=r[3],l=r[6],c=r[1],u=r[4],h=r[7],p=r[2],g=r[5],f=r[8],y=i[0],d=i[3],P=i[6],M=i[1],w=i[4],C=i[7],v=i[2],x=i[5],S=i[8];return o[0]=s*y+a*M+l*v,o[3]=s*d+a*w+l*x,o[6]=s*P+a*C+l*S,o[1]=c*y+u*M+h*v,o[4]=c*d+u*w+h*x,o[7]=c*P+u*C+h*S,o[2]=p*y+g*M+f*v,o[5]=p*d+g*w+f*x,o[8]=p*P+g*C+f*S,this}invert(){const t=this.elements,e=t[0],r=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*s-a*c,p=a*l-u*o,g=c*o-s*l,f=e*h+r*p+i*g;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/f;return t[0]=h*y,t[1]=(i*c-u*r)*y,t[2]=(a*r-i*s)*y,t[3]=p*y,t[4]=(u*e-i*l)*y,t[5]=(i*o-a*e)*y,t[6]=g*y,t[7]=(r*l-c*e)*y,t[8]=(s*e-r*o)*y,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(Qn.makeScale(t,e)),this}rotate(t){return this.premultiply(Qn.makeRotation(-t)),this}translate(t,e){return this.premultiply(Qn.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Qn=new Ct;function Yr(n,t,e,r){const i=n*e+t*r,o=Math.sqrt(n*n+t*t)*Math.sqrt(e*e+r*r);let s=Math.acos(Math.max(-1,Math.min(1,i/o)));return n*r-t*e<0&&(s=-s),s}function Ko(n,t,e,r,i,o,s,a){if(t===0||e===0){n.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(s.x-a.x)/2,c=(s.y-a.y)/2,u=Math.cos(r)*l+Math.sin(r)*c,h=-Math.sin(r)*l+Math.cos(r)*c;let p=t*t,g=e*e;const f=u*u,y=h*h,d=f/p+y/g;if(d>1){const N=Math.sqrt(d);t=N*t,e=N*e,p=t*t,g=e*e}const P=p*y+g*f,M=(p*g-P)/P;let w=Math.sqrt(Math.max(0,M));i===o&&(w=-w);const C=w*t*h/e,v=-w*e*u/t,x=Math.cos(r)*C-Math.sin(r)*v+(s.x+a.x)/2,S=Math.sin(r)*C+Math.cos(r)*v+(s.y+a.y)/2,b=Yr(1,0,(u-C)/t,(h-v)/e),D=Yr((u-C)/t,(h-v)/e,(-u-C)/t,(-h-v)/e)%(Math.PI*2);n.ellipse(x,S,t,e,r,b,b+D,o===0)}const it={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Wt(n,t,e=0){let a=0,l=!0,c="",u="";const h=[];function p(d,P,M){const w=new SyntaxError(`Unexpected character "${d}" at index ${P}.`);throw w.partial=M,w}function g(){c!==""&&(u===""?h.push(Number(c)):h.push(Number(c)*10**Number(u))),c="",u=""}let f;const y=n.length;for(let d=0;d<y;d++){if(f=n[d],Array.isArray(t)&&t.includes(h.length%e)&&it.FLAGS.test(f)){a=1,c=f,g();continue}if(a===0){if(it.WHITESPACE.test(f))continue;if(it.DIGIT.test(f)||it.SIGN.test(f)){a=1,c=f;continue}if(it.POINT.test(f)){a=2,c=f;continue}it.COMMA.test(f)&&(l&&p(f,d,h),l=!0)}if(a===1){if(it.DIGIT.test(f)){c+=f;continue}if(it.POINT.test(f)){c+=f,a=2;continue}if(it.EXP.test(f)){a=3;continue}it.SIGN.test(f)&&c.length===1&&it.SIGN.test(c[0])&&p(f,d,h)}if(a===2){if(it.DIGIT.test(f)){c+=f;continue}if(it.EXP.test(f)){a=3;continue}it.POINT.test(f)&&c[c.length-1]==="."&&p(f,d,h)}if(a===3){if(it.DIGIT.test(f)){u+=f;continue}if(it.SIGN.test(f)){if(u===""){u+=f;continue}u.length===1&&it.SIGN.test(u)&&p(f,d,h)}}it.WHITESPACE.test(f)?(g(),a=0,l=!1):it.COMMA.test(f)?(g(),a=0,l=!0):it.SIGN.test(f)?(g(),a=1,c=f):it.POINT.test(f)?(g(),a=2,c=f):p(f,d,h)}return g(),h}function Se(n,t){return n-(t-n)}function Kr(n,t){const e=new k,r=new k;for(let i=0,o=n.length;i<o;i++){const s=n[i];if(s.type==="m"||s.type==="M")s.type==="m"?e.add(s):e.copy(s),t.moveTo(e.x,e.y),r.copy(e);else if(s.type==="h"||s.type==="H")s.type==="h"?e.x+=s.x:e.x=s.x,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="v"||s.type==="V")s.type==="v"?e.y+=s.y:e.y=s.y,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="l"||s.type==="L")s.type==="l"?e.add(s):e.copy(s),t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="c"||s.type==="C")s.type==="c"?(t.bezierCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(t.bezierCurveTo(Se(e.x,r.x),Se(e.y,r.y),e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(Se(e.x,r.x),Se(e.y,r.y),s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(t.quadraticCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x,e.y+s.y),r.x=e.x+s.x1,r.y=e.y+s.y1,e.add(s)):(t.quadraticCurveTo(s.x1,s.y1,s.x,s.y),r.x=s.x1,r.y=s.y1,e.copy(s));else if(s.type==="t"||s.type==="T"){const a=Se(e.x,r.x),l=Se(e.y,r.y);r.x=a,r.y=l,s.type==="t"?(t.quadraticCurveTo(a,l,e.x+s.x,e.y+s.y),e.add(s)):(t.quadraticCurveTo(a,l,s.x,s.y),e.copy(s))}else if(s.type==="a"||s.type==="A"){const a=e.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;e.add(s)}else{if(e.equals(s))continue;e.copy(s)}r.copy(e),Ko(t,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,e)}else s.type==="z"||s.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",s)}}function Qo(n){let t,e;const r=[];for(let i=0,o=n.length;i<o;i++){const s=n[i];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===e?.x.toFixed(4)&&s.y.toFixed(4)===e?.y.toFixed(4))continue;r.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y},t={x:s.x,y:s.y};break;case"h":case"H":r.push(`${s.type} ${s.x}`),e={x:s.x,y:e?.y??0};break;case"v":case"V":r.push(`${s.type} ${s.y}`),e={x:e?.x??0,y:s.y};break;case"l":case"L":r.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"c":case"C":r.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"s":case"S":r.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"q":case"Q":r.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"t":case"T":r.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"a":case"A":r.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"z":case"Z":r.push(s.type),t&&(e={x:t.x,y:t.y});break}}return r.join(" ")}const Jo=/[a-df-z][^a-df-z]*/gi;function Qr(n){const t=[],e=n.match(Jo);if(!e)return t;for(let r=0,i=e.length;r<i;r++){const o=e[r],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=Wt(a);for(let c=0,u=l.length;c<u;c+=2)c===0?t.push({type:s,x:l[c],y:l[c+1]}):t.push({type:s==="m"?"l":"L",x:l[c],y:l[c+1]});break;case"h":case"H":l=Wt(a);for(let c=0,u=l.length;c<u;c++)t.push({type:s,x:l[c]});break;case"v":case"V":l=Wt(a);for(let c=0,u=l.length;c<u;c++)t.push({type:s,y:l[c]});break;case"l":case"L":l=Wt(a);for(let c=0,u=l.length;c<u;c+=2)t.push({type:s,x:l[c],y:l[c+1]});break;case"c":case"C":l=Wt(a);for(let c=0,u=l.length;c<u;c+=6)t.push({type:s,x1:l[c],y1:l[c+1],x2:l[c+2],y2:l[c+3],x:l[c+4],y:l[c+5]});break;case"s":case"S":l=Wt(a);for(let c=0,u=l.length;c<u;c+=4)t.push({type:s,x2:l[c],y2:l[c+1],x:l[c+2],y:l[c+3]});break;case"q":case"Q":l=Wt(a);for(let c=0,u=l.length;c<u;c+=4)t.push({type:s,x1:l[c],y1:l[c+1],x:l[c+2],y:l[c+3]});break;case"t":case"T":l=Wt(a);for(let c=0,u=l.length;c<u;c+=2)t.push({type:s,x:l[c],y:l[c+1]});break;case"a":case"A":l=Wt(a,[3,4],7);for(let c=0,u=l.length;c<u;c+=7)t.push({type:s,rx:l[c],ry:l[c+1],angle:l[c+2],largeArcFlag:l[c+3],sweepFlag:l[c+4],x:l[c+5],y:l[c+6]});break;case"z":case"Z":t.push({type:s});break;default:console.warn(o)}}return t}const Jr="data:image/svg+xml;",ti=`${Jr}base64,`,ei=`${Jr}charset=utf8,`;function ni(n){if(typeof n=="string"){let t;n.startsWith(ti)?(n=n.substring(ti.length,n.length),t=atob(n)):n.startsWith(ei)?(n=n.substring(ei.length,n.length),t=decodeURIComponent(n)):t=n;const e=new DOMParser().parseFromString(t,"text/xml"),r=e.querySelector("parsererror");if(r)throw new Error(`${r.textContent??"parser error"}
|
|
5
|
+
${t}`);return e.documentElement}else return n}const ta="px",ea=90,ri=["mm","cm","in","pt","pc","px"],ii={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 Y(n){let t="px";if(typeof n=="string")for(let r=0,i=ri.length;r<i;r++){const o=ri[r];if(n.endsWith(o)){t=o,n=n.substring(0,n.length-o.length);break}}let e;return e=ii[t][ta],e<0&&(e=ii[t].in*ea),e*Number.parseFloat(n)}const na=new Ct,hn=new Ct,si=new Ct,oi=new Ct;function ra(n,t,e){if(!(n.hasAttribute("transform")||n.nodeName==="use"&&(n.hasAttribute("x")||n.hasAttribute("y"))))return null;const r=ia(n);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function ia(n){const t=new Ct,e=na;if(n.nodeName==="use"&&(n.hasAttribute("x")||n.hasAttribute("y"))&&t.translate(Y(n.getAttribute("x")),Y(n.getAttribute("y"))),n.hasAttribute("transform")){const r=n.getAttribute("transform").split(")");for(let i=r.length-1;i>=0;i--){const o=r[i].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),c=Wt(o.slice(s+1));switch(e.identity(),l){case"translate":if(c.length>=1){const u=c[0];let h=0;c.length>=2&&(h=c[1]),e.translate(u,h)}break;case"rotate":if(c.length>=1){let u=0,h=0,p=0;u=c[0]*Math.PI/180,c.length>=3&&(h=c[1],p=c[2]),hn.makeTranslation(-h,-p),si.makeRotation(u),oi.multiplyMatrices(si,hn),hn.makeTranslation(h,p),e.multiplyMatrices(hn,oi)}break;case"scale":c.length>=1&&e.scale(c[0],c[1]??c[0]);break;case"skewX":c.length===1&&e.set(1,Math.tan(c[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":c.length===1&&e.set(1,0,0,Math.tan(c[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":c.length===6&&e.set(c[0],c[2],c[4],c[1],c[3],c[5],0,0,1);break}}t.premultiply(e)}}return t}function sa(n){return new _t().arc(Y(n.getAttribute("cx")||0),Y(n.getAttribute("cy")||0),Y(n.getAttribute("r")||0),0,Math.PI*2)}function oa(n,t){if(!(!n.sheet||!n.sheet.cssRules||!n.sheet.cssRules.length))for(let e=0;e<n.sheet.cssRules.length;e++){const r=n.sheet.cssRules[e];if(r.type!==1)continue;const i=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=r.style.length,a=0;a<s;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let s=0;s<i.length;s++)t[i[s]]=Object.assign(t[i[s]]||{},{...o})}}function aa(n){return new _t().ellipse(Y(n.getAttribute("cx")||0),Y(n.getAttribute("cy")||0),Y(n.getAttribute("rx")||0),Y(n.getAttribute("ry")||0),0,0,Math.PI*2)}function la(n){return new _t().moveTo(Y(n.getAttribute("x1")||0),Y(n.getAttribute("y1")||0)).lineTo(Y(n.getAttribute("x2")||0),Y(n.getAttribute("y2")||0))}function ca(n){const t=new _t,e=n.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const ha=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ua(n){const t=new _t;let e=0;return n.getAttribute("points")?.replace(ha,(r,i,o)=>{const s=Y(i),a=Y(o);return e===0?t.moveTo(s,a):t.lineTo(s,a),e++,r}),t.currentCurve.autoClose=!0,t}const fa=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function pa(n){const t=new _t;let e=0;return n.getAttribute("points")?.replace(fa,(r,i,o)=>{const s=Y(i),a=Y(o);return e===0?t.moveTo(s,a):t.lineTo(s,a),e++,r}),t.currentCurve.autoClose=!1,t}function da(n){const t=Y(n.getAttribute("x")||0),e=Y(n.getAttribute("y")||0),r=Y(n.getAttribute("rx")||n.getAttribute("ry")||0),i=Y(n.getAttribute("ry")||n.getAttribute("rx")||0),o=Y(n.getAttribute("width")),s=Y(n.getAttribute("height")),a=1-.551915024494,l=new _t;return l.moveTo(t+r,e),l.lineTo(t+o-r,e),(r!==0||i!==0)&&l.bezierCurveTo(t+o-r*a,e,t+o,e+i*a,t+o,e+i),l.lineTo(t+o,e+s-i),(r!==0||i!==0)&&l.bezierCurveTo(t+o,e+s-i*a,t+o-r*a,e+s,t+o-r,e+s),l.lineTo(t+r,e+s),(r!==0||i!==0)&&l.bezierCurveTo(t+r*a,e+s,t,e+s-i*a,t,e+s-i),l.lineTo(t,e+i),(r!==0||i!==0)&&l.bezierCurveTo(t,e+i*a,t+r*a,e,t+r,e),l}function Ht(n,t,e){t=Object.assign({},t);let r={};if(n.hasAttribute("class")){const c=n.getAttribute("class").split(/\s/).filter(Boolean).map(u=>u.trim());for(let u=0;u<c.length;u++)r=Object.assign(r,e[`.${c[u]}`])}n.hasAttribute("id")&&(r=Object.assign(r,e[`#${n.getAttribute("id")}`]));for(let c=n.style.length,u=0;u<c;u++){const h=n.style.item(u),p=n.style.getPropertyValue(h);t[h]=p,r[h]=p}function i(c,u,h=o){n.hasAttribute(c)&&(t[u]=h(n.getAttribute(c))),r[c]&&(t[u]=h(r[c]))}function o(c){return c.startsWith("url")&&console.warn("url access in attributes is not implemented."),c}function s(c){return Math.max(0,Math.min(1,Y(c)))}function a(c){return Math.max(0,Y(c))}function l(c){return c.split(" ").filter(u=>u!=="").map(u=>Y(u))}return i("fill","fill"),i("fill-opacity","fillOpacity",s),i("fill-rule","fillRule"),i("opacity","opacity",s),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",s),i("stroke-width","strokeWidth",a),i("stroke-linecap","strokeLinecap"),i("stroke-linejoin","strokeLinejoin"),i("stroke-miterlimit","strokeMiterlimit",a),i("stroke-dasharray","strokeDasharray",l),i("stroke-dashoffset","strokeDashoffset",Y),i("visibility","visibility"),t}function Jn(n,t,e=[],r={}){if(n.nodeType!==1)return e;let i=!1,o=null,s={...t};switch(n.nodeName){case"svg":s=Ht(n,s,r);break;case"style":oa(n,r);break;case"g":s=Ht(n,s,r);break;case"path":s=Ht(n,s,r),n.hasAttribute("d")&&(o=ca(n));break;case"rect":s=Ht(n,s,r),o=da(n);break;case"polygon":s=Ht(n,s,r),o=ua(n);break;case"polyline":s=Ht(n,s,r),o=pa(n);break;case"circle":s=Ht(n,s,r),o=sa(n);break;case"ellipse":s=Ht(n,s,r),o=aa(n);break;case"line":s=Ht(n,s,r),o=la(n);break;case"defs":i=!0;break;case"use":{s=Ht(n,s,r);const p=(n.getAttributeNS("http://www.w3.org/1999/xlink","href")||n.getAttribute("href")||"").substring(1),g=n.viewportElement?.getElementById(p);g?Jn(g,s,e,r):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(n);break}if(s.display==="none")return e;const a=new Ct,l=[],c=ra(n,a,l);o&&(o.applyTransform(a),e.push(o),o.style={...s});const u=n.childNodes;for(let h=0,p=u.length;h<p;h++){const g=u[h];i&&g.nodeName!=="style"&&g.nodeName!=="defs"||Jn(g,s,e,r)}return c&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}function ai(n){const t=ni(n);return new se(Jn(t,{}),t.getAttribute("viewBox")?.trim().split(" ").map(e=>Number(e)))}function li(n,t,e,r,i){const o=(r-t)*.5,s=(i-e)*.5,a=n*n,l=n*a;return(2*e-2*r+o+s)*l+(-3*e+3*r-2*o-s)*a+o*n+e}function ga(n,t){const e=1-n;return e*e*e*t}function ya(n,t){const e=1-n;return 3*e*e*n*t}function ma(n,t){return 3*(1-n)*n*n*t}function xa(n,t){return n*n*n*t}function ci(n,t,e,r,i){return ga(n,t)+ya(n,e)+ma(n,r)+xa(n,i)}function hi(n,t={}){let{vertices:e=[],indices:r=[],holes:i=[],verticesStride:o=2,verticesOffset:s=e.length/o,indicesOffset:a=r.length}=t;const l=Eo(n,i,2);if(l.length){for(let u=0;u<l.length;u+=3)r[a++]=l[u]+s,r[a++]=l[u+1]+s,r[a++]=l[u+2]+s;let c=s*o;for(let u=0;u<n.length;u+=2)e[c]=n[u],e[c+1]=n[u+1],c+=o}return{vertices:e,indices:r}}const va=8,un=11920929e-14,wa=1;function ba(n,t,e,r,i,o,s,a,l=.5,c=[]){const h=Math.min(.99,Math.max(0,l));let p=(wa-h)/1;return p*=p,tr(n,t,e,r,i,o,s,a,c,p,0),c.push(s,a),c}function tr(n,t,e,r,i,o,s,a,l,c,u){if(u>va)return;const h=(n+e)/2,p=(t+r)/2,g=(e+i)/2,f=(r+o)/2,y=(i+s)/2,d=(o+a)/2,P=(h+g)/2,M=(p+f)/2,w=(g+y)/2,C=(f+d)/2,v=(P+w)/2,x=(M+C)/2;if(u>0){let S=s-n,b=a-t;const D=Math.abs((e-s)*b-(r-a)*S),N=Math.abs((i-s)*b-(o-a)*S);if(D>un&&N>un){if((D+N)*(D+N)<=c*(S*S+b*b)){l.push(v,x);return}}else if(D>un){if(D*D<=c*(S*S+b*b)){l.push(v,x);return}}else if(N>un){if(N*N<=c*(S*S+b*b)){l.push(v,x);return}}else if(S=v-(n+s)/2,b=x-(t+a)/2,S*S+b*b<=c){l.push(v,x);return}}tr(n,t,h,p,P,M,v,x,l,c,u+1),tr(v,x,w,C,y,d,s,a,l,c,u+1)}const Sa=8,Ca=11920929e-14,Pa=1;function Ma(n,t,e,r,i,o,s=.5,a=[]){const c=Math.min(.99,Math.max(0,s));let u=(Pa-c)/1;return u*=u,er(a,n,t,e,r,i,o,u,0),a.push(i,o),a}function er(n,t,e,r,i,o,s,a,l){if(l>Sa)return;const c=(t+r)/2,u=(e+i)/2,h=(r+o)/2,p=(i+s)/2,g=(c+h)/2,f=(u+p)/2;let y=o-t,d=s-e;const P=Math.abs((r-o)*d-(i-s)*y);if(P>Ca){if(P*P<=a*(y*y+d*d)){n.push(g,f);return}}else if(y=g-(t+o)/2,d=f-(e+s)/2,y*y+d*d<=a){n.push(g,f);return}er(n,t,e,c,u,g,f,a,l+1),er(n,g,f,h,p,o,s,a,l+1)}function _a(n){return n.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Ta(n,t,e,r){const i=t.clone().sub(n),o=r.clone().sub(e),s=e.clone().sub(n),a=i.cross(o);if(a===0)return new k((n.x+e.x)/2,(n.y+e.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new k((n.x+e.x)/2,(n.y+e.y)/2):new k(n.x+l*i.x,n.y+l*i.y)}function ka(n){let t=0;const e=n.length/2;for(let r=0;r<e;r++){const i=n[2*r],o=n[2*r+1],s=(r+1)%e,a=n[2*s],l=n[2*s+1];t+=(a-i)*(l+o)}return t}function ui(n,t,e,r,i,o){return(e-n)*(o-t)-(i-n)*(r-t)}function Aa(n,t,e){const r=e.length;let i=0;for(let o=0,s=r-2;o<r;s=o,o+=2){const a=e[o],l=e[o+1],c=e[s],u=e[s+1];l<=t?u>t&&ui(c,u,a,l,n,t)>0&&i++:u<=t&&ui(c,u,a,l,n,t)<0&&i--}return i}function Oa(n){const t=n.length,e=n.map((r,i)=>({index:i,parentIndex:null,wn:0}));for(let r=0;r<t;r++){let i=null;if(ka(n[r])<0)continue;const o=[n[r][0],n[r][1]];for(let s=0;s<t;s++){if(r===s)continue;let a=0;for(let c=0;c<o.length&&(a=a||Aa(o[c],o[c+1],n[s]),!a);c+=2);const l=Math.abs(a);l!==0&&(!i||l>Math.abs(i.wn))&&(i={idx:s,wn:a})}i&&(e[r].parentIndex=i.idx,e[r].wn=i.wn)}return e}function Ia(n,t){const e=1-n;return e*e*t}function Ea(n,t){return 2*(1-n)*n*t}function Ba(n,t){return n*n*t}function fi(n,t,e,r){return Ia(n,t)+Ea(n,e)+Ba(n,r)}const Da=1e-4,pi=1e-4;function Fa(n,t={}){const{vertices:e=[],indices:r=[],lineStyle:i={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=t,a=Da;if(n.length===0)return{vertices:e,indices:r};const l=i;let c=l.alignment;if(i.alignment!==.5){let I=Ua(n);o&&(I*=-1),c=(c-.5)*I+.5}const u={x:n[0],y:n[1]},h={x:n[n.length-2],y:n[n.length-1]},p=s,g=Math.abs(u.x-h.x)<a&&Math.abs(u.y-h.y)<a;if(p){n=n.slice(),g&&(n.pop(),n.pop(),h.x=n[n.length-2],h.y=n[n.length-1]);const I=(u.x+h.x)*.5,V=(h.y+u.y)*.5;n.unshift(I,V),n.push(I,V)}const f=e,y=n.length/2;let d=n.length;const P=f.length/2,M=l.width/2,w=M*M,C=l.miterLimit*l.miterLimit;let v=n[0],x=n[1],S=n[2],b=n[3],D=0,N=0,E=-(x-b),F=v-S,z=0,B=0,A=Math.sqrt(E*E+F*F);E/=A,F/=A,E*=M,F*=M;const W=c,O=(1-W)*2,L=W*2;p||(l.cap==="round"?d+=de(v-E*(O-L)*.5,x-F*(O-L)*.5,v-E*O,x-F*O,v+E*L,x+F*L,f,!0)+2:l.cap==="square"&&(d+=di(v,x,E,F,O,L,!0,f))),f.push(v-E*O,x-F*O),f.push(v+E*L,x+F*L);for(let I=1;I<y-1;++I){v=n[(I-1)*2],x=n[(I-1)*2+1],S=n[I*2],b=n[I*2+1],D=n[(I+1)*2],N=n[(I+1)*2+1],E=-(x-b),F=v-S,A=Math.sqrt(E*E+F*F),E/=A,F/=A,E*=M,F*=M,z=-(b-N),B=S-D,A=Math.sqrt(z*z+B*B),z/=A,B/=A,z*=M,B*=M;const V=S-v,T=x-b,_=S-D,U=N-b,$=V*_+T*U,q=T*_-U*V,Z=q<0;if(Math.abs(q)<.001*Math.abs($)){f.push(S-E*O,b-F*O),f.push(S+E*L,b+F*L),$>=0&&(l.join==="round"?d+=de(S,b,S-E*O,b-F*O,S-z*O,b-B*O,f,!1)+4:d+=2,f.push(S-z*L,b-B*L),f.push(S+z*O,b+B*O));continue}const nt=(-E+v)*(-F+b)-(-E+S)*(-F+x),Zt=(-z+D)*(-B+b)-(-z+S)*(-B+N),Dt=(V*Zt-_*nt)/q,Pt=(U*nt-T*Zt)/q,Tt=(Dt-S)*(Dt-S)+(Pt-b)*(Pt-b),ht=S+(Dt-S)*O,kt=b+(Pt-b)*O,Vt=S-(Dt-S)*L,jt=b-(Pt-b)*L,Ft=Math.min(V*V+T*T,_*_+U*U),Qi=Z?O:L,Ql=Ft+Qi*Qi*w;Tt<=Ql?l.join==="bevel"||Tt/w>C?(Z?(f.push(ht,kt),f.push(S+E*L,b+F*L),f.push(ht,kt),f.push(S+z*L,b+B*L)):(f.push(S-E*O,b-F*O),f.push(Vt,jt),f.push(S-z*O,b-B*O),f.push(Vt,jt)),d+=2):l.join==="round"?Z?(f.push(ht,kt),f.push(S+E*L,b+F*L),d+=de(S,b,S+E*L,b+F*L,S+z*L,b+B*L,f,!0)+4,f.push(ht,kt),f.push(S+z*L,b+B*L)):(f.push(S-E*O,b-F*O),f.push(Vt,jt),d+=de(S,b,S-E*O,b-F*O,S-z*O,b-B*O,f,!1)+4,f.push(S-z*O,b-B*O),f.push(Vt,jt)):(f.push(ht,kt),f.push(Vt,jt)):(f.push(S-E*O,b-F*O),f.push(S+E*L,b+F*L),l.join==="round"?Z?d+=de(S,b,S+E*L,b+F*L,S+z*L,b+B*L,f,!0)+2:d+=de(S,b,S-E*O,b-F*O,S-z*O,b-B*O,f,!1)+2:l.join==="miter"&&Tt/w<=C&&(Z?(f.push(Vt,jt),f.push(Vt,jt)):(f.push(ht,kt),f.push(ht,kt)),d+=2),f.push(S-z*O,b-B*O),f.push(S+z*L,b+B*L),d+=2)}v=n[(y-2)*2],x=n[(y-2)*2+1],S=n[(y-1)*2],b=n[(y-1)*2+1],E=-(x-b),F=v-S,A=Math.sqrt(E*E+F*F),E/=A,F/=A,E*=M,F*=M,f.push(S-E*O,b-F*O),f.push(S+E*L,b+F*L),p||(l.cap==="round"?d+=de(S-E*(O-L)*.5,b-F*(O-L)*.5,S-E*O,b-F*O,S+E*L,b+F*L,f,!1)+2:l.cap==="square"&&(d+=di(S,b,E,F,O,L,!1,f)));const j=pi*pi;for(let I=P;I<d+P-2;++I)v=f[I*2],x=f[I*2+1],S=f[(I+1)*2],b=f[(I+1)*2+1],D=f[(I+2)*2],N=f[(I+2)*2+1],!(Math.abs(v*(b-N)+S*(N-x)+D*(x-b))<j)&&r.push(I,I+1,I+2);return{vertices:e,indices:r}}function Ua(n){const t=n.length;if(t<6)return 1;let e=0;for(let r=0,i=n[t-2],o=n[t-1];r<t;r+=2){const s=n[r],a=n[r+1];e+=(s-i)*(a+o),i=s,o=a}return e<0?-1:1}function di(n,t,e,r,i,o,s,a){const l=n-e*i,c=t-r*i,u=n+e*o,h=t+r*o;let p,g;s?(p=r,g=-e):(p=-r,g=e);const f=l+p,y=c+g,d=u+p,P=h+g;return a.push(f,y),a.push(d,P),2}function de(n,t,e,r,i,o,s,a){const l=e-n,c=r-t;let u=Math.atan2(l,c),h=Math.atan2(i-n,o-t);a&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let p=u;const g=h-u,f=Math.abs(g),y=Math.sqrt(l*l+c*c),d=(15*f*Math.sqrt(y)/Math.PI>>0)+1,P=g/d;if(p+=P,a){s.push(n,t),s.push(e,r);for(let M=1,w=p;M<d;M++,w+=P)s.push(n,t),s.push(n+Math.sin(w)*y,t+Math.cos(w)*y);s.push(n,t),s.push(i,o)}else{s.push(e,r),s.push(n,t);for(let M=1,w=p;M<d;M++,w+=P)s.push(n+Math.sin(w)*y,t+Math.cos(w)*y),s.push(n,t);s.push(i,o),s.push(n,t)}return d*2}class Ce{arcLengthDivision=200;_arcLengths;getPointAt(t,e=new k){return this.getPoint(this.getUToTMapping(t),e)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(t){const e=typeof t=="function";return this.getControlPointRefs().forEach(r=>{e?t(r):r.applyMatrix3(t)}),this}getUnevenVertices(t=5,e=[]){const r=new k;for(let i=0,o=Math.max(1,t)-1;i<=o;i++)this.getPoint(i/o,r),e.push(r.x,r.y);return e}getSpacedVertices(t=5,e=[]){const r=new k;for(let i=0,o=Math.max(1,t)-1;i<=o;i++)this.getPointAt(i/o,r),e.push(r.x,r.y);return e}getAdaptiveVertices(t=[]){return this.getUnevenVertices(5,t)}_verticesToPoints(t,e=[]){for(let r=0,i=t.length;r<i;r+=2){const o=t[r],s=t[r+1];e.push(new k(o,s))}return e}getSpacedPoints(t,e=[]){const r=this.getSpacedVertices(t);return this._verticesToPoints(r,e),e}getUnevenPoints(t,e=[]){const r=this.getUnevenVertices(t);return this._verticesToPoints(r,e),e}getAdaptivePoints(t=[]){const e=this.getAdaptiveVertices();return this._verticesToPoints(e,t),t}getPoints(t,e=[]){let r;return t?r=this.getUnevenVertices(t):r=this.getAdaptiveVertices(),this._verticesToPoints(r,e),e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const t=this.arcLengthDivision,e=[0];for(let r=0,i=this.getPoint(0),o=1;o<=t;o++){const s=this.getPoint(o/t);r+=s.distanceTo(i),e.push(r),i=s}this._arcLengths=e}getUToTMapping(t,e){const r=this.getLengths(),i=r.length,o=e??t*r[i-1];if(i<2)return o/r[0];let s=0,a=0,l=i-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=r[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,r[s]===o)return s/(i-1);const u=r[s],p=r[s+1]-u,g=(o-u)/p;return(s+g)/(i-1)}getTangent(t,e=new k){const i=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(i)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new k){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,i=1,o=(r+i)/2;for(;i-r>e;){o=(r+i)/2;const s=this.getPoint(o);if(s.distanceTo(t)<e)return o;s.x<t.x?r=o:i=o}return o}getMinMax(t=k.MAX,e=k.MIN){const r=this.getPoints();for(let i=0,o=r.length;i<o;i++){const s=r[i];t.min(s),e.max(s)}return{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new X(t.x,t.y,e.x-t.x,e.y-t.y)}getFillVertices(t){return this.getAdaptiveVertices()}fillTriangulate(t){return hi(this.getFillVertices(t),t)}strokeTriangulate(t){return Fa(this.getAdaptiveVertices(),t)}toCommands(){const t=[],e=this.getPoints();for(let r=0,i=e.length;r<i;r++){const o=e[r];r===0?t.push({type:"M",x:o.x,y:o.y}):t.push({type:"L",x:o.x,y:o.y})}return t}toData(){return Qo(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivision=t.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const La=new Ct,gi=new Ct,yi=new Ct,fn=new k;class nr extends Ce{constructor(t=new k,e=new k,r=new k,i=0,o=0,s=Math.PI*2,a=!1){super(),this._center=t,this._radius=e,this._diff=r,this.rotate=i,this.startAngle=o,this.endAngle=s,this.clockwise=a}get cx(){return this._center.x}set cx(t){this._center.x=t}get cy(){return this._center.y}set cy(t){this._center.y=t}get rx(){return this._radius.x}set rx(t){this._radius.x=t}get ry(){return this._radius.y}set ry(t){this._radius.y=t}get dx(){return this._diff.x}set dx(t){this._diff.x=t}get dy(){return this._diff.y}set dy(t){this._diff.y=t}isClockwise(){return this.clockwise}_getDeltaAngle(){const t=Math.PI*2;let e=this.endAngle-this.startAngle;const r=Math.abs(e)<Number.EPSILON;return e=(e%t+t)%t,r?e=0:this.clockwise||(e=e===0?-t:e-t),e}getPoint(t,e=new k){const r=this._getDeltaAngle(),i=this.startAngle+t*r;let o=this.cx+this.rx*Math.cos(i),s=this.cy+this.ry*Math.sin(i);if(this.rotate!==0){const a=Math.cos(this.rotate),l=Math.sin(this.rotate),c=o-this.cx,u=s-this.cy;o=c*a-u*l+this.cx,s=c*l+u*a+this.cy}return e.set(o,s)}toCommands(){const{cx:t,cy:e,rx:r,ry:i,startAngle:o,endAngle:s,clockwise:a,rotate:l}=this,c=t+r*Math.cos(o)*Math.cos(l)-i*Math.sin(o)*Math.sin(l),u=e+r*Math.cos(o)*Math.sin(l)+i*Math.sin(o)*Math.cos(l),h=Math.abs(o-s),p=h>Math.PI?1:0,g=a?1:0,f=l*180/Math.PI;if(h>=2*Math.PI){const y=o+Math.PI,d=t+r*Math.cos(y)*Math.cos(l)-i*Math.sin(y)*Math.sin(l),P=e+r*Math.cos(y)*Math.sin(l)+i*Math.sin(y)*Math.cos(l);return[{type:"M",x:c,y:u},{type:"A",rx:r,ry:i,angle:f,largeArcFlag:0,sweepFlag:g,x:d,y:P},{type:"A",rx:r,ry:i,angle:f,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const y=t+r*Math.cos(s)*Math.cos(l)-i*Math.sin(s)*Math.sin(l),d=e+r*Math.cos(s)*Math.sin(l)+i*Math.sin(s)*Math.cos(l);return[{type:"M",x:c,y:u},{type:"A",rx:r,ry:i,angle:f,largeArcFlag:p,sweepFlag:g,x:y,y:d}]}}drawTo(t){const{cx:e,cy:r,rx:i,ry:o,rotate:s,startAngle:a,endAngle:l,clockwise:c}=this;return t.ellipse(e,r,i,o,s,a,l,!c),this}applyTransform(t){return fn.set(this.cx,this.cy),fn.applyMatrix3(t),this.cx=fn.x,this.cy=fn.y,Na(t)?$a(this,t):za(this,t),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(t=[]){const{cx:e,cy:r,rx:i,ry:o,dx:s,dy:a,startAngle:l,endAngle:c,clockwise:u,rotate:h}=this,p=!u;let g=Math.abs(l-c);(!p&&l>c||p&&c>l)&&(g=2*Math.PI-g);const f=Math.max(12,Math.floor(12*i**(1/3)*(g/Math.PI)));let y=g/f,d=l;y*=p?-1:1;const P=Math.cos(p?h:-h),M=Math.sin(p?h:-h);for(let w=0;w<f+1;w++){const C=s+Math.cos(d)*i,v=a+Math.sin(d)*o,x=C*P-v*M,S=C*M+v*P;t.push(e+x,r+S),d+=y}return t}_getAdaptiveVerticesByCircle(t=[]){const{cx:e,cy:r,rx:i,ry:o,dx:s,dy:a,rotate:l,clockwise:c}=this;if(!(i>=0&&o>=0&&s>=0&&a>=0))return t;const u=Math.ceil(2.3*Math.sqrt(i+o)),h=u*8+(s?4:0)+(a?4:0),p=[];if(h===0)return t;{const y=p.length;if(u===0)p[y]=p[y+6]=e+s,p[y+1]=p[y+3]=r+a,p[y+2]=p[y+4]=e-s,p[y+5]=p[y+7]=r-a;else{let d=y,P=y+u*4+(s?2:0)+2,M=P,w=h,C=s+i,v=a,x=e+C,S=e-C,b=r+v;if(p[d++]=x,p[d++]=b,p[--P]=b,p[--P]=S,a){const N=r-v;p[M++]=S,p[M++]=N,p[--w]=N,p[--w]=x}for(let N=1;N<u;N++){const E=Math.PI/2*(N/u),F=s+Math.cos(E)*i,z=a+Math.sin(E)*o,B=e+F,A=e-F,W=r+z,O=r-z;p[d++]=B,p[d++]=W,p[--P]=W,p[--P]=A,p[M++]=A,p[M++]=O,p[--w]=O,p[--w]=B}C=s,v=a+o,x=e+C,S=e-C,b=r+v;const D=r-v;p[d++]=x,p[d++]=b,p[--w]=D,p[--w]=x,s&&(p[d++]=S,p[d++]=b,p[--w]=D,p[--w]=S)}}const g=Math.cos(c?-l:l),f=Math.sin(c?-l:l);for(let y=0;y<p.length;y+=2){const d=p[y],P=p[y+1],M=d-e,w=P-r,C=M*g-w*f,v=M*f+w*g;t.push(e+C,r+v)}return t}getAdaptiveVertices(t=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(t):this._getAdaptiveVerticesByArc(t)}copy(t){return super.copy(t),this.cx=t.cx,this.cy=t.cy,this.rx=t.rx,this.ry=t.ry,this.dx=t.dx,this.dy=t.dy,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotate=t.rotate,this}}function $a(n,t){const e=n.rx,r=n.ry,i=Math.cos(n.rotate),o=Math.sin(n.rotate),s=new k(e*i,e*o),a=new k(-r*o,r*i),l=s.applyMatrix3(t),c=a.applyMatrix3(t),u=La.set(l.x,c.x,0,l.y,c.y,0,0,0,1),h=gi.copy(u).invert(),f=yi.copy(h).transpose().multiply(h).elements,y=Va(f[0],f[1],f[4]),d=Math.sqrt(y.rt1),P=Math.sqrt(y.rt2);if(n.rx=1/d,n.ry=1/P,n.rotate=Math.atan2(y.sn,y.cs),!((n.endAngle-n.startAngle)%(2*Math.PI)<Number.EPSILON)){const w=gi.set(d,0,0,0,P,0,0,0,1),C=yi.set(y.cs,y.sn,0,-y.sn,y.cs,0,0,0,1),v=w.multiply(C).multiply(u),x=S=>{const{x:b,y:D}=new k(Math.cos(S),Math.sin(S)).applyMatrix3(v);return Math.atan2(D,b)};n.startAngle=x(n.startAngle),n.endAngle=x(n.endAngle),mi(t)&&(n.clockwise=!n.clockwise)}}function za(n,t){const e=xi(t),r=vi(t);n.rx*=e,n.ry*=r;const i=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);n.rotate+=i,mi(t)&&(n.startAngle*=-1,n.endAngle*=-1,n.clockwise=!n.clockwise)}function mi(n){const t=n.elements;return t[0]*t[4]-t[1]*t[3]<0}function Na(n){const t=n.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=xi(n),i=vi(n);return Math.abs(e/(r*i))>Number.EPSILON}function xi(n){const t=n.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function vi(n){const t=n.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Va(n,t,e){let r,i,o,s,a;const l=n+e,c=n-e,u=Math.sqrt(c*c+4*t*t);return l>0?(r=.5*(l+u),a=1/r,i=n*a*e-t*a*t):l<0?i=.5*(l-u):(r=.5*u,i=-.5*u),c>0?o=c+u:o=c-u,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(t)===0?(o=1,s=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),s=a*o),c>0&&(a=o,o=-s,s=a),{rt1:r,rt2:i,cs:o,sn:s}}class ja extends nr{constructor(t=0,e=0,r=1,i=0,o=Math.PI*2,s=!1){super(new k(t,e),new k(r,r),new k,0,i,o,s)}drawTo(t){const{cx:e,cy:r,rx:i,startAngle:o,endAngle:s,clockwise:a}=this;return t.arc(e,r,i,o,s,!a),this}}class Qt extends Ce{constructor(t=new k,e=new k){super(),this.p1=t,this.p2=e}static from(t,e,r,i){return new Qt(new k(t,e),new k(r,i))}getPoint(t,e=new k){return t===1?e.copy(this.p2):e.copy(this.p2).sub(this.p1).scale(t).add(this.p1),e}getPointAt(t,e=new k){return this.getPoint(t,e)}getTangent(t,e=new k){return e.subVectors(this.p2,this.p1).normalize()}getTangentAt(t,e=new k){return this.getTangent(t,e)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(t=[]){return t.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),t}getMinMax(t=k.MAX,e=k.MIN){const{p1:r,p2:i}=this;return t.x=Math.min(t.x,r.x,i.x),t.y=Math.min(t.y,r.y,i.y),e.x=Math.max(e.x,r.x,i.x),e.y=Math.max(e.y,r.y,i.y),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,p2:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}getFillVertices(t={}){const e=Math.min(this.p1.x,this.p2.x),r=Math.max(this.p1.x,this.p2.x),i=Math.min(this.p1.y,this.p2.y),o=Math.max(this.p1.y,this.p2.y),s=e,a=i,l=r-e||t.style?.strokeWidth||0,c=o-i||t.style?.strokeWidth||0;return[s,a,s+l,a,s+l,a+c,s,a+c]}drawTo(t){const{p1:e,p2:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.p2.copy(t.p2),this}}class Ge extends Ce{constructor(t=[]){super(),this.curves=t}getFlatCurves(){return this.curves.flatMap(t=>t instanceof Ge?t.getFlatCurves():t)}addCurve(t){return this.curves.push(t),this}getPoint(t,e=new k){const r=t*this.getLength(),i=this.getLengths();let o=0;for(;o<i.length;){if(i[o]>=r){const s=i[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/l,e)}o++}return e}updateLengths(){const t=[];for(let e=0,r=0,i=this.curves.length;e<i;e++)r+=this.curves[e].getLength(),t.push(r);this._arcLengths=t}getControlPointRefs(){return this.curves.flatMap(t=>t.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(t,e){const r=[t[e-1],t[e]],i=[t[e+1],t[e+2]];return r[0]===i[0]&&r[1]===i[1]&&t.splice(e+1,2),t}getSpacedVertices(t=5,e=[]){let r;return this.curves.forEach(i=>{i.getSpacedVertices(t,e),r&&this._removeNextPointIfEqualPrevPoint(e,r),r=e.length-1}),e}getAdaptiveVertices(t=[]){let e;return this.curves.forEach(r=>{r.getAdaptiveVertices(t),e&&this._removeNextPointIfEqualPrevPoint(t,e),e=t.length-1}),t}strokeTriangulate(t){return this.curves.length===1?this.curves[0].strokeTriangulate(t):super.strokeTriangulate(t)}getFillVertices(t){if(this.curves.length===1)return this.curves[0].getFillVertices(t);{const e=[];let r;return this.curves.forEach(i=>{let o;i instanceof Qt?o=i.getAdaptiveVertices():o=i.getFillVertices(t),e.push(...o),r&&this._removeNextPointIfEqualPrevPoint(e,r),r=e.length-1}),e}}applyTransform(t){return this.curves.forEach(e=>e.applyTransform(t)),this}getMinMax(t=k.MAX,e=k.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new X(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this}copy(t){return super.copy(t),this.curves=t.curves.map(e=>e.clone()),this}}class rr extends Ce{constructor(t=new k,e=new k,r=new k,i=new k){super(),this.p1=t,this.cp1=e,this.cp2=r,this.p2=i}static from(t,e,r,i,o,s,a,l){return new rr(new k(t,e),new k(r,i),new k(o,s),new k(a,l))}getPoint(t,e=new k){const{p1:r,cp1:i,cp2:o,p2:s}=this;return e.set(ci(t,r.x,i.x,o.x,s.x),ci(t,r.y,i.y,o.y,s.y))}getAdaptiveVertices(t=[]){return ba(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,t)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(t,e,r){const i=e*e-4*t*r;if(i<0)return[];const o=Math.sqrt(i),s=(-e+o)/(2*t),a=(-e-o)/(2*t);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(t=k.MAX,e=k.MIN){const{p1:r,cp1:i,cp2:o,p2:s}=this,a=this._solveQuadratic(3*(i.x-r.x),6*(o.x-i.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(i.y-r.y),6*(o.y-i.y),3*(s.y-o.y)),c=[0,1,...a,...l];return((h,p)=>{for(const g of h)for(let f=0;f<=p;f++){const y=f/p-.5,d=Math.min(1,Math.max(0,g+y)),P=this.getPoint(d);t.x=Math.min(t.x,P.x),t.y=Math.min(t.y,P.y),e.x=Math.max(e.x,P.x),e.y=Math.max(e.y,P.y)}})(c,10),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp1:e,cp2:r,p2:i}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:i.x,y:i.y}]}drawTo(t){const{p1:e,cp1:r,cp2:i,p2:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,i.x,i.y,o.x,o.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp1.copy(t.cp1),this.cp2.copy(t.cp2),this.p2.copy(t.p2),this}}class Ra extends nr{constructor(t=0,e=0,r=1,i=1,o=0,s=0,a=Math.PI*2,l=!1){super(new k(t,e),new k(r,i),new k,o,s,a,l)}drawTo(t){return t.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Ga extends Ge{}class ir extends Ce{constructor(t=new k,e=new k,r=new k){super(),this.p1=t,this.cp=e,this.p2=r}static from(t,e,r,i,o,s){return new ir(new k(t,e),new k(r,i),new k(o,s))}getPoint(t,e=new k){const{p1:r,cp:i,p2:o}=this;return e.set(fi(t,r.x,i.x,o.x),fi(t,r.y,i.y,o.y)),e}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(t=[]){return Ma(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,t)}getMinMax(t=k.MAX,e=k.MIN){const{p1:r,cp:i,p2:o}=this,s=.5*(r.x+i.x),a=.5*(r.y+i.y),l=.5*(r.x+o.x),c=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,s,l),t.y=Math.min(t.y,r.y,o.y,a,c),e.x=Math.max(e.x,r.x,o.x,s,l),e.y=Math.max(e.y,r.y,o.y,a,c),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp:e,p2:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{p1:e,cp:r,p2:i}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,i.x,i.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp.copy(t.cp),this.p2.copy(t.p2),this}}class qa extends Ga{constructor(t=0,e=0,r=0,i=0){super(),this.x=t,this.y=e,this.width=r,this.height=i,this.update()}update(){const{x:t,y:e,width:r,height:i}=this,o=[new k(t,e),new k(t+r,e),new k(t+r,e+i),new k(t,e+i)];return this.curves=[new Qt(o[0],o[1]),new Qt(o[1],o[2]),new Qt(o[2],o[3]),new Qt(o[3],o[0])],this}drawTo(t){return t.rect(this.x,this.y,this.width,this.height),this}getFillVertices(t={}){const{x:e,y:r,width:i,height:o}=this;return[e,r,e+i,r,e+i,r+o,e,r+o]}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.update(),this}}class Wa extends nr{constructor(t=0,e=0,r=1,i=1,o=1){super(),this.x=t,this.y=e,this.width=r,this.height=i,this.radius=o,this.update()}update(){const{x:t,y:e,width:r,height:i,radius:o}=this,s=r/2,a=i/2,l=t+s,c=e+a,u=Math.max(0,Math.min(o,Math.min(s,a))),h=u;return this._center=new k(l,c),this._radius=new k(u,h),this._diff=new k(s-u,a-h),this}drawTo(t){const{x:e,y:r,width:i,height:o,radius:s}=this;return t.roundRect(e,r,i,o,s),this}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.radius=t.radius,this.update(),this}}class Ha extends Ce{constructor(t=[]){super(),this.points=t}getPoint(t,e=new k){const{points:r}=this,i=(r.length-1)*t,o=Math.floor(i),s=i-o,a=r[o===0?o:o-1],l=r[o],c=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return e.set(li(s,a.x,l.x,c.x,u.x),li(s,a.y,l.y,c.y,u.y)),e}getControlPointRefs(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}class pn extends Ge{startPoint;currentPoint;autoClose=!1;constructor(t){super(),t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:i,y:o}=t[e];this.lineTo(i,o)}return this}addCommands(t){return Kr(t,this),this}addData(t){return this.addCommands(Qr(t)),this}_closeVertices(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenVertices(t=40,e=[]){return this._closeVertices(super.getUnevenVertices(t,e))}getSpacedVertices(t=40,e=[]){return this._closeVertices(super.getSpacedVertices(t,e))}getAdaptiveVertices(t=[]){return this._closeVertices(super.getAdaptiveVertices(t))}getFillVertices(t){return this._closeVertices(super.getFillVertices(t))}_setCurrentPoint(t){return this.currentPoint=new k(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const e=t.getPoint(0);(!this.currentPoint||!e.equals(this.currentPoint))&&this.lineTo(e.x,e.y)}return this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;e&&!t.equals(e)&&(this.curves.push(new Qt(e.clone(),t.clone())),e.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint=new k(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){const r=this.currentPoint;return r?.equals({x:t,y:e})||this.curves.push(Qt.from(r?.x??0,r?.y??0,t,e)),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,i,o,s){const a=this.currentPoint;return a?.equals({x:o,y:s})||this.curves.push(rr.from(a?.x??0,a?.y??0,t,e,r,i,o,s)),this._setCurrentPoint({x:o,y:s}),this}quadraticCurveTo(t,e,r,i){const o=this.currentPoint;return o?.equals({x:r,y:i})||this.curves.push(ir.from(o?.x??0,o?.y??0,t,e,r,i)),this._setCurrentPoint({x:r,y:i}),this}arc(t,e,r,i,o,s){const a=new ja(t,e,r,i,o,!s);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint(a.getPoint(1)),this}relativeArc(t,e,r,i,o,s){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.arc(t,e,r,i,o,s),this}arcTo(t,e,r,i,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,i,o,s,a,l=!0){const c=new Ra(t,e,r,i,o,s,a,!l);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,e,r,i,o,s,a,l){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.ellipse(t,e,r,i,o,s,a,l),this}rect(t,e,r,i){const o=new qa(t,e,r,i);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint({x:t,y:e}),this}roundRect(t,e,r,i,o){const s=new Wa(t,e,r,i,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){const e=this.currentPoint??new k;return this.curves.push(new Ha([e].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=t.currentPoint?.clone(),this}}class _t extends Ge{_meta;currentCurve=new pn;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}constructor(t,e={}){super(),this.curves.push(this.currentCurve),this.style=e,t&&(t instanceof _t?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(t){return this._meta=t,this}addPath(t){const e=this.curves.findIndex(r=>r===this.currentCurve);return e>-1&&this.curves.splice(e,1),t instanceof _t?this.curves.push(...t.curves.filter(r=>r.curves.length).map(r=>r.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new pn().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,e){return this.currentCurve.currentPoint?.equals({x:t,y:e})||(this.currentCurve.curves.length&&(this.currentCurve=new pn,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,e)),this}lineTo(t,e){return this.currentCurve.lineTo(t,e),this}bezierCurveTo(t,e,r,i,o,s){return this.currentCurve.bezierCurveTo(t,e,r,i,o,s),this}quadraticCurveTo(t,e,r,i){return this.currentCurve.quadraticCurveTo(t,e,r,i),this}arc(t,e,r,i,o,s){return this.currentCurve.arc(t,e,r,i,o,s),this}arcTo(t,e,r,i,o){return this.currentCurve.arcTo(t,e,r,i,o),this}ellipse(t,e,r,i,o,s,a,l){return this.currentCurve.ellipse(t,e,r,i,o,s,a,l),this}rect(t,e,r,i){return this.currentCurve.rect(t,e,r,i),this}roundRect(t,e,r,i,o){return this.currentCurve.roundRect(t,e,r,i,o),this}reset(){return this.currentCurve=new pn,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return Kr(t,this),this}addData(t){return this.addCommands(Qr(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,e=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getFlatCurves(),r=[],i=[],o=[];e.forEach((a,l)=>{const c=a.getControlPointRefs(),u=a.isClockwise();o[l]=c,i[l]=u;const h=c[0],p=c[c.length-1]??h;r.push({start:u?p:h,end:u?h:p,index:l})});const s=[];return r.forEach((a,l)=>{s[l]=[],r.forEach((c,u)=>{c.start&&a.end&&u!==l&&c.start?.equals(a.end)&&s[l].push(c.index)})}),e.forEach((a,l)=>{const c=i[l];o[l].forEach(u=>{u.add(a.getNormal(a.getTForPoint(u)).scale(c?t:-t))})}),s.forEach((a,l)=>{const c=o[l];a.forEach(u=>{const h=o[u],p=Ta(c[c.length-1],c[c.length-2]??c[c.length-1],h[0],h[1]??h[0]);p&&(c[c.length-1].copy(p),h[0].copy(p))})}),this}getMinMax(t=k.MAX,e=k.MIN,r=!0){const i=this.strokeWidth;return this.curves.forEach(o=>{if(o.getMinMax(t,e),r&&i>1){const s=i/2,a=o.isClockwise(),l=[];for(let c=0;c<=1;c+=1/o.arcLengthDivision){const u=o.getPoint(c),h=o.getNormal(c),p=h.clone().scale(a?s:-s),g=h.clone().scale(a?-s:s);l.push(u.clone().add(p),u.clone().add(g),u.clone().add({x:s,y:0}),u.clone().add({x:-s,y:0}),u.clone().add({x:0,y:s}),u.clone().add({x:0,y:-s}),u.clone().add({x:s,y:s}),u.clone().add({x:-s,y:-s}))}t.min(...l),e.max(...l)}}),{min:t.finite(),max:e.finite()}}strokeTriangulate(t){const e=t?.indices??[],r=t?.vertices??[];return this.curves.forEach(i=>{i.strokeTriangulate({...t,indices:e,vertices:r,style:{...this.style}})}),{indices:e,vertices:r}}fillTriangulate(t){const e={...t,style:{...this.style,...t?.style}},r=e.indices??[],i=e.vertices??[];if((e.style.fillRule??"nonzero")==="nonzero"){const s=this.curves.map(c=>c.getFillVertices(e)),a=Oa(s),l=a.length;for(let c=0;c<l;c++){const u=a[c],h=s[c];if(u.wn||!h.length)continue;const p=h.slice(),g=[];for(let f=0;f<l;f++){const y=a[f];y.parentIndex===c&&(g.push(p.length/2),p.push(...s[y.index]))}hi(p,{...t,indices:r,vertices:i,holes:g,style:{...this.style}})}}else this.curves.forEach(s=>{s.fillTriangulate({...t,indices:r,vertices:i,style:{...this.style}})});return{indices:r,vertices:i}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new X(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:i="none"}=e;return t.beginPath(),t.save(),Kn(t,e),this.curves.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:i="none"}=e;return t.beginPath(),t.save(),Kn(t,e),this.getControlPointRefs().forEach(o=>{Zo(t,o.x,o.y,{radius:4})}),r!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const i in t)t[i]!==void 0&&(e[_a(i)]=t[i]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const i in e)e[i]!==void 0&&(r+=`${i}:${e[i]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class se{constructor(t=[],e){this.paths=t,this.viewBox=e}getBoundingBox(t=!0){if(!this.paths.length)return;const e=k.MAX,r=k.MIN;return this.paths.forEach(i=>i.getMinMax(e,r,t)),new X(e.x,e.y,r.x-e.x,r.y-e.y)}toTriangulatedSvgString(t=this.paths.map(r=>r.fillTriangulate()),e=0){let r="";const i={x:-e,y:-e},o={x:e,y:e};(Array.isArray(t)?t:[t]).forEach(({vertices:l,indices:c})=>{const u=h=>{const p=l[h*2],g=l[h*2+1];return i.x=Math.min(i.x,p+e),o.x=Math.max(o.x,p+e),i.y=Math.min(i.y,g+e),o.y=Math.max(o.y,g+e),[p,g]};for(let h=0,p=c.length;h<p;h+=3){const g=u(c[h]),f=u(c[h+1]),y=u(c[h+2]);r+=`<polygon points="${g.join(",")} ${f.join(",")} ${y.join(",")}" stroke="none" fill="black" />`}});const a=[i.x,i.y,o.x-i.x,o.y-i.y];return`<svg width="${a[2]}" height="${a[3]}" viewBox="${a.join(" ")}" xmlns="http://www.w3.org/2000/svg">${r}</svg>`}toTriangulatedSvg(t,e){return new DOMParser().parseFromString(this.toTriangulatedSvgString(t,e),"image/svg+xml").documentElement}toSvgString(){const{x:t,y:e,width:r,height:i}=this.getBoundingBox(),o=this.paths.map(s=>s.toSvgPathString()).join("");return`<svg viewBox="${t} ${e} ${r} ${i}" width="${r}px" height="${i}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...r}=t,{left:i,top:o,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*e,l.height=a*e,l.style.width=`${s}px`,l.style.height=`${a}px`;const c=l.getContext("2d");return c&&(c.scale(e,e),c.translate(-i,-o),this.paths.forEach(u=>{u.drawTo(c,r)})),l}}const Xa=new Set(["©","®","÷"]),Za=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),Ya={1:"italic",32:"bold"},Ka={1:"italic",2:"bold"},wi={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class bi{constructor(t,e,r){this.content=t,this.index=e,this.parent=r}path=new _t().setMeta(this);lineBox=new X;inlineBox=new X;glyphBox;advanceWidth=0;advanceHeight=0;underlinePosition=0;underlineThickness=0;strikeoutPosition=0;strikeoutSize=0;ascender=0;descender=0;typoAscender=0;typoDescender=0;typoLineGap=0;winAscent=0;winDescent=0;xHeight=0;capHeight=0;baseline=0;centerDiviation=0;fontStyle;get compatibleGlyphBox(){const t=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new X(this.lineBox.left+this.lineBox.width/2-t/2,this.lineBox.top,t,this.lineBox.height):new X(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-t/2,this.lineBox.width,t))}get center(){return this.compatibleGlyphBox.center}get computedFill(){return this.parent.computedFill}get computedOutline(){return this.parent.computedOutline}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSFNT(t){const e=this.computedStyle.fontFamily,r=t??Io;let o=(e?r.get(e):r.fallbackFont)?.getSFNT();return o?.textToGlyphIndexes(this.content).includes(0)&&(o=r.fallbackFont?.getSFNT()),o}updateGlyph(t=this._getFontSFNT()){if(!t)return this;const{hhea:e,os2:r,post:i,head:o}=t,s=o.unitsPerEm,a=e.ascent,l=e.descent,{content:c,computedStyle:u,isVertical:h}=this,{fontSize:p}=u,g=s/p,f=t.getAdvanceWidth(c,p),y=(a+Math.abs(l))/g,d=a/g;return this.advanceWidth=f,this.advanceHeight=y,this.inlineBox.width=h?y:f,this.inlineBox.height=h?f:y,this.underlinePosition=(a-i.underlinePosition)/g,this.underlineThickness=i.underlineThickness/g,this.strikeoutPosition=(a-r.yStrikeoutPosition)/g,this.strikeoutSize=r.yStrikeoutSize/g,this.ascender=a/g,this.descender=l/g,this.typoAscender=r.sTypoAscender/g,this.typoDescender=r.sTypoDescender/g,this.typoLineGap=r.sTypoLineGap/g,this.winAscent=r.usWinAscent/g,this.winDescent=r.usWinDescent/g,this.xHeight=r.sxHeight/g,this.capHeight=r.sCapHeight/g,this.baseline=d,this.centerDiviation=y/2-d,this.fontStyle=Ya[r.fsSelection]??Ka[o.macStyle],this}update(t){const e=this._getFontSFNT(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:i,computedStyle:o,baseline:s,inlineBox:a,ascender:l,descender:c,typoAscender:u,fontStyle:h,advanceWidth:p,advanceHeight:g}=this,{left:f,top:y}=a,d=o.fontStyle==="italic"&&h!=="italic";let P=f,M=y+s,w;const C=new _t().setMeta(this);if(r&&(P+=(g-p)/2,Math.abs(p-g)>.1&&(M-=(l-u)/(l+Math.abs(c))*g),w=void 0),r&&!Xa.has(i)&&(i.codePointAt(0)<=256||Za.has(i))){C.addCommands(e.getPathCommands(i,P,y+s-(g-p)/2,o.fontSize));const x={y:y-(g-p)/2+g/2,x:P+p/2};d&&this._italic(C,r?{x:x.x,y:y-(g-p)/2+s}:void 0),C.rotate(90,x)}else w!==void 0?(C.addCommands(e.glyphs.get(w).getPathCommands(P,M,o.fontSize)),d&&this._italic(C,r?{x:P+p/2,y:y+u/(l+Math.abs(c))*g}:void 0)):(C.addCommands(e.getPathCommands(i,P,M,o.fontSize)),d&&this._italic(C,r?{x:P+g/2,y:M}:void 0));const v=o.fontWeight??400;return v in wi&&(v===700||v==="bold")&&h!=="bold"&&C.bold(wi[v]*o.fontSize*.05),C.style={fill:this.computedFill??o.color,fillRule:"nonzero",stroke:this.computedOutline??(o.textStrokeWidth?o.textStrokeColor:"none"),strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(t,e){t.skew(-.24,0,e||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(t,e,r){if(this.path.curves[0]?.curves.length)return this.path.getMinMax(t,e,r)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:r,max:i}=e;return new X(r.x,r.y,i.x-r.x,i.y-r.y)}drawTo(t,e={}){const r=this.computedStyle,i={ctx:t,path:this.path,fontSize:r.fontSize,color:r.color,...e};if(this.glyphBox)he(i);else{t.save(),t.beginPath();const o=this.path.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*i.fontSize,shadowOffsetY:(i.shadowOffsetY??0)*i.fontSize,shadowBlur:(i.shadowBlur??0)*i.fontSize,shadowColor:i.shadowColor};Kn(t,s),t.font=`${i.fontSize}px ${i.fontFamily}`,this.isVertical?(t.textBaseline="middle",t.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(t.textBaseline="alphabetic",t.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),t.restore()}}}function sr(){const n=new Map;async function t(r){if(!n.has(r)){n.set(r,r);try{n.set(r,await fetch(r).then(i=>i.text()))}catch(i){console.warn(i),n.delete(r)}}}function e(r){return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("blob://")}return{loaded:n,needsLoad:e,load:t}}function or(n){const t=new Map;function e(r){let i=t.get(r);if(!i){const o=ni(n.needsLoad(r)?n.loaded.get(r)??r:r),s=ai(o);i={dom:o,pathSet:s},t.set(r,i)}return i}return{parsed:t,parse:e}}var Qa={grad:.9,turn:360,rad:360/(2*Math.PI)},Jt=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},at=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*n)/e+0},Et=function(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),n>e?e:n>t?n:t},Si=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},Ci=function(n){return{r:Et(n.r,0,255),g:Et(n.g,0,255),b:Et(n.b,0,255),a:Et(n.a)}},ar=function(n){return{r:at(n.r),g:at(n.g),b:at(n.b),a:at(n.a,3)}},Ja=/^#([0-9a-f]{3,8})$/i,dn=function(n){var t=n.toString(16);return t.length<2?"0"+t:t},Pi=function(n){var t=n.r,e=n.g,r=n.b,i=n.a,o=Math.max(t,e,r),s=o-Math.min(t,e,r),a=s?o===t?(e-r)/s:o===e?2+(r-t)/s:4+(t-e)/s:0;return{h:60*(a<0?a+6:a),s:o?s/o*100:0,v:o/255*100,a:i}},Mi=function(n){var t=n.h,e=n.s,r=n.v,i=n.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),s=r*(1-e),a=r*(1-(t-o)*e),l=r*(1-(1-t+o)*e),c=o%6;return{r:255*[r,a,s,s,l,r][c],g:255*[l,r,r,a,s,s][c],b:255*[s,s,l,r,r,a][c],a:i}},_i=function(n){return{h:Si(n.h),s:Et(n.s,0,100),l:Et(n.l,0,100),a:Et(n.a)}},Ti=function(n){return{h:at(n.h),s:at(n.s),l:at(n.l),a:at(n.a,3)}},ki=function(n){return Mi((e=(t=n).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},qe=function(n){return{h:(t=Pi(n)).h,s:(i=(200-(e=t.s))*(r=t.v)/100)>0&&i<200?e*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,r,i},tl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,el=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,nl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ai={string:[[function(n){var t=Ja.exec(n);return t?(n=t[1]).length<=4?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?at(parseInt(n[3]+n[3],16)/255,2):1}:n.length===6||n.length===8?{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16),a:n.length===8?at(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var t=nl.exec(n)||rl.exec(n);return t?t[2]!==t[4]||t[4]!==t[6]?null:Ci({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(n){var t=tl.exec(n)||el.exec(n);if(!t)return null;var e,r,i=_i({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(Qa[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return ki(i)},"hsl"]],object:[[function(n){var t=n.r,e=n.g,r=n.b,i=n.a,o=i===void 0?1:i;return Jt(t)&&Jt(e)&&Jt(r)?Ci({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(n){var t=n.h,e=n.s,r=n.l,i=n.a,o=i===void 0?1:i;if(!Jt(t)||!Jt(e)||!Jt(r))return null;var s=_i({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return ki(s)},"hsl"],[function(n){var t=n.h,e=n.s,r=n.v,i=n.a,o=i===void 0?1:i;if(!Jt(t)||!Jt(e)||!Jt(r))return null;var s=(function(a){return{h:Si(a.h),s:Et(a.s,0,100),v:Et(a.v,0,100),a:Et(a.a)}})({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Mi(s)},"hsv"]]},Oi=function(n,t){for(var e=0;e<t.length;e++){var r=t[e][0](n);if(r)return[r,t[e][1]]}return[null,void 0]},il=function(n){return typeof n=="string"?Oi(n.trim(),Ai.string):typeof n=="object"&&n!==null?Oi(n,Ai.object):[null,void 0]},lr=function(n,t){var e=qe(n);return{h:e.h,s:Et(e.s+100*t,0,100),l:e.l,a:e.a}},cr=function(n){return(299*n.r+587*n.g+114*n.b)/1e3/255},Ii=function(n,t){var e=qe(n);return{h:e.h,s:e.s,l:Et(e.l+100*t,0,100),a:e.a}},Ei=(function(){function n(t){this.parsed=il(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return n.prototype.isValid=function(){return this.parsed!==null},n.prototype.brightness=function(){return at(cr(this.rgba),2)},n.prototype.isDark=function(){return cr(this.rgba)<.5},n.prototype.isLight=function(){return cr(this.rgba)>=.5},n.prototype.toHex=function(){return t=ar(this.rgba),e=t.r,r=t.g,i=t.b,s=(o=t.a)<1?dn(at(255*o)):"","#"+dn(e)+dn(r)+dn(i)+s;var t,e,r,i,o,s},n.prototype.toRgb=function(){return ar(this.rgba)},n.prototype.toRgbString=function(){return t=ar(this.rgba),e=t.r,r=t.g,i=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+i+", "+o+")":"rgb("+e+", "+r+", "+i+")";var t,e,r,i,o},n.prototype.toHsl=function(){return Ti(qe(this.rgba))},n.prototype.toHslString=function(){return t=Ti(qe(this.rgba)),e=t.h,r=t.s,i=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+i+"%, "+o+")":"hsl("+e+", "+r+"%, "+i+"%)";var t,e,r,i,o},n.prototype.toHsv=function(){return t=Pi(this.rgba),{h:at(t.h),s:at(t.s),v:at(t.v),a:at(t.a,3)};var t},n.prototype.invert=function(){return Xt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},n.prototype.saturate=function(t){return t===void 0&&(t=.1),Xt(lr(this.rgba,t))},n.prototype.desaturate=function(t){return t===void 0&&(t=.1),Xt(lr(this.rgba,-t))},n.prototype.grayscale=function(){return Xt(lr(this.rgba,-1))},n.prototype.lighten=function(t){return t===void 0&&(t=.1),Xt(Ii(this.rgba,t))},n.prototype.darken=function(t){return t===void 0&&(t=.1),Xt(Ii(this.rgba,-t))},n.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},n.prototype.alpha=function(t){return typeof t=="number"?Xt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):at(this.rgba.a,3);var e},n.prototype.hue=function(t){var e=qe(this.rgba);return typeof t=="number"?Xt({h:t,s:e.s,l:e.l,a:e.a}):at(e.h)},n.prototype.isEqual=function(t){return this.toHex()===Xt(t).toHex()},n})(),Xt=function(n){return n instanceof Ei?n:new Ei(n)};function tt(n){return n==null||n==="none"}function Pe(n,t=0,e=10**t){return Math.round(e*n)/e+0}function zt(n,t=!1){if(typeof n!="object"||!n)return n;if(Array.isArray(n))return t?n.map(r=>zt(r,t)):n;const e={};for(const r in n){const i=n[r];i!=null&&(t?e[r]=zt(i,t):e[r]=i)}return e}function gn(n,t){const e={};return t.forEach(r=>{r in n&&(e[r]=n[r])}),e}function hr(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){const e=Array.from(new Set([...Object.keys(n),...Object.keys(t)]));return!e.length||e.every(r=>n[r]===t[r])}return!1}function sl(n,t,e){const r=t.length-1;if(r<0)return n===void 0?e:n;for(let i=0;i<r;i++){if(n==null)return e;n=n[t[i]]}return n==null||n[t[r]]===void 0?e:n[t[r]]}function ol(n,t,e){const r=t.length-1;for(let i=0;i<r;i++)typeof n[t[i]]!="object"&&(n[t[i]]={}),n=n[t[i]];n[t[r]]=e}function al(n,t,e){return n==null||!t||typeof t!="string"?e:n[t]!==void 0?n[t]:(t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,""),sl(n,t.split("."),e))}function ll(n,t,e){if(!(typeof n!="object"||!t))return t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,""),ol(n,t.split("."),e)}class cl{_observers=new Map;on(t,e){let r=this._observers.get(t);return r===void 0&&this._observers.set(t,r=new Set),r.add(e),this}once(t,e){const r=(...i)=>{this.off(t,r),e(...i)};return this.on(t,r),this}off(t,e){const r=this._observers.get(t);return r!==void 0&&(r.delete(e),r.size===0&&this._observers.delete(t)),this}emit(t,...e){return Array.from((this._observers.get(t)||new Map).values()).forEach(r=>r(...e)),this}destroy(){this._observers=new Map}}const ur=Symbol("properties"),Bi=Symbol("inited");function fr(n){let t;if(Object.hasOwn(n,ur))t=n[ur];else{const e=Object.getPrototypeOf(n);t=new Map(e?fr(e):void 0),n[ur]=t}return t}function Di(n,t,e,r){const{alias:i,internalKey:o}=r,s=n[t];i?ll(n,i,e):n[o]=e,n.onUpdateProperty?.(t,e,s)}function Fi(n,t,e){const{alias:r,internalKey:i}=e;let o;return r?o=al(n,r):o=n[i],o=o??Ui(n,t,e),o}function Ui(n,t,e){const{default:r,fallback:i}=e;let o;if(r!==void 0&&!n[Bi]){n[Bi]=!0;const s=typeof r=="function"?r():r;s!==void 0&&(n[t]=s,o=s)}return o=o??(typeof i=="function"?i():i),o}function hl(n,t){function e(){return typeof this.getProperty<"u"?this.getProperty(n):Fi(this,n,t)}function r(i){typeof this.setProperty<"u"?this.setProperty(n,i):Di(this,n,i,t)}return{get:e,set:r}}function ul(n,t,e={}){const r={...e,internalKey:Symbol(t)};fr(n).set(t,r);const i=hl(t,r);Object.defineProperty(n.prototype,t,{get(){return i.get.call(this)},set(o){i.set.call(this,o)},configurable:!0,enumerable:!0})}function oe(n){return function(t,e){if(typeof e!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");ul(t.constructor,e,n)}}class fl extends cl{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(t){super(),this.setProperties(t)}isDirty(t){return t?this._updatedProperties.has(t):this._updatedProperties.size>0}getProperty(t){const e=this.getPropertyDeclaration(t);if(e){if(e.internal||e.alias)return Fi(this,t,e);{let r;return this._propertyAccessor?.getProperty?r=this._propertyAccessor.getProperty(t):r=this._properties.get(t),r??Ui(this,t,e)}}}setProperty(t,e){const r=this.getPropertyDeclaration(t);if(r)if(r.internal||r.alias)Di(this,t,e,r);else{const i=this.getProperty(t);this._propertyAccessor?.setProperty?.(t,e),this._properties.set(t,e),this.onUpdateProperty?.(t,e,i)}}getProperties(t){const e={};for(const[r,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!t||t.includes(r))&&(e[r]=this.getProperty(r));return e}setProperties(t){if(t&&typeof t=="object")for(const e in t)this.setProperty(e,t[e]);return this}resetProperties(){for(const[t,e]of this.getPropertyDeclarations())this.setProperty(t,typeof e.default=="function"?e.default():e.default);return this}getPropertyDeclarations(){return fr(this.constructor)}getPropertyDeclaration(t){return this.getPropertyDeclarations().get(t)}setPropertyAccessor(t){const e=this.getPropertyDeclarations();this._propertyAccessor=void 0;const r={};return e.forEach((i,o)=>{r[o]=this.getProperty(o)}),this._propertyAccessor=t,e.forEach((i,o)=>{const s=this.getProperty(o),a=r[o];s!==void 0&&!Object.is(s,a)&&(this.setProperty(o,s),!i.internal&&!i.alias&&this.requestUpdate(o,s,a))}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(t=>globalThis.requestAnimationFrame(t)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(t){Promise.reject(t)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(t,e,r){Object.is(e,r)||this.requestUpdate(t,e,r)}requestUpdate(t,e,r){t!==void 0&&(this._updatedProperties.set(t,r),this._changedProperties.add(t),this._updateProperty(t,e,r),this.emit("updateProperty",t,e,r)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(t){}_updateProperty(t,e,r){}toJSON(){const t={};return this._properties.forEach((e,r)=>{e!==void 0&&(e&&typeof e=="object"?"toJSON"in e&&typeof e.toJSON=="function"?t[r]=e.toJSON():Array.isArray(e)?t[r]=[...e]:t[r]={...e}:t[r]=e)}),t}clone(){return new this.constructor(this.toJSON())}}function Li(n){let t;return typeof n=="number"?t={r:n>>24&255,g:n>>16&255,b:n>>8&255,a:(n&255)/255}:t=n,Xt(t)}function pl(n){return{r:Pe(n.r),g:Pe(n.g),b:Pe(n.b),a:Pe(n.a,3)}}function yn(n){const t=n.toString(16);return t.length<2?`0${t}`:t}const dl="#000000FF";function gl(n){return Li(n).isValid()}function Bt(n,t=!1){const e=Li(n);if(!e.isValid()){if(typeof n=="string")return n;const a=`Failed to normalizeColor ${n}`;if(t)throw new Error(a);return console.warn(a),dl}const{r,g:i,b:o,a:s}=pl(e.rgba);return`#${yn(r)}${yn(i)}${yn(o)}${yn(Pe(s*255))}`}var mn=mn||{};mn.parse=(function(){const n={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let t="";function e(T){const _=new Error(`${t}: ${T}`);throw _.source=t,_}function r(){const T=i();return t.length>0&&e("Invalid input not EOF"),T}function i(){return w(o)}function o(){return s("linear-gradient",n.linearGradient,l)||s("repeating-linear-gradient",n.repeatingLinearGradient,l)||s("radial-gradient",n.radialGradient,h)||s("repeating-radial-gradient",n.repeatingRadialGradient,h)}function s(T,_,U){return a(_,$=>{const q=U();return q&&(I(n.comma)||e("Missing comma before color stops")),{type:T,orientation:q,colorStops:w(C)}})}function a(T,_){const U=I(T);if(U){I(n.startCall)||e("Missing (");const $=_(U);return I(n.endCall)||e("Missing )"),$}}function l(){const T=c();if(T)return T;const _=j("position-keyword",n.positionKeywords,1);return _?{type:"directional",value:_.value}:u()}function c(){return j("directional",n.sideOrCorner,1)}function u(){return j("angular",n.angleValue,1)||j("angular",n.radianValue,1)}function h(){let T,_=p(),U;return _&&(T=[],T.push(_),U=t,I(n.comma)&&(_=p(),_?T.push(_):t=U)),T}function p(){let T=g()||f();if(T)T.at=d();else{const _=y();if(_){T=_;const U=d();U&&(T.at=U)}else{const U=d();if(U)T={type:"default-radial",at:U};else{const $=P();$&&(T={type:"default-radial",at:$})}}}return T}function g(){const T=j("shape",/^(circle)/i,0);return T&&(T.style=L()||y()),T}function f(){const T=j("shape",/^(ellipse)/i,0);return T&&(T.style=P()||A()||y()),T}function y(){return j("extent-keyword",n.extentKeywords,1)}function d(){if(j("position",/^at/,0)){const T=P();return T||e("Missing positioning value"),T}}function P(){const T=M();if(T.x||T.y)return{type:"position",value:T}}function M(){return{x:A(),y:A()}}function w(T){let _=T();const U=[];if(_)for(U.push(_);I(n.comma);)_=T(),_?U.push(_):e("One extra comma");return U}function C(){const T=v();return T||e("Expected color definition"),T.length=A(),T}function v(){return S()||F()||E()||D()||b()||N()||x()}function x(){return j("literal",n.literalColor,0)}function S(){return j("hex",n.hexColor,1)}function b(){return a(n.rgbColor,()=>({type:"rgb",value:w(B)}))}function D(){return a(n.rgbaColor,()=>({type:"rgba",value:w(B)}))}function N(){return a(n.varColor,()=>({type:"var",value:z()}))}function E(){return a(n.hslColor,()=>{I(n.percentageValue)&&e("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const _=B();I(n.comma);let U=I(n.percentageValue);const $=U?U[1]:null;I(n.comma),U=I(n.percentageValue);const q=U?U[1]:null;return(!$||!q)&&e("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[_,$,q]}})}function F(){return a(n.hslaColor,()=>{const T=B();I(n.comma);let _=I(n.percentageValue);const U=_?_[1]:null;I(n.comma),_=I(n.percentageValue);const $=_?_[1]:null;I(n.comma);const q=B();return(!U||!$)&&e("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[T,U,$,q]}})}function z(){return I(n.variableName)[1]}function B(){return I(n.number)[1]}function A(){return j("%",n.percentageValue,1)||W()||O()||L()}function W(){return j("position-keyword",n.positionKeywords,1)}function O(){return a(n.calcValue,()=>{let T=1,_=0;for(;T>0&&_<t.length;){const $=t.charAt(_);$==="("?T++:$===")"&&T--,_++}T>0&&e("Missing closing parenthesis in calc() expression");const U=t.substring(0,_-1);return V(_-1),{type:"calc",value:U}})}function L(){return j("px",n.pixelValue,1)||j("em",n.emValue,1)}function j(T,_,U){const $=I(_);if($)return{type:T,value:$[U]}}function I(T){let _,U;return U=/^\s+/.exec(t),U&&V(U[0].length),_=T.exec(t),_&&V(_[0].length),_}function V(T){t=t.substr(T)}return function(T){return t=T.toString().trim(),t.endsWith(";")&&(t=t.slice(0,-1)),r()}})();const yl=mn.parse.bind(mn);var xn=xn||{};xn.stringify=(function(){var n={"visit_linear-gradient":function(t){return n.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return n.visit_gradient(t)},"visit_radial-gradient":function(t){return n.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return n.visit_gradient(t)},visit_gradient:function(t){var e=n.visit(t.orientation);return e&&(e+=", "),t.type+"("+e+n.visit(t.colorStops)+")"},visit_shape:function(t){var e=t.value,r=n.visit(t.at),i=n.visit(t.style);return i&&(e+=" "+i),r&&(e+=" at "+r),e},"visit_default-radial":function(t){var e="",r=n.visit(t.at);return r&&(e+=r),e},"visit_extent-keyword":function(t){var e=t.value,r=n.visit(t.at);return r&&(e+=" at "+r),e},"visit_position-keyword":function(t){return t.value},visit_position:function(t){return n.visit(t.value.x)+" "+n.visit(t.value.y)},"visit_%":function(t){return t.value+"%"},visit_em:function(t){return t.value+"em"},visit_px:function(t){return t.value+"px"},visit_calc:function(t){return"calc("+t.value+")"},visit_literal:function(t){return n.visit_color(t.value,t)},visit_hex:function(t){return n.visit_color("#"+t.value,t)},visit_rgb:function(t){return n.visit_color("rgb("+t.value.join(", ")+")",t)},visit_rgba:function(t){return n.visit_color("rgba("+t.value.join(", ")+")",t)},visit_hsl:function(t){return n.visit_color("hsl("+t.value[0]+", "+t.value[1]+"%, "+t.value[2]+"%)",t)},visit_hsla:function(t){return n.visit_color("hsla("+t.value[0]+", "+t.value[1]+"%, "+t.value[2]+"%, "+t.value[3]+")",t)},visit_var:function(t){return n.visit_color("var("+t.value+")",t)},visit_color:function(t,e){var r=t,i=n.visit(e.length);return i&&(r+=" "+i),r},visit_angular:function(t){return t.value+"deg"},visit_directional:function(t){return"to "+t.value},visit_array:function(t){var e="",r=t.length;return t.forEach(function(i,o){e+=n.visit(i),o<r-1&&(e+=", ")}),e},visit_object:function(t){return t.width&&t.height?n.visit(t.width)+" "+n.visit(t.height):""},visit:function(t){if(!t)return"";if(t instanceof Array)return n.visit_array(t);if(typeof t=="object"&&!t.type)return n.visit_object(t);if(t.type){var e=n["visit_"+t.type];if(e)return e(t);throw Error("Missing visitor visit_"+t.type)}else throw Error("Invalid node.")}};return function(t){return n.visit(t)}})(),xn.stringify.bind(xn);function $i(n){const t=n.length-1;return n.map((e,r)=>{const i=e.value;let o=Pe(r/t,3),s="#00000000";switch(e.type){case"rgb":s=Bt({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=Bt({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=Bt(e.value);break;case"hex":s=Bt(`#${e.value}`);break}switch(e.length?.type){case"%":o=Number(e.length.value)/100;break}return{offset:o,color:s}})}function zi(n){let t=0;switch(n.orientation?.type){case"angular":t=Number(n.orientation.value);break}return{type:"linear-gradient",angle:t,stops:$i(n.colorStops)}}function Ni(n){return n.orientation?.map(t=>{switch(t?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:$i(n.colorStops)}}function vn(n){return n.startsWith("linear-gradient(")||n.startsWith("radial-gradient(")}function ml(n){return yl(n).map(t=>{switch(t?.type){case"linear-gradient":return zi(t);case"repeating-linear-gradient":return{...zi(t),repeat:!0};case"radial-gradient":return Ni(t);case"repeating-radial-gradient":return{...Ni(t),repeat:!0};default:return}}).filter(Boolean)}function xl(n){let t;return typeof n=="string"?t={color:n}:t={...n},{color:Bt(t.color)}}function vl(n){let t;if(typeof n=="string"?t={image:n}:t={...n},t.image){const{type:e,...r}=ml(t.image)[0]??{};switch(e){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return gn(t,["linearGradient","radialGradient","rotateWithShape"])}function wl(n){let t;return typeof n=="string"?t={image:n}:t={...n},gn(t,["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"])}function bl(n){let t;return typeof n=="string"?t={preset:n}:t={...n},tt(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=Bt(t.foregroundColor),tt(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=Bt(t.backgroundColor),gn(t,["preset","foregroundColor","backgroundColor"])}function Sl(n){return!tt(n.color)}function Cl(n){return typeof n=="string"?gl(n):Sl(n)}function Pl(n){return!tt(n.image)&&vn(n.image)||!!n.linearGradient||!!n.radialGradient}function Ml(n){return typeof n=="string"?vn(n):Pl(n)}function _l(n){return!tt(n.image)&&!vn(n.image)}function Tl(n){return typeof n=="string"?!vn(n):_l(n)}function kl(n){return!tt(n.preset)}function Al(n){return typeof n=="string"?!1:kl(n)}function We(n){const t=n&&typeof n=="object"?n.enabled:void 0;return Cl(n)?zt({enabled:t,...xl(n)}):Ml(n)?zt({enabled:t,...vl(n)}):Tl(n)?zt({enabled:t,...wl(n)}):Al(n)?zt({enabled:t,...bl(n)}):{}}function pr(n){return typeof n=="string"?{...We(n)}:{...We(n),...gn(n,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function Ol(){return{boxShadow:"none"}}function Il(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function El(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function Bl(){return{...Il(),...El(),...Ol(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function Dl(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function Fl(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function Ul(){return{...Dl(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function Ll(){return{...Fl(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function $l(){return{...Ll(),...Ul(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function wn(n){return zt({...n,color:tt(n.color)?void 0:Bt(n.color),backgroundColor:tt(n.backgroundColor)?void 0:Bt(n.backgroundColor),borderColor:tt(n.borderColor)?void 0:Bt(n.borderColor),outlineColor:tt(n.outlineColor)?void 0:Bt(n.outlineColor),shadowColor:tt(n.shadowColor)?void 0:Bt(n.shadowColor)})}function zl(){return{...Bl(),...$l()}}const Nl=/\r\n|\n\r|\n|\r/,Vl=new RegExp(`^(${Nl.source})$`),jl=`
|
|
6
|
+
`;function Rl(n){return Vl.test(n)}function Vi(n){const t=[];function e(){return t[t.length-1]}function r(a,l,c){const u=a?wn(a):{},h=l?We(l):void 0,p=c?pr(c):void 0,g=zt({...u,fill:h,outline:p,fragments:[]});return t[t.length-1]?.fragments.length===0?t[t.length-1]=g:t.push(g),g}function i(a="",l,c,u){const h=l?wn(l):{},p=c?We(c):void 0,g=u?pr(u):void 0;Array.from(a).forEach(f=>{if(Rl(f)){const{fragments:y,fill:d,outline:P,...M}=e()||r();y.length||y.push(zt({...h,fill:p,outline:g,content:jl})),r(M,d,P)}else{const y=e()||r(),d=y.fragments[y.fragments.length-1];if(d){const{content:P,fill:M,outline:w,...C}=d;if(hr(p,M)&&hr(g,w)&&hr(h,C)){d.content=`${P}${f}`;return}}y.fragments.push(zt({...h,fill:p,outline:g,content:f}))}})}(Array.isArray(n)?n:[n]).forEach(a=>{if(typeof a=="string")r(),i(a);else if(ji(a)){const{content:l,fill:c,outline:u,...h}=a;r(h,c,u),i(l)}else if(Gl(a)){const{fragments:l,fill:c,outline:u,...h}=a;r(h,c,u),l.forEach(p=>{const{content:g,fill:f,outline:y,...d}=p;i(g,d,f,y)})}else Array.isArray(a)?(r(),a.forEach(l=>{if(typeof l=="string")i(l);else if(ji(l)){const{content:c,fill:u,outline:h,...p}=l;i(c,p,u,h)}})):console.warn("Failed to parse text content",a)});const s=e();return s&&!s.fragments.length&&s.fragments.push({content:""}),t}function Gl(n){return n&&typeof n=="object"&&"fragments"in n&&Array.isArray(n.fragments)}function ji(n){return n&&typeof n=="object"&&"content"in n&&typeof n.content=="string"}function ql(n){return typeof n=="string"||Array.isArray(n)?{content:Vi(n)}:zt({...n,content:Vi(n.content??""),style:n.style?wn(n.style):void 0,effects:n.effects?n.effects.map(t=>wn(t)):void 0,measureDom:n.measureDom,fonts:n.fonts,fill:n.fill?We(n.fill):void 0,outline:n.outline?pr(n.outline):void 0})}function bn(n,t){return typeof n=="number"?n:n.endsWith("%")?(n=n.substring(0,n.length-1),Math.ceil(Number(n)/100*t.total)):n.endsWith("rem")?(n=n.substring(0,n.length-3),Number(n)*t.fontSize):n.endsWith("em")?(n=n.substring(0,n.length-2),Number(n)*t.fontSize):Number(n)}function Sn(n){return tt(n)?{}:n}function Ri(n,t){const e=Object.keys(n),r=Object.keys(t);return Array.from(new Set([...e,...r])).every(o=>ge(n[o],t[o]))}function ge(n,t){const e=typeof n;return e===typeof t?e==="object"?Ri(n,t):n===t:!1}function Wl(n){const t=n.startsWith("#")?n.slice(1):n;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const r=t.length===3?t.split("").map(a=>a+a).join(""):t,i=Number.parseInt(r.slice(0,2),16),o=Number.parseInt(r.slice(2,4),16),s=Number.parseInt(r.slice(4,6),16);return`rgb(${i}, ${o}, ${s})`}function Cn(n){if(!n)return n;const t={};for(const e in n)n[e]!==""&&n[e]!==void 0&&(t[e]=n[e]);return t}class Gi{constructor(t,e={},r,i){this.content=t,this.style=e,this.index=r,this.parent=i,this.updateComputedStyle().initCharacters()}inlineBox=new X;fill;outline;get computedFill(){return this.fill??this.parent.computedFill}get computedOutline(){return this.outline??this.parent.computedOutline}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,...Cn(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new bi(r,e++,this));return this.characters=t,this}}class qi{constructor(t,e,r){this.style=t,this.index=e,this.parent=r,this.updateComputedStyle()}lineBox=new X;fragments=[];fill;outline;get computedFill(){return this.fill??this.parent.fill}get computedOutline(){return this.outline??this.parent.outline}updateComputedStyle(){return this.computedStyle={...Cn(this.parent.computedStyle),...Cn(this.style)},this}}function Hl(n){return n}class He{static notZeroStyles=new Set(["width","height"]);static pxStyles=new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","margin","marginLeft","marginTop","marginRight","marginBottom","padding","paddingLeft","paddingTop","paddingRight","paddingBottom"]);_toDomStyle(t){const e={};for(const r in t){const i=t[r];He.notZeroStyles.has(r)&&i===0||(typeof i=="number"&&He.pxStyles.has(r)?e[r]=`${i}px`:e[r]=i)}return e}createDom(t,e){const r=document.createElement("section"),i={...e},o=e.writingMode.includes("horizontal");switch(e.textAlign){case"start":case"left":i.justifyContent="flex-start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="flex-end";break}switch(e.verticalAlign){case"top":i.alignItems="flex-start";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="flex-end";break}const s=!!(i.justifyContent||i.alignItems);Object.assign(r.style,{...this._toDomStyle({...i,boxSizing:i.boxSizing??"border-box",display:i.display??(s?"inline-flex":void 0),width:i.width??"max-content",height:i.height??"max-content"}),whiteSpace:"pre-wrap",wordBreak:"break-all"});const a=document.createElement("ul");return Object.assign(a.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:s&&o?"100%":void 0,height:s&&!o?"100%":void 0}),t.forEach(l=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._toDomStyle(l.style)}),l.fragments.forEach(u=>{const h=document.createElement("span");Object.assign(h.style,{verticalAlign:"inherit",...this._toDomStyle(u.style)}),h.appendChild(document.createTextNode(u.content)),c.appendChild(h)}),a.appendChild(c)}),r.appendChild(a),r}measureDomText(t){const e=document.createRange();e.selectNodeContents(t);const r=t.data??"";let i=0;return Array.from(r).map(o=>{const s=i+=r.substring(i).indexOf(o),a=s+o.length;i+=o.length,e.setStart(t,Math.max(s,0)),e.setEnd(t,a);const l=e.getClientRects?.()??[e.getBoundingClientRect()];let c=l[l.length-1];l.length>1&&c.width<2&&(c=l[l.length-2]);const u=e.toString();if(u!==""&&c&&c.width+c.height!==0)return{content:u,top:c.top,left:c.left,height:c.height,width:c.width}}).filter(Boolean)}measureDom(t){const e=[],r=[],i=[];return t.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll(":scope > *").forEach((l,c)=>{const u=l.getBoundingClientRect();r.push({paragraphIndex:s,fragmentIndex:c,left:u.left,top:u.top,width:u.width,height:u.height});let h=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(p=>{i.push({...p,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:c,characterIndex:h++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(p=>{p.firstChild instanceof window.Text&&this.measureDomText(p.firstChild).forEach(g=>{i.push({...g,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:c,characterIndex:h++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:e,fragments:r,characters:i}}measureParagraphDom(t,e){const r=e.getBoundingClientRect(),i=this.measureDom(e);i.paragraphs.forEach(a=>{const l=t[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),i.fragments.forEach(a=>{const l=t[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let s=0;return i.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:c,characterIndex:u}=a;o.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const h=t[l].fragments[c].characters[u],{fontHeight:p,isVertical:g}=h,f=o[s];h.inlineBox.left=f.left,h.inlineBox.top=f.top,h.inlineBox.width=f.width,h.inlineBox.height=f.height,g?(h.lineBox.left=f.left+(f.width-p)/2,h.lineBox.top=f.top,h.lineBox.width=p,h.lineBox.height=f.height):(h.lineBox.left=f.left,h.lineBox.top=f.top+(f.height-p)/2,h.lineBox.width=f.width,h.lineBox.height=p),s++}),{paragraphs:t,boundingBox:new X(0,0,r.width,r.height)}}measure(t,e,r){let i;r||(r=this.createDom(t,e),Object.assign(r.style,{position:"fixed",visibility:"hidden"}),document.body.appendChild(r),i=()=>r?.parentNode?.removeChild(r));const o=this.measureParagraphDom(t,r);return i?.(),o}}function Wi(){const n=new se,t=sr(),e=or(t);return{name:"background",pathSet:n,load:async r=>{const{backgroundImage:i}=r.computedStyle;i&&t.needsLoad(i)&&await t.load(i)},update:r=>{n.paths.length=0;const{computedStyle:i,lineBox:o,isVertical:s}=r,{backgroundImage:a,backgroundSize:l,backgroundColormap:c}=i;if(tt(a))return;const{pathSet:u}=e.parse(a),h=u.getBoundingBox(!0);let p,g,f,y;s?{x:g,y:p,width:y,height:f}=o:{x:p,y:g,width:f,height:y}=o;const d=Sn(c??"none"),P=u.paths.map(v=>{const x=v.clone();return x.style.fill&&x.style.fill in d&&(x.style.fill=d[x.style.fill]),x.style.stroke&&x.style.stroke in d&&(x.style.stroke=d[x.style.stroke]),x});let M,w;if(l==="rigid"){M=Math.max(r.fontSize*5/h.width),w=M;const v=new k;v.x=h.width-f/M,v.y=h.height-y/w,P.forEach(x=>{x.applyTransform(S=>{const b=S.x>h.left+h.width/2,D=S.y>h.top+h.height/2;b&&(S.x-=v.x),D&&(S.y-=v.y)})})}else M=f/h.width,w=y/h.height;const C=new Ct;C.translate(-h.x,-h.y),C.scale(M,w),s&&(C.translate(-f/2,-y/2),C.rotate(-Math.PI/2),C.translate(y/2,f/2)),C.translate(p,g),P.forEach(v=>{v.applyTransform(x=>{x.applyMatrix3(C)})}),n.paths.push(...P)},renderOrder:-2,render:(r,i)=>{const{boundingBox:o,computedStyle:s}=i;tt(s.backgroundColor)||(r.fillStyle=s.backgroundColor,r.fillRect(...o.array)),n.paths.forEach(a=>{if(he({ctx:r,path:a,fontSize:s.fontSize}),i.debug){const l=new se([a]).getBoundingBox();l&&r.strokeRect(l.x,l.y,l.width,l.height)}}),i.paragraphs.forEach(a=>{const{lineBox:l,style:c}=a;tt(c.backgroundColor)||(r.fillStyle=c.backgroundColor,r.fillRect(...l.array)),a.fragments.forEach(u=>{const{inlineBox:h,style:p}=u;tt(p.backgroundColor)||(r.fillStyle=p.backgroundColor,r.fillRect(...h.array))})})}}}function Pn(n){const{highlight:t,highlightImage:e,highlightReferImage:r,highlightColormap:i,highlightLine:o,highlightSize:s,highlightThickness:a}=n;return{image:t?.image??e??"none",referImage:t?.referImage??r??"none",colormap:t?.colormap??i??"none",line:t?.line??o??"none",size:t?.size??s??"cover",thickness:t?.thickness??a??"100%"}}function Hi(){const n=new se,t=[],e=sr(),r=or(e);return{name:"highlight",pathSet:n,load:async i=>{const o=new Set;i.forEachCharacter(s=>{const{computedStyle:a}=s,{image:l,referImage:c}=Pn(a);l&&e.needsLoad(l)&&o.add(l),c&&e.needsLoad(c)&&o.add(c)}),await Promise.all(Array.from(o).map(s=>e.load(s)))},update:i=>{t.length=0,n.paths.length=0;let o=[],s,a;i.forEachCharacter(l=>{const{computedStyle:c}=l,u=Pn(c),{image:h,colormap:p,line:g,size:f,thickness:y}=u;if(tt(h))s?.length&&(s=[],o.push(s));else{const{inlineBox:d,isVertical:P}=l,{fontSize:M}=c;(!a||ge(a.image,h)&&ge(a.colormap,p)&&ge(a.line,g)&&ge(a.size,f)&&ge(a.thickness,y))&&s?.length&&(P?s[0].inlineBox.left===d.left:s[0].inlineBox.top===d.top)&&s[0].fontSize===M?s.push(l):(s=[],s.push(l),o.push(s))}a=u}),o=o.filter(l=>l.length);for(let l=0;l<o.length;l++){const c=o[l],u=c[0],h=X.from(...c.map(I=>I.compatibleGlyphBox));if(!h.height||!h.width)continue;const{computedStyle:p,isVertical:g,inlineBox:f,compatibleGlyphBox:y,strikeoutPosition:d,underlinePosition:P}=u,{fontSize:M}=p,{image:w,referImage:C,colormap:v,line:x,size:S,thickness:b}=Pn(p),D=bn(b,{fontSize:M,total:h.width})/h.width,N=Sn(v),{pathSet:E,dom:F}=r.parse(w),z=E.getBoundingBox(!0),B=M/z.width*2,A=new X().copy(h);g&&(A.width=h.height,A.height=h.width,A.left=h.left+h.width);const W=Math.floor(A.width);let O=W;S!=="cover"&&(O=bn(S,{fontSize:M,total:h.width})||W,A.width=O);const L=!tt(C)&&tt(x);if(L)z.copy(r.parse(C).pathSet.getBoundingBox(!0));else{let I;if(tt(x))if(z.width/z.height>4){I="underline";const V=F.getAttribute("viewBox");if(V){const[T,_,U,$]=V.split(" ").map(Z=>Number(Z)),q=_+$/2;z.y<q&&z.y+z.height>q?I="line-through":z.y+z.height<q?I="overline":I="underline"}}else I="outline";else I=x;switch(I){case"outline":{const V=A.width*.2,T=A.height*.2;g?(A.x-=T/2,A.y-=V/2,A.x-=A.height):(A.x-=V/2,A.y-=T/2),A.width+=V,A.height+=T;break}case"overline":A.height=z.height*B,g?A.x=f.left+f.width:A.y=f.top;break;case"line-through":A.height=z.height*B,g?A.x=f.left+f.width-d+A.height/2:A.y=f.top+d-A.height/2;break;case"underline":A.height=z.height*B,g?A.x=y.left+y.width-P:A.y=f.top+P;break}}const j=new Ct;if(j.translate(-z.x,-z.y),j.scale(A.width/z.width,A.height/z.height),g){const I=A.width/2,V=A.height/2;L||j.translate(-I,-V),j.rotate(-Math.PI/2),L||j.translate(V,I)}j.translate(A.x,A.y);for(let I=0;I<Math.ceil(W/O);I++){const V=j.clone();g?V.translate(0,I*A.width):V.translate(I*A.width,0),E.paths.forEach(T=>{const _=T.clone().applyTransform(V);_.style.strokeWidth&&(_.style.strokeWidth*=B*D),_.style.strokeMiterlimit&&(_.style.strokeMiterlimit*=B),_.style.strokeDashoffset&&(_.style.strokeDashoffset*=B),_.style.strokeDasharray&&(_.style.strokeDasharray=_.style.strokeDasharray.map(U=>U*B)),_.style.fill&&_.style.fill in N&&(_.style.fill=N[_.style.fill]),_.style.stroke&&_.style.stroke in N&&(_.style.stroke=N[_.style.stroke]),n.paths.push(_),W!==O&&(g?t[n.paths.length-1]=new X(h.left-h.width*2,h.top,h.width*4,h.height):t[n.paths.length-1]=new X(h.left,h.top-h.height*2,h.width,h.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{const i=[];return n.paths.forEach((o,s)=>{const a=t[s];let l=o.getBoundingBox();if(a){const c=Math.max(l.x,a.x),u=Math.max(l.y,a.y),h=Math.min(l.right,a.right),p=Math.min(l.bottom,a.bottom);l=new X(c,u,h-c,p-u)}i.push(l)}),X.from(...i)},render:(i,o)=>{n.paths.forEach((s,a)=>{if(he({ctx:i,path:s,fontSize:o.computedStyle.fontSize,clipRect:t[a]}),o.debug){const l=new se([s]).getBoundingBox();l&&i.strokeRect(l.x,l.y,l.width,l.height)}})}}}function Xl(n,t){return`<svg width="${n*2}" height="${n*2}" xmlns="http://www.w3.org/2000/svg">
|
|
7
7
|
<circle cx="${n}" cy="${n}" r="${n}" fill="${t}" />
|
|
8
|
-
</svg>`}function
|
|
8
|
+
</svg>`}function Xi(){const n=new se;return{name:"listStyle",pathSet:n,update:t=>{n.paths.length=0;const{paragraphs:e,isVertical:r,fontSize:i}=t,o=i*.45;e.forEach(s=>{const{computedStyle:a}=s,{color:l,listStyleImage:c,listStyleColormap:u,listStyleSize:h,listStyleType:p}=a,g=Sn(u);let f=h,y;if(!tt(c))y=c;else if(!tt(p)){const x=i*.38/2;switch(f=f==="cover"?x*2:f,p){case"disc":y=Xl(x,String(l));break}}if(!y)return;const d=ai(y),P=d.getBoundingBox(),M=s.fragments[0]?.characters[0];if(!M)return;const{inlineBox:w}=M,C=f==="cover"?1:bn(f,{total:i,fontSize:i})/i,v=new Ct;if(r){const x=i/P.height*C;v.translate(-P.left,-P.top).rotate(Math.PI/2).scale(x,x).translate(w.left+(w.width-P.height*x)/2,w.top-o)}else{const x=i/P.height*C;v.translate(-P.left,-P.top).scale(x,x).translate(w.left-P.width*x-o,w.top+(w.height-P.height*x)/2)}n.paths.push(...d.paths.map(x=>{const S=x.clone();return S.applyTransform(v),S.style.fill&&S.style.fill in g&&(S.style.fill=g[S.style.fill]),S.style.stroke&&S.style.stroke in g&&(S.style.stroke=g[S.style.stroke]),S}))})}}}function Zi(){return{name:"outline"}}const ae=new k,Me=new Ct,le=new Ct;function Yi(){const n=new se;return{name:"render",pathSet:n,update:t=>{n.paths.length=0;const{paragraphs:e}=t;e.forEach(r=>{r.fragments.forEach(i=>{i.characters.forEach(o=>{n.paths.push(o.path)})})})},getBoundingBox:t=>{const{characters:e,fontSize:r,effects:i}=t,o=[];return e.forEach(s=>{i?.forEach(a=>{if(!s.glyphBox)return;const l=s.glyphBox.clone(),c=Mn(t,a);ae.set(l.left,l.top),ae.applyMatrix3(c),l.left=ae.x,l.top=ae.y,ae.set(l.right,l.bottom),ae.applyMatrix3(c),l.width=ae.x-l.left,l.height=ae.y-l.top;const u=(a.shadowOffsetX??0)*r,h=(a.shadowOffsetY??0)*r,p=Math.max(.1,a.textStrokeWidth??0)*r;l.left+=u-p,l.top+=h-p,l.width+=p*2,l.height+=p*2,o.push(l)})}),o.length?X.from(...o):void 0},render:(t,e)=>{const{paragraphs:r,glyphBox:i,effects:o}=e;o?o.forEach(s=>{_e(s,i,t),t.save();const[a,l,c,u,h,p]=Mn(e,s).transpose().elements;t.transform(a,u,l,h,c,p),e.forEachCharacter(g=>{g.drawTo(t,s)}),t.restore()}):r.forEach(s=>{s.fragments.forEach(a=>{a.characters.forEach(l=>{l.drawTo(t)})})}),e.debug&&r.forEach(s=>{t.strokeRect(s.lineBox.x,s.lineBox.y,s.lineBox.width,s.lineBox.height)})}}}function Mn(n,t){const{fontSize:e,glyphBox:r}=n,i=(t.translateX??0)*e,o=(t.translateY??0)*e,s=Math.PI*2,a=(t.skewX??0)/360*s,l=(t.skewY??0)/360*s,{left:c,top:u,width:h,height:p}=r,g=c+h/2,f=u+p/2;return Me.identity(),le.makeTranslation(i,o),Me.multiply(le),le.makeTranslation(g,f),Me.multiply(le),le.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),Me.multiply(le),le.makeTranslation(-g,-f),Me.multiply(le),Me.clone()}function Ki(){const n=new se;return{name:"textDecoration",pathSet:n,update:t=>{n.paths.length=0;const e=[];let r,i;t.forEachCharacter(o=>{const{computedStyle:s,isVertical:a,inlineBox:l,underlinePosition:c,underlineThickness:u,strikeoutPosition:h,strikeoutSize:p}=o,{color:g,textDecoration:f,writingMode:y}=s;if(tt(f))i=void 0;else{let d=!1;if(i?.textDecoration===f&&i?.writingMode===y&&i?.color===g&&(a?r[0].inlineBox.left===l.left:r[0].inlineBox.top===l.top))switch(f){case"underline":r[0].underlinePosition===c&&r[0].underlineThickness===u&&(d=!0);break;case"line-through":r[0].strikeoutPosition===h&&r[0].strikeoutSize===p&&(d=!0);break}d?r.push(o):(r=[],r.push(o),e.push(r)),i=s}}),e.forEach(o=>{const{computedStyle:s,isVertical:a,underlinePosition:l,underlineThickness:c,strikeoutPosition:u,strikeoutSize:h}=o[0],{color:p,textDecoration:g}=s,f=X.from(...o.map(S=>S.inlineBox)),{left:y,top:d,width:P,height:M}=f;let w=a?y+P:d;const C=a?-1:1;let v=0;switch(g){case"overline":v=c*2;break;case"underline":w+=C*l,v=c*2;break;case"line-through":w+=C*u,v=h*2;break}w-=v;let x;a?x=new _t([{type:"M",x:w,y:d},{type:"L",x:w,y:d+M},{type:"L",x:w+v,y:d+M},{type:"L",x:w+v,y:d},{type:"Z"}],{fill:p}):x=new _t([{type:"M",x:y,y:w},{type:"L",x:y+P,y:w},{type:"L",x:y+P,y:w+v},{type:"L",x:y,y:w+v},{type:"Z"}],{fill:p}),n.paths.push(x)})},render:(t,e)=>{const{effects:r,computedStyle:i}=e;r?r.forEach(o=>{t.save();const[s,a,l,c,u,h]=Mn(e,o).transpose().elements;t.transform(s,c,a,u,l,h),n.paths.forEach(p=>{he({ctx:t,path:p,fontSize:i.fontSize,...o})}),t.restore()}):n.paths.forEach(o=>{he({ctx:t,path:o,fontSize:i.fontSize})})}}}var Zl=Object.defineProperty,ce=(n,t,e,r)=>{for(var i=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(i=s(t,e,i)||i);return i&&Zl(t,e,i),i};const dr=zl();class Nt extends fl{needsUpdate=!0;computedStyle={...dr};paragraphs=[];lineBox=new X;rawGlyphBox=new X;glyphBox=new X;pathBox=new X;boundingBox=new X;measurer=new He;plugins=new Map;pathSets=[];get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}constructor(t={}){super(),this.set(t)}set(t={}){const{content:e,effects:r,style:i,measureDom:o,fonts:s,fill:a,outline:l}=ql(t);this.debug=t.debug??!1,this.content=e,this.effects=r,this.style=i,this.measureDom=o,this.fonts=s,this.fill=a,this.outline=l,this.use(Wi()).use(Zi()).use(Xi()).use(Ki()).use(Hi()).use(Yi()),(t.plugins??[]).forEach(c=>{this.use(c)}),this.updateParagraphs()}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((e,r)=>{e.fragments.forEach((i,o)=>{i.characters.forEach((s,a)=>{t(s,{paragraphIndex:r,fragmentIndex:o,characterIndex:a})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>t.load?.(this)))}updateParagraphs(){this.computedStyle={...dr,...this.style};const{content:t}=this,e=[];return t.forEach((r,i)=>{const{fragments:o,fill:s,outline:a,...l}=r,c=new qi(l,i,this);c.fill=s,c.outline=a,o.forEach((u,h)=>{const{content:p,fill:g,outline:f,...y}=u;if(p!==void 0){const d=new Gi(p,y,h,c);c.fragments.push(d),d.fill=g,d.outline=f}}),e.push(c)}),this.paragraphs=e,this}createDom(){return this.updateParagraphs(),this.measurer.createDom(this.paragraphs,this.computedStyle)}measure(t=this.measureDom){const e={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(i=>{i.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((i,o)=>(i.updateOrder??0)-(o.updateOrder??0)).forEach(i=>{i.update?.(this)}),this.pathSets.length=0,Array.from(this.plugins.values()).sort((i,o)=>(i.renderOrder??0)-(o.renderOrder??0)).forEach(i=>{i.pathSet?.paths.length&&this.pathSets.push(i.pathSet)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const i in e)r[i]=this[i],this[i]=e[i];return this.emit("measure",{text:this,result:r}),r}getGlyphBox(){const t=k.MAX,e=k.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,e)){const{inlineBox:i}=r,{left:o,top:s,width:a,height:l}=i,c=new k(o,s),u=new k(o+a,s+l);t.min(c,u),e.max(c,u)}}),new X(t.x,t.y,e.x-t.x,e.y-t.y)}updatePathBox(){return this.pathBox=X.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>t.getBoundingBox?t.getBoundingBox(this):t.pathSet?.getBoundingBox()).filter(Boolean)),this}updateBoundingBox(){return this.boundingBox=X.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(t=this.measureDom){const e=this.measure(t);for(const r in e)this[r]=e[r];return this.emit("update",{text:this}),this.needsUpdate=!1,this}render(t){const{view:e,pixelRatio:r=2}=t,i=e.getContext("2d");i&&(this.needsUpdate&&this.update(),yr(i,r,this.boundingBox),mr(i,this),Array.from(this.plugins.values()).sort((o,s)=>(o.renderOrder??0)-(s.renderOrder??0)).forEach(o=>{if(o.render)o.render?.(i,this);else if(o.pathSet){const s=this.computedStyle;o.pathSet.paths.forEach(a=>{he({ctx:i,path:a,fontSize:s.fontSize})})}}),this.emit("render",{text:this,view:e,pixelRatio:r}),t.onContext?.(i))}toString(){return this.content.flatMap(t=>t.fragments.map(e=>e.content)).join("")}}ce([oe({internal:!0})],Nt.prototype,"debug"),ce([oe()],Nt.prototype,"content"),ce([oe()],Nt.prototype,"style"),ce([oe()],Nt.prototype,"effects"),ce([oe()],Nt.prototype,"fill"),ce([oe()],Nt.prototype,"outline"),ce([oe({internal:!0})],Nt.prototype,"measureDom"),ce([oe({internal:!0})],Nt.prototype,"fonts");function Yl(n,t){const e=new Nt(n);return t?e.load().then(()=>e.measure()):e.measure()}function Kl(n,t){const e=new Nt(n);return t?e.load().then(()=>e.render(n)):e.render(n)}H.Character=bi,H.Fragment=Gi,H.Measurer=He,H.Paragraph=qi,H.Text=Nt,H.backgroundPlugin=Wi,H.createSVGLoader=sr,H.createSVGParser=or,H.definePlugin=Hl,H.drawPath=he,H.filterEmpty=Cn,H.getHighlightStyle=Pn,H.getTransform2D=Mn,H.hexToRgb=Wl,H.highlightPlugin=Hi,H.isEqualObject=Ri,H.isEqualValue=ge,H.listStylePlugin=Xi,H.measureText=Yl,H.outlinePlugin=Zi,H.parseColor=te,H.parseColormap=Sn,H.parseValueNumber=bn,H.renderPlugin=Yi,H.renderText=Kl,H.setupView=yr,H.textDecorationPlugin=Ki,H.textDefaultStyle=dr,H.uploadColor=_e,H.uploadColors=mr,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Text } from './shared/modern-text.
|
|
2
|
-
export { C as Character, F as Fragment, M as Measurer, P as Paragraph, c as backgroundPlugin, i as createSVGLoader, j as createSVGParser, b as definePlugin, d as drawPath, w as filterEmpty, g as getHighlightStyle, e as getTransform2D, v as hexToRgb, h as highlightPlugin, n as isEqualObject, q as isEqualValue, l as listStylePlugin, o as outlinePlugin, p as parseColor, m as parseColormap, k as parseValueNumber, r as renderPlugin, s as setupView, t as textDecorationPlugin, f as textDefaultStyle, u as uploadColor, a as uploadColors } from './shared/modern-text.
|
|
1
|
+
import { T as Text } from './shared/modern-text.y0a7DPYV.mjs';
|
|
2
|
+
export { C as Character, F as Fragment, M as Measurer, P as Paragraph, c as backgroundPlugin, i as createSVGLoader, j as createSVGParser, b as definePlugin, d as drawPath, w as filterEmpty, g as getHighlightStyle, e as getTransform2D, v as hexToRgb, h as highlightPlugin, n as isEqualObject, q as isEqualValue, l as listStylePlugin, o as outlinePlugin, p as parseColor, m as parseColormap, k as parseValueNumber, r as renderPlugin, s as setupView, t as textDecorationPlugin, f as textDefaultStyle, u as uploadColor, a as uploadColors } from './shared/modern-text.y0a7DPYV.mjs';
|
|
3
3
|
import 'modern-idoc';
|
|
4
4
|
import 'modern-path2d';
|
|
5
5
|
import 'modern-font';
|
|
@@ -1797,7 +1797,7 @@ class Text extends modernIdoc.Reactivable {
|
|
|
1797
1797
|
}
|
|
1798
1798
|
}
|
|
1799
1799
|
__decorateClass([
|
|
1800
|
-
modernIdoc.property()
|
|
1800
|
+
modernIdoc.property({ internal: true })
|
|
1801
1801
|
], Text.prototype, "debug");
|
|
1802
1802
|
__decorateClass([
|
|
1803
1803
|
modernIdoc.property()
|
|
@@ -1815,10 +1815,10 @@ __decorateClass([
|
|
|
1815
1815
|
modernIdoc.property()
|
|
1816
1816
|
], Text.prototype, "outline");
|
|
1817
1817
|
__decorateClass([
|
|
1818
|
-
modernIdoc.property()
|
|
1818
|
+
modernIdoc.property({ internal: true })
|
|
1819
1819
|
], Text.prototype, "measureDom");
|
|
1820
1820
|
__decorateClass([
|
|
1821
|
-
modernIdoc.property()
|
|
1821
|
+
modernIdoc.property({ internal: true })
|
|
1822
1822
|
], Text.prototype, "fonts");
|
|
1823
1823
|
|
|
1824
1824
|
exports.Character = Character;
|
|
@@ -1795,7 +1795,7 @@ class Text extends Reactivable {
|
|
|
1795
1795
|
}
|
|
1796
1796
|
}
|
|
1797
1797
|
__decorateClass([
|
|
1798
|
-
property()
|
|
1798
|
+
property({ internal: true })
|
|
1799
1799
|
], Text.prototype, "debug");
|
|
1800
1800
|
__decorateClass([
|
|
1801
1801
|
property()
|
|
@@ -1813,10 +1813,10 @@ __decorateClass([
|
|
|
1813
1813
|
property()
|
|
1814
1814
|
], Text.prototype, "outline");
|
|
1815
1815
|
__decorateClass([
|
|
1816
|
-
property()
|
|
1816
|
+
property({ internal: true })
|
|
1817
1817
|
], Text.prototype, "measureDom");
|
|
1818
1818
|
__decorateClass([
|
|
1819
|
-
property()
|
|
1819
|
+
property({ internal: true })
|
|
1820
1820
|
], Text.prototype, "fonts");
|
|
1821
1821
|
|
|
1822
1822
|
export { Character as C, Fragment as F, Measurer as M, Paragraph as P, Text as T, uploadColors as a, definePlugin as b, backgroundPlugin as c, drawPath as d, getTransform2D as e, textDefaultStyle as f, getHighlightStyle as g, highlightPlugin as h, createSVGLoader as i, createSVGParser as j, parseValueNumber as k, listStylePlugin as l, parseColormap as m, isEqualObject as n, outlinePlugin as o, parseColor as p, isEqualValue as q, renderPlugin as r, setupView as s, textDecorationPlugin as t, uploadColor as u, hexToRgb as v, filterEmpty as w };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { diffChars } from 'diff';
|
|
2
2
|
import { isCRLF, textContentToString, normalizeCRLF, normalizeTextContent, property } from 'modern-idoc';
|
|
3
|
-
import { T as Text } from '../shared/modern-text.
|
|
3
|
+
import { T as Text } from '../shared/modern-text.y0a7DPYV.mjs';
|
|
4
4
|
import 'modern-path2d';
|
|
5
5
|
import 'modern-font';
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.3",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "Measure and render text in a way that describes the DOM.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"diff": "^8.0.2",
|
|
59
59
|
"modern-font": "^0.4.1",
|
|
60
|
-
"modern-idoc": "^0.9.
|
|
60
|
+
"modern-idoc": "^0.9.11",
|
|
61
61
|
"modern-path2d": "^1.4.9"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@antfu/eslint-config": "^5.3.0",
|
|
65
|
-
"@types/node": "^24.5.
|
|
65
|
+
"@types/node": "^24.5.2",
|
|
66
66
|
"bumpp": "^10.2.3",
|
|
67
67
|
"conventional-changelog-cli": "^5.0.0",
|
|
68
68
|
"eslint": "^9.35.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"simple-git-hooks": "^2.13.1",
|
|
71
71
|
"typescript": "^5.9.2",
|
|
72
72
|
"unbuild": "^3.6.1",
|
|
73
|
-
"vite": "^7.1.
|
|
73
|
+
"vite": "^7.1.6",
|
|
74
74
|
"vitest": "^3.2.4"
|
|
75
75
|
},
|
|
76
76
|
"simple-git-hooks": {
|