three-text 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +33 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +33 -5
- package/dist/index.min.cjs +288 -285
- package/dist/index.min.js +379 -376
- package/dist/index.umd.js +33 -5
- package/dist/index.umd.min.js +264 -261
- package/dist/types/core/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.umd.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* three-text v0.4.
|
|
2
|
+
* three-text v0.4.4
|
|
3
3
|
* Copyright (C) 2025 Countertype LLC
|
|
4
4
|
*
|
|
5
5
|
* This program is free software: you can redistribute it and/or modify
|
|
@@ -101,7 +101,10 @@ null!==p&&p!==i&&(g(),y=w),null===p&&(p=i,y=w),d+=e,w+=e.length}return g(),c}sta
|
|
|
101
101
|
let y=0
|
|
102
102
|
for(const t of u){const u=e+y
|
|
103
103
|
if(/\s+/.test(t)){const e=i(t)
|
|
104
|
-
c.push({type:d.GLUE,width:e,stretch:.5*e,J:e*f,text:t,K:u}),y+=t.length}else{const e=
|
|
104
|
+
c.push({type:d.GLUE,width:e,stretch:.5*e,J:e*f,text:t,K:u}),y+=t.length}else{if(l&&t.includes("-")&&!t.includes("")&&i(t)>l){const e=Array.from(t)
|
|
105
|
+
for(let t=0;e.length>t;t++)c.push({type:d.BOX,width:i(e[t]),text:e[t],K:u+t}),e.length-1>t&&c.push({type:d.PENALTY,width:0,X:5e3,K:u+t+1})
|
|
106
|
+
y+=t.length
|
|
107
|
+
continue}const e=t.split(/(-)/)
|
|
105
108
|
let f=u
|
|
106
109
|
for(const t of e)if(t){if("-"===t)c.push({type:d.DISCRETIONARY,width:i("-"),rt:"-",ot:"",ht:"-",lt:i("-"),X:a?.ct??g,ut:!0,text:"-",K:f}),f+=1
|
|
107
110
|
else if(t.includes("")){const e=t.split("")
|
|
@@ -466,21 +469,21 @@ let h=n?s?o:r??this.Di(t):[]
|
|
|
466
469
|
if(e){const t=this.Bi(r,"boundary")
|
|
467
470
|
if(!t)return a.warn("libtess returned empty result from boundary pass"),{Li:{vertices:[],indices:[]},Gi:[]}
|
|
468
471
|
o=this.Ni(t),n&&(h=o)}const l=this.Bi(o,"triangles")
|
|
469
|
-
return l?{Li:{vertices:l.vertices,indices:l.indices||[]},Gi:h}:(a.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{Li:{vertices:[],indices:[]},Gi:h})}ki(t,e,i,n){const s=!i&&!e
|
|
472
|
+
return l?{Li:{vertices:l.vertices,indices:l.indices||[]},Gi:h,Ui:e}:(a.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{Li:{vertices:[],indices:[]},Gi:h})}ki(t,e,i,n){const s=!i&&!e
|
|
470
473
|
let r,o
|
|
471
|
-
s?(o=this.
|
|
474
|
+
s?(o=this.Pi(t),(e||n)&&(r=t)):(r=t,o=t)
|
|
472
475
|
let h=n?s?o:r??t:[]
|
|
473
476
|
if(e){const t=this.Bi(r,"boundary")
|
|
474
477
|
if(!t)return a.warn("libtess returned empty result from boundary pass"),{Li:{vertices:[],indices:[]},Gi:[]}
|
|
475
478
|
o=this.Ni(t),n&&(h=o)}const l=this.Bi(o,"triangles")
|
|
476
|
-
return l?{Li:{vertices:l.vertices,indices:l.indices||[]},Gi:h}:(a.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{Li:{vertices:[],indices:[]},Gi:h})}Di(t,e=!1){const i=Array(t.length)
|
|
479
|
+
return l?{Li:{vertices:l.vertices,indices:l.indices||[]},Gi:h,Ui:e}:(a.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{Li:{vertices:[],indices:[]},Gi:h})}Di(t,e=!1){const i=Array(t.length)
|
|
477
480
|
for(let n=0;t.length>n;n++){const s=t[n].points,r=s.length,o=r>1&&s[0].x===s[r-1].x&&s[0].y===s[r-1].y?r-1:r,h=Array(2*(o+1))
|
|
478
481
|
let a=0
|
|
479
482
|
if(e)for(let t=o-1;t>=0;t--){const e=s[t]
|
|
480
483
|
h[a++]=e.x,h[a++]=e.y}else for(let t=0;o>t;t++){const e=s[t]
|
|
481
|
-
h[a++]=e.x,h[a++]=e.y}2>a||(h[a++]=h[0],h[a++]=h[1]),i[n]=h}return i}
|
|
482
|
-
for(let i=0;t.length>i;i++)e[i]=this
|
|
483
|
-
return e}
|
|
484
|
+
h[a++]=e.x,h[a++]=e.y}2>a||(h[a++]=h[0],h[a++]=h[1]),i[n]=h}return i}Pi(t){const e=Array(t.length)
|
|
485
|
+
for(let i=0;t.length>i;i++)e[i]=this.$i(t[i])
|
|
486
|
+
return e}$i(t){const e=t.length
|
|
484
487
|
if(0===e)return[]
|
|
485
488
|
const i=4>e||t[0]!==t[e-2]||t[1]!==t[e-1]?e:e-2
|
|
486
489
|
if(0===i)return[]
|
|
@@ -495,22 +498,22 @@ let o=[]
|
|
|
495
498
|
return n.push(t[0],t[1]),e}),i.Ei(nt.mi.GLU_TESS_ERROR,t=>{a.warn("libtess error: "+t)}),i._i(0,0,1),i.Ai(null)
|
|
496
499
|
for(const e of t){i.Mi()
|
|
497
500
|
for(let t=0;e.length>t;t+=2){const s=n.length/2
|
|
498
|
-
n.push(e[t],e[t+1]),i.Ti([e[t],e[t+1],0],s)}i.Ii()}return i.Fi(),0===n.length?null:"triangles"===e?{vertices:n,indices:s}:{vertices:n
|
|
501
|
+
n.push(e[t],e[t+1]),i.Ti([e[t],e[t+1],0],s)}i.Ii()}return i.Fi(),0===n.length?null:"triangles"===e?{vertices:n,indices:s}:{vertices:n,zi:r}}Ni(t){if(!t.zi)return[]
|
|
499
502
|
const e=[]
|
|
500
|
-
for(const i of t
|
|
503
|
+
for(const i of t.zi){const n=[]
|
|
501
504
|
for(const e of i){const i=2*e
|
|
502
|
-
n.push(t.vertices[i],t.vertices[i+1])}n.length>2&&(n[0]===n[n.length-2]&&n[1]===n[n.length-1]||n.push(n[0],n[1])),e.push(n)}return e}
|
|
505
|
+
n.push(t.vertices[i],t.vertices[i+1])}n.length>2&&(n[0]===n[n.length-2]&&n[1]===n[n.length-1]||n.push(n[0],n[1])),e.push(n)}return e}Wi(t){if(0===t.length)return!1
|
|
503
506
|
if(1===t.length)return!1
|
|
504
507
|
let e=null
|
|
505
|
-
for(const i of t){const t=0>this.
|
|
508
|
+
for(const i of t){const t=0>this.Ri(i)?-1:1
|
|
506
509
|
if(null===e)e=t
|
|
507
|
-
else if(t!==e)return!0}return!1}
|
|
510
|
+
else if(t!==e)return!0}return!1}Ri(t){let e=0
|
|
508
511
|
const i=t.length
|
|
509
512
|
if(6>i)return 0
|
|
510
513
|
for(let n=0;i>n;n+=2)e+=t[n]*t[(n+3)%i]-t[(n+2)%i]*t[n+1]
|
|
511
|
-
return e/2}}class rt{constructor(){}
|
|
514
|
+
return e/2}}class rt{constructor(){}ji(t,e=0,i){const n=t.Li.vertices,s=t.Li.indices,r=t.Gi,o=n.length,h=o/2
|
|
512
515
|
let a=[],l=0,c=!1
|
|
513
|
-
if(0!==e)if(r.length>0){c=!0
|
|
516
|
+
if(0!==e)if(!0===t.Ui&&r.length>0){c=!0
|
|
514
517
|
for(const t of r){const e=t.length>>1
|
|
515
518
|
2>e||(l+=e-1)}}else{const t=new Map,e=s.length
|
|
516
519
|
for(let i=0;e>i;i+=3){const e=s[i],n=s[i+1],r=s[i+2]
|
|
@@ -542,230 +545,230 @@ if(p>1e-10){const t=1/Math.sqrt(p)
|
|
|
542
545
|
g=u*t,v=-c*t}const b=3*m
|
|
543
546
|
f[b]=r,f[b+1]=o,f[b+2]=0,f[b+3]=h,f[b+4]=l,f[b+5]=0,f[b+6]=r,f[b+7]=o,f[b+8]=w,f[b+9]=h,f[b+10]=l,f[b+11]=w,d[b]=g,d[b+1]=v,d[b+2]=0,d[b+3]=g,d[b+4]=v,d[b+5]=0,d[b+6]=g,d[b+7]=v,d[b+8]=0,d[b+9]=g,d[b+10]=v,d[b+11]=0
|
|
544
547
|
const S=m
|
|
545
|
-
y[x]=S,y[x+1]=S+1,y[x+2]=S+2,y[x+3]=S+1,y[x+4]=S+3,y[x+5]=S+2,x+=6,m+=4}return{vertices:f,normals:d,indices:y}}}class ot{constructor(){}
|
|
546
|
-
return 0===i?[]:1===i?[[0]]:this.
|
|
548
|
+
y[x]=S,y[x+1]=S+1,y[x+2]=S+2,y[x+3]=S+1,y[x+4]=S+3,y[x+5]=S+2,x+=6,m+=4}return{vertices:f,normals:d,indices:y}}}class ot{constructor(){}Hi(t,e){const i=t.length
|
|
549
|
+
return 0===i?[]:1===i?[[0]]:this.Vi(t,e)}Vi(t,e){function i(t){return a[t]===t?t:a[t]=i(a[t])}function n(t,e){const n=i(t),s=i(e)
|
|
547
550
|
n!==s&&(l[s]>l[n]?a[n]=s:l[n]>l[s]?a[s]=n:(a[s]=n,l[n]++))}const s=t.length,r=Array(s),o=Array(2*s)
|
|
548
551
|
let h=0
|
|
549
|
-
for(let i=0;s>i;i++)r[i]=this.
|
|
552
|
+
for(let i=0;s>i;i++)r[i]=this.qi(t[i],e[i]),o[h++]=[r[i].Yi,0,i],o[h++]=[r[i].Ji,1,i]
|
|
550
553
|
o.sort((t,e)=>t[0]-e[0]||t[1]-e[1])
|
|
551
554
|
const a=Array.from({length:s},(t,e)=>e),l=Array(s).fill(0),c=new Set
|
|
552
555
|
for(const[,t,e]of o)if(0===t){const t=r[e]
|
|
553
556
|
for(const i of c){const s=r[i]
|
|
554
|
-
s.
|
|
557
|
+
s.Ki+.001>t.Qi&&t.Ki>s.Qi-.001&&n(e,i)}c.add(e)}else c.delete(e)
|
|
555
558
|
const u=new Map
|
|
556
559
|
for(let t=0;s>t;t++){const e=i(t)
|
|
557
560
|
let n=u.get(e)
|
|
558
|
-
n||(n=[],u.set(e,n)),n.push(t)}return Array.from(u.values())}
|
|
559
|
-
if(void 0!==e)return this.
|
|
560
|
-
const i=this.
|
|
561
|
-
this.
|
|
561
|
+
n||(n=[],u.set(e,n)),n.push(t)}return Array.from(u.values())}qi(t,e){return{Yi:t.bounds.min.x+e.x,Qi:t.bounds.min.y+e.y,Ji:t.bounds.max.x+e.x,Ki:t.bounds.max.y+e.y}}}class ht{constructor(t){this.Xi=[],this.Zi=new Map,this.compare=t}F(t){const e=this.Zi.get(t)
|
|
562
|
+
if(void 0!==e)return this.tn(e),void this.en(e)
|
|
563
|
+
const i=this.Xi.length
|
|
564
|
+
this.Xi.push(t),this.Zi.set(t,i),this.tn(i)}nn(){const t=this.Xi.length
|
|
562
565
|
if(!t)return
|
|
563
|
-
if(1===t){const t=this.
|
|
564
|
-
return this.
|
|
565
|
-
return this.
|
|
566
|
-
void 0!==e?(this.
|
|
567
|
-
this.
|
|
568
|
-
for(;t>0;){const i=t-1>>1,n=this.
|
|
566
|
+
if(1===t){const t=this.Xi.pop()
|
|
567
|
+
return this.Zi.clear(),t}const e=this.Xi[0],i=this.Xi.pop()
|
|
568
|
+
return this.Xi[0]=i,this.Zi.delete(e),this.Zi.set(i,0),this.en(0),e}update(t){const e=this.Zi.get(t)
|
|
569
|
+
void 0!==e?(this.tn(e),this.en(e)):this.F(t)}sn(){return!this.Xi.length}rn(t,e){const i=this.Xi[t],n=this.Xi[e]
|
|
570
|
+
this.Xi[t]=n,this.Xi[e]=i,this.Zi.set(i,e),this.Zi.set(n,t)}tn(t){const e=this.Xi[t]
|
|
571
|
+
for(;t>0;){const i=t-1>>1,n=this.Xi[i]
|
|
569
572
|
if(this.compare(e,n)>=0)break
|
|
570
|
-
this.
|
|
573
|
+
this.Xi[t]=n,this.Zi.set(n,t),t=i}this.Xi[t]=e,this.Zi.set(e,t)}en(t){const e=this.Xi[t],i=this.Xi.length,n=i>>1
|
|
571
574
|
for(;n>t;){const n=1+(t<<1),s=n+1
|
|
572
575
|
let r=t,o=e
|
|
573
|
-
const h=this.
|
|
574
|
-
if(0>this.compare(h,o)&&(r=n,o=h),i>s){const t=this.
|
|
576
|
+
const h=this.Xi[n]
|
|
577
|
+
if(0>this.compare(h,o)&&(r=n,o=h),i>s){const t=this.Xi[s]
|
|
575
578
|
0>this.compare(t,o)&&(r=s,o=t)}if(r===t)break
|
|
576
|
-
this.
|
|
577
|
-
class lt{constructor(t){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0},this.config=t}
|
|
579
|
+
this.Xi[t]=o,this.Zi.set(o,t),t=r}this.Xi[t]=e,this.Zi.set(e,t)}}const at={enabled:!0,areaThreshold:1}
|
|
580
|
+
class lt{constructor(t){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0},this.config=t}hn(t){this.config=t}an(t){if(2>=t.points.length)return t
|
|
578
581
|
if(!this.config.enabled)return t
|
|
579
582
|
this.stats.originalPointCount+=t.points.length
|
|
580
583
|
const e=t.points
|
|
581
584
|
if(5>e.length)return t
|
|
582
585
|
let i=e
|
|
583
|
-
return i=this.
|
|
584
|
-
const i=t.length,n=t.map((t,e)=>({index:e,
|
|
585
|
-
for(let t=0;n.length>t;t++)n[t].
|
|
586
|
-
const s=new ht((t,e)=>t.
|
|
586
|
+
return i=this.ln(i,this.config.areaThreshold),3>i.length?t:{...t,points:i}}ln(t,e){if(3>=t.length)return t
|
|
587
|
+
const i=t.length,n=t.map((t,e)=>({index:e,cn:1/0,un:null,next:null}))
|
|
588
|
+
for(let t=0;n.length>t;t++)n[t].un=n[t-1]||null,n[t].next=n[t+1]||null
|
|
589
|
+
const s=new ht((t,e)=>t.cn-e.cn)
|
|
587
590
|
for(let e=1;n.length-1>e;e++){const i=n[e]
|
|
588
|
-
i.
|
|
589
|
-
for(;!s.
|
|
590
|
-
if(!i||i.
|
|
591
|
-
i.
|
|
591
|
+
i.cn=this.fn(t[i.un.index],t[i.index],t[i.next.index]),s.F(i)}let r=i
|
|
592
|
+
for(;!s.sn()&&r>3;){const i=s.nn()
|
|
593
|
+
if(!i||i.cn>e)break
|
|
594
|
+
i.un&&(i.un.next=i.next),i.next&&(i.next.un=i.un),r--,i.un&&i.un.un&&(i.un.cn=this.fn(t[i.un.un.index],t[i.un.index],t[i.next.index]),s.update(i.un)),i.next&&i.next.next&&(i.next.cn=this.fn(t[i.un.index],t[i.next.index],t[i.next.next.index]),s.update(i.next))}const o=[]
|
|
592
595
|
let h=n[0]
|
|
593
596
|
for(;h;)o.push(t[h.index]),h=h.next
|
|
594
|
-
return this.stats.pointsRemovedByVisvalingam+=i-o.length,o}
|
|
595
|
-
class ft{constructor(t){this.curveSteps=null,this.
|
|
597
|
+
return this.stats.pointsRemovedByVisvalingam+=i-o.length,o}fn(t,e,i){return Math.abs((t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y))/2)}getStats(){return{...this.stats}}dn(){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0}}}const ct={distanceTolerance:.5,angleTolerance:.2},ut=1e-6
|
|
598
|
+
class ft{constructor(t){this.curveSteps=null,this.yn={...ct,...t}}pn(t){this.yn={...ct,...t}}wn(t){if(null==t)return void(this.curveSteps=null)
|
|
596
599
|
if(!Number.isFinite(t))return void(this.curveSteps=null)
|
|
597
600
|
const e=Math.round(t)
|
|
598
|
-
this.curveSteps=1>e?null:e}
|
|
601
|
+
this.curveSteps=1>e?null:e}gn(t,e,i){if(null!==this.curveSteps)return this.vn(t,e,i,this.curveSteps)
|
|
599
602
|
const n=[]
|
|
600
|
-
return this.
|
|
603
|
+
return this.mn(t.x,t.y,e.x,e.y,i.x,i.y,n),this.xn(i.x,i.y,n),n}bn(t,e,i,n){if(null!==this.curveSteps)return this.Sn(t,e,i,n,this.curveSteps)
|
|
601
604
|
const s=[]
|
|
602
|
-
return this.
|
|
603
|
-
for(let r=1;n>=r;r++){const o=r/n,h=this.
|
|
604
|
-
this.
|
|
605
|
-
for(let o=1;s>=o;o++){const h=o/s,a=this.
|
|
606
|
-
this.
|
|
607
|
-
const a=(t+i)/2,l=(e+n)/2,c=(i+s)/2,u=(n+r)/2,f=(a+c)/2,d=(l+u)/2,y=s-t,p=r-e,w=Math.abs((i-s)*p-(n-r)*y),g=this.
|
|
608
|
-
if(w>ut){if(v*(y*y+p*p)>=w*w){const h=this.
|
|
609
|
-
if(0>=h)return void this.
|
|
605
|
+
return this._n(t.x,t.y,e.x,e.y,i.x,i.y,n.x,n.y,s),this.xn(n.x,n.y,s),s}En(t,e,i){return t+(e-t)*i}vn(t,e,i,n){const s=[]
|
|
606
|
+
for(let r=1;n>=r;r++){const o=r/n,h=this.En(t.x,e.x,o),a=this.En(t.y,e.y,o),l=this.En(e.x,i.x,o),c=this.En(e.y,i.y,o),u=this.En(h,l,o),f=this.En(a,c,o)
|
|
607
|
+
this.xn(u,f,s)}return s}Sn(t,e,i,n,s){const r=[]
|
|
608
|
+
for(let o=1;s>=o;o++){const h=o/s,a=this.En(t.x,e.x,h),l=this.En(t.y,e.y,h),c=this.En(e.x,i.x,h),u=this.En(e.y,i.y,h),f=this.En(i.x,n.x,h),d=this.En(i.y,n.y,h),y=this.En(a,c,h),p=this.En(l,u,h),w=this.En(c,f,h),g=this.En(u,d,h),v=this.En(y,w,h),m=this.En(p,g,h)
|
|
609
|
+
this.xn(v,m,r)}return r}mn(t,e,i,n,s,r,o,h=0){if(h>16)return
|
|
610
|
+
const a=(t+i)/2,l=(e+n)/2,c=(i+s)/2,u=(n+r)/2,f=(a+c)/2,d=(l+u)/2,y=s-t,p=r-e,w=Math.abs((i-s)*p-(n-r)*y),g=this.yn.distanceTolerance??ct.distanceTolerance,v=g*g
|
|
611
|
+
if(w>ut){if(v*(y*y+p*p)>=w*w){const h=this.yn.angleTolerance??ct.angleTolerance
|
|
612
|
+
if(0>=h)return void this.xn(i,n,o)
|
|
610
613
|
{const a=i-t,l=n-e,c=s-i,u=r-n
|
|
611
|
-
if(h>Math.abs(Math.atan2(a*u-l*c,a*c+l*u)))return void this.
|
|
612
|
-
if(0===s){if(v>=(i-t)*(i-t)+(n-e)*(n-e))return void this.
|
|
613
|
-
if(r>0&&1>r&&v*s>=w*w)return void this.
|
|
614
|
-
const c=(t+i)/2,u=(e+n)/2,f=(i+s)/2,d=(n+r)/2,y=(s+o)/2,p=(r+h)/2,w=(c+f)/2,g=(u+d)/2,v=(f+y)/2,m=(d+p)/2,x=(w+v)/2,b=(g+m)/2,S=o-t,_=h-e,E=Math.abs((i-o)*_-(n-h)*S),T=Math.abs((s-o)*_-(r-h)*S),A=this.
|
|
614
|
+
if(h>Math.abs(Math.atan2(a*u-l*c,a*c+l*u)))return void this.xn(i,n,o)}}}else{const s=y*y+p*p
|
|
615
|
+
if(0===s){if(v>=(i-t)*(i-t)+(n-e)*(n-e))return void this.xn(i,n,o)}else{const r=((i-t)*y+(n-e)*p)/s
|
|
616
|
+
if(r>0&&1>r&&v*s>=w*w)return void this.xn(i,n,o)}}this.mn(t,e,a,l,f,d,o,h+1),this.mn(f,d,c,u,s,r,o,h+1)}_n(t,e,i,n,s,r,o,h,a,l=0){if(l>16)return
|
|
617
|
+
const c=(t+i)/2,u=(e+n)/2,f=(i+s)/2,d=(n+r)/2,y=(s+o)/2,p=(r+h)/2,w=(c+f)/2,g=(u+d)/2,v=(f+y)/2,m=(d+p)/2,x=(w+v)/2,b=(g+m)/2,S=o-t,_=h-e,E=Math.abs((i-o)*_-(n-h)*S),T=Math.abs((s-o)*_-(r-h)*S),A=this.yn.distanceTolerance??ct.distanceTolerance,M=A*A
|
|
615
618
|
let I=0
|
|
616
619
|
switch(E>ut&&(I|=1),T>ut&&(I|=2),I){case 0:const l=S*S+_*_
|
|
617
|
-
if(0===l){if(M>=(i-t)*(i-t)+(n-e)*(n-e)&&M>=(s-t)*(s-t)+(r-e)*(r-e))return this.
|
|
618
|
-
if(o>0&&1>o&&h>0&&1>h&&M*l>=(E+T)*(E+T))return this.
|
|
619
|
-
case 1:if(M*(S*S+_*_)>=T*T){const t=this.
|
|
620
|
-
if(0>=t)return this.
|
|
620
|
+
if(0===l){if(M>=(i-t)*(i-t)+(n-e)*(n-e)&&M>=(s-t)*(s-t)+(r-e)*(r-e))return this.xn(i,n,a),void this.xn(s,r,a)}else{const o=((i-t)*S+(n-e)*_)/l,h=((s-t)*S+(r-e)*_)/l
|
|
621
|
+
if(o>0&&1>o&&h>0&&1>h&&M*l>=(E+T)*(E+T))return this.xn(i,n,a),void this.xn(s,r,a)}break
|
|
622
|
+
case 1:if(M*(S*S+_*_)>=T*T){const t=this.yn.angleTolerance??ct.angleTolerance
|
|
623
|
+
if(0>=t)return this.xn(i,n,a),void this.xn(s,r,a)
|
|
621
624
|
{const e=s-i,l=r-n,c=o-s,u=h-r
|
|
622
|
-
if(t>Math.abs(Math.atan2(e*u-l*c,e*c+l*u)))return this.
|
|
623
|
-
case 2:if(M*(S*S+_*_)>=E*E){const o=this.
|
|
624
|
-
if(0>=o)return this.
|
|
625
|
+
if(t>Math.abs(Math.atan2(e*u-l*c,e*c+l*u)))return this.xn(i,n,a),void this.xn(s,r,a)}}break
|
|
626
|
+
case 2:if(M*(S*S+_*_)>=E*E){const o=this.yn.angleTolerance??ct.angleTolerance
|
|
627
|
+
if(0>=o)return this.xn(i,n,a),void this.xn(s,r,a)
|
|
625
628
|
{const h=i-t,l=n-e,c=s-i,u=r-n
|
|
626
|
-
if(o>Math.abs(Math.atan2(h*u-l*c,h*c+l*u)))return this.
|
|
627
|
-
case 3:if(M*(S*S+_*_)>=(E+T)*(E+T)){const l=this.
|
|
628
|
-
if(0>=l)return this.
|
|
629
|
+
if(o>Math.abs(Math.atan2(h*u-l*c,h*c+l*u)))return this.xn(i,n,a),void this.xn(s,r,a)}}break
|
|
630
|
+
case 3:if(M*(S*S+_*_)>=(E+T)*(E+T)){const l=this.yn.angleTolerance??ct.angleTolerance
|
|
631
|
+
if(0>=l)return this.xn(i,n,a),void this.xn(s,r,a)
|
|
629
632
|
{const c=i-t,u=n-e,f=s-i,d=r-n,y=o-s,p=h-r
|
|
630
|
-
if(l>Math.abs(Math.atan2(c*d-u*f,c*f+u*d))+Math.abs(Math.atan2(f*p-d*y,f*y+d*p)))return this.
|
|
633
|
+
if(l>Math.abs(Math.atan2(c*d-u*f,c*f+u*d))+Math.abs(Math.atan2(f*p-d*y,f*y+d*p)))return this.xn(i,n,a),void this.xn(s,r,a)}}}this._n(t,e,c,u,w,g,x,b,a,l+1),this._n(x,b,v,m,y,p,o,h,a,l+1)}xn(t,e,i){const n=new Y(t,e)
|
|
631
634
|
if(0===i.length)return void i.push(n)
|
|
632
635
|
const s=i[i.length-1],r=n.x-s.x,o=n.y-s.y
|
|
633
|
-
r*r+o*o>1e-12&&i.push(n)}}class dt{constructor(t,e){this.
|
|
636
|
+
r*r+o*o>1e-12&&i.push(n)}}class dt{constructor(t,e){this.Tn=0,this.An=0,this.Mn=[],this.In=null,this.Fn=null,this.Ln={min:new Y(1/0,1/0),max:new Y(-1/0,-1/0)},this.Gn=[],this.On=[],this.Cn=[],this.kn=new Y(0,0),this.Dn=new ft(t),this.Bn=new lt({...at,...e})}setPosition(t,e){this.kn.set(t,e)}Nn(t,e){this.kn.x+=t,this.kn.y+=e}Un(t,e){this.Mn.length>0&&this.Pn(),this.Tn=t,this.An=e,this.Mn=[],this.Ln.min.set(1/0,1/0),this.Ln.max.set(-1/0,-1/0),this.On.push(this.kn.clone())}Pn(){this.In&&this.$n(),this.Mn.length>0&&(this.Gn.push({zn:this.Tn,Wn:this.Mn,bounds:{min:{x:this.Ln.min.x,y:this.Ln.min.y},max:{x:this.Ln.max.x,y:this.Ln.max.y}}}),this.Cn.push(this.An)),this.Mn=[]}Rn(t,e){this.In&&this.$n(),this.Fn=new Y(t,e),this.jn(this.Fn),this.In={points:[this.Fn],glyphIndex:this.Tn}}Hn(t,e){if(!this.In||!this.Fn)return
|
|
634
637
|
const i=new Y(t,e)
|
|
635
|
-
this.
|
|
636
|
-
const s=this.
|
|
637
|
-
if(ut>Math.abs((r.x-o.x)*(o.y-s.y)-(r.y-o.y)*(o.x-s.x)))return void this.
|
|
638
|
-
const h=this.
|
|
638
|
+
this.jn(i),this.In.points.push(i),this.Fn=i}Vn(t,e,i,n){if(!this.In||!this.Fn)return
|
|
639
|
+
const s=this.Fn,r=new Y(t,e),o=new Y(i,n)
|
|
640
|
+
if(ut>Math.abs((r.x-o.x)*(o.y-s.y)-(r.y-o.y)*(o.x-s.x)))return void this.Hn(i,n)
|
|
641
|
+
const h=this.Dn.gn(s,r,o)
|
|
639
642
|
for(let t=0;h.length>t;t++){const e=h[t]
|
|
640
|
-
this.
|
|
641
|
-
const o=this.
|
|
642
|
-
if(ut>Math.abs((h.x-l.x)*u-(h.y-l.y)*c)&&ut>Math.abs((a.x-l.x)*u-(a.y-l.y)*c))return void this.
|
|
643
|
-
const f=this.
|
|
643
|
+
this.jn(e),this.In.points.push(e)}this.Fn=o}qn(t,e,i,n,s,r){if(!this.In||!this.Fn)return
|
|
644
|
+
const o=this.Fn,h=new Y(t,e),a=new Y(i,n),l=new Y(s,r),c=l.x-o.x,u=l.y-o.y
|
|
645
|
+
if(ut>Math.abs((h.x-l.x)*u-(h.y-l.y)*c)&&ut>Math.abs((a.x-l.x)*u-(a.y-l.y)*c))return void this.Hn(s,r)
|
|
646
|
+
const f=this.Dn.bn(o,h,a,l)
|
|
644
647
|
for(let t=0;f.length>t;t++){const e=f[t]
|
|
645
|
-
this.
|
|
646
|
-
const t=this.
|
|
647
|
-
this.
|
|
648
|
-
this.
|
|
649
|
-
if(this.
|
|
648
|
+
this.jn(e),this.In.points.push(e)}this.Fn=l}Yn(){if(!this.In||!this.Fn)return
|
|
649
|
+
const t=this.In.points[0]
|
|
650
|
+
this.Fn.equals(t)||this.In.points.push(t),this.$n()}$n(){if(this.In){const t=this.Bn.an(this.In)
|
|
651
|
+
this.Mn.push(t),this.In=null,this.Fn=null}}jn(t){this.Ln.min.x=Math.min(this.Ln.min.x,t.x),this.Ln.min.y=Math.min(this.Ln.min.y,t.y),this.Ln.max.x=Math.max(this.Ln.max.x,t.x),this.Ln.max.y=Math.max(this.Ln.max.y,t.y)}Jn(){return this.Mn.length>0&&this.Pn(),this.Gn}Kn(){return this.On}Qn(){return this.Cn}reset(){this.Gn=[],this.On=[],this.Cn=[],this.Mn=[],this.In=null,this.Fn=null,this.Tn=0,this.An=0,this.kn.set(0,0),this.Ln={min:new Y(1/0,1/0),max:new Y(-1/0,-1/0)}}pn(t){this.Dn.pn(t)}wn(t){this.Dn.wn(t)}Xn(t){this.Bn.hn({...at,...t})}Zn(){return this.Bn.getStats()}}class yt{constructor(){this.ts=null,this.es=null,this.ns=null,this.ss=null,this.rs=null,this.hs=0,this.position={x:0,y:0}}setPosition(t,e){this.position.x=t,this.position.y=e,this.ls&&this.ls.setPosition(t,e)}Nn(t,e){this.position.x+=t,this.position.y+=e,this.ls&&this.ls.Nn(t,e)}cs(t){this.ls=t}us(t,e){if(!t||!t.module||!t.hb)throw Error("Invalid font object")
|
|
652
|
+
if(this.ls=e,this.hs)return
|
|
650
653
|
const i=t.module
|
|
651
|
-
this.
|
|
652
|
-
return this.
|
|
654
|
+
this.ts=i.fs((t,e,i,n,s)=>{this.ls?.Rn(n,s)},"viiiffi"),this.es=i.fs((t,e,i,n,s)=>{this.ls?.Hn(n,s)},"viiiffi"),this.ns=i.fs((t,e,i,n,s,r,o)=>{this.ls?.Vn(n,s,r,o)},"viiiffffi"),this.ss=i.fs((t,e,i,n,s,r,o,h,a)=>{this.ls?.qn(n,s,r,o,h,a)},"viiiffffffi"),this.rs=i.fs(()=>{this.ls?.Yn()},"viiii"),this.hs=i.exports.ds(),i.exports.ys(this.hs,this.ts,0,0),i.exports.ps(this.hs,this.es,0,0),i.exports.ws(this.hs,this.ns,0,0),i.exports.gs(this.hs,this.ss,0,0),i.exports.vs(this.hs,this.rs,0,0)}xs(){if(!this.hs)throw Error("Draw functions not initialized")
|
|
655
|
+
return this.hs}destroy(t){if(!t||!t.module||!t.hb)return
|
|
653
656
|
const e=t.module
|
|
654
|
-
try{this.
|
|
655
|
-
class wt{constructor(t,e){this.
|
|
657
|
+
try{this.hs&&(e.exports.bs(this.hs),this.hs=0),null!==this.ts&&(e.Ss(this.ts),this.ts=null),null!==this.es&&(e.Ss(this.es),this.es=null),null!==this.ns&&(e.Ss(this.ns),this.ns=null),null!==this.ss&&(e.Ss(this.ss),this.ss=null),null!==this.rs&&(e.Ss(this.rs),this.rs=null)}catch(t){a.warn("Error destroying draw callbacks:",t)}this.ls=void 0}}const pt=new WeakMap
|
|
658
|
+
class wt{constructor(t,e){this._s="default",this.Es="default",this.Ts=new Set,this.As=[],this.Ms=[],this.Is=[],this.cache=t,this.Kt=e,this.tessellator=new st,this.Fs=new rt,this.Ls=new ot,this.ls=new dt,this.Gs=(()=>{const t=this.Kt.module,e=pt.get(t)
|
|
656
659
|
if(e)return e
|
|
657
660
|
const i=new yt
|
|
658
|
-
return pt.set(t,i),i})(),this.
|
|
661
|
+
return pt.set(t,i),i})(),this.Gs.us(this.Kt,this.ls),this.Os=X,this.Cs=Z,this.ks=tt}Zn(){return this.ls.Zn()}pn(t){this.yn=t,this.ls.pn(t),this.Ds()}wn(t){if(null==t)this.curveSteps=void 0
|
|
659
662
|
else if(Number.isFinite(t)){const e=Math.round(t)
|
|
660
663
|
this.curveSteps=1>e?void 0:e}else this.curveSteps=void 0
|
|
661
|
-
this.
|
|
662
|
-
const t=this.
|
|
663
|
-
return`cf:${t.toFixed(4)},${e.toFixed(4)}`})(),`opt:${this.
|
|
664
|
-
for(let i=0;t.length>i;i++)e+=t[i].length}const l=this.
|
|
664
|
+
this.ls.wn(this.curveSteps),this.Ds()}Xn(t){this.Bs=t,this.ls.Xn(t),this.Ds()}Ns(t){this._s=t,this.Ds()}Ds(){this.Es=`${this._s}__${this.Us()}`}Us(){return[(()=>{if(void 0!==this.curveSteps)return"cf:steps:"+this.curveSteps
|
|
665
|
+
const t=this.yn?.distanceTolerance??ct.distanceTolerance,e=this.yn?.angleTolerance??ct.angleTolerance
|
|
666
|
+
return`cf:${t.toFixed(4)},${e.toFixed(4)}`})(),`opt:${this.Bs?.enabled??1?1:0},${(this.Bs?.areaThreshold??1).toFixed(4)}`].join("|")}Ps(t,e,i,n,r,o=!1,a){if(h){let e=0
|
|
667
|
+
for(let i=0;t.length>i;i++)e+=t[i].length}const l=this.Is
|
|
665
668
|
l.length=0
|
|
666
669
|
let c=0,u=0,f=0,d=0,y=0
|
|
667
670
|
const p=(t,e,i,n)=>{const s=y
|
|
668
671
|
let r=l[c]
|
|
669
|
-
return r?(r.data=t,r.px=e,r
|
|
672
|
+
return r?(r.data=t,r.px=e,r.$s=i,r.zs=n,r.Ws=s):(r={data:t,px:e,$s:i,zs:n,Ws:s},l[c]=r),c++,u+=t.vertices.length,f+=t.normals.length,d+=t.indices.length,y+=t.vertices.length/3,s},w=[],g={min:{x:1/0,y:1/0,z:0},max:{x:-1/0,y:-1/0,z:e}}
|
|
670
673
|
for(let r=0;t.length>r;r++){const h=t[r]
|
|
671
674
|
for(const t of h){const r=t.position.x,h=t.position.y,l=t.position.z,c=[]
|
|
672
|
-
for(const e of t.glyphs)c.push(this.
|
|
675
|
+
for(const e of t.glyphs)c.push(this.Rs(e.g))
|
|
673
676
|
let u
|
|
674
|
-
if(t.glyphs.length>1){const e=`${this.
|
|
677
|
+
if(t.glyphs.length>1){const e=`${this.Es}_${t.text}`,i=this.ks.get(e)
|
|
675
678
|
let n=!1
|
|
676
|
-
if(i&&i.
|
|
677
|
-
for(let e=0;t.glyphs.length>e;e++){const s=t.glyphs[e],r=i.
|
|
678
|
-
if(i.
|
|
679
|
+
if(i&&i.js.length===t.glyphs.length){n=!0
|
|
680
|
+
for(let e=0;t.glyphs.length>e;e++){const s=t.glyphs[e],r=i.Hs[e]
|
|
681
|
+
if(i.js[e]!==s.g||r.x!==(s.x??0)||r.y!==(s.y??0)){n=!1
|
|
679
682
|
break}}}if(n&&i)u=i.groups
|
|
680
683
|
else{const i=t.glyphs.length
|
|
681
|
-
if(i>this.
|
|
682
|
-
this.
|
|
683
|
-
for(let e=0;i>e;e++){const i=t.glyphs[e],n=this.
|
|
684
|
-
n.x=i.x??0,n.y=i.y??0,n.z=0}u=this.
|
|
684
|
+
if(i>this.As.length)for(let t=this.As.length;i>t;t++)this.As.push(new J(0,0,0))
|
|
685
|
+
this.As.length=i
|
|
686
|
+
for(let e=0;i>e;e++){const i=t.glyphs[e],n=this.As[e]
|
|
687
|
+
n.x=i.x??0,n.y=i.y??0,n.z=0}u=this.Ls.Hi(c,this.As),this.ks.set(e,{js:t.glyphs.map(t=>t.g),Hs:t.glyphs.map(t=>({x:t.x??0,y:t.y??0})),groups:u})}}else u=[[0]]
|
|
685
688
|
const f=o
|
|
686
689
|
let d=u
|
|
687
690
|
if(a&&a.size>0){d=[]
|
|
688
691
|
for(const e of u)if(e.length>1){const i=[],n=[]
|
|
689
|
-
for(const s of e)a.has(t.glyphs[s].
|
|
690
|
-
i.length>0&&d.push(i),n.length>0&&d.push(n)}else d.push(e)}for(const o of d)if(o.length>1&&!f){const s=o.map(e=>t.glyphs[e]),a=this.
|
|
691
|
-
let u=this.
|
|
692
|
-
if(!u){const i=this.
|
|
692
|
+
for(const s of e)a.has(t.glyphs[s].Vs)?i.push(s):n.push(s)
|
|
693
|
+
i.length>0&&d.push(i),n.length>0&&d.push(n)}else d.push(e)}for(const o of d)if(o.length>1&&!f){const s=o.map(e=>t.glyphs[e]),a=this.qs(s,e,i)
|
|
694
|
+
let u=this.Cs.get(a)
|
|
695
|
+
if(!u){const i=this.Ms
|
|
693
696
|
let r=0
|
|
694
697
|
const h=s[0].x??0,l=s[0].y??0
|
|
695
698
|
for(let e=0;o.length>e;e++){const n=o[e],s=c[n],a=t.glyphs[n],u=(a.x??0)-h,f=(a.y??0)-l
|
|
696
|
-
for(const t of s.
|
|
699
|
+
for(const t of s.Wn){const e=t.points,n=e.length
|
|
697
700
|
if(3>n)continue
|
|
698
701
|
const s=n>1&&e[0].x===e[n-1].x&&e[0].y===e[n-1].y?n-1:n,o=2*(s+1)
|
|
699
702
|
let h=i[r]
|
|
700
703
|
!h||o>h.length?(h=Array(o),i[r]=h):h.length=o
|
|
701
704
|
let a=0
|
|
702
705
|
for(let t=0;s>t;t++){const i=e[t]
|
|
703
|
-
h[a++]=i.x+u,h[a++]=i.y+f}2>a||(h[a++]=h[0],h[a++]=h[1]),r++}}i.length=r,u=this.
|
|
704
|
-
for(let i=0;o.length>i;i++){const n=o[i],s=t.glyphs[n],a=this.
|
|
705
|
-
w.push(a),this.
|
|
706
|
-
if(0===u.
|
|
706
|
+
h[a++]=i.x+u,h[a++]=i.y+f}2>a||(h[a++]=h[0],h[a++]=h[1]),r++}}i.length=r,u=this.Ys(i,e,n),this.Cs.set(a,u)}const f=s[0],d=p(u,r+(f.x??0),h+(f.y??0),l),y=u.vertices.length/3
|
|
707
|
+
for(let i=0;o.length>i;i++){const n=o[i],s=t.glyphs[n],a=this.Js(s,d,y,r+(s.x??0),h+(s.y??0),l,c[n],e)
|
|
708
|
+
w.push(a),this.Ks(a.bounds,g)}}else for(const a of o){const o=t.glyphs[a],u=c[a],f=r+(o.x??0),d=h+(o.y??0),y=l
|
|
709
|
+
if(0===u.Wn.length){const t=this.Js(o,0,0,f,d,y,u,e)
|
|
707
710
|
w.push(t)
|
|
708
|
-
continue}const v=s(this.
|
|
711
|
+
continue}const v=s(this.Es,o.g,e,i)
|
|
709
712
|
let m=this.cache.get(v)
|
|
710
|
-
m?m.
|
|
711
|
-
const x=p(m,f,d,y),b=this.
|
|
712
|
-
w.push(b),this.
|
|
713
|
+
m?m.Qs++:(m=this.Xs(u,e,i,n),this.cache.set(v,m))
|
|
714
|
+
const x=p(m,f,d,y),b=this.Js(o,x,m.vertices.length/3,f,d,y,u,e)
|
|
715
|
+
w.push(b),this.Ks(b.bounds,g)}}}l.length=c
|
|
713
716
|
const v=new Float32Array(u),m=new Float32Array(f),x=new Uint32Array(d)
|
|
714
717
|
let b=0,S=0,_=0
|
|
715
|
-
for(let t=0;l.length>t;t++){const e=l[t],i=e.data.vertices,n=e.data.normals,s=e.data.indices,o=e.px*r,h=e
|
|
718
|
+
for(let t=0;l.length>t;t++){const e=l[t],i=e.data.vertices,n=e.data.normals,s=e.data.indices,o=e.px*r,h=e.$s*r,a=e.zs*r,c=i.length
|
|
716
719
|
let u=b
|
|
717
720
|
for(let t=0;c>t;t+=3)v[u]=i[t]*r+o,v[u+1]=i[t+1]*r+h,v[u+2]=i[t+2]*r+a,u+=3
|
|
718
721
|
b=u,m.set(n,S),S+=n.length
|
|
719
|
-
const f=e.
|
|
722
|
+
const f=e.Ws,d=s.length
|
|
720
723
|
let y=_
|
|
721
724
|
for(let t=0;d>t;t++)x[y++]=s[t]+f
|
|
722
725
|
_=y}g.min.x*=r,g.min.y*=r,g.min.z*=r,g.max.x*=r,g.max.y*=r,g.max.z*=r
|
|
723
726
|
for(let t=0;w.length>t;t++)w[t].bounds.min.x*=r,w[t].bounds.min.y*=r,w[t].bounds.min.z*=r,w[t].bounds.max.x*=r,w[t].bounds.max.y*=r,w[t].bounds.max.z*=r
|
|
724
|
-
return{vertices:v,normals:m,indices:x,
|
|
727
|
+
return{vertices:v,normals:m,indices:x,Zs:w,planeBounds:g}}qs(t,e,i){if(0===t.length)return""
|
|
725
728
|
const n=t[0].x??0,s=t[0].y??0,r=t.map(t=>`${t.g}:${(t.x??0)-n},${(t.y??0)-s}`).join("|")
|
|
726
|
-
return`${this.
|
|
727
|
-
const e=`${this.
|
|
729
|
+
return`${this.Es}_${r}_${Math.round(1e3*e)/1e3}_${i}`}Js(t,e,i,n,s,r,o,h){return{tr:t.Vs,er:t.er,Ws:e,ir:i,bounds:{min:{x:o.bounds.min.x+n,y:o.bounds.min.y+s,z:r},max:{x:o.bounds.max.x+n,y:o.bounds.max.y+s,z:r+h}}}}Rs(t){if(this.Ts.has(t))return{zn:t,Wn:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
|
|
730
|
+
const e=`${this.Es}_${t}`,i=this.Os.get(e)
|
|
728
731
|
if(i)return i
|
|
729
|
-
this.
|
|
730
|
-
const n=this.
|
|
731
|
-
return 0===n.
|
|
732
|
-
return this.
|
|
732
|
+
this.Gs.cs(this.ls),this.ls.reset(),this.ls.Un(t,0),this.Kt.module.exports.nr(this.Kt.font.sr,t,this.Gs.xs(),0),this.ls.Pn()
|
|
733
|
+
const n=this.ls.Jn()[0]||{zn:t,Wn:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
|
|
734
|
+
return 0===n.Wn.length&&this.Ts.add(t),this.Os.set(e,n),n}Ys(t,e,i){const n=this.tessellator.Ci(t,!0,i,0!==e)
|
|
735
|
+
return this.rr(n,e)}rr(t,e){const i=this.Fs.ji(t,e,this.Kt.upem),n=i.vertices
|
|
733
736
|
let s=1/0,r=1/0,o=1/0,h=-1/0,a=-1/0,l=-1/0
|
|
734
737
|
for(let t=0;n.length>t;t+=3){const e=n[t],i=n[t+1],c=n[t+2]
|
|
735
738
|
s>e&&(s=e),e>h&&(h=e),r>i&&(r=i),i>a&&(a=i),o>c&&(o=c),c>l&&(l=c)}const c=new J(s,r,o),u=new J(h,a,l)
|
|
736
|
-
return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:c,max:u},
|
|
737
|
-
return this.
|
|
738
|
-
i.x>s.x&&(i.x=s.x),i.y>s.y&&(i.y=s.y),i.z>s.z&&(i.z=s.z),r.x>n.x&&(n.x=r.x),r.y>n.y&&(n.y=r.y),r.z>n.z&&(n.z=r.z)}
|
|
739
|
-
return t.forEach((t,o)=>{const h=this.
|
|
740
|
-
r.push(h)}),r}finally{}}
|
|
741
|
-
"rtl"===o&&h.
|
|
739
|
+
return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:c,max:u},Qs:1}}Xs(t,e,i,n){const s=this.tessellator.process(t.Wn,i,n,0!==e)
|
|
740
|
+
return this.rr(s,e)}Ks(t,e){const i=e.min,n=e.max,s=t.min,r=t.max
|
|
741
|
+
i.x>s.x&&(i.x=s.x),i.y>s.y&&(i.y=s.y),i.z>s.z&&(i.z=s.z),r.x>n.x&&(n.x=r.x),r.y>n.y&&(n.y=r.y),r.z>n.z&&(n.z=r.z)}hr(){return this.cache.getStats()}clearCache(){this.cache.clear(),this.Cs.clear(),this.ks.clear(),this.Os.clear()}}class gt{constructor(t,e){this.ar=new Map,this.Kt=t,this.lr=e}cr(t,e,i,n,s,r,o){try{const r=[]
|
|
742
|
+
return t.forEach((t,o)=>{const h=this.ur(t,o,e,i,n,s)
|
|
743
|
+
r.push(h)}),r}finally{}}ur(t,i,n,s,r,o){const h=this.Kt.hb.createBuffer()
|
|
744
|
+
"rtl"===o&&h.dr("rtl"),h.Vt(t.text),h.qt()
|
|
742
745
|
const a=e(this.Kt.Yt)
|
|
743
746
|
this.Kt.hb.shape(this.Kt.font,h,a)
|
|
744
747
|
const l=h.json(this.Kt.font)
|
|
745
748
|
h.destroy()
|
|
746
749
|
const c=[]
|
|
747
750
|
let u=[],f=[],d=0,y=0,p=t.Ut,w=-i*n
|
|
748
|
-
const g=s*this.Kt.upem,v=this.
|
|
751
|
+
const g=s*this.Kt.upem,v=this.yr(t,r,s),m=this.pr(t,r),x=t.text,b=x.length,S=l.length
|
|
749
752
|
let _
|
|
750
753
|
for(let e=0;S>e;e++){const n=l[e],s=n.Jt,r=x[s],o=r.charCodeAt(0),h=32===o||9===o||10===o||13===o
|
|
751
|
-
n.
|
|
754
|
+
n.Vs=t.$t&&s===b-1&&"-"===r?t.Nt:t.Bt+s,n.er=i,h&&u.length>0&&(c.push({text:f.join(""),glyphs:u,position:new J(d,y,0)}),u=[],f=[])
|
|
752
755
|
const a=p+n.dx,E=w+n.dy
|
|
753
756
|
if(h||(0===u.length&&(d=a,y=E),n.x=a-d,n.y=E-y,u.push(n),f.push(r)),p+=n.ax,w+=n.ay,0!==g&&S-1>e&&(p+=g),h&&(p+=v),0!==m&&S-1>e&&!h){const t=x[l[e+1].Jt],i=void 0!==_?_:T.Z(r)
|
|
754
757
|
if(_=!!t&&T.Z(t),i&&_){let e=!0
|
|
755
|
-
T.tt(t)&&(e=!1),T.et(r)&&(e=!1),T.it(r)&&T.it(t)&&(e=!1),e&&(p+=m)}}else _=void 0}return u.length>0&&c.push({text:f.join(""),glyphs:u,position:new J(d,y,0)}),c}
|
|
756
|
-
if(void 0!==t.Ht&&"justify"===e&&!t.Pt){let e=this.
|
|
757
|
-
void 0===e&&(e=M.measureTextWidth(this.Kt," ",i),this.
|
|
758
|
-
return t.Ht>0||0>t.Ht?.04*t.Ht*this.Kt.upem:0}clearCache(){this.
|
|
759
|
-
if("function"==typeof e)return e("fs").
|
|
758
|
+
T.tt(t)&&(e=!1),T.et(r)&&(e=!1),T.it(r)&&T.it(t)&&(e=!1),e&&(p+=m)}}else _=void 0}return u.length>0&&c.push({text:f.join(""),glyphs:u,position:new J(d,y,0)}),c}yr(t,e,i){let n=0
|
|
759
|
+
if(void 0!==t.Ht&&"justify"===e&&!t.Pt){let e=this.ar.get(i)
|
|
760
|
+
void 0===e&&(e=M.measureTextWidth(this.Kt," ",i),this.ar.set(i,e)),t.Ht>0?n=t.Ht*e*.5:0>t.Ht&&(n=t.Ht*e*f)}return n}pr(t,e){if(void 0===t.Ht||"justify"!==e||t.Pt)return 0
|
|
761
|
+
return t.Ht>0||0>t.Ht?.04*t.Ht*this.Kt.upem:0}clearCache(){this.lr.clearCache()}hr(){return this.lr.hr()}}var vt={exports:{}},mt=o({__proto__:null,default:{},wr(...t){const e="undefined"!=typeof globalThis?globalThis.require:void 0
|
|
762
|
+
if("function"==typeof e)return e("fs").wr(...t)
|
|
760
763
|
throw Error("fs not available in this environment")}})
|
|
761
764
|
!(function(t){var e,i=(e="undefined"!=typeof document?document.currentScript?.src:void 0,async function(t={}){function i(){var t=g.buffer
|
|
762
|
-
s.HEAP8=new Int8Array(t),s.HEAPU8=v=new Uint8Array(t),s.HEAP32=new Int32Array(t),s.HEAPU32=new Uint32Array(t),s.HEAPF32=new Float32Array(t),new BigInt64Array(t),new BigUint64Array(t)}function n(t){s.
|
|
765
|
+
s.HEAP8=new Int8Array(t),s.HEAPU8=v=new Uint8Array(t),s.HEAP32=new Int32Array(t),s.HEAPU32=new Uint32Array(t),s.HEAPF32=new Float32Array(t),new BigInt64Array(t),new BigUint64Array(t)}function n(t){s.gr?.(t),x(t="Aborted("+t+")"),b=!0,t+=". Build with -sASSERTIONS for more info."
|
|
763
766
|
var e=new WebAssembly.RuntimeError(t)
|
|
764
767
|
throw w?.(e),e}var s=t,r="object"==typeof window,o="undefined"!=typeof WorkerGlobalScope,h="object"==typeof process&&process.versions?.node&&"renderer"!=process.type,a=(t,e)=>{throw e}
|
|
765
768
|
"undefined"!=typeof __filename?e=__filename:o&&(e=self.location.href)
|
|
766
769
|
var l,c,u=""
|
|
767
770
|
if(h){var f=mt
|
|
768
|
-
u="undefined"!=typeof __dirname?__dirname+"/":"",c=t=>(t=S(t)?new URL(t):t,f.
|
|
771
|
+
u="undefined"!=typeof __dirname?__dirname+"/":"",c=t=>(t=S(t)?new URL(t):t,f.wr(t)),l=async(t,e=!0)=>(t=S(t)?new URL(t):t,f.wr(t,e?void 0:"utf8")),process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),a=(t,e)=>{throw process.exitCode=t,e}}else if(r||o){try{u=new URL(".",e).href}catch{}o&&(c=t=>{var e=new XMLHttpRequest
|
|
769
772
|
return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),l=async t=>{if(S(t))return new Promise((e,i)=>{var n=new XMLHttpRequest
|
|
770
773
|
n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):i(n.status)},n.onerror=i,n.send(null)})
|
|
771
774
|
var e=await fetch(t,{credentials:"same-origin"})
|
|
@@ -774,197 +777,197 @@ throw Error(e.status+" : "+e.url)}}console.log.bind(console)
|
|
|
774
777
|
var d,y,p,w,g,v,m,x=console.error.bind(console),b=!1,S=t=>t.startsWith("file://"),_=!1,E=0,T=null
|
|
775
778
|
class A{name="ExitStatus"
|
|
776
779
|
constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var M,I,F,L=t=>{for(;t.length>0;)t.shift()(s)},G=[],O=t=>G.push(t),C=[],k=t=>C.push(t),D=!0,B=0,N={},U=t=>{if(t instanceof A||"unwind"==t)return y
|
|
777
|
-
a(1,t)},P=()=>D||B>0,$=t=>{y=t,P()||(s.
|
|
780
|
+
a(1,t)},P=()=>D||B>0,$=t=>{y=t,P()||(s.vr?.(t),b=!0),a(t,new A(t))},z=(t,e)=>Math.ceil(t/e)*e,W=t=>{var e=(t-g.buffer.byteLength+65535)/65536|0
|
|
778
781
|
try{return g.grow(e),i(),1}catch(t){}},R=t=>{const e=t.length
|
|
779
782
|
return[e%128|128,e>>7,...t]},j={si:127,oi:127,ai:126,f:125,d:124,e:111},H=t=>R(Array.from(t,t=>j[t])),V=t=>M.get(t),q=[],Y=(t,e)=>M.set(t,e)
|
|
780
|
-
s.
|
|
783
|
+
s.mr&&(D=s.mr),s.br&&(x=s.br),s.Sr&&(d=s.Sr),s._r=g,s.Er=K,s.fs=(t,e)=>{var i=(t=>(I||(I=new WeakMap,((t,e)=>{if(I)for(var i=0;0+e>i;i++){var n=V(i)
|
|
781
784
|
n&&I.set(n,i)}})(0,M.length)),I.get(t)||0))(t)
|
|
782
785
|
if(i)return i
|
|
783
786
|
var n=q.length?q.pop():M.grow(1)
|
|
784
787
|
try{Y(n,t)}catch(i){if(!(i instanceof TypeError))throw i
|
|
785
788
|
var s=((t,e)=>{var i=Uint8Array.of(0,97,115,109,1,0,0,0,1,...R([1,96,...H(e.slice(1)),...H("v"===e[0]?"":e[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),n=new WebAssembly.Module(i)
|
|
786
789
|
return new WebAssembly.Instance(n,{e:{f:t}}).exports.f})(t,e)
|
|
787
|
-
Y(n,s)}return I.set(t,n),n},s.
|
|
788
|
-
var J={
|
|
790
|
+
Y(n,s)}return I.set(t,n),n},s.Ss=t=>{I.delete(V(t)),Y(t,null),q.push(t)}
|
|
791
|
+
var J={Tr:()=>n(""),Ar(){D=!1,B=0},Mr(t,e){if(N[t]&&(clearTimeout(N[t].id),delete N[t]),!e)return 0
|
|
789
792
|
var i=setTimeout(()=>{delete N[t],(t=>{if(!b)try{t(),(()=>{if(!P())try{y=t=y,$(t)}catch(t){U(t)}var t})()}catch(t){U(t)}})(()=>F(t,performance.now()))},e)
|
|
790
|
-
return N[t]={id:i,
|
|
793
|
+
return N[t]={id:i,Ir:e},0},Fr(t){var e=v.length,i=2147483648
|
|
791
794
|
if((t>>>=0)>i)return!1
|
|
792
795
|
for(var n=1;4>=n;n*=2){var s=e*(1+.2/n),r=Math.min(i,z(Math.max(t,s=Math.min(s,t+100663296)),65536))
|
|
793
|
-
if(W(r))return!0}return!1},
|
|
794
|
-
T=null,t()}})(),K}E++,s.
|
|
795
|
-
var e,r={o:J,
|
|
796
|
-
return s.
|
|
796
|
+
if(W(r))return!0}return!1},Lr:$},K=await(async()=>{function t(t){return s.Er=K=t.exports,s._r=g=K.memory,i(),M=K.Gr,(t=>{s.Or=t.Cr,s.kr=t.Dr,s.Br=t.Nr,s.Ur=t.Pr,s.$r=t.zr,s.Wr=t.Rr,s.jr=t.Hr,s.Vr=t.qr,s.Yr=t.Jr,s.Kr=t.Qr,s.Xr=t.Zr,s.eo=t.io,s.no=t.so,s.ro=t.oo,s.ho=t.ao,s.lo=t.co,s.uo=t.fo,s.do=t.yo,s.po=t.wo,s.vo=t.mo,s.xo=t.bo,s.So=t._o,s.Eo=t.To,s.Ao=t.Mo,s.Io=t.Fo,s.Lo=t.Go,s.Oo=t.Co,s.ko=t.Do,s.Bo=t.ys,s.No=t.ps,s.Uo=t.ws,s.Po=t.gs,s.$o=t.vs,s.zo=t.ds,s.Wo=t.bs,s.Ro=t.jo,s.Ho=t.Vo,s.qo=t.Yo,s.Jo=t.Ko,s.Qo=t.Xo,s.Zo=t.nr,s.th=t.eh,s.ih=t.nh,s.sh=t.rh,s.oh=t.hh,s.ah=t.uh,s.fh=t.dh,s.yh=t.ph,s.wh=t.gh,s.mh=t.xh,s.bh=t.Sh,s._h=t.Eh,F=t.Th})(K),(()=>{if(E--,s.Ah?.(E),0==E&&T){var t=T
|
|
797
|
+
T=null,t()}})(),K}E++,s.Ah?.(E)
|
|
798
|
+
var e,r={o:J,Mh:J}
|
|
799
|
+
return s.Ih?new Promise(e=>{s.Ih(r,i=>{e(t(i))})}):(m??=(e="hb.wasm",s.Fh?s.Fh(e,u):u+e),t((await(async function(t,e,i){if(!t&&!S(e)&&!h)try{var s=fetch(e,{credentials:"same-origin"})
|
|
797
800
|
return await WebAssembly.instantiateStreaming(s,i)}catch(t){x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation")}return(async(t,e)=>{try{var i=await(async t=>{if(!d)try{var e=await l(t)
|
|
798
801
|
return new Uint8Array(e)}catch{}return(t=>{if(t==m&&d)return new Uint8Array(d)
|
|
799
802
|
if(c)return c(t)
|
|
800
803
|
throw"both async and sync fetching of the wasm failed"})(t)})(t)
|
|
801
|
-
return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),n(t)}})(e,i)})(d,m,r)).
|
|
802
|
-
return(()=>{if(s.
|
|
803
|
-
L(G)})())}E>0?T=t:((()=>{if(s.
|
|
804
|
+
return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),n(t)}})(e,i)})(d,m,r)).Lh))})()
|
|
805
|
+
return(()=>{if(s.Gh)for("function"==typeof s.Gh&&(s.Gh=[s.Gh]);s.Gh.length>0;)s.Gh.shift()()})(),(function t(){function e(){s.Oh=!0,b||(_=!0,K.Ch(),p?.(s),s.kh?.(),(()=>{if(s.Dh)for("function"==typeof s.Dh&&(s.Dh=[s.Dh]);s.Dh.length;)O(s.Dh.shift())
|
|
806
|
+
L(G)})())}E>0?T=t:((()=>{if(s.Bh)for("function"==typeof s.Bh&&(s.Bh=[s.Bh]);s.Bh.length;)k(s.Bh.shift())
|
|
804
807
|
L(C)})(),E>0?T=t:s.setStatus?(s.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>s.setStatus(""),1),e()},1)):e())})(),_?s:new Promise((t,e)=>{p=t,w=e})})
|
|
805
808
|
t.exports=i,t.exports.default=i})(vt)
|
|
806
809
|
var xt=r(vt.exports),bt={exports:{}}
|
|
807
|
-
try{bt.exports=t=>{function e(t){return(255&t.charCodeAt(0))<<24|(255&t.charCodeAt(1))<<16|(255&t.charCodeAt(2))<<8|255&t.charCodeAt(3)}function i(e){var i=s.
|
|
810
|
+
try{bt.exports=t=>{function e(t){return(255&t.charCodeAt(0))<<24|(255&t.charCodeAt(1))<<16|(255&t.charCodeAt(2))<<8|255&t.charCodeAt(3)}function i(e){var i=s.Co(e.length+1)
|
|
808
811
|
for(let n=0;e.length>n;++n){const s=e.charCodeAt(n)
|
|
809
812
|
if(s>127)throw Error("Expected ASCII text")
|
|
810
|
-
t.HEAPU8[i+n]=s}return t.HEAPU8[i+e.length]=0,{
|
|
811
|
-
n&&(n=n.split(","),r=s.
|
|
812
|
-
s.
|
|
813
|
-
let o=t.
|
|
814
|
-
var a=o(t=>{s.
|
|
815
|
-
return{Ue(e){var i=s.
|
|
813
|
+
t.HEAPU8[i+n]=s}return t.HEAPU8[i+e.length]=0,{sr:i,length:e.length,Do(){s.Do(i)}}}function n(t,e,n){var r=0,o=0
|
|
814
|
+
n&&(n=n.split(","),r=s.Co(16*n.length),n.forEach(t=>{var e=i(t)
|
|
815
|
+
s.Go(e.sr,-1,r+16*o)&&o++,e.Do()})),s.Eh(t.sr,e.sr,r,o),r&&s.Do(r)}var s=t.Er,r=new TextDecoder("utf8")
|
|
816
|
+
let o=t.fs,h=t.Ss
|
|
817
|
+
var a=o(t=>{s.Do(t)},"vi"),l=e("JSON"),c="",u=s.Co(256)
|
|
818
|
+
return{Ue(e){var i=s.Co(e.byteLength)
|
|
816
819
|
t.HEAPU8.set(new Uint8Array(e),i)
|
|
817
|
-
var n=s.
|
|
818
|
-
return{
|
|
819
|
-
const o=s.
|
|
820
|
-
return{
|
|
821
|
-
if(o){var h=s.
|
|
822
|
-
return t.HEAPU8.subarray(h,h+o)}},We(){var e=s.
|
|
823
|
-
t.HEAPU32[i/4]=64,s.
|
|
820
|
+
var n=s.Cr(i,e.byteLength,2,i,a)
|
|
821
|
+
return{sr:n,destroy(){s.Dr(n)}}},Pe(i,n){var r=s.jo(i.sr,n)
|
|
822
|
+
const o=s.Ko(r)
|
|
823
|
+
return{sr:r,upem:o,Nh(i){var n=s.Yo(r,e(i)),o=s.Nr(n)
|
|
824
|
+
if(o){var h=s.Pr(n,null)
|
|
825
|
+
return t.HEAPU8.subarray(h,h+o)}},We(){var e=s.Co(2048),i=s.Co(4)
|
|
826
|
+
t.HEAPU32[i/4]=64,s.gh(r,0,i,e)
|
|
824
827
|
var n={}
|
|
825
828
|
return Array.from({length:t.HEAPU32[i/4]}).forEach((i,s)=>{var r
|
|
826
|
-
n[(r=t.HEAPU32[e/4+8*s+1],""+String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(255&r))]={min:t.HEAPF32[e/4+8*s+4],default:t.HEAPF32[e/4+8*s+5],max:t.HEAPF32[e/4+8*s+6]}}),s.
|
|
827
|
-
s.
|
|
828
|
-
var i=(e=>{const i=s.
|
|
829
|
-
return t.HEAPU32.set(o,r),s.
|
|
830
|
-
return s.
|
|
831
|
-
return{
|
|
829
|
+
n[(r=t.HEAPU32[e/4+8*s+1],""+String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(255&r))]={min:t.HEAPF32[e/4+8*s+4],default:t.HEAPF32[e/4+8*s+5],max:t.HEAPF32[e/4+8*s+6]}}),s.Do(i),s.Do(e),n},Uh(){var e=s.dh()
|
|
830
|
+
s.Xo(r,e)
|
|
831
|
+
var i=(e=>{const i=s.xh(e),n=s.Co(i<<2),r=n>>2,o=t.HEAPU32.subarray(r,r+i)
|
|
832
|
+
return t.HEAPU32.set(o,r),s.Sh(e,-1,n,i),o})(e)
|
|
833
|
+
return s.ph(e),i},destroy(){s.Vo(r)}}},$e(i){function n(t){return l||(f=o((t,e,i,n,s)=>{c+=`M${n},${s}`},"viiiffi"),d=o((t,e,i,n,s)=>{c+=`L${n},${s}`},"viiiffi"),y=o((t,e,i,n,s,r,o,h,a)=>{c+=`C${n},${s} ${r},${o} ${h},${a}`},"viiiffffffi"),p=o((t,e,i,n,s,r,o)=>{c+=`Q${n},${s} ${r},${o}`},"viiiffffi"),w=o(()=>{c+="Z"},"viiii"),l=s.ds(),s.ys(l,f,0,0),s.ps(l,d,0,0),s.gs(l,y,0,0),s.ws(l,p,0,0),s.vs(l,w,0,0)),c="",s.nr(a,t,l,0),c}var a=s.nh(i.sr),l=null,f=null,d=null,y=null,p=null,w=null
|
|
834
|
+
return{sr:a,Ph(e){s.eh(a,e,u,256)
|
|
832
835
|
var i=t.HEAPU8.subarray(u,u+256)
|
|
833
|
-
return r.decode(i.slice(0,i.indexOf(0)))}
|
|
834
|
-
return{type:e[0],values:e.slice(1).filter(t=>t.length).map(t=>+t)}}),setScale(t,e){s.
|
|
835
|
-
n.forEach((i,n)=>{t.HEAPU32[r/4+2*n+0]=e(i[0]),t.HEAPF32[r/4+2*n+1]=i[1]}),s.
|
|
836
|
-
return{
|
|
836
|
+
return r.decode(i.slice(0,i.indexOf(0)))},$h:n,zh:t=>n(t).replace(/([MLQCZ])/g,"|$1 ").split("|").filter(t=>t.length).map(t=>{var e=t.split(/[ ,]/g)
|
|
837
|
+
return{type:e[0],values:e.slice(1).filter(t=>t.length).map(t=>+t)}}),setScale(t,e){s.uh(a,t,e)},ze(i){var n=Object.entries(i),r=s.Co(8*n.length)
|
|
838
|
+
n.forEach((i,n)=>{t.HEAPU32[r/4+2*n+0]=e(i[0]),t.HEAPF32[r/4+2*n+1]=i[1]}),s.rh(a,r,n.length),s.Do(r)},destroy(){s.hh(a),l&&(s.bs(l),l=null,h(f),h(d),h(y),h(p),h(w))}}},createBuffer(){var e=s.Rr()
|
|
839
|
+
return{sr:e,Vt(i){const n=(e=>{const i=s.Co(2*e.length),n=new Uint16Array(t._r.buffer,i,e.length)
|
|
837
840
|
for(let t=0;n.length>t;++t)n[t]=e.charCodeAt(t)
|
|
838
|
-
return{
|
|
839
|
-
s.
|
|
840
|
-
t.forEach(t=>{i|=(t=>"BOT"==t?1:"EOT"==t?2:"PRESERVE_DEFAULT_IGNORABLES"==t?4:"REMOVE_DEFAULT_IGNORABLES"==t?8:"DO_NOT_INSERT_DOTTED_CIRCLE"==t?16:"PRODUCE_UNSAFE_TO_CONCAT"==t?64:0)(t)}),s.
|
|
841
|
-
s.
|
|
842
|
-
s.
|
|
843
|
-
return n},destroy(){s.
|
|
844
|
-
return o.startsWith("start table GSUB")?d=1:o.startsWith("start table GPOS")&&(d=2),d!=u&&(y=!1),0!=u&&d==u&&o.startsWith("end lookup "+c)&&(y=!0),y?0:(s
|
|
845
|
-
return s.
|
|
846
|
-
s.
|
|
847
|
-
var i={
|
|
848
|
-
return s.
|
|
841
|
+
return{sr:i,length:n.length,Do(){s.Do(i)}}})(i)
|
|
842
|
+
s.mo(e,n.sr,n.length,0,n.length),n.Do()},qt:()=>s.yo(e),dr(t){s.Jr(e,{Wh:4,Rh:5,jh:6,Hh:7}[t]||0)},Vh(t){var i=0
|
|
843
|
+
t.forEach(t=>{i|=(t=>"BOT"==t?1:"EOT"==t?2:"PRESERVE_DEFAULT_IGNORABLES"==t?4:"REMOVE_DEFAULT_IGNORABLES"==t?8:"DO_NOT_INSERT_DOTTED_CIRCLE"==t?16:"PRODUCE_UNSAFE_TO_CONCAT"==t?64:0)(t)}),s.io(e,i)},qh(t){var n=i(t)
|
|
844
|
+
s.Zr(e,s._o(n.sr,-1)),n.Do()},Yh(t){var n=i(t)
|
|
845
|
+
s.Qr(e,s.To(n.sr,-1)),n.Do()},Jh(t){s.so(e,t)},json(){for(var i=s.oo(e),n=[],r=s.ao(e,0),o=r/4,h=s.co(e,0)/4,a=t.HEAPU32.subarray(o,o+5*i),l=t.HEAP32.subarray(h,h+5*i),c=0;i>c;++c)n.push({g:a[5*c+0],Jt:a[5*c+2],ax:l[5*c+0],ay:l[5*c+1],dx:l[5*c+2],dy:l[5*c+3],flags:s.fo(r+20*c)})
|
|
846
|
+
return n},destroy(){s.Hr(e)}}},shape:n,Kh(e,i,a,c,u){var f=[],d=0,y=!1,p=1048576,w=s.Co(p),g=o((e,i,n)=>{var o=r.decode(t.HEAPU8.subarray(n,t.HEAPU8.indexOf(0,n)))
|
|
847
|
+
return o.startsWith("start table GSUB")?d=1:o.startsWith("start table GPOS")&&(d=2),d!=u&&(y=!1),0!=u&&d==u&&o.startsWith("end lookup "+c)&&(y=!0),y?0:(s.zr(e,0,s.oo(e),w,p,0,i,l,4),f.push({li:o,di:JSON.parse(r.decode(t.HEAPU8.subarray(w,t.HEAPU8.indexOf(0,w)))),glyphs:2==s.qr(e)}),1)},"iiiii")
|
|
848
|
+
return s.bo(i.sr,g,0,0),n(e,i,a),s.Do(w),h(g),f},version(){var e=s.Co(12)
|
|
849
|
+
s.Mo(e,e+4,e+8)
|
|
850
|
+
var i={Qh:t.HEAPU32[e/4],Xh:t.HEAPU32[(e+4)/4],Zh:t.HEAPU32[(e+8)/4]}
|
|
851
|
+
return s.Do(e),i},ta(){var e=s.Fo()
|
|
849
852
|
return r.decode(t.HEAPU8.subarray(e,t.HEAPU8.indexOf(0,e)))}}}}catch(t){}var St=r(bt.exports)
|
|
850
853
|
let _t=null,Et=null,Tt=null
|
|
851
|
-
const At={
|
|
852
|
-
if(Tt)e.
|
|
854
|
+
const At={ea(t){Et=t,Tt=null,_t=null},ia(t){Tt=t,Et=null,_t=null},na:async()=>_t||(_t=new Promise(async(t,e)=>{try{const e={}
|
|
855
|
+
if(Tt)e.Sr=Tt
|
|
853
856
|
else{if(!Et)throw Error("HarfBuzz WASM path or buffer must be set before initialization.")
|
|
854
|
-
e.
|
|
855
|
-
t({hb:St(i),module:{
|
|
856
|
-
class Mt{constructor(t,e){this.text=t,this.
|
|
857
|
-
e.push(t),this.
|
|
858
|
-
return t.
|
|
857
|
+
e.Fh=(t,e)=>t.endsWith(".wasm")?Et:e+t}const i=await xt(e)
|
|
858
|
+
t({hb:St(i),module:{fs:i.fs,exports:i.Er,Ss:i.Ss}})}catch(t){e(Error("Failed to initialize HarfBuzz: "+t))}}),_t)}
|
|
859
|
+
class Mt{constructor(t,e){this.text=t,this.sa=new Map,e.forEach(t=>{const e=this.sa.get(t.tr)||[]
|
|
860
|
+
e.push(t),this.sa.set(t.tr,e)})}ra(t){const e=[]
|
|
861
|
+
return t.oa&&e.push(...this.ha(t.oa)),t.aa&&e.push(...this.la(t.aa)),e}ha(t){const e=[]
|
|
859
862
|
for(const i of t){let t=0
|
|
860
|
-
for(;-1!==(t=this.text.indexOf(i,t));)e.push(this.createTextRange(t,t+i.length,i)),t+=i.length}return e}
|
|
863
|
+
for(;-1!==(t=this.text.indexOf(i,t));)e.push(this.createTextRange(t,t+i.length,i)),t+=i.length}return e}la(t){return t.map(t=>{const e=this.text.slice(t.start,t.end)
|
|
861
864
|
return this.createTextRange(t.start,t.end,e)})}createTextRange(t,e,i){const n=[],s=new Map
|
|
862
|
-
for(let i=t;e>i;i++){const t=this.
|
|
865
|
+
for(let i=t;e>i;i++){const t=this.sa.get(i)
|
|
863
866
|
if(t)for(const e of t){n.push(e)
|
|
864
|
-
const t=s.get(e.
|
|
865
|
-
t.push(e),s.set(e.
|
|
867
|
+
const t=s.get(e.er)||[]
|
|
868
|
+
t.push(e),s.set(e.er,t)}}return{start:t,end:e,ca:i,bounds:Array.from(s.values()).map(t=>this.ua(t)),glyphs:n,fa:Array.from(s.keys()).sort((t,e)=>t-e)}}ua(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
|
|
866
869
|
let e=1/0,i=1/0,n=1/0,s=-1/0,r=-1/0,o=-1/0
|
|
867
870
|
for(const h of t)e>h.bounds.min.x&&(e=h.bounds.min.x),i>h.bounds.min.y&&(i=h.bounds.min.y),n>h.bounds.min.z&&(n=h.bounds.min.z),h.bounds.max.x>s&&(s=h.bounds.max.x),h.bounds.max.y>r&&(r=h.bounds.max.y),h.bounds.max.z>o&&(o=h.bounds.max.z)
|
|
868
871
|
return{min:{x:e,y:i,z:n},max:{x:s,y:r,z:o}}}}const It=72
|
|
869
|
-
class Ft{static{this.
|
|
872
|
+
class Ft{static{this.da=new Map}static{this.ya=null}static{this.pa=new Map}static{this.wa=0}static{this.ga=1/0}static{this.va=0}static ma(t){const e=Object.keys(t).sort()
|
|
870
873
|
let i=""
|
|
871
874
|
for(let n=0;e.length>n;n++)n>0&&(i+=","),i+=e[n]+":"+t[e[n]]
|
|
872
|
-
return i}constructor(){this.
|
|
873
|
-
Ft.
|
|
874
|
-
const e=await Ft.
|
|
875
|
-
i.
|
|
876
|
-
const n=await i.
|
|
875
|
+
return i}constructor(){this.xa="",Ft.ya||(Ft.ya=At.na()),this.ba=new H(()=>Ft.ya)}static Sa(t){At.ea(t),Ft.ya=null}static _a(t){At.ia(t),Ft.ya=null}static init(){return Ft.ya||(Ft.ya=At.na()),Ft.ya}static async create(t){if(!t.font)throw Error("Font is required. Specify options.font as a URL string or ArrayBuffer.")
|
|
876
|
+
Ft.ya||(Ft.ya=At.na())
|
|
877
|
+
const e=await Ft.Ea(t),i=new Ft
|
|
878
|
+
i.Ta(e)
|
|
879
|
+
const n=await i.Aa(t),s=async e=>{const n={...t}
|
|
877
880
|
for(const t in e){const i=e[t]
|
|
878
|
-
void 0!==i&&(n[t]=i)}if(void 0!==e.font||void 0!==e.Re||void 0!==e.Yt){const t=await Ft.
|
|
879
|
-
i.
|
|
880
|
-
return{...n,getLoadedFont(){return i.getLoadedFont()},getCacheSize(){return i.getCacheSize()},clearCache(){return i.clearCache()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:s}}static async
|
|
881
|
-
t.Re&&(e+="_var_"+Ft.
|
|
882
|
-
let i=Ft.
|
|
883
|
-
return i||(i=await Ft.
|
|
881
|
+
void 0!==i&&(n[t]=i)}if(void 0!==e.font||void 0!==e.Re||void 0!==e.Yt){const t=await Ft.Ea(n)
|
|
882
|
+
i.Ta(t),i.Ma()}return t=n,{...await i.Aa(t),getLoadedFont(){return i.getLoadedFont()},getCacheSize(){return i.getCacheSize()},clearCache(){return i.clearCache()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:s}}
|
|
883
|
+
return{...n,getLoadedFont(){return i.getLoadedFont()},getCacheSize(){return i.getCacheSize()},clearCache(){return i.clearCache()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:s}}static async Ea(t){let e="string"==typeof t.font?t.font:"buffer-"+Ft.Ia(t.font)
|
|
884
|
+
t.Re&&(e+="_var_"+Ft.ma(t.Re)),t.Yt&&(e+="_feat_"+Ft.ma(t.Yt))
|
|
885
|
+
let i=Ft.pa.get(e)
|
|
886
|
+
return i||(i=await Ft.Fa(e,t.font,t.Re,t.Yt)),i}static async Fa(t,e,i,n){const s=new Ft
|
|
884
887
|
await s.Ne(e,i,n)
|
|
885
888
|
const r=s.getLoadedFont()
|
|
886
|
-
return Ft.
|
|
887
|
-
e&&(Ft.
|
|
889
|
+
return Ft.pa.set(t,r),Ft.La(r),Ft.Ga(),r}static La(t){Ft.wa+=t.Ye?.byteLength??0}static Oa(t){const e=Ft.pa.get(t)
|
|
890
|
+
e&&(Ft.wa-=e.Ye?.byteLength??0,0>Ft.wa&&(Ft.wa=0))}static Ga(){if(Ft.ga!==1/0)for(;Ft.wa>Ft.ga&&Ft.pa.size>0;){const t=Ft.pa.keys().next().value
|
|
888
891
|
if(void 0===t)break
|
|
889
|
-
Ft.
|
|
892
|
+
Ft.Oa(t),Ft.pa.delete(t)}}static Ia(t){if(t){const e=new Uint8Array(t)
|
|
890
893
|
let i=2166136261
|
|
891
894
|
const n=Math.min(32,e.length),s=Math.floor(e.length/n)
|
|
892
895
|
for(let t=0;n>t;t++)i^=e[t*s],i=Math.imul(i,16777619)
|
|
893
|
-
return i^=e.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++Ft.
|
|
894
|
-
const e=Ft.
|
|
895
|
-
this.
|
|
896
|
+
return i^=e.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++Ft.va}Ta(t){this.Kt=t
|
|
897
|
+
const e=Ft.Ia(t.Ye)
|
|
898
|
+
this.xa="font_"+e,t.Re&&(this.xa+="_var_"+Ft.ma(t.Re)),t.Yt&&(this.xa+="_feat_"+Ft.ma(t.Yt))}async Ne(t,e,i){Ft.ya||(Ft.ya=At.na()),await Ft.ya
|
|
896
899
|
const n="string"==typeof t?await fetch(t).then(e=>{if(!e.ok)throw Error(`Failed to load font from ${t}: HTTP ${e.status} ${e.statusText}`)
|
|
897
900
|
return e.arrayBuffer()}):t
|
|
898
|
-
try{this.Kt&&this.destroy(),this.Kt=await this.
|
|
899
|
-
const t=Ft.
|
|
900
|
-
this.
|
|
901
|
-
const e=await this.
|
|
902
|
-
this.
|
|
901
|
+
try{this.Kt&&this.destroy(),this.Kt=await this.ba.Ne(n,e),i&&(this.Kt.Yt=i)
|
|
902
|
+
const t=Ft.Ia(n)
|
|
903
|
+
this.xa="font_"+t,e&&(this.xa+="_var_"+Ft.ma(e)),i&&(this.xa+="_feat_"+Ft.ma(i))}catch(t){throw a.error("Failed to load font:",t),t}}async Aa(t){try{if(!this.Kt)throw Error("Font not loaded. Use Text.create() with a font option.")
|
|
904
|
+
const e=await this.Ca(t)
|
|
905
|
+
this.ka(e),this.Da(t=e),this.lr||(this.lr=new wt(Q,this.Kt),this.lr.Ns(this.xa))
|
|
903
906
|
const i=null!=t.curveSteps&&t.curveSteps>0
|
|
904
|
-
this.
|
|
905
|
-
const n=this.
|
|
907
|
+
this.lr.wn(t.curveSteps),this.lr.pn(i?void 0:t.curveFidelity),this.lr.Xn(t.geometryOptimization),this.Kt.font.setScale(this.Kt.upem,this.Kt.upem),this.Ba||(this.Ba=new gt(this.Kt,this.lr))
|
|
908
|
+
const n=this.Na(t),s=t.Ua??this.Kt.je??!1,r=this.Ba.cr(n.lines,n.Pa,n.letterSpacing,n.align,n.direction,t.color,t.text)
|
|
906
909
|
let o,h
|
|
907
|
-
if(t.color&&"object"==typeof t.color&&!Array.isArray(t.color)&&(t.color.
|
|
908
|
-
for(const e of Object.keys(t.color.
|
|
910
|
+
if(t.color&&"object"==typeof t.color&&!Array.isArray(t.color)&&(t.color.oa||t.color.aa)){if(o=new Set,t.color.oa){h=[]
|
|
911
|
+
for(const e of Object.keys(t.color.oa)){let i=0
|
|
909
912
|
for(;-1!==(i=t.text.indexOf(e,i));){h.push({pattern:e,start:i,end:i+e.length})
|
|
910
913
|
for(let t=i;i+e.length>t;t++)o.add(t)
|
|
911
|
-
i+=e.length}}}if(t.color.
|
|
912
|
-
if(t.perGlyphAttributes){const t=this.
|
|
913
|
-
l.glyphAttributes=t}return l}finally{}}async
|
|
914
|
-
if(!t.layout?.St?.[e])try{if(!Ft.
|
|
915
|
-
Ft.
|
|
916
|
-
const e=t.
|
|
917
|
-
if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}
|
|
914
|
+
i+=e.length}}}if(t.color.aa)for(const e of t.color.aa)for(let t=e.start;e.end>t;t++)o.add(t)}const a=this.lr.Ps(r,n.depth,s,this.Kt.h.ue,n.$a,t.perGlyphAttributes??!1,o),l=this.za(a.vertices,a.normals,a.indices,a.Zs,a.planeBounds,t,t.text,h)
|
|
915
|
+
if(t.perGlyphAttributes){const t=this.Wa(l.vertices.length/3,l.glyphs)
|
|
916
|
+
l.glyphAttributes=t}return l}finally{}}async Ca(t){if(!1!==t.layout?.vt&&t.layout?.width){const e=t.layout?.language||"en-us"
|
|
917
|
+
if(!t.layout?.St?.[e])try{if(!Ft.da.has(e)){const i=await n(e,t.layout?.Ra)
|
|
918
|
+
Ft.da.set(e,i)}return{...t,layout:{...t.layout,St:{...t.layout?.St,[e]:Ft.da.get(e)}}}}catch(i){return a.warn(`Failed to load patterns for ${e}: ${i}`),{...t,layout:{...t.layout,vt:!1}}}}return t}ka(t){if(!t.text)throw Error("Text content is required")
|
|
919
|
+
const e=t.ja??1e5
|
|
920
|
+
if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}Da(t){t.Re&&this.Kt&&Ft.ma(t.Re)!==Ft.ma(this.Kt.Re||{})&&(this.Kt.font.ze(t.Re),this.Kt.Re=t.Re)}Na(t){if(!this.Kt)throw Error("Font not loaded. Use Text.create() with a font option")
|
|
918
921
|
const{text:e,size:i=It,depth:n=0,lineHeight:s=1,letterSpacing:r=0,layout:o={}}=t,{width:h,direction:a="ltr",align:f=("rtl"===a?"right":"left"),xt:d=!0,vt:y=!0,language:p="en-us",Et:w=l,Tt:g=c,At:v=u,Mt:m,St:x,It:b,Ft:S,Lt:_,Gt:E,Ot:T,Ct:A,kt:M}=o,F=this.Kt.upem/i
|
|
919
922
|
let L
|
|
920
923
|
void 0!==h&&(L=h*F)
|
|
921
924
|
const G=n*F,O=G>0?Math.max(G,25e-6*this.Kt.upem):0
|
|
922
|
-
this.
|
|
923
|
-
const C=this.
|
|
924
|
-
return{lines:C.lines,
|
|
925
|
+
this.Ha||(this.Ha=new I(this.Kt))
|
|
926
|
+
const C=this.Ha.Qt({text:e,width:L,align:f,direction:a,vt:y,language:p,xt:d,Et:w,Tt:g,At:v,Mt:m,St:x,It:b,Ft:S,Lt:_,Gt:E,Ot:T,Ct:A,kt:M,letterSpacing:r}),k=R.Fe(this.Kt.h)
|
|
927
|
+
return{lines:C.lines,Pa:(k.ie-k.ne)*s,letterSpacing:r,align:f,direction:a,depth:O,size:i,$a:1/F}}Va(t,e,i,n,s){const r=t.length/3,o=new Float32Array(3*r),h=[]
|
|
925
928
|
if(Array.isArray(i)){for(let t=0;r>t;t++){const e=3*t
|
|
926
|
-
o[e]=i[0],o[e+1]=i[1],o[e+2]=i[2]}h.push({start:0,end:n.length,
|
|
929
|
+
o[e]=i[0],o[e+1]=i[1],o[e+2]=i[2]}h.push({start:0,end:n.length,ca:n,color:i,bounds:[],glyphs:e,fa:[...new Set(e.map(t=>t.er))]})}else{const t=i.default||[1,1,1]
|
|
927
930
|
for(let e=0;o.length>e;e+=3)o[e]=t[0],o[e+1]=t[1],o[e+2]=t[2]
|
|
928
931
|
let r
|
|
929
|
-
if(i.
|
|
930
|
-
for(const t of e){const e=r.get(t.
|
|
931
|
-
e?e.push(t):r.set(t.
|
|
932
|
+
if(i.oa&&s||i.aa){r=new Map
|
|
933
|
+
for(const t of e){const e=r.get(t.tr)
|
|
934
|
+
e?e.push(t):r.set(t.tr,[t])}}if(i.oa&&s&&r)for(const t of s){const e=i.oa[t.pattern]
|
|
932
935
|
if(!e)continue
|
|
933
936
|
const n=[],s=new Map
|
|
934
937
|
for(let i=t.start;t.end>i;i++){const t=r.get(i)
|
|
935
938
|
if(t)for(const i of t){n.push(i)
|
|
936
|
-
const t=s.get(i.
|
|
937
|
-
t?t.push(i):s.set(i.
|
|
938
|
-
for(let t=0;i.
|
|
939
|
-
n>=0&&o.length>n&&(o[n]=e[0],o[n+1]=e[1],o[n+2]=e[2])}}}const a=Array.from(s.values()).map(t=>this.
|
|
940
|
-
h.push({start:t.start,end:t.end,
|
|
939
|
+
const t=s.get(i.er)
|
|
940
|
+
t?t.push(i):s.set(i.er,[i])
|
|
941
|
+
for(let t=0;i.ir>t;t++){const n=3*(i.Ws+t)
|
|
942
|
+
n>=0&&o.length>n&&(o[n]=e[0],o[n+1]=e[1],o[n+2]=e[2])}}}const a=Array.from(s.values()).map(t=>this.qa(t))
|
|
943
|
+
h.push({start:t.start,end:t.end,ca:t.pattern,color:e,bounds:a,glyphs:n,fa:Array.from(s.keys()).sort((t,e)=>t-e)})}if(i.aa&&r)for(const t of i.aa){const e=[],i=new Map
|
|
941
944
|
for(let n=t.start;t.end>n;n++){const s=r.get(n)
|
|
942
945
|
if(s)for(const n of s){e.push(n)
|
|
943
|
-
const s=i.get(n.
|
|
944
|
-
s?s.push(n):i.set(n.
|
|
945
|
-
for(let e=0;n.
|
|
946
|
-
i>=0&&o.length>i&&(o[i]=t.color[0],o[i+1]=t.color[1],o[i+2]=t.color[2])}}}const s=Array.from(i.values()).map(t=>this.
|
|
947
|
-
h.push({start:t.start,end:t.end,
|
|
946
|
+
const s=i.get(n.er)
|
|
947
|
+
s?s.push(n):i.set(n.er,[n])
|
|
948
|
+
for(let e=0;n.ir>e;e++){const i=3*(n.Ws+e)
|
|
949
|
+
i>=0&&o.length>i&&(o[i]=t.color[0],o[i+1]=t.color[1],o[i+2]=t.color[2])}}}const s=Array.from(i.values()).map(t=>this.qa(t))
|
|
950
|
+
h.push({start:t.start,end:t.end,ca:n.slice(t.start,t.end),color:t.color,bounds:s,glyphs:e,fa:Array.from(i.keys()).sort((t,e)=>t-e)})}}return{colors:o,Ya:h}}qa(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
|
|
948
951
|
let e=1/0,i=1/0,n=1/0,s=-1/0,r=-1/0,o=-1/0
|
|
949
952
|
for(const h of t)e>h.bounds.min.x&&(e=h.bounds.min.x),i>h.bounds.min.y&&(i=h.bounds.min.y),n>h.bounds.min.z&&(n=h.bounds.min.z),h.bounds.max.x>s&&(s=h.bounds.max.x),h.bounds.max.y>r&&(r=h.bounds.max.y),h.bounds.max.z>o&&(o=h.bounds.max.z)
|
|
950
|
-
return{min:{x:e,y:i,z:n},max:{x:s,y:r,z:o}}}
|
|
951
|
-
this.
|
|
952
|
-
const u=this.
|
|
953
|
+
return{min:{x:e,y:i,z:n},max:{x:s,y:r,z:o}}}za(t,e,i,n,s,r,o,h){const{layout:a={}}=r,{width:l,align:c=("rtl"===a.direction?"right":"left")}=a
|
|
954
|
+
this.Ha||(this.Ha=new I(this.Kt))
|
|
955
|
+
const u=this.Ha.te({width:l,align:c,planeBounds:s}),f=u.offset
|
|
953
956
|
if(s.min.x=u.Zt.min.x,s.max.x=u.Zt.max.x,0!==f){for(let e=0;t.length>e;e+=3)t[e]+=f
|
|
954
957
|
for(let t=0;n.length>t;t++)n[t].bounds.min.x+=f,n[t].bounds.max.x+=f}let d,y
|
|
955
|
-
if(r.color){const e=this.
|
|
956
|
-
d=e.colors,y=e.
|
|
958
|
+
if(r.color){const e=this.Va(t,n,r.color,r.text,h)
|
|
959
|
+
d=e.colors,y=e.Ya}const p=this.lr.Zn()
|
|
957
960
|
return{vertices:t,normals:e,indices:i,colors:d,glyphs:n,planeBounds:s,stats:{trianglesGenerated:i.length/3,verticesGenerated:t.length/3,pointsRemovedByVisvalingam:p.pointsRemovedByVisvalingam,originalPointCount:p.originalPointCount},query:(()=>{let t=null
|
|
958
961
|
return e=>{if(!o)throw Error("Original text not available for querying")
|
|
959
|
-
return t||(t=new Mt(o,n)),t.
|
|
960
|
-
return R.Le(this.Kt.h)}static async
|
|
961
|
-
Ft.
|
|
962
|
-
return M.measureTextWidth(this.Kt,t,e)}getCacheSize(){return this.
|
|
962
|
+
return t||(t=new Mt(o,n)),t.ra(e)}})(),Ya:y,glyphAttributes:void 0}}Le(){if(!this.Kt)throw Error("Font not loaded. Call loadFont() first")
|
|
963
|
+
return R.Le(this.Kt.h)}static async Ja(t,e){await Promise.all(t.map(async t=>{if(!Ft.da.has(t))try{const i=await n(t,e)
|
|
964
|
+
Ft.da.set(t,i)}catch(e){a.warn(`Failed to pre-load patterns for ${t}: ${e}`)}}))}static Ka(t,e){Ft.da.set(t,e)}static Qa(t){Ft.ga=t===1/0?1/0:1048576*Math.max(1,Math.floor(t)),Ft.Ga()}getLoadedFont(){return this.Kt}measureTextWidth(t,e=0){if(!this.Kt)throw Error("Font not loaded. Call loadFont() first")
|
|
965
|
+
return M.measureTextWidth(this.Kt,t,e)}getCacheSize(){return this.lr?this.lr.hr().size:0}clearCache(){this.lr&&this.lr.clearCache()}Wa(t,e){const i=new Float32Array(3*t),n=new Float32Array(t),s=new Float32Array(t),r=new Float32Array(t),o=new Float32Array(t)
|
|
963
966
|
let h=1/0,a=-1/0
|
|
964
967
|
for(let t=0;e.length>t;t++){const i=(e[t].bounds.min.x+e[t].bounds.max.x)/2
|
|
965
968
|
h>i&&(h=i),i>a&&(a=i)}const l=a-h
|
|
966
|
-
for(let a=0;e.length>a;a++){const c=e[a],u=(c.bounds.min.x+c.bounds.max.x)/2,f=(c.bounds.min.y+c.bounds.max.y)/2,d=(c.bounds.min.z+c.bounds.max.z)/2,y=c.bounds.min.y,p=l>0?(u-h)/l:0,w=c.
|
|
967
|
-
if(g>w){n.fill(a,w,g),s.fill(c.
|
|
968
|
-
for(let t=3*w;3*g>t;t+=3)i[t]=u,i[t+1]=f,i[t+2]=d}}return{glyphCenter:i,glyphIndex:n,glyphLineIndex:s,glyphProgress:r,glyphBaselineY:o}}
|
|
969
|
+
for(let a=0;e.length>a;a++){const c=e[a],u=(c.bounds.min.x+c.bounds.max.x)/2,f=(c.bounds.min.y+c.bounds.max.y)/2,d=(c.bounds.min.z+c.bounds.max.z)/2,y=c.bounds.min.y,p=l>0?(u-h)/l:0,w=c.Ws,g=Math.min(w+c.ir,t)
|
|
970
|
+
if(g>w){n.fill(a,w,g),s.fill(c.er,w,g),r.fill(p,w,g),o.fill(y,w,g)
|
|
971
|
+
for(let t=3*w;3*g>t;t+=3)i[t]=u,i[t+1]=f,i[t+2]=d}}return{glyphCenter:i,glyphIndex:n,glyphLineIndex:s,glyphProgress:r,glyphBaselineY:o}}Ma(){this.lr=void 0,this.Ba=void 0,this.Ha=void 0}destroy(){if(!this.Kt)return
|
|
969
972
|
const t=this.Kt
|
|
970
|
-
try{H.Je(t)}catch(t){a.warn("Error destroying HarfBuzz objects:",t)}finally{this.Kt=void 0,this.
|
|
973
|
+
try{H.Je(t)}catch(t){a.warn("Error destroying HarfBuzz objects:",t)}finally{this.Kt=void 0,this.Ha=void 0,this.Ba=void 0}}}t.DEFAULT_CURVE_FIDELITY=ct,t.FontMetadataExtractor=R,t.Text=Ft,t.Xa=()=>new K,t.Za=Q})
|