index.es.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. var n = typeof n < "u" ? n : {}, Y = Object.assign({}, n), $ = (e, t) => {
  2. throw t;
  3. }, le = !0, ce = !1, ue = !1, de = !1;
  4. if (n.ENVIRONMENT)
  5. throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");
  6. var _ = "";
  7. function fe(e) {
  8. return n.locateFile ? n.locateFile(e, _) : _ + e;
  9. }
  10. if (typeof document < "u" && document.currentScript && (_ = document.currentScript.src), _.indexOf("blob:") !== 0 ? _ = _.substr(0, _.replace(/[?#].*/, "").lastIndexOf("/") + 1) : _ = "", !(typeof window == "object" || typeof importScripts == "function"))
  11. throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
  12. n.print || console.log.bind(console);
  13. var u = n.printErr || console.error.bind(console);
  14. Object.assign(n, Y);
  15. Y = null;
  16. Ve();
  17. n.arguments && n.arguments;
  18. y("arguments", "arguments_");
  19. n.thisProgram && n.thisProgram;
  20. y("thisProgram", "thisProgram");
  21. n.quit && ($ = n.quit);
  22. y("quit", "quit_");
  23. o(typeof n.memoryInitializerPrefixURL > "u", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");
  24. o(typeof n.pthreadMainPrefixURL > "u", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");
  25. o(typeof n.cdInitializerPrefixURL > "u", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead");
  26. o(typeof n.filePackagePrefixURL > "u", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead");
  27. o(typeof n.read > "u", "Module.read option was removed (modify read_ in JS)");
  28. o(typeof n.readAsync > "u", "Module.readAsync option was removed (modify readAsync in JS)");
  29. o(typeof n.readBinary > "u", "Module.readBinary option was removed (modify readBinary in JS)");
  30. o(typeof n.setWindowTitle > "u", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)");
  31. o(typeof n.TOTAL_MEMORY > "u", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY");
  32. y("asm", "wasmExports");
  33. y("read", "read_");
  34. y("readAsync", "readAsync");
  35. y("readBinary", "readBinary");
  36. y("setWindowTitle", "setWindowTitle");
  37. o(!ce, "worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable.");
  38. o(!ue, "node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable.");
  39. o(!de, "shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");
  40. var I;
  41. n.wasmBinary && (I = n.wasmBinary);
  42. y("wasmBinary", "wasmBinary");
  43. typeof WebAssembly != "object" && p("no native wasm support detected");
  44. var P, C = !1;
  45. function o(e, t) {
  46. e || p("Assertion failed" + (t ? ": " + t : ""));
  47. }
  48. var V, R, v;
  49. function me() {
  50. var e = P.buffer;
  51. n.HEAP8 = V = new Int8Array(e), n.HEAP16 = new Int16Array(e), n.HEAPU8 = R = new Uint8Array(e), n.HEAPU16 = new Uint16Array(e), n.HEAP32 = new Int32Array(e), n.HEAPU32 = v = new Uint32Array(e), n.HEAPF32 = new Float32Array(e), n.HEAPF64 = new Float64Array(e);
  52. }
  53. o(!n.STACK_SIZE, "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time");
  54. o(
  55. typeof Int32Array < "u" && typeof Float64Array < "u" && Int32Array.prototype.subarray != null && Int32Array.prototype.set != null,
  56. "JS engine does not provide full typed array support"
  57. );
  58. o(!n.wasmMemory, "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally");
  59. o(!n.INITIAL_MEMORY, "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");
  60. function pe() {
  61. var e = N();
  62. o((e & 3) == 0), e == 0 && (e += 4), v[e >> 2] = 34821223, v[e + 4 >> 2] = 2310721022, v[0] = 1668509029;
  63. }
  64. function x() {
  65. if (!C) {
  66. var e = N();
  67. e == 0 && (e += 4);
  68. var t = v[e >> 2], r = v[e + 4 >> 2];
  69. (t != 34821223 || r != 2310721022) && p(`Stack overflow! Stack cookie has been overwritten at ${A(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${A(r)} ${A(t)}`), v[0] != 1668509029 && p("Runtime error: The application has corrupted its heap memory area (address zero)!");
  70. }
  71. }
  72. (function() {
  73. var e = new Int16Array(1), t = new Int8Array(e.buffer);
  74. if (e[0] = 25459, t[0] !== 115 || t[1] !== 99)
  75. throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
  76. })();
  77. var j = [], J = [], K = [], U = !1;
  78. function ge() {
  79. if (n.preRun)
  80. for (typeof n.preRun == "function" && (n.preRun = [n.preRun]); n.preRun.length; )
  81. he(n.preRun.shift());
  82. D(j);
  83. }
  84. function ye() {
  85. o(!U), U = !0, x(), D(J);
  86. }
  87. function _e() {
  88. if (x(), n.postRun)
  89. for (typeof n.postRun == "function" && (n.postRun = [n.postRun]); n.postRun.length; )
  90. Te(n.postRun.shift());
  91. D(K);
  92. }
  93. function he(e) {
  94. j.unshift(e);
  95. }
  96. function Ee(e) {
  97. J.unshift(e);
  98. }
  99. function Te(e) {
  100. K.unshift(e);
  101. }
  102. o(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
  103. o(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
  104. o(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
  105. o(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
  106. var b = 0, E = null, S = null, F = {};
  107. function ve(e) {
  108. var t;
  109. b++, (t = n.monitorRunDependencies) == null || t.call(n, b), e ? (o(!F[e]), F[e] = 1, E === null && typeof setInterval < "u" && (E = setInterval(() => {
  110. if (C) {
  111. clearInterval(E), E = null;
  112. return;
  113. }
  114. var r = !1;
  115. for (var i in F)
  116. r || (r = !0, u("still waiting on run dependencies:")), u(`dependency: ${i}`);
  117. r && u("(end of list)");
  118. }, 1e4))) : u("warning: run dependency added without ID");
  119. }
  120. function be(e) {
  121. var r;
  122. if (b--, (r = n.monitorRunDependencies) == null || r.call(n, b), e ? (o(F[e]), delete F[e]) : u("warning: run dependency removed without ID"), b == 0 && (E !== null && (clearInterval(E), E = null), S)) {
  123. var t = S;
  124. S = null, t();
  125. }
  126. }
  127. function p(e) {
  128. var r;
  129. (r = n.onAbort) == null || r.call(n, e), e = "Aborted(" + e + ")", u(e), C = !0;
  130. var t = new WebAssembly.RuntimeError(e);
  131. throw t;
  132. }
  133. var f = {
  134. error() {
  135. p("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM");
  136. },
  137. init() {
  138. f.error();
  139. },
  140. createDataFile() {
  141. f.error();
  142. },
  143. createPreloadedFile() {
  144. f.error();
  145. },
  146. createLazyFile() {
  147. f.error();
  148. },
  149. open() {
  150. f.error();
  151. },
  152. mkdev() {
  153. f.error();
  154. },
  155. registerDevice() {
  156. f.error();
  157. },
  158. analyzePath() {
  159. f.error();
  160. },
  161. ErrnoError() {
  162. f.error();
  163. }
  164. };
  165. n.FS_createDataFile = f.createDataFile;
  166. n.FS_createPreloadedFile = f.createPreloadedFile;
  167. var we = "data:application/octet-stream;base64,", q = (e) => e.startsWith(we), Se = (e) => e.startsWith("file://");
  168. function g(e) {
  169. return function() {
  170. o(U, `native function \`${e}\` called before runtime initialization`);
  171. var t = T[e];
  172. return o(t, `exported native function \`${e}\` not found`), t.apply(null, arguments);
  173. };
  174. }
  175. var h;
  176. h = "middle-layer.wasm";
  177. q(h) || (h = fe(h));
  178. function G(e) {
  179. if (e == h && I)
  180. return new Uint8Array(I);
  181. throw "both async and sync fetching of the wasm failed";
  182. }
  183. function Fe(e) {
  184. return !I && le && typeof fetch == "function" ? fetch(e, { credentials: "same-origin" }).then((t) => {
  185. if (!t.ok)
  186. throw "failed to load wasm binary file at '" + e + "'";
  187. return t.arrayBuffer();
  188. }).catch(() => G(e)) : Promise.resolve().then(() => G(e));
  189. }
  190. function W(e, t, r) {
  191. return Fe(e).then((i) => WebAssembly.instantiate(i, t)).then((i) => i).then(r, (i) => {
  192. u(`failed to asynchronously prepare wasm: ${i}`), Se(h) && u(`warning: Loading from a file URI (${h}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`), p(i);
  193. });
  194. }
  195. function Ae(e, t, r, i) {
  196. return !e && typeof WebAssembly.instantiateStreaming == "function" && !q(t) && typeof fetch == "function" ? fetch(t, { credentials: "same-origin" }).then((a) => {
  197. var c = WebAssembly.instantiateStreaming(a, r);
  198. return c.then(
  199. i,
  200. function(s) {
  201. return u(`wasm streaming compile failed: ${s}`), u("falling back to ArrayBuffer instantiation"), W(t, r, i);
  202. }
  203. );
  204. }) : W(t, r, i);
  205. }
  206. function Ie() {
  207. var e = {
  208. env: z,
  209. wasi_snapshot_preview1: z
  210. };
  211. function t(a, c) {
  212. return T = a.exports, P = T.memory, o(P, "memory not found in wasm exports"), me(), Ee(T.__wasm_call_ctors), be("wasm-instantiate"), T;
  213. }
  214. ve("wasm-instantiate");
  215. var r = n;
  216. function i(a) {
  217. o(n === r, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"), r = null, t(a.instance);
  218. }
  219. if (n.instantiateWasm)
  220. try {
  221. return n.instantiateWasm(e, t);
  222. } catch (a) {
  223. return u(`Module.instantiateWasm callback failed with error: ${a}`), !1;
  224. }
  225. return Ae(I, h, e, i), {};
  226. }
  227. function y(e, t, r = !0) {
  228. Object.getOwnPropertyDescriptor(n, e) || Object.defineProperty(n, e, {
  229. configurable: !0,
  230. get() {
  231. let i = r ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : "";
  232. p(`\`Module.${e}\` has been replaced by \`${t}\`` + i);
  233. }
  234. });
  235. }
  236. function Ce(e) {
  237. Object.getOwnPropertyDescriptor(n, e) && p(`\`Module.${e}\` was supplied but \`${e}\` not included in INCOMING_MODULE_JS_API`);
  238. }
  239. function Z(e) {
  240. return e === "FS_createPath" || e === "FS_createDataFile" || e === "FS_createPreloadedFile" || e === "FS_unlink" || e === "addRunDependency" || // The old FS has some functionality that WasmFS lacks.
  241. e === "FS_createLazyFile" || e === "FS_createDevice" || e === "removeRunDependency";
  242. }
  243. function X(e, t) {
  244. typeof globalThis < "u" && Object.defineProperty(globalThis, e, {
  245. configurable: !0,
  246. get() {
  247. m(`\`${e}\` is not longer defined by emscripten. ${t}`);
  248. }
  249. });
  250. }
  251. X("buffer", "Please use HEAP8.buffer or wasmMemory.buffer");
  252. X("asm", "Please use wasmExports instead");
  253. function Re(e) {
  254. typeof globalThis < "u" && !Object.getOwnPropertyDescriptor(globalThis, e) && Object.defineProperty(globalThis, e, {
  255. configurable: !0,
  256. get() {
  257. var t = `\`${e}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`, r = e;
  258. r.startsWith("_") || (r = "$" + e), t += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${r}')`, Z(e) && (t += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"), m(t);
  259. }
  260. }), Q(e);
  261. }
  262. function Q(e) {
  263. Object.getOwnPropertyDescriptor(n, e) || Object.defineProperty(n, e, {
  264. configurable: !0,
  265. get() {
  266. var t = `'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
  267. Z(e) && (t += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"), p(t);
  268. }
  269. });
  270. }
  271. function Oe(e) {
  272. this.name = "ExitStatus", this.message = `Program terminated with exit(${e})`, this.status = e;
  273. }
  274. var D = (e) => {
  275. for (; e.length > 0; )
  276. e.shift()(n);
  277. }, Me = n.noExitRuntime || !0, A = (e) => (o(typeof e == "number"), e >>>= 0, "0x" + e.toString(16).padStart(8, "0")), m = (e) => {
  278. m.shown || (m.shown = {}), m.shown[e] || (m.shown[e] = 1, u(e));
  279. }, Le = () => Date.now(), Pe = (e, t, r) => R.copyWithin(e, t, t + r), Ue = (e) => {
  280. p(`Cannot enlarge memory arrays to size ${e} bytes (OOM). Either (1) compile with -sINITIAL_MEMORY=X with X higher than the current value ${V.length}, (2) compile with -sALLOW_MEMORY_GROWTH which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -sABORTING_MALLOC=0`);
  281. }, xe = (e) => {
  282. R.length, e >>>= 0, Ue(e);
  283. }, ee = 0, te = () => Me || ee > 0, H = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0, De = (e, t, r) => {
  284. for (var i = t + r, a = t; e[a] && !(a >= i); )
  285. ++a;
  286. if (a - t > 16 && e.buffer && H)
  287. return H.decode(e.subarray(t, a));
  288. for (var c = ""; t < a; ) {
  289. var s = e[t++];
  290. if (!(s & 128)) {
  291. c += String.fromCharCode(s);
  292. continue;
  293. }
  294. var l = e[t++] & 63;
  295. if ((s & 224) == 192) {
  296. c += String.fromCharCode((s & 31) << 6 | l);
  297. continue;
  298. }
  299. var d = e[t++] & 63;
  300. if ((s & 240) == 224 ? s = (s & 15) << 12 | l << 6 | d : ((s & 248) != 240 && m("Invalid UTF-8 leading byte " + A(s) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"), s = (s & 7) << 18 | l << 12 | d << 6 | e[t++] & 63), s < 65536)
  301. c += String.fromCharCode(s);
  302. else {
  303. var w = s - 65536;
  304. c += String.fromCharCode(55296 | w >> 10, 56320 | w & 1023);
  305. }
  306. }
  307. return c;
  308. }, Ne = (e, t) => (o(typeof e == "number", `UTF8ToString expects a number (got ${typeof e})`), e ? De(R, e, t) : ""), ke = (e) => {
  309. var t;
  310. te() || ((t = n.onExit) == null || t.call(n, e), C = !0), $(e, new Oe(e));
  311. }, Be = (e, t) => {
  312. if (Xe(), te() && !t) {
  313. var r = `program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=${ee}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;
  314. u(r);
  315. }
  316. ke(e);
  317. }, Ge = Be, We = (e) => {
  318. for (var t = 0, r = 0; r < e.length; ++r) {
  319. var i = e.charCodeAt(r);
  320. i <= 127 ? t++ : i <= 2047 ? t += 2 : i >= 55296 && i <= 57343 ? (t += 4, ++r) : t += 3;
  321. }
  322. return t;
  323. }, He = (e, t, r, i) => {
  324. if (o(typeof e == "string", `stringToUTF8Array expects a string (got ${typeof e})`), !(i > 0))
  325. return 0;
  326. for (var a = r, c = r + i - 1, s = 0; s < e.length; ++s) {
  327. var l = e.charCodeAt(s);
  328. if (l >= 55296 && l <= 57343) {
  329. var d = e.charCodeAt(++s);
  330. l = 65536 + ((l & 1023) << 10) | d & 1023;
  331. }
  332. if (l <= 127) {
  333. if (r >= c)
  334. break;
  335. t[r++] = l;
  336. } else if (l <= 2047) {
  337. if (r + 1 >= c)
  338. break;
  339. t[r++] = 192 | l >> 6, t[r++] = 128 | l & 63;
  340. } else if (l <= 65535) {
  341. if (r + 2 >= c)
  342. break;
  343. t[r++] = 224 | l >> 12, t[r++] = 128 | l >> 6 & 63, t[r++] = 128 | l & 63;
  344. } else {
  345. if (r + 3 >= c)
  346. break;
  347. l > 1114111 && m("Invalid Unicode code point " + A(l) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."), t[r++] = 240 | l >> 18, t[r++] = 128 | l >> 12 & 63, t[r++] = 128 | l >> 6 & 63, t[r++] = 128 | l & 63;
  348. }
  349. }
  350. return t[r] = 0, r - a;
  351. }, ze = (e, t, r) => (o(typeof r == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), He(e, R, t, r)), Ye = (e) => {
  352. var t = We(e) + 1, r = je(t);
  353. return r && ze(e, r, t), r;
  354. }, $e = Ye;
  355. function Ve() {
  356. Ce("fetchSettings");
  357. }
  358. var z = {
  359. /** @export */
  360. emscripten_date_now: Le,
  361. /** @export */
  362. emscripten_memcpy_js: Pe,
  363. /** @export */
  364. emscripten_resize_heap: xe,
  365. /** @export */
  366. exit: Ge
  367. }, T = Ie(), je = n._malloc = g("malloc");
  368. n._free = g("free");
  369. n._initEncoder = g("initEncoder");
  370. n._clearEncoder = g("clearEncoder");
  371. n._createAnalysisBuffer = g("createAnalysisBuffer");
  372. n._processEncoding = g("processEncoding");
  373. n._getEncodedDataLen = g("getEncodedDataLen");
  374. n._transferEncodedData = g("transferEncodedData");
  375. n._decodeComments = g("decodeComments");
  376. var Je = n._fflush = g("fflush"), ne = () => (ne = T.emscripten_stack_init)(), N = () => (N = T.emscripten_stack_get_end)();
  377. n.UTF8ToString = Ne;
  378. n.allocateUTF8 = $e;
  379. var Ke = [
  380. "writeI53ToI64",
  381. "writeI53ToI64Clamped",
  382. "writeI53ToI64Signaling",
  383. "writeI53ToU64Clamped",
  384. "writeI53ToU64Signaling",
  385. "readI53FromI64",
  386. "readI53FromU64",
  387. "convertI32PairToI53",
  388. "convertI32PairToI53Checked",
  389. "convertU32PairToI53",
  390. "zeroMemory",
  391. "growMemory",
  392. "isLeapYear",
  393. "ydayFromDate",
  394. "arraySum",
  395. "addDays",
  396. "setErrNo",
  397. "inetPton4",
  398. "inetNtop4",
  399. "inetPton6",
  400. "inetNtop6",
  401. "readSockaddr",
  402. "writeSockaddr",
  403. "getHostByName",
  404. "initRandomFill",
  405. "randomFill",
  406. "getCallstack",
  407. "emscriptenLog",
  408. "convertPCtoSourceLocation",
  409. "readEmAsmArgs",
  410. "jstoi_q",
  411. "jstoi_s",
  412. "getExecutableName",
  413. "listenOnce",
  414. "autoResumeAudioContext",
  415. "dynCallLegacy",
  416. "getDynCaller",
  417. "dynCall",
  418. "handleException",
  419. "runtimeKeepalivePush",
  420. "runtimeKeepalivePop",
  421. "callUserCallback",
  422. "maybeExit",
  423. "asmjsMangle",
  424. "asyncLoad",
  425. "alignMemory",
  426. "mmapAlloc",
  427. "handleAllocatorInit",
  428. "HandleAllocator",
  429. "getNativeTypeSize",
  430. "STACK_SIZE",
  431. "STACK_ALIGN",
  432. "POINTER_SIZE",
  433. "ASSERTIONS",
  434. "getCFunc",
  435. "ccall",
  436. "cwrap",
  437. "uleb128Encode",
  438. "sigToWasmTypes",
  439. "generateFuncType",
  440. "convertJsFunctionToWasm",
  441. "getEmptyTableSlot",
  442. "updateTableMap",
  443. "getFunctionAddress",
  444. "addFunction",
  445. "removeFunction",
  446. "reallyNegative",
  447. "unSign",
  448. "strLen",
  449. "reSign",
  450. "formatString",
  451. "intArrayFromString",
  452. "intArrayToString",
  453. "AsciiToString",
  454. "stringToAscii",
  455. "UTF16ToString",
  456. "stringToUTF16",
  457. "lengthBytesUTF16",
  458. "UTF32ToString",
  459. "stringToUTF32",
  460. "lengthBytesUTF32",
  461. "stringToUTF8OnStack",
  462. "writeArrayToMemory",
  463. "registerKeyEventCallback",
  464. "maybeCStringToJsString",
  465. "findEventTarget",
  466. "findCanvasEventTarget",
  467. "getBoundingClientRect",
  468. "fillMouseEventData",
  469. "registerMouseEventCallback",
  470. "registerWheelEventCallback",
  471. "registerUiEventCallback",
  472. "registerFocusEventCallback",
  473. "fillDeviceOrientationEventData",
  474. "registerDeviceOrientationEventCallback",
  475. "fillDeviceMotionEventData",
  476. "registerDeviceMotionEventCallback",
  477. "screenOrientation",
  478. "fillOrientationChangeEventData",
  479. "registerOrientationChangeEventCallback",
  480. "fillFullscreenChangeEventData",
  481. "registerFullscreenChangeEventCallback",
  482. "JSEvents_requestFullscreen",
  483. "JSEvents_resizeCanvasForFullscreen",
  484. "registerRestoreOldStyle",
  485. "hideEverythingExceptGivenElement",
  486. "restoreHiddenElements",
  487. "setLetterbox",
  488. "softFullscreenResizeWebGLRenderTarget",
  489. "doRequestFullscreen",
  490. "fillPointerlockChangeEventData",
  491. "registerPointerlockChangeEventCallback",
  492. "registerPointerlockErrorEventCallback",
  493. "requestPointerLock",
  494. "fillVisibilityChangeEventData",
  495. "registerVisibilityChangeEventCallback",
  496. "registerTouchEventCallback",
  497. "fillGamepadEventData",
  498. "registerGamepadEventCallback",
  499. "disableGamepadApiIfItThrows",
  500. "registerBeforeUnloadEventCallback",
  501. "fillBatteryEventData",
  502. "battery",
  503. "registerBatteryEventCallback",
  504. "setCanvasElementSize",
  505. "getCanvasElementSize",
  506. "demangle",
  507. "demangleAll",
  508. "jsStackTrace",
  509. "stackTrace",
  510. "getEnvStrings",
  511. "checkWasiClock",
  512. "flush_NO_FILESYSTEM",
  513. "wasiRightsToMuslOFlags",
  514. "wasiOFlagsToMuslOFlags",
  515. "createDyncallWrapper",
  516. "safeSetTimeout",
  517. "setImmediateWrapped",
  518. "clearImmediateWrapped",
  519. "polyfillSetImmediate",
  520. "getPromise",
  521. "makePromise",
  522. "idsToPromises",
  523. "makePromiseCallback",
  524. "ExceptionInfo",
  525. "findMatchingCatch",
  526. "Browser_asyncPrepareDataCounter",
  527. "setMainLoop",
  528. "getSocketFromFD",
  529. "getSocketAddress",
  530. "FS_createPreloadedFile",
  531. "FS_modeStringToFlags",
  532. "FS_getMode",
  533. "FS_stdin_getChar",
  534. "FS_createDataFile",
  535. "FS_unlink",
  536. "FS_mkdirTree",
  537. "_setNetworkCallback",
  538. "heapObjectForWebGLType",
  539. "heapAccessShiftForWebGLHeap",
  540. "webgl_enable_ANGLE_instanced_arrays",
  541. "webgl_enable_OES_vertex_array_object",
  542. "webgl_enable_WEBGL_draw_buffers",
  543. "webgl_enable_WEBGL_multi_draw",
  544. "emscriptenWebGLGet",
  545. "computeUnpackAlignedImageSize",
  546. "colorChannelsInGlTextureFormat",
  547. "emscriptenWebGLGetTexPixelData",
  548. "__glGenObject",
  549. "emscriptenWebGLGetUniform",
  550. "webglGetUniformLocation",
  551. "webglPrepareUniformLocationsBeforeFirstUse",
  552. "webglGetLeftBracePos",
  553. "emscriptenWebGLGetVertexAttrib",
  554. "__glGetActiveAttribOrUniform",
  555. "writeGLArray",
  556. "registerWebGlEventCallback",
  557. "runAndAbortIfError",
  558. "SDL_unicode",
  559. "SDL_ttfContext",
  560. "SDL_audio",
  561. "ALLOC_NORMAL",
  562. "ALLOC_STACK",
  563. "allocate",
  564. "writeStringToMemory",
  565. "writeAsciiToMemory"
  566. ];
  567. Ke.forEach(Re);
  568. var qe = [
  569. "run",
  570. "addOnPreRun",
  571. "addOnInit",
  572. "addOnPreMain",
  573. "addOnExit",
  574. "addOnPostRun",
  575. "addRunDependency",
  576. "removeRunDependency",
  577. "FS_createFolder",
  578. "FS_createPath",
  579. "FS_createLazyFile",
  580. "FS_createLink",
  581. "FS_createDevice",
  582. "FS_readFile",
  583. "out",
  584. "err",
  585. "callMain",
  586. "abort",
  587. "wasmMemory",
  588. "wasmExports",
  589. "stackAlloc",
  590. "stackSave",
  591. "stackRestore",
  592. "getTempRet0",
  593. "setTempRet0",
  594. "writeStackCookie",
  595. "checkStackCookie",
  596. "ptrToString",
  597. "exitJS",
  598. "getHeapMax",
  599. "abortOnCannotGrowMemory",
  600. "ENV",
  601. "MONTH_DAYS_REGULAR",
  602. "MONTH_DAYS_LEAP",
  603. "MONTH_DAYS_REGULAR_CUMULATIVE",
  604. "MONTH_DAYS_LEAP_CUMULATIVE",
  605. "ERRNO_CODES",
  606. "ERRNO_MESSAGES",
  607. "DNS",
  608. "Protocols",
  609. "Sockets",
  610. "timers",
  611. "warnOnce",
  612. "UNWIND_CACHE",
  613. "readEmAsmArgsArray",
  614. "keepRuntimeAlive",
  615. "wasmTable",
  616. "noExitRuntime",
  617. "freeTableIndexes",
  618. "functionsInTableMap",
  619. "setValue",
  620. "getValue",
  621. "PATH",
  622. "PATH_FS",
  623. "UTF8Decoder",
  624. "UTF8ArrayToString",
  625. "stringToUTF8Array",
  626. "stringToUTF8",
  627. "lengthBytesUTF8",
  628. "UTF16Decoder",
  629. "stringToNewUTF8",
  630. "JSEvents",
  631. "specialHTMLTargets",
  632. "currentFullscreenStrategy",
  633. "restoreOldWindowedStyle",
  634. "ExitStatus",
  635. "promiseMap",
  636. "uncaughtExceptionCount",
  637. "exceptionLast",
  638. "exceptionCaught",
  639. "Browser",
  640. "wget",
  641. "SYSCALLS",
  642. "preloadPlugins",
  643. "FS_stdin_getChar_buffer",
  644. "FS",
  645. "MEMFS",
  646. "TTY",
  647. "PIPEFS",
  648. "SOCKFS",
  649. "tempFixedLengthArray",
  650. "miniTempWebGLFloatBuffers",
  651. "miniTempWebGLIntBuffers",
  652. "GL",
  653. "emscripten_webgl_power_preferences",
  654. "AL",
  655. "GLUT",
  656. "EGL",
  657. "GLEW",
  658. "IDBStore",
  659. "SDL",
  660. "SDL_gfx",
  661. "allocateUTF8OnStack"
  662. ];
  663. qe.forEach(Q);
  664. var L;
  665. S = function e() {
  666. L || re(), L || (S = e);
  667. };
  668. function Ze() {
  669. ne(), pe();
  670. }
  671. function re() {
  672. if (b > 0 || (Ze(), ge(), b > 0))
  673. return;
  674. function e() {
  675. L || (L = !0, n.calledRun = !0, !C && (ye(), n.onRuntimeInitialized && n.onRuntimeInitialized(), o(!n._main, 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'), _e()));
  676. }
  677. n.setStatus ? (n.setStatus("Running..."), setTimeout(function() {
  678. setTimeout(function() {
  679. n.setStatus("");
  680. }, 1), e();
  681. }, 1)) : e(), x();
  682. }
  683. function Xe() {
  684. var e = u, t = !1;
  685. u = (r) => {
  686. t = !0;
  687. };
  688. try {
  689. Je(0);
  690. } catch {
  691. }
  692. u = e, t && (m("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc."), m("(this may also be due to not including full filesystem support - try building with -sFORCE_FILESYSTEM)"));
  693. }
  694. if (n.preInit)
  695. for (typeof n.preInit == "function" && (n.preInit = [n.preInit]); n.preInit.length > 0; )
  696. n.preInit.pop()();
  697. re();
  698. n.preRun = () => n._isInitialized = !1;
  699. n.postRun = () => n._isInitialized = !0;
  700. n.ANALYSIS_SAMPLE_COUNT = 8192;
  701. function Qe(e, t) {
  702. if (!e.length)
  703. return null;
  704. e.forEach((a) => {
  705. if (a.name.indexOf("=") !== -1)
  706. throw Error(`Tag name "${a.name}" contains reserved character "="`);
  707. if (a.name.indexOf(" ") !== -1)
  708. throw Error(`Tag name "${a.name}" contains reserved character (tab)`);
  709. if (a.value.indexOf(" ") !== -1)
  710. throw Error(`Tag value "${a.value}" contains reserved character (tab)`);
  711. });
  712. const i = e.map((a) => `${a.name}=${a.value}`).join(" ");
  713. return t.allocateUTF8(i);
  714. }
  715. function et(e, t) {
  716. if (e === null)
  717. return [];
  718. const r = t.UTF8ToString(e);
  719. return r === "" ? [] : r.split(" ").map((a) => {
  720. const c = a.indexOf("=");
  721. return c === -1 ? { name: a, value: "" } : {
  722. name: a.slice(0, c),
  723. value: a.slice(c + 1)
  724. };
  725. });
  726. }
  727. const M = {
  728. quality: 0.5,
  729. tags: []
  730. }, { _clearEncoder: tt, _createAnalysisBuffer: nt, _decodeComments: rt, _initEncoder: it, _processEncoding: at, _getEncodedDataLen: ot, _transferEncodedData: st, ANALYSIS_SAMPLE_COUNT: lt } = n;
  731. let O = null;
  732. async function ie() {
  733. if (!n._isInitialized) {
  734. if (n._isInitialized === void 0)
  735. throw Error("Unexpected behavior from middle-layer.js import.");
  736. return O !== null ? await O : (O = new Promise((e) => {
  737. n.onRuntimeInitialized = e();
  738. }), O);
  739. }
  740. }
  741. function ct(e, t, r) {
  742. const i = e.numberOfChannels, a = e.sampleRate;
  743. return it(i, a, t, r);
  744. }
  745. function ut(e) {
  746. const t = e.numberOfChannels, r = [];
  747. for (let i = 0; i < t; ++i)
  748. r[i] = e.getChannelData(i);
  749. return r;
  750. }
  751. function ae(e, t) {
  752. at(e, t);
  753. const r = ot(e);
  754. if (r === 0)
  755. return new Uint8Array(0);
  756. const i = st(e);
  757. return new Uint8Array(n.HEAPU8.subarray(i, i + r));
  758. }
  759. function dt(e, t, r, i, a) {
  760. if (a === null)
  761. throw Error("Unexpected");
  762. const c = r + i;
  763. for (let s = 0; s < t.length; ++s) {
  764. const l = t[s], d = n.HEAPU32[a + s] >> 2;
  765. n.HEAPF32.set(l.subarray(r, c), d);
  766. }
  767. return ae(e, i);
  768. }
  769. function ft() {
  770. return new Promise((e) => setTimeout(e, 0));
  771. }
  772. function mt(e) {
  773. return ae(e, 0);
  774. }
  775. function pt(e) {
  776. if (e === M)
  777. return M;
  778. const t = { ...M }, r = e;
  779. for (const i in e)
  780. r[i] !== void 0 && (t[i] = r[i]);
  781. return t;
  782. }
  783. async function oe(e, t) {
  784. return await (t ?? new AudioContext()).decodeAudioData(e);
  785. }
  786. function gt(e) {
  787. let t = null, r = null;
  788. try {
  789. const i = new Uint8Array(e);
  790. return t = n._malloc(i.length), n.HEAPU8.set(i, t), r = rt(t, i.length), et(r, n);
  791. } finally {
  792. r !== null && n._free(r), t !== null && n._free(t);
  793. }
  794. }
  795. async function yt(e, t = M) {
  796. let r = null;
  797. const i = [], a = pt(t);
  798. let c = null;
  799. try {
  800. await ie(), c = Qe(a.tags, n);
  801. const s = e.length;
  802. r = ct(e, a.quality, c);
  803. const l = ut(e);
  804. let d = 0;
  805. if (r === null)
  806. throw Error("Unexpected");
  807. for (; d < s; ) {
  808. const se = nt(r) >> 2, k = Math.min(lt, s - d), B = dt(r, l, d, k, se);
  809. B.length && i.push(B), d += k, await ft();
  810. }
  811. const w = mt(r);
  812. return w.length && i.push(w), new Blob(i, { type: "audio/ogg" });
  813. } finally {
  814. r !== null && tt(r), c !== null && n._free(c);
  815. }
  816. }
  817. async function _t(e, t) {
  818. const r = await e.arrayBuffer();
  819. return await oe(r, t);
  820. }
  821. async function ht(e, t) {
  822. await ie();
  823. const r = await e.arrayBuffer(), i = gt(r);
  824. return [await oe(r, t), i];
  825. }
  826. export {
  827. _t as decodeOggBlob,
  828. ht as decodeOggBlobWithTags,
  829. yt as encodeAudioBuffer
  830. };
  831. //# sourceMappingURL=index.es.js.map