@rive-app/canvas-lite 2.47.1 → 2.49.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 +51 -1
- package/rive.js +801 -188
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +87 -1
- package/rive_fallback.wasm +0 -0
- package/runtimeLoader.d.ts +25 -0
- package/utils/gamepadBatchEncoder.d.ts +51 -0
- package/utils/gamepadInteractions.d.ts +25 -0
- package/utils/index.d.ts +1 -0
package/rive.js
CHANGED
|
@@ -215,16 +215,21 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
215
215
|
RuntimeLoader.callBackQueue = [];
|
|
216
216
|
};
|
|
217
217
|
RuntimeLoader.loaded = function (rive) {
|
|
218
|
-
var _a;
|
|
218
|
+
var _a, _b;
|
|
219
219
|
if (RuntimeLoader.enablePerfMarks) {
|
|
220
220
|
performance.mark('rive:wasm-init:end');
|
|
221
221
|
performance.measure('rive:wasm-init', 'rive:wasm-init:start', 'rive:wasm-init:end');
|
|
222
222
|
}
|
|
223
223
|
RuntimeLoader.runtime = rive;
|
|
224
|
+
RuntimeLoader.applyParallelParts();
|
|
224
225
|
RuntimeLoader.errorCallbackQueue = [];
|
|
226
|
+
// Before any callback can import a file, so its images reach the worker.
|
|
227
|
+
if (RuntimeLoader.replayWorker) {
|
|
228
|
+
(_a = rive.enableReplayWorker) === null || _a === void 0 ? void 0 : _a.call(rive);
|
|
229
|
+
}
|
|
225
230
|
// Fire all the callbacks
|
|
226
231
|
while (RuntimeLoader.callBackQueue.length > 0) {
|
|
227
|
-
(
|
|
232
|
+
(_b = RuntimeLoader.callBackQueue.shift()) === null || _b === void 0 ? void 0 : _b(RuntimeLoader.runtime);
|
|
228
233
|
}
|
|
229
234
|
};
|
|
230
235
|
// Loads the runtime, threaded once per page where it can be, and otherwise
|
|
@@ -382,6 +387,46 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
382
387
|
RuntimeLoader.getWasmThreadsUrl = function () {
|
|
383
388
|
return RuntimeLoader.wasmThreadsURL;
|
|
384
389
|
};
|
|
390
|
+
/**
|
|
391
|
+
* Sets how many parts a script's parallel call gets on a page that runs
|
|
392
|
+
* the threaded build, the page's thread and one worker thread for each
|
|
393
|
+
* other part. 1 turns parallel calls off, and null leaves the runtime's
|
|
394
|
+
* default of one part per core, up to 8. Set it before the first file
|
|
395
|
+
* loads.
|
|
396
|
+
*/
|
|
397
|
+
RuntimeLoader.setParallelParts = function (parts) {
|
|
398
|
+
RuntimeLoader.parallelParts = parts;
|
|
399
|
+
RuntimeLoader.applyParallelParts();
|
|
400
|
+
};
|
|
401
|
+
// Gets the parts set with setParallelParts (null means the default)
|
|
402
|
+
RuntimeLoader.getParallelParts = function () {
|
|
403
|
+
return RuntimeLoader.parallelParts;
|
|
404
|
+
};
|
|
405
|
+
RuntimeLoader.applyParallelParts = function () {
|
|
406
|
+
var _a;
|
|
407
|
+
var scripting = (_a = RuntimeLoader.runtime) === null || _a === void 0 ? void 0 : _a.riveScripting;
|
|
408
|
+
if (scripting) {
|
|
409
|
+
scripting.parallelParts = RuntimeLoader.parallelParts;
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* @experimental When the threaded build loads, instances with
|
|
414
|
+
* `enableGPUCanvas` hand their canvas to one worker that replays every
|
|
415
|
+
* instance's frames while the page records the next ones. Pass `false`
|
|
416
|
+
* before the runtime loads to keep replay on the page's thread; a single
|
|
417
|
+
* instance can opt out with `useReplayWorker: false`. Pages where the
|
|
418
|
+
* browser cannot draw WebGL2 on a transferred canvas stay on the page's
|
|
419
|
+
* thread regardless.
|
|
420
|
+
*
|
|
421
|
+
* True by default.
|
|
422
|
+
*/
|
|
423
|
+
RuntimeLoader.setReplayWorker = function (enabled) {
|
|
424
|
+
RuntimeLoader.replayWorker = enabled;
|
|
425
|
+
};
|
|
426
|
+
// Gets whether a threaded runtime may replay on a worker
|
|
427
|
+
RuntimeLoader.getReplayWorker = function () {
|
|
428
|
+
return RuntimeLoader.replayWorker;
|
|
429
|
+
};
|
|
385
430
|
// Manually sets the wasm binary or clears it with null
|
|
386
431
|
RuntimeLoader.setWasmBinary = function (value) {
|
|
387
432
|
if ((value instanceof ArrayBuffer) || value === null) {
|
|
@@ -411,6 +456,11 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
411
456
|
? "https://unpkg.com/".concat(package_json__WEBPACK_IMPORTED_MODULE_2__.name, "@").concat(package_json__WEBPACK_IMPORTED_MODULE_2__.version, "/rive_threads.wasm")
|
|
412
457
|
: null;
|
|
413
458
|
RuntimeLoader.triedThreads = false;
|
|
459
|
+
// The parts a script's parallel call gets on the threaded build, or null
|
|
460
|
+
// for the runtime's default.
|
|
461
|
+
RuntimeLoader.parallelParts = null;
|
|
462
|
+
// Whether a threaded runtime replays deferred frames on a worker.
|
|
463
|
+
RuntimeLoader.replayWorker = true;
|
|
414
464
|
// Error callbacks enqueued from .getInstance()
|
|
415
465
|
RuntimeLoader.errorCallbackQueue = [];
|
|
416
466
|
/**
|
|
@@ -432,109 +482,110 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
432
482
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
433
483
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
434
484
|
/* harmony export */ });
|
|
435
|
-
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var
|
|
436
|
-
function da(){function b(h){const g=d;c=a=0;d=new Map;g.forEach(n=>{try{n(h)}catch(r){console.error(r)}});this
|
|
437
|
-
"fixed",
|
|
438
|
-
function
|
|
439
|
-
|
|
440
|
-
"function"===typeof d?function(h){d(h)}:function(){console.warn("Module.setFallbackFontCallback called, but text support is not enabled in this build.")};const f=
|
|
441
|
-
return this.
|
|
442
|
-
|
|
443
|
-
function
|
|
444
|
-
function
|
|
445
|
-
r(),
|
|
446
|
-
const
|
|
447
|
-
w))c=2;else if(p=q.getContext("webgl",w))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;p=new Proxy(p,{get(
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
p.enableVertexAttribArray(0);p.enableVertexAttribArray(1);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,p.createBuffer());p.uniform1i(p.getUniformLocation(q,"image"),0);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);a=p}return!0}let a=null,c=0,d=0,f=null,
|
|
451
|
-
0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,q);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==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 w};const r=new
|
|
452
|
-
w)a.canvas.width=q,a.canvas.height=w;a.viewport(0,0,q,w);a.disable(a.SCISSOR_TEST);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);var
|
|
453
|
-
console.assert(
|
|
454
|
-
|
|
455
|
-
function
|
|
456
|
-
|
|
457
|
-
case
|
|
458
|
-
|
|
459
|
-
C=h.fill,
|
|
460
|
-
{type:"image/png"}));t.onload=function(){k.
|
|
461
|
-
k)}
|
|
462
|
-
class
|
|
463
|
-
this.m=e;this.i=this.
|
|
464
|
-
k,t,u,v,
|
|
465
|
-
this.
|
|
466
|
-
__destruct:function(){null!==this.
|
|
467
|
-
c(e,k,t,u
|
|
468
|
-
null,u=null;if(null!==this.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
2,
|
|
476
|
-
x
|
|
477
|
-
|
|
478
|
-
1,0,0,1,
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
function
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
var
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
a
|
|
533
|
-
f)=>
|
|
534
|
-
|
|
535
|
-
0):
|
|
536
|
-
|
|
537
|
-
(function(){function b(){
|
|
485
|
+
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var l=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope;
|
|
486
|
+
function da(){function b(h){const g=d;c=a=0;d=new Map;g.forEach(n=>{try{n(h)}catch(r){console.error(r)}});this.$a();f&&f.Db()}let a=0,c=0,d=new Map,f=null,m=null;this.requestAnimationFrame=function(h){a||=requestAnimationFrame(b.bind(this));const g=++c;d.set(g,h);return g};this.cancelAnimationFrame=function(h){d.delete(h);a&&0==d.size&&(cancelAnimationFrame(a),a=0)};this.Bb=function(h){m&&(document.body.remove(m),m=null);h||(m=document.createElement("div"),m.style.backgroundColor="black",m.style.position=
|
|
487
|
+
"fixed",m.style.right=0,m.style.top=0,m.style.color="white",m.style.padding="4px",m.innerHTML="RIVE FPS",h=function(g){m.innerHTML="RIVE FPS "+g.toFixed(1)},document.body.appendChild(m));f=new function(){let g=0,n=0;this.Db=function(){var r=performance.now();n?(++g,r-=n,1E3<r&&(h(1E3*g/r),g=n=0)):(n=r,g=0)}}};this.yb=function(){m&&(document.body.remove(m),m=null);f=null};this.$a=function(){}}
|
|
488
|
+
function ea(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}}function ha(b){return function(){b();const a=l.riveScripting;if(a)for(const c of a.frameBoundary())console.warn(c)}}const ia=l.onRuntimeInitialized;
|
|
489
|
+
l.onRuntimeInitialized=function(){ia&&ia();l.startFileScripts=function(h){const g=l.riveScripting;return h&&g&&h.startScripts?g.prepare().then(function(){h.startScripts();return h}):Promise.resolve(h)};let b=l.decodeAudio;l.decodeAudio=function(h,g,n=null){h=b(h,n??null);g(h)};let a=l.decodeFont;l.decodeFont=function(h,g,n=null){h=a(h,n??null);g(h)};const c=l.FileAsset.prototype.decode;l.FileAsset.prototype.decode=function(h,g){return c.call(this,h,g??null)};let d=l.setFallbackFontCb;l.setFallbackFontCallback=
|
|
490
|
+
"function"===typeof d?function(h){d(h)}:function(){console.warn("Module.setFallbackFontCallback called, but text support is not enabled in this build.")};const f=l.FileAssetLoader;l.ptrToAsset=h=>{let g=l.ptrToFileAsset(h);return g.isImage?l.ptrToImageAsset(h):g.isFont?l.ptrToFontAsset(h):g.isAudio?l.ptrToAudioAsset(h):g};l.CustomFileAssetLoader=f.extend("CustomFileAssetLoader",{__construct:function({loadContents:h}){this.__parent.__construct.call(this);this.nb=h},loadContents:function(h,g){h=l.ptrToAsset(h);
|
|
491
|
+
return this.nb(h,g)}});l.CDNFileAssetLoader=f.extend("CDNFileAssetLoader",{__construct:function(h){this.__parent.__construct.call(this);this.ob=h??null},loadContents:function(h){let g=l.ptrToAsset(h);h=g.cdnUuid;if(""===h)return!1;const n=this.ob??null;(function(r,A){var q=new XMLHttpRequest;q.responseType="arraybuffer";q.onreadystatechange=function(){4==q.readyState&&200==q.status&&A(q)};q.open("GET",r,!0);q.send(null)})(g.cdnBaseUrl+"/"+h,r=>{g.decode(new Uint8Array(r.response),n)});return!0}});
|
|
492
|
+
l.FallbackFileAssetLoader=f.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this);this.Ya=[]},addLoader:function(h){this.Ya.push(h)},loadContents:function(h,g){for(let n of this.Ya)if(n.loadContents(h,g))return!0;return!1}});let m=l.computeAlignment;l.computeAlignment=function(h,g,n,r,A=1){return m.call(this,h,g,n,r,A)}};function la(){}const F=new Int32Array(5);
|
|
493
|
+
function ma(b,a,c,d,f){b(a,c,F);b=Math.max(F[0],0);const m=Math.max(F[1],0);a=Math.min(F[2],Math.ceil(d*a));c=Math.min(F[3],Math.ceil(f*c));F[4]=b!==F[0]||m!==F[1]||a!==F[2]||c!==F[3]?1:0;F[0]=b;F[1]=m;F[2]=a;F[3]=c;return a>b&&c>m}function na(){const b=oa.Mb();return 0===b?0:b}
|
|
494
|
+
function pa(b,a,c,d,f,m,h,g,n,r,A){var q=na(),w=q-1,p=w-6;if(!(0<p))return r(),la;let z=1,C=1;if(!ma(g,z,C,c,d))return r(),la;const G=F[2]-F[0],E=F[3]-F[1];if(G>w||E>w)if(z*=Math.min(1,p/G),C*=Math.min(1,p/E),!ma(g,z,C,c,d))return r(),la;c=F[0];d=F[1];w=F[2];p=F[3];g=0!==F[4];if(1>z||1>C)--c,--d,w+=1,p+=1;const H=w-c,L=p-d;b.i||(b.i=new l.DynamicRectanizer(q),b.i.reset(512,512));q=b.i.addRect(H+1,L+1);if(0>q&&(A(),q=b.i.addRect(H+1,L+1),0>q))return console.assert(!1,"draw does not fit in an empty atlas"),
|
|
495
|
+
r(),la;const R=q&65535,I=q>>16;b.m.push({pb:[z*f[0],C*f[1],z*f[2],C*f[3],z*f[4]-c+R,C*f[5]-d+I],qb:R,rb:I,Vb:H,Xa:L,Za:g,N:n,Pb:()=>{r()}});const S=c/z,Y=d/C,ca=H/z,ra=L/C,sa=b.M;return function(){const Ea=sa.canvas();Ea&&(a.save(),a.resetTransform(),a.globalCompositeOperation=m,a.globalAlpha=h,a.drawImage(Ea,R,I,H,L,S,Y,ca,ra),a.restore())}}class qa{constructor(){this.M=new ua;this.i=null;this.m=[];this.na=new ea(8);this.$=new ea(8)}}
|
|
496
|
+
const oa=new function(){function b(){if(!a){var q=document.createElement("canvas"),w={alpha:1,depth:0,stencil:0,antialias:0,premultipliedAlpha:1,preserveDrawingBuffer:0,powerPreference:"high-performance",failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:1,explicitSwapControl:1,renderViaOffscreenBackBuffer:1};let p;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(p=q.getContext("webgl",w),c=1,!p)return console.log("No WebGL support. Image mesh will not be drawn."),!1}else if(p=q.getContext("webgl2",
|
|
497
|
+
w))c=2;else if(p=q.getContext("webgl",w))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;p=new Proxy(p,{get(C,G){if(C.isContextLost()){if(n||(console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ",G),n=!0),"function"===typeof C[G])return function(){}}else return"function"===typeof C[G]?function(...E){return C[G].apply(C,E)}:C[G]},set(C,G,E){if(C.isContextLost())n||(console.error("Cannot render the mesh because the GL Context was lost. Tried to set property "+
|
|
498
|
+
G),n=!0);else return C[G]=E,!0}});d=Math.min(p.getParameter(p.MAX_RENDERBUFFER_SIZE),p.getParameter(p.MAX_TEXTURE_SIZE));function z(C,G,E){G=p.createShader(G);p.shaderSource(G,E);p.compileShader(G);E=p.getShaderInfoLog(G);if(0<(E||"").length)throw E;p.attachShader(C,G)}q=p.createProgram();z(q,p.VERTEX_SHADER,"attribute vec2 vertex;\n attribute vec2 uv;\n uniform vec4 mat;\n uniform vec2 translate;\n varying vec2 st;\n void main() {\n st = uv;\n gl_Position = vec4(mat2(mat) * vertex + translate, 0, 1);\n }");
|
|
499
|
+
z(q,p.FRAGMENT_SHADER,"precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }");p.bindAttribLocation(q,0,"vertex");p.bindAttribLocation(q,1,"uv");p.linkProgram(q);w=p.getProgramInfoLog(q);if(0<(w||"").trim().length)throw w;f=p.getUniformLocation(q,"mat");m=p.getUniformLocation(q,"translate");p.useProgram(q);p.bindBuffer(p.ARRAY_BUFFER,p.createBuffer());
|
|
500
|
+
p.enableVertexAttribArray(0);p.enableVertexAttribArray(1);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,p.createBuffer());p.uniform1i(p.getUniformLocation(q,"image"),0);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);a=p}return!0}let a=null,c=0,d=0,f=null,m=null,h=0,g=0,n=!1;b();this.Mb=function(){b();return d};this.xb=function(q){a&&a.deleteTexture&&a.deleteTexture(q)};this.vb=function(q){if(!b())return null;const w=a.createTexture();if(!w)return null;a.bindTexture(a.TEXTURE_2D,w);a.texImage2D(a.TEXTURE_2D,
|
|
501
|
+
0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,q);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==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 w};const r=new ea(10),A=new ea(10);this.Ab=function(q,w,p){if(b()&&a.canvas){if(a.canvas.width!=q||a.canvas.height!=
|
|
502
|
+
w)a.canvas.width=q,a.canvas.height=w;a.viewport(0,0,q,w);a.disable(a.SCISSOR_TEST);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);var z=I=>I.N.image.Ca<<1|(I.Za?1:0);p.sort((I,S)=>z(S)-z(I));var C=0,G=0;for(var E of p)C+=E.N.pa.length,G+=E.N.indices.length;E=r.push(C);h!=E&&(a.bufferData(a.ARRAY_BUFFER,8*E,a.DYNAMIC_DRAW),h=E);E=0;for(var H of p)a.bufferSubData(a.ARRAY_BUFFER,E,H.N.pa),E+=4*H.N.pa.length;console.assert(E==4*C);for(var L of p)a.bufferSubData(a.ARRAY_BUFFER,E,L.N.hb),E+=4*L.N.hb.length;
|
|
503
|
+
console.assert(E==8*C);E=A.push(G);g!=E&&(a.bufferData(a.ELEMENT_ARRAY_BUFFER,2*E,a.DYNAMIC_DRAW),g=E);H=0;for(var R of p)a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,H,R.N.indices),H+=2*R.N.indices.length;console.assert(H==2*G);R=0;L=!1;E=H=0;for(const I of p){p=I.N;p.image.Ca!=R&&(a.bindTexture(a.TEXTURE_2D,p.image.V||null),R=p.image.Ca);I.Za?(a.scissor(I.qb,w-I.rb-I.Xa,I.Vb,I.Xa),L||(a.enable(a.SCISSOR_TEST),L=!0)):L&&(a.disable(a.SCISSOR_TEST),L=!1);const S=I.pb,Y=2/q,ca=-2/w;a.uniform4f(f,S[0]*Y,S[1]*
|
|
504
|
+
ca,S[2]*Y,S[3]*ca);a.uniform2f(m,S[4]*Y-1,S[5]*ca+1);a.vertexAttribPointer(0,2,a.FLOAT,!1,0,E);a.vertexAttribPointer(1,2,a.FLOAT,!1,0,E+4*C);a.drawElements(a.TRIANGLES,p.indices.length,a.UNSIGNED_SHORT,H);E+=4*p.pa.length;H+=2*p.indices.length}console.assert(E==4*C);console.assert(H==2*G)}};this.canvas=function(){return b()&&a.canvas}};class ua{constructor(){this.eb=!1}canvas(){return oa.canvas()||null}}const va=new qa;
|
|
505
|
+
function wa(b,a,c,d,f,m){const h=new DOMMatrix;h.a=b;h.b=a;h.c=c;h.d=d;h.e=f;h.f=m;return h}const xa="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),ya=l.onRuntimeInitialized;
|
|
506
|
+
l.onRuntimeInitialized=function(){function b(e){switch(e){case z.srcOver:return"source-over";case z.Yb:return"plus-lighter";case z.screen:return"screen";case z.overlay:return"overlay";case z.darken:return"darken";case z.lighten:return"lighten";case z.colorDodge:return"color-dodge";case z.colorBurn:return"color-burn";case z.hardLight:return"hard-light";case z.softLight:return"soft-light";case z.difference:return"difference";case z.exclusion:return"exclusion";case z.multiply:return"multiply";case z.hue:return"hue";
|
|
507
|
+
case z.saturation:return"saturation";case z.color:return"color";case z.luminosity:return"luminosity"}}function a(e){return"rgba("+((16711680&e)>>>16)+","+((65280&e)>>>8)+","+((255&e)>>>0)+","+((4278190080&e)>>>24)/255+")"}function c(e,k,t,u,v){return{fb:e,gb:k,Sa:t,Ta:u,type:v,Ka:[],T:null}}function d(e,k,t,u){if(k.Y===H&&!(0<k.Z))return null;t=1===t;return{Ha:e.La(t?k.xa:null),gradientTransform:t?k.ca:null,Ub:t?k.Z*k.Ba:k.Z,fillRule:e.ha===L?"evenodd":"nonzero",opacity:u,style:k.Y,color:k.sa,Wa:k.I,
|
|
508
|
+
tb:k.ra,join:k.ya,sb:k.qa}}function f(e,k){return k.Y!==H||0<k.Z?{path:e.kb(e.ha),Ga:k.lb()}:null}function m(){if(0!==I.m.length){var e=na();if(0!==e){var k=Math.min(I.na.push(I.i.drawWidth()),e);e=Math.min(I.$.push(I.i.drawHeight()),e);oa.Ab(k,e,I.m)}}for(const t of ta){for(const u of t.G)u();t.G=[]}ta.clear();for(const t of I.m)t.Pb();I.m=[];I.i&&I.i.reset(512,512)}ya&&ya();var h=l.RenderPaintStyle,g=l.FillRule;const n=l.RenderPath,r=l.RenderPaint,A=l.Renderer,q=l.StrokeCap,w=l.StrokeJoin,p=l.StrokePosition,
|
|
509
|
+
z=l.BlendMode,C=l.ImageFilter,G=l.ImageWrap,E=h.fill,H=h.stroke,L=g.evenOdd,R=g.nonZero,I=va,S=I.M;let Y=1;var ca=l.RenderImage.extend("CanvasRenderImage",{__construct:function({ea:e,oa:k}={}){this.__parent.__construct.call(this);this.Ca=Y;Y=Y+1&2147483647||1;this.ea=e;this.oa=k;this.V=this.Pa=this.ia=this.wa=null},__destruct:function(){this.V&&(oa.xb(this.V),this.V=null);this.ia&&URL.revokeObjectURL(this.ia);this.__parent.__destruct.call(this)},decode:function(e){var k=this;k.oa&&k.oa(k);var t=new Image;
|
|
510
|
+
k.ia=URL.createObjectURL(new Blob([e],{type:"image/png"}));t.onload=function(){k.wa=t;k.V=oa.vb(t);k.size(t.width,t.height);k.ea&&k.ea(k)};t.src=k.ia}});class ra{constructor(e){this.i=e;this.path=new Path2D;this.m=null;this.ua=!1}M(){null!==this.m&&(this.path.lineTo(this.m.x,this.m.y),this.m=null)}moveTo(e,k){this.M();let t=e,u=k;null!==this.i&&(e=this.i.transformPoint({x:e,y:k}),t=e.x,u=e.y);this.path.moveTo(t,u);this.m={x:t,y:u}}lineTo(e,k){this.m=null;null!==this.i?(e=this.i.transformPoint({x:e,
|
|
511
|
+
y:k}),this.path.lineTo(e.x,e.y)):this.path.lineTo(e,k)}wb(e,k,t,u,v,B){this.m=null;null!==this.i?(e=this.i.transformPoint({x:e,y:k}),t=this.i.transformPoint({x:t,y:u}),v=this.i.transformPoint({x:v,y:B}),this.path.bezierCurveTo(e.x,e.y,t.x,t.y,v.x,v.y)):this.path.bezierCurveTo(e,k,t,u,v,B)}close(){this.m=null;this.path.closePath()}addPath(e,k,t,u,v,B,D){this.M();const y=new ra(null);for(const x of e)x(y);y.Va();e=wa(k,t,u,v,B,D);null!==this.i&&(e=this.i.multiply(e));this.path.addPath(y.path,e)}Va(){null===
|
|
512
|
+
this.m||this.ua||(this.M(),this.ua=!0)}dispose(){}}class sa{constructor(e){this.Lb=e;this.$=this.M=0;this.m=null;this.i=e(null)}clear(){this.na(null)}Da(e,k){for(((null===k?null!==this.m:null===this.m||this.m.a!==k.a||this.m.b!==k.b||this.m.c!==k.c||this.m.d!==k.d||this.m.e!==k.e||this.m.f!==k.f)||this.$<e.length&&(0<this.M||this.i.ua))&&this.na(k);this.$<e.length;)e[this.$++](this.i);this.i.Va();this.M++;return this.i.path}Ja(e){null!==this.i&&e===this.i.path&&this.M--}dispose(){this.i.dispose();
|
|
513
|
+
this.i=null}na(e){this.i.dispose();this.$=this.M=0;this.m=e;this.i=this.Lb(e)}}var Ea=n.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this);this.W=[];this.ja=new sa(e=>new ra(e));this.ka=new sa(e=>new ra(e));this.X=new Map;this.ha=R;this.va=!1},__destruct:function(){this.ja.dispose();this.ka.dispose();for(const e of this.X.values())e.dispose();this.X.clear();this.__parent.__destruct.call(this)},rewind:function(){this.W.length=0;this.ja.clear();this.ka.clear();for(const e of this.X.values())e.clear();
|
|
514
|
+
this.va=!1},addPath:function(e,k,t,u,v,B,D){const y=e.W.slice();this.ba(x=>x.addPath(y,k,t,u,v,B,D))},fillRule:function(e){this.ha=e},moveTo:function(e,k){this.va=!0;this.ba(t=>t.moveTo(e,k))},lineTo:function(e,k){this.Oa();this.ba(t=>t.lineTo(e,k))},cubicTo:function(e,k,t,u,v,B){this.Oa();this.ba(D=>D.wb(e,k,t,u,v,B))},close:function(){this.ba(e=>e.close())},Oa:function(){this.va||this.moveTo(0,0)},ba:function(e){this.W.push(e)},La:function(e){e=null===e?this.ja.Da(this.W,null):this.ka.Da(this.W,
|
|
515
|
+
e);e.ref&&e.ref();return e},kb:function(e){var k=this.X.get(e);void 0===k&&(k=new sa(()=>S.Zb(e)),this.X.set(e,k));k=k.Da(this.W,null);k.ref&&k.ref();return k},za:function(e){this.ja.Ja(e);this.ka.Ja(e);for(const k of this.X.values())k.Ja(e);e.unref&&e.unref()}});const bc=c(0,0,0,0,0);var dc=r.extend("CanvasRenderPaint",{__construct:function(){this.__parent.__construct.call(this);this.Y=E;this.sa=4278190080;this.Z=1;this.ya=w.miter;this.ra=q.butt;this.Aa=p.center;this.ta=0;this.qa=b(z.srcOver);this.xa=
|
|
516
|
+
this.A=this.ca=this.I=null;this.Ba=1;this.B=0;this.S=null;this.Qa=-1},__destruct:function(){null!==this.S&&(l.unrefWebGL2Paint(this.S),this.S=null);this.__parent.__destruct.call(this)},color:function(e){this.sa=e;this.I=null;this.B++},thickness:function(e){this.Z=Math.abs(e);this.B++},join:function(e){this.ya=e;this.B++},cap:function(e){this.ra=e;this.B++},strokePosition:function(e){this.Aa=e;this.B++},feather:function(e){this.ta=Math.abs(e);this.B++},style:function(e){this.Y=e;this.B++},blendMode:function(e){this.qa=
|
|
517
|
+
b(e);this.B++},clearGradient:function(){this.I=null;this.B++},linearGradient:function(e,k,t,u){this.I=c(e,k,t,u,0);this.B++},radialGradient:function(e,k,t,u){this.I=c(e,k,t,u,1);this.B++},angularGradient:function(){this.I=c(0,0,0,0,2);this.B++},addStop:function(e,k){this.I.Ka.push({color:e,stop:k});this.I.T=null;this.B++},modulatedImage:function(e,k,t,u,v,B,D,y,x,J){const K=e.wa;K?this.A={image:K,jb:e.Pa,filter:k,Wb:t,Xb:u,transform:wa(v,B,D,y,x,J)}:this.A=null},completeGradient:function(){},_setGradientTransform:function(e,
|
|
518
|
+
k,t,u,v,B,D,y,x,J,K,P,T){1===e&&0===k&&0===t&&1===u&&0===v&&0===B?this.xa=this.ca=null:(this.ca=wa(e,k,t,u,v,B),this.xa=wa(D,y,x,J,K,P));this.Ba=T;this.B++},lb:function(){if(this.Qa!==this.B){null!==this.S&&l.unrefWebGL2Paint(this.S);const k=null!==this.I?this.I:bc;let t=null,u=null;if(null!==this.I){var e=k.Ka;t=new Uint32Array(e.length);u=new Float32Array(e.length);for(let ja=0,cc=e.length;ja<cc;ja++)t[ja]=e[ja].color,u[ja]=e[ja].stop}e=null;let v=C.bilinear,B=G.clamp,D=G.clamp,y=1,x=0,J=0,K=1,
|
|
519
|
+
P=0,T=0;null!==this.A&&(e=this.A.jb,v=this.A.filter,B=this.A.Wb,D=this.A.Xb,y=this.A.transform.a,x=this.A.transform.b,J=this.A.transform.c,K=this.A.transform.d,P=this.A.transform.e,T=this.A.transform.f);let Z=1,ka=0,Ga=0,Va=1,sb=0,tb=0;const fa=this.ca;null!==fa&&(Z=fa.a,ka=fa.b,Ga=fa.c,Va=fa.d,sb=fa.e,tb=fa.f);this.S=l.makeWebGL2Paint(this.Y,this.sa,this.Z,this.ya,this.ra,this.Aa,this.ta,t,u,k.type,k.fb,k.gb,k.Sa,k.Ta,Z,ka,Ga,Va,sb,tb,e,v,B,D,y,x,J,K,P,T);this.Qa=this.B}l.refWebGL2Paint(this.S);
|
|
520
|
+
return this.S}});const ta=new Set,ub=Object.prototype.hasOwnProperty;var ec=l.CanvasRenderer=A.extend("Renderer",{__construct:function(e){this.__parent.__construct.call(this);this.L=[1,0,0,1,0,0];this.F=[1];this.s=e.getContext("2d");this.Na=e;this.G=[]},save:function(){this.L.push(...this.L.slice(this.L.length-6));this.F.push(this.F[this.F.length-1]);this.G.push(this.s.save.bind(this.s))},restore:function(){const e=this.L.length-6;if(6>e)throw"restore() called without matching save().";this.L.splice(e);
|
|
521
|
+
this.F.pop();this.G.push(this.s.restore.bind(this.s))},transform:function(e,k,t,u,v,B){const D=this.L,y=D.length-6;D.splice(y,6,D[y]*e+D[y+2]*k,D[y+1]*e+D[y+3]*k,D[y]*t+D[y+2]*u,D[y+1]*t+D[y+3]*u,D[y]*v+D[y+2]*B+D[y+4],D[y+1]*v+D[y+3]*B+D[y+5]);this.G.push(this.s.transform.bind(this.s,e,k,t,u,v,B))},rotate:function(e){const k=Math.sin(e);e=Math.cos(e);this.transform(e,k,-k,e,0,0)},modulateOpacity:function(e){this.F[this.F.length-1]*=e},_drawPath:function(e,k){const t=Math.max(0,this.F[this.F.length-
|
|
522
|
+
1]),u=k.A||k.Aa!==p.center?2:0!==k.ta?S.eb?2:0:null===k.I||null===k.ca?0:k.Y!==H||0<k.Ba?1:S.eb?2:0;if(2===u)(null===k.A||k.A.jb)&&this.mb(e,k,t);else{var v=d(e,k,u,t);null!==v&&this.G.push(()=>{var B=this.s;const D=B.globalCompositeOperation,y=B.globalAlpha;B.globalCompositeOperation=v.sb;B.globalAlpha=v.opacity;if(null!==v.Wa){var x=v.Wa;if(null===x.T){var J=x.fb;const T=x.gb;var K=x.Sa,P=x.Ta;0==x.type?x.T=B.createLinearGradient(J,T,K,P):1==x.type?(K-=J,P-=T,x.T=B.createRadialGradient(J,T,0,J,
|
|
523
|
+
T,Math.sqrt(K*K+P*P))):x.T=B.createConicGradient(0,0,0);J=x.Ka;for(let Z=0,ka=J.length;Z<ka;Z++)x.T.addColorStop(J[Z].stop,a(J[Z].color))}x=x.T}else x=a(v.color);null!==v.gradientTransform&&(B.save(),B.transform(v.gradientTransform.a,v.gradientTransform.b,v.gradientTransform.c,v.gradientTransform.d,v.gradientTransform.e,v.gradientTransform.f));switch(v.style){case H:B.strokeStyle=x;B.lineWidth=v.Ub;a:{switch(v.tb){case q.butt:x="butt";break a;case q.round:x="round";break a;case q.square:x="square";
|
|
524
|
+
break a}x=void 0}B.lineCap=x;a:{switch(v.join){case w.miter:x="miter";break a;case w.round:x="round";break a;case w.bevel:x="bevel";break a}x=void 0}B.lineJoin=x;B.miterLimit=4;B.stroke(v.Ha);break;case E:B.fillStyle=x,B.fill(v.Ha,v.fillRule)}null!==v.gradientTransform&&B.restore();B.globalCompositeOperation=D;B.globalAlpha=y;e.za(v.Ha)})}},mb:function(e,k,t){const u=f(e,k);if(null!==u){var v=this.L.slice(this.L.length-6);k=pa(I,this.s,this.s.canvas.width,this.s.canvas.height,v,k.qa,t,(B,D,y)=>l.webGL2PathPixelBounds(u.path,
|
|
525
|
+
u.Ga,B*v[0],D*v[1],B*v[2],D*v[3],B*v[4],D*v[5],y),B=>B.drawPath(u.path,u.Ga),()=>{e.za(u.path);l.unrefWebGL2Paint(u.Ga)},m);ta.add(this);this.G.push(k)}},_drawRiveImage:function(e,k,t){var u=e.wa;if(u){var v=this.s,B=b(k),D=Math.max(0,t*this.F[this.F.length-1]);this.G.push(function(){v.globalCompositeOperation=B;v.globalAlpha=D;v.drawImage(u,0,0);v.globalAlpha=1})}},_getMatrix:function(e){const k=this.L,t=k.length-6;for(let u=0;6>u;++u)e[u]=k[t+u]},_drawImageMesh:function(e,k,t,u,v,B,D,y){const x=
|
|
526
|
+
e.Pa;x?this.Ma(t,u,v,B,D,y,J=>l.drawWebGL2PendingMesh(J,k,x),()=>k.unref()):k.unref()},_drawImageMeshFromHeap:function(e,k,t,u,v,B,D,y,x,J,K,P,T){if(e.V){try{var Z=l.HEAPF32.slice(u>>2,(u>>2)+v);var ka=l.HEAPF32.slice(B>>2,(B>>2)+D);var Ga=l.HEAPU16.slice(y>>1,(y>>1)+x)}catch(Va){console.error("[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.");return}this.Ma(k,t,J,K,P,T,{image:e,pa:Z,hb:ka,indices:Ga},()=>{})}},Ma:function(e,k,t,u,v,B,D,y){e=pa(I,this.s,
|
|
527
|
+
this.s.canvas.width,this.s.canvas.height,this.L.slice(this.L.length-6),b(e),Math.max(0,k*this.F[this.F.length-1]),(x,J,K)=>{K[0]=Math.floor(t*x);K[1]=Math.floor(u*J);K[2]=Math.ceil(v*x);K[3]=Math.ceil(B*J)},D,y,m);ta.add(this);this.G.push(e)},_clipPath:function(e){const k=e.ha===L?"evenodd":"nonzero",t=e.La(null);this.G.push(()=>{this.s.clip(t,k);e.za(t)})},beginFrame:function(e=!0){ta.add(this);e&&this.G.push(this.s.clearRect.bind(this.s,0,0,this.Na.width,this.Na.height))},clear:function(){this.beginFrame(!0)},
|
|
528
|
+
flush:function(){},translate:function(e,k){this.transform(1,0,0,1,e,k)}});l.makeRenderer=function(e){const k=new ec(e),t=k.s;let u=null,v=null;const B={attachSession:function(y){if(y&&u===y)return!0;if(!y||u||"function"!==typeof l.c2dDeferredClaim||"function"!==typeof l.c2dDeferredRenderer||!l.c2dDeferredClaim(y))return!1;const x=l.c2dDeferredRenderer(y);if(!x)return!1;u=y;v=x;return!0},detachSession:function(){u&&l.c2dDeferredDetach(u);v=u=null},deferredActive:function(){return null!==v}},D={save:function(){l.c2dDeferredSave(u)},
|
|
529
|
+
restore:function(){l.c2dDeferredRestore(u)},transform:function(y,x,J,K,P,T){l.c2dDeferredTransform(u,y,x,J,K,P,T)},translate:function(y,x){l.c2dDeferredTransform(u,1,0,0,1,y,x)},rotate:function(y){const x=Math.sin(y);y=Math.cos(y);l.c2dDeferredTransform(u,y,x,-x,y,0,0)},align:function(y,x,J,K,P){l.c2dDeferredAlign(u,y,x,J.minX,J.minY,J.maxX,J.maxY,K.minX,K.minY,K.maxX,K.maxY,void 0===P?1:P)},beginFrame:function(y=!0){k.beginFrame(y);l.c2dDeferredBeginFrame(u)},clear:function(){k.beginFrame(!0);l.c2dDeferredBeginFrame(u)},
|
|
530
|
+
flush:function(){l.c2dDeferredReplay(u,k)}};return new Proxy(k,{get(y,x){if(ub.call(B,x))return B[x];if("_deferredRecorder"===x)return v;if(null!==v&&ub.call(D,x))return D[x];if("function"===typeof y[x])return function(...J){return y[x].apply(y,J)};if("function"===typeof t[x]){if(-1<xa.indexOf(x))throw Error("RiveException: Method call to '"+x+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...J){k.G.push(t[x].bind(t,
|
|
531
|
+
...J))}}return y[x]},set(y,x,J){if(x in t)return k.G.push(()=>{t[x]=J}),!0}})};l.decodeImage=function(e,k){(new ca({ea:k})).decode(e)};l.renderFactory={makeRenderPaint:function(){return new dc},makeRenderPath:function(){return new Ea},makeRenderImage:function(){let e=Wa;return new ca({oa:()=>{e.total++},ea:()=>{e.loaded++;if(e.loaded===e.total){const k=e.ready;k&&(k(),e.ready=null)}}})}};let fc=l.load,Wa=null;l.load=function(e,k,t=!0,u=null){const v=new l.FallbackFileAssetLoader;void 0!==k&&v.addLoader(k);
|
|
532
|
+
t&&(k=new l.CDNFileAssetLoader(u),v.addLoader(k));return(new Promise(function(B){let D=null;Wa={total:0,loaded:0,ready:function(){B(D)}};D=fc(e,v,u??null);const y=l.riveScripting;y&&y.prepare();0==Wa.total&&B(D)})).then(l.startFileScripts)};const gc=l.Artboard.prototype.draw;l.Artboard.prototype.draw=function(e){gc.call(this,e._deferredRecorder||e)};let hc=l.RendererWrapper.prototype.align;l.RendererWrapper.prototype.align=function(e,k,t,u,v=1){hc.call(this,e,k,t,u,v)};h=new da;l.requestAnimationFrame=
|
|
533
|
+
h.requestAnimationFrame.bind(h);l.cancelAnimationFrame=h.cancelAnimationFrame.bind(h);l.enableFPSCounter=h.Bb.bind(h);l.disableFPSCounter=h.yb;g=ha(m);h.$a=g;l.resolveAnimationFrame=g;l.cleanup=function(){I.i&&(I.i["delete"](),I.i=null)}};ba&&(_scriptName=self.location.href);var za="",Aa,Ba;
|
|
534
|
+
if(aa||ba){try{za=(new URL(".",_scriptName)).href}catch{}ba&&(Ba=b=>{var a=new XMLHttpRequest;a.open("GET",b,!1);a.responseType="arraybuffer";a.send(null);return new Uint8Array(a.response)});Aa=async b=>{if(Ca(b))return new Promise((c,d)=>{var f=new XMLHttpRequest;f.open("GET",b,!0);f.responseType="arraybuffer";f.onload=()=>{200==f.status||0==f.status&&f.response?c(f.response):d(f.status)};f.onerror=d;f.send(null)});var a=await fetch(b,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw Error(a.status+
|
|
535
|
+
" : "+a.url);}}var Da=console.log.bind(console),Fa=console.error.bind(console),Ha,Ia=!1,Ca=b=>b.startsWith("file://"),Ja,Ka,La,M,Ma,Na,Oa,N,Pa,Qa,Ra=!1;function Sa(){var b=Ta.buffer;l.HEAP8=La=new Int8Array(b);Ma=new Int16Array(b);l.HEAPU8=M=new Uint8Array(b);l.HEAPU16=Na=new Uint16Array(b);l.HEAP32=Oa=new Int32Array(b);l.HEAPU32=N=new Uint32Array(b);l.HEAPF32=Pa=new Float32Array(b);Qa=new Float64Array(b)}
|
|
536
|
+
function Ua(b){l.onAbort?.(b);b="Aborted("+b+")";Fa(b);Ia=!0;b=new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.");Ka?.(b);throw b;}var Xa;async function Ya(b){if(!Ha)try{var a=await Aa(b);return new Uint8Array(a)}catch{}if(b==Xa&&Ha)b=new Uint8Array(Ha);else if(Ba)b=Ba(b);else throw"both async and sync fetching of the wasm failed";return b}
|
|
537
|
+
async function Za(b,a){try{var c=await Ya(b);return await WebAssembly.instantiate(c,a)}catch(d){Fa(`failed to asynchronously prepare wasm: ${d}`),Ua(d)}}async function $a(b){var a=Xa;if(!Ha&&!Ca(a))try{var c=fetch(a,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,b)}catch(d){Fa(`wasm streaming compile failed: ${d}`),Fa("falling back to ArrayBuffer instantiation")}return Za(a,b)}
|
|
538
|
+
var ab,bb,cb=b=>{for(;0<b.length;)b.shift()(l)},db=[],eb=[],fb=()=>{var b=l.preRun.shift();eb.push(b)},gb=(b,a)=>Object.defineProperty(a,"name",{value:b}),hb=[],ib=[0,1,,1,null,1,!0,1,!1,1],O=class extends Error{constructor(b){super(b);this.name="BindingError"}},Q=b=>{if(!b)throw new O(`Cannot use deleted val. handle = ${b}`);return ib[b]},jb=b=>{switch(b){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const a=hb.pop()||ib.length;ib[a]=b;ib[a+1]=1;return a}};
|
|
539
|
+
class kb extends Error{}
|
|
540
|
+
var U=b=>{for(var a="";;){var c=M[b++];if(!c)return a;a+=String.fromCharCode(c)}},lb={},mb=(b,a)=>{if(void 0===a)throw new O("ptr should not be undefined");for(;b.C;)a=b.fa(a),b=b.C;return a},nb={},qb=b=>{b=ob(b);var a=U(b);pb(b);return a},rb=(b,a)=>{var c=nb[b];if(void 0===c)throw b=`${a} has unknown type ${qb(b)}`,new O(b);return c},vb=()=>{},wb=!1,xb=b=>{if(!globalThis.FinalizationRegistry)return xb=a=>a,b;wb=new FinalizationRegistry(a=>{a=a.g;--a.count.value;0===a.count.value&&(a.D?a.K.P(a.D):
|
|
541
|
+
a.o.h.P(a.l))});xb=a=>{var c=a.g;c.D&&wb.register(a,{g:c},a);return a};vb=a=>{wb.unregister(a)};return xb(b)},yb={},zb=b=>{for(;b.length;){var a=b.pop();b.pop()(a)}};function Ab(b){return this.j(N[b>>2])}
|
|
542
|
+
var Bb={},Cb={},Db=class extends Error{constructor(b){super(b);this.name="InternalError"}},W=(b,a,c)=>{function d(g){g=c(g);if(g.length!==b.length)throw new Db("Mismatched type converter count");for(var n=0;n<b.length;++n)V(b[n],g[n])}b.forEach(g=>Cb[g]=a);var f=Array(a.length),m=[],h=0;for(let [g,n]of a.entries())nb.hasOwnProperty(n)?f[g]=nb[n]:(m.push(n),Bb.hasOwnProperty(n)||(Bb[n]=[]),Bb[n].push(()=>{f[g]=nb[n];++h;h===m.length&&d(f)}));0===m.length&&d(f)};
|
|
543
|
+
function Eb(b,a,c={}){var d=a.name;if(!b)throw new O(`type "${d}" must have a positive integer typeid pointer`);if(nb.hasOwnProperty(b)){if(c.Jb)return;throw new O(`Cannot register type '${d}' twice`);}nb[b]=a;delete Cb[b];Bb.hasOwnProperty(b)&&(a=Bb[b],delete Bb[b],a.forEach(f=>f()))}function V(b,a,c={}){return Eb(b,a,c)}var Fb=b=>{throw new O(b.g.o.h.name+" instance already deleted");},Gb=[];function Hb(){}
|
|
544
|
+
var Ib={},Jb=(b,a,c)=>{if(void 0===b[a].u){var d=b[a];b[a]=function(...f){if(!b[a].u.hasOwnProperty(f.length))throw new O(`Function '${c}' called with an invalid number of arguments (${f.length}) - expects one of (${b[a].u})!`);return b[a].u[f.length].apply(this,f)};b[a].u=[];b[a].u[d.R]=d}},Kb=(b,a,c)=>{if(l.hasOwnProperty(b)){if(void 0===c||void 0!==l[b].u&&void 0!==l[b].u[c])throw new O(`Cannot register public name '${b}' twice`);Jb(l,b,b);if(l[b].u.hasOwnProperty(c))throw new O(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`);
|
|
545
|
+
l[b].u[c]=a}else l[b]=a,l[b].R=c},Lb=b=>{b=b.replace(/[^a-zA-Z0-9_]/g,"$");var a=b.charCodeAt(0);return 48<=a&&57>=a?`_${b}`:b};function Mb(b,a,c,d,f,m,h,g){this.name=b;this.constructor=a;this.O=c;this.P=d;this.C=f;this.Eb=m;this.fa=h;this.zb=g;this.ab=[]}
|
|
546
|
+
var Nb=(b,a,c)=>{for(;a!==c;){if(!a.fa)throw new O(`Expected null or instance of ${c.name}, got an instance of ${a.name}`);b=a.fa(b);a=a.C}return b},Ob=b=>{if(null===b)return"null";var a=typeof b;return"object"===a||"array"===a||"function"===a?b.toString():""+b};
|
|
547
|
+
function Pb(b,a){if(null===a){if(this.Ea)throw new O(`null is not a valid ${this.name}`);return 0}if(!a.g)throw new O(`Cannot pass "${Ob(a)}" as a ${this.name}`);if(!a.g.l)throw new O(`Cannot pass deleted object as a pointer of type ${this.name}`);return Nb(a.g.l,a.g.o.h,this.h)}
|
|
548
|
+
function Qb(b,a){if(null===a){if(this.Ea)throw new O(`null is not a valid ${this.name}`);if(this.ma){var c=this.Ia();null!==b&&b.push(this.P,c);return c}return 0}if(!a||!a.g)throw new O(`Cannot pass "${Ob(a)}" as a ${this.name}`);if(!a.g.l)throw new O(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.la&&a.g.o.la)throw new O(`Cannot convert argument of type ${a.g.K?a.g.K.name:a.g.o.name} to parameter type ${this.name}`);c=Nb(a.g.l,a.g.o.h,this.h);if(this.ma){if(void 0===a.g.D)throw new O("Passing raw pointer to smart pointer is illegal");
|
|
549
|
+
switch(this.Tb){case 0:if(a.g.K===this)c=a.g.D;else throw new O(`Cannot convert argument of type ${a.g.K?a.g.K.name:a.g.o.name} to parameter type ${this.name}`);break;case 1:c=a.g.D;break;case 2:if(a.g.K===this)c=a.g.D;else{var d=a.clone();c=this.Ob(c,jb(()=>d["delete"]()));null!==b&&b.push(this.P,c)}break;default:throw new O("Unsupported sharing policy");}}return c}
|
|
550
|
+
function Rb(b,a){if(null===a){if(this.Ea)throw new O(`null is not a valid ${this.name}`);return 0}if(!a.g)throw new O(`Cannot pass "${Ob(a)}" as a ${this.name}`);if(!a.g.l)throw new O(`Cannot pass deleted object as a pointer of type ${this.name}`);if(a.g.o.la)throw new O(`Cannot convert argument of type ${a.g.o.name} to parameter type ${this.name}`);return Nb(a.g.l,a.g.o.h,this.h)}
|
|
551
|
+
var Sb=(b,a,c)=>{if(a===c)return b;if(void 0===c.C)return null;b=Sb(b,a,c.C);return null===b?null:c.zb(b)},Tb=(b,a)=>{a=mb(b,a);return lb[a]},Ub=(b,a)=>{if(!a.o||!a.l)throw new Db("makeClassHandle requires ptr and ptrType");if(!!a.K!==!!a.D)throw new Db("Both smartPtrType and smartPtr must be specified");a.count={value:1};return xb(Object.create(b,{g:{value:a,writable:!0}}))};
|
|
552
|
+
function Vb(b,a,c,d,f,m,h,g,n,r,A){this.name=b;this.h=a;this.Ea=c;this.la=d;this.ma=f;this.Nb=m;this.Tb=h;this.bb=g;this.Ia=n;this.Ob=r;this.P=A;f||void 0!==a.C?this.v=Qb:(this.v=d?Pb:Rb,this.H=null)}
|
|
553
|
+
var Wb=(b,a,c)=>{if(!l.hasOwnProperty(b))throw new Db("Replacing nonexistent public symbol");void 0!==l[b].u&&void 0!==c?l[b].u[c]=a:(l[b]=a,l[b].R=c)},Xb={},Zb=(b,a,c=[])=>{b.includes("j")?(b=b.replace(/p/g,"i"),a=(0,Xb[b])(a,...c)):a=Yb.get(a)(...c);return a},$b=(b,a)=>(...c)=>Zb(b,a,c),X=(b,a)=>{b=U(b);var c=b.includes("j")?$b(b,a):Yb.get(a);if("function"!=typeof c)throw new O(`unknown function pointer with signature ${b}: ${a}`);return c};class ac extends Error{}
|
|
554
|
+
var ic=(b,a)=>{function c(m){f[m]||nb[m]||(Cb[m]?Cb[m].forEach(c):(d.push(m),f[m]=!0))}var d=[],f={};a.forEach(c);throw new ac(`${b}: `+d.map(qb).join([", "]));};function jc(b){for(var a=1;a<b.length;++a)if(null!==b[a]&&void 0===b[a].H)return!0;return!1}
|
|
555
|
+
function kc(b,a,c,d,f){var m=a.length;if(2>m)throw new O("argTypes array size mismatch! Must at least get return value and 'this' types!");var h=null!==a[1]&&null!==c,g=jc(a),n=!a[0].Kb,r=m-2,A=Array(r),q=[],w=[];return gb(b,function(...p){w.length=0;q.length=h?2:1;q[0]=f;if(h){var z=a[1].v(w,this);q[1]=z}for(var C=0;C<r;++C)A[C]=a[C+2].v(w,p[C]),q.push(A[C]);p=d(...q);if(g)zb(w);else for(C=h?1:2;C<a.length;C++){var G=1===C?z:A[C-2];null!==a[C].H&&a[C].H(G)}z=n?a[0].j(p):void 0;return z})}
|
|
556
|
+
var lc=(b,a)=>{for(var c=[],d=0;d<b;d++)c.push(N[a+4*d>>2]);return c},mc=b=>{b=b.trim();const a=b.indexOf("(");return-1===a?b:b.slice(0,a)},nc=(b,a,c)=>{if(!(b instanceof Object))throw new O(`${c} with invalid "this": ${b}`);if(!(b instanceof a.h.constructor))throw new O(`${c} incompatible with "this" of type ${b.constructor.name}`);if(!b.g.l)throw new O(`cannot call emscripten binding method ${c} on deleted object`);return Nb(b.g.l,b.g.o.h,a.h)},oc=b=>{9<b&&0===--ib[b+1]&&(ib[b]=void 0,hb.push(b))},
|
|
557
|
+
pc={name:"emscripten::val",j:b=>{var a=Q(b);oc(b);return a},v:(b,a)=>jb(a),J:Ab,H:null},qc=(b,a,c)=>{switch(a){case 1:return c?function(d){return this.j(La[d])}:function(d){return this.j(M[d])};case 2:return c?function(d){return this.j(Ma[d>>1])}:function(d){return this.j(Na[d>>1])};case 4:return c?function(d){return this.j(Oa[d>>2])}:function(d){return this.j(N[d>>2])};default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},rc=(b,a)=>{switch(a){case 4:return function(c){return this.j(Pa[c>>
|
|
558
|
+
2])};case 8:return function(c){return this.j(Qa[c>>3])};default:throw new TypeError(`invalid float width (${a}): ${b}`);}},sc=(b,a,c)=>{switch(a){case 1:return c?d=>La[d]:d=>M[d];case 2:return c?d=>Ma[d>>1]:d=>Na[d>>1];case 4:return c?d=>Oa[d>>2]:d=>N[d>>2];default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},tc=globalThis.TextDecoder&&new TextDecoder,uc=(b,a,c,d)=>{c=a+c;if(d)return c;for(;b[a]&&!(a>=c);)++a;return a},vc=(b,a=0,c,d)=>{c=uc(b,a,c,d);if(16<c-a&&b.buffer&&tc)return tc.decode(b.subarray(a,
|
|
559
|
+
c));for(d="";a<c;){var f=b[a++];if(f&128){var m=b[a++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|m);else{var h=b[a++]&63;f=224==(f&240)?(f&15)<<12|m<<6|h:(f&7)<<18|m<<12|h<<6|b[a++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d},wc=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,xc=(b,a,c)=>{b>>=1;a=uc(Na,b,a/2,c);if(16<a-b&&wc)return wc.decode(Na.subarray(b,a));for(c="";b<a;++b)c+=String.fromCharCode(Na[b]);
|
|
560
|
+
return c},yc=(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 f=0;f<c;++f)Ma[a>>1]=b.charCodeAt(f),a+=2;Ma[a>>1]=0;return a-d},zc=b=>2*b.length,Ac=(b,a,c)=>{var d="";b>>=2;for(var f=0;!(f>=a/4);f++){var m=N[b+f];if(!m&&!c)break;d+=String.fromCodePoint(m)}return d},Bc=(b,a,c)=>{c??=2147483647;if(4>c)return 0;var d=a;c=d+c-4;for(var f=0;f<b.length;++f){var m=b.codePointAt(f);65535<m&&f++;Oa[a>>2]=m;a+=4;if(a+4>c)break}Oa[a>>2]=0;return a-d},Cc=b=>{for(var a=
|
|
561
|
+
0,c=0;c<b.length;++c)65535<b.codePointAt(c)&&c++,a+=4;return a},Dc=[],Ec=b=>{var a=Dc.length;Dc.push(b);return a},Fc=(b,a)=>{for(var c=Array(b),d=0;d<b;++d)c[d]=rb(N[a+4*d>>2],`parameter ${d}`);return c},Gc={},Hc=b=>{var a=Gc[b];return void 0===a?U(b):a},Ic=[null,[],[]];
|
|
562
|
+
(()=>{let b=Hb.prototype;Object.assign(b,{isAliasOf:function(c){if(!(this instanceof Hb&&c instanceof Hb))return!1;var d=this.g.o.h,f=this.g.l;c.g=c.g;var m=c.g.o.h;for(c=c.g.l;d.C;)f=d.fa(f),d=d.C;for(;m.C;)c=m.fa(c),m=m.C;return d===m&&f===c},clone:function(){this.g.l||Fb(this);if(this.g.aa)return this.g.count.value+=1,this;var c=xb,d=Object,f=d.create,m=Object.getPrototypeOf(this),h=this.g;c=c(f.call(d,m,{g:{value:{count:h.count,da:h.da,aa:h.aa,l:h.l,o:h.o,D:h.D,K:h.K}}}));c.g.count.value+=1;c.g.da=
|
|
563
|
+
!1;return c},["delete"](){this.g.l||Fb(this);if(this.g.da&&!this.g.aa)throw new O("Object already scheduled for deletion");vb(this);var c=this.g;--c.count.value;0===c.count.value&&(c.D?c.K.P(c.D):c.o.h.P(c.l));this.g.aa||(this.g.D=void 0,this.g.l=void 0)},isDeleted:function(){return!this.g.l},deleteLater:function(){this.g.l||Fb(this);if(this.g.da&&!this.g.aa)throw new O("Object already scheduled for deletion");Gb.push(this);this.g.da=!0;return this}});const a=Symbol.dispose;a&&(b[a]=b["delete"])})();
|
|
564
|
+
Object.assign(Vb.prototype,{Fb(b){this.bb&&(b=this.bb(b));return b},Ra(b){this.P?.(b)},J:Ab,j:function(b){function a(){return this.ma?Ub(this.h.O,{o:this.Nb,l:c,K:this,D:b}):Ub(this.h.O,{o:this,l:b})}var c=this.Fb(b);if(!c)return this.Ra(b),null;var d=Tb(this.h,c);if(void 0!==d){if(0===d.g.count.value)return d.g.l=c,d.g.D=b,d.clone();d=d.clone();this.Ra(b);return d}d=this.h.Eb(c);d=Ib[d];if(!d)return a.call(this);d=this.la?d.ub:d.pointerType;var f=Sb(c,this.h,d.h);return null===f?a.call(this):this.ma?
|
|
565
|
+
Ub(d.h.O,{o:d,l:f,K:this,D:b}):Ub(d.h.O,{o:d,l:f})}});l.print&&(Da=l.print);l.printErr&&(Fa=l.printErr);l.wasmBinary&&(Ha=l.wasmBinary);if(l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);0<l.preInit.length;)l.preInit.shift()();
|
|
566
|
+
var pb,Jc,ob,Ta,Yb,Kc={_abort_js:()=>Ua(""),_embind_create_inheriting_constructor:(b,a,c)=>{b=U(b);a=rb(a,"wrapper");c=Q(c);var d=a.h,f=d.O,m=d.C.O,h=d.C.constructor;b=gb(b,function(...g){for(var n of d.C.ab)if(this[n]===m[n])throw new kb(`Pure virtual function ${n} must be implemented in JavaScript`);Object.defineProperty(this,"__parent",{value:f});this.__construct(...g)});f.__construct=function(...g){if(this===f)throw new O("Pass correct 'this' to __construct");g=h.implement(this,...g);vb(g);var n=
|
|
567
|
+
g.g;g.notifyOnDestruction();n.aa=!0;Object.defineProperties(this,{g:{value:n}});xb(this);g=n.l;g=mb(d,g);if(lb.hasOwnProperty(g))throw new O(`Tried to register registered instance: ${g}`);lb[g]=this};f.__destruct=function(){if(this===f)throw new O("Pass correct 'this' to __destruct");vb(this);var g=this.g.l;g=mb(d,g);if(lb.hasOwnProperty(g))delete lb[g];else throw new O(`Tried to unregister unregistered instance: ${g}`);};b.prototype=Object.create(f);Object.assign(b.prototype,c);return jb(b)},_embind_finalize_value_object:b=>
|
|
568
|
+
{var a=yb[b];delete yb[b];var c=a.Ia,d=a.P,f=a.Ua,m=f.map(h=>h.Ib).concat(f.map(h=>h.Rb));W([b],m,h=>{var g={},n,r;for([n,r]of f.entries()){const A=h[n],q=r.Gb,w=r.Hb,p=h[n+f.length],z=r.Qb,C=r.Sb;g[r.Cb]={read:G=>A.j(q(w,G)),write:(G,E)=>{var H=[];z(C,G,p.v(H,E));zb(H)},optional:A.optional}}return[{name:a.name,j:A=>{var q={},w;for(w in g)q[w]=g[w].read(A);d(A);return q},v:(A,q)=>{for(var w in g)if(!(w in q||g[w].optional))throw new TypeError(`Missing field: "${w}"`);var p=c();for(w in g)g[w].write(p,
|
|
569
|
+
q[w]);null!==A&&A.push(d,p);return p},J:Ab,H:d}]})},_embind_register_bigint:()=>{},_embind_register_bool:(b,a,c,d)=>{a=U(a);V(b,{name:a,j:function(f){return!!f},v:function(f,m){return m?c:d},J:function(f){return this.j(M[f])},H:null})},_embind_register_class:(b,a,c,d,f,m,h,g,n,r,A,q,w)=>{A=U(A);m=X(f,m);g&&=X(h,g);r&&=X(n,r);w=X(q,w);var p=Lb(A);Kb(p,function(){ic(`Cannot construct ${A} due to unbound types`,[d])});W([b,a,c],d?[d]:[],z=>{z=z[0];if(d){var C=z.h;var G=C.O}else G=Hb.prototype;z=gb(A,
|
|
570
|
+
function(...R){if(Object.getPrototypeOf(this)!==E)throw new O(`Use 'new' to construct ${A}`);if(void 0===H.U)throw new O(`${A} has no accessible constructor`);var I=H.U[R.length];if(void 0===I)throw new O(`Tried to invoke ctor of ${A} with invalid number of parameters (${R.length}) - expected (${Object.keys(H.U).toString()}) parameters instead!`);return I.apply(this,R)});var E=Object.create(G,{constructor:{value:z}});z.prototype=E;var H=new Mb(A,z,E,w,C,m,g,r);if(H.C){var L;(L=H.C).ga??(L.ga=[]);
|
|
571
|
+
H.C.ga.push(H)}C=new Vb(A,H,!0,!1,!1);L=new Vb(A+"*",H,!1,!1,!1);G=new Vb(A+" const*",H,!1,!0,!1);Ib[b]={pointerType:L,ub:G};Wb(p,z);return[C,L,G]})},_embind_register_class_class_function:(b,a,c,d,f,m,h)=>{var g=lc(c,d);a=U(a);a=mc(a);m=X(f,m);W([],[b],n=>{function r(){ic(`Cannot call ${A} due to unbound types`,g)}n=n[0];var A=`${n.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);var q=n.h.constructor;void 0===q[a]?(r.R=c-1,q[a]=r):(Jb(q,a,A),q[a].u[c-1]=r);W([],g,w=>{w=kc(A,[w[0],null].concat(w.slice(1)),
|
|
572
|
+
null,m,h);void 0===q[a].u?(w.R=c-1,q[a]=w):q[a].u[c-1]=w;if(n.h.ga)for(const p of n.h.ga)p.constructor.hasOwnProperty(a)||(p.constructor[a]=w);return[]});return[]})},_embind_register_class_class_property:(b,a,c,d,f,m,h,g)=>{a=U(a);m=X(f,m);W([],[b],n=>{n=n[0];var r=`${n.name}.${a}`,A={get(){ic(`Cannot access ${r} due to unbound types`,[c])},enumerable:!0,configurable:!0};A.set=g?()=>{ic(`Cannot access ${r} due to unbound types`,[c])}:()=>{throw new O(`${r} is a read-only property`);};Object.defineProperty(n.h.constructor,
|
|
573
|
+
a,A);W([],[c],q=>{q=q[0];var w={get(){return q.j(m(d))},enumerable:!0};g&&(g=X(h,g),w.set=p=>{var z=[];g(d,q.v(z,p));zb(z)});Object.defineProperty(n.h.constructor,a,w);return[]});return[]})},_embind_register_class_constructor:(b,a,c,d,f,m)=>{var h=lc(a,c);f=X(d,f);W([],[b],g=>{g=g[0];var n=`constructor ${g.name}`;void 0===g.h.U&&(g.h.U=[]);if(void 0!==g.h.U[a-1])throw new O(`Cannot register multiple constructors with identical number of parameters (${a-1}) for class '${g.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
|
|
574
|
+
g.h.U[a-1]=()=>{ic(`Cannot construct ${g.name} due to unbound types`,h)};W([],h,r=>{r.splice(1,0,null);g.h.U[a-1]=kc(n,r,null,f,m);return[]});return[]})},_embind_register_class_function:(b,a,c,d,f,m,h,g)=>{var n=lc(c,d);a=U(a);a=mc(a);m=X(f,m);W([],[b],r=>{function A(){ic(`Cannot call ${q} due to unbound types`,n)}r=r[0];var q=`${r.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);g&&r.h.ab.push(a);var w=r.h.O,p=w[a];void 0===p||void 0===p.u&&p.className!==r.name&&p.R===c-2?(A.R=c-2,A.className=
|
|
575
|
+
r.name,w[a]=A):(Jb(w,a,q),w[a].u[c-2]=A);W([],n,z=>{z=kc(q,z,r,m,h);void 0===w[a].u?(z.R=c-2,w[a]=z):w[a].u[c-2]=z;return[]});return[]})},_embind_register_class_property:(b,a,c,d,f,m,h,g,n,r)=>{a=U(a);f=X(d,f);W([],[b],A=>{A=A[0];var q=`${A.name}.${a}`,w={get(){ic(`Cannot access ${q} due to unbound types`,[c,h])},enumerable:!0,configurable:!0};w.set=n?()=>ic(`Cannot access ${q} due to unbound types`,[c,h]):()=>{throw new O(q+" is a read-only property");};Object.defineProperty(A.h.O,a,w);W([],n?[c,
|
|
576
|
+
h]:[c],p=>{var z=p[0],C={get(){var E=nc(this,A,q+" getter");return z.j(f(m,E))},enumerable:!0};if(n){n=X(g,n);var G=p[1];C.set=function(E){var H=nc(this,A,q+" setter"),L=[];n(r,H,G.v(L,E));zb(L)}}Object.defineProperty(A.h.O,a,C);return[]});return[]})},_embind_register_emval:b=>V(b,pc),_embind_register_enum:(b,a,c,d,f)=>{a=U(a);f=0===f?"object":1===f?"number":"string";switch(f){case "object":function h(){}h.values={};V(b,{name:a,constructor:h,valueType:f,j:function(g){return this.constructor.values[g]},
|
|
577
|
+
v:(g,n)=>n.value,J:qc(a,c,d),H:null});Kb(a,h);break;case "number":var m={};V(b,{name:a,Fa:m,valueType:f,j:g=>g,v:(g,n)=>n,J:qc(a,c,d),H:null});Kb(a,m);delete l[a].R;break;case "string":m={},V(b,{name:a,ib:{},cb:{},Fa:m,valueType:f,j:function(g){return this.cb[g]},v:function(g,n){return this.ib[n]},J:qc(a,c,d),H:null}),Kb(a,m),delete l[a].R}},_embind_register_enum_value:(b,a,c)=>{var d=rb(b,"enum");a=U(a);switch(d.valueType){case "object":b=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},
|
|
578
|
+
constructor:{value:gb(`${d.name}_${a}`,function(){})}});b.values[c]=d;b[a]=d;break;case "number":d.Fa[a]=c;break;case "string":d.ib[a]=c,d.cb[c]=a,d.Fa[a]=a}},_embind_register_float:(b,a,c)=>{a=U(a);V(b,{name:a,j:d=>d,v:(d,f)=>f,J:rc(a,c),H:null})},_embind_register_function:(b,a,c,d,f,m)=>{var h=lc(a,c);b=U(b);b=mc(b);f=X(d,f);Kb(b,function(){ic(`Cannot call ${b} due to unbound types`,h)},a-1);W([],h,g=>{Wb(b,kc(b,[g[0],null].concat(g.slice(1)),null,f,m),a-1);return[]})},_embind_register_integer:(b,
|
|
579
|
+
a,c,d,f)=>{a=U(a);let m=g=>g;if(0===d){var h=32-8*c;m=g=>g<<h>>>h;f=m(f)}V(b,{name:a,j:m,v:(g,n)=>n,J:sc(a,c,0!==d),H:null})},_embind_register_memory_view:(b,a,c)=>{function d(m){return new f(La.buffer,N[m+4>>2],N[m>>2])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][a];c=U(c);V(b,{name:c,j:d,J:d},{Jb:!0})},_embind_register_std_string:(b,a)=>{a=U(a);V(b,{name:a,j(c){var d=(d=c+4)?vc(M,d,N[c>>2],!0):"";pb(c);return d},v(c,d){d instanceof ArrayBuffer&&
|
|
580
|
+
(d=new Uint8Array(d));var f,m="string"==typeof d;if(!(m||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new O("Cannot pass non-string to std::string");var h;if(m)for(f=h=0;f<d.length;++f){var g=d.charCodeAt(f);127>=g?h++:2047>=g?h+=2:55296<=g&&57343>=g?(h+=4,++f):h+=3}else h=d.length;f=h;h=Jc(4+f+1);g=h+4;N[h>>2]=f;if(m){if(m=g,g=f+1,f=M,0<g){g=m+g-1;for(var n=0;n<d.length;++n){var r=d.codePointAt(n);if(127>=r){if(m>=g)break;f[m++]=r}else if(2047>=r){if(m+1>=g)break;f[m++]=192|r>>6;f[m++]=128|
|
|
581
|
+
r&63}else if(65535>=r){if(m+2>=g)break;f[m++]=224|r>>12;f[m++]=128|r>>6&63;f[m++]=128|r&63}else{if(m+3>=g)break;f[m++]=240|r>>18;f[m++]=128|r>>12&63;f[m++]=128|r>>6&63;f[m++]=128|r&63;n++}}f[m]=0}}else M.set(d,g);null!==c&&c.push(pb,h);return h},J:Ab,H(c){pb(c)}})},_embind_register_std_wstring:(b,a,c)=>{c=U(c);if(2===a){var d=xc;var f=yc;var m=zc}else d=Ac,f=Bc,m=Cc;V(b,{name:c,j:h=>{var g=d(h+4,N[h>>2]*a,!0);pb(h);return g},v:(h,g)=>{if("string"!=typeof g)throw new O(`Cannot pass non-string to C++ string type ${c}`);
|
|
582
|
+
var n=m(g),r=Jc(4+n+a);N[r>>2]=n/a;f(g,r+4,n+a);null!==h&&h.push(pb,r);return r},J:Ab,H(h){pb(h)}})},_embind_register_value_object:(b,a,c,d,f,m)=>{yb[b]={name:U(a),Ia:X(c,d),P:X(f,m),Ua:[]}},_embind_register_value_object_field:(b,a,c,d,f,m,h,g,n,r)=>{yb[b].Ua.push({Cb:U(a),Ib:c,Gb:X(d,f),Hb:m,Rb:h,Qb:X(g,n),Sb:r})},_embind_register_void:(b,a)=>{a=U(a);V(b,{Kb:!0,name:a,j:()=>{},v:()=>{}})},_emval_create_invoker:(b,a,c)=>{var [d,...f]=Fc(b,a),m=d.v.bind(d),h=f.map(n=>n.J.bind(n));b--;var g=Array(b);
|
|
583
|
+
a=`methodCaller<(${f.map(n=>n.name)}) => ${d.name}>`;return Ec(gb(a,(n,r,A,q)=>{for(var w=0,p=0;p<b;++p)g[p]=h[p](q+w),w+=8;switch(c){case 0:var z=Q(n).apply(null,g);break;case 2:z=Reflect.construct(Q(n),g);break;case 3:z=g[0];break;case 1:z=Q(n)[Hc(r)](...g)}n=[];z=m(n,z);n.length&&(N[A>>2]=jb(n));return z}))},_emval_decref:oc,_emval_get_module_property:b=>{b=Hc(b);return jb(l[b])},_emval_get_property:(b,a)=>{b=Q(b);a=Q(a);return jb(b[a])},_emval_incref:b=>{9<b&&(ib[b+1]+=1)},_emval_invoke:(b,a,
|
|
584
|
+
c,d,f)=>Dc[b](a,c,d,f),_emval_new_array:()=>jb([]),_emval_new_cstring:b=>jb(Hc(b)),_emval_new_object:()=>jb({}),_emval_run_destructors:b=>{var a=Q(b);zb(a);oc(b)},_emval_set_property:(b,a,c)=>{b=Q(b);a=Q(a);c=Q(c);b[a]=c},clock_time_get:function(b,a,c,d){if(!(0<=b&&3>=b))return 28;b=Math.round(1E6*(0===b?Date.now():performance.now()));bb=[b>>>0,(ab=b,1<=+Math.abs(ab)?0<ab?+Math.floor(ab/4294967296)>>>0:~~+Math.ceil((ab-+(~~ab>>>0))/4294967296)>>>0:0)];Oa[d>>2]=bb[0];Oa[d+4>>2]=bb[1];return 0},emscripten_resize_heap:b=>
|
|
585
|
+
{var a=M.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))-Ta.buffer.byteLength+65535)/65536|0;try{Ta.grow(d);Sa();var f=1;break a}catch(m){}f=void 0}if(f)return!0}return!1},fd_close:()=>52,fd_seek:function(){return 70},fd_write:(b,a,c,d)=>{for(var f=0,m=0;m<c;m++){var h=N[a>>2],g=N[a+4>>2];a+=8;for(var n=0;n<g;n++){var r=b,A=M[h+n],q=Ic[r];0===A||10===A?((1===r?Da:Fa)(vc(q)),q.length=
|
|
586
|
+
0):q.push(A)}f+=g}N[d>>2]=f;return 0}},Lc;
|
|
587
|
+
Lc=await (async function(){function b(c){c=Lc=c.exports;pb=c.free;Jc=c.malloc;ob=c.__getTypeName;Xb.vij=c.dynCall_vij;Xb.iij=c.dynCall_iij;Xb.ji=c.dynCall_ji;Xb.jiji=c.dynCall_jiji;Ta=c.memory;Yb=c.__indirect_function_table;Sa();return Lc}var a={env:Kc,wasi_snapshot_preview1:Kc};if(l.instantiateWasm)return new Promise(c=>{l.instantiateWasm(a,(d,f)=>{c(b(d,f))})});Xa??=l.locateFile?l.locateFile("canvas_advanced_c2d_only.wasm",za):za+"canvas_advanced_c2d_only.wasm";return b((await $a(a)).instance)}());
|
|
588
|
+
(function(){function b(){l.calledRun=!0;if(!Ia){Ra=!0;Lc.__wasm_call_ctors();Ja?.(l);l.onRuntimeInitialized?.();if(l.postRun)for("function"==typeof l.postRun&&(l.postRun=[l.postRun]);l.postRun.length;){var a=l.postRun.shift();db.push(a)}cb(db)}}if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.length;)fb();cb(eb);l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1);b()},1)):b()})();Ra?moduleRtn=l:moduleRtn=new Promise((b,a)=>{Ja=b;Ka=a});
|
|
538
589
|
;return moduleRtn}})();
|
|
539
590
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
|
|
540
591
|
|
|
@@ -550,7 +601,7 @@ Cc=await (async function(){function b(c){c=Cc=c.exports;kb=c.free;Ac=c.malloc;jb
|
|
|
550
601
|
/***/ ((module) => {
|
|
551
602
|
|
|
552
603
|
"use strict";
|
|
553
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.
|
|
604
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.49.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}}');
|
|
554
605
|
|
|
555
606
|
/***/ }),
|
|
556
607
|
/* 7 */
|
|
@@ -2689,29 +2740,32 @@ function canvasOffset(canvas) {
|
|
|
2689
2740
|
"use strict";
|
|
2690
2741
|
__webpack_require__.r(__webpack_exports__);
|
|
2691
2742
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2692
|
-
/* harmony export */ AudioAssetWrapper: () => (/* reexport safe */
|
|
2693
|
-
/* harmony export */ AudioWrapper: () => (/* reexport safe */
|
|
2694
|
-
/* harmony export */ BLANK_URL: () => (/* reexport safe */
|
|
2695
|
-
/* harmony export */ CustomFileAssetLoaderWrapper: () => (/* reexport safe */
|
|
2696
|
-
/* harmony export */ FileAssetWrapper: () => (/* reexport safe */
|
|
2697
|
-
/* harmony export */ FileFinalizer: () => (/* reexport safe */
|
|
2743
|
+
/* harmony export */ AudioAssetWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.AudioAssetWrapper),
|
|
2744
|
+
/* harmony export */ AudioWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.AudioWrapper),
|
|
2745
|
+
/* harmony export */ BLANK_URL: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_3__.BLANK_URL),
|
|
2746
|
+
/* harmony export */ CustomFileAssetLoaderWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.CustomFileAssetLoaderWrapper),
|
|
2747
|
+
/* harmony export */ FileAssetWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.FileAssetWrapper),
|
|
2748
|
+
/* harmony export */ FileFinalizer: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.FileFinalizer),
|
|
2698
2749
|
/* harmony export */ FocusSessionState: () => (/* reexport safe */ _registerKeyboardInteractions__WEBPACK_IMPORTED_MODULE_1__.FocusSessionState),
|
|
2699
|
-
/* harmony export */ FontAssetWrapper: () => (/* reexport safe */
|
|
2700
|
-
/* harmony export */ FontWrapper: () => (/* reexport safe */
|
|
2701
|
-
/* harmony export */
|
|
2702
|
-
/* harmony export */
|
|
2750
|
+
/* harmony export */ FontAssetWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.FontAssetWrapper),
|
|
2751
|
+
/* harmony export */ FontWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.FontWrapper),
|
|
2752
|
+
/* harmony export */ GamepadInteractions: () => (/* reexport safe */ _gamepadInteractions__WEBPACK_IMPORTED_MODULE_2__.GamepadInteractions),
|
|
2753
|
+
/* harmony export */ ImageAssetWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.ImageAssetWrapper),
|
|
2754
|
+
/* harmony export */ ImageWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.ImageWrapper),
|
|
2703
2755
|
/* harmony export */ KeyboardInteractions: () => (/* reexport safe */ _registerKeyboardInteractions__WEBPACK_IMPORTED_MODULE_1__.KeyboardInteractions),
|
|
2704
|
-
/* harmony export */ RiveFont: () => (/* reexport safe */
|
|
2705
|
-
/* harmony export */ createFinalization: () => (/* reexport safe */
|
|
2706
|
-
/* harmony export */ finalizationRegistry: () => (/* reexport safe */
|
|
2756
|
+
/* harmony export */ RiveFont: () => (/* reexport safe */ _riveFont__WEBPACK_IMPORTED_MODULE_5__.RiveFont),
|
|
2757
|
+
/* harmony export */ createFinalization: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.createFinalization),
|
|
2758
|
+
/* harmony export */ finalizationRegistry: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.finalizationRegistry),
|
|
2707
2759
|
/* harmony export */ registerTouchInteractions: () => (/* reexport safe */ _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__.registerTouchInteractions),
|
|
2708
|
-
/* harmony export */ sanitizeUrl: () => (/* reexport safe */
|
|
2760
|
+
/* harmony export */ sanitizeUrl: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_3__.sanitizeUrl)
|
|
2709
2761
|
/* harmony export */ });
|
|
2710
2762
|
/* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
|
|
2711
2763
|
/* harmony import */ var _registerKeyboardInteractions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15);
|
|
2712
|
-
/* harmony import */ var
|
|
2713
|
-
/* harmony import */ var
|
|
2714
|
-
/* harmony import */ var
|
|
2764
|
+
/* harmony import */ var _gamepadInteractions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18);
|
|
2765
|
+
/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20);
|
|
2766
|
+
/* harmony import */ var _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21);
|
|
2767
|
+
/* harmony import */ var _riveFont__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22);
|
|
2768
|
+
|
|
2715
2769
|
|
|
2716
2770
|
|
|
2717
2771
|
|
|
@@ -4331,6 +4385,395 @@ function clamp(v, min, max) {
|
|
|
4331
4385
|
/* 18 */
|
|
4332
4386
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4333
4387
|
|
|
4388
|
+
"use strict";
|
|
4389
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4390
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4391
|
+
/* harmony export */ GamepadInteractions: () => (/* binding */ GamepadInteractions)
|
|
4392
|
+
/* harmony export */ });
|
|
4393
|
+
/* harmony import */ var _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19);
|
|
4394
|
+
|
|
4395
|
+
// Standard mapping: 17 buttons, 4 stick axes, plus triggers mirrored onto axes 4/5.
|
|
4396
|
+
var STANDARD_BUTTON_COUNT = 17;
|
|
4397
|
+
var STANDARD_STICK_AXIS_COUNT = 4;
|
|
4398
|
+
var LEFT_TRIGGER_BUTTON = 6;
|
|
4399
|
+
var RIGHT_TRIGGER_BUTTON = 7;
|
|
4400
|
+
// Consecutive rejected batches before giving up on a state machine.
|
|
4401
|
+
var MAX_SUBMIT_FAILURES = 3;
|
|
4402
|
+
function zeros(n) {
|
|
4403
|
+
var out = [];
|
|
4404
|
+
for (var i = 0; i < n; i++) {
|
|
4405
|
+
out.push(0);
|
|
4406
|
+
}
|
|
4407
|
+
return out;
|
|
4408
|
+
}
|
|
4409
|
+
function restState(pad) {
|
|
4410
|
+
return {
|
|
4411
|
+
deviceId: pad.deviceId,
|
|
4412
|
+
mapping: pad.mapping,
|
|
4413
|
+
buttons: zeros(pad.buttons.length),
|
|
4414
|
+
axes: zeros(pad.axes.length),
|
|
4415
|
+
};
|
|
4416
|
+
}
|
|
4417
|
+
function readNavigatorGamepads() {
|
|
4418
|
+
if (typeof navigator === "undefined" || !navigator.getGamepads) {
|
|
4419
|
+
return [];
|
|
4420
|
+
}
|
|
4421
|
+
try {
|
|
4422
|
+
return Array.prototype.slice.call(navigator.getGamepads());
|
|
4423
|
+
}
|
|
4424
|
+
catch (_a) {
|
|
4425
|
+
// Permissions-Policy or insecure-origin SecurityError.
|
|
4426
|
+
return [];
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4429
|
+
function readButtons(pad, count) {
|
|
4430
|
+
var buttons = [];
|
|
4431
|
+
for (var i = 0; i < count; i++) {
|
|
4432
|
+
buttons.push(pad.buttons[i] ? pad.buttons[i].value : 0);
|
|
4433
|
+
}
|
|
4434
|
+
return buttons;
|
|
4435
|
+
}
|
|
4436
|
+
function toPadState(deviceId, pad) {
|
|
4437
|
+
var _a;
|
|
4438
|
+
if (pad.mapping !== "standard") {
|
|
4439
|
+
// Unknown layout: sent as reported, up to the core's caps.
|
|
4440
|
+
return {
|
|
4441
|
+
deviceId: deviceId,
|
|
4442
|
+
mapping: _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__.GamepadMappingKind.Unknown,
|
|
4443
|
+
buttons: readButtons(pad, Math.min(pad.buttons.length, _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__.GAMEPAD_MAX_BUTTONS)),
|
|
4444
|
+
axes: pad.axes.slice(0, _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__.GAMEPAD_MAX_AXES),
|
|
4445
|
+
};
|
|
4446
|
+
}
|
|
4447
|
+
var buttons = readButtons(pad, STANDARD_BUTTON_COUNT);
|
|
4448
|
+
var axes = [];
|
|
4449
|
+
for (var i = 0; i < STANDARD_STICK_AXIS_COUNT; i++) {
|
|
4450
|
+
axes.push((_a = pad.axes[i]) !== null && _a !== void 0 ? _a : 0);
|
|
4451
|
+
}
|
|
4452
|
+
axes.push(buttons[LEFT_TRIGGER_BUTTON], buttons[RIGHT_TRIGGER_BUTTON]);
|
|
4453
|
+
return { deviceId: deviceId, mapping: _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__.GamepadMappingKind.Standard, buttons: buttons, axes: axes };
|
|
4454
|
+
}
|
|
4455
|
+
/**
|
|
4456
|
+
* Page-wide gamepad reader shared by every Rive instance: one `getGamepads()` per frame,
|
|
4457
|
+
* device ids allocated once (monotonic from 1, never reused), and a single window listener.
|
|
4458
|
+
*/
|
|
4459
|
+
var GamepadSource = /** @class */ (function () {
|
|
4460
|
+
function GamepadSource() {
|
|
4461
|
+
var _this = this;
|
|
4462
|
+
this.subscribers = 0;
|
|
4463
|
+
this.hasPads = false;
|
|
4464
|
+
this.nextDeviceId = 1;
|
|
4465
|
+
this.slots = {};
|
|
4466
|
+
this.cachedTime = NaN;
|
|
4467
|
+
this.cached = [];
|
|
4468
|
+
this.onConnected = function () {
|
|
4469
|
+
_this.hasPads = true;
|
|
4470
|
+
};
|
|
4471
|
+
}
|
|
4472
|
+
GamepadSource.prototype.subscribe = function () {
|
|
4473
|
+
if (this.subscribers++ > 0 || typeof window === "undefined") {
|
|
4474
|
+
return;
|
|
4475
|
+
}
|
|
4476
|
+
window.addEventListener("gamepadconnected", this.onConnected);
|
|
4477
|
+
// The event doesn't re-fire for pads exposed before we started listening.
|
|
4478
|
+
this.hasPads = readNavigatorGamepads().some(function (pad) { return !!pad; });
|
|
4479
|
+
};
|
|
4480
|
+
GamepadSource.prototype.unsubscribe = function () {
|
|
4481
|
+
if (--this.subscribers > 0 || typeof window === "undefined") {
|
|
4482
|
+
return;
|
|
4483
|
+
}
|
|
4484
|
+
window.removeEventListener("gamepadconnected", this.onConnected);
|
|
4485
|
+
this.hasPads = false;
|
|
4486
|
+
this.cachedTime = NaN;
|
|
4487
|
+
this.cached = [];
|
|
4488
|
+
};
|
|
4489
|
+
/** Current pads; cached per rAF timestamp so instances share one read. */
|
|
4490
|
+
GamepadSource.prototype.read = function (time) {
|
|
4491
|
+
if (!this.hasPads) {
|
|
4492
|
+
return [];
|
|
4493
|
+
}
|
|
4494
|
+
if (time === this.cachedTime) {
|
|
4495
|
+
return this.cached;
|
|
4496
|
+
}
|
|
4497
|
+
var pads = [];
|
|
4498
|
+
// Rebuilt each read so emptied slots drop out.
|
|
4499
|
+
var slots = {};
|
|
4500
|
+
var gamepads = readNavigatorGamepads();
|
|
4501
|
+
for (var i = 0; i < gamepads.length; i++) {
|
|
4502
|
+
var pad = gamepads[i];
|
|
4503
|
+
if (!pad || !pad.connected) {
|
|
4504
|
+
continue;
|
|
4505
|
+
}
|
|
4506
|
+
var prev = this.slots[pad.index];
|
|
4507
|
+
var slot = prev && prev.id === pad.id
|
|
4508
|
+
? prev
|
|
4509
|
+
: { deviceId: this.nextDeviceId++, id: pad.id };
|
|
4510
|
+
slots[pad.index] = slot;
|
|
4511
|
+
pads.push(toPadState(slot.deviceId, pad));
|
|
4512
|
+
}
|
|
4513
|
+
this.slots = slots;
|
|
4514
|
+
this.hasPads = pads.length > 0;
|
|
4515
|
+
this.cachedTime = time;
|
|
4516
|
+
this.cached = pads;
|
|
4517
|
+
return pads;
|
|
4518
|
+
};
|
|
4519
|
+
return GamepadSource;
|
|
4520
|
+
}());
|
|
4521
|
+
var gamepadSource = new GamepadSource();
|
|
4522
|
+
/**
|
|
4523
|
+
* Per-Rive-instance gamepad bridge driving a single state machine. Tracks what that state
|
|
4524
|
+
* machine has been sent and submits only the difference, so after a pause it catches up
|
|
4525
|
+
* without duplicate connected events.
|
|
4526
|
+
*/
|
|
4527
|
+
var GamepadInteractions = /** @class */ (function () {
|
|
4528
|
+
function GamepadInteractions(params) {
|
|
4529
|
+
this.params = params;
|
|
4530
|
+
this.encoder = new _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__.GamepadBatchEncoder();
|
|
4531
|
+
// deviceId -> values last sent to `stateMachine`.
|
|
4532
|
+
this.lastSentPads = new Map();
|
|
4533
|
+
this.submitFailures = 0;
|
|
4534
|
+
gamepadSource.subscribe();
|
|
4535
|
+
}
|
|
4536
|
+
/** Poll, diff and submit one batch. Call once per frame before advancing. */
|
|
4537
|
+
GamepadInteractions.prototype.handleGamepadInputs = function (time, stateMachine) {
|
|
4538
|
+
if (!stateMachine) {
|
|
4539
|
+
return;
|
|
4540
|
+
}
|
|
4541
|
+
if (stateMachine !== this.stateMachine) {
|
|
4542
|
+
// A new state machine knows no devices yet; resend connected records.
|
|
4543
|
+
this.stateMachine = stateMachine;
|
|
4544
|
+
this.lastSentPads.clear();
|
|
4545
|
+
this.submitFailures = 0;
|
|
4546
|
+
}
|
|
4547
|
+
if (this.submitFailures >= MAX_SUBMIT_FAILURES) {
|
|
4548
|
+
return;
|
|
4549
|
+
}
|
|
4550
|
+
var pads = gamepadSource.read(time);
|
|
4551
|
+
// Nothing connected and nothing left to disconnect.
|
|
4552
|
+
if (pads.length === 0 && this.lastSentPads.size === 0) {
|
|
4553
|
+
return;
|
|
4554
|
+
}
|
|
4555
|
+
if (this.params.requireFocus && !this.params.isFocusWithin()) {
|
|
4556
|
+
// Keep devices connected but release everything they hold.
|
|
4557
|
+
pads = pads.map(restState);
|
|
4558
|
+
}
|
|
4559
|
+
this.encoder.begin();
|
|
4560
|
+
this.encodeDiff(pads);
|
|
4561
|
+
if (this.encoder.isEmpty) {
|
|
4562
|
+
return;
|
|
4563
|
+
}
|
|
4564
|
+
if (stateMachine.submitGamepadsFromBuffer(this.encoder.end())) {
|
|
4565
|
+
this.submitFailures = 0;
|
|
4566
|
+
return;
|
|
4567
|
+
}
|
|
4568
|
+
// The core stops at the first bad record, so resend connected records next
|
|
4569
|
+
// frame rather than updates for devices it may never have seen.
|
|
4570
|
+
this.lastSentPads.clear();
|
|
4571
|
+
if (++this.submitFailures >= MAX_SUBMIT_FAILURES) {
|
|
4572
|
+
console.error("[Rive] Gamepad input was rejected by the state machine " +
|
|
4573
|
+
"".concat(MAX_SUBMIT_FAILURES, " times in a row; gamepad input is disabled for it."));
|
|
4574
|
+
}
|
|
4575
|
+
};
|
|
4576
|
+
GamepadInteractions.prototype.dispose = function () {
|
|
4577
|
+
this.stateMachine = undefined;
|
|
4578
|
+
this.lastSentPads.clear();
|
|
4579
|
+
gamepadSource.unsubscribe();
|
|
4580
|
+
};
|
|
4581
|
+
/** Writes records that bring `lastSentPads` up to `pads`, updating it as it goes. */
|
|
4582
|
+
GamepadInteractions.prototype.encodeDiff = function (pads) {
|
|
4583
|
+
var _this = this;
|
|
4584
|
+
var present = {};
|
|
4585
|
+
for (var i = 0; i < pads.length; i++) {
|
|
4586
|
+
var pad = pads[i];
|
|
4587
|
+
present[pad.deviceId] = true;
|
|
4588
|
+
var prev = this.lastSentPads.get(pad.deviceId);
|
|
4589
|
+
if (!prev) {
|
|
4590
|
+
// Connect at rest so inputs already held fire as updates.
|
|
4591
|
+
prev = restState(pad);
|
|
4592
|
+
this.encoder.connected(pad.deviceId, pad.mapping, prev.buttons, prev.axes);
|
|
4593
|
+
this.lastSentPads.set(pad.deviceId, prev);
|
|
4594
|
+
}
|
|
4595
|
+
this.encodeChanges(pad.deviceId, _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__.GamepadChangeKind.Button, prev.buttons, pad.buttons);
|
|
4596
|
+
this.encodeChanges(pad.deviceId, _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__.GamepadChangeKind.Axis, prev.axes, pad.axes);
|
|
4597
|
+
}
|
|
4598
|
+
this.lastSentPads.forEach(function (_, deviceId) {
|
|
4599
|
+
if (!present[deviceId]) {
|
|
4600
|
+
_this.encoder.disconnected(deviceId);
|
|
4601
|
+
_this.lastSentPads.delete(deviceId);
|
|
4602
|
+
}
|
|
4603
|
+
});
|
|
4604
|
+
};
|
|
4605
|
+
GamepadInteractions.prototype.encodeChanges = function (deviceId, kind, prev, next) {
|
|
4606
|
+
for (var i = 0; i < next.length; i++) {
|
|
4607
|
+
var value = next[i];
|
|
4608
|
+
if (value !== prev[i]) {
|
|
4609
|
+
this.encoder.update(deviceId, kind, i, value);
|
|
4610
|
+
prev[i] = value;
|
|
4611
|
+
}
|
|
4612
|
+
}
|
|
4613
|
+
};
|
|
4614
|
+
return GamepadInteractions;
|
|
4615
|
+
}());
|
|
4616
|
+
|
|
4617
|
+
|
|
4618
|
+
|
|
4619
|
+
/***/ }),
|
|
4620
|
+
/* 19 */
|
|
4621
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4622
|
+
|
|
4623
|
+
"use strict";
|
|
4624
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4625
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4626
|
+
/* harmony export */ GAMEPAD_BATCH_VERSION: () => (/* binding */ GAMEPAD_BATCH_VERSION),
|
|
4627
|
+
/* harmony export */ GAMEPAD_MAX_AXES: () => (/* binding */ GAMEPAD_MAX_AXES),
|
|
4628
|
+
/* harmony export */ GAMEPAD_MAX_BUTTONS: () => (/* binding */ GAMEPAD_MAX_BUTTONS),
|
|
4629
|
+
/* harmony export */ GamepadBatchEncoder: () => (/* binding */ GamepadBatchEncoder),
|
|
4630
|
+
/* harmony export */ GamepadChangeKind: () => (/* binding */ GamepadChangeKind),
|
|
4631
|
+
/* harmony export */ GamepadMappingKind: () => (/* binding */ GamepadMappingKind),
|
|
4632
|
+
/* harmony export */ GamepadRecordType: () => (/* binding */ GamepadRecordType)
|
|
4633
|
+
/* harmony export */ });
|
|
4634
|
+
/** Must match `rive::kGamepadBatchWireVersion` (runtime/include/rive/input/gamepad_batch.hpp). */
|
|
4635
|
+
var GAMEPAD_BATCH_VERSION = 2;
|
|
4636
|
+
var GAMEPAD_MAX_BUTTONS = 32;
|
|
4637
|
+
var GAMEPAD_MAX_AXES = 16;
|
|
4638
|
+
// Byte sizes of the wire fields/records.
|
|
4639
|
+
var VERSION_SIZE = 4; // u32
|
|
4640
|
+
var VALUE_SIZE = 4; // f32 button/axis value
|
|
4641
|
+
// type(1) + deviceId(4) + mapping(1) + nButtons(1) + nAxes(1) + padding(1); values follow
|
|
4642
|
+
var CONNECTED_HEADER_SIZE = 9;
|
|
4643
|
+
// type(1) + deviceId(4) + nChanges(1) + kind(1) + index(1) + value(4)
|
|
4644
|
+
// Always 12B because we send one change per event, but we could revisit to send larger updates.
|
|
4645
|
+
var UPDATE_RECORD_SIZE = 12;
|
|
4646
|
+
// type(1) + deviceId(4)
|
|
4647
|
+
var DISCONNECTED_RECORD_SIZE = 5;
|
|
4648
|
+
/** C++ `rive::GamepadRecordType`. */
|
|
4649
|
+
var GamepadRecordType;
|
|
4650
|
+
(function (GamepadRecordType) {
|
|
4651
|
+
GamepadRecordType[GamepadRecordType["Connected"] = 0] = "Connected";
|
|
4652
|
+
GamepadRecordType[GamepadRecordType["Update"] = 1] = "Update";
|
|
4653
|
+
GamepadRecordType[GamepadRecordType["Disconnected"] = 2] = "Disconnected";
|
|
4654
|
+
})(GamepadRecordType || (GamepadRecordType = {}));
|
|
4655
|
+
/** C++ `rive::GamepadInputChangeKind`. */
|
|
4656
|
+
var GamepadChangeKind;
|
|
4657
|
+
(function (GamepadChangeKind) {
|
|
4658
|
+
GamepadChangeKind[GamepadChangeKind["Button"] = 0] = "Button";
|
|
4659
|
+
GamepadChangeKind[GamepadChangeKind["Axis"] = 1] = "Axis";
|
|
4660
|
+
})(GamepadChangeKind || (GamepadChangeKind = {}));
|
|
4661
|
+
/** C++ `rive::GamepadMappingKind`. */
|
|
4662
|
+
var GamepadMappingKind;
|
|
4663
|
+
(function (GamepadMappingKind) {
|
|
4664
|
+
GamepadMappingKind[GamepadMappingKind["Standard"] = 0] = "Standard";
|
|
4665
|
+
GamepadMappingKind[GamepadMappingKind["Unknown"] = 1] = "Unknown";
|
|
4666
|
+
})(GamepadMappingKind || (GamepadMappingKind = {}));
|
|
4667
|
+
/**
|
|
4668
|
+
* Builds buffer to send to the state machine for gamepad input connection/updates/disconnect.
|
|
4669
|
+
*
|
|
4670
|
+
* Each `update` record carries a single change: the core
|
|
4671
|
+
* applies and dispatches records in order, so N single-change records in one batch behave like
|
|
4672
|
+
* N separate submits.
|
|
4673
|
+
*
|
|
4674
|
+
* `end()` returns a view into a reused scratch buffer, valid until the next `begin()`.
|
|
4675
|
+
*/
|
|
4676
|
+
var GamepadBatchEncoder = /** @class */ (function () {
|
|
4677
|
+
function GamepadBatchEncoder(initialCapacity) {
|
|
4678
|
+
if (initialCapacity === void 0) { initialCapacity = 256; }
|
|
4679
|
+
this.offset = 0;
|
|
4680
|
+
this.buffer = new ArrayBuffer(initialCapacity);
|
|
4681
|
+
this.view = new DataView(this.buffer);
|
|
4682
|
+
this.bytes = new Uint8Array(this.buffer);
|
|
4683
|
+
}
|
|
4684
|
+
GamepadBatchEncoder.prototype.begin = function () {
|
|
4685
|
+
this.offset = 0;
|
|
4686
|
+
this.ensure(VERSION_SIZE);
|
|
4687
|
+
this.writeU32(GAMEPAD_BATCH_VERSION);
|
|
4688
|
+
};
|
|
4689
|
+
Object.defineProperty(GamepadBatchEncoder.prototype, "isEmpty", {
|
|
4690
|
+
/** True when no records were written since `begin()`. */
|
|
4691
|
+
get: function () {
|
|
4692
|
+
return this.offset <= VERSION_SIZE;
|
|
4693
|
+
},
|
|
4694
|
+
enumerable: false,
|
|
4695
|
+
configurable: true
|
|
4696
|
+
});
|
|
4697
|
+
/** Set up buffer size/initialized values for a connected device */
|
|
4698
|
+
GamepadBatchEncoder.prototype.connected = function (deviceId, mapping, buttonValues, axes) {
|
|
4699
|
+
var nButtons = Math.min(buttonValues.length, GAMEPAD_MAX_BUTTONS);
|
|
4700
|
+
var nAxes = Math.min(axes.length, GAMEPAD_MAX_AXES);
|
|
4701
|
+
this.ensure(CONNECTED_HEADER_SIZE + (nButtons + nAxes) * VALUE_SIZE);
|
|
4702
|
+
this.writeU8(GamepadRecordType.Connected);
|
|
4703
|
+
this.writeI32(deviceId);
|
|
4704
|
+
this.writeU8(mapping);
|
|
4705
|
+
this.writeU8(nButtons);
|
|
4706
|
+
this.writeU8(nAxes);
|
|
4707
|
+
this.writeU8(0); // padding
|
|
4708
|
+
for (var i = 0; i < nButtons; i++) {
|
|
4709
|
+
this.writeF32(buttonValues[i]);
|
|
4710
|
+
}
|
|
4711
|
+
for (var i = 0; i < nAxes; i++) {
|
|
4712
|
+
this.writeF32(axes[i]);
|
|
4713
|
+
}
|
|
4714
|
+
};
|
|
4715
|
+
/** */
|
|
4716
|
+
GamepadBatchEncoder.prototype.update = function (deviceId, kind, index, value) {
|
|
4717
|
+
this.ensure(UPDATE_RECORD_SIZE);
|
|
4718
|
+
this.writeU8(GamepadRecordType.Update);
|
|
4719
|
+
this.writeI32(deviceId);
|
|
4720
|
+
this.writeU8(1); // one change per record
|
|
4721
|
+
this.writeU8(kind);
|
|
4722
|
+
this.writeU8(index);
|
|
4723
|
+
this.writeF32(value);
|
|
4724
|
+
};
|
|
4725
|
+
GamepadBatchEncoder.prototype.disconnected = function (deviceId) {
|
|
4726
|
+
this.ensure(DISCONNECTED_RECORD_SIZE);
|
|
4727
|
+
this.writeU8(GamepadRecordType.Disconnected);
|
|
4728
|
+
this.writeI32(deviceId);
|
|
4729
|
+
};
|
|
4730
|
+
GamepadBatchEncoder.prototype.end = function () {
|
|
4731
|
+
return this.bytes.subarray(0, this.offset);
|
|
4732
|
+
};
|
|
4733
|
+
/** ---------------- Helper/private methods ---------------- */
|
|
4734
|
+
// The below write* methods write a value to the buffer and increment the offset position in our central buffer
|
|
4735
|
+
GamepadBatchEncoder.prototype.writeU8 = function (value) {
|
|
4736
|
+
this.view.setUint8(this.offset, value);
|
|
4737
|
+
this.offset += 1;
|
|
4738
|
+
};
|
|
4739
|
+
GamepadBatchEncoder.prototype.writeU32 = function (value) {
|
|
4740
|
+
this.view.setUint32(this.offset, value, true);
|
|
4741
|
+
this.offset += 4;
|
|
4742
|
+
};
|
|
4743
|
+
GamepadBatchEncoder.prototype.writeI32 = function (value) {
|
|
4744
|
+
this.view.setInt32(this.offset, value, true);
|
|
4745
|
+
this.offset += 4;
|
|
4746
|
+
};
|
|
4747
|
+
GamepadBatchEncoder.prototype.writeF32 = function (value) {
|
|
4748
|
+
this.view.setFloat32(this.offset, value, true);
|
|
4749
|
+
this.offset += 4;
|
|
4750
|
+
};
|
|
4751
|
+
// Increase the byte buffer size if necessary
|
|
4752
|
+
GamepadBatchEncoder.prototype.ensure = function (additional) {
|
|
4753
|
+
var required = this.offset + additional;
|
|
4754
|
+
if (required <= this.buffer.byteLength) {
|
|
4755
|
+
return;
|
|
4756
|
+
}
|
|
4757
|
+
var capacity = this.buffer.byteLength * 2;
|
|
4758
|
+
while (capacity < required) {
|
|
4759
|
+
capacity *= 2;
|
|
4760
|
+
}
|
|
4761
|
+
var grown = new ArrayBuffer(capacity);
|
|
4762
|
+
var grownBytes = new Uint8Array(grown);
|
|
4763
|
+
grownBytes.set(this.bytes.subarray(0, this.offset));
|
|
4764
|
+
this.buffer = grown;
|
|
4765
|
+
this.view = new DataView(grown);
|
|
4766
|
+
this.bytes = grownBytes;
|
|
4767
|
+
};
|
|
4768
|
+
return GamepadBatchEncoder;
|
|
4769
|
+
}());
|
|
4770
|
+
|
|
4771
|
+
|
|
4772
|
+
|
|
4773
|
+
/***/ }),
|
|
4774
|
+
/* 20 */
|
|
4775
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4776
|
+
|
|
4334
4777
|
"use strict";
|
|
4335
4778
|
__webpack_require__.r(__webpack_exports__);
|
|
4336
4779
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
@@ -4382,7 +4825,7 @@ function sanitizeUrl(url) {
|
|
|
4382
4825
|
|
|
4383
4826
|
|
|
4384
4827
|
/***/ }),
|
|
4385
|
-
/*
|
|
4828
|
+
/* 21 */
|
|
4386
4829
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4387
4830
|
|
|
4388
4831
|
"use strict";
|
|
@@ -4683,7 +5126,7 @@ var createFinalization = function (target, finalizable) {
|
|
|
4683
5126
|
|
|
4684
5127
|
|
|
4685
5128
|
/***/ }),
|
|
4686
|
-
/*
|
|
5129
|
+
/* 22 */
|
|
4687
5130
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4688
5131
|
|
|
4689
5132
|
"use strict";
|
|
@@ -6680,7 +7123,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
6680
7123
|
var Rive = /** @class */ (function () {
|
|
6681
7124
|
function Rive(params) {
|
|
6682
7125
|
var _this = this;
|
|
6683
|
-
var _a, _b, _c, _d;
|
|
7126
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6684
7127
|
// Tracks if a Rive file is loaded
|
|
6685
7128
|
this.loaded = false;
|
|
6686
7129
|
// Tracks if a Rive file is destroyed
|
|
@@ -6698,6 +7141,8 @@ var Rive = /** @class */ (function () {
|
|
|
6698
7141
|
// Deferred rendering was requested for this instance. The file it renders
|
|
6699
7142
|
// has the final say, since a file's mode is fixed at import.
|
|
6700
7143
|
this.deferredRenderer = false;
|
|
7144
|
+
// Whether a deferred instance may hand its canvas to the replay worker.
|
|
7145
|
+
this.useReplayWorker = true;
|
|
6701
7146
|
// Decides the context attributes on every init(); cleared if the renderer can't inkbleed.
|
|
6702
7147
|
this._inkbleedCapable = false;
|
|
6703
7148
|
this._inkbleed = false;
|
|
@@ -6711,7 +7156,13 @@ var Rive = /** @class */ (function () {
|
|
|
6711
7156
|
this.eventCleanup = null;
|
|
6712
7157
|
// Manages keyboard and DOM-focus interactions for the canvas.
|
|
6713
7158
|
this._keyboardInteractions = null;
|
|
7159
|
+
// Polls game controllers and forwards input to the first playing state machine.
|
|
7160
|
+
this._gamepadInteractions = null;
|
|
6714
7161
|
this.shouldDisableRiveListeners = false;
|
|
7162
|
+
this.shouldDisableGamepad = false;
|
|
7163
|
+
this._gamepadOptions = {
|
|
7164
|
+
requireFocus: false,
|
|
7165
|
+
};
|
|
6715
7166
|
this.automaticallyHandleEvents = false;
|
|
6716
7167
|
this.dispatchPointerExit = true;
|
|
6717
7168
|
// Allow all pointers to be passed to the runtime
|
|
@@ -6800,6 +7251,31 @@ var Rive = /** @class */ (function () {
|
|
|
6800
7251
|
}
|
|
6801
7252
|
};
|
|
6802
7253
|
this.isEditingHostFocused = function () { var _a, _b; return (_b = (_a = _this._keyboardInteractions) === null || _a === void 0 ? void 0 : _a.isEditingHostFocused()) !== null && _b !== void 0 ? _b : false; };
|
|
7254
|
+
this.isFocusWithinCanvas = function () {
|
|
7255
|
+
var _a, _b, _c;
|
|
7256
|
+
if (typeof document === "undefined") {
|
|
7257
|
+
return false;
|
|
7258
|
+
}
|
|
7259
|
+
// Inside a shadow root, document.activeElement is the shadow host.
|
|
7260
|
+
var root = _this.canvas instanceof HTMLCanvasElement ? _this.canvas.getRootNode() : null;
|
|
7261
|
+
var active = (_a = (typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot
|
|
7262
|
+
? root.activeElement
|
|
7263
|
+
: null)) !== null && _a !== void 0 ? _a : document.activeElement;
|
|
7264
|
+
if (!active) {
|
|
7265
|
+
return false;
|
|
7266
|
+
}
|
|
7267
|
+
// Canvas, overlay and the text input proxy.
|
|
7268
|
+
if (_this._keyboardInteractions) {
|
|
7269
|
+
return _this._keyboardInteractions.isInFocusDomain(active);
|
|
7270
|
+
}
|
|
7271
|
+
if (active === _this.canvas) {
|
|
7272
|
+
return true;
|
|
7273
|
+
}
|
|
7274
|
+
var overlay = (_c = (_b = _this._accessibilityOverlay) === null || _b === void 0 ? void 0 : _b.getSemanticOverlayContainer()) !== null && _c !== void 0 ? _c : null;
|
|
7275
|
+
return !!overlay && overlay.contains(active);
|
|
7276
|
+
};
|
|
7277
|
+
// rAF time of the last frame; 0 makes the next frame start the clock.
|
|
7278
|
+
this.lastRenderTime = 0;
|
|
6803
7279
|
// Tracks the current animation frame request
|
|
6804
7280
|
this.frameRequestId = null;
|
|
6805
7281
|
/**
|
|
@@ -6823,6 +7299,8 @@ var Rive = /** @class */ (function () {
|
|
|
6823
7299
|
this.riveFile = params.riveFile;
|
|
6824
7300
|
this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
|
|
6825
7301
|
this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
|
|
7302
|
+
this.shouldDisableGamepad = !!params.shouldDisableGamepad;
|
|
7303
|
+
this._gamepadOptions = (_b = params.gamepadOptions) !== null && _b !== void 0 ? _b : this._gamepadOptions;
|
|
6826
7304
|
this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
|
|
6827
7305
|
if (params.automaticallyHandleEvents) {
|
|
6828
7306
|
warnOnce(DeprecationKeys.riveEvents, "The `automaticallyHandleEvents` parameter is deprecated. " +
|
|
@@ -6834,7 +7312,7 @@ var Rive = /** @class */ (function () {
|
|
|
6834
7312
|
? params.dispatchPointerExit
|
|
6835
7313
|
: this.dispatchPointerExit;
|
|
6836
7314
|
this.enableMultiTouch = !!params.enableMultiTouch;
|
|
6837
|
-
this.drawOptimization = (
|
|
7315
|
+
this.drawOptimization = (_c = params.drawingOptions) !== null && _c !== void 0 ? _c : this.drawOptimization;
|
|
6838
7316
|
this.enableRiveAssetCDN =
|
|
6839
7317
|
params.enableRiveAssetCDN === undefined
|
|
6840
7318
|
? true
|
|
@@ -6842,9 +7320,10 @@ var Rive = /** @class */ (function () {
|
|
|
6842
7320
|
this.enablePerfMarks = !!params.enablePerfMarks;
|
|
6843
7321
|
if (this.enablePerfMarks)
|
|
6844
7322
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.enablePerfMarks = true;
|
|
6845
|
-
this._focusOptions = (
|
|
6846
|
-
this._tabIndex = (
|
|
7323
|
+
this._focusOptions = (_d = params.focusOptions) !== null && _d !== void 0 ? _d : this._focusOptions;
|
|
7324
|
+
this._tabIndex = (_e = params.tabIndex) !== null && _e !== void 0 ? _e : null;
|
|
6847
7325
|
this.deferredRenderer = !!params.enableGPUCanvas;
|
|
7326
|
+
this.useReplayWorker = (_f = params.useReplayWorker) !== null && _f !== void 0 ? _f : true;
|
|
6848
7327
|
this._inkbleedCapable = !!params.enableInkbleed;
|
|
6849
7328
|
this._inkbleed = this._inkbleedCapable;
|
|
6850
7329
|
// New event management system
|
|
@@ -7033,9 +7512,11 @@ var Rive = /** @class */ (function () {
|
|
|
7033
7512
|
// Ensure loaded is marked as false if loading new file
|
|
7034
7513
|
this.loaded = false;
|
|
7035
7514
|
this.readyForPlaying = false;
|
|
7515
|
+
this.lastRenderTime = 0;
|
|
7036
7516
|
// Ensure the runtime is loaded
|
|
7037
7517
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.awaitInstance()
|
|
7038
7518
|
.then(function (runtime) {
|
|
7519
|
+
var _a, _b;
|
|
7039
7520
|
if (_this.destroyed) {
|
|
7040
7521
|
return;
|
|
7041
7522
|
}
|
|
@@ -7051,7 +7532,19 @@ var Rive = /** @class */ (function () {
|
|
|
7051
7532
|
try {
|
|
7052
7533
|
// Always immediate at creation; a deferred file attaches its session
|
|
7053
7534
|
// to this renderer once the file has loaded.
|
|
7054
|
-
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer, {
|
|
7535
|
+
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer, {
|
|
7536
|
+
inkbleed: _this._inkbleedCapable,
|
|
7537
|
+
// An immediate file would only re-import for the worker.
|
|
7538
|
+
replayWorker: _this.deferredRenderer &&
|
|
7539
|
+
_this.useReplayWorker &&
|
|
7540
|
+
((_b = (_a = _this.riveFile) === null || _a === void 0 ? void 0 : _a.deferredRequested) !== null && _b !== void 0 ? _b : true),
|
|
7541
|
+
// Draws notice a restored context, so one has to be scheduled.
|
|
7542
|
+
onContextRestored: function () {
|
|
7543
|
+
if (!_this._explicitlyStoppedRendering) {
|
|
7544
|
+
_this.scheduleRendering();
|
|
7545
|
+
}
|
|
7546
|
+
},
|
|
7547
|
+
});
|
|
7055
7548
|
if (!_this.renderer) {
|
|
7056
7549
|
throw new Error("Renderer is null, cannot render Rive on the canvas.");
|
|
7057
7550
|
}
|
|
@@ -7130,6 +7623,7 @@ var Rive = /** @class */ (function () {
|
|
|
7130
7623
|
isTextProxyFocused: this.isEditingHostFocused,
|
|
7131
7624
|
});
|
|
7132
7625
|
this.ensureKeyboardInteractions();
|
|
7626
|
+
this.ensureGamepadInteractions();
|
|
7133
7627
|
}
|
|
7134
7628
|
};
|
|
7135
7629
|
Object.defineProperty(Rive.prototype, "focusStateMachine", {
|
|
@@ -7208,6 +7702,23 @@ var Rive = /** @class */ (function () {
|
|
|
7208
7702
|
this._prevWantsTextInputSession = false;
|
|
7209
7703
|
(_a = this._accessibilityOverlay) === null || _a === void 0 ? void 0 : _a.releaseEditingHost(null, null);
|
|
7210
7704
|
};
|
|
7705
|
+
// Survives play/pause/stop so the state machine only receives missed changes on resume.
|
|
7706
|
+
Rive.prototype.ensureGamepadInteractions = function () {
|
|
7707
|
+
if (this._gamepadInteractions ||
|
|
7708
|
+
this.shouldDisableGamepad ||
|
|
7709
|
+
this.shouldDisableRiveListeners) {
|
|
7710
|
+
return;
|
|
7711
|
+
}
|
|
7712
|
+
this._gamepadInteractions = new _utils__WEBPACK_IMPORTED_MODULE_3__.GamepadInteractions({
|
|
7713
|
+
requireFocus: !!this._gamepadOptions.requireFocus,
|
|
7714
|
+
isFocusWithin: this.isFocusWithinCanvas,
|
|
7715
|
+
});
|
|
7716
|
+
};
|
|
7717
|
+
Rive.prototype.cleanupGamepadInteractions = function () {
|
|
7718
|
+
var _a;
|
|
7719
|
+
(_a = this._gamepadInteractions) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
7720
|
+
this._gamepadInteractions = null;
|
|
7721
|
+
};
|
|
7211
7722
|
/**
|
|
7212
7723
|
* Remove Rive Listeners setup on the canvas
|
|
7213
7724
|
*/
|
|
@@ -7252,11 +7763,11 @@ var Rive = /** @class */ (function () {
|
|
|
7252
7763
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
7253
7764
|
return __awaiter(this, void 0, void 0, function () {
|
|
7254
7765
|
var riveFile, error_4, msg;
|
|
7255
|
-
var _a, _b;
|
|
7256
|
-
return __generator(this, function (
|
|
7257
|
-
switch (
|
|
7766
|
+
var _a, _b, _c, _d;
|
|
7767
|
+
return __generator(this, function (_e) {
|
|
7768
|
+
switch (_e.label) {
|
|
7258
7769
|
case 0:
|
|
7259
|
-
|
|
7770
|
+
_e.trys.push([0, 5, , 6]);
|
|
7260
7771
|
// A caller-supplied riveFile is theirs to release; one we import here is
|
|
7261
7772
|
// ours, which matters if a deferred fallback replaces it below.
|
|
7262
7773
|
this.ownsRiveFile = this.riveFile == null;
|
|
@@ -7273,29 +7784,31 @@ var Rive = /** @class */ (function () {
|
|
|
7273
7784
|
this.riveFile = riveFile;
|
|
7274
7785
|
return [4 /*yield*/, riveFile.init()];
|
|
7275
7786
|
case 1:
|
|
7276
|
-
|
|
7787
|
+
_e.sent();
|
|
7277
7788
|
if (this.destroyed) {
|
|
7278
7789
|
// In the very unlikely scenario where the rive file created by this Rive is shared by
|
|
7279
7790
|
// another rive file, we only want to destroy it if this file is the only owner.
|
|
7280
7791
|
riveFile.destroyIfUnused();
|
|
7281
7792
|
return [2 /*return*/, false];
|
|
7282
7793
|
}
|
|
7283
|
-
|
|
7794
|
+
_e.label = 2;
|
|
7284
7795
|
case 2:
|
|
7285
|
-
if (!(this.riveFile.deferredSession !== null ||
|
|
7796
|
+
if (!(this.riveFile.deferredSession !== null ||
|
|
7797
|
+
this.deferredRenderer ||
|
|
7798
|
+
((_b = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.replaysOnWorker) === null || _b === void 0 ? void 0 : _b.call(_a)) === true)) return [3 /*break*/, 4];
|
|
7286
7799
|
return [4 /*yield*/, this.resolveDeferredRendering()];
|
|
7287
7800
|
case 3:
|
|
7288
|
-
|
|
7801
|
+
_e.sent();
|
|
7289
7802
|
if (this.destroyed) {
|
|
7290
7803
|
// cleanup() ran during a re-import. Taking a reference now would
|
|
7291
7804
|
// resurrect a file this instance is never going to draw. Only ours
|
|
7292
7805
|
// to release — a caller-supplied file stays theirs.
|
|
7293
7806
|
if (this.ownsRiveFile) {
|
|
7294
|
-
(
|
|
7807
|
+
(_c = this.riveFile) === null || _c === void 0 ? void 0 : _c.destroyIfUnused();
|
|
7295
7808
|
}
|
|
7296
7809
|
return [2 /*return*/, false];
|
|
7297
7810
|
}
|
|
7298
|
-
|
|
7811
|
+
_e.label = 4;
|
|
7299
7812
|
case 4:
|
|
7300
7813
|
this.file = this.riveFile.getInstance();
|
|
7301
7814
|
this.reportDisplayScale();
|
|
@@ -7316,7 +7829,7 @@ var Rive = /** @class */ (function () {
|
|
|
7316
7829
|
this.loaded = true;
|
|
7317
7830
|
this.eventManager.fire({
|
|
7318
7831
|
type: EventType.Load,
|
|
7319
|
-
data: (
|
|
7832
|
+
data: (_d = this.src) !== null && _d !== void 0 ? _d : "buffer",
|
|
7320
7833
|
});
|
|
7321
7834
|
}
|
|
7322
7835
|
catch (e) {
|
|
@@ -7335,7 +7848,7 @@ var Rive = /** @class */ (function () {
|
|
|
7335
7848
|
this.drawFrame();
|
|
7336
7849
|
return [2 /*return*/, true];
|
|
7337
7850
|
case 5:
|
|
7338
|
-
error_4 =
|
|
7851
|
+
error_4 = _e.sent();
|
|
7339
7852
|
msg = resolveErrorMessage(error_4);
|
|
7340
7853
|
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
7341
7854
|
return [2 /*return*/, Promise.reject(msg)];
|
|
@@ -7353,35 +7866,46 @@ var Rive = /** @class */ (function () {
|
|
|
7353
7866
|
*/
|
|
7354
7867
|
Rive.prototype.resolveDeferredRendering = function () {
|
|
7355
7868
|
return __awaiter(this, void 0, void 0, function () {
|
|
7356
|
-
var file, ownsFile, renderer, session, attachSession, immediate, copy,
|
|
7357
|
-
var
|
|
7358
|
-
return __generator(this, function (
|
|
7359
|
-
switch (
|
|
7869
|
+
var file, ownsFile, renderer, session, deferredOnly, attached_1, attachSession, immediate, _a, copy, attached, fallback;
|
|
7870
|
+
var _b, _c;
|
|
7871
|
+
return __generator(this, function (_d) {
|
|
7872
|
+
switch (_d.label) {
|
|
7360
7873
|
case 0:
|
|
7361
7874
|
file = this.riveFile;
|
|
7362
7875
|
ownsFile = this.ownsRiveFile;
|
|
7363
7876
|
renderer = this.renderer;
|
|
7364
7877
|
session = file.deferredSession;
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7878
|
+
deferredOnly = ((_b = renderer === null || renderer === void 0 ? void 0 : renderer.replaysOnWorker) === null || _b === void 0 ? void 0 : _b.call(renderer)) === true;
|
|
7879
|
+
if (!(session === null)) return [3 /*break*/, 3];
|
|
7880
|
+
if (!deferredOnly) return [3 /*break*/, 2];
|
|
7881
|
+
console.warn("Rive: this canvas draws on the replay worker, which only replays GPU Canvas files. Re-importing the file with `enableGPUCanvas: true` for this instance.");
|
|
7882
|
+
return [4 /*yield*/, this.attachDeferredCopy(file, renderer)];
|
|
7883
|
+
case 1:
|
|
7884
|
+
attached_1 = (_d.sent()).attached;
|
|
7885
|
+
if (attached_1 && ownsFile) {
|
|
7886
|
+
file.destroyIfUnused();
|
|
7373
7887
|
}
|
|
7888
|
+
return [2 /*return*/];
|
|
7889
|
+
case 2:
|
|
7890
|
+
// No second warning when the file asked for deferred and the build
|
|
7891
|
+
// could not honor it; the unsupported-build warning already fired, and
|
|
7892
|
+
// telling the user to set a flag they set would mislead.
|
|
7893
|
+
if (this.deferredRenderer && !file.deferredRequested) {
|
|
7894
|
+
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.");
|
|
7895
|
+
}
|
|
7896
|
+
return [2 /*return*/];
|
|
7897
|
+
case 3:
|
|
7374
7898
|
if (!this.deferredRenderer) {
|
|
7375
7899
|
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.");
|
|
7376
7900
|
}
|
|
7377
7901
|
attachSession = renderer === null || renderer === void 0 ? void 0 : renderer.attachSession;
|
|
7378
|
-
if (!(typeof attachSession !== "function")) return [3 /*break*/,
|
|
7902
|
+
if (!(typeof attachSession !== "function")) return [3 /*break*/, 5];
|
|
7379
7903
|
// Offscreen renderers share one context across canvases, which a session
|
|
7380
7904
|
// cannot record for. An immediate copy of the file still renders.
|
|
7381
7905
|
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.");
|
|
7382
7906
|
return [4 /*yield*/, file.reimport(false)];
|
|
7383
|
-
case
|
|
7384
|
-
immediate =
|
|
7907
|
+
case 4:
|
|
7908
|
+
immediate = _d.sent();
|
|
7385
7909
|
if (this.destroyed) {
|
|
7386
7910
|
// cleanup() ran while we were importing; nothing will use this copy.
|
|
7387
7911
|
immediate.destroyIfUnused();
|
|
@@ -7394,7 +7918,7 @@ var Rive = /** @class */ (function () {
|
|
|
7394
7918
|
file.destroyIfUnused();
|
|
7395
7919
|
}
|
|
7396
7920
|
return [2 /*return*/];
|
|
7397
|
-
case
|
|
7921
|
+
case 5:
|
|
7398
7922
|
// Never re-offered once claimed, even if that renderer is gone: the
|
|
7399
7923
|
// resources the session's stream refers to died with it.
|
|
7400
7924
|
if (!file.sessionClaimed && attachSession.call(renderer, session)) {
|
|
@@ -7404,20 +7928,14 @@ var Rive = /** @class */ (function () {
|
|
|
7404
7928
|
// Bound to another instance. Re-import from the retained buffer into a
|
|
7405
7929
|
// session of our own.
|
|
7406
7930
|
file.warnBoundElsewhereOnce();
|
|
7407
|
-
return [4 /*yield*/,
|
|
7408
|
-
case
|
|
7409
|
-
|
|
7410
|
-
if (this.destroyed) {
|
|
7411
|
-
// The renderer was deleted while we imported; attaching to it would hand
|
|
7412
|
-
// embind a deleted object.
|
|
7413
|
-
copy.destroyIfUnused();
|
|
7931
|
+
return [4 /*yield*/, this.attachDeferredCopy(file, renderer)];
|
|
7932
|
+
case 6:
|
|
7933
|
+
_a = _d.sent(), copy = _a.copy, attached = _a.attached;
|
|
7934
|
+
if (attached || this.destroyed) {
|
|
7414
7935
|
return [2 /*return*/];
|
|
7415
7936
|
}
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
copySession = copy.deferredSession;
|
|
7419
|
-
if (copySession !== null && attachSession.call(renderer, copySession)) {
|
|
7420
|
-
copy.claimSession();
|
|
7937
|
+
if (deferredOnly) {
|
|
7938
|
+
console.warn("Rive: could not attach the re-imported file's deferred session to this canvas, which draws on the replay worker and has no immediate fallback.");
|
|
7421
7939
|
return [2 /*return*/];
|
|
7422
7940
|
}
|
|
7423
7941
|
// The copy's session could not take this canvas either (this renderer
|
|
@@ -7426,10 +7944,10 @@ var Rive = /** @class */ (function () {
|
|
|
7426
7944
|
console.warn("Rive: could not attach the re-imported file's deferred session to this canvas; falling back to immediate rendering for this instance.");
|
|
7427
7945
|
// If a leftover session is why the attach failed, it would keep routing
|
|
7428
7946
|
// the immediate file's draws into its recorder, which drops them.
|
|
7429
|
-
(
|
|
7947
|
+
(_c = renderer.detachSession) === null || _c === void 0 ? void 0 : _c.call(renderer);
|
|
7430
7948
|
return [4 /*yield*/, file.reimport(false)];
|
|
7431
|
-
case
|
|
7432
|
-
fallback =
|
|
7949
|
+
case 7:
|
|
7950
|
+
fallback = _d.sent();
|
|
7433
7951
|
// The deferred copy was only ever ours, so it always goes.
|
|
7434
7952
|
copy.destroyIfUnused();
|
|
7435
7953
|
if (this.destroyed) {
|
|
@@ -7446,6 +7964,63 @@ var Rive = /** @class */ (function () {
|
|
|
7446
7964
|
});
|
|
7447
7965
|
});
|
|
7448
7966
|
};
|
|
7967
|
+
// Reloads what this instance was playing. State the reload does not carry,
|
|
7968
|
+
// such as a view model instance bound by hand, starts over.
|
|
7969
|
+
Rive.prototype.reloadForRestoredContext = function () {
|
|
7970
|
+
// A copy re-imported for this instance kept no source to reload from.
|
|
7971
|
+
var riveFile = this.ownsRiveFile ? undefined : this.riveFile;
|
|
7972
|
+
if (!this.src && !this.buffer && !riveFile) {
|
|
7973
|
+
this.stopRendering();
|
|
7974
|
+
if (!Rive.replayContextLostWarned) {
|
|
7975
|
+
Rive.replayContextLostWarned = true;
|
|
7976
|
+
console.warn("Rive: the replay worker's WebGL context was restored, but this instance has no `src` or `buffer` to reload from, so its canvas stays blank.");
|
|
7977
|
+
}
|
|
7978
|
+
return;
|
|
7979
|
+
}
|
|
7980
|
+
this.load({
|
|
7981
|
+
src: this.src,
|
|
7982
|
+
buffer: this.buffer,
|
|
7983
|
+
riveFile: riveFile,
|
|
7984
|
+
artboard: this.activeArtboard,
|
|
7985
|
+
animations: this.playingAnimationNames.concat(this.pausedAnimationNames),
|
|
7986
|
+
stateMachines: this.playingStateMachineNames.concat(this.pausedStateMachineNames),
|
|
7987
|
+
autoplay: this.isPlaying,
|
|
7988
|
+
autoBind: this._viewModelInstance !== null,
|
|
7989
|
+
enableGPUCanvas: this.deferredRenderer,
|
|
7990
|
+
});
|
|
7991
|
+
};
|
|
7992
|
+
/**
|
|
7993
|
+
* Re-imports `file` deferred and attaches the copy's session to `renderer`.
|
|
7994
|
+
* The copy becomes this instance's file either way, unless the instance was
|
|
7995
|
+
* destroyed while it imported.
|
|
7996
|
+
*/
|
|
7997
|
+
Rive.prototype.attachDeferredCopy = function (file, renderer) {
|
|
7998
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7999
|
+
var copy, copySession, attached;
|
|
8000
|
+
var _a;
|
|
8001
|
+
return __generator(this, function (_b) {
|
|
8002
|
+
switch (_b.label) {
|
|
8003
|
+
case 0: return [4 /*yield*/, file.reimport(true)];
|
|
8004
|
+
case 1:
|
|
8005
|
+
copy = _b.sent();
|
|
8006
|
+
if (this.destroyed) {
|
|
8007
|
+
// The renderer was deleted while we imported; attaching to it would hand
|
|
8008
|
+
// embind a deleted object.
|
|
8009
|
+
copy.destroyIfUnused();
|
|
8010
|
+
return [2 /*return*/, { copy: copy, attached: false }];
|
|
8011
|
+
}
|
|
8012
|
+
this.riveFile = copy;
|
|
8013
|
+
this.ownsRiveFile = true;
|
|
8014
|
+
copySession = copy.deferredSession;
|
|
8015
|
+
attached = copySession !== null && ((_a = renderer.attachSession) === null || _a === void 0 ? void 0 : _a.call(renderer, copySession)) === true;
|
|
8016
|
+
if (attached) {
|
|
8017
|
+
copy.claimSession();
|
|
8018
|
+
}
|
|
8019
|
+
return [2 /*return*/, { copy: copy, attached: attached }];
|
|
8020
|
+
}
|
|
8021
|
+
});
|
|
8022
|
+
});
|
|
8023
|
+
};
|
|
7449
8024
|
// Initialize for playback
|
|
7450
8025
|
Rive.prototype.initArtboard = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
7451
8026
|
if (!this.file) {
|
|
@@ -7514,7 +8089,7 @@ var Rive = /** @class */ (function () {
|
|
|
7514
8089
|
var _a, _b;
|
|
7515
8090
|
if ((_a = document === null || document === void 0 ? void 0 : document.timeline) === null || _a === void 0 ? void 0 : _a.currentTime) {
|
|
7516
8091
|
if (this.loaded && this.artboard && !this.frameRequestId) {
|
|
7517
|
-
this.
|
|
8092
|
+
this.draw(null);
|
|
7518
8093
|
(_b = this.runtime) === null || _b === void 0 ? void 0 : _b.resolveAnimationFrame();
|
|
7519
8094
|
}
|
|
7520
8095
|
}
|
|
@@ -7614,9 +8189,10 @@ var Rive = /** @class */ (function () {
|
|
|
7614
8189
|
* due to state changes, view model property changes, etc.
|
|
7615
8190
|
*
|
|
7616
8191
|
* @param elapsedTime time to advance the state machine by
|
|
8192
|
+
* @param frameTime the rAF timestamp; omitted by pointer drains, which skip gamepad polling.
|
|
7617
8193
|
*/
|
|
7618
|
-
Rive.prototype.advanceAndReportChanges = function (elapsedTime) {
|
|
7619
|
-
var _a, _b;
|
|
8194
|
+
Rive.prototype.advanceAndReportChanges = function (elapsedTime, frameTime) {
|
|
8195
|
+
var _a, _b, _c, _d;
|
|
7620
8196
|
// - Advance non-paused animations by the elapsed number of seconds
|
|
7621
8197
|
// - Advance any animations that require scrubbing
|
|
7622
8198
|
// - Advance to the first frame even when autoplay is false
|
|
@@ -7636,11 +8212,16 @@ var Rive = /** @class */ (function () {
|
|
|
7636
8212
|
// - Advance non-paused state machines by the elapsed number of seconds
|
|
7637
8213
|
// - Advance to the first frame even when autoplay is false
|
|
7638
8214
|
var activeStateMachines = this.animator.stateMachines.filter(function (a) { return a.playing; });
|
|
8215
|
+
// Gamepad input lands before this frame's advance.
|
|
8216
|
+
// Also, frameTime is not passed for other places this function is called (i.e. after pointer events)
|
|
8217
|
+
if (frameTime !== undefined) {
|
|
8218
|
+
(_a = this._gamepadInteractions) === null || _a === void 0 ? void 0 : _a.handleGamepadInputs(frameTime, (_b = activeStateMachines[0]) === null || _b === void 0 ? void 0 : _b.instance);
|
|
8219
|
+
}
|
|
7639
8220
|
// Instrument the first 3 frames so the Performance timeline shows precise
|
|
7640
8221
|
// per-call latency for advance, draw, and flush without polluting the trace.
|
|
7641
8222
|
var _perfFrame = this.enablePerfMarks && this.frameCount < 3 ? this.frameCount : -1;
|
|
7642
|
-
for (var
|
|
7643
|
-
var stateMachine = activeStateMachines_1[
|
|
8223
|
+
for (var _e = 0, activeStateMachines_1 = activeStateMachines; _e < activeStateMachines_1.length; _e++) {
|
|
8224
|
+
var stateMachine = activeStateMachines_1[_e];
|
|
7644
8225
|
// Check for events before the current frame's state machine advance
|
|
7645
8226
|
var numEventsReported = stateMachine.reportedEventCount();
|
|
7646
8227
|
if (numEventsReported) {
|
|
@@ -7655,7 +8236,7 @@ var Rive = /** @class */ (function () {
|
|
|
7655
8236
|
// Handle the event side effect if explicitly enabled
|
|
7656
8237
|
if (this.automaticallyHandleEvents) {
|
|
7657
8238
|
var newAnchorTag = document.createElement("a");
|
|
7658
|
-
var
|
|
8239
|
+
var _f = event_1, url = _f.url, target = _f.target;
|
|
7659
8240
|
var sanitizedUrl = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.sanitizeUrl)(url);
|
|
7660
8241
|
url && newAnchorTag.setAttribute("href", sanitizedUrl);
|
|
7661
8242
|
target && newAnchorTag.setAttribute("target", target);
|
|
@@ -7715,7 +8296,7 @@ var Rive = /** @class */ (function () {
|
|
|
7715
8296
|
},
|
|
7716
8297
|
});
|
|
7717
8298
|
}
|
|
7718
|
-
var overlayChange = (
|
|
8299
|
+
var overlayChange = (_c = this._accessibilityOverlay) === null || _c === void 0 ? void 0 : _c.needsUpdate(this._semanticTree);
|
|
7719
8300
|
if (overlayChange || this._overlayTransformDirty) {
|
|
7720
8301
|
// Only recompute the artboard→canvas transform when something that
|
|
7721
8302
|
// affects it changed (canvas geometry or a layout/dpr input). When only
|
|
@@ -7750,8 +8331,11 @@ var Rive = /** @class */ (function () {
|
|
|
7750
8331
|
this.animator.handleAdvancing(elapsedTime);
|
|
7751
8332
|
// Poll focus state to see whether or not to blur or pull up a virtual keyboard for any change to a text input node.
|
|
7752
8333
|
this.pollFocusState();
|
|
8334
|
+
// Reattaches after reset(), which doesn't rerun setupRiveListeners. Runs after the
|
|
8335
|
+
// advance so a new state machine has its initial focus before input arrives.
|
|
8336
|
+
this.ensureGamepadInteractions();
|
|
7753
8337
|
// Handle callbacks for main view model property changes
|
|
7754
|
-
(
|
|
8338
|
+
(_d = this._viewModelInstance) === null || _d === void 0 ? void 0 : _d.handleCallbacks();
|
|
7755
8339
|
// Handle callbacks for global view model property changes
|
|
7756
8340
|
this._globalViewModelInstances.forEach(function (instance) {
|
|
7757
8341
|
if (instance) {
|
|
@@ -7761,9 +8345,10 @@ var Rive = /** @class */ (function () {
|
|
|
7761
8345
|
};
|
|
7762
8346
|
/**
|
|
7763
8347
|
* Draw rendering loop; renders animation frames at the correct time interval.
|
|
7764
|
-
* @param time the
|
|
8348
|
+
* @param time the rAF timestamp, or null to draw now without advancing
|
|
7765
8349
|
*/
|
|
7766
8350
|
Rive.prototype.draw = function (time, onSecond) {
|
|
8351
|
+
var _a, _b, _c, _d;
|
|
7767
8352
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
7768
8353
|
this.frameRequestId = null;
|
|
7769
8354
|
// load() tears the artboard down and re-inits asynchronously; a frame
|
|
@@ -7771,24 +8356,48 @@ var Rive = /** @class */ (function () {
|
|
|
7771
8356
|
if (!this.artboard) {
|
|
7772
8357
|
return;
|
|
7773
8358
|
}
|
|
8359
|
+
// The replay worker's context came back empty, so everything it held has
|
|
8360
|
+
// to be recorded again through a fresh renderer and session.
|
|
8361
|
+
if (((_b = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.contextRestored) === null || _b === void 0 ? void 0 : _b.call(_a)) === true) {
|
|
8362
|
+
this.reloadForRestoredContext();
|
|
8363
|
+
return;
|
|
8364
|
+
}
|
|
8365
|
+
// The replay worker has yet to take the canvas, or is still on earlier
|
|
8366
|
+
// frames. Waiting keeps its queue bounded, and the frame that follows
|
|
8367
|
+
// advances by the whole wait, so playback keeps time.
|
|
8368
|
+
if (((_d = (_c = this.renderer) === null || _c === void 0 ? void 0 : _c.acceptsFrame) === null || _d === void 0 ? void 0 : _d.call(_c)) === false) {
|
|
8369
|
+
this.scheduleRendering();
|
|
8370
|
+
return;
|
|
8371
|
+
}
|
|
7774
8372
|
var before = performance.now();
|
|
7775
8373
|
// Instrument the first 3 frames so the Performance timeline shows precise
|
|
7776
8374
|
// per-call latency for advance, draw, and flush without polluting the trace.
|
|
7777
8375
|
var _perfFrame = this.enablePerfMarks && this.frameCount < 3 ? this.frameCount : -1;
|
|
7778
|
-
|
|
7779
|
-
if (
|
|
8376
|
+
var batch = Rive.batchStart;
|
|
8377
|
+
if (time !== null && batch.time !== time) {
|
|
8378
|
+
batch.time = time;
|
|
8379
|
+
batch.now = before;
|
|
8380
|
+
}
|
|
8381
|
+
// A frame queued during a long task is stamped inside it: start at now.
|
|
8382
|
+
if (!this.lastRenderTime && time !== null) {
|
|
8383
|
+
this.lastRenderTime = Math.max(time, batch.now);
|
|
8384
|
+
}
|
|
8385
|
+
else if (time !== null && time < this.lastRenderTime) {
|
|
8386
|
+
// The now-seed can lead the next stamp by a vsync; restart, don't freeze.
|
|
7780
8387
|
this.lastRenderTime = time;
|
|
7781
8388
|
}
|
|
8389
|
+
// Out-of-frame draws keep the clock: timeline time is frozen per task.
|
|
8390
|
+
var frameTime = time === null ? this.lastRenderTime : Math.max(time, this.lastRenderTime);
|
|
7782
8391
|
// Handle the onSecond callback
|
|
7783
|
-
this.renderSecondTimer +=
|
|
8392
|
+
this.renderSecondTimer += frameTime - this.lastRenderTime;
|
|
7784
8393
|
if (this.renderSecondTimer > 5000) {
|
|
7785
8394
|
this.renderSecondTimer = 0;
|
|
7786
8395
|
onSecond === null || onSecond === void 0 ? void 0 : onSecond();
|
|
7787
8396
|
}
|
|
7788
8397
|
// Calculate the elapsed time between frames in seconds
|
|
7789
|
-
var elapsedTime = (
|
|
7790
|
-
this.lastRenderTime =
|
|
7791
|
-
this.advanceAndReportChanges(elapsedTime);
|
|
8398
|
+
var elapsedTime = (frameTime - this.lastRenderTime) / 1000;
|
|
8399
|
+
this.lastRenderTime = frameTime;
|
|
8400
|
+
this.advanceAndReportChanges(elapsedTime, time);
|
|
7792
8401
|
var renderer = this.renderer;
|
|
7793
8402
|
// Do not draw on 0 canvas size
|
|
7794
8403
|
if (!this._hasZeroSize) {
|
|
@@ -8002,6 +8611,7 @@ var Rive = /** @class */ (function () {
|
|
|
8002
8611
|
this.eventCleanup();
|
|
8003
8612
|
}
|
|
8004
8613
|
this.cleanupKeyboardInteractions();
|
|
8614
|
+
this.cleanupGamepadInteractions();
|
|
8005
8615
|
// Tear down semantics before deleting state machines — the overlay's action
|
|
8006
8616
|
// closures point at instances that stop() is about to free.
|
|
8007
8617
|
this.cleanupSemantics();
|
|
@@ -9190,11 +9800,14 @@ var Rive = /** @class */ (function () {
|
|
|
9190
9800
|
playingStateMachines.forEach(function (sm) { return sm.clearFocus(); });
|
|
9191
9801
|
};
|
|
9192
9802
|
Rive.inkbleedUnsupportedWarned = false;
|
|
9803
|
+
Rive.replayContextLostWarned = false;
|
|
9193
9804
|
Rive.inkbleedNotCapableWarned = false;
|
|
9194
9805
|
// Error message for missing source or buffer
|
|
9195
9806
|
Rive.missingErrorMessage = "Rive source file or data buffer required";
|
|
9196
9807
|
// Error message for removed rive file
|
|
9197
9808
|
Rive.cleanupErrorMessage = "Attempt to use file after calling cleanup.";
|
|
9809
|
+
// performance.now() at the current rAF batch's start; first frames seed from it.
|
|
9810
|
+
Rive.batchStart = { time: -1, now: 0 };
|
|
9198
9811
|
return Rive;
|
|
9199
9812
|
}());
|
|
9200
9813
|
|