@rive-app/canvas 2.41.1 → 2.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rive.d.ts +102 -0
- package/rive.js +580 -196
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +87 -5
- package/rive_fallback.wasm +0 -0
- package/utils/finalizationRegistry.d.ts +7 -3
package/rive.js
CHANGED
|
@@ -349,145 +349,147 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
349
349
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
350
350
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
351
351
|
/* harmony export */ });
|
|
352
|
-
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var k=moduleArg,
|
|
353
|
-
function da(){function a(g){const h=d;c=b=0;d=new Map;h.forEach(
|
|
354
|
-
"fixed",f.style.right=0,f.style.top=0,f.style.color="white",f.style.padding="4px",f.innerHTML="RIVE FPS",g=function(h){f.innerHTML="RIVE FPS "+h.toFixed(1)},document.body.appendChild(f));e=new function(){let h=0,
|
|
355
|
-
function ea(a){console.assert(!0);const b=new Map;let c=-Infinity;this.push=function(d){d=d+((1<<a)-1)>>a;b.has(d)&&clearTimeout(b.get(d));b.set(d,setTimeout(function(){b.delete(d);0==b.length?c=-Infinity:d==c&&(c=Math.max(...b.keys()),console.assert(c<d))},1E3));c=Math.max(d,c);return c<<a}}const
|
|
356
|
-
k.onRuntimeInitialized=function(){
|
|
357
|
-
g.isAudio?k.ptrToAudioAsset(
|
|
358
|
-
l.onreadystatechange=function(){4==
|
|
359
|
-
|
|
360
|
-
const ia="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),ja=new function(){function a(){if(!b){var
|
|
361
|
-
renderViaOffscreenBackBuffer:1};let p;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(p=
|
|
362
|
-
"function"===typeof J[
|
|
363
|
-
p.attachShader(J,
|
|
364
|
-
p.bindAttribLocation(
|
|
365
|
-
null,c=0,d=0,e=null,f=null,g=0,h=0,
|
|
366
|
-
b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR),b.generateMipmap(b.TEXTURE_2D)):b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);return
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
O+=2*
|
|
370
|
-
k.onRuntimeInitialized=function(){function a(
|
|
371
|
-
case
|
|
372
|
-
let
|
|
373
|
-
q.kc}});class p{constructor(){this.cb=this.Kb=0;this.Za=new Path2D}clear(){this.cb=this.Kb=0;this.Za=new Path2D}
|
|
374
|
-
q,B,
|
|
375
|
-
0)},Mb:function(){null!==this.pb&&(this.pb.pc=!1,this.pb=null)},ob:function(
|
|
376
|
-
thickness:function(
|
|
377
|
-
{this.kb=null})},linearGradient:function(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
1]*=
|
|
382
|
-
q,B,
|
|
383
|
-
Ca<
|
|
384
|
-
ua.resetTransform();ua.globalCompositeOperation=Vc;ua.globalAlpha=Wc;const hb=ja.canvas();hb&&ua.drawImage(hb,Tb,Ub,
|
|
385
|
-
function(
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
a
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
function
|
|
413
|
-
|
|
414
|
-
function
|
|
415
|
-
function
|
|
416
|
-
function
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
var
|
|
424
|
-
|
|
425
|
-
var
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
var
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
b.
|
|
432
|
-
function
|
|
433
|
-
|
|
434
|
-
function
|
|
352
|
+
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var k=moduleArg,aa=!!globalThis.window,ca=!!globalThis.WorkerGlobalScope;
|
|
353
|
+
function da(){function a(g){const h=d;c=b=0;d=new Map;h.forEach(l=>{try{l(g)}catch(n){console.error(n)}});this.Bc();e&&e.fd()}let b=0,c=0,d=new Map,e=null,f=null;this.requestAnimationFrame=function(g){b||=requestAnimationFrame(a.bind(this));const h=++c;d.set(h,g);return h};this.cancelAnimationFrame=function(g){d.delete(g);b&&0==d.size&&(cancelAnimationFrame(b),b=0)};this.dd=function(g){f&&(document.body.remove(f),f=null);g||(f=document.createElement("div"),f.style.backgroundColor="black",f.style.position=
|
|
354
|
+
"fixed",f.style.right=0,f.style.top=0,f.style.color="white",f.style.padding="4px",f.innerHTML="RIVE FPS",g=function(h){f.innerHTML="RIVE FPS "+h.toFixed(1)},document.body.appendChild(f));e=new function(){let h=0,l=0;this.fd=function(){var n=performance.now();l?(++h,n-=l,1E3<n&&(g(1E3*h/n),h=l=0)):(l=n,h=0)}}};this.ad=function(){f&&(document.body.remove(f),f=null);e=null};this.Bc=function(){}}
|
|
355
|
+
function ea(a){console.assert(!0);const b=new Map;let c=-Infinity;this.push=function(d){d=d+((1<<a)-1)>>a;b.has(d)&&clearTimeout(b.get(d));b.set(d,setTimeout(function(){b.delete(d);0==b.length?c=-Infinity:d==c&&(c=Math.max(...b.keys()),console.assert(c<d))},1E3));c=Math.max(d,c);return c<<a}}const fa=k.onRuntimeInitialized;
|
|
356
|
+
k.onRuntimeInitialized=function(){fa&&fa();let a=k.decodeAudio;k.decodeAudio=function(g,h,l=null){g=a(g,l??null);h(g)};let b=k.decodeFont;k.decodeFont=function(g,h,l=null){g=b(g,l??null);h(g)};const c=k.FileAsset.prototype.decode;k.FileAsset.prototype.decode=function(g,h){return c.call(this,g,h??null)};let d=k.setFallbackFontCb;k.setFallbackFontCallback="function"===typeof d?function(g){d(g)}:function(){console.warn("Module.setFallbackFontCallback called, but text support is not enabled in this build.")};
|
|
357
|
+
const e=k.FileAssetLoader;k.ptrToAsset=g=>{let h=k.ptrToFileAsset(g);return h.isImage?k.ptrToImageAsset(g):h.isFont?k.ptrToFontAsset(g):h.isAudio?k.ptrToAudioAsset(g):h};k.CustomFileAssetLoader=e.extend("CustomFileAssetLoader",{__construct:function({loadContents:g}){this.__parent.__construct.call(this);this.Tc=g},loadContents:function(g,h){g=k.ptrToAsset(g);return this.Tc(g,h)}});k.CDNFileAssetLoader=e.extend("CDNFileAssetLoader",{__construct:function(g){this.__parent.__construct.call(this);this.Vc=
|
|
358
|
+
g??null},loadContents:function(g){let h=k.ptrToAsset(g);g=h.cdnUuid;if(""===g)return!1;const l=this.Vc??null;(function(n,t){var u=new XMLHttpRequest;u.responseType="arraybuffer";u.onreadystatechange=function(){4==u.readyState&&200==u.status&&t(u)};u.open("GET",n,!0);u.send(null)})(h.cdnBaseUrl+"/"+g,n=>{h.decode(new Uint8Array(n.response),l)});return!0}});k.FallbackFileAssetLoader=e.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this);this.wc=[]},addLoader:function(g){this.wc.push(g)},
|
|
359
|
+
loadContents:function(g,h){for(let l of this.wc)if(l.loadContents(g,h))return!0;return!1}});let f=k.computeAlignment;k.computeAlignment=function(g,h,l,n,t=1){return f.call(this,g,h,l,n,t)}};
|
|
360
|
+
const ia="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),ja=new function(){function a(){if(!b){var x=document.createElement("canvas"),y={alpha:1,depth:0,stencil:0,antialias:0,premultipliedAlpha:1,preserveDrawingBuffer:0,powerPreference:"high-performance",failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:1,explicitSwapControl:1,
|
|
361
|
+
renderViaOffscreenBackBuffer:1};let p;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(p=x.getContext("webgl",y),c=1,!p)return console.log("No WebGL support. Image mesh will not be drawn."),!1}else if(p=x.getContext("webgl2",y))c=2;else if(p=x.getContext("webgl",y))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;p=new Proxy(p,{get(J,v){if(J.isContextLost()){if(l||(console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ",v),l=!0),
|
|
362
|
+
"function"===typeof J[v])return function(){}}else return"function"===typeof J[v]?function(...N){return J[v].apply(J,N)}:J[v]},set(J,v,N){if(J.isContextLost())l||(console.error("Cannot render the mesh because the GL Context was lost. Tried to set property "+v),l=!0);else return J[v]=N,!0}});d=Math.min(p.getParameter(p.MAX_RENDERBUFFER_SIZE),p.getParameter(p.MAX_TEXTURE_SIZE));function H(J,v,N){v=p.createShader(v);p.shaderSource(v,N);p.compileShader(v);N=p.getShaderInfoLog(v);if(0<(N||"").length)throw N;
|
|
363
|
+
p.attachShader(J,v)}x=p.createProgram();H(x,p.VERTEX_SHADER,"attribute vec2 vertex;\n attribute vec2 uv;\n uniform vec4 mat;\n uniform vec2 translate;\n varying vec2 st;\n void main() {\n st = uv;\n gl_Position = vec4(mat2(mat) * vertex + translate, 0, 1);\n }");H(x,p.FRAGMENT_SHADER,"precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }");
|
|
364
|
+
p.bindAttribLocation(x,0,"vertex");p.bindAttribLocation(x,1,"uv");p.linkProgram(x);y=p.getProgramInfoLog(x);if(0<(y||"").trim().length)throw y;e=p.getUniformLocation(x,"mat");f=p.getUniformLocation(x,"translate");p.useProgram(x);p.bindBuffer(p.ARRAY_BUFFER,p.createBuffer());p.enableVertexAttribArray(0);p.enableVertexAttribArray(1);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,p.createBuffer());p.uniform1i(p.getUniformLocation(x,"image"),0);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);b=p}return!0}let b=
|
|
365
|
+
null,c=0,d=0,e=null,f=null,g=0,h=0,l=!1;a();this.td=function(){a();return d};this.$c=function(x){b&&b.deleteTexture&&b.deleteTexture(x)};this.Zc=function(x){if(!a())return null;const y=b.createTexture();if(!y)return null;b.bindTexture(b.TEXTURE_2D,y);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,x);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);2==
|
|
366
|
+
c?(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR),b.generateMipmap(b.TEXTURE_2D)):b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);return y};const n=new ea(8),t=new ea(8),u=new ea(10),r=new ea(10);this.cd=function(x,y,p,H,J){if(a()){var v=n.push(x),N=t.push(y);if(b.canvas){if(b.canvas.width!=v||b.canvas.height!=N)b.canvas.width=v,b.canvas.height=N;b.viewport(0,N-y,x,y);b.disable(b.SCISSOR_TEST);b.clearColor(0,0,0,0);b.clear(b.COLOR_BUFFER_BIT);b.enable(b.SCISSOR_TEST);
|
|
367
|
+
p.sort((G,ha)=>ha.Ic-G.Ic);v=u.push(H);g!=v&&(b.bufferData(b.ARRAY_BUFFER,8*v,b.DYNAMIC_DRAW),g=v);v=0;for(var O of p)b.bufferSubData(b.ARRAY_BUFFER,v,O.ec),v+=4*O.ec.length;console.assert(v==4*H);for(var V of p)b.bufferSubData(b.ARRAY_BUFFER,v,V.Mc),v+=4*V.Mc.length;console.assert(v==8*H);v=r.push(J);h!=v&&(b.bufferData(b.ELEMENT_ARRAY_BUFFER,2*v,b.DYNAMIC_DRAW),h=v);O=0;for(var ba of p)b.bufferSubData(b.ELEMENT_ARRAY_BUFFER,O,ba.indices),O+=2*ba.indices.length;console.assert(O==2*J);ba=0;V=!0;v=
|
|
368
|
+
O=0;for(const G of p){G.image.Tb!=ba&&(b.bindTexture(b.TEXTURE_2D,G.image.Rb||null),ba=G.image.Tb);G.xd?(b.scissor(G.mc,N-G.nc-G.vc,G.Gd,G.vc),V=!0):V&&(b.scissor(0,N-y,x,y),V=!1);p=2/x;const ha=-2/y;b.uniform4f(e,G.lb[0]*p*G.Gb,G.lb[1]*ha*G.Hb,G.lb[2]*p*G.Gb,G.lb[3]*ha*G.Hb);b.uniform2f(f,G.lb[4]*p*G.Gb+p*(G.mc-G.ud*G.Gb)-1,G.lb[5]*ha*G.Hb+ha*(G.nc-G.vd*G.Hb)+1);b.vertexAttribPointer(0,2,b.FLOAT,!1,0,v);b.vertexAttribPointer(1,2,b.FLOAT,!1,0,v+4*H);b.drawElements(b.TRIANGLES,G.indices.length,b.UNSIGNED_SHORT,
|
|
369
|
+
O);v+=4*G.ec.length;O+=2*G.indices.length}console.assert(v==4*H);console.assert(O==2*J)}}};this.canvas=function(){return a()&&b.canvas}},ka=k.onRuntimeInitialized;
|
|
370
|
+
k.onRuntimeInitialized=function(){function a(m){switch(m){case n.srcOver:return"source-over";case n.screen:return"screen";case n.overlay:return"overlay";case n.darken:return"darken";case n.lighten:return"lighten";case n.colorDodge:return"color-dodge";case n.colorBurn:return"color-burn";case n.hardLight:return"hard-light";case n.softLight:return"soft-light";case n.difference:return"difference";case n.exclusion:return"exclusion";case n.multiply:return"multiply";case n.hue:return"hue";case n.saturation:return"saturation";
|
|
371
|
+
case n.color:return"color";case n.luminosity:return"luminosity"}}function b(m){return"rgba("+((16711680&m)>>>16)+","+((65280&m)>>>8)+","+((255&m)>>>0)+","+((4278190080&m)>>>24)/255+")"}function c(){0<V.length&&(ja.cd(O.drawWidth(),O.drawHeight(),V,ba,G),V=[],G=ba=0,O.reset(512,512));for(const m of v){for(const q of m.Oa)q();m.Oa=[]}v.clear()}ka&&ka();var d=k.RenderPaintStyle;const e=k.RenderPath,f=k.RenderPaint,g=k.Renderer,h=k.StrokeCap,l=k.StrokeJoin,n=k.BlendMode,t=d.fill,u=d.stroke,r=k.FillRule.evenOdd;
|
|
372
|
+
let x=1;var y=k.RenderImage.extend("CanvasRenderImage",{__construct:function({sb:m,Eb:q}={}){this.__parent.__construct.call(this);this.Tb=x;x=x+1&2147483647||1;this.sb=m;this.Eb=q},__destruct:function(){this.Rb&&(ja.$c(this.Rb),URL.revokeObjectURL(this.kc));this.__parent.__destruct.call(this)},decode:function(m){var q=this;q.Eb&&q.Eb(q);var B=new Image;q.kc=URL.createObjectURL(new Blob([m],{type:"image/png"}));B.onload=function(){q.Sc=B;q.Rb=ja.Zc(B);q.size(B.width,B.height);q.sb&&q.sb(q)};B.src=
|
|
373
|
+
q.kc}});class p{constructor(){this.cb=this.Kb=0;this.Za=new Path2D}clear(){this.cb=this.Kb=0;this.Za=new Path2D}Wc(m){for(0<this.Kb&&this.cb<m.length&&this.clear();this.cb<m.length;)m[this.cb++](this.Za);this.Kb++;return this.Za}release(m){m===this.Za&&this.Kb--}}var H=e.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this);this.Pb=[];this.Za=new p;this.Ob=!1;this.pb=null},rewind:function(){this.Pb.length=0;this.Za.clear();this.Ob=!1;this.pb=null},addPath:function(m,
|
|
374
|
+
q,B,z,K,C,D){const A=m.Oc();this.ob(I=>{const L=new DOMMatrix;L.a=q;L.b=B;L.c=z;L.d=K;L.e=C;L.f=D;I.addPath(A,L)})},fillRule:function(m){this.jc=m},moveTo:function(m,q){this.Ob=!0;const B={pc:!0};this.pb=B;this.ob(z=>{z.moveTo(m,q);B.pc&&z.lineTo(m,q)})},lineTo:function(m,q){this.ic();this.Mb();this.ob(B=>{B.lineTo(m,q)})},cubicTo:function(m,q,B,z,K,C){this.ic();this.Mb();this.ob(D=>{D.bezierCurveTo(m,q,B,z,K,C)})},close:function(){this.Mb();this.ob(m=>{m.closePath()})},ic:function(){this.Ob||this.moveTo(0,
|
|
375
|
+
0)},Mb:function(){null!==this.pb&&(this.pb.pc=!1,this.pb=null)},ob:function(m){this.Pb.push(m)},Lb:function(){return this.Za.Wc(this.Pb)},lc:function(m){this.Za.release(m)},Oc:function(){const m=this.Lb();this.Za.clear();return m}}),J=f.extend("CanvasRenderPaint",{__construct:function(){this.__parent.__construct.call(this);this.Ma=[];this.Nb=0;this.Qb=t;this.Ub=b(4278190080);this.Sb=1;this.xb="miter";this.wb="butt";this.fc=a(n.srcOver);this.kb=null},color:function(m){this.Ma.push(()=>{this.Ub=b(m)})},
|
|
376
|
+
thickness:function(m){this.Ma.push(()=>{this.Sb=Math.abs(m)})},join:function(m){this.Ma.push(()=>{switch(m){case l.miter:this.xb="miter";break;case l.round:this.xb="round";break;case l.bevel:this.xb="bevel"}})},cap:function(m){this.Ma.push(()=>{switch(m){case h.butt:this.wb="butt";break;case h.round:this.wb="round";break;case h.square:this.wb="square"}})},style:function(m){this.Ma.push(()=>{this.Qb=m})},blendMode:function(m){this.Ma.push(()=>{this.fc=a(m)})},clearGradient:function(){this.Ma.push(()=>
|
|
377
|
+
{this.kb=null})},linearGradient:function(m,q,B,z){this.Ma.push(()=>{this.kb={Jc:m,Kc:q,rc:B,sc:z,dc:[]}})},radialGradient:function(m,q,B,z){this.Ma.push(()=>{this.kb={Jc:m,Kc:q,rc:B,sc:z,dc:[],rd:!0}})},addStop:function(m,q){this.Ma.push(()=>{this.kb.dc.push({color:m,stop:q})})},completeGradient:function(){},Pc:function(m,q,B,z){if(this.Qb!==u||0<this.Sb){var K=this.Qb,C=this.Ub,D=this.kb,A=m.globalCompositeOperation,I=m.globalAlpha;m.globalCompositeOperation=this.fc;m.globalAlpha=z;if(null!=D){C=
|
|
378
|
+
D.Jc;const R=D.Kc,U=D.rc;var L=D.sc;z=D.dc;D.rd?(D=U-C,L-=R,C=m.createRadialGradient(C,R,0,C,R,Math.sqrt(D*D+L*L))):C=m.createLinearGradient(C,R,U,L);for(let W=0,Pa=z.length;W<Pa;W++)D=z[W],C.addColorStop(D.stop,b(D.color));this.Ub=C;this.kb=null}switch(K){case u:m.strokeStyle=C;m.lineWidth=this.Sb;m.lineCap=this.wb;m.lineJoin=this.xb;m.stroke(q);break;case t:m.fillStyle=C,m.fill(q,B)}m.globalCompositeOperation=A;m.globalAlpha=I}},Rc:function(){return this.Nb+this.Ma.length},Qc:function(m){const q=
|
|
379
|
+
m-this.Nb;for(let B=0;B<q;B++)this.Ma[B]();this.Ma.splice(0,q);this.Nb=m}});const v=new Set,N=Object.prototype.hasOwnProperty;let O=null,V=[],ba=0,G=0;var ha=k.CanvasRenderer=g.extend("Renderer",{__construct:function(m){this.__parent.__construct.call(this);this.Ya=[1,0,0,1,0,0];this.Ka=[1];this.Ia=m.getContext("2d");this.hc=m;this.Oa=[]},save:function(){this.Ya.push(...this.Ya.slice(this.Ya.length-6));this.Ka.push(this.Ka[this.Ka.length-1]);this.Oa.push(this.Ia.save.bind(this.Ia))},restore:function(){const m=
|
|
380
|
+
this.Ya.length-6;if(6>m)throw"restore() called without matching save().";this.Ya.splice(m);this.Ka.pop();this.Oa.push(this.Ia.restore.bind(this.Ia))},transform:function(m,q,B,z,K,C){const D=this.Ya,A=D.length-6;D.splice(A,6,D[A]*m+D[A+2]*q,D[A+1]*m+D[A+3]*q,D[A]*B+D[A+2]*z,D[A+1]*B+D[A+3]*z,D[A]*K+D[A+2]*C+D[A+4],D[A+1]*K+D[A+3]*C+D[A+5]);this.Oa.push(this.Ia.transform.bind(this.Ia,m,q,B,z,K,C))},rotate:function(m){const q=Math.sin(m);m=Math.cos(m);this.transform(m,q,-q,m,0,0)},modulateOpacity:function(m){this.Ka[this.Ka.length-
|
|
381
|
+
1]*=m},_drawPath:function(m,q){const B=m.jc===r?"evenodd":"nonzero",z=Math.max(0,this.Ka[this.Ka.length-1]),K=m.Lb(),C=q.Rc();this.Oa.push(()=>{q.Qc(C);q.Pc(this.Ia,K,B,z);m.lc(K)})},_drawRiveImage:function(m,q,B){var z=m.Sc;if(z){var K=this.Ia,C=a(q),D=Math.max(0,B*this.Ka[this.Ka.length-1]);this.Oa.push(function(){K.globalCompositeOperation=C;K.globalAlpha=D;K.drawImage(z,0,0);K.globalAlpha=1})}},_getMatrix:function(m){const q=this.Ya,B=q.length-6;for(let z=0;6>z;++z)m[z]=q[B+z]},_drawImageMesh:function(m,
|
|
382
|
+
q,B,z,K,C,D,A,I,L,R,U,W){let Pa,Rb,Sb;try{Pa=k.HEAPF32.slice(z>>2,(z>>2)+K),Rb=k.HEAPF32.slice(C>>2,(C>>2)+D),Sb=k.HEAPU16.slice(A>>1,(A>>1)+I)}catch(hb){console.error("[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.");return}z=this.Ia.canvas.width;C=this.Ia.canvas.height;D=U-L;A=W-R;L=Math.max(L,0);R=Math.max(R,0);U=Math.min(U,z);W=Math.min(W,C);const Ca=U-L,Da=W-R;console.assert(Ca<=Math.min(D,z));console.assert(Da<=Math.min(A,C));if(!(0>=Ca||0>=Da)){U=
|
|
383
|
+
Ca<D||Da<A;z=W=1;var oa=Math.ceil(Ca*W),pa=Math.ceil(Da*z);C=ja.td();oa>C&&(W*=C/oa,oa=C);pa>C&&(z*=C/pa,pa=C);O||(O=new k.DynamicRectanizer(C),O.reset(512,512));C=O.addRect(oa,pa);0>C&&(c(),v.add(this),C=O.addRect(oa,pa),console.assert(0<=C));var Tb=C&65535,Ub=C>>16;V.push({lb:this.Ya.slice(this.Ya.length-6),image:m,mc:Tb,nc:Ub,ud:L,vd:R,Gd:oa,vc:pa,Gb:W,Hb:z,ec:Pa,Mc:Rb,indices:Sb,xd:U,Ic:m.Tb<<1|(U?1:0)});ba+=K;G+=I;var ua=this.Ia,Vc=a(q),Wc=Math.max(0,B*this.Ka[this.Ka.length-1]);this.Oa.push(function(){ua.save();
|
|
384
|
+
ua.resetTransform();ua.globalCompositeOperation=Vc;ua.globalAlpha=Wc;const hb=ja.canvas();hb&&ua.drawImage(hb,Tb,Ub,oa,pa,L,R,Ca,Da);ua.restore()})}},_clipPath:function(m){const q=m.jc===r?"evenodd":"nonzero",B=m.Lb();this.Oa.push(()=>{this.Ia.clip(B,q);m.lc(B)})},beginFrame:function(m=!0){v.add(this);m&&this.Oa.push(this.Ia.clearRect.bind(this.Ia,0,0,this.hc.width,this.hc.height))},clear:function(){this.beginFrame(!0)},flush:function(){},translate:function(m,q){this.transform(1,0,0,1,m,q)}});k.makeRenderer=
|
|
385
|
+
function(m){const q=new ha(m),B=q.Ia;let z=null,K=null;const C={attachSession:function(A){if(A&&z===A)return!0;if(!A||z||"function"!==typeof k.c2dDeferredClaim||"function"!==typeof k.c2dDeferredRenderer||!k.c2dDeferredClaim(A))return!1;const I=k.c2dDeferredRenderer(A);if(!I)return!1;z=A;K=I;return!0},detachSession:function(){z&&k.c2dDeferredDetach(z);K=z=null},deferredActive:function(){return null!==K}},D={save:function(){k.c2dDeferredSave(z)},restore:function(){k.c2dDeferredRestore(z)},transform:function(A,
|
|
386
|
+
I,L,R,U,W){k.c2dDeferredTransform(z,A,I,L,R,U,W)},translate:function(A,I){k.c2dDeferredTransform(z,1,0,0,1,A,I)},rotate:function(A){const I=Math.sin(A);A=Math.cos(A);k.c2dDeferredTransform(z,A,I,-I,A,0,0)},align:function(A,I,L,R,U){k.c2dDeferredAlign(z,A,I,L.minX,L.minY,L.maxX,L.maxY,R.minX,R.minY,R.maxX,R.maxY,void 0===U?1:U)},beginFrame:function(A=!0){q.beginFrame(A);k.c2dDeferredBeginFrame(z)},clear:function(){q.beginFrame(!0);k.c2dDeferredBeginFrame(z)},flush:function(){k.c2dDeferredReplay(z,
|
|
387
|
+
q)}};return new Proxy(q,{get(A,I){if(N.call(C,I))return C[I];if("_deferredRecorder"===I)return K;if(null!==K&&N.call(D,I))return D[I];if("function"===typeof A[I])return function(...L){return A[I].apply(A,L)};if("function"===typeof B[I]){if(-1<ia.indexOf(I))throw Error("RiveException: Method call to '"+I+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...L){q.Oa.push(B[I].bind(B,...L))}}return A[I]},
|
|
388
|
+
set(A,I,L){if(I in B)return q.Oa.push(()=>{B[I]=L}),!0}})};k.decodeImage=function(m,q){(new y({sb:q})).decode(m)};k.renderFactory={makeRenderPaint:function(){return new J},makeRenderPath:function(){return new H},makeRenderImage:function(){let m=ib;return new y({Eb:()=>{m.total++},sb:()=>{m.loaded++;if(m.loaded===m.total){const q=m.ready;q&&(q(),m.ready=null)}}})}};let Xc=k.load,ib=null;k.load=function(m,q,B=!0,z=null){const K=new k.FallbackFileAssetLoader;void 0!==q&&K.addLoader(q);B&&(q=new k.CDNFileAssetLoader(z),
|
|
389
|
+
K.addLoader(q));return new Promise(function(C){let D=null;ib={total:0,loaded:0,ready:function(){C(D)}};D=Xc(m,K,z??null);0==ib.total&&C(D)})};const Yc=k.Artboard.prototype.draw;k.Artboard.prototype.draw=function(m){Yc.call(this,m._deferredRecorder||m)};let Zc=k.RendererWrapper.prototype.align;k.RendererWrapper.prototype.align=function(m,q,B,z,K=1){Zc.call(this,m,q,B,z,K)};d=new da;k.requestAnimationFrame=d.requestAnimationFrame.bind(d);k.cancelAnimationFrame=d.cancelAnimationFrame.bind(d);k.enableFPSCounter=
|
|
390
|
+
d.dd.bind(d);k.disableFPSCounter=d.ad;d.Bc=c;k.resolveAnimationFrame=c;k.cleanup=function(){O&&O.delete()}};var la="./this.program";ca&&(_scriptName=self.location.href);var ma="",na,qa;
|
|
391
|
+
if(aa||ca){try{ma=(new URL(".",_scriptName)).href}catch{}ca&&(qa=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});na=async a=>{if(ra(a))return new Promise((c,d)=>{var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?c(e.response):d(e.status)};e.onerror=d;e.send(null)});var b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+
|
|
392
|
+
" : "+b.url);}}var sa=console.log.bind(console),ta=console.error.bind(console),va,wa=!1,xa,ra=a=>a.startsWith("file://"),ya,za,w,E,Aa,Ba,F,M,Ea,Fa,Ga,Ha,Ia=!1;function Ja(){var a=Ka.buffer;k.HEAP8=w=new Int8Array(a);Aa=new Int16Array(a);k.HEAPU8=E=new Uint8Array(a);k.HEAPU16=Ba=new Uint16Array(a);k.HEAP32=F=new Int32Array(a);k.HEAPU32=M=new Uint32Array(a);k.HEAPF32=Ea=new Float32Array(a);Fa=new Float64Array(a);Ga=new BigInt64Array(a);Ha=new BigUint64Array(a)}
|
|
393
|
+
function La(a){k.onAbort?.(a);a="Aborted("+a+")";ta(a);wa=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");za?.(a);throw a;}var Ma;async function Na(a){if(!va)try{var b=await na(a);return new Uint8Array(b)}catch{}if(a==Ma&&va)a=new Uint8Array(va);else if(qa)a=qa(a);else throw"both async and sync fetching of the wasm failed";return a}
|
|
394
|
+
async function Oa(a,b){try{var c=await Na(a);return await WebAssembly.instantiate(c,b)}catch(d){ta(`failed to asynchronously prepare wasm: ${d}`),La(d)}}async function Qa(a){var b=Ma;if(!va&&!ra(b))try{var c=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,a)}catch(d){ta(`wasm streaming compile failed: ${d}`),ta("falling back to ArrayBuffer instantiation")}return Oa(b,a)}
|
|
395
|
+
class Ra{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}
|
|
396
|
+
var Sa=a=>{for(;0<a.length;)a.shift()(k)},Ta=[],Ua=[],Va=()=>{var a=k.preRun.shift();Ua.push(a)},Wa=!0,Ya=()=>{var a=F[+Xa>>2];Xa+=4;return a},Za=(a,b)=>{for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},$a=a=>{var b="/"===a.charAt(0),c="/"===a.slice(-1);(a=Za(a.split("/").filter(d=>!!d),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},ab=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);
|
|
397
|
+
a=b[0];b=b[1];if(!a&&!b)return".";b&&=b.slice(0,-1);return a+b},bb=()=>a=>crypto.getRandomValues(a),cb=a=>{(cb=bb())(a)},db=(...a)=>{for(var b="",c=!1,d=a.length-1;-1<=d&&!c;d--){c=0<=d?a[d]:"/";if("string"!=typeof c)throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";b=c+"/"+b;c="/"===c.charAt(0)}b=Za(b.split("/").filter(e=>!!e),!c).join("/");return(c?"/":"")+b||"."},eb=globalThis.TextDecoder&&new TextDecoder,fb=(a,b,c,d)=>{c=b+c;if(d)return c;for(;a[b]&&!(b>=c);)++b;
|
|
398
|
+
return b},gb=(a,b=0,c,d)=>{c=fb(a,b,c,d);if(16<c-b&&a.buffer&&eb)return eb.decode(a.subarray(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var f=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|f);else{var g=a[b++]&63;e=224==(e&240)?(e&15)<<12|f<<6|g:(e&7)<<18|f<<12|g<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d},jb=[],kb=a=>{for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);127>=d?b++:
|
|
399
|
+
2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b},lb=(a,b,c,d)=>{if(!(0<d))return 0;var e=c;d=c+d-1;for(var f=0;f<a.length;++f){var g=a.codePointAt(f);if(127>=g){if(c>=d)break;b[c++]=g}else if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6;b[c++]=128|g&63}else if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12;b[c++]=128|g>>6&63;b[c++]=128|g&63}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63;b[c++]=128|g>>6&63;b[c++]=128|g&63;f++}}b[c]=0;return c-e},mb=[];
|
|
400
|
+
function nb(a,b){mb[a]={input:[],output:[],bb:b};ob(a,pb)}
|
|
401
|
+
var pb={open(a){var b=mb[a.node.Fb];if(!b)throw new P(43);a.Ca=b;a.seekable=!1},close(a){a.Ca.bb.yb(a.Ca)},yb(a){a.Ca.bb.yb(a.Ca)},read(a,b,c,d){if(!a.Ca||!a.Ca.bb.uc)throw new P(60);for(var e=0,f=0;f<d;f++){try{var g=a.Ca.bb.uc(a.Ca)}catch(h){throw new P(29);}if(void 0===g&&0===e)throw new P(6);if(null===g||void 0===g)break;e++;b[c+f]=g}e&&(a.node.ib=Date.now());return e},write(a,b,c,d){if(!a.Ca||!a.Ca.bb.ac)throw new P(60);try{for(var e=0;e<d;e++)a.Ca.bb.ac(a.Ca,b[c+e])}catch(f){throw new P(29);
|
|
402
|
+
}d&&(a.node.Sa=a.node.Pa=Date.now());return e}},qb={uc(){a:{if(!jb.length){var a=null;globalThis.window?.prompt&&(a=window.prompt("Input: "),null!==a&&(a+="\n"));if(!a){var b=null;break a}b=Array(kb(a)+1);a=lb(a,b,0,b.length);b.length=a;jb=b}b=jb.shift()}return b},ac(a,b){null===b||10===b?(sa(gb(a.output)),a.output=[]):0!=b&&a.output.push(b)},yb(a){0<a.output?.length&&(sa(gb(a.output)),a.output=[])},od(){return{Pd:25856,Rd:5,Od:191,Qd:35387,Nd:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,
|
|
403
|
+
0,0,0,0,0,0,0,0,0,0,0]}},pd(){return 0},qd(){return[24,80]}},rb={ac(a,b){null===b||10===b?(ta(gb(a.output)),a.output=[]):0!=b&&a.output.push(b)},yb(a){0<a.output?.length&&(ta(gb(a.output)),a.output=[])}},Q={Va:null,ab(){return Q.createNode(null,"/",16895,0)},createNode(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new P(63);Q.Va||(Q.Va={dir:{node:{gb:Q.za.gb,Xa:Q.za.Xa,rb:Q.za.rb,Cb:Q.za.Cb,Fc:Q.za.Fc,Lc:Q.za.Lc,Hc:Q.za.Hc,cc:Q.za.cc,Jb:Q.za.Jb},stream:{Ua:Q.xa.Ua}},file:{node:{gb:Q.za.gb,
|
|
404
|
+
Xa:Q.za.Xa},stream:{Ua:Q.xa.Ua,read:Q.xa.read,write:Q.xa.write,yc:Q.xa.yc,Ac:Q.xa.Ac}},link:{node:{gb:Q.za.gb,Xa:Q.za.Xa,tb:Q.za.tb},stream:{}},oc:{node:{gb:Q.za.gb,Xa:Q.za.Xa},stream:sb}});c=tb(a,b,c,d);16384===(c.mode&61440)?(c.za=Q.Va.dir.node,c.xa=Q.Va.dir.stream,c.ya={}):32768===(c.mode&61440)?(c.za=Q.Va.file.node,c.xa=Q.Va.file.stream,c.Ga=0,c.ya=null):40960===(c.mode&61440)?(c.za=Q.Va.link.node,c.xa=Q.Va.link.stream):8192===(c.mode&61440)&&(c.za=Q.Va.oc.node,c.xa=Q.Va.oc.stream);c.ib=c.Sa=
|
|
405
|
+
c.Pa=Date.now();a&&(a.ya[b]=c,a.ib=a.Sa=a.Pa=c.ib);return c},Vd(a){return a.ya?a.ya.subarray?a.ya.subarray(0,a.Ga):new Uint8Array(a.ya):new Uint8Array(0)},za:{gb(a){var b={};b.Sd=8192===(a.mode&61440)?a.id:1;b.Xd=a.id;b.mode=a.mode;b.Zd=1;b.uid=0;b.Wd=0;b.Fb=a.Fb;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.Ga:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.ib=new Date(a.ib);b.Sa=new Date(a.Sa);b.Pa=new Date(a.Pa);b.Xc=4096;b.Md=Math.ceil(b.size/b.Xc);return b},Xa(a,b){for(var c of["mode",
|
|
406
|
+
"atime","mtime","ctime"])null!=b[c]&&(a[c]=b[c]);void 0!==b.size&&(b=b.size,a.Ga!=b&&(0==b?(a.ya=null,a.Ga=0):(c=a.ya,a.ya=new Uint8Array(b),c&&a.ya.set(c.subarray(0,Math.min(b,a.Ga))),a.Ga=b)))},rb(){Q.Vb||(Q.Vb=new P(44),Q.Vb.stack="<generic error, no stack>");throw Q.Vb;},Cb(a,b,c,d){return Q.createNode(a,b,c,d)},Fc(a,b,c){try{var d=ub(b,c)}catch(f){}if(d){if(16384===(a.mode&61440))for(var e in d.ya)throw new P(55);e=vb(d.parent.id,d.name);if(wb[e]===d)wb[e]=d.mb;else for(e=wb[e];e;){if(e.mb===
|
|
407
|
+
d){e.mb=d.mb;break}e=e.mb}}delete a.parent.ya[a.name];b.ya[c]=a;a.name=c;b.Pa=b.Sa=a.parent.Pa=a.parent.Sa=Date.now()},Lc(a,b){delete a.ya[b];a.Pa=a.Sa=Date.now()},Hc(a,b){var c=ub(a,b),d;for(d in c.ya)throw new P(55);delete a.ya[b];a.Pa=a.Sa=Date.now()},cc(a){return[".","..",...Object.keys(a.ya)]},Jb(a,b,c){a=Q.createNode(a,b,41471,0);a.link=c;return a},tb(a){if(40960!==(a.mode&61440))throw new P(28);return a.link}},xa:{read(a,b,c,d,e){var f=a.node.ya;if(e>=a.node.Ga)return 0;a=Math.min(a.node.Ga-
|
|
408
|
+
e,d);if(8<a&&f.subarray)b.set(f.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=f[e+d];return a},write(a,b,c,d,e,f){b.buffer===w.buffer&&(f=!1);if(!d)return 0;a=a.node;a.Sa=a.Pa=Date.now();if(b.subarray&&(!a.ya||a.ya.subarray)){if(f)return a.ya=b.subarray(c,c+d),a.Ga=d;if(0===a.Ga&&0===e)return a.ya=b.slice(c,c+d),a.Ga=d;if(e+d<=a.Ga)return a.ya.set(b.subarray(c,c+d),e),d}f=e+d;var g=a.ya?a.ya.length:0;g>=f||(f=Math.max(f,g*(1048576>g?2:1.125)>>>0),0!=g&&(f=Math.max(f,256)),g=a.ya,a.ya=new Uint8Array(f),
|
|
409
|
+
0<a.Ga&&a.ya.set(g.subarray(0,a.Ga),0));if(a.ya.subarray&&b.subarray)a.ya.set(b.subarray(c,c+d),e);else for(f=0;f<d;f++)a.ya[e+f]=b[c+f];a.Ga=Math.max(a.Ga,e+d);return d},Ua(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Ga);if(0>b)throw new P(28);return b},yc(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new P(43);a=a.node.ya;if(e&2||!a||a.buffer!==w.buffer){d=!0;La();e=void 0;if(!e)throw new P(48);if(a){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,
|
|
410
|
+
c,c+b);w.set(a,e)}}else d=!1,e=a.byteOffset;return{Ba:e,Ld:d}},Ac(a,b,c,d){Q.xa.write(a,b,0,d,c,!1);return 0}}},xb=(a,b)=>{var c=0;a&&(c|=365);b&&(c|=146);return c},yb=null,zb={},Ab=[],Bb=1,wb=null,Cb=!1,Db=!0,Eb={},P=class{name="ErrnoError";constructor(a){this.eb=a}},Fb=class{cb={};node=null;get flags(){return this.cb.flags}set flags(a){this.cb.flags=a}get position(){return this.cb.position}set position(a){this.cb.position=a}},Gb=class{za={};xa={};Db=null;constructor(a,b,c,d){a||=this;this.parent=
|
|
411
|
+
a;this.ab=a.ab;this.id=Bb++;this.name=b;this.mode=c;this.Fb=d;this.ib=this.Sa=this.Pa=Date.now()}get read(){return 365===(this.mode&365)}set read(a){a?this.mode|=365:this.mode&=-366}get write(){return 146===(this.mode&146)}set write(a){a?this.mode|=146:this.mode&=-147}};
|
|
412
|
+
function Hb(a,b={}){if(!a)throw new P(44);b.Xb??(b.Xb=!0);"/"===a.charAt(0)||(a="//"+a);var c=0;a:for(;40>c;c++){a=a.split("/").filter(h=>!!h);for(var d=yb,e="/",f=0;f<a.length;f++){var g=f===a.length-1;if(g&&b.parent)break;if("."!==a[f])if(".."===a[f])if(e=ab(e),d===d.parent){a=e+"/"+a.slice(f+1).join("/");c--;continue a}else d=d.parent;else{e=$a(e+"/"+a[f]);try{d=ub(d,a[f])}catch(h){if(44===h?.eb&&g&&b.yd)return{path:e};throw h;}!d.Db||g&&!b.Xb||(d=d.Db.root);if(40960===(d.mode&61440)&&(!g||b.Wb)){if(!d.za.tb)throw new P(52);
|
|
413
|
+
d=d.za.tb(d);"/"===d.charAt(0)||(d=ab(e)+"/"+d);a=d+"/"+a.slice(f+1).join("/");continue a}}}return{path:e,node:d}}throw new P(32);}function vb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%wb.length}function ub(a,b){var c=16384===(a.mode&61440)?(c=Ib(a,"x"))?c:a.za.rb?0:2:54;if(c)throw new P(c);for(c=wb[vb(a.id,b)];c;c=c.mb){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.za.rb(a,b)}
|
|
414
|
+
function tb(a,b,c,d){a=new Gb(a,b,c,d);b=vb(a.parent.id,a.name);a.mb=wb[b];return wb[b]=a}function Jb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function Ib(a,b){if(Db)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function Kb(a,b){if(16384!==(a.mode&61440))return 54;try{return ub(a,b),20}catch(c){}return Ib(a,"wx")}function Lb(a){a=Ab[a];if(!a)throw new P(8);return a}
|
|
415
|
+
function Mb(a,b=-1){a=Object.assign(new Fb,a);if(-1==b)a:{for(b=0;4096>=b;b++)if(!Ab[b])break a;throw new P(33);}a.fb=b;return Ab[b]=a}function Nb(a,b=-1){a=Mb(a,b);a.xa?.Ud?.(a);return a}function Ob(a,b){var c= undefined,d=c?null:a;c??=a.za.Xa;if(!c)throw new P(63);c(d,b)}var sb={open(a){a.xa=zb[a.node.Fb].xa;a.xa.open?.(a)},Ua(){throw new P(70);}};function ob(a,b){zb[a]={xa:b}}
|
|
416
|
+
function Pb(a,b){var c="/"===b;if(c&&yb)throw new P(10);if(!c&&b){var d=Hb(b,{Xb:!1});b=d.path;d=d.node;if(d.Db)throw new P(10);if(16384!==(d.mode&61440))throw new P(54);}b={type:a,$d:{},zc:b,wd:[]};a=a.ab(b);a.ab=b;b.root=a;c?yb=a:d&&(d.Db=b,d.ab&&d.ab.wd.push(b))}function Qb(a,b,c){var d=Hb(a,{parent:!0}).node;a=a&&a.match(/([^\/]+|\/)\/*$/)[1];if(!a)throw new P(28);if("."===a||".."===a)throw new P(20);var e=Kb(d,a);if(e)throw new P(e);if(!d.za.Cb)throw new P(63);return d.za.Cb(d,a,b,c)}
|
|
417
|
+
function Vb(a){return Qb(a,16895,0)}function Wb(a,b,c){"undefined"==typeof c&&(c=b,b=438);Qb(a,b|8192,c)}function Xb(a,b){if(!db(a))throw new P(44);var c=Hb(b,{parent:!0}).node;if(!c)throw new P(44);b=b&&b.match(/([^\/]+|\/)\/*$/)[1];var d=Kb(c,b);if(d)throw new P(d);if(!c.za.Jb)throw new P(63);c.za.Jb(c,b,a)}
|
|
418
|
+
function Yb(a,b,c=438){if(""===a)throw new P(44);if("string"==typeof b){var d={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof d)throw Error(`Unknown file open mode: ${b}`);b=d}c=b&64?c&4095|32768:0;if("object"==typeof a)d=a;else{var e=a.endsWith("/");a=Hb(a,{Wb:!(b&131072),yd:!0});d=a.node;a=a.path}var f=!1;if(b&64)if(d){if(b&128)throw new P(20);}else{if(e)throw new P(31);d=Qb(a,c|511,0);f=!0}if(!d)throw new P(44);8192===(d.mode&61440)&&(b&=-513);if(b&65536&&16384!==(d.mode&
|
|
419
|
+
61440))throw new P(54);if(!f&&(e=d?40960===(d.mode&61440)?32:16384===(d.mode&61440)&&("r"!==Jb(b)||b&576)?31:Ib(d,Jb(b)):44))throw new P(e);if(b&512&&!f){e=d;e="string"==typeof e?Hb(e,{Wb:!0}).node:e;if(16384===(e.mode&61440))throw new P(31);if(32768!==(e.mode&61440))throw new P(28);var g=Ib(e,"w");if(g)throw new P(g);Ob(e,{size:0,timestamp:Date.now()})}b&=-131713;a:for(e=d;;){if(e===e.parent){e=e.ab.zc;var h=h?"/"!==e[e.length-1]?`${e}/${h}`:e+h:e;break a}h=h?`${e.name}/${h}`:e.name;e=e.parent}h=
|
|
420
|
+
Mb({node:d,path:h,flags:b,seekable:!0,position:0,xa:d.xa,Fd:[],error:!1});h.xa.open&&h.xa.open(h);f&&(c&=511,d="string"==typeof d?Hb(d,{Wb:!0}).node:d,Ob(d,{mode:c&4095|d.mode&-4096,Pa:Date.now(),Td:void 0}));!k.logReadFiles||b&1||a in Eb||(Eb[a]=1);return h}function Zb(a,b,c){if(null===a.fb)throw new P(8);if(!a.seekable||!a.xa.Ua)throw new P(70);if(0!=c&&1!=c&&2!=c)throw new P(28);a.position=a.xa.Ua(a,b,c);a.Fd=[]}
|
|
421
|
+
function $b(a,b,c){a=$a("/dev/"+a);var d=xb(!!b,!!c);$b.xc??($b.xc=64);var e=$b.xc++<<8|0;ob(e,{open(f){f.seekable=!1},close(){c?.buffer?.length&&c(10)},read(f,g,h,l){for(var n=0,t=0;t<l;t++){try{var u=b()}catch(r){throw new P(29);}if(void 0===u&&0===n)throw new P(6);if(null===u||void 0===u)break;n++;g[h+t]=u}n&&(f.node.ib=Date.now());return n},write(f,g,h,l){for(var n=0;n<l;n++)try{c(g[h+n])}catch(t){throw new P(29);}l&&(f.node.Sa=f.node.Pa=Date.now());return n}});Wb(a,d,e)}
|
|
422
|
+
var ac={},Xa=void 0,bc=(a,b)=>Object.defineProperty(b,"name",{value:a}),cc=[],dc=[0,1,,1,null,1,!0,1,!1,1],S=class extends Error{constructor(a){super(a);this.name="BindingError"}},ec=a=>{if(!a)throw new S(`Cannot use deleted val. handle = ${a}`);return dc[a]},fc=a=>{switch(a){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const b=cc.pop()||dc.length;dc[b]=a;dc[b+1]=1;return b}};class gc extends Error{}
|
|
423
|
+
var T=a=>{for(var b="";;){var c=E[a++];if(!c)return b;b+=String.fromCharCode(c)}},hc={},ic=(a,b)=>{if(void 0===b)throw new S("ptr should not be undefined");for(;a.Ha;)b=a.ub(b),a=a.Ha;return b},jc={},mc=a=>{a=kc(a);var b=T(a);lc(a);return b},nc=(a,b)=>{var c=jc[a];if(void 0===c)throw a=`${b} has unknown type ${mc(a)}`,new S(a);return c},oc=()=>{},pc=!1,qc=a=>{if(!globalThis.FinalizationRegistry)return qc=b=>b,a;pc=new FinalizationRegistry(b=>{b=b.va;--b.count.value;0===b.count.value&&(b.Ja?b.Qa.Wa(b.Ja):
|
|
424
|
+
b.Da.wa.Wa(b.Ba))});qc=b=>{var c=b.va;c.Ja&&pc.register(b,{va:c},b);return b};oc=b=>{pc.unregister(b)};return qc(a)},rc={},sc=a=>{for(;a.length;){var b=a.pop();a.pop()(b)}};function tc(a){return this.Aa(M[a>>2])}
|
|
425
|
+
var uc={},vc={},wc=class extends Error{constructor(a){super(a);this.name="InternalError"}},Y=(a,b,c)=>{function d(h){h=c(h);if(h.length!==a.length)throw new wc("Mismatched type converter count");for(var l=0;l<a.length;++l)X(a[l],h[l])}a.forEach(h=>vc[h]=b);var e=Array(b.length),f=[],g=0;for(let [h,l]of b.entries())jc.hasOwnProperty(l)?e[h]=jc[l]:(f.push(l),uc.hasOwnProperty(l)||(uc[l]=[]),uc[l].push(()=>{e[h]=jc[l];++g;g===f.length&&d(e)}));0===f.length&&d(e)};
|
|
426
|
+
function xc(a,b,c={}){var d=b.name;if(!a)throw new S(`type "${d}" must have a positive integer typeid pointer`);if(jc.hasOwnProperty(a)){if(c.md)return;throw new S(`Cannot register type '${d}' twice`);}jc[a]=b;delete vc[a];uc.hasOwnProperty(a)&&(b=uc[a],delete uc[a],b.forEach(e=>e()))}function X(a,b,c={}){return xc(a,b,c)}
|
|
427
|
+
var yc=(a,b,c)=>{switch(b){case 1:return c?d=>w[d]:d=>E[d];case 2:return c?d=>Aa[d>>1]:d=>Ba[d>>1];case 4:return c?d=>F[d>>2]:d=>M[d>>2];case 8:return c?d=>Ga[d>>3]:d=>Ha[d>>3];default:throw new TypeError(`invalid integer width (${b}): ${a}`);}},zc=a=>{throw new S(a.va.Da.wa.name+" instance already deleted");},Ac=[];function Bc(){}
|
|
428
|
+
var Cc={},Dc=(a,b,c)=>{if(void 0===a[b].Fa){var d=a[b];a[b]=function(...e){if(!a[b].Fa.hasOwnProperty(e.length))throw new S(`Function '${c}' called with an invalid number of arguments (${e.length}) - expects one of (${a[b].Fa})!`);return a[b].Fa[e.length].apply(this,e)};a[b].Fa=[];a[b].Fa[d.$a]=d}},Ec=(a,b,c)=>{if(k.hasOwnProperty(a)){if(void 0===c||void 0!==k[a].Fa&&void 0!==k[a].Fa[c])throw new S(`Cannot register public name '${a}' twice`);Dc(k,a,a);if(k[a].Fa.hasOwnProperty(c))throw new S(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`);
|
|
429
|
+
k[a].Fa[c]=b}else k[a]=b,k[a].$a=c},Fc=a=>{a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?`_${a}`:a};function Gc(a,b,c,d,e,f,g,h){this.name=a;this.constructor=b;this.Ta=c;this.Wa=d;this.Ha=e;this.gd=f;this.ub=g;this.bd=h;this.Dc=[]}
|
|
430
|
+
var Hc=(a,b,c)=>{for(;b!==c;){if(!b.ub)throw new S(`Expected null or instance of ${c.name}, got an instance of ${b.name}`);a=b.ub(a);b=b.Ha}return a},Ic=a=>{if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a};
|
|
431
|
+
function Jc(a,b){if(null===b){if(this.Zb)throw new S(`null is not a valid ${this.name}`);return 0}if(!b.va)throw new S(`Cannot pass "${Ic(b)}" as a ${this.name}`);if(!b.va.Ba)throw new S(`Cannot pass deleted object as a pointer of type ${this.name}`);return Hc(b.va.Ba,b.va.Da.wa,this.wa)}
|
|
432
|
+
function Kc(a,b){if(null===b){if(this.Zb)throw new S(`null is not a valid ${this.name}`);if(this.Bb){var c=this.bc();null!==a&&a.push(this.Wa,c);return c}return 0}if(!b||!b.va)throw new S(`Cannot pass "${Ic(b)}" as a ${this.name}`);if(!b.va.Ba)throw new S(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Ab&&b.va.Da.Ab)throw new S(`Cannot convert argument of type ${b.va.Qa?b.va.Qa.name:b.va.Da.name} to parameter type ${this.name}`);c=Hc(b.va.Ba,b.va.Da.wa,this.wa);if(this.Bb){if(void 0===
|
|
433
|
+
b.va.Ja)throw new S("Passing raw pointer to smart pointer is illegal");switch(this.Ed){case 0:if(b.va.Qa===this)c=b.va.Ja;else throw new S(`Cannot convert argument of type ${b.va.Qa?b.va.Qa.name:b.va.Da.name} to parameter type ${this.name}`);break;case 1:c=b.va.Ja;break;case 2:if(b.va.Qa===this)c=b.va.Ja;else{var d=b.clone();c=this.Ad(c,fc(()=>d["delete"]()));null!==a&&a.push(this.Wa,c)}break;default:throw new S("Unsupported sharing policy");}}return c}
|
|
434
|
+
function Lc(a,b){if(null===b){if(this.Zb)throw new S(`null is not a valid ${this.name}`);return 0}if(!b.va)throw new S(`Cannot pass "${Ic(b)}" as a ${this.name}`);if(!b.va.Ba)throw new S(`Cannot pass deleted object as a pointer of type ${this.name}`);if(b.va.Da.Ab)throw new S(`Cannot convert argument of type ${b.va.Da.name} to parameter type ${this.name}`);return Hc(b.va.Ba,b.va.Da.wa,this.wa)}
|
|
435
|
+
var Mc=(a,b,c)=>{if(b===c)return a;if(void 0===c.Ha)return null;a=Mc(a,b,c.Ha);return null===a?null:c.bd(a)},Nc=(a,b)=>{b=ic(a,b);return hc[b]},Oc=(a,b)=>{if(!b.Da||!b.Ba)throw new wc("makeClassHandle requires ptr and ptrType");if(!!b.Qa!==!!b.Ja)throw new wc("Both smartPtrType and smartPtr must be specified");b.count={value:1};return qc(Object.create(a,{va:{value:b,writable:!0}}))};
|
|
436
|
+
function Pc(a,b,c,d,e,f,g,h,l,n,t){this.name=a;this.wa=b;this.Zb=c;this.Ab=d;this.Bb=e;this.zd=f;this.Ed=g;this.Ec=h;this.bc=l;this.Ad=n;this.Wa=t;e||void 0!==b.Ha?this.Ea=Kc:(this.Ea=d?Jc:Lc,this.La=null)}var Qc=(a,b,c)=>{if(!k.hasOwnProperty(a))throw new wc("Replacing nonexistent public symbol");void 0!==k[a].Fa&&void 0!==c?k[a].Fa[c]=b:(k[a]=b,k[a].$a=c)},Z=(a,b)=>{a=T(a);var c=Rc.get(b);if("function"!=typeof c)throw new S(`unknown function pointer with signature ${a}: ${b}`);return c};
|
|
435
437
|
class Sc extends Error{}var Tc=(a,b)=>{function c(f){e[f]||jc[f]||(vc[f]?vc[f].forEach(c):(d.push(f),e[f]=!0))}var d=[],e={};b.forEach(c);throw new Sc(`${a}: `+d.map(mc).join([", "]));};function Uc(a){for(var b=1;b<a.length;++b)if(null!==a[b]&&void 0===a[b].La)return!0;return!1}
|
|
436
|
-
function
|
|
437
|
-
var
|
|
438
|
-
|
|
439
|
-
2])};case 8:return function(c){return this.Aa(
|
|
440
|
-
|
|
441
|
-
return c},
|
|
442
|
-
"C").replace("-","_")+".UTF-8",_:la||"./this.program"},b;for(b in
|
|
443
|
-
(function(){
|
|
444
|
-
(function(){
|
|
438
|
+
function $c(a,b,c,d,e){var f=b.length;if(2>f)throw new S("argTypes array size mismatch! Must at least get return value and 'this' types!");var g=null!==b[1]&&null!==c,h=Uc(b),l=!b[0].sd,n=f-2,t=Array(n),u=[],r=[];return bc(a,function(...x){r.length=0;u.length=g?2:1;u[0]=e;if(g){var y=b[1].Ea(r,this);u[1]=y}for(var p=0;p<n;++p)t[p]=b[p+2].Ea(r,x[p]),u.push(t[p]);x=d(...u);if(h)sc(r);else for(p=g?1:2;p<b.length;p++){var H=1===p?y:t[p-2];null!==b[p].La&&b[p].La(H)}y=l?b[0].Aa(x):void 0;return y})}
|
|
439
|
+
var ad=(a,b)=>{for(var c=[],d=0;d<a;d++)c.push(M[b+4*d>>2]);return c},bd=a=>{a=a.trim();const b=a.indexOf("(");return-1===b?a:a.slice(0,b)},cd=(a,b,c)=>{if(!(a instanceof Object))throw new S(`${c} with invalid "this": ${a}`);if(!(a instanceof b.wa.constructor))throw new S(`${c} incompatible with "this" of type ${a.constructor.name}`);if(!a.va.Ba)throw new S(`cannot call emscripten binding method ${c} on deleted object`);return Hc(a.va.Ba,a.va.Da.wa,b.wa)},dd=a=>{9<a&&0===--dc[a+1]&&(dc[a]=void 0,
|
|
440
|
+
cc.push(a))},ed={name:"emscripten::val",Aa:a=>{var b=ec(a);dd(a);return b},Ea:(a,b)=>fc(b),Na:tc,La:null},fd=(a,b,c)=>{switch(b){case 1:return c?function(d){return this.Aa(w[d])}:function(d){return this.Aa(E[d])};case 2:return c?function(d){return this.Aa(Aa[d>>1])}:function(d){return this.Aa(Ba[d>>1])};case 4:return c?function(d){return this.Aa(F[d>>2])}:function(d){return this.Aa(M[d>>2])};default:throw new TypeError(`invalid integer width (${b}): ${a}`);}},gd=(a,b)=>{switch(b){case 4:return function(c){return this.Aa(Ea[c>>
|
|
441
|
+
2])};case 8:return function(c){return this.Aa(Fa[c>>3])};default:throw new TypeError(`invalid float width (${b}): ${a}`);}},hd=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,jd=(a,b,c)=>{a>>=1;b=fb(Ba,a,b/2,c);if(16<b-a&&hd)return hd.decode(Ba.subarray(a,b));for(c="";a<b;++a)c+=String.fromCharCode(Ba[a]);return c},kd=(a,b,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e)Aa[b>>1]=a.charCodeAt(e),b+=2;Aa[b>>1]=0;return b-d},ld=a=>2*a.length,
|
|
442
|
+
md=(a,b,c)=>{var d="";a>>=2;for(var e=0;!(e>=b/4);e++){var f=M[a+e];if(!f&&!c)break;d+=String.fromCodePoint(f)}return d},nd=(a,b,c)=>{c??=2147483647;if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var f=a.codePointAt(e);65535<f&&e++;F[b>>2]=f;b+=4;if(b+4>c)break}F[b>>2]=0;return b-d},od=a=>{for(var b=0,c=0;c<a.length;++c)65535<a.codePointAt(c)&&c++,b+=4;return b},pd=0,qd=[],rd=a=>{var b=qd.length;qd.push(a);return b},sd=(a,b)=>{for(var c=Array(a),d=0;d<a;++d)c[d]=nc(M[b+4*d>>2],`parameter ${d}`);
|
|
443
|
+
return c},td={},ud=a=>{var b=td[a];return void 0===b?T(a):b},vd=[0,31,60,91,121,152,182,213,244,274,305,335],wd=[0,31,59,90,120,151,181,212,243,273,304,334],xd={},yd=a=>{if(!(a instanceof Ra||"unwind"==a))throw a;},zd=a=>{xa=a;Wa||0<pd||(k.onExit?.(a),wa=!0);throw new Ra(a);},Ad=a=>{if(!wa)try{if(a(),!(Wa||0<pd))try{xa=a=xa,zd(a)}catch(b){yd(b)}}catch(b){yd(b)}},Bd=[],Cd={},Ed=()=>{if(!Dd){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??
|
|
444
|
+
"C").replace("-","_")+".UTF-8",_:la||"./this.program"},b;for(b in Cd)void 0===Cd[b]?delete a[b]:a[b]=Cd[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);Dd=c}return Dd},Dd;wb=Array(4096);Pb(Q,"/");Vb("/tmp");Vb("/home");Vb("/home/web_user");
|
|
445
|
+
(function(){Vb("/dev");ob(259,{read:()=>0,write:(d,e,f,g)=>g,Ua:()=>0});Wb("/dev/null",259);nb(1280,qb);nb(1536,rb);Wb("/dev/tty",1280);Wb("/dev/tty1",1536);var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(cb(a),b=a.byteLength);return a[--b]};$b("random",c);$b("urandom",c);Vb("/dev/shm");Vb("/dev/shm/tmp")})();
|
|
446
|
+
(function(){Vb("/proc");var a=Vb("/proc/self");Vb("/proc/self/fd");Pb({ab(){var b=tb(a,"fd",16895,73);b.xa={Ua:Q.xa.Ua};b.za={rb(c,d){c=+d;var e=Lb(c);c={parent:null,ab:{zc:"fake"},za:{tb:()=>e.path},id:c+1};return c.parent=c},cc(){return Array.from(Ab.entries()).filter(([,c])=>c).map(([c])=>c.toString())}};return b}},"/proc/self/fd")})();
|
|
445
447
|
(()=>{let a=Bc.prototype;Object.assign(a,{isAliasOf:function(c){if(!(this instanceof Bc&&c instanceof Bc))return!1;var d=this.va.Da.wa,e=this.va.Ba;c.va=c.va;var f=c.va.Da.wa;for(c=c.va.Ba;d.Ha;)e=d.ub(e),d=d.Ha;for(;f.Ha;)c=f.ub(c),f=f.Ha;return d===f&&e===c},clone:function(){this.va.Ba||zc(this);if(this.va.nb)return this.va.count.value+=1,this;var c=qc,d=Object,e=d.create,f=Object.getPrototypeOf(this),g=this.va;c=c(e.call(d,f,{va:{value:{count:g.count,qb:g.qb,nb:g.nb,Ba:g.Ba,Da:g.Da,Ja:g.Ja,Qa:g.Qa}}}));
|
|
446
|
-
c.va.count.value+=1;c.va.qb=!1;return c},["delete"](){this.va.Ba||zc(this);if(this.va.qb&&!this.va.nb)throw new
|
|
448
|
+
c.va.count.value+=1;c.va.qb=!1;return c},["delete"](){this.va.Ba||zc(this);if(this.va.qb&&!this.va.nb)throw new S("Object already scheduled for deletion");oc(this);var c=this.va;--c.count.value;0===c.count.value&&(c.Ja?c.Qa.Wa(c.Ja):c.Da.wa.Wa(c.Ba));this.va.nb||(this.va.Ja=void 0,this.va.Ba=void 0)},isDeleted:function(){return!this.va.Ba},deleteLater:function(){this.va.Ba||zc(this);if(this.va.qb&&!this.va.nb)throw new S("Object already scheduled for deletion");Ac.push(this);this.va.qb=!0;return this}});
|
|
447
449
|
const b=Symbol.dispose;b&&(a[b]=a["delete"])})();
|
|
448
|
-
Object.assign(Pc.prototype,{
|
|
449
|
-
e?b.call(this):this.Bb?Oc(d.wa.Ta,{Da:d,Ba:e,Qa:this,Ja:a}):Oc(d.wa.Ta,{Da:d,Ba:e})}});k.noExitRuntime&&(
|
|
450
|
-
var
|
|
450
|
+
Object.assign(Pc.prototype,{hd(a){this.Ec&&(a=this.Ec(a));return a},qc(a){this.Wa?.(a)},Na:tc,Aa:function(a){function b(){return this.Bb?Oc(this.wa.Ta,{Da:this.zd,Ba:c,Qa:this,Ja:a}):Oc(this.wa.Ta,{Da:this,Ba:a})}var c=this.hd(a);if(!c)return this.qc(a),null;var d=Nc(this.wa,c);if(void 0!==d){if(0===d.va.count.value)return d.va.Ba=c,d.va.Ja=a,d.clone();d=d.clone();this.qc(a);return d}d=this.wa.gd(c);d=Cc[d];if(!d)return b.call(this);d=this.Ab?d.Yc:d.pointerType;var e=Mc(c,this.wa,d.wa);return null===
|
|
451
|
+
e?b.call(this):this.Bb?Oc(d.wa.Ta,{Da:d,Ba:e,Qa:this,Ja:a}):Oc(d.wa.Ta,{Da:d,Ba:e})}});k.noExitRuntime&&(Wa=k.noExitRuntime);k.print&&(sa=k.print);k.printErr&&(ta=k.printErr);k.wasmBinary&&(va=k.wasmBinary);k.thisProgram&&(la=k.thisProgram);if(k.preInit)for("function"==typeof k.preInit&&(k.preInit=[k.preInit]);0<k.preInit.length;)k.preInit.shift()();
|
|
452
|
+
var Id={240415:(a,b,c,d,e)=>{if("undefined"===typeof window||void 0===(window.AudioContext||window.webkitAudioContext))return 0;if("undefined"===typeof window.miniaudio){window.miniaudio={referenceCount:0};window.miniaudio.device_type={};window.miniaudio.device_type.playback=a;window.miniaudio.device_type.capture=b;window.miniaudio.device_type.duplex=c;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=d;window.miniaudio.device_state.started=e;let f=window.miniaudio;f.devices=
|
|
451
453
|
[];f.track_device=function(g){for(var h=0;h<f.devices.length;++h)if(null==f.devices[h])return f.devices[h]=g,h;f.devices.push(g);return f.devices.length-1};f.untrack_device_by_index=function(g){for(f.devices[g]=null;0<f.devices.length;)if(null==f.devices[f.devices.length-1])f.devices.pop();else break};f.untrack_device=function(g){for(var h=0;h<f.devices.length;++h)if(f.devices[h]==g)return f.untrack_device_by_index(h)};f.get_device_by_index=function(g){return f.devices[g]};f.unlock_event_types=["touchend",
|
|
452
|
-
"click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.Ra&&h.state===f.device_state.started&&h.Ra.resume().then(()=>{
|
|
453
|
-
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},
|
|
454
|
-
new (window.AudioContext||window.webkitAudioContext)(h);g.Ra.suspend();g.state=window.miniaudio.device_state.stopped;c=0;a!=window.miniaudio.device_type.playback&&(c=b);g.hb=g.Ra.createScriptProcessor(d,c,b);g.hb.onaudioprocess=function(
|
|
455
|
-
window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(
|
|
456
|
-
g.hb.connect(g.Ra.destination)}).catch(function(
|
|
457
|
-
{window.miniaudio.untrack_device_by_index(a)},
|
|
458
|
-
e,0;case 12:return e=
|
|
459
|
-
0:-59;case 21506:case 21507:case 21508:if(!d.Ca)return-59;if(d.Ca.bb.
|
|
460
|
-
"ErrnoError"!==g.name)throw g;return-g.eb}},M:function(a,b,c,d){
|
|
461
|
-
Object.defineProperty(this,"__parent",{value:e});this.__construct(...h)});e.__construct=function(...h){if(this===e)throw new
|
|
462
|
-
this.va.Ba;h=ic(d,h);if(hc.hasOwnProperty(h))delete hc[h];else throw new
|
|
463
|
-
Aa:
|
|
464
|
-
f){return f?c:d},Na:function(e){return this.Aa(
|
|
465
|
-
|
|
466
|
-
b
|
|
467
|
-
f);
|
|
468
|
-
{var g=
|
|
469
|
-
a:(a,b,c,d,e,f,g,h)=>{var
|
|
470
|
-
T(b);e=
|
|
471
|
-
b,p);return[]});return[]})},T:a=>
|
|
472
|
-
Ea:function(h,
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
0},y:()=>{throw Infinity;},f:(a,b,c)=>{var [d,...e]=
|
|
477
|
-
v:a=>{9<a&&(
|
|
478
|
-
0,1,0,0,0,0))/864E5|0},E:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);
|
|
479
|
-
0,1)).getTimezoneOffset();
|
|
480
|
-
"0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(
|
|
481
|
-
for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(a,d)/65536))-
|
|
482
|
-
null);try{b.xa.close&&b.xa.close(b)}catch(c){throw c;}finally{
|
|
483
|
-
if(!
|
|
484
|
-
typeof
|
|
485
|
-
|
|
486
|
-
d.width,d.height);var f=e.data.length,g=k.Uc(f);k.
|
|
487
|
-
|
|
488
|
-
(d,e)=>{c(a(d,e))})});
|
|
489
|
-
(function(){function a(){k.calledRun=!0;if(!
|
|
490
|
-
if(k.preRun)for("function"==typeof k.preRun&&(k.preRun=[k.preRun]);k.preRun.length;)
|
|
454
|
+
"click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.Ra&&h.state===f.device_state.started&&h.Ra.resume().then(()=>{Fd(h.Cc)},l=>{console.error("Failed to resume audiocontext",l)})}f.unlock_event_types.map(function(l){document.removeEventListener(l,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},242593:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
|
|
455
|
+
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},242897:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,243001:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},243172:(a,b,c,d,e,f)=>{if("undefined"===typeof window.miniaudio)return-1;var g={},h={};a==window.miniaudio.device_type.playback&&0!=c&&(h.sampleRate=c);g.Ra=
|
|
456
|
+
new (window.AudioContext||window.webkitAudioContext)(h);g.Ra.suspend();g.state=window.miniaudio.device_state.stopped;c=0;a!=window.miniaudio.device_type.playback&&(c=b);g.hb=g.Ra.createScriptProcessor(d,c,b);g.hb.onaudioprocess=function(l){if(null==g.zb||0==g.zb.length)g.zb=new Float32Array(Ea.buffer,e,d*b);if(a==window.miniaudio.device_type.capture||a==window.miniaudio.device_type.duplex){for(var n=0;n<b;n+=1)for(var t=l.inputBuffer.getChannelData(n),u=g.zb,r=0;r<d;r+=1)u[r*b+n]=t[r];Gd(f,d,e)}if(a==
|
|
457
|
+
window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(Hd(f,d,e),n=0;n<l.outputBuffer.numberOfChannels;++n)for(t=l.outputBuffer.getChannelData(n),u=g.zb,r=0;r<d;r+=1)t[r]=u[r*b+n];else for(n=0;n<l.outputBuffer.numberOfChannels;++n)l.outputBuffer.getChannelData(n).fill(0)};a!=window.miniaudio.device_type.capture&&a!=window.miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(l){g.Ib=g.Ra.createMediaStreamSource(l);g.Ib.connect(g.hb);
|
|
458
|
+
g.hb.connect(g.Ra.destination)}).catch(function(l){console.log("Failed to get user media: "+l)});a==window.miniaudio.device_type.playback&&g.hb.connect(g.Ra.destination);g.Cc=f;return window.miniaudio.track_device(g)},246049:a=>window.miniaudio.get_device_by_index(a).Ra.sampleRate,246122:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.hb&&(a.hb.onaudioprocess=function(){},a.hb.disconnect(),a.hb=void 0);void 0!==a.Ib&&(a.Ib.disconnect(),a.Ib=void 0);a.Ra.close();a.Ra=void 0;a.Cc=void 0},246522:a=>
|
|
459
|
+
{window.miniaudio.untrack_device_by_index(a)},246572:a=>{a=window.miniaudio.get_device_by_index(a);a.Ra.resume();a.state=window.miniaudio.device_state.started},246711:a=>{a=window.miniaudio.get_device_by_index(a);a.Ra.suspend();a.state=window.miniaudio.device_state.stopped}},lc,Jd,kc,Fd,Gd,Hd,Kd,Ld,Md,Nd,Ka,Rc,Pd={s:function(a,b,c){Xa=c;try{var d=Lb(a);switch(b){case 0:var e=Ya();if(0>e)break;for(;Ab[e];)e++;return Nb(d,e).fb;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=Ya(),d.flags|=
|
|
460
|
+
e,0;case 12:return e=Ya(),Aa[e+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(f){if("undefined"==typeof ac||"ErrnoError"!==f.name)throw f;return-f.eb}},L:function(a,b,c){Xa=c;try{var d=Lb(a);switch(b){case 21509:return d.Ca?0:-59;case 21505:if(!d.Ca)return-59;if(d.Ca.bb.od){a=[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var e=Ya();F[e>>2]=25856;F[e+4>>2]=5;F[e+8>>2]=191;F[e+12>>2]=35387;for(var f=0;32>f;f++)w[e+f+17]=a[f]||0}return 0;case 21510:case 21511:case 21512:return d.Ca?
|
|
461
|
+
0:-59;case 21506:case 21507:case 21508:if(!d.Ca)return-59;if(d.Ca.bb.pd)for(e=Ya(),a=[],f=0;32>f;f++)a.push(w[e+f+17]);return 0;case 21519:if(!d.Ca)return-59;e=Ya();return F[e>>2]=0;case 21520:return d.Ca?-28:-59;case 21537:case 21531:e=Ya();if(!d.xa.nd)throw new P(59);return d.xa.nd(d,b,e);case 21523:if(!d.Ca)return-59;d.Ca.bb.qd&&(f=[24,80],e=Ya(),Aa[e>>1]=f[0],Aa[e+2>>1]=f[1]);return 0;case 21524:return d.Ca?0:-59;case 21515:return d.Ca?0:-59;default:return-28}}catch(g){if("undefined"==typeof ac||
|
|
462
|
+
"ErrnoError"!==g.name)throw g;return-g.eb}},M:function(a,b,c,d){Xa=d;try{b=b?gb(E,b):"";var e=b;if("/"===e.charAt(0))b=e;else{var f=-100===a?"/":Lb(a).path;if(0==e.length)throw new P(44);b=f+"/"+e}var g=d?Ya():0;return Yb(b,c,g).fb}catch(h){if("undefined"==typeof ac||"ErrnoError"!==h.name)throw h;return-h.eb}},P:()=>La(""),o:(a,b,c)=>{a=T(a);b=nc(b,"wrapper");c=ec(c);var d=b.wa,e=d.Ta,f=d.Ha.Ta,g=d.Ha.constructor;a=bc(a,function(...h){for(var l of d.Ha.Dc)if(this[l]===f[l])throw new gc(`Pure virtual function ${l} must be implemented in JavaScript`);
|
|
463
|
+
Object.defineProperty(this,"__parent",{value:e});this.__construct(...h)});e.__construct=function(...h){if(this===e)throw new S("Pass correct 'this' to __construct");h=g.implement(this,...h);oc(h);var l=h.va;h.notifyOnDestruction();l.nb=!0;Object.defineProperties(this,{va:{value:l}});qc(this);h=l.Ba;h=ic(d,h);if(hc.hasOwnProperty(h))throw new S(`Tried to register registered instance: ${h}`);hc[h]=this};e.__destruct=function(){if(this===e)throw new S("Pass correct 'this' to __destruct");oc(this);var h=
|
|
464
|
+
this.va.Ba;h=ic(d,h);if(hc.hasOwnProperty(h))delete hc[h];else throw new S(`Tried to unregister unregistered instance: ${h}`);};a.prototype=Object.create(e);Object.assign(a.prototype,c);return fc(a)},_:a=>{var b=rc[a];delete rc[a];var c=b.bc,d=b.Wa,e=b.tc,f=e.map(g=>g.ld).concat(e.map(g=>g.Cd));Y([a],f,g=>{var h={},l,n;for([l,n]of e.entries()){const t=g[l],u=n.jd,r=n.kd,x=g[l+e.length],y=n.Bd,p=n.Dd;h[n.ed]={read:H=>t.Aa(u(r,H)),write:(H,J)=>{var v=[];y(p,H,x.Ea(v,J));sc(v)},optional:t.optional}}return[{name:b.name,
|
|
465
|
+
Aa:t=>{var u={},r;for(r in h)u[r]=h[r].read(t);d(t);return u},Ea:(t,u)=>{for(var r in h)if(!(r in u||h[r].optional))throw new TypeError(`Missing field: "${r}"`);var x=c();for(r in h)h[r].write(x,u[r]);null!==t&&t.push(d,x);return x},Na:tc,La:d}]})},u:(a,b,c,d,e)=>{b=T(b);d=0n===d;let f=g=>g;if(d){const g=8*c;f=h=>BigInt.asUintN(g,h);e=f(e)}X(a,{name:b,Aa:f,Ea:(g,h)=>{"number"==typeof h&&(h=BigInt(h));return h},Na:yc(b,c,!d),La:null})},V:(a,b,c,d)=>{b=T(b);X(a,{name:b,Aa:function(e){return!!e},Ea:function(e,
|
|
466
|
+
f){return f?c:d},Na:function(e){return this.Aa(E[e])},La:null})},c:(a,b,c,d,e,f,g,h,l,n,t,u,r)=>{t=T(t);f=Z(e,f);h&&=Z(g,h);n&&=Z(l,n);r=Z(u,r);var x=Fc(t);Ec(x,function(){Tc(`Cannot construct ${t} due to unbound types`,[d])});Y([a,b,c],d?[d]:[],y=>{y=y[0];if(d){var p=y.wa;var H=p.Ta}else H=Bc.prototype;y=bc(t,function(...O){if(Object.getPrototypeOf(this)!==J)throw new S(`Use 'new' to construct ${t}`);if(void 0===v.jb)throw new S(`${t} has no accessible constructor`);var V=v.jb[O.length];if(void 0===
|
|
467
|
+
V)throw new S(`Tried to invoke ctor of ${t} with invalid number of parameters (${O.length}) - expected (${Object.keys(v.jb).toString()}) parameters instead!`);return V.apply(this,O)});var J=Object.create(H,{constructor:{value:y}});y.prototype=J;var v=new Gc(t,y,J,r,p,f,h,n);if(v.Ha){var N;(N=v.Ha).vb??(N.vb=[]);v.Ha.vb.push(v)}p=new Pc(t,v,!0,!1,!1);N=new Pc(t+"*",v,!1,!1,!1);H=new Pc(t+" const*",v,!1,!0,!1);Cc[a]={pointerType:N,Yc:H};Qc(x,y);return[p,N,H]})},k:(a,b,c,d,e,f,g)=>{var h=ad(c,d);b=T(b);
|
|
468
|
+
b=bd(b);f=Z(e,f);Y([],[a],l=>{function n(){Tc(`Cannot call ${t} due to unbound types`,h)}l=l[0];var t=`${l.name}.${b}`;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);var u=l.wa.constructor;void 0===u[b]?(n.$a=c-1,u[b]=n):(Dc(u,b,t),u[b].Fa[c-1]=n);Y([],h,r=>{r=$c(t,[r[0],null].concat(r.slice(1)),null,f,g);void 0===u[b].Fa?(r.$a=c-1,u[b]=r):u[b].Fa[c-1]=r;if(l.wa.vb)for(const x of l.wa.vb)x.constructor.hasOwnProperty(b)||(x.constructor[b]=r);return[]});return[]})},q:(a,b,c,d,e,f,g,h)=>{b=T(b);f=Z(e,
|
|
469
|
+
f);Y([],[a],l=>{l=l[0];var n=`${l.name}.${b}`,t={get(){Tc(`Cannot access ${n} due to unbound types`,[c])},enumerable:!0,configurable:!0};t.set=h?()=>{Tc(`Cannot access ${n} due to unbound types`,[c])}:()=>{throw new S(`${n} is a read-only property`);};Object.defineProperty(l.wa.constructor,b,t);Y([],[c],u=>{u=u[0];var r={get(){return u.Aa(f(d))},enumerable:!0};h&&(h=Z(g,h),r.set=x=>{var y=[];h(d,u.Ea(y,x));sc(y)});Object.defineProperty(l.wa.constructor,b,r);return[]});return[]})},n:(a,b,c,d,e,f)=>
|
|
470
|
+
{var g=ad(b,c);e=Z(d,e);Y([],[a],h=>{h=h[0];var l=`constructor ${h.name}`;void 0===h.wa.jb&&(h.wa.jb=[]);if(void 0!==h.wa.jb[b-1])throw new S(`Cannot register multiple constructors with identical number of parameters (${b-1}) for class '${h.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);h.wa.jb[b-1]=()=>{Tc(`Cannot construct ${h.name} due to unbound types`,g)};Y([],g,n=>{n.splice(1,0,null);h.wa.jb[b-1]=$c(l,n,null,e,f);return[]});return[]})},
|
|
471
|
+
a:(a,b,c,d,e,f,g,h)=>{var l=ad(c,d);b=T(b);b=bd(b);f=Z(e,f);Y([],[a],n=>{function t(){Tc(`Cannot call ${u} due to unbound types`,l)}n=n[0];var u=`${n.name}.${b}`;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);h&&n.wa.Dc.push(b);var r=n.wa.Ta,x=r[b];void 0===x||void 0===x.Fa&&x.className!==n.name&&x.$a===c-2?(t.$a=c-2,t.className=n.name,r[b]=t):(Dc(r,b,u),r[b].Fa[c-2]=t);Y([],l,y=>{y=$c(u,y,n,f,g);void 0===r[b].Fa?(y.$a=c-2,r[b]=y):r[b].Fa[c-2]=y;return[]});return[]})},b:(a,b,c,d,e,f,g,h,l,n)=>{b=
|
|
472
|
+
T(b);e=Z(d,e);Y([],[a],t=>{t=t[0];var u=`${t.name}.${b}`,r={get(){Tc(`Cannot access ${u} due to unbound types`,[c,g])},enumerable:!0,configurable:!0};r.set=l?()=>Tc(`Cannot access ${u} due to unbound types`,[c,g]):()=>{throw new S(u+" is a read-only property");};Object.defineProperty(t.wa.Ta,b,r);Y([],l?[c,g]:[c],x=>{var y=x[0],p={get(){var J=cd(this,t,u+" getter");return y.Aa(e(f,J))},enumerable:!0};if(l){l=Z(h,l);var H=x[1];p.set=function(J){var v=cd(this,t,u+" setter"),N=[];l(n,v,H.Ea(N,J));sc(N)}}Object.defineProperty(t.wa.Ta,
|
|
473
|
+
b,p);return[]});return[]})},T:a=>X(a,ed),m:(a,b,c,d,e)=>{b=T(b);e=0===e?"object":1===e?"number":"string";switch(e){case "object":function g(){}g.values={};X(a,{name:b,constructor:g,valueType:e,Aa:function(h){return this.constructor.values[h]},Ea:(h,l)=>l.value,Na:fd(b,c,d),La:null});Ec(b,g);break;case "number":var f={};X(a,{name:b,$b:f,valueType:e,Aa:h=>h,Ea:(h,l)=>l,Na:fd(b,c,d),La:null});Ec(b,f);delete k[b].$a;break;case "string":f={},X(a,{name:b,Nc:{},Gc:{},$b:f,valueType:e,Aa:function(h){return this.Gc[h]},
|
|
474
|
+
Ea:function(h,l){return this.Nc[l]},Na:fd(b,c,d),La:null}),Ec(b,f),delete k[b].$a}},d:(a,b,c)=>{var d=nc(a,"enum");b=T(b);switch(d.valueType){case "object":a=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},constructor:{value:bc(`${d.name}_${b}`,function(){})}});a.values[c]=d;a[b]=d;break;case "number":d.$b[b]=c;break;case "string":d.Nc[b]=c,d.Gc[c]=b,d.$b[b]=b}},t:(a,b,c)=>{b=T(b);X(a,{name:b,Aa:d=>d,Ea:(d,e)=>e,Na:gd(b,c),La:null})},g:(a,b,c,d,e,f)=>{var g=ad(b,c);a=T(a);a=
|
|
475
|
+
bd(a);e=Z(d,e);Ec(a,function(){Tc(`Cannot call ${a} due to unbound types`,g)},b-1);Y([],g,h=>{Qc(a,$c(a,[h[0],null].concat(h.slice(1)),null,e,f),b-1);return[]})},l:(a,b,c,d,e)=>{b=T(b);let f=h=>h;if(0===d){var g=32-8*c;f=h=>h<<g>>>g;e=f(e)}X(a,{name:b,Aa:f,Ea:(h,l)=>l,Na:yc(b,c,0!==d),La:null})},i:(a,b,c)=>{function d(f){return new e(w.buffer,M[f+4>>2],M[f>>2])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][b];c=T(c);
|
|
476
|
+
X(a,{name:c,Aa:d,Na:d},{md:!0})},U:(a,b)=>{b=T(b);X(a,{name:b,Aa(c){var d=(d=c+4)?gb(E,d,M[c>>2],!0):"";lc(c);return d},Ea(c,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var e="string"==typeof d;if(!(e||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new S("Cannot pass non-string to std::string");var f=e?kb(d):d.length;var g=Jd(4+f+1),h=g+4;M[g>>2]=f;e?lb(d,E,h,f+1):E.set(d,h);null!==c&&c.push(lc,g);return g},Na:tc,La(c){lc(c)}})},p:(a,b,c)=>{c=T(c);if(2===b){var d=jd;var e=kd;var f=ld}else d=
|
|
477
|
+
md,e=nd,f=od;X(a,{name:c,Aa:g=>{var h=d(g+4,M[g>>2]*b,!0);lc(g);return h},Ea:(g,h)=>{if("string"!=typeof h)throw new S(`Cannot pass non-string to C++ string type ${c}`);var l=f(h),n=Jd(4+l+b);M[n>>2]=l/b;e(h,n+4,l+b);null!==g&&g.push(lc,n);return n},Na:tc,La(g){lc(g)}})},aa:(a,b,c,d,e,f)=>{rc[a]={name:T(b),bc:Z(c,d),Wa:Z(e,f),tc:[]}},$:(a,b,c,d,e,f,g,h,l,n)=>{rc[a].tc.push({ed:T(b),ld:c,jd:Z(d,e),kd:f,Cd:g,Bd:Z(h,l),Dd:n})},W:(a,b)=>{b=T(b);X(a,{sd:!0,name:b,Aa:()=>{},Ea:()=>{}})},A:()=>{Wa=!1;pd=
|
|
478
|
+
0},y:()=>{throw Infinity;},f:(a,b,c)=>{var [d,...e]=sd(a,b),f=d.Ea.bind(d),g=e.map(l=>l.Na.bind(l));a--;var h=Array(a);b=`methodCaller<(${e.map(l=>l.name)}) => ${d.name}>`;return rd(bc(b,(l,n,t,u)=>{for(var r=0,x=0;x<a;++x)h[x]=g[x](u+r),r+=8;switch(c){case 0:var y=ec(l).apply(null,h);break;case 2:y=Reflect.construct(ec(l),h);break;case 3:y=h[0];break;case 1:y=ec(l)[ud(n)](...h)}l=[];y=f(l,y);l.length&&(M[t>>2]=fc(l));return y}))},ca:dd,X:a=>{a=ud(a);return fc(k[a])},Y:(a,b)=>{a=ec(a);b=ec(b);return fc(a[b])},
|
|
479
|
+
v:a=>{9<a&&(dc[a+1]+=1)},e:(a,b,c,d,e)=>qd[a](b,c,d,e),Z:()=>fc([]),ba:a=>fc(ud(a)),da:()=>fc({}),w:a=>{var b=ec(a);sc(b);dd(a)},h:(a,b,c)=>{a=ec(a);b=ec(b);c=ec(c);a[b]=c},D:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);F[b>>2]=a.getUTCSeconds();F[b+4>>2]=a.getUTCMinutes();F[b+8>>2]=a.getUTCHours();F[b+12>>2]=a.getUTCDate();F[b+16>>2]=a.getUTCMonth();F[b+20>>2]=a.getUTCFullYear()-1900;F[b+24>>2]=a.getUTCDay();F[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),
|
|
480
|
+
0,1,0,0,0,0))/864E5|0},E:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);F[b>>2]=a.getSeconds();F[b+4>>2]=a.getMinutes();F[b+8>>2]=a.getHours();F[b+12>>2]=a.getDate();F[b+16>>2]=a.getMonth();F[b+20>>2]=a.getFullYear()-1900;F[b+24>>2]=a.getDay();var c=a.getFullYear();F[b+28>>2]=(0!==c%4||0===c%100&&0!==c%400?wd:vd)[a.getMonth()]+a.getDate()-1|0;F[b+36>>2]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),
|
|
481
|
+
0,1)).getTimezoneOffset();F[b+32>>2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},B:(a,b)=>{xd[a]&&(clearTimeout(xd[a].id),delete xd[a]);if(!b)return 0;var c=setTimeout(()=>{delete xd[a];Ad(()=>Kd(a,performance.now()))},b);xd[a]={id:c,be:b};return 0},F:(a,b,c,d)=>{var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();M[a>>2]=60*Math.max(f,e);F[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,
|
|
482
|
+
"0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(lb(a,E,c,17),lb(b,E,d,17)):(lb(a,E,d,17),lb(b,E,c,17))},O:function(a,b,c){if(!(0<=a&&3>=a))return 28;Ga[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},j:(a,b,c)=>{Bd.length=0;for(var d;d=E[b++];){var e=105!=d;e&=112!=d;c+=e&&c%8?4:0;Bd.push(112==d?M[c>>2]:106==d?Ga[c>>3]:105==d?F[c>>2]:Fa[c>>3]);c+=e?8:4}return Id[a](...Bd)},N:()=>Date.now(),Q:()=>performance.now(),C:a=>{var b=E.length;a>>>=0;if(2147483648<a)return!1;
|
|
483
|
+
for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(a,d)/65536))-Ka.buffer.byteLength+65535)/65536|0;try{Ka.grow(d);Ja();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},H:(a,b)=>{var c=0,d=0,e;for(e of Ed()){var f=b+c;M[a+d>>2]=f;c+=lb(e,E,f,Infinity)+1;d+=4}return 0},I:(a,b)=>{var c=Ed();M[a>>2]=c.length;a=0;for(var d of c)a+=kb(d)+1;M[b>>2]=a;return 0},r:function(a){try{var b=Lb(a);if(null===b.fb)throw new P(8);b.Yb&&(b.Yb=
|
|
484
|
+
null);try{b.xa.close&&b.xa.close(b)}catch(c){throw c;}finally{Ab[b.fb]=null}b.fb=null;return 0}catch(c){if("undefined"==typeof ac||"ErrnoError"!==c.name)throw c;return c.eb}},K:function(a,b,c,d){try{a:{var e=Lb(a);a=b;for(var f,g=b=0;g<c;g++){var h=M[a>>2],l=M[a+4>>2];a+=8;var n=e,t=h,u=l,r=f,x=w;if(0>u||0>r)throw new P(28);if(null===n.fb)throw new P(8);if(1===(n.flags&2097155))throw new P(8);if(16384===(n.node.mode&61440))throw new P(31);if(!n.xa.read)throw new P(28);var y="undefined"!=typeof r;
|
|
485
|
+
if(!y)r=n.position;else if(!n.seekable)throw new P(70);var p=n.xa.read(n,x,t,u,r);y||(n.position+=p);var H=p;if(0>H){var J=-1;break a}b+=H;if(H<l)break;"undefined"!=typeof f&&(f+=H)}J=b}M[d>>2]=J;return 0}catch(v){if("undefined"==typeof ac||"ErrnoError"!==v.name)throw v;return v.eb}},G:function(a,b,c,d){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b);try{if(isNaN(b))return 61;var e=Lb(a);Zb(e,b,c);Ga[d>>3]=BigInt(e.position);e.Yb&&0===b&&0===c&&(e.Yb=null);return 0}catch(f){if("undefined"==
|
|
486
|
+
typeof ac||"ErrnoError"!==f.name)throw f;return f.eb}},J:function(a,b,c,d){try{a:{var e=Lb(a);a=b;for(var f,g=b=0;g<c;g++){var h=M[a>>2],l=M[a+4>>2];a+=8;var n=e,t=h,u=l,r=f,x=w;if(0>u||0>r)throw new P(28);if(null===n.fb)throw new P(8);if(0===(n.flags&2097155))throw new P(8);if(16384===(n.node.mode&61440))throw new P(31);if(!n.xa.write)throw new P(28);n.seekable&&n.flags&1024&&Zb(n,0,2);var y="undefined"!=typeof r;if(!y)r=n.position;else if(!n.seekable)throw new P(70);var p=n.xa.write(n,x,t,u,r,void 0);
|
|
487
|
+
y||(n.position+=p);var H=p;if(0>H){var J=-1;break a}b+=H;if(H<l)break;"undefined"!=typeof f&&(f+=H)}J=b}M[d>>2]=J;return 0}catch(v){if("undefined"==typeof ac||"ErrnoError"!==v.name)throw v;return v.eb}},x:Od,R:function(){return-1<navigator.platform.indexOf("Win")},z:zd,S:function(a,b,c){b=new Uint8Array(Ka.buffer,b,c);c=new Uint8Array(c);c.set(b);createImageBitmap(new Blob([c])).then(function(d){var e=(new OffscreenCanvas(d.width,d.height)).getContext("2d");e.drawImage(d,0,0);e=e.getImageData(0,0,
|
|
488
|
+
d.width,d.height);var f=e.data.length,g=k.Uc(f);k.Hd.set(e.data,g);k.Jd(a,d.width,d.height,g,f)}).catch(function(d){d=d.message||"decode failed";var e=k.Yd(d)+1,f=k.Uc(e);k.ae(d,f,e);k.Kd(a,f);k.Id(f)})}};function Od(a,b,c){var d=Nd();try{Rc.get(a)(b,c)}catch(e){Md(d);if(e!==e+0)throw e;Ld(1,0)}}var Qd;
|
|
489
|
+
Qd=await (async function(){function a(c){c=Qd=c.exports;lc=c.ga;Jd=c.ha;kc=c.ia;k._wasm_image_decode_complete=c.ja;k._wasm_image_decode_error=c.ka;Fd=k._ma_device__on_notification_unlocked=c.la;k._ma_malloc_emscripten=c.ma;k._ma_free_emscripten=c.na;Gd=k._ma_device_process_pcm_frames_capture__webaudio=c.oa;Hd=k._ma_device_process_pcm_frames_playback__webaudio=c.pa;Kd=c.ra;Ld=c.sa;Md=c.ta;Nd=c.ua;Ka=c.ea;Rc=c.qa;Ja();return Qd}var b={a:Pd};if(k.instantiateWasm)return new Promise(c=>{k.instantiateWasm(b,
|
|
490
|
+
(d,e)=>{c(a(d,e))})});Ma??=k.locateFile?k.locateFile("canvas_advanced.wasm",ma):ma+"canvas_advanced.wasm";return a((await Qa(b)).instance)}());
|
|
491
|
+
(function(){function a(){k.calledRun=!0;if(!wa){Ia=!0;if(!k.noFSInit&&!Cb){var b,c;Cb=!0;b??=k.stdin;c??=k.stdout;d??=k.stderr;b?$b("stdin",b):Xb("/dev/tty","/dev/stdin");c?$b("stdout",null,c):Xb("/dev/tty","/dev/stdout");d?$b("stderr",null,d):Xb("/dev/tty1","/dev/stderr");Yb("/dev/stdin",0);Yb("/dev/stdout",1);Yb("/dev/stderr",1)}Qd.fa();Db=!1;ya?.(k);k.onRuntimeInitialized?.();if(k.postRun)for("function"==typeof k.postRun&&(k.postRun=[k.postRun]);k.postRun.length;){var d=k.postRun.shift();Ta.push(d)}Sa(Ta)}}
|
|
492
|
+
if(k.preRun)for("function"==typeof k.preRun&&(k.preRun=[k.preRun]);k.preRun.length;)Va();Sa(Ua);k.setStatus?(k.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>k.setStatus(""),1);a()},1)):a()})();Ia?moduleRtn=k:moduleRtn=new Promise((a,b)=>{ya=a;za=b});
|
|
491
493
|
;return moduleRtn}})();
|
|
492
494
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
|
|
493
495
|
|
|
@@ -496,7 +498,7 @@ if(k.preRun)for("function"==typeof k.preRun&&(k.preRun=[k.preRun]);k.preRun.leng
|
|
|
496
498
|
/* 5 */
|
|
497
499
|
/***/ ((module) => {
|
|
498
500
|
|
|
499
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.
|
|
501
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.42.0","description":"Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
500
502
|
|
|
501
503
|
/***/ }),
|
|
502
504
|
/* 6 */
|
|
@@ -3039,14 +3041,26 @@ var __extends = (undefined && undefined.__extends) || (function () {
|
|
|
3039
3041
|
};
|
|
3040
3042
|
})();
|
|
3041
3043
|
var FileFinalizer = /** @class */ (function () {
|
|
3042
|
-
function FileFinalizer(file) {
|
|
3044
|
+
function FileFinalizer(file, session) {
|
|
3045
|
+
if (session === void 0) { session = null; }
|
|
3043
3046
|
this.selfUnref = false;
|
|
3044
3047
|
this._file = file;
|
|
3048
|
+
this._session = session;
|
|
3045
3049
|
}
|
|
3046
3050
|
FileFinalizer.prototype.unref = function () {
|
|
3047
3051
|
if (this._file) {
|
|
3048
3052
|
this._file.unref();
|
|
3049
3053
|
}
|
|
3054
|
+
// After the file, never before: the file's resources belong to the session.
|
|
3055
|
+
if (this._session) {
|
|
3056
|
+
this._session.delete();
|
|
3057
|
+
this._session = null;
|
|
3058
|
+
}
|
|
3059
|
+
};
|
|
3060
|
+
// Disarms the GC path for a file cleanup() already released.
|
|
3061
|
+
FileFinalizer.prototype.release = function () {
|
|
3062
|
+
this._file = null;
|
|
3063
|
+
this._session = null;
|
|
3050
3064
|
};
|
|
3051
3065
|
return FileFinalizer;
|
|
3052
3066
|
}());
|
|
@@ -3130,8 +3144,10 @@ var FontWrapper = /** @class */ (function (_super) {
|
|
|
3130
3144
|
return FontWrapper;
|
|
3131
3145
|
}(AssetWrapper));
|
|
3132
3146
|
var CustomFileAssetLoaderWrapper = /** @class */ (function () {
|
|
3133
|
-
function CustomFileAssetLoaderWrapper(runtime, loaderCallback) {
|
|
3147
|
+
function CustomFileAssetLoaderWrapper(runtime, loaderCallback, session) {
|
|
3148
|
+
if (session === void 0) { session = null; }
|
|
3134
3149
|
this._assetLoaderCallback = loaderCallback;
|
|
3150
|
+
this._session = session;
|
|
3135
3151
|
this.assetLoader = new runtime.CustomFileAssetLoader({
|
|
3136
3152
|
loadContents: this.loadContents.bind(this),
|
|
3137
3153
|
});
|
|
@@ -3139,13 +3155,13 @@ var CustomFileAssetLoaderWrapper = /** @class */ (function () {
|
|
|
3139
3155
|
CustomFileAssetLoaderWrapper.prototype.loadContents = function (asset, bytes) {
|
|
3140
3156
|
var assetWrapper;
|
|
3141
3157
|
if (asset.isImage) {
|
|
3142
|
-
assetWrapper = new ImageAssetWrapper(asset);
|
|
3158
|
+
assetWrapper = new ImageAssetWrapper(asset, this._session);
|
|
3143
3159
|
}
|
|
3144
3160
|
else if (asset.isAudio) {
|
|
3145
|
-
assetWrapper = new AudioAssetWrapper(asset);
|
|
3161
|
+
assetWrapper = new AudioAssetWrapper(asset, this._session);
|
|
3146
3162
|
}
|
|
3147
3163
|
else if (asset.isFont) {
|
|
3148
|
-
assetWrapper = new FontAssetWrapper(asset);
|
|
3164
|
+
assetWrapper = new FontAssetWrapper(asset, this._session);
|
|
3149
3165
|
}
|
|
3150
3166
|
else {
|
|
3151
3167
|
return false;
|
|
@@ -3159,11 +3175,15 @@ var CustomFileAssetLoaderWrapper = /** @class */ (function () {
|
|
|
3159
3175
|
* an asset associated wtih the Rive File
|
|
3160
3176
|
*/
|
|
3161
3177
|
var FileAssetWrapper = /** @class */ (function () {
|
|
3162
|
-
function FileAssetWrapper(nativeAsset) {
|
|
3178
|
+
function FileAssetWrapper(nativeAsset, session) {
|
|
3179
|
+
if (session === void 0) { session = null; }
|
|
3163
3180
|
this._nativeFileAsset = nativeAsset;
|
|
3181
|
+
this._session = session;
|
|
3164
3182
|
}
|
|
3165
3183
|
FileAssetWrapper.prototype.decode = function (bytes) {
|
|
3166
|
-
|
|
3184
|
+
// The session travels with the asset so a deferred file's assets are
|
|
3185
|
+
// session-typed without the caller needing to know the file's rendering mode.
|
|
3186
|
+
this._nativeFileAsset.decode(bytes, this._session);
|
|
3167
3187
|
};
|
|
3168
3188
|
Object.defineProperty(FileAssetWrapper.prototype, "name", {
|
|
3169
3189
|
get: function () {
|
|
@@ -4799,8 +4819,23 @@ var RiveFile = /** @class */ (function () {
|
|
|
4799
4819
|
this.destroyed = false;
|
|
4800
4820
|
this.selfUnref = false;
|
|
4801
4821
|
this.bindableArtboards = [];
|
|
4822
|
+
// Deferred rendering was requested; the session may still be null if this
|
|
4823
|
+
// build has no deferred support.
|
|
4824
|
+
this.deferred = false;
|
|
4825
|
+
// The session this file imported through, null when immediate. Owned here:
|
|
4826
|
+
// it has to outlive the file, so it is deleted after the file is released.
|
|
4827
|
+
this.session = null;
|
|
4828
|
+
// Attaching is once per session: a detached session can never replay again,
|
|
4829
|
+
// so a claimed file re-imports for the next instance implicitly. Mirrors the native
|
|
4830
|
+
// latch (WebGL2DeferredSession::everBound, C2DDeferredSession::claim).
|
|
4831
|
+
this._sessionClaimed = false;
|
|
4832
|
+
// Releasing this file has to be deterministic once a session owns its
|
|
4833
|
+
// resources, so the finalizer is disarmed rather than left to GC.
|
|
4834
|
+
this.fileFinalizer = null;
|
|
4835
|
+
this.boundElsewhereWarned = false;
|
|
4802
4836
|
this.src = params.src;
|
|
4803
4837
|
this.buffer = params.buffer;
|
|
4838
|
+
this.deferred = !!params.enableGPUCanvas;
|
|
4804
4839
|
if (params.assetLoader)
|
|
4805
4840
|
this.assetLoader = params.assetLoader;
|
|
4806
4841
|
this.enableRiveAssetCDN =
|
|
@@ -4818,12 +4853,24 @@ var RiveFile = /** @class */ (function () {
|
|
|
4818
4853
|
this.on(EventType.LoadError, params.onLoadError);
|
|
4819
4854
|
}
|
|
4820
4855
|
RiveFile.prototype.releaseFile = function () {
|
|
4821
|
-
var _a;
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4856
|
+
var _a, _b;
|
|
4857
|
+
// Release here rather than leaving it to the finalization registry. The
|
|
4858
|
+
// native file frees GL-backed resources when its last reference goes, and
|
|
4859
|
+
// callers reach this with the renderer's context current; a finalizer runs
|
|
4860
|
+
// with none, so those deletes would silently do nothing.
|
|
4861
|
+
(_a = this.fileFinalizer) === null || _a === void 0 ? void 0 : _a.release();
|
|
4862
|
+
(_b = this.file) === null || _b === void 0 ? void 0 : _b.unref();
|
|
4863
|
+
this.fileFinalizer = null;
|
|
4825
4864
|
this.file = null;
|
|
4826
4865
|
};
|
|
4866
|
+
RiveFile.prototype.releaseSession = function () {
|
|
4867
|
+
var _a;
|
|
4868
|
+
// Known limitation: cleanup() on a file an instance is still drawing
|
|
4869
|
+
// deletes the session under it. A RiveFile's creator holds no reference of
|
|
4870
|
+
// its own, so their cleanup() can take the count to zero.
|
|
4871
|
+
(_a = this.session) === null || _a === void 0 ? void 0 : _a.delete();
|
|
4872
|
+
this.session = null;
|
|
4873
|
+
};
|
|
4827
4874
|
RiveFile.prototype.releaseBindableArtboards = function () {
|
|
4828
4875
|
this.bindableArtboards.forEach(function (bindableArtboard) {
|
|
4829
4876
|
return bindableArtboard.destroy();
|
|
@@ -4831,7 +4878,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
4831
4878
|
};
|
|
4832
4879
|
RiveFile.prototype.initData = function () {
|
|
4833
4880
|
return __awaiter(this, void 0, void 0, function () {
|
|
4834
|
-
var _a, error_1, loader, loaderWrapper, _b, fileFinalizer;
|
|
4881
|
+
var _a, error_1, loader, loaderWrapper, _b, error_2, fileFinalizer;
|
|
4835
4882
|
return __generator(this, function (_c) {
|
|
4836
4883
|
switch (_c.label) {
|
|
4837
4884
|
case 0:
|
|
@@ -4854,36 +4901,55 @@ var RiveFile = /** @class */ (function () {
|
|
|
4854
4901
|
if (this.destroyed) {
|
|
4855
4902
|
return [2 /*return*/];
|
|
4856
4903
|
}
|
|
4904
|
+
if (this.deferred && this.session === null) {
|
|
4905
|
+
this.session = RiveFile.makeDeferredSession(this.runtime);
|
|
4906
|
+
}
|
|
4857
4907
|
if (this.assetLoader) {
|
|
4858
|
-
loaderWrapper = new _utils__WEBPACK_IMPORTED_MODULE_3__.CustomFileAssetLoaderWrapper(this.runtime, this.assetLoader);
|
|
4908
|
+
loaderWrapper = new _utils__WEBPACK_IMPORTED_MODULE_3__.CustomFileAssetLoaderWrapper(this.runtime, this.assetLoader, this.session);
|
|
4859
4909
|
loader = loaderWrapper.assetLoader;
|
|
4860
4910
|
}
|
|
4861
4911
|
// Load the Rive file
|
|
4862
4912
|
if (this.enablePerfMarks)
|
|
4863
4913
|
performance.mark('rive:file-load:start');
|
|
4864
|
-
|
|
4865
|
-
return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN)];
|
|
4914
|
+
_c.label = 5;
|
|
4866
4915
|
case 5:
|
|
4916
|
+
_c.trys.push([5, 7, , 8]);
|
|
4917
|
+
_b = this;
|
|
4918
|
+
return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN, this.session)];
|
|
4919
|
+
case 6:
|
|
4867
4920
|
_b.file = _c.sent();
|
|
4921
|
+
return [3 /*break*/, 8];
|
|
4922
|
+
case 7:
|
|
4923
|
+
error_2 = _c.sent();
|
|
4924
|
+
// The finalizer that would reclaim the session is only registered once
|
|
4925
|
+
// the import succeeds, so a failed load has to release it here.
|
|
4926
|
+
this.releaseSession();
|
|
4927
|
+
throw error_2;
|
|
4928
|
+
case 8:
|
|
4868
4929
|
if (this.enablePerfMarks) {
|
|
4869
4930
|
performance.mark('rive:file-load:end');
|
|
4870
4931
|
performance.measure('rive:file-load', 'rive:file-load:start', 'rive:file-load:end');
|
|
4871
4932
|
}
|
|
4872
|
-
fileFinalizer = new _utils__WEBPACK_IMPORTED_MODULE_3__.FileFinalizer(this.file);
|
|
4873
|
-
_utils__WEBPACK_IMPORTED_MODULE_3__.finalizationRegistry.register(this, fileFinalizer);
|
|
4874
4933
|
if (this.destroyed) {
|
|
4875
4934
|
this.releaseFile();
|
|
4935
|
+
this.releaseSession();
|
|
4876
4936
|
return [2 /*return*/];
|
|
4877
4937
|
}
|
|
4878
|
-
if (this.file
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
}
|
|
4884
|
-
else {
|
|
4938
|
+
if (this.file === null) {
|
|
4939
|
+
// A malformed file resolves to null rather than rejecting. Release the
|
|
4940
|
+
// session now: a finalizer for a file that does not exist would keep it
|
|
4941
|
+
// alive until GC, or for as long as the caller holds the failed RiveFile.
|
|
4942
|
+
this.releaseSession();
|
|
4885
4943
|
this.fireLoadError(RiveFile.fileLoadErrorMessage);
|
|
4944
|
+
return [2 /*return*/];
|
|
4886
4945
|
}
|
|
4946
|
+
fileFinalizer = new _utils__WEBPACK_IMPORTED_MODULE_3__.FileFinalizer(this.file, this.session);
|
|
4947
|
+
this.fileFinalizer = fileFinalizer;
|
|
4948
|
+
_utils__WEBPACK_IMPORTED_MODULE_3__.finalizationRegistry.register(this, fileFinalizer);
|
|
4949
|
+
this.eventManager.fire({
|
|
4950
|
+
type: EventType.Load,
|
|
4951
|
+
data: this,
|
|
4952
|
+
});
|
|
4887
4953
|
return [2 /*return*/];
|
|
4888
4954
|
}
|
|
4889
4955
|
});
|
|
@@ -4927,7 +4993,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
4927
4993
|
};
|
|
4928
4994
|
RiveFile.prototype.init = function () {
|
|
4929
4995
|
return __awaiter(this, void 0, void 0, function () {
|
|
4930
|
-
var _a, bufferResolved, runtimeResolved,
|
|
4996
|
+
var _a, bufferResolved, runtimeResolved, error_3;
|
|
4931
4997
|
return __generator(this, function (_b) {
|
|
4932
4998
|
switch (_b.label) {
|
|
4933
4999
|
case 0:
|
|
@@ -4959,8 +5025,8 @@ var RiveFile = /** @class */ (function () {
|
|
|
4959
5025
|
}
|
|
4960
5026
|
return [3 /*break*/, 5];
|
|
4961
5027
|
case 4:
|
|
4962
|
-
|
|
4963
|
-
this.fireLoadError(
|
|
5028
|
+
error_3 = _b.sent();
|
|
5029
|
+
this.fireLoadError(error_3 instanceof Error ? error_3.message : RiveFile.fileLoadErrorMessage);
|
|
4964
5030
|
return [3 /*break*/, 5];
|
|
4965
5031
|
case 5: return [2 /*return*/];
|
|
4966
5032
|
}
|
|
@@ -5002,9 +5068,99 @@ var RiveFile = /** @class */ (function () {
|
|
|
5002
5068
|
this.removeAllRiveEventListeners();
|
|
5003
5069
|
this.releaseFile();
|
|
5004
5070
|
this.releaseBindableArtboards();
|
|
5071
|
+
// Everything imported through the session is gone; the session can go.
|
|
5072
|
+
this.releaseSession();
|
|
5005
5073
|
this.destroyed = true;
|
|
5006
5074
|
}
|
|
5007
5075
|
};
|
|
5076
|
+
// Deferred is only compiled into some runtime builds, so feature detect it
|
|
5077
|
+
// and degrade to an immediate import rather than failing the load.
|
|
5078
|
+
RiveFile.makeDeferredSession = function (runtime) {
|
|
5079
|
+
var _a, _b;
|
|
5080
|
+
var session = (_b = (_a = runtime.makeDeferredSession) === null || _a === void 0 ? void 0 : _a.call(runtime)) !== null && _b !== void 0 ? _b : null;
|
|
5081
|
+
if (session === null && !RiveFile.deferredUnsupportedWarned) {
|
|
5082
|
+
RiveFile.deferredUnsupportedWarned = true;
|
|
5083
|
+
console.warn("Rive: `enableGPUCanvas: true` was ignored because this runtime build has no GPU Canvas support; importing in immediate mode. Use a @rive-app/webgl2 or @rive-app/canvas build with deferred rendering compiled in.");
|
|
5084
|
+
}
|
|
5085
|
+
return session;
|
|
5086
|
+
};
|
|
5087
|
+
Object.defineProperty(RiveFile.prototype, "deferredSession", {
|
|
5088
|
+
/**
|
|
5089
|
+
* @internal The deferred session this file imported through, or null if it
|
|
5090
|
+
* was imported in immediate mode.
|
|
5091
|
+
*/
|
|
5092
|
+
get: function () {
|
|
5093
|
+
return this.session;
|
|
5094
|
+
},
|
|
5095
|
+
enumerable: false,
|
|
5096
|
+
configurable: true
|
|
5097
|
+
});
|
|
5098
|
+
Object.defineProperty(RiveFile.prototype, "deferredRequested", {
|
|
5099
|
+
/**
|
|
5100
|
+
* @internal Whether deferred was asked for, even when this build could not
|
|
5101
|
+
* honor it and imported immediate.
|
|
5102
|
+
*/
|
|
5103
|
+
get: function () {
|
|
5104
|
+
return this.deferred;
|
|
5105
|
+
},
|
|
5106
|
+
enumerable: false,
|
|
5107
|
+
configurable: true
|
|
5108
|
+
});
|
|
5109
|
+
Object.defineProperty(RiveFile.prototype, "sessionClaimed", {
|
|
5110
|
+
/**
|
|
5111
|
+
* @internal Whether this file's session has ever been attached to a renderer.
|
|
5112
|
+
* Attaching is once per session, so a claimed file re-imports for the next
|
|
5113
|
+
* instance even after the renderer it was bound to is gone.
|
|
5114
|
+
*/
|
|
5115
|
+
get: function () {
|
|
5116
|
+
return this._sessionClaimed;
|
|
5117
|
+
},
|
|
5118
|
+
enumerable: false,
|
|
5119
|
+
configurable: true
|
|
5120
|
+
});
|
|
5121
|
+
/**
|
|
5122
|
+
* @internal Marks this file's session as spent. There is no matching release:
|
|
5123
|
+
* a session that has been attached can never replay for another renderer.
|
|
5124
|
+
*/
|
|
5125
|
+
RiveFile.prototype.claimSession = function () {
|
|
5126
|
+
this._sessionClaimed = true;
|
|
5127
|
+
};
|
|
5128
|
+
/**
|
|
5129
|
+
* @internal One warning per file however many instances collide on it.
|
|
5130
|
+
*/
|
|
5131
|
+
RiveFile.prototype.warnBoundElsewhereOnce = function () {
|
|
5132
|
+
if (this.boundElsewhereWarned) {
|
|
5133
|
+
return;
|
|
5134
|
+
}
|
|
5135
|
+
this.boundElsewhereWarned = true;
|
|
5136
|
+
console.warn("Rive: this deferred RiveFile is already bound to another Rive instance's canvas, and a deferred session cannot span canvases. Re-importing the file for this instance (an extra parse of the retained buffer, no extra network request).");
|
|
5137
|
+
};
|
|
5138
|
+
/**
|
|
5139
|
+
* @internal Re-imports this file from its retained buffer into a mode of its
|
|
5140
|
+
* own. The copy is owned by whoever asked for it and never joins this file's
|
|
5141
|
+
* reference count.
|
|
5142
|
+
*/
|
|
5143
|
+
RiveFile.prototype.reimport = function (deferred) {
|
|
5144
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5145
|
+
var copy;
|
|
5146
|
+
return __generator(this, function (_a) {
|
|
5147
|
+
switch (_a.label) {
|
|
5148
|
+
case 0:
|
|
5149
|
+
copy = new RiveFile({
|
|
5150
|
+
buffer: this.buffer,
|
|
5151
|
+
assetLoader: this.assetLoader,
|
|
5152
|
+
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
5153
|
+
enablePerfMarks: this.enablePerfMarks,
|
|
5154
|
+
enableGPUCanvas: deferred,
|
|
5155
|
+
});
|
|
5156
|
+
return [4 /*yield*/, copy.init()];
|
|
5157
|
+
case 1:
|
|
5158
|
+
_a.sent();
|
|
5159
|
+
return [2 /*return*/, copy];
|
|
5160
|
+
}
|
|
5161
|
+
});
|
|
5162
|
+
});
|
|
5163
|
+
};
|
|
5008
5164
|
/**
|
|
5009
5165
|
* Unsubscribes all Rive listeners from an event type, or everything if no type is
|
|
5010
5166
|
* given
|
|
@@ -5075,6 +5231,8 @@ var RiveFile = /** @class */ (function () {
|
|
|
5075
5231
|
RiveFile.missingErrorMessage = "Rive source file or data buffer required";
|
|
5076
5232
|
// Error message for file load error
|
|
5077
5233
|
RiveFile.fileLoadErrorMessage = "The file failed to load";
|
|
5234
|
+
// Deferred support is per build, so the warning is per page, not per file.
|
|
5235
|
+
RiveFile.deferredUnsupportedWarned = false;
|
|
5078
5236
|
return RiveFile;
|
|
5079
5237
|
}());
|
|
5080
5238
|
|
|
@@ -5096,6 +5254,13 @@ var Rive = /** @class */ (function () {
|
|
|
5096
5254
|
* and start.
|
|
5097
5255
|
*/
|
|
5098
5256
|
this.readyForPlaying = false;
|
|
5257
|
+
// Deferred rendering was requested for this instance. The file it renders
|
|
5258
|
+
// has the final say, since a file's mode is fixed at import.
|
|
5259
|
+
this.deferredRenderer = false;
|
|
5260
|
+
// Whether this instance imported the file in `riveFile` (true) or the caller
|
|
5261
|
+
// supplied it (false). Only a file we imported may be released without a
|
|
5262
|
+
// matching getInstance(): a caller's file is theirs however this init ends.
|
|
5263
|
+
this.ownsRiveFile = false;
|
|
5099
5264
|
// Runtime artboard
|
|
5100
5265
|
this.artboard = null;
|
|
5101
5266
|
// place to clear up pointer/touch event listeners
|
|
@@ -5230,6 +5395,7 @@ var Rive = /** @class */ (function () {
|
|
|
5230
5395
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.enablePerfMarks = true;
|
|
5231
5396
|
this._focusOptions = (_c = params.focusOptions) !== null && _c !== void 0 ? _c : this._focusOptions;
|
|
5232
5397
|
this._tabIndex = (_d = params.tabIndex) !== null && _d !== void 0 ? _d : null;
|
|
5398
|
+
this.deferredRenderer = !!params.enableGPUCanvas;
|
|
5233
5399
|
// New event management system
|
|
5234
5400
|
this.eventManager = new EventManager();
|
|
5235
5401
|
if (params.onLoad)
|
|
@@ -5286,6 +5452,7 @@ var Rive = /** @class */ (function () {
|
|
|
5286
5452
|
tabIndex: params.tabIndex,
|
|
5287
5453
|
semanticsMode: params.semanticsMode,
|
|
5288
5454
|
semanticsOptions: params.semanticsOptions,
|
|
5455
|
+
enableGPUCanvas: this.deferredRenderer,
|
|
5289
5456
|
});
|
|
5290
5457
|
}
|
|
5291
5458
|
Object.defineProperty(Rive.prototype, "viewModelCount", {
|
|
@@ -5345,26 +5512,52 @@ var Rive = /** @class */ (function () {
|
|
|
5345
5512
|
// Initializes the Rive object either from constructor or load()
|
|
5346
5513
|
Rive.prototype.init = function (_a) {
|
|
5347
5514
|
var _this = this;
|
|
5348
|
-
var
|
|
5515
|
+
var _b, _c, _d, _e, _f;
|
|
5516
|
+
var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, stateMachine = _a.stateMachine, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _g = _a.autoplay, autoplay = _g === void 0 ? false : _g, _h = _a.useOffscreenRenderer, useOffscreenRenderer = _h === void 0 ? false : _h, _j = _a.autoBind, autoBind = _j === void 0 ? false : _j, tabIndex = _a.tabIndex, semanticsMode = _a.semanticsMode, semanticsOptions = _a.semanticsOptions, enableGPUCanvas = _a.enableGPUCanvas;
|
|
5349
5517
|
if (this.destroyed) {
|
|
5350
5518
|
return;
|
|
5351
5519
|
}
|
|
5520
|
+
// Validated before any state changes, so a call with no source leaves a
|
|
5521
|
+
// running instance untouched.
|
|
5522
|
+
if (!src && !buffer && !riveFile) {
|
|
5523
|
+
throw new RiveError(Rive.missingErrorMessage);
|
|
5524
|
+
}
|
|
5525
|
+
// Reload releases the outgoing file in the same order cleanup() uses:
|
|
5526
|
+
// artboard, then the renderer's session, then the file. The artboard goes
|
|
5527
|
+
// first because it holds an rcp<File> and its resources came from the
|
|
5528
|
+
// session about to be released. stop() has already deleted the animation
|
|
5529
|
+
// and state machine instances; reload deliberately skips cleanupInstances(),
|
|
5530
|
+
// which would also drop the event listeners load() keeps in place.
|
|
5531
|
+
if (this.artboard) {
|
|
5532
|
+
// Free GPU-backed resources with their own context current. No-op on
|
|
5533
|
+
// the canvas2d build.
|
|
5534
|
+
(_c = (_b = this.renderer) === null || _b === void 0 ? void 0 : _b.bindContext) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
5535
|
+
(_d = this.animator) === null || _d === void 0 ? void 0 : _d.stop();
|
|
5536
|
+
this.artboard.delete();
|
|
5537
|
+
this.artboard = null;
|
|
5538
|
+
}
|
|
5539
|
+
// Detach before the session is deleted: the handle dies with it.
|
|
5540
|
+
if (this.renderer) {
|
|
5541
|
+
(_f = (_e = this.renderer).detachSession) === null || _f === void 0 ? void 0 : _f.call(_e);
|
|
5542
|
+
}
|
|
5543
|
+
this.releaseCurrentRiveFile(/* isTeardown */ false);
|
|
5352
5544
|
this.src = src;
|
|
5353
5545
|
this.buffer = buffer;
|
|
5354
5546
|
this.riveFile = riveFile;
|
|
5547
|
+
// initData flips this if it ends up importing the file itself.
|
|
5548
|
+
this.ownsRiveFile = false;
|
|
5549
|
+
// Sticky across reloads so a constructor-set flag survives; an explicit
|
|
5550
|
+
// `false` still turns it off.
|
|
5551
|
+
this.deferredRenderer = enableGPUCanvas !== null && enableGPUCanvas !== void 0 ? enableGPUCanvas : this.deferredRenderer;
|
|
5355
5552
|
this._tabIndex = tabIndex !== null && tabIndex !== void 0 ? tabIndex : null;
|
|
5356
5553
|
this.semanticsMode = semanticsMode !== null && semanticsMode !== void 0 ? semanticsMode : _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticMode.Disabled;
|
|
5357
5554
|
this.semanticsOptions = semanticsOptions !== null && semanticsOptions !== void 0 ? semanticsOptions : this.semanticsOptions;
|
|
5358
|
-
// If no source file url specified, it's a bust
|
|
5359
|
-
if (!this.src && !this.buffer && !this.riveFile) {
|
|
5360
|
-
throw new RiveError(Rive.missingErrorMessage);
|
|
5361
|
-
}
|
|
5362
5555
|
// Names of the animations and state machines that should be initialized
|
|
5363
|
-
var
|
|
5556
|
+
var _k = resolveStartingPlayback({
|
|
5364
5557
|
stateMachine: stateMachine,
|
|
5365
5558
|
animations: animations,
|
|
5366
5559
|
stateMachines: stateMachines,
|
|
5367
|
-
}), startingAnimationNames =
|
|
5560
|
+
}), startingAnimationNames = _k.startingAnimationNames, startingStateMachineNames = _k.startingStateMachineNames;
|
|
5368
5561
|
// Ensure loaded is marked as false if loading new file
|
|
5369
5562
|
this.loaded = false;
|
|
5370
5563
|
this.readyForPlaying = false;
|
|
@@ -5384,6 +5577,8 @@ var Rive = /** @class */ (function () {
|
|
|
5384
5577
|
if (_this.enablePerfMarks)
|
|
5385
5578
|
performance.mark('rive:make-renderer:start');
|
|
5386
5579
|
try {
|
|
5580
|
+
// Always immediate at creation; a deferred file attaches its session
|
|
5581
|
+
// to this renderer once the file has loaded.
|
|
5387
5582
|
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
|
|
5388
5583
|
if (!_this.renderer) {
|
|
5389
5584
|
throw new Error("Renderer is null, cannot render Rive on the canvas.");
|
|
@@ -5536,32 +5731,52 @@ var Rive = /** @class */ (function () {
|
|
|
5536
5731
|
// Returns true for successful initialization.
|
|
5537
5732
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
5538
5733
|
return __awaiter(this, void 0, void 0, function () {
|
|
5539
|
-
var riveFile,
|
|
5540
|
-
var _a;
|
|
5541
|
-
return __generator(this, function (
|
|
5542
|
-
switch (
|
|
5734
|
+
var riveFile, error_4, msg;
|
|
5735
|
+
var _a, _b;
|
|
5736
|
+
return __generator(this, function (_c) {
|
|
5737
|
+
switch (_c.label) {
|
|
5543
5738
|
case 0:
|
|
5544
|
-
|
|
5545
|
-
|
|
5739
|
+
_c.trys.push([0, 5, , 6]);
|
|
5740
|
+
// A caller-supplied riveFile is theirs to release; one we import here is
|
|
5741
|
+
// ours, which matters if a deferred fallback replaces it below.
|
|
5742
|
+
this.ownsRiveFile = this.riveFile == null;
|
|
5743
|
+
if (!this.ownsRiveFile) return [3 /*break*/, 2];
|
|
5546
5744
|
riveFile = new RiveFile({
|
|
5547
5745
|
src: this.src,
|
|
5548
5746
|
buffer: this.buffer,
|
|
5549
5747
|
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
5550
5748
|
assetLoader: this.assetLoader,
|
|
5551
5749
|
enablePerfMarks: this.enablePerfMarks,
|
|
5750
|
+
// The instance owns this file, so its flag is the file's flag.
|
|
5751
|
+
enableGPUCanvas: this.deferredRenderer,
|
|
5552
5752
|
});
|
|
5553
5753
|
this.riveFile = riveFile;
|
|
5554
5754
|
return [4 /*yield*/, riveFile.init()];
|
|
5555
5755
|
case 1:
|
|
5556
|
-
|
|
5756
|
+
_c.sent();
|
|
5557
5757
|
if (this.destroyed) {
|
|
5558
5758
|
// In the very unlikely scenario where the rive file created by this Rive is shared by
|
|
5559
5759
|
// another rive file, we only want to destroy it if this file is the only owner.
|
|
5560
5760
|
riveFile.destroyIfUnused();
|
|
5561
5761
|
return [2 /*return*/, false];
|
|
5562
5762
|
}
|
|
5563
|
-
|
|
5763
|
+
_c.label = 2;
|
|
5564
5764
|
case 2:
|
|
5765
|
+
if (!(this.riveFile.deferredSession !== null || this.deferredRenderer)) return [3 /*break*/, 4];
|
|
5766
|
+
return [4 /*yield*/, this.resolveDeferredRendering()];
|
|
5767
|
+
case 3:
|
|
5768
|
+
_c.sent();
|
|
5769
|
+
if (this.destroyed) {
|
|
5770
|
+
// cleanup() ran during a re-import. Taking a reference now would
|
|
5771
|
+
// resurrect a file this instance is never going to draw. Only ours
|
|
5772
|
+
// to release — a caller-supplied file stays theirs.
|
|
5773
|
+
if (this.ownsRiveFile) {
|
|
5774
|
+
(_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.destroyIfUnused();
|
|
5775
|
+
}
|
|
5776
|
+
return [2 /*return*/, false];
|
|
5777
|
+
}
|
|
5778
|
+
_c.label = 4;
|
|
5779
|
+
case 4:
|
|
5565
5780
|
this.file = this.riveFile.getInstance();
|
|
5566
5781
|
// Initialize and draw frame
|
|
5567
5782
|
this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay, autoBind);
|
|
@@ -5580,7 +5795,7 @@ var Rive = /** @class */ (function () {
|
|
|
5580
5795
|
this.loaded = true;
|
|
5581
5796
|
this.eventManager.fire({
|
|
5582
5797
|
type: EventType.Load,
|
|
5583
|
-
data: (
|
|
5798
|
+
data: (_b = this.src) !== null && _b !== void 0 ? _b : "buffer",
|
|
5584
5799
|
});
|
|
5585
5800
|
}
|
|
5586
5801
|
catch (e) {
|
|
@@ -5598,12 +5813,114 @@ var Rive = /** @class */ (function () {
|
|
|
5598
5813
|
this.taskQueue.process();
|
|
5599
5814
|
this.drawFrame();
|
|
5600
5815
|
return [2 /*return*/, true];
|
|
5601
|
-
case
|
|
5602
|
-
|
|
5603
|
-
msg = resolveErrorMessage(
|
|
5816
|
+
case 5:
|
|
5817
|
+
error_4 = _c.sent();
|
|
5818
|
+
msg = resolveErrorMessage(error_4);
|
|
5604
5819
|
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
5605
5820
|
return [2 /*return*/, Promise.reject(msg)];
|
|
5606
|
-
case
|
|
5821
|
+
case 6: return [2 /*return*/];
|
|
5822
|
+
}
|
|
5823
|
+
});
|
|
5824
|
+
});
|
|
5825
|
+
};
|
|
5826
|
+
/**
|
|
5827
|
+
* Settles which rendering mode this Rive instance runs in. The file dictates: its rendering mode
|
|
5828
|
+
* is fixed at import, and an immediate renderer silently drops a deferred
|
|
5829
|
+
* file's resources. Every mismatch warns and degrades to something that
|
|
5830
|
+
* renders, so users shouldn't have a blank canvas. A fallback self-reimport replaces `this.riveFile`;
|
|
5831
|
+
* only a file this instance imported is released when that happens.
|
|
5832
|
+
*/
|
|
5833
|
+
Rive.prototype.resolveDeferredRendering = function () {
|
|
5834
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5835
|
+
var file, ownsFile, renderer, session, attachSession, immediate, copy, copySession, fallback;
|
|
5836
|
+
var _a;
|
|
5837
|
+
return __generator(this, function (_b) {
|
|
5838
|
+
switch (_b.label) {
|
|
5839
|
+
case 0:
|
|
5840
|
+
file = this.riveFile;
|
|
5841
|
+
ownsFile = this.ownsRiveFile;
|
|
5842
|
+
renderer = this.renderer;
|
|
5843
|
+
session = file.deferredSession;
|
|
5844
|
+
if (session === null) {
|
|
5845
|
+
// No second warning when the file asked for deferred and the build
|
|
5846
|
+
// could not honor it; the unsupported-build warning already fired, and
|
|
5847
|
+
// telling the user to set a flag they set would mislead.
|
|
5848
|
+
if (this.deferredRenderer && !file.deferredRequested) {
|
|
5849
|
+
console.warn("Rive: `enableGPUCanvas: true` was ignored because this RiveFile was imported without it. The mode is fixed at import: construct the RiveFile with `enableGPUCanvas: true` to opt in.");
|
|
5850
|
+
}
|
|
5851
|
+
return [2 /*return*/];
|
|
5852
|
+
}
|
|
5853
|
+
if (!this.deferredRenderer) {
|
|
5854
|
+
console.warn("Rive: this RiveFile was imported with `enableGPUCanvas: true`, so this instance renders deferred even though `enableGPUCanvas` is false on the instance. An immediate renderer would drop the file's deferred resources and draw nothing.");
|
|
5855
|
+
}
|
|
5856
|
+
attachSession = renderer === null || renderer === void 0 ? void 0 : renderer.attachSession;
|
|
5857
|
+
if (!(typeof attachSession !== "function")) return [3 /*break*/, 2];
|
|
5858
|
+
// Offscreen renderers share one context across canvases, which a session
|
|
5859
|
+
// cannot record for. An immediate copy of the file still renders.
|
|
5860
|
+
console.warn("Rive: this renderer cannot replay a deferred session (`useOffscreenRenderer` is not supported with deferred rendering). Re-importing the file in immediate mode for this instance.");
|
|
5861
|
+
return [4 /*yield*/, file.reimport(false)];
|
|
5862
|
+
case 1:
|
|
5863
|
+
immediate = _b.sent();
|
|
5864
|
+
if (this.destroyed) {
|
|
5865
|
+
// cleanup() ran while we were importing; nothing will use this copy.
|
|
5866
|
+
immediate.destroyIfUnused();
|
|
5867
|
+
return [2 /*return*/];
|
|
5868
|
+
}
|
|
5869
|
+
this.riveFile = immediate;
|
|
5870
|
+
this.ownsRiveFile = true;
|
|
5871
|
+
if (ownsFile) {
|
|
5872
|
+
// Nothing else can reach the deferred import we just walked away from.
|
|
5873
|
+
file.destroyIfUnused();
|
|
5874
|
+
}
|
|
5875
|
+
return [2 /*return*/];
|
|
5876
|
+
case 2:
|
|
5877
|
+
// Never re-offered once claimed, even if that renderer is gone: the
|
|
5878
|
+
// resources the session's stream refers to died with it.
|
|
5879
|
+
if (!file.sessionClaimed && attachSession.call(renderer, session)) {
|
|
5880
|
+
file.claimSession();
|
|
5881
|
+
return [2 /*return*/];
|
|
5882
|
+
}
|
|
5883
|
+
// Bound to another instance. Re-import from the retained buffer into a
|
|
5884
|
+
// session of our own.
|
|
5885
|
+
file.warnBoundElsewhereOnce();
|
|
5886
|
+
return [4 /*yield*/, file.reimport(true)];
|
|
5887
|
+
case 3:
|
|
5888
|
+
copy = _b.sent();
|
|
5889
|
+
if (this.destroyed) {
|
|
5890
|
+
// The renderer was deleted while we imported; attaching to it would hand
|
|
5891
|
+
// embind a deleted object.
|
|
5892
|
+
copy.destroyIfUnused();
|
|
5893
|
+
return [2 /*return*/];
|
|
5894
|
+
}
|
|
5895
|
+
this.riveFile = copy;
|
|
5896
|
+
this.ownsRiveFile = true;
|
|
5897
|
+
copySession = copy.deferredSession;
|
|
5898
|
+
if (copySession !== null && attachSession.call(renderer, copySession)) {
|
|
5899
|
+
copy.claimSession();
|
|
5900
|
+
return [2 /*return*/];
|
|
5901
|
+
}
|
|
5902
|
+
// The copy's session could not take this canvas either (this renderer
|
|
5903
|
+
// already holds one). An immediate re-import still renders; a deferred file
|
|
5904
|
+
// on an immediate renderer would drop its resources and draw nothing.
|
|
5905
|
+
console.warn("Rive: could not attach the re-imported file's deferred session to this canvas; falling back to immediate rendering for this instance.");
|
|
5906
|
+
// If a leftover session is why the attach failed, it would keep routing
|
|
5907
|
+
// the immediate file's draws into its recorder, which drops them.
|
|
5908
|
+
(_a = renderer.detachSession) === null || _a === void 0 ? void 0 : _a.call(renderer);
|
|
5909
|
+
return [4 /*yield*/, file.reimport(false)];
|
|
5910
|
+
case 4:
|
|
5911
|
+
fallback = _b.sent();
|
|
5912
|
+
// The deferred copy was only ever ours, so it always goes.
|
|
5913
|
+
copy.destroyIfUnused();
|
|
5914
|
+
if (this.destroyed) {
|
|
5915
|
+
fallback.destroyIfUnused();
|
|
5916
|
+
return [2 /*return*/];
|
|
5917
|
+
}
|
|
5918
|
+
this.riveFile = fallback;
|
|
5919
|
+
this.ownsRiveFile = true;
|
|
5920
|
+
if (ownsFile) {
|
|
5921
|
+
file.destroyIfUnused();
|
|
5922
|
+
}
|
|
5923
|
+
return [2 /*return*/];
|
|
5607
5924
|
}
|
|
5608
5925
|
});
|
|
5609
5926
|
});
|
|
@@ -5698,6 +6015,13 @@ var Rive = /** @class */ (function () {
|
|
|
5698
6015
|
}
|
|
5699
6016
|
return changed;
|
|
5700
6017
|
};
|
|
6018
|
+
// Content the artboard's change flag cannot see: ore and GPU canvas commands
|
|
6019
|
+
// scripts record straight into the session. Must be read before the renderer
|
|
6020
|
+
// clears — clearing marks the stream, so a later read is true every frame.
|
|
6021
|
+
Rive.prototype._deferredWorkPending = function () {
|
|
6022
|
+
var _a, _b, _c;
|
|
6023
|
+
return (_c = (_b = (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.deferredSession) === null || _b === void 0 ? void 0 : _b.recordedThisFrame()) !== null && _c !== void 0 ? _c : false;
|
|
6024
|
+
};
|
|
5701
6025
|
/**
|
|
5702
6026
|
* Poll focus state each frame to see if we should focus/blur the canvas in case
|
|
5703
6027
|
* Rive internally updated focus outside of user interaction (e.g., via listener action)
|
|
@@ -5907,6 +6231,11 @@ var Rive = /** @class */ (function () {
|
|
|
5907
6231
|
Rive.prototype.draw = function (time, onSecond) {
|
|
5908
6232
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
5909
6233
|
this.frameRequestId = null;
|
|
6234
|
+
// load() tears the artboard down and re-inits asynchronously; a frame
|
|
6235
|
+
// queued before that lands here with nothing to draw.
|
|
6236
|
+
if (!this.artboard) {
|
|
6237
|
+
return;
|
|
6238
|
+
}
|
|
5910
6239
|
var before = performance.now();
|
|
5911
6240
|
// Instrument the first 3 frames so the Performance timeline shows precise
|
|
5912
6241
|
// per-call latency for advance, draw, and flush without polluting the trace.
|
|
@@ -5928,9 +6257,13 @@ var Rive = /** @class */ (function () {
|
|
|
5928
6257
|
var renderer = this.renderer;
|
|
5929
6258
|
// Do not draw on 0 canvas size
|
|
5930
6259
|
if (!this._hasZeroSize) {
|
|
5931
|
-
// If there was no dirt on this frame, do not clear and draw
|
|
6260
|
+
// If there was no dirt on this frame, do not clear and draw. The deferred
|
|
6261
|
+
// term has to be read here, before `clear()` below: clearing opens the
|
|
6262
|
+
// session's recording window and marks its stream, so a read taken after
|
|
6263
|
+
// it reports every frame as dirty and nothing is ever skipped.
|
|
5932
6264
|
if (this.drawOptimization == DrawOptimizationOptions.AlwaysDraw ||
|
|
5933
6265
|
this.artboard.didChange() ||
|
|
6266
|
+
this._deferredWorkPending() ||
|
|
5934
6267
|
this._needsRedraw ||
|
|
5935
6268
|
this._canvasSizeChanged()) {
|
|
5936
6269
|
// Canvas must be wiped to prevent artifacts
|
|
@@ -6028,7 +6361,7 @@ var Rive = /** @class */ (function () {
|
|
|
6028
6361
|
* Rive class
|
|
6029
6362
|
*/
|
|
6030
6363
|
Rive.prototype.cleanup = function () {
|
|
6031
|
-
var _a, _b, _c, _d;
|
|
6364
|
+
var _a, _b, _c, _d, _e;
|
|
6032
6365
|
this.destroyed = true;
|
|
6033
6366
|
// Stop the renderer if it hasn't already been stopped.
|
|
6034
6367
|
this.stopRendering();
|
|
@@ -6044,10 +6377,14 @@ var Rive = /** @class */ (function () {
|
|
|
6044
6377
|
observers.remove(this._observed);
|
|
6045
6378
|
}
|
|
6046
6379
|
this.removeRiveListeners();
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6380
|
+
// The file and its session go before the renderer: the session's replay
|
|
6381
|
+
// state lives in the renderer's context. But the renderer must let go of
|
|
6382
|
+
// the session first — its detach handle dies with session.delete(), and a
|
|
6383
|
+
// later detach would pass embind a deleted object.
|
|
6384
|
+
if (this.renderer) {
|
|
6385
|
+
(_d = (_c = this.renderer).detachSession) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
6386
|
+
}
|
|
6387
|
+
this.releaseCurrentRiveFile(/* isTeardown */ true);
|
|
6051
6388
|
this.riveFile = null;
|
|
6052
6389
|
this.deleteRiveRenderer();
|
|
6053
6390
|
if (this._audioEventListener !== null) {
|
|
@@ -6058,21 +6395,65 @@ var Rive = /** @class */ (function () {
|
|
|
6058
6395
|
document.removeEventListener('visibilitychange', this._pageVisibilityHandler);
|
|
6059
6396
|
this._pageVisibilityHandler = null;
|
|
6060
6397
|
}
|
|
6061
|
-
(
|
|
6398
|
+
(_e = this._viewModelInstance) === null || _e === void 0 ? void 0 : _e.cleanup();
|
|
6062
6399
|
this._viewModelInstance = null;
|
|
6063
6400
|
this._globalViewModelInstances.forEach(function (instance) { return instance.cleanup(); });
|
|
6064
6401
|
this._globalViewModelInstances.clear();
|
|
6065
6402
|
this._dataEnums = null;
|
|
6066
6403
|
};
|
|
6404
|
+
/**
|
|
6405
|
+
* Drops this instance's hold on `this.riveFile`. A reference taken through
|
|
6406
|
+
* getInstance() is given back; a file we imported but never referenced is
|
|
6407
|
+
* released outright so its session goes with it. A caller-supplied file we
|
|
6408
|
+
* never referenced is left alone.
|
|
6409
|
+
*
|
|
6410
|
+
* `isTeardown` distinguishes cleanup() from a reload. Teardown always hands
|
|
6411
|
+
* the reference back, as it always has. A reload must not do that for a
|
|
6412
|
+
* caller-supplied file: a RiveFile carries no reference for its creator, so
|
|
6413
|
+
* releasing here would take the last one and destroy a file the caller still
|
|
6414
|
+
* holds.
|
|
6415
|
+
*/
|
|
6416
|
+
Rive.prototype.releaseCurrentRiveFile = function (isTeardown) {
|
|
6417
|
+
var _a, _b;
|
|
6418
|
+
if (this.file) {
|
|
6419
|
+
if (isTeardown || this.ownsRiveFile) {
|
|
6420
|
+
(_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
6421
|
+
}
|
|
6422
|
+
this.file = null;
|
|
6423
|
+
}
|
|
6424
|
+
else if (this.ownsRiveFile) {
|
|
6425
|
+
(_b = this.riveFile) === null || _b === void 0 ? void 0 : _b.destroyIfUnused();
|
|
6426
|
+
}
|
|
6427
|
+
};
|
|
6067
6428
|
/**
|
|
6068
6429
|
* Cleans up the Renderer object. Only call this API if you no longer
|
|
6069
6430
|
* need to render Rive content in your session.
|
|
6070
6431
|
*/
|
|
6071
6432
|
Rive.prototype.deleteRiveRenderer = function () {
|
|
6072
|
-
var _a;
|
|
6073
|
-
(
|
|
6433
|
+
var _a, _b;
|
|
6434
|
+
if (this.renderer) {
|
|
6435
|
+
// A session outliving this renderer has to stop pointing at it, and its
|
|
6436
|
+
// replay state has to drop while this context is still alive. No-op when
|
|
6437
|
+
// nothing was ever attached.
|
|
6438
|
+
(_b = (_a = this.renderer).detachSession) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
6439
|
+
this.renderer.delete();
|
|
6440
|
+
}
|
|
6074
6441
|
this.renderer = null;
|
|
6075
6442
|
};
|
|
6443
|
+
Object.defineProperty(Rive.prototype, "deferredRendererActive", {
|
|
6444
|
+
/**
|
|
6445
|
+
* @experimental This API is early and may encounter breaking behavior change without a major version bump
|
|
6446
|
+
*
|
|
6447
|
+
* Whether this instance is rendering through a deferred session. False whenever
|
|
6448
|
+
* a fallback ran, whatever was requested.
|
|
6449
|
+
*/
|
|
6450
|
+
get: function () {
|
|
6451
|
+
var _a, _b, _c;
|
|
6452
|
+
return (_c = (_b = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.deferredActive) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : false;
|
|
6453
|
+
},
|
|
6454
|
+
enumerable: false,
|
|
6455
|
+
configurable: true
|
|
6456
|
+
});
|
|
6076
6457
|
/**
|
|
6077
6458
|
* Cleans up any Wasm-generated objects that need to be manually destroyed:
|
|
6078
6459
|
* artboard instances, animation instances, state machine instances.
|
|
@@ -6304,7 +6685,10 @@ var Rive = /** @class */ (function () {
|
|
|
6304
6685
|
};
|
|
6305
6686
|
// Loads a new Rive file, keeping listeners in place
|
|
6306
6687
|
Rive.prototype.load = function (params) {
|
|
6307
|
-
|
|
6688
|
+
// Before stop(), so a call with no source leaves playback running.
|
|
6689
|
+
if (!params.src && !params.buffer && !params.riveFile) {
|
|
6690
|
+
throw new RiveError(Rive.missingErrorMessage);
|
|
6691
|
+
}
|
|
6308
6692
|
// Stop all animations
|
|
6309
6693
|
this.stop();
|
|
6310
6694
|
// Reinitialize
|
|
@@ -8168,7 +8552,7 @@ var decodeAudio = function (bytes) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
8168
8552
|
case 0:
|
|
8169
8553
|
decodedPromise = new Promise(function (resolve) {
|
|
8170
8554
|
return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
|
|
8171
|
-
rive.decodeAudio(bytes, resolve);
|
|
8555
|
+
rive.decodeAudio(bytes, resolve, null);
|
|
8172
8556
|
});
|
|
8173
8557
|
});
|
|
8174
8558
|
return [4 /*yield*/, decodedPromise];
|
|
@@ -8193,7 +8577,7 @@ var decodeImage = function (bytes) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
8193
8577
|
case 0:
|
|
8194
8578
|
decodedPromise = new Promise(function (resolve) {
|
|
8195
8579
|
return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
|
|
8196
|
-
rive.decodeImage(bytes, resolve);
|
|
8580
|
+
rive.decodeImage(bytes, resolve, null);
|
|
8197
8581
|
});
|
|
8198
8582
|
});
|
|
8199
8583
|
return [4 /*yield*/, decodedPromise];
|
|
@@ -8218,7 +8602,7 @@ var decodeFont = function (bytes) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
8218
8602
|
case 0:
|
|
8219
8603
|
decodedPromise = new Promise(function (resolve) {
|
|
8220
8604
|
return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
|
|
8221
|
-
rive.decodeFont(bytes, resolve);
|
|
8605
|
+
rive.decodeFont(bytes, resolve, null);
|
|
8222
8606
|
});
|
|
8223
8607
|
});
|
|
8224
8608
|
return [4 /*yield*/, decodedPromise];
|