Compare commits

..

139 Commits

Author SHA1 Message Date
Ammar Ahmed
7ecb5b15c8 mobile: fix title input changes not detected 2024-08-09 12:24:23 +05:00
Ammar Ahmed
12c5b6d227 mobile: release v3.0.12 2024-07-29 10:06:21 +05:00
Ammar Ahmed
364ae51e36 mobile: fix backup share button not working 2024-07-29 09:53:20 +05:00
Ammar Ahmed
18947e0c93 mobile: fix missing fonts in share sheet 2024-07-29 09:43:37 +05:00
François Martin
3880db4339 global: clarify explanations for force push and force pull (#6255)
Signed-off-by: François Martin <f.martin@fastmail.com>
2024-07-29 09:38:30 +05:00
Ammar Ahmed
ae5b0b6fcc mobile: fix share sheet not loading on ios 2024-07-29 09:25:46 +05:00
Abdullah Atta
2c729f90cc global: update lockfiles 2024-07-27 13:30:25 +05:00
Ammar Ahmed
800514d769 mobile: fix position of password input 2024-07-27 12:49:57 +05:00
Ammar Ahmed
b03b9482dc mobile: app stuck after unlock 2024-07-27 12:49:57 +05:00
Abdullah Atta
9019490dbd web: bump version to v3.0.13 2024-07-27 11:16:42 +05:00
Abdullah Atta
4a3e23c288 web: fix reminder can't be set in january 2024-07-27 11:16:09 +05:00
Ammar Ahmed
1800ebea2d mobile: fix keyboard blocks continue button on applock 2024-07-27 11:12:09 +05:00
Ammar Ahmed
a708c9e9eb mobile: fix home shortcut not working 2024-07-27 10:56:09 +05:00
Abdullah Atta
2aeb875fec web: fix crash on moving temporary tab 2024-07-27 10:08:38 +05:00
Abdullah Atta
a8164e9f6c web: enter in title should focus editor 2024-07-27 09:46:37 +05:00
Abdullah Atta
0ee8e738e5 web: fix attachments ui in properties 2024-07-27 09:46:23 +05:00
Abdullah Atta
8fdef2ac7d web: fix attachments flicker in editor note properties 2024-07-27 09:46:23 +05:00
Abdullah Atta
920b1d91f3 web: bump version to 3.0.12 2024-07-22 15:42:18 +05:00
Abdullah Atta
0ad382aced web: fix incorrect attachment upload progress 2024-07-22 15:30:38 +05:00
Abdullah Atta
c8aa8e37cf web: add support for clearing attachments cache 2024-07-22 15:30:21 +05:00
Abdullah Atta
9a37f7c506 web: fix image picker dialog shown for non-image attachments 2024-07-22 13:08:49 +05:00
Abdullah Atta
717750d5d4 web: subscribe to user related events before fetching user 2024-07-22 13:08:36 +05:00
Abdullah Atta
1274ecc3b5 core: refresh token on user subscription change 2024-07-22 13:08:12 +05:00
Abdullah Atta
4c2ad4567c setup: use listr2 2024-07-20 10:34:40 +05:00
Abdullah Atta
ebc01af34a global: publish packages 2024-07-20 10:34:28 +05:00
Abdullah Atta
e66d8eee13 ui: add support for ss 2024-07-20 01:16:46 +05:00
Abdullah Atta
55e6a4b65a editor: do not throw during ssr 2024-07-20 00:42:54 +05:00
Abdullah Atta
0aa1db584d editor: do not keep last line in view for readonly editor 2024-07-19 23:50:20 +05:00
Abdullah Atta
a0e6266d28 ui: fix Cannot access 'mouseMoveListenerAttached' before initialization 2024-07-19 23:26:35 +05:00
Abdullah Atta
bd0aaed863 ui: add support for ssr 2024-07-19 23:22:47 +05:00
Abdullah Atta
9410c42f29 web: fix search icon overlapping route header text 2024-07-19 12:42:18 +05:00
Abdullah Atta
80186c1812 web: fix type errors 2024-07-19 11:11:51 +05:00
Abdullah Atta
37dfda5c54 desktop: set updaterCacheDirName in app-update.yml 2024-07-19 10:52:59 +05:00
Abdullah Atta
ec83517dc5 desktop: fix update check gives no feedback in ui 2024-07-19 10:51:10 +05:00
Abdullah Atta
2eb4911592 web: bump version to 3.0.11 2024-07-18 17:41:26 +05:00
Abdullah Atta
cd0a6a8fcb editor: fix editing link adds a new link right beside it 2024-07-18 17:38:18 +05:00
Abdullah Atta
b15f192244 desktop: update esbuild 2024-07-18 16:47:08 +05:00
Abdullah Atta
406cb663c9 editor: pasting list item with single spaced paragraphs shouldn't break formatting 2024-07-18 12:02:39 +05:00
Abdullah Atta
301a30a50a editor: copying a link from a list item shouldn't add spaces at the end 2024-07-18 12:02:39 +05:00
Abdullah Atta
81e3432143 editor: fix copying multiple lists only copied the first one 2024-07-18 12:02:39 +05:00
Abdullah Atta
c43c2936ac web: use resizeobserver to wait for scroll container to resize 2024-07-18 11:56:48 +05:00
Abdullah Atta
fdea1807d2 web: fix editor scroll bar hiding sometimes on startup 2024-07-18 11:56:48 +05:00
Abdullah Atta
5439578fcf server(theme): add health endpoint 2024-07-17 15:25:52 +05:00
Abdullah Atta
e05e52f870 web: fix crash on sync 2024-07-16 17:18:25 +05:00
Abdullah Atta
1c6243d12e web: fix error on resetting database on crash 2024-07-16 17:18:25 +05:00
Abdullah Atta
a51dfb5b6e web: remove all traces of immer 2024-07-16 17:18:25 +05:00
Abdullah Atta
c98bddd35b web: use sqlite for storing editor session data 2024-07-16 17:18:25 +05:00
Abdullah Atta
1eb80ccc88 web: get rid of dialog controller
dialog controller was redundant and created unnecessary overhead.
It also coupled all the dialogs together so you couldn't import a dialog
independently. This new change isolates each dialog to its own module
while keeping the behaviour mostly the same.
2024-07-16 17:18:25 +05:00
Abdullah Atta
5a346aa7de web: fix tags & colors not updating/loading on opening a note 2024-07-16 17:18:25 +05:00
Abdullah Atta
910095a769 web: replace immer with mutative for perf reasons 2024-07-16 17:18:25 +05:00
Abdullah Atta
119059befa core: update tag on rename instead of upserting 2024-07-16 17:18:25 +05:00
Abdullah Atta
a8f5dea315 core: fix type definition 2024-07-16 17:18:25 +05:00
Abdullah Atta
ca0a4cb02c core: add localStorage like ConfigStorage based on SQLite 2024-07-16 17:18:25 +05:00
Abdullah Atta
a04cd6b8dc core: send event when directly unlinking a relation 2024-07-16 17:18:25 +05:00
Abdullah Atta
3e4ab0f6df setup: update typescript to 5.5 2024-07-16 17:18:25 +05:00
Abdullah Atta
a7fe1aca44 global: update lockfiles 2024-07-16 17:18:25 +05:00
Abdullah Atta
ff0188f602 web: fix app lock verification always succeeds 2024-07-12 14:30:37 +05:00
Ammar Ahmed
c846f8abc8 mobile: release v3.0.11 2024-07-11 12:08:15 +05:00
Abdullah Atta
8d8acfb99d web: fix crash on browsers that doesn't have asyncIterator 2024-07-11 11:55:17 +05:00
Abdullah Atta
3a5b5772ad web: bump version to 3.0.10 2024-07-10 10:44:44 +05:00
Abdullah Atta
8046932e4e web: fix tags & other items lists glitching 2024-07-10 10:43:06 +05:00
Abdullah Atta
c45aa84739 editor: fix pro popup shown on every paste 2024-07-10 09:04:40 +05:00
Abdullah Atta
d98be849e3 web: refresh editor on changing editor options 2024-07-10 09:04:40 +05:00
Abdullah Atta
727ac6d907 web: allow multi tab access when using idb vfs 2024-07-10 09:04:23 +05:00
Abdullah Atta
8302f8ba4c web: update wa-sqlite 2024-07-10 09:04:23 +05:00
Abdullah Atta
4db8b0db01 desktop: update electron-builder 2024-07-08 14:22:24 +05:00
Ammar Ahmed
3f1614ab9a mobile: fix stacktrace formatting 2024-07-08 13:58:04 +05:00
Ammar Ahmed
909d8c35f8 mobile: fix issue reporting 2024-07-08 13:52:57 +05:00
Ammar Ahmed
a73780f0b0 mobile: bump version to v3.0.10 2024-07-08 13:32:45 +05:00
Ammar Ahmed
286fdbeec0 mobile: show toast error if upload file url not resolved 2024-07-08 13:32:30 +05:00
Abdullah Atta
59099552f8 web: bump version to 3.0.9 2024-07-08 12:47:45 +05:00
Ammar Ahmed
0b6013be58 mobile: fix color popup on mobile 2024-07-08 12:07:39 +05:00
Abdullah Atta
2d93a17f34 web: fix all failing tests 2024-07-08 11:22:14 +05:00
Abdullah Atta
5ef7e39e17 web: optimize ui for mobile & tablet form factor 2024-07-08 10:24:50 +05:00
Abdullah Atta
f7de4c9084 editor: fix keyboard shortcut for internal link not working 2024-07-08 10:23:30 +05:00
Abdullah Atta
0672c864f7 web: fix drag/drop with multiple items 2024-07-08 10:23:02 +05:00
Abdullah Atta
cb3706c150 editor: fix editor options not applied 2024-07-08 10:22:25 +05:00
Abdullah Atta
08c6a99336 web: fix note toc not loading on app restart 2024-07-08 10:21:46 +05:00
Abdullah Atta
adf961fa08 editor: fix search options not respected 2024-07-08 10:21:10 +05:00
Abdullah Atta
0eb9ae47e9 web: restrict tab drag/drop to horizontal axis 2024-07-08 10:15:04 +05:00
Abdullah Atta
aa706300a4 web: fix tab not closing on single click 2024-07-04 11:14:20 +05:00
Ammar Ahmed
fd183a0e1e mobile: fix error in editor with incorrect tools data 2024-07-01 11:48:52 +05:00
Ammar Ahmed
b27cd4be0f mobile: set initial lastContentChangeTime to 0 2024-07-01 11:16:52 +05:00
Abdullah Atta
9575561832 web: fix real time editor sync not updating content 2024-07-01 11:16:52 +05:00
Ammar Ahmed
02f96f8d14 mobile: fix cannot read property jsx of undefined 2024-07-01 11:14:43 +05:00
Ammar Ahmed
3cf46e7ad1 mobile: bump deps 2024-07-01 10:12:08 +05:00
Abdullah Atta
93551aa0b7 web: improve focus item in list behavior 2024-07-01 09:51:58 +05:00
Abdullah Atta
d00c35bdaf web: fix tab focus requires 2 clicks 2024-07-01 09:51:44 +05:00
Abdullah Atta
6e6b793568 web: fix web app on mobile browsers 2024-07-01 09:51:29 +05:00
Ammar Ahmed
9e064d88c6 mobile: fix privacy screen 2024-07-01 09:48:14 +05:00
Abdullah Atta
1658ad8d18 core: fix SSE not connecting 2024-06-25 08:31:07 +05:00
Abdullah Atta
c94da3bdf0 core: use single listener for receiving pushed items 2024-06-25 08:30:41 +05:00
Abdullah Atta
1f0fc83a7c editor: remove images on paste if user is not pro 2024-06-07 10:31:02 +05:00
Abdullah Atta
a6af92c330 web: handle errors when resolving upload urls 2024-06-07 10:30:36 +05:00
Abdullah Atta
ef93ecc481 web: handle errors during bootstrapping 2024-06-07 10:30:16 +05:00
Abdullah Atta
039709822c desktop: add instructions for creating packages 2024-06-05 10:38:54 +05:00
Abdullah Atta
25c861ce77 global: publish packages to npm 2024-06-05 10:28:28 +05:00
Abdullah Atta
670f1570b5 setup: add script for publishing packages 2024-06-05 10:28:13 +05:00
Abdullah Atta
c93d82d2d6 web: bump version to 3.0.8 2024-06-03 17:34:53 +05:00
Abdullah Atta
bced20031b web: fix Please unlock the key store to get values 2024-06-03 17:31:44 +05:00
Abdullah Atta
f8bd089b51 web: bump version to 3.0.7 2024-06-03 13:32:01 +05:00
Abdullah Atta
2a4d04a26f mobile: use clearer wording on logout confirmation 2024-06-03 13:27:51 +05:00
Abdullah Atta
a0c32191f9 web: use clearer wording on logout confirmation 2024-06-03 13:27:51 +05:00
Abdullah Atta
662d59f60a web: use clearer wording on database corruption errors 2024-06-03 13:27:51 +05:00
Abdullah Atta
13befe1947 web: handle crashes during export 2024-06-03 13:27:21 +05:00
Abdullah Atta
21f8b6d557 web: allow resetting side bar order & hidden items 2024-06-03 13:08:20 +05:00
Abdullah Atta
aef53cace9 web: disable non pro items in context menu 2024-06-03 13:00:36 +05:00
Abdullah Atta
382b5b0240 web: improve web app loading performance by 10x (#5845)
* web: improve web app loading performance by 10x

* web: update test snapshots
2024-06-03 11:07:44 +05:00
Ammar Ahmed
a45b66d449 mobile: release v3.0.9 2024-06-01 14:14:01 +05:00
Ammar Ahmed
dd67b1a803 mobile: fix login 2fa sheet gets blocked by keyboard 2024-06-01 13:45:28 +05:00
Ammar Ahmed
00568ae839 mobile: add back undo/redo buttons 2024-06-01 13:21:27 +05:00
Abdullah Atta
2b2ea5717c web: bring back undo/redo buttons 2024-06-01 13:21:27 +05:00
Abdullah Atta
5672de8565 desktop: allow using native titlebar on desktop app (#5826) 2024-06-01 13:21:05 +05:00
Ammar Ahmed
1c70ad8cec web: fix tags & colors not included in imported notes (#5801)
* web: include tags and colors in imports

* web: refactors

---------

Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2024-06-01 11:40:16 +05:00
Abdullah Atta
0c344a2146 core: fix sqlite hangs on restoring notebook 2024-06-01 11:28:40 +05:00
Yoonjae Choi
38f69b514c web: fix readonly locked notes opening as editable (#5731)
Signed-off-by: Yoonjae Choi <dbswo9795@email.com>
2024-06-01 11:27:59 +05:00
Abdullah Atta
b502f6a08f web: fix CVE-2024-4367 2024-06-01 11:26:43 +05:00
Abdullah Atta
d68c3269d3 editor: fix extra padding around image 2024-06-01 11:26:28 +05:00
Abdullah Atta
6d9af85e2a web: fix background color of count in nav item 2024-05-21 13:14:56 +05:00
Abdullah Atta
1d58cfea3c web: fix navigation bar in settings dialog not themed 2024-05-21 13:14:56 +05:00
Abdullah Atta
c1fa4d3400 web: fix wrong version saved on conflict resolve 2024-05-21 13:14:42 +05:00
Abdullah Atta
df179056d6 logger: fix logger in core not working 2024-05-21 12:19:39 +05:00
Abdullah Atta
26f9e08c23 web: fix sync not running on page focus 2024-05-21 10:47:25 +05:00
Abdullah Atta
f719bebe5a core: create triggers after resetting database 2024-05-21 09:59:20 +05:00
Abdullah Atta
9693c8ea54 desktop: run sqlite on another thread 2024-05-21 09:59:20 +05:00
Abdullah Atta
040a677895 core: add support for closing logger db 2024-05-21 09:59:20 +05:00
Ammar Ahmed
df2708147e mobile: release v3.0.8 2024-05-20 15:35:59 +05:00
Ammar Ahmed
faba5f6385 mobile: always recreate editor on changing note 2024-05-20 15:08:27 +05:00
Ammar Ahmed
eab5bccb99 mobile: use sqlite based logger 2024-05-20 15:05:18 +05:00
Abdullah Atta
ed399c0d0a web: use noop logger before initializing 2024-05-20 15:05:18 +05:00
Abdullah Atta
3c7e962fe0 logger: minor refactor 2024-05-20 15:05:18 +05:00
Abdullah Atta
56614ef19d core: use chunks and set date only once 2024-05-20 15:05:18 +05:00
Abdullah Atta
169318c549 core: remove attachments initialized log 2024-05-20 15:05:18 +05:00
Abdullah Atta
bd6a1b9bff web: add support for opening multiple sqlite databases 2024-05-20 15:05:18 +05:00
Abdullah Atta
443d6625f9 core: add support for deleting logs for a specific date 2024-05-20 15:05:18 +05:00
Abdullah Atta
b6f95ff7cd core: use sqlite for storing logs 2024-05-20 15:05:18 +05:00
Ammar Ahmed
1b13da54a1 mobile: fix image extension 2024-05-20 12:55:34 +05:00
Ammar Ahmed
adf0f132fd mobile: convert heic/heif images to jpeg 2024-05-20 12:55:34 +05:00
Ammar Ahmed
73ec04b42d mobile: fix error when writing user key 2024-05-20 10:45:02 +05:00
288 changed files with 9995 additions and 7776 deletions

View File

@@ -40,12 +40,35 @@ Once you are inside the `./notesnook` directory, run the preparation step:
npm install
```
Now you can finally start the desktop app:
Now you can finally start the desktop app for development:
```bash
npm run start:desktop
```
To run the app in release mode:
```bash
npm run staging -- --rebuild
```
This will compile and run the app in production mode but it won't generate any packages. To create the final packages, you'll have to run the following commands:
```bash
npm run release -- --rebuild
# For macOS
npx electron-builder --mac dmg --arm64 --x64 -publish never
# For Linux (AppImage)
npx electron-builder --linux AppImage:x64 AppImage:arm64 -publish never
# For Windows
npx electron-builder --win --publish never
```
Feel free to play around with the `electron-builder` command to get the packages you need. `npx electron-builder --help` is a great resource to learn different commands & platforms supported by `electron-builder`.
## Developer guide
### The tech stack

View File

@@ -1,3 +1,4 @@
owner: streetwriters
repo: notesnook
provider: github
updaterCacheDirName: Notesnook

View File

@@ -1,12 +1,12 @@
{
"name": "@notesnook/desktop",
"version": "3.0.6",
"version": "3.0.13",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@notesnook/desktop",
"version": "3.0.6",
"version": "3.0.13",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"dependencies": {
@@ -15,7 +15,7 @@
"@trpc/server": "10.38.3",
"better-sqlite3-multiple-ciphers": "^9.5.0",
"electron-trpc": "0.5.2",
"electron-updater": "6.1.4",
"electron-updater": "^6.2.1",
"icojs": "^0.17.1",
"sodium-native": "^4.1.1",
"typed-emitter": "^2.1.0",
@@ -28,7 +28,8 @@
"chokidar": "^3.5.3",
"electron": "^29.3.1",
"electron-builder": "^24.13.3",
"esbuild": "^0.20.0",
"esbuild": "^0.23.0",
"kysely": "^0.27.3",
"node-gyp-build": "^4.8.0",
"prebuildify": "^6.0.1",
"tree-kill": "^1.2.2",
@@ -40,7 +41,7 @@
},
"../../packages/crypto": {
"name": "@notesnook/crypto",
"version": "1.1.1",
"version": "2.0.7",
"license": "GPL-3.0-or-later",
"dependencies": {
"@notesnook/sodium": "file:../sodium"
@@ -70,9 +71,9 @@
}
},
"node_modules/@electron/asar": {
"version": "3.2.9",
"resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.2.9.tgz",
"integrity": "sha512-Vu2P3X2gcZ3MY9W7yH72X9+AMXwUQZEJBrsPIbX0JsdllLtoh62/Q8Wg370/DawIEVKOyfD6KtTLo645ezqxUA==",
"version": "3.2.10",
"resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.2.10.tgz",
"integrity": "sha512-mvBSwIBUeiRscrCeJE1LwctAriBj65eUDm0Pc11iE5gRwzkmsdbS7FnZ1XUWjpSeQWL1L5g12Fc/SchPM9DUOw==",
"dev": true,
"dependencies": {
"commander": "^5.0.0",
@@ -288,9 +289,9 @@
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.0.tgz",
"integrity": "sha512-fGFDEctNh0CcSwsiRPxiaqX0P5rq+AqE0SRhYGZ4PX46Lg1FNR6oCxJghf8YgY0WQEgQuh3lErUFE4KxLeRmmw==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.0.tgz",
"integrity": "sha512-3sG8Zwa5fMcA9bgqB8AfWPQ+HFke6uD3h1s3RIwUNK8EG7a4buxvuFTs3j1IMs2NXAk9F30C/FF4vxRgQCcmoQ==",
"cpu": [
"ppc64"
],
@@ -300,13 +301,13 @@
"aix"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.0.tgz",
"integrity": "sha512-3bMAfInvByLHfJwYPJRlpTeaQA75n8C/QKpEaiS4HrFWFiJlNI0vzq/zCjBrhAYcPyVPG7Eo9dMrcQXuqmNk5g==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.0.tgz",
"integrity": "sha512-+KuOHTKKyIKgEEqKbGTK8W7mPp+hKinbMBeEnNzjJGyFcWsfrXjSTNluJHCY1RqhxFurdD8uNXQDei7qDlR6+g==",
"cpu": [
"arm"
],
@@ -316,13 +317,13 @@
"android"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.0.tgz",
"integrity": "sha512-aVpnM4lURNkp0D3qPoAzSG92VXStYmoVPOgXveAUoQBWRSuQzt51yvSju29J6AHPmwY1BjH49uR29oyfH1ra8Q==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.0.tgz",
"integrity": "sha512-EuHFUYkAVfU4qBdyivULuu03FhJO4IJN9PGuABGrFy4vUuzk91P2d+npxHcFdpUnfYKy0PuV+n6bKIpHOB3prQ==",
"cpu": [
"arm64"
],
@@ -332,13 +333,13 @@
"android"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.0.tgz",
"integrity": "sha512-uK7wAnlRvjkCPzh8jJ+QejFyrP8ObKuR5cBIsQZ+qbMunwR8sbd8krmMbxTLSrDhiPZaJYKQAU5Y3iMDcZPhyQ==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.0.tgz",
"integrity": "sha512-WRrmKidLoKDl56LsbBMhzTTBxrsVwTKdNbKDalbEZr0tcsBgCLbEtoNthOW6PX942YiYq8HzEnb4yWQMLQuipQ==",
"cpu": [
"x64"
],
@@ -348,13 +349,13 @@
"android"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.0.tgz",
"integrity": "sha512-AjEcivGAlPs3UAcJedMa9qYg9eSfU6FnGHJjT8s346HSKkrcWlYezGE8VaO2xKfvvlZkgAhyvl06OJOxiMgOYQ==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.0.tgz",
"integrity": "sha512-YLntie/IdS31H54Ogdn+v50NuoWF5BDkEUFpiOChVa9UnKpftgwzZRrI4J132ETIi+D8n6xh9IviFV3eXdxfow==",
"cpu": [
"arm64"
],
@@ -364,13 +365,13 @@
"darwin"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.0.tgz",
"integrity": "sha512-bsgTPoyYDnPv8ER0HqnJggXK6RyFy4PH4rtsId0V7Efa90u2+EifxytE9pZnsDgExgkARy24WUQGv9irVbTvIw==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.0.tgz",
"integrity": "sha512-IMQ6eme4AfznElesHUPDZ+teuGwoRmVuuixu7sv92ZkdQcPbsNHzutd+rAfaBKo8YK3IrBEi9SLLKWJdEvJniQ==",
"cpu": [
"x64"
],
@@ -380,13 +381,13 @@
"darwin"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.0.tgz",
"integrity": "sha512-kQ7jYdlKS335mpGbMW5tEe3IrQFIok9r84EM3PXB8qBFJPSc6dpWfrtsC/y1pyrz82xfUIn5ZrnSHQQsd6jebQ==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.0.tgz",
"integrity": "sha512-0muYWCng5vqaxobq6LB3YNtevDFSAZGlgtLoAc81PjUfiFz36n4KMpwhtAd4he8ToSI3TGyuhyx5xmiWNYZFyw==",
"cpu": [
"arm64"
],
@@ -396,13 +397,13 @@
"freebsd"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.0.tgz",
"integrity": "sha512-uG8B0WSepMRsBNVXAQcHf9+Ko/Tr+XqmK7Ptel9HVmnykupXdS4J7ovSQUIi0tQGIndhbqWLaIL/qO/cWhXKyQ==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.0.tgz",
"integrity": "sha512-XKDVu8IsD0/q3foBzsXGt/KjD/yTKBCIwOHE1XwiXmrRwrX6Hbnd5Eqn/WvDekddK21tfszBSrE/WMaZh+1buQ==",
"cpu": [
"x64"
],
@@ -412,13 +413,13 @@
"freebsd"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.0.tgz",
"integrity": "sha512-2ezuhdiZw8vuHf1HKSf4TIk80naTbP9At7sOqZmdVwvvMyuoDiZB49YZKLsLOfKIr77+I40dWpHVeY5JHpIEIg==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.0.tgz",
"integrity": "sha512-SEELSTEtOFu5LPykzA395Mc+54RMg1EUgXP+iw2SJ72+ooMwVsgfuwXo5Fn0wXNgWZsTVHwY2cg4Vi/bOD88qw==",
"cpu": [
"arm"
],
@@ -428,13 +429,13 @@
"linux"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.0.tgz",
"integrity": "sha512-uTtyYAP5veqi2z9b6Gr0NUoNv9F/rOzI8tOD5jKcCvRUn7T60Bb+42NDBCWNhMjkQzI0qqwXkQGo1SY41G52nw==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.0.tgz",
"integrity": "sha512-j1t5iG8jE7BhonbsEg5d9qOYcVZv/Rv6tghaXM/Ug9xahM0nX/H2gfu6X6z11QRTMT6+aywOMA8TDkhPo8aCGw==",
"cpu": [
"arm64"
],
@@ -444,13 +445,13 @@
"linux"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.0.tgz",
"integrity": "sha512-c88wwtfs8tTffPaoJ+SQn3y+lKtgTzyjkD8NgsyCtCmtoIC8RDL7PrJU05an/e9VuAke6eJqGkoMhJK1RY6z4w==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.0.tgz",
"integrity": "sha512-P7O5Tkh2NbgIm2R6x1zGJJsnacDzTFcRWZyTTMgFdVit6E98LTxO+v8LCCLWRvPrjdzXHx9FEOA8oAZPyApWUA==",
"cpu": [
"ia32"
],
@@ -460,13 +461,13 @@
"linux"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.0.tgz",
"integrity": "sha512-lR2rr/128/6svngnVta6JN4gxSXle/yZEZL3o4XZ6esOqhyR4wsKyfu6qXAL04S4S5CgGfG+GYZnjFd4YiG3Aw==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.0.tgz",
"integrity": "sha512-InQwepswq6urikQiIC/kkx412fqUZudBO4SYKu0N+tGhXRWUqAx+Q+341tFV6QdBifpjYgUndV1hhMq3WeJi7A==",
"cpu": [
"loong64"
],
@@ -476,13 +477,13 @@
"linux"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.0.tgz",
"integrity": "sha512-9Sycc+1uUsDnJCelDf6ZNqgZQoK1mJvFtqf2MUz4ujTxGhvCWw+4chYfDLPepMEvVL9PDwn6HrXad5yOrNzIsQ==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.0.tgz",
"integrity": "sha512-J9rflLtqdYrxHv2FqXE2i1ELgNjT+JFURt/uDMoPQLcjWQA5wDKgQA4t/dTqGa88ZVECKaD0TctwsUfHbVoi4w==",
"cpu": [
"mips64el"
],
@@ -492,13 +493,13 @@
"linux"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.0.tgz",
"integrity": "sha512-CoWSaaAXOZd+CjbUTdXIJE/t7Oz+4g90A3VBCHLbfuc5yUQU/nFDLOzQsN0cdxgXd97lYW/psIIBdjzQIwTBGw==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.0.tgz",
"integrity": "sha512-cShCXtEOVc5GxU0fM+dsFD10qZ5UpcQ8AM22bYj0u/yaAykWnqXJDpd77ublcX6vdDsWLuweeuSNZk4yUxZwtw==",
"cpu": [
"ppc64"
],
@@ -508,13 +509,13 @@
"linux"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.0.tgz",
"integrity": "sha512-mlb1hg/eYRJUpv8h/x+4ShgoNLL8wgZ64SUr26KwglTYnwAWjkhR2GpoKftDbPOCnodA9t4Y/b68H4J9XmmPzA==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.0.tgz",
"integrity": "sha512-HEtaN7Y5UB4tZPeQmgz/UhzoEyYftbMXrBCUjINGjh3uil+rB/QzzpMshz3cNUxqXN7Vr93zzVtpIDL99t9aRw==",
"cpu": [
"riscv64"
],
@@ -524,13 +525,13 @@
"linux"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.0.tgz",
"integrity": "sha512-fgf9ubb53xSnOBqyvWEY6ukBNRl1mVX1srPNu06B6mNsNK20JfH6xV6jECzrQ69/VMiTLvHMicQR/PgTOgqJUQ==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.0.tgz",
"integrity": "sha512-WDi3+NVAuyjg/Wxi+o5KPqRbZY0QhI9TjrEEm+8dmpY9Xir8+HE/HNx2JoLckhKbFopW0RdO2D72w8trZOV+Wg==",
"cpu": [
"s390x"
],
@@ -540,13 +541,13 @@
"linux"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.0.tgz",
"integrity": "sha512-H9Eu6MGse++204XZcYsse1yFHmRXEWgadk2N58O/xd50P9EvFMLJTQLg+lB4E1cF2xhLZU5luSWtGTb0l9UeSg==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.0.tgz",
"integrity": "sha512-a3pMQhUEJkITgAw6e0bWA+F+vFtCciMjW/LPtoj99MhVt+Mfb6bbL9hu2wmTZgNd994qTAEw+U/r6k3qHWWaOQ==",
"cpu": [
"x64"
],
@@ -556,13 +557,13 @@
"linux"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.0.tgz",
"integrity": "sha512-lCT675rTN1v8Fo+RGrE5KjSnfY0x9Og4RN7t7lVrN3vMSjy34/+3na0q7RIfWDAj0e0rCh0OL+P88lu3Rt21MQ==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.0.tgz",
"integrity": "sha512-cRK+YDem7lFTs2Q5nEv/HHc4LnrfBCbH5+JHu6wm2eP+d8OZNoSMYgPZJq78vqQ9g+9+nMuIsAO7skzphRXHyw==",
"cpu": [
"x64"
],
@@ -572,13 +573,29 @@
"netbsd"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-arm64": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.0.tgz",
"integrity": "sha512-suXjq53gERueVWu0OKxzWqk7NxiUWSUlrxoZK7usiF50C6ipColGR5qie2496iKGYNLhDZkPxBI3erbnYkU0rQ==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.0.tgz",
"integrity": "sha512-HKoUGXz/TOVXKQ+67NhxyHv+aDSZf44QpWLa3I1lLvAwGq8x1k0T+e2HHSRvxWhfJrFxaaqre1+YyzQ99KixoA==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.0.tgz",
"integrity": "sha512-6p3nHpby0DM/v15IFKMjAaayFhqnXV52aEmv1whZHX56pdkK+MEaLoQWj+H42ssFarP1PcomVhbsR4pkz09qBg==",
"cpu": [
"x64"
],
@@ -588,13 +605,13 @@
"openbsd"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.0.tgz",
"integrity": "sha512-GDwAqgHQm1mVoPppGsoq4WJwT3vhnz/2N62CzhvApFD1eJyTroob30FPpOZabN+FgCjhG+AgcZyOPIkR8dfD7g==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.0.tgz",
"integrity": "sha512-BFelBGfrBwk6LVrmFzCq1u1dZbG4zy/Kp93w2+y83Q5UGYF1d8sCzeLI9NXjKyujjBBniQa8R8PzLFAUrSM9OA==",
"cpu": [
"x64"
],
@@ -604,13 +621,13 @@
"sunos"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.0.tgz",
"integrity": "sha512-0vYsP8aC4TvMlOQYozoksiaxjlvUcQrac+muDqj1Fxy6jh9l9CZJzj7zmh8JGfiV49cYLTorFLxg7593pGldwQ==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.0.tgz",
"integrity": "sha512-lY6AC8p4Cnb7xYHuIxQ6iYPe6MfO2CC43XXKo9nBXDb35krYt7KGhQnOkRGar5psxYkircpCqfbNDB4uJbS2jQ==",
"cpu": [
"arm64"
],
@@ -620,13 +637,13 @@
"win32"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.0.tgz",
"integrity": "sha512-p98u4rIgfh4gdpV00IqknBD5pC84LCub+4a3MO+zjqvU5MVXOc3hqR2UgT2jI2nh3h8s9EQxmOsVI3tyzv1iFg==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.0.tgz",
"integrity": "sha512-7L1bHlOTcO4ByvI7OXVI5pNN6HSu6pUQq9yodga8izeuB1KcT2UkHaH6118QJwopExPn0rMHIseCTx1CRo/uNA==",
"cpu": [
"ia32"
],
@@ -636,13 +653,13 @@
"win32"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.0.tgz",
"integrity": "sha512-NgJnesu1RtWihtTtXGFMU5YSE6JyyHPMxCwBZK7a6/8d31GuSo9l0Ss7w1Jw5QnKUawG6UEehs883kcXf5fYwg==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.0.tgz",
"integrity": "sha512-Arm+WgUFLUATuoxCJcahGuk6Yj9Pzxd6l11Zb/2aAuv5kWWvvfhLFo2fni4uSK5vzlUdCGZ/BdV5tH8klj8p8g==",
"cpu": [
"x64"
],
@@ -652,7 +669,7 @@
"win32"
],
"engines": {
"node": ">=12"
"node": ">=18"
}
},
"node_modules/@isaacs/cliui": {
@@ -981,6 +998,15 @@
"@types/node": "*"
}
},
"node_modules/@xmldom/xmldom": {
"version": "0.8.10",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
"integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
"devOptional": true,
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/7zip-bin": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-5.2.0.tgz",
@@ -1107,19 +1133,6 @@
"electron-builder-squirrel-windows": "24.13.3"
}
},
"node_modules/app-builder-lib/node_modules/builder-util-runtime": {
"version": "9.2.4",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.4.tgz",
"integrity": "sha512-upp+biKpN/XZMLim7aguUyW8s0FUpDvOtK6sbanMFDAMBzpHDqdhgVYm6zc9HJ6nWo7u2Lxk60i2M6Jd3aiNrA==",
"dev": true,
"dependencies": {
"debug": "^4.3.4",
"sax": "^1.2.4"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -1358,22 +1371,9 @@
}
},
"node_modules/builder-util-runtime": {
"version": "9.2.1",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.1.tgz",
"integrity": "sha512-2rLv/uQD2x+dJ0J3xtsmI12AlRyk7p45TEbE/6o/fbb633e/S3pPgm+ct+JHsoY7r39dKHnGEFk/AASRFdnXmA==",
"dependencies": {
"debug": "^4.3.4",
"sax": "^1.2.4"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/builder-util/node_modules/builder-util-runtime": {
"version": "9.2.4",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.4.tgz",
"integrity": "sha512-upp+biKpN/XZMLim7aguUyW8s0FUpDvOtK6sbanMFDAMBzpHDqdhgVYm6zc9HJ6nWo7u2Lxk60i2M6Jd3aiNrA==",
"dev": true,
"dependencies": {
"debug": "^4.3.4",
"sax": "^1.2.4"
@@ -1586,31 +1586,32 @@
}
},
"node_modules/config-file-ts/node_modules/glob": {
"version": "10.3.12",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz",
"integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==",
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.3.tgz",
"integrity": "sha512-Q38SGlYRpVtDBPSWEylRyctn7uDeTp4NQERTLiCT1FqA9JXPYWqAVmQU6qh4r/zMM5ehxTcbaO8EjhWnvEhmyg==",
"dev": true,
"dependencies": {
"foreground-child": "^3.1.0",
"jackspeak": "^2.3.6",
"minimatch": "^9.0.1",
"minipass": "^7.0.4",
"path-scurry": "^1.10.2"
"jackspeak": "^3.1.2",
"minimatch": "^9.0.4",
"minipass": "^7.1.2",
"package-json-from-dist": "^1.0.0",
"path-scurry": "^1.11.1"
},
"bin": {
"glob": "dist/esm/bin.mjs"
},
"engines": {
"node": ">=16 || 14 >=14.17"
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/config-file-ts/node_modules/minimatch": {
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz",
"integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==",
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"dependencies": {
"brace-expansion": "^2.0.1"
@@ -1623,9 +1624,9 @@
}
},
"node_modules/config-file-ts/node_modules/minipass": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz",
"integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==",
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"dev": true,
"engines": {
"node": ">=16 || 14 >=14.17"
@@ -1833,19 +1834,6 @@
"dmg-license": "^1.0.11"
}
},
"node_modules/dmg-builder/node_modules/builder-util-runtime": {
"version": "9.2.4",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.4.tgz",
"integrity": "sha512-upp+biKpN/XZMLim7aguUyW8s0FUpDvOtK6sbanMFDAMBzpHDqdhgVYm6zc9HJ6nWo7u2Lxk60i2M6Jd3aiNrA==",
"dev": true,
"dependencies": {
"debug": "^4.3.4",
"sax": "^1.2.4"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/dmg-license": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.11.tgz",
@@ -1951,19 +1939,6 @@
"node": ">=14.0.0"
}
},
"node_modules/electron-builder/node_modules/builder-util-runtime": {
"version": "9.2.4",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.4.tgz",
"integrity": "sha512-upp+biKpN/XZMLim7aguUyW8s0FUpDvOtK6sbanMFDAMBzpHDqdhgVYm6zc9HJ6nWo7u2Lxk60i2M6Jd3aiNrA==",
"dev": true,
"dependencies": {
"debug": "^4.3.4",
"sax": "^1.2.4"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/electron-publish": {
"version": "24.13.1",
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-24.13.1.tgz",
@@ -1979,19 +1954,6 @@
"mime": "^2.5.2"
}
},
"node_modules/electron-publish/node_modules/builder-util-runtime": {
"version": "9.2.4",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.4.tgz",
"integrity": "sha512-upp+biKpN/XZMLim7aguUyW8s0FUpDvOtK6sbanMFDAMBzpHDqdhgVYm6zc9HJ6nWo7u2Lxk60i2M6Jd3aiNrA==",
"dev": true,
"dependencies": {
"debug": "^4.3.4",
"sax": "^1.2.4"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/electron-trpc": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/electron-trpc/-/electron-trpc-0.5.2.tgz",
@@ -2006,11 +1968,11 @@
}
},
"node_modules/electron-updater": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.1.4.tgz",
"integrity": "sha512-yYAJc6RQjjV4WtInZVn+ZcLyXRhbVXoomKEfUUwDqIk5s2wxzLhWaor7lrNgxODyODhipjg4SVPMhJHi5EnsCA==",
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.2.1.tgz",
"integrity": "sha512-83eKIPW14qwZqUUM6wdsIRwVKZyjmHxQ4/8G+1C6iS5PdDt7b1umYQyj1/qPpH510GmHEQe4q0kCPe3qmb3a0Q==",
"dependencies": {
"builder-util-runtime": "9.2.1",
"builder-util-runtime": "9.2.4",
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0",
"lazy-val": "^1.0.5",
@@ -2065,41 +2027,42 @@
"optional": true
},
"node_modules/esbuild": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.0.tgz",
"integrity": "sha512-6iwE3Y2RVYCME1jLpBqq7LQWK3MW6vjV2bZy6gt/WrqkY+WE74Spyc0ThAOYpMtITvnjX09CrC6ym7A/m9mebA==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.0.tgz",
"integrity": "sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==",
"dev": true,
"hasInstallScript": true,
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=12"
"node": ">=18"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.20.0",
"@esbuild/android-arm": "0.20.0",
"@esbuild/android-arm64": "0.20.0",
"@esbuild/android-x64": "0.20.0",
"@esbuild/darwin-arm64": "0.20.0",
"@esbuild/darwin-x64": "0.20.0",
"@esbuild/freebsd-arm64": "0.20.0",
"@esbuild/freebsd-x64": "0.20.0",
"@esbuild/linux-arm": "0.20.0",
"@esbuild/linux-arm64": "0.20.0",
"@esbuild/linux-ia32": "0.20.0",
"@esbuild/linux-loong64": "0.20.0",
"@esbuild/linux-mips64el": "0.20.0",
"@esbuild/linux-ppc64": "0.20.0",
"@esbuild/linux-riscv64": "0.20.0",
"@esbuild/linux-s390x": "0.20.0",
"@esbuild/linux-x64": "0.20.0",
"@esbuild/netbsd-x64": "0.20.0",
"@esbuild/openbsd-x64": "0.20.0",
"@esbuild/sunos-x64": "0.20.0",
"@esbuild/win32-arm64": "0.20.0",
"@esbuild/win32-ia32": "0.20.0",
"@esbuild/win32-x64": "0.20.0"
"@esbuild/aix-ppc64": "0.23.0",
"@esbuild/android-arm": "0.23.0",
"@esbuild/android-arm64": "0.23.0",
"@esbuild/android-x64": "0.23.0",
"@esbuild/darwin-arm64": "0.23.0",
"@esbuild/darwin-x64": "0.23.0",
"@esbuild/freebsd-arm64": "0.23.0",
"@esbuild/freebsd-x64": "0.23.0",
"@esbuild/linux-arm": "0.23.0",
"@esbuild/linux-arm64": "0.23.0",
"@esbuild/linux-ia32": "0.23.0",
"@esbuild/linux-loong64": "0.23.0",
"@esbuild/linux-mips64el": "0.23.0",
"@esbuild/linux-ppc64": "0.23.0",
"@esbuild/linux-riscv64": "0.23.0",
"@esbuild/linux-s390x": "0.23.0",
"@esbuild/linux-x64": "0.23.0",
"@esbuild/netbsd-x64": "0.23.0",
"@esbuild/openbsd-arm64": "0.23.0",
"@esbuild/openbsd-x64": "0.23.0",
"@esbuild/sunos-x64": "0.23.0",
"@esbuild/win32-arm64": "0.23.0",
"@esbuild/win32-ia32": "0.23.0",
"@esbuild/win32-x64": "0.23.0"
}
},
"node_modules/escalade": {
@@ -2224,9 +2187,9 @@
}
},
"node_modules/foreground-child": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
"integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==",
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz",
"integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==",
"dev": true,
"dependencies": {
"cross-spawn": "^7.0.0",
@@ -2239,6 +2202,18 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/foreground-child/node_modules/signal-exit": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dev": true,
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
@@ -2370,6 +2345,7 @@
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"deprecated": "Glob versions prior to v9 are no longer supported",
"dev": true,
"dependencies": {
"fs.realpath": "^1.0.0",
@@ -2670,6 +2646,7 @@
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
"dev": true,
"dependencies": {
"once": "^1.3.0",
@@ -2767,15 +2744,15 @@
"dev": true
},
"node_modules/jackspeak": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz",
"integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==",
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.1.tgz",
"integrity": "sha512-U23pQPDnmYybVkYjObcuYMk43VRlMLLqLI+RdZy8s8WV8WsxO9SnqSroKaluuvcNOdCAlauKszDwd+umbot5Mg==",
"dev": true,
"dependencies": {
"@isaacs/cliui": "^8.0.2"
},
"engines": {
"node": ">=14"
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
@@ -2785,9 +2762,9 @@
}
},
"node_modules/jake": {
"version": "10.8.7",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz",
"integrity": "sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==",
"version": "10.9.1",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.9.1.tgz",
"integrity": "sha512-61btcOHNnLnsOdtLgA5efqQWjnSi/vow5HbI7HMdKKWqvrKR1bLK3BPlJn9gcSaP2ewuamUSMB5XEy76KUIS2w==",
"dev": true,
"dependencies": {
"async": "^3.2.3",
@@ -2891,6 +2868,15 @@
"json-buffer": "3.0.1"
}
},
"node_modules/kysely": {
"version": "0.27.3",
"resolved": "https://registry.npmjs.org/kysely/-/kysely-0.27.3.tgz",
"integrity": "sha512-lG03Ru+XyOJFsjH3OMY6R/9U38IjDPfnOfDgO3ynhbDr+Dz8fak+X6L62vqu3iybQnj+lG84OttBuU9KY3L9kA==",
"dev": true,
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/lazy-val": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/lazy-val/-/lazy-val-1.0.5.tgz",
@@ -3155,6 +3141,12 @@
"node": ">=8"
}
},
"node_modules/package-json-from-dist": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz",
"integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==",
"dev": true
},
"node_modules/path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@@ -3174,28 +3166,37 @@
}
},
"node_modules/path-scurry": {
"version": "1.10.2",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz",
"integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==",
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"dev": true,
"dependencies": {
"lru-cache": "^10.2.0",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
},
"engines": {
"node": ">=16 || 14 >=14.17"
"node": ">=16 || 14 >=14.18"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/path-scurry/node_modules/lru-cache": {
"version": "10.2.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.1.tgz",
"integrity": "sha512-tS24spDe/zXhWbNPErCHs/AGOzbKGHT+ybSBqmdLm8WZ1xXLWvH8Qn71QPAlqVhd0qUTWjy+Kl9JmISgDdEjsA==",
"version": "10.4.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.0.tgz",
"integrity": "sha512-bfJaPTuEiTYBu+ulDaeQ0F+uLmlfFkMgXj4cbwfuMSjgObGMzb55FMMbDvbRU0fAHZ4sLGkz2mKwcMg8Dvm8Ww==",
"dev": true,
"engines": {
"node": "14 || >=16.14"
"node": ">=18"
}
},
"node_modules/path-scurry/node_modules/minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"dev": true,
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/peek-readable": {
@@ -3229,16 +3230,17 @@
}
},
"node_modules/plist": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.6.tgz",
"integrity": "sha512-WiIVYyrp8TD4w8yCvyeIr+lkmrGRd5u0VbRnU+tP/aRLxP/YadJUYOMZJ/6hIa3oUyVCsycXvtNRgd5XBJIbiA==",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz",
"integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==",
"devOptional": true,
"dependencies": {
"@xmldom/xmldom": "^0.8.8",
"base64-js": "^1.5.1",
"xmlbuilder": "^15.1.1"
},
"engines": {
"node": ">=6"
"node": ">=10.4.0"
}
},
"node_modules/pngjs": {
@@ -3586,18 +3588,6 @@
"node": ">=8"
}
},
"node_modules/signal-exit": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dev": true,
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/simple-concat": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
@@ -3987,9 +3977,9 @@
}
},
"node_modules/typescript": {
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
"version": "5.5.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
"integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -4032,9 +4022,9 @@
}
},
"node_modules/utf8-byte-length": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz",
"integrity": "sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==",
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz",
"integrity": "sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA==",
"dev": true
},
"node_modules/util-deprecate": {

View File

@@ -2,7 +2,7 @@
"name": "@notesnook/desktop",
"productName": "Notesnook",
"description": "Your private note taking space",
"version": "3.0.6",
"version": "3.0.13",
"appAppleId": "1544027013",
"private": true,
"main": "./dist/index.js",
@@ -16,7 +16,7 @@
"@trpc/server": "10.38.3",
"better-sqlite3-multiple-ciphers": "^9.5.0",
"electron-trpc": "0.5.2",
"electron-updater": "6.1.4",
"electron-updater": "^6.2.1",
"icojs": "^0.17.1",
"sodium-native": "^4.1.1",
"typed-emitter": "^2.1.0",
@@ -29,7 +29,8 @@
"chokidar": "^3.5.3",
"electron": "^29.3.1",
"electron-builder": "^24.13.3",
"esbuild": "^0.20.0",
"esbuild": "^0.23.0",
"kysely": "^0.27.3",
"node-gyp-build": "^4.8.0",
"prebuildify": "^6.0.1",
"tree-kill": "^1.2.2",

View File

@@ -46,11 +46,11 @@ if (args.rebuild || !existsSync(path.join(webAppPath, "build"))) {
// temporary until there's support for prebuilt binaries for linux ARM
if (os.platform() === "linux") await patchBetterSQLite3();
if (os.platform() === "win32")
await exec(
`npx prebuildify --arch=arm64 --strip -t electron@${packageJson.devDependencies.electron}`,
path.join(__dirname, "..", "node_modules", "sodium-native")
);
// if (os.platform() === "win32")
// await exec(
// `npx prebuildify --arch=arm64 --strip -t electron@${packageJson.devDependencies.electron}`,
// path.join(__dirname, "..", "node_modules", "sodium-native")
// );
await fs.cp(path.join(webAppPath, "build"), "build", {
recursive: true,

View File

@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { initTRPC } from "@trpc/server";
import { z } from "zod";
import { dialog, nativeTheme, Notification, shell } from "electron";
import { app, dialog, nativeTheme, Notification, shell } from "electron";
import { AutoLaunch } from "../utils/autolaunch";
import { config, DesktopIntegration } from "../utils/config";
import { bringToFront } from "../utils/bring-to-front";
@@ -152,6 +152,10 @@ export const osIntegrationRouter = t.router({
await rm(input);
}),
restart: t.procedure.query(() => {
app.relaunch();
app.exit();
}),
showNotification: t.procedure
.input(NotificationOptions)
.query(({ input }) => {
@@ -191,7 +195,10 @@ export const osIntegrationRouter = t.router({
({ input: { theme, windowControlsIconColor, backgroundColor } }) => {
if (windowControlsIconColor) {
config.windowControlsIconColor = windowControlsIconColor;
if (process.platform === "win32")
if (
process.platform === "win32" &&
!config.desktopSettings.nativeTitlebar
)
globalThis.window?.setTitleBarOverlay({
symbolColor: windowControlsIconColor
});

View File

@@ -0,0 +1,143 @@
/*
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 type { Database, Statement } from "better-sqlite3-multiple-ciphers";
import type { QueryResult } from "kysely";
type SQLiteCompatibleType =
| number
| string
| Uint8Array
| Array<number>
| bigint
| null;
export class SQLite {
sqlite?: Database;
initialized = false;
preparedStatements: Map<string, Statement<unknown[]>> = new Map();
retryCounter: Record<string, number> = {};
constructor() {
console.log("new sqlite worker");
}
async open(filePath: string) {
if (this.sqlite) {
console.error("Database is already initialized");
return;
}
this.sqlite = require("better-sqlite3-multiple-ciphers")(
filePath
).unsafeMode(true);
}
/**
* Wrapper function for preparing SQL statements with caching
* to avoid unnecessary computations.
*/
async prepare(sql: string): Promise<Statement | undefined> {
if (!this.sqlite) throw new Error("Database is not initialized.");
try {
const cached = this.preparedStatements.get(sql);
if (cached !== undefined) return cached;
const prepared = this.sqlite.prepare(sql);
if (!prepared) return;
this.preparedStatements.set(sql, prepared);
// reset retry count on success
this.retryCounter[sql] = 0;
return prepared;
} catch (ex) {
console.error(ex);
// statement prepare process can be flaky so retry at least 5 times
// before giving up.
if (this.retryCounter[sql] < 5) {
this.retryCounter[sql] = (this.retryCounter[sql] || 0) + 1;
console.warn("Failed to prepare statement. Retrying:", sql);
return this.prepare(sql);
} else this.retryCounter[sql] = 0;
if (ex instanceof Error) ex.message += ` (query: ${sql})`;
throw ex;
}
}
async exec<R>(
sql: string,
parameters: SQLiteCompatibleType[] = []
): Promise<QueryResult<R>> {
const prepared = await this.prepare(sql);
if (!prepared) return { rows: [] };
try {
if (prepared.reader) {
return {
rows: prepared.all(parameters) as R[]
};
} else {
const { changes, lastInsertRowid } = prepared.run(parameters);
const numAffectedRows =
changes !== undefined && changes !== null && !isNaN(changes)
? BigInt(changes)
: undefined;
return {
numAffectedRows,
insertId:
lastInsertRowid !== undefined && lastInsertRowid !== null
? typeof lastInsertRowid === "bigint"
? lastInsertRowid
: BigInt(lastInsertRowid)
: undefined,
rows: [] as R[]
};
}
} catch (e) {
if (e instanceof Error) e.message += ` (query: ${sql})`;
throw e;
}
}
async run<R>(
sql: string,
parameters?: SQLiteCompatibleType[]
): Promise<QueryResult<R>> {
if (!this.sqlite) throw new Error("No database is not opened.");
return await this.exec(sql, parameters);
}
async close() {
if (!this.sqlite) return;
this.preparedStatements.clear();
this.sqlite.close();
this.sqlite = undefined;
}
async delete(filePath: string) {
await this.close();
await require("fs/promises").rm(filePath, {
force: true,
maxRetries: 5,
retryDelay: 500
});
}
}

View File

@@ -61,7 +61,18 @@ export const updaterRouter = t.router({
"update-not-available"
),
onAvailable: createSubscription<"update-available", UpdateInfo>(
"update-available"
"update-available",
() => {
if (!config.automaticUpdates) return false;
autoUpdater.emit("download-progress", {
bytesPerSecond: 0,
delta: 0,
percent: 0,
total: 100,
transferred: 0
});
return true;
}
),
onError: createSubscription("error")
});
@@ -69,10 +80,11 @@ export const updaterRouter = t.router({
function createSubscription<
TName extends keyof AppUpdaterEvents,
TReturnType = Parameters<AppUpdaterEvents[TName]>[0]
>(eventName: TName) {
>(eventName: TName, handler?: (args: TReturnType) => boolean) {
return t.procedure.subscription(() => {
return observable<TReturnType>((emit) => {
const listener: AppUpdaterEvents[TName] = (...args: any[]) => {
if (handler?.(args[0])) return;
emit.next(args[0]);
};
autoUpdater.removeAllListeners(eventName);

View File

@@ -21,3 +21,4 @@ export * from "./constants";
export type { AppRouter } from "./api";
export { type UpdateInfo } from "builder-util-runtime";
export { type DesktopIntegration } from "./utils/config";
export { SQLite } from "./api/sqlite-kysely.js";

View File

@@ -84,22 +84,27 @@ async function createWindow() {
format: process.platform === "win32" ? "ico" : "png"
}),
titleBarStyle: "hidden",
frame: process.platform === "win32" || process.platform === "darwin",
titleBarOverlay: {
height: 37,
color: "#00000000",
symbolColor: config.windowControlsIconColor
},
trafficLightPosition: {
x: 16,
y: 12
},
...(config.desktopSettings.nativeTitlebar
? {}
: {
titleBarStyle: "hidden",
frame: process.platform === "win32" || process.platform === "darwin",
titleBarOverlay: {
height: 37,
color: "#00000000",
symbolColor: config.windowControlsIconColor
},
trafficLightPosition: {
x: 16,
y: 12
}
}),
webPreferences: {
zoomFactor: config.zoomFactor,
nodeIntegration: true,
contextIsolation: false,
nodeIntegrationInWorker: true,
spellcheck: config.isSpellCheckerEnabled,
preload: __dirname + "/preload.js"
}

View File

@@ -23,13 +23,11 @@ import { type RendererGlobalElectronTRPC } from "electron-trpc/src/types";
import type { NNCrypto } from "@notesnook/crypto";
import { ipcRenderer } from "electron";
import { platform } from "os";
import sqlite3, { Database } from "better-sqlite3-multiple-ciphers";
declare global {
var os: () => "mas" | ReturnType<typeof platform>;
var electronTRPC: RendererGlobalElectronTRPC;
var NativeNNCrypto: (new () => NNCrypto) | undefined;
var createSQLite3Database: (filename: string) => Database;
}
process.once("loaded", async () => {
@@ -43,5 +41,4 @@ process.once("loaded", async () => {
});
globalThis.NativeNNCrypto = require("@notesnook/crypto").NNCrypto;
globalThis.createSQLite3Database = (filename) => sqlite3(filename);
globalThis.os = () => (MAC_APP_STORE ? "mas" : platform());

View File

@@ -35,6 +35,7 @@ async function configureAutoUpdater() {
autoUpdater.allowDowngrade = false;
autoUpdater.allowPrerelease = false;
autoUpdater.autoInstallOnAppQuit = true;
autoUpdater.disableWebInstaller = true;
}
export { configureAutoUpdater };

View File

@@ -25,7 +25,8 @@ export const DesktopIntegration = z.object({
autoStart: z.boolean().optional(),
startMinimized: z.boolean().optional(),
minimizeToSystemTray: z.boolean().optional(),
closeToSystemTray: z.boolean().optional()
closeToSystemTray: z.boolean().optional(),
nativeTitlebar: z.boolean().optional()
});
export type DesktopIntegration = z.infer<typeof DesktopIntegration>;
@@ -35,7 +36,8 @@ export const config = {
autoStart: false,
startMinimized: false,
minimizeToSystemTray: false,
closeToSystemTray: false
closeToSystemTray: false,
nativeTitlebar: false
},
privacyMode: false,
isSpellCheckerEnabled: true,

View File

@@ -25,7 +25,6 @@ import { I18nManager, View } from "react-native";
import "react-native-gesture-handler";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { initializeLogger } from "./common/database/logger";
import AppLockedOverlay from "./components/app-lock-overlay";
import { withErrorBoundry } from "./components/exception-handler";
import GlobalSafeAreaProvider from "./components/globalsafearea";
@@ -41,35 +40,25 @@ import { useUserStore } from "./stores/use-user-store";
I18nManager.allowRTL(false);
I18nManager.forceRTL(false);
I18nManager.swapLeftAndRightInRTL(false);
const { appLockEnabled, appLockMode } = SettingsService.get();
if (appLockEnabled || appLockMode !== "none") {
useUserStore.getState().lockApp(true);
}
const App = () => {
const init = useAppEvents();
useAppEvents();
//@ts-ignore
globalThis["IS_MAIN_APP_RUNNING"] = true;
useEffect(() => {
initializeLogger()
.catch((e) => {
console.log(e);
})
.finally(() => {
const { appLockEnabled, appLockMode } = SettingsService.get();
if (appLockEnabled || appLockMode !== "none") {
useUserStore.getState().lockApp(true);
}
//@ts-ignore
globalThis["IS_MAIN_APP_RUNNING"] = true;
init();
setTimeout(async () => {
SettingsService.onFirstLaunch();
await Notifications.get();
if (SettingsService.get().notifNotes) {
Notifications.pinQuickNote(true);
}
TipManager.init();
}, 100);
});
// eslint-disable-next-line react-hooks/exhaustive-deps
SettingsService.onFirstLaunch();
setTimeout(async () => {
await Notifications.get();
if (SettingsService.get().notifNotes) {
Notifications.pinQuickNote(true);
}
TipManager.init();
}, 100);
}, []);
return (
<View
style={{

View File

@@ -25,6 +25,7 @@ import { MMKVLoader, ProcessingModes } from "react-native-mmkv-storage";
import { generateSecureRandom } from "react-native-securerandom";
import { DatabaseLogger } from ".";
import { MMKV } from "./mmkv";
import { ToastManager } from "../../services/event-manager";
// Database key cipher is persisted across different user sessions hence it has
// it's independent storage which we will never clear. This is only used when application has
@@ -208,7 +209,8 @@ export async function getDatabaseKey(appLockPassword) {
if (userKeyCredentials) {
const userKeyCipher = await encrypt(
{
key: DB_KEY
key: DB_KEY,
salt: NOTESNOOK_DB_KEY_SALT
},
userKeyCredentials.password
);
@@ -221,6 +223,7 @@ export async function getDatabaseKey(appLockPassword) {
return DB_KEY;
} catch (e) {
ToastManager.error(e, "Error getting database key");
console.log(e, "error");
DatabaseLogger.error(e);
return null;

View File

@@ -23,7 +23,9 @@ import { Platform } from "react-native";
import { setLogger } from ".";
import { RNSqliteDriver } from "./sqlite.kysely";
let loggerLoaded = false;
const initializeLogger = async () => {
if (loggerLoaded) return;
await initialize({
dialect: (name) => ({
createDriver: () => {
@@ -37,6 +39,7 @@ const initializeLogger = async () => {
journalMode: Platform.OS === "ios" ? "DELETE" : "WAL"
});
setLogger();
loggerLoaded = true;
};
export { initializeLogger };

View File

@@ -26,6 +26,7 @@ import { Platform } from "react-native";
import { IOS_APPGROUPID } from "../../utils/constants";
import { createCacheDir } from "./io";
import { getUploadedFileSize } from "./download";
import { ToastManager } from "../../services/event-manager";
export async function uploadFile(filename, data, cancelToken) {
if (!data) return false;
@@ -50,9 +51,15 @@ export async function uploadFile(filename, data, cancelToken) {
method: "PUT",
headers
});
if (!res.ok) throw new Error(`${res.status}: Unable to resolve upload url`);
const uploadUrl = await res.text();
if (!uploadUrl) throw new Error("Unable to resolve attachment upload url");
const uploadUrl = res.ok ? await res.text() : await res.json();
if (typeof uploadUrl !== "string") {
throw new Error(
uploadUrl.error || "Unable to resolve attachment upload url."
);
}
let uploadFilePath = `${cacheDir}/${filename}`;
const iosAppGroup =
@@ -125,8 +132,10 @@ export async function uploadFile(filename, data, cancelToken) {
return result;
} catch (e) {
useAttachmentStore.getState().remove(filename);
DatabaseLogger.info(`File upload error: ${filename}, ${e}`);
DatabaseLogger.error(e);
ToastManager.error(e, "File upload failed");
DatabaseLogger.error(e, "File upload failed", {
filename
});
return false;
}
}

View File

@@ -18,10 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { useCallback, useEffect, useRef } from "react";
import { AppStateStatus, Platform, TextInput, View } from "react-native";
import {
AppStateStatus,
Platform,
TextInput,
useWindowDimensions,
View
} from "react-native";
//@ts-ignore
import { useThemeColors } from "@notesnook/theme";
import { enabled } from "react-native-privacy-snapshot";
import { DatabaseLogger } from "../../common/database";
import {
decrypt,
@@ -47,6 +52,7 @@ import Input from "../ui/input";
import Seperator from "../ui/seperator";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
const getUser = () => {
const user = MMKV.getString("user");
@@ -87,6 +93,7 @@ const AppLockedOverlay = () => {
const appState = useAppState();
const lastAppState = useRef<AppStateStatus>(appState);
const biometricUnlockAwaitingUserInput = useRef(false);
const { height } = useWindowDimensions();
const keyboardType = useSettingStore(
(state) => state.settings.applockKeyboardType
);
@@ -121,7 +128,6 @@ const AppLockedOverlay = () => {
);
if (unlocked) {
lockApp(false);
enabled(false);
password.current = undefined;
}
biometricUnlockAwaitingUserInput.current = false;
@@ -148,7 +154,6 @@ const AppLockedOverlay = () => {
}
lockApp(false);
enabled(false);
password.current = undefined;
} else {
ToastManager.show({
@@ -163,10 +168,6 @@ const AppLockedOverlay = () => {
};
useEffect(() => {
if (appState === "active") {
enabled(false);
}
const prevState = lastAppState.current;
lastAppState.current = appState;
@@ -192,26 +193,26 @@ const AppLockedOverlay = () => {
DatabaseLogger.info("Biometric unlock request");
onUnlockAppRequested();
}
enabled(false);
} else {
SettingsService.appEnteredBackground();
if (SettingsService.get().privacyScreen) {
enabled(true);
}
}
}, [appState, onUnlockAppRequested, appLocked]);
return appLocked ? (
<View
<KeyboardAwareScrollView
style={{
backgroundColor: colors.primary.background,
width: "100%",
height: "100%",
position: "absolute",
zIndex: 999,
justifyContent: "center"
zIndex: 999
}}
contentContainerStyle={{
justifyContent: "center",
minHeight: height
}}
keyboardDismissMode="interactive"
keyboardShouldPersistTaps="handled"
>
<Toast context="local" />
<View
@@ -326,7 +327,7 @@ const AppLockedOverlay = () => {
</View>
</View>
</View>
</View>
</KeyboardAwareScrollView>
) : null;
};

View File

@@ -355,6 +355,7 @@ export const AttachmentDialog = ({ note }: { note?: Note }) => {
AttachmentDialog.present = (note?: Note) => {
presentSheet({
component: () => <AttachmentDialog note={note} />
component: () => <AttachmentDialog note={note} />,
keyboardHandlerDisabled: true
});
};

View File

@@ -17,12 +17,16 @@ 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 { useThemeColors } from "@notesnook/theme";
import React, { useEffect, useState } from "react";
import { TouchableOpacity, View, useWindowDimensions } from "react-native";
import { SheetManager } from "react-native-actions-sheet";
import { DDS } from "../../services/device-detection";
import { eSendEvent } from "../../services/event-manager";
import { useThemeColors } from "@notesnook/theme";
import Sync from "../../services/sync";
import { useSettingStore } from "../../stores/use-setting-store";
import { useUserStore } from "../../stores/use-user-store";
import { eUserLoggedIn } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
import SheetProvider from "../sheet-provider";
@@ -34,11 +38,6 @@ import Paragraph from "../ui/typography/paragraph";
import { hideAuth } from "./common";
import { ForgotPassword } from "./forgot-password";
import { useLogin } from "./use-login";
import { useSettingStore } from "../../stores/use-setting-store";
import { eUserLoggedIn } from "../../utils/events";
import { useUserStore } from "../../stores/use-user-store";
import Sync from "../../services/sync";
import { Notice } from "../ui/notice";
const LoginSteps = {
emailAuth: 1,
@@ -184,7 +183,11 @@ export const Login = ({ changeMode }) => {
defaultValue={email.current}
editable={step === LoginSteps.emailAuth && !loading}
onSubmit={() => {
passwordInputRef.current?.focus();
if (step === LoginSteps.emailAuth) {
login();
} else {
passwordInputRef.current?.focus();
}
}}
/>
@@ -243,6 +246,7 @@ export const Login = ({ changeMode }) => {
width: 250,
borderRadius: 100
}}
height={50}
fontSize={SIZE.md}
type="accent"
title={!loading ? "Continue" : null}

View File

@@ -37,6 +37,7 @@ import Seperator from "../ui/seperator";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
import { useCallback } from "react";
import { ScrollView } from "react-native-actions-sheet";
const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
const { colors } = useThemeColors();
@@ -143,7 +144,10 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
}, [currentMethod.method, mfaInfo.token, seconds, sending, start]);
return (
<View>
<ScrollView
keyboardShouldPersistTaps="handled"
keyboardDismissMode="interactive"
>
<View
style={{
alignItems: "center",
@@ -214,6 +218,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
code.current = value;
//onNext();
}}
onSubmitEditing={onNext}
caretHidden
inputStyle={{
fontSize: SIZE.lg,
@@ -225,6 +230,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
keyboardType={
currentMethod.method === "recoveryCode" ? "default" : "numeric"
}
enablesReturnKeyAutomatically
containerStyle={{
height: 60,
borderWidth: 0,
@@ -297,7 +303,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
</>
)}
</View>
</View>
</ScrollView>
);
};

View File

@@ -23,10 +23,7 @@ import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
import { Dialog } from "../dialog";
import { Issue } from "../sheets/github/issue";
const error = (
stack: string,
component: string
) => `Please let us know what happened. What steps we can take to reproduce the issue here.
const error = (stack: string, component: string) => `
_______________________________
Stacktrace: In ${component}::${stack}`;
@@ -39,9 +36,9 @@ class ExceptionHandler extends React.Component<{
error: Error | null;
hasError: boolean;
} = {
hasError: false,
error: null
};
hasError: false,
error: null
};
static getDerivedStateFromError(error: Error) {
return { hasError: true, error: error };
}

View File

@@ -49,7 +49,8 @@ export const Card = ({ color }: { color?: string }) => {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: 0
paddingHorizontal: 0,
width: "100%"
}}
>
<View
@@ -91,7 +92,6 @@ export const Card = ({ color }: { color?: string }) => {
<View
style={{
marginLeft: 10,
flexShrink: 1,
marginRight: 10
}}
>

View File

@@ -18,35 +18,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Debug } from "@notesnook/core/dist/api/debug";
import { getModel, getBrand, getSystemVersion } from "react-native-device-info";
import { useThemeColors } from "@notesnook/theme";
import Clipboard from "@react-native-clipboard/clipboard";
import React, { useRef, useState } from "react";
import { Linking, Platform, Text, TextInput, View } from "react-native";
import { getVersion } from "react-native-device-info";
import { useStoredRef } from "../../../hooks/use-stored-ref";
import { ToastManager, eSendEvent } from "../../../services/event-manager";
import { ToastManager } from "../../../services/event-manager";
import PremiumService from "../../../services/premium";
import { useUserStore } from "../../../stores/use-user-store";
import { eCloseSheet } from "../../../utils/events";
import { openLinkInBrowser } from "../../../utils/functions";
import { SIZE } from "../../../utils/size";
import { sleep } from "../../../utils/time";
import DialogHeader from "../../dialog/dialog-header";
import { presentDialog } from "../../dialog/functions";
import { Button } from "../../ui/button";
import Seperator from "../../ui/seperator";
import Heading from "../../ui/typography/heading";
import Paragraph from "../../ui/typography/paragraph";
export const Issue = ({ defaultTitle, defaultBody, issueTitle }) => {
const { colors } = useThemeColors();
const body = useStoredRef("issueBody", defaultBody);
const body = useStoredRef("issueBody");
const title = useStoredRef("issueTitle", defaultTitle);
const [done, setDone] = useState(false);
const user = useUserStore((state) => state.user);
const [loading, setLoading] = useState(false);
const bodyRef = useRef();
const initialLayout = useRef(false);
const issueUrl = useRef();
const onPress = async () => {
if (loading) return;
@@ -56,57 +54,24 @@ export const Issue = ({ defaultTitle, defaultBody, issueTitle }) => {
try {
setLoading(true);
let issue_url = await Debug.report({
issueUrl.current = await Debug.report({
title: title.current,
body:
body.current +
`\n${defaultBody || ""}` +
`\n_______________
**Device information:**
App version: ${getVersion()}
Platform: ${Platform.OS}
Model: ${Platform.constants.Brand || ""}-${Platform.constants.Model || ""}-${
Platform.constants.Version || ""
}
Device: ${getBrand() || ""}-${getModel() || ""}-${getSystemVersion() || ""}
Pro: ${PremiumService.get()}
Logged in: ${user ? "yes" : "no"}`,
userId: user?.id
});
setLoading(false);
eSendEvent(eCloseSheet);
body.reset();
title.reset();
await sleep(300);
presentDialog({
title: "Issue reported",
paragraph: (
<Text>
You can track your issue at{" "}
<Text
style={{
textDecorationLine: "underline",
color: colors.primary.accent
}}
onPress={() => {
Linking.openURL(issue_url);
}}
>
{issue_url}.
</Text>{" "}
Please note that we will respond to your issue on the given link. We
recommend that you save it.
</Text>
),
positiveText: "Copy link",
positivePress: () => {
Clipboard.setString(issue_url);
ToastManager.show({
heading: "Issue url copied!",
type: "success",
context: "global"
});
},
negativeText: "Close"
});
setDone(true);
} catch (e) {
setLoading(false);
ToastManager.show({
@@ -124,125 +89,177 @@ Logged in: ${user ? "yes" : "no"}`,
width: "100%"
}}
>
<DialogHeader
title={issueTitle || "Report issue"}
paragraph={
issueTitle
? "We are sorry, it seems that the app crashed due to an error. You can submit a bug report below so we can fix this asap."
: "Let us know if you have faced any issue/bug while using Notesnook."
}
/>
{done ? (
<>
<View
style={{
height: 250,
justifyContent: "center",
alignItems: "center",
gap: 10
}}
>
<Heading>Issue submitted</Heading>
<Paragraph
style={{
textAlign: "center"
}}
selectable={true}
>
You can track your issue at{" "}
<Paragraph
style={{
textDecorationLine: "underline",
color: colors.primary.accent
}}
onPress={() => {
Linking.openURL(issueUrl.current);
}}
>
{issueUrl.current}
</Paragraph>
. Please note that we will respond to your issue on the given
link. We recommend that you save it.
</Paragraph>
<Seperator half />
<TextInput
placeholder="Title"
onChangeText={(v) => (title.current = v)}
defaultValue={title.current}
style={{
borderWidth: 1,
borderColor: colors.primary.border,
borderRadius: 5,
padding: 12,
fontFamily: "OpenSans-Regular",
marginBottom: 10,
fontSize: SIZE.md,
color: colors.primary.heading
}}
placeholderTextColor={colors.primary.placeholder}
/>
<TextInput
ref={bodyRef}
placeholder={`Tell us more about the issue you are facing.
For example:
- Steps to reproduce the issue
- Things you have tried etc.`}
multiline
numberOfLines={5}
textAlignVertical="top"
onChangeText={(v) => (body.current = v)}
onLayout={() => {
if (initialLayout.current) return;
initialLayout.current = true;
if (body.current) {
bodyRef.current?.setNativeProps({
text: body.current,
selection: {
start: 0,
end: 0
}
});
}
}}
style={{
borderWidth: 1,
borderColor: colors.primary.border,
borderRadius: 5,
padding: 12,
fontFamily: "OpenSans-Regular",
maxHeight: 200,
fontSize: SIZE.sm,
marginBottom: 2.5,
color: colors.primary.paragraph
}}
placeholderTextColor={colors.primary.placeholder}
/>
<Paragraph
size={SIZE.xs}
color={colors.secondary.paragraph}
>{`App version: ${getVersion()} Platform: ${Platform.OS} Model: ${
Platform.constants.Brand
}-${Platform.constants.Model}-${Platform.constants.Version}`}</Paragraph>
<Seperator />
<Button
onPress={onPress}
title={loading ? null : "Submit"}
loading={loading}
width="100%"
type="accent"
/>
<Paragraph
color={colors.secondary.paragraph}
size={SIZE.xs}
style={{
marginTop: 10,
textAlign: "center"
}}
>
The information above will be publically available at{" "}
<Text
onPress={() => {
Linking.openURL("https://github.com/streetwriters/notesnook");
}}
style={{
textDecorationLine: "underline",
color: colors.primary.accent
}}
>
github.com/streetwriters/notesnook.
</Text>{" "}
If you want to ask something in general or need some assistance, we
would suggest that you{" "}
<Text
style={{
textDecorationLine: "underline",
color: colors.primary.accent
}}
onPress={async () => {
try {
await openLinkInBrowser("https://discord.gg/zQBK97EE22", colors);
} catch (e) {
console.error(e);
<Button
title="Open issue"
onPress={() => {
Linking.openURL(issueUrl.current);
}}
type="accent"
width="100%"
/>
</View>
</>
) : (
<>
<DialogHeader
title={issueTitle || "Report issue"}
paragraph={
issueTitle
? "We are sorry, it seems that the app crashed due to an error. You can submit a bug report below so we can fix this asap."
: "Let us know if you have faced any issue/bug while using Notesnook."
}
}}
>
join our community on Discord.
</Text>
</Paragraph>
/>
<Seperator half />
<TextInput
placeholder="Title"
onChangeText={(v) => (title.current = v)}
defaultValue={title.current}
style={{
borderWidth: 1,
borderColor: colors.primary.border,
borderRadius: 5,
padding: 12,
fontFamily: "OpenSans-Regular",
marginBottom: 10,
fontSize: SIZE.md,
color: colors.primary.heading
}}
placeholderTextColor={colors.primary.placeholder}
/>
<TextInput
ref={bodyRef}
multiline
placeholder={`Tell us more about the issue you are facing.
For example:
- What were you trying to do in the app?
- What did you expect to happen?
- Steps to reproduce the issue
- Things you have tried etc.`}
numberOfLines={5}
textAlignVertical="top"
onChangeText={(v) => (body.current = v)}
onLayout={() => {
if (initialLayout.current) return;
initialLayout.current = true;
if (body.current) {
bodyRef.current?.setNativeProps({
text: body.current,
selection: {
start: 0,
end: 0
}
});
}
}}
style={{
borderWidth: 1,
borderColor: colors.primary.border,
borderRadius: 5,
padding: 12,
fontFamily: "OpenSans-Regular",
maxHeight: 200,
fontSize: SIZE.sm,
marginBottom: 2.5,
color: colors.primary.paragraph
}}
placeholderTextColor={colors.primary.placeholder}
/>
<Paragraph
size={SIZE.xs}
color={colors.secondary.paragraph}
>{`App version: ${getVersion()} Platform: ${
Platform.OS
} Model: ${getBrand()}-${getModel()}-${getSystemVersion()}`}</Paragraph>
<Seperator />
<Button
onPress={onPress}
title={loading ? null : "Submit"}
loading={loading}
width="100%"
type="accent"
/>
<Paragraph
color={colors.secondary.paragraph}
size={SIZE.xs}
style={{
marginTop: 10,
textAlign: "center"
}}
>
The information above will be publically available at{" "}
<Text
onPress={() => {
Linking.openURL("https://github.com/streetwriters/notesnook");
}}
style={{
textDecorationLine: "underline",
color: colors.primary.accent
}}
>
github.com/streetwriters/notesnook.
</Text>{" "}
If you want to ask something in general or need some assistance, we
would suggest that you{" "}
<Text
style={{
textDecorationLine: "underline",
color: colors.primary.accent
}}
onPress={async () => {
try {
await openLinkInBrowser(
"https://discord.gg/zQBK97EE22",
colors
);
} catch (e) {
console.error(e);
}
}}
>
join our community on Discord.
</Text>
</Paragraph>
</>
)}
</View>
);
};

View File

@@ -42,10 +42,7 @@ import { ProgressBarComponent } from "../../ui/svg/lazy";
import Paragraph from "../../ui/typography/paragraph";
import { Issue } from "../github/issue";
export const makeError = (
stack: string,
component: string
) => `Please let us know what happened. What steps we can take to reproduce the issue here.
export const makeError = (stack: string, component: string) => `
_______________________________
Stacktrace: In ${component}::${stack}`;

View File

@@ -25,7 +25,8 @@ import {
DimensionValue,
TextStyle,
View,
ViewStyle
ViewStyle,
useWindowDimensions
} from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useUserStore } from "../../../stores/use-user-store";
@@ -92,6 +93,9 @@ export const Button = ({
});
const textColor = buttonType?.text ? buttonType.text : text;
const { fontScale } = useWindowDimensions();
const growFactor = 1 + (fontScale - 1) / 10;
const Component = bold ? Heading : Paragraph;
return (
@@ -117,8 +121,11 @@ export const Button = ({
customOpacity={buttonType?.opacity}
customAlpha={buttonType?.alpha}
style={{
height: height,
width: (width as DimensionValue) || undefined,
height: typeof height === "number" ? height * growFactor : height,
width:
typeof width === "number"
? width * growFactor
: (width as DimensionValue) || undefined,
paddingHorizontal: 12,
borderRadius: 5,
alignSelf: "center",

View File

@@ -21,11 +21,12 @@ import { VariantsWithStaticColors, useThemeColors } from "@notesnook/theme";
import React, { RefObject, useCallback } from "react";
import {
ColorValue,
PressableStateCallbackType,
Pressable as RNPressable,
PressableProps as RNPressableProps,
PressableStateCallbackType,
View,
ViewStyle
ViewStyle,
useWindowDimensions
} from "react-native";
import {
RGB_Linear_Shade,
@@ -256,6 +257,8 @@ export const Pressable = ({
? 1
: colorOpacity;
const alpha = customAlpha ? customAlpha : isDark ? 0.03 : -0.03;
const { fontScale } = useWindowDimensions();
const growFactor = 1 + (fontScale - 1) / 8;
const getStyle = useCallback(
({ pressed }: PressableStateCallbackType): ViewStyle | ViewStyle[] => [
@@ -276,7 +279,13 @@ export const Pressable = ({
: borderColor || "transparent",
borderWidth: borderWidth
},
style
style,
{
height:
typeof style.height === "number"
? style.height * growFactor
: style.height
}
],
[
alpha,
@@ -288,7 +297,8 @@ export const Pressable = ({
borderSelectedColor,
borderColor,
borderWidth,
style
style,
growFactor
]
);

View File

@@ -97,6 +97,7 @@ import {
import { getGithubVersion } from "../utils/github-version";
import { tabBarRef } from "../utils/global-refs";
import { sleep } from "../utils/time";
import { initializeLogger } from "../common/database/logger";
const onCheckSyncStatus = async (type: SyncStatusEvent) => {
const { disableSync, disableAutoSync } = SettingsService.get();
@@ -280,8 +281,108 @@ const onSubscriptionError = async (error: RNIap.PurchaseError) => {
const SodiumEventEmitter = new NativeEventEmitter(NativeModules.Sodium);
const doAppLoadActions = async () => {
if (SettingsService.get().sessionExpired) {
eSendEvent(eLoginSessionExpired);
return;
}
notifee.setBadgeCount(0);
if (!(await db.user.getUser())) {
setLoginMessage();
return;
}
await useMessageStore.getState().setAnnouncement();
if (NewFeature.present()) return;
if (await checkAppUpdateAvailable()) return;
if (await checkForRateAppRequest()) return;
if (await PremiumService.getRemainingTrialDaysStatus()) return;
if (SettingsService.get().introCompleted) {
useMessageStore.subscribe((state) => {
const dialogs = state.dialogs;
if (dialogs.length > 0) {
eSendEvent(eOpenAnnouncementDialog, dialogs[0]);
}
});
}
};
const checkAppUpdateAvailable = async () => {
if (__DEV__ || Config.isTesting === "true" || Config.FDROID_BUILD || BETA)
return;
try {
const version =
Config.GITHUB_RELEASE === "true"
? await getGithubVersion()
: await checkVersion();
if (!version || !version?.needsUpdate) return false;
setUpdateAvailableMessage(version);
return true;
} catch (e) {
return false;
}
};
const checkForRateAppRequest = async () => {
const rateApp = SettingsService.get().rateApp as number;
if (
rateApp &&
rateApp < Date.now() &&
!useMessageStore.getState().message?.visible
) {
setRateAppMessage();
return false;
}
return false;
};
const IsDatabaseMigrationRequired = () => {
if (!db.migrations.required() || useUserStore.getState().appLocked)
return false;
presentSheet({
component: <Migrate />,
onClose: () => {
if (!db.migrations.required()) {
initializeDatabase();
}
},
disableClosing: true
});
return true;
};
const initializeDatabase = async (password?: string) => {
if (useUserStore.getState().appLocked) return;
if (!db.isInitialized) {
RNBootSplash.hide({ fade: true });
DatabaseLogger.info("Initializing database");
try {
await setupDatabase(password);
await db.init();
} catch (e) {
DatabaseLogger.error(e as Error);
ToastManager.error(e as Error, "Error initializing database", "global");
}
}
if (IsDatabaseMigrationRequired()) return;
if (db.isInitialized) {
Notifications.setupReminders(true);
if (SettingsService.get().notifNotes) {
Notifications.pinQuickNote(false);
}
useSettingStore.getState().setAppLoading(false);
DatabaseLogger.info("Database initialized");
}
Walkthrough.init();
};
export const useAppEvents = () => {
const loading = useSettingStore((state) => state.isAppLoading);
const isAppLoading = useSettingStore((state) => state.isAppLoading);
const [setLastSynced, setUser, appLocked, syncing] = useUserStore((state) => [
state.setLastSynced,
state.setUser,
@@ -312,7 +413,7 @@ export const useAppEvents = () => {
}, [setLastSynced]);
useEffect(() => {
if (loading) return;
if (isAppLoading) return;
let subscriptions: EventManagerSubscription[] = [];
const eventManager = db.eventManager;
@@ -327,7 +428,7 @@ export const useAppEvents = () => {
return () => {
subscriptions.forEach((sub) => sub?.unsubscribe?.());
};
}, [loading, onSyncComplete]);
}, [isAppLoading, onSyncComplete]);
const subscribeToPurchaseListeners = useCallback(async () => {
if (Platform.OS === "android") {
@@ -572,7 +673,7 @@ export const useAppEvents = () => {
});
}
let sub: NativeEventSubscription;
if (!loading && !appLocked) {
if (!isAppLoading && !appLocked) {
setTimeout(() => {
sub = AppState.addEventListener("change", onAppStateChanged);
if (
@@ -594,7 +695,7 @@ export const useAppEvents = () => {
sub?.remove();
unsubscribePurchaseListeners();
};
}, [loading, appLocked, checkAutoBackup]);
}, [isAppLoading, appLocked, checkAutoBackup]);
useEffect(() => {
if (!appLocked && !syncing && refValues.current.backupDidWait) {
@@ -643,127 +744,22 @@ export const useAppEvents = () => {
}
useEffect(() => {
if (!loading) {
if (!isAppLoading) {
onUserUpdated();
doAppLoadActions();
}
}, [loading, onUserUpdated]);
const initializeDatabase = useCallback(async (password?: string) => {
const IsDatabaseMigrationRequired = () => {
if (!db.migrations.required() || useUserStore.getState().appLocked)
return false;
presentSheet({
component: <Migrate />,
onClose: () => {
if (!db.migrations.required()) {
initializeDatabase();
}
},
disableClosing: true
});
return true;
};
if (useUserStore.getState().appLocked) return;
if (!db.isInitialized) {
RNBootSplash.hide({ fade: true });
DatabaseLogger.info("Initializing database");
try {
await setupDatabase(password);
await db.init();
} catch (e) {
DatabaseLogger.error(e as Error);
ToastManager.error(e as Error, "Error initializing database", "global");
}
}
if (IsDatabaseMigrationRequired()) return;
if (db.isInitialized) {
Notifications.setupReminders(true);
if (SettingsService.get().notifNotes) {
Notifications.pinQuickNote(false);
}
useSettingStore.getState().setAppLoading(false);
DatabaseLogger.info("Database initialized");
}
Walkthrough.init();
}, []);
}, [isAppLoading, onUserUpdated]);
useEffect(() => {
let sub: () => void;
if (appLocked) {
const sub = useUserStore.subscribe((state) => {
if (!state.appLocked && useSettingStore.getState().isAppLoading) {
console.log("DB initialized");
if (!appLocked && isAppLoading) {
initializeLogger()
.catch((e) => {
console.log(e);
})
.finally(() => {
//@ts-ignore
initializeDatabase();
sub();
}
});
});
}
return () => {
sub?.();
};
}, [appLocked, initializeDatabase]);
return initializeDatabase;
};
const doAppLoadActions = async () => {
if (SettingsService.get().sessionExpired) {
eSendEvent(eLoginSessionExpired);
return;
}
notifee.setBadgeCount(0);
if (!(await db.user.getUser())) {
setLoginMessage();
return;
}
await useMessageStore.getState().setAnnouncement();
if (NewFeature.present()) return;
if (await checkAppUpdateAvailable()) return;
if (await checkForRateAppRequest()) return;
if (await PremiumService.getRemainingTrialDaysStatus()) return;
if (SettingsService.get().introCompleted) {
useMessageStore.subscribe((state) => {
const dialogs = state.dialogs;
if (dialogs.length > 0) {
eSendEvent(eOpenAnnouncementDialog, dialogs[0]);
}
});
}
};
const checkAppUpdateAvailable = async () => {
if (__DEV__ || Config.isTesting === "true" || Config.FDROID_BUILD || BETA)
return;
try {
const version =
Config.GITHUB_RELEASE === "true"
? await getGithubVersion()
: await checkVersion();
if (!version || !version?.needsUpdate) return false;
setUpdateAvailableMessage(version);
return true;
} catch (e) {
return false;
}
};
const checkForRateAppRequest = async () => {
const rateApp = SettingsService.get().rateApp as number;
if (
rateApp &&
rateApp < Date.now() &&
!useMessageStore.getState().message?.visible
) {
setRateAppMessage();
return false;
}
return false;
}, [appLocked, isAppLoading]);
};

View File

@@ -62,7 +62,6 @@ import {
} from "../services/event-manager";
import { useSettingStore } from "../stores/use-setting-store";
import {
eClearEditor,
eCloseFullscreenEditor,
eOnEnterEditor,
eOnExitEditor,
@@ -286,9 +285,10 @@ const _TabsHolder = () => {
break;
case "mobile":
if (
state &&
!state?.movedAway &&
useTabStore.getState().getCurrentNoteId()
(state &&
!state?.movedAway &&
useTabStore.getState().getCurrentNoteId()) ||
editorState().movedAway === false
) {
tabBarRef.current?.goToIndex(2, false);
} else {

View File

@@ -16,7 +16,7 @@
"html-to-text": "9.0.5",
"phone": "^3.1.14",
"qclone": "^1.2.0",
"react-native-actions-sheet": "0.9.3",
"react-native-actions-sheet": "0.9.6",
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
"react-native-drax": "^0.10.2",
"react-native-image-zoom-viewer": "^3.0.1",

View File

@@ -185,7 +185,8 @@ const camera = async (options: PickerOptions) => {
cropping: false,
multiple: true,
maxFiles: 10,
writeTempFile: true
writeTempFile: true,
compressImageQuality: 1
})
.then((response) => {
handleImageResponse(
@@ -215,7 +216,8 @@ const gallery = async (options: PickerOptions) => {
mediaType: "photo",
maxFiles: 10,
cropping: false,
multiple: true
multiple: true,
compressImageQuality: 1
})
.then((response) =>
handleImageResponse(
@@ -266,7 +268,6 @@ const handleImageResponse = async (
response: Image[],
options: PickerOptions
) => {
console.log(response, "result-file-picker");
const result = await AttachImage.present(response, options.context);
if (!result) return;
const compress = result.compress;
@@ -302,10 +303,15 @@ const handleImageResponse = async (
type: "url"
});
const fileName = image.sourceURL
let fileName = image.sourceURL
? basename(image.sourceURL)
: image.filename || "image";
fileName =
image.mime === "image/jpeg"
? fileName.replace(/HEIC|HEIF/, "jpeg")
: fileName;
console.log("attaching image...", fileName);
console.log("attaching file...");

View File

@@ -569,7 +569,7 @@ export const useEditor = (
return;
}
lastContentChangeTime.current[item.id] = item.dateEdited;
lastContentChangeTime.current[item.id] = 0;
currentLoadingNoteId.current = item.id;
currentNotes.current[item.id] = item;

View File

@@ -70,6 +70,7 @@ import { useDragState } from "./editor/state";
import { verifyUser, verifyUserWithApplock } from "./functions";
import { SettingSection } from "./types";
import { getTimeLeft } from "./user-section";
import ScreenGuardModule from "react-native-screenguard";
type User = any;
@@ -333,12 +334,14 @@ export const settingsGroups: SettingSection[] = [
{
id: "logout",
name: "Log out",
description: "Clear all your data and reset the app.",
description:
"Logging out will clear all data stored on THIS DEVICE.",
icon: "logout",
modifer: () => {
presentDialog({
title: "Logout",
paragraph: "Clear all your data and reset the app.",
paragraph:
"Logging out will clear all data stored on THIS DEVICE. Make sure you have synced all your changes before logging out.",
positiveText: "Logout",
positivePress: async () => {
try {
@@ -472,7 +475,7 @@ export const settingsGroups: SettingSection[] = [
{
id: "pull-sync",
name: "Force pull changes",
description: `Use this if some changes are not appearing on this device from other devices. This will pull everything from the server and overwrite with whatever is one this device.\n\nThese must only be used for troubleshooting. Using them regularly for sync is not recommended and will lead to unexpected data loss and other issues. If you are having persistent issues with sync, please report them to us at support@streetwriters.co.`,
description: `Use this if changes from other devices are not appearing on this device. This will overwrite the data on this device with the latest data from the server.\n\nThis must only be used for troubleshooting. Using it regularly for sync is not recommended and will lead to unexpected data loss and other issues. If you are having persistent issues with sync, please report them to us at support@streetwriters.co.`,
modifer: () => {
presentDialog({
title: "Force Pull changes",
@@ -494,7 +497,7 @@ export const settingsGroups: SettingSection[] = [
{
id: "push-sync",
name: "Force push changes",
description: `Use this if some changes are not appearing on this device from other devices. This will pull everything from the server and overwrite with whatever is one this device.`,
description: `Use this if changes made on this device are not appearing on other devices. This will overwrite the data on the server with the data from this device.\n\nThis must only be used for troubleshooting. Using it regularly for sync is not recommended and will lead to unexpected data loss and other issues. If you are having persistent issues with sync, please report them to us at support@streetwriters.co.`,
modifer: () => {
presentDialog({
title: "Force Push changes",
@@ -848,9 +851,18 @@ export const settingsGroups: SettingSection[] = [
"Hide app contents when you switch to other apps. This will also disable screenshot taking in the app.",
modifer: () => {
const settings = SettingsService.get();
Platform.OS === "android"
? NotesnookModule.setSecureMode(!settings.privacyScreen)
: enabled(true);
if (Platform.OS === "ios") {
enabled(!settings.privacyScreen);
if (settings.privacyScreen) {
ScreenGuardModule.unregister();
} else {
ScreenGuardModule.register({
backgroundColor: "#000000"
});
}
} else {
NotesnookModule.setSecureMode(!settings.privacyScreen);
}
SettingsService.set({ privacyScreen: !settings.privacyScreen });
},

View File

@@ -141,7 +141,6 @@ const onBoot = async () => {
}
await Notifications.setupReminders();
SettingsService.init();
if (SettingsService.get().notifNotes) {
Notifications.pinQuickNote(false);
}

View File

@@ -171,7 +171,6 @@ async function run(progress = false, context) {
}
let path;
let backupFilePath;
let backupFileName = "notesnook_backup_" + Date.now();
if (Platform.OS === "ios") {
@@ -236,7 +235,7 @@ async function run(progress = false, context) {
await sleep(300);
if (showBackupCompleteSheet) {
presentBackupCompleteSheet(backupFilePath);
presentBackupCompleteSheet(path);
} else {
progress && eSendEvent(eCloseSheet);
}

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 { Platform } from "react-native";
import { NativeModules, Platform } from "react-native";
import { enabled } from "react-native-privacy-snapshot";
import { MMKV } from "../common/database/mmkv";
import {
@@ -29,6 +29,7 @@ import { NotesnookModule } from "../utils/notesnook-module";
import { scale, updateSize } from "../utils/size";
import { DatabaseLogger } from "../common/database";
import { useUserStore } from "../stores/use-user-store";
import ScreenGuardModule from "react-native-screenguard";
function reset() {
const settings = get();
if (settings.reminder !== "off" && settings.reminder !== "useroff") {
@@ -117,12 +118,18 @@ function setPrivacyScreen(settings: SettingStore["settings"]) {
NotesnookModule.setSecureMode(true);
} else {
enabled(true);
if (NativeModules.ScreenGuard) {
ScreenGuardModule.register({ backgroundColor: "#000000" });
}
}
} else {
if (Platform.OS === "android") {
NotesnookModule.setSecureMode(false);
} else {
enabled(false);
if (NativeModules.ScreenGuard) {
ScreenGuardModule.unregister();
}
}
}
}

View File

@@ -17,8 +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 { Profile } from "@notesnook/core";
import { User } from "@notesnook/core";
import { Profile, User } from "@notesnook/core";
import create, { State } from "zustand";
export enum SyncStatus {
@@ -56,7 +55,9 @@ export const useUserStore = create<UserStore>((set) => ({
set({ syncing: syncing, lastSyncStatus: status });
},
setLastSynced: (lastSynced) => set({ lastSynced: lastSynced }),
lockApp: (appLocked) => set({ appLocked }),
lockApp: (appLocked) => {
set({ appLocked });
},
lastSyncStatus: SyncStatus.Never,
disableAppLockRequests: false,
setDisableAppLockRequests: (disableAppLockRequests) => {

View File

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

View File

@@ -21,9 +21,9 @@
6517B7C32B6838EB0079FF37 /* OpenSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7C02B6838EB0079FF37 /* OpenSans-Bold.ttf */; };
6529A13E279BC4C70048D4A8 /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6529A13D279BC4C70048D4A8 /* BootSplash.storyboard */; };
656835812BB29A9800144BAB /* OpenSans-Italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 656835802BB29A8300144BAB /* OpenSans-Italic.ttf */; };
656DD2AB2B1891DF00A362EA /* BuildFile in Resources */ = {isa = PBXBuildFile; };
656DD2AC2B1891DF00A362EA /* BuildFile in Resources */ = {isa = PBXBuildFile; };
656DD2AD2B1891DF00A362EA /* BuildFile in Resources */ = {isa = PBXBuildFile; };
6569927F2C5754F10041CD41 /* OpenSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7C02B6838EB0079FF37 /* OpenSans-Bold.ttf */; };
656992802C5754F10041CD41 /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7BE2B6838EB0079FF37 /* OpenSans-Regular.ttf */; };
656992812C5754F10041CD41 /* OpenSans-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7BF2B6838EB0079FF37 /* OpenSans-SemiBold.ttf */; };
6593E4A3281C345400492C50 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6593E4A2281C345400492C50 /* AppDelegate.mm */; };
659BE46725E11A5100E05671 /* notesnook-text.png in Resources */ = {isa = PBXBuildFile; fileRef = 659BE46625E11A5100E05671 /* notesnook-text.png */; };
65AA857925E6DDEC00772A01 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65AA857825E6DDEC00772A01 /* WidgetKit.framework */; };
@@ -586,9 +586,9 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
656DD2AB2B1891DF00A362EA /* BuildFile in Resources */,
656DD2AC2B1891DF00A362EA /* BuildFile in Resources */,
656DD2AD2B1891DF00A362EA /* BuildFile in Resources */,
6569927F2C5754F10041CD41 /* OpenSans-Bold.ttf in Resources */,
656992802C5754F10041CD41 /* OpenSans-Regular.ttf in Resources */,
656992812C5754F10041CD41 /* OpenSans-SemiBold.ttf in Resources */,
65C400DF2A80B6B600AA3DF5 /* MaterialCommunityIcons.ttf in Resources */,
65C149872A61151B005C40F1 /* extension.bundle in Resources */,
65B5014725A672B200E2D264 /* MainInterface.storyboard in Resources */,
@@ -1015,7 +1015,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2104;
CURRENT_PROJECT_VERSION = 2109;
DEVELOPMENT_TEAM = 53CWBG3QUC;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
@@ -1084,12 +1084,12 @@
"${PODS_ROOT}/Headers/Public/#{s.name}/**",
);
INFOPLIST_FILE = Notesnook/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.7;
MARKETING_VERSION = 3.0.12;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@@ -1120,7 +1120,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2104;
CURRENT_PROJECT_VERSION = 2109;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
@@ -1189,12 +1189,12 @@
"${PODS_ROOT}/Headers/Public/#{s.name}/**",
);
INFOPLIST_FILE = Notesnook/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.7;
MARKETING_VERSION = 3.0.12;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = (
"$(inherited)",
@@ -1353,7 +1353,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2104;
CURRENT_PROJECT_VERSION = 2109;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 53CWBG3QUC;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
@@ -1365,7 +1365,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.0.7;
MARKETING_VERSION = 3.0.12;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.notewidget;
@@ -1396,7 +1396,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2104;
CURRENT_PROJECT_VERSION = 2109;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
@@ -1409,7 +1409,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.0.7;
MARKETING_VERSION = 3.0.12;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.notewidget;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1439,7 +1439,7 @@
CODE_SIGN_ENTITLEMENTS = "Make Note/Make Note.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2104;
CURRENT_PROJECT_VERSION = 2109;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 53CWBG3QUC;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
@@ -1513,7 +1513,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.0.7;
MARKETING_VERSION = 3.0.12;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
@@ -1544,7 +1544,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2104;
CURRENT_PROJECT_VERSION = 2109;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
@@ -1619,7 +1619,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.0.7;
MARKETING_VERSION = 3.0.12;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -343,6 +343,9 @@ PODS:
- React-Core
- react-native-safe-area-context (4.9.0):
- React-Core
- react-native-screenguard (1.0.0):
- React-Core
- SDWebImage (~> 5.11.1)
- react-native-share-extension (3.0.0):
- React
- react-native-sodium (1.5.4):
@@ -548,6 +551,9 @@ PODS:
- RNZipArchive/Core (6.0.9):
- React-Core
- SSZipArchive (~> 2.2)
- SDWebImage (5.11.1):
- SDWebImage/Core (= 5.11.1)
- SDWebImage/Core (5.11.1)
- SexyTooltip (1.2.5):
- pop (~> 1.0)
- SocketRocket (0.6.0)
@@ -606,6 +612,7 @@ DEPENDENCIES:
- react-native-pdf (from `../../node_modules/react-native-pdf`)
- react-native-quick-sqlite (from `../../node_modules/react-native-quick-sqlite`)
- react-native-safe-area-context (from `../../node_modules/react-native-safe-area-context`)
- react-native-screenguard (from `../../node_modules/react-native-screenguard`)
- "react-native-share-extension (from `../../node_modules/@ammarahmed/react-native-share-extension`)"
- "react-native-sodium (from `../../node_modules/@ammarahmed/react-native-sodium`)"
- react-native-theme-switch-animation (from `../../node_modules/react-native-theme-switch-animation`)
@@ -664,6 +671,7 @@ SPEC REPOS:
- MMKV
- MMKVCore
- pop
- SDWebImage
- SocketRocket
- SSZipArchive
- SwiftyRSA
@@ -754,6 +762,8 @@ EXTERNAL SOURCES:
:path: "../../node_modules/react-native-quick-sqlite"
react-native-safe-area-context:
:path: "../../node_modules/react-native-safe-area-context"
react-native-screenguard:
:path: "../../node_modules/react-native-screenguard"
react-native-share-extension:
:path: "../../node_modules/@ammarahmed/react-native-share-extension"
react-native-sodium:
@@ -905,6 +915,7 @@ SPEC CHECKSUMS:
react-native-pdf: 33c622cbdf776a649929e8b9d1ce2d313347c4fa
react-native-quick-sqlite: e0e23b749382a85e4b57146f753de737a6c3a9e1
react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b
react-native-screenguard: 8b36a3df84c76cd2b82c477f71c26fa1c8cc14a0
react-native-share-extension: faed334b1ddf165f1e576fcabd3dc1c9e748bfa9
react-native-sodium: 955bb0dc3ea05f8ea06d5e96cb89d1be7b5d7681
react-native-theme-switch-animation: 220f883f7be290e79f2ab022093ed1a7a5929e6d
@@ -949,6 +960,7 @@ SPEC CHECKSUMS:
RNSVG: d7d7bc8229af3842c9cfc3a723c815a52cdd1105
RNTooltips: 5424d4bf0b3d441104127943b1115cc7f0616b1f
RNZipArchive: 68a0c6db4b1c103f846f1559622050df254a3ade
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SexyTooltip: 5c9b4dec52bfb317938cb0488efd9da3717bb6fd
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef

View File

@@ -66,7 +66,8 @@
"react-native-theme-switch-animation": "^0.6.0",
"@ammarahmed/react-native-background-fetch": "^4.2.2",
"react-native-image-crop-picker": "^0.40.2",
"react-native-url-polyfill": "^2.0.0"
"react-native-url-polyfill": "^2.0.0",
"react-native-screenguard": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",

View File

@@ -17,6 +17,12 @@ config.dependencies['react-native-vector-icons'] = {
},
}
config.dependencies['react-native-screenguard'] = {
platforms: {
android: null,
},
}
if (isGithubRelease) {
config.dependencies["react-native-iap"] = {
platforms: {

View File

@@ -1,12 +1,12 @@
{
"name": "@notesnook/mobile",
"version": "3.0.4",
"version": "3.0.11",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@notesnook/mobile",
"version": "3.0.4",
"version": "3.0.11",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"workspaces": [
@@ -34,15 +34,15 @@
},
"../../packages/common": {
"name": "@notesnook/common",
"version": "1.0.0",
"version": "2.0.7",
"license": "GPL-3.0-or-later",
"dependencies": {
"@notesnook/core": "file:../core",
"@notesnook/core": "^8.0.0",
"pathe": "^1.1.2",
"timeago.js": "4.0.2"
},
"devDependencies": {
"@notesnook/core": "file:../core",
"@notesnook/core": "^8.0.0",
"@types/react": "^18.2.39",
"react": "18.2.0",
"vitest": "^1.4.0"
@@ -114,7 +114,7 @@
},
"../../packages/core": {
"name": "@notesnook/core",
"version": "7.4.1",
"version": "8.0.8",
"dev": true,
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
@@ -3121,7 +3121,7 @@
},
"../../packages/crypto": {
"name": "@notesnook/crypto",
"version": "1.1.1",
"version": "2.0.7",
"dev": true,
"license": "GPL-3.0-or-later",
"dependencies": {
@@ -3135,7 +3135,7 @@
},
"../../packages/editor": {
"name": "@notesnook/editor",
"version": "1.6.1",
"version": "2.0.7",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"dependencies": {
@@ -7163,7 +7163,7 @@
},
"../../packages/editor-mobile/node_modules/@types/prop-types": {
"version": "15.7.11",
"devOptional": true,
"dev": true,
"license": "MIT"
},
"../../packages/editor-mobile/node_modules/@types/q": {
@@ -7183,7 +7183,7 @@
},
"../../packages/editor-mobile/node_modules/@types/react": {
"version": "18.2.39",
"devOptional": true,
"dev": true,
"license": "MIT",
"dependencies": {
"@types/prop-types": "*",
@@ -7214,7 +7214,7 @@
},
"../../packages/editor-mobile/node_modules/@types/scheduler": {
"version": "0.16.8",
"devOptional": true,
"dev": true,
"license": "MIT"
},
"../../packages/editor-mobile/node_modules/@types/semver": {
@@ -12072,7 +12072,7 @@
},
"../../packages/editor-mobile/node_modules/immer": {
"version": "9.0.21",
"devOptional": true,
"dev": true,
"license": "MIT",
"funding": {
"type": "opencollective",
@@ -22461,6 +22461,7 @@
},
"../../packages/editor/node_modules/js-tokens": {
"version": "4.0.0",
"dev": true,
"license": "MIT"
},
"../../packages/editor/node_modules/json-parse-even-better-errors": {
@@ -22516,6 +22517,7 @@
},
"../../packages/editor/node_modules/loose-envify": {
"version": "1.4.0",
"dev": true,
"license": "MIT",
"dependencies": {
"js-tokens": "^3.0.0 || ^4.0.0"
@@ -23037,6 +23039,7 @@
},
"../../packages/editor/node_modules/react": {
"version": "18.2.0",
"dev": true,
"license": "MIT",
"dependencies": {
"loose-envify": "^1.1.0"
@@ -23055,6 +23058,7 @@
},
"../../packages/editor/node_modules/react-dom": {
"version": "18.2.0",
"dev": true,
"license": "MIT",
"dependencies": {
"loose-envify": "^1.1.0",
@@ -23174,6 +23178,7 @@
},
"../../packages/editor/node_modules/scheduler": {
"version": "0.23.0",
"dev": true,
"license": "MIT",
"dependencies": {
"loose-envify": "^1.1.0"
@@ -23795,13 +23800,13 @@
},
"../../packages/logger": {
"name": "@notesnook/logger",
"version": "1.0.3",
"version": "2.0.7",
"license": "GPL-3.0-or-later",
"devDependencies": {}
},
"../../packages/sodium": {
"name": "@notesnook/sodium",
"version": "1.1.0",
"version": "2.0.7",
"dev": true,
"license": "GPL-3.0-or-later",
"devDependencies": {
@@ -25173,7 +25178,7 @@
},
"../../packages/theme": {
"name": "@notesnook/theme",
"version": "1.2.0",
"version": "2.0.7",
"license": "GPL-3.0-or-later",
"devDependencies": {
"@emotion/react": "11.11.1",
@@ -26240,7 +26245,7 @@
},
"../../packages/ui": {
"name": "@notesnook/ui",
"version": "1.0.0",
"version": "2.0.8",
"license": "GPL-3.0-or-later",
"dependencies": {
"@notesnook/theme": "file:../theme"
@@ -28412,7 +28417,7 @@
"pathe": "1.1.2",
"phone": "^3.1.14",
"qclone": "^1.2.0",
"react-native-actions-sheet": "0.9.3",
"react-native-actions-sheet": "0.9.6",
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
"react-native-drax": "^0.10.2",
"react-native-image-zoom-viewer": "^3.0.1",
@@ -28487,6 +28492,7 @@
"react-native-reanimated": "3.3.0",
"react-native-safe-area-context": "^4.3.1",
"react-native-scoped-storage": "^1.9.5",
"react-native-screenguard": "^1.0.0",
"react-native-screens": "^3.13.1",
"react-native-securerandom": "^1.0.1",
"react-native-share": "^7.2.0",
@@ -30891,6 +30897,7 @@
},
"node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5"
@@ -30904,6 +30911,7 @@
},
"node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5",
@@ -31050,6 +31058,7 @@
},
"node_modules/@babel/plugin-proposal-private-property-in-object": {
"version": "7.21.0-placeholder-for-preset-env.2",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -31060,6 +31069,7 @@
},
"node_modules/@babel/plugin-proposal-unicode-property-regex": {
"version": "7.18.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-create-regexp-features-plugin": "^7.18.6",
@@ -31105,6 +31115,7 @@
},
"node_modules/@babel/plugin-syntax-class-static-block": {
"version": "7.14.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.14.5"
@@ -31141,6 +31152,7 @@
},
"node_modules/@babel/plugin-syntax-export-namespace-from": {
"version": "7.8.3",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.8.3"
@@ -31164,6 +31176,7 @@
},
"node_modules/@babel/plugin-syntax-import-assertions": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5"
@@ -31177,6 +31190,7 @@
},
"node_modules/@babel/plugin-syntax-import-attributes": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5"
@@ -31190,6 +31204,7 @@
},
"node_modules/@babel/plugin-syntax-import-meta": {
"version": "7.10.4",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.10.4"
@@ -31200,6 +31215,7 @@
},
"node_modules/@babel/plugin-syntax-json-strings": {
"version": "7.8.3",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.8.0"
@@ -31223,6 +31239,7 @@
},
"node_modules/@babel/plugin-syntax-logical-assignment-operators": {
"version": "7.10.4",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.10.4"
@@ -31283,6 +31300,7 @@
},
"node_modules/@babel/plugin-syntax-private-property-in-object": {
"version": "7.14.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.14.5"
@@ -31296,6 +31314,7 @@
},
"node_modules/@babel/plugin-syntax-top-level-await": {
"version": "7.14.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.14.5"
@@ -31322,6 +31341,7 @@
},
"node_modules/@babel/plugin-syntax-unicode-sets-regex": {
"version": "7.18.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-create-regexp-features-plugin": "^7.18.6",
@@ -31349,6 +31369,7 @@
},
"node_modules/@babel/plugin-transform-async-generator-functions": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-environment-visitor": "^7.22.5",
@@ -31406,6 +31427,7 @@
},
"node_modules/@babel/plugin-transform-class-properties": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-create-class-features-plugin": "^7.22.5",
@@ -31420,6 +31442,7 @@
},
"node_modules/@babel/plugin-transform-class-static-block": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-create-class-features-plugin": "^7.22.5",
@@ -31483,6 +31506,7 @@
},
"node_modules/@babel/plugin-transform-dotall-regex": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-create-regexp-features-plugin": "^7.22.5",
@@ -31497,6 +31521,7 @@
},
"node_modules/@babel/plugin-transform-duplicate-keys": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5"
@@ -31510,6 +31535,7 @@
},
"node_modules/@babel/plugin-transform-dynamic-import": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5",
@@ -31538,6 +31564,7 @@
},
"node_modules/@babel/plugin-transform-export-namespace-from": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5",
@@ -31594,6 +31621,7 @@
},
"node_modules/@babel/plugin-transform-json-strings": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5",
@@ -31621,6 +31649,7 @@
},
"node_modules/@babel/plugin-transform-logical-assignment-operators": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5",
@@ -31648,6 +31677,7 @@
},
"node_modules/@babel/plugin-transform-modules-amd": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-module-transforms": "^7.22.5",
@@ -31677,6 +31707,7 @@
},
"node_modules/@babel/plugin-transform-modules-systemjs": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-hoist-variables": "^7.22.5",
@@ -31693,6 +31724,7 @@
},
"node_modules/@babel/plugin-transform-modules-umd": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-module-transforms": "^7.22.5",
@@ -31721,6 +31753,7 @@
},
"node_modules/@babel/plugin-transform-new-target": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5"
@@ -31734,6 +31767,7 @@
},
"node_modules/@babel/plugin-transform-nullish-coalescing-operator": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5",
@@ -31748,6 +31782,7 @@
},
"node_modules/@babel/plugin-transform-numeric-separator": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5",
@@ -31775,6 +31810,7 @@
},
"node_modules/@babel/plugin-transform-object-rest-spread": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/compat-data": "^7.22.5",
@@ -31806,6 +31842,7 @@
},
"node_modules/@babel/plugin-transform-optional-catch-binding": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5",
@@ -31820,6 +31857,7 @@
},
"node_modules/@babel/plugin-transform-optional-chaining": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5",
@@ -31848,6 +31886,7 @@
},
"node_modules/@babel/plugin-transform-private-methods": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-create-class-features-plugin": "^7.22.5",
@@ -31862,6 +31901,7 @@
},
"node_modules/@babel/plugin-transform-private-property-in-object": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-annotate-as-pure": "^7.22.5",
@@ -31961,6 +32001,7 @@
},
"node_modules/@babel/plugin-transform-reserved-words": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5"
@@ -32052,6 +32093,7 @@
},
"node_modules/@babel/plugin-transform-typeof-symbol": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5"
@@ -32081,6 +32123,7 @@
},
"node_modules/@babel/plugin-transform-unicode-escapes": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.22.5"
@@ -32094,6 +32137,7 @@
},
"node_modules/@babel/plugin-transform-unicode-property-regex": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-create-regexp-features-plugin": "^7.22.5",
@@ -32122,6 +32166,7 @@
},
"node_modules/@babel/plugin-transform-unicode-sets-regex": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-create-regexp-features-plugin": "^7.22.5",
@@ -32136,6 +32181,7 @@
},
"node_modules/@babel/preset-env": {
"version": "7.22.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/compat-data": "^7.22.5",
@@ -32228,6 +32274,7 @@
},
"node_modules/@babel/preset-env/node_modules/semver": {
"version": "6.3.0",
"dev": true,
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
@@ -32250,6 +32297,7 @@
},
"node_modules/@babel/preset-modules": {
"version": "0.1.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-plugin-utils": "^7.0.0",
@@ -34899,6 +34947,7 @@
},
"node_modules/@types/eslint": {
"version": "8.40.2",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "*",
@@ -34907,6 +34956,7 @@
},
"node_modules/@types/eslint-scope": {
"version": "3.7.4",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/eslint": "*",
@@ -34915,6 +34965,7 @@
},
"node_modules/@types/estree": {
"version": "1.0.1",
"dev": true,
"license": "MIT"
},
"node_modules/@types/graceful-fs": {
@@ -35363,6 +35414,7 @@
},
"node_modules/@webassemblyjs/ast": {
"version": "1.11.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@webassemblyjs/helper-numbers": "1.11.6",
@@ -35371,18 +35423,22 @@
},
"node_modules/@webassemblyjs/floating-point-hex-parser": {
"version": "1.11.6",
"dev": true,
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-api-error": {
"version": "1.11.6",
"dev": true,
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-buffer": {
"version": "1.11.6",
"dev": true,
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-numbers": {
"version": "1.11.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@webassemblyjs/floating-point-hex-parser": "1.11.6",
@@ -35392,10 +35448,12 @@
},
"node_modules/@webassemblyjs/helper-wasm-bytecode": {
"version": "1.11.6",
"dev": true,
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-wasm-section": {
"version": "1.11.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@webassemblyjs/ast": "1.11.6",
@@ -35406,6 +35464,7 @@
},
"node_modules/@webassemblyjs/ieee754": {
"version": "1.11.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@xtuc/ieee754": "^1.2.0"
@@ -35413,6 +35472,7 @@
},
"node_modules/@webassemblyjs/leb128": {
"version": "1.11.6",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@xtuc/long": "4.2.2"
@@ -35420,10 +35480,12 @@
},
"node_modules/@webassemblyjs/utf8": {
"version": "1.11.6",
"dev": true,
"license": "MIT"
},
"node_modules/@webassemblyjs/wasm-edit": {
"version": "1.11.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@webassemblyjs/ast": "1.11.6",
@@ -35438,6 +35500,7 @@
},
"node_modules/@webassemblyjs/wasm-gen": {
"version": "1.11.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@webassemblyjs/ast": "1.11.6",
@@ -35449,6 +35512,7 @@
},
"node_modules/@webassemblyjs/wasm-opt": {
"version": "1.11.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@webassemblyjs/ast": "1.11.6",
@@ -35459,6 +35523,7 @@
},
"node_modules/@webassemblyjs/wasm-parser": {
"version": "1.11.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@webassemblyjs/ast": "1.11.6",
@@ -35471,6 +35536,7 @@
},
"node_modules/@webassemblyjs/wast-printer": {
"version": "1.11.6",
"dev": true,
"license": "MIT",
"dependencies": {
"@webassemblyjs/ast": "1.11.6",
@@ -35528,10 +35594,12 @@
},
"node_modules/@xtuc/ieee754": {
"version": "1.2.0",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@xtuc/long": {
"version": "4.2.2",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/@yarnpkg/lockfile": {
@@ -35587,6 +35655,7 @@
},
"node_modules/acorn-import-assertions": {
"version": "1.9.0",
"dev": true,
"license": "MIT",
"peerDependencies": {
"acorn": "^8"
@@ -36691,6 +36760,7 @@
},
"node_modules/chrome-trace-event": {
"version": "1.0.3",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6.0"
@@ -37791,6 +37861,7 @@
},
"node_modules/enhanced-resolve": {
"version": "5.15.0",
"dev": true,
"license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.4",
@@ -37903,6 +37974,7 @@
},
"node_modules/es-module-lexer": {
"version": "1.3.0",
"dev": true,
"license": "MIT"
},
"node_modules/es-set-tostringtag": {
@@ -38233,6 +38305,7 @@
},
"node_modules/eslint-scope": {
"version": "5.1.1",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"esrecurse": "^4.3.0",
@@ -38244,6 +38317,7 @@
},
"node_modules/eslint-scope/node_modules/estraverse": {
"version": "4.3.0",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=4.0"
@@ -38429,6 +38503,7 @@
},
"node_modules/esrecurse": {
"version": "4.3.0",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"estraverse": "^5.2.0"
@@ -38439,6 +38514,7 @@
},
"node_modules/estraverse": {
"version": "5.3.0",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=4.0"
@@ -38446,6 +38522,7 @@
},
"node_modules/esutils": {
"version": "2.0.3",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=0.10.0"
@@ -39502,6 +39579,7 @@
},
"node_modules/glob-to-regexp": {
"version": "0.4.1",
"dev": true,
"license": "BSD-2-Clause"
},
"node_modules/global": {
@@ -41745,6 +41823,7 @@
},
"node_modules/json-parse-even-better-errors": {
"version": "2.3.1",
"dev": true,
"license": "MIT"
},
"node_modules/json-schema-traverse": {
@@ -42012,6 +42091,7 @@
},
"node_modules/loader-runner": {
"version": "4.3.0",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6.11.5"
@@ -44663,6 +44743,7 @@
},
"node_modules/randombytes": {
"version": "2.1.0",
"dev": true,
"license": "MIT",
"dependencies": {
"safe-buffer": "^5.1.0"
@@ -44778,8 +44859,9 @@
}
},
"node_modules/react-native-actions-sheet": {
"version": "0.9.3",
"license": "MIT",
"version": "0.9.6",
"resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.6.tgz",
"integrity": "sha512-BMEFmJD29izbOxkH81HJWNCgrjdW5iz4gB+Eyov9xwUPz/Fbi53R6AFvF9N3ttYT8nEvzxj56nqP7uJZ6KuKuA==",
"dependencies": {
"react-native-safe-area-context": "^4.8.2"
},
@@ -45253,6 +45335,18 @@
"react-native": "*"
}
},
"node_modules/react-native-screenguard": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/react-native-screenguard/-/react-native-screenguard-1.0.0.tgz",
"integrity": "sha512-fqtoJI8TxszKqrntnHW48EMb4gNVA9VCAg5UG1FcIXEyv2W70kWoMxRRFoWuCRYlBWSAWqiXO+R6Xfk/0um0cw==",
"engines": {
"node": ">= 16.0.0"
},
"peerDependencies": {
"react": "*",
"react-native": "*"
}
},
"node_modules/react-native-screens": {
"version": "3.21.1",
"license": "MIT",
@@ -45434,6 +45528,7 @@
},
"node_modules/react-test-renderer": {
"version": "18.2.0",
"dev": true,
"license": "MIT",
"dependencies": {
"react-is": "^18.2.0",
@@ -45446,10 +45541,12 @@
},
"node_modules/react-test-renderer/node_modules/react-is": {
"version": "18.2.0",
"dev": true,
"license": "MIT"
},
"node_modules/react-test-renderer/node_modules/scheduler": {
"version": "0.23.0",
"dev": true,
"license": "MIT",
"dependencies": {
"loose-envify": "^1.1.0"
@@ -46285,6 +46382,7 @@
},
"node_modules/serialize-javascript": {
"version": "6.0.1",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"randombytes": "^2.1.0"
@@ -47340,6 +47438,7 @@
},
"node_modules/terser-webpack-plugin": {
"version": "5.3.9",
"dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.17",
@@ -47372,6 +47471,7 @@
},
"node_modules/terser-webpack-plugin/node_modules/jest-worker": {
"version": "27.5.1",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*",
@@ -47384,6 +47484,7 @@
},
"node_modules/terser-webpack-plugin/node_modules/supports-color": {
"version": "8.1.1",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
@@ -48128,6 +48229,7 @@
},
"node_modules/watchpack": {
"version": "2.4.0",
"dev": true,
"license": "MIT",
"dependencies": {
"glob-to-regexp": "^0.4.1",
@@ -48150,6 +48252,7 @@
},
"node_modules/webpack": {
"version": "5.88.2",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/eslint-scope": "^3.7.3",
@@ -48264,6 +48367,7 @@
},
"node_modules/webpack-sources": {
"version": "3.2.3",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10.13.0"

View File

@@ -1,6 +1,6 @@
{
"name": "@notesnook/mobile",
"version": "3.0.7",
"version": "3.0.12",
"private": true,
"license": "GPL-3.0-or-later",
"workspaces": [

View File

@@ -10,3 +10,19 @@ index 5de0845..1b158d8 100644
if (includeBase64) {
image.putString("data", getBase64StringFromFile(compressedImagePath));
diff --git a/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m b/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m
index 9f20973..5e14da8 100644
--- a/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m
+++ b/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m
@@ -595,8 +595,10 @@ - (void)qb_imagePickerController:
NSString *mimeType = [self determineMimeTypeFromImageData:imageData];
Boolean isKnownMimeType = [mimeType length] > 0;
+ Boolean isHeicOrHeif = [mimeType isEqualToString:@"image/heic"] || [mimeType isEqualToString:@"image/heif"];
+
ImageResult *imageResult = [[ImageResult alloc] init];
- if (isLossless && useOriginalWidth && useOriginalHeight && isKnownMimeType && !forceJpg) {
+ if (isLossless && useOriginalWidth && useOriginalHeight && isKnownMimeType && !forceJpg && !isHeicOrHeif) {
// Use original, unmodified image
imageResult.data = imageData;
imageResult.width = @(imgT.size.width);

View File

@@ -0,0 +1,54 @@
diff --git a/node_modules/react-native-screenguard/ios/ScreenGuard.mm b/node_modules/react-native-screenguard/ios/ScreenGuard.mm
index 9fa7d33..d2e6d68 100644
--- a/node_modules/react-native-screenguard/ios/ScreenGuard.mm
+++ b/node_modules/react-native-screenguard/ios/ScreenGuard.mm
@@ -11,7 +11,7 @@
@implementation ScreenGuard
RCT_EXPORT_MODULE(ScreenGuard)
-bool hasListeners;
+bool hasListeners_;
UITextField *textField;
UIImageView *imageView;
@@ -22,11 +22,11 @@ @implementation ScreenGuard
}
- (void)startObserving {
- hasListeners = YES;
+ hasListeners_ = YES;
}
- (void)stopObserving {
- hasListeners = NO;
+ hasListeners_ = NO;
}
- (void)secureViewWithBackgroundColor: (NSString *)color {
@@ -335,7 +335,7 @@ - (UIImage *)convertViewToImage:(UIView *)view {
queue:mainQueue
usingBlock:^(NSNotification *notification) {
- if (hasListeners && getScreenShotPath) {
+ if (hasListeners_ && getScreenShotPath) {
UIViewController *presentedViewController = RCTPresentedViewController();
UIImage *image = [self convertViewToImage:presentedViewController.view.superview];
@@ -359,7 +359,7 @@ - (UIImage *)convertViewToImage:(UIView *)view {
result = @{@"path": filePath, @"name": fileName, @"type": @"PNG"};
}
[self emit:SCREENSHOT_EVT body: result];
- } else if (hasListeners) {
+ } else if (hasListeners_) {
[self emit:SCREENSHOT_EVT body: nil];
}
}];
@@ -376,7 +376,7 @@ - (UIImage *)convertViewToImage:(UIView *)view {
queue:mainQueue
usingBlock:^(NSNotification *notification) {
- if (hasListeners) {
+ if (hasListeners_) {
[self emit:SCREEN_RECORDING_EVT body:nil];
}
}];

View File

@@ -134,15 +134,15 @@
},
"../../packages/common": {
"name": "@notesnook/common",
"version": "1.0.0",
"version": "2.0.7",
"license": "GPL-3.0-or-later",
"dependencies": {
"@notesnook/core": "file:../core",
"@notesnook/core": "^8.0.0",
"pathe": "^1.1.2",
"timeago.js": "4.0.2"
},
"devDependencies": {
"@notesnook/core": "file:../core",
"@notesnook/core": "^8.0.0",
"@types/react": "^18.2.39",
"react": "18.2.0",
"vitest": "^1.4.0"
@@ -330,7 +330,7 @@
},
"../../packages/theme": {
"name": "@notesnook/theme",
"version": "1.2.0",
"version": "2.0.7",
"license": "GPL-3.0-or-later",
"devDependencies": {
"@emotion/react": "11.11.1",
@@ -979,7 +979,7 @@
},
"../web": {
"name": "@notesnook/web",
"version": "3.0.6",
"version": "3.0.13",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"dependencies": {
@@ -1029,12 +1029,12 @@
"framer-motion": "^10.16.8",
"hash-wasm": "^4.9.0",
"hotkeys-js": "^3.8.3",
"immer": "^10.0.3",
"katex": "0.16.2",
"kysely": "^0.26.3",
"libsodium-wrappers": "^0.7.13",
"mac-scrollbar": "^0.13.5",
"marked": "^4.1.0",
"mutative": "^1.0.6",
"pdfjs-dist": "3.6.172",
"phone": "^3.1.14",
"platform": "^1.3.6",
@@ -1059,12 +1059,14 @@
"w3c-keyname": "^2.2.6",
"web-streams-polyfill": "^3.1.1",
"wouter": "2.12.1",
"zustand": "4.4.7"
"zustand": "4.4.7",
"zustand-mutative": "^1.0.1"
},
"devDependencies": {
"@babel/core": "^7.22.5",
"@playwright/test": "^1.43.1",
"@swc/core": "1.3.61",
"@swc/core": "^1.5.24",
"@swc/plugin-react-remove-properties": "^2.0.4",
"@trpc/server": "10.38.3",
"@types/babel__core": "^7.20.1",
"@types/event-source-polyfill": "^1.0.1",
@@ -1079,8 +1081,8 @@
"@types/react-scroll-sync": "^0.9.0",
"@types/tinycolor2": "^1.4.3",
"@types/wicg-file-system-access": "^2020.9.6",
"@vitejs/plugin-react-swc": "3.3.2",
"autoprefixer": "^10.4.14",
"@vitejs/plugin-react-swc": "^3.7.0",
"autoprefixer": "^10.4.19",
"better-sqlite3-multiple-ciphers": "^9.4.0",
"buffer": "^6.0.3",
"chalk": "^4.1.0",
@@ -1091,14 +1093,13 @@
"ip": "^1.1.8",
"lorem-ipsum": "^2.0.4",
"otplib": "^12.0.1",
"rollup": "^3.29.4",
"rollup-plugin-visualizer": "^5.9.2",
"swc-plugin-react-remove-properties": "^0.1.4",
"vite": "^4.5.0",
"vite-plugin-env-compatible": "^1.1.1",
"vite-plugin-pwa": "^0.16.3",
"vite-plugin-svgr": "^3.2.0",
"vitest": "^0.34.6",
"rollup": "^4.18.0",
"rollup-plugin-visualizer": "^5.12.0",
"vite": "^5.2.12",
"vite-plugin-env-compatible": "^2.0.1",
"vite-plugin-pwa": "^0.20.0",
"vite-plugin-svgr": "^4.2.0",
"vitest": "^1.6.0",
"workbox-core": "^7.0.0",
"workbox-expiration": "^7.0.0",
"workbox-precaching": "^7.0.0",
@@ -2027,15 +2028,6 @@
"@trpc/server": "10.38.3"
}
},
"node_modules/@trpc/server": {
"version": "10.38.3",
"resolved": "https://registry.npmjs.org/@trpc/server/-/server-10.38.3.tgz",
"integrity": "sha512-9s8/kwo2IDB5hwB2SKZZrfevRhdb1f9fdXtIYd3lbQuf2jQaC/LyQuHaIQjDQoUx9updBfsHXcFFPiCP1DL6pg==",
"funding": [
"https://trpc.io/sponsor"
],
"peer": true
},
"node_modules/@types/babel__core": {
"version": "7.20.1",
"dev": true,

View File

@@ -33,7 +33,7 @@
},
"../../packages/crypto": {
"name": "@notesnook/crypto",
"version": "1.1.1",
"version": "2.0.7",
"license": "GPL-3.0-or-later",
"dependencies": {
"@notesnook/sodium": "file:../sodium"

View File

@@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=0">
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=1690887574068">
<style>

View File

@@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=0">
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=1690887574068">
<style>

View File

@@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=0">
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=1690887574068">
<style>

View File

@@ -97,6 +97,7 @@ test("logged in user should not be able to open unauthorized routes", async ({
await page.goto(route);
await page.waitForURL(/\/notes/gm);
await page.waitForTimeout(1000);
expect(await app.navigation.findItem("Notes")).toBeDefined();
}
});

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.0.6",
"version": "3.0.13",
"private": true,
"main": "./src/app.js",
"homepage": "https://notesnook.com/",
@@ -54,12 +54,12 @@
"framer-motion": "^10.16.8",
"hash-wasm": "^4.9.0",
"hotkeys-js": "^3.8.3",
"immer": "^10.0.3",
"katex": "0.16.2",
"kysely": "^0.26.3",
"libsodium-wrappers": "^0.7.13",
"mac-scrollbar": "^0.13.5",
"marked": "^4.1.0",
"mutative": "^1.0.6",
"pdfjs-dist": "3.6.172",
"phone": "^3.1.14",
"platform": "^1.3.6",
@@ -84,12 +84,14 @@
"w3c-keyname": "^2.2.6",
"web-streams-polyfill": "^3.1.1",
"wouter": "2.12.1",
"zustand": "4.4.7"
"zustand": "4.4.7",
"zustand-mutative": "^1.0.1"
},
"devDependencies": {
"@babel/core": "^7.22.5",
"@playwright/test": "^1.43.1",
"@swc/core": "1.3.61",
"@swc/core": "^1.5.24",
"@swc/plugin-react-remove-properties": "^2.0.4",
"@trpc/server": "10.38.3",
"@types/babel__core": "^7.20.1",
"@types/event-source-polyfill": "^1.0.1",
@@ -104,8 +106,8 @@
"@types/react-scroll-sync": "^0.9.0",
"@types/tinycolor2": "^1.4.3",
"@types/wicg-file-system-access": "^2020.9.6",
"@vitejs/plugin-react-swc": "3.3.2",
"autoprefixer": "^10.4.14",
"@vitejs/plugin-react-swc": "^3.7.0",
"autoprefixer": "^10.4.19",
"better-sqlite3-multiple-ciphers": "^9.4.0",
"buffer": "^6.0.3",
"chalk": "^4.1.0",
@@ -116,14 +118,13 @@
"ip": "^1.1.8",
"lorem-ipsum": "^2.0.4",
"otplib": "^12.0.1",
"rollup": "^3.29.4",
"rollup-plugin-visualizer": "^5.9.2",
"swc-plugin-react-remove-properties": "^0.1.4",
"vite": "^4.5.0",
"vite-plugin-env-compatible": "^1.1.1",
"vite-plugin-pwa": "^0.16.3",
"vite-plugin-svgr": "^3.2.0",
"vitest": "^0.34.6",
"rollup": "^4.18.0",
"rollup-plugin-visualizer": "^5.12.0",
"vite": "^5.2.12",
"vite-plugin-env-compatible": "^2.0.1",
"vite-plugin-pwa": "^0.20.0",
"vite-plugin-svgr": "^4.2.0",
"vitest": "^1.6.0",
"workbox-core": "^7.0.0",
"workbox-expiration": "^7.0.0",
"workbox-precaching": "^7.0.0",

View File

@@ -58,9 +58,8 @@ export default function MobileAppEffects({
overlay.style.pointerEvents = "none";
}
},
onChange: (e, { slide, lastSlide }) => {
if (!lastSlide || !isMobile) return;
toggleSideMenu(slide?.index === 1 ? true : false);
onChange: (e, { slide }) => {
toggleSideMenu(slide?.index === 0 ? true : false);
setIsEditorOpen(slide?.index === 3 ? true : false);
}
});

View File

@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React, { useEffect } from "react";
import { useStore } from "./stores/app-store";
import { useStore as useUserStore } from "./stores/user-store";
import { useStore as useAttachmentStore } from "./stores/attachment-store";
import { useEditorStore } from "./stores/editor-store";
import { useStore as useAnnouncementStore } from "./stores/announcement-store";
import { resetNotices, scheduleBackups } from "./common/notices";
@@ -30,17 +29,17 @@ import { db } from "./common/db";
import { EV, EVENTS } from "@notesnook/core/dist/common";
import { registerKeyMap } from "./common/key-map";
import { isUserPremium } from "./hooks/use-is-user-premium";
import {
showAnnouncementDialog,
showBuyDialog,
showFeatureDialog,
showOnboardingDialog
} from "./common/dialog-controller";
import { updateStatus, removeStatus, getStatus } from "./hooks/use-status";
import { showToast } from "./utils/toast";
import { interruptedOnboarding } from "./dialogs/onboarding-dialog";
import {
interruptedOnboarding,
OnboardingDialog
} from "./dialogs/onboarding-dialog";
import { hashNavigate } from "./navigation";
import { desktop } from "./common/desktop-bridge";
import { BuyDialog } from "./dialogs/buy-dialog";
import { FeatureDialog } from "./dialogs/feature-dialog";
import { AnnouncementDialog } from "./dialogs/announcement-dialog";
type AppEffectsProps = {
setShow: (show: boolean) => void;
@@ -51,7 +50,6 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
const isFocusMode = useStore((store) => store.isFocusMode);
const initUser = useUserStore((store) => store.init);
const initStore = useStore((store) => store.init);
const initAttachments = useAttachmentStore((store) => store.init);
const setIsVaultCreated = useStore((store) => store.setIsVaultCreated);
const initEditorStore = useEditorStore((store) => store.init);
const dialogAnnouncements = useAnnouncementStore(
@@ -69,7 +67,7 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
showToast(
"error",
"Please upgrade your account to Pro to use this feature.",
[{ text: "Upgrade now", onClick: () => showBuyDialog() }]
[{ text: "Upgrade now", onClick: () => BuyDialog.show({}) }]
);
return { type, result: false };
}
@@ -77,7 +75,6 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
);
initStore();
initAttachments();
initEditorStore();
(async function () {
@@ -89,8 +86,9 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
await resetNotices();
setIsVaultCreated(await db.vault.exists());
await showOnboardingDialog(interruptedOnboarding());
await showFeatureDialog("highlights");
const onboardingKey = interruptedOnboarding();
if (onboardingKey) await OnboardingDialog.show({ type: onboardingKey });
await FeatureDialog.show({ featureName: "highlights" });
await scheduleBackups();
})();
@@ -101,7 +99,6 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
[
initEditorStore,
initStore,
initAttachments,
updateLastSynced,
refreshNavItems,
initUser,
@@ -224,7 +221,7 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
useEffect(() => {
if (!dialogAnnouncements.length || IS_TESTING) return;
(async () => {
await showAnnouncementDialog(dialogAnnouncements[0]);
await AnnouncementDialog.show({ announcement: dialogAnnouncements[0] });
})();
}, [dialogAnnouncements]);

View File

@@ -22,10 +22,8 @@ import { Box, Flex } from "@theme-ui/components";
import { ScopedThemeProvider } from "./components/theme-provider";
import useMobile from "./hooks/use-mobile";
import useTablet from "./hooks/use-tablet";
import useDatabase from "./hooks/use-database";
import { useStore } from "./stores/app-store";
import { Toaster } from "react-hot-toast";
import { ViewLoader } from "./components/loaders/view-loader";
import NavigationMenu from "./components/navigation-menu";
import StatusBar from "./components/status-bar";
import { EditorLoader } from "./components/loaders/editor-loader";
@@ -38,12 +36,13 @@ import {
PanelResizeHandle,
ImperativePanelHandle
} from "react-resizable-panels";
import GlobalMenuWrapper from "./components/global-menu-wrapper";
new WebExtensionRelay();
const GlobalMenuWrapper = React.lazy(
() => import("./components/global-menu-wrapper")
);
// const GlobalMenuWrapper = React.lazy(
// () => import("./components/global-menu-wrapper")
// );
const AppEffects = React.lazy(() => import("./app-effects"));
const MobileAppEffects = React.lazy(() => import("./app-effects.mobile"));
const HashRouter = React.lazy(() => import("./components/hash-router"));
@@ -51,26 +50,24 @@ const HashRouter = React.lazy(() => import("./components/hash-router"));
function App() {
const isMobile = useMobile();
const [show, setShow] = useState(true);
const [isAppLoaded] = useDatabase();
const isFocusMode = useStore((store) => store.isFocusMode);
return (
<>
{isAppLoaded && (
<Suspense fallback={<div style={{ display: "none" }} />}>
<div id="menu-wrapper">
<GlobalMenuWrapper />
</div>
<AppEffects setShow={setShow} />
{isMobile && (
<MobileAppEffects
sliderId="slider"
overlayId="overlay"
setShow={setShow}
/>
)}
</Suspense>
)}
<Suspense fallback={<div style={{ display: "none" }} />}>
<div id="menu-wrapper">
<GlobalMenuWrapper />
</div>
<AppEffects setShow={setShow} />
{isMobile && (
<MobileAppEffects
sliderId="slider"
overlayId="overlay"
setShow={setShow}
/>
)}
</Suspense>
<Flex
id="app"
bg="background"
@@ -78,13 +75,9 @@ function App() {
sx={{ overflow: "hidden", flexDirection: "column", height: "100%" }}
>
{isMobile ? (
<MobileAppContents isAppLoaded={isAppLoaded} />
<MobileAppContents />
) : (
<DesktopAppContents
isAppLoaded={isAppLoaded}
setShow={setShow}
show={show}
/>
<DesktopAppContents setShow={setShow} show={show} />
)}
<Toaster containerClassName="toasts-container" />
</Flex>
@@ -121,15 +114,10 @@ function SuspenseLoader<TComponent extends React.JSXElementConstructor<any>>({
}
type DesktopAppContentsProps = {
isAppLoaded: boolean;
show: boolean;
setShow: (show: boolean) => void;
};
function DesktopAppContents({
isAppLoaded,
show,
setShow
}: DesktopAppContentsProps) {
function DesktopAppContents({ show, setShow }: DesktopAppContentsProps) {
const isFocusMode = useStore((store) => store.isFocusMode);
const isTablet = useTablet();
const [isNarrow, setIsNarrow] = useState(isTablet || false);
@@ -137,19 +125,23 @@ function DesktopAppContents({
const middlePane = useRef<ImperativePanelHandle>(null);
useEffect(() => {
if (show) middlePane.current?.expand();
else middlePane.current?.collapse();
}, [show]);
setIsNarrow(isTablet);
}, [isTablet]);
useEffect(() => {
if (isFocusMode) {
const middlePaneSize = middlePane.current?.getSize() || 20;
navPane.current?.collapse();
// the middle pane has to be resized because collapsing the nav
// pane increases the middle pane's size every time.
middlePane.current?.resize(middlePaneSize);
} else navPane.current?.expand();
}, [isFocusMode]);
// useEffect(() => {
// if (show) middlePane.current?.expand();
// else middlePane.current?.collapse();
// }, [show]);
// useEffect(() => {
// if (isFocusMode) {
// const middlePaneSize = middlePane.current?.getSize() || 20;
// navPane.current?.collapse();
// // the middle pane has to be resized because collapsing the nav
// // pane increases the middle pane's size every time.
// middlePane.current?.resize(middlePaneSize);
// } else navPane.current?.expand();
// }, [isFocusMode]);
return (
<>
@@ -160,45 +152,67 @@ function DesktopAppContents({
}}
>
<PanelGroup autoSaveId="global-panel-group" direction="horizontal">
<Panel
ref={navPane}
className="nav-pane"
defaultSize={10}
minSize={3.5}
onResize={(size) => setIsNarrow(size <= 5)}
collapsible
collapsedSize={3.5}
>
<NavigationMenu
toggleNavigationContainer={(state) => {
setShow(state || !show);
}}
isTablet={isNarrow}
/>
</Panel>
<PanelResizeHandle className="panel-resize-handle" />
<Panel
ref={middlePane}
className="middle-pane"
collapsible
defaultSize={20}
>
<ScopedThemeProvider
className="listMenu"
scope="list"
sx={{
display: "flex",
flexDirection: "column",
flex: 1,
bg: "background",
borderRight: "1px solid var(--separator)"
}}
>
{isAppLoaded && <CachedRouter />}
</ScopedThemeProvider>
</Panel>
<PanelResizeHandle className="panel-resize-handle" />
<Panel className="editor-pane" defaultSize={70}>
{!isFocusMode && isTablet ? (
<Flex sx={{ width: 50 }}>
<NavigationMenu
toggleNavigationContainer={(state) => {
setShow(state || !show);
}}
isTablet={isNarrow}
/>
</Flex>
) : (
!isFocusMode && (
<>
<Panel
ref={navPane}
order={1}
className="nav-pane"
defaultSize={10}
minSize={3.5}
// maxSize={isNarrow ? 5 : undefined}
onResize={(size) => setIsNarrow(size <= 5)}
collapsible
collapsedSize={3.5}
>
<NavigationMenu
toggleNavigationContainer={(state) => {
setShow(state || !show);
}}
isTablet={isNarrow}
/>
</Panel>
<PanelResizeHandle className="panel-resize-handle" />
</>
)
)}
{!isFocusMode && show && (
<>
<Panel
ref={middlePane}
className="middle-pane"
order={2}
collapsible
defaultSize={20}
>
<ScopedThemeProvider
className="listMenu"
scope="list"
sx={{
display: "flex",
flexDirection: "column",
flex: 1,
bg: "background",
borderRight: "1px solid var(--separator)"
}}
>
<CachedRouter />
</ScopedThemeProvider>
</Panel>
<PanelResizeHandle className="panel-resize-handle" />
</>
)}
<Panel className="editor-pane" order={3} defaultSize={70}>
<Flex
sx={{
display: "flex",
@@ -208,7 +222,7 @@ function DesktopAppContents({
bg: "background"
}}
>
{isAppLoaded && <HashRouter />}
{<HashRouter />}
</Flex>
</Panel>
</PanelGroup>
@@ -218,7 +232,7 @@ function DesktopAppContents({
);
}
function MobileAppContents({ isAppLoaded }: { isAppLoaded: boolean }) {
function MobileAppContents() {
return (
<FlexScrollContainer
id="slider"
@@ -257,11 +271,7 @@ function MobileAppContents({ isAppLoaded }: { isAppLoaded: boolean }) {
width: "100vw"
}}
>
<SuspenseLoader
condition={isAppLoaded}
component={CachedRouter}
fallback={<ViewLoader />}
/>
<CachedRouter />
<Box
id="overlay"
sx={{
@@ -290,7 +300,7 @@ function MobileAppContents({ isAppLoaded }: { isAppLoaded: boolean }) {
<SuspenseLoader
fallback={<EditorLoader />}
component={HashRouter}
condition={isAppLoaded}
condition={true}
/>
</Flex>
</FlexScrollContainer>

View File

@@ -18,11 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import "./polyfills";
import "@notesnook/core/dist/types";
import { getCurrentHash, getCurrentPath, makeURL } from "./navigation";
import Config from "./utils/config";
import { initializeLogger, logger } from "./utils/logger";
// import { initializeLogger, logger } from "./utils/logger";
import type { AuthProps } from "./views/auth";
import { initializeFeatureChecks } from "./utils/feature-check";
@@ -102,7 +101,7 @@ const sessionExpiryExceptions: Routes[] = [
function getRoute(): RouteWithPath<AuthProps> | RouteWithPath {
const path = getCurrentPath() as Routes;
logger.info(`Getting route for path: ${path}`);
// logger.info(`Getting route for path: ${path}`);
const signup = redirectToRegistration(path);
const sessionExpired = isSessionExpired(path);
@@ -129,7 +128,7 @@ function redirectToRegistration(path: Routes): RouteWithPath<AuthProps> | null {
function isSessionExpired(path: Routes): RouteWithPath<AuthProps> | null {
const isSessionExpired = Config.get("sessionExpired", false);
if (isSessionExpired && !sessionExpiryExceptions.includes(path)) {
logger.info(`User session has expired. Routing to /sessionexpired`);
// logger.info(`User session has expired. Routing to /sessionexpired`);
window.history.replaceState(
{},
@@ -143,7 +142,10 @@ function isSessionExpired(path: Routes): RouteWithPath<AuthProps> | null {
export async function init() {
await initializeFeatureChecks();
await initializeLogger();
await import("./utils/logger").then(({ initializeLogger }) =>
initializeLogger()
);
const { path, route } = getRoute();
return { ...route, path };

View File

@@ -20,12 +20,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { EventSourcePolyfill as EventSource } from "event-source-polyfill";
import { DatabasePersistence, NNStorage } from "../interfaces/storage";
import { logger } from "../utils/logger";
import { showMigrationDialog } from "./dialog-controller";
import { database } from "@notesnook/common";
import { createDialect } from "./sqlite";
import { isFeatureSupported } from "../utils/feature-check";
import { generatePassword } from "../utils/password-generator";
import { deriveKey } from "../interfaces/key-store";
import { deriveKey, useKeyStore } from "../interfaces/key-store";
import { logManager } from "@notesnook/core/dist/logger";
const db = database;
async function initializeDatabase(persistence: DatabasePersistence) {
@@ -33,7 +33,6 @@ async function initializeDatabase(persistence: DatabasePersistence) {
const { FileStorage } = await import("../interfaces/fs");
const { Compressor } = await import("../utils/compressor");
const { useKeyStore } = await import("../interfaces/key-store");
let databaseKey = await useKeyStore.getState().getValue("databaseKey");
if (!databaseKey) {
@@ -56,21 +55,29 @@ async function initializeDatabase(persistence: DatabasePersistence) {
);
await storage.migrate();
const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs");
database.setup({
sqliteOptions: {
dialect: (name, init) => createDialect(name, true, init),
dialect: (name, init) =>
createDialect({
name: persistence === "memory" ? ":memory:" : name,
encrypted: true,
async: !isFeatureSupported("opfs"),
init,
multiTab
}),
...(IS_DESKTOP_APP || isFeatureSupported("opfs")
? { journalMode: "WAL", lockingMode: "exclusive" }
: {
journalMode: "MEMORY",
lockingMode: "exclusive"
lockingMode: "normal"
}),
tempStore: "memory",
synchronous: "normal",
pageSize: 8192,
cacheSize: -32000,
password: Buffer.from(databaseKey).toString("hex"),
skipInitialization: !IS_DESKTOP_APP
skipInitialization: !IS_DESKTOP_APP && multiTab
},
storage: storage,
eventsource: EventSource,
@@ -97,16 +104,23 @@ async function initializeDatabase(persistence: DatabasePersistence) {
// });
// }
console.log("loading db");
await db.init();
console.log("db loaded");
window.addEventListener("beforeunload", () => {
if (IS_DESKTOP_APP) db.sql().destroy();
window.addEventListener("beforeunload", async () => {
if (IS_DESKTOP_APP) {
await db.sql().destroy();
await logManager?.close();
}
});
logger.measure("Database initialization");
if (db.migrations?.required()) {
await showMigrationDialog();
await import("../dialogs/migration-dialog").then(({ MigrationDialog }) =>
MigrationDialog.show({})
);
}
return db;

View File

@@ -28,7 +28,10 @@ export const desktop = createTRPCProxyClient<AppRouter>({
links: [ipcLink()]
});
document.addEventListener("readystatechange", async () => {
attachListeners();
function attachListeners() {
console.log("attaching listeners");
desktop.updater.onChecking.subscribe(
undefined,
attachListener(AppEvents.checkingForUpdate)
@@ -62,7 +65,7 @@ document.addEventListener("readystatechange", async () => {
TaskScheduler.register("updateCheck", "0 0 */12 * * * *", () => {
checkForUpdate();
});
});
}
function attachListener(event: string) {
return {

View File

@@ -1,577 +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 { Dialogs } from "../dialogs";
import { store as tagStore } from "../stores/tag-store";
import { store as appStore } from "../stores/app-store";
import { useEditorStore } from "../stores/editor-store";
import { store as noteStore } from "../stores/note-store";
import { db } from "./db";
import { showToast } from "../utils/toast";
import Config from "../utils/config";
import { AppVersion, getChangelog } from "../utils/version";
import { Period } from "../dialogs/buy-dialog/types";
import { FeatureKeys } from "../dialogs/feature-dialog";
import { Suspense } from "react";
import { ConfirmDialogProps } from "../dialogs/confirm";
import { getFormattedDate } from "@notesnook/common";
import { downloadUpdate } from "../utils/updater";
import { ThemeMetadata } from "@notesnook/themes-server";
import {
Color,
Profile,
Reminder,
Tag,
AuthenticatorType
} from "@notesnook/core";
import { createRoot } from "react-dom/client";
import { PasswordDialogProps } from "../dialogs/password-dialog";
import { LinkAttributes } from "@notesnook/editor/dist/extensions/link";
type DialogTypes = typeof Dialogs;
type DialogIds = keyof DialogTypes;
export type Perform<T = boolean> = (result: T) => void;
type RenderDialog<TId extends DialogIds, TReturnType> = (
dialog: DialogTypes[TId],
perform: (result: TReturnType) => void
) => JSX.Element;
let openDialogs: Partial<Record<DialogIds, boolean>> = {};
function showDialog<TId extends DialogIds, TReturnType>(
id: TId,
render: RenderDialog<TId, TReturnType>
): Promise<TReturnType> {
return new Promise((resolve) => {
if (openDialogs[id]) return false;
const container = document.createElement("div");
container.id = id;
const root = createRoot(container);
const perform = (result: TReturnType) => {
openDialogs[id] = false;
root.unmount();
container.remove();
resolve(result);
};
const PropDialog = () => render(Dialogs[id], perform);
root.render(
<Suspense fallback={<div />}>
<PropDialog />
</Suspense>
);
openDialogs[id] = true;
});
}
export function closeOpenedDialog() {
openDialogs = {};
const dialogs = document.querySelectorAll(
".ReactModalPortal,[data-react-modal-body-trap]"
);
dialogs.forEach((elem) => elem.remove());
}
export function showAddTagsDialog(noteIds: string[]) {
return showDialog("AddTagsDialog", (Dialog, perform) => (
<Dialog onClose={(res: any) => perform(res)} noteIds={noteIds} />
));
}
export function showCreateColorDialog() {
return showDialog<"CreateColorDialog", string | undefined>(
"CreateColorDialog",
(Dialog, perform) => (
<Dialog onClose={() => perform(undefined)} onDone={(id) => perform(id)} />
)
);
}
export function showAddNotebookDialog(parentId?: string) {
return showDialog("AddNotebookDialog", (Dialog, perform) => (
<Dialog
parentId={parentId}
onClose={() => {
perform(false);
}}
/>
));
}
export function showNoteLinkingDialog(attr?: LinkAttributes) {
return showDialog<"NoteLinkingDialog", LinkAttributes | undefined>(
"NoteLinkingDialog",
(Dialog, perform) => (
<Dialog
attributes={attr}
onDone={(link) => perform(link)}
onClose={() => perform(undefined)}
/>
)
);
}
export async function showEditNotebookDialog(notebookId: string) {
const notebook = await db.notebooks.notebook(notebookId);
if (!notebook) return;
return await showDialog("AddNotebookDialog", (Dialog, perform) => (
<Dialog
notebook={notebook}
edit={true}
onClose={() => {
perform(false);
}}
/>
));
}
export function showBuyDialog(plan?: Period, couponCode?: string) {
return showDialog("BuyDialog", (Dialog, perform) => (
<Dialog
plan={plan}
couponCode={couponCode}
onClose={() => perform(false)}
/>
));
}
export function confirm<TCheckId extends string>(
props: Omit<ConfirmDialogProps<TCheckId>, "onClose">
) {
return showDialog<"Confirm", false | Record<TCheckId, boolean>>(
"Confirm",
(Dialog, perform) => (
<Dialog {...props} onClose={(result) => perform(result)} />
)
);
}
export function showPromptDialog(props: {
title: string;
description?: string;
defaultValue?: string;
}) {
return showDialog<"Prompt", string | null>("Prompt", (Dialog, perform) => (
<Dialog
{...props}
onClose={() => perform(null)}
onSave={(text) => {
perform(text);
}}
/>
));
}
export function showEmailChangeDialog() {
return showDialog("EmailChangeDialog", (Dialog, perform) => (
<Dialog onClose={() => perform(null)} />
));
}
export function showError(title: string, message: string) {
return confirm({ title, message, positiveButtonText: "Okay" });
}
export function showMultiDeleteConfirmation(length: number) {
return confirm({
title: `Delete ${length} items?`,
message: `These items will be **kept in your Trash for ${
db.settings.getTrashCleanupInterval() || 7
} days** after which they will be permanently deleted.`,
positiveButtonText: "Yes",
negativeButtonText: "No"
});
}
export function showMultiPermanentDeleteConfirmation(length: number) {
return confirm({
title: `Permanently delete ${length} items?`,
message:
"These items will be **permanently deleted**. This is IRREVERSIBLE.",
positiveButtonText: "Yes",
negativeButtonText: "No"
});
}
export function showLogoutConfirmation() {
return confirm({
title: `Logout?`,
message:
"Logging out will delete all local data and reset the app. Make sure you have synced your data before logging out.",
positiveButtonText: "Yes",
negativeButtonText: "No"
});
}
export function showClearSessionsConfirmation() {
return confirm({
title: `Logout from other devices?`,
message:
"All other logged-in devices will be forced to logout stopping sync. Use with care lest you lose important notes.",
positiveButtonText: "Yes",
negativeButtonText: "No"
});
}
export function showAccountLoggedOutNotice(reason?: string) {
return confirm({
title: "You were logged out",
message: reason,
negativeButtonText: "Okay"
});
}
export function showAppUpdatedNotice(
version: AppVersion & { changelog?: string }
) {
return confirm({
title: `Welcome to v${version.formatted}`,
message: `## Changelog:
\`\`\`
${version.changelog || "No change log."}
\`\`\`
`,
positiveButtonText: `Continue`
});
}
export function showEmailVerificationDialog() {
return showDialog("EmailVerificationDialog", (Dialog, perform) => (
<Dialog onCancel={() => perform(false)} />
));
}
export function showMigrationDialog() {
return showDialog("MigrationDialog", (Dialog, perform) => (
<Dialog onClose={() => perform(false)} />
));
}
type LoadingDialogProps<T> = {
title: string;
message?: string;
subtitle: string;
action: () => T | Promise<T>;
};
export function showLoadingDialog<T>(dialogData: LoadingDialogProps<T>) {
const { title, message, subtitle, action } = dialogData;
return showDialog<"LoadingDialog", T | boolean>(
"LoadingDialog",
(Dialog, perform) => (
<Dialog
title={title}
description={subtitle}
message={message}
action={action}
onClose={(e) => perform(e as T | boolean)}
/>
)
);
}
type ProgressDialogProps = {
title: string;
subtitle: string;
action: (...args: never[]) => void;
};
export function showProgressDialog<T>(dialogData: ProgressDialogProps) {
const { title, subtitle, action } = dialogData;
return showDialog<"ProgressDialog", T>(
"ProgressDialog",
(Dialog, perform) => (
<Dialog
title={title}
subtitle={subtitle}
action={action}
onDone={(e: T) => perform(e)}
/>
)
);
}
export function showThemeDetails(theme: ThemeMetadata) {
return showDialog("ThemeDetailsDialog", (Dialog, perform) => (
<Dialog theme={theme} onClose={(res: boolean) => perform(res)} />
));
}
export function showMoveNoteDialog(noteIds: string[]) {
return showDialog("MoveDialog", (Dialog, perform) => (
<Dialog noteIds={noteIds} onClose={(res: boolean) => perform(res)} />
));
}
export function showPasswordDialog<
TInputId extends string,
TCheckId extends string
>(props: Omit<PasswordDialogProps<TInputId, TCheckId>, "onClose">) {
return showDialog<
"PasswordDialog",
string extends TCheckId ? boolean : false | Record<TCheckId, boolean>
>("PasswordDialog", (Dialog, perform) => (
<Dialog
{...props}
onClose={(result) =>
perform(
result as string extends TCheckId
? boolean
: false | Record<TCheckId, boolean>
)
}
/>
));
}
export function showBackupPasswordDialog(
validate: (outputs: {
password?: string;
key?: string;
}) => boolean | Promise<boolean>
) {
return showDialog("BackupPasswordDialog", (Dialog, perform) => (
<Dialog onClose={() => perform(false)} validate={validate} />
));
}
export function showRecoveryKeyDialog() {
return showDialog("RecoveryKeyDialog", (Dialog, perform) => (
<Dialog onDone={() => perform(true)} />
));
}
export function showCreateTagDialog() {
return showDialog("ItemDialog", (Dialog, perform) => (
<Dialog
title={"Create tag"}
subtitle={"You can create as many tags as you want."}
onClose={() => {
perform(false);
}}
onAction={async (title: string) => {
await db.tags.add({ title });
showToast("success", "Tag created!");
tagStore.refresh();
perform(true);
}}
/>
));
}
export function showEditTagDialog(tag: Tag) {
return showDialog("ItemDialog", (Dialog, perform) => (
<Dialog
title={"Edit tag"}
subtitle={`You are editing #${tag.title}.`}
defaultValue={tag.title}
onClose={() => perform(false)}
onAction={async (title: string) => {
await db.tags.add({ id: tag.id, title });
showToast("success", "Tag edited!");
await tagStore.refresh();
await useEditorStore.getState().refreshTags();
await noteStore.refresh();
await appStore.refreshNavItems();
perform(true);
}}
/>
));
}
export function showRenameColorDialog(color: Color) {
return showDialog("ItemDialog", (Dialog, perform) => (
<Dialog
title={"Rename color"}
subtitle={`You are renaming color ${color.title}.`}
defaultValue={color.title}
onClose={() => perform(false)}
onAction={async (title: string) => {
if (!title) return;
await db.colors.add({ id: color.id, title });
showToast("success", "Color renamed!");
appStore.refreshNavItems();
perform(true);
}}
/>
));
}
export function showFeatureDialog(featureName: FeatureKeys) {
return showDialog("FeatureDialog", (Dialog, perform) => (
<Dialog featureName={featureName} onClose={(res) => perform(res)} />
));
}
export function showReminderDialog(reminderKey: string) {
if (Config.get(reminderKey, false)) return;
return showDialog("ReminderDialog", (Dialog, perform) => (
<Dialog
reminderKey={reminderKey}
onClose={(res: boolean) => {
Config.set(reminderKey, true);
perform(res);
}}
/>
));
}
export function showReminderPreviewDialog(reminder: Reminder) {
return showDialog("ReminderPreviewDialog", (Dialog, perform) => (
<Dialog reminder={reminder} onClose={perform} />
));
}
export async function showAddReminderDialog(noteId?: string) {
const note = noteId ? await db.notes.note(noteId) : undefined;
return showDialog("AddReminderDialog", (Dialog, perform) => (
<Dialog onClose={(res: boolean) => perform(res)} note={note} />
));
}
export async function showEditReminderDialog(reminderId: string) {
const reminder = await db.reminders.reminder(reminderId);
if (!reminder) return null;
return showDialog("AddReminderDialog", (Dialog, perform) => (
<Dialog onClose={(res: boolean) => perform(res)} reminder={reminder} />
));
}
export function showAnnouncementDialog(announcement: any) {
return showDialog("AnnouncementDialog", (Dialog, perform) => (
<Dialog
announcement={announcement}
onClose={(res: boolean) => perform(res)}
/>
));
}
export function showIssueDialog() {
return showDialog("IssueDialog", (Dialog, perform) => (
<Dialog
onClose={(res: boolean) => {
perform(res);
}}
/>
));
}
export function showMultifactorDialog(primaryMethod?: AuthenticatorType) {
return showDialog("MultifactorDialog", (Dialog, perform) => (
<Dialog onClose={(res) => perform(res)} primaryMethod={primaryMethod} />
));
}
export function show2FARecoveryCodesDialog(primaryMethod: AuthenticatorType) {
return showDialog("RecoveryCodesDialog", (Dialog, perform) => (
<Dialog onClose={(res) => perform(res)} primaryMethod={primaryMethod} />
));
}
export function showAttachmentsDialog() {
return showDialog("AttachmentsDialog", (Dialog, perform) => (
<Dialog onClose={(res: boolean) => perform(res)} />
));
}
export function showEditProfilePictureDialog(profile?: Profile) {
return showDialog("EditProfilePictureDialog", (Dialog, perform) => (
<Dialog onClose={(res: boolean) => perform(res)} profile={profile} />
));
}
export function showImagePickerDialog(images: File[]): Promise<false | File[]> {
if (images.length <= 0) return Promise.resolve(false);
return showDialog("ImagePickerDialog", (Dialog, perform) => (
<Dialog onClose={(res) => perform(res)} images={images} />
));
}
export function showSettings() {
return showDialog("SettingsDialog", (Dialog, perform) => (
<Dialog onClose={(res: boolean) => perform(res)} />
));
}
export function showOnboardingDialog(type?: string) {
if (!type) return;
return showDialog("OnboardingDialog", (Dialog, perform) => (
<Dialog type={type} onClose={(res: boolean) => perform(res)} />
));
}
export async function showInvalidSystemTimeDialog({
serverTime,
localTime
}: {
serverTime: number;
localTime: number;
}) {
const result = await confirm({
title: "Your system clock is out of sync",
subtitle:
"Please correct your system date & time and reload the app to avoid syncing issues.",
message: `Server time: ${getFormattedDate(serverTime)}
Local time: ${getFormattedDate(localTime)}
Please sync your system time with [https://time.is](https://time.is).`,
positiveButtonText: "Reload app"
});
if (result) window.location.reload();
}
export async function showUpdateAvailableNotice({
version
}: {
version: string;
}) {
const changelog = await getChangelog(version);
return showUpdateDialog({
title: `New version available`,
subtitle: `v${version} is available for download`,
changelog,
action: { text: `Update now`, onClick: () => downloadUpdate() }
});
}
type UpdateDialogProps = {
title: string;
subtitle: string;
changelog: string;
action: {
text: string;
onClick: () => void;
};
};
async function showUpdateDialog({
title,
subtitle,
changelog,
action
}: UpdateDialogProps) {
const result = await confirm({
title,
subtitle,
message: changelog,
width: 500,
positiveButtonText: action.text
});
if (result && action.onClick) action.onClick();
}

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 { createRoot } from "react-dom/client";
export interface BaseDialogProps<T = unknown> {
onClose: (result: T) => void;
}
class _DialogManager {
private openedDialogs: Set<React.JSXElementConstructor<any>> = new Set();
open<
Props extends BaseDialogProps<any>,
Result extends Props extends BaseDialogProps<infer T> ? T : unknown
>(
component: React.ComponentType<Props>,
props: Omit<Props, "onClose">
): Promise<Result | false> {
if (this.openedDialogs.has(component)) return Promise.resolve(false);
const container = document.createElement("div");
const root = createRoot(container);
const close = () => {
this.openedDialogs.delete(component);
root.unmount();
container.remove();
};
const Dialog = component as React.FunctionComponent<
Omit<Props, "onClose"> & {
onClose: (result: any) => void;
}
>;
this.openedDialogs.add(component);
return new Promise<Result>((resolve, reject) =>
root.render(
<Dialog
{...props}
onClose={(result: Result) => {
try {
close();
resolve(result);
} catch (e) {
reject(e);
}
}}
/>
)
);
}
closeAll() {
this.openedDialogs.clear();
const dialogs = document.querySelectorAll(
".ReactModalPortal,[data-react-modal-body-trap]"
);
dialogs.forEach((elem) => elem.remove());
}
register<Props extends BaseDialogProps<any>>(
component: React.ComponentType<Props>
) {
return {
show: (props: Omit<Props, "onClose">) => this.open(component, props)
};
}
}
export const DialogManager = new _DialogManager();

View File

@@ -32,7 +32,7 @@ import {
import Vault from "./vault";
import { ExportStream } from "../utils/streams/export-stream";
import { showToast } from "../utils/toast";
import { confirm } from "./dialog-controller";
import { ConfirmDialog } from "../dialogs/confirm";
export async function exportToPDF(
title: string,
@@ -100,17 +100,26 @@ export async function exportNotes(
};
}
});
confirm({
title: `Exported ${result.count} notes`,
message:
result.errors.length > 0
? `Export completed with ${result.errors.length} errors:
if (result instanceof Error) {
ConfirmDialog.show({
title: `Export failed`,
message: result.stack || result.message,
positiveButtonText: "Okay"
});
return false;
} else {
ConfirmDialog.show({
title: `Exported ${result.count} notes`,
message:
result.errors.length > 0
? `Export completed with ${result.errors.length} errors:
${result.errors.map((e, i) => `${i + 1}. ${e.message}`).join("\n")}`
: "Export completed with 0 errors.",
positiveButtonText: "Okay"
});
return true;
: "Export completed with 0 errors.",
positiveButtonText: "Okay"
});
return true;
}
}
const FORMAT_TO_EXT = {

View File

@@ -17,12 +17,6 @@ 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 {
showBackupPasswordDialog,
showFeatureDialog,
showPasswordDialog,
showReminderDialog
} from "./dialog-controller";
import Config from "../utils/config";
import { hashNavigate, getCurrentHash } from "../navigation";
import { db } from "./db";
@@ -38,12 +32,15 @@ import { TaskManager } from "./task-manager";
import { EVENTS } from "@notesnook/core/dist/common";
import { createWritableStream } from "./desktop-bridge";
import { createZipStream } from "../utils/streams/zip-stream";
import { FeatureKeys } from "../dialogs/feature-dialog";
import { FeatureDialog, FeatureKeys } from "../dialogs/feature-dialog";
import { ZipEntry, createUnzipIterator } from "../utils/streams/unzip-stream";
import { User } from "@notesnook/core";
import { LegacyBackupFile } from "@notesnook/core";
import { useEditorStore } from "../stores/editor-store";
import { formatDate } from "@notesnook/core/dist/utils/date";
import { showPasswordDialog } from "../dialogs/password-dialog";
import { BackupPasswordDialog } from "../dialogs/backup-password-dialog";
import { ReminderDialog } from "../dialogs/reminder-dialog";
export const CREATE_BUTTON_MAP = {
notes: {
@@ -70,7 +67,7 @@ export async function introduceFeatures() {
const features: FeatureKeys[] = [];
for (const feature of features) {
if (!Config.get(`feature:${feature}`)) {
await showFeatureDialog(feature);
await FeatureDialog.show({ featureName: feature });
}
}
}
@@ -173,10 +170,12 @@ export async function restoreBackupFile(backupFile: File) {
const backup = JSON.parse(await readFile(backupFile));
if (backup.data.iv && backup.data.salt) {
await showBackupPasswordDialog(async ({ password, key }) => {
if (!password && !key) return false;
const error = await restoreWithProgress(backup, password, key);
return !error;
await BackupPasswordDialog.show({
validate: async ({ password, key }) => {
if (!password && !key) return false;
const error = await restoreWithProgress(backup, password, key);
return !error;
}
});
} else {
await restoreWithProgress(backup);
@@ -212,15 +211,15 @@ export async function restoreBackupFile(backupFile: File) {
const backup = JSON.parse(await entry.text());
if (backup.encrypted) {
if (!cachedPassword && !cachedKey) {
const result = await showBackupPasswordDialog(
async ({ password, key }) => {
const result = await BackupPasswordDialog.show({
validate: async ({ password, key }) => {
if (!password && !key) return false;
await db.backup?.import(backup, password, key);
cachedPassword = password;
cachedKey = key;
return true;
}
);
});
if (!result) break;
} else await db.backup?.import(backup, cachedPassword, cachedKey);
} else {
@@ -318,9 +317,9 @@ export async function showUpgradeReminderDialogs() {
const isTrial = user.subscription?.type === SUBSCRIPTION_STATUS.TRIAL;
const isBasic = user.subscription?.type === SUBSCRIPTION_STATUS.BASIC;
if (isBasic && consumed >= 100) {
await showReminderDialog("trialexpired");
await ReminderDialog.show({ reminderKey: "trialexpired" });
} else if (isTrial && consumed >= 75) {
await showReminderDialog("trialexpiring");
await ReminderDialog.show({ reminderKey: "trialexpiring" });
}
}

View File

@@ -17,7 +17,6 @@ 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 { confirm, showMultiDeleteConfirmation } from "./dialog-controller";
import { store as noteStore } from "../stores/note-store";
import { store as notebookStore } from "../stores/notebook-store";
import { store as attachmentStore } from "../stores/attachment-store";
@@ -27,6 +26,7 @@ import { showToast } from "../utils/toast";
import Vault from "./vault";
import { TaskManager } from "./task-manager";
import { pluralize } from "@notesnook/common";
import { ConfirmDialog, showMultiDeleteConfirmation } from "../dialogs/confirm";
async function moveNotesToTrash(ids: string[], confirm = true) {
if (confirm && !(await showMultiDeleteConfirmation(ids.length))) return;
@@ -79,7 +79,7 @@ async function moveNotebooksToTrash(ids: string[]) {
async function deleteAttachments(ids: string[]) {
if (
!(await confirm({
!(await ConfirmDialog.show({
title: "Are you sure?",
message:
"Are you sure you want to permanently delete these attachments? This action is IRREVERSIBLE.",

View File

@@ -23,12 +23,12 @@ import { db } from "./db";
import { store as appStore } from "../stores/app-store";
import { Backup, User, Email, Warn, Icon } from "../components/icons";
import dayjs from "dayjs";
import { showBuyDialog, showRecoveryKeyDialog } from "./dialog-controller";
import { hardNavigate, hashNavigate } from "../navigation";
import { isUserPremium } from "../hooks/use-is-user-premium";
import { showToast } from "../utils/toast";
import { TaskScheduler } from "../utils/task-scheduler";
import { BuyDialog } from "../dialogs/buy-dialog";
import { RecoveryKeyDialog } from "../dialogs/recovery-key-dialog";
export type NoticeType = "autoBackupsOff" | "login" | "email" | "recoverykey";
@@ -119,7 +119,7 @@ export const NoticesData: Record<NoticeType, NoticeData> = {
key: "autoBackupsOff",
title: "Automatic backups disabled",
subtitle: "Please upgrade to Pro to enable automatic backups.",
action: () => showBuyDialog(),
action: () => BuyDialog.show({}),
dismissable: true,
icon: Backup
},
@@ -143,7 +143,7 @@ export const NoticesData: Record<NoticeType, NoticeData> = {
subtitle: "Keep your recovery key safe",
dismissable: true,
action: async () => {
if (await verifyAccount()) await showRecoveryKeyDialog();
if (await verifyAccount()) await RecoveryKeyDialog.show({});
},
icon: Warn
}

View File

@@ -213,7 +213,7 @@ export class AccessHandlePoolVFS extends VFS.Base {
}
async delete() {
for await (const [name] of this.#directoryHandle) {
for await (const [name] of await this.#directoryHandle.entries()) {
await this.#directoryHandle.removeEntry(name, { recursive: true });
}
}
@@ -300,7 +300,7 @@ export class AccessHandlePoolVFS extends VFS.Base {
async #acquireAccessHandles() {
// Enumerate all the files in the directory.
const files = [];
for await (const [name, handle] of this.#directoryHandle) {
for await (const [name, handle] of await this.#directoryHandle.entries()) {
if (handle.kind === "file") {
files.push([name, handle]);
}

View File

@@ -1,7 +1,7 @@
/* eslint-disable header/header */
// Copyright 2022 Roy T. Hashimoto. All Rights Reserved.
import * as VFS from "./VFS.js";
import { WebLocksExclusive as WebLocks } from "./WebLocks.js";
import { WebLocksShared as WebLocks } from "./WebLocks.js";
import { IDBContext } from "./IDBContext.js";
const SECTOR_SIZE = 512;

View File

@@ -18,39 +18,94 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import {
SqliteDriver as KSqliteDriver,
SqliteDialectConfig,
Dialect,
SqliteAdapter,
SqliteIntrospector,
SqliteQueryCompiler
SqliteQueryCompiler,
DatabaseConnection,
QueryResult,
CompiledQuery,
Driver
} from "kysely";
import { desktop } from "../desktop-bridge";
import Worker from "./sqlite.worker.desktop.ts?worker";
import type { SQLiteWorker } from "./sqlite.worker.desktop";
import { wrap, Remote } from "comlink";
import { Mutex } from "async-mutex";
import { DialectOptions } from ".";
class SqliteDriver extends KSqliteDriver {
constructor(private readonly config: SqliteDialectConfig & { name: string }) {
super(config);
class SqliteDriver implements Driver {
connection?: DatabaseConnection;
private connectionMutex = new Mutex();
worker: Remote<SQLiteWorker> = wrap<SQLiteWorker>(new Worker());
constructor(private readonly config: { name: string }) {}
async init(): Promise<void> {
const path = await desktop!.integration.resolvePath.query({
filePath: `userData/${this.config.name}.sql`
});
await this.worker.open(path);
this.connection = new SqliteWorkerConnection(this.worker);
}
async acquireConnection(): Promise<DatabaseConnection> {
if (!this.connection) throw new Error("Driver not initialized.");
// SQLite only has one single connection. We use a mutex here to wait
// until the single connection has been released.
await this.connectionMutex.waitForUnlock();
await this.connectionMutex.acquire();
return this.connection;
}
async beginTransaction(connection: DatabaseConnection): Promise<void> {
await connection.executeQuery(CompiledQuery.raw("begin"));
}
async commitTransaction(connection: DatabaseConnection): Promise<void> {
await connection.executeQuery(CompiledQuery.raw("commit"));
}
async rollbackTransaction(connection: DatabaseConnection): Promise<void> {
await connection.executeQuery(CompiledQuery.raw("rollback"));
}
async releaseConnection(): Promise<void> {
this.connectionMutex.release();
}
async destroy(): Promise<void> {
await this.worker.close();
}
async delete() {
const path = await desktop!.integration.resolvePath.query({
filePath: `userData/${this.config.name}.sql`
});
await desktop?.integration.deleteFile.query(path);
await this.destroy();
await this.worker.delete(path);
}
}
export const createDialect = (name: string, _encrypted: boolean): Dialect => {
class SqliteWorkerConnection implements DatabaseConnection {
constructor(private readonly worker: Remote<SQLiteWorker>) {}
streamQuery<R>(): AsyncIterableIterator<QueryResult<R>> {
throw new Error("wasqlite driver doesn't support streaming");
}
async executeQuery<R>(
compiledQuery: CompiledQuery<unknown>
): Promise<QueryResult<R>> {
const { parameters, sql } = compiledQuery;
return this.worker.run(sql, parameters as any) as unknown as QueryResult<R>;
}
}
export const createDialect = (options: DialectOptions): Dialect => {
return {
createDriver: () =>
new SqliteDriver({
name,
database: async () => {
const path = await desktop!.integration.resolvePath.query({
filePath: `userData/${name}.sql`
});
return window.createSQLite3Database(path).unsafeMode(true);
}
name: options.name
}),
createAdapter: () => new SqliteAdapter(),
createIntrospector: (db) => new SqliteIntrospector(db),

View File

@@ -23,8 +23,10 @@ import {
SqliteIntrospector,
Dialect
} from "kysely";
import { WaSqliteWorkerDriver } from "./wa-sqlite-kysely-driver";
import { isFeatureSupported } from "../../utils/feature-check";
import {
WaSqliteWorkerMultipleTabDriver,
WaSqliteWorkerSingleTabDriver
} from "./wa-sqlite-kysely-driver";
declare module "kysely" {
interface Driver {
@@ -32,19 +34,29 @@ declare module "kysely" {
}
}
export const createDialect = (
name: string,
encrypted: boolean,
init?: () => Promise<void>
): Dialect => {
export type DialectOptions = {
name: string;
encrypted: boolean;
async: boolean;
multiTab: boolean;
init?: () => Promise<void>;
};
export const createDialect = (options: DialectOptions): Dialect => {
const { async, encrypted, multiTab, name, init } = options;
return {
createDriver: () =>
new WaSqliteWorkerDriver({
async: !isFeatureSupported("opfs"),
dbName: name,
encrypted,
init
}),
multiTab
? new WaSqliteWorkerMultipleTabDriver({
async,
dbName: name,
encrypted,
init
})
: new WaSqliteWorkerSingleTabDriver({
async,
dbName: name,
encrypted
}),
createAdapter: () => new SqliteAdapter(),
createIntrospector: (db) => new SqliteIntrospector(db),
createQueryCompiler: () => new SqliteQueryCompiler()

View File

@@ -182,7 +182,9 @@ export class SharedService<T extends object> extends EventTarget {
}
#sendPortToClient(message: any, port: MessagePort) {
sharedWorker?.port.postMessage(message, [port]);
if (!sharedWorker)
throw new Error("Shared worker is not supported in this environment.");
sharedWorker.port.postMessage(message, [port]);
}
async #getClientId() {

View File

@@ -0,0 +1,25 @@
/*
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 { SQLite } from "@notesnook/desktop";
import { expose } from "comlink";
export type SQLiteWorker = typeof SQLite.prototype;
const db = new SQLite();
expose(db);

View File

@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import type { SQLiteAPI, SQLiteCompatibleType } from "./sqlite-types";
import { Factory, SQLITE_ROW, SQLiteError } from "./sqlite-api";
import { transfer } from "comlink";
import { expose, transfer } from "comlink";
import type { RunMode } from "./type";
import { QueryResult } from "kysely";
import { DatabaseSource } from "./sqlite-export";
@@ -32,6 +32,12 @@ type PreparedStatement = {
columns: string[];
};
type SQLiteOptions = {
async: boolean;
url?: string;
encrypted: boolean;
};
class _SQLiteWorker {
sqlite!: SQLiteAPI;
db: number | undefined = undefined;
@@ -39,21 +45,22 @@ class _SQLiteWorker {
initialized = false;
preparedStatements: Map<string, PreparedStatement> = new Map();
retryCounter: Record<string, number> = {};
constructor(
private readonly dbName: string,
private readonly encrypted: boolean
) {
console.log("new sqlite worker", dbName, encrypted);
}
encrypted = false;
name = "";
async = false;
async open(async: boolean, url?: string) {
async open(name: string, options: SQLiteOptions) {
if (this.db) {
console.error("Database is already initialized", this.db);
return;
}
const option = url ? { locateFile: () => url } : {};
const sqliteModule = async
this.encrypted = options.encrypted;
this.name = name;
this.async = options.async;
const option = options.url ? { locateFile: () => options.url } : {};
const sqliteModule = options.async
? await import("./wa-sqlite-async").then(
({ default: SQLiteAsyncESMFactory }) => SQLiteAsyncESMFactory(option)
)
@@ -61,11 +68,11 @@ class _SQLiteWorker {
SQLiteSyncESMFactory(option)
);
this.sqlite = Factory(sqliteModule);
this.vfs = await this.getVFS(this.dbName, async);
this.vfs = await this.getVFS(name, options.async);
this.sqlite.vfs_register(this.vfs, false);
this.db = await this.sqlite.open_v2(
this.dbName,
name,
undefined,
`multipleciphers-${this.vfs.name}`
);
@@ -163,7 +170,7 @@ class _SQLiteWorker {
if (this.encrypted && !sql.startsWith("PRAGMA key")) {
await this.waitForDatabase();
}
if (!this.db) throw new Error("No database is not opened.");
if (!this.db) throw new Error("Database is not opened.");
const rows = (await this.exec(sql, mode, parameters)) as R[];
if (mode === "query") return { rows };
@@ -194,16 +201,16 @@ class _SQLiteWorker {
this.initialized = false;
}
async export(dbName: string, async: boolean) {
const vfs = await this.getVFS(dbName, async);
const stream = new ReadableStream(new DatabaseSource(vfs, dbName));
async export() {
const vfs = await this.getVFS(this.name, this.async);
const stream = new ReadableStream(new DatabaseSource(vfs, this.name));
return transfer(stream, [stream]);
}
async delete(dbName: string, async: boolean) {
async delete() {
await this.close();
if (this.vfs) await this.vfs.delete();
else await (await this.getVFS(dbName, async)).delete();
else await (await this.getVFS(this.name, this.async)).delete();
}
async getVFS(dbName: string, async: boolean) {
@@ -222,7 +229,7 @@ class _SQLiteWorker {
async initialize() {
self.dispatchEvent(
new MessageEvent("message", {
data: { type: "databaseInitialized", dbName: this.dbName }
data: { type: "databaseInitialized", dbName: this.name }
})
);
console.log("Database initialized", this.db);
@@ -237,7 +244,7 @@ class _SQLiteWorker {
self.addEventListener("message", (ev) => {
if (
ev.data.type === "databaseInitialized" &&
ev.data.dbName === this.dbName
ev.data.dbName === this.name
)
resolve(true);
})
@@ -251,11 +258,17 @@ export type SQLiteWorker = typeof _SQLiteWorker.prototype;
addEventListener("message", async (event) => {
if (!event.data.type) {
const worker = new _SQLiteWorker(event.data.dbName, event.data.encrypted);
await worker.open(event.data.async, event.data.uri);
const worker = new _SQLiteWorker();
await worker.open(event.data.dbName, {
async: event.data.async,
encrypted: event.data.encrypted,
url: event.data.uri
});
const providerPort = createSharedServicePort(worker);
postMessage(null, [providerPort]);
self.addEventListener("beforeunload", () => worker.close());
}
});
const worker = new _SQLiteWorker();
expose(worker);

View File

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

View File

@@ -25,6 +25,7 @@ import SQLiteSyncURI from "./wa-sqlite.wasm?url";
import SQLiteAsyncURI from "./wa-sqlite-async.wasm?url";
import { Mutex } from "async-mutex";
import { SharedService } from "./shared-service";
import { Remote, wrap } from "comlink";
type Config = {
dbName: string;
@@ -38,13 +39,14 @@ const servicePool = new Map<
{ service: SharedService<SQLiteWorker>; activated: boolean; closed: boolean }
>();
export class WaSqliteWorkerDriver implements Driver {
export class WaSqliteWorkerMultipleTabDriver implements Driver {
private connection?: DatabaseConnection;
private connectionMutex = new Mutex();
private initializationMutex = new Mutex();
private readonly serviceName;
constructor(private readonly config: Config) {
console.log("multi tab driver", config.dbName);
this.serviceName = `${config.dbName}-service`;
}
@@ -59,10 +61,11 @@ export class WaSqliteWorkerDriver implements Driver {
if (activated) {
if (closed) {
console.log("Already activated. Reinitializing...");
await service.proxy.open(
this.config.async,
this.config.async ? SQLiteAsyncURI : SQLiteSyncURI
);
await service.proxy.open(this.config.dbName, {
async: this.config.async,
encrypted: this.config.encrypted,
url: this.config.async ? SQLiteAsyncURI : SQLiteSyncURI
});
this.needsInitialization = true;
servicePool.set(this.serviceName, {
service,
@@ -193,19 +196,76 @@ export class WaSqliteWorkerDriver implements Driver {
async delete() {
const service = servicePool.get(this.serviceName);
if (!service || !service.service) return;
await service.service?.proxy?.delete(this.config.dbName, this.config.async);
await service.service?.proxy?.delete();
service.closed = true;
}
async export() {
return servicePool
.get(this.serviceName)
?.service?.proxy?.export(this.config.dbName, this.config.async);
return servicePool.get(this.serviceName)?.service?.proxy?.export();
}
}
export class WaSqliteWorkerSingleTabDriver implements Driver {
private connection?: DatabaseConnection;
private connectionMutex = new Mutex();
private readonly worker = wrap<SQLiteWorker>(
new Worker({ name: this.config.dbName })
);
constructor(private readonly config: Config) {
console.log("single tab driver", config.dbName);
}
async init(): Promise<void> {
await this.worker.open(this.config.dbName, {
async: this.config.async,
encrypted: this.config.encrypted,
url: this.config.async ? SQLiteAsyncURI : SQLiteSyncURI
});
this.connection = new WaSqliteWorkerConnection(this.worker);
}
async acquireConnection(): Promise<DatabaseConnection> {
if (!this.connection) throw new Error("Driver not initialized.");
// SQLite only has one single connection. We use a mutex here to wait
// until the single connection has been released.
await this.connectionMutex.waitForUnlock();
await this.connectionMutex.acquire();
return this.connection;
}
async beginTransaction(connection: DatabaseConnection): Promise<void> {
await connection.executeQuery(CompiledQuery.raw("begin"));
}
async commitTransaction(connection: DatabaseConnection): Promise<void> {
await connection.executeQuery(CompiledQuery.raw("commit"));
}
async rollbackTransaction(connection: DatabaseConnection): Promise<void> {
await connection.executeQuery(CompiledQuery.raw("rollback"));
}
async releaseConnection(): Promise<void> {
this.connectionMutex.release();
}
async destroy(): Promise<void> {
await this.worker.close();
}
async delete() {
await this.worker.delete();
}
async export() {
return await this.worker.export();
}
}
class WaSqliteWorkerConnection implements DatabaseConnection {
constructor(private readonly worker: SQLiteWorker) {}
constructor(private readonly worker: SQLiteWorker | Remote<SQLiteWorker>) {}
streamQuery<R>(): AsyncIterableIterator<QueryResult<R>> {
throw new Error("wasqlite driver doesn't support streaming");
@@ -221,6 +281,8 @@ class WaSqliteWorkerConnection implements DatabaseConnection {
: query.kind === "RawNode"
? "raw"
: "exec";
return this.worker.run(mode, sql, parameters as any);
return this.worker.run(mode, sql, parameters as any) as Promise<
QueryResult<R>
>;
}
}

View File

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

View File

@@ -16,30 +16,37 @@ 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 { immerable, setAutoFreeze } from "immer";
import { create } from "zustand";
import {
subscribeWithSelector,
persist,
PersistOptions
} from "zustand/middleware";
import { immer } from "zustand/middleware/immer";
import { GetState, IStore, SetState } from "../stores";
setAutoFreeze(false);
import { mutative } from "zustand-mutative";
export function createStore<T>(
getStore: (set: SetState<T>, get: GetState<T>) => T
) {
const store = create<
T,
[["zustand/subscribeWithSelector", never], ["zustand/immer", never]]
[["zustand/subscribeWithSelector", never], ["zustand/mutative", never]]
>(
subscribeWithSelector(
immer((set, get) => {
const store = getStore(set, get);
(store as any)[immerable] = true;
return store;
})
mutative(
(set, get) => {
const store = getStore(set, get);
return store;
},
{
strict: import.meta.env.DEV,
mark: (target, { mutable, immutable }) => {
if (!target || typeof target !== "object") return mutable;
return immutable;
}
}
)
)
);
return [store, store.getState()] as const;
@@ -54,16 +61,24 @@ export function createPersistedStore<T extends object>(
[
["zustand/persist", Partial<T>],
["zustand/subscribeWithSelector", never],
["zustand/immer", never]
["zustand/mutative", never]
]
>(
persist(
subscribeWithSelector(
immer((set, get) => {
const store = new Store(set, get);
(store as any)[immerable] = true;
return store;
})
mutative(
(set, get) => {
const store = new Store(set, get);
return store;
},
{
strict: import.meta.env.DEV,
mark: (target, { mutable, immutable }) => {
if (!target || typeof target !== "object") return mutable;
return immutable;
}
}
)
),
options
)

View File

@@ -17,8 +17,8 @@ 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 { ProgressDialog } from "../dialogs/progress-dialog";
import { removeStatus, updateStatus } from "../hooks/use-status";
import { showProgressDialog } from "./dialog-controller";
type TaskType = "status" | "modal";
type TaskAction<T> = (report: ProgressReportCallback) => T | Promise<T>;
@@ -55,7 +55,7 @@ type TaskProgress = {
type ProgressReportCallback = (progress: TaskProgress) => void;
export class TaskManager {
static async startTask<T>(task: TaskDefinition<T>): Promise<T> {
static async startTask<T>(task: TaskDefinition<T>): Promise<T | Error> {
switch (task.type) {
case "status": {
const statusTask = task;
@@ -74,11 +74,11 @@ export class TaskManager {
return result;
}
case "modal": {
return await showProgressDialog<T>({
return (await ProgressDialog.show({
title: task.title,
subtitle: task.subtitle,
action: task.action
});
})) as T;
}
}
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { db } from "./db";
import { showPasswordDialog } from "./dialog-controller";
import { showPasswordDialog } from "../dialogs/password-dialog";
import { showToast } from "../utils/toast";
import { VAULT_ERRORS } from "@notesnook/core/dist/api/vault";

View File

@@ -24,10 +24,6 @@ import {
Image as RebassImage,
Text as RebassText
} from "@theme-ui/components";
import {
closeOpenedDialog,
showBuyDialog
} from "../../common/dialog-controller";
import { ANALYTICS_EVENTS, trackEvent } from "../../utils/analytics";
import {
Sync,
@@ -43,6 +39,8 @@ import { store as appStore } from "../../stores/app-store";
import { createBackup } from "../../common";
import { allowedPlatforms } from "../../stores/announcement-store";
import { alpha } from "@theme-ui/color";
import { BuyDialog } from "../../dialogs/buy-dialog/buy-dialog";
import { DialogManager } from "../../common/dialog-manager";
var margins = [0, 2];
var HORIZONTAL_MARGIN = 3;
@@ -285,7 +283,7 @@ function CalltoAction({ action, variant, sx, dismissAnnouncement }) {
sx={sx}
onClick={async () => {
if (dismissAnnouncement) dismissAnnouncement();
closeOpenedDialog();
DialogManager.closeAll();
trackEvent(ANALYTICS_EVENTS.announcementCta, action);
switch (action.type) {
case "link": {
@@ -299,7 +297,7 @@ function CalltoAction({ action, variant, sx, dismissAnnouncement }) {
}
case "promo": {
const [coupon, plan] = action.data.split(":");
await showBuyDialog(plan, coupon);
await BuyDialog.show({ plan, coupon });
break;
}
case "force-sync": {

View File

@@ -38,10 +38,6 @@ import {
Reupload,
Uploading
} from "../icons";
import {
closeOpenedDialog,
showPromptDialog
} from "../../common/dialog-controller";
import { store, useStore } from "../../stores/attachment-store";
import { db } from "../../common/db";
import { saveAttachment } from "../../common/attachments";
@@ -59,6 +55,8 @@ import { getFormattedDate } from "@notesnook/common";
import { MenuItem } from "@notesnook/ui";
import { Attachment as AttachmentType } from "@notesnook/core";
import { useEditorStore } from "../../stores/editor-store";
import { PromptDialog } from "../../dialogs/prompt";
import { DialogManager } from "../../common/dialog-manager";
const FILE_ICONS: Record<string, Icon> = {
"image/": FileImage,
@@ -158,8 +156,7 @@ export function Attachment({
<td>
<Flex
sx={{
alignItems: "center",
maxWidth: compact ? 180 : "95%"
alignItems: "center"
}}
>
{status ? (
@@ -211,7 +208,12 @@ export function Attachment({
<Text
as="td"
variant="body"
sx={{ color: status ? "accent" : "paragraph" }}
sx={{
color: status ? "accent" : "paragraph",
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis"
}}
>
{status ? (
<>
@@ -259,7 +261,7 @@ const AttachmentMenuItems: (
title: note.title,
onClick: () => {
useEditorStore.getState().openSession(note.id);
closeOpenedDialog();
DialogManager.closeAll();
}
});
}
@@ -291,7 +293,7 @@ const AttachmentMenuItems: (
title: "Rename",
icon: Rename.path,
onClick: async () => {
const newName = await showPromptDialog({
const newName = await PromptDialog.show({
title: "Rename attachment",
description: attachment.filename,
defaultValue: attachment.filename

View File

@@ -26,7 +26,7 @@ type ContentToggle = {
onToggle: () => void;
label: string;
dateEdited: number;
resolveConflict: (options: { saveCopy: boolean }) => void;
resolveConflict: (saveCopy: boolean) => void;
readonly: boolean;
sx: FlexProps["sx"];
};
@@ -50,7 +50,7 @@ function ContentToggle(props: ContentToggle) {
<Button
variant="accent"
mr={2}
onClick={() => resolveConflict({ saveCopy: true })}
onClick={() => resolveConflict(true)}
p={1}
px={2}
>
@@ -61,7 +61,7 @@ function ContentToggle(props: ContentToggle) {
variant={isOtherSelected ? "error" : "accent"}
onClick={() => {
if (isOtherSelected) {
resolveConflict({ saveCopy: false });
resolveConflict(false);
} else {
onToggle();
}

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 { useLayoutEffect, useRef, useState } from "react";
import { useCallback, useLayoutEffect, useRef, useState } from "react";
import { Flex, Text, Button } from "@theme-ui/components";
import { Copy, Restore } from "../icons";
import ContentToggle from "./content-toggle";
@@ -45,6 +45,24 @@ function DiffViewer(props: DiffViewerProps) {
);
const root = useRef<HTMLDivElement>(null);
const onResolveContent = useCallback(
(saveCopy: boolean) => {
const toKeep =
selectedContent === 1 ? session.content?.conflicted : session.content;
const toCopy =
selectedContent === 1 ? session.content : session.content?.conflicted;
if (!toKeep) return;
resolveConflict({
note: session.note,
toKeep,
toCopy: saveCopy ? toCopy : undefined,
toKeepDateEdited: toKeep.dateEdited,
dateResolved: conflictedContent!.dateModified
});
},
[conflictedContent, selectedContent, session.content, session.note]
);
useLayoutEffect(() => {
setConflictedContent((c) => {
if (c?.dateEdited === session.content?.conflicted?.dateEdited) return c;
@@ -185,15 +203,7 @@ function DiffViewer(props: DiffViewerProps) {
isSelected={selectedContent === 0}
isOtherSelected={selectedContent === 1}
onToggle={() => setSelectedContent((s) => (s === 0 ? -1 : 0))}
resolveConflict={({ saveCopy }) => {
resolveConflict({
note: session.note,
toKeep: content.data,
toCopy: saveCopy ? conflictedContent : undefined,
toKeepDateEdited: content.dateEdited,
dateResolved: conflictedContent.dateModified
});
}}
resolveConflict={onResolveContent}
sx={{
borderStyle: "solid",
borderWidth: 0,
@@ -263,15 +273,7 @@ function DiffViewer(props: DiffViewerProps) {
<>
<ContentToggle
readonly={session.type === "diff"}
resolveConflict={({ saveCopy }) => {
resolveConflict({
note: session.note,
toKeep: conflictedContent.data,
toCopy: saveCopy ? content : undefined,
toKeepDateEdited: conflictedContent.dateEdited,
dateResolved: conflictedContent.dateModified
});
}}
resolveConflict={onResolveContent}
label={
session.type === "diff"
? "Current version"
@@ -326,17 +328,18 @@ async function resolveConflict({
dateResolved
}: {
note: Note;
toKeep: string;
toKeep: ContentItem;
toCopy?: ContentItem;
toKeepDateEdited: number;
dateResolved?: number;
}) {
await db.content.add({
id: note.contentId,
data: toKeep,
type: "tiptap",
dateResolved,
sessionId: `${Date.now()}`
sessionId: `${Date.now()}`,
...(toKeep.locked
? { data: toKeep.data, locked: true }
: { data: toKeep.data, locked: false })
});
await db.notes.add({

View File

@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { Button, Flex, Text } from "@theme-ui/components";
import { useState } from "react";
import {
ArrowLeft,
Cross,
EditorFullWidth,
EditorNormalWidth,
@@ -34,9 +35,11 @@ import {
Publish,
Published,
Readonly,
Redo,
Search,
TableOfContents,
Trash,
Undo,
Unlock
} from "../icons";
import { ScrollContainer } from "@notesnook/ui";
@@ -71,6 +74,8 @@ import { useStore as useMonographStore } from "../../stores/monograph-store";
import { useStore as useUserStore } from "../../stores/user-store";
import { db } from "../../common/db";
import { showPublishView } from "../publish-view";
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
import useMobile from "../../hooks/use-mobile";
export function EditorActionBar() {
const editorMargins = useEditorStore((store) => store.editorMargins);
@@ -79,19 +84,34 @@ export function EditorActionBar() {
const activeSession = useEditorStore((store) =>
store.activeSessionId ? store.getSession(store.activeSessionId) : undefined
);
const editor = useEditorManager((store) =>
activeSession?.id ? store.editors[activeSession?.id]?.editor : undefined
const editorManager = useEditorManager((store) =>
activeSession?.id ? store.editors[activeSession?.id] : undefined
);
const isLoggedIn = useUserStore((store) => store.isLoggedIn);
const monographs = useMonographStore((store) => store.monographs);
const isNotePublished =
activeSession && db.monographs.isPublished(activeSession.id);
const isMobile = useMobile();
const setIsEditorOpen = useAppStore((store) => store.setIsEditorOpen);
const tools = [
{
title: "Undo",
icon: Undo,
enabled: editorManager?.canUndo,
onClick: () => editorManager?.editor?.undo()
},
{
title: "Redo",
icon: Redo,
enabled: editorManager?.canRedo,
onClick: () => editorManager?.editor?.redo()
},
{
title: isNotePublished ? "Published" : "Publish",
icon: isNotePublished ? Published : Publish,
hidden: !isLoggedIn,
hideOnMobile: true,
enabled:
activeSession &&
(activeSession.type === "default" || activeSession.type === "readonly"),
@@ -105,6 +125,7 @@ export function EditorActionBar() {
title: editorMargins ? "Disable editor margins" : "Enable editor margins",
icon: editorMargins ? EditorNormalWidth : EditorFullWidth,
enabled: true,
hideOnMobile: true,
onClick: () => useEditorStore.getState().toggleEditorMargins()
},
{
@@ -154,7 +175,7 @@ export function EditorActionBar() {
activeSession.type !== "locked" &&
activeSession.type !== "diff" &&
activeSession.type !== "conflicted",
onClick: editor?.startSearch
onClick: editorManager?.editor?.startSearch
},
{
title: "Properties",
@@ -172,7 +193,24 @@ export function EditorActionBar() {
return (
<>
<TabStrip />
{isMobile ? (
<Flex sx={{ flex: 1 }}>
<Button
variant={"secondary"}
sx={{
height: "100%",
bg: "transparent",
borderRadius: 0,
flexShrink: 0
}}
onClick={() => setIsEditorOpen(false)}
>
<ArrowLeft size={18} />
</Button>
</Flex>
) : (
<TabStrip />
)}
{tools.map((tool) => (
<Button
data-test-id={tool.title}
@@ -243,21 +281,21 @@ function TabStrip() {
items={sessions}
moveItem={(from, to) => {
if (from === to) return;
useEditorStore.setState((state) => {
const isToPinned = state.sessions[to].pinned;
const [fromTab] = state.sessions.splice(from, 1);
const sessions = useEditorStore.getState().sessions.slice();
const isToPinned = sessions[to].pinned;
const [fromTab] = sessions.splice(from, 1);
// if the tab where this tab is being dropped is pinned,
// let's pin our tab too.
if (isToPinned) {
fromTab.pinned = true;
fromTab.preview = false;
}
// unpin the tab if it is moved.
else if (fromTab.pinned) fromTab.pinned = false;
// if the tab where this tab is being dropped is pinned,
// let's pin our tab too.
if (isToPinned) {
fromTab.pinned = true;
fromTab.preview = false;
}
// unpin the tab if it is moved.
else if (fromTab.pinned) fromTab.pinned = false;
state.sessions.splice(to, 0, fromTab);
});
sessions.splice(to, 0, fromTab);
useEditorStore.setState({ sessions });
}}
renderItem={({ item: session, index: i }) => (
<Tab
@@ -484,15 +522,11 @@ function Tab(props: TabProps) {
e.stopPropagation();
if (isTemporary) onKeepOpen();
}}
onMouseDown={(e) => {
if (e.button == 1) {
e.preventDefault();
onClose();
}
onAuxClick={(e) => {
if (e.button == 1) onClose();
}}
onClick={(e) => {
e.stopPropagation();
onFocus();
onMouseUp={(e) => {
if (e.button == 0) onFocus();
}}
{...listeners}
{...attributes}
@@ -523,9 +557,11 @@ function Tab(props: TabProps) {
flexShrink: 0
}}
size={14}
onClick={(e) => {
e.stopPropagation();
onPin();
onMouseUp={(e) => {
if (e.button == 0) {
e.stopPropagation();
onPin();
}
}}
/>
) : (
@@ -536,9 +572,11 @@ function Tab(props: TabProps) {
borderRadius: "default",
flexShrink: 0
}}
onClick={(e) => {
e.stopPropagation();
onClose();
onMouseUp={(e) => {
if (e.button == 0) {
e.stopPropagation();
onClose();
}
}}
className="closeTabButton"
size={16}
@@ -593,6 +631,7 @@ function ReorderableList<T extends { id: string }>(
measuring={{
droppable: { strategy: MeasuringStrategy.Always }
}}
modifiers={[restrictToHorizontalAxis]}
>
<SortableContext items={items} strategy={horizontalListSortingStrategy}>
{items.map((item, index) => (

View File

@@ -34,36 +34,28 @@ import { Tag } from "@notesnook/core";
type HeaderProps = { readonly: boolean; id: string };
function Header(props: HeaderProps) {
const { readonly, id } = props;
const session = useEditorStore((store) =>
store.getActiveSession(["default", "readonly"])
const tags = useEditorStore(
(store) => store.getActiveSession(["default", "readonly"])?.tags
);
const tags = session?.tags || [];
const refreshTags = useEditorStore((store) => store.refreshTags);
useEffect(() => {
refreshTags();
}, [id, refreshTags, session?.type]);
const setTag = useCallback(
async function (noteId: string, tags: Tag[], value: string) {
const oldTag = tags.find((t) => t.title === value);
if (oldTag) {
await db.relations.unlink(oldTag, { type: "note", id: noteId });
} else {
const id =
(await db.tags.find(value))?.id ??
(await db.tags.add({ title: value }));
await db.relations.add(
{ id, type: "tag" },
{ type: "note", id: noteId }
);
await useTagStore.getState().refresh();
}
await refreshTags();
await useNoteStore.getState().refresh();
},
[refreshTags]
);
const setTag = useCallback(async function (
noteId: string,
tags: Tag[],
value: string
) {
const oldTag = tags.find((t) => t.title === value);
if (oldTag) {
await db.relations.unlink(oldTag, { type: "note", id: noteId });
} else {
const id =
(await db.tags.find(value))?.id ??
(await db.tags.add({ title: value }));
await db.relations.add({ id, type: "tag" }, { type: "note", id: noteId });
await useTagStore.getState().refresh();
}
await useNoteStore.getState().refresh();
},
[]);
return (
<>
@@ -82,7 +74,7 @@ function Header(props: HeaderProps) {
styles={{ container: { mr: 1 }, text: { fontSize: "body" } }}
/>
))}
{!!session && !readonly && tags ? (
{!readonly && tags ? (
<Autosuggest
sessionId={id}
filter={(query) => db.lookup.tags(query).items(10)}

View File

@@ -64,12 +64,12 @@ import { Freeze } from "react-freeze";
import { UnlockView } from "../unlock";
import DiffViewer from "../diff-viewer";
import TableOfContents from "./table-of-contents";
import { showNoteLinkingDialog } from "../../common/dialog-controller";
import { scrollIntoViewById } from "@notesnook/editor";
import { IEditor } from "./types";
import { EditorActionBar } from "./action-bar";
import { logger } from "../../utils/logger";
import { PanelGroup, Panel, PanelResizeHandle } from "react-resizable-panels";
import { NoteLinkingDialog } from "../../dialogs/note-linking-dialog";
const PDFPreview = React.lazy(() => import("../pdf-preview"));
@@ -127,11 +127,8 @@ export default function TabsView() {
return (
<>
{IS_DESKTOP_APP ? (
ReactDOM.createPortal(
<EditorActionBar />,
document.getElementById("titlebar-portal-container")!
)
{!hasNativeTitlebar ? (
<EditorActionBarPortal />
) : (
<Flex sx={{ px: 1 }}>
<EditorActionBar />
@@ -153,12 +150,7 @@ export default function TabsView() {
<PanelGroup direction="horizontal" autoSaveId={"editor-panels"}>
<Panel id="editor-panel" className="editor-pane" order={1}>
{sessions.map((session) => (
<Freeze
key={session.id}
freeze={
session.needsHydration || session.id !== activeSessionId
}
>
<Freeze key={session.id} freeze={session.id !== activeSessionId}>
{session.type === "locked" ? (
<UnlockNoteView session={session} />
) : session.type === "conflicted" || session.type === "diff" ? (
@@ -233,7 +225,8 @@ const MemoizedEditorView = React.memo(
EditorView,
(prev, next) =>
prev.session.id === next.session.id &&
prev.session.type === next.session.type
prev.session.type === next.session.type &&
prev.session.needsHydration === next.session.needsHydration
);
function EditorView({
session
@@ -244,7 +237,7 @@ function EditorView({
| ReadonlyEditorSession
| DeletedEditorSession;
}) {
const lastChangedTime = useRef<number>(Date.now());
const lastChangedTime = useRef<number>(0);
const root = useRef<HTMLDivElement>(null);
const toggleProperties = useEditorStore((store) => store.toggleProperties);
@@ -302,6 +295,12 @@ function EditorView({
};
}, [editor]);
useEffect(() => {
if (!session.needsHydration && session.content) {
editor?.updateContent(session.content.data);
}
}, [editor, session.needsHydration]);
return (
<Flex
ref={root}
@@ -459,6 +458,7 @@ export function Editor(props: EditorProps) {
<EditorChrome {...props}>
<Tiptap
id={id}
isHydrating={!!session.needsHydration}
nonce={nonce}
readonly={readonly}
content={content}
@@ -466,7 +466,8 @@ export function Editor(props: EditorProps) {
corsHost: Config.get("corsProxy", "https://cors.notesnook.com")
}}
onLoad={(editor) => {
restoreSelection(editor, id);
editor = editor || useEditorManager.getState().getEditor(id)?.editor;
if (editor) restoreSelection(editor, id);
restoreScrollPosition(session);
}}
onSelectionChange={({ from, to }) =>
@@ -544,8 +545,8 @@ export function Editor(props: EditorProps) {
result.forEach((attachment) => editor?.attachFile(attachment));
}}
onInsertInternalLink={async (attributes) => {
const link = await showNoteLinkingDialog(attributes);
return link;
const link = await NoteLinkingDialog.show({ attributes });
return link || undefined;
}}
>
{headless ? null : (
@@ -629,8 +630,8 @@ function EditorChrome(props: PropsWithChildren<EditorProps>) {
maxWidth: editorMargins ? "min(100%, 850px)" : "auto",
width: "100%"
}}
pl={6}
pr={6}
pl={[2, 2, 6]}
pr={[2, 2, 6]}
onClick={onRequestFocus}
>
{children}
@@ -762,19 +763,31 @@ function restoreScrollPosition(session: EditorSession) {
const scrollContainer = document.getElementById(`editorScroll_${session.id}`);
const scrollPosition = Config.get(`${session.id}:scroll-position`, 0);
if (scrollContainer) {
setTimeout(() => {
requestAnimationFrame(() => {
if (scrollContainer.scrollHeight < scrollPosition)
scrollContainer.style.minHeight = `${scrollPosition + 100}px`;
scrollContainer.scrollTop = scrollPosition;
if (scrollContainer.scrollHeight < scrollPosition) {
const observer = new ResizeObserver(() => {
if (scrollContainer.scrollHeight >= scrollPosition) {
observer.disconnect();
requestAnimationFrame(
() => (scrollContainer.scrollTop = scrollPosition)
);
clearTimeout(timeout);
}
});
});
observer.observe(scrollContainer);
// eslint-disable-next-line no-var
var timeout = setTimeout(() => {
observer.disconnect();
}, 30 * 1000);
} else
requestAnimationFrame(() => (scrollContainer.scrollTop = scrollPosition));
}
}
function restoreSelection(editor: IEditor, id: string) {
editor.focus({
position: Config.get(`${id}:selection`, { from: 0, to: 0 })
setTimeout(() => {
editor.focus({
position: Config.get(`${id}:selection`, { from: 0, to: 0 })
});
});
}
@@ -811,7 +824,7 @@ function UnlockNoteView(props: UnlockNoteViewProps) {
throw new Error("note with this id does not exist.");
useEditorStore.getState().addSession({
type: "default",
type: session.note.readonly ? "readonly" : "default",
locked: true,
id: session.id,
note: session.note,
@@ -826,3 +839,9 @@ function UnlockNoteView(props: UnlockNoteViewProps) {
</div>
);
}
function EditorActionBarPortal() {
const container = document.getElementById("titlebar-portal-container");
if (!container) return null;
return ReactDOM.createPortal(<EditorActionBar />, container);
}

View File

@@ -20,22 +20,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { SerializedKey } from "@notesnook/crypto/dist/src/types";
import { AppEventManager, AppEvents } from "../../common/app-events";
import { db } from "../../common/db";
import {
showBuyDialog,
showImagePickerDialog
} from "../../common/dialog-controller";
import { TaskManager } from "../../common/task-manager";
import { isUserPremium } from "../../hooks/use-is-user-premium";
import { showToast } from "../../utils/toast";
import { showFilePicker } from "../../utils/file-picker";
import { Attachment } from "@notesnook/editor";
import { ImagePickerDialog } from "../../dialogs/image-picker-dialog";
import { BuyDialog } from "../../dialogs/buy-dialog";
const FILE_SIZE_LIMIT = 500 * 1024 * 1024;
const IMAGE_SIZE_LIMIT = 50 * 1024 * 1024;
export async function insertAttachments(type = "*/*") {
if (!isUserPremium()) {
await showBuyDialog();
await BuyDialog.show({});
return;
}
@@ -49,14 +47,17 @@ export async function insertAttachments(type = "*/*") {
export async function attachFiles(files: File[]) {
if (!isUserPremium()) {
await showBuyDialog();
await BuyDialog.show({});
return;
}
const images =
(await showImagePickerDialog(
files.filter((f) => f.type.startsWith("image/"))
)) || [];
let images = files.filter((f) => f.type.startsWith("image/"));
images =
images.length > 0
? (await ImagePickerDialog.show({
images
})) || []
: [];
const documents = files.filter((f) => !f.type.startsWith("image/"));
const attachments: Attachment[] = [];
for (const file of [...images, ...documents]) {

View File

@@ -149,7 +149,7 @@ function TableOfContents(props: TableOfContentsProps) {
key={t.id}
sx={{
textAlign: "left",
paddingLeft: `${t.level * 5}px`,
paddingLeft: `${t.level * 5 + (t.level - 1) * 5}px`,
py: 1,
pr: 1,
borderLeft: "5px solid transparent",

View File

@@ -48,7 +48,6 @@ import {
import { IEditor, MAX_AUTO_SAVEABLE_WORDS } from "./types";
import { useEditorConfig, useToolbarConfig, useEditorManager } from "./manager";
import { useIsUserPremium } from "../../hooks/use-is-user-premium";
import { showBuyDialog } from "../../common/dialog-controller";
import { useStore as useSettingsStore } from "../../stores/setting-store";
import { debounce } from "@notesnook/common";
import { ScopedThemeProvider } from "../theme-provider";
@@ -59,6 +58,10 @@ import { writeToClipboard } from "../../utils/clipboard";
import { useEditorStore } from "../../stores/editor-store";
import { parseInternalLink } from "@notesnook/core";
import Skeleton from "react-loading-skeleton";
import useMobile from "../../hooks/use-mobile";
import useTablet from "../../hooks/use-tablet";
import { TimeFormat } from "@notesnook/core/dist/utils/date";
import { BuyDialog } from "../../dialogs/buy-dialog";
export type OnChangeHandler = (
content: () => string,
@@ -67,7 +70,7 @@ export type OnChangeHandler = (
type TipTapProps = {
id: string;
editorContainer: () => HTMLElement | undefined;
onLoad?: (editor: IEditor) => void;
onLoad?: (editor?: IEditor) => void;
onChange?: OnChangeHandler;
onContentChange?: () => void;
onSelectionChange?: (range: { from: number; to: number }) => void;
@@ -89,9 +92,15 @@ type TipTapProps = {
readonly?: boolean;
nonce?: number;
isMobile?: boolean;
isTablet?: boolean;
downloadOptions?: DownloadOptions;
fontSize: number;
fontFamily: string;
doubleSpacedLines: boolean;
dateFormat: string;
timeFormat: TimeFormat;
markdownShortcuts: boolean;
};
function updateWordCount(id: string, content: () => Fragment) {
@@ -127,21 +136,18 @@ function TipTap(props: TipTapProps) {
readonly,
nonce,
isMobile,
isTablet,
downloadOptions,
fontSize,
fontFamily
fontFamily,
doubleSpacedLines,
dateFormat,
timeFormat,
markdownShortcuts
} = props;
const isUserPremium = useIsUserPremium();
const autoSave = useRef(true);
const doubleSpacedLines = useSettingsStore(
(store) => store.doubleSpacedParagraphs
);
const dateFormat = useSettingsStore((store) => store.dateFormat);
const timeFormat = useSettingsStore((store) => store.timeFormat);
const markdownShortcuts = useSettingsStore(
(store) => store.markdownShortcuts
);
const { toolbarConfig } = useToolbarConfig();
usePermissionHandler({
@@ -149,7 +155,7 @@ function TipTap(props: TipTapProps) {
premium: isUserPremium
},
onPermissionDenied: (claim) => {
if (claim === "premium") showBuyDialog();
if (claim === "premium") BuyDialog.show({});
}
});
@@ -245,10 +251,13 @@ function TipTap(props: TipTapProps) {
onDestroy: () => {
useEditorManager.getState().setEditor(id);
},
onTransaction: ({ editor }) => {
onTransaction: ({ editor, transaction }) => {
useEditorManager.getState().updateEditor(id, {
canRedo: editor.can().redo(),
canUndo: editor.can().undo()
canUndo: editor.can().undo(),
tableOfContents: transaction.getMeta("isUpdatingContent")
? getTableOfContents(editor.view.dom)
: useEditorManager.getState().getEditor(id)?.tableOfContents
});
},
copyToClipboard(text, html) {
@@ -358,7 +367,12 @@ function TipTap(props: TipTapProps) {
>
<Toolbar
editor={editor}
location={isMobile ? "bottom" : "top"}
location={"top"}
sx={
isTablet || isMobile
? { overflowX: "scroll", flexWrap: "nowrap" }
: {}
}
tools={toolbarConfig}
defaultFontFamily={fontFamily}
defaultFontSize={fontSize}
@@ -370,15 +384,38 @@ function TipTap(props: TipTapProps) {
function TiptapWrapper(
props: PropsWithChildren<
Omit<TipTapProps, "editorContainer" | "theme" | "fontSize" | "fontFamily">
>
Omit<
TipTapProps,
| "editorContainer"
| "theme"
| "fontSize"
| "fontFamily"
| "doubleSpacedLines"
| "dateFormat"
| "timeFormat"
| "markdownShortcuts"
>
> & {
isHydrating?: boolean;
}
) {
const { onLoad, isHydrating } = props;
const theme = useThemeStore((store) =>
store.colorScheme === "dark" ? store.darkTheme : store.lightTheme
);
const doubleSpacedLines = useSettingsStore(
(store) => store.doubleSpacedParagraphs
);
const dateFormat = useSettingsStore((store) => store.dateFormat);
const timeFormat = useSettingsStore((store) => store.timeFormat);
const markdownShortcuts = useSettingsStore(
(store) => store.markdownShortcuts
);
const containerRef = useRef<HTMLDivElement>(null);
const editorContainerRef = useRef<HTMLDivElement>();
const { editorConfig } = useEditorConfig();
const isMobile = useMobile();
const isTablet = useTablet();
useLayoutEffect(() => {
if (
@@ -397,22 +434,42 @@ function TiptapWrapper(
theme.scopes.base.primary.paragraph;
}, [theme]);
useEffect(() => {
if (!isHydrating) {
onLoad?.();
containerRef.current
?.querySelector(".editor-loading-container")
?.classList.add("hidden");
}
}, [isHydrating]);
return (
<Flex
ref={containerRef}
sx={{
flex: 1,
flexDirection: "column",
".tiptap.ProseMirror": { pb: 150 }
".tiptap.ProseMirror": { pb: 150 },
".editor-container": { opacity: isHydrating ? 0 : 1 },
".editor-loading-container.hidden": { display: "none" }
}}
>
<TipTap
key={`tiptap-${props.id}-${doubleSpacedLines}-${dateFormat}-${timeFormat}-${markdownShortcuts}`}
{...props}
isMobile={isMobile}
isTablet={isTablet}
doubleSpacedLines={doubleSpacedLines}
dateFormat={dateFormat}
timeFormat={timeFormat}
markdownShortcuts={markdownShortcuts}
onLoad={(editor) => {
props.onLoad?.(editor);
containerRef.current
?.querySelector(".editor-loading-container")
?.remove();
if (!isHydrating) {
onLoad?.(editor);
containerRef.current
?.querySelector(".editor-loading-container")
?.classList.add("hidden");
}
}}
editorContainer={() => {
if (editorContainerRef.current) return editorContainerRef.current;
@@ -471,6 +528,7 @@ function toIEditor(editor: Editor): IEditor {
?.chain()
.command(({ tr }) => {
tr.setMeta("preventSave", true);
tr.setMeta("isUpdatingContent", true);
return true;
})
.setContent(content, false, { preserveWhitespace: true })

View File

@@ -23,7 +23,7 @@ import { useEditorStore } from "../../stores/editor-store";
import { debounceWithId } from "@notesnook/common";
import useMobile from "../../hooks/use-mobile";
import useTablet from "../../hooks/use-tablet";
import { useEditorConfig } from "./manager";
import { useEditorConfig, useEditorManager } from "./manager";
import { getFontById } from "@notesnook/editor";
import { replaceDateTime } from "@notesnook/editor/dist/extensions/date-time";
import { useStore as useSettingsStore } from "../../stores/setting-store";
@@ -131,6 +131,13 @@ function TitleBox(props: TitleBoxProps) {
color: "placeholder"
}
}}
onKeyUp={(e) => {
if (e.key === "Enter") {
const context = useEditorManager.getState().getEditor(id);
if (!context) return;
context.editor?.focus({ scrollIntoView: true });
}
}}
onChange={(e) => {
pendingChanges.current = true;
e.target.value = replaceDateTime(

View File

@@ -17,15 +17,43 @@ 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 { PropsWithChildren } from "react";
import { PropsWithChildren, useEffect } from "react";
import { ErrorText } from "../error-text";
import { BaseThemeProvider } from "../theme-provider";
import { Button, Flex, Text } from "@theme-ui/components";
import {
ErrorBoundary as RErrorBoundary,
FallbackProps
FallbackProps,
useErrorBoundary
} from "react-error-boundary";
import { createDialect } from "../../common/sqlite";
import { useKeyStore } from "../../interfaces/key-store";
import { isFeatureSupported } from "../../utils/feature-check";
export function GlobalErrorHandler(props: PropsWithChildren) {
const { showBoundary } = useErrorBoundary();
useEffect(() => {
function handleError(e: ErrorEvent) {
const error = new Error(e.message);
error.stack = `${e.filename}:${e.lineno}:${e.colno}`;
showBoundary(e.error || error);
}
function handleUnhandledRejection(e: PromiseRejectionEvent) {
showBoundary(e.reason);
}
window.addEventListener("unhandledrejection", handleUnhandledRejection);
window.addEventListener("error", handleError);
return () => {
window.removeEventListener(
"unhandledrejection",
handleUnhandledRejection
);
window.removeEventListener("error", handleError);
};
}, [showBoundary]);
return <>{props.children}</>;
}
export function ErrorBoundary(props: PropsWithChildren) {
return (
@@ -170,14 +198,9 @@ function getErrorHelp(props: FallbackProps) {
return {
explanation: `This error usually means the database file is either corrupt or it could not be decrypted.`,
action:
"This error can only be fixed by wiping & reseting the database. Beware that this will wipe all your data inside the database with no way to recover it later on.",
"This error can only be fixed by wiping & reseting the database. Beware that this will wipe all your data inside the database with no way to recover it later on. This WILL NOT change/affect/delete/wipe your data on the server but ONLY on this device.",
fix: async () => {
const { useKeyStore } = await import("../../interfaces/key-store");
await useKeyStore.getState().clear();
const dialect = createDialect("notesnook");
const driver = dialect.createDriver();
await driver.delete();
await resetDatabase();
resetErrorBoundary();
}
};
@@ -185,14 +208,9 @@ function getErrorHelp(props: FallbackProps) {
return {
explanation: `This error means the at rest encryption key could not be decrypted. This can be due to data corruption or implementation change.`,
action:
"This error can only be fixed by wiping & reseting the Key Store and the database.",
"This error can only be fixed by wiping & reseting the Key Store and the database. This WILL NOT change/affect/delete/wipe your data on the server but ONLY on this device.",
fix: async () => {
const { useKeyStore } = await import("../../interfaces/key-store");
await useKeyStore.getState().clear();
const dialect = createDialect("notesnook");
const driver = dialect.createDriver();
await driver.delete();
await resetDatabase();
resetErrorBoundary();
}
};
@@ -217,3 +235,17 @@ function errorToString(error: unknown) {
? error
: JSON.stringify(error);
}
async function resetDatabase() {
const { createDialect } = await import("../../common/sqlite");
const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs");
await useKeyStore.getState().clear();
const dialect = createDialect({
name: "notesnook",
encrypted: true,
async: !isFeatureSupported("opfs"),
multiTab
});
const driver = dialect.createDriver();
await driver.delete();
}

View File

@@ -213,7 +213,8 @@ import {
mdiFormatListBulleted,
mdiLink,
mdiWindowClose,
mdiFileMusicOutline
mdiFileMusicOutline,
mdiBroom
} from "@mdi/js";
import { useTheme } from "@emotion/react";
import { Theme } from "@notesnook/theme";
@@ -548,3 +549,4 @@ export const WindowRestore = createIcon(
"M8 16V4h12v12Zm2-2h8V6h-8Zm-6 6V8.525h2V18h9.475v2Zm6-6V6v8Z"
);
export const WindowClose = createIcon(mdiWindowClose);
export const ClearCache = createIcon(mdiBroom);

View File

@@ -340,9 +340,9 @@ export class Lightbox extends React.Component<LightboxProps> {
overflow: "hidden",
alignItems: "center",
justifyContent: "flex-end",
height: IS_DESKTOP_APP ? TITLE_BAR_HEIGHT : "auto",
height: !hasNativeTitlebar ? TITLE_BAR_HEIGHT : "auto",
pr:
IS_DESKTOP_APP && getPlatform() !== "darwin"
!hasNativeTitlebar && getPlatform() !== "darwin"
? "calc(100vw - env(titlebar-area-width))"
: 0
}}

View File

@@ -31,19 +31,24 @@ import {
store as selectionStore
} from "../../stores/selection-store";
import GroupHeader from "../group-header";
import { DEFAULT_ITEM_HEIGHT, ListItemWrapper } from "./list-profiles";
import {
ListItemWrapper,
getListItemDefaultHeight,
getListItemPlaceholderData
} from "./list-profiles";
import Announcements from "../announcements";
import { ListLoader } from "../loaders/list-loader";
import ScrollContainer from "../scroll-container";
import { useKeyboardListNavigation } from "../../hooks/use-keyboard-list-navigation";
import { VirtualizedGrouping, GroupingKey, Item } from "@notesnook/core";
import {
FlatScrollIntoViewLocation,
ItemProps,
ScrollerProps,
Virtuoso,
VirtuosoHandle
} from "react-virtuoso";
import { useResolvedItem } from "@notesnook/common";
import { getRandom, useResolvedItem } from "@notesnook/common";
import { Context } from "./types";
import { AppEventManager, AppEvents } from "../../common/app-events";
@@ -76,7 +81,6 @@ type ListContainerProps = {
onClick: () => void;
};
};
var activeItem: { focus: boolean; id: string } | undefined = undefined;
function ListContainer(props: ListContainerProps) {
const { group, items, context, refresh, header, button, compact } = props;
@@ -92,6 +96,7 @@ function ListContainer(props: ListContainerProps) {
const listRef = useRef<VirtuosoHandle>(null);
const listContainerRef = useRef(null);
const activeItem = useRef<{ focus: boolean; id: string }>();
useEffect(() => {
return () => {
@@ -100,18 +105,18 @@ function ListContainer(props: ListContainerProps) {
}, []);
useLayoutEffect(() => {
if (activeItem) {
if (activeItem.current) {
items
.ids()
.then(
(ids) =>
listRef.current &&
activeItem &&
activeItem.current &&
revealItemInList(
listRef.current,
activeItem.id,
activeItem.current.id,
ids,
activeItem.focus
activeItem.current.focus
)
);
}
@@ -119,8 +124,8 @@ function ListContainer(props: ListContainerProps) {
const event = AppEventManager.subscribe(
AppEvents.revealItemInList,
(id, focus) => {
if (activeItem?.id === id) return;
activeItem = { id, focus };
if (activeItem.current?.id === id) return;
activeItem.current = { id, focus };
items
.ids()
.then(
@@ -135,7 +140,7 @@ function ListContainer(props: ListContainerProps) {
};
}, [items]);
const { onFocus, onMouseDown, onKeyDown } = useKeyboardListNavigation({
const { onMouseUp, onKeyDown } = useKeyboardListNavigation({
length: items.length,
reset: () => toggleSelection(false),
deselect: (index) => {
@@ -206,7 +211,7 @@ function ListContainer(props: ListContainerProps) {
<Virtuoso
ref={listRef}
computeItemKey={(index) => items.key(index)}
defaultItemHeight={DEFAULT_ITEM_HEIGHT}
defaultItemHeight={getListItemDefaultHeight(group, compact)}
totalCount={items.length}
onBlur={() => setFocusedGroupIndex(-1)}
onKeyDown={(e) => onKeyDown(e.nativeEvent)}
@@ -215,7 +220,7 @@ function ListContainer(props: ListContainerProps) {
Item: VirtuosoItem,
Header: ListHeader
}}
increaseViewportBy={{ top: 10, bottom: 10 }}
increaseViewportBy={{ top: 200, bottom: 200 }}
context={{
header,
items,
@@ -227,8 +232,7 @@ function ListContainer(props: ListContainerProps) {
focusGroup: setFocusedGroupIndex,
context,
compact,
onMouseDown,
onFocus
onMouseUp
}}
itemContent={(index, _data, context) => (
<ItemRenderer context={context} index={index} />
@@ -256,7 +260,7 @@ function ListContainer(props: ListContainerProps) {
height: 45
}}
>
<Plus color="static" />
<Plus color="accentForeground" />
</Button>
)}
</Flex>
@@ -279,8 +283,7 @@ type ListContext = {
context?: Context;
compact?: boolean;
onMouseDown: (e: MouseEvent, itemIndex: number) => void;
onFocus: (itemIndex: number) => void;
onMouseUp: (e: MouseEvent, itemIndex: number) => void;
};
function ItemRenderer({
index,
@@ -302,78 +305,32 @@ function ItemRenderer({
} = context;
const resolvedItem = useResolvedItem({ index, items });
if (!resolvedItem || !resolvedItem.item) {
if (compact)
return (
<div
key="list-item-skeleton"
style={{
padding: 5,
height: 12,
width: "50%",
backgroundColor: "var(--background-secondary)"
}}
/>
);
const placeholderData = getListItemPlaceholderData(group, compact);
return (
<div
key="list-item-skeleton"
style={{
display: "flex",
flexDirection: "column",
paddingTop: 10,
paddingBottom: 10,
paddingLeft: 5,
paddingRight: 5,
gap: 5
paddingTop: placeholderData.padding[0],
paddingRight: placeholderData.padding[1],
paddingBottom: placeholderData.padding[2],
paddingLeft: placeholderData.padding[3],
gap: placeholderData.gap
}}
>
<div
style={{
height: 16,
width: "50%",
backgroundColor: "var(--background-secondary)"
}}
/>
<div
style={{
height: 12,
width: "100%",
backgroundColor: "var(--background-secondary)"
}}
/>
<div
style={{
height: 12,
width: "100%",
backgroundColor: "var(--background-secondary)"
}}
/>
<div style={{ display: "flex", gap: 5 }}>
<span
{placeholderData.lines.map((line, index) => (
<div
key={`${index}`}
style={{
height: 10,
width: "50px",
backgroundColor: "var(--background-secondary)"
height: line.height,
width:
line.width === "random" ? `${getRandom(20, 60)}%` : line.width,
backgroundColor: "var(--background-secondary)",
borderRadius: line.height / 4
}}
/>
<span
style={{
height: 10,
width: 10,
borderRadius: 50,
backgroundColor: "var(--background-secondary)"
}}
/>
<span
style={{
height: 10,
width: 10,
borderRadius: 50,
backgroundColor: "var(--background-secondary)"
}}
/>
</div>
))}
</div>
);
}
@@ -436,9 +393,8 @@ function VirtuosoItem({
return (
<div
{...props}
onFocus={() => context?.onFocus(props["data-item-index"])}
onMouseDown={(e) =>
context?.onMouseDown(e.nativeEvent, props["data-item-index"])
onMouseUp={(e) =>
context?.onMouseUp(e.nativeEvent, props["data-item-index"])
}
>
{props.children}
@@ -461,11 +417,13 @@ function waitForElement(
list: VirtuosoHandle,
index: number,
elementId: string,
callback: (element: HTMLElement) => void
callback: (element: HTMLElement) => void,
options?: Partial<FlatScrollIntoViewLocation>
) {
let waitInterval = 0;
let maxAttempts = 3;
list.scrollIntoView({
...options,
index,
done: function scrollDone() {
if (!maxAttempts) return;
@@ -497,6 +455,7 @@ function revealItemInList(
list,
index,
`id_${itemId}`,
(element) => focus && element.focus()
(element) => focus && element.focus(),
{ align: "center" }
);
}

View File

@@ -40,11 +40,10 @@ type ListItemWrapperProps = {
data?: unknown;
context?: Context;
compact?: boolean;
simplified?: boolean;
};
export function ListItemWrapper(props: ListItemWrapperProps) {
const { group, compact, context, simplified, item, data } = props;
const { group, compact, context, item, data } = props;
switch (item.type) {
case "note": {
@@ -64,13 +63,13 @@ export function ListItemWrapper(props: ListItemWrapperProps) {
item={item}
totalNotes={typeof data === "number" ? data : 0}
date={getDate(item, group)}
simplified={simplified}
compact={compact}
/>
);
case "trash":
return <TrashItem item={item} date={getDate(item, group)} />;
case "reminder":
return <Reminder item={item} simplified={simplified} />;
return <Reminder item={item} compact={compact} />;
case "tag":
return (
<Tag item={item} totalNotes={typeof data === "number" ? data : 0} />
@@ -82,6 +81,66 @@ export function ListItemWrapper(props: ListItemWrapperProps) {
}
}
type PlaceholderData = {
padding: [number, number, number, number];
lines: { height: number; width: "random" | string | number }[];
gap?: number;
};
const COMPACT_PLACEHOLDER_ITEM_DATA: PlaceholderData = {
padding: [6, 5, 6, 5],
lines: [{ height: 16, width: `random` }]
};
const FULL_PLACEHOLDER_ITEM_DATA: PlaceholderData = {
padding: [10, 5, 10, 5],
gap: 5,
lines: [
{
height: 16,
width: "50%"
},
{
height: 12,
width: "100%"
},
{
height: 12,
width: "70%"
},
{
height: 10,
width: 30
}
]
};
export function getListItemDefaultHeight(
group: GroupingKey | undefined,
compact: boolean | undefined
) {
const data = getListItemPlaceholderData(group, compact);
let height = data.padding[0] + data.padding[2];
if (data.gap) height += data.gap * data.lines.length - 1;
data.lines.forEach((line) => (height += line.height));
return height;
}
export function getListItemPlaceholderData(
group: GroupingKey | undefined,
compact: boolean | undefined
): PlaceholderData {
switch (group) {
case "home":
case "favorites":
case "notes":
case "notebooks":
case "trash":
case "reminders":
if (compact) return COMPACT_PLACEHOLDER_ITEM_DATA;
return FULL_PLACEHOLDER_ITEM_DATA;
case "tags":
default:
return COMPACT_PLACEHOLDER_ITEM_DATA;
}
}
function getDate(item: Item, groupType?: GroupingKey): number {
return (
getSortValue(

View File

@@ -40,7 +40,6 @@ type ListItemProps<TItem extends Item, TContext> = {
isFocused?: boolean;
isCompact?: boolean;
isDisabled?: boolean;
isSimple?: boolean;
item: TItem;
draggable?: boolean;
@@ -76,7 +75,6 @@ function ListItem<TItem extends Item, TContext>(
isFocused,
isCompact,
isDisabled,
isSimple,
item,
sx,
context,
@@ -203,12 +201,12 @@ function ListItem<TItem extends Item, TContext>(
<Text
dir="auto"
data-test-id={`title`}
variant={isSimple || isCompact ? "body" : "subtitle"}
variant={isCompact ? "body" : "subtitle"}
sx={{
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
fontWeight: isCompact || isSimple ? "body" : "bold",
fontWeight: isCompact ? "body" : "bold",
color:
selected && heading === "heading"
? `${heading}-selected`
@@ -222,7 +220,7 @@ function ListItem<TItem extends Item, TContext>(
props.title
)}
{!isSimple && !isCompact && props.body && (
{!isCompact && props.body && (
<Text
as="p"
variant="body"

View File

@@ -27,28 +27,6 @@ const Lines = [1, 2].map(() => getRandomArbitrary(40, 90));
export const ListLoader = memo(function ListLoader() {
return (
<>
<Flex
sx={{ py: 1, alignItems: "center", justifyContent: "center", px: 1 }}
>
<Box sx={{ height: 38 }}>
<Skeleton enableAnimation={false} width={38} height={38} circle />
</Box>
<Flex
sx={{
flex: 1,
ml: 1,
flexDirection: "column",
justifyContent: "center"
}}
>
<Box sx={{ height: 14 }}>
<Skeleton enableAnimation={false} inline height={14} />
</Box>
<Box sx={{ mt: 1, height: 10 }}>
<Skeleton enableAnimation={false} inline height={10} />
</Box>
</Flex>
</Flex>
{Lines.map((width) => (
<Box key={width} sx={{ py: 2, px: 1 }}>
<Skeleton

View File

@@ -43,7 +43,6 @@ import NavigationItem, { SortableNavigationItem } from "./navigation-item";
import { hardNavigate, hashNavigate, navigate } from "../../navigation";
import { db } from "../../common/db";
import useMobile from "../../hooks/use-mobile";
import { showRenameColorDialog } from "../../common/dialog-controller";
import { useStore as useAppStore } from "../../stores/app-store";
import { useStore as useUserStore } from "../../stores/user-store";
import { useStore as useThemeStore } from "../../stores/theme-store";
@@ -71,6 +70,8 @@ import { usePersistentState } from "../../hooks/use-persistent-state";
import { MenuItem } from "@notesnook/ui";
import { Notebook, Tag } from "@notesnook/core";
import { handleDrop } from "../../common/drop-handler";
import { Menu } from "../../hooks/use-menu";
import { RenameColorDialog } from "../../dialogs/item-dialog";
type Route = {
id: string;
@@ -172,6 +173,24 @@ function NavigationMenu(props: NavigationMenuProps) {
const getSidebarItems = useCallback(async () => {
return [
{
key: "reset-sidebar",
type: "button",
title: "Reset sidebar",
onClick: () => {
db.settings
.setSideBarHiddenItems("routes", [])
.then(() => db.settings.setSideBarHiddenItems("colors", []))
.then(() => db.settings.setSideBarOrder("colors", []))
.then(() => db.settings.setSideBarOrder("routes", []))
.then(() => db.settings.setSideBarOrder("shortcuts", []))
.then(() => {
setHiddenRoutes([]);
setHiddenColors([]);
});
}
},
{ type: "separator", key: "sep" },
...toMenuItems(
orderItems(routes, db.settings.getSideBarOrder("routes")),
hiddenRoutes,
@@ -180,7 +199,7 @@ function NavigationMenu(props: NavigationMenuProps) {
.setSideBarHiddenItems("routes", ids)
.then(() => setHiddenRoutes(ids))
),
{ type: "separator", key: "sep" },
{ type: "separator", key: "sep", isHidden: colors.length <= 0 },
...toMenuItems(
orderItems(colors, db.settings.getSideBarOrder("colors")),
hiddenColors,
@@ -225,6 +244,10 @@ function NavigationMenu(props: NavigationMenuProps) {
justifyContent: "space-between"
}}
px={0}
onContextMenu={async (e) => {
e.preventDefault();
Menu.openMenu(await getSidebarItems());
}}
>
<FlexScrollContainer
style={{
@@ -345,7 +368,7 @@ function NavigationMenu(props: NavigationMenuProps) {
type: "button",
key: "rename-color",
title: "Rename color",
onClick: () => showRenameColorDialog(color)
onClick: () => RenameColorDialog.show(color)
},
{
type: "button",

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