-
Notifications
You must be signed in to change notification settings - Fork 1
/
vencordDesktopMain.js.map
7 lines (7 loc) · 192 KB
/
vencordDesktopMain.js.map
1
2
3
4
5
6
7
{
"version": 3,
"sources": ["../scripts/build/inject/react.mjs", "../src/main/utils/simpleGet.ts", "../src/shared/IpcEvents.ts", "git-hash:~git-hash", "git-remote:~git-remote", "../src/shared/vencordUserAgent.ts", "../src/main/updater/common.ts", "../src/main/updater/http.ts", "../src/main/index.ts", "../src/main/ipcMain.ts", "../src/main/updater/index.ts", "../src/main/ipcPlugins.ts", "import-natives:~pluginNatives", "../src/plugins/appleMusic.desktop/native.ts", "../src/plugins/consoleShortcuts/native.ts", "../src/plugins/fixSpotifyEmbeds.desktop/native.ts", "../src/main/settings.ts", "../src/shared/SettingsStore.ts", "../src/utils/mergeDefaults.ts", "../src/main/utils/constants.ts", "../src/plugins/fixYoutubeEmbeds.desktop/native.ts", "../src/plugins/openInApp/native.ts", "../src/plugins/translate/native.ts", "../src/plugins/voiceMessages/native.ts", "../src/plugins/xsOverlay/native.ts", "../src/plugins/youtubeAdblock.desktop/native.ts", "file-uri:file://adguard.js?minify", "../src/shared/debounce.ts", "file-uri:file://monacoWin.html?minify&base64", "../src/main/themes/index.ts", "../src/main/utils/externalLinks.ts", "../src/main/utils/extensions.ts", "../node_modules/.pnpm/fflate@0.8.2/node_modules/fflate/esm/index.mjs", "../src/main/utils/crxToZip.ts"],
"sourcesContent": ["/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nexport const VencordFragment = /* #__PURE__*/ Symbol.for(\"react.fragment\");\nexport let VencordCreateElement =\n (...args) => (VencordCreateElement = Vencord.Webpack.Common.React.createElement)(...args);\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport https from \"https\";\n\nexport function get(url: string, options: https.RequestOptions = {}) {\n return new Promise<Buffer>((resolve, reject) => {\n https.get(url, options, res => {\n const { statusCode, statusMessage, headers } = res;\n if (statusCode! >= 400)\n return void reject(`${statusCode}: ${statusMessage} - ${url}`);\n if (statusCode! >= 300)\n return void resolve(get(headers.location!, options));\n\n const chunks = [] as Buffer[];\n res.on(\"error\", reject);\n\n res.on(\"data\", chunk => chunks.push(chunk));\n res.once(\"end\", () => resolve(Buffer.concat(chunks)));\n });\n });\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2023 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nexport const enum IpcEvents {\n QUICK_CSS_UPDATE = \"VencordQuickCssUpdate\",\n THEME_UPDATE = \"VencordThemeUpdate\",\n GET_QUICK_CSS = \"VencordGetQuickCss\",\n SET_QUICK_CSS = \"VencordSetQuickCss\",\n UPLOAD_THEME = \"VencordUploadTheme\",\n DELETE_THEME = \"VencordDeleteTheme\",\n GET_THEMES_DIR = \"VencordGetThemesDir\",\n GET_THEMES_LIST = \"VencordGetThemesList\",\n GET_THEME_DATA = \"VencordGetThemeData\",\n GET_THEME_SYSTEM_VALUES = \"VencordGetThemeSystemValues\",\n GET_SETTINGS_DIR = \"VencordGetSettingsDir\",\n GET_SETTINGS = \"VencordGetSettings\",\n SET_SETTINGS = \"VencordSetSettings\",\n OPEN_EXTERNAL = \"VencordOpenExternal\",\n OPEN_QUICKCSS = \"VencordOpenQuickCss\",\n GET_UPDATES = \"VencordGetUpdates\",\n GET_REPO = \"VencordGetRepo\",\n UPDATE = \"VencordUpdate\",\n BUILD = \"VencordBuild\",\n OPEN_MONACO_EDITOR = \"VencordOpenMonacoEditor\",\n\n GET_PLUGIN_IPC_METHOD_MAP = \"VencordGetPluginIpcMethodMap\",\n\n OPEN_IN_APP__RESOLVE_REDIRECT = \"VencordOIAResolveRedirect\",\n VOICE_MESSAGES_READ_RECORDING = \"VencordVMReadRecording\",\n}\n", "export default \"25ceff5\"", "export default \"Vendicated/Vencord\"", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2024 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport gitHash from \"~git-hash\";\nimport gitRemote from \"~git-remote\";\n\nexport { gitHash, gitRemote };\n\nexport const VENCORD_USER_AGENT = `Vencord/${gitHash}${gitRemote ? ` (https://github.com/${gitRemote})` : \"\"}`;\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nexport const VENCORD_FILES = [\n IS_DISCORD_DESKTOP ? \"patcher.js\" : \"vencordDesktopMain.js\",\n IS_DISCORD_DESKTOP ? \"preload.js\" : \"vencordDesktopPreload.js\",\n IS_DISCORD_DESKTOP ? \"renderer.js\" : \"vencordDesktopRenderer.js\",\n IS_DISCORD_DESKTOP ? \"renderer.css\" : \"vencordDesktopRenderer.css\",\n];\n\nexport function serializeErrors(func: (...args: any[]) => any) {\n return async function () {\n try {\n return {\n ok: true,\n value: await func(...arguments)\n };\n } catch (e: any) {\n return {\n ok: false,\n error: e instanceof Error ? {\n // prototypes get lost, so turn error into plain object\n ...e\n } : e\n };\n }\n };\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { get } from \"@main/utils/simpleGet\";\nimport { IpcEvents } from \"@shared/IpcEvents\";\nimport { VENCORD_USER_AGENT } from \"@shared/vencordUserAgent\";\nimport { ipcMain } from \"electron\";\nimport { writeFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nimport gitHash from \"~git-hash\";\nimport gitRemote from \"~git-remote\";\n\nimport { serializeErrors, VENCORD_FILES } from \"./common\";\n\nconst API_BASE = `https://api.github.com/repos/${gitRemote}`;\nlet PendingUpdates = [] as [string, string][];\n\nasync function githubGet(endpoint: string) {\n return get(API_BASE + endpoint, {\n headers: {\n Accept: \"application/vnd.github+json\",\n // \"All API requests MUST include a valid User-Agent header.\n // Requests with no User-Agent header will be rejected.\"\n \"User-Agent\": VENCORD_USER_AGENT\n }\n });\n}\n\nasync function calculateGitChanges() {\n const isOutdated = await fetchUpdates();\n if (!isOutdated) return [];\n\n const res = await githubGet(`/compare/${gitHash}...HEAD`);\n\n const data = JSON.parse(res.toString(\"utf-8\"));\n return data.commits.map((c: any) => ({\n // github api only sends the long sha\n hash: c.sha.slice(0, 7),\n author: c.author.login,\n message: c.commit.message.split(\"\\n\")[0]\n }));\n}\n\nasync function fetchUpdates() {\n const release = await githubGet(\"/releases/latest\");\n\n const data = JSON.parse(release.toString());\n const hash = data.name.slice(data.name.lastIndexOf(\" \") + 1);\n if (hash === gitHash)\n return false;\n\n data.assets.forEach(({ name, browser_download_url }) => {\n if (VENCORD_FILES.some(s => name.startsWith(s))) {\n PendingUpdates.push([name, browser_download_url]);\n }\n });\n return true;\n}\n\nasync function applyUpdates() {\n await Promise.all(PendingUpdates.map(\n async ([name, data]) => writeFile(\n join(__dirname, name),\n await get(data)\n )\n ));\n PendingUpdates = [];\n return true;\n}\n\nipcMain.handle(IpcEvents.GET_REPO, serializeErrors(() => `https://github.com/${gitRemote}`));\nipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));\nipcMain.handle(IpcEvents.UPDATE, serializeErrors(fetchUpdates));\nipcMain.handle(IpcEvents.BUILD, serializeErrors(applyUpdates));\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2023 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { app, protocol, session } from \"electron\";\nimport { join } from \"path\";\n\nimport { ensureSafePath } from \"./ipcMain\";\nimport { RendererSettings } from \"./settings\";\nimport { IS_VANILLA, THEMES_DIR } from \"./utils/constants\";\nimport { installExt } from \"./utils/extensions\";\n\nif (IS_VESKTOP || !IS_VANILLA) {\n app.whenReady().then(() => {\n // Source Maps! Maybe there's a better way but since the renderer is executed\n // from a string I don't think any other form of sourcemaps would work\n protocol.registerFileProtocol(\"vencord\", ({ url: unsafeUrl }, cb) => {\n let url = unsafeUrl.slice(\"vencord://\".length);\n if (url.endsWith(\"/\")) url = url.slice(0, -1);\n if (url.startsWith(\"/themes/\")) {\n const theme = url.slice(\"/themes/\".length);\n const safeUrl = ensureSafePath(THEMES_DIR, theme);\n if (!safeUrl) {\n cb({ statusCode: 403 });\n return;\n }\n cb(safeUrl.replace(/\\?v=\\d+$/, \"\"));\n return;\n }\n switch (url) {\n case \"renderer.js.map\":\n case \"vencordDesktopRenderer.js.map\":\n case \"preload.js.map\":\n case \"vencordDesktopPreload.js.map\":\n case \"patcher.js.map\":\n case \"vencordDesktopMain.js.map\":\n cb(join(__dirname, url));\n break;\n default:\n cb({ statusCode: 403 });\n }\n });\n\n try {\n if (RendererSettings.store.enableReactDevtools)\n installExt(\"fmkadmapgofadopljbjfkapdkoienihi\")\n .then(() => console.info(\"[Vencord] Installed React Developer Tools\"))\n .catch(err => console.error(\"[Vencord] Failed to install React Developer Tools\", err));\n } catch { }\n\n\n const findHeader = (headers: Record<string, string[]>, headerName: Lowercase<string>) => {\n return Object.keys(headers).find(h => h.toLowerCase() === headerName);\n };\n\n // Remove CSP\n type PolicyResult = Record<string, string[]>;\n\n const parsePolicy = (policy: string): PolicyResult => {\n const result: PolicyResult = {};\n policy.split(\";\").forEach(directive => {\n const [directiveKey, ...directiveValue] = directive.trim().split(/\\s+/g);\n if (directiveKey && !Object.prototype.hasOwnProperty.call(result, directiveKey)) {\n result[directiveKey] = directiveValue;\n }\n });\n\n return result;\n };\n const stringifyPolicy = (policy: PolicyResult): string =>\n Object.entries(policy)\n .filter(([, values]) => values?.length)\n .map(directive => directive.flat().join(\" \"))\n .join(\"; \");\n\n const patchCsp = (headers: Record<string, string[]>) => {\n const header = findHeader(headers, \"content-security-policy\");\n\n if (header) {\n const csp = parsePolicy(headers[header][0]);\n\n for (const directive of [\"style-src\", \"connect-src\", \"img-src\", \"font-src\", \"media-src\", \"worker-src\"]) {\n csp[directive] ??= [];\n csp[directive].push(\"*\", \"blob:\", \"data:\", \"vencord:\", \"'unsafe-inline'\");\n }\n\n // TODO: Restrict this to only imported packages with fixed version.\n // Perhaps auto generate with esbuild\n csp[\"script-src\"] ??= [];\n csp[\"script-src\"].push(\"'unsafe-eval'\", \"https://unpkg.com\", \"https://cdnjs.cloudflare.com\");\n headers[header] = [stringifyPolicy(csp)];\n }\n };\n\n session.defaultSession.webRequest.onHeadersReceived(({ responseHeaders, resourceType }, cb) => {\n if (responseHeaders) {\n if (resourceType === \"mainFrame\")\n patchCsp(responseHeaders);\n\n // Fix hosts that don't properly set the css content type, such as\n // raw.githubusercontent.com\n if (resourceType === \"stylesheet\") {\n const header = findHeader(responseHeaders, \"content-type\");\n if (header)\n responseHeaders[header] = [\"text/css\"];\n }\n }\n\n cb({ cancel: false, responseHeaders });\n });\n\n // assign a noop to onHeadersReceived to prevent other mods from adding their own incompatible ones.\n // For instance, OpenAsar adds their own that doesn't fix content-type for stylesheets which makes it\n // impossible to load css from github raw despite our fix above\n session.defaultSession.webRequest.onHeadersReceived = () => { };\n });\n}\n\nif (IS_DISCORD_DESKTOP) {\n require(\"./patcher\");\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport \"./updater\";\nimport \"./ipcPlugins\";\nimport \"./settings\";\n\nimport { debounce } from \"@shared/debounce\";\nimport { IpcEvents } from \"@shared/IpcEvents\";\nimport { BrowserWindow, ipcMain, shell, systemPreferences } from \"electron\";\nimport monacoHtml from \"file://monacoWin.html?minify&base64\";\nimport { FSWatcher, mkdirSync, watch, writeFileSync } from \"fs\";\nimport { open, readdir, readFile } from \"fs/promises\";\nimport { join, normalize } from \"path\";\n\nimport { getThemeInfo, stripBOM, UserThemeHeader } from \"./themes\";\nimport { ALLOWED_PROTOCOLS, QUICKCSS_PATH, THEMES_DIR } from \"./utils/constants\";\nimport { makeLinksOpenExternally } from \"./utils/externalLinks\";\n\nmkdirSync(THEMES_DIR, { recursive: true });\n\nexport function ensureSafePath(basePath: string, path: string) {\n const normalizedBasePath = normalize(basePath);\n const newPath = join(basePath, path);\n const normalizedPath = normalize(newPath);\n return normalizedPath.startsWith(normalizedBasePath) ? normalizedPath : null;\n}\n\nfunction readCss() {\n return readFile(QUICKCSS_PATH, \"utf-8\").catch(() => \"\");\n}\n\nasync function listThemes(): Promise<UserThemeHeader[]> {\n const files = await readdir(THEMES_DIR).catch(() => []);\n\n const themeInfo: UserThemeHeader[] = [];\n\n for (const fileName of files) {\n if (!fileName.endsWith(\".css\")) continue;\n\n const data = await getThemeData(fileName).then(stripBOM).catch(() => null);\n if (data == null) continue;\n\n themeInfo.push(getThemeInfo(data, fileName));\n }\n\n return themeInfo;\n}\n\nfunction getThemeData(fileName: string) {\n fileName = fileName.replace(/\\?v=\\d+$/, \"\");\n const safePath = ensureSafePath(THEMES_DIR, fileName);\n if (!safePath) return Promise.reject(`Unsafe path ${fileName}`);\n return readFile(safePath, \"utf-8\");\n}\n\nipcMain.handle(IpcEvents.OPEN_QUICKCSS, () => shell.openPath(QUICKCSS_PATH));\n\nipcMain.handle(IpcEvents.OPEN_EXTERNAL, (_, url) => {\n try {\n var { protocol } = new URL(url);\n } catch {\n throw \"Malformed URL\";\n }\n if (!ALLOWED_PROTOCOLS.includes(protocol))\n throw \"Disallowed protocol.\";\n\n shell.openExternal(url);\n});\n\n\nipcMain.handle(IpcEvents.GET_QUICK_CSS, () => readCss());\nipcMain.handle(IpcEvents.SET_QUICK_CSS, (_, css) =>\n writeFileSync(QUICKCSS_PATH, css)\n);\n\nipcMain.handle(IpcEvents.GET_THEMES_DIR, () => THEMES_DIR);\nipcMain.handle(IpcEvents.GET_THEMES_LIST, () => listThemes());\nipcMain.handle(IpcEvents.GET_THEME_DATA, (_, fileName) => getThemeData(fileName));\nipcMain.handle(IpcEvents.GET_THEME_SYSTEM_VALUES, () => ({\n // win & mac only\n \"os-accent-color\": `#${systemPreferences.getAccentColor?.() || \"\"}`\n}));\n\n\nexport function initIpc(mainWindow: BrowserWindow) {\n let quickCssWatcher: FSWatcher | undefined;\n\n open(QUICKCSS_PATH, \"a+\").then(fd => {\n fd.close();\n quickCssWatcher = watch(QUICKCSS_PATH, { persistent: false }, debounce(async () => {\n mainWindow.webContents.postMessage(IpcEvents.QUICK_CSS_UPDATE, await readCss());\n }, 50));\n }).catch(() => { });\n\n const themesWatcher = watch(THEMES_DIR, { persistent: false }, debounce(() => {\n mainWindow.webContents.postMessage(IpcEvents.THEME_UPDATE, void 0);\n }));\n\n mainWindow.once(\"closed\", () => {\n quickCssWatcher?.close();\n themesWatcher.close();\n });\n}\n\nipcMain.handle(IpcEvents.OPEN_MONACO_EDITOR, async () => {\n const title = \"Vencord QuickCSS Editor\";\n const existingWindow = BrowserWindow.getAllWindows().find(w => w.title === title);\n if (existingWindow && !existingWindow.isDestroyed()) {\n existingWindow.focus();\n return;\n }\n\n const win = new BrowserWindow({\n title,\n autoHideMenuBar: true,\n darkTheme: true,\n webPreferences: {\n preload: join(__dirname, IS_DISCORD_DESKTOP ? \"preload.js\" : \"vencordDesktopPreload.js\"),\n contextIsolation: true,\n nodeIntegration: false,\n sandbox: false\n }\n });\n\n makeLinksOpenExternally(win);\n\n await win.loadURL(`data:text/html;base64,${monacoHtml}`);\n});\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nif (!IS_UPDATER_DISABLED)\n require(IS_STANDALONE ? \"./http\" : \"./git\");\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2023 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { IpcEvents } from \"@shared/IpcEvents\";\nimport { ipcMain } from \"electron\";\n\nimport PluginNatives from \"~pluginNatives\";\n\nconst PluginIpcMappings = {} as Record<string, Record<string, string>>;\nexport type PluginIpcMappings = typeof PluginIpcMappings;\n\nfor (const [plugin, methods] of Object.entries(PluginNatives)) {\n const entries = Object.entries(methods);\n if (!entries.length) continue;\n\n const mappings = PluginIpcMappings[plugin] = {};\n\n for (const [methodName, method] of entries) {\n const key = `VencordPluginNative_${plugin}_${methodName}`;\n ipcMain.handle(key, method);\n mappings[methodName] = key;\n }\n}\n\nipcMain.on(IpcEvents.GET_PLUGIN_IPC_METHOD_MAP, e => {\n e.returnValue = PluginIpcMappings;\n});\n", "import * as p0 from \"./plugins/appleMusic.desktop/native\";\nimport * as p1 from \"./plugins/consoleShortcuts/native\";\nimport * as p2 from \"./plugins/fixSpotifyEmbeds.desktop/native\";\nimport * as p3 from \"./plugins/fixYoutubeEmbeds.desktop/native\";\nimport * as p4 from \"./plugins/openInApp/native\";\nimport * as p5 from \"./plugins/translate/native\";\nimport * as p6 from \"./plugins/voiceMessages/native\";\nimport * as p7 from \"./plugins/xsOverlay/native\";\nimport * as p8 from \"./plugins/youtubeAdblock.desktop/native\";\nexport default {\n\"AppleMusicRichPresence\":p0,\n\"ConsoleShortcuts\":p1,\n\"FixSpotifyEmbeds\":p2,\n\"FixYoutubeEmbeds\":p3,\n\"OpenInApp\":p4,\n\"Translate\":p5,\n\"VoiceMessages\":p6,\n\"XSOverlay\":p7,\n\"YoutubeAdblock\":p8,\n};", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2024 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { execFile } from \"child_process\";\nimport { promisify } from \"util\";\n\nimport type { TrackData } from \".\";\n\nconst exec = promisify(execFile);\n\nasync function applescript(cmds: string[]) {\n const { stdout } = await exec(\"osascript\", cmds.map(c => [\"-e\", c]).flat());\n return stdout;\n}\n\ninterface RemoteData {\n appleMusicLink?: string,\n songLink?: string,\n albumArtwork?: string,\n artistArtwork?: string;\n}\n\nlet cachedRemoteData: { id: string, data: RemoteData; } | { id: string, failures: number; } | null = null;\n\nconst APPLE_MUSIC_BUNDLE_REGEX = /<script type=\"module\" crossorigin src=\"([a-zA-Z0-9.\\-/]+)\"><\\/script>/;\nconst APPLE_MUSIC_TOKEN_REGEX = /\\w+=\"([A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*)\",\\w+=\"x-apple-jingle-correlation-key\"/;\n\nlet cachedToken: string | undefined = undefined;\n\nconst getToken = async () => {\n if (cachedToken) return cachedToken;\n\n const html = await fetch(\"https://music.apple.com/\").then(r => r.text());\n const bundleUrl = new URL(html.match(APPLE_MUSIC_BUNDLE_REGEX)![1], \"https://music.apple.com/\");\n\n const bundle = await fetch(bundleUrl).then(r => r.text());\n const token = bundle.match(APPLE_MUSIC_TOKEN_REGEX)![1];\n\n cachedToken = token;\n return token;\n};\n\nasync function fetchRemoteData({ id, name, artist, album }: { id: string, name: string, artist: string, album: string; }) {\n if (id === cachedRemoteData?.id) {\n if (\"data\" in cachedRemoteData) return cachedRemoteData.data;\n if (\"failures\" in cachedRemoteData && cachedRemoteData.failures >= 5) return null;\n }\n\n try {\n const dataUrl = new URL(\"https://amp-api-edge.music.apple.com/v1/catalog/us/search\");\n dataUrl.searchParams.set(\"platform\", \"web\");\n dataUrl.searchParams.set(\"l\", \"en-US\");\n dataUrl.searchParams.set(\"limit\", \"1\");\n dataUrl.searchParams.set(\"with\", \"serverBubbles\");\n dataUrl.searchParams.set(\"types\", \"songs\");\n dataUrl.searchParams.set(\"term\", `${name} ${artist} ${album}`);\n dataUrl.searchParams.set(\"include[songs]\", \"artists\");\n\n const token = await getToken();\n\n const songData = await fetch(dataUrl, {\n headers: {\n \"accept\": \"*/*\",\n \"accept-language\": \"en-US,en;q=0.9\",\n \"authorization\": `Bearer ${token}`,\n \"user-agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36\",\n \"origin\": \"https://music.apple.com\",\n },\n })\n .then(r => r.json())\n .then(data => data.results.song.data[0]);\n\n cachedRemoteData = {\n id,\n data: {\n appleMusicLink: songData.attributes.url,\n songLink: `https://song.link/i/${songData.id}`,\n albumArtwork: songData.attributes.artwork.url.replace(\"{w}x{h}\", \"512x512\"),\n artistArtwork: songData.relationships.artists.data[0].attributes.artwork.url.replace(\"{w}x{h}\", \"512x512\"),\n }\n };\n\n return cachedRemoteData.data;\n } catch (e) {\n console.error(\"[AppleMusicRichPresence] Failed to fetch remote data:\", e);\n cachedRemoteData = {\n id,\n failures: (id === cachedRemoteData?.id && \"failures\" in cachedRemoteData ? cachedRemoteData.failures : 0) + 1\n };\n return null;\n }\n}\n\nexport async function fetchTrackData(): Promise<TrackData | null> {\n try {\n await exec(\"pgrep\", [\"^Music$\"]);\n } catch (error) {\n return null;\n }\n\n const playerState = await applescript(['tell application \"Music\"', \"get player state\", \"end tell\"])\n .then(out => out.trim());\n if (playerState !== \"playing\") return null;\n\n const playerPosition = await applescript(['tell application \"Music\"', \"get player position\", \"end tell\"])\n .then(text => Number.parseFloat(text.trim()));\n\n const stdout = await applescript([\n 'set output to \"\"',\n 'tell application \"Music\"',\n \"set t_id to database id of current track\",\n \"set t_name to name of current track\",\n \"set t_album to album of current track\",\n \"set t_artist to artist of current track\",\n \"set t_duration to duration of current track\",\n 'set output to \"\" & t_id & \"\\\\n\" & t_name & \"\\\\n\" & t_album & \"\\\\n\" & t_artist & \"\\\\n\" & t_duration',\n \"end tell\",\n \"return output\"\n ]);\n\n const [id, name, album, artist, durationStr] = stdout.split(\"\\n\").filter(k => !!k);\n const duration = Number.parseFloat(durationStr);\n\n const remoteData = await fetchRemoteData({ id, name, artist, album });\n\n return { name, album, artist, playerPosition, duration, ...remoteData };\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2024 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { IpcMainInvokeEvent } from \"electron\";\n\nexport function initDevtoolsOpenEagerLoad(e: IpcMainInvokeEvent) {\n const handleDevtoolsOpened = () => e.sender.executeJavaScript(\"Vencord.Plugins.plugins.ConsoleShortcuts.eagerLoad(true)\");\n\n if (e.sender.isDevToolsOpened())\n handleDevtoolsOpened();\n else\n e.sender.once(\"devtools-opened\", () => handleDevtoolsOpened());\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { RendererSettings } from \"@main/settings\";\nimport { app } from \"electron\";\n\napp.on(\"browser-window-created\", (_, win) => {\n win.webContents.on(\"frame-created\", (_, { frame }) => {\n frame.once(\"dom-ready\", () => {\n if (frame.url.startsWith(\"https://open.spotify.com/embed/\")) {\n const settings = RendererSettings.store.plugins?.FixSpotifyEmbeds;\n if (!settings?.enabled) return;\n\n frame.executeJavaScript(`\n const original = Audio.prototype.play;\n Audio.prototype.play = function() {\n this.volume = ${(settings.volume / 100) || 0.1};\n return original.apply(this, arguments);\n }\n `);\n }\n });\n });\n});\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2024 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport type { Settings } from \"@api/Settings\";\nimport { IpcEvents } from \"@shared/IpcEvents\";\nimport { SettingsStore } from \"@shared/SettingsStore\";\nimport { mergeDefaults } from \"@utils/mergeDefaults\";\nimport { ipcMain } from \"electron\";\nimport { mkdirSync, readFileSync, writeFileSync } from \"fs\";\n\nimport { NATIVE_SETTINGS_FILE, SETTINGS_DIR, SETTINGS_FILE } from \"./utils/constants\";\n\nmkdirSync(SETTINGS_DIR, { recursive: true });\n\nfunction readSettings<T = object>(name: string, file: string): Partial<T> {\n try {\n return JSON.parse(readFileSync(file, \"utf-8\"));\n } catch (err: any) {\n if (err?.code !== \"ENOENT\")\n console.error(`Failed to read ${name} settings`, err);\n\n return {};\n }\n}\n\nexport const RendererSettings = new SettingsStore(readSettings<Settings>(\"renderer\", SETTINGS_FILE));\n\nRendererSettings.addGlobalChangeListener(() => {\n try {\n writeFileSync(SETTINGS_FILE, JSON.stringify(RendererSettings.plain, null, 4));\n } catch (e) {\n console.error(\"Failed to write renderer settings\", e);\n }\n});\n\nipcMain.handle(IpcEvents.GET_SETTINGS_DIR, () => SETTINGS_DIR);\nipcMain.on(IpcEvents.GET_SETTINGS, e => e.returnValue = RendererSettings.plain);\n\nipcMain.handle(IpcEvents.SET_SETTINGS, (_, data: Settings, pathToNotify?: string) => {\n RendererSettings.setData(data, pathToNotify);\n});\n\nexport interface NativeSettings {\n plugins: {\n [plugin: string]: {\n [setting: string]: any;\n };\n };\n}\n\nconst DefaultNativeSettings: NativeSettings = {\n plugins: {}\n};\n\nconst nativeSettings = readSettings<NativeSettings>(\"native\", NATIVE_SETTINGS_FILE);\nmergeDefaults(nativeSettings, DefaultNativeSettings);\n\nexport const NativeSettings = new SettingsStore(nativeSettings);\n\nNativeSettings.addGlobalChangeListener(() => {\n try {\n writeFileSync(NATIVE_SETTINGS_FILE, JSON.stringify(NativeSettings.plain, null, 4));\n } catch (e) {\n console.error(\"Failed to write native settings\", e);\n }\n});\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2024 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { LiteralUnion } from \"type-fest\";\n\n// Resolves a possibly nested prop in the form of \"some.nested.prop\" to type of T.some.nested.prop\ntype ResolvePropDeep<T, P> = P extends `${infer Pre}.${infer Suf}`\n ? Pre extends keyof T\n ? ResolvePropDeep<T[Pre], Suf>\n : any\n : P extends keyof T\n ? T[P]\n : any;\n\ninterface SettingsStoreOptions {\n readOnly?: boolean;\n getDefaultValue?: (data: {\n target: any;\n key: string;\n root: any;\n path: string;\n }) => any;\n}\n\n// merges the SettingsStoreOptions type into the class\nexport interface SettingsStore<T extends object> extends SettingsStoreOptions { }\n\n/**\n * The SettingsStore allows you to easily create a mutable store that\n * has support for global and path-based change listeners.\n */\nexport class SettingsStore<T extends object> {\n private pathListeners = new Map<string, Set<(newData: any) => void>>();\n private globalListeners = new Set<(newData: T, path: string) => void>();\n\n /**\n * The store object. Making changes to this object will trigger the applicable change listeners\n */\n public declare store: T;\n /**\n * The plain data. Changes to this object will not trigger any change listeners\n */\n public declare plain: T;\n\n public constructor(plain: T, options: SettingsStoreOptions = {}) {\n this.plain = plain;\n this.store = this.makeProxy(plain);\n Object.assign(this, options);\n }\n\n private makeProxy(object: any, root: T = object, path: string = \"\") {\n const self = this;\n\n return new Proxy(object, {\n get(target, key: string) {\n let v = target[key];\n\n if (!(key in target) && self.getDefaultValue) {\n v = self.getDefaultValue({\n target,\n key,\n root,\n path\n });\n }\n\n if (typeof v === \"object\" && v !== null && !Array.isArray(v))\n return self.makeProxy(v, root, `${path}${path && \".\"}${key}`);\n\n return v;\n },\n set(target, key: string, value) {\n if (target[key] === value) return true;\n\n Reflect.set(target, key, value);\n const setPath = `${path}${path && \".\"}${key}`;\n\n self.globalListeners.forEach(cb => cb(value, setPath));\n self.pathListeners.get(setPath)?.forEach(cb => cb(value));\n\n return true;\n }\n });\n }\n\n /**\n * Set the data of the store.\n * This will update this.store and this.plain (and old references to them will be stale! Avoid storing them in variables)\n *\n * Additionally, all global listeners (and those for pathToNotify, if specified) will be called with the new data\n * @param value New data\n * @param pathToNotify Optional path to notify instead of globally. Used to transfer path via ipc\n */\n public setData(value: T, pathToNotify?: string) {\n if (this.readOnly) throw new Error(\"SettingsStore is read-only\");\n\n this.plain = value;\n this.store = this.makeProxy(value);\n\n if (pathToNotify) {\n let v = value;\n\n const path = pathToNotify.split(\".\");\n for (const p of path) {\n if (!v) {\n console.warn(\n `Settings#setData: Path ${pathToNotify} does not exist in new data. Not dispatching update`\n );\n return;\n }\n v = v[p];\n }\n\n this.pathListeners.get(pathToNotify)?.forEach(cb => cb(v));\n }\n\n this.markAsChanged();\n }\n\n /**\n * Add a global change listener, that will fire whenever any setting is changed\n *\n * @param data The new data. This is either the new value set on the path, or the new root object if it was changed\n * @param path The path of the setting that was changed. Empty string if the root object was changed\n */\n public addGlobalChangeListener(cb: (data: any, path: string) => void) {\n this.globalListeners.add(cb);\n }\n\n /**\n * Add a scoped change listener that will fire whenever a setting matching the specified path is changed.\n *\n * For example if path is `\"foo.bar\"`, the listener will fire on\n * ```js\n * Setting.store.foo.bar = \"hi\"\n * ```\n * but not on\n * ```js\n * Setting.store.foo.baz = \"hi\"\n * ```\n * @param path\n * @param cb\n */\n public addChangeListener<P extends LiteralUnion<keyof T, string>>(\n path: P,\n cb: (data: ResolvePropDeep<T, P>) => void\n ) {\n const listeners = this.pathListeners.get(path as string) ?? new Set();\n listeners.add(cb);\n this.pathListeners.set(path as string, listeners);\n }\n\n /**\n * Remove a global listener\n * @see {@link addGlobalChangeListener}\n */\n public removeGlobalChangeListener(cb: (data: any, path: string) => void) {\n this.globalListeners.delete(cb);\n }\n\n /**\n * Remove a scoped listener\n * @see {@link addChangeListener}\n */\n public removeChangeListener(path: LiteralUnion<keyof T, string>, cb: (data: any) => void) {\n const listeners = this.pathListeners.get(path as string);\n if (!listeners) return;\n\n listeners.delete(cb);\n if (!listeners.size) this.pathListeners.delete(path as string);\n }\n\n /**\n * Call all global change listeners\n */\n public markAsChanged() {\n this.globalListeners.forEach(cb => cb(this.plain, \"\"));\n }\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2024 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\n/**\n * Recursively merges defaults into an object and returns the same object\n * @param obj Object\n * @param defaults Defaults\n * @returns obj\n */\nexport function mergeDefaults<T>(obj: T, defaults: T): T {\n for (const key in defaults) {\n const v = defaults[key];\n if (typeof v === \"object\" && !Array.isArray(v)) {\n obj[key] ??= {} as any;\n mergeDefaults(obj[key], v);\n } else {\n obj[key] ??= v;\n }\n }\n return obj;\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { app } from \"electron\";\nimport { join } from \"path\";\n\nexport const DATA_DIR = process.env.VENCORD_USER_DATA_DIR ?? (\n process.env.DISCORD_USER_DATA_DIR\n ? join(process.env.DISCORD_USER_DATA_DIR, \"..\", \"VencordData\")\n : join(app.getPath(\"userData\"), \"..\", \"Vencord\")\n);\nexport const SETTINGS_DIR = join(DATA_DIR, \"settings\");\nexport const THEMES_DIR = join(DATA_DIR, \"themes\");\nexport const QUICKCSS_PATH = join(SETTINGS_DIR, \"quickCss.css\");\nexport const SETTINGS_FILE = join(SETTINGS_DIR, \"settings.json\");\nexport const NATIVE_SETTINGS_FILE = join(SETTINGS_DIR, \"native-settings.json\");\nexport const ALLOWED_PROTOCOLS = [\n \"https:\",\n \"http:\",\n \"steam:\",\n \"spotify:\",\n \"com.epicgames.launcher:\",\n \"tidal:\",\n \"itunes:\",\n];\n\nexport const IS_VANILLA = /* @__PURE__ */ process.argv.includes(\"--vanilla\");\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { RendererSettings } from \"@main/settings\";\nimport { app } from \"electron\";\n\napp.on(\"browser-window-created\", (_, win) => {\n win.webContents.on(\"frame-created\", (_, { frame }) => {\n frame.once(\"dom-ready\", () => {\n if (frame.url.startsWith(\"https://www.youtube.com/\")) {\n const settings = RendererSettings.store.plugins?.FixYoutubeEmbeds;\n if (!settings?.enabled) return;\n\n frame.executeJavaScript(`\n new MutationObserver(() => {\n if(\n document.querySelector('div.ytp-error-content-wrap-subreason a[href*=\"www.youtube.com/watch?v=\"]')\n ) location.reload()\n }).observe(document.body, { childList: true, subtree:true });\n `);\n }\n });\n });\n});\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { IpcMainInvokeEvent } from \"electron\";\nimport { request } from \"https\";\n\n// These links don't support CORS, so this has to be native\nconst validRedirectUrls = /^https:\\/\\/(spotify\\.link|s\\.team)\\/.+$/;\n\nfunction getRedirect(url: string) {\n return new Promise<string>((resolve, reject) => {\n const req = request(new URL(url), { method: \"HEAD\" }, res => {\n resolve(\n res.headers.location\n ? getRedirect(res.headers.location)\n : url\n );\n });\n req.on(\"error\", reject);\n req.end();\n });\n}\n\nexport async function resolveRedirect(_: IpcMainInvokeEvent, url: string) {\n if (!validRedirectUrls.test(url)) return url;\n\n return getRedirect(url);\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2024 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { IpcMainInvokeEvent } from \"electron\";\n\nexport async function makeDeeplTranslateRequest(_: IpcMainInvokeEvent, pro: boolean, apiKey: string, payload: string) {\n const url = pro\n ? \"https://api.deepl.com/v2/translate\"\n : \"https://api-free.deepl.com/v2/translate\";\n\n try {\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Authorization\": `DeepL-Auth-Key ${apiKey}`\n },\n body: payload\n });\n\n const data = await res.text();\n return { status: res.status, data };\n } catch (e) {\n return { status: -1, data: String(e) };\n }\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { app } from \"electron\";\nimport { readFile } from \"fs/promises\";\nimport { basename, normalize } from \"path\";\n\nexport async function readRecording(_, filePath: string) {\n filePath = normalize(filePath);\n const filename = basename(filePath);\n const discordBaseDirWithTrailingSlash = normalize(app.getPath(\"userData\") + \"/\");\n console.log(filename, discordBaseDirWithTrailingSlash, filePath);\n if (filename !== \"recording.ogg\" || !filePath.startsWith(discordBaseDirWithTrailingSlash)) return null;\n\n try {\n const buf = await readFile(filePath);\n return new Uint8Array(buf.buffer);\n } catch {\n return null;\n }\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { createSocket, Socket } from \"dgram\";\n\nlet xsoSocket: Socket;\n\nexport function sendToOverlay(_, data: any) {\n data.messageType = data.type;\n const json = JSON.stringify(data);\n xsoSocket ??= createSocket(\"udp4\");\n xsoSocket.send(json, 42069, \"127.0.0.1\");\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { RendererSettings } from \"@main/settings\";\nimport { app } from \"electron\";\nimport adguard from \"file://adguard.js?minify\";\n\napp.on(\"browser-window-created\", (_, win) => {\n win.webContents.on(\"frame-created\", (_, { frame }) => {\n frame.once(\"dom-ready\", () => {\n if (!RendererSettings.store.plugins?.YoutubeAdblock?.enabled) return;\n\n if (frame.url.includes(\"youtube.com/embed/\") || (frame.url.includes(\"discordsays\") && frame.url.includes(\"youtube.com\"))) {\n frame.executeJavaScript(adguard);\n }\n });\n });\n});\n", "export default \"\\\"use strict\\\";const hiddenCSS=[\\\"#__ffYoutube1\\\",\\\"#__ffYoutube2\\\",\\\"#__ffYoutube3\\\",\\\"#__ffYoutube4\\\",\\\"#feed-pyv-container\\\",\\\"#feedmodule-PRO\\\",\\\"#homepage-chrome-side-promo\\\",\\\"#merch-shelf\\\",\\\"#offer-module\\\",'#pla-shelf > ytd-pla-shelf-renderer[class=\\\"style-scope ytd-watch\\\"]',\\\"#pla-shelf\\\",\\\"#premium-yva\\\",\\\"#promo-info\\\",\\\"#promo-list\\\",\\\"#promotion-shelf\\\",\\\"#related > ytd-watch-next-secondary-results-renderer > #items > ytd-compact-promoted-video-renderer.ytd-watch-next-secondary-results-renderer\\\",\\\"#search-pva\\\",\\\"#shelf-pyv-container\\\",\\\"#video-masthead\\\",\\\"#watch-branded-actions\\\",\\\"#watch-buy-urls\\\",\\\"#watch-channel-brand-div\\\",\\\"#watch7-branded-banner\\\",\\\"#YtKevlarVisibilityIdentifier\\\",\\\"#YtSparklesVisibilityIdentifier\\\",\\\".carousel-offer-url-container\\\",\\\".companion-ad-container\\\",\\\".GoogleActiveViewElement\\\",'.list-view[style=\\\"margin: 7px 0pt;\\\"]',\\\".promoted-sparkles-text-search-root-container\\\",\\\".promoted-videos\\\",\\\".searchView.list-view\\\",\\\".sparkles-light-cta\\\",\\\".watch-extra-info-column\\\",\\\".watch-extra-info-right\\\",\\\".ytd-carousel-ad-renderer\\\",\\\".ytd-compact-promoted-video-renderer\\\",\\\".ytd-companion-slot-renderer\\\",\\\".ytd-merch-shelf-renderer\\\",\\\".ytd-player-legacy-desktop-watch-ads-renderer\\\",\\\".ytd-promoted-sparkles-text-search-renderer\\\",\\\".ytd-promoted-video-renderer\\\",\\\".ytd-search-pyv-renderer\\\",\\\".ytd-video-masthead-ad-v3-renderer\\\",\\\".ytp-ad-action-interstitial-background-container\\\",\\\".ytp-ad-action-interstitial-slot\\\",\\\".ytp-ad-image-overlay\\\",\\\".ytp-ad-overlay-container\\\",\\\".ytp-ad-progress\\\",\\\".ytp-ad-progress-list\\\",'[class*=\\\"ytd-display-ad-\\\"]','[layout*=\\\"display-ad-\\\"]','a[href^=\\\"http://www.youtube.com/cthru?\\\"]','a[href^=\\\"https://www.youtube.com/cthru?\\\"]',\\\"ytd-action-companion-ad-renderer\\\",\\\"ytd-banner-promo-renderer\\\",\\\"ytd-compact-promoted-video-renderer\\\",\\\"ytd-companion-slot-renderer\\\",\\\"ytd-display-ad-renderer\\\",\\\"ytd-promoted-sparkles-text-search-renderer\\\",\\\"ytd-promoted-sparkles-web-renderer\\\",\\\"ytd-search-pyv-renderer\\\",\\\"ytd-single-option-survey-renderer\\\",\\\"ytd-video-masthead-ad-advertiser-info-renderer\\\",\\\"ytd-video-masthead-ad-v3-renderer\\\",\\\"YTM-PROMOTED-VIDEO-RENDERER\\\"],hideElements=()=>{const e=hiddenCSS;if(!e)return;const t=e.join(\\\", \\\")+\\\" { display: none!important; }\\\",r=document.createElement(\\\"style\\\");r.textContent=t,document.head.appendChild(r)},observeDomChanges=e=>{new MutationObserver(r=>{e(r)}).observe(document.documentElement,{childList:!0,subtree:!0})},hideDynamicAds=()=>{const e=document.querySelectorAll(\\\"#contents > ytd-rich-item-renderer ytd-display-ad-renderer\\\");e.length!==0&&e.forEach(t=>{if(t.parentNode&&t.parentNode.parentNode){const r=t.parentNode.parentNode;r.localName===\\\"ytd-rich-item-renderer\\\"&&(r.style.display=\\\"none\\\")}})},autoSkipAds=()=>{if(document.querySelector(\\\".ad-showing\\\")){const e=document.querySelector(\\\"video\\\");e&&e.duration&&(e.currentTime=e.duration,setTimeout(()=>{const t=document.querySelector(\\\"button.ytp-ad-skip-button\\\");t&&t.click()},100))}},overrideObject=(e,t,r)=>{if(!e)return!1;let n=!1;for(const o in e)e.hasOwnProperty(o)&&o===t?(e[o]=r,n=!0):e.hasOwnProperty(o)&&typeof e[o]==\\\"object\\\"&&overrideObject(e[o],t,r)&&(n=!0);return n},jsonOverride=(e,t)=>{const r=JSON.parse;JSON.parse=(...n)=>{const o=r.apply(this,n);return overrideObject(o,e,t),o},Response.prototype.json=new Proxy(Response.prototype.json,{async apply(...n){const o=await Reflect.apply(...n);return overrideObject(o,e,t),o}})};jsonOverride(\\\"adPlacements\\\",[]),jsonOverride(\\\"playerAds\\\",[]),hideElements(),hideDynamicAds(),autoSkipAds(),observeDomChanges(()=>{hideDynamicAds(),autoSkipAds()});\\n\"", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\n/**\n * Returns a new function that will call the wrapped function\n * after the specified delay. If the function is called again\n * within the delay, the timer will be reset.\n * @param func The function to wrap\n * @param delay The delay in milliseconds\n */\nexport function debounce<T extends Function>(func: T, delay = 300): T {\n let timeout: NodeJS.Timeout;\n return function (...args: any[]) {\n clearTimeout(timeout);\n timeout = setTimeout(() => { func(...args); }, delay);\n } as any;\n}\n", "export default \"PCFkb2N0eXBlIGh0bWw+PGh0bWwgbGFuZz0iZW4iPjxoZWFkPjxtZXRhIGNoYXJzZXQ9InV0Zi04Ij48dGl0bGU+VmVuY29yZCBRdWlja0NTUyBFZGl0b3I8L3RpdGxlPjxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9jZG4uanNkZWxpdnIubmV0L25wbS9tb25hY28tZWRpdG9yQDAuNTAuMC9taW4vdnMvZWRpdG9yL2VkaXRvci5tYWluLmNzcyIgaW50ZWdyaXR5PSJzaGEyNTYtdGlKUFEyTzA0ei9wWi9Bd2R5SWdock9NemV3ZitQSXZFbDFZS2JRdnNaaz0iIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiIHJlZmVycmVycG9saWN5PSJuby1yZWZlcnJlciI+PHN0eWxlPiNjb250YWluZXIsYm9keSxodG1se3Bvc2l0aW9uOmFic29sdXRlO2xlZnQ6MDt0b3A6MDt3aWR0aDoxMDAlO2hlaWdodDoxMDAlO21hcmdpbjowO3BhZGRpbmc6MDtvdmVyZmxvdzpoaWRkZW59PC9zdHlsZT48L2hlYWQ+PGJvZHk+PGRpdiBpZD0iY29udGFpbmVyIj48L2Rpdj48c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG4uanNkZWxpdnIubmV0L25wbS9tb25hY28tZWRpdG9yQDAuNTAuMC9taW4vdnMvbG9hZGVyLmpzIiBpbnRlZ3JpdHk9InNoYTI1Ni1LY1U0OFRHcjg0cjd1bkY3SjVJZ0JvOTVhZVZyRWJyR2UwNFM3VGNGVWpzPSIgY3Jvc3NvcmlnaW49ImFub255bW91cyIgcmVmZXJyZXJwb2xpY3k9Im5vLXJlZmVycmVyIj48L3NjcmlwdD48c2NyaXB0PnJlcXVpcmUuY29uZmlnKHtwYXRoczp7dnM6Imh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9ucG0vbW9uYWNvLWVkaXRvckAwLjUwLjAvbWluL3ZzIn19KSxyZXF1aXJlKFsidnMvZWRpdG9yL2VkaXRvci5tYWluIl0sKCgpPT57Z2V0Q3VycmVudENzcygpLnRoZW4oKGU9Pnt2YXIgdD1tb25hY28uZWRpdG9yLmNyZWF0ZShkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiY29udGFpbmVyIikse3ZhbHVlOmUsbGFuZ3VhZ2U6ImNzcyIsdGhlbWU6Z2V0VGhlbWUoKX0pO3Qub25EaWRDaGFuZ2VNb2RlbENvbnRlbnQoKCgpPT5zZXRDc3ModC5nZXRWYWx1ZSgpKSkpLHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJyZXNpemUiLCgoKT0+e3QubGF5b3V0KCl9KSl9KSl9KSk8L3NjcmlwdD48L2JvZHk+PC9odG1sPg==\"", "/* eslint-disable simple-header/header */\n\n/*!\n * BetterDiscord addon meta parser\n * Copyright 2023 BetterDiscord contributors\n * Copyright 2023 Vendicated and Vencord contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst splitRegex = /[^\\S\\r\\n]*?\\r?(?:\\r\\n|\\n)[^\\S\\r\\n]*?\\*[^\\S\\r\\n]?/;\nconst escapedAtRegex = /^\\\\@/;\n\nexport interface UserThemeHeader {\n fileName: string;\n name: string;\n author: string;\n description: string;\n version?: string;\n license?: string;\n source?: string;\n website?: string;\n invite?: string;\n}\n\nfunction makeHeader(fileName: string, opts: Partial<UserThemeHeader> = {}): UserThemeHeader {\n return {\n fileName,\n name: opts.name ?? fileName.replace(/\\.css$/i, \"\"),\n author: opts.author ?? \"Unknown Author\",\n description: opts.description ?? \"A Discord Theme.\",\n version: opts.version,\n license: opts.license,\n source: opts.source,\n website: opts.website,\n invite: opts.invite\n };\n}\n\nexport function stripBOM(fileContent: string) {\n if (fileContent.charCodeAt(0) === 0xFEFF) {\n fileContent = fileContent.slice(1);\n }\n return fileContent;\n}\n\nexport function getThemeInfo(css: string, fileName: string): UserThemeHeader {\n if (!css) return makeHeader(fileName);\n\n const block = css.split(\"/**\", 2)?.[1]?.split(\"*/\", 1)?.[0];\n if (!block) return makeHeader(fileName);\n\n const header: Partial<UserThemeHeader> = {};\n let field = \"\";\n let accum = \"\";\n for (const line of block.split(splitRegex)) {\n if (line.length === 0) continue;\n if (line.charAt(0) === \"@\" && line.charAt(1) !== \" \") {\n header[field] = accum.trim();\n const l = line.indexOf(\" \");\n field = line.substring(1, l);\n accum = line.substring(l + 1);\n }\n else {\n accum += \" \" + line.replace(\"\\\\n\", \"\\n\").replace(escapedAtRegex, \"@\");\n }\n }\n header[field] = accum.trim();\n delete header[\"\"];\n return makeHeader(fileName, header);\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2023 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { type BrowserWindow, shell } from \"electron\";\n\nexport function makeLinksOpenExternally(win: BrowserWindow) {\n win.webContents.setWindowOpenHandler(({ url }) => {\n switch (url) {\n case \"about:blank\":\n case \"https://discord.com/popout\":\n case \"https://ptb.discord.com/popout\":\n case \"https://canary.discord.com/popout\":\n return { action: \"allow\" };\n }\n\n try {\n var { protocol } = new URL(url);\n } catch {\n return { action: \"deny\" };\n }\n\n switch (protocol) {\n case \"http:\":\n case \"https:\":\n case \"mailto:\":\n case \"steam:\":\n case \"spotify:\":\n shell.openExternal(url);\n }\n\n return { action: \"deny\" };\n });\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { session } from \"electron\";\nimport { unzip } from \"fflate\";\nimport { constants as fsConstants } from \"fs\";\nimport { access, mkdir, rm, writeFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nimport { DATA_DIR } from \"./constants\";\nimport { crxToZip } from \"./crxToZip\";\nimport { get } from \"./simpleGet\";\n\nconst extensionCacheDir = join(DATA_DIR, \"ExtensionCache\");\n\nasync function extract(data: Buffer, outDir: string) {\n await mkdir(outDir, { recursive: true });\n return new Promise<void>((resolve, reject) => {\n unzip(data, (err, files) => {\n if (err) return void reject(err);\n Promise.all(Object.keys(files).map(async f => {\n // Signature stuff\n // 'Cannot load extension with file or directory name\n // _metadata. Filenames starting with \"_\" are reserved for use by the system.';\n if (f.startsWith(\"_metadata/\")) return;\n\n if (f.endsWith(\"/\")) return void mkdir(join(outDir, f), { recursive: true });\n\n const pathElements = f.split(\"/\");\n const name = pathElements.pop()!;\n const directories = pathElements.join(\"/\");\n const dir = join(outDir, directories);\n\n if (directories) {\n await mkdir(dir, { recursive: true });\n }\n\n await writeFile(join(dir, name), files[f]);\n }))\n .then(() => resolve())\n .catch(err => {\n rm(outDir, { recursive: true, force: true });\n reject(err);\n });\n });\n });\n}\n\nexport async function installExt(id: string) {\n const extDir = join(extensionCacheDir, `${id}`);\n\n try {\n await access(extDir, fsConstants.F_OK);\n } catch (err) {\n const url = id === \"fmkadmapgofadopljbjfkapdkoienihi\"\n // React Devtools v4.25\n // v4.27 is broken in Electron, see https://github.com/facebook/react/issues/25843\n // Unfortunately, Google does not serve old versions, so this is the only way\n ? \"https://raw.githubusercontent.com/Vendicated/random-files/f6f550e4c58ac5f2012095a130406c2ab25b984d/fmkadmapgofadopljbjfkapdkoienihi.zip\"\n : `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=32`;\n const buf = await get(url, {\n headers: {\n \"User-Agent\": \"Vencord (https://github.com/Vendicated/Vencord)\"\n }\n });\n await extract(crxToZip(buf), extDir).catch(console.error);\n }\n\n session.defaultSession.loadExtension(extDir);\n}\n", "import { createRequire } from 'module';\nvar require = createRequire('/');\n// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\n// Mediocre shim\nvar Worker;\nvar workerAdd = \";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global\";\ntry {\n Worker = require('worker_threads').Worker;\n}\ncatch (e) {\n}\nvar wk = Worker ? function (c, _, msg, transfer, cb) {\n var done = false;\n var w = new Worker(c + workerAdd, { eval: true })\n .on('error', function (e) { return cb(e, null); })\n .on('message', function (m) { return cb(null, m); })\n .on('exit', function (c) {\n if (c && !done)\n cb(new Error('exited with code ' + c), null);\n });\n w.postMessage(msg, transfer);\n w.terminate = function () {\n done = true;\n return Worker.prototype.terminate.call(w);\n };\n return w;\n} : function (_, __, ___, ____, cb) {\n setImmediate(function () { return cb(new Error('async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)'), null); });\n var NOP = function () { };\n return {\n terminate: NOP,\n postMessage: NOP\n };\n};\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new i32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return { b: b, r: r };\n};\nvar _a = freb(fleb, 2), fl = _a.b, revfl = _a.r;\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b.b, revfd = _b.r;\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) >> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i])\n ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 1; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p + 7) / 8) | 0; };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n return new u8(v.subarray(s, e));\n};\n/**\n * Codes for errors generated within this library\n */\nexport var FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = [\n 'unexpected EOF',\n 'invalid block type',\n 'invalid length/literal',\n 'invalid distance',\n 'stream finished',\n 'no stream handler',\n ,\n 'no callback',\n 'invalid UTF-8 data',\n 'extra field too long',\n 'date not in range 1980-2099',\n 'filename too long',\n 'stream finishing',\n 'invalid zip data'\n // determined by unknown compression method\n];\n;\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, st, buf, dict) {\n // source length dict length\n var sl = dat.length, dl = dict ? dict.length : 0;\n if (!sl || st.f && !st.l)\n return buf || new u8(0);\n var noBuf = !buf;\n // have to estimate size\n var resize = noBuf || st.i != 2;\n // no state\n var noSt = st.i;\n // Assumes roughly 33% compression ratio average\n if (noBuf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n err(0);\n break;\n }\n // ensure size\n if (resize)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n err(1);\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17\n if (resize)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (!c)\n err(2);\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;\n if (!d)\n err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & (1 << b) - 1, pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (resize)\n cbuf(bt + 131072);\n var end = bt + add;\n if (bt < dt) {\n var shift = dl - dt, dend = Math.min(dt, end);\n if (shift + bt < 0)\n err(3);\n for (; bt < dend; ++bt)\n buf[bt] = dict[shift + bt];\n }\n for (; bt < end; ++bt)\n buf[bt] = buf[bt - dt];\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n // don't reallocate for streams or user buffers\n return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n d[o + 2] |= v >> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return { t: et, l: 0 };\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return { t: v, l: 1 };\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return { t: new u8(tr), l: mbt };\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return { c: cl.subarray(0, cli), n: s };\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a.t, mlb = _a.l;\n var _b = hTree(df, 15), ddt = _b.t, mdb = _b.l;\n var _c = lc(dlt), lclt = _c.c, nlc = _c.n;\n var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n ++lcfreq[lclt[i] & 31];\n for (var i = 0; i < lcdt.length; ++i)\n ++lcfreq[lcdt[i] & 31];\n var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];\n if (bs >= 0 && flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >> 5) & 127), p += clct[i] >> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n var sym = syms[i];\n if (sym > 255) {\n var len = (sym >> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (sym >> 23) & 31), p += fleb[len];\n var dst = sym & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (sym >> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[sym]), p += ll[sym];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, st) {\n var s = st.z || dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var lst = st.l;\n var pos = (st.r || 0) & 7;\n if (lvl) {\n if (pos)\n w[0] = st.r >> 3;\n var opt = deo[lvl - 1];\n var n = opt >> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new i32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx blkpos\n var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;\n for (; i + 2 < s; ++i) {\n // hash value\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = i - dif + j & 32767;\n var pti = prev[ti];\n var cd = ti - pti & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += imod - pimod & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one int32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n for (i = Math.max(i, wi); i < s; ++i) {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n if (!lst) {\n st.r = (pos & 7) | w[(pos / 8) | 0] << 3;\n // shft(pos) now 1 less if pos & 7 != 0\n pos -= 7;\n st.h = head, st.p = prev, st.i = i, st.w = wi;\n }\n }\n else {\n for (var i = st.w || 0; i < s + lst; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[(pos / 8) | 0] = lst;\n e = s;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n st.i = s;\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Adler32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a & 0xFF00) << 8 | (b & 255) << 8 | (b >> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n if (!st) {\n st = { l: 1 };\n if (opt.dictionary) {\n var dict = opt.dictionary.subarray(-32768);\n var newDat = new u8(dict.length + dat.length);\n newDat.set(dict);\n newDat.set(dat, dict.length);\n dat = newDat;\n st.w = dict.length;\n }\n }\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? (st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20) : (12 + opt.mem), pre, post, st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return fnStr;\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n fnStr = wcln(fns[i], fnStr, td_1);\n ch[id] = { c: wcln(fns[m], fnStr, td_1), e: td_1 };\n }\n var td = mrg({}, ch[id].e);\n return wk(ch[id].c + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gopt]; };\nvar bDflt = function () { return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zls]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get opts\nvar gopt = function (o) { return o && {\n out: o.size && new u8(o.size),\n dictionary: o.dictionary\n}; };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) {\n if (ev.data.length) {\n strm.push(ev.data[0], ev.data[1]);\n postMessage([ev.data[0].length]);\n }\n else\n strm.flush();\n };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id, flush, ext) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else if (!Array.isArray(dat))\n ext(dat);\n else if (dat.length == 1) {\n strm.queuedSize -= dat[0];\n if (strm.ondrain)\n strm.ondrain(dat[0]);\n }\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.queuedSize = 0;\n strm.push = function (d, f) {\n if (!strm.ondata)\n err(5);\n if (t)\n strm.ondata(err(4, 0, 1), null, !!f);\n strm.queuedSize += d.length;\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () { w.terminate(); };\n if (flush) {\n strm.flush = function () { w.postMessage([]); };\n }\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += (d[10] | d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + (o.filename ? o.filename.length + 1 : 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (o.dictionary && 32);\n c[1] |= 31 - ((c[0] << 8) | c[1]) % 31;\n if (o.dictionary) {\n var h = adler();\n h.p(o.dictionary);\n wbytes(c, 2, h.d());\n }\n};\n// zlib start\nvar zls = function (d, dict) {\n if ((d[0] & 15) != 8 || (d[0] >> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n err(6, 'invalid zlib data');\n if ((d[1] >> 5 & 1) == +!dict)\n err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary');\n return (d[1] >> 3 & 4) + 2;\n};\nfunction StrmOpt(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n this.s = { l: 0, i: 32768, w: 32768, z: 32768 };\n // Buffer length must always be 0 mod 32768 for index calculations to be correct when modifying head and prev\n // 98304 = 32768 (lookback) + 65536 (common chunk size)\n this.b = new u8(98304);\n if (this.o.dictionary) {\n var dict = this.o.dictionary.subarray(-32768);\n this.b.set(dict, 32768 - dict.length);\n this.s.i = 32768 - dict.length;\n }\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, this.s), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.s.l)\n err(4);\n var endLen = chunk.length + this.s.z;\n if (endLen > this.b.length) {\n if (endLen > 2 * this.b.length - 32768) {\n var newBuf = new u8(endLen & -32768);\n newBuf.set(this.b.subarray(0, this.s.z));\n this.b = newBuf;\n }\n var split = this.b.length - this.s.z;\n this.b.set(chunk.subarray(0, split), this.s.z);\n this.s.z = this.b.length;\n this.p(this.b, false);\n this.b.set(this.b.subarray(-32768));\n this.b.set(chunk.subarray(split), 32768);\n this.s.z = chunk.length - split + 32768;\n this.s.i = 32766, this.s.w = 32768;\n }\n else {\n this.b.set(chunk, this.s.z);\n this.s.z += chunk.length;\n }\n this.s.l = final & 1;\n if (this.s.z > this.s.w + 8191 || final) {\n this.p(this.b, final || false);\n this.s.w = this.s.i, this.s.i -= 2;\n }\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * deflated output for small inputs.\n */\n Deflate.prototype.flush = function () {\n if (!this.ondata)\n err(5);\n if (this.s.l)\n err(4);\n this.p(this.b, false);\n this.s.w = this.s.i, this.s.i -= 2;\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6, 1);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n function Inflate(opts, cb) {\n // no StrmOpt here to avoid adding to workerizer\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768);\n this.s = { i: 0, b: dict ? dict.length : 0 };\n this.o = new u8(32768);\n this.p = new u8(0);\n if (dict)\n this.o.set(dict);\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n if (!this.p.length)\n this.p = c;\n else if (c.length) {\n var n = new u8(this.p.length + c.length);\n n.set(this.p), n.set(c, this.p.length), this.p = n;\n }\n };\n Inflate.prototype.c = function (final) {\n this.s.i = +(this.d = final || false);\n var bts = this.s.b;\n var dt = inflt(this.p, this.s, this.o);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n function AsyncInflate(opts, cb) {\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Inflate(ev.data);\n onmessage = astrm(strm);\n }, 7, 0);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gopt(ev.data[1]))); }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function inflateSync(data, opts) {\n return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n this.l += chunk.length;\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * GZIPped output for small inputs.\n */\n Gzip.prototype.flush = function () {\n Deflate.prototype.flush.call(this);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8, 1);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming single or multi-member GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n function Gunzip(opts, cb) {\n this.v = 1;\n this.r = 0;\n Inflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n this.r += chunk.length;\n if (this.v) {\n var p = this.p.subarray(this.v - 1);\n var s = p.length > 3 ? gzs(p) : 4;\n if (s > p.length) {\n if (!final)\n return;\n }\n else if (this.v > 1 && this.onmember) {\n this.onmember(this.r - p.length);\n }\n this.p = p.subarray(s), this.v = 0;\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n // process concatenated GZIP\n if (this.s.f && !this.s.l && !final) {\n this.v = shft(this.s.p) + 9;\n this.s = { i: 0 };\n this.o = new u8(0);\n this.push(new u8(0), final);\n }\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming single or multi-member GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n function AsyncGunzip(opts, cb) {\n var _this = this;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gunzip(ev.data);\n strm.onmember = function (offset) { return postMessage(offset); };\n onmessage = astrm(strm);\n }, 9, 0, function (offset) { return _this.onmember && _this.onmember(offset); });\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0], ev.data[1])); }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function gunzipSync(data, opts) {\n var st = gzs(data);\n if (st + 8 > data.length)\n err(6, 'invalid gzip data');\n return inflt(data.subarray(st, -8), { i: 2 }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary);\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * zlibbed output for small inputs.\n */\n Zlib.prototype.flush = function () {\n Deflate.prototype.flush.call(this);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10, 1);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n function Unzlib(opts, cb) {\n Inflate.call(this, opts, cb);\n this.v = opts && opts.dictionary ? 2 : 1;\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 6 && !final)\n return;\n this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n function AsyncUnzlib(opts, cb) {\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Unzlib(ev.data);\n onmessage = astrm(strm);\n }, 11, 0);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gopt(ev.data[1]))); }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function unzlibSync(data, opts) {\n return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n function Decompress(opts, cb) {\n this.o = StrmOpt.call(this, opts, cb) || {};\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n }\n // init substream\n // overriden by AsyncDecompress\n Decompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (dat, final) {\n _this.ondata(dat, final);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(this.o)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(this.o)\n : new this.Z(this.o);\n this.i();\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n function AsyncDecompress(opts, cb) {\n Decompress.call(this, opts, cb);\n this.queuedSize = 0;\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n }\n AsyncDecompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (err, dat, final) {\n _this.ondata(err, dat, final);\n };\n this.s.ondrain = function (size) {\n _this.queuedSize -= size;\n if (_this.ondrain)\n _this.ondrain(size);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n this.queuedSize += chunk.length;\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, opts) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, opts)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, opts)\n : unzlibSync(data, opts);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k, op = o;\n if (Array.isArray(val))\n op = mrg(o, val[1]), val = val[0];\n if (val instanceof u8)\n t[n] = [val, op];\n else {\n t[n += '/'] = [new u8(0), op];\n fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return { s: r, r: slc(d, i - 1) };\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p)\n err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (final) {\n if (r.length)\n err(8);\n this.p = null;\n }\n else\n this.p = r;\n this.ondata(s, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td) {\n return td.decode(dat);\n }\n else {\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (r.length)\n err(8);\n return s;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function (d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))\n ;\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c < 0 && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n err(10);\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >> 1)), b += 4;\n if (c != -1) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c < 0 ? -c - 2 : c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this = this;\n if (!this.ondata)\n err(5);\n // finishing or finished\n if (this.d & 2)\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false);\n else {\n var f = strToU8(file.filename), fl_1 = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl_1 != file.filename.length || (o && (com.length != o.length));\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535)\n this.ondata(err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u, -1);\n var chks_1 = [header];\n var pAll_1 = function () {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll_1();\n if (tr_1) {\n var nxt = _this.u[ind_1 + 1];\n if (nxt)\n nxt.r();\n else\n _this.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this.ondata(err, dat, final);\n _this.terminate();\n }\n else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1)\n uf_1.r();\n tr_1 = 1;\n }\n else if (tr_1)\n pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this = this;\n if (this.d & 2) {\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this.d & 1))\n return;\n _this.u.splice(-1, 1);\n _this.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl(err(11, 0, 1), null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n err(11);\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this = this;\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate)\n data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this = this;\n if (!this.onfile)\n err(5);\n if (!this.p)\n err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n }\n else if (dd)\n sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n err(5);\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this.o[cmp_1];\n if (!ctr)\n file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this.k[0] == chks_3 && _this.c)\n _this.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); };\nexport function unzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = lft = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n if (d)\n files[fn] = d;\n if (!--lft)\n cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n // Synchronously decompress under 512KB, or barely-compressed data\n if (su < 524288 || sc > 0.8 * su) {\n try {\n cbl(null, inflateSync(infl, { out: new u8(su) }));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl(err(14, 'unknown compression type ' + c_1, 1), null);\n }\n else\n cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n }\n else\n cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nexport function unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });\n else\n err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n", "/* eslint-disable simple-header/header */\n\n/*!\n * crxToZip\n * Copyright (c) 2013 Rob Wu <rob@robwu.nl>\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nexport function crxToZip(buf: Buffer) {\n function calcLength(a: number, b: number, c: number, d: number) {\n let length = 0;\n\n length += a << 0;\n length += b << 8;\n length += c << 16;\n length += d << 24 >>> 0;\n return length;\n }\n\n // 50 4b 03 04\n // This is actually a zip file\n if (buf[0] === 80 && buf[1] === 75 && buf[2] === 3 && buf[3] === 4) {\n return buf;\n }\n\n // 43 72 32 34 (Cr24)\n if (buf[0] !== 67 || buf[1] !== 114 || buf[2] !== 50 || buf[3] !== 52) {\n throw new Error(\"Invalid header: Does not start with Cr24\");\n }\n\n // 02 00 00 00\n // or\n // 03 00 00 00\n const isV3 = buf[4] === 3;\n const isV2 = buf[4] === 2;\n\n if ((!isV2 && !isV3) || buf[5] || buf[6] || buf[7]) {\n throw new Error(\"Unexpected crx format version number.\");\n }\n\n if (isV2) {\n const publicKeyLength = calcLength(buf[8], buf[9], buf[10], buf[11]);\n const signatureLength = calcLength(buf[12], buf[13], buf[14], buf[15]);\n\n // 16 = Magic number (4), CRX format version (4), lengths (2x4)\n const zipStartOffset = 16 + publicKeyLength + signatureLength;\n\n return buf.subarray(zipStartOffset, buf.length);\n }\n // v3 format has header size and then header\n const headerSize = calcLength(buf[8], buf[9], buf[10], buf[11]);\n const zipStartOffset = 12 + headerSize;\n\n return buf.subarray(zipStartOffset, buf.length);\n}\n"],
"mappings": ";;;;inBAAA,IAAAA,EAAAC,EAAA,oBCoBO,SAASC,EAAIC,EAAaC,EAAgC,CAAC,EAAG,CACjE,OAAO,IAAI,QAAgB,CAACC,EAASC,IAAW,CAC5C,GAAAC,QAAM,IAAIJ,EAAKC,EAASI,GAAO,CAC3B,GAAM,CAAE,WAAAC,EAAY,cAAAC,EAAe,QAAAC,CAAQ,EAAIH,EAC/C,GAAIC,GAAe,IACf,OAAO,KAAKH,EAAO,GAAGG,MAAeC,OAAmBP,GAAK,EACjE,GAAIM,GAAe,IACf,OAAO,KAAKJ,EAAQH,EAAIS,EAAQ,SAAWP,CAAO,CAAC,EAEvD,IAAMQ,EAAS,CAAC,EAChBJ,EAAI,GAAG,QAASF,CAAM,EAEtBE,EAAI,GAAG,OAAQK,GAASD,EAAO,KAAKC,CAAK,CAAC,EAC1CL,EAAI,KAAK,MAAO,IAAMH,EAAQ,OAAO,OAAOO,CAAM,CAAC,CAAC,CACxD,CAAC,CACL,CAAC,CACL,CApCA,IAkBAE,GAlBAC,GAAAC,EAAA,kBAAAC,IAkBAH,GAAkB,uBClBlB,IAAAI,GAAAC,EAAA,kBAAAC,MCAA,IAAOC,GAAPC,GAAAC,EAAA,KAAAC,IAAOH,GAAQ,YCAf,IAAOI,EAAPC,GAAAC,EAAA,KAAAC,IAAOH,EAAQ,uBCAf,IAWaI,GAXbC,GAAAC,EAAA,kBAAAC,IAMAC,KACAC,KAIaL,GAAqB,WAAWM,KAAUC,EAAY,wBAAwBA,KAAe,OCcnG,SAASC,GAAgBC,EAA+B,CAC3D,OAAO,gBAAkB,CACrB,GAAI,CACA,MAAO,CACH,GAAI,GACJ,MAAO,MAAMA,EAAK,GAAG,SAAS,CAClC,CACJ,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eAAe,WAAW,kBAAkB,CAAC,CAAE,gBAAAC,EAAiB,aAAAC,CAAa,EAAGzB,IAAO,CAC3F,GAAIwB,IACIC,IAAiB,aACjBJ,EAASG,CAAe,EAIxBC,IAAiB,cAAc,CAC/B,IAAMH,EAASb,EAAWe,EAAiB,cAAc,EACrDF,IACAE,EAAgBF,GAAU,CAAC,UAAU,EAC7C,CAGJtB,EAAG,CAAE,OAAQ,GAAO,gBAAAwB,CAAgB,CAAC,CACzC,CAAC,EAKD,UAAQ,eAAe,WAAW,kBAAoB,IAAM,CAAE,CAClE,CAAC",
"names": ["init_react", "__esmMin", "get", "url", "options", "resolve", "reject", "https", "res", "statusCode", "statusMessage", "headers", "chunks", "chunk", "import_https", "init_simpleGet", "__esmMin", "init_react", "init_IpcEvents", "__esmMin", "init_react", "git_hash_default", "init_git_hash", "__esmMin", "init_react", "git_remote_default", "init_git_remote", "__esmMin", "init_react", "VENCORD_USER_AGENT", "init_vencordUserAgent", "__esmMin", "init_react", "init_git_hash", "init_git_remote", "git_hash_default", "git_remote_default", "serializeErrors", "func", "e", "VENCORD_FILES", "init_common", "__esmMin", "init_react", "http_exports", "githubGet", "endpoint", "get", "API_BASE", "VENCORD_USER_AGENT", "calculateGitChanges", "fetchUpdates", "res", "git_hash_default", "c", "release", "data", "name", "browser_download_url", "VENCORD_FILES", "s", "PendingUpdates", "applyUpdates", "import_electron", "import_promises", "import_path", "init_http", "__esmMin", "init_react", "init_simpleGet", "init_IpcEvents", "init_vencordUserAgent", "init_git_hash", "init_git_remote", "init_common", "git_remote_default", "serializeErrors", "init_react", "import_electron", "import_path", "init_react", "init_react", "init_react", "init_IpcEvents", "import_electron", "init_react", "native_exports", "__export", "fetchTrackData", "init_react", "import_child_process", "import_util", "exec", "applescript", "cmds", "stdout", "c", "cachedRemoteData", "APPLE_MUSIC_BUNDLE_REGEX", "APPLE_MUSIC_TOKEN_REGEX", "cachedToken", "getToken", "html", "r", "bundleUrl", "token", "fetchRemoteData", "id", "name", "artist", "album", "dataUrl", "songData", "data", "e", "out", "playerPosition", "text", "durationStr", "k", "duration", "remoteData", "native_exports", "__export", "initDevtoolsOpenEagerLoad", "init_react", "handleDevtoolsOpened", "native_exports", "init_react", "init_react", "init_IpcEvents", "init_react", "SettingsStore", "plain", "options", "object", "root", "path", "self", "target", "key", "v", "value", "setPath", "cb", "pathToNotify", "p", "listeners", "init_react", "mergeDefaults", "obj", "defaults", "key", "v", "import_electron", "import_fs", "init_react", "import_electron", "import_path", "DATA_DIR", "SETTINGS_DIR", "THEMES_DIR", "QUICKCSS_PATH", "SETTINGS_FILE", "NATIVE_SETTINGS_FILE", "ALLOWED_PROTOCOLS", "SETTINGS_DIR", "readSettings", "name", "file", "err", "RendererSettings", "SettingsStore", "SETTINGS_FILE", "_", "data", "pathToNotify", "DefaultNativeSettings", "nativeSettings", "NATIVE_SETTINGS_FILE", "mergeDefaults", "NativeSettings", "import_electron", "_", "win", "frame", "settings", "RendererSettings", "native_exports", "init_react", "import_electron", "_", "win", "frame", "RendererSettings", "native_exports", "__export", "resolveRedirect", "init_react", "import_https", "validRedirectUrls", "getRedirect", "url", "resolve", "reject", "req", "res", "_", "native_exports", "__export", "makeDeeplTranslateRequest", "init_react", "_", "pro", "apiKey", "payload", "url", "res", "data", "e", "native_exports", "__export", "readRecording", "init_react", "import_electron", "import_promises", "import_path", "_", "filePath", "filename", "discordBaseDirWithTrailingSlash", "buf", "native_exports", "__export", "sendToOverlay", "init_react", "import_dgram", "xsoSocket", "_", "data", "json", "native_exports", "init_react", "import_electron", "init_react", "adguard_default", "_", "win", "frame", "RendererSettings", "adguard_default", "pluginNatives_default", "native_exports", "PluginIpcMappings", "plugin", "methods", "pluginNatives_default", "entries", "mappings", "methodName", "method", "key", "init_react", "init_IpcEvents", "import_electron", "init_react", "monacoWin_default", "import_fs", "import_promises", "import_path", "init_react", "splitRegex", "escapedAtRegex", "makeHeader", "fileName", "opts", "stripBOM", "fileContent", "getThemeInfo", "css", "block", "header", "field", "accum", "line", "l", "init_react", "import_electron", "makeLinksOpenExternally", "win", "url", "protocol", "THEMES_DIR", "ensureSafePath", "basePath", "path", "normalizedBasePath", "newPath", "normalizedPath", "readCss", "QUICKCSS_PATH", "listThemes", "files", "themeInfo", "fileName", "data", "getThemeData", "stripBOM", "getThemeInfo", "safePath", "_", "url", "protocol", "ALLOWED_PROTOCOLS", "css", "title", "existingWindow", "w", "win", "makeLinksOpenExternally", "monacoWin_default", "init_react", "import_electron", "init_react", "import_module", "require", "Worker", "workerAdd", "wk", "c", "_", "msg", "transfer", "cb", "done", "w", "e", "m", "__", "___", "____", "NOP", "u8", "u16", "i32", "fleb", "fdeb", "clim", "freb", "eb", "start", "b", "i", "r", "j", "_a", "fl", "revfl", "_b", "fd", "revfd", "rev", "x", "hMap", "cd", "mb", "s", "l", "le", "co", "rvb", "sv", "r_1", "v", "flt", "fdt", "flrm", "hMap", "flt", "fdrm", "hMap", "fdt", "max", "a", "m", "i", "bits", "d", "p", "o", "bits16", "shft", "slc", "v", "s", "e", "u8", "ec", "err", "ind", "msg", "nt", "e", "inflt", "dat", "st", "buf", "dict", "sl", "dl", "u8", "noBuf", "resize", "noSt", "cbuf", "l", "bl", "nbuf", "final", "pos", "bt", "lm", "dm", "lbt", "dbt", "tbts", "bits", "type", "flrm", "fdrm", "hLit", "hcLen", "tl", "ldt", "clt", "i", "clim", "clb", "max", "clbmsk", "clm", "hMap", "r", "s", "c", "n", "lt", "dt", "shft", "t", "lms", "dms", "lpos", "bits16", "sym", "add", "b", "fleb", "fl", "d", "dsym", "fd", "fdeb", "end", "shift", "dend", "slc", "et", "u8", "mrg", "a", "b", "o", "k", "wcln", "fn", "fnStr", "td", "dt", "st", "ks", "i", "v", "st_1", "spInd", "t", "ch", "cbfs", "tl", "wrkr", "fns", "init", "id", "cb", "td_1", "m", "wk", "bInflt", "u8", "u16", "i32", "fleb", "fdeb", "clim", "fl", "fd", "flrm", "fdrm", "rev", "ec", "hMap", "max", "bits", "bits16", "shft", "slc", "err", "inflt", "inflateSync", "pbf", "gopt", "pbf", "msg", "gopt", "o", "u8", "cbify", "dat", "opts", "fns", "init", "id", "cb", "w", "wrkr", "err", "b2", "d", "b", "b4", "b8", "inflate", "data", "opts", "cb", "err", "cbify", "bInflt", "ev", "pbf", "inflateSync", "gopt", "inflt", "td", "tds", "et", "dutf8", "d", "r", "i", "c", "eb", "slc", "strFromU8", "dat", "latin1", "i", "td", "_a", "dutf8", "s", "err", "slzh", "d", "b", "b2", "zh", "z", "fnl", "fn", "strFromU8", "es", "bs", "b4", "_a", "z64e", "sc", "su", "off", "b8", "mt", "fn", "unzip", "data", "opts", "cb", "err", "term", "tAll", "i", "files", "cbd", "a", "b", "e", "b4", "lft", "b2", "c", "o", "z", "ze", "fltr", "_loop_3", "_a", "zh", "c_1", "sc", "su", "no", "off", "slzh", "cbl", "d", "slc", "infl", "inflateSync", "u8", "inflate", "import_fs", "import_promises", "import_path", "init_react", "crxToZip", "buf", "calcLength", "a", "b", "c", "length", "isV3", "isV2", "publicKeyLength", "signatureLength", "zipStartOffset", "init_simpleGet", "extensionCacheDir", "DATA_DIR", "extract", "data", "outDir", "resolve", "reject", "unzip", "err", "files", "f", "pathElements", "name", "directories", "dir", "installExt", "id", "extDir", "fsConstants", "url", "buf", "get", "crxToZip", "unsafeUrl", "cb", "url", "theme", "safeUrl", "ensureSafePath", "THEMES_DIR", "RendererSettings", "installExt", "err", "findHeader", "headers", "headerName", "h", "parsePolicy", "policy", "result", "directive", "directiveKey", "directiveValue", "stringifyPolicy", "values", "patchCsp", "header", "csp", "responseHeaders", "resourceType"]
}