tinybase 8.4.0-beta.0 → 8.4.0

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.
Files changed (40) hide show
  1. package/@types/ui-react-dom/index.d.ts +10 -10
  2. package/@types/ui-react-dom/with-schemas/index.d.ts +10 -10
  3. package/@types/ui-react-inspector/index.d.ts +1 -1
  4. package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
  5. package/@types/ui-solid-dom/index.d.ts +2013 -0
  6. package/@types/ui-solid-dom/with-schemas/index.d.ts +2064 -0
  7. package/@types/ui-solid-inspector/index.d.ts +73 -0
  8. package/@types/ui-solid-inspector/with-schemas/index.d.ts +73 -0
  9. package/@types/ui-svelte-dom/index.d.ts +10 -10
  10. package/@types/ui-svelte-dom/with-schemas/index.d.ts +10 -10
  11. package/@types/ui-svelte-inspector/index.d.ts +1 -1
  12. package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
  13. package/agents.md +10 -0
  14. package/min/ui-solid/index.js +1 -1
  15. package/min/ui-solid/index.js.gz +0 -0
  16. package/min/ui-solid/with-schemas/index.js +1 -1
  17. package/min/ui-solid/with-schemas/index.js.gz +0 -0
  18. package/min/ui-solid-dom/index.js +1 -0
  19. package/min/ui-solid-dom/index.js.gz +0 -0
  20. package/min/ui-solid-dom/with-schemas/index.js +1 -0
  21. package/min/ui-solid-dom/with-schemas/index.js.gz +0 -0
  22. package/min/ui-solid-inspector/index.js +1 -0
  23. package/min/ui-solid-inspector/index.js.gz +0 -0
  24. package/min/ui-solid-inspector/with-schemas/index.js +1 -0
  25. package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
  26. package/min/ui-svelte-inspector/index.js +1 -1
  27. package/min/ui-svelte-inspector/index.js.gz +0 -0
  28. package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
  29. package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
  30. package/package.json +76 -2
  31. package/readme.md +14 -14
  32. package/releases.md +98 -62
  33. package/ui-solid/index.js +208 -104
  34. package/ui-solid/with-schemas/index.js +208 -104
  35. package/ui-solid-dom/index.js +1575 -0
  36. package/ui-solid-dom/with-schemas/index.js +1575 -0
  37. package/ui-solid-inspector/index.js +5621 -0
  38. package/ui-solid-inspector/with-schemas/index.js +5621 -0
  39. package/ui-svelte-inspector/index.js +6 -2
  40. package/ui-svelte-inspector/with-schemas/index.js +6 -2
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The ui-solid-inspector module of the TinyBase project provides a component to
3
+ * help debug the state of your TinyBase stores and other objects.
4
+ *
5
+ * The component in this module uses the Solid DOM runtime and so is not
6
+ * appropriate for non-DOM environments.
7
+ * @see <Inspector /> (Solid) demo
8
+ * @packageDocumentation
9
+ * @module ui-solid-inspector
10
+ * @since v8.4.0
11
+ */
12
+ import type {ComponentReturnType} from '../ui-solid/index.d.ts';
13
+
14
+ /**
15
+ * InspectorProps props are used to configure the Inspector component.
16
+ * @category Props
17
+ * @since v8.4.0
18
+ */
19
+ export type InspectorProps = {
20
+ /**
21
+ * An optional string to indicate where you want the inspector to first
22
+ * appear.
23
+ * @category Prop
24
+ * @since v8.4.0
25
+ */
26
+ readonly position?: 'top' | 'right' | 'bottom' | 'left' | 'full';
27
+ /**
28
+ * An optional boolean to indicate whether the inspector should start in the
29
+ * opened state.
30
+ * @category Prop
31
+ * @since v8.4.0
32
+ */
33
+ readonly open?: boolean;
34
+ /**
35
+ * An optional number to indicate the hue of the inspector's UI, defaulting to
36
+ * 270.
37
+ * @category Prop
38
+ * @since v8.4.0
39
+ */
40
+ readonly hue?: number;
41
+ };
42
+
43
+ /**
44
+ * The Inspector component renders a tool which allows you to view and edit the
45
+ * content of a Store in a debug web environment.
46
+ *
47
+ * See the <Inspector /> (Solid) demo for this component in action:
48
+ *
49
+ * ![Inspector example](https://tinybase.org/shots/inspector-solid-demo.png
50
+ * "Inspector example")
51
+ *
52
+ * The component displays a nub in the corner of the screen which you may then
53
+ * click to interact with all the Store objects in the Provider component
54
+ * context.
55
+ *
56
+ * The component's props identify the nub's initial location and panel state,
57
+ * though subsequent user changes to that will be preserved on each reload.
58
+ * @param props The props for this component.
59
+ * @returns The rendering of the inspector tool.
60
+ * @example
61
+ * This example imports the Inspector component from the module.
62
+ *
63
+ * ```js
64
+ * import {Inspector} from 'tinybase/ui-solid-inspector';
65
+ *
66
+ * console.log(typeof Inspector);
67
+ * // -> 'function'
68
+ * ```
69
+ * @category Development components
70
+ * @essential Using Solid
71
+ * @since v8.4.0
72
+ */
73
+ export function Inspector(props: InspectorProps): ComponentReturnType;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The ui-solid-inspector module of the TinyBase project provides a component to
3
+ * help debug the state of your TinyBase stores and other objects.
4
+ *
5
+ * The component in this module uses the Solid DOM runtime and so is not
6
+ * appropriate for non-DOM environments.
7
+ * @see <Inspector /> (Solid) demo
8
+ * @packageDocumentation
9
+ * @module ui-solid-inspector
10
+ * @since v8.4.0
11
+ */
12
+ import type {ComponentReturnType} from '../../_internal/ui-solid/with-schemas/index.d.ts';
13
+
14
+ /**
15
+ * InspectorProps props are used to configure the Inspector component.
16
+ * @category Props
17
+ * @since v8.4.0
18
+ */
19
+ export type InspectorProps = {
20
+ /**
21
+ * An optional string to indicate where you want the inspector to first
22
+ * appear.
23
+ * @category Prop
24
+ * @since v8.4.0
25
+ */
26
+ readonly position?: 'top' | 'right' | 'bottom' | 'left' | 'full';
27
+ /**
28
+ * An optional boolean to indicate whether the inspector should start in the
29
+ * opened state.
30
+ * @category Prop
31
+ * @since v8.4.0
32
+ */
33
+ readonly open?: boolean;
34
+ /**
35
+ * An optional number to indicate the hue of the inspector's UI, defaulting to
36
+ * 270.
37
+ * @category Prop
38
+ * @since v8.4.0
39
+ */
40
+ readonly hue?: number;
41
+ };
42
+
43
+ /**
44
+ * The Inspector component renders a tool which allows you to view and edit the
45
+ * content of a Store in a debug web environment.
46
+ *
47
+ * See the <Inspector /> (Solid) demo for this component in action:
48
+ *
49
+ * ![Inspector example](https://tinybase.org/shots/inspector-solid-demo.png
50
+ * "Inspector example")
51
+ *
52
+ * The component displays a nub in the corner of the screen which you may then
53
+ * click to interact with all the Store objects in the Provider component
54
+ * context.
55
+ *
56
+ * The component's props identify the nub's initial location and panel state,
57
+ * though subsequent user changes to that will be preserved on each reload.
58
+ * @param props The props for this component.
59
+ * @returns The rendering of the inspector tool.
60
+ * @example
61
+ * This example imports the Inspector component from the module.
62
+ *
63
+ * ```js
64
+ * import {Inspector} from 'tinybase/ui-solid-inspector';
65
+ *
66
+ * console.log(typeof Inspector);
67
+ * // -> 'function'
68
+ * ```
69
+ * @category Development components
70
+ * @essential Using Solid
71
+ * @since v8.4.0
72
+ */
73
+ export function Inspector(props: InspectorProps): ComponentReturnType;
@@ -690,7 +690,7 @@ export type SortedTablePaginatorProps = {
690
690
  *
691
691
  * See the <TableInHtmlTable /> (Svelte) demo for this component in action:
692
692
  *
693
- * ![TableInHtmlTable example](https://beta.tinybase.org/shots/tableinhtmltable-svelte-demo.png
693
+ * ![TableInHtmlTable example](https://tinybase.org/shots/tableinhtmltable-svelte-demo.png
694
694
  * "TableInHtmlTable example")
695
695
  *
696
696
  * The component's props identify which Table to render based on Table Id, and
@@ -854,7 +854,7 @@ export const TableInHtmlTable: Component<
854
854
  * See the <SortedTableInHtmlTable /> (Svelte) demo for this component in
855
855
  * action:
856
856
  *
857
- * ![SortedTableInHtmlTable example](https://beta.tinybase.org/shots/sortedtableinhtmltable-svelte-demo.png
857
+ * ![SortedTableInHtmlTable example](https://tinybase.org/shots/sortedtableinhtmltable-svelte-demo.png
858
858
  * "SortedTableInHtmlTable example")
859
859
  *
860
860
  * The component's props identify which Table to render based on Table Id, and
@@ -1042,7 +1042,7 @@ export const SortedTableInHtmlTable: Component<
1042
1042
  *
1043
1043
  * See the <ValuesInHtmlTable /> (Svelte) demo for this component in action:
1044
1044
  *
1045
- * ![ValuesInHtmlTable example](https://beta.tinybase.org/shots/valuesinhtmltable-svelte-demo.png
1045
+ * ![ValuesInHtmlTable example](https://tinybase.org/shots/valuesinhtmltable-svelte-demo.png
1046
1046
  * "ValuesInHtmlTable example")
1047
1047
  *
1048
1048
  * The component's props identify which Row to render based on Table Id, Row Id,
@@ -1185,7 +1185,7 @@ export const ValuesInHtmlTable: Component<
1185
1185
  *
1186
1186
  * See the <SliceInHtmlTable /> (Svelte) demo for this component in action:
1187
1187
  *
1188
- * ![SliceInHtmlTable example](https://beta.tinybase.org/shots/sliceinhtmltable-svelte-demo.png
1188
+ * ![SliceInHtmlTable example](https://tinybase.org/shots/sliceinhtmltable-svelte-demo.png
1189
1189
  * "SliceInHtmlTable example")
1190
1190
  *
1191
1191
  * The component's props identify which Slice to render based on Index Id, Slice
@@ -1357,7 +1357,7 @@ export const SliceInHtmlTable: Component<
1357
1357
  * See the <RelationshipInHtmlTable /> (Svelte) demo for this component in
1358
1358
  * action:
1359
1359
  *
1360
- * ![RelationshipInHtmlTable example](https://beta.tinybase.org/shots/relationshipinhtmltable-svelte-demo.png
1360
+ * ![RelationshipInHtmlTable example](https://tinybase.org/shots/relationshipinhtmltable-svelte-demo.png
1361
1361
  * "RelationshipInHtmlTable example")
1362
1362
  *
1363
1363
  * The component's props identify which Relationship to render based on
@@ -1544,7 +1544,7 @@ export const RelationshipInHtmlTable: Component<
1544
1544
  * See the <ResultTableInHtmlTable /> (Svelte) demo for this component in
1545
1545
  * action:
1546
1546
  *
1547
- * ![ResultTableInHtmlTable example](https://beta.tinybase.org/shots/resulttableinhtmltable-svelte-demo.png
1547
+ * ![ResultTableInHtmlTable example](https://tinybase.org/shots/resulttableinhtmltable-svelte-demo.png
1548
1548
  * "ResultTableInHtmlTable example")
1549
1549
  *
1550
1550
  * The component's props identify which ResultTable to render based on query Id,
@@ -1713,7 +1713,7 @@ export const ResultTableInHtmlTable: Component<
1713
1713
  * See the <ResultSortedTableInHtmlTable /> (Svelte) demo for this component in
1714
1714
  * action:
1715
1715
  *
1716
- * ![ResultSortedTableInHtmlTable example](https://beta.tinybase.org/shots/resultsortedtableinhtmltable-svelte-demo.png
1716
+ * ![ResultSortedTableInHtmlTable example](https://tinybase.org/shots/resultsortedtableinhtmltable-svelte-demo.png
1717
1717
  * "ResultSortedTableInHtmlTable example")
1718
1718
  *
1719
1719
  * The component's props identify which ResultTable to render based on query Id,
@@ -1902,7 +1902,7 @@ export const ResultSortedTableInHtmlTable: Component<
1902
1902
  *
1903
1903
  * See the <EditableCellView /> (Svelte) demo for this component in action:
1904
1904
  *
1905
- * ![EditableCellView example](https://beta.tinybase.org/shots/editablecellview-svelte-demo.png
1905
+ * ![EditableCellView example](https://tinybase.org/shots/editablecellview-svelte-demo.png
1906
1906
  * "EditableCellView example")
1907
1907
  *
1908
1908
  * The component's props identify which Cell to render based on Table Id, Row
@@ -1975,7 +1975,7 @@ export const EditableCellView: Component<
1975
1975
  *
1976
1976
  * See the <EditableValueView /> (Svelte) demo for this component in action:
1977
1977
  *
1978
- * ![EditableValueView example](https://beta.tinybase.org/shots/editablevalueview-svelte-demo.png
1978
+ * ![EditableValueView example](https://tinybase.org/shots/editablevalueview-svelte-demo.png
1979
1979
  * "EditableValueView example")
1980
1980
  *
1981
1981
  * The component's props identify which Value to render based on Table Id, Row
@@ -2050,7 +2050,7 @@ export const EditableValueView: Component<
2050
2050
  * See the <SortedTableInHtmlTable /> (Svelte) demo for this component in
2051
2051
  * action:
2052
2052
  *
2053
- * ![SortedTablePaginator example](https://beta.tinybase.org/shots/sortedtablepaginator-svelte-demo.png
2053
+ * ![SortedTablePaginator example](https://tinybase.org/shots/sortedtablepaginator-svelte-demo.png
2054
2054
  * "SortedTablePaginator example")
2055
2055
  *
2056
2056
  * The component displays 'previous' and 'next' buttons for paging through the
@@ -670,7 +670,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
670
670
  *
671
671
  * See the <TableInHtmlTable /> (Svelte) demo for this component in action:
672
672
  *
673
- * ![TableInHtmlTable example](https://beta.tinybase.org/shots/tableinhtmltable-svelte-demo.png
673
+ * ![TableInHtmlTable example](https://tinybase.org/shots/tableinhtmltable-svelte-demo.png
674
674
  * "TableInHtmlTable example")
675
675
  *
676
676
  * The component's props identify which Table to render based on Table Id, and
@@ -840,7 +840,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
840
840
  * See the <SortedTableInHtmlTable /> (Svelte) demo for this component in
841
841
  * action:
842
842
  *
843
- * ![SortedTableInHtmlTable example](https://beta.tinybase.org/shots/sortedtableinhtmltable-svelte-demo.png
843
+ * ![SortedTableInHtmlTable example](https://tinybase.org/shots/sortedtableinhtmltable-svelte-demo.png
844
844
  * "SortedTableInHtmlTable example")
845
845
  *
846
846
  * The component's props identify which Table to render based on Table Id, and
@@ -1036,7 +1036,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1036
1036
  *
1037
1037
  * See the <ValuesInHtmlTable /> (Svelte) demo for this component in action:
1038
1038
  *
1039
- * ![ValuesInHtmlTable example](https://beta.tinybase.org/shots/valuesinhtmltable-svelte-demo.png
1039
+ * ![ValuesInHtmlTable example](https://tinybase.org/shots/valuesinhtmltable-svelte-demo.png
1040
1040
  * "ValuesInHtmlTable example")
1041
1041
  *
1042
1042
  * The component's props identify which Row to render based on Table Id, Row Id,
@@ -1187,7 +1187,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1187
1187
  *
1188
1188
  * See the <SliceInHtmlTable /> (Svelte) demo for this component in action:
1189
1189
  *
1190
- * ![SliceInHtmlTable example](https://beta.tinybase.org/shots/sliceinhtmltable-svelte-demo.png
1190
+ * ![SliceInHtmlTable example](https://tinybase.org/shots/sliceinhtmltable-svelte-demo.png
1191
1191
  * "SliceInHtmlTable example")
1192
1192
  *
1193
1193
  * The component's props identify which Slice to render based on Index Id, Slice
@@ -1365,7 +1365,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1365
1365
  * See the <RelationshipInHtmlTable /> (Svelte) demo for this component in
1366
1366
  * action:
1367
1367
  *
1368
- * ![RelationshipInHtmlTable example](https://beta.tinybase.org/shots/relationshipinhtmltable-svelte-demo.png
1368
+ * ![RelationshipInHtmlTable example](https://tinybase.org/shots/relationshipinhtmltable-svelte-demo.png
1369
1369
  * "RelationshipInHtmlTable example")
1370
1370
  *
1371
1371
  * The component's props identify which Relationship to render based on
@@ -1560,7 +1560,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1560
1560
  * See the <ResultTableInHtmlTable /> (Svelte) demo for this component in
1561
1561
  * action:
1562
1562
  *
1563
- * ![ResultTableInHtmlTable example](https://beta.tinybase.org/shots/resulttableinhtmltable-svelte-demo.png
1563
+ * ![ResultTableInHtmlTable example](https://tinybase.org/shots/resulttableinhtmltable-svelte-demo.png
1564
1564
  * "ResultTableInHtmlTable example")
1565
1565
  *
1566
1566
  * The component's props identify which ResultTable to render based on query Id,
@@ -1737,7 +1737,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1737
1737
  * See the <ResultSortedTableInHtmlTable /> (Svelte) demo for this component in
1738
1738
  * action:
1739
1739
  *
1740
- * ![ResultSortedTableInHtmlTable example](https://beta.tinybase.org/shots/resultsortedtableinhtmltable-svelte-demo.png
1740
+ * ![ResultSortedTableInHtmlTable example](https://tinybase.org/shots/resultsortedtableinhtmltable-svelte-demo.png
1741
1741
  * "ResultSortedTableInHtmlTable example")
1742
1742
  *
1743
1743
  * The component's props identify which ResultTable to render based on query Id,
@@ -1934,7 +1934,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1934
1934
  *
1935
1935
  * See the <EditableCellView /> (Svelte) demo for this component in action:
1936
1936
  *
1937
- * ![EditableCellView example](https://beta.tinybase.org/shots/editablecellview-svelte-demo.png
1937
+ * ![EditableCellView example](https://tinybase.org/shots/editablecellview-svelte-demo.png
1938
1938
  * "EditableCellView example")
1939
1939
  *
1940
1940
  * The component's props identify which Cell to render based on Table Id, Row
@@ -2021,7 +2021,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2021
2021
  *
2022
2022
  * See the <EditableValueView /> (Svelte) demo for this component in action:
2023
2023
  *
2024
- * ![EditableValueView example](https://beta.tinybase.org/shots/editablevalueview-svelte-demo.png
2024
+ * ![EditableValueView example](https://tinybase.org/shots/editablevalueview-svelte-demo.png
2025
2025
  * "EditableValueView example")
2026
2026
  *
2027
2027
  * The component's props identify which Value to render based on Table Id, Row
@@ -2096,7 +2096,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2096
2096
  * See the <SortedTableInHtmlTable /> (Svelte) demo for this component in
2097
2097
  * action:
2098
2098
  *
2099
- * ![SortedTablePaginator example](https://beta.tinybase.org/shots/sortedtablepaginator-svelte-demo.png
2099
+ * ![SortedTablePaginator example](https://tinybase.org/shots/sortedtablepaginator-svelte-demo.png
2100
2100
  * "SortedTablePaginator example")
2101
2101
  *
2102
2102
  * The component displays 'previous' and 'next' buttons for paging through the
@@ -46,7 +46,7 @@ export type InspectorProps = {
46
46
  *
47
47
  * See the <Inspector /> (Svelte) demo for this component in action:
48
48
  *
49
- * ![Inspector example](https://beta.tinybase.org/shots/inspector-svelte-demo.png
49
+ * ![Inspector example](https://tinybase.org/shots/inspector-svelte-demo.png
50
50
  * "Inspector example")
51
51
  *
52
52
  * The component displays a nub in the corner of the screen which you may then
@@ -46,7 +46,7 @@ export type InspectorProps = {
46
46
  *
47
47
  * See the <Inspector /> (Svelte) demo for this component in action:
48
48
  *
49
- * ![Inspector example](https://beta.tinybase.org/shots/inspector-svelte-demo.png
49
+ * ![Inspector example](https://tinybase.org/shots/inspector-svelte-demo.png
50
50
  * "Inspector example")
51
51
  *
52
52
  * The component displays a nub in the corner of the screen which you may then
package/agents.md CHANGED
@@ -92,6 +92,10 @@ Optional UI modules provide:
92
92
  `useRow`, `useTable`, `useTables`, `useValue`, and component/context support
93
93
  - **React DOM Components**: `ui-react-dom` with interactive tables
94
94
  - **React Inspector**: `ui-react-inspector` for debugging and editing data
95
+ - **Solid Primitives & Components**: `ui-solid` with primitives like `useCell`,
96
+ `useRow`, `useTable`, `useTables`, `useValue`, and component/context support
97
+ - **Solid DOM Components**: `ui-solid-dom` with interactive tables
98
+ - **Solid Inspector**: `ui-solid-inspector` for debugging and editing data
95
99
  - **Svelte Reactivity & Components**: `ui-svelte` with reactive functions,
96
100
  components, and context support
97
101
  - **Svelte DOM Components**: `ui-svelte-dom` with interactive tables
@@ -117,6 +121,9 @@ tinybase/synchronizers/synchronizer-* # Sync transports
117
121
  tinybase/ui-react # React hooks
118
122
  tinybase/ui-react-dom # React DOM components
119
123
  tinybase/ui-react-inspector # DevTools
124
+ tinybase/ui-solid # Solid primitives
125
+ tinybase/ui-solid-dom # Solid DOM components
126
+ tinybase/ui-solid-inspector # DevTools
120
127
  tinybase/ui-svelte # Svelte reactivity & components
121
128
  tinybase/ui-svelte-dom # Svelte DOM components
122
129
  tinybase/ui-svelte-inspector # DevTools
@@ -200,6 +207,9 @@ tinybase/
200
207
  │ ├── ui-react/ # React hooks
201
208
  │ ├── ui-react-dom/ # React DOM components
202
209
  │ ├── ui-react-inspector/ # DevTools
210
+ │ ├── ui-solid/ # Solid primitives
211
+ │ ├── ui-solid-dom/ # Solid DOM components
212
+ │ ├── ui-solid-inspector/ # DevTools
203
213
  │ ├── ui-svelte/ # Svelte reactivity & components
204
214
  │ ├── ui-svelte-dom/ # Svelte DOM components
205
215
  │ ├── ui-svelte-inspector/ # DevTools
@@ -1 +1 @@
1
- import{createContext as e,useContext as t,createRenderEffect as o,untrack as r,onCleanup as s,createSignal as n,createMemo as d,createEffect as u}from"solid-js";import l from"solid-js/h";const c=e=>typeof e,I="",i=c(I),a=c(c),p="Result",g="Has",b="Ids",m="Table",w=m+"s",C=m+b,h="Row",y=h+"Count",v=h+b,P="Sorted"+h+b,q="Cell",R=q+b,k="Value",f=k+"s",x=k+b,B="Transaction",T="Partial",V="Finish",S="Status",L="Metric",j="Slice",z="RemoteRowId",A="Local",F="Linked",O="Checkpoint",D=e=>(t,o,r)=>e(t)?r?.():o(t),H=globalThis,M=e=>null==e,Q=e=>void 0===e,W=D(M),_=D(Q),E=e=>c(e)==i,G=e=>c(e)==a,J=e=>Array.isArray(e),K=e=>e.length,N=()=>{},U=e=>e,X=(e,t)=>e.every(t),Y=(e,t)=>K(e)===K(t)&&X(e,(e,o)=>t[o]===e),Z=(e,t)=>J(e)&&J(t)?Y(e,t):e===t,$=(e,t)=>e.map(t),ee=(e,t,o)=>e.with(t,o),te=Object,oe=e=>te.getPrototypeOf(e),re=te.entries,se=e=>!M(e)&&W(oe(e),e=>e==te.prototype||M(oe(e)),()=>!0),ne=te.keys,de=(e,t)=>_(e,e=>e[t]),ue=(e,t,o=(e,t)=>e===t)=>{const r=re(e);return K(r)===K(ne(t))&&X(r,([e,r])=>se(r)?!!se(t[e])&&ue(t[e],r,o):o(r,t[e]))},le=e=>G(e)?e():e,ce=(e,...t)=>Q(e)?{}:e(...t),Ie=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],ie="tinybase_uisc",ae=()=>[],pe={value:ae},ge=H,be=ge[ie]?ge[ie]:ge[ie]=e(pe),me=(e,o)=>{const r=t(be)?.value??ae;return()=>{const t=r(),s=le(e);return Q(s)?t[2*o]:E(s)?de(t[2*o+1],s):s}},we=(e,t)=>{const o=me(e,t);return()=>{const t=le(e);return Q(t)||E(t)?o():t}},Ce=(e,n,d)=>{const u=t(be)?.value??ae;o(()=>{const{16:t,17:o}=r(u);t?.(d,e,n),s(()=>o?.(d,e))})},he=e=>{const o=t(be)?.value??ae;return()=>ne(o()[2*e+1]??{})},ye=0,ve=1,Pe=2,qe=3,Re=4,ke=5,fe=6,xe=7,Be=(e,t,o,r,s)=>[o??t[2*e],{...t[2*e+1],...r,...s[e]}],Te=()=>[],Ve=e=>{const o=t(be)?.value??Te,[r,s]=n($([,,,,,,,,].fill(0),(e,t)=>({}))),u=(e,t,o)=>{s(r=>de(r[e],t)==o?r:ee(r,e,{...r[e],[t]:o}))},c=(e,t)=>{s(o=>((e,t)=>t in e)(o[e],t)?ee(o,e,((e,t)=>(delete e[t],e))(o[e],t)):o)},I=d(()=>[...Be(0,o(),e.store,e.storesById,r()),...Be(1,o(),e.metrics,e.metricsById,r()),...Be(2,o(),e.indexes,e.indexesById,r()),...Be(3,o(),e.relationships,e.relationshipsById,r()),...Be(4,o(),e.queries,e.queriesById,r()),...Be(5,o(),e.checkpoints,e.checkpointsById,r()),...Be(6,o(),e.persister,e.persistersById,r()),...Be(7,o(),e.synchronizer,e.synchronizersById,r()),u,c]);return l(be.Provider,{value:{value:I}},()=>e.children)},Se=[],Le=[{},[],[Se,void 0,Se],{},void 0,void 0,!1,0],je=[ue,Y,([e,t,o],[r,s,n])=>t===s&&Y(e,r)&&Y(o,n),(e,t)=>ue(e,t,Z),Z],ze=(e,t)=>e===t,Ae=e=>G(e)?e():e,Fe=[],Oe=(e,t)=>{const[o,r]=n();return u(()=>{const o=Ae(e),n=o?t(o):void 0;r(()=>n),s(()=>n?.destroy?.())}),o},De=(e,t,...o)=>{const r=e?.["add"+t+"Listener"]?.(...o);return()=>e?.delListener?.(r)},He=(e,t,d,u=Fe)=>{const[l,c]=n(Le[d]),i=()=>$(u,Ae),a=()=>{const o=Ae(t)?.[(6==d?"has":"get")+e]?.(...i())??Le[d],s=r(l);c(()=>(je[d]??ze)(o,s)?s:o)};return o(()=>{const o=Ae(t),r=i();a();const n=De(o,(6==d?g:I)+e,...r,a);s(n)}),l},Me=(e,t,r,n=Fe,...d)=>o(()=>{const o=De(Ae(t),e,...$(n,Ae),r,...$(d,Ae));s(o)}),Qe=(e,t,o,r=N,s,...n)=>d=>_(Ae(e),e=>_(o(d,e),o=>r(e[s+t](...Ee(n,e,d),o),o))),We=(e,t,o,r,...s)=>Qe($e(e),t,o,r,"set",...s),_e=(e,t,o,r,...s)=>Qe(Jo(e),t,o,r,I,...s),Ee=(e,t,o)=>$(e,e=>G(e)?0==e.length?Ae(e):e(o,t):e),Ge=(e,t,o=N,...r)=>{const s=$e(e);return e=>{const n=Ae(s);_(n,s=>o(s["del"+t](...Ee(r,s,e))))}},Je=(e,t,o)=>{const r=Pr(e);return()=>Ae(r)?.[t](o)},Ke=(e,t,o,r,s,n)=>He(P,$e(n),1,[e,t,o,r,s]),Ne=(e,t,o,r,s,n,d,u)=>Me(P,$e(u),n,[e,t,o,r,s],d),Ue=e=>d(e),Xe=()=>he(0),Ye=e=>me(e,0),Ze=()=>(()=>{const e=t(be)?.value??ae;return()=>({...e()[1]})})(),$e=e=>we(e,0),et=(e,t)=>Ce(e,t,0),tt=e=>d(e),ot=e=>He(w,$e(e),6,[]),rt=e=>He(w,$e(e),0),st=e=>[rt(e),Bt(U,e)],nt=e=>He(C,$e(e),1),dt=(e,t)=>He(m,$e(t),6,[e]),ut=(e,t)=>He(m,$e(t),0,[e]),lt=(e,t)=>[ut(e,t),Tt(e,U,t)],ct=(e,t)=>He(m+R,$e(t),1,[e]),It=(e,t,o)=>He(m+q,$e(o),6,[e,t]),it=(e,t)=>He(y,$e(t),7,[e]),at=(e,t)=>He(v,$e(t),1,[e]),pt=(e,t,o,r,s,n)=>se(e)?Ke(e.tableId,e.cellId,e.descending??!1,e.offset??0,e.limit,t):Ke(e,t,o,r,s,n),gt=(e,t,o)=>He(h,$e(o),6,[e,t]),bt=(e,t,o)=>He(h,$e(o),0,[e,t]),mt=(e,t,o)=>[bt(e,t,o),Vt(e,t,U,o)],wt=(e,t,o)=>He(R,$e(o),1,[e,t]),Ct=(e,t,o,r)=>He(q,$e(r),6,[e,t,o]),ht=(e,t,o,r)=>He(q,$e(r),5,[e,t,o]),yt=(e,t,o,r)=>[ht(e,t,o,r),jt(e,t,o,U,r)],vt=e=>He(f,$e(e),6,[]),Pt=e=>He(f,$e(e),0),qt=e=>[Pt(e),zt(U,e)],Rt=e=>He(x,$e(e),1),kt=(e,t)=>He(k,$e(t),6,[e]),ft=(e,t)=>He(k,$e(t),5,[e]),xt=(e,t)=>[ft(e,t),Ft(e,U,t)],Bt=(e,t,o)=>We(t,w,e,o),Tt=(e,t,o,r)=>We(o,m,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t)=>He(p+y,Jo(t),7,[e]),Zo=(e,t)=>He(p+v,Jo(t),1,[e]),$o=(e,t,o,r=0,s,n)=>He(p+P,Jo(n),1,[e,t,o,r,s]),er=(e,t,o)=>He(p+h,Jo(o),0,[e,t]),tr=(e,t,o)=>He(p+R,Jo(o),1,[e,t]),or=(e,t,o,r)=>He(p+q,Jo(r),5,[e,t,o]),rr=(e,t,o)=>Me(p+m,Jo(o),t,[e]),sr=(e,t,o)=>Me(p+m+R,Jo(o),t,[e]),nr=(e,t,o)=>Me(p+y,Jo(o),t,[e]),dr=(e,t,o)=>Me(p+v,Jo(o),t,[e]),ur=(e,t,o,r,s,n,d)=>Me(p+P,Jo(d),n,[e,t,o,r,s]),lr=(e,t,o,r)=>Me(p+h,Jo(r),o,[e,t]),cr=(e,t,o,r)=>Me(p+R,Jo(r),o,[e,t]),Ir=(e,t,o,r,s)=>Me(p+q,Jo(s),r,[e,t,o]),ir=(e,t)=>He("ParamValues",Jo(t),3,[e]),ar=(e,t)=>[ir(e,t),Cr(e,U,t)],pr=(e,t,o)=>He("ParamValue",Jo(o),4,[e,t]),gr=(e,t,o)=>[pr(e,t,o),wr(e,t,U,o)],br=(e,t,o)=>Me("ParamValues",Jo(o),t,[e]),mr=(e,t,o,r)=>Me("ParamValue",Jo(r),o,[e,t]),wr=(e,t,o,r,s)=>_e(r,"setParamValue",o,s,e,t),Cr=(e,t,o,r)=>_e(o,"setParamValues",t,r,e),hr=(e,t)=>Oe(e,t),yr=()=>he(5),vr=e=>me(e,5),Pr=e=>we(e,5),qr=(e,t)=>Ce(e,t,5),Rr=e=>He(O+b,Pr(e),2),kr=(e,t)=>He(O,Pr(t),5,[e]),fr=(e=N,t,o=N)=>{const r=Pr(t);return t=>_(Ae(r),r=>{const s=e(t);o(r.addCheckpoint(s),r,s)})},xr=e=>Je(e,"goBackward"),Br=e=>Je(e,"goForward"),Tr=(e,t,o=N)=>{const r=Pr(t);return t=>_(Ae(r),r=>_(e(t),e=>o(r.goTo(e),e)))},Vr=e=>{const t=Pr(e),[o,r]=Ae(Rr(t));return[(s=o,!(0==K(s))),xr(t),r,_(r,e=>Ae(t)?.getCheckpoint(e))??I];var s},Sr=e=>{const t=Pr(e),[,,[o]]=Ae(Rr(t));return[!Q(o),Br(t),o,_(o,e=>Ae(t)?.getCheckpoint(e))??I]},Lr=(e,t)=>Me(O+b,Pr(t),e),jr=(e,t,o)=>Me(O,Pr(o),t,[e]),zr=(e,t,o,r)=>{const[d,l]=n();return u(()=>{let n,d=!0;const u=e=>{e.destroy(),r?.(e)};(async()=>{const r=Ae(e);n=r?await t(r):void 0,d?(l(()=>n),n&&o&&await o(n)):n&&u(n)})(),s(()=>{d=!1,l(()=>{}),n&&u(n)})}),d},Ar=()=>he(6),Fr=e=>me(e,6),Or=e=>we(e,6),Dr=(e,t)=>Ce(e,t,6),Hr=e=>He(S,Or(e),7,[]),Mr=(e,t)=>Me(S,Or(t),e,[]),Qr=(e,t,o)=>{const[r,d]=n();return u(()=>{let r,n=!0;const u=e=>{e.destroy(),o?.(e)};(async()=>{const o=Ae(e);r=o?await t(o):void 0,n?d(()=>r):r&&u(r)})(),s(()=>{n=!1,d(()=>{}),r&&u(r)})}),r},Wr=()=>he(7),_r=e=>me(e,7),Er=e=>we(e,7),Gr=(e,t)=>Ce(e,t,7),Jr=e=>He(S,Er(e),7,[]),Kr=(e,t)=>Me(S,Er(t),e,[]),Nr=(e,t,o,r)=>{const s=Q(t)||!J(e)?e:$(e,(e,o)=>o>0?[t,e]:e);return o?[r,":{",s,"}"]:s},Ur=e=>{const t=kr(()=>e.checkpointId,()=>e.checkpoints);return()=>Nr(le(t)??I,void 0,e.debugIds,e.checkpointId)},Xr=e=>{const t=or(()=>e.queryId,()=>e.rowId,()=>e.cellId,()=>e.queries);return()=>Nr(I+(le(t)??I),void 0,e.debugIds,e.cellId)},Yr=e=>{const t=tr(()=>e.queryId,()=>e.rowId,()=>e.queries);return()=>{const o=e.resultCellComponent??Xr;return Nr($(le(t),t=>l(o,{...ce(e.getResultCellComponentProps,t),queryId:e.queryId,rowId:e.rowId,cellId:t,queries:e.queries,debugIds:e.debugIds})),e.separator,e.debugIds,e.rowId)}},Zr=e=>{const t=ht(()=>e.tableId,()=>e.rowId,()=>e.cellId,()=>e.store);return()=>Nr(I+(le(t)??I),void 0,e.debugIds,e.cellId)},$r=e=>{const t=(t=>{const o=wt(()=>e.tableId,()=>e.rowId,()=>e.store);return()=>le(t)??le(o)})(()=>e.customCellIds);return()=>{const o=e.cellComponent??Zr;return Nr($(le(t),t=>l(o,{...ce(e.getCellComponentProps,t),tableId:e.tableId,rowId:e.rowId,cellId:t,store:e.store,debugIds:e.debugIds})),e.separator,e.debugIds,e.rowId)}},es=(e,t)=>()=>{const o=e.rowComponent??$r;return Nr($(le(t),t=>l(o,{...ce(e.getRowComponentProps,t),tableId:e.tableId,rowId:t,customCellIds:e.customCellIds,store:e.store,debugIds:e.debugIds})),e.separator,e.debugIds,e.tableId)},ts=(e,t)=>()=>{const o=e.resultRowComponent??Yr;return Nr($(le(t),t=>l(o,{...ce(e.getResultRowComponentProps,t),queryId:e.queryId,rowId:t,queries:e.queries,debugIds:e.debugIds})),e.separator,e.debugIds,e.queryId)},os=(e,t,o)=>{const r=zo(()=>e.relationships),s=t(()=>e.relationshipId,o,r);return()=>{const t=e.rowComponent??$r,[n,d,u]=Ie(le(r),e.relationshipId);return Nr($(le(s),o=>l(t,{...ce(e.getRowComponentProps,o),tableId:u,rowId:o,store:d,debugIds:e.debugIds})),e.separator,e.debugIds,le(o))}},rs=e=>t=>{const o=Pr(()=>t.checkpoints),r=Rr(o);return()=>{const s=t.checkpointComponent??Ur;return Nr($(e(le(r)),e=>l(s,{...ce(t.getCheckpointComponentProps,e),checkpoints:le(o),checkpointId:e,debugIds:t.debugIds})),t.separator)}},ss=rs(e=>e[0]),ns=rs(e=>M(e[1])?[]:[e[1]]),ds=rs(e=>e[2]),us=e=>{const t=Ro(()=>e.indexes),o=Bo(()=>e.indexId,()=>e.sliceId,t);return()=>{const r=e.rowComponent??$r,[s,n,d]=(u=le(t),c=e.indexId,[u,u?.getStore(),u?.getTableId(c)]);var u,c;return Nr($(le(o),t=>l(r,{...ce(e.getRowComponentProps,t),tableId:d,rowId:t,store:n,debugIds:e.debugIds})),e.separator,e.debugIds,e.sliceId)}},ls=e=>{const t=fo(()=>e.indexId,()=>e.indexes);return()=>{const o=e.sliceComponent??us;return Nr($(le(t),t=>l(o,{...ce(e.getSliceComponentProps,t),indexId:e.indexId,sliceId:t,indexes:e.indexes,debugIds:e.debugIds})),e.separator,e.debugIds,e.indexId)}},cs=e=>os(e,Ho,()=>e.firstRowId),Is=e=>os(e,Do,()=>e.remoteRowId),is=e=>{const t=ho(()=>e.metricId,()=>e.metrics);return()=>Nr(le(t)??I,void 0,e.debugIds,e.metricId)},as=e=>{const t=zo(()=>e.relationships),o=Oo(()=>e.relationshipId,()=>e.localRowId,t);return()=>{const r=e.rowComponent??$r,[s,n,,d]=Ie(le(t),e.relationshipId),u=le(o);return Nr(Q(d)||Q(u)?null:l(r,{...ce(e.getRowComponentProps,u),tableId:d,rowId:u,store:n,debugIds:e.debugIds}),void 0,e.debugIds,e.localRowId)}},ps=e=>ts(e,$o(()=>e.queryId,()=>e.cellId,()=>e.descending,()=>e.offset,()=>e.limit,()=>e.queries)),gs=e=>ts(e,Zo(()=>e.queryId,()=>e.queries)),bs=e=>es(e,pt(()=>e.tableId,()=>e.cellId,()=>e.descending,()=>e.offset,()=>e.limit,()=>e.store)),ms=e=>es(e,at(()=>e.tableId,()=>e.store)),ws=e=>{const t=nt(()=>e.store);return()=>{const o=e.tableComponent??ms;return Nr($(le(t),t=>l(o,{...ce(e.getTableComponentProps,t),tableId:t,store:e.store,debugIds:e.debugIds})),e.separator)}},Cs=e=>{const t=ft(()=>e.valueId,()=>e.store);return()=>Nr(I+(le(t)??I),void 0,e.debugIds,e.valueId)},hs=e=>{const t=Rt(()=>e.store);return()=>{const o=e.valueComponent??Cs;return Nr($(le(t),t=>l(o,{...ce(e.getValueComponentProps,t),valueId:t,store:e.store,debugIds:e.debugIds})),e.separator)}};export{ss as BackwardCheckpointsView,Zr as CellView,Ur as CheckpointView,ns as CurrentCheckpointView,ds as ForwardCheckpointsView,ls as IndexView,cs as LinkedRowsView,Is as LocalRowsView,is as MetricView,ke as OFFSET_CHECKPOINTS,Pe as OFFSET_INDEXES,ve as OFFSET_METRICS,fe as OFFSET_PERSISTER,Re as OFFSET_QUERIES,qe as OFFSET_RELATIONSHIPS,ye as OFFSET_STORE,xe as OFFSET_SYNCHRONIZER,Ve as Provider,as as RemoteRowView,Xr as ResultCellView,Yr as ResultRowView,ps as ResultSortedTableView,gs as ResultTableView,$r as RowView,us as SliceView,bs as SortedTableView,ms as TableView,ws as TablesView,Cs as ValueView,hs as ValuesView,St as useAddRowCallback,ht as useCell,wt as useCellIds,to as useCellIdsListener,ro as useCellListener,yt as useCellState,kr as useCheckpoint,Rr as useCheckpointIds,Lr as useCheckpointIdsListener,jr as useCheckpointListener,vr as useCheckpoints,yr as useCheckpointsIds,Pr as useCheckpointsOrCheckpointsById,hr as useCreateCheckpoints,vo as useCreateIndexes,tt as useCreateMergeableStore,po as useCreateMetrics,zr as useCreatePersister,_o as useCreateQueries,So as useCreateRelationships,Ue as useCreateStore,Qr as useCreateSynchronizer,Mt as useDelCellCallback,Ht as useDelRowCallback,Dt as useDelTableCallback,Ot as useDelTablesCallback,Wt as useDelValueCallback,Qt as useDelValuesCallback,ao as useDidFinishTransactionListener,xr as useGoBackwardCallback,Br as useGoForwardCallback,Tr as useGoToCallback,Ct as useHasCell,oo as useHasCellListener,gt as useHasRow,$t as useHasRowListener,dt as useHasTable,It as useHasTableCell,Ut as useHasTableCellListener,Jt as useHasTableListener,ot as useHasTables,_t as useHasTablesListener,kt as useHasValue,lo as useHasValueListener,vt as useHasValues,so as useHasValuesListener,xo as useIndexIds,qo as useIndexes,Po as useIndexesIds,Ro as useIndexesOrIndexesById,Ho as useLinkedRowIds,Wo as useLinkedRowIdsListener,Do as useLocalRowIds,Qo as useLocalRowIdsListener,ho as useMetric,Co as useMetricIds,yo as useMetricListener,bo as useMetrics,go as useMetricsIds,mo as useMetricsOrMetricsById,pr as useParamValue,mr as useParamValueListener,gr as useParamValueState,ir as useParamValues,br as useParamValuesListener,ar as useParamValuesState,Fr as usePersister,Ar as usePersisterIds,Or as usePersisterOrPersisterById,Hr as usePersisterStatus,Mr as usePersisterStatusListener,qr as useProvideCheckpoints,ko as useProvideIndexes,wo as useProvideMetrics,Dr as useProvidePersister,Ko as useProvideQueries,Ao as useProvideRelationships,et as useProvideStore,Gr as useProvideSynchronizer,Go as useQueries,Eo as useQueriesIds,Jo as useQueriesOrQueriesById,No as useQueryIds,Sr as useRedoInformation,Fo as useRelationshipIds,jo as useRelationships,Lo as useRelationshipsIds,zo as useRelationshipsOrRelationshipsById,Oo as useRemoteRowId,Mo as useRemoteRowIdListener,or as useResultCell,tr as useResultCellIds,cr as useResultCellIdsListener,Ir as useResultCellListener,er as useResultRow,Yo as useResultRowCount,nr as useResultRowCountListener,Zo as useResultRowIds,dr as useResultRowIdsListener,lr as useResultRowListener,$o as useResultSortedRowIds,ur as useResultSortedRowIdsListener,Uo as useResultTable,Xo as useResultTableCellIds,sr as useResultTableCellIdsListener,rr as useResultTableListener,bt as useRow,it as useRowCount,Xt as useRowCountListener,at as useRowIds,Yt as useRowIdsListener,eo as useRowListener,mt as useRowState,jt as useSetCellCallback,fr as useSetCheckpointCallback,wr as useSetParamValueCallback,Cr as useSetParamValuesCallback,Lt as useSetPartialRowCallback,At as useSetPartialValuesCallback,Vt as useSetRowCallback,Tt as useSetTableCallback,Bt as useSetTablesCallback,Ft as useSetValueCallback,zt as useSetValuesCallback,fo as useSliceIds,To as useSliceIdsListener,Bo as useSliceRowIds,Vo as useSliceRowIdsListener,pt as useSortedRowIds,Zt as useSortedRowIdsListener,Ne as useSortedRowIdsListenerImpl,Io as useStartTransactionListener,Ye as useStore,Xe as useStoreIds,$e as useStoreOrStoreById,Ze as useStores,_r as useSynchronizer,Wr as useSynchronizerIds,Er as useSynchronizerOrSynchronizerById,Jr as useSynchronizerStatus,Kr as useSynchronizerStatusListener,ut as useTable,ct as useTableCellIds,Nt as useTableCellIdsListener,nt as useTableIds,Gt as useTableIdsListener,Kt as useTableListener,lt as useTableState,rt as useTables,Et as useTablesListener,st as useTablesState,Vr as useUndoInformation,ft as useValue,Rt as useValueIds,uo as useValueIdsListener,co as useValueListener,xt as useValueState,Pt as useValues,no as useValuesListener,qt as useValuesState,io as useWillFinishTransactionListener};
1
+ import{createContext as e,useContext as t,createRenderEffect as r,untrack as o,onCleanup as n,createSignal as s,createMemo as d,createEffect as u}from"solid-js";import{createComponent as l,memo as c,mergeProps as I}from"solid-js/web";const i=e=>typeof e,a="",g=i(a),p=i(i),b="Result",m="Has",w="Ids",C="Table",h=C+"s",y=C+w,v="Row",P=v+"Count",q=v+w,R="Sorted"+v+w,k="Cell",f=k+w,x="Value",B=x+"s",T=x+w,V="Transaction",S="Partial",L="Finish",j="Status",z="Metric",A="Slice",F="RemoteRowId",O="Local",D="Linked",H="Checkpoint",M=e=>(t,r,o)=>e(t)?o?.():r(t),Q=globalThis,W=e=>null==e,_=e=>void 0===e,E=M(W),G=M(_),J=e=>i(e)==g,K=e=>i(e)==p,N=e=>Array.isArray(e),U=e=>e.length,X=()=>{},Y=e=>e,Z=(e,t)=>e.every(t),$=(e,t)=>U(e)===U(t)&&Z(e,(e,r)=>t[r]===e),ee=(e,t)=>N(e)&&N(t)?$(e,t):e===t,te=(e,t)=>e.map(t),re=(e,t,r)=>e.with(t,r),oe=Object,ne=e=>oe.getPrototypeOf(e),se=oe.entries,de=e=>!W(e)&&E(ne(e),e=>e==oe.prototype||W(ne(e)),()=>!0),ue=oe.keys,le=(e,t)=>G(e,e=>e[t]),ce=(e,t,r=(e,t)=>e===t)=>{const o=se(e);return U(o)===U(ue(t))&&Z(o,([e,o])=>de(o)?!!de(t[e])&&ce(t[e],o,r):r(o,t[e]))},Ie=e=>K(e)?e():e,ie=(e,...t)=>_(e)?{}:e(...t),ae=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],ge="tinybase_uisc",pe=()=>[],be={value:pe},me=Q,we=me[ge]?me[ge]:me[ge]=e(be),Ce=(e,r)=>{const o=t(we)?.value??pe;return()=>{const t=o(),n=Ie(e);return _(n)?t[2*r]:J(n)?le(t[2*r+1],n):n}},he=(e,t)=>{const r=Ce(e,t);return()=>{const t=Ie(e);return _(t)||J(t)?r():t}},ye=(e,s,d)=>{const u=t(we)?.value??pe;r(()=>{const{16:t,17:r}=o(u);t?.(d,e,s),n(()=>r?.(d,e))})},ve=e=>{const r=t(we)?.value??pe;return()=>ue(r()[2*e+1]??{})},Pe=0,qe=1,Re=2,ke=3,fe=4,xe=5,Be=6,Te=7,Ve=(e,t,r,o,n)=>[r??t[2*e],{...t[2*e+1],...o,...n[e]}],Se=()=>[],Le=e=>{const r=t(we)?.value??Se,[o,n]=s(te([,,,,,,,,].fill(0),(e,t)=>({}))),u=(e,t,r)=>{n(o=>le(o[e],t)==r?o:re(o,e,{...o[e],[t]:r}))},c=(e,t)=>{n(r=>((e,t)=>t in e)(r[e],t)?re(r,e,((e,t)=>(delete e[t],e))(r[e],t)):r)},I=d(()=>[...Ve(0,r(),e.store,e.storesById,o()),...Ve(1,r(),e.metrics,e.metricsById,o()),...Ve(2,r(),e.indexes,e.indexesById,o()),...Ve(3,r(),e.relationships,e.relationshipsById,o()),...Ve(4,r(),e.queries,e.queriesById,o()),...Ve(5,r(),e.checkpoints,e.checkpointsById,o()),...Ve(6,r(),e.persister,e.persistersById,o()),...Ve(7,r(),e.synchronizer,e.synchronizersById,o()),u,c]);return l(we.Provider,{value:{value:I},get children(){return e.children}})},je=[],ze=[{},[],[je,void 0,je],{},void 0,void 0,!1,0],Ae=[ce,$,([e,t,r],[o,n,s])=>t===n&&$(e,o)&&$(r,s),(e,t)=>ce(e,t,ee),ee],Fe=(e,t)=>e===t,Oe=e=>K(e)?e():e,De=[],He=(e,t)=>{const[r,o]=s();return u(()=>{const r=Oe(e),s=r?t(r):void 0;o(()=>s),n(()=>s?.destroy?.())}),r},Me=(e,t,...r)=>{const o=e?.["add"+t+"Listener"]?.(...r);return()=>e?.delListener?.(o)},Qe=(e,t,d,u=De)=>{const[l,c]=s(ze[d]),I=()=>te(u,Oe),i=()=>{const r=Oe(t)?.[(6==d?"has":"get")+e]?.(...I())??ze[d],n=o(l);c(()=>(Ae[d]??Fe)(r,n)?n:r)};return r(()=>{const r=Oe(t),o=I();i();const s=Me(r,(6==d?m:a)+e,...o,i);n(s)}),l},We=(e,t,o,s=De,...d)=>r(()=>{const r=Me(Oe(t),e,...te(s,Oe),o,...te(d,Oe));n(r)}),_e=(e,t,r,o=X,n,...s)=>d=>G(Oe(e),e=>G(r(d,e),r=>o(e[n+t](...Je(s,e,d),r),r))),Ee=(e,t,r,o,...n)=>_e(tt(e),t,r,o,"set",...n),Ge=(e,t,r,o,...n)=>_e(Kr(e),t,r,o,a,...n),Je=(e,t,r)=>te(e,e=>K(e)?0==e.length?Oe(e):e(r,t):e),Ke=(e,t,r=X,...o)=>{const n=tt(e);return e=>{const s=Oe(n);G(s,n=>r(n["del"+t](...Je(o,n,e))))}},Ne=(e,t,r)=>{const o=Ro(e);return()=>Oe(o)?.[t](r)},Ue=(e,t,r,o,n,s)=>Qe(R,tt(s),1,[e,t,r,o,n]),Xe=(e,t,r,o,n,s,d,u)=>We(R,tt(u),s,[e,t,r,o,n],d),Ye=e=>d(e),Ze=()=>ve(0),$e=e=>Ce(e,0),et=()=>(()=>{const e=t(we)?.value??pe;return()=>({...e()[1]})})(),tt=e=>he(e,0),rt=(e,t)=>ye(e,t,0),ot=e=>d(e),nt=e=>Qe(h,tt(e),6,[]),st=e=>Qe(h,tt(e),0),dt=e=>[st(e),Vt(Y,e)],ut=e=>Qe(y,tt(e),1),lt=(e,t)=>Qe(C,tt(t),6,[e]),ct=(e,t)=>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r,o)=>Ke(r,v,o,e,t),Wt=(e,t,r,o,n,s)=>Ke(n,k,s,e,t,r,o),_t=(e,t)=>Ke(e,B,t),Et=(e,t,r)=>Ke(t,x,r,e),Gt=(e,t,r)=>We(m+h,tt(r),e,[],t),Jt=(e,t,r)=>We(h,tt(r),e,De,t),Kt=(e,t,r)=>We(y,tt(r),e,De,t),Nt=(e,t,r,o)=>We(m+C,tt(o),t,[e],r),Ut=(e,t,r,o)=>We(C,tt(o),t,[e],r),Xt=(e,t,r,o)=>We(C+f,tt(o),t,[e],r),Yt=(e,t,r,o,n)=>We(m+C+k,tt(n),r,[e,t],o),Zt=(e,t,r,o)=>We(P,tt(o),t,[e],r),$t=(e,t,r,o)=>We(q,tt(o),t,[e],r),er=(e,t,r,o,n,s,d,u)=>de(e)?Xe(e.tableId,e.cellId,e.descending??!1,e.offset??0,e.limit,t,r,o):Xe(e,t,r??!1,o??0,n,s,d,u),tr=(e,t,r,o,n)=>We(m+v,tt(n),r,[e,t],o),rr=(e,t,r,o,n)=>We(v,tt(n),r,[e,t],o),or=(e,t,r,o,n)=>We(f,tt(n),r,[e,t],o),nr=(e,t,r,o,n,s)=>We(m+k,tt(s),o,[e,t,r],n),sr=(e,t,r,o,n,s)=>We(k,tt(s),o,[e,t,r],n),dr=(e,t,r)=>We(m+B,tt(r),e,[],t),ur=(e,t,r)=>We(B,tt(r),e,De,t),lr=(e,t,r)=>We(T,tt(r),e,De,t),cr=(e,t,r,o)=>We(m+x,tt(o),t,[e],r),Ir=(e,t,r,o)=>We(x,tt(o),t,[e],r),ir=(e,t)=>We("Start"+V,tt(t),e),ar=(e,t)=>We("Will"+L+V,tt(t),e),gr=(e,t)=>We("Did"+L+V,tt(t),e),pr=(e,t)=>He(e,t),br=()=>ve(1),mr=e=>Ce(e,1),wr=e=>he(e,1),Cr=(e,t)=>ye(e,t,1),hr=e=>Qe(z+w,wr(e),1),yr=(e,t)=>Qe(z,wr(t),5,[e]),vr=(e,t,r)=>We(z,wr(r),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kr(r),t,[e]),co=(e,t,r,o,n,s,d)=>We(b+R,Kr(d),s,[e,t,r,o,n]),Io=(e,t,r,o)=>We(b+v,Kr(o),r,[e,t]),io=(e,t,r,o)=>We(b+f,Kr(o),r,[e,t]),ao=(e,t,r,o,n)=>We(b+k,Kr(n),o,[e,t,r]),go=(e,t)=>Qe("ParamValues",Kr(t),3,[e]),po=(e,t)=>[go(e,t),yo(e,Y,t)],bo=(e,t,r)=>Qe("ParamValue",Kr(r),4,[e,t]),mo=(e,t,r)=>[bo(e,t,r),ho(e,t,Y,r)],wo=(e,t,r)=>We("ParamValues",Kr(r),t,[e]),Co=(e,t,r,o)=>We("ParamValue",Kr(o),r,[e,t]),ho=(e,t,r,o,n)=>Ge(o,"setParamValue",r,n,e,t),yo=(e,t,r,o)=>Ge(r,"setParamValues",t,o,e),vo=(e,t)=>He(e,t),Po=()=>ve(5),qo=e=>Ce(e,5),Ro=e=>he(e,5),ko=(e,t)=>ye(e,t,5),fo=e=>Qe(H+w,Ro(e),2),xo=(e,t)=>Qe(H,Ro(t),5,[e]),Bo=(e=X,t,r=X)=>{const o=Ro(t);return t=>G(Oe(o),o=>{const n=e(t);r(o.addCheckpoint(n),o,n)})},To=e=>Ne(e,"goBackward"),Vo=e=>Ne(e,"goForward"),So=(e,t,r=X)=>{const o=Ro(t);return t=>G(Oe(o),o=>G(e(t),e=>r(o.goTo(e),e)))},Lo=e=>{const t=Ro(e),[r,o]=Oe(fo(t));return[(n=r,!(0==U(n))),To(t),o,G(o,e=>Oe(t)?.getCheckpoint(e))??a];var n},jo=e=>{const t=Ro(e),[,,[r]]=Oe(fo(t));return[!_(r),Vo(t),r,G(r,e=>Oe(t)?.getCheckpoint(e))??a]},zo=(e,t)=>We(H+w,Ro(t),e),Ao=(e,t,r)=>We(H,Ro(r),t,[e]),Fo=(e,t,r,o)=>{const[d,l]=s();return u(()=>{let s,d=!0;const u=e=>{e.destroy(),o?.(e)};(async()=>{const o=Oe(e);s=o?await t(o):void 0,d?(l(()=>s),s&&r&&await r(s)):s&&u(s)})(),n(()=>{d=!1,l(()=>{}),s&&u(s)})}),d},Oo=()=>ve(6),Do=e=>Ce(e,6),Ho=e=>he(e,6),Mo=(e,t)=>ye(e,t,6),Qo=e=>Qe(j,Ho(e),7,[]),Wo=(e,t)=>We(j,Ho(t),e,[]),_o=(e,t,r)=>{const[o,d]=s();return u(()=>{let o,s=!0;const u=e=>{e.destroy(),r?.(e)};(async()=>{const r=Oe(e);o=r?await t(r):void 0,s?d(()=>o):o&&u(o)})(),n(()=>{s=!1,d(()=>{}),o&&u(o)})}),o},Eo=()=>ve(7),Go=e=>Ce(e,7),Jo=e=>he(e,7),Ko=(e,t)=>ye(e,t,7),No=e=>Qe(j,Jo(e),7,[]),Uo=(e,t)=>We(j,Jo(t),e,[]),Xo=(e,t,r,o)=>{const n=_(t)||!N(e)?e:te(e,(e,r)=>r>0?[t,e]:e);return r?[o,":{",n,"}"]:n},Yo=e=>{const t=xo(()=>e.checkpointId,()=>e.checkpoints);return c(()=>Xo(Ie(t)??a,void 0,e.debugIds,e.checkpointId))},Zo=e=>{const t=oo(()=>e.queryId,()=>e.rowId,()=>e.cellId,()=>e.queries);return c(()=>Xo(a+(Ie(t)??a),void 0,e.debugIds,e.cellId))},$o=e=>{const t=ro(()=>e.queryId,()=>e.rowId,()=>e.queries);return c(()=>{const r=e.resultCellComponent??Zo;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getResultCellComponentProps,t),{get queryId(){return e.queryId},get rowId(){return e.rowId},cellId:t,get queries(){return e.queries},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.rowId)})},en=e=>{const t=vt(()=>e.tableId,()=>e.rowId,()=>e.cellId,()=>e.store);return c(()=>Xo(a+(Ie(t)??a),void 0,e.debugIds,e.cellId))},tn=e=>{const t=(t=>{const r=ht(()=>e.tableId,()=>e.rowId,()=>e.store);return()=>Ie(t)??Ie(r)})(()=>e.customCellIds);return c(()=>{const r=e.cellComponent??en;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getCellComponentProps,t),{get tableId(){return e.tableId},get rowId(){return e.rowId},cellId:t,get store(){return e.store},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.rowId)})},rn=(e,t)=>c(()=>{const r=e.rowComponent??tn;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getRowComponentProps,t),{get tableId(){return e.tableId},rowId:t,get customCellIds(){return e.customCellIds},get store(){return e.store},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.tableId)}),on=(e,t)=>c(()=>{const r=e.resultRowComponent??$o;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getResultRowComponentProps,t),{get queryId(){return e.queryId},rowId:t,get queries(){return e.queries},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.queryId)}),nn=(e,t,r)=>{const o=Ar(()=>e.relationships),n=t(()=>e.relationshipId,r,o);return c(()=>{const t=e.rowComponent??tn,[s,d,u]=ae(Ie(o),e.relationshipId);return Xo(te(Ie(n),r=>l(t,I(()=>ie(e.getRowComponentProps,r),{tableId:u,rowId:r,store:d,get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,Ie(r))})},sn=e=>t=>{const r=Ro(()=>t.checkpoints),o=fo(r);return c(()=>{const n=t.checkpointComponent??Yo;return Xo(te(e(Ie(o)),e=>l(n,I(()=>ie(t.getCheckpointComponentProps,e),{get checkpoints(){return Ie(r)},checkpointId:e,get debugIds(){return t.debugIds}}))),t.separator)})},dn=sn(e=>e[0]),un=sn(e=>W(e[1])?[]:[e[1]]),ln=sn(e=>e[2]),cn=e=>{const t=kr(()=>e.indexes),r=Tr(()=>e.indexId,()=>e.sliceId,t);return c(()=>{const o=e.rowComponent??tn,[n,s,d]=(u=Ie(t),c=e.indexId,[u,u?.getStore(),u?.getTableId(c)]);var u,c;return Xo(te(Ie(r),t=>l(o,I(()=>ie(e.getRowComponentProps,t),{tableId:d,rowId:t,store:s,get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.sliceId)})},In=e=>{const t=xr(()=>e.indexId,()=>e.indexes);return c(()=>{const r=e.sliceComponent??cn;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getSliceComponentProps,t),{get indexId(){return e.indexId},sliceId:t,get indexes(){return e.indexes},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.indexId)})},an=e=>nn(e,Mr,()=>e.firstRowId),gn=e=>nn(e,Hr,()=>e.remoteRowId),pn=e=>{const t=yr(()=>e.metricId,()=>e.metrics);return c(()=>Xo(Ie(t)??a,void 0,e.debugIds,e.metricId))},bn=e=>{const t=Ar(()=>e.relationships),r=Dr(()=>e.relationshipId,()=>e.localRowId,t);return c(()=>{const o=e.rowComponent??tn,[n,s,,d]=ae(Ie(t),e.relationshipId),u=Ie(r);return Xo(_(d)||_(u)?null:l(o,I(()=>ie(e.getRowComponentProps,u),{tableId:d,rowId:u,store:s,get debugIds(){return e.debugIds}})),void 0,e.debugIds,e.localRowId)})},mn=e=>on(e,eo(()=>e.queryId,()=>e.cellId,()=>e.descending,()=>e.offset,()=>e.limit,()=>e.queries)),wn=e=>on(e,$r(()=>e.queryId,()=>e.queries)),Cn=e=>rn(e,bt(()=>e.tableId,()=>e.cellId,()=>e.descending,()=>e.offset,()=>e.limit,()=>e.store)),hn=e=>rn(e,pt(()=>e.tableId,()=>e.store)),yn=e=>{const t=ut(()=>e.store);return c(()=>{const r=e.tableComponent??hn;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getTableComponentProps,t),{tableId:t,get store(){return e.store},get debugIds(){return e.debugIds}}))),e.separator)})},vn=e=>{const t=Bt(()=>e.valueId,()=>e.store);return c(()=>Xo(a+(Ie(t)??a),void 0,e.debugIds,e.valueId))},Pn=e=>{const t=ft(()=>e.store);return c(()=>{const r=e.valueComponent??vn;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getValueComponentProps,t),{valueId:t,get store(){return e.store},get debugIds(){return e.debugIds}}))),e.separator)})};export{dn as BackwardCheckpointsView,en as CellView,Yo as CheckpointView,un as CurrentCheckpointView,ln as ForwardCheckpointsView,In as IndexView,an as LinkedRowsView,gn as LocalRowsView,pn as MetricView,xe as OFFSET_CHECKPOINTS,Re as OFFSET_INDEXES,qe as OFFSET_METRICS,Be as OFFSET_PERSISTER,fe as OFFSET_QUERIES,ke as OFFSET_RELATIONSHIPS,Pe as OFFSET_STORE,Te as OFFSET_SYNCHRONIZER,Le as Provider,bn as RemoteRowView,Zo as ResultCellView,$o as ResultRowView,mn as ResultSortedTableView,wn as ResultTableView,tn as RowView,cn as SliceView,Cn as SortedTableView,hn as TableView,yn as TablesView,vn as ValueView,Pn as ValuesView,jt as useAddRowCallback,vt as useCell,ht as useCellIds,or as useCellIdsListener,sr as useCellListener,Pt as useCellState,xo as useCheckpoint,fo as useCheckpointIds,zo as useCheckpointIdsListener,Ao as useCheckpointListener,qo as useCheckpoints,Po as useCheckpointsIds,Ro as useCheckpointsOrCheckpointsById,vo as useCreateCheckpoints,Pr as useCreateIndexes,ot as useCreateMergeableStore,pr as useCreateMetrics,Fo as useCreatePersister,Er as useCreateQueries,Lr as useCreateRelationships,Ye as useCreateStore,_o as useCreateSynchronizer,Wt as useDelCellCallback,Qt as useDelRowCallback,Mt as useDelTableCallback,Ht as useDelTablesCallback,Et as useDelValueCallback,_t as useDelValuesCallback,gr as useDidFinishTransactionListener,To as useGoBackwardCallback,Vo as useGoForwardCallback,So as useGoToCallback,yt as useHasCell,nr as useHasCellListener,mt as useHasRow,tr as useHasRowListener,lt as useHasTable,at as useHasTableCell,Yt as useHasTableCellListener,Nt as useHasTableListener,nt as useHasTables,Gt as useHasTablesListener,xt as useHasValue,cr as useHasValueListener,qt as useHasValues,dr as useHasValuesListener,Br as useIndexIds,Rr as useIndexes,qr as useIndexesIds,kr as useIndexesOrIndexesById,Mr as useLinkedRowIds,_r as useLinkedRowIdsListener,Hr as useLocalRowIds,Wr as useLocalRowIdsListener,yr as useMetric,hr as useMetricIds,vr as useMetricListener,mr as useMetrics,br as useMetricsIds,wr as useMetricsOrMetricsById,bo as useParamValue,Co as useParamValueListener,mo as useParamValueState,go as useParamValues,wo as useParamValuesListener,po as useParamValuesState,Do as usePersister,Oo as usePersisterIds,Ho as usePersisterOrPersisterById,Qo as usePersisterStatus,Wo as usePersisterStatusListener,ko as useProvideCheckpoints,fr as useProvideIndexes,Cr as useProvideMetrics,Mo as useProvidePersister,Nr as useProvideQueries,Fr as useProvideRelationships,rt as useProvideStore,Ko as useProvideSynchronizer,Jr as useQueries,Gr as useQueriesIds,Kr as useQueriesOrQueriesById,Ur as useQueryIds,jo as useRedoInformation,Or as useRelationshipIds,zr as useRelationships,jr as useRelationshipsIds,Ar as useRelationshipsOrRelationshipsById,Dr as useRemoteRowId,Qr as useRemoteRowIdListener,oo as useResultCell,ro as useResultCellIds,io as useResultCellIdsListener,ao as useResultCellListener,to as useResultRow,Zr as useResultRowCount,uo as useResultRowCountListener,$r as useResultRowIds,lo as useResultRowIdsListener,Io as useResultRowListener,eo as useResultSortedRowIds,co as useResultSortedRowIdsListener,Xr as useResultTable,Yr as useResultTableCellIds,so as useResultTableCellIdsListener,no as useResultTableListener,wt as useRow,gt as useRowCount,Zt as useRowCountListener,pt as useRowIds,$t as useRowIdsListener,rr as useRowListener,Ct as useRowState,At as useSetCellCallback,Bo as useSetCheckpointCallback,ho as useSetParamValueCallback,yo as useSetParamValuesCallback,zt as useSetPartialRowCallback,Ot as useSetPartialValuesCallback,Lt as useSetRowCallback,St as useSetTableCallback,Vt as useSetTablesCallback,Dt as useSetValueCallback,Ft as useSetValuesCallback,xr as useSliceIds,Vr as useSliceIdsListener,Tr as useSliceRowIds,Sr as useSliceRowIdsListener,bt as useSortedRowIds,er as useSortedRowIdsListener,Xe as useSortedRowIdsListenerImpl,ir as useStartTransactionListener,$e as useStore,Ze as useStoreIds,tt as useStoreOrStoreById,et as useStores,Go as useSynchronizer,Eo as useSynchronizerIds,Jo as useSynchronizerOrSynchronizerById,No as useSynchronizerStatus,Uo as useSynchronizerStatusListener,ct as useTable,it as useTableCellIds,Xt as useTableCellIdsListener,ut as useTableIds,Kt as useTableIdsListener,Ut as useTableListener,It as useTableState,st as useTables,Jt as useTablesListener,dt as useTablesState,Lo as useUndoInformation,Bt as useValue,ft as useValueIds,lr as useValueIdsListener,Ir as useValueListener,Tt as useValueState,Rt as useValues,ur as useValuesListener,kt as useValuesState,ar as useWillFinishTransactionListener};
Binary file
@@ -1 +1 @@
1
- import{createContext as e,useContext as t,createRenderEffect as o,untrack as r,onCleanup as s,createSignal as n,createMemo as d,createEffect as u}from"solid-js";import l from"solid-js/h";const c=e=>typeof e,I="",i=c(I),a=c(c),p="Result",g="Has",b="Ids",m="Table",w=m+"s",C=m+b,h="Row",y=h+"Count",v=h+b,P="Sorted"+h+b,q="Cell",R=q+b,k="Value",f=k+"s",x=k+b,B="Transaction",T="Partial",V="Finish",S="Status",L="Metric",j="Slice",z="RemoteRowId",A="Local",F="Linked",O="Checkpoint",D=e=>(t,o,r)=>e(t)?r?.():o(t),H=globalThis,M=e=>null==e,Q=e=>void 0===e,W=D(M),_=D(Q),E=e=>c(e)==i,G=e=>c(e)==a,J=e=>Array.isArray(e),K=e=>e.length,N=()=>{},U=e=>e,X=(e,t)=>e.every(t),Y=(e,t)=>K(e)===K(t)&&X(e,(e,o)=>t[o]===e),Z=(e,t)=>J(e)&&J(t)?Y(e,t):e===t,$=(e,t)=>e.map(t),ee=(e,t,o)=>e.with(t,o),te=Object,oe=e=>te.getPrototypeOf(e),re=te.entries,se=e=>!M(e)&&W(oe(e),e=>e==te.prototype||M(oe(e)),()=>!0),ne=te.keys,de=(e,t)=>_(e,e=>e[t]),ue=(e,t,o=(e,t)=>e===t)=>{const r=re(e);return K(r)===K(ne(t))&&X(r,([e,r])=>se(r)?!!se(t[e])&&ue(t[e],r,o):o(r,t[e]))},le=e=>G(e)?e():e,ce=(e,...t)=>Q(e)?{}:e(...t),Ie=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],ie="tinybase_uisc",ae=()=>[],pe={value:ae},ge=H,be=ge[ie]?ge[ie]:ge[ie]=e(pe),me=(e,o)=>{const r=t(be)?.value??ae;return()=>{const t=r(),s=le(e);return Q(s)?t[2*o]:E(s)?de(t[2*o+1],s):s}},we=(e,t)=>{const o=me(e,t);return()=>{const t=le(e);return Q(t)||E(t)?o():t}},Ce=(e,n,d)=>{const u=t(be)?.value??ae;o(()=>{const{16:t,17:o}=r(u);t?.(d,e,n),s(()=>o?.(d,e))})},he=e=>{const o=t(be)?.value??ae;return()=>ne(o()[2*e+1]??{})},ye=0,ve=1,Pe=2,qe=3,Re=4,ke=5,fe=6,xe=7,Be=(e,t,o,r,s)=>[o??t[2*e],{...t[2*e+1],...r,...s[e]}],Te=()=>[],Ve=e=>{const o=t(be)?.value??Te,[r,s]=n($([,,,,,,,,].fill(0),(e,t)=>({}))),u=(e,t,o)=>{s(r=>de(r[e],t)==o?r:ee(r,e,{...r[e],[t]:o}))},c=(e,t)=>{s(o=>((e,t)=>t in e)(o[e],t)?ee(o,e,((e,t)=>(delete e[t],e))(o[e],t)):o)},I=d(()=>[...Be(0,o(),e.store,e.storesById,r()),...Be(1,o(),e.metrics,e.metricsById,r()),...Be(2,o(),e.indexes,e.indexesById,r()),...Be(3,o(),e.relationships,e.relationshipsById,r()),...Be(4,o(),e.queries,e.queriesById,r()),...Be(5,o(),e.checkpoints,e.checkpointsById,r()),...Be(6,o(),e.persister,e.persistersById,r()),...Be(7,o(),e.synchronizer,e.synchronizersById,r()),u,c]);return l(be.Provider,{value:{value:I}},()=>e.children)},Se=[],Le=[{},[],[Se,void 0,Se],{},void 0,void 0,!1,0],je=[ue,Y,([e,t,o],[r,s,n])=>t===s&&Y(e,r)&&Y(o,n),(e,t)=>ue(e,t,Z),Z],ze=(e,t)=>e===t,Ae=e=>G(e)?e():e,Fe=[],Oe=(e,t)=>{const[o,r]=n();return u(()=>{const o=Ae(e),n=o?t(o):void 0;r(()=>n),s(()=>n?.destroy?.())}),o},De=(e,t,...o)=>{const r=e?.["add"+t+"Listener"]?.(...o);return()=>e?.delListener?.(r)},He=(e,t,d,u=Fe)=>{const[l,c]=n(Le[d]),i=()=>$(u,Ae),a=()=>{const o=Ae(t)?.[(6==d?"has":"get")+e]?.(...i())??Le[d],s=r(l);c(()=>(je[d]??ze)(o,s)?s:o)};return o(()=>{const o=Ae(t),r=i();a();const n=De(o,(6==d?g:I)+e,...r,a);s(n)}),l},Me=(e,t,r,n=Fe,...d)=>o(()=>{const o=De(Ae(t),e,...$(n,Ae),r,...$(d,Ae));s(o)}),Qe=(e,t,o,r=N,s,...n)=>d=>_(Ae(e),e=>_(o(d,e),o=>r(e[s+t](...Ee(n,e,d),o),o))),We=(e,t,o,r,...s)=>Qe($e(e),t,o,r,"set",...s),_e=(e,t,o,r,...s)=>Qe(Jo(e),t,o,r,I,...s),Ee=(e,t,o)=>$(e,e=>G(e)?0==e.length?Ae(e):e(o,t):e),Ge=(e,t,o=N,...r)=>{const s=$e(e);return e=>{const n=Ae(s);_(n,s=>o(s["del"+t](...Ee(r,s,e))))}},Je=(e,t,o)=>{const r=Pr(e);return()=>Ae(r)?.[t](o)},Ke=(e,t,o,r,s,n)=>He(P,$e(n),1,[e,t,o,r,s]),Ne=(e,t,o,r,s,n,d,u)=>Me(P,$e(u),n,[e,t,o,r,s],d),Ue=e=>d(e),Xe=()=>he(0),Ye=e=>me(e,0),Ze=()=>(()=>{const e=t(be)?.value??ae;return()=>({...e()[1]})})(),$e=e=>we(e,0),et=(e,t)=>Ce(e,t,0),tt=e=>d(e),ot=e=>He(w,$e(e),6,[]),rt=e=>He(w,$e(e),0),st=e=>[rt(e),Bt(U,e)],nt=e=>He(C,$e(e),1),dt=(e,t)=>He(m,$e(t),6,[e]),ut=(e,t)=>He(m,$e(t),0,[e]),lt=(e,t)=>[ut(e,t),Tt(e,U,t)],ct=(e,t)=>He(m+R,$e(t),1,[e]),It=(e,t,o)=>He(m+q,$e(o),6,[e,t]),it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),e,Fe,t),Gt=(e,t,o)=>Me(C,$e(o),e,Fe,t),Jt=(e,t,o,r)=>Me(g+m,$e(r),t,[e],o),Kt=(e,t,o,r)=>Me(m,$e(r),t,[e],o),Nt=(e,t,o,r)=>Me(m+R,$e(r),t,[e],o),Ut=(e,t,o,r,s)=>Me(g+m+q,$e(s),o,[e,t],r),Xt=(e,t,o,r)=>Me(y,$e(r),t,[e],o),Yt=(e,t,o,r)=>Me(v,$e(r),t,[e],o),Zt=(e,t,o,r,s,n,d,u)=>se(e)?Ne(e.tableId,e.cellId,e.descending??!1,e.offset??0,e.limit,t,o,r):Ne(e,t,o??!1,r??0,s,n,d,u),$t=(e,t,o,r,s)=>Me(g+h,$e(s),o,[e,t],r),eo=(e,t,o,r,s)=>Me(h,$e(s),o,[e,t],r),to=(e,t,o,r,s)=>Me(R,$e(s),o,[e,t],r),oo=(e,t,o,r,s,n)=>Me(g+q,$e(n),r,[e,t,o],s),ro=(e,t,o,r,s,n)=>Me(q,$e(n),r,[e,t,o],s),so=(e,t,o)=>Me(g+f,$e(o),e,[],t),no=(e,t,o)=>Me(f,$e(o),e,Fe,t),uo=(e,t,o)=>Me(x,$e(o),e,Fe,t),lo=(e,t,o,r)=>Me(g+k,$e(r),t,[e],o),co=(e,t,o,r)=>Me(k,$e(r),t,[e],o),Io=(e,t)=>Me("Start"+B,$e(t),e),io=(e,t)=>Me("Will"+V+B,$e(t),e),ao=(e,t)=>Me("Did"+V+B,$e(t),e),po=(e,t)=>Oe(e,t),go=()=>he(1),bo=e=>me(e,1),mo=e=>we(e,1),wo=(e,t)=>Ce(e,t,1),Co=e=>He(L+b,mo(e),1),ho=(e,t)=>He(L,mo(t),5,[e]),yo=(e,t,o)=>Me(L,mo(o),t,[e]),vo=(e,t)=>Oe(e,t),Po=()=>he(2),qo=e=>me(e,2),Ro=e=>we(e,2),ko=(e,t)=>Ce(e,t,2),fo=(e,t)=>He(j+b,Ro(t),1,[e]),xo=e=>He("Index"+b,Ro(e),1),B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e,t,o]),ir=(e,t)=>He("ParamValues",Jo(t),3,[e]),ar=(e,t)=>[ir(e,t),Cr(e,U,t)],pr=(e,t,o)=>He("ParamValue",Jo(o),4,[e,t]),gr=(e,t,o)=>[pr(e,t,o),wr(e,t,U,o)],br=(e,t,o)=>Me("ParamValues",Jo(o),t,[e]),mr=(e,t,o,r)=>Me("ParamValue",Jo(r),o,[e,t]),wr=(e,t,o,r,s)=>_e(r,"setParamValue",o,s,e,t),Cr=(e,t,o,r)=>_e(o,"setParamValues",t,r,e),hr=(e,t)=>Oe(e,t),yr=()=>he(5),vr=e=>me(e,5),Pr=e=>we(e,5),qr=(e,t)=>Ce(e,t,5),Rr=e=>He(O+b,Pr(e),2),kr=(e,t)=>He(O,Pr(t),5,[e]),fr=(e=N,t,o=N)=>{const r=Pr(t);return t=>_(Ae(r),r=>{const s=e(t);o(r.addCheckpoint(s),r,s)})},xr=e=>Je(e,"goBackward"),Br=e=>Je(e,"goForward"),Tr=(e,t,o=N)=>{const r=Pr(t);return t=>_(Ae(r),r=>_(e(t),e=>o(r.goTo(e),e)))},Vr=e=>{const t=Pr(e),[o,r]=Ae(Rr(t));return[(s=o,!(0==K(s))),xr(t),r,_(r,e=>Ae(t)?.getCheckpoint(e))??I];var s},Sr=e=>{const t=Pr(e),[,,[o]]=Ae(Rr(t));return[!Q(o),Br(t),o,_(o,e=>Ae(t)?.getCheckpoint(e))??I]},Lr=(e,t)=>Me(O+b,Pr(t),e),jr=(e,t,o)=>Me(O,Pr(o),t,[e]),zr=(e,t,o,r)=>{const[d,l]=n();return u(()=>{let n,d=!0;const u=e=>{e.destroy(),r?.(e)};(async()=>{const r=Ae(e);n=r?await t(r):void 0,d?(l(()=>n),n&&o&&await o(n)):n&&u(n)})(),s(()=>{d=!1,l(()=>{}),n&&u(n)})}),d},Ar=()=>he(6),Fr=e=>me(e,6),Or=e=>we(e,6),Dr=(e,t)=>Ce(e,t,6),Hr=e=>He(S,Or(e),7,[]),Mr=(e,t)=>Me(S,Or(t),e,[]),Qr=(e,t,o)=>{const[r,d]=n();return u(()=>{let r,n=!0;const u=e=>{e.destroy(),o?.(e)};(async()=>{const o=Ae(e);r=o?await t(o):void 0,n?d(()=>r):r&&u(r)})(),s(()=>{n=!1,d(()=>{}),r&&u(r)})}),r},Wr=()=>he(7),_r=e=>me(e,7),Er=e=>we(e,7),Gr=(e,t)=>Ce(e,t,7),Jr=e=>He(S,Er(e),7,[]),Kr=(e,t)=>Me(S,Er(t),e,[]),Nr=(e,t,o,r)=>{const s=Q(t)||!J(e)?e:$(e,(e,o)=>o>0?[t,e]:e);return o?[r,":{",s,"}"]:s},Ur=e=>{const t=kr(()=>e.checkpointId,()=>e.checkpoints);return()=>Nr(le(t)??I,void 0,e.debugIds,e.checkpointId)},Xr=e=>{const t=or(()=>e.queryId,()=>e.rowId,()=>e.cellId,()=>e.queries);return()=>Nr(I+(le(t)??I),void 0,e.debugIds,e.cellId)},Yr=e=>{const t=tr(()=>e.queryId,()=>e.rowId,()=>e.queries);return()=>{const o=e.resultCellComponent??Xr;return Nr($(le(t),t=>l(o,{...ce(e.getResultCellComponentProps,t),queryId:e.queryId,rowId:e.rowId,cellId:t,queries:e.queries,debugIds:e.debugIds})),e.separator,e.debugIds,e.rowId)}},Zr=e=>{const t=ht(()=>e.tableId,()=>e.rowId,()=>e.cellId,()=>e.store);return()=>Nr(I+(le(t)??I),void 0,e.debugIds,e.cellId)},$r=e=>{const t=(t=>{const o=wt(()=>e.tableId,()=>e.rowId,()=>e.store);return()=>le(t)??le(o)})(()=>e.customCellIds);return()=>{const o=e.cellComponent??Zr;return Nr($(le(t),t=>l(o,{...ce(e.getCellComponentProps,t),tableId:e.tableId,rowId:e.rowId,cellId:t,store:e.store,debugIds:e.debugIds})),e.separator,e.debugIds,e.rowId)}},es=(e,t)=>()=>{const o=e.rowComponent??$r;return Nr($(le(t),t=>l(o,{...ce(e.getRowComponentProps,t),tableId:e.tableId,rowId:t,customCellIds:e.customCellIds,store:e.store,debugIds:e.debugIds})),e.separator,e.debugIds,e.tableId)},ts=(e,t)=>()=>{const o=e.resultRowComponent??Yr;return Nr($(le(t),t=>l(o,{...ce(e.getResultRowComponentProps,t),queryId:e.queryId,rowId:t,queries:e.queries,debugIds:e.debugIds})),e.separator,e.debugIds,e.queryId)},os=(e,t,o)=>{const r=zo(()=>e.relationships),s=t(()=>e.relationshipId,o,r);return()=>{const t=e.rowComponent??$r,[n,d,u]=Ie(le(r),e.relationshipId);return Nr($(le(s),o=>l(t,{...ce(e.getRowComponentProps,o),tableId:u,rowId:o,store:d,debugIds:e.debugIds})),e.separator,e.debugIds,le(o))}},rs=e=>t=>{const o=Pr(()=>t.checkpoints),r=Rr(o);return()=>{const s=t.checkpointComponent??Ur;return Nr($(e(le(r)),e=>l(s,{...ce(t.getCheckpointComponentProps,e),checkpoints:le(o),checkpointId:e,debugIds:t.debugIds})),t.separator)}},ss=rs(e=>e[0]),ns=rs(e=>M(e[1])?[]:[e[1]]),ds=rs(e=>e[2]),us=e=>{const t=Ro(()=>e.indexes),o=Bo(()=>e.indexId,()=>e.sliceId,t);return()=>{const r=e.rowComponent??$r,[s,n,d]=(u=le(t),c=e.indexId,[u,u?.getStore(),u?.getTableId(c)]);var u,c;return Nr($(le(o),t=>l(r,{...ce(e.getRowComponentProps,t),tableId:d,rowId:t,store:n,debugIds:e.debugIds})),e.separator,e.debugIds,e.sliceId)}},ls=e=>{const t=fo(()=>e.indexId,()=>e.indexes);return()=>{const o=e.sliceComponent??us;return Nr($(le(t),t=>l(o,{...ce(e.getSliceComponentProps,t),indexId:e.indexId,sliceId:t,indexes:e.indexes,debugIds:e.debugIds})),e.separator,e.debugIds,e.indexId)}},cs=e=>os(e,Ho,()=>e.firstRowId),Is=e=>os(e,Do,()=>e.remoteRowId),is=e=>{const t=ho(()=>e.metricId,()=>e.metrics);return()=>Nr(le(t)??I,void 0,e.debugIds,e.metricId)},as=e=>{const t=zo(()=>e.relationships),o=Oo(()=>e.relationshipId,()=>e.localRowId,t);return()=>{const r=e.rowComponent??$r,[s,n,,d]=Ie(le(t),e.relationshipId),u=le(o);return Nr(Q(d)||Q(u)?null:l(r,{...ce(e.getRowComponentProps,u),tableId:d,rowId:u,store:n,debugIds:e.debugIds}),void 0,e.debugIds,e.localRowId)}},ps=e=>ts(e,$o(()=>e.queryId,()=>e.cellId,()=>e.descending,()=>e.offset,()=>e.limit,()=>e.queries)),gs=e=>ts(e,Zo(()=>e.queryId,()=>e.queries)),bs=e=>es(e,pt(()=>e.tableId,()=>e.cellId,()=>e.descending,()=>e.offset,()=>e.limit,()=>e.store)),ms=e=>es(e,at(()=>e.tableId,()=>e.store)),ws=e=>{const t=nt(()=>e.store);return()=>{const o=e.tableComponent??ms;return Nr($(le(t),t=>l(o,{...ce(e.getTableComponentProps,t),tableId:t,store:e.store,debugIds:e.debugIds})),e.separator)}},Cs=e=>{const t=ft(()=>e.valueId,()=>e.store);return()=>Nr(I+(le(t)??I),void 0,e.debugIds,e.valueId)},hs=e=>{const t=Rt(()=>e.store);return()=>{const o=e.valueComponent??Cs;return Nr($(le(t),t=>l(o,{...ce(e.getValueComponentProps,t),valueId:t,store:e.store,debugIds:e.debugIds})),e.separator)}};export{ss as BackwardCheckpointsView,Zr as CellView,Ur as CheckpointView,ns as CurrentCheckpointView,ds as ForwardCheckpointsView,ls as IndexView,cs as LinkedRowsView,Is as LocalRowsView,is as MetricView,ke as OFFSET_CHECKPOINTS,Pe as OFFSET_INDEXES,ve as OFFSET_METRICS,fe as OFFSET_PERSISTER,Re as OFFSET_QUERIES,qe as OFFSET_RELATIONSHIPS,ye as OFFSET_STORE,xe as OFFSET_SYNCHRONIZER,Ve as Provider,as as RemoteRowView,Xr as ResultCellView,Yr as ResultRowView,ps as ResultSortedTableView,gs as ResultTableView,$r as RowView,us as SliceView,bs as SortedTableView,ms as TableView,ws as TablesView,Cs as ValueView,hs as ValuesView,St as useAddRowCallback,ht as useCell,wt as useCellIds,to as useCellIdsListener,ro as useCellListener,yt as useCellState,kr as useCheckpoint,Rr as useCheckpointIds,Lr as useCheckpointIdsListener,jr as useCheckpointListener,vr as useCheckpoints,yr as useCheckpointsIds,Pr as useCheckpointsOrCheckpointsById,hr as useCreateCheckpoints,vo as useCreateIndexes,tt as useCreateMergeableStore,po as useCreateMetrics,zr as useCreatePersister,_o as useCreateQueries,So as useCreateRelationships,Ue as useCreateStore,Qr as useCreateSynchronizer,Mt as useDelCellCallback,Ht as useDelRowCallback,Dt as useDelTableCallback,Ot as useDelTablesCallback,Wt as useDelValueCallback,Qt as useDelValuesCallback,ao as useDidFinishTransactionListener,xr as useGoBackwardCallback,Br as useGoForwardCallback,Tr as useGoToCallback,Ct as useHasCell,oo as useHasCellListener,gt as useHasRow,$t as useHasRowListener,dt as useHasTable,It as useHasTableCell,Ut as useHasTableCellListener,Jt as useHasTableListener,ot as useHasTables,_t as useHasTablesListener,kt as useHasValue,lo as useHasValueListener,vt as useHasValues,so as useHasValuesListener,xo as useIndexIds,qo as useIndexes,Po as useIndexesIds,Ro as useIndexesOrIndexesById,Ho as useLinkedRowIds,Wo as useLinkedRowIdsListener,Do as useLocalRowIds,Qo as useLocalRowIdsListener,ho as useMetric,Co as useMetricIds,yo as useMetricListener,bo as useMetrics,go as useMetricsIds,mo as useMetricsOrMetricsById,pr as useParamValue,mr as useParamValueListener,gr as useParamValueState,ir as useParamValues,br as useParamValuesListener,ar as useParamValuesState,Fr as usePersister,Ar as usePersisterIds,Or as usePersisterOrPersisterById,Hr as usePersisterStatus,Mr as usePersisterStatusListener,qr as useProvideCheckpoints,ko as useProvideIndexes,wo as useProvideMetrics,Dr as useProvidePersister,Ko as useProvideQueries,Ao as useProvideRelationships,et as useProvideStore,Gr as useProvideSynchronizer,Go as useQueries,Eo as useQueriesIds,Jo as useQueriesOrQueriesById,No as useQueryIds,Sr as useRedoInformation,Fo as useRelationshipIds,jo as useRelationships,Lo as useRelationshipsIds,zo as useRelationshipsOrRelationshipsById,Oo as useRemoteRowId,Mo as useRemoteRowIdListener,or as useResultCell,tr as useResultCellIds,cr as useResultCellIdsListener,Ir as useResultCellListener,er as useResultRow,Yo as useResultRowCount,nr as useResultRowCountListener,Zo as useResultRowIds,dr as useResultRowIdsListener,lr as useResultRowListener,$o as useResultSortedRowIds,ur as useResultSortedRowIdsListener,Uo as useResultTable,Xo as useResultTableCellIds,sr as useResultTableCellIdsListener,rr as useResultTableListener,bt as useRow,it as useRowCount,Xt as useRowCountListener,at as useRowIds,Yt as useRowIdsListener,eo as useRowListener,mt as useRowState,jt as useSetCellCallback,fr as useSetCheckpointCallback,wr as useSetParamValueCallback,Cr as useSetParamValuesCallback,Lt as useSetPartialRowCallback,At as useSetPartialValuesCallback,Vt as useSetRowCallback,Tt as useSetTableCallback,Bt as useSetTablesCallback,Ft as useSetValueCallback,zt as useSetValuesCallback,fo as useSliceIds,To as useSliceIdsListener,Bo as useSliceRowIds,Vo as useSliceRowIdsListener,pt as useSortedRowIds,Zt as useSortedRowIdsListener,Ne as useSortedRowIdsListenerImpl,Io as useStartTransactionListener,Ye as useStore,Xe as useStoreIds,$e as useStoreOrStoreById,Ze as useStores,_r as useSynchronizer,Wr as useSynchronizerIds,Er as useSynchronizerOrSynchronizerById,Jr as useSynchronizerStatus,Kr as useSynchronizerStatusListener,ut as useTable,ct as useTableCellIds,Nt as useTableCellIdsListener,nt as useTableIds,Gt as useTableIdsListener,Kt as useTableListener,lt as useTableState,rt as useTables,Et as useTablesListener,st as useTablesState,Vr as useUndoInformation,ft as useValue,Rt as useValueIds,uo as useValueIdsListener,co as useValueListener,xt as useValueState,Pt as useValues,no as useValuesListener,qt as useValuesState,io as useWillFinishTransactionListener};
1
+ import{createContext as e,useContext as t,createRenderEffect as r,untrack as o,onCleanup as n,createSignal as s,createMemo as d,createEffect as u}from"solid-js";import{createComponent as l,memo as c,mergeProps as I}from"solid-js/web";const i=e=>typeof e,a="",g=i(a),p=i(i),b="Result",m="Has",w="Ids",C="Table",h=C+"s",y=C+w,v="Row",P=v+"Count",q=v+w,R="Sorted"+v+w,k="Cell",f=k+w,x="Value",B=x+"s",T=x+w,V="Transaction",S="Partial",L="Finish",j="Status",z="Metric",A="Slice",F="RemoteRowId",O="Local",D="Linked",H="Checkpoint",M=e=>(t,r,o)=>e(t)?o?.():r(t),Q=globalThis,W=e=>null==e,_=e=>void 0===e,E=M(W),G=M(_),J=e=>i(e)==g,K=e=>i(e)==p,N=e=>Array.isArray(e),U=e=>e.length,X=()=>{},Y=e=>e,Z=(e,t)=>e.every(t),$=(e,t)=>U(e)===U(t)&&Z(e,(e,r)=>t[r]===e),ee=(e,t)=>N(e)&&N(t)?$(e,t):e===t,te=(e,t)=>e.map(t),re=(e,t,r)=>e.with(t,r),oe=Object,ne=e=>oe.getPrototypeOf(e),se=oe.entries,de=e=>!W(e)&&E(ne(e),e=>e==oe.prototype||W(ne(e)),()=>!0),ue=oe.keys,le=(e,t)=>G(e,e=>e[t]),ce=(e,t,r=(e,t)=>e===t)=>{const o=se(e);return U(o)===U(ue(t))&&Z(o,([e,o])=>de(o)?!!de(t[e])&&ce(t[e],o,r):r(o,t[e]))},Ie=e=>K(e)?e():e,ie=(e,...t)=>_(e)?{}:e(...t),ae=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],ge="tinybase_uisc",pe=()=>[],be={value:pe},me=Q,we=me[ge]?me[ge]:me[ge]=e(be),Ce=(e,r)=>{const o=t(we)?.value??pe;return()=>{const t=o(),n=Ie(e);return _(n)?t[2*r]:J(n)?le(t[2*r+1],n):n}},he=(e,t)=>{const r=Ce(e,t);return()=>{const t=Ie(e);return _(t)||J(t)?r():t}},ye=(e,s,d)=>{const u=t(we)?.value??pe;r(()=>{const{16:t,17:r}=o(u);t?.(d,e,s),n(()=>r?.(d,e))})},ve=e=>{const r=t(we)?.value??pe;return()=>ue(r()[2*e+1]??{})},Pe=0,qe=1,Re=2,ke=3,fe=4,xe=5,Be=6,Te=7,Ve=(e,t,r,o,n)=>[r??t[2*e],{...t[2*e+1],...o,...n[e]}],Se=()=>[],Le=e=>{const r=t(we)?.value??Se,[o,n]=s(te([,,,,,,,,].fill(0),(e,t)=>({}))),u=(e,t,r)=>{n(o=>le(o[e],t)==r?o:re(o,e,{...o[e],[t]:r}))},c=(e,t)=>{n(r=>((e,t)=>t in e)(r[e],t)?re(r,e,((e,t)=>(delete e[t],e))(r[e],t)):r)},I=d(()=>[...Ve(0,r(),e.store,e.storesById,o()),...Ve(1,r(),e.metrics,e.metricsById,o()),...Ve(2,r(),e.indexes,e.indexesById,o()),...Ve(3,r(),e.relationships,e.relationshipsById,o()),...Ve(4,r(),e.queries,e.queriesById,o()),...Ve(5,r(),e.checkpoints,e.checkpointsById,o()),...Ve(6,r(),e.persister,e.persistersById,o()),...Ve(7,r(),e.synchronizer,e.synchronizersById,o()),u,c]);return l(we.Provider,{value:{value:I},get children(){return e.children}})},je=[],ze=[{},[],[je,void 0,je],{},void 0,void 0,!1,0],Ae=[ce,$,([e,t,r],[o,n,s])=>t===n&&$(e,o)&&$(r,s),(e,t)=>ce(e,t,ee),ee],Fe=(e,t)=>e===t,Oe=e=>K(e)?e():e,De=[],He=(e,t)=>{const[r,o]=s();return u(()=>{const r=Oe(e),s=r?t(r):void 0;o(()=>s),n(()=>s?.destroy?.())}),r},Me=(e,t,...r)=>{const o=e?.["add"+t+"Listener"]?.(...r);return()=>e?.delListener?.(o)},Qe=(e,t,d,u=De)=>{const[l,c]=s(ze[d]),I=()=>te(u,Oe),i=()=>{const r=Oe(t)?.[(6==d?"has":"get")+e]?.(...I())??ze[d],n=o(l);c(()=>(Ae[d]??Fe)(r,n)?n:r)};return r(()=>{const r=Oe(t),o=I();i();const s=Me(r,(6==d?m:a)+e,...o,i);n(s)}),l},We=(e,t,o,s=De,...d)=>r(()=>{const r=Me(Oe(t),e,...te(s,Oe),o,...te(d,Oe));n(r)}),_e=(e,t,r,o=X,n,...s)=>d=>G(Oe(e),e=>G(r(d,e),r=>o(e[n+t](...Je(s,e,d),r),r))),Ee=(e,t,r,o,...n)=>_e(tt(e),t,r,o,"set",...n),Ge=(e,t,r,o,...n)=>_e(Kr(e),t,r,o,a,...n),Je=(e,t,r)=>te(e,e=>K(e)?0==e.length?Oe(e):e(r,t):e),Ke=(e,t,r=X,...o)=>{const n=tt(e);return e=>{const s=Oe(n);G(s,n=>r(n["del"+t](...Je(o,n,e))))}},Ne=(e,t,r)=>{const o=Ro(e);return()=>Oe(o)?.[t](r)},Ue=(e,t,r,o,n,s)=>Qe(R,tt(s),1,[e,t,r,o,n]),Xe=(e,t,r,o,n,s,d,u)=>We(R,tt(u),s,[e,t,r,o,n],d),Ye=e=>d(e),Ze=()=>ve(0),$e=e=>Ce(e,0),et=()=>(()=>{const e=t(we)?.value??pe;return()=>({...e()[1]})})(),tt=e=>he(e,0),rt=(e,t)=>ye(e,t,0),ot=e=>d(e),nt=e=>Qe(h,tt(e),6,[]),st=e=>Qe(h,tt(e),0),dt=e=>[st(e),Vt(Y,e)],ut=e=>Qe(y,tt(e),1),lt=(e,t)=>Qe(C,tt(t),6,[e]),ct=(e,t)=>Qe(C,tt(t),0,[e]),It=(e,t)=>[ct(e,t),St(e,Y,t)],it=(e,t)=>Qe(C+f,tt(t),1,[e]),at=(e,t,r)=>Qe(C+k,tt(r),6,[e,t]),gt=(e,t)=>Qe(P,tt(t),7,[e]),pt=(e,t)=>Qe(q,tt(t),1,[e]),bt=(e,t,r,o,n,s)=>de(e)?Ue(e.tableId,e.cellId,e.descending??!1,e.offset??0,e.limit,t):Ue(e,t,r,o,n,s),mt=(e,t,r)=>Qe(v,tt(r),6,[e,t]),wt=(e,t,r)=>Qe(v,tt(r),0,[e,t]),Ct=(e,t,r)=>[wt(e,t,r),Lt(e,t,Y,r)],ht=(e,t,r)=>Qe(f,tt(r),1,[e,t]),yt=(e,t,r,o)=>Qe(k,tt(o),6,[e,t,r]),vt=(e,t,r,o)=>Qe(k,tt(o),5,[e,t,r]),Pt=(e,t,r,o)=>[vt(e,t,r,o),At(e,t,r,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ro=e=>he(e,5),ko=(e,t)=>ye(e,t,5),fo=e=>Qe(H+w,Ro(e),2),xo=(e,t)=>Qe(H,Ro(t),5,[e]),Bo=(e=X,t,r=X)=>{const o=Ro(t);return t=>G(Oe(o),o=>{const n=e(t);r(o.addCheckpoint(n),o,n)})},To=e=>Ne(e,"goBackward"),Vo=e=>Ne(e,"goForward"),So=(e,t,r=X)=>{const o=Ro(t);return t=>G(Oe(o),o=>G(e(t),e=>r(o.goTo(e),e)))},Lo=e=>{const t=Ro(e),[r,o]=Oe(fo(t));return[(n=r,!(0==U(n))),To(t),o,G(o,e=>Oe(t)?.getCheckpoint(e))??a];var n},jo=e=>{const t=Ro(e),[,,[r]]=Oe(fo(t));return[!_(r),Vo(t),r,G(r,e=>Oe(t)?.getCheckpoint(e))??a]},zo=(e,t)=>We(H+w,Ro(t),e),Ao=(e,t,r)=>We(H,Ro(r),t,[e]),Fo=(e,t,r,o)=>{const[d,l]=s();return u(()=>{let s,d=!0;const u=e=>{e.destroy(),o?.(e)};(async()=>{const o=Oe(e);s=o?await t(o):void 0,d?(l(()=>s),s&&r&&await r(s)):s&&u(s)})(),n(()=>{d=!1,l(()=>{}),s&&u(s)})}),d},Oo=()=>ve(6),Do=e=>Ce(e,6),Ho=e=>he(e,6),Mo=(e,t)=>ye(e,t,6),Qo=e=>Qe(j,Ho(e),7,[]),Wo=(e,t)=>We(j,Ho(t),e,[]),_o=(e,t,r)=>{const[o,d]=s();return u(()=>{let o,s=!0;const u=e=>{e.destroy(),r?.(e)};(async()=>{const r=Oe(e);o=r?await t(r):void 0,s?d(()=>o):o&&u(o)})(),n(()=>{s=!1,d(()=>{}),o&&u(o)})}),o},Eo=()=>ve(7),Go=e=>Ce(e,7),Jo=e=>he(e,7),Ko=(e,t)=>ye(e,t,7),No=e=>Qe(j,Jo(e),7,[]),Uo=(e,t)=>We(j,Jo(t),e,[]),Xo=(e,t,r,o)=>{const n=_(t)||!N(e)?e:te(e,(e,r)=>r>0?[t,e]:e);return r?[o,":{",n,"}"]:n},Yo=e=>{const t=xo(()=>e.checkpointId,()=>e.checkpoints);return c(()=>Xo(Ie(t)??a,void 0,e.debugIds,e.checkpointId))},Zo=e=>{const t=oo(()=>e.queryId,()=>e.rowId,()=>e.cellId,()=>e.queries);return c(()=>Xo(a+(Ie(t)??a),void 0,e.debugIds,e.cellId))},$o=e=>{const t=ro(()=>e.queryId,()=>e.rowId,()=>e.queries);return c(()=>{const r=e.resultCellComponent??Zo;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getResultCellComponentProps,t),{get queryId(){return e.queryId},get rowId(){return e.rowId},cellId:t,get queries(){return e.queries},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.rowId)})},en=e=>{const t=vt(()=>e.tableId,()=>e.rowId,()=>e.cellId,()=>e.store);return c(()=>Xo(a+(Ie(t)??a),void 0,e.debugIds,e.cellId))},tn=e=>{const t=(t=>{const r=ht(()=>e.tableId,()=>e.rowId,()=>e.store);return()=>Ie(t)??Ie(r)})(()=>e.customCellIds);return c(()=>{const r=e.cellComponent??en;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getCellComponentProps,t),{get tableId(){return e.tableId},get rowId(){return e.rowId},cellId:t,get store(){return e.store},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.rowId)})},rn=(e,t)=>c(()=>{const r=e.rowComponent??tn;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getRowComponentProps,t),{get tableId(){return e.tableId},rowId:t,get customCellIds(){return e.customCellIds},get store(){return e.store},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.tableId)}),on=(e,t)=>c(()=>{const r=e.resultRowComponent??$o;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getResultRowComponentProps,t),{get queryId(){return e.queryId},rowId:t,get queries(){return e.queries},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.queryId)}),nn=(e,t,r)=>{const o=Ar(()=>e.relationships),n=t(()=>e.relationshipId,r,o);return c(()=>{const t=e.rowComponent??tn,[s,d,u]=ae(Ie(o),e.relationshipId);return Xo(te(Ie(n),r=>l(t,I(()=>ie(e.getRowComponentProps,r),{tableId:u,rowId:r,store:d,get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,Ie(r))})},sn=e=>t=>{const r=Ro(()=>t.checkpoints),o=fo(r);return c(()=>{const n=t.checkpointComponent??Yo;return Xo(te(e(Ie(o)),e=>l(n,I(()=>ie(t.getCheckpointComponentProps,e),{get checkpoints(){return Ie(r)},checkpointId:e,get debugIds(){return t.debugIds}}))),t.separator)})},dn=sn(e=>e[0]),un=sn(e=>W(e[1])?[]:[e[1]]),ln=sn(e=>e[2]),cn=e=>{const t=kr(()=>e.indexes),r=Tr(()=>e.indexId,()=>e.sliceId,t);return c(()=>{const o=e.rowComponent??tn,[n,s,d]=(u=Ie(t),c=e.indexId,[u,u?.getStore(),u?.getTableId(c)]);var u,c;return Xo(te(Ie(r),t=>l(o,I(()=>ie(e.getRowComponentProps,t),{tableId:d,rowId:t,store:s,get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.sliceId)})},In=e=>{const t=xr(()=>e.indexId,()=>e.indexes);return c(()=>{const r=e.sliceComponent??cn;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getSliceComponentProps,t),{get indexId(){return e.indexId},sliceId:t,get indexes(){return e.indexes},get debugIds(){return e.debugIds}}))),e.separator,e.debugIds,e.indexId)})},an=e=>nn(e,Mr,()=>e.firstRowId),gn=e=>nn(e,Hr,()=>e.remoteRowId),pn=e=>{const t=yr(()=>e.metricId,()=>e.metrics);return c(()=>Xo(Ie(t)??a,void 0,e.debugIds,e.metricId))},bn=e=>{const t=Ar(()=>e.relationships),r=Dr(()=>e.relationshipId,()=>e.localRowId,t);return c(()=>{const o=e.rowComponent??tn,[n,s,,d]=ae(Ie(t),e.relationshipId),u=Ie(r);return Xo(_(d)||_(u)?null:l(o,I(()=>ie(e.getRowComponentProps,u),{tableId:d,rowId:u,store:s,get debugIds(){return e.debugIds}})),void 0,e.debugIds,e.localRowId)})},mn=e=>on(e,eo(()=>e.queryId,()=>e.cellId,()=>e.descending,()=>e.offset,()=>e.limit,()=>e.queries)),wn=e=>on(e,$r(()=>e.queryId,()=>e.queries)),Cn=e=>rn(e,bt(()=>e.tableId,()=>e.cellId,()=>e.descending,()=>e.offset,()=>e.limit,()=>e.store)),hn=e=>rn(e,pt(()=>e.tableId,()=>e.store)),yn=e=>{const t=ut(()=>e.store);return c(()=>{const r=e.tableComponent??hn;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getTableComponentProps,t),{tableId:t,get store(){return e.store},get debugIds(){return e.debugIds}}))),e.separator)})},vn=e=>{const t=Bt(()=>e.valueId,()=>e.store);return c(()=>Xo(a+(Ie(t)??a),void 0,e.debugIds,e.valueId))},Pn=e=>{const t=ft(()=>e.store);return c(()=>{const r=e.valueComponent??vn;return Xo(te(Ie(t),t=>l(r,I(()=>ie(e.getValueComponentProps,t),{valueId:t,get store(){return e.store},get debugIds(){return e.debugIds}}))),e.separator)})};export{dn as BackwardCheckpointsView,en as CellView,Yo as CheckpointView,un as CurrentCheckpointView,ln as ForwardCheckpointsView,In as IndexView,an as LinkedRowsView,gn as LocalRowsView,pn as MetricView,xe as OFFSET_CHECKPOINTS,Re as OFFSET_INDEXES,qe as OFFSET_METRICS,Be as OFFSET_PERSISTER,fe as OFFSET_QUERIES,ke as OFFSET_RELATIONSHIPS,Pe as OFFSET_STORE,Te as OFFSET_SYNCHRONIZER,Le as Provider,bn as RemoteRowView,Zo as ResultCellView,$o as ResultRowView,mn as ResultSortedTableView,wn as ResultTableView,tn as RowView,cn as SliceView,Cn as SortedTableView,hn as TableView,yn as TablesView,vn as ValueView,Pn as ValuesView,jt as useAddRowCallback,vt as useCell,ht as useCellIds,or as useCellIdsListener,sr as useCellListener,Pt as useCellState,xo as useCheckpoint,fo as useCheckpointIds,zo as useCheckpointIdsListener,Ao as useCheckpointListener,qo as useCheckpoints,Po as useCheckpointsIds,Ro as useCheckpointsOrCheckpointsById,vo as useCreateCheckpoints,Pr as useCreateIndexes,ot as useCreateMergeableStore,pr as useCreateMetrics,Fo as useCreatePersister,Er as useCreateQueries,Lr as useCreateRelationships,Ye as useCreateStore,_o as useCreateSynchronizer,Wt as useDelCellCallback,Qt as useDelRowCallback,Mt as useDelTableCallback,Ht as useDelTablesCallback,Et as useDelValueCallback,_t as useDelValuesCallback,gr as useDidFinishTransactionListener,To as useGoBackwardCallback,Vo as useGoForwardCallback,So as useGoToCallback,yt as useHasCell,nr as useHasCellListener,mt as useHasRow,tr as useHasRowListener,lt as useHasTable,at as useHasTableCell,Yt as useHasTableCellListener,Nt as useHasTableListener,nt as useHasTables,Gt as useHasTablesListener,xt as useHasValue,cr as useHasValueListener,qt as useHasValues,dr as useHasValuesListener,Br as useIndexIds,Rr as useIndexes,qr as useIndexesIds,kr as useIndexesOrIndexesById,Mr as useLinkedRowIds,_r as useLinkedRowIdsListener,Hr as useLocalRowIds,Wr as useLocalRowIdsListener,yr as useMetric,hr as useMetricIds,vr as useMetricListener,mr as useMetrics,br as useMetricsIds,wr as useMetricsOrMetricsById,bo as useParamValue,Co as useParamValueListener,mo as useParamValueState,go as useParamValues,wo as useParamValuesListener,po as useParamValuesState,Do as usePersister,Oo as usePersisterIds,Ho as usePersisterOrPersisterById,Qo as usePersisterStatus,Wo as usePersisterStatusListener,ko as useProvideCheckpoints,fr as useProvideIndexes,Cr as useProvideMetrics,Mo as useProvidePersister,Nr as useProvideQueries,Fr as useProvideRelationships,rt as useProvideStore,Ko as useProvideSynchronizer,Jr as useQueries,Gr as useQueriesIds,Kr as useQueriesOrQueriesById,Ur as useQueryIds,jo as useRedoInformation,Or as useRelationshipIds,zr as useRelationships,jr as useRelationshipsIds,Ar as useRelationshipsOrRelationshipsById,Dr as useRemoteRowId,Qr as useRemoteRowIdListener,oo as useResultCell,ro as useResultCellIds,io as useResultCellIdsListener,ao as useResultCellListener,to as useResultRow,Zr as useResultRowCount,uo as useResultRowCountListener,$r as useResultRowIds,lo as useResultRowIdsListener,Io as useResultRowListener,eo as useResultSortedRowIds,co as useResultSortedRowIdsListener,Xr as useResultTable,Yr as useResultTableCellIds,so as useResultTableCellIdsListener,no as useResultTableListener,wt as useRow,gt as useRowCount,Zt as useRowCountListener,pt as useRowIds,$t as useRowIdsListener,rr as useRowListener,Ct as useRowState,At as useSetCellCallback,Bo as useSetCheckpointCallback,ho as useSetParamValueCallback,yo as useSetParamValuesCallback,zt as useSetPartialRowCallback,Ot as useSetPartialValuesCallback,Lt as useSetRowCallback,St as useSetTableCallback,Vt as useSetTablesCallback,Dt as useSetValueCallback,Ft as useSetValuesCallback,xr as useSliceIds,Vr as useSliceIdsListener,Tr as useSliceRowIds,Sr as useSliceRowIdsListener,bt as useSortedRowIds,er as useSortedRowIdsListener,Xe as useSortedRowIdsListenerImpl,ir as useStartTransactionListener,$e as useStore,Ze as useStoreIds,tt as useStoreOrStoreById,et as useStores,Go as useSynchronizer,Eo as useSynchronizerIds,Jo as useSynchronizerOrSynchronizerById,No as useSynchronizerStatus,Uo as useSynchronizerStatusListener,ct as useTable,it as useTableCellIds,Xt as useTableCellIdsListener,ut as useTableIds,Kt as useTableIdsListener,Ut as useTableListener,It as useTableState,st as useTables,Jt as useTablesListener,dt as useTablesState,Lo as useUndoInformation,Bt as useValue,ft as useValueIds,lr as useValueIdsListener,Ir as useValueListener,Tt as useValueState,Rt as useValues,ur as useValuesListener,kt as useValuesState,ar as useWillFinishTransactionListener};
@@ -0,0 +1 @@
1
+ import{createContext as e,useContext as t,createSignal as r,createRenderEffect as l,onCleanup as n,untrack as o,createMemo as s,createEffect as a}from"solid-js";import{className as u,insert as i,createComponent as d,template as c,memo as h,effect as v,setAttribute as C,addEventListener as m,mergeProps as p}from"solid-js/web";import{CellView as I,ResultCellView as b,ValueView as f}from"../ui-solid/index.js";const g=e=>typeof e,y=g(""),x=g(!0),w=g(0),T=g(g),q="object",k="array",R="Result",A="Ids",S="Table",B="Row",L=B+"Count",N=B+A,E="Sorted"+B+A,O="Cell",j=O+A,P="Value",V=P+A,J="currentTarget",F="value",H="extra",M=e=>(t,r,l)=>e(t)?l?.():r(t),$=globalThis,_=Math.min,z=isFinite,D=e=>null==e,G=e=>void 0===e,K=e=>!1===e,Q=M(D),U=M(G),W=e=>g(e)==y,X=e=>g(e)==T,Y=e=>Array.isArray(e),Z=e=>e.length,ee=()=>{},te=e=>e,re=(e,t)=>{try{return e()}catch{return t}},le=(e,t)=>e.every(t),ne=(e,t)=>Z(e)===Z(t)&&le(e,(e,r)=>t[r]===e),oe=(e,t)=>Y(e)&&Y(t)?ne(e,t):e===t,se=(e,t)=>e.map(t),ae=Object,ue=e=>ae.getPrototypeOf(e),ie=ae.entries,de=e=>!D(e)&&Q(ue(e),e=>e==ae.prototype||D(ue(e)),()=>!0),ce=ae.keys,he=(e=[])=>ae.fromEntries(e),ve=(e,t)=>se(ie(e),([e,r])=>t(r,e)),Ce=(e,t,r=(e,t)=>e===t)=>{const l=ie(e);return Z(l)===Z(ce(t))&&le(l,([e,l])=>de(l)?!!de(t[e])&&Ce(t[e],l,r):r(l,t[e]))},me=e=>X(e)?e():e,pe=(e,...t)=>G(e)?{}:e(...t),Ie="tinybase_uisc",be=()=>[],fe={value:be},ge=$,ye=ge[Ie]?ge[Ie]:ge[Ie]=e(fe),xe=(e,r)=>{const l=((e,r)=>{const l=t(ye)?.value??be;return()=>{const t=l(),n=me(e);return G(n)?t[2*r]:W(n)?((e,t)=>U(e,e=>e[t]))(t[2*r+1],n):n}})(e,r);return()=>{const t=me(e);return G(t)||W(t)?l():t}},we=[],Te=[{},[],[we,void 0,we],{},void 0,void 0,!1,0],qe=[Ce,ne,([e,t,r],[l,n,o])=>t===n&&ne(e,l)&&ne(r,o),(e,t)=>Ce(e,t,oe),oe],ke=(e,t)=>e===t,Re=e=>X(e)?e():e,Ae=[],Se=(e,t,s,a=Ae)=>{const[u,i]=r(Te[s]),d=()=>se(a,Re),c=()=>{const r=Re(t)?.[(6==s?"has":"get")+e]?.(...d())??Te[s],l=o(u);i(()=>(qe[s]??ke)(r,l)?l:r)};return l(()=>{const r=Re(t),l=d();c();const o=((e,t,...r)=>{const l=e?.["add"+t+"Listener"]?.(...r);return()=>e?.delListener?.(l)})(r,(6==s?"Has":"")+e,...l,c);n(o)}),u},Be=(e,t,r,l,...n)=>((e,t,r,l=ee,n,...o)=>s=>U(Re(e),e=>U(r(s,e),r=>l(e[n+t](...Le(o,e,s),r),r))))(Ee(e),t,r,l,"set",...n),Le=(e,t,r)=>se(e,e=>X(e)?0==e.length?Re(e):e(r,t):e),Ne=(e,t,r,l,n,o)=>Se(E,Ee(o),1,[e,t,r,l,n]),Ee=e=>xe(e,0),Oe=(e,t)=>Se(S+j,Ee(t),1,[e]),je=(e,t)=>Se(N,Ee(t),1,[e]),Pe=(e,t,r,l)=>Se(O,Ee(l),5,[e,t,r]),Ve=(e,t)=>Se(P,Ee(t),5,[e]),Je=(e,t,r,l,n,o)=>Be(n,O,l,o,e,t,r),Fe=(e,t,r,l)=>Be(r,P,t,l,e),He=e=>xe(e,2),Me=e=>xe(e,3),$e=e=>xe(e,4),_e=(e,t)=>Se(R+S+j,$e(t),1,[e]),ze=(e,t,r,l=0,n,o)=>Se(R+E,$e(o),1,[e,t,r,l,n]),De=JSON.stringify,Ge=JSON.parse,Ke=(e,t,r,l,n,o)=>e==y?t:e==w?r:e==x?l:e==q?n:e==k?o:null,Qe=(e,t)=>({store:e,tableId:t}),Ue=(e,t)=>({queries:e,queryId:t}),We=(e,t)=>t?e:void 0,Xe=(...e)=>e,Ye=(e,t,r)=>s(()=>{const l=me(t),n=me(l)??me(e),o=r();return s=Y(n)?he(se(n,e=>[e,e])):n,a=(e,t)=>({label:t,component:o,...W(e)?{label:e}:e}),he(ve(s,(e,t)=>[t,a(e,t)]));var s,a});var Ze=c("<td>"),et=c("<th>");const tt="editable",rt=(e=[],t)=>se(me(e)??[],e=>{const r=e.component;return l=Ze(),u(l,H),i(l,d(r,t)),l;var l}),lt=(e=[])=>se(me(e)??[],e=>{return t=et(),u(t,H),i(t,()=>e.label),t;var t});var nt=c("<th>"),ot=c("<table><tbody>"),st=c("<caption>"),at=c("<thead><tr>"),ut=c("<tr>"),it=c("<td>"),dt=c("<input>"),ct=c("<input type=number>"),ht=c("<input type=checkbox>"),vt=c("<div>"),Ct=c("<button>");const mt=e=>{const t=e.sort[1],r=e.cellId;return l=nt(),m(l,"click",We(()=>e.onClick?.(r),e.onClick)),i(l,()=>G(t)||e.sort[0]!=r?null:(t?"↓":"↑")+" ",null),i(l,()=>e.label??r??"",null),v(()=>u(l,G(t)||e.sort[0]!=r?void 0:`sorted ${t?"de":"a"}scending`)),l;var l},pt=e=>h(()=>{const[t,r,l,n,o,s,a,c]=e.params,m=null==s?[]:me(s),I=me(c);return y=(g=ot()).firstChild,i(g,I?(b=st(),i(b,I),b):null,y),i(g,(f=h(()=>!1===e.headerRow),()=>{return f()?null:(s=(l=at()).firstChild,i(s,()=>lt(n),null),i(s,(r=h(()=>!1===e.idColumn),()=>r()?null:mt({sort:m,label:"Id",onClick:a})),null),i(s,()=>ve(me(t),({label:e},t)=>mt({cellId:t,label:e,sort:m,onClick:a})),null),i(s,()=>lt(o),null),l);var r,l,s}),y),i(y,()=>se(me(l),l=>{const s={...r,rowId:l};return u=ut(),i(u,()=>rt(n,s),null),i(u,(a=h(()=>!!K(e.idColumn)),()=>{return a()?null:(e=nt(),C(e,"title",l),i(e,l),e);var e}),null),i(u,()=>ve(me(t),({component:e,getComponentProps:t},r)=>{return n=it(),i(n,d(e,p(()=>pe(t,l,r),s,{cellId:r}))),n;var n}),null),i(u,()=>rt(o,s),null),u;var a,u})),v(()=>u(g,e.className)),g;var b,f,g,y}),It=e=>{const[t,n]=r(),[s,a]=r(),[d,c]=r(),[m,p]=r(),[I,b]=r(),[f,T]=r("{}"),[R,A]=r("[]"),[S,B]=r(""),[L,N]=r("");l(()=>{const t=e.thing;o(s)!==t&&(n((e=>{if(null===e)return"null";if(Y(e))return k;if(de(e))return q;const t=g(e);return(e=>e==y||e==x)(t)||t==w&&z(e)?t:void 0})(t)),a(()=>t),de(t)?T(De(t)):Y(t)?A(De(t)):(c(t+""),p(Number(t)||0),b(!!t)))});const E=(t,r)=>{r(t),a(()=>t),e.onThingChange(t)},O=(t,r,l,n)=>{r(t);try{const r=Ge(t);l(r)&&(a(()=>r),e.onThingChange(r),n(""))}catch{n("invalid")}},j=()=>{if(!e.hasSchema?.()){const r=Ke(t(),w,x,q,k,y),l=Ke(r,d(),m(),I(),re(()=>Ge(f()),{}),re(()=>Ge(R()),[]));n(r),a(()=>l),e.onThingChange(l)}};return h(()=>{const r=Ke(t(),((a=dt()).addEventListener("input",e=>E(e[J][F]+"",c)),v(()=>a.value=d()),a),((s=ct()).addEventListener("input",e=>E(Number(e[J][F]||0),p)),v(()=>s.value=m()),s),((o=ht()).addEventListener("input",e=>E(!!e[J].checked,b)),v(()=>o.checked=I()),o),((n=dt()).addEventListener("input",e=>O(e[J][F],T,de,B)),v(()=>u(n,S())),v(()=>n.value=f()),n),((l=dt()).addEventListener("input",e=>O(e[J][F],A,Y,N)),v(()=>u(l,L())),v(()=>l.value=R()),l));var l,n,o,s,a,g,y;return y=vt(),i(y,(g=h(()=>!(!1===e.showType||!r)),()=>{return g()?((e=Ct()).addEventListener("click",j),i(e,t),v(r=>{var l=t(),n=t();return l!==r.e&&C(e,"title",r.e=l),n!==r.t&&u(e,r.t=n),r},{e:void 0,t:void 0}),e):null;var e}),null),i(y,r,null),v(()=>u(y,e.class)),y})},bt=e=>{const[t,r]=[Pe(l=()=>e.tableId,n=()=>e.rowId,o=()=>e.cellId,s=()=>e.store),Je(l,n,o,te,s)];var l,n,o,s;const a=Ee(()=>e.store);return It({get thing(){return t()},onThingChange:r,class:e.className??tt+O,showType:e.showType,hasSchema:()=>!!a()?.hasTablesSchema()})},ft=e=>{const[t,r]=[Ve(l=()=>e.valueId,n=()=>e.store),Fe(l,te,n)];var l,n;const o=Ee(()=>e.store);return It({get thing(){return t()},onThingChange:r,class:e.className??tt+P,showType:e.showType,hasSchema:()=>!!o()?.hasValuesSchema()})};var gt=c("<tr>"),yt=c("<th>"),xt=c("<td>"),wt=c("<table><tbody>"),Tt=c("<thead><tr>"),qt=c("<th>.Id");const kt=(e,t)=>{const r=Oe(()=>me(e),()=>me(t));return s(()=>se(r(),t=>me(e)+"."+t))},Rt=e=>{const[t,r,l,n,o,s,a,u,c]=e.params,m=(t=>Se("RemoteRowId",Me(()=>s),5,[t,()=>e.localRowId]))(()=>o),I={tableId:l??"",rowId:e.localRowId,store:a};return f=gt(),i(f,()=>rt(u,I),null),i(f,(b=h(()=>!!K(t)),()=>{return b()?null:[(r=yt(),i(r,()=>e.localRowId),v(()=>C(r,"title",e.localRowId)),r),(t=yt(),i(t,m),v(()=>C(t,"title",m())),t)];var t,r}),null),i(f,()=>ve(me(r),({component:t,getComponentProps:r},o)=>{const[s,u]=((e,t="",r)=>e.split(t,r))(o,".",2),c=s===l?e.localRowId:s===n?m():void 0;return G(c)?null:(h=xt(),i(h,d(t,p(()=>pe(r,c,u),{store:a,tableId:s,rowId:c,cellId:u}))),h);var h}),null),i(f,()=>rt(c,I),null),f;var b,f},At=e=>{const t=Me(()=>e.relationships),r=s(()=>{return r=t(),l=e.relationshipId,[r,r?.getStore(),r?.getLocalTableId(l),r?.getRemoteTableId(l)];var r,l}),l=kt(()=>r()[2],()=>r()[1]),n=kt(()=>r()[3],()=>r()[1]),o=s(()=>[...l(),...n()]),a=Ye(o,()=>e.customCells,()=>e.editable?bt:I),d=je(()=>r()[2],()=>r()[1]);return h(()=>{const[t,l,n,o]=r(),s=Xe(e.idColumn??!0,a,n,o,e.relationshipId,t,l,e.extraCellsBefore,e.extraCellsAfter);return m=(C=wt()).firstChild,i(C,(c=h(()=>!!K(e.headerRow)),()=>{return c()?null:(l=(r=Tt()).firstChild,i(l,()=>lt(e.extraCellsBefore),null),i(l,(t=h(()=>!!K(e.idColumn)),()=>{return t()?null:[(l=qt(),s=l.firstChild,i(l,n,s),l),(e=qt(),r=e.firstChild,i(e,o,r),e)];var e,r,l,s}),null),i(l,()=>ve(a(),e=>{return t=yt(),i(t,()=>e.label),t;var t}),null),i(l,()=>lt(e.extraCellsAfter),null),r);var t,r,l}),m),i(m,()=>se(d(),e=>Rt({localRowId:e,params:s}))),v(()=>u(C,e.className)),C;var c,C,m})};var St=c("<button class=previous>←"),Bt=c("<button class=next>→");const Lt=(e,t,l,n,o,u,i,c)=>{const[h,v]=r([me(e),!!me(t),me(n)??0]);a(()=>v([me(e),!!me(t),me(n)??0]));const C=e=>{v(e),me(c)?.(e)},m=e=>{const[t,r]=h();C([t,r,e])},p=s(()=>{const e=me(i),[t,r,l]=h(),n=!0===e?Nt:e;return K(e)?null:d(n,{offset:l,get limit(){return me(o)},get total(){return me(u)},onChange:m})});return[h,e=>{if(me(l)){const[t,r,l]=h();C([e,e==t&&!r,l])}},p]},Nt=e=>h(()=>{let t=e.offset??0;const r=e.limit??e.total;(t>e.total||t<0)&&(t=0,e.onChange(0));const l=e.singular??"row",n=e.plural??l+"s";return[h(()=>{return h(()=>e.total>r)()&&[(n=St(),m(n,"click",We(()=>e.onChange(t-r),t>0)),n.disabled=0==t,n),(l=Bt(),m(l,"click",We(()=>e.onChange(t+r),t+r<e.total)),v(()=>l.disabled=t+r>=e.total),l),t+1," to ",h(()=>_(e.total,t+r))," of "];var l,n}),h(()=>e.total)," ",h(()=>1!=e.total?n:l)]}),Et=e=>{const[t,r,l]=Lt(()=>e.cellId,()=>e.descending,()=>e.sortOnClick,()=>e.offset,()=>e.limit,(n=()=>e.queryId,Se(R+L,$e(()=>e.queries),7,[n])),()=>e.paginator??!1,()=>e.onChange);var n;return pt({...e,params:Xe(Ye(_e(()=>e.queryId,()=>e.queries),()=>e.customCells,()=>b),Ue(e.queries,e.queryId),ze(()=>e.queryId,()=>t()[0],()=>t()[1],()=>t()[2],()=>e.limit,()=>e.queries),e.extraCellsBefore,e.extraCellsAfter,t,r,l)})},Ot=e=>{return pt({...e,params:Xe(Ye(_e(()=>e.queryId,()=>e.queries),()=>e.customCells,()=>b),Ue(e.queries,e.queryId),(t=()=>e.queryId,r=()=>e.queries,Se(R+N,$e(r),1,[t])),e.extraCellsBefore,e.extraCellsAfter)});var t,r},jt=e=>{const t=He(()=>e.indexes),r=s(()=>{return r=t(),l=e.indexId,[r,r?.getStore(),r?.getTableId(l)];var r,l});return pt({...e,params:Xe(Ye(Oe(()=>r()[2],()=>r()[1]),e.customCells,()=>e.editable?bt:I),Qe(r()[1],r()[2]),(l=()=>e.indexId,n=()=>e.sliceId,o=t,Se("Slice"+N,He(o),1,[l,n])),e.extraCellsBefore,e.extraCellsAfter)});var l,n,o},Pt=e=>{const[t,r,l]=Lt(()=>e.cellId,()=>e.descending,()=>e.sortOnClick,()=>e.offset,()=>e.limit,(n=()=>e.tableId,Se(L,Ee(()=>e.store),7,[n])),()=>e.paginator??!1,()=>e.onChange);var n,o,s,a,u,i,d;return pt({...e,params:Xe(Ye(Oe(()=>e.tableId,()=>e.store),()=>e.customCells,()=>!0===e.editable?bt:I),Qe(e.store,e.tableId),(o=()=>e.tableId,s=()=>t()[0],a=()=>t()[1],u=()=>t()[2],i=()=>e.limit,d=()=>e.store,de(o)?Ne(o.tableId,o.cellId,o.descending??!1,o.offset??0,o.limit,s):Ne(o,s,a,u,i,d)),e.extraCellsBefore,e.extraCellsAfter,t,r,l)})},Vt=e=>pt({...e,params:Xe(Ye(Oe(()=>e.tableId,()=>e.store),()=>e.customCells,()=>e.editable?bt:I),Qe(e.store,e.tableId),je(()=>e.tableId,()=>e.store),e.extraCellsBefore,e.extraCellsAfter)});var Jt=c("<td>"),Ft=c("<table><tbody>"),Ht=c("<thead><tr><th>"),Mt=c("<th>Id"),$t=c("<tr><td>"),_t=c("<th>");const zt=(e=[],t)=>se(me(e)??[],e=>{const r=e.component;return l=Jt(),u(l,H),i(l,d(r,t)),l;var l}),Dt=e=>{const t=Se(V,Ee(()=>e.store),1);var r,l,n;return n=(l=Ft()).firstChild,i(l,(r=h(()=>!1===e.headerRow),()=>{return r()?null:(o=(n=(l=Ht()).firstChild).firstChild,i(n,()=>lt(e.extraCellsBefore),o),i(n,(t=h(()=>!1===e.idColumn),()=>t()?null:Mt()),o),i(o,P),i(n,()=>lt(e.extraCellsAfter),null),l);var t,l,n,o}),n),i(n,()=>se(t(),t=>{const r={valueId:t,store:e.store},l=e.valueComponent??(!0===me(e.editable)?ft:f);return s=(o=$t()).firstChild,i(o,()=>zt(e.extraCellsBefore,r),s),i(o,(n=h(()=>!!K(e.idColumn)),()=>{return n()?null:(e=_t(),C(e,"title",t),i(e,t),e);var e}),s),i(s,d(l,p(()=>pe(e.getValueComponentProps,t),r))),i(o,()=>zt(e.extraCellsAfter,r),null),o;var n,o,s})),v(()=>u(l,e.className)),l};export{bt as EditableCellView,ft as EditableValueView,Rt as RelationshipInHtmlRow,At as RelationshipInHtmlTable,Et as ResultSortedTableInHtmlTable,Ot as ResultTableInHtmlTable,jt as SliceInHtmlTable,Pt as SortedTableInHtmlTable,Nt as SortedTablePaginator,Vt as TableInHtmlTable,Dt as ValuesInHtmlTable,Lt as useSortingAndPagination};
Binary file