this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Sync implementation using cr-sqlite + websockets, across JS and CLI clients (#1)

- Implements CRDT syncing using cr-slqlite.
- Initializes a simple vite application from the cr-sqlite repos that uses Svelte
- implements a websocket go server backend for communicating syncs between applications

Needs lots of refactoring, everything is hardcoded

Co-authored-by: Anish Lakhwara <anish+git@lakhwara.com>
Reviewed-on: https://git.sealight.xyz/aynish/mast/pulls/1

aynish d46d6783 5ca28cfb

+2088 -85
+15 -16
db/migrations.go
··· 1 - package main 1 + package mast 2 2 3 3 import ( 4 - "database/sql" 4 + "database/sql" 5 5 ) 6 6 7 7 func RunMigrations(db *sql.DB) error { 8 - // Load the cr-sqlite extension 9 - _, err := db.Exec("SELECT load_extension('crsqlite.so')") 10 - if err != nil { 11 - return err 12 - } 8 + // Load the cr-sqlite extension 9 + // _, err := db.Exec("SELECT load_extension('./crsqlite.so', 'sqlite3_crsqlite_init')") 10 + // if err != nil { 11 + // return fmt.Errorf("failed to load cr-sqlite extension: %w", err) 12 + // } 13 13 14 - // Create the todos table and initialize it as a CRDT 15 - _, err = db.Exec(` 16 - CREATE TABLE IF NOT EXISTS todos (id INTEGER PRIMARY KEY, content TEXT); 17 - SELECT crsql_as_crr('todos'); 14 + // Create the todos table and initialize it as a CRDT 15 + _, err := db.Exec(` 16 + CREATE TABLE IF NOT EXISTS todos (id blob PRIMARY KEY NOT NULL, content TEXT, completed INTEGER NOT NULL DEFAULT 0); 17 + SELECT crsql_as_crr('todos'); 18 18 `) 19 - if err != nil { 20 - return err 21 - } 19 + if err != nil { 20 + return err 21 + } 22 22 23 - return nil 23 + return nil 24 24 } 25 -
+5 -1
flake.nix
··· 8 8 in 9 9 { 10 10 devShells."x86_64-linux".default = pkgs.mkShell { 11 - packages = [ pkgs.go ]; 11 + packages = with pkgs; [ 12 + go 13 + sqlite 14 + nodejs 15 + ]; 12 16 }; 13 17 }; 14 18 }
+15 -2
go.mod
··· 3 3 go 1.21.6 4 4 5 5 require ( 6 - github.com/charmbracelet/bubbletea v0.26.6 // indirect 6 + github.com/charmbracelet/bubbles v0.18.0 7 + github.com/charmbracelet/bubbletea v0.26.6 8 + github.com/gofrs/uuid v4.4.0+incompatible 9 + github.com/mattn/go-sqlite3 v1.14.22 10 + ) 11 + 12 + require ( 13 + github.com/atotto/clipboard v0.1.4 // indirect 14 + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect 15 + github.com/charmbracelet/lipgloss v0.9.1 // indirect 7 16 github.com/charmbracelet/x/ansi v0.1.2 // indirect 8 17 github.com/charmbracelet/x/input v0.1.0 // indirect 9 18 github.com/charmbracelet/x/term v0.1.1 // indirect 10 19 github.com/charmbracelet/x/windows v0.1.0 // indirect 11 20 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect 21 + github.com/gorilla/websocket v1.5.3 // indirect 22 + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect 23 + github.com/mattn/go-isatty v0.0.18 // indirect 12 24 github.com/mattn/go-localereader v0.0.1 // indirect 13 25 github.com/mattn/go-runewidth v0.0.15 // indirect 14 - github.com/mattn/go-sqlite3 v1.14.22 // indirect 15 26 github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect 16 27 github.com/muesli/cancelreader v0.2.2 // indirect 28 + github.com/muesli/reflow v0.3.0 // indirect 29 + github.com/muesli/termenv v0.15.2 // indirect 17 30 github.com/rivo/uniseg v0.4.7 // indirect 18 31 github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect 19 32 golang.org/x/sync v0.7.0 // indirect
+25
go.sum
··· 1 + github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= 2 + github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= 3 + github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= 4 + github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= 5 + github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= 6 + github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= 1 7 github.com/charmbracelet/bubbletea v0.26.6 h1:zTCWSuST+3yZYZnVSvbXwKOPRSNZceVeqpzOLN2zq1s= 2 8 github.com/charmbracelet/bubbletea v0.26.6/go.mod h1:dz8CWPlfCCGLFbBlTY4N7bjLiyOGDJEnd2Muu7pOWhk= 9 + github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg= 10 + github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I= 3 11 github.com/charmbracelet/x/ansi v0.1.2 h1:6+LR39uG8DE6zAmbu023YlqjJHkYXDF1z36ZwzO4xZY= 4 12 github.com/charmbracelet/x/ansi v0.1.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= 5 13 github.com/charmbracelet/x/input v0.1.0 h1:TEsGSfZYQyOtp+STIjyBq6tpRaorH0qpwZUj8DavAhQ= ··· 10 18 github.com/charmbracelet/x/windows v0.1.0/go.mod h1:GLEO/l+lizvFDBPLIOk+49gdX49L9YWMB5t+DZd0jkQ= 11 19 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= 12 20 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= 21 + github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= 22 + github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= 23 + github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= 24 + github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 25 + github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= 26 + github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= 27 + github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= 28 + github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 13 29 github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= 14 30 github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= 31 + github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= 15 32 github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= 16 33 github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= 17 34 github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= ··· 20 37 github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= 21 38 github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= 22 39 github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= 40 + github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= 41 + github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= 42 + github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= 43 + github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= 44 + github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= 23 45 github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= 24 46 github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= 25 47 github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= 26 48 github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= 27 49 github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= 50 + golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E= 51 + golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= 28 52 golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= 29 53 golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 30 54 golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 55 + golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 31 56 golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= 32 57 golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 33 58 golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
+24
js/.gitignore
··· 1 + # Logs 2 + logs 3 + *.log 4 + npm-debug.log* 5 + yarn-debug.log* 6 + yarn-error.log* 7 + pnpm-debug.log* 8 + lerna-debug.log* 9 + 10 + node_modules 11 + dist 12 + dist-ssr 13 + *.local 14 + 15 + # Editor directories and files 16 + .vscode/* 17 + !.vscode/extensions.json 18 + .idea 19 + .DS_Store 20 + *.suo 21 + *.ntvs* 22 + *.njsproj 23 + *.sln 24 + *.sw?
+3
js/.vscode/extensions.json
··· 1 + { 2 + "recommendations": ["svelte.svelte-vscode"] 3 + }
+47
js/README.md
··· 1 + # Svelte + Vite 2 + 3 + This template should help get you started developing with Svelte in Vite. 4 + 5 + ## Recommended IDE Setup 6 + 7 + [VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). 8 + 9 + ## Need an official Svelte framework? 10 + 11 + Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more. 12 + 13 + ## Technical considerations 14 + 15 + **Why use this over SvelteKit?** 16 + 17 + - It brings its own routing solution which might not be preferable for some users. 18 + - It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app. 19 + 20 + This template contains as little as possible to get started with Vite + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project. 21 + 22 + Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate. 23 + 24 + **Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?** 25 + 26 + Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information. 27 + 28 + **Why include `.vscode/extensions.json`?** 29 + 30 + Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project. 31 + 32 + **Why enable `checkJs` in the JS template?** 33 + 34 + It is likely that most cases of changing variable types in runtime are likely to be accidental, rather than deliberate. This provides advanced typechecking out of the box. Should you like to take advantage of the dynamically-typed nature of JavaScript, it is trivial to change the configuration. 35 + 36 + **Why is HMR not preserving my local component state?** 37 + 38 + HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/sveltejs/svelte-hmr/tree/master/packages/svelte-hmr#preservation-of-local-state). 39 + 40 + If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR. 41 + 42 + ```js 43 + // store.js 44 + // An extremely simple external store 45 + import { writable } from 'svelte/store' 46 + export default writable(0) 47 + ```
+13
js/index.html
··· 1 + <!doctype html> 2 + <html lang="en"> 3 + <head> 4 + <meta charset="UTF-8" /> 5 + <link rel="icon" type="image/svg+xml" href="/vite.svg" /> 6 + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 7 + <title>Vite + Svelte</title> 8 + </head> 9 + <body> 10 + <div id="app"></div> 11 + <script type="module" src="/src/main.js"></script> 12 + </body> 13 + </html>
+32
js/jsconfig.json
··· 1 + { 2 + "compilerOptions": { 3 + "moduleResolution": "bundler", 4 + "target": "ESNext", 5 + "module": "ESNext", 6 + /** 7 + * svelte-preprocess cannot figure out whether you have 8 + * a value or a type, so tell TypeScript to enforce using 9 + * `import type` instead of `import` for Types. 10 + */ 11 + "verbatimModuleSyntax": true, 12 + "isolatedModules": true, 13 + "resolveJsonModule": true, 14 + /** 15 + * To have warnings / errors of the Svelte compiler at the 16 + * correct position, enable source maps by default. 17 + */ 18 + "sourceMap": true, 19 + "esModuleInterop": true, 20 + "skipLibCheck": true, 21 + /** 22 + * Typecheck JS in `.svelte` and `.js` files by default. 23 + * Disable this if you'd like to use dynamic types. 24 + */ 25 + "checkJs": true 26 + }, 27 + /** 28 + * Use global.d.ts instead of compilerOptions.types 29 + * to avoid limiting type declarations. 30 + */ 31 + "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"] 32 + }
+1228
js/package-lock.json
··· 1 + { 2 + "name": "js", 3 + "version": "0.0.0", 4 + "lockfileVersion": 3, 5 + "requires": true, 6 + "packages": { 7 + "": { 8 + "name": "js", 9 + "version": "0.0.0", 10 + "dependencies": { 11 + "@vlcn.io/crsqlite-wasm": "^0.16.0", 12 + "@vlcn.io/ws-browserdb": "^0.2.0", 13 + "@vlcn.io/ws-client": "^0.2.0", 14 + "@vlcn.io/xplat-api": "^0.15.0" 15 + }, 16 + "devDependencies": { 17 + "@sveltejs/vite-plugin-svelte": "^3.1.1", 18 + "svelte": "^4.2.18", 19 + "vite": "^5.3.4" 20 + } 21 + }, 22 + "node_modules/@ampproject/remapping": { 23 + "version": "2.3.0", 24 + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", 25 + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", 26 + "dev": true, 27 + "dependencies": { 28 + "@jridgewell/gen-mapping": "^0.3.5", 29 + "@jridgewell/trace-mapping": "^0.3.24" 30 + }, 31 + "engines": { 32 + "node": ">=6.0.0" 33 + } 34 + }, 35 + "node_modules/@esbuild/aix-ppc64": { 36 + "version": "0.21.5", 37 + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", 38 + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", 39 + "cpu": [ 40 + "ppc64" 41 + ], 42 + "dev": true, 43 + "optional": true, 44 + "os": [ 45 + "aix" 46 + ], 47 + "engines": { 48 + "node": ">=12" 49 + } 50 + }, 51 + "node_modules/@esbuild/android-arm": { 52 + "version": "0.21.5", 53 + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", 54 + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", 55 + "cpu": [ 56 + "arm" 57 + ], 58 + "dev": true, 59 + "optional": true, 60 + "os": [ 61 + "android" 62 + ], 63 + "engines": { 64 + "node": ">=12" 65 + } 66 + }, 67 + "node_modules/@esbuild/android-arm64": { 68 + "version": "0.21.5", 69 + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", 70 + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", 71 + "cpu": [ 72 + "arm64" 73 + ], 74 + "dev": true, 75 + "optional": true, 76 + "os": [ 77 + "android" 78 + ], 79 + "engines": { 80 + "node": ">=12" 81 + } 82 + }, 83 + "node_modules/@esbuild/android-x64": { 84 + "version": "0.21.5", 85 + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", 86 + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", 87 + "cpu": [ 88 + "x64" 89 + ], 90 + "dev": true, 91 + "optional": true, 92 + "os": [ 93 + "android" 94 + ], 95 + "engines": { 96 + "node": ">=12" 97 + } 98 + }, 99 + "node_modules/@esbuild/darwin-arm64": { 100 + "version": "0.21.5", 101 + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", 102 + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", 103 + "cpu": [ 104 + "arm64" 105 + ], 106 + "dev": true, 107 + "optional": true, 108 + "os": [ 109 + "darwin" 110 + ], 111 + "engines": { 112 + "node": ">=12" 113 + } 114 + }, 115 + "node_modules/@esbuild/darwin-x64": { 116 + "version": "0.21.5", 117 + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", 118 + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", 119 + "cpu": [ 120 + "x64" 121 + ], 122 + "dev": true, 123 + "optional": true, 124 + "os": [ 125 + "darwin" 126 + ], 127 + "engines": { 128 + "node": ">=12" 129 + } 130 + }, 131 + "node_modules/@esbuild/freebsd-arm64": { 132 + "version": "0.21.5", 133 + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", 134 + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", 135 + "cpu": [ 136 + "arm64" 137 + ], 138 + "dev": true, 139 + "optional": true, 140 + "os": [ 141 + "freebsd" 142 + ], 143 + "engines": { 144 + "node": ">=12" 145 + } 146 + }, 147 + "node_modules/@esbuild/freebsd-x64": { 148 + "version": "0.21.5", 149 + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", 150 + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", 151 + "cpu": [ 152 + "x64" 153 + ], 154 + "dev": true, 155 + "optional": true, 156 + "os": [ 157 + "freebsd" 158 + ], 159 + "engines": { 160 + "node": ">=12" 161 + } 162 + }, 163 + "node_modules/@esbuild/linux-arm": { 164 + "version": "0.21.5", 165 + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", 166 + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", 167 + "cpu": [ 168 + "arm" 169 + ], 170 + "dev": true, 171 + "optional": true, 172 + "os": [ 173 + "linux" 174 + ], 175 + "engines": { 176 + "node": ">=12" 177 + } 178 + }, 179 + "node_modules/@esbuild/linux-arm64": { 180 + "version": "0.21.5", 181 + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", 182 + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", 183 + "cpu": [ 184 + "arm64" 185 + ], 186 + "dev": true, 187 + "optional": true, 188 + "os": [ 189 + "linux" 190 + ], 191 + "engines": { 192 + "node": ">=12" 193 + } 194 + }, 195 + "node_modules/@esbuild/linux-ia32": { 196 + "version": "0.21.5", 197 + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", 198 + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", 199 + "cpu": [ 200 + "ia32" 201 + ], 202 + "dev": true, 203 + "optional": true, 204 + "os": [ 205 + "linux" 206 + ], 207 + "engines": { 208 + "node": ">=12" 209 + } 210 + }, 211 + "node_modules/@esbuild/linux-loong64": { 212 + "version": "0.21.5", 213 + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", 214 + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", 215 + "cpu": [ 216 + "loong64" 217 + ], 218 + "dev": true, 219 + "optional": true, 220 + "os": [ 221 + "linux" 222 + ], 223 + "engines": { 224 + "node": ">=12" 225 + } 226 + }, 227 + "node_modules/@esbuild/linux-mips64el": { 228 + "version": "0.21.5", 229 + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", 230 + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", 231 + "cpu": [ 232 + "mips64el" 233 + ], 234 + "dev": true, 235 + "optional": true, 236 + "os": [ 237 + "linux" 238 + ], 239 + "engines": { 240 + "node": ">=12" 241 + } 242 + }, 243 + "node_modules/@esbuild/linux-ppc64": { 244 + "version": "0.21.5", 245 + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", 246 + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", 247 + "cpu": [ 248 + "ppc64" 249 + ], 250 + "dev": true, 251 + "optional": true, 252 + "os": [ 253 + "linux" 254 + ], 255 + "engines": { 256 + "node": ">=12" 257 + } 258 + }, 259 + "node_modules/@esbuild/linux-riscv64": { 260 + "version": "0.21.5", 261 + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", 262 + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", 263 + "cpu": [ 264 + "riscv64" 265 + ], 266 + "dev": true, 267 + "optional": true, 268 + "os": [ 269 + "linux" 270 + ], 271 + "engines": { 272 + "node": ">=12" 273 + } 274 + }, 275 + "node_modules/@esbuild/linux-s390x": { 276 + "version": "0.21.5", 277 + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", 278 + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", 279 + "cpu": [ 280 + "s390x" 281 + ], 282 + "dev": true, 283 + "optional": true, 284 + "os": [ 285 + "linux" 286 + ], 287 + "engines": { 288 + "node": ">=12" 289 + } 290 + }, 291 + "node_modules/@esbuild/linux-x64": { 292 + "version": "0.21.5", 293 + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", 294 + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", 295 + "cpu": [ 296 + "x64" 297 + ], 298 + "dev": true, 299 + "optional": true, 300 + "os": [ 301 + "linux" 302 + ], 303 + "engines": { 304 + "node": ">=12" 305 + } 306 + }, 307 + "node_modules/@esbuild/netbsd-x64": { 308 + "version": "0.21.5", 309 + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", 310 + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", 311 + "cpu": [ 312 + "x64" 313 + ], 314 + "dev": true, 315 + "optional": true, 316 + "os": [ 317 + "netbsd" 318 + ], 319 + "engines": { 320 + "node": ">=12" 321 + } 322 + }, 323 + "node_modules/@esbuild/openbsd-x64": { 324 + "version": "0.21.5", 325 + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", 326 + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", 327 + "cpu": [ 328 + "x64" 329 + ], 330 + "dev": true, 331 + "optional": true, 332 + "os": [ 333 + "openbsd" 334 + ], 335 + "engines": { 336 + "node": ">=12" 337 + } 338 + }, 339 + "node_modules/@esbuild/sunos-x64": { 340 + "version": "0.21.5", 341 + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", 342 + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", 343 + "cpu": [ 344 + "x64" 345 + ], 346 + "dev": true, 347 + "optional": true, 348 + "os": [ 349 + "sunos" 350 + ], 351 + "engines": { 352 + "node": ">=12" 353 + } 354 + }, 355 + "node_modules/@esbuild/win32-arm64": { 356 + "version": "0.21.5", 357 + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", 358 + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", 359 + "cpu": [ 360 + "arm64" 361 + ], 362 + "dev": true, 363 + "optional": true, 364 + "os": [ 365 + "win32" 366 + ], 367 + "engines": { 368 + "node": ">=12" 369 + } 370 + }, 371 + "node_modules/@esbuild/win32-ia32": { 372 + "version": "0.21.5", 373 + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", 374 + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", 375 + "cpu": [ 376 + "ia32" 377 + ], 378 + "dev": true, 379 + "optional": true, 380 + "os": [ 381 + "win32" 382 + ], 383 + "engines": { 384 + "node": ">=12" 385 + } 386 + }, 387 + "node_modules/@esbuild/win32-x64": { 388 + "version": "0.21.5", 389 + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", 390 + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", 391 + "cpu": [ 392 + "x64" 393 + ], 394 + "dev": true, 395 + "optional": true, 396 + "os": [ 397 + "win32" 398 + ], 399 + "engines": { 400 + "node": ">=12" 401 + } 402 + }, 403 + "node_modules/@jridgewell/gen-mapping": { 404 + "version": "0.3.5", 405 + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", 406 + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", 407 + "dev": true, 408 + "dependencies": { 409 + "@jridgewell/set-array": "^1.2.1", 410 + "@jridgewell/sourcemap-codec": "^1.4.10", 411 + "@jridgewell/trace-mapping": "^0.3.24" 412 + }, 413 + "engines": { 414 + "node": ">=6.0.0" 415 + } 416 + }, 417 + "node_modules/@jridgewell/resolve-uri": { 418 + "version": "3.1.2", 419 + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", 420 + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", 421 + "dev": true, 422 + "engines": { 423 + "node": ">=6.0.0" 424 + } 425 + }, 426 + "node_modules/@jridgewell/set-array": { 427 + "version": "1.2.1", 428 + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", 429 + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", 430 + "dev": true, 431 + "engines": { 432 + "node": ">=6.0.0" 433 + } 434 + }, 435 + "node_modules/@jridgewell/sourcemap-codec": { 436 + "version": "1.5.0", 437 + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", 438 + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", 439 + "dev": true 440 + }, 441 + "node_modules/@jridgewell/trace-mapping": { 442 + "version": "0.3.25", 443 + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", 444 + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", 445 + "dev": true, 446 + "dependencies": { 447 + "@jridgewell/resolve-uri": "^3.1.0", 448 + "@jridgewell/sourcemap-codec": "^1.4.14" 449 + } 450 + }, 451 + "node_modules/@rollup/rollup-android-arm-eabi": { 452 + "version": "4.20.0", 453 + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.20.0.tgz", 454 + "integrity": "sha512-TSpWzflCc4VGAUJZlPpgAJE1+V60MePDQnBd7PPkpuEmOy8i87aL6tinFGKBFKuEDikYpig72QzdT3QPYIi+oA==", 455 + "cpu": [ 456 + "arm" 457 + ], 458 + "dev": true, 459 + "optional": true, 460 + "os": [ 461 + "android" 462 + ] 463 + }, 464 + "node_modules/@rollup/rollup-android-arm64": { 465 + "version": "4.20.0", 466 + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.20.0.tgz", 467 + "integrity": "sha512-u00Ro/nok7oGzVuh/FMYfNoGqxU5CPWz1mxV85S2w9LxHR8OoMQBuSk+3BKVIDYgkpeOET5yXkx90OYFc+ytpQ==", 468 + "cpu": [ 469 + "arm64" 470 + ], 471 + "dev": true, 472 + "optional": true, 473 + "os": [ 474 + "android" 475 + ] 476 + }, 477 + "node_modules/@rollup/rollup-darwin-arm64": { 478 + "version": "4.20.0", 479 + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.20.0.tgz", 480 + "integrity": "sha512-uFVfvzvsdGtlSLuL0ZlvPJvl6ZmrH4CBwLGEFPe7hUmf7htGAN+aXo43R/V6LATyxlKVC/m6UsLb7jbG+LG39Q==", 481 + "cpu": [ 482 + "arm64" 483 + ], 484 + "dev": true, 485 + "optional": true, 486 + "os": [ 487 + "darwin" 488 + ] 489 + }, 490 + "node_modules/@rollup/rollup-darwin-x64": { 491 + "version": "4.20.0", 492 + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.20.0.tgz", 493 + "integrity": "sha512-xbrMDdlev53vNXexEa6l0LffojxhqDTBeL+VUxuuIXys4x6xyvbKq5XqTXBCEUA8ty8iEJblHvFaWRJTk/icAQ==", 494 + "cpu": [ 495 + "x64" 496 + ], 497 + "dev": true, 498 + "optional": true, 499 + "os": [ 500 + "darwin" 501 + ] 502 + }, 503 + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { 504 + "version": "4.20.0", 505 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.20.0.tgz", 506 + "integrity": "sha512-jMYvxZwGmoHFBTbr12Xc6wOdc2xA5tF5F2q6t7Rcfab68TT0n+r7dgawD4qhPEvasDsVpQi+MgDzj2faOLsZjA==", 507 + "cpu": [ 508 + "arm" 509 + ], 510 + "dev": true, 511 + "optional": true, 512 + "os": [ 513 + "linux" 514 + ] 515 + }, 516 + "node_modules/@rollup/rollup-linux-arm-musleabihf": { 517 + "version": "4.20.0", 518 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.20.0.tgz", 519 + "integrity": "sha512-1asSTl4HKuIHIB1GcdFHNNZhxAYEdqML/MW4QmPS4G0ivbEcBr1JKlFLKsIRqjSwOBkdItn3/ZDlyvZ/N6KPlw==", 520 + "cpu": [ 521 + "arm" 522 + ], 523 + "dev": true, 524 + "optional": true, 525 + "os": [ 526 + "linux" 527 + ] 528 + }, 529 + "node_modules/@rollup/rollup-linux-arm64-gnu": { 530 + "version": "4.20.0", 531 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.20.0.tgz", 532 + "integrity": "sha512-COBb8Bkx56KldOYJfMf6wKeYJrtJ9vEgBRAOkfw6Ens0tnmzPqvlpjZiLgkhg6cA3DGzCmLmmd319pmHvKWWlQ==", 533 + "cpu": [ 534 + "arm64" 535 + ], 536 + "dev": true, 537 + "optional": true, 538 + "os": [ 539 + "linux" 540 + ] 541 + }, 542 + "node_modules/@rollup/rollup-linux-arm64-musl": { 543 + "version": "4.20.0", 544 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.20.0.tgz", 545 + "integrity": "sha512-+it+mBSyMslVQa8wSPvBx53fYuZK/oLTu5RJoXogjk6x7Q7sz1GNRsXWjn6SwyJm8E/oMjNVwPhmNdIjwP135Q==", 546 + "cpu": [ 547 + "arm64" 548 + ], 549 + "dev": true, 550 + "optional": true, 551 + "os": [ 552 + "linux" 553 + ] 554 + }, 555 + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { 556 + "version": "4.20.0", 557 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.20.0.tgz", 558 + "integrity": "sha512-yAMvqhPfGKsAxHN8I4+jE0CpLWD8cv4z7CK7BMmhjDuz606Q2tFKkWRY8bHR9JQXYcoLfopo5TTqzxgPUjUMfw==", 559 + "cpu": [ 560 + "ppc64" 561 + ], 562 + "dev": true, 563 + "optional": true, 564 + "os": [ 565 + "linux" 566 + ] 567 + }, 568 + "node_modules/@rollup/rollup-linux-riscv64-gnu": { 569 + "version": "4.20.0", 570 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.20.0.tgz", 571 + "integrity": "sha512-qmuxFpfmi/2SUkAw95TtNq/w/I7Gpjurx609OOOV7U4vhvUhBcftcmXwl3rqAek+ADBwSjIC4IVNLiszoj3dPA==", 572 + "cpu": [ 573 + "riscv64" 574 + ], 575 + "dev": true, 576 + "optional": true, 577 + "os": [ 578 + "linux" 579 + ] 580 + }, 581 + "node_modules/@rollup/rollup-linux-s390x-gnu": { 582 + "version": "4.20.0", 583 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.20.0.tgz", 584 + "integrity": "sha512-I0BtGXddHSHjV1mqTNkgUZLnS3WtsqebAXv11D5BZE/gfw5KoyXSAXVqyJximQXNvNzUo4GKlCK/dIwXlz+jlg==", 585 + "cpu": [ 586 + "s390x" 587 + ], 588 + "dev": true, 589 + "optional": true, 590 + "os": [ 591 + "linux" 592 + ] 593 + }, 594 + "node_modules/@rollup/rollup-linux-x64-gnu": { 595 + "version": "4.20.0", 596 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.20.0.tgz", 597 + "integrity": "sha512-y+eoL2I3iphUg9tN9GB6ku1FA8kOfmF4oUEWhztDJ4KXJy1agk/9+pejOuZkNFhRwHAOxMsBPLbXPd6mJiCwew==", 598 + "cpu": [ 599 + "x64" 600 + ], 601 + "dev": true, 602 + "optional": true, 603 + "os": [ 604 + "linux" 605 + ] 606 + }, 607 + "node_modules/@rollup/rollup-linux-x64-musl": { 608 + "version": "4.20.0", 609 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.20.0.tgz", 610 + "integrity": "sha512-hM3nhW40kBNYUkZb/r9k2FKK+/MnKglX7UYd4ZUy5DJs8/sMsIbqWK2piZtVGE3kcXVNj3B2IrUYROJMMCikNg==", 611 + "cpu": [ 612 + "x64" 613 + ], 614 + "dev": true, 615 + "optional": true, 616 + "os": [ 617 + "linux" 618 + ] 619 + }, 620 + "node_modules/@rollup/rollup-win32-arm64-msvc": { 621 + "version": "4.20.0", 622 + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.20.0.tgz", 623 + "integrity": "sha512-psegMvP+Ik/Bg7QRJbv8w8PAytPA7Uo8fpFjXyCRHWm6Nt42L+JtoqH8eDQ5hRP7/XW2UiIriy1Z46jf0Oa1kA==", 624 + "cpu": [ 625 + "arm64" 626 + ], 627 + "dev": true, 628 + "optional": true, 629 + "os": [ 630 + "win32" 631 + ] 632 + }, 633 + "node_modules/@rollup/rollup-win32-ia32-msvc": { 634 + "version": "4.20.0", 635 + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.20.0.tgz", 636 + "integrity": "sha512-GabekH3w4lgAJpVxkk7hUzUf2hICSQO0a/BLFA11/RMxQT92MabKAqyubzDZmMOC/hcJNlc+rrypzNzYl4Dx7A==", 637 + "cpu": [ 638 + "ia32" 639 + ], 640 + "dev": true, 641 + "optional": true, 642 + "os": [ 643 + "win32" 644 + ] 645 + }, 646 + "node_modules/@rollup/rollup-win32-x64-msvc": { 647 + "version": "4.20.0", 648 + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.20.0.tgz", 649 + "integrity": "sha512-aJ1EJSuTdGnM6qbVC4B5DSmozPTqIag9fSzXRNNo+humQLG89XpPgdt16Ia56ORD7s+H8Pmyx44uczDQ0yDzpg==", 650 + "cpu": [ 651 + "x64" 652 + ], 653 + "dev": true, 654 + "optional": true, 655 + "os": [ 656 + "win32" 657 + ] 658 + }, 659 + "node_modules/@sveltejs/vite-plugin-svelte": { 660 + "version": "3.1.1", 661 + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-3.1.1.tgz", 662 + "integrity": "sha512-rimpFEAboBBHIlzISibg94iP09k/KYdHgVhJlcsTfn7KMBhc70jFX/GRWkRdFCc2fdnk+4+Bdfej23cMDnJS6A==", 663 + "dev": true, 664 + "dependencies": { 665 + "@sveltejs/vite-plugin-svelte-inspector": "^2.1.0", 666 + "debug": "^4.3.4", 667 + "deepmerge": "^4.3.1", 668 + "kleur": "^4.1.5", 669 + "magic-string": "^0.30.10", 670 + "svelte-hmr": "^0.16.0", 671 + "vitefu": "^0.2.5" 672 + }, 673 + "engines": { 674 + "node": "^18.0.0 || >=20" 675 + }, 676 + "peerDependencies": { 677 + "svelte": "^4.0.0 || ^5.0.0-next.0", 678 + "vite": "^5.0.0" 679 + } 680 + }, 681 + "node_modules/@sveltejs/vite-plugin-svelte-inspector": { 682 + "version": "2.1.0", 683 + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-2.1.0.tgz", 684 + "integrity": "sha512-9QX28IymvBlSCqsCll5t0kQVxipsfhFFL+L2t3nTWfXnddYwxBuAEtTtlaVQpRz9c37BhJjltSeY4AJSC03SSg==", 685 + "dev": true, 686 + "dependencies": { 687 + "debug": "^4.3.4" 688 + }, 689 + "engines": { 690 + "node": "^18.0.0 || >=20" 691 + }, 692 + "peerDependencies": { 693 + "@sveltejs/vite-plugin-svelte": "^3.0.0", 694 + "svelte": "^4.0.0 || ^5.0.0-next.0", 695 + "vite": "^5.0.0" 696 + } 697 + }, 698 + "node_modules/@types/estree": { 699 + "version": "1.0.5", 700 + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", 701 + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", 702 + "dev": true 703 + }, 704 + "node_modules/@types/throttle-debounce": { 705 + "version": "5.0.2", 706 + "resolved": "https://registry.npmjs.org/@types/throttle-debounce/-/throttle-debounce-5.0.2.tgz", 707 + "integrity": "sha512-pDzSNulqooSKvSNcksnV72nk8p7gRqN8As71Sp28nov1IgmPKWbOEIwAWvBME5pPTtaXJAvG3O4oc76HlQ4kqQ==" 708 + }, 709 + "node_modules/@vlcn.io/crsqlite-wasm": { 710 + "version": "0.16.0", 711 + "resolved": "https://registry.npmjs.org/@vlcn.io/crsqlite-wasm/-/crsqlite-wasm-0.16.0.tgz", 712 + "integrity": "sha512-5gf52eyMYvZirxuEUo4QS65JhEsw3fndoO+tCtCEOxuiIEtvaKB2/6wuuKGRlMVkxIp4Bls70D3DCF5v9lcJxA==", 713 + "dependencies": { 714 + "@vlcn.io/wa-sqlite": "0.22.0", 715 + "@vlcn.io/xplat-api": "0.15.0", 716 + "async-mutex": "^0.4.0" 717 + } 718 + }, 719 + "node_modules/@vlcn.io/rx-tbl": { 720 + "version": "0.15.0", 721 + "resolved": "https://registry.npmjs.org/@vlcn.io/rx-tbl/-/rx-tbl-0.15.0.tgz", 722 + "integrity": "sha512-6P5R8E5EJ6oASDyT7TbuV18Af4P/YobGEI3+uGUoquQi0GVl+NLdtbYA/sR4PkXsjQ1zBcs0oAi5TmYGe+Cd6A==", 723 + "dependencies": { 724 + "@vlcn.io/xplat-api": "0.15.0" 725 + } 726 + }, 727 + "node_modules/@vlcn.io/wa-sqlite": { 728 + "version": "0.22.0", 729 + "resolved": "https://registry.npmjs.org/@vlcn.io/wa-sqlite/-/wa-sqlite-0.22.0.tgz", 730 + "integrity": "sha512-OujKro0mAqP7/efUeCGB6zBiyMoSCFVe7jQKPF0n47U9ZhOaIW3kQUVCwF+CmzvzQfN1Vl4PrFQRNNxlSwTCNQ==" 731 + }, 732 + "node_modules/@vlcn.io/ws-browserdb": { 733 + "version": "0.2.0", 734 + "resolved": "https://registry.npmjs.org/@vlcn.io/ws-browserdb/-/ws-browserdb-0.2.0.tgz", 735 + "integrity": "sha512-TKPygQomMPurQ8mwAwEefN5BROw30FagL21S3FzvUunyCybOByysAEoV/OrJ7xNCvYXN9yjg0qyf7iZZfeOsYg==", 736 + "dependencies": { 737 + "@types/throttle-debounce": "^5.0.0", 738 + "@vlcn.io/crsqlite-wasm": "0.16.0", 739 + "@vlcn.io/rx-tbl": "0.15.0", 740 + "@vlcn.io/ws-client": "0.2.0", 741 + "@vlcn.io/ws-common": "0.2.0", 742 + "@vlcn.io/xplat-api": "0.15.0" 743 + } 744 + }, 745 + "node_modules/@vlcn.io/ws-client": { 746 + "version": "0.2.0", 747 + "resolved": "https://registry.npmjs.org/@vlcn.io/ws-client/-/ws-client-0.2.0.tgz", 748 + "integrity": "sha512-0Nwqh/vBrKZNmRvVS2/LHUm8ssgfXbAzS5J3h3b2l9FQWDDsF3f+DfFekR/ExNagFGHEk8ZEjTQtIzj+F9doJw==", 749 + "dependencies": { 750 + "@types/throttle-debounce": "^5.0.0", 751 + "@vlcn.io/ws-common": "0.2.0" 752 + } 753 + }, 754 + "node_modules/@vlcn.io/ws-common": { 755 + "version": "0.2.0", 756 + "resolved": "https://registry.npmjs.org/@vlcn.io/ws-common/-/ws-common-0.2.0.tgz", 757 + "integrity": "sha512-c7a470fCAzKzsjn+dchp+zAHXXem2eG2W7RxjHowZuO9PUfLjMAKp0GpZ9rsKAyLiyYRMOFAFnpl0HmFxERjig==", 758 + "dependencies": { 759 + "lib0": "^0.2.73" 760 + } 761 + }, 762 + "node_modules/@vlcn.io/xplat-api": { 763 + "version": "0.15.0", 764 + "resolved": "https://registry.npmjs.org/@vlcn.io/xplat-api/-/xplat-api-0.15.0.tgz", 765 + "integrity": "sha512-2/aE7VgI3EbIO5EcJGrskAJuCa2pteY1rWNWfhovFKMERe9NhJdlDMIB1I31X0sN/WC2DnF30RqcdTXNfYyzhQ==", 766 + "dependencies": { 767 + "comlink": "^4.4.1" 768 + } 769 + }, 770 + "node_modules/acorn": { 771 + "version": "8.12.1", 772 + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", 773 + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", 774 + "dev": true, 775 + "bin": { 776 + "acorn": "bin/acorn" 777 + }, 778 + "engines": { 779 + "node": ">=0.4.0" 780 + } 781 + }, 782 + "node_modules/aria-query": { 783 + "version": "5.3.0", 784 + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", 785 + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", 786 + "dev": true, 787 + "dependencies": { 788 + "dequal": "^2.0.3" 789 + } 790 + }, 791 + "node_modules/async-mutex": { 792 + "version": "0.4.1", 793 + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.4.1.tgz", 794 + "integrity": "sha512-WfoBo4E/TbCX1G95XTjbWTE3X2XLG0m1Xbv2cwOtuPdyH9CZvnaA5nCt1ucjaKEgW2A5IF71hxrRhr83Je5xjA==", 795 + "dependencies": { 796 + "tslib": "^2.4.0" 797 + } 798 + }, 799 + "node_modules/axobject-query": { 800 + "version": "4.1.0", 801 + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", 802 + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", 803 + "dev": true, 804 + "engines": { 805 + "node": ">= 0.4" 806 + } 807 + }, 808 + "node_modules/code-red": { 809 + "version": "1.0.4", 810 + "resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz", 811 + "integrity": "sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==", 812 + "dev": true, 813 + "dependencies": { 814 + "@jridgewell/sourcemap-codec": "^1.4.15", 815 + "@types/estree": "^1.0.1", 816 + "acorn": "^8.10.0", 817 + "estree-walker": "^3.0.3", 818 + "periscopic": "^3.1.0" 819 + } 820 + }, 821 + "node_modules/comlink": { 822 + "version": "4.4.1", 823 + "resolved": "https://registry.npmjs.org/comlink/-/comlink-4.4.1.tgz", 824 + "integrity": "sha512-+1dlx0aY5Jo1vHy/tSsIGpSkN4tS9rZSW8FIhG0JH/crs9wwweswIo/POr451r7bZww3hFbPAKnTpimzL/mm4Q==" 825 + }, 826 + "node_modules/css-tree": { 827 + "version": "2.3.1", 828 + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", 829 + "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", 830 + "dev": true, 831 + "dependencies": { 832 + "mdn-data": "2.0.30", 833 + "source-map-js": "^1.0.1" 834 + }, 835 + "engines": { 836 + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" 837 + } 838 + }, 839 + "node_modules/debug": { 840 + "version": "4.3.6", 841 + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", 842 + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", 843 + "dev": true, 844 + "dependencies": { 845 + "ms": "2.1.2" 846 + }, 847 + "engines": { 848 + "node": ">=6.0" 849 + }, 850 + "peerDependenciesMeta": { 851 + "supports-color": { 852 + "optional": true 853 + } 854 + } 855 + }, 856 + "node_modules/deepmerge": { 857 + "version": "4.3.1", 858 + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", 859 + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", 860 + "dev": true, 861 + "engines": { 862 + "node": ">=0.10.0" 863 + } 864 + }, 865 + "node_modules/dequal": { 866 + "version": "2.0.3", 867 + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", 868 + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", 869 + "dev": true, 870 + "engines": { 871 + "node": ">=6" 872 + } 873 + }, 874 + "node_modules/esbuild": { 875 + "version": "0.21.5", 876 + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", 877 + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", 878 + "dev": true, 879 + "hasInstallScript": true, 880 + "bin": { 881 + "esbuild": "bin/esbuild" 882 + }, 883 + "engines": { 884 + "node": ">=12" 885 + }, 886 + "optionalDependencies": { 887 + "@esbuild/aix-ppc64": "0.21.5", 888 + "@esbuild/android-arm": "0.21.5", 889 + "@esbuild/android-arm64": "0.21.5", 890 + "@esbuild/android-x64": "0.21.5", 891 + "@esbuild/darwin-arm64": "0.21.5", 892 + "@esbuild/darwin-x64": "0.21.5", 893 + "@esbuild/freebsd-arm64": "0.21.5", 894 + "@esbuild/freebsd-x64": "0.21.5", 895 + "@esbuild/linux-arm": "0.21.5", 896 + "@esbuild/linux-arm64": "0.21.5", 897 + "@esbuild/linux-ia32": "0.21.5", 898 + "@esbuild/linux-loong64": "0.21.5", 899 + "@esbuild/linux-mips64el": "0.21.5", 900 + "@esbuild/linux-ppc64": "0.21.5", 901 + "@esbuild/linux-riscv64": "0.21.5", 902 + "@esbuild/linux-s390x": "0.21.5", 903 + "@esbuild/linux-x64": "0.21.5", 904 + "@esbuild/netbsd-x64": "0.21.5", 905 + "@esbuild/openbsd-x64": "0.21.5", 906 + "@esbuild/sunos-x64": "0.21.5", 907 + "@esbuild/win32-arm64": "0.21.5", 908 + "@esbuild/win32-ia32": "0.21.5", 909 + "@esbuild/win32-x64": "0.21.5" 910 + } 911 + }, 912 + "node_modules/estree-walker": { 913 + "version": "3.0.3", 914 + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", 915 + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", 916 + "dev": true, 917 + "dependencies": { 918 + "@types/estree": "^1.0.0" 919 + } 920 + }, 921 + "node_modules/fsevents": { 922 + "version": "2.3.3", 923 + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", 924 + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", 925 + "dev": true, 926 + "hasInstallScript": true, 927 + "optional": true, 928 + "os": [ 929 + "darwin" 930 + ], 931 + "engines": { 932 + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 933 + } 934 + }, 935 + "node_modules/is-reference": { 936 + "version": "3.0.2", 937 + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz", 938 + "integrity": "sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==", 939 + "dev": true, 940 + "dependencies": { 941 + "@types/estree": "*" 942 + } 943 + }, 944 + "node_modules/isomorphic.js": { 945 + "version": "0.2.5", 946 + "resolved": "https://registry.npmjs.org/isomorphic.js/-/isomorphic.js-0.2.5.tgz", 947 + "integrity": "sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==", 948 + "funding": { 949 + "type": "GitHub Sponsors ❤", 950 + "url": "https://github.com/sponsors/dmonad" 951 + } 952 + }, 953 + "node_modules/kleur": { 954 + "version": "4.1.5", 955 + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", 956 + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", 957 + "dev": true, 958 + "engines": { 959 + "node": ">=6" 960 + } 961 + }, 962 + "node_modules/lib0": { 963 + "version": "0.2.95", 964 + "resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.95.tgz", 965 + "integrity": "sha512-St5XGDh5omvNawGkAOa7CFRjxl4xEKLj9DxgT8Nl7rmrD6l2WRTngvmZGhJKRaniROterT0RDVdnwLlU9PiEOg==", 966 + "dependencies": { 967 + "isomorphic.js": "^0.2.4" 968 + }, 969 + "bin": { 970 + "0ecdsa-generate-keypair": "bin/0ecdsa-generate-keypair.js", 971 + "0gentesthtml": "bin/gentesthtml.js", 972 + "0serve": "bin/0serve.js" 973 + }, 974 + "engines": { 975 + "node": ">=16" 976 + }, 977 + "funding": { 978 + "type": "GitHub Sponsors ❤", 979 + "url": "https://github.com/sponsors/dmonad" 980 + } 981 + }, 982 + "node_modules/locate-character": { 983 + "version": "3.0.0", 984 + "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", 985 + "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", 986 + "dev": true 987 + }, 988 + "node_modules/magic-string": { 989 + "version": "0.30.11", 990 + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.11.tgz", 991 + "integrity": "sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==", 992 + "dev": true, 993 + "dependencies": { 994 + "@jridgewell/sourcemap-codec": "^1.5.0" 995 + } 996 + }, 997 + "node_modules/mdn-data": { 998 + "version": "2.0.30", 999 + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", 1000 + "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", 1001 + "dev": true 1002 + }, 1003 + "node_modules/ms": { 1004 + "version": "2.1.2", 1005 + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 1006 + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 1007 + "dev": true 1008 + }, 1009 + "node_modules/nanoid": { 1010 + "version": "3.3.7", 1011 + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", 1012 + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", 1013 + "dev": true, 1014 + "funding": [ 1015 + { 1016 + "type": "github", 1017 + "url": "https://github.com/sponsors/ai" 1018 + } 1019 + ], 1020 + "bin": { 1021 + "nanoid": "bin/nanoid.cjs" 1022 + }, 1023 + "engines": { 1024 + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" 1025 + } 1026 + }, 1027 + "node_modules/periscopic": { 1028 + "version": "3.1.0", 1029 + "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz", 1030 + "integrity": "sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==", 1031 + "dev": true, 1032 + "dependencies": { 1033 + "@types/estree": "^1.0.0", 1034 + "estree-walker": "^3.0.0", 1035 + "is-reference": "^3.0.0" 1036 + } 1037 + }, 1038 + "node_modules/picocolors": { 1039 + "version": "1.0.1", 1040 + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", 1041 + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", 1042 + "dev": true 1043 + }, 1044 + "node_modules/postcss": { 1045 + "version": "8.4.40", 1046 + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz", 1047 + "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", 1048 + "dev": true, 1049 + "funding": [ 1050 + { 1051 + "type": "opencollective", 1052 + "url": "https://opencollective.com/postcss/" 1053 + }, 1054 + { 1055 + "type": "tidelift", 1056 + "url": "https://tidelift.com/funding/github/npm/postcss" 1057 + }, 1058 + { 1059 + "type": "github", 1060 + "url": "https://github.com/sponsors/ai" 1061 + } 1062 + ], 1063 + "dependencies": { 1064 + "nanoid": "^3.3.7", 1065 + "picocolors": "^1.0.1", 1066 + "source-map-js": "^1.2.0" 1067 + }, 1068 + "engines": { 1069 + "node": "^10 || ^12 || >=14" 1070 + } 1071 + }, 1072 + "node_modules/rollup": { 1073 + "version": "4.20.0", 1074 + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.20.0.tgz", 1075 + "integrity": "sha512-6rbWBChcnSGzIlXeIdNIZTopKYad8ZG8ajhl78lGRLsI2rX8IkaotQhVas2Ma+GPxJav19wrSzvRvuiv0YKzWw==", 1076 + "dev": true, 1077 + "dependencies": { 1078 + "@types/estree": "1.0.5" 1079 + }, 1080 + "bin": { 1081 + "rollup": "dist/bin/rollup" 1082 + }, 1083 + "engines": { 1084 + "node": ">=18.0.0", 1085 + "npm": ">=8.0.0" 1086 + }, 1087 + "optionalDependencies": { 1088 + "@rollup/rollup-android-arm-eabi": "4.20.0", 1089 + "@rollup/rollup-android-arm64": "4.20.0", 1090 + "@rollup/rollup-darwin-arm64": "4.20.0", 1091 + "@rollup/rollup-darwin-x64": "4.20.0", 1092 + "@rollup/rollup-linux-arm-gnueabihf": "4.20.0", 1093 + "@rollup/rollup-linux-arm-musleabihf": "4.20.0", 1094 + "@rollup/rollup-linux-arm64-gnu": "4.20.0", 1095 + "@rollup/rollup-linux-arm64-musl": "4.20.0", 1096 + "@rollup/rollup-linux-powerpc64le-gnu": "4.20.0", 1097 + "@rollup/rollup-linux-riscv64-gnu": "4.20.0", 1098 + "@rollup/rollup-linux-s390x-gnu": "4.20.0", 1099 + "@rollup/rollup-linux-x64-gnu": "4.20.0", 1100 + "@rollup/rollup-linux-x64-musl": "4.20.0", 1101 + "@rollup/rollup-win32-arm64-msvc": "4.20.0", 1102 + "@rollup/rollup-win32-ia32-msvc": "4.20.0", 1103 + "@rollup/rollup-win32-x64-msvc": "4.20.0", 1104 + "fsevents": "~2.3.2" 1105 + } 1106 + }, 1107 + "node_modules/source-map-js": { 1108 + "version": "1.2.0", 1109 + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", 1110 + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", 1111 + "dev": true, 1112 + "engines": { 1113 + "node": ">=0.10.0" 1114 + } 1115 + }, 1116 + "node_modules/svelte": { 1117 + "version": "4.2.18", 1118 + "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.18.tgz", 1119 + "integrity": "sha512-d0FdzYIiAePqRJEb90WlJDkjUEx42xhivxN8muUBmfZnP+tzUgz12DJ2hRJi8sIHCME7jeK1PTMgKPSfTd8JrA==", 1120 + "dev": true, 1121 + "dependencies": { 1122 + "@ampproject/remapping": "^2.2.1", 1123 + "@jridgewell/sourcemap-codec": "^1.4.15", 1124 + "@jridgewell/trace-mapping": "^0.3.18", 1125 + "@types/estree": "^1.0.1", 1126 + "acorn": "^8.9.0", 1127 + "aria-query": "^5.3.0", 1128 + "axobject-query": "^4.0.0", 1129 + "code-red": "^1.0.3", 1130 + "css-tree": "^2.3.1", 1131 + "estree-walker": "^3.0.3", 1132 + "is-reference": "^3.0.1", 1133 + "locate-character": "^3.0.0", 1134 + "magic-string": "^0.30.4", 1135 + "periscopic": "^3.1.0" 1136 + }, 1137 + "engines": { 1138 + "node": ">=16" 1139 + } 1140 + }, 1141 + "node_modules/svelte-hmr": { 1142 + "version": "0.16.0", 1143 + "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.16.0.tgz", 1144 + "integrity": "sha512-Gyc7cOS3VJzLlfj7wKS0ZnzDVdv3Pn2IuVeJPk9m2skfhcu5bq3wtIZyQGggr7/Iim5rH5cncyQft/kRLupcnA==", 1145 + "dev": true, 1146 + "engines": { 1147 + "node": "^12.20 || ^14.13.1 || >= 16" 1148 + }, 1149 + "peerDependencies": { 1150 + "svelte": "^3.19.0 || ^4.0.0" 1151 + } 1152 + }, 1153 + "node_modules/tslib": { 1154 + "version": "2.6.3", 1155 + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", 1156 + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" 1157 + }, 1158 + "node_modules/vite": { 1159 + "version": "5.3.5", 1160 + "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.5.tgz", 1161 + "integrity": "sha512-MdjglKR6AQXQb9JGiS7Rc2wC6uMjcm7Go/NHNO63EwiJXfuk9PgqiP/n5IDJCziMkfw9n4Ubp7lttNwz+8ZVKA==", 1162 + "dev": true, 1163 + "dependencies": { 1164 + "esbuild": "^0.21.3", 1165 + "postcss": "^8.4.39", 1166 + "rollup": "^4.13.0" 1167 + }, 1168 + "bin": { 1169 + "vite": "bin/vite.js" 1170 + }, 1171 + "engines": { 1172 + "node": "^18.0.0 || >=20.0.0" 1173 + }, 1174 + "funding": { 1175 + "url": "https://github.com/vitejs/vite?sponsor=1" 1176 + }, 1177 + "optionalDependencies": { 1178 + "fsevents": "~2.3.3" 1179 + }, 1180 + "peerDependencies": { 1181 + "@types/node": "^18.0.0 || >=20.0.0", 1182 + "less": "*", 1183 + "lightningcss": "^1.21.0", 1184 + "sass": "*", 1185 + "stylus": "*", 1186 + "sugarss": "*", 1187 + "terser": "^5.4.0" 1188 + }, 1189 + "peerDependenciesMeta": { 1190 + "@types/node": { 1191 + "optional": true 1192 + }, 1193 + "less": { 1194 + "optional": true 1195 + }, 1196 + "lightningcss": { 1197 + "optional": true 1198 + }, 1199 + "sass": { 1200 + "optional": true 1201 + }, 1202 + "stylus": { 1203 + "optional": true 1204 + }, 1205 + "sugarss": { 1206 + "optional": true 1207 + }, 1208 + "terser": { 1209 + "optional": true 1210 + } 1211 + } 1212 + }, 1213 + "node_modules/vitefu": { 1214 + "version": "0.2.5", 1215 + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz", 1216 + "integrity": "sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==", 1217 + "dev": true, 1218 + "peerDependencies": { 1219 + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0" 1220 + }, 1221 + "peerDependenciesMeta": { 1222 + "vite": { 1223 + "optional": true 1224 + } 1225 + } 1226 + } 1227 + } 1228 + }
+22
js/package.json
··· 1 + { 2 + "name": "js", 3 + "private": true, 4 + "version": "0.0.0", 5 + "type": "module", 6 + "scripts": { 7 + "dev": "vite", 8 + "build": "vite build", 9 + "preview": "vite preview" 10 + }, 11 + "devDependencies": { 12 + "@sveltejs/vite-plugin-svelte": "^3.1.1", 13 + "svelte": "^4.2.18", 14 + "vite": "^5.3.4" 15 + }, 16 + "dependencies": { 17 + "@vlcn.io/crsqlite-wasm": "^0.16.0", 18 + "@vlcn.io/ws-browserdb": "^0.2.0", 19 + "@vlcn.io/ws-client": "^0.2.0", 20 + "@vlcn.io/xplat-api": "^0.15.0" 21 + } 22 + }
+1
js/public/vite.svg
··· 1 + <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
+138
js/src/App.svelte
··· 1 + <script lang="ts"> 2 + import { onMount } from 'svelte'; 3 + import initWasm from '@vlcn.io/crsqlite-wasm'; 4 + import wasmUrl from '@vlcn.io/crsqlite-wasm/crsqlite.wasm?url'; 5 + import { start } from "@vlcn.io/ws-client/worker.js"; 6 + import { createDbProvider } from "@vlcn.io/ws-browserdb"; 7 + 8 + let db; 9 + let ws; 10 + let todos = []; 11 + let newTodo = ''; 12 + 13 + onMount(async () => { 14 + const sqlite = await initWasm(() => wasmUrl); 15 + db = await sqlite.open('todo.db'); 16 + 17 + await db.exec(` 18 + CREATE TABLE IF NOT EXISTS todos ( 19 + id BLOB PRIMARY KEY NOT NULL, 20 + content TEXT, 21 + completed INTEGER NOT NULL DEFAULT 0 22 + ); 23 + SELECT crsql_as_crr('todos'); 24 + `); 25 + 26 + const config = { 27 + dbProvider: createDbProvider(), 28 + transportProvider: (dbName) => new WebSocket(`ws://localhost:8080/sync/${dbName}`), 29 + }; 30 + 31 + start(config); 32 + 33 + ws = new WebSocket('ws://localhost:8080/sync'); 34 + 35 + db.onUpdate(async () => { 36 + const changes = await db.execA(`SELECT * FROM crsql_changes WHERE db_version > 0 AND site_id = crsql_site_id()`); 37 + 38 + sendChangesToServer(changes); 39 + }); 40 + 41 + ws.onmessage = async function(event) { 42 + const { type, data } = JSON.parse(event.data); 43 + if (type === 'changes') { 44 + await applyChanges(data); 45 + } 46 + }; 47 + 48 + loadTodos(); 49 + }); 50 + 51 + function sendChangesToServer(changes) { 52 + const formattedChanges = changes.map(change => ({ 53 + TableName: change[0], 54 + PK: Array.isArray(change[1]) ? btoa(String.fromCharCode.apply(null, change[1])) : btoa(change[1]), 55 + ColumnName: change[2], 56 + Value: Array.isArray(change[3]) ? btoa(String.fromCharCode.apply(null, change[3])) : change[3], 57 + ColVersion: Number(change[4]), 58 + DBVersion: Number(change[5]), 59 + SiteID: Array.isArray(change[6]) ? btoa(new TextDecoder('utf8').decode(change[6])) : btoa(change[6]), 60 + CL: Number(change[7]), 61 + Seq: Number(change[8]) 62 + })); 63 + console.log(formattedChanges) 64 + 65 + const message = { 66 + type: "changes", 67 + data: formattedChanges 68 + }; 69 + 70 + ws.send(JSON.stringify(message)); 71 + } 72 + 73 + 74 + async function applyChanges(changes) { 75 + await db.tx(async (tx) => { 76 + for (const change of changes) { 77 + await tx.exec( 78 + `INSERT INTO crsql_changes VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, 79 + change 80 + ); 81 + } 82 + }); 83 + } 84 + 85 + async function loadTodos() { 86 + const result = await db.execO("SELECT * FROM todos ORDER BY id"); 87 + todos = result; 88 + } 89 + 90 + async function addTodo() { 91 + if (newTodo.trim()) { 92 + await db.exec(` 93 + INSERT INTO todos (id, content, completed) 94 + VALUES (lower(hex(randomblob(16))), ?, 0) 95 + `, [newTodo.trim()]); 96 + newTodo = ''; 97 + loadTodos(); 98 + } 99 + } 100 + 101 + async function toggleTodo(id) { 102 + await db.exec(` 103 + UPDATE todos 104 + SET completed = NOT completed 105 + WHERE id = ? 106 + `, [id]); 107 + loadTodos(); 108 + } 109 + </script> 110 + 111 + <main> 112 + <h1>Svelte Todo with cr-sqlite</h1> 113 + <input 114 + bind:value={newTodo} 115 + on:keypress={(e) => e.key === 'Enter' && addTodo()} 116 + placeholder="Add a new todo" 117 + /> 118 + <button on:click={addTodo}>Add Todo</button> 119 + <ul> 120 + {#each todos as todo} 121 + <li> 122 + <input 123 + type="checkbox" 124 + checked={todo.completed} 125 + on:change={() => toggleTodo(todo.id)} 126 + /> 127 + <span class:completed={todo.completed}>{todo.content}</span> 128 + </li> 129 + {/each} 130 + </ul> 131 + </main> 132 + 133 + <style> 134 + .completed { 135 + text-decoration: line-through; 136 + } 137 + </style> 138 +
+79
js/src/app.css
··· 1 + :root { 2 + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; 3 + line-height: 1.5; 4 + font-weight: 400; 5 + 6 + color-scheme: light dark; 7 + color: rgba(255, 255, 255, 0.87); 8 + background-color: #242424; 9 + 10 + font-synthesis: none; 11 + text-rendering: optimizeLegibility; 12 + -webkit-font-smoothing: antialiased; 13 + -moz-osx-font-smoothing: grayscale; 14 + } 15 + 16 + a { 17 + font-weight: 500; 18 + color: #646cff; 19 + text-decoration: inherit; 20 + } 21 + a:hover { 22 + color: #535bf2; 23 + } 24 + 25 + body { 26 + margin: 0; 27 + display: flex; 28 + place-items: center; 29 + min-width: 320px; 30 + min-height: 100vh; 31 + } 32 + 33 + h1 { 34 + font-size: 3.2em; 35 + line-height: 1.1; 36 + } 37 + 38 + .card { 39 + padding: 2em; 40 + } 41 + 42 + #app { 43 + max-width: 1280px; 44 + margin: 0 auto; 45 + padding: 2rem; 46 + text-align: center; 47 + } 48 + 49 + button { 50 + border-radius: 8px; 51 + border: 1px solid transparent; 52 + padding: 0.6em 1.2em; 53 + font-size: 1em; 54 + font-weight: 500; 55 + font-family: inherit; 56 + background-color: #1a1a1a; 57 + cursor: pointer; 58 + transition: border-color 0.25s; 59 + } 60 + button:hover { 61 + border-color: #646cff; 62 + } 63 + button:focus, 64 + button:focus-visible { 65 + outline: 4px auto -webkit-focus-ring-color; 66 + } 67 + 68 + @media (prefers-color-scheme: light) { 69 + :root { 70 + color: #213547; 71 + background-color: #ffffff; 72 + } 73 + a:hover { 74 + color: #747bff; 75 + } 76 + button { 77 + background-color: #f9f9f9; 78 + } 79 + }
+1
js/src/assets/svelte.svg
··· 1 + <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="26.6" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 308"><path fill="#FF3E00" d="M239.682 40.707C211.113-.182 154.69-12.301 113.895 13.69L42.247 59.356a82.198 82.198 0 0 0-37.135 55.056a86.566 86.566 0 0 0 8.536 55.576a82.425 82.425 0 0 0-12.296 30.719a87.596 87.596 0 0 0 14.964 66.244c28.574 40.893 84.997 53.007 125.787 27.016l71.648-45.664a82.182 82.182 0 0 0 37.135-55.057a86.601 86.601 0 0 0-8.53-55.577a82.409 82.409 0 0 0 12.29-30.718a87.573 87.573 0 0 0-14.963-66.244"></path><path fill="#FFF" d="M106.889 270.841c-23.102 6.007-47.497-3.036-61.103-22.648a52.685 52.685 0 0 1-9.003-39.85a49.978 49.978 0 0 1 1.713-6.693l1.35-4.115l3.671 2.697a92.447 92.447 0 0 0 28.036 14.007l2.663.808l-.245 2.659a16.067 16.067 0 0 0 2.89 10.656a17.143 17.143 0 0 0 18.397 6.828a15.786 15.786 0 0 0 4.403-1.935l71.67-45.672a14.922 14.922 0 0 0 6.734-9.977a15.923 15.923 0 0 0-2.713-12.011a17.156 17.156 0 0 0-18.404-6.832a15.78 15.78 0 0 0-4.396 1.933l-27.35 17.434a52.298 52.298 0 0 1-14.553 6.391c-23.101 6.007-47.497-3.036-61.101-22.649a52.681 52.681 0 0 1-9.004-39.849a49.428 49.428 0 0 1 22.34-33.114l71.664-45.677a52.218 52.218 0 0 1 14.563-6.398c23.101-6.007 47.497 3.036 61.101 22.648a52.685 52.685 0 0 1 9.004 39.85a50.559 50.559 0 0 1-1.713 6.692l-1.35 4.116l-3.67-2.693a92.373 92.373 0 0 0-28.037-14.013l-2.664-.809l.246-2.658a16.099 16.099 0 0 0-2.89-10.656a17.143 17.143 0 0 0-18.398-6.828a15.786 15.786 0 0 0-4.402 1.935l-71.67 45.674a14.898 14.898 0 0 0-6.73 9.975a15.9 15.9 0 0 0 2.709 12.012a17.156 17.156 0 0 0 18.404 6.832a15.841 15.841 0 0 0 4.402-1.935l27.345-17.427a52.147 52.147 0 0 1 14.552-6.397c23.101-6.006 47.497 3.037 61.102 22.65a52.681 52.681 0 0 1 9.003 39.848a49.453 49.453 0 0 1-22.34 33.12l-71.664 45.673a52.218 52.218 0 0 1-14.563 6.398"></path></svg>
+10
js/src/lib/Counter.svelte
··· 1 + <script> 2 + let count = 0 3 + const increment = () => { 4 + count += 1 5 + } 6 + </script> 7 + 8 + <button on:click={increment}> 9 + count is {count} 10 + </button>
+8
js/src/main.js
··· 1 + import './app.css' 2 + import App from './App.svelte' 3 + 4 + const app = new App({ 5 + target: document.getElementById('app'), 6 + }) 7 + 8 + export default app
+2
js/src/vite-env.d.ts
··· 1 + /// <reference types="svelte" /> 2 + /// <reference types="vite/client" />
+7
js/svelte.config.js
··· 1 + import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' 2 + 3 + export default { 4 + // Consult https://svelte.dev/docs#compile-time-svelte-preprocess 5 + // for more information about preprocessors 6 + preprocess: vitePreprocess(), 7 + }
+17
js/vite.config.js
··· 1 + import { defineConfig } from 'vite' 2 + import { svelte } from '@sveltejs/vite-plugin-svelte' 3 + 4 + // https://vitejs.dev/config/ 5 + export default defineConfig({ 6 + plugins: [svelte()], 7 + optimizeDeps: { 8 + exclude: ['@vlcn.io/crsqlite-wasm'], 9 + }, 10 + server: { 11 + headers: { 12 + 'Cross-Origin-Opener-Policy': 'same-origin', 13 + 'Cross-Origin-Embedder-Policy': 'require-corp', 14 + }, 15 + }, 16 + }); 17 +
+196 -66
main.go
··· 1 1 package main 2 2 3 3 import ( 4 - "database/sql" 5 - "fmt" 6 - "os" 4 + "database/sql" 5 + "encoding/base64" 6 + "fmt" 7 + "log" 8 + "os" 9 + 10 + "mast/db" 7 11 8 - tea "github.com/charmbracelet/bubbletea" 9 - _ "github.com/mattn/go-sqlite3" 10 - "git.sealight.xyz/aynish/mast/db" 12 + "github.com/charmbracelet/bubbles/textinput" 13 + tea "github.com/charmbracelet/bubbletea" 14 + uuid "github.com/gofrs/uuid" 15 + "github.com/gorilla/websocket" 16 + sqlite3 "github.com/mattn/go-sqlite3" 11 17 ) 12 18 13 19 type model struct { 14 - db *sql.DB 15 - todos []string 16 - cursor int 20 + db *sql.DB 21 + conn *websocket.Conn 22 + todos []string 23 + cursor int 24 + textInput textinput.Model 25 + inputting bool 17 26 } 18 27 19 28 func initialModel() model { 20 - db, err := sql.Open("sqlite3", ":memory:") 21 - if err != nil { 22 - panic(err) 23 - } 29 + sql.Register("sqlite3_with_extensions", 30 + &sqlite3.SQLiteDriver{ 31 + Extensions: []string{ 32 + "./db/crsqlite.so", 33 + }, 34 + }) 35 + db, err := sql.Open("sqlite3_with_extensions", "db.sqlite") 36 + if err != nil { 37 + panic(err) 38 + } 24 39 25 - err = RunMigrations(db) 26 - if err != nil { 27 - panic(err) 28 - } 40 + err = mast.RunMigrations(db) 41 + if err != nil { 42 + panic(err) 43 + } 44 + 45 + ti := textinput.New() 46 + ti.Placeholder = "Add a new todo" 47 + ti.Focus() 48 + 49 + conn, _, err := websocket.DefaultDialer.Dial("ws://localhost:8080/sync", nil) 50 + if err != nil { 51 + log.Println("Error connecting to WebSocket:", err) 52 + panic(err) 53 + } 54 + 55 + m := model{ 56 + db: db, 57 + conn: conn, 58 + todos: []string{}, 59 + cursor: 0, 60 + textInput: ti, 61 + inputting: false, 62 + } 63 + m.loadTodos() 64 + return m 65 + } 29 66 30 - m := model{ 31 - db: db, 32 - todos: []string{}, 33 - cursor: 0, 34 - } 35 - m.loadTodos() 36 - return m 67 + type CRSQLChange struct { 68 + TableName string 69 + PK string 70 + ColumnName string 71 + Value string 72 + ColVersion int64 73 + DBVersion int64 74 + SiteID string 75 + CL int64 76 + Seq int64 37 77 } 38 78 39 79 func (m *model) addTodo(todo string) { 40 - _, err := m.db.Exec("INSERT INTO todos (content) VALUES (?)", todo) 41 - if err != nil { 42 - panic(err) 43 - } 44 - m.loadTodos() 80 + id, err := uuid.NewV7() 81 + if err != nil { 82 + panic("Error generating new UUID") 83 + } 84 + _, err = m.db.Exec(` 85 + INSERT INTO todos (id, content) 86 + VALUES (?, ?) 87 + `, id.String(), todo) 88 + if err != nil { 89 + panic(err) 90 + } 91 + 92 + rows, err := m.db.Query("SELECT * FROM crsql_changes") 93 + if err != nil { 94 + log.Println("Error querying crsql_changes:", err) 95 + return 96 + } 97 + defer rows.Close() 98 + 99 + var changes []CRSQLChange 100 + for rows.Next() { 101 + var change CRSQLChange 102 + var pkRaw []byte 103 + var valueRaw []byte 104 + var siteIDRaw []byte 105 + err := rows.Scan(&change.TableName, &pkRaw, &change.ColumnName, &valueRaw, 106 + &change.ColVersion, &change.DBVersion, &siteIDRaw, &change.CL, &change.Seq) 107 + 108 + if err != nil { 109 + log.Println("Error scanning change:", err) 110 + return 111 + } 112 + change.PK = base64.StdEncoding.EncodeToString(pkRaw) 113 + change.Value = base64.StdEncoding.EncodeToString(valueRaw) 114 + change.SiteID = base64.StdEncoding.EncodeToString(siteIDRaw) 115 + 116 + changes = append(changes, change) 117 + fmt.Println(change) 118 + } 119 + 120 + if len(changes) > 0 { 121 + m.sendToWebSocket(changes) 122 + } 123 + 124 + m.loadTodos() 125 + } 126 + 127 + func (m *model) sendToWebSocket(changes []CRSQLChange) { 128 + message := struct { 129 + Type string `json:"type"` 130 + Data []CRSQLChange `json:"data"` 131 + }{ 132 + Type: "changes", 133 + Data: changes, 134 + } 135 + 136 + err := m.conn.WriteJSON(message) 137 + if err != nil { 138 + log.Println("Error sending changes to WebSocket:", err) 139 + panic(err) 140 + } 45 141 } 46 142 47 143 func (m *model) loadTodos() { 48 - rows, err := m.db.Query("SELECT content FROM todos") 49 - if err != nil { 50 - panic(err) 51 - } 52 - defer rows.Close() 144 + rows, err := m.db.Query("SELECT content FROM todos") 145 + if err != nil { 146 + panic(err) 147 + } 148 + defer rows.Close() 53 149 54 - m.todos = []string{} 55 - for rows.Next() { 56 - var content string 57 - if err := rows.Scan(&content); err != nil { 58 - panic(err) 59 - } 60 - m.todos = append(m.todos, content) 61 - } 150 + m.todos = []string{} 151 + for rows.Next() { 152 + var content string 153 + if err := rows.Scan(&content); err != nil { 154 + panic(err) 155 + } 156 + m.todos = append(m.todos, content) 157 + } 62 158 } 63 159 64 160 func (m model) Init() tea.Cmd { 65 - return nil 161 + return nil 66 162 } 67 163 68 164 func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { 69 - switch msg := msg.(type) { 70 - case tea.KeyMsg: 71 - switch msg.String() { 72 - case "ctrl+c", "q": 73 - return m, tea.Quit 74 - } 75 - } 76 - return m, nil 165 + var cmd tea.Cmd 166 + 167 + switch msg := msg.(type) { 168 + case tea.KeyMsg: 169 + switch msg.String() { 170 + case "ctrl+c", "q": 171 + return m, m.quit() 172 + case "j", "down": 173 + m.cursor = (m.cursor + 1) % len(m.todos) 174 + case "k", "up": 175 + m.cursor = (m.cursor - 1 + len(m.todos)) % len(m.todos) 176 + case "a": 177 + if !m.inputting { 178 + m.inputting = true 179 + return m, textinput.Blink 180 + } 181 + case "enter": 182 + if m.inputting { 183 + m.addTodo(m.textInput.Value()) 184 + m.textInput.Reset() 185 + m.inputting = false 186 + } 187 + } 188 + } 189 + 190 + if m.inputting { 191 + m.textInput, cmd = m.textInput.Update(msg) 192 + return m, cmd 193 + } 194 + 195 + return m, nil 196 + } 197 + 198 + func (m model) quit() tea.Cmd { 199 + m.db.Close() 200 + m.conn.Close() 201 + return tea.Quit 77 202 } 78 203 79 204 func (m model) View() string { 80 - s := "Todo List:\n\n" 81 - for i, todo := range m.todos { 82 - cursor := " " 83 - if m.cursor == i { 84 - cursor = ">" 85 - } 86 - s += fmt.Sprintf("%s %s\n", cursor, todo) 87 - } 88 - s += "\nPress q to quit.\n" 89 - return s 205 + s := "Todo List:\n\n" 206 + for i, todo := range m.todos { 207 + cursor := " " 208 + if m.cursor == i { 209 + cursor = ">" 210 + } 211 + s += fmt.Sprintf("%s %s\n", cursor, todo) 212 + } 213 + s += "\nPress 'a' to add a new todo, 'q' to quit.\n" 214 + 215 + if m.inputting { 216 + s += "\n" + m.textInput.View() 217 + } 218 + 219 + return s 90 220 } 91 221 92 222 func main() { 93 - p := tea.NewProgram(initialModel()) 94 - if _, err := p.Run(); err != nil { 95 - fmt.Printf("Alas, there's been an error: %v", err) 96 - os.Exit(1) 97 - } 223 + p := tea.NewProgram(initialModel()) 224 + if _, err := p.Run(); err != nil { 225 + fmt.Printf("Alas, there's been an error: %v", err) 226 + os.Exit(1) 227 + } 98 228 }
+200
server/main.go
··· 1 + package main 2 + 3 + import ( 4 + "database/sql" 5 + "encoding/base64" 6 + "encoding/json" 7 + "fmt" 8 + "log" 9 + "net/http" 10 + "strconv" 11 + "strings" 12 + 13 + "mast/db" 14 + 15 + "github.com/gorilla/websocket" 16 + sqlite3 "github.com/mattn/go-sqlite3" 17 + ) 18 + 19 + var upgrader = websocket.Upgrader{ 20 + CheckOrigin: func(r *http.Request) bool { 21 + return true 22 + }, 23 + } 24 + 25 + var db *sql.DB 26 + var clients = make(map[*websocket.Conn]bool) 27 + 28 + func handleWebSocket(w http.ResponseWriter, r *http.Request) { 29 + conn, err := upgrader.Upgrade(w, r, nil) 30 + if err != nil { 31 + log.Println(err) 32 + return 33 + } 34 + defer conn.Close() 35 + 36 + for { 37 + _, message, err := conn.ReadMessage() 38 + if err != nil { 39 + log.Println(err) 40 + return 41 + } 42 + 43 + var msg struct { 44 + Type string `json:"type"` 45 + Data []interface{} `json:"data"` 46 + } 47 + if err := json.Unmarshal(message, &msg); err != nil { 48 + log.Println("Error unmarshaling message:", err) 49 + continue 50 + } 51 + 52 + if msg.Type == "changes" { 53 + fmt.Println("We're applying changes!!") 54 + applyChanges(msg.Data) 55 + } 56 + } 57 + } 58 + 59 + func printChange(change interface{}) { 60 + // Attempt to type assert and print more details 61 + if c, ok := change.(map[string]interface{}); ok { 62 + for key, value := range c { 63 + fmt.Printf(" %s: %v\n", key, value) 64 + } 65 + } else { 66 + fmt.Printf(" Not a map: %T\n", change) 67 + } 68 + } 69 + 70 + func printChanges(changes []interface{}) { 71 + for i, change := range changes { 72 + fmt.Printf("Change %d: %+v\n", i, change) 73 + printChange(change) 74 + } 75 + } 76 + 77 + type CRSQLChange struct { 78 + TableName string 79 + PK []byte 80 + ColumnName string 81 + Value any 82 + ColVersion int64 83 + DBVersion int64 84 + SiteID []byte 85 + CL int64 86 + Seq int64 87 + } 88 + 89 + func mapToCRSQLChange(m map[string]interface{}) (CRSQLChange, error) { 90 + var err error 91 + change := CRSQLChange{} 92 + 93 + change.TableName = m["TableName"].(string) 94 + change.ColumnName = m["ColumnName"].(string) 95 + change.ColVersion = int64(m["ColVersion"].(float64)) 96 + change.DBVersion = int64(m["DBVersion"].(float64)) 97 + change.CL = int64(m["CL"].(float64)) 98 + change.Seq = int64(m["Seq"].(float64)) 99 + 100 + // Still unsure about this, it can encode anything 101 + if m["Value"] != nil { 102 + change.Value = m["Value"] 103 + } 104 + // Handle []byte fields 105 + change.PK, err = decodeBase64ToByteArray(m["PK"].(string)) 106 + if err != nil { 107 + return change, err 108 + } 109 + change.SiteID, err = decodeBase64ToByteArray(m["SiteID"].(string)) 110 + fmt.Println(change.SiteID) 111 + if err != nil { 112 + return change, err 113 + } 114 + 115 + return change, nil 116 + } 117 + 118 + func decodeBase64ToByteArray(encodedString string) ([]uint8, error) { 119 + // Decode the base64 string 120 + decodedBytes, err := base64.StdEncoding.DecodeString(encodedString) 121 + if err != nil { 122 + return nil, fmt.Errorf("error decoding base64: %w", err) 123 + } 124 + 125 + // Convert bytes to string 126 + decodedString := string(decodedBytes) 127 + 128 + // Split the string by commas 129 + stringSlice := strings.Split(decodedString, ",") 130 + 131 + // Convert each string to an integer 132 + intSlice := make([]uint8, len(stringSlice)) 133 + for i, s := range stringSlice { 134 + num, err := strconv.Atoi(s) 135 + if err != nil { 136 + return nil, fmt.Errorf("error converting string to int: %w", err) 137 + } 138 + intSlice[i] = byte(num) 139 + } 140 + 141 + return intSlice, nil 142 + } 143 + 144 + func applyChanges(changes []interface{}) { 145 + tx, _ := db.Begin() 146 + for i, change := range changes { 147 + fmt.Println("Change number: ", i) 148 + fmt.Println(change) 149 + if changeMap, ok := change.(map[string]interface{}); ok { 150 + c, err := mapToCRSQLChange(changeMap) 151 + if err != nil { 152 + fmt.Println("Error converting to CRSQLChange:", err) 153 + continue 154 + } 155 + _, err = tx.Exec(`INSERT INTO crsql_changes VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, 156 + c.TableName, c.PK, c.ColumnName, c.Value, c.ColVersion, c.DBVersion, c.SiteID, c.CL, c.Seq) 157 + if err != nil { 158 + log.Println("Error inserting change:", err) 159 + } 160 + log.Println("We inserted data successfully??") 161 + fmt.Println(c) 162 + } else { 163 + fmt.Println("Not OK to convert change") 164 + fmt.Println("Change look like:") 165 + printChange(change) 166 + continue 167 + } 168 + } 169 + tx.Commit() 170 + } 171 + 172 + func broadcastChanges(sender *websocket.Conn, changes interface{}) { 173 + for client := range clients { 174 + if client != sender { 175 + client.WriteJSON(map[string]interface{}{"type": "changes", "data": changes}) 176 + } 177 + } 178 + } 179 + func main() { 180 + var err error 181 + if err != nil { 182 + log.Fatal("error:", err) 183 + } 184 + sql.Register("sqlite3_with_extensions", 185 + &sqlite3.SQLiteDriver{ 186 + Extensions: []string{ 187 + "../db/crsqlite.so", 188 + }, 189 + }) 190 + db, err = sql.Open("sqlite3_with_extensions", "./todo.sqlite") 191 + if err != nil { 192 + log.Fatal(err) 193 + } 194 + err = mast.RunMigrations(db) 195 + defer db.Close() 196 + 197 + // Initialize database and tables... 198 + http.HandleFunc("/sync", handleWebSocket) 199 + log.Fatal(http.ListenAndServe(":8080", nil)) 200 + }