vuer 0.0.32rc7__py3-none-any.whl → 0.0.32rc8__py3-none-any.whl

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.

Potentially problematic release.


This version of vuer might be problematic. Click here for more details.

Files changed (25) hide show
  1. vuer/addons/camera_rtc.py +171 -0
  2. vuer/client_build/404.html +1 -1
  3. vuer/client_build/assets/chunks/chunk-42690cd5.js +15 -0
  4. vuer/client_build/assets/chunks/chunk-8db1b443.js +1 -0
  5. vuer/client_build/assets/chunks/chunk-9ee83150.js +220 -0
  6. vuer/client_build/assets/chunks/chunk-af3ddd0a.js +6786 -0
  7. vuer/client_build/assets/chunks/chunk-bbf8b6fc.js +85 -0
  8. vuer/client_build/assets/entries/entry-client-routing.3c853994.js +2 -0
  9. vuer/client_build/assets/entries/entry-server-routing.40c0fcc6.js +1 -0
  10. vuer/client_build/assets/entries/pages_hands.page.8bc91e13.js +1 -0
  11. vuer/client_build/assets/entries/pages_index.page.041ef5af.js +97 -0
  12. vuer/client_build/assets/entries/pages_stereo_plane.page.186386ed.js +54 -0
  13. vuer/client_build/assets/entries/pages_video_plane.page.9303749c.js +1 -0
  14. vuer/client_build/hands/index.html +3 -3
  15. vuer/client_build/index.html +3 -3
  16. vuer/client_build/stereo_plane/index.html +3 -3
  17. vuer/client_build/video_plane/index.html +3 -3
  18. vuer/schemas/__pycache__/scene_components.cpython-38.pyc +0 -0
  19. vuer/schemas/scene_components.py +25 -0
  20. {vuer-0.0.32rc7.dist-info → vuer-0.0.32rc8.dist-info}/METADATA +1 -1
  21. {vuer-0.0.32rc7.dist-info → vuer-0.0.32rc8.dist-info}/RECORD +25 -13
  22. {vuer-0.0.32rc7.dist-info → vuer-0.0.32rc8.dist-info}/LICENSE +0 -0
  23. {vuer-0.0.32rc7.dist-info → vuer-0.0.32rc8.dist-info}/WHEEL +0 -0
  24. {vuer-0.0.32rc7.dist-info → vuer-0.0.32rc8.dist-info}/entry_points.txt +0 -0
  25. {vuer-0.0.32rc7.dist-info → vuer-0.0.32rc8.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,220 @@
1
+ import{I as Jt,S as Yt,B as Kt,a as Qt,D as Pt,b as Zt,V as Qe,d as yt,C as dt,M as er,e as ht,F as tr,f as It,T as rr,L as bt,g as nr,P as pt,h as or,i as ar,j as ir,k as sr,l as vt,U as lr,m as ur,R as fr,n as cr,o as dr}from"./chunk-af3ddd0a.js";import"./chunk-3010a972.js";import"./chunk-d9bdcef8.js";import"./chunk-cf010ec4.js";function hr(){var f=Object.create(null);function r(t,e){var a=t.id,o=t.name,n=t.dependencies;n===void 0&&(n=[]);var i=t.init;i===void 0&&(i=function(){});var s=t.getTransferables;if(s===void 0&&(s=null),!f[a])try{n=n.map(function(u){return u&&u.isWorkerModule&&(r(u,function(c){if(c instanceof Error)throw c}),u=f[u.id].value),u}),i=h("<"+o+">.init",i),s&&(s=h("<"+o+">.getTransferables",s));var l=null;typeof i=="function"?l=i.apply(void 0,n):console.error("worker module init function failed to rehydrate"),f[a]={id:a,value:l,getTransferables:s},e(l)}catch(u){u&&u.noLog||console.error(u),e(u)}}function d(t,e){var a,o=t.id,n=t.args;(!f[o]||typeof f[o].value!="function")&&e(new Error("Worker module "+o+": not found or its 'init' did not return a function"));try{var i=(a=f[o]).value.apply(a,n);i&&typeof i.then=="function"?i.then(s,function(l){return e(l instanceof Error?l:new Error(""+l))}):s(i)}catch(l){e(l)}function s(l){try{var u=f[o].getTransferables&&f[o].getTransferables(l);(!u||!Array.isArray(u)||!u.length)&&(u=void 0),e(l,u)}catch(c){console.error(c),e(c)}}}function h(t,e){var a=void 0;self.troikaDefine=function(n){return a=n};var o=URL.createObjectURL(new Blob(["/** "+t.replace(/\*/g,"")+` **/
2
+
3
+ troikaDefine(
4
+ `+e+`
5
+ )`],{type:"application/javascript"}));try{importScripts(o)}catch(n){console.error(n)}return URL.revokeObjectURL(o),delete self.troikaDefine,a}self.addEventListener("message",function(t){var e=t.data,a=e.messageId,o=e.action,n=e.data;try{o==="registerModule"&&r(n,function(i){i instanceof Error?postMessage({messageId:a,success:!1,error:i.message}):postMessage({messageId:a,success:!0,result:{isCallable:typeof i=="function"}})}),o==="callModule"&&d(n,function(i,s){i instanceof Error?postMessage({messageId:a,success:!1,error:i.message}):postMessage({messageId:a,success:!0,result:i},s||void 0)})}catch(i){postMessage({messageId:a,success:!1,error:i.stack})}})}function pr(f){var r=function(){for(var d=[],h=arguments.length;h--;)d[h]=arguments[h];return r._getInitResult().then(function(t){if(typeof t=="function")return t.apply(void 0,d);throw new Error("Worker module function was called but `init` did not return a callable function")})};return r._getInitResult=function(){var d=f.dependencies,h=f.init;d=Array.isArray(d)?d.map(function(e){return e&&e._getInitResult?e._getInitResult():e}):[];var t=Promise.all(d).then(function(e){return h.apply(null,e)});return r._getInitResult=function(){return t},t},r}var Rt=function(){var f=!1;if(typeof window<"u"&&typeof window.document<"u")try{var r=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));r.terminate(),f=!0}catch(d){typeof process<"u",console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+d.message+"]")}return Rt=function(){return f},f},vr=0,gr=0,ot=!1,We=Object.create(null),ze=Object.create(null),lt=Object.create(null);function Ve(f){if((!f||typeof f.init!="function")&&!ot)throw new Error("requires `options.init` function");var r=f.dependencies,d=f.init,h=f.getTransferables,t=f.workerId;if(!Rt())return pr(f);t==null&&(t="#default");var e="workerModule"+ ++vr,a=f.name||e,o=null;r=r&&r.map(function(i){return typeof i=="function"&&!i.workerModuleData&&(ot=!0,i=Ve({workerId:t,name:"<"+a+"> function dependency: "+i.name,init:`function(){return (
6
+ `+Ye(i)+`
7
+ )}`}),ot=!1),i&&i.workerModuleData&&(i=i.workerModuleData),i});function n(){for(var i=[],s=arguments.length;s--;)i[s]=arguments[s];if(!o){o=St(t,"registerModule",n.workerModuleData);var l=function(){o=null,ze[t].delete(l)};(ze[t]||(ze[t]=new Set)).add(l)}return o.then(function(u){var c=u.isCallable;if(c)return St(t,"callModule",{id:e,args:i});throw new Error("Worker module function was called but `init` did not return a callable function")})}return n.workerModuleData={isWorkerModule:!0,id:e,name:a,dependencies:r,init:Ye(d),getTransferables:h&&Ye(h)},n}function mr(f){ze[f]&&ze[f].forEach(function(r){r()}),We[f]&&(We[f].terminate(),delete We[f])}function Ye(f){var r=f.toString();return!/^function/.test(r)&&/^\w+\s*\(/.test(r)&&(r="function "+r),r}function yr(f){var r=We[f];if(!r){var d=Ye(hr);r=We[f]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+f.replace(/\*/g,"")+` **/
8
+
9
+ ;(`+d+")()"],{type:"application/javascript"}))),r.onmessage=function(h){var t=h.data,e=t.messageId,a=lt[e];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete lt[e],a(t)}}return r}function St(f,r,d){return new Promise(function(h,t){var e=++gr;lt[e]=function(a){a.success?h(a.result):t(new Error("Error in worker "+r+" call: "+a.error))},yr(f).postMessage({messageId:e,action:r,data:d})})}const Et=/\bvoid\s+main\s*\(\s*\)\s*{/g;function ut(f){const r=/^[ \t]*#include +<([\w\d./]+)>/gm;function d(h,t){let e=dr[t];return e?ut(e):h}return f.replace(r,d)}const se=[];for(let f=0;f<256;f++)se[f]=(f<16?"0":"")+f.toString(16);function br(){const f=Math.random()*4294967295|0,r=Math.random()*4294967295|0,d=Math.random()*4294967295|0,h=Math.random()*4294967295|0;return(se[f&255]+se[f>>8&255]+se[f>>16&255]+se[f>>24&255]+"-"+se[r&255]+se[r>>8&255]+"-"+se[r>>16&15|64]+se[r>>24&255]+"-"+se[d&63|128]+se[d>>8&255]+"-"+se[d>>16&255]+se[d>>24&255]+se[h&255]+se[h>>8&255]+se[h>>16&255]+se[h>>24&255]).toUpperCase()}const Me=Object.assign||function(){let f=arguments[0];for(let r=1,d=arguments.length;r<d;r++){let h=arguments[r];if(h)for(let t in h)Object.prototype.hasOwnProperty.call(h,t)&&(f[t]=h[t])}return f},Sr=Date.now(),Ut=new WeakMap,kt=new Map;let Ur=1e10;function ft(f,r){const d=xr(r);let h=Ut.get(f);if(h||Ut.set(f,h=Object.create(null)),h[d])return new h[d];const t=`_onBeforeCompile${d}`,e=function(i,s){f.onBeforeCompile.call(this,i,s);const l=this.customProgramCacheKey()+"|"+i.vertexShader+"|"+i.fragmentShader;let u=kt[l];if(!u){const c=kr(this,i,r,d);u=kt[l]=c}i.vertexShader=u.vertexShader,i.fragmentShader=u.fragmentShader,Me(i.uniforms,this.uniforms),r.timeUniform&&(i.uniforms[r.timeUniform]={get value(){return Date.now()-Sr}}),this[t]&&this[t](i)},a=function(){return o(r.chained?f:f.clone())},o=function(i){const s=Object.create(i,n);return Object.defineProperty(s,"baseMaterial",{value:f}),Object.defineProperty(s,"id",{value:Ur++}),s.uuid=br(),s.uniforms=Me({},i.uniforms,r.uniforms),s.defines=Me({},i.defines,r.defines),s.defines[`TROIKA_DERIVED_MATERIAL_${d}`]="",s.extensions=Me({},i.extensions,r.extensions),s._listeners=void 0,s},n={constructor:{value:a},isDerivedMaterial:{value:!0},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return f.customProgramCacheKey()+"|"+d}},onBeforeCompile:{get(){return e},set(i){this[t]=i}},copy:{writable:!0,configurable:!0,value:function(i){return f.copy.call(this,i),!f.isShaderMaterial&&!f.isDerivedMaterial&&(Me(this.extensions,i.extensions),Me(this.defines,i.defines),Me(this.uniforms,lr.clone(i.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const i=new f.constructor;return o(i).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let i=this._depthMaterial;return i||(i=this._depthMaterial=ft(f.isDerivedMaterial?f.getDepthMaterial():new ur({depthPacking:fr}),r),i.defines.IS_DEPTH_MATERIAL="",i.uniforms=this.uniforms),i}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let i=this._distanceMaterial;return i||(i=this._distanceMaterial=ft(f.isDerivedMaterial?f.getDistanceMaterial():new cr,r),i.defines.IS_DISTANCE_MATERIAL="",i.uniforms=this.uniforms),i}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:i,_distanceMaterial:s}=this;i&&i.dispose(),s&&s.dispose(),f.dispose.call(this)}}};return h[d]=a,new a}function kr(f,{vertexShader:r,fragmentShader:d},h,t){let{vertexDefs:e,vertexMainIntro:a,vertexMainOutro:o,vertexTransform:n,fragmentDefs:i,fragmentMainIntro:s,fragmentMainOutro:l,fragmentColorTransform:u,customRewriter:c,timeUniform:m}=h;if(e=e||"",a=a||"",o=o||"",i=i||"",s=s||"",l=l||"",(n||c)&&(r=ut(r)),(u||c)&&(d=d.replace(/^[ \t]*#include <((?:tonemapping|encodings|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
10
+ //!BEGIN_POST_CHUNK $1
11
+ $&
12
+ //!END_POST_CHUNK
13
+ `),d=ut(d)),c){let g=c({vertexShader:r,fragmentShader:d});r=g.vertexShader,d=g.fragmentShader}if(u){let g=[];d=d.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,v=>(g.push(v),"")),l=`${u}
14
+ ${g.join(`
15
+ `)}
16
+ ${l}`}if(m){const g=`
17
+ uniform float ${m};
18
+ `;e=g+e,i=g+i}return n&&(r=`vec3 troika_position_${t};
19
+ vec3 troika_normal_${t};
20
+ vec2 troika_uv_${t};
21
+ ${r}
22
+ `,e=`${e}
23
+ void troikaVertexTransform${t}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
24
+ ${n}
25
+ }
26
+ `,a=`
27
+ troika_position_${t} = vec3(position);
28
+ troika_normal_${t} = vec3(normal);
29
+ troika_uv_${t} = vec2(uv);
30
+ troikaVertexTransform${t}(troika_position_${t}, troika_normal_${t}, troika_uv_${t});
31
+ ${a}
32
+ `,r=r.replace(/\b(position|normal|uv)\b/g,(g,v,k,p)=>/\battribute\s+vec[23]\s+$/.test(p.substr(0,k))?v:`troika_${v}_${t}`),f.map&&f.map.channel>0||(r=r.replace(/\bMAP_UV\b/g,`troika_uv_${t}`))),r=Tt(r,t,e,a,o),d=Tt(d,t,i,s,l),{vertexShader:r,fragmentShader:d}}function Tt(f,r,d,h,t){return(h||t||d)&&(f=f.replace(Et,`
33
+ ${d}
34
+ void troikaOrigMain${r}() {`),f+=`
35
+ void main() {
36
+ ${h}
37
+ troikaOrigMain${r}();
38
+ ${t}
39
+ }`),f}function Tr(f,r){return f==="uniforms"?void 0:typeof r=="function"?r.toString():r}let wr=0;const wt=new Map;function xr(f){const r=JSON.stringify(f,Tr);let d=wt.get(r);return d==null&&wt.set(r,d=++wr),d}function _r(f,r,d){const{defaultFontURL:h}=d,t=Object.create(null),e=1/0,a=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,o="[^\\S\\u00A0]",n=new RegExp(`${o}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function i(p,S){function T(){const b=U=>{console.error(`Failure loading font ${p}${p===h?"":"; trying fallback"}`,U),p!==h&&(p=h,T())};try{const U=new XMLHttpRequest;U.open("get",p,!0),U.responseType="arraybuffer",U.onload=function(){if(U.status>=400)b(new Error(U.statusText));else if(U.status>0)try{const x=f(U.response);S(x)}catch(x){b(x)}},U.onerror=b,U.send()}catch(U){b(U)}}T()}function s(p,S){p||(p=h);let T=t[p];T?T.pending?T.pending.push(S):S(T):(t[p]={pending:[S]},i(p,b=>{let U=t[p].pending;t[p]=b,U.forEach(x=>x(b))}))}function l({text:p="",font:S=h,sdfGlyphSize:T=64,fontSize:b=1,letterSpacing:U=0,lineHeight:x="normal",maxWidth:w=e,direction:A,textAlign:M="left",textIndent:B=0,whiteSpace:y="normal",overflowWrap:C="normal",anchorX:_=0,anchorY:F=0,includeCaretPositions:D=!1,chunkedBoundsSize:P=8192,colorRanges:I=null},W,J=!1){const O=g(),E={fontLoad:0,typesetting:0};p.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),p=p.replace(/\r\n/g,`
40
+ `).replace(/\r/g,`
41
+ `)),b=+b,U=+U,w=+w,x=x||"normal",B=+B,s(S,R=>{const $=isFinite(w);let K=null,Z=null,ae=null,H=null,Y=null,V=null,G=null,z=0,ce=0,re=y!=="nowrap";const{ascender:N,descender:ne,unitsPerEm:Be,lineGap:tt,capHeight:Ne,xHeight:ge}=R;E.fontLoad=g()-O;const je=g(),X=b/Be;x==="normal"&&(x=(N-ne+tt)/Be),x=x*b;const Oe=(x-(N-ne)*X)/2,xe=-(N*X+Oe),Se=Math.min(x,(N-ne)*X),rt=(N+ne)/2*X-Se/2;let _e=B,le=new v;const he=[le];R.forEachGlyph(p,b,U,(L,ue,ke)=>{const j=p.charAt(ke),ee=L.advanceWidth*X,ie=le.count;let fe;if("isEmpty"in L||(L.isWhitespace=!!j&&new RegExp(o).test(j),L.canBreakAfter=!!j&&n.test(j),L.isEmpty=L.xMin===L.xMax||L.yMin===L.yMax||a.test(j)),!L.isWhitespace&&!L.isEmpty&&ce++,re&&$&&!L.isWhitespace&&ue+ee+_e>w&&ie){if(le.glyphAt(ie-1).glyphObj.canBreakAfter)fe=new v,_e=-ue;else for(let Re=ie;Re--;)if(Re===0&&C==="break-word"){fe=new v,_e=-ue;break}else if(le.glyphAt(Re).glyphObj.canBreakAfter){fe=le.splitAt(Re+1);const ye=fe.glyphAt(0).x;_e-=ye;for(let Pe=fe.count;Pe--;)fe.glyphAt(Pe).x-=ye;break}fe&&(le.isSoftWrapped=!0,le=fe,he.push(le),z=w)}let Q=le.glyphAt(le.count);Q.glyphObj=L,Q.x=ue+_e,Q.width=ee,Q.charIndex=ke,j===`
42
+ `&&(le=new v,he.push(le),_e=-(ue+ee+U*b)+B)}),he.forEach(L=>{for(let ue=L.count;ue--;){let{glyphObj:ke,x:j,width:ee}=L.glyphAt(ue);if(!ke.isWhitespace){L.width=j+ee,L.width>z&&(z=L.width);return}}});let Ue=0,me=0;if(_&&(typeof _=="number"?Ue=-_:typeof _=="string"&&(Ue=-z*(_==="left"?0:_==="center"?.5:_==="right"?1:c(_)))),F){if(typeof F=="number")me=-F;else if(typeof F=="string"){let L=he.length*x;me=F==="top"?0:F==="top-baseline"?-xe:F==="top-cap"?-xe-Ne*X:F==="top-ex"?-xe-ge*X:F==="middle"?L/2:F==="bottom"?L:F==="bottom-baseline"?L-Oe+ne*X:c(F)*L}}if(!J){const L=r.getEmbeddingLevels(p,A);K=new Uint16Array(ce),Z=new Float32Array(ce*2),ae={},V=[e,e,-e,-e],G=[];let ue=xe;D&&(Y=new Float32Array(p.length*3)),I&&(H=new Uint8Array(ce*3));let ke=0,j=-1,ee=-1,ie,fe;if(he.forEach((Q,Re)=>{let{count:ye,width:Pe}=Q;if(ye>0){let $e=0;for(let oe=ye;oe--&&Q.glyphAt(oe).glyphObj.isWhitespace;)$e++;let He=0,Ee=0;if(M==="center")He=(z-Pe)/2;else if(M==="right")He=z-Pe;else if(M==="justify"&&Q.isSoftWrapped){let oe=0;for(let te=ye-$e;te--;)Q.glyphAt(te).glyphObj.isWhitespace&&oe++;Ee=(z-Pe)/oe}if(Ee||He){let oe=0;for(let te=0;te<ye;te++){let Te=Q.glyphAt(te);const we=Te.glyphObj;Te.x+=He+oe,Ee!==0&&we.isWhitespace&&te<ye-$e&&(oe+=Ee,Te.width+=Ee)}}const mt=r.getReorderSegments(p,L,Q.glyphAt(0).charIndex,Q.glyphAt(Q.count-1).charIndex);for(let oe=0;oe<mt.length;oe++){const[te,Te]=mt[oe];let we=1/0,q=-1/0;for(let be=0;be<ye;be++)if(Q.glyphAt(be).charIndex>=te){let Ce=be,pe=be;for(;pe<ye;pe++){let ve=Q.glyphAt(pe);if(ve.charIndex>Te)break;pe<ye-$e&&(we=Math.min(we,ve.x),q=Math.max(q,ve.x+ve.width))}for(let ve=Ce;ve<pe;ve++){const Fe=Q.glyphAt(ve);Fe.x=q-(Fe.x+Fe.width-we)}break}}let de;const qt=oe=>de=oe;for(let oe=0;oe<ye;oe++){let te=Q.glyphAt(oe);de=te.glyphObj;const Te=de.index,we=L.levels[te.charIndex]&1;if(we){const q=r.getMirroredCharacter(p[te.charIndex]);q&&R.forEachGlyph(q,0,0,qt)}if(D){const{charIndex:q}=te,be=te.x+Ue,Ce=te.x+te.width+Ue;Y[q*3]=we?Ce:be,Y[q*3+1]=we?be:Ce,Y[q*3+2]=ue+rt+me;const pe=q-j;pe>1&&m(Y,j,pe),j=q}if(I){const{charIndex:q}=te;for(;q>ee;)ee++,I.hasOwnProperty(ee)&&(fe=I[ee])}if(!de.isWhitespace&&!de.isEmpty){const q=ke++;ae[Te]||(ae[Te]={path:de.path,pathBounds:[de.xMin,de.yMin,de.xMax,de.yMax]});const be=te.x+Ue,Ce=ue+me;Z[q*2]=be,Z[q*2+1]=Ce;const pe=be+de.xMin*X,ve=Ce+de.yMin*X,Fe=be+de.xMax*X,Xe=Ce+de.yMax*X;pe<V[0]&&(V[0]=pe),ve<V[1]&&(V[1]=ve),Fe>V[2]&&(V[2]=Fe),Xe>V[3]&&(V[3]=Xe),q%P===0&&(ie={start:q,end:q,rect:[e,e,-e,-e]},G.push(ie)),ie.end++;const De=ie.rect;if(pe<De[0]&&(De[0]=pe),ve<De[1]&&(De[1]=ve),Fe>De[2]&&(De[2]=Fe),Xe>De[3]&&(De[3]=Xe),K[q]=Te,I){const nt=q*3;H[nt]=fe>>16&255,H[nt+1]=fe>>8&255,H[nt+2]=fe&255}}}}ue-=x}),Y){const Q=p.length-j;Q>1&&m(Y,j,Q)}}E.typesetting=g()-je,W({glyphIds:K,glyphPositions:Z,glyphData:ae,caretPositions:Y,caretHeight:Se,glyphColors:H,chunkedBounds:G,fontSize:b,unitsPerEm:Be,ascender:N*X,descender:ne*X,capHeight:Ne*X,xHeight:ge*X,lineHeight:x,topBaseline:xe,blockBounds:[Ue,me-he.length*x,Ue+z,me],visibleBounds:V,timings:E})})}function u(p,S){l(p,T=>{const[b,U,x,w]=T.blockBounds;S({width:x-b,height:w-U})},{metricsOnly:!0})}function c(p){let S=p.match(/^([\d.]+)%$/),T=S?parseFloat(S[1]):NaN;return isNaN(T)?0:T/100}function m(p,S,T){const b=p[S*3],U=p[S*3+1],x=p[S*3+2],w=(U-b)/T;for(let A=0;A<T;A++){const M=(S+A)*3;p[M]=b+w*A,p[M+1]=b+w*(A+1),p[M+2]=x}}function g(){return(self.performance||Date).now()}function v(){this.data=[]}const k=["glyphObj","x","width","charIndex"];return v.prototype={width:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/k.length)},glyphAt(p){let S=v.flyweight;return S.data=this.data,S.index=p,S},splitAt(p){let S=new v;return S.data=this.data.splice(p*k.length),S}},v.flyweight=k.reduce((p,S,T,b)=>(Object.defineProperty(p,S,{get(){return this.data[this.index*k.length+T]},set(U){this.data[this.index*k.length+T]=U}}),p),{data:null,index:0}),{typeset:l,measure:u,loadFont:s}}const Ge=()=>(self.performance||Date).now(),et=It();let xt;function Cr(f,r,d,h,t,e,a,o,n,i,s=!0){return s?Dr(f,r,d,h,t,e,a,o,n,i).then(null,l=>(xt||(console.warn("WebGL SDF generation failed, falling back to JS",l),xt=!0),Ct(f,r,d,h,t,e,a,o,n,i))):Ct(f,r,d,h,t,e,a,o,n,i)}const Ke=[],Fr=5;let ct=0;function Lt(){const f=Ge();for(;Ke.length&&Ge()-f<Fr;)Ke.shift()();ct=Ke.length?setTimeout(Lt,0):0}const Dr=(...f)=>new Promise((r,d)=>{Ke.push(()=>{const h=Ge();try{et.webgl.generateIntoCanvas(...f),r({timing:Ge()-h})}catch(t){d(t)}}),ct||(ct=setTimeout(Lt,0))}),Or=4,Mr=2e3,_t={};let Ar=0;function Ct(f,r,d,h,t,e,a,o,n,i){const s="TroikaTextSDFGenerator_JS_"+Ar++%Or;let l=_t[s];return l||(l=_t[s]={workerModule:Ve({name:s,workerId:s,dependencies:[It,Ge],init(u,c){const m=u().javascript.generate;return function(...g){const v=c();return{textureData:m(...g),timing:c()-v}}},getTransferables(u){return[u.textureData.buffer]}}),requests:0,idleTimer:null}),l.requests++,clearTimeout(l.idleTimer),l.workerModule(f,r,d,h,t,e).then(({textureData:u,timing:c})=>{const m=Ge(),g=new Uint8Array(u.length*4);for(let v=0;v<u.length;v++)g[v*4+i]=u[v];return et.webglUtils.renderImageData(a,g,o,n,f,r,1<<3-i),c+=Ge()-m,--l.requests===0&&(l.idleTimer=setTimeout(()=>{mr(s)},Mr)),{timing:c}})}function Gr(f){f._warm||(et.webgl.isSupported(f),f._warm=!0)}const Br=et.webglUtils.resizeWebGLCanvasWithoutClearing;/*!
43
+ Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering.
44
+ Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE
45
+ */function Pr(){return typeof window>"u"&&(self.window=self),function(f){var r={parse:function(t){var e=r._bin,a=new Uint8Array(t);if(e.readASCII(a,0,4)=="ttcf"){var o=4;e.readUshort(a,o),o+=2,e.readUshort(a,o),o+=2;var n=e.readUint(a,o);o+=4;for(var i=[],s=0;s<n;s++){var l=e.readUint(a,o);o+=4,i.push(r._readFont(a,l))}return i}return[r._readFont(a,0)]},_readFont:function(t,e){var a=r._bin,o=e;a.readFixed(t,e),e+=4;var n=a.readUshort(t,e);e+=2,a.readUshort(t,e),e+=2,a.readUshort(t,e),e+=2,a.readUshort(t,e),e+=2;for(var i=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GPOS","GSUB","SVG "],s={_data:t,_offset:o},l={},u=0;u<n;u++){var c=a.readASCII(t,e,4);e+=4,a.readUint(t,e),e+=4;var m=a.readUint(t,e);e+=4;var g=a.readUint(t,e);e+=4,l[c]={offset:m,length:g}}for(u=0;u<i.length;u++){var v=i[u];l[v]&&(s[v.trim()]=r[v.trim()].parse(t,l[v].offset,l[v].length,s))}return s},_tabOffset:function(t,e,a){for(var o=r._bin,n=o.readUshort(t,a+4),i=a+12,s=0;s<n;s++){var l=o.readASCII(t,i,4);i+=4,o.readUint(t,i),i+=4;var u=o.readUint(t,i);if(i+=4,o.readUint(t,i),i+=4,l==e)return u}return 0}};r._bin={readFixed:function(t,e){return(t[e]<<8|t[e+1])+(t[e+2]<<8|t[e+3])/65540},readF2dot14:function(t,e){return r._bin.readShort(t,e)/16384},readInt:function(t,e){return r._bin._view(t).getInt32(e)},readInt8:function(t,e){return r._bin._view(t).getInt8(e)},readShort:function(t,e){return r._bin._view(t).getInt16(e)},readUshort:function(t,e){return r._bin._view(t).getUint16(e)},readUshorts:function(t,e,a){for(var o=[],n=0;n<a;n++)o.push(r._bin.readUshort(t,e+2*n));return o},readUint:function(t,e){return r._bin._view(t).getUint32(e)},readUint64:function(t,e){return 4294967296*r._bin.readUint(t,e)+r._bin.readUint(t,e+4)},readASCII:function(t,e,a){for(var o="",n=0;n<a;n++)o+=String.fromCharCode(t[e+n]);return o},readUnicode:function(t,e,a){for(var o="",n=0;n<a;n++){var i=t[e++]<<8|t[e++];o+=String.fromCharCode(i)}return o},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(t,e,a){var o=r._bin._tdec;return o&&e==0&&a==t.length?o.decode(t):r._bin.readASCII(t,e,a)},readBytes:function(t,e,a){for(var o=[],n=0;n<a;n++)o.push(t[e+n]);return o},readASCIIArray:function(t,e,a){for(var o=[],n=0;n<a;n++)o.push(String.fromCharCode(t[e+n]));return o},_view:function(t){return t._dataView||(t._dataView=t.buffer?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(new Uint8Array(t).buffer))}},r._lctf={},r._lctf.parse=function(t,e,a,o,n){var i=r._bin,s={},l=e;i.readFixed(t,e),e+=4;var u=i.readUshort(t,e);e+=2;var c=i.readUshort(t,e);e+=2;var m=i.readUshort(t,e);return e+=2,s.scriptList=r._lctf.readScriptList(t,l+u),s.featureList=r._lctf.readFeatureList(t,l+c),s.lookupList=r._lctf.readLookupList(t,l+m,n),s},r._lctf.readLookupList=function(t,e,a){var o=r._bin,n=e,i=[],s=o.readUshort(t,e);e+=2;for(var l=0;l<s;l++){var u=o.readUshort(t,e);e+=2;var c=r._lctf.readLookupTable(t,n+u,a);i.push(c)}return i},r._lctf.readLookupTable=function(t,e,a){var o=r._bin,n=e,i={tabs:[]};i.ltype=o.readUshort(t,e),e+=2,i.flag=o.readUshort(t,e),e+=2;var s=o.readUshort(t,e);e+=2;for(var l=i.ltype,u=0;u<s;u++){var c=o.readUshort(t,e);e+=2;var m=a(t,l,n+c,i);i.tabs.push(m)}return i},r._lctf.numOfOnes=function(t){for(var e=0,a=0;a<32;a++)t>>>a&1&&e++;return e},r._lctf.readClassDef=function(t,e){var a=r._bin,o=[],n=a.readUshort(t,e);if(e+=2,n==1){var i=a.readUshort(t,e);e+=2;var s=a.readUshort(t,e);e+=2;for(var l=0;l<s;l++)o.push(i+l),o.push(i+l),o.push(a.readUshort(t,e)),e+=2}if(n==2){var u=a.readUshort(t,e);for(e+=2,l=0;l<u;l++)o.push(a.readUshort(t,e)),e+=2,o.push(a.readUshort(t,e)),e+=2,o.push(a.readUshort(t,e)),e+=2}return o},r._lctf.getInterval=function(t,e){for(var a=0;a<t.length;a+=3){var o=t[a],n=t[a+1];if(t[a+2],o<=e&&e<=n)return a}return-1},r._lctf.readCoverage=function(t,e){var a=r._bin,o={};o.fmt=a.readUshort(t,e),e+=2;var n=a.readUshort(t,e);return e+=2,o.fmt==1&&(o.tab=a.readUshorts(t,e,n)),o.fmt==2&&(o.tab=a.readUshorts(t,e,3*n)),o},r._lctf.coverageIndex=function(t,e){var a=t.tab;if(t.fmt==1)return a.indexOf(e);if(t.fmt==2){var o=r._lctf.getInterval(a,e);if(o!=-1)return a[o+2]+(e-a[o])}return-1},r._lctf.readFeatureList=function(t,e){var a=r._bin,o=e,n=[],i=a.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var l=a.readASCII(t,e,4);e+=4;var u=a.readUshort(t,e);e+=2;var c=r._lctf.readFeatureTable(t,o+u);c.tag=l.trim(),n.push(c)}return n},r._lctf.readFeatureTable=function(t,e){var a=r._bin,o=e,n={},i=a.readUshort(t,e);e+=2,i>0&&(n.featureParams=o+i);var s=a.readUshort(t,e);e+=2,n.tab=[];for(var l=0;l<s;l++)n.tab.push(a.readUshort(t,e+2*l));return n},r._lctf.readScriptList=function(t,e){var a=r._bin,o=e,n={},i=a.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var l=a.readASCII(t,e,4);e+=4;var u=a.readUshort(t,e);e+=2,n[l.trim()]=r._lctf.readScriptTable(t,o+u)}return n},r._lctf.readScriptTable=function(t,e){var a=r._bin,o=e,n={},i=a.readUshort(t,e);e+=2,n.default=r._lctf.readLangSysTable(t,o+i);var s=a.readUshort(t,e);e+=2;for(var l=0;l<s;l++){var u=a.readASCII(t,e,4);e+=4;var c=a.readUshort(t,e);e+=2,n[u.trim()]=r._lctf.readLangSysTable(t,o+c)}return n},r._lctf.readLangSysTable=function(t,e){var a=r._bin,o={};a.readUshort(t,e),e+=2,o.reqFeature=a.readUshort(t,e),e+=2;var n=a.readUshort(t,e);return e+=2,o.features=a.readUshorts(t,e,n),o},r.CFF={},r.CFF.parse=function(t,e,a){var o=r._bin;(t=new Uint8Array(t.buffer,e,a))[e=0],t[++e],t[++e],t[++e],e++;var n=[];e=r.CFF.readIndex(t,e,n);for(var i=[],s=0;s<n.length-1;s++)i.push(o.readASCII(t,e+n[s],n[s+1]-n[s]));e+=n[n.length-1];var l=[];e=r.CFF.readIndex(t,e,l);var u=[];for(s=0;s<l.length-1;s++)u.push(r.CFF.readDict(t,e+l[s],e+l[s+1]));e+=l[l.length-1];var c=u[0],m=[];e=r.CFF.readIndex(t,e,m);var g=[];for(s=0;s<m.length-1;s++)g.push(o.readASCII(t,e+m[s],m[s+1]-m[s]));if(e+=m[m.length-1],r.CFF.readSubrs(t,e,c),c.CharStrings){e=c.CharStrings,m=[],e=r.CFF.readIndex(t,e,m);var v=[];for(s=0;s<m.length-1;s++)v.push(o.readBytes(t,e+m[s],m[s+1]-m[s]));c.CharStrings=v}if(c.ROS){e=c.FDArray;var k=[];for(e=r.CFF.readIndex(t,e,k),c.FDArray=[],s=0;s<k.length-1;s++){var p=r.CFF.readDict(t,e+k[s],e+k[s+1]);r.CFF._readFDict(t,p,g),c.FDArray.push(p)}e+=k[k.length-1],e=c.FDSelect,c.FDSelect=[];var S=t[e];if(e++,S!=3)throw S;var T=o.readUshort(t,e);for(e+=2,s=0;s<T+1;s++)c.FDSelect.push(o.readUshort(t,e),t[e+2]),e+=3}return c.Encoding&&(c.Encoding=r.CFF.readEncoding(t,c.Encoding,c.CharStrings.length)),c.charset&&(c.charset=r.CFF.readCharset(t,c.charset,c.CharStrings.length)),r.CFF._readFDict(t,c,g),c},r.CFF._readFDict=function(t,e,a){var o;for(var n in e.Private&&(o=e.Private[1],e.Private=r.CFF.readDict(t,o,o+e.Private[0]),e.Private.Subrs&&r.CFF.readSubrs(t,o+e.Private.Subrs,e.Private)),e)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(n)!=-1&&(e[n]=a[e[n]-426+35])},r.CFF.readSubrs=function(t,e,a){var o=r._bin,n=[];e=r.CFF.readIndex(t,e,n);var i,s=n.length;i=s<1240?107:s<33900?1131:32768,a.Bias=i,a.Subrs=[];for(var l=0;l<n.length-1;l++)a.Subrs.push(o.readBytes(t,e+n[l],n[l+1]-n[l]))},r.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],r.CFF.glyphByUnicode=function(t,e){for(var a=0;a<t.charset.length;a++)if(t.charset[a]==e)return a;return-1},r.CFF.glyphBySE=function(t,e){return e<0||e>255?-1:r.CFF.glyphByUnicode(t,r.CFF.tableSE[e])},r.CFF.readEncoding=function(t,e,a){r._bin;var o=[".notdef"],n=t[e];if(e++,n!=0)throw"error: unknown encoding format: "+n;var i=t[e];e++;for(var s=0;s<i;s++)o.push(t[e+s]);return o},r.CFF.readCharset=function(t,e,a){var o=r._bin,n=[".notdef"],i=t[e];if(e++,i==0)for(var s=0;s<a;s++){var l=o.readUshort(t,e);e+=2,n.push(l)}else{if(i!=1&&i!=2)throw"error: format: "+i;for(;n.length<a;){l=o.readUshort(t,e),e+=2;var u=0;for(i==1?(u=t[e],e++):(u=o.readUshort(t,e),e+=2),s=0;s<=u;s++)n.push(l),l++}}return n},r.CFF.readIndex=function(t,e,a){var o=r._bin,n=o.readUshort(t,e)+1,i=t[e+=2];if(e++,i==1)for(var s=0;s<n;s++)a.push(t[e+s]);else if(i==2)for(s=0;s<n;s++)a.push(o.readUshort(t,e+2*s));else if(i==3)for(s=0;s<n;s++)a.push(16777215&o.readUint(t,e+3*s-1));else if(n!=1)throw"unsupported offset size: "+i+", count: "+n;return(e+=n*i)-1},r.CFF.getCharString=function(t,e,a){var o=r._bin,n=t[e],i=t[e+1];t[e+2],t[e+3],t[e+4];var s=1,l=null,u=null;n<=20&&(l=n,s=1),n==12&&(l=100*n+i,s=2),21<=n&&n<=27&&(l=n,s=1),n==28&&(u=o.readShort(t,e+1),s=3),29<=n&&n<=31&&(l=n,s=1),32<=n&&n<=246&&(u=n-139,s=1),247<=n&&n<=250&&(u=256*(n-247)+i+108,s=2),251<=n&&n<=254&&(u=256*-(n-251)-i-108,s=2),n==255&&(u=o.readInt(t,e+1)/65535,s=5),a.val=u??"o"+l,a.size=s},r.CFF.readCharString=function(t,e,a){for(var o=e+a,n=r._bin,i=[];e<o;){var s=t[e],l=t[e+1];t[e+2],t[e+3],t[e+4];var u=1,c=null,m=null;s<=20&&(c=s,u=1),s==12&&(c=100*s+l,u=2),s!=19&&s!=20||(c=s,u=2),21<=s&&s<=27&&(c=s,u=1),s==28&&(m=n.readShort(t,e+1),u=3),29<=s&&s<=31&&(c=s,u=1),32<=s&&s<=246&&(m=s-139,u=1),247<=s&&s<=250&&(m=256*(s-247)+l+108,u=2),251<=s&&s<=254&&(m=256*-(s-251)-l-108,u=2),s==255&&(m=n.readInt(t,e+1)/65535,u=5),i.push(m??"o"+c),e+=u}return i},r.CFF.readDict=function(t,e,a){for(var o=r._bin,n={},i=[];e<a;){var s=t[e],l=t[e+1];t[e+2],t[e+3],t[e+4];var u=1,c=null,m=null;if(s==28&&(m=o.readShort(t,e+1),u=3),s==29&&(m=o.readInt(t,e+1),u=5),32<=s&&s<=246&&(m=s-139,u=1),247<=s&&s<=250&&(m=256*(s-247)+l+108,u=2),251<=s&&s<=254&&(m=256*-(s-251)-l-108,u=2),s==255)throw m=o.readInt(t,e+1)/65535,u=5,"unknown number";if(s==30){var g=[];for(u=1;;){var v=t[e+u];u++;var k=v>>4,p=15&v;if(k!=15&&g.push(k),p!=15&&g.push(p),p==15)break}for(var S="",T=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],b=0;b<g.length;b++)S+=T[g[b]];m=parseFloat(S)}s<=21&&(c=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][s],u=1,s==12&&(c=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][l],u=2)),c!=null?(n[c]=i.length==1?i[0]:i,i=[]):i.push(m),e+=u}return n},r.cmap={},r.cmap.parse=function(t,e,a){t=new Uint8Array(t.buffer,e,a),e=0;var o=r._bin,n={};o.readUshort(t,e),e+=2;var i=o.readUshort(t,e);e+=2;var s=[];n.tables=[];for(var l=0;l<i;l++){var u=o.readUshort(t,e);e+=2;var c=o.readUshort(t,e);e+=2;var m=o.readUint(t,e);e+=4;var g="p"+u+"e"+c,v=s.indexOf(m);if(v==-1){var k;v=n.tables.length,s.push(m);var p=o.readUshort(t,m);p==0?k=r.cmap.parse0(t,m):p==4?k=r.cmap.parse4(t,m):p==6?k=r.cmap.parse6(t,m):p==12?k=r.cmap.parse12(t,m):console.debug("unknown format: "+p,u,c,m),n.tables.push(k)}if(n[g]!=null)throw"multiple tables for one platform+encoding";n[g]=v}return n},r.cmap.parse0=function(t,e){var a=r._bin,o={};o.format=a.readUshort(t,e),e+=2;var n=a.readUshort(t,e);e+=2,a.readUshort(t,e),e+=2,o.map=[];for(var i=0;i<n-6;i++)o.map.push(t[e+i]);return o},r.cmap.parse4=function(t,e){var a=r._bin,o=e,n={};n.format=a.readUshort(t,e),e+=2;var i=a.readUshort(t,e);e+=2,a.readUshort(t,e),e+=2;var s=a.readUshort(t,e);e+=2;var l=s/2;n.searchRange=a.readUshort(t,e),e+=2,n.entrySelector=a.readUshort(t,e),e+=2,n.rangeShift=a.readUshort(t,e),e+=2,n.endCount=a.readUshorts(t,e,l),e+=2*l,e+=2,n.startCount=a.readUshorts(t,e,l),e+=2*l,n.idDelta=[];for(var u=0;u<l;u++)n.idDelta.push(a.readShort(t,e)),e+=2;for(n.idRangeOffset=a.readUshorts(t,e,l),e+=2*l,n.glyphIdArray=[];e<o+i;)n.glyphIdArray.push(a.readUshort(t,e)),e+=2;return n},r.cmap.parse6=function(t,e){var a=r._bin,o={};o.format=a.readUshort(t,e),e+=2,a.readUshort(t,e),e+=2,a.readUshort(t,e),e+=2,o.firstCode=a.readUshort(t,e),e+=2;var n=a.readUshort(t,e);e+=2,o.glyphIdArray=[];for(var i=0;i<n;i++)o.glyphIdArray.push(a.readUshort(t,e)),e+=2;return o},r.cmap.parse12=function(t,e){var a=r._bin,o={};o.format=a.readUshort(t,e),e+=2,e+=2,a.readUint(t,e),e+=4,a.readUint(t,e),e+=4;var n=a.readUint(t,e);e+=4,o.groups=[];for(var i=0;i<n;i++){var s=e+12*i,l=a.readUint(t,s+0),u=a.readUint(t,s+4),c=a.readUint(t,s+8);o.groups.push([l,u,c])}return o},r.glyf={},r.glyf.parse=function(t,e,a,o){for(var n=[],i=0;i<o.maxp.numGlyphs;i++)n.push(null);return n},r.glyf._parseGlyf=function(t,e){var a=r._bin,o=t._data,n=r._tabOffset(o,"glyf",t._offset)+t.loca[e];if(t.loca[e]==t.loca[e+1])return null;var i={};if(i.noc=a.readShort(o,n),n+=2,i.xMin=a.readShort(o,n),n+=2,i.yMin=a.readShort(o,n),n+=2,i.xMax=a.readShort(o,n),n+=2,i.yMax=a.readShort(o,n),n+=2,i.xMin>=i.xMax||i.yMin>=i.yMax)return null;if(i.noc>0){i.endPts=[];for(var s=0;s<i.noc;s++)i.endPts.push(a.readUshort(o,n)),n+=2;var l=a.readUshort(o,n);if(n+=2,o.length-n<l)return null;i.instructions=a.readBytes(o,n,l),n+=l;var u=i.endPts[i.noc-1]+1;for(i.flags=[],s=0;s<u;s++){var c=o[n];if(n++,i.flags.push(c),(8&c)!=0){var m=o[n];n++;for(var g=0;g<m;g++)i.flags.push(c),s++}}for(i.xs=[],s=0;s<u;s++){var v=(2&i.flags[s])!=0,k=(16&i.flags[s])!=0;v?(i.xs.push(k?o[n]:-o[n]),n++):k?i.xs.push(0):(i.xs.push(a.readShort(o,n)),n+=2)}for(i.ys=[],s=0;s<u;s++)v=(4&i.flags[s])!=0,k=(32&i.flags[s])!=0,v?(i.ys.push(k?o[n]:-o[n]),n++):k?i.ys.push(0):(i.ys.push(a.readShort(o,n)),n+=2);var p=0,S=0;for(s=0;s<u;s++)p+=i.xs[s],S+=i.ys[s],i.xs[s]=p,i.ys[s]=S}else{var T;i.parts=[];do{T=a.readUshort(o,n),n+=2;var b={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(i.parts.push(b),b.glyphIndex=a.readUshort(o,n),n+=2,1&T){var U=a.readShort(o,n);n+=2;var x=a.readShort(o,n);n+=2}else U=a.readInt8(o,n),n++,x=a.readInt8(o,n),n++;2&T?(b.m.tx=U,b.m.ty=x):(b.p1=U,b.p2=x),8&T?(b.m.a=b.m.d=a.readF2dot14(o,n),n+=2):64&T?(b.m.a=a.readF2dot14(o,n),n+=2,b.m.d=a.readF2dot14(o,n),n+=2):128&T&&(b.m.a=a.readF2dot14(o,n),n+=2,b.m.b=a.readF2dot14(o,n),n+=2,b.m.c=a.readF2dot14(o,n),n+=2,b.m.d=a.readF2dot14(o,n),n+=2)}while(32&T);if(256&T){var w=a.readUshort(o,n);for(n+=2,i.instr=[],s=0;s<w;s++)i.instr.push(o[n]),n++}}return i},r.GPOS={},r.GPOS.parse=function(t,e,a,o){return r._lctf.parse(t,e,a,o,r.GPOS.subt)},r.GPOS.subt=function(t,e,a,o){var n=r._bin,i=a,s={};if(s.fmt=n.readUshort(t,a),a+=2,e==1||e==2||e==3||e==7||e==8&&s.fmt<=2){var l=n.readUshort(t,a);a+=2,s.coverage=r._lctf.readCoverage(t,l+i)}if(e==1&&s.fmt==1){var u=n.readUshort(t,a);a+=2;var c=r._lctf.numOfOnes(u);u!=0&&(s.pos=r.GPOS.readValueRecord(t,a,u))}else if(e==2&&s.fmt>=1&&s.fmt<=2){u=n.readUshort(t,a),a+=2;var m=n.readUshort(t,a);a+=2,c=r._lctf.numOfOnes(u);var g=r._lctf.numOfOnes(m);if(s.fmt==1){s.pairsets=[];var v=n.readUshort(t,a);a+=2;for(var k=0;k<v;k++){var p=i+n.readUshort(t,a);a+=2;var S=n.readUshort(t,p);p+=2;for(var T=[],b=0;b<S;b++){var U=n.readUshort(t,p);p+=2,u!=0&&(y=r.GPOS.readValueRecord(t,p,u),p+=2*c),m!=0&&(C=r.GPOS.readValueRecord(t,p,m),p+=2*g),T.push({gid2:U,val1:y,val2:C})}s.pairsets.push(T)}}if(s.fmt==2){var x=n.readUshort(t,a);a+=2;var w=n.readUshort(t,a);a+=2;var A=n.readUshort(t,a);a+=2;var M=n.readUshort(t,a);for(a+=2,s.classDef1=r._lctf.readClassDef(t,i+x),s.classDef2=r._lctf.readClassDef(t,i+w),s.matrix=[],k=0;k<A;k++){var B=[];for(b=0;b<M;b++){var y=null,C=null;u!=0&&(y=r.GPOS.readValueRecord(t,a,u),a+=2*c),m!=0&&(C=r.GPOS.readValueRecord(t,a,m),a+=2*g),B.push({val1:y,val2:C})}s.matrix.push(B)}}}else{if(e==9&&s.fmt==1){var _=n.readUshort(t,a);a+=2;var F=n.readUint(t,a);if(a+=4,o.ltype==9)o.ltype=_;else if(o.ltype!=_)throw"invalid extension substitution";return r.GPOS.subt(t,o.ltype,i+F)}console.debug("unsupported GPOS table LookupType",e,"format",s.fmt)}return s},r.GPOS.readValueRecord=function(t,e,a){var o=r._bin,n=[];return n.push(1&a?o.readShort(t,e):0),e+=1&a?2:0,n.push(2&a?o.readShort(t,e):0),e+=2&a?2:0,n.push(4&a?o.readShort(t,e):0),e+=4&a?2:0,n.push(8&a?o.readShort(t,e):0),e+=8&a?2:0,n},r.GSUB={},r.GSUB.parse=function(t,e,a,o){return r._lctf.parse(t,e,a,o,r.GSUB.subt)},r.GSUB.subt=function(t,e,a,o){var n=r._bin,i=a,s={};if(s.fmt=n.readUshort(t,a),a+=2,e!=1&&e!=4&&e!=5&&e!=6)return null;if(e==1||e==4||e==5&&s.fmt<=2||e==6&&s.fmt<=2){var l=n.readUshort(t,a);a+=2,s.coverage=r._lctf.readCoverage(t,i+l)}if(e==1&&s.fmt>=1&&s.fmt<=2){if(s.fmt==1)s.delta=n.readShort(t,a),a+=2;else if(s.fmt==2){var u=n.readUshort(t,a);a+=2,s.newg=n.readUshorts(t,a,u),a+=2*s.newg.length}}else if(e==4){s.vals=[],u=n.readUshort(t,a),a+=2;for(var c=0;c<u;c++){var m=n.readUshort(t,a);a+=2,s.vals.push(r.GSUB.readLigatureSet(t,i+m))}}else if(e==5&&s.fmt==2){if(s.fmt==2){var g=n.readUshort(t,a);a+=2,s.cDef=r._lctf.readClassDef(t,i+g),s.scset=[];var v=n.readUshort(t,a);for(a+=2,c=0;c<v;c++){var k=n.readUshort(t,a);a+=2,s.scset.push(k==0?null:r.GSUB.readSubClassSet(t,i+k))}}}else if(e==6&&s.fmt==3){if(s.fmt==3){for(c=0;c<3;c++){u=n.readUshort(t,a),a+=2;for(var p=[],S=0;S<u;S++)p.push(r._lctf.readCoverage(t,i+n.readUshort(t,a+2*S)));a+=2*u,c==0&&(s.backCvg=p),c==1&&(s.inptCvg=p),c==2&&(s.ahedCvg=p)}u=n.readUshort(t,a),a+=2,s.lookupRec=r.GSUB.readSubstLookupRecords(t,a,u)}}else{if(e==7&&s.fmt==1){var T=n.readUshort(t,a);a+=2;var b=n.readUint(t,a);if(a+=4,o.ltype==9)o.ltype=T;else if(o.ltype!=T)throw"invalid extension substitution";return r.GSUB.subt(t,o.ltype,i+b)}console.debug("unsupported GSUB table LookupType",e,"format",s.fmt)}return s},r.GSUB.readSubClassSet=function(t,e){var a=r._bin.readUshort,o=e,n=[],i=a(t,e);e+=2;for(var s=0;s<i;s++){var l=a(t,e);e+=2,n.push(r.GSUB.readSubClassRule(t,o+l))}return n},r.GSUB.readSubClassRule=function(t,e){var a=r._bin.readUshort,o={},n=a(t,e),i=a(t,e+=2);e+=2,o.input=[];for(var s=0;s<n-1;s++)o.input.push(a(t,e)),e+=2;return o.substLookupRecords=r.GSUB.readSubstLookupRecords(t,e,i),o},r.GSUB.readSubstLookupRecords=function(t,e,a){for(var o=r._bin.readUshort,n=[],i=0;i<a;i++)n.push(o(t,e),o(t,e+2)),e+=4;return n},r.GSUB.readChainSubClassSet=function(t,e){var a=r._bin,o=e,n=[],i=a.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var l=a.readUshort(t,e);e+=2,n.push(r.GSUB.readChainSubClassRule(t,o+l))}return n},r.GSUB.readChainSubClassRule=function(t,e){for(var a=r._bin,o={},n=["backtrack","input","lookahead"],i=0;i<n.length;i++){var s=a.readUshort(t,e);e+=2,i==1&&s--,o[n[i]]=a.readUshorts(t,e,s),e+=2*o[n[i]].length}return s=a.readUshort(t,e),e+=2,o.subst=a.readUshorts(t,e,2*s),e+=2*o.subst.length,o},r.GSUB.readLigatureSet=function(t,e){var a=r._bin,o=e,n=[],i=a.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var l=a.readUshort(t,e);e+=2,n.push(r.GSUB.readLigature(t,o+l))}return n},r.GSUB.readLigature=function(t,e){var a=r._bin,o={chain:[]};o.nglyph=a.readUshort(t,e),e+=2;var n=a.readUshort(t,e);e+=2;for(var i=0;i<n-1;i++)o.chain.push(a.readUshort(t,e)),e+=2;return o},r.head={},r.head.parse=function(t,e,a){var o=r._bin,n={};return o.readFixed(t,e),e+=4,n.fontRevision=o.readFixed(t,e),e+=4,o.readUint(t,e),e+=4,o.readUint(t,e),e+=4,n.flags=o.readUshort(t,e),e+=2,n.unitsPerEm=o.readUshort(t,e),e+=2,n.created=o.readUint64(t,e),e+=8,n.modified=o.readUint64(t,e),e+=8,n.xMin=o.readShort(t,e),e+=2,n.yMin=o.readShort(t,e),e+=2,n.xMax=o.readShort(t,e),e+=2,n.yMax=o.readShort(t,e),e+=2,n.macStyle=o.readUshort(t,e),e+=2,n.lowestRecPPEM=o.readUshort(t,e),e+=2,n.fontDirectionHint=o.readShort(t,e),e+=2,n.indexToLocFormat=o.readShort(t,e),e+=2,n.glyphDataFormat=o.readShort(t,e),e+=2,n},r.hhea={},r.hhea.parse=function(t,e,a){var o=r._bin,n={};return o.readFixed(t,e),e+=4,n.ascender=o.readShort(t,e),e+=2,n.descender=o.readShort(t,e),e+=2,n.lineGap=o.readShort(t,e),e+=2,n.advanceWidthMax=o.readUshort(t,e),e+=2,n.minLeftSideBearing=o.readShort(t,e),e+=2,n.minRightSideBearing=o.readShort(t,e),e+=2,n.xMaxExtent=o.readShort(t,e),e+=2,n.caretSlopeRise=o.readShort(t,e),e+=2,n.caretSlopeRun=o.readShort(t,e),e+=2,n.caretOffset=o.readShort(t,e),e+=2,e+=8,n.metricDataFormat=o.readShort(t,e),e+=2,n.numberOfHMetrics=o.readUshort(t,e),e+=2,n},r.hmtx={},r.hmtx.parse=function(t,e,a,o){for(var n=r._bin,i={aWidth:[],lsBearing:[]},s=0,l=0,u=0;u<o.maxp.numGlyphs;u++)u<o.hhea.numberOfHMetrics&&(s=n.readUshort(t,e),e+=2,l=n.readShort(t,e),e+=2),i.aWidth.push(s),i.lsBearing.push(l);return i},r.kern={},r.kern.parse=function(t,e,a,o){var n=r._bin,i=n.readUshort(t,e);if(e+=2,i==1)return r.kern.parseV1(t,e-2,a,o);var s=n.readUshort(t,e);e+=2;for(var l={glyph1:[],rval:[]},u=0;u<s;u++){e+=2,a=n.readUshort(t,e),e+=2;var c=n.readUshort(t,e);e+=2;var m=c>>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;e=r.kern.readFormat0(t,e,l)}return l},r.kern.parseV1=function(t,e,a,o){var n=r._bin;n.readFixed(t,e),e+=4;var i=n.readUint(t,e);e+=4;for(var s={glyph1:[],rval:[]},l=0;l<i;l++){n.readUint(t,e),e+=4;var u=n.readUshort(t,e);e+=2,n.readUshort(t,e),e+=2;var c=u>>>8;if((c&=15)!=0)throw"unknown kern table format: "+c;e=r.kern.readFormat0(t,e,s)}return s},r.kern.readFormat0=function(t,e,a){var o=r._bin,n=-1,i=o.readUshort(t,e);e+=2,o.readUshort(t,e),e+=2,o.readUshort(t,e),e+=2,o.readUshort(t,e),e+=2;for(var s=0;s<i;s++){var l=o.readUshort(t,e);e+=2;var u=o.readUshort(t,e);e+=2;var c=o.readShort(t,e);e+=2,l!=n&&(a.glyph1.push(l),a.rval.push({glyph2:[],vals:[]}));var m=a.rval[a.rval.length-1];m.glyph2.push(u),m.vals.push(c),n=l}return e},r.loca={},r.loca.parse=function(t,e,a,o){var n=r._bin,i=[],s=o.head.indexToLocFormat,l=o.maxp.numGlyphs+1;if(s==0)for(var u=0;u<l;u++)i.push(n.readUshort(t,e+(u<<1))<<1);if(s==1)for(u=0;u<l;u++)i.push(n.readUint(t,e+(u<<2)));return i},r.maxp={},r.maxp.parse=function(t,e,a){var o=r._bin,n={},i=o.readUint(t,e);return e+=4,n.numGlyphs=o.readUshort(t,e),e+=2,i==65536&&(n.maxPoints=o.readUshort(t,e),e+=2,n.maxContours=o.readUshort(t,e),e+=2,n.maxCompositePoints=o.readUshort(t,e),e+=2,n.maxCompositeContours=o.readUshort(t,e),e+=2,n.maxZones=o.readUshort(t,e),e+=2,n.maxTwilightPoints=o.readUshort(t,e),e+=2,n.maxStorage=o.readUshort(t,e),e+=2,n.maxFunctionDefs=o.readUshort(t,e),e+=2,n.maxInstructionDefs=o.readUshort(t,e),e+=2,n.maxStackElements=o.readUshort(t,e),e+=2,n.maxSizeOfInstructions=o.readUshort(t,e),e+=2,n.maxComponentElements=o.readUshort(t,e),e+=2,n.maxComponentDepth=o.readUshort(t,e),e+=2),n},r.name={},r.name.parse=function(t,e,a){var o=r._bin,n={};o.readUshort(t,e),e+=2;var i=o.readUshort(t,e);e+=2,o.readUshort(t,e);for(var s,l=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],u=e+=2,c=0;c<i;c++){var m=o.readUshort(t,e);e+=2;var g=o.readUshort(t,e);e+=2;var v=o.readUshort(t,e);e+=2;var k=o.readUshort(t,e);e+=2;var p=o.readUshort(t,e);e+=2;var S=o.readUshort(t,e);e+=2;var T,b=l[k],U=u+12*i+S;if(m==0)T=o.readUnicode(t,U,p/2);else if(m==3&&g==0)T=o.readUnicode(t,U,p/2);else if(g==0)T=o.readASCII(t,U,p);else if(g==1)T=o.readUnicode(t,U,p/2);else if(g==3)T=o.readUnicode(t,U,p/2);else{if(m!=1)throw"unknown encoding "+g+", platformID: "+m;T=o.readASCII(t,U,p),console.debug("reading unknown MAC encoding "+g+" as ASCII")}var x="p"+m+","+v.toString(16);n[x]==null&&(n[x]={}),n[x][b!==void 0?b:k]=T,n[x]._lang=v}for(var w in n)if(n[w].postScriptName!=null&&n[w]._lang==1033)return n[w];for(var w in n)if(n[w].postScriptName!=null&&n[w]._lang==0)return n[w];for(var w in n)if(n[w].postScriptName!=null&&n[w]._lang==3084)return n[w];for(var w in n)if(n[w].postScriptName!=null)return n[w];for(var w in n){s=w;break}return console.debug("returning name table with languageID "+n[s]._lang),n[s]},r["OS/2"]={},r["OS/2"].parse=function(t,e,a){var o=r._bin.readUshort(t,e);e+=2;var n={};if(o==0)r["OS/2"].version0(t,e,n);else if(o==1)r["OS/2"].version1(t,e,n);else if(o==2||o==3||o==4)r["OS/2"].version2(t,e,n);else{if(o!=5)throw"unknown OS/2 table version: "+o;r["OS/2"].version5(t,e,n)}return n},r["OS/2"].version0=function(t,e,a){var o=r._bin;return a.xAvgCharWidth=o.readShort(t,e),e+=2,a.usWeightClass=o.readUshort(t,e),e+=2,a.usWidthClass=o.readUshort(t,e),e+=2,a.fsType=o.readUshort(t,e),e+=2,a.ySubscriptXSize=o.readShort(t,e),e+=2,a.ySubscriptYSize=o.readShort(t,e),e+=2,a.ySubscriptXOffset=o.readShort(t,e),e+=2,a.ySubscriptYOffset=o.readShort(t,e),e+=2,a.ySuperscriptXSize=o.readShort(t,e),e+=2,a.ySuperscriptYSize=o.readShort(t,e),e+=2,a.ySuperscriptXOffset=o.readShort(t,e),e+=2,a.ySuperscriptYOffset=o.readShort(t,e),e+=2,a.yStrikeoutSize=o.readShort(t,e),e+=2,a.yStrikeoutPosition=o.readShort(t,e),e+=2,a.sFamilyClass=o.readShort(t,e),e+=2,a.panose=o.readBytes(t,e,10),e+=10,a.ulUnicodeRange1=o.readUint(t,e),e+=4,a.ulUnicodeRange2=o.readUint(t,e),e+=4,a.ulUnicodeRange3=o.readUint(t,e),e+=4,a.ulUnicodeRange4=o.readUint(t,e),e+=4,a.achVendID=[o.readInt8(t,e),o.readInt8(t,e+1),o.readInt8(t,e+2),o.readInt8(t,e+3)],e+=4,a.fsSelection=o.readUshort(t,e),e+=2,a.usFirstCharIndex=o.readUshort(t,e),e+=2,a.usLastCharIndex=o.readUshort(t,e),e+=2,a.sTypoAscender=o.readShort(t,e),e+=2,a.sTypoDescender=o.readShort(t,e),e+=2,a.sTypoLineGap=o.readShort(t,e),e+=2,a.usWinAscent=o.readUshort(t,e),e+=2,a.usWinDescent=o.readUshort(t,e),e+=2},r["OS/2"].version1=function(t,e,a){var o=r._bin;return e=r["OS/2"].version0(t,e,a),a.ulCodePageRange1=o.readUint(t,e),e+=4,a.ulCodePageRange2=o.readUint(t,e),e+=4},r["OS/2"].version2=function(t,e,a){var o=r._bin;return e=r["OS/2"].version1(t,e,a),a.sxHeight=o.readShort(t,e),e+=2,a.sCapHeight=o.readShort(t,e),e+=2,a.usDefault=o.readUshort(t,e),e+=2,a.usBreak=o.readUshort(t,e),e+=2,a.usMaxContext=o.readUshort(t,e),e+=2},r["OS/2"].version5=function(t,e,a){var o=r._bin;return e=r["OS/2"].version2(t,e,a),a.usLowerOpticalPointSize=o.readUshort(t,e),e+=2,a.usUpperOpticalPointSize=o.readUshort(t,e),e+=2},r.post={},r.post.parse=function(t,e,a){var o=r._bin,n={};return n.version=o.readFixed(t,e),e+=4,n.italicAngle=o.readFixed(t,e),e+=4,n.underlinePosition=o.readShort(t,e),e+=2,n.underlineThickness=o.readShort(t,e),e+=2,n},r==null&&(r={}),r.U==null&&(r.U={}),r.U.codeToGlyph=function(t,e){var a=t.cmap,o=-1;if(a.p0e4!=null?o=a.p0e4:a.p3e1!=null?o=a.p3e1:a.p1e0!=null?o=a.p1e0:a.p0e3!=null&&(o=a.p0e3),o==-1)throw"no familiar platform and encoding!";var n=a.tables[o];if(n.format==0)return e>=n.map.length?0:n.map[e];if(n.format==4){for(var i=-1,s=0;s<n.endCount.length;s++)if(e<=n.endCount[s]){i=s;break}return i==-1||n.startCount[i]>e?0:65535&(n.idRangeOffset[i]!=0?n.glyphIdArray[e-n.startCount[i]+(n.idRangeOffset[i]>>1)-(n.idRangeOffset.length-i)]:e+n.idDelta[i])}if(n.format==12){if(e>n.groups[n.groups.length-1][1])return 0;for(s=0;s<n.groups.length;s++){var l=n.groups[s];if(l[0]<=e&&e<=l[1])return l[2]+(e-l[0])}return 0}throw"unknown cmap table format "+n.format},r.U.glyphToPath=function(t,e){var a={cmds:[],crds:[]};if(t.SVG&&t.SVG.entries[e]){var o=t.SVG.entries[e];return o==null?a:(typeof o=="string"&&(o=r.SVG.toPath(o),t.SVG.entries[e]=o),o)}if(t.CFF){var n={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:t.CFF.Private?t.CFF.Private.defaultWidthX:0,open:!1},i=t.CFF,s=t.CFF.Private;if(i.ROS){for(var l=0;i.FDSelect[l+2]<=e;)l+=2;s=i.FDArray[i.FDSelect[l+1]].Private}r.U._drawCFF(t.CFF.CharStrings[e],n,i,s,a)}else t.glyf&&r.U._drawGlyf(e,t,a);return a},r.U._drawGlyf=function(t,e,a){var o=e.glyf[t];o==null&&(o=e.glyf[t]=r.glyf._parseGlyf(e,t)),o!=null&&(o.noc>-1?r.U._simpleGlyph(o,a):r.U._compoGlyph(o,e,a))},r.U._simpleGlyph=function(t,e){for(var a=0;a<t.noc;a++){for(var o=a==0?0:t.endPts[a-1]+1,n=t.endPts[a],i=o;i<=n;i++){var s=i==o?n:i-1,l=i==n?o:i+1,u=1&t.flags[i],c=1&t.flags[s],m=1&t.flags[l],g=t.xs[i],v=t.ys[i];if(i==o)if(u){if(!c){r.U.P.moveTo(e,g,v);continue}r.U.P.moveTo(e,t.xs[s],t.ys[s])}else c?r.U.P.moveTo(e,t.xs[s],t.ys[s]):r.U.P.moveTo(e,(t.xs[s]+g)/2,(t.ys[s]+v)/2);u?c&&r.U.P.lineTo(e,g,v):m?r.U.P.qcurveTo(e,g,v,t.xs[l],t.ys[l]):r.U.P.qcurveTo(e,g,v,(g+t.xs[l])/2,(v+t.ys[l])/2)}r.U.P.closePath(e)}},r.U._compoGlyph=function(t,e,a){for(var o=0;o<t.parts.length;o++){var n={cmds:[],crds:[]},i=t.parts[o];r.U._drawGlyf(i.glyphIndex,e,n);for(var s=i.m,l=0;l<n.crds.length;l+=2){var u=n.crds[l],c=n.crds[l+1];a.crds.push(u*s.a+c*s.b+s.tx),a.crds.push(u*s.c+c*s.d+s.ty)}for(l=0;l<n.cmds.length;l++)a.cmds.push(n.cmds[l])}},r.U._getGlyphClass=function(t,e){var a=r._lctf.getInterval(e,t);return a==-1?0:e[a+2]},r.U.getPairAdjustment=function(t,e,a){var o=!1;if(t.GPOS)for(var n=t.GPOS,i=n.lookupList,s=n.featureList,l=[],u=0;u<s.length;u++){var c=s[u];if(c.tag=="kern"){o=!0;for(var m=0;m<c.tab.length;m++)if(!l[c.tab[m]]){l[c.tab[m]]=!0;for(var g=i[c.tab[m]],v=0;v<g.tabs.length;v++)if(g.tabs[v]!=null){var k,p=g.tabs[v];if((!p.coverage||(k=r._lctf.coverageIndex(p.coverage,e))!=-1)&&g.ltype!=1){if(g.ltype==2){var S=null;if(p.fmt==1){var T=p.pairsets[k];for(u=0;u<T.length;u++)T[u].gid2==a&&(S=T[u])}else if(p.fmt==2){var b=r.U._getGlyphClass(e,p.classDef1),U=r.U._getGlyphClass(a,p.classDef2);S=p.matrix[b][U]}if(S){var x=0;return S.val1&&S.val1[2]&&(x+=S.val1[2]),S.val2&&S.val2[0]&&(x+=S.val2[0]),x}}}}}}}if(t.kern&&!o){var w=t.kern.glyph1.indexOf(e);if(w!=-1){var A=t.kern.rval[w].glyph2.indexOf(a);if(A!=-1)return t.kern.rval[w].vals[A]}}return 0},r.U._applySubs=function(t,e,a,o){for(var n=t.length-e-1,i=0;i<a.tabs.length;i++)if(a.tabs[i]!=null){var s,l=a.tabs[i];if(!l.coverage||(s=r._lctf.coverageIndex(l.coverage,t[e]))!=-1){if(a.ltype==1)t[e],l.fmt==1?t[e]=t[e]+l.delta:t[e]=l.newg[s];else if(a.ltype==4)for(var u=l.vals[s],c=0;c<u.length;c++){var m=u[c],g=m.chain.length;if(!(g>n)){for(var v=!0,k=0,p=0;p<g;p++){for(;t[e+k+(1+p)]==-1;)k++;m.chain[p]!=t[e+k+(1+p)]&&(v=!1)}if(v){for(t[e]=m.nglyph,p=0;p<g+k;p++)t[e+p+1]=-1;break}}}else if(a.ltype==5&&l.fmt==2)for(var S=r._lctf.getInterval(l.cDef,t[e]),T=l.cDef[S+2],b=l.scset[T],U=0;U<b.length;U++){var x=b[U],w=x.input;if(!(w.length>n)){for(v=!0,p=0;p<w.length;p++){var A=r._lctf.getInterval(l.cDef,t[e+1+p]);if(S==-1&&l.cDef[A+2]!=w[p]){v=!1;break}}if(v){var M=x.substLookupRecords;for(c=0;c<M.length;c+=2)M[c],M[c+1]}}}else if(a.ltype==6&&l.fmt==3){if(!r.U._glsCovered(t,l.backCvg,e-l.backCvg.length)||!r.U._glsCovered(t,l.inptCvg,e)||!r.U._glsCovered(t,l.ahedCvg,e+l.inptCvg.length))continue;var B=l.lookupRec;for(U=0;U<B.length;U+=2){S=B[U];var y=o[B[U+1]];r.U._applySubs(t,e+S,y,o)}}}}},r.U._glsCovered=function(t,e,a){for(var o=0;o<e.length;o++)if(r._lctf.coverageIndex(e[o],t[a+o])==-1)return!1;return!0},r.U.glyphsToPath=function(t,e,a){for(var o={cmds:[],crds:[]},n=0,i=0;i<e.length;i++){var s=e[i];if(s!=-1){for(var l=i<e.length-1&&e[i+1]!=-1?e[i+1]:0,u=r.U.glyphToPath(t,s),c=0;c<u.crds.length;c+=2)o.crds.push(u.crds[c]+n),o.crds.push(u.crds[c+1]);for(a&&o.cmds.push(a),c=0;c<u.cmds.length;c++)o.cmds.push(u.cmds[c]);a&&o.cmds.push("X"),n+=t.hmtx.aWidth[s],i<e.length-1&&(n+=r.U.getPairAdjustment(t,s,l))}}return o},r.U.P={},r.U.P.moveTo=function(t,e,a){t.cmds.push("M"),t.crds.push(e,a)},r.U.P.lineTo=function(t,e,a){t.cmds.push("L"),t.crds.push(e,a)},r.U.P.curveTo=function(t,e,a,o,n,i,s){t.cmds.push("C"),t.crds.push(e,a,o,n,i,s)},r.U.P.qcurveTo=function(t,e,a,o,n){t.cmds.push("Q"),t.crds.push(e,a,o,n)},r.U.P.closePath=function(t){t.cmds.push("Z")},r.U._drawCFF=function(t,e,a,o,n){for(var i=e.stack,s=e.nStems,l=e.haveWidth,u=e.width,c=e.open,m=0,g=e.x,v=e.y,k=0,p=0,S=0,T=0,b=0,U=0,x=0,w=0,A=0,M=0,B={val:0,size:0};m<t.length;){r.CFF.getCharString(t,m,B);var y=B.val;if(m+=B.size,y=="o1"||y=="o18")i.length%2!=0&&!l&&(u=i.shift()+o.nominalWidthX),s+=i.length>>1,i.length=0,l=!0;else if(y=="o3"||y=="o23")i.length%2!=0&&!l&&(u=i.shift()+o.nominalWidthX),s+=i.length>>1,i.length=0,l=!0;else if(y=="o4")i.length>1&&!l&&(u=i.shift()+o.nominalWidthX,l=!0),c&&r.U.P.closePath(n),v+=i.pop(),r.U.P.moveTo(n,g,v),c=!0;else if(y=="o5")for(;i.length>0;)g+=i.shift(),v+=i.shift(),r.U.P.lineTo(n,g,v);else if(y=="o6"||y=="o7")for(var C=i.length,_=y=="o6",F=0;F<C;F++){var D=i.shift();_?g+=D:v+=D,_=!_,r.U.P.lineTo(n,g,v)}else if(y=="o8"||y=="o24"){C=i.length;for(var P=0;P+6<=C;)k=g+i.shift(),p=v+i.shift(),S=k+i.shift(),T=p+i.shift(),g=S+i.shift(),v=T+i.shift(),r.U.P.curveTo(n,k,p,S,T,g,v),P+=6;y=="o24"&&(g+=i.shift(),v+=i.shift(),r.U.P.lineTo(n,g,v))}else{if(y=="o11")break;if(y=="o1234"||y=="o1235"||y=="o1236"||y=="o1237")y=="o1234"&&(p=v,S=(k=g+i.shift())+i.shift(),M=T=p+i.shift(),U=T,w=v,g=(x=(b=(A=S+i.shift())+i.shift())+i.shift())+i.shift(),r.U.P.curveTo(n,k,p,S,T,A,M),r.U.P.curveTo(n,b,U,x,w,g,v)),y=="o1235"&&(k=g+i.shift(),p=v+i.shift(),S=k+i.shift(),T=p+i.shift(),A=S+i.shift(),M=T+i.shift(),b=A+i.shift(),U=M+i.shift(),x=b+i.shift(),w=U+i.shift(),g=x+i.shift(),v=w+i.shift(),i.shift(),r.U.P.curveTo(n,k,p,S,T,A,M),r.U.P.curveTo(n,b,U,x,w,g,v)),y=="o1236"&&(k=g+i.shift(),p=v+i.shift(),S=k+i.shift(),M=T=p+i.shift(),U=T,x=(b=(A=S+i.shift())+i.shift())+i.shift(),w=U+i.shift(),g=x+i.shift(),r.U.P.curveTo(n,k,p,S,T,A,M),r.U.P.curveTo(n,b,U,x,w,g,v)),y=="o1237"&&(k=g+i.shift(),p=v+i.shift(),S=k+i.shift(),T=p+i.shift(),A=S+i.shift(),M=T+i.shift(),b=A+i.shift(),U=M+i.shift(),x=b+i.shift(),w=U+i.shift(),Math.abs(x-g)>Math.abs(w-v)?g=x+i.shift():v=w+i.shift(),r.U.P.curveTo(n,k,p,S,T,A,M),r.U.P.curveTo(n,b,U,x,w,g,v));else if(y=="o14"){if(i.length>0&&!l&&(u=i.shift()+a.nominalWidthX,l=!0),i.length==4){var I=i.shift(),W=i.shift(),J=i.shift(),O=i.shift(),E=r.CFF.glyphBySE(a,J),R=r.CFF.glyphBySE(a,O);r.U._drawCFF(a.CharStrings[E],e,a,o,n),e.x=I,e.y=W,r.U._drawCFF(a.CharStrings[R],e,a,o,n)}c&&(r.U.P.closePath(n),c=!1)}else if(y=="o19"||y=="o20")i.length%2!=0&&!l&&(u=i.shift()+o.nominalWidthX),s+=i.length>>1,i.length=0,l=!0,m+=s+7>>3;else if(y=="o21")i.length>2&&!l&&(u=i.shift()+o.nominalWidthX,l=!0),v+=i.pop(),g+=i.pop(),c&&r.U.P.closePath(n),r.U.P.moveTo(n,g,v),c=!0;else if(y=="o22")i.length>1&&!l&&(u=i.shift()+o.nominalWidthX,l=!0),g+=i.pop(),c&&r.U.P.closePath(n),r.U.P.moveTo(n,g,v),c=!0;else if(y=="o25"){for(;i.length>6;)g+=i.shift(),v+=i.shift(),r.U.P.lineTo(n,g,v);k=g+i.shift(),p=v+i.shift(),S=k+i.shift(),T=p+i.shift(),g=S+i.shift(),v=T+i.shift(),r.U.P.curveTo(n,k,p,S,T,g,v)}else if(y=="o26")for(i.length%2&&(g+=i.shift());i.length>0;)k=g,p=v+i.shift(),g=S=k+i.shift(),v=(T=p+i.shift())+i.shift(),r.U.P.curveTo(n,k,p,S,T,g,v);else if(y=="o27")for(i.length%2&&(v+=i.shift());i.length>0;)p=v,S=(k=g+i.shift())+i.shift(),T=p+i.shift(),g=S+i.shift(),v=T,r.U.P.curveTo(n,k,p,S,T,g,v);else if(y=="o10"||y=="o29"){var $=y=="o10"?o:a;if(i.length==0)console.debug("error: empty stack");else{var K=i.pop(),Z=$.Subrs[K+$.Bias];e.x=g,e.y=v,e.nStems=s,e.haveWidth=l,e.width=u,e.open=c,r.U._drawCFF(Z,e,a,o,n),g=e.x,v=e.y,s=e.nStems,l=e.haveWidth,u=e.width,c=e.open}}else if(y=="o30"||y=="o31"){var ae=i.length,H=(P=0,y=="o31");for(P+=ae-(C=-3&ae);P<C;)H?(p=v,S=(k=g+i.shift())+i.shift(),v=(T=p+i.shift())+i.shift(),C-P==5?(g=S+i.shift(),P++):g=S,H=!1):(k=g,p=v+i.shift(),S=k+i.shift(),T=p+i.shift(),g=S+i.shift(),C-P==5?(v=T+i.shift(),P++):v=T,H=!0),r.U.P.curveTo(n,k,p,S,T,g,v),P+=4}else{if((y+"").charAt(0)=="o")throw console.debug("Unknown operation: "+y,t),y;i.push(y)}}}e.x=g,e.y=v,e.nStems=s,e.haveWidth=l,e.width=u,e.open=c};var d=r,h={Typr:d};return f.Typr=d,f.default=h,Object.defineProperty(f,"__esModule",{value:!0}),f}({}).Typr}/*!
46
+ Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate
47
+ (https://github.com/101arrowz/fflate) for use in Troika text rendering.
48
+ Original licenses apply:
49
+ - fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT)
50
+ - woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2)
51
+ */function Ir(){return function(f){var r=Uint8Array,d=Uint16Array,h=Uint32Array,t=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),e=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(y,C){for(var _=new d(31),F=0;F<31;++F)_[F]=C+=1<<y[F-1];var D=new h(_[30]);for(F=1;F<30;++F)for(var P=_[F];P<_[F+1];++P)D[P]=P-_[F]<<5|F;return[_,D]},n=o(t,2),i=n[0],s=n[1];i[28]=258,s[258]=28;for(var l=o(e,0)[0],u=new d(32768),c=0;c<32768;++c){var m=(43690&c)>>>1|(21845&c)<<1;m=(61680&(m=(52428&m)>>>2|(13107&m)<<2))>>>4|(3855&m)<<4,u[c]=((65280&m)>>>8|(255&m)<<8)>>>1}var g=function(y,C,_){for(var F=y.length,D=0,P=new d(C);D<F;++D)++P[y[D]-1];var I,W=new d(C);for(D=0;D<C;++D)W[D]=W[D-1]+P[D-1]<<1;if(_){I=new d(1<<C);var J=15-C;for(D=0;D<F;++D)if(y[D])for(var O=D<<4|y[D],E=C-y[D],R=W[y[D]-1]++<<E,$=R|(1<<E)-1;R<=$;++R)I[u[R]>>>J]=O}else for(I=new d(F),D=0;D<F;++D)y[D]&&(I[D]=u[W[y[D]-1]++]>>>15-y[D]);return I},v=new r(288);for(c=0;c<144;++c)v[c]=8;for(c=144;c<256;++c)v[c]=9;for(c=256;c<280;++c)v[c]=7;for(c=280;c<288;++c)v[c]=8;var k=new r(32);for(c=0;c<32;++c)k[c]=5;var p=g(v,9,1),S=g(k,5,1),T=function(y){for(var C=y[0],_=1;_<y.length;++_)y[_]>C&&(C=y[_]);return C},b=function(y,C,_){var F=C/8|0;return(y[F]|y[F+1]<<8)>>(7&C)&_},U=function(y,C){var _=C/8|0;return(y[_]|y[_+1]<<8|y[_+2]<<16)>>(7&C)},x=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],w=function(y,C,_){var F=new Error(C||x[y]);if(F.code=y,Error.captureStackTrace&&Error.captureStackTrace(F,w),!_)throw F;return F},A=function(y,C,_){var F=y.length;if(!F||_&&!_.l&&F<5)return C||new r(0);var D=!C||_,P=!_||_.i;_||(_={}),C||(C=new r(3*F));var I,W=function(j){var ee=C.length;if(j>ee){var ie=new r(Math.max(2*ee,j));ie.set(C),C=ie}},J=_.f||0,O=_.p||0,E=_.b||0,R=_.l,$=_.d,K=_.m,Z=_.n,ae=8*F;do{if(!R){_.f=J=b(y,O,1);var H=b(y,O+1,3);if(O+=3,!H){var Y=y[(ge=((I=O)/8|0)+(7&I&&1)+4)-4]|y[ge-3]<<8,V=ge+Y;if(V>F){P&&w(0);break}D&&W(E+Y),C.set(y.subarray(ge,V),E),_.b=E+=Y,_.p=O=8*V;continue}if(H==1)R=p,$=S,K=9,Z=5;else if(H==2){var G=b(y,O,31)+257,z=b(y,O+10,15)+4,ce=G+b(y,O+5,31)+1;O+=14;for(var re=new r(ce),N=new r(19),ne=0;ne<z;++ne)N[a[ne]]=b(y,O+3*ne,7);O+=3*z;var Be=T(N),tt=(1<<Be)-1,Ne=g(N,Be,1);for(ne=0;ne<ce;){var ge,je=Ne[b(y,O,tt)];if(O+=15&je,(ge=je>>>4)<16)re[ne++]=ge;else{var X=0,Oe=0;for(ge==16?(Oe=3+b(y,O,3),O+=2,X=re[ne-1]):ge==17?(Oe=3+b(y,O,7),O+=3):ge==18&&(Oe=11+b(y,O,127),O+=7);Oe--;)re[ne++]=X}}var xe=re.subarray(0,G),Se=re.subarray(G);K=T(xe),Z=T(Se),R=g(xe,K,1),$=g(Se,Z,1)}else w(1);if(O>ae){P&&w(0);break}}D&&W(E+131072);for(var rt=(1<<K)-1,_e=(1<<Z)-1,le=O;;le=O){var he=(X=R[U(y,O)&rt])>>>4;if((O+=15&X)>ae){P&&w(0);break}if(X||w(2),he<256)C[E++]=he;else{if(he==256){le=O,R=null;break}var Ue=he-254;if(he>264){var me=t[ne=he-257];Ue=b(y,O,(1<<me)-1)+i[ne],O+=me}var L=$[U(y,O)&_e],ue=L>>>4;if(L||w(3),O+=15&L,Se=l[ue],ue>3&&(me=e[ue],Se+=U(y,O)&(1<<me)-1,O+=me),O>ae){P&&w(0);break}D&&W(E+131072);for(var ke=E+Ue;E<ke;E+=4)C[E]=C[E-Se],C[E+1]=C[E+1-Se],C[E+2]=C[E+2-Se],C[E+3]=C[E+3-Se];E=ke}}_.l=R,_.p=le,_.b=E,R&&(J=1,_.m=K,_.d=$,_.n=Z)}while(!J);return E==C.length?C:function(j,ee,ie){(ee==null||ee<0)&&(ee=0),(ie==null||ie>j.length)&&(ie=j.length);var fe=new(j instanceof d?d:j instanceof h?h:r)(ie-ee);return fe.set(j.subarray(ee,ie)),fe}(C,0,E)},M=new r(0),B=typeof TextDecoder<"u"&&new TextDecoder;try{B.decode(M,{stream:!0})}catch{}return f.convert_streams=function(y){var C=new DataView(y),_=0;function F(){var G=C.getUint16(_);return _+=2,G}function D(){var G=C.getUint32(_);return _+=4,G}function P(G){Y.setUint16(V,G),V+=2}function I(G){Y.setUint32(V,G),V+=4}for(var W={signature:D(),flavor:D(),length:D(),numTables:F(),reserved:F(),totalSfntSize:D(),majorVersion:F(),minorVersion:F(),metaOffset:D(),metaLength:D(),metaOrigLength:D(),privOffset:D(),privLength:D()},J=0;Math.pow(2,J)<=W.numTables;)J++;J--;for(var O=16*Math.pow(2,J),E=16*W.numTables-O,R=12,$=[],K=0;K<W.numTables;K++)$.push({tag:D(),offset:D(),compLength:D(),origLength:D(),origChecksum:D()}),R+=16;var Z,ae=new Uint8Array(12+16*$.length+$.reduce(function(G,z){return G+z.origLength+4},0)),H=ae.buffer,Y=new DataView(H),V=0;return I(W.flavor),P(W.numTables),P(O),P(J),P(E),$.forEach(function(G){I(G.tag),I(G.origChecksum),I(R),I(G.origLength),G.outOffset=R,(R+=G.origLength)%4!=0&&(R+=4-R%4)}),$.forEach(function(G){var z,ce=y.slice(G.offset,G.offset+G.compLength);if(G.compLength!=G.origLength){var re=new Uint8Array(G.origLength);z=new Uint8Array(ce,2),A(z,re)}else re=new Uint8Array(ce);ae.set(re,G.outOffset);var N=0;(R=G.outOffset+G.origLength)%4!=0&&(N=4-R%4),ae.set(new Uint8Array(N).buffer,G.outOffset+G.origLength),Z=R+N}),H.slice(0,Z)},Object.defineProperty(f,"__esModule",{value:!0}),f}({}).convert_streams}function Rr(f,r){const d={M:2,L:2,Q:4,C:6,Z:0},h={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},t=1,e=2,a=4,o=8,n=16,i=32;let s;function l(b){if(!s){const U={R:e,L:t,D:a,C:n,U:i,T:o};s=new Map;for(let x in h){let w=0;h[x].split(",").forEach(A=>{let[M,B]=A.split("+");M=parseInt(M,36),B=B?parseInt(B,36):0,s.set(w+=M,U[x]);for(let y=B;y--;)s.set(++w,U[x])})}}return s.get(b)||i}const u=1,c=2,m=3,g=4,v=[null,"isol","init","fina","medi"];function k(b){const U=new Uint8Array(b.length);let x=i,w=u,A=-1;for(let M=0;M<b.length;M++){const B=b.codePointAt(M);let y=l(B)|0,C=u;y&o||(x&(t|a|n)?y&(e|a|n)?(C=m,(w===u||w===m)&&U[A]++):y&(t|i)&&(w===c||w===g)&&U[A]--:x&(e|i)&&(w===c||w===g)&&U[A]--,w=U[M]=C,x=y,A=M,B>65535&&M++)}return U}function p(b,U){const x=[];for(let A=0;A<U.length;A++){const M=U.codePointAt(A);M>65535&&A++,x.push(f.U.codeToGlyph(b,M))}const w=b.GSUB;if(w){const{lookupList:A,featureList:M}=w;let B;const y=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,C=[];M.forEach(_=>{if(y.test(_.tag))for(let F=0;F<_.tab.length;F++){if(C[_.tab[F]])continue;C[_.tab[F]]=!0;const D=A[_.tab[F]],P=/^(isol|init|fina|medi)$/.test(_.tag);P&&!B&&(B=k(U));for(let I=0;I<x.length;I++)(!B||!P||v[B[I]]===_.tag)&&f.U._applySubs(x,I,D,A)}})}return x}function S(...b){for(let U=0;U<b.length;U++)if(typeof b[U]=="number")return b[U]}function T(b){const U=Object.create(null),x=b["OS/2"],w=b.hhea,A=b.head.unitsPerEm,M=S(x&&x.sTypoAscender,w&&w.ascender,A),B={unitsPerEm:A,ascender:M,descender:S(x&&x.sTypoDescender,w&&w.descender,0),capHeight:S(x&&x.sCapHeight,M),xHeight:S(x&&x.sxHeight,M),lineGap:S(x&&x.sTypoLineGap,w&&w.lineGap),forEachGlyph(y,C,_,F){let D=0;const P=1/B.unitsPerEm*C,I=p(b,y);let W=0,J=-1;return I.forEach((O,E)=>{if(O!==-1){let R=U[O];if(!R){const{cmds:$,crds:K}=f.U.glyphToPath(b,O);let Z="",ae=0;for(let z=0,ce=$.length;z<ce;z++){const re=d[$[z]];Z+=$[z];for(let N=1;N<=re;N++)Z+=(N>1?",":"")+K[ae++]}let H,Y,V,G;if(K.length){H=Y=1/0,V=G=-1/0;for(let z=0,ce=K.length;z<ce;z+=2){let re=K[z],N=K[z+1];re<H&&(H=re),N<Y&&(Y=N),re>V&&(V=re),N>G&&(G=N)}}else H=V=Y=G=0;R=U[O]={index:O,advanceWidth:b.hmtx.aWidth[O],xMin:H,yMin:Y,xMax:V,yMax:G,path:Z,pathCommandCount:$.length}}J!==-1&&(D+=f.U.getPairAdjustment(b,J,O)*P),F.call(null,R,D,W),R.advanceWidth&&(D+=R.advanceWidth*P),_&&(D+=_*C),J=O}W+=y.codePointAt(W)>65535?2:1}),D}};return B}return function(U){const x=new Uint8Array(U,0,4),w=f._bin.readASCII(x,0,4);if(w==="wOFF")U=r(U);else if(w==="wOF2")throw new Error("woff2 fonts not supported");return T(f.parse(U)[0])}}const Er=Ve({name:"Typr Font Parser",dependencies:[Pr,Ir,Rr],init(f,r,d){const h=f(),t=r();return d(h,t)}}),Ae={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},Lr=new dt;let Wt=!1;function Ie(){return(self.performance||Date).now()}function fn(f){Wt?console.warn("configureTextBuilder called after first font request; will be ignored."):Nt(Ae,f)}const Ze=Object.create(null);function zt(f,r){Wt=!0,f=Nt({},f);const d=Ie();if(f.font=zr(f.font||Ae.defaultFontURL),f.text=""+f.text,f.sdfGlyphSize=f.sdfGlyphSize||Ae.sdfGlyphSize,f.colorRanges!=null){let l={};for(let u in f.colorRanges)if(f.colorRanges.hasOwnProperty(u)){let c=f.colorRanges[u];typeof c!="number"&&(c=Lr.set(c).getHex()),l[u]=c}f.colorRanges=l}Object.freeze(f);const{textureWidth:h,sdfExponent:t}=Ae,{sdfGlyphSize:e}=f,a=h/e*4;let o=Ze[e];if(!o){const l=document.createElement("canvas");l.width=h,l.height=e*256/a,o=Ze[e]={glyphCount:0,sdfGlyphSize:e,sdfCanvas:l,sdfTexture:new rr(l,void 0,void 0,void 0,bt,bt),contextLost:!1,glyphsByFont:new Map},o.sdfTexture.generateMipmaps=!1,Wr(o)}const{sdfTexture:n,sdfCanvas:i}=o;let s=o.glyphsByFont.get(f.font);s||o.glyphsByFont.set(f.font,s=new Map),Nr(f).then(l=>{const{glyphIds:u,glyphPositions:c,fontSize:m,unitsPerEm:g,timings:v}=l,k=[],p=new Float32Array(u.length*4),S=m/g;let T=0,b=0;const U=Ie();u.forEach((B,y)=>{let C=s.get(B);if(!C){const{path:P,pathBounds:I}=l.glyphData[B],W=Math.max(I[2]-I[0],I[3]-I[1])/e*(Ae.sdfMargin*e+.5),J=o.glyphCount++,O=[I[0]-W,I[1]-W,I[2]+W,I[3]+W];s.set(B,C={path:P,atlasIndex:J,sdfViewBox:O}),k.push(C)}const{sdfViewBox:_}=C,F=c[b++],D=c[b++];p[T++]=F+_[0]*S,p[T++]=D+_[1]*S,p[T++]=F+_[2]*S,p[T++]=D+_[3]*S,u[y]=C.atlasIndex}),v.quads=(v.quads||0)+(Ie()-U);const x=Ie();v.sdf={};const w=i.height,A=Math.ceil(o.glyphCount/a),M=Math.pow(2,Math.ceil(Math.log2(A*e)));M>w&&(console.info(`Increasing SDF texture size ${w}->${M}`),Br(i,h,M),n.dispose()),Promise.all(k.map(B=>Vt(B,o,f.gpuAccelerateSDF).then(({timing:y})=>{v.sdf[B.atlasIndex]=y}))).then(()=>{k.length&&!o.contextLost&&(jt(o),n.needsUpdate=!0),v.sdfTotal=Ie()-x,v.total=Ie()-d,r(Object.freeze({parameters:f,sdfTexture:n,sdfGlyphSize:e,sdfExponent:t,glyphBounds:p,glyphAtlasIndices:u,glyphColors:l.glyphColors,caretPositions:l.caretPositions,caretHeight:l.caretHeight,chunkedBounds:l.chunkedBounds,ascender:l.ascender,descender:l.descender,lineHeight:l.lineHeight,capHeight:l.capHeight,xHeight:l.xHeight,topBaseline:l.topBaseline,blockBounds:l.blockBounds,visibleBounds:l.visibleBounds,timings:l.timings}))})}),Promise.resolve().then(()=>{o.contextLost||Gr(i)})}function Vt({path:f,atlasIndex:r,sdfViewBox:d},{sdfGlyphSize:h,sdfCanvas:t,contextLost:e},a){if(e)return Promise.resolve({timing:-1});const{textureWidth:o,sdfExponent:n}=Ae,i=Math.max(d[2]-d[0],d[3]-d[1]),s=Math.floor(r/4),l=s%(o/h)*h,u=Math.floor(s/(o/h))*h,c=r%4;return Cr(h,h,f,d,i,n,t,l,u,c,a)}function Wr(f){const r=f.sdfCanvas;r.addEventListener("webglcontextlost",d=>{console.log("Context Lost",d),d.preventDefault(),f.contextLost=!0}),r.addEventListener("webglcontextrestored",d=>{console.log("Context Restored",d),f.contextLost=!1;const h=[];f.glyphsByFont.forEach(t=>{t.forEach(e=>{h.push(Vt(e,f,!0))})}),Promise.all(h).then(()=>{jt(f),f.sdfTexture.needsUpdate=!0})})}function cn({font:f,characters:r,sdfGlyphSize:d},h){let t=Array.isArray(r)?r.join(`
52
+ `):""+r;zt({font:f,sdfGlyphSize:d,text:t},h)}function Nt(f,r){for(let d in r)r.hasOwnProperty(d)&&(f[d]=r[d]);return f}let qe;function zr(f){return qe||(qe=typeof document>"u"?{}:document.createElement("a")),qe.href=f,qe.href}function jt(f){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:r,sdfTexture:d}=f,{width:h,height:t}=r,e=f.sdfCanvas.getContext("webgl");let a=d.image.data;(!a||a.length!==h*t*4)&&(a=new Uint8Array(h*t*4),d.image={width:h,height:t,data:a},d.flipY=!1,d.isDataTexture=!0),e.readPixels(0,0,h,t,e.RGBA,e.UNSIGNED_BYTE,a)}}const Vr=Ve({name:"Typesetter",dependencies:[Ae,Er,_r,nr],init(f,r,d,h){const{defaultFontURL:t}=f;return d(r,h(),{defaultFontURL:t})}}),Nr=Ve({name:"Typesetter",dependencies:[Vr],init(f){return function(r){return new Promise(d=>{f.typeset(r,d)})}},getTransferables(f){const r=[f.glyphPositions.buffer,f.glyphIds.buffer];return f.caretPositions&&r.push(f.caretPositions.buffer),f.glyphColors&&r.push(f.glyphColors.buffer),r}});function dn(){Object.keys(Ze).forEach(f=>{const r=Ze[f].sdfCanvas,{width:d,height:h}=r;console.log("%c.",`
53
+ background: url(${r.toDataURL()});
54
+ background-size: ${d}px ${h}px;
55
+ color: transparent;
56
+ font-size: 0;
57
+ line-height: ${h}px;
58
+ padding-left: ${d}px;
59
+ `)})}const Ft={};function jr(f){let r=Ft[f];if(!r){const d=new pt(1,1,f,f),h=d.clone(),t=d.attributes,e=h.attributes,a=new or,o=t.uv.count;for(let n=0;n<o;n++)e.position.array[n*3]*=-1,e.normal.array[n*3+2]*=-1;["position","normal","uv"].forEach(n=>{a.setAttribute(n,new ar([...t[n].array,...e[n].array],t[n].itemSize))}),a.setIndex([...d.index.array,...h.index.array.map(n=>n+o)]),a.translate(.5,.5,0),r=Ft[f]=a}return r}const $r="aTroikaGlyphBounds",Dt="aTroikaGlyphIndex",Hr="aTroikaGlyphColor";class Xr extends Jt{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Yt,this.boundingBox=new Kt}computeBoundingSphere(){}computeBoundingBox(){}setSide(r){const d=this.getIndex().count;this.setDrawRange(r===Qt?d/2:0,r===Pt?d:d/2)}set detail(r){if(r!==this._detail){this._detail=r,(typeof r!="number"||r<1)&&(r=1);let d=jr(r);["position","normal","uv"].forEach(h=>{this.attributes[h]=d.attributes[h].clone()}),this.setIndex(d.getIndex().clone())}}get detail(){return this._detail}set curveRadius(r){r!==this._curveRadius&&(this._curveRadius=r,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(r,d,h,t,e){at(this,$r,r,4),at(this,Dt,d,1),at(this,Hr,e,3),this._blockBounds=h,this._chunkedBounds=t,this.instanceCount=d.length,this._updateBounds()}_updateBounds(){const r=this._blockBounds;if(r){const{curveRadius:d,boundingBox:h}=this;if(d){const{PI:t,floor:e,min:a,max:o,sin:n,cos:i}=Math,s=t/2,l=t*2,u=Math.abs(d),c=r[0]/u,m=r[2]/u,g=e((c+s)/l)!==e((m+s)/l)?-u:a(n(c)*u,n(m)*u),v=e((c-s)/l)!==e((m-s)/l)?u:o(n(c)*u,n(m)*u),k=e((c+t)/l)!==e((m+t)/l)?u*2:o(u-i(c)*u,u-i(m)*u);h.min.set(g,r[1],d<0?-k:0),h.max.set(v,r[3],d<0?0:k)}else h.min.set(r[0],r[1],0),h.max.set(r[2],r[3],0);h.getBoundingSphere(this.boundingSphere)}}applyClipRect(r){let d=this.getAttribute(Dt).count,h=this._chunkedBounds;if(h)for(let t=h.length;t--;){d=h[t].end;let e=h[t].rect;if(e[1]<r.w&&e[3]>r.y&&e[0]<r.z&&e[2]>r.x)break}this.instanceCount=d}}function at(f,r,d,h){const t=f.getAttribute(r);d?t&&t.array.length===d.length?(t.array.set(d),t.needsUpdate=!0):(f.setAttribute(r,new Zt(d,h)),delete f._maxInstanceCount,f.dispose()):t&&f.deleteAttribute(r)}const qr=`
60
+ uniform vec2 uTroikaSDFTextureSize;
61
+ uniform float uTroikaSDFGlyphSize;
62
+ uniform vec4 uTroikaTotalBounds;
63
+ uniform vec4 uTroikaClipRect;
64
+ uniform mat3 uTroikaOrient;
65
+ uniform bool uTroikaUseGlyphColors;
66
+ uniform float uTroikaDistanceOffset;
67
+ uniform float uTroikaBlurRadius;
68
+ uniform vec2 uTroikaPositionOffset;
69
+ uniform float uTroikaCurveRadius;
70
+ attribute vec4 aTroikaGlyphBounds;
71
+ attribute float aTroikaGlyphIndex;
72
+ attribute vec3 aTroikaGlyphColor;
73
+ varying vec2 vTroikaGlyphUV;
74
+ varying vec4 vTroikaTextureUVBounds;
75
+ varying float vTroikaTextureChannel;
76
+ varying vec3 vTroikaGlyphColor;
77
+ varying vec2 vTroikaGlyphDimensions;
78
+ `,Jr=`
79
+ vec4 bounds = aTroikaGlyphBounds;
80
+ bounds.xz += uTroikaPositionOffset.x;
81
+ bounds.yw -= uTroikaPositionOffset.y;
82
+
83
+ vec4 outlineBounds = vec4(
84
+ bounds.xy - uTroikaDistanceOffset - uTroikaBlurRadius,
85
+ bounds.zw + uTroikaDistanceOffset + uTroikaBlurRadius
86
+ );
87
+ vec4 clippedBounds = vec4(
88
+ clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),
89
+ clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)
90
+ );
91
+
92
+ vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);
93
+
94
+ position.xy = mix(bounds.xy, bounds.zw, clippedXY);
95
+
96
+ uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);
97
+
98
+ float rad = uTroikaCurveRadius;
99
+ if (rad != 0.0) {
100
+ float angle = position.x / rad;
101
+ position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);
102
+ normal.xz = vec2(sin(angle), cos(angle));
103
+ }
104
+
105
+ position = uTroikaOrient * position;
106
+ normal = uTroikaOrient * normal;
107
+
108
+ vTroikaGlyphUV = clippedXY.xy;
109
+ vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);
110
+
111
+
112
+ float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;
113
+ vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;
114
+ vec2 txStartUV = txUvPerSquare * vec2(
115
+ mod(floor(aTroikaGlyphIndex / 4.0), txCols),
116
+ floor(floor(aTroikaGlyphIndex / 4.0) / txCols)
117
+ );
118
+ vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);
119
+ vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);
120
+ `,Yr=`
121
+ uniform sampler2D uTroikaSDFTexture;
122
+ uniform vec2 uTroikaSDFTextureSize;
123
+ uniform float uTroikaSDFGlyphSize;
124
+ uniform float uTroikaSDFExponent;
125
+ uniform float uTroikaDistanceOffset;
126
+ uniform float uTroikaFillOpacity;
127
+ uniform float uTroikaOutlineOpacity;
128
+ uniform float uTroikaBlurRadius;
129
+ uniform vec3 uTroikaStrokeColor;
130
+ uniform float uTroikaStrokeWidth;
131
+ uniform float uTroikaStrokeOpacity;
132
+ uniform bool uTroikaSDFDebug;
133
+ varying vec2 vTroikaGlyphUV;
134
+ varying vec4 vTroikaTextureUVBounds;
135
+ varying float vTroikaTextureChannel;
136
+ varying vec2 vTroikaGlyphDimensions;
137
+
138
+ float troikaSdfValueToSignedDistance(float alpha) {
139
+ // Inverse of exponential encoding in webgl-sdf-generator
140
+
141
+ float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);
142
+ float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;
143
+ float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);
144
+ return signedDist;
145
+ }
146
+
147
+ float troikaGlyphUvToSdfValue(vec2 glyphUV) {
148
+ vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);
149
+ vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);
150
+ float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1
151
+ return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;
152
+ }
153
+
154
+ float troikaGlyphUvToDistance(vec2 uv) {
155
+ return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));
156
+ }
157
+
158
+ float troikaGetAADist() {
159
+
160
+ #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300
161
+ return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;
162
+ #else
163
+ return vTroikaGlyphDimensions.x / 64.0;
164
+ #endif
165
+ }
166
+
167
+ float troikaGetFragDistValue() {
168
+ vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);
169
+ float distance = troikaGlyphUvToDistance(clampedGlyphUV);
170
+
171
+ // Extrapolate distance when outside bounds:
172
+ distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 :
173
+ length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);
174
+
175
+
176
+
177
+ return distance;
178
+ }
179
+
180
+ float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {
181
+ #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)
182
+ float alpha = step(-distanceOffset, -distance);
183
+ #else
184
+
185
+ float alpha = smoothstep(
186
+ distanceOffset + aaDist,
187
+ distanceOffset - aaDist,
188
+ distance
189
+ );
190
+ #endif
191
+
192
+ return alpha;
193
+ }
194
+ `,Kr=`
195
+ float aaDist = troikaGetAADist();
196
+ float fragDistance = troikaGetFragDistValue();
197
+ float edgeAlpha = uTroikaSDFDebug ?
198
+ troikaGlyphUvToSdfValue(vTroikaGlyphUV) :
199
+ troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius));
200
+
201
+ #if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)
202
+ vec4 fillRGBA = gl_FragColor;
203
+ fillRGBA.a *= uTroikaFillOpacity;
204
+ vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);
205
+ if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;
206
+ gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(
207
+ -uTroikaStrokeWidth - aaDist,
208
+ -uTroikaStrokeWidth + aaDist,
209
+ fragDistance
210
+ ));
211
+ gl_FragColor.a *= edgeAlpha;
212
+ #endif
213
+
214
+ if (edgeAlpha == 0.0) {
215
+ discard;
216
+ }
217
+ `;function Qr(f){const r=ft(f,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Qe},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new yt(0,0,0,0)},uTroikaClipRect:{value:new yt(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Qe},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new dt},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new er},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:qr,vertexTransform:Jr,fragmentDefs:Yr,fragmentColorTransform:Kr,customRewriter({vertexShader:d,fragmentShader:h}){let t=/\buniform\s+vec3\s+diffuse\b/;return t.test(h)&&(h=h.replace(t,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),t.test(d)||(d=d.replace(Et,`uniform vec3 diffuse;
218
+ $&
219
+ vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
220
+ `))),{vertexShader:d,fragmentShader:h}}});return r.transparent=!0,Object.defineProperties(r,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),r}const gt=new ir({color:16777215,side:Pt,transparent:!0}),Ot=8421504,Mt=new sr,Je=new vt,it=new vt,Le=[],Zr=new vt,st="+x+y";function At(f){return Array.isArray(f)?f[0]:f}let $t=()=>{const f=new ht(new pt(1,1),gt);return $t=()=>f,f},Ht=()=>{const f=new ht(new pt(1,1,32,1),gt);return Ht=()=>f,f};const en={type:"syncstart"},tn={type:"synccomplete"},Xt=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],rn=Xt.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");class nn extends ht{constructor(){const r=new Xr;super(r,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Ot,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=st,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(r){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(r):(this._isSyncing=!0,this.dispatchEvent(en),zt({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},d=>{this._isSyncing=!1,this._textRenderInfo=d,this.geometry.updateGlyphs(d.glyphBounds,d.glyphAtlasIndices,d.blockBounds,d.chunkedBounds,d.glyphColors);const h=this._queuedSyncs;h&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{h.forEach(t=>t&&t())})),this.dispatchEvent(tn),r&&r()})))}onBeforeRender(r,d,h,t,e,a){this.sync(),e.isTroikaTextMaterial&&this._prepareForRender(e),e._hadOwnSide=e.hasOwnProperty("side"),this.geometry.setSide(e._actualSide=e.side),e.side=tr}onAfterRender(r,d,h,t,e,a){e._hadOwnSide?e.side=e._actualSide:delete e.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let r=this._derivedMaterial;const d=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=gt.clone());if((!r||r.baseMaterial!==d)&&(r=this._derivedMaterial=Qr(d),d.addEventListener("dispose",function h(){d.removeEventListener("dispose",h),r.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let h=r._outlineMtl;return h||(h=r._outlineMtl=Object.create(r,{id:{value:r.id+.1}}),h.isTextOutlineMaterial=!0,h.depthWrite=!1,h.map=null,r.addEventListener("dispose",function t(){r.removeEventListener("dispose",t),h.dispose()})),[h,r]}else return r}set material(r){r&&r.isTroikaTextMaterial?(this._derivedMaterial=r,this._baseMaterial=r.baseMaterial):this._baseMaterial=r}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(r){this.geometry.detail=r}get curveRadius(){return this.geometry.curveRadius}set curveRadius(r){this.geometry.curveRadius=r}get customDepthMaterial(){return At(this.material).getDepthMaterial()}get customDistanceMaterial(){return At(this.material).getDistanceMaterial()}_prepareForRender(r){const d=r.isTextOutlineMaterial,h=r.uniforms,t=this.textRenderInfo;if(t){const{sdfTexture:o,blockBounds:n}=t;h.uTroikaSDFTexture.value=o,h.uTroikaSDFTextureSize.value.set(o.image.width,o.image.height),h.uTroikaSDFGlyphSize.value=t.sdfGlyphSize,h.uTroikaSDFExponent.value=t.sdfExponent,h.uTroikaTotalBounds.value.fromArray(n),h.uTroikaUseGlyphColors.value=!d&&!!t.glyphColors;let i=0,s=0,l=0,u,c,m,g=0,v=0;if(d){let{outlineWidth:p,outlineOffsetX:S,outlineOffsetY:T,outlineBlur:b,outlineOpacity:U}=this;i=this._parsePercent(p)||0,s=Math.max(0,this._parsePercent(b)||0),u=U,g=this._parsePercent(S)||0,v=this._parsePercent(T)||0}else l=Math.max(0,this._parsePercent(this.strokeWidth)||0),l&&(m=this.strokeColor,h.uTroikaStrokeColor.value.set(m??Ot),c=this.strokeOpacity,c==null&&(c=1)),u=this.fillOpacity;h.uTroikaDistanceOffset.value=i,h.uTroikaPositionOffset.value.set(g,v),h.uTroikaBlurRadius.value=s,h.uTroikaStrokeWidth.value=l,h.uTroikaStrokeOpacity.value=c,h.uTroikaFillOpacity.value=u??1,h.uTroikaCurveRadius.value=this.curveRadius||0;let k=this.clipRect;if(k&&Array.isArray(k)&&k.length===4)h.uTroikaClipRect.value.fromArray(k);else{const p=(this.fontSize||.1)*100;h.uTroikaClipRect.value.set(n[0]-p,n[1]-p,n[2]+p,n[3]+p)}this.geometry.applyClipRect(h.uTroikaClipRect.value)}h.uTroikaSDFDebug.value=!!this.debugSDF,r.polygonOffset=!!this.depthOffset,r.polygonOffsetFactor=r.polygonOffsetUnits=this.depthOffset||0;const e=d?this.outlineColor||0:this.color;if(e==null)delete r.color;else{const o=r.hasOwnProperty("color")?r.color:r.color=new dt;(e!==o._input||typeof e=="object")&&o.set(o._input=e)}let a=this.orientation||st;if(a!==r._orientation){let o=h.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let n=a!==st&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(n){let[,i,s,l,u]=n;Je.set(0,0,0)[s]=i==="-"?1:-1,it.set(0,0,0)[u]=l==="-"?-1:1,Mt.lookAt(Zr,Je.cross(it),it),o.setFromMatrix4(Mt)}else o.identity();r._orientation=a}}_parsePercent(r){if(typeof r=="string"){let d=r.match(/^(-?[\d.]+)%$/),h=d?parseFloat(d[1]):NaN;r=(isNaN(h)?0:h/100)*this.fontSize}return r}localPositionToTextCoords(r,d=new Qe){d.copy(r);const h=this.curveRadius;return h&&(d.x=Math.atan2(r.x,Math.abs(h)-Math.abs(r.z))*Math.abs(h)),d}worldPositionToTextCoords(r,d=new Qe){return Je.copy(r),this.localPositionToTextCoords(this.worldToLocal(Je),d)}raycast(r,d){const{textRenderInfo:h,curveRadius:t}=this;if(h){const e=h.blockBounds,a=t?Ht():$t(),o=a.geometry,{position:n,uv:i}=o.attributes;for(let s=0;s<i.count;s++){let l=e[0]+i.getX(s)*(e[2]-e[0]);const u=e[1]+i.getY(s)*(e[3]-e[1]);let c=0;t&&(c=t-Math.cos(l/t)*t,l=Math.sin(l/t)*t),n.setXYZ(s,l,u,c)}o.boundingSphere=this.geometry.boundingSphere,o.boundingBox=this.geometry.boundingBox,a.matrixWorld=this.matrixWorld,a.material.side=this.material.side,Le.length=0,a.raycast(r,Le);for(let s=0;s<Le.length;s++)Le[s].object=this,d.push(Le[s])}}copy(r){const d=this.geometry;return super.copy(r),this.geometry=d,rn.forEach(h=>{this[h]=r[h]}),this}clone(){return new this.constructor().copy(this)}}Xt.forEach(f=>{const r="_private_"+f;Object.defineProperty(nn.prototype,f,{get(){return this[r]},set(d){d!==this[r]&&(this[r]=d,this._needsSync=!0)}})});function hn(f,r,d){let h=null;const{caretHeight:t}=f,e=on(f);let a=1/0;return e.forEach((o,n)=>{Math.abs(d-(n+t/2))<Math.abs(d-(a+t/2))&&(a=n)}),e.get(a).forEach(o=>{(!h||Math.abs(r-o.x)<Math.abs(r-h.x))&&(h=o)}),h}const Gt=new WeakMap;function pn(f,r,d){let h;if(f){let t=Gt.get(f);if(t&&t.start===r&&t.end===d)return t.rects;const{caretPositions:e,caretHeight:a}=f;if(d<r){const n=r;r=d,d=n}r=Math.max(r,0),d=Math.min(d,e.length+1),h=[];let o=null;for(let n=r;n<d;n++){const i=e[n*3],s=e[n*3+1],l=Math.min(i,s),u=Math.max(i,s),c=e[n*3+2];(!o||c!==o.bottom||l>o.right||u<o.left)&&(o={left:1/0,right:-1/0,bottom:c,top:c+a},h.push(o)),o.left=Math.min(l,o.left),o.right=Math.max(u,o.right)}h.sort((n,i)=>i.bottom-n.bottom||n.left-i.left);for(let n=h.length-1;n-- >0;){const i=h[n],s=h[n+1];i.bottom===s.bottom&&i.left<=s.right&&i.right>=s.left&&(s.left=Math.min(s.left,i.left),s.right=Math.max(s.right,i.right),h.splice(n,1))}Gt.set(f,{start:r,end:d,rects:h})}return h}const Bt=new WeakMap;function on(f){let r=Bt.get(f);if(!r){const{caretPositions:d,caretHeight:h}=f;r=new Map;for(let t=0;t<d.length;t+=3){const e=d[t+2];let a=r.get(e);a||r.set(e,a=[]),a.push({x:d[t],y:e,height:h,charIndex:t/3}),t+3>=d.length&&a.push({x:d[t+1],y:e,height:h,charIndex:t/3+1})}}return Bt.set(f,r),r}export{Xr as GlyphsGeometry,nn as Text,fn as configureTextBuilder,Qr as createTextDerivedMaterial,dn as dumpSDFTextures,hn as getCaretAtPoint,pn as getSelectionRects,cn as preloadFont,Vr as typesetterWorkerModule};