@rive-app/webgl 1.0.4 → 1.0.8

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/rive.js ADDED
@@ -0,0 +1,1776 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["rive"] = factory();
8
+ else
9
+ root["rive"] = factory();
10
+ })((() => {
11
+ if (typeof self !== 'undefined') {
12
+ return self;
13
+ } else if (typeof window !== 'undefined') {
14
+ return window;
15
+ } else if (typeof global !== 'undefined') {
16
+ return global;
17
+ } else {
18
+ return Function('return this')();
19
+ }
20
+ })(), function() {
21
+ return /******/ (() => { // webpackBootstrap
22
+ /******/ "use strict";
23
+ /******/ var __webpack_modules__ = ([
24
+ /* 0 */,
25
+ /* 1 */
26
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
27
+
28
+ __webpack_require__.r(__webpack_exports__);
29
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
30
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
31
+ /* harmony export */ });
32
+
33
+ var Rive = (function() {
34
+ var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
35
+ if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
36
+ return (
37
+ function(Rive) {
38
+ Rive = Rive || {};
39
+
40
+
41
+ null;var g;g||(g=typeof Rive !== 'undefined' ? Rive : {});var aa,ba;g.ready=new Promise(function(a,b){aa=a;ba=b});
42
+ g.onRuntimeInitialized=function(){const a=g.makeRenderer;g.makeRenderer=function(c){var d=ca(c);h=da[d];g.de=r=h&&h.Jd;const e=a(c.width,c.height);e.be=d;e.ae=c;e.Rd=c.width;e.Qd=c.height;return e};const b=g.WebGLRenderer.prototype.clear;g.WebGLRenderer.prototype.clear=function(){h=da[this.be];g.de=r=h&&h.Jd;const c=this.ae;if(this.Rd!=c.width||this.Qd!=c.height)this.resize(c.width,c.height),this.Rd=c.width,this.Qd=c.height;b.call(this)}};var ea={},v;for(v in g)g.hasOwnProperty(v)&&(ea[v]=g[v]);
43
+ var fa="./this.program",ha="object"===typeof window,ia="function"===typeof importScripts,ja="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node,y="",ka,la,ma,na,oa;
44
+ if(ja)y=ia?require("path").dirname(y)+"/":__dirname+"/",ka=function(a,b){na||(na=require("fs"));oa||(oa=require("path"));a=oa.normalize(a);return na.readFileSync(a,b?null:"utf8")},ma=function(a){a=ka(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||pa("Assertion failed: undefined");return a},la=function(a,b,c){na||(na=require("fs"));oa||(oa=require("path"));a=oa.normalize(a);na.readFile(a,function(d,e){d?c(d):b(e.buffer)})},1<process.argv.length&&(fa=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),
45
+ process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",function(a){throw a;}),g.inspect=function(){return"[Emscripten Module object]"};else if(ha||ia)ia?y=self.location.href:"undefined"!==typeof document&&document.currentScript&&(y=document.currentScript.src),_scriptDir&&(y=_scriptDir),0!==y.indexOf("blob:")?y=y.substr(0,y.replace(/[?#].*/,"").lastIndexOf("/")+1):y="",ka=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},ia&&
46
+ (ma=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),la=function(a,b,c){var d=new XMLHttpRequest;d.open("GET",a,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?b(d.response):c()};d.onerror=c;d.send(null)};var qa=g.print||console.log.bind(console),z=g.printErr||console.warn.bind(console);for(v in ea)ea.hasOwnProperty(v)&&(g[v]=ea[v]);ea=null;g.thisProgram&&(fa=g.thisProgram);
47
+ var ra=0,sa;g.wasmBinary&&(sa=g.wasmBinary);var noExitRuntime=g.noExitRuntime||!0;"object"!==typeof WebAssembly&&pa("no native wasm support detected");var ta,ua=!1,va="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
48
+ function wa(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&va)return va.decode(a.subarray(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var f=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|f);else{var l=a[b++]&63;e=224==(e&240)?(e&15)<<12|f<<6|l:(e&7)<<18|f<<12|l<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}function xa(a,b){return a?wa(A,a,b):""}
49
+ function ya(a,b,c,d){if(!(0<d))return 0;var e=c;d=c+d-1;for(var f=0;f<a.length;++f){var l=a.charCodeAt(f);if(55296<=l&&57343>=l){var k=a.charCodeAt(++f);l=65536+((l&1023)<<10)|k&1023}if(127>=l){if(c>=d)break;b[c++]=l}else{if(2047>=l){if(c+1>=d)break;b[c++]=192|l>>6}else{if(65535>=l){if(c+2>=d)break;b[c++]=224|l>>12}else{if(c+3>=d)break;b[c++]=240|l>>18;b[c++]=128|l>>12&63}b[c++]=128|l>>6&63}b[c++]=128|l&63}}b[c]=0;return c-e}
50
+ function za(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var Aa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function Ba(a,b){var c=a>>1;for(var d=c+b/2;!(c>=d)&&Ca[c];)++c;c<<=1;if(32<c-a&&Aa)return Aa.decode(A.subarray(a,c));c="";for(d=0;!(d>=b/2);++d){var e=B[a+2*d>>1];if(0==e)break;c+=String.fromCharCode(e)}return c}
51
+ function Da(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e)B[b>>1]=a.charCodeAt(e),b+=2;B[b>>1]=0;return b-d}function Ea(a){return 2*a.length}function Fa(a,b){for(var c=0,d="";!(c>=b/4);){var e=C[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d}
52
+ function Ga(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var f=a.charCodeAt(e);if(55296<=f&&57343>=f){var l=a.charCodeAt(++e);f=65536+((f&1023)<<10)|l&1023}C[b>>2]=f;b+=4;if(b+4>c)break}C[b>>2]=0;return b-d}function Ha(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var Ja,E,A,B,Ca,C,F,G,Ka;
53
+ function La(){var a=ta.buffer;Ja=a;g.HEAP8=E=new Int8Array(a);g.HEAP16=B=new Int16Array(a);g.HEAP32=C=new Int32Array(a);g.HEAPU8=A=new Uint8Array(a);g.HEAPU16=Ca=new Uint16Array(a);g.HEAPU32=F=new Uint32Array(a);g.HEAPF32=G=new Float32Array(a);g.HEAPF64=Ka=new Float64Array(a)}var Ma,Na=[],Oa=[],Pa=[];function Qa(){var a=g.preRun.shift();Na.unshift(a)}var Ra=0,Sa=null,Ta=null;g.preloadedImages={};g.preloadedAudios={};
54
+ function pa(a){if(g.onAbort)g.onAbort(a);a="Aborted("+a+")";z(a);ua=!0;a=new WebAssembly.RuntimeError(a+". Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ua(){return H.startsWith("data:application/octet-stream;base64,")}var H;H="webgl_advanced.wasm";if(!Ua()){var Va=H;H=g.locateFile?g.locateFile(Va,y):y+Va}function Wa(){var a=H;try{if(a==H&&sa)return new Uint8Array(sa);if(ma)return ma(a);throw"both async and sync fetching of the wasm failed";}catch(b){pa(b)}}
55
+ function Xa(){if(!sa&&(ha||ia)){if("function"===typeof fetch&&!H.startsWith("file://"))return fetch(H,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+H+"'";return a.arrayBuffer()}).catch(function(){return Wa()});if(la)return new Promise(function(a,b){la(H,function(c){a(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return Wa()})}
56
+ function Ya(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(g);else{var c=b.Ce;"number"===typeof c?void 0===b.Kd?I(c)():I(c)(b.Kd):c(void 0===b.Kd?null:b.Kd)}}}function I(a){return Ma.get(a)}var Za={};function $a(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function ab(a){return this.fromWireType(F[a>>2])}var bb={},cb={},db={};function eb(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
57
+ function fb(a,b){a=eb(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function gb(a){var b=Error,c=fb(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
58
+ var hb=void 0;function ib(a){throw new hb(a);}function J(a,b,c){function d(k){k=c(k);k.length!==a.length&&ib("Mismatched type converter count");for(var n=0;n<a.length;++n)K(a[n],k[n])}a.forEach(function(k){db[k]=b});var e=Array(b.length),f=[],l=0;b.forEach(function(k,n){cb.hasOwnProperty(k)?e[n]=cb[k]:(f.push(k),bb.hasOwnProperty(k)||(bb[k]=[]),bb[k].push(function(){e[n]=cb[k];++l;l===f.length&&d(e)}))});0===f.length&&d(e)}
59
+ function jb(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var kb=void 0;function L(a){for(var b="";A[a];)b+=kb[A[a++]];return b}var lb=void 0;function M(a){throw new lb(a);}
60
+ function K(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||M('type "'+d+'" must have a positive integer typeid pointer');if(cb.hasOwnProperty(a)){if(c.ne)return;M("Cannot register type '"+d+"' twice")}cb[a]=b;delete db[a];bb.hasOwnProperty(a)&&(b=bb[a],delete bb[a],b.forEach(function(e){e()}))}function mb(a){M(a.ed.jd.gd.name+" instance already deleted")}var nb=!1;function ob(){}
61
+ function pb(a){--a.count.value;0===a.count.value&&(a.md?a.od.qd(a.md):a.jd.gd.qd(a.hd))}function qb(a){if("undefined"===typeof FinalizationGroup)return qb=function(b){return b},a;nb=new FinalizationGroup(function(b){for(var c=b.next();!c.done;c=b.next())c=c.value,c.hd?pb(c):console.warn("object already deleted: "+c.hd)});qb=function(b){nb.register(b,b.ed,b.ed);return b};ob=function(b){nb.unregister(b.ed)};return qb(a)}var rb=void 0,sb=[];
62
+ function tb(){for(;sb.length;){var a=sb.pop();a.ed.ud=!1;a["delete"]()}}function ub(){}var vb={};function wb(a,b,c){if(void 0===a[b].kd){var d=a[b];a[b]=function(){a[b].kd.hasOwnProperty(arguments.length)||M("Function '"+c+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+a[b].kd+")!");return a[b].kd[arguments.length].apply(this,arguments)};a[b].kd=[];a[b].kd[d.Ad]=d}}
63
+ function xb(a,b,c){g.hasOwnProperty(a)?((void 0===c||void 0!==g[a].kd&&void 0!==g[a].kd[c])&&M("Cannot register public name '"+a+"' twice"),wb(g,a,a),g.hasOwnProperty(c)&&M("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),g[a].kd[c]=b):(g[a]=b,void 0!==c&&(g[a].Ge=c))}function yb(a,b,c,d,e,f,l,k){this.name=a;this.constructor=b;this.rd=c;this.qd=d;this.pd=e;this.ie=f;this.zd=l;this.fe=k;this.re=[]}
64
+ function zb(a,b,c){for(;b!==c;)b.zd||M("Expected null or instance of "+c.name+", got an instance of "+b.name),a=b.zd(a),b=b.pd;return a}function Ab(a,b){if(null===b)return this.Md&&M("null is not a valid "+this.name),0;b.ed||M('Cannot pass "'+Bb(b)+'" as a '+this.name);b.ed.hd||M("Cannot pass deleted object as a pointer of type "+this.name);return zb(b.ed.hd,b.ed.jd.gd,this.gd)}
65
+ function Cb(a,b){if(null===b){this.Md&&M("null is not a valid "+this.name);if(this.Cd){var c=this.Nd();null!==a&&a.push(this.qd,c);return c}return 0}b.ed||M('Cannot pass "'+Bb(b)+'" as a '+this.name);b.ed.hd||M("Cannot pass deleted object as a pointer of type "+this.name);!this.Bd&&b.ed.jd.Bd&&M("Cannot convert argument of type "+(b.ed.od?b.ed.od.name:b.ed.jd.name)+" to parameter type "+this.name);c=zb(b.ed.hd,b.ed.jd.gd,this.gd);if(this.Cd)switch(void 0===b.ed.md&&M("Passing raw pointer to smart pointer is illegal"),
66
+ this.we){case 0:b.ed.od===this?c=b.ed.md:M("Cannot convert argument of type "+(b.ed.od?b.ed.od.name:b.ed.jd.name)+" to parameter type "+this.name);break;case 1:c=b.ed.md;break;case 2:if(b.ed.od===this)c=b.ed.md;else{var d=b.clone();c=this.se(c,Db(function(){d["delete"]()}));null!==a&&a.push(this.qd,c)}break;default:M("Unsupporting sharing policy")}return c}
67
+ function Eb(a,b){if(null===b)return this.Md&&M("null is not a valid "+this.name),0;b.ed||M('Cannot pass "'+Bb(b)+'" as a '+this.name);b.ed.hd||M("Cannot pass deleted object as a pointer of type "+this.name);b.ed.jd.Bd&&M("Cannot convert argument of type "+b.ed.jd.name+" to parameter type "+this.name);return zb(b.ed.hd,b.ed.jd.gd,this.gd)}function Fb(a,b,c){if(b===c)return a;if(void 0===c.pd)return null;a=Fb(a,b,c.pd);return null===a?null:c.fe(a)}var Gb={};
68
+ function Hb(a,b){for(void 0===b&&M("ptr should not be undefined");a.pd;)b=a.zd(b),a=a.pd;return Gb[b]}function Ib(a,b){b.jd&&b.hd||ib("makeClassHandle requires ptr and ptrType");!!b.od!==!!b.md&&ib("Both smartPtrType and smartPtr must be specified");b.count={value:1};return qb(Object.create(a,{ed:{value:b}}))}
69
+ function O(a,b,c,d){this.name=a;this.gd=b;this.Md=c;this.Bd=d;this.Cd=!1;this.qd=this.se=this.Nd=this.Yd=this.we=this.qe=void 0;void 0!==b.pd?this.toWireType=Cb:(this.toWireType=d?Ab:Eb,this.nd=null)}function Jb(a,b,c){g.hasOwnProperty(a)||ib("Replacing nonexistant public symbol");void 0!==g[a].kd&&void 0!==c?g[a].kd[c]=b:(g[a]=b,g[a].Ad=c)}
70
+ function Kb(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=g["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=I(b).apply(null,c);return d}}function P(a,b){a=L(a);var c=a.includes("j")?Kb(a,b):I(b);"function"!==typeof c&&M("unknown function pointer with signature "+a+": "+b);return c}var Lb=void 0;function Mb(a){a=Nb(a);var b=L(a);Q(a);return b}
71
+ function Ob(a,b){function c(f){e[f]||cb[f]||(db[f]?db[f].forEach(c):(d.push(f),e[f]=!0))}var d=[],e={};b.forEach(c);throw new Lb(a+": "+d.map(Mb).join([", "]));}function Pb(a,b,c){a instanceof Object||M(c+' with invalid "this": '+a);a instanceof b.gd.constructor||M(c+' incompatible with "this" of type '+a.constructor.name);a.ed.hd||M("cannot call emscripten binding method "+c+" on deleted object");return zb(a.ed.hd,a.ed.jd.gd,b.gd)}
72
+ function Qb(a,b){for(var c=[],d=0;d<a;d++)c.push(C[(b>>2)+d]);return c}function Rb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=fb(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
73
+ function Sb(a,b,c,d,e){var f=b.length;2>f&&M("argTypes array size mismatch! Must at least get return value and 'this' types!");var l=null!==b[1]&&null!==c,k=!1;for(c=1;c<b.length;++c)if(null!==b[c]&&void 0===b[c].nd){k=!0;break}var n="void"!==b[0].name,p="",q="";for(c=0;c<f-2;++c)p+=(0!==c?", ":"")+"arg"+c,q+=(0!==c?", ":"")+"arg"+c+"Wired";a="return function "+eb(a)+"("+p+") {\nif (arguments.length !== "+(f-2)+") {\nthrowBindingError('function "+a+" called with ' + arguments.length + ' arguments, expected "+
74
+ (f-2)+" args!');\n}\n";k&&(a+="var destructors = [];\n");var u=k?"destructors":"null";p="throwBindingError invoker fn runDestructors retType classParam".split(" ");d=[M,d,e,$a,b[0],b[1]];l&&(a+="var thisWired = classParam.toWireType("+u+", this);\n");for(c=0;c<f-2;++c)a+="var arg"+c+"Wired = argType"+c+".toWireType("+u+", arg"+c+"); // "+b[c+2].name+"\n",p.push("argType"+c),d.push(b[c+2]);l&&(q="thisWired"+(0<q.length?", ":"")+q);a+=(n?"var rv = ":"")+"invoker(fn"+(0<q.length?", ":"")+q+");\n";if(k)a+=
75
+ "runDestructors(destructors);\n";else for(c=l?1:2;c<b.length;++c)f=1===c?"thisWired":"arg"+(c-2)+"Wired",null!==b[c].nd&&(a+=f+"_dtor("+f+"); // "+b[c].name+"\n",p.push(f+"_dtor"),d.push(b[c].nd));n&&(a+="var ret = retType.fromWireType(rv);\nreturn ret;\n");p.push(a+"}\n");return Rb(p).apply(null,d)}var Tb=[],S=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Ub(a){4<a&&0===--S[a].Od&&(S[a]=void 0,Tb.push(a))}
76
+ function Vb(a){a||M("Cannot use deleted val. handle = "+a);return S[a].value}function Db(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Tb.length?Tb.pop():S.length;S[b]={Od:1,value:a};return b}}
77
+ function Wb(a,b,c){switch(b){case 0:return function(d){return this.fromWireType((c?E:A)[d])};case 1:return function(d){return this.fromWireType((c?B:Ca)[d>>1])};case 2:return function(d){return this.fromWireType((c?C:F)[d>>2])};default:throw new TypeError("Unknown integer type: "+a);}}function Xb(a,b){var c=cb[a];void 0===c&&M(b+" has unknown type "+Mb(a));return c}function Bb(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
78
+ function Yb(a,b){switch(b){case 2:return function(c){return this.fromWireType(G[c>>2])};case 3:return function(c){return this.fromWireType(Ka[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}
79
+ function Zb(a,b,c){switch(b){case 0:return c?function(d){return E[d]}:function(d){return A[d]};case 1:return c?function(d){return B[d>>1]}:function(d){return Ca[d>>1]};case 2:return c?function(d){return C[d>>2]}:function(d){return F[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var $b={};function ac(a){var b=$b[a];return void 0===b?L(a):b}var bc=[];function cc(a){var b=bc.length;bc.push(a);return b}
80
+ function dc(a,b){for(var c=Array(a),d=0;d<a;++d)c[d]=Xb(C[(b>>2)+d],"parameter "+d);return c}var ec=[],fc;fc=ja?function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:function(){return performance.now()};var gc=1,hc=[],T=[],ic=[],jc=[],kc=[],U=[],lc=[],da=[],mc=[],nc=[],oc={},pc={};function V(a){rc||(rc=a)}function sc(a){for(var b=gc++,c=a.length;c<b;c++)a[c]=null;return b}
81
+ function ca(a){var b={alpha:1,depth:1,stencil:8,antialias:0,premultipliedAlpha:1,preserveDrawingBuffer:0,preferLowPowerToHighPerformance:0,failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:1,explicitSwapControl:0,renderViaOffscreenBackBuffer:0};a.Wd||(a.Wd=a.getContext,a.getContext=function(d,e){e=a.Wd(d,e);return"webgl"==d==e instanceof WebGLRenderingContext?e:null});var c=a.getContext("webgl2",b);return c?tc(c,b):0}
82
+ function tc(a,b){var c=sc(da),d={De:c,attributes:b,version:b.Ee,Jd:a};a.canvas&&(a.canvas.Be=d);da[c]=d;("undefined"===typeof b.ge||b.ge)&&uc(d);return c}
83
+ function uc(a){a||(a=h);if(!a.oe){a.oe=!0;var b=a.Jd;b.Td=b.getExtension("WEBGL_draw_instanced_base_vertex_base_instance");b.Xd=b.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance");2<=a.version&&(b.Ud=b.getExtension("EXT_disjoint_timer_query_webgl2"));if(2>a.version||!b.Ud)b.Ud=b.getExtension("EXT_disjoint_timer_query");b.Fe=b.getExtension("WEBGL_multi_draw");(b.getSupportedExtensions()||[]).forEach(function(c){c.includes("lose_context")||c.includes("debug")||b.getExtension(c)})}}
84
+ var rc,h,vc=[];function wc(a,b,c,d){for(var e=0;e<a;e++){var f=r[c](),l=f&&sc(d);f?(f.name=l,d[l]=f):V(1282);C[b+4*e>>2]=l}}
85
+ function xc(a,b){if(b){var c=void 0;switch(a){case 36346:c=1;break;case 36344:return;case 34814:case 36345:c=0;break;case 34466:var d=r.getParameter(34467);c=d?d.length:0;break;case 33309:if(2>h.version){V(1282);return}c=2*(r.getSupportedExtensions()||[]).length;break;case 33307:case 33308:if(2>h.version){V(1280);return}c=33307==a?3:0}if(void 0===c)switch(d=r.getParameter(a),typeof d){case "number":c=d;break;case "boolean":c=d?1:0;break;case "string":V(1280);return;case "object":if(null===d)switch(a){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:c=
86
+ 0;break;default:V(1280);return}else{if(d instanceof Float32Array||d instanceof Uint32Array||d instanceof Int32Array||d instanceof Array){for(a=0;a<d.length;++a)C[b+4*a>>2]=d[a];return}try{c=d.name|0}catch(e){V(1280);z("GL_INVALID_ENUM in glGet0v: Unknown object returned from WebGL getParameter("+a+")! (error: "+e+")");return}}break;default:V(1280);z("GL_INVALID_ENUM in glGet0v: Native code calling glGet0v("+a+") and it returns "+d+" of type "+typeof d+"!");return}C[b>>2]=c}else V(1281)}
87
+ function yc(a){var b=za(a)+1,c=zc(b);ya(a,A,c,b);return c}function Ac(a){return"]"==a.slice(-1)&&a.lastIndexOf("[")}function Bc(a){a-=5120;return 0==a?E:1==a?A:2==a?B:4==a?C:6==a?G:5==a||28922==a||28520==a||30779==a||30782==a?F:Ca}function W(a){var b=r.ee;if(b){var c=b.yd[a];"number"===typeof c&&(b.yd[a]=c=r.getUniformLocation(b,b.Zd[a]+(0<c?"["+c+"]":"")));return c}V(1282)}var Cc={};
88
+ function Dc(){if(!Ec){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:fa||"./this.program"},b;for(b in Cc)void 0===Cc[b]?delete a[b]:a[b]=Cc[b];var c=[];for(b in a)c.push(b+"="+a[b]);Ec=c}return Ec}var Ec,Fc=[null,[],[]];function Gc(a){return 0===a%4&&(0!==a%100||0===a%400)}function Hc(a,b){for(var c=0,d=0;d<=b;c+=a[d++]);return c}
89
+ var Ic=[31,29,31,30,31,30,31,31,30,31,30,31],Jc=[31,28,31,30,31,30,31,31,30,31,30,31];function Kc(a,b){for(a=new Date(a.getTime());0<b;){var c=a.getMonth(),d=(Gc(a.getFullYear())?Ic:Jc)[c];if(b>d-a.getDate())b-=d-a.getDate()+1,a.setDate(1),11>c?a.setMonth(c+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
90
+ function Lc(a,b,c,d){function e(m,t,w){for(m="number"===typeof m?m.toString():m||"";m.length<t;)m=w[0]+m;return m}function f(m,t){return e(m,t,"0")}function l(m,t){function w(N){return 0>N?-1:0<N?1:0}var D;0===(D=w(m.getFullYear()-t.getFullYear()))&&0===(D=w(m.getMonth()-t.getMonth()))&&(D=w(m.getDate()-t.getDate()));return D}function k(m){switch(m.getDay()){case 0:return new Date(m.getFullYear()-1,11,29);case 1:return m;case 2:return new Date(m.getFullYear(),0,3);case 3:return new Date(m.getFullYear(),
91
+ 0,2);case 4:return new Date(m.getFullYear(),0,1);case 5:return new Date(m.getFullYear()-1,11,31);case 6:return new Date(m.getFullYear()-1,11,30)}}function n(m){m=Kc(new Date(m.ld+1900,0,1),m.Id);var t=new Date(m.getFullYear()+1,0,4),w=k(new Date(m.getFullYear(),0,4));t=k(t);return 0>=l(w,m)?0>=l(t,m)?m.getFullYear()+1:m.getFullYear():m.getFullYear()-1}var p=C[d+40>>2];d={ze:C[d>>2],ye:C[d+4>>2],Gd:C[d+8>>2],xd:C[d+12>>2],vd:C[d+16>>2],ld:C[d+20>>2],Hd:C[d+24>>2],Id:C[d+28>>2],He:C[d+32>>2],xe:C[d+
92
+ 36>>2],Ae:p?xa(p):""};c=xa(c);p={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var q in p)c=c.replace(new RegExp(q,"g"),p[q]);var u="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
93
+ x="January February March April May June July August September October November December".split(" ");p={"%a":function(m){return u[m.Hd].substring(0,3)},"%A":function(m){return u[m.Hd]},"%b":function(m){return x[m.vd].substring(0,3)},"%B":function(m){return x[m.vd]},"%C":function(m){return f((m.ld+1900)/100|0,2)},"%d":function(m){return f(m.xd,2)},"%e":function(m){return e(m.xd,2," ")},"%g":function(m){return n(m).toString().substring(2)},"%G":function(m){return n(m)},"%H":function(m){return f(m.Gd,
94
+ 2)},"%I":function(m){m=m.Gd;0==m?m=12:12<m&&(m-=12);return f(m,2)},"%j":function(m){return f(m.xd+Hc(Gc(m.ld+1900)?Ic:Jc,m.vd-1),3)},"%m":function(m){return f(m.vd+1,2)},"%M":function(m){return f(m.ye,2)},"%n":function(){return"\n"},"%p":function(m){return 0<=m.Gd&&12>m.Gd?"AM":"PM"},"%S":function(m){return f(m.ze,2)},"%t":function(){return"\t"},"%u":function(m){return m.Hd||7},"%U":function(m){var t=new Date(m.ld+1900,0,1),w=0===t.getDay()?t:Kc(t,7-t.getDay());m=new Date(m.ld+1900,m.vd,m.xd);return 0>
95
+ l(w,m)?f(Math.ceil((31-w.getDate()+(Hc(Gc(m.getFullYear())?Ic:Jc,m.getMonth()-1)-31)+m.getDate())/7),2):0===l(w,t)?"01":"00"},"%V":function(m){var t=new Date(m.ld+1901,0,4),w=k(new Date(m.ld+1900,0,4));t=k(t);var D=Kc(new Date(m.ld+1900,0,1),m.Id);return 0>l(D,w)?"53":0>=l(t,D)?"01":f(Math.ceil((w.getFullYear()<m.ld+1900?m.Id+32-w.getDate():m.Id+1-w.getDate())/7),2)},"%w":function(m){return m.Hd},"%W":function(m){var t=new Date(m.ld,0,1),w=1===t.getDay()?t:Kc(t,0===t.getDay()?1:7-t.getDay()+1);m=
96
+ new Date(m.ld+1900,m.vd,m.xd);return 0>l(w,m)?f(Math.ceil((31-w.getDate()+(Hc(Gc(m.getFullYear())?Ic:Jc,m.getMonth()-1)-31)+m.getDate())/7),2):0===l(w,t)?"01":"00"},"%y":function(m){return(m.ld+1900).toString().substring(2)},"%Y":function(m){return m.ld+1900},"%z":function(m){m=m.xe;var t=0<=m;m=Math.abs(m)/60;return(t?"+":"-")+String("0000"+(m/60*100+m%60)).slice(-4)},"%Z":function(m){return m.Ae},"%%":function(){return"%"}};for(q in p)c.includes(q)&&(c=c.replace(new RegExp(q,"g"),p[q](d)));q=Mc(c);
97
+ if(q.length>b)return 0;E.set(q,a);return q.length-1}hb=g.InternalError=gb("InternalError");for(var Nc=Array(256),Oc=0;256>Oc;++Oc)Nc[Oc]=String.fromCharCode(Oc);kb=Nc;lb=g.BindingError=gb("BindingError");ub.prototype.isAliasOf=function(a){if(!(this instanceof ub&&a instanceof ub))return!1;var b=this.ed.jd.gd,c=this.ed.hd,d=a.ed.jd.gd;for(a=a.ed.hd;b.pd;)c=b.zd(c),b=b.pd;for(;d.pd;)a=d.zd(a),d=d.pd;return b===d&&c===a};
98
+ ub.prototype.clone=function(){this.ed.hd||mb(this);if(this.ed.wd)return this.ed.count.value+=1,this;var a=qb,b=Object,c=b.create,d=Object.getPrototypeOf(this),e=this.ed;a=a(c.call(b,d,{ed:{value:{count:e.count,ud:e.ud,wd:e.wd,hd:e.hd,jd:e.jd,md:e.md,od:e.od}}}));a.ed.count.value+=1;a.ed.ud=!1;return a};ub.prototype["delete"]=function(){this.ed.hd||mb(this);this.ed.ud&&!this.ed.wd&&M("Object already scheduled for deletion");ob(this);pb(this.ed);this.ed.wd||(this.ed.md=void 0,this.ed.hd=void 0)};
99
+ ub.prototype.isDeleted=function(){return!this.ed.hd};ub.prototype.deleteLater=function(){this.ed.hd||mb(this);this.ed.ud&&!this.ed.wd&&M("Object already scheduled for deletion");sb.push(this);1===sb.length&&rb&&rb(tb);this.ed.ud=!0;return this};O.prototype.je=function(a){this.Yd&&(a=this.Yd(a));return a};O.prototype.Sd=function(a){this.qd&&this.qd(a)};O.prototype.argPackAdvance=8;O.prototype.readValueFromPointer=ab;O.prototype.deleteObject=function(a){if(null!==a)a["delete"]()};
100
+ O.prototype.fromWireType=function(a){function b(){return this.Cd?Ib(this.gd.rd,{jd:this.qe,hd:c,od:this,md:a}):Ib(this.gd.rd,{jd:this,hd:a})}var c=this.je(a);if(!c)return this.Sd(a),null;var d=Hb(this.gd,c);if(void 0!==d){if(0===d.ed.count.value)return d.ed.hd=c,d.ed.md=a,d.clone();d=d.clone();this.Sd(a);return d}d=this.gd.ie(c);d=vb[d];if(!d)return b.call(this);d=this.Bd?d.ce:d.pointerType;var e=Fb(c,this.gd,d.gd);return null===e?b.call(this):this.Cd?Ib(d.gd.rd,{jd:d,hd:e,od:this,md:a}):Ib(d.gd.rd,
101
+ {jd:d,hd:e})};g.getInheritedInstanceCount=function(){return Object.keys(Gb).length};g.getLiveInheritedInstances=function(){var a=[],b;for(b in Gb)Gb.hasOwnProperty(b)&&a.push(Gb[b]);return a};g.flushPendingDeletes=tb;g.setDelayFunction=function(a){rb=a;sb.length&&rb&&rb(tb)};Lb=g.UnboundTypeError=gb("UnboundTypeError");g.count_emval_handles=function(){for(var a=0,b=5;b<S.length;++b)void 0!==S[b]&&++a;return a};g.get_first_emval=function(){for(var a=5;a<S.length;++a)if(void 0!==S[a])return S[a];return null};
102
+ for(var r,Pc=0;32>Pc;++Pc)vc.push(Array(Pc));function Mc(a){var b=Array(za(a)+1);ya(a,b,0,b.length);return b}
103
+ var ed={cb:function(a){var b=Za[a];delete Za[a];var c=b.Nd,d=b.qd,e=b.Vd,f=e.map(function(l){return l.me}).concat(e.map(function(l){return l.ue}));J([a],f,function(l){var k={};e.forEach(function(n,p){var q=l[p],u=n.ke,x=n.le,m=l[p+e.length],t=n.te,w=n.ve;k[n.he]={read:function(D){return q.fromWireType(u(x,D))},write:function(D,N){var R=[];t(w,D,m.toWireType(R,N));$a(R)}}});return[{name:b.name,fromWireType:function(n){var p={},q;for(q in k)p[q]=k[q].read(n);d(n);return p},toWireType:function(n,p){for(var q in k)if(!(q in
104
+ p))throw new TypeError('Missing field: "'+q+'"');var u=c();for(q in k)k[q].write(u,p[q]);null!==n&&n.push(d,u);return u},argPackAdvance:8,readValueFromPointer:ab,nd:d}]})},fb:function(){},wb:function(a,b,c,d,e){var f=jb(c);b=L(b);K(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?d:e},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=E;else if(2===c)k=B;else if(4===c)k=C;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>
105
+ f])},nd:null})},g:function(a,b,c,d,e,f,l,k,n,p,q,u,x){q=L(q);f=P(e,f);k&&(k=P(l,k));p&&(p=P(n,p));x=P(u,x);var m=eb(q);xb(m,function(){Ob("Cannot construct "+q+" due to unbound types",[d])});J([a,b,c],d?[d]:[],function(t){t=t[0];if(d){var w=t.gd;var D=w.rd}else D=ub.prototype;t=fb(m,function(){if(Object.getPrototypeOf(this)!==N)throw new lb("Use 'new' to construct "+q);if(void 0===R.sd)throw new lb(q+" has no accessible constructor");var qc=R.sd[arguments.length];if(void 0===qc)throw new lb("Tried to invoke ctor of "+
106
+ q+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(R.sd).toString()+") parameters instead!");return qc.apply(this,arguments)});var N=Object.create(D,{constructor:{value:t}});t.prototype=N;var R=new yb(q,t,N,x,w,f,k,p);w=new O(q,R,!0,!1);D=new O(q+"*",R,!1,!1);var Ia=new O(q+" const*",R,!1,!0);vb[a]={pointerType:D,ce:Ia};Jb(m,t);return[w,D,Ia]})},k:function(a,b,c,d,e,f,l,k){b=L(b);f=P(e,f);J([],[a],function(n){n=n[0];var p=n.name+"."+b,q={get:function(){Ob("Cannot access "+
107
+ p+" due to unbound types",[c])},enumerable:!0,configurable:!0};q.set=k?function(){Ob("Cannot access "+p+" due to unbound types",[c])}:function(){M(p+" is a read-only property")};Object.defineProperty(n.gd.constructor,b,q);J([],[c],function(u){u=u[0];var x={get:function(){return u.fromWireType(f(d))},enumerable:!0};k&&(k=P(l,k),x.set=function(m){var t=[];k(d,u.toWireType(t,m));$a(t)});Object.defineProperty(n.gd.constructor,b,x);return[]});return[]})},v:function(a,b,c,d,e,f){0<b||pa("Assertion failed: undefined");
108
+ var l=Qb(b,c);e=P(d,e);J([],[a],function(k){k=k[0];var n="constructor "+k.name;void 0===k.gd.sd&&(k.gd.sd=[]);if(void 0!==k.gd.sd[b-1])throw new lb("Cannot register multiple constructors with identical number of parameters ("+(b-1)+") for class '"+k.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");k.gd.sd[b-1]=function(){Ob("Cannot construct "+k.name+" due to unbound types",l)};J([],l,function(p){p.splice(1,0,null);k.gd.sd[b-1]=Sb(n,p,null,
109
+ e,f);return[]});return[]})},e:function(a,b,c,d,e,f,l,k){var n=Qb(c,d);b=L(b);f=P(e,f);J([],[a],function(p){function q(){Ob("Cannot call "+u+" due to unbound types",n)}p=p[0];var u=p.name+"."+b;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);k&&p.gd.re.push(b);var x=p.gd.rd,m=x[b];void 0===m||void 0===m.kd&&m.className!==p.name&&m.Ad===c-2?(q.Ad=c-2,q.className=p.name,x[b]=q):(wb(x,b,u),x[b].kd[c-2]=q);J([],n,function(t){t=Sb(u,t,p,f,l);void 0===x[b].kd?(t.Ad=c-2,x[b]=t):x[b].kd[c-2]=t;return[]});return[]})},
110
+ f:function(a,b,c,d,e,f,l,k,n,p){b=L(b);e=P(d,e);J([],[a],function(q){q=q[0];var u=q.name+"."+b,x={get:function(){Ob("Cannot access "+u+" due to unbound types",[c,l])},enumerable:!0,configurable:!0};x.set=n?function(){Ob("Cannot access "+u+" due to unbound types",[c,l])}:function(){M(u+" is a read-only property")};Object.defineProperty(q.gd.rd,b,x);J([],n?[c,l]:[c],function(m){var t=m[0],w={get:function(){var N=Pb(this,q,u+" getter");return t.fromWireType(e(f,N))},enumerable:!0};if(n){n=P(k,n);var D=
111
+ m[1];w.set=function(N){var R=Pb(this,q,u+" setter"),Ia=[];n(p,R,D.toWireType(Ia,N));$a(Ia)}}Object.defineProperty(q.gd.rd,b,w);return[]});return[]})},vb:function(a,b){b=L(b);K(a,{name:b,fromWireType:function(c){var d=Vb(c);Ub(c);return d},toWireType:function(c,d){return Db(d)},argPackAdvance:8,readValueFromPointer:ab,nd:null})},sb:function(a,b,c,d){function e(){}c=jb(c);b=L(b);e.values={};K(a,{name:b,constructor:e,fromWireType:function(f){return this.constructor.values[f]},toWireType:function(f,l){return l.value},
112
+ argPackAdvance:8,readValueFromPointer:Wb(b,c,d),nd:null});xb(b,e)},mb:function(a,b,c){var d=Xb(a,"enum");b=L(b);a=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},constructor:{value:fb(d.name+"_"+b,function(){})}});a.values[c]=d;a[b]=d},w:function(a,b,c){c=jb(c);b=L(b);K(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,e){return e},argPackAdvance:8,readValueFromPointer:Yb(b,c),nd:null})},y:function(a,b,c,d,e,f){var l=Qb(b,c);a=L(a);e=P(d,e);xb(a,function(){Ob("Cannot call "+
113
+ a+" due to unbound types",l)},b-1);J([],l,function(k){k=[k[0],null].concat(k.slice(1));Jb(a,Sb(a,k,null,e,f),b-1);return[]})},m:function(a,b,c,d,e){function f(p){return p}b=L(b);-1===e&&(e=4294967295);var l=jb(c);if(0===d){var k=32-8*c;f=function(p){return p<<k>>>k}}var n=b.includes("unsigned");K(a,{name:b,fromWireType:f,toWireType:function(p,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+Bb(q)+'" to '+this.name);if(q<d||q>e)throw new TypeError('Passing a number "'+
114
+ Bb(q)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+e+"]!");return n?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:Zb(b,l,0!==d),nd:null})},l:function(a,b,c){function d(f){f>>=2;var l=F;return new e(Ja,l[f+1],l[f])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=L(c);K(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{ne:!0})},x:function(a,b){b=L(b);var c="std::string"===
115
+ b;K(a,{name:b,fromWireType:function(d){var e=F[d>>2];if(c)for(var f=d+4,l=0;l<=e;++l){var k=d+4+l;if(l==e||0==A[k]){f=xa(f,k-f);if(void 0===n)var n=f;else n+=String.fromCharCode(0),n+=f;f=k+1}}else{n=Array(e);for(l=0;l<e;++l)n[l]=String.fromCharCode(A[d+4+l]);n=n.join("")}Q(d);return n},toWireType:function(d,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var f="string"===typeof e;f||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||M("Cannot pass non-string to std::string");
116
+ var l=(c&&f?function(){return za(e)}:function(){return e.length})(),k=zc(4+l+1);F[k>>2]=l;if(c&&f)ya(e,A,k+4,l+1);else if(f)for(f=0;f<l;++f){var n=e.charCodeAt(f);255<n&&(Q(k),M("String has UTF-16 code units that do not fit in 8 bits"));A[k+4+f]=n}else for(f=0;f<l;++f)A[k+4+f]=e[f];null!==d&&d.push(Q,k);return k},argPackAdvance:8,readValueFromPointer:ab,nd:function(d){Q(d)}})},u:function(a,b,c){c=L(c);if(2===b){var d=Ba;var e=Da;var f=Ea;var l=function(){return Ca};var k=1}else 4===b&&(d=Fa,e=Ga,
117
+ f=Ha,l=function(){return F},k=2);K(a,{name:c,fromWireType:function(n){for(var p=F[n>>2],q=l(),u,x=n+4,m=0;m<=p;++m){var t=n+4+m*b;if(m==p||0==q[t>>k])x=d(x,t-x),void 0===u?u=x:(u+=String.fromCharCode(0),u+=x),x=t+b}Q(n);return u},toWireType:function(n,p){"string"!==typeof p&&M("Cannot pass non-string to C++ string type "+c);var q=f(p),u=zc(4+q+b);F[u>>2]=q>>k;e(p,u+4,q+b);null!==n&&n.push(Q,u);return u},argPackAdvance:8,readValueFromPointer:ab,nd:function(n){Q(n)}})},ib:function(a,b,c,d,e,f){Za[a]=
118
+ {name:L(b),Nd:P(c,d),qd:P(e,f),Vd:[]}},bb:function(a,b,c,d,e,f,l,k,n,p){Za[a].Vd.push({he:L(b),me:c,ke:P(d,e),le:f,ue:l,te:P(k,n),ve:p})},xb:function(a,b){b=L(b);K(a,{pe:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},nb:function(){throw"longjmp";},oa:function(a,b,c){a=Vb(a);b=Xb(b,"emval::as");var d=[],e=Db(d);C[c>>2]=e;return b.toWireType(d,a)},U:function(a,b,c,d){a=bc[a];b=Vb(b);c=ac(c);a(b,c,null,d)},Fc:Ub,J:function(a,b){var c=dc(a,b),d=c[0];b=d.name+"_$"+c.slice(1).map(function(q){return q.name}).join("_")+
119
+ "$";var e=ec[b];if(void 0!==e)return e;e=["retType"];for(var f=[d],l="",k=0;k<a-1;++k)l+=(0!==k?", ":"")+"arg"+k,e.push("argType"+k),f.push(c[1+k]);var n="return function "+eb("methodCaller_"+b)+"(handle, name, destructors, args) {\n",p=0;for(k=0;k<a-1;++k)n+=" var arg"+k+" = argType"+k+".readValueFromPointer(args"+(p?"+"+p:"")+");\n",p+=c[k+1].argPackAdvance;n+=" var rv = handle[name]("+l+");\n";for(k=0;k<a-1;++k)c[k+1].deleteObject&&(n+=" argType"+k+".deleteObject(arg"+k+");\n");d.pe||
120
+ (n+=" return retType.toWireType(destructors, rv);\n");e.push(n+"};\n");a=Rb(e).apply(null,f);e=cc(a);return ec[b]=e},Ka:function(a,b){a=Vb(a);b=Vb(b);return Db(a[b])},Ec:function(a){4<a&&(S[a].Od+=1)},za:function(a){return Db(ac(a))},da:function(a){var b=Vb(a);$a(b);Ub(a)},Va:function(a,b){a=Xb(a,"_emval_take_value");a=a.readValueFromPointer(b);return Db(a)},a:function(){pa("")},ob:function(a,b){if(0===a)a=Date.now();else if(1===a||4===a)a=fc();else return C[Qc()>>2]=28,-1;C[b>>2]=a/1E3|0;C[b+
121
+ 4>>2]=a%1E3*1E6|0;return 0},Ya:function(a){r.activeTexture(a)},Xa:function(a,b){r.attachShader(T[a],U[b])},Wa:function(a,b,c){r.bindAttribLocation(T[a],b,xa(c))},Ua:function(a,b){35051==a?r.Ld=b:35052==a&&(r.td=b);r.bindBuffer(a,hc[b])},Xb:function(a,b){r.bindFramebuffer(a,ic[b])},Wb:function(a,b){r.bindRenderbuffer(a,jc[b])},Fb:function(a,b){r.bindSampler(a,mc[b])},Ta:function(a,b){r.bindTexture(a,kc[b])},nc:function(a){r.bindVertexArray(lc[a])},kc:function(a){r.bindVertexArray(lc[a])},Sa:function(a,
122
+ b,c,d){r.blendColor(a,b,c,d)},Ra:function(a){r.blendEquation(a)},Qa:function(a,b){r.blendFunc(a,b)},Kb:function(a,b,c,d,e,f,l,k,n,p){r.blitFramebuffer(a,b,c,d,e,f,l,k,n,p)},Pa:function(a,b,c,d){c?r.bufferData(a,A,d,c,b):r.bufferData(a,b,d)},Oa:function(a,b,c,d){r.bufferSubData(a,b,A,d,c)},Vb:function(a){return r.checkFramebufferStatus(a)},Na:function(a){r.clear(a)},Ma:function(a,b,c,d){r.clearColor(a,b,c,d)},La:function(a){r.clearStencil(a)},$a:function(a,b,c,d){return r.clientWaitSync(nc[a],b,(c>>>
123
+ 0)+4294967296*d)},Ja:function(a,b,c,d){r.colorMask(!!a,!!b,!!c,!!d)},Ia:function(a){r.compileShader(U[a])},Ha:function(a,b,c,d,e,f,l,k){r.td?r.compressedTexImage2D(a,b,c,d,e,f,l,k):r.compressedTexImage2D(a,b,c,d,e,f,A,k,l)},Ga:function(a,b,c,d,e,f,l,k,n){r.td?r.compressedTexSubImage2D(a,b,c,d,e,f,l,k,n):r.compressedTexSubImage2D(a,b,c,d,e,f,l,A,n,k)},Fa:function(a,b,c,d,e,f,l,k){r.copyTexSubImage2D(a,b,c,d,e,f,l,k)},Ea:function(){var a=sc(T),b=r.createProgram();b.name=a;b.Fd=b.Dd=b.Ed=0;b.Pd=1;T[a]=
124
+ b;return a},Da:function(a){var b=sc(U);U[b]=r.createShader(a);return b},Ca:function(a){r.cullFace(a)},Ba:function(a,b){for(var c=0;c<a;c++){var d=C[b+4*c>>2],e=hc[d];e&&(r.deleteBuffer(e),e.name=0,hc[d]=null,d==r.Ld&&(r.Ld=0),d==r.td&&(r.td=0))}},Ub:function(a,b){for(var c=0;c<a;++c){var d=C[b+4*c>>2],e=ic[d];e&&(r.deleteFramebuffer(e),e.name=0,ic[d]=null)}},Aa:function(a){if(a){var b=T[a];b?(r.deleteProgram(b),b.name=0,T[a]=null):V(1281)}},Tb:function(a,b){for(var c=0;c<a;c++){var d=C[b+4*c>>2],
125
+ e=jc[d];e&&(r.deleteRenderbuffer(e),e.name=0,jc[d]=null)}},Eb:function(a,b){for(var c=0;c<a;c++){var d=C[b+4*c>>2],e=mc[d];e&&(r.deleteSampler(e),e.name=0,mc[d]=null)}},ya:function(a){if(a){var b=U[a];b?(r.deleteShader(b),U[a]=null):V(1281)}},Ib:function(a){if(a){var b=nc[a];b?(r.deleteSync(b),b.name=0,nc[a]=null):V(1281)}},xa:function(a,b){for(var c=0;c<a;c++){var d=C[b+4*c>>2],e=kc[d];e&&(r.deleteTexture(e),e.name=0,kc[d]=null)}},mc:function(a,b){for(var c=0;c<a;c++){var d=C[b+4*c>>2];r.deleteVertexArray(lc[d]);
126
+ lc[d]=null}},jc:function(a,b){for(var c=0;c<a;c++){var d=C[b+4*c>>2];r.deleteVertexArray(lc[d]);lc[d]=null}},wa:function(a){r.depthMask(!!a)},va:function(a){r.disable(a)},ua:function(a){r.disableVertexAttribArray(a)},ta:function(a,b,c){r.drawArrays(a,b,c)},hc:function(a,b,c,d){r.drawArraysInstanced(a,b,c,d)},fc:function(a,b,c,d,e){r.Td.drawArraysInstancedBaseInstanceWEBGL(a,b,c,d,e)},dc:function(a,b){for(var c=vc[a],d=0;d<a;d++)c[d]=C[b+4*d>>2];r.drawBuffers(c)},sa:function(a,b,c,d){r.drawElements(a,
127
+ b,c,d)},gc:function(a,b,c,d,e){r.drawElementsInstanced(a,b,c,d,e)},ec:function(a,b,c,d,e,f,l){r.Td.drawElementsInstancedBaseVertexBaseInstanceWEBGL(a,b,c,d,e,f,l)},$b:function(a,b,c,d,e,f){r.drawElements(a,d,e,f)},ra:function(a){r.enable(a)},qa:function(a){r.enableVertexAttribArray(a)},Hb:function(a,b){return(a=r.fenceSync(a,b))?(b=sc(nc),a.name=b,nc[b]=a,b):0},pa:function(){r.finish()},na:function(){r.flush()},Sb:function(a,b,c,d){r.framebufferRenderbuffer(a,b,c,jc[d])},Rb:function(a,b,c,d,e){r.framebufferTexture2D(a,
128
+ b,c,kc[d],e)},ma:function(a){r.frontFace(a)},la:function(a,b){wc(a,b,"createBuffer",hc)},Qb:function(a,b){wc(a,b,"createFramebuffer",ic)},Pb:function(a,b){wc(a,b,"createRenderbuffer",jc)},Db:function(a,b){wc(a,b,"createSampler",mc)},ka:function(a,b){wc(a,b,"createTexture",kc)},lc:function(a,b){wc(a,b,"createVertexArray",lc)},ic:function(a,b){wc(a,b,"createVertexArray",lc)},Ob:function(a){r.generateMipmap(a)},ja:function(a,b,c){c?C[c>>2]=r.getBufferParameter(a,b):V(1281)},ia:function(){var a=r.getError()||
129
+ rc;rc=0;return a},Nb:function(a,b,c,d){a=r.getFramebufferAttachmentParameter(a,b,c);if(a instanceof WebGLRenderbuffer||a instanceof WebGLTexture)a=a.name|0;C[d>>2]=a},Za:function(a,b){xc(a,b)},ha:function(a,b,c,d){a=r.getProgramInfoLog(T[a]);null===a&&(a="(unknown error)");b=0<b&&d?ya(a,A,d,b):0;c&&(C[c>>2]=b)},ga:function(a,b,c){if(c)if(a>=gc)V(1281);else if(a=T[a],35716==b)a=r.getProgramInfoLog(a),null===a&&(a="(unknown error)"),C[c>>2]=a.length+1;else if(35719==b){if(!a.Fd)for(b=0;b<r.getProgramParameter(a,
130
+ 35718);++b)a.Fd=Math.max(a.Fd,r.getActiveUniform(a,b).name.length+1);C[c>>2]=a.Fd}else if(35722==b){if(!a.Dd)for(b=0;b<r.getProgramParameter(a,35721);++b)a.Dd=Math.max(a.Dd,r.getActiveAttrib(a,b).name.length+1);C[c>>2]=a.Dd}else if(35381==b){if(!a.Ed)for(b=0;b<r.getProgramParameter(a,35382);++b)a.Ed=Math.max(a.Ed,r.getActiveUniformBlockName(a,b).length+1);C[c>>2]=a.Ed}else C[c>>2]=r.getProgramParameter(a,b);else V(1281)},Mb:function(a,b,c){c?C[c>>2]=r.getRenderbufferParameter(a,b):V(1281)},fa:function(a,
131
+ b,c,d){a=r.getShaderInfoLog(U[a]);null===a&&(a="(unknown error)");b=0<b&&d?ya(a,A,d,b):0;c&&(C[c>>2]=b)},yb:function(a,b,c,d){a=r.getShaderPrecisionFormat(a,b);C[c>>2]=a.rangeMin;C[c+4>>2]=a.rangeMax;C[d>>2]=a.precision},ea:function(a,b,c){c?35716==b?(a=r.getShaderInfoLog(U[a]),null===a&&(a="(unknown error)"),C[c>>2]=a?a.length+1:0):35720==b?(a=r.getShaderSource(U[a]),C[c>>2]=a?a.length+1:0):C[c>>2]=r.getShaderParameter(U[a],b):V(1281)},s:function(a){var b=oc[a];if(!b){switch(a){case 7939:b=r.getSupportedExtensions()||
132
+ [];b=b.concat(b.map(function(d){return"GL_"+d}));b=yc(b.join(" "));break;case 7936:case 7937:case 37445:case 37446:(b=r.getParameter(a))||V(1280);b=b&&yc(b);break;case 7938:b=yc("OpenGL ES 3.0 ("+r.getParameter(7938)+")");break;case 35724:b=r.getParameter(35724);var c=b.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==c&&(3==c[1].length&&(c[1]+="0"),b="OpenGL ES GLSL ES "+c[1]+" ("+b+")");b=yc(b);break;default:V(1280)}oc[a]=b}return b},_a:function(a,b){if(2>h.version)return V(1282),0;
133
+ var c=pc[a];if(c)return 0>b||b>=c.length?(V(1281),0):c[b];switch(a){case 7939:return c=r.getSupportedExtensions()||[],c=c.concat(c.map(function(d){return"GL_"+d})),c=c.map(function(d){return yc(d)}),c=pc[a]=c,0>b||b>=c.length?(V(1281),0):c[b];default:return V(1280),0}},ca:function(a,b){b=xa(b);if(a=T[a]){var c=a,d=c.yd,e=c.$d,f;if(!d)for(c.yd=d={},c.Zd={},f=0;f<r.getProgramParameter(c,35718);++f){var l=r.getActiveUniform(c,f);var k=l.name;l=l.size;var n=Ac(k);n=0<n?k.slice(0,n):k;var p=c.Pd;c.Pd+=
134
+ l;e[n]=[l,p];for(k=0;k<l;++k)d[p]=k,c.Zd[p++]=n}c=a.yd;d=0;e=b;f=Ac(b);0<f&&(d=parseInt(b.slice(f+1))>>>0,e=b.slice(0,f));if((e=a.$d[e])&&d<e[0]&&(d+=e[1],c[d]=c[d]||r.getUniformLocation(a,b)))return d}else V(1281);return-1},Ab:function(a,b,c){for(var d=vc[b],e=0;e<b;e++)d[e]=C[c+4*e>>2];r.invalidateFramebuffer(a,d)},zb:function(a,b,c,d,e,f,l){for(var k=vc[b],n=0;n<b;n++)k[n]=C[c+4*n>>2];r.invalidateSubFramebuffer(a,k,d,e,f,l)},Gb:function(a){return r.isSync(nc[a])},ba:function(a){return(a=kc[a])?
135
+ r.isTexture(a):0},aa:function(a){r.lineWidth(a)},$:function(a){a=T[a];r.linkProgram(a);a.yd=0;a.$d={}},bc:function(a,b,c,d,e,f){r.Xd.multiDrawArraysInstancedBaseInstanceWEBGL(a,C,b>>2,C,c>>2,C,d>>2,F,e>>2,f)},ac:function(a,b,c,d,e,f,l,k){r.Xd.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(a,C,b>>2,c,C,d>>2,C,e>>2,C,f>>2,F,l>>2,k)},_:function(a,b){r.pixelStorei(a,b)},cc:function(a){r.readBuffer(a)},Z:function(a,b,c,d,e,f,l){if(r.Ld)r.readPixels(a,b,c,d,e,f,l);else{var k=Bc(f);r.readPixels(a,
136
+ b,c,d,e,f,k,l>>31-Math.clz32(k.BYTES_PER_ELEMENT))}},Lb:function(a,b,c,d){r.renderbufferStorage(a,b,c,d)},Jb:function(a,b,c,d,e){r.renderbufferStorageMultisample(a,b,c,d,e)},Cb:function(a,b,c){r.samplerParameteri(mc[a],b,c)},Bb:function(a,b,c){r.samplerParameteri(mc[a],b,C[c>>2])},Y:function(a,b,c,d){r.scissor(a,b,c,d)},X:function(a,b,c,d){for(var e="",f=0;f<b;++f){var l=d?C[d+4*f>>2]:-1;e+=xa(C[c+4*f>>2],0>l?void 0:l)}r.shaderSource(U[a],e)},W:function(a,b,c){r.stencilFunc(a,b,c)},V:function(a,b,
137
+ c,d){r.stencilFuncSeparate(a,b,c,d)},T:function(a){r.stencilMask(a)},S:function(a,b){r.stencilMaskSeparate(a,b)},R:function(a,b,c){r.stencilOp(a,b,c)},Q:function(a,b,c,d){r.stencilOpSeparate(a,b,c,d)},P:function(a,b,c,d,e,f,l,k,n){if(r.td)r.texImage2D(a,b,c,d,e,f,l,k,n);else if(n){var p=Bc(k);r.texImage2D(a,b,c,d,e,f,l,k,p,n>>31-Math.clz32(p.BYTES_PER_ELEMENT))}else r.texImage2D(a,b,c,d,e,f,l,k,null)},O:function(a,b,c){r.texParameterf(a,b,c)},N:function(a,b,c){r.texParameterf(a,b,G[c>>2])},M:function(a,
138
+ b,c){r.texParameteri(a,b,c)},L:function(a,b,c){r.texParameteri(a,b,C[c>>2])},_b:function(a,b,c,d,e){r.texStorage2D(a,b,c,d,e)},K:function(a,b,c,d,e,f,l,k,n){if(r.td)r.texSubImage2D(a,b,c,d,e,f,l,k,n);else if(n){var p=Bc(k);r.texSubImage2D(a,b,c,d,e,f,l,k,p,n>>31-Math.clz32(p.BYTES_PER_ELEMENT))}else r.texSubImage2D(a,b,c,d,e,f,l,k,null)},I:function(a,b){r.uniform1f(W(a),b)},H:function(a,b,c){r.uniform1fv(W(a),G,c>>2,b)},G:function(a,b){r.uniform1i(W(a),b)},F:function(a,b,c){r.uniform1iv(W(a),C,c>>
139
+ 2,b)},E:function(a,b,c){r.uniform2f(W(a),b,c)},D:function(a,b,c){r.uniform2fv(W(a),G,c>>2,2*b)},C:function(a,b,c){r.uniform2i(W(a),b,c)},B:function(a,b,c){r.uniform2iv(W(a),C,c>>2,2*b)},A:function(a,b,c,d){r.uniform3f(W(a),b,c,d)},z:function(a,b,c){r.uniform3fv(W(a),G,c>>2,3*b)},Dc:function(a,b,c,d){r.uniform3i(W(a),b,c,d)},Cc:function(a,b,c){r.uniform3iv(W(a),C,c>>2,3*b)},Bc:function(a,b,c,d,e){r.uniform4f(W(a),b,c,d,e)},Ac:function(a,b,c){r.uniform4fv(W(a),G,c>>2,4*b)},zc:function(a,b,c,d,e){r.uniform4i(W(a),
140
+ b,c,d,e)},yc:function(a,b,c){r.uniform4iv(W(a),C,c>>2,4*b)},xc:function(a,b,c,d){r.uniformMatrix2fv(W(a),!!c,G,d>>2,4*b)},wc:function(a,b,c,d){r.uniformMatrix3fv(W(a),!!c,G,d>>2,9*b)},vc:function(a,b,c,d){r.uniformMatrix4fv(W(a),!!c,G,d>>2,16*b)},uc:function(a){a=T[a];r.useProgram(a);r.ee=a},tc:function(a,b){r.vertexAttrib1f(a,b)},sc:function(a,b){r.vertexAttrib2f(a,G[b>>2],G[b+4>>2])},rc:function(a,b){r.vertexAttrib3f(a,G[b>>2],G[b+4>>2],G[b+8>>2])},qc:function(a,b){r.vertexAttrib4f(a,G[b>>2],G[b+
141
+ 4>>2],G[b+8>>2],G[b+12>>2])},Zb:function(a,b){r.vertexAttribDivisor(a,b)},Yb:function(a,b,c,d,e){r.vertexAttribIPointer(a,b,c,d,e)},pc:function(a,b,c,d,e,f){r.vertexAttribPointer(a,b,c,!!d,e,f)},oc:function(a,b,c,d){r.viewport(a,b,c,d)},ab:function(a,b,c,d){r.waitSync(nc[a],b,(c>>>0)+4294967296*d)},t:function(a){var b=A.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{ta.grow(Math.min(2147483648,
142
+ d)-Ja.byteLength+65535>>>16);La();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},qb:function(a,b){var c=0;Dc().forEach(function(d,e){var f=b+c;e=C[a+4*e>>2]=f;for(f=0;f<d.length;++f)E[e++>>0]=d.charCodeAt(f);E[e>>0]=0;c+=d.length+1});return 0},rb:function(a,b){var c=Dc();C[a>>2]=c.length;var d=0;c.forEach(function(e){d+=e.length+1});C[b>>2]=d;return 0},ub:function(){return 0},eb:function(){},tb:function(a,b,c,d){for(var e=0,f=0;f<c;f++){var l=C[b>>2],k=C[b+4>>2];b+=8;for(var n=0;n<k;n++){var p=
143
+ A[l+n],q=Fc[a];0===p||10===p?((1===a?qa:z)(wa(q,0)),q.length=0):q.push(p)}e+=k}C[d>>2]=e;return 0},b:function(){return ra},db:function(a,b){xc(a,b)},n:Rc,h:Sc,o:Tc,r:Uc,hb:Vc,jb:Wc,q:Xc,j:Yc,d:Zc,p:$c,i:ad,kb:bd,gb:cd,lb:dd,c:function(a){ra=a},pb:function(a,b,c,d){return Lc(a,b,c,d)}};
144
+ (function(){function a(e){g.asm=e.exports;ta=g.asm.Gc;La();Ma=g.asm.Qc;Oa.unshift(g.asm.Hc);Ra--;g.monitorRunDependencies&&g.monitorRunDependencies(Ra);0==Ra&&(null!==Sa&&(clearInterval(Sa),Sa=null),Ta&&(e=Ta,Ta=null,e()))}function b(e){a(e.instance)}function c(e){return Xa().then(function(f){return WebAssembly.instantiate(f,d)}).then(function(f){return f}).then(e,function(f){z("failed to asynchronously prepare wasm: "+f);pa(f)})}var d={a:ed};Ra++;g.monitorRunDependencies&&g.monitorRunDependencies(Ra);
145
+ if(g.instantiateWasm)try{return g.instantiateWasm(d,a)}catch(e){return z("Module.instantiateWasm callback failed with error: "+e),!1}(function(){return sa||"function"!==typeof WebAssembly.instantiateStreaming||Ua()||H.startsWith("file://")||"function"!==typeof fetch?c(b):fetch(H,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(f){z("wasm streaming compile failed: "+f);z("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);
146
+ return{}})();g.___wasm_call_ctors=function(){return(g.___wasm_call_ctors=g.asm.Hc).apply(null,arguments)};var zc=g._malloc=function(){return(zc=g._malloc=g.asm.Ic).apply(null,arguments)},Qc=g.___errno_location=function(){return(Qc=g.___errno_location=g.asm.Jc).apply(null,arguments)},Q=g._free=function(){return(Q=g._free=g.asm.Kc).apply(null,arguments)},Nb=g.___getTypeName=function(){return(Nb=g.___getTypeName=g.asm.Lc).apply(null,arguments)};
147
+ g.___embind_register_native_and_builtin_types=function(){return(g.___embind_register_native_and_builtin_types=g.asm.Mc).apply(null,arguments)};var X=g.stackSave=function(){return(X=g.stackSave=g.asm.Nc).apply(null,arguments)},Y=g.stackRestore=function(){return(Y=g.stackRestore=g.asm.Oc).apply(null,arguments)},Z=g._setThrew=function(){return(Z=g._setThrew=g.asm.Pc).apply(null,arguments)};g.dynCall_iiiij=function(){return(g.dynCall_iiiij=g.asm.Rc).apply(null,arguments)};
148
+ g.dynCall_viiij=function(){return(g.dynCall_viiij=g.asm.Sc).apply(null,arguments)};g.dynCall_iiij=function(){return(g.dynCall_iiij=g.asm.Tc).apply(null,arguments)};g.dynCall_viij=function(){return(g.dynCall_viij=g.asm.Uc).apply(null,arguments)};g.dynCall_viiiiij=function(){return(g.dynCall_viiiiij=g.asm.Vc).apply(null,arguments)};g.dynCall_jii=function(){return(g.dynCall_jii=g.asm.Wc).apply(null,arguments)};g.dynCall_viji=function(){return(g.dynCall_viji=g.asm.Xc).apply(null,arguments)};
149
+ g.dynCall_ji=function(){return(g.dynCall_ji=g.asm.Yc).apply(null,arguments)};g.dynCall_iij=function(){return(g.dynCall_iij=g.asm.Zc).apply(null,arguments)};g.dynCall_vij=function(){return(g.dynCall_vij=g.asm._c).apply(null,arguments)};g.dynCall_jiji=function(){return(g.dynCall_jiji=g.asm.$c).apply(null,arguments)};g.dynCall_iiiiij=function(){return(g.dynCall_iiiiij=g.asm.ad).apply(null,arguments)};g.dynCall_iiiiijj=function(){return(g.dynCall_iiiiijj=g.asm.bd).apply(null,arguments)};
150
+ g.dynCall_iiiiiijj=function(){return(g.dynCall_iiiiiijj=g.asm.cd).apply(null,arguments)};g.dynCall_viijii=function(){return(g.dynCall_viijii=g.asm.dd).apply(null,arguments)};function Zc(a,b,c){var d=X();try{I(a)(b,c)}catch(e){Y(d);if(e!==e+0&&"longjmp"!==e)throw e;Z(1,0)}}function Tc(a,b,c,d){var e=X();try{return I(a)(b,c,d)}catch(f){Y(e);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}}function ad(a,b,c,d,e){var f=X();try{I(a)(b,c,d,e)}catch(l){Y(f);if(l!==l+0&&"longjmp"!==l)throw l;Z(1,0)}}
151
+ function Yc(a,b){var c=X();try{I(a)(b)}catch(d){Y(c);if(d!==d+0&&"longjmp"!==d)throw d;Z(1,0)}}function Sc(a,b,c){var d=X();try{return I(a)(b,c)}catch(e){Y(d);if(e!==e+0&&"longjmp"!==e)throw e;Z(1,0)}}function Uc(a,b,c,d,e){var f=X();try{return I(a)(b,c,d,e)}catch(l){Y(f);if(l!==l+0&&"longjmp"!==l)throw l;Z(1,0)}}function Rc(a,b){var c=X();try{return I(a)(b)}catch(d){Y(c);if(d!==d+0&&"longjmp"!==d)throw d;Z(1,0)}}
152
+ function Xc(a){var b=X();try{I(a)()}catch(c){Y(b);if(c!==c+0&&"longjmp"!==c)throw c;Z(1,0)}}function dd(a,b,c,d,e,f,l,k,n){var p=X();try{I(a)(b,c,d,e,f,l,k,n)}catch(q){Y(p);if(q!==q+0&&"longjmp"!==q)throw q;Z(1,0)}}function $c(a,b,c,d){var e=X();try{I(a)(b,c,d)}catch(f){Y(e);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}}function bd(a,b,c,d,e,f){var l=X();try{I(a)(b,c,d,e,f)}catch(k){Y(l);if(k!==k+0&&"longjmp"!==k)throw k;Z(1,0)}}
153
+ function Wc(a,b,c,d,e,f,l){var k=X();try{return I(a)(b,c,d,e,f,l)}catch(n){Y(k);if(n!==n+0&&"longjmp"!==n)throw n;Z(1,0)}}function Vc(a,b,c,d,e,f){var l=X();try{return I(a)(b,c,d,e,f)}catch(k){Y(l);if(k!==k+0&&"longjmp"!==k)throw k;Z(1,0)}}function cd(a,b,c,d,e,f,l){var k=X();try{I(a)(b,c,d,e,f,l)}catch(n){Y(k);if(n!==n+0&&"longjmp"!==n)throw n;Z(1,0)}}var fd;Ta=function gd(){fd||hd();fd||(Ta=gd)};
154
+ function hd(){function a(){if(!fd&&(fd=!0,g.calledRun=!0,!ua)){Ya(Oa);aa(g);if(g.onRuntimeInitialized)g.onRuntimeInitialized();if(g.postRun)for("function"==typeof g.postRun&&(g.postRun=[g.postRun]);g.postRun.length;){var b=g.postRun.shift();Pa.unshift(b)}Ya(Pa)}}if(!(0<Ra)){if(g.preRun)for("function"==typeof g.preRun&&(g.preRun=[g.preRun]);g.preRun.length;)Qa();Ya(Na);0<Ra||(g.setStatus?(g.setStatus("Running..."),setTimeout(function(){setTimeout(function(){g.setStatus("")},1);a()},1)):a())}}
155
+ g.run=hd;if(g.preInit)for("function"==typeof g.preInit&&(g.preInit=[g.preInit]);0<g.preInit.length;)g.preInit.pop()();hd();
156
+
157
+
158
+ return Rive.ready
159
+ }
160
+ );
161
+ })();
162
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
163
+
164
+ /***/ }),
165
+ /* 2 */
166
+ /***/ ((module) => {
167
+
168
+ module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"1.0.8","description":"Rive\'s webgl 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.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
169
+
170
+ /***/ })
171
+ /******/ ]);
172
+ /************************************************************************/
173
+ /******/ // The module cache
174
+ /******/ var __webpack_module_cache__ = {};
175
+ /******/
176
+ /******/ // The require function
177
+ /******/ function __webpack_require__(moduleId) {
178
+ /******/ // Check if module is in cache
179
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
180
+ /******/ if (cachedModule !== undefined) {
181
+ /******/ return cachedModule.exports;
182
+ /******/ }
183
+ /******/ // Create a new module (and put it into the cache)
184
+ /******/ var module = __webpack_module_cache__[moduleId] = {
185
+ /******/ // no module.id needed
186
+ /******/ // no module.loaded needed
187
+ /******/ exports: {}
188
+ /******/ };
189
+ /******/
190
+ /******/ // Execute the module function
191
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
192
+ /******/
193
+ /******/ // Return the exports of the module
194
+ /******/ return module.exports;
195
+ /******/ }
196
+ /******/
197
+ /************************************************************************/
198
+ /******/ /* webpack/runtime/define property getters */
199
+ /******/ (() => {
200
+ /******/ // define getter functions for harmony exports
201
+ /******/ __webpack_require__.d = (exports, definition) => {
202
+ /******/ for(var key in definition) {
203
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
204
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
205
+ /******/ }
206
+ /******/ }
207
+ /******/ };
208
+ /******/ })();
209
+ /******/
210
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
211
+ /******/ (() => {
212
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
213
+ /******/ })();
214
+ /******/
215
+ /******/ /* webpack/runtime/make namespace object */
216
+ /******/ (() => {
217
+ /******/ // define __esModule on exports
218
+ /******/ __webpack_require__.r = (exports) => {
219
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
220
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
221
+ /******/ }
222
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
223
+ /******/ };
224
+ /******/ })();
225
+ /******/
226
+ /************************************************************************/
227
+ var __webpack_exports__ = {};
228
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
229
+ (() => {
230
+ __webpack_require__.r(__webpack_exports__);
231
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
232
+ /* harmony export */ "Fit": () => (/* binding */ Fit),
233
+ /* harmony export */ "Alignment": () => (/* binding */ Alignment),
234
+ /* harmony export */ "Layout": () => (/* binding */ Layout),
235
+ /* harmony export */ "RuntimeLoader": () => (/* binding */ RuntimeLoader),
236
+ /* harmony export */ "StateMachineInputType": () => (/* binding */ StateMachineInputType),
237
+ /* harmony export */ "StateMachineInput": () => (/* binding */ StateMachineInput),
238
+ /* harmony export */ "EventType": () => (/* binding */ EventType),
239
+ /* harmony export */ "LoopType": () => (/* binding */ LoopType),
240
+ /* harmony export */ "Rive": () => (/* binding */ Rive),
241
+ /* harmony export */ "Testing": () => (/* binding */ Testing)
242
+ /* harmony export */ });
243
+ /* harmony import */ var _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
244
+ /* harmony import */ var package_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
245
+ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
246
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
247
+ return new (P || (P = Promise))(function (resolve, reject) {
248
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
249
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
250
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
251
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
252
+ });
253
+ };
254
+ var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
255
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
256
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
257
+ function verb(n) { return function (v) { return step([n, v]); }; }
258
+ function step(op) {
259
+ if (f) throw new TypeError("Generator is already executing.");
260
+ while (_) try {
261
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
262
+ if (y = 0, t) op = [op[0] & 2, t.value];
263
+ switch (op[0]) {
264
+ case 0: case 1: t = op; break;
265
+ case 4: _.label++; return { value: op[1], done: false };
266
+ case 5: _.label++; y = op[1]; op = [0]; continue;
267
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
268
+ default:
269
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
270
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
271
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
272
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
273
+ if (t[2]) _.ops.pop();
274
+ _.trys.pop(); continue;
275
+ }
276
+ op = body.call(thisArg, _);
277
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
278
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
279
+ }
280
+ };
281
+
282
+
283
+ // Tracks playback states; numbers map to the runtime's numerical values
284
+ // i.e. play: 0, pause: 1, stop: 2
285
+ var PlaybackState;
286
+ (function (PlaybackState) {
287
+ PlaybackState[PlaybackState["Play"] = 0] = "Play";
288
+ PlaybackState[PlaybackState["Pause"] = 1] = "Pause";
289
+ PlaybackState[PlaybackState["Stop"] = 2] = "Stop";
290
+ })(PlaybackState || (PlaybackState = {}));
291
+ // #region layout
292
+ // Fit options for the canvas
293
+ var Fit;
294
+ (function (Fit) {
295
+ Fit["Cover"] = "cover";
296
+ Fit["Contain"] = "contain";
297
+ Fit["Fill"] = "fill";
298
+ Fit["FitWidth"] = "fitWidth";
299
+ Fit["FitHeight"] = "fitHeight";
300
+ Fit["None"] = "none";
301
+ Fit["ScaleDown"] = "scaleDown";
302
+ })(Fit || (Fit = {}));
303
+ // Alignment options for the canvas
304
+ var Alignment;
305
+ (function (Alignment) {
306
+ Alignment["Center"] = "center";
307
+ Alignment["TopLeft"] = "topLeft";
308
+ Alignment["TopCenter"] = "topCenter";
309
+ Alignment["TopRight"] = "topRight";
310
+ Alignment["CenterLeft"] = "centerLeft";
311
+ Alignment["CenterRight"] = "centerRight";
312
+ Alignment["BottomLeft"] = "bottomLeft";
313
+ Alignment["BottomCenter"] = "bottomCenter";
314
+ Alignment["BottomRight"] = "bottomRight";
315
+ })(Alignment || (Alignment = {}));
316
+ // Alignment options for Rive animations in a HTML canvas
317
+ var Layout = /** @class */ (function () {
318
+ function Layout(params) {
319
+ var _a, _b, _c, _d, _e, _f;
320
+ this.fit = (_a = params === null || params === void 0 ? void 0 : params.fit) !== null && _a !== void 0 ? _a : Fit.Contain;
321
+ this.alignment = (_b = params === null || params === void 0 ? void 0 : params.alignment) !== null && _b !== void 0 ? _b : Alignment.Center;
322
+ this.minX = (_c = params === null || params === void 0 ? void 0 : params.minX) !== null && _c !== void 0 ? _c : 0;
323
+ this.minY = (_d = params === null || params === void 0 ? void 0 : params.minY) !== null && _d !== void 0 ? _d : 0;
324
+ this.maxX = (_e = params === null || params === void 0 ? void 0 : params.maxX) !== null && _e !== void 0 ? _e : 0;
325
+ this.maxY = (_f = params === null || params === void 0 ? void 0 : params.maxY) !== null && _f !== void 0 ? _f : 0;
326
+ }
327
+ // Alternative constructor to build a Layout from an interface/object
328
+ Layout.new = function (_a) {
329
+ var fit = _a.fit, alignment = _a.alignment, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY;
330
+ console.warn('This function is deprecated: please use `new Layout({})` instead');
331
+ return new Layout({ fit: fit, alignment: alignment, minX: minX, minY: minY, maxX: maxX, maxY: maxY });
332
+ };
333
+ /**
334
+ * Makes a copy of the layout, replacing any specified parameters
335
+ */
336
+ Layout.prototype.copyWith = function (_a) {
337
+ var fit = _a.fit, alignment = _a.alignment, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY;
338
+ return new Layout({
339
+ fit: fit !== null && fit !== void 0 ? fit : this.fit,
340
+ alignment: alignment !== null && alignment !== void 0 ? alignment : this.alignment,
341
+ minX: minX !== null && minX !== void 0 ? minX : this.minX,
342
+ minY: minY !== null && minY !== void 0 ? minY : this.minY,
343
+ maxX: maxX !== null && maxX !== void 0 ? maxX : this.maxX,
344
+ maxY: maxY !== null && maxY !== void 0 ? maxY : this.maxY
345
+ });
346
+ };
347
+ // Returns fit for the Wasm runtime format
348
+ Layout.prototype.runtimeFit = function (rive) {
349
+ if (this.cachedRuntimeFit)
350
+ return this.cachedRuntimeFit;
351
+ var fit;
352
+ if (this.fit === Fit.Cover)
353
+ fit = rive.Fit.cover;
354
+ else if (this.fit === Fit.Contain)
355
+ fit = rive.Fit.contain;
356
+ else if (this.fit === Fit.Fill)
357
+ fit = rive.Fit.fill;
358
+ else if (this.fit === Fit.FitWidth)
359
+ fit = rive.Fit.fitWidth;
360
+ else if (this.fit === Fit.FitHeight)
361
+ fit = rive.Fit.fitHeight;
362
+ else if (this.fit === Fit.ScaleDown)
363
+ fit = rive.Fit.scaleDown;
364
+ else
365
+ fit = rive.Fit.none;
366
+ this.cachedRuntimeFit = fit;
367
+ return fit;
368
+ };
369
+ // Returns alignment for the Wasm runtime format
370
+ Layout.prototype.runtimeAlignment = function (rive) {
371
+ if (this.cachedRuntimeAlignment)
372
+ return this.cachedRuntimeAlignment;
373
+ var alignment;
374
+ if (this.alignment === Alignment.TopLeft)
375
+ alignment = rive.Alignment.topLeft;
376
+ else if (this.alignment === Alignment.TopCenter)
377
+ alignment = rive.Alignment.topCenter;
378
+ else if (this.alignment === Alignment.TopRight)
379
+ alignment = rive.Alignment.topRight;
380
+ else if (this.alignment === Alignment.CenterLeft)
381
+ alignment = rive.Alignment.centerLeft;
382
+ else if (this.alignment === Alignment.CenterRight)
383
+ alignment = rive.Alignment.centerRight;
384
+ else if (this.alignment === Alignment.BottomLeft)
385
+ alignment = rive.Alignment.bottomLeft;
386
+ else if (this.alignment === Alignment.BottomCenter)
387
+ alignment = rive.Alignment.bottomCenter;
388
+ else if (this.alignment === Alignment.BottomRight)
389
+ alignment = rive.Alignment.bottomRight;
390
+ else
391
+ alignment = rive.Alignment.center;
392
+ this.cachedRuntimeAlignment = alignment;
393
+ return alignment;
394
+ };
395
+ return Layout;
396
+ }());
397
+
398
+ // Runtime singleton; use getInstance to provide a callback that returns the
399
+ // Rive runtime
400
+ var RuntimeLoader = /** @class */ (function () {
401
+ // Class is never instantiated
402
+ function RuntimeLoader() {
403
+ }
404
+ // Loads the runtime
405
+ RuntimeLoader.loadRuntime = function () {
406
+ _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__.default({
407
+ // Loads Wasm bundle
408
+ locateFile: function (_) { return RuntimeLoader.wasmURL; }
409
+ }).then(function (rive) {
410
+ var _a;
411
+ RuntimeLoader.runtime = rive;
412
+ // Fire all the callbacks
413
+ while (RuntimeLoader.callBackQueue.length > 0) {
414
+ (_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime);
415
+ }
416
+ });
417
+ };
418
+ // Provides a runtime instance via a callback
419
+ RuntimeLoader.getInstance = function (callback) {
420
+ // If it's not loading, start loading runtime
421
+ if (!RuntimeLoader.isLoading) {
422
+ RuntimeLoader.isLoading = true;
423
+ RuntimeLoader.loadRuntime();
424
+ }
425
+ if (!RuntimeLoader.runtime) {
426
+ RuntimeLoader.callBackQueue.push(callback);
427
+ }
428
+ else {
429
+ callback(RuntimeLoader.runtime);
430
+ }
431
+ };
432
+ // Provides a runtime instance via a promise
433
+ RuntimeLoader.awaitInstance = function () {
434
+ return new Promise(function (resolve, reject) {
435
+ return RuntimeLoader.getInstance(function (rive) { return resolve(rive); });
436
+ });
437
+ };
438
+ // Manually sets the wasm url
439
+ RuntimeLoader.setWasmUrl = function (url) {
440
+ RuntimeLoader.wasmURL = url;
441
+ };
442
+ // Flag to indicate that loading has started/completed
443
+ RuntimeLoader.isLoading = false;
444
+ // List of callbacks for the runtime that come in while loading
445
+ RuntimeLoader.callBackQueue = [];
446
+ // Path to the Wasm file; default path works for testing only;
447
+ // if embedded wasm is used then this is never used.
448
+ RuntimeLoader.wasmURL = "https://unpkg.com/" + package_json__WEBPACK_IMPORTED_MODULE_1__.name + "@" + package_json__WEBPACK_IMPORTED_MODULE_1__.version + "/rive.wasm";
449
+ return RuntimeLoader;
450
+ }());
451
+
452
+ // #endregion
453
+ // #region animations
454
+ // Wraps animations and instances from the runtime and keeps track of playback
455
+ // state
456
+ var Animation = /** @class */ (function () {
457
+ /**
458
+ * Constructs a new animation
459
+ * @constructor
460
+ * @param {any} animation: runtime animation object
461
+ * @param {any} instance: runtime animation instance object
462
+ */
463
+ function Animation(animation, runtime, playing) {
464
+ this.animation = animation;
465
+ this.playing = playing;
466
+ this.loopCount = 0;
467
+ // Time to which the animation should move to on the next render
468
+ this.scrubTo = null;
469
+ this.instance = new runtime.LinearAnimationInstance(animation);
470
+ }
471
+ Object.defineProperty(Animation.prototype, "name", {
472
+ // Returns the animation's name
473
+ get: function () {
474
+ return this.animation.name;
475
+ },
476
+ enumerable: false,
477
+ configurable: true
478
+ });
479
+ Object.defineProperty(Animation.prototype, "time", {
480
+ // Returns the animation's current time
481
+ get: function () {
482
+ return this.instance.time;
483
+ },
484
+ // Sets the animation's current time
485
+ set: function (value) {
486
+ this.instance.time = value;
487
+ },
488
+ enumerable: false,
489
+ configurable: true
490
+ });
491
+ Object.defineProperty(Animation.prototype, "loopValue", {
492
+ // Returns the animation's loop type
493
+ get: function () {
494
+ return this.animation.loopValue;
495
+ },
496
+ enumerable: false,
497
+ configurable: true
498
+ });
499
+ /**
500
+ * Advances the animation by the give time. If the animation needs scrubbing,
501
+ * time is ignored and the stored scrub value is used.
502
+ * @param time the time to advance the animation by if no scrubbing required
503
+ */
504
+ Animation.prototype.advance = function (time) {
505
+ if (this.scrubTo === null) {
506
+ this.instance.advance(time);
507
+ }
508
+ else {
509
+ this.instance.time = 0;
510
+ this.instance.advance(this.scrubTo);
511
+ this.scrubTo = null;
512
+ }
513
+ };
514
+ Object.defineProperty(Animation.prototype, "needsScrub", {
515
+ get: function () {
516
+ return this.scrubTo !== null;
517
+ },
518
+ enumerable: false,
519
+ configurable: true
520
+ });
521
+ /**
522
+ * Deletes the backing Wasm animation instance; once this is called, this
523
+ * animation is no more.
524
+ */
525
+ Animation.prototype.cleanup = function () {
526
+ this.instance.delete();
527
+ };
528
+ return Animation;
529
+ }());
530
+ // #endregion
531
+ // #region state machines
532
+ var StateMachineInputType;
533
+ (function (StateMachineInputType) {
534
+ StateMachineInputType[StateMachineInputType["Number"] = 56] = "Number";
535
+ StateMachineInputType[StateMachineInputType["Trigger"] = 58] = "Trigger";
536
+ StateMachineInputType[StateMachineInputType["Boolean"] = 59] = "Boolean";
537
+ })(StateMachineInputType || (StateMachineInputType = {}));
538
+ /**
539
+ * An input for a state machine
540
+ */
541
+ var StateMachineInput = /** @class */ (function () {
542
+ function StateMachineInput(type, runtimeInput) {
543
+ this.type = type;
544
+ this.runtimeInput = runtimeInput;
545
+ }
546
+ Object.defineProperty(StateMachineInput.prototype, "name", {
547
+ /**
548
+ * Returns the name of the input
549
+ */
550
+ get: function () {
551
+ return this.runtimeInput.name;
552
+ },
553
+ enumerable: false,
554
+ configurable: true
555
+ });
556
+ Object.defineProperty(StateMachineInput.prototype, "value", {
557
+ /**
558
+ * Returns the current value of the input
559
+ */
560
+ get: function () {
561
+ return this.runtimeInput.value;
562
+ },
563
+ /**
564
+ * Sets the value of the input
565
+ */
566
+ set: function (value) {
567
+ this.runtimeInput.value = value;
568
+ },
569
+ enumerable: false,
570
+ configurable: true
571
+ });
572
+ /**
573
+ * Fires a trigger; does nothing on Number or Boolean input types
574
+ */
575
+ StateMachineInput.prototype.fire = function () {
576
+ if (this.type === StateMachineInputType.Trigger) {
577
+ this.runtimeInput.fire();
578
+ }
579
+ };
580
+ return StateMachineInput;
581
+ }());
582
+
583
+ var StateMachine = /** @class */ (function () {
584
+ /**
585
+ * @constructor
586
+ * @param stateMachine runtime state machine object
587
+ * @param instance runtime state machine instance object
588
+ */
589
+ function StateMachine(stateMachine, runtime, playing) {
590
+ this.stateMachine = stateMachine;
591
+ this.playing = playing;
592
+ /**
593
+ * Caches the inputs from the runtime
594
+ */
595
+ this.inputs = [];
596
+ this.instance = new runtime.StateMachineInstance(stateMachine);
597
+ this.initInputs(runtime);
598
+ }
599
+ Object.defineProperty(StateMachine.prototype, "name", {
600
+ get: function () {
601
+ return this.stateMachine.name;
602
+ },
603
+ enumerable: false,
604
+ configurable: true
605
+ });
606
+ Object.defineProperty(StateMachine.prototype, "statesChanged", {
607
+ /**
608
+ * Returns a list of state names that have changed on this frame
609
+ */
610
+ get: function () {
611
+ var names = [];
612
+ for (var i = 0; i < this.instance.stateChangedCount(); i++) {
613
+ names.push(this.instance.stateChangedNameByIndex(i));
614
+ }
615
+ return names;
616
+ },
617
+ enumerable: false,
618
+ configurable: true
619
+ });
620
+ /**
621
+ * Fetches references to the state machine's inputs and caches them
622
+ * @param runtime an instance of the runtime; needed for the SMIInput types
623
+ */
624
+ StateMachine.prototype.initInputs = function (runtime) {
625
+ // Fetch the inputs from the runtime if we don't have them
626
+ for (var i = 0; i < this.instance.inputCount(); i++) {
627
+ var input = this.instance.input(i);
628
+ this.inputs.push(this.mapRuntimeInput(input, runtime));
629
+ }
630
+ };
631
+ /**
632
+ * Maps a runtime input to it's appropriate type
633
+ * @param input
634
+ */
635
+ StateMachine.prototype.mapRuntimeInput = function (input, runtime) {
636
+ if (input.type === runtime.SMIInput.bool) {
637
+ return new StateMachineInput(StateMachineInputType.Boolean, input.asBool());
638
+ }
639
+ else if (input.type === runtime.SMIInput.number) {
640
+ return new StateMachineInput(StateMachineInputType.Number, input.asNumber());
641
+ }
642
+ else if (input.type === runtime.SMIInput.trigger) {
643
+ return new StateMachineInput(StateMachineInputType.Trigger, input.asTrigger());
644
+ }
645
+ };
646
+ /**
647
+ * Deletes the backing Wasm state machine instance; once this is called, this
648
+ * state machine is no more.
649
+ */
650
+ StateMachine.prototype.cleanup = function () {
651
+ this.instance.delete();
652
+ };
653
+ return StateMachine;
654
+ }());
655
+ // #endregion
656
+ // #region animator
657
+ /**
658
+ * Manages animation
659
+ */
660
+ var Animator = /** @class */ (function () {
661
+ /**
662
+ * Constructs a new animator
663
+ * @constructor
664
+ * @param runtime Rive runtime; needed to instance animations & state machines
665
+ * @param artboard the artboard that holds all animations and state machines
666
+ * @param animations optional list of animations
667
+ * @param stateMachines optional list of state machines
668
+ */
669
+ function Animator(runtime, artboard, eventManager, animations, stateMachines) {
670
+ if (animations === void 0) { animations = []; }
671
+ if (stateMachines === void 0) { stateMachines = []; }
672
+ this.runtime = runtime;
673
+ this.artboard = artboard;
674
+ this.eventManager = eventManager;
675
+ this.animations = animations;
676
+ this.stateMachines = stateMachines;
677
+ }
678
+ /**
679
+ * Adds animations and state machines by their names. If names are shared
680
+ * between animations & state machines, then the first one found will be
681
+ * created. Best not to use the same names for these in your Rive file.
682
+ * @param animatable the name(s) of animations and state machines to add
683
+ * @returns a list of names of the playing animations and state machines
684
+ */
685
+ Animator.prototype.add = function (animatables, playing, fireEvent) {
686
+ if (fireEvent === void 0) { fireEvent = true; }
687
+ animatables = mapToStringArray(animatables);
688
+ // If animatables is empty, play or pause everything
689
+ if (animatables.length === 0) {
690
+ this.animations.forEach(function (a) { return a.playing = playing; });
691
+ this.stateMachines.forEach(function (m) { return m.playing = playing; });
692
+ }
693
+ else {
694
+ // Play/pause already instanced items, or create new instances
695
+ var instancedAnimationNames = this.animations.map(function (a) { return a.name; });
696
+ var instancedMachineNames = this.stateMachines.map(function (m) { return m.name; });
697
+ for (var i in animatables) {
698
+ var aIndex = instancedAnimationNames.indexOf(animatables[i]);
699
+ var mIndex = instancedMachineNames.indexOf(animatables[i]);
700
+ if (aIndex >= 0 || mIndex >= 0) {
701
+ if (aIndex >= 0) {
702
+ // Animation is instanced, play/pause it
703
+ this.animations[aIndex].playing = playing;
704
+ }
705
+ else {
706
+ // State machine is instanced, play/pause it
707
+ this.stateMachines[mIndex].playing = playing;
708
+ }
709
+ }
710
+ else {
711
+ // Try to create a new animation instance
712
+ var anim = this.artboard.animationByName(animatables[i]);
713
+ if (anim) {
714
+ this.animations.push(new Animation(anim, this.runtime, playing));
715
+ }
716
+ else {
717
+ // Try to create a new state machine instance
718
+ var sm = this.artboard.stateMachineByName(animatables[i]);
719
+ if (sm) {
720
+ this.stateMachines.push(new StateMachine(sm, this.runtime, playing));
721
+ }
722
+ }
723
+ }
724
+ }
725
+ }
726
+ // Fire play/paused events for animations
727
+ if (fireEvent) {
728
+ if (playing) {
729
+ this.eventManager.fire({
730
+ type: EventType.Play,
731
+ data: this.playing,
732
+ });
733
+ }
734
+ else {
735
+ this.eventManager.fire({
736
+ type: EventType.Pause,
737
+ data: this.paused,
738
+ });
739
+ }
740
+ }
741
+ return playing ? this.playing : this.paused;
742
+ };
743
+ /**
744
+ * Play the named animations/state machines
745
+ * @param animatables the names of the animations/machines to play; plays all if empty
746
+ * @returns a list of the playing items
747
+ */
748
+ Animator.prototype.play = function (animatables) {
749
+ return this.add(animatables, true);
750
+ };
751
+ /**
752
+ * Pauses named animations and state machines, or everything if nothing is
753
+ * specified
754
+ * @param animatables names of the animations and state machines to pause
755
+ * @returns a list of names of the animations and state machines paused
756
+ */
757
+ Animator.prototype.pause = function (animatables) {
758
+ return this.add(animatables, false);
759
+ };
760
+ /**
761
+ * Set time of named animations
762
+ * @param animations names of the animations to scrub
763
+ * @param value time scrub value, a floating point number to which the playhead is jumped
764
+ * @returns a list of names of the animations that were scrubbed
765
+ */
766
+ Animator.prototype.scrub = function (animatables, value) {
767
+ var forScrubbing = this.animations.filter(function (a) { return animatables.includes(a.name); });
768
+ forScrubbing.forEach(function (a) { return a.scrubTo = value; });
769
+ return forScrubbing.map(function (a) { return a.name; });
770
+ };
771
+ Object.defineProperty(Animator.prototype, "playing", {
772
+ /**
773
+ * Returns a list of names of all animations and state machines currently
774
+ * playing
775
+ */
776
+ get: function () {
777
+ return this.animations.filter(function (a) { return a.playing; }).map(function (a) { return a.name; }).concat(this.stateMachines.filter(function (m) { return m.playing; }).map(function (m) { return m.name; }));
778
+ },
779
+ enumerable: false,
780
+ configurable: true
781
+ });
782
+ Object.defineProperty(Animator.prototype, "paused", {
783
+ /**
784
+ * Returns a list of names of all animations and state machines currently
785
+ * paused
786
+ */
787
+ get: function () {
788
+ return this.animations.filter(function (a) { return !a.playing; }).map(function (a) { return a.name; }).concat(this.stateMachines.filter(function (m) { return !m.playing; }).map(function (m) { return m.name; }));
789
+ },
790
+ enumerable: false,
791
+ configurable: true
792
+ });
793
+ /**
794
+ * Stops and removes all named animations and state machines
795
+ * @param animatables animations and state machines to remove
796
+ * @returns a list of names of removed items
797
+ */
798
+ Animator.prototype.stop = function (animatables) {
799
+ var _this = this;
800
+ animatables = mapToStringArray(animatables);
801
+ // If nothing's specified, wipe them out, all of them
802
+ var removedNames = [];
803
+ // Stop everything
804
+ if (animatables.length === 0) {
805
+ removedNames = this.animations.map(function (a) { return a.name; }).concat(this.stateMachines.map(function (m) { return m.name; }));
806
+ // Clean up before emptying the arrays
807
+ this.animations.forEach(function (a) { return a.cleanup(); });
808
+ this.stateMachines.forEach(function (m) { return m.cleanup(); });
809
+ // Empty out the arrays
810
+ this.animations.splice(0, this.animations.length);
811
+ this.stateMachines.splice(0, this.stateMachines.length);
812
+ }
813
+ else {
814
+ // Remove only the named animations/state machines
815
+ var animationsToRemove = this.animations.filter(function (a) { return animatables.includes(a.name); });
816
+ animationsToRemove.forEach(function (a) {
817
+ a.cleanup();
818
+ _this.animations.splice(_this.animations.indexOf(a), 1);
819
+ });
820
+ var machinesToRemove = this.stateMachines.filter(function (m) { return animatables.includes(m.name); });
821
+ machinesToRemove.forEach(function (m) {
822
+ m.cleanup();
823
+ _this.stateMachines.splice(_this.stateMachines.indexOf(m), 1);
824
+ });
825
+ removedNames = animationsToRemove.map(function (a) { return a.name; }).concat(machinesToRemove.map(function (m) { return m.name; }));
826
+ }
827
+ this.eventManager.fire({
828
+ type: EventType.Stop,
829
+ data: removedNames,
830
+ });
831
+ // Return the list of animations removed
832
+ return removedNames;
833
+ };
834
+ Object.defineProperty(Animator.prototype, "isPlaying", {
835
+ /**
836
+ * Returns true if at least one animation is active
837
+ */
838
+ get: function () {
839
+ return this.animations.reduce(function (acc, curr) { return acc || curr.playing; }, false)
840
+ || this.stateMachines.reduce(function (acc, curr) { return acc || curr.playing; }, false);
841
+ },
842
+ enumerable: false,
843
+ configurable: true
844
+ });
845
+ Object.defineProperty(Animator.prototype, "isPaused", {
846
+ /**
847
+ * Returns true if all animations are paused and there's at least one animation
848
+ */
849
+ get: function () {
850
+ return !this.isPlaying &&
851
+ (this.animations.length > 0 || this.stateMachines.length > 0);
852
+ },
853
+ enumerable: false,
854
+ configurable: true
855
+ });
856
+ Object.defineProperty(Animator.prototype, "isStopped", {
857
+ /**
858
+ * Returns true if there are no playing or paused animations/state machines
859
+ */
860
+ get: function () {
861
+ return this.animations.length === 0 && this.stateMachines.length === 0;
862
+ },
863
+ enumerable: false,
864
+ configurable: true
865
+ });
866
+ /**
867
+ * If there are no animations or state machines, add the first one found
868
+ * @returns the name of the animation or state machine instanced
869
+ */
870
+ Animator.prototype.atLeastOne = function (playing, fireEvent) {
871
+ if (fireEvent === void 0) { fireEvent = true; }
872
+ var instancedName;
873
+ if (this.animations.length === 0 && this.stateMachines.length === 0) {
874
+ if (this.artboard.animationCount() > 0) {
875
+ // Add the first animation
876
+ this.add([instancedName = this.artboard.animationByIndex(0).name], playing, fireEvent);
877
+ }
878
+ else if (this.artboard.stateMachineCount() > 0) {
879
+ // Add the first state machine
880
+ this.add([instancedName = this.artboard.stateMachineByIndex(0).name], playing, fireEvent);
881
+ }
882
+ }
883
+ return instancedName;
884
+ };
885
+ /**
886
+ * Checks if any animations have looped and if so, fire the appropriate event
887
+ */
888
+ Animator.prototype.handleLooping = function () {
889
+ for (var _i = 0, _a = this.animations.filter(function (a) { return a.playing; }); _i < _a.length; _i++) {
890
+ var animation = _a[_i];
891
+ // Emit if the animation looped
892
+ if (animation.loopValue === 0 && animation.loopCount) {
893
+ animation.loopCount = 0;
894
+ // This is a one-shot; if it has ended, delete the instance
895
+ this.stop(animation.name);
896
+ }
897
+ else if (animation.loopValue === 1 && animation.loopCount) {
898
+ this.eventManager.fire({
899
+ type: EventType.Loop,
900
+ data: { animation: animation.name, type: LoopType.Loop }
901
+ });
902
+ animation.loopCount = 0;
903
+ }
904
+ // Wasm indicates a loop at each time the animation
905
+ // changes direction, so a full loop/lap occurs every
906
+ // two loop counts
907
+ else if (animation.loopValue === 2 && animation.loopCount > 1) {
908
+ this.eventManager.fire({
909
+ type: EventType.Loop,
910
+ data: { animation: animation.name, type: LoopType.PingPong }
911
+ });
912
+ animation.loopCount = 0;
913
+ }
914
+ }
915
+ };
916
+ /**
917
+ * Checks if states have changed in state machines and fires a statechange
918
+ * event
919
+ */
920
+ Animator.prototype.handleStateChanges = function () {
921
+ var statesChanged = [];
922
+ for (var _i = 0, _a = this.stateMachines.filter(function (sm) { return sm.playing; }); _i < _a.length; _i++) {
923
+ var stateMachine = _a[_i];
924
+ statesChanged.push.apply(statesChanged, stateMachine.statesChanged);
925
+ }
926
+ if (statesChanged.length > 0) {
927
+ this.eventManager.fire({
928
+ type: EventType.StateChange,
929
+ data: statesChanged,
930
+ });
931
+ }
932
+ };
933
+ return Animator;
934
+ }());
935
+ // #endregion
936
+ // #region events
937
+ /**
938
+ * Supported event types triggered in Rive
939
+ */
940
+ var EventType;
941
+ (function (EventType) {
942
+ EventType["Load"] = "load";
943
+ EventType["LoadError"] = "loaderror";
944
+ EventType["Play"] = "play";
945
+ EventType["Pause"] = "pause";
946
+ EventType["Stop"] = "stop";
947
+ EventType["Loop"] = "loop";
948
+ EventType["Draw"] = "draw";
949
+ EventType["StateChange"] = "statechange";
950
+ })(EventType || (EventType = {}));
951
+ /**
952
+ * Looping types: one-shot, loop, and ping-pong
953
+ */
954
+ var LoopType;
955
+ (function (LoopType) {
956
+ LoopType["OneShot"] = "oneshot";
957
+ LoopType["Loop"] = "loop";
958
+ LoopType["PingPong"] = "pingpong"; // has value 2 in runtime
959
+ })(LoopType || (LoopType = {}));
960
+ // Manages Rive events and listeners
961
+ var EventManager = /** @class */ (function () {
962
+ function EventManager(listeners) {
963
+ if (listeners === void 0) { listeners = []; }
964
+ this.listeners = listeners;
965
+ }
966
+ // Gets listeners of specified type
967
+ EventManager.prototype.getListeners = function (type) {
968
+ return this.listeners.filter(function (e) { return e.type === type; });
969
+ };
970
+ // Adds a listener
971
+ EventManager.prototype.add = function (listener) {
972
+ if (!this.listeners.includes(listener)) {
973
+ this.listeners.push(listener);
974
+ }
975
+ };
976
+ /**
977
+ * Removes a listener
978
+ * @param listener the listener with the callback to be removed
979
+ */
980
+ EventManager.prototype.remove = function (listener) {
981
+ // We can't simply look for the listener as it'll be a different instance to
982
+ // one originally subscribed. Find all the listeners of the right type and
983
+ // then check their callbacks which should match.
984
+ for (var i = 0; i < this.listeners.length; i++) {
985
+ var currentListener = this.listeners[i];
986
+ if (currentListener.type === listener.type) {
987
+ if (currentListener.callback === listener.callback) {
988
+ this.listeners.splice(i, 1);
989
+ break;
990
+ }
991
+ }
992
+ }
993
+ };
994
+ /**
995
+ * Clears all listeners of specified type, or every listener if no type is
996
+ * specified
997
+ * @param type the type of listeners to clear, or all listeners if not
998
+ * specified
999
+ */
1000
+ EventManager.prototype.removeAll = function (type) {
1001
+ var _this = this;
1002
+ if (!type) {
1003
+ this.listeners.splice(0, this.listeners.length);
1004
+ }
1005
+ else {
1006
+ this.listeners
1007
+ .filter(function (l) { return l.type === type; })
1008
+ .forEach(function (l) { return _this.remove(l); });
1009
+ }
1010
+ };
1011
+ // Fires an event
1012
+ EventManager.prototype.fire = function (event) {
1013
+ var eventListeners = this.getListeners(event.type);
1014
+ eventListeners.forEach(function (listener) { return listener.callback(event); });
1015
+ };
1016
+ return EventManager;
1017
+ }());
1018
+ // Manages a queue of tasks
1019
+ var TaskQueueManager = /** @class */ (function () {
1020
+ function TaskQueueManager(eventManager) {
1021
+ this.eventManager = eventManager;
1022
+ this.queue = [];
1023
+ }
1024
+ // Adds a task top the queue
1025
+ TaskQueueManager.prototype.add = function (task) {
1026
+ this.queue.push(task);
1027
+ };
1028
+ // Processes all tasks in the queue
1029
+ TaskQueueManager.prototype.process = function () {
1030
+ while (this.queue.length > 0) {
1031
+ var task = this.queue.shift();
1032
+ task === null || task === void 0 ? void 0 : task.action();
1033
+ if (task === null || task === void 0 ? void 0 : task.event) {
1034
+ this.eventManager.fire(task.event);
1035
+ }
1036
+ }
1037
+ };
1038
+ return TaskQueueManager;
1039
+ }());
1040
+ var Rive = /** @class */ (function () {
1041
+ function Rive(params) {
1042
+ var _a;
1043
+ // Flag to indicate if the layout has changed; used by the renderer to know
1044
+ // when to align
1045
+ this._updateLayout = true;
1046
+ /**
1047
+ * Flag to active/deactivate renderer
1048
+ */
1049
+ this.isRendererActive = true;
1050
+ // Tracks if a Rive file is loaded
1051
+ this.loaded = false;
1052
+ /**
1053
+ * Tracks if a Rive file is loaded; we need this in addition to loaded as some
1054
+ * commands (e.g. contents) can be called as soon as the file is loaded.
1055
+ * However, playback commands need to be queued and run in order once initial
1056
+ * animations and autoplay has been sorted out. This applies to play, pause,
1057
+ * and start.
1058
+ */
1059
+ this.readyForPlaying = false;
1060
+ // Runtime artboard
1061
+ this.artboard = null;
1062
+ /**
1063
+ * Used be draw to track when a second of active rendering time has passed. Used for debugging purposes
1064
+ */
1065
+ this.renderSecondTimer = 0;
1066
+ this.canvas = params.canvas;
1067
+ this.src = params.src;
1068
+ this.buffer = params.buffer;
1069
+ this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
1070
+ // New event management system
1071
+ this.eventManager = new EventManager();
1072
+ if (params.onLoad)
1073
+ this.on(EventType.Load, params.onLoad);
1074
+ if (params.onLoadError)
1075
+ this.on(EventType.LoadError, params.onLoadError);
1076
+ if (params.onPlay)
1077
+ this.on(EventType.Play, params.onPlay);
1078
+ if (params.onPause)
1079
+ this.on(EventType.Pause, params.onPause);
1080
+ if (params.onStop)
1081
+ this.on(EventType.Stop, params.onStop);
1082
+ if (params.onLoop)
1083
+ this.on(EventType.Loop, params.onLoop);
1084
+ if (params.onStateChange)
1085
+ this.on(EventType.StateChange, params.onStateChange);
1086
+ /**
1087
+ * @deprecated Use camelCase'd versions instead.
1088
+ */
1089
+ if (params.onload && !params.onLoad)
1090
+ this.on(EventType.Load, params.onload);
1091
+ if (params.onloaderror && !params.onLoadError)
1092
+ this.on(EventType.LoadError, params.onloaderror);
1093
+ if (params.onplay && !params.onPlay)
1094
+ this.on(EventType.Play, params.onplay);
1095
+ if (params.onpause && !params.onPause)
1096
+ this.on(EventType.Pause, params.onpause);
1097
+ if (params.onstop && !params.onStop)
1098
+ this.on(EventType.Stop, params.onstop);
1099
+ if (params.onloop && !params.onLoop)
1100
+ this.on(EventType.Loop, params.onloop);
1101
+ if (params.onstatechange && !params.onStateChange)
1102
+ this.on(EventType.StateChange, params.onstatechange);
1103
+ // Hook up the task queue
1104
+ this.taskQueue = new TaskQueueManager(this.eventManager);
1105
+ this.init({
1106
+ src: this.src,
1107
+ buffer: this.buffer,
1108
+ autoplay: params.autoplay,
1109
+ animations: params.animations,
1110
+ stateMachines: params.stateMachines,
1111
+ artboard: params.artboard
1112
+ });
1113
+ }
1114
+ // Alternative constructor to build a Rive instance from an interface/object
1115
+ Rive.new = function (params) {
1116
+ console.warn('This function is deprecated: please use `new Rive({})` instead');
1117
+ return new Rive(params);
1118
+ };
1119
+ // Initializes the Rive object either from constructor or load()
1120
+ Rive.prototype.init = function (_a) {
1121
+ var _this = this;
1122
+ var src = _a.src, buffer = _a.buffer, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b;
1123
+ this.src = src;
1124
+ this.buffer = buffer;
1125
+ // If no source file url specified, it's a bust
1126
+ if (!this.src && !this.buffer) {
1127
+ throw new Error(Rive.missingErrorMessage);
1128
+ }
1129
+ // List of animations that should be initialized.
1130
+ var startingAnimationNames = mapToStringArray(animations);
1131
+ // List of state machines that should be initialized
1132
+ var startingStateMachineNames = mapToStringArray(stateMachines);
1133
+ // Ensure loaded is marked as false if loading new file
1134
+ this.loaded = false;
1135
+ this.readyForPlaying = false;
1136
+ // Ensure the runtime is loaded
1137
+ RuntimeLoader.awaitInstance().then(function (runtime) {
1138
+ _this.runtime = runtime;
1139
+ // Get the canvas where you want to render the animation and create a renderer
1140
+ _this.renderer = _this.runtime.makeRenderer(_this.canvas);
1141
+ // Load Rive data from a source uri or a data buffer
1142
+ _this.initData(artboard, startingAnimationNames, startingStateMachineNames, autoplay).catch(function (e) {
1143
+ console.error(e);
1144
+ });
1145
+ }).catch(function (e) {
1146
+ console.error(e);
1147
+ });
1148
+ };
1149
+ // Initializes runtime with Rive data and preps for playing
1150
+ Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay) {
1151
+ var _a;
1152
+ return __awaiter(this, void 0, void 0, function () {
1153
+ var _b, _c, msg;
1154
+ return __generator(this, function (_d) {
1155
+ switch (_d.label) {
1156
+ case 0:
1157
+ if (!this.src) return [3 /*break*/, 2];
1158
+ _b = this;
1159
+ return [4 /*yield*/, loadRiveFile(this.src)];
1160
+ case 1:
1161
+ _b.buffer = _d.sent();
1162
+ _d.label = 2;
1163
+ case 2:
1164
+ // Load the Rive file
1165
+ _c = this;
1166
+ return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer))];
1167
+ case 3:
1168
+ // Load the Rive file
1169
+ _c.file = _d.sent();
1170
+ if (this.file) {
1171
+ // Initialize and draw frame
1172
+ this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay);
1173
+ // Everything's set up, emit a load event
1174
+ this.loaded = true;
1175
+ this.eventManager.fire({
1176
+ type: EventType.Load,
1177
+ data: (_a = this.src) !== null && _a !== void 0 ? _a : 'buffer'
1178
+ });
1179
+ // Flag ready for playback commands and clear the task queue; this order
1180
+ // is important or it may infinitely recurse
1181
+ this.readyForPlaying = true;
1182
+ this.taskQueue.process();
1183
+ this.drawFrame();
1184
+ return [2 /*return*/, Promise.resolve()];
1185
+ }
1186
+ else {
1187
+ msg = 'Problem loading file; may be corrupt!';
1188
+ console.warn(msg);
1189
+ this.eventManager.fire({ type: EventType.LoadError, data: msg });
1190
+ return [2 /*return*/, Promise.reject(msg)];
1191
+ }
1192
+ return [2 /*return*/];
1193
+ }
1194
+ });
1195
+ });
1196
+ };
1197
+ // Initialize for playback
1198
+ Rive.prototype.initArtboard = function (artboardName, animationNames, stateMachineNames, autoplay) {
1199
+ // Fetch the artboard
1200
+ var rootArtboard = artboardName ?
1201
+ this.file.artboardByName(artboardName) :
1202
+ this.file.defaultArtboard();
1203
+ // Check we have a working artboard
1204
+ if (!rootArtboard) {
1205
+ var msg = 'Invalid artboard name or no default artboard';
1206
+ console.warn(msg);
1207
+ this.eventManager.fire({ type: EventType.LoadError, data: msg });
1208
+ return;
1209
+ }
1210
+ // Instance the artboard
1211
+ this.artboard = rootArtboard.instance();
1212
+ // Check that the artboard has at least 1 animation
1213
+ if (this.artboard.animationCount() < 1) {
1214
+ var msg = 'Artboard has no animations';
1215
+ this.eventManager.fire({ type: EventType.LoadError, data: msg });
1216
+ throw msg;
1217
+ }
1218
+ // Initialize the animator
1219
+ this.animator = new Animator(this.runtime, this.artboard, this.eventManager);
1220
+ // Initialize the animations; as loaded hasn't happened yet, we need to
1221
+ // suppress firing the play/pause events until the load event has fired. To
1222
+ // do this we tell the animator to suppress firing events, and add event
1223
+ // firing to the task queue.
1224
+ var instanceNames;
1225
+ if (animationNames.length > 0 || stateMachineNames.length > 0) {
1226
+ instanceNames = animationNames.concat(stateMachineNames);
1227
+ this.animator.add(instanceNames, autoplay, false);
1228
+ }
1229
+ else {
1230
+ instanceNames = [this.animator.atLeastOne(autoplay, false)];
1231
+ }
1232
+ // Queue up firing the playback events
1233
+ this.taskQueue.add({
1234
+ action: function () { },
1235
+ event: {
1236
+ type: autoplay ? EventType.Play : EventType.Pause,
1237
+ data: instanceNames,
1238
+ }
1239
+ });
1240
+ };
1241
+ // Draws the current artboard frame
1242
+ Rive.prototype.drawFrame = function () {
1243
+ this.startRendering();
1244
+ };
1245
+ /**
1246
+ * Draw rendering loop; renders animation frames at the correct time interval.
1247
+ * @param time the time at which to render a frame
1248
+ */
1249
+ Rive.prototype.draw = function (time, onSecond) {
1250
+ // Clear the frameRequestId, as we're now rendering a fresh frame
1251
+ this.frameRequestId = null;
1252
+ // On the first pass, make sure lastTime has a valid value
1253
+ if (!this.lastRenderTime) {
1254
+ this.lastRenderTime = time;
1255
+ }
1256
+ // Handle the onSecond callback
1257
+ this.renderSecondTimer += (time - this.lastRenderTime);
1258
+ if (this.renderSecondTimer > 5000) {
1259
+ this.renderSecondTimer = 0;
1260
+ onSecond === null || onSecond === void 0 ? void 0 : onSecond();
1261
+ }
1262
+ // Calculate the elapsed time between frames in seconds
1263
+ var elapsedTime = (time - this.lastRenderTime) / 1000;
1264
+ this.lastRenderTime = time;
1265
+ // Advance non-paused animations by the elapsed number of seconds
1266
+ // Also advance any animations that require scrubbing
1267
+ var activeAnimations = this.animator.animations.filter(function (a) { return a.playing || a.needsScrub; })
1268
+ // The scrubbed animations must be applied first to prevent weird artifacts
1269
+ // if the playing animations conflict with the scrubbed animating attribuates.
1270
+ .sort(function (first, second) { return first.needsScrub ? -1 : 1; });
1271
+ for (var _i = 0, activeAnimations_1 = activeAnimations; _i < activeAnimations_1.length; _i++) {
1272
+ var animation = activeAnimations_1[_i];
1273
+ animation.advance(elapsedTime);
1274
+ if (animation.instance.didLoop) {
1275
+ animation.loopCount += 1;
1276
+ }
1277
+ animation.instance.apply(this.artboard, 1.0);
1278
+ }
1279
+ // Advance non-paused state machines by the elapsed number of seconds
1280
+ var activeStateMachines = this.animator.stateMachines.filter(function (a) { return a.playing; });
1281
+ for (var _a = 0, activeStateMachines_1 = activeStateMachines; _a < activeStateMachines_1.length; _a++) {
1282
+ var stateMachine = activeStateMachines_1[_a];
1283
+ stateMachine.instance.advance(this.artboard, elapsedTime);
1284
+ // stateMachine.instance.apply(this.artboard);
1285
+ }
1286
+ // Once the animations have been applied to the artboard, advance it
1287
+ // by the elapsed time.
1288
+ this.artboard.advance(elapsedTime);
1289
+ var renderer = this.renderer;
1290
+ renderer.save();
1291
+ // Update the renderer alignment if necessary
1292
+ this.alignRenderer();
1293
+ this.artboard.draw(renderer);
1294
+ renderer.restore();
1295
+ renderer.flush();
1296
+ // Check for any animations that looped
1297
+ this.animator.handleLooping();
1298
+ // Check for any state machines that had a state change
1299
+ this.animator.handleStateChanges();
1300
+ // Calling requestAnimationFrame will rerun draw() at the correct rate:
1301
+ // https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations
1302
+ if (this.animator.isPlaying) {
1303
+ // Request a new rendering frame
1304
+ this.startRendering();
1305
+ }
1306
+ else if (this.animator.isPaused) {
1307
+ // Reset the end time so on playback it starts at the correct frame
1308
+ this.lastRenderTime = 0;
1309
+ }
1310
+ else if (this.animator.isStopped) {
1311
+ // Reset animation instances, artboard and time
1312
+ // TODO: implement this properly when we have instancing
1313
+ // this.initArtboard();
1314
+ // this.drawFrame();
1315
+ this.lastRenderTime = 0;
1316
+ }
1317
+ };
1318
+ /**
1319
+ * Align the renderer
1320
+ */
1321
+ Rive.prototype.alignRenderer = function () {
1322
+ var _a = this, renderer = _a.renderer, runtime = _a.runtime, _layout = _a._layout, artboard = _a.artboard;
1323
+ // Canvas must be wiped to prevent artifacts
1324
+ renderer.clear();
1325
+ // Now save so that future changes to align can restore
1326
+ renderer.save();
1327
+ // Align things up safe in the knowledge we can restore if changed
1328
+ renderer.align(_layout.runtimeFit(runtime), _layout.runtimeAlignment(runtime), {
1329
+ minX: _layout.minX,
1330
+ minY: _layout.minY,
1331
+ maxX: _layout.maxX,
1332
+ maxY: _layout.maxY
1333
+ }, artboard.bounds);
1334
+ };
1335
+ /**
1336
+ * Cleans up any Wasm-generated objects that need to be manually destroyed:
1337
+ * artboard instances, animation instances, state machine instances.
1338
+ *
1339
+ * Once this is called, things will need to be reinitialized or bad things
1340
+ * might happen.
1341
+ */
1342
+ Rive.prototype.cleanup = function () {
1343
+ this.artboard.delete();
1344
+ // TODO: delete animation and state machine instances
1345
+ };
1346
+ // Plays specified animations; if none specified, it unpauses everything.
1347
+ Rive.prototype.play = function (animationNames, autoplay) {
1348
+ var _this = this;
1349
+ animationNames = mapToStringArray(animationNames);
1350
+ // If the file's not loaded, queue up the play
1351
+ if (!this.readyForPlaying) {
1352
+ this.taskQueue.add({
1353
+ action: function () { return _this.play(animationNames, autoplay); },
1354
+ });
1355
+ return;
1356
+ }
1357
+ this.animator.play(animationNames);
1358
+ this.startRendering();
1359
+ };
1360
+ // Pauses specified animations; if none specified, pauses all.
1361
+ Rive.prototype.pause = function (animationNames) {
1362
+ var _this = this;
1363
+ animationNames = mapToStringArray(animationNames);
1364
+ // If the file's not loaded, early out, nothing to pause
1365
+ if (!this.readyForPlaying) {
1366
+ this.taskQueue.add({
1367
+ action: function () { return _this.pause(animationNames); },
1368
+ });
1369
+ return;
1370
+ }
1371
+ this.animator.pause(animationNames);
1372
+ };
1373
+ Rive.prototype.scrub = function (animationNames, value) {
1374
+ var _this = this;
1375
+ animationNames = mapToStringArray(animationNames);
1376
+ // If the file's not loaded, early out, nothing to pause
1377
+ if (!this.readyForPlaying) {
1378
+ this.taskQueue.add({
1379
+ action: function () { return _this.scrub(animationNames, value); },
1380
+ });
1381
+ return;
1382
+ }
1383
+ // Scrub the animation time; we draw a single frame here so that if
1384
+ // nothing's currently playing, the scrubbed animation is still rendered/
1385
+ this.animator.scrub(animationNames, value || 0);
1386
+ this.drawFrame();
1387
+ };
1388
+ // Stops specified animations; if none specifies, stops them all.
1389
+ Rive.prototype.stop = function (animationNames) {
1390
+ var _this = this;
1391
+ animationNames = mapToStringArray(animationNames);
1392
+ // If the file's not loaded, early out, nothing to pause
1393
+ if (!this.readyForPlaying) {
1394
+ this.taskQueue.add({
1395
+ action: function () { return _this.stop(animationNames); },
1396
+ });
1397
+ return;
1398
+ }
1399
+ this.animator.stop(animationNames);
1400
+ };
1401
+ /**
1402
+ * Resets the animation
1403
+ * @param artboard the name of the artboard, or default if none given
1404
+ * @param animations the names of animations for playback
1405
+ * @param stateMachines the names of state machines for playback
1406
+ * @param autoplay whether to autoplay when reset, defaults to false
1407
+ *
1408
+ */
1409
+ Rive.prototype.reset = function (params) {
1410
+ var _a;
1411
+ // Get the current artboard, animations, state machines, and playback states
1412
+ var artBoardName = params === null || params === void 0 ? void 0 : params.artboard;
1413
+ var animationNames = mapToStringArray(params === null || params === void 0 ? void 0 : params.animations);
1414
+ var stateMachineNames = mapToStringArray(params === null || params === void 0 ? void 0 : params.stateMachines);
1415
+ var autoplay = (_a = params === null || params === void 0 ? void 0 : params.autoplay) !== null && _a !== void 0 ? _a : false;
1416
+ // Stop everything and clean up
1417
+ this.stop();
1418
+ this.cleanup();
1419
+ // Reinitialize an artboard instance with the state
1420
+ this.initArtboard(artBoardName, animationNames, stateMachineNames, autoplay);
1421
+ };
1422
+ // Loads a new Rive file, keeping listeners in place
1423
+ Rive.prototype.load = function (params) {
1424
+ // Stop all animations
1425
+ this.stop();
1426
+ // Reinitialize
1427
+ this.init(params);
1428
+ };
1429
+ Object.defineProperty(Rive.prototype, "layout", {
1430
+ /**
1431
+ * Returns the current layout. Note that layout should be treated as
1432
+ * immutable. If you want to change the layout, create a new one use the
1433
+ * layout setter
1434
+ */
1435
+ get: function () {
1436
+ return this._layout;
1437
+ },
1438
+ // Sets a new layout
1439
+ set: function (layout) {
1440
+ this._layout = layout;
1441
+ // If the maxX or maxY are 0, then set them to the canvas width and height
1442
+ if (!layout.maxX || !layout.maxY) {
1443
+ this.resizeToCanvas();
1444
+ }
1445
+ if (this.loaded && !this.animator.isPlaying) {
1446
+ this.drawFrame();
1447
+ }
1448
+ },
1449
+ enumerable: false,
1450
+ configurable: true
1451
+ });
1452
+ /**
1453
+ * Sets the layout bounds to the current canvas size; this is typically called
1454
+ * when the canvas is resized
1455
+ */
1456
+ Rive.prototype.resizeToCanvas = function () {
1457
+ this._layout = this.layout.copyWith({
1458
+ minX: 0,
1459
+ minY: 0,
1460
+ maxX: this.canvas.width,
1461
+ maxY: this.canvas.height
1462
+ });
1463
+ };
1464
+ Object.defineProperty(Rive.prototype, "source", {
1465
+ // Returns the animation source, which may be undefined
1466
+ get: function () {
1467
+ return this.src;
1468
+ },
1469
+ enumerable: false,
1470
+ configurable: true
1471
+ });
1472
+ Object.defineProperty(Rive.prototype, "activeArtboard", {
1473
+ /**
1474
+ * Returns the name of the active artboard
1475
+ */
1476
+ get: function () {
1477
+ return this.artboard.name;
1478
+ },
1479
+ enumerable: false,
1480
+ configurable: true
1481
+ });
1482
+ Object.defineProperty(Rive.prototype, "animationNames", {
1483
+ // Returns a list of animation names on the chosen artboard
1484
+ get: function () {
1485
+ // If the file's not loaded, we got nothing to return
1486
+ if (!this.loaded) {
1487
+ return [];
1488
+ }
1489
+ var animationNames = [];
1490
+ for (var i = 0; i < this.artboard.animationCount(); i++) {
1491
+ animationNames.push(this.artboard.animationByIndex(i).name);
1492
+ }
1493
+ return animationNames;
1494
+ },
1495
+ enumerable: false,
1496
+ configurable: true
1497
+ });
1498
+ Object.defineProperty(Rive.prototype, "stateMachineNames", {
1499
+ /**
1500
+ * Returns a list of state machine names from the current artboard
1501
+ */
1502
+ get: function () {
1503
+ // If the file's not loaded, we got nothing to return
1504
+ if (!this.loaded) {
1505
+ return [];
1506
+ }
1507
+ var stateMachineNames = [];
1508
+ for (var i = 0; i < this.artboard.stateMachineCount(); i++) {
1509
+ stateMachineNames.push(this.artboard.stateMachineByIndex(i).name);
1510
+ }
1511
+ return stateMachineNames;
1512
+ },
1513
+ enumerable: false,
1514
+ configurable: true
1515
+ });
1516
+ /**
1517
+ * Returns the inputs for the specified instanced state machine, or an empty
1518
+ * list if the name is invalid or the state machine is not instanced
1519
+ * @param name the state machine name
1520
+ * @returns the inputs for the named state machine
1521
+ */
1522
+ Rive.prototype.stateMachineInputs = function (name) {
1523
+ // If the file's not loaded, early out, nothing to pause
1524
+ if (!this.loaded) {
1525
+ return;
1526
+ }
1527
+ var stateMachine = this.animator.stateMachines.find(function (m) { return m.name === name; });
1528
+ return stateMachine === null || stateMachine === void 0 ? void 0 : stateMachine.inputs;
1529
+ };
1530
+ Object.defineProperty(Rive.prototype, "playingStateMachineNames", {
1531
+ // Returns a list of playing machine names
1532
+ get: function () {
1533
+ // If the file's not loaded, we got nothing to return
1534
+ if (!this.loaded) {
1535
+ return [];
1536
+ }
1537
+ return this.animator.stateMachines
1538
+ .filter(function (m) { return m.playing; })
1539
+ .map(function (m) { return m.name; });
1540
+ },
1541
+ enumerable: false,
1542
+ configurable: true
1543
+ });
1544
+ Object.defineProperty(Rive.prototype, "playingAnimationNames", {
1545
+ // Returns a list of playing animation names
1546
+ get: function () {
1547
+ // If the file's not loaded, we got nothing to return
1548
+ if (!this.loaded) {
1549
+ return [];
1550
+ }
1551
+ return this.animator.animations
1552
+ .filter(function (a) { return a.playing; })
1553
+ .map(function (a) { return a.name; });
1554
+ },
1555
+ enumerable: false,
1556
+ configurable: true
1557
+ });
1558
+ Object.defineProperty(Rive.prototype, "pausedAnimationNames", {
1559
+ // Returns a list of paused animation names
1560
+ get: function () {
1561
+ // If the file's not loaded, we got nothing to return
1562
+ if (!this.loaded) {
1563
+ return [];
1564
+ }
1565
+ return this.animator.animations
1566
+ .filter(function (a) { return !a.playing; })
1567
+ .map(function (a) { return a.name; });
1568
+ },
1569
+ enumerable: false,
1570
+ configurable: true
1571
+ });
1572
+ Object.defineProperty(Rive.prototype, "pausedStateMachineNames", {
1573
+ /**
1574
+ * Returns a list of paused machine names
1575
+ * @returns a list of state machine names that are paused
1576
+ */
1577
+ get: function () {
1578
+ // If the file's not loaded, we got nothing to return
1579
+ if (!this.loaded) {
1580
+ return [];
1581
+ }
1582
+ return this.animator.stateMachines
1583
+ .filter(function (m) { return !m.playing; })
1584
+ .map(function (m) { return m.name; });
1585
+ },
1586
+ enumerable: false,
1587
+ configurable: true
1588
+ });
1589
+ Object.defineProperty(Rive.prototype, "isPlaying", {
1590
+ /**
1591
+ * @returns true if any animation is playing
1592
+ */
1593
+ get: function () {
1594
+ return this.animator.isPlaying;
1595
+ },
1596
+ enumerable: false,
1597
+ configurable: true
1598
+ });
1599
+ Object.defineProperty(Rive.prototype, "isPaused", {
1600
+ /**
1601
+ * @returns true if all instanced animations are paused
1602
+ */
1603
+ get: function () {
1604
+ return this.animator.isPaused;
1605
+ },
1606
+ enumerable: false,
1607
+ configurable: true
1608
+ });
1609
+ Object.defineProperty(Rive.prototype, "isStopped", {
1610
+ /**
1611
+ * @returns true if no animations are playing or paused
1612
+ */
1613
+ get: function () {
1614
+ return this.animator.isStopped;
1615
+ },
1616
+ enumerable: false,
1617
+ configurable: true
1618
+ });
1619
+ Object.defineProperty(Rive.prototype, "bounds", {
1620
+ /**
1621
+ * @returns the bounds of the current artboard, or undefined if the artboard
1622
+ * isn't loaded yet.
1623
+ */
1624
+ get: function () {
1625
+ return this.artboard ? this.artboard.bounds : undefined;
1626
+ },
1627
+ enumerable: false,
1628
+ configurable: true
1629
+ });
1630
+ /**
1631
+ * Subscribe to Rive-generated events
1632
+ * @param type the type of event to subscribe to
1633
+ * @param callback callback to fire when the event occurs
1634
+ */
1635
+ Rive.prototype.on = function (type, callback) {
1636
+ this.eventManager.add({
1637
+ type: type,
1638
+ callback: callback,
1639
+ });
1640
+ };
1641
+ /**
1642
+ * Unsubscribes from a Rive-generated event
1643
+ * @param callback the callback to unsubscribe from
1644
+ */
1645
+ Rive.prototype.unsubscribe = function (type, callback) {
1646
+ this.eventManager.remove({
1647
+ type: type,
1648
+ callback: callback,
1649
+ });
1650
+ };
1651
+ /**
1652
+ * Unsubscribes all listeners from an event type, or everything if no type is
1653
+ * given
1654
+ * @param type the type of event to unsubscribe from, or all types if
1655
+ * undefined
1656
+ */
1657
+ Rive.prototype.unsubscribeAll = function (type) {
1658
+ this.eventManager.removeAll(type);
1659
+ };
1660
+ /**
1661
+ * Stops the rendering loop; this is different from pausing in that it doesn't
1662
+ * change the state of any animation. It stops rendering from occurring. This
1663
+ * is designed for situations such as when Rive isn't visible.
1664
+ *
1665
+ * The only way to start rendering again is to call `startRendering`.
1666
+ * Animations that are marked as playing will start from the position that
1667
+ * they would have been at if rendering had not been stopped.
1668
+ */
1669
+ Rive.prototype.stopRendering = function () {
1670
+ if (this.loaded && this.frameRequestId) {
1671
+ cancelAnimationFrame(this.frameRequestId);
1672
+ this.frameRequestId = null;
1673
+ }
1674
+ };
1675
+ /**
1676
+ * Starts the rendering loop if it has been previously stopped. If the
1677
+ * renderer is already active, then this will have zero effect.
1678
+ */
1679
+ Rive.prototype.startRendering = function () {
1680
+ if (this.loaded && !this.frameRequestId) {
1681
+ this.frameRequestId = requestAnimationFrame(this.draw.bind(this));
1682
+ }
1683
+ };
1684
+ Object.defineProperty(Rive.prototype, "contents", {
1685
+ /**
1686
+ * Returns the contents of a Rive file: the artboards, animations, and state machines
1687
+ */
1688
+ get: function () {
1689
+ if (!this.loaded) {
1690
+ return undefined;
1691
+ }
1692
+ var riveContents = {
1693
+ artboards: [],
1694
+ };
1695
+ for (var i = 0; i < this.file.artboardCount(); i++) {
1696
+ var artboard = this.file.artboardByIndex(i);
1697
+ var artboardContents = {
1698
+ name: artboard.name,
1699
+ animations: [],
1700
+ stateMachines: [],
1701
+ };
1702
+ for (var j = 0; j < artboard.animationCount(); j++) {
1703
+ var animation = artboard.animationByIndex(j);
1704
+ artboardContents.animations.push(animation.name);
1705
+ }
1706
+ for (var k = 0; k < artboard.stateMachineCount(); k++) {
1707
+ var stateMachine = artboard.stateMachineByIndex(k);
1708
+ var name_1 = stateMachine.name;
1709
+ var instance = new this.runtime.StateMachineInstance(stateMachine);
1710
+ var inputContents = [];
1711
+ for (var l = 0; l < instance.inputCount(); l++) {
1712
+ var input = instance.input(l);
1713
+ inputContents.push({ name: input.name, type: input.type });
1714
+ }
1715
+ artboardContents.stateMachines.push({ name: name_1, inputs: inputContents });
1716
+ }
1717
+ riveContents.artboards.push(artboardContents);
1718
+ }
1719
+ return riveContents;
1720
+ },
1721
+ enumerable: false,
1722
+ configurable: true
1723
+ });
1724
+ // Error message for missing source or buffer
1725
+ Rive.missingErrorMessage = 'Rive source file or data buffer required';
1726
+ return Rive;
1727
+ }());
1728
+
1729
+ // Loads Rive data from a URI via fetch.
1730
+ var loadRiveFile = function (src) { return __awaiter(void 0, void 0, void 0, function () {
1731
+ var req, res, buffer;
1732
+ return __generator(this, function (_a) {
1733
+ switch (_a.label) {
1734
+ case 0:
1735
+ req = new Request(src);
1736
+ return [4 /*yield*/, fetch(req)];
1737
+ case 1:
1738
+ res = _a.sent();
1739
+ return [4 /*yield*/, res.arrayBuffer()];
1740
+ case 2:
1741
+ buffer = _a.sent();
1742
+ return [2 /*return*/, buffer];
1743
+ }
1744
+ });
1745
+ }); };
1746
+ // #endregion
1747
+ // #region utility functions
1748
+ /*
1749
+ * Utility function to ensure an object is a string array
1750
+ */
1751
+ var mapToStringArray = function (obj) {
1752
+ if (typeof obj === 'string') {
1753
+ return [obj];
1754
+ }
1755
+ else if (obj instanceof Array) {
1756
+ return obj;
1757
+ }
1758
+ // If obj is undefined, return empty array
1759
+ return [];
1760
+ };
1761
+ // #endregion
1762
+ // #region testing utilities
1763
+ // Exports to only be used for tests
1764
+ var Testing = {
1765
+ EventManager: EventManager,
1766
+ TaskQueueManager: TaskQueueManager,
1767
+ };
1768
+ // #endregion
1769
+
1770
+ })();
1771
+
1772
+ /******/ return __webpack_exports__;
1773
+ /******/ })()
1774
+ ;
1775
+ });
1776
+ //# sourceMappingURL=rive.js.map