tinybase 8.0.0 → 8.1.0-beta.1

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.
@@ -0,0 +1,2015 @@
1
+ import {getContext, setContext} from 'svelte';
2
+ import * as $ from 'svelte/internal/client';
3
+ import 'svelte/internal/disclose-version';
4
+
5
+ const getTypeOf = (thing) => typeof thing;
6
+ const TINYBASE = 'tinybase';
7
+ const EMPTY_STRING = '';
8
+ const STRING = getTypeOf(EMPTY_STRING);
9
+ const LISTENER = 'Listener';
10
+ const RESULT = 'Result';
11
+ const GET = 'get';
12
+ const ADD = 'add';
13
+ const HAS = 'Has';
14
+ const _HAS = 'has';
15
+ const IDS = 'Ids';
16
+ const TABLE = 'Table';
17
+ const TABLES = TABLE + 's';
18
+ const TABLE_IDS = TABLE + IDS;
19
+ const ROW = 'Row';
20
+ const ROW_COUNT = ROW + 'Count';
21
+ const ROW_IDS = ROW + IDS;
22
+ const SORTED_ROW_IDS = 'Sorted' + ROW + IDS;
23
+ const CELL = 'Cell';
24
+ const CELL_IDS = CELL + IDS;
25
+ const VALUE = 'Value';
26
+ const VALUES = VALUE + 's';
27
+ const VALUE_IDS = VALUE + IDS;
28
+ const STATUS = 'Status';
29
+ const METRIC = 'Metric';
30
+ const INDEX = 'Index';
31
+ const SLICE = 'Slice';
32
+ const RELATIONSHIP = 'Relationship';
33
+ const REMOTE_ROW_ID = 'Remote' + ROW + 'Id';
34
+ const LOCAL = 'Local';
35
+ const LINKED = 'Linked';
36
+ const QUERY = 'Query';
37
+ const CHECKPOINT = 'Checkpoint';
38
+
39
+ const getIfNotFunction = (predicate) => (value, then, otherwise) =>
40
+ predicate(value) ? otherwise?.() : then(value);
41
+ const isUndefined = (thing) => thing === void 0;
42
+ const ifNotUndefined = getIfNotFunction(isUndefined);
43
+ const isString = (thing) => getTypeOf(thing) == STRING;
44
+
45
+ const object = Object;
46
+ const objIds = object.keys;
47
+ const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
48
+
49
+ const TINYBASE_CONTEXT_KEY = TINYBASE + '_uisc';
50
+
51
+ /* hooks.svelte.ts generated by Svelte v5.53.8 */
52
+
53
+ const EMPTY_ARR = [];
54
+ const EMPTY_OBJ = {};
55
+ const DEFAULT_CHECKPOINT_IDS = [EMPTY_ARR, void 0, EMPTY_ARR];
56
+ const rv = (v) => (typeof v === 'function' ? v() : v);
57
+ const OFFSET_STORE = 0;
58
+ const OFFSET_METRICS = 1;
59
+ const OFFSET_INDEXES = 2;
60
+ const OFFSET_RELATIONSHIPS = 3;
61
+ const OFFSET_QUERIES = 4;
62
+ const OFFSET_CHECKPOINTS = 5;
63
+ const OFFSET_PERSISTER = 6;
64
+ const OFFSET_SYNCHRONIZER = 7;
65
+ const getCtx = () => getContext(TINYBASE_CONTEXT_KEY) ?? [];
66
+
67
+ const resolveWithCtx = (ctx, thingOrId, offset) => {
68
+ if (!isUndefined(thingOrId) && !isString(thingOrId)) return thingOrId;
69
+
70
+ return isUndefined(thingOrId)
71
+ ? ctx[offset * 2]
72
+ : objGet(ctx[offset * 2 + 1], thingOrId);
73
+ };
74
+
75
+ const resolveByOffset = (thingOrId, offset) =>
76
+ resolveWithCtx(getCtx(), thingOrId, offset);
77
+
78
+ const mkGetter = (offset, thingOrId) => {
79
+ const ctx = getCtx();
80
+
81
+ return () =>
82
+ resolveWithCtx(
83
+ ctx,
84
+ typeof thingOrId === 'function' ? thingOrId() : thingOrId,
85
+ offset,
86
+ );
87
+ };
88
+
89
+ const getThingIds = (ctx, offset) => objIds(ctx[offset * 2 + 1] ?? EMPTY_OBJ);
90
+ const sg = (s) => mkGetter(OFFSET_STORE, s);
91
+ const mg = (m) => mkGetter(OFFSET_METRICS, m);
92
+ const ig = (i) => mkGetter(OFFSET_INDEXES, i);
93
+ const rg = (r) => mkGetter(OFFSET_RELATIONSHIPS, r);
94
+ const qg = (q) => mkGetter(OFFSET_QUERIES, q);
95
+ const cg = (c) => mkGetter(OFFSET_CHECKPOINTS, c);
96
+ const pg = (p) => mkGetter(OFFSET_PERSISTER, p);
97
+ const syg = (sy) => mkGetter(OFFSET_SYNCHRONIZER, sy);
98
+
99
+ const useListenable = (
100
+ getThing,
101
+ getMethod,
102
+ addMethod,
103
+ defaultValue,
104
+ getArgs,
105
+ ) => {
106
+ let value = $.state(
107
+ $.proxy(getThing()?.[getMethod]?.(...getArgs()) ?? defaultValue),
108
+ );
109
+
110
+ $.user_effect(() => {
111
+ const thing = getThing();
112
+ const args = getArgs();
113
+
114
+ $.set(value, thing?.[getMethod]?.(...args) ?? defaultValue, true);
115
+
116
+ const listenerId = thing?.[addMethod]?.(...args, () => {
117
+ $.set(value, thing[getMethod](...getArgs()) ?? defaultValue, true);
118
+ });
119
+
120
+ return () => thing?.delListener?.(listenerId);
121
+ });
122
+
123
+ return {
124
+ get current() {
125
+ return $.get(value);
126
+ },
127
+ };
128
+ };
129
+
130
+ const useGet = (
131
+ getThing,
132
+ listenable,
133
+ defaultValue,
134
+ getArgs = () => EMPTY_ARR,
135
+ ) =>
136
+ useListenable(
137
+ getThing,
138
+ GET + listenable,
139
+ ADD + listenable + LISTENER,
140
+ defaultValue,
141
+ getArgs,
142
+ );
143
+
144
+ const useHas = (getThing, listenable, getArgs = () => EMPTY_ARR) =>
145
+ useListenable(
146
+ getThing,
147
+ _HAS + listenable,
148
+ ADD + HAS + listenable + LISTENER,
149
+ false,
150
+ getArgs,
151
+ );
152
+
153
+ const useHasTables = (storeOrStoreId) => useHas(sg(storeOrStoreId), TABLES);
154
+ const useTables = (storeOrStoreId) =>
155
+ useGet(sg(storeOrStoreId), TABLES, EMPTY_OBJ);
156
+ const useTableIds = (storeOrStoreId) =>
157
+ useGet(sg(storeOrStoreId), TABLE_IDS, EMPTY_ARR);
158
+ const useHasTable = (tableId, storeOrStoreId) =>
159
+ useHas(sg(storeOrStoreId), TABLE, () => [rv(tableId)]);
160
+ const useTable = (tableId, storeOrStoreId) =>
161
+ useGet(sg(storeOrStoreId), TABLE, EMPTY_OBJ, () => [rv(tableId)]);
162
+ const useTableCellIds = (tableId, storeOrStoreId) =>
163
+ useGet(sg(storeOrStoreId), TABLE + CELL_IDS, EMPTY_ARR, () => [rv(tableId)]);
164
+ const useHasTableCell = (tableId, cellId, storeOrStoreId) =>
165
+ useHas(sg(storeOrStoreId), TABLE + CELL, () => [rv(tableId), rv(cellId)]);
166
+ const useRowCount = (tableId, storeOrStoreId) =>
167
+ useGet(sg(storeOrStoreId), ROW_COUNT, 0, () => [rv(tableId)]);
168
+ const useRowIds = (tableId, storeOrStoreId) =>
169
+ useGet(sg(storeOrStoreId), ROW_IDS, EMPTY_ARR, () => [rv(tableId)]);
170
+
171
+ const useSortedRowIds = (
172
+ tableId,
173
+ cellId,
174
+ descending = false,
175
+ offset = 0,
176
+ limit,
177
+ storeOrStoreId,
178
+ ) =>
179
+ useGet(sg(storeOrStoreId), SORTED_ROW_IDS, EMPTY_ARR, () => [
180
+ rv(tableId),
181
+ rv(cellId),
182
+ rv(descending),
183
+ rv(offset),
184
+ rv(limit),
185
+ ]);
186
+
187
+ const useHasRow = (tableId, rowId, storeOrStoreId) =>
188
+ useHas(sg(storeOrStoreId), ROW, () => [rv(tableId), rv(rowId)]);
189
+ const useRow = (tableId, rowId, storeOrStoreId) =>
190
+ useGet(sg(storeOrStoreId), ROW, EMPTY_OBJ, () => [rv(tableId), rv(rowId)]);
191
+ const useCellIds = (tableId, rowId, storeOrStoreId) =>
192
+ useGet(sg(storeOrStoreId), CELL_IDS, EMPTY_ARR, () => [
193
+ rv(tableId),
194
+ rv(rowId),
195
+ ]);
196
+ const useHasCell = (tableId, rowId, cellId, storeOrStoreId) =>
197
+ useHas(sg(storeOrStoreId), CELL, () => [rv(tableId), rv(rowId), rv(cellId)]);
198
+ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
199
+ useGet(sg(storeOrStoreId), CELL, void 0, () => [
200
+ rv(tableId),
201
+ rv(rowId),
202
+ rv(cellId),
203
+ ]);
204
+
205
+ const useCellState = (tableId, rowId, cellId, storeOrStoreId) => {
206
+ const getS = sg(storeOrStoreId);
207
+ let value = $.state(
208
+ $.proxy(getS()?.getCell(rv(tableId), rv(rowId), rv(cellId))),
209
+ );
210
+
211
+ $.user_effect(() => {
212
+ const s = getS();
213
+
214
+ const t = rv(tableId),
215
+ r = rv(rowId),
216
+ c = rv(cellId);
217
+
218
+ $.set(value, s?.getCell(t, r, c), true);
219
+
220
+ const listenerId = s?.addCellListener(t, r, c, (st) => {
221
+ $.set(value, st.getCell(rv(tableId), rv(rowId), rv(cellId)), true);
222
+ });
223
+
224
+ return () => s?.delListener?.(listenerId);
225
+ });
226
+
227
+ return {
228
+ get current() {
229
+ return $.get(value);
230
+ },
231
+
232
+ set current(v) {
233
+ getS()?.setCell(rv(tableId), rv(rowId), rv(cellId), v);
234
+ },
235
+ };
236
+ };
237
+
238
+ const useHasValues = (storeOrStoreId) => useHas(sg(storeOrStoreId), VALUES);
239
+ const useValues = (storeOrStoreId) =>
240
+ useGet(sg(storeOrStoreId), VALUES, EMPTY_OBJ);
241
+ const useValueIds = (storeOrStoreId) =>
242
+ useGet(sg(storeOrStoreId), VALUE_IDS, EMPTY_ARR);
243
+ const useHasValue = (valueId, storeOrStoreId) =>
244
+ useHas(sg(storeOrStoreId), VALUE, () => [rv(valueId)]);
245
+ const useValue = (valueId, storeOrStoreId) =>
246
+ useGet(sg(storeOrStoreId), VALUE, void 0, () => [rv(valueId)]);
247
+
248
+ const useValueState = (valueId, storeOrStoreId) => {
249
+ const getS = sg(storeOrStoreId);
250
+ let value = $.state($.proxy(getS()?.getValue(rv(valueId))));
251
+
252
+ $.user_effect(() => {
253
+ const s = getS();
254
+ const vid = rv(valueId);
255
+
256
+ $.set(value, s?.getValue(vid), true);
257
+
258
+ const listenerId = s?.addValueListener(vid, (st) => {
259
+ $.set(value, st.getValue(rv(valueId)), true);
260
+ });
261
+
262
+ return () => s?.delListener?.(listenerId);
263
+ });
264
+
265
+ return {
266
+ get current() {
267
+ return $.get(value);
268
+ },
269
+
270
+ set current(v) {
271
+ getS()?.setValue(rv(valueId), v);
272
+ },
273
+ };
274
+ };
275
+
276
+ const useStore = (id) => resolveByOffset(id, OFFSET_STORE);
277
+
278
+ const useStoreIds = () => {
279
+ const ctx = getCtx();
280
+ let ids = $.state($.proxy(getThingIds(ctx, OFFSET_STORE)));
281
+
282
+ $.user_effect(() => {
283
+ $.set(ids, getThingIds(ctx, OFFSET_STORE), true);
284
+ });
285
+
286
+ return {
287
+ get current() {
288
+ return $.get(ids);
289
+ },
290
+ };
291
+ };
292
+
293
+ const useMetrics = (id) => resolveByOffset(id, OFFSET_METRICS);
294
+
295
+ const useMetricsIds = () => {
296
+ const ctx = getCtx();
297
+ let ids = $.state($.proxy(getThingIds(ctx, OFFSET_METRICS)));
298
+
299
+ $.user_effect(() => {
300
+ $.set(ids, getThingIds(ctx, OFFSET_METRICS), true);
301
+ });
302
+
303
+ return {
304
+ get current() {
305
+ return $.get(ids);
306
+ },
307
+ };
308
+ };
309
+
310
+ const useMetricIds = (metricsOrMetricsId) =>
311
+ useGet(mg(metricsOrMetricsId), METRIC + IDS, EMPTY_ARR);
312
+ const useMetric = (metricId, metricsOrMetricsId) =>
313
+ useGet(mg(metricsOrMetricsId), METRIC, void 0, () => [rv(metricId)]);
314
+ const useIndexes = (id) => resolveByOffset(id, OFFSET_INDEXES);
315
+
316
+ const useIndexesIds = () => {
317
+ const ctx = getCtx();
318
+ let ids = $.state($.proxy(getThingIds(ctx, OFFSET_INDEXES)));
319
+
320
+ $.user_effect(() => {
321
+ $.set(ids, getThingIds(ctx, OFFSET_INDEXES), true);
322
+ });
323
+
324
+ return {
325
+ get current() {
326
+ return $.get(ids);
327
+ },
328
+ };
329
+ };
330
+
331
+ const useIndexIds = (indexesOrIndexesId) =>
332
+ useGet(ig(indexesOrIndexesId), INDEX + IDS, EMPTY_ARR);
333
+ const useSliceIds = (indexId, indexesOrIndexesId) =>
334
+ useGet(ig(indexesOrIndexesId), SLICE + IDS, EMPTY_ARR, () => [rv(indexId)]);
335
+ const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
336
+ useGet(ig(indexesOrIndexesId), SLICE + ROW_IDS, EMPTY_ARR, () => [
337
+ rv(indexId),
338
+ rv(sliceId),
339
+ ]);
340
+ const useQueries = (id) => resolveByOffset(id, OFFSET_QUERIES);
341
+
342
+ const useQueriesIds = () => {
343
+ const ctx = getCtx();
344
+ let ids = $.state($.proxy(getThingIds(ctx, OFFSET_QUERIES)));
345
+
346
+ $.user_effect(() => {
347
+ $.set(ids, getThingIds(ctx, OFFSET_QUERIES), true);
348
+ });
349
+
350
+ return {
351
+ get current() {
352
+ return $.get(ids);
353
+ },
354
+ };
355
+ };
356
+
357
+ const useQueryIds = (queriesOrQueriesId) =>
358
+ useGet(qg(queriesOrQueriesId), QUERY + IDS, EMPTY_ARR);
359
+ const useResultTable = (queryId, queriesOrQueriesId) =>
360
+ useGet(qg(queriesOrQueriesId), RESULT + TABLE, EMPTY_OBJ, () => [
361
+ rv(queryId),
362
+ ]);
363
+ const useResultTableCellIds = (queryId, queriesOrQueriesId) =>
364
+ useGet(qg(queriesOrQueriesId), RESULT + TABLE + CELL_IDS, EMPTY_ARR, () => [
365
+ rv(queryId),
366
+ ]);
367
+ const useResultRowCount = (queryId, queriesOrQueriesId) =>
368
+ useGet(qg(queriesOrQueriesId), RESULT + ROW_COUNT, 0, () => [rv(queryId)]);
369
+ const useResultRowIds = (queryId, queriesOrQueriesId) =>
370
+ useGet(qg(queriesOrQueriesId), RESULT + ROW_IDS, EMPTY_ARR, () => [
371
+ rv(queryId),
372
+ ]);
373
+
374
+ const useResultSortedRowIds = (
375
+ queryId,
376
+ cellId,
377
+ descending = false,
378
+ offset = 0,
379
+ limit,
380
+ queriesOrQueriesId,
381
+ ) =>
382
+ useGet(qg(queriesOrQueriesId), RESULT + SORTED_ROW_IDS, EMPTY_ARR, () => [
383
+ rv(queryId),
384
+ rv(cellId),
385
+ rv(descending),
386
+ rv(offset),
387
+ rv(limit),
388
+ ]);
389
+
390
+ const useResultRow = (queryId, rowId, queriesOrQueriesId) =>
391
+ useGet(qg(queriesOrQueriesId), RESULT + ROW, EMPTY_OBJ, () => [
392
+ rv(queryId),
393
+ rv(rowId),
394
+ ]);
395
+ const useResultCellIds = (queryId, rowId, queriesOrQueriesId) =>
396
+ useGet(qg(queriesOrQueriesId), RESULT + CELL_IDS, EMPTY_ARR, () => [
397
+ rv(queryId),
398
+ rv(rowId),
399
+ ]);
400
+ const useResultCell = (queryId, rowId, cellId, queriesOrQueriesId) =>
401
+ useGet(qg(queriesOrQueriesId), RESULT + CELL, void 0, () => [
402
+ rv(queryId),
403
+ rv(rowId),
404
+ rv(cellId),
405
+ ]);
406
+ const useRelationships = (id) => resolveByOffset(id, OFFSET_RELATIONSHIPS);
407
+
408
+ const useRelationshipsIds = () => {
409
+ const ctx = getCtx();
410
+ let ids = $.state($.proxy(getThingIds(ctx, OFFSET_RELATIONSHIPS)));
411
+
412
+ $.user_effect(() => {
413
+ $.set(ids, getThingIds(ctx, OFFSET_RELATIONSHIPS), true);
414
+ });
415
+
416
+ return {
417
+ get current() {
418
+ return $.get(ids);
419
+ },
420
+ };
421
+ };
422
+
423
+ const useRelationshipIds = (relationshipsOrRelationshipsId) =>
424
+ useGet(rg(relationshipsOrRelationshipsId), RELATIONSHIP + IDS, EMPTY_ARR);
425
+ const useRemoteRowId = (
426
+ relationshipId,
427
+ localRowId,
428
+ relationshipsOrRelationshipsId,
429
+ ) =>
430
+ useGet(rg(relationshipsOrRelationshipsId), REMOTE_ROW_ID, void 0, () => [
431
+ rv(relationshipId),
432
+ rv(localRowId),
433
+ ]);
434
+ const useLocalRowIds = (
435
+ relationshipId,
436
+ remoteRowId,
437
+ relationshipsOrRelationshipsId,
438
+ ) =>
439
+ useGet(rg(relationshipsOrRelationshipsId), LOCAL + ROW_IDS, EMPTY_ARR, () => [
440
+ rv(relationshipId),
441
+ rv(remoteRowId),
442
+ ]);
443
+ const useLinkedRowIds = (
444
+ relationshipId,
445
+ firstRowId,
446
+ relationshipsOrRelationshipsId,
447
+ ) =>
448
+ useGet(
449
+ rg(relationshipsOrRelationshipsId),
450
+ LINKED + ROW_IDS,
451
+ EMPTY_ARR,
452
+ () => [rv(relationshipId), rv(firstRowId)],
453
+ );
454
+ const useCheckpoints = (id) => resolveByOffset(id, OFFSET_CHECKPOINTS);
455
+
456
+ const useCheckpointsIds = () => {
457
+ const ctx = getCtx();
458
+ let ids = $.state($.proxy(getThingIds(ctx, OFFSET_CHECKPOINTS)));
459
+
460
+ $.user_effect(() => {
461
+ $.set(ids, getThingIds(ctx, OFFSET_CHECKPOINTS), true);
462
+ });
463
+
464
+ return {
465
+ get current() {
466
+ return $.get(ids);
467
+ },
468
+ };
469
+ };
470
+
471
+ const useCheckpointIds = (checkpointsOrCheckpointsId) =>
472
+ useGet(
473
+ cg(checkpointsOrCheckpointsId),
474
+ CHECKPOINT + IDS,
475
+ DEFAULT_CHECKPOINT_IDS,
476
+ );
477
+ const useCheckpoint = (checkpointId, checkpointsOrCheckpointsId) =>
478
+ useGet(cg(checkpointsOrCheckpointsId), CHECKPOINT, void 0, () => [
479
+ rv(checkpointId),
480
+ ]);
481
+
482
+ const useGoBackwardCallback = (checkpointsOrCheckpointsId) => {
483
+ const getC = cg(checkpointsOrCheckpointsId);
484
+
485
+ return () => getC()?.goBackward();
486
+ };
487
+
488
+ const useGoForwardCallback = (checkpointsOrCheckpointsId) => {
489
+ const getC = cg(checkpointsOrCheckpointsId);
490
+
491
+ return () => getC()?.goForward();
492
+ };
493
+
494
+ const usePersister = (id) => resolveByOffset(id, OFFSET_PERSISTER);
495
+
496
+ const usePersisterIds = () => {
497
+ const ctx = getCtx();
498
+ let ids = $.state($.proxy(getThingIds(ctx, OFFSET_PERSISTER)));
499
+
500
+ $.user_effect(() => {
501
+ $.set(ids, getThingIds(ctx, OFFSET_PERSISTER), true);
502
+ });
503
+
504
+ return {
505
+ get current() {
506
+ return $.get(ids);
507
+ },
508
+ };
509
+ };
510
+
511
+ const usePersisterStatus = (persisterOrPersisterId) =>
512
+ useGet(pg(persisterOrPersisterId), STATUS, 0);
513
+ const useSynchronizer = (id) => resolveByOffset(id, OFFSET_SYNCHRONIZER);
514
+
515
+ const useSynchronizerIds = () => {
516
+ const ctx = getCtx();
517
+ let ids = $.state($.proxy(getThingIds(ctx, OFFSET_SYNCHRONIZER)));
518
+
519
+ $.user_effect(() => {
520
+ $.set(ids, getThingIds(ctx, OFFSET_SYNCHRONIZER), true);
521
+ });
522
+
523
+ return {
524
+ get current() {
525
+ return $.get(ids);
526
+ },
527
+ };
528
+ };
529
+
530
+ const useSynchronizerStatus = (synchronizerOrSynchronizerId) =>
531
+ useGet(syg(synchronizerOrSynchronizerId), STATUS, 0);
532
+
533
+ const injectThing = (offset, id, thing) => {
534
+ const ctx = getCtx();
535
+
536
+ $.user_effect(() => {
537
+ ctx[16]?.(offset, id, thing);
538
+
539
+ return () => ctx[17]?.(offset, id);
540
+ });
541
+ };
542
+
543
+ const provideStore = (storeId, store) =>
544
+ injectThing(OFFSET_STORE, storeId, store);
545
+ const provideMetrics = (metricsId, metrics) =>
546
+ injectThing(OFFSET_METRICS, metricsId, metrics);
547
+ const provideIndexes = (indexesId, indexes) =>
548
+ injectThing(OFFSET_INDEXES, indexesId, indexes);
549
+ const provideRelationships = (relationshipsId, relationships) =>
550
+ injectThing(OFFSET_RELATIONSHIPS, relationshipsId, relationships);
551
+ const provideQueries = (queriesId, queries) =>
552
+ injectThing(OFFSET_QUERIES, queriesId, queries);
553
+ const provideCheckpoints = (checkpointsId, checkpoints) =>
554
+ injectThing(OFFSET_CHECKPOINTS, checkpointsId, checkpoints);
555
+ const providePersister = (persisterId, persister) =>
556
+ injectThing(OFFSET_PERSISTER, persisterId, persister);
557
+ const provideSynchronizer = (synchronizerId, synchronizer) =>
558
+ injectThing(OFFSET_SYNCHRONIZER, synchronizerId, synchronizer);
559
+
560
+ function CheckpointView($$anchor, $$props) {
561
+ $.push($$props, true);
562
+
563
+ const checkpoint = useCheckpoint(
564
+ () => $$props.checkpointId,
565
+ () => $$props.checkpoints,
566
+ );
567
+ const display = $.derived(() => '' + (checkpoint.current ?? ''));
568
+
569
+ const output = $.derived(() =>
570
+ $$props.debugIds
571
+ ? `${$$props.checkpointId}:{${$.get(display)}}`
572
+ : $.get(display),
573
+ );
574
+
575
+ $.next();
576
+
577
+ var text = $.text();
578
+
579
+ $.template_effect(() => $.set_text(text, $.get(output)));
580
+ $.append($$anchor, text);
581
+ $.pop();
582
+ }
583
+
584
+ var root_2 = $.from_html(`<!><!>`, 1);
585
+ var root$1 = $.from_html(`<!><!><!>`, 1);
586
+
587
+ function ItemsView($$anchor, $$props) {
588
+ var fragment = root$1();
589
+ var node = $.first_child(fragment);
590
+
591
+ {
592
+ var consequent = ($$anchor) => {
593
+ var text = $.text();
594
+
595
+ $.template_effect(() => $.set_text(text, `${$$props.id ?? ''}:{`));
596
+ $.append($$anchor, text);
597
+ };
598
+
599
+ $.if(node, ($$render) => {
600
+ if ($$props.debugIds && $$props.id !== undefined) $$render(consequent);
601
+ });
602
+ }
603
+
604
+ var node_1 = $.sibling(node);
605
+
606
+ $.each(
607
+ node_1,
608
+ 17,
609
+ () => $$props.ids,
610
+ $.index,
611
+ ($$anchor, itemId, i) => {
612
+ var fragment_2 = root_2();
613
+ var node_2 = $.first_child(fragment_2);
614
+
615
+ {
616
+ var consequent_1 = ($$anchor) => {
617
+ var fragment_3 = $.comment();
618
+ var node_3 = $.first_child(fragment_3);
619
+
620
+ $.snippet(node_3, () => $$props.separator);
621
+ $.append($$anchor, fragment_3);
622
+ };
623
+
624
+ $.if(node_2, ($$render) => {
625
+ if (i > 0 && $$props.separator) $$render(consequent_1);
626
+ });
627
+ }
628
+
629
+ var node_4 = $.sibling(node_2);
630
+
631
+ {
632
+ var consequent_2 = ($$anchor) => {
633
+ var fragment_4 = $.comment();
634
+ var node_5 = $.first_child(fragment_4);
635
+
636
+ $.snippet(
637
+ node_5,
638
+ () => $$props.custom,
639
+ () => $.get(itemId),
640
+ );
641
+ $.append($$anchor, fragment_4);
642
+ };
643
+
644
+ var alternate = ($$anchor) => {
645
+ var fragment_5 = $.comment();
646
+ var node_6 = $.first_child(fragment_5);
647
+
648
+ $.snippet(
649
+ node_6,
650
+ () => $$props.children,
651
+ () => $.get(itemId),
652
+ );
653
+ $.append($$anchor, fragment_5);
654
+ };
655
+
656
+ $.if(node_4, ($$render) => {
657
+ if ($$props.custom) $$render(consequent_2);
658
+ else $$render(alternate, -1);
659
+ });
660
+ }
661
+
662
+ $.append($$anchor, fragment_2);
663
+ },
664
+ );
665
+
666
+ var node_7 = $.sibling(node_1);
667
+
668
+ {
669
+ var consequent_3 = ($$anchor) => {
670
+ var text_1 = $.text();
671
+
672
+ text_1.nodeValue = '}';
673
+ $.append($$anchor, text_1);
674
+ };
675
+
676
+ $.if(node_7, ($$render) => {
677
+ if ($$props.debugIds && $$props.id !== undefined) $$render(consequent_3);
678
+ });
679
+ }
680
+
681
+ $.append($$anchor, fragment);
682
+ }
683
+
684
+ function BackwardCheckpointsView($$anchor, $$props) {
685
+ $.push($$props, true);
686
+
687
+ const checkpointIds = useCheckpointIds(() => $$props.checkpoints);
688
+ const ids = $.derived(() => checkpointIds.current[0]);
689
+
690
+ {
691
+ const children = ($$anchor, checkpointId = $.noop) => {
692
+ CheckpointView($$anchor, {
693
+ get checkpointId() {
694
+ return checkpointId();
695
+ },
696
+
697
+ get checkpoints() {
698
+ return $$props.checkpoints;
699
+ },
700
+
701
+ get debugIds() {
702
+ return $$props.debugIds;
703
+ },
704
+ });
705
+ };
706
+
707
+ ItemsView($$anchor, {
708
+ get ids() {
709
+ return $.get(ids);
710
+ },
711
+
712
+ get separator() {
713
+ return $$props.separator;
714
+ },
715
+
716
+ get debugIds() {
717
+ return $$props.debugIds;
718
+ },
719
+
720
+ get custom() {
721
+ return $$props.checkpoint;
722
+ },
723
+ children,
724
+ });
725
+ }
726
+
727
+ $.pop();
728
+ }
729
+
730
+ function CellView($$anchor, $$props) {
731
+ $.push($$props, true);
732
+
733
+ const cell = useCell(
734
+ () => $$props.tableId,
735
+ () => $$props.rowId,
736
+ () => $$props.cellId,
737
+ () => $$props.store,
738
+ );
739
+ const display = $.derived(() => '' + (cell.current ?? ''));
740
+
741
+ const output = $.derived(() =>
742
+ $$props.debugIds ? `${$$props.cellId}:{${$.get(display)}}` : $.get(display),
743
+ );
744
+
745
+ $.next();
746
+
747
+ var text = $.text();
748
+
749
+ $.template_effect(() => $.set_text(text, $.get(output)));
750
+ $.append($$anchor, text);
751
+ $.pop();
752
+ }
753
+
754
+ function CurrentCheckpointView($$anchor, $$props) {
755
+ $.push($$props, true);
756
+
757
+ const checkpointIds = useCheckpointIds(() => $$props.checkpoints);
758
+ const currentId = $.derived(() => checkpointIds.current[1]);
759
+ var fragment = $.comment();
760
+ var node = $.first_child(fragment);
761
+
762
+ {
763
+ var consequent_1 = ($$anchor) => {
764
+ var fragment_1 = $.comment();
765
+ var node_1 = $.first_child(fragment_1);
766
+
767
+ {
768
+ var consequent = ($$anchor) => {
769
+ var fragment_2 = $.comment();
770
+ var node_2 = $.first_child(fragment_2);
771
+
772
+ $.snippet(
773
+ node_2,
774
+ () => $$props.checkpoint,
775
+ () => $.get(currentId),
776
+ );
777
+ $.append($$anchor, fragment_2);
778
+ };
779
+
780
+ var alternate = ($$anchor) => {
781
+ CheckpointView($$anchor, {
782
+ get checkpointId() {
783
+ return $.get(currentId);
784
+ },
785
+
786
+ get checkpoints() {
787
+ return $$props.checkpoints;
788
+ },
789
+
790
+ get debugIds() {
791
+ return $$props.debugIds;
792
+ },
793
+ });
794
+ };
795
+
796
+ $.if(node_1, ($$render) => {
797
+ if ($$props.checkpoint) $$render(consequent);
798
+ else $$render(alternate, -1);
799
+ });
800
+ }
801
+
802
+ $.append($$anchor, fragment_1);
803
+ };
804
+
805
+ $.if(node, ($$render) => {
806
+ if ($.get(currentId) !== undefined) $$render(consequent_1);
807
+ });
808
+ }
809
+
810
+ $.append($$anchor, fragment);
811
+ $.pop();
812
+ }
813
+
814
+ function ForwardCheckpointsView($$anchor, $$props) {
815
+ $.push($$props, true);
816
+
817
+ const checkpointIds = useCheckpointIds(() => $$props.checkpoints);
818
+ const ids = $.derived(() => checkpointIds.current[2]);
819
+
820
+ {
821
+ const children = ($$anchor, checkpointId = $.noop) => {
822
+ CheckpointView($$anchor, {
823
+ get checkpointId() {
824
+ return checkpointId();
825
+ },
826
+
827
+ get checkpoints() {
828
+ return $$props.checkpoints;
829
+ },
830
+
831
+ get debugIds() {
832
+ return $$props.debugIds;
833
+ },
834
+ });
835
+ };
836
+
837
+ ItemsView($$anchor, {
838
+ get ids() {
839
+ return $.get(ids);
840
+ },
841
+
842
+ get separator() {
843
+ return $$props.separator;
844
+ },
845
+
846
+ get debugIds() {
847
+ return $$props.debugIds;
848
+ },
849
+
850
+ get custom() {
851
+ return $$props.checkpoint;
852
+ },
853
+ children,
854
+ });
855
+ }
856
+
857
+ $.pop();
858
+ }
859
+
860
+ function RowView($$anchor, $$props) {
861
+ $.push($$props, true);
862
+
863
+ const defaultCellIds = useCellIds(
864
+ () => $$props.tableId,
865
+ () => $$props.rowId,
866
+ () => $$props.store,
867
+ );
868
+ const activeCellIds = $.derived(
869
+ () => $$props.customCellIds ?? defaultCellIds.current,
870
+ );
871
+
872
+ {
873
+ const children = ($$anchor, cellId = $.noop) => {
874
+ CellView($$anchor, {
875
+ get tableId() {
876
+ return $$props.tableId;
877
+ },
878
+
879
+ get rowId() {
880
+ return $$props.rowId;
881
+ },
882
+
883
+ get cellId() {
884
+ return cellId();
885
+ },
886
+
887
+ get store() {
888
+ return $$props.store;
889
+ },
890
+
891
+ get debugIds() {
892
+ return $$props.debugIds;
893
+ },
894
+ });
895
+ };
896
+
897
+ ItemsView($$anchor, {
898
+ get ids() {
899
+ return $.get(activeCellIds);
900
+ },
901
+
902
+ get separator() {
903
+ return $$props.separator;
904
+ },
905
+
906
+ get debugIds() {
907
+ return $$props.debugIds;
908
+ },
909
+
910
+ get id() {
911
+ return $$props.rowId;
912
+ },
913
+
914
+ get custom() {
915
+ return $$props.cell;
916
+ },
917
+ children,
918
+ });
919
+ }
920
+
921
+ $.pop();
922
+ }
923
+
924
+ function SliceView($$anchor, $$props) {
925
+ $.push($$props, true);
926
+
927
+ // Capture context at init to resolve Indexes → store/tableId
928
+ const _ctx = getContext(TINYBASE_CONTEXT_KEY) ?? [];
929
+
930
+ const _resolvedIndexes = $.derived(() =>
931
+ isString($$props.indexes)
932
+ ? objGet(_ctx[5], $$props.indexes)
933
+ : ($$props.indexes ?? _ctx[4]),
934
+ );
935
+
936
+ const _store = $.derived(() => $.get(_resolvedIndexes)?.getStore());
937
+ const _tableId = $.derived(() =>
938
+ $.get(_resolvedIndexes)?.getTableId($$props.indexId),
939
+ );
940
+ const rowIds = useSliceRowIds(
941
+ () => $$props.indexId,
942
+ () => $$props.sliceId,
943
+ () => $$props.indexes,
944
+ );
945
+
946
+ {
947
+ const children = ($$anchor, rowId = $.noop) => {
948
+ var fragment_1 = $.comment();
949
+ var node = $.first_child(fragment_1);
950
+
951
+ {
952
+ var consequent = ($$anchor) => {
953
+ RowView($$anchor, {
954
+ get tableId() {
955
+ return $.get(_tableId);
956
+ },
957
+
958
+ get rowId() {
959
+ return rowId();
960
+ },
961
+
962
+ get store() {
963
+ return $.get(_store);
964
+ },
965
+
966
+ get debugIds() {
967
+ return $$props.debugIds;
968
+ },
969
+ });
970
+ };
971
+
972
+ $.if(node, ($$render) => {
973
+ if ($.get(_tableId)) $$render(consequent);
974
+ });
975
+ }
976
+
977
+ $.append($$anchor, fragment_1);
978
+ };
979
+
980
+ ItemsView($$anchor, {
981
+ get ids() {
982
+ return rowIds.current;
983
+ },
984
+
985
+ get separator() {
986
+ return $$props.separator;
987
+ },
988
+
989
+ get debugIds() {
990
+ return $$props.debugIds;
991
+ },
992
+
993
+ get id() {
994
+ return $$props.sliceId;
995
+ },
996
+
997
+ get custom() {
998
+ return $$props.row;
999
+ },
1000
+ children,
1001
+ });
1002
+ }
1003
+
1004
+ $.pop();
1005
+ }
1006
+
1007
+ function IndexView($$anchor, $$props) {
1008
+ $.push($$props, true);
1009
+
1010
+ const sliceIds = useSliceIds(
1011
+ () => $$props.indexId,
1012
+ () => $$props.indexes,
1013
+ );
1014
+
1015
+ {
1016
+ const children = ($$anchor, sliceId = $.noop) => {
1017
+ SliceView($$anchor, {
1018
+ get indexId() {
1019
+ return $$props.indexId;
1020
+ },
1021
+
1022
+ get sliceId() {
1023
+ return sliceId();
1024
+ },
1025
+
1026
+ get indexes() {
1027
+ return $$props.indexes;
1028
+ },
1029
+
1030
+ get debugIds() {
1031
+ return $$props.debugIds;
1032
+ },
1033
+ });
1034
+ };
1035
+
1036
+ ItemsView($$anchor, {
1037
+ get ids() {
1038
+ return sliceIds.current;
1039
+ },
1040
+
1041
+ get separator() {
1042
+ return $$props.separator;
1043
+ },
1044
+
1045
+ get debugIds() {
1046
+ return $$props.debugIds;
1047
+ },
1048
+
1049
+ get id() {
1050
+ return $$props.indexId;
1051
+ },
1052
+
1053
+ get custom() {
1054
+ return $$props.slice;
1055
+ },
1056
+ children,
1057
+ });
1058
+ }
1059
+
1060
+ $.pop();
1061
+ }
1062
+
1063
+ function LinkedRowsView($$anchor, $$props) {
1064
+ $.push($$props, true);
1065
+
1066
+ // Capture context at init to resolve Relationships → store/tableId
1067
+ const _ctx = getContext(TINYBASE_CONTEXT_KEY) ?? [];
1068
+
1069
+ const _resolvedRelationships = $.derived(() =>
1070
+ isString($$props.relationships)
1071
+ ? objGet(_ctx[7], $$props.relationships)
1072
+ : ($$props.relationships ?? _ctx[6]),
1073
+ );
1074
+
1075
+ const _store = $.derived(() => $.get(_resolvedRelationships)?.getStore());
1076
+ const _tableId = $.derived(() =>
1077
+ $.get(_resolvedRelationships)?.getLocalTableId($$props.relationshipId),
1078
+ );
1079
+ const rowIds = useLinkedRowIds(
1080
+ () => $$props.relationshipId,
1081
+ () => $$props.firstRowId,
1082
+ () => $$props.relationships,
1083
+ );
1084
+
1085
+ {
1086
+ const children = ($$anchor, rowId = $.noop) => {
1087
+ var fragment_1 = $.comment();
1088
+ var node = $.first_child(fragment_1);
1089
+
1090
+ {
1091
+ var consequent = ($$anchor) => {
1092
+ RowView($$anchor, {
1093
+ get tableId() {
1094
+ return $.get(_tableId);
1095
+ },
1096
+
1097
+ get rowId() {
1098
+ return rowId();
1099
+ },
1100
+
1101
+ get store() {
1102
+ return $.get(_store);
1103
+ },
1104
+
1105
+ get debugIds() {
1106
+ return $$props.debugIds;
1107
+ },
1108
+ });
1109
+ };
1110
+
1111
+ $.if(node, ($$render) => {
1112
+ if ($.get(_tableId)) $$render(consequent);
1113
+ });
1114
+ }
1115
+
1116
+ $.append($$anchor, fragment_1);
1117
+ };
1118
+
1119
+ ItemsView($$anchor, {
1120
+ get ids() {
1121
+ return rowIds.current;
1122
+ },
1123
+
1124
+ get separator() {
1125
+ return $$props.separator;
1126
+ },
1127
+
1128
+ get debugIds() {
1129
+ return $$props.debugIds;
1130
+ },
1131
+
1132
+ get id() {
1133
+ return $$props.firstRowId;
1134
+ },
1135
+
1136
+ get custom() {
1137
+ return $$props.row;
1138
+ },
1139
+ children,
1140
+ });
1141
+ }
1142
+
1143
+ $.pop();
1144
+ }
1145
+
1146
+ function LocalRowsView($$anchor, $$props) {
1147
+ $.push($$props, true);
1148
+
1149
+ // Capture context at init to resolve Relationships → store/tableId
1150
+ const _ctx = getContext(TINYBASE_CONTEXT_KEY) ?? [];
1151
+
1152
+ const _resolvedRelationships = $.derived(() =>
1153
+ isString($$props.relationships)
1154
+ ? objGet(_ctx[7], $$props.relationships)
1155
+ : ($$props.relationships ?? _ctx[6]),
1156
+ );
1157
+
1158
+ const _store = $.derived(() => $.get(_resolvedRelationships)?.getStore());
1159
+ const _tableId = $.derived(() =>
1160
+ $.get(_resolvedRelationships)?.getLocalTableId($$props.relationshipId),
1161
+ );
1162
+ const rowIds = useLocalRowIds(
1163
+ () => $$props.relationshipId,
1164
+ () => $$props.remoteRowId,
1165
+ () => $$props.relationships,
1166
+ );
1167
+
1168
+ {
1169
+ const children = ($$anchor, rowId = $.noop) => {
1170
+ var fragment_1 = $.comment();
1171
+ var node = $.first_child(fragment_1);
1172
+
1173
+ {
1174
+ var consequent = ($$anchor) => {
1175
+ RowView($$anchor, {
1176
+ get tableId() {
1177
+ return $.get(_tableId);
1178
+ },
1179
+
1180
+ get rowId() {
1181
+ return rowId();
1182
+ },
1183
+
1184
+ get store() {
1185
+ return $.get(_store);
1186
+ },
1187
+
1188
+ get debugIds() {
1189
+ return $$props.debugIds;
1190
+ },
1191
+ });
1192
+ };
1193
+
1194
+ $.if(node, ($$render) => {
1195
+ if ($.get(_tableId)) $$render(consequent);
1196
+ });
1197
+ }
1198
+
1199
+ $.append($$anchor, fragment_1);
1200
+ };
1201
+
1202
+ ItemsView($$anchor, {
1203
+ get ids() {
1204
+ return rowIds.current;
1205
+ },
1206
+
1207
+ get separator() {
1208
+ return $$props.separator;
1209
+ },
1210
+
1211
+ get debugIds() {
1212
+ return $$props.debugIds;
1213
+ },
1214
+
1215
+ get id() {
1216
+ return $$props.remoteRowId;
1217
+ },
1218
+
1219
+ get custom() {
1220
+ return $$props.row;
1221
+ },
1222
+ children,
1223
+ });
1224
+ }
1225
+
1226
+ $.pop();
1227
+ }
1228
+
1229
+ function MetricView($$anchor, $$props) {
1230
+ $.push($$props, true);
1231
+
1232
+ const metric = useMetric(
1233
+ () => $$props.metricId,
1234
+ () => $$props.metrics,
1235
+ );
1236
+ const display = $.derived(() => '' + (metric.current ?? ''));
1237
+
1238
+ const output = $.derived(() =>
1239
+ $$props.debugIds
1240
+ ? `${$$props.metricId}:{${$.get(display)}}`
1241
+ : $.get(display),
1242
+ );
1243
+
1244
+ $.next();
1245
+
1246
+ var text = $.text();
1247
+
1248
+ $.template_effect(() => $.set_text(text, $.get(output)));
1249
+ $.append($$anchor, text);
1250
+ $.pop();
1251
+ }
1252
+
1253
+ function Provider($$anchor, $$props) {
1254
+ $.push($$props, true);
1255
+
1256
+ const parentCtx = getContext(TINYBASE_CONTEXT_KEY) ?? [];
1257
+ let extras = $.proxy(Array.from({length: 8}, () => ({})));
1258
+
1259
+ const addThing = (offset, id, thing) => {
1260
+ extras[offset] = {...extras[offset], [id]: thing};
1261
+ };
1262
+
1263
+ const delThing = (offset, id) => {
1264
+ const {[id]: _, ...rest} = extras[offset];
1265
+
1266
+ extras[offset] = rest;
1267
+ };
1268
+
1269
+ const ctx = {
1270
+ get [0]() {
1271
+ return $$props.store ?? parentCtx[0];
1272
+ },
1273
+
1274
+ get [1]() {
1275
+ return {...(parentCtx[1] ?? {}), ...$$props.storesById, ...extras[0]};
1276
+ },
1277
+
1278
+ get [2]() {
1279
+ return $$props.metrics ?? parentCtx[2];
1280
+ },
1281
+
1282
+ get [3]() {
1283
+ return {...(parentCtx[3] ?? {}), ...$$props.metricsById, ...extras[1]};
1284
+ },
1285
+
1286
+ get [4]() {
1287
+ return $$props.indexes ?? parentCtx[4];
1288
+ },
1289
+
1290
+ get [5]() {
1291
+ return {...(parentCtx[5] ?? {}), ...$$props.indexesById, ...extras[2]};
1292
+ },
1293
+
1294
+ get [6]() {
1295
+ return $$props.relationships ?? parentCtx[6];
1296
+ },
1297
+
1298
+ get [7]() {
1299
+ return {
1300
+ ...(parentCtx[7] ?? {}),
1301
+ ...$$props.relationshipsById,
1302
+ ...extras[3],
1303
+ };
1304
+ },
1305
+
1306
+ get [8]() {
1307
+ return $$props.queries ?? parentCtx[8];
1308
+ },
1309
+
1310
+ get [9]() {
1311
+ return {...(parentCtx[9] ?? {}), ...$$props.queriesById, ...extras[4]};
1312
+ },
1313
+
1314
+ get [10]() {
1315
+ return $$props.checkpoints ?? parentCtx[10];
1316
+ },
1317
+
1318
+ get [11]() {
1319
+ return {
1320
+ ...(parentCtx[11] ?? {}),
1321
+ ...$$props.checkpointsById,
1322
+ ...extras[5],
1323
+ };
1324
+ },
1325
+
1326
+ get [12]() {
1327
+ return $$props.persister ?? parentCtx[12];
1328
+ },
1329
+
1330
+ get [13]() {
1331
+ return {
1332
+ ...(parentCtx[13] ?? {}),
1333
+ ...$$props.persistersById,
1334
+ ...extras[6],
1335
+ };
1336
+ },
1337
+
1338
+ get [14]() {
1339
+ return $$props.synchronizer ?? parentCtx[14];
1340
+ },
1341
+
1342
+ get [15]() {
1343
+ return {
1344
+ ...(parentCtx[15] ?? {}),
1345
+ ...$$props.synchronizersById,
1346
+ ...extras[7],
1347
+ };
1348
+ },
1349
+
1350
+ get [16]() {
1351
+ return addThing;
1352
+ },
1353
+
1354
+ get [17]() {
1355
+ return delThing;
1356
+ },
1357
+ };
1358
+
1359
+ setContext(TINYBASE_CONTEXT_KEY, ctx);
1360
+
1361
+ var fragment = $.comment();
1362
+ var node = $.first_child(fragment);
1363
+
1364
+ $.snippet(node, () => $$props.children);
1365
+ $.append($$anchor, fragment);
1366
+ $.pop();
1367
+ }
1368
+
1369
+ var root = $.from_html(`<!><!><!>`, 1);
1370
+
1371
+ function RemoteRowView($$anchor, $$props) {
1372
+ $.push($$props, true);
1373
+
1374
+ // Capture context at init to resolve Relationships → store/tableId
1375
+ const _ctx = getContext(TINYBASE_CONTEXT_KEY) ?? [];
1376
+
1377
+ const _resolvedRelationships = $.derived(() =>
1378
+ isString($$props.relationships)
1379
+ ? objGet(_ctx[7], $$props.relationships)
1380
+ : ($$props.relationships ?? _ctx[6]),
1381
+ );
1382
+
1383
+ const _store = $.derived(() => $.get(_resolvedRelationships)?.getStore());
1384
+ const _tableId = $.derived(() =>
1385
+ $.get(_resolvedRelationships)?.getRemoteTableId($$props.relationshipId),
1386
+ );
1387
+ const remoteRowId = useRemoteRowId(
1388
+ () => $$props.relationshipId,
1389
+ () => $$props.localRowId,
1390
+ () => $$props.relationships,
1391
+ );
1392
+ var fragment = root();
1393
+ var node = $.first_child(fragment);
1394
+
1395
+ {
1396
+ var consequent = ($$anchor) => {
1397
+ var text = $.text();
1398
+
1399
+ $.template_effect(() =>
1400
+ $.set_text(text, `${$$props.localRowId ?? ''}:{`),
1401
+ );
1402
+ $.append($$anchor, text);
1403
+ };
1404
+
1405
+ $.if(node, ($$render) => {
1406
+ if ($$props.debugIds) $$render(consequent);
1407
+ });
1408
+ }
1409
+
1410
+ var node_1 = $.sibling(node);
1411
+
1412
+ {
1413
+ var consequent_3 = ($$anchor) => {
1414
+ var fragment_2 = $.comment();
1415
+ var node_2 = $.first_child(fragment_2);
1416
+
1417
+ {
1418
+ var consequent_1 = ($$anchor) => {
1419
+ var fragment_3 = $.comment();
1420
+ var node_3 = $.first_child(fragment_3);
1421
+
1422
+ $.snippet(
1423
+ node_3,
1424
+ () => $$props.row,
1425
+ () => remoteRowId.current,
1426
+ );
1427
+ $.append($$anchor, fragment_3);
1428
+ };
1429
+
1430
+ var consequent_2 = ($$anchor) => {
1431
+ RowView($$anchor, {
1432
+ get tableId() {
1433
+ return $.get(_tableId);
1434
+ },
1435
+
1436
+ get rowId() {
1437
+ return remoteRowId.current;
1438
+ },
1439
+
1440
+ get store() {
1441
+ return $.get(_store);
1442
+ },
1443
+
1444
+ get debugIds() {
1445
+ return $$props.debugIds;
1446
+ },
1447
+ });
1448
+ };
1449
+
1450
+ $.if(node_2, ($$render) => {
1451
+ if ($$props.row) $$render(consequent_1);
1452
+ else if ($.get(_tableId)) $$render(consequent_2, 1);
1453
+ });
1454
+ }
1455
+
1456
+ $.append($$anchor, fragment_2);
1457
+ };
1458
+
1459
+ $.if(node_1, ($$render) => {
1460
+ if (remoteRowId.current !== undefined) $$render(consequent_3);
1461
+ });
1462
+ }
1463
+
1464
+ var node_4 = $.sibling(node_1);
1465
+
1466
+ {
1467
+ var consequent_4 = ($$anchor) => {
1468
+ var text_1 = $.text();
1469
+
1470
+ text_1.nodeValue = '}';
1471
+ $.append($$anchor, text_1);
1472
+ };
1473
+
1474
+ $.if(node_4, ($$render) => {
1475
+ if ($$props.debugIds) $$render(consequent_4);
1476
+ });
1477
+ }
1478
+
1479
+ $.append($$anchor, fragment);
1480
+ $.pop();
1481
+ }
1482
+
1483
+ function ResultCellView($$anchor, $$props) {
1484
+ $.push($$props, true);
1485
+
1486
+ const cell = useResultCell(
1487
+ () => $$props.queryId,
1488
+ () => $$props.rowId,
1489
+ () => $$props.cellId,
1490
+ () => $$props.queries,
1491
+ );
1492
+ const display = $.derived(() => '' + (cell.current ?? ''));
1493
+
1494
+ const output = $.derived(() =>
1495
+ $$props.debugIds ? `${$$props.cellId}:{${$.get(display)}}` : $.get(display),
1496
+ );
1497
+
1498
+ $.next();
1499
+
1500
+ var text = $.text();
1501
+
1502
+ $.template_effect(() => $.set_text(text, $.get(output)));
1503
+ $.append($$anchor, text);
1504
+ $.pop();
1505
+ }
1506
+
1507
+ function ResultRowView($$anchor, $$props) {
1508
+ $.push($$props, true);
1509
+
1510
+ const cellIds = useResultCellIds(
1511
+ () => $$props.queryId,
1512
+ () => $$props.rowId,
1513
+ () => $$props.queries,
1514
+ );
1515
+
1516
+ {
1517
+ const children = ($$anchor, cellId = $.noop) => {
1518
+ ResultCellView($$anchor, {
1519
+ get queryId() {
1520
+ return $$props.queryId;
1521
+ },
1522
+
1523
+ get rowId() {
1524
+ return $$props.rowId;
1525
+ },
1526
+
1527
+ get cellId() {
1528
+ return cellId();
1529
+ },
1530
+
1531
+ get queries() {
1532
+ return $$props.queries;
1533
+ },
1534
+
1535
+ get debugIds() {
1536
+ return $$props.debugIds;
1537
+ },
1538
+ });
1539
+ };
1540
+
1541
+ ItemsView($$anchor, {
1542
+ get ids() {
1543
+ return cellIds.current;
1544
+ },
1545
+
1546
+ get separator() {
1547
+ return $$props.separator;
1548
+ },
1549
+
1550
+ get debugIds() {
1551
+ return $$props.debugIds;
1552
+ },
1553
+
1554
+ get id() {
1555
+ return $$props.rowId;
1556
+ },
1557
+
1558
+ get custom() {
1559
+ return $$props.cell;
1560
+ },
1561
+ children,
1562
+ });
1563
+ }
1564
+
1565
+ $.pop();
1566
+ }
1567
+
1568
+ function ResultSortedTableView($$anchor, $$props) {
1569
+ $.push($$props, true);
1570
+
1571
+ const rowIds = useResultSortedRowIds(
1572
+ () => $$props.queryId,
1573
+ () => $$props.cellId,
1574
+ () => $$props.descending ?? false,
1575
+ () => $$props.offset ?? 0,
1576
+ () => $$props.limit,
1577
+ () => $$props.queries,
1578
+ );
1579
+
1580
+ {
1581
+ const children = ($$anchor, rowId = $.noop) => {
1582
+ ResultRowView($$anchor, {
1583
+ get queryId() {
1584
+ return $$props.queryId;
1585
+ },
1586
+
1587
+ get rowId() {
1588
+ return rowId();
1589
+ },
1590
+
1591
+ get queries() {
1592
+ return $$props.queries;
1593
+ },
1594
+
1595
+ get debugIds() {
1596
+ return $$props.debugIds;
1597
+ },
1598
+ });
1599
+ };
1600
+
1601
+ ItemsView($$anchor, {
1602
+ get ids() {
1603
+ return rowIds.current;
1604
+ },
1605
+
1606
+ get separator() {
1607
+ return $$props.separator;
1608
+ },
1609
+
1610
+ get debugIds() {
1611
+ return $$props.debugIds;
1612
+ },
1613
+
1614
+ get id() {
1615
+ return $$props.queryId;
1616
+ },
1617
+
1618
+ get custom() {
1619
+ return $$props.row;
1620
+ },
1621
+ children,
1622
+ });
1623
+ }
1624
+
1625
+ $.pop();
1626
+ }
1627
+
1628
+ function ResultTableView($$anchor, $$props) {
1629
+ $.push($$props, true);
1630
+
1631
+ const rowIds = useResultRowIds(
1632
+ () => $$props.queryId,
1633
+ () => $$props.queries,
1634
+ );
1635
+
1636
+ {
1637
+ const children = ($$anchor, rowId = $.noop) => {
1638
+ ResultRowView($$anchor, {
1639
+ get queryId() {
1640
+ return $$props.queryId;
1641
+ },
1642
+
1643
+ get rowId() {
1644
+ return rowId();
1645
+ },
1646
+
1647
+ get queries() {
1648
+ return $$props.queries;
1649
+ },
1650
+
1651
+ get debugIds() {
1652
+ return $$props.debugIds;
1653
+ },
1654
+ });
1655
+ };
1656
+
1657
+ ItemsView($$anchor, {
1658
+ get ids() {
1659
+ return rowIds.current;
1660
+ },
1661
+
1662
+ get separator() {
1663
+ return $$props.separator;
1664
+ },
1665
+
1666
+ get debugIds() {
1667
+ return $$props.debugIds;
1668
+ },
1669
+
1670
+ get id() {
1671
+ return $$props.queryId;
1672
+ },
1673
+
1674
+ get custom() {
1675
+ return $$props.row;
1676
+ },
1677
+ children,
1678
+ });
1679
+ }
1680
+
1681
+ $.pop();
1682
+ }
1683
+
1684
+ function SortedTableView($$anchor, $$props) {
1685
+ $.push($$props, true);
1686
+
1687
+ const rowIds = useSortedRowIds(
1688
+ () => $$props.tableId,
1689
+ () => $$props.cellId,
1690
+ () => $$props.descending ?? false,
1691
+ () => $$props.offset ?? 0,
1692
+ () => $$props.limit,
1693
+ () => $$props.store,
1694
+ );
1695
+
1696
+ {
1697
+ const children = ($$anchor, rowId = $.noop) => {
1698
+ RowView($$anchor, {
1699
+ get tableId() {
1700
+ return $$props.tableId;
1701
+ },
1702
+
1703
+ get rowId() {
1704
+ return rowId();
1705
+ },
1706
+
1707
+ get store() {
1708
+ return $$props.store;
1709
+ },
1710
+
1711
+ get customCellIds() {
1712
+ return $$props.customCellIds;
1713
+ },
1714
+
1715
+ get debugIds() {
1716
+ return $$props.debugIds;
1717
+ },
1718
+ });
1719
+ };
1720
+
1721
+ ItemsView($$anchor, {
1722
+ get ids() {
1723
+ return rowIds.current;
1724
+ },
1725
+
1726
+ get separator() {
1727
+ return $$props.separator;
1728
+ },
1729
+
1730
+ get debugIds() {
1731
+ return $$props.debugIds;
1732
+ },
1733
+
1734
+ get id() {
1735
+ return $$props.tableId;
1736
+ },
1737
+
1738
+ get custom() {
1739
+ return $$props.row;
1740
+ },
1741
+ children,
1742
+ });
1743
+ }
1744
+
1745
+ $.pop();
1746
+ }
1747
+
1748
+ function TableView($$anchor, $$props) {
1749
+ $.push($$props, true);
1750
+
1751
+ const rowIds = useRowIds(
1752
+ () => $$props.tableId,
1753
+ () => $$props.store,
1754
+ );
1755
+
1756
+ {
1757
+ const children = ($$anchor, rowId = $.noop) => {
1758
+ RowView($$anchor, {
1759
+ get tableId() {
1760
+ return $$props.tableId;
1761
+ },
1762
+
1763
+ get rowId() {
1764
+ return rowId();
1765
+ },
1766
+
1767
+ get store() {
1768
+ return $$props.store;
1769
+ },
1770
+
1771
+ get customCellIds() {
1772
+ return $$props.customCellIds;
1773
+ },
1774
+
1775
+ get debugIds() {
1776
+ return $$props.debugIds;
1777
+ },
1778
+ });
1779
+ };
1780
+
1781
+ ItemsView($$anchor, {
1782
+ get ids() {
1783
+ return rowIds.current;
1784
+ },
1785
+
1786
+ get separator() {
1787
+ return $$props.separator;
1788
+ },
1789
+
1790
+ get debugIds() {
1791
+ return $$props.debugIds;
1792
+ },
1793
+
1794
+ get id() {
1795
+ return $$props.tableId;
1796
+ },
1797
+
1798
+ get custom() {
1799
+ return $$props.row;
1800
+ },
1801
+ children,
1802
+ });
1803
+ }
1804
+
1805
+ $.pop();
1806
+ }
1807
+
1808
+ function TablesView($$anchor, $$props) {
1809
+ $.push($$props, true);
1810
+
1811
+ const tableIds = useTableIds(() => $$props.store);
1812
+
1813
+ {
1814
+ const children = ($$anchor, tableId = $.noop) => {
1815
+ TableView($$anchor, {
1816
+ get tableId() {
1817
+ return tableId();
1818
+ },
1819
+
1820
+ get store() {
1821
+ return $$props.store;
1822
+ },
1823
+
1824
+ get debugIds() {
1825
+ return $$props.debugIds;
1826
+ },
1827
+ });
1828
+ };
1829
+
1830
+ ItemsView($$anchor, {
1831
+ get ids() {
1832
+ return tableIds.current;
1833
+ },
1834
+
1835
+ get separator() {
1836
+ return $$props.separator;
1837
+ },
1838
+
1839
+ get debugIds() {
1840
+ return $$props.debugIds;
1841
+ },
1842
+
1843
+ get custom() {
1844
+ return $$props.table;
1845
+ },
1846
+ children,
1847
+ });
1848
+ }
1849
+
1850
+ $.pop();
1851
+ }
1852
+
1853
+ function ValueView($$anchor, $$props) {
1854
+ $.push($$props, true);
1855
+
1856
+ const value = useValue(
1857
+ () => $$props.valueId,
1858
+ () => $$props.store,
1859
+ );
1860
+ const display = $.derived(() => '' + (value.current ?? ''));
1861
+
1862
+ const output = $.derived(() =>
1863
+ $$props.debugIds
1864
+ ? `${$$props.valueId}:{${$.get(display)}}`
1865
+ : $.get(display),
1866
+ );
1867
+
1868
+ $.next();
1869
+
1870
+ var text = $.text();
1871
+
1872
+ $.template_effect(() => $.set_text(text, $.get(output)));
1873
+ $.append($$anchor, text);
1874
+ $.pop();
1875
+ }
1876
+
1877
+ function ValuesView($$anchor, $$props) {
1878
+ $.push($$props, true);
1879
+
1880
+ const valueIds = useValueIds(() => $$props.store);
1881
+
1882
+ {
1883
+ const children = ($$anchor, valueId = $.noop) => {
1884
+ ValueView($$anchor, {
1885
+ get valueId() {
1886
+ return valueId();
1887
+ },
1888
+
1889
+ get store() {
1890
+ return $$props.store;
1891
+ },
1892
+
1893
+ get debugIds() {
1894
+ return $$props.debugIds;
1895
+ },
1896
+ });
1897
+ };
1898
+
1899
+ ItemsView($$anchor, {
1900
+ get ids() {
1901
+ return valueIds.current;
1902
+ },
1903
+
1904
+ get separator() {
1905
+ return $$props.separator;
1906
+ },
1907
+
1908
+ get debugIds() {
1909
+ return $$props.debugIds;
1910
+ },
1911
+
1912
+ get custom() {
1913
+ return $$props.value;
1914
+ },
1915
+ children,
1916
+ });
1917
+ }
1918
+
1919
+ $.pop();
1920
+ }
1921
+
1922
+ export {
1923
+ BackwardCheckpointsView,
1924
+ CellView,
1925
+ CheckpointView,
1926
+ CurrentCheckpointView,
1927
+ ForwardCheckpointsView,
1928
+ IndexView,
1929
+ LinkedRowsView,
1930
+ LocalRowsView,
1931
+ MetricView,
1932
+ provideCheckpoints,
1933
+ provideIndexes,
1934
+ provideMetrics,
1935
+ providePersister,
1936
+ provideQueries,
1937
+ Provider,
1938
+ provideRelationships,
1939
+ provideStore,
1940
+ provideSynchronizer,
1941
+ RemoteRowView,
1942
+ ResultCellView,
1943
+ ResultRowView,
1944
+ ResultSortedTableView,
1945
+ ResultTableView,
1946
+ RowView,
1947
+ SliceView,
1948
+ SortedTableView,
1949
+ TablesView,
1950
+ TableView,
1951
+ useCell,
1952
+ useCellIds,
1953
+ useCellState,
1954
+ useCheckpoint,
1955
+ useCheckpointIds,
1956
+ useCheckpoints,
1957
+ useCheckpointsIds,
1958
+ useGoBackwardCallback,
1959
+ useGoForwardCallback,
1960
+ useHasCell,
1961
+ useHasRow,
1962
+ useHasTable,
1963
+ useHasTableCell,
1964
+ useHasTables,
1965
+ useHasValue,
1966
+ useHasValues,
1967
+ useIndexes,
1968
+ useIndexesIds,
1969
+ useIndexIds,
1970
+ useLinkedRowIds,
1971
+ useLocalRowIds,
1972
+ useMetric,
1973
+ useMetricIds,
1974
+ useMetrics,
1975
+ useMetricsIds,
1976
+ usePersister,
1977
+ usePersisterIds,
1978
+ usePersisterStatus,
1979
+ useQueries,
1980
+ useQueriesIds,
1981
+ useQueryIds,
1982
+ useRelationshipIds,
1983
+ useRelationships,
1984
+ useRelationshipsIds,
1985
+ useRemoteRowId,
1986
+ useResultCell,
1987
+ useResultCellIds,
1988
+ useResultRow,
1989
+ useResultRowCount,
1990
+ useResultRowIds,
1991
+ useResultSortedRowIds,
1992
+ useResultTable,
1993
+ useResultTableCellIds,
1994
+ useRow,
1995
+ useRowCount,
1996
+ useRowIds,
1997
+ useSliceIds,
1998
+ useSliceRowIds,
1999
+ useSortedRowIds,
2000
+ useStore,
2001
+ useStoreIds,
2002
+ useSynchronizer,
2003
+ useSynchronizerIds,
2004
+ useSynchronizerStatus,
2005
+ useTable,
2006
+ useTableCellIds,
2007
+ useTableIds,
2008
+ useTables,
2009
+ useValue,
2010
+ useValueIds,
2011
+ useValues,
2012
+ useValueState,
2013
+ ValuesView,
2014
+ ValueView,
2015
+ };