tinybase 5.2.2 → 5.3.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.
Files changed (43) hide show
  1. package/@types/ui-react/index.d.cts +159 -0
  2. package/@types/ui-react/index.d.ts +159 -0
  3. package/@types/ui-react/with-schemas/index.d.cts +92 -0
  4. package/@types/ui-react/with-schemas/index.d.ts +92 -0
  5. package/cjs/es6/min/ui-react/index.cjs +1 -1
  6. package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
  7. package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
  8. package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
  9. package/cjs/es6/ui-react/index.cjs +89 -29
  10. package/cjs/es6/ui-react/with-schemas/index.cjs +89 -29
  11. package/cjs/min/ui-react/index.cjs +1 -1
  12. package/cjs/min/ui-react/index.cjs.gz +0 -0
  13. package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
  14. package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
  15. package/cjs/ui-react/index.cjs +63 -30
  16. package/cjs/ui-react/with-schemas/index.cjs +63 -30
  17. package/es6/min/ui-react/index.js +1 -1
  18. package/es6/min/ui-react/index.js.gz +0 -0
  19. package/es6/min/ui-react/with-schemas/index.js +1 -1
  20. package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  21. package/es6/ui-react/index.js +89 -29
  22. package/es6/ui-react/with-schemas/index.js +89 -29
  23. package/min/ui-react/index.js +1 -1
  24. package/min/ui-react/index.js.gz +0 -0
  25. package/min/ui-react/with-schemas/index.js +1 -1
  26. package/min/ui-react/with-schemas/index.js.gz +0 -0
  27. package/package.json +1 -1
  28. package/readme.md +14 -14
  29. package/releases.md +24 -24
  30. package/ui-react/index.js +63 -30
  31. package/ui-react/with-schemas/index.js +63 -30
  32. package/umd/es6/min/ui-react/index.js +1 -1
  33. package/umd/es6/min/ui-react/index.js.gz +0 -0
  34. package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
  35. package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  36. package/umd/es6/ui-react/index.js +90 -33
  37. package/umd/es6/ui-react/with-schemas/index.js +90 -33
  38. package/umd/min/ui-react/index.js +1 -1
  39. package/umd/min/ui-react/index.js.gz +0 -0
  40. package/umd/min/ui-react/with-schemas/index.js +1 -1
  41. package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
  42. package/umd/ui-react/index.js +65 -30
  43. package/umd/ui-react/with-schemas/index.js +65 -30
package/ui-react/index.js CHANGED
@@ -42,6 +42,7 @@ const arrayIsEqual = (array1, array2) =>
42
42
  const arrayMap = (array, cb) => array.map(cb);
43
43
  const arrayIsEmpty = (array) => size(array) == 0;
44
44
  const arrayFilter = (array, cb) => array.filter(cb);
45
+ const arrayWith = (array, index, value) => array.with(index, value);
45
46
 
46
47
  const object = Object;
47
48
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
@@ -101,32 +102,43 @@ const useThingOrThingById = (thingOrThingId, offset) => {
101
102
  ? thing
102
103
  : thingOrThingId;
103
104
  };
105
+ const useProvideThing = (thingId, thing, offset) => {
106
+ const {12: addExtraThingById, 13: delExtraThingById} = useContext$1(Context);
107
+ useEffect$1(() => {
108
+ addExtraThingById?.(offset, thingId, thing);
109
+ return () => delExtraThingById?.(offset, thingId);
110
+ }, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
111
+ };
104
112
  const useThingIds = (offset) => objIds(useContext$1(Context)[offset] ?? {});
105
113
  const useStore = (id) => useThing(id, 0);
106
114
  const useStoreOrStoreById = (storeOrStoreId) =>
107
115
  useThingOrThingById(storeOrStoreId, 0);
108
- const useProvideStore = (storeId, store) => {
109
- const {12: addExtraStore, 13: delExtraStore} = useContext$1(Context);
110
- useEffect$1(() => {
111
- addExtraStore?.(storeId, store);
112
- return () => delExtraStore?.(storeId);
113
- }, [addExtraStore, storeId, store, delExtraStore]);
114
- };
116
+ const useProvideStore = (storeId, store) => useProvideThing(storeId, store, 0);
115
117
  const useMetrics = (id) => useThing(id, 2);
116
118
  const useMetricsOrMetricsById = (metricsOrMetricsId) =>
117
119
  useThingOrThingById(metricsOrMetricsId, 2);
120
+ const useProvideMetrics = (metricsId, metrics) =>
121
+ useProvideThing(metricsId, metrics, 1);
118
122
  const useIndexes = (id) => useThing(id, 4);
119
123
  const useIndexesOrIndexesById = (indexesOrIndexesId) =>
120
124
  useThingOrThingById(indexesOrIndexesId, 4);
125
+ const useProvideIndexes = (indexesId, indexes) =>
126
+ useProvideThing(indexesId, indexes, 2);
121
127
  const useRelationships = (id) => useThing(id, 6);
122
128
  const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
123
129
  useThingOrThingById(relationshipsOrRelationshipsId, 6);
130
+ const useProvideRelationships = (relationshipsId, relationships) =>
131
+ useProvideThing(relationshipsId, relationships, 3);
124
132
  const useQueries = (id) => useThing(id, 8);
125
133
  const useQueriesOrQueriesById = (queriesOrQueriesId) =>
126
134
  useThingOrThingById(queriesOrQueriesId, 8);
135
+ const useProvideQueries = (queriesId, queries) =>
136
+ useProvideThing(queriesId, queries, 4);
127
137
  const useCheckpoints = (id) => useThing(id, 10);
128
138
  const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
129
139
  useThingOrThingById(checkpointsOrCheckpointsId, 10);
140
+ const useProvideCheckpoints = (checkpointsId, checkpoints) =>
141
+ useProvideThing(checkpointsId, checkpoints, 5);
130
142
 
131
143
  const lower = (str) => str.toLowerCase();
132
144
  lower(LISTENER);
@@ -1579,21 +1591,37 @@ const Provider = ({
1579
1591
  children,
1580
1592
  }) => {
1581
1593
  const parentValue = useContext(Context);
1582
- const [extraStoresById, setExtraStoresById] = useState({});
1583
- const addExtraStore = useCallback(
1584
- (id, store2) =>
1585
- setExtraStoresById((extraStoresById2) =>
1586
- objGet(extraStoresById2, id) == store2
1587
- ? extraStoresById2
1588
- : {...extraStoresById2, [id]: store2},
1594
+ const [extraThingsById, setExtraThingsById] = useState([
1595
+ {},
1596
+ {},
1597
+ {},
1598
+ {},
1599
+ {},
1600
+ {},
1601
+ ]);
1602
+ const addExtraThingById = useCallback(
1603
+ (thingOffset, id, thing) =>
1604
+ setExtraThingsById((extraThingsById2) =>
1605
+ objGet(extraThingsById2[thingOffset], id) == thing
1606
+ ? extraThingsById2
1607
+ : arrayWith(extraThingsById2, thingOffset, {
1608
+ ...extraThingsById2[thingOffset],
1609
+ [id]: thing,
1610
+ }),
1589
1611
  ),
1590
1612
  [],
1591
1613
  );
1592
- const delExtraStore = useCallback(
1593
- (id) =>
1594
- setExtraStoresById((extraStoresById2) => ({
1595
- ...objDel(extraStoresById2, id),
1596
- })),
1614
+ const delExtraThingById = useCallback(
1615
+ (thingOffset, id) =>
1616
+ setExtraThingsById((extraThingsById2) =>
1617
+ !objHas(extraThingsById2[thingOffset], id)
1618
+ ? extraThingsById2
1619
+ : arrayWith(
1620
+ extraThingsById2,
1621
+ thingOffset,
1622
+ objDel(extraThingsById2[thingOffset], id),
1623
+ ),
1624
+ ),
1597
1625
  [],
1598
1626
  );
1599
1627
  return /* @__PURE__ */ createElement(
@@ -1602,24 +1630,24 @@ const Provider = ({
1602
1630
  value: useMemo(
1603
1631
  () => [
1604
1632
  store ?? parentValue[0],
1605
- {...parentValue[1], ...storesById, ...extraStoresById},
1633
+ {...parentValue[1], ...storesById, ...extraThingsById[0]},
1606
1634
  metrics ?? parentValue[2],
1607
- {...parentValue[3], ...metricsById},
1635
+ {...parentValue[3], ...metricsById, ...extraThingsById[1]},
1608
1636
  indexes ?? parentValue[4],
1609
- {...parentValue[5], ...indexesById},
1637
+ {...parentValue[5], ...indexesById, ...extraThingsById[2]},
1610
1638
  relationships ?? parentValue[6],
1611
- {...parentValue[7], ...relationshipsById},
1639
+ {...parentValue[7], ...relationshipsById, ...extraThingsById[3]},
1612
1640
  queries ?? parentValue[8],
1613
- {...parentValue[9], ...queriesById},
1641
+ {...parentValue[9], ...queriesById, ...extraThingsById[4]},
1614
1642
  checkpoints ?? parentValue[10],
1615
- {...parentValue[11], ...checkpointsById},
1616
- addExtraStore,
1617
- delExtraStore,
1643
+ {...parentValue[11], ...checkpointsById, ...extraThingsById[5]},
1644
+ addExtraThingById,
1645
+ delExtraThingById,
1618
1646
  ],
1619
1647
  [
1620
1648
  store,
1621
1649
  storesById,
1622
- extraStoresById,
1650
+ extraThingsById,
1623
1651
  metrics,
1624
1652
  metricsById,
1625
1653
  indexes,
@@ -1631,8 +1659,8 @@ const Provider = ({
1631
1659
  checkpoints,
1632
1660
  checkpointsById,
1633
1661
  parentValue,
1634
- addExtraStore,
1635
- delExtraStore,
1662
+ addExtraThingById,
1663
+ delExtraThingById,
1636
1664
  ],
1637
1665
  ),
1638
1666
  },
@@ -1988,6 +2016,11 @@ export {
1988
2016
  useMetrics,
1989
2017
  useMetricsIds,
1990
2018
  useMetricsOrMetricsById,
2019
+ useProvideCheckpoints,
2020
+ useProvideIndexes,
2021
+ useProvideMetrics,
2022
+ useProvideQueries,
2023
+ useProvideRelationships,
1991
2024
  useProvideStore,
1992
2025
  useQueries,
1993
2026
  useQueriesIds,
@@ -42,6 +42,7 @@ const arrayIsEqual = (array1, array2) =>
42
42
  const arrayMap = (array, cb) => array.map(cb);
43
43
  const arrayIsEmpty = (array) => size(array) == 0;
44
44
  const arrayFilter = (array, cb) => array.filter(cb);
45
+ const arrayWith = (array, index, value) => array.with(index, value);
45
46
 
46
47
  const object = Object;
47
48
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
@@ -101,32 +102,43 @@ const useThingOrThingById = (thingOrThingId, offset) => {
101
102
  ? thing
102
103
  : thingOrThingId;
103
104
  };
105
+ const useProvideThing = (thingId, thing, offset) => {
106
+ const {12: addExtraThingById, 13: delExtraThingById} = useContext$1(Context);
107
+ useEffect$1(() => {
108
+ addExtraThingById?.(offset, thingId, thing);
109
+ return () => delExtraThingById?.(offset, thingId);
110
+ }, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
111
+ };
104
112
  const useThingIds = (offset) => objIds(useContext$1(Context)[offset] ?? {});
105
113
  const useStore = (id) => useThing(id, 0);
106
114
  const useStoreOrStoreById = (storeOrStoreId) =>
107
115
  useThingOrThingById(storeOrStoreId, 0);
108
- const useProvideStore = (storeId, store) => {
109
- const {12: addExtraStore, 13: delExtraStore} = useContext$1(Context);
110
- useEffect$1(() => {
111
- addExtraStore?.(storeId, store);
112
- return () => delExtraStore?.(storeId);
113
- }, [addExtraStore, storeId, store, delExtraStore]);
114
- };
116
+ const useProvideStore = (storeId, store) => useProvideThing(storeId, store, 0);
115
117
  const useMetrics = (id) => useThing(id, 2);
116
118
  const useMetricsOrMetricsById = (metricsOrMetricsId) =>
117
119
  useThingOrThingById(metricsOrMetricsId, 2);
120
+ const useProvideMetrics = (metricsId, metrics) =>
121
+ useProvideThing(metricsId, metrics, 1);
118
122
  const useIndexes = (id) => useThing(id, 4);
119
123
  const useIndexesOrIndexesById = (indexesOrIndexesId) =>
120
124
  useThingOrThingById(indexesOrIndexesId, 4);
125
+ const useProvideIndexes = (indexesId, indexes) =>
126
+ useProvideThing(indexesId, indexes, 2);
121
127
  const useRelationships = (id) => useThing(id, 6);
122
128
  const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
123
129
  useThingOrThingById(relationshipsOrRelationshipsId, 6);
130
+ const useProvideRelationships = (relationshipsId, relationships) =>
131
+ useProvideThing(relationshipsId, relationships, 3);
124
132
  const useQueries = (id) => useThing(id, 8);
125
133
  const useQueriesOrQueriesById = (queriesOrQueriesId) =>
126
134
  useThingOrThingById(queriesOrQueriesId, 8);
135
+ const useProvideQueries = (queriesId, queries) =>
136
+ useProvideThing(queriesId, queries, 4);
127
137
  const useCheckpoints = (id) => useThing(id, 10);
128
138
  const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
129
139
  useThingOrThingById(checkpointsOrCheckpointsId, 10);
140
+ const useProvideCheckpoints = (checkpointsId, checkpoints) =>
141
+ useProvideThing(checkpointsId, checkpoints, 5);
130
142
 
131
143
  const lower = (str) => str.toLowerCase();
132
144
  lower(LISTENER);
@@ -1579,21 +1591,37 @@ const Provider = ({
1579
1591
  children,
1580
1592
  }) => {
1581
1593
  const parentValue = useContext(Context);
1582
- const [extraStoresById, setExtraStoresById] = useState({});
1583
- const addExtraStore = useCallback(
1584
- (id, store2) =>
1585
- setExtraStoresById((extraStoresById2) =>
1586
- objGet(extraStoresById2, id) == store2
1587
- ? extraStoresById2
1588
- : {...extraStoresById2, [id]: store2},
1594
+ const [extraThingsById, setExtraThingsById] = useState([
1595
+ {},
1596
+ {},
1597
+ {},
1598
+ {},
1599
+ {},
1600
+ {},
1601
+ ]);
1602
+ const addExtraThingById = useCallback(
1603
+ (thingOffset, id, thing) =>
1604
+ setExtraThingsById((extraThingsById2) =>
1605
+ objGet(extraThingsById2[thingOffset], id) == thing
1606
+ ? extraThingsById2
1607
+ : arrayWith(extraThingsById2, thingOffset, {
1608
+ ...extraThingsById2[thingOffset],
1609
+ [id]: thing,
1610
+ }),
1589
1611
  ),
1590
1612
  [],
1591
1613
  );
1592
- const delExtraStore = useCallback(
1593
- (id) =>
1594
- setExtraStoresById((extraStoresById2) => ({
1595
- ...objDel(extraStoresById2, id),
1596
- })),
1614
+ const delExtraThingById = useCallback(
1615
+ (thingOffset, id) =>
1616
+ setExtraThingsById((extraThingsById2) =>
1617
+ !objHas(extraThingsById2[thingOffset], id)
1618
+ ? extraThingsById2
1619
+ : arrayWith(
1620
+ extraThingsById2,
1621
+ thingOffset,
1622
+ objDel(extraThingsById2[thingOffset], id),
1623
+ ),
1624
+ ),
1597
1625
  [],
1598
1626
  );
1599
1627
  return /* @__PURE__ */ createElement(
@@ -1602,24 +1630,24 @@ const Provider = ({
1602
1630
  value: useMemo(
1603
1631
  () => [
1604
1632
  store ?? parentValue[0],
1605
- {...parentValue[1], ...storesById, ...extraStoresById},
1633
+ {...parentValue[1], ...storesById, ...extraThingsById[0]},
1606
1634
  metrics ?? parentValue[2],
1607
- {...parentValue[3], ...metricsById},
1635
+ {...parentValue[3], ...metricsById, ...extraThingsById[1]},
1608
1636
  indexes ?? parentValue[4],
1609
- {...parentValue[5], ...indexesById},
1637
+ {...parentValue[5], ...indexesById, ...extraThingsById[2]},
1610
1638
  relationships ?? parentValue[6],
1611
- {...parentValue[7], ...relationshipsById},
1639
+ {...parentValue[7], ...relationshipsById, ...extraThingsById[3]},
1612
1640
  queries ?? parentValue[8],
1613
- {...parentValue[9], ...queriesById},
1641
+ {...parentValue[9], ...queriesById, ...extraThingsById[4]},
1614
1642
  checkpoints ?? parentValue[10],
1615
- {...parentValue[11], ...checkpointsById},
1616
- addExtraStore,
1617
- delExtraStore,
1643
+ {...parentValue[11], ...checkpointsById, ...extraThingsById[5]},
1644
+ addExtraThingById,
1645
+ delExtraThingById,
1618
1646
  ],
1619
1647
  [
1620
1648
  store,
1621
1649
  storesById,
1622
- extraStoresById,
1650
+ extraThingsById,
1623
1651
  metrics,
1624
1652
  metricsById,
1625
1653
  indexes,
@@ -1631,8 +1659,8 @@ const Provider = ({
1631
1659
  checkpoints,
1632
1660
  checkpointsById,
1633
1661
  parentValue,
1634
- addExtraStore,
1635
- delExtraStore,
1662
+ addExtraThingById,
1663
+ delExtraThingById,
1636
1664
  ],
1637
1665
  ),
1638
1666
  },
@@ -1988,6 +2016,11 @@ export {
1988
2016
  useMetrics,
1989
2017
  useMetricsIds,
1990
2018
  useMetricsOrMetricsById,
2019
+ useProvideCheckpoints,
2020
+ useProvideIndexes,
2021
+ useProvideMetrics,
2022
+ useProvideQueries,
2023
+ useProvideRelationships,
1991
2024
  useProvideStore,
1992
2025
  useQueries,
1993
2026
  useQueriesIds,
@@ -1 +1 @@
1
- var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",d="Has",i="Ids",a="Table",c=a+"s",I=a+i,p="Row",C=p+"Count",b=p+i,w="Sorted"+p+i,R="Cell",k=R+i,v="Value",y=v+"s",g=v+i,h=globalThis,m=e=>null==e,L=(e,s,t)=>m(e)?null==t?void 0:t():s(e),f=e=>t(e)==o,S=e=>t(e)==r,T=e=>e.length,V=()=>{},P=(e,s)=>e.every(s),x=(e,s)=>T(e)===T(s)&&P(e,((e,t)=>s[t]===e)),O=(e,s)=>e.map(s),q=Object,B=e=>q.getPrototypeOf(e),H=q.entries,M=e=>!m(e)&&L(B(e),(e=>e==q.prototype||m(B(e))),(()=>!0)),D=q.keys,j=(e,s)=>L(e,(e=>e[s])),F=(e,s)=>{const t=H(e);return T(t)===T(D(s))&&P(t,(([e,t])=>M(t)?!!M(s[e])&&F(s[e],t):s[e]===t))},{createContext:E,useContext:Q,useEffect:A}=s,G=(z=()=>E([]),((e,s)=>s in e)(U=h,W="tinybase_uirc")||(U[W]=z()),U[W]);var U,W,z;const _=(e,s)=>{var t;const l=Q(G);return m(e)?l[s]:f(e)?j(null!=(t=l[s+1])?t:{},e):e},J=(e,s)=>{const t=_(e,s);return m(e)||f(e)?t:e},K=e=>{var s;return D(null!=(s=Q(G)[e])?s:{})},N=e=>J(e,0),X=e=>J(e,2),Y=e=>J(e,4),Z=e=>J(e,6),$=e=>J(e,8),ee=e=>J(e,10),se=e=>e.toLowerCase();se(u);const te="Transaction";se(te);var le=(e,s,t)=>new Promise(((l,o)=>{var r=e=>{try{n(t.next(e))}catch(e){o(e)}},u=e=>{try{n(t.throw(e))}catch(e){o(e)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,u);n((t=t.apply(e,s)).next())}));const{useCallback:oe,useEffect:re,useMemo:ue,useLayoutEffect:ne,useRef:de,useState:ie,useSyncExternalStore:ae}=s,ce=[],Ie=[{},[],[ce,void 0,ce],void 0,!1,0],pe=[F,x,([e,s,t],[l,o,r])=>s===o&&x(e,l)&&x(t,r)],Ce=(e,s)=>e===s,be=(e,s,t=ce)=>{const[,l]=ie(),[o,r]=ie();return re((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},we=(e,s,...t)=>{var l;const o=null==(l=null==e?void 0:e["add"+s+u])?void 0:l.call(e,...t);return()=>null==e?void 0:e.delListener(o)},Re=(e,s,t,o=ce)=>{const r=de(Ie[t]),u=oe((()=>{var l,u,n;const d=null!=(u=null==(l=null==s?void 0:s[(4==t?"has":"get")+e])?void 0:l.call(s,...o))?u:Ie[t];return(null!=(n=pe[t])?n:Ce)(d,r.current)?r.current:r.current=d}),[s,t,e,...o]),n=oe((r=>we(s,(4==t?d:l)+e,...o,r)),[s,t,e,...o]);return ae(n,u)},ke=(e,s,t,l=ce,o=ce,...r)=>ne((()=>we(s,e,...o,t,...r)),[s,e,...o,...l,...r]),ve=(e,s,t,l=ce,o=V,r=ce,...u)=>{const n=N(e);return oe((e=>L(n,(l=>L(t(e,l),(t=>o(l["set"+s](...ye(u,l,e),t),t)))))),[n,s,...l,...r,...ge(u)])},ye=(e,s,t)=>O(e,(e=>S(e)?e(t,s):e)),ge=e=>{return s=e=>!S(e),e.filter(s);var s},he=(e,s,t=V,l=ce,...o)=>{const r=N(e);return oe((e=>t(null==r?void 0:r["del"+s](...ye(o,r,e)))),[r,s,...l,...ge(o)])},me=(e,s,t)=>{const l=ee(e);return oe((()=>null==l?void 0:l[s](t)),[l,s,t])},Le=e=>Re(I,N(e),1),fe=(e,s)=>Re(b,N(s),1,[e]),Se=(e,s,t,l=0,o,r)=>Re(w,N(r),1,[e,s,t,l,o]),Te=(e,s,t)=>Re(k,N(t),1,[e,s]),Ve=(e,s,t,l)=>Re(R,N(l),3,[e,s,t]),Pe=e=>Re(g,N(e),1),xe=(e,s)=>Re(v,N(s),3,[e]),Oe=(e,s)=>Re("Metric",X(s),3,[e]),qe=(e,s)=>Re("SliceIds",Y(s),1,[e]),Be=(e,s,t)=>Re("Slice"+b,Y(t),1,[e,s]),He=(e,s,t)=>Re("RemoteRowId",Z(t),3,[e,s]),Me=(e,s,t)=>Re("Local"+b,Z(t),1,[e,s]),De=(e,s,t)=>Re("Linked"+b,Z(t),1,[e,s]),je=(e,s)=>Re(n+b,$(s),1,[e]),Fe=(e,s,t,l=0,o,r)=>Re(n+w,$(r),1,[e,s,t,l,o]),Ee=(e,s,t)=>Re(n+k,$(t),1,[e,s]),Qe=(e,s,t,l)=>Re(n+R,$(l),3,[e,s,t]),Ae=e=>Re("CheckpointIds",ee(e),2),Ge=(e,s)=>Re("Checkpoint",ee(s),3,[e]),Ue=e=>me(e,"goBackward"),We=e=>me(e,"goForward"),{PureComponent:ze,Fragment:_e,createElement:Je,useCallback:Ke,useLayoutEffect:Ne,useRef:Xe,useState:Ye}=s,Ze=(e,...s)=>m(e)?{}:e(...s),$e=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var es=Object.defineProperty,ss=Object.defineProperties,ts=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertySymbols,os=Object.prototype.hasOwnProperty,rs=Object.prototype.propertyIsEnumerable,us=(e,s,t)=>s in e?es(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ns=(e,s)=>{for(var t in s||(s={}))os.call(s,t)&&us(e,t,s[t]);if(ls)for(var t of ls(s))rs.call(s,t)&&us(e,t,s[t]);return e},ds=(e,s)=>ss(e,ts(s)),is=(e,s)=>{var t={};for(var l in e)os.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&ls)for(var l of ls(e))s.indexOf(l)<0&&rs.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:as,useContext:cs,useMemo:Is,useState:ps}=s,Cs=({tableId:e,store:s,rowComponent:t=ys,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>ks(O(n,(r=>Je(t,ds(ns({},Ze(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),bs=({queryId:e,queries:s,resultRowComponent:t=fs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>ks(O(u,(o=>Je(t,ds(ns({},Ze(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),ws=({relationshipId:e,relationships:s,rowComponent:t=ys,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=$e(Z(s),e),c=u(e,n,d);return ks(O(c,(e=>Je(t,ds(ns({},Ze(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},Rs=e=>({checkpoints:s,checkpointComponent:t=Ss,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=ee(s);return ks(O(e(Ae(u)),(e=>Je(t,ds(ns({},Ze(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},ks=(e,s,t,l)=>{const o=m(s)||!Array.isArray(e)?e:O(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},vs=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return ks(l+(null!=(u=Ve(e,s,t,o))?u:l),void 0,r,t)},ys=({tableId:e,rowId:s,store:t,cellComponent:l=vs,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>ks(O(((e,s,t,l)=>{const o=Te(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Je(l,ds(ns({},Ze(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),gs=e=>Cs(e,fe(e.tableId,e.store)),hs=({valueId:e,store:s,debugIds:t})=>{var o;return ks(l+(null!=(o=xe(e,s))?o:l),void 0,t,e)},ms=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ys,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(Y(t),e),a=Be(e,s,n);return ks(O(a,(e=>Je(l,ds(ns({},Ze(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Ls=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return ks(l+(null!=(u=Qe(e,s,t,o))?u:l),void 0,r,t)},fs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=Ls,getResultCellComponentProps:o,separator:r,debugIds:u})=>ks(O(Ee(e,s,t),(r=>Je(l,ds(ns({},Ze(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ss=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return ks(null!=(o=Ge(s,e))?o:l,void 0,t,s)},Ts=Rs((e=>e[0])),Vs=Rs((e=>m(e[1])?[]:[e[1]])),Ps=Rs((e=>e[2]));e.BackwardCheckpointsView=Ts,e.CellView=vs,e.CheckpointView=Ss,e.CurrentCheckpointView=Vs,e.ForwardCheckpointsView=Ps,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ms,getSliceComponentProps:l,separator:o,debugIds:r})=>ks(O(qe(e,s),(o=>Je(t,ds(ns({},Ze(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>ws(e,De,e.firstRowId),e.LocalRowsView=e=>ws(e,Me,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return ks(null!=(o=Oe(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=cs(G),[C,b]=ps({}),w=as(((e,s)=>b((t=>j(t,e)==s?t:ds(ns({},t),{[e]:s})))),[]),R=as((e=>b((s=>ns({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Je(G.Provider,{value:Is((()=>[null!=e?e:p[0],ns(ns(ns({},p[1]),s),C),null!=t?t:p[2],ns(ns({},p[3]),l),null!=o?o:p[4],ns(ns({},p[5]),r),null!=u?u:p[6],ns(ns({},p[7]),n),null!=d?d:p[8],ns(ns({},p[9]),i),null!=a?a:p[10],ns(ns({},p[11]),c),w,R]),[e,s,C,t,l,o,r,u,n,d,i,a,c,p,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ys,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=$e(Z(t),e),i=He(e,s,u);return ks(m(d)||m(i)?null:Je(l,ds(ns({},Ze(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ls,e.ResultRowView=fs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=is(s,["cellId","descending","offset","limit"]);return bs(u,Fe(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>bs(e,je(e.queryId,e.queries)),e.RowView=ys,e.SliceView=ms,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=is(s,["cellId","descending","offset","limit"]);return Cs(u,Se(u.tableId,t,l,o,r,u.store))},e.TableView=gs,e.TablesView=({store:e,tableComponent:s=gs,getTableComponentProps:t,separator:l,debugIds:o})=>ks(O(Le(e),(l=>Je(s,ds(ns({},Ze(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=hs,e.ValuesView=({store:e,valueComponent:s=hs,getValueComponentProps:t,separator:l,debugIds:o})=>ks(O(Pe(e),(l=>Je(s,ds(ns({},Ze(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=ce,l,o=V,r=ce,u=!0)=>{const n=N(l);return oe((t=>L(n,(l=>L(s(t,l),(s=>o(l.addRow(S(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=Ve,e.useCellIds=Te,e.useCellIdsListener=(e,s,t,l,o,r)=>ke(k,N(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>ke(R,N(u),l,o,[e,s,t],r),e.useCheckpoint=Ge,e.useCheckpointIds=Ae,e.useCheckpointIdsListener=(e,s,t)=>ke("CheckpointIds",ee(t),e,s),e.useCheckpointListener=(e,s,t,l)=>ke("Checkpoint",ee(l),s,t,[e]),e.useCheckpoints=e=>_(e,10),e.useCheckpointsIds=()=>K(11),e.useCheckpointsOrCheckpointsById=ee,e.useCreateCheckpoints=(e,s,t)=>be(e,s,t),e.useCreateIndexes=(e,s,t)=>be(e,s,t),e.useCreateMergeableStore=(e,s=ce)=>ue(e,s),e.useCreateMetrics=(e,s,t)=>be(e,s,t),e.useCreatePersister=(e,s,t=ce,l,o=ce,r,u=ce)=>{const[,n]=ie(),[d,i]=ie();return re((()=>{le(void 0,null,(function*(){const t=e?yield s(e):void 0;i(t),t&&l&&le(void 0,null,(function*(){yield l(t),n([])}))}))}),[e,...t,...o]),re((()=>()=>{d&&(d.destroy(),null==r||r(d))}),[d,...u]),d},e.useCreateQueries=(e,s,t)=>be(e,s,t),e.useCreateRelationships=(e,s,t)=>be(e,s,t),e.useCreateStore=(e,s=ce)=>ue(e,s),e.useCreateSynchronizer=(e,s,t=ce,l,o=ce)=>{const[r,u]=ie();return re((()=>{le(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),re((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>he(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>he(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>he(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>he(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>he(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>he(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>ke("DidFinish"+te,N(t),e,s),e.useGoBackwardCallback=Ue,e.useGoForwardCallback=We,e.useGoToCallback=(e,s=ce,t,l=V,o=ce)=>{const r=ee(t);return oe((s=>L(r,(t=>L(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>Re(R,N(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>ke(d+R,N(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>Re(p,N(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>ke(d+p,N(r),t,l,[e,s],o),e.useHasTable=(e,s)=>Re(a,N(s),4,[e]),e.useHasTableCell=(e,s,t)=>Re(a+R,N(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>ke(d+a+R,N(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>ke(d+a,N(o),s,t,[e],l),e.useHasTables=e=>Re(c,N(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>ke(d+c,N(l),e,s,[],t),e.useHasValue=(e,s)=>Re(v,N(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>ke(d+v,N(o),s,t,[e],l),e.useHasValues=e=>Re(y,N(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>ke(d+y,N(l),e,s,[],t),e.useIndexIds=e=>Re("IndexIds",Y(e),1),e.useIndexes=e=>_(e,4),e.useIndexesIds=()=>K(5),e.useIndexesOrIndexesById=Y,e.useLinkedRowIds=De,e.useLinkedRowIdsListener=(e,s,t,l,o)=>ke("Linked"+b,Z(o),t,l,[e,s]),e.useLocalRowIds=Me,e.useLocalRowIdsListener=(e,s,t,l,o)=>ke("Local"+b,Z(o),t,l,[e,s]),e.useMetric=Oe,e.useMetricIds=e=>Re("MetricIds",X(e),1),e.useMetricListener=(e,s,t,l)=>ke("Metric",X(l),s,t,[e]),e.useMetrics=e=>_(e,2),e.useMetricsIds=()=>K(3),e.useMetricsOrMetricsById=X,e.useProvideStore=(e,s)=>{const{12:t,13:l}=Q(G);A((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>_(e,8),e.useQueriesIds=()=>K(9),e.useQueriesOrQueriesById=$,e.useQueryIds=e=>Re("QueryIds",$(e),1),e.useRedoInformation=e=>{var s;const t=ee(e),[,,[o]]=Ae(t);return[!m(o),We(t),o,null!=(s=L(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>Re("RelationshipIds",Z(e),1),e.useRelationships=e=>_(e,6),e.useRelationshipsIds=()=>K(7),e.useRelationshipsOrRelationshipsById=Z,e.useRemoteRowId=He,e.useRemoteRowIdListener=(e,s,t,l,o)=>ke("RemoteRowId",Z(o),t,l,[e,s]),e.useResultCell=Qe,e.useResultCellIds=Ee,e.useResultCellIdsListener=(e,s,t,l,o)=>ke(n+k,$(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>ke(n+R,$(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>Re(n+p,$(t),0,[e,s]),e.useResultRowCount=(e,s)=>Re(n+C,$(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>ke(n+C,$(l),s,t,[e]),e.useResultRowIds=je,e.useResultRowIdsListener=(e,s,t,l)=>ke(n+b,$(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>ke(n+p,$(o),t,l,[e,s]),e.useResultSortedRowIds=Fe,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>ke(n+w,$(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>Re(n+a,$(s),0,[e]),e.useResultTableCellIds=(e,s)=>Re(n+a+k,$(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>ke(n+a+k,$(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>ke(n+a,$(l),s,t,[e]),e.useRow=(e,s,t)=>Re(p,N(t),0,[e,s]),e.useRowCount=(e,s)=>Re(C,N(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>ke(C,N(o),s,t,[e],l),e.useRowIds=fe,e.useRowIdsListener=(e,s,t,l,o)=>ke(b,N(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>ke(p,N(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>ve(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=V,s=ce,t,l=V,o=ce)=>{const r=ee(t);return oe((s=>L(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>ve(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>ve(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>ve(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>ve(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>ve(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>ve(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>ve(t,y,e,s,l,o),e.useSliceIds=qe,e.useSliceIdsListener=(e,s,t,l)=>ke("SliceIds",Y(l),s,t,[e]),e.useSliceRowIds=Be,e.useSliceRowIdsListener=(e,s,t,l,o)=>ke("Slice"+b,Y(o),t,l,[e,s]),e.useSortedRowIds=Se,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>ke(w,N(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>ke("Start"+te,N(t),e,s),e.useStore=e=>_(e,0),e.useStoreIds=()=>K(1),e.useStoreOrStoreById=N,e.useTable=(e,s)=>Re(a,N(s),0,[e]),e.useTableCellIds=(e,s)=>Re(a+k,N(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>ke(a+k,N(o),s,t,[e],l),e.useTableIds=Le,e.useTableIdsListener=(e,s,t,l)=>ke(I,N(l),e,s,ce,t),e.useTableListener=(e,s,t,l,o)=>ke(a,N(o),s,t,[e],l),e.useTables=e=>Re(c,N(e),0),e.useTablesListener=(e,s,t,l)=>ke(c,N(l),e,s,ce,t),e.useUndoInformation=e=>{var s;const t=ee(e),[o,r]=Ae(t);return[(u=o,!(0==T(u))),Ue(t),r,null!=(s=L(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=xe,e.useValueIds=Pe,e.useValueIdsListener=(e,s,t,l)=>ke(g,N(l),e,s,ce,t),e.useValueListener=(e,s,t,l,o)=>ke(v,N(o),s,t,[e],l),e.useValues=e=>Re(y,N(e),0),e.useValuesListener=(e,s,t,l)=>ke(y,N(l),e,s,ce,t),e.useWillFinishTransactionListener=(e,s,t)=>ke("WillFinish"+te,N(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
1
+ var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",i="Has",d="Ids",a="Table",c=a+"s",I=a+d,p="Row",C=p+"Count",b=p+d,w="Sorted"+p+d,R="Cell",k=R+d,v="Value",y=v+"s",g=v+d,h=globalThis,m=e=>null==e,L=(e,s,t)=>m(e)?null==t?void 0:t():s(e),f=e=>t(e)==o,S=e=>t(e)==r,T=e=>e.length,V=()=>{},P=(e,s)=>e.every(s),x=(e,s)=>T(e)===T(s)&&P(e,((e,t)=>s[t]===e)),O=(e,s)=>e.map(s),q=(e,s,t)=>e.with(s,t),B=Object,M=e=>B.getPrototypeOf(e),H=B.entries,D=e=>!m(e)&&L(M(e),(e=>e==B.prototype||m(M(e))),(()=>!0)),j=B.keys,F=(e,s)=>L(e,(e=>e[s])),Q=(e,s)=>s in e,E=(e,s)=>{const t=H(e);return T(t)===T(j(s))&&P(t,(([e,t])=>D(t)?!!D(s[e])&&E(s[e],t):s[e]===t))},{createContext:A,useContext:G,useEffect:U}=s,W=(J=()=>A([]),Q(z=h,_="tinybase_uirc")||(z[_]=J()),z[_]);var z,_,J;const K=(e,s)=>{var t;const l=G(W);return m(e)?l[s]:f(e)?F(null!=(t=l[s+1])?t:{},e):e},N=(e,s)=>{const t=K(e,s);return m(e)||f(e)?t:e},X=(e,s,t)=>{const{12:l,13:o}=G(W);U((()=>(null==l||l(t,e,s),()=>null==o?void 0:o(t,e))),[l,e,s,t,o])},Y=e=>{var s;return j(null!=(s=G(W)[e])?s:{})},Z=e=>N(e,0),$=e=>N(e,2),ee=e=>N(e,4),se=e=>N(e,6),te=e=>N(e,8),le=e=>N(e,10),oe=e=>e.toLowerCase();oe(u);const re="Transaction";oe(re);var ue=(e,s,t)=>new Promise(((l,o)=>{var r=e=>{try{n(t.next(e))}catch(e){o(e)}},u=e=>{try{n(t.throw(e))}catch(e){o(e)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,u);n((t=t.apply(e,s)).next())}));const{useCallback:ne,useEffect:ie,useMemo:de,useLayoutEffect:ae,useRef:ce,useState:Ie,useSyncExternalStore:pe}=s,Ce=[],be=[{},[],[Ce,void 0,Ce],void 0,!1,0],we=[E,x,([e,s,t],[l,o,r])=>s===o&&x(e,l)&&x(t,r)],Re=(e,s)=>e===s,ke=(e,s,t=Ce)=>{const[,l]=Ie(),[o,r]=Ie();return ie((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},ve=(e,s,...t)=>{var l;const o=null==(l=null==e?void 0:e["add"+s+u])?void 0:l.call(e,...t);return()=>null==e?void 0:e.delListener(o)},ye=(e,s,t,o=Ce)=>{const r=ce(be[t]),u=ne((()=>{var l,u,n;const i=null!=(u=null==(l=null==s?void 0:s[(4==t?"has":"get")+e])?void 0:l.call(s,...o))?u:be[t];return(null!=(n=we[t])?n:Re)(i,r.current)?r.current:r.current=i}),[s,t,e,...o]),n=ne((r=>ve(s,(4==t?i:l)+e,...o,r)),[s,t,e,...o]);return pe(n,u)},ge=(e,s,t,l=Ce,o=Ce,...r)=>ae((()=>ve(s,e,...o,t,...r)),[s,e,...o,...l,...r]),he=(e,s,t,l=Ce,o=V,r=Ce,...u)=>{const n=Z(e);return ne((e=>L(n,(l=>L(t(e,l),(t=>o(l["set"+s](...me(u,l,e),t),t)))))),[n,s,...l,...r,...Le(u)])},me=(e,s,t)=>O(e,(e=>S(e)?e(t,s):e)),Le=e=>{return s=e=>!S(e),e.filter(s);var s},fe=(e,s,t=V,l=Ce,...o)=>{const r=Z(e);return ne((e=>t(null==r?void 0:r["del"+s](...me(o,r,e)))),[r,s,...l,...Le(o)])},Se=(e,s,t)=>{const l=le(e);return ne((()=>null==l?void 0:l[s](t)),[l,s,t])},Te=e=>ye(I,Z(e),1),Ve=(e,s)=>ye(b,Z(s),1,[e]),Pe=(e,s,t,l=0,o,r)=>ye(w,Z(r),1,[e,s,t,l,o]),xe=(e,s,t)=>ye(k,Z(t),1,[e,s]),Oe=(e,s,t,l)=>ye(R,Z(l),3,[e,s,t]),qe=e=>ye(g,Z(e),1),Be=(e,s)=>ye(v,Z(s),3,[e]),Me=(e,s)=>ye("Metric",$(s),3,[e]),He=(e,s)=>ye("SliceIds",ee(s),1,[e]),De=(e,s,t)=>ye("Slice"+b,ee(t),1,[e,s]),je=(e,s,t)=>ye("RemoteRowId",se(t),3,[e,s]),Fe=(e,s,t)=>ye("Local"+b,se(t),1,[e,s]),Qe=(e,s,t)=>ye("Linked"+b,se(t),1,[e,s]),Ee=(e,s)=>ye(n+b,te(s),1,[e]),Ae=(e,s,t,l=0,o,r)=>ye(n+w,te(r),1,[e,s,t,l,o]),Ge=(e,s,t)=>ye(n+k,te(t),1,[e,s]),Ue=(e,s,t,l)=>ye(n+R,te(l),3,[e,s,t]),We=e=>ye("CheckpointIds",le(e),2),ze=(e,s)=>ye("Checkpoint",le(s),3,[e]),_e=e=>Se(e,"goBackward"),Je=e=>Se(e,"goForward"),{PureComponent:Ke,Fragment:Ne,createElement:Xe,useCallback:Ye,useLayoutEffect:Ze,useRef:$e,useState:es}=s,ss=(e,...s)=>m(e)?{}:e(...s),ts=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var ls=Object.defineProperty,os=Object.defineProperties,rs=Object.getOwnPropertyDescriptors,us=Object.getOwnPropertySymbols,ns=Object.prototype.hasOwnProperty,is=Object.prototype.propertyIsEnumerable,ds=(e,s,t)=>s in e?ls(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,as=(e,s)=>{for(var t in s||(s={}))ns.call(s,t)&&ds(e,t,s[t]);if(us)for(var t of us(s))is.call(s,t)&&ds(e,t,s[t]);return e},cs=(e,s)=>os(e,rs(s)),Is=(e,s)=>{var t={};for(var l in e)ns.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&us)for(var l of us(e))s.indexOf(l)<0&&is.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:ps,useContext:Cs,useMemo:bs,useState:ws}=s,Rs=({tableId:e,store:s,rowComponent:t=ms,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>gs(O(n,(r=>Xe(t,cs(as({},ss(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),ks=({queryId:e,queries:s,resultRowComponent:t=Vs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>gs(O(u,(o=>Xe(t,cs(as({},ss(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),vs=({relationshipId:e,relationships:s,rowComponent:t=ms,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[i,d,a]=ts(se(s),e),c=u(e,n,i);return gs(O(c,(e=>Xe(t,cs(as({},ss(l,e)),{key:e,tableId:a,rowId:e,store:d,debugIds:r})))),o,r,n)},ys=e=>({checkpoints:s,checkpointComponent:t=Ps,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=le(s);return gs(O(e(We(u)),(e=>Xe(t,cs(as({},ss(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},gs=(e,s,t,l)=>{const o=m(s)||!Array.isArray(e)?e:O(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},hs=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return gs(l+(null!=(u=Oe(e,s,t,o))?u:l),void 0,r,t)},ms=({tableId:e,rowId:s,store:t,cellComponent:l=hs,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>gs(O(((e,s,t,l)=>{const o=xe(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Xe(l,cs(as({},ss(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Ls=e=>Rs(e,Ve(e.tableId,e.store)),fs=({valueId:e,store:s,debugIds:t})=>{var o;return gs(l+(null!=(o=Be(e,s))?o:l),void 0,t,e)},Ss=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ms,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,i,d]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(ee(t),e),a=De(e,s,n);return gs(O(a,(e=>Xe(l,cs(as({},ss(o,e)),{key:e,tableId:d,rowId:e,store:i,debugIds:u})))),r,u,s)},Ts=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return gs(l+(null!=(u=Ue(e,s,t,o))?u:l),void 0,r,t)},Vs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=Ts,getResultCellComponentProps:o,separator:r,debugIds:u})=>gs(O(Ge(e,s,t),(r=>Xe(l,cs(as({},ss(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ps=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return gs(null!=(o=ze(s,e))?o:l,void 0,t,s)},xs=ys((e=>e[0])),Os=ys((e=>m(e[1])?[]:[e[1]])),qs=ys((e=>e[2]));e.BackwardCheckpointsView=xs,e.CellView=hs,e.CheckpointView=Ps,e.CurrentCheckpointView=Os,e.ForwardCheckpointsView=qs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ss,getSliceComponentProps:l,separator:o,debugIds:r})=>gs(O(He(e,s),(o=>Xe(t,cs(as({},ss(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>vs(e,Qe,e.firstRowId),e.LocalRowsView=e=>vs(e,Fe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return gs(null!=(o=Me(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:i,queriesById:d,checkpoints:a,checkpointsById:c,children:I})=>{const p=Cs(W),[C,b]=ws([{},{},{},{},{},{}]),w=ps(((e,s,t)=>b((l=>F(l[e],s)==t?l:q(l,e,cs(as({},l[e]),{[s]:t}))))),[]),R=ps(((e,s)=>b((t=>Q(t[e],s)?q(t,e,((e,s)=>(delete e[s],e))(t[e],s)):t))),[]);return Xe(W.Provider,{value:bs((()=>[null!=e?e:p[0],as(as(as({},p[1]),s),C[0]),null!=t?t:p[2],as(as(as({},p[3]),l),C[1]),null!=o?o:p[4],as(as(as({},p[5]),r),C[2]),null!=u?u:p[6],as(as(as({},p[7]),n),C[3]),null!=i?i:p[8],as(as(as({},p[9]),d),C[4]),null!=a?a:p[10],as(as(as({},p[11]),c),C[5]),w,R]),[e,s,C,t,l,o,r,u,n,i,d,a,c,p,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ms,getRowComponentProps:o,debugIds:r})=>{const[u,n,,i]=ts(se(t),e),d=je(e,s,u);return gs(m(i)||m(d)?null:Xe(l,cs(as({},ss(o,d)),{key:d,tableId:i,rowId:d,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ts,e.ResultRowView=Vs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Is(s,["cellId","descending","offset","limit"]);return ks(u,Ae(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>ks(e,Ee(e.queryId,e.queries)),e.RowView=ms,e.SliceView=Ss,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Is(s,["cellId","descending","offset","limit"]);return Rs(u,Pe(u.tableId,t,l,o,r,u.store))},e.TableView=Ls,e.TablesView=({store:e,tableComponent:s=Ls,getTableComponentProps:t,separator:l,debugIds:o})=>gs(O(Te(e),(l=>Xe(s,cs(as({},ss(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=fs,e.ValuesView=({store:e,valueComponent:s=fs,getValueComponentProps:t,separator:l,debugIds:o})=>gs(O(qe(e),(l=>Xe(s,cs(as({},ss(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=Ce,l,o=V,r=Ce,u=!0)=>{const n=Z(l);return ne((t=>L(n,(l=>L(s(t,l),(s=>o(l.addRow(S(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=Oe,e.useCellIds=xe,e.useCellIdsListener=(e,s,t,l,o,r)=>ge(k,Z(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>ge(R,Z(u),l,o,[e,s,t],r),e.useCheckpoint=ze,e.useCheckpointIds=We,e.useCheckpointIdsListener=(e,s,t)=>ge("CheckpointIds",le(t),e,s),e.useCheckpointListener=(e,s,t,l)=>ge("Checkpoint",le(l),s,t,[e]),e.useCheckpoints=e=>K(e,10),e.useCheckpointsIds=()=>Y(11),e.useCheckpointsOrCheckpointsById=le,e.useCreateCheckpoints=(e,s,t)=>ke(e,s,t),e.useCreateIndexes=(e,s,t)=>ke(e,s,t),e.useCreateMergeableStore=(e,s=Ce)=>de(e,s),e.useCreateMetrics=(e,s,t)=>ke(e,s,t),e.useCreatePersister=(e,s,t=Ce,l,o=Ce,r,u=Ce)=>{const[,n]=Ie(),[i,d]=Ie();return ie((()=>{ue(void 0,null,(function*(){const t=e?yield s(e):void 0;d(t),t&&l&&ue(void 0,null,(function*(){yield l(t),n([])}))}))}),[e,...t,...o]),ie((()=>()=>{i&&(i.destroy(),null==r||r(i))}),[i,...u]),i},e.useCreateQueries=(e,s,t)=>ke(e,s,t),e.useCreateRelationships=(e,s,t)=>ke(e,s,t),e.useCreateStore=(e,s=Ce)=>de(e,s),e.useCreateSynchronizer=(e,s,t=Ce,l,o=Ce)=>{const[r,u]=Ie();return ie((()=>{ue(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),ie((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>fe(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>fe(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>fe(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>fe(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>fe(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>fe(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>ge("DidFinish"+re,Z(t),e,s),e.useGoBackwardCallback=_e,e.useGoForwardCallback=Je,e.useGoToCallback=(e,s=Ce,t,l=V,o=Ce)=>{const r=le(t);return ne((s=>L(r,(t=>L(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>ye(R,Z(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>ge(i+R,Z(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>ye(p,Z(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>ge(i+p,Z(r),t,l,[e,s],o),e.useHasTable=(e,s)=>ye(a,Z(s),4,[e]),e.useHasTableCell=(e,s,t)=>ye(a+R,Z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>ge(i+a+R,Z(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>ge(i+a,Z(o),s,t,[e],l),e.useHasTables=e=>ye(c,Z(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>ge(i+c,Z(l),e,s,[],t),e.useHasValue=(e,s)=>ye(v,Z(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>ge(i+v,Z(o),s,t,[e],l),e.useHasValues=e=>ye(y,Z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>ge(i+y,Z(l),e,s,[],t),e.useIndexIds=e=>ye("IndexIds",ee(e),1),e.useIndexes=e=>K(e,4),e.useIndexesIds=()=>Y(5),e.useIndexesOrIndexesById=ee,e.useLinkedRowIds=Qe,e.useLinkedRowIdsListener=(e,s,t,l,o)=>ge("Linked"+b,se(o),t,l,[e,s]),e.useLocalRowIds=Fe,e.useLocalRowIdsListener=(e,s,t,l,o)=>ge("Local"+b,se(o),t,l,[e,s]),e.useMetric=Me,e.useMetricIds=e=>ye("MetricIds",$(e),1),e.useMetricListener=(e,s,t,l)=>ge("Metric",$(l),s,t,[e]),e.useMetrics=e=>K(e,2),e.useMetricsIds=()=>Y(3),e.useMetricsOrMetricsById=$,e.useProvideCheckpoints=(e,s)=>X(e,s,5),e.useProvideIndexes=(e,s)=>X(e,s,2),e.useProvideMetrics=(e,s)=>X(e,s,1),e.useProvideQueries=(e,s)=>X(e,s,4),e.useProvideRelationships=(e,s)=>X(e,s,3),e.useProvideStore=(e,s)=>X(e,s,0),e.useQueries=e=>K(e,8),e.useQueriesIds=()=>Y(9),e.useQueriesOrQueriesById=te,e.useQueryIds=e=>ye("QueryIds",te(e),1),e.useRedoInformation=e=>{var s;const t=le(e),[,,[o]]=We(t);return[!m(o),Je(t),o,null!=(s=L(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>ye("RelationshipIds",se(e),1),e.useRelationships=e=>K(e,6),e.useRelationshipsIds=()=>Y(7),e.useRelationshipsOrRelationshipsById=se,e.useRemoteRowId=je,e.useRemoteRowIdListener=(e,s,t,l,o)=>ge("RemoteRowId",se(o),t,l,[e,s]),e.useResultCell=Ue,e.useResultCellIds=Ge,e.useResultCellIdsListener=(e,s,t,l,o)=>ge(n+k,te(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>ge(n+R,te(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>ye(n+p,te(t),0,[e,s]),e.useResultRowCount=(e,s)=>ye(n+C,te(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>ge(n+C,te(l),s,t,[e]),e.useResultRowIds=Ee,e.useResultRowIdsListener=(e,s,t,l)=>ge(n+b,te(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>ge(n+p,te(o),t,l,[e,s]),e.useResultSortedRowIds=Ae,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,i)=>ge(n+w,te(i),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>ye(n+a,te(s),0,[e]),e.useResultTableCellIds=(e,s)=>ye(n+a+k,te(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>ge(n+a+k,te(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>ge(n+a,te(l),s,t,[e]),e.useRow=(e,s,t)=>ye(p,Z(t),0,[e,s]),e.useRowCount=(e,s)=>ye(C,Z(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>ge(C,Z(o),s,t,[e],l),e.useRowIds=Ve,e.useRowIdsListener=(e,s,t,l,o)=>ge(b,Z(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>ge(p,Z(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>he(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=V,s=Ce,t,l=V,o=Ce)=>{const r=le(t);return ne((s=>L(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>he(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>he(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>he(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>he(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>he(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>he(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>he(t,y,e,s,l,o),e.useSliceIds=He,e.useSliceIdsListener=(e,s,t,l)=>ge("SliceIds",ee(l),s,t,[e]),e.useSliceRowIds=De,e.useSliceRowIdsListener=(e,s,t,l,o)=>ge("Slice"+b,ee(o),t,l,[e,s]),e.useSortedRowIds=Pe,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,i)=>ge(w,Z(i),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>ge("Start"+re,Z(t),e,s),e.useStore=e=>K(e,0),e.useStoreIds=()=>Y(1),e.useStoreOrStoreById=Z,e.useTable=(e,s)=>ye(a,Z(s),0,[e]),e.useTableCellIds=(e,s)=>ye(a+k,Z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>ge(a+k,Z(o),s,t,[e],l),e.useTableIds=Te,e.useTableIdsListener=(e,s,t,l)=>ge(I,Z(l),e,s,Ce,t),e.useTableListener=(e,s,t,l,o)=>ge(a,Z(o),s,t,[e],l),e.useTables=e=>ye(c,Z(e),0),e.useTablesListener=(e,s,t,l)=>ge(c,Z(l),e,s,Ce,t),e.useUndoInformation=e=>{var s;const t=le(e),[o,r]=We(t);return[(u=o,!(0==T(u))),_e(t),r,null!=(s=L(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Be,e.useValueIds=qe,e.useValueIdsListener=(e,s,t,l)=>ge(g,Z(l),e,s,Ce,t),e.useValueListener=(e,s,t,l,o)=>ge(v,Z(o),s,t,[e],l),e.useValues=e=>ye(y,Z(e),0),e.useValuesListener=(e,s,t,l)=>ge(y,Z(l),e,s,Ce,t),e.useWillFinishTransactionListener=(e,s,t)=>ge("WillFinish"+re,Z(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
Binary file
@@ -1 +1 @@
1
- var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",d="Has",i="Ids",a="Table",c=a+"s",I=a+i,p="Row",C=p+"Count",b=p+i,w="Sorted"+p+i,R="Cell",k=R+i,v="Value",y=v+"s",g=v+i,h=globalThis,m=e=>null==e,L=(e,s,t)=>m(e)?null==t?void 0:t():s(e),f=e=>t(e)==o,S=e=>t(e)==r,T=e=>e.length,V=()=>{},P=(e,s)=>e.every(s),x=(e,s)=>T(e)===T(s)&&P(e,((e,t)=>s[t]===e)),O=(e,s)=>e.map(s),q=Object,B=e=>q.getPrototypeOf(e),H=q.entries,M=e=>!m(e)&&L(B(e),(e=>e==q.prototype||m(B(e))),(()=>!0)),D=q.keys,j=(e,s)=>L(e,(e=>e[s])),F=(e,s)=>{const t=H(e);return T(t)===T(D(s))&&P(t,(([e,t])=>M(t)?!!M(s[e])&&F(s[e],t):s[e]===t))},{createContext:E,useContext:Q,useEffect:A}=s,G=(z=()=>E([]),((e,s)=>s in e)(U=h,W="tinybase_uirc")||(U[W]=z()),U[W]);var U,W,z;const _=(e,s)=>{var t;const l=Q(G);return m(e)?l[s]:f(e)?j(null!=(t=l[s+1])?t:{},e):e},J=(e,s)=>{const t=_(e,s);return m(e)||f(e)?t:e},K=e=>{var s;return D(null!=(s=Q(G)[e])?s:{})},N=e=>J(e,0),X=e=>J(e,2),Y=e=>J(e,4),Z=e=>J(e,6),$=e=>J(e,8),ee=e=>J(e,10),se=e=>e.toLowerCase();se(u);const te="Transaction";se(te);var le=(e,s,t)=>new Promise(((l,o)=>{var r=e=>{try{n(t.next(e))}catch(e){o(e)}},u=e=>{try{n(t.throw(e))}catch(e){o(e)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,u);n((t=t.apply(e,s)).next())}));const{useCallback:oe,useEffect:re,useMemo:ue,useLayoutEffect:ne,useRef:de,useState:ie,useSyncExternalStore:ae}=s,ce=[],Ie=[{},[],[ce,void 0,ce],void 0,!1,0],pe=[F,x,([e,s,t],[l,o,r])=>s===o&&x(e,l)&&x(t,r)],Ce=(e,s)=>e===s,be=(e,s,t=ce)=>{const[,l]=ie(),[o,r]=ie();return re((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},we=(e,s,...t)=>{var l;const o=null==(l=null==e?void 0:e["add"+s+u])?void 0:l.call(e,...t);return()=>null==e?void 0:e.delListener(o)},Re=(e,s,t,o=ce)=>{const r=de(Ie[t]),u=oe((()=>{var l,u,n;const d=null!=(u=null==(l=null==s?void 0:s[(4==t?"has":"get")+e])?void 0:l.call(s,...o))?u:Ie[t];return(null!=(n=pe[t])?n:Ce)(d,r.current)?r.current:r.current=d}),[s,t,e,...o]),n=oe((r=>we(s,(4==t?d:l)+e,...o,r)),[s,t,e,...o]);return ae(n,u)},ke=(e,s,t,l=ce,o=ce,...r)=>ne((()=>we(s,e,...o,t,...r)),[s,e,...o,...l,...r]),ve=(e,s,t,l=ce,o=V,r=ce,...u)=>{const n=N(e);return oe((e=>L(n,(l=>L(t(e,l),(t=>o(l["set"+s](...ye(u,l,e),t),t)))))),[n,s,...l,...r,...ge(u)])},ye=(e,s,t)=>O(e,(e=>S(e)?e(t,s):e)),ge=e=>{return s=e=>!S(e),e.filter(s);var s},he=(e,s,t=V,l=ce,...o)=>{const r=N(e);return oe((e=>t(null==r?void 0:r["del"+s](...ye(o,r,e)))),[r,s,...l,...ge(o)])},me=(e,s,t)=>{const l=ee(e);return oe((()=>null==l?void 0:l[s](t)),[l,s,t])},Le=e=>Re(I,N(e),1),fe=(e,s)=>Re(b,N(s),1,[e]),Se=(e,s,t,l=0,o,r)=>Re(w,N(r),1,[e,s,t,l,o]),Te=(e,s,t)=>Re(k,N(t),1,[e,s]),Ve=(e,s,t,l)=>Re(R,N(l),3,[e,s,t]),Pe=e=>Re(g,N(e),1),xe=(e,s)=>Re(v,N(s),3,[e]),Oe=(e,s)=>Re("Metric",X(s),3,[e]),qe=(e,s)=>Re("SliceIds",Y(s),1,[e]),Be=(e,s,t)=>Re("Slice"+b,Y(t),1,[e,s]),He=(e,s,t)=>Re("RemoteRowId",Z(t),3,[e,s]),Me=(e,s,t)=>Re("Local"+b,Z(t),1,[e,s]),De=(e,s,t)=>Re("Linked"+b,Z(t),1,[e,s]),je=(e,s)=>Re(n+b,$(s),1,[e]),Fe=(e,s,t,l=0,o,r)=>Re(n+w,$(r),1,[e,s,t,l,o]),Ee=(e,s,t)=>Re(n+k,$(t),1,[e,s]),Qe=(e,s,t,l)=>Re(n+R,$(l),3,[e,s,t]),Ae=e=>Re("CheckpointIds",ee(e),2),Ge=(e,s)=>Re("Checkpoint",ee(s),3,[e]),Ue=e=>me(e,"goBackward"),We=e=>me(e,"goForward"),{PureComponent:ze,Fragment:_e,createElement:Je,useCallback:Ke,useLayoutEffect:Ne,useRef:Xe,useState:Ye}=s,Ze=(e,...s)=>m(e)?{}:e(...s),$e=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var es=Object.defineProperty,ss=Object.defineProperties,ts=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertySymbols,os=Object.prototype.hasOwnProperty,rs=Object.prototype.propertyIsEnumerable,us=(e,s,t)=>s in e?es(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ns=(e,s)=>{for(var t in s||(s={}))os.call(s,t)&&us(e,t,s[t]);if(ls)for(var t of ls(s))rs.call(s,t)&&us(e,t,s[t]);return e},ds=(e,s)=>ss(e,ts(s)),is=(e,s)=>{var t={};for(var l in e)os.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&ls)for(var l of ls(e))s.indexOf(l)<0&&rs.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:as,useContext:cs,useMemo:Is,useState:ps}=s,Cs=({tableId:e,store:s,rowComponent:t=ys,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>ks(O(n,(r=>Je(t,ds(ns({},Ze(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),bs=({queryId:e,queries:s,resultRowComponent:t=fs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>ks(O(u,(o=>Je(t,ds(ns({},Ze(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),ws=({relationshipId:e,relationships:s,rowComponent:t=ys,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=$e(Z(s),e),c=u(e,n,d);return ks(O(c,(e=>Je(t,ds(ns({},Ze(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},Rs=e=>({checkpoints:s,checkpointComponent:t=Ss,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=ee(s);return ks(O(e(Ae(u)),(e=>Je(t,ds(ns({},Ze(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},ks=(e,s,t,l)=>{const o=m(s)||!Array.isArray(e)?e:O(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},vs=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return ks(l+(null!=(u=Ve(e,s,t,o))?u:l),void 0,r,t)},ys=({tableId:e,rowId:s,store:t,cellComponent:l=vs,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>ks(O(((e,s,t,l)=>{const o=Te(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Je(l,ds(ns({},Ze(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),gs=e=>Cs(e,fe(e.tableId,e.store)),hs=({valueId:e,store:s,debugIds:t})=>{var o;return ks(l+(null!=(o=xe(e,s))?o:l),void 0,t,e)},ms=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ys,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(Y(t),e),a=Be(e,s,n);return ks(O(a,(e=>Je(l,ds(ns({},Ze(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Ls=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return ks(l+(null!=(u=Qe(e,s,t,o))?u:l),void 0,r,t)},fs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=Ls,getResultCellComponentProps:o,separator:r,debugIds:u})=>ks(O(Ee(e,s,t),(r=>Je(l,ds(ns({},Ze(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ss=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return ks(null!=(o=Ge(s,e))?o:l,void 0,t,s)},Ts=Rs((e=>e[0])),Vs=Rs((e=>m(e[1])?[]:[e[1]])),Ps=Rs((e=>e[2]));e.BackwardCheckpointsView=Ts,e.CellView=vs,e.CheckpointView=Ss,e.CurrentCheckpointView=Vs,e.ForwardCheckpointsView=Ps,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ms,getSliceComponentProps:l,separator:o,debugIds:r})=>ks(O(qe(e,s),(o=>Je(t,ds(ns({},Ze(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>ws(e,De,e.firstRowId),e.LocalRowsView=e=>ws(e,Me,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return ks(null!=(o=Oe(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=cs(G),[C,b]=ps({}),w=as(((e,s)=>b((t=>j(t,e)==s?t:ds(ns({},t),{[e]:s})))),[]),R=as((e=>b((s=>ns({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Je(G.Provider,{value:Is((()=>[null!=e?e:p[0],ns(ns(ns({},p[1]),s),C),null!=t?t:p[2],ns(ns({},p[3]),l),null!=o?o:p[4],ns(ns({},p[5]),r),null!=u?u:p[6],ns(ns({},p[7]),n),null!=d?d:p[8],ns(ns({},p[9]),i),null!=a?a:p[10],ns(ns({},p[11]),c),w,R]),[e,s,C,t,l,o,r,u,n,d,i,a,c,p,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ys,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=$e(Z(t),e),i=He(e,s,u);return ks(m(d)||m(i)?null:Je(l,ds(ns({},Ze(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ls,e.ResultRowView=fs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=is(s,["cellId","descending","offset","limit"]);return bs(u,Fe(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>bs(e,je(e.queryId,e.queries)),e.RowView=ys,e.SliceView=ms,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=is(s,["cellId","descending","offset","limit"]);return Cs(u,Se(u.tableId,t,l,o,r,u.store))},e.TableView=gs,e.TablesView=({store:e,tableComponent:s=gs,getTableComponentProps:t,separator:l,debugIds:o})=>ks(O(Le(e),(l=>Je(s,ds(ns({},Ze(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=hs,e.ValuesView=({store:e,valueComponent:s=hs,getValueComponentProps:t,separator:l,debugIds:o})=>ks(O(Pe(e),(l=>Je(s,ds(ns({},Ze(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=ce,l,o=V,r=ce,u=!0)=>{const n=N(l);return oe((t=>L(n,(l=>L(s(t,l),(s=>o(l.addRow(S(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=Ve,e.useCellIds=Te,e.useCellIdsListener=(e,s,t,l,o,r)=>ke(k,N(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>ke(R,N(u),l,o,[e,s,t],r),e.useCheckpoint=Ge,e.useCheckpointIds=Ae,e.useCheckpointIdsListener=(e,s,t)=>ke("CheckpointIds",ee(t),e,s),e.useCheckpointListener=(e,s,t,l)=>ke("Checkpoint",ee(l),s,t,[e]),e.useCheckpoints=e=>_(e,10),e.useCheckpointsIds=()=>K(11),e.useCheckpointsOrCheckpointsById=ee,e.useCreateCheckpoints=(e,s,t)=>be(e,s,t),e.useCreateIndexes=(e,s,t)=>be(e,s,t),e.useCreateMergeableStore=(e,s=ce)=>ue(e,s),e.useCreateMetrics=(e,s,t)=>be(e,s,t),e.useCreatePersister=(e,s,t=ce,l,o=ce,r,u=ce)=>{const[,n]=ie(),[d,i]=ie();return re((()=>{le(void 0,null,(function*(){const t=e?yield s(e):void 0;i(t),t&&l&&le(void 0,null,(function*(){yield l(t),n([])}))}))}),[e,...t,...o]),re((()=>()=>{d&&(d.destroy(),null==r||r(d))}),[d,...u]),d},e.useCreateQueries=(e,s,t)=>be(e,s,t),e.useCreateRelationships=(e,s,t)=>be(e,s,t),e.useCreateStore=(e,s=ce)=>ue(e,s),e.useCreateSynchronizer=(e,s,t=ce,l,o=ce)=>{const[r,u]=ie();return re((()=>{le(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),re((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>he(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>he(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>he(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>he(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>he(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>he(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>ke("DidFinish"+te,N(t),e,s),e.useGoBackwardCallback=Ue,e.useGoForwardCallback=We,e.useGoToCallback=(e,s=ce,t,l=V,o=ce)=>{const r=ee(t);return oe((s=>L(r,(t=>L(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>Re(R,N(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>ke(d+R,N(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>Re(p,N(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>ke(d+p,N(r),t,l,[e,s],o),e.useHasTable=(e,s)=>Re(a,N(s),4,[e]),e.useHasTableCell=(e,s,t)=>Re(a+R,N(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>ke(d+a+R,N(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>ke(d+a,N(o),s,t,[e],l),e.useHasTables=e=>Re(c,N(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>ke(d+c,N(l),e,s,[],t),e.useHasValue=(e,s)=>Re(v,N(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>ke(d+v,N(o),s,t,[e],l),e.useHasValues=e=>Re(y,N(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>ke(d+y,N(l),e,s,[],t),e.useIndexIds=e=>Re("IndexIds",Y(e),1),e.useIndexes=e=>_(e,4),e.useIndexesIds=()=>K(5),e.useIndexesOrIndexesById=Y,e.useLinkedRowIds=De,e.useLinkedRowIdsListener=(e,s,t,l,o)=>ke("Linked"+b,Z(o),t,l,[e,s]),e.useLocalRowIds=Me,e.useLocalRowIdsListener=(e,s,t,l,o)=>ke("Local"+b,Z(o),t,l,[e,s]),e.useMetric=Oe,e.useMetricIds=e=>Re("MetricIds",X(e),1),e.useMetricListener=(e,s,t,l)=>ke("Metric",X(l),s,t,[e]),e.useMetrics=e=>_(e,2),e.useMetricsIds=()=>K(3),e.useMetricsOrMetricsById=X,e.useProvideStore=(e,s)=>{const{12:t,13:l}=Q(G);A((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>_(e,8),e.useQueriesIds=()=>K(9),e.useQueriesOrQueriesById=$,e.useQueryIds=e=>Re("QueryIds",$(e),1),e.useRedoInformation=e=>{var s;const t=ee(e),[,,[o]]=Ae(t);return[!m(o),We(t),o,null!=(s=L(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>Re("RelationshipIds",Z(e),1),e.useRelationships=e=>_(e,6),e.useRelationshipsIds=()=>K(7),e.useRelationshipsOrRelationshipsById=Z,e.useRemoteRowId=He,e.useRemoteRowIdListener=(e,s,t,l,o)=>ke("RemoteRowId",Z(o),t,l,[e,s]),e.useResultCell=Qe,e.useResultCellIds=Ee,e.useResultCellIdsListener=(e,s,t,l,o)=>ke(n+k,$(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>ke(n+R,$(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>Re(n+p,$(t),0,[e,s]),e.useResultRowCount=(e,s)=>Re(n+C,$(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>ke(n+C,$(l),s,t,[e]),e.useResultRowIds=je,e.useResultRowIdsListener=(e,s,t,l)=>ke(n+b,$(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>ke(n+p,$(o),t,l,[e,s]),e.useResultSortedRowIds=Fe,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>ke(n+w,$(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>Re(n+a,$(s),0,[e]),e.useResultTableCellIds=(e,s)=>Re(n+a+k,$(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>ke(n+a+k,$(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>ke(n+a,$(l),s,t,[e]),e.useRow=(e,s,t)=>Re(p,N(t),0,[e,s]),e.useRowCount=(e,s)=>Re(C,N(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>ke(C,N(o),s,t,[e],l),e.useRowIds=fe,e.useRowIdsListener=(e,s,t,l,o)=>ke(b,N(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>ke(p,N(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>ve(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=V,s=ce,t,l=V,o=ce)=>{const r=ee(t);return oe((s=>L(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>ve(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>ve(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>ve(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>ve(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>ve(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>ve(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>ve(t,y,e,s,l,o),e.useSliceIds=qe,e.useSliceIdsListener=(e,s,t,l)=>ke("SliceIds",Y(l),s,t,[e]),e.useSliceRowIds=Be,e.useSliceRowIdsListener=(e,s,t,l,o)=>ke("Slice"+b,Y(o),t,l,[e,s]),e.useSortedRowIds=Se,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>ke(w,N(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>ke("Start"+te,N(t),e,s),e.useStore=e=>_(e,0),e.useStoreIds=()=>K(1),e.useStoreOrStoreById=N,e.useTable=(e,s)=>Re(a,N(s),0,[e]),e.useTableCellIds=(e,s)=>Re(a+k,N(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>ke(a+k,N(o),s,t,[e],l),e.useTableIds=Le,e.useTableIdsListener=(e,s,t,l)=>ke(I,N(l),e,s,ce,t),e.useTableListener=(e,s,t,l,o)=>ke(a,N(o),s,t,[e],l),e.useTables=e=>Re(c,N(e),0),e.useTablesListener=(e,s,t,l)=>ke(c,N(l),e,s,ce,t),e.useUndoInformation=e=>{var s;const t=ee(e),[o,r]=Ae(t);return[(u=o,!(0==T(u))),Ue(t),r,null!=(s=L(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=xe,e.useValueIds=Pe,e.useValueIdsListener=(e,s,t,l)=>ke(g,N(l),e,s,ce,t),e.useValueListener=(e,s,t,l,o)=>ke(v,N(o),s,t,[e],l),e.useValues=e=>Re(y,N(e),0),e.useValuesListener=(e,s,t,l)=>ke(y,N(l),e,s,ce,t),e.useWillFinishTransactionListener=(e,s,t)=>ke("WillFinish"+te,N(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
1
+ var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",i="Has",d="Ids",a="Table",c=a+"s",I=a+d,p="Row",C=p+"Count",b=p+d,w="Sorted"+p+d,R="Cell",k=R+d,v="Value",y=v+"s",g=v+d,h=globalThis,m=e=>null==e,L=(e,s,t)=>m(e)?null==t?void 0:t():s(e),f=e=>t(e)==o,S=e=>t(e)==r,T=e=>e.length,V=()=>{},P=(e,s)=>e.every(s),x=(e,s)=>T(e)===T(s)&&P(e,((e,t)=>s[t]===e)),O=(e,s)=>e.map(s),q=(e,s,t)=>e.with(s,t),B=Object,M=e=>B.getPrototypeOf(e),H=B.entries,D=e=>!m(e)&&L(M(e),(e=>e==B.prototype||m(M(e))),(()=>!0)),j=B.keys,F=(e,s)=>L(e,(e=>e[s])),Q=(e,s)=>s in e,E=(e,s)=>{const t=H(e);return T(t)===T(j(s))&&P(t,(([e,t])=>D(t)?!!D(s[e])&&E(s[e],t):s[e]===t))},{createContext:A,useContext:G,useEffect:U}=s,W=(J=()=>A([]),Q(z=h,_="tinybase_uirc")||(z[_]=J()),z[_]);var z,_,J;const K=(e,s)=>{var t;const l=G(W);return m(e)?l[s]:f(e)?F(null!=(t=l[s+1])?t:{},e):e},N=(e,s)=>{const t=K(e,s);return m(e)||f(e)?t:e},X=(e,s,t)=>{const{12:l,13:o}=G(W);U((()=>(null==l||l(t,e,s),()=>null==o?void 0:o(t,e))),[l,e,s,t,o])},Y=e=>{var s;return j(null!=(s=G(W)[e])?s:{})},Z=e=>N(e,0),$=e=>N(e,2),ee=e=>N(e,4),se=e=>N(e,6),te=e=>N(e,8),le=e=>N(e,10),oe=e=>e.toLowerCase();oe(u);const re="Transaction";oe(re);var ue=(e,s,t)=>new Promise(((l,o)=>{var r=e=>{try{n(t.next(e))}catch(e){o(e)}},u=e=>{try{n(t.throw(e))}catch(e){o(e)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,u);n((t=t.apply(e,s)).next())}));const{useCallback:ne,useEffect:ie,useMemo:de,useLayoutEffect:ae,useRef:ce,useState:Ie,useSyncExternalStore:pe}=s,Ce=[],be=[{},[],[Ce,void 0,Ce],void 0,!1,0],we=[E,x,([e,s,t],[l,o,r])=>s===o&&x(e,l)&&x(t,r)],Re=(e,s)=>e===s,ke=(e,s,t=Ce)=>{const[,l]=Ie(),[o,r]=Ie();return ie((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},ve=(e,s,...t)=>{var l;const o=null==(l=null==e?void 0:e["add"+s+u])?void 0:l.call(e,...t);return()=>null==e?void 0:e.delListener(o)},ye=(e,s,t,o=Ce)=>{const r=ce(be[t]),u=ne((()=>{var l,u,n;const i=null!=(u=null==(l=null==s?void 0:s[(4==t?"has":"get")+e])?void 0:l.call(s,...o))?u:be[t];return(null!=(n=we[t])?n:Re)(i,r.current)?r.current:r.current=i}),[s,t,e,...o]),n=ne((r=>ve(s,(4==t?i:l)+e,...o,r)),[s,t,e,...o]);return pe(n,u)},ge=(e,s,t,l=Ce,o=Ce,...r)=>ae((()=>ve(s,e,...o,t,...r)),[s,e,...o,...l,...r]),he=(e,s,t,l=Ce,o=V,r=Ce,...u)=>{const n=Z(e);return ne((e=>L(n,(l=>L(t(e,l),(t=>o(l["set"+s](...me(u,l,e),t),t)))))),[n,s,...l,...r,...Le(u)])},me=(e,s,t)=>O(e,(e=>S(e)?e(t,s):e)),Le=e=>{return s=e=>!S(e),e.filter(s);var s},fe=(e,s,t=V,l=Ce,...o)=>{const r=Z(e);return ne((e=>t(null==r?void 0:r["del"+s](...me(o,r,e)))),[r,s,...l,...Le(o)])},Se=(e,s,t)=>{const l=le(e);return ne((()=>null==l?void 0:l[s](t)),[l,s,t])},Te=e=>ye(I,Z(e),1),Ve=(e,s)=>ye(b,Z(s),1,[e]),Pe=(e,s,t,l=0,o,r)=>ye(w,Z(r),1,[e,s,t,l,o]),xe=(e,s,t)=>ye(k,Z(t),1,[e,s]),Oe=(e,s,t,l)=>ye(R,Z(l),3,[e,s,t]),qe=e=>ye(g,Z(e),1),Be=(e,s)=>ye(v,Z(s),3,[e]),Me=(e,s)=>ye("Metric",$(s),3,[e]),He=(e,s)=>ye("SliceIds",ee(s),1,[e]),De=(e,s,t)=>ye("Slice"+b,ee(t),1,[e,s]),je=(e,s,t)=>ye("RemoteRowId",se(t),3,[e,s]),Fe=(e,s,t)=>ye("Local"+b,se(t),1,[e,s]),Qe=(e,s,t)=>ye("Linked"+b,se(t),1,[e,s]),Ee=(e,s)=>ye(n+b,te(s),1,[e]),Ae=(e,s,t,l=0,o,r)=>ye(n+w,te(r),1,[e,s,t,l,o]),Ge=(e,s,t)=>ye(n+k,te(t),1,[e,s]),Ue=(e,s,t,l)=>ye(n+R,te(l),3,[e,s,t]),We=e=>ye("CheckpointIds",le(e),2),ze=(e,s)=>ye("Checkpoint",le(s),3,[e]),_e=e=>Se(e,"goBackward"),Je=e=>Se(e,"goForward"),{PureComponent:Ke,Fragment:Ne,createElement:Xe,useCallback:Ye,useLayoutEffect:Ze,useRef:$e,useState:es}=s,ss=(e,...s)=>m(e)?{}:e(...s),ts=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var ls=Object.defineProperty,os=Object.defineProperties,rs=Object.getOwnPropertyDescriptors,us=Object.getOwnPropertySymbols,ns=Object.prototype.hasOwnProperty,is=Object.prototype.propertyIsEnumerable,ds=(e,s,t)=>s in e?ls(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,as=(e,s)=>{for(var t in s||(s={}))ns.call(s,t)&&ds(e,t,s[t]);if(us)for(var t of us(s))is.call(s,t)&&ds(e,t,s[t]);return e},cs=(e,s)=>os(e,rs(s)),Is=(e,s)=>{var t={};for(var l in e)ns.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&us)for(var l of us(e))s.indexOf(l)<0&&is.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:ps,useContext:Cs,useMemo:bs,useState:ws}=s,Rs=({tableId:e,store:s,rowComponent:t=ms,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>gs(O(n,(r=>Xe(t,cs(as({},ss(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),ks=({queryId:e,queries:s,resultRowComponent:t=Vs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>gs(O(u,(o=>Xe(t,cs(as({},ss(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),vs=({relationshipId:e,relationships:s,rowComponent:t=ms,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[i,d,a]=ts(se(s),e),c=u(e,n,i);return gs(O(c,(e=>Xe(t,cs(as({},ss(l,e)),{key:e,tableId:a,rowId:e,store:d,debugIds:r})))),o,r,n)},ys=e=>({checkpoints:s,checkpointComponent:t=Ps,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=le(s);return gs(O(e(We(u)),(e=>Xe(t,cs(as({},ss(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},gs=(e,s,t,l)=>{const o=m(s)||!Array.isArray(e)?e:O(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},hs=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return gs(l+(null!=(u=Oe(e,s,t,o))?u:l),void 0,r,t)},ms=({tableId:e,rowId:s,store:t,cellComponent:l=hs,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>gs(O(((e,s,t,l)=>{const o=xe(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Xe(l,cs(as({},ss(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Ls=e=>Rs(e,Ve(e.tableId,e.store)),fs=({valueId:e,store:s,debugIds:t})=>{var o;return gs(l+(null!=(o=Be(e,s))?o:l),void 0,t,e)},Ss=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ms,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,i,d]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(ee(t),e),a=De(e,s,n);return gs(O(a,(e=>Xe(l,cs(as({},ss(o,e)),{key:e,tableId:d,rowId:e,store:i,debugIds:u})))),r,u,s)},Ts=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return gs(l+(null!=(u=Ue(e,s,t,o))?u:l),void 0,r,t)},Vs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=Ts,getResultCellComponentProps:o,separator:r,debugIds:u})=>gs(O(Ge(e,s,t),(r=>Xe(l,cs(as({},ss(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ps=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return gs(null!=(o=ze(s,e))?o:l,void 0,t,s)},xs=ys((e=>e[0])),Os=ys((e=>m(e[1])?[]:[e[1]])),qs=ys((e=>e[2]));e.BackwardCheckpointsView=xs,e.CellView=hs,e.CheckpointView=Ps,e.CurrentCheckpointView=Os,e.ForwardCheckpointsView=qs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ss,getSliceComponentProps:l,separator:o,debugIds:r})=>gs(O(He(e,s),(o=>Xe(t,cs(as({},ss(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>vs(e,Qe,e.firstRowId),e.LocalRowsView=e=>vs(e,Fe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return gs(null!=(o=Me(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:i,queriesById:d,checkpoints:a,checkpointsById:c,children:I})=>{const p=Cs(W),[C,b]=ws([{},{},{},{},{},{}]),w=ps(((e,s,t)=>b((l=>F(l[e],s)==t?l:q(l,e,cs(as({},l[e]),{[s]:t}))))),[]),R=ps(((e,s)=>b((t=>Q(t[e],s)?q(t,e,((e,s)=>(delete e[s],e))(t[e],s)):t))),[]);return Xe(W.Provider,{value:bs((()=>[null!=e?e:p[0],as(as(as({},p[1]),s),C[0]),null!=t?t:p[2],as(as(as({},p[3]),l),C[1]),null!=o?o:p[4],as(as(as({},p[5]),r),C[2]),null!=u?u:p[6],as(as(as({},p[7]),n),C[3]),null!=i?i:p[8],as(as(as({},p[9]),d),C[4]),null!=a?a:p[10],as(as(as({},p[11]),c),C[5]),w,R]),[e,s,C,t,l,o,r,u,n,i,d,a,c,p,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ms,getRowComponentProps:o,debugIds:r})=>{const[u,n,,i]=ts(se(t),e),d=je(e,s,u);return gs(m(i)||m(d)?null:Xe(l,cs(as({},ss(o,d)),{key:d,tableId:i,rowId:d,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ts,e.ResultRowView=Vs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Is(s,["cellId","descending","offset","limit"]);return ks(u,Ae(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>ks(e,Ee(e.queryId,e.queries)),e.RowView=ms,e.SliceView=Ss,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Is(s,["cellId","descending","offset","limit"]);return Rs(u,Pe(u.tableId,t,l,o,r,u.store))},e.TableView=Ls,e.TablesView=({store:e,tableComponent:s=Ls,getTableComponentProps:t,separator:l,debugIds:o})=>gs(O(Te(e),(l=>Xe(s,cs(as({},ss(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=fs,e.ValuesView=({store:e,valueComponent:s=fs,getValueComponentProps:t,separator:l,debugIds:o})=>gs(O(qe(e),(l=>Xe(s,cs(as({},ss(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=Ce,l,o=V,r=Ce,u=!0)=>{const n=Z(l);return ne((t=>L(n,(l=>L(s(t,l),(s=>o(l.addRow(S(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=Oe,e.useCellIds=xe,e.useCellIdsListener=(e,s,t,l,o,r)=>ge(k,Z(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>ge(R,Z(u),l,o,[e,s,t],r),e.useCheckpoint=ze,e.useCheckpointIds=We,e.useCheckpointIdsListener=(e,s,t)=>ge("CheckpointIds",le(t),e,s),e.useCheckpointListener=(e,s,t,l)=>ge("Checkpoint",le(l),s,t,[e]),e.useCheckpoints=e=>K(e,10),e.useCheckpointsIds=()=>Y(11),e.useCheckpointsOrCheckpointsById=le,e.useCreateCheckpoints=(e,s,t)=>ke(e,s,t),e.useCreateIndexes=(e,s,t)=>ke(e,s,t),e.useCreateMergeableStore=(e,s=Ce)=>de(e,s),e.useCreateMetrics=(e,s,t)=>ke(e,s,t),e.useCreatePersister=(e,s,t=Ce,l,o=Ce,r,u=Ce)=>{const[,n]=Ie(),[i,d]=Ie();return ie((()=>{ue(void 0,null,(function*(){const t=e?yield s(e):void 0;d(t),t&&l&&ue(void 0,null,(function*(){yield l(t),n([])}))}))}),[e,...t,...o]),ie((()=>()=>{i&&(i.destroy(),null==r||r(i))}),[i,...u]),i},e.useCreateQueries=(e,s,t)=>ke(e,s,t),e.useCreateRelationships=(e,s,t)=>ke(e,s,t),e.useCreateStore=(e,s=Ce)=>de(e,s),e.useCreateSynchronizer=(e,s,t=Ce,l,o=Ce)=>{const[r,u]=Ie();return ie((()=>{ue(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),ie((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>fe(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>fe(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>fe(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>fe(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>fe(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>fe(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>ge("DidFinish"+re,Z(t),e,s),e.useGoBackwardCallback=_e,e.useGoForwardCallback=Je,e.useGoToCallback=(e,s=Ce,t,l=V,o=Ce)=>{const r=le(t);return ne((s=>L(r,(t=>L(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>ye(R,Z(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>ge(i+R,Z(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>ye(p,Z(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>ge(i+p,Z(r),t,l,[e,s],o),e.useHasTable=(e,s)=>ye(a,Z(s),4,[e]),e.useHasTableCell=(e,s,t)=>ye(a+R,Z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>ge(i+a+R,Z(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>ge(i+a,Z(o),s,t,[e],l),e.useHasTables=e=>ye(c,Z(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>ge(i+c,Z(l),e,s,[],t),e.useHasValue=(e,s)=>ye(v,Z(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>ge(i+v,Z(o),s,t,[e],l),e.useHasValues=e=>ye(y,Z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>ge(i+y,Z(l),e,s,[],t),e.useIndexIds=e=>ye("IndexIds",ee(e),1),e.useIndexes=e=>K(e,4),e.useIndexesIds=()=>Y(5),e.useIndexesOrIndexesById=ee,e.useLinkedRowIds=Qe,e.useLinkedRowIdsListener=(e,s,t,l,o)=>ge("Linked"+b,se(o),t,l,[e,s]),e.useLocalRowIds=Fe,e.useLocalRowIdsListener=(e,s,t,l,o)=>ge("Local"+b,se(o),t,l,[e,s]),e.useMetric=Me,e.useMetricIds=e=>ye("MetricIds",$(e),1),e.useMetricListener=(e,s,t,l)=>ge("Metric",$(l),s,t,[e]),e.useMetrics=e=>K(e,2),e.useMetricsIds=()=>Y(3),e.useMetricsOrMetricsById=$,e.useProvideCheckpoints=(e,s)=>X(e,s,5),e.useProvideIndexes=(e,s)=>X(e,s,2),e.useProvideMetrics=(e,s)=>X(e,s,1),e.useProvideQueries=(e,s)=>X(e,s,4),e.useProvideRelationships=(e,s)=>X(e,s,3),e.useProvideStore=(e,s)=>X(e,s,0),e.useQueries=e=>K(e,8),e.useQueriesIds=()=>Y(9),e.useQueriesOrQueriesById=te,e.useQueryIds=e=>ye("QueryIds",te(e),1),e.useRedoInformation=e=>{var s;const t=le(e),[,,[o]]=We(t);return[!m(o),Je(t),o,null!=(s=L(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>ye("RelationshipIds",se(e),1),e.useRelationships=e=>K(e,6),e.useRelationshipsIds=()=>Y(7),e.useRelationshipsOrRelationshipsById=se,e.useRemoteRowId=je,e.useRemoteRowIdListener=(e,s,t,l,o)=>ge("RemoteRowId",se(o),t,l,[e,s]),e.useResultCell=Ue,e.useResultCellIds=Ge,e.useResultCellIdsListener=(e,s,t,l,o)=>ge(n+k,te(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>ge(n+R,te(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>ye(n+p,te(t),0,[e,s]),e.useResultRowCount=(e,s)=>ye(n+C,te(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>ge(n+C,te(l),s,t,[e]),e.useResultRowIds=Ee,e.useResultRowIdsListener=(e,s,t,l)=>ge(n+b,te(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>ge(n+p,te(o),t,l,[e,s]),e.useResultSortedRowIds=Ae,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,i)=>ge(n+w,te(i),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>ye(n+a,te(s),0,[e]),e.useResultTableCellIds=(e,s)=>ye(n+a+k,te(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>ge(n+a+k,te(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>ge(n+a,te(l),s,t,[e]),e.useRow=(e,s,t)=>ye(p,Z(t),0,[e,s]),e.useRowCount=(e,s)=>ye(C,Z(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>ge(C,Z(o),s,t,[e],l),e.useRowIds=Ve,e.useRowIdsListener=(e,s,t,l,o)=>ge(b,Z(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>ge(p,Z(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>he(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=V,s=Ce,t,l=V,o=Ce)=>{const r=le(t);return ne((s=>L(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>he(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>he(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>he(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>he(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>he(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>he(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>he(t,y,e,s,l,o),e.useSliceIds=He,e.useSliceIdsListener=(e,s,t,l)=>ge("SliceIds",ee(l),s,t,[e]),e.useSliceRowIds=De,e.useSliceRowIdsListener=(e,s,t,l,o)=>ge("Slice"+b,ee(o),t,l,[e,s]),e.useSortedRowIds=Pe,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,i)=>ge(w,Z(i),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>ge("Start"+re,Z(t),e,s),e.useStore=e=>K(e,0),e.useStoreIds=()=>Y(1),e.useStoreOrStoreById=Z,e.useTable=(e,s)=>ye(a,Z(s),0,[e]),e.useTableCellIds=(e,s)=>ye(a+k,Z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>ge(a+k,Z(o),s,t,[e],l),e.useTableIds=Te,e.useTableIdsListener=(e,s,t,l)=>ge(I,Z(l),e,s,Ce,t),e.useTableListener=(e,s,t,l,o)=>ge(a,Z(o),s,t,[e],l),e.useTables=e=>ye(c,Z(e),0),e.useTablesListener=(e,s,t,l)=>ge(c,Z(l),e,s,Ce,t),e.useUndoInformation=e=>{var s;const t=le(e),[o,r]=We(t);return[(u=o,!(0==T(u))),_e(t),r,null!=(s=L(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Be,e.useValueIds=qe,e.useValueIdsListener=(e,s,t,l)=>ge(g,Z(l),e,s,Ce,t),e.useValueListener=(e,s,t,l,o)=>ge(v,Z(o),s,t,[e],l),e.useValues=e=>ye(y,Z(e),0),e.useValuesListener=(e,s,t,l)=>ge(y,Z(l),e,s,Ce,t),e.useWillFinishTransactionListener=(e,s,t)=>ge("WillFinish"+re,Z(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);