Compare commits

...

71 Commits

Author SHA1 Message Date
Ammar Ahmed
33ea52068b mobile: add line break when appending to note 2025-05-17 12:14:22 +05:00
Ammar Ahmed
3e86167842 mobile: fix crash in settings -> user subscription 2025-05-17 10:05:35 +05:00
01zulfi
93713d58d4 web: persist double spaced lines config on logout (#8097)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-16 15:21:26 +05:00
01zulfi
7da18de68c web: fix readonly note not locking when vault is locked (#8092)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-16 15:21:10 +05:00
01zulfi
fccf2a7b3e web: add support for drag/dropping notes on tab strip (#8090)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-16 15:20:28 +05:00
Abdullah Atta
b200180684 web: bump version to 3.2.0-beta.2 2025-05-16 15:05:40 +05:00
Abdullah Atta
0a5ea5d448 core: fix `expected previously executed migration 2 to be at index 1 but
10 was found in its place.`
2025-05-16 15:04:27 +05:00
01zulfi
739906dbe4 core: fix db.settings.getTrashCleanupInterval return type (#8076)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-16 14:48:28 +05:00
01zulfi
4326552ccc web: add support for removing recents in command palette using delete key (#8069)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-16 14:44:11 +05:00
01zulfi
1ee1ceef73 web: press shift+enter to create note in quick open (#8068)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-16 14:43:24 +05:00
Ammar Ahmed
4d83666fed editor: fix alignment items in callout heading (#8101)
* editor: fix alignment items in callout heading

* Update packages/editor/styles/styles.css

Signed-off-by: Abdullah Atta <thecodrr@protonmail.com>

---------

Signed-off-by: Abdullah Atta <thecodrr@protonmail.com>
Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2025-05-16 14:36:29 +05:00
Abdullah Atta
86b8a2ae8c desktop: update patched better-sqlite3-multiple-ciphers to 11.6.1 2025-05-16 12:52:11 +05:00
Abdullah Atta
c8c21d210b global: regenerate package-lock.json for theme & ui packages 2025-05-16 11:22:21 +05:00
Ammar Ahmed
96343a3b1f mobile: fix error in build 2025-05-16 11:03:16 +05:00
Ammar Ahmed
74ebc4c82e mobile: add option to disable auto update check 2025-05-16 10:58:15 +05:00
Abdullah Atta
3acd3a87a9 misc: include @notesnook/theme package when generating flatpak sources 2025-05-16 10:24:54 +05:00
Abdullah Atta
94888ad94d desktop: downgrade playwright 2025-05-16 10:15:21 +05:00
Abdullah Atta
030daf12f2 desktop: fix flatpak sources generation 2025-05-15 12:17:28 +05:00
Abdullah Atta
d599a0836f desktop: regenerate package-lock.json 2025-05-15 10:36:42 +05:00
Abdullah Atta
7f901e7e75 web: update package-lock.json 2025-05-15 10:28:54 +05:00
Abdullah Atta
0a5e235e50 global: fix dependencies version differences 2025-05-15 09:59:39 +05:00
Abdullah Atta
aec3530d8a global: update package-lock.json 2025-05-15 09:47:41 +05:00
01zulfi
732e79dd60 web: fix list pane not expanding (#7963)
* web: fix list pane not expanding
* fix list pane not expanding to saved width on reload
* fix list pane not expanding to saved width on collapse

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>

* web: collapse pane and set size to 0 when applicable
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>

---------

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-15 09:25:29 +05:00
01zulfi
ca5c596158 core: segregate logic for note headline and note headline title generation (#7968)
* core: segregate logic for note headline and note headline title generation
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>

* core: minor refactor note headline title
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-15 09:25:29 +05:00
Ammar Ahmed
9e8e9c54d4 ci: fix build ios
Signed-off-by: Ammar Ahmed <40239442+ammarahm-ed@users.noreply.github.com>
2025-05-15 09:25:29 +05:00
Ammar Ahmed
2c2a79104b ci: fix build ios
Signed-off-by: Ammar Ahmed <40239442+ammarahm-ed@users.noreply.github.com>
2025-05-15 09:25:29 +05:00
Ammar Ahmed
27769f8682 ci: fix build ios
Signed-off-by: Ammar Ahmed <40239442+ammarahm-ed@users.noreply.github.com>
2025-05-15 09:25:29 +05:00
Ammar Ahmed
f150637e3a mobile: fix crash when going from trash -> search 2025-05-15 09:25:29 +05:00
Ammar Ahmed
f04661e32a mobile: release v3.1.1 2025-05-15 09:25:29 +05:00
Ammar Ahmed
db65e80dbc mobile: fix crash on delete item 2025-05-15 09:25:29 +05:00
Ammar Ahmed
4e65bbb7bf mobile: fix crash in list 2025-05-15 09:25:29 +05:00
Ammar Ahmed
d5ec302bf6 mobile: fix cursor bug on ios 2025-05-15 09:25:29 +05:00
Ammar Ahmed
51692a67e7 mobile: fix typing in editor title input 2025-05-15 09:25:29 +05:00
Ammar Ahmed
ee97d71f09 mobile: archive notes 2025-05-12 12:17:29 +05:00
Abdullah Atta
6d089c7332 web: bump version to 3.2.0-beta.1 2025-05-06 13:34:16 +05:00
Abdullah Atta
ab1b45bd50 core: fix query-transformer tests 2025-05-06 13:28:24 +05:00
Ammar Ahmed
fff8b61f71 mobile: add sqlite3-fts5-html module 2025-05-06 13:28:24 +05:00
Abdullah Atta
2c4f262fbc desktop: install sqlite3-fts5-html 2025-05-06 13:28:24 +05:00
Abdullah Atta
e5a7e08efb web: update wa-sqlite to use sqlite3-fts5-html for stripping html 2025-05-06 13:28:24 +05:00
Abdullah Atta
b4ef01c688 core: fix short queries search 2025-05-06 13:28:24 +05:00
Abdullah Atta
e6d6194b66 core: remove @orama/stopwords 2025-05-06 13:28:24 +05:00
Abdullah Atta
b6ee0989e5 core: strip html when searching notes
this commit also properly fixes search queries containing
words less than 3 characters in length
2025-05-06 13:28:24 +05:00
Abdullah Atta
e4230a0709 core: fix warnings in tests 2025-05-06 13:28:24 +05:00
Ammar Ahmed
0b17588e5d mobile: update better trigram 2025-05-06 13:28:24 +05:00
Abdullah Atta
8498f35b95 core: fix db migration 2025-05-06 13:28:24 +05:00
Abdullah Atta
8eecc995fc core: wrap query with invalid symbols in quotes 2025-05-06 13:28:24 +05:00
Abdullah Atta
1bbc01346b core: update sqlite-better-trigram to v0.0.3 2025-05-06 13:28:24 +05:00
01zulfi
2f3a895ddc core: fix trash cleanup interval setting retrieval (#8045)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-02 12:15:00 +05:00
01zulfi
5caa18543a web: add more archive test cases (#8040)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-02 10:11:53 +05:00
Abdullah Atta
33c493b317 desktop: no need to externalize @resvg/resvg-js 2025-05-02 10:11:08 +05:00
Abdullah Atta
ca497f3815 desktop: remove icon from native menu 2025-05-02 10:11:08 +05:00
Abdullah Atta
d796795c40 desktop: only show native menus on macos 2025-05-02 10:11:08 +05:00
Abdullah Atta
5c9d98d5d6 desktop: show native menus where possible 2025-05-02 10:11:08 +05:00
01zulfi
3b47d97314 web: assign accent color to links (#8041)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-01 13:14:40 +05:00
Abdullah Atta
4360d4b155 desktop: update packages 2025-05-01 13:13:38 +05:00
01zulfi
24d8bfe9bd desktop: upgrade electron to v34.0.0 (#8038)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-01 10:23:54 +05:00
01zulfi
832506b836 web: fix automatic backup reminder setting reverting to never (#8037)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-05-01 09:07:30 +05:00
01zulfi
795f38b4b8 web: fix focus last active tab method (#8034)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-04-30 11:30:24 +05:00
01zulfi
d42813b262 editor: improve hover link popup position (#8011)
* move it down so it doesn't block the link

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-04-29 09:32:38 +05:00
Abdullah Atta
d522c65d49 web: bump version to 3.2.0-beta.0 2025-04-28 11:18:25 +05:00
Abdullah Atta
4b7cecccbe web: update @notesnook-imoporter/core to 2.2.2 2025-04-28 11:09:51 +05:00
01zulfi
151abb94e1 web: fix notestore is not defined error (#8012)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-04-28 11:09:05 +05:00
Abdullah Atta
b67a307453 web: update @notesnook-importer/core to 2.2.1 2025-04-28 10:31:54 +05:00
Abdullah Atta
bf83c87911 web: update @notesnook-importer/core to 2.2.0 2025-04-28 09:59:57 +05:00
Abdullah Atta
8e67d3dc23 web: open settings with importer page instead of importer.notesnook.com 2025-04-28 09:59:57 +05:00
Ammar Ahmed
4b24f2c4b6 mobile: fix default font setting not followed 2025-04-28 09:59:57 +05:00
01zulfi
6cd14a5a78 web: make nav menu header draggable (#7985)
* web: make part of nav menu header draggable
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>

* Update apps/web/src/app.css

Signed-off-by: Abdullah Atta <thecodrr@protonmail.com>

* Update apps/web/src/components/navigation-menu/index.tsx

Signed-off-by: Abdullah Atta <thecodrr@protonmail.com>

---------

Signed-off-by: Abdullah Atta <thecodrr@protonmail.com>
Co-authored-by: Abdullah Atta <thecodrr@protonmail.com>
2025-04-28 09:59:57 +05:00
Ammar Ahmed
6edae50960 mobile: remove READ_MEDIA_IMAGES permission 2025-04-28 09:59:57 +05:00
Abdullah Atta
2a6a377d06 web: refresh app after import 2025-04-28 09:59:57 +05:00
Abdullah Atta
c569dbd778 web: move importer into web/desktop app (#7472)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-04-28 09:59:57 +05:00
01zulfi
36022df189 web: add support for archiving notes (#7810)
* web: archive notes
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>

* global: arhives -> archived
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
2025-04-28 09:45:59 +05:00
116 changed files with 17844 additions and 9608 deletions

View File

@@ -4,7 +4,7 @@ on: workflow_dispatch
jobs:
build:
runs-on: macos-latest
runs-on: macos-14
timeout-minutes: 60
steps:
@@ -14,6 +14,11 @@ jobs:
- name: Setup Node
uses: ./.github/actions/setup-node-with-cache
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.1"
- name: Install node modules
run: |
npm ci --ignore-scripts --prefer-offline --no-audit

View File

@@ -57,6 +57,7 @@ module.exports = {
"node_modules/bindings",
"node_modules/node-gyp-build",
"node_modules/sqlite-better-trigram",
"node_modules/sqlite3-fts5-html",
"node_modules/sodium-native/prebuilds/${platform}-${arch}",
{
from: "node_modules/sqlite-better-trigram-linux-${arch}",
@@ -70,6 +71,20 @@ module.exports = {
from: "node_modules/sqlite-better-trigram-windows-${arch}",
to: "node_modules/sqlite-better-trigram-windows-${arch}"
},
{
from: "node_modules/sqlite3-fts5-html-linux-${arch}",
to: "node_modules/sqlite3-fts5-html-linux-${arch}"
},
{
from: "node_modules/sqlite3-fts5-html-darwin-${arch}",
to: "node_modules/sqlite3-fts5-html-darwin-${arch}"
},
{
from: "node_modules/sqlite3-fts5-html-windows-${arch}",
to: "node_modules/sqlite3-fts5-html-windows-${arch}"
},
"node_modules/sodium-native/index.js",
"node_modules/sodium-native/package.json"
],
@@ -160,23 +175,20 @@ module.exports = {
description: "Your private note taking space",
executableName: linuxExecutableName,
desktop: {
actions: [
{
id: "new-note",
name: "New note",
args: "new note"
desktopActions: {
"new-note": {
Name: "New note",
Exec: `${linuxExecutableName} new note`
},
{
id: "new-notebook",
name: "New notebook",
args: "new notebook"
"new-notebook": {
Name: "New notebook",
Exec: `${linuxExecutableName} new notebook`
},
{
id: "new-reminder",
name: "New reminder",
args: "new reminder"
"new-reminder": {
Name: "New reminder",
Exec: `${linuxExecutableName} new reminder`
}
]
}
}
},
snap: {

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"name": "@notesnook/desktop",
"productName": "Notesnook",
"description": "Your private note taking space",
"version": "3.1.0",
"version": "3.2.0-beta.2",
"appAppleId": "1544027013",
"private": true,
"main": "./dist/cjs/index.js",
@@ -27,37 +27,42 @@
"dependencies": {
"@lingui/core": "5.1.2",
"@notesnook/intl": "file:../../packages/intl",
"@notesnook/ui": "file:../../packages/ui",
"@trpc/client": "10.45.2",
"@trpc/server": "10.45.2",
"better-sqlite3-multiple-ciphers": "11.5.0",
"better-sqlite3-multiple-ciphers": "11.3.0",
"electron-trpc": "0.7.1",
"electron-updater": "^6.3.4",
"icojs": "^0.19.4",
"sqlite-better-trigram": "0.0.2",
"electron-updater": "^6.6.2",
"icojs": "^0.19.5",
"sqlite-better-trigram": "0.0.3",
"sqlite3-fts5-html": "^0.0.2",
"typed-emitter": "^2.1.0",
"yargs": "^17.7.2",
"zod": "3.23.8"
"zod": "3.24.3"
},
"devDependencies": {
"@streetwriters/kysely": "^0.27.4",
"@types/node": "22.7.0",
"@types/node": "22.15.3",
"@types/yargs": "^17.0.33",
"chokidar": "^4.0.1",
"electron": "^31.7.4",
"electron-builder": "^25.1.8",
"chokidar": "^4.0.3",
"electron": "^34.0.0",
"electron-builder": "^26.0.12",
"esbuild": "0.21.5",
"node-abi": "^3.68.0",
"node-gyp-build": "^4.8.2",
"playwright": "^1.48.2",
"node-abi": "^4.5.0",
"node-gyp-build": "^4.8.4",
"playwright": "1.48.2",
"prebuildify": "^6.0.1",
"slugify": "1.6.6",
"tree-kill": "^1.2.2",
"undici": "^6.19.8",
"vitest": "^2.1.8"
"undici": "^7.8.0",
"vitest": "2.1.8"
},
"optionalDependencies": {
"dmg-license": "^1.0.11"
},
"overrides": {
"@electron/node-gyp": "^10.2.0-electron.2"
},
"scripts": {
"start": "node scripts/dev.mjs",
"staging": "node scripts/build.mjs --run",

View File

@@ -1,36 +0,0 @@
diff --git a/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js b/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
index 739a48c..7a7b4af 100644
--- a/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
+++ b/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
@@ -117,6 +117,7 @@ class LinuxTargetHelper {
StartupWMClass: appInfo.productName,
...extra,
...targetSpecificOptions.desktop,
+ actions: undefined
};
const description = this.getDescription(targetSpecificOptions);
if (!(0, builder_util_1.isEmptyOrSpaces)(description)) {
@@ -160,6 +161,23 @@ class LinuxTargetHelper {
data += `\n${name}=${desktopMeta[name]}`;
}
data += "\n";
+
+ if (targetSpecificOptions.desktop.actions) {
+ let actionsData = "";
+ const validActions = [];
+ for (const action of targetSpecificOptions.desktop.actions) {
+ if (!action.id || !action.name || !action.args) continue;
+ actionsData += "\n";
+ actionsData += `[Desktop Action ${action.id}]
+Name=${action.name}
+Exec=${desktopMeta.Exec} ${action.args}`;
+ actionsData += "\n";
+
+ validActions.push(action.id);
+ }
+
+ data += `Actions=${validActions.join(";")};\n${actionsData}`
+ }
return Promise.resolve(data);
}
}

View File

@@ -1,39 +0,0 @@
diff --git a/node_modules/electron-trpc/dist/main.mjs b/node_modules/electron-trpc/dist/main.mjs
index 07971db..b67a3cf 100644
--- a/node_modules/electron-trpc/dist/main.mjs
+++ b/node_modules/electron-trpc/dist/main.mjs
@@ -537,8 +537,15 @@ class be {
attachWindow(r) {
F(this, w).includes(r) || (y("Attaching window", r.id), F(this, w).push(r), v(this, N, Z).call(this, r));
}
- detachWindow(r) {
- y("Detaching window", r.id), L(this, w, F(this, w).filter((e) => e !== r)), v(this, R, M).call(this, { webContentsId: r.webContents.id });
+ detachWindow(r, webContentsId) {
+ y("Detaching window", r.id);
+
+ if (r.isDestroyed() && webContentsId === undefined) {
+ throw new Error('webContentsId is required when calling detachWindow on a destroyed window');
+ }
+
+ L(this, w, F(this, w).filter((e) => e !== r));
+ v(this, R, M).call(this, { webContentsId: webContentsId ?? r.webContents.id });
}
}
w = new WeakMap(), E = new WeakMap(), R = new WeakSet(), M = function({
@@ -548,6 +555,7 @@ w = new WeakMap(), E = new WeakMap(), R = new WeakSet(), M = function({
for (const [i, a] of F(this, E).entries())
i.startsWith(`${r}-${e ?? ""}`) && (y("Closing subscription", i), a.unsubscribe(), F(this, E).delete(i));
}, N = new WeakSet(), Z = function(r) {
+ const webContentsId = r.webContents.id;
r.webContents.on("did-start-navigation", ({ frame: e }) => {
y(
"Handling webContents `did-start-navigation` event",
@@ -558,7 +566,7 @@ w = new WeakMap(), E = new WeakMap(), R = new WeakSet(), M = function({
frameRoutingId: e.routingId
});
}), r.webContents.on("destroyed", () => {
- y("Handling webContents `destroyed` event"), this.detachWindow(r);
+ y("Handling webContents `destroyed` event"), this.detachWindow(r, webContentsId);
});
};
const me = ({

View File

@@ -34,7 +34,7 @@ export async function patchBetterSQLite3() {
);
const json = JSON.parse(await readFile(jsonPath, "utf-8"));
json.version = "11.5.1";
json.version = "11.6.1";
json.homepage = "https://github.com/thecodrr/better-sqlite3-multiple-ciphers";
json.repository.url =
"git://github.com/thecodrr/better-sqlite3-multiple-ciphers.git";

View File

@@ -19,7 +19,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { initTRPC } from "@trpc/server";
import { z } from "zod";
import { app, dialog, nativeTheme, Notification, shell } from "electron";
import {
app,
dialog,
Menu,
MenuItem,
nativeImage,
nativeTheme,
Notification,
shell
} from "electron";
import { AutoLaunch } from "../utils/autolaunch";
import { config, DesktopIntegration } from "../utils/config";
import { bringToFront } from "../utils/bring-to-front";
@@ -33,6 +42,7 @@ import { isFlatpak, isSnap } from "../utils";
import { setupDesktopIntegration } from "../utils/desktop-integration";
import { rm } from "fs/promises";
import { disableCustomDns, enableCustomDns } from "../utils/custom-dns";
import type { MenuItem as NNMenuItem } from "@notesnook/ui";
const t = initTRPC.create();
@@ -225,5 +235,63 @@ export const osIntegrationRouter = t.router({
nativeTheme.off("updated", updated);
};
})
)
),
showMenu: t.procedure
.input(
z.object({
menuItems: z.array(z.any())
})
)
.subscription(({ input: { menuItems } }) =>
observable<string[]>((emit) => {
const items = menuItems as NNMenuItem[];
const menu = new Menu();
for (const item of items) {
const menuItem = toMenuItem(item, (id) => emit.next(id));
if (menuItem) menu.append(menuItem);
}
if (menu.items.length > 0) menu.popup();
return () => {
menu.removeAllListeners();
menu.closePopup();
};
})
)
});
function toMenuItem(
item: NNMenuItem,
onClick: (id: string[]) => void,
parentKey?: string
): MenuItem | undefined {
switch (item.type) {
case "lazy-loader":
return undefined;
case "separator":
return new MenuItem({ type: "separator" });
case "button": {
const submenu = item.menu ? new Menu() : undefined;
if (submenu && item.menu) {
for (const subitem of item.menu.items) {
const subMenuItem = toMenuItem(subitem, onClick, item.key);
if (subMenuItem) submenu.append(subMenuItem);
}
}
return new MenuItem({
label: item.title,
enabled: !item.isDisabled,
visible: !item.isHidden,
toolTip: item.tooltip,
sublabel: item.tooltip,
checked: item.isChecked,
type: submenu ? "submenu" : item.isChecked ? "checkbox" : "normal",
id: item.key,
submenu,
click: () => onClick(parentKey ? [parentKey, item.key] : [item.key]),
accelerator: item.modifier?.replace("Mod", "CommandOrControl")
});
}
}
}

View File

@@ -47,7 +47,9 @@ export class SQLite {
filePath
).unsafeMode(true);
const betterTrigram = require("sqlite-better-trigram");
const fts5Html = require("sqlite3-fts5-html");
betterTrigram.load(this.sqlite);
fts5Html.load(this.sqlite);
}
/**

View File

@@ -143,16 +143,44 @@ function setupMenu() {
})
);
if (params.isEditable)
if (params.isEditable) {
menu.append(
new MenuItem({
label: strings.paste(),
role: "pasteAndMatchStyle",
role: "paste",
enabled: clipboard.readText("clipboard").length > 0,
accelerator: "CommandOrControl+V"
})
);
menu.append(
new MenuItem({
label:
process.platform === "darwin"
? strings.pasteAndMatchStyle()
: strings.pasteWithoutFormatting(),
role: "pasteAndMatchStyle",
enabled: clipboard.readText("clipboard").length > 0,
accelerator:
process.platform === "darwin"
? "Option+Shift+Command+V"
: "Shift+CommandOrControl+V"
})
);
menu.append(
new MenuItem({
type: "separator"
})
);
menu.append(
new MenuItem({
label: strings.spellCheck(),
role: "toggleSpellChecker"
})
);
}
if (menu.items.length > 0) menu.popup();
});
}

View File

@@ -73,7 +73,7 @@ export default function List(props: ListProps) {
? "home"
: props.renderedInRoute === "Favorites"
? "favorites"
: props.renderedInRoute === "Trash"
: props.renderedInRoute === "Trash" || props.dataType === "trash"
? "trash"
: `${props.dataType}s`;

View File

@@ -58,7 +58,6 @@ const Line = ({ top = 6, bottom = 6 }) => {
export const Properties = ({ close = () => {}, item, buttons = [] }) => {
const { colors } = useThemeColors();
const isColor = !!ColorValues[item.title];
if (!item || !item.id) {
return (
<Paragraph style={{ marginVertical: 10, alignSelf: "center" }}>

View File

@@ -36,6 +36,7 @@ import Paragraph from "../ui/typography/paragraph";
const TOP_BAR_ITEMS: ActionId[] = [
"pin",
"favorite",
"archive",
"lock-unlock",
"publish",
"local-only",

View File

@@ -56,7 +56,7 @@ const Sort = ({
db.settings.getGroupOptions(
screen === "Notes"
? "home"
: screen === "Trash"
: screen === "Trash" || type === "trash"
? "trash"
: ((type + "s") as GroupingKey)
)
@@ -65,10 +65,11 @@ const Sort = ({
const groupType =
screen === "Notes"
? "home"
: screen === "Trash"
: screen === "Trash" || type === "trash"
? "trash"
: screen === "Favorites"
? "favorites"
: ((type + "s") as GroupingKey);
console.log("updateGroupOptions for group", groupType, "in", screen);
await db.settings.setGroupOptions(groupType, _groupOptions);
setGroupOptions(_groupOptions);
setTimeout(() => {

View File

@@ -19,13 +19,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { FeatureType } from "./components/sheets/new-feature";
export const features: FeatureType[] = [
{
title: "Notebook Tree View",
body: "Notebooks are now displayed in a tree view for better organization and user experience."
},
{
title: "New SideBar",
body: "Sidebar now contains tabs for Notebooks and Tags for easy navigation."
}
];
export const features: FeatureType[] = [];

View File

@@ -66,9 +66,11 @@ import { convertNoteToText } from "../utils/note-to-text";
import { sleep } from "../utils/time";
import SettingsService from "../services/settings";
import { useSettingStore } from "../stores/use-setting-store";
import { useArchivedStore } from "../stores/use-archived-store";
export type ActionId =
| "select"
| "archive"
| "restore"
| "delete"
| "reorder"
@@ -972,6 +974,19 @@ export const useActions = ({
reference: item as ItemReference
});
}
},
{
id: "archive",
title: !item.archived ? strings.archive() : strings.unarchive(),
icon: "archive",
onPress: async () => {
db.notes.archive(!item.archived, item.id);
setItem((await db.notes.note(item.id)) as Item);
Navigation.queueRoutesForUpdate();
useArchivedStore.getState().refresh();
},
checked: item.archived,
isToggle: true
}
);

View File

@@ -341,8 +341,15 @@ const doAppLoadActions = async () => {
};
const checkAppUpdateAvailable = async () => {
if (__DEV__ || Config.isTesting === "true" || Config.FDROID_BUILD || BETA)
if (
__DEV__ ||
Config.isTesting === "true" ||
Config.FDROID_BUILD ||
BETA ||
!SettingsService.getProperty("checkForUpdates")
)
return;
try {
const version =
Config.GITHUB_RELEASE === "true"

View File

@@ -32,7 +32,7 @@ export function useGroupOptions(type: any) {
const onUpdate = (groupType: string) => {
if (groupType !== type) return;
const options = db.settings?.getGroupOptions(type) as any;
if (!options) return;
if (
groupOptions?.groupBy !== options.groupBy ||
groupOptions?.sortBy !== options.sortBy ||

View File

@@ -43,7 +43,7 @@ let Reminders: any = null;
let Monographs: any = null;
let TaggedNotes: any = null;
let ColoredNotes: any = null;
let Archive: any = null;
const AppNavigation = React.memo(
() => {
const { colors } = useThemeColors();
@@ -192,6 +192,14 @@ const AppNavigation = React.memo(
initialParams={home.name === "ColoredNotes" ? home.params : undefined}
/>
<AppStack.Screen
name="Archive"
getComponent={() => {
Archive = Archive || require("../screens/archive").default;
return Archive;
}}
/>
<AppStack.Screen
name="Reminders"
getComponent={() => {

View File

@@ -0,0 +1,88 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from "react";
import DelayLayout from "../../components/delay-layout";
import { Header } from "../../components/header";
import List from "../../components/list";
import SelectionHeader from "../../components/selection-header";
import { useNavigationFocus } from "../../hooks/use-navigation-focus";
import Navigation, { NavigationProps } from "../../services/navigation";
import SettingsService from "../../services/settings";
import useNavigationStore from "../../stores/use-navigation-store";
import { db } from "../../common/database";
import { strings } from "@notesnook/intl";
import { useArchived } from "../../stores/use-archived-store";
export const Archive = ({ navigation, route }: NavigationProps<"Archive">) => {
const [archive, loading, refresh] = useArchived();
const isFocused = useNavigationFocus(navigation, {
onFocus: (prev) => {
Navigation.routeNeedsUpdate(
route.name,
Navigation.routeUpdateFunctions[route.name]
);
useNavigationStore.getState().setFocusedRouteId(route?.name);
return false;
},
onBlur: () => false,
delay: SettingsService.get().homepage === route.name ? 1 : -1
});
return (
<>
<SelectionHeader id={route.name} items={archive} type="note" />
<Header
renderedInRoute={route.name}
title={strings.routes[route.name]()}
canGoBack={false}
hasSearch={true}
id={route.name}
onSearch={() => {
Navigation.push("Search", {
placeholder: strings.searchInRoute(route.name),
type: "note",
title: route.name,
route: route.name,
items: db.notes.archived
});
}}
/>
<DelayLayout wait={loading}>
<List
data={archive}
dataType="note"
onRefresh={() => {
refresh();
}}
renderedInRoute="Archive"
loading={loading}
placeholder={{
title: strings.yourArchive(),
paragraph: strings.yourArchiveIsEmpty(),
loading: strings.loadingArchive()
}}
headerTitle={strings.routes.Archive()}
/>
</DelayLayout>
</>
);
};
export default Archive;

View File

@@ -177,7 +177,7 @@ export const useEditorEvents = (
useEffect(() => {
const handleKeyboardDidShow: KeyboardEventListener = () => {
editor.commands.keyboardShown(true);
//editor.postMessage(NativeEvents.keyboardShown, undefined);
editor.postMessage(NativeEvents.keyboardShown, undefined);
};
const handleKeyboardDidHide: KeyboardEventListener = () => {
editor.commands.keyboardShown(false);

View File

@@ -352,7 +352,7 @@ export const useEditor = (
DatabaseLogger.log(`Note saved: ${id}...`);
clearTimeout(saveTimer);
const oldNote = currentNotes.current[id];
if (id) {
currentNotes.current[id] = await db.notes?.note(id);
}
@@ -376,11 +376,16 @@ export const useEditor = (
}
}
postMessage(
NativeEvents.title,
currentNotes.current[id]?.title,
tabId
);
if (
oldNote?.title !== currentNotes.current[id]?.title &&
!noteData.title
) {
postMessage(
NativeEvents.title,
currentNotes.current[id]?.title,
tabId
);
}
if (Notifications.isNotePinned(id as string)) {
Notifications.pinNote(id as string);

View File

@@ -82,7 +82,8 @@ export const settingsGroups: SettingSection[] = [
useHook: () => useUserStore((state) => state.user),
hidden: (current) => !current,
name: (current) => {
const user = current as User;
const user = (current as User) || useUserStore.getState().user;
if (!user) return strings.subscribeToPro();
const isBasic = user.subscription?.type === SUBSCRIPTION_STATUS.BASIC;
const isTrial = user.subscription?.type === SUBSCRIPTION_STATUS.TRIAL;
return isBasic || !user.subscription?.type
@@ -96,6 +97,7 @@ export const settingsGroups: SettingSection[] = [
icon: "crown",
description: (current) => {
const user = current as User;
if (!user) return strings.neverHesitate();
const subscriptionDaysLeft =
user &&
getTimeLeft(
@@ -670,6 +672,13 @@ export const settingsGroups: SettingSection[] = [
});
},
disabled: () => !db.settings.getDefaultNotebook()
},
{
id: "disable-update-check",
type: "switch",
name: strings.autoUpdateCheck(),
description: strings.autoUpdateCheckDesc(),
property: "checkForUpdates"
}
]
},

View File

@@ -37,6 +37,7 @@ import {
rootNavigatorRef
} from "../utils/global-refs";
import { eSendEvent } from "./event-manager";
import { useArchivedStore } from "../stores/use-archived-store";
/**
* Routes that should be updated on focus
@@ -66,7 +67,8 @@ const routeNames = {
Reminders: "Reminders",
MoveNotebook: "MoveNotebook",
LinkNotebooks: "LinkNotebooks",
MoveNotes: "MoveNotes"
MoveNotes: "MoveNotes",
Archive: "Archive"
};
export type NavigationProps<T extends RouteName> = NativeStackScreenProps<
@@ -92,7 +94,8 @@ const routeUpdateFunctions: {
TopicNotes: (params) => eSendEvent("TopicNotes", params),
Monographs: (params) => eSendEvent("Monographs", params),
Reminders: () => useReminderStore.getState().refresh(),
Search: () => eSendEvent(eOnRefreshSearch)
Search: () => eSendEvent(eOnRefreshSearch),
Archive: () => useArchivedStore.getState().refresh()
};
function clearRouteFromQueue(routeName: RouteName) {

View File

@@ -0,0 +1,30 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { db } from "../common/database";
import createDBCollectionStore from "./create-db-collection-store";
const { useStore: useArchivedStore, useCollection: useArchived } =
createDBCollectionStore({
getCollection: () =>
db.notes.archived.grouped(db.settings.getGroupOptions("archive")),
eagerlyFetchFirstBatch: true
});
export { useArchivedStore, useArchived };

View File

@@ -74,6 +74,7 @@ export interface RouteParams extends ParamListBase {
TaggedNotes: NotesScreenParams;
ColoredNotes: NotesScreenParams;
TopicNotes: NotesScreenParams;
Archive: GenericRouteParam;
Monographs: NotesScreenParams;
Reminders: GenericRouteParam;
SettingsGroup: GenericRouteParam;

View File

@@ -98,6 +98,7 @@ export type Settings = {
lastFullBackupDate?: number;
serverUrls?: Record<HostId, string>;
defaultSidebarTab: number;
checkForUpdates?: boolean;
};
type DimensionsType = {
@@ -196,7 +197,8 @@ export const defaultSettings: SettingStore["settings"] = {
settingsVersion: 0,
backupType: "partial",
fullBackupReminder: "never",
lastFullBackupDate: 0
lastFullBackupDate: 0,
checkForUpdates: true
};
export const useSettingStore = create<SettingStore>((set, get) => ({

View File

@@ -77,12 +77,13 @@ export const MenuItemsList: SideMenuItem[] = [
},
type: "side-menu-item"
},
// {
// dataType: "note",
// id: "Archive",
// title: "Archive",
// icon: "archive"
// },
{
dataType: "note",
id: "Archive",
title: "Archive",
icon: "archive",
type: "side-menu-item"
},
{
dataType: "note",
id: "Trash",

View File

@@ -121,7 +121,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled true
versionCode 3049
versionCode 3050
versionName getNpmVersion()
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

View File

@@ -15,7 +15,6 @@
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" tools:node="remove" />

View File

@@ -1,8 +1,3 @@
- v3.1.0 brings new features and improvements to enhance your Notesnook experience.
- Notebooks and Tags are not located in the Sidebar
- Tree view for notebooks
- Improved list view UI for better user experience
- Improved notebook related actions by integrating tree view in most places
- You can set any notebook, tag or colors as home screen
- Bug fixes
Thank you for using Notesnook!

View File

@@ -1063,7 +1063,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2132;
CURRENT_PROJECT_VERSION = 2133;
DEVELOPMENT_TEAM = 53CWBG3QUC;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
@@ -1137,7 +1137,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.1.0;
MARKETING_VERSION = 3.1.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@@ -1168,7 +1168,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2132;
CURRENT_PROJECT_VERSION = 2133;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
@@ -1242,7 +1242,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.1.0;
MARKETING_VERSION = 3.1.1;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = (
"$(inherited)",
@@ -1401,7 +1401,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2132;
CURRENT_PROJECT_VERSION = 2133;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 53CWBG3QUC;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
@@ -1413,7 +1413,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.1.0;
MARKETING_VERSION = 3.1.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.notewidget;
@@ -1444,7 +1444,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2132;
CURRENT_PROJECT_VERSION = 2133;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
@@ -1457,7 +1457,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.1.0;
MARKETING_VERSION = 3.1.1;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.notewidget;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1487,7 +1487,7 @@
CODE_SIGN_ENTITLEMENTS = "Make Note/Make Note.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2132;
CURRENT_PROJECT_VERSION = 2133;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 53CWBG3QUC;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
@@ -1561,7 +1561,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.1.0;
MARKETING_VERSION = 3.1.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
@@ -1592,7 +1592,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2132;
CURRENT_PROJECT_VERSION = 2133;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
@@ -1667,7 +1667,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.1.0;
MARKETING_VERSION = 3.1.1;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -1899,7 +1899,7 @@ SPEC CHECKSUMS:
react-native-orientation-locker: cc6f357b289a2e0dd2210fea0c52cb8e0727fdaa
react-native-pager-view: f530c9533319e0355da3551ade81d471b5a04c44
react-native-pdf: da10473ae54555c373c62af671da8fe0eef846e2
react-native-quick-sqlite: 80b5b3405bfc92e97b6041d2c2a446800bea6ad7
react-native-quick-sqlite: ae74515f7a941f3e7f9e5ea7aff603da1b1c3010
react-native-safe-area-context: b72c4611af2e86d80a59ac76279043d8f75f454c
react-native-screenguard: 82437eeb0086a90b5e5d7e54130bb04fb406373e
react-native-share-extension: bcb7e466390a9e50c742f4b1019d6f181aedd7ad

View File

@@ -228,16 +228,6 @@ module.exports = (env) => {
* from `Repack.plugins`.
*/
new Repack.RepackPlugin({
logger: {
console: false,
listener: (e => {
if (e.message[0].includes("Bundle built with warnings")) {
console.warn(` ` + e.message[0] + " time: " + e.message[1].time);
return;
}
})
},
extraChunks: [
{
type: "local",

View File

@@ -1,6 +1,6 @@
{
"name": "@notesnook/mobile",
"version": "3.1.0",
"version": "3.1.1",
"private": true,
"license": "GPL-3.0-or-later",
"workspaces": [
@@ -56,4 +56,4 @@
"react": "18.2.0",
"react-native": "0.74.5"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -307,7 +307,7 @@ const ShareView = () => {
noteData = {
content: {
data: (rawContent?.data || "") + noteContent.current,
data: (rawContent?.data || "") + "<br/>" + noteContent.current,
type: "tiptap"
},
id: note.id,

View File

@@ -108,6 +108,12 @@ export class AppModel {
return new TrashViewModel(this.page);
}
async goToArchive() {
await this.page.locator(getTestId("tab-home")).click();
await this.navigateTo("Archive");
return new NotesViewModel(this.page, "notes", "archive");
}
async goToSettings() {
await this.profileDropdown.open(
this.page.locator(getTestId("profile-dropdown")),
@@ -153,12 +159,8 @@ export class AppModel {
async search(query: string, type: string) {
const searchinput = this.page.locator(getTestId("search-input"));
const searchButton = this.page.locator(getTestId("search-button"));
const openSearch = this.page.locator(getTestId("open-search"));
await openSearch.click();
await searchinput.fill(query);
await searchButton.click();
return new SearchViewModel(this.page, type);
}
}

View File

@@ -77,4 +77,11 @@ export class NoteItemModel extends BaseItemModel {
}
return tags;
}
async isLockedNotePasswordFieldVisible() {
return this.page
.locator(".active")
.locator(getTestId("unlock-note-password"))
.isVisible();
}
}

View File

@@ -37,6 +37,7 @@ abstract class BaseProperties {
private readonly pinToggle: ToggleModel;
private readonly favoriteToggle: ToggleModel;
private readonly lockToggle: ToggleModel;
private readonly archiveToggle: ToggleModel;
constructor(
page: Page,
@@ -47,6 +48,7 @@ abstract class BaseProperties {
this.pinToggle = new ToggleModel(page, `${itemPrefix}-pin`);
this.lockToggle = new ToggleModel(page, `${itemPrefix}-lock`);
this.favoriteToggle = new ToggleModel(page, `${itemPrefix}-favorite`);
this.archiveToggle = new ToggleModel(page, `${itemPrefix}-archive`);
}
async isPinned() {
@@ -126,6 +128,25 @@ abstract class BaseProperties {
await this.close();
}
async isArchived() {
await this.open();
const state = await this.archiveToggle.isToggled();
await this.close();
return state;
}
async archive() {
await this.open();
await this.archiveToggle.on();
await this.close();
}
async unarchive() {
await this.open();
await this.archiveToggle.off();
await this.close();
}
abstract isColored(color: string): Promise<boolean>;
abstract color(color: string): Promise<void>;
abstract open(): Promise<void>;

View File

@@ -201,6 +201,37 @@ for (const actor of actors) {
expect(await note?.getDescription()).toContain(NOTE.content);
expect(await note?.contextMenu.isLocked()).toBe(false);
});
test(`archive a note using ${actor}`, async ({ page }) => {
const app = new AppModel(page);
await app.goto();
const notes = await app.goToNotes();
const note = await notes.createNote(NOTE);
await note?.[actor].archive();
const archive = await app.goToArchive();
const archivedNote = await archive.findNote(NOTE);
expect(await archivedNote?.contextMenu.isArchived()).toBe(true);
expect(await archivedNote?.properties.isArchived()).toBe(true);
});
test(`unarchive a note using ${actor}`, async ({ page }) => {
const app = new AppModel(page);
await app.goto();
let notes = await app.goToNotes();
let note = await notes.createNote(NOTE);
await note?.contextMenu.archive();
const archive = await app.goToArchive();
const archivedNote = await archive.findNote(NOTE);
await archivedNote?.[actor].unarchive();
notes = await app.goToNotes();
note = await notes.findNote(NOTE);
expect(await note?.contextMenu.isArchived()).toBe(false);
expect(await note?.properties.isArchived()).toBe(false);
});
}
test("open a locked note", async ({ page }) => {
@@ -339,3 +370,80 @@ test(`sort notes`, async ({ page }, info) => {
}
}
});
test("archived favorite note shouldn't be in favorites note list", async ({
page
}) => {
const app = new AppModel(page);
await app.goto();
const notes = await app.goToNotes();
const note = await notes.createNote(NOTE);
await note?.contextMenu.favorite();
await note?.contextMenu.archive();
const favorites = await app.goToFavorites();
expect(await favorites.findNote(NOTE)).toBeUndefined();
});
test("archived tag note shouldn't be in tags note list", async ({ page }) => {
const app = new AppModel(page);
await app.goto();
const tags = await app.goToTags();
const tag = await tags.createItem({ title: "my-tag" });
const notes = await tag?.open();
const note = await notes?.createNote(NOTE);
expect(await notes?.findNote(NOTE)).toBeDefined();
await note?.contextMenu.archive();
expect(await notes?.findNote(NOTE)).toBeUndefined();
});
test("archived notebook note shouldn't be in notebooks note list", async ({
page
}) => {
const app = new AppModel(page);
await app.goto();
const notebooks = await app.goToNotebooks();
const notebook = await notebooks.createNotebook({ title: "my-notebook" });
const notes = await notebook?.openNotebook();
const note = await notes?.createNote(NOTE);
expect(await notes?.findNote(NOTE)).toBeDefined();
await note?.contextMenu.archive();
expect(await notes?.findNote(NOTE)).toBeUndefined();
});
test("archived colored note shouldn't be in colors note list", async ({
page
}) => {
const app = new AppModel(page);
await app.goto();
const notes = await app.goToNotes();
let note = await notes.createNote(NOTE);
await note?.contextMenu.newColor({ title: "red", color: "#ff0000" });
const color = await app.goToColor("red");
note = await color.findNote(NOTE);
expect(note).toBeDefined();
await note?.contextMenu.archive();
expect(await color.findNote(NOTE)).toBeUndefined();
});
test("archived note shouldn't appear in search results", async ({ page }) => {
const app = new AppModel(page);
await app.goto();
const notes = await app.goToNotes();
const note = await notes.createNote(NOTE);
await app.search(NOTE.title, "notes");
expect(await notes.findNote(NOTE)).toBeDefined();
await note?.contextMenu.archive();
await app.search(NOTE.title, "notes");
const searchedNote = await notes.findNote(NOTE);
expect(searchedNote).toBeUndefined();
});

View File

@@ -86,3 +86,42 @@ test("unlocking a note permanently should not show vault unlocked status", async
await expect(vaultUnlockedStatus).toBeHidden();
});
test("clicking on vault unlocked status should lock the note", async ({
page
}) => {
const app = new AppModel(page);
await app.goto();
const notes = await app.goToNotes();
const note = await notes.createNote(NOTE);
await note?.contextMenu.lock(PASSWORD);
await note?.openLockedNote(PASSWORD);
expect(await note?.isLockedNotePasswordFieldVisible()).toBe(false);
const vaultUnlockedStatus = page.locator(getTestId("vault-unlocked"));
await vaultUnlockedStatus.waitFor({ state: "visible" });
await vaultUnlockedStatus.click();
expect(await note?.isLockedNotePasswordFieldVisible()).toBe(true);
});
test("clicking on vault unlocked status should lock the readonly note", async ({
page
}) => {
const app = new AppModel(page);
await app.goto();
const notes = await app.goToNotes();
const note = await notes.createNote(NOTE);
await note?.properties.readonly();
await note?.contextMenu.lock(PASSWORD);
await note?.openLockedNote(PASSWORD);
expect(await note?.isLockedNotePasswordFieldVisible()).toBe(false);
const vaultUnlockedStatus = page.locator(getTestId("vault-unlocked"));
await vaultUnlockedStatus.waitFor({ state: "visible" });
await vaultUnlockedStatus.click();
expect(await note?.isLockedNotePasswordFieldVisible()).toBe(true);
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "@notesnook/web",
"description": "Your private note taking space",
"version": "3.1.0",
"version": "3.2.0-beta.2",
"private": true,
"main": "./src/app.js",
"homepage": "https://notesnook.com/",
@@ -19,7 +19,7 @@
"@lingui/react": "5.1.2",
"@mdi/js": "7.4.47",
"@mdi/react": "1.6.1",
"@notesnook-importer/core": "^2.1.1",
"@notesnook-importer/core": "^2.2.2",
"@notesnook/common": "file:../../packages/common",
"@notesnook/core": "file:../../packages/core",
"@notesnook/crypto": "file:../../packages/crypto",
@@ -51,7 +51,7 @@
"cronosjs": "^1.7.1",
"dayjs": "1.11.13",
"diffblazer": "^1.0.1",
"electron-trpc": "0.6.1",
"electron-trpc": "0.7.1",
"event-source-polyfill": "1.0.31",
"fflate": "^0.8.0",
"file-saver": "^2.0.5",

View File

@@ -1,6 +1,7 @@
.tabsScroll,
.titlebarLogo,
.theme-scope-titleBar,
.navigation-menu-header,
.route-container-header {
-webkit-app-region: drag;
}
@@ -205,6 +206,10 @@ textarea,
display: none;
}
a {
color: var(--accent);
}
.flash {
animation: flash 1s;
}

View File

@@ -164,8 +164,11 @@ function DesktopAppContents() {
useEffect(() => {
if (isListPaneVisible) {
navPane.current?.expand(1);
navPane.current?.reset(1);
if (navPane.current?.hasExpandedSize(1)) {
navPane.current?.expand(1);
} else {
navPane.current?.reset(1);
}
} else {
navPane.current?.collapse(1);
}

View File

@@ -86,9 +86,12 @@ export async function scheduleFullBackups() {
);
}
export function shouldAddAutoBackupsDisabledNotice() {
export async function shouldAddAutoBackupsDisabledNotice() {
const user = await db.user.getUser();
if (!user) return false;
const backupInterval = Config.get("backupReminderOffset", 0);
if (!isUserPremium() && backupInterval) {
if (!isUserPremium(user) && backupInterval) {
Config.set("backupReminderOffset", 0);
return true;
}
@@ -177,7 +180,7 @@ export const NoticesData: Record<NoticeType, NoticeData> = {
export async function resetNotices() {
const notices: Notice[] = [];
if (shouldAddAutoBackupsDisabledNotice()) {
if (await shouldAddAutoBackupsDisabledNotice()) {
notices.push({ type: "autoBackupsOff", priority: 3 });
}
if (await shouldAddBackupNotice()) {

View File

@@ -563,6 +563,7 @@ export function Factory(Module) {
Module.ccall("RegisterExtensionFunctions", "void", ["number"], [db]);
Module.ccall("sqlite3Fts5BetterTrigramInit", "void", ["number"], [db]);
Module.ccall("sqlite3Fts5HtmlInit", "void", ["number"], [db]);
check(fname, result);
return db;
};

View File

@@ -1,148 +1,168 @@
var Module = (() => {
var _scriptName = import.meta.url;
var _scriptDir = import.meta.url;
return (
function(moduleArg = {}) {
var moduleRtn;
var d=moduleArg,aa,ba,ca=new Promise((a,b)=>{aa=a;ba=b}),da="object"==typeof window,ea="undefined"!=typeof WorkerGlobalScope,fa=Object.assign({},d),ha="./this.program",g="",ia,ja;
if(da||ea)ea?g=self.location.href:"undefined"!=typeof document&&document.currentScript&&(g=document.currentScript.src),_scriptName&&(g=_scriptName),g.startsWith("blob:")?g="":g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1),ea&&(ja=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),ia=a=>fetch(a,{credentials:"same-origin"}).then(b=>b.ok?b.arrayBuffer():Promise.reject(Error(b.status+" : "+b.url)));
var la=d.print||console.log.bind(console),r=d.printErr||console.error.bind(console);Object.assign(d,fa);fa=null;d.thisProgram&&(ha=d.thisProgram);var ma=d.wasmBinary,na,oa=!1,pa,u,v,w,qa,x,z,ra,sa;function ta(){var a=na.buffer;d.HEAP8=u=new Int8Array(a);d.HEAP16=w=new Int16Array(a);d.HEAPU8=v=new Uint8Array(a);d.HEAPU16=qa=new Uint16Array(a);d.HEAP32=x=new Int32Array(a);d.HEAPU32=z=new Uint32Array(a);d.HEAPF32=ra=new Float32Array(a);d.HEAPF64=sa=new Float64Array(a)}var ua=[],va=[],wa=[],xa=[];
function ya(){var a=d.preRun.shift();ua.unshift(a)}var za=0,Aa=null,Ba=null;function B(a){d.onAbort?.(a);a="Aborted("+a+")";r(a);oa=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ba(a);throw a;}var Ca=a=>a.startsWith("data:application/octet-stream;base64,"),Da;function Ea(a){if(a==Da&&ma)return new Uint8Array(ma);if(ja)return ja(a);throw"both async and sync fetching of the wasm failed";}
function Fa(a){return ma?Promise.resolve().then(()=>Ea(a)):ia(a).then(b=>new Uint8Array(b),()=>Ea(a))}function Ga(a,b,c){return Fa(a).then(e=>WebAssembly.instantiate(e,b)).then(c,e=>{r(`failed to asynchronously prepare wasm: ${e}`);B(e)})}
function Ha(a,b){var c=Da;return ma||"function"!=typeof WebAssembly.instantiateStreaming||Ca(c)||"function"!=typeof fetch?Ga(c,a,b):fetch(c,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(f){r(`wasm streaming compile failed: ${f}`);r("falling back to ArrayBuffer instantiation");return Ga(c,a,b)}))}var C,D;class Ia{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}var Ja=a=>{for(;0<a.length;)a.shift()(d)};
function F(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return u[a];case "i8":return u[a];case "i16":return w[a>>1];case "i32":return x[a>>2];case "i64":B("to do getValue(i64) use WASM_BIGINT");case "float":return ra[a>>2];case "double":return sa[a>>3];case "*":return z[a>>2];default:B(`invalid type for getValue: ${b}`)}}var Ka=d.noExitRuntime||!0;
function H(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":u[a]=b;break;case "i8":u[a]=b;break;case "i16":w[a>>1]=b;break;case "i32":x[a>>2]=b;break;case "i64":B("to do setValue(i64) use WASM_BIGINT");case "float":ra[a>>2]=b;break;case "double":sa[a>>3]=b;break;case "*":z[a>>2]=b;break;default:B(`invalid type for setValue: ${c}`)}}
var La="undefined"!=typeof TextDecoder?new TextDecoder:void 0,I=(a,b=0,c=NaN)=>{var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.buffer&&La)return La.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var h=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|h);else{var k=a[b++]&63;f=224==(f&240)?(f&15)<<12|h<<6|k:(f&7)<<18|h<<12|k<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e},
Ma=(a,b)=>{for(var c=0,e=a.length-1;0<=e;e--){var f=a[e];"."===f?a.splice(e,1):".."===f?(a.splice(e,1),c++):c&&(a.splice(e,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},Na=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=Ma(a.split("/").filter(e=>!!e),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},Oa=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&=b.substr(0,b.length-1);return a+b},Pa=a=>{if("/"===
a)return"/";a=Na(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)},Qa=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return a=>crypto.getRandomValues(a);B("initRandomDevice")},Ra=a=>(Ra=Qa())(a),Sa=(...a)=>{for(var b="",c=!1,e=a.length-1;-1<=e&&!c;e--){c=0<=e?a[e]:"/";if("string"!=typeof c)throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";b=c+"/"+b;c="/"===c.charAt(0)}b=Ma(b.split("/").filter(f=>!!f),!c).join("/");
return(c?"/":"")+b||"."},Ta=[],Ua=a=>{for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++c):b+=3}return b},J=(a,b,c,e)=>{if(!(0<e))return 0;var f=c;e=c+e-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var n=a.charCodeAt(++h);k=65536+((k&1023)<<10)|n&1023}if(127>=k){if(c>=e)break;b[c++]=k}else{if(2047>=k){if(c+1>=e)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=e)break;b[c++]=224|k>>12}else{if(c+3>=e)break;b[c++]=240|
k>>18;b[c++]=128|k>>12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-f};function Va(a,b,c){c=Array(0<c?c:Ua(a)+1);a=J(a,c,0,c.length);b&&(c.length=a);return c}var Wa=[];function Xa(a,b){Wa[a]={input:[],Tf:[],dg:b};Ya(a,Za)}
var Za={open(a){var b=Wa[a.node.gg];if(!b)throw new K(43);a.Uf=b;a.seekable=!1},close(a){a.Uf.dg.jg(a.Uf)},jg(a){a.Uf.dg.jg(a.Uf)},read(a,b,c,e){if(!a.Uf||!a.Uf.dg.xg)throw new K(60);for(var f=0,h=0;h<e;h++){try{var k=a.Uf.dg.xg(a.Uf)}catch(n){throw new K(29);}if(void 0===k&&0===f)throw new K(6);if(null===k||void 0===k)break;f++;b[c+h]=k}f&&(a.node.timestamp=Date.now());return f},write(a,b,c,e){if(!a.Uf||!a.Uf.dg.rg)throw new K(60);try{for(var f=0;f<e;f++)a.Uf.dg.rg(a.Uf,b[c+f])}catch(h){throw new K(29);
}e&&(a.node.timestamp=Date.now());return f}},$a={xg(){a:{if(!Ta.length){var a=null;"undefined"!=typeof window&&"function"==typeof window.prompt&&(a=window.prompt("Input: "),null!==a&&(a+="\n"));if(!a){a=null;break a}Ta=Va(a,!0)}a=Ta.shift()}return a},rg(a,b){null===b||10===b?(la(I(a.Tf)),a.Tf=[]):0!=b&&a.Tf.push(b)},jg(a){a.Tf&&0<a.Tf.length&&(la(I(a.Tf)),a.Tf=[])},Zg(){return{Ug:25856,Wg:5,Tg:191,Vg:35387,Sg:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},$g(){return 0},
ah(){return[24,80]}},ab={rg(a,b){null===b||10===b?(r(I(a.Tf)),a.Tf=[]):0!=b&&a.Tf.push(b)},jg(a){a.Tf&&0<a.Tf.length&&(r(I(a.Tf)),a.Tf=[])}};function bb(a,b){var c=a.Pf?a.Pf.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Pf,a.Pf=new Uint8Array(b),0<a.Rf&&a.Pf.set(c.subarray(0,a.Rf),0))}
var M={Xf:null,Wf(){return M.createNode(null,"/",16895,0)},createNode(a,b,c,e){if(24576===(c&61440)||4096===(c&61440))throw new K(63);M.Xf||(M.Xf={dir:{node:{Vf:M.Nf.Vf,Sf:M.Nf.Sf,eg:M.Nf.eg,kg:M.Nf.kg,Cg:M.Nf.Cg,pg:M.Nf.pg,ng:M.Nf.ng,Bg:M.Nf.Bg,og:M.Nf.og},stream:{ag:M.Of.ag}},file:{node:{Vf:M.Nf.Vf,Sf:M.Nf.Sf},stream:{ag:M.Of.ag,read:M.Of.read,write:M.Of.write,ug:M.Of.ug,lg:M.Of.lg,mg:M.Of.mg}},link:{node:{Vf:M.Nf.Vf,Sf:M.Nf.Sf,hg:M.Nf.hg},stream:{}},vg:{node:{Vf:M.Nf.Vf,Sf:M.Nf.Sf},stream:cb}});
c=db(a,b,c,e);O(c.mode)?(c.Nf=M.Xf.dir.node,c.Of=M.Xf.dir.stream,c.Pf={}):32768===(c.mode&61440)?(c.Nf=M.Xf.file.node,c.Of=M.Xf.file.stream,c.Rf=0,c.Pf=null):40960===(c.mode&61440)?(c.Nf=M.Xf.link.node,c.Of=M.Xf.link.stream):8192===(c.mode&61440)&&(c.Nf=M.Xf.vg.node,c.Of=M.Xf.vg.stream);c.timestamp=Date.now();a&&(a.Pf[b]=c,a.timestamp=c.timestamp);return c},Yg(a){return a.Pf?a.Pf.subarray?a.Pf.subarray(0,a.Rf):new Uint8Array(a.Pf):new Uint8Array(0)},Nf:{Vf(a){var b={};b.Ig=8192===(a.mode&61440)?a.id:
1;b.yg=a.id;b.mode=a.mode;b.Og=1;b.uid=0;b.Lg=0;b.gg=a.gg;O(a.mode)?b.size=4096:32768===(a.mode&61440)?b.size=a.Rf:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.Eg=new Date(a.timestamp);b.Ng=new Date(a.timestamp);b.Hg=new Date(a.timestamp);b.Fg=4096;b.Gg=Math.ceil(b.size/b.Fg);return b},Sf(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);if(void 0!==b.size&&(b=b.size,a.Rf!=b))if(0==b)a.Pf=null,a.Rf=0;else{var c=a.Pf;a.Pf=new Uint8Array(b);c&&a.Pf.set(c.subarray(0,
Math.min(b,a.Rf)));a.Rf=b}},eg(){throw eb[44];},kg(a,b,c,e){return M.createNode(a,b,c,e)},Cg(a,b,c){if(O(a.mode)){try{var e=fb(b,c)}catch(h){}if(e)for(var f in e.Pf)throw new K(55);}delete a.parent.Pf[a.name];a.parent.timestamp=Date.now();a.name=c;b.Pf[c]=a;b.timestamp=a.parent.timestamp},pg(a,b){delete a.Pf[b];a.timestamp=Date.now()},ng(a,b){var c=fb(a,b),e;for(e in c.Pf)throw new K(55);delete a.Pf[b];a.timestamp=Date.now()},Bg(a){var b=[".",".."],c;for(c of Object.keys(a.Pf))b.push(c);return b},
og(a,b,c){a=M.createNode(a,b,41471,0);a.link=c;return a},hg(a){if(40960!==(a.mode&61440))throw new K(28);return a.link}},Of:{read(a,b,c,e,f){var h=a.node.Pf;if(f>=a.node.Rf)return 0;a=Math.min(a.node.Rf-f,e);if(8<a&&h.subarray)b.set(h.subarray(f,f+a),c);else for(e=0;e<a;e++)b[c+e]=h[f+e];return a},write(a,b,c,e,f,h){b.buffer===u.buffer&&(h=!1);if(!e)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Pf||a.Pf.subarray)){if(h)return a.Pf=b.subarray(c,c+e),a.Rf=e;if(0===a.Rf&&0===f)return a.Pf=
b.slice(c,c+e),a.Rf=e;if(f+e<=a.Rf)return a.Pf.set(b.subarray(c,c+e),f),e}bb(a,f+e);if(a.Pf.subarray&&b.subarray)a.Pf.set(b.subarray(c,c+e),f);else for(h=0;h<e;h++)a.Pf[f+h]=b[c+h];a.Rf=Math.max(a.Rf,f+e);return e},ag(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Rf);if(0>b)throw new K(28);return b},ug(a,b,c){bb(a.node,b+c);a.node.Rf=Math.max(a.node.Rf,b+c)},lg(a,b,c,e,f){if(32768!==(a.node.mode&61440))throw new K(43);a=a.node.Pf;if(f&2||!a||a.buffer!==u.buffer){f=!0;e=
65536*Math.ceil(b/65536);var h=gb(65536,e);h&&v.fill(0,h,h+e);e=h;if(!e)throw new K(48);if(a){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,c,c+b);u.set(a,e)}}else f=!1,e=a.byteOffset;return{Pg:e,Dg:f}},mg(a,b,c,e){M.Of.write(a,b,0,e,c,!1);return 0}}},hb=(a,b)=>{var c=0;a&&(c|=365);b&&(c|=146);return c},ib=null,jb={},kb=[],lb=1,P=null,mb=!1,nb=!0,K=class{name="ErrnoError";constructor(a){this.Qf=a}},eb={},ob={},pb=class{ig={};node=null;get flags(){return this.ig.flags}set flags(a){this.ig.flags=
a}get position(){return this.ig.position}set position(a){this.ig.position=a}},qb=class{Nf={};Of={};bg=null;constructor(a,b,c,e){a||=this;this.parent=a;this.Wf=a.Wf;this.id=lb++;this.name=b;this.mode=c;this.gg=e}get read(){return 365===(this.mode&365)}set read(a){a?this.mode|=365:this.mode&=-366}get write(){return 146===(this.mode&146)}set write(a){a?this.mode|=146:this.mode&=-147}};
function Q(a,b={}){a=Sa(a);if(!a)return{path:"",node:null};b=Object.assign({wg:!0,sg:0},b);if(8<b.sg)throw new K(32);a=a.split("/").filter(k=>!!k);for(var c=ib,e="/",f=0;f<a.length;f++){var h=f===a.length-1;if(h&&b.parent)break;c=fb(c,a[f]);e=Na(e+"/"+a[f]);c.bg&&(!h||h&&b.wg)&&(c=c.bg.root);if(!h||b.$f)for(h=0;40960===(c.mode&61440);)if(c=rb(e),e=Sa(Oa(e),c),c=Q(e,{sg:b.sg+1}).node,40<h++)throw new K(32);}return{path:e,node:c}}
function sb(a){for(var b;;){if(a===a.parent)return a=a.Wf.Ag,b?"/"!==a[a.length-1]?`${a}/${b}`:a+b:a;b=b?`${a.name}/${b}`:a.name;a=a.parent}}function tb(a,b){for(var c=0,e=0;e<b.length;e++)c=(c<<5)-c+b.charCodeAt(e)|0;return(a+c>>>0)%P.length}function ub(a){var b=tb(a.parent.id,a.name);if(P[b]===a)P[b]=a.cg;else for(b=P[b];b;){if(b.cg===a){b.cg=a.cg;break}b=b.cg}}
function fb(a,b){var c=O(a.mode)?(c=vb(a,"x"))?c:a.Nf.eg?0:2:54;if(c)throw new K(c);for(c=P[tb(a.id,b)];c;c=c.cg){var e=c.name;if(c.parent.id===a.id&&e===b)return c}return a.Nf.eg(a,b)}function db(a,b,c,e){a=new qb(a,b,c,e);b=tb(a.parent.id,a.name);a.cg=P[b];return P[b]=a}function O(a){return 16384===(a&61440)}function wb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}
function vb(a,b){if(nb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function xb(a,b){try{return fb(a,b),20}catch(c){}return vb(a,"wx")}function yb(a,b,c){try{var e=fb(a,b)}catch(f){return f.Qf}if(a=vb(a,"wx"))return a;if(c){if(!O(e.mode))return 54;if(e===e.parent||"/"===sb(e))return 10}else if(O(e.mode))return 31;return 0}function R(a){a=kb[a];if(!a)throw new K(8);return a}
function zb(a,b=-1){a=Object.assign(new pb,a);if(-1==b)a:{for(b=0;4096>=b;b++)if(!kb[b])break a;throw new K(33);}a.Yf=b;return kb[b]=a}function Ab(a,b=-1){a=zb(a,b);a.Of?.Xg?.(a);return a}var cb={open(a){a.Of=jb[a.node.gg].Of;a.Of.open?.(a)},ag(){throw new K(70);}};function Ya(a,b){jb[a]={Of:b}}
function Bb(a,b){var c="/"===b;if(c&&ib)throw new K(10);if(!c&&b){var e=Q(b,{wg:!1});b=e.path;e=e.node;if(e.bg)throw new K(10);if(!O(e.mode))throw new K(54);}b={type:a,bh:{},Ag:b,Mg:[]};a=a.Wf(b);a.Wf=b;b.root=a;c?ib=a:e&&(e.bg=b,e.Wf&&e.Wf.Mg.push(b))}function Cb(a,b,c){var e=Q(a,{parent:!0}).node;a=Pa(a);if(!a||"."===a||".."===a)throw new K(28);var f=xb(e,a);if(f)throw new K(f);if(!e.Nf.kg)throw new K(63);return e.Nf.kg(e,a,b,c)}function S(a,b){return Cb(a,(void 0!==b?b:511)&1023|16384,0)}
function Db(a,b,c){"undefined"==typeof c&&(c=b,b=438);Cb(a,b|8192,c)}function Eb(a,b){if(!Sa(a))throw new K(44);var c=Q(b,{parent:!0}).node;if(!c)throw new K(44);b=Pa(b);var e=xb(c,b);if(e)throw new K(e);if(!c.Nf.og)throw new K(63);c.Nf.og(c,b,a)}function Fb(a){var b=Q(a,{parent:!0}).node;a=Pa(a);var c=fb(b,a),e=yb(b,a,!0);if(e)throw new K(e);if(!b.Nf.ng)throw new K(63);if(c.bg)throw new K(10);b.Nf.ng(b,a);ub(c)}
function rb(a){a=Q(a).node;if(!a)throw new K(44);if(!a.Nf.hg)throw new K(28);return Sa(sb(a.parent),a.Nf.hg(a))}function Gb(a,b){a=Q(a,{$f:!b}).node;if(!a)throw new K(44);if(!a.Nf.Vf)throw new K(63);return a.Nf.Vf(a)}function Hb(a){return Gb(a,!0)}function Ib(a,b){a="string"==typeof a?Q(a,{$f:!0}).node:a;if(!a.Nf.Sf)throw new K(63);a.Nf.Sf(a,{mode:b&4095|a.mode&-4096,timestamp:Date.now()})}
function Jb(a,b){if(0>b)throw new K(28);a="string"==typeof a?Q(a,{$f:!0}).node:a;if(!a.Nf.Sf)throw new K(63);if(O(a.mode))throw new K(31);if(32768!==(a.mode&61440))throw new K(28);var c=vb(a,"w");if(c)throw new K(c);a.Nf.Sf(a,{size:b,timestamp:Date.now()})}
function Kb(a,b,c){if(""===a)throw new K(44);if("string"==typeof b){var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof e)throw Error(`Unknown file open mode: ${b}`);b=e}c=b&64?("undefined"==typeof c?438:c)&4095|32768:0;if("object"==typeof a)var f=a;else{a=Na(a);try{f=Q(a,{$f:!(b&131072)}).node}catch(h){}}e=!1;if(b&64)if(f){if(b&128)throw new K(20);}else f=Cb(a,c,0),e=!0;if(!f)throw new K(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!O(f.mode))throw new K(54);if(!e&&(c=
f?40960===(f.mode&61440)?32:O(f.mode)&&("r"!==wb(b)||b&512)?31:vb(f,wb(b)):44))throw new K(c);b&512&&!e&&Jb(f,0);b&=-131713;f=zb({node:f,path:sb(f),flags:b,seekable:!0,position:0,Of:f.Of,Rg:[],error:!1});f.Of.open&&f.Of.open(f);!d.logReadFiles||b&1||a in ob||(ob[a]=1);return f}function Lb(a,b,c){if(null===a.Yf)throw new K(8);if(!a.seekable||!a.Of.ag)throw new K(70);if(0!=c&&1!=c&&2!=c)throw new K(28);a.position=a.Of.ag(a,b,c);a.Rg=[]}
function T(a,b,c){a=Na("/dev/"+a);var e=hb(!!b,!!c);T.zg??(T.zg=64);var f=T.zg++<<8|0;Ya(f,{open(h){h.seekable=!1},close(){c?.buffer?.length&&c(10)},read(h,k,n,l){for(var m=0,p=0;p<l;p++){try{var q=b()}catch(t){throw new K(29);}if(void 0===q&&0===m)throw new K(6);if(null===q||void 0===q)break;m++;k[n+p]=q}m&&(h.node.timestamp=Date.now());return m},write(h,k,n,l){for(var m=0;m<l;m++)try{c(k[n+m])}catch(p){throw new K(29);}l&&(h.node.timestamp=Date.now());return m}});Db(a,e,f)}var U={};
function Mb(a,b,c){if("/"===b.charAt(0))return b;a=-100===a?"/":R(a).path;if(0==b.length){if(!c)throw new K(44);return a}return Na(a+"/"+b)}
function Nb(a,b,c){a=a(b);x[c>>2]=a.Ig;x[c+4>>2]=a.mode;z[c+8>>2]=a.Og;x[c+12>>2]=a.uid;x[c+16>>2]=a.Lg;x[c+20>>2]=a.gg;D=[a.size>>>0,(C=a.size,1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];x[c+24>>2]=D[0];x[c+28>>2]=D[1];x[c+32>>2]=4096;x[c+36>>2]=a.Gg;b=a.Eg.getTime();var e=a.Ng.getTime(),f=a.Hg.getTime();D=[Math.floor(b/1E3)>>>0,(C=Math.floor(b/1E3),1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:
0)];x[c+40>>2]=D[0];x[c+44>>2]=D[1];z[c+48>>2]=b%1E3*1E6;D=[Math.floor(e/1E3)>>>0,(C=Math.floor(e/1E3),1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];x[c+56>>2]=D[0];x[c+60>>2]=D[1];z[c+64>>2]=e%1E3*1E6;D=[Math.floor(f/1E3)>>>0,(C=Math.floor(f/1E3),1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];x[c+72>>2]=D[0];x[c+76>>2]=D[1];z[c+80>>2]=f%1E3*1E6;D=[a.yg>>>0,(C=a.yg,1<=+Math.abs(C)?0<C?+Math.floor(C/
4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];x[c+88>>2]=D[0];x[c+92>>2]=D[1];return 0}
var Ob=void 0,Pb=()=>{var a=x[+Ob>>2];Ob+=4;return a},Qb=(a,b)=>b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN,Rb=0,Sb=[0,31,60,91,121,152,182,213,244,274,305,335],Tb=[0,31,59,90,120,151,181,212,243,273,304,334],Ub={},Vb=a=>{if(!(a instanceof Ia||"unwind"==a))throw a;},Wb=a=>{pa=a;Ka||0<Rb||(d.onExit?.(a),oa=!0);throw new Ia(a);},Xb=a=>{if(!oa)try{if(a(),!(Ka||0<Rb))try{pa=a=pa,Wb(a)}catch(b){Vb(b)}}catch(b){Vb(b)}},Yb={},$b=()=>{if(!Zb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",
HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ha||"./this.program"},b;for(b in Yb)void 0===Yb[b]?delete a[b]:a[b]=Yb[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);Zb=c}return Zb},Zb;function ac(){}function bc(){}function cc(){}function dc(){}function ec(){}function fc(){}function gc(){}function hc(){}function ic(){}function jc(){}function kc(){}function lc(){}function mc(){}function nc(){}function oc(){}
function pc(){}function qc(){}function rc(){}function sc(){}function tc(){}function uc(){}function vc(){}function wc(){}function xc(){}function yc(){}function zc(){}function Ac(){}function Bc(){}function Cc(){}function Dc(){}function Ec(){}function Fc(){}function Gc(){}function Hc(){}function Ic(){}function Jc(){}function Kc(){}function Lc(){}function Mc(){}var Nc=a=>{try{a()}catch(b){B(b)}};
function Oc(){var a=V,b={};for(let [c,e]of Object.entries(a))b[c]="function"==typeof e?(...f)=>{Pc.push(c);try{return e(...f)}finally{oa||(Pc.pop(),W&&1===X&&0===Pc.length&&(X=0,Nc(Qc),"undefined"!=typeof Fibers&&Fibers.eh()))}}:e;return b}var X=0,W=null,Rc=0,Pc=[],Sc={},Tc={},Uc=0,Vc=null,Wc=[];function Xc(){return new Promise((a,b)=>{Vc={resolve:a,reject:b}})}
function Yc(){var a=Zc(16396),b=a+12;z[a>>2]=b;z[a+4>>2]=b+16384;b=Pc[0];var c=Sc[b];void 0===c&&(c=Uc++,Sc[b]=c,Tc[c]=b);x[a+8>>2]=c;return a}
function $c(a){if(!oa){if(0===X){var b=!1,c=!1;a((e=0)=>{if(!oa&&(Rc=e,b=!0,c)){X=2;Nc(()=>ad(W));"undefined"!=typeof MainLoop&&MainLoop.Kg&&MainLoop.resume();e=!1;try{var f=(0,V[Tc[x[W+8>>2]]])()}catch(n){f=n,e=!0}var h=!1;if(!W){var k=Vc;k&&(Vc=null,(e?k.reject:k.resolve)(f),h=!0)}if(e&&!h)throw f;}});c=!0;b||(X=1,W=Yc(),"undefined"!=typeof MainLoop&&MainLoop.Kg&&MainLoop.pause(),Nc(()=>bd(W)))}else 2===X?(X=0,Nc(cd),dd(W),W=null,Wc.forEach(Xb)):B(`invalid state: ${X}`);return Rc}}
function ed(a){return $c(b=>{a().then(b)})}
var fd={},gd,hd,jd=[],Z=(a,b,c,e,f)=>{function h(q){--Rb;0!==l&&kd(l);return"string"===b?q?I(v,q):"":"boolean"===b?!!q:q}var k={string:q=>{var t=0;if(null!==q&&void 0!==q&&0!==q){t=Ua(q)+1;var y=ld(t);J(q,v,y,t);t=y}return t},array:q=>{var t=ld(q.length);u.set(q,t);return t}};a=d["_"+a];var n=[],l=0;if(e)for(var m=0;m<e.length;m++){var p=k[c[m]];p?(0===l&&(l=md()),n[m]=p(e[m])):n[m]=e[m]}c=W;e=a(...n);f=f?.async;Rb+=1;if(W!=c)return Xc().then(h);e=h(e);return f?Promise.resolve(e):e},nd="undefined"!=
typeof TextDecoder?new TextDecoder("utf-16le"):void 0;[44].forEach(a=>{eb[a]=new K(a);eb[a].stack="<generic error, no stack>"});P=Array(4096);Bb(M,"/");S("/tmp");S("/home");S("/home/web_user");(function(){S("/dev");Ya(259,{read:()=>0,write:(e,f,h,k)=>k});Db("/dev/null",259);Xa(1280,$a);Xa(1536,ab);Db("/dev/tty",1280);Db("/dev/tty1",1536);var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(b=Ra(a).byteLength);return a[--b]};T("random",c);T("urandom",c);S("/dev/shm");S("/dev/shm/tmp")})();
(function(){S("/proc");var a=S("/proc/self");S("/proc/self/fd");Bb({Wf(){var b=db(a,"fd",16895,73);b.Nf={eg(c,e){var f=R(+e);c={parent:null,Wf:{Ag:"fake"},Nf:{hg:()=>f.path}};return c.parent=c}};return b}},"/proc/self/fd")})();
(function(){const a=new Map;d.setAuthorizer=function(b,c,e){c?a.set(b,{f:c,tg:e}):a.delete(b);return Z("set_authorizer","number",["number"],[b])};ac=function(b,c,e,f,h,k){if(a.has(b)){const {f:n,tg:l}=a.get(b);return n(l,c,e?e?I(v,e):"":null,f?f?I(v,f):"":null,h?h?I(v,h):"":null,k?k?I(v,k):"":null)}return 0}})();
(function(){const a=new Map,b=new Map;d.createFunction=function(c,e,f,h,k,n){const l=a.size;a.set(l,{f:n,Zf:k});return Z("create_function","number","number string number number number number".split(" "),[c,e,f,h,l,0])};d.createAggregate=function(c,e,f,h,k,n,l){const m=a.size;a.set(m,{step:n,Jg:l,Zf:k});return Z("create_function","number","number string number number number number".split(" "),[c,e,f,h,m,1])};d.getFunctionUserData=function(c){return b.get(c)};cc=function(c,e,f,h){c=a.get(c);b.set(e,
c.Zf);c.f(e,new Uint32Array(v.buffer,h,f));b.delete(e)};ec=function(c,e,f,h){c=a.get(c);b.set(e,c.Zf);c.step(e,new Uint32Array(v.buffer,h,f));b.delete(e)};bc=function(c,e){c=a.get(c);b.set(e,c.Zf);c.Jg(e);b.delete(e)}})();(function(){const a=new Map;d.progressHandler=function(b,c,e,f){e?a.set(b,{f:e,tg:f}):a.delete(b);return Z("progress_handler",null,["number","number"],[b,c])};dc=function(b){if(a.has(b)){const {f:c,tg:e}=a.get(b);return c(e)}return 0}})();
(function(){function a(l,m){const p=`get${l}`,q=`set${l}`;return new Proxy(new DataView(v.buffer,m,"Int32"===l?4:8),{get(t,y){if(y===p)return function(A,G){if(!G)throw Error("must be little endian");return t[y](A,G)};if(y===q)return function(A,G,E){if(!E)throw Error("must be little endian");return t[y](A,G,E)};if("string"===typeof y&&y.match(/^(get)|(set)/))throw Error("invalid type");return t[y]}})}const b="object"===typeof fd,c=new Map,e=new Map,f=new Map,h=b?new Set:null,k=b?new Set:null,n=new Map;
vc=function(l,m,p,q){n.set(l?I(v,l):"",{size:m,fg:Array.from(new Uint32Array(v.buffer,q,p))})};d.createModule=function(l,m,p,q){b&&(p.handleAsync=ed);const t=c.size;c.set(t,{module:p,Zf:q});q=0;p.xCreate&&(q|=1);p.xConnect&&(q|=2);p.xBestIndex&&(q|=4);p.xDisconnect&&(q|=8);p.xDestroy&&(q|=16);p.xOpen&&(q|=32);p.xClose&&(q|=64);p.xFilter&&(q|=128);p.xNext&&(q|=256);p.xEof&&(q|=512);p.xColumn&&(q|=1024);p.xRowid&&(q|=2048);p.xUpdate&&(q|=4096);p.xBegin&&(q|=8192);p.xSync&&(q|=16384);p.xCommit&&(q|=
32768);p.xRollback&&(q|=65536);p.xFindFunction&&(q|=131072);p.xRename&&(q|=262144);return Z("create_module","number",["number","string","number","number"],[l,m,t,q])};lc=function(l,m,p,q,t,y){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const A of h)e.delete(A)}q=Array.from(new Uint32Array(v.buffer,q,p)).map(A=>A?I(v,A):"");return m.module.xCreate(l,m.Zf,q,t,a("Int32",y))};kc=function(l,m,p,q,t,y){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const A of h)e.delete(A)}q=Array.from(new Uint32Array(v.buffer,
q,p)).map(A=>A?I(v,A):"");return m.module.xConnect(l,m.Zf,q,t,a("Int32",y))};gc=function(l,m){var p=e.get(l),q=n.get("sqlite3_index_info").fg;const t={};t.nConstraint=F(m+q[0],"i32");t.aConstraint=[];var y=F(m+q[1],"*"),A=n.get("sqlite3_index_constraint").size;for(var G=0;G<t.nConstraint;++G){var E=t.aConstraint,N=E.push,L=y+G*A,ka=n.get("sqlite3_index_constraint").fg,Y={};Y.iColumn=F(L+ka[0],"i32");Y.op=F(L+ka[1],"i8");Y.usable=!!F(L+ka[2],"i8");N.call(E,Y)}t.nOrderBy=F(m+q[2],"i32");t.aOrderBy=
[];y=F(m+q[3],"*");A=n.get("sqlite3_index_orderby").size;for(G=0;G<t.nOrderBy;++G)E=t.aOrderBy,N=E.push,L=y+G*A,ka=n.get("sqlite3_index_orderby").fg,Y={},Y.iColumn=F(L+ka[0],"i32"),Y.desc=!!F(L+ka[1],"i8"),N.call(E,Y);t.aConstraintUsage=[];for(y=0;y<t.nConstraint;++y)t.aConstraintUsage.push({argvIndex:0,omit:!1});t.idxNum=F(m+q[5],"i32");t.idxStr=null;t.orderByConsumed=!!F(m+q[8],"i8");t.estimatedCost=F(m+q[9],"double");t.estimatedRows=F(m+q[10],"i32");t.idxFlags=F(m+q[11],"i32");t.colUsed=F(m+q[12],
"i32");l=p.module.xBestIndex(l,t);p=n.get("sqlite3_index_info").fg;q=F(m+p[4],"*");y=n.get("sqlite3_index_constraint_usage").size;for(N=0;N<t.nConstraint;++N)A=q+N*y,E=t.aConstraintUsage[N],L=n.get("sqlite3_index_constraint_usage").fg,H(A+L[0],E.argvIndex,"i32"),H(A+L[1],E.omit?1:0,"i8");H(m+p[5],t.idxNum,"i32");"string"===typeof t.idxStr&&(q=Ua(t.idxStr),y=Z("sqlite3_malloc","number",["number"],[q+1]),J(t.idxStr,v,y,q+1),H(m+p[6],y,"*"),H(m+p[7],1,"i32"));H(m+p[8],t.orderByConsumed,"i32");H(m+p[9],
t.estimatedCost,"double");H(m+p[10],t.estimatedRows,"i32");H(m+p[11],t.idxFlags,"i32");return l};nc=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDisconnect(l)};mc=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDestroy(l)};rc=function(l,m){const p=e.get(l);f.set(m,p);if(b){k.delete(m);for(const q of k)f.delete(q)}return p.module.xOpen(l,m)};hc=function(l){const m=f.get(l);b?k.add(l):f.delete(l);return m.module.xClose(l)};oc=function(l){return f.get(l).module.xEof(l)?
1:0};pc=function(l,m,p,q,t){const y=f.get(l);p=p?p?I(v,p):"":null;t=new Uint32Array(v.buffer,t,q);return y.module.xFilter(l,m,p,t)};qc=function(l){return f.get(l).module.xNext(l)};ic=function(l,m,p){return f.get(l).module.xColumn(l,m,p)};uc=function(l,m){return f.get(l).module.xRowid(l,a("BigInt64",m))};xc=function(l,m,p,q){const t=e.get(l);p=new Uint32Array(v.buffer,p,m);return t.module.xUpdate(l,p,a("BigInt64",q))};fc=function(l){return e.get(l).module.xBegin(l)};wc=function(l){return e.get(l).module.xSync(l)};
jc=function(l){return e.get(l).module.xCommit(l)};tc=function(l){return e.get(l).module.xRollback(l)};sc=function(l,m){const p=e.get(l);m=m?I(v,m):"";return p.module.xRename(l,m)}})();
(function(){function a(h,k){const n=`get${h}`,l=`set${h}`;return new Proxy(new DataView(v.buffer,k,"Int32"===h?4:8),{get(m,p){if(p===n)return function(q,t){if(!t)throw Error("must be little endian");return m[p](q,t)};if(p===l)return function(q,t,y){if(!y)throw Error("must be little endian");return m[p](q,t,y)};if("string"===typeof p&&p.match(/^(get)|(set)/))throw Error("invalid type");return m[p]}})}const b="object"===typeof fd;b&&(d.handleAsync=ed);const c=new Map,e=new Map;d.registerVFS=function(h,
k){if(Z("sqlite3_vfs_find","number",["string"],[h.name]))throw Error(`VFS '${h.name}' already registered`);b&&(h.handleAsync=ed);var n=h.mxPathName??64;const l=d._malloc(4);k=Z("register_vfs","number",["string","number","number","number"],[h.name,n,k?1:0,l]);k||(n=F(l,"*"),c.set(n,h));d._free(l);return k};const f=b?new Set:null;Ac=function(h){const k=e.get(h);b?f.add(h):e.delete(h);return k.xClose(h)};Hc=function(h,k,n,l,m){return e.get(h).xRead(h,v.subarray(k,k+n),4294967296*m+l+(0>l?2**32:0))};
Mc=function(h,k,n,l,m){return e.get(h).xWrite(h,v.subarray(k,k+n),4294967296*m+l+(0>l?2**32:0))};Kc=function(h,k,n){return e.get(h).xTruncate(h,4294967296*n+k+(0>k?2**32:0))};Jc=function(h,k){return e.get(h).xSync(h,k)};Ec=function(h,k){const n=e.get(h);k=a("BigInt64",k);return n.xFileSize(h,k)};Fc=function(h,k){return e.get(h).xLock(h,k)};Lc=function(h,k){return e.get(h).xUnlock(h,k)};zc=function(h,k){const n=e.get(h);k=a("Int32",k);return n.xCheckReservedLock(h,k)};Dc=function(h,k,n){const l=e.get(h);
n=new DataView(v.buffer,n);return l.xFileControl(h,k,n)};Ic=function(h){return e.get(h).xSectorSize(h)};Cc=function(h){return e.get(h).xDeviceCharacteristics(h)};Gc=function(h,k,n,l,m){h=c.get(h);e.set(n,h);if(b){f.delete(n);for(var p of f)e.delete(p)}p=null;if(l&64){p=1;const q=[];for(;p;){const t=v[k++];if(t)q.push(t);else switch(v[k]||(p=null),p){case 1:q.push(63);p=2;break;case 2:q.push(61);p=3;break;case 3:q.push(38),p=2}}p=(new TextDecoder).decode(new Uint8Array(q))}else k&&(p=k?I(v,k):"");
m=a("Int32",m);return h.xOpen(p,n,l,m)};Bc=function(h,k,n){return c.get(h).xDelete(k?I(v,k):"",n)};yc=function(h,k,n,l){h=c.get(h);l=a("Int32",l);return h.xAccess(k?I(v,k):"",n,l)}})();
var pd={a:(a,b,c,e)=>{B(`Assertion failed: ${a?I(v,a):""}, at: `+[b?b?I(v,b):"":"unknown filename",c,e?e?I(v,e):"":"unknown function"])},R:function(a,b){try{return a=a?I(v,a):"",Ib(a,b),0}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;return-c.Qf}},U:function(a,b,c){try{b=b?I(v,b):"";b=Mb(a,b);if(c&-8)return-28;var e=Q(b,{$f:!0}).node;if(!e)return-44;a="";c&4&&(a+="r");c&2&&(a+="w");c&1&&(a+="x");return a&&vb(e,a)?-2:0}catch(f){if("undefined"==typeof U||"ErrnoError"!==f.name)throw f;
return-f.Qf}},S:function(a,b){try{var c=R(a);Ib(c.node,b);return 0}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return-e.Qf}},Q:function(a){try{var b=R(a).node;var c="string"==typeof b?Q(b,{$f:!0}).node:b;if(!c.Nf.Sf)throw new K(63);c.Nf.Sf(c,{timestamp:Date.now()});return 0}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return-e.Qf}},b:function(a,b,c){Ob=c;try{var e=R(a);switch(b){case 0:var f=Pb();if(0>f)break;for(;kb[f];)f++;return Ab(e,f).Yf;case 1:case 2:return 0;
case 3:return e.flags;case 4:return f=Pb(),e.flags|=f,0;case 12:return f=Pb(),w[f+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(h){if("undefined"==typeof U||"ErrnoError"!==h.name)throw h;return-h.Qf}},P:function(a,b){try{var c=R(a);return Nb(Gb,c.path,b)}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return-e.Qf}},m:function(a,b,c){b=Qb(b,c);try{if(isNaN(b))return 61;var e=R(a);if(0===(e.flags&2097155))throw new K(28);Jb(e.node,b);return 0}catch(f){if("undefined"==typeof U||
"ErrnoError"!==f.name)throw f;return-f.Qf}},J:function(a,b){try{if(0===b)return-28;var c=Ua("/")+1;if(b<c)return-68;J("/",v,a,b);return c}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return-e.Qf}},N:function(a,b){try{return a=a?I(v,a):"",Nb(Hb,a,b)}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;return-c.Qf}},F:function(a,b,c){try{return b=b?I(v,b):"",b=Mb(a,b),b=Na(b),"/"===b[b.length-1]&&(b=b.substr(0,b.length-1)),S(b,c),0}catch(e){if("undefined"==typeof U||
"ErrnoError"!==e.name)throw e;return-e.Qf}},M:function(a,b,c,e){try{b=b?I(v,b):"";var f=e&256;b=Mb(a,b,e&4096);return Nb(f?Hb:Gb,b,c)}catch(h){if("undefined"==typeof U||"ErrnoError"!==h.name)throw h;return-h.Qf}},D:function(a,b,c,e){Ob=e;try{b=b?I(v,b):"";b=Mb(a,b);var f=e?Pb():0;return Kb(b,c,f).Yf}catch(h){if("undefined"==typeof U||"ErrnoError"!==h.name)throw h;return-h.Qf}},B:function(a,b,c,e){try{b=b?I(v,b):"";b=Mb(a,b);if(0>=e)return-28;var f=rb(b),h=Math.min(e,Ua(f)),k=u[c+h];J(f,v,c,e+1);u[c+
h]=k;return h}catch(n){if("undefined"==typeof U||"ErrnoError"!==n.name)throw n;return-n.Qf}},z:function(a){try{return a=a?I(v,a):"",Fb(a),0}catch(b){if("undefined"==typeof U||"ErrnoError"!==b.name)throw b;return-b.Qf}},O:function(a,b){try{return a=a?I(v,a):"",Nb(Gb,a,b)}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;return-c.Qf}},x:function(a,b,c){try{b=b?I(v,b):"";b=Mb(a,b);if(0===c){a=b;var e=Q(a,{parent:!0}).node;if(!e)throw new K(44);var f=Pa(a),h=fb(e,f),k=yb(e,f,!1);if(k)throw new K(k);
if(!e.Nf.pg)throw new K(63);if(h.bg)throw new K(10);e.Nf.pg(e,f);ub(h)}else 512===c?Fb(b):B("Invalid flags passed to unlinkat");return 0}catch(n){if("undefined"==typeof U||"ErrnoError"!==n.name)throw n;return-n.Qf}},w:function(a,b,c){try{b=b?I(v,b):"";b=Mb(a,b,!0);var e=Date.now();if(c){var f=z[c>>2]+4294967296*x[c+4>>2],h=x[c+8>>2];var k=1073741823==h?e:1073741822==h?-1:1E3*f+h/1E6;c+=16;f=z[c>>2]+4294967296*x[c+4>>2];h=x[c+8>>2];var n=1073741823==h?e:1073741822==h?-1:1E3*f+h/1E6}else n=k=e;if(-1!=
n||-1!=k){a=k;var l=Q(b,{$f:!0}).node;l.Nf.Sf(l,{timestamp:Math.max(a,n)})}return 0}catch(m){if("undefined"==typeof U||"ErrnoError"!==m.name)throw m;return-m.Qf}},V:()=>{B("")},s:()=>{Ka=!1;Rb=0},k:function(a,b,c){a=new Date(1E3*Qb(a,b));x[c>>2]=a.getSeconds();x[c+4>>2]=a.getMinutes();x[c+8>>2]=a.getHours();x[c+12>>2]=a.getDate();x[c+16>>2]=a.getMonth();x[c+20>>2]=a.getFullYear()-1900;x[c+24>>2]=a.getDay();b=a.getFullYear();x[c+28>>2]=(0!==b%4||0===b%100&&0!==b%400?Tb:Sb)[a.getMonth()]+a.getDate()-
1|0;x[c+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();x[c+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},i:function(a,b,c,e,f,h,k,n){f=Qb(f,h);try{if(isNaN(f))return 61;var l=R(e);if(0!==(b&2)&&0===(c&2)&&2!==(l.flags&2097155))throw new K(2);if(1===(l.flags&2097155))throw new K(2);if(!l.Of.lg)throw new K(43);if(!a)throw new K(28);var m=l.Of.lg(l,a,f,b,c);var p=m.Pg;x[k>>2]=m.Dg;z[n>>2]=p;return 0}catch(q){if("undefined"==
typeof U||"ErrnoError"!==q.name)throw q;return-q.Qf}},j:function(a,b,c,e,f,h,k){h=Qb(h,k);try{var n=R(f);if(c&2){if(32768!==(n.node.mode&61440))throw new K(43);e&2||n.Of.mg&&n.Of.mg(n,v.slice(a,a+b),h,b,e)}}catch(l){if("undefined"==typeof U||"ErrnoError"!==l.name)throw l;return-l.Qf}},t:(a,b)=>{Ub[a]&&(clearTimeout(Ub[a].id),delete Ub[a]);if(!b)return 0;var c=setTimeout(()=>{delete Ub[a];Xb(()=>od(a,performance.now()))},b);Ub[a]={id:c,dh:b};return 0},E:(a,b,c,e)=>{var f=(new Date).getFullYear(),h=
(new Date(f,0,1)).getTimezoneOffset();f=(new Date(f,6,1)).getTimezoneOffset();z[a>>2]=60*Math.max(h,f);x[b>>2]=Number(h!=f);b=k=>{var n=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(n/60)).padStart(2,"0")}${String(n%60).padStart(2,"0")}`};a=b(h);b=b(f);f<h?(J(a,v,c,17),J(b,v,e,17)):(J(a,v,e,17),J(b,v,c,17))},e:()=>Date.now(),d:()=>performance.now(),u:a=>{var b=v.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,
65536*Math.ceil(Math.max(a,e)/65536))-na.buffer.byteLength+65535)/65536|0;try{na.grow(e);ta();var f=1;break a}catch(h){}f=void 0}if(f)return!0}return!1},G:(a,b)=>{var c=0;$b().forEach((e,f)=>{var h=b+c;f=z[a+4*f>>2]=h;for(h=0;h<e.length;++h)u[f++]=e.charCodeAt(h);u[f]=0;c+=e.length+1});return 0},H:(a,b)=>{var c=$b();z[a>>2]=c.length;var e=0;c.forEach(f=>e+=f.length+1);z[b>>2]=e;return 0},f:function(a){try{var b=R(a);if(null===b.Yf)throw new K(8);b.qg&&(b.qg=null);try{b.Of.close&&b.Of.close(b)}catch(c){throw c;
}finally{kb[b.Yf]=null}b.Yf=null;return 0}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;return c.Qf}},v:function(a,b){try{var c=R(a);u[b]=c.Uf?2:O(c.mode)?3:40960===(c.mode&61440)?7:4;w[b+2>>1]=0;D=[0,(C=0,1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];x[b+8>>2]=D[0];x[b+12>>2]=D[1];D=[0,(C=0,1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];x[b+16>>2]=D[0];x[b+20>>2]=D[1];return 0}catch(e){if("undefined"==
typeof U||"ErrnoError"!==e.name)throw e;return e.Qf}},C:function(a,b,c,e){try{a:{var f=R(a);a=b;for(var h,k=b=0;k<c;k++){var n=z[a>>2],l=z[a+4>>2];a+=8;var m=f,p=h,q=u;if(0>l||0>p)throw new K(28);if(null===m.Yf)throw new K(8);if(1===(m.flags&2097155))throw new K(8);if(O(m.node.mode))throw new K(31);if(!m.Of.read)throw new K(28);var t="undefined"!=typeof p;if(!t)p=m.position;else if(!m.seekable)throw new K(70);var y=m.Of.read(m,q,n,l,p);t||(m.position+=y);var A=y;if(0>A){var G=-1;break a}b+=A;if(A<
l)break;"undefined"!=typeof h&&(h+=A)}G=b}z[e>>2]=G;return 0}catch(E){if("undefined"==typeof U||"ErrnoError"!==E.name)throw E;return E.Qf}},l:function(a,b,c,e,f){b=Qb(b,c);try{if(isNaN(b))return 61;var h=R(a);Lb(h,b,e);D=[h.position>>>0,(C=h.position,1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];x[f>>2]=D[0];x[f+4>>2]=D[1];h.qg&&0===b&&0===e&&(h.qg=null);return 0}catch(k){if("undefined"==typeof U||"ErrnoError"!==k.name)throw k;return k.Qf}},K:function(a){try{var b=
R(a);return $c(c=>{var e=b.node.Wf;e.type.Qg?e.type.Qg(e,!1,f=>{f?c(29):c(0)}):c(0)})}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;return c.Qf}},y:function(a,b,c,e){try{a:{var f=R(a);a=b;for(var h,k=b=0;k<c;k++){var n=z[a>>2],l=z[a+4>>2];a+=8;var m=f,p=n,q=l,t=h,y=u;if(0>q||0>t)throw new K(28);if(null===m.Yf)throw new K(8);if(0===(m.flags&2097155))throw new K(8);if(O(m.node.mode))throw new K(31);if(!m.Of.write)throw new K(28);m.seekable&&m.flags&1024&&Lb(m,0,2);var A="undefined"!=
typeof t;if(!A)t=m.position;else if(!m.seekable)throw new K(70);var G=m.Of.write(m,y,p,q,t,void 0);A||(m.position+=G);var E=G;if(0>E){var N=-1;break a}b+=E;if(E<l)break;"undefined"!=typeof h&&(h+=E)}N=b}z[e>>2]=N;return 0}catch(L){if("undefined"==typeof U||"ErrnoError"!==L.name)throw L;return L.Qf}},wa:ac,T:bc,la:cc,ha:dc,ba:ec,qa:fc,L:gc,h:hc,ta:ic,oa:jc,ja:kc,ka:lc,p:mc,A:nc,ua:oc,g:pc,va:qc,ia:rc,ma:sc,na:tc,sa:uc,c:vc,pa:wc,ra:xc,r:Wb,I:function(a,b){try{return Ra(v.subarray(a,a+b)),0}catch(c){if("undefined"==
typeof U||"ErrnoError"!==c.name)throw c;return c.Qf}},fa:yc,_:zc,ea:Ac,ga:Bc,X:Cc,Z:Dc,ca:Ec,aa:Fc,W:Gc,q:Hc,Y:Ic,da:Jc,n:Kc,$:Lc,o:Mc},V=function(){function a(c){V=c.exports;V=Oc();na=V.xa;ta();gd=V.Cf;va.unshift(V.ya);za--;d.monitorRunDependencies?.(za);0==za&&(null!==Aa&&(clearInterval(Aa),Aa=null),Ba&&(c=Ba,Ba=null,c()));return V}var b={a:pd};za++;d.monitorRunDependencies?.(za);if(d.instantiateWasm)try{return d.instantiateWasm(b,a)}catch(c){r(`Module.instantiateWasm callback failed with error: ${c}`),
ba(c)}Da??=d.locateFile?Ca("wa-sqlite-async.wasm")?"wa-sqlite-async.wasm":d.locateFile?d.locateFile("wa-sqlite-async.wasm",g):g+"wa-sqlite-async.wasm":(new URL("wa-sqlite-async.wasm",import.meta.url)).href;Ha(b,function(c){a(c.instance)}).catch(ba);return{}}();d._sqlite3_status64=(a,b,c,e)=>(d._sqlite3_status64=V.za)(a,b,c,e);d._sqlite3_status=(a,b,c,e)=>(d._sqlite3_status=V.Aa)(a,b,c,e);d._sqlite3_db_status=(a,b,c,e,f)=>(d._sqlite3_db_status=V.Ba)(a,b,c,e,f);
d._sqlite3_msize=a=>(d._sqlite3_msize=V.Ca)(a);d._sqlite3_vfs_find=a=>(d._sqlite3_vfs_find=V.Da)(a);d._sqlite3_vfs_register=(a,b)=>(d._sqlite3_vfs_register=V.Ea)(a,b);d._sqlite3_vfs_unregister=a=>(d._sqlite3_vfs_unregister=V.Fa)(a);d._sqlite3_release_memory=a=>(d._sqlite3_release_memory=V.Ga)(a);d._sqlite3_soft_heap_limit64=(a,b)=>(d._sqlite3_soft_heap_limit64=V.Ha)(a,b);d._sqlite3_memory_used=()=>(d._sqlite3_memory_used=V.Ia)();
d._sqlite3_hard_heap_limit64=(a,b)=>(d._sqlite3_hard_heap_limit64=V.Ja)(a,b);d._sqlite3_memory_highwater=a=>(d._sqlite3_memory_highwater=V.Ka)(a);d._sqlite3_malloc=a=>(d._sqlite3_malloc=V.La)(a);d._sqlite3_malloc64=(a,b)=>(d._sqlite3_malloc64=V.Ma)(a,b);d._sqlite3_free=a=>(d._sqlite3_free=V.Na)(a);d._sqlite3_realloc=(a,b)=>(d._sqlite3_realloc=V.Oa)(a,b);d._sqlite3_realloc64=(a,b,c)=>(d._sqlite3_realloc64=V.Pa)(a,b,c);d._sqlite3_str_vappendf=(a,b,c)=>(d._sqlite3_str_vappendf=V.Qa)(a,b,c);
d._sqlite3_str_append=(a,b,c)=>(d._sqlite3_str_append=V.Ra)(a,b,c);d._sqlite3_str_appendchar=(a,b,c)=>(d._sqlite3_str_appendchar=V.Sa)(a,b,c);d._sqlite3_str_appendall=(a,b)=>(d._sqlite3_str_appendall=V.Ta)(a,b);d._sqlite3_str_appendf=(a,b,c)=>(d._sqlite3_str_appendf=V.Ua)(a,b,c);d._sqlite3_str_finish=a=>(d._sqlite3_str_finish=V.Va)(a);d._sqlite3_str_errcode=a=>(d._sqlite3_str_errcode=V.Wa)(a);d._sqlite3_str_length=a=>(d._sqlite3_str_length=V.Xa)(a);d._sqlite3_str_value=a=>(d._sqlite3_str_value=V.Ya)(a);
d._sqlite3_str_reset=a=>(d._sqlite3_str_reset=V.Za)(a);d._sqlite3_str_new=a=>(d._sqlite3_str_new=V._a)(a);d._sqlite3_vmprintf=(a,b)=>(d._sqlite3_vmprintf=V.$a)(a,b);d._sqlite3_mprintf=(a,b)=>(d._sqlite3_mprintf=V.ab)(a,b);d._sqlite3_vsnprintf=(a,b,c,e)=>(d._sqlite3_vsnprintf=V.bb)(a,b,c,e);d._sqlite3_snprintf=(a,b,c,e)=>(d._sqlite3_snprintf=V.cb)(a,b,c,e);d._sqlite3_log=(a,b,c)=>(d._sqlite3_log=V.db)(a,b,c);d._sqlite3_randomness=(a,b)=>(d._sqlite3_randomness=V.eb)(a,b);
d._sqlite3_stricmp=(a,b)=>(d._sqlite3_stricmp=V.fb)(a,b);d._sqlite3_strnicmp=(a,b,c)=>(d._sqlite3_strnicmp=V.gb)(a,b,c);d._sqlite3_os_init=()=>(d._sqlite3_os_init=V.hb)();d._sqlite3_os_end=()=>(d._sqlite3_os_end=V.ib)();d._sqlite3_serialize=(a,b,c,e)=>(d._sqlite3_serialize=V.jb)(a,b,c,e);d._sqlite3_prepare_v2=(a,b,c,e,f)=>(d._sqlite3_prepare_v2=V.kb)(a,b,c,e,f);d._sqlite3_step=a=>(d._sqlite3_step=V.lb)(a);d._sqlite3_column_int64=(a,b)=>(d._sqlite3_column_int64=V.mb)(a,b);
d._sqlite3_reset=a=>(d._sqlite3_reset=V.nb)(a);d._sqlite3_exec=(a,b,c,e,f)=>(d._sqlite3_exec=V.ob)(a,b,c,e,f);d._sqlite3_column_int=(a,b)=>(d._sqlite3_column_int=V.pb)(a,b);d._sqlite3_finalize=a=>(d._sqlite3_finalize=V.qb)(a);d._sqlite3_deserialize=(a,b,c,e,f,h,k,n)=>(d._sqlite3_deserialize=V.rb)(a,b,c,e,f,h,k,n);d._sqlite3_database_file_object=a=>(d._sqlite3_database_file_object=V.sb)(a);d._sqlite3_backup_init=(a,b,c,e)=>(d._sqlite3_backup_init=V.tb)(a,b,c,e);
d._sqlite3_backup_step=(a,b)=>(d._sqlite3_backup_step=V.ub)(a,b);d._sqlite3_backup_finish=a=>(d._sqlite3_backup_finish=V.vb)(a);d._sqlite3_backup_remaining=a=>(d._sqlite3_backup_remaining=V.wb)(a);d._sqlite3_backup_pagecount=a=>(d._sqlite3_backup_pagecount=V.xb)(a);d._sqlite3_clear_bindings=a=>(d._sqlite3_clear_bindings=V.yb)(a);d._sqlite3_value_blob=a=>(d._sqlite3_value_blob=V.zb)(a);d._sqlite3_value_text=a=>(d._sqlite3_value_text=V.Ab)(a);d._sqlite3_value_bytes=a=>(d._sqlite3_value_bytes=V.Bb)(a);
d._sqlite3_value_bytes16=a=>(d._sqlite3_value_bytes16=V.Cb)(a);d._sqlite3_value_double=a=>(d._sqlite3_value_double=V.Db)(a);d._sqlite3_value_int=a=>(d._sqlite3_value_int=V.Eb)(a);d._sqlite3_value_int64=a=>(d._sqlite3_value_int64=V.Fb)(a);d._sqlite3_value_subtype=a=>(d._sqlite3_value_subtype=V.Gb)(a);d._sqlite3_value_pointer=(a,b)=>(d._sqlite3_value_pointer=V.Hb)(a,b);d._sqlite3_value_text16=a=>(d._sqlite3_value_text16=V.Ib)(a);d._sqlite3_value_text16be=a=>(d._sqlite3_value_text16be=V.Jb)(a);
d._sqlite3_value_text16le=a=>(d._sqlite3_value_text16le=V.Kb)(a);d._sqlite3_value_type=a=>(d._sqlite3_value_type=V.Lb)(a);d._sqlite3_value_encoding=a=>(d._sqlite3_value_encoding=V.Mb)(a);d._sqlite3_value_nochange=a=>(d._sqlite3_value_nochange=V.Nb)(a);d._sqlite3_value_frombind=a=>(d._sqlite3_value_frombind=V.Ob)(a);d._sqlite3_value_dup=a=>(d._sqlite3_value_dup=V.Pb)(a);d._sqlite3_value_free=a=>(d._sqlite3_value_free=V.Qb)(a);d._sqlite3_result_blob=(a,b,c,e)=>(d._sqlite3_result_blob=V.Rb)(a,b,c,e);
d._sqlite3_result_blob64=(a,b,c,e,f)=>(d._sqlite3_result_blob64=V.Sb)(a,b,c,e,f);d._sqlite3_result_double=(a,b)=>(d._sqlite3_result_double=V.Tb)(a,b);d._sqlite3_result_error=(a,b,c)=>(d._sqlite3_result_error=V.Ub)(a,b,c);d._sqlite3_result_error16=(a,b,c)=>(d._sqlite3_result_error16=V.Vb)(a,b,c);d._sqlite3_result_int=(a,b)=>(d._sqlite3_result_int=V.Wb)(a,b);d._sqlite3_result_int64=(a,b,c)=>(d._sqlite3_result_int64=V.Xb)(a,b,c);d._sqlite3_result_null=a=>(d._sqlite3_result_null=V.Yb)(a);
d._sqlite3_result_pointer=(a,b,c,e)=>(d._sqlite3_result_pointer=V.Zb)(a,b,c,e);d._sqlite3_result_subtype=(a,b)=>(d._sqlite3_result_subtype=V._b)(a,b);d._sqlite3_result_text=(a,b,c,e)=>(d._sqlite3_result_text=V.$b)(a,b,c,e);d._sqlite3_result_text64=(a,b,c,e,f,h)=>(d._sqlite3_result_text64=V.ac)(a,b,c,e,f,h);d._sqlite3_result_text16=(a,b,c,e)=>(d._sqlite3_result_text16=V.bc)(a,b,c,e);d._sqlite3_result_text16be=(a,b,c,e)=>(d._sqlite3_result_text16be=V.cc)(a,b,c,e);
d._sqlite3_result_text16le=(a,b,c,e)=>(d._sqlite3_result_text16le=V.dc)(a,b,c,e);d._sqlite3_result_value=(a,b)=>(d._sqlite3_result_value=V.ec)(a,b);d._sqlite3_result_error_toobig=a=>(d._sqlite3_result_error_toobig=V.fc)(a);d._sqlite3_result_zeroblob=(a,b)=>(d._sqlite3_result_zeroblob=V.gc)(a,b);d._sqlite3_result_zeroblob64=(a,b,c)=>(d._sqlite3_result_zeroblob64=V.hc)(a,b,c);d._sqlite3_result_error_code=(a,b)=>(d._sqlite3_result_error_code=V.ic)(a,b);
d._sqlite3_result_error_nomem=a=>(d._sqlite3_result_error_nomem=V.jc)(a);d._sqlite3_user_data=a=>(d._sqlite3_user_data=V.kc)(a);d._sqlite3_context_db_handle=a=>(d._sqlite3_context_db_handle=V.lc)(a);d._sqlite3_vtab_nochange=a=>(d._sqlite3_vtab_nochange=V.mc)(a);d._sqlite3_vtab_in_first=(a,b)=>(d._sqlite3_vtab_in_first=V.nc)(a,b);d._sqlite3_vtab_in_next=(a,b)=>(d._sqlite3_vtab_in_next=V.oc)(a,b);d._sqlite3_aggregate_context=(a,b)=>(d._sqlite3_aggregate_context=V.pc)(a,b);
d._sqlite3_get_auxdata=(a,b)=>(d._sqlite3_get_auxdata=V.qc)(a,b);d._sqlite3_set_auxdata=(a,b,c,e)=>(d._sqlite3_set_auxdata=V.rc)(a,b,c,e);d._sqlite3_column_count=a=>(d._sqlite3_column_count=V.sc)(a);d._sqlite3_data_count=a=>(d._sqlite3_data_count=V.tc)(a);d._sqlite3_column_blob=(a,b)=>(d._sqlite3_column_blob=V.uc)(a,b);d._sqlite3_column_bytes=(a,b)=>(d._sqlite3_column_bytes=V.vc)(a,b);d._sqlite3_column_bytes16=(a,b)=>(d._sqlite3_column_bytes16=V.wc)(a,b);
d._sqlite3_column_double=(a,b)=>(d._sqlite3_column_double=V.xc)(a,b);d._sqlite3_column_text=(a,b)=>(d._sqlite3_column_text=V.yc)(a,b);d._sqlite3_column_value=(a,b)=>(d._sqlite3_column_value=V.zc)(a,b);d._sqlite3_column_text16=(a,b)=>(d._sqlite3_column_text16=V.Ac)(a,b);d._sqlite3_column_type=(a,b)=>(d._sqlite3_column_type=V.Bc)(a,b);d._sqlite3_column_name=(a,b)=>(d._sqlite3_column_name=V.Cc)(a,b);d._sqlite3_column_name16=(a,b)=>(d._sqlite3_column_name16=V.Dc)(a,b);
d._sqlite3_bind_blob=(a,b,c,e,f)=>(d._sqlite3_bind_blob=V.Ec)(a,b,c,e,f);d._sqlite3_bind_blob64=(a,b,c,e,f,h)=>(d._sqlite3_bind_blob64=V.Fc)(a,b,c,e,f,h);d._sqlite3_bind_double=(a,b,c)=>(d._sqlite3_bind_double=V.Gc)(a,b,c);d._sqlite3_bind_int=(a,b,c)=>(d._sqlite3_bind_int=V.Hc)(a,b,c);d._sqlite3_bind_int64=(a,b,c,e)=>(d._sqlite3_bind_int64=V.Ic)(a,b,c,e);d._sqlite3_bind_null=(a,b)=>(d._sqlite3_bind_null=V.Jc)(a,b);d._sqlite3_bind_pointer=(a,b,c,e,f)=>(d._sqlite3_bind_pointer=V.Kc)(a,b,c,e,f);
d._sqlite3_bind_text=(a,b,c,e,f)=>(d._sqlite3_bind_text=V.Lc)(a,b,c,e,f);d._sqlite3_bind_text64=(a,b,c,e,f,h,k)=>(d._sqlite3_bind_text64=V.Mc)(a,b,c,e,f,h,k);d._sqlite3_bind_text16=(a,b,c,e,f)=>(d._sqlite3_bind_text16=V.Nc)(a,b,c,e,f);d._sqlite3_bind_value=(a,b,c)=>(d._sqlite3_bind_value=V.Oc)(a,b,c);d._sqlite3_bind_zeroblob=(a,b,c)=>(d._sqlite3_bind_zeroblob=V.Pc)(a,b,c);d._sqlite3_bind_zeroblob64=(a,b,c,e)=>(d._sqlite3_bind_zeroblob64=V.Qc)(a,b,c,e);
d._sqlite3_bind_parameter_count=a=>(d._sqlite3_bind_parameter_count=V.Rc)(a);d._sqlite3_bind_parameter_name=(a,b)=>(d._sqlite3_bind_parameter_name=V.Sc)(a,b);d._sqlite3_bind_parameter_index=(a,b)=>(d._sqlite3_bind_parameter_index=V.Tc)(a,b);d._sqlite3_db_handle=a=>(d._sqlite3_db_handle=V.Uc)(a);d._sqlite3_stmt_readonly=a=>(d._sqlite3_stmt_readonly=V.Vc)(a);d._sqlite3_stmt_isexplain=a=>(d._sqlite3_stmt_isexplain=V.Wc)(a);d._sqlite3_stmt_explain=(a,b)=>(d._sqlite3_stmt_explain=V.Xc)(a,b);
d._sqlite3_stmt_busy=a=>(d._sqlite3_stmt_busy=V.Yc)(a);d._sqlite3_next_stmt=(a,b)=>(d._sqlite3_next_stmt=V.Zc)(a,b);d._sqlite3_stmt_status=(a,b,c)=>(d._sqlite3_stmt_status=V._c)(a,b,c);d._sqlite3_sql=a=>(d._sqlite3_sql=V.$c)(a);d._sqlite3_expanded_sql=a=>(d._sqlite3_expanded_sql=V.ad)(a);d._sqlite3_value_numeric_type=a=>(d._sqlite3_value_numeric_type=V.bd)(a);d._sqlite3_blob_open=(a,b,c,e,f,h,k,n)=>(d._sqlite3_blob_open=V.cd)(a,b,c,e,f,h,k,n);d._sqlite3_blob_close=a=>(d._sqlite3_blob_close=V.dd)(a);
d._sqlite3_blob_read=(a,b,c,e)=>(d._sqlite3_blob_read=V.ed)(a,b,c,e);d._sqlite3_blob_write=(a,b,c,e)=>(d._sqlite3_blob_write=V.fd)(a,b,c,e);d._sqlite3_blob_bytes=a=>(d._sqlite3_blob_bytes=V.gd)(a);d._sqlite3_blob_reopen=(a,b,c)=>(d._sqlite3_blob_reopen=V.hd)(a,b,c);d._sqlite3_set_authorizer=(a,b,c)=>(d._sqlite3_set_authorizer=V.id)(a,b,c);d._sqlite3_strglob=(a,b)=>(d._sqlite3_strglob=V.jd)(a,b);d._sqlite3_strlike=(a,b,c)=>(d._sqlite3_strlike=V.kd)(a,b,c);d._sqlite3_errmsg=a=>(d._sqlite3_errmsg=V.ld)(a);
d._sqlite3_auto_extension=a=>(d._sqlite3_auto_extension=V.md)(a);d._sqlite3_cancel_auto_extension=a=>(d._sqlite3_cancel_auto_extension=V.nd)(a);d._sqlite3_reset_auto_extension=()=>(d._sqlite3_reset_auto_extension=V.od)();d._sqlite3_prepare=(a,b,c,e,f)=>(d._sqlite3_prepare=V.pd)(a,b,c,e,f);d._sqlite3_prepare_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare_v3=V.qd)(a,b,c,e,f,h);d._sqlite3_prepare16=(a,b,c,e,f)=>(d._sqlite3_prepare16=V.rd)(a,b,c,e,f);
d._sqlite3_prepare16_v2=(a,b,c,e,f)=>(d._sqlite3_prepare16_v2=V.sd)(a,b,c,e,f);d._sqlite3_prepare16_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare16_v3=V.td)(a,b,c,e,f,h);d._sqlite3_get_table=(a,b,c,e,f,h)=>(d._sqlite3_get_table=V.ud)(a,b,c,e,f,h);d._sqlite3_free_table=a=>(d._sqlite3_free_table=V.vd)(a);d._sqlite3_create_module=(a,b,c,e)=>(d._sqlite3_create_module=V.wd)(a,b,c,e);d._sqlite3_create_module_v2=(a,b,c,e,f)=>(d._sqlite3_create_module_v2=V.xd)(a,b,c,e,f);
d._sqlite3_drop_modules=(a,b)=>(d._sqlite3_drop_modules=V.yd)(a,b);d._sqlite3_declare_vtab=(a,b)=>(d._sqlite3_declare_vtab=V.zd)(a,b);d._sqlite3_vtab_on_conflict=a=>(d._sqlite3_vtab_on_conflict=V.Ad)(a);d._sqlite3_vtab_config=(a,b,c)=>(d._sqlite3_vtab_config=V.Bd)(a,b,c);d._sqlite3_vtab_collation=(a,b)=>(d._sqlite3_vtab_collation=V.Cd)(a,b);d._sqlite3_vtab_in=(a,b,c)=>(d._sqlite3_vtab_in=V.Dd)(a,b,c);d._sqlite3_vtab_rhs_value=(a,b,c)=>(d._sqlite3_vtab_rhs_value=V.Ed)(a,b,c);
d._sqlite3_vtab_distinct=a=>(d._sqlite3_vtab_distinct=V.Fd)(a);d._sqlite3_keyword_name=(a,b,c)=>(d._sqlite3_keyword_name=V.Gd)(a,b,c);d._sqlite3_keyword_count=()=>(d._sqlite3_keyword_count=V.Hd)();d._sqlite3_keyword_check=(a,b)=>(d._sqlite3_keyword_check=V.Id)(a,b);d._sqlite3_complete=a=>(d._sqlite3_complete=V.Jd)(a);d._sqlite3_complete16=a=>(d._sqlite3_complete16=V.Kd)(a);d._sqlite3_libversion=()=>(d._sqlite3_libversion=V.Ld)();d._sqlite3_libversion_number=()=>(d._sqlite3_libversion_number=V.Md)();
d._sqlite3_threadsafe=()=>(d._sqlite3_threadsafe=V.Nd)();d._sqlite3_initialize=()=>(d._sqlite3_initialize=V.Od)();d._sqlite3_shutdown=()=>(d._sqlite3_shutdown=V.Pd)();d._sqlite3_config=(a,b)=>(d._sqlite3_config=V.Qd)(a,b);d._sqlite3_db_mutex=a=>(d._sqlite3_db_mutex=V.Rd)(a);d._sqlite3_db_release_memory=a=>(d._sqlite3_db_release_memory=V.Sd)(a);d._sqlite3_db_cacheflush=a=>(d._sqlite3_db_cacheflush=V.Td)(a);d._sqlite3_db_config=(a,b,c)=>(d._sqlite3_db_config=V.Ud)(a,b,c);
d._sqlite3_last_insert_rowid=a=>(d._sqlite3_last_insert_rowid=V.Vd)(a);d._sqlite3_set_last_insert_rowid=(a,b,c)=>(d._sqlite3_set_last_insert_rowid=V.Wd)(a,b,c);d._sqlite3_changes64=a=>(d._sqlite3_changes64=V.Xd)(a);d._sqlite3_changes=a=>(d._sqlite3_changes=V.Yd)(a);d._sqlite3_total_changes64=a=>(d._sqlite3_total_changes64=V.Zd)(a);d._sqlite3_total_changes=a=>(d._sqlite3_total_changes=V._d)(a);d._sqlite3_txn_state=(a,b)=>(d._sqlite3_txn_state=V.$d)(a,b);d._sqlite3_close=a=>(d._sqlite3_close=V.ae)(a);
d._sqlite3_close_v2=a=>(d._sqlite3_close_v2=V.be)(a);d._sqlite3_busy_handler=(a,b,c)=>(d._sqlite3_busy_handler=V.ce)(a,b,c);d._sqlite3_progress_handler=(a,b,c,e)=>(d._sqlite3_progress_handler=V.de)(a,b,c,e);d._sqlite3_busy_timeout=(a,b)=>(d._sqlite3_busy_timeout=V.ee)(a,b);d._sqlite3_interrupt=a=>(d._sqlite3_interrupt=V.fe)(a);d._sqlite3_is_interrupted=a=>(d._sqlite3_is_interrupted=V.ge)(a);d._sqlite3_create_function=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function=V.he)(a,b,c,e,f,h,k,n);
d._sqlite3_create_function_v2=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_create_function_v2=V.ie)(a,b,c,e,f,h,k,n,l);d._sqlite3_create_window_function=(a,b,c,e,f,h,k,n,l,m)=>(d._sqlite3_create_window_function=V.je)(a,b,c,e,f,h,k,n,l,m);d._sqlite3_create_function16=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function16=V.ke)(a,b,c,e,f,h,k,n);d._sqlite3_overload_function=(a,b,c)=>(d._sqlite3_overload_function=V.le)(a,b,c);d._sqlite3_trace_v2=(a,b,c,e)=>(d._sqlite3_trace_v2=V.me)(a,b,c,e);
d._sqlite3_commit_hook=(a,b,c)=>(d._sqlite3_commit_hook=V.ne)(a,b,c);d._sqlite3_update_hook=(a,b,c)=>(d._sqlite3_update_hook=V.oe)(a,b,c);d._sqlite3_rollback_hook=(a,b,c)=>(d._sqlite3_rollback_hook=V.pe)(a,b,c);d._sqlite3_autovacuum_pages=(a,b,c,e)=>(d._sqlite3_autovacuum_pages=V.qe)(a,b,c,e);d._sqlite3_wal_autocheckpoint=(a,b)=>(d._sqlite3_wal_autocheckpoint=V.re)(a,b);d._sqlite3_wal_hook=(a,b,c)=>(d._sqlite3_wal_hook=V.se)(a,b,c);
d._sqlite3_wal_checkpoint_v2=(a,b,c,e,f)=>(d._sqlite3_wal_checkpoint_v2=V.te)(a,b,c,e,f);d._sqlite3_wal_checkpoint=(a,b)=>(d._sqlite3_wal_checkpoint=V.ue)(a,b);d._sqlite3_error_offset=a=>(d._sqlite3_error_offset=V.ve)(a);d._sqlite3_errmsg16=a=>(d._sqlite3_errmsg16=V.we)(a);d._sqlite3_errcode=a=>(d._sqlite3_errcode=V.xe)(a);d._sqlite3_extended_errcode=a=>(d._sqlite3_extended_errcode=V.ye)(a);d._sqlite3_system_errno=a=>(d._sqlite3_system_errno=V.ze)(a);d._sqlite3_errstr=a=>(d._sqlite3_errstr=V.Ae)(a);
d._sqlite3_limit=(a,b,c)=>(d._sqlite3_limit=V.Be)(a,b,c);d._sqlite3_open=(a,b)=>(d._sqlite3_open=V.Ce)(a,b);d._sqlite3_open_v2=(a,b,c,e)=>(d._sqlite3_open_v2=V.De)(a,b,c,e);d._sqlite3_open16=(a,b)=>(d._sqlite3_open16=V.Ee)(a,b);d._sqlite3_create_collation=(a,b,c,e,f)=>(d._sqlite3_create_collation=V.Fe)(a,b,c,e,f);d._sqlite3_create_collation_v2=(a,b,c,e,f,h)=>(d._sqlite3_create_collation_v2=V.Ge)(a,b,c,e,f,h);d._sqlite3_create_collation16=(a,b,c,e,f)=>(d._sqlite3_create_collation16=V.He)(a,b,c,e,f);
d._sqlite3_collation_needed=(a,b,c)=>(d._sqlite3_collation_needed=V.Ie)(a,b,c);d._sqlite3_collation_needed16=(a,b,c)=>(d._sqlite3_collation_needed16=V.Je)(a,b,c);d._sqlite3_get_clientdata=(a,b)=>(d._sqlite3_get_clientdata=V.Ke)(a,b);d._sqlite3_set_clientdata=(a,b,c,e)=>(d._sqlite3_set_clientdata=V.Le)(a,b,c,e);d._sqlite3_get_autocommit=a=>(d._sqlite3_get_autocommit=V.Me)(a);d._sqlite3_table_column_metadata=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_table_column_metadata=V.Ne)(a,b,c,e,f,h,k,n,l);
d._sqlite3_sleep=a=>(d._sqlite3_sleep=V.Oe)(a);d._sqlite3_extended_result_codes=(a,b)=>(d._sqlite3_extended_result_codes=V.Pe)(a,b);d._sqlite3_file_control=(a,b,c,e)=>(d._sqlite3_file_control=V.Qe)(a,b,c,e);d._sqlite3_test_control=(a,b)=>(d._sqlite3_test_control=V.Re)(a,b);d._sqlite3_create_filename=(a,b,c,e,f)=>(d._sqlite3_create_filename=V.Se)(a,b,c,e,f);d._sqlite3_free_filename=a=>(d._sqlite3_free_filename=V.Te)(a);d._sqlite3_uri_parameter=(a,b)=>(d._sqlite3_uri_parameter=V.Ue)(a,b);
d._sqlite3_uri_key=(a,b)=>(d._sqlite3_uri_key=V.Ve)(a,b);d._sqlite3_uri_boolean=(a,b,c)=>(d._sqlite3_uri_boolean=V.We)(a,b,c);d._sqlite3_uri_int64=(a,b,c,e)=>(d._sqlite3_uri_int64=V.Xe)(a,b,c,e);d._sqlite3_filename_database=a=>(d._sqlite3_filename_database=V.Ye)(a);d._sqlite3_filename_journal=a=>(d._sqlite3_filename_journal=V.Ze)(a);d._sqlite3_filename_wal=a=>(d._sqlite3_filename_wal=V._e)(a);d._sqlite3_db_name=(a,b)=>(d._sqlite3_db_name=V.$e)(a,b);
d._sqlite3_db_filename=(a,b)=>(d._sqlite3_db_filename=V.af)(a,b);d._sqlite3_db_readonly=(a,b)=>(d._sqlite3_db_readonly=V.bf)(a,b);d._sqlite3_compileoption_used=a=>(d._sqlite3_compileoption_used=V.cf)(a);d._sqlite3_compileoption_get=a=>(d._sqlite3_compileoption_get=V.df)(a);d._sqlite3_sourceid=()=>(d._sqlite3_sourceid=V.ef)();d._sqlite3mc_config=(a,b,c)=>(d._sqlite3mc_config=V.ff)(a,b,c);d._sqlite3mc_cipher_count=()=>(d._sqlite3mc_cipher_count=V.gf)();
d._sqlite3mc_cipher_index=a=>(d._sqlite3mc_cipher_index=V.hf)(a);d._sqlite3mc_cipher_name=a=>(d._sqlite3mc_cipher_name=V.jf)(a);d._sqlite3mc_config_cipher=(a,b,c,e)=>(d._sqlite3mc_config_cipher=V.kf)(a,b,c,e);d._sqlite3mc_codec_data=(a,b,c)=>(d._sqlite3mc_codec_data=V.lf)(a,b,c);d._sqlite3_key=(a,b,c)=>(d._sqlite3_key=V.mf)(a,b,c);d._sqlite3_key_v2=(a,b,c,e)=>(d._sqlite3_key_v2=V.nf)(a,b,c,e);d._sqlite3_rekey_v2=(a,b,c,e)=>(d._sqlite3_rekey_v2=V.of)(a,b,c,e);
d._sqlite3_rekey=(a,b,c)=>(d._sqlite3_rekey=V.pf)(a,b,c);d._sqlite3mc_register_cipher=(a,b,c)=>(d._sqlite3mc_register_cipher=V.qf)(a,b,c);var Zc=d._malloc=a=>(Zc=d._malloc=V.rf)(a),dd=d._free=a=>(dd=d._free=V.sf)(a);d._RegisterExtensionFunctions=a=>(d._RegisterExtensionFunctions=V.tf)(a);d._sqlite3Fts5BetterTrigramInit=a=>(d._sqlite3Fts5BetterTrigramInit=V.uf)(a);d._set_authorizer=a=>(d._set_authorizer=V.vf)(a);d._create_function=(a,b,c,e,f,h)=>(d._create_function=V.wf)(a,b,c,e,f,h);
d._create_module=(a,b,c,e)=>(d._create_module=V.xf)(a,b,c,e);d._progress_handler=(a,b)=>(d._progress_handler=V.yf)(a,b);d._register_vfs=(a,b,c,e)=>(d._register_vfs=V.zf)(a,b,c,e);d._getSqliteFree=()=>(d._getSqliteFree=V.Af)();var qd=d._main=(a,b)=>(qd=d._main=V.Bf)(a,b),gb=(a,b)=>(gb=V.Df)(a,b),od=(a,b)=>(od=V.Ef)(a,b),rd=()=>(rd=V.Ff)(),kd=a=>(kd=V.Gf)(a),ld=a=>(ld=V.Hf)(a),md=()=>(md=V.If)(),bd=a=>(bd=V.Jf)(a),Qc=()=>(Qc=V.Kf)(),ad=a=>(ad=V.Lf)(a),cd=()=>(cd=V.Mf)();d._sqlite3_version=5472;
d.getTempRet0=()=>rd();d.ccall=Z;d.cwrap=(a,b,c,e)=>{var f=!c||c.every(h=>"number"===h||"boolean"===h);return"string"!==b&&f&&!e?d["_"+a]:(...h)=>Z(a,b,c,h,e)};
d.addFunction=(a,b)=>{if(!hd){hd=new WeakMap;var c=gd.length;if(hd)for(var e=0;e<0+c;e++){var f=gd.get(e);f&&hd.set(f,e)}}if(c=hd.get(a)||0)return c;if(jd.length)c=jd.pop();else{try{gd.grow(1)}catch(n){if(!(n instanceof RangeError))throw n;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}c=gd.length-1}try{gd.set(c,a)}catch(n){if(!(n instanceof TypeError))throw n;if("function"==typeof WebAssembly.Function){e=WebAssembly.Function;f={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"};for(var h=
{parameters:[],results:"v"==b[0]?[]:[f[b[0]]]},k=1;k<b.length;++k)h.parameters.push(f[b[k]]);b=new e(h,a)}else{e=[1];f=b.slice(0,1);b=b.slice(1);h={i:127,p:127,j:126,f:125,d:124,e:111};e.push(96);k=b.length;128>k?e.push(k):e.push(k%128|128,k>>7);for(k=0;k<b.length;++k)e.push(h[b[k]]);"v"==f?e.push(0):e.push(1,h[f]);b=[0,97,115,109,1,0,0,0,1];f=e.length;128>f?b.push(f):b.push(f%128|128,f>>7);b.push(...e);b.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);b=new WebAssembly.Module(new Uint8Array(b));b=(new WebAssembly.Instance(b,
{e:{f:a}})).exports.f}gd.set(c,b)}hd.set(a,c);return c};d.setValue=H;d.getValue=F;d.UTF8ToString=(a,b)=>a?I(v,a,b):"";d.stringToUTF8=(a,b,c)=>J(a,v,b,c);d.lengthBytesUTF8=Ua;d.intArrayFromString=Va;d.intArrayToString=function(a){for(var b=[],c=0;c<a.length;c++){var e=a[c];255<e&&(e&=255);b.push(String.fromCharCode(e))}return b.join("")};d.AsciiToString=a=>{for(var b="";;){var c=v[a++];if(!c)return b;b+=String.fromCharCode(c)}};
d.UTF16ToString=(a,b)=>{var c=a>>1;for(var e=c+b/2;!(c>=e)&&qa[c];)++c;c<<=1;if(32<c-a&&nd)return nd.decode(v.subarray(a,c));c="";for(e=0;!(e>=b/2);++e){var f=w[a+2*e>>1];if(0==f)break;c+=String.fromCharCode(f)}return c};d.stringToUTF16=(a,b,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)w[b>>1]=a.charCodeAt(f),b+=2;w[b>>1]=0;return b-e};
d.UTF32ToString=(a,b)=>{for(var c=0,e="";!(c>=b/4);){var f=x[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e};d.stringToUTF32=(a,b,c)=>{c??=2147483647;if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var h=a.charCodeAt(f);if(55296<=h&&57343>=h){var k=a.charCodeAt(++f);h=65536+((h&1023)<<10)|k&1023}x[b>>2]=h;b+=4;if(b+4>c)break}x[b>>2]=0;return b-e};d.writeArrayToMemory=(a,b)=>{u.set(a,b)};var sd;
Ba=function td(){sd||ud();sd||(Ba=td)};
function ud(){function a(){if(!sd&&(sd=!0,d.calledRun=!0,!oa)){if(!d.noFSInit&&!mb){var b,c;mb=!0;e??=d.stdin;b??=d.stdout;c??=d.stderr;e?T("stdin",e):Eb("/dev/tty","/dev/stdin");b?T("stdout",null,b):Eb("/dev/tty","/dev/stdout");c?T("stderr",null,c):Eb("/dev/tty1","/dev/stderr");Kb("/dev/stdin",0);Kb("/dev/stdout",1);Kb("/dev/stderr",1)}nb=!1;Ja(va);Ja(wa);aa(d);d.onRuntimeInitialized?.();if(vd){var e=qd;try{var f=e(0,0);pa=f;Wb(f)}catch(h){Vb(h)}}if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=
[d.postRun]);d.postRun.length;)f=d.postRun.shift(),xa.unshift(f);Ja(xa)}}if(!(0<za)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)ya();Ja(ua);0<za||(d.setStatus?(d.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>d.setStatus(""),1);a()},1)):a())}}if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();var vd=!0;d.noInitialRun&&(vd=!1);ud();moduleRtn=ca;
function(config) {
var Module = config || {};
return moduleRtn;
var a;a||(a=typeof Module !== 'undefined' ? Module : {});var aa,ba;a.ready=new Promise(function(b,c){aa=b;ba=c});var ca=Object.assign({},a),da="./this.program",ea=(b,c)=>{throw c;},fa="object"==typeof window,ha="function"==typeof importScripts,m="",ia;
if(fa||ha)ha?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),_scriptDir&&(m=_scriptDir),0!==m.indexOf("blob:")?m=m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):m="",ha&&(ia=b=>{var c=new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)});var ka=a.print||console.log.bind(console),t=a.printErr||console.warn.bind(console);Object.assign(a,ca);ca=null;a.thisProgram&&(da=a.thisProgram);
a.quit&&(ea=a.quit);var la;a.wasmBinary&&(la=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!=typeof WebAssembly&&u("no native wasm support detected");var ma,v=!1,na="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;
function oa(b,c,d){var e=c+d;for(d=c;b[d]&&!(d>=e);)++d;if(16<d-c&&b.buffer&&na)return na.decode(b.subarray(c,d));for(e="";c<d;){var f=b[c++];if(f&128){var g=b[c++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var h=b[c++]&63;f=224==(f&240)?(f&15)<<12|g<<6|h:(f&7)<<18|g<<12|h<<6|b[c++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}function x(b,c){return b?oa(y,b,c):""}
function pa(b,c,d,e){if(!(0<e))return 0;var f=d;e=d+e-1;for(var g=0;g<b.length;++g){var h=b.charCodeAt(g);if(55296<=h&&57343>=h){var n=b.charCodeAt(++g);h=65536+((h&1023)<<10)|n&1023}if(127>=h){if(d>=e)break;c[d++]=h}else{if(2047>=h){if(d+1>=e)break;c[d++]=192|h>>6}else{if(65535>=h){if(d+2>=e)break;c[d++]=224|h>>12}else{if(d+3>=e)break;c[d++]=240|h>>18;c[d++]=128|h>>12&63}c[d++]=128|h>>6&63}c[d++]=128|h&63}}c[d]=0;return d-f}function qa(b,c,d){return pa(b,y,c,d)}
function ra(b){for(var c=0,d=0;d<b.length;++d){var e=b.charCodeAt(d);127>=e?c++:2047>=e?c+=2:55296<=e&&57343>=e?(c+=4,++d):c+=3}return c}var A,y,B,sa,C,E,ta,ua;function va(){var b=ma.buffer;a.HEAP8=A=new Int8Array(b);a.HEAP16=B=new Int16Array(b);a.HEAP32=C=new Int32Array(b);a.HEAPU8=y=new Uint8Array(b);a.HEAPU16=sa=new Uint16Array(b);a.HEAPU32=E=new Uint32Array(b);a.HEAPF32=ta=new Float32Array(b);a.HEAPF64=ua=new Float64Array(b)}var wa,xa=[],ya=[],za=[],Aa=[];
function Ba(){var b=a.preRun.shift();xa.unshift(b)}var Ca=0,Da=null,Ea=null;function u(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";t(b);v=!0;b=new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.");ba(b);throw b;}function Fa(){return F.startsWith("data:application/octet-stream;base64,")}var F;if(a.locateFile){if(F="wa-sqlite-async.wasm",!Fa()){var Ga=F;F=a.locateFile?a.locateFile(Ga,m):m+Ga}}else F=(new URL("wa-sqlite-async.wasm",import.meta.url)).href;
function Ha(){var b=F;try{if(b==F&&la)return new Uint8Array(la);if(ia)return ia(b);throw"both async and sync fetching of the wasm failed";}catch(c){u(c)}}function Ia(){return la||!fa&&!ha||"function"!=typeof fetch?Promise.resolve().then(function(){return Ha()}):fetch(F,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+F+"'";return b.arrayBuffer()}).catch(function(){return Ha()})}var I,K;
function Ja(b){this.name="ExitStatus";this.message="Program terminated with exit("+b+")";this.status=b}function Ka(b){for(;0<b.length;)b.shift()(a)}function L(b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":return A[b>>0];case "i8":return A[b>>0];case "i16":return B[b>>1];case "i32":return C[b>>2];case "i64":return C[b>>2];case "float":return ta[b>>2];case "double":return ua[b>>3];case "*":return E[b>>2];default:u("invalid type for getValue: "+c)}return null}
function M(b,c,d="i8"){d.endsWith("*")&&(d="*");switch(d){case "i1":A[b>>0]=c;break;case "i8":A[b>>0]=c;break;case "i16":B[b>>1]=c;break;case "i32":C[b>>2]=c;break;case "i64":K=[c>>>0,(I=c,1<=+Math.abs(I)?0<I?(Math.min(+Math.floor(I/4294967296),4294967295)|0)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];C[b>>2]=K[0];C[b+4>>2]=K[1];break;case "float":ta[b>>2]=c;break;case "double":ua[b>>3]=c;break;case "*":E[b>>2]=c;break;default:u("invalid type for setValue: "+d)}}
var La=(b,c)=>{for(var d=0,e=b.length-1;0<=e;e--){var f=b[e];"."===f?b.splice(e,1):".."===f?(b.splice(e,1),d++):d&&(b.splice(e,1),d--)}if(c)for(;d;d--)b.unshift("..");return b},N=b=>{var c="/"===b.charAt(0),d="/"===b.substr(-1);(b=La(b.split("/").filter(e=>!!e),!c).join("/"))||c||(b=".");b&&d&&(b+="/");return(c?"/":"")+b},Ma=b=>{var c=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(b).slice(1);b=c[0];c=c[1];if(!b&&!c)return".";c&&(c=c.substr(0,c.length-1));return b+c},Na=b=>{if("/"===
b)return"/";b=N(b);b=b.replace(/\/$/,"");var c=b.lastIndexOf("/");return-1===c?b:b.substr(c+1)};function Oa(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var b=new Uint8Array(1);return()=>{crypto.getRandomValues(b);return b[0]}}return()=>u("randomDevice")}
function Pa(){for(var b="",c=!1,d=arguments.length-1;-1<=d&&!c;d--){c=0<=d?arguments[d]:"/";if("string"!=typeof c)throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";b=c+"/"+b;c="/"===c.charAt(0)}b=La(b.split("/").filter(e=>!!e),!c).join("/");return(c?"/":"")+b||"."}function Qa(b,c,d){d=Array(0<d?d:ra(b)+1);b=pa(b,d,0,d.length);c&&(d.length=b);return d}var Ra=[];function Sa(b,c){Ra[b]={input:[],Rf:[],bg:c};Ta(b,Ua)}
var Ua={open:function(b){var c=Ra[b.node.eg];if(!c)throw new O(43);b.Sf=c;b.seekable=!1},close:function(b){b.Sf.bg.hg(b.Sf)},hg:function(b){b.Sf.bg.hg(b.Sf)},read:function(b,c,d,e){if(!b.Sf||!b.Sf.bg.yg)throw new O(60);for(var f=0,g=0;g<e;g++){try{var h=b.Sf.bg.yg(b.Sf)}catch(n){throw new O(29);}if(void 0===h&&0===f)throw new O(6);if(null===h||void 0===h)break;f++;c[d+g]=h}f&&(b.node.timestamp=Date.now());return f},write:function(b,c,d,e){if(!b.Sf||!b.Sf.bg.rg)throw new O(60);try{for(var f=0;f<e;f++)b.Sf.bg.rg(b.Sf,
c[d+f])}catch(g){throw new O(29);}e&&(b.node.timestamp=Date.now());return f}},Va={yg:function(b){if(!b.input.length){var c=null;"undefined"!=typeof window&&"function"==typeof window.prompt?(c=window.prompt("Input: "),null!==c&&(c+="\n")):"function"==typeof readline&&(c=readline(),null!==c&&(c+="\n"));if(!c)return null;b.input=Qa(c,!0)}return b.input.shift()},rg:function(b,c){null===c||10===c?(ka(oa(b.Rf,0)),b.Rf=[]):0!=c&&b.Rf.push(c)},hg:function(b){b.Rf&&0<b.Rf.length&&(ka(oa(b.Rf,0)),b.Rf=[])}},
Wa={rg:function(b,c){null===c||10===c?(t(oa(b.Rf,0)),b.Rf=[]):0!=c&&b.Rf.push(c)},hg:function(b){b.Rf&&0<b.Rf.length&&(t(oa(b.Rf,0)),b.Rf=[])}},P={Vf:null,Uf:function(){return P.createNode(null,"/",16895,0)},createNode:function(b,c,d,e){if(24576===(d&61440)||4096===(d&61440))throw new O(63);P.Vf||(P.Vf={dir:{node:{Tf:P.Lf.Tf,Qf:P.Lf.Qf,cg:P.Lf.cg,ig:P.Lf.ig,Cg:P.Lf.Cg,ng:P.Lf.ng,lg:P.Lf.lg,Bg:P.Lf.Bg,mg:P.Lf.mg},stream:{Zf:P.Mf.Zf}},file:{node:{Tf:P.Lf.Tf,Qf:P.Lf.Qf},stream:{Zf:P.Mf.Zf,read:P.Mf.read,
write:P.Mf.write,ug:P.Mf.ug,jg:P.Mf.jg,kg:P.Mf.kg}},link:{node:{Tf:P.Lf.Tf,Qf:P.Lf.Qf,fg:P.Lf.fg},stream:{}},vg:{node:{Tf:P.Lf.Tf,Qf:P.Lf.Qf},stream:Xa}});d=Ya(b,c,d,e);16384===(d.mode&61440)?(d.Lf=P.Vf.dir.node,d.Mf=P.Vf.dir.stream,d.Nf={}):32768===(d.mode&61440)?(d.Lf=P.Vf.file.node,d.Mf=P.Vf.file.stream,d.Pf=0,d.Nf=null):40960===(d.mode&61440)?(d.Lf=P.Vf.link.node,d.Mf=P.Vf.link.stream):8192===(d.mode&61440)&&(d.Lf=P.Vf.vg.node,d.Mf=P.Vf.vg.stream);d.timestamp=Date.now();b&&(b.Nf[c]=d,b.timestamp=
d.timestamp);return d},Ug:function(b){return b.Nf?b.Nf.subarray?b.Nf.subarray(0,b.Pf):new Uint8Array(b.Nf):new Uint8Array(0)},wg:function(b,c){var d=b.Nf?b.Nf.length:0;d>=c||(c=Math.max(c,d*(1048576>d?2:1.125)>>>0),0!=d&&(c=Math.max(c,256)),d=b.Nf,b.Nf=new Uint8Array(c),0<b.Pf&&b.Nf.set(d.subarray(0,b.Pf),0))},Qg:function(b,c){if(b.Pf!=c)if(0==c)b.Nf=null,b.Pf=0;else{var d=b.Nf;b.Nf=new Uint8Array(c);d&&b.Nf.set(d.subarray(0,Math.min(c,b.Pf)));b.Pf=c}},Lf:{Tf:function(b){var c={};c.Ig=8192===(b.mode&
61440)?b.id:1;c.pg=b.id;c.mode=b.mode;c.Og=1;c.uid=0;c.Lg=0;c.eg=b.eg;16384===(b.mode&61440)?c.size=4096:32768===(b.mode&61440)?c.size=b.Pf:40960===(b.mode&61440)?c.size=b.link.length:c.size=0;c.Eg=new Date(b.timestamp);c.Ng=new Date(b.timestamp);c.Hg=new Date(b.timestamp);c.Fg=4096;c.Gg=Math.ceil(c.size/c.Fg);return c},Qf:function(b,c){void 0!==c.mode&&(b.mode=c.mode);void 0!==c.timestamp&&(b.timestamp=c.timestamp);void 0!==c.size&&P.Qg(b,c.size)},cg:function(){throw Za[44];},ig:function(b,c,d,e){return P.createNode(b,
c,d,e)},Cg:function(b,c,d){if(16384===(b.mode&61440)){try{var e=$a(c,d)}catch(g){}if(e)for(var f in e.Nf)throw new O(55);}delete b.parent.Nf[b.name];b.parent.timestamp=Date.now();b.name=d;c.Nf[d]=b;c.timestamp=b.parent.timestamp;b.parent=c},ng:function(b,c){delete b.Nf[c];b.timestamp=Date.now()},lg:function(b,c){var d=$a(b,c),e;for(e in d.Nf)throw new O(55);delete b.Nf[c];b.timestamp=Date.now()},Bg:function(b){var c=[".",".."],d;for(d in b.Nf)b.Nf.hasOwnProperty(d)&&c.push(d);return c},mg:function(b,
c,d){b=P.createNode(b,c,41471,0);b.link=d;return b},fg:function(b){if(40960!==(b.mode&61440))throw new O(28);return b.link}},Mf:{read:function(b,c,d,e,f){var g=b.node.Nf;if(f>=b.node.Pf)return 0;b=Math.min(b.node.Pf-f,e);if(8<b&&g.subarray)c.set(g.subarray(f,f+b),d);else for(e=0;e<b;e++)c[d+e]=g[f+e];return b},write:function(b,c,d,e,f,g){c.buffer===A.buffer&&(g=!1);if(!e)return 0;b=b.node;b.timestamp=Date.now();if(c.subarray&&(!b.Nf||b.Nf.subarray)){if(g)return b.Nf=c.subarray(d,d+e),b.Pf=e;if(0===
b.Pf&&0===f)return b.Nf=c.slice(d,d+e),b.Pf=e;if(f+e<=b.Pf)return b.Nf.set(c.subarray(d,d+e),f),e}P.wg(b,f+e);if(b.Nf.subarray&&c.subarray)b.Nf.set(c.subarray(d,d+e),f);else for(g=0;g<e;g++)b.Nf[f+g]=c[d+g];b.Pf=Math.max(b.Pf,f+e);return e},Zf:function(b,c,d){1===d?c+=b.position:2===d&&32768===(b.node.mode&61440)&&(c+=b.node.Pf);if(0>c)throw new O(28);return c},ug:function(b,c,d){P.wg(b.node,c+d);b.node.Pf=Math.max(b.node.Pf,c+d)},jg:function(b,c,d,e,f){if(32768!==(b.node.mode&61440))throw new O(43);
b=b.node.Nf;if(f&2||b.buffer!==A.buffer){if(0<d||d+c<b.length)b.subarray?b=b.subarray(d,d+c):b=Array.prototype.slice.call(b,d,d+c);d=!0;c=65536*Math.ceil(c/65536);(f=ab(65536,c))?(y.fill(0,f,f+c),c=f):c=0;if(!c)throw new O(48);A.set(b,c)}else d=!1,c=b.byteOffset;return{Pg:c,Dg:d}},kg:function(b,c,d,e){P.Mf.write(b,c,0,e,d,!1);return 0}}},bb=null,cb={},Q=[],db=1,R=null,eb=!0,O=null,Za={},S=(b,c={})=>{b=Pa(b);if(!b)return{path:"",node:null};c=Object.assign({xg:!0,sg:0},c);if(8<c.sg)throw new O(32);
b=b.split("/").filter(h=>!!h);for(var d=bb,e="/",f=0;f<b.length;f++){var g=f===b.length-1;if(g&&c.parent)break;d=$a(d,b[f]);e=N(e+"/"+b[f]);d.$f&&(!g||g&&c.xg)&&(d=d.$f.root);if(!g||c.Yf)for(g=0;40960===(d.mode&61440);)if(d=fb(e),e=Pa(Ma(e),d),d=S(e,{sg:c.sg+1}).node,40<g++)throw new O(32);}return{path:e,node:d}},gb=b=>{for(var c;;){if(b===b.parent)return b=b.Uf.zg,c?"/"!==b[b.length-1]?b+"/"+c:b+c:b;c=c?b.name+"/"+c:b.name;b=b.parent}},hb=(b,c)=>{for(var d=0,e=0;e<c.length;e++)d=(d<<5)-d+c.charCodeAt(e)|
0;return(b+d>>>0)%R.length},ib=b=>{var c=hb(b.parent.id,b.name);if(R[c]===b)R[c]=b.ag;else for(c=R[c];c;){if(c.ag===b){c.ag=b.ag;break}c=c.ag}},$a=(b,c)=>{var d;if(d=(d=jb(b,"x"))?d:b.Lf.cg?0:2)throw new O(d,b);for(d=R[hb(b.id,c)];d;d=d.ag){var e=d.name;if(d.parent.id===b.id&&e===c)return d}return b.Lf.cg(b,c)},Ya=(b,c,d,e)=>{b=new kb(b,c,d,e);c=hb(b.parent.id,b.name);b.ag=R[c];return R[c]=b},lb={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},mb=b=>{var c=["r","w","rw"][b&3];b&512&&(c+="w");return c},
jb=(b,c)=>{if(eb)return 0;if(!c.includes("r")||b.mode&292){if(c.includes("w")&&!(b.mode&146)||c.includes("x")&&!(b.mode&73))return 2}else return 2;return 0},nb=(b,c)=>{try{return $a(b,c),20}catch(d){}return jb(b,"wx")},ob=(b,c,d)=>{try{var e=$a(b,c)}catch(f){return f.Of}if(b=jb(b,"wx"))return b;if(d){if(16384!==(e.mode&61440))return 54;if(e===e.parent||"/"===gb(e))return 10}else if(16384===(e.mode&61440))return 31;return 0},pb=(b=0)=>{for(;4096>=b;b++)if(!Q[b])return b;throw new O(33);},rb=(b,c)=>
{qb||(qb=function(){this.gg={}},qb.prototype={},Object.defineProperties(qb.prototype,{object:{get:function(){return this.node},set:function(d){this.node=d}},flags:{get:function(){return this.gg.flags},set:function(d){this.gg.flags=d}},position:{get:function(){return this.gg.position},set:function(d){this.gg.position=d}}}));b=Object.assign(new qb,b);c=pb(c);b.Wf=c;return Q[c]=b},Xa={open:b=>{b.Mf=cb[b.node.eg].Mf;b.Mf.open&&b.Mf.open(b)},Zf:()=>{throw new O(70);}},Ta=(b,c)=>{cb[b]={Mf:c}},sb=(b,c)=>
{var d="/"===c,e=!c;if(d&&bb)throw new O(10);if(!d&&!e){var f=S(c,{xg:!1});c=f.path;f=f.node;if(f.$f)throw new O(10);if(16384!==(f.mode&61440))throw new O(54);}c={type:b,Vg:{},zg:c,Mg:[]};b=b.Uf(c);b.Uf=c;c.root=b;d?bb=b:f&&(f.$f=c,f.Uf&&f.Uf.Mg.push(c))},tb=(b,c,d)=>{var e=S(b,{parent:!0}).node;b=Na(b);if(!b||"."===b||".."===b)throw new O(28);var f=nb(e,b);if(f)throw new O(f);if(!e.Lf.ig)throw new O(63);return e.Lf.ig(e,b,c,d)},T=(b,c)=>tb(b,(void 0!==c?c:511)&1023|16384,0),ub=(b,c,d)=>{"undefined"==
typeof d&&(d=c,c=438);tb(b,c|8192,d)},vb=(b,c)=>{if(!Pa(b))throw new O(44);var d=S(c,{parent:!0}).node;if(!d)throw new O(44);c=Na(c);var e=nb(d,c);if(e)throw new O(e);if(!d.Lf.mg)throw new O(63);d.Lf.mg(d,c,b)},wb=b=>{var c=S(b,{parent:!0}).node;b=Na(b);var d=$a(c,b),e=ob(c,b,!0);if(e)throw new O(e);if(!c.Lf.lg)throw new O(63);if(d.$f)throw new O(10);c.Lf.lg(c,b);ib(d)},fb=b=>{b=S(b).node;if(!b)throw new O(44);if(!b.Lf.fg)throw new O(28);return Pa(gb(b.parent),b.Lf.fg(b))},xb=(b,c)=>{b=S(b,{Yf:!c}).node;
if(!b)throw new O(44);if(!b.Lf.Tf)throw new O(63);return b.Lf.Tf(b)},yb=b=>xb(b,!0),zb=(b,c)=>{b="string"==typeof b?S(b,{Yf:!0}).node:b;if(!b.Lf.Qf)throw new O(63);b.Lf.Qf(b,{mode:c&4095|b.mode&-4096,timestamp:Date.now()})},Ab=(b,c)=>{if(0>c)throw new O(28);b="string"==typeof b?S(b,{Yf:!0}).node:b;if(!b.Lf.Qf)throw new O(63);if(16384===(b.mode&61440))throw new O(31);if(32768!==(b.mode&61440))throw new O(28);var d=jb(b,"w");if(d)throw new O(d);b.Lf.Qf(b,{size:c,timestamp:Date.now()})},Cb=(b,c,d)=>
{if(""===b)throw new O(44);if("string"==typeof c){var e=lb[c];if("undefined"==typeof e)throw Error("Unknown file open mode: "+c);c=e}d=c&64?("undefined"==typeof d?438:d)&4095|32768:0;if("object"==typeof b)var f=b;else{b=N(b);try{f=S(b,{Yf:!(c&131072)}).node}catch(g){}}e=!1;if(c&64)if(f){if(c&128)throw new O(20);}else f=tb(b,d,0),e=!0;if(!f)throw new O(44);8192===(f.mode&61440)&&(c&=-513);if(c&65536&&16384!==(f.mode&61440))throw new O(54);if(!e&&(d=f?40960===(f.mode&61440)?32:16384===(f.mode&61440)&&
("r"!==mb(c)||c&512)?31:jb(f,mb(c)):44))throw new O(d);c&512&&!e&&Ab(f,0);c&=-131713;f=rb({node:f,path:gb(f),flags:c,seekable:!0,position:0,Mf:f.Mf,Tg:[],error:!1});f.Mf.open&&f.Mf.open(f);!a.logReadFiles||c&1||(Bb||(Bb={}),b in Bb||(Bb[b]=1));return f},Db=(b,c,d)=>{if(null===b.Wf)throw new O(8);if(!b.seekable||!b.Mf.Zf)throw new O(70);if(0!=d&&1!=d&&2!=d)throw new O(28);b.position=b.Mf.Zf(b,c,d);b.Tg=[]},Eb=()=>{O||(O=function(b,c){this.node=c;this.Rg=function(d){this.Of=d};this.Rg(b);this.message=
"FS error"},O.prototype=Error(),O.prototype.constructor=O,[44].forEach(b=>{Za[b]=new O(b);Za[b].stack="<generic error, no stack>"}))},Fb,Gb=(b,c)=>{var d=0;b&&(d|=365);c&&(d|=146);return d},Ib=(b,c,d)=>{b=N("/dev/"+b);var e=Gb(!!c,!!d);Hb||(Hb=64);var f=Hb++<<8|0;Ta(f,{open:g=>{g.seekable=!1},close:()=>{d&&d.buffer&&d.buffer.length&&d(10)},read:(g,h,n,k)=>{for(var l=0,p=0;p<k;p++){try{var q=c()}catch(r){throw new O(29);}if(void 0===q&&0===l)throw new O(6);if(null===q||void 0===q)break;l++;h[n+p]=
q}l&&(g.node.timestamp=Date.now());return l},write:(g,h,n,k)=>{for(var l=0;l<k;l++)try{d(h[n+l])}catch(p){throw new O(29);}k&&(g.node.timestamp=Date.now());return l}});ub(b,e,f)},Hb,U={},qb,Bb;function Jb(b,c,d){if("/"===c.charAt(0))return c;b=-100===b?"/":V(b).path;if(0==c.length){if(!d)throw new O(44);return b}return N(b+"/"+c)}
function Kb(b,c,d){try{var e=b(c)}catch(g){if(g&&g.node&&N(c)!==N(gb(g.node)))return-54;throw g;}C[d>>2]=e.Ig;C[d+8>>2]=e.pg;C[d+12>>2]=e.mode;E[d+16>>2]=e.Og;C[d+20>>2]=e.uid;C[d+24>>2]=e.Lg;C[d+28>>2]=e.eg;K=[e.size>>>0,(I=e.size,1<=+Math.abs(I)?0<I?(Math.min(+Math.floor(I/4294967296),4294967295)|0)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];C[d+40>>2]=K[0];C[d+44>>2]=K[1];C[d+48>>2]=4096;C[d+52>>2]=e.Gg;b=e.Eg.getTime();c=e.Ng.getTime();var f=e.Hg.getTime();K=[Math.floor(b/1E3)>>>0,(I=
Math.floor(b/1E3),1<=+Math.abs(I)?0<I?(Math.min(+Math.floor(I/4294967296),4294967295)|0)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];C[d+56>>2]=K[0];C[d+60>>2]=K[1];E[d+64>>2]=b%1E3*1E3;K=[Math.floor(c/1E3)>>>0,(I=Math.floor(c/1E3),1<=+Math.abs(I)?0<I?(Math.min(+Math.floor(I/4294967296),4294967295)|0)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];C[d+72>>2]=K[0];C[d+76>>2]=K[1];E[d+80>>2]=c%1E3*1E3;K=[Math.floor(f/1E3)>>>0,(I=Math.floor(f/1E3),1<=+Math.abs(I)?0<I?(Math.min(+Math.floor(I/
4294967296),4294967295)|0)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];C[d+88>>2]=K[0];C[d+92>>2]=K[1];E[d+96>>2]=f%1E3*1E3;K=[e.pg>>>0,(I=e.pg,1<=+Math.abs(I)?0<I?(Math.min(+Math.floor(I/4294967296),4294967295)|0)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];C[d+104>>2]=K[0];C[d+108>>2]=K[1];return 0}var Lb=void 0;function Mb(){Lb+=4;return C[Lb-4>>2]}function V(b){b=Q[b];if(!b)throw new O(8);return b}function Nb(b){return E[b>>2]+4294967296*C[b+4>>2]}
var Ob=[0,31,60,91,121,152,182,213,244,274,305,335],Pb=[0,31,59,90,120,151,181,212,243,273,304,334];function Qb(b){var c=ra(b)+1,d=Rb(c);d&&pa(b,A,d,c);return d}var Sb={};
function Tb(){if(!Ub){var b={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:da||"./this.program"},c;for(c in Sb)void 0===Sb[c]?delete b[c]:b[c]=Sb[c];var d=[];for(c in b)d.push(c+"="+b[c]);Ub=d}return Ub}var Ub;function Vb(b,c){Vb.Ag||(Vb.Ag=Oa());for(var d=0;d<c;d++)A[b+d>>0]=Vb.Ag();return 0}function Wb(){}function Xb(){}function Yb(){}function Zb(){}
function $b(){}function ac(){}function bc(){}function cc(){}function dc(){}function ec(){}function fc(){}function gc(){}function hc(){}function ic(){}function jc(){}function kc(){}function lc(){}function mc(){}function nc(){}function oc(){}function pc(){}function qc(){}function rc(){}function sc(){}function tc(){}function uc(){}function vc(){}function wc(){}function xc(){}function yc(){}function zc(){}function Ac(){}function Bc(){}function Cc(){}function Dc(){}function Ec(){}function Fc(){}
function Gc(){}function Hc(){}function Ic(b){b instanceof Ja||"unwind"==b||ea(1,b)}function Jc(b){try{b()}catch(c){u(c)}}function Kc(b){var c={},d;for(d in b)(function(e){var f=b[e];c[e]="function"==typeof f?function(){Lc.push(e);try{return f.apply(null,arguments)}finally{v||(Lc.pop()===e||u(),X&&1===Y&&0===Lc.length&&(Y=0,Jc(Mc),"undefined"!=typeof Fibers&&Fibers.Wg()))}}:f})(d);return c}var Y=0,X=null,Nc=0,Lc=[],Oc={},Pc={},Qc=0,Rc=null,Sc=[];
function Tc(){return new Promise((b,c)=>{Rc={resolve:b,reject:c}})}function Uc(){var b=Rb(16396),c=b+12;C[b>>2]=c;C[b+4>>2]=c+16384;c=Lc[0];var d=Oc[c];void 0===d&&(d=Qc++,Oc[c]=d,Pc[d]=c);C[b+8>>2]=d;return b}
function Vc(b){if(!v){if(0===Y){var c=!1,d=!1;b(e=>{if(!v&&(Nc=e||0,c=!0,d)){Y=2;Jc(()=>Wc(X));"undefined"!=typeof Xc&&Xc.qg.Kg&&Xc.qg.resume();e=!1;try{var f=(0,a.asm[Pc[C[X+8>>2]]])()}catch(n){f=n,e=!0}var g=!1;if(!X){var h=Rc;h&&(Rc=null,(e?h.reject:h.resolve)(f),g=!0)}if(e&&!g)throw f;}});d=!0;c||(Y=1,X=Uc(),"undefined"!=typeof Xc&&Xc.qg.Kg&&Xc.qg.pause(),Jc(()=>Yc(X)))}else 2===Y?(Y=0,Jc(Zc),$c(X),X=null,Sc.forEach(e=>{if(!v)try{e()}catch(f){Ic(f)}})):u("invalid state: "+Y);return Nc}}
function ad(b){return Vc(c=>{b().then(c)})}var bd={},cd=void 0,dd=[];function ed(b,c){A.set(b,c)}
function Z(b,c,d,e,f){function g(q){0!==k&&fd(k);return"string"===c?x(q):"boolean"===c?!!q:q}var h={string:q=>{var r=0;if(null!==q&&void 0!==q&&0!==q){var w=(q.length<<2)+1;r=gd(w);qa(q,r,w)}return r},array:q=>{var r=gd(q.length);ed(q,r);return r}};b=a["_"+b];var n=[],k=0;if(e)for(var l=0;l<e.length;l++){var p=h[d[l]];p?(0===k&&(k=hd()),n[l]=p(e[l])):n[l]=e[l]}d=X;e=b.apply(null,n);f=f&&f.async;if(X!=d)return Tc().then(g);e=g(e);return f?Promise.resolve(e):e}
var jd="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function kb(b,c,d,e){b||(b=this);this.parent=b;this.Uf=b.Uf;this.$f=null;this.id=db++;this.name=c;this.mode=d;this.Lf={};this.Mf={};this.eg=e}Object.defineProperties(kb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(b){b?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(b){b?this.mode|=146:this.mode&=-147}}});Eb();R=Array(4096);sb(P,"/");T("/tmp");T("/home");
T("/home/web_user");(()=>{T("/dev");Ta(259,{read:()=>0,write:(c,d,e,f)=>f});ub("/dev/null",259);Sa(1280,Va);Sa(1536,Wa);ub("/dev/tty",1280);ub("/dev/tty1",1536);var b=Oa();Ib("random",b);Ib("urandom",b);T("/dev/shm");T("/dev/shm/tmp")})();(()=>{T("/proc");var b=T("/proc/self");T("/proc/self/fd");sb({Uf:()=>{var c=Ya(b,"fd",16895,73);c.Lf={cg:(d,e)=>{var f=Q[+e];if(!f)throw new O(8);d={parent:null,Uf:{zg:"fake"},Lf:{fg:()=>f.path}};return d.parent=d}};return c}},"/proc/self/fd")})();var Xc;
(function(){const b=new Map;a.setAuthorizer=function(c,d,e){d?b.set(c,{f:d,tg:e}):b.delete(c);return Z("set_authorizer","number",["number"],[c])};Wb=function(c,d,e,f,g,h){if(b.has(c)){const {f:n,tg:k}=b.get(c);return n(k,d,e?x(e):null,f?x(f):null,g?x(g):null,h?x(h):null)}return 0}})();
(function(){const b=new Map,c=new Map;a.createFunction=function(d,e,f,g,h,n){const k=b.size;b.set(k,{f:n,Xf:h});return Z("create_function","number","number string number number number number".split(" "),[d,e,f,g,k,0])};a.createAggregate=function(d,e,f,g,h,n,k){const l=b.size;b.set(l,{step:n,Jg:k,Xf:h});return Z("create_function","number","number string number number number number".split(" "),[d,e,f,g,l,1])};a.getFunctionUserData=function(d){return c.get(d)};Yb=function(d,e,f,g){d=b.get(d);c.set(e,
d.Xf);d.f(e,new Uint32Array(y.buffer,g,f));c.delete(e)};$b=function(d,e,f,g){d=b.get(d);c.set(e,d.Xf);d.step(e,new Uint32Array(y.buffer,g,f));c.delete(e)};Xb=function(d,e){d=b.get(d);c.set(e,d.Xf);d.Jg(e);c.delete(e)}})();(function(){const b=new Map;a.progressHandler=function(c,d,e,f){e?b.set(c,{f:e,tg:f}):b.delete(c);return Z("progress_handler",null,["number","number"],[c,d])};Zb=function(c){if(b.has(c)){const {f:d,tg:e}=b.get(c);return d(e)}return 0}})();
(function(){function b(k,l){const p=`get${k}`,q=`set${k}`;return new Proxy(new DataView(y.buffer,l,"Int32"===k?4:8),{get(r,w){if(w===p)return function(z,G){if(!G)throw Error("must be little endian");return r[w](z,G)};if(w===q)return function(z,G,D){if(!D)throw Error("must be little endian");return r[w](z,G,D)};if("string"===typeof w&&w.match(/^(get)|(set)/))throw Error("invalid type");return r[w]}})}const c="object"===typeof bd,d=new Map,e=new Map,f=new Map,g=c?new Set:null,h=c?new Set:null,n=new Map;
qc=function(k,l,p,q){n.set(x(k),{size:l,dg:Array.from(new Uint32Array(y.buffer,q,p))})};a.createModule=function(k,l,p,q){c&&(p.handleAsync=ad);const r=d.size;d.set(r,{module:p,Xf:q});q=0;p.xCreate&&(q|=1);p.xConnect&&(q|=2);p.xBestIndex&&(q|=4);p.xDisconnect&&(q|=8);p.xDestroy&&(q|=16);p.xOpen&&(q|=32);p.xClose&&(q|=64);p.xFilter&&(q|=128);p.xNext&&(q|=256);p.xEof&&(q|=512);p.xColumn&&(q|=1024);p.xRowid&&(q|=2048);p.xUpdate&&(q|=4096);p.xBegin&&(q|=8192);p.xSync&&(q|=16384);p.xCommit&&(q|=32768);
p.xRollback&&(q|=65536);p.xFindFunction&&(q|=131072);p.xRename&&(q|=262144);return Z("create_module","number",["number","string","number","number"],[k,l,r,q])};gc=function(k,l,p,q,r,w){l=d.get(l);e.set(r,l);if(c){g.delete(r);for(const z of g)e.delete(z)}q=Array.from(new Uint32Array(y.buffer,q,p)).map(z=>x(z));return l.module.xCreate(k,l.Xf,q,r,b("Int32",w))};fc=function(k,l,p,q,r,w){l=d.get(l);e.set(r,l);if(c){g.delete(r);for(const z of g)e.delete(z)}q=Array.from(new Uint32Array(y.buffer,q,p)).map(z=>
x(z));return l.module.xConnect(k,l.Xf,q,r,b("Int32",w))};bc=function(k,l){var p=e.get(k),q=n.get("sqlite3_index_info").dg;const r={};r.nConstraint=L(l+q[0],"i32");r.aConstraint=[];var w=L(l+q[1],"*"),z=n.get("sqlite3_index_constraint").size;for(var G=0;G<r.nConstraint;++G){var D=r.aConstraint,J=D.push,H=w+G*z,ja=n.get("sqlite3_index_constraint").dg,W={};W.iColumn=L(H+ja[0],"i32");W.op=L(H+ja[1],"i8");W.usable=!!L(H+ja[2],"i8");J.call(D,W)}r.nOrderBy=L(l+q[2],"i32");r.aOrderBy=[];w=L(l+q[3],"*");z=
n.get("sqlite3_index_orderby").size;for(G=0;G<r.nOrderBy;++G)D=r.aOrderBy,J=D.push,H=w+G*z,ja=n.get("sqlite3_index_orderby").dg,W={},W.iColumn=L(H+ja[0],"i32"),W.desc=!!L(H+ja[1],"i8"),J.call(D,W);r.aConstraintUsage=[];for(w=0;w<r.nConstraint;++w)r.aConstraintUsage.push({argvIndex:0,omit:!1});r.idxNum=L(l+q[5],"i32");r.idxStr=null;r.orderByConsumed=!!L(l+q[8],"i8");r.estimatedCost=L(l+q[9],"double");r.estimatedRows=L(l+q[10],"i32");r.idxFlags=L(l+q[11],"i32");r.colUsed=L(l+q[12],"i32");k=p.module.xBestIndex(k,
r);p=n.get("sqlite3_index_info").dg;q=L(l+p[4],"*");w=n.get("sqlite3_index_constraint_usage").size;for(J=0;J<r.nConstraint;++J)z=q+J*w,D=r.aConstraintUsage[J],H=n.get("sqlite3_index_constraint_usage").dg,M(z+H[0],D.argvIndex,"i32"),M(z+H[1],D.omit?1:0,"i8");M(l+p[5],r.idxNum,"i32");"string"===typeof r.idxStr&&(q=ra(r.idxStr),w=Z("sqlite3_malloc","number",["number"],[q+1]),qa(r.idxStr,w,q+1),M(l+p[6],w,"*"),M(l+p[7],1,"i32"));M(l+p[8],r.orderByConsumed,"i32");M(l+p[9],r.estimatedCost,"double");M(l+
p[10],r.estimatedRows,"i32");M(l+p[11],r.idxFlags,"i32");return k};ic=function(k){const l=e.get(k);c?g.add(k):e.delete(k);return l.module.xDisconnect(k)};hc=function(k){const l=e.get(k);c?g.add(k):e.delete(k);return l.module.xDestroy(k)};mc=function(k,l){const p=e.get(k);f.set(l,p);if(c){h.delete(l);for(const q of h)f.delete(q)}return p.module.xOpen(k,l)};cc=function(k){const l=f.get(k);c?h.add(k):f.delete(k);return l.module.xClose(k)};jc=function(k){return f.get(k).module.xEof(k)?1:0};kc=function(k,
l,p,q,r){const w=f.get(k);p=p?x(p):null;r=new Uint32Array(y.buffer,r,q);return w.module.xFilter(k,l,p,r)};lc=function(k){return f.get(k).module.xNext(k)};dc=function(k,l,p){return f.get(k).module.xColumn(k,l,p)};pc=function(k,l){return f.get(k).module.xRowid(k,b("BigInt64",l))};sc=function(k,l,p,q){const r=e.get(k);p=new Uint32Array(y.buffer,p,l);return r.module.xUpdate(k,p,b("BigInt64",q))};ac=function(k){return e.get(k).module.xBegin(k)};rc=function(k){return e.get(k).module.xSync(k)};ec=function(k){return e.get(k).module.xCommit(k)};
oc=function(k){return e.get(k).module.xRollback(k)};nc=function(k,l){const p=e.get(k);l=x(l);return p.module.xRename(k,l)}})();
(function(){function b(g,h){const n=`get${g}`,k=`set${g}`;return new Proxy(new DataView(y.buffer,h,"Int32"===g?4:8),{get(l,p){if(p===n)return function(q,r){if(!r)throw Error("must be little endian");return l[p](q,r)};if(p===k)return function(q,r,w){if(!w)throw Error("must be little endian");return l[p](q,r,w)};if("string"===typeof p&&p.match(/^(get)|(set)/))throw Error("invalid type");return l[p]}})}const c="object"===typeof bd;c&&(a.handleAsync=ad);const d=new Map,e=new Map;a.registerVFS=function(g,
h){if(Z("sqlite3_vfs_find","number",["string"],[g.name]))throw Error(`VFS '${g.name}' already registered`);c&&(g.handleAsync=ad);var n=g.mxPathName??64;const k=a._malloc(4);h=Z("register_vfs","number",["string","number","number","number"],[g.name,n,h?1:0,k]);h||(n=L(k,"*"),d.set(n,g));a._free(k);return h};const f=c?new Set:null;vc=function(g){const h=e.get(g);c?f.add(g):e.delete(g);return h.xClose(g)};Cc=function(g,h,n,k,l){return e.get(g).xRead(g,y.subarray(h,h+n),4294967296*l+k+(0>k?2**32:0))};
Hc=function(g,h,n,k,l){return e.get(g).xWrite(g,y.subarray(h,h+n),4294967296*l+k+(0>k?2**32:0))};Fc=function(g,h,n){return e.get(g).xTruncate(g,4294967296*n+h+(0>h?2**32:0))};Ec=function(g,h){return e.get(g).xSync(g,h)};zc=function(g,h){const n=e.get(g);h=b("BigInt64",h);return n.xFileSize(g,h)};Ac=function(g,h){return e.get(g).xLock(g,h)};Gc=function(g,h){return e.get(g).xUnlock(g,h)};uc=function(g,h){const n=e.get(g);h=b("Int32",h);return n.xCheckReservedLock(g,h)};yc=function(g,h,n){const k=e.get(g);
n=new DataView(y.buffer,n);return k.xFileControl(g,h,n)};Dc=function(g){return e.get(g).xSectorSize(g)};xc=function(g){return e.get(g).xDeviceCharacteristics(g)};Bc=function(g,h,n,k,l){g=d.get(g);e.set(n,g);if(c){f.delete(n);for(var p of f)e.delete(p)}p=null;if(k&64){p=1;const q=[];for(;p;){const r=y[h++];if(r)q.push(r);else switch(y[h]||(p=null),p){case 1:q.push(63);p=2;break;case 2:q.push(61);p=3;break;case 3:q.push(38),p=2}}p=(new TextDecoder).decode(new Uint8Array(q))}else h&&(p=x(h));l=b("Int32",
l);return g.xOpen(p,n,k,l)};wc=function(g,h,n){return d.get(g).xDelete(x(h),n)};tc=function(g,h,n,k){g=d.get(g);k=b("Int32",k);return g.xAccess(x(h),n,k)}})();
var ld={a:function(b,c,d,e){u("Assertion failed: "+x(b)+", at: "+[c?x(c):"unknown filename",d,e?x(e):"unknown function"])},L:function(b,c){try{return b=x(b),zb(b,c),0}catch(d){if("undefined"==typeof U||!(d instanceof O))throw d;return-d.Of}},Q:function(b,c,d){try{c=x(c);c=Jb(b,c);if(d&-8)return-28;var e=S(c,{Yf:!0}).node;if(!e)return-44;b="";d&4&&(b+="r");d&2&&(b+="w");d&1&&(b+="x");return b&&jb(e,b)?-2:0}catch(f){if("undefined"==typeof U||!(f instanceof O))throw f;return-f.Of}},M:function(b,c){try{var d=
Q[b];if(!d)throw new O(8);zb(d.node,c);return 0}catch(e){if("undefined"==typeof U||!(e instanceof O))throw e;return-e.Of}},K:function(b){try{var c=Q[b];if(!c)throw new O(8);var d=c.node;var e="string"==typeof d?S(d,{Yf:!0}).node:d;if(!e.Lf.Qf)throw new O(63);e.Lf.Qf(e,{timestamp:Date.now()});return 0}catch(f){if("undefined"==typeof U||!(f instanceof O))throw f;return-f.Of}},b:function(b,c,d){Lb=d;try{var e=V(b);switch(c){case 0:var f=Mb();return 0>f?-28:rb(e,f).Wf;case 1:case 2:return 0;case 3:return e.flags;
case 4:return f=Mb(),e.flags|=f,0;case 5:return f=Mb(),B[f+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return C[kd()>>2]=28,-1;default:return-28}}catch(g){if("undefined"==typeof U||!(g instanceof O))throw g;return-g.Of}},J:function(b,c){try{var d=V(b);return Kb(xb,d.path,c)}catch(e){if("undefined"==typeof U||!(e instanceof O))throw e;return-e.Of}},j:function(b,c,d){try{c=d+2097152>>>0<4194305-!!c?(c>>>0)+4294967296*d:NaN;if(isNaN(c))return-61;var e=Q[b];if(!e)throw new O(8);if(0===
(e.flags&2097155))throw new O(28);Ab(e.node,c);return 0}catch(f){if("undefined"==typeof U||!(f instanceof O))throw f;return-f.Of}},D:function(b,c){try{if(0===c)return-28;var d=ra("/")+1;if(c<d)return-68;qa("/",b,c);return d}catch(e){if("undefined"==typeof U||!(e instanceof O))throw e;return-e.Of}},G:function(b,c){try{return b=x(b),Kb(yb,b,c)}catch(d){if("undefined"==typeof U||!(d instanceof O))throw d;return-d.Of}},A:function(b,c,d){try{return c=x(c),c=Jb(b,c),c=N(c),"/"===c[c.length-1]&&(c=c.substr(0,
c.length-1)),T(c,d),0}catch(e){if("undefined"==typeof U||!(e instanceof O))throw e;return-e.Of}},F:function(b,c,d,e){try{c=x(c);var f=e&256;c=Jb(b,c,e&4096);return Kb(f?yb:xb,c,d)}catch(g){if("undefined"==typeof U||!(g instanceof O))throw g;return-g.Of}},w:function(b,c,d,e){Lb=e;try{c=x(c);c=Jb(b,c);var f=e?Mb():0;return Cb(c,d,f).Wf}catch(g){if("undefined"==typeof U||!(g instanceof O))throw g;return-g.Of}},u:function(b,c,d,e){try{c=x(c);c=Jb(b,c);if(0>=e)return-28;var f=fb(c),g=Math.min(e,ra(f)),
h=A[d+g];qa(f,d,e+1);A[d+g]=h;return g}catch(n){if("undefined"==typeof U||!(n instanceof O))throw n;return-n.Of}},t:function(b){try{return b=x(b),wb(b),0}catch(c){if("undefined"==typeof U||!(c instanceof O))throw c;return-c.Of}},H:function(b,c){try{return b=x(b),Kb(xb,b,c)}catch(d){if("undefined"==typeof U||!(d instanceof O))throw d;return-d.Of}},r:function(b,c,d){try{c=x(c);c=Jb(b,c);if(0===d){b=c;var e=S(b,{parent:!0}).node;if(!e)throw new O(44);var f=Na(b),g=$a(e,f),h=ob(e,f,!1);if(h)throw new O(h);
if(!e.Lf.ng)throw new O(63);if(g.$f)throw new O(10);e.Lf.ng(e,f);ib(g)}else 512===d?wb(c):u("Invalid flags passed to unlinkat");return 0}catch(n){if("undefined"==typeof U||!(n instanceof O))throw n;return-n.Of}},q:function(b,c,d){try{c=x(c);c=Jb(b,c,!0);if(d){var e=Nb(d),f=C[d+8>>2];g=1E3*e+f/1E6;d+=16;e=Nb(d);f=C[d+8>>2];h=1E3*e+f/1E6}else var g=Date.now(),h=g;b=g;var n=S(c,{Yf:!0}).node;n.Lf.Qf(n,{timestamp:Math.max(b,h)});return 0}catch(k){if("undefined"==typeof U||!(k instanceof O))throw k;return-k.Of}},
N:function(b,c){b=new Date(1E3*Nb(b));C[c>>2]=b.getSeconds();C[c+4>>2]=b.getMinutes();C[c+8>>2]=b.getHours();C[c+12>>2]=b.getDate();C[c+16>>2]=b.getMonth();C[c+20>>2]=b.getFullYear()-1900;C[c+24>>2]=b.getDay();var d=b.getFullYear();C[c+28>>2]=(0!==d%4||0===d%100&&0!==d%400?Pb:Ob)[b.getMonth()]+b.getDate()-1|0;C[c+36>>2]=-(60*b.getTimezoneOffset());d=(new Date(b.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(b.getFullYear(),0,1)).getTimezoneOffset();C[c+32>>2]=(d!=e&&b.getTimezoneOffset()==
Math.min(e,d))|0},y:function(b,c,d,e,f,g,h){try{var n=V(e);if(0!==(c&2)&&0===(d&2)&&2!==(n.flags&2097155))throw new O(2);if(1===(n.flags&2097155))throw new O(2);if(!n.Mf.jg)throw new O(43);var k=n.Mf.jg(n,b,f,c,d);var l=k.Pg;C[g>>2]=k.Dg;E[h>>2]=l;return 0}catch(p){if("undefined"==typeof U||!(p instanceof O))throw p;return-p.Of}},z:function(b,c,d,e,f,g){try{var h=V(f);if(d&2){if(32768!==(h.node.mode&61440))throw new O(43);e&2||h.Mf.kg&&h.Mf.kg(h,y.slice(b,b+c),g,c,e)}}catch(n){if("undefined"==typeof U||
!(n instanceof O))throw n;return-n.Of}},O:function(b,c,d){function e(k){return(k=k.toTimeString().match(/\(([A-Za-z ]+)\)$/))?k[1]:"GMT"}var f=(new Date).getFullYear(),g=new Date(f,0,1),h=new Date(f,6,1);f=g.getTimezoneOffset();var n=h.getTimezoneOffset();E[b>>2]=60*Math.max(f,n);C[c>>2]=Number(f!=n);b=e(g);c=e(h);b=Qb(b);c=Qb(c);n<f?(E[d>>2]=b,E[d+4>>2]=c):(E[d>>2]=c,E[d+4>>2]=b)},ta:function(){u("")},e:function(){return Date.now()},d:()=>performance.now(),o:function(b){var c=y.length;b>>>=0;if(2147483648<
b)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,b+100663296);var f=Math,g=f.min;e=Math.max(b,e);e+=(65536-e%65536)%65536;a:{var h=ma.buffer;try{ma.grow(g.call(f,2147483648,e)-h.byteLength+65535>>>16);va();var n=1;break a}catch(k){}n=void 0}if(n)return!0}return!1},B:function(b,c){var d=0;Tb().forEach(function(e,f){var g=c+d;f=E[b+4*f>>2]=g;for(g=0;g<e.length;++g)A[f++>>0]=e.charCodeAt(g);A[f>>0]=0;d+=e.length+1});return 0},C:function(b,c){var d=Tb();E[b>>2]=d.length;var e=0;d.forEach(function(f){e+=
f.length+1});E[c>>2]=e;return 0},f:function(b){try{var c=V(b);if(null===c.Wf)throw new O(8);c.og&&(c.og=null);try{c.Mf.close&&c.Mf.close(c)}catch(d){throw d;}finally{Q[c.Wf]=null}c.Wf=null;return 0}catch(d){if("undefined"==typeof U||!(d instanceof O))throw d;return d.Of}},p:function(b,c){try{var d=V(b);A[c>>0]=d.Sf?2:16384===(d.mode&61440)?3:40960===(d.mode&61440)?7:4;return 0}catch(e){if("undefined"==typeof U||!(e instanceof O))throw e;return e.Of}},v:function(b,c,d,e){try{a:{var f=V(b);b=c;for(var g,
h=c=0;h<d;h++){var n=E[b>>2],k=E[b+4>>2];b+=8;var l=f,p=n,q=k,r=g,w=A;if(0>q||0>r)throw new O(28);if(null===l.Wf)throw new O(8);if(1===(l.flags&2097155))throw new O(8);if(16384===(l.node.mode&61440))throw new O(31);if(!l.Mf.read)throw new O(28);var z="undefined"!=typeof r;if(!z)r=l.position;else if(!l.seekable)throw new O(70);var G=l.Mf.read(l,w,p,q,r);z||(l.position+=G);var D=G;if(0>D){var J=-1;break a}c+=D;if(D<k)break;"undefined"!==typeof g&&(g+=D)}J=c}E[e>>2]=J;return 0}catch(H){if("undefined"==
typeof U||!(H instanceof O))throw H;return H.Of}},i:function(b,c,d,e,f){try{c=d+2097152>>>0<4194305-!!c?(c>>>0)+4294967296*d:NaN;if(isNaN(c))return 61;var g=V(b);Db(g,c,e);K=[g.position>>>0,(I=g.position,1<=+Math.abs(I)?0<I?(Math.min(+Math.floor(I/4294967296),4294967295)|0)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];C[f>>2]=K[0];C[f+4>>2]=K[1];g.og&&0===c&&0===e&&(g.og=null);return 0}catch(h){if("undefined"==typeof U||!(h instanceof O))throw h;return h.Of}},E:function(b){try{var c=V(b);return Vc(function(d){var e=
c.node.Uf;e.type.Sg?e.type.Sg(e,!1,function(f){f?d(function(){return 29}):d(0)}):d(0)})}catch(d){if("undefined"==typeof U||!(d instanceof O))throw d;return d.Of}},s:function(b,c,d,e){try{a:{var f=V(b);b=c;for(var g,h=c=0;h<d;h++){var n=E[b>>2],k=E[b+4>>2];b+=8;var l=f,p=n,q=k,r=g,w=A;if(0>q||0>r)throw new O(28);if(null===l.Wf)throw new O(8);if(0===(l.flags&2097155))throw new O(8);if(16384===(l.node.mode&61440))throw new O(31);if(!l.Mf.write)throw new O(28);l.seekable&&l.flags&1024&&Db(l,0,2);var z=
"undefined"!=typeof r;if(!z)r=l.position;else if(!l.seekable)throw new O(70);var G=l.Mf.write(l,w,p,q,r,void 0);z||(l.position+=G);var D=G;if(0>D){var J=-1;break a}c+=D;"undefined"!==typeof g&&(g+=D)}J=c}E[e>>2]=J;return 0}catch(H){if("undefined"==typeof U||!(H instanceof O))throw H;return H.Of}},sa:Vb,_:Wb,x:Xb,P:Yb,ca:Zb,I:$b,ka:ac,m:bc,ra:cc,na:dc,ia:ec,ea:fc,fa:gc,g:hc,h:ic,oa:jc,qa:kc,pa:lc,da:mc,ga:nc,ha:oc,ma:pc,c:qc,ja:rc,la:sc,aa:tc,V:uc,$:vc,ba:wc,S:xc,U:yc,Y:zc,X:Ac,R:Bc,n:Cc,T:Dc,Z:Ec,
k:Fc,W:Gc,l:Hc};
(function(){function b(g){g=g.exports;g=Kc(g);a.asm=g;ma=a.asm.ua;va();wa=a.asm.Cf;ya.unshift(a.asm.va);Ca--;a.monitorRunDependencies&&a.monitorRunDependencies(Ca);0==Ca&&(null!==Da&&(clearInterval(Da),Da=null),Ea&&(g=Ea,Ea=null,g()))}function c(g){b(g.instance)}function d(g){return Ia().then(function(h){return WebAssembly.instantiate(h,e)}).then(function(h){return h}).then(g,function(h){t("failed to asynchronously prepare wasm: "+h);u(h)})}var e={a:ld};Ca++;a.monitorRunDependencies&&a.monitorRunDependencies(Ca);
if(a.instantiateWasm)try{var f=a.instantiateWasm(e,b);return f=Kc(f)}catch(g){t("Module.instantiateWasm callback failed with error: "+g),ba(g)}(function(){return la||"function"!=typeof WebAssembly.instantiateStreaming||Fa()||"function"!=typeof fetch?d(c):fetch(F,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,e).then(c,function(h){t("wasm streaming compile failed: "+h);t("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(ba);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.va).apply(null,arguments)};a._sqlite3_status64=function(){return(a._sqlite3_status64=a.asm.wa).apply(null,arguments)};a._sqlite3_status=function(){return(a._sqlite3_status=a.asm.xa).apply(null,arguments)};a._sqlite3_db_status=function(){return(a._sqlite3_db_status=a.asm.ya).apply(null,arguments)};a._sqlite3_msize=function(){return(a._sqlite3_msize=a.asm.za).apply(null,arguments)};
a._sqlite3_vfs_find=function(){return(a._sqlite3_vfs_find=a.asm.Aa).apply(null,arguments)};a._sqlite3_vfs_register=function(){return(a._sqlite3_vfs_register=a.asm.Ba).apply(null,arguments)};a._sqlite3_vfs_unregister=function(){return(a._sqlite3_vfs_unregister=a.asm.Ca).apply(null,arguments)};a._sqlite3_release_memory=function(){return(a._sqlite3_release_memory=a.asm.Da).apply(null,arguments)};a._sqlite3_soft_heap_limit64=function(){return(a._sqlite3_soft_heap_limit64=a.asm.Ea).apply(null,arguments)};
a._sqlite3_memory_used=function(){return(a._sqlite3_memory_used=a.asm.Fa).apply(null,arguments)};a._sqlite3_hard_heap_limit64=function(){return(a._sqlite3_hard_heap_limit64=a.asm.Ga).apply(null,arguments)};a._sqlite3_memory_highwater=function(){return(a._sqlite3_memory_highwater=a.asm.Ha).apply(null,arguments)};a._sqlite3_malloc=function(){return(a._sqlite3_malloc=a.asm.Ia).apply(null,arguments)};a._sqlite3_malloc64=function(){return(a._sqlite3_malloc64=a.asm.Ja).apply(null,arguments)};
a._sqlite3_free=function(){return(a._sqlite3_free=a.asm.Ka).apply(null,arguments)};a._sqlite3_realloc=function(){return(a._sqlite3_realloc=a.asm.La).apply(null,arguments)};a._sqlite3_realloc64=function(){return(a._sqlite3_realloc64=a.asm.Ma).apply(null,arguments)};a._sqlite3_str_vappendf=function(){return(a._sqlite3_str_vappendf=a.asm.Na).apply(null,arguments)};a._sqlite3_str_append=function(){return(a._sqlite3_str_append=a.asm.Oa).apply(null,arguments)};
a._sqlite3_str_appendchar=function(){return(a._sqlite3_str_appendchar=a.asm.Pa).apply(null,arguments)};a._sqlite3_str_appendall=function(){return(a._sqlite3_str_appendall=a.asm.Qa).apply(null,arguments)};a._sqlite3_str_appendf=function(){return(a._sqlite3_str_appendf=a.asm.Ra).apply(null,arguments)};a._sqlite3_str_finish=function(){return(a._sqlite3_str_finish=a.asm.Sa).apply(null,arguments)};a._sqlite3_str_errcode=function(){return(a._sqlite3_str_errcode=a.asm.Ta).apply(null,arguments)};
a._sqlite3_str_length=function(){return(a._sqlite3_str_length=a.asm.Ua).apply(null,arguments)};a._sqlite3_str_value=function(){return(a._sqlite3_str_value=a.asm.Va).apply(null,arguments)};a._sqlite3_str_reset=function(){return(a._sqlite3_str_reset=a.asm.Wa).apply(null,arguments)};a._sqlite3_str_new=function(){return(a._sqlite3_str_new=a.asm.Xa).apply(null,arguments)};a._sqlite3_vmprintf=function(){return(a._sqlite3_vmprintf=a.asm.Ya).apply(null,arguments)};
a._sqlite3_mprintf=function(){return(a._sqlite3_mprintf=a.asm.Za).apply(null,arguments)};a._sqlite3_vsnprintf=function(){return(a._sqlite3_vsnprintf=a.asm._a).apply(null,arguments)};a._sqlite3_snprintf=function(){return(a._sqlite3_snprintf=a.asm.$a).apply(null,arguments)};a._sqlite3_log=function(){return(a._sqlite3_log=a.asm.ab).apply(null,arguments)};a._sqlite3_randomness=function(){return(a._sqlite3_randomness=a.asm.bb).apply(null,arguments)};
a._sqlite3_stricmp=function(){return(a._sqlite3_stricmp=a.asm.cb).apply(null,arguments)};a._sqlite3_strnicmp=function(){return(a._sqlite3_strnicmp=a.asm.db).apply(null,arguments)};a._sqlite3_os_init=function(){return(a._sqlite3_os_init=a.asm.eb).apply(null,arguments)};a._sqlite3_os_end=function(){return(a._sqlite3_os_end=a.asm.fb).apply(null,arguments)};a._sqlite3_serialize=function(){return(a._sqlite3_serialize=a.asm.gb).apply(null,arguments)};
a._sqlite3_prepare_v2=function(){return(a._sqlite3_prepare_v2=a.asm.hb).apply(null,arguments)};a._sqlite3_step=function(){return(a._sqlite3_step=a.asm.ib).apply(null,arguments)};a._sqlite3_column_int64=function(){return(a._sqlite3_column_int64=a.asm.jb).apply(null,arguments)};a._sqlite3_reset=function(){return(a._sqlite3_reset=a.asm.kb).apply(null,arguments)};a._sqlite3_exec=function(){return(a._sqlite3_exec=a.asm.lb).apply(null,arguments)};
a._sqlite3_column_int=function(){return(a._sqlite3_column_int=a.asm.mb).apply(null,arguments)};a._sqlite3_finalize=function(){return(a._sqlite3_finalize=a.asm.nb).apply(null,arguments)};a._sqlite3_deserialize=function(){return(a._sqlite3_deserialize=a.asm.ob).apply(null,arguments)};a._sqlite3_database_file_object=function(){return(a._sqlite3_database_file_object=a.asm.pb).apply(null,arguments)};a._sqlite3_backup_init=function(){return(a._sqlite3_backup_init=a.asm.qb).apply(null,arguments)};
a._sqlite3_backup_step=function(){return(a._sqlite3_backup_step=a.asm.rb).apply(null,arguments)};a._sqlite3_backup_finish=function(){return(a._sqlite3_backup_finish=a.asm.sb).apply(null,arguments)};a._sqlite3_backup_remaining=function(){return(a._sqlite3_backup_remaining=a.asm.tb).apply(null,arguments)};a._sqlite3_backup_pagecount=function(){return(a._sqlite3_backup_pagecount=a.asm.ub).apply(null,arguments)};
a._sqlite3_clear_bindings=function(){return(a._sqlite3_clear_bindings=a.asm.vb).apply(null,arguments)};a._sqlite3_value_blob=function(){return(a._sqlite3_value_blob=a.asm.wb).apply(null,arguments)};a._sqlite3_value_text=function(){return(a._sqlite3_value_text=a.asm.xb).apply(null,arguments)};a._sqlite3_value_bytes=function(){return(a._sqlite3_value_bytes=a.asm.yb).apply(null,arguments)};a._sqlite3_value_bytes16=function(){return(a._sqlite3_value_bytes16=a.asm.zb).apply(null,arguments)};
a._sqlite3_value_double=function(){return(a._sqlite3_value_double=a.asm.Ab).apply(null,arguments)};a._sqlite3_value_int=function(){return(a._sqlite3_value_int=a.asm.Bb).apply(null,arguments)};a._sqlite3_value_int64=function(){return(a._sqlite3_value_int64=a.asm.Cb).apply(null,arguments)};a._sqlite3_value_subtype=function(){return(a._sqlite3_value_subtype=a.asm.Db).apply(null,arguments)};a._sqlite3_value_pointer=function(){return(a._sqlite3_value_pointer=a.asm.Eb).apply(null,arguments)};
a._sqlite3_value_text16=function(){return(a._sqlite3_value_text16=a.asm.Fb).apply(null,arguments)};a._sqlite3_value_text16be=function(){return(a._sqlite3_value_text16be=a.asm.Gb).apply(null,arguments)};a._sqlite3_value_text16le=function(){return(a._sqlite3_value_text16le=a.asm.Hb).apply(null,arguments)};a._sqlite3_value_type=function(){return(a._sqlite3_value_type=a.asm.Ib).apply(null,arguments)};a._sqlite3_value_encoding=function(){return(a._sqlite3_value_encoding=a.asm.Jb).apply(null,arguments)};
a._sqlite3_value_nochange=function(){return(a._sqlite3_value_nochange=a.asm.Kb).apply(null,arguments)};a._sqlite3_value_frombind=function(){return(a._sqlite3_value_frombind=a.asm.Lb).apply(null,arguments)};a._sqlite3_value_dup=function(){return(a._sqlite3_value_dup=a.asm.Mb).apply(null,arguments)};a._sqlite3_value_free=function(){return(a._sqlite3_value_free=a.asm.Nb).apply(null,arguments)};a._sqlite3_result_blob=function(){return(a._sqlite3_result_blob=a.asm.Ob).apply(null,arguments)};
a._sqlite3_result_blob64=function(){return(a._sqlite3_result_blob64=a.asm.Pb).apply(null,arguments)};a._sqlite3_result_double=function(){return(a._sqlite3_result_double=a.asm.Qb).apply(null,arguments)};a._sqlite3_result_error=function(){return(a._sqlite3_result_error=a.asm.Rb).apply(null,arguments)};a._sqlite3_result_error16=function(){return(a._sqlite3_result_error16=a.asm.Sb).apply(null,arguments)};a._sqlite3_result_int=function(){return(a._sqlite3_result_int=a.asm.Tb).apply(null,arguments)};
a._sqlite3_result_int64=function(){return(a._sqlite3_result_int64=a.asm.Ub).apply(null,arguments)};a._sqlite3_result_null=function(){return(a._sqlite3_result_null=a.asm.Vb).apply(null,arguments)};a._sqlite3_result_pointer=function(){return(a._sqlite3_result_pointer=a.asm.Wb).apply(null,arguments)};a._sqlite3_result_subtype=function(){return(a._sqlite3_result_subtype=a.asm.Xb).apply(null,arguments)};a._sqlite3_result_text=function(){return(a._sqlite3_result_text=a.asm.Yb).apply(null,arguments)};
a._sqlite3_result_text64=function(){return(a._sqlite3_result_text64=a.asm.Zb).apply(null,arguments)};a._sqlite3_result_text16=function(){return(a._sqlite3_result_text16=a.asm._b).apply(null,arguments)};a._sqlite3_result_text16be=function(){return(a._sqlite3_result_text16be=a.asm.$b).apply(null,arguments)};a._sqlite3_result_text16le=function(){return(a._sqlite3_result_text16le=a.asm.ac).apply(null,arguments)};a._sqlite3_result_value=function(){return(a._sqlite3_result_value=a.asm.bc).apply(null,arguments)};
a._sqlite3_result_error_toobig=function(){return(a._sqlite3_result_error_toobig=a.asm.cc).apply(null,arguments)};a._sqlite3_result_zeroblob=function(){return(a._sqlite3_result_zeroblob=a.asm.dc).apply(null,arguments)};a._sqlite3_result_zeroblob64=function(){return(a._sqlite3_result_zeroblob64=a.asm.ec).apply(null,arguments)};a._sqlite3_result_error_code=function(){return(a._sqlite3_result_error_code=a.asm.fc).apply(null,arguments)};
a._sqlite3_result_error_nomem=function(){return(a._sqlite3_result_error_nomem=a.asm.gc).apply(null,arguments)};a._sqlite3_user_data=function(){return(a._sqlite3_user_data=a.asm.hc).apply(null,arguments)};a._sqlite3_context_db_handle=function(){return(a._sqlite3_context_db_handle=a.asm.ic).apply(null,arguments)};a._sqlite3_vtab_nochange=function(){return(a._sqlite3_vtab_nochange=a.asm.jc).apply(null,arguments)};
a._sqlite3_vtab_in_first=function(){return(a._sqlite3_vtab_in_first=a.asm.kc).apply(null,arguments)};a._sqlite3_vtab_in_next=function(){return(a._sqlite3_vtab_in_next=a.asm.lc).apply(null,arguments)};a._sqlite3_aggregate_context=function(){return(a._sqlite3_aggregate_context=a.asm.mc).apply(null,arguments)};a._sqlite3_get_auxdata=function(){return(a._sqlite3_get_auxdata=a.asm.nc).apply(null,arguments)};a._sqlite3_set_auxdata=function(){return(a._sqlite3_set_auxdata=a.asm.oc).apply(null,arguments)};
a._sqlite3_column_count=function(){return(a._sqlite3_column_count=a.asm.pc).apply(null,arguments)};a._sqlite3_data_count=function(){return(a._sqlite3_data_count=a.asm.qc).apply(null,arguments)};a._sqlite3_column_blob=function(){return(a._sqlite3_column_blob=a.asm.rc).apply(null,arguments)};a._sqlite3_column_bytes=function(){return(a._sqlite3_column_bytes=a.asm.sc).apply(null,arguments)};a._sqlite3_column_bytes16=function(){return(a._sqlite3_column_bytes16=a.asm.tc).apply(null,arguments)};
a._sqlite3_column_double=function(){return(a._sqlite3_column_double=a.asm.uc).apply(null,arguments)};a._sqlite3_column_text=function(){return(a._sqlite3_column_text=a.asm.vc).apply(null,arguments)};a._sqlite3_column_value=function(){return(a._sqlite3_column_value=a.asm.wc).apply(null,arguments)};a._sqlite3_column_text16=function(){return(a._sqlite3_column_text16=a.asm.xc).apply(null,arguments)};a._sqlite3_column_type=function(){return(a._sqlite3_column_type=a.asm.yc).apply(null,arguments)};
a._sqlite3_column_name=function(){return(a._sqlite3_column_name=a.asm.zc).apply(null,arguments)};a._sqlite3_column_name16=function(){return(a._sqlite3_column_name16=a.asm.Ac).apply(null,arguments)};a._sqlite3_bind_blob=function(){return(a._sqlite3_bind_blob=a.asm.Bc).apply(null,arguments)};a._sqlite3_bind_blob64=function(){return(a._sqlite3_bind_blob64=a.asm.Cc).apply(null,arguments)};a._sqlite3_bind_double=function(){return(a._sqlite3_bind_double=a.asm.Dc).apply(null,arguments)};
a._sqlite3_bind_int=function(){return(a._sqlite3_bind_int=a.asm.Ec).apply(null,arguments)};a._sqlite3_bind_int64=function(){return(a._sqlite3_bind_int64=a.asm.Fc).apply(null,arguments)};a._sqlite3_bind_null=function(){return(a._sqlite3_bind_null=a.asm.Gc).apply(null,arguments)};a._sqlite3_bind_pointer=function(){return(a._sqlite3_bind_pointer=a.asm.Hc).apply(null,arguments)};a._sqlite3_bind_text=function(){return(a._sqlite3_bind_text=a.asm.Ic).apply(null,arguments)};
a._sqlite3_bind_text64=function(){return(a._sqlite3_bind_text64=a.asm.Jc).apply(null,arguments)};a._sqlite3_bind_text16=function(){return(a._sqlite3_bind_text16=a.asm.Kc).apply(null,arguments)};a._sqlite3_bind_value=function(){return(a._sqlite3_bind_value=a.asm.Lc).apply(null,arguments)};a._sqlite3_bind_zeroblob=function(){return(a._sqlite3_bind_zeroblob=a.asm.Mc).apply(null,arguments)};a._sqlite3_bind_zeroblob64=function(){return(a._sqlite3_bind_zeroblob64=a.asm.Nc).apply(null,arguments)};
a._sqlite3_bind_parameter_count=function(){return(a._sqlite3_bind_parameter_count=a.asm.Oc).apply(null,arguments)};a._sqlite3_bind_parameter_name=function(){return(a._sqlite3_bind_parameter_name=a.asm.Pc).apply(null,arguments)};a._sqlite3_bind_parameter_index=function(){return(a._sqlite3_bind_parameter_index=a.asm.Qc).apply(null,arguments)};a._sqlite3_db_handle=function(){return(a._sqlite3_db_handle=a.asm.Rc).apply(null,arguments)};
a._sqlite3_stmt_readonly=function(){return(a._sqlite3_stmt_readonly=a.asm.Sc).apply(null,arguments)};a._sqlite3_stmt_isexplain=function(){return(a._sqlite3_stmt_isexplain=a.asm.Tc).apply(null,arguments)};a._sqlite3_stmt_explain=function(){return(a._sqlite3_stmt_explain=a.asm.Uc).apply(null,arguments)};a._sqlite3_stmt_busy=function(){return(a._sqlite3_stmt_busy=a.asm.Vc).apply(null,arguments)};a._sqlite3_next_stmt=function(){return(a._sqlite3_next_stmt=a.asm.Wc).apply(null,arguments)};
a._sqlite3_stmt_status=function(){return(a._sqlite3_stmt_status=a.asm.Xc).apply(null,arguments)};a._sqlite3_sql=function(){return(a._sqlite3_sql=a.asm.Yc).apply(null,arguments)};a._sqlite3_expanded_sql=function(){return(a._sqlite3_expanded_sql=a.asm.Zc).apply(null,arguments)};a._sqlite3_value_numeric_type=function(){return(a._sqlite3_value_numeric_type=a.asm._c).apply(null,arguments)};a._sqlite3_blob_open=function(){return(a._sqlite3_blob_open=a.asm.$c).apply(null,arguments)};
a._sqlite3_blob_close=function(){return(a._sqlite3_blob_close=a.asm.ad).apply(null,arguments)};a._sqlite3_blob_read=function(){return(a._sqlite3_blob_read=a.asm.bd).apply(null,arguments)};a._sqlite3_blob_write=function(){return(a._sqlite3_blob_write=a.asm.cd).apply(null,arguments)};a._sqlite3_blob_bytes=function(){return(a._sqlite3_blob_bytes=a.asm.dd).apply(null,arguments)};a._sqlite3_blob_reopen=function(){return(a._sqlite3_blob_reopen=a.asm.ed).apply(null,arguments)};
a._sqlite3_set_authorizer=function(){return(a._sqlite3_set_authorizer=a.asm.fd).apply(null,arguments)};a._sqlite3_strglob=function(){return(a._sqlite3_strglob=a.asm.gd).apply(null,arguments)};a._sqlite3_strlike=function(){return(a._sqlite3_strlike=a.asm.hd).apply(null,arguments)};a._sqlite3_errmsg=function(){return(a._sqlite3_errmsg=a.asm.id).apply(null,arguments)};a._sqlite3_auto_extension=function(){return(a._sqlite3_auto_extension=a.asm.jd).apply(null,arguments)};
a._sqlite3_cancel_auto_extension=function(){return(a._sqlite3_cancel_auto_extension=a.asm.kd).apply(null,arguments)};a._sqlite3_reset_auto_extension=function(){return(a._sqlite3_reset_auto_extension=a.asm.ld).apply(null,arguments)};a._sqlite3_prepare=function(){return(a._sqlite3_prepare=a.asm.md).apply(null,arguments)};a._sqlite3_prepare_v3=function(){return(a._sqlite3_prepare_v3=a.asm.nd).apply(null,arguments)};a._sqlite3_prepare16=function(){return(a._sqlite3_prepare16=a.asm.od).apply(null,arguments)};
a._sqlite3_prepare16_v2=function(){return(a._sqlite3_prepare16_v2=a.asm.pd).apply(null,arguments)};a._sqlite3_prepare16_v3=function(){return(a._sqlite3_prepare16_v3=a.asm.qd).apply(null,arguments)};a._sqlite3_get_table=function(){return(a._sqlite3_get_table=a.asm.rd).apply(null,arguments)};a._sqlite3_free_table=function(){return(a._sqlite3_free_table=a.asm.sd).apply(null,arguments)};a._sqlite3_create_module=function(){return(a._sqlite3_create_module=a.asm.td).apply(null,arguments)};
a._sqlite3_create_module_v2=function(){return(a._sqlite3_create_module_v2=a.asm.ud).apply(null,arguments)};a._sqlite3_drop_modules=function(){return(a._sqlite3_drop_modules=a.asm.vd).apply(null,arguments)};a._sqlite3_declare_vtab=function(){return(a._sqlite3_declare_vtab=a.asm.wd).apply(null,arguments)};a._sqlite3_vtab_on_conflict=function(){return(a._sqlite3_vtab_on_conflict=a.asm.xd).apply(null,arguments)};a._sqlite3_vtab_config=function(){return(a._sqlite3_vtab_config=a.asm.yd).apply(null,arguments)};
a._sqlite3_vtab_collation=function(){return(a._sqlite3_vtab_collation=a.asm.zd).apply(null,arguments)};a._sqlite3_vtab_in=function(){return(a._sqlite3_vtab_in=a.asm.Ad).apply(null,arguments)};a._sqlite3_vtab_rhs_value=function(){return(a._sqlite3_vtab_rhs_value=a.asm.Bd).apply(null,arguments)};a._sqlite3_vtab_distinct=function(){return(a._sqlite3_vtab_distinct=a.asm.Cd).apply(null,arguments)};a._sqlite3_keyword_name=function(){return(a._sqlite3_keyword_name=a.asm.Dd).apply(null,arguments)};
a._sqlite3_keyword_count=function(){return(a._sqlite3_keyword_count=a.asm.Ed).apply(null,arguments)};a._sqlite3_keyword_check=function(){return(a._sqlite3_keyword_check=a.asm.Fd).apply(null,arguments)};a._sqlite3_complete=function(){return(a._sqlite3_complete=a.asm.Gd).apply(null,arguments)};a._sqlite3_complete16=function(){return(a._sqlite3_complete16=a.asm.Hd).apply(null,arguments)};a._sqlite3_libversion=function(){return(a._sqlite3_libversion=a.asm.Id).apply(null,arguments)};
a._sqlite3_libversion_number=function(){return(a._sqlite3_libversion_number=a.asm.Jd).apply(null,arguments)};a._sqlite3_threadsafe=function(){return(a._sqlite3_threadsafe=a.asm.Kd).apply(null,arguments)};a._sqlite3_initialize=function(){return(a._sqlite3_initialize=a.asm.Ld).apply(null,arguments)};a._sqlite3_shutdown=function(){return(a._sqlite3_shutdown=a.asm.Md).apply(null,arguments)};a._sqlite3_config=function(){return(a._sqlite3_config=a.asm.Nd).apply(null,arguments)};
a._sqlite3_db_mutex=function(){return(a._sqlite3_db_mutex=a.asm.Od).apply(null,arguments)};a._sqlite3_db_release_memory=function(){return(a._sqlite3_db_release_memory=a.asm.Pd).apply(null,arguments)};a._sqlite3_db_cacheflush=function(){return(a._sqlite3_db_cacheflush=a.asm.Qd).apply(null,arguments)};a._sqlite3_db_config=function(){return(a._sqlite3_db_config=a.asm.Rd).apply(null,arguments)};a._sqlite3_last_insert_rowid=function(){return(a._sqlite3_last_insert_rowid=a.asm.Sd).apply(null,arguments)};
a._sqlite3_set_last_insert_rowid=function(){return(a._sqlite3_set_last_insert_rowid=a.asm.Td).apply(null,arguments)};a._sqlite3_changes64=function(){return(a._sqlite3_changes64=a.asm.Ud).apply(null,arguments)};a._sqlite3_changes=function(){return(a._sqlite3_changes=a.asm.Vd).apply(null,arguments)};a._sqlite3_total_changes64=function(){return(a._sqlite3_total_changes64=a.asm.Wd).apply(null,arguments)};a._sqlite3_total_changes=function(){return(a._sqlite3_total_changes=a.asm.Xd).apply(null,arguments)};
a._sqlite3_txn_state=function(){return(a._sqlite3_txn_state=a.asm.Yd).apply(null,arguments)};a._sqlite3_close=function(){return(a._sqlite3_close=a.asm.Zd).apply(null,arguments)};a._sqlite3_close_v2=function(){return(a._sqlite3_close_v2=a.asm._d).apply(null,arguments)};a._sqlite3_busy_handler=function(){return(a._sqlite3_busy_handler=a.asm.$d).apply(null,arguments)};a._sqlite3_progress_handler=function(){return(a._sqlite3_progress_handler=a.asm.ae).apply(null,arguments)};
a._sqlite3_busy_timeout=function(){return(a._sqlite3_busy_timeout=a.asm.be).apply(null,arguments)};a._sqlite3_interrupt=function(){return(a._sqlite3_interrupt=a.asm.ce).apply(null,arguments)};a._sqlite3_is_interrupted=function(){return(a._sqlite3_is_interrupted=a.asm.de).apply(null,arguments)};a._sqlite3_create_function=function(){return(a._sqlite3_create_function=a.asm.ee).apply(null,arguments)};a._sqlite3_create_function_v2=function(){return(a._sqlite3_create_function_v2=a.asm.fe).apply(null,arguments)};
a._sqlite3_create_window_function=function(){return(a._sqlite3_create_window_function=a.asm.ge).apply(null,arguments)};a._sqlite3_create_function16=function(){return(a._sqlite3_create_function16=a.asm.he).apply(null,arguments)};a._sqlite3_overload_function=function(){return(a._sqlite3_overload_function=a.asm.ie).apply(null,arguments)};a._sqlite3_trace_v2=function(){return(a._sqlite3_trace_v2=a.asm.je).apply(null,arguments)};
a._sqlite3_commit_hook=function(){return(a._sqlite3_commit_hook=a.asm.ke).apply(null,arguments)};a._sqlite3_update_hook=function(){return(a._sqlite3_update_hook=a.asm.le).apply(null,arguments)};a._sqlite3_rollback_hook=function(){return(a._sqlite3_rollback_hook=a.asm.me).apply(null,arguments)};a._sqlite3_autovacuum_pages=function(){return(a._sqlite3_autovacuum_pages=a.asm.ne).apply(null,arguments)};
a._sqlite3_wal_autocheckpoint=function(){return(a._sqlite3_wal_autocheckpoint=a.asm.oe).apply(null,arguments)};a._sqlite3_wal_hook=function(){return(a._sqlite3_wal_hook=a.asm.pe).apply(null,arguments)};a._sqlite3_wal_checkpoint_v2=function(){return(a._sqlite3_wal_checkpoint_v2=a.asm.qe).apply(null,arguments)};a._sqlite3_wal_checkpoint=function(){return(a._sqlite3_wal_checkpoint=a.asm.re).apply(null,arguments)};
a._sqlite3_error_offset=function(){return(a._sqlite3_error_offset=a.asm.se).apply(null,arguments)};a._sqlite3_errmsg16=function(){return(a._sqlite3_errmsg16=a.asm.te).apply(null,arguments)};a._sqlite3_errcode=function(){return(a._sqlite3_errcode=a.asm.ue).apply(null,arguments)};a._sqlite3_extended_errcode=function(){return(a._sqlite3_extended_errcode=a.asm.ve).apply(null,arguments)};a._sqlite3_system_errno=function(){return(a._sqlite3_system_errno=a.asm.we).apply(null,arguments)};
a._sqlite3_errstr=function(){return(a._sqlite3_errstr=a.asm.xe).apply(null,arguments)};a._sqlite3_limit=function(){return(a._sqlite3_limit=a.asm.ye).apply(null,arguments)};a._sqlite3_open=function(){return(a._sqlite3_open=a.asm.ze).apply(null,arguments)};a._sqlite3_open_v2=function(){return(a._sqlite3_open_v2=a.asm.Ae).apply(null,arguments)};a._sqlite3_open16=function(){return(a._sqlite3_open16=a.asm.Be).apply(null,arguments)};
a._sqlite3_create_collation=function(){return(a._sqlite3_create_collation=a.asm.Ce).apply(null,arguments)};a._sqlite3_create_collation_v2=function(){return(a._sqlite3_create_collation_v2=a.asm.De).apply(null,arguments)};a._sqlite3_create_collation16=function(){return(a._sqlite3_create_collation16=a.asm.Ee).apply(null,arguments)};a._sqlite3_collation_needed=function(){return(a._sqlite3_collation_needed=a.asm.Fe).apply(null,arguments)};
a._sqlite3_collation_needed16=function(){return(a._sqlite3_collation_needed16=a.asm.Ge).apply(null,arguments)};a._sqlite3_get_clientdata=function(){return(a._sqlite3_get_clientdata=a.asm.He).apply(null,arguments)};a._sqlite3_set_clientdata=function(){return(a._sqlite3_set_clientdata=a.asm.Ie).apply(null,arguments)};a._sqlite3_get_autocommit=function(){return(a._sqlite3_get_autocommit=a.asm.Je).apply(null,arguments)};
a._sqlite3_table_column_metadata=function(){return(a._sqlite3_table_column_metadata=a.asm.Ke).apply(null,arguments)};a._sqlite3_sleep=function(){return(a._sqlite3_sleep=a.asm.Le).apply(null,arguments)};a._sqlite3_extended_result_codes=function(){return(a._sqlite3_extended_result_codes=a.asm.Me).apply(null,arguments)};a._sqlite3_file_control=function(){return(a._sqlite3_file_control=a.asm.Ne).apply(null,arguments)};
a._sqlite3_test_control=function(){return(a._sqlite3_test_control=a.asm.Oe).apply(null,arguments)};a._sqlite3_create_filename=function(){return(a._sqlite3_create_filename=a.asm.Pe).apply(null,arguments)};a._sqlite3_free_filename=function(){return(a._sqlite3_free_filename=a.asm.Qe).apply(null,arguments)};a._sqlite3_uri_parameter=function(){return(a._sqlite3_uri_parameter=a.asm.Re).apply(null,arguments)};a._sqlite3_uri_key=function(){return(a._sqlite3_uri_key=a.asm.Se).apply(null,arguments)};
a._sqlite3_uri_boolean=function(){return(a._sqlite3_uri_boolean=a.asm.Te).apply(null,arguments)};a._sqlite3_uri_int64=function(){return(a._sqlite3_uri_int64=a.asm.Ue).apply(null,arguments)};a._sqlite3_filename_database=function(){return(a._sqlite3_filename_database=a.asm.Ve).apply(null,arguments)};a._sqlite3_filename_journal=function(){return(a._sqlite3_filename_journal=a.asm.We).apply(null,arguments)};a._sqlite3_filename_wal=function(){return(a._sqlite3_filename_wal=a.asm.Xe).apply(null,arguments)};
a._sqlite3_db_name=function(){return(a._sqlite3_db_name=a.asm.Ye).apply(null,arguments)};a._sqlite3_db_filename=function(){return(a._sqlite3_db_filename=a.asm.Ze).apply(null,arguments)};a._sqlite3_db_readonly=function(){return(a._sqlite3_db_readonly=a.asm._e).apply(null,arguments)};a._sqlite3_compileoption_used=function(){return(a._sqlite3_compileoption_used=a.asm.$e).apply(null,arguments)};a._sqlite3_compileoption_get=function(){return(a._sqlite3_compileoption_get=a.asm.af).apply(null,arguments)};
a._sqlite3_sourceid=function(){return(a._sqlite3_sourceid=a.asm.bf).apply(null,arguments)};a._sqlite3mc_config=function(){return(a._sqlite3mc_config=a.asm.cf).apply(null,arguments)};a._sqlite3mc_cipher_count=function(){return(a._sqlite3mc_cipher_count=a.asm.df).apply(null,arguments)};a._sqlite3mc_cipher_index=function(){return(a._sqlite3mc_cipher_index=a.asm.ef).apply(null,arguments)};a._sqlite3mc_cipher_name=function(){return(a._sqlite3mc_cipher_name=a.asm.ff).apply(null,arguments)};
a._sqlite3mc_config_cipher=function(){return(a._sqlite3mc_config_cipher=a.asm.gf).apply(null,arguments)};a._sqlite3mc_codec_data=function(){return(a._sqlite3mc_codec_data=a.asm.hf).apply(null,arguments)};a._sqlite3_key=function(){return(a._sqlite3_key=a.asm.jf).apply(null,arguments)};a._sqlite3_key_v2=function(){return(a._sqlite3_key_v2=a.asm.kf).apply(null,arguments)};a._sqlite3_rekey_v2=function(){return(a._sqlite3_rekey_v2=a.asm.lf).apply(null,arguments)};
a._sqlite3_rekey=function(){return(a._sqlite3_rekey=a.asm.mf).apply(null,arguments)};a._sqlite3mc_register_cipher=function(){return(a._sqlite3mc_register_cipher=a.asm.nf).apply(null,arguments)};var kd=a.___errno_location=function(){return(kd=a.___errno_location=a.asm.of).apply(null,arguments)},Rb=a._malloc=function(){return(Rb=a._malloc=a.asm.pf).apply(null,arguments)},$c=a._free=function(){return($c=a._free=a.asm.qf).apply(null,arguments)};
a._RegisterExtensionFunctions=function(){return(a._RegisterExtensionFunctions=a.asm.rf).apply(null,arguments)};a._sqlite3Fts5BetterTrigramInit=function(){return(a._sqlite3Fts5BetterTrigramInit=a.asm.sf).apply(null,arguments)};a._sqlite3Fts5HtmlInit=function(){return(a._sqlite3Fts5HtmlInit=a.asm.tf).apply(null,arguments)};a._set_authorizer=function(){return(a._set_authorizer=a.asm.uf).apply(null,arguments)};a._create_function=function(){return(a._create_function=a.asm.vf).apply(null,arguments)};
a._create_module=function(){return(a._create_module=a.asm.wf).apply(null,arguments)};a._progress_handler=function(){return(a._progress_handler=a.asm.xf).apply(null,arguments)};a._register_vfs=function(){return(a._register_vfs=a.asm.yf).apply(null,arguments)};a._getSqliteFree=function(){return(a._getSqliteFree=a.asm.zf).apply(null,arguments)};a._main=function(){return(a._main=a.asm.Af).apply(null,arguments)};
var ab=a._emscripten_builtin_memalign=function(){return(ab=a._emscripten_builtin_memalign=a.asm.Bf).apply(null,arguments)},md=a.getTempRet0=function(){return(md=a.getTempRet0=a.asm.Df).apply(null,arguments)},hd=a.stackSave=function(){return(hd=a.stackSave=a.asm.Ef).apply(null,arguments)},fd=a.stackRestore=function(){return(fd=a.stackRestore=a.asm.Ff).apply(null,arguments)},gd=a.stackAlloc=function(){return(gd=a.stackAlloc=a.asm.Gf).apply(null,arguments)},Yc=a._asyncify_start_unwind=function(){return(Yc=
a._asyncify_start_unwind=a.asm.Hf).apply(null,arguments)},Mc=a._asyncify_stop_unwind=function(){return(Mc=a._asyncify_stop_unwind=a.asm.If).apply(null,arguments)},Wc=a._asyncify_start_rewind=function(){return(Wc=a._asyncify_start_rewind=a.asm.Jf).apply(null,arguments)},Zc=a._asyncify_stop_rewind=function(){return(Zc=a._asyncify_stop_rewind=a.asm.Kf).apply(null,arguments)};a._sqlite3_version=3232;a.UTF8ToString=x;a.stringToUTF8=qa;a.lengthBytesUTF8=ra;a.getTempRet0=md;a.ccall=Z;
a.cwrap=function(b,c,d,e){d=d||[];var f=d.every(g=>"number"===g||"boolean"===g);return"string"!==c&&f&&!e?a["_"+b]:function(){return Z(b,c,d,arguments,e)}};
a.addFunction=function(b,c){if(!cd){cd=new WeakMap;var d=wa.length;if(cd)for(var e=0;e<0+d;e++){var f=wa.get(e);f&&cd.set(f,e)}}if(cd.has(b))return cd.get(b);if(dd.length)d=dd.pop();else{try{wa.grow(1)}catch(n){if(!(n instanceof RangeError))throw n;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}d=wa.length-1}try{wa.set(d,b)}catch(n){if(!(n instanceof TypeError))throw n;if("function"==typeof WebAssembly.Function){e=WebAssembly.Function;f={i:"i32",j:"i32",f:"f32",d:"f64",p:"i32"};for(var g=
{parameters:[],results:"v"==c[0]?[]:[f[c[0]]]},h=1;h<c.length;++h)g.parameters.push(f[c[h]]),"j"===c[h]&&g.parameters.push("i32");c=new e(g,b)}else{e=[1];f=c.slice(0,1);c=c.slice(1);g={i:127,p:127,j:126,f:125,d:124};e.push(96);h=c.length;128>h?e.push(h):e.push(h%128|128,h>>7);for(h=0;h<c.length;++h)e.push(g[c[h]]);"v"==f?e.push(0):e.push(1,g[f]);c=[0,97,115,109,1,0,0,0,1];f=e.length;128>f?c.push(f):c.push(f%128|128,f>>7);c.push.apply(c,e);c.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);c=new WebAssembly.Module(new Uint8Array(c));
c=(new WebAssembly.Instance(c,{e:{f:b}})).exports.f}wa.set(d,c)}cd.set(b,d);return d};a.setValue=M;a.getValue=L;a.intArrayFromString=Qa;a.intArrayToString=function(b){for(var c=[],d=0;d<b.length;d++){var e=b[d];255<e&&(e&=255);c.push(String.fromCharCode(e))}return c.join("")};a.AsciiToString=function(b){for(var c="";;){var d=y[b++>>0];if(!d)return c;c+=String.fromCharCode(d)}};
a.UTF16ToString=function(b,c){var d=b>>1;for(var e=d+c/2;!(d>=e)&&sa[d];)++d;d<<=1;if(32<d-b&&jd)return jd.decode(y.subarray(b,d));d="";for(e=0;!(e>=c/2);++e){var f=B[b+2*e>>1];if(0==f)break;d+=String.fromCharCode(f)}return d};a.stringToUTF16=function(b,c,d){void 0===d&&(d=2147483647);if(2>d)return 0;d-=2;var e=c;d=d<2*b.length?d/2:b.length;for(var f=0;f<d;++f)B[c>>1]=b.charCodeAt(f),c+=2;B[c>>1]=0;return c-e};
a.UTF32ToString=function(b,c){for(var d=0,e="";!(d>=c/4);){var f=C[b+4*d>>2];if(0==f)break;++d;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e};a.stringToUTF32=function(b,c,d){void 0===d&&(d=2147483647);if(4>d)return 0;var e=c;d=e+d-4;for(var f=0;f<b.length;++f){var g=b.charCodeAt(f);if(55296<=g&&57343>=g){var h=b.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}C[c>>2]=g;c+=4;if(c+4>d)break}C[c>>2]=0;return c-e};a.writeArrayToMemory=ed;var nd;
Ea=function od(){nd||pd();nd||(Ea=od)};
function pd(){function b(){if(!nd&&(nd=!0,a.calledRun=!0,!v)){a.noFSInit||Fb||(Fb=!0,Eb(),a.stdin=a.stdin,a.stdout=a.stdout,a.stderr=a.stderr,a.stdin?Ib("stdin",a.stdin):vb("/dev/tty","/dev/stdin"),a.stdout?Ib("stdout",null,a.stdout):vb("/dev/tty","/dev/stdout"),a.stderr?Ib("stderr",null,a.stderr):vb("/dev/tty1","/dev/stderr"),Cb("/dev/stdin",0),Cb("/dev/stdout",1),Cb("/dev/stderr",1));eb=!1;Ka(ya);Ka(za);aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(qd){var c=a._main;try{var d=c(0,
0);if(!noExitRuntime){if(a.onExit)a.onExit(d);v=!0}ea(d,new Ja(d))}catch(e){Ic(e)}}if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)c=a.postRun.shift(),Aa.unshift(c);Ka(Aa)}}if(!(0<Ca)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)Ba();Ka(xa);0<Ca||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();var qd=!0;a.noInitialRun&&(qd=!1);pd();
return Module.ready
}
);
})();
export default Module;
export default Module;

View File

@@ -1,144 +1,162 @@
var Module = (() => {
var _scriptName = import.meta.url;
var _scriptDir = import.meta.url;
return (
function(moduleArg = {}) {
var moduleRtn;
var d=moduleArg,aa,ba,ca=new Promise((a,b)=>{aa=a;ba=b}),da="object"==typeof window,ea="undefined"!=typeof WorkerGlobalScope,fa=Object.assign({},d),ia="./this.program",g="",ja,ka;
if(da||ea)ea?g=self.location.href:"undefined"!=typeof document&&document.currentScript&&(g=document.currentScript.src),_scriptName&&(g=_scriptName),g.startsWith("blob:")?g="":g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1),ea&&(ka=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),ja=a=>fetch(a,{credentials:"same-origin"}).then(b=>b.ok?b.arrayBuffer():Promise.reject(Error(b.status+" : "+b.url)));
var la=d.print||console.log.bind(console),r=d.printErr||console.error.bind(console);Object.assign(d,fa);fa=null;d.thisProgram&&(ia=d.thisProgram);var ma=d.wasmBinary,na,oa=!1,pa,u,v,w,qa,x,z,ra,sa;function ta(){var a=na.buffer;d.HEAP8=u=new Int8Array(a);d.HEAP16=w=new Int16Array(a);d.HEAPU8=v=new Uint8Array(a);d.HEAPU16=qa=new Uint16Array(a);d.HEAP32=x=new Int32Array(a);d.HEAPU32=z=new Uint32Array(a);d.HEAPF32=ra=new Float32Array(a);d.HEAPF64=sa=new Float64Array(a)}var ua=[],va=[],wa=[],xa=[];
function ya(){var a=d.preRun.shift();ua.unshift(a)}var B=0,za=null,Aa=null;function C(a){d.onAbort?.(a);a="Aborted("+a+")";r(a);oa=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ba(a);throw a;}var Ba=a=>a.startsWith("data:application/octet-stream;base64,"),Ca;function Da(a){if(a==Ca&&ma)return new Uint8Array(ma);if(ka)return ka(a);throw"both async and sync fetching of the wasm failed";}
function Ea(a){return ma?Promise.resolve().then(()=>Da(a)):ja(a).then(b=>new Uint8Array(b),()=>Da(a))}function Fa(a,b,c){return Ea(a).then(e=>WebAssembly.instantiate(e,b)).then(c,e=>{r(`failed to asynchronously prepare wasm: ${e}`);C(e)})}
function Ga(a,b){var c=Ca;return ma||"function"!=typeof WebAssembly.instantiateStreaming||Ba(c)||"function"!=typeof fetch?Fa(c,a,b):fetch(c,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(f){r(`wasm streaming compile failed: ${f}`);r("falling back to ArrayBuffer instantiation");return Fa(c,a,b)}))}var D,F;class Ha{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}var Ia=a=>{for(;0<a.length;)a.shift()(d)};
function H(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return u[a];case "i8":return u[a];case "i16":return w[a>>1];case "i32":return x[a>>2];case "i64":C("to do getValue(i64) use WASM_BIGINT");case "float":return ra[a>>2];case "double":return sa[a>>3];case "*":return z[a>>2];default:C(`invalid type for getValue: ${b}`)}}var Ja=d.noExitRuntime||!0;
function I(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":u[a]=b;break;case "i8":u[a]=b;break;case "i16":w[a>>1]=b;break;case "i32":x[a>>2]=b;break;case "i64":C("to do setValue(i64) use WASM_BIGINT");case "float":ra[a>>2]=b;break;case "double":sa[a>>3]=b;break;case "*":z[a>>2]=b;break;default:C(`invalid type for setValue: ${c}`)}}
var Ka="undefined"!=typeof TextDecoder?new TextDecoder:void 0,J=(a,b=0,c=NaN)=>{var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.buffer&&Ka)return Ka.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var h=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|h);else{var k=a[b++]&63;f=224==(f&240)?(f&15)<<12|h<<6|k:(f&7)<<18|h<<12|k<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e},
La=(a,b)=>{for(var c=0,e=a.length-1;0<=e;e--){var f=a[e];"."===f?a.splice(e,1):".."===f?(a.splice(e,1),c++):c&&(a.splice(e,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},Ma=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=La(a.split("/").filter(e=>!!e),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},Na=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&=b.substr(0,b.length-1);return a+b},Oa=a=>{if("/"===
a)return"/";a=Ma(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)},Pa=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return a=>crypto.getRandomValues(a);C("initRandomDevice")},Qa=a=>(Qa=Pa())(a),Ra=(...a)=>{for(var b="",c=!1,e=a.length-1;-1<=e&&!c;e--){c=0<=e?a[e]:"/";if("string"!=typeof c)throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";b=c+"/"+b;c="/"===c.charAt(0)}b=La(b.split("/").filter(f=>!!f),!c).join("/");
return(c?"/":"")+b||"."},Sa=[],Ta=a=>{for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++c):b+=3}return b},K=(a,b,c,e)=>{if(!(0<e))return 0;var f=c;e=c+e-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var n=a.charCodeAt(++h);k=65536+((k&1023)<<10)|n&1023}if(127>=k){if(c>=e)break;b[c++]=k}else{if(2047>=k){if(c+1>=e)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=e)break;b[c++]=224|k>>12}else{if(c+3>=e)break;b[c++]=240|
k>>18;b[c++]=128|k>>12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-f};function Ua(a,b,c){c=Array(0<c?c:Ta(a)+1);a=K(a,c,0,c.length);b&&(c.length=a);return c}var Va=[];function Wa(a,b){Va[a]={input:[],Pf:[],ag:b};Xa(a,Ya)}
var Ya={open(a){var b=Va[a.node.dg];if(!b)throw new N(43);a.Qf=b;a.seekable=!1},close(a){a.Qf.ag.Yf(a.Qf)},Yf(a){a.Qf.ag.Yf(a.Qf)},read(a,b,c,e){if(!a.Qf||!a.Qf.ag.tg)throw new N(60);for(var f=0,h=0;h<e;h++){try{var k=a.Qf.ag.tg(a.Qf)}catch(n){throw new N(29);}if(void 0===k&&0===f)throw new N(6);if(null===k||void 0===k)break;f++;b[c+h]=k}f&&(a.node.timestamp=Date.now());return f},write(a,b,c,e){if(!a.Qf||!a.Qf.ag.ng)throw new N(60);try{for(var f=0;f<e;f++)a.Qf.ag.ng(a.Qf,b[c+f])}catch(h){throw new N(29);
}e&&(a.node.timestamp=Date.now());return f}},Za={tg(){a:{if(!Sa.length){var a=null;"undefined"!=typeof window&&"function"==typeof window.prompt&&(a=window.prompt("Input: "),null!==a&&(a+="\n"));if(!a){a=null;break a}Sa=Ua(a,!0)}a=Sa.shift()}return a},ng(a,b){null===b||10===b?(la(J(a.Pf)),a.Pf=[]):0!=b&&a.Pf.push(b)},Yf(a){a.Pf&&0<a.Pf.length&&(la(J(a.Pf)),a.Pf=[])},Ug(){return{Pg:25856,Rg:5,Og:191,Qg:35387,Ng:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},Vg(){return 0},
Wg(){return[24,80]}},$a={ng(a,b){null===b||10===b?(r(J(a.Pf)),a.Pf=[]):0!=b&&a.Pf.push(b)},Yf(a){a.Pf&&0<a.Pf.length&&(r(J(a.Pf)),a.Pf=[])}};function ab(a,b){var c=a.Lf?a.Lf.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Lf,a.Lf=new Uint8Array(b),0<a.Nf&&a.Lf.set(c.subarray(0,a.Nf),0))}
var O={Sf:null,Tf(){return O.createNode(null,"/",16895,0)},createNode(a,b,c,e){if(24576===(c&61440)||4096===(c&61440))throw new N(63);O.Sf||(O.Sf={dir:{node:{Rf:O.Jf.Rf,Of:O.Jf.Of,bg:O.Jf.bg,gg:O.Jf.gg,zg:O.Jf.zg,lg:O.Jf.lg,jg:O.Jf.jg,yg:O.Jf.yg,kg:O.Jf.kg},stream:{Xf:O.Kf.Xf}},file:{node:{Rf:O.Jf.Rf,Of:O.Jf.Of},stream:{Xf:O.Kf.Xf,read:O.Kf.read,write:O.Kf.write,qg:O.Kf.qg,hg:O.Kf.hg,ig:O.Kf.ig}},link:{node:{Rf:O.Jf.Rf,Of:O.Jf.Of,eg:O.Jf.eg},stream:{}},rg:{node:{Rf:O.Jf.Rf,Of:O.Jf.Of},stream:bb}});
c=cb(a,b,c,e);P(c.mode)?(c.Jf=O.Sf.dir.node,c.Kf=O.Sf.dir.stream,c.Lf={}):32768===(c.mode&61440)?(c.Jf=O.Sf.file.node,c.Kf=O.Sf.file.stream,c.Nf=0,c.Lf=null):40960===(c.mode&61440)?(c.Jf=O.Sf.link.node,c.Kf=O.Sf.link.stream):8192===(c.mode&61440)&&(c.Jf=O.Sf.rg.node,c.Kf=O.Sf.rg.stream);c.timestamp=Date.now();a&&(a.Lf[b]=c,a.timestamp=c.timestamp);return c},Tg(a){return a.Lf?a.Lf.subarray?a.Lf.subarray(0,a.Nf):new Uint8Array(a.Lf):new Uint8Array(0)},Jf:{Rf(a){var b={};b.Fg=8192===(a.mode&61440)?a.id:
1;b.vg=a.id;b.mode=a.mode;b.Kg=1;b.uid=0;b.Hg=0;b.dg=a.dg;P(a.mode)?b.size=4096:32768===(a.mode&61440)?b.size=a.Nf:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.Bg=new Date(a.timestamp);b.Jg=new Date(a.timestamp);b.Eg=new Date(a.timestamp);b.Cg=4096;b.Dg=Math.ceil(b.size/b.Cg);return b},Of(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);if(void 0!==b.size&&(b=b.size,a.Nf!=b))if(0==b)a.Lf=null,a.Nf=0;else{var c=a.Lf;a.Lf=new Uint8Array(b);c&&a.Lf.set(c.subarray(0,
Math.min(b,a.Nf)));a.Nf=b}},bg(){throw db[44];},gg(a,b,c,e){return O.createNode(a,b,c,e)},zg(a,b,c){if(P(a.mode)){try{var e=Q(b,c)}catch(h){}if(e)for(var f in e.Lf)throw new N(55);}delete a.parent.Lf[a.name];a.parent.timestamp=Date.now();a.name=c;b.Lf[c]=a;b.timestamp=a.parent.timestamp},lg(a,b){delete a.Lf[b];a.timestamp=Date.now()},jg(a,b){var c=Q(a,b),e;for(e in c.Lf)throw new N(55);delete a.Lf[b];a.timestamp=Date.now()},yg(a){var b=[".",".."],c;for(c of Object.keys(a.Lf))b.push(c);return b},kg(a,
b,c){a=O.createNode(a,b,41471,0);a.link=c;return a},eg(a){if(40960!==(a.mode&61440))throw new N(28);return a.link}},Kf:{read(a,b,c,e,f){var h=a.node.Lf;if(f>=a.node.Nf)return 0;a=Math.min(a.node.Nf-f,e);if(8<a&&h.subarray)b.set(h.subarray(f,f+a),c);else for(e=0;e<a;e++)b[c+e]=h[f+e];return a},write(a,b,c,e,f,h){b.buffer===u.buffer&&(h=!1);if(!e)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Lf||a.Lf.subarray)){if(h)return a.Lf=b.subarray(c,c+e),a.Nf=e;if(0===a.Nf&&0===f)return a.Lf=b.slice(c,
c+e),a.Nf=e;if(f+e<=a.Nf)return a.Lf.set(b.subarray(c,c+e),f),e}ab(a,f+e);if(a.Lf.subarray&&b.subarray)a.Lf.set(b.subarray(c,c+e),f);else for(h=0;h<e;h++)a.Lf[f+h]=b[c+h];a.Nf=Math.max(a.Nf,f+e);return e},Xf(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Nf);if(0>b)throw new N(28);return b},qg(a,b,c){ab(a.node,b+c);a.node.Nf=Math.max(a.node.Nf,b+c)},hg(a,b,c,e,f){if(32768!==(a.node.mode&61440))throw new N(43);a=a.node.Lf;if(f&2||!a||a.buffer!==u.buffer){f=!0;e=65536*Math.ceil(b/
65536);var h=eb(65536,e);h&&v.fill(0,h,h+e);e=h;if(!e)throw new N(48);if(a){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,c,c+b);u.set(a,e)}}else f=!1,e=a.byteOffset;return{Lg:e,Ag:f}},ig(a,b,c,e){O.Kf.write(a,b,0,e,c,!1);return 0}}},fb=(a,b)=>{var c=0;a&&(c|=365);b&&(c|=146);return c},gb=null,hb={},ib=[],jb=1,R=null,kb=!1,lb=!0,N=class{name="ErrnoError";constructor(a){this.Mf=a}},db={},mb={},nb=class{fg={};node=null;get flags(){return this.fg.flags}set flags(a){this.fg.flags=
a}get position(){return this.fg.position}set position(a){this.fg.position=a}},ob=class{Jf={};Kf={};Zf=null;constructor(a,b,c,e){a||=this;this.parent=a;this.Tf=a.Tf;this.id=jb++;this.name=b;this.mode=c;this.dg=e}get read(){return 365===(this.mode&365)}set read(a){a?this.mode|=365:this.mode&=-366}get write(){return 146===(this.mode&146)}set write(a){a?this.mode|=146:this.mode&=-147}};
function S(a,b={}){a=Ra(a);if(!a)return{path:"",node:null};b=Object.assign({sg:!0,og:0},b);if(8<b.og)throw new N(32);a=a.split("/").filter(k=>!!k);for(var c=gb,e="/",f=0;f<a.length;f++){var h=f===a.length-1;if(h&&b.parent)break;c=Q(c,a[f]);e=Ma(e+"/"+a[f]);c.Zf&&(!h||h&&b.sg)&&(c=c.Zf.root);if(!h||b.Wf)for(h=0;40960===(c.mode&61440);)if(c=pb(e),e=Ra(Na(e),c),c=S(e,{og:b.og+1}).node,40<h++)throw new N(32);}return{path:e,node:c}}
function qb(a){for(var b;;){if(a===a.parent)return a=a.Tf.xg,b?"/"!==a[a.length-1]?`${a}/${b}`:a+b:a;b=b?`${a.name}/${b}`:a.name;a=a.parent}}function rb(a,b){for(var c=0,e=0;e<b.length;e++)c=(c<<5)-c+b.charCodeAt(e)|0;return(a+c>>>0)%R.length}function sb(a){var b=rb(a.parent.id,a.name);if(R[b]===a)R[b]=a.$f;else for(b=R[b];b;){if(b.$f===a){b.$f=a.$f;break}b=b.$f}}
function Q(a,b){var c=P(a.mode)?(c=tb(a,"x"))?c:a.Jf.bg?0:2:54;if(c)throw new N(c);for(c=R[rb(a.id,b)];c;c=c.$f){var e=c.name;if(c.parent.id===a.id&&e===b)return c}return a.Jf.bg(a,b)}function cb(a,b,c,e){a=new ob(a,b,c,e);b=rb(a.parent.id,a.name);a.$f=R[b];return R[b]=a}function P(a){return 16384===(a&61440)}function ub(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}
function tb(a,b){if(lb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function vb(a,b){try{return Q(a,b),20}catch(c){}return tb(a,"wx")}function wb(a,b,c){try{var e=Q(a,b)}catch(f){return f.Mf}if(a=tb(a,"wx"))return a;if(c){if(!P(e.mode))return 54;if(e===e.parent||"/"===qb(e))return 10}else if(P(e.mode))return 31;return 0}function T(a){a=ib[a];if(!a)throw new N(8);return a}
function xb(a,b=-1){a=Object.assign(new nb,a);if(-1==b)a:{for(b=0;4096>=b;b++)if(!ib[b])break a;throw new N(33);}a.Uf=b;return ib[b]=a}function yb(a,b=-1){a=xb(a,b);a.Kf?.Sg?.(a);return a}var bb={open(a){a.Kf=hb[a.node.dg].Kf;a.Kf.open?.(a)},Xf(){throw new N(70);}};function Xa(a,b){hb[a]={Kf:b}}
function zb(a,b){var c="/"===b;if(c&&gb)throw new N(10);if(!c&&b){var e=S(b,{sg:!1});b=e.path;e=e.node;if(e.Zf)throw new N(10);if(!P(e.mode))throw new N(54);}b={type:a,Xg:{},xg:b,Ig:[]};a=a.Tf(b);a.Tf=b;b.root=a;c?gb=a:e&&(e.Zf=b,e.Tf&&e.Tf.Ig.push(b))}function Ab(a,b,c){var e=S(a,{parent:!0}).node;a=Oa(a);if(!a||"."===a||".."===a)throw new N(28);var f=vb(e,a);if(f)throw new N(f);if(!e.Jf.gg)throw new N(63);return e.Jf.gg(e,a,b,c)}function U(a,b){return Ab(a,(void 0!==b?b:511)&1023|16384,0)}
function Bb(a,b,c){"undefined"==typeof c&&(c=b,b=438);Ab(a,b|8192,c)}function Cb(a,b){if(!Ra(a))throw new N(44);var c=S(b,{parent:!0}).node;if(!c)throw new N(44);b=Oa(b);var e=vb(c,b);if(e)throw new N(e);if(!c.Jf.kg)throw new N(63);c.Jf.kg(c,b,a)}function Db(a){var b=S(a,{parent:!0}).node;a=Oa(a);var c=Q(b,a),e=wb(b,a,!0);if(e)throw new N(e);if(!b.Jf.jg)throw new N(63);if(c.Zf)throw new N(10);b.Jf.jg(b,a);sb(c)}
function pb(a){a=S(a).node;if(!a)throw new N(44);if(!a.Jf.eg)throw new N(28);return Ra(qb(a.parent),a.Jf.eg(a))}function Eb(a,b){a=S(a,{Wf:!b}).node;if(!a)throw new N(44);if(!a.Jf.Rf)throw new N(63);return a.Jf.Rf(a)}function Fb(a){return Eb(a,!0)}function Gb(a,b){a="string"==typeof a?S(a,{Wf:!0}).node:a;if(!a.Jf.Of)throw new N(63);a.Jf.Of(a,{mode:b&4095|a.mode&-4096,timestamp:Date.now()})}
function Hb(a,b){if(0>b)throw new N(28);a="string"==typeof a?S(a,{Wf:!0}).node:a;if(!a.Jf.Of)throw new N(63);if(P(a.mode))throw new N(31);if(32768!==(a.mode&61440))throw new N(28);var c=tb(a,"w");if(c)throw new N(c);a.Jf.Of(a,{size:b,timestamp:Date.now()})}
function Ib(a,b,c){if(""===a)throw new N(44);if("string"==typeof b){var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof e)throw Error(`Unknown file open mode: ${b}`);b=e}c=b&64?("undefined"==typeof c?438:c)&4095|32768:0;if("object"==typeof a)var f=a;else{a=Ma(a);try{f=S(a,{Wf:!(b&131072)}).node}catch(h){}}e=!1;if(b&64)if(f){if(b&128)throw new N(20);}else f=Ab(a,c,0),e=!0;if(!f)throw new N(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!P(f.mode))throw new N(54);if(!e&&(c=
f?40960===(f.mode&61440)?32:P(f.mode)&&("r"!==ub(b)||b&512)?31:tb(f,ub(b)):44))throw new N(c);b&512&&!e&&Hb(f,0);b&=-131713;f=xb({node:f,path:qb(f),flags:b,seekable:!0,position:0,Kf:f.Kf,Mg:[],error:!1});f.Kf.open&&f.Kf.open(f);!d.logReadFiles||b&1||a in mb||(mb[a]=1);return f}function Jb(a,b,c){if(null===a.Uf)throw new N(8);if(!a.seekable||!a.Kf.Xf)throw new N(70);if(0!=c&&1!=c&&2!=c)throw new N(28);a.position=a.Kf.Xf(a,b,c);a.Mg=[]}
function V(a,b,c){a=Ma("/dev/"+a);var e=fb(!!b,!!c);V.wg??(V.wg=64);var f=V.wg++<<8|0;Xa(f,{open(h){h.seekable=!1},close(){c?.buffer?.length&&c(10)},read(h,k,n,m){for(var l=0,p=0;p<m;p++){try{var q=b()}catch(t){throw new N(29);}if(void 0===q&&0===l)throw new N(6);if(null===q||void 0===q)break;l++;k[n+p]=q}l&&(h.node.timestamp=Date.now());return l},write(h,k,n,m){for(var l=0;l<m;l++)try{c(k[n+l])}catch(p){throw new N(29);}m&&(h.node.timestamp=Date.now());return l}});Bb(a,e,f)}var X={};
function Kb(a,b,c){if("/"===b.charAt(0))return b;a=-100===a?"/":T(a).path;if(0==b.length){if(!c)throw new N(44);return a}return Ma(a+"/"+b)}
function Lb(a,b,c){a=a(b);x[c>>2]=a.Fg;x[c+4>>2]=a.mode;z[c+8>>2]=a.Kg;x[c+12>>2]=a.uid;x[c+16>>2]=a.Hg;x[c+20>>2]=a.dg;F=[a.size>>>0,(D=a.size,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];x[c+24>>2]=F[0];x[c+28>>2]=F[1];x[c+32>>2]=4096;x[c+36>>2]=a.Dg;b=a.Bg.getTime();var e=a.Jg.getTime(),f=a.Eg.getTime();F=[Math.floor(b/1E3)>>>0,(D=Math.floor(b/1E3),1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:
0)];x[c+40>>2]=F[0];x[c+44>>2]=F[1];z[c+48>>2]=b%1E3*1E6;F=[Math.floor(e/1E3)>>>0,(D=Math.floor(e/1E3),1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];x[c+56>>2]=F[0];x[c+60>>2]=F[1];z[c+64>>2]=e%1E3*1E6;F=[Math.floor(f/1E3)>>>0,(D=Math.floor(f/1E3),1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];x[c+72>>2]=F[0];x[c+76>>2]=F[1];z[c+80>>2]=f%1E3*1E6;F=[a.vg>>>0,(D=a.vg,1<=+Math.abs(D)?0<D?+Math.floor(D/
4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];x[c+88>>2]=F[0];x[c+92>>2]=F[1];return 0}
var Mb=void 0,Nb=()=>{var a=x[+Mb>>2];Mb+=4;return a},Ob=(a,b)=>b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN,Pb=0,Qb=[0,31,60,91,121,152,182,213,244,274,305,335],Rb=[0,31,59,90,120,151,181,212,243,273,304,334],Sb={},Tb=a=>{if(!(a instanceof Ha||"unwind"==a))throw a;},Ub=a=>{pa=a;Ja||0<Pb||(d.onExit?.(a),oa=!0);throw new Ha(a);},Vb=a=>{if(!oa)try{if(a(),!(Ja||0<Pb))try{pa=a=pa,Ub(a)}catch(b){Tb(b)}}catch(b){Tb(b)}},Wb={},Yb=()=>{if(!Xb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",
HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ia||"./this.program"},b;for(b in Wb)void 0===Wb[b]?delete a[b]:a[b]=Wb[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);Xb=c}return Xb},Xb;function Zb(){}function $b(){}function ac(){}function bc(){}function cc(){}function dc(){}function ec(){}function fc(){}function gc(){}function hc(){}function ic(){}function jc(){}function kc(){}function lc(){}function mc(){}
function nc(){}function oc(){}function pc(){}function qc(){}function rc(){}function sc(){}function tc(){}function uc(){}function vc(){}function wc(){}function xc(){}function yc(){}function zc(){}function Ac(){}function Bc(){}function Cc(){}function Dc(){}function Ec(){}function Fc(){}function Gc(){}function Hc(){}function Ic(){}function Jc(){}function Kc(){}
var Lc,Mc,Nc=[],Y=(a,b,c,e)=>{var f={string:l=>{var p=0;if(null!==l&&void 0!==l&&0!==l){p=Ta(l)+1;var q=Oc(p);K(l,v,q,p);p=q}return p},array:l=>{var p=Oc(l.length);u.set(l,p);return p}};a=d["_"+a];var h=[],k=0;if(e)for(var n=0;n<e.length;n++){var m=f[c[n]];m?(0===k&&(k=Pc()),h[n]=m(e[n])):h[n]=e[n]}c=a(...h);return c=function(l){0!==k&&Qc(k);return"string"===b?l?J(v,l):"":"boolean"===b?!!l:l}(c)},Rc="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
[44].forEach(a=>{db[a]=new N(a);db[a].stack="<generic error, no stack>"});R=Array(4096);zb(O,"/");U("/tmp");U("/home");U("/home/web_user");(function(){U("/dev");Xa(259,{read:()=>0,write:(e,f,h,k)=>k});Bb("/dev/null",259);Wa(1280,Za);Wa(1536,$a);Bb("/dev/tty",1280);Bb("/dev/tty1",1536);var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(b=Qa(a).byteLength);return a[--b]};V("random",c);V("urandom",c);U("/dev/shm");U("/dev/shm/tmp")})();
(function(){U("/proc");var a=U("/proc/self");U("/proc/self/fd");zb({Tf(){var b=cb(a,"fd",16895,73);b.Jf={bg(c,e){var f=T(+e);c={parent:null,Tf:{xg:"fake"},Jf:{eg:()=>f.path}};return c.parent=c}};return b}},"/proc/self/fd")})();
(function(){const a=new Map;d.setAuthorizer=function(b,c,e){c?a.set(b,{f:c,pg:e}):a.delete(b);return Y("set_authorizer","number",["number"],[b])};Zb=function(b,c,e,f,h,k){if(a.has(b)){const {f:n,pg:m}=a.get(b);return n(m,c,e?e?J(v,e):"":null,f?f?J(v,f):"":null,h?h?J(v,h):"":null,k?k?J(v,k):"":null)}return 0}})();
(function(){const a=new Map,b=new Map;d.createFunction=function(c,e,f,h,k,n){const m=a.size;a.set(m,{f:n,Vf:k});return Y("create_function","number","number string number number number number".split(" "),[c,e,f,h,m,0])};d.createAggregate=function(c,e,f,h,k,n,m){const l=a.size;a.set(l,{step:n,Gg:m,Vf:k});return Y("create_function","number","number string number number number number".split(" "),[c,e,f,h,l,1])};d.getFunctionUserData=function(c){return b.get(c)};ac=function(c,e,f,h){c=a.get(c);b.set(e,
c.Vf);c.f(e,new Uint32Array(v.buffer,h,f));b.delete(e)};cc=function(c,e,f,h){c=a.get(c);b.set(e,c.Vf);c.step(e,new Uint32Array(v.buffer,h,f));b.delete(e)};$b=function(c,e){c=a.get(c);b.set(e,c.Vf);c.Gg(e);b.delete(e)}})();(function(){const a=new Map;d.progressHandler=function(b,c,e,f){e?a.set(b,{f:e,pg:f}):a.delete(b);return Y("progress_handler",null,["number","number"],[b,c])};bc=function(b){if(a.has(b)){const {f:c,pg:e}=a.get(b);return c(e)}return 0}})();
(function(){function a(m,l){const p=`get${m}`,q=`set${m}`;return new Proxy(new DataView(v.buffer,l,"Int32"===m?4:8),{get(t,y){if(y===p)return function(A,G){if(!G)throw Error("must be little endian");return t[y](A,G)};if(y===q)return function(A,G,E){if(!E)throw Error("must be little endian");return t[y](A,G,E)};if("string"===typeof y&&y.match(/^(get)|(set)/))throw Error("invalid type");return t[y]}})}const b="object"===typeof Asyncify,c=new Map,e=new Map,f=new Map,h=b?new Set:null,k=b?new Set:null,
n=new Map;tc=function(m,l,p,q){n.set(m?J(v,m):"",{size:l,cg:Array.from(new Uint32Array(v.buffer,q,p))})};d.createModule=function(m,l,p,q){b&&(p.handleAsync=Asyncify.ug);const t=c.size;c.set(t,{module:p,Vf:q});q=0;p.xCreate&&(q|=1);p.xConnect&&(q|=2);p.xBestIndex&&(q|=4);p.xDisconnect&&(q|=8);p.xDestroy&&(q|=16);p.xOpen&&(q|=32);p.xClose&&(q|=64);p.xFilter&&(q|=128);p.xNext&&(q|=256);p.xEof&&(q|=512);p.xColumn&&(q|=1024);p.xRowid&&(q|=2048);p.xUpdate&&(q|=4096);p.xBegin&&(q|=8192);p.xSync&&(q|=16384);
p.xCommit&&(q|=32768);p.xRollback&&(q|=65536);p.xFindFunction&&(q|=131072);p.xRename&&(q|=262144);return Y("create_module","number",["number","string","number","number"],[m,l,t,q])};jc=function(m,l,p,q,t,y){l=c.get(l);e.set(t,l);if(b){h.delete(t);for(const A of h)e.delete(A)}q=Array.from(new Uint32Array(v.buffer,q,p)).map(A=>A?J(v,A):"");return l.module.xCreate(m,l.Vf,q,t,a("Int32",y))};ic=function(m,l,p,q,t,y){l=c.get(l);e.set(t,l);if(b){h.delete(t);for(const A of h)e.delete(A)}q=Array.from(new Uint32Array(v.buffer,
q,p)).map(A=>A?J(v,A):"");return l.module.xConnect(m,l.Vf,q,t,a("Int32",y))};ec=function(m,l){var p=e.get(m),q=n.get("sqlite3_index_info").cg;const t={};t.nConstraint=H(l+q[0],"i32");t.aConstraint=[];var y=H(l+q[1],"*"),A=n.get("sqlite3_index_constraint").size;for(var G=0;G<t.nConstraint;++G){var E=t.aConstraint,M=E.push,L=y+G*A,ha=n.get("sqlite3_index_constraint").cg,W={};W.iColumn=H(L+ha[0],"i32");W.op=H(L+ha[1],"i8");W.usable=!!H(L+ha[2],"i8");M.call(E,W)}t.nOrderBy=H(l+q[2],"i32");t.aOrderBy=
[];y=H(l+q[3],"*");A=n.get("sqlite3_index_orderby").size;for(G=0;G<t.nOrderBy;++G)E=t.aOrderBy,M=E.push,L=y+G*A,ha=n.get("sqlite3_index_orderby").cg,W={},W.iColumn=H(L+ha[0],"i32"),W.desc=!!H(L+ha[1],"i8"),M.call(E,W);t.aConstraintUsage=[];for(y=0;y<t.nConstraint;++y)t.aConstraintUsage.push({argvIndex:0,omit:!1});t.idxNum=H(l+q[5],"i32");t.idxStr=null;t.orderByConsumed=!!H(l+q[8],"i8");t.estimatedCost=H(l+q[9],"double");t.estimatedRows=H(l+q[10],"i32");t.idxFlags=H(l+q[11],"i32");t.colUsed=H(l+q[12],
"i32");m=p.module.xBestIndex(m,t);p=n.get("sqlite3_index_info").cg;q=H(l+p[4],"*");y=n.get("sqlite3_index_constraint_usage").size;for(M=0;M<t.nConstraint;++M)A=q+M*y,E=t.aConstraintUsage[M],L=n.get("sqlite3_index_constraint_usage").cg,I(A+L[0],E.argvIndex,"i32"),I(A+L[1],E.omit?1:0,"i8");I(l+p[5],t.idxNum,"i32");"string"===typeof t.idxStr&&(q=Ta(t.idxStr),y=Y("sqlite3_malloc","number",["number"],[q+1]),K(t.idxStr,v,y,q+1),I(l+p[6],y,"*"),I(l+p[7],1,"i32"));I(l+p[8],t.orderByConsumed,"i32");I(l+p[9],
t.estimatedCost,"double");I(l+p[10],t.estimatedRows,"i32");I(l+p[11],t.idxFlags,"i32");return m};lc=function(m){const l=e.get(m);b?h.add(m):e.delete(m);return l.module.xDisconnect(m)};kc=function(m){const l=e.get(m);b?h.add(m):e.delete(m);return l.module.xDestroy(m)};pc=function(m,l){const p=e.get(m);f.set(l,p);if(b){k.delete(l);for(const q of k)f.delete(q)}return p.module.xOpen(m,l)};fc=function(m){const l=f.get(m);b?k.add(m):f.delete(m);return l.module.xClose(m)};mc=function(m){return f.get(m).module.xEof(m)?
1:0};nc=function(m,l,p,q,t){const y=f.get(m);p=p?p?J(v,p):"":null;t=new Uint32Array(v.buffer,t,q);return y.module.xFilter(m,l,p,t)};oc=function(m){return f.get(m).module.xNext(m)};gc=function(m,l,p){return f.get(m).module.xColumn(m,l,p)};sc=function(m,l){return f.get(m).module.xRowid(m,a("BigInt64",l))};vc=function(m,l,p,q){const t=e.get(m);p=new Uint32Array(v.buffer,p,l);return t.module.xUpdate(m,p,a("BigInt64",q))};dc=function(m){return e.get(m).module.xBegin(m)};uc=function(m){return e.get(m).module.xSync(m)};
hc=function(m){return e.get(m).module.xCommit(m)};rc=function(m){return e.get(m).module.xRollback(m)};qc=function(m,l){const p=e.get(m);l=l?J(v,l):"";return p.module.xRename(m,l)}})();
(function(){function a(h,k){const n=`get${h}`,m=`set${h}`;return new Proxy(new DataView(v.buffer,k,"Int32"===h?4:8),{get(l,p){if(p===n)return function(q,t){if(!t)throw Error("must be little endian");return l[p](q,t)};if(p===m)return function(q,t,y){if(!y)throw Error("must be little endian");return l[p](q,t,y)};if("string"===typeof p&&p.match(/^(get)|(set)/))throw Error("invalid type");return l[p]}})}const b="object"===typeof Asyncify;b&&(d.handleAsync=Asyncify.ug);const c=new Map,e=new Map;d.registerVFS=
function(h,k){if(Y("sqlite3_vfs_find","number",["string"],[h.name]))throw Error(`VFS '${h.name}' already registered`);b&&(h.handleAsync=Asyncify.ug);var n=h.mxPathName??64;const m=d._malloc(4);k=Y("register_vfs","number",["string","number","number","number"],[h.name,n,k?1:0,m]);k||(n=H(m,"*"),c.set(n,h));d._free(m);return k};const f=b?new Set:null;yc=function(h){const k=e.get(h);b?f.add(h):e.delete(h);return k.xClose(h)};Fc=function(h,k,n,m,l){return e.get(h).xRead(h,v.subarray(k,k+n),4294967296*
l+m+(0>m?2**32:0))};Kc=function(h,k,n,m,l){return e.get(h).xWrite(h,v.subarray(k,k+n),4294967296*l+m+(0>m?2**32:0))};Ic=function(h,k,n){return e.get(h).xTruncate(h,4294967296*n+k+(0>k?2**32:0))};Hc=function(h,k){return e.get(h).xSync(h,k)};Cc=function(h,k){const n=e.get(h);k=a("BigInt64",k);return n.xFileSize(h,k)};Dc=function(h,k){return e.get(h).xLock(h,k)};Jc=function(h,k){return e.get(h).xUnlock(h,k)};xc=function(h,k){const n=e.get(h);k=a("Int32",k);return n.xCheckReservedLock(h,k)};Bc=function(h,
k,n){const m=e.get(h);n=new DataView(v.buffer,n);return m.xFileControl(h,k,n)};Gc=function(h){return e.get(h).xSectorSize(h)};Ac=function(h){return e.get(h).xDeviceCharacteristics(h)};Ec=function(h,k,n,m,l){h=c.get(h);e.set(n,h);if(b){f.delete(n);for(var p of f)e.delete(p)}p=null;if(m&64){p=1;const q=[];for(;p;){const t=v[k++];if(t)q.push(t);else switch(v[k]||(p=null),p){case 1:q.push(63);p=2;break;case 2:q.push(61);p=3;break;case 3:q.push(38),p=2}}p=(new TextDecoder).decode(new Uint8Array(q))}else k&&
(p=k?J(v,k):"");l=a("Int32",l);return h.xOpen(p,n,m,l)};zc=function(h,k,n){return c.get(h).xDelete(k?J(v,k):"",n)};wc=function(h,k,n,m){h=c.get(h);m=a("Int32",m);return h.xAccess(k?J(v,k):"",n,m)}})();
var Tc={a:(a,b,c,e)=>{C(`Assertion failed: ${a?J(v,a):""}, at: `+[b?b?J(v,b):"":"unknown filename",c,e?e?J(v,e):"":"unknown function"])},R:function(a,b){try{return a=a?J(v,a):"",Gb(a,b),0}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return-c.Mf}},U:function(a,b,c){try{b=b?J(v,b):"";b=Kb(a,b);if(c&-8)return-28;var e=S(b,{Wf:!0}).node;if(!e)return-44;a="";c&4&&(a+="r");c&2&&(a+="w");c&1&&(a+="x");return a&&tb(e,a)?-2:0}catch(f){if("undefined"==typeof X||"ErrnoError"!==f.name)throw f;
return-f.Mf}},S:function(a,b){try{var c=T(a);Gb(c.node,b);return 0}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return-e.Mf}},Q:function(a){try{var b=T(a).node;var c="string"==typeof b?S(b,{Wf:!0}).node:b;if(!c.Jf.Of)throw new N(63);c.Jf.Of(c,{timestamp:Date.now()});return 0}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return-e.Mf}},b:function(a,b,c){Mb=c;try{var e=T(a);switch(b){case 0:var f=Nb();if(0>f)break;for(;ib[f];)f++;return yb(e,f).Uf;case 1:case 2:return 0;
case 3:return e.flags;case 4:return f=Nb(),e.flags|=f,0;case 12:return f=Nb(),w[f+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(h){if("undefined"==typeof X||"ErrnoError"!==h.name)throw h;return-h.Mf}},P:function(a,b){try{var c=T(a);return Lb(Eb,c.path,b)}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return-e.Mf}},m:function(a,b,c){b=Ob(b,c);try{if(isNaN(b))return 61;var e=T(a);if(0===(e.flags&2097155))throw new N(28);Hb(e.node,b);return 0}catch(f){if("undefined"==typeof X||
"ErrnoError"!==f.name)throw f;return-f.Mf}},J:function(a,b){try{if(0===b)return-28;var c=Ta("/")+1;if(b<c)return-68;K("/",v,a,b);return c}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return-e.Mf}},N:function(a,b){try{return a=a?J(v,a):"",Lb(Fb,a,b)}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return-c.Mf}},F:function(a,b,c){try{return b=b?J(v,b):"",b=Kb(a,b),b=Ma(b),"/"===b[b.length-1]&&(b=b.substr(0,b.length-1)),U(b,c),0}catch(e){if("undefined"==typeof X||
"ErrnoError"!==e.name)throw e;return-e.Mf}},M:function(a,b,c,e){try{b=b?J(v,b):"";var f=e&256;b=Kb(a,b,e&4096);return Lb(f?Fb:Eb,b,c)}catch(h){if("undefined"==typeof X||"ErrnoError"!==h.name)throw h;return-h.Mf}},D:function(a,b,c,e){Mb=e;try{b=b?J(v,b):"";b=Kb(a,b);var f=e?Nb():0;return Ib(b,c,f).Uf}catch(h){if("undefined"==typeof X||"ErrnoError"!==h.name)throw h;return-h.Mf}},B:function(a,b,c,e){try{b=b?J(v,b):"";b=Kb(a,b);if(0>=e)return-28;var f=pb(b),h=Math.min(e,Ta(f)),k=u[c+h];K(f,v,c,e+1);u[c+
h]=k;return h}catch(n){if("undefined"==typeof X||"ErrnoError"!==n.name)throw n;return-n.Mf}},z:function(a){try{return a=a?J(v,a):"",Db(a),0}catch(b){if("undefined"==typeof X||"ErrnoError"!==b.name)throw b;return-b.Mf}},O:function(a,b){try{return a=a?J(v,a):"",Lb(Eb,a,b)}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return-c.Mf}},x:function(a,b,c){try{b=b?J(v,b):"";b=Kb(a,b);if(0===c){a=b;var e=S(a,{parent:!0}).node;if(!e)throw new N(44);var f=Oa(a),h=Q(e,f),k=wb(e,f,!1);if(k)throw new N(k);
if(!e.Jf.lg)throw new N(63);if(h.Zf)throw new N(10);e.Jf.lg(e,f);sb(h)}else 512===c?Db(b):C("Invalid flags passed to unlinkat");return 0}catch(n){if("undefined"==typeof X||"ErrnoError"!==n.name)throw n;return-n.Mf}},w:function(a,b,c){try{b=b?J(v,b):"";b=Kb(a,b,!0);var e=Date.now();if(c){var f=z[c>>2]+4294967296*x[c+4>>2],h=x[c+8>>2];var k=1073741823==h?e:1073741822==h?-1:1E3*f+h/1E6;c+=16;f=z[c>>2]+4294967296*x[c+4>>2];h=x[c+8>>2];var n=1073741823==h?e:1073741822==h?-1:1E3*f+h/1E6}else n=k=e;if(-1!=
n||-1!=k){a=k;var m=S(b,{Wf:!0}).node;m.Jf.Of(m,{timestamp:Math.max(a,n)})}return 0}catch(l){if("undefined"==typeof X||"ErrnoError"!==l.name)throw l;return-l.Mf}},V:()=>{C("")},s:()=>{Ja=!1;Pb=0},k:function(a,b,c){a=new Date(1E3*Ob(a,b));x[c>>2]=a.getSeconds();x[c+4>>2]=a.getMinutes();x[c+8>>2]=a.getHours();x[c+12>>2]=a.getDate();x[c+16>>2]=a.getMonth();x[c+20>>2]=a.getFullYear()-1900;x[c+24>>2]=a.getDay();b=a.getFullYear();x[c+28>>2]=(0!==b%4||0===b%100&&0!==b%400?Rb:Qb)[a.getMonth()]+a.getDate()-
1|0;x[c+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();x[c+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},i:function(a,b,c,e,f,h,k,n){f=Ob(f,h);try{if(isNaN(f))return 61;var m=T(e);if(0!==(b&2)&&0===(c&2)&&2!==(m.flags&2097155))throw new N(2);if(1===(m.flags&2097155))throw new N(2);if(!m.Kf.hg)throw new N(43);if(!a)throw new N(28);var l=m.Kf.hg(m,a,f,b,c);var p=l.Lg;x[k>>2]=l.Ag;z[n>>2]=p;return 0}catch(q){if("undefined"==
typeof X||"ErrnoError"!==q.name)throw q;return-q.Mf}},j:function(a,b,c,e,f,h,k){h=Ob(h,k);try{var n=T(f);if(c&2){if(32768!==(n.node.mode&61440))throw new N(43);e&2||n.Kf.ig&&n.Kf.ig(n,v.slice(a,a+b),h,b,e)}}catch(m){if("undefined"==typeof X||"ErrnoError"!==m.name)throw m;return-m.Mf}},t:(a,b)=>{Sb[a]&&(clearTimeout(Sb[a].id),delete Sb[a]);if(!b)return 0;var c=setTimeout(()=>{delete Sb[a];Vb(()=>Sc(a,performance.now()))},b);Sb[a]={id:c,Yg:b};return 0},E:(a,b,c,e)=>{var f=(new Date).getFullYear(),h=
(new Date(f,0,1)).getTimezoneOffset();f=(new Date(f,6,1)).getTimezoneOffset();z[a>>2]=60*Math.max(h,f);x[b>>2]=Number(h!=f);b=k=>{var n=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(n/60)).padStart(2,"0")}${String(n%60).padStart(2,"0")}`};a=b(h);b=b(f);f<h?(K(a,v,c,17),K(b,v,e,17)):(K(a,v,e,17),K(b,v,c,17))},e:()=>Date.now(),d:()=>performance.now(),u:a=>{var b=v.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,
65536*Math.ceil(Math.max(a,e)/65536))-na.buffer.byteLength+65535)/65536|0;try{na.grow(e);ta();var f=1;break a}catch(h){}f=void 0}if(f)return!0}return!1},G:(a,b)=>{var c=0;Yb().forEach((e,f)=>{var h=b+c;f=z[a+4*f>>2]=h;for(h=0;h<e.length;++h)u[f++]=e.charCodeAt(h);u[f]=0;c+=e.length+1});return 0},H:(a,b)=>{var c=Yb();z[a>>2]=c.length;var e=0;c.forEach(f=>e+=f.length+1);z[b>>2]=e;return 0},f:function(a){try{var b=T(a);if(null===b.Uf)throw new N(8);b.mg&&(b.mg=null);try{b.Kf.close&&b.Kf.close(b)}catch(c){throw c;
}finally{ib[b.Uf]=null}b.Uf=null;return 0}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return c.Mf}},v:function(a,b){try{var c=T(a);u[b]=c.Qf?2:P(c.mode)?3:40960===(c.mode&61440)?7:4;w[b+2>>1]=0;F=[0,(D=0,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];x[b+8>>2]=F[0];x[b+12>>2]=F[1];F=[0,(D=0,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];x[b+16>>2]=F[0];x[b+20>>2]=F[1];return 0}catch(e){if("undefined"==
typeof X||"ErrnoError"!==e.name)throw e;return e.Mf}},C:function(a,b,c,e){try{a:{var f=T(a);a=b;for(var h,k=b=0;k<c;k++){var n=z[a>>2],m=z[a+4>>2];a+=8;var l=f,p=h,q=u;if(0>m||0>p)throw new N(28);if(null===l.Uf)throw new N(8);if(1===(l.flags&2097155))throw new N(8);if(P(l.node.mode))throw new N(31);if(!l.Kf.read)throw new N(28);var t="undefined"!=typeof p;if(!t)p=l.position;else if(!l.seekable)throw new N(70);var y=l.Kf.read(l,q,n,m,p);t||(l.position+=y);var A=y;if(0>A){var G=-1;break a}b+=A;if(A<
m)break;"undefined"!=typeof h&&(h+=A)}G=b}z[e>>2]=G;return 0}catch(E){if("undefined"==typeof X||"ErrnoError"!==E.name)throw E;return E.Mf}},l:function(a,b,c,e,f){b=Ob(b,c);try{if(isNaN(b))return 61;var h=T(a);Jb(h,b,e);F=[h.position>>>0,(D=h.position,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];x[f>>2]=F[0];x[f+4>>2]=F[1];h.mg&&0===b&&0===e&&(h.mg=null);return 0}catch(k){if("undefined"==typeof X||"ErrnoError"!==k.name)throw k;return k.Mf}},K:function(a){try{var b=
T(a);return b.Kf?.Yf?b.Kf.Yf(b):0}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return c.Mf}},y:function(a,b,c,e){try{a:{var f=T(a);a=b;for(var h,k=b=0;k<c;k++){var n=z[a>>2],m=z[a+4>>2];a+=8;var l=f,p=n,q=m,t=h,y=u;if(0>q||0>t)throw new N(28);if(null===l.Uf)throw new N(8);if(0===(l.flags&2097155))throw new N(8);if(P(l.node.mode))throw new N(31);if(!l.Kf.write)throw new N(28);l.seekable&&l.flags&1024&&Jb(l,0,2);var A="undefined"!=typeof t;if(!A)t=l.position;else if(!l.seekable)throw new N(70);
var G=l.Kf.write(l,y,p,q,t,void 0);A||(l.position+=G);var E=G;if(0>E){var M=-1;break a}b+=E;if(E<m)break;"undefined"!=typeof h&&(h+=E)}M=b}z[e>>2]=M;return 0}catch(L){if("undefined"==typeof X||"ErrnoError"!==L.name)throw L;return L.Mf}},wa:Zb,T:$b,la:ac,ha:bc,ba:cc,qa:dc,L:ec,h:fc,ta:gc,oa:hc,ja:ic,ka:jc,p:kc,A:lc,ua:mc,g:nc,va:oc,ia:pc,ma:qc,na:rc,sa:sc,c:tc,pa:uc,ra:vc,r:Ub,I:function(a,b){try{return Qa(v.subarray(a,a+b)),0}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return c.Mf}},
fa:wc,_:xc,ea:yc,ga:zc,X:Ac,Z:Bc,ca:Cc,aa:Dc,W:Ec,q:Fc,Y:Gc,da:Hc,n:Ic,$:Jc,o:Kc},Z=function(){function a(c){Z=c.exports;na=Z.xa;ta();Lc=Z.Cf;va.unshift(Z.ya);B--;d.monitorRunDependencies?.(B);0==B&&(null!==za&&(clearInterval(za),za=null),Aa&&(c=Aa,Aa=null,c()));return Z}var b={a:Tc};B++;d.monitorRunDependencies?.(B);if(d.instantiateWasm)try{return d.instantiateWasm(b,a)}catch(c){r(`Module.instantiateWasm callback failed with error: ${c}`),ba(c)}Ca??=d.locateFile?Ba("wa-sqlite.wasm")?"wa-sqlite.wasm":
d.locateFile?d.locateFile("wa-sqlite.wasm",g):g+"wa-sqlite.wasm":(new URL("wa-sqlite.wasm",import.meta.url)).href;Ga(b,function(c){a(c.instance)}).catch(ba);return{}}();d._sqlite3_status64=(a,b,c,e)=>(d._sqlite3_status64=Z.za)(a,b,c,e);d._sqlite3_status=(a,b,c,e)=>(d._sqlite3_status=Z.Aa)(a,b,c,e);d._sqlite3_db_status=(a,b,c,e,f)=>(d._sqlite3_db_status=Z.Ba)(a,b,c,e,f);d._sqlite3_msize=a=>(d._sqlite3_msize=Z.Ca)(a);d._sqlite3_vfs_find=a=>(d._sqlite3_vfs_find=Z.Da)(a);
d._sqlite3_vfs_register=(a,b)=>(d._sqlite3_vfs_register=Z.Ea)(a,b);d._sqlite3_vfs_unregister=a=>(d._sqlite3_vfs_unregister=Z.Fa)(a);d._sqlite3_release_memory=a=>(d._sqlite3_release_memory=Z.Ga)(a);d._sqlite3_soft_heap_limit64=(a,b)=>(d._sqlite3_soft_heap_limit64=Z.Ha)(a,b);d._sqlite3_memory_used=()=>(d._sqlite3_memory_used=Z.Ia)();d._sqlite3_hard_heap_limit64=(a,b)=>(d._sqlite3_hard_heap_limit64=Z.Ja)(a,b);d._sqlite3_memory_highwater=a=>(d._sqlite3_memory_highwater=Z.Ka)(a);
d._sqlite3_malloc=a=>(d._sqlite3_malloc=Z.La)(a);d._sqlite3_malloc64=(a,b)=>(d._sqlite3_malloc64=Z.Ma)(a,b);d._sqlite3_free=a=>(d._sqlite3_free=Z.Na)(a);d._sqlite3_realloc=(a,b)=>(d._sqlite3_realloc=Z.Oa)(a,b);d._sqlite3_realloc64=(a,b,c)=>(d._sqlite3_realloc64=Z.Pa)(a,b,c);d._sqlite3_str_vappendf=(a,b,c)=>(d._sqlite3_str_vappendf=Z.Qa)(a,b,c);d._sqlite3_str_append=(a,b,c)=>(d._sqlite3_str_append=Z.Ra)(a,b,c);d._sqlite3_str_appendchar=(a,b,c)=>(d._sqlite3_str_appendchar=Z.Sa)(a,b,c);
d._sqlite3_str_appendall=(a,b)=>(d._sqlite3_str_appendall=Z.Ta)(a,b);d._sqlite3_str_appendf=(a,b,c)=>(d._sqlite3_str_appendf=Z.Ua)(a,b,c);d._sqlite3_str_finish=a=>(d._sqlite3_str_finish=Z.Va)(a);d._sqlite3_str_errcode=a=>(d._sqlite3_str_errcode=Z.Wa)(a);d._sqlite3_str_length=a=>(d._sqlite3_str_length=Z.Xa)(a);d._sqlite3_str_value=a=>(d._sqlite3_str_value=Z.Ya)(a);d._sqlite3_str_reset=a=>(d._sqlite3_str_reset=Z.Za)(a);d._sqlite3_str_new=a=>(d._sqlite3_str_new=Z._a)(a);
d._sqlite3_vmprintf=(a,b)=>(d._sqlite3_vmprintf=Z.$a)(a,b);d._sqlite3_mprintf=(a,b)=>(d._sqlite3_mprintf=Z.ab)(a,b);d._sqlite3_vsnprintf=(a,b,c,e)=>(d._sqlite3_vsnprintf=Z.bb)(a,b,c,e);d._sqlite3_snprintf=(a,b,c,e)=>(d._sqlite3_snprintf=Z.cb)(a,b,c,e);d._sqlite3_log=(a,b,c)=>(d._sqlite3_log=Z.db)(a,b,c);d._sqlite3_randomness=(a,b)=>(d._sqlite3_randomness=Z.eb)(a,b);d._sqlite3_stricmp=(a,b)=>(d._sqlite3_stricmp=Z.fb)(a,b);d._sqlite3_strnicmp=(a,b,c)=>(d._sqlite3_strnicmp=Z.gb)(a,b,c);
d._sqlite3_os_init=()=>(d._sqlite3_os_init=Z.hb)();d._sqlite3_os_end=()=>(d._sqlite3_os_end=Z.ib)();d._sqlite3_serialize=(a,b,c,e)=>(d._sqlite3_serialize=Z.jb)(a,b,c,e);d._sqlite3_prepare_v2=(a,b,c,e,f)=>(d._sqlite3_prepare_v2=Z.kb)(a,b,c,e,f);d._sqlite3_step=a=>(d._sqlite3_step=Z.lb)(a);d._sqlite3_column_int64=(a,b)=>(d._sqlite3_column_int64=Z.mb)(a,b);d._sqlite3_reset=a=>(d._sqlite3_reset=Z.nb)(a);d._sqlite3_exec=(a,b,c,e,f)=>(d._sqlite3_exec=Z.ob)(a,b,c,e,f);
d._sqlite3_column_int=(a,b)=>(d._sqlite3_column_int=Z.pb)(a,b);d._sqlite3_finalize=a=>(d._sqlite3_finalize=Z.qb)(a);d._sqlite3_deserialize=(a,b,c,e,f,h,k,n)=>(d._sqlite3_deserialize=Z.rb)(a,b,c,e,f,h,k,n);d._sqlite3_database_file_object=a=>(d._sqlite3_database_file_object=Z.sb)(a);d._sqlite3_backup_init=(a,b,c,e)=>(d._sqlite3_backup_init=Z.tb)(a,b,c,e);d._sqlite3_backup_step=(a,b)=>(d._sqlite3_backup_step=Z.ub)(a,b);d._sqlite3_backup_finish=a=>(d._sqlite3_backup_finish=Z.vb)(a);
d._sqlite3_backup_remaining=a=>(d._sqlite3_backup_remaining=Z.wb)(a);d._sqlite3_backup_pagecount=a=>(d._sqlite3_backup_pagecount=Z.xb)(a);d._sqlite3_clear_bindings=a=>(d._sqlite3_clear_bindings=Z.yb)(a);d._sqlite3_value_blob=a=>(d._sqlite3_value_blob=Z.zb)(a);d._sqlite3_value_text=a=>(d._sqlite3_value_text=Z.Ab)(a);d._sqlite3_value_bytes=a=>(d._sqlite3_value_bytes=Z.Bb)(a);d._sqlite3_value_bytes16=a=>(d._sqlite3_value_bytes16=Z.Cb)(a);d._sqlite3_value_double=a=>(d._sqlite3_value_double=Z.Db)(a);
d._sqlite3_value_int=a=>(d._sqlite3_value_int=Z.Eb)(a);d._sqlite3_value_int64=a=>(d._sqlite3_value_int64=Z.Fb)(a);d._sqlite3_value_subtype=a=>(d._sqlite3_value_subtype=Z.Gb)(a);d._sqlite3_value_pointer=(a,b)=>(d._sqlite3_value_pointer=Z.Hb)(a,b);d._sqlite3_value_text16=a=>(d._sqlite3_value_text16=Z.Ib)(a);d._sqlite3_value_text16be=a=>(d._sqlite3_value_text16be=Z.Jb)(a);d._sqlite3_value_text16le=a=>(d._sqlite3_value_text16le=Z.Kb)(a);d._sqlite3_value_type=a=>(d._sqlite3_value_type=Z.Lb)(a);
d._sqlite3_value_encoding=a=>(d._sqlite3_value_encoding=Z.Mb)(a);d._sqlite3_value_nochange=a=>(d._sqlite3_value_nochange=Z.Nb)(a);d._sqlite3_value_frombind=a=>(d._sqlite3_value_frombind=Z.Ob)(a);d._sqlite3_value_dup=a=>(d._sqlite3_value_dup=Z.Pb)(a);d._sqlite3_value_free=a=>(d._sqlite3_value_free=Z.Qb)(a);d._sqlite3_result_blob=(a,b,c,e)=>(d._sqlite3_result_blob=Z.Rb)(a,b,c,e);d._sqlite3_result_blob64=(a,b,c,e,f)=>(d._sqlite3_result_blob64=Z.Sb)(a,b,c,e,f);
d._sqlite3_result_double=(a,b)=>(d._sqlite3_result_double=Z.Tb)(a,b);d._sqlite3_result_error=(a,b,c)=>(d._sqlite3_result_error=Z.Ub)(a,b,c);d._sqlite3_result_error16=(a,b,c)=>(d._sqlite3_result_error16=Z.Vb)(a,b,c);d._sqlite3_result_int=(a,b)=>(d._sqlite3_result_int=Z.Wb)(a,b);d._sqlite3_result_int64=(a,b,c)=>(d._sqlite3_result_int64=Z.Xb)(a,b,c);d._sqlite3_result_null=a=>(d._sqlite3_result_null=Z.Yb)(a);d._sqlite3_result_pointer=(a,b,c,e)=>(d._sqlite3_result_pointer=Z.Zb)(a,b,c,e);
d._sqlite3_result_subtype=(a,b)=>(d._sqlite3_result_subtype=Z._b)(a,b);d._sqlite3_result_text=(a,b,c,e)=>(d._sqlite3_result_text=Z.$b)(a,b,c,e);d._sqlite3_result_text64=(a,b,c,e,f,h)=>(d._sqlite3_result_text64=Z.ac)(a,b,c,e,f,h);d._sqlite3_result_text16=(a,b,c,e)=>(d._sqlite3_result_text16=Z.bc)(a,b,c,e);d._sqlite3_result_text16be=(a,b,c,e)=>(d._sqlite3_result_text16be=Z.cc)(a,b,c,e);d._sqlite3_result_text16le=(a,b,c,e)=>(d._sqlite3_result_text16le=Z.dc)(a,b,c,e);
d._sqlite3_result_value=(a,b)=>(d._sqlite3_result_value=Z.ec)(a,b);d._sqlite3_result_error_toobig=a=>(d._sqlite3_result_error_toobig=Z.fc)(a);d._sqlite3_result_zeroblob=(a,b)=>(d._sqlite3_result_zeroblob=Z.gc)(a,b);d._sqlite3_result_zeroblob64=(a,b,c)=>(d._sqlite3_result_zeroblob64=Z.hc)(a,b,c);d._sqlite3_result_error_code=(a,b)=>(d._sqlite3_result_error_code=Z.ic)(a,b);d._sqlite3_result_error_nomem=a=>(d._sqlite3_result_error_nomem=Z.jc)(a);d._sqlite3_user_data=a=>(d._sqlite3_user_data=Z.kc)(a);
d._sqlite3_context_db_handle=a=>(d._sqlite3_context_db_handle=Z.lc)(a);d._sqlite3_vtab_nochange=a=>(d._sqlite3_vtab_nochange=Z.mc)(a);d._sqlite3_vtab_in_first=(a,b)=>(d._sqlite3_vtab_in_first=Z.nc)(a,b);d._sqlite3_vtab_in_next=(a,b)=>(d._sqlite3_vtab_in_next=Z.oc)(a,b);d._sqlite3_aggregate_context=(a,b)=>(d._sqlite3_aggregate_context=Z.pc)(a,b);d._sqlite3_get_auxdata=(a,b)=>(d._sqlite3_get_auxdata=Z.qc)(a,b);d._sqlite3_set_auxdata=(a,b,c,e)=>(d._sqlite3_set_auxdata=Z.rc)(a,b,c,e);
d._sqlite3_column_count=a=>(d._sqlite3_column_count=Z.sc)(a);d._sqlite3_data_count=a=>(d._sqlite3_data_count=Z.tc)(a);d._sqlite3_column_blob=(a,b)=>(d._sqlite3_column_blob=Z.uc)(a,b);d._sqlite3_column_bytes=(a,b)=>(d._sqlite3_column_bytes=Z.vc)(a,b);d._sqlite3_column_bytes16=(a,b)=>(d._sqlite3_column_bytes16=Z.wc)(a,b);d._sqlite3_column_double=(a,b)=>(d._sqlite3_column_double=Z.xc)(a,b);d._sqlite3_column_text=(a,b)=>(d._sqlite3_column_text=Z.yc)(a,b);
d._sqlite3_column_value=(a,b)=>(d._sqlite3_column_value=Z.zc)(a,b);d._sqlite3_column_text16=(a,b)=>(d._sqlite3_column_text16=Z.Ac)(a,b);d._sqlite3_column_type=(a,b)=>(d._sqlite3_column_type=Z.Bc)(a,b);d._sqlite3_column_name=(a,b)=>(d._sqlite3_column_name=Z.Cc)(a,b);d._sqlite3_column_name16=(a,b)=>(d._sqlite3_column_name16=Z.Dc)(a,b);d._sqlite3_bind_blob=(a,b,c,e,f)=>(d._sqlite3_bind_blob=Z.Ec)(a,b,c,e,f);d._sqlite3_bind_blob64=(a,b,c,e,f,h)=>(d._sqlite3_bind_blob64=Z.Fc)(a,b,c,e,f,h);
d._sqlite3_bind_double=(a,b,c)=>(d._sqlite3_bind_double=Z.Gc)(a,b,c);d._sqlite3_bind_int=(a,b,c)=>(d._sqlite3_bind_int=Z.Hc)(a,b,c);d._sqlite3_bind_int64=(a,b,c,e)=>(d._sqlite3_bind_int64=Z.Ic)(a,b,c,e);d._sqlite3_bind_null=(a,b)=>(d._sqlite3_bind_null=Z.Jc)(a,b);d._sqlite3_bind_pointer=(a,b,c,e,f)=>(d._sqlite3_bind_pointer=Z.Kc)(a,b,c,e,f);d._sqlite3_bind_text=(a,b,c,e,f)=>(d._sqlite3_bind_text=Z.Lc)(a,b,c,e,f);d._sqlite3_bind_text64=(a,b,c,e,f,h,k)=>(d._sqlite3_bind_text64=Z.Mc)(a,b,c,e,f,h,k);
d._sqlite3_bind_text16=(a,b,c,e,f)=>(d._sqlite3_bind_text16=Z.Nc)(a,b,c,e,f);d._sqlite3_bind_value=(a,b,c)=>(d._sqlite3_bind_value=Z.Oc)(a,b,c);d._sqlite3_bind_zeroblob=(a,b,c)=>(d._sqlite3_bind_zeroblob=Z.Pc)(a,b,c);d._sqlite3_bind_zeroblob64=(a,b,c,e)=>(d._sqlite3_bind_zeroblob64=Z.Qc)(a,b,c,e);d._sqlite3_bind_parameter_count=a=>(d._sqlite3_bind_parameter_count=Z.Rc)(a);d._sqlite3_bind_parameter_name=(a,b)=>(d._sqlite3_bind_parameter_name=Z.Sc)(a,b);
d._sqlite3_bind_parameter_index=(a,b)=>(d._sqlite3_bind_parameter_index=Z.Tc)(a,b);d._sqlite3_db_handle=a=>(d._sqlite3_db_handle=Z.Uc)(a);d._sqlite3_stmt_readonly=a=>(d._sqlite3_stmt_readonly=Z.Vc)(a);d._sqlite3_stmt_isexplain=a=>(d._sqlite3_stmt_isexplain=Z.Wc)(a);d._sqlite3_stmt_explain=(a,b)=>(d._sqlite3_stmt_explain=Z.Xc)(a,b);d._sqlite3_stmt_busy=a=>(d._sqlite3_stmt_busy=Z.Yc)(a);d._sqlite3_next_stmt=(a,b)=>(d._sqlite3_next_stmt=Z.Zc)(a,b);
d._sqlite3_stmt_status=(a,b,c)=>(d._sqlite3_stmt_status=Z._c)(a,b,c);d._sqlite3_sql=a=>(d._sqlite3_sql=Z.$c)(a);d._sqlite3_expanded_sql=a=>(d._sqlite3_expanded_sql=Z.ad)(a);d._sqlite3_value_numeric_type=a=>(d._sqlite3_value_numeric_type=Z.bd)(a);d._sqlite3_blob_open=(a,b,c,e,f,h,k,n)=>(d._sqlite3_blob_open=Z.cd)(a,b,c,e,f,h,k,n);d._sqlite3_blob_close=a=>(d._sqlite3_blob_close=Z.dd)(a);d._sqlite3_blob_read=(a,b,c,e)=>(d._sqlite3_blob_read=Z.ed)(a,b,c,e);
d._sqlite3_blob_write=(a,b,c,e)=>(d._sqlite3_blob_write=Z.fd)(a,b,c,e);d._sqlite3_blob_bytes=a=>(d._sqlite3_blob_bytes=Z.gd)(a);d._sqlite3_blob_reopen=(a,b,c)=>(d._sqlite3_blob_reopen=Z.hd)(a,b,c);d._sqlite3_set_authorizer=(a,b,c)=>(d._sqlite3_set_authorizer=Z.id)(a,b,c);d._sqlite3_strglob=(a,b)=>(d._sqlite3_strglob=Z.jd)(a,b);d._sqlite3_strlike=(a,b,c)=>(d._sqlite3_strlike=Z.kd)(a,b,c);d._sqlite3_errmsg=a=>(d._sqlite3_errmsg=Z.ld)(a);d._sqlite3_auto_extension=a=>(d._sqlite3_auto_extension=Z.md)(a);
d._sqlite3_cancel_auto_extension=a=>(d._sqlite3_cancel_auto_extension=Z.nd)(a);d._sqlite3_reset_auto_extension=()=>(d._sqlite3_reset_auto_extension=Z.od)();d._sqlite3_prepare=(a,b,c,e,f)=>(d._sqlite3_prepare=Z.pd)(a,b,c,e,f);d._sqlite3_prepare_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare_v3=Z.qd)(a,b,c,e,f,h);d._sqlite3_prepare16=(a,b,c,e,f)=>(d._sqlite3_prepare16=Z.rd)(a,b,c,e,f);d._sqlite3_prepare16_v2=(a,b,c,e,f)=>(d._sqlite3_prepare16_v2=Z.sd)(a,b,c,e,f);
d._sqlite3_prepare16_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare16_v3=Z.td)(a,b,c,e,f,h);d._sqlite3_get_table=(a,b,c,e,f,h)=>(d._sqlite3_get_table=Z.ud)(a,b,c,e,f,h);d._sqlite3_free_table=a=>(d._sqlite3_free_table=Z.vd)(a);d._sqlite3_create_module=(a,b,c,e)=>(d._sqlite3_create_module=Z.wd)(a,b,c,e);d._sqlite3_create_module_v2=(a,b,c,e,f)=>(d._sqlite3_create_module_v2=Z.xd)(a,b,c,e,f);d._sqlite3_drop_modules=(a,b)=>(d._sqlite3_drop_modules=Z.yd)(a,b);
d._sqlite3_declare_vtab=(a,b)=>(d._sqlite3_declare_vtab=Z.zd)(a,b);d._sqlite3_vtab_on_conflict=a=>(d._sqlite3_vtab_on_conflict=Z.Ad)(a);d._sqlite3_vtab_config=(a,b,c)=>(d._sqlite3_vtab_config=Z.Bd)(a,b,c);d._sqlite3_vtab_collation=(a,b)=>(d._sqlite3_vtab_collation=Z.Cd)(a,b);d._sqlite3_vtab_in=(a,b,c)=>(d._sqlite3_vtab_in=Z.Dd)(a,b,c);d._sqlite3_vtab_rhs_value=(a,b,c)=>(d._sqlite3_vtab_rhs_value=Z.Ed)(a,b,c);d._sqlite3_vtab_distinct=a=>(d._sqlite3_vtab_distinct=Z.Fd)(a);
d._sqlite3_keyword_name=(a,b,c)=>(d._sqlite3_keyword_name=Z.Gd)(a,b,c);d._sqlite3_keyword_count=()=>(d._sqlite3_keyword_count=Z.Hd)();d._sqlite3_keyword_check=(a,b)=>(d._sqlite3_keyword_check=Z.Id)(a,b);d._sqlite3_complete=a=>(d._sqlite3_complete=Z.Jd)(a);d._sqlite3_complete16=a=>(d._sqlite3_complete16=Z.Kd)(a);d._sqlite3_libversion=()=>(d._sqlite3_libversion=Z.Ld)();d._sqlite3_libversion_number=()=>(d._sqlite3_libversion_number=Z.Md)();d._sqlite3_threadsafe=()=>(d._sqlite3_threadsafe=Z.Nd)();
d._sqlite3_initialize=()=>(d._sqlite3_initialize=Z.Od)();d._sqlite3_shutdown=()=>(d._sqlite3_shutdown=Z.Pd)();d._sqlite3_config=(a,b)=>(d._sqlite3_config=Z.Qd)(a,b);d._sqlite3_db_mutex=a=>(d._sqlite3_db_mutex=Z.Rd)(a);d._sqlite3_db_release_memory=a=>(d._sqlite3_db_release_memory=Z.Sd)(a);d._sqlite3_db_cacheflush=a=>(d._sqlite3_db_cacheflush=Z.Td)(a);d._sqlite3_db_config=(a,b,c)=>(d._sqlite3_db_config=Z.Ud)(a,b,c);d._sqlite3_last_insert_rowid=a=>(d._sqlite3_last_insert_rowid=Z.Vd)(a);
d._sqlite3_set_last_insert_rowid=(a,b,c)=>(d._sqlite3_set_last_insert_rowid=Z.Wd)(a,b,c);d._sqlite3_changes64=a=>(d._sqlite3_changes64=Z.Xd)(a);d._sqlite3_changes=a=>(d._sqlite3_changes=Z.Yd)(a);d._sqlite3_total_changes64=a=>(d._sqlite3_total_changes64=Z.Zd)(a);d._sqlite3_total_changes=a=>(d._sqlite3_total_changes=Z._d)(a);d._sqlite3_txn_state=(a,b)=>(d._sqlite3_txn_state=Z.$d)(a,b);d._sqlite3_close=a=>(d._sqlite3_close=Z.ae)(a);d._sqlite3_close_v2=a=>(d._sqlite3_close_v2=Z.be)(a);
d._sqlite3_busy_handler=(a,b,c)=>(d._sqlite3_busy_handler=Z.ce)(a,b,c);d._sqlite3_progress_handler=(a,b,c,e)=>(d._sqlite3_progress_handler=Z.de)(a,b,c,e);d._sqlite3_busy_timeout=(a,b)=>(d._sqlite3_busy_timeout=Z.ee)(a,b);d._sqlite3_interrupt=a=>(d._sqlite3_interrupt=Z.fe)(a);d._sqlite3_is_interrupted=a=>(d._sqlite3_is_interrupted=Z.ge)(a);d._sqlite3_create_function=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function=Z.he)(a,b,c,e,f,h,k,n);
d._sqlite3_create_function_v2=(a,b,c,e,f,h,k,n,m)=>(d._sqlite3_create_function_v2=Z.ie)(a,b,c,e,f,h,k,n,m);d._sqlite3_create_window_function=(a,b,c,e,f,h,k,n,m,l)=>(d._sqlite3_create_window_function=Z.je)(a,b,c,e,f,h,k,n,m,l);d._sqlite3_create_function16=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function16=Z.ke)(a,b,c,e,f,h,k,n);d._sqlite3_overload_function=(a,b,c)=>(d._sqlite3_overload_function=Z.le)(a,b,c);d._sqlite3_trace_v2=(a,b,c,e)=>(d._sqlite3_trace_v2=Z.me)(a,b,c,e);
d._sqlite3_commit_hook=(a,b,c)=>(d._sqlite3_commit_hook=Z.ne)(a,b,c);d._sqlite3_update_hook=(a,b,c)=>(d._sqlite3_update_hook=Z.oe)(a,b,c);d._sqlite3_rollback_hook=(a,b,c)=>(d._sqlite3_rollback_hook=Z.pe)(a,b,c);d._sqlite3_autovacuum_pages=(a,b,c,e)=>(d._sqlite3_autovacuum_pages=Z.qe)(a,b,c,e);d._sqlite3_wal_autocheckpoint=(a,b)=>(d._sqlite3_wal_autocheckpoint=Z.re)(a,b);d._sqlite3_wal_hook=(a,b,c)=>(d._sqlite3_wal_hook=Z.se)(a,b,c);
d._sqlite3_wal_checkpoint_v2=(a,b,c,e,f)=>(d._sqlite3_wal_checkpoint_v2=Z.te)(a,b,c,e,f);d._sqlite3_wal_checkpoint=(a,b)=>(d._sqlite3_wal_checkpoint=Z.ue)(a,b);d._sqlite3_error_offset=a=>(d._sqlite3_error_offset=Z.ve)(a);d._sqlite3_errmsg16=a=>(d._sqlite3_errmsg16=Z.we)(a);d._sqlite3_errcode=a=>(d._sqlite3_errcode=Z.xe)(a);d._sqlite3_extended_errcode=a=>(d._sqlite3_extended_errcode=Z.ye)(a);d._sqlite3_system_errno=a=>(d._sqlite3_system_errno=Z.ze)(a);d._sqlite3_errstr=a=>(d._sqlite3_errstr=Z.Ae)(a);
d._sqlite3_limit=(a,b,c)=>(d._sqlite3_limit=Z.Be)(a,b,c);d._sqlite3_open=(a,b)=>(d._sqlite3_open=Z.Ce)(a,b);d._sqlite3_open_v2=(a,b,c,e)=>(d._sqlite3_open_v2=Z.De)(a,b,c,e);d._sqlite3_open16=(a,b)=>(d._sqlite3_open16=Z.Ee)(a,b);d._sqlite3_create_collation=(a,b,c,e,f)=>(d._sqlite3_create_collation=Z.Fe)(a,b,c,e,f);d._sqlite3_create_collation_v2=(a,b,c,e,f,h)=>(d._sqlite3_create_collation_v2=Z.Ge)(a,b,c,e,f,h);d._sqlite3_create_collation16=(a,b,c,e,f)=>(d._sqlite3_create_collation16=Z.He)(a,b,c,e,f);
d._sqlite3_collation_needed=(a,b,c)=>(d._sqlite3_collation_needed=Z.Ie)(a,b,c);d._sqlite3_collation_needed16=(a,b,c)=>(d._sqlite3_collation_needed16=Z.Je)(a,b,c);d._sqlite3_get_clientdata=(a,b)=>(d._sqlite3_get_clientdata=Z.Ke)(a,b);d._sqlite3_set_clientdata=(a,b,c,e)=>(d._sqlite3_set_clientdata=Z.Le)(a,b,c,e);d._sqlite3_get_autocommit=a=>(d._sqlite3_get_autocommit=Z.Me)(a);d._sqlite3_table_column_metadata=(a,b,c,e,f,h,k,n,m)=>(d._sqlite3_table_column_metadata=Z.Ne)(a,b,c,e,f,h,k,n,m);
d._sqlite3_sleep=a=>(d._sqlite3_sleep=Z.Oe)(a);d._sqlite3_extended_result_codes=(a,b)=>(d._sqlite3_extended_result_codes=Z.Pe)(a,b);d._sqlite3_file_control=(a,b,c,e)=>(d._sqlite3_file_control=Z.Qe)(a,b,c,e);d._sqlite3_test_control=(a,b)=>(d._sqlite3_test_control=Z.Re)(a,b);d._sqlite3_create_filename=(a,b,c,e,f)=>(d._sqlite3_create_filename=Z.Se)(a,b,c,e,f);d._sqlite3_free_filename=a=>(d._sqlite3_free_filename=Z.Te)(a);d._sqlite3_uri_parameter=(a,b)=>(d._sqlite3_uri_parameter=Z.Ue)(a,b);
d._sqlite3_uri_key=(a,b)=>(d._sqlite3_uri_key=Z.Ve)(a,b);d._sqlite3_uri_boolean=(a,b,c)=>(d._sqlite3_uri_boolean=Z.We)(a,b,c);d._sqlite3_uri_int64=(a,b,c,e)=>(d._sqlite3_uri_int64=Z.Xe)(a,b,c,e);d._sqlite3_filename_database=a=>(d._sqlite3_filename_database=Z.Ye)(a);d._sqlite3_filename_journal=a=>(d._sqlite3_filename_journal=Z.Ze)(a);d._sqlite3_filename_wal=a=>(d._sqlite3_filename_wal=Z._e)(a);d._sqlite3_db_name=(a,b)=>(d._sqlite3_db_name=Z.$e)(a,b);
d._sqlite3_db_filename=(a,b)=>(d._sqlite3_db_filename=Z.af)(a,b);d._sqlite3_db_readonly=(a,b)=>(d._sqlite3_db_readonly=Z.bf)(a,b);d._sqlite3_compileoption_used=a=>(d._sqlite3_compileoption_used=Z.cf)(a);d._sqlite3_compileoption_get=a=>(d._sqlite3_compileoption_get=Z.df)(a);d._sqlite3_sourceid=()=>(d._sqlite3_sourceid=Z.ef)();d._sqlite3mc_config=(a,b,c)=>(d._sqlite3mc_config=Z.ff)(a,b,c);d._sqlite3mc_cipher_count=()=>(d._sqlite3mc_cipher_count=Z.gf)();
d._sqlite3mc_cipher_index=a=>(d._sqlite3mc_cipher_index=Z.hf)(a);d._sqlite3mc_cipher_name=a=>(d._sqlite3mc_cipher_name=Z.jf)(a);d._sqlite3mc_config_cipher=(a,b,c,e)=>(d._sqlite3mc_config_cipher=Z.kf)(a,b,c,e);d._sqlite3mc_codec_data=(a,b,c)=>(d._sqlite3mc_codec_data=Z.lf)(a,b,c);d._sqlite3_key=(a,b,c)=>(d._sqlite3_key=Z.mf)(a,b,c);d._sqlite3_key_v2=(a,b,c,e)=>(d._sqlite3_key_v2=Z.nf)(a,b,c,e);d._sqlite3_rekey_v2=(a,b,c,e)=>(d._sqlite3_rekey_v2=Z.of)(a,b,c,e);
d._sqlite3_rekey=(a,b,c)=>(d._sqlite3_rekey=Z.pf)(a,b,c);d._sqlite3mc_register_cipher=(a,b,c)=>(d._sqlite3mc_register_cipher=Z.qf)(a,b,c);d._malloc=a=>(d._malloc=Z.rf)(a);d._free=a=>(d._free=Z.sf)(a);d._RegisterExtensionFunctions=a=>(d._RegisterExtensionFunctions=Z.tf)(a);d._sqlite3Fts5BetterTrigramInit=a=>(d._sqlite3Fts5BetterTrigramInit=Z.uf)(a);d._set_authorizer=a=>(d._set_authorizer=Z.vf)(a);d._create_function=(a,b,c,e,f,h)=>(d._create_function=Z.wf)(a,b,c,e,f,h);
d._create_module=(a,b,c,e)=>(d._create_module=Z.xf)(a,b,c,e);d._progress_handler=(a,b)=>(d._progress_handler=Z.yf)(a,b);d._register_vfs=(a,b,c,e)=>(d._register_vfs=Z.zf)(a,b,c,e);d._getSqliteFree=()=>(d._getSqliteFree=Z.Af)();var Uc=d._main=(a,b)=>(Uc=d._main=Z.Bf)(a,b),eb=(a,b)=>(eb=Z.Df)(a,b),Sc=(a,b)=>(Sc=Z.Ef)(a,b),Vc=()=>(Vc=Z.Ff)(),Qc=a=>(Qc=Z.Gf)(a),Oc=a=>(Oc=Z.Hf)(a),Pc=()=>(Pc=Z.If)();d._sqlite3_version=5472;d.getTempRet0=()=>Vc();d.ccall=Y;
d.cwrap=(a,b,c,e)=>{var f=!c||c.every(h=>"number"===h||"boolean"===h);return"string"!==b&&f&&!e?d["_"+a]:(...h)=>Y(a,b,c,h,e)};
d.addFunction=(a,b)=>{if(!Mc){Mc=new WeakMap;var c=Lc.length;if(Mc)for(var e=0;e<0+c;e++){var f=Lc.get(e);f&&Mc.set(f,e)}}if(c=Mc.get(a)||0)return c;if(Nc.length)c=Nc.pop();else{try{Lc.grow(1)}catch(n){if(!(n instanceof RangeError))throw n;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}c=Lc.length-1}try{Lc.set(c,a)}catch(n){if(!(n instanceof TypeError))throw n;if("function"==typeof WebAssembly.Function){e=WebAssembly.Function;f={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"};for(var h=
{parameters:[],results:"v"==b[0]?[]:[f[b[0]]]},k=1;k<b.length;++k)h.parameters.push(f[b[k]]);b=new e(h,a)}else{e=[1];f=b.slice(0,1);b=b.slice(1);h={i:127,p:127,j:126,f:125,d:124,e:111};e.push(96);k=b.length;128>k?e.push(k):e.push(k%128|128,k>>7);for(k=0;k<b.length;++k)e.push(h[b[k]]);"v"==f?e.push(0):e.push(1,h[f]);b=[0,97,115,109,1,0,0,0,1];f=e.length;128>f?b.push(f):b.push(f%128|128,f>>7);b.push(...e);b.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);b=new WebAssembly.Module(new Uint8Array(b));b=(new WebAssembly.Instance(b,
{e:{f:a}})).exports.f}Lc.set(c,b)}Mc.set(a,c);return c};d.setValue=I;d.getValue=H;d.UTF8ToString=(a,b)=>a?J(v,a,b):"";d.stringToUTF8=(a,b,c)=>K(a,v,b,c);d.lengthBytesUTF8=Ta;d.intArrayFromString=Ua;d.intArrayToString=function(a){for(var b=[],c=0;c<a.length;c++){var e=a[c];255<e&&(e&=255);b.push(String.fromCharCode(e))}return b.join("")};d.AsciiToString=a=>{for(var b="";;){var c=v[a++];if(!c)return b;b+=String.fromCharCode(c)}};
d.UTF16ToString=(a,b)=>{var c=a>>1;for(var e=c+b/2;!(c>=e)&&qa[c];)++c;c<<=1;if(32<c-a&&Rc)return Rc.decode(v.subarray(a,c));c="";for(e=0;!(e>=b/2);++e){var f=w[a+2*e>>1];if(0==f)break;c+=String.fromCharCode(f)}return c};d.stringToUTF16=(a,b,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)w[b>>1]=a.charCodeAt(f),b+=2;w[b>>1]=0;return b-e};
d.UTF32ToString=(a,b)=>{for(var c=0,e="";!(c>=b/4);){var f=x[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e};d.stringToUTF32=(a,b,c)=>{c??=2147483647;if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var h=a.charCodeAt(f);if(55296<=h&&57343>=h){var k=a.charCodeAt(++f);h=65536+((h&1023)<<10)|k&1023}x[b>>2]=h;b+=4;if(b+4>c)break}x[b>>2]=0;return b-e};d.writeArrayToMemory=(a,b)=>{u.set(a,b)};var Wc;
Aa=function Xc(){Wc||Yc();Wc||(Aa=Xc)};
function Yc(){function a(){if(!Wc&&(Wc=!0,d.calledRun=!0,!oa)){if(!d.noFSInit&&!kb){var b,c;kb=!0;e??=d.stdin;b??=d.stdout;c??=d.stderr;e?V("stdin",e):Cb("/dev/tty","/dev/stdin");b?V("stdout",null,b):Cb("/dev/tty","/dev/stdout");c?V("stderr",null,c):Cb("/dev/tty1","/dev/stderr");Ib("/dev/stdin",0);Ib("/dev/stdout",1);Ib("/dev/stderr",1)}lb=!1;Ia(va);Ia(wa);aa(d);d.onRuntimeInitialized?.();if(Zc){var e=Uc;try{var f=e(0,0);pa=f;Ub(f)}catch(h){Tb(h)}}if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=
[d.postRun]);d.postRun.length;)f=d.postRun.shift(),xa.unshift(f);Ia(xa)}}if(!(0<B)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)ya();Ia(ua);0<B||(d.setStatus?(d.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>d.setStatus(""),1);a()},1)):a())}}if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();var Zc=!0;d.noInitialRun&&(Zc=!1);Yc();moduleRtn=ca;
function(config) {
var Module = config || {};
return moduleRtn;
var a;a||(a=typeof Module !== 'undefined' ? Module : {});var aa,ba;a.ready=new Promise(function(b,c){aa=b;ba=c});var ca=Object.assign({},a),da="./this.program",fa=(b,c)=>{throw c;},ha="object"==typeof window,ia="function"==typeof importScripts,m="",ja;
if(ha||ia)ia?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),_scriptDir&&(m=_scriptDir),0!==m.indexOf("blob:")?m=m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):m="",ia&&(ja=b=>{var c=new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)});var ka=a.print||console.log.bind(console),t=a.printErr||console.warn.bind(console);Object.assign(a,ca);ca=null;a.thisProgram&&(da=a.thisProgram);
a.quit&&(fa=a.quit);var la;a.wasmBinary&&(la=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!=typeof WebAssembly&&u("no native wasm support detected");var ma,na=!1,oa="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;
function pa(b,c,d){var e=c+d;for(d=c;b[d]&&!(d>=e);)++d;if(16<d-c&&b.buffer&&oa)return oa.decode(b.subarray(c,d));for(e="";c<d;){var f=b[c++];if(f&128){var g=b[c++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var h=b[c++]&63;f=224==(f&240)?(f&15)<<12|g<<6|h:(f&7)<<18|g<<12|h<<6|b[c++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}function v(b,c){return b?pa(x,b,c):""}
function qa(b,c,d,e){if(!(0<e))return 0;var f=d;e=d+e-1;for(var g=0;g<b.length;++g){var h=b.charCodeAt(g);if(55296<=h&&57343>=h){var p=b.charCodeAt(++g);h=65536+((h&1023)<<10)|p&1023}if(127>=h){if(d>=e)break;c[d++]=h}else{if(2047>=h){if(d+1>=e)break;c[d++]=192|h>>6}else{if(65535>=h){if(d+2>=e)break;c[d++]=224|h>>12}else{if(d+3>=e)break;c[d++]=240|h>>18;c[d++]=128|h>>12&63}c[d++]=128|h>>6&63}c[d++]=128|h&63}}c[d]=0;return d-f}function ra(b,c,d){return qa(b,x,c,d)}
function sa(b){for(var c=0,d=0;d<b.length;++d){var e=b.charCodeAt(d);127>=e?c++:2047>=e?c+=2:55296<=e&&57343>=e?(c+=4,++d):c+=3}return c}var y,x,A,ta,B,C,ua,va;function wa(){var b=ma.buffer;a.HEAP8=y=new Int8Array(b);a.HEAP16=A=new Int16Array(b);a.HEAP32=B=new Int32Array(b);a.HEAPU8=x=new Uint8Array(b);a.HEAPU16=ta=new Uint16Array(b);a.HEAPU32=C=new Uint32Array(b);a.HEAPF32=ua=new Float32Array(b);a.HEAPF64=va=new Float64Array(b)}var E,xa=[],ya=[],za=[],Aa=[];
function Ba(){var b=a.preRun.shift();xa.unshift(b)}var F=0,Ca=null,Da=null;function u(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";t(b);na=!0;b=new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.");ba(b);throw b;}function Ea(){return I.startsWith("data:application/octet-stream;base64,")}var I;if(a.locateFile){if(I="wa-sqlite.wasm",!Ea()){var Fa=I;I=a.locateFile?a.locateFile(Fa,m):m+Fa}}else I=(new URL("wa-sqlite.wasm",import.meta.url)).href;
function Ga(){var b=I;try{if(b==I&&la)return new Uint8Array(la);if(ja)return ja(b);throw"both async and sync fetching of the wasm failed";}catch(c){u(c)}}function Ha(){return la||!ha&&!ia||"function"!=typeof fetch?Promise.resolve().then(function(){return Ga()}):fetch(I,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+I+"'";return b.arrayBuffer()}).catch(function(){return Ga()})}var K,L;
function Ia(b){this.name="ExitStatus";this.message="Program terminated with exit("+b+")";this.status=b}function Ja(b){for(;0<b.length;)b.shift()(a)}function M(b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":return y[b>>0];case "i8":return y[b>>0];case "i16":return A[b>>1];case "i32":return B[b>>2];case "i64":return B[b>>2];case "float":return ua[b>>2];case "double":return va[b>>3];case "*":return C[b>>2];default:u("invalid type for getValue: "+c)}return null}
function N(b,c,d="i8"){d.endsWith("*")&&(d="*");switch(d){case "i1":y[b>>0]=c;break;case "i8":y[b>>0]=c;break;case "i16":A[b>>1]=c;break;case "i32":B[b>>2]=c;break;case "i64":L=[c>>>0,(K=c,1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];B[b>>2]=L[0];B[b+4>>2]=L[1];break;case "float":ua[b>>2]=c;break;case "double":va[b>>3]=c;break;case "*":C[b>>2]=c;break;default:u("invalid type for setValue: "+d)}}
var Ka=(b,c)=>{for(var d=0,e=b.length-1;0<=e;e--){var f=b[e];"."===f?b.splice(e,1):".."===f?(b.splice(e,1),d++):d&&(b.splice(e,1),d--)}if(c)for(;d;d--)b.unshift("..");return b},O=b=>{var c="/"===b.charAt(0),d="/"===b.substr(-1);(b=Ka(b.split("/").filter(e=>!!e),!c).join("/"))||c||(b=".");b&&d&&(b+="/");return(c?"/":"")+b},La=b=>{var c=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(b).slice(1);b=c[0];c=c[1];if(!b&&!c)return".";c&&(c=c.substr(0,c.length-1));return b+c},Ma=b=>{if("/"===
b)return"/";b=O(b);b=b.replace(/\/$/,"");var c=b.lastIndexOf("/");return-1===c?b:b.substr(c+1)};function Na(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var b=new Uint8Array(1);return()=>{crypto.getRandomValues(b);return b[0]}}return()=>u("randomDevice")}
function Oa(){for(var b="",c=!1,d=arguments.length-1;-1<=d&&!c;d--){c=0<=d?arguments[d]:"/";if("string"!=typeof c)throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";b=c+"/"+b;c="/"===c.charAt(0)}b=Ka(b.split("/").filter(e=>!!e),!c).join("/");return(c?"/":"")+b||"."}function Pa(b,c,d){d=Array(0<d?d:sa(b)+1);b=qa(b,d,0,d.length);c&&(d.length=b);return d}var Qa=[];function Ra(b,c){Qa[b]={input:[],Nf:[],Zf:c};Sa(b,Ta)}
var Ta={open:function(b){var c=Qa[b.node.bg];if(!c)throw new P(43);b.Of=c;b.seekable=!1},close:function(b){b.Of.Zf.Wf(b.Of)},Wf:function(b){b.Of.Zf.Wf(b.Of)},read:function(b,c,d,e){if(!b.Of||!b.Of.Zf.tg)throw new P(60);for(var f=0,g=0;g<e;g++){try{var h=b.Of.Zf.tg(b.Of)}catch(p){throw new P(29);}if(void 0===h&&0===f)throw new P(6);if(null===h||void 0===h)break;f++;c[d+g]=h}f&&(b.node.timestamp=Date.now());return f},write:function(b,c,d,e){if(!b.Of||!b.Of.Zf.mg)throw new P(60);try{for(var f=0;f<e;f++)b.Of.Zf.mg(b.Of,
c[d+f])}catch(g){throw new P(29);}e&&(b.node.timestamp=Date.now());return f}},Ua={tg:function(b){if(!b.input.length){var c=null;"undefined"!=typeof window&&"function"==typeof window.prompt?(c=window.prompt("Input: "),null!==c&&(c+="\n")):"function"==typeof readline&&(c=readline(),null!==c&&(c+="\n"));if(!c)return null;b.input=Pa(c,!0)}return b.input.shift()},mg:function(b,c){null===c||10===c?(ka(pa(b.Nf,0)),b.Nf=[]):0!=c&&b.Nf.push(c)},Wf:function(b){b.Nf&&0<b.Nf.length&&(ka(pa(b.Nf,0)),b.Nf=[])}},
Va={mg:function(b,c){null===c||10===c?(t(pa(b.Nf,0)),b.Nf=[]):0!=c&&b.Nf.push(c)},Wf:function(b){b.Nf&&0<b.Nf.length&&(t(pa(b.Nf,0)),b.Nf=[])}},Q={Qf:null,Rf:function(){return Q.createNode(null,"/",16895,0)},createNode:function(b,c,d,e){if(24576===(d&61440)||4096===(d&61440))throw new P(63);Q.Qf||(Q.Qf={dir:{node:{Pf:Q.Hf.Pf,Mf:Q.Hf.Mf,$f:Q.Hf.$f,eg:Q.Hf.eg,yg:Q.Hf.yg,jg:Q.Hf.jg,hg:Q.Hf.hg,xg:Q.Hf.xg,ig:Q.Hf.ig},stream:{Vf:Q.If.Vf}},file:{node:{Pf:Q.Hf.Pf,Mf:Q.Hf.Mf},stream:{Vf:Q.If.Vf,read:Q.If.read,
write:Q.If.write,pg:Q.If.pg,fg:Q.If.fg,gg:Q.If.gg}},link:{node:{Pf:Q.Hf.Pf,Mf:Q.Hf.Mf,cg:Q.Hf.cg},stream:{}},qg:{node:{Pf:Q.Hf.Pf,Mf:Q.Hf.Mf},stream:Wa}});d=Xa(b,c,d,e);16384===(d.mode&61440)?(d.Hf=Q.Qf.dir.node,d.If=Q.Qf.dir.stream,d.Jf={}):32768===(d.mode&61440)?(d.Hf=Q.Qf.file.node,d.If=Q.Qf.file.stream,d.Lf=0,d.Jf=null):40960===(d.mode&61440)?(d.Hf=Q.Qf.link.node,d.If=Q.Qf.link.stream):8192===(d.mode&61440)&&(d.Hf=Q.Qf.qg.node,d.If=Q.Qf.qg.stream);d.timestamp=Date.now();b&&(b.Jf[c]=d,b.timestamp=
d.timestamp);return d},Og:function(b){return b.Jf?b.Jf.subarray?b.Jf.subarray(0,b.Lf):new Uint8Array(b.Jf):new Uint8Array(0)},rg:function(b,c){var d=b.Jf?b.Jf.length:0;d>=c||(c=Math.max(c,d*(1048576>d?2:1.125)>>>0),0!=d&&(c=Math.max(c,256)),d=b.Jf,b.Jf=new Uint8Array(c),0<b.Lf&&b.Jf.set(d.subarray(0,b.Lf),0))},Lg:function(b,c){if(b.Lf!=c)if(0==c)b.Jf=null,b.Lf=0;else{var d=b.Jf;b.Jf=new Uint8Array(c);d&&b.Jf.set(d.subarray(0,Math.min(c,b.Lf)));b.Lf=c}},Hf:{Pf:function(b){var c={};c.Eg=8192===(b.mode&
61440)?b.id:1;c.lg=b.id;c.mode=b.mode;c.Jg=1;c.uid=0;c.Gg=0;c.bg=b.bg;16384===(b.mode&61440)?c.size=4096:32768===(b.mode&61440)?c.size=b.Lf:40960===(b.mode&61440)?c.size=b.link.length:c.size=0;c.Ag=new Date(b.timestamp);c.Ig=new Date(b.timestamp);c.Dg=new Date(b.timestamp);c.Bg=4096;c.Cg=Math.ceil(c.size/c.Bg);return c},Mf:function(b,c){void 0!==c.mode&&(b.mode=c.mode);void 0!==c.timestamp&&(b.timestamp=c.timestamp);void 0!==c.size&&Q.Lg(b,c.size)},$f:function(){throw Ya[44];},eg:function(b,c,d,e){return Q.createNode(b,
c,d,e)},yg:function(b,c,d){if(16384===(b.mode&61440)){try{var e=R(c,d)}catch(g){}if(e)for(var f in e.Jf)throw new P(55);}delete b.parent.Jf[b.name];b.parent.timestamp=Date.now();b.name=d;c.Jf[d]=b;c.timestamp=b.parent.timestamp;b.parent=c},jg:function(b,c){delete b.Jf[c];b.timestamp=Date.now()},hg:function(b,c){var d=R(b,c),e;for(e in d.Jf)throw new P(55);delete b.Jf[c];b.timestamp=Date.now()},xg:function(b){var c=[".",".."],d;for(d in b.Jf)b.Jf.hasOwnProperty(d)&&c.push(d);return c},ig:function(b,
c,d){b=Q.createNode(b,c,41471,0);b.link=d;return b},cg:function(b){if(40960!==(b.mode&61440))throw new P(28);return b.link}},If:{read:function(b,c,d,e,f){var g=b.node.Jf;if(f>=b.node.Lf)return 0;b=Math.min(b.node.Lf-f,e);if(8<b&&g.subarray)c.set(g.subarray(f,f+b),d);else for(e=0;e<b;e++)c[d+e]=g[f+e];return b},write:function(b,c,d,e,f,g){c.buffer===y.buffer&&(g=!1);if(!e)return 0;b=b.node;b.timestamp=Date.now();if(c.subarray&&(!b.Jf||b.Jf.subarray)){if(g)return b.Jf=c.subarray(d,d+e),b.Lf=e;if(0===
b.Lf&&0===f)return b.Jf=c.slice(d,d+e),b.Lf=e;if(f+e<=b.Lf)return b.Jf.set(c.subarray(d,d+e),f),e}Q.rg(b,f+e);if(b.Jf.subarray&&c.subarray)b.Jf.set(c.subarray(d,d+e),f);else for(g=0;g<e;g++)b.Jf[f+g]=c[d+g];b.Lf=Math.max(b.Lf,f+e);return e},Vf:function(b,c,d){1===d?c+=b.position:2===d&&32768===(b.node.mode&61440)&&(c+=b.node.Lf);if(0>c)throw new P(28);return c},pg:function(b,c,d){Q.rg(b.node,c+d);b.node.Lf=Math.max(b.node.Lf,c+d)},fg:function(b,c,d,e,f){if(32768!==(b.node.mode&61440))throw new P(43);
b=b.node.Jf;if(f&2||b.buffer!==y.buffer){if(0<d||d+c<b.length)b.subarray?b=b.subarray(d,d+c):b=Array.prototype.slice.call(b,d,d+c);d=!0;c=65536*Math.ceil(c/65536);(f=Za(65536,c))?(x.fill(0,f,f+c),c=f):c=0;if(!c)throw new P(48);y.set(b,c)}else d=!1,c=b.byteOffset;return{Kg:c,zg:d}},gg:function(b,c,d,e){Q.If.write(b,c,0,e,d,!1);return 0}}},$a=null,ab={},S=[],bb=1,T=null,cb=!0,P=null,Ya={},V=(b,c={})=>{b=Oa(b);if(!b)return{path:"",node:null};c=Object.assign({sg:!0,ng:0},c);if(8<c.ng)throw new P(32);
b=b.split("/").filter(h=>!!h);for(var d=$a,e="/",f=0;f<b.length;f++){var g=f===b.length-1;if(g&&c.parent)break;d=R(d,b[f]);e=O(e+"/"+b[f]);d.Xf&&(!g||g&&c.sg)&&(d=d.Xf.root);if(!g||c.Uf)for(g=0;40960===(d.mode&61440);)if(d=db(e),e=Oa(La(e),d),d=V(e,{ng:c.ng+1}).node,40<g++)throw new P(32);}return{path:e,node:d}},eb=b=>{for(var c;;){if(b===b.parent)return b=b.Rf.vg,c?"/"!==b[b.length-1]?b+"/"+c:b+c:b;c=c?b.name+"/"+c:b.name;b=b.parent}},fb=(b,c)=>{for(var d=0,e=0;e<c.length;e++)d=(d<<5)-d+c.charCodeAt(e)|
0;return(b+d>>>0)%T.length},gb=b=>{var c=fb(b.parent.id,b.name);if(T[c]===b)T[c]=b.Yf;else for(c=T[c];c;){if(c.Yf===b){c.Yf=b.Yf;break}c=c.Yf}},R=(b,c)=>{var d;if(d=(d=hb(b,"x"))?d:b.Hf.$f?0:2)throw new P(d,b);for(d=T[fb(b.id,c)];d;d=d.Yf){var e=d.name;if(d.parent.id===b.id&&e===c)return d}return b.Hf.$f(b,c)},Xa=(b,c,d,e)=>{b=new ib(b,c,d,e);c=fb(b.parent.id,b.name);b.Yf=T[c];return T[c]=b},jb={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},kb=b=>{var c=["r","w","rw"][b&3];b&512&&(c+="w");return c},
hb=(b,c)=>{if(cb)return 0;if(!c.includes("r")||b.mode&292){if(c.includes("w")&&!(b.mode&146)||c.includes("x")&&!(b.mode&73))return 2}else return 2;return 0},lb=(b,c)=>{try{return R(b,c),20}catch(d){}return hb(b,"wx")},mb=(b,c,d)=>{try{var e=R(b,c)}catch(f){return f.Kf}if(b=hb(b,"wx"))return b;if(d){if(16384!==(e.mode&61440))return 54;if(e===e.parent||"/"===eb(e))return 10}else if(16384===(e.mode&61440))return 31;return 0},nb=(b=0)=>{for(;4096>=b;b++)if(!S[b])return b;throw new P(33);},pb=(b,c)=>{ob||
(ob=function(){this.dg={}},ob.prototype={},Object.defineProperties(ob.prototype,{object:{get:function(){return this.node},set:function(d){this.node=d}},flags:{get:function(){return this.dg.flags},set:function(d){this.dg.flags=d}},position:{get:function(){return this.dg.position},set:function(d){this.dg.position=d}}}));b=Object.assign(new ob,b);c=nb(c);b.Sf=c;return S[c]=b},Wa={open:b=>{b.If=ab[b.node.bg].If;b.If.open&&b.If.open(b)},Vf:()=>{throw new P(70);}},Sa=(b,c)=>{ab[b]={If:c}},qb=(b,c)=>{var d=
"/"===c,e=!c;if(d&&$a)throw new P(10);if(!d&&!e){var f=V(c,{sg:!1});c=f.path;f=f.node;if(f.Xf)throw new P(10);if(16384!==(f.mode&61440))throw new P(54);}c={type:b,Pg:{},vg:c,Hg:[]};b=b.Rf(c);b.Rf=c;c.root=b;d?$a=b:f&&(f.Xf=c,f.Rf&&f.Rf.Hg.push(c))},rb=(b,c,d)=>{var e=V(b,{parent:!0}).node;b=Ma(b);if(!b||"."===b||".."===b)throw new P(28);var f=lb(e,b);if(f)throw new P(f);if(!e.Hf.eg)throw new P(63);return e.Hf.eg(e,b,c,d)},W=(b,c)=>rb(b,(void 0!==c?c:511)&1023|16384,0),sb=(b,c,d)=>{"undefined"==typeof d&&
(d=c,c=438);rb(b,c|8192,d)},tb=(b,c)=>{if(!Oa(b))throw new P(44);var d=V(c,{parent:!0}).node;if(!d)throw new P(44);c=Ma(c);var e=lb(d,c);if(e)throw new P(e);if(!d.Hf.ig)throw new P(63);d.Hf.ig(d,c,b)},ub=b=>{var c=V(b,{parent:!0}).node;b=Ma(b);var d=R(c,b),e=mb(c,b,!0);if(e)throw new P(e);if(!c.Hf.hg)throw new P(63);if(d.Xf)throw new P(10);c.Hf.hg(c,b);gb(d)},db=b=>{b=V(b).node;if(!b)throw new P(44);if(!b.Hf.cg)throw new P(28);return Oa(eb(b.parent),b.Hf.cg(b))},vb=(b,c)=>{b=V(b,{Uf:!c}).node;if(!b)throw new P(44);
if(!b.Hf.Pf)throw new P(63);return b.Hf.Pf(b)},wb=b=>vb(b,!0),xb=(b,c)=>{b="string"==typeof b?V(b,{Uf:!0}).node:b;if(!b.Hf.Mf)throw new P(63);b.Hf.Mf(b,{mode:c&4095|b.mode&-4096,timestamp:Date.now()})},yb=(b,c)=>{if(0>c)throw new P(28);b="string"==typeof b?V(b,{Uf:!0}).node:b;if(!b.Hf.Mf)throw new P(63);if(16384===(b.mode&61440))throw new P(31);if(32768!==(b.mode&61440))throw new P(28);var d=hb(b,"w");if(d)throw new P(d);b.Hf.Mf(b,{size:c,timestamp:Date.now()})},Ab=(b,c,d)=>{if(""===b)throw new P(44);
if("string"==typeof c){var e=jb[c];if("undefined"==typeof e)throw Error("Unknown file open mode: "+c);c=e}d=c&64?("undefined"==typeof d?438:d)&4095|32768:0;if("object"==typeof b)var f=b;else{b=O(b);try{f=V(b,{Uf:!(c&131072)}).node}catch(g){}}e=!1;if(c&64)if(f){if(c&128)throw new P(20);}else f=rb(b,d,0),e=!0;if(!f)throw new P(44);8192===(f.mode&61440)&&(c&=-513);if(c&65536&&16384!==(f.mode&61440))throw new P(54);if(!e&&(d=f?40960===(f.mode&61440)?32:16384===(f.mode&61440)&&("r"!==kb(c)||c&512)?31:
hb(f,kb(c)):44))throw new P(d);c&512&&!e&&yb(f,0);c&=-131713;f=pb({node:f,path:eb(f),flags:c,seekable:!0,position:0,If:f.If,Ng:[],error:!1});f.If.open&&f.If.open(f);!a.logReadFiles||c&1||(zb||(zb={}),b in zb||(zb[b]=1));return f},Bb=(b,c,d)=>{if(null===b.Sf)throw new P(8);if(!b.seekable||!b.If.Vf)throw new P(70);if(0!=d&&1!=d&&2!=d)throw new P(28);b.position=b.If.Vf(b,c,d);b.Ng=[]},Cb=()=>{P||(P=function(b,c){this.node=c;this.Mg=function(d){this.Kf=d};this.Mg(b);this.message="FS error"},P.prototype=
Error(),P.prototype.constructor=P,[44].forEach(b=>{Ya[b]=new P(b);Ya[b].stack="<generic error, no stack>"}))},Db,Eb=(b,c)=>{var d=0;b&&(d|=365);c&&(d|=146);return d},Gb=(b,c,d)=>{b=O("/dev/"+b);var e=Eb(!!c,!!d);Fb||(Fb=64);var f=Fb++<<8|0;Sa(f,{open:g=>{g.seekable=!1},close:()=>{d&&d.buffer&&d.buffer.length&&d(10)},read:(g,h,p,l)=>{for(var k=0,n=0;n<l;n++){try{var q=c()}catch(r){throw new P(29);}if(void 0===q&&0===k)throw new P(6);if(null===q||void 0===q)break;k++;h[p+n]=q}k&&(g.node.timestamp=Date.now());
return k},write:(g,h,p,l)=>{for(var k=0;k<l;k++)try{d(h[p+k])}catch(n){throw new P(29);}l&&(g.node.timestamp=Date.now());return k}});sb(b,e,f)},Fb,X={},ob,zb;function Hb(b,c,d){if("/"===c.charAt(0))return c;b=-100===b?"/":Y(b).path;if(0==c.length){if(!d)throw new P(44);return b}return O(b+"/"+c)}
function Ib(b,c,d){try{var e=b(c)}catch(g){if(g&&g.node&&O(c)!==O(eb(g.node)))return-54;throw g;}B[d>>2]=e.Eg;B[d+8>>2]=e.lg;B[d+12>>2]=e.mode;C[d+16>>2]=e.Jg;B[d+20>>2]=e.uid;B[d+24>>2]=e.Gg;B[d+28>>2]=e.bg;L=[e.size>>>0,(K=e.size,1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];B[d+40>>2]=L[0];B[d+44>>2]=L[1];B[d+48>>2]=4096;B[d+52>>2]=e.Cg;b=e.Ag.getTime();c=e.Ig.getTime();var f=e.Dg.getTime();L=[Math.floor(b/1E3)>>>0,(K=
Math.floor(b/1E3),1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];B[d+56>>2]=L[0];B[d+60>>2]=L[1];C[d+64>>2]=b%1E3*1E3;L=[Math.floor(c/1E3)>>>0,(K=Math.floor(c/1E3),1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];B[d+72>>2]=L[0];B[d+76>>2]=L[1];C[d+80>>2]=c%1E3*1E3;L=[Math.floor(f/1E3)>>>0,(K=Math.floor(f/1E3),1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/
4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];B[d+88>>2]=L[0];B[d+92>>2]=L[1];C[d+96>>2]=f%1E3*1E3;L=[e.lg>>>0,(K=e.lg,1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];B[d+104>>2]=L[0];B[d+108>>2]=L[1];return 0}var Jb=void 0;function Kb(){Jb+=4;return B[Jb-4>>2]}function Y(b){b=S[b];if(!b)throw new P(8);return b}function Lb(b){return C[b>>2]+4294967296*B[b+4>>2]}
var Mb=[0,31,60,91,121,152,182,213,244,274,305,335],Nb=[0,31,59,90,120,151,181,212,243,273,304,334];function Ob(b){var c=sa(b)+1,d=Pb(c);d&&qa(b,y,d,c);return d}var Qb={};
function Rb(){if(!Sb){var b={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:da||"./this.program"},c;for(c in Qb)void 0===Qb[c]?delete b[c]:b[c]=Qb[c];var d=[];for(c in b)d.push(c+"="+b[c]);Sb=d}return Sb}var Sb;function Tb(b,c){Tb.wg||(Tb.wg=Na());for(var d=0;d<c;d++)y[b+d>>0]=Tb.wg();return 0}function Ub(){}function Vb(){}function Wb(){}function Xb(){}
function Yb(){}function Zb(){}function $b(){}function ac(){}function bc(){}function cc(){}function dc(){}function ec(){}function fc(){}function gc(){}function hc(){}function ic(){}function jc(){}function kc(){}function lc(){}function mc(){}function nc(){}function oc(){}function pc(){}function qc(){}function rc(){}function sc(){}function tc(){}function uc(){}function vc(){}function wc(){}function xc(){}function yc(){}function zc(){}function Ac(){}function Bc(){}function Cc(){}function Dc(){}
function Ec(){}function Fc(){}var Gc=void 0,Hc=[];function Ic(b,c){y.set(b,c)}function Z(b,c,d,e){var f={string:k=>{var n=0;if(null!==k&&void 0!==k&&0!==k){var q=(k.length<<2)+1;n=Jc(q);ra(k,n,q)}return n},array:k=>{var n=Jc(k.length);Ic(k,n);return n}};b=a["_"+b];var g=[],h=0;if(e)for(var p=0;p<e.length;p++){var l=f[d[p]];l?(0===h&&(h=Kc()),g[p]=l(e[p])):g[p]=e[p]}d=b.apply(null,g);return d=function(k){0!==h&&Lc(h);return"string"===c?v(k):"boolean"===c?!!k:k}(d)}
var Mc="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function ib(b,c,d,e){b||(b=this);this.parent=b;this.Rf=b.Rf;this.Xf=null;this.id=bb++;this.name=c;this.mode=d;this.Hf={};this.If={};this.bg=e}Object.defineProperties(ib.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(b){b?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(b){b?this.mode|=146:this.mode&=-147}}});Cb();T=Array(4096);qb(Q,"/");W("/tmp");W("/home");
W("/home/web_user");(()=>{W("/dev");Sa(259,{read:()=>0,write:(c,d,e,f)=>f});sb("/dev/null",259);Ra(1280,Ua);Ra(1536,Va);sb("/dev/tty",1280);sb("/dev/tty1",1536);var b=Na();Gb("random",b);Gb("urandom",b);W("/dev/shm");W("/dev/shm/tmp")})();(()=>{W("/proc");var b=W("/proc/self");W("/proc/self/fd");qb({Rf:()=>{var c=Xa(b,"fd",16895,73);c.Hf={$f:(d,e)=>{var f=S[+e];if(!f)throw new P(8);d={parent:null,Rf:{vg:"fake"},Hf:{cg:()=>f.path}};return d.parent=d}};return c}},"/proc/self/fd")})();
(function(){const b=new Map;a.setAuthorizer=function(c,d,e){d?b.set(c,{f:d,og:e}):b.delete(c);return Z("set_authorizer","number",["number"],[c])};Ub=function(c,d,e,f,g,h){if(b.has(c)){const {f:p,og:l}=b.get(c);return p(l,d,e?v(e):null,f?v(f):null,g?v(g):null,h?v(h):null)}return 0}})();
(function(){const b=new Map,c=new Map;a.createFunction=function(d,e,f,g,h,p){const l=b.size;b.set(l,{f:p,Tf:h});return Z("create_function","number","number string number number number number".split(" "),[d,e,f,g,l,0])};a.createAggregate=function(d,e,f,g,h,p,l){const k=b.size;b.set(k,{step:p,Fg:l,Tf:h});return Z("create_function","number","number string number number number number".split(" "),[d,e,f,g,k,1])};a.getFunctionUserData=function(d){return c.get(d)};Wb=function(d,e,f,g){d=b.get(d);c.set(e,
d.Tf);d.f(e,new Uint32Array(x.buffer,g,f));c.delete(e)};Yb=function(d,e,f,g){d=b.get(d);c.set(e,d.Tf);d.step(e,new Uint32Array(x.buffer,g,f));c.delete(e)};Vb=function(d,e){d=b.get(d);c.set(e,d.Tf);d.Fg(e);c.delete(e)}})();(function(){const b=new Map;a.progressHandler=function(c,d,e,f){e?b.set(c,{f:e,og:f}):b.delete(c);return Z("progress_handler",null,["number","number"],[c,d])};Xb=function(c){if(b.has(c)){const {f:d,og:e}=b.get(c);return d(e)}return 0}})();
(function(){function b(l,k){const n=`get${l}`,q=`set${l}`;return new Proxy(new DataView(x.buffer,k,"Int32"===l?4:8),{get(r,w){if(w===n)return function(z,G){if(!G)throw Error("must be little endian");return r[w](z,G)};if(w===q)return function(z,G,D){if(!D)throw Error("must be little endian");return r[w](z,G,D)};if("string"===typeof w&&w.match(/^(get)|(set)/))throw Error("invalid type");return r[w]}})}const c="object"===typeof Asyncify,d=new Map,e=new Map,f=new Map,g=c?new Set:null,h=c?new Set:null,
p=new Map;oc=function(l,k,n,q){p.set(v(l),{size:k,ag:Array.from(new Uint32Array(x.buffer,q,n))})};a.createModule=function(l,k,n,q){c&&(n.handleAsync=Asyncify.ug);const r=d.size;d.set(r,{module:n,Tf:q});q=0;n.xCreate&&(q|=1);n.xConnect&&(q|=2);n.xBestIndex&&(q|=4);n.xDisconnect&&(q|=8);n.xDestroy&&(q|=16);n.xOpen&&(q|=32);n.xClose&&(q|=64);n.xFilter&&(q|=128);n.xNext&&(q|=256);n.xEof&&(q|=512);n.xColumn&&(q|=1024);n.xRowid&&(q|=2048);n.xUpdate&&(q|=4096);n.xBegin&&(q|=8192);n.xSync&&(q|=16384);n.xCommit&&
(q|=32768);n.xRollback&&(q|=65536);n.xFindFunction&&(q|=131072);n.xRename&&(q|=262144);return Z("create_module","number",["number","string","number","number"],[l,k,r,q])};ec=function(l,k,n,q,r,w){k=d.get(k);e.set(r,k);if(c){g.delete(r);for(const z of g)e.delete(z)}q=Array.from(new Uint32Array(x.buffer,q,n)).map(z=>v(z));return k.module.xCreate(l,k.Tf,q,r,b("Int32",w))};dc=function(l,k,n,q,r,w){k=d.get(k);e.set(r,k);if(c){g.delete(r);for(const z of g)e.delete(z)}q=Array.from(new Uint32Array(x.buffer,
q,n)).map(z=>v(z));return k.module.xConnect(l,k.Tf,q,r,b("Int32",w))};$b=function(l,k){var n=e.get(l),q=p.get("sqlite3_index_info").ag;const r={};r.nConstraint=M(k+q[0],"i32");r.aConstraint=[];var w=M(k+q[1],"*"),z=p.get("sqlite3_index_constraint").size;for(var G=0;G<r.nConstraint;++G){var D=r.aConstraint,J=D.push,H=w+G*z,ea=p.get("sqlite3_index_constraint").ag,U={};U.iColumn=M(H+ea[0],"i32");U.op=M(H+ea[1],"i8");U.usable=!!M(H+ea[2],"i8");J.call(D,U)}r.nOrderBy=M(k+q[2],"i32");r.aOrderBy=[];w=M(k+
q[3],"*");z=p.get("sqlite3_index_orderby").size;for(G=0;G<r.nOrderBy;++G)D=r.aOrderBy,J=D.push,H=w+G*z,ea=p.get("sqlite3_index_orderby").ag,U={},U.iColumn=M(H+ea[0],"i32"),U.desc=!!M(H+ea[1],"i8"),J.call(D,U);r.aConstraintUsage=[];for(w=0;w<r.nConstraint;++w)r.aConstraintUsage.push({argvIndex:0,omit:!1});r.idxNum=M(k+q[5],"i32");r.idxStr=null;r.orderByConsumed=!!M(k+q[8],"i8");r.estimatedCost=M(k+q[9],"double");r.estimatedRows=M(k+q[10],"i32");r.idxFlags=M(k+q[11],"i32");r.colUsed=M(k+q[12],"i32");
l=n.module.xBestIndex(l,r);n=p.get("sqlite3_index_info").ag;q=M(k+n[4],"*");w=p.get("sqlite3_index_constraint_usage").size;for(J=0;J<r.nConstraint;++J)z=q+J*w,D=r.aConstraintUsage[J],H=p.get("sqlite3_index_constraint_usage").ag,N(z+H[0],D.argvIndex,"i32"),N(z+H[1],D.omit?1:0,"i8");N(k+n[5],r.idxNum,"i32");"string"===typeof r.idxStr&&(q=sa(r.idxStr),w=Z("sqlite3_malloc","number",["number"],[q+1]),ra(r.idxStr,w,q+1),N(k+n[6],w,"*"),N(k+n[7],1,"i32"));N(k+n[8],r.orderByConsumed,"i32");N(k+n[9],r.estimatedCost,
"double");N(k+n[10],r.estimatedRows,"i32");N(k+n[11],r.idxFlags,"i32");return l};gc=function(l){const k=e.get(l);c?g.add(l):e.delete(l);return k.module.xDisconnect(l)};fc=function(l){const k=e.get(l);c?g.add(l):e.delete(l);return k.module.xDestroy(l)};kc=function(l,k){const n=e.get(l);f.set(k,n);if(c){h.delete(k);for(const q of h)f.delete(q)}return n.module.xOpen(l,k)};ac=function(l){const k=f.get(l);c?h.add(l):f.delete(l);return k.module.xClose(l)};hc=function(l){return f.get(l).module.xEof(l)?1:
0};ic=function(l,k,n,q,r){const w=f.get(l);n=n?v(n):null;r=new Uint32Array(x.buffer,r,q);return w.module.xFilter(l,k,n,r)};jc=function(l){return f.get(l).module.xNext(l)};bc=function(l,k,n){return f.get(l).module.xColumn(l,k,n)};nc=function(l,k){return f.get(l).module.xRowid(l,b("BigInt64",k))};qc=function(l,k,n,q){const r=e.get(l);n=new Uint32Array(x.buffer,n,k);return r.module.xUpdate(l,n,b("BigInt64",q))};Zb=function(l){return e.get(l).module.xBegin(l)};pc=function(l){return e.get(l).module.xSync(l)};
cc=function(l){return e.get(l).module.xCommit(l)};mc=function(l){return e.get(l).module.xRollback(l)};lc=function(l,k){const n=e.get(l);k=v(k);return n.module.xRename(l,k)}})();
(function(){function b(g,h){const p=`get${g}`,l=`set${g}`;return new Proxy(new DataView(x.buffer,h,"Int32"===g?4:8),{get(k,n){if(n===p)return function(q,r){if(!r)throw Error("must be little endian");return k[n](q,r)};if(n===l)return function(q,r,w){if(!w)throw Error("must be little endian");return k[n](q,r,w)};if("string"===typeof n&&n.match(/^(get)|(set)/))throw Error("invalid type");return k[n]}})}const c="object"===typeof Asyncify;c&&(a.handleAsync=Asyncify.ug);const d=new Map,e=new Map;a.registerVFS=
function(g,h){if(Z("sqlite3_vfs_find","number",["string"],[g.name]))throw Error(`VFS '${g.name}' already registered`);c&&(g.handleAsync=Asyncify.ug);var p=g.mxPathName??64;const l=a._malloc(4);h=Z("register_vfs","number",["string","number","number","number"],[g.name,p,h?1:0,l]);h||(p=M(l,"*"),d.set(p,g));a._free(l);return h};const f=c?new Set:null;tc=function(g){const h=e.get(g);c?f.add(g):e.delete(g);return h.xClose(g)};Ac=function(g,h,p,l,k){return e.get(g).xRead(g,x.subarray(h,h+p),4294967296*
k+l+(0>l?2**32:0))};Fc=function(g,h,p,l,k){return e.get(g).xWrite(g,x.subarray(h,h+p),4294967296*k+l+(0>l?2**32:0))};Dc=function(g,h,p){return e.get(g).xTruncate(g,4294967296*p+h+(0>h?2**32:0))};Cc=function(g,h){return e.get(g).xSync(g,h)};xc=function(g,h){const p=e.get(g);h=b("BigInt64",h);return p.xFileSize(g,h)};yc=function(g,h){return e.get(g).xLock(g,h)};Ec=function(g,h){return e.get(g).xUnlock(g,h)};sc=function(g,h){const p=e.get(g);h=b("Int32",h);return p.xCheckReservedLock(g,h)};wc=function(g,
h,p){const l=e.get(g);p=new DataView(x.buffer,p);return l.xFileControl(g,h,p)};Bc=function(g){return e.get(g).xSectorSize(g)};vc=function(g){return e.get(g).xDeviceCharacteristics(g)};zc=function(g,h,p,l,k){g=d.get(g);e.set(p,g);if(c){f.delete(p);for(var n of f)e.delete(n)}n=null;if(l&64){n=1;const q=[];for(;n;){const r=x[h++];if(r)q.push(r);else switch(x[h]||(n=null),n){case 1:q.push(63);n=2;break;case 2:q.push(61);n=3;break;case 3:q.push(38),n=2}}n=(new TextDecoder).decode(new Uint8Array(q))}else h&&
(n=v(h));k=b("Int32",k);return g.xOpen(n,p,l,k)};uc=function(g,h,p){return d.get(g).xDelete(v(h),p)};rc=function(g,h,p,l){g=d.get(g);l=b("Int32",l);return g.xAccess(v(h),p,l)}})();
var Oc={a:function(b,c,d,e){u("Assertion failed: "+v(b)+", at: "+[c?v(c):"unknown filename",d,e?v(e):"unknown function"])},L:function(b,c){try{return b=v(b),xb(b,c),0}catch(d){if("undefined"==typeof X||!(d instanceof P))throw d;return-d.Kf}},Q:function(b,c,d){try{c=v(c);c=Hb(b,c);if(d&-8)return-28;var e=V(c,{Uf:!0}).node;if(!e)return-44;b="";d&4&&(b+="r");d&2&&(b+="w");d&1&&(b+="x");return b&&hb(e,b)?-2:0}catch(f){if("undefined"==typeof X||!(f instanceof P))throw f;return-f.Kf}},M:function(b,c){try{var d=
S[b];if(!d)throw new P(8);xb(d.node,c);return 0}catch(e){if("undefined"==typeof X||!(e instanceof P))throw e;return-e.Kf}},K:function(b){try{var c=S[b];if(!c)throw new P(8);var d=c.node;var e="string"==typeof d?V(d,{Uf:!0}).node:d;if(!e.Hf.Mf)throw new P(63);e.Hf.Mf(e,{timestamp:Date.now()});return 0}catch(f){if("undefined"==typeof X||!(f instanceof P))throw f;return-f.Kf}},b:function(b,c,d){Jb=d;try{var e=Y(b);switch(c){case 0:var f=Kb();return 0>f?-28:pb(e,f).Sf;case 1:case 2:return 0;case 3:return e.flags;
case 4:return f=Kb(),e.flags|=f,0;case 5:return f=Kb(),A[f+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return B[Nc()>>2]=28,-1;default:return-28}}catch(g){if("undefined"==typeof X||!(g instanceof P))throw g;return-g.Kf}},J:function(b,c){try{var d=Y(b);return Ib(vb,d.path,c)}catch(e){if("undefined"==typeof X||!(e instanceof P))throw e;return-e.Kf}},j:function(b,c,d){try{c=d+2097152>>>0<4194305-!!c?(c>>>0)+4294967296*d:NaN;if(isNaN(c))return-61;var e=S[b];if(!e)throw new P(8);if(0===
(e.flags&2097155))throw new P(28);yb(e.node,c);return 0}catch(f){if("undefined"==typeof X||!(f instanceof P))throw f;return-f.Kf}},D:function(b,c){try{if(0===c)return-28;var d=sa("/")+1;if(c<d)return-68;ra("/",b,c);return d}catch(e){if("undefined"==typeof X||!(e instanceof P))throw e;return-e.Kf}},G:function(b,c){try{return b=v(b),Ib(wb,b,c)}catch(d){if("undefined"==typeof X||!(d instanceof P))throw d;return-d.Kf}},A:function(b,c,d){try{return c=v(c),c=Hb(b,c),c=O(c),"/"===c[c.length-1]&&(c=c.substr(0,
c.length-1)),W(c,d),0}catch(e){if("undefined"==typeof X||!(e instanceof P))throw e;return-e.Kf}},F:function(b,c,d,e){try{c=v(c);var f=e&256;c=Hb(b,c,e&4096);return Ib(f?wb:vb,c,d)}catch(g){if("undefined"==typeof X||!(g instanceof P))throw g;return-g.Kf}},w:function(b,c,d,e){Jb=e;try{c=v(c);c=Hb(b,c);var f=e?Kb():0;return Ab(c,d,f).Sf}catch(g){if("undefined"==typeof X||!(g instanceof P))throw g;return-g.Kf}},u:function(b,c,d,e){try{c=v(c);c=Hb(b,c);if(0>=e)return-28;var f=db(c),g=Math.min(e,sa(f)),
h=y[d+g];ra(f,d,e+1);y[d+g]=h;return g}catch(p){if("undefined"==typeof X||!(p instanceof P))throw p;return-p.Kf}},t:function(b){try{return b=v(b),ub(b),0}catch(c){if("undefined"==typeof X||!(c instanceof P))throw c;return-c.Kf}},H:function(b,c){try{return b=v(b),Ib(vb,b,c)}catch(d){if("undefined"==typeof X||!(d instanceof P))throw d;return-d.Kf}},r:function(b,c,d){try{c=v(c);c=Hb(b,c);if(0===d){b=c;var e=V(b,{parent:!0}).node;if(!e)throw new P(44);var f=Ma(b),g=R(e,f),h=mb(e,f,!1);if(h)throw new P(h);
if(!e.Hf.jg)throw new P(63);if(g.Xf)throw new P(10);e.Hf.jg(e,f);gb(g)}else 512===d?ub(c):u("Invalid flags passed to unlinkat");return 0}catch(p){if("undefined"==typeof X||!(p instanceof P))throw p;return-p.Kf}},q:function(b,c,d){try{c=v(c);c=Hb(b,c,!0);if(d){var e=Lb(d),f=B[d+8>>2];g=1E3*e+f/1E6;d+=16;e=Lb(d);f=B[d+8>>2];h=1E3*e+f/1E6}else var g=Date.now(),h=g;b=g;var p=V(c,{Uf:!0}).node;p.Hf.Mf(p,{timestamp:Math.max(b,h)});return 0}catch(l){if("undefined"==typeof X||!(l instanceof P))throw l;return-l.Kf}},
N:function(b,c){b=new Date(1E3*Lb(b));B[c>>2]=b.getSeconds();B[c+4>>2]=b.getMinutes();B[c+8>>2]=b.getHours();B[c+12>>2]=b.getDate();B[c+16>>2]=b.getMonth();B[c+20>>2]=b.getFullYear()-1900;B[c+24>>2]=b.getDay();var d=b.getFullYear();B[c+28>>2]=(0!==d%4||0===d%100&&0!==d%400?Nb:Mb)[b.getMonth()]+b.getDate()-1|0;B[c+36>>2]=-(60*b.getTimezoneOffset());d=(new Date(b.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(b.getFullYear(),0,1)).getTimezoneOffset();B[c+32>>2]=(d!=e&&b.getTimezoneOffset()==
Math.min(e,d))|0},y:function(b,c,d,e,f,g,h){try{var p=Y(e);if(0!==(c&2)&&0===(d&2)&&2!==(p.flags&2097155))throw new P(2);if(1===(p.flags&2097155))throw new P(2);if(!p.If.fg)throw new P(43);var l=p.If.fg(p,b,f,c,d);var k=l.Kg;B[g>>2]=l.zg;C[h>>2]=k;return 0}catch(n){if("undefined"==typeof X||!(n instanceof P))throw n;return-n.Kf}},z:function(b,c,d,e,f,g){try{var h=Y(f);if(d&2){if(32768!==(h.node.mode&61440))throw new P(43);e&2||h.If.gg&&h.If.gg(h,x.slice(b,b+c),g,c,e)}}catch(p){if("undefined"==typeof X||
!(p instanceof P))throw p;return-p.Kf}},O:function(b,c,d){function e(l){return(l=l.toTimeString().match(/\(([A-Za-z ]+)\)$/))?l[1]:"GMT"}var f=(new Date).getFullYear(),g=new Date(f,0,1),h=new Date(f,6,1);f=g.getTimezoneOffset();var p=h.getTimezoneOffset();C[b>>2]=60*Math.max(f,p);B[c>>2]=Number(f!=p);b=e(g);c=e(h);b=Ob(b);c=Ob(c);p<f?(C[d>>2]=b,C[d+4>>2]=c):(C[d>>2]=c,C[d+4>>2]=b)},ta:function(){u("")},e:function(){return Date.now()},d:()=>performance.now(),o:function(b){var c=x.length;b>>>=0;if(2147483648<
b)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,b+100663296);var f=Math,g=f.min;e=Math.max(b,e);e+=(65536-e%65536)%65536;a:{var h=ma.buffer;try{ma.grow(g.call(f,2147483648,e)-h.byteLength+65535>>>16);wa();var p=1;break a}catch(l){}p=void 0}if(p)return!0}return!1},B:function(b,c){var d=0;Rb().forEach(function(e,f){var g=c+d;f=C[b+4*f>>2]=g;for(g=0;g<e.length;++g)y[f++>>0]=e.charCodeAt(g);y[f>>0]=0;d+=e.length+1});return 0},C:function(b,c){var d=Rb();C[b>>2]=d.length;var e=0;d.forEach(function(f){e+=
f.length+1});C[c>>2]=e;return 0},f:function(b){try{var c=Y(b);if(null===c.Sf)throw new P(8);c.kg&&(c.kg=null);try{c.If.close&&c.If.close(c)}catch(d){throw d;}finally{S[c.Sf]=null}c.Sf=null;return 0}catch(d){if("undefined"==typeof X||!(d instanceof P))throw d;return d.Kf}},p:function(b,c){try{var d=Y(b);y[c>>0]=d.Of?2:16384===(d.mode&61440)?3:40960===(d.mode&61440)?7:4;return 0}catch(e){if("undefined"==typeof X||!(e instanceof P))throw e;return e.Kf}},v:function(b,c,d,e){try{a:{var f=Y(b);b=c;for(var g,
h=c=0;h<d;h++){var p=C[b>>2],l=C[b+4>>2];b+=8;var k=f,n=p,q=l,r=g,w=y;if(0>q||0>r)throw new P(28);if(null===k.Sf)throw new P(8);if(1===(k.flags&2097155))throw new P(8);if(16384===(k.node.mode&61440))throw new P(31);if(!k.If.read)throw new P(28);var z="undefined"!=typeof r;if(!z)r=k.position;else if(!k.seekable)throw new P(70);var G=k.If.read(k,w,n,q,r);z||(k.position+=G);var D=G;if(0>D){var J=-1;break a}c+=D;if(D<l)break;"undefined"!==typeof g&&(g+=D)}J=c}C[e>>2]=J;return 0}catch(H){if("undefined"==
typeof X||!(H instanceof P))throw H;return H.Kf}},i:function(b,c,d,e,f){try{c=d+2097152>>>0<4194305-!!c?(c>>>0)+4294967296*d:NaN;if(isNaN(c))return 61;var g=Y(b);Bb(g,c,e);L=[g.position>>>0,(K=g.position,1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];B[f>>2]=L[0];B[f+4>>2]=L[1];g.kg&&0===c&&0===e&&(g.kg=null);return 0}catch(h){if("undefined"==typeof X||!(h instanceof P))throw h;return h.Kf}},E:function(b){try{var c=Y(b);return c.If&&
c.If.Wf?c.If.Wf(c):0}catch(d){if("undefined"==typeof X||!(d instanceof P))throw d;return d.Kf}},s:function(b,c,d,e){try{a:{var f=Y(b);b=c;for(var g,h=c=0;h<d;h++){var p=C[b>>2],l=C[b+4>>2];b+=8;var k=f,n=p,q=l,r=g,w=y;if(0>q||0>r)throw new P(28);if(null===k.Sf)throw new P(8);if(0===(k.flags&2097155))throw new P(8);if(16384===(k.node.mode&61440))throw new P(31);if(!k.If.write)throw new P(28);k.seekable&&k.flags&1024&&Bb(k,0,2);var z="undefined"!=typeof r;if(!z)r=k.position;else if(!k.seekable)throw new P(70);
var G=k.If.write(k,w,n,q,r,void 0);z||(k.position+=G);var D=G;if(0>D){var J=-1;break a}c+=D;"undefined"!==typeof g&&(g+=D)}J=c}C[e>>2]=J;return 0}catch(H){if("undefined"==typeof X||!(H instanceof P))throw H;return H.Kf}},sa:Tb,_:Ub,x:Vb,P:Wb,ca:Xb,I:Yb,ka:Zb,m:$b,ra:ac,na:bc,ia:cc,ea:dc,fa:ec,g:fc,h:gc,oa:hc,qa:ic,pa:jc,da:kc,ga:lc,ha:mc,ma:nc,c:oc,ja:pc,la:qc,aa:rc,V:sc,$:tc,ba:uc,S:vc,U:wc,Y:xc,X:yc,R:zc,n:Ac,T:Bc,Z:Cc,k:Dc,W:Ec,l:Fc};
(function(){function b(f){a.asm=f.exports;ma=a.asm.ua;wa();E=a.asm.Cf;ya.unshift(a.asm.va);F--;a.monitorRunDependencies&&a.monitorRunDependencies(F);0==F&&(null!==Ca&&(clearInterval(Ca),Ca=null),Da&&(f=Da,Da=null,f()))}function c(f){b(f.instance)}function d(f){return Ha().then(function(g){return WebAssembly.instantiate(g,e)}).then(function(g){return g}).then(f,function(g){t("failed to asynchronously prepare wasm: "+g);u(g)})}var e={a:Oc};F++;a.monitorRunDependencies&&a.monitorRunDependencies(F);if(a.instantiateWasm)try{return a.instantiateWasm(e,
b)}catch(f){t("Module.instantiateWasm callback failed with error: "+f),ba(f)}(function(){return la||"function"!=typeof WebAssembly.instantiateStreaming||Ea()||"function"!=typeof fetch?d(c):fetch(I,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(g){t("wasm streaming compile failed: "+g);t("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(ba);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.va).apply(null,arguments)};a._sqlite3_status64=function(){return(a._sqlite3_status64=a.asm.wa).apply(null,arguments)};a._sqlite3_status=function(){return(a._sqlite3_status=a.asm.xa).apply(null,arguments)};a._sqlite3_db_status=function(){return(a._sqlite3_db_status=a.asm.ya).apply(null,arguments)};a._sqlite3_msize=function(){return(a._sqlite3_msize=a.asm.za).apply(null,arguments)};
a._sqlite3_vfs_find=function(){return(a._sqlite3_vfs_find=a.asm.Aa).apply(null,arguments)};a._sqlite3_vfs_register=function(){return(a._sqlite3_vfs_register=a.asm.Ba).apply(null,arguments)};a._sqlite3_vfs_unregister=function(){return(a._sqlite3_vfs_unregister=a.asm.Ca).apply(null,arguments)};a._sqlite3_release_memory=function(){return(a._sqlite3_release_memory=a.asm.Da).apply(null,arguments)};a._sqlite3_soft_heap_limit64=function(){return(a._sqlite3_soft_heap_limit64=a.asm.Ea).apply(null,arguments)};
a._sqlite3_memory_used=function(){return(a._sqlite3_memory_used=a.asm.Fa).apply(null,arguments)};a._sqlite3_hard_heap_limit64=function(){return(a._sqlite3_hard_heap_limit64=a.asm.Ga).apply(null,arguments)};a._sqlite3_memory_highwater=function(){return(a._sqlite3_memory_highwater=a.asm.Ha).apply(null,arguments)};a._sqlite3_malloc=function(){return(a._sqlite3_malloc=a.asm.Ia).apply(null,arguments)};a._sqlite3_malloc64=function(){return(a._sqlite3_malloc64=a.asm.Ja).apply(null,arguments)};
a._sqlite3_free=function(){return(a._sqlite3_free=a.asm.Ka).apply(null,arguments)};a._sqlite3_realloc=function(){return(a._sqlite3_realloc=a.asm.La).apply(null,arguments)};a._sqlite3_realloc64=function(){return(a._sqlite3_realloc64=a.asm.Ma).apply(null,arguments)};a._sqlite3_str_vappendf=function(){return(a._sqlite3_str_vappendf=a.asm.Na).apply(null,arguments)};a._sqlite3_str_append=function(){return(a._sqlite3_str_append=a.asm.Oa).apply(null,arguments)};
a._sqlite3_str_appendchar=function(){return(a._sqlite3_str_appendchar=a.asm.Pa).apply(null,arguments)};a._sqlite3_str_appendall=function(){return(a._sqlite3_str_appendall=a.asm.Qa).apply(null,arguments)};a._sqlite3_str_appendf=function(){return(a._sqlite3_str_appendf=a.asm.Ra).apply(null,arguments)};a._sqlite3_str_finish=function(){return(a._sqlite3_str_finish=a.asm.Sa).apply(null,arguments)};a._sqlite3_str_errcode=function(){return(a._sqlite3_str_errcode=a.asm.Ta).apply(null,arguments)};
a._sqlite3_str_length=function(){return(a._sqlite3_str_length=a.asm.Ua).apply(null,arguments)};a._sqlite3_str_value=function(){return(a._sqlite3_str_value=a.asm.Va).apply(null,arguments)};a._sqlite3_str_reset=function(){return(a._sqlite3_str_reset=a.asm.Wa).apply(null,arguments)};a._sqlite3_str_new=function(){return(a._sqlite3_str_new=a.asm.Xa).apply(null,arguments)};a._sqlite3_vmprintf=function(){return(a._sqlite3_vmprintf=a.asm.Ya).apply(null,arguments)};
a._sqlite3_mprintf=function(){return(a._sqlite3_mprintf=a.asm.Za).apply(null,arguments)};a._sqlite3_vsnprintf=function(){return(a._sqlite3_vsnprintf=a.asm._a).apply(null,arguments)};a._sqlite3_snprintf=function(){return(a._sqlite3_snprintf=a.asm.$a).apply(null,arguments)};a._sqlite3_log=function(){return(a._sqlite3_log=a.asm.ab).apply(null,arguments)};a._sqlite3_randomness=function(){return(a._sqlite3_randomness=a.asm.bb).apply(null,arguments)};
a._sqlite3_stricmp=function(){return(a._sqlite3_stricmp=a.asm.cb).apply(null,arguments)};a._sqlite3_strnicmp=function(){return(a._sqlite3_strnicmp=a.asm.db).apply(null,arguments)};a._sqlite3_os_init=function(){return(a._sqlite3_os_init=a.asm.eb).apply(null,arguments)};a._sqlite3_os_end=function(){return(a._sqlite3_os_end=a.asm.fb).apply(null,arguments)};a._sqlite3_serialize=function(){return(a._sqlite3_serialize=a.asm.gb).apply(null,arguments)};
a._sqlite3_prepare_v2=function(){return(a._sqlite3_prepare_v2=a.asm.hb).apply(null,arguments)};a._sqlite3_step=function(){return(a._sqlite3_step=a.asm.ib).apply(null,arguments)};a._sqlite3_column_int64=function(){return(a._sqlite3_column_int64=a.asm.jb).apply(null,arguments)};a._sqlite3_reset=function(){return(a._sqlite3_reset=a.asm.kb).apply(null,arguments)};a._sqlite3_exec=function(){return(a._sqlite3_exec=a.asm.lb).apply(null,arguments)};
a._sqlite3_column_int=function(){return(a._sqlite3_column_int=a.asm.mb).apply(null,arguments)};a._sqlite3_finalize=function(){return(a._sqlite3_finalize=a.asm.nb).apply(null,arguments)};a._sqlite3_deserialize=function(){return(a._sqlite3_deserialize=a.asm.ob).apply(null,arguments)};a._sqlite3_database_file_object=function(){return(a._sqlite3_database_file_object=a.asm.pb).apply(null,arguments)};a._sqlite3_backup_init=function(){return(a._sqlite3_backup_init=a.asm.qb).apply(null,arguments)};
a._sqlite3_backup_step=function(){return(a._sqlite3_backup_step=a.asm.rb).apply(null,arguments)};a._sqlite3_backup_finish=function(){return(a._sqlite3_backup_finish=a.asm.sb).apply(null,arguments)};a._sqlite3_backup_remaining=function(){return(a._sqlite3_backup_remaining=a.asm.tb).apply(null,arguments)};a._sqlite3_backup_pagecount=function(){return(a._sqlite3_backup_pagecount=a.asm.ub).apply(null,arguments)};
a._sqlite3_clear_bindings=function(){return(a._sqlite3_clear_bindings=a.asm.vb).apply(null,arguments)};a._sqlite3_value_blob=function(){return(a._sqlite3_value_blob=a.asm.wb).apply(null,arguments)};a._sqlite3_value_text=function(){return(a._sqlite3_value_text=a.asm.xb).apply(null,arguments)};a._sqlite3_value_bytes=function(){return(a._sqlite3_value_bytes=a.asm.yb).apply(null,arguments)};a._sqlite3_value_bytes16=function(){return(a._sqlite3_value_bytes16=a.asm.zb).apply(null,arguments)};
a._sqlite3_value_double=function(){return(a._sqlite3_value_double=a.asm.Ab).apply(null,arguments)};a._sqlite3_value_int=function(){return(a._sqlite3_value_int=a.asm.Bb).apply(null,arguments)};a._sqlite3_value_int64=function(){return(a._sqlite3_value_int64=a.asm.Cb).apply(null,arguments)};a._sqlite3_value_subtype=function(){return(a._sqlite3_value_subtype=a.asm.Db).apply(null,arguments)};a._sqlite3_value_pointer=function(){return(a._sqlite3_value_pointer=a.asm.Eb).apply(null,arguments)};
a._sqlite3_value_text16=function(){return(a._sqlite3_value_text16=a.asm.Fb).apply(null,arguments)};a._sqlite3_value_text16be=function(){return(a._sqlite3_value_text16be=a.asm.Gb).apply(null,arguments)};a._sqlite3_value_text16le=function(){return(a._sqlite3_value_text16le=a.asm.Hb).apply(null,arguments)};a._sqlite3_value_type=function(){return(a._sqlite3_value_type=a.asm.Ib).apply(null,arguments)};a._sqlite3_value_encoding=function(){return(a._sqlite3_value_encoding=a.asm.Jb).apply(null,arguments)};
a._sqlite3_value_nochange=function(){return(a._sqlite3_value_nochange=a.asm.Kb).apply(null,arguments)};a._sqlite3_value_frombind=function(){return(a._sqlite3_value_frombind=a.asm.Lb).apply(null,arguments)};a._sqlite3_value_dup=function(){return(a._sqlite3_value_dup=a.asm.Mb).apply(null,arguments)};a._sqlite3_value_free=function(){return(a._sqlite3_value_free=a.asm.Nb).apply(null,arguments)};a._sqlite3_result_blob=function(){return(a._sqlite3_result_blob=a.asm.Ob).apply(null,arguments)};
a._sqlite3_result_blob64=function(){return(a._sqlite3_result_blob64=a.asm.Pb).apply(null,arguments)};a._sqlite3_result_double=function(){return(a._sqlite3_result_double=a.asm.Qb).apply(null,arguments)};a._sqlite3_result_error=function(){return(a._sqlite3_result_error=a.asm.Rb).apply(null,arguments)};a._sqlite3_result_error16=function(){return(a._sqlite3_result_error16=a.asm.Sb).apply(null,arguments)};a._sqlite3_result_int=function(){return(a._sqlite3_result_int=a.asm.Tb).apply(null,arguments)};
a._sqlite3_result_int64=function(){return(a._sqlite3_result_int64=a.asm.Ub).apply(null,arguments)};a._sqlite3_result_null=function(){return(a._sqlite3_result_null=a.asm.Vb).apply(null,arguments)};a._sqlite3_result_pointer=function(){return(a._sqlite3_result_pointer=a.asm.Wb).apply(null,arguments)};a._sqlite3_result_subtype=function(){return(a._sqlite3_result_subtype=a.asm.Xb).apply(null,arguments)};a._sqlite3_result_text=function(){return(a._sqlite3_result_text=a.asm.Yb).apply(null,arguments)};
a._sqlite3_result_text64=function(){return(a._sqlite3_result_text64=a.asm.Zb).apply(null,arguments)};a._sqlite3_result_text16=function(){return(a._sqlite3_result_text16=a.asm._b).apply(null,arguments)};a._sqlite3_result_text16be=function(){return(a._sqlite3_result_text16be=a.asm.$b).apply(null,arguments)};a._sqlite3_result_text16le=function(){return(a._sqlite3_result_text16le=a.asm.ac).apply(null,arguments)};a._sqlite3_result_value=function(){return(a._sqlite3_result_value=a.asm.bc).apply(null,arguments)};
a._sqlite3_result_error_toobig=function(){return(a._sqlite3_result_error_toobig=a.asm.cc).apply(null,arguments)};a._sqlite3_result_zeroblob=function(){return(a._sqlite3_result_zeroblob=a.asm.dc).apply(null,arguments)};a._sqlite3_result_zeroblob64=function(){return(a._sqlite3_result_zeroblob64=a.asm.ec).apply(null,arguments)};a._sqlite3_result_error_code=function(){return(a._sqlite3_result_error_code=a.asm.fc).apply(null,arguments)};
a._sqlite3_result_error_nomem=function(){return(a._sqlite3_result_error_nomem=a.asm.gc).apply(null,arguments)};a._sqlite3_user_data=function(){return(a._sqlite3_user_data=a.asm.hc).apply(null,arguments)};a._sqlite3_context_db_handle=function(){return(a._sqlite3_context_db_handle=a.asm.ic).apply(null,arguments)};a._sqlite3_vtab_nochange=function(){return(a._sqlite3_vtab_nochange=a.asm.jc).apply(null,arguments)};
a._sqlite3_vtab_in_first=function(){return(a._sqlite3_vtab_in_first=a.asm.kc).apply(null,arguments)};a._sqlite3_vtab_in_next=function(){return(a._sqlite3_vtab_in_next=a.asm.lc).apply(null,arguments)};a._sqlite3_aggregate_context=function(){return(a._sqlite3_aggregate_context=a.asm.mc).apply(null,arguments)};a._sqlite3_get_auxdata=function(){return(a._sqlite3_get_auxdata=a.asm.nc).apply(null,arguments)};a._sqlite3_set_auxdata=function(){return(a._sqlite3_set_auxdata=a.asm.oc).apply(null,arguments)};
a._sqlite3_column_count=function(){return(a._sqlite3_column_count=a.asm.pc).apply(null,arguments)};a._sqlite3_data_count=function(){return(a._sqlite3_data_count=a.asm.qc).apply(null,arguments)};a._sqlite3_column_blob=function(){return(a._sqlite3_column_blob=a.asm.rc).apply(null,arguments)};a._sqlite3_column_bytes=function(){return(a._sqlite3_column_bytes=a.asm.sc).apply(null,arguments)};a._sqlite3_column_bytes16=function(){return(a._sqlite3_column_bytes16=a.asm.tc).apply(null,arguments)};
a._sqlite3_column_double=function(){return(a._sqlite3_column_double=a.asm.uc).apply(null,arguments)};a._sqlite3_column_text=function(){return(a._sqlite3_column_text=a.asm.vc).apply(null,arguments)};a._sqlite3_column_value=function(){return(a._sqlite3_column_value=a.asm.wc).apply(null,arguments)};a._sqlite3_column_text16=function(){return(a._sqlite3_column_text16=a.asm.xc).apply(null,arguments)};a._sqlite3_column_type=function(){return(a._sqlite3_column_type=a.asm.yc).apply(null,arguments)};
a._sqlite3_column_name=function(){return(a._sqlite3_column_name=a.asm.zc).apply(null,arguments)};a._sqlite3_column_name16=function(){return(a._sqlite3_column_name16=a.asm.Ac).apply(null,arguments)};a._sqlite3_bind_blob=function(){return(a._sqlite3_bind_blob=a.asm.Bc).apply(null,arguments)};a._sqlite3_bind_blob64=function(){return(a._sqlite3_bind_blob64=a.asm.Cc).apply(null,arguments)};a._sqlite3_bind_double=function(){return(a._sqlite3_bind_double=a.asm.Dc).apply(null,arguments)};
a._sqlite3_bind_int=function(){return(a._sqlite3_bind_int=a.asm.Ec).apply(null,arguments)};a._sqlite3_bind_int64=function(){return(a._sqlite3_bind_int64=a.asm.Fc).apply(null,arguments)};a._sqlite3_bind_null=function(){return(a._sqlite3_bind_null=a.asm.Gc).apply(null,arguments)};a._sqlite3_bind_pointer=function(){return(a._sqlite3_bind_pointer=a.asm.Hc).apply(null,arguments)};a._sqlite3_bind_text=function(){return(a._sqlite3_bind_text=a.asm.Ic).apply(null,arguments)};
a._sqlite3_bind_text64=function(){return(a._sqlite3_bind_text64=a.asm.Jc).apply(null,arguments)};a._sqlite3_bind_text16=function(){return(a._sqlite3_bind_text16=a.asm.Kc).apply(null,arguments)};a._sqlite3_bind_value=function(){return(a._sqlite3_bind_value=a.asm.Lc).apply(null,arguments)};a._sqlite3_bind_zeroblob=function(){return(a._sqlite3_bind_zeroblob=a.asm.Mc).apply(null,arguments)};a._sqlite3_bind_zeroblob64=function(){return(a._sqlite3_bind_zeroblob64=a.asm.Nc).apply(null,arguments)};
a._sqlite3_bind_parameter_count=function(){return(a._sqlite3_bind_parameter_count=a.asm.Oc).apply(null,arguments)};a._sqlite3_bind_parameter_name=function(){return(a._sqlite3_bind_parameter_name=a.asm.Pc).apply(null,arguments)};a._sqlite3_bind_parameter_index=function(){return(a._sqlite3_bind_parameter_index=a.asm.Qc).apply(null,arguments)};a._sqlite3_db_handle=function(){return(a._sqlite3_db_handle=a.asm.Rc).apply(null,arguments)};
a._sqlite3_stmt_readonly=function(){return(a._sqlite3_stmt_readonly=a.asm.Sc).apply(null,arguments)};a._sqlite3_stmt_isexplain=function(){return(a._sqlite3_stmt_isexplain=a.asm.Tc).apply(null,arguments)};a._sqlite3_stmt_explain=function(){return(a._sqlite3_stmt_explain=a.asm.Uc).apply(null,arguments)};a._sqlite3_stmt_busy=function(){return(a._sqlite3_stmt_busy=a.asm.Vc).apply(null,arguments)};a._sqlite3_next_stmt=function(){return(a._sqlite3_next_stmt=a.asm.Wc).apply(null,arguments)};
a._sqlite3_stmt_status=function(){return(a._sqlite3_stmt_status=a.asm.Xc).apply(null,arguments)};a._sqlite3_sql=function(){return(a._sqlite3_sql=a.asm.Yc).apply(null,arguments)};a._sqlite3_expanded_sql=function(){return(a._sqlite3_expanded_sql=a.asm.Zc).apply(null,arguments)};a._sqlite3_value_numeric_type=function(){return(a._sqlite3_value_numeric_type=a.asm._c).apply(null,arguments)};a._sqlite3_blob_open=function(){return(a._sqlite3_blob_open=a.asm.$c).apply(null,arguments)};
a._sqlite3_blob_close=function(){return(a._sqlite3_blob_close=a.asm.ad).apply(null,arguments)};a._sqlite3_blob_read=function(){return(a._sqlite3_blob_read=a.asm.bd).apply(null,arguments)};a._sqlite3_blob_write=function(){return(a._sqlite3_blob_write=a.asm.cd).apply(null,arguments)};a._sqlite3_blob_bytes=function(){return(a._sqlite3_blob_bytes=a.asm.dd).apply(null,arguments)};a._sqlite3_blob_reopen=function(){return(a._sqlite3_blob_reopen=a.asm.ed).apply(null,arguments)};
a._sqlite3_set_authorizer=function(){return(a._sqlite3_set_authorizer=a.asm.fd).apply(null,arguments)};a._sqlite3_strglob=function(){return(a._sqlite3_strglob=a.asm.gd).apply(null,arguments)};a._sqlite3_strlike=function(){return(a._sqlite3_strlike=a.asm.hd).apply(null,arguments)};a._sqlite3_errmsg=function(){return(a._sqlite3_errmsg=a.asm.id).apply(null,arguments)};a._sqlite3_auto_extension=function(){return(a._sqlite3_auto_extension=a.asm.jd).apply(null,arguments)};
a._sqlite3_cancel_auto_extension=function(){return(a._sqlite3_cancel_auto_extension=a.asm.kd).apply(null,arguments)};a._sqlite3_reset_auto_extension=function(){return(a._sqlite3_reset_auto_extension=a.asm.ld).apply(null,arguments)};a._sqlite3_prepare=function(){return(a._sqlite3_prepare=a.asm.md).apply(null,arguments)};a._sqlite3_prepare_v3=function(){return(a._sqlite3_prepare_v3=a.asm.nd).apply(null,arguments)};a._sqlite3_prepare16=function(){return(a._sqlite3_prepare16=a.asm.od).apply(null,arguments)};
a._sqlite3_prepare16_v2=function(){return(a._sqlite3_prepare16_v2=a.asm.pd).apply(null,arguments)};a._sqlite3_prepare16_v3=function(){return(a._sqlite3_prepare16_v3=a.asm.qd).apply(null,arguments)};a._sqlite3_get_table=function(){return(a._sqlite3_get_table=a.asm.rd).apply(null,arguments)};a._sqlite3_free_table=function(){return(a._sqlite3_free_table=a.asm.sd).apply(null,arguments)};a._sqlite3_create_module=function(){return(a._sqlite3_create_module=a.asm.td).apply(null,arguments)};
a._sqlite3_create_module_v2=function(){return(a._sqlite3_create_module_v2=a.asm.ud).apply(null,arguments)};a._sqlite3_drop_modules=function(){return(a._sqlite3_drop_modules=a.asm.vd).apply(null,arguments)};a._sqlite3_declare_vtab=function(){return(a._sqlite3_declare_vtab=a.asm.wd).apply(null,arguments)};a._sqlite3_vtab_on_conflict=function(){return(a._sqlite3_vtab_on_conflict=a.asm.xd).apply(null,arguments)};a._sqlite3_vtab_config=function(){return(a._sqlite3_vtab_config=a.asm.yd).apply(null,arguments)};
a._sqlite3_vtab_collation=function(){return(a._sqlite3_vtab_collation=a.asm.zd).apply(null,arguments)};a._sqlite3_vtab_in=function(){return(a._sqlite3_vtab_in=a.asm.Ad).apply(null,arguments)};a._sqlite3_vtab_rhs_value=function(){return(a._sqlite3_vtab_rhs_value=a.asm.Bd).apply(null,arguments)};a._sqlite3_vtab_distinct=function(){return(a._sqlite3_vtab_distinct=a.asm.Cd).apply(null,arguments)};a._sqlite3_keyword_name=function(){return(a._sqlite3_keyword_name=a.asm.Dd).apply(null,arguments)};
a._sqlite3_keyword_count=function(){return(a._sqlite3_keyword_count=a.asm.Ed).apply(null,arguments)};a._sqlite3_keyword_check=function(){return(a._sqlite3_keyword_check=a.asm.Fd).apply(null,arguments)};a._sqlite3_complete=function(){return(a._sqlite3_complete=a.asm.Gd).apply(null,arguments)};a._sqlite3_complete16=function(){return(a._sqlite3_complete16=a.asm.Hd).apply(null,arguments)};a._sqlite3_libversion=function(){return(a._sqlite3_libversion=a.asm.Id).apply(null,arguments)};
a._sqlite3_libversion_number=function(){return(a._sqlite3_libversion_number=a.asm.Jd).apply(null,arguments)};a._sqlite3_threadsafe=function(){return(a._sqlite3_threadsafe=a.asm.Kd).apply(null,arguments)};a._sqlite3_initialize=function(){return(a._sqlite3_initialize=a.asm.Ld).apply(null,arguments)};a._sqlite3_shutdown=function(){return(a._sqlite3_shutdown=a.asm.Md).apply(null,arguments)};a._sqlite3_config=function(){return(a._sqlite3_config=a.asm.Nd).apply(null,arguments)};
a._sqlite3_db_mutex=function(){return(a._sqlite3_db_mutex=a.asm.Od).apply(null,arguments)};a._sqlite3_db_release_memory=function(){return(a._sqlite3_db_release_memory=a.asm.Pd).apply(null,arguments)};a._sqlite3_db_cacheflush=function(){return(a._sqlite3_db_cacheflush=a.asm.Qd).apply(null,arguments)};a._sqlite3_db_config=function(){return(a._sqlite3_db_config=a.asm.Rd).apply(null,arguments)};a._sqlite3_last_insert_rowid=function(){return(a._sqlite3_last_insert_rowid=a.asm.Sd).apply(null,arguments)};
a._sqlite3_set_last_insert_rowid=function(){return(a._sqlite3_set_last_insert_rowid=a.asm.Td).apply(null,arguments)};a._sqlite3_changes64=function(){return(a._sqlite3_changes64=a.asm.Ud).apply(null,arguments)};a._sqlite3_changes=function(){return(a._sqlite3_changes=a.asm.Vd).apply(null,arguments)};a._sqlite3_total_changes64=function(){return(a._sqlite3_total_changes64=a.asm.Wd).apply(null,arguments)};a._sqlite3_total_changes=function(){return(a._sqlite3_total_changes=a.asm.Xd).apply(null,arguments)};
a._sqlite3_txn_state=function(){return(a._sqlite3_txn_state=a.asm.Yd).apply(null,arguments)};a._sqlite3_close=function(){return(a._sqlite3_close=a.asm.Zd).apply(null,arguments)};a._sqlite3_close_v2=function(){return(a._sqlite3_close_v2=a.asm._d).apply(null,arguments)};a._sqlite3_busy_handler=function(){return(a._sqlite3_busy_handler=a.asm.$d).apply(null,arguments)};a._sqlite3_progress_handler=function(){return(a._sqlite3_progress_handler=a.asm.ae).apply(null,arguments)};
a._sqlite3_busy_timeout=function(){return(a._sqlite3_busy_timeout=a.asm.be).apply(null,arguments)};a._sqlite3_interrupt=function(){return(a._sqlite3_interrupt=a.asm.ce).apply(null,arguments)};a._sqlite3_is_interrupted=function(){return(a._sqlite3_is_interrupted=a.asm.de).apply(null,arguments)};a._sqlite3_create_function=function(){return(a._sqlite3_create_function=a.asm.ee).apply(null,arguments)};a._sqlite3_create_function_v2=function(){return(a._sqlite3_create_function_v2=a.asm.fe).apply(null,arguments)};
a._sqlite3_create_window_function=function(){return(a._sqlite3_create_window_function=a.asm.ge).apply(null,arguments)};a._sqlite3_create_function16=function(){return(a._sqlite3_create_function16=a.asm.he).apply(null,arguments)};a._sqlite3_overload_function=function(){return(a._sqlite3_overload_function=a.asm.ie).apply(null,arguments)};a._sqlite3_trace_v2=function(){return(a._sqlite3_trace_v2=a.asm.je).apply(null,arguments)};
a._sqlite3_commit_hook=function(){return(a._sqlite3_commit_hook=a.asm.ke).apply(null,arguments)};a._sqlite3_update_hook=function(){return(a._sqlite3_update_hook=a.asm.le).apply(null,arguments)};a._sqlite3_rollback_hook=function(){return(a._sqlite3_rollback_hook=a.asm.me).apply(null,arguments)};a._sqlite3_autovacuum_pages=function(){return(a._sqlite3_autovacuum_pages=a.asm.ne).apply(null,arguments)};
a._sqlite3_wal_autocheckpoint=function(){return(a._sqlite3_wal_autocheckpoint=a.asm.oe).apply(null,arguments)};a._sqlite3_wal_hook=function(){return(a._sqlite3_wal_hook=a.asm.pe).apply(null,arguments)};a._sqlite3_wal_checkpoint_v2=function(){return(a._sqlite3_wal_checkpoint_v2=a.asm.qe).apply(null,arguments)};a._sqlite3_wal_checkpoint=function(){return(a._sqlite3_wal_checkpoint=a.asm.re).apply(null,arguments)};
a._sqlite3_error_offset=function(){return(a._sqlite3_error_offset=a.asm.se).apply(null,arguments)};a._sqlite3_errmsg16=function(){return(a._sqlite3_errmsg16=a.asm.te).apply(null,arguments)};a._sqlite3_errcode=function(){return(a._sqlite3_errcode=a.asm.ue).apply(null,arguments)};a._sqlite3_extended_errcode=function(){return(a._sqlite3_extended_errcode=a.asm.ve).apply(null,arguments)};a._sqlite3_system_errno=function(){return(a._sqlite3_system_errno=a.asm.we).apply(null,arguments)};
a._sqlite3_errstr=function(){return(a._sqlite3_errstr=a.asm.xe).apply(null,arguments)};a._sqlite3_limit=function(){return(a._sqlite3_limit=a.asm.ye).apply(null,arguments)};a._sqlite3_open=function(){return(a._sqlite3_open=a.asm.ze).apply(null,arguments)};a._sqlite3_open_v2=function(){return(a._sqlite3_open_v2=a.asm.Ae).apply(null,arguments)};a._sqlite3_open16=function(){return(a._sqlite3_open16=a.asm.Be).apply(null,arguments)};
a._sqlite3_create_collation=function(){return(a._sqlite3_create_collation=a.asm.Ce).apply(null,arguments)};a._sqlite3_create_collation_v2=function(){return(a._sqlite3_create_collation_v2=a.asm.De).apply(null,arguments)};a._sqlite3_create_collation16=function(){return(a._sqlite3_create_collation16=a.asm.Ee).apply(null,arguments)};a._sqlite3_collation_needed=function(){return(a._sqlite3_collation_needed=a.asm.Fe).apply(null,arguments)};
a._sqlite3_collation_needed16=function(){return(a._sqlite3_collation_needed16=a.asm.Ge).apply(null,arguments)};a._sqlite3_get_clientdata=function(){return(a._sqlite3_get_clientdata=a.asm.He).apply(null,arguments)};a._sqlite3_set_clientdata=function(){return(a._sqlite3_set_clientdata=a.asm.Ie).apply(null,arguments)};a._sqlite3_get_autocommit=function(){return(a._sqlite3_get_autocommit=a.asm.Je).apply(null,arguments)};
a._sqlite3_table_column_metadata=function(){return(a._sqlite3_table_column_metadata=a.asm.Ke).apply(null,arguments)};a._sqlite3_sleep=function(){return(a._sqlite3_sleep=a.asm.Le).apply(null,arguments)};a._sqlite3_extended_result_codes=function(){return(a._sqlite3_extended_result_codes=a.asm.Me).apply(null,arguments)};a._sqlite3_file_control=function(){return(a._sqlite3_file_control=a.asm.Ne).apply(null,arguments)};
a._sqlite3_test_control=function(){return(a._sqlite3_test_control=a.asm.Oe).apply(null,arguments)};a._sqlite3_create_filename=function(){return(a._sqlite3_create_filename=a.asm.Pe).apply(null,arguments)};a._sqlite3_free_filename=function(){return(a._sqlite3_free_filename=a.asm.Qe).apply(null,arguments)};a._sqlite3_uri_parameter=function(){return(a._sqlite3_uri_parameter=a.asm.Re).apply(null,arguments)};a._sqlite3_uri_key=function(){return(a._sqlite3_uri_key=a.asm.Se).apply(null,arguments)};
a._sqlite3_uri_boolean=function(){return(a._sqlite3_uri_boolean=a.asm.Te).apply(null,arguments)};a._sqlite3_uri_int64=function(){return(a._sqlite3_uri_int64=a.asm.Ue).apply(null,arguments)};a._sqlite3_filename_database=function(){return(a._sqlite3_filename_database=a.asm.Ve).apply(null,arguments)};a._sqlite3_filename_journal=function(){return(a._sqlite3_filename_journal=a.asm.We).apply(null,arguments)};a._sqlite3_filename_wal=function(){return(a._sqlite3_filename_wal=a.asm.Xe).apply(null,arguments)};
a._sqlite3_db_name=function(){return(a._sqlite3_db_name=a.asm.Ye).apply(null,arguments)};a._sqlite3_db_filename=function(){return(a._sqlite3_db_filename=a.asm.Ze).apply(null,arguments)};a._sqlite3_db_readonly=function(){return(a._sqlite3_db_readonly=a.asm._e).apply(null,arguments)};a._sqlite3_compileoption_used=function(){return(a._sqlite3_compileoption_used=a.asm.$e).apply(null,arguments)};a._sqlite3_compileoption_get=function(){return(a._sqlite3_compileoption_get=a.asm.af).apply(null,arguments)};
a._sqlite3_sourceid=function(){return(a._sqlite3_sourceid=a.asm.bf).apply(null,arguments)};a._sqlite3mc_config=function(){return(a._sqlite3mc_config=a.asm.cf).apply(null,arguments)};a._sqlite3mc_cipher_count=function(){return(a._sqlite3mc_cipher_count=a.asm.df).apply(null,arguments)};a._sqlite3mc_cipher_index=function(){return(a._sqlite3mc_cipher_index=a.asm.ef).apply(null,arguments)};a._sqlite3mc_cipher_name=function(){return(a._sqlite3mc_cipher_name=a.asm.ff).apply(null,arguments)};
a._sqlite3mc_config_cipher=function(){return(a._sqlite3mc_config_cipher=a.asm.gf).apply(null,arguments)};a._sqlite3mc_codec_data=function(){return(a._sqlite3mc_codec_data=a.asm.hf).apply(null,arguments)};a._sqlite3_key=function(){return(a._sqlite3_key=a.asm.jf).apply(null,arguments)};a._sqlite3_key_v2=function(){return(a._sqlite3_key_v2=a.asm.kf).apply(null,arguments)};a._sqlite3_rekey_v2=function(){return(a._sqlite3_rekey_v2=a.asm.lf).apply(null,arguments)};
a._sqlite3_rekey=function(){return(a._sqlite3_rekey=a.asm.mf).apply(null,arguments)};a._sqlite3mc_register_cipher=function(){return(a._sqlite3mc_register_cipher=a.asm.nf).apply(null,arguments)};var Nc=a.___errno_location=function(){return(Nc=a.___errno_location=a.asm.of).apply(null,arguments)},Pb=a._malloc=function(){return(Pb=a._malloc=a.asm.pf).apply(null,arguments)};a._free=function(){return(a._free=a.asm.qf).apply(null,arguments)};
a._RegisterExtensionFunctions=function(){return(a._RegisterExtensionFunctions=a.asm.rf).apply(null,arguments)};a._sqlite3Fts5BetterTrigramInit=function(){return(a._sqlite3Fts5BetterTrigramInit=a.asm.sf).apply(null,arguments)};a._sqlite3Fts5HtmlInit=function(){return(a._sqlite3Fts5HtmlInit=a.asm.tf).apply(null,arguments)};a._set_authorizer=function(){return(a._set_authorizer=a.asm.uf).apply(null,arguments)};a._create_function=function(){return(a._create_function=a.asm.vf).apply(null,arguments)};
a._create_module=function(){return(a._create_module=a.asm.wf).apply(null,arguments)};a._progress_handler=function(){return(a._progress_handler=a.asm.xf).apply(null,arguments)};a._register_vfs=function(){return(a._register_vfs=a.asm.yf).apply(null,arguments)};a._getSqliteFree=function(){return(a._getSqliteFree=a.asm.zf).apply(null,arguments)};a._main=function(){return(a._main=a.asm.Af).apply(null,arguments)};
var Za=a._emscripten_builtin_memalign=function(){return(Za=a._emscripten_builtin_memalign=a.asm.Bf).apply(null,arguments)},Pc=a.getTempRet0=function(){return(Pc=a.getTempRet0=a.asm.Df).apply(null,arguments)},Kc=a.stackSave=function(){return(Kc=a.stackSave=a.asm.Ef).apply(null,arguments)},Lc=a.stackRestore=function(){return(Lc=a.stackRestore=a.asm.Ff).apply(null,arguments)},Jc=a.stackAlloc=function(){return(Jc=a.stackAlloc=a.asm.Gf).apply(null,arguments)};a._sqlite3_version=3232;a.UTF8ToString=v;
a.stringToUTF8=ra;a.lengthBytesUTF8=sa;a.getTempRet0=Pc;a.ccall=Z;a.cwrap=function(b,c,d,e){d=d||[];var f=d.every(g=>"number"===g||"boolean"===g);return"string"!==c&&f&&!e?a["_"+b]:function(){return Z(b,c,d,arguments,e)}};
a.addFunction=function(b,c){if(!Gc){Gc=new WeakMap;var d=E.length;if(Gc)for(var e=0;e<0+d;e++){var f=E.get(e);f&&Gc.set(f,e)}}if(Gc.has(b))return Gc.get(b);if(Hc.length)d=Hc.pop();else{try{E.grow(1)}catch(p){if(!(p instanceof RangeError))throw p;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}d=E.length-1}try{E.set(d,b)}catch(p){if(!(p instanceof TypeError))throw p;if("function"==typeof WebAssembly.Function){e=WebAssembly.Function;f={i:"i32",j:"i32",f:"f32",d:"f64",p:"i32"};for(var g={parameters:[],
results:"v"==c[0]?[]:[f[c[0]]]},h=1;h<c.length;++h)g.parameters.push(f[c[h]]),"j"===c[h]&&g.parameters.push("i32");c=new e(g,b)}else{e=[1];f=c.slice(0,1);c=c.slice(1);g={i:127,p:127,j:126,f:125,d:124};e.push(96);h=c.length;128>h?e.push(h):e.push(h%128|128,h>>7);for(h=0;h<c.length;++h)e.push(g[c[h]]);"v"==f?e.push(0):e.push(1,g[f]);c=[0,97,115,109,1,0,0,0,1];f=e.length;128>f?c.push(f):c.push(f%128|128,f>>7);c.push.apply(c,e);c.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);c=new WebAssembly.Module(new Uint8Array(c));
c=(new WebAssembly.Instance(c,{e:{f:b}})).exports.f}E.set(d,c)}Gc.set(b,d);return d};a.setValue=N;a.getValue=M;a.intArrayFromString=Pa;a.intArrayToString=function(b){for(var c=[],d=0;d<b.length;d++){var e=b[d];255<e&&(e&=255);c.push(String.fromCharCode(e))}return c.join("")};a.AsciiToString=function(b){for(var c="";;){var d=x[b++>>0];if(!d)return c;c+=String.fromCharCode(d)}};
a.UTF16ToString=function(b,c){var d=b>>1;for(var e=d+c/2;!(d>=e)&&ta[d];)++d;d<<=1;if(32<d-b&&Mc)return Mc.decode(x.subarray(b,d));d="";for(e=0;!(e>=c/2);++e){var f=A[b+2*e>>1];if(0==f)break;d+=String.fromCharCode(f)}return d};a.stringToUTF16=function(b,c,d){void 0===d&&(d=2147483647);if(2>d)return 0;d-=2;var e=c;d=d<2*b.length?d/2:b.length;for(var f=0;f<d;++f)A[c>>1]=b.charCodeAt(f),c+=2;A[c>>1]=0;return c-e};
a.UTF32ToString=function(b,c){for(var d=0,e="";!(d>=c/4);){var f=B[b+4*d>>2];if(0==f)break;++d;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e};a.stringToUTF32=function(b,c,d){void 0===d&&(d=2147483647);if(4>d)return 0;var e=c;d=e+d-4;for(var f=0;f<b.length;++f){var g=b.charCodeAt(f);if(55296<=g&&57343>=g){var h=b.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}B[c>>2]=g;c+=4;if(c+4>d)break}B[c>>2]=0;return c-e};a.writeArrayToMemory=Ic;var Qc;
Da=function Rc(){Qc||Sc();Qc||(Da=Rc)};
function Sc(){function b(){if(!Qc&&(Qc=!0,a.calledRun=!0,!na)){a.noFSInit||Db||(Db=!0,Cb(),a.stdin=a.stdin,a.stdout=a.stdout,a.stderr=a.stderr,a.stdin?Gb("stdin",a.stdin):tb("/dev/tty","/dev/stdin"),a.stdout?Gb("stdout",null,a.stdout):tb("/dev/tty","/dev/stdout"),a.stderr?Gb("stderr",null,a.stderr):tb("/dev/tty1","/dev/stderr"),Ab("/dev/stdin",0),Ab("/dev/stdout",1),Ab("/dev/stderr",1));cb=!1;Ja(ya);Ja(za);aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(Tc){var c=a._main;try{var d=c(0,
0);if(!noExitRuntime){if(a.onExit)a.onExit(d);na=!0}fa(d,new Ia(d))}catch(e){e instanceof Ia||"unwind"==e||fa(1,e)}}if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)c=a.postRun.shift(),Aa.unshift(c);Ja(Aa)}}if(!(0<F)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)Ba();Ja(xa);0<F||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();var Tc=!0;a.noInitialRun&&(Tc=!1);Sc();
return Module.ready
}
);
})();
export default Module;
export default Module;

View File

@@ -45,11 +45,7 @@ export default function Accordion(
containerSx,
...restProps
} = props;
const [isContentHidden, setIsContentHidden] = useState(false);
useEffect(() => {
setIsContentHidden(isClosed);
}, [isClosed]);
const [isContentHidden, setIsContentHidden] = useState(isClosed);
return (
<Flex sx={{ flexDirection: "column", ...sx }} {...restProps}>

View File

@@ -82,6 +82,7 @@ import { getWindowControls } from "../title-bar";
import useTablet from "../../hooks/use-tablet";
import { isMac } from "../../utils/platform";
import { CREATE_BUTTON_MAP } from "../../common";
import { getDragData } from "../../utils/data-transfer";
type ToolButton = {
title: string;
@@ -340,6 +341,19 @@ const TabStrip = React.memo(function TabStrip() {
e.stopPropagation();
useEditorStore.getState().addTab();
}}
onDragOver={(e) => {
e.preventDefault();
}}
onDrop={(e) => {
e.stopPropagation();
const noteId = getDragData(e.dataTransfer, "note")?.[0];
if (!noteId) return;
useEditorStore
.getState()
.openSession(noteId, { openInNewTab: true });
}}
data-test-id="tabs"
>
<ReorderableList
@@ -519,6 +533,17 @@ function Tab(props: TabProps) {
}}
className={`tab${isActive || active?.id === id ? " active" : ""}`}
data-test-id={`tab-${id}`}
onDragOver={(e) => {
e.preventDefault();
}}
onDrop={(e) => {
e.stopPropagation();
const noteId = getDragData(e.dataTransfer, "note")?.[0];
if (!noteId) return;
useEditorStore.getState().openSessionInTab(noteId, id);
}}
sx={{
height: "100%",
cursor: "pointer",

View File

@@ -40,6 +40,7 @@ import {
mdiClose,
mdiDotsVertical,
mdiTrashCanOutline,
mdiArchiveOutline,
mdiBookRemoveOutline,
mdiMagnify,
mdiMenu,
@@ -351,6 +352,7 @@ export const Cross = createIcon(mdiClose);
export const MoreVertical = createIcon(mdiDotsVertical);
export const MoreHorizontal = createIcon(mdiDotsHorizontal);
export const Trash = createIcon(mdiTrashCanOutline);
export const Archive = createIcon(mdiArchiveOutline);
export const TopicRemove = createIcon(mdiBookmarkRemoveOutline);
export const NotebookRemove = createIcon(mdiBookRemoveOutline);
export const Search = createIcon(mdiMagnify);

View File

@@ -0,0 +1,315 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import {
IFile,
IFileProvider,
ProviderSettings,
transform
} from "@notesnook-importer/core";
import { formatBytes } from "@notesnook/common";
import { ScrollContainer } from "@notesnook/ui";
import { Button, Flex, Input, Text } from "@theme-ui/components";
import { xxhash64 } from "hash-wasm";
import { useCallback, useEffect, useRef, useState } from "react";
import { useDropzone } from "react-dropzone";
import { importNote } from "../../../utils/importer";
import Accordion from "../../accordion";
import { TransformResult } from "../types";
import { useStore as useAppStore } from "../../../stores/app-store";
type FileProviderHandlerProps = {
provider: IFileProvider;
onTransformFinished: (result: TransformResult) => void;
};
type Progress = {
total: number;
done: number;
};
export function FileProviderHandler(props: FileProviderHandlerProps) {
const { provider, onTransformFinished } = props;
const [files, setFiles] = useState<File[]>([]);
const [filesProgress, setFilesProgress] = useState<Progress>({
done: 0,
total: 0
});
const [totalNoteCount, setTotalNoteCount] = useState(0);
const [_, setCounter] = useState<number>(0);
const logs = useRef<string[]>([]);
const onDrop = useCallback((acceptedFiles: File[]) => {
setFiles((files) => {
const newFiles = [...acceptedFiles, ...files];
return newFiles;
});
}, []);
const { getRootProps, getInputProps, isDragActive } = useDropzone({
onDrop,
accept: {
file: provider?.supportedExtensions?.concat([".zip"])
}
});
useEffect(() => {
setFiles([]);
}, [provider]);
async function onStartImport() {
let totalNotes = 0;
const errors: Error[] = [];
const settings: ProviderSettings = {
clientType: "browser",
hasher: { type: "xxh64", hash: xxhash64 },
storage: {
clear: async () => undefined,
get: async () => [],
write: async (data) => {
logs.current.push(
`[${new Date().toLocaleString()}] Pushing ${
data.title
} into database`
);
await importNote(data);
},
iterate: async function* () {
return null;
}
},
log: (message) => {
logs.current.push(
`[${new Date(message.date).toLocaleString()}] ${message.text}`
);
setCounter((s) => ++s);
},
reporter: () => {
setTotalNoteCount(++totalNotes);
}
};
setTotalNoteCount(0);
setFilesProgress({
total: files.length,
done: 0
});
for (const file of files) {
setFilesProgress((p) => ({
...p,
done: p.done + 1
}));
const providerFile: IFile = {
name: file.name,
modifiedAt: file.lastModified,
size: file.size,
data: file
};
errors.push(...(await transform(provider, [providerFile], settings)));
}
await useAppStore.getState().refresh();
onTransformFinished({
totalNotes,
errors
});
}
if (filesProgress.done) {
return (
<Flex sx={{ flexDirection: "column", alignItems: "stretch" }}>
<Text variant="subtitle">
Processing {filesProgress.done} of {filesProgress.total} file(s)
</Text>
<Text variant="body" sx={{ mt: 4, textAlign: "center" }}>
Found {totalNoteCount} notes
</Text>
{logs.current.length > 0 && (
<Accordion
title="Logs"
isClosed={false}
sx={{
border: "1px solid var(--border)",
mt: 2
}}
>
<ScrollContainer>
<Text
as="pre"
variant="body"
sx={{
fontFamily: "monospace",
maxHeight: 250,
p: 2
}}
>
{logs.current.map((c, index) => (
<>
<span key={index.toString()}>{c}</span>
<br />
</>
))}
</Text>
</ScrollContainer>
</Accordion>
)}
</Flex>
);
}
return (
<Flex sx={{ flexDirection: "column", alignItems: "stretch" }}>
<Text variant="subtitle">Select {provider.name} files</Text>
<Text
variant="body"
as={"div"}
sx={{ mt: 1, color: "paragraph", whiteSpace: "pre-wrap" }}
>
Check out our step-by-step guide on{" "}
<a href={provider.helpLink} target="_blank" rel="noreferrer">
how to import from {provider?.name}.
</a>
</Text>
<Flex
{...getRootProps()}
sx={{
justifyContent: "center",
alignItems: "center",
height: 100,
border: "2px dashed var(--border)",
borderRadius: "default",
mt: 2,
cursor: "pointer",
":hover": {
bg: "background-secondary"
}
}}
>
<Input {...getInputProps()} />
<Text variant="body" sx={{ textAlign: "center" }}>
{isDragActive
? "Drop the files here"
: "Drag & drop files here, or click to select files"}
<br />
<Text variant="subBody">
Only {provider?.supportedExtensions.join(", ")} files are supported.{" "}
{provider?.supportedExtensions.includes(".zip") ? null : (
<>
You can also select .zip files containing{" "}
{provider?.supportedExtensions.join(", ")} files.
</>
)}
<br />
{provider.examples ? (
<>For example, {provider.examples.join(", ")}</>
) : null}
</Text>
</Text>
</Flex>
{files.length > 0 ? (
<Accordion
isClosed
title={`${files.length} ${
files.length > 1 ? "files" : "file"
} selected`}
sx={{
border: "1px solid var(--border)",
mt: 2,
borderRadius: "default"
}}
>
<Flex
sx={{ flexDirection: "column", overflowY: "auto", maxHeight: 400 }}
>
{files.map((file, index) => (
<Flex
key={file.name}
sx={{
p: 2,
bg: index % 2 ? "transparent" : "background-secondary",
alignItems: "center",
justifyContent: "space-between",
cursor: "pointer",
":hover": {
bg: "hover"
}
}}
onClick={() => {
setFiles((files) => {
const _files = files.slice();
_files.splice(index, 1);
return _files;
});
}}
title="Click to remove"
>
<Text variant="body">{file.name}</Text>
<Text variant="body">{formatBytes(file.size)}</Text>
</Flex>
))}
</Flex>
</Accordion>
) : null}
{!!files.length && (
<>
<Text
variant="body"
sx={{
bg: "primary",
color: "static",
mt: 2,
borderRadius: 5,
p: 1
}}
>
Please make sure you have at least{" "}
{formatBytes(files.reduce((prev, file) => prev + file.size, 0))} of
free space before proceeding.
</Text>
{provider.requiresNetwork ? (
<Text
variant="body"
sx={{
bg: "background-error",
color: "paragraph-error",
mt: 2,
borderRadius: 5,
p: 1
}}
>
Please make sure you have good Internet access before proceeding.
The importer may send network requests in order to download media
resources such as images, files, and other attachments.
</Text>
) : null}
<Button
variant="accent"
sx={{ alignSelf: "center", mt: 2, px: 4 }}
onClick={onStartImport}
>
Start importing
</Button>
</>
)}
</Flex>
);
}

View File

@@ -0,0 +1,60 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Button, Flex, Text } from "@theme-ui/components";
import Accordion from "../../accordion";
type ImportErrorsProps = {
errors: Error[];
};
export function ImportErrors(props: ImportErrorsProps) {
return (
<Accordion
isClosed={false}
title={`${props.errors.length} errors occured`}
sx={{ bg: "background-error", borderRadius: "default", mt: 2 }}
color="paragraph-error"
>
<Flex sx={{ flexDirection: "column", px: 2, pb: 2, overflowX: "auto" }}>
{props.errors.map((error, index) => (
<Text
variant="body"
sx={{ color: "paragraph-error", my: 1, fontFamily: "monospace" }}
>
{index + 1}. {error.message}
<br />
</Text>
))}
<Button
variant="error"
sx={{ alignSelf: "start", mt: 2 }}
onClick={() =>
window.open(
"https://github.com/streetwriters/notesnook-importer/issues/new",
"_blank"
)
}
>
Send us a bug report
</Button>
</Flex>
</Accordion>
);
}

View File

@@ -0,0 +1,94 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { IProvider } from "@notesnook-importer/core";
import { strings } from "@notesnook/intl";
import { Button, Flex, Text } from "@theme-ui/components";
import { CheckCircleOutline } from "../../icons";
import { TransformResult } from "../types";
import { ImportErrors } from "./import-errors";
type ImportResultProps = {
result: TransformResult;
provider: IProvider;
onReset: () => void;
};
export function ImportResult(props: ImportResultProps) {
const { result, onReset } = props;
if (result.totalNotes <= 0) {
return (
<Flex sx={{ flexDirection: "column", alignItems: "stretch" }}>
<Text variant="title">Import unsuccessful</Text>
<Text variant="body" sx={{ mt: 2 }}>
We failed to import the selected files. Please try again.
</Text>
{result.errors.length > 0 && <ImportErrors errors={result.errors} />}
<Button
variant="accent"
onClick={onReset}
sx={{ alignSelf: "center", mt: 2, px: 4 }}
>
Start over
</Button>
</Flex>
);
}
return (
<>
<CheckCircleOutline color="accent" />
<Text variant="body" my={2} sx={{ textAlign: "center" }}>
{strings.importCompleted()}. {props.result.totalNotes} notes
successfully imported.
{strings.errorsOccured(result.errors.length)}
</Text>
<Button
variant="secondary"
sx={{ alignSelf: "center" }}
onClick={async () => {
onReset();
}}
>
{strings.startOver()}
</Button>
{result.errors.length > 0 && (
<Flex
my={1}
bg="var(--background-error)"
p={1}
sx={{ flexDirection: "column" }}
>
{result.errors.map((error) => (
<Text
key={error.message}
variant="body"
sx={{
color: "var(--paragraph-error)"
}}
>
{error.message}
</Text>
))}
</Flex>
)}
</>
);
}

View File

@@ -0,0 +1,174 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import {
INetworkProvider,
OneNote,
OneNoteSettings,
ProviderSettings,
transform
} from "@notesnook-importer/core";
import { ScrollContainer } from "@notesnook/ui";
import { Button, Flex, Text } from "@theme-ui/components";
import { xxhash64 } from "hash-wasm";
import { useRef, useState } from "react";
import { importNote } from "../../../utils/importer";
import Accordion from "../../accordion";
import { TransformResult } from "../types";
type NetworkProviderHandlerProps = {
provider: INetworkProvider<ProviderSettings>;
onTransformFinished: (result: TransformResult) => void;
};
type Progress = {
total: number;
done: number;
};
function getProviderSettings(
provider: INetworkProvider<ProviderSettings>,
settings: ProviderSettings
) {
if (provider instanceof OneNote) {
return {
...settings,
cache: false,
clientId: "6c32bdbd-c6c6-4cda-bcf0-0c8ec17e5804",
redirectUri:
process.env.NODE_ENV === "development"
? "http://localhost:3000"
: "https://app.notesnook.com"
} as OneNoteSettings;
}
}
export function NetworkProviderHandler(props: NetworkProviderHandlerProps) {
const { provider, onTransformFinished } = props;
const [totalNoteCount, setTotalNoteCount] = useState(0);
const [_, setCounter] = useState<number>(0);
const logs = useRef<string[]>([]);
async function onStartImport() {
let totalNotes = 0;
const settings = getProviderSettings(provider, {
clientType: "browser",
hasher: { type: "xxh64", hash: xxhash64 },
storage: {
clear: async () => undefined,
get: async () => [],
write: async (data) => {
logs.current.push(
`[${new Date().toLocaleString()}] Pushing ${
data.title
} into database`
);
await importNote(data);
},
iterate: async function* () {
return null;
}
},
log: (message) => {
logs.current.push(
`[${new Date(message.date).toLocaleString()}] ${message.text}`
);
setCounter((s) => ++s);
},
reporter: () => {
setTotalNoteCount(++totalNotes);
}
});
if (!settings) return;
setTotalNoteCount(0);
const errors = await transform(provider, settings);
console.log(errors);
onTransformFinished({
totalNotes,
errors
});
}
return (
<Flex
sx={{
flexDirection: "column",
alignItems: "stretch"
}}
>
{totalNoteCount ? (
<>
<Text variant="title">Importing your notes from {provider.name}</Text>
<Text variant="body" sx={{ mt: 4 }}>
Found {totalNoteCount} notes
</Text>
{logs.current.length > 0 && (
<Accordion
isClosed={false}
title="Logs"
sx={{
border: "1px solid var(--border)",
mt: 2
}}
>
<ScrollContainer>
<Text
as="pre"
variant="body"
sx={{
fontFamily: "monospace",
maxHeight: 250,
p: 2
}}
>
{logs.current.map((c, index) => (
<>
<span key={index.toString()}>{c}</span>
<br />
</>
))}
</Text>
</ScrollContainer>
</Accordion>
)}
</>
) : (
<>
<Text variant="title">Connect your {provider.name} account</Text>
<Text variant="body" sx={{ color: "fontTertiary", mt: [2, 0] }}>
Check out our step-by-step guide on{" "}
<a href={provider.helpLink} target="_blank" rel="noreferrer">
how to import from {provider.name}.
</a>
</Text>
<Button
variant="accent"
onClick={onStartImport}
sx={{ my: 4, alignSelf: "center" }}
>
Start importing
</Button>
</>
)}
</Flex>
);
}

View File

@@ -0,0 +1,79 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import {
IProvider,
ProviderFactory,
Providers
} from "@notesnook-importer/core";
import { Flex, Text } from "@theme-ui/components";
type ProviderSelectorProps = {
onProviderChanged: (provider: IProvider) => void;
};
export function ProviderSelector(props: ProviderSelectorProps) {
return (
<Flex
sx={{
flexDirection: "row",
justifyContent: "space-between",
alignItems: "start",
gap: 4
}}
>
<Flex sx={{ flexDirection: "column", flex: 1 }}>
<Text variant="subtitle">Select a notes app to import from</Text>
<Text
variant="body"
as="div"
sx={{ mt: 1, color: "paragraph", whiteSpace: "pre-wrap" }}
>
Can&apos;t find your notes app in the list?{" "}
<a href="https://github.com/streetwriters/notesnook-importer/issues/new">
Send us a request.
</a>
</Text>
</Flex>
<select
style={{
backgroundColor: "var(--background-secondary)",
outline: "none",
border: "1px solid var(--border-secondary)",
borderRadius: "5px",
color: "var(--paragraph)",
padding: "5px",
overflow: "hidden"
}}
onChange={(e) => {
if (e.target.value === "") return;
const providerName: Providers = e.target.value as Providers;
props.onProviderChanged(ProviderFactory.getProvider(providerName));
}}
>
<option value="">Select notes app</option>
{ProviderFactory.getAvailableProviders().map((provider) => (
<option key={provider} value={provider}>
{ProviderFactory.getProvider(provider as Providers).name}
</option>
))}
</select>
</Flex>
);
}

View File

@@ -0,0 +1,82 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Flex } from "@theme-ui/components";
import { useState } from "react";
import { ProviderSelector } from "./components/provider-selector";
import { FileProviderHandler } from "./components/file-provider-handler";
import { ImportResult } from "./components/import-result";
import { IProvider } from "@notesnook-importer/core";
import { NetworkProviderHandler } from "./components/network-provider-handler";
import { TransformResult } from "./types";
export function Importer() {
const [selectedProvider, setSelectedProvider] = useState<IProvider>();
const [transformResult, setTransformResult] = useState<TransformResult>();
const [instanceKey, setInstanceKey] = useState<string>(`${Math.random()}`);
return (
<Flex sx={{ flexDirection: "column" }}>
<Flex
sx={{
flexDirection: "column",
alignItems: "stretch",
gap: 4
}}
>
<ProviderSelector
onProviderChanged={(provider) => {
setInstanceKey(`${Math.random()}`);
setSelectedProvider(provider);
setTransformResult(undefined);
}}
/>
{selectedProvider ? (
<>
{selectedProvider.type === "file" ? (
<FileProviderHandler
key={instanceKey}
provider={selectedProvider}
onTransformFinished={setTransformResult}
/>
) : selectedProvider.type === "network" ? (
<NetworkProviderHandler
key={instanceKey}
provider={selectedProvider}
onTransformFinished={setTransformResult}
/>
) : null}
</>
) : null}
{transformResult && selectedProvider ? (
<>
<ImportResult
result={transformResult}
provider={selectedProvider}
onReset={() => {
setTransformResult(undefined);
setInstanceKey(`${Math.random()}`);
}}
/>
</>
) : null}
</Flex>
</Flex>
);
}

View File

@@ -0,0 +1,20 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
export * from "./importer";

View File

@@ -0,0 +1,23 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
export type TransformResult = {
totalNotes: number;
errors: Error[];
};

View File

@@ -36,7 +36,7 @@ export type Context =
}
| NotebookContext
| {
type: "favorite" | "monographs";
type: "favorite" | "monographs" | "archive";
};
export type WithDateEdited<T> = { items: T[]; dateEdited: number };

View File

@@ -46,7 +46,8 @@ import {
Reset,
Rename,
ExpandSidebar,
HamburgerMenu
HamburgerMenu,
Archive
} from "../icons";
import { SortableNavigationItem } from "./navigation-item";
import {
@@ -111,7 +112,7 @@ import { showSortMenu } from "../group-header";
import { Freeze } from "react-freeze";
type Route = {
id: "notes" | "favorites" | "reminders" | "monographs" | "trash";
id: "notes" | "favorites" | "reminders" | "monographs" | "trash" | "archive";
title: string;
path: string;
icon: Icon;
@@ -138,7 +139,13 @@ const routes: Route[] = [
path: "/monographs",
icon: Monographs
},
{ id: "trash", title: strings.routes.Trash(), path: "/trash", icon: Trash }
{ id: "trash", title: strings.routes.Trash(), path: "/trash", icon: Trash },
{
id: "archive",
title: strings.archive(),
path: "/archive",
icon: Archive
}
];
const tabs = [
@@ -272,7 +279,9 @@ function NavigationMenu({ onExpand }: { onExpand?: () => void }) {
}}
>
<Flex
className="navigation-menu-header"
sx={{
flex: 1,
flexDirection: "row",
alignItems: "center",
gap: 1
@@ -704,6 +713,8 @@ function ItemCount({ item }: { item: Route | Color | Notebook | Tag }) {
return trash?.length || 0;
case "monographs":
return monographs?.length || 0;
case "archive":
return db.notes.archived.count();
default:
return 0;
}

View File

@@ -62,6 +62,7 @@ import {
AddReminder,
AddToNotebook,
Alert,
Archive,
Attachment,
AttachmentError,
Circle,
@@ -395,6 +396,15 @@ export const noteMenuItems: (
await AddReminderDialog.show({ note });
}
},
{
type: "button",
key: "archive",
title: strings.archive(),
isChecked: note.archived,
icon: Archive.path,
onClick: () => store.archive(!note.archived, ...ids),
multiSelect: true
},
{ key: "sep1", type: "separator" },
{
type: "button",

View File

@@ -31,7 +31,8 @@ import {
ChevronRight,
LinkedTo,
ReferencedIn as ReferencedInIcon,
Note as NoteIcon
Note as NoteIcon,
Archive
} from "../icons";
import { Box, Button, Flex, Text, FlexProps } from "@theme-ui/components";
import {
@@ -83,6 +84,12 @@ const tools = [
label: strings.readOnly(),
property: "readonly"
},
{
key: "archive",
icon: Archive,
label: strings.archive(),
property: "archived"
},
{
key: "local-only",
icon: SyncOff,
@@ -837,10 +844,17 @@ export function Section({
}
function changeToggleState(
prop: "lock" | "readonly" | "local-only" | "pin" | "favorite",
prop: "lock" | "readonly" | "local-only" | "pin" | "favorite" | "archive",
session: ReadonlyEditorSession | DefaultEditorSession
) {
const { id: sessionId, readonly, localOnly, pinned, favorite } = session.note;
const {
id: sessionId,
readonly,
localOnly,
pinned,
favorite,
archived
} = session.note;
if (!sessionId) return;
switch (prop) {
case "lock":
@@ -855,6 +869,8 @@ function changeToggleState(
return noteStore.pin(!pinned, sessionId);
case "favorite":
return noteStore.favorite(!favorite, sessionId);
case "archive":
return noteStore.archive(!archived, sessionId);
default:
return;
}

View File

@@ -62,6 +62,7 @@ export type SplitPaneImperativeHandle = {
expand: (index: number) => void;
reset: (index: number) => void;
isCollapsed: (index: number) => boolean;
hasExpandedSize: (index: number) => boolean;
};
export const SplitPane = React.forwardRef<
SplitPaneImperativeHandle,
@@ -281,8 +282,9 @@ export const SplitPane = React.forwardRef<
const currentPane = paneSizes.current[index];
if (!currentPane || !currentPane.collapsed) return;
currentPane.collapsed = false;
currentPane.size =
currentPane.expandedSize ?? currentPane.initialSize;
currentPane.size = !!currentPane.expandedSize
? currentPane.expandedSize
: currentPane.initialSize;
currentPane.expandedSize = undefined;
setSizes(paneSizes.current, wrapSize.current);
},
@@ -296,6 +298,9 @@ export const SplitPane = React.forwardRef<
},
isCollapsed: (index: number) => {
return paneSizes.current[index].collapsed;
},
hasExpandedSize: (index: number) => {
return paneSizes.current[index].expandedSize !== undefined;
}
};
},
@@ -375,6 +380,19 @@ export const SplitPane = React.forwardRef<
nextPane.nextSize = undefined;
currentPane.nextSize = undefined;
[currentPane, nextPane].forEach((pane) => {
if (pane.size === 0) {
// if pane size is 0, collapsed should be true
pane.collapsed = true;
}
if (pane.min === 0 && pane.size < pane.snap) {
// if pane min is 0, and size is less than snap, collapsed should be true
pane.collapsed = true;
// and size should be set to 0
pane.size = 0;
}
});
setSizes(paneSizes.current, wrapSize.current);
},
[paneSizes, setSizes, splitAxis]

View File

@@ -32,6 +32,7 @@ import Dialog from "../../components/dialog";
import { Cross } from "../../components/icons";
import { CustomScrollbarsVirtualList } from "../../components/list-container";
import { useEditorStore } from "../../stores/editor-store";
import { useStore as useNoteStore } from "../../stores/note-store";
import { strings } from "@notesnook/intl";
import { isMac } from "../../utils/platform";
import {
@@ -117,8 +118,30 @@ export const CommandPaletteDialog = DialogManager.register(
}}
onKeyDown={(e) => {
if (commands.status !== "fulfilled") return;
if (e.key === "Delete") {
e.preventDefault();
const command = commands.value.commands[selected];
if (!command) return;
if (command.group !== "recent") return;
removeRecentCommand(command.id);
getDefaultCommands().then((resolved) => {
defaultCommands.current = resolved;
commands.refresh();
});
return;
}
if (e.key == "Enter") {
e.preventDefault();
if (e.shiftKey && !props.isCommandMode) {
db.notes.add({ title: query }).then((note) => {
useEditorStore.getState().openSession(note);
useNoteStore.getState().refresh();
});
props.onClose(false);
return;
}
const command = commands.value.commands[selected];
if (!command) return;
command.action?.(command, {
@@ -525,6 +548,10 @@ function getCommandPaletteHelp(isCommandMode: boolean) {
key: isMac() ? "⌘⏎" : "Ctrl+⏎",
description: strings.openInNewTab()
},
{
key: "Shift+⏎",
description: strings.createNewNote()
},
{
key: isMac() ? "⌘K" : "Ctrl+K",
description: strings.commandPalette()

View File

@@ -93,28 +93,26 @@ const features: Record<FeatureKeys, Feature> = {
]
: [
{
title: "New sidebar UI/UX",
title: "Archive",
subtitle: (
<>
Your notebooks &amp; tags are now displayed directly in the
sidebar making organization &amp; navigation much easier.
You can now archive your notes to hide them from the main list.
</>
)
},
{
title: "Hierarchical tree view for notebooks",
title: "Integrated Notesnook Importer",
subtitle: (
<>
Notebooks are now displayed in a hierarchical tree view so you
can jump back and forth between them easily.
Notesnook Importer is now integrated directly into the app
allowing for faster and more seamless import of your notes. Just
drag and drop your notes from other note-taking apps and viola!
</>
)
},
{
title: "Set any tag, color or notebook as homepage",
subtitle: (
<>You can now set any tag, color or notebook as your homepage.</>
)
title: "Improved search",
subtitle: "Search should now be much more accurate and predictable."
}
],
cta: {

View File

@@ -48,6 +48,7 @@ import { ErrorText } from "../components/error-text";
import { BuyDialog } from "./buy-dialog";
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
import { strings } from "@notesnook/intl";
import { SettingsDialog } from "./settings";
type Step = {
title: string;
@@ -297,7 +298,9 @@ function Importer({ onClose }: { onClose: () => void }) {
variant="accent"
sx={{ borderRadius: 50, alignSelf: "center", px: 30 }}
onClick={() => {
window.open("https://importer.notesnook.com/", "_blank");
SettingsDialog.show({
activeSection: "importer"
});
onClose();
}}
>

View File

@@ -1,318 +0,0 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { strings } from "@notesnook/intl";
import { Button, Flex, Input, Link, Text, Box } from "@theme-ui/components";
import { useCallback, useRef, useState } from "react";
import { useDropzone } from "react-dropzone";
import { db } from "../../../common/db";
import { CheckCircleOutline } from "../../../components/icons";
import Accordion from "../../../components/accordion";
import { importFiles } from "../../../utils/importer";
import { useStore as useAppStore } from "../../../stores/app-store";
type Provider = { title: string; link: string };
const POPULAR_PROVIDERS: Provider[] = [
{
title: "Evernote",
link: "https://help.notesnook.com/importing-notes/import-notes-from-evernote"
},
{
title: "Simplenote",
link: "https://help.notesnook.com/importing-notes/import-notes-from-simplenote"
},
{
title: "Google Keep",
link: "https://help.notesnook.com/importing-notes/import-notes-from-googlekeep"
},
{
title: "Obsidian",
link: "https://help.notesnook.com/importing-notes/import-notes-from-obsidian"
},
{
title: "Joplin",
link: "https://help.notesnook.com/importing-notes/import-notes-from-joplin"
},
{
title: "Markdown files",
link: "https://help.notesnook.com/importing-notes/import-notes-from-markdown-files"
},
{
title: "other apps",
link: "https://help.notesnook.com/importing-notes/"
}
];
export function Importer() {
const [isDone, setIsDone] = useState(false);
const [isImporting, setIsImporting] = useState(false);
const [files, setFiles] = useState<File[]>([]);
const [errors, setErrors] = useState<Error[]>([]);
const notesCounter = useRef<HTMLSpanElement>(null);
const importProgress = useRef<HTMLDivElement>(null);
const onDrop = useCallback((acceptedFiles: File[]) => {
setFiles((files) => {
const newFiles = [...acceptedFiles, ...files];
return newFiles;
});
}, []);
const { getRootProps, getInputProps, isDragActive } = useDropzone({
onDrop,
accept: {
"application/zip": [".zip"]
}
});
return (
<Flex
sx={{
flexDirection: "column",
// justifyContent: "center",
overflow: "hidden"
}}
>
{isImporting ? (
<>
<Text variant="title" sx={{ textAlign: "center", mb: 4, mt: 150 }}>
<span ref={notesCounter}>0</span> {strings.notesImported()}.
</Text>
<Flex
ref={importProgress}
sx={{
alignSelf: "start",
borderRadius: "default",
height: "5px",
bg: "accent",
width: `0%`
}}
/>
</>
) : isDone ? (
<>
<CheckCircleOutline color="accent" sx={{ mt: 150 }} />
<Text variant="body" my={2} sx={{ textAlign: "center" }}>
{strings.importCompleted()}. {strings.errorsOccured(errors.length)}
</Text>
<Button
variant="secondary"
sx={{ alignSelf: "center" }}
onClick={async () => {
setErrors([]);
setFiles([]);
setIsDone(false);
setIsImporting(false);
}}
>
{strings.startOver()}
</Button>
{errors.length > 0 && (
<Flex
my={1}
bg="var(--background-error)"
p={1}
sx={{ flexDirection: "column" }}
>
{errors.map((error) => (
<Text
key={error.message}
variant="body"
sx={{
color: "var(--paragraph-error)"
}}
>
{error.message}
</Text>
))}
</Flex>
)}
</>
) : (
<>
<Accordion
isClosed={false}
title="How to import your notes from other apps?"
containerSx={{
px: 2,
pb: 2,
border: "1px solid var(--border)",
borderTopWidth: 0,
borderRadius: "default",
borderTopLeftRadius: 0,
borderTopRightRadius: 0
}}
>
<Text variant="subtitle" sx={{ mt: 2 }}>
Quick start guide:
</Text>
<Box as="ol" sx={{ my: 1 }}>
<Text as="li" variant="body">
Go to{" "}
<Link
href="https://importer.notesnook.com/"
target="_blank"
sx={{ color: "accent" }}
>
https://importer.notesnook.com/
</Link>
</Text>
<Text as="li" variant="body">
Select the app you want to import from.
</Text>
<Text as="li" variant="body">
Drag drop or select the files you exported from the other app.
</Text>
<Text as="li" variant="body">
Start the importer and wait for it to complete processing.
</Text>
<Text as="li" variant="body">
Download the .zip file from the Importer.
</Text>
<Text as="li" variant="body">
Drop the .zip file below to complete your import.
</Text>
</Box>
<Text variant={"body"} sx={{ fontWeight: "bold" }}>
For detailed steps with screenshots, refer to the help article for
each app:
</Text>
<Box
sx={{
display: "grid",
gridTemplateColumns: "1fr 1fr 1fr",
gap: 1,
mt: 1
}}
>
{POPULAR_PROVIDERS.map((provider) => (
<Button
key={provider.link}
variant="icon"
sx={{
borderRadius: "default",
border: "1px solid var(--border)",
textAlign: "left"
}}
onClick={() => window.open(provider.link, "_blank")}
>
Import from {provider.title}
</Button>
))}
</Box>
</Accordion>
<Flex
{...getRootProps()}
data-test-id="import-dialog-select-files"
sx={{
justifyContent: "center",
alignItems: "center",
minHeight: 200,
flexShrink: 0,
width: "full",
border: "2px dashed var(--border)",
borderRadius: "default",
mt: 2,
flexDirection: "column"
}}
>
<Input {...getInputProps()} />
<Text variant="body" sx={{ textAlign: "center" }}>
{isDragActive
? strings.dropFilesHere()
: strings.dragAndDropFiles()}
<br />
<Text variant="subBody">{strings.onlyZipSupported()}</Text>
</Text>
<Box sx={{ display: "flex", flexWrap: "wrap", mt: 2 }}>
{files.map((file, i) => (
<Text
key={file.name}
p={1}
sx={{
":hover": { bg: "hover" },
cursor: "pointer",
borderRadius: "default"
}}
onClick={() => {
setFiles((files) => {
const cloned = files.slice();
cloned.splice(i, 1);
return cloned;
});
}}
variant="body"
title="Click to remove"
>
{file.name}
</Text>
))}
</Box>
</Flex>
{/* <Flex my={1} sx={{ flexDirection: "column" }}>
</Flex> */}
<Button
variant="accent"
sx={{ alignSelf: "end", mt: 1 }}
onClick={async () => {
setIsDone(false);
setIsImporting(true);
await db.syncer?.acquireLock(async () => {
try {
for await (const message of importFiles(files)) {
switch (message.type) {
case "error":
setErrors((errors) => [...errors, message.error]);
break;
case "progress": {
const { count } = message;
if (notesCounter.current)
notesCounter.current.innerText = `${count}`;
break;
}
}
}
} catch (e) {
console.error(e);
if (e instanceof Error) {
setErrors((errors) => [...errors, e as Error]);
}
}
});
await useAppStore.getState().refresh();
setIsDone(true);
setIsImporting(false);
}}
disabled={!files.length}
>
{files.length > 0
? "Start import"
: "Select files to start importing"}
</Button>
</>
)}
</Flex>
);
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { SettingsGroup } from "./types";
import { Importer } from "./components/importer";
import { Importer } from "../../components/importer";
export const ImporterSettings: SettingsGroup[] = [
{

View File

@@ -20,7 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { create } from "zustand";
import { shallow } from "zustand/shallow";
import { MenuItem, PositionOptions } from "@notesnook/ui";
// import { isUserPremium } from "./use-is-user-premium";
import { desktop } from "../common/desktop-bridge";
import { isMac } from "../utils/platform";
type MenuOptions = {
position?: PositionOptions;
@@ -43,7 +44,24 @@ const useMenuStore = create<MenuStore>((set) => ({
options: {
blocking: false
},
open: (items, options) => set(() => ({ isOpen: true, items, options })),
open: async (items, options) => {
if (IS_DESKTOP_APP && canShowNativeMenu(items) && isMac()) {
const resolvedItems = await resolveMenuItems(items);
desktop?.integration.showMenu.subscribe(
{
menuItems: JSON.parse(JSON.stringify(resolvedItems))
},
{
onData(ids) {
findAndCallAction(resolvedItems, ids);
}
}
);
set(() => ({ options }));
} else {
set(() => ({ isOpen: true, items, options }));
}
},
close: () =>
set(() => ({
isOpen: false,
@@ -84,3 +102,35 @@ export function useMenu() {
]);
return { items, options };
}
async function resolveMenuItems(items: MenuItem[]): Promise<MenuItem[]> {
const serialized = [];
for (const item of items) {
if (item.type === "lazy-loader")
serialized.push(...(await resolveMenuItems(await item.items())));
else if (item.type === "button") {
if (item.menu) item.menu.items = await resolveMenuItems(item.menu.items);
serialized.push(item);
} else serialized.push(item);
}
return serialized;
}
function findAndCallAction(items: MenuItem[], ids: string[]) {
let _items: MenuItem[] = items;
const actionId = ids.at(-1);
for (const id of ids) {
const item = _items.find((item) => item.key === id);
if (!item || item?.type !== "button") continue;
console.log(item);
if (id === actionId) {
item?.onClick?.();
} else {
_items = item.menu?.items || [];
}
}
}
function canShowNativeMenu(items: MenuItem[]) {
return items.every((item) => item.type !== "popup");
}

View File

@@ -48,6 +48,7 @@ export type TipContext =
| "reminders"
| "monographs"
| "trash"
| "archive"
| "attachments";
export type Tip = {
@@ -207,5 +208,8 @@ const DEFAULT_TIPS: Record<TipContext, Omit<Tip, "contexts">> = {
trash: {
text: ""
},
archive: {
text: strings.yourArchiveIsEmpty()
},
search: { text: "" }
};

View File

@@ -105,6 +105,15 @@ const routes = defineRoutes({
component: Trash
});
},
"/archive": () => {
useNoteStore.getState().setContext({ type: "archive" });
return defineRoute({
key: "notes",
title: strings.archive(),
type: "notes",
component: Notes
});
},
"/tags/:tagId": async ({ tagId }) => {
const tag = await db.tags.tag(tagId);
if (!tag) return NOT_FOUND_ROUTE;

View File

@@ -164,7 +164,8 @@ export type DocumentPreview = {
export function isLockedSession(session: EditorSession): boolean {
return (
session.type === "locked" ||
(session.type === "default" && !!session.locked) ||
((session.type === "default" || session.type === "readonly") &&
!!session.locked) ||
("content" in session &&
!!session.content &&
"locked" in session.content &&
@@ -382,6 +383,8 @@ class EditorStore extends BaseStore<EditorStore> {
event.item.localOnly ?? session.note.localOnly;
session.note.favorite =
event.item.favorite ?? session.note.favorite;
session.note.archived =
event.item.archived ?? session.note.archived;
session.note.dateEdited =
event.item.dateEdited ?? session.note.dateEdited;
});
@@ -830,6 +833,18 @@ class EditorStore extends BaseStore<EditorStore> {
}
};
openSessionInTab = async (noteId: string, tabId: string) => {
const { tabs } = this.get();
const tab = tabs.find((t) => t.id === tabId);
if (!tab) {
this.openSession(noteId, { openInNewTab: true });
return;
}
this.focusTab(tabId);
this.openSession(noteId, { force: true });
};
focusNextTab = () => {
const { tabs, activeTabId } = this.get();
if (tabs.length <= 1) return;
@@ -849,13 +864,13 @@ class EditorStore extends BaseStore<EditorStore> {
};
focusLastActiveTab = () => {
const history = useEditorStore.getState().history;
if (history.length < 2) return;
const { tabs, history, focusTab } = this.get();
if (tabs.length < 2 || history.length < 2) return;
const previousTab = history.at(-2);
if (!previousTab) return;
useEditorStore.getState().focusTab(previousTab);
focusTab(previousTab);
};
goBack = async () => {

View File

@@ -62,7 +62,11 @@ class NoteStore extends BaseStore<NoteStore> {
contextNotes: context
? await notesFromContext(context).grouped(
db.settings.getGroupOptions(
context.type === "favorite" ? "favorites" : "notes"
context.type === "favorite"
? "favorites"
: context.type === "archive"
? "archive"
: "notes"
)
)
: undefined
@@ -85,6 +89,11 @@ class NoteStore extends BaseStore<NoteStore> {
await this.refresh();
};
archive = async (state: boolean, ...ids: string[]) => {
await db.notes.archive(state, ...ids);
await this.refresh();
};
unlock = async (id: string) => {
return await Vault.unlockNote(id).then(async (res) => {
await this.refresh();
@@ -141,6 +150,8 @@ export function notesFromContext(context: Context) {
.selector;
case "favorite":
return db.notes.favorites;
case "archive":
return db.notes.archived;
case "monographs":
return db.monographs.all;
}

View File

@@ -66,7 +66,8 @@ function logout() {
"theme:light",
"theme:dark",
"colorScheme",
"followSystemTheme"
"followSystemTheme",
"doubleSpacedLines"
];
const vals = {} as Record<string, any>;

View File

@@ -17,80 +17,21 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { db } from "../common/db";
import {
Note,
Notebook,
ContentType,
LegacyNotebook
Note,
Notebook
} from "@notesnook-importer/core/dist/src/models";
import {
ATTACHMENTS_DIRECTORY_NAME,
NOTE_DATA_FILENAME
} from "@notesnook-importer/core/dist/src/utils/note-stream";
import { path } from "@notesnook-importer/core/dist/src/utils/path";
import { type ZipEntry } from "./streams/unzip-stream";
import { hashBuffer, writeEncryptedFile } from "../interfaces/fs";
import { Notebook as NotebookType } from "@notesnook/core";
import { SerializedKey } from "@notesnook/crypto";
import { db } from "../common/db";
import { writeEncryptedFile } from "../interfaces/fs";
export async function* importFiles(zipFiles: File[]) {
const { createUnzipIterator } = await import("./streams/unzip-stream");
for (const zip of zipFiles) {
let count = 0;
let filesRead = 0;
const attachments: Record<string, any> = {};
for await (const entry of createUnzipIterator(zip)) {
++filesRead;
const isAttachment = entry.name.includes(
`/${ATTACHMENTS_DIRECTORY_NAME}/`
);
const isNote = !isAttachment && entry.name.endsWith(NOTE_DATA_FILENAME);
try {
if (isAttachment) {
await processAttachment(entry, attachments);
} else if (isNote) {
await processNote(entry, attachments);
++count;
}
} catch (e) {
if (e instanceof Error) yield { type: "error" as const, error: e };
}
yield {
type: "progress" as const,
count,
filesRead
};
}
}
}
async function processAttachment(
entry: ZipEntry,
attachments: Record<string, any>
) {
const name = path.basename(entry.name);
if (!name || attachments[name] || (await db.attachments?.exists(name)))
return;
const data = await entry.arrayBuffer();
const { hash } = await hashBuffer(new Uint8Array(data));
if (hash !== name) {
throw new Error(`integrity check failed: ${name} !== ${hash}`);
}
const file = new File([data], name, {
type: "application/octet-stream"
});
const key = await db.attachments?.generateKey();
const cipherData = await writeEncryptedFile(file, key, name);
attachments[name] = { ...cipherData, key };
}
type EncryptedAttachmentFields = Awaited<
ReturnType<typeof writeEncryptedFile>
> & {
key: SerializedKey;
};
const colorMap: Record<string, string | undefined> = {
default: undefined,
@@ -107,19 +48,50 @@ const colorMap: Record<string, string | undefined> = {
yellow: "#FFC107"
};
async function processNote(entry: ZipEntry, attachments: Record<string, any>) {
const note = await fileToJson<Note>(entry);
for (const attachment of note.attachments || []) {
const cipherData = attachments[attachment.hash];
if (!cipherData || (await db.attachments?.exists(attachment.hash)))
export async function importNote(note: Note) {
const encryptedAttachmentFieldsMap = await processAttachments(
note.attachments
);
await processNote(note, encryptedAttachmentFieldsMap);
}
async function processAttachments(attachments: Note["attachments"]) {
if (!attachments) return {};
const map: Record<string, EncryptedAttachmentFields | undefined> = {};
for (const { hash, filename, data } of attachments) {
if (!data || !hash || map[hash]) {
continue;
}
const exists = await db.attachments?.exists(hash);
if (exists) continue;
const file = new File([data], filename, {
type: "application/octet-stream"
});
const key = await db.attachments?.generateKey();
const cipherData = await writeEncryptedFile(file, key, hash);
map[hash] = { ...cipherData, key };
}
return map;
}
async function processNote(
note: Note,
map: Record<string, EncryptedAttachmentFields | undefined>
) {
for (const attachment of note.attachments || []) {
const cipherData = map[attachment.hash];
if (!cipherData || (await db.attachments?.exists(attachment.hash))) {
continue;
}
await db.attachments?.add({
...cipherData,
hash: attachment.hash,
hashType: attachment.hashType,
filename: attachment.filename,
type: attachment.mime
mimeType: attachment.mime
});
}
@@ -185,39 +157,13 @@ async function processNote(entry: ZipEntry, attachments: Record<string, any>) {
}
for (const nb of notebooks) {
if ("notebook" in nb) {
const notebookId = await importLegacyNotebook(nb).catch(() => undefined);
if (!notebookId) continue;
const notebookIds = await importNotebook(nb).catch(() => undefined);
if (!notebookIds) continue;
for (const notebookId of notebookIds)
await db.notes.addToNotebook(notebookId, noteId);
} else {
const notebookIds = await importNotebook(nb).catch(() => undefined);
if (!notebookIds) continue;
for (const notebookId of notebookIds)
await db.notes.addToNotebook(notebookId, noteId);
}
}
}
async function fileToJson<T>(file: ZipEntry) {
const text = await file.text();
return JSON.parse(text) as T;
}
/**
* @deprecated
*/
async function importLegacyNotebook(
notebook: LegacyNotebook | undefined
): Promise<string | undefined> {
if (!notebook) return;
const nb = await db.notebooks.find(notebook.notebook);
return nb
? nb.id
: await db.notebooks.add({
title: notebook.notebook
});
}
async function importNotebook(
notebook: Notebook,
parent?: NotebookType

View File

@@ -35,7 +35,12 @@ function Notes(props: NotesProps) {
const context = useNotesStore((store) => store.context);
const contextNotes = useNotesStore((store) => store.contextNotes);
const refreshContext = useNotesStore((store) => store.refreshContext);
const type = context?.type === "favorite" ? "favorites" : "notes";
const type =
context?.type === "favorite"
? "favorites"
: context?.type === "archive"
? "archive"
: "notes";
const isCompact = useNotesStore((store) => store.viewMode === "compact");
const filteredItems = useSearch(
context?.type === "notebook" ? "notebook" : "notes",
@@ -62,6 +67,8 @@ function Notes(props: NotesProps) {
context={
context.type === "favorite"
? "favorites"
: context.type === "archive"
? "archive"
: context.type === "monographs"
? "monographs"
: "notes"

View File

@@ -0,0 +1,3 @@
- Bug fixes
Thank you for using Notesnook!

File diff suppressed because it is too large Load Diff

View File

@@ -58,6 +58,19 @@ test("search notes (remove diacritics)", () =>
expect(filtered).toHaveLength(1);
}));
test("search notes (remove html tags)", () =>
noteTest({
content: {
type: "tiptap",
data: "<p block-id='1'>hello this is a word</p>"
}
}).then(async ({ db }) => {
await db.notes.add(TEST_NOTE);
expect(await db.lookup.notes("block").ids()).toHaveLength(0);
expect(await db.lookup.notes("hello").ids()).toHaveLength(2);
expect(await db.lookup.notes("word").ids()).toHaveLength(1);
}));
test("search notes with a locked note", () =>
noteTest({
content: content

View File

@@ -60,13 +60,13 @@ test("add invalid note", () =>
databaseTest().then(async (db) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(db.notes.add()).rejects.toThrow();
await expect(db.notes.add()).rejects.toThrow();
expect(db.notes.add({})).rejects.toThrow();
await expect(db.notes.add({})).rejects.toThrow();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(db.notes.add({ hello: "world" })).rejects.toThrow();
await expect(db.notes.add({ hello: "world" })).rejects.toThrow();
}));
test("add note", () =>
@@ -134,7 +134,7 @@ test("changing content shouldn't reset the note title ", () =>
expect(note?.title).toBe("I am a note");
}));
test("note title with headline format should keep generating headline until title is edited", () =>
test("note title with headline format should keep generating headline title until title is edited", () =>
noteTest().then(async ({ db }) => {
await db.settings.setTitleFormat("$headline$");
const id = await db.notes.add({
@@ -191,19 +191,44 @@ test("note title with headline format should keep generating headline until titl
"headlineLorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam rutrum ex ac eros egestas, ut rhoncus felis faucibus. Mauris tempor orci nisl,"
]
].forEach(([testCase, content, expectedHeadline]) => {
test(`note should generate headline up to HEADLINE_CHARACTER_LIMIT characters - ${testCase}`, () =>
noteTest({
...TEST_NOTE,
content: {
type: TEST_NOTE.content.type,
data: content
}
}).then(async ({ db, id }) => {
test(`note title with headline format should generate headline title up to 150 characters - ${testCase}`, () =>
noteTest().then(async ({ db }) => {
await db.settings.setTitleFormat("$headline$");
const id = await db.notes.add({
content: {
type: TEST_NOTE.content.type,
data: content
}
});
const note = await db.notes.note(id);
expect(note?.headline).toBe(expectedHeadline);
expect(note?.title).toBe(expectedHeadline);
}));
});
test("note should get headline from first paragraph in content", () =>
noteTest({
...TEST_NOTE,
content: {
type: TEST_NOTE.content.type,
data: "<p>This is a very colorful existence.</p>"
}
}).then(async ({ db, id }) => {
const note = await db.notes.note(id);
expect(note?.headline).toBe("This is a very colorful existence.");
}));
test("note should not get headline if there is no p tag", () =>
noteTest({
...TEST_NOTE,
content: {
type: TEST_NOTE.content.type,
data: `<ol style="list-style-type: decimal;" data-mce-style="list-style-type: decimal;"><li>Hello I won't be a headline :(</li><li>Me too.</li><li>Gold.</li></ol>`
}
}).then(async ({ db, id }) => {
const note = await db.notes.note(id);
expect(note?.headline).toBe("");
}));
test("note title should allow trailing space", () =>
noteTest({ title: "Hello ", content: TEST_NOTE.content }).then(
async ({ db, id }) => {
@@ -682,3 +707,54 @@ for (const group of groups) {
}));
}
}
test("get archived notes", () =>
noteTest().then(async ({ db, id }) => {
await db.notes.archive(true, id);
expect(await db.notes.archived.count()).toBeGreaterThan(0);
}));
test("archive note", () =>
noteTest().then(async ({ db, id }) => {
await db.notes.archive(true, id);
const note = await db.notes.note(id);
expect(note?.archived).toBe(true);
}));
test("unarchive note", () =>
noteTest().then(async ({ db, id }) => {
await db.notes.archive(true, id);
await db.notes.archive(false, id);
const note = await db.notes.note(id);
expect(note?.archived).toBe(false);
}));
test("archiving note should update cache.archived", () =>
noteTest().then(async ({ db, id }) => {
await db.notes.archive(true, id);
const note = await db.notes.note(id);
expect(db.notes.cache.archived).toEqual([note?.id]);
}));
test("un-archiving note should update cache.archived", () =>
noteTest().then(async ({ db, id }) => {
await db.notes.archive(true, id);
const note = await db.notes.note(id);
expect(db.notes.cache.archived).toEqual([note?.id]);
await db.notes.archive(false, id);
expect(db.notes.cache.archived).toEqual([]);
}));
test("archived note shouldn't be in all notes", () =>
noteTest().then(async ({ db, id }) => {
await db.notes.archive(true, id);
expect(await db.notes.all.count()).toBe(0);
}));
test("archived note shouldn't be in favorites", () =>
noteTest().then(async ({ db, id }) => {
await db.notes.favorite(true, id);
await db.notes.archive(true, id);
expect(await db.notes.favorites.count()).toBe(0);
}));

View File

@@ -40,3 +40,10 @@ test("save toolbar config", () =>
await db.settings.setToolbarConfig("mobile", toolbarConfig);
expect(db.settings.getToolbarConfig("mobile")).toMatchObject(toolbarConfig);
}));
test("save trash cleanup interval", () =>
databaseTest().then(async (db) => {
const interval = 7;
await db.settings.setTrashCleanupInterval(interval);
expect(db.settings.getTrashCleanupInterval()).toBe(interval);
}));

View File

@@ -31,6 +31,7 @@ import { tmpdir } from "os";
import { getId } from "../../src/utils/id.js";
import { existsSync, mkdirSync } from "fs";
import * as betterTrigram from "sqlite-better-trigram";
import * as fts5Html from "sqlite3-fts5-html";
const TEST_NOTEBOOK: Partial<Notebook> = {
title: "Test Notebook",
@@ -65,6 +66,7 @@ function databaseTest(type: "memory" | "persistent" = "memory") {
batchSize: 500
});
betterTrigram.load(betterSqliteDb);
fts5Html.load(betterSqliteDb);
return db.init().then(() => db);
}

View File

@@ -34,12 +34,12 @@ test("create vault", () =>
test("lock vault", () =>
databaseTest().then(async (db) => {
await expect(db.vault.create("password")).resolves.toBe(true);
expect(db.vault.lock()).resolves.toBe(true);
await expect(db.vault.lock()).resolves.toBe(true);
}));
test("lock non-existent vault", () =>
databaseTest().then(async (db) => {
expect(db.vault.lock()).resolves.toBe(true);
await expect(db.vault.lock()).resolves.toBe(true);
}));
test("unlock vault", () =>

File diff suppressed because it is too large Load Diff

View File

@@ -46,6 +46,8 @@
"nanoid": "5.0.7",
"otplib": "^12.0.1",
"refractor": "^4.8.1",
"sqlite-better-trigram": "^0.0.3",
"sqlite3-fts5-html": "^0.0.2",
"vitest": "2.1.8",
"vitest-fetch-mock": "^0.2.2",
"ws": "^8.13.0"
@@ -85,10 +87,9 @@
"prismjs": "^1.29.0",
"qclone": "^1.2.0",
"rfdc": "^1.3.0",
"spark-md5": "^3.0.2",
"sqlite-better-trigram": "0.0.2"
"spark-md5": "^3.0.2"
},
"overrides": {
"htmlparser2": "^8.0.1"
}
}
}

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { match, surround } from "fuzzyjs";
import { match } from "fuzzyjs";
import Database from "./index.js";
import {
Item,
@@ -36,6 +36,7 @@ import { rebuildSearchIndex } from "../database/fts.js";
import { transformQuery } from "../utils/query-transformer.js";
import { getSortSelectors } from "../utils/grouping.js";
import { fuzzy } from "../utils/fuzzy.js";
import { extractText } from "../utils/html-parser.js";
type SearchResults<T> = {
sorted: (limit?: number) => Promise<VirtualizedGrouping<T>>;
@@ -52,65 +53,99 @@ type FuzzySearchField<T> = {
export default class Lookup {
constructor(private readonly db: Database) {}
notes(
query: string,
notes?: FilteredSelector<Note>,
opts?: { titleOnly?: boolean }
): SearchResults<Note> {
notes(query: string, notes?: FilteredSelector<Note>): SearchResults<Note> {
return this.toSearchResults(async (limit, sortOptions) => {
const db = this.db.sql() as unknown as Kysely<RawDatabaseSchema>;
const excludedIds = this.db.trash.cache.notes;
query = transformQuery(query);
const results = await db
.selectFrom((eb) =>
eb
.selectFrom("notes_fts")
.$if(!!notes, (eb) =>
eb.where("id", "in", notes!.filter.select("id"))
)
.$if(excludedIds.length > 0, (eb) =>
eb.where("id", "not in", excludedIds)
)
.where("title", "match", query)
.select(["id", sql<number>`rank * 10`.as("rank")])
.$if(!opts?.titleOnly, (eb) =>
eb.unionAll((eb) =>
const { query: transformedQuery, tokens } = transformQuery(query);
const resultsA: string[] =
transformedQuery.length === 0
? []
: await db
.selectFrom((eb) =>
eb
.selectFrom("content_fts")
.selectFrom("notes_fts")
.$if(!!notes, (eb) =>
eb.where("noteId", "in", notes!.filter.select("id"))
eb.where("id", "in", notes!.filter.select("id"))
)
.$if(excludedIds.length > 0, (eb) =>
eb.where("id", "not in", excludedIds)
)
.where("data", "match", query)
.select(["noteId as id", "rank"])
.$castTo<{
id: string;
rank: number;
}>()
.where("title", "match", transformedQuery)
.select(["id", sql<number>`rank * 10`.as("rank")])
.unionAll((eb) =>
eb
.selectFrom("content_fts")
.$if(!!notes, (eb) =>
eb.where("noteId", "in", notes!.filter.select("id"))
)
.$if(excludedIds.length > 0, (eb) =>
eb.where("noteId", "not in", excludedIds)
)
.where("data", "match", transformedQuery)
.select(["noteId as id", "rank"])
.$castTo<{
id: string;
rank: number;
}>()
)
.as("results")
)
)
.as("results")
)
.select(["results.id"])
.groupBy("results.id")
.orderBy(sql`SUM(results.rank)`, sortOptions?.sortDirection || "desc")
.$if(!!limit, (eb) => eb.limit(limit!))
.select(["results.id"])
.groupBy("results.id")
.orderBy(
sql`SUM(results.rank)`,
sortOptions?.sortDirection || "desc"
)
.execute()
.catch((e) => {
logger.error(e, `Error while searching`, { query });
return [];
})
.then((r) => r.map((r) => r.id));
// filter out ids that have no note against them
.where(
"results.id",
"in",
(notes || this.db.notes.all).filter.select("id")
const smallTokens = Array.from(
new Set(
tokens.filter((token) => token.length < 3 && token !== "OR")
).values()
);
if (smallTokens.length === 0) return resultsA;
const results = [];
const titles = await db
.selectFrom("notes")
.$if(!!transformedQuery && resultsA.length > 0, (eb) =>
eb.where("id", "in", resultsA)
)
.execute()
.catch((e) => {
logger.error(e, `Error while searching`, { query });
return [];
});
return results.map((r) => r.id);
.select(["id", "title"])
.execute();
const htmls = await db
.selectFrom("content")
.$if(!!transformedQuery && resultsA.length > 0, (eb) =>
eb.where("noteId", "in", resultsA)
)
.select(["data", "noteId as id"])
.$castTo<{ data: string; id: string }>()
.execute();
for (let i = 0; i < titles.length; i++) {
const title = titles[i];
const html = htmls.find((h) => h.id === title.id);
const text = html ? extractText(html.data) : "";
if (
smallTokens.every((token) => !!title.title?.includes(token)) ||
smallTokens.every((token) => !!text?.includes(token))
) {
results.push(title.id);
}
}
return results;
}, notes || this.db.notes.all);
}

View File

@@ -40,6 +40,7 @@ import { ICollection } from "./collection.js";
import { SQLCollection } from "../database/sql-collection.js";
import { isFalse } from "../database/index.js";
import { logger } from "../logger.js";
import { addItems, deleteItems } from "../utils/array.js";
export type ExportOptions = {
format: "html" | "md" | "txt" | "md-frontmatter";
@@ -51,6 +52,7 @@ export type ExportOptions = {
export class Notes implements ICollection {
name = "notes";
cache: { archived: string[] } = { archived: [] };
/**
* @internal
*/
@@ -69,6 +71,13 @@ export class Notes implements ICollection {
async init() {
await this.collection.init();
this.totalNotes = await this.collection.count();
await this.buildCache();
}
async buildCache() {
this.cache.archived = [];
const archived = await this.archived.ids();
this.cache.archived = archived;
}
async add(
@@ -87,6 +96,7 @@ export class Notes implements ICollection {
let contentId = item.contentId;
let dateEdited = item.dateEdited;
let headline = item.headline;
let headlineTitle = "";
if (item.content && item.content.data && item.content.type) {
logger.debug("saving content", { id });
@@ -95,7 +105,8 @@ export class Notes implements ICollection {
const content = await getContentFromData(type, data);
if (!content) throw new Error("Invalid content type.");
headline = getNoteHeadline(content);
headline = content.toHeadline();
headlineTitle = content.toTitle();
dateEdited = Date.now();
contentId = await this.db.content.add({
noteId: id,
@@ -125,7 +136,7 @@ export class Notes implements ICollection {
this.db.settings.getTitleFormat(),
this.db.settings.getDateFormat(),
this.db.settings.getTimeFormat(),
headline ? headlineToTitle(headline) : "",
headlineTitle,
this.totalNotes
);
item.isGeneratedTitle = true;
@@ -147,13 +158,10 @@ export class Notes implements ICollection {
if (
item.isGeneratedTitle &&
HEADLINE_REGEX.test(titleFormat) &&
headline &&
currentNoteTitleFields?.title !== headlineToTitle(headline)
headlineTitle &&
currentNoteTitleFields?.title !== headlineTitle
) {
item.title = titleFormat.replace(
HEADLINE_REGEX,
headlineToTitle(headline)
);
item.title = titleFormat.replace(HEADLINE_REGEX, headlineTitle);
}
}
@@ -234,7 +242,11 @@ export class Notes implements ICollection {
get all() {
return this.collection.createFilter<Note>(
(qb) => qb.where(isFalse("dateDeleted")).where(isFalse("deleted")),
(qb) =>
qb
.where(isFalse("dateDeleted"))
.where(isFalse("deleted"))
.where(isFalse("archived")),
this.db.options?.batchSize
);
}
@@ -277,11 +289,23 @@ export class Notes implements ICollection {
qb
.where(isFalse("dateDeleted"))
.where(isFalse("deleted"))
.where(isFalse("archived"))
.where("favorite", "==", true),
this.db.options?.batchSize
);
}
get archived() {
return this.collection.createFilter<Note>(
(qb) =>
qb
.where(isFalse("dateDeleted"))
.where(isFalse("deleted"))
.where("archived", "==", true),
this.db.options?.batchSize
);
}
exists(id: string) {
return this.collection.exists(id);
}
@@ -300,6 +324,14 @@ export class Notes implements ICollection {
favorite(state: boolean, ...ids: string[]) {
return this.collection.update(ids, { favorite: state });
}
async archive(state: boolean, ...ids: string[]) {
await this.collection.update(ids, { archived: state });
if (state) {
addItems(this.cache.archived, ...ids);
} else {
deleteItems(this.cache.archived, ...ids);
}
}
readonly(state: boolean, ...ids: string[]) {
return this.collection.update(ids, { readonly: state });
}
@@ -488,11 +520,3 @@ export class Notes implements ICollection {
).internalLinks;
}
}
function getNoteHeadline(content: Tiptap) {
return content.toHeadline();
}
function headlineToTitle(headline: string) {
return headline.split(" ").splice(0, 10).join(" ");
}

View File

@@ -395,6 +395,11 @@ class RelationsArray<TType extends keyof RelatableTable> {
this.db.trash.cache.notes.length > 0,
(b) => b.where("fromId", "not in", this.db.trash.cache.notes)
)
.$if(
!!this.types?.includes("note" as TType) &&
this.db.notes.cache.archived.length > 0,
(b) => b.where("fromId", "not in", this.db.notes.cache.archived)
)
.$if(
!!this.types?.includes("notebook" as TType) &&
this.db.trash.cache.notebooks.length > 0,
@@ -424,6 +429,11 @@ class RelationsArray<TType extends keyof RelatableTable> {
this.db.trash.cache.notes.length > 0,
(b) => b.where("toId", "not in", this.db.trash.cache.notes)
)
.$if(
!!this.types?.includes("note" as TType) &&
this.db.notes.cache.archived.length > 0,
(b) => b.where("toId", "not in", this.db.notes.cache.archived)
)
.$if(
!!this.types?.includes("notebook" as TType) &&
this.db.trash.cache.notebooks.length > 0,

View File

@@ -62,6 +62,7 @@ const defaultSettings: SettingItemMap = {
"groupOptions:notes": DEFAULT_GROUP_OPTIONS("notes"),
"groupOptions:notebooks": DEFAULT_GROUP_OPTIONS("notebooks"),
"groupOptions:favorites": DEFAULT_GROUP_OPTIONS("favorites"),
"groupOptions:archive": DEFAULT_GROUP_OPTIONS("archive"),
"groupOptions:home": DEFAULT_GROUP_OPTIONS("home"),
"groupOptions:reminders": DEFAULT_GROUP_OPTIONS("reminders"),
@@ -154,7 +155,9 @@ export class Settings implements ICollection {
}
getTrashCleanupInterval() {
return this.get("trashCleanupInterval");
const t = this.get("trashCleanupInterval");
// stored as a string in db, need conversion before use
return Number(t) as TrashCleanupInterval;
}
setDefaultNotebook(item: string | undefined) {

View File

@@ -31,6 +31,7 @@ import dataurl from "../utils/dataurl.js";
import {
HTMLParser,
extractHeadline,
extractTitle,
getDummyDocument
} from "../utils/html-parser.js";
import { HTMLRewriter } from "../utils/html-rewriter.js";
@@ -89,7 +90,11 @@ export class Tiptap {
}
toHeadline() {
return extractHeadline(this.data, 150);
return extractHeadline(this.data);
}
toTitle() {
return extractTitle(this.data, 150);
}
// isEmpty() {

View File

@@ -232,7 +232,8 @@ const BooleanProperties: Set<BooleanFields> = new Set([
"readonly",
"remote",
"synced",
"isGeneratedTitle"
"isGeneratedTitle",
"archived"
]);
const DataMappers: Partial<Record<ItemType, (row: any) => void>> = {

View File

@@ -21,6 +21,7 @@ import {
ColumnBuilderCallback,
CreateTableBuilder,
ExpressionBuilder,
Kysely,
Migration,
MigrationProvider,
sql
@@ -358,31 +359,7 @@ export class NNMigrationProvider implements MigrationProvider {
}
},
"7": {
async up(db) {
await db.transaction().execute(async (tx) => {
await tx.schema.dropTable("content_fts").execute();
await tx.schema.dropTable("notes_fts").execute();
await createFTS5Table(
"notes_fts",
[{ name: "id" }, { name: "title" }],
{
contentTable: "notes",
tokenizer: ["porter", "better_trigram", "remove_diacritics 1"]
}
).execute(tx);
await createFTS5Table(
"content_fts",
[{ name: "id" }, { name: "noteId" }, { name: "data" }],
{
contentTable: "content",
tokenizer: ["porter", "better_trigram", "remove_diacritics 1"]
}
).execute(tx);
});
await rebuildSearchIndex(db);
}
async up() {}
},
"8": {
async up(db) {
@@ -391,6 +368,24 @@ export class NNMigrationProvider implements MigrationProvider {
.addColumn("isGeneratedTitle", "boolean")
.execute();
}
},
"9": {
async up(db) {
await db.schema
.alterTable("notes")
.addColumn("archived", "boolean")
.execute();
}
},
// changing the migrations name scheme from here because
// apparently, Kysley runs migrations in alphanumeric order.
// To ensure things keep running smoothly, we are now moving
// to a date-based migration name but since any number is smaller
// than 9, we have to use "a" in the beginning.
"a-2025-05-16": {
async up(db) {
await runFTSTablesMigrations(db);
}
}
};
}
@@ -453,3 +448,25 @@ function createFTS5Table(
return sql`CREATE VIRTUAL TABLE ${sql.raw(name)} USING fts5(${args})`;
}
async function runFTSTablesMigrations(db: Kysely<any>) {
await db.transaction().execute(async (tx) => {
await tx.schema.dropTable("content_fts").execute();
await tx.schema.dropTable("notes_fts").execute();
await createFTS5Table("notes_fts", [{ name: "id" }, { name: "title" }], {
contentTable: "notes",
tokenizer: ["porter", "better_trigram", "remove_diacritics 1"]
}).execute(tx);
await createFTS5Table(
"content_fts",
[{ name: "id" }, { name: "noteId" }, { name: "data" }],
{
contentTable: "content",
tokenizer: ["html", "porter", "better_trigram", "remove_diacritics 1"]
}
).execute(tx);
});
await rebuildSearchIndex(db);
}

View File

@@ -49,7 +49,8 @@ export const GroupingKey = [
"tags",
"trash",
"favorites",
"reminders"
"reminders",
"archive"
] as const;
export type GroupingKey = (typeof GroupingKey)[number];
@@ -200,6 +201,7 @@ export interface Note extends BaseItem<"note"> {
deletedBy: null;
isGeneratedTitle?: boolean;
archived?: boolean;
}
export interface Notebook extends BaseItem<"notebook"> {

View File

@@ -20,11 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { expect, test } from "vitest";
import { transformQuery } from "../query-transformer.js";
function lt2(str: string) {
return `(">${str}" OR "${str}" OR "${str}<")`;
}
const TRANSFORM_QUERY_TESTS = [
const TRANSFORM_QUERY_TESTS: [string, string][] = [
["hello world", `hello AND world`],
["hello world OR bar", `hello AND world OR bar`],
["hello world OR bar NOT baz", `hello AND world OR bar NOT baz`],
@@ -33,45 +29,34 @@ const TRANSFORM_QUERY_TESTS = [
["hello world -foo", `hello AND world AND "-foo"`],
["hello world phrase-with-dash", `hello AND world AND "phrase-with-dash"`],
["hello world phrase-with-dash*", 'hello AND world AND "phrase-with-dash*"'],
[
"example + foo + bar",
`example AND ${lt2("+")} AND foo AND ${lt2("+")} AND bar`
],
["example + foo + bar", `example AND foo AND bar`],
["example OR foo NOT bar", `example OR foo NOT bar`],
[
'example "quoted phrase" "another quoted phrase"',
`example AND "quoted phrase" AND "another quoted phrase"`
],
['"phrase-with-dash*"', `"phrase-with-dash*"`],
[
'-foo + bar OR "quoted-phrase"',
`"-foo" AND ${lt2("+")} AND bar OR "quoted-phrase"`
],
['-foo + bar OR "quoted-phrase"', `"-foo" AND bar OR "quoted-phrase"`],
[
'phrase-with-dash* + "quoted-phrase"',
`"phrase-with-dash*" AND ${lt2("+")} AND "quoted-phrase"`
`"phrase-with-dash*" AND "quoted-phrase"`
],
[
'example -foo + bar + "quoted-dash-phrase*" OR "another-quoted-phrase"',
`example AND "-foo" AND ${lt2("+")} AND bar AND ${lt2(
"+"
)} AND "quoted-dash-phrase*" OR "another-quoted-phrase"`
`example AND "-foo" AND bar AND "quoted-dash-phrase*" OR "another-quoted-phrase"`
],
["", ""],
["foo", `foo`],
['"quoted"', '"quoted"'],
["-foo -bar", `"-foo" AND "-bar"`],
["foo + + bar", `foo AND ${lt2("+")} AND ${lt2("+")} AND bar`],
["foo + OR", `foo AND ${lt2("+")}`],
["foo + + bar", `foo AND bar`],
["foo + OR", `foo`],
['"special -phrase*"', '"special -phrase*"'],
["foo* + bar*", `"foo*" AND ${lt2("+")} AND "bar*"`],
["(foo + bar) -baz", `"(foo" AND ${lt2("+")} AND "bar)" AND "-baz"`],
["foo* + bar*", `"foo*" AND "bar*"`],
["(foo + bar) -baz", `"(foo" AND "bar)" AND "-baz"`],
['"phrase with "quotes""', '"phrase with ""quotes"""'],
[
'foo + "bar -baz" OR "qux*"',
`foo AND ${lt2("+")} AND "bar -baz" OR "qux*"`
],
["foo + bar + ", `foo AND ${lt2("+")} AND bar AND ${lt2("+")}`],
['foo + "bar -baz" OR "qux*"', `foo AND "bar -baz" OR "qux*"`],
["foo + bar + ", `foo AND bar`],
["+foo bar", `"+foo" AND bar`],
["foo*bar*", `"foo*bar*"`],
['"escaped "quotes""', '"escaped ""quotes"""'],
@@ -80,12 +65,12 @@ const TRANSFORM_QUERY_TESTS = [
["*helo*", `"*helo*"`],
[">he", `">he"`],
["something<hello", `"something<hello"`],
["<", `"<"`],
[">", `">"`]
["<", ``],
[">", ``]
];
for (const [input, expectedOutput] of TRANSFORM_QUERY_TESTS) {
test(`should transform "${input}" into a valid SQL query`, () => {
expect(transformQuery(input)).toBe(expectedOutput);
expect(transformQuery(input).query).toBe(expectedOutput);
});
}

View File

@@ -31,6 +31,13 @@ export function addItem<T>(array: T[], item: T) {
return true;
}
export function addItems<T>(array: T[], ...items: T[]) {
for (const item of items) {
addItem(array, item);
}
return array;
}
export function deleteItem<T>(array: T[], item: T) {
return deleteAtIndex(array, array.indexOf(item));
}

Some files were not shown because too many files have changed in this diff Show More