vuer 0.0.31rc8__py3-none-any.whl → 0.0.32rc7__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.
- vuer/client_build/404.html +5 -5
- vuer/client_build/assets/chunks/chunk-2131c36b.js +220 -0
- vuer/client_build/assets/chunks/chunk-3010a972.js +17 -0
- vuer/client_build/assets/chunks/chunk-41409215.js +85 -0
- vuer/client_build/assets/chunks/chunk-6066377f.js +1 -0
- vuer/client_build/assets/chunks/chunk-6b3e1cbe.js +220 -0
- vuer/client_build/assets/chunks/chunk-71fcf8b5.js +4502 -0
- vuer/client_build/assets/chunks/chunk-79630475.js +4502 -0
- vuer/client_build/assets/chunks/chunk-98964cd2.js +1 -0
- vuer/client_build/assets/chunks/chunk-a783899f.js +1 -0
- vuer/client_build/assets/chunks/chunk-c2202416.js +24 -0
- vuer/client_build/assets/chunks/chunk-c676def8.js +17 -0
- vuer/client_build/assets/chunks/chunk-d9bdcef8.js +24 -0
- vuer/client_build/assets/chunks/chunk-dc0a8b73.js +4502 -0
- vuer/client_build/assets/chunks/chunk-ed028bdc.js +85 -0
- vuer/client_build/assets/chunks/chunk-f856f090.js +85 -0
- vuer/client_build/assets/chunks/chunk-fb530879.js +1 -0
- vuer/client_build/assets/chunks/chunk-fc5669ff.js +220 -0
- vuer/client_build/assets/entries/entry-client-routing.3e00a936.js +2 -0
- vuer/client_build/assets/entries/entry-client-routing.440ca3f3.js +2 -0
- vuer/client_build/assets/entries/entry-client-routing.f2b2c78d.js +2 -0
- vuer/client_build/assets/entries/entry-client-routing.fd8d1a7e.js +2 -0
- vuer/client_build/assets/entries/entry-server-routing.331da83b.js +1 -0
- vuer/client_build/assets/entries/entry-server-routing.80367474.js +1 -0
- vuer/client_build/assets/entries/entry-server-routing.a14b8f2f.js +1 -0
- vuer/client_build/assets/entries/entry-server-routing.c5820a27.js +1 -0
- vuer/client_build/assets/entries/pages_hands.page.96d76674.js +1 -0
- vuer/client_build/assets/entries/pages_hands.page.a710320f.js +1 -0
- vuer/client_build/assets/entries/pages_hands.page.d2819396.js +39 -0
- vuer/client_build/assets/entries/pages_hands.page.f0c716fa.js +1 -0
- vuer/client_build/assets/entries/pages_index.page.55624b51.js +97 -0
- vuer/client_build/assets/entries/pages_index.page.882a1a82.js +97 -0
- vuer/client_build/assets/entries/pages_index.page.ec469c43.js +97 -0
- vuer/client_build/assets/entries/pages_stereo_plane.page.360c58a8.js +54 -0
- vuer/client_build/assets/entries/pages_stereo_plane.page.5953449a.js +1 -0
- vuer/client_build/assets/entries/pages_stereo_plane.page.b31b89c0.js +54 -0
- vuer/client_build/assets/entries/pages_video_plane.page.35550a3d.js +1 -0
- vuer/client_build/assets/entries/pages_video_plane.page.b6db83b0.js +1 -0
- vuer/client_build/assets/entries/pages_video_plane.page.c7a96ba6.js +1 -0
- vuer/client_build/assets/entries/renderer_default.page.client.9822d975.js +1 -0
- vuer/client_build/assets/entries/renderer_default.page.client.aa49b305.js +1 -0
- vuer/client_build/assets/entries/renderer_error.page.19e415e1.js +1 -0
- vuer/client_build/assets/entries/renderer_error.page.3723d86c.js +1 -0
- vuer/client_build/hands/index.html +6 -6
- vuer/client_build/index.html +7 -6
- vuer/client_build/stereo_plane/index.html +20 -0
- vuer/client_build/stereo_plane/index.pageContext.json +1 -0
- vuer/client_build/video_plane/index.html +19 -0
- vuer/client_build/video_plane/index.pageContext.json +1 -0
- vuer/schemas/scene_components.py +100 -28
- {vuer-0.0.31rc8.dist-info → vuer-0.0.32rc7.dist-info}/METADATA +1 -1
- {vuer-0.0.31rc8.dist-info → vuer-0.0.32rc7.dist-info}/RECORD +56 -10
- {vuer-0.0.31rc8.dist-info → vuer-0.0.32rc7.dist-info}/LICENSE +0 -0
- {vuer-0.0.31rc8.dist-info → vuer-0.0.32rc7.dist-info}/WHEEL +0 -0
- {vuer-0.0.31rc8.dist-info → vuer-0.0.32rc7.dist-info}/entry_points.txt +0 -0
- {vuer-0.0.31rc8.dist-info → vuer-0.0.32rc7.dist-info}/top_level.txt +0 -0
vuer/client_build/404.html
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
</head>
|
|
7
7
|
<body>
|
|
8
8
|
<div id="page-view"><h1>404 Page Not Found</h1><p>This page could not be found.</p></div>
|
|
9
|
-
<script type="module" src="/assets/entries/entry-client-routing.
|
|
10
|
-
<link rel="modulepreload" href="/assets/entries/renderer_error.page.
|
|
11
|
-
<link rel="modulepreload" href="/assets/chunks/chunk-
|
|
12
|
-
<link rel="modulepreload" href="/assets/entries/renderer_default.page.client.
|
|
13
|
-
<link rel="modulepreload" href="/assets/chunks/chunk-
|
|
9
|
+
<script type="module" src="/assets/entries/entry-client-routing.fd8d1a7e.js" defer></script>
|
|
10
|
+
<link rel="modulepreload" href="/assets/entries/renderer_error.page.3723d86c.js" as="script" type="text/javascript">
|
|
11
|
+
<link rel="modulepreload" href="/assets/chunks/chunk-3010a972.js" as="script" type="text/javascript">
|
|
12
|
+
<link rel="modulepreload" href="/assets/entries/renderer_default.page.client.9822d975.js" as="script" type="text/javascript">
|
|
13
|
+
<link rel="modulepreload" href="/assets/chunks/chunk-d9bdcef8.js" as="script" type="text/javascript">
|
|
14
14
|
<link rel="modulepreload" href="/assets/chunks/chunk-3d735b94.js" as="script" type="text/javascript">
|
|
15
15
|
<link rel="modulepreload" href="/assets/chunks/chunk-cf010ec4.js" as="script" type="text/javascript">
|
|
16
16
|
<script id="vike_pageContext" type="application/json">{"pageProps":{"is404":true},"documentProps":"!undefined","someAsyncProps":42,"abortReason":"!undefined","_urlRewrite":null,"_urlRedirect":"!undefined","abortStatusCode":"!undefined","_abortCall":"!undefined","_pageContextInitHasClientData":"!undefined","_pageId":"/renderer/_error","is404":true,"_isError":"!undefined"}</script>
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import{I as wn,S as kn,B as xn,a as Fn,D as an,b as Cn,V as It,d as Nr,C as pr,M as Dn,e as gr,F as An,T as En,L as zr,P as mr,f as Mn,g as Pn,h as Gn,i as Bn,j as yr,U as On,k as Rn,R as Ln,l as In,m as Wn}from"./chunk-dc0a8b73.js";import"./chunk-3010a972.js";import"./chunk-d9bdcef8.js";import"./chunk-cf010ec4.js";function Nn(){var c=Object.create(null);function r(t,e){var o=t.id,a=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),!c[o])try{n=n.map(function(f){return f&&f.isWorkerModule&&(r(f,function(h){if(h instanceof Error)throw h}),f=c[f.id].value),f}),i=u("<"+a+">.init",i),s&&(s=u("<"+a+">.getTransferables",s));var l=null;typeof i=="function"?l=i.apply(void 0,n):console.error("worker module init function failed to rehydrate"),c[o]={id:o,value:l,getTransferables:s},e(l)}catch(f){f&&f.noLog||console.error(f),e(f)}}function d(t,e){var o,a=t.id,n=t.args;(!c[a]||typeof c[a].value!="function")&&e(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var i=(o=c[a]).value.apply(o,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 f=c[a].getTransferables&&c[a].getTransferables(l);(!f||!Array.isArray(f)||!f.length)&&(f=void 0),e(l,f)}catch(h){console.error(h),e(h)}}}function u(t,e){var o=void 0;self.troikaDefine=function(n){return o=n};var a=URL.createObjectURL(new Blob(["/** "+t.replace(/\*/g,"")+` **/
|
|
2
|
+
|
|
3
|
+
troikaDefine(
|
|
4
|
+
`+e+`
|
|
5
|
+
)`],{type:"application/javascript"}));try{importScripts(a)}catch(n){console.error(n)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(t){var e=t.data,o=e.messageId,a=e.action,n=e.data;try{a==="registerModule"&&r(n,function(i){i instanceof Error?postMessage({messageId:o,success:!1,error:i.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof i=="function"}})}),a==="callModule"&&d(n,function(i,s){i instanceof Error?postMessage({messageId:o,success:!1,error:i.message}):postMessage({messageId:o,success:!0,result:i},s||void 0)})}catch(i){postMessage({messageId:o,success:!1,error:i.stack})}})}function zn(c){var r=function(){for(var d=[],u=arguments.length;u--;)d[u]=arguments[u];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=c.dependencies,u=c.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 u.apply(null,e)});return r._getInitResult=function(){return t},t},r}var on=function(){var c=!1;if(typeof window<"u"&&typeof window.document<"u")try{var r=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));r.terminate(),c=!0}catch(d){typeof process<"u",console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+d.message+"]")}return on=function(){return c},c},Vn=0,jn=0,sr=!1,bt=Object.create(null),Ut=Object.create(null),cr=Object.create(null);function _t(c){if((!c||typeof c.init!="function")&&!sr)throw new Error("requires `options.init` function");var r=c.dependencies,d=c.init,u=c.getTransferables,t=c.workerId;if(!on())return zn(c);t==null&&(t="#default");var e="workerModule"+ ++Vn,o=c.name||e,a=null;r=r&&r.map(function(i){return typeof i=="function"&&!i.workerModuleData&&(sr=!0,i=_t({workerId:t,name:"<"+o+"> function dependency: "+i.name,init:`function(){return (
|
|
6
|
+
`+Rt(i)+`
|
|
7
|
+
)}`}),sr=!1),i&&i.workerModuleData&&(i=i.workerModuleData),i});function n(){for(var i=[],s=arguments.length;s--;)i[s]=arguments[s];if(!a){a=Vr(t,"registerModule",n.workerModuleData);var l=function(){a=null,Ut[t].delete(l)};(Ut[t]||(Ut[t]=new Set)).add(l)}return a.then(function(f){var h=f.isCallable;if(h)return Vr(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:o,dependencies:r,init:Rt(d),getTransferables:u&&Rt(u)},n}function Xn(c){Ut[c]&&Ut[c].forEach(function(r){r()}),bt[c]&&(bt[c].terminate(),delete bt[c])}function Rt(c){var r=c.toString();return!/^function/.test(r)&&/^\w+\s*\(/.test(r)&&(r="function "+r),r}function Yn(c){var r=bt[c];if(!r){var d=Rt(Nn);r=bt[c]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+c.replace(/\*/g,"")+` **/
|
|
8
|
+
|
|
9
|
+
;(`+d+")()"],{type:"application/javascript"}))),r.onmessage=function(u){var t=u.data,e=t.messageId,o=cr[e];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete cr[e],o(t)}}return r}function Vr(c,r,d){return new Promise(function(u,t){var e=++jn;cr[e]=function(o){o.success?u(o.result):t(new Error("Error in worker "+r+" call: "+o.error))},Yn(c).postMessage({messageId:e,action:r,data:d})})}function sn(){var c=function(r){function d(G,W,p,w,O,B,D,I){var F=1-D;I.x=F*F*G+2*F*D*p+D*D*O,I.y=F*F*W+2*F*D*w+D*D*B}function u(G,W,p,w,O,B,D,I,F,M){var z=1-F;M.x=z*z*z*G+3*z*z*F*p+3*z*F*F*O+F*F*F*D,M.y=z*z*z*W+3*z*z*F*w+3*z*F*F*B+F*F*F*I}function t(G,W){for(var p=/([MLQCZ])([^MLQCZ]*)/g,w,O,B,D,I;w=p.exec(G);){var F=w[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(M){return parseFloat(M)});switch(w[1]){case"M":D=O=F[0],I=B=F[1];break;case"L":(F[0]!==D||F[1]!==I)&&W("L",D,I,D=F[0],I=F[1]);break;case"Q":{W("Q",D,I,D=F[2],I=F[3],F[0],F[1]);break}case"C":{W("C",D,I,D=F[4],I=F[5],F[0],F[1],F[2],F[3]);break}case"Z":(D!==O||I!==B)&&W("L",D,I,O,B);break}}}function e(G,W,p){p===void 0&&(p=16);var w={x:0,y:0};t(G,function(O,B,D,I,F,M,z,Z,V){switch(O){case"L":W(B,D,I,F);break;case"Q":{for(var E=B,de=D,ce=1;ce<p;ce++)d(B,D,M,z,I,F,ce/(p-1),w),W(E,de,w.x,w.y),E=w.x,de=w.y;break}case"C":{for(var X=B,q=D,le=1;le<p;le++)u(B,D,M,z,Z,V,I,F,le/(p-1),w),W(X,q,w.x,w.y),X=w.x,q=w.y;break}}})}var o="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",a="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",n=new WeakMap,i={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function s(G,W){var p=G.getContext?G.getContext("webgl",i):G,w=n.get(p);if(!w){let z=function(X){var q=B[X];if(!q&&(q=B[X]=p.getExtension(X),!q))throw new Error(X+" not supported");return q},Z=function(X,q){var le=p.createShader(q);return p.shaderSource(le,X),p.compileShader(le),le},V=function(X,q,le,R){if(!D[X]){var te={},K={},P=p.createProgram();p.attachShader(P,Z(q,p.VERTEX_SHADER)),p.attachShader(P,Z(le,p.FRAGMENT_SHADER)),p.linkProgram(P),D[X]={program:P,transaction:function(Q){p.useProgram(P),Q({setUniform:function(H,me){for(var pe=[],ee=arguments.length-2;ee-- >0;)pe[ee]=arguments[ee+2];var ue=K[me]||(K[me]=p.getUniformLocation(P,me));p["uniform"+H].apply(p,[ue].concat(pe))},setAttribute:function(H,me,pe,ee,ue){var ge=te[H];ge||(ge=te[H]={buf:p.createBuffer(),loc:p.getAttribLocation(P,H),data:null}),p.bindBuffer(p.ARRAY_BUFFER,ge.buf),p.vertexAttribPointer(ge.loc,me,p.FLOAT,!1,0,0),p.enableVertexAttribArray(ge.loc),O?p.vertexAttribDivisor(ge.loc,ee):z("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(ge.loc,ee),ue!==ge.data&&(p.bufferData(p.ARRAY_BUFFER,ue,pe),ge.data=ue)}})}}}D[X].transaction(R)},E=function(X,q){F++;try{p.activeTexture(p.TEXTURE0+F);var le=I[X];le||(le=I[X]=p.createTexture(),p.bindTexture(p.TEXTURE_2D,le),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST)),p.bindTexture(p.TEXTURE_2D,le),q(le,F)}finally{F--}},de=function(X,q,le){var R=p.createFramebuffer();M.push(R),p.bindFramebuffer(p.FRAMEBUFFER,R),p.activeTexture(p.TEXTURE0+q),p.bindTexture(p.TEXTURE_2D,X),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,X,0);try{le(R)}finally{p.deleteFramebuffer(R),p.bindFramebuffer(p.FRAMEBUFFER,M[--M.length-1]||null)}},ce=function(){B={},D={},I={},F=-1,M.length=0};var O=typeof WebGL2RenderingContext<"u"&&p instanceof WebGL2RenderingContext,B={},D={},I={},F=-1,M=[];p.canvas.addEventListener("webglcontextlost",function(X){ce(),X.preventDefault()},!1),n.set(p,w={gl:p,isWebGL2:O,getExtension:z,withProgram:V,withTexture:E,withTextureFramebuffer:de,handleContextLoss:ce})}W(w)}function l(G,W,p,w,O,B,D,I){D===void 0&&(D=15),I===void 0&&(I=null),s(G,function(F){var M=F.gl,z=F.withProgram,Z=F.withTexture;Z("copy",function(V,E){M.texImage2D(M.TEXTURE_2D,0,M.RGBA,O,B,0,M.RGBA,M.UNSIGNED_BYTE,W),z("copy",o,a,function(de){var ce=de.setUniform,X=de.setAttribute;X("aUV",2,M.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),ce("1i","image",E),M.bindFramebuffer(M.FRAMEBUFFER,I||null),M.disable(M.BLEND),M.colorMask(D&8,D&4,D&2,D&1),M.viewport(p,w,O,B),M.scissor(p,w,O,B),M.drawArrays(M.TRIANGLES,0,3)})})})}function f(G,W,p){var w=G.width,O=G.height;s(G,function(B){var D=B.gl,I=new Uint8Array(w*O*4);D.readPixels(0,0,w,O,D.RGBA,D.UNSIGNED_BYTE,I),G.width=W,G.height=p,l(D,I,0,0,w,O)})}var h=Object.freeze({__proto__:null,withWebGLContext:s,renderImageData:l,resizeWebGLCanvasWithoutClearing:f});function y(G,W,p,w,O,B){B===void 0&&(B=1);var D=new Uint8Array(G*W),I=w[2]-w[0],F=w[3]-w[1],M=[];e(p,function(X,q,le,R){M.push({x1:X,y1:q,x2:le,y2:R,minX:Math.min(X,le),minY:Math.min(q,R),maxX:Math.max(X,le),maxY:Math.max(q,R)})}),M.sort(function(X,q){return X.maxX-q.maxX});for(var z=0;z<G;z++)for(var Z=0;Z<W;Z++){var V=de(w[0]+I*(z+.5)/G,w[1]+F*(Z+.5)/W),E=Math.pow(1-Math.abs(V)/O,B)/2;V<0&&(E=1-E),E=Math.max(0,Math.min(255,Math.round(E*255))),D[Z*G+z]=E}return D;function de(X,q){for(var le=1/0,R=1/0,te=M.length;te--;){var K=M[te];if(K.maxX+R<=X)break;if(X+R>K.minX&&q-R<K.maxY&&q+R>K.minY){var P=C(X,q,K.x1,K.y1,K.x2,K.y2);P<le&&(le=P,R=Math.sqrt(le))}}return ce(X,q)&&(R=-R),R}function ce(X,q){for(var le=0,R=M.length;R--;){var te=M[R];if(te.maxX<=X)break;var K=te.y1>q!=te.y2>q&&X<(te.x2-te.x1)*(q-te.y1)/(te.y2-te.y1)+te.x1;K&&(le+=te.y1<te.y2?1:-1)}return le!==0}}function m(G,W,p,w,O,B,D,I,F,M){B===void 0&&(B=1),I===void 0&&(I=0),F===void 0&&(F=0),M===void 0&&(M=0),g(G,W,p,w,O,B,D,null,I,F,M)}function g(G,W,p,w,O,B,D,I,F,M,z){B===void 0&&(B=1),F===void 0&&(F=0),M===void 0&&(M=0),z===void 0&&(z=0);for(var Z=y(G,W,p,w,O,B),V=new Uint8Array(Z.length*4),E=0;E<Z.length;E++)V[E*4+z]=Z[E];l(D,V,F,M,G,W,1<<3-z,I)}function C(G,W,p,w,O,B){var D=O-p,I=B-w,F=D*D+I*I,M=F?Math.max(0,Math.min(1,((G-p)*D+(W-w)*I)/F)):0,z=G-(p+M*D),Z=W-(w+M*I);return z*z+Z*Z}var v=Object.freeze({__proto__:null,generate:y,generateIntoCanvas:m,generateIntoFramebuffer:g}),_="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",x="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",U="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",T=new Float32Array([0,0,2,0,0,2]),k=null,S=!1,Y={},J=new WeakMap;function ne(G){if(!S&&!j(G))throw new Error("WebGL generation not supported")}function b(G,W,p,w,O,B,D){if(B===void 0&&(B=1),D===void 0&&(D=null),!D&&(D=k,!D)){var I=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!I)throw new Error("OffscreenCanvas or DOM canvas not supported");D=k=I.getContext("webgl",{depth:!1})}ne(D);var F=new Uint8Array(G*W*4);s(D,function(V){var E=V.gl,de=V.withTexture,ce=V.withTextureFramebuffer;de("readable",function(X,q){E.texImage2D(E.TEXTURE_2D,0,E.RGBA,G,W,0,E.RGBA,E.UNSIGNED_BYTE,null),ce(X,q,function(le){A(G,W,p,w,O,B,E,le,0,0,0),E.readPixels(0,0,G,W,E.RGBA,E.UNSIGNED_BYTE,F)})})});for(var M=new Uint8Array(G*W),z=0,Z=0;z<F.length;z+=4)M[Z++]=F[z];return M}function L(G,W,p,w,O,B,D,I,F,M){B===void 0&&(B=1),I===void 0&&(I=0),F===void 0&&(F=0),M===void 0&&(M=0),A(G,W,p,w,O,B,D,null,I,F,M)}function A(G,W,p,w,O,B,D,I,F,M,z){B===void 0&&(B=1),F===void 0&&(F=0),M===void 0&&(M=0),z===void 0&&(z=0),ne(D);var Z=[];e(p,function(V,E,de,ce){Z.push(V,E,de,ce)}),Z=new Float32Array(Z),s(D,function(V){var E=V.gl,de=V.isWebGL2,ce=V.getExtension,X=V.withProgram,q=V.withTexture,le=V.withTextureFramebuffer,R=V.handleContextLoss;if(q("rawDistances",function(te,K){(G!==te._lastWidth||W!==te._lastHeight)&&E.texImage2D(E.TEXTURE_2D,0,E.RGBA,te._lastWidth=G,te._lastHeight=W,0,E.RGBA,E.UNSIGNED_BYTE,null),X("main",_,x,function(P){var ae=P.setAttribute,Q=P.setUniform,re=!de&&ce("ANGLE_instanced_arrays"),H=!de&&ce("EXT_blend_minmax");ae("aUV",2,E.STATIC_DRAW,0,T),ae("aLineSegment",4,E.DYNAMIC_DRAW,1,Z),Q.apply(void 0,["4f","uGlyphBounds"].concat(w)),Q("1f","uMaxDistance",O),Q("1f","uExponent",B),le(te,K,function(me){E.enable(E.BLEND),E.colorMask(!0,!0,!0,!0),E.viewport(0,0,G,W),E.scissor(0,0,G,W),E.blendFunc(E.ONE,E.ONE),E.blendEquationSeparate(E.FUNC_ADD,de?E.MAX:H.MAX_EXT),E.clear(E.COLOR_BUFFER_BIT),de?E.drawArraysInstanced(E.TRIANGLES,0,3,Z.length/4):re.drawArraysInstancedANGLE(E.TRIANGLES,0,3,Z.length/4)})}),X("post",o,U,function(P){P.setAttribute("aUV",2,E.STATIC_DRAW,0,T),P.setUniform("1i","tex",K),E.bindFramebuffer(E.FRAMEBUFFER,I),E.disable(E.BLEND),E.colorMask(z===0,z===1,z===2,z===3),E.viewport(F,M,G,W),E.scissor(F,M,G,W),E.drawArrays(E.TRIANGLES,0,3)})}),E.isContextLost())throw R(),new Error("webgl context lost")})}function j(G){var W=!G||G===k?Y:G.canvas||G,p=J.get(W);if(p===void 0){S=!0;var w=null;try{var O=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],B=b(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,G);p=B&&O.length===B.length&&B.every(function(D,I){return D===O[I]}),p||(w="bad trial run results",console.info(O,B))}catch(D){p=!1,w=D.message}w&&console.warn("WebGL SDF generation not supported:",w),S=!1,J.set(W,p)}return p}var N=Object.freeze({__proto__:null,generate:b,generateIntoCanvas:L,generateIntoFramebuffer:A,isSupported:j});function se(G,W,p,w,O,B){O===void 0&&(O=Math.max(w[2]-w[0],w[3]-w[1])/2),B===void 0&&(B=1);try{return b.apply(N,arguments)}catch(D){return console.info("WebGL SDF generation failed, falling back to JS",D),y.apply(v,arguments)}}function ie(G,W,p,w,O,B,D,I,F,M){O===void 0&&(O=Math.max(w[2]-w[0],w[3]-w[1])/2),B===void 0&&(B=1),I===void 0&&(I=0),F===void 0&&(F=0),M===void 0&&(M=0);try{return L.apply(N,arguments)}catch(z){return console.info("WebGL SDF generation failed, falling back to JS",z),m.apply(v,arguments)}}return r.forEachPathCommand=t,r.generate=se,r.generateIntoCanvas=ie,r.javascript=v,r.pathToLineSegments=e,r.webgl=N,r.webglUtils=h,Object.defineProperty(r,"__esModule",{value:!0}),r}({});return c}function Hn(){var c=function(r){var d={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,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,g+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+g,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,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,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,r2,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+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+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,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},u={},t={};u.L=1,t[1]="L",Object.keys(d).forEach(function(R,te){u[R]=1<<te+1,t[u[R]]=R}),Object.freeze(u);var e=u.LRI|u.RLI|u.FSI,o=u.L|u.R|u.AL,a=u.B|u.S|u.WS|u.ON|u.FSI|u.LRI|u.RLI|u.PDI,n=u.BN|u.RLE|u.LRE|u.RLO|u.LRO|u.PDF,i=u.S|u.WS|u.B|e|u.PDI|n,s=null;function l(){if(!s){s=new Map;var R=function(K){if(d.hasOwnProperty(K)){var P=0;d[K].split(",").forEach(function(ae){var Q=ae.split("+"),re=Q[0],H=Q[1];re=parseInt(re,36),H=H?parseInt(H,36):0,s.set(P+=re,u[K]);for(var me=0;me<H;me++)s.set(++P,u[K])})}};for(var te in d)R(te)}}function f(R){return l(),s.get(R.codePointAt(0))||u.L}function h(R){return t[f(R)]}var y={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function m(R,te){var K=36,P=0,ae=new Map,Q=te&&new Map,re;return R.split(",").forEach(function H(me){if(me.indexOf("+")!==-1)for(var pe=+me;pe--;)H(re);else{re=me;var ee=me.split(">"),ue=ee[0],ge=ee[1];ue=String.fromCodePoint(P+=parseInt(ue,K)),ge=String.fromCodePoint(P+=parseInt(ge,K)),ae.set(ue,ge),te&&Q.set(ge,ue)}}),{map:ae,reverseMap:Q}}var g,C,v;function _(){if(!g){var R=m(y.pairs,!0),te=R.map,K=R.reverseMap;g=te,C=K,v=m(y.canonical,!1).map}}function x(R){return _(),g.get(R)||null}function U(R){return _(),C.get(R)||null}function T(R){return _(),v.get(R)||null}var k=u.L,S=u.R,Y=u.EN,J=u.ES,ne=u.ET,b=u.AN,L=u.CS,A=u.B,j=u.S,N=u.ON,se=u.BN,ie=u.NSM,G=u.AL,W=u.LRO,p=u.RLO,w=u.LRE,O=u.RLE,B=u.PDF,D=u.LRI,I=u.RLI,F=u.FSI,M=u.PDI;function z(R,te){for(var K=125,P=new Uint32Array(R.length),ae=0;ae<R.length;ae++)P[ae]=f(R[ae]);var Q=new Map;function re(Ge,je){var Be=P[Ge];P[Ge]=je,Q.set(Be,Q.get(Be)-1),Be&a&&Q.set(a,Q.get(a)-1),Q.set(je,(Q.get(je)||0)+1),je&a&&Q.set(a,(Q.get(a)||0)+1)}for(var H=new Uint8Array(R.length),me=new Map,pe=[],ee=null,ue=0;ue<R.length;ue++)ee||pe.push(ee={start:ue,end:R.length-1,level:te==="rtl"?1:te==="ltr"?0:Ir(ue,!1)}),P[ue]&A&&(ee.end=ue,ee=null);for(var ge=O|w|p|W|e|M|B|A,xe=function(Ge){return Ge+(Ge&1?1:2)},fe=function(Ge){return Ge+(Ge&1?2:1)},_e=0;_e<pe.length;_e++){ee=pe[_e];var ve=[{_level:ee.level,_override:0,_isolate:0}],oe=void 0,ye=0,Ue=0,Fe=0;Q.clear();for(var he=ee.start;he<=ee.end;he++){var Se=P[he];if(oe=ve[ve.length-1],Q.set(Se,(Q.get(Se)||0)+1),Se&a&&Q.set(a,(Q.get(a)||0)+1),Se&ge)if(Se&(O|w)){H[he]=oe._level;var Me=(Se===O?fe:xe)(oe._level);Me<=K&&!ye&&!Ue?ve.push({_level:Me,_override:0,_isolate:0}):ye||Ue++}else if(Se&(p|W)){H[he]=oe._level;var Ye=(Se===p?fe:xe)(oe._level);Ye<=K&&!ye&&!Ue?ve.push({_level:Ye,_override:Se&p?S:k,_isolate:0}):ye||Ue++}else if(Se&e){Se&F&&(Se=Ir(he+1,!0)===1?I:D),H[he]=oe._level,oe._override&&re(he,oe._override);var Ze=(Se===I?fe:xe)(oe._level);Ze<=K&&ye===0&&Ue===0?(Fe++,ve.push({_level:Ze,_override:0,_isolate:1,_isolInitIndex:he})):ye++}else if(Se&M){if(ye>0)ye--;else if(Fe>0){for(Ue=0;!ve[ve.length-1]._isolate;)ve.pop();var He=ve[ve.length-1]._isolInitIndex;He!=null&&(me.set(He,he),me.set(he,He)),ve.pop(),Fe--}oe=ve[ve.length-1],H[he]=oe._level,oe._override&&re(he,oe._override)}else Se&B?(ye===0&&(Ue>0?Ue--:!oe._isolate&&ve.length>1&&(ve.pop(),oe=ve[ve.length-1])),H[he]=oe._level):Se&A&&(H[he]=ee.level);else H[he]=oe._level,oe._override&&Se!==se&&re(he,oe._override)}for(var Ie=[],Oe=null,Te=ee.start;Te<=ee.end;Te++){var st=P[Te];if(!(st&n)){var ke=H[Te],we=st&e,Ne=st===M;Oe&&ke===Oe._level?(Oe._end=Te,Oe._endsWithIsolInit=we):Ie.push(Oe={_start:Te,_end:Te,_level:ke,_startsWithPDI:Ne,_endsWithIsolInit:we})}}for(var Re=[],be=0;be<Ie.length;be++){var De=Ie[be];if(!De._startsWithPDI||De._startsWithPDI&&!me.has(De._start)){for(var We=[Oe=De],Ee=void 0;Oe&&Oe._endsWithIsolInit&&(Ee=me.get(Oe._end))!=null;)for(var Ce=be+1;Ce<Ie.length;Ce++)if(Ie[Ce]._start===Ee){We.push(Oe=Ie[Ce]);break}for(var Pe=[],Je=0;Je<We.length;Je++)for(var ze=We[Je],qe=ze._start;qe<=ze._end;qe++)Pe.push(qe);for(var yn=H[Pe[0]],Ur=ee.level,St=Pe[0]-1;St>=0;St--)if(!(P[St]&n)){Ur=H[St];break}var zt=Pe[Pe.length-1],bn=H[zt],_r=ee.level;if(!(P[zt]&e)){for(var Tt=zt+1;Tt<=ee.end;Tt++)if(!(P[Tt]&n)){_r=H[Tt];break}}Re.push({_seqIndices:Pe,_sosType:Math.max(Ur,yn)%2?S:k,_eosType:Math.max(_r,bn)%2?S:k})}}for(var Vt=0;Vt<Re.length;Vt++){var jt=Re[Vt],$=jt._seqIndices,lt=jt._sosType,Un=jt._eosType,rt=H[$[0]]&1?S:k;if(Q.get(ie))for(var wt=0;wt<$.length;wt++){var Sr=$[wt];if(P[Sr]&ie){for(var Xt=lt,kt=wt-1;kt>=0;kt--)if(!(P[$[kt]]&n)){Xt=P[$[kt]];break}re(Sr,Xt&(e|M)?N:Xt)}}if(Q.get(Y))for(var xt=0;xt<$.length;xt++){var Tr=$[xt];if(P[Tr]&Y)for(var Ft=xt-1;Ft>=-1;Ft--){var wr=Ft===-1?lt:P[$[Ft]];if(wr&o){wr===G&&re(Tr,b);break}}}if(Q.get(G))for(var Yt=0;Yt<$.length;Yt++){var kr=$[Yt];P[kr]&G&&re(kr,S)}if(Q.get(J)||Q.get(L))for(var ft=1;ft<$.length-1;ft++){var Ht=$[ft];if(P[Ht]&(J|L)){for(var nt=0,Jt=0,Kt=ft-1;Kt>=0&&(nt=P[$[Kt]],!!(nt&n));Kt--);for(var Qt=ft+1;Qt<$.length&&(Jt=P[$[Qt]],!!(Jt&n));Qt++);nt===Jt&&(P[Ht]===J?nt===Y:nt&(Y|b))&&re(Ht,nt)}}if(Q.get(Y))for(var Xe=0;Xe<$.length;Xe++){var _n=$[Xe];if(P[_n]&Y){for(var Ct=Xe-1;Ct>=0&&P[$[Ct]]&(ne|n);Ct--)re($[Ct],Y);for(Xe++;Xe<$.length&&P[$[Xe]]&(ne|n|Y);Xe++)P[$[Xe]]!==Y&&re($[Xe],Y)}}if(Q.get(ne)||Q.get(J)||Q.get(L))for(var ut=0;ut<$.length;ut++){var xr=$[ut];if(P[xr]&(ne|J|L)){re(xr,N);for(var Dt=ut-1;Dt>=0&&P[$[Dt]]&n;Dt--)re($[Dt],N);for(var At=ut+1;At<$.length&&P[$[At]]&n;At++)re($[At],N)}}if(Q.get(Y))for(var Zt=0,Fr=lt;Zt<$.length;Zt++){var Cr=$[Zt],qt=P[Cr];qt&Y?Fr===k&&re(Cr,k):qt&o&&(Fr=qt)}if(Q.get(a)){var ct=S|Y|b,Dr=ct|k,Et=[];{for(var at=[],ot=0;ot<$.length;ot++)if(P[$[ot]]&a){var ht=R[$[ot]],Ar=void 0;if(x(ht)!==null)if(at.length<63)at.push({char:ht,seqIndex:ot});else break;else if((Ar=U(ht))!==null)for(var dt=at.length-1;dt>=0;dt--){var $t=at[dt].char;if($t===Ar||$t===U(T(ht))||x(T($t))===ht){Et.push([at[dt].seqIndex,ot]),at.length=dt;break}}}Et.sort(function(Ge,je){return Ge[0]-je[0]})}for(var er=0;er<Et.length;er++){for(var Er=Et[er],Mt=Er[0],tr=Er[1],Mr=!1,Ve=0,rr=Mt+1;rr<tr;rr++){var Pr=$[rr];if(P[Pr]&Dr){Mr=!0;var Gr=P[Pr]&ct?S:k;if(Gr===rt){Ve=Gr;break}}}if(Mr&&!Ve){Ve=lt;for(var nr=Mt-1;nr>=0;nr--){var Br=$[nr];if(P[Br]&Dr){var Or=P[Br]&ct?S:k;Or!==rt?Ve=Or:Ve=rt;break}}}if(Ve){if(P[$[Mt]]=P[$[tr]]=Ve,Ve!==rt){for(var vt=Mt+1;vt<$.length;vt++)if(!(P[$[vt]]&n)){f(R[$[vt]])&ie&&(P[$[vt]]=Ve);break}}if(Ve!==rt){for(var pt=tr+1;pt<$.length;pt++)if(!(P[$[pt]]&n)){f(R[$[pt]])&ie&&(P[$[pt]]=Ve);break}}}}for(var Ke=0;Ke<$.length;Ke++)if(P[$[Ke]]&a){for(var Rr=Ke,ar=Ke,or=lt,gt=Ke-1;gt>=0;gt--)if(P[$[gt]]&n)Rr=gt;else{or=P[$[gt]]&ct?S:k;break}for(var Lr=Un,mt=Ke+1;mt<$.length;mt++)if(P[$[mt]]&(a|n))ar=mt;else{Lr=P[$[mt]]&ct?S:k;break}for(var ir=Rr;ir<=ar;ir++)P[$[ir]]=or===Lr?or:rt;Ke=ar}}}for(var Le=ee.start;Le<=ee.end;Le++){var Sn=H[Le],Pt=P[Le];if(Sn&1?Pt&(k|Y|b)&&H[Le]++:Pt&S?H[Le]++:Pt&(b|Y)&&(H[Le]+=2),Pt&n&&(H[Le]=Le===0?ee.level:H[Le-1]),Le===ee.end||f(R[Le])&(j|A))for(var Gt=Le;Gt>=0&&f(R[Gt])&i;Gt--)H[Gt]=ee.level}}return{levels:H,paragraphs:pe};function Ir(Ge,je){for(var Be=Ge;Be<R.length;Be++){var Qe=P[Be];if(Qe&(S|G))return 1;if(Qe&(A|k)||je&&Qe===M)return 0;if(Qe&e){var Wr=Tn(Be);Be=Wr===-1?R.length:Wr}}return 0}function Tn(Ge){for(var je=1,Be=Ge+1;Be<R.length;Be++){var Qe=P[Be];if(Qe&A)break;if(Qe&M){if(--je===0)return Be}else Qe&e&&je++}return-1}}var Z="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",V;function E(){if(!V){var R=m(Z,!0),te=R.map,K=R.reverseMap;K.forEach(function(P,ae){te.set(ae,P)}),V=te}}function de(R){return E(),V.get(R)||null}function ce(R,te,K,P){var ae=R.length;K=Math.max(0,K==null?0:+K),P=Math.min(ae-1,P==null?ae-1:+P);for(var Q=new Map,re=K;re<=P;re++)if(te[re]&1){var H=de(R[re]);H!==null&&Q.set(re,H)}return Q}function X(R,te,K,P){var ae=R.length;K=Math.max(0,K==null?0:+K),P=Math.min(ae-1,P==null?ae-1:+P);var Q=[];return te.paragraphs.forEach(function(re){var H=Math.max(K,re.start),me=Math.min(P,re.end);if(H<me){for(var pe=te.levels.slice(H,me+1),ee=me;ee>=H&&f(R[ee])&i;ee--)pe[ee]=re.level;for(var ue=re.level,ge=1/0,xe=0;xe<pe.length;xe++){var fe=pe[xe];fe>ue&&(ue=fe),fe<ge&&(ge=fe|1)}for(var _e=ue;_e>=ge;_e--)for(var ve=0;ve<pe.length;ve++)if(pe[ve]>=_e){for(var oe=ve;ve+1<pe.length&&pe[ve+1]>=_e;)ve++;ve>oe&&Q.push([oe+H,ve+H])}}}),Q}function q(R,te,K,P){var ae=le(R,te,K,P),Q=[].concat(R);return ae.forEach(function(re,H){Q[H]=(te.levels[re]&1?de(R[re]):null)||R[re]}),Q.join("")}function le(R,te,K,P){for(var ae=X(R,te,K,P),Q=[],re=0;re<R.length;re++)Q[re]=re;return ae.forEach(function(H){for(var me=H[0],pe=H[1],ee=Q.slice(me,pe+1),ue=ee.length;ue--;)Q[pe-ue]=ee[ue]}),Q}return r.closingToOpeningBracket=U,r.getBidiCharType=f,r.getBidiCharTypeName=h,r.getCanonicalBracket=T,r.getEmbeddingLevels=z,r.getMirroredCharacter=de,r.getMirroredCharactersMap=ce,r.getReorderSegments=X,r.getReorderedIndices=le,r.getReorderedString=q,r.openingToClosingBracket=x,Object.defineProperty(r,"__esModule",{value:!0}),r}({});return c}const ln=/\bvoid\s+main\s*\(\s*\)\s*{/g;function hr(c){const r=/^[ \t]*#include +<([\w\d./]+)>/gm;function d(u,t){let e=Wn[t];return e?hr(e):u}return c.replace(r,d)}const Ae=[];for(let c=0;c<256;c++)Ae[c]=(c<16?"0":"")+c.toString(16);function Jn(){const c=Math.random()*4294967295|0,r=Math.random()*4294967295|0,d=Math.random()*4294967295|0,u=Math.random()*4294967295|0;return(Ae[c&255]+Ae[c>>8&255]+Ae[c>>16&255]+Ae[c>>24&255]+"-"+Ae[r&255]+Ae[r>>8&255]+"-"+Ae[r>>16&15|64]+Ae[r>>24&255]+"-"+Ae[d&63|128]+Ae[d>>8&255]+"-"+Ae[d>>16&255]+Ae[d>>24&255]+Ae[u&255]+Ae[u>>8&255]+Ae[u>>16&255]+Ae[u>>24&255]).toUpperCase()}const $e=Object.assign||function(){let c=arguments[0];for(let r=1,d=arguments.length;r<d;r++){let u=arguments[r];if(u)for(let t in u)Object.prototype.hasOwnProperty.call(u,t)&&(c[t]=u[t])}return c},Kn=Date.now(),jr=new WeakMap,Xr=new Map;let Qn=1e10;function dr(c,r){const d=ea(r);let u=jr.get(c);if(u||jr.set(c,u=Object.create(null)),u[d])return new u[d];const t=`_onBeforeCompile${d}`,e=function(i,s){c.onBeforeCompile.call(this,i,s);const l=this.customProgramCacheKey()+"|"+i.vertexShader+"|"+i.fragmentShader;let f=Xr[l];if(!f){const h=Zn(this,i,r,d);f=Xr[l]=h}i.vertexShader=f.vertexShader,i.fragmentShader=f.fragmentShader,$e(i.uniforms,this.uniforms),r.timeUniform&&(i.uniforms[r.timeUniform]={get value(){return Date.now()-Kn}}),this[t]&&this[t](i)},o=function(){return a(r.chained?c:c.clone())},a=function(i){const s=Object.create(i,n);return Object.defineProperty(s,"baseMaterial",{value:c}),Object.defineProperty(s,"id",{value:Qn++}),s.uuid=Jn(),s.uniforms=$e({},i.uniforms,r.uniforms),s.defines=$e({},i.defines,r.defines),s.defines[`TROIKA_DERIVED_MATERIAL_${d}`]="",s.extensions=$e({},i.extensions,r.extensions),s._listeners=void 0,s},n={constructor:{value:o},isDerivedMaterial:{value:!0},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return c.customProgramCacheKey()+"|"+d}},onBeforeCompile:{get(){return e},set(i){this[t]=i}},copy:{writable:!0,configurable:!0,value:function(i){return c.copy.call(this,i),!c.isShaderMaterial&&!c.isDerivedMaterial&&($e(this.extensions,i.extensions),$e(this.defines,i.defines),$e(this.uniforms,On.clone(i.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const i=new c.constructor;return a(i).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let i=this._depthMaterial;return i||(i=this._depthMaterial=dr(c.isDerivedMaterial?c.getDepthMaterial():new Rn({depthPacking:Ln}),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=dr(c.isDerivedMaterial?c.getDistanceMaterial():new In,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(),c.dispose.call(this)}}};return u[d]=o,new o}function Zn(c,{vertexShader:r,fragmentShader:d},u,t){let{vertexDefs:e,vertexMainIntro:o,vertexMainOutro:a,vertexTransform:n,fragmentDefs:i,fragmentMainIntro:s,fragmentMainOutro:l,fragmentColorTransform:f,customRewriter:h,timeUniform:y}=u;if(e=e||"",o=o||"",a=a||"",i=i||"",s=s||"",l=l||"",(n||h)&&(r=hr(r)),(f||h)&&(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=hr(d)),h){let m=h({vertexShader:r,fragmentShader:d});r=m.vertexShader,d=m.fragmentShader}if(f){let m=[];d=d.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,g=>(m.push(g),"")),l=`${f}
|
|
14
|
+
${m.join(`
|
|
15
|
+
`)}
|
|
16
|
+
${l}`}if(y){const m=`
|
|
17
|
+
uniform float ${y};
|
|
18
|
+
`;e=m+e,i=m+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
|
+
`,o=`
|
|
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
|
+
${o}
|
|
32
|
+
`,r=r.replace(/\b(position|normal|uv)\b/g,(m,g,C,v)=>/\battribute\s+vec[23]\s+$/.test(v.substr(0,C))?g:`troika_${g}_${t}`),c.map&&c.map.channel>0||(r=r.replace(/\bMAP_UV\b/g,`troika_uv_${t}`))),r=Yr(r,t,e,o,a),d=Yr(d,t,i,s,l),{vertexShader:r,fragmentShader:d}}function Yr(c,r,d,u,t){return(u||t||d)&&(c=c.replace(ln,`
|
|
33
|
+
${d}
|
|
34
|
+
void troikaOrigMain${r}() {`),c+=`
|
|
35
|
+
void main() {
|
|
36
|
+
${u}
|
|
37
|
+
troikaOrigMain${r}();
|
|
38
|
+
${t}
|
|
39
|
+
}`),c}function qn(c,r){return c==="uniforms"?void 0:typeof r=="function"?r.toString():r}let $n=0;const Hr=new Map;function ea(c){const r=JSON.stringify(c,qn);let d=Hr.get(r);return d==null&&Hr.set(r,d=++$n),d}function ta(c,r,d){const{defaultFontURL:u}=d,t=Object.create(null),e=1/0,o=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,a="[^\\S\\u00A0]",n=new RegExp(`${a}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function i(v,_){function x(){const U=T=>{console.error(`Failure loading font ${v}${v===u?"":"; trying fallback"}`,T),v!==u&&(v=u,x())};try{const T=new XMLHttpRequest;T.open("get",v,!0),T.responseType="arraybuffer",T.onload=function(){if(T.status>=400)U(new Error(T.statusText));else if(T.status>0)try{const k=c(T.response);_(k)}catch(k){U(k)}},T.onerror=U,T.send()}catch(T){U(T)}}x()}function s(v,_){v||(v=u);let x=t[v];x?x.pending?x.pending.push(_):_(x):(t[v]={pending:[_]},i(v,U=>{let T=t[v].pending;t[v]=U,T.forEach(k=>k(U))}))}function l({text:v="",font:_=u,sdfGlyphSize:x=64,fontSize:U=1,letterSpacing:T=0,lineHeight:k="normal",maxWidth:S=e,direction:Y,textAlign:J="left",textIndent:ne=0,whiteSpace:b="normal",overflowWrap:L="normal",anchorX:A=0,anchorY:j=0,includeCaretPositions:N=!1,chunkedBoundsSize:se=8192,colorRanges:ie=null},G,W=!1){const p=m(),w={fontLoad:0,typesetting:0};v.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),v=v.replace(/\r\n/g,`
|
|
40
|
+
`).replace(/\r/g,`
|
|
41
|
+
`)),U=+U,T=+T,S=+S,k=k||"normal",ne=+ne,s(_,O=>{const B=isFinite(S);let D=null,I=null,F=null,M=null,z=null,Z=null,V=null,E=0,de=0,ce=b!=="nowrap";const{ascender:X,descender:q,unitsPerEm:le,lineGap:R,capHeight:te,xHeight:K}=O;w.fontLoad=m()-p;const P=m(),ae=U/le;k==="normal"&&(k=(X-q+R)/le),k=k*U;const Q=(k-(X-q)*ae)/2,re=-(X*ae+Q),H=Math.min(k,(X-q)*ae),me=(X+q)/2*ae-H/2;let pe=ne,ee=new g;const ue=[ee];O.forEachGlyph(v,U,T,(fe,_e,ve)=>{const oe=v.charAt(ve),ye=fe.advanceWidth*ae,Ue=ee.count;let Fe;if("isEmpty"in fe||(fe.isWhitespace=!!oe&&new RegExp(a).test(oe),fe.canBreakAfter=!!oe&&n.test(oe),fe.isEmpty=fe.xMin===fe.xMax||fe.yMin===fe.yMax||o.test(oe)),!fe.isWhitespace&&!fe.isEmpty&&de++,ce&&B&&!fe.isWhitespace&&_e+ye+pe>S&&Ue){if(ee.glyphAt(Ue-1).glyphObj.canBreakAfter)Fe=new g,pe=-_e;else for(let Se=Ue;Se--;)if(Se===0&&L==="break-word"){Fe=new g,pe=-_e;break}else if(ee.glyphAt(Se).glyphObj.canBreakAfter){Fe=ee.splitAt(Se+1);const Me=Fe.glyphAt(0).x;pe-=Me;for(let Ye=Fe.count;Ye--;)Fe.glyphAt(Ye).x-=Me;break}Fe&&(ee.isSoftWrapped=!0,ee=Fe,ue.push(ee),E=S)}let he=ee.glyphAt(ee.count);he.glyphObj=fe,he.x=_e+pe,he.width=ye,he.charIndex=ve,oe===`
|
|
42
|
+
`&&(ee=new g,ue.push(ee),pe=-(_e+ye+T*U)+ne)}),ue.forEach(fe=>{for(let _e=fe.count;_e--;){let{glyphObj:ve,x:oe,width:ye}=fe.glyphAt(_e);if(!ve.isWhitespace){fe.width=oe+ye,fe.width>E&&(E=fe.width);return}}});let ge=0,xe=0;if(A&&(typeof A=="number"?ge=-A:typeof A=="string"&&(ge=-E*(A==="left"?0:A==="center"?.5:A==="right"?1:h(A)))),j){if(typeof j=="number")xe=-j;else if(typeof j=="string"){let fe=ue.length*k;xe=j==="top"?0:j==="top-baseline"?-re:j==="top-cap"?-re-te*ae:j==="top-ex"?-re-K*ae:j==="middle"?fe/2:j==="bottom"?fe:j==="bottom-baseline"?fe-Q+q*ae:h(j)*fe}}if(!W){const fe=r.getEmbeddingLevels(v,Y);D=new Uint16Array(de),I=new Float32Array(de*2),F={},Z=[e,e,-e,-e],V=[];let _e=re;N&&(z=new Float32Array(v.length*3)),ie&&(M=new Uint8Array(de*3));let ve=0,oe=-1,ye=-1,Ue,Fe;if(ue.forEach((he,Se)=>{let{count:Me,width:Ye}=he;if(Me>0){let Ze=0;for(let ke=Me;ke--&&he.glyphAt(ke).glyphObj.isWhitespace;)Ze++;let He=0,Ie=0;if(J==="center")He=(E-Ye)/2;else if(J==="right")He=E-Ye;else if(J==="justify"&&he.isSoftWrapped){let ke=0;for(let we=Me-Ze;we--;)he.glyphAt(we).glyphObj.isWhitespace&&ke++;Ie=(E-Ye)/ke}if(Ie||He){let ke=0;for(let we=0;we<Me;we++){let Ne=he.glyphAt(we);const Re=Ne.glyphObj;Ne.x+=He+ke,Ie!==0&&Re.isWhitespace&&we<Me-Ze&&(ke+=Ie,Ne.width+=Ie)}}const Oe=r.getReorderSegments(v,fe,he.glyphAt(0).charIndex,he.glyphAt(he.count-1).charIndex);for(let ke=0;ke<Oe.length;ke++){const[we,Ne]=Oe[ke];let Re=1/0,be=-1/0;for(let De=0;De<Me;De++)if(he.glyphAt(De).charIndex>=we){let We=De,Ee=De;for(;Ee<Me;Ee++){let Ce=he.glyphAt(Ee);if(Ce.charIndex>Ne)break;Ee<Me-Ze&&(Re=Math.min(Re,Ce.x),be=Math.max(be,Ce.x+Ce.width))}for(let Ce=We;Ce<Ee;Ce++){const Pe=he.glyphAt(Ce);Pe.x=be-(Pe.x+Pe.width-Re)}break}}let Te;const st=ke=>Te=ke;for(let ke=0;ke<Me;ke++){let we=he.glyphAt(ke);Te=we.glyphObj;const Ne=Te.index,Re=fe.levels[we.charIndex]&1;if(Re){const be=r.getMirroredCharacter(v[we.charIndex]);be&&O.forEachGlyph(be,0,0,st)}if(N){const{charIndex:be}=we,De=we.x+ge,We=we.x+we.width+ge;z[be*3]=Re?We:De,z[be*3+1]=Re?De:We,z[be*3+2]=_e+me+xe;const Ee=be-oe;Ee>1&&y(z,oe,Ee),oe=be}if(ie){const{charIndex:be}=we;for(;be>ye;)ye++,ie.hasOwnProperty(ye)&&(Fe=ie[ye])}if(!Te.isWhitespace&&!Te.isEmpty){const be=ve++;F[Ne]||(F[Ne]={path:Te.path,pathBounds:[Te.xMin,Te.yMin,Te.xMax,Te.yMax]});const De=we.x+ge,We=_e+xe;I[be*2]=De,I[be*2+1]=We;const Ee=De+Te.xMin*ae,Ce=We+Te.yMin*ae,Pe=De+Te.xMax*ae,Je=We+Te.yMax*ae;Ee<Z[0]&&(Z[0]=Ee),Ce<Z[1]&&(Z[1]=Ce),Pe>Z[2]&&(Z[2]=Pe),Je>Z[3]&&(Z[3]=Je),be%se===0&&(Ue={start:be,end:be,rect:[e,e,-e,-e]},V.push(Ue)),Ue.end++;const ze=Ue.rect;if(Ee<ze[0]&&(ze[0]=Ee),Ce<ze[1]&&(ze[1]=Ce),Pe>ze[2]&&(ze[2]=Pe),Je>ze[3]&&(ze[3]=Je),D[be]=Ne,ie){const qe=be*3;M[qe]=Fe>>16&255,M[qe+1]=Fe>>8&255,M[qe+2]=Fe&255}}}}_e-=k}),z){const he=v.length-oe;he>1&&y(z,oe,he)}}w.typesetting=m()-P,G({glyphIds:D,glyphPositions:I,glyphData:F,caretPositions:z,caretHeight:H,glyphColors:M,chunkedBounds:V,fontSize:U,unitsPerEm:le,ascender:X*ae,descender:q*ae,capHeight:te*ae,xHeight:K*ae,lineHeight:k,topBaseline:re,blockBounds:[ge,xe-ue.length*k,ge+E,xe],visibleBounds:Z,timings:w})})}function f(v,_){l(v,x=>{const[U,T,k,S]=x.blockBounds;_({width:k-U,height:S-T})},{metricsOnly:!0})}function h(v){let _=v.match(/^([\d.]+)%$/),x=_?parseFloat(_[1]):NaN;return isNaN(x)?0:x/100}function y(v,_,x){const U=v[_*3],T=v[_*3+1],k=v[_*3+2],S=(T-U)/x;for(let Y=0;Y<x;Y++){const J=(_+Y)*3;v[J]=U+S*Y,v[J+1]=U+S*(Y+1),v[J+2]=k}}function m(){return(self.performance||Date).now()}function g(){this.data=[]}const C=["glyphObj","x","width","charIndex"];return g.prototype={width:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/C.length)},glyphAt(v){let _=g.flyweight;return _.data=this.data,_.index=v,_},splitAt(v){let _=new g;return _.data=this.data.splice(v*C.length),_}},g.flyweight=C.reduce((v,_,x,U)=>(Object.defineProperty(v,_,{get(){return this.data[this.index*C.length+x]},set(T){this.data[this.index*C.length+x]=T}}),v),{data:null,index:0}),{typeset:l,measure:f,loadFont:s}}const tt=()=>(self.performance||Date).now(),Nt=sn();let Jr;function ra(c,r,d,u,t,e,o,a,n,i,s=!0){return s?aa(c,r,d,u,t,e,o,a,n,i).then(null,l=>(Jr||(console.warn("WebGL SDF generation failed, falling back to JS",l),Jr=!0),Qr(c,r,d,u,t,e,o,a,n,i))):Qr(c,r,d,u,t,e,o,a,n,i)}const Lt=[],na=5;let vr=0;function fn(){const c=tt();for(;Lt.length&&tt()-c<na;)Lt.shift()();vr=Lt.length?setTimeout(fn,0):0}const aa=(...c)=>new Promise((r,d)=>{Lt.push(()=>{const u=tt();try{Nt.webgl.generateIntoCanvas(...c),r({timing:tt()-u})}catch(t){d(t)}}),vr||(vr=setTimeout(fn,0))}),oa=4,ia=2e3,Kr={};let sa=0;function Qr(c,r,d,u,t,e,o,a,n,i){const s="TroikaTextSDFGenerator_JS_"+sa++%oa;let l=Kr[s];return l||(l=Kr[s]={workerModule:_t({name:s,workerId:s,dependencies:[sn,tt],init(f,h){const y=f().javascript.generate;return function(...m){const g=h();return{textureData:y(...m),timing:h()-g}}},getTransferables(f){return[f.textureData.buffer]}}),requests:0,idleTimer:null}),l.requests++,clearTimeout(l.idleTimer),l.workerModule(c,r,d,u,t,e).then(({textureData:f,timing:h})=>{const y=tt(),m=new Uint8Array(f.length*4);for(let g=0;g<f.length;g++)m[g*4+i]=f[g];return Nt.webglUtils.renderImageData(o,m,a,n,c,r,1<<3-i),h+=tt()-y,--l.requests===0&&(l.idleTimer=setTimeout(()=>{Xn(s)},ia)),{timing:h}})}function la(c){c._warm||(Nt.webgl.isSupported(c),c._warm=!0)}const fa=Nt.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 ua(){return typeof window>"u"&&(self.window=self),function(c){var r={parse:function(t){var e=r._bin,o=new Uint8Array(t);if(e.readASCII(o,0,4)=="ttcf"){var a=4;e.readUshort(o,a),a+=2,e.readUshort(o,a),a+=2;var n=e.readUint(o,a);a+=4;for(var i=[],s=0;s<n;s++){var l=e.readUint(o,a);a+=4,i.push(r._readFont(o,l))}return i}return[r._readFont(o,0)]},_readFont:function(t,e){var o=r._bin,a=e;o.readFixed(t,e),e+=4;var n=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 i=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GPOS","GSUB","SVG "],s={_data:t,_offset:a},l={},f=0;f<n;f++){var h=o.readASCII(t,e,4);e+=4,o.readUint(t,e),e+=4;var y=o.readUint(t,e);e+=4;var m=o.readUint(t,e);e+=4,l[h]={offset:y,length:m}}for(f=0;f<i.length;f++){var g=i[f];l[g]&&(s[g.trim()]=r[g.trim()].parse(t,l[g].offset,l[g].length,s))}return s},_tabOffset:function(t,e,o){for(var a=r._bin,n=a.readUshort(t,o+4),i=o+12,s=0;s<n;s++){var l=a.readASCII(t,i,4);i+=4,a.readUint(t,i),i+=4;var f=a.readUint(t,i);if(i+=4,a.readUint(t,i),i+=4,l==e)return f}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,o){for(var a=[],n=0;n<o;n++)a.push(r._bin.readUshort(t,e+2*n));return a},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,o){for(var a="",n=0;n<o;n++)a+=String.fromCharCode(t[e+n]);return a},readUnicode:function(t,e,o){for(var a="",n=0;n<o;n++){var i=t[e++]<<8|t[e++];a+=String.fromCharCode(i)}return a},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(t,e,o){var a=r._bin._tdec;return a&&e==0&&o==t.length?a.decode(t):r._bin.readASCII(t,e,o)},readBytes:function(t,e,o){for(var a=[],n=0;n<o;n++)a.push(t[e+n]);return a},readASCIIArray:function(t,e,o){for(var a=[],n=0;n<o;n++)a.push(String.fromCharCode(t[e+n]));return a},_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,o,a,n){var i=r._bin,s={},l=e;i.readFixed(t,e),e+=4;var f=i.readUshort(t,e);e+=2;var h=i.readUshort(t,e);e+=2;var y=i.readUshort(t,e);return e+=2,s.scriptList=r._lctf.readScriptList(t,l+f),s.featureList=r._lctf.readFeatureList(t,l+h),s.lookupList=r._lctf.readLookupList(t,l+y,n),s},r._lctf.readLookupList=function(t,e,o){var a=r._bin,n=e,i=[],s=a.readUshort(t,e);e+=2;for(var l=0;l<s;l++){var f=a.readUshort(t,e);e+=2;var h=r._lctf.readLookupTable(t,n+f,o);i.push(h)}return i},r._lctf.readLookupTable=function(t,e,o){var a=r._bin,n=e,i={tabs:[]};i.ltype=a.readUshort(t,e),e+=2,i.flag=a.readUshort(t,e),e+=2;var s=a.readUshort(t,e);e+=2;for(var l=i.ltype,f=0;f<s;f++){var h=a.readUshort(t,e);e+=2;var y=o(t,l,n+h,i);i.tabs.push(y)}return i},r._lctf.numOfOnes=function(t){for(var e=0,o=0;o<32;o++)t>>>o&1&&e++;return e},r._lctf.readClassDef=function(t,e){var o=r._bin,a=[],n=o.readUshort(t,e);if(e+=2,n==1){var i=o.readUshort(t,e);e+=2;var s=o.readUshort(t,e);e+=2;for(var l=0;l<s;l++)a.push(i+l),a.push(i+l),a.push(o.readUshort(t,e)),e+=2}if(n==2){var f=o.readUshort(t,e);for(e+=2,l=0;l<f;l++)a.push(o.readUshort(t,e)),e+=2,a.push(o.readUshort(t,e)),e+=2,a.push(o.readUshort(t,e)),e+=2}return a},r._lctf.getInterval=function(t,e){for(var o=0;o<t.length;o+=3){var a=t[o],n=t[o+1];if(t[o+2],a<=e&&e<=n)return o}return-1},r._lctf.readCoverage=function(t,e){var o=r._bin,a={};a.fmt=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);return e+=2,a.fmt==1&&(a.tab=o.readUshorts(t,e,n)),a.fmt==2&&(a.tab=o.readUshorts(t,e,3*n)),a},r._lctf.coverageIndex=function(t,e){var o=t.tab;if(t.fmt==1)return o.indexOf(e);if(t.fmt==2){var a=r._lctf.getInterval(o,e);if(a!=-1)return o[a+2]+(e-o[a])}return-1},r._lctf.readFeatureList=function(t,e){var o=r._bin,a=e,n=[],i=o.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var l=o.readASCII(t,e,4);e+=4;var f=o.readUshort(t,e);e+=2;var h=r._lctf.readFeatureTable(t,a+f);h.tag=l.trim(),n.push(h)}return n},r._lctf.readFeatureTable=function(t,e){var o=r._bin,a=e,n={},i=o.readUshort(t,e);e+=2,i>0&&(n.featureParams=a+i);var s=o.readUshort(t,e);e+=2,n.tab=[];for(var l=0;l<s;l++)n.tab.push(o.readUshort(t,e+2*l));return n},r._lctf.readScriptList=function(t,e){var o=r._bin,a=e,n={},i=o.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var l=o.readASCII(t,e,4);e+=4;var f=o.readUshort(t,e);e+=2,n[l.trim()]=r._lctf.readScriptTable(t,a+f)}return n},r._lctf.readScriptTable=function(t,e){var o=r._bin,a=e,n={},i=o.readUshort(t,e);e+=2,n.default=r._lctf.readLangSysTable(t,a+i);var s=o.readUshort(t,e);e+=2;for(var l=0;l<s;l++){var f=o.readASCII(t,e,4);e+=4;var h=o.readUshort(t,e);e+=2,n[f.trim()]=r._lctf.readLangSysTable(t,a+h)}return n},r._lctf.readLangSysTable=function(t,e){var o=r._bin,a={};o.readUshort(t,e),e+=2,a.reqFeature=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);return e+=2,a.features=o.readUshorts(t,e,n),a},r.CFF={},r.CFF.parse=function(t,e,o){var a=r._bin;(t=new Uint8Array(t.buffer,e,o))[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(a.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 f=[];for(s=0;s<l.length-1;s++)f.push(r.CFF.readDict(t,e+l[s],e+l[s+1]));e+=l[l.length-1];var h=f[0],y=[];e=r.CFF.readIndex(t,e,y);var m=[];for(s=0;s<y.length-1;s++)m.push(a.readASCII(t,e+y[s],y[s+1]-y[s]));if(e+=y[y.length-1],r.CFF.readSubrs(t,e,h),h.CharStrings){e=h.CharStrings,y=[],e=r.CFF.readIndex(t,e,y);var g=[];for(s=0;s<y.length-1;s++)g.push(a.readBytes(t,e+y[s],y[s+1]-y[s]));h.CharStrings=g}if(h.ROS){e=h.FDArray;var C=[];for(e=r.CFF.readIndex(t,e,C),h.FDArray=[],s=0;s<C.length-1;s++){var v=r.CFF.readDict(t,e+C[s],e+C[s+1]);r.CFF._readFDict(t,v,m),h.FDArray.push(v)}e+=C[C.length-1],e=h.FDSelect,h.FDSelect=[];var _=t[e];if(e++,_!=3)throw _;var x=a.readUshort(t,e);for(e+=2,s=0;s<x+1;s++)h.FDSelect.push(a.readUshort(t,e),t[e+2]),e+=3}return h.Encoding&&(h.Encoding=r.CFF.readEncoding(t,h.Encoding,h.CharStrings.length)),h.charset&&(h.charset=r.CFF.readCharset(t,h.charset,h.CharStrings.length)),r.CFF._readFDict(t,h,m),h},r.CFF._readFDict=function(t,e,o){var a;for(var n in e.Private&&(a=e.Private[1],e.Private=r.CFF.readDict(t,a,a+e.Private[0]),e.Private.Subrs&&r.CFF.readSubrs(t,a+e.Private.Subrs,e.Private)),e)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(n)!=-1&&(e[n]=o[e[n]-426+35])},r.CFF.readSubrs=function(t,e,o){var a=r._bin,n=[];e=r.CFF.readIndex(t,e,n);var i,s=n.length;i=s<1240?107:s<33900?1131:32768,o.Bias=i,o.Subrs=[];for(var l=0;l<n.length-1;l++)o.Subrs.push(a.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 o=0;o<t.charset.length;o++)if(t.charset[o]==e)return o;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,o){r._bin;var a=[".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++)a.push(t[e+s]);return a},r.CFF.readCharset=function(t,e,o){var a=r._bin,n=[".notdef"],i=t[e];if(e++,i==0)for(var s=0;s<o;s++){var l=a.readUshort(t,e);e+=2,n.push(l)}else{if(i!=1&&i!=2)throw"error: format: "+i;for(;n.length<o;){l=a.readUshort(t,e),e+=2;var f=0;for(i==1?(f=t[e],e++):(f=a.readUshort(t,e),e+=2),s=0;s<=f;s++)n.push(l),l++}}return n},r.CFF.readIndex=function(t,e,o){var a=r._bin,n=a.readUshort(t,e)+1,i=t[e+=2];if(e++,i==1)for(var s=0;s<n;s++)o.push(t[e+s]);else if(i==2)for(s=0;s<n;s++)o.push(a.readUshort(t,e+2*s));else if(i==3)for(s=0;s<n;s++)o.push(16777215&a.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,o){var a=r._bin,n=t[e],i=t[e+1];t[e+2],t[e+3],t[e+4];var s=1,l=null,f=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&&(f=a.readShort(t,e+1),s=3),29<=n&&n<=31&&(l=n,s=1),32<=n&&n<=246&&(f=n-139,s=1),247<=n&&n<=250&&(f=256*(n-247)+i+108,s=2),251<=n&&n<=254&&(f=256*-(n-251)-i-108,s=2),n==255&&(f=a.readInt(t,e+1)/65535,s=5),o.val=f??"o"+l,o.size=s},r.CFF.readCharString=function(t,e,o){for(var a=e+o,n=r._bin,i=[];e<a;){var s=t[e],l=t[e+1];t[e+2],t[e+3],t[e+4];var f=1,h=null,y=null;s<=20&&(h=s,f=1),s==12&&(h=100*s+l,f=2),s!=19&&s!=20||(h=s,f=2),21<=s&&s<=27&&(h=s,f=1),s==28&&(y=n.readShort(t,e+1),f=3),29<=s&&s<=31&&(h=s,f=1),32<=s&&s<=246&&(y=s-139,f=1),247<=s&&s<=250&&(y=256*(s-247)+l+108,f=2),251<=s&&s<=254&&(y=256*-(s-251)-l-108,f=2),s==255&&(y=n.readInt(t,e+1)/65535,f=5),i.push(y??"o"+h),e+=f}return i},r.CFF.readDict=function(t,e,o){for(var a=r._bin,n={},i=[];e<o;){var s=t[e],l=t[e+1];t[e+2],t[e+3],t[e+4];var f=1,h=null,y=null;if(s==28&&(y=a.readShort(t,e+1),f=3),s==29&&(y=a.readInt(t,e+1),f=5),32<=s&&s<=246&&(y=s-139,f=1),247<=s&&s<=250&&(y=256*(s-247)+l+108,f=2),251<=s&&s<=254&&(y=256*-(s-251)-l-108,f=2),s==255)throw y=a.readInt(t,e+1)/65535,f=5,"unknown number";if(s==30){var m=[];for(f=1;;){var g=t[e+f];f++;var C=g>>4,v=15&g;if(C!=15&&m.push(C),v!=15&&m.push(v),v==15)break}for(var _="",x=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],U=0;U<m.length;U++)_+=x[m[U]];y=parseFloat(_)}s<=21&&(h=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][s],f=1,s==12&&(h=["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],f=2)),h!=null?(n[h]=i.length==1?i[0]:i,i=[]):i.push(y),e+=f}return n},r.cmap={},r.cmap.parse=function(t,e,o){t=new Uint8Array(t.buffer,e,o),e=0;var a=r._bin,n={};a.readUshort(t,e),e+=2;var i=a.readUshort(t,e);e+=2;var s=[];n.tables=[];for(var l=0;l<i;l++){var f=a.readUshort(t,e);e+=2;var h=a.readUshort(t,e);e+=2;var y=a.readUint(t,e);e+=4;var m="p"+f+"e"+h,g=s.indexOf(y);if(g==-1){var C;g=n.tables.length,s.push(y);var v=a.readUshort(t,y);v==0?C=r.cmap.parse0(t,y):v==4?C=r.cmap.parse4(t,y):v==6?C=r.cmap.parse6(t,y):v==12?C=r.cmap.parse12(t,y):console.debug("unknown format: "+v,f,h,y),n.tables.push(C)}if(n[m]!=null)throw"multiple tables for one platform+encoding";n[m]=g}return n},r.cmap.parse0=function(t,e){var o=r._bin,a={};a.format=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);e+=2,o.readUshort(t,e),e+=2,a.map=[];for(var i=0;i<n-6;i++)a.map.push(t[e+i]);return a},r.cmap.parse4=function(t,e){var o=r._bin,a=e,n={};n.format=o.readUshort(t,e),e+=2;var i=o.readUshort(t,e);e+=2,o.readUshort(t,e),e+=2;var s=o.readUshort(t,e);e+=2;var l=s/2;n.searchRange=o.readUshort(t,e),e+=2,n.entrySelector=o.readUshort(t,e),e+=2,n.rangeShift=o.readUshort(t,e),e+=2,n.endCount=o.readUshorts(t,e,l),e+=2*l,e+=2,n.startCount=o.readUshorts(t,e,l),e+=2*l,n.idDelta=[];for(var f=0;f<l;f++)n.idDelta.push(o.readShort(t,e)),e+=2;for(n.idRangeOffset=o.readUshorts(t,e,l),e+=2*l,n.glyphIdArray=[];e<a+i;)n.glyphIdArray.push(o.readUshort(t,e)),e+=2;return n},r.cmap.parse6=function(t,e){var o=r._bin,a={};a.format=o.readUshort(t,e),e+=2,o.readUshort(t,e),e+=2,o.readUshort(t,e),e+=2,a.firstCode=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);e+=2,a.glyphIdArray=[];for(var i=0;i<n;i++)a.glyphIdArray.push(o.readUshort(t,e)),e+=2;return a},r.cmap.parse12=function(t,e){var o=r._bin,a={};a.format=o.readUshort(t,e),e+=2,e+=2,o.readUint(t,e),e+=4,o.readUint(t,e),e+=4;var n=o.readUint(t,e);e+=4,a.groups=[];for(var i=0;i<n;i++){var s=e+12*i,l=o.readUint(t,s+0),f=o.readUint(t,s+4),h=o.readUint(t,s+8);a.groups.push([l,f,h])}return a},r.glyf={},r.glyf.parse=function(t,e,o,a){for(var n=[],i=0;i<a.maxp.numGlyphs;i++)n.push(null);return n},r.glyf._parseGlyf=function(t,e){var o=r._bin,a=t._data,n=r._tabOffset(a,"glyf",t._offset)+t.loca[e];if(t.loca[e]==t.loca[e+1])return null;var i={};if(i.noc=o.readShort(a,n),n+=2,i.xMin=o.readShort(a,n),n+=2,i.yMin=o.readShort(a,n),n+=2,i.xMax=o.readShort(a,n),n+=2,i.yMax=o.readShort(a,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(o.readUshort(a,n)),n+=2;var l=o.readUshort(a,n);if(n+=2,a.length-n<l)return null;i.instructions=o.readBytes(a,n,l),n+=l;var f=i.endPts[i.noc-1]+1;for(i.flags=[],s=0;s<f;s++){var h=a[n];if(n++,i.flags.push(h),(8&h)!=0){var y=a[n];n++;for(var m=0;m<y;m++)i.flags.push(h),s++}}for(i.xs=[],s=0;s<f;s++){var g=(2&i.flags[s])!=0,C=(16&i.flags[s])!=0;g?(i.xs.push(C?a[n]:-a[n]),n++):C?i.xs.push(0):(i.xs.push(o.readShort(a,n)),n+=2)}for(i.ys=[],s=0;s<f;s++)g=(4&i.flags[s])!=0,C=(32&i.flags[s])!=0,g?(i.ys.push(C?a[n]:-a[n]),n++):C?i.ys.push(0):(i.ys.push(o.readShort(a,n)),n+=2);var v=0,_=0;for(s=0;s<f;s++)v+=i.xs[s],_+=i.ys[s],i.xs[s]=v,i.ys[s]=_}else{var x;i.parts=[];do{x=o.readUshort(a,n),n+=2;var U={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(i.parts.push(U),U.glyphIndex=o.readUshort(a,n),n+=2,1&x){var T=o.readShort(a,n);n+=2;var k=o.readShort(a,n);n+=2}else T=o.readInt8(a,n),n++,k=o.readInt8(a,n),n++;2&x?(U.m.tx=T,U.m.ty=k):(U.p1=T,U.p2=k),8&x?(U.m.a=U.m.d=o.readF2dot14(a,n),n+=2):64&x?(U.m.a=o.readF2dot14(a,n),n+=2,U.m.d=o.readF2dot14(a,n),n+=2):128&x&&(U.m.a=o.readF2dot14(a,n),n+=2,U.m.b=o.readF2dot14(a,n),n+=2,U.m.c=o.readF2dot14(a,n),n+=2,U.m.d=o.readF2dot14(a,n),n+=2)}while(32&x);if(256&x){var S=o.readUshort(a,n);for(n+=2,i.instr=[],s=0;s<S;s++)i.instr.push(a[n]),n++}}return i},r.GPOS={},r.GPOS.parse=function(t,e,o,a){return r._lctf.parse(t,e,o,a,r.GPOS.subt)},r.GPOS.subt=function(t,e,o,a){var n=r._bin,i=o,s={};if(s.fmt=n.readUshort(t,o),o+=2,e==1||e==2||e==3||e==7||e==8&&s.fmt<=2){var l=n.readUshort(t,o);o+=2,s.coverage=r._lctf.readCoverage(t,l+i)}if(e==1&&s.fmt==1){var f=n.readUshort(t,o);o+=2;var h=r._lctf.numOfOnes(f);f!=0&&(s.pos=r.GPOS.readValueRecord(t,o,f))}else if(e==2&&s.fmt>=1&&s.fmt<=2){f=n.readUshort(t,o),o+=2;var y=n.readUshort(t,o);o+=2,h=r._lctf.numOfOnes(f);var m=r._lctf.numOfOnes(y);if(s.fmt==1){s.pairsets=[];var g=n.readUshort(t,o);o+=2;for(var C=0;C<g;C++){var v=i+n.readUshort(t,o);o+=2;var _=n.readUshort(t,v);v+=2;for(var x=[],U=0;U<_;U++){var T=n.readUshort(t,v);v+=2,f!=0&&(b=r.GPOS.readValueRecord(t,v,f),v+=2*h),y!=0&&(L=r.GPOS.readValueRecord(t,v,y),v+=2*m),x.push({gid2:T,val1:b,val2:L})}s.pairsets.push(x)}}if(s.fmt==2){var k=n.readUshort(t,o);o+=2;var S=n.readUshort(t,o);o+=2;var Y=n.readUshort(t,o);o+=2;var J=n.readUshort(t,o);for(o+=2,s.classDef1=r._lctf.readClassDef(t,i+k),s.classDef2=r._lctf.readClassDef(t,i+S),s.matrix=[],C=0;C<Y;C++){var ne=[];for(U=0;U<J;U++){var b=null,L=null;f!=0&&(b=r.GPOS.readValueRecord(t,o,f),o+=2*h),y!=0&&(L=r.GPOS.readValueRecord(t,o,y),o+=2*m),ne.push({val1:b,val2:L})}s.matrix.push(ne)}}}else{if(e==9&&s.fmt==1){var A=n.readUshort(t,o);o+=2;var j=n.readUint(t,o);if(o+=4,a.ltype==9)a.ltype=A;else if(a.ltype!=A)throw"invalid extension substitution";return r.GPOS.subt(t,a.ltype,i+j)}console.debug("unsupported GPOS table LookupType",e,"format",s.fmt)}return s},r.GPOS.readValueRecord=function(t,e,o){var a=r._bin,n=[];return n.push(1&o?a.readShort(t,e):0),e+=1&o?2:0,n.push(2&o?a.readShort(t,e):0),e+=2&o?2:0,n.push(4&o?a.readShort(t,e):0),e+=4&o?2:0,n.push(8&o?a.readShort(t,e):0),e+=8&o?2:0,n},r.GSUB={},r.GSUB.parse=function(t,e,o,a){return r._lctf.parse(t,e,o,a,r.GSUB.subt)},r.GSUB.subt=function(t,e,o,a){var n=r._bin,i=o,s={};if(s.fmt=n.readUshort(t,o),o+=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,o);o+=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,o),o+=2;else if(s.fmt==2){var f=n.readUshort(t,o);o+=2,s.newg=n.readUshorts(t,o,f),o+=2*s.newg.length}}else if(e==4){s.vals=[],f=n.readUshort(t,o),o+=2;for(var h=0;h<f;h++){var y=n.readUshort(t,o);o+=2,s.vals.push(r.GSUB.readLigatureSet(t,i+y))}}else if(e==5&&s.fmt==2){if(s.fmt==2){var m=n.readUshort(t,o);o+=2,s.cDef=r._lctf.readClassDef(t,i+m),s.scset=[];var g=n.readUshort(t,o);for(o+=2,h=0;h<g;h++){var C=n.readUshort(t,o);o+=2,s.scset.push(C==0?null:r.GSUB.readSubClassSet(t,i+C))}}}else if(e==6&&s.fmt==3){if(s.fmt==3){for(h=0;h<3;h++){f=n.readUshort(t,o),o+=2;for(var v=[],_=0;_<f;_++)v.push(r._lctf.readCoverage(t,i+n.readUshort(t,o+2*_)));o+=2*f,h==0&&(s.backCvg=v),h==1&&(s.inptCvg=v),h==2&&(s.ahedCvg=v)}f=n.readUshort(t,o),o+=2,s.lookupRec=r.GSUB.readSubstLookupRecords(t,o,f)}}else{if(e==7&&s.fmt==1){var x=n.readUshort(t,o);o+=2;var U=n.readUint(t,o);if(o+=4,a.ltype==9)a.ltype=x;else if(a.ltype!=x)throw"invalid extension substitution";return r.GSUB.subt(t,a.ltype,i+U)}console.debug("unsupported GSUB table LookupType",e,"format",s.fmt)}return s},r.GSUB.readSubClassSet=function(t,e){var o=r._bin.readUshort,a=e,n=[],i=o(t,e);e+=2;for(var s=0;s<i;s++){var l=o(t,e);e+=2,n.push(r.GSUB.readSubClassRule(t,a+l))}return n},r.GSUB.readSubClassRule=function(t,e){var o=r._bin.readUshort,a={},n=o(t,e),i=o(t,e+=2);e+=2,a.input=[];for(var s=0;s<n-1;s++)a.input.push(o(t,e)),e+=2;return a.substLookupRecords=r.GSUB.readSubstLookupRecords(t,e,i),a},r.GSUB.readSubstLookupRecords=function(t,e,o){for(var a=r._bin.readUshort,n=[],i=0;i<o;i++)n.push(a(t,e),a(t,e+2)),e+=4;return n},r.GSUB.readChainSubClassSet=function(t,e){var o=r._bin,a=e,n=[],i=o.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var l=o.readUshort(t,e);e+=2,n.push(r.GSUB.readChainSubClassRule(t,a+l))}return n},r.GSUB.readChainSubClassRule=function(t,e){for(var o=r._bin,a={},n=["backtrack","input","lookahead"],i=0;i<n.length;i++){var s=o.readUshort(t,e);e+=2,i==1&&s--,a[n[i]]=o.readUshorts(t,e,s),e+=2*a[n[i]].length}return s=o.readUshort(t,e),e+=2,a.subst=o.readUshorts(t,e,2*s),e+=2*a.subst.length,a},r.GSUB.readLigatureSet=function(t,e){var o=r._bin,a=e,n=[],i=o.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var l=o.readUshort(t,e);e+=2,n.push(r.GSUB.readLigature(t,a+l))}return n},r.GSUB.readLigature=function(t,e){var o=r._bin,a={chain:[]};a.nglyph=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);e+=2;for(var i=0;i<n-1;i++)a.chain.push(o.readUshort(t,e)),e+=2;return a},r.head={},r.head.parse=function(t,e,o){var a=r._bin,n={};return a.readFixed(t,e),e+=4,n.fontRevision=a.readFixed(t,e),e+=4,a.readUint(t,e),e+=4,a.readUint(t,e),e+=4,n.flags=a.readUshort(t,e),e+=2,n.unitsPerEm=a.readUshort(t,e),e+=2,n.created=a.readUint64(t,e),e+=8,n.modified=a.readUint64(t,e),e+=8,n.xMin=a.readShort(t,e),e+=2,n.yMin=a.readShort(t,e),e+=2,n.xMax=a.readShort(t,e),e+=2,n.yMax=a.readShort(t,e),e+=2,n.macStyle=a.readUshort(t,e),e+=2,n.lowestRecPPEM=a.readUshort(t,e),e+=2,n.fontDirectionHint=a.readShort(t,e),e+=2,n.indexToLocFormat=a.readShort(t,e),e+=2,n.glyphDataFormat=a.readShort(t,e),e+=2,n},r.hhea={},r.hhea.parse=function(t,e,o){var a=r._bin,n={};return a.readFixed(t,e),e+=4,n.ascender=a.readShort(t,e),e+=2,n.descender=a.readShort(t,e),e+=2,n.lineGap=a.readShort(t,e),e+=2,n.advanceWidthMax=a.readUshort(t,e),e+=2,n.minLeftSideBearing=a.readShort(t,e),e+=2,n.minRightSideBearing=a.readShort(t,e),e+=2,n.xMaxExtent=a.readShort(t,e),e+=2,n.caretSlopeRise=a.readShort(t,e),e+=2,n.caretSlopeRun=a.readShort(t,e),e+=2,n.caretOffset=a.readShort(t,e),e+=2,e+=8,n.metricDataFormat=a.readShort(t,e),e+=2,n.numberOfHMetrics=a.readUshort(t,e),e+=2,n},r.hmtx={},r.hmtx.parse=function(t,e,o,a){for(var n=r._bin,i={aWidth:[],lsBearing:[]},s=0,l=0,f=0;f<a.maxp.numGlyphs;f++)f<a.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,o,a){var n=r._bin,i=n.readUshort(t,e);if(e+=2,i==1)return r.kern.parseV1(t,e-2,o,a);var s=n.readUshort(t,e);e+=2;for(var l={glyph1:[],rval:[]},f=0;f<s;f++){e+=2,o=n.readUshort(t,e),e+=2;var h=n.readUshort(t,e);e+=2;var y=h>>>8;if((y&=15)!=0)throw"unknown kern table format: "+y;e=r.kern.readFormat0(t,e,l)}return l},r.kern.parseV1=function(t,e,o,a){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 f=n.readUshort(t,e);e+=2,n.readUshort(t,e),e+=2;var h=f>>>8;if((h&=15)!=0)throw"unknown kern table format: "+h;e=r.kern.readFormat0(t,e,s)}return s},r.kern.readFormat0=function(t,e,o){var a=r._bin,n=-1,i=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 s=0;s<i;s++){var l=a.readUshort(t,e);e+=2;var f=a.readUshort(t,e);e+=2;var h=a.readShort(t,e);e+=2,l!=n&&(o.glyph1.push(l),o.rval.push({glyph2:[],vals:[]}));var y=o.rval[o.rval.length-1];y.glyph2.push(f),y.vals.push(h),n=l}return e},r.loca={},r.loca.parse=function(t,e,o,a){var n=r._bin,i=[],s=a.head.indexToLocFormat,l=a.maxp.numGlyphs+1;if(s==0)for(var f=0;f<l;f++)i.push(n.readUshort(t,e+(f<<1))<<1);if(s==1)for(f=0;f<l;f++)i.push(n.readUint(t,e+(f<<2)));return i},r.maxp={},r.maxp.parse=function(t,e,o){var a=r._bin,n={},i=a.readUint(t,e);return e+=4,n.numGlyphs=a.readUshort(t,e),e+=2,i==65536&&(n.maxPoints=a.readUshort(t,e),e+=2,n.maxContours=a.readUshort(t,e),e+=2,n.maxCompositePoints=a.readUshort(t,e),e+=2,n.maxCompositeContours=a.readUshort(t,e),e+=2,n.maxZones=a.readUshort(t,e),e+=2,n.maxTwilightPoints=a.readUshort(t,e),e+=2,n.maxStorage=a.readUshort(t,e),e+=2,n.maxFunctionDefs=a.readUshort(t,e),e+=2,n.maxInstructionDefs=a.readUshort(t,e),e+=2,n.maxStackElements=a.readUshort(t,e),e+=2,n.maxSizeOfInstructions=a.readUshort(t,e),e+=2,n.maxComponentElements=a.readUshort(t,e),e+=2,n.maxComponentDepth=a.readUshort(t,e),e+=2),n},r.name={},r.name.parse=function(t,e,o){var a=r._bin,n={};a.readUshort(t,e),e+=2;var i=a.readUshort(t,e);e+=2,a.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"],f=e+=2,h=0;h<i;h++){var y=a.readUshort(t,e);e+=2;var m=a.readUshort(t,e);e+=2;var g=a.readUshort(t,e);e+=2;var C=a.readUshort(t,e);e+=2;var v=a.readUshort(t,e);e+=2;var _=a.readUshort(t,e);e+=2;var x,U=l[C],T=f+12*i+_;if(y==0)x=a.readUnicode(t,T,v/2);else if(y==3&&m==0)x=a.readUnicode(t,T,v/2);else if(m==0)x=a.readASCII(t,T,v);else if(m==1)x=a.readUnicode(t,T,v/2);else if(m==3)x=a.readUnicode(t,T,v/2);else{if(y!=1)throw"unknown encoding "+m+", platformID: "+y;x=a.readASCII(t,T,v),console.debug("reading unknown MAC encoding "+m+" as ASCII")}var k="p"+y+","+g.toString(16);n[k]==null&&(n[k]={}),n[k][U!==void 0?U:C]=x,n[k]._lang=g}for(var S in n)if(n[S].postScriptName!=null&&n[S]._lang==1033)return n[S];for(var S in n)if(n[S].postScriptName!=null&&n[S]._lang==0)return n[S];for(var S in n)if(n[S].postScriptName!=null&&n[S]._lang==3084)return n[S];for(var S in n)if(n[S].postScriptName!=null)return n[S];for(var S in n){s=S;break}return console.debug("returning name table with languageID "+n[s]._lang),n[s]},r["OS/2"]={},r["OS/2"].parse=function(t,e,o){var a=r._bin.readUshort(t,e);e+=2;var n={};if(a==0)r["OS/2"].version0(t,e,n);else if(a==1)r["OS/2"].version1(t,e,n);else if(a==2||a==3||a==4)r["OS/2"].version2(t,e,n);else{if(a!=5)throw"unknown OS/2 table version: "+a;r["OS/2"].version5(t,e,n)}return n},r["OS/2"].version0=function(t,e,o){var a=r._bin;return o.xAvgCharWidth=a.readShort(t,e),e+=2,o.usWeightClass=a.readUshort(t,e),e+=2,o.usWidthClass=a.readUshort(t,e),e+=2,o.fsType=a.readUshort(t,e),e+=2,o.ySubscriptXSize=a.readShort(t,e),e+=2,o.ySubscriptYSize=a.readShort(t,e),e+=2,o.ySubscriptXOffset=a.readShort(t,e),e+=2,o.ySubscriptYOffset=a.readShort(t,e),e+=2,o.ySuperscriptXSize=a.readShort(t,e),e+=2,o.ySuperscriptYSize=a.readShort(t,e),e+=2,o.ySuperscriptXOffset=a.readShort(t,e),e+=2,o.ySuperscriptYOffset=a.readShort(t,e),e+=2,o.yStrikeoutSize=a.readShort(t,e),e+=2,o.yStrikeoutPosition=a.readShort(t,e),e+=2,o.sFamilyClass=a.readShort(t,e),e+=2,o.panose=a.readBytes(t,e,10),e+=10,o.ulUnicodeRange1=a.readUint(t,e),e+=4,o.ulUnicodeRange2=a.readUint(t,e),e+=4,o.ulUnicodeRange3=a.readUint(t,e),e+=4,o.ulUnicodeRange4=a.readUint(t,e),e+=4,o.achVendID=[a.readInt8(t,e),a.readInt8(t,e+1),a.readInt8(t,e+2),a.readInt8(t,e+3)],e+=4,o.fsSelection=a.readUshort(t,e),e+=2,o.usFirstCharIndex=a.readUshort(t,e),e+=2,o.usLastCharIndex=a.readUshort(t,e),e+=2,o.sTypoAscender=a.readShort(t,e),e+=2,o.sTypoDescender=a.readShort(t,e),e+=2,o.sTypoLineGap=a.readShort(t,e),e+=2,o.usWinAscent=a.readUshort(t,e),e+=2,o.usWinDescent=a.readUshort(t,e),e+=2},r["OS/2"].version1=function(t,e,o){var a=r._bin;return e=r["OS/2"].version0(t,e,o),o.ulCodePageRange1=a.readUint(t,e),e+=4,o.ulCodePageRange2=a.readUint(t,e),e+=4},r["OS/2"].version2=function(t,e,o){var a=r._bin;return e=r["OS/2"].version1(t,e,o),o.sxHeight=a.readShort(t,e),e+=2,o.sCapHeight=a.readShort(t,e),e+=2,o.usDefault=a.readUshort(t,e),e+=2,o.usBreak=a.readUshort(t,e),e+=2,o.usMaxContext=a.readUshort(t,e),e+=2},r["OS/2"].version5=function(t,e,o){var a=r._bin;return e=r["OS/2"].version2(t,e,o),o.usLowerOpticalPointSize=a.readUshort(t,e),e+=2,o.usUpperOpticalPointSize=a.readUshort(t,e),e+=2},r.post={},r.post.parse=function(t,e,o){var a=r._bin,n={};return n.version=a.readFixed(t,e),e+=4,n.italicAngle=a.readFixed(t,e),e+=4,n.underlinePosition=a.readShort(t,e),e+=2,n.underlineThickness=a.readShort(t,e),e+=2,n},r==null&&(r={}),r.U==null&&(r.U={}),r.U.codeToGlyph=function(t,e){var o=t.cmap,a=-1;if(o.p0e4!=null?a=o.p0e4:o.p3e1!=null?a=o.p3e1:o.p1e0!=null?a=o.p1e0:o.p0e3!=null&&(a=o.p0e3),a==-1)throw"no familiar platform and encoding!";var n=o.tables[a];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 o={cmds:[],crds:[]};if(t.SVG&&t.SVG.entries[e]){var a=t.SVG.entries[e];return a==null?o:(typeof a=="string"&&(a=r.SVG.toPath(a),t.SVG.entries[e]=a),a)}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,o)}else t.glyf&&r.U._drawGlyf(e,t,o);return o},r.U._drawGlyf=function(t,e,o){var a=e.glyf[t];a==null&&(a=e.glyf[t]=r.glyf._parseGlyf(e,t)),a!=null&&(a.noc>-1?r.U._simpleGlyph(a,o):r.U._compoGlyph(a,e,o))},r.U._simpleGlyph=function(t,e){for(var o=0;o<t.noc;o++){for(var a=o==0?0:t.endPts[o-1]+1,n=t.endPts[o],i=a;i<=n;i++){var s=i==a?n:i-1,l=i==n?a:i+1,f=1&t.flags[i],h=1&t.flags[s],y=1&t.flags[l],m=t.xs[i],g=t.ys[i];if(i==a)if(f){if(!h){r.U.P.moveTo(e,m,g);continue}r.U.P.moveTo(e,t.xs[s],t.ys[s])}else h?r.U.P.moveTo(e,t.xs[s],t.ys[s]):r.U.P.moveTo(e,(t.xs[s]+m)/2,(t.ys[s]+g)/2);f?h&&r.U.P.lineTo(e,m,g):y?r.U.P.qcurveTo(e,m,g,t.xs[l],t.ys[l]):r.U.P.qcurveTo(e,m,g,(m+t.xs[l])/2,(g+t.ys[l])/2)}r.U.P.closePath(e)}},r.U._compoGlyph=function(t,e,o){for(var a=0;a<t.parts.length;a++){var n={cmds:[],crds:[]},i=t.parts[a];r.U._drawGlyf(i.glyphIndex,e,n);for(var s=i.m,l=0;l<n.crds.length;l+=2){var f=n.crds[l],h=n.crds[l+1];o.crds.push(f*s.a+h*s.b+s.tx),o.crds.push(f*s.c+h*s.d+s.ty)}for(l=0;l<n.cmds.length;l++)o.cmds.push(n.cmds[l])}},r.U._getGlyphClass=function(t,e){var o=r._lctf.getInterval(e,t);return o==-1?0:e[o+2]},r.U.getPairAdjustment=function(t,e,o){var a=!1;if(t.GPOS)for(var n=t.GPOS,i=n.lookupList,s=n.featureList,l=[],f=0;f<s.length;f++){var h=s[f];if(h.tag=="kern"){a=!0;for(var y=0;y<h.tab.length;y++)if(!l[h.tab[y]]){l[h.tab[y]]=!0;for(var m=i[h.tab[y]],g=0;g<m.tabs.length;g++)if(m.tabs[g]!=null){var C,v=m.tabs[g];if((!v.coverage||(C=r._lctf.coverageIndex(v.coverage,e))!=-1)&&m.ltype!=1){if(m.ltype==2){var _=null;if(v.fmt==1){var x=v.pairsets[C];for(f=0;f<x.length;f++)x[f].gid2==o&&(_=x[f])}else if(v.fmt==2){var U=r.U._getGlyphClass(e,v.classDef1),T=r.U._getGlyphClass(o,v.classDef2);_=v.matrix[U][T]}if(_){var k=0;return _.val1&&_.val1[2]&&(k+=_.val1[2]),_.val2&&_.val2[0]&&(k+=_.val2[0]),k}}}}}}}if(t.kern&&!a){var S=t.kern.glyph1.indexOf(e);if(S!=-1){var Y=t.kern.rval[S].glyph2.indexOf(o);if(Y!=-1)return t.kern.rval[S].vals[Y]}}return 0},r.U._applySubs=function(t,e,o,a){for(var n=t.length-e-1,i=0;i<o.tabs.length;i++)if(o.tabs[i]!=null){var s,l=o.tabs[i];if(!l.coverage||(s=r._lctf.coverageIndex(l.coverage,t[e]))!=-1){if(o.ltype==1)t[e],l.fmt==1?t[e]=t[e]+l.delta:t[e]=l.newg[s];else if(o.ltype==4)for(var f=l.vals[s],h=0;h<f.length;h++){var y=f[h],m=y.chain.length;if(!(m>n)){for(var g=!0,C=0,v=0;v<m;v++){for(;t[e+C+(1+v)]==-1;)C++;y.chain[v]!=t[e+C+(1+v)]&&(g=!1)}if(g){for(t[e]=y.nglyph,v=0;v<m+C;v++)t[e+v+1]=-1;break}}}else if(o.ltype==5&&l.fmt==2)for(var _=r._lctf.getInterval(l.cDef,t[e]),x=l.cDef[_+2],U=l.scset[x],T=0;T<U.length;T++){var k=U[T],S=k.input;if(!(S.length>n)){for(g=!0,v=0;v<S.length;v++){var Y=r._lctf.getInterval(l.cDef,t[e+1+v]);if(_==-1&&l.cDef[Y+2]!=S[v]){g=!1;break}}if(g){var J=k.substLookupRecords;for(h=0;h<J.length;h+=2)J[h],J[h+1]}}}else if(o.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 ne=l.lookupRec;for(T=0;T<ne.length;T+=2){_=ne[T];var b=a[ne[T+1]];r.U._applySubs(t,e+_,b,a)}}}}},r.U._glsCovered=function(t,e,o){for(var a=0;a<e.length;a++)if(r._lctf.coverageIndex(e[a],t[o+a])==-1)return!1;return!0},r.U.glyphsToPath=function(t,e,o){for(var a={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,f=r.U.glyphToPath(t,s),h=0;h<f.crds.length;h+=2)a.crds.push(f.crds[h]+n),a.crds.push(f.crds[h+1]);for(o&&a.cmds.push(o),h=0;h<f.cmds.length;h++)a.cmds.push(f.cmds[h]);o&&a.cmds.push("X"),n+=t.hmtx.aWidth[s],i<e.length-1&&(n+=r.U.getPairAdjustment(t,s,l))}}return a},r.U.P={},r.U.P.moveTo=function(t,e,o){t.cmds.push("M"),t.crds.push(e,o)},r.U.P.lineTo=function(t,e,o){t.cmds.push("L"),t.crds.push(e,o)},r.U.P.curveTo=function(t,e,o,a,n,i,s){t.cmds.push("C"),t.crds.push(e,o,a,n,i,s)},r.U.P.qcurveTo=function(t,e,o,a,n){t.cmds.push("Q"),t.crds.push(e,o,a,n)},r.U.P.closePath=function(t){t.cmds.push("Z")},r.U._drawCFF=function(t,e,o,a,n){for(var i=e.stack,s=e.nStems,l=e.haveWidth,f=e.width,h=e.open,y=0,m=e.x,g=e.y,C=0,v=0,_=0,x=0,U=0,T=0,k=0,S=0,Y=0,J=0,ne={val:0,size:0};y<t.length;){r.CFF.getCharString(t,y,ne);var b=ne.val;if(y+=ne.size,b=="o1"||b=="o18")i.length%2!=0&&!l&&(f=i.shift()+a.nominalWidthX),s+=i.length>>1,i.length=0,l=!0;else if(b=="o3"||b=="o23")i.length%2!=0&&!l&&(f=i.shift()+a.nominalWidthX),s+=i.length>>1,i.length=0,l=!0;else if(b=="o4")i.length>1&&!l&&(f=i.shift()+a.nominalWidthX,l=!0),h&&r.U.P.closePath(n),g+=i.pop(),r.U.P.moveTo(n,m,g),h=!0;else if(b=="o5")for(;i.length>0;)m+=i.shift(),g+=i.shift(),r.U.P.lineTo(n,m,g);else if(b=="o6"||b=="o7")for(var L=i.length,A=b=="o6",j=0;j<L;j++){var N=i.shift();A?m+=N:g+=N,A=!A,r.U.P.lineTo(n,m,g)}else if(b=="o8"||b=="o24"){L=i.length;for(var se=0;se+6<=L;)C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),x=v+i.shift(),m=_+i.shift(),g=x+i.shift(),r.U.P.curveTo(n,C,v,_,x,m,g),se+=6;b=="o24"&&(m+=i.shift(),g+=i.shift(),r.U.P.lineTo(n,m,g))}else{if(b=="o11")break;if(b=="o1234"||b=="o1235"||b=="o1236"||b=="o1237")b=="o1234"&&(v=g,_=(C=m+i.shift())+i.shift(),J=x=v+i.shift(),T=x,S=g,m=(k=(U=(Y=_+i.shift())+i.shift())+i.shift())+i.shift(),r.U.P.curveTo(n,C,v,_,x,Y,J),r.U.P.curveTo(n,U,T,k,S,m,g)),b=="o1235"&&(C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),x=v+i.shift(),Y=_+i.shift(),J=x+i.shift(),U=Y+i.shift(),T=J+i.shift(),k=U+i.shift(),S=T+i.shift(),m=k+i.shift(),g=S+i.shift(),i.shift(),r.U.P.curveTo(n,C,v,_,x,Y,J),r.U.P.curveTo(n,U,T,k,S,m,g)),b=="o1236"&&(C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),J=x=v+i.shift(),T=x,k=(U=(Y=_+i.shift())+i.shift())+i.shift(),S=T+i.shift(),m=k+i.shift(),r.U.P.curveTo(n,C,v,_,x,Y,J),r.U.P.curveTo(n,U,T,k,S,m,g)),b=="o1237"&&(C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),x=v+i.shift(),Y=_+i.shift(),J=x+i.shift(),U=Y+i.shift(),T=J+i.shift(),k=U+i.shift(),S=T+i.shift(),Math.abs(k-m)>Math.abs(S-g)?m=k+i.shift():g=S+i.shift(),r.U.P.curveTo(n,C,v,_,x,Y,J),r.U.P.curveTo(n,U,T,k,S,m,g));else if(b=="o14"){if(i.length>0&&!l&&(f=i.shift()+o.nominalWidthX,l=!0),i.length==4){var ie=i.shift(),G=i.shift(),W=i.shift(),p=i.shift(),w=r.CFF.glyphBySE(o,W),O=r.CFF.glyphBySE(o,p);r.U._drawCFF(o.CharStrings[w],e,o,a,n),e.x=ie,e.y=G,r.U._drawCFF(o.CharStrings[O],e,o,a,n)}h&&(r.U.P.closePath(n),h=!1)}else if(b=="o19"||b=="o20")i.length%2!=0&&!l&&(f=i.shift()+a.nominalWidthX),s+=i.length>>1,i.length=0,l=!0,y+=s+7>>3;else if(b=="o21")i.length>2&&!l&&(f=i.shift()+a.nominalWidthX,l=!0),g+=i.pop(),m+=i.pop(),h&&r.U.P.closePath(n),r.U.P.moveTo(n,m,g),h=!0;else if(b=="o22")i.length>1&&!l&&(f=i.shift()+a.nominalWidthX,l=!0),m+=i.pop(),h&&r.U.P.closePath(n),r.U.P.moveTo(n,m,g),h=!0;else if(b=="o25"){for(;i.length>6;)m+=i.shift(),g+=i.shift(),r.U.P.lineTo(n,m,g);C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),x=v+i.shift(),m=_+i.shift(),g=x+i.shift(),r.U.P.curveTo(n,C,v,_,x,m,g)}else if(b=="o26")for(i.length%2&&(m+=i.shift());i.length>0;)C=m,v=g+i.shift(),m=_=C+i.shift(),g=(x=v+i.shift())+i.shift(),r.U.P.curveTo(n,C,v,_,x,m,g);else if(b=="o27")for(i.length%2&&(g+=i.shift());i.length>0;)v=g,_=(C=m+i.shift())+i.shift(),x=v+i.shift(),m=_+i.shift(),g=x,r.U.P.curveTo(n,C,v,_,x,m,g);else if(b=="o10"||b=="o29"){var B=b=="o10"?a:o;if(i.length==0)console.debug("error: empty stack");else{var D=i.pop(),I=B.Subrs[D+B.Bias];e.x=m,e.y=g,e.nStems=s,e.haveWidth=l,e.width=f,e.open=h,r.U._drawCFF(I,e,o,a,n),m=e.x,g=e.y,s=e.nStems,l=e.haveWidth,f=e.width,h=e.open}}else if(b=="o30"||b=="o31"){var F=i.length,M=(se=0,b=="o31");for(se+=F-(L=-3&F);se<L;)M?(v=g,_=(C=m+i.shift())+i.shift(),g=(x=v+i.shift())+i.shift(),L-se==5?(m=_+i.shift(),se++):m=_,M=!1):(C=m,v=g+i.shift(),_=C+i.shift(),x=v+i.shift(),m=_+i.shift(),L-se==5?(g=x+i.shift(),se++):g=x,M=!0),r.U.P.curveTo(n,C,v,_,x,m,g),se+=4}else{if((b+"").charAt(0)=="o")throw console.debug("Unknown operation: "+b,t),b;i.push(b)}}}e.x=m,e.y=g,e.nStems=s,e.haveWidth=l,e.width=f,e.open=h};var d=r,u={Typr:d};return c.Typr=d,c.default=u,Object.defineProperty(c,"__esModule",{value:!0}),c}({}).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 ca(){return function(c){var r=Uint8Array,d=Uint16Array,u=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]),o=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(b,L){for(var A=new d(31),j=0;j<31;++j)A[j]=L+=1<<b[j-1];var N=new u(A[30]);for(j=1;j<30;++j)for(var se=A[j];se<A[j+1];++se)N[se]=se-A[j]<<5|j;return[A,N]},n=a(t,2),i=n[0],s=n[1];i[28]=258,s[258]=28;for(var l=a(e,0)[0],f=new d(32768),h=0;h<32768;++h){var y=(43690&h)>>>1|(21845&h)<<1;y=(61680&(y=(52428&y)>>>2|(13107&y)<<2))>>>4|(3855&y)<<4,f[h]=((65280&y)>>>8|(255&y)<<8)>>>1}var m=function(b,L,A){for(var j=b.length,N=0,se=new d(L);N<j;++N)++se[b[N]-1];var ie,G=new d(L);for(N=0;N<L;++N)G[N]=G[N-1]+se[N-1]<<1;if(A){ie=new d(1<<L);var W=15-L;for(N=0;N<j;++N)if(b[N])for(var p=N<<4|b[N],w=L-b[N],O=G[b[N]-1]++<<w,B=O|(1<<w)-1;O<=B;++O)ie[f[O]>>>W]=p}else for(ie=new d(j),N=0;N<j;++N)b[N]&&(ie[N]=f[G[b[N]-1]++]>>>15-b[N]);return ie},g=new r(288);for(h=0;h<144;++h)g[h]=8;for(h=144;h<256;++h)g[h]=9;for(h=256;h<280;++h)g[h]=7;for(h=280;h<288;++h)g[h]=8;var C=new r(32);for(h=0;h<32;++h)C[h]=5;var v=m(g,9,1),_=m(C,5,1),x=function(b){for(var L=b[0],A=1;A<b.length;++A)b[A]>L&&(L=b[A]);return L},U=function(b,L,A){var j=L/8|0;return(b[j]|b[j+1]<<8)>>(7&L)&A},T=function(b,L){var A=L/8|0;return(b[A]|b[A+1]<<8|b[A+2]<<16)>>(7&L)},k=["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"],S=function(b,L,A){var j=new Error(L||k[b]);if(j.code=b,Error.captureStackTrace&&Error.captureStackTrace(j,S),!A)throw j;return j},Y=function(b,L,A){var j=b.length;if(!j||A&&!A.l&&j<5)return L||new r(0);var N=!L||A,se=!A||A.i;A||(A={}),L||(L=new r(3*j));var ie,G=function(oe){var ye=L.length;if(oe>ye){var Ue=new r(Math.max(2*ye,oe));Ue.set(L),L=Ue}},W=A.f||0,p=A.p||0,w=A.b||0,O=A.l,B=A.d,D=A.m,I=A.n,F=8*j;do{if(!O){A.f=W=U(b,p,1);var M=U(b,p+1,3);if(p+=3,!M){var z=b[(K=((ie=p)/8|0)+(7&ie&&1)+4)-4]|b[K-3]<<8,Z=K+z;if(Z>j){se&&S(0);break}N&&G(w+z),L.set(b.subarray(K,Z),w),A.b=w+=z,A.p=p=8*Z;continue}if(M==1)O=v,B=_,D=9,I=5;else if(M==2){var V=U(b,p,31)+257,E=U(b,p+10,15)+4,de=V+U(b,p+5,31)+1;p+=14;for(var ce=new r(de),X=new r(19),q=0;q<E;++q)X[o[q]]=U(b,p+3*q,7);p+=3*E;var le=x(X),R=(1<<le)-1,te=m(X,le,1);for(q=0;q<de;){var K,P=te[U(b,p,R)];if(p+=15&P,(K=P>>>4)<16)ce[q++]=K;else{var ae=0,Q=0;for(K==16?(Q=3+U(b,p,3),p+=2,ae=ce[q-1]):K==17?(Q=3+U(b,p,7),p+=3):K==18&&(Q=11+U(b,p,127),p+=7);Q--;)ce[q++]=ae}}var re=ce.subarray(0,V),H=ce.subarray(V);D=x(re),I=x(H),O=m(re,D,1),B=m(H,I,1)}else S(1);if(p>F){se&&S(0);break}}N&&G(w+131072);for(var me=(1<<D)-1,pe=(1<<I)-1,ee=p;;ee=p){var ue=(ae=O[T(b,p)&me])>>>4;if((p+=15&ae)>F){se&&S(0);break}if(ae||S(2),ue<256)L[w++]=ue;else{if(ue==256){ee=p,O=null;break}var ge=ue-254;if(ue>264){var xe=t[q=ue-257];ge=U(b,p,(1<<xe)-1)+i[q],p+=xe}var fe=B[T(b,p)&pe],_e=fe>>>4;if(fe||S(3),p+=15&fe,H=l[_e],_e>3&&(xe=e[_e],H+=T(b,p)&(1<<xe)-1,p+=xe),p>F){se&&S(0);break}N&&G(w+131072);for(var ve=w+ge;w<ve;w+=4)L[w]=L[w-H],L[w+1]=L[w+1-H],L[w+2]=L[w+2-H],L[w+3]=L[w+3-H];w=ve}}A.l=O,A.p=ee,A.b=w,O&&(W=1,A.m=D,A.d=B,A.n=I)}while(!W);return w==L.length?L:function(oe,ye,Ue){(ye==null||ye<0)&&(ye=0),(Ue==null||Ue>oe.length)&&(Ue=oe.length);var Fe=new(oe instanceof d?d:oe instanceof u?u:r)(Ue-ye);return Fe.set(oe.subarray(ye,Ue)),Fe}(L,0,w)},J=new r(0),ne=typeof TextDecoder<"u"&&new TextDecoder;try{ne.decode(J,{stream:!0})}catch{}return c.convert_streams=function(b){var L=new DataView(b),A=0;function j(){var V=L.getUint16(A);return A+=2,V}function N(){var V=L.getUint32(A);return A+=4,V}function se(V){z.setUint16(Z,V),Z+=2}function ie(V){z.setUint32(Z,V),Z+=4}for(var G={signature:N(),flavor:N(),length:N(),numTables:j(),reserved:j(),totalSfntSize:N(),majorVersion:j(),minorVersion:j(),metaOffset:N(),metaLength:N(),metaOrigLength:N(),privOffset:N(),privLength:N()},W=0;Math.pow(2,W)<=G.numTables;)W++;W--;for(var p=16*Math.pow(2,W),w=16*G.numTables-p,O=12,B=[],D=0;D<G.numTables;D++)B.push({tag:N(),offset:N(),compLength:N(),origLength:N(),origChecksum:N()}),O+=16;var I,F=new Uint8Array(12+16*B.length+B.reduce(function(V,E){return V+E.origLength+4},0)),M=F.buffer,z=new DataView(M),Z=0;return ie(G.flavor),se(G.numTables),se(p),se(W),se(w),B.forEach(function(V){ie(V.tag),ie(V.origChecksum),ie(O),ie(V.origLength),V.outOffset=O,(O+=V.origLength)%4!=0&&(O+=4-O%4)}),B.forEach(function(V){var E,de=b.slice(V.offset,V.offset+V.compLength);if(V.compLength!=V.origLength){var ce=new Uint8Array(V.origLength);E=new Uint8Array(de,2),Y(E,ce)}else ce=new Uint8Array(de);F.set(ce,V.outOffset);var X=0;(O=V.outOffset+V.origLength)%4!=0&&(X=4-O%4),F.set(new Uint8Array(X).buffer,V.outOffset+V.origLength),I=O+X}),M.slice(0,I)},Object.defineProperty(c,"__esModule",{value:!0}),c}({}).convert_streams}function ha(c,r){const d={M:2,L:2,Q:4,C:6,Z:0},u={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,o=4,a=8,n=16,i=32;let s;function l(U){if(!s){const T={R:e,L:t,D:o,C:n,U:i,T:a};s=new Map;for(let k in u){let S=0;u[k].split(",").forEach(Y=>{let[J,ne]=Y.split("+");J=parseInt(J,36),ne=ne?parseInt(ne,36):0,s.set(S+=J,T[k]);for(let b=ne;b--;)s.set(++S,T[k])})}}return s.get(U)||i}const f=1,h=2,y=3,m=4,g=[null,"isol","init","fina","medi"];function C(U){const T=new Uint8Array(U.length);let k=i,S=f,Y=-1;for(let J=0;J<U.length;J++){const ne=U.codePointAt(J);let b=l(ne)|0,L=f;b&a||(k&(t|o|n)?b&(e|o|n)?(L=y,(S===f||S===y)&&T[Y]++):b&(t|i)&&(S===h||S===m)&&T[Y]--:k&(e|i)&&(S===h||S===m)&&T[Y]--,S=T[J]=L,k=b,Y=J,ne>65535&&J++)}return T}function v(U,T){const k=[];for(let Y=0;Y<T.length;Y++){const J=T.codePointAt(Y);J>65535&&Y++,k.push(c.U.codeToGlyph(U,J))}const S=U.GSUB;if(S){const{lookupList:Y,featureList:J}=S;let ne;const b=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,L=[];J.forEach(A=>{if(b.test(A.tag))for(let j=0;j<A.tab.length;j++){if(L[A.tab[j]])continue;L[A.tab[j]]=!0;const N=Y[A.tab[j]],se=/^(isol|init|fina|medi)$/.test(A.tag);se&&!ne&&(ne=C(T));for(let ie=0;ie<k.length;ie++)(!ne||!se||g[ne[ie]]===A.tag)&&c.U._applySubs(k,ie,N,Y)}})}return k}function _(...U){for(let T=0;T<U.length;T++)if(typeof U[T]=="number")return U[T]}function x(U){const T=Object.create(null),k=U["OS/2"],S=U.hhea,Y=U.head.unitsPerEm,J=_(k&&k.sTypoAscender,S&&S.ascender,Y),ne={unitsPerEm:Y,ascender:J,descender:_(k&&k.sTypoDescender,S&&S.descender,0),capHeight:_(k&&k.sCapHeight,J),xHeight:_(k&&k.sxHeight,J),lineGap:_(k&&k.sTypoLineGap,S&&S.lineGap),forEachGlyph(b,L,A,j){let N=0;const se=1/ne.unitsPerEm*L,ie=v(U,b);let G=0,W=-1;return ie.forEach((p,w)=>{if(p!==-1){let O=T[p];if(!O){const{cmds:B,crds:D}=c.U.glyphToPath(U,p);let I="",F=0;for(let E=0,de=B.length;E<de;E++){const ce=d[B[E]];I+=B[E];for(let X=1;X<=ce;X++)I+=(X>1?",":"")+D[F++]}let M,z,Z,V;if(D.length){M=z=1/0,Z=V=-1/0;for(let E=0,de=D.length;E<de;E+=2){let ce=D[E],X=D[E+1];ce<M&&(M=ce),X<z&&(z=X),ce>Z&&(Z=ce),X>V&&(V=X)}}else M=Z=z=V=0;O=T[p]={index:p,advanceWidth:U.hmtx.aWidth[p],xMin:M,yMin:z,xMax:Z,yMax:V,path:I,pathCommandCount:B.length}}W!==-1&&(N+=c.U.getPairAdjustment(U,W,p)*se),j.call(null,O,N,G),O.advanceWidth&&(N+=O.advanceWidth*se),A&&(N+=A*L),W=p}G+=b.codePointAt(G)>65535?2:1}),N}};return ne}return function(T){const k=new Uint8Array(T,0,4),S=c._bin.readASCII(k,0,4);if(S==="wOFF")T=r(T);else if(S==="wOF2")throw new Error("woff2 fonts not supported");return x(c.parse(T)[0])}}const da=_t({name:"Typr Font Parser",dependencies:[ua,ca,ha],init(c,r,d){const u=c(),t=r();return d(u,t)}}),et={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},va=new pr;let un=!1;function it(){return(self.performance||Date).now()}function La(c){un?console.warn("configureTextBuilder called after first font request; will be ignored."):dn(et,c)}const Wt=Object.create(null);function cn(c,r){un=!0,c=dn({},c);const d=it();if(c.font=ga(c.font||et.defaultFontURL),c.text=""+c.text,c.sdfGlyphSize=c.sdfGlyphSize||et.sdfGlyphSize,c.colorRanges!=null){let l={};for(let f in c.colorRanges)if(c.colorRanges.hasOwnProperty(f)){let h=c.colorRanges[f];typeof h!="number"&&(h=va.set(h).getHex()),l[f]=h}c.colorRanges=l}Object.freeze(c);const{textureWidth:u,sdfExponent:t}=et,{sdfGlyphSize:e}=c,o=u/e*4;let a=Wt[e];if(!a){const l=document.createElement("canvas");l.width=u,l.height=e*256/o,a=Wt[e]={glyphCount:0,sdfGlyphSize:e,sdfCanvas:l,sdfTexture:new En(l,void 0,void 0,void 0,zr,zr),contextLost:!1,glyphsByFont:new Map},a.sdfTexture.generateMipmaps=!1,pa(a)}const{sdfTexture:n,sdfCanvas:i}=a;let s=a.glyphsByFont.get(c.font);s||a.glyphsByFont.set(c.font,s=new Map),ya(c).then(l=>{const{glyphIds:f,glyphPositions:h,fontSize:y,unitsPerEm:m,timings:g}=l,C=[],v=new Float32Array(f.length*4),_=y/m;let x=0,U=0;const T=it();f.forEach((ne,b)=>{let L=s.get(ne);if(!L){const{path:se,pathBounds:ie}=l.glyphData[ne],G=Math.max(ie[2]-ie[0],ie[3]-ie[1])/e*(et.sdfMargin*e+.5),W=a.glyphCount++,p=[ie[0]-G,ie[1]-G,ie[2]+G,ie[3]+G];s.set(ne,L={path:se,atlasIndex:W,sdfViewBox:p}),C.push(L)}const{sdfViewBox:A}=L,j=h[U++],N=h[U++];v[x++]=j+A[0]*_,v[x++]=N+A[1]*_,v[x++]=j+A[2]*_,v[x++]=N+A[3]*_,f[b]=L.atlasIndex}),g.quads=(g.quads||0)+(it()-T);const k=it();g.sdf={};const S=i.height,Y=Math.ceil(a.glyphCount/o),J=Math.pow(2,Math.ceil(Math.log2(Y*e)));J>S&&(console.info(`Increasing SDF texture size ${S}->${J}`),fa(i,u,J),n.dispose()),Promise.all(C.map(ne=>hn(ne,a,c.gpuAccelerateSDF).then(({timing:b})=>{g.sdf[ne.atlasIndex]=b}))).then(()=>{C.length&&!a.contextLost&&(vn(a),n.needsUpdate=!0),g.sdfTotal=it()-k,g.total=it()-d,r(Object.freeze({parameters:c,sdfTexture:n,sdfGlyphSize:e,sdfExponent:t,glyphBounds:v,glyphAtlasIndices:f,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(()=>{a.contextLost||la(i)})}function hn({path:c,atlasIndex:r,sdfViewBox:d},{sdfGlyphSize:u,sdfCanvas:t,contextLost:e},o){if(e)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:n}=et,i=Math.max(d[2]-d[0],d[3]-d[1]),s=Math.floor(r/4),l=s%(a/u)*u,f=Math.floor(s/(a/u))*u,h=r%4;return ra(u,u,c,d,i,n,t,l,f,h,o)}function pa(c){const r=c.sdfCanvas;r.addEventListener("webglcontextlost",d=>{console.log("Context Lost",d),d.preventDefault(),c.contextLost=!0}),r.addEventListener("webglcontextrestored",d=>{console.log("Context Restored",d),c.contextLost=!1;const u=[];c.glyphsByFont.forEach(t=>{t.forEach(e=>{u.push(hn(e,c,!0))})}),Promise.all(u).then(()=>{vn(c),c.sdfTexture.needsUpdate=!0})})}function Ia({font:c,characters:r,sdfGlyphSize:d},u){let t=Array.isArray(r)?r.join(`
|
|
52
|
+
`):""+r;cn({font:c,sdfGlyphSize:d,text:t},u)}function dn(c,r){for(let d in r)r.hasOwnProperty(d)&&(c[d]=r[d]);return c}let Bt;function ga(c){return Bt||(Bt=typeof document>"u"?{}:document.createElement("a")),Bt.href=c,Bt.href}function vn(c){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:r,sdfTexture:d}=c,{width:u,height:t}=r,e=c.sdfCanvas.getContext("webgl");let o=d.image.data;(!o||o.length!==u*t*4)&&(o=new Uint8Array(u*t*4),d.image={width:u,height:t,data:o},d.flipY=!1,d.isDataTexture=!0),e.readPixels(0,0,u,t,e.RGBA,e.UNSIGNED_BYTE,o)}}const ma=_t({name:"Typesetter",dependencies:[et,da,ta,Hn],init(c,r,d,u){const{defaultFontURL:t}=c;return d(r,u(),{defaultFontURL:t})}}),ya=_t({name:"Typesetter",dependencies:[ma],init(c){return function(r){return new Promise(d=>{c.typeset(r,d)})}},getTransferables(c){const r=[c.glyphPositions.buffer,c.glyphIds.buffer];return c.caretPositions&&r.push(c.caretPositions.buffer),c.glyphColors&&r.push(c.glyphColors.buffer),r}});function Wa(){Object.keys(Wt).forEach(c=>{const r=Wt[c].sdfCanvas,{width:d,height:u}=r;console.log("%c.",`
|
|
53
|
+
background: url(${r.toDataURL()});
|
|
54
|
+
background-size: ${d}px ${u}px;
|
|
55
|
+
color: transparent;
|
|
56
|
+
font-size: 0;
|
|
57
|
+
line-height: ${u}px;
|
|
58
|
+
padding-left: ${d}px;
|
|
59
|
+
`)})}const Zr={};function ba(c){let r=Zr[c];if(!r){const d=new mr(1,1,c,c),u=d.clone(),t=d.attributes,e=u.attributes,o=new Mn,a=t.uv.count;for(let n=0;n<a;n++)e.position.array[n*3]*=-1,e.normal.array[n*3+2]*=-1;["position","normal","uv"].forEach(n=>{o.setAttribute(n,new Pn([...t[n].array,...e[n].array],t[n].itemSize))}),o.setIndex([...d.index.array,...u.index.array.map(n=>n+a)]),o.translate(.5,.5,0),r=Zr[c]=o}return r}const Ua="aTroikaGlyphBounds",qr="aTroikaGlyphIndex",_a="aTroikaGlyphColor";class Sa extends wn{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 kn,this.boundingBox=new xn}computeBoundingSphere(){}computeBoundingBox(){}setSide(r){const d=this.getIndex().count;this.setDrawRange(r===Fn?d/2:0,r===an?d:d/2)}set detail(r){if(r!==this._detail){this._detail=r,(typeof r!="number"||r<1)&&(r=1);let d=ba(r);["position","normal","uv"].forEach(u=>{this.attributes[u]=d.attributes[u].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,u,t,e){lr(this,Ua,r,4),lr(this,qr,d,1),lr(this,_a,e,3),this._blockBounds=u,this._chunkedBounds=t,this.instanceCount=d.length,this._updateBounds()}_updateBounds(){const r=this._blockBounds;if(r){const{curveRadius:d,boundingBox:u}=this;if(d){const{PI:t,floor:e,min:o,max:a,sin:n,cos:i}=Math,s=t/2,l=t*2,f=Math.abs(d),h=r[0]/f,y=r[2]/f,m=e((h+s)/l)!==e((y+s)/l)?-f:o(n(h)*f,n(y)*f),g=e((h-s)/l)!==e((y-s)/l)?f:a(n(h)*f,n(y)*f),C=e((h+t)/l)!==e((y+t)/l)?f*2:a(f-i(h)*f,f-i(y)*f);u.min.set(m,r[1],d<0?-C:0),u.max.set(g,r[3],d<0?0:C)}else u.min.set(r[0],r[1],0),u.max.set(r[2],r[3],0);u.getBoundingSphere(this.boundingSphere)}}applyClipRect(r){let d=this.getAttribute(qr).count,u=this._chunkedBounds;if(u)for(let t=u.length;t--;){d=u[t].end;let e=u[t].rect;if(e[1]<r.w&&e[3]>r.y&&e[0]<r.z&&e[2]>r.x)break}this.instanceCount=d}}function lr(c,r,d,u){const t=c.getAttribute(r);d?t&&t.array.length===d.length?(t.array.set(d),t.needsUpdate=!0):(c.setAttribute(r,new Cn(d,u)),delete c._maxInstanceCount,c.dispose()):t&&c.deleteAttribute(r)}const Ta=`
|
|
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
|
+
`,wa=`
|
|
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
|
+
`,ka=`
|
|
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
|
+
`,xa=`
|
|
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 Fa(c){const r=dr(c,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new It},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Nr(0,0,0,0)},uTroikaClipRect:{value:new Nr(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new It},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new pr},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Dn},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:Ta,vertexTransform:wa,fragmentDefs:ka,fragmentColorTransform:xa,customRewriter({vertexShader:d,fragmentShader:u}){let t=/\buniform\s+vec3\s+diffuse\b/;return t.test(u)&&(u=u.replace(t,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),t.test(d)||(d=d.replace(ln,`uniform vec3 diffuse;
|
|
218
|
+
$&
|
|
219
|
+
vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
|
|
220
|
+
`))),{vertexShader:d,fragmentShader:u}}});return r.transparent=!0,Object.defineProperties(r,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),r}const br=new Gn({color:16777215,side:an,transparent:!0}),$r=8421504,en=new Bn,Ot=new yr,fr=new yr,yt=[],Ca=new yr,ur="+x+y";function tn(c){return Array.isArray(c)?c[0]:c}let pn=()=>{const c=new gr(new mr(1,1),br);return pn=()=>c,c},gn=()=>{const c=new gr(new mr(1,1,32,1),br);return gn=()=>c,c};const Da={type:"syncstart"},Aa={type:"synccomplete"},mn=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],Ea=mn.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");class Ma extends gr{constructor(){const r=new Sa;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=$r,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=ur,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(Da),cn({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 u=this._queuedSyncs;u&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{u.forEach(t=>t&&t())})),this.dispatchEvent(Aa),r&&r()})))}onBeforeRender(r,d,u,t,e,o){this.sync(),e.isTroikaTextMaterial&&this._prepareForRender(e),e._hadOwnSide=e.hasOwnProperty("side"),this.geometry.setSide(e._actualSide=e.side),e.side=An}onAfterRender(r,d,u,t,e,o){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=br.clone());if((!r||r.baseMaterial!==d)&&(r=this._derivedMaterial=Fa(d),d.addEventListener("dispose",function u(){d.removeEventListener("dispose",u),r.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let u=r._outlineMtl;return u||(u=r._outlineMtl=Object.create(r,{id:{value:r.id+.1}}),u.isTextOutlineMaterial=!0,u.depthWrite=!1,u.map=null,r.addEventListener("dispose",function t(){r.removeEventListener("dispose",t),u.dispose()})),[u,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 tn(this.material).getDepthMaterial()}get customDistanceMaterial(){return tn(this.material).getDistanceMaterial()}_prepareForRender(r){const d=r.isTextOutlineMaterial,u=r.uniforms,t=this.textRenderInfo;if(t){const{sdfTexture:a,blockBounds:n}=t;u.uTroikaSDFTexture.value=a,u.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),u.uTroikaSDFGlyphSize.value=t.sdfGlyphSize,u.uTroikaSDFExponent.value=t.sdfExponent,u.uTroikaTotalBounds.value.fromArray(n),u.uTroikaUseGlyphColors.value=!d&&!!t.glyphColors;let i=0,s=0,l=0,f,h,y,m=0,g=0;if(d){let{outlineWidth:v,outlineOffsetX:_,outlineOffsetY:x,outlineBlur:U,outlineOpacity:T}=this;i=this._parsePercent(v)||0,s=Math.max(0,this._parsePercent(U)||0),f=T,m=this._parsePercent(_)||0,g=this._parsePercent(x)||0}else l=Math.max(0,this._parsePercent(this.strokeWidth)||0),l&&(y=this.strokeColor,u.uTroikaStrokeColor.value.set(y??$r),h=this.strokeOpacity,h==null&&(h=1)),f=this.fillOpacity;u.uTroikaDistanceOffset.value=i,u.uTroikaPositionOffset.value.set(m,g),u.uTroikaBlurRadius.value=s,u.uTroikaStrokeWidth.value=l,u.uTroikaStrokeOpacity.value=h,u.uTroikaFillOpacity.value=f??1,u.uTroikaCurveRadius.value=this.curveRadius||0;let C=this.clipRect;if(C&&Array.isArray(C)&&C.length===4)u.uTroikaClipRect.value.fromArray(C);else{const v=(this.fontSize||.1)*100;u.uTroikaClipRect.value.set(n[0]-v,n[1]-v,n[2]+v,n[3]+v)}this.geometry.applyClipRect(u.uTroikaClipRect.value)}u.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 a=r.hasOwnProperty("color")?r.color:r.color=new pr;(e!==a._input||typeof e=="object")&&a.set(a._input=e)}let o=this.orientation||ur;if(o!==r._orientation){let a=u.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let n=o!==ur&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(n){let[,i,s,l,f]=n;Ot.set(0,0,0)[s]=i==="-"?1:-1,fr.set(0,0,0)[f]=l==="-"?-1:1,en.lookAt(Ca,Ot.cross(fr),fr),a.setFromMatrix4(en)}else a.identity();r._orientation=o}}_parsePercent(r){if(typeof r=="string"){let d=r.match(/^(-?[\d.]+)%$/),u=d?parseFloat(d[1]):NaN;r=(isNaN(u)?0:u/100)*this.fontSize}return r}localPositionToTextCoords(r,d=new It){d.copy(r);const u=this.curveRadius;return u&&(d.x=Math.atan2(r.x,Math.abs(u)-Math.abs(r.z))*Math.abs(u)),d}worldPositionToTextCoords(r,d=new It){return Ot.copy(r),this.localPositionToTextCoords(this.worldToLocal(Ot),d)}raycast(r,d){const{textRenderInfo:u,curveRadius:t}=this;if(u){const e=u.blockBounds,o=t?gn():pn(),a=o.geometry,{position:n,uv:i}=a.attributes;for(let s=0;s<i.count;s++){let l=e[0]+i.getX(s)*(e[2]-e[0]);const f=e[1]+i.getY(s)*(e[3]-e[1]);let h=0;t&&(h=t-Math.cos(l/t)*t,l=Math.sin(l/t)*t),n.setXYZ(s,l,f,h)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,yt.length=0,o.raycast(r,yt);for(let s=0;s<yt.length;s++)yt[s].object=this,d.push(yt[s])}}copy(r){const d=this.geometry;return super.copy(r),this.geometry=d,Ea.forEach(u=>{this[u]=r[u]}),this}clone(){return new this.constructor().copy(this)}}mn.forEach(c=>{const r="_private_"+c;Object.defineProperty(Ma.prototype,c,{get(){return this[r]},set(d){d!==this[r]&&(this[r]=d,this._needsSync=!0)}})});function Na(c,r,d){let u=null;const{caretHeight:t}=c,e=Pa(c);let o=1/0;return e.forEach((a,n)=>{Math.abs(d-(n+t/2))<Math.abs(d-(o+t/2))&&(o=n)}),e.get(o).forEach(a=>{(!u||Math.abs(r-a.x)<Math.abs(r-u.x))&&(u=a)}),u}const rn=new WeakMap;function za(c,r,d){let u;if(c){let t=rn.get(c);if(t&&t.start===r&&t.end===d)return t.rects;const{caretPositions:e,caretHeight:o}=c;if(d<r){const n=r;r=d,d=n}r=Math.max(r,0),d=Math.min(d,e.length+1),u=[];let a=null;for(let n=r;n<d;n++){const i=e[n*3],s=e[n*3+1],l=Math.min(i,s),f=Math.max(i,s),h=e[n*3+2];(!a||h!==a.bottom||l>a.right||f<a.left)&&(a={left:1/0,right:-1/0,bottom:h,top:h+o},u.push(a)),a.left=Math.min(l,a.left),a.right=Math.max(f,a.right)}u.sort((n,i)=>i.bottom-n.bottom||n.left-i.left);for(let n=u.length-1;n-- >0;){const i=u[n],s=u[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),u.splice(n,1))}rn.set(c,{start:r,end:d,rects:u})}return u}const nn=new WeakMap;function Pa(c){let r=nn.get(c);if(!r){const{caretPositions:d,caretHeight:u}=c;r=new Map;for(let t=0;t<d.length;t+=3){const e=d[t+2];let o=r.get(e);o||r.set(e,o=[]),o.push({x:d[t],y:e,height:u,charIndex:t/3}),t+3>=d.length&&o.push({x:d[t+1],y:e,height:u,charIndex:t/3+1})}}return nn.set(c,r),r}export{Sa as GlyphsGeometry,Ma as Text,La as configureTextBuilder,Fa as createTextDerivedMaterial,Wa as dumpSDFTextures,Na as getCaretAtPoint,za as getSelectionRects,Ia as preloadFont,ma as typesetterWorkerModule};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function ee(l,S){for(var v=0;v<S.length;v++){const _=S[v];if(typeof _!="string"&&!Array.isArray(_)){for(const m in _)if(m!=="default"&&!(m in l)){const h=Object.getOwnPropertyDescriptor(_,m);h&&Object.defineProperty(l,m,h.get?h:{enumerable:!0,get:()=>_[m]})}}}return Object.freeze(Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}))}function te(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Y={exports:{}},x={},G={exports:{}},r={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var H;function re(){if(H)return r;H=1;var l=Symbol.for("react.element"),S=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),O=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),w=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),R=Symbol.iterator;function b(e){return e===null||typeof e!="object"?null:(e=R&&e[R]||e["@@iterator"],typeof e=="function"?e:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,N={};function j(e,t,n){this.props=e,this.context=t,this.refs=N,this.updater=n||k}j.prototype.isReactComponent={},j.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},j.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function U(){}U.prototype=j.prototype;function P(e,t,n){this.props=e,this.context=t,this.refs=N,this.updater=n||k}var I=P.prototype=new U;I.constructor=P,L(I,j.prototype),I.isPureReactComponent=!0;var V=Array.isArray,M=Object.prototype.hasOwnProperty,D={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function B(e,t,n){var u,o={},c=null,f=null;if(t!=null)for(u in t.ref!==void 0&&(f=t.ref),t.key!==void 0&&(c=""+t.key),t)M.call(t,u)&&!z.hasOwnProperty(u)&&(o[u]=t[u]);var s=arguments.length-2;if(s===1)o.children=n;else if(1<s){for(var i=Array(s),d=0;d<s;d++)i[d]=arguments[d+2];o.children=i}if(e&&e.defaultProps)for(u in s=e.defaultProps,s)o[u]===void 0&&(o[u]=s[u]);return{$$typeof:l,type:e,key:c,ref:f,props:o,_owner:D.current}}function K(e,t){return{$$typeof:l,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function F(e){return typeof e=="object"&&e!==null&&e.$$typeof===l}function Q(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var J=/\/+/g;function T(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Q(""+e.key):t.toString(36)}function $(e,t,n,u,o){var c=typeof e;(c==="undefined"||c==="boolean")&&(e=null);var f=!1;if(e===null)f=!0;else switch(c){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){case l:case S:f=!0}}if(f)return f=e,o=o(f),e=u===""?"."+T(f,0):u,V(o)?(n="",e!=null&&(n=e.replace(J,"$&/")+"/"),$(o,t,n,"",function(d){return d})):o!=null&&(F(o)&&(o=K(o,n+(!o.key||f&&f.key===o.key?"":(""+o.key).replace(J,"$&/")+"/")+e)),t.push(o)),1;if(f=0,u=u===""?".":u+":",V(e))for(var s=0;s<e.length;s++){c=e[s];var i=u+T(c,s);f+=$(c,t,n,i,o)}else if(i=b(e),typeof i=="function")for(e=i.call(e),s=0;!(c=e.next()).done;)c=c.value,i=u+T(c,s++),f+=$(c,t,n,i,o);else if(c==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return f}function g(e,t,n){if(e==null)return e;var u=[],o=0;return $(e,u,"","",function(c){return t.call(n,c,o++)}),u}function X(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var a={current:null},C={transition:null},Z={ReactCurrentDispatcher:a,ReactCurrentBatchConfig:C,ReactCurrentOwner:D};return r.Children={map:g,forEach:function(e,t,n){g(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return g(e,function(){t++}),t},toArray:function(e){return g(e,function(t){return t})||[]},only:function(e){if(!F(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},r.Component=j,r.Fragment=v,r.Profiler=m,r.PureComponent=P,r.StrictMode=_,r.Suspense=p,r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z,r.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var u=L({},e.props),o=e.key,c=e.ref,f=e._owner;if(t!=null){if(t.ref!==void 0&&(c=t.ref,f=D.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(i in t)M.call(t,i)&&!z.hasOwnProperty(i)&&(u[i]=t[i]===void 0&&s!==void 0?s[i]:t[i])}var i=arguments.length-2;if(i===1)u.children=n;else if(1<i){s=Array(i);for(var d=0;d<i;d++)s[d]=arguments[d+2];u.children=s}return{$$typeof:l,type:e.type,key:o,ref:c,props:u,_owner:f}},r.createContext=function(e){return e={$$typeof:O,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:h,_context:e},e.Consumer=e},r.createElement=B,r.createFactory=function(e){var t=B.bind(null,e);return t.type=e,t},r.createRef=function(){return{current:null}},r.forwardRef=function(e){return{$$typeof:E,render:e}},r.isValidElement=F,r.lazy=function(e){return{$$typeof:y,_payload:{_status:-1,_result:e},_init:X}},r.memo=function(e,t){return{$$typeof:w,type:e,compare:t===void 0?null:t}},r.startTransition=function(e){var t=C.transition;C.transition={};try{e()}finally{C.transition=t}},r.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},r.useCallback=function(e,t){return a.current.useCallback(e,t)},r.useContext=function(e){return a.current.useContext(e)},r.useDebugValue=function(){},r.useDeferredValue=function(e){return a.current.useDeferredValue(e)},r.useEffect=function(e,t){return a.current.useEffect(e,t)},r.useId=function(){return a.current.useId()},r.useImperativeHandle=function(e,t,n){return a.current.useImperativeHandle(e,t,n)},r.useInsertionEffect=function(e,t){return a.current.useInsertionEffect(e,t)},r.useLayoutEffect=function(e,t){return a.current.useLayoutEffect(e,t)},r.useMemo=function(e,t){return a.current.useMemo(e,t)},r.useReducer=function(e,t,n){return a.current.useReducer(e,t,n)},r.useRef=function(e){return a.current.useRef(e)},r.useState=function(e){return a.current.useState(e)},r.useSyncExternalStore=function(e,t,n){return a.current.useSyncExternalStore(e,t,n)},r.useTransition=function(){return a.current.useTransition()},r.version="18.2.0",r}G.exports=re();var q=G.exports;const ne=te(q),ue=ee({__proto__:null,default:ne},[q]);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var W;function oe(){if(W)return x;W=1;var l=q,S=Symbol.for("react.element"),v=Symbol.for("react.fragment"),_=Object.prototype.hasOwnProperty,m=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function O(E,p,w){var y,R={},b=null,k=null;w!==void 0&&(b=""+w),p.key!==void 0&&(b=""+p.key),p.ref!==void 0&&(k=p.ref);for(y in p)_.call(p,y)&&!h.hasOwnProperty(y)&&(R[y]=p[y]);if(E&&E.defaultProps)for(y in p=E.defaultProps,p)R[y]===void 0&&(R[y]=p[y]);return{$$typeof:S,type:E,key:b,ref:k,props:R,_owner:m.current}}return x.Fragment=v,x.jsx=O,x.jsxs=O,x}Y.exports=oe();var A=Y.exports;const ie=A.Fragment,ce=A.jsx,se=A.jsxs;export{ue as $,ie as F,ne as R,se as a,te as g,ce as j,q as r};
|