tinybase 5.0.0-beta.11 → 5.0.0-beta.12

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,u,l=le)=>{const[,n]=re(),[d,p]=re();return ee((()=>{(async()=>{const t=await s(e);p(t),t&&o&&(async()=>{await o(t),n([])})()})()}),[e,...t,...r]),ee((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),d},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),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);
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",i="Table",a=i+"s",p=i+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,ie=[D,f,([e,s,t],[r,o,l])=>s===o&&f(e,r)&&f(t,l)],ae=(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=ie[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),is=({relationshipId:e,relationships:s,rowComponent:t=xs,getRowComponentProps:r,separator:o,debugIds:l},u,n)=>{const[d,i,a]=Je(K(s),e),p=u(e,n,d);return ps(T(p,(e=>Qe(t,ss(es({},Ue(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),o,l,n)},as=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,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(J(t),e),a=Se(e,s,n);return ps(T(a,(e=>Qe(r,ss(es({},Ue(o,e)),{key:e,tableId:i,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=as((e=>e[0])),gs=as((e=>g(e[1])?[]:[e[1]])),ys=as((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=>is(e,Te,e.firstRowId),exports.LocalRowsView=e=>is(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:i,checkpoints:a,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]),i),null!=a?a:x[10],es(es({},x[11]),p),b,w]),[e,s,I,t,r,o,l,u,n,d,i,a,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),i=Ve(e,s,u);return ps(g(d)||g(i)?null:Qe(r,ss(es({},Ue(o,i)),{key:i,tableId:d,rowId:i,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)=>ae(e,s,t),exports.useCreateIndexes=(e,s,t)=>ae(e,s,t),exports.useCreateMergeableStore=(e,s=ue)=>se(e,s),exports.useCreateMetrics=(e,s,t)=>ae(e,s,t),exports.useCreatePersister=(e,s,t=ue,r,o=ue,l,u=ue)=>{const[,n]=oe(),[d,i]=oe();return ee((()=>{const t=s(e);i(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)=>ae(e,s,t),exports.useCreateRelationships=(e,s,t)=>ae(e,s,t),exports.useCreateStore=(e,s=ue)=>se(e,s),exports.useCreateSynchronizer=(e,s,t=ue,r,o=ue,l,u=ue)=>{const[,n]=oe(),[d,i]=oe();return ee((()=>{$(void 0,null,(function*(){const t=yield s(e);i(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.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,i,t,r,e),exports.useDelTablesCallback=(e,s,t)=>Ce(e,a,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(i,z(s),4,[e]),exports.useHasTableCell=(e,s,t)=>ce(i+b,z(t),4,[e,s]),exports.useHasTableCellListener=(e,s,t,r,o,l)=>xe(n+i+b,z(l),t,r,[e,s],o),exports.useHasTableListener=(e,s,t,r,o)=>xe(n+i,z(o),s,t,[e],r),exports.useHasTables=e=>ce(a,z(e),4,[]),exports.useHasTablesListener=(e,s,t,r)=>xe(n+a,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+i,N(s),0,[e]),exports.useResultTableCellIds=(e,s)=>ce(u+i+w,N(s),1,[e]),exports.useResultTableCellIdsListener=(e,s,t,r)=>xe(u+i+w,N(r),s,t,[e]),exports.useResultTableListener=(e,s,t,r)=>xe(u+i,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,i,s,t,o,l,e),exports.useSetTablesCallback=(e,s,t,r,o)=>Ie(t,a,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(i,z(s),0,[e]),exports.useTableCellIds=(e,s)=>ce(i+w,z(s),1,[e]),exports.useTableCellIdsListener=(e,s,t,r,o)=>xe(i+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(i,z(o),s,t,[e],r),exports.useTables=e=>ce(a,z(e),0),exports.useTablesListener=(e,s,t,r)=>xe(a,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,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);
Binary file
@@ -1293,15 +1293,13 @@ const useCreatePersister = (
1293
1293
  const [persister, setPersister] = useState$2();
1294
1294
  useEffect(
1295
1295
  () => {
1296
- const newPersister = create(store);
1297
- setPersister(newPersister);
1298
- if (newPersister) {
1299
- if (then) {
1300
- (async () => {
1301
- await then(newPersister);
1302
- rerender([]);
1303
- })();
1304
- }
1296
+ const persister2 = create(store);
1297
+ setPersister(persister2);
1298
+ if (persister2 && then) {
1299
+ (async () => {
1300
+ await then(persister2);
1301
+ rerender([]);
1302
+ })();
1305
1303
  }
1306
1304
  },
1307
1305
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1323,28 +1321,19 @@ const useCreateSynchronizer = (
1323
1321
  store,
1324
1322
  create,
1325
1323
  createDeps = EMPTY_ARRAY,
1326
- then,
1327
- thenDeps = EMPTY_ARRAY,
1328
1324
  destroy,
1329
1325
  destroyDeps = EMPTY_ARRAY,
1330
1326
  ) => {
1331
- const [, rerender] = useState$2();
1332
1327
  const [synchronizer, setSynchronizer] = useState$2();
1333
1328
  useEffect(
1334
1329
  () => {
1335
1330
  (async () => {
1336
- const newSynchronizer = await create(store);
1337
- setSynchronizer(newSynchronizer);
1338
- if (newSynchronizer && then) {
1339
- (async () => {
1340
- await then(newSynchronizer);
1341
- rerender([]);
1342
- })();
1343
- }
1331
+ const synchronizer2 = await create(store);
1332
+ setSynchronizer(synchronizer2);
1344
1333
  })();
1345
1334
  },
1346
1335
  // eslint-disable-next-line react-hooks/exhaustive-deps
1347
- [store, ...createDeps, ...thenDeps],
1336
+ [store, ...createDeps],
1348
1337
  );
1349
1338
  useEffect(
1350
1339
  () => () => {
@@ -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",f=m+u,w=e=>null==e,k=(e,t,o)=>w(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=>!w(e)&&k(j(e),(e=>e==L.prototype||w(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 w(e)?r[t]:h(e)?M(null!=(o=r[t+1])?o:{},e):e},W=(e,t)=>{const o=Q(e,t);return w(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)},fe=(e,t,o,r=pe,n=pe,...l)=>ie((()=>me(t,e,...n,o,...l)),[t,e,...n,...r,...l]),we=(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(f,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)=>we(o,c,e,t,r,n),Ue=(e,t,o,r,n,l)=>we(r,i,t,o,n,l,e),Xe=(e,t,o,r,n,l,s)=>we(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)=>we(n,"PartialRow",o,r,l,s,e,t),$e=(e,t,o,r,n,l,s,d)=>we(l,v,r,n,s,d,e,t,o),_e=(e,t,o,r,n)=>we(o,C,e,t,r,n),et=(e,t,o,r,n)=>we(o,"PartialValues",e,t,r,n),tt=(e,t,o,r,n,l)=>we(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)=>fe(d+c,J(r),e,t,[],o),it=(e,t,o,r)=>fe(c,J(r),e,t,pe,o),ct=(e,t,o,r)=>fe(a,J(r),e,t,pe,o),at=(e,t,o,r,n)=>fe(d+i,J(n),t,o,[e],r),It=(e,t,o,r,n)=>fe(i,J(n),t,o,[e],r),pt=(e,t,o,r,n)=>fe(i+y,J(n),t,o,[e],r),bt=(e,t,o,r,n,l)=>fe(d+i+v,J(l),o,r,[e,t],n),gt=(e,t,o,r,n)=>fe(p,J(n),t,o,[e],r),vt=(e,t,o,r,n)=>fe(b,J(n),t,o,[e],r),yt=(e,t,o,r,n,l,s,d,u)=>fe(g,J(u),l,s,[e,t,o,r,n],d),mt=(e,t,o,r,n,l)=>fe(d+I,J(l),o,r,[e,t],n),Ct=(e,t,o,r,n,l)=>fe(I,J(l),o,r,[e,t],n),ft=(e,t,o,r,n,l)=>fe(y,J(l),o,r,[e,t],n),wt=(e,t,o,r,n,l,s)=>fe(d+v,J(s),r,n,[e,t,o],l),kt=(e,t,o,r,n,l,s)=>fe(v,J(s),r,n,[e,t,o],l),ht=(e,t,o,r)=>fe(d+C,J(r),e,t,[],o),Pt=(e,t,o,r)=>fe(C,J(r),e,t,pe,o),Rt=(e,t,o,r)=>fe(f,J(r),e,t,pe,o),xt=(e,t,o,r,n)=>fe(d+m,J(n),t,o,[e],r),qt=(e,t,o,r,n)=>fe(m,J(n),t,o,[e],r),St=(e,t,o)=>fe("Start"+ne,J(o),e,t),Ot=(e,t,o)=>fe("WillFinish"+ne,J(o),e,t),Lt=(e,t,o)=>fe("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)=>fe("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)=>fe("SliceIds",Y(r),t,o,[e]),Wt=(e,t,o,r,n)=>fe("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)=>fe("RemoteRowId",$(n),o,r,[e,t]),Yt=(e,t,o,r,n)=>fe("Local"+b,$(n),o,r,[e,t]),Zt=(e,t,o,r,n)=>fe("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)=>fe(s+i,ee(r),t,o,[e]),ao=(e,t,o,r)=>fe(s+i+y,ee(r),t,o,[e]),Io=(e,t,o,r)=>fe(s+p,ee(r),t,o,[e]),po=(e,t,o,r)=>fe(s+b,ee(r),t,o,[e]),bo=(e,t,o,r,n,l,d,u)=>fe(s+g,ee(u),l,d,[e,t,o,r,n]),go=(e,t,o,r,n)=>fe(s+I,ee(n),o,r,[e,t]),vo=(e,t,o,r,n)=>fe(s+y,ee(n),o,r,[e,t]),yo=(e,t,o,r,n,l)=>fe(s+v,ee(l),r,n,[e,t,o]),mo=(e,t,o)=>ye(e,t,o),Co=()=>z(11),fo=e=>Ce("CheckpointIds",oe(e),2),wo=(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]=fo(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]]=fo(r);return[!w(n),Po(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},So=(e,t,o)=>fe("CheckpointIds",oe(o),e,t),Oo=(e,t,o,r)=>fe("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,l,s=pe)=>{const[,d]=ae(),[u,i]=ae();return de((()=>{le(void 0,null,(function*(){const o=yield 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},{PureComponent:Bo,Fragment:Eo,createElement:To,useCallback:Mo,useLayoutEffect:Fo,useRef:Vo,useState:Ao}=e,Do=(e,...t)=>w(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=wr,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(fo(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=w(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(w(u)||w(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),fr=({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)},wr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=fr,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=wo(t,e))?n:o,void 0,r,t)},Rr=nr((e=>e[0])),xr=nr((e=>w(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,fr as ResultCellView,wr 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,ft as useCellIdsListener,kt as useCellListener,wo as useCheckpoint,fo 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,wt 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",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};
Binary file
@@ -13,7 +13,6 @@
13
13
  * Note that both the client and server parts of this Persister are currently
14
14
  * experimental as PartyKit is new and still maturing.
15
15
  * @see Persisting Data guide
16
- * @see Todo App v6 (collaboration) demo
17
16
  * @packageDocumentation
18
17
  * @module persister-partykit-client
19
18
  * @since 4.3.0
@@ -12,7 +12,6 @@
12
12
  * Note that both the client and server parts of this Persister are currently
13
13
  * experimental as PartyKit is new and still maturing.
14
14
  * @see Persisting Data guide
15
- * @see Todo App v6 (collaboration) demo
16
15
  * @packageDocumentation
17
16
  * @module persister-partykit-server
18
17
  * @since 4.3.0
@@ -3,6 +3,7 @@
3
3
  * MergeableStore data to and from other MergeableStore instances via WebSockets
4
4
  * facilitated by a server.
5
5
  * @see Synchronizing Data guide
6
+ * @see Todo App v6 (collaboration) demo
6
7
  * @packageDocumentation
7
8
  * @module synchronizer-ws-client
8
9
  * @since v5.0.0
@@ -2,6 +2,7 @@
2
2
  * The synchronizer-ws-server module of the TinyBase project lets you create
3
3
  * a server that facilitates synchronization between clients.
4
4
  * @see Synchronizing Data guide
5
+ * @see Todo App v6 (collaboration) demo
5
6
  * @packageDocumentation
6
7
  * @module synchronizer-ws-server
7
8
  * @since v5.0.0
@@ -10247,13 +10247,6 @@ export function useCreatePersister<
10247
10247
  * as you would for any React hook with dependencies. The MergeableStore passed
10248
10248
  * in as the first parameter of this hook is used as a dependency by default.
10249
10249
  *
10250
- * A second callback, called `then`, can be provided as the fourth parameter.
10251
- * This is called after the creation, and can also be asynchronous, so that you
10252
- * can configure the Synchronizer with the startSync method, for example. If
10253
- * this callback contains dependencies, the changing of which should cause the
10254
- * Synchronizer to be reconfigured, you can provide them in an array in the
10255
- * fifth parameter. The Synchronizer itself is used as a dependency by default.
10256
- *
10257
10250
  * The `create` function can return undefined, meaning that you can enable or
10258
10251
  * disable synchronization conditionally within this hook. This is useful for
10259
10252
  * applications which might turn on or off their cloud synchronization or
@@ -10268,11 +10261,6 @@ export function useCreatePersister<
10268
10261
  * @param createDeps An optional array of dependencies for the `create`
10269
10262
  * function, which, if any change, result in its rerun. This parameter defaults
10270
10263
  * to an empty array.
10271
- * @param then An optional callback for performing asynchronous post-creation
10272
- * steps on the Synchronizer, such as starting automatic synchronization.
10273
- * @param thenDeps An optional array of dependencies for the `then` callback,
10274
- * which, if any change, result in its rerun. This parameter defaults to an
10275
- * empty array.
10276
10264
  * @param destroy An optional callback whenever the Synchronizer is destroyed
10277
10265
  * due to a change in the `createDeps` dependencies.
10278
10266
  * @param destroyDeps An optional array of dependencies for the `destroy`
@@ -10319,7 +10307,7 @@ export function useCreatePersister<
10319
10307
  *
10320
10308
  * const App = ({url}) => {
10321
10309
  * const store = useCreateMergeableStore(() => createMergeableStore('s1'));
10322
- * const synchronizer = useCreateSynchronizer(
10310
+ * useCreateSynchronizer(
10323
10311
  * store,
10324
10312
  * async (store) => {
10325
10313
  * const webSocket = new WebSocket(url);
@@ -10327,10 +10315,6 @@ export function useCreatePersister<
10327
10315
  * return await createWsSynchronizer(store, webSocket);
10328
10316
  * },
10329
10317
  * [url],
10330
- * async (synchronizer) => {
10331
- * await synchronizer.startSync();
10332
- * },
10333
- * [],
10334
10318
  * (synchronizer) => {
10335
10319
  * const webSocket = synchronizer.getWebSocket();
10336
10320
  * console.log(`Synchronizer destroyed for ${webSocket.url}`);
@@ -10365,8 +10349,6 @@ export function useCreateSynchronizer<
10365
10349
  store: MergeableStore,
10366
10350
  create: (store: MergeableStore) => Promise<SynchronizerOrUndefined>,
10367
10351
  createDeps?: React.DependencyList,
10368
- then?: (synchronizer: Synchronizer) => Promise<void>,
10369
- thenDeps?: React.DependencyList,
10370
10352
  destroy?: (synchronizer: Synchronizer) => void,
10371
10353
  destroyDeps?: React.DependencyList,
10372
10354
  ): SynchronizerOrUndefined;
@@ -13,7 +13,6 @@
13
13
  * Note that both the client and server parts of this Persister are currently
14
14
  * experimental as PartyKit is new and still maturing.
15
15
  * @see Persisting Data guide
16
- * @see Todo App v6 (collaboration) demo
17
16
  * @packageDocumentation
18
17
  * @module persister-partykit-client
19
18
  * @since 4.3.0
@@ -12,7 +12,6 @@
12
12
  * Note that both the client and server parts of this Persister are currently
13
13
  * experimental as PartyKit is new and still maturing.
14
14
  * @see Persisting Data guide
15
- * @see Todo App v6 (collaboration) demo
16
15
  * @packageDocumentation
17
16
  * @module persister-partykit-server
18
17
  * @since 4.3.0
@@ -3,6 +3,7 @@
3
3
  * MergeableStore data to and from other MergeableStore instances via WebSockets
4
4
  * facilitated by a server.
5
5
  * @see Synchronizing Data guide
6
+ * @see Todo App v6 (collaboration) demo
6
7
  * @packageDocumentation
7
8
  * @module synchronizer-ws-client
8
9
  * @since v5.0.0
@@ -2,6 +2,7 @@
2
2
  * The synchronizer-ws-server module of the TinyBase project lets you create
3
3
  * a server that facilitates synchronization between clients.
4
4
  * @see Synchronizing Data guide
5
+ * @see Todo App v6 (collaboration) demo
5
6
  * @packageDocumentation
6
7
  * @module synchronizer-ws-server
7
8
  * @since v5.0.0
@@ -11675,8 +11675,6 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11675
11675
  * store: MergeableStore,
11676
11676
  * create: (store: MergeableStore) => Promise<SynchronizerOrUndefined>,
11677
11677
  * createDeps?: React.DependencyList,
11678
- * then?: (synchronizer: Synchronizer) => Promise<void>,
11679
- * thenDeps?: React.DependencyList,
11680
11678
  * destroy?: (synchronizer: Synchronizer) => void,
11681
11679
  * destroyDeps?: React.DependencyList,
11682
11680
  * ): SynchronizerOrUndefined;
@@ -11694,13 +11692,6 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11694
11692
  * as you would for any React hook with dependencies. The MergeableStore passed
11695
11693
  * in as the first parameter of this hook is used as a dependency by default.
11696
11694
  *
11697
- * A second callback, called `then`, can be provided as the fourth parameter.
11698
- * This is called after the creation, and can also be asynchronous, so that you
11699
- * can configure the Synchronizer with the startSync method, for example. If
11700
- * this callback contains dependencies, the changing of which should cause the
11701
- * Synchronizer to be reconfigured, you can provide them in an array in the
11702
- * fifth parameter. The Synchronizer itself is used as a dependency by default.
11703
- *
11704
11695
  * The `create` function can return undefined, meaning that you can enable or
11705
11696
  * disable synchronization conditionally within this hook. This is useful for
11706
11697
  * applications which might turn on or off their cloud synchronization or
@@ -11715,11 +11706,6 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11715
11706
  * @param createDeps An optional array of dependencies for the `create`
11716
11707
  * function, which, if any change, result in its rerun. This parameter defaults
11717
11708
  * to an empty array.
11718
- * @param then An optional callback for performing asynchronous post-creation
11719
- * steps on the Synchronizer, such as starting automatic synchronization.
11720
- * @param thenDeps An optional array of dependencies for the `then` callback,
11721
- * which, if any change, result in its rerun. This parameter defaults to an
11722
- * empty array.
11723
11709
  * @param destroy An optional callback whenever the Synchronizer is destroyed
11724
11710
  * due to a change in the `createDeps` dependencies.
11725
11711
  * @param destroyDeps An optional array of dependencies for the `destroy`
@@ -11766,7 +11752,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11766
11752
  *
11767
11753
  * const App = ({url}) => {
11768
11754
  * const store = useCreateMergeableStore(() => createMergeableStore('s1'));
11769
- * const synchronizer = useCreateSynchronizer(
11755
+ * useCreateSynchronizer(
11770
11756
  * store,
11771
11757
  * async (store) => {
11772
11758
  * const webSocket = new WebSocket(url);
@@ -11774,10 +11760,6 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11774
11760
  * return await createWsSynchronizer(store, webSocket);
11775
11761
  * },
11776
11762
  * [url],
11777
- * async (synchronizer) => {
11778
- * await synchronizer.startSync();
11779
- * },
11780
- * [],
11781
11763
  * (synchronizer) => {
11782
11764
  * const webSocket = synchronizer.getWebSocket();
11783
11765
  * console.log(`Synchronizer destroyed for ${webSocket.url}`);
@@ -11814,8 +11796,6 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
11814
11796
  store: MergeableStore<Schemas>,
11815
11797
  ) => Promise<SynchronizerOrUndefined>,
11816
11798
  createDeps?: React.DependencyList,
11817
- then?: (synchronizer: Synchronizer<Schemas>) => Promise<void>,
11818
- thenDeps?: React.DependencyList,
11819
11799
  destroy?: (synchronizer: Synchronizer<Schemas>) => void,
11820
11800
  destroyDeps?: React.DependencyList,
11821
11801
  ) => 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",a=I+"s",l=I+c,i="Row",p=i+"Count",g=i+c,b="Sorted"+i+c,C="Cell",m=C+c,y="Value",w=y+"s",k=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:ae,useState:le,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]=le(),[r,d]=le();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)},we=(e,t,s,r=pe)=>{const d=ae(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)},ke=(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=>we(a,K(e),4,[]),Se=e=>we(a,K(e),0),Le=e=>we(l,K(e),1),Be=(e,t)=>we(I,K(t),4,[e]),Te=(e,t)=>we(I,K(t),0,[e]),Ee=(e,t)=>we(I+m,K(t),1,[e]),Me=(e,t,o)=>we(I+C,K(o),4,[e,t]),Fe=(e,t)=>we(p,K(t),5,[e]),Ve=(e,t)=>we(g,K(t),1,[e]),Ae=(e,t,o,s=0,r,d)=>we(b,K(d),1,[e,t,o,s,r]),Oe=(e,t,o)=>we(i,K(o),4,[e,t]),je=(e,t,o)=>we(i,K(o),0,[e,t]),De=(e,t,o)=>we(m,K(o),1,[e,t]),He=(e,t,o,s)=>we(C,K(s),4,[e,t,o]),Qe=(e,t,o,s)=>we(C,K(s),3,[e,t,o]),We=e=>we(w,K(e),4,[]),ze=e=>we(w,K(e),0),Ge=e=>we(k,K(e),1),Je=(e,t)=>we(y,K(t),4,[e]),Ke=(e,t)=>we(y,K(t),3,[e]),Ne=(e,t,o,s,r)=>he(o,a,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,w,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,a,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,w,t,o),ut=(e,t,o,s)=>Re(t,y,o,s,e),ct=(e,t,o,s)=>ke(u+a,K(s),e,t,[],o),It=(e,t,o,s)=>ke(a,K(s),e,t,pe,o),at=(e,t,o,s)=>ke(l,K(s),e,t,pe,o),lt=(e,t,o,s,r)=>ke(u+I,K(r),t,o,[e],s),it=(e,t,o,s,r)=>ke(I,K(r),t,o,[e],s),pt=(e,t,o,s,r)=>ke(I+m,K(r),t,o,[e],s),gt=(e,t,o,s,r,d)=>ke(u+I+C,K(d),o,s,[e,t],r),bt=(e,t,o,s,r)=>ke(p,K(r),t,o,[e],s),Ct=(e,t,o,s,r)=>ke(g,K(r),t,o,[e],s),mt=(e,t,o,s,r,d,n,u,c)=>ke(b,K(c),d,n,[e,t,o,s,r],u),yt=(e,t,o,s,r,d)=>ke(u+i,K(d),o,s,[e,t],r),wt=(e,t,o,s,r,d)=>ke(i,K(d),o,s,[e,t],r),kt=(e,t,o,s,r,d)=>ke(m,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d,n)=>ke(u+C,K(n),s,r,[e,t,o],d),Rt=(e,t,o,s,r,d,n)=>ke(C,K(n),s,r,[e,t,o],d),ft=(e,t,o,s)=>ke(u+w,K(s),e,t,[],o),qt=(e,t,o,s)=>ke(w,K(s),e,t,pe,o),Pt=(e,t,o,s)=>ke(k,K(s),e,t,pe,o),vt=(e,t,o,s,r)=>ke(u+y,K(r),t,o,[e],s),xt=(e,t,o,s,r)=>ke(y,K(r),t,o,[e],s),St=(e,t,o)=>ke("Start"+de,K(o),e,t),Lt=(e,t,o)=>ke("WillFinish"+de,K(o),e,t),Bt=(e,t,o)=>ke("DidFinish"+de,K(o),e,t),Tt=(e,t,o)=>me(e,t,o),Et=()=>G(3),Mt=e=>we("MetricIds",X(e),1),Ft=(e,t)=>we("Metric",X(t),3,[e]),Vt=(e,t,o,s)=>ke("Metric",X(s),t,o,[e]),At=(e,t,o)=>me(e,t,o),Ot=()=>G(5),jt=(e,t)=>we("SliceIds",Z(t),1,[e]),Dt=e=>we("IndexIds",Z(e),1),Ht=(e,t,o)=>we("Slice"+g,Z(o),1,[e,t]),Qt=(e,t,o,s)=>ke("SliceIds",Z(s),t,o,[e]),Wt=(e,t,o,s,r)=>ke("Slice"+g,Z(r),o,s,[e,t]),zt=(e,t,o)=>me(e,t,o),Gt=()=>G(7),Jt=e=>we("RelationshipIds",_(e),1),Kt=(e,t,o)=>we("RemoteRowId",_(o),3,[e,t]),Nt=(e,t,o)=>we("Local"+g,_(o),1,[e,t]),Ut=(e,t,o)=>we("Linked"+g,_(o),1,[e,t]),Xt=(e,t,o,s,r)=>ke("RemoteRowId",_(r),o,s,[e,t]),Yt=(e,t,o,s,r)=>ke("Local"+g,_(r),o,s,[e,t]),Zt=(e,t,o,s,r)=>ke("Linked"+g,_(r),o,s,[e,t]),$t=(e,t,o)=>me(e,t,o),_t=()=>G(9),eo=e=>we("QueryIds",te(e),1),to=(e,t)=>we(n+I,te(t),0,[e]),oo=(e,t)=>we(n+I+m,te(t),1,[e]),so=(e,t)=>we(n+p,te(t),5,[e]),ro=(e,t)=>we(n+g,te(t),1,[e]),no=(e,t,o,s=0,r,d)=>we(n+b,te(d),1,[e,t,o,s,r]),uo=(e,t,o)=>we(n+i,te(o),0,[e,t]),co=(e,t,o)=>we(n+m,te(o),1,[e,t]),Io=(e,t,o,s)=>we(n+C,te(s),3,[e,t,o]),ao=(e,t,o,s)=>ke(n+I,te(s),t,o,[e]),lo=(e,t,o,s)=>ke(n+I+m,te(s),t,o,[e]),io=(e,t,o,s)=>ke(n+p,te(s),t,o,[e]),po=(e,t,o,s)=>ke(n+g,te(s),t,o,[e]),go=(e,t,o,s,r,d,u,c)=>ke(n+b,te(c),d,u,[e,t,o,s,r]),bo=(e,t,o,s,r)=>ke(n+i,te(r),o,s,[e,t]),Co=(e,t,o,s,r)=>ke(n+m,te(r),o,s,[e,t]),mo=(e,t,o,s,r,d)=>ke(n+C,te(d),s,r,[e,t,o]),yo=(e,t,o)=>me(e,t,o),wo=()=>G(11),ko=e=>we("CheckpointIds",se(e),2),ho=(e,t)=>we("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]=ko(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]]=ko(t);return[!h(s),qo(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},So=(e,t,o)=>ke("CheckpointIds",se(o),e,t),Lo=(e,t,o,s)=>ke("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=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,d,n=pe)=>{const[,u]=le(),[c,I]=le();return ue((()=>{(async()=>{const o=await t(e);I(o),o&&s&&(async()=>{await s(o),u([])})()})()}),[e,...o,...r]),ue((()=>()=>{c&&(c.destroy(),d?.(c))}),[c,...n]),c},{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,a]=Ho(_(t),e),l=n(e,u,c);return Yo(L(l,(e=>Fo(o,{...Do(s,e),key:e,tableId:a,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(ko(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:a,checkpointsById:l,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},a??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,c,I,a,l,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),a=Ht(e,t,u);return Yo(L(a,(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),as=({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=as,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,as as ResultCellView,ls 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,kt as useCellIdsListener,Rt as useCellListener,ho as useCheckpoint,ko as useCheckpointIds,So as useCheckpointIdsListener,Lo as useCheckpointListener,oe as useCheckpoints,wo 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,lt 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,lo as useResultTableCellIdsListener,ao as useResultTableListener,je as useRow,Fe as useRowCount,bt as useRowCountListener,Ve as useRowIds,Ct as useRowIdsListener,wt 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,at 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",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};
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,u,l=ne)=>{const[,n]=ue(),[d,a]=ue();return se((()=>{(async()=>{const t=await s(e);a(t),t&&o&&(async()=>{await o(t),n([])})()})()}),[e,...t,...r]),se((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),d},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),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);
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,r,u=ne)=>{const[,n]=re(),[d,i]=re();return se((()=>{_(void 0,null,(function*(){const t=yield 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.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="",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);
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "5.0.0-beta.11",
3
+ "version": "5.0.0-beta.12",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
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.0kB - 12.1kB</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.11" 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.0kB - 12.1kB</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.12" 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.0kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.1kB</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.0kB</td><td>12.0kB</td><td>52.1kB</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>1.9kB</td><td>3.8kB</td><td>17.1kB</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.3kB</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.0kB</td><td>16.9kB</td><td>72.0kB</td><td>4.5kB</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.3kB</td><td>46.7kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/synchronizers/">synchronizers</a></th><td>2.0kB</td><td>4.2kB</td><td>16.0kB</td><td>3.6kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>12.1kB</td><td>29.9kB</td><td>129.1kB</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,553</td><td>2,553</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>994</td><td>994</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>940</td><td>940</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,617</td></tr><tr><th class="right">Assertions</th><td colspan="3">31,186</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.0kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.1kB</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.0kB</td><td>12.0kB</td><td>52.1kB</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>1.9kB</td><td>3.8kB</td><td>17.1kB</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.3kB</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.0kB</td><td>16.9kB</td><td>72.0kB</td><td>4.5kB</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.3kB</td><td>46.7kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/synchronizers/">synchronizers</a></th><td>2.0kB</td><td>4.2kB</td><td>16.0kB</td><td>3.6kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>12.1kB</td><td>29.9kB</td><td>129.1kB</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,362</td><td>2,362</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,547</td><td>2,547</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>993</td><td>993</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>935</td><td>935</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,616</td></tr><tr><th class="right">Assertions</th><td colspan="3">31,177</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>