three-text 0.5.1 → 0.6.0
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/LICENSE_THIRD_PARTY +15 -0
- package/README.md +80 -50
- package/dist/index.cjs +66 -20
- package/dist/index.d.ts +8 -0
- package/dist/index.js +66 -20
- package/dist/index.min.cjs +310 -307
- package/dist/index.min.js +265 -262
- package/dist/index.umd.js +68 -21
- package/dist/index.umd.min.js +268 -265
- package/dist/three/index.cjs +2 -1
- package/dist/three/index.d.ts +1 -0
- package/dist/three/index.js +2 -1
- package/dist/three/react.cjs +35 -17
- package/dist/three/react.d.ts +8 -0
- package/dist/three/react.js +35 -17
- package/dist/types/core/Text.d.ts +6 -0
- package/dist/types/core/types.d.ts +2 -33
- package/dist/types/three/index.d.ts +1 -0
- package/dist/types/vector/core/index.d.ts +28 -0
- package/dist/types/vector/index.d.ts +17 -12
- package/dist/types/vector/react.d.ts +3 -4
- package/dist/types/vector/slug/SlugPacker.d.ts +2 -0
- package/dist/types/vector/slug/curveUtils.d.ts +6 -0
- package/dist/types/vector/slug/index.d.ts +8 -0
- package/dist/types/vector/slug/shaderStrings.d.ts +4 -0
- package/dist/types/vector/slug/slugGLSL.d.ts +21 -0
- package/dist/types/vector/slug/slugTSL.d.ts +13 -0
- package/dist/types/vector/slug/types.d.ts +30 -0
- package/dist/types/vector/slug/unpackVertices.d.ts +11 -0
- package/dist/types/vector/webgl/index.d.ts +7 -3
- package/dist/types/vector/webgpu/index.d.ts +4 -4
- package/dist/vector/all.cjs +21 -0
- package/dist/vector/all.d.ts +134 -0
- package/dist/vector/all.js +2 -0
- package/dist/vector/core/index.cjs +856 -0
- package/dist/vector/core/index.d.ts +63 -0
- package/dist/vector/core/index.js +854 -0
- package/dist/vector/core.cjs +5489 -0
- package/dist/vector/core.d.ts +402 -0
- package/dist/vector/core.js +5486 -0
- package/dist/vector/index.cjs +5 -1305
- package/dist/vector/index.d.ts +41 -67
- package/dist/vector/index.js +3 -1306
- package/dist/vector/index2.cjs +287 -0
- package/dist/vector/index2.js +264 -0
- package/dist/vector/loopBlinnTSL.d.ts +69 -0
- package/dist/vector/react.cjs +54 -40
- package/dist/vector/react.d.ts +11 -2
- package/dist/vector/react.js +55 -41
- package/dist/vector/slugTSL.cjs +252 -0
- package/dist/vector/slugTSL.js +231 -0
- package/dist/vector/webgl/index.cjs +131 -201
- package/dist/vector/webgl/index.d.ts +19 -44
- package/dist/vector/webgl/index.js +131 -201
- package/dist/vector/webgpu/index.cjs +100 -283
- package/dist/vector/webgpu/index.d.ts +16 -45
- package/dist/vector/webgpu/index.js +100 -283
- package/package.json +6 -1
- package/dist/types/vector/GlyphVectorGeometryBuilder.d.ts +0 -26
- package/dist/types/vector/LoopBlinnGeometry.d.ts +0 -68
- package/dist/types/vector/loopBlinnTSL.d.ts +0 -11
package/dist/index.umd.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license
|
|
3
|
-
* three-text v0.
|
|
3
|
+
* three-text v0.6.0
|
|
4
4
|
* Copyright © 2025-2026 Jeremy Tribby, Countertype LLC
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/
|
|
@@ -142,12 +142,12 @@ for(;l>0;){const s=Oe[Be[t]],n=Oe[Be[i]],r=Oe[Be[ke[l-1]]],o=s.s*(n.l-r.l)+n.s*(
|
|
|
142
142
|
if(!(1===Ce[t]?0>=o:o>=0))break
|
|
143
143
|
H(e,s,n,r),i=ke[--l]}ke[l++]=i,ke[l++]=t}for(;l>1;){const t=ke[--l]
|
|
144
144
|
H(e,Oe[Be[o-1]],Oe[Be[t]],Oe[Be[ke[l-1]]])}}function Y(t,e){let i
|
|
145
|
-
for(let s=t.Z.next;s!==t.Z;s=i)i=s.next,s.p.D.q!==s.D.q?s._=s.D.q?e:-e:t.delete(s)}function
|
|
145
|
+
for(let s=t.Z.next;s!==t.Z;s=i)i=s.next,s.p.D.q!==s.D.q?s._=s.D.q?e:-e:t.delete(s)}function K(t,e){let i=0,s=-1
|
|
146
146
|
for(let n=e.it.v;n!==e.it;n=n.v){if(!n.q)continue
|
|
147
147
|
i||(t.H(4),i=1)
|
|
148
148
|
let e=n.L
|
|
149
149
|
do{{const i=e.p&&e.p.D&&e.p.D.q?0:1
|
|
150
|
-
s!==i&&(s=i,t.K(!!s))}t.W(e.u.data),e=e.O}while(e!==n.L)}i&&t.st()}function
|
|
150
|
+
s!==i&&(s=i,t.K(!!s))}t.W(e.u.data),e=e.O}while(e!==n.L)}i&&t.st()}function J(t,e){for(let i=e.it.next;i!==e.it;i=i.next){if(!i.q)continue
|
|
151
151
|
t.H(2)
|
|
152
152
|
let e=i.L
|
|
153
153
|
do{t.W(e.u.data),e=e.O}while(e!==i.L)
|
|
@@ -240,7 +240,7 @@ return r.setAttribute("position",new e.Float32BufferAttribute(n.vertices,3)),r.s
|
|
|
240
240
|
for(const t in e){const i=e[t]
|
|
241
241
|
void 0!==i&&(n[t]=i)}if(void 0!==e.font||void 0!==e.lt||void 0!==e.ct){const e=await t.update(n)
|
|
242
242
|
return i.ut(e.ft,e.dt),i.reset(),st(t=e,i,s=n)}const r=await t.update(n)
|
|
243
|
-
return st(t=r,i,s=n)}}}const nt=!("undefined"==typeof window||!window.THREE_TEXT_LOG)||"undefined"!=typeof globalThis&&"true"===globalThis.process?.yt?.THREE_TEXT_LOG,rt=new class{warn(t,...e){}error(t,...e){console.error(t,...e)}log(t,...e){}}
|
|
243
|
+
return st(t=r,i,s=n)},dispose:()=>t.dispose()}}const nt=!("undefined"==typeof window||!window.THREE_TEXT_LOG)||"undefined"!=typeof globalThis&&"true"===globalThis.process?.yt?.THREE_TEXT_LOG,rt=new class{warn(t,...e){}error(t,...e){console.error(t,...e)}log(t,...e){}}
|
|
244
244
|
new class{constructor(){this.wt=[],this.gt=new Map}start(t,e){if(!nt)return
|
|
245
245
|
const i=performance.now()
|
|
246
246
|
this.gt.set(`${t}_${i}`,i),this.wt.push({name:t,startTime:i,metadata:e})}end(t){if(!nt)return null
|
|
@@ -352,7 +352,7 @@ if(0===r.size()&&u!==bt)return null
|
|
|
352
352
|
c.type===ct.BOX?o+=c.width:c.type===ct.GLUE?(o+=c.width,h+=c.stretch,a+=c.me):c.type===ct.DISCRETIONARY&&(o+=c.width)}let l=null,c=1/0
|
|
353
353
|
for(const t of r.ue())c>t.se&&(c=t.se,l=t)
|
|
354
354
|
return l}static Ne(t){if(!t.text||0===t.text.length)return[]
|
|
355
|
-
const{text:e,width:i,align:s="left",direction:n="ltr",$e:r=!1,language:o="en-us",Ge:h=!0,measureText:a,ze:l,We:c,Re:u,letterSpacing:f=0,je:d=ot,Ue:y=ht,Ve:p=at,He:w,qe:g=vt,Ye:m=xt,
|
|
355
|
+
const{text:e,width:i,align:s="left",direction:n="ltr",$e:r=!1,language:o="en-us",Ge:h=!0,measureText:a,ze:l,We:c,Re:u,letterSpacing:f=0,je:d=ot,Ue:y=ht,Ve:p=at,He:w,qe:g=vt,Ye:m=xt,Ke:v=gt,Je:x=mt,Xe:b=dt,Qe:A=yt,Ze:E=pt,ti:T=wt}=t
|
|
356
356
|
if(h&&e.includes("\n")){const i=e.split("\n"),s=[]
|
|
357
357
|
let n=0
|
|
358
358
|
for(const e of i){if(0===e.length)s.push({text:"",ei:n,ii:n,si:0,ni:!0,naturalWidth:0,ri:!1})
|
|
@@ -414,9 +414,9 @@ const r=i(t.ct)
|
|
|
414
414
|
t.hb.shape(t.font,n,r)
|
|
415
415
|
const o=n.json(t.font),h=s*t.upem
|
|
416
416
|
let a=0
|
|
417
|
-
return o.forEach(t=>{a+=t.ax,0!==h&&(a+=h)}),n.destroy(),a}}class It{constructor(t){this.ft=t}yi(t){const{text:e,width:i,align:s,direction:n,$e:r,language:o,Ge:h,je:a,Ue:l,Ve:c,He:u,We:f,qe:d,Ye:y,
|
|
417
|
+
return o.forEach(t=>{a+=t.ax,0!==h&&(a+=h)}),n.destroy(),a}}class It{constructor(t){this.ft=t}yi(t){const{text:e,width:i,align:s,direction:n,$e:r,language:o,Ge:h,je:a,Ue:l,Ve:c,He:u,We:f,qe:d,Ye:y,Ke:p,Je:w,Xe:g,Qe:m,Ze:v,letterSpacing:x}=t
|
|
418
418
|
let b
|
|
419
|
-
if(i)b=At.Ne({text:e,width:i,align:s,direction:n,$e:r,language:o,Ge:h,je:a,Ue:l,Ve:c,He:u,We:f,qe:d,Ye:y,
|
|
419
|
+
if(i)b=At.Ne({text:e,width:i,align:s,direction:n,$e:r,language:o,Ge:h,je:a,Ue:l,Ve:c,He:u,We:f,qe:d,Ye:y,Ke:p,Je:w,Xe:g,Qe:m,Ze:v,Re:this.ft.upem,letterSpacing:x,measureText:t=>Tt.measureTextWidth(this.ft,t,x),ze:t=>Tt.ze(this.ft,t,x)})
|
|
420
420
|
else{const t=e.split("\n")
|
|
421
421
|
b=[]
|
|
422
422
|
let i=0
|
|
@@ -489,8 +489,8 @@ const d=u+f
|
|
|
489
489
|
if(0!==t.getUint16(d))continue
|
|
490
490
|
const y=t.getUint16(d+2),p=this.ji(t,i,y)
|
|
491
491
|
p&&(n[String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,255&h)]=p)}}static Hi(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)}static qi(t){return null!==t.Ei&&null!==t.Ti?{xi:t.Ei,bi:t.Ti,Ai:0}:null!==t.Oi&&null!==t.Ci?{xi:t.Oi,bi:t.Ci,Ai:0}:null!==t.Fi&&null!==t.Si?{xi:t.Fi,bi:-t.Si,Ai:0}:{xi:Math.round(.8*t.Re),bi:-Math.round(.2*t.Re),Ai:0}}static Yi(t){const e=Wt.qi(t)
|
|
492
|
-
return{xi:e.xi,bi:e.bi,Ai:e.Ai,Re:t.Re,
|
|
493
|
-
class jt{static
|
|
492
|
+
return{xi:e.xi,bi:e.bi,Ai:e.Ai,Re:t.Re,Ki:e.xi-e.bi}}}let Rt=null
|
|
493
|
+
class jt{static Ji(t){if(4>t.byteLength)return"ttf/otf"
|
|
494
494
|
const e=new DataView(t).getUint32(0)
|
|
495
495
|
return e===Mt?"woff":e===_t?"woff2":"ttf/otf"}static async Xi(t){const e=new DataView(t),i=new Uint8Array(t)
|
|
496
496
|
if(e.getUint32(0)!==Mt)throw Error("Not a valid WOFF font")
|
|
@@ -513,7 +513,7 @@ h.setUint32(i,e.tag),h.setUint32(i+4,e.t),h.setUint32(i+8,l),h.setUint32(i+12,e.
|
|
|
513
513
|
if(!Rt)throw Error("WOFF2 fonts require enabling the decoder. Add to your code:\n import { woff2Decode } from 'woff-lib/woff2/decode';\n Text.enableWoff2(woff2Decode);")
|
|
514
514
|
return(await Rt(t)).buffer}static async Zi(t){const e=new ReadableStream({start(e){e.enqueue(t),e.close()}}).pipeThrough(new DecompressionStream("deflate"))
|
|
515
515
|
return new Response(e).arrayBuffer()}}class Ut{constructor(t){this.es=t}async ss(t,e){if(!t||12>t.byteLength)throw Error("Invalid font buffer: too small to be a valid font file")
|
|
516
|
-
const i=jt.
|
|
516
|
+
const i=jt.Ji(t)
|
|
517
517
|
"woff"===i?t=await jt.Xi(t):"woff2"===i&&(t=await jt.ts(t))
|
|
518
518
|
const s=new DataView(t).getUint32(0)
|
|
519
519
|
if(![Ft,St].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
|
|
@@ -531,7 +531,7 @@ return e*e+i*i}equals(t){return this.x===t.x&&this.y===t.y}angle(){return Math.a
|
|
|
531
531
|
return t>0&&this.vs(t),this}bs(t){return this.x*t.x+this.y*t.y+this.z*t.z}Ts(t){const e=this.z*t.x-this.x*t.z,i=this.x*t.y-this.y*t.x
|
|
532
532
|
return this.x=this.y*t.z-this.z*t.y,this.y=e,this.z=i,this}As(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z
|
|
533
533
|
return Math.sqrt(e*e+i*i+s*s)}Es(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z
|
|
534
|
-
return e*e+i*i+s*s}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}}class
|
|
534
|
+
return e*e+i*i+s*s}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}}class Kt{constructor(t){this.Is=new Map,this.ft=t}Fs(t,e,i,s,n,r,o){try{const r=[]
|
|
535
535
|
return t.forEach((t,o)=>{const h=this.Ss(t,o,e,i,s,n)
|
|
536
536
|
r.push(h)}),r}finally{}}Ss(t,e,s,n,r,o){const h=this.ft.hb.createBuffer()
|
|
537
537
|
"rtl"===o&&h.Ms("rtl"),h.ui(t.text),h.fi()
|
|
@@ -550,7 +550,7 @@ if(h||(0===u.length&&(d=a,y=T),s.x=a-d,s.y=T-y,u.push(s),f.push(r)),p+=s.ax,w+=s
|
|
|
550
550
|
if(E=!!t&&At.be(t),e&&E){let e=!0
|
|
551
551
|
At.Ae(t)&&(e=!1),At.Ee(r)&&(e=!1),At.Te(r)&&At.Te(t)&&(e=!1),e&&(p+=v)}}else E=void 0}return u.length>0&&c.push({text:f.join(""),glyphs:u,position:new Yt(d,y,0)}),c}_s(t,e,i){let s=0
|
|
552
552
|
if(void 0!==t.ci&&"justify"===e&&!t.ni){let e=this.Is.get(i)
|
|
553
|
-
void 0===e&&(e=Tt.measureTextWidth(this.ft," ",i),this.Is.set(i,e)),t.ci>0?s=t.ci*e*.5:0>t.ci&&(s=t.ci*e*lt)}return s}Os(t,e){return void 0===t.ci||"justify"!==e||t.ni?0:t.ci>0||0>t.ci?.04*t.ci*this.ft.upem:0}}var
|
|
553
|
+
void 0===e&&(e=Tt.measureTextWidth(this.ft," ",i),this.Is.set(i,e)),t.ci>0?s=t.ci*e*.5:0>t.ci&&(s=t.ci*e*lt)}return s}Os(t,e){return void 0===t.ci||"justify"!==e||t.ni?0:t.ci>0||0>t.ci?.04*t.ci*this.ft.upem:0}}var Jt={exports:{}},Xt=h({__proto__:null,default:{},o(...t){const e="undefined"!=typeof globalThis?globalThis.require:void 0
|
|
554
554
|
if("function"==typeof e)return e("fs").o(...t)
|
|
555
555
|
throw Error("fs not available in this environment")}})
|
|
556
556
|
!(function(t){var e,i=(e="undefined"!=typeof document?document.currentScript?.src:void 0,async function(t={}){function i(){var t=g.buffer
|
|
@@ -572,7 +572,7 @@ constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}
|
|
|
572
572
|
a(1,t)},G=()=>D||P>0,z=t=>{y=t,G()||(n.Ls?.(t),b=!0),a(t,new F(t))},W=(t,e)=>Math.ceil(t/e)*e,R=t=>{var e=(t-g.buffer.byteLength+65535)/65536|0
|
|
573
573
|
try{return g.grow(e),i(),1}catch(t){}},j=t=>{const e=t.length
|
|
574
574
|
return[e%128|128,e>>7,...t]},U={u:127,q:127,it:126,f:125,d:124,e:111},V=t=>j(Array.from(t,t=>U[t])),H=t=>S.get(t),q=[],Y=(t,e)=>S.set(t,e)
|
|
575
|
-
n.Ds&&(D=n.Ds),n.Ps&&(x=n.Ps),n.Ns&&(d=n.Ns),n.$s=g,n.Gs=
|
|
575
|
+
n.Ds&&(D=n.Ds),n.Ps&&(x=n.Ps),n.Ns&&(d=n.Ns),n.$s=g,n.Gs=J,n.zs=(t,e)=>{var i=(t=>(M||(M=new WeakMap,((t,e)=>{if(M)for(var i=0;0+e>i;i++){var s=H(i)
|
|
576
576
|
s&&M.set(s,i)}})(0,S.length)),M.get(t)||0))(t)
|
|
577
577
|
if(i)return i
|
|
578
578
|
var s=q.length?q.pop():S.grow(1)
|
|
@@ -580,64 +580,64 @@ try{Y(s,t)}catch(i){if(!(i instanceof TypeError))throw i
|
|
|
580
580
|
var n=((t,e)=>{var i=Uint8Array.of(0,97,115,109,1,0,0,0,1,...j([1,96,...V(e.slice(1)),...V("v"===e[0]?"":e[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),s=new WebAssembly.Module(i)
|
|
581
581
|
return new WebAssembly.Instance(s,{e:{f:t}}).exports.f})(t,e)
|
|
582
582
|
Y(s,n)}return M.set(t,s),s},n.Ws=t=>{M.delete(H(t)),Y(t,null),q.push(t)}
|
|
583
|
-
var
|
|
583
|
+
var K={Rs(){return s("")},js(){D=!1,P=0},Us(t,e){if(N[t]&&(clearTimeout(N[t].id),delete N[t]),!e)return 0
|
|
584
584
|
var i=setTimeout(()=>{delete N[t],(t=>{if(!b)try{t(),(()=>{if(!G())try{y=t=y,z(t)}catch(t){$(t)}var t})()}catch(t){$(t)}})(()=>_(t,performance.now()))},e)
|
|
585
585
|
return N[t]={id:i,Vs:e},0},Hs(t){var e=m.length,i=2147483648
|
|
586
586
|
if((t>>>=0)>i)return!1
|
|
587
587
|
for(var s=1;4>=s;s*=2){var n=e*(1+.2/s),r=Math.min(i,W(Math.max(t,n=Math.min(n,t+100663296)),65536))
|
|
588
|
-
if(R(r))return!0}return!1},qs:z},
|
|
589
|
-
I=null,t()}})(),
|
|
590
|
-
var e,r={yt:
|
|
588
|
+
if(R(r))return!0}return!1},qs:z},J=await(async()=>{function t(t){return n.Gs=J=t.exports,n.$s=g=J.memory,i(),S=J.Ys,(t=>{n.Ks=t.Js,n.Xs=t.Qs,n.Zs=t.tn,n.en=t.sn,n.nn=t.rn,n.hn=t.an,n.ln=t.cn,n.un=t.fn,n.dn=t.yn,n.pn=t.wn,n.gn=t.mn,n.vn=t.xn,n.bn=t.An,n.En=t.Tn,n.In=t.Fn,n.Sn=t.Mn,n._n=t.On,n.Cn=t.Bn,n.kn=t.Ln,n.Dn=t.Pn,n.Nn=t.$n,n.Gn=t.zn,n.Wn=t.Rn,n.jn=t.Un,n.Vn=t.Hn,n.qn=t.Yn,n.Kn=t.Jn,n.Xn=t.Qn,n.Zn=t.tr,n.er=t.ir,n.sr=t.nr,n.rr=t.hr,n.ar=t.lr,n.cr=t.ur,n.dr=t.yr,n.pr=t.wr,n.gr=t.mr,n.vr=t.br,n.Ar=t.Er,n.Tr=t.Ir,n.Fr=t.Sr,n.Mr=t._r,n.Or=t.Cr,n.Br=t.kr,n.Lr=t.Dr,n.Pr=t.Nr,n.$r=t.Gr,n.zr=t.Wr,n.Rr=t.jr,n.Ur=t.Vr,n.Hr=t.qr,n.Yr=t.Kr,_=t.Jr})(J),(()=>{if(T--,n.Xr?.(T),0==T&&I){var t=I
|
|
589
|
+
I=null,t()}})(),J}T++,n.Xr?.(T)
|
|
590
|
+
var e,r={yt:K,Qr:K}
|
|
591
591
|
return n.Zr?new Promise(e=>{n.Zr(r,i=>{e(t(i))})}):(v??=(e="hb.wasm",n.eo?n.eo(e,u):u+e),t((await(async function(t,e,i){if(!t&&!A(e)&&!h)try{var n=fetch(e,{credentials:"same-origin"})
|
|
592
592
|
return await WebAssembly.instantiateStreaming(n,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)
|
|
593
593
|
return new Uint8Array(e)}catch{}return(t=>{if(t==v&&d)return new Uint8Array(d)
|
|
594
594
|
if(c)return c(t)
|
|
595
595
|
throw"both async and sync fetching of the wasm failed"})(t)})(t)
|
|
596
596
|
return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),s(t)}})(e,i)})(d,v,r)).io))})()
|
|
597
|
-
return(()=>{if(n.so)for("function"==typeof n.so&&(n.so=[n.so]);n.so.length>0;)n.so.shift()()})(),(function t(){function e(){n.no=!0,b||(E=!0,
|
|
597
|
+
return(()=>{if(n.so)for("function"==typeof n.so&&(n.so=[n.so]);n.so.length>0;)n.so.shift()()})(),(function t(){function e(){n.no=!0,b||(E=!0,J.ro(),p?.(n),n.oo?.(),(()=>{if(n.ho)for("function"==typeof n.ho&&(n.ho=[n.ho]);n.ho.length;)B(n.ho.shift())
|
|
598
598
|
O(C)})())}T>0?I=t:((()=>{if(n.ao)for("function"==typeof n.ao&&(n.ao=[n.ao]);n.ao.length;)L(n.ao.shift())
|
|
599
599
|
O(k)})(),T>0?I=t:n.setStatus?(n.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>n.setStatus(""),1),e()},1)):e())})(),E?n:new Promise((t,e)=>{p=t,w=e})})
|
|
600
|
-
t.exports=i,t.exports.default=i})(
|
|
601
|
-
var Qt=o(
|
|
602
|
-
try{Zt.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=n.
|
|
600
|
+
t.exports=i,t.exports.default=i})(Jt)
|
|
601
|
+
var Qt=o(Jt.exports),Zt={exports:{}}
|
|
602
|
+
try{Zt.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=n.Jn(e.length+1)
|
|
603
603
|
for(let s=0;e.length>s;++s){const n=e.charCodeAt(s)
|
|
604
604
|
if(n>127)throw Error("Expected ASCII text")
|
|
605
605
|
t.HEAPU8[i+s]=n}return t.HEAPU8[i+e.length]=0,{lo:i,length:e.length,Qn(){n.Qn(i)}}}function s(t,e,s){var r=0,o=0
|
|
606
|
-
s&&(s=s.split(","),r=n.
|
|
607
|
-
n.Yn(e.lo,-1,r+16*o)&&o++,e.Qn()})),n.
|
|
606
|
+
s&&(s=s.split(","),r=n.Jn(16*s.length),s.forEach(t=>{var e=i(t)
|
|
607
|
+
n.Yn(e.lo,-1,r+16*o)&&o++,e.Qn()})),n.Kr(t.lo,e.lo,r,o),r&&n.Qn(r)}var n=t.Gs,r=new TextDecoder("utf8")
|
|
608
608
|
let o=t.zs,h=t.Ws
|
|
609
|
-
var a=o(t=>{n.Qn(t)},"vi"),l=e("JSON"),c="",u=n.
|
|
610
|
-
return{ns(e){var i=n.
|
|
609
|
+
var a=o(t=>{n.Qn(t)},"vi"),l=e("JSON"),c="",u=n.Jn(256)
|
|
610
|
+
return{ns(e){var i=n.Jn(e.byteLength)
|
|
611
611
|
t.HEAPU8.set(new Uint8Array(e),i)
|
|
612
|
-
var s=n.
|
|
612
|
+
var s=n.Js(i,e.byteLength,2,i,a)
|
|
613
613
|
return{lo:s,destroy(){n.Qs(s)}}},rs(i,s){var r=n.wr(i.lo,s)
|
|
614
614
|
const o=n.Er(r)
|
|
615
615
|
return{lo:r,upem:o,co(i){var s=n.br(r,e(i)),o=n.tn(s)
|
|
616
616
|
if(o){var h=n.sn(s,null)
|
|
617
|
-
return t.HEAPU8.subarray(h,h+o)}},cs(){var e=n.
|
|
617
|
+
return t.HEAPU8.subarray(h,h+o)}},cs(){var e=n.Jn(2048),i=n.Jn(4)
|
|
618
618
|
t.HEAPU32[i/4]=64,n.jr(r,0,i,e)
|
|
619
619
|
var s={}
|
|
620
620
|
return Array.from({length:t.HEAPU32[i/4]}).forEach((i,n)=>{var r
|
|
621
621
|
s[(r=t.HEAPU32[e/4+8*n+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*n+4],default:t.HEAPF32[e/4+8*n+5],max:t.HEAPF32[e/4+8*n+6]}}),n.Qn(i),n.Qn(e),s},uo(){var e=n.Gr()
|
|
622
622
|
n.Ir(r,e)
|
|
623
|
-
var i=(e=>{const i=n.Vr(e),s=n.
|
|
623
|
+
var i=(e=>{const i=n.Vr(e),s=n.Jn(i<<2),r=s>>2,o=t.HEAPU32.subarray(r,r+i)
|
|
624
624
|
return t.HEAPU32.set(o,r),n.qr(e,-1,s,i),o})(e)
|
|
625
625
|
return n.Wr(e),i},destroy(){n.mr(r)}}},hs(i){function s(t){return l||(f=o((t,e,i,s,n)=>{c+=`M${s},${n}`},"viiiffi"),d=o((t,e,i,s,n)=>{c+=`L${s},${n}`},"viiiffi"),y=o((t,e,i,s,n,r,o,h,a)=>{c+=`C${s},${n} ${r},${o} ${h},${a}`},"viiiffffffi"),p=o((t,e,i,s,n,r,o)=>{c+=`Q${s},${n} ${r},${o}`},"viiiffffi"),w=o(()=>{c+="Z"},"viiii"),l=n.ur(),n.tr(l,f,0,0),n.ir(l,d,0,0),n.hr(l,y,0,0),n.nr(l,p,0,0),n.lr(l,w,0,0)),c="",n.Sr(a,t,l,0),c}var a=n.Cr(i.lo),l=null,f=null,d=null,y=null,p=null,w=null
|
|
626
626
|
return{lo:a,fo(e){n._r(a,e,u,256)
|
|
627
627
|
var i=t.HEAPU8.subarray(u,u+256)
|
|
628
628
|
return r.decode(i.slice(0,i.indexOf(0)))},do:s,yo(t){return s(t).replace(/([MLQCZ])/g,"|$1 ").split("|").filter(t=>t.length).map(t=>{var e=t.split(/[ ,]/g)
|
|
629
|
-
return{type:e[0],values:e.slice(1).filter(t=>t.length).map(t=>+t)}})},setScale(t,e){n.Nr(a,t,e)},ls(i){var s=Object.entries(i),r=n.
|
|
629
|
+
return{type:e[0],values:e.slice(1).filter(t=>t.length).map(t=>+t)}})},setScale(t,e){n.Nr(a,t,e)},ls(i){var s=Object.entries(i),r=n.Jn(8*s.length)
|
|
630
630
|
s.forEach((i,s)=>{t.HEAPU32[r/4+2*s+0]=e(i[0]),t.HEAPF32[r/4+2*s+1]=i[1]}),n.kr(a,r,s.length),n.Qn(r)},destroy(){n.Dr(a),l&&(n.yr(l),l=null,h(f),h(d),h(y),h(p),h(w))}}},createBuffer(){var e=n.an()
|
|
631
|
-
return{lo:e,ui(i){const s=(e=>{const i=n.
|
|
631
|
+
return{lo:e,ui(i){const s=(e=>{const i=n.Jn(2*e.length),s=new Uint16Array(t.$s.buffer,i,e.length)
|
|
632
632
|
for(let t=0;s.length>t;++t)s[t]=e.charCodeAt(t)
|
|
633
633
|
return{lo:i,length:s.length,Qn(){n.Qn(i)}}})(i)
|
|
634
634
|
n.Pn(e,s.lo,s.length,0,s.length),s.Qn()},fi(){return n.Bn(e)},Ms(t){n.yn(e,{po:4,wo:5,mo:6,vo:7}[t]||0)},xo(t){var i=0
|
|
635
635
|
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)}),n.xn(e,i)},bo(t){var s=i(t)
|
|
636
636
|
n.mn(e,n.zn(s.lo,-1)),s.Qn()},Ao(t){var s=i(t)
|
|
637
637
|
n.wn(e,n.Rn(s.lo,-1)),s.Qn()},Eo(t){n.An(e,t)},json(){for(var i=n.Tn(e),s=[],r=n.Fn(e,0),o=r/4,h=n.Mn(e,0)/4,a=t.HEAPU32.subarray(o,o+5*i),l=t.HEAP32.subarray(h,h+5*i),c=0;i>c;++c)s.push({g:a[5*c+0],di: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:n.On(r+20*c)})
|
|
638
|
-
return s},destroy(){n.cn(e)}}},shape:s,To(e,i,a,c,u){var f=[],d=0,y=!1,p=1048576,w=n.
|
|
638
|
+
return s},destroy(){n.cn(e)}}},shape:s,To(e,i,a,c,u){var f=[],d=0,y=!1,p=1048576,w=n.Jn(p),g=o((e,i,s)=>{var o=r.decode(t.HEAPU8.subarray(s,t.HEAPU8.indexOf(0,s)))
|
|
639
639
|
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:(n.rn(e,0,n.Tn(e),w,p,0,i,l,4),f.push({tt:o,l:JSON.parse(r.decode(t.HEAPU8.subarray(w,t.HEAPU8.indexOf(0,w)))),glyphs:2==n.fn(e)}),1)},"iiiii")
|
|
640
|
-
return n.$n(i.lo,g,0,0),s(e,i,a),n.Qn(w),h(g),f},version(){var e=n.
|
|
640
|
+
return n.$n(i.lo,g,0,0),s(e,i,a),n.Qn(w),h(g),f},version(){var e=n.Jn(12)
|
|
641
641
|
n.Un(e,e+4,e+8)
|
|
642
642
|
var i={Io:t.HEAPU32[e/4],Fo:t.HEAPU32[(e+4)/4],So:t.HEAPU32[(e+8)/4]}
|
|
643
643
|
return n.Qn(e),i},Mo(){var e=n.Hn()
|
|
@@ -648,59 +648,62 @@ if(se)e.Ns=se
|
|
|
648
648
|
else{if(!ie)throw Error("HarfBuzz WASM path or buffer must be set before initialization.")
|
|
649
649
|
e.Ns=await r(ie)}const i=await Qt(e)
|
|
650
650
|
t({hb:te(i),module:{zs:i.zs,exports:i.Gs,Ws:i.Ws}})}catch(t){e(Error("Failed to initialize HarfBuzz: "+t))}}),ee)}},re=72
|
|
651
|
-
let oe=class t{static{this.Bo=new Map}static{this.ko=null}static{this.Lo=new Map}static{this.Do=
|
|
651
|
+
let oe=class t{static{this.Bo=new Map}static{this.ko=null}static{this.Lo=new Map}static{this.Do=new Map}static{this.Po=new Map}static{this.No=0}static{this.$o=1/0}static{this.Go=0}static zo(t){(t=>{Rt=t})(t)}static Wo(t){const e=Object.keys(t).sort()
|
|
652
652
|
let i=""
|
|
653
653
|
for(let s=0;e.length>s;s++)s>0&&(i+=","),i+=e[s]+":"+t[e[s]]
|
|
654
|
-
return i}constructor(){this.
|
|
654
|
+
return i}constructor(){this.Ro="",t.ko||(t.ko=ne.Co()),this.jo=new Ut(()=>t.ko)}static Uo(e){ne._o(e),t.ko=null}static Vo(e){ne.Oo(e),t.ko=null}static init(){return t.ko||(t.ko=ne.Co()),t.ko}static async create(e){if(!e.font)throw Error("Font is required. Specify options.font as a URL string or ArrayBuffer.")
|
|
655
655
|
t.ko||(t.ko=ne.Co())
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
const
|
|
656
|
+
const{ft:i,Ho:s}=await t.qo(e),n=new t
|
|
657
|
+
n.Yo(i,s)
|
|
658
|
+
const r=await n.Ko(e),o=async i=>{const s={...e}
|
|
659
659
|
for(const t in i){const e=i[t]
|
|
660
|
-
void 0!==e&&(
|
|
661
|
-
|
|
662
|
-
return{...
|
|
663
|
-
|
|
660
|
+
void 0!==e&&(s[t]=e)}if(void 0!==i.font||void 0!==i.lt||void 0!==i.ct){const{ft:e,Ho:i}=await t.qo(s)
|
|
661
|
+
n.Yo(e,i),n.Jo()}return e=s,{...await n.Ko(e),getLoadedFont:()=>n.getLoadedFont(),measureTextWidth:(t,e)=>n.measureTextWidth(t,e),update:o,dispose:()=>n.destroy()}}
|
|
662
|
+
return{...r,getLoadedFont:()=>n.getLoadedFont(),measureTextWidth:(t,e)=>n.measureTextWidth(t,e),update:o,dispose:()=>n.destroy()}}static Xo(e){t.Po.set(e,(t.Po.get(e)??0)+1)}static Qo(e,i){const s=(t.Po.get(e)??0)-1
|
|
663
|
+
s>0?t.Po.set(e,s):(t.Po.delete(e),t.Lo.has(e)||Ut.ws(i))}static async qo(e){let i="string"==typeof e.font?e.font:"buffer-"+t.Zo(e.font)
|
|
664
|
+
e.lt&&(i+="_var_"+t.Wo(e.lt)),e.ct&&(i+="_feat_"+t.Wo(e.ct))
|
|
664
665
|
let s=t.Lo.get(i)
|
|
665
|
-
|
|
666
|
+
if(!s){let n=t.Do.get(i)
|
|
667
|
+
n||(n=t.th(i,e.font,e.lt,e.ct).finally(()=>{t.Do.delete(i)}),t.Do.set(i,n)),s=await n}return t.Xo(i),{ft:s,Ho:i}}static async th(e,i,s,n){const r=new t
|
|
666
668
|
await r.ss(i,s,n)
|
|
667
669
|
const o=r.getLoadedFont()
|
|
668
|
-
return t.Lo.set(e,o),t.
|
|
669
|
-
i&&(t.
|
|
670
|
+
return t.Lo.set(e,o),t.eh(o),t.ih(),o}static eh(e){t.No+=e.ps?.byteLength??0}static sh(e){const i=t.Lo.get(e)
|
|
671
|
+
i&&(t.No-=i.ps?.byteLength??0,0>t.No&&(t.No=0))}static ih(){if(t.$o!==1/0)for(;t.No>t.$o&&t.Lo.size>0;){const e=t.Lo.keys().next().value
|
|
670
672
|
if(void 0===e)break
|
|
671
|
-
t.
|
|
673
|
+
const i=t.Lo.get(e)
|
|
674
|
+
t.sh(e),t.Lo.delete(e),0>=(t.Po.get(e)??0)&&i&&Ut.ws(i)}}static Zo(e){if(e){const t=new Uint8Array(e)
|
|
672
675
|
let i=2166136261
|
|
673
676
|
const s=Math.min(32,t.length),n=Math.floor(t.length/s)
|
|
674
677
|
for(let e=0;s>e;e++)i^=t[e*n],i=Math.imul(i,16777619)
|
|
675
|
-
return i^=t.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++t.
|
|
676
|
-
const
|
|
677
|
-
this.
|
|
678
|
+
return i^=t.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++t.Go}Yo(e,i){this.ft&&this.ft!==e&&this.nh(),this.ft=e,this.rh=i
|
|
679
|
+
const s=t.Zo(e.ps)
|
|
680
|
+
this.Ro="font_"+s,e.lt&&(this.Ro+="_var_"+t.Wo(e.lt)),e.ct&&(this.Ro+="_feat_"+t.Wo(e.ct))}nh(){if(!this.ft)return
|
|
681
|
+
const e=this.ft,i=this.rh
|
|
682
|
+
try{i?t.Qo(i,e):Ut.ws(e)}catch(t){rt.warn("Error destroying HarfBuzz objects:",t)}finally{this.ft=void 0,this.rh=void 0,this.oh=void 0,this.hh=void 0}}async ss(e,i,s){t.ko||(t.ko=ne.Co()),await t.ko
|
|
678
683
|
const n="string"==typeof e?await r(e):e
|
|
679
|
-
try{this.ft&&this.destroy(),this.ft=await this.
|
|
680
|
-
const e=t.
|
|
681
|
-
this.
|
|
682
|
-
const e=await this.
|
|
683
|
-
this.
|
|
684
|
-
const i=this.
|
|
685
|
-
return{
|
|
686
|
-
if(!e.layout?.We?.[i])try{if(!t.Bo.has(i)){const s=await n(i,e.layout?.
|
|
687
|
-
t.Bo.set(i,s)}return{...e,layout:{...e.layout,We:{...e.layout?.We,[i]:t.Bo.get(i)}}}}catch(t){return rt.warn(`Failed to load patterns for ${i}: ${t}`),{...e,layout:{...e.layout,$e:!1}}}}return e}
|
|
688
|
-
const e=t.
|
|
689
|
-
if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}
|
|
690
|
-
const{text:e,size:i=re,depth:s=0,lineHeight:n=1,letterSpacing:r=0,layout:o={}}=t,{width:h,direction:a="ltr",align:l=("rtl"===a?"right":"left"),Ge:c=!0,$e:u=!0,language:f="en-us",je:d=ot,Ue:y=ht,Ve:p=at,He:w,We:g,qe:m,Ye:v,
|
|
684
|
+
try{this.ft&&this.destroy(),this.ft=await this.jo.ss(n,i),s&&(this.ft.ct=s)
|
|
685
|
+
const e=t.Zo(n)
|
|
686
|
+
this.Ro="font_"+e,i&&(this.Ro+="_var_"+t.Wo(i)),s&&(this.Ro+="_feat_"+t.Wo(s))}catch(t){throw rt.error("Failed to load font:",t),t}}async Ko(t){try{if(!this.ft)throw Error("Font not loaded. Use Text.create() with a font option.")
|
|
687
|
+
const e=await this.ah(t)
|
|
688
|
+
this.uh(e),this.fh(t=e),this.ft.font.setScale(this.ft.upem,this.ft.upem),this.hh||(this.hh=new Kt(this.ft))
|
|
689
|
+
const i=this.dh(t)
|
|
690
|
+
return{yh:this.hh.Fs(i.lines,i.ph,i.letterSpacing,i.align,i.direction,t.color,t.text),wh:i,options:t,ft:this.ft,dt:this.Ro}}finally{}}async ah(e){if(!1!==e.layout?.$e&&e.layout?.width){const i=e.layout?.language||"en-us"
|
|
691
|
+
if(!e.layout?.We?.[i])try{if(!t.Bo.has(i)){const s=await n(i,e.layout?.gh)
|
|
692
|
+
t.Bo.set(i,s)}return{...e,layout:{...e.layout,We:{...e.layout?.We,[i]:t.Bo.get(i)}}}}catch(t){return rt.warn(`Failed to load patterns for ${i}: ${t}`),{...e,layout:{...e.layout,$e:!1}}}}return e}uh(t){if(!t.text)throw Error("Text content is required")
|
|
693
|
+
const e=t.mh??1e5
|
|
694
|
+
if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}fh(e){e.lt&&this.ft&&t.Wo(e.lt)!==t.Wo(this.ft.lt||{})&&(this.ft.font.ls(e.lt),this.ft.lt=e.lt)}dh(t){if(!this.ft)throw Error("Font not loaded. Use Text.create() with a font option")
|
|
695
|
+
const{text:e,size:i=re,depth:s=0,lineHeight:n=1,letterSpacing:r=0,layout:o={}}=t,{width:h,direction:a="ltr",align:l=("rtl"===a?"right":"left"),Ge:c=!0,$e:u=!0,language:f="en-us",je:d=ot,Ue:y=ht,Ve:p=at,He:w,We:g,qe:m,Ye:v,Ke:x,Je:b,Xe:A,Qe:E,Ze:T}=o,I=this.ft.upem/i
|
|
691
696
|
let F
|
|
692
697
|
void 0!==h&&(F=h*I)
|
|
693
698
|
const S=s*I,M=S>0?Math.max(S,25e-6*this.ft.upem):0
|
|
694
|
-
this.
|
|
695
|
-
const _=this.
|
|
696
|
-
return{lines:_.lines,
|
|
697
|
-
return Wt.Yi(this.ft.wt)}static async
|
|
698
|
-
t.Bo.set(e,s)}catch(t){rt.warn(`Failed to pre-load patterns for ${e}: ${t}`)}}))}static
|
|
699
|
-
return Tt.measureTextWidth(this.ft,t,e)}
|
|
700
|
-
const t=this.ft
|
|
701
|
-
try{Ut.ws(t)}catch(t){rt.warn("Error destroying HarfBuzz objects:",t)}finally{this.ft=void 0,this.uh=void 0,this.ih=void 0}}}
|
|
699
|
+
this.oh||(this.oh=new It(this.ft))
|
|
700
|
+
const _=this.oh.yi({text:e,width:F,align:l,direction:a,$e:u,language:f,Ge:c,je:d,Ue:y,Ve:p,He:w,We:g,qe:m,Ye:v,Ke:x,Je:b,Xe:A,Qe:E,Ze:T,letterSpacing:r}),O=Wt.qi(this.ft.wt)
|
|
701
|
+
return{lines:_.lines,ph:(O.xi-O.bi)*n,letterSpacing:r,align:l,direction:a,depth:M,size:i,xh:1/I}}Yi(){if(!this.ft)throw Error("Font not loaded. Call loadFont() first")
|
|
702
|
+
return Wt.Yi(this.ft.wt)}static async bh(e,i){await Promise.all(e.map(async e=>{if(!t.Bo.has(e))try{const s=await n(e,i)
|
|
703
|
+
t.Bo.set(e,s)}catch(t){rt.warn(`Failed to pre-load patterns for ${e}: ${t}`)}}))}static Ah(e,i){t.Bo.set(e,i)}static Eh(e){t.$o=e===1/0?1/0:1048576*Math.max(1,Math.floor(e)),t.ih()}getLoadedFont(){return this.ft}measureTextWidth(t,e=0){if(!this.ft)throw Error("Font not loaded. Call loadFont() first")
|
|
704
|
+
return Tt.measureTextWidth(this.ft,t,e)}Jo(){this.hh=void 0,this.oh=void 0}destroy(){this.ft&&this.nh()}}
|
|
702
705
|
class he{constructor(){this.cache=new Map}get(t){return this.cache.get(t)}has(t){return this.cache.has(t)}set(t,e){this.cache.set(t,e)}delete(t){return this.cache.delete(t)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return Array.from(this.cache.keys())}getStats(){return{size:this.cache.size}}}const ae=new he,le=new he,ce=new he,ue=new he
|
|
703
|
-
var fe,de,ye,pe;(t=>{t[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(fe||(fe={})),(t=>{t[t.X=0]="POLYGONS",t[t.J=1]="CONNECTED_POLYGONS",t[t.$=2]="BOUNDARY_CONTOURS"})(de||(de={})),(t=>{t[t.BEGIN=100100]="BEGIN",t[t.EDGE_FLAG=100104]="EDGE_FLAG",t[t.VERTEX=100101]="VERTEX",t[t.END=100102]="END",t[t.ERROR=100103]="ERROR",t[t.COMBINE=100105]="COMBINE",t[t.BEGIN_DATA=100106]="BEGIN_DATA",t[t.EDGE_FLAG_DATA=100110]="EDGE_FLAG_DATA",t[t.VERTEX_DATA=100107]="VERTEX_DATA",t[t.END_DATA=100108]="END_DATA",t[t.ERROR_DATA=100109]="ERROR_DATA",t[t.COMBINE_DATA=100111]="COMBINE_DATA",t[t.WINDING_RULE=100140]="WINDING_RULE",t[t.BOUNDARY_ONLY=100141]="BOUNDARY_ONLY",t[t.TOLERANCE=100142]="TOLERANCE"})(ye||(ye={})),(t=>{t[t.
|
|
706
|
+
var fe,de,ye,pe;(t=>{t[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(fe||(fe={})),(t=>{t[t.X=0]="POLYGONS",t[t.J=1]="CONNECTED_POLYGONS",t[t.$=2]="BOUNDARY_CONTOURS"})(de||(de={})),(t=>{t[t.BEGIN=100100]="BEGIN",t[t.EDGE_FLAG=100104]="EDGE_FLAG",t[t.VERTEX=100101]="VERTEX",t[t.END=100102]="END",t[t.ERROR=100103]="ERROR",t[t.COMBINE=100105]="COMBINE",t[t.BEGIN_DATA=100106]="BEGIN_DATA",t[t.EDGE_FLAG_DATA=100110]="EDGE_FLAG_DATA",t[t.VERTEX_DATA=100107]="VERTEX_DATA",t[t.END_DATA=100108]="END_DATA",t[t.ERROR_DATA=100109]="ERROR_DATA",t[t.COMBINE_DATA=100111]="COMBINE_DATA",t[t.WINDING_RULE=100140]="WINDING_RULE",t[t.BOUNDARY_ONLY=100141]="BOUNDARY_ONLY",t[t.TOLERANCE=100142]="TOLERANCE"})(ye||(ye={})),(t=>{t[t.Th=100151]="MISSING_BEGIN_POLYGON",t[t.Ih=100152]="MISSING_BEGIN_CONTOUR",t[t.Fh=100153]="MISSING_END_POLYGON",t[t.Sh=100154]="MISSING_END_CONTOUR",t[t.Mh=100155]="COORD_TOO_LARGE",t[t._h=100156]="NEED_COMBINE_CALLBACK"})(pe||(pe={}))
|
|
704
707
|
class we{next
|
|
705
708
|
v
|
|
706
709
|
m=null
|
|
@@ -728,82 +731,82 @@ L
|
|
|
728
731
|
q=0}class xe{Y
|
|
729
732
|
it
|
|
730
733
|
Z
|
|
731
|
-
|
|
732
|
-
|
|
734
|
+
Oh
|
|
735
|
+
Ch=0
|
|
733
736
|
constructor(){const t=new me,e=new ve,i=new ge,s=new ge
|
|
734
|
-
t.next=t.v=t,e.next=e.v=e,i.next=i,i.p=s,s.next=s,s.p=i,this.Y=t,this.it=e,this.Z=i,this.
|
|
735
|
-
return i.next=s,s.p.next=e,e.next=t,t.p.next=i,e.p=i,e.C=e,e.O=i,e._=0,e.N=null,i.p=e,i.C=i,i.O=e,i._=0,i.N=null,e}
|
|
736
|
-
i.p.O=e,s.p.O=t,t.C=s,e.C=i}
|
|
737
|
-
s.v=n,n.next=s,s.next=i,i.v=s,s.L=e,++this.
|
|
737
|
+
t.next=t.v=t,e.next=e.v=e,i.next=i,i.p=s,s.next=s,s.p=i,this.Y=t,this.it=e,this.Z=i,this.Oh=s}Bh(t){const e=new ge,i=new ge,s=t.p.next
|
|
738
|
+
return i.next=s,s.p.next=e,e.next=t,t.p.next=i,e.p=i,e.C=e,e.O=i,e._=0,e.N=null,i.p=e,i.C=i,i.O=e,i._=0,i.N=null,e}kh(t,e){const i=t.C,s=e.C
|
|
739
|
+
i.p.O=e,s.p.O=t,t.C=s,e.C=i}Lh(t,e,i){const s=t,n=i.v
|
|
740
|
+
s.v=n,n.next=s,s.next=i,i.v=s,s.L=e,++this.Ch
|
|
738
741
|
let r=e
|
|
739
|
-
do{r.u=s,r=r.C}while(r!==e)}
|
|
742
|
+
do{r.u=s,r=r.C}while(r!==e)}Dh(t,e,i){const s=t,n=i.v
|
|
740
743
|
s.v=n,n.next=s,s.next=i,i.v=s,s.L=e,s.q=i.q
|
|
741
744
|
let r=e
|
|
742
|
-
do{r.D=s,r=r.O}while(r!==e)}
|
|
743
|
-
e.p.next=i,i.p.next=e}
|
|
745
|
+
do{r.D=s,r=r.O}while(r!==e)}Ph(t){const e=t.next,i=t.p.next
|
|
746
|
+
e.p.next=i,i.p.next=e}Nh(t,e){const i=t.L
|
|
744
747
|
let s=i
|
|
745
748
|
do{s.u=e,s=s.C}while(s!==i)
|
|
746
749
|
const n=t.v,r=t.next
|
|
747
|
-
r.v=n,n.next=r,--this.
|
|
750
|
+
r.v=n,n.next=r,--this.Ch}$h(t,e){const i=t.L
|
|
748
751
|
let s=i
|
|
749
752
|
do{s.D=e,s=s.O}while(s!==i)
|
|
750
753
|
const n=t.v,r=t.next
|
|
751
|
-
r.v=n,n.next=r}F(){const t=new me,e=new me,i=new ve,s=this.
|
|
752
|
-
return this.
|
|
753
|
-
if(t!==e){if(e.u!==t.u&&(s=1,this.
|
|
754
|
-
this.
|
|
755
|
-
this.
|
|
754
|
+
r.v=n,n.next=r}F(){const t=new me,e=new me,i=new ve,s=this.Bh(this.Z)
|
|
755
|
+
return this.Lh(t,s,this.Y),this.Lh(e,s.p,this.Y),this.Dh(i,s,this.it),s}splice(t,e){let i=0,s=0
|
|
756
|
+
if(t!==e){if(e.u!==t.u&&(s=1,this.Nh(e.u,t.u)),e.D!==t.D&&(i=1,this.$h(e.D,t.D)),this.kh(e,t),!s){const i=new me
|
|
757
|
+
this.Lh(i,e,t.u),t.u.L=t}if(!i){const i=new ve
|
|
758
|
+
this.Dh(i,e,t.D),t.D.L=t}}}delete(t){const e=t.p
|
|
756
759
|
let i=0
|
|
757
|
-
if(t.D!==t.p.D&&(i=1,this
|
|
758
|
-
else if(t.p.D.L=t.p.O,t.u.L=t.C,this.
|
|
759
|
-
this.
|
|
760
|
-
this.
|
|
760
|
+
if(t.D!==t.p.D&&(i=1,this.$h(t.D,t.p.D)),t.C===t)this.Nh(t.u,null)
|
|
761
|
+
else if(t.p.D.L=t.p.O,t.u.L=t.C,this.kh(t,t.p.O),!i){const e=new ve
|
|
762
|
+
this.Dh(e,t,t.D)}e.C===e?(this.Nh(e.u,null),this.$h(e.D,null)):(t.D.L=e.p.O,e.u.L=e.C,this.kh(e,e.p.O)),this.Ph(t)}Et(t){const e=this.Bh(t),i=e.p
|
|
763
|
+
this.kh(e,t.O),e.u=t.p.u
|
|
761
764
|
const s=new me
|
|
762
|
-
return this.
|
|
763
|
-
return this.
|
|
764
|
-
const s=this.
|
|
765
|
-
if(e.D!==t.D&&(i=1,this
|
|
766
|
-
this.
|
|
765
|
+
return this.Lh(s,i,e.u),e.D=i.D=t.D,e}V(t){const e=this.Et(t).p
|
|
766
|
+
return this.kh(t.p,t.p.p.O),this.kh(t.p,e),t.p.u=e.u,e.p.u.L=e.p,e.p.D=t.p.D,e._=t._,e.p._=t.p._,e}connect(t,e){let i=0
|
|
767
|
+
const s=this.Bh(t),n=s.p
|
|
768
|
+
if(e.D!==t.D&&(i=1,this.$h(e.D,t.D)),this.kh(s,t.O),this.kh(n,e),s.u=t.p.u,n.u=e.u,s.D=n.D=t.D,t.D.L=n,!i){const e=new ve
|
|
769
|
+
this.Dh(e,s,t.D)}return s}Nt(t){const e=t.L
|
|
767
770
|
let i,s,n,r,o
|
|
768
771
|
s=e.O
|
|
769
|
-
do{i=s,s=i.O,i.D=null,i.p.D||(i.C===i?this.
|
|
770
|
-
r=t.v,o=t.next,o.v=r,r.next=o}
|
|
772
|
+
do{i=s,s=i.O,i.D=null,i.p.D||(i.C===i?this.Nh(i.u,null):(i.u.L=i.C,this.kh(i,i.p.O)),n=i.p,n.C===n?this.Nh(n.u,null):(n.u.L=n.C,this.kh(n,n.p.O)),this.Ph(i))}while(i!=e)
|
|
773
|
+
r=t.v,o=t.next,o.v=r,r.next=o}Gh(t){let e=t.L,i=0
|
|
771
774
|
do{i++,e=e.O}while(e!==t.L)
|
|
772
775
|
return i}check(){}}class be{max=0
|
|
773
776
|
At
|
|
774
777
|
It
|
|
775
|
-
|
|
778
|
+
zh
|
|
776
779
|
Ot=0
|
|
777
|
-
|
|
780
|
+
Wh=0
|
|
778
781
|
size=0
|
|
779
|
-
constructor(t){this.max=t,this.At=new Int32Array(t+1),this.It=Array(t+1).fill(null),this.
|
|
782
|
+
constructor(t){this.max=t,this.At=new Int32Array(t+1),this.It=Array(t+1).fill(null),this.zh=new Int32Array(t+1),this.Ot=0,this.At[1]=1,this.It[1]=null}reset(t){if(t+1>this.max)this.max=t,this.At=new Int32Array(t+1),this.It=Array(t+1).fill(null),this.zh=new Int32Array(t+1)
|
|
780
783
|
else{const t=this.It
|
|
781
|
-
for(let e=1;this.size>=e;e++)t[e]=null}this.size=0,this.
|
|
784
|
+
for(let e=1;this.size>=e;e++)t[e]=null}this.size=0,this.Wh=0,this.Ot=0,this.At[1]=1,this.It[1]=null}Rh(t){const e=this.At,i=this.It,s=this.zh
|
|
782
785
|
let n=e[t]
|
|
783
786
|
for(;;){let r=t<<1
|
|
784
787
|
if(r>this.size)break
|
|
785
788
|
let o=r,h=e[r]
|
|
786
789
|
if(this.size>=r+1){const t=e[r+1],s=i[t],n=i[h];(n.s>s.s||s.s===n.s&&n.l>=s.l)&&(o=r+1,h=t)}const a=i[n],l=i[h]
|
|
787
790
|
if(l.s>a.s||a.s===l.s&&l.l>=a.l)break
|
|
788
|
-
e[t]=h,s[h]=t,t=o}e[t]=n,s[n]=t}Tt(t){const e=this.At,i=this.It,s=this.
|
|
791
|
+
e[t]=h,s[h]=t,t=o}e[t]=n,s[n]=t}Tt(t){const e=this.At,i=this.It,s=this.zh
|
|
789
792
|
let n=e[t]
|
|
790
793
|
for(;;){const r=t>>1
|
|
791
794
|
if(0===r)break
|
|
792
795
|
const o=e[r],h=i[o],a=i[n]
|
|
793
796
|
if(a.s>h.s||h.s===a.s&&a.l>=h.l)break
|
|
794
|
-
e[t]=o,s[o]=t,t=r}e[t]=n,s[n]=t}init(){for(let t=this.size>>1;t>=1;--t)this.
|
|
795
|
-
this.Ot=1}
|
|
797
|
+
e[t]=o,s[o]=t,t=r}e[t]=n,s[n]=t}init(){for(let t=this.size>>1;t>=1;--t)this.Rh(t)
|
|
798
|
+
this.Ot=1}jh(){return 0===this.size}min(){return 0===this.size?null:this.It[this.At[1]]}P(t){let e,i
|
|
796
799
|
if(e=++this.size,2*e>this.max){this.max*=2
|
|
797
800
|
const t=new Int32Array(this.max+1),e=new Int32Array(this.max+1),i=Array(this.max+1).fill(null)
|
|
798
|
-
t.set(this.At),e.set(this.
|
|
801
|
+
t.set(this.At),e.set(this.zh)
|
|
799
802
|
for(let t=0;this.It.length>t;t++)i[t]=this.It[t]
|
|
800
|
-
this.At=t,this.
|
|
803
|
+
this.At=t,this.zh=e,this.It=i}return 0===this.Wh?i=e:(i=this.Wh,this.Wh=this.zh[i]),this.At[e]=i,this.zh[i]=e,this.It[i]=t,this.Ot&&this.Tt(e),i}Mt(){const t=this.At,e=this.It,i=this.zh
|
|
801
804
|
let s=t[1],n=e[s]
|
|
802
|
-
return this.size>0&&(t[1]=t[this.size],i[t[1]]=1,e[s]=null,i[s]=this.
|
|
805
|
+
return this.size>0&&(t[1]=t[this.size],i[t[1]]=1,e[s]=null,i[s]=this.Wh,this.Wh=s,--this.size,this.size>0&&this.Rh(1)),n}delete(t){const e=this.At,i=this.It,s=this.zh
|
|
803
806
|
let n
|
|
804
807
|
if(n=s[t],e[n]=e[this.size],s[e[n]]=n,--this.size,this.size>=n)if(n>1){const t=i[e[n>>1]],s=i[e[n]]
|
|
805
|
-
s.s>t.s||t.s===s.s&&s.l>=t.l?this.
|
|
806
|
-
i[t]=null,s[t]=this.
|
|
808
|
+
s.s>t.s||t.s===s.s&&s.l>=t.l?this.Rh(n):this.Tt(n)}else this.Rh(n)
|
|
809
|
+
i[t]=null,s[t]=this.Wh,this.Wh=t}}class Ae{Dt
|
|
807
810
|
keys
|
|
808
811
|
order=null
|
|
809
812
|
size=0
|
|
@@ -823,12 +826,12 @@ const t=this.keys
|
|
|
823
826
|
return this.order.sort((e,i)=>{const s=t[e],n=t[i]
|
|
824
827
|
return n.s>s.s?1:s.s>n.s||s.l>n.l?-1:1}),this.max=this.size,this.Ot=1,this.Dt.init(),1}Mt(){if(this.Lt||0===this.size)return this.Dt.Mt()
|
|
825
828
|
const t=this.keys[this.order[this.size-1]]
|
|
826
|
-
if(!this.Dt.
|
|
829
|
+
if(!this.Dt.jh()){const e=this.Dt.min()
|
|
827
830
|
if(e&&c(e,t))return this.Dt.Mt()}do{--this.size}while(this.size>0&&null===this.keys[this.order[this.size-1]])
|
|
828
831
|
return t}min(){if(this.Lt||0===this.size)return this.Dt.min()
|
|
829
832
|
const t=this.keys[this.order[this.size-1]]
|
|
830
|
-
if(!this.Dt.
|
|
831
|
-
if(e&&c(e,t))return e}return t}delete(t){0>t?this.keys[-(t+1)]=null:this.Dt.delete(t)}
|
|
833
|
+
if(!this.Dt.jh()){const e=this.Dt.min()
|
|
834
|
+
if(e&&c(e,t))return e}return t}delete(t){0>t?this.keys[-(t+1)]=null:this.Dt.delete(t)}jh(){return(this.Lt||0===this.size)&&this.Dt.jh()}}class Ee{head=new we
|
|
832
835
|
frame
|
|
833
836
|
constructor(t){this.frame=t,this.head.next=this.head,this.head.v=this.head}min(){return this.head.next}max(){return this.head.v}P(t){return this.insertBefore(this.head,t)}search(t){let e=this.head
|
|
834
837
|
do{e=e.next}while(null!==e.m&&!x(this.frame,t,e))
|
|
@@ -841,10 +844,10 @@ for(;c(i.p.u,i.u);i=i.C.p);for(;c(i.u,i.p.u);i=i.O);for(s=i.C.p;i.O!==s;)if(c(i.
|
|
|
841
844
|
s=s.C.p}else{for(;s.O!==i&&(d(i.C.p)||w(i.p.u,i.u,i.C.p.u)>=0);)n=t.connect(i,i.C.p),i=n.p
|
|
842
845
|
i=i.O}if(s.O===i)throw Error("Monotone region has insufficient vertices")
|
|
843
846
|
for(;s.O.O!==i;)n=t.connect(s.O,s),s=n.p
|
|
844
|
-
return 1}static
|
|
847
|
+
return 1}static Uh(t){let e
|
|
845
848
|
for(let i=t.it.next;i!==t.it;i=e)e=i.next,i.q&&_e.Gt(t,i)
|
|
846
849
|
return 1}}let Oe=[],Ce=new Int8Array(64),Be=new Int32Array(64),ke=new Int32Array(64)
|
|
847
|
-
var Le;(t=>{t[t.Rt=0]="T_DORMANT",t[t
|
|
850
|
+
var Le;(t=>{t[t.Rt=0]="T_DORMANT",t[t.Vh=1]="T_IN_POLYGON",t[t.Hh=2]="T_IN_CONTOUR"})(Le||(Le={}))
|
|
848
851
|
class De{state=Le.Rt
|
|
849
852
|
Ut=null
|
|
850
853
|
St=0
|
|
@@ -853,11 +856,11 @@ Vt=1
|
|
|
853
856
|
Pt=0
|
|
854
857
|
Ft=0
|
|
855
858
|
Yt=0
|
|
856
|
-
|
|
859
|
+
qh=0
|
|
857
860
|
A
|
|
858
861
|
Ht=[0,0,0]
|
|
859
|
-
|
|
860
|
-
|
|
862
|
+
Yh
|
|
863
|
+
Kh
|
|
861
864
|
Wt
|
|
862
865
|
Zt
|
|
863
866
|
M=fe.ODD
|
|
@@ -869,45 +872,45 @@ Xt
|
|
|
869
872
|
Qt
|
|
870
873
|
Jt
|
|
871
874
|
$t
|
|
872
|
-
|
|
873
|
-
|
|
875
|
+
Jh
|
|
876
|
+
Xh
|
|
874
877
|
R
|
|
875
|
-
|
|
878
|
+
Qh
|
|
876
879
|
tt=null
|
|
877
880
|
U=0
|
|
878
|
-
|
|
881
|
+
Zh(t,e){const i=e||null
|
|
879
882
|
switch(t){case 100100:case 100106:this.Xt=i
|
|
880
883
|
break
|
|
881
|
-
case 100104:case 100110:this.$t=i,this.
|
|
884
|
+
case 100104:case 100110:this.$t=i,this.ta=1
|
|
882
885
|
break
|
|
883
886
|
case 100101:case 100107:this.Qt=i
|
|
884
887
|
break
|
|
885
888
|
case 100102:case 100108:this.Jt=i
|
|
886
889
|
break
|
|
887
|
-
case 100103:this.
|
|
890
|
+
case 100103:this.Jh=i
|
|
888
891
|
break
|
|
889
|
-
case 100109:this.
|
|
892
|
+
case 100109:this.Xh=i
|
|
890
893
|
break
|
|
891
894
|
case 100105:case 100111:this.R=i
|
|
892
895
|
break
|
|
893
|
-
case 100112:this.
|
|
896
|
+
case 100112:this.Qh=i
|
|
894
897
|
break
|
|
895
|
-
default:throw Error("GLU_INVALID_ENUM")}}
|
|
898
|
+
default:throw Error("GLU_INVALID_ENUM")}}ea(t,e){switch(t){case 100140:{const t=e,i=100130>t?t:t-100130
|
|
896
899
|
if(0>i||i>4)throw Error("GLU_INVALID_VALUE")
|
|
897
900
|
this.Kt=t,this.M=i
|
|
898
|
-
break}case 100141:this.
|
|
901
|
+
break}case 100141:this.ia=!!e
|
|
899
902
|
break
|
|
900
903
|
case 100142:break
|
|
901
|
-
default:throw Error("GLU_INVALID_ENUM")}}
|
|
902
|
-
case 100141:return this.
|
|
904
|
+
default:throw Error("GLU_INVALID_ENUM")}}sa(t){switch(t){case 100140:return this.Kt
|
|
905
|
+
case 100141:return this.ia
|
|
903
906
|
case 100142:return 0
|
|
904
|
-
default:throw Error("GLU_INVALID_ENUM")}}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
+
default:throw Error("GLU_INVALID_ENUM")}}na(t,e,i){this.Ht[0]=t,this.Ht[1]=e,this.Ht[2]=i,0===i||t||e||(this.Vt=i>0?1:-1)}H(t){this.Xt&&this.Xt(t,this.tt)}W(t){this.Qt&&this.Qt(t,this.tt)}st(){this.Jt&&this.Jt(this.tt)}K(t){this.$t&&this.$t(t,this.tt)}et(t){this.Xh?this.Xh(t,this.tt):this.Jh&&this.Jh(t)}ra(t){if(this.state!==t)for(;this.state!==t;)t>this.state?this.state===Le.Rt?(this.et(100151),this.oa()):this.state===Le.Vh&&(this.et(100152),this.ha()):this.state===Le.Hh?(this.et(100154),this.aa()):this.state===Le.Vh&&(this.et(100153),this.la())}ia=0
|
|
908
|
+
ta=0
|
|
909
|
+
ca(){const t=this.A,e=t.Y,i=this.Ht[0],s=this.Ht[1],n=this.Ht[2]
|
|
907
910
|
let r,o
|
|
908
|
-
if(this.
|
|
911
|
+
if(this.Yh||(this.Yh=[0,0,0]),this.Kh||(this.Kh=[0,0,0]),this.Wt||(this.Wt=[0,0]),this.Zt||(this.Zt=[0,0]),r=this.Yh,o=this.Kh,this.Bt){r[0]=1,r[1]=0,r[2]=0
|
|
909
912
|
const t=n>0?1:-1
|
|
910
|
-
return o[0]=0,o[1]=t,o[2]=0,this.Wt[0]=this.Pt,this.Wt[1]=this.Yt,this.Zt[0]=this.Ft,void(this.Zt[1]=this.
|
|
913
|
+
return o[0]=0,o[1]=t,o[2]=0,this.Wt[0]=this.Pt,this.Wt[1]=this.Yt,this.Zt[0]=this.Ft,void(this.Zt[1]=this.qh)}if(!this.St&&!i&&!s){let i
|
|
911
914
|
r[0]=1,r[1]=0,r[2]=0
|
|
912
915
|
let s=0
|
|
913
916
|
if(n)i=n>0?1:-1
|
|
@@ -917,7 +920,7 @@ let h=e.next,a=h.coords[0],l=h.coords[1]*i
|
|
|
917
920
|
h.s=a,h.l=l
|
|
918
921
|
let c=a,u=a,f=l,d=l
|
|
919
922
|
for(h=h.next;h!==e;h=h.next)a=h.coords[0],l=h.coords[1]*i,h.s=a,h.l=l,c>a?c=a:a>u&&(u=a),f>l?f=l:l>d&&(d=l)
|
|
920
|
-
return this.Wt[0]=c,this.Zt[0]=u,void(s?(U(t,this.
|
|
923
|
+
return this.Wt[0]=c,this.Zt[0]=u,void(s?(U(t,this.Kh),o[1]!==i?(this.Wt[1]=-d,this.Zt[1]=-f):(this.Wt[1]=f,this.Zt[1]=d)):(this.Wt[1]=f,this.Zt[1]=d))}let h=0
|
|
921
924
|
const a=[i,s,n]
|
|
922
925
|
i||s||n||(j(t,a),h=1)
|
|
923
926
|
const l=(t=>{let e=0
|
|
@@ -927,16 +930,16 @@ let c=e.next
|
|
|
927
930
|
c.s=c.coords[0]*r[0]+c.coords[1]*r[1]+c.coords[2]*r[2],c.l=c.coords[0]*o[0]+c.coords[1]*o[1]+c.coords[2]*o[2]
|
|
928
931
|
let u=c.s,f=c.s,d=c.l,y=c.l
|
|
929
932
|
for(c=c.next;c!==e;c=c.next){const t=c.coords[0]*r[0]+c.coords[1]*r[1]+c.coords[2]*r[2],e=c.coords[0]*o[0]+c.coords[1]*o[1]+c.coords[2]*o[2]
|
|
930
|
-
c.s=t,c.l=e,u>t?u=t:t>f&&(f=t),d>e?d=e:e>y&&(y=e)}h&&U(t,this.
|
|
933
|
+
c.s=t,c.l=e,u>t?u=t:t>f&&(f=t),d>e?d=e:e>y&&(y=e)}h&&U(t,this.Kh),h&&o[(l+2)%3]!==(a[l]>0?1:-1)?(this.Wt[0]=u,this.Zt[0]=f,this.Wt[1]=-y,this.Zt[1]=-d):(this.Wt[0]=u,this.Zt[0]=f,this.Wt[1]=d,this.Zt[1]=y)}oa(t){this.ra(Le.Rt),this.state=Le.Vh,this.U=0,this.A=new xe,this.St=0,this.Bt=0!==this.Ht[2]&&!this.Ht[0]&&!this.Ht[1],this.Pt=1/0,this.Ft=-1/0,this.Yt=1/0,this.qh=-1/0,this.tt=t}ha(){this.ra(Le.Vh),this.state=Le.Hh,this.Ut=null}ua(t,e){this.ra(Le.Hh)
|
|
931
934
|
let i=t[0],s=t[1],n=t.length>2?t[2]:0,r=0;-1e150>i?(i=-1e150,r=1):i>1e150&&(i=1e150,r=1),-1e150>s?(s=-1e150,r=1):s>1e150&&(s=1e150,r=1),-1e150>n?(n=-1e150,r=1):n>1e150&&(n=1e150,r=1),r&&this.et(100155)
|
|
932
935
|
let o=this.Ut
|
|
933
936
|
if(null===o?(o=this.A.F(),this.A.splice(o,o.p)):(this.A.V(o),o=o.O),o.u.data=e||null,o.u.coords[0]=i,o.u.coords[1]=s,0!==n?(o.u.coords[2]=n,this.St=1,this.Bt=0):o.u.coords[2]=0,this.Bt){o.u.s=i
|
|
934
937
|
const t=s*this.Vt
|
|
935
|
-
o.u.l=t,this.Pt>i&&(this.Pt=i),i>this.Ft&&(this.Ft=i),this.Yt>t&&(this.Yt=t),t>this.
|
|
938
|
+
o.u.l=t,this.Pt>i&&(this.Pt=i),i>this.Ft&&(this.Ft=i),this.Yt>t&&(this.Yt=t),t>this.qh&&(this.qh=t)}o._=1,o.p._=-1,this.Ut=o}aa(){this.ra(Le.Hh),this.state=Le.Vh}la(){this.ra(Le.Vh),this.state=Le.Rt,this.compute(this.M,void 0,0)
|
|
936
939
|
const t=this.A
|
|
937
|
-
this.U||(this.
|
|
940
|
+
this.U||(this.ia?(Y(t,1),J(this,t)):this.ta?(_e.Uh(t),K(this,t)):V(this,t)),this.Qh&&this.Qh(t),this.A=null,this.Ut=null,this.event=null,this.tt=null,this.k=null}fa(){this.ra(Le.Rt)}compute(t=fe.ODD,e,i=0){this.state!==Le.Rt&&this.state===Le.Vh&&(this.state=Le.Rt),this.A||(this.A=new xe),e&&(this.Ht[0]=e[0],this.Ht[1]=e[1],this.Ht[2]=e[2]),this.M=t,this.ca(),((t,e=1)=>{let i,s
|
|
938
941
|
if((t=>{let e,i,s,n=t.A.Z
|
|
939
|
-
for(e=n.next;e!==n;e=i)i=e.next,s=e.O,l(e.u,e.p.u)&&e.O.O!==e&&(L(t,s,e),t.A.delete(e),e=s,s=e.O),s.O===e&&(s!==e&&(s!==i&&s!==i.p||(i=i.next),t.A.delete(s)),e!==i&&e!==i.p||(i=i.next),t.A.delete(e))})(t),!(t=>{let e,i,s,n=t.A.
|
|
942
|
+
for(e=n.next;e!==n;e=i)i=e.next,s=e.O,l(e.u,e.p.u)&&e.O.O!==e&&(L(t,s,e),t.A.delete(e),e=s,s=e.O),s.O===e&&(s!==e&&(s!==i&&s!==i.p||(i=i.next),t.A.delete(s)),e!==i&&e!==i.p||(i=i.next),t.A.delete(e))})(t),!(t=>{let e,i,s,n=t.A.Ch+8
|
|
940
943
|
for(t.S?(t.S.reset(n),e=t.S):e=t.S=new Ae(n),s=t.A.Y,i=s.next;i!==s;i=i.next)i.B=e.P(i)
|
|
941
944
|
return i!==s?0:(e.init(),1)})(t))return 0
|
|
942
945
|
for((t=>{t.k=new Ee(t)
|
|
@@ -944,60 +947,60 @@ let e=t.Zt[0]-t.Wt[0],i=t.Zt[1]-t.Wt[1],s=t.Wt[0]-e,n=t.Zt[0]+e,r=t.Zt[1]+i
|
|
|
944
947
|
R(t,s,n,t.Wt[1]-i),R(t,s,n,r)})(t);null!==(i=t.S.Mt());){for(;s=t.S.min(),null!==s&&l(s,i);)s=t.S.Mt(),L(t,i.L,s.L)
|
|
945
948
|
W(t,i)}t.event=t.k.min().m.u,(t=>{let e
|
|
946
949
|
for(;null!==(e=t.k.min()).m;)T(t,e)})(t),((t,e)=>{let i,s,n
|
|
947
|
-
for(i=e.it.next;i!==e.it;i=s)s=i.next,n=i.L,n.O.O===n&&(E(n.C,n),t.A.delete(n))})(t,t.A),e&&t.A.check()})(this,i)}
|
|
950
|
+
for(i=e.it.next;i!==e.it;i=s)s=i.next,n=i.L,n.O.O===n&&(E(n.C,n),t.A.delete(n))})(t,t.A),e&&t.A.check()})(this,i)}da(){this.A&&(Y(this.A,1),J(this,this.A))}ya(t=0){this.A&&(t?(_e.Uh(this.A),K(this,this.A)):V(this,this.A))}}class Pe{process(t,e=!0,i=!1,s=!0){if(0===t.length)return{pa:{vertices:[],indices:[]},wa:[]}
|
|
948
951
|
const n=t.filter(t=>t.points.length>=3)
|
|
949
|
-
return 0===n.length?{
|
|
952
|
+
return 0===n.length?{pa:{vertices:[],indices:[]},wa:[]}:this.ga(n,e,i,s)}ma(t,e=!0,i=!1,s=!0){return 0===t.length?{pa:{vertices:[],indices:[]},wa:[]}:this.va(t,e,i,s)}ga(t,e,i,s){const n=!i&&!e
|
|
950
953
|
let r,o
|
|
951
|
-
n?(o=this.
|
|
952
|
-
let h=s?n?o:r??this.
|
|
953
|
-
if(e){const t=this.
|
|
954
|
-
if(!t)return rt.warn("libtess returned empty result from boundary pass"),{
|
|
955
|
-
o=this.
|
|
956
|
-
return a?{
|
|
954
|
+
n?(o=this.xa(t,!0),(e||s)&&(r=this.xa(t))):(r=this.xa(t),o=r)
|
|
955
|
+
let h=s?n?o:r??this.xa(t):[]
|
|
956
|
+
if(e){const t=this.ba(r,"boundary")
|
|
957
|
+
if(!t)return rt.warn("libtess returned empty result from boundary pass"),{pa:{vertices:[],indices:[]},wa:[]}
|
|
958
|
+
o=this.Aa(t),s&&(h=o)}const a=this.ba(o,"triangles")
|
|
959
|
+
return a?{pa:{vertices:a.vertices,indices:a.indices||[]},wa:h,Ea:e}:(rt.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{pa:{vertices:[],indices:[]},wa:h})}va(t,e,i,s){const n=!i&&!e
|
|
957
960
|
let r,o
|
|
958
|
-
n?(o=this.
|
|
961
|
+
n?(o=this.Ta(t),(e||s)&&(r=t)):(r=t,o=t)
|
|
959
962
|
let h=s?n?o:r??t:[]
|
|
960
|
-
if(e){const t=this.
|
|
961
|
-
if(!t)return rt.warn("libtess returned empty result from boundary pass"),{
|
|
962
|
-
o=this.
|
|
963
|
-
return a?{
|
|
963
|
+
if(e){const t=this.ba(r,"boundary")
|
|
964
|
+
if(!t)return rt.warn("libtess returned empty result from boundary pass"),{pa:{vertices:[],indices:[]},wa:[]}
|
|
965
|
+
o=this.Aa(t),s&&(h=o)}const a=this.ba(o,"triangles")
|
|
966
|
+
return a?{pa:{vertices:a.vertices,indices:a.indices||[]},wa:h,Ea:e}:(rt.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{pa:{vertices:[],indices:[]},wa:h})}xa(t,e=!1){const i=Array(t.length)
|
|
964
967
|
for(let s=0;t.length>s;s++){const n=t[s].points,r=n.length,o=r>1&&n[0].x===n[r-1].x&&n[0].y===n[r-1].y?r-1:r,h=Array(2*(o+1))
|
|
965
968
|
let a=0
|
|
966
969
|
if(e)for(let t=o-1;t>=0;t--){const e=n[t]
|
|
967
970
|
h[a++]=e.x,h[a++]=e.y}else for(let t=0;o>t;t++){const e=n[t]
|
|
968
|
-
h[a++]=e.x,h[a++]=e.y}2>a||(h[a++]=h[0],h[a++]=h[1]),i[s]=h}return i}
|
|
969
|
-
for(let i=0;t.length>i;i++)e[i]=this.
|
|
970
|
-
return e}
|
|
971
|
+
h[a++]=e.x,h[a++]=e.y}2>a||(h[a++]=h[0],h[a++]=h[1]),i[s]=h}return i}Ta(t){const e=Array(t.length)
|
|
972
|
+
for(let i=0;t.length>i;i++)e[i]=this.Ia(t[i])
|
|
973
|
+
return e}Ia(t){const e=t.length
|
|
971
974
|
if(0===e)return[]
|
|
972
975
|
const i=4>e||t[0]!==t[e-2]||t[1]!==t[e-1]?e:e-2
|
|
973
976
|
if(0===i)return[]
|
|
974
977
|
const s=Array(i+2)
|
|
975
978
|
let n=0
|
|
976
979
|
for(let e=i-2;e>=0;e-=2)s[n++]=t[e],s[n++]=t[e+1]
|
|
977
|
-
return 2>n||(s[n++]=s[0],s[n++]=s[1]),s}
|
|
978
|
-
i.
|
|
980
|
+
return 2>n||(s[n++]=s[0],s[n++]=s[1]),s}ba(t,e){const i=new De
|
|
981
|
+
i.ea(ye.WINDING_RULE,fe.NONZERO)
|
|
979
982
|
const s=[],n=[],r=[]
|
|
980
983
|
let o=[]
|
|
981
|
-
"boundary"===e&&i.
|
|
982
|
-
return s.push(t[0],t[1]),e}),i.
|
|
983
|
-
for(const e of t){i.
|
|
984
|
+
"boundary"===e&&i.ea(ye.BOUNDARY_ONLY,1),"triangles"===e?i.Zh(ye.VERTEX_DATA,t=>{n.push(t)}):(i.Zh(ye.BEGIN,()=>{o=[]}),i.Zh(ye.VERTEX_DATA,t=>{o.push(t)}),i.Zh(ye.END,()=>{o.length>0&&r.push(o)})),i.Zh(ye.COMBINE,t=>{const e=s.length/2
|
|
985
|
+
return s.push(t[0],t[1]),e}),i.Zh(ye.ERROR,t=>{rt.warn("libtess error: "+t)}),i.na(0,0,1),i.oa()
|
|
986
|
+
for(const e of t){i.ha()
|
|
984
987
|
for(let t=0;e.length>t;t+=2){const n=s.length/2
|
|
985
|
-
s.push(e[t],e[t+1]),i.
|
|
988
|
+
s.push(e[t],e[t+1]),i.ua([e[t],e[t+1]],n)}i.aa()}return i.la(),0===s.length?null:"triangles"===e?{vertices:s,indices:n}:{vertices:s,Fa:r}}Aa(t){if(!t.Fa)return[]
|
|
986
989
|
const e=[]
|
|
987
|
-
for(const i of t.
|
|
990
|
+
for(const i of t.Fa){const s=[]
|
|
988
991
|
for(const e of i){const i=2*e
|
|
989
|
-
s.push(t.vertices[i],t.vertices[i+1])}s.length>2&&(s[0]===s[s.length-2]&&s[1]===s[s.length-1]||s.push(s[0],s[1])),e.push(s)}return e}
|
|
992
|
+
s.push(t.vertices[i],t.vertices[i+1])}s.length>2&&(s[0]===s[s.length-2]&&s[1]===s[s.length-1]||s.push(s[0],s[1])),e.push(s)}return e}Sa(t){if(0===t.length)return!1
|
|
990
993
|
if(1===t.length)return!1
|
|
991
994
|
let e=null
|
|
992
|
-
for(const i of t){const t=0>this.
|
|
995
|
+
for(const i of t){const t=0>this.Ma(i)?-1:1
|
|
993
996
|
if(null===e)e=t
|
|
994
|
-
else if(t!==e)return!0}return!1}
|
|
997
|
+
else if(t!==e)return!0}return!1}Ma(t){let e=0
|
|
995
998
|
const i=t.length
|
|
996
999
|
if(6>i)return 0
|
|
997
1000
|
for(let s=0;i>s;s+=2)e+=t[s]*t[(s+3)%i]-t[(s+2)%i]*t[s+1]
|
|
998
|
-
return e/2}}class Ne{constructor(){}
|
|
1001
|
+
return e/2}}class Ne{constructor(){}_a(t,e=0,i){const s=t.pa.vertices,n=t.pa.indices,r=t.wa,o=s.length,h=o/2
|
|
999
1002
|
let a=[],l=0,c=!1
|
|
1000
|
-
if(0!==e)if(!0===t.
|
|
1003
|
+
if(0!==e)if(!0===t.Ea&&r.length>0){c=!0
|
|
1001
1004
|
for(const t of r){const e=t.length>>1
|
|
1002
1005
|
2>e||(l+=e-1)}}else{const t=new Map,e=n.length
|
|
1003
1006
|
for(let i=0;e>i;i+=3){const e=n[i],s=n[i+1],r=n[i+2]
|
|
@@ -1029,22 +1032,22 @@ if(p>1e-10){const t=1/Math.sqrt(p)
|
|
|
1029
1032
|
g=u*t,m=-c*t}const b=3*v
|
|
1030
1033
|
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]=m,d[b+2]=0,d[b+3]=g,d[b+4]=m,d[b+5]=0,d[b+6]=g,d[b+7]=m,d[b+8]=0,d[b+9]=g,d[b+10]=m,d[b+11]=0
|
|
1031
1034
|
const A=v
|
|
1032
|
-
y[x]=A,y[x+1]=A+1,y[x+2]=A+2,y[x+3]=A+1,y[x+4]=A+3,y[x+5]=A+2,x+=6,v+=4}return{vertices:f,normals:d,indices:y}}}class $e{constructor(){}
|
|
1033
|
-
return 0===i?[]:1===i?[[0]]:this.
|
|
1035
|
+
y[x]=A,y[x+1]=A+1,y[x+2]=A+2,y[x+3]=A+1,y[x+4]=A+3,y[x+5]=A+2,x+=6,v+=4}return{vertices:f,normals:d,indices:y}}}class $e{constructor(){}Oa(t,e){const i=t.length
|
|
1036
|
+
return 0===i?[]:1===i?[[0]]:this.Ca(t,e)}Ca(t,e){function i(t){return a[t]===t?t:a[t]=i(a[t])}function s(t,e){const s=i(t),n=i(e)
|
|
1034
1037
|
s!==n&&(l[n]>l[s]?a[s]=n:l[s]>l[n]?a[n]=s:(a[n]=s,l[s]++))}const n=t.length,r=Array(n),o=Array(2*n)
|
|
1035
1038
|
let h=0
|
|
1036
|
-
for(let i=0;n>i;i++)r[i]=this.
|
|
1039
|
+
for(let i=0;n>i;i++)r[i]=this.Ba(t[i],e[i]),o[h++]=[r[i].ka,0,i],o[h++]=[r[i].La,1,i]
|
|
1037
1040
|
o.sort((t,e)=>t[0]-e[0]||t[1]-e[1])
|
|
1038
1041
|
const a=Array.from({length:n},(t,e)=>e),l=Array(n).fill(0),c=new Set
|
|
1039
1042
|
for(const[,t,e]of o)if(0===t){const t=r[e]
|
|
1040
1043
|
for(const i of c){const n=r[i]
|
|
1041
|
-
n.
|
|
1044
|
+
n.Da+.001>t.Pa&&t.Da>n.Pa-.001&&s(e,i)}c.add(e)}else c.delete(e)
|
|
1042
1045
|
const u=new Map
|
|
1043
1046
|
for(let t=0;n>t;t++){const e=i(t)
|
|
1044
1047
|
let s=u.get(e)
|
|
1045
|
-
s||(s=[],u.set(e,s)),s.push(t)}return Array.from(u.values())}
|
|
1048
|
+
s||(s=[],u.set(e,s)),s.push(t)}return Array.from(u.values())}Ba(t,e){return{ka:t.bounds.min.x+e.x,Pa:t.bounds.min.y+e.y,La:t.bounds.max.x+e.x,Da:t.bounds.max.y+e.y}}}const Ge={enabled:!0,areaThreshold:1}
|
|
1046
1049
|
let ze=1024,We=new Float64Array(ze),Re=new Float64Array(ze),je=new Float64Array(ze),Ue=new Int32Array(ze),Ve=new Int32Array(ze),He=new Int32Array(ze),qe=new Int32Array(ze)
|
|
1047
|
-
class Ye{constructor(t){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0},this.config=t}
|
|
1050
|
+
class Ye{constructor(t){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0},this.config=t}Na(t){this.config=t}$a(t){const e=t.points,i=e.length
|
|
1048
1051
|
if(5>i||!this.config.enabled)return this.config.enabled&&(this.stats.originalPointCount+=i),t
|
|
1049
1052
|
this.stats.originalPointCount+=i
|
|
1050
1053
|
const s=((t,e,i)=>{if(3>=e)return 0;(t=>{if(t>ze){for(ze=1;t>ze;)ze<<=1
|
|
@@ -1077,185 +1080,185 @@ this.stats.pointsRemovedByVisvalingam+=s
|
|
|
1077
1080
|
const n=Array(i-s)
|
|
1078
1081
|
let r=0,o=0
|
|
1079
1082
|
for(;r>=0;)n[o++]=e[r],r=Ve[r]
|
|
1080
|
-
return{...t,points:n}}getStats(){return{...this.stats}}
|
|
1083
|
+
return{...t,points:n}}getStats(){return{...this.stats}}Ga(){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0}}}const Ke={distanceTolerance:.5,angleTolerance:.2,za:0,Wa:1e-6,Ra:16},Je=1e-6
|
|
1081
1084
|
let Xe,Qe=0,Ze=0,ti=0,ei=0,ii=0,si=0,ni=0
|
|
1082
|
-
class ri{constructor(t){this.curveSteps=null,this.
|
|
1083
|
-
this.
|
|
1085
|
+
class ri{constructor(t){this.curveSteps=null,this.ja=0,this.Ua=0,this.Va=0,this.Ha=0,this.qa=0,this.Ya=0,this.Ka=0,this.Ja={...Ke,...t},this.Xa()}Qa(t){this.Ja={...Ke,...t},this.Xa()}Xa(){const t=this.Ja,e=t.distanceTolerance??.5
|
|
1086
|
+
this.ja=e*e,this.Ua=t.angleTolerance??.2,this.Va=this.Ua>0?Math.tan(this.Ua)**2:0,this.Ha=t.za??0,this.qa=this.Ha>0?Math.tan(this.Ha)**2:0,this.Ya=t.Wa??1e-6,this.Ka=t.Ra??16}Za(){Qe=this.ja,ei=this.Ua,ii=this.Va,si=this.Ha,ni=this.qa,Ze=this.Ya,ti=this.Ka,Xe=[]}tl(t){if(null==t)return void(this.curveSteps=null)
|
|
1084
1087
|
if(!Number.isFinite(t))return void(this.curveSteps=null)
|
|
1085
1088
|
const e=Math.round(t)
|
|
1086
|
-
this.curveSteps=1>e?null:e}
|
|
1087
|
-
it(t,e,a,l,y,p,m,v,1),it(m,v,w,g,f,d,o,h,1)})(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y),tt(s.x,s.y),Xe)}
|
|
1089
|
+
this.curveSteps=1>e?null:e}el(t,e,i){return null!==this.curveSteps?this.il(t,e,i,this.curveSteps):(this.Za(),et(t.x,t.y,e.x,e.y,i.x,i.y,0),tt(i.x,i.y),Xe)}sl(t,e,i,s){return null!==this.curveSteps?this.nl(t,e,i,s,this.curveSteps):(this.Za(),((t,e,i,s,n,r,o,h)=>{const a=.5*(t+i),l=.5*(e+s),c=.5*(i+n),u=.5*(s+r),f=.5*(n+o),d=.5*(r+h),y=.5*(a+c),p=.5*(l+u),w=.5*(c+f),g=.5*(u+d),m=.5*(y+w),v=.5*(p+g)
|
|
1090
|
+
it(t,e,a,l,y,p,m,v,1),it(m,v,w,g,f,d,o,h,1)})(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y),tt(s.x,s.y),Xe)}il(t,e,i,s){this.Za()
|
|
1088
1091
|
for(let n=1;s>=n;n++){const r=n/s,o=t.x+(e.x-t.x)*r,h=t.y+(e.y-t.y)*r
|
|
1089
|
-
tt(o+(e.x+(i.x-e.x)*r-o)*r,h+(e.y+(i.y-e.y)*r-h)*r)}return Xe}
|
|
1092
|
+
tt(o+(e.x+(i.x-e.x)*r-o)*r,h+(e.y+(i.y-e.y)*r-h)*r)}return Xe}nl(t,e,i,s,n){this.Za()
|
|
1090
1093
|
for(let r=1;n>=r;r++){const o=r/n,h=t.x+(e.x-t.x)*o,a=t.y+(e.y-t.y)*o,l=e.x+(i.x-e.x)*o,c=e.y+(i.y-e.y)*o,u=h+(l-h)*o,f=a+(c-a)*o
|
|
1091
|
-
tt(u+(l+(i.x+(s.x-i.x)*o-l)*o-u)*o,f+(c+(i.y+(s.y-i.y)*o-c)*o-f)*o)}return Xe}}class oi{constructor(t,e){this.
|
|
1094
|
+
tt(u+(l+(i.x+(s.x-i.x)*o-l)*o-u)*o,f+(c+(i.y+(s.y-i.y)*o-c)*o-f)*o)}return Xe}}class oi{constructor(t,e){this.rl=0,this.ol=0,this.hl=[],this.al=null,this.ll=null,this.cl={min:new qt(1/0,1/0),max:new qt(-1/0,-1/0)},this.ul=[],this.fl=[],this.dl=[],this.yl=new qt(0,0),this.pl=new ri(t),this.wl=new Ye({...Ge,...e})}setPosition(t,e){this.yl.set(t,e)}gl(t,e){this.yl.x+=t,this.yl.y+=e}ml(t,e){this.hl.length>0&&this.vl(),this.rl=t,this.ol=e,this.hl=[],this.cl.min.set(1/0,1/0),this.cl.max.set(-1/0,-1/0),this.fl.push(this.yl.clone())}vl(){this.al&&this.xl(),this.hl.length>0&&(this.ul.push({bl:this.rl,Al:this.hl,bounds:{min:{x:this.cl.min.x,y:this.cl.min.y},max:{x:this.cl.max.x,y:this.cl.max.y}}}),this.dl.push(this.ol)),this.hl=[]}El(t,e){this.al&&this.xl(),this.ll=new qt(t,e),this.Tl(this.ll),this.al={points:[this.ll],glyphIndex:this.rl}}Il(t,e){if(!this.al||!this.ll)return
|
|
1092
1095
|
const i=new qt(t,e)
|
|
1093
|
-
this.
|
|
1094
|
-
const n=this.
|
|
1095
|
-
if(
|
|
1096
|
-
const h=this.
|
|
1096
|
+
this.Tl(i),this.al.points.push(i),this.ll=i}Fl(t,e,i,s){if(!this.al||!this.ll)return
|
|
1097
|
+
const n=this.ll,r=new qt(t,e),o=new qt(i,s)
|
|
1098
|
+
if(Je>Math.abs((r.x-o.x)*(o.y-n.y)-(r.y-o.y)*(o.x-n.x)))return void this.Il(i,s)
|
|
1099
|
+
const h=this.pl.el(n,r,o)
|
|
1097
1100
|
for(let t=0;h.length>t;t++){const e=h[t]
|
|
1098
|
-
this.
|
|
1099
|
-
const o=this.
|
|
1100
|
-
if(
|
|
1101
|
-
const f=this.
|
|
1101
|
+
this.Tl(e),this.al.points.push(e)}this.ll=o}Sl(t,e,i,s,n,r){if(!this.al||!this.ll)return
|
|
1102
|
+
const o=this.ll,h=new qt(t,e),a=new qt(i,s),l=new qt(n,r),c=l.x-o.x,u=l.y-o.y
|
|
1103
|
+
if(Je>Math.abs((h.x-l.x)*u-(h.y-l.y)*c)&&Je>Math.abs((a.x-l.x)*u-(a.y-l.y)*c))return void this.Il(n,r)
|
|
1104
|
+
const f=this.pl.sl(o,h,a,l)
|
|
1102
1105
|
for(let t=0;f.length>t;t++){const e=f[t]
|
|
1103
|
-
this.
|
|
1104
|
-
const t=this.
|
|
1105
|
-
this.
|
|
1106
|
-
this.
|
|
1107
|
-
if(this.
|
|
1106
|
+
this.Tl(e),this.al.points.push(e)}this.ll=l}Ml(){if(!this.al||!this.ll)return
|
|
1107
|
+
const t=this.al.points[0]
|
|
1108
|
+
this.ll.equals(t)||this.al.points.push(t),this.xl()}xl(){if(this.al){const t=this.wl.$a(this.al)
|
|
1109
|
+
this.hl.push(t),this.al=null,this.ll=null}}Tl(t){this.cl.min.x=Math.min(this.cl.min.x,t.x),this.cl.min.y=Math.min(this.cl.min.y,t.y),this.cl.max.x=Math.max(this.cl.max.x,t.x),this.cl.max.y=Math.max(this.cl.max.y,t.y)}_l(){return this.hl.length>0&&this.vl(),this.ul}Ol(){return this.fl}Cl(){return this.dl}reset(){this.ul=[],this.fl=[],this.dl=[],this.hl=[],this.al=null,this.ll=null,this.rl=0,this.ol=0,this.yl.set(0,0),this.cl={min:new qt(1/0,1/0),max:new qt(-1/0,-1/0)}}Qa(t){this.pl.Qa(t)}tl(t){this.pl.tl(t)}Bl(t){this.wl.Na({...Ge,...t})}kl(){return this.wl.getStats()}}class hi{constructor(){this.Ll=null,this.Dl=null,this.Pl=null,this.Nl=null,this.$l=null,this.Gl=0,this.position={x:0,y:0}}setPosition(t,e){this.position.x=t,this.position.y=e,this.zl&&this.zl.setPosition(t,e)}gl(t,e){this.position.x+=t,this.position.y+=e,this.zl&&this.zl.gl(t,e)}Wl(t){this.zl=t}Rl(t,e){if(!t||!t.module||!t.hb)throw Error("Invalid font object")
|
|
1110
|
+
if(this.zl=e,this.Gl)return
|
|
1108
1111
|
const i=t.module
|
|
1109
|
-
this.
|
|
1110
|
-
return this.
|
|
1112
|
+
this.Ll=i.zs((t,e,i,s,n)=>{this.zl?.El(s,n)},"viiiffi"),this.Dl=i.zs((t,e,i,s,n)=>{this.zl?.Il(s,n)},"viiiffi"),this.Pl=i.zs((t,e,i,s,n,r,o)=>{this.zl?.Fl(s,n,r,o)},"viiiffffi"),this.Nl=i.zs((t,e,i,s,n,r,o,h,a)=>{this.zl?.Sl(s,n,r,o,h,a)},"viiiffffffi"),this.$l=i.zs(()=>{this.zl?.Ml()},"viiii"),this.Gl=i.exports.ur(),i.exports.tr(this.Gl,this.Ll,0,0),i.exports.ir(this.Gl,this.Dl,0,0),i.exports.nr(this.Gl,this.Pl,0,0),i.exports.hr(this.Gl,this.Nl,0,0),i.exports.lr(this.Gl,this.$l,0,0)}jl(){if(!this.Gl)throw Error("Draw functions not initialized")
|
|
1113
|
+
return this.Gl}destroy(t){if(!t||!t.module||!t.hb)return
|
|
1111
1114
|
const e=t.module
|
|
1112
|
-
try{this.
|
|
1113
|
-
class li{constructor(t,e){this.dt="default",this.
|
|
1115
|
+
try{this.Gl&&(e.exports.yr(this.Gl),this.Gl=0),null!==this.Ll&&(e.Ws(this.Ll),this.Ll=null),null!==this.Dl&&(e.Ws(this.Dl),this.Dl=null),null!==this.Pl&&(e.Ws(this.Pl),this.Pl=null),null!==this.Nl&&(e.Ws(this.Nl),this.Nl=null),null!==this.$l&&(e.Ws(this.$l),this.$l=null)}catch(t){rt.warn("Error destroying draw callbacks:",t)}this.zl=void 0}}const ai=new WeakMap
|
|
1116
|
+
class li{constructor(t,e){this.dt="default",this.Ul="default",this.Vl=new Set,this.Hl=[],this.ql=[],this.Yl=[],this.cache=t,this.ft=e,this.tessellator=new Pe,this.Kl=new Ne,this.Jl=new $e,this.zl=new oi,this.Xl=(()=>{const t=this.ft.module,e=ai.get(t)
|
|
1114
1117
|
if(e)return e
|
|
1115
1118
|
const i=new hi
|
|
1116
|
-
return ai.set(t,i),i})(),this.
|
|
1119
|
+
return ai.set(t,i),i})(),this.Xl.Rl(this.ft,this.zl),this.Ql=le,this.Zl=ce,this.tc=ue}kl(){return this.zl.kl()}Qa(t){this.Ja=t,this.zl.Qa(t),this.ec()}tl(t){if(null==t)this.curveSteps=void 0
|
|
1117
1120
|
else if(Number.isFinite(t)){const e=Math.round(t)
|
|
1118
1121
|
this.curveSteps=1>e?void 0:e}else this.curveSteps=void 0
|
|
1119
|
-
this.
|
|
1120
|
-
const t=this.
|
|
1121
|
-
return`cf:${t.toFixed(4)},${e.toFixed(4)}`})(),`opt:${this.
|
|
1122
|
-
for(let i=0;t.length>i;i++)e+=t[i].length}const h=this.
|
|
1122
|
+
this.zl.tl(this.curveSteps),this.ec()}Bl(t){this.sc=t,this.zl.Bl(t),this.ec()}nc(t){this.dt=t,this.ec()}ec(){this.Ul=`${this.dt}__${this.rc()}`}rc(){return[(()=>{if(void 0!==this.curveSteps)return"cf:steps:"+this.curveSteps
|
|
1123
|
+
const t=this.Ja?.distanceTolerance??.5,e=this.Ja?.angleTolerance??.2
|
|
1124
|
+
return`cf:${t.toFixed(4)},${e.toFixed(4)}`})(),`opt:${this.sc?.enabled??1?1:0},${(this.sc?.areaThreshold??1).toFixed(4)}`].join("|")}oc(t,e,i,s,n,r=!1,o){if(nt){let e=0
|
|
1125
|
+
for(let i=0;t.length>i;i++)e+=t[i].length}const h=this.Yl
|
|
1123
1126
|
h.length=0
|
|
1124
1127
|
let l=0,c=0,u=0,f=0,d=0
|
|
1125
1128
|
const y=(t,e,i,s)=>{const n=d
|
|
1126
1129
|
let r=h[l]
|
|
1127
|
-
return r?(r.data=t,r.px=e,r.
|
|
1130
|
+
return r?(r.data=t,r.px=e,r.hc=i,r.ac=s,r.lc=n):(r={data:t,px:e,hc:i,ac:s,lc:n},h[l]=r),l++,c+=t.vertices.length,u+=t.normals.length,f+=t.indices.length,d+=t.vertices.length/3,n},p=[],w={min:{x:1/0,y:1/0,z:0},max:{x:-1/0,y:-1/0,z:e}}
|
|
1128
1131
|
for(let n=0;t.length>n;n++){const h=t[n]
|
|
1129
1132
|
for(const t of h){const n=t.position.x,h=t.position.y,l=t.position.z,c=[]
|
|
1130
|
-
for(const e of t.glyphs)c.push(this.
|
|
1133
|
+
for(const e of t.glyphs)c.push(this.cc(e.g))
|
|
1131
1134
|
let u
|
|
1132
|
-
if(t.glyphs.length>1){const e=`${this.
|
|
1135
|
+
if(t.glyphs.length>1){const e=`${this.Ul}_${t.text}`,i=this.tc.get(e)
|
|
1133
1136
|
let s=!1
|
|
1134
|
-
if(i&&i.
|
|
1135
|
-
for(let e=0;t.glyphs.length>e;e++){const n=t.glyphs[e],r=i.
|
|
1136
|
-
if(i.
|
|
1137
|
+
if(i&&i.uc.length===t.glyphs.length){s=!0
|
|
1138
|
+
for(let e=0;t.glyphs.length>e;e++){const n=t.glyphs[e],r=i.fc[e]
|
|
1139
|
+
if(i.uc[e]!==n.g||r.x!==(n.x??0)||r.y!==(n.y??0)){s=!1
|
|
1137
1140
|
break}}}if(s&&i)u=i.groups
|
|
1138
1141
|
else{const i=t.glyphs.length
|
|
1139
|
-
if(i>this.
|
|
1140
|
-
this.
|
|
1141
|
-
for(let e=0;i>e;e++){const i=t.glyphs[e],s=this.
|
|
1142
|
-
s.x=i.x??0,s.y=i.y??0,s.z=0}u=this.
|
|
1142
|
+
if(i>this.Hl.length)for(let t=this.Hl.length;i>t;t++)this.Hl.push(new Yt(0,0,0))
|
|
1143
|
+
this.Hl.length=i
|
|
1144
|
+
for(let e=0;i>e;e++){const i=t.glyphs[e],s=this.Hl[e]
|
|
1145
|
+
s.x=i.x??0,s.y=i.y??0,s.z=0}u=this.Jl.Oa(c,this.Hl),this.tc.set(e,{uc:t.glyphs.map(t=>t.g),fc:t.glyphs.map(t=>({x:t.x??0,y:t.y??0})),groups:u})}}else u=[[0]]
|
|
1143
1146
|
const f=r
|
|
1144
1147
|
let d=u
|
|
1145
1148
|
if(o&&o.size>0){d=[]
|
|
1146
1149
|
for(const e of u)if(e.length>1){const i=[],s=[]
|
|
1147
1150
|
for(const n of e)o.has(t.glyphs[n].Cs)?i.push(n):s.push(n)
|
|
1148
|
-
i.length>0&&d.push(i),s.length>0&&d.push(s)}else d.push(e)}for(const r of d)if(r.length>1&&!f){const o=r.map(e=>t.glyphs[e]),a=this.
|
|
1149
|
-
let u=this.
|
|
1150
|
-
if(!u){const i=this.
|
|
1151
|
+
i.length>0&&d.push(i),s.length>0&&d.push(s)}else d.push(e)}for(const r of d)if(r.length>1&&!f){const o=r.map(e=>t.glyphs[e]),a=this.dc(o,e,i)
|
|
1152
|
+
let u=this.Zl.get(a)
|
|
1153
|
+
if(!u){const i=this.ql
|
|
1151
1154
|
let n=0
|
|
1152
1155
|
const h=o[0].x??0,l=o[0].y??0
|
|
1153
1156
|
for(let e=0;r.length>e;e++){const s=r[e],o=c[s],a=t.glyphs[s],u=(a.x??0)-h,f=(a.y??0)-l
|
|
1154
|
-
for(const t of o.
|
|
1157
|
+
for(const t of o.Al){const e=t.points,s=e.length
|
|
1155
1158
|
if(3>s)continue
|
|
1156
1159
|
const r=s>1&&e[0].x===e[s-1].x&&e[0].y===e[s-1].y?s-1:s,o=2*(r+1)
|
|
1157
1160
|
let h=i[n]
|
|
1158
1161
|
!h||o>h.length?(h=Array(o),i[n]=h):h.length=o
|
|
1159
1162
|
let a=0
|
|
1160
1163
|
for(let t=0;r>t;t++){const i=e[t]
|
|
1161
|
-
h[a++]=i.x+u,h[a++]=i.y+f}2>a||(h[a++]=h[0],h[a++]=h[1]),n++}}i.length=n,u=this.
|
|
1162
|
-
for(let i=0;r.length>i;i++){const s=r[i],o=t.glyphs[s],a=this.
|
|
1163
|
-
p.push(a),this.
|
|
1164
|
-
if(0===u.
|
|
1164
|
+
h[a++]=i.x+u,h[a++]=i.y+f}2>a||(h[a++]=h[0],h[a++]=h[1]),n++}}i.length=n,u=this.yc(i,e,s),this.Zl.set(a,u)}const f=o[0],d=y(u,n+(f.x??0),h+(f.y??0),l),g=u.vertices.length/3
|
|
1165
|
+
for(let i=0;r.length>i;i++){const s=r[i],o=t.glyphs[s],a=this.wc(o,d,g,n+(o.x??0),h+(o.y??0),l,c[s],e)
|
|
1166
|
+
p.push(a),this.gc(a.bounds,w)}}else for(const o of r){const r=t.glyphs[o],u=c[o],f=n+(r.x??0),d=h+(r.y??0),g=l
|
|
1167
|
+
if(0===u.Al.length){const t=this.wc(r,0,0,f,d,g,u,e)
|
|
1165
1168
|
p.push(t)
|
|
1166
|
-
continue}const m=a(this.
|
|
1169
|
+
continue}const m=a(this.Ul,r.g,e,i)
|
|
1167
1170
|
let v=this.cache.get(m)
|
|
1168
|
-
v?v.
|
|
1169
|
-
const x=y(v,f,d,g),b=this.
|
|
1170
|
-
p.push(b),this.
|
|
1171
|
+
v?v.mc++:(v=this.vc(u,e,i,s),this.cache.set(m,v))
|
|
1172
|
+
const x=y(v,f,d,g),b=this.wc(r,x,v.vertices.length/3,f,d,g,u,e)
|
|
1173
|
+
p.push(b),this.gc(b.bounds,w)}}}h.length=l
|
|
1171
1174
|
const g=new Float32Array(c),m=new Float32Array(u),v=new Uint32Array(f)
|
|
1172
1175
|
let x=0,b=0,A=0
|
|
1173
|
-
for(let t=0;h.length>t;t++){const e=h[t],i=e.data.vertices,s=e.data.normals,r=e.data.indices,o=e.px*n,a=e.
|
|
1176
|
+
for(let t=0;h.length>t;t++){const e=h[t],i=e.data.vertices,s=e.data.normals,r=e.data.indices,o=e.px*n,a=e.hc*n,l=e.ac*n,c=i.length
|
|
1174
1177
|
let u=x
|
|
1175
1178
|
for(let t=0;c>t;t+=3)g[u]=i[t]*n+o,g[u+1]=i[t+1]*n+a,g[u+2]=i[t+2]*n+l,u+=3
|
|
1176
1179
|
x=u,m.set(s,b),b+=s.length
|
|
1177
|
-
const f=e.
|
|
1180
|
+
const f=e.lc,d=r.length
|
|
1178
1181
|
let y=A
|
|
1179
1182
|
for(let t=0;d>t;t++)v[y++]=r[t]+f
|
|
1180
1183
|
A=y}w.min.x*=n,w.min.y*=n,w.min.z*=n,w.max.x*=n,w.max.y*=n,w.max.z*=n
|
|
1181
1184
|
for(let t=0;p.length>t;t++)p[t].bounds.min.x*=n,p[t].bounds.min.y*=n,p[t].bounds.min.z*=n,p[t].bounds.max.x*=n,p[t].bounds.max.y*=n,p[t].bounds.max.z*=n
|
|
1182
|
-
return{vertices:g,normals:m,indices:v,
|
|
1185
|
+
return{vertices:g,normals:m,indices:v,xc:p,planeBounds:w}}dc(t,e,i){if(0===t.length)return""
|
|
1183
1186
|
const s=t[0].x??0,n=t[0].y??0,r=t.map(t=>`${t.g}:${(t.x??0)-s},${(t.y??0)-n}`),o=r.join("|")
|
|
1184
|
-
return`${this.
|
|
1185
|
-
const e=`${this.
|
|
1187
|
+
return`${this.Ul}_${o}_${Math.round(1e3*e)/1e3}_${i}`}wc(t,e,i,s,n,r,o,h){return{bc:t.Cs,Bs:t.Bs,lc:e,Ch:i,bounds:{min:{x:o.bounds.min.x+s,y:o.bounds.min.y+n,z:r},max:{x:o.bounds.max.x+s,y:o.bounds.max.y+n,z:r+h}}}}cc(t){if(this.Vl.has(t))return{bl:t,Al:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
|
|
1188
|
+
const e=`${this.Ul}_${t}`,i=this.Ql.get(e)
|
|
1186
1189
|
if(i)return i
|
|
1187
|
-
this.
|
|
1188
|
-
const s=this.
|
|
1189
|
-
return 0===s.
|
|
1190
|
-
return this.
|
|
1190
|
+
this.Xl.Wl(this.zl),this.zl.reset(),this.zl.ml(t,0),this.ft.module.exports.Sr(this.ft.font.lo,t,this.Xl.jl(),0),this.zl.vl()
|
|
1191
|
+
const s=this.zl._l()[0]||{bl:t,Al:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
|
|
1192
|
+
return 0===s.Al.length&&this.Vl.add(t),this.Ql.set(e,s),s}yc(t,e,i){const s=this.tessellator.ma(t,!0,i,0!==e)
|
|
1193
|
+
return this.Ac(s,e)}Ac(t,e){const i=this.Kl._a(t,e,this.ft.upem),s=i.vertices
|
|
1191
1194
|
let n=1/0,r=1/0,o=1/0,h=-1/0,a=-1/0,l=-1/0
|
|
1192
1195
|
for(let t=0;s.length>t;t+=3){const e=s[t],i=s[t+1],c=s[t+2]
|
|
1193
1196
|
n>e&&(n=e),e>h&&(h=e),r>i&&(r=i),i>a&&(a=i),o>c&&(o=c),c>l&&(l=c)}const c=new Yt(n,r,o),u=new Yt(h,a,l)
|
|
1194
|
-
return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:c,max:u},
|
|
1195
|
-
return this.
|
|
1196
|
-
i.x>n.x&&(i.x=n.x),i.y>n.y&&(i.y=n.y),i.z>n.z&&(i.z=n.z),r.x>s.x&&(s.x=r.x),r.y>s.y&&(s.y=r.y),r.z>s.z&&(s.z=r.z)}
|
|
1197
|
-
e.push(t),this.
|
|
1198
|
-
return t.
|
|
1197
|
+
return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:c,max:u},mc:1}}vc(t,e,i,s){const n=this.tessellator.process(t.Al,i,s,0!==e)
|
|
1198
|
+
return this.Ac(n,e)}gc(t,e){const i=e.min,s=e.max,n=t.min,r=t.max
|
|
1199
|
+
i.x>n.x&&(i.x=n.x),i.y>n.y&&(i.y=n.y),i.z>n.z&&(i.z=n.z),r.x>s.x&&(s.x=r.x),r.y>s.y&&(s.y=r.y),r.z>s.z&&(s.z=r.z)}Ec(){return this.cache.getStats()}clearCache(){this.cache.clear(),this.Zl.clear(),this.tc.clear(),this.Ql.clear()}}class ci{constructor(t,e){this.text=t,this.Tc=new Map,e.forEach(t=>{const e=this.Tc.get(t.bc)||[]
|
|
1200
|
+
e.push(t),this.Tc.set(t.bc,e)})}Ic(t){const e=[]
|
|
1201
|
+
return t.Fc&&e.push(...this.Sc(t.Fc)),t.Mc&&e.push(...this._c(t.Mc)),e}Sc(t){const e=[]
|
|
1199
1202
|
for(const i of t){let t=0
|
|
1200
|
-
for(;-1!==(t=this.text.indexOf(i,t));)e.push(this.createTextRange(t,t+i.length,i)),t+=i.length}return e}
|
|
1203
|
+
for(;-1!==(t=this.text.indexOf(i,t));)e.push(this.createTextRange(t,t+i.length,i)),t+=i.length}return e}_c(t){return t.map(t=>{const e=this.text.slice(t.start,t.end)
|
|
1201
1204
|
return this.createTextRange(t.start,t.end,e)})}createTextRange(t,e,i){const s=[],n=new Map
|
|
1202
|
-
for(let i=t;e>i;i++){const t=this.
|
|
1205
|
+
for(let i=t;e>i;i++){const t=this.Tc.get(i)
|
|
1203
1206
|
if(t)for(const e of t){s.push(e)
|
|
1204
1207
|
const t=n.get(e.Bs)||[]
|
|
1205
|
-
t.push(e),n.set(e.Bs,t)}}return{start:t,end:e,
|
|
1208
|
+
t.push(e),n.set(e.Bs,t)}}return{start:t,end:e,Oc:i,bounds:Array.from(n.values()).map(t=>this.Cc(t)),glyphs:s,Bc:Array.from(n.keys()).sort((t,e)=>t-e)}}Cc(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
|
|
1206
1209
|
let e=1/0,i=1/0,s=1/0,n=-1/0,r=-1/0,o=-1/0
|
|
1207
1210
|
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),s>h.bounds.min.z&&(s=h.bounds.min.z),h.bounds.max.x>n&&(n=h.bounds.max.x),h.bounds.max.y>r&&(r=h.bounds.max.y),h.bounds.max.z>o&&(o=h.bounds.max.z)
|
|
1208
|
-
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}}class ui{constructor(t,e){this.ft=t,this.dt=e}ut(t,e){this.ft=t,this.dt=e,this.
|
|
1211
|
+
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}}class ui{constructor(t,e){this.ft=t,this.dt=e}ut(t,e){this.ft=t,this.dt=e,this.kc=void 0}nt(t,e){try{this.kc||(this.kc=new li(ae,this.ft),this.kc.nc(this.dt))
|
|
1209
1212
|
const i=null!=e.curveSteps&&e.curveSteps>0
|
|
1210
|
-
this.
|
|
1211
|
-
const s=e.
|
|
1213
|
+
this.kc.tl(e.curveSteps),this.kc.Qa(i?void 0:e.curveFidelity),this.kc.Bl(e.geometryOptimization)
|
|
1214
|
+
const s=e.Lc??this.ft.us??!1
|
|
1212
1215
|
let n,r
|
|
1213
|
-
if(e.color&&"object"==typeof e.color&&!Array.isArray(e.color)&&(e.color.
|
|
1214
|
-
for(const t of Object.keys(e.color.
|
|
1216
|
+
if(e.color&&"object"==typeof e.color&&!Array.isArray(e.color)&&(e.color.Fc||e.color.Mc)){if(n=new Set,e.color.Fc){r=[]
|
|
1217
|
+
for(const t of Object.keys(e.color.Fc)){let i=0
|
|
1215
1218
|
for(;-1!==(i=e.text.indexOf(t,i));){r.push({pattern:t,start:i,end:i+t.length})
|
|
1216
1219
|
for(let e=i;i+t.length>e;e++)n.add(e)
|
|
1217
|
-
i+=t.length}}}if(e.color.
|
|
1218
|
-
if(e.perGlyphAttributes){const t=this.
|
|
1219
|
-
h.glyphAttributes=t}return h}finally{}}getCacheSize(){return this.
|
|
1220
|
-
this.
|
|
1221
|
-
const u=this.
|
|
1220
|
+
i+=t.length}}}if(e.color.Mc)for(const t of e.color.Mc)for(let e=t.start;t.end>e;e++)n.add(e)}const o=this.kc.oc(t.yh,t.wh.depth,s,this.ft.wt._i,t.wh.xh,e.perGlyphAttributes??!1,n),h=this.Dc(o.vertices,o.normals,o.indices,o.xc,o.planeBounds,e,e.text,r)
|
|
1221
|
+
if(e.perGlyphAttributes){const t=this.Pc(h.vertices.length/3,h.glyphs)
|
|
1222
|
+
h.glyphAttributes=t}return h}finally{}}getCacheSize(){return this.kc?.Ec().size??0}clearCache(){this.kc?.clearCache()}reset(){this.kc=void 0,this.oh=void 0}Dc(t,e,i,s,n,r,o,h){const{layout:a={}}=r,{width:l,align:c=("rtl"===a.direction?"right":"left")}=a
|
|
1223
|
+
this.oh||(this.oh=new It(this.ft))
|
|
1224
|
+
const u=this.oh.gi({width:l,align:c,planeBounds:n}),f=u.offset
|
|
1222
1225
|
if(n.min.x=u.wi.min.x,n.max.x=u.wi.max.x,0!==f){for(let e=0;t.length>e;e+=3)t[e]+=f
|
|
1223
1226
|
for(let t=0;s.length>t;t++)s[t].bounds.min.x+=f,s[t].bounds.max.x+=f}let d,y
|
|
1224
|
-
if(r.color){const e=this.
|
|
1225
|
-
d=e.colors,y=e.ht}const p=this.
|
|
1227
|
+
if(r.color){const e=this.Nc(t,s,r.color,r.text,h)
|
|
1228
|
+
d=e.colors,y=e.ht}const p=this.kc.kl()
|
|
1226
1229
|
return{vertices:t,normals:e,indices:i,colors:d,glyphs:s,planeBounds:n,stats:{trianglesGenerated:i.length/3,verticesGenerated:t.length/3,pointsRemovedByVisvalingam:p.pointsRemovedByVisvalingam,originalPointCount:p.originalPointCount},query:(()=>{let t=null
|
|
1227
1230
|
return e=>{if(!o)throw Error("Original text not available for querying")
|
|
1228
|
-
return t||(t=new ci(o,s)),t.
|
|
1231
|
+
return t||(t=new ci(o,s)),t.Ic(e)}})(),ht:y,glyphAttributes:void 0}}Nc(t,e,i,s,n){const r=t.length/3,o=new Float32Array(3*r),h=[]
|
|
1229
1232
|
if(Array.isArray(i)){for(let t=0;r>t;t++){const e=3*t
|
|
1230
|
-
o[e]=i[0],o[e+1]=i[1],o[e+2]=i[2]}h.push({start:0,end:s.length,
|
|
1233
|
+
o[e]=i[0],o[e+1]=i[1],o[e+2]=i[2]}h.push({start:0,end:s.length,Oc:s,color:i,bounds:[],glyphs:e,Bc:[...new Set(e.map(t=>t.Bs))]})}else{const t=i.default||[1,1,1]
|
|
1231
1234
|
for(let e=0;o.length>e;e+=3)o[e]=t[0],o[e+1]=t[1],o[e+2]=t[2]
|
|
1232
1235
|
let r
|
|
1233
|
-
if(i.
|
|
1234
|
-
for(const t of e){const e=r.get(t.
|
|
1235
|
-
e?e.push(t):r.set(t.
|
|
1236
|
+
if(i.Fc&&n||i.Mc){r=new Map
|
|
1237
|
+
for(const t of e){const e=r.get(t.bc)
|
|
1238
|
+
e?e.push(t):r.set(t.bc,[t])}}if(i.Fc&&n&&r)for(const t of n){const e=i.Fc[t.pattern]
|
|
1236
1239
|
if(!e)continue
|
|
1237
1240
|
const s=[],n=new Map
|
|
1238
1241
|
for(let i=t.start;t.end>i;i++){const t=r.get(i)
|
|
1239
1242
|
if(t)for(const i of t){s.push(i)
|
|
1240
1243
|
const t=n.get(i.Bs)
|
|
1241
1244
|
t?t.push(i):n.set(i.Bs,[i])
|
|
1242
|
-
for(let t=0;i.
|
|
1243
|
-
s>=0&&o.length>s&&(o[s]=e[0],o[s+1]=e[1],o[s+2]=e[2])}}}const a=Array.from(n.values()).map(t=>this
|
|
1244
|
-
h.push({start:t.start,end:t.end,
|
|
1245
|
+
for(let t=0;i.Ch>t;t++){const s=3*(i.lc+t)
|
|
1246
|
+
s>=0&&o.length>s&&(o[s]=e[0],o[s+1]=e[1],o[s+2]=e[2])}}}const a=Array.from(n.values()).map(t=>this.$c(t))
|
|
1247
|
+
h.push({start:t.start,end:t.end,Oc:t.pattern,color:e,bounds:a,glyphs:s,Bc:Array.from(n.keys()).sort((t,e)=>t-e)})}if(i.Mc&&r)for(const t of i.Mc){const e=[],i=new Map
|
|
1245
1248
|
for(let s=t.start;t.end>s;s++){const n=r.get(s)
|
|
1246
1249
|
if(n)for(const s of n){e.push(s)
|
|
1247
1250
|
const n=i.get(s.Bs)
|
|
1248
1251
|
n?n.push(s):i.set(s.Bs,[s])
|
|
1249
|
-
for(let e=0;s.
|
|
1250
|
-
i>=0&&o.length>i&&(o[i]=t.color[0],o[i+1]=t.color[1],o[i+2]=t.color[2])}}}const n=Array.from(i.values()).map(t=>this
|
|
1251
|
-
h.push({start:t.start,end:t.end,
|
|
1252
|
+
for(let e=0;s.Ch>e;e++){const i=3*(s.lc+e)
|
|
1253
|
+
i>=0&&o.length>i&&(o[i]=t.color[0],o[i+1]=t.color[1],o[i+2]=t.color[2])}}}const n=Array.from(i.values()).map(t=>this.$c(t))
|
|
1254
|
+
h.push({start:t.start,end:t.end,Oc:s.slice(t.start,t.end),color:t.color,bounds:n,glyphs:e,Bc:Array.from(i.keys()).sort((t,e)=>t-e)})}}return{colors:o,ht:h}}$c(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
|
|
1252
1255
|
let e=1/0,i=1/0,s=1/0,n=-1/0,r=-1/0,o=-1/0
|
|
1253
1256
|
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),s>h.bounds.min.z&&(s=h.bounds.min.z),h.bounds.max.x>n&&(n=h.bounds.max.x),h.bounds.max.y>r&&(r=h.bounds.max.y),h.bounds.max.z>o&&(o=h.bounds.max.z)
|
|
1254
|
-
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}
|
|
1257
|
+
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}Pc(t,e){const i=new Float32Array(3*t),s=new Float32Array(t),n=new Float32Array(t),r=new Float32Array(t),o=new Float32Array(t)
|
|
1255
1258
|
let h=1/0,a=-1/0
|
|
1256
1259
|
for(let t=0;e.length>t;t++){const i=(e[t].bounds.min.x+e[t].bounds.max.x)/2
|
|
1257
1260
|
h>i&&(h=i),i>a&&(a=i)}const l=a-h
|
|
1258
|
-
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.
|
|
1261
|
+
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.lc,g=Math.min(w+c.Ch,t)
|
|
1259
1262
|
if(g>w){s.fill(a,w,g),n.fill(c.Bs,w,g),r.fill(p,w,g),o.fill(y,w,g)
|
|
1260
|
-
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:s,glyphLineIndex:n,glyphProgress:r,glyphBaselineY:o}}}class fi{static{this.
|
|
1263
|
+
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:s,glyphLineIndex:n,glyphProgress:r,glyphBaselineY:o}}}class fi{static{this.Uo=oe.Uo}static{this.Vo=oe.Vo}static{this.init=oe.init}static{this.Ah=oe.Ah}static{this.bh=oe.bh}static{this.Eh=oe.Eh}static{this.zo=oe.zo}static async create(t){const e=await oe.create(t)
|
|
1261
1264
|
return st(e,new ui(e.ft,e.dt),t)}}t.Text=fi},"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ThreeText={},t.THREE)
|