@rive-app/canvas-lite 2.41.0 → 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 +599 -158
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +114 -17
- package/rive_fallback.wasm +0 -0
- package/semantics/index.d.ts +1 -1
- package/semantics/types.d.ts +15 -2
- package/utils/finalizationRegistry.d.ts +7 -3
package/rive.js
CHANGED
|
@@ -349,98 +349,103 @@ __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
|
|
353
|
-
function fa(){function b(
|
|
354
|
-
"fixed",
|
|
355
|
-
function
|
|
356
|
-
|
|
357
|
-
h.isAudio?
|
|
358
|
-
n.onreadystatechange=function(){4==
|
|
359
|
-
m,n=1){return
|
|
360
|
-
const
|
|
361
|
-
renderViaOffscreenBackBuffer:1};let
|
|
362
|
-
"function"===typeof
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
null,c=0,d=0,e=null,
|
|
366
|
-
a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_LINEAR),a.generateMipmap(a.TEXTURE_2D)):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);return
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
E.indices.length}console.assert(
|
|
370
|
-
|
|
371
|
-
case n.color:return"color";case n.luminosity:return"luminosity"}}function a(l){return"rgba("+((16711680&l)>>>16)+","+((65280&l)>>>8)+","+((255&l)>>>0)+","+((4278190080&l)>>>24)/255+")"}function c(){0<
|
|
372
|
-
let
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
A;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
var
|
|
399
|
-
|
|
400
|
-
var
|
|
401
|
-
function
|
|
402
|
-
|
|
403
|
-
a
|
|
404
|
-
|
|
405
|
-
var
|
|
406
|
-
function
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
(
|
|
414
|
-
b
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
352
|
+
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var h=moduleArg,ba=!!globalThis.window,ca=!!globalThis.WorkerGlobalScope;
|
|
353
|
+
function fa(){function b(g){const f=d;c=a=0;d=new Map;f.forEach(m=>{try{m(g)}catch(n){console.error(n)}});this.rb();e&&e.Qb()}let a=0,c=0,d=new Map,e=null,k=null;this.requestAnimationFrame=function(g){a||=requestAnimationFrame(b.bind(this));const f=++c;d.set(f,g);return f};this.cancelAnimationFrame=function(g){d.delete(g);a&&0==d.size&&(cancelAnimationFrame(a),a=0)};this.Ob=function(g){k&&(document.body.remove(k),k=null);g||(k=document.createElement("div"),k.style.backgroundColor="black",k.style.position=
|
|
354
|
+
"fixed",k.style.right=0,k.style.top=0,k.style.color="white",k.style.padding="4px",k.innerHTML="RIVE FPS",g=function(f){k.innerHTML="RIVE FPS "+f.toFixed(1)},document.body.appendChild(k));e=new function(){let f=0,m=0;this.Qb=function(){var n=performance.now();m?(++f,n-=m,1E3<n&&(g(1E3*f/n),f=m=0)):(m=n,f=0)}}};this.Lb=function(){k&&(document.body.remove(k),k=null);e=null};this.rb=function(){}}
|
|
355
|
+
function ia(b){console.assert(!0);const a=new Map;let c=-Infinity;this.push=function(d){d=d+((1<<b)-1)>>b;a.has(d)&&clearTimeout(a.get(d));a.set(d,setTimeout(function(){a.delete(d);0==a.length?c=-Infinity:d==c&&(c=Math.max(...a.keys()),console.assert(c<d))},1E3));c=Math.max(d,c);return c<<b}}const ja=h.onRuntimeInitialized;
|
|
356
|
+
h.onRuntimeInitialized=function(){ja&&ja();let b=h.decodeAudio;h.decodeAudio=function(g,f,m=null){g=b(g,m??null);f(g)};let a=h.decodeFont;h.decodeFont=function(g,f,m=null){g=a(g,m??null);f(g)};const c=h.FileAsset.prototype.decode;h.FileAsset.prototype.decode=function(g,f){return c.call(this,g,f??null)};let d=h.setFallbackFontCb;h.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=h.FileAssetLoader;h.ptrToAsset=g=>{let f=h.ptrToFileAsset(g);return f.isImage?h.ptrToImageAsset(g):f.isFont?h.ptrToFontAsset(g):f.isAudio?h.ptrToAudioAsset(g):f};h.CustomFileAssetLoader=e.extend("CustomFileAssetLoader",{__construct:function({loadContents:g}){this.__parent.__construct.call(this);this.Fb=g},loadContents:function(g,f){g=h.ptrToAsset(g);return this.Fb(g,f)}});h.CDNFileAssetLoader=e.extend("CDNFileAssetLoader",{__construct:function(g){this.__parent.__construct.call(this);this.Gb=
|
|
358
|
+
g??null},loadContents:function(g){let f=h.ptrToAsset(g);g=f.cdnUuid;if(""===g)return!1;const m=this.Gb??null;(function(n,r){var w=new XMLHttpRequest;w.responseType="arraybuffer";w.onreadystatechange=function(){4==w.readyState&&200==w.status&&r(w)};w.open("GET",n,!0);w.send(null)})(f.cdnBaseUrl+"/"+g,n=>{f.decode(new Uint8Array(n.response),m)});return!0}});h.FallbackFileAssetLoader=e.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this);this.qb=[]},addLoader:function(g){this.qb.push(g)},
|
|
359
|
+
loadContents:function(g,f){for(let m of this.qb)if(m.loadContents(g,f))return!0;return!1}});let k=h.computeAlignment;h.computeAlignment=function(g,f,m,n,r=1){return k.call(this,g,f,m,n,r)}};
|
|
360
|
+
const ka="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),la=new function(){function b(){if(!a){var v=document.createElement("canvas"),x={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 q;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(q=v.getContext("webgl",x),c=1,!q)return console.log("No WebGL support. Image mesh will not be drawn."),!1}else if(q=v.getContext("webgl2",x))c=2;else if(q=v.getContext("webgl",x))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;q=new Proxy(q,{get(I,u){if(I.isContextLost()){if(m||(console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ",u),m=!0),
|
|
362
|
+
"function"===typeof I[u])return function(){}}else return"function"===typeof I[u]?function(...J){return I[u].apply(I,J)}:I[u]},set(I,u,J){if(I.isContextLost())m||(console.error("Cannot render the mesh because the GL Context was lost. Tried to set property "+u),m=!0);else return I[u]=J,!0}});d=Math.min(q.getParameter(q.MAX_RENDERBUFFER_SIZE),q.getParameter(q.MAX_TEXTURE_SIZE));function L(I,u,J){u=q.createShader(u);q.shaderSource(u,J);q.compileShader(u);J=q.getShaderInfoLog(u);if(0<(J||"").length)throw J;
|
|
363
|
+
q.attachShader(I,u)}v=q.createProgram();L(v,q.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 }");L(v,q.FRAGMENT_SHADER,"precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }");
|
|
364
|
+
q.bindAttribLocation(v,0,"vertex");q.bindAttribLocation(v,1,"uv");q.linkProgram(v);x=q.getProgramInfoLog(v);if(0<(x||"").trim().length)throw x;e=q.getUniformLocation(v,"mat");k=q.getUniformLocation(v,"translate");q.useProgram(v);q.bindBuffer(q.ARRAY_BUFFER,q.createBuffer());q.enableVertexAttribArray(0);q.enableVertexAttribArray(1);q.bindBuffer(q.ELEMENT_ARRAY_BUFFER,q.createBuffer());q.uniform1i(q.getUniformLocation(v,"image"),0);q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);a=q}return!0}let a=
|
|
365
|
+
null,c=0,d=0,e=null,k=null,g=0,f=0,m=!1;b();this.Zb=function(){b();return d};this.Kb=function(v){a&&a.deleteTexture&&a.deleteTexture(v)};this.Jb=function(v){if(!b())return null;const x=a.createTexture();if(!x)return null;a.bindTexture(a.TEXTURE_2D,x);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,v);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);2==
|
|
366
|
+
c?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_LINEAR),a.generateMipmap(a.TEXTURE_2D)):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);return x};const n=new ia(8),r=new ia(8),w=new ia(10),z=new ia(10);this.Nb=function(v,x,q,L,I){if(b()){var u=n.push(v),J=r.push(x);if(a.canvas){if(a.canvas.width!=u||a.canvas.height!=J)a.canvas.width=u,a.canvas.height=J;a.viewport(0,J-x,v,x);a.disable(a.SCISSOR_TEST);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);a.enable(a.SCISSOR_TEST);
|
|
367
|
+
q.sort((E,aa)=>aa.vb-E.vb);u=w.push(L);g!=u&&(a.bufferData(a.ARRAY_BUFFER,8*u,a.DYNAMIC_DRAW),g=u);u=0;for(var K of q)a.bufferSubData(a.ARRAY_BUFFER,u,K.ab),u+=4*K.ab.length;console.assert(u==4*L);for(var R of q)a.bufferSubData(a.ARRAY_BUFFER,u,R.yb),u+=4*R.yb.length;console.assert(u==8*L);u=z.push(I);f!=u&&(a.bufferData(a.ELEMENT_ARRAY_BUFFER,2*u,a.DYNAMIC_DRAW),f=u);K=0;for(var X of q)a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,K,X.indices),K+=2*X.indices.length;console.assert(K==2*I);X=0;R=!0;u=K=0;
|
|
368
|
+
for(const E of q){E.image.Va!=X&&(a.bindTexture(a.TEXTURE_2D,E.image.Ta||null),X=E.image.Va);E.bc?(a.scissor(E.ib,J-E.jb-E.pb,E.jc,E.pb),R=!0):R&&(a.scissor(0,J-x,v,x),R=!1);q=2/v;const aa=-2/x;a.uniform4f(e,E.wa[0]*q*E.La,E.wa[1]*aa*E.Ma,E.wa[2]*q*E.La,E.wa[3]*aa*E.Ma);a.uniform2f(k,E.wa[4]*q*E.La+q*(E.ib-E.$b*E.La)-1,E.wa[5]*aa*E.Ma+aa*(E.jb-E.ac*E.Ma)+1);a.vertexAttribPointer(0,2,a.FLOAT,!1,0,u);a.vertexAttribPointer(1,2,a.FLOAT,!1,0,u+4*L);a.drawElements(a.TRIANGLES,E.indices.length,a.UNSIGNED_SHORT,
|
|
369
|
+
K);u+=4*E.ab.length;K+=2*E.indices.length}console.assert(u==4*L);console.assert(K==2*I)}}};this.canvas=function(){return b()&&a.canvas}},ma=h.onRuntimeInitialized;
|
|
370
|
+
h.onRuntimeInitialized=function(){function b(l){switch(l){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 a(l){return"rgba("+((16711680&l)>>>16)+","+((65280&l)>>>8)+","+((255&l)>>>0)+","+((4278190080&l)>>>24)/255+")"}function c(){0<R.length&&(la.Nb(K.drawWidth(),K.drawHeight(),R,X,E),R=[],E=X=0,K.reset(512,512));for(const l of u){for(const p of l.na)p();l.na=[]}u.clear()}ma&&ma();var d=h.RenderPaintStyle;const e=h.RenderPath,k=h.RenderPaint,g=h.Renderer,f=h.StrokeCap,m=h.StrokeJoin,n=h.BlendMode,r=d.fill,w=d.stroke,z=h.FillRule.evenOdd;
|
|
372
|
+
let v=1;var x=h.RenderImage.extend("CanvasRenderImage",{__construct:function({Ba:l,Ka:p}={}){this.__parent.__construct.call(this);this.Va=v;v=v+1&2147483647||1;this.Ba=l;this.Ka=p},__destruct:function(){this.Ta&&(la.Kb(this.Ta),URL.revokeObjectURL(this.gb));this.__parent.__destruct.call(this)},decode:function(l){var p=this;p.Ka&&p.Ka(p);var A=new Image;p.gb=URL.createObjectURL(new Blob([l],{type:"image/png"}));A.onload=function(){p.Eb=A;p.Ta=la.Jb(A);p.size(A.width,A.height);p.Ba&&p.Ba(p)};A.src=
|
|
373
|
+
p.gb}});class q{constructor(){this.Da=this.Ha=0;this.sa=new Path2D}clear(){this.Da=this.Ha=0;this.sa=new Path2D}Hb(l){for(0<this.Ha&&this.Da<l.length&&this.clear();this.Da<l.length;)l[this.Da++](this.sa);this.Ha++;return this.sa}release(l){l===this.sa&&this.Ha--}}var L=e.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this);this.Ra=[];this.sa=new q;this.Qa=!1;this.za=null},rewind:function(){this.Ra.length=0;this.sa.clear();this.Qa=!1;this.za=null},addPath:function(l,
|
|
374
|
+
p,A,t,G,B,C){const y=l.Ab();this.ya(F=>{const H=new DOMMatrix;H.a=p;H.b=A;H.c=t;H.d=G;H.e=B;H.f=C;F.addPath(y,H)})},fillRule:function(l){this.fb=l},moveTo:function(l,p){this.Qa=!0;const A={kb:!0};this.za=A;this.ya(t=>{t.moveTo(l,p);A.kb&&t.lineTo(l,p)})},lineTo:function(l,p){this.eb();this.Oa();this.ya(A=>{A.lineTo(l,p)})},cubicTo:function(l,p,A,t,G,B){this.eb();this.Oa();this.ya(C=>{C.bezierCurveTo(l,p,A,t,G,B)})},close:function(){this.Oa();this.ya(l=>{l.closePath()})},eb:function(){this.Qa||this.moveTo(0,
|
|
375
|
+
0)},Oa:function(){null!==this.za&&(this.za.kb=!1,this.za=null)},ya:function(l){this.Ra.push(l)},Na:function(){return this.sa.Hb(this.Ra)},hb:function(l){this.sa.release(l)},Ab:function(){const l=this.Na();this.sa.clear();return l}}),I=k.extend("CanvasRenderPaint",{__construct:function(){this.__parent.__construct.call(this);this.la=[];this.Pa=0;this.Sa=r;this.Wa=a(4278190080);this.Ua=1;this.Ga="miter";this.Fa="butt";this.bb=b(n.srcOver);this.va=null},color:function(l){this.la.push(()=>{this.Wa=a(l)})},
|
|
376
|
+
thickness:function(l){this.la.push(()=>{this.Ua=Math.abs(l)})},join:function(l){this.la.push(()=>{switch(l){case m.miter:this.Ga="miter";break;case m.round:this.Ga="round";break;case m.bevel:this.Ga="bevel"}})},cap:function(l){this.la.push(()=>{switch(l){case f.butt:this.Fa="butt";break;case f.round:this.Fa="round";break;case f.square:this.Fa="square"}})},style:function(l){this.la.push(()=>{this.Sa=l})},blendMode:function(l){this.la.push(()=>{this.bb=b(l)})},clearGradient:function(){this.la.push(()=>
|
|
377
|
+
{this.va=null})},linearGradient:function(l,p,A,t){this.la.push(()=>{this.va={wb:l,xb:p,mb:A,nb:t,$a:[]}})},radialGradient:function(l,p,A,t){this.la.push(()=>{this.va={wb:l,xb:p,mb:A,nb:t,$a:[],Xb:!0}})},addStop:function(l,p){this.la.push(()=>{this.va.$a.push({color:l,stop:p})})},completeGradient:function(){},Bb:function(l,p,A,t){if(this.Sa!==w||0<this.Ua){var G=this.Sa,B=this.Wa,C=this.va,y=l.globalCompositeOperation,F=l.globalAlpha;l.globalCompositeOperation=this.bb;l.globalAlpha=t;if(null!=C){B=
|
|
378
|
+
C.wb;const O=C.xb,Q=C.mb;var H=C.nb;t=C.$a;C.Xb?(C=Q-B,H-=O,B=l.createRadialGradient(B,O,0,B,O,Math.sqrt(C*C+H*H))):B=l.createLinearGradient(B,O,Q,H);for(let S=0,Aa=t.length;S<Aa;S++)C=t[S],B.addColorStop(C.stop,a(C.color));this.Wa=B;this.va=null}switch(G){case w:l.strokeStyle=B;l.lineWidth=this.Ua;l.lineCap=this.Fa;l.lineJoin=this.Ga;l.stroke(p);break;case r:l.fillStyle=B,l.fill(p,A)}l.globalCompositeOperation=y;l.globalAlpha=F}},Db:function(){return this.Pa+this.la.length},Cb:function(l){const p=
|
|
379
|
+
l-this.Pa;for(let A=0;A<p;A++)this.la[A]();this.la.splice(0,p);this.Pa=l}});const u=new Set,J=Object.prototype.hasOwnProperty;let K=null,R=[],X=0,E=0;var aa=h.CanvasRenderer=g.extend("Renderer",{__construct:function(l){this.__parent.__construct.call(this);this.ra=[1,0,0,1,0,0];this.ja=[1];this.ha=l.getContext("2d");this.cb=l;this.na=[]},save:function(){this.ra.push(...this.ra.slice(this.ra.length-6));this.ja.push(this.ja[this.ja.length-1]);this.na.push(this.ha.save.bind(this.ha))},restore:function(){const l=
|
|
380
|
+
this.ra.length-6;if(6>l)throw"restore() called without matching save().";this.ra.splice(l);this.ja.pop();this.na.push(this.ha.restore.bind(this.ha))},transform:function(l,p,A,t,G,B){const C=this.ra,y=C.length-6;C.splice(y,6,C[y]*l+C[y+2]*p,C[y+1]*l+C[y+3]*p,C[y]*A+C[y+2]*t,C[y+1]*A+C[y+3]*t,C[y]*G+C[y+2]*B+C[y+4],C[y+1]*G+C[y+3]*B+C[y+5]);this.na.push(this.ha.transform.bind(this.ha,l,p,A,t,G,B))},rotate:function(l){const p=Math.sin(l);l=Math.cos(l);this.transform(l,p,-p,l,0,0)},modulateOpacity:function(l){this.ja[this.ja.length-
|
|
381
|
+
1]*=l},_drawPath:function(l,p){const A=l.fb===z?"evenodd":"nonzero",t=Math.max(0,this.ja[this.ja.length-1]),G=l.Na(),B=p.Db();this.na.push(()=>{p.Cb(B);p.Bb(this.ha,G,A,t);l.hb(G)})},_drawRiveImage:function(l,p,A){var t=l.Eb;if(t){var G=this.ha,B=b(p),C=Math.max(0,A*this.ja[this.ja.length-1]);this.na.push(function(){G.globalCompositeOperation=B;G.globalAlpha=C;G.drawImage(t,0,0);G.globalAlpha=1})}},_getMatrix:function(l){const p=this.ra,A=p.length-6;for(let t=0;6>t;++t)l[t]=p[A+t]},_drawImageMesh:function(l,
|
|
382
|
+
p,A,t,G,B,C,y,F,H,O,Q,S){let Aa,ob,pb;try{Aa=h.HEAPF32.slice(t>>2,(t>>2)+G),ob=h.HEAPF32.slice(B>>2,(B>>2)+C),pb=h.HEAPU16.slice(y>>1,(y>>1)+F)}catch(Ra){console.error("[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.");return}t=this.ha.canvas.width;B=this.ha.canvas.height;C=Q-H;y=S-O;H=Math.max(H,0);O=Math.max(O,0);Q=Math.min(Q,t);S=Math.min(S,B);const pa=Q-H,qa=S-O;console.assert(pa<=Math.min(C,t));console.assert(qa<=Math.min(y,B));if(!(0>=pa||0>=qa)){Q=
|
|
383
|
+
pa<C||qa<y;t=S=1;var da=Math.ceil(pa*S),ea=Math.ceil(qa*t);B=la.Zb();da>B&&(S*=B/da,da=B);ea>B&&(t*=B/ea,ea=B);K||(K=new h.DynamicRectanizer(B),K.reset(512,512));B=K.addRect(da,ea);0>B&&(c(),u.add(this),B=K.addRect(da,ea),console.assert(0<=B));var qb=B&65535,rb=B>>16;R.push({wa:this.ra.slice(this.ra.length-6),image:l,ib:qb,jb:rb,$b:H,ac:O,jc:da,pb:ea,La:S,Ma:t,ab:Aa,yb:ob,indices:pb,bc:Q,vb:l.Va<<1|(Q?1:0)});X+=G;E+=F;var ha=this.ha,cc=b(p),dc=Math.max(0,A*this.ja[this.ja.length-1]);this.na.push(function(){ha.save();
|
|
384
|
+
ha.resetTransform();ha.globalCompositeOperation=cc;ha.globalAlpha=dc;const Ra=la.canvas();Ra&&ha.drawImage(Ra,qb,rb,da,ea,H,O,pa,qa);ha.restore()})}},_clipPath:function(l){const p=l.fb===z?"evenodd":"nonzero",A=l.Na();this.na.push(()=>{this.ha.clip(A,p);l.hb(A)})},beginFrame:function(l=!0){u.add(this);l&&this.na.push(this.ha.clearRect.bind(this.ha,0,0,this.cb.width,this.cb.height))},clear:function(){this.beginFrame(!0)},flush:function(){},translate:function(l,p){this.transform(1,0,0,1,l,p)}});h.makeRenderer=
|
|
385
|
+
function(l){const p=new aa(l),A=p.ha;let t=null,G=null;const B={attachSession:function(y){if(y&&t===y)return!0;if(!y||t||"function"!==typeof h.c2dDeferredClaim||"function"!==typeof h.c2dDeferredRenderer||!h.c2dDeferredClaim(y))return!1;const F=h.c2dDeferredRenderer(y);if(!F)return!1;t=y;G=F;return!0},detachSession:function(){t&&h.c2dDeferredDetach(t);G=t=null},deferredActive:function(){return null!==G}},C={save:function(){h.c2dDeferredSave(t)},restore:function(){h.c2dDeferredRestore(t)},transform:function(y,
|
|
386
|
+
F,H,O,Q,S){h.c2dDeferredTransform(t,y,F,H,O,Q,S)},translate:function(y,F){h.c2dDeferredTransform(t,1,0,0,1,y,F)},rotate:function(y){const F=Math.sin(y);y=Math.cos(y);h.c2dDeferredTransform(t,y,F,-F,y,0,0)},align:function(y,F,H,O,Q){h.c2dDeferredAlign(t,y,F,H.minX,H.minY,H.maxX,H.maxY,O.minX,O.minY,O.maxX,O.maxY,void 0===Q?1:Q)},beginFrame:function(y=!0){p.beginFrame(y);h.c2dDeferredBeginFrame(t)},clear:function(){p.beginFrame(!0);h.c2dDeferredBeginFrame(t)},flush:function(){h.c2dDeferredReplay(t,
|
|
387
|
+
p)}};return new Proxy(p,{get(y,F){if(J.call(B,F))return B[F];if("_deferredRecorder"===F)return G;if(null!==G&&J.call(C,F))return C[F];if("function"===typeof y[F])return function(...H){return y[F].apply(y,H)};if("function"===typeof A[F]){if(-1<ka.indexOf(F))throw Error("RiveException: Method call to '"+F+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...H){p.na.push(A[F].bind(A,...H))}}return y[F]},
|
|
388
|
+
set(y,F,H){if(F in A)return p.na.push(()=>{A[F]=H}),!0}})};h.decodeImage=function(l,p){(new x({Ba:p})).decode(l)};h.renderFactory={makeRenderPaint:function(){return new I},makeRenderPath:function(){return new L},makeRenderImage:function(){let l=Sa;return new x({Ka:()=>{l.total++},Ba:()=>{l.loaded++;if(l.loaded===l.total){const p=l.ready;p&&(p(),l.ready=null)}}})}};let ec=h.load,Sa=null;h.load=function(l,p,A=!0,t=null){const G=new h.FallbackFileAssetLoader;void 0!==p&&G.addLoader(p);A&&(p=new h.CDNFileAssetLoader(t),
|
|
389
|
+
G.addLoader(p));return new Promise(function(B){let C=null;Sa={total:0,loaded:0,ready:function(){B(C)}};C=ec(l,G,t??null);0==Sa.total&&B(C)})};const fc=h.Artboard.prototype.draw;h.Artboard.prototype.draw=function(l){fc.call(this,l._deferredRecorder||l)};let gc=h.RendererWrapper.prototype.align;h.RendererWrapper.prototype.align=function(l,p,A,t,G=1){gc.call(this,l,p,A,t,G)};d=new fa;h.requestAnimationFrame=d.requestAnimationFrame.bind(d);h.cancelAnimationFrame=d.cancelAnimationFrame.bind(d);h.enableFPSCounter=
|
|
390
|
+
d.Ob.bind(d);h.disableFPSCounter=d.Lb;d.rb=c;h.resolveAnimationFrame=c;h.cleanup=function(){K&&K.delete()}};var na="./this.program";ca&&(_scriptName=self.location.href);var oa="",ra,sa;
|
|
391
|
+
if(ba||ca){try{oa=(new URL(".",_scriptName)).href}catch{}ca&&(sa=b=>{var a=new XMLHttpRequest;a.open("GET",b,!1);a.responseType="arraybuffer";a.send(null);return new Uint8Array(a.response)});ra=async b=>{if(ta(b))return new Promise((c,d)=>{var e=new XMLHttpRequest;e.open("GET",b,!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 a=await fetch(b,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw Error(a.status+
|
|
392
|
+
" : "+a.url);}}var ua=console.log.bind(console),va=console.error.bind(console),wa,xa=!1,ya,ta=b=>b.startsWith("file://"),za,Ba,Ca,D,Da,Ea,Fa,M,Ga,Ha,Ia,Ja,Ka=!1;function La(){var b=Ma.buffer;h.HEAP8=Ca=new Int8Array(b);Da=new Int16Array(b);h.HEAPU8=D=new Uint8Array(b);h.HEAPU16=Ea=new Uint16Array(b);h.HEAP32=Fa=new Int32Array(b);h.HEAPU32=M=new Uint32Array(b);h.HEAPF32=Ga=new Float32Array(b);Ha=new Float64Array(b);Ia=new BigInt64Array(b);Ja=new BigUint64Array(b)}
|
|
393
|
+
function Na(b){h.onAbort?.(b);b="Aborted("+b+")";va(b);xa=!0;b=new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.");Ba?.(b);throw b;}var Oa;async function Pa(b){if(!wa)try{var a=await ra(b);return new Uint8Array(a)}catch{}if(b==Oa&&wa)b=new Uint8Array(wa);else if(sa)b=sa(b);else throw"both async and sync fetching of the wasm failed";return b}
|
|
394
|
+
async function Qa(b,a){try{var c=await Pa(b);return await WebAssembly.instantiate(c,a)}catch(d){va(`failed to asynchronously prepare wasm: ${d}`),Na(d)}}async function Ta(b){var a=Oa;if(!wa&&!ta(a))try{var c=fetch(a,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,b)}catch(d){va(`wasm streaming compile failed: ${d}`),va("falling back to ArrayBuffer instantiation")}return Qa(a,b)}
|
|
395
|
+
class Ua{name="ExitStatus";constructor(b){this.message=`Program terminated with exit(${b})`;this.status=b}}
|
|
396
|
+
var Va=b=>{for(;0<b.length;)b.shift()(h)},Wa=[],Xa=[],Ya=()=>{var b=h.preRun.shift();Xa.push(b)},Za=!0,$a=(b,a)=>Object.defineProperty(a,"name",{value:b}),ab=[],bb=[0,1,,1,null,1,!0,1,!1,1],N=class extends Error{constructor(b){super(b);this.name="BindingError"}},P=b=>{if(!b)throw new N(`Cannot use deleted val. handle = ${b}`);return bb[b]},T=b=>{switch(b){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const a=ab.pop()||bb.length;bb[a]=b;bb[a+1]=1;return a}};
|
|
397
|
+
class cb extends Error{}
|
|
398
|
+
var U=b=>{for(var a="";;){var c=D[b++];if(!c)return a;a+=String.fromCharCode(c)}},db={},eb=(b,a)=>{if(void 0===a)throw new N("ptr should not be undefined");for(;b.ga;)a=b.Ca(a),b=b.ga;return a},fb={},ib=b=>{b=gb(b);var a=U(b);hb(b);return a},jb=(b,a)=>{var c=fb[b];if(void 0===c)throw b=`${a} has unknown type ${ib(b)}`,new N(b);return c},kb=()=>{},lb=!1,mb=b=>{if(!globalThis.FinalizationRegistry)return mb=a=>a,b;lb=new FinalizationRegistry(a=>{a=a.$;--a.count.value;0===a.count.value&&(a.ia?a.oa.qa(a.ia):
|
|
399
|
+
a.da.aa.qa(a.ca))});mb=a=>{var c=a.$;c.ia&&lb.register(a,{$:c},a);return a};kb=a=>{lb.unregister(a)};return mb(b)},nb={},sb=b=>{for(;b.length;){var a=b.pop();b.pop()(a)}};function tb(b){return this.ba(M[b>>2])}
|
|
400
|
+
var ub={},vb={},wb=class extends Error{constructor(b){super(b);this.name="InternalError"}},W=(b,a,c)=>{function d(f){f=c(f);if(f.length!==b.length)throw new wb("Mismatched type converter count");for(var m=0;m<b.length;++m)V(b[m],f[m])}b.forEach(f=>vb[f]=a);var e=Array(a.length),k=[],g=0;for(let [f,m]of a.entries())fb.hasOwnProperty(m)?e[f]=fb[m]:(k.push(m),ub.hasOwnProperty(m)||(ub[m]=[]),ub[m].push(()=>{e[f]=fb[m];++g;g===k.length&&d(e)}));0===k.length&&d(e)};
|
|
401
|
+
function xb(b,a,c={}){var d=a.name;if(!b)throw new N(`type "${d}" must have a positive integer typeid pointer`);if(fb.hasOwnProperty(b)){if(c.Wb)return;throw new N(`Cannot register type '${d}' twice`);}fb[b]=a;delete vb[b];ub.hasOwnProperty(b)&&(a=ub[b],delete ub[b],a.forEach(e=>e()))}function V(b,a,c={}){return xb(b,a,c)}
|
|
402
|
+
var yb=(b,a,c)=>{switch(a){case 1:return c?d=>Ca[d]:d=>D[d];case 2:return c?d=>Da[d>>1]:d=>Ea[d>>1];case 4:return c?d=>Fa[d>>2]:d=>M[d>>2];case 8:return c?d=>Ia[d>>3]:d=>Ja[d>>3];default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},zb=b=>{throw new N(b.$.da.aa.name+" instance already deleted");},Ab=[];function Bb(){}
|
|
403
|
+
var Cb={},Db=(b,a,c)=>{if(void 0===b[a].fa){var d=b[a];b[a]=function(...e){if(!b[a].fa.hasOwnProperty(e.length))throw new N(`Function '${c}' called with an invalid number of arguments (${e.length}) - expects one of (${b[a].fa})!`);return b[a].fa[e.length].apply(this,e)};b[a].fa=[];b[a].fa[d.ta]=d}},Eb=(b,a,c)=>{if(h.hasOwnProperty(b)){if(void 0===c||void 0!==h[b].fa&&void 0!==h[b].fa[c])throw new N(`Cannot register public name '${b}' twice`);Db(h,b,b);if(h[b].fa.hasOwnProperty(c))throw new N(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`);
|
|
404
|
+
h[b].fa[c]=a}else h[b]=a,h[b].ta=c},Fb=b=>{b=b.replace(/[^a-zA-Z0-9_]/g,"$");var a=b.charCodeAt(0);return 48<=a&&57>=a?`_${b}`:b};function Gb(b,a,c,d,e,k,g,f){this.name=b;this.constructor=a;this.pa=c;this.qa=d;this.ga=e;this.Rb=k;this.Ca=g;this.Mb=f;this.sb=[]}
|
|
405
|
+
var Hb=(b,a,c)=>{for(;a!==c;){if(!a.Ca)throw new N(`Expected null or instance of ${c.name}, got an instance of ${a.name}`);b=a.Ca(b);a=a.ga}return b},Ib=b=>{if(null===b)return"null";var a=typeof b;return"object"===a||"array"===a||"function"===a?b.toString():""+b};
|
|
406
|
+
function Jb(b,a){if(null===a){if(this.Xa)throw new N(`null is not a valid ${this.name}`);return 0}if(!a.$)throw new N(`Cannot pass "${Ib(a)}" as a ${this.name}`);if(!a.$.ca)throw new N(`Cannot pass deleted object as a pointer of type ${this.name}`);return Hb(a.$.ca,a.$.da.aa,this.aa)}
|
|
407
|
+
function Kb(b,a){if(null===a){if(this.Xa)throw new N(`null is not a valid ${this.name}`);if(this.Ja){var c=this.Za();null!==b&&b.push(this.qa,c);return c}return 0}if(!a||!a.$)throw new N(`Cannot pass "${Ib(a)}" as a ${this.name}`);if(!a.$.ca)throw new N(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Ia&&a.$.da.Ia)throw new N(`Cannot convert argument of type ${a.$.oa?a.$.oa.name:a.$.da.name} to parameter type ${this.name}`);c=Hb(a.$.ca,a.$.da.aa,this.aa);if(this.Ja){if(void 0===
|
|
408
|
+
a.$.ia)throw new N("Passing raw pointer to smart pointer is illegal");switch(this.ic){case 0:if(a.$.oa===this)c=a.$.ia;else throw new N(`Cannot convert argument of type ${a.$.oa?a.$.oa.name:a.$.da.name} to parameter type ${this.name}`);break;case 1:c=a.$.ia;break;case 2:if(a.$.oa===this)c=a.$.ia;else{var d=a.clone();c=this.dc(c,T(()=>d["delete"]()));null!==b&&b.push(this.qa,c)}break;default:throw new N("Unsupported sharing policy");}}return c}
|
|
409
|
+
function Lb(b,a){if(null===a){if(this.Xa)throw new N(`null is not a valid ${this.name}`);return 0}if(!a.$)throw new N(`Cannot pass "${Ib(a)}" as a ${this.name}`);if(!a.$.ca)throw new N(`Cannot pass deleted object as a pointer of type ${this.name}`);if(a.$.da.Ia)throw new N(`Cannot convert argument of type ${a.$.da.name} to parameter type ${this.name}`);return Hb(a.$.ca,a.$.da.aa,this.aa)}
|
|
410
|
+
var Mb=(b,a,c)=>{if(a===c)return b;if(void 0===c.ga)return null;b=Mb(b,a,c.ga);return null===b?null:c.Mb(b)},Nb=(b,a)=>{a=eb(b,a);return db[a]},Ob=(b,a)=>{if(!a.da||!a.ca)throw new wb("makeClassHandle requires ptr and ptrType");if(!!a.oa!==!!a.ia)throw new wb("Both smartPtrType and smartPtr must be specified");a.count={value:1};return mb(Object.create(b,{$:{value:a,writable:!0}}))};
|
|
411
|
+
function Pb(b,a,c,d,e,k,g,f,m,n,r){this.name=b;this.aa=a;this.Xa=c;this.Ia=d;this.Ja=e;this.cc=k;this.ic=g;this.tb=f;this.Za=m;this.dc=n;this.qa=r;e||void 0!==a.ga?this.ea=Kb:(this.ea=d?Jb:Lb,this.ka=null)}var Qb=(b,a,c)=>{if(!h.hasOwnProperty(b))throw new wb("Replacing nonexistent public symbol");void 0!==h[b].fa&&void 0!==c?h[b].fa[c]=a:(h[b]=a,h[b].ta=c)},Y=(b,a)=>{b=U(b);var c=Rb.get(a);if("function"!=typeof c)throw new N(`unknown function pointer with signature ${b}: ${a}`);return c};
|
|
412
|
+
class Sb extends Error{}var Z=(b,a)=>{function c(k){e[k]||fb[k]||(vb[k]?vb[k].forEach(c):(d.push(k),e[k]=!0))}var d=[],e={};a.forEach(c);throw new Sb(`${b}: `+d.map(ib).join([", "]));};function Tb(b){for(var a=1;a<b.length;++a)if(null!==b[a]&&void 0===b[a].ka)return!0;return!1}
|
|
413
|
+
function Ub(b,a,c,d,e){var k=a.length;if(2>k)throw new N("argTypes array size mismatch! Must at least get return value and 'this' types!");var g=null!==a[1]&&null!==c,f=Tb(a),m=!a[0].Yb,n=k-2,r=Array(n),w=[],z=[];return $a(b,function(...v){z.length=0;w.length=g?2:1;w[0]=e;if(g){var x=a[1].ea(z,this);w[1]=x}for(var q=0;q<n;++q)r[q]=a[q+2].ea(z,v[q]),w.push(r[q]);v=d(...w);if(f)sb(z);else for(q=g?1:2;q<a.length;q++){var L=1===q?x:r[q-2];null!==a[q].ka&&a[q].ka(L)}x=m?a[0].ba(v):void 0;return x})}
|
|
414
|
+
var Vb=(b,a)=>{for(var c=[],d=0;d<b;d++)c.push(M[a+4*d>>2]);return c},Wb=b=>{b=b.trim();const a=b.indexOf("(");return-1===a?b:b.slice(0,a)},Xb=(b,a,c)=>{if(!(b instanceof Object))throw new N(`${c} with invalid "this": ${b}`);if(!(b instanceof a.aa.constructor))throw new N(`${c} incompatible with "this" of type ${b.constructor.name}`);if(!b.$.ca)throw new N(`cannot call emscripten binding method ${c} on deleted object`);return Hb(b.$.ca,b.$.da.aa,a.aa)},Yb=b=>{9<b&&0===--bb[b+1]&&(bb[b]=void 0,ab.push(b))},
|
|
415
|
+
Zb={name:"emscripten::val",ba:b=>{var a=P(b);Yb(b);return a},ea:(b,a)=>T(a),ma:tb,ka:null},$b=(b,a,c)=>{switch(a){case 1:return c?function(d){return this.ba(Ca[d])}:function(d){return this.ba(D[d])};case 2:return c?function(d){return this.ba(Da[d>>1])}:function(d){return this.ba(Ea[d>>1])};case 4:return c?function(d){return this.ba(Fa[d>>2])}:function(d){return this.ba(M[d>>2])};default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},ac=(b,a)=>{switch(a){case 4:return function(c){return this.ba(Ga[c>>
|
|
416
|
+
2])};case 8:return function(c){return this.ba(Ha[c>>3])};default:throw new TypeError(`invalid float width (${a}): ${b}`);}},bc=(b,a,c)=>{var d=D;if(!(0<c))return 0;var e=a;c=a+c-1;for(var k=0;k<b.length;++k){var g=b.codePointAt(k);if(127>=g){if(a>=c)break;d[a++]=g}else if(2047>=g){if(a+1>=c)break;d[a++]=192|g>>6;d[a++]=128|g&63}else if(65535>=g){if(a+2>=c)break;d[a++]=224|g>>12;d[a++]=128|g>>6&63;d[a++]=128|g&63}else{if(a+3>=c)break;d[a++]=240|g>>18;d[a++]=128|g>>12&63;d[a++]=128|g>>6&63;d[a++]=128|
|
|
417
|
+
g&63;k++}}d[a]=0;return a-e},hc=b=>{for(var a=0,c=0;c<b.length;++c){var d=b.charCodeAt(c);127>=d?a++:2047>=d?a+=2:55296<=d&&57343>=d?(a+=4,++c):a+=3}return a},ic=globalThis.TextDecoder&&new TextDecoder,jc=(b,a,c,d)=>{c=a+c;if(d)return c;for(;b[a]&&!(a>=c);)++a;return a},kc=(b,a=0,c,d)=>{c=jc(b,a,c,d);if(16<c-a&&b.buffer&&ic)return ic.decode(b.subarray(a,c));for(d="";a<c;){var e=b[a++];if(e&128){var k=b[a++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|k);else{var g=b[a++]&63;e=224==(e&240)?
|
|
418
|
+
(e&15)<<12|k<<6|g:(e&7)<<18|k<<12|g<<6|b[a++]&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},lc=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,mc=(b,a,c)=>{b>>=1;a=jc(Ea,b,a/2,c);if(16<a-b&&lc)return lc.decode(Ea.subarray(b,a));for(c="";b<a;++b)c+=String.fromCharCode(Ea[b]);return c},nc=(b,a,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=a;c=c<2*b.length?c/2:b.length;for(var e=0;e<c;++e)Da[a>>1]=
|
|
419
|
+
b.charCodeAt(e),a+=2;Da[a>>1]=0;return a-d},oc=b=>2*b.length,pc=(b,a,c)=>{var d="";b>>=2;for(var e=0;!(e>=a/4);e++){var k=M[b+e];if(!k&&!c)break;d+=String.fromCodePoint(k)}return d},qc=(b,a,c)=>{c??=2147483647;if(4>c)return 0;var d=a;c=d+c-4;for(var e=0;e<b.length;++e){var k=b.codePointAt(e);65535<k&&e++;Fa[a>>2]=k;a+=4;if(a+4>c)break}Fa[a>>2]=0;return a-d},rc=b=>{for(var a=0,c=0;c<b.length;++c)65535<b.codePointAt(c)&&c++,a+=4;return a},sc=0,tc=[],uc=b=>{var a=tc.length;tc.push(b);return a},vc=(b,
|
|
420
|
+
a)=>{for(var c=Array(b),d=0;d<b;++d)c[d]=jb(M[a+4*d>>2],`parameter ${d}`);return c},wc={},xc=b=>{var a=wc[b];return void 0===a?U(b):a},yc={},zc=b=>{if(!(b instanceof Ua||"unwind"==b))throw b;},Ac=b=>{ya=b;Za||0<sc||(h.onExit?.(b),xa=!0);throw new Ua(b);},Bc=b=>{if(!xa)try{if(b(),!(Za||0<sc))try{ya=b=ya,Ac(b)}catch(a){zc(a)}}catch(a){zc(a)}},Cc={},Ec=()=>{if(!Dc){var b={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-",
|
|
421
|
+
"_")+".UTF-8",_:na||"./this.program"},a;for(a in Cc)void 0===Cc[a]?delete b[a]:b[a]=Cc[a];var c=[];for(a in b)c.push(`${a}=${b[a]}`);Dc=c}return Dc},Dc,Fc=[null,[],[]];
|
|
422
|
+
(()=>{let b=Bb.prototype;Object.assign(b,{isAliasOf:function(c){if(!(this instanceof Bb&&c instanceof Bb))return!1;var d=this.$.da.aa,e=this.$.ca;c.$=c.$;var k=c.$.da.aa;for(c=c.$.ca;d.ga;)e=d.Ca(e),d=d.ga;for(;k.ga;)c=k.Ca(c),k=k.ga;return d===k&&e===c},clone:function(){this.$.ca||zb(this);if(this.$.xa)return this.$.count.value+=1,this;var c=mb,d=Object,e=d.create,k=Object.getPrototypeOf(this),g=this.$;c=c(e.call(d,k,{$:{value:{count:g.count,Aa:g.Aa,xa:g.xa,ca:g.ca,da:g.da,ia:g.ia,oa:g.oa}}}));c.$.count.value+=
|
|
423
|
+
1;c.$.Aa=!1;return c},["delete"](){this.$.ca||zb(this);if(this.$.Aa&&!this.$.xa)throw new N("Object already scheduled for deletion");kb(this);var c=this.$;--c.count.value;0===c.count.value&&(c.ia?c.oa.qa(c.ia):c.da.aa.qa(c.ca));this.$.xa||(this.$.ia=void 0,this.$.ca=void 0)},isDeleted:function(){return!this.$.ca},deleteLater:function(){this.$.ca||zb(this);if(this.$.Aa&&!this.$.xa)throw new N("Object already scheduled for deletion");Ab.push(this);this.$.Aa=!0;return this}});const a=Symbol.dispose;
|
|
419
424
|
a&&(b[a]=b["delete"])})();
|
|
420
|
-
Object.assign(Pb.prototype,{
|
|
421
|
-
e?a.call(this):this.
|
|
422
|
-
var
|
|
423
|
-
!0;Object.defineProperties(this,{$:{value:m}});
|
|
424
|
-
a.
|
|
425
|
-
|
|
426
|
-
[d])});W([b,a,c],d?[d]:[],
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
};Object.defineProperty(m.aa.constructor,a,
|
|
430
|
-
|
|
431
|
-
(Db(
|
|
432
|
-
|
|
433
|
-
{};
|
|
434
|
-
d;break;case "number":d.
|
|
435
|
-
c)=>{function d(
|
|
436
|
-
var
|
|
437
|
-
|
|
438
|
-
case 3:
|
|
439
|
-
w:(b,a,c,d)=>{var e=(new Date).getFullYear(),
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
(function(){function b(){
|
|
425
|
+
Object.assign(Pb.prototype,{Sb(b){this.tb&&(b=this.tb(b));return b},lb(b){this.qa?.(b)},ma:tb,ba:function(b){function a(){return this.Ja?Ob(this.aa.pa,{da:this.cc,ca:c,oa:this,ia:b}):Ob(this.aa.pa,{da:this,ca:b})}var c=this.Sb(b);if(!c)return this.lb(b),null;var d=Nb(this.aa,c);if(void 0!==d){if(0===d.$.count.value)return d.$.ca=c,d.$.ia=b,d.clone();d=d.clone();this.lb(b);return d}d=this.aa.Rb(c);d=Cb[d];if(!d)return a.call(this);d=this.Ia?d.Ib:d.pointerType;var e=Mb(c,this.aa,d.aa);return null===
|
|
426
|
+
e?a.call(this):this.Ja?Ob(d.aa.pa,{da:d,ca:e,oa:this,ia:b}):Ob(d.aa.pa,{da:d,ca:e})}});h.noExitRuntime&&(Za=h.noExitRuntime);h.print&&(ua=h.print);h.printErr&&(va=h.printErr);h.wasmBinary&&(wa=h.wasmBinary);h.thisProgram&&(na=h.thisProgram);if(h.preInit)for("function"==typeof h.preInit&&(h.preInit=[h.preInit]);0<h.preInit.length;)h.preInit.shift()();
|
|
427
|
+
var hb,Gc,gb,Hc,Ma,Rb,Ic={E:()=>Na(""),n:(b,a,c)=>{b=U(b);a=jb(a,"wrapper");c=P(c);var d=a.aa,e=d.pa,k=d.ga.pa,g=d.ga.constructor;b=$a(b,function(...f){for(var m of d.ga.sb)if(this[m]===k[m])throw new cb(`Pure virtual function ${m} must be implemented in JavaScript`);Object.defineProperty(this,"__parent",{value:e});this.__construct(...f)});e.__construct=function(...f){if(this===e)throw new N("Pass correct 'this' to __construct");f=g.implement(this,...f);kb(f);var m=f.$;f.notifyOnDestruction();m.xa=
|
|
428
|
+
!0;Object.defineProperties(this,{$:{value:m}});mb(this);f=m.ca;f=eb(d,f);if(db.hasOwnProperty(f))throw new N(`Tried to register registered instance: ${f}`);db[f]=this};e.__destruct=function(){if(this===e)throw new N("Pass correct 'this' to __destruct");kb(this);var f=this.$.ca;f=eb(d,f);if(db.hasOwnProperty(f))delete db[f];else throw new N(`Tried to unregister unregistered instance: ${f}`);};b.prototype=Object.create(e);Object.assign(b.prototype,c);return T(b)},N:b=>{var a=nb[b];delete nb[b];var c=
|
|
429
|
+
a.Za,d=a.qa,e=a.ob,k=e.map(g=>g.Vb).concat(e.map(g=>g.fc));W([b],k,g=>{var f={},m,n;for([m,n]of e.entries()){const r=g[m],w=n.Tb,z=n.Ub,v=g[m+e.length],x=n.ec,q=n.hc;f[n.Pb]={read:L=>r.ba(w(z,L)),write:(L,I)=>{var u=[];x(q,L,v.ea(u,I));sb(u)},optional:r.optional}}return[{name:a.name,ba:r=>{var w={},z;for(z in f)w[z]=f[z].read(r);d(r);return w},ea:(r,w)=>{for(var z in f)if(!(z in w||f[z].optional))throw new TypeError(`Missing field: "${z}"`);var v=c();for(z in f)f[z].write(v,w[z]);null!==r&&r.push(d,
|
|
430
|
+
v);return v},ma:tb,ka:d}]})},r:(b,a,c,d,e)=>{a=U(a);d=0n===d;let k=g=>g;if(d){const g=8*c;k=f=>BigInt.asUintN(g,f);e=k(e)}V(b,{name:a,ba:k,ea:(g,f)=>{"number"==typeof f&&(f=BigInt(f));return f},ma:yb(a,c,!d),ka:null})},H:(b,a,c,d)=>{a=U(a);V(b,{name:a,ba:function(e){return!!e},ea:function(e,k){return k?c:d},ma:function(e){return this.ba(D[e])},ka:null})},c:(b,a,c,d,e,k,g,f,m,n,r,w,z)=>{r=U(r);k=Y(e,k);f&&=Y(g,f);n&&=Y(m,n);z=Y(w,z);var v=Fb(r);Eb(v,function(){Z(`Cannot construct ${r} due to unbound types`,
|
|
431
|
+
[d])});W([b,a,c],d?[d]:[],x=>{x=x[0];if(d){var q=x.aa;var L=q.pa}else L=Bb.prototype;x=$a(r,function(...K){if(Object.getPrototypeOf(this)!==I)throw new N(`Use 'new' to construct ${r}`);if(void 0===u.ua)throw new N(`${r} has no accessible constructor`);var R=u.ua[K.length];if(void 0===R)throw new N(`Tried to invoke ctor of ${r} with invalid number of parameters (${K.length}) - expected (${Object.keys(u.ua).toString()}) parameters instead!`);return R.apply(this,K)});var I=Object.create(L,{constructor:{value:x}});
|
|
432
|
+
x.prototype=I;var u=new Gb(r,x,I,z,q,k,f,n);if(u.ga){var J;(J=u.ga).Ea??(J.Ea=[]);u.ga.Ea.push(u)}q=new Pb(r,u,!0,!1,!1);J=new Pb(r+"*",u,!1,!1,!1);L=new Pb(r+" const*",u,!1,!0,!1);Cb[b]={pointerType:J,Ib:L};Qb(v,x);return[q,J,L]})},j:(b,a,c,d,e,k,g)=>{var f=Vb(c,d);a=U(a);a=Wb(a);k=Y(e,k);W([],[b],m=>{function n(){Z(`Cannot call ${r} due to unbound types`,f)}m=m[0];var r=`${m.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);var w=m.aa.constructor;void 0===w[a]?(n.ta=c-1,w[a]=n):(Db(w,a,
|
|
433
|
+
r),w[a].fa[c-1]=n);W([],f,z=>{z=Ub(r,[z[0],null].concat(z.slice(1)),null,k,g);void 0===w[a].fa?(z.ta=c-1,w[a]=z):w[a].fa[c-1]=z;if(m.aa.Ea)for(const v of m.aa.Ea)v.constructor.hasOwnProperty(a)||(v.constructor[a]=z);return[]});return[]})},p:(b,a,c,d,e,k,g,f)=>{a=U(a);k=Y(e,k);W([],[b],m=>{m=m[0];var n=`${m.name}.${a}`,r={get(){Z(`Cannot access ${n} due to unbound types`,[c])},enumerable:!0,configurable:!0};r.set=f?()=>{Z(`Cannot access ${n} due to unbound types`,[c])}:()=>{throw new N(`${n} is a read-only property`);
|
|
434
|
+
};Object.defineProperty(m.aa.constructor,a,r);W([],[c],w=>{w=w[0];var z={get(){return w.ba(k(d))},enumerable:!0};f&&(f=Y(g,f),z.set=v=>{var x=[];f(d,w.ea(x,v));sb(x)});Object.defineProperty(m.aa.constructor,a,z);return[]});return[]})},m:(b,a,c,d,e,k)=>{var g=Vb(a,c);e=Y(d,e);W([],[b],f=>{f=f[0];var m=`constructor ${f.name}`;void 0===f.aa.ua&&(f.aa.ua=[]);if(void 0!==f.aa.ua[a-1])throw new N(`Cannot register multiple constructors with identical number of parameters (${a-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
|
|
435
|
+
f.aa.ua[a-1]=()=>{Z(`Cannot construct ${f.name} due to unbound types`,g)};W([],g,n=>{n.splice(1,0,null);f.aa.ua[a-1]=Ub(m,n,null,e,k);return[]});return[]})},a:(b,a,c,d,e,k,g,f)=>{var m=Vb(c,d);a=U(a);a=Wb(a);k=Y(e,k);W([],[b],n=>{function r(){Z(`Cannot call ${w} due to unbound types`,m)}n=n[0];var w=`${n.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);f&&n.aa.sb.push(a);var z=n.aa.pa,v=z[a];void 0===v||void 0===v.fa&&v.className!==n.name&&v.ta===c-2?(r.ta=c-2,r.className=n.name,z[a]=r):
|
|
436
|
+
(Db(z,a,w),z[a].fa[c-2]=r);W([],m,x=>{x=Ub(w,x,n,k,g);void 0===z[a].fa?(x.ta=c-2,z[a]=x):z[a].fa[c-2]=x;return[]});return[]})},b:(b,a,c,d,e,k,g,f,m,n)=>{a=U(a);e=Y(d,e);W([],[b],r=>{r=r[0];var w=`${r.name}.${a}`,z={get(){Z(`Cannot access ${w} due to unbound types`,[c,g])},enumerable:!0,configurable:!0};z.set=m?()=>Z(`Cannot access ${w} due to unbound types`,[c,g]):()=>{throw new N(w+" is a read-only property");};Object.defineProperty(r.aa.pa,a,z);W([],m?[c,g]:[c],v=>{var x=v[0],q={get(){var I=Xb(this,
|
|
437
|
+
r,w+" getter");return x.ba(e(k,I))},enumerable:!0};if(m){m=Y(f,m);var L=v[1];q.set=function(I){var u=Xb(this,r,w+" setter"),J=[];m(n,u,L.ea(J,I));sb(J)}}Object.defineProperty(r.aa.pa,a,q);return[]});return[]})},F:b=>V(b,Zb),l:(b,a,c,d,e)=>{a=U(a);e=0===e?"object":1===e?"number":"string";switch(e){case "object":function g(){}g.values={};V(b,{name:a,constructor:g,valueType:e,ba:function(f){return this.constructor.values[f]},ea:(f,m)=>m.value,ma:$b(a,c,d),ka:null});Eb(a,g);break;case "number":var k=
|
|
438
|
+
{};V(b,{name:a,Ya:k,valueType:e,ba:f=>f,ea:(f,m)=>m,ma:$b(a,c,d),ka:null});Eb(a,k);delete h[a].ta;break;case "string":k={},V(b,{name:a,zb:{},ub:{},Ya:k,valueType:e,ba:function(f){return this.ub[f]},ea:function(f,m){return this.zb[m]},ma:$b(a,c,d),ka:null}),Eb(a,k),delete h[a].ta}},d:(b,a,c)=>{var d=jb(b,"enum");a=U(a);switch(d.valueType){case "object":b=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},constructor:{value:$a(`${d.name}_${a}`,function(){})}});b.values[c]=d;b[a]=
|
|
439
|
+
d;break;case "number":d.Ya[a]=c;break;case "string":d.zb[a]=c,d.ub[c]=a,d.Ya[a]=a}},q:(b,a,c)=>{a=U(a);V(b,{name:a,ba:d=>d,ea:(d,e)=>e,ma:ac(a,c),ka:null})},h:(b,a,c,d,e,k)=>{var g=Vb(a,c);b=U(b);b=Wb(b);e=Y(d,e);Eb(b,function(){Z(`Cannot call ${b} due to unbound types`,g)},a-1);W([],g,f=>{Qb(b,Ub(b,[f[0],null].concat(f.slice(1)),null,e,k),a-1);return[]})},k:(b,a,c,d,e)=>{a=U(a);let k=f=>f;if(0===d){var g=32-8*c;k=f=>f<<g>>>g;e=k(e)}V(b,{name:a,ba:k,ea:(f,m)=>m,ma:yb(a,c,0!==d),ka:null})},i:(b,a,
|
|
440
|
+
c)=>{function d(k){return new e(Ca.buffer,M[k+4>>2],M[k>>2])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][a];c=U(c);V(b,{name:c,ba:d,ma:d},{Wb:!0})},G:(b,a)=>{a=U(a);V(b,{name:a,ba(c){var d=(d=c+4)?kc(D,d,M[c>>2],!0):"";hb(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 N("Cannot pass non-string to std::string");
|
|
441
|
+
var k=e?hc(d):d.length;var g=Gc(4+k+1),f=g+4;M[g>>2]=k;e?bc(d,f,k+1):D.set(d,f);null!==c&&c.push(hb,g);return g},ma:tb,ka(c){hb(c)}})},o:(b,a,c)=>{c=U(c);if(2===a){var d=mc;var e=nc;var k=oc}else d=pc,e=qc,k=rc;V(b,{name:c,ba:g=>{var f=d(g+4,M[g>>2]*a,!0);hb(g);return f},ea:(g,f)=>{if("string"!=typeof f)throw new N(`Cannot pass non-string to C++ string type ${c}`);var m=k(f),n=Gc(4+m+a);M[n>>2]=m/a;e(f,n+4,m+a);null!==g&&g.push(hb,n);return n},ma:tb,ka(g){hb(g)}})},P:(b,a,c,d,e,k)=>{nb[b]={name:U(a),
|
|
442
|
+
Za:Y(c,d),qa:Y(e,k),ob:[]}},O:(b,a,c,d,e,k,g,f,m,n)=>{nb[b].ob.push({Pb:U(a),Vb:c,Tb:Y(d,e),Ub:k,fc:g,ec:Y(f,m),hc:n})},I:(b,a)=>{a=U(a);V(b,{Yb:!0,name:a,ba:()=>{},ea:()=>{}})},u:()=>{Za=!1;sc=0},f:(b,a,c)=>{var [d,...e]=vc(b,a),k=d.ea.bind(d),g=e.map(m=>m.ma.bind(m));b--;var f=Array(b);a=`methodCaller<(${e.map(m=>m.name)}) => ${d.name}>`;return uc($a(a,(m,n,r,w)=>{for(var z=0,v=0;v<b;++v)f[v]=g[v](w+z),z+=8;switch(c){case 0:var x=P(m).apply(null,f);break;case 2:x=Reflect.construct(P(m),f);break;
|
|
443
|
+
case 3:x=f[0];break;case 1:x=P(m)[xc(n)](...f)}m=[];x=k(m,x);m.length&&(M[r>>2]=T(m));return x}))},R:Yb,J:b=>{b=xc(b);return T(h[b])},K:(b,a)=>{b=P(b);a=P(a);return T(b[a])},L:b=>{9<b&&(bb[b+1]+=1)},e:(b,a,c,d,e)=>tc[b](a,c,d,e),M:()=>T([]),s:b=>T(xc(b)),S:()=>T({}),Q:b=>{var a=P(b);sb(a);Yb(b)},g:(b,a,c)=>{b=P(b);a=P(a);c=P(c);b[a]=c},v:(b,a)=>{yc[b]&&(clearTimeout(yc[b].id),delete yc[b]);if(!a)return 0;var c=setTimeout(()=>{delete yc[b];Bc(()=>Hc(b,performance.now()))},a);yc[b]={id:c,kc:a};return 0},
|
|
444
|
+
w:(b,a,c,d)=>{var e=(new Date).getFullYear(),k=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();M[b>>2]=60*Math.max(k,e);Fa[a>>2]=Number(k!=e);a=g=>{var f=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(f/60)).padStart(2,"0")}${String(f%60).padStart(2,"0")}`};b=a(k);a=a(e);e<k?(bc(b,c,17),bc(a,d,17)):(bc(b,d,17),bc(a,c,17))},x:function(b,a,c){if(!(0<=b&&3>=b))return 28;Ia[c>>3]=BigInt(Math.round(1E6*(0===b?Date.now():performance.now())));return 0},y:b=>{var a=
|
|
445
|
+
D.length;b>>>=0;if(2147483648<b)return!1;for(var c=1;4>=c;c*=2){var d=a*(1+.2/c);d=Math.min(d,b+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(b,d)/65536))-Ma.buffer.byteLength+65535)/65536|0;try{Ma.grow(d);La();var e=1;break a}catch(k){}e=void 0}if(e)return!0}return!1},C:(b,a)=>{var c=0,d=0,e;for(e of Ec()){var k=a+c;M[b+d>>2]=k;c+=bc(e,k,Infinity)+1;d+=4}return 0},D:(b,a)=>{var c=Ec();M[b>>2]=c.length;b=0;for(var d of c)b+=hc(d)+1;M[a>>2]=b;return 0},B:()=>52,z:function(){return 70},
|
|
446
|
+
A:(b,a,c,d)=>{for(var e=0,k=0;k<c;k++){var g=M[a>>2],f=M[a+4>>2];a+=8;for(var m=0;m<f;m++){var n=b,r=D[g+m],w=Fc[n];0===r||10===r?((1===n?ua:va)(kc(w)),w.length=0):w.push(r)}e+=f}M[d>>2]=e;return 0},t:Ac},Jc;
|
|
447
|
+
Jc=await (async function(){function b(c){c=Jc=c.exports;hb=c.V;Gc=c.W;gb=c.X;Hc=c.Z;Ma=c.T;Rb=c.Y;La();return Jc}var a={a:Ic};if(h.instantiateWasm)return new Promise(c=>{h.instantiateWasm(a,(d,e)=>{c(b(d,e))})});Oa??=h.locateFile?h.locateFile("canvas_advanced.wasm",oa):oa+"canvas_advanced.wasm";return b((await Ta(a)).instance)}());
|
|
448
|
+
(function(){function b(){h.calledRun=!0;if(!xa){Ka=!0;Jc.U();za?.(h);h.onRuntimeInitialized?.();if(h.postRun)for("function"==typeof h.postRun&&(h.postRun=[h.postRun]);h.postRun.length;){var a=h.postRun.shift();Wa.push(a)}Va(Wa)}}if(h.preRun)for("function"==typeof h.preRun&&(h.preRun=[h.preRun]);h.preRun.length;)Ya();Va(Xa);h.setStatus?(h.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>h.setStatus(""),1);b()},1)):b()})();Ka?moduleRtn=h:moduleRtn=new Promise((b,a)=>{za=b;Ba=a});
|
|
444
449
|
;return moduleRtn}})();
|
|
445
450
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
|
|
446
451
|
|
|
@@ -449,7 +454,7 @@ Hc=await (async function(){function b(c){c=Hc=c.exports;gb=c.V;Ec=c.W;fb=c.X;Fc=
|
|
|
449
454
|
/* 5 */
|
|
450
455
|
/***/ ((module) => {
|
|
451
456
|
|
|
452
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.
|
|
457
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.42.0","description":"A lite version of 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}}');
|
|
453
458
|
|
|
454
459
|
/***/ }),
|
|
455
460
|
/* 6 */
|
|
@@ -458,12 +463,16 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","versi
|
|
|
458
463
|
__webpack_require__.r(__webpack_exports__);
|
|
459
464
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
460
465
|
/* harmony export */ AccessibilityOverlay: () => (/* reexport safe */ _accessibilityOverlay__WEBPACK_IMPORTED_MODULE_1__.AccessibilityOverlay),
|
|
466
|
+
/* harmony export */ CHECK_STATE_MASK: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.CHECK_STATE_MASK),
|
|
467
|
+
/* harmony export */ CHECK_STATE_OFFSET: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.CHECK_STATE_OFFSET),
|
|
461
468
|
/* harmony export */ SemanticActionType: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticActionType),
|
|
469
|
+
/* harmony export */ SemanticCheckState: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticCheckState),
|
|
462
470
|
/* harmony export */ SemanticMode: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticMode),
|
|
463
471
|
/* harmony export */ SemanticRole: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole),
|
|
464
472
|
/* harmony export */ SemanticState: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState),
|
|
465
473
|
/* harmony export */ SemanticTrait: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait),
|
|
466
474
|
/* harmony export */ SemanticTreeModel: () => (/* reexport safe */ _semanticTreeModel__WEBPACK_IMPORTED_MODULE_0__.SemanticTreeModel),
|
|
475
|
+
/* harmony export */ checkStateOf: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.checkStateOf),
|
|
467
476
|
/* harmony export */ hasState: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.hasState),
|
|
468
477
|
/* harmony export */ hasTrait: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.hasTrait),
|
|
469
478
|
/* harmony export */ roleName: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.roleName),
|
|
@@ -928,11 +937,15 @@ function applyGeometry(target, src) {
|
|
|
928
937
|
|
|
929
938
|
__webpack_require__.r(__webpack_exports__);
|
|
930
939
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
940
|
+
/* harmony export */ CHECK_STATE_MASK: () => (/* binding */ CHECK_STATE_MASK),
|
|
941
|
+
/* harmony export */ CHECK_STATE_OFFSET: () => (/* binding */ CHECK_STATE_OFFSET),
|
|
931
942
|
/* harmony export */ SemanticActionType: () => (/* binding */ SemanticActionType),
|
|
943
|
+
/* harmony export */ SemanticCheckState: () => (/* binding */ SemanticCheckState),
|
|
932
944
|
/* harmony export */ SemanticMode: () => (/* binding */ SemanticMode),
|
|
933
945
|
/* harmony export */ SemanticRole: () => (/* binding */ SemanticRole),
|
|
934
946
|
/* harmony export */ SemanticState: () => (/* binding */ SemanticState),
|
|
935
947
|
/* harmony export */ SemanticTrait: () => (/* binding */ SemanticTrait),
|
|
948
|
+
/* harmony export */ checkStateOf: () => (/* binding */ checkStateOf),
|
|
936
949
|
/* harmony export */ hasState: () => (/* binding */ hasState),
|
|
937
950
|
/* harmony export */ hasTrait: () => (/* binding */ hasTrait),
|
|
938
951
|
/* harmony export */ roleName: () => (/* binding */ roleName),
|
|
@@ -967,14 +980,17 @@ var SemanticRole = {
|
|
|
967
980
|
//
|
|
968
981
|
// Bits 0-7 are trait-gated (only meaningful when the corresponding
|
|
969
982
|
// SemanticTrait is set). Bits 8-13 are non-trait states.
|
|
983
|
+
//
|
|
984
|
+
// Check state is the exception: it is a two-bit *field* at bits 2-3 rather
|
|
985
|
+
// than a flag, because a checkbox is tri-state. It is not a member of this
|
|
986
|
+
// table — read it with checkStateOf().
|
|
970
987
|
// ---------------------------------------------------------------------------
|
|
971
988
|
var SemanticState = {
|
|
972
989
|
None: 0,
|
|
973
990
|
// Trait-gated
|
|
974
991
|
Expanded: 1 << 0, // requires Expandable
|
|
975
992
|
Selected: 1 << 1, // requires Selectable
|
|
976
|
-
|
|
977
|
-
Mixed: 1 << 3, // requires Checkable; wins over Checked
|
|
993
|
+
// Bits 2-3 are the check state field, not independent flags -- see SemanticCheckState.
|
|
978
994
|
Toggled: 1 << 4, // requires Toggleable
|
|
979
995
|
Required: 1 << 5, // requires Requirable
|
|
980
996
|
Disabled: 1 << 6, // requires Enablable
|
|
@@ -990,6 +1006,30 @@ var SemanticState = {
|
|
|
990
1006
|
function hasState(flags, state) {
|
|
991
1007
|
return (flags & state) !== 0;
|
|
992
1008
|
}
|
|
1009
|
+
// SemanticCheckState — mirrors rive::SemanticCheckState
|
|
1010
|
+
//
|
|
1011
|
+
// The tri-state of a checkable node. Occupies two bits of stateFlags at
|
|
1012
|
+
// CHECK_STATE_OFFSET, so it is read as a value rather than tested as a flag.
|
|
1013
|
+
// Only meaningful when the Checkable trait is set.
|
|
1014
|
+
var SemanticCheckState = {
|
|
1015
|
+
Unchecked: 0,
|
|
1016
|
+
Checked: 1,
|
|
1017
|
+
Mixed: 2,
|
|
1018
|
+
};
|
|
1019
|
+
/** Bit offset of the check field within stateFlags. */
|
|
1020
|
+
var CHECK_STATE_OFFSET = 2;
|
|
1021
|
+
/** Mask of the check field within stateFlags. */
|
|
1022
|
+
var CHECK_STATE_MASK = 3 << CHECK_STATE_OFFSET;
|
|
1023
|
+
/**
|
|
1024
|
+
* Decodes the check field out of `flags`. The field is two bits. Returns 0, 1, or 2
|
|
1025
|
+
* per the mapping in SemanticCheckState.
|
|
1026
|
+
*/
|
|
1027
|
+
function checkStateOf(flags) {
|
|
1028
|
+
var value = (flags & CHECK_STATE_MASK) >> CHECK_STATE_OFFSET;
|
|
1029
|
+
return value >= SemanticCheckState.Mixed
|
|
1030
|
+
? SemanticCheckState.Mixed
|
|
1031
|
+
: value;
|
|
1032
|
+
}
|
|
993
1033
|
/**
|
|
994
1034
|
* Controls when the instance builds semantic trees and accessibility overlays.
|
|
995
1035
|
*
|
|
@@ -1056,6 +1096,14 @@ function stateNames(flags) {
|
|
|
1056
1096
|
if (flags & bit)
|
|
1057
1097
|
active.push(name_2);
|
|
1058
1098
|
}
|
|
1099
|
+
switch (checkStateOf(flags)) {
|
|
1100
|
+
case SemanticCheckState.Checked:
|
|
1101
|
+
active.push("Checked");
|
|
1102
|
+
break;
|
|
1103
|
+
case SemanticCheckState.Mixed:
|
|
1104
|
+
active.push("Mixed");
|
|
1105
|
+
break;
|
|
1106
|
+
}
|
|
1059
1107
|
return active.join(", ") || "none";
|
|
1060
1108
|
}
|
|
1061
1109
|
function traitNames(flags) {
|
|
@@ -1824,13 +1872,15 @@ var AccessibilityOverlay = /** @class */ (function () {
|
|
|
1824
1872
|
removeAttr(el, "aria-selected");
|
|
1825
1873
|
}
|
|
1826
1874
|
if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Checkable) && ARIA_CHECKED_ROLES.has(role)) {
|
|
1827
|
-
//
|
|
1828
|
-
//
|
|
1829
|
-
|
|
1875
|
+
// Check state is a tri-state field, but not every checkable role
|
|
1876
|
+
// accepts all three values — see ARIA_MIXED_ROLES.
|
|
1877
|
+
var checkState = (0,_types__WEBPACK_IMPORTED_MODULE_0__.checkStateOf)(flags);
|
|
1878
|
+
if (checkState === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticCheckState.Mixed &&
|
|
1879
|
+
ARIA_MIXED_ROLES.has(role)) {
|
|
1830
1880
|
setAttr(el, "aria-checked", "mixed");
|
|
1831
1881
|
}
|
|
1832
1882
|
else {
|
|
1833
|
-
setBoolAttr(el, "aria-checked",
|
|
1883
|
+
setBoolAttr(el, "aria-checked", checkState === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticCheckState.Checked);
|
|
1834
1884
|
}
|
|
1835
1885
|
}
|
|
1836
1886
|
else {
|
|
@@ -2090,6 +2140,15 @@ var ARIA_CHECKED_ROLES = new Set([
|
|
|
2090
2140
|
_types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.radioButton,
|
|
2091
2141
|
_types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.switchControl,
|
|
2092
2142
|
]);
|
|
2143
|
+
/**
|
|
2144
|
+
* aria-checked="mixed": checkbox only. ARIA defines checkbox as three-valued
|
|
2145
|
+
* (true/false/mixed) but radio and switch as two-valued (true/false), so an
|
|
2146
|
+
* indeterminate check state degrades to false for those roles rather than
|
|
2147
|
+
* emitting a value they do not support.
|
|
2148
|
+
*/
|
|
2149
|
+
var ARIA_MIXED_ROLES = new Set([
|
|
2150
|
+
_types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.checkbox,
|
|
2151
|
+
]);
|
|
2093
2152
|
/**
|
|
2094
2153
|
* aria-pressed: button only. switch is a button subclass in ARIA but uses
|
|
2095
2154
|
* aria-checked (not aria-pressed) for its on/off state — it is intentionally
|
|
@@ -2938,14 +2997,26 @@ var __extends = (undefined && undefined.__extends) || (function () {
|
|
|
2938
2997
|
};
|
|
2939
2998
|
})();
|
|
2940
2999
|
var FileFinalizer = /** @class */ (function () {
|
|
2941
|
-
function FileFinalizer(file) {
|
|
3000
|
+
function FileFinalizer(file, session) {
|
|
3001
|
+
if (session === void 0) { session = null; }
|
|
2942
3002
|
this.selfUnref = false;
|
|
2943
3003
|
this._file = file;
|
|
3004
|
+
this._session = session;
|
|
2944
3005
|
}
|
|
2945
3006
|
FileFinalizer.prototype.unref = function () {
|
|
2946
3007
|
if (this._file) {
|
|
2947
3008
|
this._file.unref();
|
|
2948
3009
|
}
|
|
3010
|
+
// After the file, never before: the file's resources belong to the session.
|
|
3011
|
+
if (this._session) {
|
|
3012
|
+
this._session.delete();
|
|
3013
|
+
this._session = null;
|
|
3014
|
+
}
|
|
3015
|
+
};
|
|
3016
|
+
// Disarms the GC path for a file cleanup() already released.
|
|
3017
|
+
FileFinalizer.prototype.release = function () {
|
|
3018
|
+
this._file = null;
|
|
3019
|
+
this._session = null;
|
|
2949
3020
|
};
|
|
2950
3021
|
return FileFinalizer;
|
|
2951
3022
|
}());
|
|
@@ -3029,8 +3100,10 @@ var FontWrapper = /** @class */ (function (_super) {
|
|
|
3029
3100
|
return FontWrapper;
|
|
3030
3101
|
}(AssetWrapper));
|
|
3031
3102
|
var CustomFileAssetLoaderWrapper = /** @class */ (function () {
|
|
3032
|
-
function CustomFileAssetLoaderWrapper(runtime, loaderCallback) {
|
|
3103
|
+
function CustomFileAssetLoaderWrapper(runtime, loaderCallback, session) {
|
|
3104
|
+
if (session === void 0) { session = null; }
|
|
3033
3105
|
this._assetLoaderCallback = loaderCallback;
|
|
3106
|
+
this._session = session;
|
|
3034
3107
|
this.assetLoader = new runtime.CustomFileAssetLoader({
|
|
3035
3108
|
loadContents: this.loadContents.bind(this),
|
|
3036
3109
|
});
|
|
@@ -3038,13 +3111,13 @@ var CustomFileAssetLoaderWrapper = /** @class */ (function () {
|
|
|
3038
3111
|
CustomFileAssetLoaderWrapper.prototype.loadContents = function (asset, bytes) {
|
|
3039
3112
|
var assetWrapper;
|
|
3040
3113
|
if (asset.isImage) {
|
|
3041
|
-
assetWrapper = new ImageAssetWrapper(asset);
|
|
3114
|
+
assetWrapper = new ImageAssetWrapper(asset, this._session);
|
|
3042
3115
|
}
|
|
3043
3116
|
else if (asset.isAudio) {
|
|
3044
|
-
assetWrapper = new AudioAssetWrapper(asset);
|
|
3117
|
+
assetWrapper = new AudioAssetWrapper(asset, this._session);
|
|
3045
3118
|
}
|
|
3046
3119
|
else if (asset.isFont) {
|
|
3047
|
-
assetWrapper = new FontAssetWrapper(asset);
|
|
3120
|
+
assetWrapper = new FontAssetWrapper(asset, this._session);
|
|
3048
3121
|
}
|
|
3049
3122
|
else {
|
|
3050
3123
|
return false;
|
|
@@ -3058,11 +3131,15 @@ var CustomFileAssetLoaderWrapper = /** @class */ (function () {
|
|
|
3058
3131
|
* an asset associated wtih the Rive File
|
|
3059
3132
|
*/
|
|
3060
3133
|
var FileAssetWrapper = /** @class */ (function () {
|
|
3061
|
-
function FileAssetWrapper(nativeAsset) {
|
|
3134
|
+
function FileAssetWrapper(nativeAsset, session) {
|
|
3135
|
+
if (session === void 0) { session = null; }
|
|
3062
3136
|
this._nativeFileAsset = nativeAsset;
|
|
3137
|
+
this._session = session;
|
|
3063
3138
|
}
|
|
3064
3139
|
FileAssetWrapper.prototype.decode = function (bytes) {
|
|
3065
|
-
|
|
3140
|
+
// The session travels with the asset so a deferred file's assets are
|
|
3141
|
+
// session-typed without the caller needing to know the file's rendering mode.
|
|
3142
|
+
this._nativeFileAsset.decode(bytes, this._session);
|
|
3066
3143
|
};
|
|
3067
3144
|
Object.defineProperty(FileAssetWrapper.prototype, "name", {
|
|
3068
3145
|
get: function () {
|
|
@@ -4698,8 +4775,23 @@ var RiveFile = /** @class */ (function () {
|
|
|
4698
4775
|
this.destroyed = false;
|
|
4699
4776
|
this.selfUnref = false;
|
|
4700
4777
|
this.bindableArtboards = [];
|
|
4778
|
+
// Deferred rendering was requested; the session may still be null if this
|
|
4779
|
+
// build has no deferred support.
|
|
4780
|
+
this.deferred = false;
|
|
4781
|
+
// The session this file imported through, null when immediate. Owned here:
|
|
4782
|
+
// it has to outlive the file, so it is deleted after the file is released.
|
|
4783
|
+
this.session = null;
|
|
4784
|
+
// Attaching is once per session: a detached session can never replay again,
|
|
4785
|
+
// so a claimed file re-imports for the next instance implicitly. Mirrors the native
|
|
4786
|
+
// latch (WebGL2DeferredSession::everBound, C2DDeferredSession::claim).
|
|
4787
|
+
this._sessionClaimed = false;
|
|
4788
|
+
// Releasing this file has to be deterministic once a session owns its
|
|
4789
|
+
// resources, so the finalizer is disarmed rather than left to GC.
|
|
4790
|
+
this.fileFinalizer = null;
|
|
4791
|
+
this.boundElsewhereWarned = false;
|
|
4701
4792
|
this.src = params.src;
|
|
4702
4793
|
this.buffer = params.buffer;
|
|
4794
|
+
this.deferred = !!params.enableGPUCanvas;
|
|
4703
4795
|
if (params.assetLoader)
|
|
4704
4796
|
this.assetLoader = params.assetLoader;
|
|
4705
4797
|
this.enableRiveAssetCDN =
|
|
@@ -4717,12 +4809,24 @@ var RiveFile = /** @class */ (function () {
|
|
|
4717
4809
|
this.on(EventType.LoadError, params.onLoadError);
|
|
4718
4810
|
}
|
|
4719
4811
|
RiveFile.prototype.releaseFile = function () {
|
|
4720
|
-
var _a;
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4812
|
+
var _a, _b;
|
|
4813
|
+
// Release here rather than leaving it to the finalization registry. The
|
|
4814
|
+
// native file frees GL-backed resources when its last reference goes, and
|
|
4815
|
+
// callers reach this with the renderer's context current; a finalizer runs
|
|
4816
|
+
// with none, so those deletes would silently do nothing.
|
|
4817
|
+
(_a = this.fileFinalizer) === null || _a === void 0 ? void 0 : _a.release();
|
|
4818
|
+
(_b = this.file) === null || _b === void 0 ? void 0 : _b.unref();
|
|
4819
|
+
this.fileFinalizer = null;
|
|
4724
4820
|
this.file = null;
|
|
4725
4821
|
};
|
|
4822
|
+
RiveFile.prototype.releaseSession = function () {
|
|
4823
|
+
var _a;
|
|
4824
|
+
// Known limitation: cleanup() on a file an instance is still drawing
|
|
4825
|
+
// deletes the session under it. A RiveFile's creator holds no reference of
|
|
4826
|
+
// its own, so their cleanup() can take the count to zero.
|
|
4827
|
+
(_a = this.session) === null || _a === void 0 ? void 0 : _a.delete();
|
|
4828
|
+
this.session = null;
|
|
4829
|
+
};
|
|
4726
4830
|
RiveFile.prototype.releaseBindableArtboards = function () {
|
|
4727
4831
|
this.bindableArtboards.forEach(function (bindableArtboard) {
|
|
4728
4832
|
return bindableArtboard.destroy();
|
|
@@ -4730,7 +4834,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
4730
4834
|
};
|
|
4731
4835
|
RiveFile.prototype.initData = function () {
|
|
4732
4836
|
return __awaiter(this, void 0, void 0, function () {
|
|
4733
|
-
var _a, error_1, loader, loaderWrapper, _b, fileFinalizer;
|
|
4837
|
+
var _a, error_1, loader, loaderWrapper, _b, error_2, fileFinalizer;
|
|
4734
4838
|
return __generator(this, function (_c) {
|
|
4735
4839
|
switch (_c.label) {
|
|
4736
4840
|
case 0:
|
|
@@ -4753,36 +4857,55 @@ var RiveFile = /** @class */ (function () {
|
|
|
4753
4857
|
if (this.destroyed) {
|
|
4754
4858
|
return [2 /*return*/];
|
|
4755
4859
|
}
|
|
4860
|
+
if (this.deferred && this.session === null) {
|
|
4861
|
+
this.session = RiveFile.makeDeferredSession(this.runtime);
|
|
4862
|
+
}
|
|
4756
4863
|
if (this.assetLoader) {
|
|
4757
|
-
loaderWrapper = new _utils__WEBPACK_IMPORTED_MODULE_3__.CustomFileAssetLoaderWrapper(this.runtime, this.assetLoader);
|
|
4864
|
+
loaderWrapper = new _utils__WEBPACK_IMPORTED_MODULE_3__.CustomFileAssetLoaderWrapper(this.runtime, this.assetLoader, this.session);
|
|
4758
4865
|
loader = loaderWrapper.assetLoader;
|
|
4759
4866
|
}
|
|
4760
4867
|
// Load the Rive file
|
|
4761
4868
|
if (this.enablePerfMarks)
|
|
4762
4869
|
performance.mark('rive:file-load:start');
|
|
4763
|
-
|
|
4764
|
-
return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN)];
|
|
4870
|
+
_c.label = 5;
|
|
4765
4871
|
case 5:
|
|
4872
|
+
_c.trys.push([5, 7, , 8]);
|
|
4873
|
+
_b = this;
|
|
4874
|
+
return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN, this.session)];
|
|
4875
|
+
case 6:
|
|
4766
4876
|
_b.file = _c.sent();
|
|
4877
|
+
return [3 /*break*/, 8];
|
|
4878
|
+
case 7:
|
|
4879
|
+
error_2 = _c.sent();
|
|
4880
|
+
// The finalizer that would reclaim the session is only registered once
|
|
4881
|
+
// the import succeeds, so a failed load has to release it here.
|
|
4882
|
+
this.releaseSession();
|
|
4883
|
+
throw error_2;
|
|
4884
|
+
case 8:
|
|
4767
4885
|
if (this.enablePerfMarks) {
|
|
4768
4886
|
performance.mark('rive:file-load:end');
|
|
4769
4887
|
performance.measure('rive:file-load', 'rive:file-load:start', 'rive:file-load:end');
|
|
4770
4888
|
}
|
|
4771
|
-
fileFinalizer = new _utils__WEBPACK_IMPORTED_MODULE_3__.FileFinalizer(this.file);
|
|
4772
|
-
_utils__WEBPACK_IMPORTED_MODULE_3__.finalizationRegistry.register(this, fileFinalizer);
|
|
4773
4889
|
if (this.destroyed) {
|
|
4774
4890
|
this.releaseFile();
|
|
4891
|
+
this.releaseSession();
|
|
4775
4892
|
return [2 /*return*/];
|
|
4776
4893
|
}
|
|
4777
|
-
if (this.file
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
}
|
|
4783
|
-
else {
|
|
4894
|
+
if (this.file === null) {
|
|
4895
|
+
// A malformed file resolves to null rather than rejecting. Release the
|
|
4896
|
+
// session now: a finalizer for a file that does not exist would keep it
|
|
4897
|
+
// alive until GC, or for as long as the caller holds the failed RiveFile.
|
|
4898
|
+
this.releaseSession();
|
|
4784
4899
|
this.fireLoadError(RiveFile.fileLoadErrorMessage);
|
|
4900
|
+
return [2 /*return*/];
|
|
4785
4901
|
}
|
|
4902
|
+
fileFinalizer = new _utils__WEBPACK_IMPORTED_MODULE_3__.FileFinalizer(this.file, this.session);
|
|
4903
|
+
this.fileFinalizer = fileFinalizer;
|
|
4904
|
+
_utils__WEBPACK_IMPORTED_MODULE_3__.finalizationRegistry.register(this, fileFinalizer);
|
|
4905
|
+
this.eventManager.fire({
|
|
4906
|
+
type: EventType.Load,
|
|
4907
|
+
data: this,
|
|
4908
|
+
});
|
|
4786
4909
|
return [2 /*return*/];
|
|
4787
4910
|
}
|
|
4788
4911
|
});
|
|
@@ -4826,7 +4949,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
4826
4949
|
};
|
|
4827
4950
|
RiveFile.prototype.init = function () {
|
|
4828
4951
|
return __awaiter(this, void 0, void 0, function () {
|
|
4829
|
-
var _a, bufferResolved, runtimeResolved,
|
|
4952
|
+
var _a, bufferResolved, runtimeResolved, error_3;
|
|
4830
4953
|
return __generator(this, function (_b) {
|
|
4831
4954
|
switch (_b.label) {
|
|
4832
4955
|
case 0:
|
|
@@ -4858,8 +4981,8 @@ var RiveFile = /** @class */ (function () {
|
|
|
4858
4981
|
}
|
|
4859
4982
|
return [3 /*break*/, 5];
|
|
4860
4983
|
case 4:
|
|
4861
|
-
|
|
4862
|
-
this.fireLoadError(
|
|
4984
|
+
error_3 = _b.sent();
|
|
4985
|
+
this.fireLoadError(error_3 instanceof Error ? error_3.message : RiveFile.fileLoadErrorMessage);
|
|
4863
4986
|
return [3 /*break*/, 5];
|
|
4864
4987
|
case 5: return [2 /*return*/];
|
|
4865
4988
|
}
|
|
@@ -4901,9 +5024,99 @@ var RiveFile = /** @class */ (function () {
|
|
|
4901
5024
|
this.removeAllRiveEventListeners();
|
|
4902
5025
|
this.releaseFile();
|
|
4903
5026
|
this.releaseBindableArtboards();
|
|
5027
|
+
// Everything imported through the session is gone; the session can go.
|
|
5028
|
+
this.releaseSession();
|
|
4904
5029
|
this.destroyed = true;
|
|
4905
5030
|
}
|
|
4906
5031
|
};
|
|
5032
|
+
// Deferred is only compiled into some runtime builds, so feature detect it
|
|
5033
|
+
// and degrade to an immediate import rather than failing the load.
|
|
5034
|
+
RiveFile.makeDeferredSession = function (runtime) {
|
|
5035
|
+
var _a, _b;
|
|
5036
|
+
var session = (_b = (_a = runtime.makeDeferredSession) === null || _a === void 0 ? void 0 : _a.call(runtime)) !== null && _b !== void 0 ? _b : null;
|
|
5037
|
+
if (session === null && !RiveFile.deferredUnsupportedWarned) {
|
|
5038
|
+
RiveFile.deferredUnsupportedWarned = true;
|
|
5039
|
+
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.");
|
|
5040
|
+
}
|
|
5041
|
+
return session;
|
|
5042
|
+
};
|
|
5043
|
+
Object.defineProperty(RiveFile.prototype, "deferredSession", {
|
|
5044
|
+
/**
|
|
5045
|
+
* @internal The deferred session this file imported through, or null if it
|
|
5046
|
+
* was imported in immediate mode.
|
|
5047
|
+
*/
|
|
5048
|
+
get: function () {
|
|
5049
|
+
return this.session;
|
|
5050
|
+
},
|
|
5051
|
+
enumerable: false,
|
|
5052
|
+
configurable: true
|
|
5053
|
+
});
|
|
5054
|
+
Object.defineProperty(RiveFile.prototype, "deferredRequested", {
|
|
5055
|
+
/**
|
|
5056
|
+
* @internal Whether deferred was asked for, even when this build could not
|
|
5057
|
+
* honor it and imported immediate.
|
|
5058
|
+
*/
|
|
5059
|
+
get: function () {
|
|
5060
|
+
return this.deferred;
|
|
5061
|
+
},
|
|
5062
|
+
enumerable: false,
|
|
5063
|
+
configurable: true
|
|
5064
|
+
});
|
|
5065
|
+
Object.defineProperty(RiveFile.prototype, "sessionClaimed", {
|
|
5066
|
+
/**
|
|
5067
|
+
* @internal Whether this file's session has ever been attached to a renderer.
|
|
5068
|
+
* Attaching is once per session, so a claimed file re-imports for the next
|
|
5069
|
+
* instance even after the renderer it was bound to is gone.
|
|
5070
|
+
*/
|
|
5071
|
+
get: function () {
|
|
5072
|
+
return this._sessionClaimed;
|
|
5073
|
+
},
|
|
5074
|
+
enumerable: false,
|
|
5075
|
+
configurable: true
|
|
5076
|
+
});
|
|
5077
|
+
/**
|
|
5078
|
+
* @internal Marks this file's session as spent. There is no matching release:
|
|
5079
|
+
* a session that has been attached can never replay for another renderer.
|
|
5080
|
+
*/
|
|
5081
|
+
RiveFile.prototype.claimSession = function () {
|
|
5082
|
+
this._sessionClaimed = true;
|
|
5083
|
+
};
|
|
5084
|
+
/**
|
|
5085
|
+
* @internal One warning per file however many instances collide on it.
|
|
5086
|
+
*/
|
|
5087
|
+
RiveFile.prototype.warnBoundElsewhereOnce = function () {
|
|
5088
|
+
if (this.boundElsewhereWarned) {
|
|
5089
|
+
return;
|
|
5090
|
+
}
|
|
5091
|
+
this.boundElsewhereWarned = true;
|
|
5092
|
+
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).");
|
|
5093
|
+
};
|
|
5094
|
+
/**
|
|
5095
|
+
* @internal Re-imports this file from its retained buffer into a mode of its
|
|
5096
|
+
* own. The copy is owned by whoever asked for it and never joins this file's
|
|
5097
|
+
* reference count.
|
|
5098
|
+
*/
|
|
5099
|
+
RiveFile.prototype.reimport = function (deferred) {
|
|
5100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5101
|
+
var copy;
|
|
5102
|
+
return __generator(this, function (_a) {
|
|
5103
|
+
switch (_a.label) {
|
|
5104
|
+
case 0:
|
|
5105
|
+
copy = new RiveFile({
|
|
5106
|
+
buffer: this.buffer,
|
|
5107
|
+
assetLoader: this.assetLoader,
|
|
5108
|
+
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
5109
|
+
enablePerfMarks: this.enablePerfMarks,
|
|
5110
|
+
enableGPUCanvas: deferred,
|
|
5111
|
+
});
|
|
5112
|
+
return [4 /*yield*/, copy.init()];
|
|
5113
|
+
case 1:
|
|
5114
|
+
_a.sent();
|
|
5115
|
+
return [2 /*return*/, copy];
|
|
5116
|
+
}
|
|
5117
|
+
});
|
|
5118
|
+
});
|
|
5119
|
+
};
|
|
4907
5120
|
/**
|
|
4908
5121
|
* Unsubscribes all Rive listeners from an event type, or everything if no type is
|
|
4909
5122
|
* given
|
|
@@ -4974,6 +5187,8 @@ var RiveFile = /** @class */ (function () {
|
|
|
4974
5187
|
RiveFile.missingErrorMessage = "Rive source file or data buffer required";
|
|
4975
5188
|
// Error message for file load error
|
|
4976
5189
|
RiveFile.fileLoadErrorMessage = "The file failed to load";
|
|
5190
|
+
// Deferred support is per build, so the warning is per page, not per file.
|
|
5191
|
+
RiveFile.deferredUnsupportedWarned = false;
|
|
4977
5192
|
return RiveFile;
|
|
4978
5193
|
}());
|
|
4979
5194
|
|
|
@@ -4995,6 +5210,13 @@ var Rive = /** @class */ (function () {
|
|
|
4995
5210
|
* and start.
|
|
4996
5211
|
*/
|
|
4997
5212
|
this.readyForPlaying = false;
|
|
5213
|
+
// Deferred rendering was requested for this instance. The file it renders
|
|
5214
|
+
// has the final say, since a file's mode is fixed at import.
|
|
5215
|
+
this.deferredRenderer = false;
|
|
5216
|
+
// Whether this instance imported the file in `riveFile` (true) or the caller
|
|
5217
|
+
// supplied it (false). Only a file we imported may be released without a
|
|
5218
|
+
// matching getInstance(): a caller's file is theirs however this init ends.
|
|
5219
|
+
this.ownsRiveFile = false;
|
|
4998
5220
|
// Runtime artboard
|
|
4999
5221
|
this.artboard = null;
|
|
5000
5222
|
// place to clear up pointer/touch event listeners
|
|
@@ -5129,6 +5351,7 @@ var Rive = /** @class */ (function () {
|
|
|
5129
5351
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.enablePerfMarks = true;
|
|
5130
5352
|
this._focusOptions = (_c = params.focusOptions) !== null && _c !== void 0 ? _c : this._focusOptions;
|
|
5131
5353
|
this._tabIndex = (_d = params.tabIndex) !== null && _d !== void 0 ? _d : null;
|
|
5354
|
+
this.deferredRenderer = !!params.enableGPUCanvas;
|
|
5132
5355
|
// New event management system
|
|
5133
5356
|
this.eventManager = new EventManager();
|
|
5134
5357
|
if (params.onLoad)
|
|
@@ -5185,6 +5408,7 @@ var Rive = /** @class */ (function () {
|
|
|
5185
5408
|
tabIndex: params.tabIndex,
|
|
5186
5409
|
semanticsMode: params.semanticsMode,
|
|
5187
5410
|
semanticsOptions: params.semanticsOptions,
|
|
5411
|
+
enableGPUCanvas: this.deferredRenderer,
|
|
5188
5412
|
});
|
|
5189
5413
|
}
|
|
5190
5414
|
Object.defineProperty(Rive.prototype, "viewModelCount", {
|
|
@@ -5244,26 +5468,52 @@ var Rive = /** @class */ (function () {
|
|
|
5244
5468
|
// Initializes the Rive object either from constructor or load()
|
|
5245
5469
|
Rive.prototype.init = function (_a) {
|
|
5246
5470
|
var _this = this;
|
|
5247
|
-
var
|
|
5471
|
+
var _b, _c, _d, _e, _f;
|
|
5472
|
+
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;
|
|
5248
5473
|
if (this.destroyed) {
|
|
5249
5474
|
return;
|
|
5250
5475
|
}
|
|
5476
|
+
// Validated before any state changes, so a call with no source leaves a
|
|
5477
|
+
// running instance untouched.
|
|
5478
|
+
if (!src && !buffer && !riveFile) {
|
|
5479
|
+
throw new RiveError(Rive.missingErrorMessage);
|
|
5480
|
+
}
|
|
5481
|
+
// Reload releases the outgoing file in the same order cleanup() uses:
|
|
5482
|
+
// artboard, then the renderer's session, then the file. The artboard goes
|
|
5483
|
+
// first because it holds an rcp<File> and its resources came from the
|
|
5484
|
+
// session about to be released. stop() has already deleted the animation
|
|
5485
|
+
// and state machine instances; reload deliberately skips cleanupInstances(),
|
|
5486
|
+
// which would also drop the event listeners load() keeps in place.
|
|
5487
|
+
if (this.artboard) {
|
|
5488
|
+
// Free GPU-backed resources with their own context current. No-op on
|
|
5489
|
+
// the canvas2d build.
|
|
5490
|
+
(_c = (_b = this.renderer) === null || _b === void 0 ? void 0 : _b.bindContext) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
5491
|
+
(_d = this.animator) === null || _d === void 0 ? void 0 : _d.stop();
|
|
5492
|
+
this.artboard.delete();
|
|
5493
|
+
this.artboard = null;
|
|
5494
|
+
}
|
|
5495
|
+
// Detach before the session is deleted: the handle dies with it.
|
|
5496
|
+
if (this.renderer) {
|
|
5497
|
+
(_f = (_e = this.renderer).detachSession) === null || _f === void 0 ? void 0 : _f.call(_e);
|
|
5498
|
+
}
|
|
5499
|
+
this.releaseCurrentRiveFile(/* isTeardown */ false);
|
|
5251
5500
|
this.src = src;
|
|
5252
5501
|
this.buffer = buffer;
|
|
5253
5502
|
this.riveFile = riveFile;
|
|
5503
|
+
// initData flips this if it ends up importing the file itself.
|
|
5504
|
+
this.ownsRiveFile = false;
|
|
5505
|
+
// Sticky across reloads so a constructor-set flag survives; an explicit
|
|
5506
|
+
// `false` still turns it off.
|
|
5507
|
+
this.deferredRenderer = enableGPUCanvas !== null && enableGPUCanvas !== void 0 ? enableGPUCanvas : this.deferredRenderer;
|
|
5254
5508
|
this._tabIndex = tabIndex !== null && tabIndex !== void 0 ? tabIndex : null;
|
|
5255
5509
|
this.semanticsMode = semanticsMode !== null && semanticsMode !== void 0 ? semanticsMode : _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticMode.Disabled;
|
|
5256
5510
|
this.semanticsOptions = semanticsOptions !== null && semanticsOptions !== void 0 ? semanticsOptions : this.semanticsOptions;
|
|
5257
|
-
// If no source file url specified, it's a bust
|
|
5258
|
-
if (!this.src && !this.buffer && !this.riveFile) {
|
|
5259
|
-
throw new RiveError(Rive.missingErrorMessage);
|
|
5260
|
-
}
|
|
5261
5511
|
// Names of the animations and state machines that should be initialized
|
|
5262
|
-
var
|
|
5512
|
+
var _k = resolveStartingPlayback({
|
|
5263
5513
|
stateMachine: stateMachine,
|
|
5264
5514
|
animations: animations,
|
|
5265
5515
|
stateMachines: stateMachines,
|
|
5266
|
-
}), startingAnimationNames =
|
|
5516
|
+
}), startingAnimationNames = _k.startingAnimationNames, startingStateMachineNames = _k.startingStateMachineNames;
|
|
5267
5517
|
// Ensure loaded is marked as false if loading new file
|
|
5268
5518
|
this.loaded = false;
|
|
5269
5519
|
this.readyForPlaying = false;
|
|
@@ -5283,6 +5533,8 @@ var Rive = /** @class */ (function () {
|
|
|
5283
5533
|
if (_this.enablePerfMarks)
|
|
5284
5534
|
performance.mark('rive:make-renderer:start');
|
|
5285
5535
|
try {
|
|
5536
|
+
// Always immediate at creation; a deferred file attaches its session
|
|
5537
|
+
// to this renderer once the file has loaded.
|
|
5286
5538
|
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
|
|
5287
5539
|
if (!_this.renderer) {
|
|
5288
5540
|
throw new Error("Renderer is null, cannot render Rive on the canvas.");
|
|
@@ -5435,32 +5687,52 @@ var Rive = /** @class */ (function () {
|
|
|
5435
5687
|
// Returns true for successful initialization.
|
|
5436
5688
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
5437
5689
|
return __awaiter(this, void 0, void 0, function () {
|
|
5438
|
-
var riveFile,
|
|
5439
|
-
var _a;
|
|
5440
|
-
return __generator(this, function (
|
|
5441
|
-
switch (
|
|
5690
|
+
var riveFile, error_4, msg;
|
|
5691
|
+
var _a, _b;
|
|
5692
|
+
return __generator(this, function (_c) {
|
|
5693
|
+
switch (_c.label) {
|
|
5442
5694
|
case 0:
|
|
5443
|
-
|
|
5444
|
-
|
|
5695
|
+
_c.trys.push([0, 5, , 6]);
|
|
5696
|
+
// A caller-supplied riveFile is theirs to release; one we import here is
|
|
5697
|
+
// ours, which matters if a deferred fallback replaces it below.
|
|
5698
|
+
this.ownsRiveFile = this.riveFile == null;
|
|
5699
|
+
if (!this.ownsRiveFile) return [3 /*break*/, 2];
|
|
5445
5700
|
riveFile = new RiveFile({
|
|
5446
5701
|
src: this.src,
|
|
5447
5702
|
buffer: this.buffer,
|
|
5448
5703
|
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
5449
5704
|
assetLoader: this.assetLoader,
|
|
5450
5705
|
enablePerfMarks: this.enablePerfMarks,
|
|
5706
|
+
// The instance owns this file, so its flag is the file's flag.
|
|
5707
|
+
enableGPUCanvas: this.deferredRenderer,
|
|
5451
5708
|
});
|
|
5452
5709
|
this.riveFile = riveFile;
|
|
5453
5710
|
return [4 /*yield*/, riveFile.init()];
|
|
5454
5711
|
case 1:
|
|
5455
|
-
|
|
5712
|
+
_c.sent();
|
|
5456
5713
|
if (this.destroyed) {
|
|
5457
5714
|
// In the very unlikely scenario where the rive file created by this Rive is shared by
|
|
5458
5715
|
// another rive file, we only want to destroy it if this file is the only owner.
|
|
5459
5716
|
riveFile.destroyIfUnused();
|
|
5460
5717
|
return [2 /*return*/, false];
|
|
5461
5718
|
}
|
|
5462
|
-
|
|
5719
|
+
_c.label = 2;
|
|
5463
5720
|
case 2:
|
|
5721
|
+
if (!(this.riveFile.deferredSession !== null || this.deferredRenderer)) return [3 /*break*/, 4];
|
|
5722
|
+
return [4 /*yield*/, this.resolveDeferredRendering()];
|
|
5723
|
+
case 3:
|
|
5724
|
+
_c.sent();
|
|
5725
|
+
if (this.destroyed) {
|
|
5726
|
+
// cleanup() ran during a re-import. Taking a reference now would
|
|
5727
|
+
// resurrect a file this instance is never going to draw. Only ours
|
|
5728
|
+
// to release — a caller-supplied file stays theirs.
|
|
5729
|
+
if (this.ownsRiveFile) {
|
|
5730
|
+
(_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.destroyIfUnused();
|
|
5731
|
+
}
|
|
5732
|
+
return [2 /*return*/, false];
|
|
5733
|
+
}
|
|
5734
|
+
_c.label = 4;
|
|
5735
|
+
case 4:
|
|
5464
5736
|
this.file = this.riveFile.getInstance();
|
|
5465
5737
|
// Initialize and draw frame
|
|
5466
5738
|
this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay, autoBind);
|
|
@@ -5479,7 +5751,7 @@ var Rive = /** @class */ (function () {
|
|
|
5479
5751
|
this.loaded = true;
|
|
5480
5752
|
this.eventManager.fire({
|
|
5481
5753
|
type: EventType.Load,
|
|
5482
|
-
data: (
|
|
5754
|
+
data: (_b = this.src) !== null && _b !== void 0 ? _b : "buffer",
|
|
5483
5755
|
});
|
|
5484
5756
|
}
|
|
5485
5757
|
catch (e) {
|
|
@@ -5497,12 +5769,114 @@ var Rive = /** @class */ (function () {
|
|
|
5497
5769
|
this.taskQueue.process();
|
|
5498
5770
|
this.drawFrame();
|
|
5499
5771
|
return [2 /*return*/, true];
|
|
5500
|
-
case
|
|
5501
|
-
|
|
5502
|
-
msg = resolveErrorMessage(
|
|
5772
|
+
case 5:
|
|
5773
|
+
error_4 = _c.sent();
|
|
5774
|
+
msg = resolveErrorMessage(error_4);
|
|
5503
5775
|
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
5504
5776
|
return [2 /*return*/, Promise.reject(msg)];
|
|
5505
|
-
case
|
|
5777
|
+
case 6: return [2 /*return*/];
|
|
5778
|
+
}
|
|
5779
|
+
});
|
|
5780
|
+
});
|
|
5781
|
+
};
|
|
5782
|
+
/**
|
|
5783
|
+
* Settles which rendering mode this Rive instance runs in. The file dictates: its rendering mode
|
|
5784
|
+
* is fixed at import, and an immediate renderer silently drops a deferred
|
|
5785
|
+
* file's resources. Every mismatch warns and degrades to something that
|
|
5786
|
+
* renders, so users shouldn't have a blank canvas. A fallback self-reimport replaces `this.riveFile`;
|
|
5787
|
+
* only a file this instance imported is released when that happens.
|
|
5788
|
+
*/
|
|
5789
|
+
Rive.prototype.resolveDeferredRendering = function () {
|
|
5790
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5791
|
+
var file, ownsFile, renderer, session, attachSession, immediate, copy, copySession, fallback;
|
|
5792
|
+
var _a;
|
|
5793
|
+
return __generator(this, function (_b) {
|
|
5794
|
+
switch (_b.label) {
|
|
5795
|
+
case 0:
|
|
5796
|
+
file = this.riveFile;
|
|
5797
|
+
ownsFile = this.ownsRiveFile;
|
|
5798
|
+
renderer = this.renderer;
|
|
5799
|
+
session = file.deferredSession;
|
|
5800
|
+
if (session === null) {
|
|
5801
|
+
// No second warning when the file asked for deferred and the build
|
|
5802
|
+
// could not honor it; the unsupported-build warning already fired, and
|
|
5803
|
+
// telling the user to set a flag they set would mislead.
|
|
5804
|
+
if (this.deferredRenderer && !file.deferredRequested) {
|
|
5805
|
+
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.");
|
|
5806
|
+
}
|
|
5807
|
+
return [2 /*return*/];
|
|
5808
|
+
}
|
|
5809
|
+
if (!this.deferredRenderer) {
|
|
5810
|
+
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.");
|
|
5811
|
+
}
|
|
5812
|
+
attachSession = renderer === null || renderer === void 0 ? void 0 : renderer.attachSession;
|
|
5813
|
+
if (!(typeof attachSession !== "function")) return [3 /*break*/, 2];
|
|
5814
|
+
// Offscreen renderers share one context across canvases, which a session
|
|
5815
|
+
// cannot record for. An immediate copy of the file still renders.
|
|
5816
|
+
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.");
|
|
5817
|
+
return [4 /*yield*/, file.reimport(false)];
|
|
5818
|
+
case 1:
|
|
5819
|
+
immediate = _b.sent();
|
|
5820
|
+
if (this.destroyed) {
|
|
5821
|
+
// cleanup() ran while we were importing; nothing will use this copy.
|
|
5822
|
+
immediate.destroyIfUnused();
|
|
5823
|
+
return [2 /*return*/];
|
|
5824
|
+
}
|
|
5825
|
+
this.riveFile = immediate;
|
|
5826
|
+
this.ownsRiveFile = true;
|
|
5827
|
+
if (ownsFile) {
|
|
5828
|
+
// Nothing else can reach the deferred import we just walked away from.
|
|
5829
|
+
file.destroyIfUnused();
|
|
5830
|
+
}
|
|
5831
|
+
return [2 /*return*/];
|
|
5832
|
+
case 2:
|
|
5833
|
+
// Never re-offered once claimed, even if that renderer is gone: the
|
|
5834
|
+
// resources the session's stream refers to died with it.
|
|
5835
|
+
if (!file.sessionClaimed && attachSession.call(renderer, session)) {
|
|
5836
|
+
file.claimSession();
|
|
5837
|
+
return [2 /*return*/];
|
|
5838
|
+
}
|
|
5839
|
+
// Bound to another instance. Re-import from the retained buffer into a
|
|
5840
|
+
// session of our own.
|
|
5841
|
+
file.warnBoundElsewhereOnce();
|
|
5842
|
+
return [4 /*yield*/, file.reimport(true)];
|
|
5843
|
+
case 3:
|
|
5844
|
+
copy = _b.sent();
|
|
5845
|
+
if (this.destroyed) {
|
|
5846
|
+
// The renderer was deleted while we imported; attaching to it would hand
|
|
5847
|
+
// embind a deleted object.
|
|
5848
|
+
copy.destroyIfUnused();
|
|
5849
|
+
return [2 /*return*/];
|
|
5850
|
+
}
|
|
5851
|
+
this.riveFile = copy;
|
|
5852
|
+
this.ownsRiveFile = true;
|
|
5853
|
+
copySession = copy.deferredSession;
|
|
5854
|
+
if (copySession !== null && attachSession.call(renderer, copySession)) {
|
|
5855
|
+
copy.claimSession();
|
|
5856
|
+
return [2 /*return*/];
|
|
5857
|
+
}
|
|
5858
|
+
// The copy's session could not take this canvas either (this renderer
|
|
5859
|
+
// already holds one). An immediate re-import still renders; a deferred file
|
|
5860
|
+
// on an immediate renderer would drop its resources and draw nothing.
|
|
5861
|
+
console.warn("Rive: could not attach the re-imported file's deferred session to this canvas; falling back to immediate rendering for this instance.");
|
|
5862
|
+
// If a leftover session is why the attach failed, it would keep routing
|
|
5863
|
+
// the immediate file's draws into its recorder, which drops them.
|
|
5864
|
+
(_a = renderer.detachSession) === null || _a === void 0 ? void 0 : _a.call(renderer);
|
|
5865
|
+
return [4 /*yield*/, file.reimport(false)];
|
|
5866
|
+
case 4:
|
|
5867
|
+
fallback = _b.sent();
|
|
5868
|
+
// The deferred copy was only ever ours, so it always goes.
|
|
5869
|
+
copy.destroyIfUnused();
|
|
5870
|
+
if (this.destroyed) {
|
|
5871
|
+
fallback.destroyIfUnused();
|
|
5872
|
+
return [2 /*return*/];
|
|
5873
|
+
}
|
|
5874
|
+
this.riveFile = fallback;
|
|
5875
|
+
this.ownsRiveFile = true;
|
|
5876
|
+
if (ownsFile) {
|
|
5877
|
+
file.destroyIfUnused();
|
|
5878
|
+
}
|
|
5879
|
+
return [2 /*return*/];
|
|
5506
5880
|
}
|
|
5507
5881
|
});
|
|
5508
5882
|
});
|
|
@@ -5597,6 +5971,13 @@ var Rive = /** @class */ (function () {
|
|
|
5597
5971
|
}
|
|
5598
5972
|
return changed;
|
|
5599
5973
|
};
|
|
5974
|
+
// Content the artboard's change flag cannot see: ore and GPU canvas commands
|
|
5975
|
+
// scripts record straight into the session. Must be read before the renderer
|
|
5976
|
+
// clears — clearing marks the stream, so a later read is true every frame.
|
|
5977
|
+
Rive.prototype._deferredWorkPending = function () {
|
|
5978
|
+
var _a, _b, _c;
|
|
5979
|
+
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;
|
|
5980
|
+
};
|
|
5600
5981
|
/**
|
|
5601
5982
|
* Poll focus state each frame to see if we should focus/blur the canvas in case
|
|
5602
5983
|
* Rive internally updated focus outside of user interaction (e.g., via listener action)
|
|
@@ -5806,6 +6187,11 @@ var Rive = /** @class */ (function () {
|
|
|
5806
6187
|
Rive.prototype.draw = function (time, onSecond) {
|
|
5807
6188
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
5808
6189
|
this.frameRequestId = null;
|
|
6190
|
+
// load() tears the artboard down and re-inits asynchronously; a frame
|
|
6191
|
+
// queued before that lands here with nothing to draw.
|
|
6192
|
+
if (!this.artboard) {
|
|
6193
|
+
return;
|
|
6194
|
+
}
|
|
5809
6195
|
var before = performance.now();
|
|
5810
6196
|
// Instrument the first 3 frames so the Performance timeline shows precise
|
|
5811
6197
|
// per-call latency for advance, draw, and flush without polluting the trace.
|
|
@@ -5827,9 +6213,13 @@ var Rive = /** @class */ (function () {
|
|
|
5827
6213
|
var renderer = this.renderer;
|
|
5828
6214
|
// Do not draw on 0 canvas size
|
|
5829
6215
|
if (!this._hasZeroSize) {
|
|
5830
|
-
// If there was no dirt on this frame, do not clear and draw
|
|
6216
|
+
// If there was no dirt on this frame, do not clear and draw. The deferred
|
|
6217
|
+
// term has to be read here, before `clear()` below: clearing opens the
|
|
6218
|
+
// session's recording window and marks its stream, so a read taken after
|
|
6219
|
+
// it reports every frame as dirty and nothing is ever skipped.
|
|
5831
6220
|
if (this.drawOptimization == DrawOptimizationOptions.AlwaysDraw ||
|
|
5832
6221
|
this.artboard.didChange() ||
|
|
6222
|
+
this._deferredWorkPending() ||
|
|
5833
6223
|
this._needsRedraw ||
|
|
5834
6224
|
this._canvasSizeChanged()) {
|
|
5835
6225
|
// Canvas must be wiped to prevent artifacts
|
|
@@ -5927,7 +6317,7 @@ var Rive = /** @class */ (function () {
|
|
|
5927
6317
|
* Rive class
|
|
5928
6318
|
*/
|
|
5929
6319
|
Rive.prototype.cleanup = function () {
|
|
5930
|
-
var _a, _b, _c, _d;
|
|
6320
|
+
var _a, _b, _c, _d, _e;
|
|
5931
6321
|
this.destroyed = true;
|
|
5932
6322
|
// Stop the renderer if it hasn't already been stopped.
|
|
5933
6323
|
this.stopRendering();
|
|
@@ -5943,10 +6333,14 @@ var Rive = /** @class */ (function () {
|
|
|
5943
6333
|
observers.remove(this._observed);
|
|
5944
6334
|
}
|
|
5945
6335
|
this.removeRiveListeners();
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
6336
|
+
// The file and its session go before the renderer: the session's replay
|
|
6337
|
+
// state lives in the renderer's context. But the renderer must let go of
|
|
6338
|
+
// the session first — its detach handle dies with session.delete(), and a
|
|
6339
|
+
// later detach would pass embind a deleted object.
|
|
6340
|
+
if (this.renderer) {
|
|
6341
|
+
(_d = (_c = this.renderer).detachSession) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
6342
|
+
}
|
|
6343
|
+
this.releaseCurrentRiveFile(/* isTeardown */ true);
|
|
5950
6344
|
this.riveFile = null;
|
|
5951
6345
|
this.deleteRiveRenderer();
|
|
5952
6346
|
if (this._audioEventListener !== null) {
|
|
@@ -5957,21 +6351,65 @@ var Rive = /** @class */ (function () {
|
|
|
5957
6351
|
document.removeEventListener('visibilitychange', this._pageVisibilityHandler);
|
|
5958
6352
|
this._pageVisibilityHandler = null;
|
|
5959
6353
|
}
|
|
5960
|
-
(
|
|
6354
|
+
(_e = this._viewModelInstance) === null || _e === void 0 ? void 0 : _e.cleanup();
|
|
5961
6355
|
this._viewModelInstance = null;
|
|
5962
6356
|
this._globalViewModelInstances.forEach(function (instance) { return instance.cleanup(); });
|
|
5963
6357
|
this._globalViewModelInstances.clear();
|
|
5964
6358
|
this._dataEnums = null;
|
|
5965
6359
|
};
|
|
6360
|
+
/**
|
|
6361
|
+
* Drops this instance's hold on `this.riveFile`. A reference taken through
|
|
6362
|
+
* getInstance() is given back; a file we imported but never referenced is
|
|
6363
|
+
* released outright so its session goes with it. A caller-supplied file we
|
|
6364
|
+
* never referenced is left alone.
|
|
6365
|
+
*
|
|
6366
|
+
* `isTeardown` distinguishes cleanup() from a reload. Teardown always hands
|
|
6367
|
+
* the reference back, as it always has. A reload must not do that for a
|
|
6368
|
+
* caller-supplied file: a RiveFile carries no reference for its creator, so
|
|
6369
|
+
* releasing here would take the last one and destroy a file the caller still
|
|
6370
|
+
* holds.
|
|
6371
|
+
*/
|
|
6372
|
+
Rive.prototype.releaseCurrentRiveFile = function (isTeardown) {
|
|
6373
|
+
var _a, _b;
|
|
6374
|
+
if (this.file) {
|
|
6375
|
+
if (isTeardown || this.ownsRiveFile) {
|
|
6376
|
+
(_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
6377
|
+
}
|
|
6378
|
+
this.file = null;
|
|
6379
|
+
}
|
|
6380
|
+
else if (this.ownsRiveFile) {
|
|
6381
|
+
(_b = this.riveFile) === null || _b === void 0 ? void 0 : _b.destroyIfUnused();
|
|
6382
|
+
}
|
|
6383
|
+
};
|
|
5966
6384
|
/**
|
|
5967
6385
|
* Cleans up the Renderer object. Only call this API if you no longer
|
|
5968
6386
|
* need to render Rive content in your session.
|
|
5969
6387
|
*/
|
|
5970
6388
|
Rive.prototype.deleteRiveRenderer = function () {
|
|
5971
|
-
var _a;
|
|
5972
|
-
(
|
|
6389
|
+
var _a, _b;
|
|
6390
|
+
if (this.renderer) {
|
|
6391
|
+
// A session outliving this renderer has to stop pointing at it, and its
|
|
6392
|
+
// replay state has to drop while this context is still alive. No-op when
|
|
6393
|
+
// nothing was ever attached.
|
|
6394
|
+
(_b = (_a = this.renderer).detachSession) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
6395
|
+
this.renderer.delete();
|
|
6396
|
+
}
|
|
5973
6397
|
this.renderer = null;
|
|
5974
6398
|
};
|
|
6399
|
+
Object.defineProperty(Rive.prototype, "deferredRendererActive", {
|
|
6400
|
+
/**
|
|
6401
|
+
* @experimental This API is early and may encounter breaking behavior change without a major version bump
|
|
6402
|
+
*
|
|
6403
|
+
* Whether this instance is rendering through a deferred session. False whenever
|
|
6404
|
+
* a fallback ran, whatever was requested.
|
|
6405
|
+
*/
|
|
6406
|
+
get: function () {
|
|
6407
|
+
var _a, _b, _c;
|
|
6408
|
+
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;
|
|
6409
|
+
},
|
|
6410
|
+
enumerable: false,
|
|
6411
|
+
configurable: true
|
|
6412
|
+
});
|
|
5975
6413
|
/**
|
|
5976
6414
|
* Cleans up any Wasm-generated objects that need to be manually destroyed:
|
|
5977
6415
|
* artboard instances, animation instances, state machine instances.
|
|
@@ -6203,7 +6641,10 @@ var Rive = /** @class */ (function () {
|
|
|
6203
6641
|
};
|
|
6204
6642
|
// Loads a new Rive file, keeping listeners in place
|
|
6205
6643
|
Rive.prototype.load = function (params) {
|
|
6206
|
-
|
|
6644
|
+
// Before stop(), so a call with no source leaves playback running.
|
|
6645
|
+
if (!params.src && !params.buffer && !params.riveFile) {
|
|
6646
|
+
throw new RiveError(Rive.missingErrorMessage);
|
|
6647
|
+
}
|
|
6207
6648
|
// Stop all animations
|
|
6208
6649
|
this.stop();
|
|
6209
6650
|
// Reinitialize
|
|
@@ -8067,7 +8508,7 @@ var decodeAudio = function (bytes) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
8067
8508
|
case 0:
|
|
8068
8509
|
decodedPromise = new Promise(function (resolve) {
|
|
8069
8510
|
return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
|
|
8070
|
-
rive.decodeAudio(bytes, resolve);
|
|
8511
|
+
rive.decodeAudio(bytes, resolve, null);
|
|
8071
8512
|
});
|
|
8072
8513
|
});
|
|
8073
8514
|
return [4 /*yield*/, decodedPromise];
|
|
@@ -8092,7 +8533,7 @@ var decodeImage = function (bytes) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
8092
8533
|
case 0:
|
|
8093
8534
|
decodedPromise = new Promise(function (resolve) {
|
|
8094
8535
|
return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
|
|
8095
|
-
rive.decodeImage(bytes, resolve);
|
|
8536
|
+
rive.decodeImage(bytes, resolve, null);
|
|
8096
8537
|
});
|
|
8097
8538
|
});
|
|
8098
8539
|
return [4 /*yield*/, decodedPromise];
|
|
@@ -8117,7 +8558,7 @@ var decodeFont = function (bytes) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
8117
8558
|
case 0:
|
|
8118
8559
|
decodedPromise = new Promise(function (resolve) {
|
|
8119
8560
|
return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
|
|
8120
|
-
rive.decodeFont(bytes, resolve);
|
|
8561
|
+
rive.decodeFont(bytes, resolve, null);
|
|
8121
8562
|
});
|
|
8122
8563
|
});
|
|
8123
8564
|
return [4 /*yield*/, decodedPromise];
|