tinybase 5.1.0 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/persisters/persister-powersync/index.d.cts +4 -4
- package/@types/persisters/persister-powersync/index.d.ts +4 -4
- package/@types/persisters/persister-powersync/with-schemas/index.d.cts +4 -4
- package/@types/persisters/persister-powersync/with-schemas/index.d.ts +4 -4
- package/@types/synchronizers/synchronizer-ws-client/index.d.cts +6 -0
- package/@types/synchronizers/synchronizer-ws-client/index.d.ts +6 -0
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.cts +6 -0
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +6 -0
- package/@types/synchronizers/synchronizer-ws-server/index.d.cts +66 -4
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +66 -4
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +72 -5
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +72 -5
- package/cjs/es6/min/checkpoints/index.cjs +1 -1
- package/cjs/es6/min/checkpoints/index.cjs.gz +0 -0
- package/cjs/es6/min/checkpoints/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/checkpoints/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/index.cjs +1 -1
- package/cjs/es6/min/index.cjs.gz +0 -0
- package/cjs/es6/min/indexes/index.cjs +1 -1
- package/cjs/es6/min/indexes/index.cjs.gz +0 -0
- package/cjs/es6/min/indexes/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/indexes/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/mergeable-store/index.cjs +1 -1
- package/cjs/es6/min/mergeable-store/index.cjs.gz +0 -0
- package/cjs/es6/min/mergeable-store/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/metrics/index.cjs +1 -1
- package/cjs/es6/min/metrics/index.cjs.gz +0 -0
- package/cjs/es6/min/metrics/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/metrics/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-automerge/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-automerge/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-automerge/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-automerge/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-indexed-db/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-indexed-db/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-indexed-db/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-indexed-db/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-partykit-client/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-partykit-client/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-partykit-client/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-partykit-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-yjs/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-yjs/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-yjs/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-yjs/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/queries/index.cjs +1 -1
- package/cjs/es6/min/queries/index.cjs.gz +0 -0
- package/cjs/es6/min/queries/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/queries/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/relationships/index.cjs +1 -1
- package/cjs/es6/min/relationships/index.cjs.gz +0 -0
- package/cjs/es6/min/relationships/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/relationships/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/store/index.cjs +1 -1
- package/cjs/es6/min/store/index.cjs.gz +0 -0
- package/cjs/es6/min/store/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/store/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
- package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/synchronizers/synchronizer-ws-server/index.cjs +11 -4
- package/cjs/es6/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +11 -4
- package/cjs/min/checkpoints/index.cjs +1 -1
- package/cjs/min/checkpoints/index.cjs.gz +0 -0
- package/cjs/min/checkpoints/with-schemas/index.cjs +1 -1
- package/cjs/min/checkpoints/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/index.cjs +1 -1
- package/cjs/min/index.cjs.gz +0 -0
- package/cjs/min/indexes/index.cjs +1 -1
- package/cjs/min/indexes/index.cjs.gz +0 -0
- package/cjs/min/indexes/with-schemas/index.cjs +1 -1
- package/cjs/min/indexes/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/mergeable-store/index.cjs +1 -1
- package/cjs/min/mergeable-store/index.cjs.gz +0 -0
- package/cjs/min/mergeable-store/with-schemas/index.cjs +1 -1
- package/cjs/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/metrics/index.cjs +1 -1
- package/cjs/min/metrics/index.cjs.gz +0 -0
- package/cjs/min/metrics/with-schemas/index.cjs +1 -1
- package/cjs/min/metrics/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-automerge/index.cjs +1 -1
- package/cjs/min/persisters/persister-automerge/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-automerge/with-schemas/index.cjs +1 -1
- package/cjs/min/persisters/persister-automerge/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-indexed-db/index.cjs +1 -1
- package/cjs/min/persisters/persister-indexed-db/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-indexed-db/with-schemas/index.cjs +1 -1
- package/cjs/min/persisters/persister-indexed-db/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-partykit-client/index.cjs +1 -1
- package/cjs/min/persisters/persister-partykit-client/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-partykit-client/with-schemas/index.cjs +1 -1
- package/cjs/min/persisters/persister-partykit-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-yjs/index.cjs +1 -1
- package/cjs/min/persisters/persister-yjs/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-yjs/with-schemas/index.cjs +1 -1
- package/cjs/min/persisters/persister-yjs/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/queries/index.cjs +1 -1
- package/cjs/min/queries/index.cjs.gz +0 -0
- package/cjs/min/queries/with-schemas/index.cjs +1 -1
- package/cjs/min/queries/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/relationships/index.cjs +1 -1
- package/cjs/min/relationships/index.cjs.gz +0 -0
- package/cjs/min/relationships/with-schemas/index.cjs +1 -1
- package/cjs/min/relationships/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/store/index.cjs +1 -1
- package/cjs/min/store/index.cjs.gz +0 -0
- package/cjs/min/store/with-schemas/index.cjs +1 -1
- package/cjs/min/store/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/ui-react-inspector/index.cjs +1 -1
- package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
- package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/with-schemas/index.cjs +1 -1
- package/cjs/min/with-schemas/index.cjs.gz +0 -0
- package/cjs/synchronizers/synchronizer-ws-server/index.cjs +11 -4
- package/cjs/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +11 -4
- package/es6/min/checkpoints/index.js +1 -1
- package/es6/min/checkpoints/index.js.gz +0 -0
- package/es6/min/checkpoints/with-schemas/index.js +1 -1
- package/es6/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/es6/min/index.js +1 -1
- package/es6/min/index.js.gz +0 -0
- package/es6/min/indexes/index.js +1 -1
- package/es6/min/indexes/index.js.gz +0 -0
- package/es6/min/indexes/with-schemas/index.js +1 -1
- package/es6/min/indexes/with-schemas/index.js.gz +0 -0
- package/es6/min/mergeable-store/index.js +1 -1
- package/es6/min/mergeable-store/index.js.gz +0 -0
- package/es6/min/mergeable-store/with-schemas/index.js +1 -1
- package/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/es6/min/metrics/index.js +1 -1
- package/es6/min/metrics/index.js.gz +0 -0
- package/es6/min/metrics/with-schemas/index.js +1 -1
- package/es6/min/metrics/with-schemas/index.js.gz +0 -0
- package/es6/min/persisters/persister-automerge/index.js +1 -1
- package/es6/min/persisters/persister-automerge/index.js.gz +0 -0
- package/es6/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/es6/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/es6/min/persisters/persister-indexed-db/index.js +1 -1
- package/es6/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/es6/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/es6/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/es6/min/persisters/persister-partykit-client/index.js +1 -1
- package/es6/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/es6/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/es6/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/es6/min/persisters/persister-yjs/index.js +1 -1
- package/es6/min/persisters/persister-yjs/index.js.gz +0 -0
- package/es6/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/es6/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/es6/min/queries/index.js +1 -1
- package/es6/min/queries/index.js.gz +0 -0
- package/es6/min/queries/with-schemas/index.js +1 -1
- package/es6/min/queries/with-schemas/index.js.gz +0 -0
- package/es6/min/relationships/index.js +1 -1
- package/es6/min/relationships/index.js.gz +0 -0
- package/es6/min/relationships/with-schemas/index.js +1 -1
- package/es6/min/relationships/with-schemas/index.js.gz +0 -0
- package/es6/min/store/index.js +1 -1
- package/es6/min/store/index.js.gz +0 -0
- package/es6/min/store/with-schemas/index.js +1 -1
- package/es6/min/store/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/es6/min/ui-react-inspector/index.js +1 -1
- package/es6/min/ui-react-inspector/index.js.gz +0 -0
- package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/es6/min/with-schemas/index.js +1 -1
- package/es6/min/with-schemas/index.js.gz +0 -0
- package/es6/synchronizers/synchronizer-ws-server/index.js +11 -4
- package/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
- package/min/checkpoints/index.js +1 -1
- package/min/checkpoints/index.js.gz +0 -0
- package/min/checkpoints/with-schemas/index.js +1 -1
- package/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/indexes/index.js +1 -1
- package/min/indexes/index.js.gz +0 -0
- package/min/indexes/with-schemas/index.js +1 -1
- package/min/indexes/with-schemas/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/metrics/index.js +1 -1
- package/min/metrics/index.js.gz +0 -0
- package/min/metrics/with-schemas/index.js +1 -1
- package/min/metrics/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-automerge/index.js +1 -1
- package/min/persisters/persister-automerge/index.js.gz +0 -0
- package/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/index.js +1 -1
- package/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/index.js +1 -1
- package/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-yjs/index.js +1 -1
- package/min/persisters/persister-yjs/index.js.gz +0 -0
- package/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/min/queries/index.js +1 -1
- package/min/queries/index.js.gz +0 -0
- package/min/queries/with-schemas/index.js +1 -1
- package/min/queries/with-schemas/index.js.gz +0 -0
- package/min/relationships/index.js +1 -1
- package/min/relationships/index.js.gz +0 -0
- package/min/relationships/with-schemas/index.js +1 -1
- package/min/relationships/with-schemas/index.js.gz +0 -0
- package/min/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/package.json +7 -7
- package/readme.md +2 -2
- package/releases.md +7 -1
- package/synchronizers/synchronizer-ws-server/index.js +11 -4
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
- package/umd/es6/min/checkpoints/index.js +1 -1
- package/umd/es6/min/checkpoints/index.js.gz +0 -0
- package/umd/es6/min/checkpoints/with-schemas/index.js +1 -1
- package/umd/es6/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/index.js +1 -1
- package/umd/es6/min/index.js.gz +0 -0
- package/umd/es6/min/indexes/index.js +1 -1
- package/umd/es6/min/indexes/index.js.gz +0 -0
- package/umd/es6/min/indexes/with-schemas/index.js +1 -1
- package/umd/es6/min/indexes/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/mergeable-store/index.js +1 -1
- package/umd/es6/min/mergeable-store/index.js.gz +0 -0
- package/umd/es6/min/mergeable-store/with-schemas/index.js +1 -1
- package/umd/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/metrics/index.js +1 -1
- package/umd/es6/min/metrics/index.js.gz +0 -0
- package/umd/es6/min/metrics/with-schemas/index.js +1 -1
- package/umd/es6/min/metrics/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-automerge/index.js +1 -1
- package/umd/es6/min/persisters/persister-automerge/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/umd/es6/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-indexed-db/index.js +1 -1
- package/umd/es6/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/umd/es6/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-partykit-client/index.js +1 -1
- package/umd/es6/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/umd/es6/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-yjs/index.js +1 -1
- package/umd/es6/min/persisters/persister-yjs/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/umd/es6/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/queries/index.js +1 -1
- package/umd/es6/min/queries/index.js.gz +0 -0
- package/umd/es6/min/queries/with-schemas/index.js +1 -1
- package/umd/es6/min/queries/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/relationships/index.js +1 -1
- package/umd/es6/min/relationships/index.js.gz +0 -0
- package/umd/es6/min/relationships/with-schemas/index.js +1 -1
- package/umd/es6/min/relationships/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/store/index.js +1 -1
- package/umd/es6/min/store/index.js.gz +0 -0
- package/umd/es6/min/store/with-schemas/index.js +1 -1
- package/umd/es6/min/store/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/ui-react-inspector/index.js +1 -1
- package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
- package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/with-schemas/index.js +1 -1
- package/umd/es6/min/with-schemas/index.js.gz +0 -0
- package/umd/es6/synchronizers/synchronizer-ws-server/index.js +11 -4
- package/umd/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
- package/umd/min/checkpoints/index.js +1 -1
- package/umd/min/checkpoints/index.js.gz +0 -0
- package/umd/min/checkpoints/with-schemas/index.js +1 -1
- package/umd/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/umd/min/index.js +1 -1
- package/umd/min/index.js.gz +0 -0
- package/umd/min/indexes/index.js +1 -1
- package/umd/min/indexes/index.js.gz +0 -0
- package/umd/min/indexes/with-schemas/index.js +1 -1
- package/umd/min/indexes/with-schemas/index.js.gz +0 -0
- package/umd/min/mergeable-store/index.js +1 -1
- package/umd/min/mergeable-store/index.js.gz +0 -0
- package/umd/min/mergeable-store/with-schemas/index.js +1 -1
- package/umd/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/umd/min/metrics/index.js +1 -1
- package/umd/min/metrics/index.js.gz +0 -0
- package/umd/min/metrics/with-schemas/index.js +1 -1
- package/umd/min/metrics/with-schemas/index.js.gz +0 -0
- package/umd/min/persisters/persister-automerge/index.js +1 -1
- package/umd/min/persisters/persister-automerge/index.js.gz +0 -0
- package/umd/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/umd/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/umd/min/persisters/persister-indexed-db/index.js +1 -1
- package/umd/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/umd/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/umd/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/umd/min/persisters/persister-partykit-client/index.js +1 -1
- package/umd/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/umd/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/umd/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/umd/min/persisters/persister-yjs/index.js +1 -1
- package/umd/min/persisters/persister-yjs/index.js.gz +0 -0
- package/umd/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/umd/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/umd/min/queries/index.js +1 -1
- package/umd/min/queries/index.js.gz +0 -0
- package/umd/min/queries/with-schemas/index.js +1 -1
- package/umd/min/queries/with-schemas/index.js.gz +0 -0
- package/umd/min/relationships/index.js +1 -1
- package/umd/min/relationships/index.js.gz +0 -0
- package/umd/min/relationships/with-schemas/index.js +1 -1
- package/umd/min/relationships/with-schemas/index.js.gz +0 -0
- package/umd/min/store/index.js +1 -1
- package/umd/min/store/index.js.gz +0 -0
- package/umd/min/store/with-schemas/index.js +1 -1
- package/umd/min/store/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/min/ui-react-inspector/index.js +1 -1
- package/umd/min/ui-react-inspector/index.js.gz +0 -0
- package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/umd/min/with-schemas/index.js +1 -1
- package/umd/min/with-schemas/index.js.gz +0 -0
- package/umd/synchronizers/synchronizer-ws-server/index.js +11 -4
- package/umd/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{useCell as t,useValue as n,useSetValueCallback as s,useSetCellCallback as l,useValueIds as a,ValueView as r,useStoreOrStoreById as o,useRowCount as i,useSortedRowIds as d,useTableCellIds as c,useIndexesOrIndexesById as u,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useRowIds as g,useResultRowCount as p,useResultSortedRowIds as b,useResultTableCellIds as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as v,useIndexIds as C,useSliceIds as k,useMetrics as T,useMetricIds as x,useMetric as S,useQueries as N,useQueryIds as q,useRelationships as V,useRelationshipIds as M,useStore as L,useTableIds as R,useValues as E,useStoreIds as z,useMetricsIds as $,useIndexesIds as J,useRelationshipsIds as O,useQueriesIds as A,useCreateStore as F,useCreatePersister as P}from"../../ui-react/with-schemas/index.js";const D=e=>typeof e,j="",B=D(j),H=D(!0),W=D(0),Q=D(D),G="type",K="default",U="Has",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",ne=ee+X,se="Cell",le=se+X,ae="Value",re=ae+"s",oe=ae+X,ie="currentTarget",de="value",ce=e=>j+e,ue=globalThis.window,he=Math,me=he.min,ge=he.floor,pe=isFinite,be=e=>null==e,fe=(e,t,n)=>be(e)?n?.():t(e),ye=e=>e==B||e==H,Ie=e=>D(e)==Q,we=e=>Array.isArray(e),ve=(e,t,n)=>e.slice(t,n),Ce=e=>e.length,ke=e=>{throw Error(e)},{PureComponent:Te,Fragment:xe,createElement:Se,useCallback:Ne,useLayoutEffect:qe,useRef:Ve,useState:Me}=e,Le=(e,...t)=>be(e)?{}:e(...t),Re=(e,t)=>e.sort(t),Ee=(e,t)=>e.forEach(t),ze=(e,t)=>e.map(t),$e=e=>0==Ce(e),Je=(e,...t)=>e.push(...t),Oe=e=>e.shift(),Ae=Object,Fe=e=>Ae.getPrototypeOf(e),Pe=Ae.entries,De=Ae.isFrozen,je=e=>!be(e)&&fe(Fe(e),(e=>e==Ae.prototype||be(Fe(e))),(()=>!0)),Be=Ae.keys,He=Ae.freeze,We=(e=[])=>Ae.fromEntries(e),Qe=(e,t)=>t in e,Ge=(e,t)=>(delete e[t],e),Ke=(e,t)=>ze(Pe(e),(([e,n])=>t(n,e))),Ue=e=>je(e)&&0==(e=>Ce(Be(e)))(e),Xe=(e,t,n,s=0)=>be(e)||!je(e)||!s&&Ue(e)||De(e)?(n?.(),!1):(Ke(e,((n,s)=>{t(n,s)||Ge(e,s)})),!!s||!Ue(e)),Ye=e=>JSON.stringify(e,((e,t)=>t instanceof Map?Ae.fromEntries([...t]):t)),Ze=JSON.parse,_e="tinybaseInspector",et="TinyBase Inspector",tt=["left","top","bottom","right","full"],nt="state",st="sort",lt="open",at="position",rt=lt,ot="editable",it=(...e)=>Ye(e),dt=(e,t)=>ze(Re(e),t),ct=(e,n)=>[!!t(nt,e,ot,n),Ne((t=>{n.setCell(nt,e,ot,(e=>!e)),t.preventDefault()}),[n,e])],ut="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ht='content:url("',mt=ht+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",gt='</svg>")',pt=ht+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",bt=ze([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,n,s])=>mt+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${n}' height='${s}' fill='white'/>`+gt)),ft=mt+"<path d='M20 20l60 60M20 80l60-60' />"+gt,yt=mt+`<path d='${ut}' />`+gt,It=mt+`<path d='${ut}M20 20l60 60' />`+gt,wt="*::-webkit-scrollbar",vt=((e,t="")=>e.join(t))(Ke({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[wt]:"width:0.5rem;height:0.5rem;",[wt+"-track"]:"background:#111",[wt+"-thumb"]:"background:#999;border:1px solid #111",[wt+"-thumb:hover"]:"background:#fff",[wt+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+pt,...We(ze(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...We(ze(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":pt,"header>img:nth-of-type(6)":ft,...We(ze(bt,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":yt,"details[open]>summary img.done":It,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${_e} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"},((e,t)=>e?`#${_e} ${t}{${e}}`:""))),Ct=({s:e})=>{const t=n(at,e)??1,l=s(rt,(()=>!0),[],e);return n(rt,e)?null:Se("img",{onClick:l,title:et,"data-position":t})},kt=({uniqueId:e,summary:n,editable:s,handleEditable:a,children:r,s:o})=>{const i=!!t(nt,e,lt,o),d=l(nt,e,lt,(e=>e[ie].open),[],o);return Se("details",{open:i,onToggle:d},Se("summary",null,n,a?Se("img",{onClick:a,className:s?"done":"edit"}):null),r)},Tt=e=>{const t=D(e);return ye(t)||t==W&&pe(e)?t:void 0},xt=(e,t,n,s,l)=>be(l)?e.delCell(t,n,s,!0):e.setCell(t,n,s,l),St=(e,t,n)=>be(n)?e.delValue(t):e.setValue(t,n),Nt=(e,t,n,s)=>e==B?t:e==W?n:s,{useCallback:qt,useMemo:Vt,useState:Mt}=e,Lt="editable",Rt=(e,t)=>ze(c(e,t),(t=>e+"."+t)),Et=(e,t,n)=>{const s=qt(e,t);return n?s:void 0},zt=(...e)=>Vt((()=>e),e),$t=(e,t)=>Vt((()=>({store:e,tableId:t})),[e,t]),Jt=(e,t)=>Vt((()=>({queries:e,queryId:t})),[e,t]),Ot=(e,t=!1,n,s=0,l,a,r,o)=>{const[[i,d,c],u]=Mt([e,t,s]),h=qt((e=>{u(e),o?.(e)}),[o]),m=Et((e=>h([e,e==i&&!d,c])),[h,i,d,c],n),g=qt((e=>h([i,d,e])),[h,i,d]),p=!0===r?Xt:r;return[[i,d,c],m,Vt((()=>!1===r?null:Se(p,{offset:c,limit:l,total:a,onChange:g})),[r,p,c,l,a,g])]},At=(e,t,n)=>Vt((()=>{const s=t??e;return l=we(s)?We(ze(s,(e=>[e,e]))):s,a=(e,t)=>{return{label:t,component:n,...(s=e,D(s)==B?{label:e}:e)};var s},We(Ke(l,((e,t)=>[t,a(e,t)])));var l,a}),[t,n,e]),Ft=({className:e,headerRow:t,idColumn:n,params:[s,l,a,r,o,i]})=>Se("table",{className:e},i?Se("caption",null,i):null,!1===t?null:Se("thead",null,Se("tr",null,!1===n?null:Se(Pt,{sort:r??[],label:"Id",onClick:o}),Ke(s,(({label:e},t)=>Se(Pt,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),Se("tbody",null,ze(a,(e=>Se("tr",{key:e},!1===n?null:Se("th",null,e),Ke(s,(({component:t,getComponentProps:n},s)=>Se("td",{key:s},Se(t,{...Le(n,e,s),...l,rowId:e,cellId:s}))))))))),Pt=({cellId:e,sort:[t,n],label:s=e??j,onClick:l})=>Se("th",{onClick:Et((()=>l?.(e)),[l,e],l),className:be(n)||t!=e?void 0:`sorted ${n?"de":"a"}scending`},be(n)||t!=e?null:(n?"↓":"↑")+" ",s),Dt=({localRowId:t,params:[n,s,l,a,r,o,i]})=>{const d=y(r,t,o);return Se("tr",null,!1===n?null:Se(e.Fragment,null,Se("th",null,t),Se("th",null,d)),Ke(s,(({component:e,getComponentProps:n},s)=>{const[r,o]=s.split(".",2),c=r===l?t:r===a?d:null;return be(c)?null:Se("td",{key:s},Se(e,{...Le(n,c,o),store:i,tableId:r,rowId:c,cellId:o}))})))},jt=({thing:e,onThingChange:t,className:n,hasSchema:s,showType:l=!0})=>{const[a,r]=Mt(),[o,i]=Mt(),[d,c]=Mt(),[u,h]=Mt(),[m,g]=Mt();o!==e&&(r(Tt(e)),i(e),c(e+""),h(Number(e)||0),g(!!e));const p=qt(((e,n)=>{n(e),i(e),t(e)}),[t]),b=qt((()=>{if(!s?.()){const e=Nt(a,W,H,B),n=Nt(e,d,u,m);r(e),i(n),t(n)}}),[s,t,d,u,m,a]);return Se("div",{className:n},l?Se("button",{className:a,onClick:b},a):null,Nt(a,Se("input",{key:a,value:d,onChange:qt((e=>p(e[ie][de]+"",c)),[p])}),Se("input",{key:a,type:"number",value:u,onChange:qt((e=>p(Number(e[ie][de]||0),h)),[p])}),Se("input",{key:a,type:"checkbox",checked:m,onChange:qt((e=>p(!!e[ie].checked,g)),[p])})))},Bt=({tableId:e,cellId:t,descending:n,offset:s,limit:l,store:a,editable:r,sortOnClick:o,paginator:u=!1,onChange:h,customCells:m,...g})=>{const[p,b,f]=Ot(t,n,o,s,l,i(e,a),u,h);return Se(Ft,{...g,params:zt(At(c(e,a),m,r?Kt:I),$t(a,e),d(e,...p,l,a),p,b,f)})},Ht=({store:e,editable:t=!1,valueComponent:n=(t?Ut:r),getValueComponentProps:s,className:l,headerRow:o,idColumn:i})=>Se("table",{className:l},!1===o?null:Se("thead",null,Se("tr",null,!1===i?null:Se("th",null,"Id"),Se("th",null,ae))),Se("tbody",null,ze(a(e),(t=>Se("tr",{key:t},!1===i?null:Se("th",null,t),Se("td",null,Se(n,{...Le(s,t),valueId:t,store:e}))))))),Wt=({indexId:e,sliceId:t,indexes:n,editable:s,customCells:l,...a})=>{const[r,o,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(u(n),e);return Se(Ft,{...a,params:zt(At(c(i,o),l,s?Kt:I),$t(o,i),h(e,t,r))})},Qt=({relationshipId:t,relationships:n,editable:s,customCells:l,className:a,headerRow:r,idColumn:o=!0})=>{const[i,d,c,u]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(m(n),t),h=At([...Rt(c,d),...Rt(u,d)],l,s?Kt:I),p=zt(o,h,c,u,t,i,d);return Se("table",{className:a},!1===r?null:Se("thead",null,Se("tr",null,!1===o?null:Se(e.Fragment,null,Se("th",null,c,".Id"),Se("th",null,u,".Id")),Ke(h,(({label:e},t)=>Se("th",{key:t},e))))),Se("tbody",null,ze(g(c,d),(e=>Se(Dt,{key:e,localRowId:e,params:p})))))},Gt=({queryId:e,cellId:t,descending:n,offset:s,limit:l,queries:a,sortOnClick:r,paginator:o=!1,customCells:i,onChange:d,...c})=>{const[u,h,m]=Ot(t,n,r,s,l,p(e,a),o,d);return Se(Ft,{...c,params:zt(At(f(e,a),i,w),Jt(a,e),b(e,...u,l,a),u,h,m)})},Kt=({tableId:e,rowId:n,cellId:s,store:a,className:r,showType:i})=>Se(jt,{thing:t(e,n,s,a),onThingChange:l(e,n,s,(e=>e),[],a),className:r??Lt+se,showType:i,hasSchema:o(a)?.hasTablesSchema}),Ut=({valueId:e,store:t,className:l,showType:a})=>Se(jt,{thing:n(e,t),onThingChange:s(e,(e=>e),[],t),className:l??Lt+ae,showType:a,hasSchema:o(t)?.hasValuesSchema}),Xt=({onChange:t,total:n,offset:s=0,limit:l=n,singular:a="row",plural:r=a+"s"})=>{(s>n||s<0)&&(s=0,t(0));const o=Et((()=>t(s-l)),[t,s,l],s>0),i=Et((()=>t(s+l)),[t,s,l],s+l<n);return Se(e.Fragment,null,n>l&&Se(e.Fragment,null,Se("button",{className:"previous",disabled:0==s,onClick:o},"←"),Se("button",{className:"next",disabled:s+l>=n,onClick:i},"→"),s+1," to ",me(n,s+l)," of "),n," ",1!=n?r:a)},Yt=({indexes:e,indexesId:t,indexId:n,s:s})=>Se(kt,{uniqueId:it("i",t,n),summary:"Index: "+n,s:s},ze(k(n,e),(l=>Se(Zt,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),Zt=({indexes:e,indexesId:t,indexId:n,sliceId:s,s:l})=>{const a=it("i",t,n,s),[r,o]=ct(a,l);return Se(kt,{uniqueId:a,summary:"Slice: "+s,editable:r,handleEditable:o,s:l},Se(Wt,{sliceId:s,indexId:n,indexes:e,editable:r}))},_t=({indexesId:e,s:t})=>{const n=v(e),s=C(n);return be(n)?null:Se(kt,{uniqueId:it("i",e),summary:"Indexes: "+(e??K),s:t},$e(s)?"No indexes defined":dt(s,(s=>Se(Yt,{indexes:n,indexesId:e,indexId:s,s:t,key:s}))))},en=({metrics:e,metricId:t})=>Se("tr",null,Se("th",null,t),Se("td",null,e?.getTableId(t)),Se("td",null,S(t,e))),tn=({metricsId:e,s:t})=>{const n=T(e),s=x(n);return be(n)?null:Se(kt,{uniqueId:it("m",e),summary:"Metrics: "+(e??K),s:t},$e(s)?"No metrics defined":Se("table",null,Se("thead",null,Se("th",null,"Metric Id"),Se("th",null,"Table Id"),Se("th",null,"Metric")),Se("tbody",null,ze(s,(e=>Se(en,{metrics:n,metricId:e,key:e}))))))},nn=({queries:e,queriesId:n,queryId:s,s:a})=>{const r=it("q",n,s),[o,i,d]=Ze(t(nt,r,st,a)??"[]"),c=l(nt,r,st,Ye,[],a);return Se(kt,{uniqueId:r,summary:"Query: "+s,s:a},Se(Gt,{queryId:s,queries:e,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},sn=({queriesId:e,s:t})=>{const n=N(e),s=q(n);return be(n)?null:Se(kt,{uniqueId:it("q",e),summary:"Queries: "+(e??K),s:t},$e(s)?"No queries defined":dt(s,(s=>Se(nn,{queries:n,queriesId:e,queryId:s,s:t,key:s}))))},ln=({relationships:e,relationshipsId:t,relationshipId:n,s:s})=>{const l=it("r",t,n),[a,r]=ct(l,s);return Se(kt,{uniqueId:l,summary:"Relationship: "+n,editable:a,handleEditable:r,s:s},Se(Qt,{relationshipId:n,relationships:e,editable:a}))},an=({relationshipsId:e,s:t})=>{const n=V(e),s=M(n);return be(n)?null:Se(kt,{uniqueId:it("r",e),summary:"Relationships: "+(e??K),s:t},$e(s)?"No relationships defined":dt(s,(s=>Se(ln,{relationships:n,relationshipsId:e,relationshipId:s,s:t,key:s}))))},rn=({tableId:e,store:n,storeId:s,s:a})=>{const r=it("t",s,e),[o,i,d]=Ze(t(nt,r,st,a)??"[]"),c=l(nt,r,st,Ye,[],a),[u,h]=ct(r,a);return Se(kt,{uniqueId:r,summary:Y+": "+e,editable:u,handleEditable:h,s:a},Se(Bt,{tableId:e,store:n,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:u}))},on=({store:e,storeId:t,s:n})=>{const s=it("v",t),[l,r]=ct(s,n);return $e(a(e))?null:Se(kt,{uniqueId:s,summary:re,editable:l,handleEditable:r,s:n},Se(Ht,{store:e,editable:l}))},dn=({storeId:e,s:t})=>{const n=L(e),s=R(n);return be(n)?null:Se(kt,{uniqueId:it("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(e??K),s:t},Se(on,{storeId:e,store:n,s:t}),dt(s,(s=>Se(rn,{store:n,storeId:e,tableId:s,s:t,key:s}))))},cn=({s:e})=>{const t=Ve(null),n=Ve(0),[s,l]=Me(!1),{scrollLeft:a,scrollTop:r}=E(e);qe((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=ge(a)+e.clientWidth&&e.scrollHeight>=ge(r)+e.clientHeight&&e.scrollTo(a,r)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,r]);const o=Ne((t=>{const{scrollLeft:s,scrollTop:a}=t[ie];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{l(!0),e.setPartialValues({scrollLeft:s,scrollTop:a})}))}),[e]),i=L(),d=z(),c=T(),u=$(),h=v(),m=J(),g=V(),p=O(),b=N(),f=A();return be(i)&&$e(d)&&be(c)&&$e(u)&&be(h)&&$e(m)&&be(g)&&$e(p)&&be(b)&&$e(f)?Se("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):Se("article",{ref:t,onScroll:o},Se(dn,{s:e}),ze(d,(t=>Se(dn,{storeId:t,s:e,key:t}))),Se(tn,{s:e}),ze(u,(t=>Se(tn,{metricsId:t,s:e,key:t}))),Se(_t,{s:e}),ze(m,(t=>Se(_t,{indexesId:t,s:e,key:t}))),Se(an,{s:e}),ze(p,(t=>Se(an,{relationshipsId:t,s:e,key:t}))),Se(sn,{s:e}),ze(f,(t=>Se(sn,{queriesId:t,s:e,key:t}))))};class un extends Te{constructor(e){super(e),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}componentDidCatch=(e,t)=>console.error(e,t.componentStack);render(){return this.state.e?Se("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const hn=({s:e})=>{const t=n(at,e)??1,l=s(rt,(()=>!1),[],e),a=s(at,(e=>Number(e[ie].dataset.id)),[],e);return Se("header",null,Se("img",{title:et}),Se("span",null,et),ze(tt,((e,n)=>n==t?null:Se("img",{onClick:a,"data-id":n,title:"Dock to "+e,key:n}))),Se("img",{onClick:l,title:"Close"}))},mn=({s:e})=>{const t=n(at,e)??1;return n(rt,e)?Se("main",{"data-position":t},Se(hn,{s:e}),Se(un,null,Se(cn,{s:e}))):null},gn=e=>t=>{return n=(t,n)=>t+e(n),vn(t).reduce(n,0);var n},pn=e=>e?.size??0,bn=gn(pn),fn=gn(bn),yn=gn(fn),In=(e,t)=>e?.has(t)??!1,wn=e=>be(e)||0==pn(e),vn=e=>[...e?.values()??[]],Cn=e=>e.clear(),kn=(e,t)=>e?.forEach(t),Tn=(e,t)=>e?.delete(t),xn=e=>new Map(e),Sn=e=>[...e?.keys()??[]],Nn=(e,t)=>e?.get(t),qn=(e,t)=>kn(e,((e,n)=>t(n,e))),Vn=(e,t,n)=>be(n)?(Tn(e,t),e):e?.set(t,n),Mn=(e,t,n,s)=>(In(e,t)?s?.(Nn(e,t)):Vn(e,t,n()),Nn(e,t)),Ln=(e,t,n,s=Vn)=>(Ke(t,((t,s)=>n(e,s,t))),qn(e,(n=>Qe(t,n)?0:s(e,n))),e),Rn=(e,t,n,s)=>{const l={};return kn(e,((e,a)=>{if(!n?.(e,a)){const n=t?t(e,a):e;!s?.(n)&&(l[a]=n)}})),l},En=(e,t,n)=>Rn(e,(e=>Rn(e,t,n)),wn,Ue),zn=(e,t,n)=>Rn(e,(e=>En(e,t,n)),wn,Ue),$n=(e,t)=>{const n=xn();return kn(e,((e,s)=>n.set(s,t?.(e)??e))),n},Jn=e=>$n(e,$n),On=e=>$n(e,Jn),An=(e,t,n,s,l=0)=>fe((n?Mn:Nn)(e,t[l],l>Ce(t)-2?n:xn),(a=>{if(l>Ce(t)-2)return s?.(a)&&Vn(e,t[l]),a;const r=An(a,t,n,s,l+1);return wn(a)&&Vn(e,t[l]),r})),Fn=xn(),Pn=xn(),Dn="storage",jn=e=>new Set(we(e)||be(e)?e:[e]),Bn=(e,t)=>e?.add(t),Hn=/^\d+$/,Wn=()=>{const e=[];let t=0;return[n=>(n?Oe(e):null)??j+t++,t=>{Hn.test(t)&&Ce(e)<1e3&&Je(e,t)}]},Qn=e=>[e,e],Gn=(e,t=bn)=>t(e[0])+t(e[1]),Kn=()=>[xn(),xn()],Un=e=>[...e],Xn=([e,t])=>e===t;xn(ze("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(j),((e,t)=>[e,t])));const Yn=(e,t,n)=>Vn(e,t,Nn(e,t)==-n?void 0:n),Zn=()=>{let e,t,n=!1,s=!1,l=0,a=[];const r=xn(),o=xn(),i=xn(),d=xn(),c=xn(),u=xn(),h=xn(),m=xn(),g=xn(),p=xn(),b=xn(),f=xn(),y=xn(),I=xn(),w=jn(),v=xn(),C=xn(),k=xn(),T=xn(),x=Kn(),S=Kn(),N=Kn(),q=Kn(),V=Kn(),M=Kn(),L=Kn(),R=Kn(),E=Kn(),z=Kn(),$=Kn(),J=Kn(),O=Kn(),A=Kn(),F=Kn(),P=Kn(),D=Kn(),B=Kn(),H=Kn(),Q=Kn(),X=Kn(),ie=Kn(),de=xn(),ue=Kn(),[he,me,ge,pe]=(e=>{let t;const[n,s]=Wn(),l=xn();return[(e,s,a,r=[],o=(()=>[]))=>{t??=ln;const i=n(1);return Vn(l,i,[e,s,a,r,o]),Bn(An(s,a??[j],jn),i),i},(e,n,...s)=>Ee(((e,t=[j])=>{const n=[],s=(e,l)=>l==Ce(t)?Je(n,e):null===t[l]?kn(e,(e=>s(e,l+1))):Ee([t[l],null],(t=>s(Nn(e,t),l+1)));return s(e,0),n})(e,n),(e=>kn(e,(e=>Nn(l,e)[0](t,...n??[],...s))))),e=>fe(Nn(l,e),(([,t,n])=>(An(t,n??[j],void 0,(t=>(Tn(t,e),wn(t)?1:0))),Vn(l,e),s(e),n))),e=>fe(Nn(l,e),(([e,,n=[],s,l])=>{const a=(...r)=>{const o=Ce(r);o==Ce(n)?e(t,...r,...l(r)):be(n[o])?Ee(s[o]?.(...r)??[],(e=>a(...r,e))):a(...r,n[o])};a()}))]})(),ke=e=>{if(!Xe(e,((e,t)=>[G,K].includes(t))))return!1;const t=e[G];return!(!ye(t)&&t!=W||(Tt(e[K])!=t&&Ge(e,K),0))},Te=we,xe=(t,n)=>(!e||In(b,n)||mt(n))&&Xe(t,((e,t)=>Se(n,t,e)),(()=>mt(n))),Se=(e,t,n,s)=>Xe(s?n:Me(n,e,t),((s,l)=>fe(Ne(e,t,l,s),(e=>(n[l]=e,!0)),(()=>!1))),(()=>mt(e,t))),Ne=(t,n,s,l)=>e?fe(Nn(Nn(b,t),s),(e=>Tt(l)!=e[G]?mt(t,n,s,l,e[K]):l),(()=>mt(t,n,s,l))):be(Tt(l))?mt(t,n,s,l):l,qe=(e,t)=>Xe(t?e:Le(e),((t,n)=>fe(Ve(n,t),(t=>(e[n]=t,!0)),(()=>!1))),(()=>gt())),Ve=(e,n)=>t?fe(Nn(y,e),(t=>Tt(n)!=t[G]?gt(e,n,t[K]):n),(()=>gt(e,n))):be(Tt(n))?gt(e,n):n,Me=(e,t,n)=>(fe(Nn(f,t),(([s,l])=>{kn(s,((t,n)=>{Qe(e,n)||(e[n]=t)})),kn(l,(s=>{Qe(e,s)||mt(t,n,s)}))})),e),Le=e=>(t&&(kn(I,((t,n)=>{Qe(e,n)||(e[n]=t)})),kn(w,(t=>{Qe(e,t)||gt(t)}))),e),$e=e=>Ln(b,e,((e,t,n)=>{const s=xn(),l=jn();Ln(Mn(b,t,xn),n,((e,t,n)=>{Vn(e,t,n),fe(n[K],(e=>Vn(s,t,e)),(()=>Bn(l,t)))})),Vn(f,t,[s,l])}),((e,t)=>{Vn(b,t),Vn(f,t)})),Oe=e=>Ln(y,e,((e,t,n)=>{Vn(y,t,n),fe(n[K],(e=>Vn(I,t,e)),(()=>Bn(w,t)))}),((e,t)=>{Vn(y,t),Vn(I,t),Tn(w,t)})),Ae=e=>Ue(e)?Ut():Ht(e),Fe=e=>Ln(k,e,((e,t,n)=>Pe(t,n)),((e,t)=>st(t))),Pe=(e,t)=>Ln(Mn(k,e,(()=>(ot(e,1),Vn(v,e,Wn()),Vn(C,e,xn()),xn()))),t,((t,n,s)=>De(e,t,n,s)),((t,n)=>lt(e,t,n))),De=(e,t,n,s,l)=>Ln(Mn(t,n,(()=>(it(e,n,1),xn()))),s,((t,s,l)=>je(e,n,t,s,l)),((s,a)=>at(e,t,n,s,a,l))),je=(e,t,n,s,l)=>{In(n,s)||dt(e,t,s,1);const a=Nn(n,s);l!==a&&(ct(e,t,s,a,l),Vn(n,s,l))},Be=(e,t,n,s,l)=>fe(Nn(t,n),(t=>je(e,n,t,s,l)),(()=>De(e,t,n,Me({[s]:l},e,n)))),We=e=>Ue(e)?Zt():Wt(e),_e=e=>Ln(T,e,((e,t,n)=>et(t,n)),((e,t)=>rt(t))),et=(e,t)=>{In(T,e)||ut(e,1);const n=Nn(T,e);t!==n&&(ht(e,n,t),Vn(T,e,t))},tt=(e,t)=>{const[n]=Nn(v,e),s=n(t);return In(Nn(k,e),s)?tt(e,t):s},nt=e=>Nn(k,e)??Pe(e,{}),st=e=>Pe(e,{}),lt=(e,t,n)=>{const[,s]=Nn(v,e);s(n),De(e,t,n,{},!0)},at=(e,t,n,s,l,a)=>{const r=Nn(Nn(f,e)?.[0],l);if(!be(r)&&!a)return je(e,n,s,l,r);const o=t=>{ct(e,n,t,Nn(s,t)),dt(e,n,t,-1),Vn(s,t)};be(r)?o(l):qn(s,o),wn(s)&&(it(e,n,-1),wn(Vn(t,n))&&(ot(e,-1),Vn(k,e),Vn(v,e),Vn(C,e)))},rt=e=>{const t=Nn(I,e);if(!be(t))return et(e,t);ht(e,Nn(T,e)),ut(e,-1),Vn(T,e)},ot=(e,t)=>Yn(r,e,t),it=(e,t,n)=>Yn(Mn(d,e,xn),t,n)&&Vn(i,e,Mn(i,e,(()=>0))+n),dt=(e,t,n,s)=>{const l=Nn(C,e),a=Nn(l,n)??0;(0==a&&1==s||1==a&&-1==s)&&Yn(Mn(o,e,xn),n,s),Vn(l,n,a!=-s?a+s:null),Yn(Mn(Mn(c,e,xn),t,xn),n,s)},ct=(e,t,n,s,l)=>{Mn(Mn(Mn(u,e,xn),t,xn),n,(()=>[s,0]))[1]=l,a[3]?.(e,t,n,l)},ut=(e,t)=>Yn(h,e,t),ht=(e,t,n)=>{Mn(m,e,(()=>[t,0]))[1]=n,a[4]?.(e,n)},mt=(e,t,n,s,l)=>(Je(Mn(Mn(Mn(g,e,xn),t,xn),n,(()=>[])),s),l),gt=(e,t,n)=>(Je(Mn(p,e,(()=>[])),t),n),pt=(e,t,n)=>fe(Nn(Nn(Nn(u,e),t),n),(([e,t])=>[!0,e,t]),(()=>[!1,...Qn(Et(e,t,n))])),bt=e=>fe(Nn(m,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Qn(Jt(e))])),ft=e=>wn(g)||wn(P[e])?0:kn(e?On(g):g,((t,n)=>kn(t,((t,s)=>kn(t,((t,l)=>me(P[e],[n,s,l],t))))))),yt=e=>wn(p)||wn(D[e])?0:kn(e?$n(p):p,((t,n)=>me(D[e],[n],t))),It=(e,t,n,s)=>{if(!wn(e))return me(t,s,(()=>Rn(e))),qn(e,((e,t)=>me(n,[...s??[],e],1==t))),1},wt=e=>{const t=Ot();t!=n&&me(x[e],void 0,t);const s=wn(z[e]),l=wn(O[e])&&wn(A[e])&&wn(E[e])&&wn($[e])&&wn(M[e])&&wn(L[e])&&wn(R[e])&&s&&wn(N[e])&&wn(q[e]),a=wn(F[e])&&wn(J[e])&&wn(V[e])&&wn(S[e]);if(!l||!a){const t=e?[$n(r),Jn(o),$n(i),Jn(d),On(c),On(u)]:[r,o,i,d,c,u];if(!l){It(t[0],N[e],q[e]),kn(t[1],((t,n)=>It(t,M[e],L[e],[n]))),kn(t[2],((t,n)=>{0!=t&&me(R[e],[n],Vt(n))}));const n=jn();kn(t[3],((t,l)=>{It(t,E[e],$[e],[l])&&!s&&(me(z[e],[l,null]),Bn(n,l))})),s||kn(t[5],((t,s)=>{if(!In(n,s)){const n=jn();kn(t,(e=>kn(e,(([t,s],l)=>s!==t?Bn(n,l):Tn(e,l))))),kn(n,(t=>me(z[e],[s,t])))}})),kn(t[4],((t,n)=>kn(t,((t,s)=>It(t,O[e],A[e],[n,s])))))}if(!a){let n;kn(t[5],((t,s)=>{let l;kn(t,((t,a)=>{let r;kn(t,(([t,o],i)=>{o!==t&&(me(F[e],[s,a,i],o,t,pt),n=l=r=1)})),r&&me(J[e],[s,a],pt)})),l&&me(V[e],[s],pt)})),n&&me(S[e],void 0,pt)}}},vt=e=>{const t=jt();t!=s&&me(B[e],void 0,t);const n=wn(Q[e])&&wn(X[e]),l=wn(ie[e])&&wn(H[e]);if(!n||!l){const t=e?[$n(h),$n(m)]:[h,m];if(n||It(t[0],Q[e],X[e]),!l){let n;kn(t[1],(([t,s],l)=>{s!==t&&(me(ie[e],[l],s,t,bt),n=1)})),n&&me(H[e],void 0,bt)}}},Ct=(e,...t)=>(tn((()=>e(...ze(t,ce)))),ln),kt=()=>zn(k),Nt=()=>Sn(k),qt=e=>Sn(Nn(C,ce(e))),Vt=e=>pn(Nn(k,ce(e))),Mt=e=>Sn(Nn(k,ce(e))),Lt=(e,t,n,s=0,l)=>{return ze(ve(Re((a=Nn(k,ce(e)),r=(e,n)=>[be(t)?n:Nn(e,ce(t)),n],ze([...a?.entries()??[]],(([e,t])=>r(t,e)))),(([e],[t])=>((e??0)<(t??0)?-1:1)*(n?-1:1))),s,be(l)?l:s+l),(([,e])=>e));var a,r},Rt=(e,t)=>Sn(Nn(Nn(k,ce(e)),ce(t))),Et=(e,t,n)=>Nn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),zt=()=>Rn(T),$t=()=>Sn(T),Jt=e=>Nn(T,ce(e)),Ot=()=>!wn(k),At=e=>In(k,ce(e)),Ft=(e,t)=>In(Nn(C,ce(e)),ce(t)),Pt=(e,t)=>In(Nn(k,ce(e)),ce(t)),Dt=(e,t,n)=>In(Nn(Nn(k,ce(e)),ce(t)),ce(n)),jt=()=>!wn(T),Bt=e=>In(T,ce(e)),Ht=e=>Ct((()=>(e=>Xe(e,xe,mt))(e)?Fe(e):0)),Wt=e=>Ct((()=>qe(e)?_e(e):0)),Qt=e=>{try{Ae(Ze(e))}catch{}return ln},Gt=t=>Ct((()=>{if((e=Xe(t,(e=>Xe(e,ke))))&&($e(t),!wn(k))){const e=kt();Ut(),Ht(e)}})),Kt=e=>Ct((()=>{if(t=(e=>Xe(e,ke))(e)){const n=zt();en(),Zt(),t=!0,Oe(e),Wt(n)}})),Ut=()=>Ct((()=>Fe({}))),Xt=e=>Ct((e=>In(k,e)?st(e):0),e),Yt=(e,t)=>Ct(((e,t)=>fe(Nn(k,e),(n=>In(n,t)?lt(e,n,t):0))),e,t),Zt=()=>Ct((()=>_e({}))),_t=()=>Ct((()=>{$e({}),e=!1})),en=()=>Ct((()=>{Oe({}),t=!1})),tn=(e,t)=>{if(-1!=l){nn();const n=e();return sn(t),n}},nn=()=>(-1!=l&&l++,1==l&&(a[0]?.(),me(de)),ln),sn=e=>(l>0&&(l--,0==l&&(l=1,ft(1),wn(u)||wt(1),yt(1),wn(m)||vt(1),e?.(ln)&&(kn(u,((e,t)=>kn(e,((e,n)=>kn(e,(([e],s)=>xt(ln,t,n,s,e))))))),Cn(u),kn(m,(([e],t)=>St(ln,t,e))),Cn(m)),me(ue[0],void 0),l=-1,ft(0),wn(u)||wt(0),yt(0),wn(m)||vt(0),a[1]?.(),me(ue[1],void 0),a[2]?.(),l=0,n=Ot(),s=jt(),Ee([r,o,i,d,c,u,g,h,m,p],Cn))),ln),ln={getContent:()=>[kt(),zt()],getTables:kt,getTableIds:Nt,getTable:e=>En(Nn(k,ce(e))),getTableCellIds:qt,getRowCount:Vt,getRowIds:Mt,getSortedRowIds:Lt,getRow:(e,t)=>Rn(Nn(Nn(k,ce(e)),ce(t))),getCellIds:Rt,getCell:Et,getValues:zt,getValueIds:$t,getValue:Jt,hasTables:Ot,hasTable:At,hasTableCell:Ft,hasRow:Pt,hasCell:Dt,hasValues:jt,hasValue:Bt,getTablesJson:()=>Ye(k),getValuesJson:()=>Ye(T),getJson:()=>Ye([k,T]),getTablesSchemaJson:()=>Ye(b),getValuesSchemaJson:()=>Ye(y),getSchemaJson:()=>Ye([b,y]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>Ct((()=>Te(e)?(([e,t])=>{(Ue(e)?Ut:Ht)(e),(Ue(t)?Zt:Wt)(t)})(e):0)),setTables:Ht,setTable:(e,t)=>Ct((e=>xe(t,e)?Pe(e,t):0),e),setRow:(e,t,n)=>Ct(((e,t)=>Se(e,t,n)?De(e,nt(e),t,n):0),e,t),addRow:(e,t,n=!0)=>tn((()=>{let s;return Se(e,s,t)&&(e=ce(e),De(e,nt(e),s=tt(e,n?1:0),t)),s})),setPartialRow:(e,t,n)=>Ct(((e,t)=>{if(Se(e,t,n,1)){const s=nt(e);Ke(n,((n,l)=>Be(e,s,t,l,n)))}}),e,t),setCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(Ne(e,t,n,Ie(s)?s(Et(e,t,n)):s),(s=>Be(e,nt(e),t,n,s)))),e,t,n),setValues:Wt,setPartialValues:e=>Ct((()=>qe(e,1)?Ke(e,((e,t)=>et(t,e))):0)),setValue:(e,t)=>Ct((e=>fe(Ve(e,Ie(t)?t(Jt(e)):t),(t=>et(e,t)))),e),applyChanges:e=>Ct((()=>{Ke(e[0],((e,t)=>be(e)?Xt(t):Ke(e,((e,n)=>be(e)?Yt(t,n):Ke(e,((e,s)=>xt(ln,t,n,s,e))))))),Ke(e[1],((e,t)=>St(ln,t,e)))})),setTablesJson:Qt,setValuesJson:e=>{try{We(Ze(e))}catch{}return ln},setJson:e=>Ct((()=>{try{const[t,n]=Ze(e);Ae(t),We(n)}catch{Qt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>Ct((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:Xt,delRow:Yt,delCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(Nn(k,e),(l=>fe(Nn(l,t),(a=>In(a,n)?at(e,l,t,a,n,s):0))))),e,t,n),delValues:Zt,delValue:e=>Ct((e=>In(T,e)?rt(e):0),e),delTablesSchema:_t,delValuesSchema:en,delSchema:()=>Ct((()=>{_t(),en()})),transaction:tn,startTransaction:nn,getTransactionChanges:()=>[Rn(u,((e,t)=>-1===Nn(r,t)?void 0:Rn(e,((e,n)=>-1===Nn(Nn(d,t),n)?void 0:Rn(e,(([,e])=>e),(e=>Xn(e)))),wn,Ue)),wn,Ue),Rn(m,(([,e])=>e),(e=>Xn(e))),1],getTransactionLog:()=>[!wn(u),!wn(m),zn(u,Un,Xn),zn(g),Rn(m,Un,Xn),Rn(p),Rn(r),En(d),zn(c),Rn(h)],finishTransaction:sn,forEachTable:e=>kn(k,((t,n)=>e(n,(e=>kn(t,((t,n)=>e(n,(e=>qn(t,e))))))))),forEachTableCell:(e,t)=>qn(Nn(C,ce(e)),t),forEachRow:(e,t)=>kn(Nn(k,ce(e)),((e,n)=>t(n,(t=>qn(e,t))))),forEachCell:(e,t,n)=>qn(Nn(Nn(k,ce(e)),ce(t)),n),forEachValue:e=>qn(T,e),addSortedRowIdsListener:(e,t,n,s,l,a,r)=>{let o=Lt(e,t,n,s,l);return he((()=>{const r=Lt(e,t,n,s,l);var i,d,c;d=o,Ce(i=r)===Ce(d)&&(c=(e,t)=>d[t]===e,i.every(c))||(o=r,a(ln,e,t,n,s,l,o))}),z[r?1:0],[e,t],[Nt])},addStartTransactionListener:e=>he(e,de),addWillFinishTransactionListener:e=>he(e,ue[0]),addDidFinishTransactionListener:e=>he(e,ue[1]),callListener:e=>(pe(e),ln),delListener:e=>(ge(e),ln),getListenerStats:()=>({hasTables:Gn(x),tables:Gn(S),tableIds:Gn(N),hasTable:Gn(q),table:Gn(V),tableCellIds:Gn(M),hasTableCell:Gn(L,fn),rowCount:Gn(R),rowIds:Gn(E),sortedRowIds:Gn(z),hasRow:Gn($,fn),row:Gn(J,fn),cellIds:Gn(O,fn),hasCell:Gn(A,yn),cell:Gn(F,yn),invalidCell:Gn(P,yn),hasValues:Gn(B),values:Gn(H),valueIds:Gn(Q),hasValue:Gn(X),value:Gn(ie),invalidValue:Gn(D),transaction:bn(de)+Gn(ue)}),isMergeable:()=>!1,createStore:Zn,addListener:he,callListeners:me,setInternalListeners:(e,t,n,s,l)=>a=[e,t,n,s,l]};return Ke({[U+Z]:[0,x,[],()=>[Ot()]],[Z]:[0,S],[_]:[0,N],[U+Y]:[1,q,[Nt],e=>[At(...e)]],[Y]:[1,V,[Nt]],[Y+le]:[1,M,[Nt]],[U+Y+se]:[2,L,[Nt,qt],e=>[Ft(...e)]],[te]:[1,R,[Nt]],[ne]:[1,E,[Nt]],[U+ee]:[2,$,[Nt,Mt],e=>[Pt(...e)]],[ee]:[2,J,[Nt,Mt]],[le]:[2,O,[Nt,Mt]],[U+se]:[3,A,[Nt,Mt,Rt],e=>[Dt(...e)]],[se]:[3,F,[Nt,Mt,Rt],e=>Qn(Et(...e))],InvalidCell:[3,P],[U+re]:[0,B,[],()=>[jt()]],[re]:[0,H],[oe]:[0,Q],[U+ae]:[1,X,[$t],e=>[Bt(...e)]],[ae]:[1,ie,[$t],e=>Qn(Jt(e[0]))],InvalidValue:[1,D]},(([e,t,n,s],l)=>{ln["add"+l+"Listener"]=(...l)=>he(l[e],t[l[e+1]?1:0],e>0?ve(l,0,e):void 0,n,s)})),He(ln)},_n=({position:e="right",open:t=!1})=>{const n=F(Zn),s=tt.indexOf(e);return P(n,(e=>{return t=_e,n=sessionStorage,((e,t,n,s,l,a,r,o={},i=[])=>{let d,c,u,h=0,m=0,g=0;Mn(Fn,i,(()=>0)),Mn(Pn,i,(()=>[]));const[p,b,f,y,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!Ue(e)||!Ue(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!Ue(e)||!Ue(t),t.setContent]:ke("Store type not supported by this Persister"))(r,e),w=t=>{(p&&we(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},v=async e=>(2!=h&&(h=1,m++,await x((async()=>{try{const e=await t();we(e)?w(e):ke("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))),S),C=()=>(c&&(l(c),c=void 0),S),k=async e=>(1!=h&&(h=2,g++,await x((async()=>{try{await n(b,e)}catch(e){}h=0}))),S),T=()=>(fe(u,e.delListener),u=void 0,S),x=async(...e)=>(Je(Nn(Pn,i),...e),await(async()=>{if(!Nn(Fn,i)){for(Vn(Fn,i,1);!be(d=Oe(Nn(Pn,i)));)try{await d()}catch(e){}Vn(Fn,i,0)}})(),S),S={load:v,startAutoLoad:async e=>{await C().load(e);try{c=s((async(e,t)=>{t||e?2!=h&&(h=1,m++,w(t??e),h=0):await v()}))}catch(e){}return S},stopAutoLoad:C,isAutoLoading:()=>!be(c),save:k,startAutoSave:async()=>(await T().save(),u=e.addDidFinishTransactionListener((()=>{const e=f();y(e)&&k(e)})),S),stopAutoSave:T,isAutoSaving:()=>!be(u),schedule:x,getStore:()=>e,destroy:()=>(Nn(Pn,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:g}),...o};return He(S)})(e,(async()=>{return e=n.getItem(t),JSON.parse(e,((e,t)=>""===t?void 0:t));var e}),(async e=>{return n.setItem(t,(s=e(),JSON.stringify(s,((e,t)=>void 0===t?"":t))));var s}),(e=>{const s=s=>{if(s.storageArea===n&&s.key===t)try{e(Ze(s.newValue))}catch{e()}};return ue.addEventListener(Dn,s),s}),(e=>ue.removeEventListener(Dn,e)),0,3,{getStorageName:()=>t});var t,n}),void 0,(async e=>{await e.load([{},{position:-1==s?1:s,open:!!t}]),await e.startAutoSave()})),Se(xe,null,Se("aside",{id:_e},Se(Ct,{s:n}),Se(mn,{s:n})),Se("style",null,vt))};export{_n as Inspector};
|
|
1
|
+
import e from"react";import{useCell as t,useValue as n,useSetValueCallback as s,useSetCellCallback as l,useValueIds as a,ValueView as r,useStoreOrStoreById as o,useRowCount as i,useSortedRowIds as d,useTableCellIds as c,useIndexesOrIndexesById as u,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useRowIds as g,useResultRowCount as p,useResultSortedRowIds as b,useResultTableCellIds as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as v,useIndexIds as C,useSliceIds as k,useMetrics as T,useMetricIds as x,useMetric as S,useQueries as N,useQueryIds as q,useRelationships as V,useRelationshipIds as M,useStore as L,useTableIds as R,useValues as E,useStoreIds as z,useMetricsIds as $,useIndexesIds as J,useRelationshipsIds as O,useQueriesIds as A,useCreateStore as F,useCreatePersister as P}from"../../ui-react/with-schemas/index.js";const D=e=>typeof e,j="",B=D(j),H=D(!0),W=D(0),Q=D(D),G="type",K="default",U="Has",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",ne=ee+X,se="Cell",le=se+X,ae="Value",re=ae+"s",oe=ae+X,ie="currentTarget",de="value",ce=e=>j+e,ue=globalThis.window,he=Math,me=he.min,ge=he.floor,pe=isFinite,be=e=>null==e,fe=(e,t,n)=>be(e)?n?.():t(e),ye=e=>e==B||e==H,Ie=e=>D(e)==Q,we=e=>Array.isArray(e),ve=(e,t,n)=>e.slice(t,n),Ce=e=>e.length,ke=e=>{throw Error(e)},{PureComponent:Te,Fragment:xe,createElement:Se,useCallback:Ne,useLayoutEffect:qe,useRef:Ve,useState:Me}=e,Le=(e,...t)=>be(e)?{}:e(...t),Re=(e,t)=>e.sort(t),Ee=(e,t)=>e.forEach(t),ze=(e,t)=>e.map(t),$e=e=>0==Ce(e),Je=(e,...t)=>e.push(...t),Oe=e=>e.shift(),Ae=Object,Fe=e=>Ae.getPrototypeOf(e),Pe=Ae.entries,De=Ae.isFrozen,je=e=>!be(e)&&fe(Fe(e),(e=>e==Ae.prototype||be(Fe(e))),(()=>!0)),Be=Ae.keys,He=Ae.freeze,We=(e=[])=>Ae.fromEntries(e),Qe=(e,t)=>t in e,Ge=(e,t)=>(delete e[t],e),Ke=(e,t)=>ze(Pe(e),(([e,n])=>t(n,e))),Ue=e=>je(e)&&0==(e=>Ce(Be(e)))(e),Xe=(e,t,n,s=0)=>be(e)||!je(e)||!s&&Ue(e)||De(e)?(n?.(),!1):(Ke(e,((n,s)=>{t(n,s)||Ge(e,s)})),!!s||!Ue(e)),Ye=e=>JSON.stringify(e,((e,t)=>t instanceof Map?Ae.fromEntries([...t]):t)),Ze=JSON.parse,_e="tinybaseInspector",et="TinyBase Inspector",tt=["left","top","bottom","right","full"],nt="state",st="sort",lt="open",at="position",rt=lt,ot="editable",it=(...e)=>Ye(e),dt=(e,t)=>ze(Re(e),t),ct=(e,n)=>[!!t(nt,e,ot,n),Ne((t=>{n.setCell(nt,e,ot,(e=>!e)),t.preventDefault()}),[n,e])],ut="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ht='content:url("',mt=ht+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",gt='</svg>")',pt=ht+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",bt=ze([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,n,s])=>mt+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${n}' height='${s}' fill='white'/>`+gt)),ft=mt+"<path d='M20 20l60 60M20 80l60-60' />"+gt,yt=mt+`<path d='${ut}' />`+gt,It=mt+`<path d='${ut}M20 20l60 60' />`+gt,wt="*::-webkit-scrollbar",vt=((e,t="")=>e.join(t))(Ke({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[wt]:"width:0.5rem;height:0.5rem;",[wt+"-track"]:"background:#111",[wt+"-thumb"]:"background:#999;border:1px solid #111",[wt+"-thumb:hover"]:"background:#fff",[wt+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+pt,...We(ze(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...We(ze(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":pt,"header>img:nth-of-type(6)":ft,...We(ze(bt,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":yt,"details[open]>summary img.done":It,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${_e} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"},((e,t)=>e?`#${_e} ${t}{${e}}`:""))),Ct=({s:e})=>{const t=n(at,e)??1,l=s(rt,(()=>!0),[],e);return n(rt,e)?null:Se("img",{onClick:l,title:et,"data-position":t})},kt=({uniqueId:e,summary:n,editable:s,handleEditable:a,children:r,s:o})=>{const i=!!t(nt,e,lt,o),d=l(nt,e,lt,(e=>e[ie].open),[],o);return Se("details",{open:i,onToggle:d},Se("summary",null,n,a?Se("img",{onClick:a,className:s?"done":"edit"}):null),r)},Tt=e=>{const t=D(e);return ye(t)||t==W&&pe(e)?t:void 0},xt=(e,t,n,s,l)=>be(l)?e.delCell(t,n,s,!0):e.setCell(t,n,s,l),St=(e,t,n)=>be(n)?e.delValue(t):e.setValue(t,n),Nt=(e,t,n,s)=>e==B?t:e==W?n:s,{useCallback:qt,useMemo:Vt,useState:Mt}=e,Lt="editable",Rt=(e,t)=>ze(c(e,t),(t=>e+"."+t)),Et=(e,t,n)=>{const s=qt(e,t);return n?s:void 0},zt=(...e)=>Vt((()=>e),e),$t=(e,t)=>Vt((()=>({store:e,tableId:t})),[e,t]),Jt=(e,t)=>Vt((()=>({queries:e,queryId:t})),[e,t]),Ot=(e,t=!1,n,s=0,l,a,r,o)=>{const[[i,d,c],u]=Mt([e,t,s]),h=qt((e=>{u(e),o?.(e)}),[o]),m=Et((e=>h([e,e==i&&!d,c])),[h,i,d,c],n),g=qt((e=>h([i,d,e])),[h,i,d]),p=!0===r?Xt:r;return[[i,d,c],m,Vt((()=>!1===r?null:Se(p,{offset:c,limit:l,total:a,onChange:g})),[r,p,c,l,a,g])]},At=(e,t,n)=>Vt((()=>{const s=t??e;return l=we(s)?We(ze(s,(e=>[e,e]))):s,a=(e,t)=>{return{label:t,component:n,...(s=e,D(s)==B?{label:e}:e)};var s},We(Ke(l,((e,t)=>[t,a(e,t)])));var l,a}),[t,n,e]),Ft=({className:e,headerRow:t,idColumn:n,params:[s,l,a,r,o,i]})=>Se("table",{className:e},i?Se("caption",null,i):null,!1===t?null:Se("thead",null,Se("tr",null,!1===n?null:Se(Pt,{sort:r??[],label:"Id",onClick:o}),Ke(s,(({label:e},t)=>Se(Pt,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),Se("tbody",null,ze(a,(e=>Se("tr",{key:e},!1===n?null:Se("th",null,e),Ke(s,(({component:t,getComponentProps:n},s)=>Se("td",{key:s},Se(t,{...Le(n,e,s),...l,rowId:e,cellId:s}))))))))),Pt=({cellId:e,sort:[t,n],label:s=e??j,onClick:l})=>Se("th",{onClick:Et((()=>l?.(e)),[l,e],l),className:be(n)||t!=e?void 0:`sorted ${n?"de":"a"}scending`},be(n)||t!=e?null:(n?"↓":"↑")+" ",s),Dt=({localRowId:t,params:[n,s,l,a,r,o,i]})=>{const d=y(r,t,o);return Se("tr",null,!1===n?null:Se(e.Fragment,null,Se("th",null,t),Se("th",null,d)),Ke(s,(({component:e,getComponentProps:n},s)=>{const[r,o]=s.split(".",2),c=r===l?t:r===a?d:null;return be(c)?null:Se("td",{key:s},Se(e,{...Le(n,c,o),store:i,tableId:r,rowId:c,cellId:o}))})))},jt=({thing:e,onThingChange:t,className:n,hasSchema:s,showType:l=!0})=>{const[a,r]=Mt(),[o,i]=Mt(),[d,c]=Mt(),[u,h]=Mt(),[m,g]=Mt();o!==e&&(r(Tt(e)),i(e),c(e+""),h(Number(e)||0),g(!!e));const p=qt(((e,n)=>{n(e),i(e),t(e)}),[t]),b=qt((()=>{if(!s?.()){const e=Nt(a,W,H,B),n=Nt(e,d,u,m);r(e),i(n),t(n)}}),[s,t,d,u,m,a]);return Se("div",{className:n},l?Se("button",{className:a,onClick:b},a):null,Nt(a,Se("input",{key:a,value:d,onChange:qt((e=>p(e[ie][de]+"",c)),[p])}),Se("input",{key:a,type:"number",value:u,onChange:qt((e=>p(Number(e[ie][de]||0),h)),[p])}),Se("input",{key:a,type:"checkbox",checked:m,onChange:qt((e=>p(!!e[ie].checked,g)),[p])})))},Bt=({tableId:e,cellId:t,descending:n,offset:s,limit:l,store:a,editable:r,sortOnClick:o,paginator:u=!1,onChange:h,customCells:m,...g})=>{const[p,b,f]=Ot(t,n,o,s,l,i(e,a),u,h);return Se(Ft,{...g,params:zt(At(c(e,a),m,r?Kt:I),$t(a,e),d(e,...p,l,a),p,b,f)})},Ht=({store:e,editable:t=!1,valueComponent:n=(t?Ut:r),getValueComponentProps:s,className:l,headerRow:o,idColumn:i})=>Se("table",{className:l},!1===o?null:Se("thead",null,Se("tr",null,!1===i?null:Se("th",null,"Id"),Se("th",null,ae))),Se("tbody",null,ze(a(e),(t=>Se("tr",{key:t},!1===i?null:Se("th",null,t),Se("td",null,Se(n,{...Le(s,t),valueId:t,store:e}))))))),Wt=({indexId:e,sliceId:t,indexes:n,editable:s,customCells:l,...a})=>{const[r,o,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(u(n),e);return Se(Ft,{...a,params:zt(At(c(i,o),l,s?Kt:I),$t(o,i),h(e,t,r))})},Qt=({relationshipId:t,relationships:n,editable:s,customCells:l,className:a,headerRow:r,idColumn:o=!0})=>{const[i,d,c,u]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(m(n),t),h=At([...Rt(c,d),...Rt(u,d)],l,s?Kt:I),p=zt(o,h,c,u,t,i,d);return Se("table",{className:a},!1===r?null:Se("thead",null,Se("tr",null,!1===o?null:Se(e.Fragment,null,Se("th",null,c,".Id"),Se("th",null,u,".Id")),Ke(h,(({label:e},t)=>Se("th",{key:t},e))))),Se("tbody",null,ze(g(c,d),(e=>Se(Dt,{key:e,localRowId:e,params:p})))))},Gt=({queryId:e,cellId:t,descending:n,offset:s,limit:l,queries:a,sortOnClick:r,paginator:o=!1,customCells:i,onChange:d,...c})=>{const[u,h,m]=Ot(t,n,r,s,l,p(e,a),o,d);return Se(Ft,{...c,params:zt(At(f(e,a),i,w),Jt(a,e),b(e,...u,l,a),u,h,m)})},Kt=({tableId:e,rowId:n,cellId:s,store:a,className:r,showType:i})=>Se(jt,{thing:t(e,n,s,a),onThingChange:l(e,n,s,(e=>e),[],a),className:r??Lt+se,showType:i,hasSchema:o(a)?.hasTablesSchema}),Ut=({valueId:e,store:t,className:l,showType:a})=>Se(jt,{thing:n(e,t),onThingChange:s(e,(e=>e),[],t),className:l??Lt+ae,showType:a,hasSchema:o(t)?.hasValuesSchema}),Xt=({onChange:t,total:n,offset:s=0,limit:l=n,singular:a="row",plural:r=a+"s"})=>{(s>n||s<0)&&(s=0,t(0));const o=Et((()=>t(s-l)),[t,s,l],s>0),i=Et((()=>t(s+l)),[t,s,l],s+l<n);return Se(e.Fragment,null,n>l&&Se(e.Fragment,null,Se("button",{className:"previous",disabled:0==s,onClick:o},"←"),Se("button",{className:"next",disabled:s+l>=n,onClick:i},"→"),s+1," to ",me(n,s+l)," of "),n," ",1!=n?r:a)},Yt=({indexes:e,indexesId:t,indexId:n,s:s})=>Se(kt,{uniqueId:it("i",t,n),summary:"Index: "+n,s:s},ze(k(n,e),(l=>Se(Zt,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),Zt=({indexes:e,indexesId:t,indexId:n,sliceId:s,s:l})=>{const a=it("i",t,n,s),[r,o]=ct(a,l);return Se(kt,{uniqueId:a,summary:"Slice: "+s,editable:r,handleEditable:o,s:l},Se(Wt,{sliceId:s,indexId:n,indexes:e,editable:r}))},_t=({indexesId:e,s:t})=>{const n=v(e),s=C(n);return be(n)?null:Se(kt,{uniqueId:it("i",e),summary:"Indexes: "+(e??K),s:t},$e(s)?"No indexes defined":dt(s,(s=>Se(Yt,{indexes:n,indexesId:e,indexId:s,s:t,key:s}))))},en=({metrics:e,metricId:t})=>Se("tr",null,Se("th",null,t),Se("td",null,e?.getTableId(t)),Se("td",null,S(t,e))),tn=({metricsId:e,s:t})=>{const n=T(e),s=x(n);return be(n)?null:Se(kt,{uniqueId:it("m",e),summary:"Metrics: "+(e??K),s:t},$e(s)?"No metrics defined":Se("table",null,Se("thead",null,Se("th",null,"Metric Id"),Se("th",null,"Table Id"),Se("th",null,"Metric")),Se("tbody",null,ze(s,(e=>Se(en,{metrics:n,metricId:e,key:e}))))))},nn=({queries:e,queriesId:n,queryId:s,s:a})=>{const r=it("q",n,s),[o,i,d]=Ze(t(nt,r,st,a)??"[]"),c=l(nt,r,st,Ye,[],a);return Se(kt,{uniqueId:r,summary:"Query: "+s,s:a},Se(Gt,{queryId:s,queries:e,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},sn=({queriesId:e,s:t})=>{const n=N(e),s=q(n);return be(n)?null:Se(kt,{uniqueId:it("q",e),summary:"Queries: "+(e??K),s:t},$e(s)?"No queries defined":dt(s,(s=>Se(nn,{queries:n,queriesId:e,queryId:s,s:t,key:s}))))},ln=({relationships:e,relationshipsId:t,relationshipId:n,s:s})=>{const l=it("r",t,n),[a,r]=ct(l,s);return Se(kt,{uniqueId:l,summary:"Relationship: "+n,editable:a,handleEditable:r,s:s},Se(Qt,{relationshipId:n,relationships:e,editable:a}))},an=({relationshipsId:e,s:t})=>{const n=V(e),s=M(n);return be(n)?null:Se(kt,{uniqueId:it("r",e),summary:"Relationships: "+(e??K),s:t},$e(s)?"No relationships defined":dt(s,(s=>Se(ln,{relationships:n,relationshipsId:e,relationshipId:s,s:t,key:s}))))},rn=({tableId:e,store:n,storeId:s,s:a})=>{const r=it("t",s,e),[o,i,d]=Ze(t(nt,r,st,a)??"[]"),c=l(nt,r,st,Ye,[],a),[u,h]=ct(r,a);return Se(kt,{uniqueId:r,summary:Y+": "+e,editable:u,handleEditable:h,s:a},Se(Bt,{tableId:e,store:n,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:u}))},on=({store:e,storeId:t,s:n})=>{const s=it("v",t),[l,r]=ct(s,n);return $e(a(e))?null:Se(kt,{uniqueId:s,summary:re,editable:l,handleEditable:r,s:n},Se(Ht,{store:e,editable:l}))},dn=({storeId:e,s:t})=>{const n=L(e),s=R(n);return be(n)?null:Se(kt,{uniqueId:it("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(e??K),s:t},Se(on,{storeId:e,store:n,s:t}),dt(s,(s=>Se(rn,{store:n,storeId:e,tableId:s,s:t,key:s}))))},cn=({s:e})=>{const t=Ve(null),n=Ve(0),[s,l]=Me(!1),{scrollLeft:a,scrollTop:r}=E(e);qe((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=ge(a)+e.clientWidth&&e.scrollHeight>=ge(r)+e.clientHeight&&e.scrollTo(a,r)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,r]);const o=Ne((t=>{const{scrollLeft:s,scrollTop:a}=t[ie];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{l(!0),e.setPartialValues({scrollLeft:s,scrollTop:a})}))}),[e]),i=L(),d=z(),c=T(),u=$(),h=v(),m=J(),g=V(),p=O(),b=N(),f=A();return be(i)&&$e(d)&&be(c)&&$e(u)&&be(h)&&$e(m)&&be(g)&&$e(p)&&be(b)&&$e(f)?Se("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):Se("article",{ref:t,onScroll:o},Se(dn,{s:e}),ze(d,(t=>Se(dn,{storeId:t,s:e,key:t}))),Se(tn,{s:e}),ze(u,(t=>Se(tn,{metricsId:t,s:e,key:t}))),Se(_t,{s:e}),ze(m,(t=>Se(_t,{indexesId:t,s:e,key:t}))),Se(an,{s:e}),ze(p,(t=>Se(an,{relationshipsId:t,s:e,key:t}))),Se(sn,{s:e}),ze(f,(t=>Se(sn,{queriesId:t,s:e,key:t}))))};class un extends Te{constructor(e){super(e),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}componentDidCatch=(e,t)=>console.error(e,t.componentStack);render(){return this.state.e?Se("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const hn=({s:e})=>{const t=n(at,e)??1,l=s(rt,(()=>!1),[],e),a=s(at,(e=>Number(e[ie].dataset.id)),[],e);return Se("header",null,Se("img",{title:et}),Se("span",null,et),ze(tt,((e,n)=>n==t?null:Se("img",{onClick:a,"data-id":n,title:"Dock to "+e,key:n}))),Se("img",{onClick:l,title:"Close"}))},mn=({s:e})=>{const t=n(at,e)??1;return n(rt,e)?Se("main",{"data-position":t},Se(hn,{s:e}),Se(un,null,Se(cn,{s:e}))):null},gn=e=>t=>{return n=(t,n)=>t+e(n),vn(t).reduce(n,0);var n},pn=e=>e?.size??0,bn=gn(pn),fn=gn(bn),yn=gn(fn),In=(e,t)=>e?.has(t)??!1,wn=e=>be(e)||0==pn(e),vn=e=>[...e?.values()??[]],Cn=e=>e.clear(),kn=(e,t)=>e?.forEach(t),Tn=(e,t)=>e?.delete(t),xn=e=>new Map(e),Sn=e=>[...e?.keys()??[]],Nn=(e,t)=>e?.get(t),qn=(e,t)=>kn(e,((e,n)=>t(n,e))),Vn=(e,t,n)=>be(n)?(Tn(e,t),e):e?.set(t,n),Mn=(e,t,n,s)=>(In(e,t)?s?.(Nn(e,t)):Vn(e,t,n()),Nn(e,t)),Ln=(e,t,n,s=Vn)=>(Ke(t,((t,s)=>n(e,s,t))),qn(e,(n=>Qe(t,n)?0:s(e,n))),e),Rn=(e,t,n,s)=>{const l={};return kn(e,((e,a)=>{if(!n?.(e,a)){const n=t?t(e,a):e;!s?.(n)&&(l[a]=n)}})),l},En=(e,t,n)=>Rn(e,(e=>Rn(e,t,n)),wn,Ue),zn=(e,t,n)=>Rn(e,(e=>En(e,t,n)),wn,Ue),$n=(e,t)=>{const n=xn();return kn(e,((e,s)=>n.set(s,t?.(e)??e))),n},Jn=e=>$n(e,$n),On=e=>$n(e,Jn),An=(e,t,n,s,l=0)=>fe((n?Mn:Nn)(e,t[l],l>Ce(t)-2?n:xn),(a=>{if(l>Ce(t)-2)return s?.(a)&&Vn(e,t[l]),a;const r=An(a,t,n,s,l+1);return wn(a)&&Vn(e,t[l]),r})),Fn=xn(),Pn=xn(),Dn="storage",jn=e=>new Set(we(e)||be(e)?e:[e]),Bn=(e,t)=>e?.add(t),Hn=/^\d+$/,Wn=()=>{const e=[];let t=0;return[n=>(n?Oe(e):null)??j+t++,t=>{Hn.test(t)&&Ce(e)<1e3&&Je(e,t)}]},Qn=e=>[e,e],Gn=(e,t=bn)=>t(e[0])+t(e[1]),Kn=()=>[xn(),xn()],Un=e=>[...e],Xn=([e,t])=>e===t;xn(ze("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(j),((e,t)=>[e,t])));const Yn=(e,t,n)=>Vn(e,t,Nn(e,t)==-n?void 0:n),Zn=()=>{let e,t,n=!1,s=!1,l=0,a=[];const r=xn(),o=xn(),i=xn(),d=xn(),c=xn(),u=xn(),h=xn(),m=xn(),g=xn(),p=xn(),b=xn(),f=xn(),y=xn(),I=xn(),w=jn(),v=xn(),C=xn(),k=xn(),T=xn(),x=Kn(),S=Kn(),N=Kn(),q=Kn(),V=Kn(),M=Kn(),L=Kn(),R=Kn(),E=Kn(),z=Kn(),$=Kn(),J=Kn(),O=Kn(),A=Kn(),F=Kn(),P=Kn(),D=Kn(),B=Kn(),H=Kn(),Q=Kn(),X=Kn(),ie=Kn(),de=xn(),ue=Kn(),[he,me,ge,pe]=(()=>{let e;const[t,n]=Wn(),s=xn();return[(n,l,a,r=[],o=()=>[])=>{e??=ln;const i=t(1);return Vn(s,i,[n,l,a,r,o]),Bn(An(l,a??[j],jn),i),i},(t,n,...l)=>Ee(((e,t=[j])=>{const n=[],s=(e,l)=>l==Ce(t)?Je(n,e):null===t[l]?kn(e,(e=>s(e,l+1))):Ee([t[l],null],(t=>s(Nn(e,t),l+1)));return s(e,0),n})(t,n),(t=>kn(t,(t=>Nn(s,t)[0](e,...n??[],...l))))),e=>fe(Nn(s,e),(([,t,l])=>(An(t,l??[j],void 0,(t=>(Tn(t,e),wn(t)?1:0))),Vn(s,e),n(e),l))),t=>fe(Nn(s,t),(([t,,n=[],s,l])=>{const a=(...r)=>{const o=Ce(r);o==Ce(n)?t(e,...r,...l(r)):be(n[o])?Ee(s[o]?.(...r)??[],(e=>a(...r,e))):a(...r,n[o])};a()}))]})(),ke=e=>{if(!Xe(e,((e,t)=>[G,K].includes(t))))return!1;const t=e[G];return!(!ye(t)&&t!=W||(Tt(e[K])!=t&&Ge(e,K),0))},Te=we,xe=(t,n)=>(!e||In(b,n)||mt(n))&&Xe(t,((e,t)=>Se(n,t,e)),(()=>mt(n))),Se=(e,t,n,s)=>Xe(s?n:Me(n,e,t),((s,l)=>fe(Ne(e,t,l,s),(e=>(n[l]=e,!0)),(()=>!1))),(()=>mt(e,t))),Ne=(t,n,s,l)=>e?fe(Nn(Nn(b,t),s),(e=>Tt(l)!=e[G]?mt(t,n,s,l,e[K]):l),(()=>mt(t,n,s,l))):be(Tt(l))?mt(t,n,s,l):l,qe=(e,t)=>Xe(t?e:Le(e),((t,n)=>fe(Ve(n,t),(t=>(e[n]=t,!0)),(()=>!1))),(()=>gt())),Ve=(e,n)=>t?fe(Nn(y,e),(t=>Tt(n)!=t[G]?gt(e,n,t[K]):n),(()=>gt(e,n))):be(Tt(n))?gt(e,n):n,Me=(e,t,n)=>(fe(Nn(f,t),(([s,l])=>{kn(s,((t,n)=>{Qe(e,n)||(e[n]=t)})),kn(l,(s=>{Qe(e,s)||mt(t,n,s)}))})),e),Le=e=>(t&&(kn(I,((t,n)=>{Qe(e,n)||(e[n]=t)})),kn(w,(t=>{Qe(e,t)||gt(t)}))),e),$e=e=>Ln(b,e,((e,t,n)=>{const s=xn(),l=jn();Ln(Mn(b,t,xn),n,((e,t,n)=>{Vn(e,t,n),fe(n[K],(e=>Vn(s,t,e)),(()=>Bn(l,t)))})),Vn(f,t,[s,l])}),((e,t)=>{Vn(b,t),Vn(f,t)})),Oe=e=>Ln(y,e,((e,t,n)=>{Vn(y,t,n),fe(n[K],(e=>Vn(I,t,e)),(()=>Bn(w,t)))}),((e,t)=>{Vn(y,t),Vn(I,t),Tn(w,t)})),Ae=e=>Ue(e)?Ut():Ht(e),Fe=e=>Ln(k,e,((e,t,n)=>Pe(t,n)),((e,t)=>st(t))),Pe=(e,t)=>Ln(Mn(k,e,(()=>(ot(e,1),Vn(v,e,Wn()),Vn(C,e,xn()),xn()))),t,((t,n,s)=>De(e,t,n,s)),((t,n)=>lt(e,t,n))),De=(e,t,n,s,l)=>Ln(Mn(t,n,(()=>(it(e,n,1),xn()))),s,((t,s,l)=>je(e,n,t,s,l)),((s,a)=>at(e,t,n,s,a,l))),je=(e,t,n,s,l)=>{In(n,s)||dt(e,t,s,1);const a=Nn(n,s);l!==a&&(ct(e,t,s,a,l),Vn(n,s,l))},Be=(e,t,n,s,l)=>fe(Nn(t,n),(t=>je(e,n,t,s,l)),(()=>De(e,t,n,Me({[s]:l},e,n)))),We=e=>Ue(e)?Zt():Wt(e),_e=e=>Ln(T,e,((e,t,n)=>et(t,n)),((e,t)=>rt(t))),et=(e,t)=>{In(T,e)||ut(e,1);const n=Nn(T,e);t!==n&&(ht(e,n,t),Vn(T,e,t))},tt=(e,t)=>{const[n]=Nn(v,e),s=n(t);return In(Nn(k,e),s)?tt(e,t):s},nt=e=>Nn(k,e)??Pe(e,{}),st=e=>Pe(e,{}),lt=(e,t,n)=>{const[,s]=Nn(v,e);s(n),De(e,t,n,{},!0)},at=(e,t,n,s,l,a)=>{const r=Nn(Nn(f,e)?.[0],l);if(!be(r)&&!a)return je(e,n,s,l,r);const o=t=>{ct(e,n,t,Nn(s,t)),dt(e,n,t,-1),Vn(s,t)};be(r)?o(l):qn(s,o),wn(s)&&(it(e,n,-1),wn(Vn(t,n))&&(ot(e,-1),Vn(k,e),Vn(v,e),Vn(C,e)))},rt=e=>{const t=Nn(I,e);if(!be(t))return et(e,t);ht(e,Nn(T,e)),ut(e,-1),Vn(T,e)},ot=(e,t)=>Yn(r,e,t),it=(e,t,n)=>Yn(Mn(d,e,xn),t,n)&&Vn(i,e,Mn(i,e,(()=>0))+n),dt=(e,t,n,s)=>{const l=Nn(C,e),a=Nn(l,n)??0;(0==a&&1==s||1==a&&-1==s)&&Yn(Mn(o,e,xn),n,s),Vn(l,n,a!=-s?a+s:null),Yn(Mn(Mn(c,e,xn),t,xn),n,s)},ct=(e,t,n,s,l)=>{Mn(Mn(Mn(u,e,xn),t,xn),n,(()=>[s,0]))[1]=l,a[3]?.(e,t,n,l)},ut=(e,t)=>Yn(h,e,t),ht=(e,t,n)=>{Mn(m,e,(()=>[t,0]))[1]=n,a[4]?.(e,n)},mt=(e,t,n,s,l)=>(Je(Mn(Mn(Mn(g,e,xn),t,xn),n,(()=>[])),s),l),gt=(e,t,n)=>(Je(Mn(p,e,(()=>[])),t),n),pt=(e,t,n)=>fe(Nn(Nn(Nn(u,e),t),n),(([e,t])=>[!0,e,t]),(()=>[!1,...Qn(Et(e,t,n))])),bt=e=>fe(Nn(m,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Qn(Jt(e))])),ft=e=>wn(g)||wn(P[e])?0:kn(e?On(g):g,((t,n)=>kn(t,((t,s)=>kn(t,((t,l)=>me(P[e],[n,s,l],t))))))),yt=e=>wn(p)||wn(D[e])?0:kn(e?$n(p):p,((t,n)=>me(D[e],[n],t))),It=(e,t,n,s)=>{if(!wn(e))return me(t,s,(()=>Rn(e))),qn(e,((e,t)=>me(n,[...s??[],e],1==t))),1},wt=e=>{const t=Ot();t!=n&&me(x[e],void 0,t);const s=wn(z[e]),l=wn(O[e])&&wn(A[e])&&wn(E[e])&&wn($[e])&&wn(M[e])&&wn(L[e])&&wn(R[e])&&s&&wn(N[e])&&wn(q[e]),a=wn(F[e])&&wn(J[e])&&wn(V[e])&&wn(S[e]);if(!l||!a){const t=e?[$n(r),Jn(o),$n(i),Jn(d),On(c),On(u)]:[r,o,i,d,c,u];if(!l){It(t[0],N[e],q[e]),kn(t[1],((t,n)=>It(t,M[e],L[e],[n]))),kn(t[2],((t,n)=>{0!=t&&me(R[e],[n],Vt(n))}));const n=jn();kn(t[3],((t,l)=>{It(t,E[e],$[e],[l])&&!s&&(me(z[e],[l,null]),Bn(n,l))})),s||kn(t[5],((t,s)=>{if(!In(n,s)){const n=jn();kn(t,(e=>kn(e,(([t,s],l)=>s!==t?Bn(n,l):Tn(e,l))))),kn(n,(t=>me(z[e],[s,t])))}})),kn(t[4],((t,n)=>kn(t,((t,s)=>It(t,O[e],A[e],[n,s])))))}if(!a){let n;kn(t[5],((t,s)=>{let l;kn(t,((t,a)=>{let r;kn(t,(([t,o],i)=>{o!==t&&(me(F[e],[s,a,i],o,t,pt),n=l=r=1)})),r&&me(J[e],[s,a],pt)})),l&&me(V[e],[s],pt)})),n&&me(S[e],void 0,pt)}}},vt=e=>{const t=jt();t!=s&&me(B[e],void 0,t);const n=wn(Q[e])&&wn(X[e]),l=wn(ie[e])&&wn(H[e]);if(!n||!l){const t=e?[$n(h),$n(m)]:[h,m];if(n||It(t[0],Q[e],X[e]),!l){let n;kn(t[1],(([t,s],l)=>{s!==t&&(me(ie[e],[l],s,t,bt),n=1)})),n&&me(H[e],void 0,bt)}}},Ct=(e,...t)=>(tn((()=>e(...ze(t,ce)))),ln),kt=()=>zn(k),Nt=()=>Sn(k),qt=e=>Sn(Nn(C,ce(e))),Vt=e=>pn(Nn(k,ce(e))),Mt=e=>Sn(Nn(k,ce(e))),Lt=(e,t,n,s=0,l)=>{return ze(ve(Re((a=Nn(k,ce(e)),r=(e,n)=>[be(t)?n:Nn(e,ce(t)),n],ze([...a?.entries()??[]],(([e,t])=>r(t,e)))),(([e],[t])=>((e??0)<(t??0)?-1:1)*(n?-1:1))),s,be(l)?l:s+l),(([,e])=>e));var a,r},Rt=(e,t)=>Sn(Nn(Nn(k,ce(e)),ce(t))),Et=(e,t,n)=>Nn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),zt=()=>Rn(T),$t=()=>Sn(T),Jt=e=>Nn(T,ce(e)),Ot=()=>!wn(k),At=e=>In(k,ce(e)),Ft=(e,t)=>In(Nn(C,ce(e)),ce(t)),Pt=(e,t)=>In(Nn(k,ce(e)),ce(t)),Dt=(e,t,n)=>In(Nn(Nn(k,ce(e)),ce(t)),ce(n)),jt=()=>!wn(T),Bt=e=>In(T,ce(e)),Ht=e=>Ct((()=>(e=>Xe(e,xe,mt))(e)?Fe(e):0)),Wt=e=>Ct((()=>qe(e)?_e(e):0)),Qt=e=>{try{Ae(Ze(e))}catch{}return ln},Gt=t=>Ct((()=>{if((e=Xe(t,(e=>Xe(e,ke))))&&($e(t),!wn(k))){const e=kt();Ut(),Ht(e)}})),Kt=e=>Ct((()=>{if(t=(e=>Xe(e,ke))(e)){const n=zt();en(),Zt(),t=!0,Oe(e),Wt(n)}})),Ut=()=>Ct((()=>Fe({}))),Xt=e=>Ct((e=>In(k,e)?st(e):0),e),Yt=(e,t)=>Ct(((e,t)=>fe(Nn(k,e),(n=>In(n,t)?lt(e,n,t):0))),e,t),Zt=()=>Ct((()=>_e({}))),_t=()=>Ct((()=>{$e({}),e=!1})),en=()=>Ct((()=>{Oe({}),t=!1})),tn=(e,t)=>{if(-1!=l){nn();const n=e();return sn(t),n}},nn=()=>(-1!=l&&l++,1==l&&(a[0]?.(),me(de)),ln),sn=e=>(l>0&&(l--,0==l&&(l=1,ft(1),wn(u)||wt(1),yt(1),wn(m)||vt(1),e?.(ln)&&(kn(u,((e,t)=>kn(e,((e,n)=>kn(e,(([e],s)=>xt(ln,t,n,s,e))))))),Cn(u),kn(m,(([e],t)=>St(ln,t,e))),Cn(m)),me(ue[0],void 0),l=-1,ft(0),wn(u)||wt(0),yt(0),wn(m)||vt(0),a[1]?.(),me(ue[1],void 0),a[2]?.(),l=0,n=Ot(),s=jt(),Ee([r,o,i,d,c,u,g,h,m,p],Cn))),ln),ln={getContent:()=>[kt(),zt()],getTables:kt,getTableIds:Nt,getTable:e=>En(Nn(k,ce(e))),getTableCellIds:qt,getRowCount:Vt,getRowIds:Mt,getSortedRowIds:Lt,getRow:(e,t)=>Rn(Nn(Nn(k,ce(e)),ce(t))),getCellIds:Rt,getCell:Et,getValues:zt,getValueIds:$t,getValue:Jt,hasTables:Ot,hasTable:At,hasTableCell:Ft,hasRow:Pt,hasCell:Dt,hasValues:jt,hasValue:Bt,getTablesJson:()=>Ye(k),getValuesJson:()=>Ye(T),getJson:()=>Ye([k,T]),getTablesSchemaJson:()=>Ye(b),getValuesSchemaJson:()=>Ye(y),getSchemaJson:()=>Ye([b,y]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>Ct((()=>Te(e)?(([e,t])=>{(Ue(e)?Ut:Ht)(e),(Ue(t)?Zt:Wt)(t)})(e):0)),setTables:Ht,setTable:(e,t)=>Ct((e=>xe(t,e)?Pe(e,t):0),e),setRow:(e,t,n)=>Ct(((e,t)=>Se(e,t,n)?De(e,nt(e),t,n):0),e,t),addRow:(e,t,n=!0)=>tn((()=>{let s;return Se(e,s,t)&&(e=ce(e),De(e,nt(e),s=tt(e,n?1:0),t)),s})),setPartialRow:(e,t,n)=>Ct(((e,t)=>{if(Se(e,t,n,1)){const s=nt(e);Ke(n,((n,l)=>Be(e,s,t,l,n)))}}),e,t),setCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(Ne(e,t,n,Ie(s)?s(Et(e,t,n)):s),(s=>Be(e,nt(e),t,n,s)))),e,t,n),setValues:Wt,setPartialValues:e=>Ct((()=>qe(e,1)?Ke(e,((e,t)=>et(t,e))):0)),setValue:(e,t)=>Ct((e=>fe(Ve(e,Ie(t)?t(Jt(e)):t),(t=>et(e,t)))),e),applyChanges:e=>Ct((()=>{Ke(e[0],((e,t)=>be(e)?Xt(t):Ke(e,((e,n)=>be(e)?Yt(t,n):Ke(e,((e,s)=>xt(ln,t,n,s,e))))))),Ke(e[1],((e,t)=>St(ln,t,e)))})),setTablesJson:Qt,setValuesJson:e=>{try{We(Ze(e))}catch{}return ln},setJson:e=>Ct((()=>{try{const[t,n]=Ze(e);Ae(t),We(n)}catch{Qt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>Ct((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:Xt,delRow:Yt,delCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(Nn(k,e),(l=>fe(Nn(l,t),(a=>In(a,n)?at(e,l,t,a,n,s):0))))),e,t,n),delValues:Zt,delValue:e=>Ct((e=>In(T,e)?rt(e):0),e),delTablesSchema:_t,delValuesSchema:en,delSchema:()=>Ct((()=>{_t(),en()})),transaction:tn,startTransaction:nn,getTransactionChanges:()=>[Rn(u,((e,t)=>-1===Nn(r,t)?void 0:Rn(e,((e,n)=>-1===Nn(Nn(d,t),n)?void 0:Rn(e,(([,e])=>e),(e=>Xn(e)))),wn,Ue)),wn,Ue),Rn(m,(([,e])=>e),(e=>Xn(e))),1],getTransactionLog:()=>[!wn(u),!wn(m),zn(u,Un,Xn),zn(g),Rn(m,Un,Xn),Rn(p),Rn(r),En(d),zn(c),Rn(h)],finishTransaction:sn,forEachTable:e=>kn(k,((t,n)=>e(n,(e=>kn(t,((t,n)=>e(n,(e=>qn(t,e))))))))),forEachTableCell:(e,t)=>qn(Nn(C,ce(e)),t),forEachRow:(e,t)=>kn(Nn(k,ce(e)),((e,n)=>t(n,(t=>qn(e,t))))),forEachCell:(e,t,n)=>qn(Nn(Nn(k,ce(e)),ce(t)),n),forEachValue:e=>qn(T,e),addSortedRowIdsListener:(e,t,n,s,l,a,r)=>{let o=Lt(e,t,n,s,l);return he((()=>{const r=Lt(e,t,n,s,l);var i,d,c;d=o,Ce(i=r)===Ce(d)&&(c=(e,t)=>d[t]===e,i.every(c))||(o=r,a(ln,e,t,n,s,l,o))}),z[r?1:0],[e,t],[Nt])},addStartTransactionListener:e=>he(e,de),addWillFinishTransactionListener:e=>he(e,ue[0]),addDidFinishTransactionListener:e=>he(e,ue[1]),callListener:e=>(pe(e),ln),delListener:e=>(ge(e),ln),getListenerStats:()=>({hasTables:Gn(x),tables:Gn(S),tableIds:Gn(N),hasTable:Gn(q),table:Gn(V),tableCellIds:Gn(M),hasTableCell:Gn(L,fn),rowCount:Gn(R),rowIds:Gn(E),sortedRowIds:Gn(z),hasRow:Gn($,fn),row:Gn(J,fn),cellIds:Gn(O,fn),hasCell:Gn(A,yn),cell:Gn(F,yn),invalidCell:Gn(P,yn),hasValues:Gn(B),values:Gn(H),valueIds:Gn(Q),hasValue:Gn(X),value:Gn(ie),invalidValue:Gn(D),transaction:bn(de)+Gn(ue)}),isMergeable:()=>!1,createStore:Zn,addListener:he,callListeners:me,setInternalListeners:(e,t,n,s,l)=>a=[e,t,n,s,l]};return Ke({[U+Z]:[0,x,[],()=>[Ot()]],[Z]:[0,S],[_]:[0,N],[U+Y]:[1,q,[Nt],e=>[At(...e)]],[Y]:[1,V,[Nt]],[Y+le]:[1,M,[Nt]],[U+Y+se]:[2,L,[Nt,qt],e=>[Ft(...e)]],[te]:[1,R,[Nt]],[ne]:[1,E,[Nt]],[U+ee]:[2,$,[Nt,Mt],e=>[Pt(...e)]],[ee]:[2,J,[Nt,Mt]],[le]:[2,O,[Nt,Mt]],[U+se]:[3,A,[Nt,Mt,Rt],e=>[Dt(...e)]],[se]:[3,F,[Nt,Mt,Rt],e=>Qn(Et(...e))],InvalidCell:[3,P],[U+re]:[0,B,[],()=>[jt()]],[re]:[0,H],[oe]:[0,Q],[U+ae]:[1,X,[$t],e=>[Bt(...e)]],[ae]:[1,ie,[$t],e=>Qn(Jt(e[0]))],InvalidValue:[1,D]},(([e,t,n,s],l)=>{ln["add"+l+"Listener"]=(...l)=>he(l[e],t[l[e+1]?1:0],e>0?ve(l,0,e):void 0,n,s)})),He(ln)},_n=({position:e="right",open:t=!1})=>{const n=F(Zn),s=tt.indexOf(e);return P(n,(e=>{return t=_e,n=sessionStorage,((e,t,n,s,l,a,r,o={},i=[])=>{let d,c,u,h=0,m=0,g=0;Mn(Fn,i,(()=>0)),Mn(Pn,i,(()=>[]));const[p,b,f,y,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!Ue(e)||!Ue(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!Ue(e)||!Ue(t),t.setContent]:ke("Store type not supported by this Persister"))(r,e),w=t=>{(p&&we(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},v=async e=>(2!=h&&(h=1,m++,await x((async()=>{try{const e=await t();we(e)?w(e):ke("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))),S),C=()=>(c&&(l(c),c=void 0),S),k=async e=>(1!=h&&(h=2,g++,await x((async()=>{try{await n(b,e)}catch(e){}h=0}))),S),T=()=>(fe(u,e.delListener),u=void 0,S),x=async(...e)=>(Je(Nn(Pn,i),...e),await(async()=>{if(!Nn(Fn,i)){for(Vn(Fn,i,1);!be(d=Oe(Nn(Pn,i)));)try{await d()}catch(e){}Vn(Fn,i,0)}})(),S),S={load:v,startAutoLoad:async e=>{await C().load(e);try{c=s((async(e,t)=>{t||e?2!=h&&(h=1,m++,w(t??e),h=0):await v()}))}catch(e){}return S},stopAutoLoad:C,isAutoLoading:()=>!be(c),save:k,startAutoSave:async()=>(await T().save(),u=e.addDidFinishTransactionListener((()=>{const e=f();y(e)&&k(e)})),S),stopAutoSave:T,isAutoSaving:()=>!be(u),schedule:x,getStore:()=>e,destroy:()=>(Nn(Pn,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:g}),...o};return He(S)})(e,(async()=>{return e=n.getItem(t),JSON.parse(e,((e,t)=>""===t?void 0:t));var e}),(async e=>{return n.setItem(t,(s=e(),JSON.stringify(s,((e,t)=>void 0===t?"":t))));var s}),(e=>{const s=s=>{if(s.storageArea===n&&s.key===t)try{e(Ze(s.newValue))}catch{e()}};return ue.addEventListener(Dn,s),s}),(e=>ue.removeEventListener(Dn,e)),0,3,{getStorageName:()=>t});var t,n}),void 0,(async e=>{await e.load([{},{position:-1==s?1:s,open:!!t}]),await e.startAutoSave()})),Se(xe,null,Se("aside",{id:_e},Se(Ct,{s:n}),Se(mn,{s:n})),Se("style",null,vt))};export{_n as Inspector};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=e=>typeof e,t="",s=e(t),n=e(!0),a=e(0),o=e(e),r="type",l="default",i="Listener",c="Result",d="add",u="Has",g="Ids",h="Table",f=h+"s",b=h+g,w="Row",C=w+"Count",L=w+g,v="Sorted"+w+g,y="Cell",I=y+g,p="Value",T=p+"s",R=p+g,S=e=>t+e,M=(e,t)=>e.startsWith(t),V=(e,t)=>e.endsWith(t),m=Promise,D=globalThis,E=Math,H=E.max,k=E.min,A=E.floor,J=isFinite,x=e=>null==e,F=(e,t,s)=>x(e)?s?.():t(e),O=e=>e==s||e==n,Q=t=>e(t)==s,z=t=>e(t)==o,G=e=>Array.isArray(e),N=(e,t,s)=>e.slice(t,s),P=e=>e.length,W=()=>{},_=e=>{throw Error(e)},j=(e,t)=>e.includes(t),$=(e,t)=>e.every(t),B=(e,t)=>P(e)===P(t)&&$(e,((e,s)=>t[s]===e)),U=(e,t)=>$(e,((s,n)=>0==n||t(e[n-1],s)<=0)),q=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),X=(e,t)=>e.map(t),Y=e=>ee(e,((e,t)=>e+t),0),Z=e=>0==P(e),ee=(e,t,s)=>e.reduce(t,s),te=(e,t)=>e.splice(0,t),se=(e,...t)=>e.push(...t),ne=e=>e.pop(),ae=e=>e.shift(),oe=Object,re=e=>oe.getPrototypeOf(e),le=oe.entries,ie=oe.isFrozen,ce=e=>!x(e)&&F(re(e),(e=>e==oe.prototype||x(re(e))),(()=>!0)),de=oe.keys,ue=oe.freeze,ge=(e=[])=>oe.fromEntries(e),he=(e,t)=>t in e,fe=(e,t)=>(delete e[t],e),be=(e,t)=>K(le(e),(([e,s])=>t(s,e))),we=(e,t)=>X(le(e),(([e,s])=>t(s,e))),Ce=e=>ce(e)&&0==(e=>P(de(e)))(e),Le=(e,t,s)=>(he(e,t)||(e[t]=s()),e[t]),ve=(e,t,s,n=0)=>x(e)||!ce(e)||!n&&Ce(e)||ie(e)?(s?.(),!1):(we(e,((s,n)=>{t(s,n)||fe(e,n)})),!!n||!Ce(e)),ye=e=>t=>ee(Ve(t),((t,s)=>t+e(s)),0),Ie=e=>e?.size??0,pe=ye(Ie),Te=ye(pe),Re=ye(Te),Se=(e,t)=>e?.has(t)??!1,Me=e=>x(e)||0==Ie(e),Ve=e=>[...e?.values()??[]],me=e=>e.clear(),De=(e,t)=>e?.forEach(t),Ee=(e,t)=>e?.delete(t),He=e=>new Map(e),ke=e=>[...e?.keys()??[]],Ae=(e,t)=>e?.get(t),Je=(e,t)=>De(e,((e,s)=>t(s,e))),xe=(e,t,s)=>x(s)?(Ee(e,t),e):e?.set(t,s),Fe=(e,t,s,n)=>(Se(e,t)?n?.(Ae(e,t)):xe(e,t,s()),Ae(e,t)),Oe=(e,t,s,n=xe)=>(we(t,((t,n)=>s(e,n,t))),Je(e,(s=>he(t,s)?0:n(e,s))),e),Qe=(e,t,s,n)=>{const a={};return De(e,((e,o)=>{if(!s?.(e,o)){const s=t?t(e,o):e;!n?.(s)&&(a[o]=s)}})),a},ze=(e,t,s)=>Qe(e,(e=>Qe(e,t,s)),Me,Ce),Ge=(e,t,s)=>Qe(e,(e=>ze(e,t,s)),Me,Ce),Ne=(e,t)=>{const s=He();return De(e,((e,n)=>s.set(n,t?.(e)??e))),s},Pe=e=>Ne(e,Ne),We=e=>Ne(e,Pe),_e=(e,t,s,n,a=0)=>F((s?Fe:Ae)(e,t[a],a>P(t)-2?s:He),(o=>{if(a>P(t)-2)return n?.(o)&&xe(e,t[a]),o;const r=_e(o,t,s,n,a+1);return Me(o)&&xe(e,t[a]),r})),je=t=>{const s=e(t);return O(s)||s==a&&J(t)?s:void 0},$e=e=>x(e)||!x(je(e)),Be=(e,t,s,n,a)=>x(a)?e.delCell(t,s,n,!0):e.setCell(t,s,n,a),Ue=(e,t,s)=>x(s)?e.delValue(t):e.setValue(t,s),qe=e=>new Set(G(e)||x(e)?e:[e]),Ke=(e,t)=>e?.add(t),Xe=(e,t,s,n,a)=>{const o=e.hasRow,r=He(),l=He(),i=He(),c=He(),d=He(),u=He(),g=(t,s,...n)=>{const a=Fe(u,t,qe);return K(n,(t=>Ke(a,t)&&s&&e.callListener(t))),n},h=(t,...s)=>F(Ae(u,t),(n=>{K(Z(s)?Ve(n):s,(t=>{e.delListener(t),Ee(n,t)})),Me(n)&&xe(u,t)})),f=(e,s)=>{xe(r,e,s),Se(l,e)||(xe(l,e,t()),xe(c,e,He()),xe(d,e,He()),a(i))},b=e=>{xe(r,e),xe(l,e),xe(c,e),xe(d,e),h(e),a(i)};return[()=>e,()=>ke(r),e=>Je(l,e),e=>Se(l,e),e=>Ae(r,e),e=>Ae(l,e),(e,t)=>xe(l,e,t),f,(t,n,a,r,l)=>{f(t,n);const i=He(),u=He(),b=Ae(c,t),w=Ae(d,t),C=t=>{const a=s=>e.getCell(n,t,s),c=Ae(b,t),d=o(n,t)?s(r(a,t)):void 0;if(c===d||G(c)&&G(d)&&B(c,d)||xe(i,t,[c,d]),!x(l)){const e=Ae(w,t),s=o(n,t)?l(a,t):void 0;e!=s&&xe(u,t,s)}},L=e=>{a((()=>{De(i,(([,e],t)=>xe(b,t,e))),De(u,((e,t)=>xe(w,t,e)))}),i,u,b,w,e),me(i),me(u)};Je(b,C),e.hasTable(n)&&K(e.getRowIds(n),(e=>{Se(b,e)||C(e)})),L(!0),h(t),g(t,0,e.addRowListener(n,null,((e,t,s)=>C(s))),e.addTableListener(n,(()=>L())))},b,e=>n(e,i),()=>Je(u,b),g,h]},Ye=(e,s)=>Q(e)?t=>t(e):e??(()=>s??t),Ze=(e,t)=>{const s=new WeakMap;return n=>{s.has(n)||s.set(n,e(n));const a=s.get(n);return t?.(a),a}},et=/^\d+$/,tt=()=>{const e=[];let s=0;return[n=>(n?ae(e):null)??t+s++,t=>{et.test(t)&&P(e)<1e3&&se(e,t)}]},st=e=>{let s;const[n,a]=tt(),o=He();return[(a,r,l,i=[],c=(()=>[]))=>{s??=e();const d=n(1);return xe(o,d,[a,r,l,i,c]),Ke(_e(r,l??[t],qe),d),d},(e,n,...a)=>K(((e,s=[t])=>{const n=[],a=(e,t)=>t==P(s)?se(n,e):null===s[t]?De(e,(e=>a(e,t+1))):K([s[t],null],(s=>a(Ae(e,s),t+1)));return a(e,0),n})(e,n),(e=>De(e,(e=>Ae(o,e)[0](s,...n??[],...a))))),e=>F(Ae(o,e),(([,s,n])=>(_e(s,n??[t],void 0,(t=>(Ee(t,e),Me(t)?1:0))),xe(o,e),a(e),n))),e=>F(Ae(o,e),(([e,,t=[],n,a])=>{const o=(...r)=>{const l=P(r);l==P(t)?e(s,...r,...a(r)):x(t[l])?K(n[l]?.(...r)??[],(e=>o(...r,e))):o(...r,t[l])};o()}))]},nt=Ze((e=>{let s,n,a,o=100,r=He(),l=He(),i=1;const c=He(),d=He(),[u,g,h]=st((()=>A)),f=He(),b=He(),w=[],C=[],L=(t,s)=>{i=0,e.transaction((()=>{const[n,a]=Ae(f,s);De(n,((s,n)=>De(s,((s,a)=>De(s,((s,o)=>Be(e,n,a,o,s[t]))))))),De(a,((s,n)=>Ue(e,n,s[t])))})),i=1},v=e=>{xe(f,e),xe(b,e),g(d,[e])},y=(e,t)=>K(te(e,t??P(e)),v),I=()=>y(w,P(w)-o),p=()=>F(s,(()=>{se(w,s),I(),y(C),s=void 0,a=1})),T=()=>{s=ne(w),a=1};let R,S;const M=(e=t)=>(x(s)&&(s=t+n++,xe(f,s,[r,l]),H(s,e),r=He(),l=He(),a=1),s),V=()=>{Z(w)||(((e,...t)=>{e.unshift(...t)})(C,M()),L(0,s),s=ne(w),a=1)},m=()=>{Z(C)||(se(w,s),s=ae(C),L(1,s),a=1)},D=()=>{a&&(g(c),a=0)},E=e=>{const t=M(e);return D(),t},H=(e,t)=>(k(e)&&Ae(b,e)!==t&&(xe(b,e,t),g(d,[e])),A),k=e=>Se(f,e),A={setSize:e=>(o=e,I(),A),addCheckpoint:E,setCheckpoint:H,getStore:()=>e,getCheckpointIds:()=>[[...w],s,[...C]],forEachCheckpoint:e=>Je(b,e),hasCheckpoint:k,getCheckpoint:e=>Ae(b,e),goBackward:()=>(V(),D(),A),goForward:()=>(m(),D(),A),goTo:e=>{const t=j(w,e)?V:j(C,e)?m:null;for(;!x(t)&&e!=s;)t();return D(),A},addCheckpointIdsListener:e=>u(e,c),addCheckpointListener:(e,t)=>u(t,d,[e]),delListener:e=>(h(e),A),clear:()=>(y(w),y(C),x(s)||v(s),s=void 0,n=0,E(),A),clearForward:()=>(Z(C)||(y(C),g(c)),A),destroy:()=>{e.delListener(R),e.delListener(S)},getListenerStats:()=>({checkpointIds:pe(c),checkpoint:pe(d)}),_registerListeners:()=>{R=e.addCellListener(null,null,null,((e,t,s,n,a,o)=>{if(i){p();const e=Fe(r,t,He),l=Fe(e,s,He),i=Fe(l,n,(()=>[o,void 0]));i[1]=a,i[0]===a&&Me(xe(l,n))&&Me(xe(e,s))&&Me(xe(r,t))&&T(),D()}})),S=e.addValueListener(null,((e,t,s,n)=>{if(i){p();const e=Fe(l,t,(()=>[n,void 0]));e[1]=s,e[0]===s&&Me(xe(l,t))&&T(),D()}}))}};return ue(A.clear())}),(e=>e._registerListeners())),at="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(t),ot=He(X(at,((e,t)=>[e,t]))),rt=e=>at[63&e],lt=(e,t)=>Ae(ot,e[t])??0,it=D.crypto?e=>D.crypto.getRandomValues(e):e=>X(e,(()=>A(256*E.random()))),ct=(e,t)=>(e??0)<(t??0)?-1:1,dt=(e=16)=>ee(it(new Uint8Array(e)),((e,t)=>e+rt(t)),""),ut=Ze((e=>{const s=He(),n=He(),[a,o,r]=st((()=>v)),[l,i,c,d,u,g,h,,f,b,w,C]=Xe(e,He,(e=>x(e)?t:G(e)?X(e,S):S(e)),a,o),L=(t,s,n)=>{const a=u(t);De(n,((t,n)=>s(n,(s=>De(t,(t=>s(t,(s=>e.forEachCell(a,t,s)))))))))},v={setIndexDefinition:(e,t,a,r,l,i=ct)=>{const c=x(l)?void 0:([e],[t])=>l(e,t);return f(e,t,((t,a,l,d,u,f)=>{let b=0;const w=qe(),C=qe(),L=g(e);if(De(a,(([e,t],s)=>{const n=qe(e),a=qe(t);De(n,(e=>Ee(a,e)?Ee(n,e):0)),De(n,(e=>{Ke(w,e),F(Ae(L,e),(t=>{Ee(t,s),Me(t)&&(xe(L,e),b=1)}))})),De(a,(e=>{Ke(w,e),Se(L,e)||(xe(L,e,qe()),b=1),Ke(Ae(L,e),s),x(r)||Ke(C,e)}))})),t(),Me(u)||(f?Je(L,(e=>Ke(C,e))):Je(l,(e=>F(Ae(d,e),(e=>Ke(C,e))))),De(C,(e=>{const t=(t,s)=>i(Ae(u,t),Ae(u,s),e),s=[...Ae(L,e)];U(s,t)||(xe(L,e,qe(q(s,t))),Ke(w,e))}))),(b||f)&&!x(c)){const t=[...L];U(t,c)||(h(e,He(q(t,c))),b=1)}b&&o(s,[e]),De(w,(t=>o(n,[e,t])))}),Ye(a),F(r,Ye)),v},delIndexDefinition:e=>(b(e),v),getStore:l,getIndexIds:i,forEachIndex:e=>c(((t,s)=>e(t,(e=>L(t,e,s))))),forEachSlice:(e,t)=>L(e,t,g(e)),hasIndex:d,hasSlice:(e,t)=>Se(g(e),t),getTableId:u,getSliceIds:e=>ke(g(e)),getSliceRowIds:(e,t)=>Ve(Ae(g(e),t)),addIndexIdsListener:w,addSliceIdsListener:(e,t)=>a(t,s,[e]),addSliceRowIdsListener:(e,t,s)=>a(s,n,[e,t]),delListener:e=>(r(e),v),destroy:C,getListenerStats:()=>({sliceIds:pe(s),sliceRowIds:Te(n)})};return ue(v)})),gt=He([["avg",[(e,t)=>Y(e)/t,(e,t,s)=>e+(t-e)/(s+1),(e,t,s)=>e+(e-t)/(s-1),(e,t,s,n)=>e+(t-s)/n]],["max",[e=>H(...e),(e,t)=>H(t,e),(e,t)=>t==e?void 0:e,(e,t,s)=>s==e?void 0:H(t,e)]],["min",[e=>k(...e),(e,t)=>k(t,e),(e,t)=>t==e?void 0:e,(e,t,s)=>s==e?void 0:k(t,e)]],["sum",[e=>Y(e),(e,t)=>e+t,(e,t)=>e-t,(e,t,s)=>e-s+t]]]),ht=(e,t,s,n,a,o=!1)=>{if(Me(s))return;const[r,l,i,c]=a;return o||=x(e),De(n,(([s,n])=>{o||(e=x(s)?l?.(e,n,t++):x(n)?i?.(e,s,t--):c?.(e,n,s,t),o||=x(e))})),o?r(Ve(s),Ie(s)):e},ft=Ze((e=>{const s=He(),[n,a,o]=st((()=>C)),[r,l,i,c,d,u,g,,h,f,b,w]=Xe(e,W,(e=>isNaN(e)||x(e)||!0===e||!1===e||e===t?void 0:1*e),n,a),C={setMetricDefinition:(e,t,n,o,r,l,i)=>{const c=z(n)?[n,r,l,i]:Ae(gt,n)??Ae(gt,"sum");return h(e,t,((t,n,o,r,l,i)=>{const d=u(e),h=Ie(r);i||=x(d),t();let f=ht(d,h,r,n,c,i);J(f)||(f=void 0),f!=d&&(g(e,f),a(s,[e],f,d))}),Ye(o,1)),C},delMetricDefinition:e=>(f(e),C),getStore:r,getMetricIds:l,forEachMetric:i,hasMetric:c,getTableId:d,getMetric:u,addMetricIdsListener:b,addMetricListener:(e,t)=>n(t,s,[e]),delListener:e=>(o(e),C),destroy:w,getListenerStats:()=>({metric:pe(s)})};return ue(C)})),bt={StoreOnly:1,MergeableStoreOnly:2,StoreOrMergeableStore:3},wt=He(),Ct=He(),Lt=(e,t,s,n,a,o,r,l={},i=[])=>{let c,d,u,g=0,h=0,f=0;Fe(wt,i,(()=>0)),Fe(Ct,i,(()=>[]));const[b,w,C,L,v]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!Ce(e)||!Ce(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!Ce(e)||!Ce(t),t.setContent]:_("Store type not supported by this Persister"))(r,e),y=t=>{(b&&G(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},I=async e=>(2!=g&&(g=1,h++,await S((async()=>{try{const e=await t();G(e)?y(e):_("Content is not an array "+e)}catch(t){o?.(t),e&&v(e)}g=0}))),M),p=()=>(d&&(a(d),d=void 0),M),T=async e=>(1!=g&&(g=2,f++,await S((async()=>{try{await s(w,e)}catch(e){o?.(e)}g=0}))),M),R=()=>(F(u,e.delListener),u=void 0,M),S=async(...e)=>(se(Ae(Ct,i),...e),await(async()=>{if(!Ae(wt,i)){for(xe(wt,i,1);!x(c=ae(Ae(Ct,i)));)try{await c()}catch(e){o?.(e)}xe(wt,i,0)}})(),M),M={load:I,startAutoLoad:async e=>{await p().load(e);try{d=n((async(e,t)=>{t||e?2!=g&&(g=1,h++,y(t??e),g=0):await I()}))}catch(e){o?.(e)}return M},stopAutoLoad:p,isAutoLoading:()=>!x(d),save:T,startAutoSave:async()=>(await R().save(),u=e.addDidFinishTransactionListener((()=>{const e=C();L(e)&&T(e)})),M),stopAutoSave:R,isAutoSaving:()=>!x(u),schedule:S,getStore:()=>e,destroy:()=>(te(Ae(Ct,i)),p().stopAutoSave()),getStats:()=>({loads:h,saves:f}),...l};return ue(M)},vt=new D.TextEncoder,yt=e=>{let t=2166136261;return K(vt.encode(e),(e=>{t^=e,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)})),t>>>0},It=([e,t,s])=>[e,t,s],pt=([e,t])=>Tt(e,t),Tt=(e,t)=>t?[e,t]:[e],Rt=e=>e[2],St=(e,t)=>yt(e+":"+t),Mt=(e,t)=>t>e?(e?yt(e):0)^yt(t):0,Vt=(e,t)=>((e??"")>(t??"")?e:t)??"",mt=(e,t,s)=>{e[2]=t>>>0,s>e[1]&&(e[1]=s)},Dt=(e=t)=>Tt(ge(),e),Et=(e=t)=>[He(),e,0],Ht=([e,t,s],n=It)=>[Qe(e,n),t,s],kt=([e,t],s=pt)=>Tt(Qe(e,s),t),At=(t,s)=>G(t)&&3==P(t)&&Q(t[1])&&e(t[2])==a&&J(t[2])&&s(t[0]),Jt={Response:0,GetContentHashes:1,ContentHashes:2,ContentDiff:3,GetTableDiff:4,GetRowDiff:5,GetCellDiff:6,GetValueDiff:7},xt=(e,s,n,a,o,r,l,i,c={})=>{let d,u=0,g=0;const h=He(),f=(e,t,n,a)=>{u++,r?.(e,t,n,a),s(e,t,n,a)},b=async(e,s,n=t)=>new m(((t,a)=>{const r=dt(),l=setTimeout((()=>{Ee(h,r),a(`No response from ${e??"anyone"} to ${r}, `+s)}),1e3*o);xe(h,r,[e,(e,s)=>{clearTimeout(l),Ee(h,r),t([e,s])}]),f(e,r,s,n)})),w=(e,[t,s])=>{be(t,(([t,s],n)=>{const a=Le(e[0],n,Dt);be(t,(([e,t],s)=>{const n=Le(a[0],s,Dt);be(e,(([e,t],s)=>n[0][s]=Tt(e,t))),n[1]=Vt(n[1],t)})),a[1]=Vt(a[1],s)})),e[1]=Vt(e[1],s)},C=async(t=null,s)=>{x(s)&&([s,t]=await b(t,1));const[n,a]=s,[o,r]=e.getMergeableContentHashes();let l=Dt();if(o!=n){const[s,n]=(await b(t,4,e.getMergeableTableHashes()))[0];if(l=s,!Ce(n)){const[s,a]=(await b(t,5,e.getMergeableRowHashes(n)))[0];if(w(l,s),!Ce(a)){const s=(await b(t,6,e.getMergeableCellHashes(a)))[0];w(l,s)}}}return[l,r==a?Dt():(await b(t,7,e.getMergeableValueHashes()))[0],1]},L=Lt(e,(async()=>{const e=await C();return Ce(e[0][0])&&Ce(e[1][0])?void 0:e}),(async(t,s)=>s?f(null,null,3,s):f(null,null,2,e.getMergeableContentHashes())),(e=>d=e),(()=>d=void 0),i,2,{startSync:async e=>await(await L.startAutoLoad(e)).startAutoSave(),stopSync:()=>L.stopAutoLoad().stopAutoSave(),destroy:()=>(a(),L.stopSync()),getSynchronizerStats:()=>({sends:u,receives:g}),...c});return n(((t,s,n,a)=>{g++,l?.(t,s,n,a),0==n?F(Ae(h,s),(([e,s])=>x(e)||e==t?s(a,t):0)):2==n&&L.isAutoLoading()?C(t,a).then((e=>{d?.(void 0,e)})):3==n&&L.isAutoLoading()?d?.(void 0,a):F(1==n&&L.isAutoSaving()?e.getMergeableContentHashes():4==n?e.getMergeableTableDiff(a):5==n?e.getMergeableRowDiff(a):6==n?e.getMergeableCellDiff(a):7==n?e.getMergeableValueDiff(a):void 0,(e=>{f(t,s,0,e)}))})),L},Ft=Ze((e=>{const s=e.createStore,n=s(),a=s(),o=He(),{addListener:r,callListeners:l,delListener:u}=a,[g,f,b,p,T,,,R,,S,M,V,m,D]=Xe(e,(()=>!0),W,r,l),E=(e,t,...s)=>K(s,(s=>Ke(Fe(Fe(o,t,He),e,qe),s))),H=e=>{F(Ae(o,e),(e=>{Je(e,((e,t)=>De(t,(t=>e.delListener(t))))),me(e)})),K([a,n],(t=>t.delTable(e)))},k=(e,t,s)=>E(t,e,t.addStartTransactionListener(s.startTransaction),t.addDidFinishTransactionListener((()=>s.finishTransaction()))),A={setQueryDefinition:(s,o,r)=>{R(s,o),H(s);const l=[],i=[[null,[o,null,null,[],He()]]],c=[],d=[],u=[];r({select:(e,s)=>{const n=z(e)?[P(l)+t,e]:[x(s)?e:s,t=>t(e,s)];return se(l,n),{as:e=>n[0]=e}},join:(e,t,s)=>{const n=x(s)||z(t)?null:t,a=x(n)?t:s,o=[e,[e,n,z(a)?a:e=>e(a),[],He()]];return se(i,o),{as:e=>o[0]=e}},where:(e,t,s)=>se(c,z(e)?e:x(s)?s=>s(e)===t:n=>n(e,t)===s),group:(e,t,s,n,a)=>{const o=[e,[e,z(t)?[t,s,n,a]:Ae(gt,t)??[(e,t)=>t]]];return se(d,o),{as:e=>o[0]=e}},having:(e,t)=>se(u,z(e)?e:s=>s(e)===t)});const g=He(l);if(Me(g))return A;const h=He(i);Je(h,((e,[,t])=>F(Ae(h,t),(({3:t})=>x(e)?0:se(t,e)))));const f=He(d);let b=n;if(Me(f)&&Z(u))b=a;else{k(s,b,a);const e=He();Je(f,((t,[s,n])=>Ke(Fe(e,s,qe),[t,n])));const t=qe();Je(g,(s=>Se(e,s)?0:Ke(t,s)));const n=He(),o=(t,n,o,r)=>F(t,(([l,i,c,d])=>{Je(n,((t,[s])=>{const n=Fe(l,t,He),a=Ae(n,o),i=r?void 0:s;if(a!==i){const s=qe([[a,i]]),r=Ie(n);xe(n,o,i),De(Ae(e,t),(([e,t])=>{const a=ht(d[e],r,n,s,t);d[e]=x(je(a))?null:a}))}})),Me(i)||!$(u,(e=>e((e=>d[e]))))?a.delRow(s,c):x(c)?t[2]=a.addRow(s,d):a.setRow(s,c,d)}));E(b,s,b.addRowListener(s,null,((a,r,l,i)=>{const c=[],d=[],u=He(),g=b.hasRow(s,l);let h=!g;De(t,(e=>{const[t,n,a]=i(s,l,e);se(c,n),se(d,a),h||=t})),Je(e,(e=>{const[t,,n]=i(s,l,e);(h||t)&&xe(u,e,[n])})),h&&o(_e(n,c,void 0,(([,e])=>(Ee(e,l),Me(e)))),u,l,1),g&&o(_e(n,d,(()=>{const e={};return De(t,(t=>e[t]=b.getCell(s,l,t))),[He(),qe(),void 0,e]}),(([,e])=>{Ke(e,l)})),u,l)})))}k(s,e,b);const w=(t,n,a,r)=>{const l=t=>e.getCell(n,a,t);K(r,(n=>{const[a,,o,r,i]=Ae(h,n),c=o?.(l,t),[d,u]=Ae(i,t)??[];c!=d&&(x(u)||D(s,u),xe(i,t,x(c)?null:[c,...m(s,1,e.addRowListener(a,c,(()=>w(t,a,c,r))))]))})),(t=>{const n=(s,n)=>e.getCell(...x(n)?[o,t,s]:s===o?[o,t,n]:[Ae(h,s)?.[0],Ae(Ae(h,s)?.[4],t)?.[0],n]);b.transaction((()=>$(c,(e=>e(n)))?Je(g,((e,a)=>Be(b,s,t,e,a(n,t)))):b.delRow(s,t)))})(t)},{3:C}=Ae(h,null);return b.transaction((()=>m(s,1,e.addRowListener(o,null,((t,n,a)=>{e.hasRow(o,a)?w(a,o,a,C):(b.delRow(s,a),De(h,(({4:e})=>F(Ae(e,a),(([,t])=>{D(s,t),xe(e,a)})))))}))))),A},delQueryDefinition:e=>(H(e),S(e),A),getStore:g,getQueryIds:f,forEachQuery:b,hasQuery:p,getTableId:T,addQueryIdsListener:e=>M((()=>e(A))),delListener:e=>(u(e),A),destroy:V,getListenerStats:()=>{const{tables:e,tableIds:t,transaction:s,...n}=a.getListenerStats();return n}};return we({[h]:[1,1],[h+I]:[0,1],[C]:[0,1],[L]:[0,1],[v]:[0,5],[w]:[1,2],[I]:[0,2],[y]:[1,3]},(([e,t],s)=>{K(e?["get","has","forEach"]:["get"],(e=>A[e+c+s]=(...t)=>a[e+s](...t))),A[d+c+s+i]=(...e)=>a[d+s+i](...N(e,0,t),((s,...n)=>e[t](A,...n)),!0)})),ue(A)})),Ot=Ze((e=>{const s=He(),n=He(),a=He(),o=He(),[r,l,i]=st((()=>p)),[c,d,u,g,h,f,,,b,w,C,L]=Xe(e,(()=>[He(),He(),He(),He()]),(e=>x(e)?void 0:e+t),r,l),v=(e,t,s)=>F(f(e),(([n,,a])=>{if(!Se(a,t)){const o=qe();if(h(e)!=I(e))Ke(o,t);else{let e=t;for(;!x(e)&&!Se(o,e);)Ke(o,e),e=Ae(n,e)}if(s)return o;xe(a,t,o)}return Ae(a,t)})),y=(e,t)=>F(f(e),(([,,e])=>xe(e,t))),I=e=>Ae(s,e),p={setRelationshipDefinition:(e,t,r,i)=>(xe(s,e,r),b(e,t,((t,s)=>{const r=qe(),i=qe(),c=qe(),[d,u]=f(e);De(s,(([t,s],n)=>{x(t)||(Ke(i,t),F(Ae(u,t),(e=>{Ee(e,n),Me(e)&&xe(u,t)}))),x(s)||(Ke(i,s),Se(u,s)||xe(u,s,qe()),Ke(Ae(u,s),n)),Ke(r,n),xe(d,n,s),Je(Ae(o,e),(t=>{Se(v(e,t),n)&&Ke(c,t)}))})),t(),De(r,(t=>l(n,[e,t]))),De(i,(t=>l(a,[e,t]))),De(c,(t=>{y(e,t),l(o,[e,t])}))}),Ye(i)),p),delRelationshipDefinition:e=>(xe(s,e),w(e),p),getStore:c,getRelationshipIds:d,forEachRelationship:t=>u((s=>t(s,(t=>e.forEachRow(h(s),t))))),hasRelationship:g,getLocalTableId:h,getRemoteTableId:I,getRemoteRowId:(e,t)=>Ae(f(e)?.[0],t),getLocalRowIds:(e,t)=>Ve(Ae(f(e)?.[1],t)),getLinkedRowIds:(e,t)=>x(f(e))?[t]:Ve(v(e,t,!0)),addRelationshipIdsListener:C,addRemoteRowIdListener:(e,t,s)=>r(s,n,[e,t]),addLocalRowIdsListener:(e,t,s)=>r(s,a,[e,t]),addLinkedRowIdsListener:(e,t,s)=>(v(e,t),r(s,o,[e,t])),delListener:e=>(y(...i(e)??[]),p),destroy:L,getListenerStats:()=>({remoteRowId:Te(n),localRowIds:Te(a),linkedRowIds:Te(o)})};return ue(p)})),Qt=e=>[e,e],zt=(e,t=pe)=>t(e[0])+t(e[1]),Gt=()=>[He(),He()],Nt=e=>[...e],Pt=([e,t])=>e===t,Wt=e=>JSON.stringify(e,((e,t)=>t instanceof Map?oe.fromEntries([...t]):t)),_t=JSON.parse,jt=(e,t,s)=>xe(e,t,Ae(e,t)==-s?void 0:s),$t=()=>{let e,t,s=!1,n=!1,o=0,c=[];const g=He(),v=He(),M=He(),V=He(),m=He(),D=He(),E=He(),H=He(),k=He(),A=He(),J=He(),Q=He(),P=He(),W=He(),_=qe(),$=He(),U=He(),Y=He(),Z=He(),ee=Gt(),te=Gt(),ne=Gt(),ae=Gt(),oe=Gt(),re=Gt(),le=Gt(),ie=Gt(),ce=Gt(),de=Gt(),ge=Gt(),be=Gt(),Le=Gt(),ye=Gt(),Ve=Gt(),_e=Gt(),$e=Gt(),Xe=Gt(),Ye=Gt(),Ze=Gt(),et=Gt(),nt=Gt(),at=He(),ot=Gt(),[rt,lt,it,dt]=st((()=>Gs)),ut=e=>{if(!ve(e,((e,t)=>j([r,l],t))))return!1;const t=e[r];return!(!O(t)&&t!=a||(je(e[l])!=t&&fe(e,l),0))},gt=G,ht=(t,s)=>(!e||Se(J,s)||Yt(s))&&ve(t,((e,t)=>ft(s,t,e)),(()=>Yt(s))),ft=(e,t,s,n)=>ve(n?s:Lt(s,e,t),((n,a)=>F(bt(e,t,a,n),(e=>(s[a]=e,!0)),(()=>!1))),(()=>Yt(e,t))),bt=(t,s,n,a)=>e?F(Ae(Ae(J,t),n),(e=>je(a)!=e[r]?Yt(t,s,n,a,e[l]):a),(()=>Yt(t,s,n,a))):x(je(a))?Yt(t,s,n,a):a,wt=(e,t)=>ve(t?e:vt(e),((t,s)=>F(Ct(s,t),(t=>(e[s]=t,!0)),(()=>!1))),(()=>Zt())),Ct=(e,s)=>t?F(Ae(P,e),(t=>je(s)!=t[r]?Zt(e,s,t[l]):s),(()=>Zt(e,s))):x(je(s))?Zt(e,s):s,Lt=(e,t,s)=>(F(Ae(Q,t),(([n,a])=>{De(n,((t,s)=>{he(e,s)||(e[s]=t)})),De(a,(n=>{he(e,n)||Yt(t,s,n)}))})),e),vt=e=>(t&&(De(W,((t,s)=>{he(e,s)||(e[s]=t)})),De(_,(t=>{he(e,t)||Zt(t)}))),e),yt=e=>Oe(J,e,((e,t,s)=>{const n=He(),a=qe();Oe(Fe(J,t,He),s,((e,t,s)=>{xe(e,t,s),F(s[l],(e=>xe(n,t,e)),(()=>Ke(a,t)))})),xe(Q,t,[n,a])}),((e,t)=>{xe(J,t),xe(Q,t)})),It=e=>Oe(P,e,((e,t,s)=>{xe(P,t,s),F(s[l],(e=>xe(W,t,e)),(()=>Ke(_,t)))}),((e,t)=>{xe(P,t),xe(W,t),Ee(_,t)})),pt=e=>Ce(e)?Hs():Ms(e),Tt=e=>Oe(Y,e,((e,t,s)=>Rt(t,s)),((e,t)=>At(t))),Rt=(e,t)=>Oe(Fe(Y,e,(()=>(Ot(e,1),xe($,e,tt()),xe(U,e,He()),He()))),t,((t,s,n)=>St(e,t,s,n)),((t,s)=>Jt(e,t,s))),St=(e,t,s,n,a)=>Oe(Fe(t,s,(()=>(Bt(e,s,1),He()))),n,((t,n,a)=>Mt(e,s,t,n,a)),((n,o)=>xt(e,t,s,n,o,a))),Mt=(e,t,s,n,a)=>{Se(s,n)||Ut(e,t,n,1);const o=Ae(s,n);a!==o&&(qt(e,t,n,o,a),xe(s,n,a))},Vt=(e,t,s,n,a)=>F(Ae(t,s),(t=>Mt(e,s,t,n,a)),(()=>St(e,t,s,Lt({[n]:a},e,s)))),mt=e=>Ce(e)?Js():Vs(e),Dt=e=>Oe(Z,e,((e,t,s)=>Et(t,s)),((e,t)=>Ft(t))),Et=(e,t)=>{Se(Z,e)||Kt(e,1);const s=Ae(Z,e);t!==s&&(Xt(e,s,t),xe(Z,e,t))},Ht=(e,t)=>{const[s]=Ae($,e),n=s(t);return Se(Ae(Y,e),n)?Ht(e,t):n},kt=e=>Ae(Y,e)??Rt(e,{}),At=e=>Rt(e,{}),Jt=(e,t,s)=>{const[,n]=Ae($,e);n(s),St(e,t,s,{},!0)},xt=(e,t,s,n,a,o)=>{const r=Ae(Ae(Q,e)?.[0],a);if(!x(r)&&!o)return Mt(e,s,n,a,r);const l=t=>{qt(e,s,t,Ae(n,t)),Ut(e,s,t,-1),xe(n,t)};x(r)?l(a):Je(n,l),Me(n)&&(Bt(e,s,-1),Me(xe(t,s))&&(Ot(e,-1),xe(Y,e),xe($,e),xe(U,e)))},Ft=e=>{const t=Ae(W,e);if(!x(t))return Et(e,t);Xt(e,Ae(Z,e)),Kt(e,-1),xe(Z,e)},Ot=(e,t)=>jt(g,e,t),Bt=(e,t,s)=>jt(Fe(V,e,He),t,s)&&xe(M,e,Fe(M,e,(()=>0))+s),Ut=(e,t,s,n)=>{const a=Ae(U,e),o=Ae(a,s)??0;(0==o&&1==n||1==o&&-1==n)&&jt(Fe(v,e,He),s,n),xe(a,s,o!=-n?o+n:null),jt(Fe(Fe(m,e,He),t,He),s,n)},qt=(e,t,s,n,a)=>{Fe(Fe(Fe(D,e,He),t,He),s,(()=>[n,0]))[1]=a,c[3]?.(e,t,s,a)},Kt=(e,t)=>jt(E,e,t),Xt=(e,t,s)=>{Fe(H,e,(()=>[t,0]))[1]=s,c[4]?.(e,s)},Yt=(e,t,s,n,a)=>(se(Fe(Fe(Fe(k,e,He),t,He),s,(()=>[])),n),a),Zt=(e,t,s)=>(se(Fe(A,e,(()=>[])),t),s),es=(e,t,s)=>F(Ae(Ae(Ae(D,e),t),s),(([e,t])=>[!0,e,t]),(()=>[!1,...Qt(bs(e,t,s))])),ts=e=>F(Ae(H,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Qt(Ls(e))])),ss=e=>Me(k)||Me(_e[e])?0:De(e?We(k):k,((t,s)=>De(t,((t,n)=>De(t,((t,a)=>lt(_e[e],[s,n,a],t))))))),ns=e=>Me(A)||Me($e[e])?0:De(e?Ne(A):A,((t,s)=>lt($e[e],[s],t))),as=(e,t,s,n)=>{if(!Me(e))return lt(t,n,(()=>Qe(e))),Je(e,((e,t)=>lt(s,[...n??[],e],1==t))),1},os=e=>{const t=vs();t!=s&<(ee[e],void 0,t);const n=Me(de[e]),a=Me(Le[e])&&Me(ye[e])&&Me(ce[e])&&Me(ge[e])&&Me(re[e])&&Me(le[e])&&Me(ie[e])&&n&&Me(ne[e])&&Me(ae[e]),o=Me(Ve[e])&&Me(be[e])&&Me(oe[e])&&Me(te[e]);if(!a||!o){const t=e?[Ne(g),Pe(v),Ne(M),Pe(V),We(m),We(D)]:[g,v,M,V,m,D];if(!a){as(t[0],ne[e],ae[e]),De(t[1],((t,s)=>as(t,re[e],le[e],[s]))),De(t[2],((t,s)=>{0!=t&<(ie[e],[s],us(s))}));const s=qe();De(t[3],((t,a)=>{as(t,ce[e],ge[e],[a])&&!n&&(lt(de[e],[a,null]),Ke(s,a))})),n||De(t[5],((t,n)=>{if(!Se(s,n)){const s=qe();De(t,(e=>De(e,(([t,n],a)=>n!==t?Ke(s,a):Ee(e,a))))),De(s,(t=>lt(de[e],[n,t])))}})),De(t[4],((t,s)=>De(t,((t,n)=>as(t,Le[e],ye[e],[s,n])))))}if(!o){let s;De(t[5],((t,n)=>{let a;De(t,((t,o)=>{let r;De(t,(([t,l],i)=>{l!==t&&(lt(Ve[e],[n,o,i],l,t,es),s=a=r=1)})),r&<(be[e],[n,o],es)})),a&<(oe[e],[n],es)})),s&<(te[e],void 0,es)}}},rs=e=>{const t=Rs();t!=n&<(Xe[e],void 0,t);const s=Me(Ze[e])&&Me(et[e]),a=Me(nt[e])&&Me(Ye[e]);if(!s||!a){const t=e?[Ne(E),Ne(H)]:[E,H];if(s||as(t[0],Ze[e],et[e]),!a){let s;De(t[1],(([t,n],a)=>{n!==t&&(lt(nt[e],[a],n,t,ts),s=1)})),s&<(Ye[e],void 0,ts)}}},ls=(e,...t)=>(Os((()=>e(...X(t,S)))),Gs),is=()=>Ge(Y),cs=()=>ke(Y),ds=e=>ke(Ae(U,S(e))),us=e=>Ie(Ae(Y,S(e))),gs=e=>ke(Ae(Y,S(e))),hs=(e,t,s,n=0,a)=>{return X(N(q((o=Ae(Y,S(e)),r=(e,s)=>[x(t)?s:Ae(e,S(t)),s],X([...o?.entries()??[]],(([e,t])=>r(t,e)))),(([e],[t])=>ct(e,t)*(s?-1:1))),n,x(a)?a:n+a),(([,e])=>e));var o,r},fs=(e,t)=>ke(Ae(Ae(Y,S(e)),S(t))),bs=(e,t,s)=>Ae(Ae(Ae(Y,S(e)),S(t)),S(s)),ws=()=>Qe(Z),Cs=()=>ke(Z),Ls=e=>Ae(Z,S(e)),vs=()=>!Me(Y),ys=e=>Se(Y,S(e)),Is=(e,t)=>Se(Ae(U,S(e)),S(t)),ps=(e,t)=>Se(Ae(Y,S(e)),S(t)),Ts=(e,t,s)=>Se(Ae(Ae(Y,S(e)),S(t)),S(s)),Rs=()=>!Me(Z),Ss=e=>Se(Z,S(e)),Ms=e=>ls((()=>(e=>ve(e,ht,Yt))(e)?Tt(e):0)),Vs=e=>ls((()=>wt(e)?Dt(e):0)),ms=e=>{try{pt(_t(e))}catch{}return Gs},Ds=t=>ls((()=>{if((e=ve(t,(e=>ve(e,ut))))&&(yt(t),!Me(Y))){const e=is();Hs(),Ms(e)}})),Es=e=>ls((()=>{if(t=(e=>ve(e,ut))(e)){const s=ws();Fs(),Js(),t=!0,It(e),Vs(s)}})),Hs=()=>ls((()=>Tt({}))),ks=e=>ls((e=>Se(Y,e)?At(e):0),e),As=(e,t)=>ls(((e,t)=>F(Ae(Y,e),(s=>Se(s,t)?Jt(e,s,t):0))),e,t),Js=()=>ls((()=>Dt({}))),xs=()=>ls((()=>{yt({}),e=!1})),Fs=()=>ls((()=>{It({}),t=!1})),Os=(e,t)=>{if(-1!=o){Qs();const s=e();return zs(t),s}},Qs=()=>(-1!=o&&o++,1==o&&(c[0]?.(),lt(at)),Gs),zs=e=>(o>0&&(o--,0==o&&(o=1,ss(1),Me(D)||os(1),ns(1),Me(H)||rs(1),e?.(Gs)&&(De(D,((e,t)=>De(e,((e,s)=>De(e,(([e],n)=>Be(Gs,t,s,n,e))))))),me(D),De(H,(([e],t)=>Ue(Gs,t,e))),me(H)),lt(ot[0],void 0),o=-1,ss(0),Me(D)||os(0),ns(0),Me(H)||rs(0),c[1]?.(),lt(ot[1],void 0),c[2]?.(),o=0,s=vs(),n=Rs(),K([g,v,M,V,m,D,k,E,H,A],me))),Gs),Gs={getContent:()=>[is(),ws()],getTables:is,getTableIds:cs,getTable:e=>ze(Ae(Y,S(e))),getTableCellIds:ds,getRowCount:us,getRowIds:gs,getSortedRowIds:hs,getRow:(e,t)=>Qe(Ae(Ae(Y,S(e)),S(t))),getCellIds:fs,getCell:bs,getValues:ws,getValueIds:Cs,getValue:Ls,hasTables:vs,hasTable:ys,hasTableCell:Is,hasRow:ps,hasCell:Ts,hasValues:Rs,hasValue:Ss,getTablesJson:()=>Wt(Y),getValuesJson:()=>Wt(Z),getJson:()=>Wt([Y,Z]),getTablesSchemaJson:()=>Wt(J),getValuesSchemaJson:()=>Wt(P),getSchemaJson:()=>Wt([J,P]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>ls((()=>gt(e)?(([e,t])=>{(Ce(e)?Hs:Ms)(e),(Ce(t)?Js:Vs)(t)})(e):0)),setTables:Ms,setTable:(e,t)=>ls((e=>ht(t,e)?Rt(e,t):0),e),setRow:(e,t,s)=>ls(((e,t)=>ft(e,t,s)?St(e,kt(e),t,s):0),e,t),addRow:(e,t,s=!0)=>Os((()=>{let n;return ft(e,n,t)&&(e=S(e),St(e,kt(e),n=Ht(e,s?1:0),t)),n})),setPartialRow:(e,t,s)=>ls(((e,t)=>{if(ft(e,t,s,1)){const n=kt(e);we(s,((s,a)=>Vt(e,n,t,a,s)))}}),e,t),setCell:(e,t,s,n)=>ls(((e,t,s)=>F(bt(e,t,s,z(n)?n(bs(e,t,s)):n),(n=>Vt(e,kt(e),t,s,n)))),e,t,s),setValues:Vs,setPartialValues:e=>ls((()=>wt(e,1)?we(e,((e,t)=>Et(t,e))):0)),setValue:(e,t)=>ls((e=>F(Ct(e,z(t)?t(Ls(e)):t),(t=>Et(e,t)))),e),applyChanges:e=>ls((()=>{we(e[0],((e,t)=>x(e)?ks(t):we(e,((e,s)=>x(e)?As(t,s):we(e,((e,n)=>Be(Gs,t,s,n,e))))))),we(e[1],((e,t)=>Ue(Gs,t,e)))})),setTablesJson:ms,setValuesJson:e=>{try{mt(_t(e))}catch{}return Gs},setJson:e=>ls((()=>{try{const[t,s]=_t(e);pt(t),mt(s)}catch{ms(e)}})),setTablesSchema:Ds,setValuesSchema:Es,setSchema:(e,t)=>ls((()=>{Ds(e),Es(t)})),delTables:Hs,delTable:ks,delRow:As,delCell:(e,t,s,n)=>ls(((e,t,s)=>F(Ae(Y,e),(a=>F(Ae(a,t),(o=>Se(o,s)?xt(e,a,t,o,s,n):0))))),e,t,s),delValues:Js,delValue:e=>ls((e=>Se(Z,e)?Ft(e):0),e),delTablesSchema:xs,delValuesSchema:Fs,delSchema:()=>ls((()=>{xs(),Fs()})),transaction:Os,startTransaction:Qs,getTransactionChanges:()=>[Qe(D,((e,t)=>-1===Ae(g,t)?void 0:Qe(e,((e,s)=>-1===Ae(Ae(V,t),s)?void 0:Qe(e,(([,e])=>e),(e=>Pt(e)))),Me,Ce)),Me,Ce),Qe(H,(([,e])=>e),(e=>Pt(e))),1],getTransactionLog:()=>[!Me(D),!Me(H),Ge(D,Nt,Pt),Ge(k),Qe(H,Nt,Pt),Qe(A),Qe(g),ze(V),Ge(m),Qe(E)],finishTransaction:zs,forEachTable:e=>De(Y,((t,s)=>e(s,(e=>De(t,((t,s)=>e(s,(e=>Je(t,e))))))))),forEachTableCell:(e,t)=>Je(Ae(U,S(e)),t),forEachRow:(e,t)=>De(Ae(Y,S(e)),((e,s)=>t(s,(t=>Je(e,t))))),forEachCell:(e,t,s)=>Je(Ae(Ae(Y,S(e)),S(t)),s),forEachValue:e=>Je(Z,e),addSortedRowIdsListener:(e,t,s,n,a,o,r)=>{let l=hs(e,t,s,n,a);return rt((()=>{const r=hs(e,t,s,n,a);B(r,l)||(l=r,o(Gs,e,t,s,n,a,l))}),de[r?1:0],[e,t],[cs])},addStartTransactionListener:e=>rt(e,at),addWillFinishTransactionListener:e=>rt(e,ot[0]),addDidFinishTransactionListener:e=>rt(e,ot[1]),callListener:e=>(dt(e),Gs),delListener:e=>(it(e),Gs),getListenerStats:()=>({hasTables:zt(ee),tables:zt(te),tableIds:zt(ne),hasTable:zt(ae),table:zt(oe),tableCellIds:zt(re),hasTableCell:zt(le,Te),rowCount:zt(ie),rowIds:zt(ce),sortedRowIds:zt(de),hasRow:zt(ge,Te),row:zt(be,Te),cellIds:zt(Le,Te),hasCell:zt(ye,Re),cell:zt(Ve,Re),invalidCell:zt(_e,Re),hasValues:zt(Xe),values:zt(Ye),valueIds:zt(Ze),hasValue:zt(et),value:zt(nt),invalidValue:zt($e),transaction:pe(at)+zt(ot)}),isMergeable:()=>!1,createStore:$t,addListener:rt,callListeners:lt,setInternalListeners:(e,t,s,n,a)=>c=[e,t,s,n,a]};return we({[u+f]:[0,ee,[],()=>[vs()]],[f]:[0,te],[b]:[0,ne],[u+h]:[1,ae,[cs],e=>[ys(...e)]],[h]:[1,oe,[cs]],[h+I]:[1,re,[cs]],[u+h+y]:[2,le,[cs,ds],e=>[Is(...e)]],[C]:[1,ie,[cs]],[L]:[1,ce,[cs]],[u+w]:[2,ge,[cs,gs],e=>[ps(...e)]],[w]:[2,be,[cs,gs]],[I]:[2,Le,[cs,gs]],[u+y]:[3,ye,[cs,gs,fs],e=>[Ts(...e)]],[y]:[3,Ve,[cs,gs,fs],e=>Qt(bs(...e))],InvalidCell:[3,_e],[u+T]:[0,Xe,[],()=>[Rs()]],[T]:[0,Ye],[R]:[0,Ze],[u+p]:[1,et,[Cs],e=>[Ss(...e)]],[p]:[1,nt,[Cs],e=>Qt(Ls(e[0]))],InvalidValue:[1,$e]},(([e,t,s,n],a)=>{Gs[d+a+i]=(...a)=>rt(a[e],t[a[e+1]?1:0],e>0?N(a,0,e):void 0,s,n)})),ue(Gs)},Bt=2**36,Ut=2**30,qt=2**24,Kt=2**18,Xt=4096,Yt={HasTable:1,Table:1,TableCellIds:1,HasTableCell:2,RowCount:1,RowIds:1,SortedRowIds:5,HasRow:2,Row:2,CellIds:2,HasCell:3,Cell:3,HasValue:1,Value:1,InvalidCell:3,InvalidValue:1},Zt=(e=t)=>[Et(e),Et(e)],es=e=>{let s=1,n=Zt(),a=0;const o=He(),r=qe(),[l,i]=(e=>{let t=0,s=-1;const n=F(e,(e=>{const t=yt(e);return rt(t/qt)+rt(t/Kt)+rt(t/Xt)+rt(t/64)+rt(t)}),(()=>dt(5))),a=e=>{const n=t,[a,o]=x(e)||""==e?[0,0]:[lt(r=e,0)*Bt+lt(r,1)*Ut+lt(r,2)*qt+lt(r,3)*Kt+lt(r,4)*Xt+64*lt(r,5)+lt(r,6),lt(r,7)*Kt+lt(r,8)*Xt+64*lt(r,9)+lt(r,10)];var r;t=H(n,a,D.HLC_TIME??Date.now()),s=t==n?t==a?H(s,o):s:t==a?o:-1};return[()=>{return a(),o=++s,rt((e=t)/Bt)+rt(e/Ut)+rt(e/qt)+rt(e/Kt)+rt(e/Xt)+rt(e/64)+rt(e)+rt(o/Kt)+rt(o/Xt)+rt(o/64)+rt(o)+n;var e,o},a]})(e),c=$t(),d=e=>{const t=s;return s=0,e(),s=t,b},u=(e,s=0)=>{const a={},o={},[[r,l=t,c=0],d]=e,[u,h]=n,[f,b,w]=u;let C=s?c:w,L=l;be(r,(([e,n=t,o=0],r)=>{const l=Fe(f,r,Et),[i,c,d]=l;let u=s?o:d,h=n;be(e,((e,t)=>{const[n,o,l]=g(e,Fe(i,t,Et),Le(Le(a,r,ge),t,ge),s);u^=s?0:(o?St(t,o):0)^St(t,l),h=Vt(h,n)})),u^=s?0:Mt(c,n),mt(l,u,n),C^=s?0:(d?St(r,d):0)^St(r,l[2]),L=Vt(L,h)})),C^=s?0:Mt(b,l),mt(u,C,l);const[v]=g(d,h,o,s);return i(Vt(L,v)),[a,o,1]},g=(e,s,n,a)=>{const[o,r=t,l=0]=e,[i,c,d]=s;let u=r,g=a?l:d;return be(o,(([e,s,o=0],r)=>{const l=Fe(i,r,(()=>[void 0,t,0])),[,c,d]=l;(!c||s>c)&&(mt(l,a?o:yt(Wt(e??null)+":"+s),s),l[0]=e,n[r]=e,g^=a?0:St(r,d)^St(r,l[2]),u=Vt(u,s))})),g^=a?0:Mt(c,r),mt(s,g,r),[u,d,s[2]]},h=()=>[Ht(n[0],(e=>Ht(e,(e=>Ht(e))))),Ht(n[1])],f=e=>d((()=>c.applyChanges(u(e)))),b={getMergeableContent:h,getMergeableContentHashes:()=>[n[0][2],n[1][2]],getMergeableTableHashes:()=>Qe(n[0][0],Rt),getMergeableTableDiff:e=>{const t=Dt(n[0][1]),s={};return Je(n[0][0],((n,[a,o,r])=>he(e,n)?r!=e[n]?s[n]=r:0:t[0][n]=kt([a,o],(e=>kt(e))))),[t,s]},getMergeableRowHashes:e=>{const t={};return be(e,((e,s)=>F(Ae(n[0][0],s),(([n,,a])=>a!=e?Je(n,((e,[,,n])=>Le(t,s,ge)[e]=n)):0)))),t},getMergeableRowDiff:e=>{const t=Dt(n[0][1]),s={};return be(e,((e,a)=>Je(Ae(n[0][0],a)?.[0],((n,[o,r,l])=>he(e,n)?l!==e[n]?Le(s,a,ge)[n]=l:0:Le(t[0],a,Dt)[0][n]=kt([o,r]))))),[t,s]},getMergeableCellHashes:e=>{const t={};return be(e,((e,s)=>F(Ae(n[0][0],s),(([n])=>be(e,((e,a)=>F(Ae(n,a),(([n,,o])=>o!==e?Je(n,((e,[,,n])=>Le(Le(t,s,ge),a,ge)[e]=n)):0)))))))),t},getMergeableCellDiff:e=>{const[[t,s]]=n,a={};return be(e,((e,s)=>be(e,((e,n)=>F(Ae(t,s),(([t,o])=>F(Ae(t,n),(([t,r])=>Je(t,((t,[l,i,c])=>c!==e[t]?Le(Le(a,s,(()=>Dt(o)))[0],n,(()=>Dt(r)))[0][t]=[l,i]:0)))))))))),Tt(a,s)},getMergeableValueHashes:()=>Qe(n[1][0],Rt),getMergeableValueDiff:e=>{const[,[t,s]]=n,a=Qe(t,pt,(([,,t],s)=>t==e?.[s]));return Tt(a,s)},setMergeableContent:e=>d((()=>(e=>G(e)&&2==P(e)&&At(e[0],(e=>ve(e,(e=>At(e,(e=>ve(e,(e=>At(e,(e=>ve(e,(e=>At(e,$e)),void 0,1)))),void 0,1)))),void 0,1)))&&At(e[1],(e=>ve(e,(e=>At(e,$e)),void 0,1))))(e)?c.transaction((()=>{c.delTables().delValues(),n=Zt(),c.applyChanges(u(e,1))})):0)),setDefaultContent:e=>(c.transaction((()=>{a=1,c.setContent(e),a=0})),b),getTransactionMergeableChanges:()=>{const[[e,t],[s,a]]=n,l={};De(o,((t,s)=>F(Ae(e,s),(([e,n])=>{const a={};De(t,((t,s)=>F(Ae(e,s),(([e,n])=>{const o={};De(t,(t=>{F(Ae(e,t),(([e,s])=>o[t]=Tt(e,s)))})),a[s]=Tt(o,n)})))),l[s]=Tt(a,n)}))));const i={};return De(r,(e=>F(Ae(s,e),(([t,s])=>i[e]=Tt(t,s))))),[Tt(l,t),Tt(i,a),1]},applyMergeableChanges:f,merge:e=>{const t=h(),s=e.getMergeableContent();return e.applyMergeableChanges(t),f(s)}};return c.setInternalListeners((()=>{}),(()=>{}),(()=>{me(o),me(r)}),((e,n,r,i)=>{Ke(Fe(Fe(o,e,He),n,qe),r),s&&u([[{[e]:[{[n]:[{[r]:[i,a?t:l()]}]}]}],[{}],1])}),((e,n)=>{Ke(r,e),s&&u([[{}],[{[e]:[n,a?t:l()]}],1])})),we(c,((e,t)=>b[t]=M(t,"set")||M(t,"del")||M(t,"apply")||V(t,"Transaction")||"callListener"==t?(...t)=>(e(...t),b):M(t,"add")&&V(t,"Listener")?(...s)=>{const n=Yt[N(t,3,-8)]??0,a=s[n];return s[n]=(e,...t)=>a(b,...t),e(...s)}:"isMergeable"==t?()=>!0:e)),ue(b)};export{Jt as Message,bt as Persists,nt as createCheckpoints,Lt as createCustomPersister,xt as createCustomSynchronizer,ut as createIndexes,es as createMergeableStore,ft as createMetrics,Ft as createQueries,Ot as createRelationships,$t as createStore,ct as defaultSorter,dt as getUniqueId};
|
|
1
|
+
const e=e=>typeof e,t="",s=e(t),n=e(!0),a=e(0),o=e(e),r="type",l="default",i="Listener",c="Result",d="add",u="Has",g="Ids",h="Table",f=h+"s",b=h+g,w="Row",C=w+"Count",L=w+g,v="Sorted"+w+g,y="Cell",I=y+g,p="Value",T=p+"s",R=p+g,S=e=>t+e,M=(e,t)=>e.startsWith(t),V=(e,t)=>e.endsWith(t),m=Promise,D=globalThis,E=Math,H=E.max,k=E.min,A=E.floor,J=isFinite,x=e=>null==e,F=(e,t,s)=>x(e)?s?.():t(e),O=e=>e==s||e==n,Q=t=>e(t)==s,z=t=>e(t)==o,G=e=>Array.isArray(e),N=(e,t,s)=>e.slice(t,s),P=e=>e.length,W=()=>{},_=e=>{throw Error(e)},j=(e,t)=>e.includes(t),$=(e,t)=>e.every(t),B=(e,t)=>P(e)===P(t)&&$(e,((e,s)=>t[s]===e)),U=(e,t)=>$(e,((s,n)=>0==n||t(e[n-1],s)<=0)),q=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),X=(e,t)=>e.map(t),Y=e=>ee(e,((e,t)=>e+t),0),Z=e=>0==P(e),ee=(e,t,s)=>e.reduce(t,s),te=(e,t)=>e.splice(0,t),se=(e,...t)=>e.push(...t),ne=e=>e.pop(),ae=e=>e.shift(),oe=Object,re=e=>oe.getPrototypeOf(e),le=oe.entries,ie=oe.isFrozen,ce=e=>!x(e)&&F(re(e),(e=>e==oe.prototype||x(re(e))),(()=>!0)),de=oe.keys,ue=oe.freeze,ge=(e=[])=>oe.fromEntries(e),he=(e,t)=>t in e,fe=(e,t)=>(delete e[t],e),be=(e,t)=>K(le(e),(([e,s])=>t(s,e))),we=(e,t)=>X(le(e),(([e,s])=>t(s,e))),Ce=e=>ce(e)&&0==(e=>P(de(e)))(e),Le=(e,t,s)=>(he(e,t)||(e[t]=s()),e[t]),ve=(e,t,s,n=0)=>x(e)||!ce(e)||!n&&Ce(e)||ie(e)?(s?.(),!1):(we(e,((s,n)=>{t(s,n)||fe(e,n)})),!!n||!Ce(e)),ye=e=>t=>ee(Ve(t),((t,s)=>t+e(s)),0),Ie=e=>e?.size??0,pe=ye(Ie),Te=ye(pe),Re=ye(Te),Se=(e,t)=>e?.has(t)??!1,Me=e=>x(e)||0==Ie(e),Ve=e=>[...e?.values()??[]],me=e=>e.clear(),De=(e,t)=>e?.forEach(t),Ee=(e,t)=>e?.delete(t),He=e=>new Map(e),ke=e=>[...e?.keys()??[]],Ae=(e,t)=>e?.get(t),Je=(e,t)=>De(e,((e,s)=>t(s,e))),xe=(e,t,s)=>x(s)?(Ee(e,t),e):e?.set(t,s),Fe=(e,t,s,n)=>(Se(e,t)?n?.(Ae(e,t)):xe(e,t,s()),Ae(e,t)),Oe=(e,t,s,n=xe)=>(we(t,((t,n)=>s(e,n,t))),Je(e,(s=>he(t,s)?0:n(e,s))),e),Qe=(e,t,s,n)=>{const a={};return De(e,((e,o)=>{if(!s?.(e,o)){const s=t?t(e,o):e;!n?.(s)&&(a[o]=s)}})),a},ze=(e,t,s)=>Qe(e,(e=>Qe(e,t,s)),Me,Ce),Ge=(e,t,s)=>Qe(e,(e=>ze(e,t,s)),Me,Ce),Ne=(e,t)=>{const s=He();return De(e,((e,n)=>s.set(n,t?.(e)??e))),s},Pe=e=>Ne(e,Ne),We=e=>Ne(e,Pe),_e=(e,t,s,n,a=0)=>F((s?Fe:Ae)(e,t[a],a>P(t)-2?s:He),(o=>{if(a>P(t)-2)return n?.(o)&&xe(e,t[a]),o;const r=_e(o,t,s,n,a+1);return Me(o)&&xe(e,t[a]),r})),je=t=>{const s=e(t);return O(s)||s==a&&J(t)?s:void 0},$e=e=>x(e)||!x(je(e)),Be=(e,t,s,n,a)=>x(a)?e.delCell(t,s,n,!0):e.setCell(t,s,n,a),Ue=(e,t,s)=>x(s)?e.delValue(t):e.setValue(t,s),qe=e=>new Set(G(e)||x(e)?e:[e]),Ke=(e,t)=>e?.add(t),Xe=(e,t,s,n,a)=>{const o=e.hasRow,r=He(),l=He(),i=He(),c=He(),d=He(),u=He(),g=(t,s,...n)=>{const a=Fe(u,t,qe);return K(n,(t=>Ke(a,t)&&s&&e.callListener(t))),n},h=(t,...s)=>F(Ae(u,t),(n=>{K(Z(s)?Ve(n):s,(t=>{e.delListener(t),Ee(n,t)})),Me(n)&&xe(u,t)})),f=(e,s)=>{xe(r,e,s),Se(l,e)||(xe(l,e,t()),xe(c,e,He()),xe(d,e,He()),a(i))},b=e=>{xe(r,e),xe(l,e),xe(c,e),xe(d,e),h(e),a(i)};return[()=>e,()=>ke(r),e=>Je(l,e),e=>Se(l,e),e=>Ae(r,e),e=>Ae(l,e),(e,t)=>xe(l,e,t),f,(t,n,a,r,l)=>{f(t,n);const i=He(),u=He(),b=Ae(c,t),w=Ae(d,t),C=t=>{const a=s=>e.getCell(n,t,s),c=Ae(b,t),d=o(n,t)?s(r(a,t)):void 0;if(c===d||G(c)&&G(d)&&B(c,d)||xe(i,t,[c,d]),!x(l)){const e=Ae(w,t),s=o(n,t)?l(a,t):void 0;e!=s&&xe(u,t,s)}},L=e=>{a((()=>{De(i,(([,e],t)=>xe(b,t,e))),De(u,((e,t)=>xe(w,t,e)))}),i,u,b,w,e),me(i),me(u)};Je(b,C),e.hasTable(n)&&K(e.getRowIds(n),(e=>{Se(b,e)||C(e)})),L(!0),h(t),g(t,0,e.addRowListener(n,null,((e,t,s)=>C(s))),e.addTableListener(n,(()=>L())))},b,e=>n(e,i),()=>Je(u,b),g,h]},Ye=(e,s)=>Q(e)?t=>t(e):e??(()=>s??t),Ze=(e,t)=>{const s=new WeakMap;return n=>{s.has(n)||s.set(n,e(n));const a=s.get(n);return t?.(a),a}},et=/^\d+$/,tt=()=>{const e=[];let s=0;return[n=>(n?ae(e):null)??t+s++,t=>{et.test(t)&&P(e)<1e3&&se(e,t)}]},st=e=>{let s;const[n,a]=tt(),o=He();return[(a,r,l,i=[],c=()=>[])=>{s??=e();const d=n(1);return xe(o,d,[a,r,l,i,c]),Ke(_e(r,l??[t],qe),d),d},(e,n,...a)=>K(((e,s=[t])=>{const n=[],a=(e,t)=>t==P(s)?se(n,e):null===s[t]?De(e,(e=>a(e,t+1))):K([s[t],null],(s=>a(Ae(e,s),t+1)));return a(e,0),n})(e,n),(e=>De(e,(e=>Ae(o,e)[0](s,...n??[],...a))))),e=>F(Ae(o,e),(([,s,n])=>(_e(s,n??[t],void 0,(t=>(Ee(t,e),Me(t)?1:0))),xe(o,e),a(e),n))),e=>F(Ae(o,e),(([e,,t=[],n,a])=>{const o=(...r)=>{const l=P(r);l==P(t)?e(s,...r,...a(r)):x(t[l])?K(n[l]?.(...r)??[],(e=>o(...r,e))):o(...r,t[l])};o()}))]},nt=Ze((e=>{let s,n,a,o=100,r=He(),l=He(),i=1;const c=He(),d=He(),[u,g,h]=st((()=>A)),f=He(),b=He(),w=[],C=[],L=(t,s)=>{i=0,e.transaction((()=>{const[n,a]=Ae(f,s);De(n,((s,n)=>De(s,((s,a)=>De(s,((s,o)=>Be(e,n,a,o,s[t]))))))),De(a,((s,n)=>Ue(e,n,s[t])))})),i=1},v=e=>{xe(f,e),xe(b,e),g(d,[e])},y=(e,t)=>K(te(e,t??P(e)),v),I=()=>y(w,P(w)-o),p=()=>F(s,(()=>{se(w,s),I(),y(C),s=void 0,a=1})),T=()=>{s=ne(w),a=1};let R,S;const M=(e=t)=>(x(s)&&(s=t+n++,xe(f,s,[r,l]),H(s,e),r=He(),l=He(),a=1),s),V=()=>{Z(w)||(((e,...t)=>{e.unshift(...t)})(C,M()),L(0,s),s=ne(w),a=1)},m=()=>{Z(C)||(se(w,s),s=ae(C),L(1,s),a=1)},D=()=>{a&&(g(c),a=0)},E=e=>{const t=M(e);return D(),t},H=(e,t)=>(k(e)&&Ae(b,e)!==t&&(xe(b,e,t),g(d,[e])),A),k=e=>Se(f,e),A={setSize:e=>(o=e,I(),A),addCheckpoint:E,setCheckpoint:H,getStore:()=>e,getCheckpointIds:()=>[[...w],s,[...C]],forEachCheckpoint:e=>Je(b,e),hasCheckpoint:k,getCheckpoint:e=>Ae(b,e),goBackward:()=>(V(),D(),A),goForward:()=>(m(),D(),A),goTo:e=>{const t=j(w,e)?V:j(C,e)?m:null;for(;!x(t)&&e!=s;)t();return D(),A},addCheckpointIdsListener:e=>u(e,c),addCheckpointListener:(e,t)=>u(t,d,[e]),delListener:e=>(h(e),A),clear:()=>(y(w),y(C),x(s)||v(s),s=void 0,n=0,E(),A),clearForward:()=>(Z(C)||(y(C),g(c)),A),destroy:()=>{e.delListener(R),e.delListener(S)},getListenerStats:()=>({checkpointIds:pe(c),checkpoint:pe(d)}),_registerListeners:()=>{R=e.addCellListener(null,null,null,((e,t,s,n,a,o)=>{if(i){p();const e=Fe(r,t,He),l=Fe(e,s,He),i=Fe(l,n,(()=>[o,void 0]));i[1]=a,i[0]===a&&Me(xe(l,n))&&Me(xe(e,s))&&Me(xe(r,t))&&T(),D()}})),S=e.addValueListener(null,((e,t,s,n)=>{if(i){p();const e=Fe(l,t,(()=>[n,void 0]));e[1]=s,e[0]===s&&Me(xe(l,t))&&T(),D()}}))}};return ue(A.clear())}),(e=>e._registerListeners())),at="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(t),ot=He(X(at,((e,t)=>[e,t]))),rt=e=>at[63&e],lt=(e,t)=>Ae(ot,e[t])??0,it=D.crypto?e=>D.crypto.getRandomValues(e):e=>X(e,(()=>A(256*E.random()))),ct=(e,t)=>(e??0)<(t??0)?-1:1,dt=(e=16)=>ee(it(new Uint8Array(e)),((e,t)=>e+rt(t)),""),ut=Ze((e=>{const s=He(),n=He(),[a,o,r]=st((()=>v)),[l,i,c,d,u,g,h,,f,b,w,C]=Xe(e,He,(e=>x(e)?t:G(e)?X(e,S):S(e)),a,o),L=(t,s,n)=>{const a=u(t);De(n,((t,n)=>s(n,(s=>De(t,(t=>s(t,(s=>e.forEachCell(a,t,s)))))))))},v={setIndexDefinition:(e,t,a,r,l,i=ct)=>{const c=x(l)?void 0:([e],[t])=>l(e,t);return f(e,t,((t,a,l,d,u,f)=>{let b=0;const w=qe(),C=qe(),L=g(e);if(De(a,(([e,t],s)=>{const n=qe(e),a=qe(t);De(n,(e=>Ee(a,e)?Ee(n,e):0)),De(n,(e=>{Ke(w,e),F(Ae(L,e),(t=>{Ee(t,s),Me(t)&&(xe(L,e),b=1)}))})),De(a,(e=>{Ke(w,e),Se(L,e)||(xe(L,e,qe()),b=1),Ke(Ae(L,e),s),x(r)||Ke(C,e)}))})),t(),Me(u)||(f?Je(L,(e=>Ke(C,e))):Je(l,(e=>F(Ae(d,e),(e=>Ke(C,e))))),De(C,(e=>{const t=(t,s)=>i(Ae(u,t),Ae(u,s),e),s=[...Ae(L,e)];U(s,t)||(xe(L,e,qe(q(s,t))),Ke(w,e))}))),(b||f)&&!x(c)){const t=[...L];U(t,c)||(h(e,He(q(t,c))),b=1)}b&&o(s,[e]),De(w,(t=>o(n,[e,t])))}),Ye(a),F(r,Ye)),v},delIndexDefinition:e=>(b(e),v),getStore:l,getIndexIds:i,forEachIndex:e=>c(((t,s)=>e(t,(e=>L(t,e,s))))),forEachSlice:(e,t)=>L(e,t,g(e)),hasIndex:d,hasSlice:(e,t)=>Se(g(e),t),getTableId:u,getSliceIds:e=>ke(g(e)),getSliceRowIds:(e,t)=>Ve(Ae(g(e),t)),addIndexIdsListener:w,addSliceIdsListener:(e,t)=>a(t,s,[e]),addSliceRowIdsListener:(e,t,s)=>a(s,n,[e,t]),delListener:e=>(r(e),v),destroy:C,getListenerStats:()=>({sliceIds:pe(s),sliceRowIds:Te(n)})};return ue(v)})),gt=He([["avg",[(e,t)=>Y(e)/t,(e,t,s)=>e+(t-e)/(s+1),(e,t,s)=>e+(e-t)/(s-1),(e,t,s,n)=>e+(t-s)/n]],["max",[e=>H(...e),(e,t)=>H(t,e),(e,t)=>t==e?void 0:e,(e,t,s)=>s==e?void 0:H(t,e)]],["min",[e=>k(...e),(e,t)=>k(t,e),(e,t)=>t==e?void 0:e,(e,t,s)=>s==e?void 0:k(t,e)]],["sum",[e=>Y(e),(e,t)=>e+t,(e,t)=>e-t,(e,t,s)=>e-s+t]]]),ht=(e,t,s,n,a,o=!1)=>{if(Me(s))return;const[r,l,i,c]=a;return o||=x(e),De(n,(([s,n])=>{o||(e=x(s)?l?.(e,n,t++):x(n)?i?.(e,s,t--):c?.(e,n,s,t),o||=x(e))})),o?r(Ve(s),Ie(s)):e},ft=Ze((e=>{const s=He(),[n,a,o]=st((()=>C)),[r,l,i,c,d,u,g,,h,f,b,w]=Xe(e,W,(e=>isNaN(e)||x(e)||!0===e||!1===e||e===t?void 0:1*e),n,a),C={setMetricDefinition:(e,t,n,o,r,l,i)=>{const c=z(n)?[n,r,l,i]:Ae(gt,n)??Ae(gt,"sum");return h(e,t,((t,n,o,r,l,i)=>{const d=u(e),h=Ie(r);i||=x(d),t();let f=ht(d,h,r,n,c,i);J(f)||(f=void 0),f!=d&&(g(e,f),a(s,[e],f,d))}),Ye(o,1)),C},delMetricDefinition:e=>(f(e),C),getStore:r,getMetricIds:l,forEachMetric:i,hasMetric:c,getTableId:d,getMetric:u,addMetricIdsListener:b,addMetricListener:(e,t)=>n(t,s,[e]),delListener:e=>(o(e),C),destroy:w,getListenerStats:()=>({metric:pe(s)})};return ue(C)})),bt={StoreOnly:1,MergeableStoreOnly:2,StoreOrMergeableStore:3},wt=He(),Ct=He(),Lt=(e,t,s,n,a,o,r,l={},i=[])=>{let c,d,u,g=0,h=0,f=0;Fe(wt,i,(()=>0)),Fe(Ct,i,(()=>[]));const[b,w,C,L,v]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!Ce(e)||!Ce(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!Ce(e)||!Ce(t),t.setContent]:_("Store type not supported by this Persister"))(r,e),y=t=>{(b&&G(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},I=async e=>(2!=g&&(g=1,h++,await S((async()=>{try{const e=await t();G(e)?y(e):_("Content is not an array "+e)}catch(t){o?.(t),e&&v(e)}g=0}))),M),p=()=>(d&&(a(d),d=void 0),M),T=async e=>(1!=g&&(g=2,f++,await S((async()=>{try{await s(w,e)}catch(e){o?.(e)}g=0}))),M),R=()=>(F(u,e.delListener),u=void 0,M),S=async(...e)=>(se(Ae(Ct,i),...e),await(async()=>{if(!Ae(wt,i)){for(xe(wt,i,1);!x(c=ae(Ae(Ct,i)));)try{await c()}catch(e){o?.(e)}xe(wt,i,0)}})(),M),M={load:I,startAutoLoad:async e=>{await p().load(e);try{d=n((async(e,t)=>{t||e?2!=g&&(g=1,h++,y(t??e),g=0):await I()}))}catch(e){o?.(e)}return M},stopAutoLoad:p,isAutoLoading:()=>!x(d),save:T,startAutoSave:async()=>(await R().save(),u=e.addDidFinishTransactionListener((()=>{const e=C();L(e)&&T(e)})),M),stopAutoSave:R,isAutoSaving:()=>!x(u),schedule:S,getStore:()=>e,destroy:()=>(te(Ae(Ct,i)),p().stopAutoSave()),getStats:()=>({loads:h,saves:f}),...l};return ue(M)},vt=new D.TextEncoder,yt=e=>{let t=2166136261;return K(vt.encode(e),(e=>{t^=e,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)})),t>>>0},It=([e,t,s])=>[e,t,s],pt=([e,t])=>Tt(e,t),Tt=(e,t)=>t?[e,t]:[e],Rt=e=>e[2],St=(e,t)=>yt(e+":"+t),Mt=(e,t)=>t>e?(e?yt(e):0)^yt(t):0,Vt=(e,t)=>((e??"")>(t??"")?e:t)??"",mt=(e,t,s)=>{e[2]=t>>>0,s>e[1]&&(e[1]=s)},Dt=(e=t)=>Tt(ge(),e),Et=(e=t)=>[He(),e,0],Ht=([e,t,s],n=It)=>[Qe(e,n),t,s],kt=([e,t],s=pt)=>Tt(Qe(e,s),t),At=(t,s)=>G(t)&&3==P(t)&&Q(t[1])&&e(t[2])==a&&J(t[2])&&s(t[0]),Jt={Response:0,GetContentHashes:1,ContentHashes:2,ContentDiff:3,GetTableDiff:4,GetRowDiff:5,GetCellDiff:6,GetValueDiff:7},xt=(e,s,n,a,o,r,l,i,c={})=>{let d,u=0,g=0;const h=He(),f=(e,t,n,a)=>{u++,r?.(e,t,n,a),s(e,t,n,a)},b=async(e,s,n=t)=>new m(((t,a)=>{const r=dt(),l=setTimeout((()=>{Ee(h,r),a(`No response from ${e??"anyone"} to ${r}, `+s)}),1e3*o);xe(h,r,[e,(e,s)=>{clearTimeout(l),Ee(h,r),t([e,s])}]),f(e,r,s,n)})),w=(e,[t,s])=>{be(t,(([t,s],n)=>{const a=Le(e[0],n,Dt);be(t,(([e,t],s)=>{const n=Le(a[0],s,Dt);be(e,(([e,t],s)=>n[0][s]=Tt(e,t))),n[1]=Vt(n[1],t)})),a[1]=Vt(a[1],s)})),e[1]=Vt(e[1],s)},C=async(t=null,s)=>{x(s)&&([s,t]=await b(t,1));const[n,a]=s,[o,r]=e.getMergeableContentHashes();let l=Dt();if(o!=n){const[s,n]=(await b(t,4,e.getMergeableTableHashes()))[0];if(l=s,!Ce(n)){const[s,a]=(await b(t,5,e.getMergeableRowHashes(n)))[0];if(w(l,s),!Ce(a)){const s=(await b(t,6,e.getMergeableCellHashes(a)))[0];w(l,s)}}}return[l,r==a?Dt():(await b(t,7,e.getMergeableValueHashes()))[0],1]},L=Lt(e,(async()=>{const e=await C();return Ce(e[0][0])&&Ce(e[1][0])?void 0:e}),(async(t,s)=>s?f(null,null,3,s):f(null,null,2,e.getMergeableContentHashes())),(e=>d=e),(()=>d=void 0),i,2,{startSync:async e=>await(await L.startAutoLoad(e)).startAutoSave(),stopSync:()=>L.stopAutoLoad().stopAutoSave(),destroy:()=>(a(),L.stopSync()),getSynchronizerStats:()=>({sends:u,receives:g}),...c});return n(((t,s,n,a)=>{g++,l?.(t,s,n,a),0==n?F(Ae(h,s),(([e,s])=>x(e)||e==t?s(a,t):0)):2==n&&L.isAutoLoading()?C(t,a).then((e=>{d?.(void 0,e)})):3==n&&L.isAutoLoading()?d?.(void 0,a):F(1==n&&L.isAutoSaving()?e.getMergeableContentHashes():4==n?e.getMergeableTableDiff(a):5==n?e.getMergeableRowDiff(a):6==n?e.getMergeableCellDiff(a):7==n?e.getMergeableValueDiff(a):void 0,(e=>{f(t,s,0,e)}))})),L},Ft=Ze((e=>{const s=e.createStore,n=s(),a=s(),o=He(),{addListener:r,callListeners:l,delListener:u}=a,[g,f,b,p,T,,,R,,S,M,V,m,D]=Xe(e,(()=>!0),W,r,l),E=(e,t,...s)=>K(s,(s=>Ke(Fe(Fe(o,t,He),e,qe),s))),H=e=>{F(Ae(o,e),(e=>{Je(e,((e,t)=>De(t,(t=>e.delListener(t))))),me(e)})),K([a,n],(t=>t.delTable(e)))},k=(e,t,s)=>E(t,e,t.addStartTransactionListener(s.startTransaction),t.addDidFinishTransactionListener((()=>s.finishTransaction()))),A={setQueryDefinition:(s,o,r)=>{R(s,o),H(s);const l=[],i=[[null,[o,null,null,[],He()]]],c=[],d=[],u=[];r({select:(e,s)=>{const n=z(e)?[P(l)+t,e]:[x(s)?e:s,t=>t(e,s)];return se(l,n),{as:e=>n[0]=e}},join:(e,t,s)=>{const n=x(s)||z(t)?null:t,a=x(n)?t:s,o=[e,[e,n,z(a)?a:e=>e(a),[],He()]];return se(i,o),{as:e=>o[0]=e}},where:(e,t,s)=>se(c,z(e)?e:x(s)?s=>s(e)===t:n=>n(e,t)===s),group:(e,t,s,n,a)=>{const o=[e,[e,z(t)?[t,s,n,a]:Ae(gt,t)??[(e,t)=>t]]];return se(d,o),{as:e=>o[0]=e}},having:(e,t)=>se(u,z(e)?e:s=>s(e)===t)});const g=He(l);if(Me(g))return A;const h=He(i);Je(h,((e,[,t])=>F(Ae(h,t),(({3:t})=>x(e)?0:se(t,e)))));const f=He(d);let b=n;if(Me(f)&&Z(u))b=a;else{k(s,b,a);const e=He();Je(f,((t,[s,n])=>Ke(Fe(e,s,qe),[t,n])));const t=qe();Je(g,(s=>Se(e,s)?0:Ke(t,s)));const n=He(),o=(t,n,o,r)=>F(t,(([l,i,c,d])=>{Je(n,((t,[s])=>{const n=Fe(l,t,He),a=Ae(n,o),i=r?void 0:s;if(a!==i){const s=qe([[a,i]]),r=Ie(n);xe(n,o,i),De(Ae(e,t),(([e,t])=>{const a=ht(d[e],r,n,s,t);d[e]=x(je(a))?null:a}))}})),Me(i)||!$(u,(e=>e((e=>d[e]))))?a.delRow(s,c):x(c)?t[2]=a.addRow(s,d):a.setRow(s,c,d)}));E(b,s,b.addRowListener(s,null,((a,r,l,i)=>{const c=[],d=[],u=He(),g=b.hasRow(s,l);let h=!g;De(t,(e=>{const[t,n,a]=i(s,l,e);se(c,n),se(d,a),h||=t})),Je(e,(e=>{const[t,,n]=i(s,l,e);(h||t)&&xe(u,e,[n])})),h&&o(_e(n,c,void 0,(([,e])=>(Ee(e,l),Me(e)))),u,l,1),g&&o(_e(n,d,(()=>{const e={};return De(t,(t=>e[t]=b.getCell(s,l,t))),[He(),qe(),void 0,e]}),(([,e])=>{Ke(e,l)})),u,l)})))}k(s,e,b);const w=(t,n,a,r)=>{const l=t=>e.getCell(n,a,t);K(r,(n=>{const[a,,o,r,i]=Ae(h,n),c=o?.(l,t),[d,u]=Ae(i,t)??[];c!=d&&(x(u)||D(s,u),xe(i,t,x(c)?null:[c,...m(s,1,e.addRowListener(a,c,(()=>w(t,a,c,r))))]))})),(t=>{const n=(s,n)=>e.getCell(...x(n)?[o,t,s]:s===o?[o,t,n]:[Ae(h,s)?.[0],Ae(Ae(h,s)?.[4],t)?.[0],n]);b.transaction((()=>$(c,(e=>e(n)))?Je(g,((e,a)=>Be(b,s,t,e,a(n,t)))):b.delRow(s,t)))})(t)},{3:C}=Ae(h,null);return b.transaction((()=>m(s,1,e.addRowListener(o,null,((t,n,a)=>{e.hasRow(o,a)?w(a,o,a,C):(b.delRow(s,a),De(h,(({4:e})=>F(Ae(e,a),(([,t])=>{D(s,t),xe(e,a)})))))}))))),A},delQueryDefinition:e=>(H(e),S(e),A),getStore:g,getQueryIds:f,forEachQuery:b,hasQuery:p,getTableId:T,addQueryIdsListener:e=>M((()=>e(A))),delListener:e=>(u(e),A),destroy:V,getListenerStats:()=>{const{tables:e,tableIds:t,transaction:s,...n}=a.getListenerStats();return n}};return we({[h]:[1,1],[h+I]:[0,1],[C]:[0,1],[L]:[0,1],[v]:[0,5],[w]:[1,2],[I]:[0,2],[y]:[1,3]},(([e,t],s)=>{K(e?["get","has","forEach"]:["get"],(e=>A[e+c+s]=(...t)=>a[e+s](...t))),A[d+c+s+i]=(...e)=>a[d+s+i](...N(e,0,t),((s,...n)=>e[t](A,...n)),!0)})),ue(A)})),Ot=Ze((e=>{const s=He(),n=He(),a=He(),o=He(),[r,l,i]=st((()=>p)),[c,d,u,g,h,f,,,b,w,C,L]=Xe(e,(()=>[He(),He(),He(),He()]),(e=>x(e)?void 0:e+t),r,l),v=(e,t,s)=>F(f(e),(([n,,a])=>{if(!Se(a,t)){const o=qe();if(h(e)!=I(e))Ke(o,t);else{let e=t;for(;!x(e)&&!Se(o,e);)Ke(o,e),e=Ae(n,e)}if(s)return o;xe(a,t,o)}return Ae(a,t)})),y=(e,t)=>F(f(e),(([,,e])=>xe(e,t))),I=e=>Ae(s,e),p={setRelationshipDefinition:(e,t,r,i)=>(xe(s,e,r),b(e,t,((t,s)=>{const r=qe(),i=qe(),c=qe(),[d,u]=f(e);De(s,(([t,s],n)=>{x(t)||(Ke(i,t),F(Ae(u,t),(e=>{Ee(e,n),Me(e)&&xe(u,t)}))),x(s)||(Ke(i,s),Se(u,s)||xe(u,s,qe()),Ke(Ae(u,s),n)),Ke(r,n),xe(d,n,s),Je(Ae(o,e),(t=>{Se(v(e,t),n)&&Ke(c,t)}))})),t(),De(r,(t=>l(n,[e,t]))),De(i,(t=>l(a,[e,t]))),De(c,(t=>{y(e,t),l(o,[e,t])}))}),Ye(i)),p),delRelationshipDefinition:e=>(xe(s,e),w(e),p),getStore:c,getRelationshipIds:d,forEachRelationship:t=>u((s=>t(s,(t=>e.forEachRow(h(s),t))))),hasRelationship:g,getLocalTableId:h,getRemoteTableId:I,getRemoteRowId:(e,t)=>Ae(f(e)?.[0],t),getLocalRowIds:(e,t)=>Ve(Ae(f(e)?.[1],t)),getLinkedRowIds:(e,t)=>x(f(e))?[t]:Ve(v(e,t,!0)),addRelationshipIdsListener:C,addRemoteRowIdListener:(e,t,s)=>r(s,n,[e,t]),addLocalRowIdsListener:(e,t,s)=>r(s,a,[e,t]),addLinkedRowIdsListener:(e,t,s)=>(v(e,t),r(s,o,[e,t])),delListener:e=>(y(...i(e)??[]),p),destroy:L,getListenerStats:()=>({remoteRowId:Te(n),localRowIds:Te(a),linkedRowIds:Te(o)})};return ue(p)})),Qt=e=>[e,e],zt=(e,t=pe)=>t(e[0])+t(e[1]),Gt=()=>[He(),He()],Nt=e=>[...e],Pt=([e,t])=>e===t,Wt=e=>JSON.stringify(e,((e,t)=>t instanceof Map?oe.fromEntries([...t]):t)),_t=JSON.parse,jt=(e,t,s)=>xe(e,t,Ae(e,t)==-s?void 0:s),$t=()=>{let e,t,s=!1,n=!1,o=0,c=[];const g=He(),v=He(),M=He(),V=He(),m=He(),D=He(),E=He(),H=He(),k=He(),A=He(),J=He(),Q=He(),P=He(),W=He(),_=qe(),$=He(),U=He(),Y=He(),Z=He(),ee=Gt(),te=Gt(),ne=Gt(),ae=Gt(),oe=Gt(),re=Gt(),le=Gt(),ie=Gt(),ce=Gt(),de=Gt(),ge=Gt(),be=Gt(),Le=Gt(),ye=Gt(),Ve=Gt(),_e=Gt(),$e=Gt(),Xe=Gt(),Ye=Gt(),Ze=Gt(),et=Gt(),nt=Gt(),at=He(),ot=Gt(),[rt,lt,it,dt]=st((()=>Gs)),ut=e=>{if(!ve(e,((e,t)=>j([r,l],t))))return!1;const t=e[r];return!(!O(t)&&t!=a||(je(e[l])!=t&&fe(e,l),0))},gt=G,ht=(t,s)=>(!e||Se(J,s)||Yt(s))&&ve(t,((e,t)=>ft(s,t,e)),(()=>Yt(s))),ft=(e,t,s,n)=>ve(n?s:Lt(s,e,t),((n,a)=>F(bt(e,t,a,n),(e=>(s[a]=e,!0)),(()=>!1))),(()=>Yt(e,t))),bt=(t,s,n,a)=>e?F(Ae(Ae(J,t),n),(e=>je(a)!=e[r]?Yt(t,s,n,a,e[l]):a),(()=>Yt(t,s,n,a))):x(je(a))?Yt(t,s,n,a):a,wt=(e,t)=>ve(t?e:vt(e),((t,s)=>F(Ct(s,t),(t=>(e[s]=t,!0)),(()=>!1))),(()=>Zt())),Ct=(e,s)=>t?F(Ae(P,e),(t=>je(s)!=t[r]?Zt(e,s,t[l]):s),(()=>Zt(e,s))):x(je(s))?Zt(e,s):s,Lt=(e,t,s)=>(F(Ae(Q,t),(([n,a])=>{De(n,((t,s)=>{he(e,s)||(e[s]=t)})),De(a,(n=>{he(e,n)||Yt(t,s,n)}))})),e),vt=e=>(t&&(De(W,((t,s)=>{he(e,s)||(e[s]=t)})),De(_,(t=>{he(e,t)||Zt(t)}))),e),yt=e=>Oe(J,e,((e,t,s)=>{const n=He(),a=qe();Oe(Fe(J,t,He),s,((e,t,s)=>{xe(e,t,s),F(s[l],(e=>xe(n,t,e)),(()=>Ke(a,t)))})),xe(Q,t,[n,a])}),((e,t)=>{xe(J,t),xe(Q,t)})),It=e=>Oe(P,e,((e,t,s)=>{xe(P,t,s),F(s[l],(e=>xe(W,t,e)),(()=>Ke(_,t)))}),((e,t)=>{xe(P,t),xe(W,t),Ee(_,t)})),pt=e=>Ce(e)?Hs():Ms(e),Tt=e=>Oe(Y,e,((e,t,s)=>Rt(t,s)),((e,t)=>At(t))),Rt=(e,t)=>Oe(Fe(Y,e,(()=>(Ot(e,1),xe($,e,tt()),xe(U,e,He()),He()))),t,((t,s,n)=>St(e,t,s,n)),((t,s)=>Jt(e,t,s))),St=(e,t,s,n,a)=>Oe(Fe(t,s,(()=>(Bt(e,s,1),He()))),n,((t,n,a)=>Mt(e,s,t,n,a)),((n,o)=>xt(e,t,s,n,o,a))),Mt=(e,t,s,n,a)=>{Se(s,n)||Ut(e,t,n,1);const o=Ae(s,n);a!==o&&(qt(e,t,n,o,a),xe(s,n,a))},Vt=(e,t,s,n,a)=>F(Ae(t,s),(t=>Mt(e,s,t,n,a)),(()=>St(e,t,s,Lt({[n]:a},e,s)))),mt=e=>Ce(e)?Js():Vs(e),Dt=e=>Oe(Z,e,((e,t,s)=>Et(t,s)),((e,t)=>Ft(t))),Et=(e,t)=>{Se(Z,e)||Kt(e,1);const s=Ae(Z,e);t!==s&&(Xt(e,s,t),xe(Z,e,t))},Ht=(e,t)=>{const[s]=Ae($,e),n=s(t);return Se(Ae(Y,e),n)?Ht(e,t):n},kt=e=>Ae(Y,e)??Rt(e,{}),At=e=>Rt(e,{}),Jt=(e,t,s)=>{const[,n]=Ae($,e);n(s),St(e,t,s,{},!0)},xt=(e,t,s,n,a,o)=>{const r=Ae(Ae(Q,e)?.[0],a);if(!x(r)&&!o)return Mt(e,s,n,a,r);const l=t=>{qt(e,s,t,Ae(n,t)),Ut(e,s,t,-1),xe(n,t)};x(r)?l(a):Je(n,l),Me(n)&&(Bt(e,s,-1),Me(xe(t,s))&&(Ot(e,-1),xe(Y,e),xe($,e),xe(U,e)))},Ft=e=>{const t=Ae(W,e);if(!x(t))return Et(e,t);Xt(e,Ae(Z,e)),Kt(e,-1),xe(Z,e)},Ot=(e,t)=>jt(g,e,t),Bt=(e,t,s)=>jt(Fe(V,e,He),t,s)&&xe(M,e,Fe(M,e,(()=>0))+s),Ut=(e,t,s,n)=>{const a=Ae(U,e),o=Ae(a,s)??0;(0==o&&1==n||1==o&&-1==n)&&jt(Fe(v,e,He),s,n),xe(a,s,o!=-n?o+n:null),jt(Fe(Fe(m,e,He),t,He),s,n)},qt=(e,t,s,n,a)=>{Fe(Fe(Fe(D,e,He),t,He),s,(()=>[n,0]))[1]=a,c[3]?.(e,t,s,a)},Kt=(e,t)=>jt(E,e,t),Xt=(e,t,s)=>{Fe(H,e,(()=>[t,0]))[1]=s,c[4]?.(e,s)},Yt=(e,t,s,n,a)=>(se(Fe(Fe(Fe(k,e,He),t,He),s,(()=>[])),n),a),Zt=(e,t,s)=>(se(Fe(A,e,(()=>[])),t),s),es=(e,t,s)=>F(Ae(Ae(Ae(D,e),t),s),(([e,t])=>[!0,e,t]),(()=>[!1,...Qt(bs(e,t,s))])),ts=e=>F(Ae(H,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Qt(Ls(e))])),ss=e=>Me(k)||Me(_e[e])?0:De(e?We(k):k,((t,s)=>De(t,((t,n)=>De(t,((t,a)=>lt(_e[e],[s,n,a],t))))))),ns=e=>Me(A)||Me($e[e])?0:De(e?Ne(A):A,((t,s)=>lt($e[e],[s],t))),as=(e,t,s,n)=>{if(!Me(e))return lt(t,n,(()=>Qe(e))),Je(e,((e,t)=>lt(s,[...n??[],e],1==t))),1},os=e=>{const t=vs();t!=s&<(ee[e],void 0,t);const n=Me(de[e]),a=Me(Le[e])&&Me(ye[e])&&Me(ce[e])&&Me(ge[e])&&Me(re[e])&&Me(le[e])&&Me(ie[e])&&n&&Me(ne[e])&&Me(ae[e]),o=Me(Ve[e])&&Me(be[e])&&Me(oe[e])&&Me(te[e]);if(!a||!o){const t=e?[Ne(g),Pe(v),Ne(M),Pe(V),We(m),We(D)]:[g,v,M,V,m,D];if(!a){as(t[0],ne[e],ae[e]),De(t[1],((t,s)=>as(t,re[e],le[e],[s]))),De(t[2],((t,s)=>{0!=t&<(ie[e],[s],us(s))}));const s=qe();De(t[3],((t,a)=>{as(t,ce[e],ge[e],[a])&&!n&&(lt(de[e],[a,null]),Ke(s,a))})),n||De(t[5],((t,n)=>{if(!Se(s,n)){const s=qe();De(t,(e=>De(e,(([t,n],a)=>n!==t?Ke(s,a):Ee(e,a))))),De(s,(t=>lt(de[e],[n,t])))}})),De(t[4],((t,s)=>De(t,((t,n)=>as(t,Le[e],ye[e],[s,n])))))}if(!o){let s;De(t[5],((t,n)=>{let a;De(t,((t,o)=>{let r;De(t,(([t,l],i)=>{l!==t&&(lt(Ve[e],[n,o,i],l,t,es),s=a=r=1)})),r&<(be[e],[n,o],es)})),a&<(oe[e],[n],es)})),s&<(te[e],void 0,es)}}},rs=e=>{const t=Rs();t!=n&<(Xe[e],void 0,t);const s=Me(Ze[e])&&Me(et[e]),a=Me(nt[e])&&Me(Ye[e]);if(!s||!a){const t=e?[Ne(E),Ne(H)]:[E,H];if(s||as(t[0],Ze[e],et[e]),!a){let s;De(t[1],(([t,n],a)=>{n!==t&&(lt(nt[e],[a],n,t,ts),s=1)})),s&<(Ye[e],void 0,ts)}}},ls=(e,...t)=>(Os((()=>e(...X(t,S)))),Gs),is=()=>Ge(Y),cs=()=>ke(Y),ds=e=>ke(Ae(U,S(e))),us=e=>Ie(Ae(Y,S(e))),gs=e=>ke(Ae(Y,S(e))),hs=(e,t,s,n=0,a)=>{return X(N(q((o=Ae(Y,S(e)),r=(e,s)=>[x(t)?s:Ae(e,S(t)),s],X([...o?.entries()??[]],(([e,t])=>r(t,e)))),(([e],[t])=>ct(e,t)*(s?-1:1))),n,x(a)?a:n+a),(([,e])=>e));var o,r},fs=(e,t)=>ke(Ae(Ae(Y,S(e)),S(t))),bs=(e,t,s)=>Ae(Ae(Ae(Y,S(e)),S(t)),S(s)),ws=()=>Qe(Z),Cs=()=>ke(Z),Ls=e=>Ae(Z,S(e)),vs=()=>!Me(Y),ys=e=>Se(Y,S(e)),Is=(e,t)=>Se(Ae(U,S(e)),S(t)),ps=(e,t)=>Se(Ae(Y,S(e)),S(t)),Ts=(e,t,s)=>Se(Ae(Ae(Y,S(e)),S(t)),S(s)),Rs=()=>!Me(Z),Ss=e=>Se(Z,S(e)),Ms=e=>ls((()=>(e=>ve(e,ht,Yt))(e)?Tt(e):0)),Vs=e=>ls((()=>wt(e)?Dt(e):0)),ms=e=>{try{pt(_t(e))}catch{}return Gs},Ds=t=>ls((()=>{if((e=ve(t,(e=>ve(e,ut))))&&(yt(t),!Me(Y))){const e=is();Hs(),Ms(e)}})),Es=e=>ls((()=>{if(t=(e=>ve(e,ut))(e)){const s=ws();Fs(),Js(),t=!0,It(e),Vs(s)}})),Hs=()=>ls((()=>Tt({}))),ks=e=>ls((e=>Se(Y,e)?At(e):0),e),As=(e,t)=>ls(((e,t)=>F(Ae(Y,e),(s=>Se(s,t)?Jt(e,s,t):0))),e,t),Js=()=>ls((()=>Dt({}))),xs=()=>ls((()=>{yt({}),e=!1})),Fs=()=>ls((()=>{It({}),t=!1})),Os=(e,t)=>{if(-1!=o){Qs();const s=e();return zs(t),s}},Qs=()=>(-1!=o&&o++,1==o&&(c[0]?.(),lt(at)),Gs),zs=e=>(o>0&&(o--,0==o&&(o=1,ss(1),Me(D)||os(1),ns(1),Me(H)||rs(1),e?.(Gs)&&(De(D,((e,t)=>De(e,((e,s)=>De(e,(([e],n)=>Be(Gs,t,s,n,e))))))),me(D),De(H,(([e],t)=>Ue(Gs,t,e))),me(H)),lt(ot[0],void 0),o=-1,ss(0),Me(D)||os(0),ns(0),Me(H)||rs(0),c[1]?.(),lt(ot[1],void 0),c[2]?.(),o=0,s=vs(),n=Rs(),K([g,v,M,V,m,D,k,E,H,A],me))),Gs),Gs={getContent:()=>[is(),ws()],getTables:is,getTableIds:cs,getTable:e=>ze(Ae(Y,S(e))),getTableCellIds:ds,getRowCount:us,getRowIds:gs,getSortedRowIds:hs,getRow:(e,t)=>Qe(Ae(Ae(Y,S(e)),S(t))),getCellIds:fs,getCell:bs,getValues:ws,getValueIds:Cs,getValue:Ls,hasTables:vs,hasTable:ys,hasTableCell:Is,hasRow:ps,hasCell:Ts,hasValues:Rs,hasValue:Ss,getTablesJson:()=>Wt(Y),getValuesJson:()=>Wt(Z),getJson:()=>Wt([Y,Z]),getTablesSchemaJson:()=>Wt(J),getValuesSchemaJson:()=>Wt(P),getSchemaJson:()=>Wt([J,P]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>ls((()=>gt(e)?(([e,t])=>{(Ce(e)?Hs:Ms)(e),(Ce(t)?Js:Vs)(t)})(e):0)),setTables:Ms,setTable:(e,t)=>ls((e=>ht(t,e)?Rt(e,t):0),e),setRow:(e,t,s)=>ls(((e,t)=>ft(e,t,s)?St(e,kt(e),t,s):0),e,t),addRow:(e,t,s=!0)=>Os((()=>{let n;return ft(e,n,t)&&(e=S(e),St(e,kt(e),n=Ht(e,s?1:0),t)),n})),setPartialRow:(e,t,s)=>ls(((e,t)=>{if(ft(e,t,s,1)){const n=kt(e);we(s,((s,a)=>Vt(e,n,t,a,s)))}}),e,t),setCell:(e,t,s,n)=>ls(((e,t,s)=>F(bt(e,t,s,z(n)?n(bs(e,t,s)):n),(n=>Vt(e,kt(e),t,s,n)))),e,t,s),setValues:Vs,setPartialValues:e=>ls((()=>wt(e,1)?we(e,((e,t)=>Et(t,e))):0)),setValue:(e,t)=>ls((e=>F(Ct(e,z(t)?t(Ls(e)):t),(t=>Et(e,t)))),e),applyChanges:e=>ls((()=>{we(e[0],((e,t)=>x(e)?ks(t):we(e,((e,s)=>x(e)?As(t,s):we(e,((e,n)=>Be(Gs,t,s,n,e))))))),we(e[1],((e,t)=>Ue(Gs,t,e)))})),setTablesJson:ms,setValuesJson:e=>{try{mt(_t(e))}catch{}return Gs},setJson:e=>ls((()=>{try{const[t,s]=_t(e);pt(t),mt(s)}catch{ms(e)}})),setTablesSchema:Ds,setValuesSchema:Es,setSchema:(e,t)=>ls((()=>{Ds(e),Es(t)})),delTables:Hs,delTable:ks,delRow:As,delCell:(e,t,s,n)=>ls(((e,t,s)=>F(Ae(Y,e),(a=>F(Ae(a,t),(o=>Se(o,s)?xt(e,a,t,o,s,n):0))))),e,t,s),delValues:Js,delValue:e=>ls((e=>Se(Z,e)?Ft(e):0),e),delTablesSchema:xs,delValuesSchema:Fs,delSchema:()=>ls((()=>{xs(),Fs()})),transaction:Os,startTransaction:Qs,getTransactionChanges:()=>[Qe(D,((e,t)=>-1===Ae(g,t)?void 0:Qe(e,((e,s)=>-1===Ae(Ae(V,t),s)?void 0:Qe(e,(([,e])=>e),(e=>Pt(e)))),Me,Ce)),Me,Ce),Qe(H,(([,e])=>e),(e=>Pt(e))),1],getTransactionLog:()=>[!Me(D),!Me(H),Ge(D,Nt,Pt),Ge(k),Qe(H,Nt,Pt),Qe(A),Qe(g),ze(V),Ge(m),Qe(E)],finishTransaction:zs,forEachTable:e=>De(Y,((t,s)=>e(s,(e=>De(t,((t,s)=>e(s,(e=>Je(t,e))))))))),forEachTableCell:(e,t)=>Je(Ae(U,S(e)),t),forEachRow:(e,t)=>De(Ae(Y,S(e)),((e,s)=>t(s,(t=>Je(e,t))))),forEachCell:(e,t,s)=>Je(Ae(Ae(Y,S(e)),S(t)),s),forEachValue:e=>Je(Z,e),addSortedRowIdsListener:(e,t,s,n,a,o,r)=>{let l=hs(e,t,s,n,a);return rt((()=>{const r=hs(e,t,s,n,a);B(r,l)||(l=r,o(Gs,e,t,s,n,a,l))}),de[r?1:0],[e,t],[cs])},addStartTransactionListener:e=>rt(e,at),addWillFinishTransactionListener:e=>rt(e,ot[0]),addDidFinishTransactionListener:e=>rt(e,ot[1]),callListener:e=>(dt(e),Gs),delListener:e=>(it(e),Gs),getListenerStats:()=>({hasTables:zt(ee),tables:zt(te),tableIds:zt(ne),hasTable:zt(ae),table:zt(oe),tableCellIds:zt(re),hasTableCell:zt(le,Te),rowCount:zt(ie),rowIds:zt(ce),sortedRowIds:zt(de),hasRow:zt(ge,Te),row:zt(be,Te),cellIds:zt(Le,Te),hasCell:zt(ye,Re),cell:zt(Ve,Re),invalidCell:zt(_e,Re),hasValues:zt(Xe),values:zt(Ye),valueIds:zt(Ze),hasValue:zt(et),value:zt(nt),invalidValue:zt($e),transaction:pe(at)+zt(ot)}),isMergeable:()=>!1,createStore:$t,addListener:rt,callListeners:lt,setInternalListeners:(e,t,s,n,a)=>c=[e,t,s,n,a]};return we({[u+f]:[0,ee,[],()=>[vs()]],[f]:[0,te],[b]:[0,ne],[u+h]:[1,ae,[cs],e=>[ys(...e)]],[h]:[1,oe,[cs]],[h+I]:[1,re,[cs]],[u+h+y]:[2,le,[cs,ds],e=>[Is(...e)]],[C]:[1,ie,[cs]],[L]:[1,ce,[cs]],[u+w]:[2,ge,[cs,gs],e=>[ps(...e)]],[w]:[2,be,[cs,gs]],[I]:[2,Le,[cs,gs]],[u+y]:[3,ye,[cs,gs,fs],e=>[Ts(...e)]],[y]:[3,Ve,[cs,gs,fs],e=>Qt(bs(...e))],InvalidCell:[3,_e],[u+T]:[0,Xe,[],()=>[Rs()]],[T]:[0,Ye],[R]:[0,Ze],[u+p]:[1,et,[Cs],e=>[Ss(...e)]],[p]:[1,nt,[Cs],e=>Qt(Ls(e[0]))],InvalidValue:[1,$e]},(([e,t,s,n],a)=>{Gs[d+a+i]=(...a)=>rt(a[e],t[a[e+1]?1:0],e>0?N(a,0,e):void 0,s,n)})),ue(Gs)},Bt=2**36,Ut=2**30,qt=2**24,Kt=2**18,Xt=4096,Yt={HasTable:1,Table:1,TableCellIds:1,HasTableCell:2,RowCount:1,RowIds:1,SortedRowIds:5,HasRow:2,Row:2,CellIds:2,HasCell:3,Cell:3,HasValue:1,Value:1,InvalidCell:3,InvalidValue:1},Zt=(e=t)=>[Et(e),Et(e)],es=e=>{let s=1,n=Zt(),a=0;const o=He(),r=qe(),[l,i]=(e=>{let t=0,s=-1;const n=F(e,(e=>{const t=yt(e);return rt(t/qt)+rt(t/Kt)+rt(t/Xt)+rt(t/64)+rt(t)}),(()=>dt(5))),a=e=>{const n=t,[a,o]=x(e)||""==e?[0,0]:[lt(r=e,0)*Bt+lt(r,1)*Ut+lt(r,2)*qt+lt(r,3)*Kt+lt(r,4)*Xt+64*lt(r,5)+lt(r,6),lt(r,7)*Kt+lt(r,8)*Xt+64*lt(r,9)+lt(r,10)];var r;t=H(n,a,D.HLC_TIME??Date.now()),s=t==n?t==a?H(s,o):s:t==a?o:-1};return[()=>{return a(),o=++s,rt((e=t)/Bt)+rt(e/Ut)+rt(e/qt)+rt(e/Kt)+rt(e/Xt)+rt(e/64)+rt(e)+rt(o/Kt)+rt(o/Xt)+rt(o/64)+rt(o)+n;var e,o},a]})(e),c=$t(),d=e=>{const t=s;return s=0,e(),s=t,b},u=(e,s=0)=>{const a={},o={},[[r,l=t,c=0],d]=e,[u,h]=n,[f,b,w]=u;let C=s?c:w,L=l;be(r,(([e,n=t,o=0],r)=>{const l=Fe(f,r,Et),[i,c,d]=l;let u=s?o:d,h=n;be(e,((e,t)=>{const[n,o,l]=g(e,Fe(i,t,Et),Le(Le(a,r,ge),t,ge),s);u^=s?0:(o?St(t,o):0)^St(t,l),h=Vt(h,n)})),u^=s?0:Mt(c,n),mt(l,u,n),C^=s?0:(d?St(r,d):0)^St(r,l[2]),L=Vt(L,h)})),C^=s?0:Mt(b,l),mt(u,C,l);const[v]=g(d,h,o,s);return i(Vt(L,v)),[a,o,1]},g=(e,s,n,a)=>{const[o,r=t,l=0]=e,[i,c,d]=s;let u=r,g=a?l:d;return be(o,(([e,s,o=0],r)=>{const l=Fe(i,r,(()=>[void 0,t,0])),[,c,d]=l;(!c||s>c)&&(mt(l,a?o:yt(Wt(e??null)+":"+s),s),l[0]=e,n[r]=e,g^=a?0:St(r,d)^St(r,l[2]),u=Vt(u,s))})),g^=a?0:Mt(c,r),mt(s,g,r),[u,d,s[2]]},h=()=>[Ht(n[0],(e=>Ht(e,(e=>Ht(e))))),Ht(n[1])],f=e=>d((()=>c.applyChanges(u(e)))),b={getMergeableContent:h,getMergeableContentHashes:()=>[n[0][2],n[1][2]],getMergeableTableHashes:()=>Qe(n[0][0],Rt),getMergeableTableDiff:e=>{const t=Dt(n[0][1]),s={};return Je(n[0][0],((n,[a,o,r])=>he(e,n)?r!=e[n]?s[n]=r:0:t[0][n]=kt([a,o],(e=>kt(e))))),[t,s]},getMergeableRowHashes:e=>{const t={};return be(e,((e,s)=>F(Ae(n[0][0],s),(([n,,a])=>a!=e?Je(n,((e,[,,n])=>Le(t,s,ge)[e]=n)):0)))),t},getMergeableRowDiff:e=>{const t=Dt(n[0][1]),s={};return be(e,((e,a)=>Je(Ae(n[0][0],a)?.[0],((n,[o,r,l])=>he(e,n)?l!==e[n]?Le(s,a,ge)[n]=l:0:Le(t[0],a,Dt)[0][n]=kt([o,r]))))),[t,s]},getMergeableCellHashes:e=>{const t={};return be(e,((e,s)=>F(Ae(n[0][0],s),(([n])=>be(e,((e,a)=>F(Ae(n,a),(([n,,o])=>o!==e?Je(n,((e,[,,n])=>Le(Le(t,s,ge),a,ge)[e]=n)):0)))))))),t},getMergeableCellDiff:e=>{const[[t,s]]=n,a={};return be(e,((e,s)=>be(e,((e,n)=>F(Ae(t,s),(([t,o])=>F(Ae(t,n),(([t,r])=>Je(t,((t,[l,i,c])=>c!==e[t]?Le(Le(a,s,(()=>Dt(o)))[0],n,(()=>Dt(r)))[0][t]=[l,i]:0)))))))))),Tt(a,s)},getMergeableValueHashes:()=>Qe(n[1][0],Rt),getMergeableValueDiff:e=>{const[,[t,s]]=n,a=Qe(t,pt,(([,,t],s)=>t==e?.[s]));return Tt(a,s)},setMergeableContent:e=>d((()=>(e=>G(e)&&2==P(e)&&At(e[0],(e=>ve(e,(e=>At(e,(e=>ve(e,(e=>At(e,(e=>ve(e,(e=>At(e,$e)),void 0,1)))),void 0,1)))),void 0,1)))&&At(e[1],(e=>ve(e,(e=>At(e,$e)),void 0,1))))(e)?c.transaction((()=>{c.delTables().delValues(),n=Zt(),c.applyChanges(u(e,1))})):0)),setDefaultContent:e=>(c.transaction((()=>{a=1,c.setContent(e),a=0})),b),getTransactionMergeableChanges:()=>{const[[e,t],[s,a]]=n,l={};De(o,((t,s)=>F(Ae(e,s),(([e,n])=>{const a={};De(t,((t,s)=>F(Ae(e,s),(([e,n])=>{const o={};De(t,(t=>{F(Ae(e,t),(([e,s])=>o[t]=Tt(e,s)))})),a[s]=Tt(o,n)})))),l[s]=Tt(a,n)}))));const i={};return De(r,(e=>F(Ae(s,e),(([t,s])=>i[e]=Tt(t,s))))),[Tt(l,t),Tt(i,a),1]},applyMergeableChanges:f,merge:e=>{const t=h(),s=e.getMergeableContent();return e.applyMergeableChanges(t),f(s)}};return c.setInternalListeners((()=>{}),(()=>{}),(()=>{me(o),me(r)}),((e,n,r,i)=>{Ke(Fe(Fe(o,e,He),n,qe),r),s&&u([[{[e]:[{[n]:[{[r]:[i,a?t:l()]}]}]}],[{}],1])}),((e,n)=>{Ke(r,e),s&&u([[{}],[{[e]:[n,a?t:l()]}],1])})),we(c,((e,t)=>b[t]=M(t,"set")||M(t,"del")||M(t,"apply")||V(t,"Transaction")||"callListener"==t?(...t)=>(e(...t),b):M(t,"add")&&V(t,"Listener")?(...s)=>{const n=Yt[N(t,3,-8)]??0,a=s[n];return s[n]=(e,...t)=>a(b,...t),e(...s)}:"isMergeable"==t?()=>!0:e)),ue(b)};export{Jt as Message,bt as Persists,nt as createCheckpoints,Lt as createCustomPersister,xt as createCustomSynchronizer,ut as createIndexes,es as createMergeableStore,ft as createMetrics,Ft as createQueries,Ot as createRelationships,$t as createStore,ct as defaultSorter,dt as getUniqueId};
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@automerge/automerge-repo": "^1.2.0",
|
|
24
|
-
"@
|
|
25
|
-
"@libsql/client": "^0.
|
|
24
|
+
"@powersync/common": "^1.6.0",
|
|
25
|
+
"@libsql/client": "^0.8.0",
|
|
26
26
|
"@sqlite.org/sqlite-wasm": "^3.46.0-build2",
|
|
27
27
|
"@vlcn.io/crsqlite-wasm": "^0.16.0",
|
|
28
28
|
"electric-sql": "^0.12.1",
|
|
29
29
|
"expo": "^51.0.0",
|
|
30
|
-
"expo-sqlite": "^14.0.
|
|
31
|
-
"partykit": "^0.0.
|
|
32
|
-
"partysocket": "^1.0.
|
|
30
|
+
"expo-sqlite": "^14.0.5",
|
|
31
|
+
"partykit": "^0.0.108",
|
|
32
|
+
"partysocket": "^1.0.2",
|
|
33
33
|
"prettier": "^3.3.2",
|
|
34
34
|
"react": "^18.2.0",
|
|
35
35
|
"react-dom": "^18.2.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@automerge/automerge-repo": {
|
|
42
42
|
"optional": true
|
|
43
43
|
},
|
|
44
|
-
"@
|
|
44
|
+
"@powersync/common": {
|
|
45
45
|
"optional": true
|
|
46
46
|
},
|
|
47
47
|
"@libsql/client": {
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2></section><p><a href="https://tinybase.org/guides/releases/#v5-1"><em>NEW!</em> v5.1 release</a></p><p><span id="one-with">"The One You Can Sync... with a server!"</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It's <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It's <em>Database-Like</em></h2><p>Consumer app? Enterprise app? Or even a game? Model <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="#apply-schemas-to-tables-values">schematization</a>, whatever its data structures. There are built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - and a powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can deterministically <a href="https://tinybase.org/guides/synchronization/">synchronize</a> and merge data across multiple sources, clients, and servers. And although TinyBase is an in-memory data store, but you can easily <a href="#persist-to-storage-sqlite-more">persist</a> your data to file, <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, <a href="https://tinybase.org/guides/persistence/database-persistence/">SQLite databases</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It's Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it's especially great for local-first apps: where data is stored locally on the user's device and that can be run offline. It's tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 12.7kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg">Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg">PowerSync</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.1.
|
|
1
|
+
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2></section><p><a href="https://tinybase.org/guides/releases/#v5-1"><em>NEW!</em> v5.1 release</a></p><p><span id="one-with">"The One You Can Sync... with a server!"</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It's <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It's <em>Database-Like</em></h2><p>Consumer app? Enterprise app? Or even a game? Model <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="#apply-schemas-to-tables-values">schematization</a>, whatever its data structures. There are built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - and a powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can deterministically <a href="https://tinybase.org/guides/synchronization/">synchronize</a> and merge data across multiple sources, clients, and servers. And although TinyBase is an in-memory data store, but you can easily <a href="#persist-to-storage-sqlite-more">persist</a> your data to file, <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, <a href="https://tinybase.org/guides/persistence/database-persistence/">SQLite databases</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It's Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it's especially great for local-first apps: where data is stored locally on the user's device and that can be run offline. It's tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 12.7kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg">Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg">PowerSync</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.1.2" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&logo=npm&logoColor=%23fff&labelColor=%23bd0005&color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
4
|
import {createStore} from 'tinybase';
|
|
@@ -292,4 +292,4 @@ export const createShop: typeof createShopDecl = () => {
|
|
|
292
292
|
};
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
-
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.7kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>4.6kB</em>, the ui-react-dom components are another <em>2.5kB</em>, and everything is super fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.5kB</td></tr><tr><th class="right">tinybase (complete)</th><td>12.7kB</td><td>130.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react/">ui-react</a></th><td>4.6kB</td><td>48.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,373</td><td>2,373</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,561</td><td>2,561</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,004</td><td>1,004</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>947</td><td>947</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,821</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,030</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>
|
|
295
|
+
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.7kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>4.6kB</em>, the ui-react-dom components are another <em>2.5kB</em>, and everything is super fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.5kB</td></tr><tr><th class="right">tinybase (complete)</th><td>12.7kB</td><td>130.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react/">ui-react</a></th><td>4.6kB</td><td>48.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,380</td><td>2,380</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,567</td><td>2,567</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,006</td><td>1,006</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>951</td><td>951</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,851</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,074</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>
|
package/releases.md
CHANGED
|
@@ -8,8 +8,14 @@ import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
|
8
8
|
|
|
9
9
|
const persistingServer = createWsServer(
|
|
10
10
|
new WebSocketServer({port: 8051}),
|
|
11
|
-
(pathId) =>
|
|
11
|
+
(pathId) =>
|
|
12
|
+
createFilePersister(
|
|
13
|
+
createMergeableStore(),
|
|
14
|
+
pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
|
|
15
|
+
),
|
|
12
16
|
);
|
|
17
|
+
|
|
18
|
+
persistingServer.destroy();
|
|
13
19
|
```
|
|
14
20
|
|
|
15
21
|
<p>This is a very crude (and not production-safe!) example, but demonstrates a server that will create a file, based on any path that clients connect to, and persist data to it. See the <a href="https://tinybase.org/api/synchronizer-ws-server/functions/creation/createwsserver/"><code>createWsServer</code></a> function documentation for more details.</p><p>This implementation is still experimental so please kick the tires!</p><p>There is one small breaking change in this release: the functions for creating <a href="https://tinybase.org/api/synchronizers/interfaces/synchronizer/synchronizer/"><code>Synchronizer</code></a> objects can now take optional onSend and onReceive callbacks that will fire whenever messages pass through the <a href="https://tinybase.org/api/synchronizers/interfaces/synchronizer/synchronizer/"><code>Synchronizer</code></a>. See, for example, the <a href="https://tinybase.org/api/synchronizer-ws-client/functions/creation/createwssynchronizer/"><code>createWsSynchronizer</code></a> function. These are suitable for debugging synchronization issues in a development environment.</p><h2 id="v5-0">v5.0</h2><p>We're excited to announce this major release for <a href="https://tinybase.org/">TinyBase</a>! It includes important data synchronization functionality and a range of other improvements.</p><h2 id="in-summary">In Summary</h2><ul><li><a href="#the-new-mergeableStore-type">The new MergeableStore type</a> wraps your data as a Conflict-Free Replicated Data Type (CRDT).</li><li><a href="#the-new-synchronizer-framework">The new Synchronizer framework</a> keeps multiple instances of data in sync across different media.</li><li>An <a href="#improved-module-folder-structure">improved module folder structure</a> removes common packaging and bundling issues.</li><li>The <a href="https://tinybase.org/">TinyBase</a> Inspector is now in its own standalone <a href="https://tinybase.org/api/ui-react-inspector/"><code>ui-react-inspector</code></a> module.</li><li><a href="https://tinybase.org/">TinyBase</a> now supports only Expo SQLite v14 (<a href="https://expo.dev/changelog/2024/05-07-sdk-51">SDK 51</a>) and above.</li></ul><p>There are also some small <a href="#breaking-changes-in-v50">breaking changes</a> that may affect you (but which should easy to fix if they do).</p><p>Let's look at the major functionality in more detail!</p><h3 id="the-new-mergeablestore-type">The New <a href="https://tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> Type</h3><p>A key part of <a href="https://tinybase.org/">TinyBase</a> v5.0 is the new <a href="https://tinybase.org/api/mergeable-store/"><code>mergeable-store</code></a> module, which contains a subtype of <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> - called <a href="https://tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> - that can be merged with another with deterministic results. The implementation uses an encoded hybrid logical clock (HLC) to timestamp the changes made so that they can be cleanly merged.</p><p>The <a href="https://tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/methods/getter/getmergeablecontent/"><code>getMergeableContent</code></a> method on a <a href="https://tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> is used to get the state of a store that can be merged into another. The <a href="https://tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/methods/setter/applymergeablechanges/"><code>applyMergeableChanges</code></a> method will let you apply that to (another) store. The <a href="https://tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/methods/setter/merge/"><code>merge</code></a> method is a convenience function to bidirectionally merge two stores together:</p>
|
|
@@ -616,16 +616,18 @@ const createWsServer = (webSocketServer, createPersisterForPath) => {
|
|
|
616
616
|
() => wsServer,
|
|
617
617
|
);
|
|
618
618
|
const configureServerClient = (serverClient, pathId, clients) =>
|
|
619
|
-
ifNotUndefined(createPersisterForPath?.(pathId), (
|
|
619
|
+
ifNotUndefined(createPersisterForPath?.(pathId), (persisterMaybeThen) => {
|
|
620
620
|
serverClient[0 /* State */] = 1;
|
|
621
|
-
serverClient[1 /* Persister */] =
|
|
621
|
+
serverClient[1 /* Persister */] = isArray(persisterMaybeThen)
|
|
622
|
+
? persisterMaybeThen[0]
|
|
623
|
+
: persisterMaybeThen;
|
|
622
624
|
const messageHandler = getMessageHandler(
|
|
623
625
|
SERVER_CLIENT_ID,
|
|
624
626
|
clients,
|
|
625
627
|
serverClient,
|
|
626
628
|
);
|
|
627
629
|
serverClient[2 /* Synchronizer */] = createCustomSynchronizer(
|
|
628
|
-
|
|
630
|
+
serverClient[1 /* Persister */].getStore(),
|
|
629
631
|
(toClientId, requestId, message, body) =>
|
|
630
632
|
messageHandler(createPayload(toClientId, requestId, message, body)),
|
|
631
633
|
(receive) =>
|
|
@@ -635,6 +637,9 @@ const createWsServer = (webSocketServer, createPersisterForPath) => {
|
|
|
635
637
|
1,
|
|
636
638
|
);
|
|
637
639
|
serverClient[4 /* Buffer */] = [];
|
|
640
|
+
serverClient[5 /* Then */] = isArray(persisterMaybeThen)
|
|
641
|
+
? persisterMaybeThen[1]
|
|
642
|
+
: (_) => 0;
|
|
638
643
|
});
|
|
639
644
|
const startServerClient = async (serverClient) => {
|
|
640
645
|
serverClient[0 /* State */] = 2 /* Starting */;
|
|
@@ -643,6 +648,7 @@ const createWsServer = (webSocketServer, createPersisterForPath) => {
|
|
|
643
648
|
serverClient[1 /* Persister */].startAutoSave,
|
|
644
649
|
serverClient[2 /* Synchronizer */].startSync,
|
|
645
650
|
);
|
|
651
|
+
serverClient[5 /* Then */](serverClient[1 /* Persister */].getStore());
|
|
646
652
|
serverClient[0 /* State */] = 0 /* Ready */;
|
|
647
653
|
};
|
|
648
654
|
const stopServerClient = (serverClient) => {
|
|
@@ -725,8 +731,9 @@ const createWsServer = (webSocketServer, createPersisterForPath) => {
|
|
|
725
731
|
clients: collSize2(clientsByPath),
|
|
726
732
|
});
|
|
727
733
|
const destroy = () => {
|
|
728
|
-
webSocketServer.close();
|
|
729
734
|
collClear(clientsByPath);
|
|
735
|
+
collForEach(serverClientsByPath, stopServerClient);
|
|
736
|
+
webSocketServer.close();
|
|
730
737
|
};
|
|
731
738
|
const wsServer = {
|
|
732
739
|
getWebSocketServer,
|