tinybase 5.0.0-beta.15 → 5.0.0-beta.16

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.
@@ -1 +1 @@
1
- "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r=s(s),u="Listener",l="Result",n="Has",d="Ids",p="Table",a=p+"s",i=p+d,x="Row",c=x+"Count",I=x+d,C="Sorted"+x+d,b="Cell",w=b+d,R="Value",k=R+"s",g=R+d,L=e=>null==e,h=(e,s,t)=>L(e)?t?.():s(e),y=e=>s(e)==o,m=e=>s(e)==r,S=e=>e.length,V=()=>{},T=(e,s)=>e.every(s),P=(e,s)=>S(e)===S(s)&&T(e,((e,t)=>s[t]===e)),f=(e,s)=>e.map(s),v=Object,q=e=>v.getPrototypeOf(e),B=v.entries,H=e=>!L(e)&&h(q(e),(e=>e==v.prototype||L(q(e))),(()=>!0)),M=v.keys,D=(e,s)=>h(e,(e=>e[s])),F=(e,s)=>(delete e[s],e),O=(e,s)=>{const t=B(e);return S(t)===S(M(s))&&T(t,(([e,t])=>H(t)?!!H(s[e])&&O(s[e],t):s[e]===t))},{createContext:Q,useContext:E,useEffect:A}=e,G=Q([]),W=(e,s)=>{const t=E(G);return L(e)?t[s]:y(e)?D(t[s+1]??{},e):e},j=(e,s)=>{const t=W(e,s);return L(e)||y(e)?t:e},z=e=>M(E(G)[e]??{}),U=e=>j(e,0),J=e=>j(e,2),K=e=>j(e,4),N=e=>j(e,6),X=e=>j(e,8),Y=e=>j(e,10),Z=e=>e.toLowerCase();Z(u);const $="Transaction";Z($);const{useCallback:_,useEffect:ee,useMemo:se,useLayoutEffect:te,useRef:oe,useState:re,useSyncExternalStore:ue}=e,le=[],ne=[{},[],[le,void 0,le],void 0,!1,0],de=(e,s)=>e===s,pe=[O,P,([e,s,t],[o,r,u])=>s===r&&P(e,o)&&P(t,u)],ae=(e,s,t=le)=>{const[,o]=re(),[r,u]=re();return ee((()=>{const t=s(e);return u(t),o([]),t.destroy}),[e,...t]),r},ie=(e,s,...t)=>{const o=e?.["add"+s+u]?.(...t);return()=>e?.delListener(o)},xe=(e,s,o,r=le)=>{const u=oe(ne[o]),l=_((()=>{const t=s?.[(4==o?"has":"get")+e]?.(...r)??ne[o];return(pe[o]??de)(t,u.current)?u.current:u.current=t}),[s,o,e,...r]),d=_((u=>ie(s,(4==o?n:t)+e,...r,u)),[s,o,e,...r]);return ue(d,l)},ce=(e,s,t,o=le,r=le,...u)=>te((()=>ie(s,e,...r,t,...u)),[s,e,...r,...o,...u]),Ie=(e,s,t,o=le,r=V,u=le,...l)=>{const n=U(e);return _((e=>h(n,(o=>h(t(e,o),(t=>r(o["set"+s](...f(l,(s=>m(s)?s(e,o):s)),t),t)))))),[n,s,...o,...u,...l])},Ce=(e,s,t=V,o=le,...r)=>{const u=U(e);return _((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},be=(e,s,t)=>{const o=Y(e);return _((()=>o?.[s](t)),[o,s,t])},we=e=>xe(i,U(e),1),Re=(e,s)=>xe(I,U(s),1,[e]),ke=(e,s,t,o=0,r,u)=>xe(C,U(u),1,[e,s,t,o,r]),ge=(e,s,t)=>xe(w,U(t),1,[e,s]),Le=(e,s,t,o)=>xe(b,U(o),3,[e,s,t]),he=e=>xe(g,U(e),1),ye=(e,s)=>xe(R,U(s),3,[e]),me=(e,s)=>xe("Metric",J(s),3,[e]),Se=(e,s)=>xe("SliceIds",K(s),1,[e]),Ve=(e,s,t)=>xe("Slice"+I,K(t),1,[e,s]),Te=(e,s,t)=>xe("RemoteRowId",N(t),3,[e,s]),Pe=(e,s,t)=>xe("Local"+I,N(t),1,[e,s]),fe=(e,s,t)=>xe("Linked"+I,N(t),1,[e,s]),ve=(e,s)=>xe(l+I,X(s),1,[e]),qe=(e,s,t,o=0,r,u)=>xe(l+C,X(u),1,[e,s,t,o,r]),Be=(e,s,t)=>xe(l+w,X(t),1,[e,s]),He=(e,s,t,o)=>xe(l+b,X(o),3,[e,s,t]),Me=e=>xe("CheckpointIds",Y(e),2),De=(e,s)=>xe("Checkpoint",Y(s),3,[e]),Fe=e=>be(e,"goBackward"),Oe=e=>be(e,"goForward"),{PureComponent:Qe,Fragment:Ee,createElement:Ae,useCallback:Ge,useLayoutEffect:We,useRef:je,useState:ze}=e,Ue=(e,...s)=>L(e)?{}:e(...s),Je=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:Ke,useContext:Ne,useMemo:Xe,useState:Ye}=e,Ze=({tableId:e,store:s,rowComponent:t=os,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},n)=>ss(f(n,(u=>Ae(t,{...Ue(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),$e=({queryId:e,queries:s,resultRowComponent:t=ds,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>ss(f(l,(r=>Ae(t,{...Ue(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),_e=({relationshipId:e,relationships:s,rowComponent:t=os,getRowComponentProps:o,separator:r,debugIds:u},l,n)=>{const[d,p,a]=Je(N(s),e),i=l(e,n,d);return ss(f(i,(e=>Ae(t,{...Ue(o,e),key:e,tableId:a,rowId:e,store:p,debugIds:u}))),r,u,n)},es=e=>({checkpoints:s,checkpointComponent:t=ps,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=Y(s);return ss(f(e(Me(l)),(e=>Ae(t,{...Ue(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},ss=(e,s,t,o)=>{const r=L(s)||!Array.isArray(e)?e:f(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},ts=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>ss(t+(Le(e,s,o,r)??t),void 0,u,o),os=({tableId:e,rowId:s,store:t,cellComponent:o=ts,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:n})=>ss(f(((e,s,t,o)=>{const r=ge(s,t,o);return e??r})(u,e,s,t),(u=>Ae(o,{...Ue(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:n}))),l,n,s),rs=e=>Ze(e,Re(e.tableId,e.store)),us=({valueId:e,store:s,debugIds:o})=>ss(t+(ye(e,s)??t),void 0,o,e),ls=({indexId:e,sliceId:s,indexes:t,rowComponent:o=os,getRowComponentProps:r,separator:u,debugIds:l})=>{const[n,d,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(K(t),e),a=Ve(e,s,n);return ss(f(a,(e=>Ae(o,{...Ue(r,e),key:e,tableId:p,rowId:e,store:d,debugIds:l}))),u,l,s)},ns=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>ss(t+(He(e,s,o,r)??t),void 0,u,o),ds=({queryId:e,rowId:s,queries:t,resultCellComponent:o=ns,getResultCellComponentProps:r,separator:u,debugIds:l})=>ss(f(Be(e,s,t),(u=>Ae(o,{...Ue(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),ps=({checkpoints:e,checkpointId:s,debugIds:o})=>ss(De(s,e)??t,void 0,o,s),as=es((e=>e[0])),is=es((e=>L(e[1])?[]:[e[1]])),xs=es((e=>e[2]));exports.BackwardCheckpointsView=as,exports.CellView=ts,exports.CheckpointView=ps,exports.CurrentCheckpointView=is,exports.ForwardCheckpointsView=xs,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=ls,getSliceComponentProps:o,separator:r,debugIds:u})=>ss(f(Se(e,s),(r=>Ae(t,{...Ue(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>_e(e,fe,e.firstRowId),exports.LocalRowsView=e=>_e(e,Pe,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>ss(me(e,s)??t,void 0,o,e),exports.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:n,queries:d,queriesById:p,checkpoints:a,checkpointsById:i,children:x})=>{const c=Ne(G),[I,C]=Ye({}),b=Ke(((e,s)=>C((t=>D(t,e)==s?t:{...t,[e]:s}))),[]),w=Ke((e=>C((s=>({...F(s,e)})))),[]);return Ae(G.Provider,{value:Xe((()=>[e??c[0],{...c[1],...s,...I},t??c[2],{...c[3],...o},r??c[4],{...c[5],...u},l??c[6],{...c[7],...n},d??c[8],{...c[9],...p},a??c[10],{...c[11],...i},b,w]),[e,s,I,t,o,r,u,l,n,d,p,a,i,c,b,w])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=os,getRowComponentProps:r,debugIds:u})=>{const[l,n,,d]=Je(N(t),e),p=Te(e,s,l);return ss(L(d)||L(p)?null:Ae(o,{...Ue(r,p),key:p,tableId:d,rowId:p,store:n,debugIds:u}),void 0,u,s)},exports.ResultCellView=ns,exports.ResultRowView=ds,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>$e(r,qe(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>$e(e,ve(e.queryId,e.queries)),exports.RowView=os,exports.SliceView=ls,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Ze(r,ke(r.tableId,e,s,t,o,r.store)),exports.TableView=rs,exports.TablesView=({store:e,tableComponent:s=rs,getTableComponentProps:t,separator:o,debugIds:r})=>ss(f(we(e),(o=>Ae(s,{...Ue(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=us,exports.ValuesView=({store:e,valueComponent:s=us,getValueComponentProps:t,separator:o,debugIds:r})=>ss(f(he(e),(o=>Ae(s,{...Ue(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=le,o,r=V,u=le,l=!0)=>{const n=U(o);return _((t=>h(n,(o=>h(s(t,o),(s=>r(o.addRow(m(e)?e(t,o):e,s,l),o,s)))))),[n,e,...t,...u,l])},exports.useCell=Le,exports.useCellIds=ge,exports.useCellIdsListener=(e,s,t,o,r,u)=>ce(w,U(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,l)=>ce(b,U(l),o,r,[e,s,t],u),exports.useCheckpoint=De,exports.useCheckpointIds=Me,exports.useCheckpointIdsListener=(e,s,t)=>ce("CheckpointIds",Y(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>ce("Checkpoint",Y(o),s,t,[e]),exports.useCheckpoints=e=>W(e,10),exports.useCheckpointsIds=()=>z(11),exports.useCheckpointsOrCheckpointsById=Y,exports.useCreateCheckpoints=(e,s,t)=>ae(e,s,t),exports.useCreateIndexes=(e,s,t)=>ae(e,s,t),exports.useCreateMergeableStore=(e,s=le)=>se(e,s),exports.useCreateMetrics=(e,s,t)=>ae(e,s,t),exports.useCreatePersister=(e,s,t=le,o,r=le,u,l=le)=>{const[,n]=re(),[d,p]=re();return ee((()=>{const t=s(e);p(t),t&&o&&(async()=>{await o(t),n([])})()}),[e,...t,...r]),ee((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),d},exports.useCreateQueries=(e,s,t)=>ae(e,s,t),exports.useCreateRelationships=(e,s,t)=>ae(e,s,t),exports.useCreateStore=(e,s=le)=>se(e,s),exports.useCreateSynchronizer=(e,s,t=le,o,r=le)=>{const[u,l]=re();return ee((()=>{(async()=>{const t=await s(e);l(t)})()}),[e,...t]),ee((()=>()=>{u&&(u.destroy(),o?.(u))}),[u,...r]),u},exports.useDelCellCallback=(e,s,t,o,r,u,l)=>Ce(r,b,u,l,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>Ce(t,x,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>Ce(s,p,t,o,e),exports.useDelTablesCallback=(e,s,t)=>Ce(e,a,s,t),exports.useDelValueCallback=(e,s,t,o)=>Ce(s,R,t,o,e),exports.useDelValuesCallback=(e,s,t)=>Ce(e,k,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>ce("DidFinish"+$,U(t),e,s),exports.useGoBackwardCallback=Fe,exports.useGoForwardCallback=Oe,exports.useGoToCallback=(e,s=le,t,o=V,r=le)=>{const u=Y(t);return _((s=>h(u,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useHasCell=(e,s,t,o)=>xe(b,U(o),4,[e,s,t]),exports.useHasCellListener=(e,s,t,o,r,u,l)=>ce(n+b,U(l),o,r,[e,s,t],u),exports.useHasRow=(e,s,t)=>xe(x,U(t),4,[e,s]),exports.useHasRowListener=(e,s,t,o,r,u)=>ce(n+x,U(u),t,o,[e,s],r),exports.useHasTable=(e,s)=>xe(p,U(s),4,[e]),exports.useHasTableCell=(e,s,t)=>xe(p+b,U(t),4,[e,s]),exports.useHasTableCellListener=(e,s,t,o,r,u)=>ce(n+p+b,U(u),t,o,[e,s],r),exports.useHasTableListener=(e,s,t,o,r)=>ce(n+p,U(r),s,t,[e],o),exports.useHasTables=e=>xe(a,U(e),4,[]),exports.useHasTablesListener=(e,s,t,o)=>ce(n+a,U(o),e,s,[],t),exports.useHasValue=(e,s)=>xe(R,U(s),4,[e]),exports.useHasValueListener=(e,s,t,o,r)=>ce(n+R,U(r),s,t,[e],o),exports.useHasValues=e=>xe(k,U(e),4,[]),exports.useHasValuesListener=(e,s,t,o)=>ce(n+k,U(o),e,s,[],t),exports.useIndexIds=e=>xe("IndexIds",K(e),1),exports.useIndexes=e=>W(e,4),exports.useIndexesIds=()=>z(5),exports.useIndexesOrIndexesById=K,exports.useLinkedRowIds=fe,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>ce("Linked"+I,N(r),t,o,[e,s]),exports.useLocalRowIds=Pe,exports.useLocalRowIdsListener=(e,s,t,o,r)=>ce("Local"+I,N(r),t,o,[e,s]),exports.useMetric=me,exports.useMetricIds=e=>xe("MetricIds",J(e),1),exports.useMetricListener=(e,s,t,o)=>ce("Metric",J(o),s,t,[e]),exports.useMetrics=e=>W(e,2),exports.useMetricsIds=()=>z(3),exports.useMetricsOrMetricsById=J,exports.useProvideStore=(e,s)=>{const{12:t,13:o}=E(G);A((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},exports.useQueries=e=>W(e,8),exports.useQueriesIds=()=>z(9),exports.useQueriesOrQueriesById=X,exports.useQueryIds=e=>xe("QueryIds",X(e),1),exports.useRedoInformation=e=>{const s=Y(e),[,,[o]]=Me(s);return[!L(o),Oe(s),o,h(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>xe("RelationshipIds",N(e),1),exports.useRelationships=e=>W(e,6),exports.useRelationshipsIds=()=>z(7),exports.useRelationshipsOrRelationshipsById=N,exports.useRemoteRowId=Te,exports.useRemoteRowIdListener=(e,s,t,o,r)=>ce("RemoteRowId",N(r),t,o,[e,s]),exports.useResultCell=He,exports.useResultCellIds=Be,exports.useResultCellIdsListener=(e,s,t,o,r)=>ce(l+w,X(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,u)=>ce(l+b,X(u),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>xe(l+x,X(t),0,[e,s]),exports.useResultRowCount=(e,s)=>xe(l+c,X(s),5,[e]),exports.useResultRowCountListener=(e,s,t,o)=>ce(l+c,X(o),s,t,[e]),exports.useResultRowIds=ve,exports.useResultRowIdsListener=(e,s,t,o)=>ce(l+I,X(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>ce(l+x,X(r),t,o,[e,s]),exports.useResultSortedRowIds=qe,exports.useResultSortedRowIdsListener=(e,s,t,o,r,u,n,d)=>ce(l+C,X(d),u,n,[e,s,t,o,r]),exports.useResultTable=(e,s)=>xe(l+p,X(s),0,[e]),exports.useResultTableCellIds=(e,s)=>xe(l+p+w,X(s),1,[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>ce(l+p+w,X(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>ce(l+p,X(o),s,t,[e]),exports.useRow=(e,s,t)=>xe(x,U(t),0,[e,s]),exports.useRowCount=(e,s)=>xe(c,U(s),5,[e]),exports.useRowCountListener=(e,s,t,o,r)=>ce(c,U(r),s,t,[e],o),exports.useRowIds=Re,exports.useRowIdsListener=(e,s,t,o,r)=>ce(I,U(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>ce(x,U(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,l,n)=>Ie(u,b,o,r,l,n,e,s,t),exports.useSetCheckpointCallback=(e=V,s=le,t,o=V,r=le)=>{const u=Y(t);return _((s=>h(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>Ie(r,"PartialRow",t,o,u,l,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>Ie(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,l)=>Ie(r,x,t,o,u,l,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>Ie(o,p,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>Ie(t,a,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>Ie(o,R,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>Ie(t,k,e,s,o,r),exports.useSliceIds=Se,exports.useSliceIdsListener=(e,s,t,o)=>ce("SliceIds",K(o),s,t,[e]),exports.useSliceRowIds=Ve,exports.useSliceRowIdsListener=(e,s,t,o,r)=>ce("Slice"+I,K(r),t,o,[e,s]),exports.useSortedRowIds=ke,exports.useSortedRowIdsListener=(e,s,t,o,r,u,l,n,d)=>ce(C,U(d),u,l,[e,s,t,o,r],n),exports.useStartTransactionListener=(e,s,t)=>ce("Start"+$,U(t),e,s),exports.useStore=e=>W(e,0),exports.useStoreIds=()=>z(1),exports.useStoreOrStoreById=U,exports.useTable=(e,s)=>xe(p,U(s),0,[e]),exports.useTableCellIds=(e,s)=>xe(p+w,U(s),1,[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>ce(p+w,U(r),s,t,[e],o),exports.useTableIds=we,exports.useTableIdsListener=(e,s,t,o)=>ce(i,U(o),e,s,le,t),exports.useTableListener=(e,s,t,o,r)=>ce(p,U(r),s,t,[e],o),exports.useTables=e=>xe(a,U(e),0),exports.useTablesListener=(e,s,t,o)=>ce(a,U(o),e,s,le,t),exports.useUndoInformation=e=>{const s=Y(e),[o,r]=Me(s);return[(u=o,!(0==S(u))),Fe(s),r,h(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=ye,exports.useValueIds=he,exports.useValueIdsListener=(e,s,t,o)=>ce(g,U(o),e,s,le,t),exports.useValueListener=(e,s,t,o,r)=>ce(R,U(r),s,t,[e],o),exports.useValues=e=>xe(k,U(e),0),exports.useValuesListener=(e,s,t,o)=>ce(k,U(o),e,s,le,t),exports.useWillFinishTransactionListener=(e,s,t)=>ce("WillFinish"+$,U(t),e,s);
1
+ "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r=s(s),u="Listener",l="Result",n="Has",d="Ids",p="Table",a=p+"s",i=p+d,x="Row",c=x+"Count",I=x+d,C="Sorted"+x+d,b="Cell",w=b+d,R="Value",k=R+"s",g=R+d,L=e=>null==e,h=(e,s,t)=>L(e)?t?.():s(e),y=e=>s(e)==o,m=e=>s(e)==r,S=e=>e.length,V=()=>{},T=(e,s)=>e.every(s),v=(e,s)=>S(e)===S(s)&&T(e,((e,t)=>s[t]===e)),P=(e,s)=>e.map(s),f=Object,q=e=>f.getPrototypeOf(e),B=f.entries,H=e=>!L(e)&&h(q(e),(e=>e==f.prototype||L(q(e))),(()=>!0)),M=f.keys,D=(e,s)=>h(e,(e=>e[s])),F=(e,s)=>(delete e[s],e),O=(e,s)=>{const t=B(e);return S(t)===S(M(s))&&T(t,(([e,t])=>H(t)?!!H(s[e])&&O(s[e],t):s[e]===t))},{createContext:Q,useContext:E,useEffect:A}=e,G=Q([]),W=(e,s)=>{const t=E(G);return L(e)?t[s]:y(e)?D(t[s+1]??{},e):e},j=(e,s)=>{const t=W(e,s);return L(e)||y(e)?t:e},z=e=>M(E(G)[e]??{}),U=e=>j(e,0),J=e=>j(e,2),K=e=>j(e,4),N=e=>j(e,6),X=e=>j(e,8),Y=e=>j(e,10),Z=e=>e.toLowerCase();Z(u);const $="Transaction";Z($);const{useCallback:_,useEffect:ee,useMemo:se,useLayoutEffect:te,useRef:oe,useState:re,useSyncExternalStore:ue}=e,le=[],ne=[{},[],[le,void 0,le],void 0,!1,0],de=(e,s)=>e===s,pe=[O,v,([e,s,t],[o,r,u])=>s===r&&v(e,o)&&v(t,u)],ae=(e,s,t=le)=>{const[,o]=re(),[r,u]=re();return ee((()=>{const t=e?s(e):void 0;return u(t),o([]),t?.destroy}),[e,...t]),r},ie=(e,s,...t)=>{const o=e?.["add"+s+u]?.(...t);return()=>e?.delListener(o)},xe=(e,s,o,r=le)=>{const u=oe(ne[o]),l=_((()=>{const t=s?.[(4==o?"has":"get")+e]?.(...r)??ne[o];return(pe[o]??de)(t,u.current)?u.current:u.current=t}),[s,o,e,...r]),d=_((u=>ie(s,(4==o?n:t)+e,...r,u)),[s,o,e,...r]),p=ue(d,l);return 0==o?{...p}:o<3?[...p]:p},ce=(e,s,t,o=le,r=le,...u)=>te((()=>ie(s,e,...r,t,...u)),[s,e,...r,...o,...u]),Ie=(e,s,t,o=le,r=V,u=le,...l)=>{const n=U(e);return _((e=>h(n,(o=>h(t(e,o),(t=>r(o["set"+s](...P(l,(s=>m(s)?s(e,o):s)),t),t)))))),[n,s,...o,...u,...l])},Ce=(e,s,t=V,o=le,...r)=>{const u=U(e);return _((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},be=(e,s,t)=>{const o=Y(e);return _((()=>o?.[s](t)),[o,s,t])},we=e=>xe(i,U(e),1),Re=(e,s)=>xe(I,U(s),1,[e]),ke=(e,s,t,o=0,r,u)=>xe(C,U(u),1,[e,s,t,o,r]),ge=(e,s,t)=>xe(w,U(t),1,[e,s]),Le=(e,s,t,o)=>xe(b,U(o),3,[e,s,t]),he=e=>xe(g,U(e),1),ye=(e,s)=>xe(R,U(s),3,[e]),me=(e,s)=>xe("Metric",J(s),3,[e]),Se=(e,s)=>xe("SliceIds",K(s),1,[e]),Ve=(e,s,t)=>xe("Slice"+I,K(t),1,[e,s]),Te=(e,s,t)=>xe("RemoteRowId",N(t),3,[e,s]),ve=(e,s,t)=>xe("Local"+I,N(t),1,[e,s]),Pe=(e,s,t)=>xe("Linked"+I,N(t),1,[e,s]),fe=(e,s)=>xe(l+I,X(s),1,[e]),qe=(e,s,t,o=0,r,u)=>xe(l+C,X(u),1,[e,s,t,o,r]),Be=(e,s,t)=>xe(l+w,X(t),1,[e,s]),He=(e,s,t,o)=>xe(l+b,X(o),3,[e,s,t]),Me=e=>xe("CheckpointIds",Y(e),2),De=(e,s)=>xe("Checkpoint",Y(s),3,[e]),Fe=e=>be(e,"goBackward"),Oe=e=>be(e,"goForward"),{PureComponent:Qe,Fragment:Ee,createElement:Ae,useCallback:Ge,useLayoutEffect:We,useRef:je,useState:ze}=e,Ue=(e,...s)=>L(e)?{}:e(...s),Je=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:Ke,useContext:Ne,useMemo:Xe,useState:Ye}=e,Ze=({tableId:e,store:s,rowComponent:t=os,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},n)=>ss(P(n,(u=>Ae(t,{...Ue(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),$e=({queryId:e,queries:s,resultRowComponent:t=ds,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>ss(P(l,(r=>Ae(t,{...Ue(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),_e=({relationshipId:e,relationships:s,rowComponent:t=os,getRowComponentProps:o,separator:r,debugIds:u},l,n)=>{const[d,p,a]=Je(N(s),e),i=l(e,n,d);return ss(P(i,(e=>Ae(t,{...Ue(o,e),key:e,tableId:a,rowId:e,store:p,debugIds:u}))),r,u,n)},es=e=>({checkpoints:s,checkpointComponent:t=ps,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=Y(s);return ss(P(e(Me(l)),(e=>Ae(t,{...Ue(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},ss=(e,s,t,o)=>{const r=L(s)||!Array.isArray(e)?e:P(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},ts=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>ss(t+(Le(e,s,o,r)??t),void 0,u,o),os=({tableId:e,rowId:s,store:t,cellComponent:o=ts,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:n})=>ss(P(((e,s,t,o)=>{const r=ge(s,t,o);return e??r})(u,e,s,t),(u=>Ae(o,{...Ue(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:n}))),l,n,s),rs=e=>Ze(e,Re(e.tableId,e.store)),us=({valueId:e,store:s,debugIds:o})=>ss(t+(ye(e,s)??t),void 0,o,e),ls=({indexId:e,sliceId:s,indexes:t,rowComponent:o=os,getRowComponentProps:r,separator:u,debugIds:l})=>{const[n,d,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(K(t),e),a=Ve(e,s,n);return ss(P(a,(e=>Ae(o,{...Ue(r,e),key:e,tableId:p,rowId:e,store:d,debugIds:l}))),u,l,s)},ns=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>ss(t+(He(e,s,o,r)??t),void 0,u,o),ds=({queryId:e,rowId:s,queries:t,resultCellComponent:o=ns,getResultCellComponentProps:r,separator:u,debugIds:l})=>ss(P(Be(e,s,t),(u=>Ae(o,{...Ue(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),ps=({checkpoints:e,checkpointId:s,debugIds:o})=>ss(De(s,e)??t,void 0,o,s),as=es((e=>e[0])),is=es((e=>L(e[1])?[]:[e[1]])),xs=es((e=>e[2]));exports.BackwardCheckpointsView=as,exports.CellView=ts,exports.CheckpointView=ps,exports.CurrentCheckpointView=is,exports.ForwardCheckpointsView=xs,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=ls,getSliceComponentProps:o,separator:r,debugIds:u})=>ss(P(Se(e,s),(r=>Ae(t,{...Ue(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>_e(e,Pe,e.firstRowId),exports.LocalRowsView=e=>_e(e,ve,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>ss(me(e,s)??t,void 0,o,e),exports.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:n,queries:d,queriesById:p,checkpoints:a,checkpointsById:i,children:x})=>{const c=Ne(G),[I,C]=Ye({}),b=Ke(((e,s)=>C((t=>D(t,e)==s?t:{...t,[e]:s}))),[]),w=Ke((e=>C((s=>({...F(s,e)})))),[]);return Ae(G.Provider,{value:Xe((()=>[e??c[0],{...c[1],...s,...I},t??c[2],{...c[3],...o},r??c[4],{...c[5],...u},l??c[6],{...c[7],...n},d??c[8],{...c[9],...p},a??c[10],{...c[11],...i},b,w]),[e,s,I,t,o,r,u,l,n,d,p,a,i,c,b,w])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=os,getRowComponentProps:r,debugIds:u})=>{const[l,n,,d]=Je(N(t),e),p=Te(e,s,l);return ss(L(d)||L(p)?null:Ae(o,{...Ue(r,p),key:p,tableId:d,rowId:p,store:n,debugIds:u}),void 0,u,s)},exports.ResultCellView=ns,exports.ResultRowView=ds,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>$e(r,qe(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>$e(e,fe(e.queryId,e.queries)),exports.RowView=os,exports.SliceView=ls,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Ze(r,ke(r.tableId,e,s,t,o,r.store)),exports.TableView=rs,exports.TablesView=({store:e,tableComponent:s=rs,getTableComponentProps:t,separator:o,debugIds:r})=>ss(P(we(e),(o=>Ae(s,{...Ue(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=us,exports.ValuesView=({store:e,valueComponent:s=us,getValueComponentProps:t,separator:o,debugIds:r})=>ss(P(he(e),(o=>Ae(s,{...Ue(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=le,o,r=V,u=le,l=!0)=>{const n=U(o);return _((t=>h(n,(o=>h(s(t,o),(s=>r(o.addRow(m(e)?e(t,o):e,s,l),o,s)))))),[n,e,...t,...u,l])},exports.useCell=Le,exports.useCellIds=ge,exports.useCellIdsListener=(e,s,t,o,r,u)=>ce(w,U(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,l)=>ce(b,U(l),o,r,[e,s,t],u),exports.useCheckpoint=De,exports.useCheckpointIds=Me,exports.useCheckpointIdsListener=(e,s,t)=>ce("CheckpointIds",Y(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>ce("Checkpoint",Y(o),s,t,[e]),exports.useCheckpoints=e=>W(e,10),exports.useCheckpointsIds=()=>z(11),exports.useCheckpointsOrCheckpointsById=Y,exports.useCreateCheckpoints=(e,s,t)=>ae(e,s,t),exports.useCreateIndexes=(e,s,t)=>ae(e,s,t),exports.useCreateMergeableStore=(e,s=le)=>se(e,s),exports.useCreateMetrics=(e,s,t)=>ae(e,s,t),exports.useCreatePersister=(e,s,t=le,o,r=le,u,l=le)=>{const[,n]=re(),[d,p]=re();return ee((()=>{const t=e?s(e):void 0;p(t),t&&o&&(async()=>{await o(t),n([])})()}),[e,...t,...r]),ee((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),d},exports.useCreateQueries=(e,s,t)=>ae(e,s,t),exports.useCreateRelationships=(e,s,t)=>ae(e,s,t),exports.useCreateStore=(e,s=le)=>se(e,s),exports.useCreateSynchronizer=(e,s,t=le,o,r=le)=>{const[u,l]=re();return ee((()=>{(async()=>{const t=e?await s(e):void 0;l(t)})()}),[e,...t]),ee((()=>()=>{u&&(u.destroy(),o?.(u))}),[u,...r]),u},exports.useDelCellCallback=(e,s,t,o,r,u,l)=>Ce(r,b,u,l,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>Ce(t,x,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>Ce(s,p,t,o,e),exports.useDelTablesCallback=(e,s,t)=>Ce(e,a,s,t),exports.useDelValueCallback=(e,s,t,o)=>Ce(s,R,t,o,e),exports.useDelValuesCallback=(e,s,t)=>Ce(e,k,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>ce("DidFinish"+$,U(t),e,s),exports.useGoBackwardCallback=Fe,exports.useGoForwardCallback=Oe,exports.useGoToCallback=(e,s=le,t,o=V,r=le)=>{const u=Y(t);return _((s=>h(u,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useHasCell=(e,s,t,o)=>xe(b,U(o),4,[e,s,t]),exports.useHasCellListener=(e,s,t,o,r,u,l)=>ce(n+b,U(l),o,r,[e,s,t],u),exports.useHasRow=(e,s,t)=>xe(x,U(t),4,[e,s]),exports.useHasRowListener=(e,s,t,o,r,u)=>ce(n+x,U(u),t,o,[e,s],r),exports.useHasTable=(e,s)=>xe(p,U(s),4,[e]),exports.useHasTableCell=(e,s,t)=>xe(p+b,U(t),4,[e,s]),exports.useHasTableCellListener=(e,s,t,o,r,u)=>ce(n+p+b,U(u),t,o,[e,s],r),exports.useHasTableListener=(e,s,t,o,r)=>ce(n+p,U(r),s,t,[e],o),exports.useHasTables=e=>xe(a,U(e),4,[]),exports.useHasTablesListener=(e,s,t,o)=>ce(n+a,U(o),e,s,[],t),exports.useHasValue=(e,s)=>xe(R,U(s),4,[e]),exports.useHasValueListener=(e,s,t,o,r)=>ce(n+R,U(r),s,t,[e],o),exports.useHasValues=e=>xe(k,U(e),4,[]),exports.useHasValuesListener=(e,s,t,o)=>ce(n+k,U(o),e,s,[],t),exports.useIndexIds=e=>xe("IndexIds",K(e),1),exports.useIndexes=e=>W(e,4),exports.useIndexesIds=()=>z(5),exports.useIndexesOrIndexesById=K,exports.useLinkedRowIds=Pe,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>ce("Linked"+I,N(r),t,o,[e,s]),exports.useLocalRowIds=ve,exports.useLocalRowIdsListener=(e,s,t,o,r)=>ce("Local"+I,N(r),t,o,[e,s]),exports.useMetric=me,exports.useMetricIds=e=>xe("MetricIds",J(e),1),exports.useMetricListener=(e,s,t,o)=>ce("Metric",J(o),s,t,[e]),exports.useMetrics=e=>W(e,2),exports.useMetricsIds=()=>z(3),exports.useMetricsOrMetricsById=J,exports.useProvideStore=(e,s)=>{const{12:t,13:o}=E(G);A((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},exports.useQueries=e=>W(e,8),exports.useQueriesIds=()=>z(9),exports.useQueriesOrQueriesById=X,exports.useQueryIds=e=>xe("QueryIds",X(e),1),exports.useRedoInformation=e=>{const s=Y(e),[,,[o]]=Me(s);return[!L(o),Oe(s),o,h(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>xe("RelationshipIds",N(e),1),exports.useRelationships=e=>W(e,6),exports.useRelationshipsIds=()=>z(7),exports.useRelationshipsOrRelationshipsById=N,exports.useRemoteRowId=Te,exports.useRemoteRowIdListener=(e,s,t,o,r)=>ce("RemoteRowId",N(r),t,o,[e,s]),exports.useResultCell=He,exports.useResultCellIds=Be,exports.useResultCellIdsListener=(e,s,t,o,r)=>ce(l+w,X(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,u)=>ce(l+b,X(u),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>xe(l+x,X(t),0,[e,s]),exports.useResultRowCount=(e,s)=>xe(l+c,X(s),5,[e]),exports.useResultRowCountListener=(e,s,t,o)=>ce(l+c,X(o),s,t,[e]),exports.useResultRowIds=fe,exports.useResultRowIdsListener=(e,s,t,o)=>ce(l+I,X(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>ce(l+x,X(r),t,o,[e,s]),exports.useResultSortedRowIds=qe,exports.useResultSortedRowIdsListener=(e,s,t,o,r,u,n,d)=>ce(l+C,X(d),u,n,[e,s,t,o,r]),exports.useResultTable=(e,s)=>xe(l+p,X(s),0,[e]),exports.useResultTableCellIds=(e,s)=>xe(l+p+w,X(s),1,[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>ce(l+p+w,X(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>ce(l+p,X(o),s,t,[e]),exports.useRow=(e,s,t)=>xe(x,U(t),0,[e,s]),exports.useRowCount=(e,s)=>xe(c,U(s),5,[e]),exports.useRowCountListener=(e,s,t,o,r)=>ce(c,U(r),s,t,[e],o),exports.useRowIds=Re,exports.useRowIdsListener=(e,s,t,o,r)=>ce(I,U(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>ce(x,U(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,l,n)=>Ie(u,b,o,r,l,n,e,s,t),exports.useSetCheckpointCallback=(e=V,s=le,t,o=V,r=le)=>{const u=Y(t);return _((s=>h(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>Ie(r,"PartialRow",t,o,u,l,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>Ie(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,l)=>Ie(r,x,t,o,u,l,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>Ie(o,p,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>Ie(t,a,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>Ie(o,R,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>Ie(t,k,e,s,o,r),exports.useSliceIds=Se,exports.useSliceIdsListener=(e,s,t,o)=>ce("SliceIds",K(o),s,t,[e]),exports.useSliceRowIds=Ve,exports.useSliceRowIdsListener=(e,s,t,o,r)=>ce("Slice"+I,K(r),t,o,[e,s]),exports.useSortedRowIds=ke,exports.useSortedRowIdsListener=(e,s,t,o,r,u,l,n,d)=>ce(C,U(d),u,l,[e,s,t,o,r],n),exports.useStartTransactionListener=(e,s,t)=>ce("Start"+$,U(t),e,s),exports.useStore=e=>W(e,0),exports.useStoreIds=()=>z(1),exports.useStoreOrStoreById=U,exports.useTable=(e,s)=>xe(p,U(s),0,[e]),exports.useTableCellIds=(e,s)=>xe(p+w,U(s),1,[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>ce(p+w,U(r),s,t,[e],o),exports.useTableIds=we,exports.useTableIdsListener=(e,s,t,o)=>ce(i,U(o),e,s,le,t),exports.useTableListener=(e,s,t,o,r)=>ce(p,U(r),s,t,[e],o),exports.useTables=e=>xe(a,U(e),0),exports.useTablesListener=(e,s,t,o)=>ce(a,U(o),e,s,le,t),exports.useUndoInformation=e=>{const s=Y(e),[o,r]=Me(s);return[(u=o,!(0==S(u))),Fe(s),r,h(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=ye,exports.useValueIds=he,exports.useValueIdsListener=(e,s,t,o)=>ce(g,U(o),e,s,le,t),exports.useValueListener=(e,s,t,o,r)=>ce(R,U(r),s,t,[e],o),exports.useValues=e=>xe(k,U(e),0),exports.useValuesListener=(e,s,t,o)=>ce(k,U(o),e,s,le,t),exports.useWillFinishTransactionListener=(e,s,t)=>ce("WillFinish"+$,U(t),e,s);
Binary file
@@ -1 +1 @@
1
- "use strict";var e=require("react");const s=e=>typeof e,t="",r=s(t),o=s(s),l="Listener",u="Result",n="Has",d="Ids",a="Table",i=a+"s",p=a+d,c="Row",x=c+"Count",I=c+d,C="Sorted"+c+d,b="Cell",w=b+d,R="Value",k=R+"s",v=R+d,g=e=>null==e,y=(e,s,t)=>g(e)?null==t?void 0:t():s(e),h=e=>s(e)==r,L=e=>s(e)==o,m=e=>e.length,S=()=>{},V=(e,s)=>e.every(s),f=(e,s)=>m(e)===m(s)&&V(e,((e,t)=>s[t]===e)),T=(e,s)=>e.map(s),P=Object,O=e=>P.getPrototypeOf(e),q=P.entries,B=e=>!g(e)&&y(O(e),(e=>e==P.prototype||g(O(e))),(()=>!0)),H=P.keys,M=(e,s)=>y(e,(e=>e[s])),D=(e,s)=>{const t=q(e);return m(t)===m(H(s))&&V(t,(([e,t])=>B(t)?!!B(s[e])&&D(s[e],t):s[e]===t))},{createContext:F,useContext:j,useEffect:E}=e,Q=F([]),A=(e,s)=>{var t;const r=j(Q);return g(e)?r[s]:h(e)?M(null!=(t=r[s+1])?t:{},e):e},G=(e,s)=>{const t=A(e,s);return g(e)||h(e)?t:e},W=e=>{var s;return H(null!=(s=j(Q)[e])?s:{})},z=e=>G(e,0),U=e=>G(e,2),J=e=>G(e,4),K=e=>G(e,6),N=e=>G(e,8),X=e=>G(e,10),Y=e=>e.toLowerCase();Y(l);const Z="Transaction";Y(Z);var $=(e,s,t)=>new Promise(((r,o)=>{var l=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?r(e.value):Promise.resolve(e.value).then(l,u);n((t=t.apply(e,s)).next())}));const{useCallback:_,useEffect:ee,useMemo:se,useLayoutEffect:te,useRef:re,useState:oe,useSyncExternalStore:le}=e,ue=[],ne=[{},[],[ue,void 0,ue],void 0,!1,0],de=(e,s)=>e===s,ae=[D,f,([e,s,t],[r,o,l])=>s===o&&f(e,r)&&f(t,l)],ie=(e,s,t=ue)=>{const[,r]=oe(),[o,l]=oe();return ee((()=>{const t=s(e);return l(t),r([]),t.destroy}),[e,...t]),o},pe=(e,s,...t)=>{var r;const o=null==(r=null==e?void 0:e["add"+s+l])?void 0:r.call(e,...t);return()=>null==e?void 0:e.delListener(o)},ce=(e,s,r,o=ue)=>{const l=re(ne[r]),u=_((()=>{var t,u,n;const d=null!=(u=null==(t=null==s?void 0:s[(4==r?"has":"get")+e])?void 0:t.call(s,...o))?u:ne[r];return(null!=(n=ae[r])?n:de)(d,l.current)?l.current:l.current=d}),[s,r,e,...o]),d=_((l=>pe(s,(4==r?n:t)+e,...o,l)),[s,r,e,...o]);return le(d,u)},xe=(e,s,t,r=ue,o=ue,...l)=>te((()=>pe(s,e,...o,t,...l)),[s,e,...o,...r,...l]),Ie=(e,s,t,r=ue,o=S,l=ue,...u)=>{const n=z(e);return _((e=>y(n,(r=>y(t(e,r),(t=>o(r["set"+s](...T(u,(s=>L(s)?s(e,r):s)),t),t)))))),[n,s,...r,...l,...u])},Ce=(e,s,t=S,r=ue,...o)=>{const l=z(e);return _((()=>t(null==l?void 0:l["del"+s](...o))),[l,s,...r,...o])},be=(e,s,t)=>{const r=X(e);return _((()=>null==r?void 0:r[s](t)),[r,s,t])},we=e=>ce(p,z(e),1),Re=(e,s)=>ce(I,z(s),1,[e]),ke=(e,s,t,r=0,o,l)=>ce(C,z(l),1,[e,s,t,r,o]),ve=(e,s,t)=>ce(w,z(t),1,[e,s]),ge=(e,s,t,r)=>ce(b,z(r),3,[e,s,t]),ye=e=>ce(v,z(e),1),he=(e,s)=>ce(R,z(s),3,[e]),Le=(e,s)=>ce("Metric",U(s),3,[e]),me=(e,s)=>ce("SliceIds",J(s),1,[e]),Se=(e,s,t)=>ce("Slice"+I,J(t),1,[e,s]),Ve=(e,s,t)=>ce("RemoteRowId",K(t),3,[e,s]),fe=(e,s,t)=>ce("Local"+I,K(t),1,[e,s]),Te=(e,s,t)=>ce("Linked"+I,K(t),1,[e,s]),Pe=(e,s)=>ce(u+I,N(s),1,[e]),Oe=(e,s,t,r=0,o,l)=>ce(u+C,N(l),1,[e,s,t,r,o]),qe=(e,s,t)=>ce(u+w,N(t),1,[e,s]),Be=(e,s,t,r)=>ce(u+b,N(r),3,[e,s,t]),He=e=>ce("CheckpointIds",X(e),2),Me=(e,s)=>ce("Checkpoint",X(s),3,[e]),De=e=>be(e,"goBackward"),Fe=e=>be(e,"goForward"),{PureComponent:je,Fragment:Ee,createElement:Qe,useCallback:Ae,useLayoutEffect:Ge,useRef:We,useState:ze}=e,Ue=(e,...s)=>g(e)?{}:e(...s),Je=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ke=Object.defineProperty,Ne=Object.defineProperties,Xe=Object.getOwnPropertyDescriptors,Ye=Object.getOwnPropertySymbols,Ze=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable,_e=(e,s,t)=>s in e?Ke(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,es=(e,s)=>{for(var t in s||(s={}))Ze.call(s,t)&&_e(e,t,s[t]);if(Ye)for(var t of Ye(s))$e.call(s,t)&&_e(e,t,s[t]);return e},ss=(e,s)=>Ne(e,Xe(s)),ts=(e,s)=>{var t={};for(var r in e)Ze.call(e,r)&&s.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&Ye)for(var r of Ye(e))s.indexOf(r)<0&&$e.call(e,r)&&(t[r]=e[r]);return t};const{useCallback:rs,useContext:os,useMemo:ls,useState:us}=e,ns=({tableId:e,store:s,rowComponent:t=xs,getRowComponentProps:r,customCellIds:o,separator:l,debugIds:u},n)=>ps(T(n,(l=>Qe(t,ss(es({},Ue(r,l)),{key:l,tableId:e,rowId:l,customCellIds:o,store:s,debugIds:u})))),l,u,e),ds=({queryId:e,queries:s,resultRowComponent:t=Rs,getResultRowComponentProps:r,separator:o,debugIds:l},u)=>ps(T(u,(o=>Qe(t,ss(es({},Ue(r,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:l})))),o,l,e),as=({relationshipId:e,relationships:s,rowComponent:t=xs,getRowComponentProps:r,separator:o,debugIds:l},u,n)=>{const[d,a,i]=Je(K(s),e),p=u(e,n,d);return ps(T(p,(e=>Qe(t,ss(es({},Ue(r,e)),{key:e,tableId:i,rowId:e,store:a,debugIds:l})))),o,l,n)},is=e=>({checkpoints:s,checkpointComponent:t=ks,getCheckpointComponentProps:r,separator:o,debugIds:l})=>{const u=X(s);return ps(T(e(He(u)),(e=>Qe(t,ss(es({},Ue(r,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:l})))),o)},ps=(e,s,t,r)=>{const o=g(s)||!Array.isArray(e)?e:T(e,((e,t)=>t>0?[s,e]:e));return t?[r,":{",o,"}"]:o},cs=({tableId:e,rowId:s,cellId:r,store:o,debugIds:l})=>{var u;return ps(t+(null!=(u=ge(e,s,r,o))?u:t),void 0,l,r)},xs=({tableId:e,rowId:s,store:t,cellComponent:r=cs,getCellComponentProps:o,customCellIds:l,separator:u,debugIds:n})=>ps(T(((e,s,t,r)=>{const o=ve(s,t,r);return null!=e?e:o})(l,e,s,t),(l=>Qe(r,ss(es({},Ue(o,l)),{key:l,tableId:e,rowId:s,cellId:l,store:t,debugIds:n})))),u,n,s),Is=e=>ns(e,Re(e.tableId,e.store)),Cs=({valueId:e,store:s,debugIds:r})=>{var o;return ps(t+(null!=(o=he(e,s))?o:t),void 0,r,e)},bs=({indexId:e,sliceId:s,indexes:t,rowComponent:r=xs,getRowComponentProps:o,separator:l,debugIds:u})=>{const[n,d,a]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(J(t),e),i=Se(e,s,n);return ps(T(i,(e=>Qe(r,ss(es({},Ue(o,e)),{key:e,tableId:a,rowId:e,store:d,debugIds:u})))),l,u,s)},ws=({queryId:e,rowId:s,cellId:r,queries:o,debugIds:l})=>{var u;return ps(t+(null!=(u=Be(e,s,r,o))?u:t),void 0,l,r)},Rs=({queryId:e,rowId:s,queries:t,resultCellComponent:r=ws,getResultCellComponentProps:o,separator:l,debugIds:u})=>ps(T(qe(e,s,t),(l=>Qe(r,ss(es({},Ue(o,l)),{key:l,queryId:e,rowId:s,cellId:l,queries:t,debugIds:u})))),l,u,s),ks=({checkpoints:e,checkpointId:s,debugIds:r})=>{var o;return ps(null!=(o=Me(s,e))?o:t,void 0,r,s)},vs=is((e=>e[0])),gs=is((e=>g(e[1])?[]:[e[1]])),ys=is((e=>e[2]));exports.BackwardCheckpointsView=vs,exports.CellView=cs,exports.CheckpointView=ks,exports.CurrentCheckpointView=gs,exports.ForwardCheckpointsView=ys,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=bs,getSliceComponentProps:r,separator:o,debugIds:l})=>ps(T(me(e,s),(o=>Qe(t,ss(es({},Ue(r,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:l})))),o,l,e),exports.LinkedRowsView=e=>as(e,Te,e.firstRowId),exports.LocalRowsView=e=>as(e,fe,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:r})=>{var o;return ps(null!=(o=Le(e,s))?o:t,void 0,r,e)},exports.Provider=({store:e,storesById:s,metrics:t,metricsById:r,indexes:o,indexesById:l,relationships:u,relationshipsById:n,queries:d,queriesById:a,checkpoints:i,checkpointsById:p,children:c})=>{const x=os(Q),[I,C]=us({}),b=rs(((e,s)=>C((t=>M(t,e)==s?t:ss(es({},t),{[e]:s})))),[]),w=rs((e=>C((s=>es({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Qe(Q.Provider,{value:ls((()=>[null!=e?e:x[0],es(es(es({},x[1]),s),I),null!=t?t:x[2],es(es({},x[3]),r),null!=o?o:x[4],es(es({},x[5]),l),null!=u?u:x[6],es(es({},x[7]),n),null!=d?d:x[8],es(es({},x[9]),a),null!=i?i:x[10],es(es({},x[11]),p),b,w]),[e,s,I,t,r,o,l,u,n,d,a,i,p,x,b,w])},c)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:r=xs,getRowComponentProps:o,debugIds:l})=>{const[u,n,,d]=Je(K(t),e),a=Ve(e,s,u);return ps(g(d)||g(a)?null:Qe(r,ss(es({},Ue(o,a)),{key:a,tableId:d,rowId:a,store:n,debugIds:l})),void 0,l,s)},exports.ResultCellView=ws,exports.ResultRowView=Rs,exports.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:r,offset:o,limit:l}=s,u=ts(s,["cellId","descending","offset","limit"]);return ds(u,Oe(u.queryId,t,r,o,l,u.queries))},exports.ResultTableView=e=>ds(e,Pe(e.queryId,e.queries)),exports.RowView=xs,exports.SliceView=bs,exports.SortedTableView=e=>{var s=e,{cellId:t,descending:r,offset:o,limit:l}=s,u=ts(s,["cellId","descending","offset","limit"]);return ns(u,ke(u.tableId,t,r,o,l,u.store))},exports.TableView=Is,exports.TablesView=({store:e,tableComponent:s=Is,getTableComponentProps:t,separator:r,debugIds:o})=>ps(T(we(e),(r=>Qe(s,ss(es({},Ue(t,r)),{key:r,tableId:r,store:e,debugIds:o})))),r),exports.ValueView=Cs,exports.ValuesView=({store:e,valueComponent:s=Cs,getValueComponentProps:t,separator:r,debugIds:o})=>ps(T(ye(e),(r=>Qe(s,ss(es({},Ue(t,r)),{key:r,valueId:r,store:e,debugIds:o})))),r),exports.useAddRowCallback=(e,s,t=ue,r,o=S,l=ue,u=!0)=>{const n=z(r);return _((t=>y(n,(r=>y(s(t,r),(s=>o(r.addRow(L(e)?e(t,r):e,s,u),r,s)))))),[n,e,...t,...l,u])},exports.useCell=ge,exports.useCellIds=ve,exports.useCellIdsListener=(e,s,t,r,o,l)=>xe(w,z(l),t,r,[e,s],o),exports.useCellListener=(e,s,t,r,o,l,u)=>xe(b,z(u),r,o,[e,s,t],l),exports.useCheckpoint=Me,exports.useCheckpointIds=He,exports.useCheckpointIdsListener=(e,s,t)=>xe("CheckpointIds",X(t),e,s),exports.useCheckpointListener=(e,s,t,r)=>xe("Checkpoint",X(r),s,t,[e]),exports.useCheckpoints=e=>A(e,10),exports.useCheckpointsIds=()=>W(11),exports.useCheckpointsOrCheckpointsById=X,exports.useCreateCheckpoints=(e,s,t)=>ie(e,s,t),exports.useCreateIndexes=(e,s,t)=>ie(e,s,t),exports.useCreateMergeableStore=(e,s=ue)=>se(e,s),exports.useCreateMetrics=(e,s,t)=>ie(e,s,t),exports.useCreatePersister=(e,s,t=ue,r,o=ue,l,u=ue)=>{const[,n]=oe(),[d,a]=oe();return ee((()=>{const t=s(e);a(t),t&&r&&$(void 0,null,(function*(){yield r(t),n([])}))}),[e,...t,...o]),ee((()=>()=>{d&&(d.destroy(),null==l||l(d))}),[d,...u]),d},exports.useCreateQueries=(e,s,t)=>ie(e,s,t),exports.useCreateRelationships=(e,s,t)=>ie(e,s,t),exports.useCreateStore=(e,s=ue)=>se(e,s),exports.useCreateSynchronizer=(e,s,t=ue,r,o=ue)=>{const[l,u]=oe();return ee((()=>{$(void 0,null,(function*(){const t=yield s(e);u(t)}))}),[e,...t]),ee((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...o]),l},exports.useDelCellCallback=(e,s,t,r,o,l,u)=>Ce(o,b,l,u,e,s,t,r),exports.useDelRowCallback=(e,s,t,r,o)=>Ce(t,c,r,o,e,s),exports.useDelTableCallback=(e,s,t,r)=>Ce(s,a,t,r,e),exports.useDelTablesCallback=(e,s,t)=>Ce(e,i,s,t),exports.useDelValueCallback=(e,s,t,r)=>Ce(s,R,t,r,e),exports.useDelValuesCallback=(e,s,t)=>Ce(e,k,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>xe("DidFinish"+Z,z(t),e,s),exports.useGoBackwardCallback=De,exports.useGoForwardCallback=Fe,exports.useGoToCallback=(e,s=ue,t,r=S,o=ue)=>{const l=X(t);return _((s=>y(l,(t=>y(e(s),(e=>r(t.goTo(e),e)))))),[l,...s,...o])},exports.useHasCell=(e,s,t,r)=>ce(b,z(r),4,[e,s,t]),exports.useHasCellListener=(e,s,t,r,o,l,u)=>xe(n+b,z(u),r,o,[e,s,t],l),exports.useHasRow=(e,s,t)=>ce(c,z(t),4,[e,s]),exports.useHasRowListener=(e,s,t,r,o,l)=>xe(n+c,z(l),t,r,[e,s],o),exports.useHasTable=(e,s)=>ce(a,z(s),4,[e]),exports.useHasTableCell=(e,s,t)=>ce(a+b,z(t),4,[e,s]),exports.useHasTableCellListener=(e,s,t,r,o,l)=>xe(n+a+b,z(l),t,r,[e,s],o),exports.useHasTableListener=(e,s,t,r,o)=>xe(n+a,z(o),s,t,[e],r),exports.useHasTables=e=>ce(i,z(e),4,[]),exports.useHasTablesListener=(e,s,t,r)=>xe(n+i,z(r),e,s,[],t),exports.useHasValue=(e,s)=>ce(R,z(s),4,[e]),exports.useHasValueListener=(e,s,t,r,o)=>xe(n+R,z(o),s,t,[e],r),exports.useHasValues=e=>ce(k,z(e),4,[]),exports.useHasValuesListener=(e,s,t,r)=>xe(n+k,z(r),e,s,[],t),exports.useIndexIds=e=>ce("IndexIds",J(e),1),exports.useIndexes=e=>A(e,4),exports.useIndexesIds=()=>W(5),exports.useIndexesOrIndexesById=J,exports.useLinkedRowIds=Te,exports.useLinkedRowIdsListener=(e,s,t,r,o)=>xe("Linked"+I,K(o),t,r,[e,s]),exports.useLocalRowIds=fe,exports.useLocalRowIdsListener=(e,s,t,r,o)=>xe("Local"+I,K(o),t,r,[e,s]),exports.useMetric=Le,exports.useMetricIds=e=>ce("MetricIds",U(e),1),exports.useMetricListener=(e,s,t,r)=>xe("Metric",U(r),s,t,[e]),exports.useMetrics=e=>A(e,2),exports.useMetricsIds=()=>W(3),exports.useMetricsOrMetricsById=U,exports.useProvideStore=(e,s)=>{const{12:t,13:r}=j(Q);E((()=>(null==t||t(e,s),()=>null==r?void 0:r(e))),[t,e,s,r])},exports.useQueries=e=>A(e,8),exports.useQueriesIds=()=>W(9),exports.useQueriesOrQueriesById=N,exports.useQueryIds=e=>ce("QueryIds",N(e),1),exports.useRedoInformation=e=>{var s;const r=X(e),[,,[o]]=He(r);return[!g(o),Fe(r),o,null!=(s=y(o,(e=>null==r?void 0:r.getCheckpoint(e))))?s:t]},exports.useRelationshipIds=e=>ce("RelationshipIds",K(e),1),exports.useRelationships=e=>A(e,6),exports.useRelationshipsIds=()=>W(7),exports.useRelationshipsOrRelationshipsById=K,exports.useRemoteRowId=Ve,exports.useRemoteRowIdListener=(e,s,t,r,o)=>xe("RemoteRowId",K(o),t,r,[e,s]),exports.useResultCell=Be,exports.useResultCellIds=qe,exports.useResultCellIdsListener=(e,s,t,r,o)=>xe(u+w,N(o),t,r,[e,s]),exports.useResultCellListener=(e,s,t,r,o,l)=>xe(u+b,N(l),r,o,[e,s,t]),exports.useResultRow=(e,s,t)=>ce(u+c,N(t),0,[e,s]),exports.useResultRowCount=(e,s)=>ce(u+x,N(s),5,[e]),exports.useResultRowCountListener=(e,s,t,r)=>xe(u+x,N(r),s,t,[e]),exports.useResultRowIds=Pe,exports.useResultRowIdsListener=(e,s,t,r)=>xe(u+I,N(r),s,t,[e]),exports.useResultRowListener=(e,s,t,r,o)=>xe(u+c,N(o),t,r,[e,s]),exports.useResultSortedRowIds=Oe,exports.useResultSortedRowIdsListener=(e,s,t,r,o,l,n,d)=>xe(u+C,N(d),l,n,[e,s,t,r,o]),exports.useResultTable=(e,s)=>ce(u+a,N(s),0,[e]),exports.useResultTableCellIds=(e,s)=>ce(u+a+w,N(s),1,[e]),exports.useResultTableCellIdsListener=(e,s,t,r)=>xe(u+a+w,N(r),s,t,[e]),exports.useResultTableListener=(e,s,t,r)=>xe(u+a,N(r),s,t,[e]),exports.useRow=(e,s,t)=>ce(c,z(t),0,[e,s]),exports.useRowCount=(e,s)=>ce(x,z(s),5,[e]),exports.useRowCountListener=(e,s,t,r,o)=>xe(x,z(o),s,t,[e],r),exports.useRowIds=Re,exports.useRowIdsListener=(e,s,t,r,o)=>xe(I,z(o),s,t,[e],r),exports.useRowListener=(e,s,t,r,o,l)=>xe(c,z(l),t,r,[e,s],o),exports.useSetCellCallback=(e,s,t,r,o,l,u,n)=>Ie(l,b,r,o,u,n,e,s,t),exports.useSetCheckpointCallback=(e=S,s=ue,t,r=S,o=ue)=>{const l=X(t);return _((s=>y(l,(t=>{const o=e(s);r(t.addCheckpoint(o),t,o)}))),[l,...s,...o])},exports.useSetPartialRowCallback=(e,s,t,r,o,l,u)=>Ie(o,"PartialRow",t,r,l,u,e,s),exports.useSetPartialValuesCallback=(e,s,t,r,o)=>Ie(t,"PartialValues",e,s,r,o),exports.useSetRowCallback=(e,s,t,r,o,l,u)=>Ie(o,c,t,r,l,u,e,s),exports.useSetTableCallback=(e,s,t,r,o,l)=>Ie(r,a,s,t,o,l,e),exports.useSetTablesCallback=(e,s,t,r,o)=>Ie(t,i,e,s,r,o),exports.useSetValueCallback=(e,s,t,r,o,l)=>Ie(r,R,s,t,o,l,e),exports.useSetValuesCallback=(e,s,t,r,o)=>Ie(t,k,e,s,r,o),exports.useSliceIds=me,exports.useSliceIdsListener=(e,s,t,r)=>xe("SliceIds",J(r),s,t,[e]),exports.useSliceRowIds=Se,exports.useSliceRowIdsListener=(e,s,t,r,o)=>xe("Slice"+I,J(o),t,r,[e,s]),exports.useSortedRowIds=ke,exports.useSortedRowIdsListener=(e,s,t,r,o,l,u,n,d)=>xe(C,z(d),l,u,[e,s,t,r,o],n),exports.useStartTransactionListener=(e,s,t)=>xe("Start"+Z,z(t),e,s),exports.useStore=e=>A(e,0),exports.useStoreIds=()=>W(1),exports.useStoreOrStoreById=z,exports.useTable=(e,s)=>ce(a,z(s),0,[e]),exports.useTableCellIds=(e,s)=>ce(a+w,z(s),1,[e]),exports.useTableCellIdsListener=(e,s,t,r,o)=>xe(a+w,z(o),s,t,[e],r),exports.useTableIds=we,exports.useTableIdsListener=(e,s,t,r)=>xe(p,z(r),e,s,ue,t),exports.useTableListener=(e,s,t,r,o)=>xe(a,z(o),s,t,[e],r),exports.useTables=e=>ce(i,z(e),0),exports.useTablesListener=(e,s,t,r)=>xe(i,z(r),e,s,ue,t),exports.useUndoInformation=e=>{var s;const r=X(e),[o,l]=He(r);return[(u=o,!(0==m(u))),De(r),l,null!=(s=y(l,(e=>null==r?void 0:r.getCheckpoint(e))))?s:t];var u},exports.useValue=he,exports.useValueIds=ye,exports.useValueIdsListener=(e,s,t,r)=>xe(v,z(r),e,s,ue,t),exports.useValueListener=(e,s,t,r,o)=>xe(R,z(o),s,t,[e],r),exports.useValues=e=>ce(k,z(e),0),exports.useValuesListener=(e,s,t,r)=>xe(k,z(r),e,s,ue,t),exports.useWillFinishTransactionListener=(e,s,t)=>xe("WillFinish"+Z,z(t),e,s);
1
+ "use strict";var e=require("react");const s=e=>typeof e,t="",r=s(t),o=s(s),l="Listener",u="Result",n="Has",d="Ids",a="Table",i=a+"s",p=a+d,c="Row",x=c+"Count",I=c+d,b="Sorted"+c+d,C="Cell",w=C+d,R="Value",k=R+"s",v=R+d,y=e=>null==e,g=(e,s,t)=>y(e)?null==t?void 0:t():s(e),h=e=>s(e)==r,m=e=>s(e)==o,L=e=>e.length,S=()=>{},f=(e,s)=>e.every(s),V=(e,s)=>L(e)===L(s)&&f(e,((e,t)=>s[t]===e)),T=(e,s)=>e.map(s),P=Object,O=e=>P.getPrototypeOf(e),q=P.entries,B=e=>!y(e)&&g(O(e),(e=>e==P.prototype||y(O(e))),(()=>!0)),H=P.keys,M=(e,s)=>g(e,(e=>e[s])),j=(e,s)=>{const t=q(e);return L(t)===L(H(s))&&f(t,(([e,t])=>B(t)?!!B(s[e])&&j(s[e],t):s[e]===t))},{createContext:D,useContext:E,useEffect:F}=e,Q=D([]),A=(e,s)=>{var t;const r=E(Q);return y(e)?r[s]:h(e)?M(null!=(t=r[s+1])?t:{},e):e},G=(e,s)=>{const t=A(e,s);return y(e)||h(e)?t:e},W=e=>{var s;return H(null!=(s=E(Q)[e])?s:{})},z=e=>G(e,0),U=e=>G(e,2),J=e=>G(e,4),K=e=>G(e,6),N=e=>G(e,8),X=e=>G(e,10),Y=e=>e.toLowerCase();Y(l);const Z="Transaction";Y(Z);var $=Object.defineProperty,_=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,te=(e,s,t)=>s in e?$(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,re=(e,s,t)=>new Promise(((r,o)=>{var l=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?r(e.value):Promise.resolve(e.value).then(l,u);n((t=t.apply(e,s)).next())}));const{useCallback:oe,useEffect:le,useMemo:ue,useLayoutEffect:ne,useRef:de,useState:ae,useSyncExternalStore:ie}=e,pe=[],ce=[{},[],[pe,void 0,pe],void 0,!1,0],xe=(e,s)=>e===s,Ie=[j,V,([e,s,t],[r,o,l])=>s===o&&V(e,r)&&V(t,l)],be=(e,s,t=pe)=>{const[,r]=ae(),[o,l]=ae();return le((()=>{const t=e?s(e):void 0;return l(t),r([]),null==t?void 0:t.destroy}),[e,...t]),o},Ce=(e,s,...t)=>{var r;const o=null==(r=null==e?void 0:e["add"+s+l])?void 0:r.call(e,...t);return()=>null==e?void 0:e.delListener(o)},we=(e,s,r,o=pe)=>{const l=de(ce[r]),u=oe((()=>{var t,u,n;const d=null!=(u=null==(t=null==s?void 0:s[(4==r?"has":"get")+e])?void 0:t.call(s,...o))?u:ce[r];return(null!=(n=Ie[r])?n:xe)(d,l.current)?l.current:l.current=d}),[s,r,e,...o]),d=oe((l=>Ce(s,(4==r?n:t)+e,...o,l)),[s,r,e,...o]),a=ie(d,u);return 0==r?((e,s)=>{for(var t in s||(s={}))ee.call(s,t)&&te(e,t,s[t]);if(_)for(var t of _(s))se.call(s,t)&&te(e,t,s[t]);return e})({},a):r<3?[...a]:a},Re=(e,s,t,r=pe,o=pe,...l)=>ne((()=>Ce(s,e,...o,t,...l)),[s,e,...o,...r,...l]),ke=(e,s,t,r=pe,o=S,l=pe,...u)=>{const n=z(e);return oe((e=>g(n,(r=>g(t(e,r),(t=>o(r["set"+s](...T(u,(s=>m(s)?s(e,r):s)),t),t)))))),[n,s,...r,...l,...u])},ve=(e,s,t=S,r=pe,...o)=>{const l=z(e);return oe((()=>t(null==l?void 0:l["del"+s](...o))),[l,s,...r,...o])},ye=(e,s,t)=>{const r=X(e);return oe((()=>null==r?void 0:r[s](t)),[r,s,t])},ge=e=>we(p,z(e),1),he=(e,s)=>we(I,z(s),1,[e]),me=(e,s,t,r=0,o,l)=>we(b,z(l),1,[e,s,t,r,o]),Le=(e,s,t)=>we(w,z(t),1,[e,s]),Se=(e,s,t,r)=>we(C,z(r),3,[e,s,t]),fe=e=>we(v,z(e),1),Ve=(e,s)=>we(R,z(s),3,[e]),Te=(e,s)=>we("Metric",U(s),3,[e]),Pe=(e,s)=>we("SliceIds",J(s),1,[e]),Oe=(e,s,t)=>we("Slice"+I,J(t),1,[e,s]),qe=(e,s,t)=>we("RemoteRowId",K(t),3,[e,s]),Be=(e,s,t)=>we("Local"+I,K(t),1,[e,s]),He=(e,s,t)=>we("Linked"+I,K(t),1,[e,s]),Me=(e,s)=>we(u+I,N(s),1,[e]),je=(e,s,t,r=0,o,l)=>we(u+b,N(l),1,[e,s,t,r,o]),De=(e,s,t)=>we(u+w,N(t),1,[e,s]),Ee=(e,s,t,r)=>we(u+C,N(r),3,[e,s,t]),Fe=e=>we("CheckpointIds",X(e),2),Qe=(e,s)=>we("Checkpoint",X(s),3,[e]),Ae=e=>ye(e,"goBackward"),Ge=e=>ye(e,"goForward"),{PureComponent:We,Fragment:ze,createElement:Ue,useCallback:Je,useLayoutEffect:Ke,useRef:Ne,useState:Xe}=e,Ye=(e,...s)=>y(e)?{}:e(...s),Ze=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var $e=Object.defineProperty,_e=Object.defineProperties,es=Object.getOwnPropertyDescriptors,ss=Object.getOwnPropertySymbols,ts=Object.prototype.hasOwnProperty,rs=Object.prototype.propertyIsEnumerable,os=(e,s,t)=>s in e?$e(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ls=(e,s)=>{for(var t in s||(s={}))ts.call(s,t)&&os(e,t,s[t]);if(ss)for(var t of ss(s))rs.call(s,t)&&os(e,t,s[t]);return e},us=(e,s)=>_e(e,es(s)),ns=(e,s)=>{var t={};for(var r in e)ts.call(e,r)&&s.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&ss)for(var r of ss(e))s.indexOf(r)<0&&rs.call(e,r)&&(t[r]=e[r]);return t};const{useCallback:ds,useContext:as,useMemo:is,useState:ps}=e,cs=({tableId:e,store:s,rowComponent:t=Rs,getRowComponentProps:r,customCellIds:o,separator:l,debugIds:u},n)=>Cs(T(n,(l=>Ue(t,us(ls({},Ye(r,l)),{key:l,tableId:e,rowId:l,customCellIds:o,store:s,debugIds:u})))),l,u,e),xs=({queryId:e,queries:s,resultRowComponent:t=hs,getResultRowComponentProps:r,separator:o,debugIds:l},u)=>Cs(T(u,(o=>Ue(t,us(ls({},Ye(r,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:l})))),o,l,e),Is=({relationshipId:e,relationships:s,rowComponent:t=Rs,getRowComponentProps:r,separator:o,debugIds:l},u,n)=>{const[d,a,i]=Ze(K(s),e),p=u(e,n,d);return Cs(T(p,(e=>Ue(t,us(ls({},Ye(r,e)),{key:e,tableId:i,rowId:e,store:a,debugIds:l})))),o,l,n)},bs=e=>({checkpoints:s,checkpointComponent:t=ms,getCheckpointComponentProps:r,separator:o,debugIds:l})=>{const u=X(s);return Cs(T(e(Fe(u)),(e=>Ue(t,us(ls({},Ye(r,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:l})))),o)},Cs=(e,s,t,r)=>{const o=y(s)||!Array.isArray(e)?e:T(e,((e,t)=>t>0?[s,e]:e));return t?[r,":{",o,"}"]:o},ws=({tableId:e,rowId:s,cellId:r,store:o,debugIds:l})=>{var u;return Cs(t+(null!=(u=Se(e,s,r,o))?u:t),void 0,l,r)},Rs=({tableId:e,rowId:s,store:t,cellComponent:r=ws,getCellComponentProps:o,customCellIds:l,separator:u,debugIds:n})=>Cs(T(((e,s,t,r)=>{const o=Le(s,t,r);return null!=e?e:o})(l,e,s,t),(l=>Ue(r,us(ls({},Ye(o,l)),{key:l,tableId:e,rowId:s,cellId:l,store:t,debugIds:n})))),u,n,s),ks=e=>cs(e,he(e.tableId,e.store)),vs=({valueId:e,store:s,debugIds:r})=>{var o;return Cs(t+(null!=(o=Ve(e,s))?o:t),void 0,r,e)},ys=({indexId:e,sliceId:s,indexes:t,rowComponent:r=Rs,getRowComponentProps:o,separator:l,debugIds:u})=>{const[n,d,a]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(J(t),e),i=Oe(e,s,n);return Cs(T(i,(e=>Ue(r,us(ls({},Ye(o,e)),{key:e,tableId:a,rowId:e,store:d,debugIds:u})))),l,u,s)},gs=({queryId:e,rowId:s,cellId:r,queries:o,debugIds:l})=>{var u;return Cs(t+(null!=(u=Ee(e,s,r,o))?u:t),void 0,l,r)},hs=({queryId:e,rowId:s,queries:t,resultCellComponent:r=gs,getResultCellComponentProps:o,separator:l,debugIds:u})=>Cs(T(De(e,s,t),(l=>Ue(r,us(ls({},Ye(o,l)),{key:l,queryId:e,rowId:s,cellId:l,queries:t,debugIds:u})))),l,u,s),ms=({checkpoints:e,checkpointId:s,debugIds:r})=>{var o;return Cs(null!=(o=Qe(s,e))?o:t,void 0,r,s)},Ls=bs((e=>e[0])),Ss=bs((e=>y(e[1])?[]:[e[1]])),fs=bs((e=>e[2]));exports.BackwardCheckpointsView=Ls,exports.CellView=ws,exports.CheckpointView=ms,exports.CurrentCheckpointView=Ss,exports.ForwardCheckpointsView=fs,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=ys,getSliceComponentProps:r,separator:o,debugIds:l})=>Cs(T(Pe(e,s),(o=>Ue(t,us(ls({},Ye(r,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:l})))),o,l,e),exports.LinkedRowsView=e=>Is(e,He,e.firstRowId),exports.LocalRowsView=e=>Is(e,Be,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:r})=>{var o;return Cs(null!=(o=Te(e,s))?o:t,void 0,r,e)},exports.Provider=({store:e,storesById:s,metrics:t,metricsById:r,indexes:o,indexesById:l,relationships:u,relationshipsById:n,queries:d,queriesById:a,checkpoints:i,checkpointsById:p,children:c})=>{const x=as(Q),[I,b]=ps({}),C=ds(((e,s)=>b((t=>M(t,e)==s?t:us(ls({},t),{[e]:s})))),[]),w=ds((e=>b((s=>ls({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Ue(Q.Provider,{value:is((()=>[null!=e?e:x[0],ls(ls(ls({},x[1]),s),I),null!=t?t:x[2],ls(ls({},x[3]),r),null!=o?o:x[4],ls(ls({},x[5]),l),null!=u?u:x[6],ls(ls({},x[7]),n),null!=d?d:x[8],ls(ls({},x[9]),a),null!=i?i:x[10],ls(ls({},x[11]),p),C,w]),[e,s,I,t,r,o,l,u,n,d,a,i,p,x,C,w])},c)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:r=Rs,getRowComponentProps:o,debugIds:l})=>{const[u,n,,d]=Ze(K(t),e),a=qe(e,s,u);return Cs(y(d)||y(a)?null:Ue(r,us(ls({},Ye(o,a)),{key:a,tableId:d,rowId:a,store:n,debugIds:l})),void 0,l,s)},exports.ResultCellView=gs,exports.ResultRowView=hs,exports.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:r,offset:o,limit:l}=s,u=ns(s,["cellId","descending","offset","limit"]);return xs(u,je(u.queryId,t,r,o,l,u.queries))},exports.ResultTableView=e=>xs(e,Me(e.queryId,e.queries)),exports.RowView=Rs,exports.SliceView=ys,exports.SortedTableView=e=>{var s=e,{cellId:t,descending:r,offset:o,limit:l}=s,u=ns(s,["cellId","descending","offset","limit"]);return cs(u,me(u.tableId,t,r,o,l,u.store))},exports.TableView=ks,exports.TablesView=({store:e,tableComponent:s=ks,getTableComponentProps:t,separator:r,debugIds:o})=>Cs(T(ge(e),(r=>Ue(s,us(ls({},Ye(t,r)),{key:r,tableId:r,store:e,debugIds:o})))),r),exports.ValueView=vs,exports.ValuesView=({store:e,valueComponent:s=vs,getValueComponentProps:t,separator:r,debugIds:o})=>Cs(T(fe(e),(r=>Ue(s,us(ls({},Ye(t,r)),{key:r,valueId:r,store:e,debugIds:o})))),r),exports.useAddRowCallback=(e,s,t=pe,r,o=S,l=pe,u=!0)=>{const n=z(r);return oe((t=>g(n,(r=>g(s(t,r),(s=>o(r.addRow(m(e)?e(t,r):e,s,u),r,s)))))),[n,e,...t,...l,u])},exports.useCell=Se,exports.useCellIds=Le,exports.useCellIdsListener=(e,s,t,r,o,l)=>Re(w,z(l),t,r,[e,s],o),exports.useCellListener=(e,s,t,r,o,l,u)=>Re(C,z(u),r,o,[e,s,t],l),exports.useCheckpoint=Qe,exports.useCheckpointIds=Fe,exports.useCheckpointIdsListener=(e,s,t)=>Re("CheckpointIds",X(t),e,s),exports.useCheckpointListener=(e,s,t,r)=>Re("Checkpoint",X(r),s,t,[e]),exports.useCheckpoints=e=>A(e,10),exports.useCheckpointsIds=()=>W(11),exports.useCheckpointsOrCheckpointsById=X,exports.useCreateCheckpoints=(e,s,t)=>be(e,s,t),exports.useCreateIndexes=(e,s,t)=>be(e,s,t),exports.useCreateMergeableStore=(e,s=pe)=>ue(e,s),exports.useCreateMetrics=(e,s,t)=>be(e,s,t),exports.useCreatePersister=(e,s,t=pe,r,o=pe,l,u=pe)=>{const[,n]=ae(),[d,a]=ae();return le((()=>{const t=e?s(e):void 0;a(t),t&&r&&re(void 0,null,(function*(){yield r(t),n([])}))}),[e,...t,...o]),le((()=>()=>{d&&(d.destroy(),null==l||l(d))}),[d,...u]),d},exports.useCreateQueries=(e,s,t)=>be(e,s,t),exports.useCreateRelationships=(e,s,t)=>be(e,s,t),exports.useCreateStore=(e,s=pe)=>ue(e,s),exports.useCreateSynchronizer=(e,s,t=pe,r,o=pe)=>{const[l,u]=ae();return le((()=>{re(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),le((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...o]),l},exports.useDelCellCallback=(e,s,t,r,o,l,u)=>ve(o,C,l,u,e,s,t,r),exports.useDelRowCallback=(e,s,t,r,o)=>ve(t,c,r,o,e,s),exports.useDelTableCallback=(e,s,t,r)=>ve(s,a,t,r,e),exports.useDelTablesCallback=(e,s,t)=>ve(e,i,s,t),exports.useDelValueCallback=(e,s,t,r)=>ve(s,R,t,r,e),exports.useDelValuesCallback=(e,s,t)=>ve(e,k,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>Re("DidFinish"+Z,z(t),e,s),exports.useGoBackwardCallback=Ae,exports.useGoForwardCallback=Ge,exports.useGoToCallback=(e,s=pe,t,r=S,o=pe)=>{const l=X(t);return oe((s=>g(l,(t=>g(e(s),(e=>r(t.goTo(e),e)))))),[l,...s,...o])},exports.useHasCell=(e,s,t,r)=>we(C,z(r),4,[e,s,t]),exports.useHasCellListener=(e,s,t,r,o,l,u)=>Re(n+C,z(u),r,o,[e,s,t],l),exports.useHasRow=(e,s,t)=>we(c,z(t),4,[e,s]),exports.useHasRowListener=(e,s,t,r,o,l)=>Re(n+c,z(l),t,r,[e,s],o),exports.useHasTable=(e,s)=>we(a,z(s),4,[e]),exports.useHasTableCell=(e,s,t)=>we(a+C,z(t),4,[e,s]),exports.useHasTableCellListener=(e,s,t,r,o,l)=>Re(n+a+C,z(l),t,r,[e,s],o),exports.useHasTableListener=(e,s,t,r,o)=>Re(n+a,z(o),s,t,[e],r),exports.useHasTables=e=>we(i,z(e),4,[]),exports.useHasTablesListener=(e,s,t,r)=>Re(n+i,z(r),e,s,[],t),exports.useHasValue=(e,s)=>we(R,z(s),4,[e]),exports.useHasValueListener=(e,s,t,r,o)=>Re(n+R,z(o),s,t,[e],r),exports.useHasValues=e=>we(k,z(e),4,[]),exports.useHasValuesListener=(e,s,t,r)=>Re(n+k,z(r),e,s,[],t),exports.useIndexIds=e=>we("IndexIds",J(e),1),exports.useIndexes=e=>A(e,4),exports.useIndexesIds=()=>W(5),exports.useIndexesOrIndexesById=J,exports.useLinkedRowIds=He,exports.useLinkedRowIdsListener=(e,s,t,r,o)=>Re("Linked"+I,K(o),t,r,[e,s]),exports.useLocalRowIds=Be,exports.useLocalRowIdsListener=(e,s,t,r,o)=>Re("Local"+I,K(o),t,r,[e,s]),exports.useMetric=Te,exports.useMetricIds=e=>we("MetricIds",U(e),1),exports.useMetricListener=(e,s,t,r)=>Re("Metric",U(r),s,t,[e]),exports.useMetrics=e=>A(e,2),exports.useMetricsIds=()=>W(3),exports.useMetricsOrMetricsById=U,exports.useProvideStore=(e,s)=>{const{12:t,13:r}=E(Q);F((()=>(null==t||t(e,s),()=>null==r?void 0:r(e))),[t,e,s,r])},exports.useQueries=e=>A(e,8),exports.useQueriesIds=()=>W(9),exports.useQueriesOrQueriesById=N,exports.useQueryIds=e=>we("QueryIds",N(e),1),exports.useRedoInformation=e=>{var s;const r=X(e),[,,[o]]=Fe(r);return[!y(o),Ge(r),o,null!=(s=g(o,(e=>null==r?void 0:r.getCheckpoint(e))))?s:t]},exports.useRelationshipIds=e=>we("RelationshipIds",K(e),1),exports.useRelationships=e=>A(e,6),exports.useRelationshipsIds=()=>W(7),exports.useRelationshipsOrRelationshipsById=K,exports.useRemoteRowId=qe,exports.useRemoteRowIdListener=(e,s,t,r,o)=>Re("RemoteRowId",K(o),t,r,[e,s]),exports.useResultCell=Ee,exports.useResultCellIds=De,exports.useResultCellIdsListener=(e,s,t,r,o)=>Re(u+w,N(o),t,r,[e,s]),exports.useResultCellListener=(e,s,t,r,o,l)=>Re(u+C,N(l),r,o,[e,s,t]),exports.useResultRow=(e,s,t)=>we(u+c,N(t),0,[e,s]),exports.useResultRowCount=(e,s)=>we(u+x,N(s),5,[e]),exports.useResultRowCountListener=(e,s,t,r)=>Re(u+x,N(r),s,t,[e]),exports.useResultRowIds=Me,exports.useResultRowIdsListener=(e,s,t,r)=>Re(u+I,N(r),s,t,[e]),exports.useResultRowListener=(e,s,t,r,o)=>Re(u+c,N(o),t,r,[e,s]),exports.useResultSortedRowIds=je,exports.useResultSortedRowIdsListener=(e,s,t,r,o,l,n,d)=>Re(u+b,N(d),l,n,[e,s,t,r,o]),exports.useResultTable=(e,s)=>we(u+a,N(s),0,[e]),exports.useResultTableCellIds=(e,s)=>we(u+a+w,N(s),1,[e]),exports.useResultTableCellIdsListener=(e,s,t,r)=>Re(u+a+w,N(r),s,t,[e]),exports.useResultTableListener=(e,s,t,r)=>Re(u+a,N(r),s,t,[e]),exports.useRow=(e,s,t)=>we(c,z(t),0,[e,s]),exports.useRowCount=(e,s)=>we(x,z(s),5,[e]),exports.useRowCountListener=(e,s,t,r,o)=>Re(x,z(o),s,t,[e],r),exports.useRowIds=he,exports.useRowIdsListener=(e,s,t,r,o)=>Re(I,z(o),s,t,[e],r),exports.useRowListener=(e,s,t,r,o,l)=>Re(c,z(l),t,r,[e,s],o),exports.useSetCellCallback=(e,s,t,r,o,l,u,n)=>ke(l,C,r,o,u,n,e,s,t),exports.useSetCheckpointCallback=(e=S,s=pe,t,r=S,o=pe)=>{const l=X(t);return oe((s=>g(l,(t=>{const o=e(s);r(t.addCheckpoint(o),t,o)}))),[l,...s,...o])},exports.useSetPartialRowCallback=(e,s,t,r,o,l,u)=>ke(o,"PartialRow",t,r,l,u,e,s),exports.useSetPartialValuesCallback=(e,s,t,r,o)=>ke(t,"PartialValues",e,s,r,o),exports.useSetRowCallback=(e,s,t,r,o,l,u)=>ke(o,c,t,r,l,u,e,s),exports.useSetTableCallback=(e,s,t,r,o,l)=>ke(r,a,s,t,o,l,e),exports.useSetTablesCallback=(e,s,t,r,o)=>ke(t,i,e,s,r,o),exports.useSetValueCallback=(e,s,t,r,o,l)=>ke(r,R,s,t,o,l,e),exports.useSetValuesCallback=(e,s,t,r,o)=>ke(t,k,e,s,r,o),exports.useSliceIds=Pe,exports.useSliceIdsListener=(e,s,t,r)=>Re("SliceIds",J(r),s,t,[e]),exports.useSliceRowIds=Oe,exports.useSliceRowIdsListener=(e,s,t,r,o)=>Re("Slice"+I,J(o),t,r,[e,s]),exports.useSortedRowIds=me,exports.useSortedRowIdsListener=(e,s,t,r,o,l,u,n,d)=>Re(b,z(d),l,u,[e,s,t,r,o],n),exports.useStartTransactionListener=(e,s,t)=>Re("Start"+Z,z(t),e,s),exports.useStore=e=>A(e,0),exports.useStoreIds=()=>W(1),exports.useStoreOrStoreById=z,exports.useTable=(e,s)=>we(a,z(s),0,[e]),exports.useTableCellIds=(e,s)=>we(a+w,z(s),1,[e]),exports.useTableCellIdsListener=(e,s,t,r,o)=>Re(a+w,z(o),s,t,[e],r),exports.useTableIds=ge,exports.useTableIdsListener=(e,s,t,r)=>Re(p,z(r),e,s,pe,t),exports.useTableListener=(e,s,t,r,o)=>Re(a,z(o),s,t,[e],r),exports.useTables=e=>we(i,z(e),0),exports.useTablesListener=(e,s,t,r)=>Re(i,z(r),e,s,pe,t),exports.useUndoInformation=e=>{var s;const r=X(e),[o,l]=Fe(r);return[(u=o,!(0==L(u))),Ae(r),l,null!=(s=g(l,(e=>null==r?void 0:r.getCheckpoint(e))))?s:t];var u},exports.useValue=Ve,exports.useValueIds=fe,exports.useValueIdsListener=(e,s,t,r)=>Re(v,z(r),e,s,pe,t),exports.useValueListener=(e,s,t,r,o)=>Re(R,z(o),s,t,[e],r),exports.useValues=e=>we(k,z(e),0),exports.useValuesListener=(e,s,t,r)=>Re(k,z(r),e,s,pe,t),exports.useWillFinishTransactionListener=(e,s,t)=>Re("WillFinish"+Z,z(t),e,s);
Binary file
@@ -150,10 +150,10 @@ const useCreate = (store, create, createDeps = EMPTY_ARRAY) => {
150
150
  const [thing, setThing] = useState$2();
151
151
  useEffect(
152
152
  () => {
153
- const newThing = create(store);
153
+ const newThing = store ? create(store) : void 0;
154
154
  setThing(newThing);
155
155
  rerender([]);
156
- return newThing.destroy;
156
+ return newThing?.destroy;
157
157
  },
158
158
  // eslint-disable-next-line react-hooks/exhaustive-deps
159
159
  [store, ...createDeps],
@@ -189,7 +189,8 @@ const useListenable = (listenable, thing, type, args = EMPTY_ARRAY) => {
189
189
  /* eslint-disable-next-line react-hooks/exhaustive-deps */
190
190
  [thing, type, listenable, ...args],
191
191
  );
192
- return useSyncExternalStore(subscribe, getResult);
192
+ const result = useSyncExternalStore(subscribe, getResult);
193
+ return type == 0 ? {...result} : type < 3 ? [...result] : result;
193
194
  };
194
195
  const useListener = (
195
196
  listenable,
@@ -1293,7 +1294,7 @@ const useCreatePersister = (
1293
1294
  const [persister, setPersister] = useState$2();
1294
1295
  useEffect(
1295
1296
  () => {
1296
- const persister2 = create(store);
1297
+ const persister2 = store ? create(store) : void 0;
1297
1298
  setPersister(persister2);
1298
1299
  if (persister2 && then) {
1299
1300
  (async () => {
@@ -1328,7 +1329,7 @@ const useCreateSynchronizer = (
1328
1329
  useEffect(
1329
1330
  () => {
1330
1331
  (async () => {
1331
- const synchronizer2 = await create(store);
1332
+ const synchronizer2 = store ? await create(store) : void 0;
1332
1333
  setSynchronizer(synchronizer2);
1333
1334
  })();
1334
1335
  },
@@ -1 +1 @@
1
- import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",c=i+"s",a=i+u,I="Row",p=I+"Count",b=I+u,g="Sorted"+I+u,v="Cell",y=v+u,m="Value",C=m+"s",w=m+u,f=e=>null==e,k=(e,t,o)=>f(e)?null==o?void 0:o():t(e),h=e=>t(e)==r,P=e=>t(e)==n,R=e=>e.length,x=()=>{},q=(e,t)=>e.every(t),S=(e,t)=>R(e)===R(t)&&q(e,((e,o)=>t[o]===e)),O=(e,t)=>e.map(t),L=Object,j=e=>L.getPrototypeOf(e),B=L.entries,E=e=>!f(e)&&k(j(e),(e=>e==L.prototype||f(j(e))),(()=>!0)),T=L.keys,M=(e,t)=>k(e,(e=>e[t])),F=(e,t)=>{const o=B(e);return R(o)===R(T(t))&&q(o,(([e,o])=>E(o)?!!E(t[e])&&F(t[e],o):t[e]===o))},{createContext:V,useContext:A,useEffect:D}=e,H=V([]),Q=(e,t)=>{var o;const r=A(H);return f(e)?r[t]:h(e)?M(null!=(o=r[t+1])?o:{},e):e},W=(e,t)=>{const o=Q(e,t);return f(e)||h(e)?o:e},z=e=>{var t;return T(null!=(t=A(H)[e])?t:{})},G=e=>Q(e,0),J=e=>W(e,0),K=(e,t)=>{const{12:o,13:r}=A(H);D((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},N=e=>Q(e,2),U=e=>W(e,2),X=e=>Q(e,4),Y=e=>W(e,4),Z=e=>Q(e,6),$=e=>W(e,6),_=e=>Q(e,8),ee=e=>W(e,8),te=e=>Q(e,10),oe=e=>W(e,10),re=e=>e.toLowerCase();re(l);const ne="Transaction";re(ne);var le=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:se,useEffect:de,useMemo:ue,useLayoutEffect:ie,useRef:ce,useState:ae,useSyncExternalStore:Ie}=e,pe=[],be=[{},[],[pe,void 0,pe],void 0,!1,0],ge=(e,t)=>e===t,ve=[F,S,([e,t,o],[r,n,l])=>t===n&&S(e,r)&&S(o,l)],ye=(e,t,o=pe)=>{const[,r]=ae(),[n,l]=ae();return de((()=>{const o=t(e);return l(o),r([]),o.destroy}),[e,...o]),n},me=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},Ce=(e,t,r,n=pe)=>{const l=ce(be[r]),s=se((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:be[r];return(null!=(d=ve[r])?d:ge)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=se((l=>me(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]);return Ie(u,s)},we=(e,t,o,r=pe,n=pe,...l)=>ie((()=>me(t,e,...n,o,...l)),[t,e,...n,...r,...l]),fe=(e,t,o,r=pe,n=x,l=pe,...s)=>{const d=J(e);return se((e=>k(d,(r=>k(o(e,r),(o=>n(r["set"+t](...O(s,(t=>P(t)?t(e,r):t)),o),o)))))),[d,t,...r,...l,...s])},ke=(e,t,o=x,r=pe,...n)=>{const l=J(e);return se((()=>o(null==l?void 0:l["del"+t](...n))),[l,t,...r,...n])},he=(e,t,o)=>{const r=oe(e);return se((()=>null==r?void 0:r[t](o)),[r,t,o])},Pe=(e,t=pe)=>ue(e,t),Re=(e,t=pe)=>ue(e,t),xe=()=>z(1),qe=e=>Ce(c,J(e),4,[]),Se=e=>Ce(c,J(e),0),Oe=e=>Ce(a,J(e),1),Le=(e,t)=>Ce(i,J(t),4,[e]),je=(e,t)=>Ce(i,J(t),0,[e]),Be=(e,t)=>Ce(i+y,J(t),1,[e]),Ee=(e,t,o)=>Ce(i+v,J(o),4,[e,t]),Te=(e,t)=>Ce(p,J(t),5,[e]),Me=(e,t)=>Ce(b,J(t),1,[e]),Fe=(e,t,o,r=0,n,l)=>Ce(g,J(l),1,[e,t,o,r,n]),Ve=(e,t,o)=>Ce(I,J(o),4,[e,t]),Ae=(e,t,o)=>Ce(I,J(o),0,[e,t]),De=(e,t,o)=>Ce(y,J(o),1,[e,t]),He=(e,t,o,r)=>Ce(v,J(r),4,[e,t,o]),Qe=(e,t,o,r)=>Ce(v,J(r),3,[e,t,o]),We=e=>Ce(C,J(e),4,[]),ze=e=>Ce(C,J(e),0),Ge=e=>Ce(w,J(e),1),Je=(e,t)=>Ce(m,J(t),4,[e]),Ke=(e,t)=>Ce(m,J(t),3,[e]),Ne=(e,t,o,r,n)=>fe(o,c,e,t,r,n),Ue=(e,t,o,r,n,l)=>fe(r,i,t,o,n,l,e),Xe=(e,t,o,r,n,l,s)=>fe(n,I,o,r,l,s,e,t),Ye=(e,t,o=pe,r,n=x,l=pe,s=!0)=>{const d=J(r);return se((o=>k(d,(r=>k(t(o,r),(t=>n(r.addRow(P(e)?e(o,r):e,t,s),r,t)))))),[d,e,...o,...l,s])},Ze=(e,t,o,r,n,l,s)=>fe(n,"PartialRow",o,r,l,s,e,t),$e=(e,t,o,r,n,l,s,d)=>fe(l,v,r,n,s,d,e,t,o),_e=(e,t,o,r,n)=>fe(o,C,e,t,r,n),et=(e,t,o,r,n)=>fe(o,"PartialValues",e,t,r,n),tt=(e,t,o,r,n,l)=>fe(r,m,t,o,n,l,e),ot=(e,t,o)=>ke(e,c,t,o),rt=(e,t,o,r)=>ke(t,i,o,r,e),nt=(e,t,o,r,n)=>ke(o,I,r,n,e,t),lt=(e,t,o,r,n,l,s)=>ke(n,v,l,s,e,t,o,r),st=(e,t,o)=>ke(e,C,t,o),dt=(e,t,o,r)=>ke(t,m,o,r,e),ut=(e,t,o,r)=>we(d+c,J(r),e,t,[],o),it=(e,t,o,r)=>we(c,J(r),e,t,pe,o),ct=(e,t,o,r)=>we(a,J(r),e,t,pe,o),at=(e,t,o,r,n)=>we(d+i,J(n),t,o,[e],r),It=(e,t,o,r,n)=>we(i,J(n),t,o,[e],r),pt=(e,t,o,r,n)=>we(i+y,J(n),t,o,[e],r),bt=(e,t,o,r,n,l)=>we(d+i+v,J(l),o,r,[e,t],n),gt=(e,t,o,r,n)=>we(p,J(n),t,o,[e],r),vt=(e,t,o,r,n)=>we(b,J(n),t,o,[e],r),yt=(e,t,o,r,n,l,s,d,u)=>we(g,J(u),l,s,[e,t,o,r,n],d),mt=(e,t,o,r,n,l)=>we(d+I,J(l),o,r,[e,t],n),Ct=(e,t,o,r,n,l)=>we(I,J(l),o,r,[e,t],n),wt=(e,t,o,r,n,l)=>we(y,J(l),o,r,[e,t],n),ft=(e,t,o,r,n,l,s)=>we(d+v,J(s),r,n,[e,t,o],l),kt=(e,t,o,r,n,l,s)=>we(v,J(s),r,n,[e,t,o],l),ht=(e,t,o,r)=>we(d+C,J(r),e,t,[],o),Pt=(e,t,o,r)=>we(C,J(r),e,t,pe,o),Rt=(e,t,o,r)=>we(w,J(r),e,t,pe,o),xt=(e,t,o,r,n)=>we(d+m,J(n),t,o,[e],r),qt=(e,t,o,r,n)=>we(m,J(n),t,o,[e],r),St=(e,t,o)=>we("Start"+ne,J(o),e,t),Ot=(e,t,o)=>we("WillFinish"+ne,J(o),e,t),Lt=(e,t,o)=>we("DidFinish"+ne,J(o),e,t),jt=(e,t,o)=>ye(e,t,o),Bt=()=>z(3),Et=e=>Ce("MetricIds",U(e),1),Tt=(e,t)=>Ce("Metric",U(t),3,[e]),Mt=(e,t,o,r)=>we("Metric",U(r),t,o,[e]),Ft=(e,t,o)=>ye(e,t,o),Vt=()=>z(5),At=(e,t)=>Ce("SliceIds",Y(t),1,[e]),Dt=e=>Ce("IndexIds",Y(e),1),Ht=(e,t,o)=>Ce("Slice"+b,Y(o),1,[e,t]),Qt=(e,t,o,r)=>we("SliceIds",Y(r),t,o,[e]),Wt=(e,t,o,r,n)=>we("Slice"+b,Y(n),o,r,[e,t]),zt=(e,t,o)=>ye(e,t,o),Gt=()=>z(7),Jt=e=>Ce("RelationshipIds",$(e),1),Kt=(e,t,o)=>Ce("RemoteRowId",$(o),3,[e,t]),Nt=(e,t,o)=>Ce("Local"+b,$(o),1,[e,t]),Ut=(e,t,o)=>Ce("Linked"+b,$(o),1,[e,t]),Xt=(e,t,o,r,n)=>we("RemoteRowId",$(n),o,r,[e,t]),Yt=(e,t,o,r,n)=>we("Local"+b,$(n),o,r,[e,t]),Zt=(e,t,o,r,n)=>we("Linked"+b,$(n),o,r,[e,t]),$t=(e,t,o)=>ye(e,t,o),_t=()=>z(9),eo=e=>Ce("QueryIds",ee(e),1),to=(e,t)=>Ce(s+i,ee(t),0,[e]),oo=(e,t)=>Ce(s+i+y,ee(t),1,[e]),ro=(e,t)=>Ce(s+p,ee(t),5,[e]),no=(e,t)=>Ce(s+b,ee(t),1,[e]),lo=(e,t,o,r=0,n,l)=>Ce(s+g,ee(l),1,[e,t,o,r,n]),so=(e,t,o)=>Ce(s+I,ee(o),0,[e,t]),uo=(e,t,o)=>Ce(s+y,ee(o),1,[e,t]),io=(e,t,o,r)=>Ce(s+v,ee(r),3,[e,t,o]),co=(e,t,o,r)=>we(s+i,ee(r),t,o,[e]),ao=(e,t,o,r)=>we(s+i+y,ee(r),t,o,[e]),Io=(e,t,o,r)=>we(s+p,ee(r),t,o,[e]),po=(e,t,o,r)=>we(s+b,ee(r),t,o,[e]),bo=(e,t,o,r,n,l,d,u)=>we(s+g,ee(u),l,d,[e,t,o,r,n]),go=(e,t,o,r,n)=>we(s+I,ee(n),o,r,[e,t]),vo=(e,t,o,r,n)=>we(s+y,ee(n),o,r,[e,t]),yo=(e,t,o,r,n,l)=>we(s+v,ee(l),r,n,[e,t,o]),mo=(e,t,o)=>ye(e,t,o),Co=()=>z(11),wo=e=>Ce("CheckpointIds",oe(e),2),fo=(e,t)=>Ce("Checkpoint",oe(t),3,[e]),ko=(e=x,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},ho=e=>he(e,"goBackward"),Po=e=>he(e,"goForward"),Ro=(e,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},xo=e=>{var t;const r=oe(e),[n,l]=wo(r);return[(s=n,!(0==R(s))),ho(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},qo=e=>{var t;const r=oe(e),[,,[n]]=wo(r);return[!f(n),Po(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},So=(e,t,o)=>we("CheckpointIds",oe(o),e,t),Oo=(e,t,o,r)=>we("Checkpoint",oe(r),t,o,[e]),Lo=(e,t,o=pe,r,n=pe,l,s=pe)=>{const[,d]=ae(),[u,i]=ae();return de((()=>{const o=t(e);i(o),o&&r&&le(void 0,null,(function*(){yield r(o),d([])}))}),[e,...o,...n]),de((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},jo=(e,t,o=pe,r,n=pe)=>{const[l,s]=ae();return de((()=>{le(void 0,null,(function*(){const o=yield t(e);s(o)}))}),[e,...o]),de((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:Bo,Fragment:Eo,createElement:To,useCallback:Mo,useLayoutEffect:Fo,useRef:Vo,useState:Ao}=e,Do=(e,...t)=>f(e)?{}:e(...t),Ho=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var Qo=Object.defineProperty,Wo=Object.defineProperties,zo=Object.getOwnPropertyDescriptors,Go=Object.getOwnPropertySymbols,Jo=Object.prototype.hasOwnProperty,Ko=Object.prototype.propertyIsEnumerable,No=(e,t,o)=>t in e?Qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Uo=(e,t)=>{for(var o in t||(t={}))Jo.call(t,o)&&No(e,o,t[o]);if(Go)for(var o of Go(t))Ko.call(t,o)&&No(e,o,t[o]);return e},Xo=(e,t)=>Wo(e,zo(t)),Yo=(e,t)=>{var o={};for(var r in e)Jo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Go)for(var r of Go(e))t.indexOf(r)<0&&Ko.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:Zo,useContext:$o,useMemo:_o,useState:er}=e,tr=({tableId:e,store:t,rowComponent:o=ur,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>sr(O(d,(l=>To(o,Xo(Uo({},Do(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),or=({queryId:e,queries:t,resultRowComponent:o=fr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>sr(O(s,(n=>To(o,Xo(Uo({},Do(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),rr=({relationshipId:e,relationships:t,rowComponent:o=ur,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,c]=Ho($(t),e),a=s(e,d,u);return sr(O(a,(e=>To(o,Xo(Uo({},Do(r,e)),{key:e,tableId:c,rowId:e,store:i,debugIds:l})))),n,l,d)},nr=e=>({checkpoints:t,checkpointComponent:o=Pr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=oe(t);return sr(O(e(wo(s)),(e=>To(o,Xo(Uo({},Do(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},lr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:c,checkpointsById:a,children:I})=>{const p=$o(H),[b,g]=er({}),v=Zo(((e,t)=>g((o=>M(o,e)==t?o:Xo(Uo({},o),{[e]:t})))),[]),y=Zo((e=>g((t=>Uo({},((e,t)=>(delete e[t],e))(t,e))))),[]);return To(H.Provider,{value:_o((()=>[null!=e?e:p[0],Uo(Uo(Uo({},p[1]),t),b),null!=o?o:p[2],Uo(Uo({},p[3]),r),null!=n?n:p[4],Uo(Uo({},p[5]),l),null!=s?s:p[6],Uo(Uo({},p[7]),d),null!=u?u:p[8],Uo(Uo({},p[9]),i),null!=c?c:p[10],Uo(Uo({},p[11]),a),v,y]),[e,t,b,o,r,n,l,s,d,u,i,c,a,p,v,y])},I)},sr=(e,t,o,r)=>{const n=f(t)||!Array.isArray(e)?e:O(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},dr=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return sr(o+(null!=(s=Qe(e,t,r,n))?s:o),void 0,l,r)},ur=({tableId:e,rowId:t,store:o,cellComponent:r=dr,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>sr(O(((e,t,o,r)=>{const n=De(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>To(r,Xo(Uo({},Do(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),ir=e=>tr(e,Me(e.tableId,e.store)),cr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=Yo(t,["cellId","descending","offset","limit"]);return tr(s,Fe(s.tableId,o,r,n,l,s.store))},ar=({store:e,tableComponent:t=ir,getTableComponentProps:o,separator:r,debugIds:n})=>sr(O(Oe(e),(r=>To(t,Xo(Uo({},Do(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),Ir=({valueId:e,store:t,debugIds:r})=>{var n;return sr(o+(null!=(n=Ke(e,t))?n:o),void 0,r,e)},pr=({store:e,valueComponent:t=Ir,getValueComponentProps:o,separator:r,debugIds:n})=>sr(O(Ge(e),(r=>To(t,Xo(Uo({},Do(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),br=({metricId:e,metrics:t,debugIds:r})=>{var n;return sr(null!=(n=Tt(e,t))?n:o,void 0,r,e)},gr=({indexId:e,sliceId:t,indexes:o,rowComponent:r=ur,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(Y(o),e),c=Ht(e,t,d);return sr(O(c,(e=>To(r,Xo(Uo({},Do(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},vr=({indexId:e,indexes:t,sliceComponent:o=gr,getSliceComponentProps:r,separator:n,debugIds:l})=>sr(O(At(e,t),(n=>To(o,Xo(Uo({},Do(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),yr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=ur,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=Ho($(o),e),i=Kt(e,t,s);return sr(f(u)||f(i)?null:To(r,Xo(Uo({},Do(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},mr=e=>rr(e,Nt,e.remoteRowId),Cr=e=>rr(e,Ut,e.firstRowId),wr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return sr(o+(null!=(s=io(e,t,r,n))?s:o),void 0,l,r)},fr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=wr,getResultCellComponentProps:n,separator:l,debugIds:s})=>sr(O(uo(e,t,o),(l=>To(r,Xo(Uo({},Do(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),kr=e=>or(e,no(e.queryId,e.queries)),hr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=Yo(t,["cellId","descending","offset","limit"]);return or(s,lo(s.queryId,o,r,n,l,s.queries))},Pr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return sr(null!=(n=fo(t,e))?n:o,void 0,r,t)},Rr=nr((e=>e[0])),xr=nr((e=>f(e[1])?[]:[e[1]])),qr=nr((e=>e[2]));export{Rr as BackwardCheckpointsView,dr as CellView,Pr as CheckpointView,xr as CurrentCheckpointView,qr as ForwardCheckpointsView,vr as IndexView,Cr as LinkedRowsView,mr as LocalRowsView,br as MetricView,lr as Provider,yr as RemoteRowView,wr as ResultCellView,fr as ResultRowView,hr as ResultSortedTableView,kr as ResultTableView,ur as RowView,gr as SliceView,cr as SortedTableView,ir as TableView,ar as TablesView,Ir as ValueView,pr as ValuesView,Ye as useAddRowCallback,Qe as useCell,De as useCellIds,wt as useCellIdsListener,kt as useCellListener,fo as useCheckpoint,wo as useCheckpointIds,So as useCheckpointIdsListener,Oo as useCheckpointListener,te as useCheckpoints,Co as useCheckpointsIds,oe as useCheckpointsOrCheckpointsById,mo as useCreateCheckpoints,Ft as useCreateIndexes,Re as useCreateMergeableStore,jt as useCreateMetrics,Lo as useCreatePersister,$t as useCreateQueries,zt as useCreateRelationships,Pe as useCreateStore,jo as useCreateSynchronizer,lt as useDelCellCallback,nt as useDelRowCallback,rt as useDelTableCallback,ot as useDelTablesCallback,dt as useDelValueCallback,st as useDelValuesCallback,Lt as useDidFinishTransactionListener,ho as useGoBackwardCallback,Po as useGoForwardCallback,Ro as useGoToCallback,He as useHasCell,ft as useHasCellListener,Ve as useHasRow,mt as useHasRowListener,Le as useHasTable,Ee as useHasTableCell,bt as useHasTableCellListener,at as useHasTableListener,qe as useHasTables,ut as useHasTablesListener,Je as useHasValue,xt as useHasValueListener,We as useHasValues,ht as useHasValuesListener,Dt as useIndexIds,X as useIndexes,Vt as useIndexesIds,Y as useIndexesOrIndexesById,Ut as useLinkedRowIds,Zt as useLinkedRowIdsListener,Nt as useLocalRowIds,Yt as useLocalRowIdsListener,Tt as useMetric,Et as useMetricIds,Mt as useMetricListener,N as useMetrics,Bt as useMetricsIds,U as useMetricsOrMetricsById,K as useProvideStore,_ as useQueries,_t as useQueriesIds,ee as useQueriesOrQueriesById,eo as useQueryIds,qo as useRedoInformation,Jt as useRelationshipIds,Z as useRelationships,Gt as useRelationshipsIds,$ as useRelationshipsOrRelationshipsById,Kt as useRemoteRowId,Xt as useRemoteRowIdListener,io as useResultCell,uo as useResultCellIds,vo as useResultCellIdsListener,yo as useResultCellListener,so as useResultRow,ro as useResultRowCount,Io as useResultRowCountListener,no as useResultRowIds,po as useResultRowIdsListener,go as useResultRowListener,lo as useResultSortedRowIds,bo as useResultSortedRowIdsListener,to as useResultTable,oo as useResultTableCellIds,ao as useResultTableCellIdsListener,co as useResultTableListener,Ae as useRow,Te as useRowCount,gt as useRowCountListener,Me as useRowIds,vt as useRowIdsListener,Ct as useRowListener,$e as useSetCellCallback,ko as useSetCheckpointCallback,Ze as useSetPartialRowCallback,et as useSetPartialValuesCallback,Xe as useSetRowCallback,Ue as useSetTableCallback,Ne as useSetTablesCallback,tt as useSetValueCallback,_e as useSetValuesCallback,At as useSliceIds,Qt as useSliceIdsListener,Ht as useSliceRowIds,Wt as useSliceRowIdsListener,Fe as useSortedRowIds,yt as useSortedRowIdsListener,St as useStartTransactionListener,G as useStore,xe as useStoreIds,J as useStoreOrStoreById,je as useTable,Be as useTableCellIds,pt as useTableCellIdsListener,Oe as useTableIds,ct as useTableIdsListener,It as useTableListener,Se as useTables,it as useTablesListener,xo as useUndoInformation,Ke as useValue,Ge as useValueIds,Rt as useValueIdsListener,qt as useValueListener,ze as useValues,Pt as useValuesListener,Ot as useWillFinishTransactionListener};
1
+ import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",a=i+"s",c=i+u,I="Row",p=I+"Count",b=I+u,v="Sorted"+I+u,g="Cell",y=g+u,m="Value",C=m+"s",f=m+u,w=e=>null==e,h=(e,t,o)=>w(e)?null==o?void 0:o():t(e),k=e=>t(e)==r,P=e=>t(e)==n,R=e=>e.length,O=()=>{},x=(e,t)=>e.every(t),q=(e,t)=>R(e)===R(t)&&x(e,((e,o)=>t[o]===e)),S=(e,t)=>e.map(t),j=Object,L=e=>j.getPrototypeOf(e),E=j.entries,B=e=>!w(e)&&h(L(e),(e=>e==j.prototype||w(L(e))),(()=>!0)),T=j.keys,M=(e,t)=>h(e,(e=>e[t])),F=(e,t)=>{const o=E(e);return R(o)===R(T(t))&&x(o,(([e,o])=>B(o)?!!B(t[e])&&F(t[e],o):t[e]===o))},{createContext:V,useContext:A,useEffect:D}=e,H=V([]),Q=(e,t)=>{var o;const r=A(H);return w(e)?r[t]:k(e)?M(null!=(o=r[t+1])?o:{},e):e},W=(e,t)=>{const o=Q(e,t);return w(e)||k(e)?o:e},z=e=>{var t;return T(null!=(t=A(H)[e])?t:{})},G=e=>Q(e,0),J=e=>W(e,0),K=(e,t)=>{const{12:o,13:r}=A(H);D((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},N=e=>Q(e,2),U=e=>W(e,2),X=e=>Q(e,4),Y=e=>W(e,4),Z=e=>Q(e,6),$=e=>W(e,6),_=e=>Q(e,8),ee=e=>W(e,8),te=e=>Q(e,10),oe=e=>W(e,10),re=e=>e.toLowerCase();re(l);const ne="Transaction";re(ne);var le=Object.defineProperty,se=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,ie=(e,t,o)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,ae=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:ce,useEffect:Ie,useMemo:pe,useLayoutEffect:be,useRef:ve,useState:ge,useSyncExternalStore:ye}=e,me=[],Ce=[{},[],[me,void 0,me],void 0,!1,0],fe=(e,t)=>e===t,we=[F,q,([e,t,o],[r,n,l])=>t===n&&q(e,r)&&q(o,l)],he=(e,t,o=me)=>{const[,r]=ge(),[n,l]=ge();return Ie((()=>{const o=e?t(e):void 0;return l(o),r([]),null==o?void 0:o.destroy}),[e,...o]),n},ke=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},Pe=(e,t,r,n=me)=>{const l=ve(Ce[r]),s=ce((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:Ce[r];return(null!=(d=we[r])?d:fe)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=ce((l=>ke(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]),i=ye(u,s);return 0==r?((e,t)=>{for(var o in t||(t={}))de.call(t,o)&&ie(e,o,t[o]);if(se)for(var o of se(t))ue.call(t,o)&&ie(e,o,t[o]);return e})({},i):r<3?[...i]:i},Re=(e,t,o,r=me,n=me,...l)=>be((()=>ke(t,e,...n,o,...l)),[t,e,...n,...r,...l]),Oe=(e,t,o,r=me,n=O,l=me,...s)=>{const d=J(e);return ce((e=>h(d,(r=>h(o(e,r),(o=>n(r["set"+t](...S(s,(t=>P(t)?t(e,r):t)),o),o)))))),[d,t,...r,...l,...s])},xe=(e,t,o=O,r=me,...n)=>{const l=J(e);return ce((()=>o(null==l?void 0:l["del"+t](...n))),[l,t,...r,...n])},qe=(e,t,o)=>{const r=oe(e);return ce((()=>null==r?void 0:r[t](o)),[r,t,o])},Se=(e,t=me)=>pe(e,t),je=(e,t=me)=>pe(e,t),Le=()=>z(1),Ee=e=>Pe(a,J(e),4,[]),Be=e=>Pe(a,J(e),0),Te=e=>Pe(c,J(e),1),Me=(e,t)=>Pe(i,J(t),4,[e]),Fe=(e,t)=>Pe(i,J(t),0,[e]),Ve=(e,t)=>Pe(i+y,J(t),1,[e]),Ae=(e,t,o)=>Pe(i+g,J(o),4,[e,t]),De=(e,t)=>Pe(p,J(t),5,[e]),He=(e,t)=>Pe(b,J(t),1,[e]),Qe=(e,t,o,r=0,n,l)=>Pe(v,J(l),1,[e,t,o,r,n]),We=(e,t,o)=>Pe(I,J(o),4,[e,t]),ze=(e,t,o)=>Pe(I,J(o),0,[e,t]),Ge=(e,t,o)=>Pe(y,J(o),1,[e,t]),Je=(e,t,o,r)=>Pe(g,J(r),4,[e,t,o]),Ke=(e,t,o,r)=>Pe(g,J(r),3,[e,t,o]),Ne=e=>Pe(C,J(e),4,[]),Ue=e=>Pe(C,J(e),0),Xe=e=>Pe(f,J(e),1),Ye=(e,t)=>Pe(m,J(t),4,[e]),Ze=(e,t)=>Pe(m,J(t),3,[e]),$e=(e,t,o,r,n)=>Oe(o,a,e,t,r,n),_e=(e,t,o,r,n,l)=>Oe(r,i,t,o,n,l,e),et=(e,t,o,r,n,l,s)=>Oe(n,I,o,r,l,s,e,t),tt=(e,t,o=me,r,n=O,l=me,s=!0)=>{const d=J(r);return ce((o=>h(d,(r=>h(t(o,r),(t=>n(r.addRow(P(e)?e(o,r):e,t,s),r,t)))))),[d,e,...o,...l,s])},ot=(e,t,o,r,n,l,s)=>Oe(n,"PartialRow",o,r,l,s,e,t),rt=(e,t,o,r,n,l,s,d)=>Oe(l,g,r,n,s,d,e,t,o),nt=(e,t,o,r,n)=>Oe(o,C,e,t,r,n),lt=(e,t,o,r,n)=>Oe(o,"PartialValues",e,t,r,n),st=(e,t,o,r,n,l)=>Oe(r,m,t,o,n,l,e),dt=(e,t,o)=>xe(e,a,t,o),ut=(e,t,o,r)=>xe(t,i,o,r,e),it=(e,t,o,r,n)=>xe(o,I,r,n,e,t),at=(e,t,o,r,n,l,s)=>xe(n,g,l,s,e,t,o,r),ct=(e,t,o)=>xe(e,C,t,o),It=(e,t,o,r)=>xe(t,m,o,r,e),pt=(e,t,o,r)=>Re(d+a,J(r),e,t,[],o),bt=(e,t,o,r)=>Re(a,J(r),e,t,me,o),vt=(e,t,o,r)=>Re(c,J(r),e,t,me,o),gt=(e,t,o,r,n)=>Re(d+i,J(n),t,o,[e],r),yt=(e,t,o,r,n)=>Re(i,J(n),t,o,[e],r),mt=(e,t,o,r,n)=>Re(i+y,J(n),t,o,[e],r),Ct=(e,t,o,r,n,l)=>Re(d+i+g,J(l),o,r,[e,t],n),ft=(e,t,o,r,n)=>Re(p,J(n),t,o,[e],r),wt=(e,t,o,r,n)=>Re(b,J(n),t,o,[e],r),ht=(e,t,o,r,n,l,s,d,u)=>Re(v,J(u),l,s,[e,t,o,r,n],d),kt=(e,t,o,r,n,l)=>Re(d+I,J(l),o,r,[e,t],n),Pt=(e,t,o,r,n,l)=>Re(I,J(l),o,r,[e,t],n),Rt=(e,t,o,r,n,l)=>Re(y,J(l),o,r,[e,t],n),Ot=(e,t,o,r,n,l,s)=>Re(d+g,J(s),r,n,[e,t,o],l),xt=(e,t,o,r,n,l,s)=>Re(g,J(s),r,n,[e,t,o],l),qt=(e,t,o,r)=>Re(d+C,J(r),e,t,[],o),St=(e,t,o,r)=>Re(C,J(r),e,t,me,o),jt=(e,t,o,r)=>Re(f,J(r),e,t,me,o),Lt=(e,t,o,r,n)=>Re(d+m,J(n),t,o,[e],r),Et=(e,t,o,r,n)=>Re(m,J(n),t,o,[e],r),Bt=(e,t,o)=>Re("Start"+ne,J(o),e,t),Tt=(e,t,o)=>Re("WillFinish"+ne,J(o),e,t),Mt=(e,t,o)=>Re("DidFinish"+ne,J(o),e,t),Ft=(e,t,o)=>he(e,t,o),Vt=()=>z(3),At=e=>Pe("MetricIds",U(e),1),Dt=(e,t)=>Pe("Metric",U(t),3,[e]),Ht=(e,t,o,r)=>Re("Metric",U(r),t,o,[e]),Qt=(e,t,o)=>he(e,t,o),Wt=()=>z(5),zt=(e,t)=>Pe("SliceIds",Y(t),1,[e]),Gt=e=>Pe("IndexIds",Y(e),1),Jt=(e,t,o)=>Pe("Slice"+b,Y(o),1,[e,t]),Kt=(e,t,o,r)=>Re("SliceIds",Y(r),t,o,[e]),Nt=(e,t,o,r,n)=>Re("Slice"+b,Y(n),o,r,[e,t]),Ut=(e,t,o)=>he(e,t,o),Xt=()=>z(7),Yt=e=>Pe("RelationshipIds",$(e),1),Zt=(e,t,o)=>Pe("RemoteRowId",$(o),3,[e,t]),$t=(e,t,o)=>Pe("Local"+b,$(o),1,[e,t]),_t=(e,t,o)=>Pe("Linked"+b,$(o),1,[e,t]),eo=(e,t,o,r,n)=>Re("RemoteRowId",$(n),o,r,[e,t]),to=(e,t,o,r,n)=>Re("Local"+b,$(n),o,r,[e,t]),oo=(e,t,o,r,n)=>Re("Linked"+b,$(n),o,r,[e,t]),ro=(e,t,o)=>he(e,t,o),no=()=>z(9),lo=e=>Pe("QueryIds",ee(e),1),so=(e,t)=>Pe(s+i,ee(t),0,[e]),uo=(e,t)=>Pe(s+i+y,ee(t),1,[e]),io=(e,t)=>Pe(s+p,ee(t),5,[e]),ao=(e,t)=>Pe(s+b,ee(t),1,[e]),co=(e,t,o,r=0,n,l)=>Pe(s+v,ee(l),1,[e,t,o,r,n]),Io=(e,t,o)=>Pe(s+I,ee(o),0,[e,t]),po=(e,t,o)=>Pe(s+y,ee(o),1,[e,t]),bo=(e,t,o,r)=>Pe(s+g,ee(r),3,[e,t,o]),vo=(e,t,o,r)=>Re(s+i,ee(r),t,o,[e]),go=(e,t,o,r)=>Re(s+i+y,ee(r),t,o,[e]),yo=(e,t,o,r)=>Re(s+p,ee(r),t,o,[e]),mo=(e,t,o,r)=>Re(s+b,ee(r),t,o,[e]),Co=(e,t,o,r,n,l,d,u)=>Re(s+v,ee(u),l,d,[e,t,o,r,n]),fo=(e,t,o,r,n)=>Re(s+I,ee(n),o,r,[e,t]),wo=(e,t,o,r,n)=>Re(s+y,ee(n),o,r,[e,t]),ho=(e,t,o,r,n,l)=>Re(s+g,ee(l),r,n,[e,t,o]),ko=(e,t,o)=>he(e,t,o),Po=()=>z(11),Ro=e=>Pe("CheckpointIds",oe(e),2),Oo=(e,t)=>Pe("Checkpoint",oe(t),3,[e]),xo=(e=O,t=me,o,r=O,n=me)=>{const l=oe(o);return ce((t=>h(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},qo=e=>qe(e,"goBackward"),So=e=>qe(e,"goForward"),jo=(e,t=me,o,r=O,n=me)=>{const l=oe(o);return ce((t=>h(l,(o=>h(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},Lo=e=>{var t;const r=oe(e),[n,l]=Ro(r);return[(s=n,!(0==R(s))),qo(r),l,null!=(t=h(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},Eo=e=>{var t;const r=oe(e),[,,[n]]=Ro(r);return[!w(n),So(r),n,null!=(t=h(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},Bo=(e,t,o)=>Re("CheckpointIds",oe(o),e,t),To=(e,t,o,r)=>Re("Checkpoint",oe(r),t,o,[e]),Mo=(e,t,o=me,r,n=me,l,s=me)=>{const[,d]=ge(),[u,i]=ge();return Ie((()=>{const o=e?t(e):void 0;i(o),o&&r&&ae(void 0,null,(function*(){yield r(o),d([])}))}),[e,...o,...n]),Ie((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},Fo=(e,t,o=me,r,n=me)=>{const[l,s]=ge();return Ie((()=>{ae(void 0,null,(function*(){const o=e?yield t(e):void 0;s(o)}))}),[e,...o]),Ie((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:Vo,Fragment:Ao,createElement:Do,useCallback:Ho,useLayoutEffect:Qo,useRef:Wo,useState:zo}=e,Go=(e,...t)=>w(e)?{}:e(...t),Jo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var Ko=Object.defineProperty,No=Object.defineProperties,Uo=Object.getOwnPropertyDescriptors,Xo=Object.getOwnPropertySymbols,Yo=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable,$o=(e,t,o)=>t in e?Ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,_o=(e,t)=>{for(var o in t||(t={}))Yo.call(t,o)&&$o(e,o,t[o]);if(Xo)for(var o of Xo(t))Zo.call(t,o)&&$o(e,o,t[o]);return e},er=(e,t)=>No(e,Uo(t)),tr=(e,t)=>{var o={};for(var r in e)Yo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Xo)for(var r of Xo(e))t.indexOf(r)<0&&Zo.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:or,useContext:rr,useMemo:nr,useState:lr}=e,sr=({tableId:e,store:t,rowComponent:o=pr,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>cr(S(d,(l=>Do(o,er(_o({},Go(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),dr=({queryId:e,queries:t,resultRowComponent:o=Or,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>cr(S(s,(n=>Do(o,er(_o({},Go(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),ur=({relationshipId:e,relationships:t,rowComponent:o=pr,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,a]=Jo($(t),e),c=s(e,d,u);return cr(S(c,(e=>Do(o,er(_o({},Go(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),n,l,d)},ir=e=>({checkpoints:t,checkpointComponent:o=Sr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=oe(t);return cr(S(e(Ro(s)),(e=>Do(o,er(_o({},Go(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},ar=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=rr(H),[b,v]=lr({}),g=or(((e,t)=>v((o=>M(o,e)==t?o:er(_o({},o),{[e]:t})))),[]),y=or((e=>v((t=>_o({},((e,t)=>(delete e[t],e))(t,e))))),[]);return Do(H.Provider,{value:nr((()=>[null!=e?e:p[0],_o(_o(_o({},p[1]),t),b),null!=o?o:p[2],_o(_o({},p[3]),r),null!=n?n:p[4],_o(_o({},p[5]),l),null!=s?s:p[6],_o(_o({},p[7]),d),null!=u?u:p[8],_o(_o({},p[9]),i),null!=a?a:p[10],_o(_o({},p[11]),c),g,y]),[e,t,b,o,r,n,l,s,d,u,i,a,c,p,g,y])},I)},cr=(e,t,o,r)=>{const n=w(t)||!Array.isArray(e)?e:S(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},Ir=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return cr(o+(null!=(s=Ke(e,t,r,n))?s:o),void 0,l,r)},pr=({tableId:e,rowId:t,store:o,cellComponent:r=Ir,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>cr(S(((e,t,o,r)=>{const n=Ge(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>Do(r,er(_o({},Go(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),br=e=>sr(e,He(e.tableId,e.store)),vr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=tr(t,["cellId","descending","offset","limit"]);return sr(s,Qe(s.tableId,o,r,n,l,s.store))},gr=({store:e,tableComponent:t=br,getTableComponentProps:o,separator:r,debugIds:n})=>cr(S(Te(e),(r=>Do(t,er(_o({},Go(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),yr=({valueId:e,store:t,debugIds:r})=>{var n;return cr(o+(null!=(n=Ze(e,t))?n:o),void 0,r,e)},mr=({store:e,valueComponent:t=yr,getValueComponentProps:o,separator:r,debugIds:n})=>cr(S(Xe(e),(r=>Do(t,er(_o({},Go(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),Cr=({metricId:e,metrics:t,debugIds:r})=>{var n;return cr(null!=(n=Dt(e,t))?n:o,void 0,r,e)},fr=({indexId:e,sliceId:t,indexes:o,rowComponent:r=pr,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(Y(o),e),a=Jt(e,t,d);return cr(S(a,(e=>Do(r,er(_o({},Go(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},wr=({indexId:e,indexes:t,sliceComponent:o=fr,getSliceComponentProps:r,separator:n,debugIds:l})=>cr(S(zt(e,t),(n=>Do(o,er(_o({},Go(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),hr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=pr,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=Jo($(o),e),i=Zt(e,t,s);return cr(w(u)||w(i)?null:Do(r,er(_o({},Go(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},kr=e=>ur(e,$t,e.remoteRowId),Pr=e=>ur(e,_t,e.firstRowId),Rr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return cr(o+(null!=(s=bo(e,t,r,n))?s:o),void 0,l,r)},Or=({queryId:e,rowId:t,queries:o,resultCellComponent:r=Rr,getResultCellComponentProps:n,separator:l,debugIds:s})=>cr(S(po(e,t,o),(l=>Do(r,er(_o({},Go(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),xr=e=>dr(e,ao(e.queryId,e.queries)),qr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=tr(t,["cellId","descending","offset","limit"]);return dr(s,co(s.queryId,o,r,n,l,s.queries))},Sr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return cr(null!=(n=Oo(t,e))?n:o,void 0,r,t)},jr=ir((e=>e[0])),Lr=ir((e=>w(e[1])?[]:[e[1]])),Er=ir((e=>e[2]));export{jr as BackwardCheckpointsView,Ir as CellView,Sr as CheckpointView,Lr as CurrentCheckpointView,Er as ForwardCheckpointsView,wr as IndexView,Pr as LinkedRowsView,kr as LocalRowsView,Cr as MetricView,ar as Provider,hr as RemoteRowView,Rr as ResultCellView,Or as ResultRowView,qr as ResultSortedTableView,xr as ResultTableView,pr as RowView,fr as SliceView,vr as SortedTableView,br as TableView,gr as TablesView,yr as ValueView,mr as ValuesView,tt as useAddRowCallback,Ke as useCell,Ge as useCellIds,Rt as useCellIdsListener,xt as useCellListener,Oo as useCheckpoint,Ro as useCheckpointIds,Bo as useCheckpointIdsListener,To as useCheckpointListener,te as useCheckpoints,Po as useCheckpointsIds,oe as useCheckpointsOrCheckpointsById,ko as useCreateCheckpoints,Qt as useCreateIndexes,je as useCreateMergeableStore,Ft as useCreateMetrics,Mo as useCreatePersister,ro as useCreateQueries,Ut as useCreateRelationships,Se as useCreateStore,Fo as useCreateSynchronizer,at as useDelCellCallback,it as useDelRowCallback,ut as useDelTableCallback,dt as useDelTablesCallback,It as useDelValueCallback,ct as useDelValuesCallback,Mt as useDidFinishTransactionListener,qo as useGoBackwardCallback,So as useGoForwardCallback,jo as useGoToCallback,Je as useHasCell,Ot as useHasCellListener,We as useHasRow,kt as useHasRowListener,Me as useHasTable,Ae as useHasTableCell,Ct as useHasTableCellListener,gt as useHasTableListener,Ee as useHasTables,pt as useHasTablesListener,Ye as useHasValue,Lt as useHasValueListener,Ne as useHasValues,qt as useHasValuesListener,Gt as useIndexIds,X as useIndexes,Wt as useIndexesIds,Y as useIndexesOrIndexesById,_t as useLinkedRowIds,oo as useLinkedRowIdsListener,$t as useLocalRowIds,to as useLocalRowIdsListener,Dt as useMetric,At as useMetricIds,Ht as useMetricListener,N as useMetrics,Vt as useMetricsIds,U as useMetricsOrMetricsById,K as useProvideStore,_ as useQueries,no as useQueriesIds,ee as useQueriesOrQueriesById,lo as useQueryIds,Eo as useRedoInformation,Yt as useRelationshipIds,Z as useRelationships,Xt as useRelationshipsIds,$ as useRelationshipsOrRelationshipsById,Zt as useRemoteRowId,eo as useRemoteRowIdListener,bo as useResultCell,po as useResultCellIds,wo as useResultCellIdsListener,ho as useResultCellListener,Io as useResultRow,io as useResultRowCount,yo as useResultRowCountListener,ao as useResultRowIds,mo as useResultRowIdsListener,fo as useResultRowListener,co as useResultSortedRowIds,Co as useResultSortedRowIdsListener,so as useResultTable,uo as useResultTableCellIds,go as useResultTableCellIdsListener,vo as useResultTableListener,ze as useRow,De as useRowCount,ft as useRowCountListener,He as useRowIds,wt as useRowIdsListener,Pt as useRowListener,rt as useSetCellCallback,xo as useSetCheckpointCallback,ot as useSetPartialRowCallback,lt as useSetPartialValuesCallback,et as useSetRowCallback,_e as useSetTableCallback,$e as useSetTablesCallback,st as useSetValueCallback,nt as useSetValuesCallback,zt as useSliceIds,Kt as useSliceIdsListener,Jt as useSliceRowIds,Nt as useSliceRowIdsListener,Qe as useSortedRowIds,ht as useSortedRowIdsListener,Bt as useStartTransactionListener,G as useStore,Le as useStoreIds,J as useStoreOrStoreById,Fe as useTable,Ve as useTableCellIds,mt as useTableCellIdsListener,Te as useTableIds,vt as useTableIdsListener,yt as useTableListener,Be as useTables,bt as useTablesListener,Lo as useUndoInformation,Ze as useValue,Xe as useValueIds,jt as useValueIdsListener,Et as useValueListener,Ue as useValues,St as useValuesListener,Tt as useWillFinishTransactionListener};
Binary file
@@ -5009,9 +5009,9 @@ export function useDidFinishTransactionListener(
5009
5009
  * regular createMetrics function and pass it in, but you may prefer to create
5010
5010
  * it within the app, perhaps inside the top-level component. To prevent a new
5011
5011
  * Metrics object being created every time the app renders or re-renders, since
5012
- * v5.0 the useCreateMetrics hook performs the creation in an effect. As a
5013
- * result this hook will return `undefined` on the brief first render, which you
5014
- * should defend against.
5012
+ * v5.0 this hook performs the creation in an effect. As a result it will return
5013
+ * `undefined` on the brief first render (or if the Store is not yet defined),
5014
+ * which you should defend against.
5015
5015
  *
5016
5016
  * If your `create` function contains other dependencies, the changing of which
5017
5017
  * should also cause the Metrics object to be recreated, you can provide them in
@@ -5104,7 +5104,7 @@ export function useDidFinishTransactionListener(
5104
5104
  * @category Metrics hooks
5105
5105
  */
5106
5106
  export function useCreateMetrics(
5107
- store: Store,
5107
+ store: Store | undefined,
5108
5108
  create: (store: Store) => Metrics,
5109
5109
  createDeps?: React.DependencyList,
5110
5110
  ): Metrics | undefined;
@@ -5489,9 +5489,9 @@ export function useMetricListener(
5489
5489
  * regular createIndexes function and pass it in, but you may prefer to create
5490
5490
  * it within the app, perhaps inside the top-level component. To prevent a new
5491
5491
  * Indexes object being created every time the app renders or re-renders, since
5492
- * v5.0 the useCreateIndexes hook performs the creation in an effect. As a
5493
- * result this hook will return `undefined` on the brief first render, which you
5494
- * should defend against.
5492
+ * v5.0 the this hook performs the creation in an effect. As a result it will
5493
+ * return `undefined` on the brief first render (or if the Store is not yet
5494
+ * defined), which you should defend against.
5495
5495
  *
5496
5496
  * If your `create` function contains other dependencies, the changing of which
5497
5497
  * should also cause the Indexes object to be recreated, you can provide them in
@@ -5592,7 +5592,7 @@ export function useMetricListener(
5592
5592
  * @category Indexes hooks
5593
5593
  */
5594
5594
  export function useCreateIndexes(
5595
- store: Store,
5595
+ store: Store | undefined,
5596
5596
  create: (store: Store) => Indexes,
5597
5597
  createDeps?: React.DependencyList,
5598
5598
  ): Indexes | undefined;
@@ -6174,9 +6174,9 @@ export function useSliceRowIdsListener(
6174
6174
  * the regular createRelationships function and pass it in, but you may prefer
6175
6175
  * to create it within the app, perhaps inside the top-level component. To
6176
6176
  * prevent a new Relationships object being created every time the app renders
6177
- * or re-renders, since v5.0 the useCreateRelationships hook performs the
6178
- * creation in an effect. As a result this hook will return `undefined` on the
6179
- * brief first render, which you should defend against.
6177
+ * or re-renders, since v5.0 this hook performs the creation in an effect. As a
6178
+ * result it will return `undefined` on the brief first render (or if the Store
6179
+ * is not yet defined), which you should defend against.
6180
6180
  *
6181
6181
  * If your `create` function contains other dependencies, the changing of which
6182
6182
  * should also cause the Relationships object to be recreated, you can provide
@@ -6288,7 +6288,7 @@ export function useSliceRowIdsListener(
6288
6288
  * @category Relationships hooks
6289
6289
  */
6290
6290
  export function useCreateRelationships(
6291
- store: Store,
6291
+ store: Store | undefined,
6292
6292
  create: (store: Store) => Relationships,
6293
6293
  createDeps?: React.DependencyList,
6294
6294
  ): Relationships | undefined;
@@ -7139,9 +7139,9 @@ export function useLinkedRowIdsListener(
7139
7139
  * regular createQueries function and pass it in, but you may prefer to create
7140
7140
  * it within the app, perhaps inside the top-level component. To prevent a new
7141
7141
  * Queries object being created every time the app renders or re-renders, since
7142
- * v5.0 the useCreateQueries hook performs the creation in an effect. As a
7143
- * result this hook will return `undefined` on the brief first render, which you
7144
- * should defend against.
7142
+ * v5.0 this hook performs the creation in an effect. As a result it will return
7143
+ * `undefined` on the brief first render (or if the Store is not yet defined),
7144
+ * which you should defend against.
7145
7145
  *
7146
7146
  * If your `create` function contains other dependencies, the changing of which
7147
7147
  * should also cause the Queries object to be recreated, you can provide them in
@@ -7245,7 +7245,7 @@ export function useLinkedRowIdsListener(
7245
7245
  * @since v2.0.0
7246
7246
  */
7247
7247
  export function useCreateQueries(
7248
- store: Store,
7248
+ store: Store | undefined,
7249
7249
  create: (store: Store) => Queries,
7250
7250
  createDeps?: React.DependencyList,
7251
7251
  ): Queries | undefined;
@@ -9141,9 +9141,9 @@ export function useResultCellListener(
9141
9141
  * the regular createCheckpoints function and pass it in, but you may prefer to
9142
9142
  * create it within the app, perhaps inside the top-level component. To prevent
9143
9143
  * a new Checkpoints object being created every time the app renders or
9144
- * re-renders, since v5.0 the useCreateMetrics hook performs the creation in an
9145
- * effect. As a result this hook will return `undefined` on the brief first
9146
- * render, which you should defend against.
9144
+ * re-renders, since v5.0 this hook performs the creation in an effect. As a
9145
+ * result it will return `undefined` on the brief first render (or if the
9146
+ * Store is not yet defined), which you should defend against.
9147
9147
  *
9148
9148
  * If your `create` function contains other dependencies, the changing of which
9149
9149
  * should also cause the Checkpoints object to be recreated, you can provide
@@ -9225,7 +9225,7 @@ export function useResultCellListener(
9225
9225
  * @category Checkpoints hooks
9226
9226
  */
9227
9227
  export function useCreateCheckpoints(
9228
- store: Store,
9228
+ store: Store | undefined,
9229
9229
  create: (store: Store) => Checkpoints,
9230
9230
  createDeps?: React.DependencyList,
9231
9231
  ): Checkpoints | undefined;
@@ -10069,7 +10069,7 @@ export function useCheckpointListener(
10069
10069
  * regular createPersister function and pass it in, but you may prefer to create
10070
10070
  * it within the app, perhaps inside the top-level component. To prevent a new
10071
10071
  * Persister being created every time the app renders or re-renders, since v5.0
10072
- * the useCreateMetrics hook performs the creation in an effect.
10072
+ * the this hook performs the creation in an effect.
10073
10073
  *
10074
10074
  * If your `create` function (the second parameter to the hook) contains
10075
10075
  * dependencies, the changing of which should cause the Persister to be
@@ -10088,7 +10088,8 @@ export function useCheckpointListener(
10088
10088
  * Since v4.3.0, the `create` function can return undefined, meaning that you
10089
10089
  * can enable or disable persistence conditionally within this hook. This is
10090
10090
  * useful for applications which might turn on or off their cloud persistence or
10091
- * collaboration features.
10091
+ * collaboration features. This hook can return `undefined` if the Store is not
10092
+ * yet defined, which you should defend against.
10092
10093
  *
10093
10094
  * Since v4.3.19, a `destroy` function can be provided which will be called
10094
10095
  * after an old Persister is destroyed due to a change in the `createDeps`
@@ -10222,7 +10223,7 @@ export function useCheckpointListener(
10222
10223
  export function useCreatePersister<
10223
10224
  PersisterOrUndefined extends Persister | undefined,
10224
10225
  >(
10225
- store: Store,
10226
+ store: Store | undefined,
10226
10227
  create: (store: Store) => PersisterOrUndefined,
10227
10228
  createDeps?: React.DependencyList,
10228
10229
  then?: (persister: Persister) => Promise<void>,
@@ -10346,7 +10347,7 @@ export function useCreatePersister<
10346
10347
  export function useCreateSynchronizer<
10347
10348
  SynchronizerOrUndefined extends Synchronizer | undefined,
10348
10349
  >(
10349
- store: MergeableStore,
10350
+ store: MergeableStore | undefined,
10350
10351
  create: (store: MergeableStore) => Promise<SynchronizerOrUndefined>,
10351
10352
  createDeps?: React.DependencyList,
10352
10353
  destroy?: (synchronizer: Synchronizer) => void,
@@ -5876,7 +5876,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
5876
5876
  *
5877
5877
  * ```ts override
5878
5878
  * useCreateMetrics(
5879
- * store: Store,
5879
+ * store: Store | undefined,
5880
5880
  * create: (store: Store) => Metrics,
5881
5881
  * createDeps?: React.DependencyList,
5882
5882
  * ): Metrics | undefined;
@@ -5886,9 +5886,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
5886
5886
  * regular createMetrics function and pass it in, but you may prefer to create
5887
5887
  * it within the app, perhaps inside the top-level component. To prevent a new
5888
5888
  * Metrics object being created every time the app renders or re-renders, since
5889
- * v5.0 the useCreateMetrics hook performs the creation in an effect. As a
5890
- * result this hook will return `undefined` on the brief first render, which you
5891
- * should defend against.
5889
+ * v5.0 this hook performs the creation in an effect. As a result it will return
5890
+ * `undefined` on the brief first render (or if the Store is not yet defined),
5891
+ * which you should defend against.
5892
5892
  *
5893
5893
  * If your `create` function contains other dependencies, the changing of which
5894
5894
  * should also cause the Metrics object to be recreated, you can provide them in
@@ -5981,7 +5981,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
5981
5981
  * @category Metrics hooks
5982
5982
  */
5983
5983
  useCreateMetrics: (
5984
- store: Store<Schemas>,
5984
+ store: Store<Schemas> | undefined,
5985
5985
  create: (store: Store<Schemas>) => Metrics<Schemas>,
5986
5986
  createDeps?: React.DependencyList,
5987
5987
  ) => Metrics<Schemas> | undefined;
@@ -6406,7 +6406,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6406
6406
  *
6407
6407
  * ```ts override
6408
6408
  * useCreateIndexes(
6409
- * store: Store,
6409
+ * store: Store | undefined,
6410
6410
  * create: (store: Store) => Indexes,
6411
6411
  * createDeps?: React.DependencyList,
6412
6412
  * ): Indexes | undefined;
@@ -6416,9 +6416,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6416
6416
  * regular createIndexes function and pass it in, but you may prefer to create
6417
6417
  * it within the app, perhaps inside the top-level component. To prevent a new
6418
6418
  * Indexes object being created every time the app renders or re-renders, since
6419
- * v5.0 the useCreateIndexes hook performs the creation in an effect. As a
6420
- * result this hook will return `undefined` on the brief first render, which you
6421
- * should defend against.
6419
+ * v5.0 the this hook performs the creation in an effect. As a result it will
6420
+ * return `undefined` on the brief first render (or if the Store is not yet
6421
+ * defined), which you should defend against.
6422
6422
  *
6423
6423
  * If your `create` function contains other dependencies, the changing of which
6424
6424
  * should also cause the Indexes object to be recreated, you can provide them in
@@ -6519,7 +6519,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6519
6519
  * @category Indexes hooks
6520
6520
  */
6521
6521
  useCreateIndexes: (
6522
- store: Store<Schemas>,
6522
+ store: Store<Schemas> | undefined,
6523
6523
  create: (store: Store<Schemas>) => Indexes<Schemas>,
6524
6524
  createDeps?: React.DependencyList,
6525
6525
  ) => Indexes<Schemas> | undefined;
@@ -7163,7 +7163,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7163
7163
  *
7164
7164
  * ```ts override
7165
7165
  * useCreateRelationships(
7166
- * store: Store,
7166
+ * store: Store | undefined,
7167
7167
  * create: (store: Store) => Relationships,
7168
7168
  * createDeps?: React.DependencyList,
7169
7169
  * ): Relationships | undefined;
@@ -7173,9 +7173,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7173
7173
  * the regular createRelationships function and pass it in, but you may prefer
7174
7174
  * to create it within the app, perhaps inside the top-level component. To
7175
7175
  * prevent a new Relationships object being created every time the app renders
7176
- * or re-renders, since v5.0 the useCreateRelationships hook performs the
7177
- * creation in an effect. As a result this hook will return `undefined` on the
7178
- * brief first render, which you should defend against.
7176
+ * or re-renders, since v5.0 this hook performs the creation in an effect. As a
7177
+ * result it will return `undefined` on the brief first render (or if the Store
7178
+ * is not yet defined), which you should defend against.
7179
7179
  *
7180
7180
  * If your `create` function contains other dependencies, the changing of which
7181
7181
  * should also cause the Relationships object to be recreated, you can provide
@@ -7287,7 +7287,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7287
7287
  * @category Relationships hooks
7288
7288
  */
7289
7289
  useCreateRelationships: (
7290
- store: Store<Schemas>,
7290
+ store: Store<Schemas> | undefined,
7291
7291
  create: (store: Store<Schemas>) => Relationships<Schemas>,
7292
7292
  createDeps?: React.DependencyList,
7293
7293
  ) => Relationships<Schemas> | undefined;
@@ -8226,7 +8226,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
8226
8226
  *
8227
8227
  * ```ts override
8228
8228
  * useCreateQueries(
8229
- * store: Store,
8229
+ * store: Store | undefined,
8230
8230
  * create: (store: Store) => Queries,
8231
8231
  * createDeps?: React.DependencyList,
8232
8232
  * ): Queries | undefined;
@@ -8236,9 +8236,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
8236
8236
  * regular createQueries function and pass it in, but you may prefer to create
8237
8237
  * it within the app, perhaps inside the top-level component. To prevent a new
8238
8238
  * Queries object being created every time the app renders or re-renders, since
8239
- * v5.0 the useCreateQueries hook performs the creation in an effect. As a
8240
- * result this hook will return `undefined` on the brief first render, which you
8241
- * should defend against.
8239
+ * v5.0 this hook performs the creation in an effect. As a result it will return
8240
+ * `undefined` on the brief first render (or if the Store is not yet defined),
8241
+ * which you should defend against.
8242
8242
  *
8243
8243
  * If your `create` function contains other dependencies, the changing of which
8244
8244
  * should also cause the Queries object to be recreated, you can provide them in
@@ -8342,7 +8342,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
8342
8342
  * @since v2.0.0
8343
8343
  */
8344
8344
  useCreateQueries: (
8345
- store: Store<Schemas>,
8345
+ store: Store<Schemas> | undefined,
8346
8346
  create: (store: Store<Schemas>) => Queries<Schemas>,
8347
8347
  createDeps?: React.DependencyList,
8348
8348
  ) => Queries<Schemas> | undefined;
@@ -10434,7 +10434,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10434
10434
  *
10435
10435
  * ```ts override
10436
10436
  * useCreateCheckpoints(
10437
- * store: Store,
10437
+ * store: Store | undefined,
10438
10438
  * create: (store: Store) => Checkpoints,
10439
10439
  * createDeps?: React.DependencyList,
10440
10440
  * ): Checkpoints | undefined;
@@ -10444,9 +10444,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10444
10444
  * the regular createCheckpoints function and pass it in, but you may prefer to
10445
10445
  * create it within the app, perhaps inside the top-level component. To prevent
10446
10446
  * a new Checkpoints object being created every time the app renders or
10447
- * re-renders, since v5.0 the useCreateMetrics hook performs the creation in an
10448
- * effect. As a result this hook will return `undefined` on the brief first
10449
- * render, which you should defend against.
10447
+ * re-renders, since v5.0 this hook performs the creation in an effect. As a
10448
+ * result it will return `undefined` on the brief first render (or if the
10449
+ * Store is not yet defined), which you should defend against.
10450
10450
  *
10451
10451
  * If your `create` function contains other dependencies, the changing of which
10452
10452
  * should also cause the Checkpoints object to be recreated, you can provide
@@ -10528,7 +10528,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10528
10528
  * @category Checkpoints hooks
10529
10529
  */
10530
10530
  useCreateCheckpoints: (
10531
- store: Store<Schemas>,
10531
+ store: Store<Schemas> | undefined,
10532
10532
  create: (store: Store<Schemas>) => Checkpoints<Schemas>,
10533
10533
  createDeps?: React.DependencyList,
10534
10534
  ) => Checkpoints<Schemas> | undefined;
@@ -11486,7 +11486,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11486
11486
  * useCreatePersister<
11487
11487
  * PersisterOrUndefined extends Persister | undefined,
11488
11488
  * >(
11489
- * store: Store,
11489
+ * store: Store | undefined,
11490
11490
  * create: (store: Store) => PersisterOrUndefined,
11491
11491
  * createDeps?: React.DependencyList,
11492
11492
  * then?: (persister: Persister) => Promise<void>,
@@ -11500,7 +11500,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11500
11500
  * regular createPersister function and pass it in, but you may prefer to create
11501
11501
  * it within the app, perhaps inside the top-level component. To prevent a new
11502
11502
  * Persister being created every time the app renders or re-renders, since v5.0
11503
- * the useCreateMetrics hook performs the creation in an effect.
11503
+ * the this hook performs the creation in an effect.
11504
11504
  *
11505
11505
  * If your `create` function (the second parameter to the hook) contains
11506
11506
  * dependencies, the changing of which should cause the Persister to be
@@ -11519,7 +11519,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11519
11519
  * Since v4.3.0, the `create` function can return undefined, meaning that you
11520
11520
  * can enable or disable persistence conditionally within this hook. This is
11521
11521
  * useful for applications which might turn on or off their cloud persistence or
11522
- * collaboration features.
11522
+ * collaboration features. This hook can return `undefined` if the Store is not
11523
+ * yet defined, which you should defend against.
11523
11524
  *
11524
11525
  * Since v4.3.19, a `destroy` function can be provided which will be called
11525
11526
  * after an old Persister is destroyed due to a change in the `createDeps`
@@ -11653,7 +11654,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11653
11654
  useCreatePersister: <
11654
11655
  PersisterOrUndefined extends Persister<Schemas> | undefined,
11655
11656
  >(
11656
- store: Store<Schemas>,
11657
+ store: Store<Schemas> | undefined,
11657
11658
  create: (store: Store<Schemas>) => Promise<PersisterOrUndefined>,
11658
11659
  createDeps?: React.DependencyList,
11659
11660
  destroy?: (persister: Persister<Schemas>) => void,
@@ -11670,7 +11671,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11670
11671
  * useCreateSynchronizer<
11671
11672
  * SynchronizerOrUndefined extends Synchronizer | undefined,
11672
11673
  * >(
11673
- * store: MergeableStore,
11674
+ * store: MergeableStore | undefined,
11674
11675
  * create: (store: MergeableStore) => Promise<SynchronizerOrUndefined>,
11675
11676
  * createDeps?: React.DependencyList,
11676
11677
  * destroy?: (synchronizer: Synchronizer) => void,
@@ -11789,7 +11790,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11789
11790
  useCreateSynchronizer: <
11790
11791
  SynchronizerOrUndefined extends Synchronizer<Schemas> | undefined,
11791
11792
  >(
11792
- store: MergeableStore<Schemas>,
11793
+ store: MergeableStore<Schemas> | undefined,
11793
11794
  create: (
11794
11795
  store: MergeableStore<Schemas>,
11795
11796
  ) => Promise<SynchronizerOrUndefined>,
package/lib/ui-react.js CHANGED
@@ -1 +1 @@
1
- import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),d="Listener",n="Result",u="Has",c="Ids",I="Table",l=I+"s",a=I+c,i="Row",p=i+"Count",g=i+c,b="Sorted"+i+c,C="Cell",m=C+c,y="Value",k=y+"s",w=y+c,h=e=>null==e,R=(e,t,o)=>h(e)?o?.():t(e),f=e=>t(e)==s,q=e=>t(e)==r,P=e=>e.length,v=()=>{},x=(e,t)=>e.every(t),S=(e,t)=>P(e)===P(t)&&x(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),B=Object,T=e=>B.getPrototypeOf(e),E=B.entries,M=e=>!h(e)&&R(T(e),(e=>e==B.prototype||h(T(e))),(()=>!0)),F=B.keys,V=(e,t)=>R(e,(e=>e[t])),A=(e,t)=>(delete e[t],e),O=(e,t)=>{const o=E(e);return P(o)===P(F(t))&&x(o,(([e,o])=>M(o)?!!M(t[e])&&O(t[e],o):t[e]===o))},{createContext:j,useContext:D,useEffect:H}=e,Q=j([]),W=(e,t)=>{const o=D(Q);return h(e)?o[t]:f(e)?V(o[t+1]??{},e):e},z=(e,t)=>{const o=W(e,t);return h(e)||f(e)?o:e},G=e=>F(D(Q)[e]??{}),J=e=>W(e,0),K=e=>z(e,0),N=(e,t)=>{const{12:o,13:s}=D(Q);H((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},U=e=>W(e,2),X=e=>z(e,2),Y=e=>W(e,4),Z=e=>z(e,4),$=e=>W(e,6),_=e=>z(e,6),ee=e=>W(e,8),te=e=>z(e,8),oe=e=>W(e,10),se=e=>z(e,10),re=e=>e.toLowerCase();re(d);const de="Transaction";re(de);const{useCallback:ne,useEffect:ue,useMemo:ce,useLayoutEffect:Ie,useRef:le,useState:ae,useSyncExternalStore:ie}=e,pe=[],ge=[{},[],[pe,void 0,pe],void 0,!1,0],be=(e,t)=>e===t,Ce=[O,S,([e,t,o],[s,r,d])=>t===r&&S(e,s)&&S(o,d)],me=(e,t,o=pe)=>{const[,s]=ae(),[r,d]=ae();return ue((()=>{const o=t(e);return d(o),s([]),o.destroy}),[e,...o]),r},ye=(e,t,...o)=>{const s=e?.["add"+t+d]?.(...o);return()=>e?.delListener(s)},ke=(e,t,s,r=pe)=>{const d=le(ge[s]),n=ne((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??ge[s];return(Ce[s]??be)(o,d.current)?d.current:d.current=o}),[t,s,e,...r]),c=ne((d=>ye(t,(4==s?u:o)+e,...r,d)),[t,s,e,...r]);return ie(c,n)},we=(e,t,o,s=pe,r=pe,...d)=>Ie((()=>ye(t,e,...r,o,...d)),[t,e,...r,...s,...d]),he=(e,t,o,s=pe,r=v,d=pe,...n)=>{const u=K(e);return ne((e=>R(u,(s=>R(o(e,s),(o=>r(s["set"+t](...L(n,(t=>q(t)?t(e,s):t)),o),o)))))),[u,t,...s,...d,...n])},Re=(e,t,o=v,s=pe,...r)=>{const d=K(e);return ne((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},fe=(e,t,o)=>{const s=se(e);return ne((()=>s?.[t](o)),[s,t,o])},qe=(e,t=pe)=>ce(e,t),Pe=(e,t=pe)=>ce(e,t),ve=()=>G(1),xe=e=>ke(l,K(e),4,[]),Se=e=>ke(l,K(e),0),Le=e=>ke(a,K(e),1),Be=(e,t)=>ke(I,K(t),4,[e]),Te=(e,t)=>ke(I,K(t),0,[e]),Ee=(e,t)=>ke(I+m,K(t),1,[e]),Me=(e,t,o)=>ke(I+C,K(o),4,[e,t]),Fe=(e,t)=>ke(p,K(t),5,[e]),Ve=(e,t)=>ke(g,K(t),1,[e]),Ae=(e,t,o,s=0,r,d)=>ke(b,K(d),1,[e,t,o,s,r]),Oe=(e,t,o)=>ke(i,K(o),4,[e,t]),je=(e,t,o)=>ke(i,K(o),0,[e,t]),De=(e,t,o)=>ke(m,K(o),1,[e,t]),He=(e,t,o,s)=>ke(C,K(s),4,[e,t,o]),Qe=(e,t,o,s)=>ke(C,K(s),3,[e,t,o]),We=e=>ke(k,K(e),4,[]),ze=e=>ke(k,K(e),0),Ge=e=>ke(w,K(e),1),Je=(e,t)=>ke(y,K(t),4,[e]),Ke=(e,t)=>ke(y,K(t),3,[e]),Ne=(e,t,o,s,r)=>he(o,l,e,t,s,r),Ue=(e,t,o,s,r,d)=>he(s,I,t,o,r,d,e),Xe=(e,t,o,s,r,d,n)=>he(r,i,o,s,d,n,e,t),Ye=(e,t,o=pe,s,r=v,d=pe,n=!0)=>{const u=K(s);return ne((o=>R(u,(s=>R(t(o,s),(t=>r(s.addRow(q(e)?e(o,s):e,t,n),s,t)))))),[u,e,...o,...d,n])},Ze=(e,t,o,s,r,d,n)=>he(r,"PartialRow",o,s,d,n,e,t),$e=(e,t,o,s,r,d,n,u)=>he(d,C,s,r,n,u,e,t,o),_e=(e,t,o,s,r)=>he(o,k,e,t,s,r),et=(e,t,o,s,r)=>he(o,"PartialValues",e,t,s,r),tt=(e,t,o,s,r,d)=>he(s,y,t,o,r,d,e),ot=(e,t,o)=>Re(e,l,t,o),st=(e,t,o,s)=>Re(t,I,o,s,e),rt=(e,t,o,s,r)=>Re(o,i,s,r,e,t),dt=(e,t,o,s,r,d,n)=>Re(r,C,d,n,e,t,o,s),nt=(e,t,o)=>Re(e,k,t,o),ut=(e,t,o,s)=>Re(t,y,o,s,e),ct=(e,t,o,s)=>we(u+l,K(s),e,t,[],o),It=(e,t,o,s)=>we(l,K(s),e,t,pe,o),lt=(e,t,o,s)=>we(a,K(s),e,t,pe,o),at=(e,t,o,s,r)=>we(u+I,K(r),t,o,[e],s),it=(e,t,o,s,r)=>we(I,K(r),t,o,[e],s),pt=(e,t,o,s,r)=>we(I+m,K(r),t,o,[e],s),gt=(e,t,o,s,r,d)=>we(u+I+C,K(d),o,s,[e,t],r),bt=(e,t,o,s,r)=>we(p,K(r),t,o,[e],s),Ct=(e,t,o,s,r)=>we(g,K(r),t,o,[e],s),mt=(e,t,o,s,r,d,n,u,c)=>we(b,K(c),d,n,[e,t,o,s,r],u),yt=(e,t,o,s,r,d)=>we(u+i,K(d),o,s,[e,t],r),kt=(e,t,o,s,r,d)=>we(i,K(d),o,s,[e,t],r),wt=(e,t,o,s,r,d)=>we(m,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d,n)=>we(u+C,K(n),s,r,[e,t,o],d),Rt=(e,t,o,s,r,d,n)=>we(C,K(n),s,r,[e,t,o],d),ft=(e,t,o,s)=>we(u+k,K(s),e,t,[],o),qt=(e,t,o,s)=>we(k,K(s),e,t,pe,o),Pt=(e,t,o,s)=>we(w,K(s),e,t,pe,o),vt=(e,t,o,s,r)=>we(u+y,K(r),t,o,[e],s),xt=(e,t,o,s,r)=>we(y,K(r),t,o,[e],s),St=(e,t,o)=>we("Start"+de,K(o),e,t),Lt=(e,t,o)=>we("WillFinish"+de,K(o),e,t),Bt=(e,t,o)=>we("DidFinish"+de,K(o),e,t),Tt=(e,t,o)=>me(e,t,o),Et=()=>G(3),Mt=e=>ke("MetricIds",X(e),1),Ft=(e,t)=>ke("Metric",X(t),3,[e]),Vt=(e,t,o,s)=>we("Metric",X(s),t,o,[e]),At=(e,t,o)=>me(e,t,o),Ot=()=>G(5),jt=(e,t)=>ke("SliceIds",Z(t),1,[e]),Dt=e=>ke("IndexIds",Z(e),1),Ht=(e,t,o)=>ke("Slice"+g,Z(o),1,[e,t]),Qt=(e,t,o,s)=>we("SliceIds",Z(s),t,o,[e]),Wt=(e,t,o,s,r)=>we("Slice"+g,Z(r),o,s,[e,t]),zt=(e,t,o)=>me(e,t,o),Gt=()=>G(7),Jt=e=>ke("RelationshipIds",_(e),1),Kt=(e,t,o)=>ke("RemoteRowId",_(o),3,[e,t]),Nt=(e,t,o)=>ke("Local"+g,_(o),1,[e,t]),Ut=(e,t,o)=>ke("Linked"+g,_(o),1,[e,t]),Xt=(e,t,o,s,r)=>we("RemoteRowId",_(r),o,s,[e,t]),Yt=(e,t,o,s,r)=>we("Local"+g,_(r),o,s,[e,t]),Zt=(e,t,o,s,r)=>we("Linked"+g,_(r),o,s,[e,t]),$t=(e,t,o)=>me(e,t,o),_t=()=>G(9),eo=e=>ke("QueryIds",te(e),1),to=(e,t)=>ke(n+I,te(t),0,[e]),oo=(e,t)=>ke(n+I+m,te(t),1,[e]),so=(e,t)=>ke(n+p,te(t),5,[e]),ro=(e,t)=>ke(n+g,te(t),1,[e]),no=(e,t,o,s=0,r,d)=>ke(n+b,te(d),1,[e,t,o,s,r]),uo=(e,t,o)=>ke(n+i,te(o),0,[e,t]),co=(e,t,o)=>ke(n+m,te(o),1,[e,t]),Io=(e,t,o,s)=>ke(n+C,te(s),3,[e,t,o]),lo=(e,t,o,s)=>we(n+I,te(s),t,o,[e]),ao=(e,t,o,s)=>we(n+I+m,te(s),t,o,[e]),io=(e,t,o,s)=>we(n+p,te(s),t,o,[e]),po=(e,t,o,s)=>we(n+g,te(s),t,o,[e]),go=(e,t,o,s,r,d,u,c)=>we(n+b,te(c),d,u,[e,t,o,s,r]),bo=(e,t,o,s,r)=>we(n+i,te(r),o,s,[e,t]),Co=(e,t,o,s,r)=>we(n+m,te(r),o,s,[e,t]),mo=(e,t,o,s,r,d)=>we(n+C,te(d),s,r,[e,t,o]),yo=(e,t,o)=>me(e,t,o),ko=()=>G(11),wo=e=>ke("CheckpointIds",se(e),2),ho=(e,t)=>ke("Checkpoint",se(t),3,[e]),Ro=(e=v,t=pe,o,s=v,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},fo=e=>fe(e,"goBackward"),qo=e=>fe(e,"goForward"),Po=(e,t=pe,o,s=v,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>R(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},vo=e=>{const t=se(e),[s,r]=wo(t);return[(d=s,!(0==P(d))),fo(t),r,R(r,(e=>t?.getCheckpoint(e)))??o];var d},xo=e=>{const t=se(e),[,,[s]]=wo(t);return[!h(s),qo(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},So=(e,t,o)=>we("CheckpointIds",se(o),e,t),Lo=(e,t,o,s)=>we("Checkpoint",se(s),t,o,[e]),Bo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=ae(),[c,I]=ae();return ue((()=>{const o=t(e);I(o),o&&s&&(async()=>{await s(o),u([])})()}),[e,...o,...r]),ue((()=>()=>{c&&(c.destroy(),d?.(c))}),[c,...n]),c},To=(e,t,o=pe,s,r=pe)=>{const[d,n]=ae();return ue((()=>{(async()=>{const o=await t(e);n(o)})()}),[e,...o]),ue((()=>()=>{d&&(d.destroy(),s?.(d))}),[d,...r]),d},{PureComponent:Eo,Fragment:Mo,createElement:Fo,useCallback:Vo,useLayoutEffect:Ao,useRef:Oo,useState:jo}=e,Do=(e,...t)=>h(e)?{}:e(...t),Ho=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:Qo,useContext:Wo,useMemo:zo,useState:Go}=e,Jo=({tableId:e,store:t,rowComponent:o=$o,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>Yo(L(u,(d=>Fo(o,{...Do(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Ko=({queryId:e,queries:t,resultRowComponent:o=as,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>Yo(L(n,(r=>Fo(o,{...Do(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),No=({relationshipId:e,relationships:t,rowComponent:o=$o,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,I,l]=Ho(_(t),e),a=n(e,u,c);return Yo(L(a,(e=>Fo(o,{...Do(s,e),key:e,tableId:l,rowId:e,store:I,debugIds:d}))),r,d,u)},Uo=e=>({checkpoints:t,checkpointComponent:o=gs,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=se(t);return Yo(L(e(wo(n)),(e=>Fo(o,{...Do(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},Xo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:I,checkpoints:l,checkpointsById:a,children:i})=>{const p=Wo(Q),[g,b]=Go({}),C=Qo(((e,t)=>b((o=>V(o,e)==t?o:{...o,[e]:t}))),[]),m=Qo((e=>b((t=>({...A(t,e)})))),[]);return Fo(Q.Provider,{value:zo((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},c??p[8],{...p[9],...I},l??p[10],{...p[11],...a},C,m]),[e,t,g,o,s,r,d,n,u,c,I,l,a,p,C,m])},i)},Yo=(e,t,o,s)=>{const r=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},Zo=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>Yo(o+(Qe(e,t,s,r)??o),void 0,d,s),$o=({tableId:e,rowId:t,store:o,cellComponent:s=Zo,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>Yo(L(((e,t,o,s)=>{const r=De(t,o,s);return e??r})(d,e,t,o),(d=>Fo(s,{...Do(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),_o=e=>Jo(e,Ve(e.tableId,e.store)),es=({cellId:e,descending:t,offset:o,limit:s,...r})=>Jo(r,Ae(r.tableId,e,t,o,s,r.store)),ts=({store:e,tableComponent:t=_o,getTableComponentProps:o,separator:s,debugIds:r})=>Yo(L(Le(e),(s=>Fo(t,{...Do(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),os=({valueId:e,store:t,debugIds:s})=>Yo(o+(Ke(e,t)??o),void 0,s,e),ss=({store:e,valueComponent:t=os,getValueComponentProps:o,separator:s,debugIds:r})=>Yo(L(Ge(e),(s=>Fo(t,{...Do(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),rs=({metricId:e,metrics:t,debugIds:s})=>Yo(Ft(e,t)??o,void 0,s,e),ds=({indexId:e,sliceId:t,indexes:o,rowComponent:s=$o,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,I]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(Z(o),e),l=Ht(e,t,u);return Yo(L(l,(e=>Fo(s,{...Do(r,e),key:e,tableId:I,rowId:e,store:c,debugIds:n}))),d,n,t)},ns=({indexId:e,indexes:t,sliceComponent:o=ds,getSliceComponentProps:s,separator:r,debugIds:d})=>Yo(L(jt(e,t),(r=>Fo(o,{...Do(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),us=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=$o,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Ho(_(o),e),I=Kt(e,t,n);return Yo(h(c)||h(I)?null:Fo(s,{...Do(r,I),key:I,tableId:c,rowId:I,store:u,debugIds:d}),void 0,d,t)},cs=e=>No(e,Nt,e.remoteRowId),Is=e=>No(e,Ut,e.firstRowId),ls=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>Yo(o+(Io(e,t,s,r)??o),void 0,d,s),as=({queryId:e,rowId:t,queries:o,resultCellComponent:s=ls,getResultCellComponentProps:r,separator:d,debugIds:n})=>Yo(L(co(e,t,o),(d=>Fo(s,{...Do(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),is=e=>Ko(e,ro(e.queryId,e.queries)),ps=({cellId:e,descending:t,offset:o,limit:s,...r})=>Ko(r,no(r.queryId,e,t,o,s,r.queries)),gs=({checkpoints:e,checkpointId:t,debugIds:s})=>Yo(ho(t,e)??o,void 0,s,t),bs=Uo((e=>e[0])),Cs=Uo((e=>h(e[1])?[]:[e[1]])),ms=Uo((e=>e[2]));export{bs as BackwardCheckpointsView,Zo as CellView,gs as CheckpointView,Cs as CurrentCheckpointView,ms as ForwardCheckpointsView,ns as IndexView,Is as LinkedRowsView,cs as LocalRowsView,rs as MetricView,Xo as Provider,us as RemoteRowView,ls as ResultCellView,as as ResultRowView,ps as ResultSortedTableView,is as ResultTableView,$o as RowView,ds as SliceView,es as SortedTableView,_o as TableView,ts as TablesView,os as ValueView,ss as ValuesView,Ye as useAddRowCallback,Qe as useCell,De as useCellIds,wt as useCellIdsListener,Rt as useCellListener,ho as useCheckpoint,wo as useCheckpointIds,So as useCheckpointIdsListener,Lo as useCheckpointListener,oe as useCheckpoints,ko as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,yo as useCreateCheckpoints,At as useCreateIndexes,Pe as useCreateMergeableStore,Tt as useCreateMetrics,Bo as useCreatePersister,$t as useCreateQueries,zt as useCreateRelationships,qe as useCreateStore,To as useCreateSynchronizer,dt as useDelCellCallback,rt as useDelRowCallback,st as useDelTableCallback,ot as useDelTablesCallback,ut as useDelValueCallback,nt as useDelValuesCallback,Bt as useDidFinishTransactionListener,fo as useGoBackwardCallback,qo as useGoForwardCallback,Po as useGoToCallback,He as useHasCell,ht as useHasCellListener,Oe as useHasRow,yt as useHasRowListener,Be as useHasTable,Me as useHasTableCell,gt as useHasTableCellListener,at as useHasTableListener,xe as useHasTables,ct as useHasTablesListener,Je as useHasValue,vt as useHasValueListener,We as useHasValues,ft as useHasValuesListener,Dt as useIndexIds,Y as useIndexes,Ot as useIndexesIds,Z as useIndexesOrIndexesById,Ut as useLinkedRowIds,Zt as useLinkedRowIdsListener,Nt as useLocalRowIds,Yt as useLocalRowIdsListener,Ft as useMetric,Mt as useMetricIds,Vt as useMetricListener,U as useMetrics,Et as useMetricsIds,X as useMetricsOrMetricsById,N as useProvideStore,ee as useQueries,_t as useQueriesIds,te as useQueriesOrQueriesById,eo as useQueryIds,xo as useRedoInformation,Jt as useRelationshipIds,$ as useRelationships,Gt as useRelationshipsIds,_ as useRelationshipsOrRelationshipsById,Kt as useRemoteRowId,Xt as useRemoteRowIdListener,Io as useResultCell,co as useResultCellIds,Co as useResultCellIdsListener,mo as useResultCellListener,uo as useResultRow,so as useResultRowCount,io as useResultRowCountListener,ro as useResultRowIds,po as useResultRowIdsListener,bo as useResultRowListener,no as useResultSortedRowIds,go as useResultSortedRowIdsListener,to as useResultTable,oo as useResultTableCellIds,ao as useResultTableCellIdsListener,lo as useResultTableListener,je as useRow,Fe as useRowCount,bt as useRowCountListener,Ve as useRowIds,Ct as useRowIdsListener,kt as useRowListener,$e as useSetCellCallback,Ro as useSetCheckpointCallback,Ze as useSetPartialRowCallback,et as useSetPartialValuesCallback,Xe as useSetRowCallback,Ue as useSetTableCallback,Ne as useSetTablesCallback,tt as useSetValueCallback,_e as useSetValuesCallback,jt as useSliceIds,Qt as useSliceIdsListener,Ht as useSliceRowIds,Wt as useSliceRowIdsListener,Ae as useSortedRowIds,mt as useSortedRowIdsListener,St as useStartTransactionListener,J as useStore,ve as useStoreIds,K as useStoreOrStoreById,Te as useTable,Ee as useTableCellIds,pt as useTableCellIdsListener,Le as useTableIds,lt as useTableIdsListener,it as useTableListener,Se as useTables,It as useTablesListener,vo as useUndoInformation,Ke as useValue,Ge as useValueIds,Pt as useValueIdsListener,xt as useValueListener,ze as useValues,qt as useValuesListener,Lt as useWillFinishTransactionListener};
1
+ import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),d="Listener",n="Result",u="Has",c="Ids",I="Table",i=I+"s",l=I+c,a="Row",p=a+"Count",g=a+c,b="Sorted"+a+c,C="Cell",m=C+c,y="Value",k=y+"s",w=y+c,h=e=>null==e,R=(e,t,o)=>h(e)?o?.():t(e),f=e=>t(e)==s,v=e=>t(e)==r,q=e=>e.length,P=()=>{},x=(e,t)=>e.every(t),S=(e,t)=>q(e)===q(t)&&x(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),B=Object,T=e=>B.getPrototypeOf(e),E=B.entries,M=e=>!h(e)&&R(T(e),(e=>e==B.prototype||h(T(e))),(()=>!0)),F=B.keys,V=(e,t)=>R(e,(e=>e[t])),A=(e,t)=>(delete e[t],e),O=(e,t)=>{const o=E(e);return q(o)===q(F(t))&&x(o,(([e,o])=>M(o)?!!M(t[e])&&O(t[e],o):t[e]===o))},{createContext:j,useContext:D,useEffect:H}=e,Q=j([]),W=(e,t)=>{const o=D(Q);return h(e)?o[t]:f(e)?V(o[t+1]??{},e):e},z=(e,t)=>{const o=W(e,t);return h(e)||f(e)?o:e},G=e=>F(D(Q)[e]??{}),J=e=>W(e,0),K=e=>z(e,0),N=(e,t)=>{const{12:o,13:s}=D(Q);H((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},U=e=>W(e,2),X=e=>z(e,2),Y=e=>W(e,4),Z=e=>z(e,4),$=e=>W(e,6),_=e=>z(e,6),ee=e=>W(e,8),te=e=>z(e,8),oe=e=>W(e,10),se=e=>z(e,10),re=e=>e.toLowerCase();re(d);const de="Transaction";re(de);const{useCallback:ne,useEffect:ue,useMemo:ce,useLayoutEffect:Ie,useRef:ie,useState:le,useSyncExternalStore:ae}=e,pe=[],ge=[{},[],[pe,void 0,pe],void 0,!1,0],be=(e,t)=>e===t,Ce=[O,S,([e,t,o],[s,r,d])=>t===r&&S(e,s)&&S(o,d)],me=(e,t,o=pe)=>{const[,s]=le(),[r,d]=le();return ue((()=>{const o=e?t(e):void 0;return d(o),s([]),o?.destroy}),[e,...o]),r},ye=(e,t,...o)=>{const s=e?.["add"+t+d]?.(...o);return()=>e?.delListener(s)},ke=(e,t,s,r=pe)=>{const d=ie(ge[s]),n=ne((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??ge[s];return(Ce[s]??be)(o,d.current)?d.current:d.current=o}),[t,s,e,...r]),c=ne((d=>ye(t,(4==s?u:o)+e,...r,d)),[t,s,e,...r]),I=ae(c,n);return 0==s?{...I}:s<3?[...I]:I},we=(e,t,o,s=pe,r=pe,...d)=>Ie((()=>ye(t,e,...r,o,...d)),[t,e,...r,...s,...d]),he=(e,t,o,s=pe,r=P,d=pe,...n)=>{const u=K(e);return ne((e=>R(u,(s=>R(o(e,s),(o=>r(s["set"+t](...L(n,(t=>v(t)?t(e,s):t)),o),o)))))),[u,t,...s,...d,...n])},Re=(e,t,o=P,s=pe,...r)=>{const d=K(e);return ne((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},fe=(e,t,o)=>{const s=se(e);return ne((()=>s?.[t](o)),[s,t,o])},ve=(e,t=pe)=>ce(e,t),qe=(e,t=pe)=>ce(e,t),Pe=()=>G(1),xe=e=>ke(i,K(e),4,[]),Se=e=>ke(i,K(e),0),Le=e=>ke(l,K(e),1),Be=(e,t)=>ke(I,K(t),4,[e]),Te=(e,t)=>ke(I,K(t),0,[e]),Ee=(e,t)=>ke(I+m,K(t),1,[e]),Me=(e,t,o)=>ke(I+C,K(o),4,[e,t]),Fe=(e,t)=>ke(p,K(t),5,[e]),Ve=(e,t)=>ke(g,K(t),1,[e]),Ae=(e,t,o,s=0,r,d)=>ke(b,K(d),1,[e,t,o,s,r]),Oe=(e,t,o)=>ke(a,K(o),4,[e,t]),je=(e,t,o)=>ke(a,K(o),0,[e,t]),De=(e,t,o)=>ke(m,K(o),1,[e,t]),He=(e,t,o,s)=>ke(C,K(s),4,[e,t,o]),Qe=(e,t,o,s)=>ke(C,K(s),3,[e,t,o]),We=e=>ke(k,K(e),4,[]),ze=e=>ke(k,K(e),0),Ge=e=>ke(w,K(e),1),Je=(e,t)=>ke(y,K(t),4,[e]),Ke=(e,t)=>ke(y,K(t),3,[e]),Ne=(e,t,o,s,r)=>he(o,i,e,t,s,r),Ue=(e,t,o,s,r,d)=>he(s,I,t,o,r,d,e),Xe=(e,t,o,s,r,d,n)=>he(r,a,o,s,d,n,e,t),Ye=(e,t,o=pe,s,r=P,d=pe,n=!0)=>{const u=K(s);return ne((o=>R(u,(s=>R(t(o,s),(t=>r(s.addRow(v(e)?e(o,s):e,t,n),s,t)))))),[u,e,...o,...d,n])},Ze=(e,t,o,s,r,d,n)=>he(r,"PartialRow",o,s,d,n,e,t),$e=(e,t,o,s,r,d,n,u)=>he(d,C,s,r,n,u,e,t,o),_e=(e,t,o,s,r)=>he(o,k,e,t,s,r),et=(e,t,o,s,r)=>he(o,"PartialValues",e,t,s,r),tt=(e,t,o,s,r,d)=>he(s,y,t,o,r,d,e),ot=(e,t,o)=>Re(e,i,t,o),st=(e,t,o,s)=>Re(t,I,o,s,e),rt=(e,t,o,s,r)=>Re(o,a,s,r,e,t),dt=(e,t,o,s,r,d,n)=>Re(r,C,d,n,e,t,o,s),nt=(e,t,o)=>Re(e,k,t,o),ut=(e,t,o,s)=>Re(t,y,o,s,e),ct=(e,t,o,s)=>we(u+i,K(s),e,t,[],o),It=(e,t,o,s)=>we(i,K(s),e,t,pe,o),it=(e,t,o,s)=>we(l,K(s),e,t,pe,o),lt=(e,t,o,s,r)=>we(u+I,K(r),t,o,[e],s),at=(e,t,o,s,r)=>we(I,K(r),t,o,[e],s),pt=(e,t,o,s,r)=>we(I+m,K(r),t,o,[e],s),gt=(e,t,o,s,r,d)=>we(u+I+C,K(d),o,s,[e,t],r),bt=(e,t,o,s,r)=>we(p,K(r),t,o,[e],s),Ct=(e,t,o,s,r)=>we(g,K(r),t,o,[e],s),mt=(e,t,o,s,r,d,n,u,c)=>we(b,K(c),d,n,[e,t,o,s,r],u),yt=(e,t,o,s,r,d)=>we(u+a,K(d),o,s,[e,t],r),kt=(e,t,o,s,r,d)=>we(a,K(d),o,s,[e,t],r),wt=(e,t,o,s,r,d)=>we(m,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d,n)=>we(u+C,K(n),s,r,[e,t,o],d),Rt=(e,t,o,s,r,d,n)=>we(C,K(n),s,r,[e,t,o],d),ft=(e,t,o,s)=>we(u+k,K(s),e,t,[],o),vt=(e,t,o,s)=>we(k,K(s),e,t,pe,o),qt=(e,t,o,s)=>we(w,K(s),e,t,pe,o),Pt=(e,t,o,s,r)=>we(u+y,K(r),t,o,[e],s),xt=(e,t,o,s,r)=>we(y,K(r),t,o,[e],s),St=(e,t,o)=>we("Start"+de,K(o),e,t),Lt=(e,t,o)=>we("WillFinish"+de,K(o),e,t),Bt=(e,t,o)=>we("DidFinish"+de,K(o),e,t),Tt=(e,t,o)=>me(e,t,o),Et=()=>G(3),Mt=e=>ke("MetricIds",X(e),1),Ft=(e,t)=>ke("Metric",X(t),3,[e]),Vt=(e,t,o,s)=>we("Metric",X(s),t,o,[e]),At=(e,t,o)=>me(e,t,o),Ot=()=>G(5),jt=(e,t)=>ke("SliceIds",Z(t),1,[e]),Dt=e=>ke("IndexIds",Z(e),1),Ht=(e,t,o)=>ke("Slice"+g,Z(o),1,[e,t]),Qt=(e,t,o,s)=>we("SliceIds",Z(s),t,o,[e]),Wt=(e,t,o,s,r)=>we("Slice"+g,Z(r),o,s,[e,t]),zt=(e,t,o)=>me(e,t,o),Gt=()=>G(7),Jt=e=>ke("RelationshipIds",_(e),1),Kt=(e,t,o)=>ke("RemoteRowId",_(o),3,[e,t]),Nt=(e,t,o)=>ke("Local"+g,_(o),1,[e,t]),Ut=(e,t,o)=>ke("Linked"+g,_(o),1,[e,t]),Xt=(e,t,o,s,r)=>we("RemoteRowId",_(r),o,s,[e,t]),Yt=(e,t,o,s,r)=>we("Local"+g,_(r),o,s,[e,t]),Zt=(e,t,o,s,r)=>we("Linked"+g,_(r),o,s,[e,t]),$t=(e,t,o)=>me(e,t,o),_t=()=>G(9),eo=e=>ke("QueryIds",te(e),1),to=(e,t)=>ke(n+I,te(t),0,[e]),oo=(e,t)=>ke(n+I+m,te(t),1,[e]),so=(e,t)=>ke(n+p,te(t),5,[e]),ro=(e,t)=>ke(n+g,te(t),1,[e]),no=(e,t,o,s=0,r,d)=>ke(n+b,te(d),1,[e,t,o,s,r]),uo=(e,t,o)=>ke(n+a,te(o),0,[e,t]),co=(e,t,o)=>ke(n+m,te(o),1,[e,t]),Io=(e,t,o,s)=>ke(n+C,te(s),3,[e,t,o]),io=(e,t,o,s)=>we(n+I,te(s),t,o,[e]),lo=(e,t,o,s)=>we(n+I+m,te(s),t,o,[e]),ao=(e,t,o,s)=>we(n+p,te(s),t,o,[e]),po=(e,t,o,s)=>we(n+g,te(s),t,o,[e]),go=(e,t,o,s,r,d,u,c)=>we(n+b,te(c),d,u,[e,t,o,s,r]),bo=(e,t,o,s,r)=>we(n+a,te(r),o,s,[e,t]),Co=(e,t,o,s,r)=>we(n+m,te(r),o,s,[e,t]),mo=(e,t,o,s,r,d)=>we(n+C,te(d),s,r,[e,t,o]),yo=(e,t,o)=>me(e,t,o),ko=()=>G(11),wo=e=>ke("CheckpointIds",se(e),2),ho=(e,t)=>ke("Checkpoint",se(t),3,[e]),Ro=(e=P,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},fo=e=>fe(e,"goBackward"),vo=e=>fe(e,"goForward"),qo=(e,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>R(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},Po=e=>{const t=se(e),[s,r]=wo(t);return[(d=s,!(0==q(d))),fo(t),r,R(r,(e=>t?.getCheckpoint(e)))??o];var d},xo=e=>{const t=se(e),[,,[s]]=wo(t);return[!h(s),vo(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},So=(e,t,o)=>we("CheckpointIds",se(o),e,t),Lo=(e,t,o,s)=>we("Checkpoint",se(s),t,o,[e]),Bo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=le(),[c,I]=le();return ue((()=>{const o=e?t(e):void 0;I(o),o&&s&&(async()=>{await s(o),u([])})()}),[e,...o,...r]),ue((()=>()=>{c&&(c.destroy(),d?.(c))}),[c,...n]),c},To=(e,t,o=pe,s,r=pe)=>{const[d,n]=le();return ue((()=>{(async()=>{const o=e?await t(e):void 0;n(o)})()}),[e,...o]),ue((()=>()=>{d&&(d.destroy(),s?.(d))}),[d,...r]),d},{PureComponent:Eo,Fragment:Mo,createElement:Fo,useCallback:Vo,useLayoutEffect:Ao,useRef:Oo,useState:jo}=e,Do=(e,...t)=>h(e)?{}:e(...t),Ho=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:Qo,useContext:Wo,useMemo:zo,useState:Go}=e,Jo=({tableId:e,store:t,rowComponent:o=$o,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>Yo(L(u,(d=>Fo(o,{...Do(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Ko=({queryId:e,queries:t,resultRowComponent:o=ls,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>Yo(L(n,(r=>Fo(o,{...Do(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),No=({relationshipId:e,relationships:t,rowComponent:o=$o,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,I,i]=Ho(_(t),e),l=n(e,u,c);return Yo(L(l,(e=>Fo(o,{...Do(s,e),key:e,tableId:i,rowId:e,store:I,debugIds:d}))),r,d,u)},Uo=e=>({checkpoints:t,checkpointComponent:o=gs,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=se(t);return Yo(L(e(wo(n)),(e=>Fo(o,{...Do(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},Xo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:I,checkpoints:i,checkpointsById:l,children:a})=>{const p=Wo(Q),[g,b]=Go({}),C=Qo(((e,t)=>b((o=>V(o,e)==t?o:{...o,[e]:t}))),[]),m=Qo((e=>b((t=>({...A(t,e)})))),[]);return Fo(Q.Provider,{value:zo((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},c??p[8],{...p[9],...I},i??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,c,I,i,l,p,C,m])},a)},Yo=(e,t,o,s)=>{const r=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},Zo=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>Yo(o+(Qe(e,t,s,r)??o),void 0,d,s),$o=({tableId:e,rowId:t,store:o,cellComponent:s=Zo,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>Yo(L(((e,t,o,s)=>{const r=De(t,o,s);return e??r})(d,e,t,o),(d=>Fo(s,{...Do(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),_o=e=>Jo(e,Ve(e.tableId,e.store)),es=({cellId:e,descending:t,offset:o,limit:s,...r})=>Jo(r,Ae(r.tableId,e,t,o,s,r.store)),ts=({store:e,tableComponent:t=_o,getTableComponentProps:o,separator:s,debugIds:r})=>Yo(L(Le(e),(s=>Fo(t,{...Do(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),os=({valueId:e,store:t,debugIds:s})=>Yo(o+(Ke(e,t)??o),void 0,s,e),ss=({store:e,valueComponent:t=os,getValueComponentProps:o,separator:s,debugIds:r})=>Yo(L(Ge(e),(s=>Fo(t,{...Do(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),rs=({metricId:e,metrics:t,debugIds:s})=>Yo(Ft(e,t)??o,void 0,s,e),ds=({indexId:e,sliceId:t,indexes:o,rowComponent:s=$o,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,I]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(Z(o),e),i=Ht(e,t,u);return Yo(L(i,(e=>Fo(s,{...Do(r,e),key:e,tableId:I,rowId:e,store:c,debugIds:n}))),d,n,t)},ns=({indexId:e,indexes:t,sliceComponent:o=ds,getSliceComponentProps:s,separator:r,debugIds:d})=>Yo(L(jt(e,t),(r=>Fo(o,{...Do(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),us=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=$o,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Ho(_(o),e),I=Kt(e,t,n);return Yo(h(c)||h(I)?null:Fo(s,{...Do(r,I),key:I,tableId:c,rowId:I,store:u,debugIds:d}),void 0,d,t)},cs=e=>No(e,Nt,e.remoteRowId),Is=e=>No(e,Ut,e.firstRowId),is=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>Yo(o+(Io(e,t,s,r)??o),void 0,d,s),ls=({queryId:e,rowId:t,queries:o,resultCellComponent:s=is,getResultCellComponentProps:r,separator:d,debugIds:n})=>Yo(L(co(e,t,o),(d=>Fo(s,{...Do(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),as=e=>Ko(e,ro(e.queryId,e.queries)),ps=({cellId:e,descending:t,offset:o,limit:s,...r})=>Ko(r,no(r.queryId,e,t,o,s,r.queries)),gs=({checkpoints:e,checkpointId:t,debugIds:s})=>Yo(ho(t,e)??o,void 0,s,t),bs=Uo((e=>e[0])),Cs=Uo((e=>h(e[1])?[]:[e[1]])),ms=Uo((e=>e[2]));export{bs as BackwardCheckpointsView,Zo as CellView,gs as CheckpointView,Cs as CurrentCheckpointView,ms as ForwardCheckpointsView,ns as IndexView,Is as LinkedRowsView,cs as LocalRowsView,rs as MetricView,Xo as Provider,us as RemoteRowView,is as ResultCellView,ls as ResultRowView,ps as ResultSortedTableView,as as ResultTableView,$o as RowView,ds as SliceView,es as SortedTableView,_o as TableView,ts as TablesView,os as ValueView,ss as ValuesView,Ye as useAddRowCallback,Qe as useCell,De as useCellIds,wt as useCellIdsListener,Rt as useCellListener,ho as useCheckpoint,wo as useCheckpointIds,So as useCheckpointIdsListener,Lo as useCheckpointListener,oe as useCheckpoints,ko as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,yo as useCreateCheckpoints,At as useCreateIndexes,qe as useCreateMergeableStore,Tt as useCreateMetrics,Bo as useCreatePersister,$t as useCreateQueries,zt as useCreateRelationships,ve as useCreateStore,To as useCreateSynchronizer,dt as useDelCellCallback,rt as useDelRowCallback,st as useDelTableCallback,ot as useDelTablesCallback,ut as useDelValueCallback,nt as useDelValuesCallback,Bt as useDidFinishTransactionListener,fo as useGoBackwardCallback,vo as useGoForwardCallback,qo as useGoToCallback,He as useHasCell,ht as useHasCellListener,Oe as useHasRow,yt as useHasRowListener,Be as useHasTable,Me as useHasTableCell,gt as useHasTableCellListener,lt as useHasTableListener,xe as useHasTables,ct as useHasTablesListener,Je as useHasValue,Pt as useHasValueListener,We as useHasValues,ft as useHasValuesListener,Dt as useIndexIds,Y as useIndexes,Ot as useIndexesIds,Z as useIndexesOrIndexesById,Ut as useLinkedRowIds,Zt as useLinkedRowIdsListener,Nt as useLocalRowIds,Yt as useLocalRowIdsListener,Ft as useMetric,Mt as useMetricIds,Vt as useMetricListener,U as useMetrics,Et as useMetricsIds,X as useMetricsOrMetricsById,N as useProvideStore,ee as useQueries,_t as useQueriesIds,te as useQueriesOrQueriesById,eo as useQueryIds,xo as useRedoInformation,Jt as useRelationshipIds,$ as useRelationships,Gt as useRelationshipsIds,_ as useRelationshipsOrRelationshipsById,Kt as useRemoteRowId,Xt as useRemoteRowIdListener,Io as useResultCell,co as useResultCellIds,Co as useResultCellIdsListener,mo as useResultCellListener,uo as useResultRow,so as useResultRowCount,ao as useResultRowCountListener,ro as useResultRowIds,po as useResultRowIdsListener,bo as useResultRowListener,no as useResultSortedRowIds,go as useResultSortedRowIdsListener,to as useResultTable,oo as useResultTableCellIds,lo as useResultTableCellIdsListener,io as useResultTableListener,je as useRow,Fe as useRowCount,bt as useRowCountListener,Ve as useRowIds,Ct as useRowIdsListener,kt as useRowListener,$e as useSetCellCallback,Ro as useSetCheckpointCallback,Ze as useSetPartialRowCallback,et as useSetPartialValuesCallback,Xe as useSetRowCallback,Ue as useSetTableCallback,Ne as useSetTablesCallback,tt as useSetValueCallback,_e as useSetValuesCallback,jt as useSliceIds,Qt as useSliceIdsListener,Ht as useSliceRowIds,Wt as useSliceRowIdsListener,Ae as useSortedRowIds,mt as useSortedRowIdsListener,St as useStartTransactionListener,J as useStore,Pe as useStoreIds,K as useStoreOrStoreById,Te as useTable,Ee as useTableCellIds,pt as useTableCellIdsListener,Le as useTableIds,it as useTableIdsListener,at as useTableListener,Se as useTables,It as useTablesListener,Po as useUndoInformation,Ke as useValue,Ge as useValueIds,qt as useValueIdsListener,xt as useValueListener,ze as useValues,vt as useValuesListener,Lt as useWillFinishTransactionListener};
Binary file
@@ -1 +1 @@
1
- var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u=t(t),l="Listener",n="Result",d="Has",a="Ids",i="Table",c=i+"s",I=i+a,C="Row",p=C+"Count",b=C+a,w="Sorted"+C+a,R="Cell",k=R+a,g="Value",L=g+"s",h=g+a,y=e=>null==e,m=(e,s,t)=>y(e)?t?.():s(e),S=e=>t(e)==r,T=e=>t(e)==u,V=e=>e.length,f=()=>{},x=(e,s)=>e.every(s),P=(e,s)=>V(e)===V(s)&&x(e,((e,t)=>s[t]===e)),v=(e,s)=>e.map(s),q=Object,B=e=>q.getPrototypeOf(e),H=q.entries,M=e=>!y(e)&&m(B(e),(e=>e==q.prototype||y(B(e))),(()=>!0)),D=q.keys,F=(e,s)=>m(e,(e=>e[s])),O=(e,s)=>(delete e[s],e),Q=(e,s)=>{const t=H(e);return V(t)===V(D(s))&&x(t,(([e,t])=>M(t)?!!M(s[e])&&Q(s[e],t):s[e]===t))},{createContext:E,useContext:A,useEffect:G}=s,j=E([]),U=(e,s)=>{const t=A(j);return y(e)?t[s]:S(e)?F(t[s+1]??{},e):e},W=(e,s)=>{const t=U(e,s);return y(e)||S(e)?t:e},z=e=>D(A(j)[e]??{}),J=e=>W(e,0),K=e=>W(e,2),N=e=>W(e,4),X=e=>W(e,6),Y=e=>W(e,8),Z=e=>W(e,10),$=e=>e.toLowerCase();$(l);const _="Transaction";$(_);const{useCallback:ee,useEffect:se,useMemo:te,useLayoutEffect:oe,useRef:re,useState:ue,useSyncExternalStore:le}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ae=(e,s)=>e===s,ie=[Q,P,([e,s,t],[o,r,u])=>s===r&&P(e,o)&&P(t,u)],ce=(e,s,t=ne)=>{const[,o]=ue(),[r,u]=ue();return se((()=>{const t=s(e);return u(t),o([]),t.destroy}),[e,...t]),r},Ie=(e,s,...t)=>{const o=e?.["add"+s+l]?.(...t);return()=>e?.delListener(o)},Ce=(e,s,t,r=ne)=>{const u=re(de[t]),l=ee((()=>{const o=s?.[(4==t?"has":"get")+e]?.(...r)??de[t];return(ie[t]??ae)(o,u.current)?u.current:u.current=o}),[s,t,e,...r]),n=ee((u=>Ie(s,(4==t?d:o)+e,...r,u)),[s,t,e,...r]);return le(n,l)},pe=(e,s,t,o=ne,r=ne,...u)=>oe((()=>Ie(s,e,...r,t,...u)),[s,e,...r,...o,...u]),be=(e,s,t,o=ne,r=f,u=ne,...l)=>{const n=J(e);return ee((e=>m(n,(o=>m(t(e,o),(t=>r(o["set"+s](...v(l,(s=>T(s)?s(e,o):s)),t),t)))))),[n,s,...o,...u,...l])},we=(e,s,t=f,o=ne,...r)=>{const u=J(e);return ee((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},Re=(e,s,t)=>{const o=Z(e);return ee((()=>o?.[s](t)),[o,s,t])},ke=e=>Ce(I,J(e),1),ge=(e,s)=>Ce(b,J(s),1,[e]),Le=(e,s,t,o=0,r,u)=>Ce(w,J(u),1,[e,s,t,o,r]),he=(e,s,t)=>Ce(k,J(t),1,[e,s]),ye=(e,s,t,o)=>Ce(R,J(o),3,[e,s,t]),me=e=>Ce(h,J(e),1),Se=(e,s)=>Ce(g,J(s),3,[e]),Te=(e,s)=>Ce("Metric",K(s),3,[e]),Ve=(e,s)=>Ce("SliceIds",N(s),1,[e]),fe=(e,s,t)=>Ce("Slice"+b,N(t),1,[e,s]),xe=(e,s,t)=>Ce("RemoteRowId",X(t),3,[e,s]),Pe=(e,s,t)=>Ce("Local"+b,X(t),1,[e,s]),ve=(e,s,t)=>Ce("Linked"+b,X(t),1,[e,s]),qe=(e,s)=>Ce(n+b,Y(s),1,[e]),Be=(e,s,t,o=0,r,u)=>Ce(n+w,Y(u),1,[e,s,t,o,r]),He=(e,s,t)=>Ce(n+k,Y(t),1,[e,s]),Me=(e,s,t,o)=>Ce(n+R,Y(o),3,[e,s,t]),De=e=>Ce("CheckpointIds",Z(e),2),Fe=(e,s)=>Ce("Checkpoint",Z(s),3,[e]),Oe=e=>Re(e,"goBackward"),Qe=e=>Re(e,"goForward"),{PureComponent:Ee,Fragment:Ae,createElement:Ge,useCallback:je,useLayoutEffect:Ue,useRef:We,useState:ze}=s,Je=(e,...s)=>y(e)?{}:e(...s),Ke=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:Ne,useContext:Xe,useMemo:Ye,useState:Ze}=s,$e=({tableId:e,store:s,rowComponent:t=rs,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},n)=>ts(v(n,(u=>Ge(t,{...Je(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),_e=({queryId:e,queries:s,resultRowComponent:t=as,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>ts(v(l,(r=>Ge(t,{...Je(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),es=({relationshipId:e,relationships:s,rowComponent:t=rs,getRowComponentProps:o,separator:r,debugIds:u},l,n)=>{const[d,a,i]=Ke(X(s),e),c=l(e,n,d);return ts(v(c,(e=>Ge(t,{...Je(o,e),key:e,tableId:i,rowId:e,store:a,debugIds:u}))),r,u,n)},ss=e=>({checkpoints:s,checkpointComponent:t=is,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=Z(s);return ts(v(e(De(l)),(e=>Ge(t,{...Je(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},ts=(e,s,t,o)=>{const r=y(s)||!Array.isArray(e)?e:v(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},os=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>ts(o+(ye(e,s,t,r)??o),void 0,u,t),rs=({tableId:e,rowId:s,store:t,cellComponent:o=os,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:n})=>ts(v(((e,s,t,o)=>{const r=he(s,t,o);return e??r})(u,e,s,t),(u=>Ge(o,{...Je(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:n}))),l,n,s),us=e=>$e(e,ge(e.tableId,e.store)),ls=({valueId:e,store:s,debugIds:t})=>ts(o+(Se(e,s)??o),void 0,t,e),ns=({indexId:e,sliceId:s,indexes:t,rowComponent:o=rs,getRowComponentProps:r,separator:u,debugIds:l})=>{const[n,d,a]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(N(t),e),i=fe(e,s,n);return ts(v(i,(e=>Ge(o,{...Je(r,e),key:e,tableId:a,rowId:e,store:d,debugIds:l}))),u,l,s)},ds=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>ts(o+(Me(e,s,t,r)??o),void 0,u,t),as=({queryId:e,rowId:s,queries:t,resultCellComponent:o=ds,getResultCellComponentProps:r,separator:u,debugIds:l})=>ts(v(He(e,s,t),(u=>Ge(o,{...Je(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),is=({checkpoints:e,checkpointId:s,debugIds:t})=>ts(Fe(s,e)??o,void 0,t,s),cs=ss((e=>e[0])),Is=ss((e=>y(e[1])?[]:[e[1]])),Cs=ss((e=>e[2]));e.BackwardCheckpointsView=cs,e.CellView=os,e.CheckpointView=is,e.CurrentCheckpointView=Is,e.ForwardCheckpointsView=Cs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ns,getSliceComponentProps:o,separator:r,debugIds:u})=>ts(v(Ve(e,s),(r=>Ge(t,{...Je(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>es(e,ve,e.firstRowId),e.LocalRowsView=e=>es(e,Pe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>ts(Te(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:n,queries:d,queriesById:a,checkpoints:i,checkpointsById:c,children:I})=>{const C=Xe(j),[p,b]=Ze({}),w=Ne(((e,s)=>b((t=>F(t,e)==s?t:{...t,[e]:s}))),[]),R=Ne((e=>b((s=>({...O(s,e)})))),[]);return Ge(j.Provider,{value:Ye((()=>[e??C[0],{...C[1],...s,...p},t??C[2],{...C[3],...o},r??C[4],{...C[5],...u},l??C[6],{...C[7],...n},d??C[8],{...C[9],...a},i??C[10],{...C[11],...c},w,R]),[e,s,p,t,o,r,u,l,n,d,a,i,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=rs,getRowComponentProps:r,debugIds:u})=>{const[l,n,,d]=Ke(X(t),e),a=xe(e,s,l);return ts(y(d)||y(a)?null:Ge(o,{...Je(r,a),key:a,tableId:d,rowId:a,store:n,debugIds:u}),void 0,u,s)},e.ResultCellView=ds,e.ResultRowView=as,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>_e(r,Be(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>_e(e,qe(e.queryId,e.queries)),e.RowView=rs,e.SliceView=ns,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>$e(r,Le(r.tableId,e,s,t,o,r.store)),e.TableView=us,e.TablesView=({store:e,tableComponent:s=us,getTableComponentProps:t,separator:o,debugIds:r})=>ts(v(ke(e),(o=>Ge(s,{...Je(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=ls,e.ValuesView=({store:e,valueComponent:s=ls,getValueComponentProps:t,separator:o,debugIds:r})=>ts(v(me(e),(o=>Ge(s,{...Je(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=ne,o,r=f,u=ne,l=!0)=>{const n=J(o);return ee((t=>m(n,(o=>m(s(t,o),(s=>r(o.addRow(T(e)?e(t,o):e,s,l),o,s)))))),[n,e,...t,...u,l])},e.useCell=ye,e.useCellIds=he,e.useCellIdsListener=(e,s,t,o,r,u)=>pe(k,J(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,l)=>pe(R,J(l),o,r,[e,s,t],u),e.useCheckpoint=Fe,e.useCheckpointIds=De,e.useCheckpointIdsListener=(e,s,t)=>pe("CheckpointIds",Z(t),e,s),e.useCheckpointListener=(e,s,t,o)=>pe("Checkpoint",Z(o),s,t,[e]),e.useCheckpoints=e=>U(e,10),e.useCheckpointsIds=()=>z(11),e.useCheckpointsOrCheckpointsById=Z,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,o,r=ne,u,l=ne)=>{const[,n]=ue(),[d,a]=ue();return se((()=>{const t=s(e);a(t),t&&o&&(async()=>{await o(t),n([])})()}),[e,...t,...r]),se((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),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,o,r=ne)=>{const[u,l]=ue();return se((()=>{(async()=>{const t=await s(e);l(t)})()}),[e,...t]),se((()=>()=>{u&&(u.destroy(),o?.(u))}),[u,...r]),u},e.useDelCellCallback=(e,s,t,o,r,u,l)=>we(r,R,u,l,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>we(t,C,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>we(s,i,t,o,e),e.useDelTablesCallback=(e,s,t)=>we(e,c,s,t),e.useDelValueCallback=(e,s,t,o)=>we(s,g,t,o,e),e.useDelValuesCallback=(e,s,t)=>we(e,L,s,t),e.useDidFinishTransactionListener=(e,s,t)=>pe("DidFinish"+_,J(t),e,s),e.useGoBackwardCallback=Oe,e.useGoForwardCallback=Qe,e.useGoToCallback=(e,s=ne,t,o=f,r=ne)=>{const u=Z(t);return ee((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useHasCell=(e,s,t,o)=>Ce(R,J(o),4,[e,s,t]),e.useHasCellListener=(e,s,t,o,r,u,l)=>pe(d+R,J(l),o,r,[e,s,t],u),e.useHasRow=(e,s,t)=>Ce(C,J(t),4,[e,s]),e.useHasRowListener=(e,s,t,o,r,u)=>pe(d+C,J(u),t,o,[e,s],r),e.useHasTable=(e,s)=>Ce(i,J(s),4,[e]),e.useHasTableCell=(e,s,t)=>Ce(i+R,J(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,o,r,u)=>pe(d+i+R,J(u),t,o,[e,s],r),e.useHasTableListener=(e,s,t,o,r)=>pe(d+i,J(r),s,t,[e],o),e.useHasTables=e=>Ce(c,J(e),4,[]),e.useHasTablesListener=(e,s,t,o)=>pe(d+c,J(o),e,s,[],t),e.useHasValue=(e,s)=>Ce(g,J(s),4,[e]),e.useHasValueListener=(e,s,t,o,r)=>pe(d+g,J(r),s,t,[e],o),e.useHasValues=e=>Ce(L,J(e),4,[]),e.useHasValuesListener=(e,s,t,o)=>pe(d+L,J(o),e,s,[],t),e.useIndexIds=e=>Ce("IndexIds",N(e),1),e.useIndexes=e=>U(e,4),e.useIndexesIds=()=>z(5),e.useIndexesOrIndexesById=N,e.useLinkedRowIds=ve,e.useLinkedRowIdsListener=(e,s,t,o,r)=>pe("Linked"+b,X(r),t,o,[e,s]),e.useLocalRowIds=Pe,e.useLocalRowIdsListener=(e,s,t,o,r)=>pe("Local"+b,X(r),t,o,[e,s]),e.useMetric=Te,e.useMetricIds=e=>Ce("MetricIds",K(e),1),e.useMetricListener=(e,s,t,o)=>pe("Metric",K(o),s,t,[e]),e.useMetrics=e=>U(e,2),e.useMetricsIds=()=>z(3),e.useMetricsOrMetricsById=K,e.useProvideStore=(e,s)=>{const{12:t,13:o}=A(j);G((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},e.useQueries=e=>U(e,8),e.useQueriesIds=()=>z(9),e.useQueriesOrQueriesById=Y,e.useQueryIds=e=>Ce("QueryIds",Y(e),1),e.useRedoInformation=e=>{const s=Z(e),[,,[t]]=De(s);return[!y(t),Qe(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>Ce("RelationshipIds",X(e),1),e.useRelationships=e=>U(e,6),e.useRelationshipsIds=()=>z(7),e.useRelationshipsOrRelationshipsById=X,e.useRemoteRowId=xe,e.useRemoteRowIdListener=(e,s,t,o,r)=>pe("RemoteRowId",X(r),t,o,[e,s]),e.useResultCell=Me,e.useResultCellIds=He,e.useResultCellIdsListener=(e,s,t,o,r)=>pe(n+k,Y(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>pe(n+R,Y(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>Ce(n+C,Y(t),0,[e,s]),e.useResultRowCount=(e,s)=>Ce(n+p,Y(s),5,[e]),e.useResultRowCountListener=(e,s,t,o)=>pe(n+p,Y(o),s,t,[e]),e.useResultRowIds=qe,e.useResultRowIdsListener=(e,s,t,o)=>pe(n+b,Y(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>pe(n+C,Y(r),t,o,[e,s]),e.useResultSortedRowIds=Be,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,d)=>pe(n+w,Y(d),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>Ce(n+i,Y(s),0,[e]),e.useResultTableCellIds=(e,s)=>Ce(n+i+k,Y(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>pe(n+i+k,Y(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>pe(n+i,Y(o),s,t,[e]),e.useRow=(e,s,t)=>Ce(C,J(t),0,[e,s]),e.useRowCount=(e,s)=>Ce(p,J(s),5,[e]),e.useRowCountListener=(e,s,t,o,r)=>pe(p,J(r),s,t,[e],o),e.useRowIds=ge,e.useRowIdsListener=(e,s,t,o,r)=>pe(b,J(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>pe(C,J(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,l,n)=>be(u,R,o,r,l,n,e,s,t),e.useSetCheckpointCallback=(e=f,s=ne,t,o=f,r=ne)=>{const u=Z(t);return ee((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>be(r,"PartialRow",t,o,u,l,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>be(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,l)=>be(r,C,t,o,u,l,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>be(o,i,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>be(t,c,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>be(o,g,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>be(t,L,e,s,o,r),e.useSliceIds=Ve,e.useSliceIdsListener=(e,s,t,o)=>pe("SliceIds",N(o),s,t,[e]),e.useSliceRowIds=fe,e.useSliceRowIdsListener=(e,s,t,o,r)=>pe("Slice"+b,N(r),t,o,[e,s]),e.useSortedRowIds=Le,e.useSortedRowIdsListener=(e,s,t,o,r,u,l,n,d)=>pe(w,J(d),u,l,[e,s,t,o,r],n),e.useStartTransactionListener=(e,s,t)=>pe("Start"+_,J(t),e,s),e.useStore=e=>U(e,0),e.useStoreIds=()=>z(1),e.useStoreOrStoreById=J,e.useTable=(e,s)=>Ce(i,J(s),0,[e]),e.useTableCellIds=(e,s)=>Ce(i+k,J(s),1,[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>pe(i+k,J(r),s,t,[e],o),e.useTableIds=ke,e.useTableIdsListener=(e,s,t,o)=>pe(I,J(o),e,s,ne,t),e.useTableListener=(e,s,t,o,r)=>pe(i,J(r),s,t,[e],o),e.useTables=e=>Ce(c,J(e),0),e.useTablesListener=(e,s,t,o)=>pe(c,J(o),e,s,ne,t),e.useUndoInformation=e=>{const s=Z(e),[t,r]=De(s);return[(u=t,!(0==V(u))),Oe(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=Se,e.useValueIds=me,e.useValueIdsListener=(e,s,t,o)=>pe(h,J(o),e,s,ne,t),e.useValueListener=(e,s,t,o,r)=>pe(g,J(r),s,t,[e],o),e.useValues=e=>Ce(L,J(e),0),e.useValuesListener=(e,s,t,o)=>pe(L,J(o),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>pe("WillFinish"+_,J(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,o="",r=t(o),u=t(t),l="Listener",n="Result",d="Has",a="Ids",i="Table",c=i+"s",I=i+a,C="Row",p=C+"Count",b=C+a,w="Sorted"+C+a,R="Cell",k=R+a,g="Value",L=g+"s",h=g+a,y=e=>null==e,m=(e,s,t)=>y(e)?t?.():s(e),S=e=>t(e)==r,T=e=>t(e)==u,V=e=>e.length,f=()=>{},x=(e,s)=>e.every(s),v=(e,s)=>V(e)===V(s)&&x(e,((e,t)=>s[t]===e)),P=(e,s)=>e.map(s),q=Object,B=e=>q.getPrototypeOf(e),H=q.entries,M=e=>!y(e)&&m(B(e),(e=>e==q.prototype||y(B(e))),(()=>!0)),D=q.keys,F=(e,s)=>m(e,(e=>e[s])),O=(e,s)=>(delete e[s],e),Q=(e,s)=>{const t=H(e);return V(t)===V(D(s))&&x(t,(([e,t])=>M(t)?!!M(s[e])&&Q(s[e],t):s[e]===t))},{createContext:E,useContext:A,useEffect:G}=s,j=E([]),U=(e,s)=>{const t=A(j);return y(e)?t[s]:S(e)?F(t[s+1]??{},e):e},W=(e,s)=>{const t=U(e,s);return y(e)||S(e)?t:e},z=e=>D(A(j)[e]??{}),J=e=>W(e,0),K=e=>W(e,2),N=e=>W(e,4),X=e=>W(e,6),Y=e=>W(e,8),Z=e=>W(e,10),$=e=>e.toLowerCase();$(l);const _="Transaction";$(_);const{useCallback:ee,useEffect:se,useMemo:te,useLayoutEffect:oe,useRef:re,useState:ue,useSyncExternalStore:le}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ae=(e,s)=>e===s,ie=[Q,v,([e,s,t],[o,r,u])=>s===r&&v(e,o)&&v(t,u)],ce=(e,s,t=ne)=>{const[,o]=ue(),[r,u]=ue();return se((()=>{const t=e?s(e):void 0;return u(t),o([]),t?.destroy}),[e,...t]),r},Ie=(e,s,...t)=>{const o=e?.["add"+s+l]?.(...t);return()=>e?.delListener(o)},Ce=(e,s,t,r=ne)=>{const u=re(de[t]),l=ee((()=>{const o=s?.[(4==t?"has":"get")+e]?.(...r)??de[t];return(ie[t]??ae)(o,u.current)?u.current:u.current=o}),[s,t,e,...r]),n=ee((u=>Ie(s,(4==t?d:o)+e,...r,u)),[s,t,e,...r]),a=le(n,l);return 0==t?{...a}:t<3?[...a]:a},pe=(e,s,t,o=ne,r=ne,...u)=>oe((()=>Ie(s,e,...r,t,...u)),[s,e,...r,...o,...u]),be=(e,s,t,o=ne,r=f,u=ne,...l)=>{const n=J(e);return ee((e=>m(n,(o=>m(t(e,o),(t=>r(o["set"+s](...P(l,(s=>T(s)?s(e,o):s)),t),t)))))),[n,s,...o,...u,...l])},we=(e,s,t=f,o=ne,...r)=>{const u=J(e);return ee((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},Re=(e,s,t)=>{const o=Z(e);return ee((()=>o?.[s](t)),[o,s,t])},ke=e=>Ce(I,J(e),1),ge=(e,s)=>Ce(b,J(s),1,[e]),Le=(e,s,t,o=0,r,u)=>Ce(w,J(u),1,[e,s,t,o,r]),he=(e,s,t)=>Ce(k,J(t),1,[e,s]),ye=(e,s,t,o)=>Ce(R,J(o),3,[e,s,t]),me=e=>Ce(h,J(e),1),Se=(e,s)=>Ce(g,J(s),3,[e]),Te=(e,s)=>Ce("Metric",K(s),3,[e]),Ve=(e,s)=>Ce("SliceIds",N(s),1,[e]),fe=(e,s,t)=>Ce("Slice"+b,N(t),1,[e,s]),xe=(e,s,t)=>Ce("RemoteRowId",X(t),3,[e,s]),ve=(e,s,t)=>Ce("Local"+b,X(t),1,[e,s]),Pe=(e,s,t)=>Ce("Linked"+b,X(t),1,[e,s]),qe=(e,s)=>Ce(n+b,Y(s),1,[e]),Be=(e,s,t,o=0,r,u)=>Ce(n+w,Y(u),1,[e,s,t,o,r]),He=(e,s,t)=>Ce(n+k,Y(t),1,[e,s]),Me=(e,s,t,o)=>Ce(n+R,Y(o),3,[e,s,t]),De=e=>Ce("CheckpointIds",Z(e),2),Fe=(e,s)=>Ce("Checkpoint",Z(s),3,[e]),Oe=e=>Re(e,"goBackward"),Qe=e=>Re(e,"goForward"),{PureComponent:Ee,Fragment:Ae,createElement:Ge,useCallback:je,useLayoutEffect:Ue,useRef:We,useState:ze}=s,Je=(e,...s)=>y(e)?{}:e(...s),Ke=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:Ne,useContext:Xe,useMemo:Ye,useState:Ze}=s,$e=({tableId:e,store:s,rowComponent:t=rs,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},n)=>ts(P(n,(u=>Ge(t,{...Je(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),_e=({queryId:e,queries:s,resultRowComponent:t=as,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>ts(P(l,(r=>Ge(t,{...Je(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),es=({relationshipId:e,relationships:s,rowComponent:t=rs,getRowComponentProps:o,separator:r,debugIds:u},l,n)=>{const[d,a,i]=Ke(X(s),e),c=l(e,n,d);return ts(P(c,(e=>Ge(t,{...Je(o,e),key:e,tableId:i,rowId:e,store:a,debugIds:u}))),r,u,n)},ss=e=>({checkpoints:s,checkpointComponent:t=is,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=Z(s);return ts(P(e(De(l)),(e=>Ge(t,{...Je(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},ts=(e,s,t,o)=>{const r=y(s)||!Array.isArray(e)?e:P(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},os=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>ts(o+(ye(e,s,t,r)??o),void 0,u,t),rs=({tableId:e,rowId:s,store:t,cellComponent:o=os,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:n})=>ts(P(((e,s,t,o)=>{const r=he(s,t,o);return e??r})(u,e,s,t),(u=>Ge(o,{...Je(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:n}))),l,n,s),us=e=>$e(e,ge(e.tableId,e.store)),ls=({valueId:e,store:s,debugIds:t})=>ts(o+(Se(e,s)??o),void 0,t,e),ns=({indexId:e,sliceId:s,indexes:t,rowComponent:o=rs,getRowComponentProps:r,separator:u,debugIds:l})=>{const[n,d,a]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(N(t),e),i=fe(e,s,n);return ts(P(i,(e=>Ge(o,{...Je(r,e),key:e,tableId:a,rowId:e,store:d,debugIds:l}))),u,l,s)},ds=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>ts(o+(Me(e,s,t,r)??o),void 0,u,t),as=({queryId:e,rowId:s,queries:t,resultCellComponent:o=ds,getResultCellComponentProps:r,separator:u,debugIds:l})=>ts(P(He(e,s,t),(u=>Ge(o,{...Je(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),is=({checkpoints:e,checkpointId:s,debugIds:t})=>ts(Fe(s,e)??o,void 0,t,s),cs=ss((e=>e[0])),Is=ss((e=>y(e[1])?[]:[e[1]])),Cs=ss((e=>e[2]));e.BackwardCheckpointsView=cs,e.CellView=os,e.CheckpointView=is,e.CurrentCheckpointView=Is,e.ForwardCheckpointsView=Cs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ns,getSliceComponentProps:o,separator:r,debugIds:u})=>ts(P(Ve(e,s),(r=>Ge(t,{...Je(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>es(e,Pe,e.firstRowId),e.LocalRowsView=e=>es(e,ve,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>ts(Te(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:n,queries:d,queriesById:a,checkpoints:i,checkpointsById:c,children:I})=>{const C=Xe(j),[p,b]=Ze({}),w=Ne(((e,s)=>b((t=>F(t,e)==s?t:{...t,[e]:s}))),[]),R=Ne((e=>b((s=>({...O(s,e)})))),[]);return Ge(j.Provider,{value:Ye((()=>[e??C[0],{...C[1],...s,...p},t??C[2],{...C[3],...o},r??C[4],{...C[5],...u},l??C[6],{...C[7],...n},d??C[8],{...C[9],...a},i??C[10],{...C[11],...c},w,R]),[e,s,p,t,o,r,u,l,n,d,a,i,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=rs,getRowComponentProps:r,debugIds:u})=>{const[l,n,,d]=Ke(X(t),e),a=xe(e,s,l);return ts(y(d)||y(a)?null:Ge(o,{...Je(r,a),key:a,tableId:d,rowId:a,store:n,debugIds:u}),void 0,u,s)},e.ResultCellView=ds,e.ResultRowView=as,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>_e(r,Be(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>_e(e,qe(e.queryId,e.queries)),e.RowView=rs,e.SliceView=ns,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>$e(r,Le(r.tableId,e,s,t,o,r.store)),e.TableView=us,e.TablesView=({store:e,tableComponent:s=us,getTableComponentProps:t,separator:o,debugIds:r})=>ts(P(ke(e),(o=>Ge(s,{...Je(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=ls,e.ValuesView=({store:e,valueComponent:s=ls,getValueComponentProps:t,separator:o,debugIds:r})=>ts(P(me(e),(o=>Ge(s,{...Je(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=ne,o,r=f,u=ne,l=!0)=>{const n=J(o);return ee((t=>m(n,(o=>m(s(t,o),(s=>r(o.addRow(T(e)?e(t,o):e,s,l),o,s)))))),[n,e,...t,...u,l])},e.useCell=ye,e.useCellIds=he,e.useCellIdsListener=(e,s,t,o,r,u)=>pe(k,J(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,l)=>pe(R,J(l),o,r,[e,s,t],u),e.useCheckpoint=Fe,e.useCheckpointIds=De,e.useCheckpointIdsListener=(e,s,t)=>pe("CheckpointIds",Z(t),e,s),e.useCheckpointListener=(e,s,t,o)=>pe("Checkpoint",Z(o),s,t,[e]),e.useCheckpoints=e=>U(e,10),e.useCheckpointsIds=()=>z(11),e.useCheckpointsOrCheckpointsById=Z,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,o,r=ne,u,l=ne)=>{const[,n]=ue(),[d,a]=ue();return se((()=>{const t=e?s(e):void 0;a(t),t&&o&&(async()=>{await o(t),n([])})()}),[e,...t,...r]),se((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),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,o,r=ne)=>{const[u,l]=ue();return se((()=>{(async()=>{const t=e?await s(e):void 0;l(t)})()}),[e,...t]),se((()=>()=>{u&&(u.destroy(),o?.(u))}),[u,...r]),u},e.useDelCellCallback=(e,s,t,o,r,u,l)=>we(r,R,u,l,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>we(t,C,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>we(s,i,t,o,e),e.useDelTablesCallback=(e,s,t)=>we(e,c,s,t),e.useDelValueCallback=(e,s,t,o)=>we(s,g,t,o,e),e.useDelValuesCallback=(e,s,t)=>we(e,L,s,t),e.useDidFinishTransactionListener=(e,s,t)=>pe("DidFinish"+_,J(t),e,s),e.useGoBackwardCallback=Oe,e.useGoForwardCallback=Qe,e.useGoToCallback=(e,s=ne,t,o=f,r=ne)=>{const u=Z(t);return ee((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useHasCell=(e,s,t,o)=>Ce(R,J(o),4,[e,s,t]),e.useHasCellListener=(e,s,t,o,r,u,l)=>pe(d+R,J(l),o,r,[e,s,t],u),e.useHasRow=(e,s,t)=>Ce(C,J(t),4,[e,s]),e.useHasRowListener=(e,s,t,o,r,u)=>pe(d+C,J(u),t,o,[e,s],r),e.useHasTable=(e,s)=>Ce(i,J(s),4,[e]),e.useHasTableCell=(e,s,t)=>Ce(i+R,J(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,o,r,u)=>pe(d+i+R,J(u),t,o,[e,s],r),e.useHasTableListener=(e,s,t,o,r)=>pe(d+i,J(r),s,t,[e],o),e.useHasTables=e=>Ce(c,J(e),4,[]),e.useHasTablesListener=(e,s,t,o)=>pe(d+c,J(o),e,s,[],t),e.useHasValue=(e,s)=>Ce(g,J(s),4,[e]),e.useHasValueListener=(e,s,t,o,r)=>pe(d+g,J(r),s,t,[e],o),e.useHasValues=e=>Ce(L,J(e),4,[]),e.useHasValuesListener=(e,s,t,o)=>pe(d+L,J(o),e,s,[],t),e.useIndexIds=e=>Ce("IndexIds",N(e),1),e.useIndexes=e=>U(e,4),e.useIndexesIds=()=>z(5),e.useIndexesOrIndexesById=N,e.useLinkedRowIds=Pe,e.useLinkedRowIdsListener=(e,s,t,o,r)=>pe("Linked"+b,X(r),t,o,[e,s]),e.useLocalRowIds=ve,e.useLocalRowIdsListener=(e,s,t,o,r)=>pe("Local"+b,X(r),t,o,[e,s]),e.useMetric=Te,e.useMetricIds=e=>Ce("MetricIds",K(e),1),e.useMetricListener=(e,s,t,o)=>pe("Metric",K(o),s,t,[e]),e.useMetrics=e=>U(e,2),e.useMetricsIds=()=>z(3),e.useMetricsOrMetricsById=K,e.useProvideStore=(e,s)=>{const{12:t,13:o}=A(j);G((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},e.useQueries=e=>U(e,8),e.useQueriesIds=()=>z(9),e.useQueriesOrQueriesById=Y,e.useQueryIds=e=>Ce("QueryIds",Y(e),1),e.useRedoInformation=e=>{const s=Z(e),[,,[t]]=De(s);return[!y(t),Qe(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>Ce("RelationshipIds",X(e),1),e.useRelationships=e=>U(e,6),e.useRelationshipsIds=()=>z(7),e.useRelationshipsOrRelationshipsById=X,e.useRemoteRowId=xe,e.useRemoteRowIdListener=(e,s,t,o,r)=>pe("RemoteRowId",X(r),t,o,[e,s]),e.useResultCell=Me,e.useResultCellIds=He,e.useResultCellIdsListener=(e,s,t,o,r)=>pe(n+k,Y(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>pe(n+R,Y(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>Ce(n+C,Y(t),0,[e,s]),e.useResultRowCount=(e,s)=>Ce(n+p,Y(s),5,[e]),e.useResultRowCountListener=(e,s,t,o)=>pe(n+p,Y(o),s,t,[e]),e.useResultRowIds=qe,e.useResultRowIdsListener=(e,s,t,o)=>pe(n+b,Y(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>pe(n+C,Y(r),t,o,[e,s]),e.useResultSortedRowIds=Be,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,d)=>pe(n+w,Y(d),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>Ce(n+i,Y(s),0,[e]),e.useResultTableCellIds=(e,s)=>Ce(n+i+k,Y(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>pe(n+i+k,Y(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>pe(n+i,Y(o),s,t,[e]),e.useRow=(e,s,t)=>Ce(C,J(t),0,[e,s]),e.useRowCount=(e,s)=>Ce(p,J(s),5,[e]),e.useRowCountListener=(e,s,t,o,r)=>pe(p,J(r),s,t,[e],o),e.useRowIds=ge,e.useRowIdsListener=(e,s,t,o,r)=>pe(b,J(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>pe(C,J(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,l,n)=>be(u,R,o,r,l,n,e,s,t),e.useSetCheckpointCallback=(e=f,s=ne,t,o=f,r=ne)=>{const u=Z(t);return ee((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>be(r,"PartialRow",t,o,u,l,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>be(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,l)=>be(r,C,t,o,u,l,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>be(o,i,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>be(t,c,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>be(o,g,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>be(t,L,e,s,o,r),e.useSliceIds=Ve,e.useSliceIdsListener=(e,s,t,o)=>pe("SliceIds",N(o),s,t,[e]),e.useSliceRowIds=fe,e.useSliceRowIdsListener=(e,s,t,o,r)=>pe("Slice"+b,N(r),t,o,[e,s]),e.useSortedRowIds=Le,e.useSortedRowIdsListener=(e,s,t,o,r,u,l,n,d)=>pe(w,J(d),u,l,[e,s,t,o,r],n),e.useStartTransactionListener=(e,s,t)=>pe("Start"+_,J(t),e,s),e.useStore=e=>U(e,0),e.useStoreIds=()=>z(1),e.useStoreOrStoreById=J,e.useTable=(e,s)=>Ce(i,J(s),0,[e]),e.useTableCellIds=(e,s)=>Ce(i+k,J(s),1,[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>pe(i+k,J(r),s,t,[e],o),e.useTableIds=ke,e.useTableIdsListener=(e,s,t,o)=>pe(I,J(o),e,s,ne,t),e.useTableListener=(e,s,t,o,r)=>pe(i,J(r),s,t,[e],o),e.useTables=e=>Ce(c,J(e),0),e.useTablesListener=(e,s,t,o)=>pe(c,J(o),e,s,ne,t),e.useUndoInformation=e=>{const s=Z(e),[t,r]=De(s);return[(u=t,!(0==V(u))),Oe(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=Se,e.useValueIds=me,e.useValueIdsListener=(e,s,t,o)=>pe(h,J(o),e,s,ne,t),e.useValueListener=(e,s,t,o,r)=>pe(g,J(r),s,t,[e],o),e.useValues=e=>Ce(L,J(e),0),e.useValuesListener=(e,s,t,o)=>pe(L,J(o),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>pe("WillFinish"+_,J(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,y="Value",g=y+"s",v=y+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=(e,s)=>e===s,ae=[j,P,([e,s,t],[l,o,r])=>s===o&&P(e,l)&&P(t,r)],ce=(e,s,t=ne)=>{const[,l]=re(),[o,r]=re();return se((()=>{const t=s(e);return r(t),l([]),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=ae[t])?n:ie)(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](...x(u,(s=>f(s)?s(e,l):s)),t),t)))))),[n,s,...l,...r,...u])},we=(e,s,t=T,l=ne,...o)=>{const r=z(e);return ee((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},Re=(e,s,t)=>{const l=Y(e);return ee((()=>null==l?void 0:l[s](t)),[l,s,t])},ke=e=>pe(I,z(e),1),ye=(e,s)=>pe(b,z(s),1,[e]),ge=(e,s,t,l=0,o,r)=>pe(w,z(r),1,[e,s,t,l,o]),ve=(e,s,t)=>pe(k,z(t),1,[e,s]),he=(e,s,t,l)=>pe(R,z(l),3,[e,s,t]),me=e=>pe(v,z(e),1),Le=(e,s)=>pe(y,z(s),3,[e]),fe=(e,s)=>pe("Metric",J(s),3,[e]),Se=(e,s)=>pe("SliceIds",K(s),1,[e]),Te=(e,s,t)=>pe("Slice"+b,K(t),1,[e,s]),Ve=(e,s,t)=>pe("RemoteRowId",N(t),3,[e,s]),Pe=(e,s,t)=>pe("Local"+b,N(t),1,[e,s]),xe=(e,s,t)=>pe("Linked"+b,N(t),1,[e,s]),Oe=(e,s)=>pe(n+b,X(s),1,[e]),qe=(e,s,t,l=0,o,r)=>pe(n+w,X(r),1,[e,s,t,l,o]),Be=(e,s,t)=>pe(n+k,X(t),1,[e,s]),He=(e,s,t,l)=>pe(n+R,X(l),3,[e,s,t]),Me=e=>pe("CheckpointIds",Y(e),2),De=(e,s)=>pe("Checkpoint",Y(s),3,[e]),je=e=>Re(e,"goBackward"),Fe=e=>Re(e,"goForward"),{PureComponent:Ee,Fragment:Qe,createElement:Ae,useCallback:Ge,useLayoutEffect:Ue,useRef:We,useState:ze}=s,Je=(e,...s)=>h(e)?{}:e(...s),Ke=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ne=Object.defineProperty,Xe=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,Ze=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,es=(e,s,t)=>s in e?Ne(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ss=(e,s)=>{for(var t in s||(s={}))$e.call(s,t)&&es(e,t,s[t]);if(Ze)for(var t of Ze(s))_e.call(s,t)&&es(e,t,s[t]);return e},ts=(e,s)=>Xe(e,Ye(s)),ls=(e,s)=>{var t={};for(var l in e)$e.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&Ze)for(var l of Ze(e))s.indexOf(l)<0&&_e.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:os,useContext:rs,useMemo:us,useState:ns}=s,ds=({tableId:e,store:s,rowComponent:t=Cs,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>Is(x(n,(r=>Ae(t,ts(ss({},Je(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),is=({queryId:e,queries:s,resultRowComponent:t=ys,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Is(x(u,(o=>Ae(t,ts(ss({},Je(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),as=({relationshipId:e,relationships:s,rowComponent:t=Cs,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=Ke(N(s),e),c=u(e,n,d);return Is(x(c,(e=>Ae(t,ts(ss({},Je(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},cs=e=>({checkpoints:s,checkpointComponent:t=gs,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=Y(s);return Is(x(e(Me(u)),(e=>Ae(t,ts(ss({},Je(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Is=(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},ps=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return Is(l+(null!=(u=he(e,s,t,o))?u:l),void 0,r,t)},Cs=({tableId:e,rowId:s,store:t,cellComponent:l=ps,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>Is(x(((e,s,t,l)=>{const o=ve(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Ae(l,ts(ss({},Je(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),bs=e=>ds(e,ye(e.tableId,e.store)),ws=({valueId:e,store:s,debugIds:t})=>{var o;return Is(l+(null!=(o=Le(e,s))?o:l),void 0,t,e)},Rs=({indexId:e,sliceId:s,indexes:t,rowComponent:l=Cs,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=Te(e,s,n);return Is(x(a,(e=>Ae(l,ts(ss({},Je(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ks=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Is(l+(null!=(u=He(e,s,t,o))?u:l),void 0,r,t)},ys=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ks,getResultCellComponentProps:o,separator:r,debugIds:u})=>Is(x(Be(e,s,t),(r=>Ae(l,ts(ss({},Je(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),gs=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return Is(null!=(o=De(s,e))?o:l,void 0,t,s)},vs=cs((e=>e[0])),hs=cs((e=>h(e[1])?[]:[e[1]])),ms=cs((e=>e[2]));e.BackwardCheckpointsView=vs,e.CellView=ps,e.CheckpointView=gs,e.CurrentCheckpointView=hs,e.ForwardCheckpointsView=ms,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Rs,getSliceComponentProps:l,separator:o,debugIds:r})=>Is(x(Se(e,s),(o=>Ae(t,ts(ss({},Je(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>as(e,xe,e.firstRowId),e.LocalRowsView=e=>as(e,Pe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Is(null!=(o=fe(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=rs(A),[C,b]=ns({}),w=os(((e,s)=>b((t=>D(t,e)==s?t:ts(ss({},t),{[e]:s})))),[]),R=os((e=>b((s=>ss({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Ae(A.Provider,{value:us((()=>[null!=e?e:p[0],ss(ss(ss({},p[1]),s),C),null!=t?t:p[2],ss(ss({},p[3]),l),null!=o?o:p[4],ss(ss({},p[5]),r),null!=u?u:p[6],ss(ss({},p[7]),n),null!=d?d:p[8],ss(ss({},p[9]),i),null!=a?a:p[10],ss(ss({},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=Cs,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=Ke(N(t),e),i=Ve(e,s,u);return Is(h(d)||h(i)?null:Ae(l,ts(ss({},Je(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ks,e.ResultRowView=ys,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=ls(s,["cellId","descending","offset","limit"]);return is(u,qe(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>is(e,Oe(e.queryId,e.queries)),e.RowView=Cs,e.SliceView=Rs,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=ls(s,["cellId","descending","offset","limit"]);return ds(u,ge(u.tableId,t,l,o,r,u.store))},e.TableView=bs,e.TablesView=({store:e,tableComponent:s=bs,getTableComponentProps:t,separator:l,debugIds:o})=>Is(x(ke(e),(l=>Ae(s,ts(ss({},Je(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=ws,e.ValuesView=({store:e,valueComponent:s=ws,getValueComponentProps:t,separator:l,debugIds:o})=>Is(x(me(e),(l=>Ae(s,ts(ss({},Je(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=he,e.useCellIds=ve,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=De,e.useCheckpointIds=Me,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((()=>{const t=s(e);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=yield s(e);u(t)}))}),[e,...t]),se((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>we(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>we(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>we(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>we(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>we(s,y,t,l,e),e.useDelValuesCallback=(e,s,t)=>we(e,g,s,t),e.useDidFinishTransactionListener=(e,s,t)=>Ce("DidFinish"+$,z(t),e,s),e.useGoBackwardCallback=je,e.useGoForwardCallback=Fe,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(y,z(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>Ce(d+y,z(o),s,t,[e],l),e.useHasValues=e=>pe(g,z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>Ce(d+g,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=xe,e.useLinkedRowIdsListener=(e,s,t,l,o)=>Ce("Linked"+b,N(o),t,l,[e,s]),e.useLocalRowIds=Pe,e.useLocalRowIdsListener=(e,s,t,l,o)=>Ce("Local"+b,N(o),t,l,[e,s]),e.useMetric=fe,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]]=Me(t);return[!h(o),Fe(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=Ve,e.useRemoteRowIdListener=(e,s,t,l,o)=>Ce("RemoteRowId",N(o),t,l,[e,s]),e.useResultCell=He,e.useResultCellIds=Be,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=Oe,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=qe,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=ye,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,y,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>be(t,g,e,s,l,o),e.useSliceIds=Se,e.useSliceIdsListener=(e,s,t,l)=>Ce("SliceIds",K(l),s,t,[e]),e.useSliceRowIds=Te,e.useSliceRowIdsListener=(e,s,t,l,o)=>Ce("Slice"+b,K(o),t,l,[e,s]),e.useSortedRowIds=ge,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=ke,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]=Me(t);return[(u=o,!(0==S(u))),je(t),r,null!=(s=m(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Le,e.useValueIds=me,e.useValueIdsListener=(e,s,t,l)=>Ce(v,z(l),e,s,ne,t),e.useValueListener=(e,s,t,l,o)=>Ce(y,z(o),s,t,[e],l),e.useValues=e=>pe(g,z(e),0),e.useValuesListener=(e,s,t,l)=>Ce(g,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="",r=t(l),o=t(t),u="Listener",n="Result",d="Has",i="Ids",a="Table",c=a+"s",I=a+i,p="Row",b=p+"Count",C=p+i,w="Sorted"+p+i,R="Cell",k=R+i,y="Value",v=y+"s",g=y+i,h=e=>null==e,m=(e,s,t)=>h(e)?null==t?void 0:t():s(e),f=e=>t(e)==r,L=e=>t(e)==o,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,j=(e,s)=>m(e,(e=>e[s])),D=(e,s)=>{const t=B(e);return S(t)===S(M(s))&&V(t,(([e,t])=>H(t)?!!H(s[e])&&D(s[e],t):s[e]===t))},{createContext:E,useContext:F,useEffect:Q}=s,A=E([]),G=(e,s)=>{var t;const l=F(A);return h(e)?l[s]:f(e)?j(null!=(t=l[s+1])?t:{},e):e},U=(e,s)=>{const t=G(e,s);return h(e)||f(e)?t:e},W=e=>{var s;return M(null!=(s=F(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 _=Object.defineProperty,ee=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,le=(e,s,t)=>s in e?_(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,re=(e,s,t)=>new Promise(((l,r)=>{var o=e=>{try{n(t.next(e))}catch(e){r(e)}},u=e=>{try{n(t.throw(e))}catch(e){r(e)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(o,u);n((t=t.apply(e,s)).next())}));const{useCallback:oe,useEffect:ue,useMemo:ne,useLayoutEffect:de,useRef:ie,useState:ae,useSyncExternalStore:ce}=s,Ie=[],pe=[{},[],[Ie,void 0,Ie],void 0,!1,0],be=(e,s)=>e===s,Ce=[D,P,([e,s,t],[l,r,o])=>s===r&&P(e,l)&&P(t,o)],we=(e,s,t=Ie)=>{const[,l]=ae(),[r,o]=ae();return ue((()=>{const t=e?s(e):void 0;return o(t),l([]),null==t?void 0:t.destroy}),[e,...t]),r},Re=(e,s,...t)=>{var l;const r=null==(l=null==e?void 0:e["add"+s+u])?void 0:l.call(e,...t);return()=>null==e?void 0:e.delListener(r)},ke=(e,s,t,r=Ie)=>{const o=ie(pe[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,...r))?u:pe[t];return(null!=(n=Ce[t])?n:be)(d,o.current)?o.current:o.current=d}),[s,t,e,...r]),n=oe((o=>Re(s,(4==t?d:l)+e,...r,o)),[s,t,e,...r]),i=ce(n,u);return 0==t?((e,s)=>{for(var t in s||(s={}))se.call(s,t)&&le(e,t,s[t]);if(ee)for(var t of ee(s))te.call(s,t)&&le(e,t,s[t]);return e})({},i):t<3?[...i]:i},ye=(e,s,t,l=Ie,r=Ie,...o)=>de((()=>Re(s,e,...r,t,...o)),[s,e,...r,...l,...o]),ve=(e,s,t,l=Ie,r=T,o=Ie,...u)=>{const n=z(e);return oe((e=>m(n,(l=>m(t(e,l),(t=>r(l["set"+s](...x(u,(s=>L(s)?s(e,l):s)),t),t)))))),[n,s,...l,...o,...u])},ge=(e,s,t=T,l=Ie,...r)=>{const o=z(e);return oe((()=>t(null==o?void 0:o["del"+s](...r))),[o,s,...l,...r])},he=(e,s,t)=>{const l=Y(e);return oe((()=>null==l?void 0:l[s](t)),[l,s,t])},me=e=>ke(I,z(e),1),fe=(e,s)=>ke(C,z(s),1,[e]),Le=(e,s,t,l=0,r,o)=>ke(w,z(o),1,[e,s,t,l,r]),Se=(e,s,t)=>ke(k,z(t),1,[e,s]),Te=(e,s,t,l)=>ke(R,z(l),3,[e,s,t]),Ve=e=>ke(g,z(e),1),Pe=(e,s)=>ke(y,z(s),3,[e]),xe=(e,s)=>ke("Metric",J(s),3,[e]),Oe=(e,s)=>ke("SliceIds",K(s),1,[e]),qe=(e,s,t)=>ke("Slice"+C,K(t),1,[e,s]),Be=(e,s,t)=>ke("RemoteRowId",N(t),3,[e,s]),He=(e,s,t)=>ke("Local"+C,N(t),1,[e,s]),Me=(e,s,t)=>ke("Linked"+C,N(t),1,[e,s]),je=(e,s)=>ke(n+C,X(s),1,[e]),De=(e,s,t,l=0,r,o)=>ke(n+w,X(o),1,[e,s,t,l,r]),Ee=(e,s,t)=>ke(n+k,X(t),1,[e,s]),Fe=(e,s,t,l)=>ke(n+R,X(l),3,[e,s,t]),Qe=e=>ke("CheckpointIds",Y(e),2),Ae=(e,s)=>ke("Checkpoint",Y(s),3,[e]),Ge=e=>he(e,"goBackward"),Ue=e=>he(e,"goForward"),{PureComponent:We,Fragment:ze,createElement:Je,useCallback:Ke,useLayoutEffect:Ne,useRef:Xe,useState:Ye}=s,Ze=(e,...s)=>h(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 _e=Object.defineProperty,es=Object.defineProperties,ss=Object.getOwnPropertyDescriptors,ts=Object.getOwnPropertySymbols,ls=Object.prototype.hasOwnProperty,rs=Object.prototype.propertyIsEnumerable,os=(e,s,t)=>s in e?_e(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,us=(e,s)=>{for(var t in s||(s={}))ls.call(s,t)&&os(e,t,s[t]);if(ts)for(var t of ts(s))rs.call(s,t)&&os(e,t,s[t]);return e},ns=(e,s)=>es(e,ss(s)),ds=(e,s)=>{var t={};for(var l in e)ls.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&ts)for(var l of ts(e))s.indexOf(l)<0&&rs.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:is,useContext:as,useMemo:cs,useState:Is}=s,ps=({tableId:e,store:s,rowComponent:t=ys,getRowComponentProps:l,customCellIds:r,separator:o,debugIds:u},n)=>Rs(x(n,(o=>Je(t,ns(us({},Ze(l,o)),{key:o,tableId:e,rowId:o,customCellIds:r,store:s,debugIds:u})))),o,u,e),bs=({queryId:e,queries:s,resultRowComponent:t=fs,getResultRowComponentProps:l,separator:r,debugIds:o},u)=>Rs(x(u,(r=>Je(t,ns(us({},Ze(l,r)),{key:r,queryId:e,rowId:r,queries:s,debugIds:o})))),r,o,e),Cs=({relationshipId:e,relationships:s,rowComponent:t=ys,getRowComponentProps:l,separator:r,debugIds:o},u,n)=>{const[d,i,a]=$e(N(s),e),c=u(e,n,d);return Rs(x(c,(e=>Je(t,ns(us({},Ze(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:o})))),r,o,n)},ws=e=>({checkpoints:s,checkpointComponent:t=Ls,getCheckpointComponentProps:l,separator:r,debugIds:o})=>{const u=Y(s);return Rs(x(e(Qe(u)),(e=>Je(t,ns(us({},Ze(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:o})))),r)},Rs=(e,s,t,l)=>{const r=h(s)||!Array.isArray(e)?e:x(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",r,"}"]:r},ks=({tableId:e,rowId:s,cellId:t,store:r,debugIds:o})=>{var u;return Rs(l+(null!=(u=Te(e,s,t,r))?u:l),void 0,o,t)},ys=({tableId:e,rowId:s,store:t,cellComponent:l=ks,getCellComponentProps:r,customCellIds:o,separator:u,debugIds:n})=>Rs(x(((e,s,t,l)=>{const r=Se(s,t,l);return null!=e?e:r})(o,e,s,t),(o=>Je(l,ns(us({},Ze(r,o)),{key:o,tableId:e,rowId:s,cellId:o,store:t,debugIds:n})))),u,n,s),vs=e=>ps(e,fe(e.tableId,e.store)),gs=({valueId:e,store:s,debugIds:t})=>{var r;return Rs(l+(null!=(r=Pe(e,s))?r:l),void 0,t,e)},hs=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ys,getRowComponentProps:r,separator:o,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=qe(e,s,n);return Rs(x(a,(e=>Je(l,ns(us({},Ze(r,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),o,u,s)},ms=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:o})=>{var u;return Rs(l+(null!=(u=Fe(e,s,t,r))?u:l),void 0,o,t)},fs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ms,getResultCellComponentProps:r,separator:o,debugIds:u})=>Rs(x(Ee(e,s,t),(o=>Je(l,ns(us({},Ze(r,o)),{key:o,queryId:e,rowId:s,cellId:o,queries:t,debugIds:u})))),o,u,s),Ls=({checkpoints:e,checkpointId:s,debugIds:t})=>{var r;return Rs(null!=(r=Ae(s,e))?r:l,void 0,t,s)},Ss=ws((e=>e[0])),Ts=ws((e=>h(e[1])?[]:[e[1]])),Vs=ws((e=>e[2]));e.BackwardCheckpointsView=Ss,e.CellView=ks,e.CheckpointView=Ls,e.CurrentCheckpointView=Ts,e.ForwardCheckpointsView=Vs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=hs,getSliceComponentProps:l,separator:r,debugIds:o})=>Rs(x(Oe(e,s),(r=>Je(t,ns(us({},Ze(l,r)),{key:r,indexId:e,sliceId:r,indexes:s,debugIds:o})))),r,o,e),e.LinkedRowsView=e=>Cs(e,Me,e.firstRowId),e.LocalRowsView=e=>Cs(e,He,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var r;return Rs(null!=(r=xe(e,s))?r:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:r,indexesById:o,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=as(A),[b,C]=Is({}),w=is(((e,s)=>C((t=>j(t,e)==s?t:ns(us({},t),{[e]:s})))),[]),R=is((e=>C((s=>us({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Je(A.Provider,{value:cs((()=>[null!=e?e:p[0],us(us(us({},p[1]),s),b),null!=t?t:p[2],us(us({},p[3]),l),null!=r?r:p[4],us(us({},p[5]),o),null!=u?u:p[6],us(us({},p[7]),n),null!=d?d:p[8],us(us({},p[9]),i),null!=a?a:p[10],us(us({},p[11]),c),w,R]),[e,s,b,t,l,r,o,u,n,d,i,a,c,p,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ys,getRowComponentProps:r,debugIds:o})=>{const[u,n,,d]=$e(N(t),e),i=Be(e,s,u);return Rs(h(d)||h(i)?null:Je(l,ns(us({},Ze(r,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:o})),void 0,o,s)},e.ResultCellView=ms,e.ResultRowView=fs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:r,limit:o}=s,u=ds(s,["cellId","descending","offset","limit"]);return bs(u,De(u.queryId,t,l,r,o,u.queries))},e.ResultTableView=e=>bs(e,je(e.queryId,e.queries)),e.RowView=ys,e.SliceView=hs,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:r,limit:o}=s,u=ds(s,["cellId","descending","offset","limit"]);return ps(u,Le(u.tableId,t,l,r,o,u.store))},e.TableView=vs,e.TablesView=({store:e,tableComponent:s=vs,getTableComponentProps:t,separator:l,debugIds:r})=>Rs(x(me(e),(l=>Je(s,ns(us({},Ze(t,l)),{key:l,tableId:l,store:e,debugIds:r})))),l),e.ValueView=gs,e.ValuesView=({store:e,valueComponent:s=gs,getValueComponentProps:t,separator:l,debugIds:r})=>Rs(x(Ve(e),(l=>Je(s,ns(us({},Ze(t,l)),{key:l,valueId:l,store:e,debugIds:r})))),l),e.useAddRowCallback=(e,s,t=Ie,l,r=T,o=Ie,u=!0)=>{const n=z(l);return oe((t=>m(n,(l=>m(s(t,l),(s=>r(l.addRow(L(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...o,u])},e.useCell=Te,e.useCellIds=Se,e.useCellIdsListener=(e,s,t,l,r,o)=>ye(k,z(o),t,l,[e,s],r),e.useCellListener=(e,s,t,l,r,o,u)=>ye(R,z(u),l,r,[e,s,t],o),e.useCheckpoint=Ae,e.useCheckpointIds=Qe,e.useCheckpointIdsListener=(e,s,t)=>ye("CheckpointIds",Y(t),e,s),e.useCheckpointListener=(e,s,t,l)=>ye("Checkpoint",Y(l),s,t,[e]),e.useCheckpoints=e=>G(e,10),e.useCheckpointsIds=()=>W(11),e.useCheckpointsOrCheckpointsById=Y,e.useCreateCheckpoints=(e,s,t)=>we(e,s,t),e.useCreateIndexes=(e,s,t)=>we(e,s,t),e.useCreateMergeableStore=(e,s=Ie)=>ne(e,s),e.useCreateMetrics=(e,s,t)=>we(e,s,t),e.useCreatePersister=(e,s,t=Ie,l,r=Ie,o,u=Ie)=>{const[,n]=ae(),[d,i]=ae();return ue((()=>{const t=e?s(e):void 0;i(t),t&&l&&re(void 0,null,(function*(){yield l(t),n([])}))}),[e,...t,...r]),ue((()=>()=>{d&&(d.destroy(),null==o||o(d))}),[d,...u]),d},e.useCreateQueries=(e,s,t)=>we(e,s,t),e.useCreateRelationships=(e,s,t)=>we(e,s,t),e.useCreateStore=(e,s=Ie)=>ne(e,s),e.useCreateSynchronizer=(e,s,t=Ie,l,r=Ie)=>{const[o,u]=ae();return ue((()=>{re(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),ue((()=>()=>{o&&(o.destroy(),null==l||l(o))}),[o,...r]),o},e.useDelCellCallback=(e,s,t,l,r,o,u)=>ge(r,R,o,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,r)=>ge(t,p,l,r,e,s),e.useDelTableCallback=(e,s,t,l)=>ge(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>ge(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>ge(s,y,t,l,e),e.useDelValuesCallback=(e,s,t)=>ge(e,v,s,t),e.useDidFinishTransactionListener=(e,s,t)=>ye("DidFinish"+$,z(t),e,s),e.useGoBackwardCallback=Ge,e.useGoForwardCallback=Ue,e.useGoToCallback=(e,s=Ie,t,l=T,r=Ie)=>{const o=Y(t);return oe((s=>m(o,(t=>m(e(s),(e=>l(t.goTo(e),e)))))),[o,...s,...r])},e.useHasCell=(e,s,t,l)=>ke(R,z(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,r,o,u)=>ye(d+R,z(u),l,r,[e,s,t],o),e.useHasRow=(e,s,t)=>ke(p,z(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,r,o)=>ye(d+p,z(o),t,l,[e,s],r),e.useHasTable=(e,s)=>ke(a,z(s),4,[e]),e.useHasTableCell=(e,s,t)=>ke(a+R,z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,r,o)=>ye(d+a+R,z(o),t,l,[e,s],r),e.useHasTableListener=(e,s,t,l,r)=>ye(d+a,z(r),s,t,[e],l),e.useHasTables=e=>ke(c,z(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>ye(d+c,z(l),e,s,[],t),e.useHasValue=(e,s)=>ke(y,z(s),4,[e]),e.useHasValueListener=(e,s,t,l,r)=>ye(d+y,z(r),s,t,[e],l),e.useHasValues=e=>ke(v,z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>ye(d+v,z(l),e,s,[],t),e.useIndexIds=e=>ke("IndexIds",K(e),1),e.useIndexes=e=>G(e,4),e.useIndexesIds=()=>W(5),e.useIndexesOrIndexesById=K,e.useLinkedRowIds=Me,e.useLinkedRowIdsListener=(e,s,t,l,r)=>ye("Linked"+C,N(r),t,l,[e,s]),e.useLocalRowIds=He,e.useLocalRowIdsListener=(e,s,t,l,r)=>ye("Local"+C,N(r),t,l,[e,s]),e.useMetric=xe,e.useMetricIds=e=>ke("MetricIds",J(e),1),e.useMetricListener=(e,s,t,l)=>ye("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}=F(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=>ke("QueryIds",X(e),1),e.useRedoInformation=e=>{var s;const t=Y(e),[,,[r]]=Qe(t);return[!h(r),Ue(t),r,null!=(s=m(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>ke("RelationshipIds",N(e),1),e.useRelationships=e=>G(e,6),e.useRelationshipsIds=()=>W(7),e.useRelationshipsOrRelationshipsById=N,e.useRemoteRowId=Be,e.useRemoteRowIdListener=(e,s,t,l,r)=>ye("RemoteRowId",N(r),t,l,[e,s]),e.useResultCell=Fe,e.useResultCellIds=Ee,e.useResultCellIdsListener=(e,s,t,l,r)=>ye(n+k,X(r),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,r,o)=>ye(n+R,X(o),l,r,[e,s,t]),e.useResultRow=(e,s,t)=>ke(n+p,X(t),0,[e,s]),e.useResultRowCount=(e,s)=>ke(n+b,X(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>ye(n+b,X(l),s,t,[e]),e.useResultRowIds=je,e.useResultRowIdsListener=(e,s,t,l)=>ye(n+C,X(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,r)=>ye(n+p,X(r),t,l,[e,s]),e.useResultSortedRowIds=De,e.useResultSortedRowIdsListener=(e,s,t,l,r,o,u,d)=>ye(n+w,X(d),o,u,[e,s,t,l,r]),e.useResultTable=(e,s)=>ke(n+a,X(s),0,[e]),e.useResultTableCellIds=(e,s)=>ke(n+a+k,X(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>ye(n+a+k,X(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>ye(n+a,X(l),s,t,[e]),e.useRow=(e,s,t)=>ke(p,z(t),0,[e,s]),e.useRowCount=(e,s)=>ke(b,z(s),5,[e]),e.useRowCountListener=(e,s,t,l,r)=>ye(b,z(r),s,t,[e],l),e.useRowIds=fe,e.useRowIdsListener=(e,s,t,l,r)=>ye(C,z(r),s,t,[e],l),e.useRowListener=(e,s,t,l,r,o)=>ye(p,z(o),t,l,[e,s],r),e.useSetCellCallback=(e,s,t,l,r,o,u,n)=>ve(o,R,l,r,u,n,e,s,t),e.useSetCheckpointCallback=(e=T,s=Ie,t,l=T,r=Ie)=>{const o=Y(t);return oe((s=>m(o,(t=>{const r=e(s);l(t.addCheckpoint(r),t,r)}))),[o,...s,...r])},e.useSetPartialRowCallback=(e,s,t,l,r,o,u)=>ve(r,"PartialRow",t,l,o,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,r)=>ve(t,"PartialValues",e,s,l,r),e.useSetRowCallback=(e,s,t,l,r,o,u)=>ve(r,p,t,l,o,u,e,s),e.useSetTableCallback=(e,s,t,l,r,o)=>ve(l,a,s,t,r,o,e),e.useSetTablesCallback=(e,s,t,l,r)=>ve(t,c,e,s,l,r),e.useSetValueCallback=(e,s,t,l,r,o)=>ve(l,y,s,t,r,o,e),e.useSetValuesCallback=(e,s,t,l,r)=>ve(t,v,e,s,l,r),e.useSliceIds=Oe,e.useSliceIdsListener=(e,s,t,l)=>ye("SliceIds",K(l),s,t,[e]),e.useSliceRowIds=qe,e.useSliceRowIdsListener=(e,s,t,l,r)=>ye("Slice"+C,K(r),t,l,[e,s]),e.useSortedRowIds=Le,e.useSortedRowIdsListener=(e,s,t,l,r,o,u,n,d)=>ye(w,z(d),o,u,[e,s,t,l,r],n),e.useStartTransactionListener=(e,s,t)=>ye("Start"+$,z(t),e,s),e.useStore=e=>G(e,0),e.useStoreIds=()=>W(1),e.useStoreOrStoreById=z,e.useTable=(e,s)=>ke(a,z(s),0,[e]),e.useTableCellIds=(e,s)=>ke(a+k,z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,r)=>ye(a+k,z(r),s,t,[e],l),e.useTableIds=me,e.useTableIdsListener=(e,s,t,l)=>ye(I,z(l),e,s,Ie,t),e.useTableListener=(e,s,t,l,r)=>ye(a,z(r),s,t,[e],l),e.useTables=e=>ke(c,z(e),0),e.useTablesListener=(e,s,t,l)=>ye(c,z(l),e,s,Ie,t),e.useUndoInformation=e=>{var s;const t=Y(e),[r,o]=Qe(t);return[(u=r,!(0==S(u))),Ge(t),o,null!=(s=m(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Pe,e.useValueIds=Ve,e.useValueIdsListener=(e,s,t,l)=>ye(g,z(l),e,s,Ie,t),e.useValueListener=(e,s,t,l,r)=>ye(y,z(r),s,t,[e],l),e.useValues=e=>ke(v,z(e),0),e.useValuesListener=(e,s,t,l)=>ye(v,z(l),e,s,Ie,t),e.useWillFinishTransactionListener=(e,s,t)=>ye("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);
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "5.0.0-beta.15",
3
+ "version": "5.0.0-beta.16",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -254,11 +254,11 @@
254
254
  "country-flag-emoji-json": "^2.0.0",
255
255
  "cspell": "^8.8.1",
256
256
  "electric-sql": "^0.11.3",
257
- "esbuild": "^0.21.2",
257
+ "esbuild": "^0.21.3",
258
258
  "eslint": "^8.57.0",
259
259
  "eslint-config-prettier": "^9.1.0",
260
260
  "eslint-plugin-jest": "^28.5.0",
261
- "eslint-plugin-jsdoc": "^48.2.4",
261
+ "eslint-plugin-jsdoc": "^48.2.5",
262
262
  "eslint-plugin-react": "7.34.1",
263
263
  "eslint-plugin-react-hooks": "^4.6.2",
264
264
  "expo-sqlite": "^13.2.1",
@@ -275,7 +275,7 @@
275
275
  "partykit": "^0.0.104",
276
276
  "partysocket": "^1.0.1",
277
277
  "prettier": "^3.2.5",
278
- "puppeteer": "22.8.1",
278
+ "puppeteer": "22.9.0",
279
279
  "react": "^18.3.1",
280
280
  "react-dom": "^18.3.1",
281
281
  "react-test-renderer": "^18.3.1",
@@ -291,7 +291,7 @@
291
291
  "ts-unused-exports": "^10.0.1",
292
292
  "typescript": "5.4.5",
293
293
  "wa-sqlite": "github:rhashimoto/wa-sqlite",
294
- "ws": "^8.16.0",
294
+ "ws": "^8.17.0",
295
295
  "yjs": "^13.6.15"
296
296
  },
297
297
  "peerDependencies": {
@@ -308,7 +308,7 @@
308
308
  "react": "^18.3.1",
309
309
  "react-dom": "^18.3.1",
310
310
  "sqlite3": "^5.1.7",
311
- "ws": "^8.16.0",
311
+ "ws": "^8.17.0",
312
312
  "yjs": "^13.6.15"
313
313
  },
314
314
  "peerDependenciesMeta": {
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://beta.tinybase.org/guides/releases/#v5-0"><em>NEW!</em> v5.0 release</a> <span id="one-with">&quot;The One You Can Sync&quot;</span></p><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions &amp; ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://beta.tinybase.org/api/persister-browser">storage</a>, <a href="https://beta.tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://beta.tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>; and (<em>new!</em>) <a href="https://beta.tinybase.org/api/persister-partykit-client/">PartyKit</a> and <a href="https://electric-sql.com/">ElectricSQL</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">5.1kB - 12.2kB</a>, no dependencies. <a href="#well-tested-and-documented">100% tested</a>, <a href="https://beta.tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</li></ul><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://beta.tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://beta.tinybase.org/react.svg"> React</a></div><div><a href="https://beta.tinybase.org/api/persister-partykit-client"><img width="48" src="https://beta.tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/turso.svg">Turso</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/powersync.svg">PowerSync</a></div><div><a href="https://beta.tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://beta.tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://beta.tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://beta.tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://beta.tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://beta.tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://beta.tinybase.org/api/persister-automerge"><img width="48" src="https://beta.tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.0.0-beta.15" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://beta.tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://beta.tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
1
+ <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://beta.tinybase.org/guides/releases/#v5-0"><em>NEW!</em> v5.0 release</a> <span id="one-with">&quot;The One You Can Sync&quot;</span></p><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions &amp; ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://beta.tinybase.org/api/persister-browser">storage</a>, <a href="https://beta.tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://beta.tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>; and (<em>new!</em>) <a href="https://beta.tinybase.org/api/persister-partykit-client/">PartyKit</a> and <a href="https://electric-sql.com/">ElectricSQL</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">5.1kB - 12.2kB</a>, no dependencies. <a href="#well-tested-and-documented">100% tested</a>, <a href="https://beta.tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</li></ul><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://beta.tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://beta.tinybase.org/react.svg"> React</a></div><div><a href="https://beta.tinybase.org/api/persister-partykit-client"><img width="48" src="https://beta.tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/turso.svg">Turso</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/powersync.svg">PowerSync</a></div><div><a href="https://beta.tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://beta.tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://beta.tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://beta.tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://beta.tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://beta.tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://beta.tinybase.org/api/persister-automerge"><img width="48" src="https://beta.tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.0.0-beta.16" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://beta.tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://beta.tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
2
2
 
3
3
  ```js
4
4
  const store = createStore()
@@ -247,4 +247,4 @@ export const createShop: typeof createShopDecl = () => {
247
247
  };
248
248
  ```
249
249
 
250
- <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>5.1kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.2kB</em>.</p><p>The optional <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>4.6kB</em>, the auxiliary <a href="https://beta.tinybase.org/api/tools/"><code>tools</code></a> module is <em>11.1kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">store</a></th><td>5.1kB</td><td>12.1kB</td><td>52.3kB</td><td>255.3kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.7kB</td><td>15.3kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/indexes/">indexes</a></th><td>2.0kB</td><td>3.9kB</td><td>17.3kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.8kB</td><td>17.2kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.8kB</td><td>126.0kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.6kB</td><td>3.2kB</td><td>13.5kB</td><td>35.1kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/mergeable-store/">mergeable-store</a></th><td>7.1kB</td><td>17.0kB</td><td>72.2kB</td><td>4.4kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/persisters/">persisters</a></th><td>0.9kB</td><td>1.7kB</td><td>6.2kB</td><td>47.3kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/synchronizers/">synchronizers</a></th><td>1.8kB</td><td>3.7kB</td><td>13.8kB</td><td>3.8kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/common/">common</a></th><td>0.3kB</td><td>0.3kB</td><td>0.7kB</td><td>3.6kB</td></tr><tr><th class="right">tinybase (all)</th><td>12.2kB</td><td>29.9kB</td><td>129.3kB</td><td>0.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,367</td><td>2,367</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,551</td><td>2,551</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>996</td><td>996</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>938</td><td>938</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,714</td></tr><tr><th class="right">Assertions</th><td colspan="3">31,375</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://beta.tinybase.org/youtube.webp"></a></section>
250
+ <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>5.1kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.2kB</em>.</p><p>The optional <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>4.6kB</em>, the auxiliary <a href="https://beta.tinybase.org/api/tools/"><code>tools</code></a> module is <em>11.1kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">store</a></th><td>5.1kB</td><td>12.1kB</td><td>52.3kB</td><td>255.3kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.7kB</td><td>15.3kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/indexes/">indexes</a></th><td>2.0kB</td><td>3.9kB</td><td>17.3kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.8kB</td><td>17.2kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.8kB</td><td>126.0kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.6kB</td><td>3.2kB</td><td>13.5kB</td><td>35.1kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/mergeable-store/">mergeable-store</a></th><td>7.1kB</td><td>17.0kB</td><td>72.2kB</td><td>4.4kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/persisters/">persisters</a></th><td>0.9kB</td><td>1.7kB</td><td>6.2kB</td><td>47.3kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/synchronizers/">synchronizers</a></th><td>1.8kB</td><td>3.7kB</td><td>13.8kB</td><td>3.8kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/common/">common</a></th><td>0.3kB</td><td>0.3kB</td><td>0.7kB</td><td>3.6kB</td></tr><tr><th class="right">tinybase (all)</th><td>12.2kB</td><td>29.9kB</td><td>129.3kB</td><td>0.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,368</td><td>2,368</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,552</td><td>2,552</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>996</td><td>996</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>948</td><td>945</td><td>99.7%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,714</td></tr><tr><th class="right">Assertions</th><td colspan="3">31,375</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://beta.tinybase.org/youtube.webp"></a></section>