Compare commits

..

192 Commits

Author SHA1 Message Date
Ammar Ahmed
bb42a2e1a4 ci: skip testflight 2024-08-08 10:19:10 +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
Abdullah Atta
54a68e4406 themebuilder: bump version to 1.2.0 2024-05-18 13:09:49 +05:00
Abdullah Atta
bd73ae9df4 theme: add titleBar to theme scopes 2024-05-18 13:09:49 +05:00
Abdullah Atta
fe41f7b687 themebuilder: make theme builder compile 2024-05-18 13:09:49 +05:00
Ammar Ahmed
c9adaa2442 mobile: release v3.0.7 2024-05-17 12:41:13 +05:00
Abdullah Atta
10be5771c6 web: bump version to 3.0.6 2024-05-17 12:31:22 +05:00
Abdullah Atta
43f4669360 core: fix notes with no conflict marked as conflicted 2024-05-17 12:29:58 +05:00
Ammar Ahmed
3b04925e54 mobile: update changelog 2024-05-17 09:58:43 +05:00
Ammar Ahmed
ba3959af9e mobile: release v3.0.6 2024-05-17 09:58:08 +05:00
Ammar Ahmed
552d86d9d2 mobile: fix android compilation on java 17 2024-05-17 09:56:51 +05:00
Ammar Ahmed
096602150e mobile: fix encryption key not found error on login 2024-05-17 09:56:51 +05:00
Abdullah Atta
e5795bcbb2 web: fix app asking password on auto backups with encryption off 2024-05-16 16:25:04 +05:00
Ammar Ahmed
9be52a69ad mobile: add changelog 2024-05-16 15:45:38 +05:00
Ammar Ahmed
5809384f62 mobile: release v3.0.5 2024-05-16 15:44:48 +05:00
Ammar Ahmed
fff70dce16 mobile: fix recovery key dialog ui 2024-05-16 15:14:14 +05:00
Ammar Ahmed
258140b1e0 mobile: fix share widget title issues
1. Do not change title of note when choosing append to note
2. Fix color of title in widget
2024-05-16 12:07:29 +05:00
Ammar Ahmed
0a00844e64 mobile: fix locked note title cannot be edited 2024-05-16 12:07:05 +05:00
Abdullah Atta
03cea85efc web: bump version to 3.0.5 2024-05-16 11:57:12 +05:00
Abdullah Atta
8a16ef9b85 web: fix unlock a note for editing test 2024-05-16 11:55:50 +05:00
Abdullah Atta
c82c30b530 editor: fix search replace 2024-05-16 11:34:10 +05:00
Abdullah Atta
46599f66da web: fix search not working in readonly editor 2024-05-16 11:33:53 +05:00
Abdullah Atta
d1b532a4ae editor: show (empty) toolbar in readonly mode 2024-05-16 11:33:53 +05:00
Abdullah Atta
0baf7afc25 web: allow locked note duplication without unlocking 2024-05-16 09:31:46 +05:00
Abdullah Atta
a0595a7d23 core: copy all note relations when duplicating 2024-05-16 09:31:46 +05:00
Abdullah Atta
1e6f6ab477 core: fix Cannot read properties of undefined (reading 'startsWith') error on export 2024-05-16 09:31:18 +05:00
Abdullah Atta
62d677f9ad web: fix web app not working on safari 2024-05-16 09:30:49 +05:00
Abdullah Atta
8de98d98ab core: fix merger tests 2024-05-16 09:30:28 +05:00
Ammar Ahmed
5b57614bfe mobile: fix app lock issues 2024-05-16 09:27:27 +05:00
Ammar Ahmed
ae7c538ad7 mobile: enable privacy screen with applock 2024-05-16 09:27:27 +05:00
Ammar Ahmed
c6394c9e37 mobile: allow removing app lock with account password 2024-05-16 09:27:27 +05:00
Ammar Ahmed
acf3740a68 mobile: fix pricing plans stuck at loading 2024-05-16 09:24:19 +05:00
Ammar Ahmed
8423543904 mobile: show diff in note history 2024-05-16 09:23:45 +05:00
Abdullah Atta
b90cb28637 web: handle corrupted+migrations: error 2024-05-16 08:40:03 +05:00
Abdullah Atta
780e1e9db0 web: reopen editor session if conflict is resolved/created 2024-05-15 12:37:50 +05:00
Abdullah Atta
ca6f8e5e4b web: fix real time sync ignored when resolved content is synced 2024-05-15 12:37:08 +05:00
Abdullah Atta
4c4cda1c39 core: create conflict if local item is unsynced
previously we were only creating a conflict when the local item was
edited after the remote item. This failed in cases where even though
the local item was edited before the remote item, it still contained
important information.

Now we only check if the local item is synced or not. If it isn't synced,
we most probably want to preserve the local changes, or at least want
to be notified.
2024-05-15 12:36:38 +05:00
Abdullah Atta
6fcbde772c core: fix notes marked as conflicted wrongly 2024-05-15 12:34:23 +05:00
Abdullah Atta
eac1750b1c core: add test for merge conflicts during sync 2024-05-14 15:21:00 +05:00
Abdullah Atta
5eea179a58 core: set conflicted property on notes after fetch is done 2024-05-14 15:21:00 +05:00
Abdullah Atta
fe1ea6dc27 core: do not update dateModified when updating content internally 2024-05-14 15:21:00 +05:00
Abdullah Atta
cf1b774255 core: filter out conflicted notes & content during sync 2024-05-14 15:21:00 +05:00
Abdullah Atta
198fa33fc0 core: do not update dateModified when setting synced=true 2024-05-14 15:21:00 +05:00
Abdullah Atta
e722866d62 web: better handling of database disk image is malformed error 2024-05-14 15:21:00 +05:00
Ammar Ahmed
58845e5508 mobile: release v3.0.4 2024-05-11 15:19:12 +05:00
Abdullah Atta
543c6f17ed web: enable sourcemaps for web app 2024-05-11 13:09:59 +05:00
Abdullah Atta
533f95fcff editor: fix editor crash due to TypeError: t.startsWith is not a function 2024-05-11 12:53:30 +05:00
Ammar Ahmed
c02f1cde16 mobile: disable template when pin note to notifications 2024-05-11 12:49:11 +05:00
Ammar Ahmed
043f55ead0 mobile: fix exporting note to text for share/copy 2024-05-11 12:49:11 +05:00
Ammar Ahmed
fcece06a1c mobile: fix update notification not showing on mobile app 2024-05-11 12:49:11 +05:00
Abdullah Atta
da7d79edc6 core: token without a scope is invalid 2024-05-11 12:36:23 +05:00
Ammar Ahmed
a2e7190a4a mobile: fix colors of error popup in editor 2024-05-11 11:26:15 +05:00
Ammar Ahmed
503f2b5876 mobile: fix cannot read property 'groupBy' of undefined 2024-05-11 11:22:59 +05:00
Abdullah Atta
68d57e2b27 web: bump version to 3.0.4 2024-05-11 10:48:48 +05:00
Abdullah Atta
400aa574cd core: fix 2fa codes not being sent 2024-05-11 10:29:02 +05:00
333 changed files with 11198 additions and 8542 deletions

View File

@@ -89,13 +89,13 @@ jobs:
- name: CCache Stats After Build
run: ccache -sv
- name: "Upload app to TestFlight"
uses: apple-actions/upload-testflight-build@v1
with:
app-path: Notesnook.ipa
issuer-id: ${{ secrets.API_KEY_ISSUER_ID }}
api-key-id: ${{ secrets.API_KEY_ID }}
api-private-key: ${{ secrets.API_KEY }}
# - name: "Upload app to TestFlight"
# uses: apple-actions/upload-testflight-build@v1
# with:
# app-path: Notesnook.ipa
# issuer-id: ${{ secrets.API_KEY_ISSUER_ID }}
# api-key-id: ${{ secrets.API_KEY_ID }}
# api-private-key: ${{ secrets.API_KEY }}
- name: Upload Notesnook.ipa to Github
uses: actions/upload-artifact@v4

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.3",
"version": "3.0.13",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@notesnook/desktop",
"version": "3.0.3",
"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.3",
"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

@@ -16,13 +16,13 @@ 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-native-gesture-handler";
import {
THEME_COMPATIBILITY_VERSION,
useThemeEngineStore
} from "@notesnook/theme";
import React, { useEffect } from "react";
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 AppLockedOverlay from "./components/app-lock-overlay";
@@ -40,30 +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(() => {
const { appLockEnabled, appLockMode } = SettingsService.get();
if (appLockEnabled || appLockMode !== "none") {
useUserStore.getState().lockApp(true);
}
//@ts-ignore
globalThis["IS_MAIN_APP_RUNNING"] = true;
init();
SettingsService.onFirstLaunch();
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
}, []);
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
@@ -43,9 +44,8 @@ const IOS_KEYCHAIN_ACCESS_GROUP = "group.org.streetwriters.notesnook";
const IOS_KEYCHAIN_SERVICE_NAME = "org.streetwriters.notesnook";
const KEYCHAIN_SERVER_DBKEY = "notesnook:db";
const NOTESNOOK_APPLOCK_KEY_SALT = "3dqclWbOYllfk9kk";
const NOTESNOOK_DB_KEY_SALT = "2rcgSprDmRvZ1AAa";
const NOTESNOOK_USER_KEY_SALT = "7qO4qeoM6PbsAJ0Q";
const NOTESNOOK_APPLOCK_KEY_SALT = "kBwr1Kre86ebOZ8ThLu2OA";
const NOTESNOOK_DB_KEY_SALT = "SNuzOcEK3amoqL0WvPeKqw";
const DB_KEY_CIPHER = "databaseKeyCipher";
const USER_KEY_CIPHER = "userKeyCipher";
@@ -117,9 +117,7 @@ export async function setAppLockVerificationCipher(appLockPassword) {
NOTESNOOK_APPLOCK_KEY_SALT
);
const encrypted = await encrypt(appLockCredentials, generatePassword());
CipherStorage.setMap(APPLOCK_CIPHER, encrypted);
DatabaseLogger.info("setAppLockVerificationCipher");
} catch (e) {
DatabaseLogger.error(e);
@@ -135,10 +133,8 @@ export async function validateAppLockPassword(appLockPassword) {
try {
const appLockCipher = CipherStorage.getMap(APPLOCK_CIPHER);
if (!appLockCipher) return true;
const decrypted = await decrypt(
await Sodium.deriveKey(appLockPassword, NOTESNOOK_APPLOCK_KEY_SALT),
appLockCipher
);
const key = await Sodium.deriveKey(appLockPassword, appLockCipher.salt);
const decrypted = await decrypt(key, appLockCipher);
DatabaseLogger.info(
`validateAppLockPassword: ${typeof decrypted === "string"}`
@@ -214,7 +210,7 @@ export async function getDatabaseKey(appLockPassword) {
const userKeyCipher = await encrypt(
{
key: DB_KEY,
salt: NOTESNOOK_USER_KEY_SALT
salt: NOTESNOOK_DB_KEY_SALT
},
userKeyCredentials.password
);
@@ -227,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;
@@ -239,7 +236,7 @@ export async function deriveCryptoKey(data) {
const userKeyCipher = await encrypt(
{
key: await getDatabaseKey(),
salt: NOTESNOOK_USER_KEY_SALT
salt: NOTESNOOK_DB_KEY_SALT
},
credentials.key
);
@@ -264,13 +261,12 @@ export async function getCryptoKey(_name) {
const key = await decrypt(
{
key: await getDatabaseKey()
key: await getDatabaseKey(),
salt: keyCipher.salt
},
keyCipher
);
DatabaseLogger.info("User key decrypted: ", !!key);
return key;
} catch (e) {
console.log("getCryptoKey", e);

View File

@@ -85,4 +85,10 @@ export async function setupDatabase(password) {
}
export const db = database;
export const DatabaseLogger = dbLogger;
let DatabaseLogger = dbLogger.scope(Platform.OS);
const setLogger = () => {
DatabaseLogger = dbLogger.scope(Platform.OS);
};
export { DatabaseLogger, setLogger };

View File

@@ -16,14 +16,30 @@ 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 { MMKVLoader } from "react-native-mmkv-storage";
import { initialize } from "@notesnook/core/dist/logger";
import { KV } from "./storage";
import { SqliteAdapter, SqliteIntrospector, SqliteQueryCompiler } from "kysely";
import { Platform } from "react-native";
import { setLogger } from ".";
import { RNSqliteDriver } from "./sqlite.kysely";
const LoggerStorage = new MMKVLoader()
.withInstanceID("notesnook_logs")
.initialize();
let loggerLoaded = false;
const initializeLogger = async () => {
if (loggerLoaded) return;
await initialize({
dialect: (name) => ({
createDriver: () => {
return new RNSqliteDriver({ async: true, dbName: name });
},
createAdapter: () => new SqliteAdapter(),
createIntrospector: (db) => new SqliteIntrospector(db),
createQueryCompiler: () => new SqliteQueryCompiler()
}),
tempStore: "memory",
journalMode: Platform.OS === "ios" ? "DELETE" : "WAL"
});
setLogger();
loggerLoaded = true;
};
initialize(new KV(LoggerStorage));
export { LoggerStorage };
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,
@@ -34,17 +39,20 @@ import {
import { MMKV } from "../../common/database/mmkv";
import { useAppState } from "../../hooks/use-app-state";
import BiometricService from "../../services/biometrics";
import { ToastManager } from "../../services/event-manager";
import SettingsService from "../../services/settings";
import { useSettingStore } from "../../stores/use-setting-store";
import { useUserStore } from "../../stores/use-user-store";
import { NotesnookModule } from "../../utils/notesnook-module";
import { SIZE } from "../../utils/size";
import { Toast } from "../toast";
import { Button } from "../ui/button";
import { IconButton } from "../ui/icon-button";
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");
@@ -85,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
);
@@ -119,7 +128,6 @@ const AppLockedOverlay = () => {
);
if (unlocked) {
lockApp(false);
enabled(false);
password.current = undefined;
}
biometricUnlockAwaitingUserInput.current = false;
@@ -146,8 +154,13 @@ const AppLockedOverlay = () => {
}
lockApp(false);
enabled(false);
password.current = undefined;
} else {
ToastManager.show({
heading: `Invalid ${keyboardType === "numeric" ? "pin" : "password"}`,
type: "error",
context: "local"
});
}
} catch (e) {
console.error(e);
@@ -155,10 +168,6 @@ const AppLockedOverlay = () => {
};
useEffect(() => {
if (appState === "active") {
enabled(false);
}
const prevState = lastAppState.current;
lastAppState.current = appState;
@@ -184,31 +193,28 @@ const AppLockedOverlay = () => {
DatabaseLogger.info("Biometric unlock request");
onUnlockAppRequested();
}
enabled(false);
} else {
SettingsService.appEnteredBackground();
if (
SettingsService.get().privacyScreen ||
SettingsService.getProperty("appLockEnabled")
) {
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
style={{
flex: 1,
@@ -321,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

@@ -112,6 +112,10 @@ export const SessionExpired = () => {
if (!res) throw new Error("no token found");
if (db.tokenManager._isTokenExpired(res))
throw new Error("token expired");
const key = await db.user.getEncryptionKey();
if (!key) throw new Error("No encryption key found.");
Sync.run("global", false, "full", async (complete) => {
if (!complete) {
let user = await db.user.getUser();
@@ -127,7 +131,6 @@ export const SessionExpired = () => {
setVisible(false);
});
} catch (e) {
console.log(e);
let user = await db.user.getUser();
if (!user) return;
email.current = user.email;

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

@@ -44,6 +44,7 @@ type DialogInfo = {
// eslint-disable-next-line @typescript-eslint/ban-types
context: "global" | "local" | (string & {});
secureTextEntry?: boolean;
keyboardType?: string;
};
export function presentDialog(data: Partial<DialogInfo>): void {

View File

@@ -174,6 +174,7 @@ export const Dialog = ({ context = "global" }) => {
onSubmit={onPressPositive}
returnKeyLabel="Done"
returnKeyType="done"
keyboardType={dialogInfo.keyboardType || "default"}
placeholder={dialogInfo.inputPlaceholder}
/>
</View>

View File

@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { useThemeColors } from "@notesnook/theme";
import React, { useEffect, useRef, useState } from "react";
import { TextInput, View } from "react-native";
import { db } from "../../../common/database";
import {
clearAppLockVerificationCipher,
setAppLockVerificationCipher,
@@ -44,6 +45,7 @@ import BaseDialog from "../../dialog/base-dialog";
import DialogButtons from "../../dialog/dialog-buttons";
import DialogHeader from "../../dialog/dialog-header";
import { Toast } from "../../toast";
import { Button } from "../../ui/button";
import { IconButton } from "../../ui/icon-button";
import Input from "../../ui/input";
import Seperator from "../../ui/seperator";
@@ -66,6 +68,7 @@ export const AppLockPassword = () => {
confirmPassword?: string;
}>({});
const [secureTextEntry, setSecureTextEntry] = useState(true);
const [accountPass, setAccountPass] = useState(false);
useEffect(() => {
const subs = [
@@ -73,6 +76,7 @@ export const AppLockPassword = () => {
eOpenAppLockPasswordDialog,
(mode: "create" | "change" | "remove") => {
setMode(mode);
setAccountPass(false);
setVisible(true);
}
),
@@ -126,7 +130,9 @@ export const AppLockPassword = () => {
mode === "change"
? `Change app lock ${keyboardType}`
: mode === "remove"
? `Remove app lock ${keyboardType}`
? `Enter ${
accountPass ? "account password" : `app lock ${keyboardType}`
} to remove ${keyboardType}`
: `Set up a custom app lock ${keyboardType} to unlock the app`
}
icon="shield"
@@ -169,33 +175,39 @@ export const AppLockPassword = () => {
confirmPasswordInputRef.current?.focus();
}}
defaultValue={values.current.password}
keyboardType={keyboardType === "pin" ? "number-pad" : "default"}
keyboardType={
keyboardType === "pin" && !accountPass ? "number-pad" : "default"
}
autoComplete="password"
returnKeyLabel={mode !== "remove" ? "Next" : "Remove"}
returnKeyType={mode !== "remove" ? "next" : "done"}
secureTextEntry={secureTextEntry}
buttonLeft={
<IconButton
name={keyboardType === "password" ? "numeric" : "keyboard"}
onPress={() => {
setKeyboardType(
keyboardType === "password" ? "pin" : "password"
);
setSecureTextEntry(false);
setImmediate(() => {
setSecureTextEntry(true);
});
}}
style={{
width: 25,
height: 25,
marginRight: 5
}}
size={SIZE.lg}
/>
accountPass ? null : (
<IconButton
name={keyboardType === "password" ? "numeric" : "keyboard"}
onPress={() => {
setKeyboardType(
keyboardType === "password" ? "pin" : "password"
);
setSecureTextEntry(false);
setImmediate(() => {
setSecureTextEntry(true);
});
}}
style={{
width: 25,
height: 25,
marginRight: 5
}}
size={SIZE.lg}
/>
)
}
placeholder={
mode === "change"
accountPass
? "Account password"
: mode === "change"
? `New ${keyboardType}`
: `${keyboardType === "pin" ? "Pin" : "Password"}`
}
@@ -222,6 +234,36 @@ export const AppLockPassword = () => {
placeholder={`Confirm ${keyboardType}`}
/>
) : null}
{mode === "remove" ? (
<>
<Button
icon={
accountPass ? "checkbox-marked" : "checkbox-blank-outline"
}
onPress={() => {
setSecureTextEntry(false);
setAccountPass(!accountPass);
setTimeout(() => {
setSecureTextEntry(true);
});
}}
iconSize={SIZE.lg}
type="plain"
iconColor={
accountPass ? colors.primary.accent : colors.primary.icon
}
title="Use account password instead"
style={{
width: "100%",
alignSelf: "flex-start",
justifyContent: "flex-start",
paddingHorizontal: 0,
height: 30
}}
/>
</>
) : null}
</View>
<DialogButtons
@@ -249,7 +291,8 @@ export const AppLockPassword = () => {
);
return;
}
await setAppLockVerificationCipher(values.current.password);
const password = values.current.password;
setAppLockVerificationCipher(password);
SettingsService.setProperty("appLockHasPasswordSecurity", true);
} else if (mode === "change") {
if (
@@ -277,7 +320,6 @@ export const AppLockPassword = () => {
);
return;
}
const isCurrentPasswordCorrect = await validateAppLockPassword(
values.current.currentPassword
);
@@ -293,8 +335,10 @@ export const AppLockPassword = () => {
return;
}
const password = values.current.password;
await clearAppLockVerificationCipher();
SettingsService.setProperty("appLockHasPasswordSecurity", true);
await setAppLockVerificationCipher(values.current.password);
await setAppLockVerificationCipher(password);
} else if (mode === "remove") {
if (!values.current.password) {
ToastManager.error(
@@ -305,14 +349,18 @@ export const AppLockPassword = () => {
return;
}
const isCurrentPasswordCorrect = await validateAppLockPassword(
values.current.password
);
const isCurrentPasswordCorrect = accountPass
? await db.user.verifyPassword(values.current.password)
: await validateAppLockPassword(values.current.password);
if (!isCurrentPasswordCorrect) {
ToastManager.error(
new Error(
`${keyboardType === "pin" ? "Pin" : "Password"} incorrect`
accountPass
? "Account password incorrect"
: `${
keyboardType === "pin" ? "Pin" : "Password"
} incorrect`
),
undefined,
"local"
@@ -342,7 +390,9 @@ export const AppLockPassword = () => {
close();
}}
positiveTitle="Save"
positiveTitle={
mode === "remove" ? "Remove" : mode === "change" ? "Change" : "Save"
}
negativeTitle="Cancel"
positiveType="transparent"
loading={false}

View File

@@ -586,7 +586,7 @@ export class VaultDialog extends Component {
}
async _copyNote(note) {
Clipboard.setString(await convertNoteToText(note));
Clipboard.setString((await convertNoteToText(note, true)) || "");
ToastManager.show({
heading: "Note copied",
type: "success",
@@ -602,7 +602,7 @@ export class VaultDialog extends Component {
await Share.open({
heading: "Share note",
failOnCancel: false,
message: await convertNoteToText(note)
message: (await convertNoteToText(note)) || ""
});
} catch (e) {
console.error(e);

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

@@ -21,10 +21,10 @@ import { useThemeColors } from "@notesnook/theme";
import React, { useEffect, useState } from "react";
import { View } from "react-native";
import { db } from "../../common/database";
import Editor from "../../screens/editor";
import { ReadonlyEditor } from "../../screens/editor/readonly-editor";
import { useTabStore } from "../../screens/editor/tiptap/use-tab-store";
import { editorController } from "../../screens/editor/tiptap/utils";
import { eSendEvent, ToastManager } from "../../services/event-manager";
import { ToastManager, eSendEvent } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import { useSelectionStore } from "../../stores/use-selection-store";
import { useTrashStore } from "../../stores/use-trash-store";
@@ -34,7 +34,7 @@ import DialogHeader from "../dialog/dialog-header";
import { presentDialog } from "../dialog/functions";
import { Button } from "../ui/button";
import Paragraph from "../ui/typography/paragraph";
import { ReadonlyEditor } from "../../screens/editor/readonly-editor";
import { diff } from "diffblazer";
/**
*
@@ -121,12 +121,21 @@ export default function NotePreview({ session, content, note }) {
<ReadonlyEditor
editorId="historyPreview"
onLoad={async (loadContent) => {
if (content.data) {
const _note = note || (await db.notes.note(session?.noteId));
loadContent({
data: content.data,
id: _note.id
});
try {
if (content.data) {
const _note = note || (await db.notes.note(session?.noteId));
const currentContent = await db.content.get(_note.contentId);
loadContent({
data: diff(currentContent.data, content.data),
id: _note.id
});
}
} catch (e) {
ToastManager.error(
e,
"Failed to load history preview",
"local"
);
}
}}
/>

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

@@ -86,16 +86,16 @@ const Sort = ({ type, screen }) => {
<Button
title={
groupOptions?.sortDirection === "asc"
? groupOptions.groupBy === "abc" ||
groupOptions.sortBy === "title"
? groupOptions?.groupBy === "abc" ||
groupOptions?.sortBy === "title"
? "A - Z"
: groupOptions.sortBy === "dueDate"
: groupOptions?.sortBy === "dueDate"
? "Earliest first"
: "Old - New"
: groupOptions.groupBy === "abc" ||
groupOptions.sortBy === "title"
: groupOptions?.groupBy === "abc" ||
groupOptions?.sortBy === "title"
? "Z - A"
: groupOptions.sortBy === "dueDate"
: groupOptions?.sortBy === "dueDate"
? "Latest first"
: "New - Old"
}
@@ -134,7 +134,7 @@ const Sort = ({ type, screen }) => {
alignItems: "center"
}}
>
{groupOptions.groupBy === "abc" ? (
{groupOptions?.groupBy === "abc" ? (
<Button
type="secondary"
title="Title"
@@ -154,18 +154,18 @@ const Sort = ({ type, screen }) => {
item === "dateEdited") ? null : (
<Button
key={item}
type={groupOptions.sortBy === item ? "selected" : "plain"}
type={groupOptions?.sortBy === item ? "selected" : "plain"}
title={SORT[item]}
height={40}
iconPosition="left"
icon={groupOptions.sortBy === item ? "check" : null}
icon={groupOptions?.sortBy === item ? "check" : null}
style={{
marginRight: 10,
paddingHorizontal: 8
}}
buttonType={{
text:
groupOptions.sortBy === item
groupOptions?.sortBy === item
? colors.primary.accent
: colors.secondary.paragraph
}}
@@ -213,11 +213,11 @@ const Sort = ({ type, screen }) => {
key={item}
testID={"btn-" + item}
type={
groupOptions.groupBy === GROUP[item] ? "selected" : "plain"
groupOptions?.groupBy === GROUP[item] ? "selected" : "plain"
}
buttonType={{
text:
groupOptions.groupBy === GROUP[item]
groupOptions?.groupBy === GROUP[item]
? colors.primary.accent
: colors.secondary.paragraph
}}
@@ -235,7 +235,7 @@ const Sort = ({ type, screen }) => {
updateGroupOptions(_groupOptions);
}}
height={40}
icon={groupOptions.groupBy === GROUP[item] ? "check" : null}
icon={groupOptions?.groupBy === GROUP[item] ? "check" : null}
title={
item.slice(0, 1).toUpperCase() + item.slice(1, item.length)
}

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

@@ -600,20 +600,11 @@ export const useActions = ({
});
return;
}
const text = await convertNoteToText(item as Note, false);
if (!text) {
ToastManager.error(
new Error(Errors.export("text")),
undefined,
"local"
);
return;
}
const html = text.replace(/\n/g, "<br />");
const text = await convertNoteToText(item as Note, true);
const html = (text || "").replace(/\n/g, "<br />");
await Notifications.displayNotification({
title: item.title,
message: (item as Note).headline || text,
message: (item as Note).headline || text || "",
subtitle: "",
bigText: html,
ongoing: true,
@@ -684,15 +675,11 @@ export const useActions = ({
} else {
processingId.current = "shareNote";
const convertedText = await convertNoteToText(item);
if (!convertedText) {
ToastManager.error(new Error(Errors.export("text")));
return;
}
processingId.current = undefined;
Share.open({
title: "Share note to",
failOnCancel: false,
message: convertedText
message: convertedText || ""
});
}
}
@@ -772,11 +759,7 @@ export const useActions = ({
} else {
processingId.current = "copyContent";
const text = await convertNoteToText(item as Note, true);
if (!text) {
ToastManager.error(new Error(Errors.export("text")));
return;
}
Clipboard.setString(text);
Clipboard.setString(text || "");
processingId.current = undefined;
ToastManager.show({
heading: "Note copied to clipboard",

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

@@ -22,20 +22,14 @@ import { Platform } from "react-native";
import { Subscription } from "react-native-iap";
import PremiumService from "../services/premium";
import { db } from "../common/database";
import { Product } from "@notesnook/core/dist/api/pricing";
type PurchaseInfo = {
country: string;
countryCode: string;
sku: string;
discount: number;
};
const skuInfos: { [name: string]: PurchaseInfo | undefined } = {};
const skuInfos: { [name: string]: Product | undefined } = {};
export const usePricing = (period: "monthly" | "yearly") => {
const [current, setCurrent] = useState<{
period: string;
info?: PurchaseInfo;
info?: Product;
product?: Subscription;
}>();
@@ -54,6 +48,7 @@ export const usePricing = (period: "monthly" | "yearly") => {
period
));
skuInfos[period] = skuInfo;
const products = (await PremiumService.getProducts()) as Subscription[];
let product = products.find((p) => p.productId === skuInfo?.sku);
if (!product)

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

@@ -75,14 +75,16 @@ export function ReadonlyEditor(props: {
if (editorMessage.type === EventTypes.readonlyEditorLoaded) {
console.log("Readonly editor loaded.");
props.onLoad?.((content: { data: string; id: string }) => {
noteId.current = content.id;
editorRef.current?.postMessage(
JSON.stringify({
type: "native:html",
value: content.data
})
);
setLoading(false);
setTimeout(() => {
noteId.current = content.id;
editorRef.current?.postMessage(
JSON.stringify({
type: "native:html",
value: content.data
})
);
setLoading(false);
}, 300);
});
} else if (editorMessage.type === EventTypes.getAttachmentData) {
const attachment = (editorMessage.value as any).attachment as Attachment;

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

@@ -351,9 +351,18 @@ export const useEditor = (
if (!unlocked)
throw new Error("Could not save note, vault is locked");
}
noteData.contentId = note?.contentId;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await db.vault?.save(noteData as any);
if (typeof noteData.title === "string") {
await db.notes.add({
title: noteData.title,
id: noteData.id
});
}
noteData.contentId = note?.contentId;
if (data) {
await db.vault?.save(noteData as any);
}
clearTimeout(saveTimer);
}
@@ -560,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;
@@ -696,14 +705,13 @@ export const useEditor = (
);
}
console.log("readonly state changed...", note.readonly);
useTabStore.getState().updateTab(tabId, {
readonly: note.readonly
});
}
if (data.type === "tiptap" && note && !isLocal) {
if (lastContentChangeTime.current[noteId] >= data.dateEdited) {
if (lastContentChangeTime.current[noteId] >= data.dateModified) {
return;
}
@@ -728,7 +736,7 @@ export const useEditor = (
}
} else {
const _nextContent = data.data;
if (_nextContent === currentContents.current?.data) {
if (_nextContent === currentContents.current[note.id]?.data) {
return;
}
lastContentChangeTime.current[note.id] = note.dateEdited;

View File

@@ -122,7 +122,8 @@ export default function DebugLogs() {
colors.primary.paragraph,
colors.error.paragraph,
colors.static.black,
colors.static.orange
colors.static.orange,
colors.primary.border
]
);

View File

@@ -90,13 +90,26 @@ export async function verifyUserWithApplock() {
positiveText: "Verify",
secureTextEntry: true,
negativeText: "Cancel",
keyboardType: keyboardType,
positivePress: async (value) => {
try {
const verified = await validateAppLockPassword(value);
if (!verified) {
ToastManager.show({
heading: `Invalid ${
keyboardType === "numeric" ? "pin" : "password"
}`,
type: "error",
context: "local"
});
return false;
}
resolve(verified);
} catch (e) {
resolve(false);
return false;
}
return true;
}
});
} else {

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 });
},
@@ -871,6 +883,9 @@ export const settingsGroups: SettingSection[] = [
type: "switch",
property: "appLockEnabled",
onChange: () => {
SettingsService.set({
privacyScreen: true
});
SettingsService.setPrivacyScreen(SettingsService.get());
},
onVerify: async () => {
@@ -973,7 +988,7 @@ export const settingsGroups: SettingSection[] = [
SettingsService.getProperty("applockKeyboardType") === "numeric"
? "pin"
: "password"
}, app lock will fallback to using account password to unlock the app`,
}, app lock will be disabled if no other security method is enabled.`,
hidden: () => {
return !SettingsService.getProperty("appLockHasPasswordSecurity");
},

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

@@ -59,14 +59,14 @@ const recoveryKeyMessage = {
() => {
eSendEvent(eOpenRecoveryKeyDialog);
},
true,
false,
async () => {
SettingsService.set({
recoveryKeySaved: true
});
clearMessage();
},
"I have saved my key already"
"Cancel"
);
},
data: {},

View File

@@ -952,13 +952,13 @@ async function pinNote(id: string) {
const note = await db.notes.note(id as string);
if (!note) return;
let text = await convertNoteToText(note, false);
let text = await convertNoteToText(note, true);
if (!text) text = "";
const html = text.replace(/\n/g, "<br />");
Notifications.displayNotification({
title: note.title,
message: note.headline || text,
subtitle: note.headline || text,
subtitle: "",
bigText: html,
ongoing: true,
actions: ["UNPIN"],

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") {
@@ -76,6 +77,17 @@ function migrateAppLock() {
DatabaseLogger.debug("App lock Migrated");
}
function migrateSettings(settings: SettingStore["settings"]) {
const version = settings.settingsVersion;
if (!version) {
settings.settingsVersion = 1;
settings.privacyScreen = settings.appLockEnabled
? true
: settings.privacyScreen;
MMKV.setString("appSettings", JSON.stringify(settings));
}
}
function init() {
scale.fontScale = 1;
const settingsJson = MMKV.getString("appSettings");
@@ -83,14 +95,17 @@ function init() {
if (!settingsJson) {
MMKV.setString("appSettings", JSON.stringify(settings));
} else {
const settingsParsed = JSON.parse(settingsJson);
migrateSettings(settingsParsed);
settings = {
...settings,
...JSON.parse(settingsJson)
...settingsParsed
};
}
if (settings.fontScale) {
scale.fontScale = settings.fontScale;
}
setTimeout(() => setPrivacyScreen(settings), 1);
updateSize();
useSettingStore.getState().setSettings({ ...settings });
@@ -98,17 +113,23 @@ function init() {
}
function setPrivacyScreen(settings: SettingStore["settings"]) {
if (settings.privacyScreen || settings.appLockEnabled) {
if (settings.privacyScreen) {
if (Platform.OS === "android") {
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

@@ -81,6 +81,7 @@ export type Settings = {
biometricsAuthEnabled?: boolean;
backgroundSync?: boolean;
applockKeyboardType: "numeric" | "default";
settingsVersion?: number;
};
type DimensionsType = {
@@ -169,7 +170,8 @@ export const defaultSettings: SettingStore["settings"] = {
markdownShortcuts: true,
biometricsAuthEnabled: false,
appLockHasPasswordSecurity: false,
backgroundSync: true
backgroundSync: true,
settingsVersion: 0
};
export const useSettingStore = create<SettingStore>((set, get) => ({

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

@@ -23,7 +23,7 @@ export const IOS_APPGROUPID = "group.org.streetwriters.notesnook";
export const FILE_SIZE_LIMIT = 500 * 1024 * 1024;
export const IMAGE_SIZE_LIMIT = 50 * 1024 * 1024;
export const BETA = true;
export const BETA = false;
export const STORE_LINK =
Platform.OS === "ios"

View File

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

View File

@@ -37,4 +37,10 @@ allprojects {
maven { url 'https://www.jitpack.io' }
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "11"
}
}
}

View File

@@ -1,4 +1,3 @@
- Added push/pull changes to troubleshoot sync issues in settings
- Bug fixes and performance improvements
Thank you for using Notesnook!

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 = 2100;
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.3;
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 = 2100;
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.3;
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 = 2100;
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.3;
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 = 2100;
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.3;
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 = 2100;
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.3;
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 = 2100;
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.3;
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
@@ -959,4 +971,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 2b8b28a341b202bf3ca5f231b75bb05893486ed8
COCOAPODS: 1.12.1
COCOAPODS: 1.15.2

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.2",
"version": "3.0.11",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@notesnook/mobile",
"version": "3.0.2",
"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.3",
"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

@@ -311,8 +311,7 @@ const ShareView = () => {
type: "tiptap"
},
id: note.id,
sessionId: Date.now(),
title: noteTitle.current
sessionId: Date.now()
};
} else {
noteData = { ...note };
@@ -487,25 +486,42 @@ const ShareView = () => {
gap: 10
}}
>
<TextInput
placeholder="Enter note title"
ref={inputRef}
style={{
flexShrink: 1,
flexGrow: 1,
fontFamily: "OpenSans-SemiBold",
fontSize: SIZE.lg,
paddingBottom: 0,
paddingTop: 0
}}
onChangeText={(value) => {
noteTitle.current = value;
}}
blurOnSubmit={false}
onSubmitEditing={() => {
editorRef.current.focus();
}}
/>
{appendNoteId ? (
<Heading
style={{
flexShrink: 1,
flexGrow: 1,
fontFamily: "OpenSans-SemiBold",
fontSize: SIZE.lg,
paddingBottom: 0,
paddingTop: 0
}}
>
Save note
</Heading>
) : (
<TextInput
placeholder="Enter note title"
ref={inputRef}
style={{
flexShrink: 1,
flexGrow: 1,
fontFamily: "OpenSans-SemiBold",
fontSize: SIZE.lg,
paddingBottom: 0,
paddingTop: 0,
color: colors.primary.heading
}}
onChangeText={(value) => {
noteTitle.current = value;
}}
defaultValue={noteTitle.current}
blurOnSubmit={false}
onSubmitEditing={() => {
editorRef.current.focus();
}}
/>
)}
<Button
title="Done"
type="accent"

View File

@@ -1,12 +1,12 @@
{
"name": "@notesnook/theme-builder",
"version": "1.1.1",
"version": "1.2.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@notesnook/theme-builder",
"version": "1.1.1",
"version": "1.2.0",
"license": "GPL-3.0-or-later",
"dependencies": {
"@emotion/react": "11.11.1",
@@ -18,17 +18,18 @@
"@theme-ui/components": "^0.14.7",
"@theme-ui/core": "^0.14.7",
"@trpc/client": "^10.38.3",
"@types/react-dom": "^18.3.0",
"clipboard-polyfill": "^4.0.0",
"file-saver": "^2.0.5",
"katex": "^0.16.2",
"react": "18.2.0",
"react-dom": "18.2.0"
"react-dom": "^18.2.0"
},
"devDependencies": {
"@babel/core": "^7.22.5",
"@types/babel__core": "^7.20.1",
"@types/file-saver": "^2.0.5",
"@types/react": "^18.2.17",
"@types/react": "^18.2.39",
"@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.14",
"buffer": "^6.0.3",
@@ -133,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"
@@ -329,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",
@@ -978,7 +979,7 @@
},
"../web": {
"name": "@notesnook/web",
"version": "3.0.0",
"version": "3.0.13",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"dependencies": {
@@ -1028,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",
@@ -1058,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",
@@ -1078,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",
@@ -1090,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",
@@ -2098,25 +2100,30 @@
},
"node_modules/@types/prop-types": {
"version": "15.7.5",
"dev": true,
"license": "MIT"
},
"node_modules/@types/react": {
"version": "18.2.39",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.39.tgz",
"integrity": "sha512-Oiw+ppED6IremMInLV4HXGbfbG6GyziY3kqAwJYOR0PNbkYDmLWQA3a95EhdSmamsvbkJN96ZNN+YD+fGjzSBA==",
"dev": true,
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
"csstype": "^3.0.2"
}
},
"node_modules/@types/react-dom": {
"version": "18.3.0",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz",
"integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==",
"dependencies": {
"@types/react": "*"
}
},
"node_modules/@types/scheduler": {
"version": "0.16.8",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz",
"integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==",
"dev": true
"integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A=="
},
"node_modules/@types/styled-system": {
"version": "5.1.16",

View File

@@ -1,7 +1,7 @@
{
"name": "@notesnook/theme-builder",
"description": "Your private note taking space",
"version": "1.1.1",
"version": "1.2.0",
"private": true,
"main": "./src/app.js",
"homepage": "https://notesnook.com/",
@@ -17,18 +17,18 @@
"@theme-ui/components": "^0.14.7",
"@theme-ui/core": "^0.14.7",
"@trpc/client": "^10.38.3",
"@types/react-dom": "^18.3.0",
"clipboard-polyfill": "^4.0.0",
"file-saver": "^2.0.5",
"katex": "^0.16.2",
"react": "18.2.0",
"react-dom": "18.2.0"
"react-dom": "^18.2.0"
},
"devDependencies": {
"@babel/core": "^7.22.5",
"@types/babel__core": "^7.20.1",
"@types/file-saver": "^2.0.5",
"@types/react": "^18.2.39",
"@types/react": "^18.2.17",
"@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.14",
"buffer": "^6.0.3",

View File

@@ -2,19 +2,10 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAHUUExURUxpcf////////////////////////////////////////////////////////////////////////////////////39/f39/f////////////////////////////////z8/O3s7P7+/vTz8wAAAPz7++/v7/Py8u/u7vDv7+7t7dfX1/79/ezr66Kiovv6+vf29vX09OTj4w0NDfv7++Ti4vr6+vT09Ovq6vn5+f39/fb19dnX1/b29tvb29/f3xMTE/j4+Pn4+O7s7MnJyerq6uno6M/Pz8jIyN3d3dnZ2d7e3kZGRvj39/38/Pf39+zs7PDw8OPi4ubl5cvLy+rp6czMzPLy8vPz887Ozujo6MrKyuDf3+fn59PT0+bm5uXl5c3NzfX19evr6wsLC+/t7ePj4/Ty8u3r6/Lx8eXk5OPh4dDQ0Nza2tjX19vZ2fHw8Nva2tLR0djW1tbW1tra2tLS0uHh4evp6eLi4tXV1djY2L+/vysrK7q6utHR0aGhoa6urrm5uQICAigoKCEhIZCQkFxcXBgYGFRUVBISEm1tbQ4ODklJSbu7uyAgID09PZqamkVFRXh4eLGxsTg4OOTk5FFRUQEBAQoKCnx8fBcXF7/+rP8AAAAfdFJOUwBOqO2h6KT9Mtyr5+w3Str+6TTZOjXb31M24O8BOd0PapSsAAABxElEQVQ4y2NgYOBgYWWXxwLYBdmEGICAjx9Z1NJJVQfB42QE6hdG0RaoaaCqhKSCl4EF1VxNVAXyTAzcaArUUBXwMLBjKDBBViDAII+uwBZFgTy6AjU1awIKNKz1aa0g1VBfB58CDS08CuIb40AKzLAqsJKXN2tXacChwKS+rTtB3tJHRU9ewxmbFZ6tKiqTrSAKdIO1LDEUaPeoqMzsUwAp0NIt8Uj0ijJXQFVgnDJVZcK0XrACXcXY0sjoHM8AfyUkBbOn9KvMmgRSYFEW4hUVqJagHeaShqTAwX7ijJQusAkW5VXRHu6eruFqaigKkqarqAAVKFbYxWiYq1XGedijuMHBWz6xo7m2Rl7RwtvdJaw6NjzCFl2BVVNdshJQgbqBsqtdpIu7nasjXIFXS2cyRL2CW6i6JTCgFCLitUPs4QrM7cDmKZi7FRYVm6o5QeLbDGICLNEqJAVk59rk2djY5Me4FThawQOKFSzrrxmaZWpqBAamQUGmwRaakNTNzMAm7+ekrKmlqOjsrIgAGcAA1ci0NVPiYhAV8zVURgbp6nBg7isuwsDAKKfkp4AEVOHASklKApS9JZmY5bECaS5ZGQYA3vqpy6NoYh0AAABXelRYdFJhdyBwcm9maWxlIHR5cGUgaXB0YwAAeJzj8gwIcVYoKMpPy8xJ5VIAAyMLLmMLEyMTS5MUAxMgRIA0w2QDI7NUIMvY1MjEzMQcxAfLgEigSi4A6hcRdPJCNZUAAAAASUVORK5CYII="
/>
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<!-- <link rel="manifest" href="/site.webmanifest" /> -->
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#01c352" />
<meta name="msapplication-TileColor" content="#01c352" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<meta name="theme-color" content="#01c352" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--
manifest.json provides metadata used when your web app is installed on a
@@ -49,13 +40,26 @@
/>
<meta name="twitter:card" content="summary_large_image" />
<title>Notesnook Theme Builder</title>
<style id="theme-colors">
#splash {
display: none !important;
}
</style>
<script type="module">
import { themeToCSS } from "@notesnook/theme";
<script nonce="7WIq8hRwApoXhctoGZZthMLYQLRNiprTwcPi6Azdf">
const colorScheme = JSON.parse(
window.localStorage.getItem("colorScheme") || '"light"'
);
const root = document.querySelector("html");
if (root) root.setAttribute("data-theme", colorScheme);
const theme = window.localStorage.getItem(`theme:${colorScheme}`);
if (theme) {
const css = themeToCSS(JSON.parse(theme));
const stylesheet = document.getElementById("theme-colors");
if (stylesheet) stylesheet.innerHTML = css;
}
</script>
<script type="module" src="/index.tsx"></script>
<style>
@@ -63,21 +67,6 @@
overscroll-behavior: none;
}
html[data-theme="dark"] {
--bg: #0f0f0f;
--fg: #fff;
--three-bars-bg: #494949;
--gradient-stop-color: #111111;
--n-letter-color: #e1e1e1;
}
html[data-theme="light"] {
--bg: #fff;
--three-bars-bg: #bebebe;
--gradient-stop-color: #fff9f9;
--n-letter-color: #000;
}
html[data-theme="light"] .react-loading-skeleton {
--base-color: var(--background-secondary);
--highlight-color: #var(--background-secondary);
@@ -88,6 +77,19 @@
--highlight-color: var(--background-secondary);
}
#splash {
background-color: var(--background);
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#splash svg {
transform: scale(1);
animation: pulse 2s infinite;
@@ -95,7 +97,7 @@
@keyframes pulse {
0% {
transform: scale(0.95);
transform: scale(0.9);
}
70% {
@@ -103,7 +105,7 @@
}
100% {
transform: scale(0.95);
transform: scale(0.9);
}
}
@@ -128,20 +130,9 @@
overflow: hidden;
}
@keyframes fadeUp {
0% {
transform: translateY(500px);
opacity: 0;
}
80% {
transform: translateY(0px);
opacity: 0.7;
}
100% {
opacity: 1;
}
#root {
display: flex;
flex-direction: column;
}
/* svg {
@@ -171,85 +162,40 @@
</style>
</head>
<body>
<body class="theme-scope-base">
<noscript>You need to enable JavaScript to run this app.</noscript>
<!-- <script src="https://cdn.jsdelivr.net/npm/highlightjs@9.16.2/highlight.pack.min.js"></script>
-->
<div id="root"></div>
<div
id="splash"
style="
background-color: var(--bg);
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
<svg
xmlns="http://www.w3.org/2000/svg"
style="height: 0; width: 0; z-index: -1; position: absolute"
>
<svg viewBox="0 0 339 339" style="width: 150px">
<defs />
<defs>
<linearGradient
xlink:href="#a"
id="b"
x1="188.61227"
x2="193.54405"
y1="165.2058"
y2="216.81519"
gradientTransform="rotate(5 4448 -4204) scale(2.93671)"
gradientUnits="userSpaceOnUse"
/>
<linearGradient id="a">
<stop offset="0" />
<stop
offset="1"
stop-color="var(--gradient-stop-color)"
stop-opacity="0"
/>
</linearGradient>
<linearGradient
id="c"
x1="167.8"
x2="270.6"
y1="76.9"
y2="64.2"
gradientTransform="rotate(5 465 -2050) scale(1.50082)"
gradientUnits="userSpaceOnUse"
xlink:href="#a"
/>
</defs>
<g transform="translate(0 42)">
<path fill="url(#b)" d="M160 205l154 42-141 44-155-42z" />
<path fill="url(#c)" d="M160-35v240l154 42 1-253z" />
<symbol id="full-logo" viewBox="0 0 1000 1000">
<rect
width="1000"
height="1000"
rx="30%"
ry="30%"
style="fill: var(--paragraph)"
/>
<g transform="translate(275,176.95254)">
<path
fill="none"
stroke-width="1.2"
d="M160 205V-35m0 240L18 249m142-44l154 41"
/>
<path
fill="var(--n-letter-color)"
d="M84 109l35 54V98l21-7v91l-27 9-35-54v65l-21 6v-91z"
/>
<rect
width="86.1"
height="12.6"
x="185"
y="97"
fill="var(--three-bars-bg)"
ry="2.3"
transform="skewY(15) scale(.9669 1)"
/>
<path
fill="var(--three-bars-bg)"
d="M181 169l99 26 2 3v8c0 1-1 2-2 1l-99-26-2-3v-7c0-2 1-2 2-2zm0-47l99 27 2 2v8l-2 2-99-27c-1 0-2-1-2-3v-7l2-2z"
style="fill: var(--background)"
d="M437.985 493.919c-17.255 50.411-51.835 93.065-97.588 120.372-45.752 27.307-99.71 37.496-152.269 28.753-52.56-8.743-100.313999-35.85-134.763-76.498C18.916 525.898.006 474.347 0 421.064v-110.25l79.121001 33.053v77.152c-.007 20.779 4.434 41.318 13.024 60.237C100.735 500.176 113.276 517.037 128.925 530.707c2.97 2.587 6.053 5.107 9.236 7.459 23.357 17.388 51.402 27.352 80.494 28.597.99 0 1.946.079 2.925.101.979.023 2.25 0 3.375 0h3.375c1.125 0 1.935 0 2.925-.101 29.081-1.248 57.116-11.203 80.471-28.575 3.173-2.351 6.255-4.86 9.237-7.447 20.556-17.98 35.656-41.366 43.582-67.5zM450 225v196.065c0 2.531 0 5.074-.158 7.605l-78.963-33.019V225c-.013-37.684-14.607-73.901-40.725-101.066-26.119-27.164003-61.735-43.168003-99.389-44.660003-37.655-1.492-74.426 11.644-102.611 36.657003-28.185999 25.013-45.599999 59.962-48.593999 97.526-.281 3.803-.439 7.662-.439 11.543v48.712L0 240.637V0h225c59.674 0 116.903 23.705 159.099 65.901C426.295 108.097 450 165.326 450 225Z"
/>
</g>
</symbol>
<symbol id="themed-logo" viewBox="0 0 450 646.09491">
<path
style="fill: var(--paragraph)"
d="M437.985 493.919c-17.255 50.411-51.835 93.065-97.588 120.372-45.752 27.307-99.71 37.496-152.269 28.753-52.56-8.743-100.313999-35.85-134.763-76.498C18.916 525.898.006 474.347 0 421.064v-110.25l79.121001 33.053v77.152c-.007 20.779 4.434 41.318 13.024 60.237C100.735 500.176 113.276 517.037 128.925 530.707c2.97 2.587 6.053 5.107 9.236 7.459 23.357 17.388 51.402 27.352 80.494 28.597.99 0 1.946.079 2.925.101.979.023 2.25 0 3.375 0h3.375c1.125 0 1.935 0 2.925-.101 29.081-1.248 57.116-11.203 80.471-28.575 3.173-2.351 6.255-4.86 9.237-7.447 20.556-17.98 35.656-41.366 43.582-67.5zM450 225v196.065c0 2.531 0 5.074-.158 7.605l-78.963-33.019V225c-.013-37.684-14.607-73.901-40.725-101.066-26.119-27.164003-61.735-43.168003-99.389-44.660003-37.655-1.492-74.426 11.644-102.611 36.657003-28.185999 25.013-45.599999 59.962-48.593999 97.526-.281 3.803-.439 7.662-.439 11.543v48.712L0 240.637V0h225c59.674 0 116.903 23.705 159.099 65.901C426.295 108.097 450 165.326 450 225Z"
/>
</symbol>
</svg>
<div id="splash" class="hidden">
<svg style="height: 120px">
<use href="#themed-logo" />
</svg>
</div>
<div id="dialogContainer"></div>

View File

@@ -18,31 +18,59 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { init } from "@notesnook/web/src/bootstrap";
import { render } from "react-dom";
import { createRoot } from "react-dom/client";
import {
ErrorBoundary,
ErrorComponent
} from "@notesnook/web/src/components/error-boundary";
import { BaseThemeProvider } from "@notesnook/web/src/components/theme-provider";
import { App } from "./app";
renderApp();
async function renderApp() {
const { component, props } = await init();
const rootElement = document.getElementById("root");
if (!rootElement) return;
const root = createRoot(rootElement);
try {
const { component, props } = await init();
const { default: Component } = await component();
render(
<BaseThemeProvider
sx={{
display: "flex",
"#app": { flex: 1, height: "unset" },
"& > :first-child:not(#menu-wrapper)": { flex: 1 },
height: "100%"
}}
>
<Component route={props?.route || "login:email"} />
<App />
</BaseThemeProvider>,
document.getElementById("root"),
() => {
document.getElementById("splash")?.remove();
}
);
const { useKeyStore } = await import(
"@notesnook/web/src/interfaces/key-store"
);
await useKeyStore.getState().init();
const { default: Component } = await component();
const { default: AppLock } = await import(
"@notesnook/web/src/views/app-lock"
);
root.render(
<ErrorBoundary>
<BaseThemeProvider
onRender={() => document.getElementById("splash")?.remove()}
sx={{
display: "flex",
"#app": { flex: 1, height: "unset" },
"& > :first-child:not(#menu-wrapper)": { flex: 1 },
height: "100%"
}}
>
<AppLock>
<Component route={props?.route || "login:email"} />
</AppLock>
<App />
</BaseThemeProvider>
</ErrorBoundary>
);
} catch (e) {
root.render(
<>
<ErrorComponent
error={e}
resetErrorBoundary={() => window.location.reload()}
/>
</>
);
}
}

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

@@ -259,14 +259,15 @@ test("unlock a note for editing", async ({ page }) => {
await page.waitForTimeout(150);
await page.reload();
await page.waitForTimeout(500);
await notes.waitForList();
const newContent = `${NOTE.content}${content}`;
const editedNote = await notes.findNote({
title: NOTE.title,
content: newContent
});
await editedNote?.openLockedNote(PASSWORD);
if (!editedNote) throw new Error("Could not find note.");
await editedNote.openLockedNote(PASSWORD);
await notes.editor.waitForLoading();
expect(await notes.editor.getContent("text")).toContain(newContent);
});

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.3",
"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: createDialect,
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,19 +67,26 @@ 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 });
}
}
}
export const DEFAULT_CONTEXT = { colors: [], tags: [], notebook: {} };
export async function createBackup(rescueMode = false) {
export async function createBackup(
options: {
rescueMode?: boolean;
noVerify?: boolean;
} = {}
) {
const { rescueMode, noVerify } = options;
const { isLoggedIn } = useUserStore.getState();
const { encryptBackups, toggleEncryptBackups } = useSettingStore.getState();
if (!isLoggedIn && encryptBackups) toggleEncryptBackups();
const verified = rescueMode || encryptBackups || (await verifyAccount());
const verified =
rescueMode || encryptBackups || noVerify || (await verifyAccount());
if (!verified) {
showToast("error", "Could not create a backup: user verification failed.");
return false;
@@ -166,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);
@@ -205,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 {
@@ -311,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

@@ -18,9 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import hotkeys from "hotkeys-js";
import { navigate } from "../navigation";
// import { store as themestore } from "../stores/theme-store";
import { GlobalKeyboard } from "../utils/keyboard";
import { useEditorStore } from "../stores/editor-store";
import { useStore as useSearchStore } from "../stores/search-store";
import { useEditorManager } from "../components/editor/manager";
const KEYMAP = [
// {
@@ -57,11 +58,24 @@ const KEYMAP = [
keys: ["command+f", "ctrl+f"],
description: "Search all notes",
global: false,
action: (e) => {
if (e.target?.classList.contains("ProseMirror")) return;
action: (e: KeyboardEvent) => {
const isInEditor =
e.target instanceof HTMLElement &&
!!e.target?.closest(".editor-container");
if (isInEditor) {
const activeSession = useEditorStore.getState().getActiveSession();
if (activeSession?.type === "readonly") {
e.preventDefault();
const editor = useEditorManager
.getState()
.getEditor(activeSession.id);
editor?.editor?.startSearch();
}
return;
}
e.preventDefault();
navigate("/search/notes");
useSearchStore.setState({ isSearching: true, searchType: "notes" });
}
}
// {
@@ -137,7 +151,11 @@ export function registerKeyMap() {
KEYMAP.forEach((key) => {
hotkeys(
key.keys.join(","),
{ element: key.global ? GlobalKeyboard : window },
{
element: key.global
? (GlobalKeyboard as unknown as HTMLElement)
: document.body
},
key.action
);
});

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
}
@@ -177,7 +177,7 @@ function isIgnored(key: keyof typeof NoticesData) {
let openedToast: { hide: () => void } | null = null;
async function saveBackup() {
if (IS_DESKTOP_APP) {
await createBackup();
await createBackup({ noVerify: true });
} else if (isUserPremium() && !IS_TESTING) {
if (openedToast !== null) return;
openedToast = showToast(

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): 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,17 +34,29 @@ declare module "kysely" {
}
}
export const createDialect = (
name: string,
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,
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

@@ -83,7 +83,7 @@ export class SharedService<T extends object> extends EventTarget {
}
activate(
portProviderFunc: () => MessagePort | Promise<MessagePort>,
portProviderFunc: () => Promise<{ port: MessagePort; onclose: () => void }>,
onClientConnected: () => Promise<void>
) {
if (this.#onDeactivate) return;
@@ -97,7 +97,7 @@ export class SharedService<T extends object> extends EventTarget {
navigator.locks
.request(LOCK_NAME, { signal: this.#onDeactivate.signal }, async () => {
// Get the port to request client ports.
const port = await portProviderFunc();
const { port, onclose } = await portProviderFunc();
port.start();
// Listen for client requests. A separate BroadcastChannel
@@ -159,6 +159,7 @@ export class SharedService<T extends object> extends EventTarget {
// Release the lock only on user abort or context destruction.
return new Promise((_, reject) => {
this.#onDeactivate?.signal.addEventListener("abort", () => {
onclose();
broadcastChannel.close();
reject(this.#onDeactivate?.signal.reason);
});
@@ -181,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,219 +32,243 @@ type PreparedStatement = {
columns: string[];
};
let sqlite: SQLiteAPI;
let db: number | undefined = undefined;
let vfs: IDBBatchAtomicVFS | AccessHandlePoolVFS | null = null;
let initialized = false;
const preparedStatements: Map<string, PreparedStatement> = new Map();
const retryCounter: Record<string, number> = {};
console.log("new sqlite worker");
async function open(dbName: string, async: boolean, url?: string) {
if (db) {
console.error("Database is already initialized", db);
return;
}
const option = url ? { locateFile: () => url } : {};
const sqliteModule = async
? await import("./wa-sqlite-async").then(
({ default: SQLiteAsyncESMFactory }) => SQLiteAsyncESMFactory(option)
)
: await import("./wa-sqlite").then(({ default: SQLiteSyncESMFactory }) =>
SQLiteSyncESMFactory(option)
);
sqlite = Factory(sqliteModule);
vfs = await getVFS(dbName, async);
sqlite.vfs_register(vfs, false);
db = await sqlite.open_v2(dbName, undefined, `multipleciphers-${vfs.name}`);
}
/**
* Wrapper function for preparing SQL statements with caching
* to avoid unnecessary computations.
*/
async function prepare(sql: string) {
if (!db) throw new Error("Database is not initialized.");
try {
const cached = preparedStatements.get(sql);
if (cached !== undefined) return cached;
const str = sqlite.str_new(db, sql);
const prepared = await sqlite.prepare_v2(db, sqlite.str_value(str));
if (!prepared) return;
const statement: PreparedStatement = {
stmt: prepared.stmt,
columns: sqlite.column_names(prepared.stmt)
};
preparedStatements.set(sql, statement);
sqlite.str_finish(str);
// reset retry count on success
retryCounter[sql] = 0;
return statement;
} catch (ex) {
console.error(ex);
// statement prepare process can be flaky so retry at least 5 times
// before giving up.
if (retryCounter[sql] < 5) {
retryCounter[sql] = (retryCounter[sql] || 0) + 1;
console.warn("Failed to prepare statement. Retrying:", sql);
return prepare(sql);
} else retryCounter[sql] = 0;
if (ex instanceof Error || ex instanceof SQLiteError)
ex.message += ` (query: ${sql})`;
throw ex;
}
}
async function run(
sql: string,
mode: RunMode,
parameters?: SQLiteCompatibleType[]
) {
const prepared = await prepare(sql);
if (!prepared) return [];
try {
if (parameters) sqlite.bind_collection(prepared.stmt, parameters);
// fast path for exec statements
if (mode === "exec") {
while ((await sqlite.step(prepared.stmt)) === SQLITE_ROW);
return [];
}
const rows: Record<string, SQLiteCompatibleType>[] = [];
while ((await sqlite.step(prepared.stmt)) === SQLITE_ROW) {
const row = sqlite.row(prepared.stmt);
const acc: Record<string, SQLiteCompatibleType> = {};
row.forEach((v, i) => (acc[prepared.columns[i]] = v));
rows.push(acc);
}
return rows;
} catch (e) {
if (e instanceof Error || e instanceof SQLiteError)
e.message += ` (query: ${sql})`;
throw e;
} finally {
await sqlite
.reset(prepared.stmt)
// we must clear/destruct the prepared statement if it can't be reset
.catch(() =>
sqlite
.finalize(prepared.stmt)
// ignore error (we will just prepare a new statement)
.catch(console.error)
.finally(() => preparedStatements.delete(sql))
);
}
}
async function exec<R>(
mode: RunMode,
sql: string,
parameters?: SQLiteCompatibleType[]
): Promise<QueryResult<R>> {
if (!sql.startsWith("PRAGMA key")) {
await waitForDatabase();
}
if (!db) throw new Error("No database is not opened.");
const rows = (await run(sql, mode, parameters)) as R[];
if (mode === "query") return { rows };
// initialize the database after it has been successfully decrypted.
// all queries prior to that must wait otherwise we get the
// "file is not a database" error
if (sql.startsWith("PRAGMA key")) await initialize();
return {
insertId: BigInt(sqlite.last_insert_rowid(db)),
numAffectedRows: BigInt(sqlite.changes(db)),
rows: mode === "raw" ? rows : []
};
}
async function close() {
if (!db) return;
for (const [_, prepared] of preparedStatements) {
await sqlite.finalize(prepared.stmt);
}
preparedStatements.clear();
await sqlite.close(db);
await vfs?.close();
db = undefined;
initialized = false;
}
async function exportDatabase(dbName: string, async: boolean) {
const vfs = await getVFS(dbName, async);
const stream = new ReadableStream(new DatabaseSource(vfs, dbName));
return transfer(stream, [stream]);
}
async function deleteDatabase(dbName: string, async: boolean) {
await close();
if (vfs) await vfs.delete();
else await (await getVFS(dbName, async)).delete();
}
async function getVFS(dbName: string, async: boolean) {
const vfs = async
? await import("./IDBBatchAtomicVFS").then(
({ IDBBatchAtomicVFS }) =>
new IDBBatchAtomicVFS(dbName, { durability: "strict" })
)
: await import("./AccessHandlePoolVFS").then(
({ AccessHandlePoolVFS }) => new AccessHandlePoolVFS(dbName)
);
if ("isReady" in vfs) await vfs.isReady;
return vfs;
}
async function initialize() {
self.dispatchEvent(
new MessageEvent("message", { data: { type: "databaseInitialized" } })
);
console.log("Database initialized", db);
initialized = true;
}
const worker = {
close,
open,
run: exec,
export: exportDatabase,
delete: deleteDatabase
type SQLiteOptions = {
async: boolean;
url?: string;
encrypted: boolean;
};
export type SQLiteWorker = typeof worker;
class _SQLiteWorker {
sqlite!: SQLiteAPI;
db: number | undefined = undefined;
vfs: IDBBatchAtomicVFS | AccessHandlePoolVFS | null = null;
initialized = false;
preparedStatements: Map<string, PreparedStatement> = new Map();
retryCounter: Record<string, number> = {};
encrypted = false;
name = "";
async = false;
async open(name: string, options: SQLiteOptions) {
if (this.db) {
console.error("Database is already initialized", this.db);
return;
}
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)
)
: await import("./wa-sqlite").then(({ default: SQLiteSyncESMFactory }) =>
SQLiteSyncESMFactory(option)
);
this.sqlite = Factory(sqliteModule);
this.vfs = await this.getVFS(name, options.async);
this.sqlite.vfs_register(this.vfs, false);
this.db = await this.sqlite.open_v2(
name,
undefined,
`multipleciphers-${this.vfs.name}`
);
}
/**
* Wrapper function for preparing SQL statements with caching
* to avoid unnecessary computations.
*/
async prepare(sql: string): Promise<PreparedStatement | undefined> {
if (!this.db) throw new Error("Database is not initialized.");
try {
const cached = this.preparedStatements.get(sql);
if (cached !== undefined) return cached;
const str = this.sqlite.str_new(this.db, sql);
const prepared = await this.sqlite.prepare_v2(
this.db,
this.sqlite.str_value(str)
);
if (!prepared) return;
const statement: PreparedStatement = {
stmt: prepared.stmt,
columns: this.sqlite.column_names(prepared.stmt)
};
this.preparedStatements.set(sql, statement);
this.sqlite.str_finish(str);
// reset retry count on success
this.retryCounter[sql] = 0;
return statement;
} 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 instanceof SQLiteError)
ex.message += ` (query: ${sql})`;
throw ex;
}
}
async exec(sql: string, mode: RunMode, parameters?: SQLiteCompatibleType[]) {
const prepared = await this.prepare(sql);
if (!prepared) return [];
try {
if (parameters) this.sqlite.bind_collection(prepared.stmt, parameters);
// fast path for exec statements
if (mode === "exec") {
while ((await this.sqlite.step(prepared.stmt)) === SQLITE_ROW);
return [];
}
const rows: Record<string, SQLiteCompatibleType>[] = [];
while ((await this.sqlite.step(prepared.stmt)) === SQLITE_ROW) {
const row = this.sqlite.row(prepared.stmt);
const acc: Record<string, SQLiteCompatibleType> = {};
row.forEach((v, i) => (acc[prepared.columns[i]] = v));
rows.push(acc);
}
return rows;
} catch (e) {
if (e instanceof Error || e instanceof SQLiteError)
e.message += ` (query: ${sql})`;
throw e;
} finally {
await this.sqlite
.reset(prepared.stmt)
// we must clear/destruct the prepared statement if it can't be reset
.catch(() =>
this.sqlite
.finalize(prepared.stmt)
// ignore error (we will just prepare a new statement)
.catch(console.error)
.finally(() => this.preparedStatements.delete(sql))
);
}
}
async run<R>(
mode: RunMode,
sql: string,
parameters?: SQLiteCompatibleType[]
): Promise<QueryResult<R>> {
if (this.encrypted && !sql.startsWith("PRAGMA key")) {
await this.waitForDatabase();
}
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 };
// initialize the database after it has been successfully decrypted.
// all queries prior to that must wait otherwise we get the
// "file is not a database" error
if (this.encrypted && sql.startsWith("PRAGMA key")) await this.initialize();
return {
insertId: BigInt(this.sqlite.last_insert_rowid(this.db)),
numAffectedRows: BigInt(this.sqlite.changes(this.db)),
rows: mode === "raw" ? rows : []
};
}
async close() {
if (!this.db) return;
for (const [_, prepared] of this.preparedStatements) {
await this.sqlite.finalize(prepared.stmt);
}
this.preparedStatements.clear();
await this.sqlite.close(this.db);
await this.vfs?.close();
this.db = undefined;
this.initialized = false;
}
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() {
await this.close();
if (this.vfs) await this.vfs.delete();
else await (await this.getVFS(this.name, this.async)).delete();
}
async getVFS(dbName: string, async: boolean) {
const vfs = async
? await import("./IDBBatchAtomicVFS").then(
({ IDBBatchAtomicVFS }) =>
new IDBBatchAtomicVFS(dbName, { durability: "strict" })
)
: await import("./AccessHandlePoolVFS").then(
({ AccessHandlePoolVFS }) => new AccessHandlePoolVFS(dbName)
);
if ("isReady" in vfs) await vfs.isReady;
return vfs;
}
async initialize() {
self.dispatchEvent(
new MessageEvent("message", {
data: { type: "databaseInitialized", dbName: this.name }
})
);
console.log("Database initialized", this.db);
this.initialized = true;
}
async waitForDatabase() {
// if the database hasn't yet been initialized.
if (!this.initialized) {
console.log("Waiting for database to be initialized...", this.db);
return await new Promise<boolean>((resolve) =>
self.addEventListener("message", (ev) => {
if (
ev.data.type === "databaseInitialized" &&
ev.data.dbName === this.name
)
resolve(true);
})
);
}
return true;
}
}
export type SQLiteWorker = typeof _SQLiteWorker.prototype;
addEventListener("message", async (event) => {
if (!event.data.type) {
await worker.open(event.data.dbName, 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());
}
});
async function waitForDatabase() {
// if the database hasn't yet been initialized.
if (!initialized) {
console.log("Waiting for database to be initialized...", db);
return await new Promise<boolean>((resolve) =>
self.addEventListener("message", (ev) => {
if (ev.data.type === "databaseInitialized") resolve(true);
})
);
}
return true;
}
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

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