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