@rive-app/webgl2
Version:
Rive's webgl2 based web api.
1,895 lines (1,891 loc) • 284 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["rive"] = factory();
else
root["rive"] = factory();
})(this, () => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
var Rive = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
return (
function(moduleArg = {}) {
var k = moduleArg, aa, ca;
k.ready = new Promise((a, b) => {
aa = a;
ca = b;
});
function da() {
function a(g) {
const l = d;
c = b = 0;
d = new Map();
l.forEach(p => {
try {
p(g);
} catch (m) {
console.error(m);
}
});
this.lb();
e && e.Nb();
}
let b = 0, c = 0, d = new Map(), e = null, f = null;
this.requestAnimationFrame = function(g) {
b || (b = requestAnimationFrame(a.bind(this)));
const l = ++c;
d.set(l, g);
return l;
};
this.cancelAnimationFrame = function(g) {
d.delete(g);
b && 0 == d.size && (cancelAnimationFrame(b), b = 0);
};
this.Lb = function(g) {
f && (document.body.remove(f), f = null);
g || (f = document.createElement("div"), f.style.backgroundColor = "black", f.style.position = "fixed", f.style.right = 0, f.style.top = 0, f.style.color = "white", f.style.padding = "4px", f.innerHTML = "RIVE FPS", g = function(l) {
f.innerHTML = "RIVE FPS " + l.toFixed(1);
}, document.body.appendChild(f));
e = new function() {
let l = 0, p = 0;
this.Nb = function() {
var m = performance.now();
p ? (++l, m -= p, 1000 < m && (g(1000 * l / m), l = p = 0)) : (p = m, l = 0);
};
}();
};
this.lb = function() {
};
}
function ea() {
console.assert(!0);
const a = new Map();
let b = -Infinity;
this.push = function(c) {
c = c + 255 >> 8;
a.has(c) && clearTimeout(a.get(c));
a.set(c, setTimeout(function() {
a.delete(c);
0 == a.length ? b = -Infinity : c == b && (b = Math.max(...a.keys()), console.assert(b < c));
}, 1000));
b = Math.max(c, b);
return b << 8;
};
}
const fa = k.onRuntimeInitialized;
k.onRuntimeInitialized = function() {
fa && fa();
let a = k.decodeAudio;
k.decodeAudio = function(e, f) {
e = a(e);
f(e);
};
let b = k.decodeFont;
k.decodeFont = function(e, f) {
e = b(e);
f(e);
};
const c = k.FileAssetLoader;
k.ptrToAsset = e => {
let f = k.ptrToFileAsset(e);
return f.isImage ? k.ptrToImageAsset(e) : f.isFont ? k.ptrToFontAsset(e) : f.isAudio ? k.ptrToAudioAsset(e) : f;
};
k.CustomFileAssetLoader = c.extend("CustomFileAssetLoader", {__construct:function({loadContents:e}) {
this.__parent.__construct.call(this);
this.Bb = e;
}, loadContents:function(e, f) {
e = k.ptrToAsset(e);
return this.Bb(e, f);
},});
k.CDNFileAssetLoader = c.extend("CDNFileAssetLoader", {__construct:function() {
this.__parent.__construct.call(this);
}, loadContents:function(e) {
let f = k.ptrToAsset(e);
e = f.cdnUuid;
if ("" === e) {
return !1;
}
(function(g, l) {
var p = new XMLHttpRequest();
p.responseType = "arraybuffer";
p.onreadystatechange = function() {
4 == p.readyState && 200 == p.status && l(p);
};
p.open("GET", g, !0);
p.send(null);
})(f.cdnBaseUrl + "/" + e, g => {
f.decode(new Uint8Array(g.response));
});
return !0;
},});
k.FallbackFileAssetLoader = c.extend("FallbackFileAssetLoader", {__construct:function() {
this.__parent.__construct.call(this);
this.hb = [];
}, addLoader:function(e) {
this.hb.push(e);
}, loadContents:function(e, f) {
for (let g of this.hb) {
if (g.loadContents(e, f)) {
return !0;
}
}
return !1;
},});
let d = k.computeAlignment;
k.computeAlignment = function(e, f, g, l, p = 1.0) {
return d.call(this, e, f, g, l, p);
};
};
const ha = k.onRuntimeInitialized;
k.onRuntimeInitialized = function() {
function a(q) {
this.F = q;
this.Ab = q.getContext("2d");
this.Db = d;
this.S = [];
this.la = 0;
this.clear = function() {
console.assert(0 == this.la);
this.S = [];
e.delete(this);
};
this.save = function() {
++this.la;
this.S.push(d.save.bind(d));
};
this.restore = function() {
0 < this.la && (this.S.push(d.restore.bind(d)), --this.la);
};
this.transform = function(u) {
this.S.push(d.transform.bind(d, u));
};
this.align = function(u, y, z, A, H = 1.0) {
this.S.push(d.align.bind(d, u, y, z, A, H));
};
this.flush = function() {
console.assert(0 == this.la);
e.add(this);
d.Wa || c();
};
this["delete"] = function() {
};
}
function b(q, u = !1) {
var y = {alpha:!0, depth:u, stencil:u, antialias:u, premultipliedAlpha:!0, preserveDrawingBuffer:0, powerPreference:"high-performance", failIfMajorPerformanceCaveat:0, enableExtensionsByDefault:!1, explicitSwapControl:0, renderViaOffscreenBackBuffer:0,};
u = q.getContext("webgl2", y);
if (!u) {
return null;
}
y = ia(u, y);
ja(y);
const z = f(q.width, q.height);
z.Ka = y;
z.F = q;
z.La = q.width;
z.Xa = q.height;
z.T = u;
var A = z.delete;
z.delete = function() {
A.call(this);
var H = this.Ka;
r === w[H] && (r = null);
"object" == typeof JSEvents && JSEvents.Oc(w[H].C.canvas);
w[H] && w[H].C.canvas && (w[H].C.canvas.zb = void 0);
this.Ka = this.F = this.La = this.T = w[H] = null;
};
return z;
}
function c() {
if (d) {
var q = d.Cb, u = 0, y = 0, z = 0, A = Array(e.size), H = 0;
for (var I of e) {
I.ga = Math.min(I.F.width, q), I.fa = Math.min(I.F.height, q), I.Ia = I.fa * I.ga, u = Math.max(u, I.ga), y = Math.max(y, I.fa), z += I.Ia, A[H++] = I;
}
e.clear();
if (!(0 >= z)) {
u = 1 << (0 >= u ? 0 : 32 - Math.clz32(u - 1));
for (y = 1 << (0 >= y ? 0 : 32 - Math.clz32(y - 1)); y * u < z;) {
u <= y ? u *= 2 : y *= 2;
}
u = Math.min(u, q);
u = Math.min(y, q);
A.sort((ba, tb) => tb.Ia - ba.Ia);
z = new k.DynamicRectanizer(q);
for (I = 0; I < A.length;) {
z.reset(u, y);
for (H = I; H < A.length; ++H) {
var L = A[H], E = z.addRect(L.ga, L.fa);
if (0 > E) {
console.assert(H > I);
break;
}
L.ra = E & 65535;
L.sa = E >> 16;
}
L = p.push(z.drawWidth());
E = m.push(z.drawHeight());
console.assert(L >= z.drawWidth());
console.assert(E >= z.drawHeight());
console.assert(L <= q);
console.assert(E <= q);
d.F.width != L && (d.F.width = L);
d.F.height != E && (d.F.height = E);
d.clear();
for (L = I; L < H; ++L) {
E = A[L];
d.saveClipRect(E.ra, E.sa, E.ra + E.ga, E.sa + E.fa);
let ba = new k.Mat2D();
ba.xx = E.ga / E.F.width;
ba.yy = E.fa / E.F.height;
ba.xy = ba.yx = 0;
ba.tx = E.ra;
ba.ty = E.sa;
d.transform(ba);
for (const tb of E.S) {
tb();
}
d.restoreClipRect();
E.S = [];
}
for (d.flush(); I < H; ++I) {
L = A[I], E = L.Ab, E.globalCompositeOperation = "copy", E.drawImage(d.F, L.ra, L.sa, L.ga, L.fa, 0, 0, L.F.width, L.F.height);
}
I = H;
}
}
}
}
ha && ha();
let d = null;
const e = new Set(), f = k.makeRenderer;
k.makeRenderer = function(q, u) {
if (!d) {
function y(z) {
var A = document.createElement("canvas");
A.width = 1;
A.height = 1;
d = b(A, z);
d.Wa = !!d.T.getExtension("WEBGL_shader_pixel_local_storage");
d.Cb = Math.min(d.T.getParameter(d.T.MAX_RENDERBUFFER_SIZE), d.T.getParameter(d.T.MAX_TEXTURE_SIZE));
d.Ja = !d.Wa;
if (z = d.T.getExtension("WEBGL_debug_renderer_info")) {
A = d.T.getParameter(z.UNMASKED_RENDERER_WEBGL), d.T.getParameter(z.UNMASKED_VENDOR_WEBGL).includes("Google") && A.includes("ANGLE Metal Renderer") && (d.Ja = !1);
}
return d;
}
d = y(!0);
d.Ja || (d = y(!1));
}
return u ? new a(q) : b(q, d.Ja);
};
const g = k.Artboard.prototype["delete"];
k.Artboard.prototype["delete"] = function() {
this.Eb = !0;
g.call(this);
};
const l = k.Artboard.prototype.draw;
k.Artboard.prototype.draw = function(q) {
q.S ? q.S.push(() => {
this.Eb || l.call(this, q.Db);
}) : l.call(this, q);
};
const p = new ea(), m = new ea(), t = new da();
k.requestAnimationFrame = t.requestAnimationFrame.bind(t);
k.cancelAnimationFrame = t.cancelAnimationFrame.bind(t);
k.enableFPSCounter = t.Lb.bind(t);
t.lb = c;
k.resolveAnimationFrame = c;
let v = k.load;
k.load = function(q, u, y = !0) {
const z = new k.FallbackFileAssetLoader();
void 0 !== u && z.addLoader(u);
y && (u = new k.CDNFileAssetLoader(), z.addLoader(u));
return Promise.resolve(v(q, z));
};
const x = k.WebGL2Renderer.prototype.clear;
k.WebGL2Renderer.prototype.clear = function() {
ja(this.Ka);
const q = this.F;
if (this.La != q.width || this.Xa != q.height) {
this.resize(q.width, q.height), this.La = q.width, this.Xa = q.height;
}
x.call(this);
};
k.decodeImage = function(q, u) {
q = k.decodeWebGL2Image(q);
u(q);
};
let n = k.Renderer.prototype.align;
k.Renderer.prototype.align = function(q, u, y, z, A = 1.0) {
n.call(this, q, u, y, z, A);
};
};
var ka = Object.assign({}, k), la = "./this.program", ma = "object" == typeof window, na = "function" == typeof importScripts, B = "", oa, pa;
if (ma || na) {
na ? B = self.location.href : "undefined" != typeof document && document.currentScript && (B = document.currentScript.src), _scriptDir && (B = _scriptDir), 0 !== B.indexOf("blob:") ? B = B.substr(0, B.replace(/[?#].*/, "").lastIndexOf("/") + 1) : B = "", na && (pa = a => {
var b = new XMLHttpRequest();
b.open("GET", a, !1);
b.responseType = "arraybuffer";
b.send(null);
return new Uint8Array(b.response);
}), oa = (a, b, c) => {
var d = new XMLHttpRequest();
d.open("GET", a, !0);
d.responseType = "arraybuffer";
d.onload = () => {
200 == d.status || 0 == d.status && d.response ? b(d.response) : c();
};
d.onerror = c;
d.send(null);
};
}
var qa = k.print || console.log.bind(console), ra = k.printErr || console.error.bind(console);
Object.assign(k, ka);
ka = null;
k.thisProgram && (la = k.thisProgram);
var sa;
k.wasmBinary && (sa = k.wasmBinary);
var noExitRuntime = k.noExitRuntime || !0;
"object" != typeof WebAssembly && ta("no native wasm support detected");
var ua, C, va = !1, D, F, G, wa, J, K, xa, ya;
function za() {
var a = ua.buffer;
k.HEAP8 = D = new Int8Array(a);
k.HEAP16 = G = new Int16Array(a);
k.HEAP32 = J = new Int32Array(a);
k.HEAPU8 = F = new Uint8Array(a);
k.HEAPU16 = wa = new Uint16Array(a);
k.HEAPU32 = K = new Uint32Array(a);
k.HEAPF32 = xa = new Float32Array(a);
k.HEAPF64 = ya = new Float64Array(a);
}
var Aa, Ba = [], Ca = [], Da = [];
function Ea() {
var a = k.preRun.shift();
Ba.unshift(a);
}
var Fa = 0, Ga = null, Ha = null;
function ta(a) {
if (k.onAbort) {
k.onAbort(a);
}
a = "Aborted(" + a + ")";
ra(a);
va = !0;
a = new WebAssembly.RuntimeError(a + ". Build with -sASSERTIONS for more info.");
ca(a);
throw a;
}
function Ia(a) {
return a.startsWith("data:application/octet-stream;base64,");
}
var Ja;
Ja = "webgl2_advanced.wasm";
if (!Ia(Ja)) {
var Ka = Ja;
Ja = k.locateFile ? k.locateFile(Ka, B) : B + Ka;
}
function La(a) {
if (a == Ja && sa) {
return new Uint8Array(sa);
}
if (pa) {
return pa(a);
}
throw "both async and sync fetching of the wasm failed";
}
function Ma(a) {
if (!sa && (ma || na)) {
if ("function" == typeof fetch && !a.startsWith("file://")) {
return fetch(a, {credentials:"same-origin"}).then(b => {
if (!b.ok) {
throw "failed to load wasm binary file at '" + a + "'";
}
return b.arrayBuffer();
}).catch(() => La(a));
}
if (oa) {
return new Promise((b, c) => {
oa(a, d => b(new Uint8Array(d)), c);
});
}
}
return Promise.resolve().then(() => La(a));
}
function Na(a, b, c) {
return Ma(a).then(d => WebAssembly.instantiate(d, b)).then(d => d).then(c, d => {
ra("failed to asynchronously prepare wasm: " + d);
ta(d);
});
}
function Oa(a, b) {
var c = Ja;
return sa || "function" != typeof WebAssembly.instantiateStreaming || Ia(c) || c.startsWith("file://") || "function" != typeof fetch ? Na(c, a, b) : fetch(c, {credentials:"same-origin"}).then(d => WebAssembly.instantiateStreaming(d, a).then(b, function(e) {
ra("wasm streaming compile failed: " + e);
ra("falling back to ArrayBuffer instantiation");
return Na(c, a, b);
}));
}
var Pa, Qa, Ua = {522615:(a, b, c, d, e) => {
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
return 0;
}
if ("undefined" === typeof window.h) {
window.h = {Da:0};
window.h.I = {};
window.h.I.Ba = a;
window.h.I.capture = b;
window.h.I.Na = c;
window.h.ja = {};
window.h.ja.stopped = d;
window.h.ja.ub = e;
let f = window.h;
f.D = [];
f.oc = function(g) {
for (var l = 0; l < f.D.length; ++l) {
if (null == f.D[l]) {
return f.D[l] = g, l;
}
}
f.D.push(g);
return f.D.length - 1;
};
f.yb = function(g) {
for (f.D[g] = null; 0 < f.D.length;) {
if (null == f.D[f.D.length - 1]) {
f.D.pop();
} else {
break;
}
}
};
f.Qc = function(g) {
for (var l = 0; l < f.D.length; ++l) {
if (f.D[l] == g) {
return f.yb(l);
}
}
};
f.va = function(g) {
return f.D[g];
};
f.Va = ["touchend", "click"];
f.unlock = function() {
for (var g = 0; g < f.D.length; ++g) {
var l = f.D[g];
null != l && null != l.J && l.state === f.ja.ub && l.J.resume().then(() => {
Ra(l.mb);
}, p => {
console.error("Failed to resume audiocontext", p);
});
}
f.Va.map(function(p) {
document.removeEventListener(p, f.unlock, !0);
});
};
f.Va.map(function(g) {
document.addEventListener(g, f.unlock, !0);
});
}
window.h.Da += 1;
return 1;
}, 524793:() => {
"undefined" !== typeof window.h && (window.h.Va.map(function(a) {
document.removeEventListener(a, window.h.unlock, !0);
}), --window.h.Da, 0 === window.h.Da && delete window.h);
}, 525097:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 525201:() => {
try {
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
a.close();
return b;
} catch (c) {
return 0;
}
}, 525372:(a, b, c, d, e, f) => {
if ("undefined" === typeof window.h) {
return -1;
}
var g = {}, l = {};
a == window.h.I.Ba && 0 != c && (l.sampleRate = c);
g.J = new (window.AudioContext || window.webkitAudioContext)(l);
g.J.suspend();
g.state = window.h.ja.stopped;
c = 0;
a != window.h.I.Ba && (c = b);
g.Z = g.J.createScriptProcessor(d, c, b);
g.Z.onaudioprocess = function(p) {
if (null == g.wa || 0 == g.wa.length) {
g.wa = new Float32Array(xa.buffer, e, d * b);
}
if (a == window.h.I.capture || a == window.h.I.Na) {
for (var m = 0; m < b; m += 1) {
for (var t = p.inputBuffer.getChannelData(m), v = g.wa, x = 0; x < d; x += 1) {
v[x * b + m] = t[x];
}
}
Sa(f, d, e);
}
if (a == window.h.I.Ba || a == window.h.I.Na) {
for (Ta(f, d, e), m = 0; m < p.outputBuffer.numberOfChannels; ++m) {
for (t = p.outputBuffer.getChannelData(m), v = g.wa, x = 0; x < d; x += 1) {
t[x] = v[x * b + m];
}
}
} else {
for (m = 0; m < p.outputBuffer.numberOfChannels; ++m) {
p.outputBuffer.getChannelData(m).fill(0.0);
}
}
};
a != window.h.I.capture && a != window.h.I.Na || navigator.mediaDevices.getUserMedia({audio:!0, video:!1}).then(function(p) {
g.Ea = g.J.createMediaStreamSource(p);
g.Ea.connect(g.Z);
g.Z.connect(g.J.destination);
}).catch(function(p) {
console.log("Failed to get user media: " + p);
});
a == window.h.I.Ba && g.Z.connect(g.J.destination);
g.mb = f;
return window.h.oc(g);
}, 528249:a => window.h.va(a).J.sampleRate, 528322:a => {
a = window.h.va(a);
void 0 !== a.Z && (a.Z.onaudioprocess = function() {
}, a.Z.disconnect(), a.Z = void 0);
void 0 !== a.Ea && (a.Ea.disconnect(), a.Ea = void 0);
a.J.close();
a.J = void 0;
a.mb = void 0;
}, 528722:a => {
window.h.yb(a);
}, 528772:a => {
a = window.h.va(a);
a.J.resume();
a.state = window.h.ja.ub;
}, 528911:a => {
a = window.h.va(a);
a.J.suspend();
a.state = window.h.ja.stopped;
}}, Va = a => {
for (; 0 < a.length;) {
a.shift()(k);
}
}, Wa = (a, b) => {
for (var c = 0, d = a.length - 1; 0 <= d; d--) {
var e = a[d];
"." === e ? a.splice(d, 1) : ".." === e ? (a.splice(d, 1), c++) : c && (a.splice(d, 1), c--);
}
if (b) {
for (; c; c--) {
a.unshift("..");
}
}
return a;
}, Xa = a => {
var b = "/" === a.charAt(0), c = "/" === a.substr(-1);
(a = Wa(a.split("/").filter(d => !!d), !b).join("/")) || b || (a = ".");
a && c && (a += "/");
return (b ? "/" : "") + a;
}, Ya = a => {
var b = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);
a = b[0];
b = b[1];
if (!a && !b) {
return ".";
}
b && (b = b.substr(0, b.length - 1));
return a + b;
}, Za = a => {
if ("/" === a) {
return "/";
}
a = Xa(a);
a = a.replace(/\/$/, "");
var b = a.lastIndexOf("/");
return -1 === b ? a : a.substr(b + 1);
}, $a = () => {
if ("object" == typeof crypto && "function" == typeof crypto.getRandomValues) {
return a => crypto.getRandomValues(a);
}
ta("initRandomDevice");
}, ab = a => (ab = $a())(a);
function bb() {
for (var a = "", b = !1, c = arguments.length - 1; -1 <= c && !b; c--) {
b = 0 <= c ? arguments[c] : "/";
if ("string" != typeof b) {
throw new TypeError("Arguments to path.resolve must be strings");
}
if (!b) {
return "";
}
a = b + "/" + a;
b = "/" === b.charAt(0);
}
a = Wa(a.split("/").filter(d => !!d), !b).join("/");
return (b ? "/" : "") + a || ".";
}
var cb = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0, M = (a, b, c) => {
var d = b + c;
for (c = b; a[c] && !(c >= d);) {
++c;
}
if (16 < c - b && a.buffer && cb) {
return cb.decode(a.subarray(b, c));
}
for (d = ""; b < c;) {
var e = a[b++];
if (e & 128) {
var f = a[b++] & 63;
if (192 == (e & 224)) {
d += String.fromCharCode((e & 31) << 6 | f);
} else {
var g = a[b++] & 63;
e = 224 == (e & 240) ? (e & 15) << 12 | f << 6 | g : (e & 7) << 18 | f << 12 | g << 6 | a[b++] & 63;
65536 > e ? d += String.fromCharCode(e) : (e -= 65536, d += String.fromCharCode(55296 | e >> 10, 56320 | e & 1023));
}
} else {
d += String.fromCharCode(e);
}
}
return d;
}, db = [], eb = a => {
for (var b = 0, c = 0; c < a.length; ++c) {
var d = a.charCodeAt(c);
127 >= d ? b++ : 2047 >= d ? b += 2 : 55296 <= d && 57343 >= d ? (b += 4, ++c) : b += 3;
}
return b;
}, fb = (a, b, c, d) => {
if (!(0 < d)) {
return 0;
}
var e = c;
d = c + d - 1;
for (var f = 0; f < a.length; ++f) {
var g = a.charCodeAt(f);
if (55296 <= g && 57343 >= g) {
var l = a.charCodeAt(++f);
g = 65536 + ((g & 1023) << 10) | l & 1023;
}
if (127 >= g) {
if (c >= d) {
break;
}
b[c++] = g;
} else {
if (2047 >= g) {
if (c + 1 >= d) {
break;
}
b[c++] = 192 | g >> 6;
} else {
if (65535 >= g) {
if (c + 2 >= d) {
break;
}
b[c++] = 224 | g >> 12;
} else {
if (c + 3 >= d) {
break;
}
b[c++] = 240 | g >> 18;
b[c++] = 128 | g >> 12 & 63;
}
b[c++] = 128 | g >> 6 & 63;
}
b[c++] = 128 | g & 63;
}
}
b[c] = 0;
return c - e;
};
function gb(a, b) {
var c = Array(eb(a) + 1);
a = fb(a, c, 0, c.length);
b && (c.length = a);
return c;
}
var hb = [];
function ib(a, b) {
hb[a] = {input:[], G:[], V:b};
jb(a, kb);
}
var kb = {open:function(a) {
var b = hb[a.node.Ca];
if (!b) {
throw new N(43);
}
a.s = b;
a.seekable = !1;
}, close:function(a) {
a.s.V.ua(a.s);
}, ua:function(a) {
a.s.V.ua(a.s);
}, read:function(a, b, c, d) {
if (!a.s || !a.s.V.gb) {
throw new N(60);
}
for (var e = 0, f = 0; f < d; f++) {
try {
var g = a.s.V.gb(a.s);
} catch (l) {
throw new N(29);
}
if (void 0 === g && 0 === e) {
throw new N(6);
}
if (null === g || void 0 === g) {
break;
}
e++;
b[c + f] = g;
}
e && (a.node.timestamp = Date.now());
return e;
}, write:function(a, b, c, d) {
if (!a.s || !a.s.V.Qa) {
throw new N(60);
}
try {
for (var e = 0; e < d; e++) {
a.s.V.Qa(a.s, b[c + e]);
}
} catch (f) {
throw new N(29);
}
d && (a.node.timestamp = Date.now());
return e;
},}, lb = {gb:function() {
a: {
if (!db.length) {
var a = null;
"undefined" != typeof window && "function" == typeof window.prompt ? (a = window.prompt("Input: "), null !== a && (a += "\n")) : "function" == typeof readline && (a = readline(), null !== a && (a += "\n"));
if (!a) {
a = null;
break a;
}
db = gb(a, !0);
}
a = db.shift();
}
return a;
}, Qa:function(a, b) {
null === b || 10 === b ? (qa(M(a.G, 0)), a.G = []) : 0 != b && a.G.push(b);
}, ua:function(a) {
a.G && 0 < a.G.length && (qa(M(a.G, 0)), a.G = []);
}, Xb:function() {
return {uc:25856, wc:5, tc:191, vc:35387, sc:[3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]};
}, Yb:function() {
return 0;
}, Zb:function() {
return [24, 80];
},}, mb = {Qa:function(a, b) {
null === b || 10 === b ? (ra(M(a.G, 0)), a.G = []) : 0 != b && a.G.push(b);
}, ua:function(a) {
a.G && 0 < a.G.length && (ra(M(a.G, 0)), a.G = []);
},};
function nb(a, b) {
var c = a.j ? a.j.length : 0;
c >= b || (b = Math.max(b, c * (1048576 > c ? 2.0 : 1.125) >>> 0), 0 != c && (b = Math.max(b, 256)), c = a.j, a.j = new Uint8Array(b), 0 < a.v && a.j.set(c.subarray(0, a.v), 0));
}
var O = {O:null, U() {
return O.createNode(null, "/", 16895, 0);
}, createNode(a, b, c, d) {
if (24576 === (c & 61440) || 4096 === (c & 61440)) {
throw new N(63);
}
O.O || (O.O = {dir:{node:{Y:O.l.Y, P:O.l.P, ma:O.l.ma, za:O.l.za, sb:O.l.sb, xb:O.l.xb, tb:O.l.tb, qb:O.l.qb, Fa:O.l.Fa}, stream:{ba:O.m.ba}}, file:{node:{Y:O.l.Y, P:O.l.P}, stream:{ba:O.m.ba, read:O.m.read, write:O.m.write, ta:O.m.ta, ib:O.m.ib, kb:O.m.kb}}, link:{node:{Y:O.l.Y, P:O.l.P, na:O.l.na}, stream:{}}, Ya:{node:{Y:O.l.Y, P:O.l.P}, stream:ob}});
c = pb(a, b, c, d);
16384 === (c.mode & 61440) ? (c.l = O.O.dir.node, c.m = O.O.dir.stream, c.j = {}) : 32768 === (c.mode & 61440) ? (c.l = O.O.file.node, c.m = O.O.file.stream, c.v = 0, c.j = null) : 40960 === (c.mode & 61440) ? (c.l = O.O.link.node, c.m = O.O.link.stream) : 8192 === (c.mode & 61440) && (c.l = O.O.Ya.node, c.m = O.O.Ya.stream);
c.timestamp = Date.now();
a && (a.j[b] = c, a.timestamp = c.timestamp);
return c;
}, Bc(a) {
return a.j ? a.j.subarray ? a.j.subarray(0, a.v) : new Uint8Array(a.j) : new Uint8Array(0);
}, l:{Y(a) {
var b = {};
b.zc = 8192 === (a.mode & 61440) ? a.id : 1;
b.Dc = a.id;
b.mode = a.mode;
b.Lc = 1;
b.uid = 0;
b.Cc = 0;
b.Ca = a.Ca;
16384 === (a.mode & 61440) ? b.size = 4096 : 32768 === (a.mode & 61440) ? b.size = a.v : 40960 === (a.mode & 61440) ? b.size = a.link.length : b.size = 0;
b.qc = new Date(a.timestamp);
b.Jc = new Date(a.timestamp);
b.xc = new Date(a.timestamp);
b.Fb = 4096;
b.rc = Math.ceil(b.size / b.Fb);
return b;
}, P(a, b) {
void 0 !== b.mode && (a.mode = b.mode);
void 0 !== b.timestamp && (a.timestamp = b.timestamp);
if (void 0 !== b.size && (b = b.size, a.v != b)) {
if (0 == b) {
a.j = null, a.v = 0;
} else {
var c = a.j;
a.j = new Uint8Array(b);
c && a.j.set(c.subarray(0, Math.min(b, a.v)));
a.v = b;
}
}
}, ma() {
throw qb[44];
}, za(a, b, c, d) {
return O.createNode(a, b, c, d);
}, sb(a, b, c) {
if (16384 === (a.mode & 61440)) {
try {
var d = rb(b, c);
} catch (f) {
}
if (d) {
for (var e in d.j) {
throw new N(55);
}
}
}
delete a.parent.j[a.name];
a.parent.timestamp = Date.now();
a.name = c;
b.j[c] = a;
b.timestamp = a.parent.timestamp;
a.parent = b;
}, xb(a, b) {
delete a.j[b];
a.timestamp = Date.now();
}, tb(a, b) {
var c = rb(a, b), d;
for (d in c.j) {
throw new N(55);
}
delete a.j[b];
a.timestamp = Date.now();
}, qb(a) {
var b = [".", ".."], c;
for (c in a.j) {
a.j.hasOwnProperty(c) && b.push(c);
}
return b;
}, Fa(a, b, c) {
a = O.createNode(a, b, 41471, 0);
a.link = c;
return a;
}, na(a) {
if (40960 !== (a.mode & 61440)) {
throw new N(28);
}
return a.link;
},}, m:{read(a, b, c, d, e) {
var f = a.node.j;
if (e >= a.node.v) {
return 0;
}
a = Math.min(a.node.v - e, d);
if (8 < a && f.subarray) {
b.set(f.subarray(e, e + a), c);
} else {
for (d = 0; d < a; d++) {
b[c + d] = f[e + d];
}
}
return a;
}, write(a, b, c, d, e, f) {
b.buffer === D.buffer && (f = !1);
if (!d) {
return 0;
}
a = a.node;
a.timestamp = Date.now();
if (b.subarray && (!a.j || a.j.subarray)) {
if (f) {
return a.j = b.subarray(c, c + d), a.v = d;
}
if (0 === a.v && 0 === e) {
return a.j = b.slice(c, c + d), a.v = d;
}
if (e + d <= a.v) {
return a.j.set(b.subarray(c, c + d), e), d;
}
}
nb(a, e + d);
if (a.j.subarray && b.subarray) {
a.j.set(b.subarray(c, c + d), e);
} else {
for (f = 0; f < d; f++) {
a.j[e + f] = b[c + f];
}
}
a.v = Math.max(a.v, e + d);
return d;
}, ba(a, b, c) {
1 === c ? b += a.position : 2 === c && 32768 === (a.node.mode & 61440) && (b += a.node.v);
if (0 > b) {
throw new N(28);
}
return b;
}, ta(a, b, c) {
nb(a.node, b + c);
a.node.v = Math.max(a.node.v, b + c);
}, ib(a, b, c, d, e) {
if (32768 !== (a.node.mode & 61440)) {
throw new N(43);
}
a = a.node.j;
if (e & 2 || a.buffer !== D.buffer) {
if (0 < c || c + b < a.length) {
a.subarray ? a = a.subarray(c, c + b) : a = Array.prototype.slice.call(a, c, c + b);
}
c = !0;
ta();
b = void 0;
if (!b) {
throw new N(48);
}
D.set(a, b);
} else {
c = !1, b = a.byteOffset;
}
return {o:b, M:c};
}, kb(a, b, c, d) {
O.m.write(a, b, 0, d, c, !1);
return 0;
},},};
function sb(a, b) {
var c = 0;
a && (c |= 365);
b && (c |= 146);
return c;
}
var ub = null, vb = {}, wb = [], xb = 1, yb = null, zb = !0, N = null, qb = {}, Bb = (a, b = {}) => {
a = bb(a);
if (!a) {
return {path:"", node:null};
}
b = Object.assign({eb:!0, Sa:0}, b);
if (8 < b.Sa) {
throw new N(32);
}
a = a.split("/").filter(g => !!g);
for (var c = ub, d = "/", e = 0; e < a.length; e++) {
var f = e === a.length - 1;
if (f && b.parent) {
break;
}
c = rb(c, a[e]);
d = Xa(d + "/" + a[e]);
c.Aa && (!f || f && b.eb) && (c = c.Aa.root);
if (!f || b.cb) {
for (f = 0; 40960 === (c.mode & 61440);) {
if (c = Ab(d), d = bb(Ya(d), c), c = Bb(d, {Sa:b.Sa + 1}).node, 40 < f++) {
throw new N(32);
}
}
}
}
return {path:d, node:c};
}, Cb = a => {
for (var b;;) {
if (a === a.parent) {
return a = a.U.jb, b ? "/" !== a[a.length - 1] ? `${a}/${b}` : a + b : a;
}
b = b ? `${a.name}/${b}` : a.name;
a = a.parent;
}
}, Db = (a, b) => {
for (var c = 0, d = 0; d < b.length; d++) {
c = (c << 5) - c + b.charCodeAt(d) | 0;
}
return (a + c >>> 0) % yb.length;
}, rb = (a, b) => {
var c;
if (c = (c = Eb(a, "x")) ? c : a.l.ma ? 0 : 2) {
throw new N(c, a);
}
for (c = yb[Db(a.id, b)]; c; c = c.bc) {
var d = c.name;
if (c.parent.id === a.id && d === b) {
return c;
}
}
return a.l.ma(a, b);
}, pb = (a, b, c, d) => {
a = new Fb(a, b, c, d);
b = Db(a.parent.id, a.name);
a.bc = yb[b];
return yb[b] = a;
}, Gb = a => {
var b = ["r", "w", "rw"][a & 3];
a & 512 && (b += "w");
return b;
}, Eb = (a, b) => {
if (zb) {
return 0;
}
if (!b.includes("r") || a.mode & 292) {
if (b.includes("w") && !(a.mode & 146) || b.includes("x") && !(a.mode & 73)) {
return 2;
}
} else {
return 2;
}
return 0;
}, Hb = (a, b) => {
try {
return rb(a, b), 20;
} catch (c) {
}
return Eb(a, "wx");
}, Ib = () => {
for (var a = 0; 4096 >= a; a++) {
if (!wb[a]) {
return a;
}
}
throw new N(33);
}, Jb = a => {
a = wb[a];
if (!a) {
throw new N(8);
}
return a;
}, Lb = (a, b = -1) => {
Kb || (Kb = function() {
this.h = {};
}, Kb.prototype = {}, Object.defineProperties(Kb.prototype, {object:{get() {
return this.node;
}, set(c) {
this.node = c;
}}, flags:{get() {
return this.h.flags;
}, set(c) {
this.h.flags = c;
},}, position:{get() {
return this.h.position;
}, set(c) {
this.h.position = c;
},},}));
a = Object.assign(new Kb(), a);
-1 == b && (b = Ib());
a.X = b;
return wb[b] = a;
}, ob = {open:a => {
a.m = vb[a.node.Ca].m;
a.m.open && a.m.open(a);
}, ba:() => {
throw new N(70);
},}, jb = (a, b) => {
vb[a] = {m:b};
}, Mb = (a, b) => {
var c = "/" === b, d = !b;
if (c && ub) {
throw new N(10);
}
if (!c && !d) {
var e = Bb(b, {eb:!1});
b = e.path;
e = e.node;
if (e.Aa) {
throw new N(10);
}
if (16384 !== (e.mode & 61440)) {
throw new N(54);
}
}
b = {type:a, Nc:{}, jb:b, ac:[]};
a = a.U(b);
a.U = b;
b.root = a;
c ? ub = a : e && (e.Aa = b, e.U && e.U.ac.push(b));
}, P = (a, b, c) => {
var d = Bb(a, {parent:!0}).node;
a = Za(a);
if (!a || "." === a || ".." === a) {
throw new N(28);
}
var e = Hb(d, a);
if (e) {
throw new N(e);
}
if (!d.l.za) {
throw new N(63);
}
return d.l.za(d, a, b, c);
}, Nb = (a, b, c) => {
"undefined" == typeof c && (c = b, b = 438);
P(a, b | 8192, c);
}, Ob = (a, b) => {
if (!bb(a)) {
throw new N(44);
}
var c = Bb(b, {parent:!0}).node;
if (!c) {
throw new N(44);
}
b = Za(b);
var d = Hb(c, b);
if (d) {
throw new N(d);
}
if (!c.l.Fa) {
throw new N(63);
}
c.l.Fa(c, b, a);
}, Ab = a => {
a = Bb(a).node;
if (!a) {
throw new N(44);
}
if (!a.l.na) {
throw new N(28);
}
return bb(Cb(a.parent), a.l.na(a));
}, Qb = (a, b, c) => {
if ("" === a) {
throw new N(44);
}
if ("string" == typeof b) {
var d = {r:0, "r+":2, w:577, "w+":578, a:1089, "a+":1090,}[b];
if ("undefined" == typeof d) {
throw Error(`Unknown file open mode: ${b}`);
}
b = d;
}
c = b & 64 ? ("undefined" == typeof c ? 438 : c) & 4095 | 32768 : 0;
if ("object" == typeof a) {
var e = a;
} else {
a = Xa(a);
try {
e = Bb(a, {cb:!(b & 131072)}).node;
} catch (f) {
}
}
d = !1;
if (b & 64) {
if (e) {
if (b & 128) {
throw new N(20);
}
} else {
e = P(a, c, 0), d = !0;
}
}
if (!e) {
throw new N(44);
}
8192 === (e.mode & 61440) && (b &= -513);
if (b & 65536 && 16384 !== (e.mode & 61440)) {
throw new N(54);
}
if (!d && (c = e ? 40960 === (e.mode & 61440) ? 32 : 16384 === (e.mode & 61440) && ("r" !== Gb(b) || b & 512) ? 31 : Eb(e, Gb(b)) : 44)) {
throw new N(c);
}
if (b & 512 && !d) {
c = e;
c = "string" == typeof c ? Bb(c, {cb:!0}).node : c;
if (!c.l.P) {
throw new N(63);
}
if (16384 === (c.mode & 61440)) {
throw new N(31);
}
if (32768 !== (c.mode & 61440)) {
throw new N(28);
}
if (d = Eb(c, "w")) {
throw new N(d);
}
c.l.P(c, {size:0, timestamp:Date.now()});
}
b &= -131713;
e = Lb({node:e, path:Cb(e), flags:b, seekable:!0, position:0, m:e.m, pc:[], error:!1});
e.m.open && e.m.open(e);
!k.logReadFiles || b & 1 || (Pb || (Pb = {}), a in Pb || (Pb[a] = 1));
return e;
}, Rb = (a, b, c) => {
if (null === a.X) {
throw new N(8);
}
if (!a.seekable || !a.m.ba) {
throw new N(70);
}
if (0 != c && 1 != c && 2 != c) {
throw new N(28);
}
a.position = a.m.ba(a, b, c);
a.pc = [];
}, Sb = () => {
N || (N = function(a, b) {
this.name = "ErrnoError";
this.node = b;
this.ec = function(c) {
this.aa = c;
};
this.ec(a);
this.message = "FS error";
}, N.prototype = Error(), N.prototype.constructor = N, [44].forEach(a => {
qb[a] = new N(a);
qb[a].stack = "<generic error, no stack>";
}));
}, Tb, Vb = (a, b, c) => {
a = Xa("/dev/" + a);
var d = sb(!!b, !!c);
Ub || (Ub = 64);
var e = Ub++ << 8 | 0;
jb(e, {open:f => {
f.seekable = !1;
}, close:() => {
c && c.buffer && c.buffer.length && c(10);
}, read:(f, g, l, p) => {
for (var m = 0, t = 0; t < p; t++) {
try {
var v = b();
} catch (x) {
throw new N(29);
}
if (void 0 === v && 0 === m) {
throw new N(6);
}
if (null === v || void 0 === v) {
break;
}
m++;
g[l + t] = v;
}
m && (f.node.timestamp = Date.now());
return m;
}, write:(f, g, l, p) => {
for (var m = 0; m < p; m++) {
try {
c(g[l + m]);
} catch (t) {
throw new N(29);
}
}
p && (f.node.timestamp = Date.now());
return m;
}});
Nb(a, d, e);
}, Ub, Wb = {}, Kb, Pb, Xb = void 0;
function Yb() {
Xb += 4;
return J[Xb - 4 >> 2];
}
function Zb(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;
}
function $b(a, b) {
a = Zb(a);
return {[a]:function() {
return b.apply(this, arguments);
}}[a];
}
function ac() {
this.M = [void 0];
this.fb = [];
}
var Q = new ac(), bc = void 0;
function R(a) {
throw new bc(a);
}
var S = a => {
a || R("Cannot use deleted val. handle = " + a);
return Q.get(a).value;
}, T = a => {
switch(a) {
case void 0:
return 1;
case null:
return 2;
case !0:
return 3;
case !1:
return 4;
default:
return Q.ta({rb:1, value:a});
}
};
function cc(a) {
var b = Error, c = $b(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;
}
var dc = void 0, ec = void 0;
function U(a) {
for (var b = ""; F[a];) {
b += ec[F[a++]];
}
return b;
}
var fc = [];
function gc() {
for (; fc.length;) {
var a = fc.pop();
a.g.ia = !1;
a["delete"]();
}
}
var hc = void 0, ic = {};
function jc(a, b) {
for (void 0 === b && R("ptr should not be undefined"); a.A;) {
b = a.pa(b), a = a.A;
}
return b;
}
var kc = {};
function lc(a) {
a = mc(a);
var b = U(a);
nc(a);
return b;
}
function oc(a, b) {
var c = kc[a];
void 0 === c && R(b + " has unknown type " + lc(a));
return c;
}
function pc() {
}
var qc = !1;
function rc(a) {
--a.count.value;
0 === a.count.value && (a.H ? a.L.W(a.H) : a.u.i.W(a.o));
}
function sc(a, b, c) {
if (b === c) {
return a;
}
if (void 0 === c.A) {
return null;
}
a = sc(a, b, c.A);
return null === a ? null : c.Jb(a);
}
var tc = {};
function uc(a, b) {
b = jc(a, b);
return ic[b];
}
var vc = void 0;
function wc(a) {
throw new vc(a);
}
function xc(a, b) {
b.u && b.o || wc("makeClassHandle requires ptr and ptrType");
!!b.L !== !!b.H && wc("Both smartPtrType and smartPtr must be specified");
b.count = {value:1};
return yc(Object.create(a, {g:{value:b,},}));
}
function yc(a) {
if ("undefined" === typeof FinalizationRegistry) {
return yc = b => b, a;
}
qc = new FinalizationRegistry(b => {
rc(b.g);
});
yc = b => {
var c = b.g;
c.H && qc.register(b, {g:c}, b);
return b;
};
pc = b => {
qc.unregister(b);
};
return yc(a);
}
var zc = {};
function Ac(a) {
for (; a.length;) {
var b = a.pop();
a.pop()(b);
}
}
function Bc(a) {
return this.fromWireType(J[a >> 2]);
}
var Cc = {}, Dc = {};
function V(a, b, c) {
function d(l) {
l = c(l);
l.length !== a.length && wc("Mismatched type converter count");
for (var p = 0; p < a.length; ++p) {
W(a[p], l[p]);
}
}
a.forEach(function(l) {
Dc[l] = b;
});
var e = Array(b.length), f = [], g = 0;
b.forEach((l, p) => {
kc.hasOwnProperty(l) ? e[p] = kc[l] : (f.push(l), Cc.hasOwnProperty(l) || (Cc[l] = []), Cc[l].push(() => {
e[p] = kc[l];
++g;
g === f.length && d(e);
}));
});
0 === f.length && d(e);
}
function Ec(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}`);
}
}
function Fc(a, b, c = {}) {
var d = b.name;
a || R(`type "${d}" must have a positive integer typeid pointer`);
if (kc.hasOwnProperty(a)) {
if (c.Ub) {
return;
}
R(`Cannot register type '${d}' twice`);
}
kc[a] = b;
delete Dc[a];
Cc.hasOwnProperty(a) && (b = Cc[a], delete Cc[a], b.forEach(e => e()));
}
function W(a, b, c = {}) {
if (!("argPackAdvance" in b)) {
throw new TypeError("registerType registeredInstance requires argPackAdvance");
}
Fc(a, b, c);
}
function Gc(a) {
R(a.g.u.i.name + " instance already deleted");
}
function Hc() {
}
function Ic(a, b, c) {
if (void 0 === a[b].B) {
var d = a[b];
a[b] = function() {
a[b].B.hasOwnProperty(arguments.length) || R(`Function '${c}' called with an invalid number of arguments (${arguments.length}) - expects one of (${a[b].B})!`);
return a[b].B[arguments.length].apply(this, arguments);
};
a[b].B = [];
a[b].B[d.ha] = d;
}
}
function Jc(a, b, c) {
k.hasOwnProperty(a) ? ((void 0 === c || void 0 !== k[a].B && void 0 !== k[a].B[c]) && R(`Cannot register public name '${a}' twice`), Ic(k, a, a), k.hasOwnProperty(c) && R(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`), k[a].B[c] = b) : (k[a] = b, void 0 !== c && (k[a].Mc = c));
}
function Kc(a, b, c, d, e, f, g, l) {
this.name = a;
this.constructor = b;
this.N = c;
this.W = d;
this.A = e;
this.Ob = f;
this.pa = g;
this.Jb = l;
this.nb = [];
}
function Lc(a, b, c) {
for (; b !== c;) {
b.pa || R(`Expected null or instance of ${c.name}, got an instance of ${b.name}`), a = b.pa(a), b = b.A;
}
return a;
}
function Mc(a, b) {
if (null === b) {
return this.Pa && R(`null is not a valid ${this.name}`), 0;
}
b.g || R(`Cannot pass "${Nc(b)}" as a ${this.name}`);
b.g.o || R(`Cannot pass deleted object as a pointer of type ${this.name}`);
return Lc(b.g.o, b.g.u.i, this.i);
}
function Oc(a, b) {
if (null === b) {
this.Pa && R(`null is not a valid ${this.name}`);
if (this.ya) {
var c = this.Ra();
null !== a && a.push(this.W, c);
return c;
}
return 0;
}
b.g || R(`Cannot pass "${Nc(b)}" as a ${this.name}`);
b.g.o || R(`Cannot pass deleted object as a pointer of type ${this.name}`);
!this.xa && b.g.u.xa && R(`Cannot convert argument of type ${b.g.L ? b.g.L.name : b.g.u.name} to parameter type ${this.name}`);
c = Lc(b.g.o, b.g.u.i, this.i);
if (this.ya) {
switch(void 0 === b.g.H && R("Passing raw pointer to smart pointer is illegal"), this.jc) {
case 0:
b.g.L === this ? c = b.g.H : R(`Cannot convert argument of type ${b.g.L ? b.g.L.name : b.g.u.name} to parameter type ${this.name}`);
break;
case 1:
c = b.g.H;
break;
case 2:
if (b.g.L === this) {
c = b.g.H;
} else {
var d = b.clone();
c = this.dc(c, T(function() {
d["delete"]();
}));
null !== a && a.push(this.W, c);
}
break;
default:
R("Unsupporting sharing policy");
}
}
return c;
}
function Pc(a, b) {
if (null === b) {
return this.Pa && R(`null is not a valid ${this.name}`), 0;
}
b.g || R(`Cannot pass "${Nc(b)}" as a ${this.name}`);
b.g.o || R(`Cannot pass deleted object as a pointer of type ${this.name}`);
b.g.u.xa && R(`Cannot convert argument of type ${b.g.u.name} to parameter type ${this.name}`);
return Lc(b.g.o, b.g.u.i, this.i);
}
function Qc(a, b, c, d) {
this.name = a;
this.i = b;
this.Pa = c;
this.xa = d;
this.ya = !1;
this.W = this.dc = this.Ra = this.pb = this.jc = this.cc = void 0;
void 0 !== b.A ? this.toWireType = Oc : (this.toWireType = d ? Mc : Pc, this.K = null);
}
function Rc(a, b, c) {
k.hasOwnProperty(a) || wc("Replacing nonexistant public symbol");
void 0 !== k[a].B && void 0 !== c ? k[a].B[c] = b : (k[a] = b, k[a].ha = c);
}
var Sc = [], Tc = a => {
var b = Sc[a];
b || (a >= Sc.length && (Sc.length = a + 1), Sc[a] = b = Aa.get(a));
return b;
}, Uc = (a, b) => {
var c = [];
return function() {
c.length = 0;
Object.assign(c, arguments);
if (a.includes("j")) {
var d = k["dynCall_" + a];
d = c && c.length ? d.apply(null, [b].concat(c)) : d.call(null, b);
} else {
d = Tc(b).apply(null, c);
}
return d;
};
};
function X(a, b) {
a = U(a);
var c = a.includes("j") ? Uc(a, b) : Tc(b);
"function" != typeof c && R(`unknown function pointer with signature ${a}: ${b}`);
return c;
}
var Vc = void 0;
function Wc(a, b) {
function c(f) {
e[f] || kc[f] || (Dc[f] ? Dc[f].forEach(c) : (d.push(f), e[f] = !0));
}
var d = [], e = {};
b.forEach(c);
throw new Vc(`${a}: ` + d.map(lc).join([", "]));
}
function Xc(a, b, c, d, e) {
var f = b.length;
2 > f && R("argTypes array size mismatch! Must at least get return value and 'this' types!");
var g = null !== b[1] && null !== c, l = !1;
for (c = 1; c < b.length; ++c) {
if (null !== b[c] && void 0 === b[c].K) {
l = !0;
break;
}
}
var p = "void" !== b[0].name, m = f - 2, t = Array(m), v = [], x = [];
return function() {
arguments.length !== m && R(`function ${a} called with ${arguments.length} arguments, expected ${m} args!`);
x.length = 0;
v.length = g ? 2 : 1;
v[0] = e;
if (g) {
var n = b[1].toWireType(x, this);
v[1] = n;
}
for (var q = 0; q < m; ++q) {
t[q] = b[q + 2].toWireType(x, arguments[q]), v.push(t[q]);
}
q = d.apply(null, v);
if (l) {
Ac(x);
} else {
for (var u = g ? 1 : 2; u < b.length; u++) {
var y = 1 === u ? n : t[u - 2];
null !== b[u].K && b[u].K(y);
}
}
n = p ? b[0].fromWireType(q) : void 0;
return n;
};
}
function Yc(a, b) {
for (var c = [], d = 0; d < a; d++) {
c.push(K[b + 4 * d >> 2]);
}
return c;
}
function Zc(a, b, c) {
a instanceof Object || R(`${c} with invalid "this": ${a}`);
a instanceof b.i.constructor || R(`${c} incompatible with "this" of type ${a.constructor.name}`);
a.g.o || R(`cannot call emscripten binding method ${c} on deleted object`);
return Lc(a.g.o, a.g.u.i, b.i);
}
function $c(a) {
a >= Q.h && 0 === --Q.get(a).rb && Q.Tb(a);
}
function ad(a, b, c) {
switch(b) {
case 0:
return function(d) {
return this.fromWireType((c ? D : F)[d]);
};
case 1:
return function(d) {
return this.fromWireType((c ? G : wa)[d >> 1]);
};
case 2:
return function(d) {
return this.fromWireType((c ? J : K)[d >> 2]);
};
default:
throw new TypeError("Unknown integer type: " + a);
}
}
function Nc(a) {
if (null === a) {
return "null";
}
var b = typeof a;
return "object" === b || "array" === b || "function" === b ? a.toString() : "" + a;
}
function bd(a, b) {
switch(b) {
case 2:
return function(c) {
return this.fromWireType(xa[c >> 2]);
};
case 3:
return function(c) {
return this.fromWireType(ya[c >> 3]);
};
default:
throw new TypeError("Unknown float type: " + a);
}
}
function cd(a, b, c) {
switch(b) {
case 0:
return c ? function(d) {
return D[d];
} : function(d) {
return F[d];
};
case 1:
return c ? function(d) {
return G[d >> 1];
} : function(d) {
return wa[d >> 1];
};
case 2:
return c ? function(d) {
return J[d >> 2];
} : function(d) {
return K[d >> 2];
};
default:
throw new TypeError("Unknown integer type: " + a);
}
}
var dd = "undefined" != typeof TextDecoder ? new TextDecoder("utf-16le") : void 0, ed = (a, b) => {
var c = a >> 1;
for (var d = c + b / 2; !(c >= d) && wa[c];) {
++c;
}
c <<= 1;
if (32 < c - a && dd) {
return dd.decode(F.subarray(a, c));
}
c = "";
for (d = 0; !(d >= b / 2); ++d) {
var e = G[a + 2 * d >> 1];
if (0 == e) {
break;
}
c += String.fromCharCode(e);
}
return c;
}, fd = (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) {
G[b >> 1] = a.charCodeAt(e), b += 2;
}
G[b >> 1] = 0;
return b - d;
}, gd = a => 2 * a.length, hd = (a, b) => {
for (var c = 0, d = ""; !(c >= b / 4);) {
var e = J[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;
}, jd = (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 g = a.charCodeAt(++e);
f = 65536 + ((f & 1023) << 10) | g & 1023;
}
J[b >> 2] = f;
b += 4;
if (b + 4 > c) {
break;
}
}
J[b >> 2] = 0;
return b - d;
}, kd = 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;
}, ld = {};
function md(a) {
var b = ld[a];
return void 0 === b ? U(a) : b;
}
var nd = [];
function od(a) {
var b = nd.length;
nd.push(a);
return b;
}
function pd(a, b) {
for (var c = Array(a), d = 0; d < a; ++d) {
c[d] = oc(K[b + 4 * d >> 2], "parameter " + d);
}
return c;
}
var qd = [], rd = [];
function sd(a) {
a.Ac = a.getExtension("WEBGL_draw_instanced_base_vertex_base_instance");
}
function td(a) {
a.Ic = a.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance");
}
var ud = 1, vd = [], wd = [], xd = [], yd = [], zd = [], Ad = [], Bd = [], w = [], Cd = {};
function Y(a) {
Dd || (Dd = a);
}
function Ed(a) {
for (var b = ud++, c = a.length; c < b; c++) {
a[c] = null;
}
return b;
}
function ia(a, b) {
var c = Ed(w), d = {handle:c, attributes:b, version:b.Ec, C:a};
a.canvas && (a.canvas.zb = d);
w[c] = d;
("undefined" == typeof b.Kb || b.Kb) && Fd(d);
return c;
}
function ja(a) {
r = w[a];
k.yc = Z = r && r.C;
return !(a && !Z);
}
function Fd(a) {
a || (a = r);
if (!a.Vb) {
a.Vb = !0;
var b = a.C;
sd(b);
td(b);
2 <= a.version && (b.ab = b.getExtension("EXT_disjoint_timer_query_webgl2"));
if (2 > a.version || !b.ab) {
b.ab = b.getExtension("EXT_disjoint_timer_query");
}
Gd(b);
(b.getSupportedExtensions() || []).forEach(function(c) {
c.includes("lose_context") || c.includes("debug") || b.getExtension(c);
});
}
}
var Dd, r;
function Gd(a) {
a.Kc = a.getExtension("WEBGL_multi_draw");
}
var Hd = {}, Jd = () => {
if (!Id) {
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", _:la || "./this.program"}, b;
for (b in Hd) {
void 0 === Hd[b] ? delete a[b] : a[b] = Hd[b];
}
var c = [];
for (b in a) {
c.push(`${b}=${a[b]}`);
}
Id = c;
}
return Id;
}, Id, Kd = [];
function Ld(a, b, c, d) {
for (var e = 0; e < a; e++)