tinybase 5.2.1 → 5.2.3

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 (75) hide show
  1. package/cjs/es6/min/ui-react/index.cjs +1 -1
  2. package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
  3. package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
  4. package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
  5. package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
  6. package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
  7. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  8. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  9. package/cjs/es6/ui-react/index.cjs +10 -1
  10. package/cjs/es6/ui-react/with-schemas/index.cjs +10 -1
  11. package/cjs/es6/ui-react-inspector/index.cjs +1 -1
  12. package/cjs/es6/ui-react-inspector/with-schemas/index.cjs +1 -1
  13. package/cjs/min/ui-react/index.cjs +1 -1
  14. package/cjs/min/ui-react/index.cjs.gz +0 -0
  15. package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
  16. package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
  17. package/cjs/min/ui-react-inspector/index.cjs +1 -1
  18. package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
  19. package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  20. package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  21. package/cjs/ui-react/index.cjs +10 -1
  22. package/cjs/ui-react/with-schemas/index.cjs +10 -1
  23. package/cjs/ui-react-inspector/index.cjs +1 -1
  24. package/cjs/ui-react-inspector/with-schemas/index.cjs +1 -1
  25. package/es6/min/ui-react/index.js +1 -1
  26. package/es6/min/ui-react/index.js.gz +0 -0
  27. package/es6/min/ui-react/with-schemas/index.js +1 -1
  28. package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  29. package/es6/min/ui-react-inspector/index.js +1 -1
  30. package/es6/min/ui-react-inspector/index.js.gz +0 -0
  31. package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  32. package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  33. package/es6/ui-react/index.js +10 -1
  34. package/es6/ui-react/with-schemas/index.js +10 -1
  35. package/es6/ui-react-inspector/index.js +1 -1
  36. package/es6/ui-react-inspector/with-schemas/index.js +1 -1
  37. package/min/ui-react/index.js +1 -1
  38. package/min/ui-react/index.js.gz +0 -0
  39. package/min/ui-react/with-schemas/index.js +1 -1
  40. package/min/ui-react/with-schemas/index.js.gz +0 -0
  41. package/min/ui-react-inspector/index.js +1 -1
  42. package/min/ui-react-inspector/index.js.gz +0 -0
  43. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  44. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  45. package/package.json +1 -1
  46. package/readme.md +13 -13
  47. package/releases.md +23 -23
  48. package/ui-react/index.js +10 -1
  49. package/ui-react/with-schemas/index.js +10 -1
  50. package/ui-react-inspector/index.js +1 -1
  51. package/ui-react-inspector/with-schemas/index.js +1 -1
  52. package/umd/es6/min/ui-react/index.js +1 -1
  53. package/umd/es6/min/ui-react/index.js.gz +0 -0
  54. package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
  55. package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  56. package/umd/es6/min/ui-react-inspector/index.js +1 -1
  57. package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
  58. package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  59. package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  60. package/umd/es6/ui-react/index.js +12 -1
  61. package/umd/es6/ui-react/with-schemas/index.js +12 -1
  62. package/umd/es6/ui-react-inspector/index.js +2 -1
  63. package/umd/es6/ui-react-inspector/with-schemas/index.js +2 -1
  64. package/umd/min/ui-react/index.js +1 -1
  65. package/umd/min/ui-react/index.js.gz +0 -0
  66. package/umd/min/ui-react/with-schemas/index.js +1 -1
  67. package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
  68. package/umd/min/ui-react-inspector/index.js +1 -1
  69. package/umd/min/ui-react-inspector/index.js.gz +0 -0
  70. package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
  71. package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  72. package/umd/ui-react/index.js +12 -1
  73. package/umd/ui-react/with-schemas/index.js +12 -1
  74. package/umd/ui-react-inspector/index.js +2 -1
  75. package/umd/ui-react-inspector/with-schemas/index.js +2 -1
package/ui-react/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  const getTypeOf = (thing) => typeof thing;
4
+ const TINYBASE = 'tinybase';
4
5
  const EMPTY_STRING = '';
5
6
  const STRING = getTypeOf(EMPTY_STRING);
6
7
  const FUNCTION = getTypeOf(getTypeOf);
@@ -24,6 +25,7 @@ const VALUE = 'Value';
24
25
  const VALUES = VALUE + 's';
25
26
  const VALUE_IDS = VALUE + IDS;
26
27
 
28
+ const GLOBAL = globalThis;
27
29
  const isUndefined = (thing) => thing == void 0;
28
30
  const ifNotUndefined = (value, then, otherwise) =>
29
31
  isUndefined(value) ? otherwise?.() : then(value);
@@ -57,6 +59,7 @@ const isObject = (obj) =>
57
59
  );
58
60
  const objIds = object.keys;
59
61
  const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
62
+ const objHas = (obj, id) => id in obj;
60
63
  const objDel = (obj, id) => {
61
64
  delete obj[id];
62
65
  return obj;
@@ -75,9 +78,15 @@ const objIsEqual = (obj1, obj2) => {
75
78
  )
76
79
  );
77
80
  };
81
+ const objEnsure = (obj, id, getDefaultValue) => {
82
+ if (!objHas(obj, id)) {
83
+ obj[id] = getDefaultValue();
84
+ }
85
+ return obj[id];
86
+ };
78
87
 
79
88
  const {createContext, useContext: useContext$1, useEffect: useEffect$1} = React;
80
- const Context = createContext([]);
89
+ const Context = objEnsure(GLOBAL, TINYBASE + '_uirc', () => createContext([]));
81
90
  const useThing = (id, offset) => {
82
91
  const contextValue = useContext$1(Context);
83
92
  return isUndefined(id)
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  const getTypeOf = (thing) => typeof thing;
4
+ const TINYBASE = 'tinybase';
4
5
  const EMPTY_STRING = '';
5
6
  const STRING = getTypeOf(EMPTY_STRING);
6
7
  const FUNCTION = getTypeOf(getTypeOf);
@@ -24,6 +25,7 @@ const VALUE = 'Value';
24
25
  const VALUES = VALUE + 's';
25
26
  const VALUE_IDS = VALUE + IDS;
26
27
 
28
+ const GLOBAL = globalThis;
27
29
  const isUndefined = (thing) => thing == void 0;
28
30
  const ifNotUndefined = (value, then, otherwise) =>
29
31
  isUndefined(value) ? otherwise?.() : then(value);
@@ -57,6 +59,7 @@ const isObject = (obj) =>
57
59
  );
58
60
  const objIds = object.keys;
59
61
  const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
62
+ const objHas = (obj, id) => id in obj;
60
63
  const objDel = (obj, id) => {
61
64
  delete obj[id];
62
65
  return obj;
@@ -75,9 +78,15 @@ const objIsEqual = (obj1, obj2) => {
75
78
  )
76
79
  );
77
80
  };
81
+ const objEnsure = (obj, id, getDefaultValue) => {
82
+ if (!objHas(obj, id)) {
83
+ obj[id] = getDefaultValue();
84
+ }
85
+ return obj[id];
86
+ };
78
87
 
79
88
  const {createContext, useContext: useContext$1, useEffect: useEffect$1} = React;
80
- const Context = createContext([]);
89
+ const Context = objEnsure(GLOBAL, TINYBASE + '_uirc', () => createContext([]));
81
90
  const useThing = (id, offset) => {
82
91
  const contextValue = useContext$1(Context);
83
92
  return isUndefined(id)
@@ -197,7 +197,7 @@ const POSITION_VALUE = 'position';
197
197
  const OPEN_VALUE = OPEN_CELL;
198
198
  const EDITABLE_CELL = 'editable';
199
199
  const getUniqueId = (...args) => jsonStringWithMap(args);
200
- const sortedIdsMap = (ids, callback) => arrayMap(arraySort(ids), callback);
200
+ const sortedIdsMap = (ids, callback) => arrayMap(arraySort([...ids]), callback);
201
201
  const useEditable = (uniqueId, s) => [
202
202
  !!useCell(STATE_TABLE, uniqueId, EDITABLE_CELL, s),
203
203
  useCallback$1(
@@ -197,7 +197,7 @@ const POSITION_VALUE = 'position';
197
197
  const OPEN_VALUE = OPEN_CELL;
198
198
  const EDITABLE_CELL = 'editable';
199
199
  const getUniqueId = (...args) => jsonStringWithMap(args);
200
- const sortedIdsMap = (ids, callback) => arrayMap(arraySort(ids), callback);
200
+ const sortedIdsMap = (ids, callback) => arrayMap(arraySort([...ids]), callback);
201
201
  const useEditable = (uniqueId, s) => [
202
202
  !!useCell(STATE_TABLE, uniqueId, EDITABLE_CELL, s),
203
203
  useCallback$1(
@@ -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=e=>null==e,m=(e,s,t)=>h(e)?null==t?void 0:t():s(e),L=e=>t(e)==o,f=e=>t(e)==r,S=e=>e.length,T=()=>{},V=(e,s)=>e.every(s),P=(e,s)=>S(e)===S(s)&&V(e,((e,t)=>s[t]===e)),x=(e,s)=>e.map(s),O=Object,q=e=>O.getPrototypeOf(e),B=O.entries,H=e=>!h(e)&&m(q(e),(e=>e==O.prototype||h(q(e))),(()=>!0)),M=O.keys,D=(e,s)=>m(e,(e=>e[s])),j=(e,s)=>{const t=B(e);return S(t)===S(M(s))&&V(t,(([e,t])=>H(t)?!!H(s[e])&&j(s[e],t):s[e]===t))},{createContext:F,useContext:E,useEffect:Q}=s,A=F([]),G=(e,s)=>{var t;const l=E(A);return h(e)?l[s]:L(e)?D(null!=(t=l[s+1])?t:{},e):e},U=(e,s)=>{const t=G(e,s);return h(e)||L(e)?t:e},W=e=>{var s;return M(null!=(s=E(A)[e])?s:{})},z=e=>U(e,0),J=e=>U(e,2),K=e=>U(e,4),N=e=>U(e,6),X=e=>U(e,8),Y=e=>U(e,10),Z=e=>e.toLowerCase();Z(u);const $="Transaction";Z($);var _=(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:ee,useEffect:se,useMemo:te,useLayoutEffect:le,useRef:oe,useState:re,useSyncExternalStore:ue}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ie=[j,P,([e,s,t],[l,o,r])=>s===o&&P(e,l)&&P(t,r)],ae=(e,s)=>e===s,ce=(e,s,t=ne)=>{const[,l]=re(),[o,r]=re();return se((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},Ie=(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)},pe=(e,s,t,o=ne)=>{const r=oe(de[t]),u=ee((()=>{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:de[t];return(null!=(n=ie[t])?n:ae)(d,r.current)?r.current:r.current=d}),[s,t,e,...o]),n=ee((r=>Ie(s,(4==t?d:l)+e,...o,r)),[s,t,e,...o]);return ue(n,u)},Ce=(e,s,t,l=ne,o=ne,...r)=>le((()=>Ie(s,e,...o,t,...r)),[s,e,...o,...l,...r]),be=(e,s,t,l=ne,o=T,r=ne,...u)=>{const n=z(e);return ee((e=>m(n,(l=>m(t(e,l),(t=>o(l["set"+s](...we(u,l,e),t),t)))))),[n,s,...l,...r,...Re(u)])},we=(e,s,t)=>x(e,(e=>f(e)?e(t,s):e)),Re=e=>{return s=e=>!f(e),e.filter(s);var s},ke=(e,s,t=T,l=ne,...o)=>{const r=z(e);return ee((e=>t(null==r?void 0:r["del"+s](...we(o,r,e)))),[r,s,...l,...Re(o)])},ve=(e,s,t)=>{const l=Y(e);return ee((()=>null==l?void 0:l[s](t)),[l,s,t])},ye=e=>pe(I,z(e),1),ge=(e,s)=>pe(b,z(s),1,[e]),he=(e,s,t,l=0,o,r)=>pe(w,z(r),1,[e,s,t,l,o]),me=(e,s,t)=>pe(k,z(t),1,[e,s]),Le=(e,s,t,l)=>pe(R,z(l),3,[e,s,t]),fe=e=>pe(g,z(e),1),Se=(e,s)=>pe(v,z(s),3,[e]),Te=(e,s)=>pe("Metric",J(s),3,[e]),Ve=(e,s)=>pe("SliceIds",K(s),1,[e]),Pe=(e,s,t)=>pe("Slice"+b,K(t),1,[e,s]),xe=(e,s,t)=>pe("RemoteRowId",N(t),3,[e,s]),Oe=(e,s,t)=>pe("Local"+b,N(t),1,[e,s]),qe=(e,s,t)=>pe("Linked"+b,N(t),1,[e,s]),Be=(e,s)=>pe(n+b,X(s),1,[e]),He=(e,s,t,l=0,o,r)=>pe(n+w,X(r),1,[e,s,t,l,o]),Me=(e,s,t)=>pe(n+k,X(t),1,[e,s]),De=(e,s,t,l)=>pe(n+R,X(l),3,[e,s,t]),je=e=>pe("CheckpointIds",Y(e),2),Fe=(e,s)=>pe("Checkpoint",Y(s),3,[e]),Ee=e=>ve(e,"goBackward"),Qe=e=>ve(e,"goForward"),{PureComponent:Ae,Fragment:Ge,createElement:Ue,useCallback:We,useLayoutEffect:ze,useRef:Je,useState:Ke}=s,Ne=(e,...s)=>h(e)?{}:e(...s),Xe=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ye=Object.defineProperty,Ze=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,_e=Object.getOwnPropertySymbols,es=Object.prototype.hasOwnProperty,ss=Object.prototype.propertyIsEnumerable,ts=(e,s,t)=>s in e?Ye(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ls=(e,s)=>{for(var t in s||(s={}))es.call(s,t)&&ts(e,t,s[t]);if(_e)for(var t of _e(s))ss.call(s,t)&&ts(e,t,s[t]);return e},os=(e,s)=>Ze(e,$e(s)),rs=(e,s)=>{var t={};for(var l in e)es.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&_e)for(var l of _e(e))s.indexOf(l)<0&&ss.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:us,useContext:ns,useMemo:ds,useState:is}=s,as=({tableId:e,store:s,rowComponent:t=ws,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>Cs(x(n,(r=>Ue(t,os(ls({},Ne(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),cs=({queryId:e,queries:s,resultRowComponent:t=gs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Cs(x(u,(o=>Ue(t,os(ls({},Ne(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),Is=({relationshipId:e,relationships:s,rowComponent:t=ws,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=Xe(N(s),e),c=u(e,n,d);return Cs(x(c,(e=>Ue(t,os(ls({},Ne(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},ps=e=>({checkpoints:s,checkpointComponent:t=hs,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=Y(s);return Cs(x(e(je(u)),(e=>Ue(t,os(ls({},Ne(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Cs=(e,s,t,l)=>{const o=h(s)||!Array.isArray(e)?e:x(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},bs=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return Cs(l+(null!=(u=Le(e,s,t,o))?u:l),void 0,r,t)},ws=({tableId:e,rowId:s,store:t,cellComponent:l=bs,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>Cs(x(((e,s,t,l)=>{const o=me(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Ue(l,os(ls({},Ne(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Rs=e=>as(e,ge(e.tableId,e.store)),ks=({valueId:e,store:s,debugIds:t})=>{var o;return Cs(l+(null!=(o=Se(e,s))?o:l),void 0,t,e)},vs=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ws,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)])(K(t),e),a=Pe(e,s,n);return Cs(x(a,(e=>Ue(l,os(ls({},Ne(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ys=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Cs(l+(null!=(u=De(e,s,t,o))?u:l),void 0,r,t)},gs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ys,getResultCellComponentProps:o,separator:r,debugIds:u})=>Cs(x(Me(e,s,t),(r=>Ue(l,os(ls({},Ne(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),hs=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return Cs(null!=(o=Fe(s,e))?o:l,void 0,t,s)},ms=ps((e=>e[0])),Ls=ps((e=>h(e[1])?[]:[e[1]])),fs=ps((e=>e[2]));e.BackwardCheckpointsView=ms,e.CellView=bs,e.CheckpointView=hs,e.CurrentCheckpointView=Ls,e.ForwardCheckpointsView=fs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=vs,getSliceComponentProps:l,separator:o,debugIds:r})=>Cs(x(Ve(e,s),(o=>Ue(t,os(ls({},Ne(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>Is(e,qe,e.firstRowId),e.LocalRowsView=e=>Is(e,Oe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Cs(null!=(o=Te(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=ns(A),[C,b]=is({}),w=us(((e,s)=>b((t=>D(t,e)==s?t:os(ls({},t),{[e]:s})))),[]),R=us((e=>b((s=>ls({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Ue(A.Provider,{value:ds((()=>[null!=e?e:p[0],ls(ls(ls({},p[1]),s),C),null!=t?t:p[2],ls(ls({},p[3]),l),null!=o?o:p[4],ls(ls({},p[5]),r),null!=u?u:p[6],ls(ls({},p[7]),n),null!=d?d:p[8],ls(ls({},p[9]),i),null!=a?a:p[10],ls(ls({},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=ws,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=Xe(N(t),e),i=xe(e,s,u);return Cs(h(d)||h(i)?null:Ue(l,os(ls({},Ne(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ys,e.ResultRowView=gs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=rs(s,["cellId","descending","offset","limit"]);return cs(u,He(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>cs(e,Be(e.queryId,e.queries)),e.RowView=ws,e.SliceView=vs,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=rs(s,["cellId","descending","offset","limit"]);return as(u,he(u.tableId,t,l,o,r,u.store))},e.TableView=Rs,e.TablesView=({store:e,tableComponent:s=Rs,getTableComponentProps:t,separator:l,debugIds:o})=>Cs(x(ye(e),(l=>Ue(s,os(ls({},Ne(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=ks,e.ValuesView=({store:e,valueComponent:s=ks,getValueComponentProps:t,separator:l,debugIds:o})=>Cs(x(fe(e),(l=>Ue(s,os(ls({},Ne(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=ne,l,o=T,r=ne,u=!0)=>{const n=z(l);return ee((t=>m(n,(l=>m(s(t,l),(s=>o(l.addRow(f(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=Le,e.useCellIds=me,e.useCellIdsListener=(e,s,t,l,o,r)=>Ce(k,z(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>Ce(R,z(u),l,o,[e,s,t],r),e.useCheckpoint=Fe,e.useCheckpointIds=je,e.useCheckpointIdsListener=(e,s,t)=>Ce("CheckpointIds",Y(t),e,s),e.useCheckpointListener=(e,s,t,l)=>Ce("Checkpoint",Y(l),s,t,[e]),e.useCheckpoints=e=>G(e,10),e.useCheckpointsIds=()=>W(11),e.useCheckpointsOrCheckpointsById=Y,e.useCreateCheckpoints=(e,s,t)=>ce(e,s,t),e.useCreateIndexes=(e,s,t)=>ce(e,s,t),e.useCreateMergeableStore=(e,s=ne)=>te(e,s),e.useCreateMetrics=(e,s,t)=>ce(e,s,t),e.useCreatePersister=(e,s,t=ne,l,o=ne,r,u=ne)=>{const[,n]=re(),[d,i]=re();return se((()=>{_(void 0,null,(function*(){const t=e?yield s(e):void 0;i(t),t&&l&&_(void 0,null,(function*(){yield l(t),n([])}))}))}),[e,...t,...o]),se((()=>()=>{d&&(d.destroy(),null==r||r(d))}),[d,...u]),d},e.useCreateQueries=(e,s,t)=>ce(e,s,t),e.useCreateRelationships=(e,s,t)=>ce(e,s,t),e.useCreateStore=(e,s=ne)=>te(e,s),e.useCreateSynchronizer=(e,s,t=ne,l,o=ne)=>{const[r,u]=re();return se((()=>{_(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),se((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>ke(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>ke(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>ke(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>ke(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>ke(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>ke(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>Ce("DidFinish"+$,z(t),e,s),e.useGoBackwardCallback=Ee,e.useGoForwardCallback=Qe,e.useGoToCallback=(e,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>m(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>pe(R,z(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>Ce(d+R,z(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>pe(p,z(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>Ce(d+p,z(r),t,l,[e,s],o),e.useHasTable=(e,s)=>pe(a,z(s),4,[e]),e.useHasTableCell=(e,s,t)=>pe(a+R,z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>Ce(d+a+R,z(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>Ce(d+a,z(o),s,t,[e],l),e.useHasTables=e=>pe(c,z(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>Ce(d+c,z(l),e,s,[],t),e.useHasValue=(e,s)=>pe(v,z(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>Ce(d+v,z(o),s,t,[e],l),e.useHasValues=e=>pe(y,z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>Ce(d+y,z(l),e,s,[],t),e.useIndexIds=e=>pe("IndexIds",K(e),1),e.useIndexes=e=>G(e,4),e.useIndexesIds=()=>W(5),e.useIndexesOrIndexesById=K,e.useLinkedRowIds=qe,e.useLinkedRowIdsListener=(e,s,t,l,o)=>Ce("Linked"+b,N(o),t,l,[e,s]),e.useLocalRowIds=Oe,e.useLocalRowIdsListener=(e,s,t,l,o)=>Ce("Local"+b,N(o),t,l,[e,s]),e.useMetric=Te,e.useMetricIds=e=>pe("MetricIds",J(e),1),e.useMetricListener=(e,s,t,l)=>Ce("Metric",J(l),s,t,[e]),e.useMetrics=e=>G(e,2),e.useMetricsIds=()=>W(3),e.useMetricsOrMetricsById=J,e.useProvideStore=(e,s)=>{const{12:t,13:l}=E(A);Q((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>G(e,8),e.useQueriesIds=()=>W(9),e.useQueriesOrQueriesById=X,e.useQueryIds=e=>pe("QueryIds",X(e),1),e.useRedoInformation=e=>{var s;const t=Y(e),[,,[o]]=je(t);return[!h(o),Qe(t),o,null!=(s=m(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>pe("RelationshipIds",N(e),1),e.useRelationships=e=>G(e,6),e.useRelationshipsIds=()=>W(7),e.useRelationshipsOrRelationshipsById=N,e.useRemoteRowId=xe,e.useRemoteRowIdListener=(e,s,t,l,o)=>Ce("RemoteRowId",N(o),t,l,[e,s]),e.useResultCell=De,e.useResultCellIds=Me,e.useResultCellIdsListener=(e,s,t,l,o)=>Ce(n+k,X(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>Ce(n+R,X(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>pe(n+p,X(t),0,[e,s]),e.useResultRowCount=(e,s)=>pe(n+C,X(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>Ce(n+C,X(l),s,t,[e]),e.useResultRowIds=Be,e.useResultRowIdsListener=(e,s,t,l)=>Ce(n+b,X(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>Ce(n+p,X(o),t,l,[e,s]),e.useResultSortedRowIds=He,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>Ce(n+w,X(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>pe(n+a,X(s),0,[e]),e.useResultTableCellIds=(e,s)=>pe(n+a+k,X(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>Ce(n+a+k,X(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>Ce(n+a,X(l),s,t,[e]),e.useRow=(e,s,t)=>pe(p,z(t),0,[e,s]),e.useRowCount=(e,s)=>pe(C,z(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>Ce(C,z(o),s,t,[e],l),e.useRowIds=ge,e.useRowIdsListener=(e,s,t,l,o)=>Ce(b,z(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>Ce(p,z(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>be(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=T,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>be(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>be(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>be(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>be(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>be(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>be(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>be(t,y,e,s,l,o),e.useSliceIds=Ve,e.useSliceIdsListener=(e,s,t,l)=>Ce("SliceIds",K(l),s,t,[e]),e.useSliceRowIds=Pe,e.useSliceRowIdsListener=(e,s,t,l,o)=>Ce("Slice"+b,K(o),t,l,[e,s]),e.useSortedRowIds=he,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>Ce(w,z(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>Ce("Start"+$,z(t),e,s),e.useStore=e=>G(e,0),e.useStoreIds=()=>W(1),e.useStoreOrStoreById=z,e.useTable=(e,s)=>pe(a,z(s),0,[e]),e.useTableCellIds=(e,s)=>pe(a+k,z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>Ce(a+k,z(o),s,t,[e],l),e.useTableIds=ye,e.useTableIdsListener=(e,s,t,l)=>Ce(I,z(l),e,s,ne,t),e.useTableListener=(e,s,t,l,o)=>Ce(a,z(o),s,t,[e],l),e.useTables=e=>pe(c,z(e),0),e.useTablesListener=(e,s,t,l)=>Ce(c,z(l),e,s,ne,t),e.useUndoInformation=e=>{var s;const t=Y(e),[o,r]=je(t);return[(u=o,!(0==S(u))),Ee(t),r,null!=(s=m(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Se,e.useValueIds=fe,e.useValueIdsListener=(e,s,t,l)=>Ce(g,z(l),e,s,ne,t),e.useValueListener=(e,s,t,l,o)=>Ce(v,z(o),s,t,[e],l),e.useValues=e=>pe(y,z(e),0),e.useValuesListener=(e,s,t,l)=>Ce(y,z(l),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>Ce("WillFinish"+$,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);
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);
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=e=>null==e,m=(e,s,t)=>h(e)?null==t?void 0:t():s(e),L=e=>t(e)==o,f=e=>t(e)==r,S=e=>e.length,T=()=>{},V=(e,s)=>e.every(s),P=(e,s)=>S(e)===S(s)&&V(e,((e,t)=>s[t]===e)),x=(e,s)=>e.map(s),O=Object,q=e=>O.getPrototypeOf(e),B=O.entries,H=e=>!h(e)&&m(q(e),(e=>e==O.prototype||h(q(e))),(()=>!0)),M=O.keys,D=(e,s)=>m(e,(e=>e[s])),j=(e,s)=>{const t=B(e);return S(t)===S(M(s))&&V(t,(([e,t])=>H(t)?!!H(s[e])&&j(s[e],t):s[e]===t))},{createContext:F,useContext:E,useEffect:Q}=s,A=F([]),G=(e,s)=>{var t;const l=E(A);return h(e)?l[s]:L(e)?D(null!=(t=l[s+1])?t:{},e):e},U=(e,s)=>{const t=G(e,s);return h(e)||L(e)?t:e},W=e=>{var s;return M(null!=(s=E(A)[e])?s:{})},z=e=>U(e,0),J=e=>U(e,2),K=e=>U(e,4),N=e=>U(e,6),X=e=>U(e,8),Y=e=>U(e,10),Z=e=>e.toLowerCase();Z(u);const $="Transaction";Z($);var _=(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:ee,useEffect:se,useMemo:te,useLayoutEffect:le,useRef:oe,useState:re,useSyncExternalStore:ue}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ie=[j,P,([e,s,t],[l,o,r])=>s===o&&P(e,l)&&P(t,r)],ae=(e,s)=>e===s,ce=(e,s,t=ne)=>{const[,l]=re(),[o,r]=re();return se((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},Ie=(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)},pe=(e,s,t,o=ne)=>{const r=oe(de[t]),u=ee((()=>{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:de[t];return(null!=(n=ie[t])?n:ae)(d,r.current)?r.current:r.current=d}),[s,t,e,...o]),n=ee((r=>Ie(s,(4==t?d:l)+e,...o,r)),[s,t,e,...o]);return ue(n,u)},Ce=(e,s,t,l=ne,o=ne,...r)=>le((()=>Ie(s,e,...o,t,...r)),[s,e,...o,...l,...r]),be=(e,s,t,l=ne,o=T,r=ne,...u)=>{const n=z(e);return ee((e=>m(n,(l=>m(t(e,l),(t=>o(l["set"+s](...we(u,l,e),t),t)))))),[n,s,...l,...r,...Re(u)])},we=(e,s,t)=>x(e,(e=>f(e)?e(t,s):e)),Re=e=>{return s=e=>!f(e),e.filter(s);var s},ke=(e,s,t=T,l=ne,...o)=>{const r=z(e);return ee((e=>t(null==r?void 0:r["del"+s](...we(o,r,e)))),[r,s,...l,...Re(o)])},ve=(e,s,t)=>{const l=Y(e);return ee((()=>null==l?void 0:l[s](t)),[l,s,t])},ye=e=>pe(I,z(e),1),ge=(e,s)=>pe(b,z(s),1,[e]),he=(e,s,t,l=0,o,r)=>pe(w,z(r),1,[e,s,t,l,o]),me=(e,s,t)=>pe(k,z(t),1,[e,s]),Le=(e,s,t,l)=>pe(R,z(l),3,[e,s,t]),fe=e=>pe(g,z(e),1),Se=(e,s)=>pe(v,z(s),3,[e]),Te=(e,s)=>pe("Metric",J(s),3,[e]),Ve=(e,s)=>pe("SliceIds",K(s),1,[e]),Pe=(e,s,t)=>pe("Slice"+b,K(t),1,[e,s]),xe=(e,s,t)=>pe("RemoteRowId",N(t),3,[e,s]),Oe=(e,s,t)=>pe("Local"+b,N(t),1,[e,s]),qe=(e,s,t)=>pe("Linked"+b,N(t),1,[e,s]),Be=(e,s)=>pe(n+b,X(s),1,[e]),He=(e,s,t,l=0,o,r)=>pe(n+w,X(r),1,[e,s,t,l,o]),Me=(e,s,t)=>pe(n+k,X(t),1,[e,s]),De=(e,s,t,l)=>pe(n+R,X(l),3,[e,s,t]),je=e=>pe("CheckpointIds",Y(e),2),Fe=(e,s)=>pe("Checkpoint",Y(s),3,[e]),Ee=e=>ve(e,"goBackward"),Qe=e=>ve(e,"goForward"),{PureComponent:Ae,Fragment:Ge,createElement:Ue,useCallback:We,useLayoutEffect:ze,useRef:Je,useState:Ke}=s,Ne=(e,...s)=>h(e)?{}:e(...s),Xe=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ye=Object.defineProperty,Ze=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,_e=Object.getOwnPropertySymbols,es=Object.prototype.hasOwnProperty,ss=Object.prototype.propertyIsEnumerable,ts=(e,s,t)=>s in e?Ye(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ls=(e,s)=>{for(var t in s||(s={}))es.call(s,t)&&ts(e,t,s[t]);if(_e)for(var t of _e(s))ss.call(s,t)&&ts(e,t,s[t]);return e},os=(e,s)=>Ze(e,$e(s)),rs=(e,s)=>{var t={};for(var l in e)es.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&_e)for(var l of _e(e))s.indexOf(l)<0&&ss.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:us,useContext:ns,useMemo:ds,useState:is}=s,as=({tableId:e,store:s,rowComponent:t=ws,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>Cs(x(n,(r=>Ue(t,os(ls({},Ne(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),cs=({queryId:e,queries:s,resultRowComponent:t=gs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Cs(x(u,(o=>Ue(t,os(ls({},Ne(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),Is=({relationshipId:e,relationships:s,rowComponent:t=ws,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=Xe(N(s),e),c=u(e,n,d);return Cs(x(c,(e=>Ue(t,os(ls({},Ne(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},ps=e=>({checkpoints:s,checkpointComponent:t=hs,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=Y(s);return Cs(x(e(je(u)),(e=>Ue(t,os(ls({},Ne(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Cs=(e,s,t,l)=>{const o=h(s)||!Array.isArray(e)?e:x(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},bs=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return Cs(l+(null!=(u=Le(e,s,t,o))?u:l),void 0,r,t)},ws=({tableId:e,rowId:s,store:t,cellComponent:l=bs,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>Cs(x(((e,s,t,l)=>{const o=me(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Ue(l,os(ls({},Ne(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Rs=e=>as(e,ge(e.tableId,e.store)),ks=({valueId:e,store:s,debugIds:t})=>{var o;return Cs(l+(null!=(o=Se(e,s))?o:l),void 0,t,e)},vs=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ws,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)])(K(t),e),a=Pe(e,s,n);return Cs(x(a,(e=>Ue(l,os(ls({},Ne(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ys=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Cs(l+(null!=(u=De(e,s,t,o))?u:l),void 0,r,t)},gs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ys,getResultCellComponentProps:o,separator:r,debugIds:u})=>Cs(x(Me(e,s,t),(r=>Ue(l,os(ls({},Ne(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),hs=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return Cs(null!=(o=Fe(s,e))?o:l,void 0,t,s)},ms=ps((e=>e[0])),Ls=ps((e=>h(e[1])?[]:[e[1]])),fs=ps((e=>e[2]));e.BackwardCheckpointsView=ms,e.CellView=bs,e.CheckpointView=hs,e.CurrentCheckpointView=Ls,e.ForwardCheckpointsView=fs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=vs,getSliceComponentProps:l,separator:o,debugIds:r})=>Cs(x(Ve(e,s),(o=>Ue(t,os(ls({},Ne(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>Is(e,qe,e.firstRowId),e.LocalRowsView=e=>Is(e,Oe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Cs(null!=(o=Te(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=ns(A),[C,b]=is({}),w=us(((e,s)=>b((t=>D(t,e)==s?t:os(ls({},t),{[e]:s})))),[]),R=us((e=>b((s=>ls({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Ue(A.Provider,{value:ds((()=>[null!=e?e:p[0],ls(ls(ls({},p[1]),s),C),null!=t?t:p[2],ls(ls({},p[3]),l),null!=o?o:p[4],ls(ls({},p[5]),r),null!=u?u:p[6],ls(ls({},p[7]),n),null!=d?d:p[8],ls(ls({},p[9]),i),null!=a?a:p[10],ls(ls({},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=ws,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=Xe(N(t),e),i=xe(e,s,u);return Cs(h(d)||h(i)?null:Ue(l,os(ls({},Ne(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ys,e.ResultRowView=gs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=rs(s,["cellId","descending","offset","limit"]);return cs(u,He(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>cs(e,Be(e.queryId,e.queries)),e.RowView=ws,e.SliceView=vs,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=rs(s,["cellId","descending","offset","limit"]);return as(u,he(u.tableId,t,l,o,r,u.store))},e.TableView=Rs,e.TablesView=({store:e,tableComponent:s=Rs,getTableComponentProps:t,separator:l,debugIds:o})=>Cs(x(ye(e),(l=>Ue(s,os(ls({},Ne(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=ks,e.ValuesView=({store:e,valueComponent:s=ks,getValueComponentProps:t,separator:l,debugIds:o})=>Cs(x(fe(e),(l=>Ue(s,os(ls({},Ne(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=ne,l,o=T,r=ne,u=!0)=>{const n=z(l);return ee((t=>m(n,(l=>m(s(t,l),(s=>o(l.addRow(f(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=Le,e.useCellIds=me,e.useCellIdsListener=(e,s,t,l,o,r)=>Ce(k,z(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>Ce(R,z(u),l,o,[e,s,t],r),e.useCheckpoint=Fe,e.useCheckpointIds=je,e.useCheckpointIdsListener=(e,s,t)=>Ce("CheckpointIds",Y(t),e,s),e.useCheckpointListener=(e,s,t,l)=>Ce("Checkpoint",Y(l),s,t,[e]),e.useCheckpoints=e=>G(e,10),e.useCheckpointsIds=()=>W(11),e.useCheckpointsOrCheckpointsById=Y,e.useCreateCheckpoints=(e,s,t)=>ce(e,s,t),e.useCreateIndexes=(e,s,t)=>ce(e,s,t),e.useCreateMergeableStore=(e,s=ne)=>te(e,s),e.useCreateMetrics=(e,s,t)=>ce(e,s,t),e.useCreatePersister=(e,s,t=ne,l,o=ne,r,u=ne)=>{const[,n]=re(),[d,i]=re();return se((()=>{_(void 0,null,(function*(){const t=e?yield s(e):void 0;i(t),t&&l&&_(void 0,null,(function*(){yield l(t),n([])}))}))}),[e,...t,...o]),se((()=>()=>{d&&(d.destroy(),null==r||r(d))}),[d,...u]),d},e.useCreateQueries=(e,s,t)=>ce(e,s,t),e.useCreateRelationships=(e,s,t)=>ce(e,s,t),e.useCreateStore=(e,s=ne)=>te(e,s),e.useCreateSynchronizer=(e,s,t=ne,l,o=ne)=>{const[r,u]=re();return se((()=>{_(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),se((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>ke(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>ke(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>ke(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>ke(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>ke(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>ke(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>Ce("DidFinish"+$,z(t),e,s),e.useGoBackwardCallback=Ee,e.useGoForwardCallback=Qe,e.useGoToCallback=(e,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>m(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>pe(R,z(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>Ce(d+R,z(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>pe(p,z(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>Ce(d+p,z(r),t,l,[e,s],o),e.useHasTable=(e,s)=>pe(a,z(s),4,[e]),e.useHasTableCell=(e,s,t)=>pe(a+R,z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>Ce(d+a+R,z(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>Ce(d+a,z(o),s,t,[e],l),e.useHasTables=e=>pe(c,z(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>Ce(d+c,z(l),e,s,[],t),e.useHasValue=(e,s)=>pe(v,z(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>Ce(d+v,z(o),s,t,[e],l),e.useHasValues=e=>pe(y,z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>Ce(d+y,z(l),e,s,[],t),e.useIndexIds=e=>pe("IndexIds",K(e),1),e.useIndexes=e=>G(e,4),e.useIndexesIds=()=>W(5),e.useIndexesOrIndexesById=K,e.useLinkedRowIds=qe,e.useLinkedRowIdsListener=(e,s,t,l,o)=>Ce("Linked"+b,N(o),t,l,[e,s]),e.useLocalRowIds=Oe,e.useLocalRowIdsListener=(e,s,t,l,o)=>Ce("Local"+b,N(o),t,l,[e,s]),e.useMetric=Te,e.useMetricIds=e=>pe("MetricIds",J(e),1),e.useMetricListener=(e,s,t,l)=>Ce("Metric",J(l),s,t,[e]),e.useMetrics=e=>G(e,2),e.useMetricsIds=()=>W(3),e.useMetricsOrMetricsById=J,e.useProvideStore=(e,s)=>{const{12:t,13:l}=E(A);Q((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>G(e,8),e.useQueriesIds=()=>W(9),e.useQueriesOrQueriesById=X,e.useQueryIds=e=>pe("QueryIds",X(e),1),e.useRedoInformation=e=>{var s;const t=Y(e),[,,[o]]=je(t);return[!h(o),Qe(t),o,null!=(s=m(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>pe("RelationshipIds",N(e),1),e.useRelationships=e=>G(e,6),e.useRelationshipsIds=()=>W(7),e.useRelationshipsOrRelationshipsById=N,e.useRemoteRowId=xe,e.useRemoteRowIdListener=(e,s,t,l,o)=>Ce("RemoteRowId",N(o),t,l,[e,s]),e.useResultCell=De,e.useResultCellIds=Me,e.useResultCellIdsListener=(e,s,t,l,o)=>Ce(n+k,X(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>Ce(n+R,X(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>pe(n+p,X(t),0,[e,s]),e.useResultRowCount=(e,s)=>pe(n+C,X(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>Ce(n+C,X(l),s,t,[e]),e.useResultRowIds=Be,e.useResultRowIdsListener=(e,s,t,l)=>Ce(n+b,X(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>Ce(n+p,X(o),t,l,[e,s]),e.useResultSortedRowIds=He,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>Ce(n+w,X(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>pe(n+a,X(s),0,[e]),e.useResultTableCellIds=(e,s)=>pe(n+a+k,X(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>Ce(n+a+k,X(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>Ce(n+a,X(l),s,t,[e]),e.useRow=(e,s,t)=>pe(p,z(t),0,[e,s]),e.useRowCount=(e,s)=>pe(C,z(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>Ce(C,z(o),s,t,[e],l),e.useRowIds=ge,e.useRowIdsListener=(e,s,t,l,o)=>Ce(b,z(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>Ce(p,z(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>be(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=T,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>be(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>be(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>be(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>be(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>be(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>be(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>be(t,y,e,s,l,o),e.useSliceIds=Ve,e.useSliceIdsListener=(e,s,t,l)=>Ce("SliceIds",K(l),s,t,[e]),e.useSliceRowIds=Pe,e.useSliceRowIdsListener=(e,s,t,l,o)=>Ce("Slice"+b,K(o),t,l,[e,s]),e.useSortedRowIds=he,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>Ce(w,z(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>Ce("Start"+$,z(t),e,s),e.useStore=e=>G(e,0),e.useStoreIds=()=>W(1),e.useStoreOrStoreById=z,e.useTable=(e,s)=>pe(a,z(s),0,[e]),e.useTableCellIds=(e,s)=>pe(a+k,z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>Ce(a+k,z(o),s,t,[e],l),e.useTableIds=ye,e.useTableIdsListener=(e,s,t,l)=>Ce(I,z(l),e,s,ne,t),e.useTableListener=(e,s,t,l,o)=>Ce(a,z(o),s,t,[e],l),e.useTables=e=>pe(c,z(e),0),e.useTablesListener=(e,s,t,l)=>Ce(c,z(l),e,s,ne,t),e.useUndoInformation=e=>{var s;const t=Y(e),[o,r]=je(t);return[(u=o,!(0==S(u))),Ee(t),r,null!=(s=m(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Se,e.useValueIds=fe,e.useValueIdsListener=(e,s,t,l)=>Ce(g,z(l),e,s,ne,t),e.useValueListener=(e,s,t,l,o)=>Ce(v,z(o),s,t,[e],l),e.useValues=e=>pe(y,z(e),0),e.useValuesListener=(e,s,t,l)=>Ce(y,z(l),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>Ce("WillFinish"+$,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);
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 +1 @@
1
- var e,t;e=this,t=function(e,t,l){"use strict";const n=e=>typeof e,s="",r=n(s),a=n(!0),o=n(0),i=n(n),u="type",d="default",c="Has",h="Ids",m="Table",p=m+"s",b=m+h,g="Row",v=g+"Count",f=g+h,y="Cell",I=y+h,w="Value",C=w+"s",k=w+h,x="currentTarget",S="value",T=e=>s+e,V=globalThis.window,R=Math,O=R.min,q=R.floor,M=isFinite,P=e=>null==e,N=(e,t,l)=>P(e)?null==l?void 0:l():t(e),L=e=>e==r||e==a,E=e=>n(e)==i,j=e=>Array.isArray(e),z=(e,t,l)=>e.slice(t,l),$=e=>e.length,A=e=>{throw Error(e)},{PureComponent:F,Fragment:J,createElement:B,useCallback:D,useLayoutEffect:Q,useRef:H,useState:W}=t,U=(e,...t)=>P(e)?{}:e(...t),G=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),X=(e,t)=>e.map(t),Y=e=>0==$(e),Z=(e,...t)=>e.push(...t),_=e=>e.shift(),ee=Object,te=e=>ee.getPrototypeOf(e),le=ee.entries,ne=ee.isFrozen,se=e=>!P(e)&&N(te(e),(e=>e==ee.prototype||P(te(e))),(()=>!0)),re=ee.keys,ae=ee.freeze,oe=(e=[])=>ee.fromEntries(e),ie=(e,t)=>t in e,ue=(e,t)=>(delete e[t],e),de=(e,t)=>X(le(e),(([e,l])=>t(l,e))),ce=e=>se(e)&&0==(e=>$(re(e)))(e),he=(e,t,l,n=0)=>P(e)||!se(e)||!n&&ce(e)||ne(e)?(null==l||l(),!1):(de(e,((l,n)=>{t(l,n)||ue(e,n)})),!!n||!ce(e)),me=JSON.stringify,pe=JSON.parse,be=e=>me(e,((e,t)=>t instanceof Map?ee.fromEntries([...t]):t)),ge="tinybaseInspector",ve="TinyBase Inspector",fe=["left","top","bottom","right","full"],ye="state",Ie="sort",we="open",Ce="position",ke=we,xe="editable",Se=(...e)=>be(e),Te=(e,t)=>X(G(e),t),Ve=(e,t)=>[!!l.useCell(ye,e,xe,t),D((l=>{t.setCell(ye,e,xe,(e=>!e)),l.preventDefault()}),[t,e])],Re="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Oe='content:url("',qe=Oe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Me='</svg>")',Pe=Oe+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Ne=X([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>qe+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+Me)),Le=qe+"<path d='M20 20l60 60M20 80l60-60' />"+Me,Ee=qe+`<path d='${Re}' />`+Me,je=qe+`<path d='${Re}M20 20l60 60' />`+Me;var ze=Object.defineProperty,$e=Object.defineProperties,Ae=Object.getOwnPropertyDescriptors,Fe=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,De=(e,t,l)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Qe=(e,t)=>{for(var l in t||(t={}))Je.call(t,l)&&De(e,l,t[l]);if(Fe)for(var l of Fe(t))Be.call(t,l)&&De(e,l,t[l]);return e},He=(e,t)=>$e(e,Ae(t));const We="*::-webkit-scrollbar",Ue=((e,t="")=>e.join(t))(de(He(Qe(He(Qe(He(Qe({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[We]:"width:0.5rem;height:0.5rem;",[We+"-track"]:"background:#111",[We+"-thumb"]:"background:#999;border:1px solid #111",[We+"-thumb:hover"]:"background:#fff",[We+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+Pe},oe(X(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),oe(X(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Pe,"header>img:nth-of-type(6)":Le}),oe(X(Ne,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":Ee,"details[open]>summary img.done":je,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${ge} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`#${ge} ${t}{${e}}`:""))),Ge=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1,s=l.useSetValueCallback(ke,(()=>!0),[],e);return l.useValue(ke,e)?null:B("img",{onClick:s,title:ve,"data-position":n})},Ke=({uniqueId:e,summary:t,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!l.useCell(ye,e,we,a),i=l.useSetCellCallback(ye,e,we,(e=>e[x].open),[],a);return B("details",{open:o,onToggle:i},B("summary",null,t,s?B("img",{onClick:s,className:n?"done":"edit"}):null),r)},Xe=e=>{const t=n(e);return L(t)||t==o&&M(e)?t:void 0},Ye=(e,t,l,n,s)=>P(s)?e.delCell(t,l,n,!0):e.setCell(t,l,n,s),Ze=(e,t,l)=>P(l)?e.delValue(t):e.setValue(t,l),_e=(e,t,l,n)=>e==r?t:e==o?l:n;var et=Object.defineProperty,tt=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,nt=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable,at=(e,t,l)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,ot=(e,t)=>{for(var l in t||(t={}))st.call(t,l)&&at(e,l,t[l]);if(nt)for(var l of nt(t))rt.call(t,l)&&at(e,l,t[l]);return e},it=(e,t)=>tt(e,lt(t)),ut=(e,t)=>{var l={};for(var n in e)st.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&nt)for(var n of nt(e))t.indexOf(n)<0&&rt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:dt,useMemo:ct,useState:ht}=t,mt="editable",pt=(e,t)=>X(l.useTableCellIds(e,t),(t=>e+"."+t)),bt=(e,t,l)=>{const n=dt(e,t);return l?n:void 0},gt=(...e)=>ct((()=>e),e),vt=(e,t)=>ct((()=>({store:e,tableId:t})),[e,t]),ft=(e,t)=>ct((()=>({queries:e,queryId:t})),[e,t]),yt=(e,t=!1,l,n=0,s,r,a,o)=>{const[[i,u,d],c]=ht([e,t,n]),h=dt((e=>{c(e),null==o||o(e)}),[o]),m=bt((e=>h([e,e==i&&!u,d])),[h,i,u,d],l),p=dt((e=>h([i,u,e])),[h,i,u]),b=!0===a?Pt:a;return[[i,u,d],m,ct((()=>!1===a?null:B(b,{offset:d,limit:s,total:r,onChange:p})),[a,b,d,s,r,p])]},It=(e,t,l)=>ct((()=>{const s=null!=t?t:e;return a=j(s)?oe(X(s,(e=>[e,e]))):s,o=(e,t)=>ot(ot({},{label:t,component:l}),n(e)==r?{label:e}:e),oe(de(a,((e,t)=>[t,o(e,t)])));var a,o}),[t,l,e]),wt=({className:e,headerRow:t,idColumn:l,params:[n,s,r,a,o,i]})=>B("table",{className:e},i?B("caption",null,i):null,!1===t?null:B("thead",null,B("tr",null,!1===l?null:B(Ct,{sort:null!=a?a:[],label:"Id",onClick:o}),de(n,(({label:e},t)=>B(Ct,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:o}))))),B("tbody",null,X(r,(e=>B("tr",{key:e},!1===l?null:B("th",null,e),de(n,(({component:t,getComponentProps:l},n)=>B("td",{key:n},B(t,it(ot(ot({},U(l,e,n)),s),{rowId:e,cellId:n})))))))))),Ct=({cellId:e,sort:[t,l],label:n=(null!=e?e:s),onClick:r})=>B("th",{onClick:bt((()=>null==r?void 0:r(e)),[r,e],r),className:P(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},P(l)||t!=e?null:(l?"↓":"↑")+" ",n),kt=({localRowId:e,params:[n,s,r,a,o,i,u]})=>{const d=l.useRemoteRowId(o,e,i);return B("tr",null,!1===n?null:B(t.Fragment,null,B("th",null,e),B("th",null,d)),de(s,(({component:t,getComponentProps:l},n)=>{const[s,o]=n.split(".",2),i=s===r?e:s===a?d:null;return P(i)?null:B("td",{key:n},B(t,it(ot({},U(l,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},xt=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:s=!0})=>{const[i,u]=ht(),[d,c]=ht(),[h,m]=ht(),[p,b]=ht(),[g,v]=ht();d!==e&&(u(Xe(e)),c(e),m(e+""),b(Number(e)||0),v(!!e));const f=dt(((e,l)=>{l(e),c(e),t(e)}),[t]),y=dt((()=>{if(!(null==n?void 0:n())){const e=_e(i,o,a,r),l=_e(e,h,p,g);u(e),c(l),t(l)}}),[n,t,h,p,g,i]);return B("div",{className:l},s?B("button",{className:i,onClick:y},i):null,_e(i,B("input",{key:i,value:h,onChange:dt((e=>f(e[x][S]+"",m)),[f])}),B("input",{key:i,type:"number",value:p,onChange:dt((e=>f(Number(e[x][S]||0),b)),[f])}),B("input",{key:i,type:"checkbox",checked:g,onChange:dt((e=>f(!!e[x].checked,v)),[f])})))},St=e=>{var t=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=t,p=ut(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,g,v]=yt(s,r,d,a,o,l.useRowCount(n,i),c,h);return B(wt,it(ot({},p),{params:gt(It(l.useTableCellIds(n,i),m,u?qt:l.CellView),vt(i,n),l.useSortedRowIds(n,...b,o,i),b,g,v)}))},Tt=({store:e,editable:t=!1,valueComponent:n=(t?Mt:l.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>B("table",{className:r},!1===a?null:B("thead",null,B("tr",null,!1===o?null:B("th",null,"Id"),B("th",null,w))),B("tbody",null,X(l.useValueIds(e),(t=>B("tr",{key:t},!1===o?null:B("th",null,t),B("td",null,B(n,it(ot({},U(s,t)),{valueId:t,store:e})))))))),Vt=e=>{var t=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=t,i=ut(t,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(l.useIndexesOrIndexesById(r),n);return B(wt,it(ot({},i),{params:gt(It(l.useTableCellIds(c,d),o,a?qt:l.CellView),vt(d,c),l.useSliceRowIds(n,s,u))}))},Rt=({relationshipId:e,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(l.useRelationshipsOrRelationshipsById(n),e),m=It([...pt(c,d),...pt(h,d)],r,s?qt:l.CellView),p=gt(i,m,c,h,e,u,d);return B("table",{className:a},!1===o?null:B("thead",null,B("tr",null,!1===i?null:B(t.Fragment,null,B("th",null,c,".Id"),B("th",null,h,".Id")),de(m,(({label:e},t)=>B("th",{key:t},e))))),B("tbody",null,X(l.useRowIds(c,d),(e=>B(kt,{key:e,localRowId:e,params:p})))))},Ot=e=>{var t=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=t,m=ut(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,b,g]=yt(s,r,u,a,o,l.useResultRowCount(n,i),d,h);return B(wt,it(ot({},m),{params:gt(It(l.useResultTableCellIds(n,i),c,l.ResultCellView),ft(i,n),l.useResultSortedRowIds(n,...p,o,i),p,b,g)}))},qt=({tableId:e,rowId:t,cellId:n,store:s,className:r,showType:a})=>{var o;return B(xt,{thing:l.useCell(e,t,n,s),onThingChange:l.useSetCellCallback(e,t,n,(e=>e),[],s),className:null!=r?r:mt+y,showType:a,hasSchema:null==(o=l.useStoreOrStoreById(s))?void 0:o.hasTablesSchema})},Mt=({valueId:e,store:t,className:n,showType:s})=>{var r;return B(xt,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=n?n:mt+w,showType:s,hasSchema:null==(r=l.useStoreOrStoreById(t))?void 0:r.hasValuesSchema})},Pt=({onChange:e,total:l,offset:n=0,limit:s=l,singular:r="row",plural:a=r+"s"})=>{(n>l||n<0)&&(n=0,e(0));const o=bt((()=>e(n-s)),[e,n,s],n>0),i=bt((()=>e(n+s)),[e,n,s],n+s<l);return B(t.Fragment,null,l>s&&B(t.Fragment,null,B("button",{className:"previous",disabled:0==n,onClick:o},"←"),B("button",{className:"next",disabled:n+s>=l,onClick:i},"→"),n+1," to ",O(l,n+s)," of "),l," ",1!=l?a:r)},Nt=({indexes:e,indexesId:t,indexId:n,s:s})=>B(Ke,{uniqueId:Se("i",t,n),summary:"Index: "+n,s:s},X(l.useSliceIds(n,e),(l=>B(Lt,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),Lt=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:s})=>{const r=Se("i",t,l,n),[a,o]=Ve(r,s);return B(Ke,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},B(Vt,{sliceId:n,indexId:l,indexes:e,editable:a}))},Et=({indexesId:e,s:t})=>{const n=l.useIndexes(e),s=l.useIndexIds(n);return P(n)?null:B(Ke,{uniqueId:Se("i",e),summary:"Indexes: "+(null!=e?e:d),s:t},Y(s)?"No indexes defined":Te(s,(l=>B(Nt,{indexes:n,indexesId:e,indexId:l,s:t,key:l}))))},jt=({metrics:e,metricId:t})=>B("tr",null,B("th",null,t),B("td",null,null==e?void 0:e.getTableId(t)),B("td",null,l.useMetric(t,e))),zt=({metricsId:e,s:t})=>{const n=l.useMetrics(e),s=l.useMetricIds(n);return P(n)?null:B(Ke,{uniqueId:Se("m",e),summary:"Metrics: "+(null!=e?e:d),s:t},Y(s)?"No metrics defined":B("table",null,B("thead",null,B("th",null,"Metric Id"),B("th",null,"Table Id"),B("th",null,"Metric")),B("tbody",null,X(s,(e=>B(jt,{metrics:n,metricId:e,key:e}))))))},$t=({queries:e,queriesId:t,queryId:n,s:s})=>{var r;const a=Se("q",t,n),[o,i,u]=pe(null!=(r=l.useCell(ye,a,Ie,s))?r:"[]"),d=l.useSetCellCallback(ye,a,Ie,be,[],s);return B(Ke,{uniqueId:a,summary:"Query: "+n,s:s},B(Ot,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},At=({queriesId:e,s:t})=>{const n=l.useQueries(e),s=l.useQueryIds(n);return P(n)?null:B(Ke,{uniqueId:Se("q",e),summary:"Queries: "+(null!=e?e:d),s:t},Y(s)?"No queries defined":Te(s,(l=>B($t,{queries:n,queriesId:e,queryId:l,s:t,key:l}))))},Ft=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const s=Se("r",t,l),[r,a]=Ve(s,n);return B(Ke,{uniqueId:s,summary:"Relationship: "+l,editable:r,handleEditable:a,s:n},B(Rt,{relationshipId:l,relationships:e,editable:r}))},Jt=({relationshipsId:e,s:t})=>{const n=l.useRelationships(e),s=l.useRelationshipIds(n);return P(n)?null:B(Ke,{uniqueId:Se("r",e),summary:"Relationships: "+(null!=e?e:d),s:t},Y(s)?"No relationships defined":Te(s,(l=>B(Ft,{relationships:n,relationshipsId:e,relationshipId:l,s:t,key:l}))))},Bt=({tableId:e,store:t,storeId:n,s:s})=>{var r;const a=Se("t",n,e),[o,i,u]=pe(null!=(r=l.useCell(ye,a,Ie,s))?r:"[]"),d=l.useSetCellCallback(ye,a,Ie,be,[],s),[c,h]=Ve(a,s);return B(Ke,{uniqueId:a,summary:m+": "+e,editable:c,handleEditable:h,s:s},B(St,{tableId:e,store:t,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Dt=({store:e,storeId:t,s:n})=>{const s=Se("v",t),[r,a]=Ve(s,n);return Y(l.useValueIds(e))?null:B(Ke,{uniqueId:s,summary:C,editable:r,handleEditable:a,s:n},B(Tt,{store:e,editable:r}))},Qt=({storeId:e,s:t})=>{const n=l.useStore(e),s=l.useTableIds(n);return P(n)?null:B(Ke,{uniqueId:Se("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(null!=e?e:d),s:t},B(Dt,{storeId:e,store:n,s:t}),Te(s,(l=>B(Bt,{store:n,storeId:e,tableId:l,s:t,key:l}))))},Ht=({s:e})=>{const t=H(null),n=H(0),[s,r]=W(!1),{scrollLeft:a,scrollTop:o}=l.useValues(e);Q((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=q(a)+e.clientWidth&&e.scrollHeight>=q(o)+e.clientHeight&&e.scrollTo(a,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,o]);const i=D((t=>{const{scrollLeft:l,scrollTop:s}=t[x];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:l,scrollTop:s})}))}),[e]),u=l.useStore(),d=l.useStoreIds(),c=l.useMetrics(),h=l.useMetricsIds(),m=l.useIndexes(),p=l.useIndexesIds(),b=l.useRelationships(),g=l.useRelationshipsIds(),v=l.useQueries(),f=l.useQueriesIds();return P(u)&&Y(d)&&P(c)&&Y(h)&&P(m)&&Y(p)&&P(b)&&Y(g)&&P(v)&&Y(f)?B("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):B("article",{ref:t,onScroll:i},B(Qt,{s:e}),X(d,(t=>B(Qt,{storeId:t,s:e,key:t}))),B(zt,{s:e}),X(h,(t=>B(zt,{metricsId:t,s:e,key:t}))),B(Et,{s:e}),X(p,(t=>B(Et,{indexesId:t,s:e,key:t}))),B(Jt,{s:e}),X(g,(t=>B(Jt,{relationshipsId:t,s:e,key:t}))),B(At,{s:e}),X(f,(t=>B(At,{queriesId:t,s:e,key:t}))))};var Wt=Object.defineProperty;class Ut extends F{constructor(e){var t,l,n;super(e),n=(e,t)=>console.error(e,t.componentStack),(l="componentDidCatch")in(t=this)?Wt(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?B("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const Gt=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1,s=l.useSetValueCallback(ke,(()=>!1),[],e),r=l.useSetValueCallback(Ce,(e=>Number(e[x].dataset.id)),[],e);return B("header",null,B("img",{title:ve}),B("span",null,ve),X(fe,((e,t)=>t==n?null:B("img",{onClick:r,"data-id":t,title:"Dock to "+e,key:t}))),B("img",{onClick:s,title:"Close"}))},Kt=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1;return l.useValue(ke,e)?B("main",{"data-position":n},B(Gt,{s:e}),B(Ut,null,B(Ht,{s:e}))):null},Xt=e=>t=>{return l=(t,l)=>t+e(l),nl(t).reduce(l,0);var l},Yt=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Zt=Xt(Yt),_t=Xt(Zt),el=Xt(_t),tl=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},ll=e=>P(e)||0==Yt(e),nl=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},sl=e=>e.clear(),rl=(e,t)=>null==e?void 0:e.forEach(t),al=(e,t)=>null==e?void 0:e.delete(t),ol=e=>new Map(e),il=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},ul=(e,t)=>null==e?void 0:e.get(t),dl=(e,t)=>rl(e,((e,l)=>t(l,e))),cl=(e,t,l)=>P(l)?(al(e,t),e):null==e?void 0:e.set(t,l),hl=(e,t,l,n)=>(tl(e,t)?null==n||n(ul(e,t)):cl(e,t,l()),ul(e,t)),ml=(e,t,l,n=cl)=>(de(t,((t,n)=>l(e,n,t))),dl(e,(l=>ie(t,l)?0:n(e,l))),e),pl=(e,t,l,n)=>{const s={};return rl(e,((e,r)=>{if(!(null==l?void 0:l(e,r))){const l=t?t(e,r):e;(null==n?void 0:n(l))||(s[r]=l)}})),s},bl=(e,t,l)=>pl(e,(e=>pl(e,t,l)),ll,ce),gl=(e,t,l)=>pl(e,(e=>bl(e,t,l)),ll,ce),vl=(e,t)=>{const l=ol();return rl(e,((e,n)=>{var s;return l.set(n,null!=(s=null==t?void 0:t(e))?s:e)})),l},fl=e=>vl(e,vl),yl=e=>vl(e,fl),Il=(e,t,l,n,s=0)=>N((l?hl:ul)(e,t[s],s>$(t)-2?l:ol),(r=>{if(s>$(t)-2)return(null==n?void 0:n(r))&&cl(e,t[s]),r;const a=Il(r,t,l,n,s+1);return ll(r)&&cl(e,t[s]),a}));var wl=Object.defineProperty,Cl=Object.getOwnPropertySymbols,kl=Object.prototype.hasOwnProperty,xl=Object.prototype.propertyIsEnumerable,Sl=(e,t,l)=>t in e?wl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Tl=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Vl=ol(),Rl=ol();var Ol=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const ql="storage",Ml=e=>new Set(j(e)||P(e)?e:[e]),Pl=(e,t)=>null==e?void 0:e.add(t),Nl=/^\d+$/,Ll=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?_(e):null)?n:s+t++},t=>{Nl.test(t)&&$(e)<1e3&&Z(e,t)}]},El=e=>[e,e],jl=(e,t=Zt)=>t(e[0])+t(e[1]),zl=()=>[ol(),ol()],$l=e=>[...e],Al=([e,t])=>e===t;ol(X("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(s),((e,t)=>[e,t])));const Fl=(e,t,l)=>cl(e,t,ul(e,t)==-l?void 0:l),Jl=()=>{let e,t,l=!1,n=!1,r=0,a=[];const i=ol(),h=ol(),x=ol(),S=ol(),V=ol(),R=ol(),O=ol(),q=ol(),M=ol(),A=ol(),F=ol(),J=ol(),B=ol(),D=ol(),Q=Ml(),H=ol(),W=ol(),U=ol(),Y=ol(),_=zl(),ee=zl(),te=zl(),le=zl(),ne=zl(),se=zl(),re=zl(),oe=zl(),me=zl(),ge=zl(),ve=zl(),fe=zl(),ye=zl(),Ie=zl(),we=zl(),Ce=zl(),ke=zl(),xe=zl(),Se=zl(),Te=zl(),Ve=zl(),Re=zl(),Oe=ol(),qe=zl(),[Me,Pe,Ne,Le]=(()=>{let e;const[t,l]=Ll(),n=ol();return[(l,r,a,o=[],i=()=>[])=>{null!=e||(e=Vl);const u=t(1);return cl(n,u,[l,r,a,o,i]),Pl(Il(r,null!=a?a:[s],Ml),u),u},(t,l,...r)=>K(((e,t=[s])=>{const l=[],n=(e,s)=>s==$(t)?Z(l,e):null===t[s]?rl(e,(e=>n(e,s+1))):K([t[s],null],(t=>n(ul(e,t),s+1)));return n(e,0),l})(t,l),(t=>rl(t,(t=>ul(n,t)[0](e,...null!=l?l:[],...r))))),e=>N(ul(n,e),(([,t,r])=>(Il(t,null!=r?r:[s],void 0,(t=>(al(t,e),ll(t)?1:0))),cl(n,e),l(e),r))),t=>N(ul(n,t),(([t,,l=[],n,s])=>{const r=(...a)=>{var o,i;const u=$(a);u==$(l)?t(e,...a,...s(a)):P(l[u])?K(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,l[u])};r()}))]})(),Ee=e=>{if(!he(e,((e,t)=>[u,d].includes(t))))return!1;const t=e[u];return!(!L(t)&&t!=o||(Xe(e[d])!=t&&ue(e,d),0))},je=j,ze=(t,l)=>(!e||tl(F,l)||gt(l))&&he(t,((e,t)=>$e(l,t,e)),(()=>gt(l))),$e=(e,t,l,n)=>he(n?l:Be(l,e,t),((n,s)=>N(Ae(e,t,s,n),(e=>(l[s]=e,!0)),(()=>!1))),(()=>gt(e,t))),Ae=(t,l,n,s)=>e?N(ul(ul(F,t),n),(e=>Xe(s)!=e[u]?gt(t,l,n,s,e[d]):s),(()=>gt(t,l,n,s))):P(Xe(s))?gt(t,l,n,s):s,Fe=(e,t)=>he(t?e:De(e),((t,l)=>N(Je(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>vt())),Je=(e,l)=>t?N(ul(B,e),(t=>Xe(l)!=t[u]?vt(e,l,t[d]):l),(()=>vt(e,l))):P(Xe(l))?vt(e,l):l,Be=(e,t,l)=>(N(ul(J,t),(([n,s])=>{rl(n,((t,l)=>{ie(e,l)||(e[l]=t)})),rl(s,(n=>{ie(e,n)||gt(t,l,n)}))})),e),De=e=>(t&&(rl(D,((t,l)=>{ie(e,l)||(e[l]=t)})),rl(Q,(t=>{ie(e,t)||vt(t)}))),e),Qe=e=>ml(F,e,((e,t,l)=>{const n=ol(),s=Ml();ml(hl(F,t,ol),l,((e,t,l)=>{cl(e,t,l),N(l[d],(e=>cl(n,t,e)),(()=>Pl(s,t)))})),cl(J,t,[n,s])}),((e,t)=>{cl(F,t),cl(J,t)})),He=e=>ml(B,e,((e,t,l)=>{cl(B,t,l),N(l[d],(e=>cl(D,t,e)),(()=>Pl(Q,t)))}),((e,t)=>{cl(B,t),cl(D,t),al(Q,t)})),We=e=>ce(e)?Kt():Qt(e),Ue=e=>ml(U,e,((e,t,l)=>Ge(t,l)),((e,t)=>at(t))),Ge=(e,t)=>ml(hl(U,e,(()=>(dt(e,1),cl(H,e,Ll()),cl(W,e,ol()),ol()))),t,((t,l,n)=>Ke(e,t,l,n)),((t,l)=>ot(e,t,l))),Ke=(e,t,l,n,s)=>ml(hl(t,l,(()=>(ct(e,l,1),ol()))),n,((t,n,s)=>_e(e,l,t,n,s)),((n,r)=>it(e,t,l,n,r,s))),_e=(e,t,l,n,s)=>{tl(l,n)||ht(e,t,n,1);const r=ul(l,n);s!==r&&(mt(e,t,n,r,s),cl(l,n,s))},et=(e,t,l,n,s)=>N(ul(t,l),(t=>_e(e,l,t,n,s)),(()=>Ke(e,t,l,Be({[n]:s},e,l)))),tt=e=>ce(e)?wl():Ht(e),lt=e=>ml(Y,e,((e,t,l)=>nt(t,l)),((e,t)=>ut(t))),nt=(e,t)=>{tl(Y,e)||pt(e,1);const l=ul(Y,e);t!==l&&(bt(e,l,t),cl(Y,e,t))},st=(e,t)=>{const[l]=ul(H,e),n=l(t);return tl(ul(U,e),n)?st(e,t):n},rt=e=>{var t;return null!=(t=ul(U,e))?t:Ge(e,{})},at=e=>Ge(e,{}),ot=(e,t,l)=>{const[,n]=ul(H,e);n(l),Ke(e,t,l,{},!0)},it=(e,t,l,n,s,r)=>{var a;const o=ul(null==(a=ul(J,e))?void 0:a[0],s);if(!P(o)&&!r)return _e(e,l,n,s,o);const i=t=>{mt(e,l,t,ul(n,t)),ht(e,l,t,-1),cl(n,t)};P(o)?i(s):dl(n,i),ll(n)&&(ct(e,l,-1),ll(cl(t,l))&&(dt(e,-1),cl(U,e),cl(H,e),cl(W,e)))},ut=e=>{const t=ul(D,e);if(!P(t))return nt(e,t);bt(e,ul(Y,e)),pt(e,-1),cl(Y,e)},dt=(e,t)=>Fl(i,e,t),ct=(e,t,l)=>Fl(hl(S,e,ol),t,l)&&cl(x,e,hl(x,e,(()=>0))+l),ht=(e,t,l,n)=>{var s;const r=ul(W,e),a=null!=(s=ul(r,l))?s:0;(0==a&&1==n||1==a&&-1==n)&&Fl(hl(h,e,ol),l,n),cl(r,l,a!=-n?a+n:null),Fl(hl(hl(V,e,ol),t,ol),l,n)},mt=(e,t,l,n,s)=>{var r;hl(hl(hl(R,e,ol),t,ol),l,(()=>[n,0]))[1]=s,null==(r=a[3])||r.call(a,e,t,l,s)},pt=(e,t)=>Fl(O,e,t),bt=(e,t,l)=>{var n;hl(q,e,(()=>[t,0]))[1]=l,null==(n=a[4])||n.call(a,e,l)},gt=(e,t,l,n,s)=>(Z(hl(hl(hl(M,e,ol),t,ol),l,(()=>[])),n),s),vt=(e,t,l)=>(Z(hl(A,e,(()=>[])),t),l),ft=(e,t,l)=>N(ul(ul(ul(R,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...El(Nt(e,t,l))])),yt=e=>N(ul(q,e),(([e,t])=>[!0,e,t]),(()=>[!1,...El(jt(e))])),It=e=>ll(M)||ll(Ce[e])?0:rl(e?yl(M):M,((t,l)=>rl(t,((t,n)=>rl(t,((t,s)=>Pe(Ce[e],[l,n,s],t))))))),wt=e=>ll(A)||ll(ke[e])?0:rl(e?vl(A):A,((t,l)=>Pe(ke[e],[l],t))),Ct=(e,t,l,n)=>{if(!ll(e))return Pe(t,n,(()=>pl(e))),dl(e,((e,t)=>Pe(l,[...null!=n?n:[],e],1==t))),1},kt=e=>{const t=zt();t!=l&&Pe(_[e],void 0,t);const n=ll(ge[e]),s=ll(ye[e])&&ll(Ie[e])&&ll(me[e])&&ll(ve[e])&&ll(se[e])&&ll(re[e])&&ll(oe[e])&&n&&ll(te[e])&&ll(le[e]),r=ll(we[e])&&ll(fe[e])&&ll(ne[e])&&ll(ee[e]);if(!s||!r){const t=e?[vl(i),fl(h),vl(x),fl(S),yl(V),yl(R)]:[i,h,x,S,V,R];if(!s){Ct(t[0],te[e],le[e]),rl(t[1],((t,l)=>Ct(t,se[e],re[e],[l]))),rl(t[2],((t,l)=>{0!=t&&Pe(oe[e],[l],Ot(l))}));const l=Ml();rl(t[3],((t,s)=>{Ct(t,me[e],ve[e],[s])&&!n&&(Pe(ge[e],[s,null]),Pl(l,s))})),n||rl(t[5],((t,n)=>{if(!tl(l,n)){const l=Ml();rl(t,(e=>rl(e,(([t,n],s)=>n!==t?Pl(l,s):al(e,s))))),rl(l,(t=>Pe(ge[e],[n,t])))}})),rl(t[4],((t,l)=>rl(t,((t,n)=>Ct(t,ye[e],Ie[e],[l,n])))))}if(!r){let l;rl(t[5],((t,n)=>{let s;rl(t,((t,r)=>{let a;rl(t,(([t,o],i)=>{o!==t&&(Pe(we[e],[n,r,i],o,t,ft),l=s=a=1)})),a&&Pe(fe[e],[n,r],ft)})),s&&Pe(ne[e],[n],ft)})),l&&Pe(ee[e],void 0,ft)}}},xt=e=>{const t=Bt();t!=n&&Pe(xe[e],void 0,t);const l=ll(Te[e])&&ll(Ve[e]),s=ll(Re[e])&&ll(Se[e]);if(!l||!s){const t=e?[vl(O),vl(q)]:[O,q];if(l||Ct(t[0],Te[e],Ve[e]),!s){let l;rl(t[1],(([t,n],s)=>{n!==t&&(Pe(Re[e],[s],n,t,yt),l=1)})),l&&Pe(Se[e],void 0,yt)}}},St=(e,...t)=>(xl((()=>e(...X(t,T)))),Vl),Tt=()=>gl(U),Vt=()=>il(U),Rt=e=>il(ul(W,T(e))),Ot=e=>Yt(ul(U,T(e))),qt=e=>il(ul(U,T(e))),Mt=(e,t,l,n=0,s)=>{return X(z(G((r=ul(U,T(e)),a=(e,l)=>[P(t)?l:ul(e,T(t)),l],X([...null!=(o=null==r?void 0:r.entries())?o:[]],(([e,t])=>a(t,e)))),(([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(s=t)?s:0)?-1:1)*(l?-1:1);var n,s})),n,P(s)?s:n+s),(([,e])=>e));var r,a,o},Pt=(e,t)=>il(ul(ul(U,T(e)),T(t))),Nt=(e,t,l)=>ul(ul(ul(U,T(e)),T(t)),T(l)),Lt=()=>pl(Y),Et=()=>il(Y),jt=e=>ul(Y,T(e)),zt=()=>!ll(U),$t=e=>tl(U,T(e)),At=(e,t)=>tl(ul(W,T(e)),T(t)),Ft=(e,t)=>tl(ul(U,T(e)),T(t)),Jt=(e,t,l)=>tl(ul(ul(U,T(e)),T(t)),T(l)),Bt=()=>!ll(Y),Dt=e=>tl(Y,T(e)),Qt=e=>St((()=>(e=>he(e,ze,gt))(e)?Ue(e):0)),Ht=e=>St((()=>Fe(e)?lt(e):0)),Wt=e=>{try{We(pe(e))}catch(e){}return Vl},Ut=t=>St((()=>{if((e=he(t,(e=>he(e,Ee))))&&(Qe(t),!ll(U))){const e=Tt();Kt(),Qt(e)}})),Gt=e=>St((()=>{if(t=(e=>he(e,Ee))(e)){const l=Lt();kl(),wl(),t=!0,He(e),Ht(l)}})),Kt=()=>St((()=>Ue({}))),Xt=e=>St((e=>tl(U,e)?at(e):0),e),nl=(e,t)=>St(((e,t)=>N(ul(U,e),(l=>tl(l,t)?ot(e,l,t):0))),e,t),wl=()=>St((()=>lt({}))),Cl=()=>St((()=>{Qe({}),e=!1})),kl=()=>St((()=>{He({}),t=!1})),xl=(e,t)=>{if(-1!=r){Sl();const l=e();return Tl(t),l}},Sl=()=>{var e;return-1!=r&&r++,1==r&&(null==(e=a[0])||e.call(a),Pe(Oe)),Vl},Tl=e=>{var t,s;return r>0&&(r--,0==r&&(r=1,It(1),ll(R)||kt(1),wt(1),ll(q)||xt(1),(null==e?void 0:e(Vl))&&(rl(R,((e,t)=>rl(e,((e,l)=>rl(e,(([e],n)=>Ye(Vl,t,l,n,e))))))),sl(R),rl(q,(([e],t)=>Ze(Vl,t,e))),sl(q)),Pe(qe[0],void 0),r=-1,It(0),ll(R)||kt(0),wt(0),ll(q)||xt(0),null==(t=a[1])||t.call(a),Pe(qe[1],void 0),null==(s=a[2])||s.call(a),r=0,l=zt(),n=Bt(),K([i,h,x,S,V,R,M,O,q,A],sl))),Vl},Vl={getContent:()=>[Tt(),Lt()],getTables:Tt,getTableIds:Vt,getTable:e=>bl(ul(U,T(e))),getTableCellIds:Rt,getRowCount:Ot,getRowIds:qt,getSortedRowIds:Mt,getRow:(e,t)=>pl(ul(ul(U,T(e)),T(t))),getCellIds:Pt,getCell:Nt,getValues:Lt,getValueIds:Et,getValue:jt,hasTables:zt,hasTable:$t,hasTableCell:At,hasRow:Ft,hasCell:Jt,hasValues:Bt,hasValue:Dt,getTablesJson:()=>be(U),getValuesJson:()=>be(Y),getJson:()=>be([U,Y]),getTablesSchemaJson:()=>be(F),getValuesSchemaJson:()=>be(B),getSchemaJson:()=>be([F,B]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>St((()=>je(e)?(([e,t])=>{(ce(e)?Kt:Qt)(e),(ce(t)?wl:Ht)(t)})(e):0)),setTables:Qt,setTable:(e,t)=>St((e=>ze(t,e)?Ge(e,t):0),e),setRow:(e,t,l)=>St(((e,t)=>$e(e,t,l)?Ke(e,rt(e),t,l):0),e,t),addRow:(e,t,l=!0)=>xl((()=>{let n;return $e(e,n,t)&&(e=T(e),Ke(e,rt(e),n=st(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>St(((e,t)=>{if($e(e,t,l,1)){const n=rt(e);de(l,((l,s)=>et(e,n,t,s,l)))}}),e,t),setCell:(e,t,l,n)=>St(((e,t,l)=>N(Ae(e,t,l,E(n)?n(Nt(e,t,l)):n),(n=>et(e,rt(e),t,l,n)))),e,t,l),setValues:Ht,setPartialValues:e=>St((()=>Fe(e,1)?de(e,((e,t)=>nt(t,e))):0)),setValue:(e,t)=>St((e=>N(Je(e,E(t)?t(jt(e)):t),(t=>nt(e,t)))),e),applyChanges:e=>St((()=>{de(e[0],((e,t)=>P(e)?Xt(t):de(e,((e,l)=>P(e)?nl(t,l):de(e,((e,n)=>Ye(Vl,t,l,n,e))))))),de(e[1],((e,t)=>Ze(Vl,t,e)))})),setTablesJson:Wt,setValuesJson:e=>{try{tt(pe(e))}catch(e){}return Vl},setJson:e=>St((()=>{try{const[t,l]=pe(e);We(t),tt(l)}catch(t){Wt(e)}})),setTablesSchema:Ut,setValuesSchema:Gt,setSchema:(e,t)=>St((()=>{Ut(e),Gt(t)})),delTables:Kt,delTable:Xt,delRow:nl,delCell:(e,t,l,n)=>St(((e,t,l)=>N(ul(U,e),(s=>N(ul(s,t),(r=>tl(r,l)?it(e,s,t,r,l,n):0))))),e,t,l),delValues:wl,delValue:e=>St((e=>tl(Y,e)?ut(e):0),e),delTablesSchema:Cl,delValuesSchema:kl,delSchema:()=>St((()=>{Cl(),kl()})),transaction:xl,startTransaction:Sl,getTransactionChanges:()=>[pl(R,((e,t)=>-1===ul(i,t)?void 0:pl(e,((e,l)=>-1===ul(ul(S,t),l)?void 0:pl(e,(([,e])=>e),(e=>Al(e)))),ll,ce)),ll,ce),pl(q,(([,e])=>e),(e=>Al(e))),1],getTransactionLog:()=>[!ll(R),!ll(q),gl(R,$l,Al),gl(M),pl(q,$l,Al),pl(A),pl(i),bl(S),gl(V),pl(O)],finishTransaction:Tl,forEachTable:e=>rl(U,((t,l)=>e(l,(e=>rl(t,((t,l)=>e(l,(e=>dl(t,e))))))))),forEachTableCell:(e,t)=>dl(ul(W,T(e)),t),forEachRow:(e,t)=>rl(ul(U,T(e)),((e,l)=>t(l,(t=>dl(e,t))))),forEachCell:(e,t,l)=>dl(ul(ul(U,T(e)),T(t)),l),forEachValue:e=>dl(Y,e),addSortedRowIdsListener:(e,t,l,n,s,r,a)=>{let o=Mt(e,t,l,n,s);return Me((()=>{const a=Mt(e,t,l,n,s);var i,u,d;u=o,$(i=a)===$(u)&&(d=(e,t)=>u[t]===e,i.every(d))||(o=a,r(Vl,e,t,l,n,s,o))}),ge[a?1:0],[e,t],[Vt])},addStartTransactionListener:e=>Me(e,Oe),addWillFinishTransactionListener:e=>Me(e,qe[0]),addDidFinishTransactionListener:e=>Me(e,qe[1]),callListener:e=>(Le(e),Vl),delListener:e=>(Ne(e),Vl),getListenerStats:()=>({hasTables:jl(_),tables:jl(ee),tableIds:jl(te),hasTable:jl(le),table:jl(ne),tableCellIds:jl(se),hasTableCell:jl(re,_t),rowCount:jl(oe),rowIds:jl(me),sortedRowIds:jl(ge),hasRow:jl(ve,_t),row:jl(fe,_t),cellIds:jl(ye,_t),hasCell:jl(Ie,el),cell:jl(we,el),invalidCell:jl(Ce,el),hasValues:jl(xe),values:jl(Se),valueIds:jl(Te),hasValue:jl(Ve),value:jl(Re),invalidValue:jl(ke),transaction:Zt(Oe)+jl(qe)}),isMergeable:()=>!1,createStore:Jl,addListener:Me,callListeners:Pe,setInternalListeners:(e,t,l,n,s)=>a=[e,t,l,n,s]};return de({[c+p]:[0,_,[],()=>[zt()]],[p]:[0,ee],[b]:[0,te],[c+m]:[1,le,[Vt],e=>[$t(...e)]],[m]:[1,ne,[Vt]],[m+I]:[1,se,[Vt]],[c+m+y]:[2,re,[Vt,Rt],e=>[At(...e)]],[v]:[1,oe,[Vt]],[f]:[1,me,[Vt]],[c+g]:[2,ve,[Vt,qt],e=>[Ft(...e)]],[g]:[2,fe,[Vt,qt]],[I]:[2,ye,[Vt,qt]],[c+y]:[3,Ie,[Vt,qt,Pt],e=>[Jt(...e)]],[y]:[3,we,[Vt,qt,Pt],e=>El(Nt(...e))],InvalidCell:[3,Ce],[c+C]:[0,xe,[],()=>[Bt()]],[C]:[0,Se],[k]:[0,Te],[c+w]:[1,Ve,[Et],e=>[Dt(...e)]],[w]:[1,Re,[Et],e=>El(jt(e[0]))],InvalidValue:[1,ke]},(([e,t,l,n],s)=>{Vl["add"+s+"Listener"]=(...s)=>Me(s[e],t[s[e+1]?1:0],e>0?z(s,0,e):void 0,l,n)})),ae(Vl)};e.Inspector=({position:e="right",open:t=!1})=>{const n=l.useCreateStore(Jl),s=fe.indexOf(e);return l.useCreatePersister(n,(e=>{return t=ge,l=sessionStorage,((e,t,l,n,s,r,a,o={},i=[])=>{let u,d,c,h=0,m=0,p=0;hl(Vl,i,(()=>0)),hl(Rl,i,(()=>[]));const[b,g,v,f,y]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!ce(e)||!ce(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!ce(e)||!ce(t),t.setContent]:A("Store type not supported by this Persister"))(a,e),I=t=>{(b&&j(null==t?void 0:t[0])?1===(null==t?void 0:t[2])?e.applyMergeableChanges:e.setMergeableContent:1===(null==t?void 0:t[2])?e.applyChanges:e.setContent)(t)},w=e=>Tl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield S((()=>Tl(void 0,null,(function*(){try{const e=yield t();j(e)?I(e):A("Content is not an array "+e)}catch(t){e&&y(e)}h=0}))))),T})),C=()=>(d&&(s(d),d=void 0),T),k=e=>Tl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield S((()=>Tl(void 0,null,(function*(){try{yield l(g,e)}catch(e){}h=0}))))),T})),x=()=>(N(c,e.delListener),c=void 0,T),S=(...e)=>Tl(void 0,null,(function*(){return Z(ul(Rl,i),...e),yield Tl(void 0,null,(function*(){if(!ul(Vl,i)){for(cl(Vl,i,1);!P(u=_(ul(Rl,i)));)try{yield u()}catch(e){}cl(Vl,i,0)}})),T})),T=((e,t)=>{for(var l in t||(t={}))kl.call(t,l)&&Sl(e,l,t[l]);if(Cl)for(var l of Cl(t))xl.call(t,l)&&Sl(e,l,t[l]);return e})({load:w,startAutoLoad:e=>Tl(void 0,null,(function*(){yield C().load(e);try{d=yield n(((e,t)=>Tl(void 0,null,(function*(){t||e?2!=h&&(h=1,m++,I(null!=t?t:e),h=0):yield w()}))))}catch(e){}return T})),stopAutoLoad:C,isAutoLoading:()=>!P(d),save:k,startAutoSave:()=>Tl(void 0,null,(function*(){return yield x().save(),c=e.addDidFinishTransactionListener((()=>{const e=v();f(e)&&k(e)})),T})),stopAutoSave:x,isAutoSaving:()=>!P(c),schedule:S,getStore:()=>e,destroy:()=>(ul(Rl,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:p})},o);return ae(T)})(e,(()=>Ol(void 0,null,(function*(){return e=l.getItem(t),pe(e,((e,t)=>""===t?void 0:t));var e}))),(e=>Ol(void 0,null,(function*(){return l.setItem(t,(n=e(),me(n,((e,t)=>void 0===t?"":t))));var n}))),(e=>{const n=n=>{if(n.storageArea===l&&n.key===t)try{e(pe(n.newValue))}catch(t){e()}};return V.addEventListener(ql,n),n}),(e=>V.removeEventListener(ql,e)),0,3,{getStorageName:()=>t});var t,l}),void 0,(e=>{return l=function*(){yield e.load([{},{position:-1==s?1:s,open:!!t}]),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{r(l.next(e))}catch(e){t(e)}},s=e=>{try{r(l.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,s);r((l=l.apply(void 0,null)).next())}));var l})),B(J,null,B("aside",{id:ge},B(Ge,{s:n}),B(Kt,{s:n})),B("style",null,Ue))}},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("../ui-react/index.js")):"function"==typeof define&&define.amd?define(["exports","react","../ui-react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactInspector={},e.React,e.TinyBaseUiReact);
1
+ var e,t;e=this,t=function(e,t,l){"use strict";const n=e=>typeof e,s="",r=n(s),a=n(!0),o=n(0),i=n(n),u="type",d="default",c="Has",h="Ids",m="Table",p=m+"s",b=m+h,g="Row",v=g+"Count",f=g+h,y="Cell",I=y+h,w="Value",C=w+"s",k=w+h,x="currentTarget",S="value",T=e=>s+e,V=globalThis.window,R=Math,O=R.min,q=R.floor,M=isFinite,P=e=>null==e,N=(e,t,l)=>P(e)?null==l?void 0:l():t(e),L=e=>e==r||e==a,E=e=>n(e)==i,j=e=>Array.isArray(e),z=(e,t,l)=>e.slice(t,l),$=e=>e.length,A=e=>{throw Error(e)},{PureComponent:F,Fragment:J,createElement:B,useCallback:D,useLayoutEffect:Q,useRef:H,useState:W}=t,U=(e,...t)=>P(e)?{}:e(...t),G=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),X=(e,t)=>e.map(t),Y=e=>0==$(e),Z=(e,...t)=>e.push(...t),_=e=>e.shift(),ee=Object,te=e=>ee.getPrototypeOf(e),le=ee.entries,ne=ee.isFrozen,se=e=>!P(e)&&N(te(e),(e=>e==ee.prototype||P(te(e))),(()=>!0)),re=ee.keys,ae=ee.freeze,oe=(e=[])=>ee.fromEntries(e),ie=(e,t)=>t in e,ue=(e,t)=>(delete e[t],e),de=(e,t)=>X(le(e),(([e,l])=>t(l,e))),ce=e=>se(e)&&0==(e=>$(re(e)))(e),he=(e,t,l,n=0)=>P(e)||!se(e)||!n&&ce(e)||ne(e)?(null==l||l(),!1):(de(e,((l,n)=>{t(l,n)||ue(e,n)})),!!n||!ce(e)),me=JSON.stringify,pe=JSON.parse,be=e=>me(e,((e,t)=>t instanceof Map?ee.fromEntries([...t]):t)),ge="tinybaseInspector",ve="TinyBase Inspector",fe=["left","top","bottom","right","full"],ye="state",Ie="sort",we="open",Ce="position",ke=we,xe="editable",Se=(...e)=>be(e),Te=(e,t)=>X(G([...e]),t),Ve=(e,t)=>[!!l.useCell(ye,e,xe,t),D((l=>{t.setCell(ye,e,xe,(e=>!e)),l.preventDefault()}),[t,e])],Re="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Oe='content:url("',qe=Oe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Me='</svg>")',Pe=Oe+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Ne=X([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>qe+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+Me)),Le=qe+"<path d='M20 20l60 60M20 80l60-60' />"+Me,Ee=qe+`<path d='${Re}' />`+Me,je=qe+`<path d='${Re}M20 20l60 60' />`+Me;var ze=Object.defineProperty,$e=Object.defineProperties,Ae=Object.getOwnPropertyDescriptors,Fe=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,De=(e,t,l)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Qe=(e,t)=>{for(var l in t||(t={}))Je.call(t,l)&&De(e,l,t[l]);if(Fe)for(var l of Fe(t))Be.call(t,l)&&De(e,l,t[l]);return e},He=(e,t)=>$e(e,Ae(t));const We="*::-webkit-scrollbar",Ue=((e,t="")=>e.join(t))(de(He(Qe(He(Qe(He(Qe({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[We]:"width:0.5rem;height:0.5rem;",[We+"-track"]:"background:#111",[We+"-thumb"]:"background:#999;border:1px solid #111",[We+"-thumb:hover"]:"background:#fff",[We+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+Pe},oe(X(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),oe(X(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Pe,"header>img:nth-of-type(6)":Le}),oe(X(Ne,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":Ee,"details[open]>summary img.done":je,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${ge} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`#${ge} ${t}{${e}}`:""))),Ge=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1,s=l.useSetValueCallback(ke,(()=>!0),[],e);return l.useValue(ke,e)?null:B("img",{onClick:s,title:ve,"data-position":n})},Ke=({uniqueId:e,summary:t,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!l.useCell(ye,e,we,a),i=l.useSetCellCallback(ye,e,we,(e=>e[x].open),[],a);return B("details",{open:o,onToggle:i},B("summary",null,t,s?B("img",{onClick:s,className:n?"done":"edit"}):null),r)},Xe=e=>{const t=n(e);return L(t)||t==o&&M(e)?t:void 0},Ye=(e,t,l,n,s)=>P(s)?e.delCell(t,l,n,!0):e.setCell(t,l,n,s),Ze=(e,t,l)=>P(l)?e.delValue(t):e.setValue(t,l),_e=(e,t,l,n)=>e==r?t:e==o?l:n;var et=Object.defineProperty,tt=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,nt=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable,at=(e,t,l)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,ot=(e,t)=>{for(var l in t||(t={}))st.call(t,l)&&at(e,l,t[l]);if(nt)for(var l of nt(t))rt.call(t,l)&&at(e,l,t[l]);return e},it=(e,t)=>tt(e,lt(t)),ut=(e,t)=>{var l={};for(var n in e)st.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&nt)for(var n of nt(e))t.indexOf(n)<0&&rt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:dt,useMemo:ct,useState:ht}=t,mt="editable",pt=(e,t)=>X(l.useTableCellIds(e,t),(t=>e+"."+t)),bt=(e,t,l)=>{const n=dt(e,t);return l?n:void 0},gt=(...e)=>ct((()=>e),e),vt=(e,t)=>ct((()=>({store:e,tableId:t})),[e,t]),ft=(e,t)=>ct((()=>({queries:e,queryId:t})),[e,t]),yt=(e,t=!1,l,n=0,s,r,a,o)=>{const[[i,u,d],c]=ht([e,t,n]),h=dt((e=>{c(e),null==o||o(e)}),[o]),m=bt((e=>h([e,e==i&&!u,d])),[h,i,u,d],l),p=dt((e=>h([i,u,e])),[h,i,u]),b=!0===a?Pt:a;return[[i,u,d],m,ct((()=>!1===a?null:B(b,{offset:d,limit:s,total:r,onChange:p})),[a,b,d,s,r,p])]},It=(e,t,l)=>ct((()=>{const s=null!=t?t:e;return a=j(s)?oe(X(s,(e=>[e,e]))):s,o=(e,t)=>ot(ot({},{label:t,component:l}),n(e)==r?{label:e}:e),oe(de(a,((e,t)=>[t,o(e,t)])));var a,o}),[t,l,e]),wt=({className:e,headerRow:t,idColumn:l,params:[n,s,r,a,o,i]})=>B("table",{className:e},i?B("caption",null,i):null,!1===t?null:B("thead",null,B("tr",null,!1===l?null:B(Ct,{sort:null!=a?a:[],label:"Id",onClick:o}),de(n,(({label:e},t)=>B(Ct,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:o}))))),B("tbody",null,X(r,(e=>B("tr",{key:e},!1===l?null:B("th",null,e),de(n,(({component:t,getComponentProps:l},n)=>B("td",{key:n},B(t,it(ot(ot({},U(l,e,n)),s),{rowId:e,cellId:n})))))))))),Ct=({cellId:e,sort:[t,l],label:n=(null!=e?e:s),onClick:r})=>B("th",{onClick:bt((()=>null==r?void 0:r(e)),[r,e],r),className:P(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},P(l)||t!=e?null:(l?"↓":"↑")+" ",n),kt=({localRowId:e,params:[n,s,r,a,o,i,u]})=>{const d=l.useRemoteRowId(o,e,i);return B("tr",null,!1===n?null:B(t.Fragment,null,B("th",null,e),B("th",null,d)),de(s,(({component:t,getComponentProps:l},n)=>{const[s,o]=n.split(".",2),i=s===r?e:s===a?d:null;return P(i)?null:B("td",{key:n},B(t,it(ot({},U(l,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},xt=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:s=!0})=>{const[i,u]=ht(),[d,c]=ht(),[h,m]=ht(),[p,b]=ht(),[g,v]=ht();d!==e&&(u(Xe(e)),c(e),m(e+""),b(Number(e)||0),v(!!e));const f=dt(((e,l)=>{l(e),c(e),t(e)}),[t]),y=dt((()=>{if(!(null==n?void 0:n())){const e=_e(i,o,a,r),l=_e(e,h,p,g);u(e),c(l),t(l)}}),[n,t,h,p,g,i]);return B("div",{className:l},s?B("button",{className:i,onClick:y},i):null,_e(i,B("input",{key:i,value:h,onChange:dt((e=>f(e[x][S]+"",m)),[f])}),B("input",{key:i,type:"number",value:p,onChange:dt((e=>f(Number(e[x][S]||0),b)),[f])}),B("input",{key:i,type:"checkbox",checked:g,onChange:dt((e=>f(!!e[x].checked,v)),[f])})))},St=e=>{var t=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=t,p=ut(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,g,v]=yt(s,r,d,a,o,l.useRowCount(n,i),c,h);return B(wt,it(ot({},p),{params:gt(It(l.useTableCellIds(n,i),m,u?qt:l.CellView),vt(i,n),l.useSortedRowIds(n,...b,o,i),b,g,v)}))},Tt=({store:e,editable:t=!1,valueComponent:n=(t?Mt:l.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>B("table",{className:r},!1===a?null:B("thead",null,B("tr",null,!1===o?null:B("th",null,"Id"),B("th",null,w))),B("tbody",null,X(l.useValueIds(e),(t=>B("tr",{key:t},!1===o?null:B("th",null,t),B("td",null,B(n,it(ot({},U(s,t)),{valueId:t,store:e})))))))),Vt=e=>{var t=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=t,i=ut(t,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(l.useIndexesOrIndexesById(r),n);return B(wt,it(ot({},i),{params:gt(It(l.useTableCellIds(c,d),o,a?qt:l.CellView),vt(d,c),l.useSliceRowIds(n,s,u))}))},Rt=({relationshipId:e,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(l.useRelationshipsOrRelationshipsById(n),e),m=It([...pt(c,d),...pt(h,d)],r,s?qt:l.CellView),p=gt(i,m,c,h,e,u,d);return B("table",{className:a},!1===o?null:B("thead",null,B("tr",null,!1===i?null:B(t.Fragment,null,B("th",null,c,".Id"),B("th",null,h,".Id")),de(m,(({label:e},t)=>B("th",{key:t},e))))),B("tbody",null,X(l.useRowIds(c,d),(e=>B(kt,{key:e,localRowId:e,params:p})))))},Ot=e=>{var t=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=t,m=ut(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,b,g]=yt(s,r,u,a,o,l.useResultRowCount(n,i),d,h);return B(wt,it(ot({},m),{params:gt(It(l.useResultTableCellIds(n,i),c,l.ResultCellView),ft(i,n),l.useResultSortedRowIds(n,...p,o,i),p,b,g)}))},qt=({tableId:e,rowId:t,cellId:n,store:s,className:r,showType:a})=>{var o;return B(xt,{thing:l.useCell(e,t,n,s),onThingChange:l.useSetCellCallback(e,t,n,(e=>e),[],s),className:null!=r?r:mt+y,showType:a,hasSchema:null==(o=l.useStoreOrStoreById(s))?void 0:o.hasTablesSchema})},Mt=({valueId:e,store:t,className:n,showType:s})=>{var r;return B(xt,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=n?n:mt+w,showType:s,hasSchema:null==(r=l.useStoreOrStoreById(t))?void 0:r.hasValuesSchema})},Pt=({onChange:e,total:l,offset:n=0,limit:s=l,singular:r="row",plural:a=r+"s"})=>{(n>l||n<0)&&(n=0,e(0));const o=bt((()=>e(n-s)),[e,n,s],n>0),i=bt((()=>e(n+s)),[e,n,s],n+s<l);return B(t.Fragment,null,l>s&&B(t.Fragment,null,B("button",{className:"previous",disabled:0==n,onClick:o},"←"),B("button",{className:"next",disabled:n+s>=l,onClick:i},"→"),n+1," to ",O(l,n+s)," of "),l," ",1!=l?a:r)},Nt=({indexes:e,indexesId:t,indexId:n,s:s})=>B(Ke,{uniqueId:Se("i",t,n),summary:"Index: "+n,s:s},X(l.useSliceIds(n,e),(l=>B(Lt,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),Lt=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:s})=>{const r=Se("i",t,l,n),[a,o]=Ve(r,s);return B(Ke,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},B(Vt,{sliceId:n,indexId:l,indexes:e,editable:a}))},Et=({indexesId:e,s:t})=>{const n=l.useIndexes(e),s=l.useIndexIds(n);return P(n)?null:B(Ke,{uniqueId:Se("i",e),summary:"Indexes: "+(null!=e?e:d),s:t},Y(s)?"No indexes defined":Te(s,(l=>B(Nt,{indexes:n,indexesId:e,indexId:l,s:t,key:l}))))},jt=({metrics:e,metricId:t})=>B("tr",null,B("th",null,t),B("td",null,null==e?void 0:e.getTableId(t)),B("td",null,l.useMetric(t,e))),zt=({metricsId:e,s:t})=>{const n=l.useMetrics(e),s=l.useMetricIds(n);return P(n)?null:B(Ke,{uniqueId:Se("m",e),summary:"Metrics: "+(null!=e?e:d),s:t},Y(s)?"No metrics defined":B("table",null,B("thead",null,B("th",null,"Metric Id"),B("th",null,"Table Id"),B("th",null,"Metric")),B("tbody",null,X(s,(e=>B(jt,{metrics:n,metricId:e,key:e}))))))},$t=({queries:e,queriesId:t,queryId:n,s:s})=>{var r;const a=Se("q",t,n),[o,i,u]=pe(null!=(r=l.useCell(ye,a,Ie,s))?r:"[]"),d=l.useSetCellCallback(ye,a,Ie,be,[],s);return B(Ke,{uniqueId:a,summary:"Query: "+n,s:s},B(Ot,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},At=({queriesId:e,s:t})=>{const n=l.useQueries(e),s=l.useQueryIds(n);return P(n)?null:B(Ke,{uniqueId:Se("q",e),summary:"Queries: "+(null!=e?e:d),s:t},Y(s)?"No queries defined":Te(s,(l=>B($t,{queries:n,queriesId:e,queryId:l,s:t,key:l}))))},Ft=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const s=Se("r",t,l),[r,a]=Ve(s,n);return B(Ke,{uniqueId:s,summary:"Relationship: "+l,editable:r,handleEditable:a,s:n},B(Rt,{relationshipId:l,relationships:e,editable:r}))},Jt=({relationshipsId:e,s:t})=>{const n=l.useRelationships(e),s=l.useRelationshipIds(n);return P(n)?null:B(Ke,{uniqueId:Se("r",e),summary:"Relationships: "+(null!=e?e:d),s:t},Y(s)?"No relationships defined":Te(s,(l=>B(Ft,{relationships:n,relationshipsId:e,relationshipId:l,s:t,key:l}))))},Bt=({tableId:e,store:t,storeId:n,s:s})=>{var r;const a=Se("t",n,e),[o,i,u]=pe(null!=(r=l.useCell(ye,a,Ie,s))?r:"[]"),d=l.useSetCellCallback(ye,a,Ie,be,[],s),[c,h]=Ve(a,s);return B(Ke,{uniqueId:a,summary:m+": "+e,editable:c,handleEditable:h,s:s},B(St,{tableId:e,store:t,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Dt=({store:e,storeId:t,s:n})=>{const s=Se("v",t),[r,a]=Ve(s,n);return Y(l.useValueIds(e))?null:B(Ke,{uniqueId:s,summary:C,editable:r,handleEditable:a,s:n},B(Tt,{store:e,editable:r}))},Qt=({storeId:e,s:t})=>{const n=l.useStore(e),s=l.useTableIds(n);return P(n)?null:B(Ke,{uniqueId:Se("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(null!=e?e:d),s:t},B(Dt,{storeId:e,store:n,s:t}),Te(s,(l=>B(Bt,{store:n,storeId:e,tableId:l,s:t,key:l}))))},Ht=({s:e})=>{const t=H(null),n=H(0),[s,r]=W(!1),{scrollLeft:a,scrollTop:o}=l.useValues(e);Q((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=q(a)+e.clientWidth&&e.scrollHeight>=q(o)+e.clientHeight&&e.scrollTo(a,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,o]);const i=D((t=>{const{scrollLeft:l,scrollTop:s}=t[x];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:l,scrollTop:s})}))}),[e]),u=l.useStore(),d=l.useStoreIds(),c=l.useMetrics(),h=l.useMetricsIds(),m=l.useIndexes(),p=l.useIndexesIds(),b=l.useRelationships(),g=l.useRelationshipsIds(),v=l.useQueries(),f=l.useQueriesIds();return P(u)&&Y(d)&&P(c)&&Y(h)&&P(m)&&Y(p)&&P(b)&&Y(g)&&P(v)&&Y(f)?B("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):B("article",{ref:t,onScroll:i},B(Qt,{s:e}),X(d,(t=>B(Qt,{storeId:t,s:e,key:t}))),B(zt,{s:e}),X(h,(t=>B(zt,{metricsId:t,s:e,key:t}))),B(Et,{s:e}),X(p,(t=>B(Et,{indexesId:t,s:e,key:t}))),B(Jt,{s:e}),X(g,(t=>B(Jt,{relationshipsId:t,s:e,key:t}))),B(At,{s:e}),X(f,(t=>B(At,{queriesId:t,s:e,key:t}))))};var Wt=Object.defineProperty;class Ut extends F{constructor(e){var t,l,n;super(e),n=(e,t)=>console.error(e,t.componentStack),(l="componentDidCatch")in(t=this)?Wt(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?B("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const Gt=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1,s=l.useSetValueCallback(ke,(()=>!1),[],e),r=l.useSetValueCallback(Ce,(e=>Number(e[x].dataset.id)),[],e);return B("header",null,B("img",{title:ve}),B("span",null,ve),X(fe,((e,t)=>t==n?null:B("img",{onClick:r,"data-id":t,title:"Dock to "+e,key:t}))),B("img",{onClick:s,title:"Close"}))},Kt=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1;return l.useValue(ke,e)?B("main",{"data-position":n},B(Gt,{s:e}),B(Ut,null,B(Ht,{s:e}))):null},Xt=e=>t=>{return l=(t,l)=>t+e(l),nl(t).reduce(l,0);var l},Yt=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Zt=Xt(Yt),_t=Xt(Zt),el=Xt(_t),tl=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},ll=e=>P(e)||0==Yt(e),nl=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},sl=e=>e.clear(),rl=(e,t)=>null==e?void 0:e.forEach(t),al=(e,t)=>null==e?void 0:e.delete(t),ol=e=>new Map(e),il=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},ul=(e,t)=>null==e?void 0:e.get(t),dl=(e,t)=>rl(e,((e,l)=>t(l,e))),cl=(e,t,l)=>P(l)?(al(e,t),e):null==e?void 0:e.set(t,l),hl=(e,t,l,n)=>(tl(e,t)?null==n||n(ul(e,t)):cl(e,t,l()),ul(e,t)),ml=(e,t,l,n=cl)=>(de(t,((t,n)=>l(e,n,t))),dl(e,(l=>ie(t,l)?0:n(e,l))),e),pl=(e,t,l,n)=>{const s={};return rl(e,((e,r)=>{if(!(null==l?void 0:l(e,r))){const l=t?t(e,r):e;(null==n?void 0:n(l))||(s[r]=l)}})),s},bl=(e,t,l)=>pl(e,(e=>pl(e,t,l)),ll,ce),gl=(e,t,l)=>pl(e,(e=>bl(e,t,l)),ll,ce),vl=(e,t)=>{const l=ol();return rl(e,((e,n)=>{var s;return l.set(n,null!=(s=null==t?void 0:t(e))?s:e)})),l},fl=e=>vl(e,vl),yl=e=>vl(e,fl),Il=(e,t,l,n,s=0)=>N((l?hl:ul)(e,t[s],s>$(t)-2?l:ol),(r=>{if(s>$(t)-2)return(null==n?void 0:n(r))&&cl(e,t[s]),r;const a=Il(r,t,l,n,s+1);return ll(r)&&cl(e,t[s]),a}));var wl=Object.defineProperty,Cl=Object.getOwnPropertySymbols,kl=Object.prototype.hasOwnProperty,xl=Object.prototype.propertyIsEnumerable,Sl=(e,t,l)=>t in e?wl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Tl=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Vl=ol(),Rl=ol();var Ol=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const ql="storage",Ml=e=>new Set(j(e)||P(e)?e:[e]),Pl=(e,t)=>null==e?void 0:e.add(t),Nl=/^\d+$/,Ll=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?_(e):null)?n:s+t++},t=>{Nl.test(t)&&$(e)<1e3&&Z(e,t)}]},El=e=>[e,e],jl=(e,t=Zt)=>t(e[0])+t(e[1]),zl=()=>[ol(),ol()],$l=e=>[...e],Al=([e,t])=>e===t;ol(X("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(s),((e,t)=>[e,t])));const Fl=(e,t,l)=>cl(e,t,ul(e,t)==-l?void 0:l),Jl=()=>{let e,t,l=!1,n=!1,r=0,a=[];const i=ol(),h=ol(),x=ol(),S=ol(),V=ol(),R=ol(),O=ol(),q=ol(),M=ol(),A=ol(),F=ol(),J=ol(),B=ol(),D=ol(),Q=Ml(),H=ol(),W=ol(),U=ol(),Y=ol(),_=zl(),ee=zl(),te=zl(),le=zl(),ne=zl(),se=zl(),re=zl(),oe=zl(),me=zl(),ge=zl(),ve=zl(),fe=zl(),ye=zl(),Ie=zl(),we=zl(),Ce=zl(),ke=zl(),xe=zl(),Se=zl(),Te=zl(),Ve=zl(),Re=zl(),Oe=ol(),qe=zl(),[Me,Pe,Ne,Le]=(()=>{let e;const[t,l]=Ll(),n=ol();return[(l,r,a,o=[],i=()=>[])=>{null!=e||(e=Vl);const u=t(1);return cl(n,u,[l,r,a,o,i]),Pl(Il(r,null!=a?a:[s],Ml),u),u},(t,l,...r)=>K(((e,t=[s])=>{const l=[],n=(e,s)=>s==$(t)?Z(l,e):null===t[s]?rl(e,(e=>n(e,s+1))):K([t[s],null],(t=>n(ul(e,t),s+1)));return n(e,0),l})(t,l),(t=>rl(t,(t=>ul(n,t)[0](e,...null!=l?l:[],...r))))),e=>N(ul(n,e),(([,t,r])=>(Il(t,null!=r?r:[s],void 0,(t=>(al(t,e),ll(t)?1:0))),cl(n,e),l(e),r))),t=>N(ul(n,t),(([t,,l=[],n,s])=>{const r=(...a)=>{var o,i;const u=$(a);u==$(l)?t(e,...a,...s(a)):P(l[u])?K(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,l[u])};r()}))]})(),Ee=e=>{if(!he(e,((e,t)=>[u,d].includes(t))))return!1;const t=e[u];return!(!L(t)&&t!=o||(Xe(e[d])!=t&&ue(e,d),0))},je=j,ze=(t,l)=>(!e||tl(F,l)||gt(l))&&he(t,((e,t)=>$e(l,t,e)),(()=>gt(l))),$e=(e,t,l,n)=>he(n?l:Be(l,e,t),((n,s)=>N(Ae(e,t,s,n),(e=>(l[s]=e,!0)),(()=>!1))),(()=>gt(e,t))),Ae=(t,l,n,s)=>e?N(ul(ul(F,t),n),(e=>Xe(s)!=e[u]?gt(t,l,n,s,e[d]):s),(()=>gt(t,l,n,s))):P(Xe(s))?gt(t,l,n,s):s,Fe=(e,t)=>he(t?e:De(e),((t,l)=>N(Je(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>vt())),Je=(e,l)=>t?N(ul(B,e),(t=>Xe(l)!=t[u]?vt(e,l,t[d]):l),(()=>vt(e,l))):P(Xe(l))?vt(e,l):l,Be=(e,t,l)=>(N(ul(J,t),(([n,s])=>{rl(n,((t,l)=>{ie(e,l)||(e[l]=t)})),rl(s,(n=>{ie(e,n)||gt(t,l,n)}))})),e),De=e=>(t&&(rl(D,((t,l)=>{ie(e,l)||(e[l]=t)})),rl(Q,(t=>{ie(e,t)||vt(t)}))),e),Qe=e=>ml(F,e,((e,t,l)=>{const n=ol(),s=Ml();ml(hl(F,t,ol),l,((e,t,l)=>{cl(e,t,l),N(l[d],(e=>cl(n,t,e)),(()=>Pl(s,t)))})),cl(J,t,[n,s])}),((e,t)=>{cl(F,t),cl(J,t)})),He=e=>ml(B,e,((e,t,l)=>{cl(B,t,l),N(l[d],(e=>cl(D,t,e)),(()=>Pl(Q,t)))}),((e,t)=>{cl(B,t),cl(D,t),al(Q,t)})),We=e=>ce(e)?Kt():Qt(e),Ue=e=>ml(U,e,((e,t,l)=>Ge(t,l)),((e,t)=>at(t))),Ge=(e,t)=>ml(hl(U,e,(()=>(dt(e,1),cl(H,e,Ll()),cl(W,e,ol()),ol()))),t,((t,l,n)=>Ke(e,t,l,n)),((t,l)=>ot(e,t,l))),Ke=(e,t,l,n,s)=>ml(hl(t,l,(()=>(ct(e,l,1),ol()))),n,((t,n,s)=>_e(e,l,t,n,s)),((n,r)=>it(e,t,l,n,r,s))),_e=(e,t,l,n,s)=>{tl(l,n)||ht(e,t,n,1);const r=ul(l,n);s!==r&&(mt(e,t,n,r,s),cl(l,n,s))},et=(e,t,l,n,s)=>N(ul(t,l),(t=>_e(e,l,t,n,s)),(()=>Ke(e,t,l,Be({[n]:s},e,l)))),tt=e=>ce(e)?wl():Ht(e),lt=e=>ml(Y,e,((e,t,l)=>nt(t,l)),((e,t)=>ut(t))),nt=(e,t)=>{tl(Y,e)||pt(e,1);const l=ul(Y,e);t!==l&&(bt(e,l,t),cl(Y,e,t))},st=(e,t)=>{const[l]=ul(H,e),n=l(t);return tl(ul(U,e),n)?st(e,t):n},rt=e=>{var t;return null!=(t=ul(U,e))?t:Ge(e,{})},at=e=>Ge(e,{}),ot=(e,t,l)=>{const[,n]=ul(H,e);n(l),Ke(e,t,l,{},!0)},it=(e,t,l,n,s,r)=>{var a;const o=ul(null==(a=ul(J,e))?void 0:a[0],s);if(!P(o)&&!r)return _e(e,l,n,s,o);const i=t=>{mt(e,l,t,ul(n,t)),ht(e,l,t,-1),cl(n,t)};P(o)?i(s):dl(n,i),ll(n)&&(ct(e,l,-1),ll(cl(t,l))&&(dt(e,-1),cl(U,e),cl(H,e),cl(W,e)))},ut=e=>{const t=ul(D,e);if(!P(t))return nt(e,t);bt(e,ul(Y,e)),pt(e,-1),cl(Y,e)},dt=(e,t)=>Fl(i,e,t),ct=(e,t,l)=>Fl(hl(S,e,ol),t,l)&&cl(x,e,hl(x,e,(()=>0))+l),ht=(e,t,l,n)=>{var s;const r=ul(W,e),a=null!=(s=ul(r,l))?s:0;(0==a&&1==n||1==a&&-1==n)&&Fl(hl(h,e,ol),l,n),cl(r,l,a!=-n?a+n:null),Fl(hl(hl(V,e,ol),t,ol),l,n)},mt=(e,t,l,n,s)=>{var r;hl(hl(hl(R,e,ol),t,ol),l,(()=>[n,0]))[1]=s,null==(r=a[3])||r.call(a,e,t,l,s)},pt=(e,t)=>Fl(O,e,t),bt=(e,t,l)=>{var n;hl(q,e,(()=>[t,0]))[1]=l,null==(n=a[4])||n.call(a,e,l)},gt=(e,t,l,n,s)=>(Z(hl(hl(hl(M,e,ol),t,ol),l,(()=>[])),n),s),vt=(e,t,l)=>(Z(hl(A,e,(()=>[])),t),l),ft=(e,t,l)=>N(ul(ul(ul(R,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...El(Nt(e,t,l))])),yt=e=>N(ul(q,e),(([e,t])=>[!0,e,t]),(()=>[!1,...El(jt(e))])),It=e=>ll(M)||ll(Ce[e])?0:rl(e?yl(M):M,((t,l)=>rl(t,((t,n)=>rl(t,((t,s)=>Pe(Ce[e],[l,n,s],t))))))),wt=e=>ll(A)||ll(ke[e])?0:rl(e?vl(A):A,((t,l)=>Pe(ke[e],[l],t))),Ct=(e,t,l,n)=>{if(!ll(e))return Pe(t,n,(()=>pl(e))),dl(e,((e,t)=>Pe(l,[...null!=n?n:[],e],1==t))),1},kt=e=>{const t=zt();t!=l&&Pe(_[e],void 0,t);const n=ll(ge[e]),s=ll(ye[e])&&ll(Ie[e])&&ll(me[e])&&ll(ve[e])&&ll(se[e])&&ll(re[e])&&ll(oe[e])&&n&&ll(te[e])&&ll(le[e]),r=ll(we[e])&&ll(fe[e])&&ll(ne[e])&&ll(ee[e]);if(!s||!r){const t=e?[vl(i),fl(h),vl(x),fl(S),yl(V),yl(R)]:[i,h,x,S,V,R];if(!s){Ct(t[0],te[e],le[e]),rl(t[1],((t,l)=>Ct(t,se[e],re[e],[l]))),rl(t[2],((t,l)=>{0!=t&&Pe(oe[e],[l],Ot(l))}));const l=Ml();rl(t[3],((t,s)=>{Ct(t,me[e],ve[e],[s])&&!n&&(Pe(ge[e],[s,null]),Pl(l,s))})),n||rl(t[5],((t,n)=>{if(!tl(l,n)){const l=Ml();rl(t,(e=>rl(e,(([t,n],s)=>n!==t?Pl(l,s):al(e,s))))),rl(l,(t=>Pe(ge[e],[n,t])))}})),rl(t[4],((t,l)=>rl(t,((t,n)=>Ct(t,ye[e],Ie[e],[l,n])))))}if(!r){let l;rl(t[5],((t,n)=>{let s;rl(t,((t,r)=>{let a;rl(t,(([t,o],i)=>{o!==t&&(Pe(we[e],[n,r,i],o,t,ft),l=s=a=1)})),a&&Pe(fe[e],[n,r],ft)})),s&&Pe(ne[e],[n],ft)})),l&&Pe(ee[e],void 0,ft)}}},xt=e=>{const t=Bt();t!=n&&Pe(xe[e],void 0,t);const l=ll(Te[e])&&ll(Ve[e]),s=ll(Re[e])&&ll(Se[e]);if(!l||!s){const t=e?[vl(O),vl(q)]:[O,q];if(l||Ct(t[0],Te[e],Ve[e]),!s){let l;rl(t[1],(([t,n],s)=>{n!==t&&(Pe(Re[e],[s],n,t,yt),l=1)})),l&&Pe(Se[e],void 0,yt)}}},St=(e,...t)=>(xl((()=>e(...X(t,T)))),Vl),Tt=()=>gl(U),Vt=()=>il(U),Rt=e=>il(ul(W,T(e))),Ot=e=>Yt(ul(U,T(e))),qt=e=>il(ul(U,T(e))),Mt=(e,t,l,n=0,s)=>{return X(z(G((r=ul(U,T(e)),a=(e,l)=>[P(t)?l:ul(e,T(t)),l],X([...null!=(o=null==r?void 0:r.entries())?o:[]],(([e,t])=>a(t,e)))),(([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(s=t)?s:0)?-1:1)*(l?-1:1);var n,s})),n,P(s)?s:n+s),(([,e])=>e));var r,a,o},Pt=(e,t)=>il(ul(ul(U,T(e)),T(t))),Nt=(e,t,l)=>ul(ul(ul(U,T(e)),T(t)),T(l)),Lt=()=>pl(Y),Et=()=>il(Y),jt=e=>ul(Y,T(e)),zt=()=>!ll(U),$t=e=>tl(U,T(e)),At=(e,t)=>tl(ul(W,T(e)),T(t)),Ft=(e,t)=>tl(ul(U,T(e)),T(t)),Jt=(e,t,l)=>tl(ul(ul(U,T(e)),T(t)),T(l)),Bt=()=>!ll(Y),Dt=e=>tl(Y,T(e)),Qt=e=>St((()=>(e=>he(e,ze,gt))(e)?Ue(e):0)),Ht=e=>St((()=>Fe(e)?lt(e):0)),Wt=e=>{try{We(pe(e))}catch(e){}return Vl},Ut=t=>St((()=>{if((e=he(t,(e=>he(e,Ee))))&&(Qe(t),!ll(U))){const e=Tt();Kt(),Qt(e)}})),Gt=e=>St((()=>{if(t=(e=>he(e,Ee))(e)){const l=Lt();kl(),wl(),t=!0,He(e),Ht(l)}})),Kt=()=>St((()=>Ue({}))),Xt=e=>St((e=>tl(U,e)?at(e):0),e),nl=(e,t)=>St(((e,t)=>N(ul(U,e),(l=>tl(l,t)?ot(e,l,t):0))),e,t),wl=()=>St((()=>lt({}))),Cl=()=>St((()=>{Qe({}),e=!1})),kl=()=>St((()=>{He({}),t=!1})),xl=(e,t)=>{if(-1!=r){Sl();const l=e();return Tl(t),l}},Sl=()=>{var e;return-1!=r&&r++,1==r&&(null==(e=a[0])||e.call(a),Pe(Oe)),Vl},Tl=e=>{var t,s;return r>0&&(r--,0==r&&(r=1,It(1),ll(R)||kt(1),wt(1),ll(q)||xt(1),(null==e?void 0:e(Vl))&&(rl(R,((e,t)=>rl(e,((e,l)=>rl(e,(([e],n)=>Ye(Vl,t,l,n,e))))))),sl(R),rl(q,(([e],t)=>Ze(Vl,t,e))),sl(q)),Pe(qe[0],void 0),r=-1,It(0),ll(R)||kt(0),wt(0),ll(q)||xt(0),null==(t=a[1])||t.call(a),Pe(qe[1],void 0),null==(s=a[2])||s.call(a),r=0,l=zt(),n=Bt(),K([i,h,x,S,V,R,M,O,q,A],sl))),Vl},Vl={getContent:()=>[Tt(),Lt()],getTables:Tt,getTableIds:Vt,getTable:e=>bl(ul(U,T(e))),getTableCellIds:Rt,getRowCount:Ot,getRowIds:qt,getSortedRowIds:Mt,getRow:(e,t)=>pl(ul(ul(U,T(e)),T(t))),getCellIds:Pt,getCell:Nt,getValues:Lt,getValueIds:Et,getValue:jt,hasTables:zt,hasTable:$t,hasTableCell:At,hasRow:Ft,hasCell:Jt,hasValues:Bt,hasValue:Dt,getTablesJson:()=>be(U),getValuesJson:()=>be(Y),getJson:()=>be([U,Y]),getTablesSchemaJson:()=>be(F),getValuesSchemaJson:()=>be(B),getSchemaJson:()=>be([F,B]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>St((()=>je(e)?(([e,t])=>{(ce(e)?Kt:Qt)(e),(ce(t)?wl:Ht)(t)})(e):0)),setTables:Qt,setTable:(e,t)=>St((e=>ze(t,e)?Ge(e,t):0),e),setRow:(e,t,l)=>St(((e,t)=>$e(e,t,l)?Ke(e,rt(e),t,l):0),e,t),addRow:(e,t,l=!0)=>xl((()=>{let n;return $e(e,n,t)&&(e=T(e),Ke(e,rt(e),n=st(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>St(((e,t)=>{if($e(e,t,l,1)){const n=rt(e);de(l,((l,s)=>et(e,n,t,s,l)))}}),e,t),setCell:(e,t,l,n)=>St(((e,t,l)=>N(Ae(e,t,l,E(n)?n(Nt(e,t,l)):n),(n=>et(e,rt(e),t,l,n)))),e,t,l),setValues:Ht,setPartialValues:e=>St((()=>Fe(e,1)?de(e,((e,t)=>nt(t,e))):0)),setValue:(e,t)=>St((e=>N(Je(e,E(t)?t(jt(e)):t),(t=>nt(e,t)))),e),applyChanges:e=>St((()=>{de(e[0],((e,t)=>P(e)?Xt(t):de(e,((e,l)=>P(e)?nl(t,l):de(e,((e,n)=>Ye(Vl,t,l,n,e))))))),de(e[1],((e,t)=>Ze(Vl,t,e)))})),setTablesJson:Wt,setValuesJson:e=>{try{tt(pe(e))}catch(e){}return Vl},setJson:e=>St((()=>{try{const[t,l]=pe(e);We(t),tt(l)}catch(t){Wt(e)}})),setTablesSchema:Ut,setValuesSchema:Gt,setSchema:(e,t)=>St((()=>{Ut(e),Gt(t)})),delTables:Kt,delTable:Xt,delRow:nl,delCell:(e,t,l,n)=>St(((e,t,l)=>N(ul(U,e),(s=>N(ul(s,t),(r=>tl(r,l)?it(e,s,t,r,l,n):0))))),e,t,l),delValues:wl,delValue:e=>St((e=>tl(Y,e)?ut(e):0),e),delTablesSchema:Cl,delValuesSchema:kl,delSchema:()=>St((()=>{Cl(),kl()})),transaction:xl,startTransaction:Sl,getTransactionChanges:()=>[pl(R,((e,t)=>-1===ul(i,t)?void 0:pl(e,((e,l)=>-1===ul(ul(S,t),l)?void 0:pl(e,(([,e])=>e),(e=>Al(e)))),ll,ce)),ll,ce),pl(q,(([,e])=>e),(e=>Al(e))),1],getTransactionLog:()=>[!ll(R),!ll(q),gl(R,$l,Al),gl(M),pl(q,$l,Al),pl(A),pl(i),bl(S),gl(V),pl(O)],finishTransaction:Tl,forEachTable:e=>rl(U,((t,l)=>e(l,(e=>rl(t,((t,l)=>e(l,(e=>dl(t,e))))))))),forEachTableCell:(e,t)=>dl(ul(W,T(e)),t),forEachRow:(e,t)=>rl(ul(U,T(e)),((e,l)=>t(l,(t=>dl(e,t))))),forEachCell:(e,t,l)=>dl(ul(ul(U,T(e)),T(t)),l),forEachValue:e=>dl(Y,e),addSortedRowIdsListener:(e,t,l,n,s,r,a)=>{let o=Mt(e,t,l,n,s);return Me((()=>{const a=Mt(e,t,l,n,s);var i,u,d;u=o,$(i=a)===$(u)&&(d=(e,t)=>u[t]===e,i.every(d))||(o=a,r(Vl,e,t,l,n,s,o))}),ge[a?1:0],[e,t],[Vt])},addStartTransactionListener:e=>Me(e,Oe),addWillFinishTransactionListener:e=>Me(e,qe[0]),addDidFinishTransactionListener:e=>Me(e,qe[1]),callListener:e=>(Le(e),Vl),delListener:e=>(Ne(e),Vl),getListenerStats:()=>({hasTables:jl(_),tables:jl(ee),tableIds:jl(te),hasTable:jl(le),table:jl(ne),tableCellIds:jl(se),hasTableCell:jl(re,_t),rowCount:jl(oe),rowIds:jl(me),sortedRowIds:jl(ge),hasRow:jl(ve,_t),row:jl(fe,_t),cellIds:jl(ye,_t),hasCell:jl(Ie,el),cell:jl(we,el),invalidCell:jl(Ce,el),hasValues:jl(xe),values:jl(Se),valueIds:jl(Te),hasValue:jl(Ve),value:jl(Re),invalidValue:jl(ke),transaction:Zt(Oe)+jl(qe)}),isMergeable:()=>!1,createStore:Jl,addListener:Me,callListeners:Pe,setInternalListeners:(e,t,l,n,s)=>a=[e,t,l,n,s]};return de({[c+p]:[0,_,[],()=>[zt()]],[p]:[0,ee],[b]:[0,te],[c+m]:[1,le,[Vt],e=>[$t(...e)]],[m]:[1,ne,[Vt]],[m+I]:[1,se,[Vt]],[c+m+y]:[2,re,[Vt,Rt],e=>[At(...e)]],[v]:[1,oe,[Vt]],[f]:[1,me,[Vt]],[c+g]:[2,ve,[Vt,qt],e=>[Ft(...e)]],[g]:[2,fe,[Vt,qt]],[I]:[2,ye,[Vt,qt]],[c+y]:[3,Ie,[Vt,qt,Pt],e=>[Jt(...e)]],[y]:[3,we,[Vt,qt,Pt],e=>El(Nt(...e))],InvalidCell:[3,Ce],[c+C]:[0,xe,[],()=>[Bt()]],[C]:[0,Se],[k]:[0,Te],[c+w]:[1,Ve,[Et],e=>[Dt(...e)]],[w]:[1,Re,[Et],e=>El(jt(e[0]))],InvalidValue:[1,ke]},(([e,t,l,n],s)=>{Vl["add"+s+"Listener"]=(...s)=>Me(s[e],t[s[e+1]?1:0],e>0?z(s,0,e):void 0,l,n)})),ae(Vl)};e.Inspector=({position:e="right",open:t=!1})=>{const n=l.useCreateStore(Jl),s=fe.indexOf(e);return l.useCreatePersister(n,(e=>{return t=ge,l=sessionStorage,((e,t,l,n,s,r,a,o={},i=[])=>{let u,d,c,h=0,m=0,p=0;hl(Vl,i,(()=>0)),hl(Rl,i,(()=>[]));const[b,g,v,f,y]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!ce(e)||!ce(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!ce(e)||!ce(t),t.setContent]:A("Store type not supported by this Persister"))(a,e),I=t=>{(b&&j(null==t?void 0:t[0])?1===(null==t?void 0:t[2])?e.applyMergeableChanges:e.setMergeableContent:1===(null==t?void 0:t[2])?e.applyChanges:e.setContent)(t)},w=e=>Tl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield S((()=>Tl(void 0,null,(function*(){try{const e=yield t();j(e)?I(e):A("Content is not an array "+e)}catch(t){e&&y(e)}h=0}))))),T})),C=()=>(d&&(s(d),d=void 0),T),k=e=>Tl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield S((()=>Tl(void 0,null,(function*(){try{yield l(g,e)}catch(e){}h=0}))))),T})),x=()=>(N(c,e.delListener),c=void 0,T),S=(...e)=>Tl(void 0,null,(function*(){return Z(ul(Rl,i),...e),yield Tl(void 0,null,(function*(){if(!ul(Vl,i)){for(cl(Vl,i,1);!P(u=_(ul(Rl,i)));)try{yield u()}catch(e){}cl(Vl,i,0)}})),T})),T=((e,t)=>{for(var l in t||(t={}))kl.call(t,l)&&Sl(e,l,t[l]);if(Cl)for(var l of Cl(t))xl.call(t,l)&&Sl(e,l,t[l]);return e})({load:w,startAutoLoad:e=>Tl(void 0,null,(function*(){yield C().load(e);try{d=yield n(((e,t)=>Tl(void 0,null,(function*(){t||e?2!=h&&(h=1,m++,I(null!=t?t:e),h=0):yield w()}))))}catch(e){}return T})),stopAutoLoad:C,isAutoLoading:()=>!P(d),save:k,startAutoSave:()=>Tl(void 0,null,(function*(){return yield x().save(),c=e.addDidFinishTransactionListener((()=>{const e=v();f(e)&&k(e)})),T})),stopAutoSave:x,isAutoSaving:()=>!P(c),schedule:S,getStore:()=>e,destroy:()=>(ul(Rl,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:p})},o);return ae(T)})(e,(()=>Ol(void 0,null,(function*(){return e=l.getItem(t),pe(e,((e,t)=>""===t?void 0:t));var e}))),(e=>Ol(void 0,null,(function*(){return l.setItem(t,(n=e(),me(n,((e,t)=>void 0===t?"":t))));var n}))),(e=>{const n=n=>{if(n.storageArea===l&&n.key===t)try{e(pe(n.newValue))}catch(t){e()}};return V.addEventListener(ql,n),n}),(e=>V.removeEventListener(ql,e)),0,3,{getStorageName:()=>t});var t,l}),void 0,(e=>{return l=function*(){yield e.load([{},{position:-1==s?1:s,open:!!t}]),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{r(l.next(e))}catch(e){t(e)}},s=e=>{try{r(l.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,s);r((l=l.apply(void 0,null)).next())}));var l})),B(J,null,B("aside",{id:ge},B(Ge,{s:n}),B(Kt,{s:n})),B("style",null,Ue))}},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("../ui-react/index.js")):"function"==typeof define&&define.amd?define(["exports","react","../ui-react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactInspector={},e.React,e.TinyBaseUiReact);