aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--browser/VencordNativeStub.ts7
-rw-r--r--browser/content.js5
-rw-r--r--browser/manifest.json2
-rw-r--r--browser/monaco.ts43
-rw-r--r--browser/monacoWin.html37
-rw-r--r--browser/patch-worker.js135
-rw-r--r--browser/third-party/rnnoise/LICENSE21
-rw-r--r--browser/third-party/rnnoise/rnnoise.wasmbin0 -> 152656 bytes
-rw-r--r--browser/third-party/rnnoise/rnnoise/workletProcessor.js13
-rw-r--r--browser/third-party/rnnoise/rnnoise_simd.wasmbin0 -> 152656 bytes
-rw-r--r--package.json6
-rw-r--r--pnpm-lock.yaml81
-rwxr-xr-xscripts/build/build.mjs2
-rw-r--r--scripts/build/buildWeb.mjs118
-rw-r--r--src/globals.d.ts1
-rw-r--r--src/main/ipcMain.ts2
-rw-r--r--src/main/monacoWin.html (renamed from src/components/monacoWin.html)0
-rw-r--r--src/plugins/_core/supportHelper.tsx (renamed from src/plugins/supportHelper.tsx)2
-rw-r--r--src/plugins/fakeNitro.ts11
-rw-r--r--src/plugins/invisibleChat.desktop/components/DecryptionModal.tsx (renamed from src/plugins/invisibleChat/components/DecryptionModal.tsx)0
-rw-r--r--src/plugins/invisibleChat.desktop/components/EncryptionModal.tsx (renamed from src/plugins/invisibleChat/components/EncryptionModal.tsx)0
-rw-r--r--src/plugins/invisibleChat.desktop/index.tsx (renamed from src/plugins/invisibleChat/index.tsx)0
-rw-r--r--src/plugins/petpet.ts5
-rw-r--r--src/plugins/shikiCodeblocks.desktop/api/languages.ts (renamed from src/plugins/shikiCodeblocks/api/languages.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/api/shiki.ts (renamed from src/plugins/shikiCodeblocks/api/shiki.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/api/themes.ts (renamed from src/plugins/shikiCodeblocks/api/themes.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/components/ButtonRow.tsx (renamed from src/plugins/shikiCodeblocks/components/ButtonRow.tsx)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/components/Code.tsx (renamed from src/plugins/shikiCodeblocks/components/Code.tsx)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/components/CopyButton.tsx (renamed from src/plugins/shikiCodeblocks/components/CopyButton.tsx)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/components/Header.tsx (renamed from src/plugins/shikiCodeblocks/components/Header.tsx)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/components/Highlighter.tsx (renamed from src/plugins/shikiCodeblocks/components/Highlighter.tsx)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/devicon.css (renamed from src/plugins/shikiCodeblocks/devicon.css)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/hooks/useCopyCooldown.ts (renamed from src/plugins/shikiCodeblocks/hooks/useCopyCooldown.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/hooks/useShikiSettings.ts (renamed from src/plugins/shikiCodeblocks/hooks/useShikiSettings.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/hooks/useTheme.ts (renamed from src/plugins/shikiCodeblocks/hooks/useTheme.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/index.ts (renamed from src/plugins/shikiCodeblocks/index.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/previewExample.tsx (renamed from src/plugins/shikiCodeblocks/previewExample.tsx)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/settings.ts (renamed from src/plugins/shikiCodeblocks/settings.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/shiki.css (renamed from src/plugins/shikiCodeblocks/shiki.css)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/types.ts (renamed from src/plugins/shikiCodeblocks/types.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/utils/color.ts (renamed from src/plugins/shikiCodeblocks/utils/color.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/utils/createStyle.ts (renamed from src/plugins/shikiCodeblocks/utils/createStyle.ts)0
-rw-r--r--src/plugins/shikiCodeblocks.desktop/utils/misc.ts (renamed from src/plugins/shikiCodeblocks/utils/misc.ts)0
-rw-r--r--src/utils/apng-canvas.js1168
-rw-r--r--src/utils/dependencies.ts35
-rw-r--r--src/utils/web-metadata.ts14
46 files changed, 1634 insertions, 74 deletions
diff --git a/browser/VencordNativeStub.ts b/browser/VencordNativeStub.ts
index 664e9ee..e3df0d6 100644
--- a/browser/VencordNativeStub.ts
+++ b/browser/VencordNativeStub.ts
@@ -19,9 +19,11 @@
/// <reference path="../src/modules.d.ts" />
/// <reference path="../src/globals.d.ts" />
-import monacoHtml from "~fileContent/../src/components/monacoWin.html";
+import monacoHtmlLocal from "~fileContent/monacoWin.html";
+import monacoHtmlCdn from "~fileContent/../src/main/monacoWin.html";
import * as DataStore from "../src/api/DataStore";
import { debounce } from "../src/utils";
+import { EXTENSION_BASE_URL } from "../src/utils/web-metadata";
import { getTheme, Theme } from "../src/utils/discord";
import { getThemeInfo } from "../src/main/themes";
@@ -80,6 +82,7 @@ window.VencordNative = {
return;
}
+ win.baseUrl = EXTENSION_BASE_URL;
win.setCss = setCssDebounced;
win.getCurrentCss = () => VencordNative.quickCss.get();
win.getTheme = () =>
@@ -87,7 +90,7 @@ window.VencordNative = {
? "vs-light"
: "vs-dark";
- win.document.write(monacoHtml);
+ win.document.write(IS_EXTENSION ? monacoHtmlLocal : monacoHtmlCdn);
},
},
diff --git a/browser/content.js b/browser/content.js
index e47ef83..4810fe3 100644
--- a/browser/content.js
+++ b/browser/content.js
@@ -4,6 +4,11 @@ if (typeof browser === "undefined") {
const script = document.createElement("script");
script.src = browser.runtime.getURL("dist/Vencord.js");
+script.id = "vencord-script";
+Object.assign(script.dataset, {
+ extensionBaseUrl: browser.runtime.getURL(""),
+ version: browser.runtime.getManifest().version
+});
const style = document.createElement("link");
style.type = "text/css";
diff --git a/browser/manifest.json b/browser/manifest.json
index 49536a7..69bf0ce 100644
--- a/browser/manifest.json
+++ b/browser/manifest.json
@@ -28,7 +28,7 @@
"web_accessible_resources": [
{
- "resources": ["dist/Vencord.js", "dist/Vencord.css"],
+ "resources": ["dist/*", "third-party/*"],
"matches": ["*://*.discord.com/*"]
}
],
diff --git a/browser/monaco.ts b/browser/monaco.ts
new file mode 100644
index 0000000..ead061d
--- /dev/null
+++ b/browser/monaco.ts
@@ -0,0 +1,43 @@
+/*
+ * Vencord, a Discord client mod
+ * Copyright (c) 2023 Vendicated and contributors
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+import "./patch-worker";
+
+import * as monaco from "monaco-editor/esm/vs/editor/editor.main.js";
+
+declare global {
+ const baseUrl: string;
+ const getCurrentCss: () => Promise<string>;
+ const setCss: (css: string) => void;
+ const getTheme: () => string;
+}
+
+const BASE = "/dist/monaco/vs";
+
+self.MonacoEnvironment = {
+ getWorkerUrl(_moduleId: unknown, label: string) {
+ const path = label === "css" ? "/language/css/css.worker.js" : "/editor/editor.worker.js";
+ return new URL(BASE + path, baseUrl).toString();
+ }
+};
+
+getCurrentCss().then(css => {
+ const editor = monaco.editor.create(
+ document.getElementById("container")!,
+ {
+ value: css,
+ language: "css",
+ theme: getTheme(),
+ }
+ );
+ editor.onDidChangeModelContent(() =>
+ setCss(editor.getValue())
+ );
+ window.addEventListener("resize", () => {
+ // make monaco re-layout
+ editor.layout();
+ });
+});
diff --git a/browser/monacoWin.html b/browser/monacoWin.html
new file mode 100644
index 0000000..a55b0e5
--- /dev/null
+++ b/browser/monacoWin.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>Vencord QuickCSS Editor</title>
+ <style>
+ html,
+ body,
+ #container {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div id="container"></div>
+
+ <script>
+ const script = document.createElement("script");
+ script.src = new URL("/dist/monaco/index.js", baseUrl);
+
+ const style = document.createElement("link");
+ style.type = "text/css";
+ style.rel = "stylesheet";
+ style.href = new URL("/dist/monaco/index.css", baseUrl);
+
+ document.body.append(style, script);
+ </script>
+ </body>
+</html>
diff --git a/browser/patch-worker.js b/browser/patch-worker.js
new file mode 100644
index 0000000..428ea6c
--- /dev/null
+++ b/browser/patch-worker.js
@@ -0,0 +1,135 @@
+/*
+Copyright 2013 Rob Wu <gwnRob@gmail.com>
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+// Target: Chrome 20+
+
+// W3-compliant Worker proxy.
+// This module replaces the global Worker object.
+// When invoked, the default Worker object is called.
+// If this call fails with SECURITY_ERR, the script is fetched
+// using async XHR, and transparently proxies all calls and
+// setters/getters to the new Worker object.
+// Note: This script does not magically circumvent the Same origin policy.
+
+(function () {
+ 'use strict';
+ var Worker_ = window.Worker;
+ var URL = window.URL || window.webkitURL;
+ // Create dummy worker for the following purposes:
+ // 1. Don't override the global Worker object if the fallback isn't
+ // going to work (future API changes?)
+ // 2. Use it to trigger early validation of postMessage calls
+ // Note: Blob constructor is supported since Chrome 20, but since
+ // some of the used Chrome APIs are only supported as of Chrome 20,
+ // I don't bother adding a BlobBuilder fallback.
+ var dummyWorker = new Worker_(
+ URL.createObjectURL(new Blob([], { type: 'text/javascript' })));
+ window.Worker = function Worker(scriptURL) {
+ if (arguments.length === 0) {
+ throw new TypeError('Not enough arguments');
+ }
+ try {
+ return new Worker_(scriptURL);
+ } catch (e) {
+ if (e.code === 18/*DOMException.SECURITY_ERR*/) {
+ return new WorkerXHR(scriptURL);
+ } else {
+ throw e;
+ }
+ }
+ };
+ // Bind events and replay queued messages
+ function bindWorker(worker, workerURL) {
+ if (worker._terminated) {
+ return;
+ }
+ worker.Worker = new Worker_(workerURL);
+ worker.Worker.onerror = worker._onerror;
+ worker.Worker.onmessage = worker._onmessage;
+ var o;
+ while ((o = worker._replayQueue.shift())) {
+ worker.Worker[o.method].apply(worker.Worker, o.arguments);
+ }
+ while ((o = worker._messageQueue.shift())) {
+ worker.Worker.postMessage.apply(worker.Worker, o);
+ }
+ }
+ function WorkerXHR(scriptURL) {
+ var worker = this;
+ var x = new XMLHttpRequest();
+ x.responseType = 'blob';
+ x.onload = function () {
+ // http://stackoverflow.com/a/10372280/938089
+ var workerURL = URL.createObjectURL(x.response);
+ bindWorker(worker, workerURL);
+ };
+ x.open('GET', scriptURL);
+ x.send();
+ worker._replayQueue = [];
+ worker._messageQueue = [];
+ }
+ WorkerXHR.prototype = {
+ constructor: Worker_,
+ terminate: function () {
+ if (!this._terminated) {
+ this._terminated = true;
+ if (this.Worker)
+ this.Worker.terminate();
+ }
+ },
+ postMessage: function (message, transfer) {
+ if (!(this instanceof WorkerXHR))
+ throw new TypeError('Illegal invocation');
+ if (this.Worker) {
+ this.Worker.postMessage.apply(this.Worker, arguments);
+ } else {
+ // Trigger validation:
+ dummyWorker.postMessage(message);
+ // Alright, push the valid message to the queue.
+ this._messageQueue.push(arguments);
+ }
+ }
+ };
+ // Implement the EventTarget interface
+ [
+ 'addEventListener',
+ 'removeEventListener',
+ 'dispatchEvent'
+ ].forEach(function (method) {
+ WorkerXHR.prototype[method] = function () {
+ if (!(this instanceof WorkerXHR)) {
+ throw new TypeError('Illegal invocation');
+ }
+ if (this.Worker) {
+ this.Worker[method].apply(this.Worker, arguments);
+ } else {
+ this._replayQueue.push({ method: method, arguments: arguments });
+ }
+ };
+ });
+ Object.defineProperties(WorkerXHR.prototype, {
+ onmessage: {
+ get: function () { return this._onmessage || null; },
+ set: function (func) {
+ this._onmessage = typeof func === 'function' ? func : null;
+ }
+ },
+ onerror: {
+ get: function () { return this._onerror || null; },
+ set: function (func) {
+ this._onerror = typeof func === 'function' ? func : null;
+ }
+ }
+ });
+})(); \ No newline at end of file
diff --git a/browser/third-party/rnnoise/LICENSE b/browser/third-party/rnnoise/LICENSE
new file mode 100644
index 0000000..bc8b047
--- /dev/null
+++ b/browser/third-party/rnnoise/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 翠 / green
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/browser/third-party/rnnoise/rnnoise.wasm b/browser/third-party/rnnoise/rnnoise.wasm
new file mode 100644
index 0000000..6f9fbb6
--- /dev/null
+++ b/browser/third-party/rnnoise/rnnoise.wasm
Binary files differ
diff --git a/browser/third-party/rnnoise/rnnoise/workletProcessor.js b/browser/third-party/rnnoise/rnnoise/workletProcessor.js
new file mode 100644
index 0000000..e29fdc8
--- /dev/null
+++ b/browser/third-party/rnnoise/rnnoise/workletProcessor.js
@@ -0,0 +1,13 @@
+var Ke=Object.defineProperty;var Ze=(d,n,e)=>n in d?Ke(d,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[n]=e;var N=(d=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(d,{get:(n,e)=>(typeof require<"u"?require:n)[e]}):d)(function(d){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+d+'" is not supported')});var R=(d,n,e)=>(Ze(d,typeof n!="symbol"?n+"":n,e),e);var S={};var Je=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Pe=(()=>{var d=import.meta.url;return function(e){e=e||{};var e=typeof e<"u"?e:{},a=Object.assign,p,u;e.ready=new Promise(function(r,o){p=r,u=o}),Object.getOwnPropertyDescriptor(e.ready,"_rnnoise_process_frame")||(Object.defineProperty(e.ready,"_rnnoise_process_frame",{configurable:!0,get:function(){t("You are getting _rnnoise_process_frame on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"_rnnoise_process_frame",{configurable:!0,set:function(){t("You are setting _rnnoise_process_frame on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(e.ready,"_rnnoise_destroy")||(Object.defineProperty(e.ready,"_rnnoise_destroy",{configurable:!0,get:function(){t("You are getting _rnnoise_destroy on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"_rnnoise_destroy",{configurable:!0,set:function(){t("You are setting _rnnoise_destroy on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(e.ready,"_rnnoise_create")||(Object.defineProperty(e.ready,"_rnnoise_create",{configurable:!0,get:function(){t("You are getting _rnnoise_create on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"_rnnoise_create",{configurable:!0,set:function(){t("You are setting _rnnoise_create on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(e.ready,"_rnnoise_get_frame_size")||(Object.defineProperty(e.ready,"_rnnoise_get_frame_size",{configurable:!0,get:function(){t("You are getting _rnnoise_get_frame_size on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"_rnnoise_get_frame_size",{configurable:!0,set:function(){t("You are setting _rnnoise_get_frame_size on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(e.ready,"_rnnoise_model_from_string")||(Object.defineProperty(e.ready,"_rnnoise_model_from_string",{configurable:!0,get:function(){t("You are getting _rnnoise_model_from_string on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"_rnnoise_model_from_string",{configurable:!0,set:function(){t("You are setting _rnnoise_model_from_string on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(e.ready,"_rnnoise_model_free")||(Object.defineProperty(e.ready,"_rnnoise_model_free",{configurable:!0,get:function(){t("You are getting _rnnoise_model_free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"_rnnoise_model_free",{configurable:!0,set:function(){t("You are setting _rnnoise_model_free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(e.ready,"_malloc")||(Object.defineProperty(e.ready,"_malloc",{configurable:!0,get:function(){t("You are getting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"_malloc",{configurable:!0,set:function(){t("You are setting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(e.ready,"_free")||(Object.defineProperty(e.ready,"_free",{configurable:!0,get:function(){t("You are getting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"_free",{configurable:!0,set:function(){t("You are setting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(e.ready,"_fflush")||(Object.defineProperty(e.ready,"_fflush",{configurable:!0,get:function(){t("You are getting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"_fflush",{configurable:!0,set:function(){t("You are setting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(e.ready,"onRuntimeInitialized")||(Object.defineProperty(e.ready,"onRuntimeInitialized",{configurable:!0,get:function(){t("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(e.ready,"onRuntimeInitialized",{configurable:!0,set:function(){t("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}));var g=a({},e),b=typeof S=="object",f=typeof importScripts=="function",y=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",m=!b&&!y&&!f;if(e.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");var T="";function B(r){return e.locateFile?e.locateFile(r,T):T+r}var U,x,v,J,W,$;if(y){if(!(typeof process=="object"&&typeof N=="function"))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?)");f?T=N("path").dirname(T)+"/":T=__dirname+"/",$=function(){W||(J=N("fs"),W=N("path"))},U=function(o,i){return $(),o=W.normalize(o),J.readFileSync(o,i?null:"utf8")},v=function(o){var i=U(o,!0);return i.buffer||(i=new Uint8Array(i)),s(i.buffer),i},x=function(o,i,c){$(),o=W.normalize(o),J.readFile(o,function(O,M){O?c(O):i(M.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(r){if(!(r instanceof Ve))throw r}),process.on("unhandledRejection",function(r){throw r}),e.inspect=function(){return"[Emscripten Module object]"}}else if(m){if(typeof process=="object"&&typeof N=="function"||typeof S=="object"||typeof importScripts=="function")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?)");typeof read<"u"&&(U=function(o){return read(o)}),v=function(o){let i;return typeof readbuffer=="function"?new Uint8Array(readbuffer(o)):(i=read(o,"binary"),s(typeof i=="object"),i)},x=function(o,i,c){setTimeout(()=>i(v(o)),0)},typeof scriptArgs<"u"&&scriptArgs,typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)}else if(b||f){if(f?T=self.location.href:typeof document<"u"&&document.currentScript&&(T=document.currentScript.src),d&&(T=d),T.indexOf("blob:")!==0?T=T.substr(0,T.replace(/[?#].*/,"").lastIndexOf("/")+1):T="",!(typeof S=="object"||typeof importScripts=="function"))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?)");U=function(r){var o=new XMLHttpRequest;return o.open("GET",r,!1),o.send(null),o.responseText},f&&(v=function(r){var o=new XMLHttpRequest;return o.open("GET",r,!1),o.responseType="arraybuffer",o.send(null),new Uint8Array(o.response)}),x=function(r,o,i){var c=new XMLHttpRequest;c.open("GET",r,!0),c.responseType="arraybuffer",c.onload=function(){if(c.status==200||c.status==0&&c.response){o(c.response);return}i()},c.onerror=i,c.send(null)}}else throw new Error("environment detection error");e.print||console.log.bind(console);var _=e.printErr||console.warn.bind(console);a(e,g),g=null,e.arguments,Object.getOwnPropertyDescriptor(e,"arguments")||Object.defineProperty(e,"arguments",{configurable:!0,get:function(){t("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),e.thisProgram,Object.getOwnPropertyDescriptor(e,"thisProgram")||Object.defineProperty(e,"thisProgram",{configurable:!0,get:function(){t("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),e.quit,Object.getOwnPropertyDescriptor(e,"quit")||Object.defineProperty(e,"quit",{configurable:!0,get:function(){t("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),s(typeof e.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),s(typeof e.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),s(typeof e.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),s(typeof e.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),s(typeof e.read>"u","Module.read option was removed (modify read_ in JS)"),s(typeof e.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),s(typeof e.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),s(typeof e.setWindowTitle>"u","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),s(typeof e.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),Object.getOwnPropertyDescriptor(e,"read")||Object.defineProperty(e,"read",{configurable:!0,get:function(){t("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(e,"readAsync")||Object.defineProperty(e,"readAsync",{configurable:!0,get:function(){t("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(e,"readBinary")||Object.defineProperty(e,"readBinary",{configurable:!0,get:function(){t("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(e,"setWindowTitle")||Object.defineProperty(e,"setWindowTitle",{configurable:!0,get:function(){t("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),s(!m,"shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable.");function H(r){H.shown||(H.shown={}),H.shown[r]||(H.shown[r]=1,_(r))}var k;e.wasmBinary&&(k=e.wasmBinary),Object.getOwnPropertyDescriptor(e,"wasmBinary")||Object.defineProperty(e,"wasmBinary",{configurable:!0,get:function(){t("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),e.noExitRuntime,Object.getOwnPropertyDescriptor(e,"noExitRuntime")||Object.defineProperty(e,"noExitRuntime",{configurable:!0,get:function(){t("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),typeof WebAssembly!="object"&&t("no native wasm support detected");var C,Y=!1;function s(r,o){r||t("Assertion failed"+(o?": "+o:""))}var Ee=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Fe(r,o,i){for(var c=o+i,O=o;r[O]&&!(O>=c);)++O;if(O-o>16&&r.subarray&&Ee)return Ee.decode(r.subarray(o,O));for(var M="";o<O;){var l=r[o++];if(!(l&128)){M+=String.fromCharCode(l);continue}var w=r[o++]&63;if((l&224)==192){M+=String.fromCharCode((l&31)<<6|w);continue}var P=r[o++]&63;if((l&240)==224?l=(l&15)<<12|w<<6|P:((l&248)!=240&&H("Invalid UTF-8 leading byte 0x"+l.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),l=(l&7)<<18|w<<12|P<<6|r[o++]&63),l<65536)M+=String.fromCharCode(l);else{var j=l-65536;M+=String.fromCharCode(55296|j>>10,56320|j&1023)}}return M}function ee(r,o){return r?Fe(z,r,o):""}typeof TextDecoder<"u"&&new TextDecoder("utf-16le");function Ae(r,o){return r%o>0&&(r+=o-r%o),r}var te,z,X,re;function Oe(r){te=r,e.HEAP8=new Int8Array(r),e.HEAP16=new Int16Array(r),e.HEAP32=X=new Int32Array(r),e.HEAPU8=z=new Uint8Array(r),e.HEAPU16=new Uint16Array(r),e.HEAPU32=re=new Uint32Array(r),e.HEAPF32=new Float32Array(r),e.HEAPF64=new Float64Array(r)}var oe=5242880;e.TOTAL_STACK&&s(oe===e.TOTAL_STACK,"the stack size can no longer be determined at runtime");var ne=e.INITIAL_MEMORY||16777216;Object.getOwnPropertyDescriptor(e,"INITIAL_MEMORY")||Object.defineProperty(e,"INITIAL_MEMORY",{configurable:!0,get:function(){t("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),s(ne>=oe,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+ne+"! (TOTAL_STACK="+oe+")"),s(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!==void 0&&Int32Array.prototype.set!==void 0,"JS engine does not provide full typed array support"),s(!e.wasmMemory,"Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally"),s(ne==16777216,"Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically");var V;function ue(){var r=ce();s((r&3)==0),X[r+4>>2]=34821223,X[r+8>>2]=2310721022,X[0]=1668509029}function G(){if(!Y){var r=ce(),o=re[r+4>>2],i=re[r+8>>2];(o!=34821223||i!=2310721022)&&t("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+i.toString(16)+" 0x"+o.toString(16)),X[0]!==1668509029&&t("Runtime error: The application has corrupted its heap memory area (address zero)!")}}(function(){var r=new Int16Array(1),o=new Int8Array(r.buffer);if(r[0]=25459,o[0]!==115||o[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"})();var Te=[],_e=[],ge=[],ie=!1,Ie=!1;function Ue(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Ne(e.preRun.shift());ae(Te)}function ve(){G(),s(!ie),ie=!0,ae(_e)}function je(){if(G(),e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)He(e.postRun.shift());ae(ge)}function Ne(r){Te.unshift(r)}function xe(r){_e.unshift(r)}function He(r){ge.unshift(r)}s(Math.imul,"This browser does n