tinybase 4.1.0-beta.5 → 4.1.0
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.
- package/lib/cjs/store.cjs +1 -1
- package/lib/cjs/store.cjs.gz +0 -0
- package/lib/cjs/tinybase.cjs +1 -1
- package/lib/cjs/tinybase.cjs.gz +0 -0
- package/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom.cjs +1 -1
- package/lib/cjs/ui-react-dom.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/store.cjs +1 -1
- package/lib/cjs-es6/store.cjs.gz +0 -0
- package/lib/cjs-es6/tinybase.cjs +1 -1
- package/lib/cjs-es6/tinybase.cjs.gz +0 -0
- package/lib/cjs-es6/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/store.js +2 -0
- package/lib/debug/tinybase.js +2 -0
- package/lib/debug/tools.js +28 -0
- package/lib/debug/ui-react-dom.js +51 -25
- package/lib/debug/ui-react.js +8 -1
- package/lib/es6/store.js +1 -1
- package/lib/es6/store.js.gz +0 -0
- package/lib/es6/tinybase.js +1 -1
- package/lib/es6/tinybase.js.gz +0 -0
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/es6/ui-react-dom-debug.js +1 -1
- package/lib/es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/es6/ui-react-dom.js +1 -1
- package/lib/es6/ui-react-dom.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/types/store.d.ts +46 -0
- package/lib/types/tools.d.ts +2 -2
- package/lib/types/with-schemas/store.d.ts +46 -0
- package/lib/types/with-schemas/tools.d.ts +2 -2
- package/lib/ui-react-dom.js +1 -1
- package/lib/ui-react-dom.js.gz +0 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/store.js +1 -1
- package/lib/umd/store.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd/ui-react-dom-debug.js +1 -1
- package/lib/umd/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd/ui-react-dom.js +1 -1
- package/lib/umd/ui-react-dom.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/store.js +1 -1
- package/lib/umd-es6/store.js.gz +0 -0
- package/lib/umd-es6/tinybase.js +1 -1
- package/lib/umd-es6/tinybase.js.gz +0 -0
- package/lib/umd-es6/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom-debug.js +1 -1
- package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom.js +1 -1
- package/lib/umd-es6/ui-react-dom.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +7 -7
- package/readme.md +13 -13
package/lib/umd-es6/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,l="tinybase",a="",n=",",o=t(a),d=t(!0),r=t(0),s="type",I="default",c="Listener",u="get",i="add",$="Ids",p="Table",b=p+"s",C=p+$,h="Row",m=h+$,f="Sorted"+h+$,g="Cell",w=g+$,y="Value",T=y+"s",v=y+$,V=isFinite,x=(e,t)=>e instanceof t,R=e=>null==e,k=e=>e==o||e==d,P=e=>t(e)==o,S=e=>Array.isArray(e),A=e=>{const l=t(e);return k(l)||l==r&&V(e)?l:void 0},O=(e,t)=>e.every(t),E=(e,t)=>e.sort(t),D=(e,t)=>e.forEach(t),j=(e,t=a)=>e.join(t),N=(e,t)=>e.map(t),L=e=>e.length,G=(e,t)=>e.filter(t),M=(e,...t)=>e.push(...t),J=e=>e.pop(),z=(e,...t)=>e.unshift(...t),W=e=>e.shift(),B=Object,F=B.keys,U=B.freeze,_=e=>x(e,B)&&e.constructor==B,Z=(e,t)=>N(B.entries(e),(([e,l])=>t(l,e))),H=e=>L(F(e)),Q=e=>_(e)&&0==H(e),q=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},K=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},X=(e,t)=>null==e?void 0:e.forEach(t),Y=(e,t)=>null==e?void 0:e.delete(t),ee=e=>new Map(e),te=(e,t)=>null==e?void 0:e.get(t),le=(e,t)=>X(e,((e,l)=>t(l,e))),ae=(e,t)=>{var l;return N([...null!=(l=null==e?void 0:e.entries())?l:[]],(([e,l])=>t(l,e)))},ne=(e,t,l)=>R(l)?(Y(e,t),e):null==e?void 0:e.set(t,l),oe=(e,t,l)=>(q(e,t)||ne(e,t,l()),te(e,t)),de=e=>e.toUpperCase(),re=e=>e.toLowerCase(),se="a ",Ie="A function for",ce=", and registers a listener so that any changes to that result will cause a re-render",ue="Callback",ie="Del",$e="Deps",pe=$e+"?: React.DependencyList",be="doRollback?: DoRollback",Ce="actions: () => Return, "+be,he="export",me="Id",fe="Invalid",ge="Json",we=re(c),ye="?: ",Te=" | undefined",ve="NonNullable",Ve="Partial",xe="Props",Re="Provider",ke=`Registers a ${we} that will be called`,Pe="Represents",Se="rowId: "+me,Ae="Schema",Oe="Set",Ee=", descending?: boolean, offset?: number, limit?: number",De="[]",je="the Store",Ne="Transaction",Le=Ne+"Changes",Ge=re(Ne),Me="Execute a "+Ge+" to make multiple mutations",Je="Explicitly starts a "+Ge,ze="Explicitly finishes a "+Ge,We="the end of the "+Ge,Be="void",Fe=" => "+Be,Ue="WhenSet",_e=" when setting it",Ze=se+"string serialization of",He=" ",Qe="Gets a callback that can ",qe="the ",Ke=" the schema for",Xe=(e=0,t=0)=>`the ${Ct[e]}content of`+(t?He+je:a),Ye=(e=0,t,l=0)=>$t[t]+He+Xe(e,1)+(l?" when setting it":a),et=(e,t=0)=>Pe+` a Row when ${t?"s":"g"}etting ${Xe()} the '${e}' `+p,tt=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,lt=(e,t)=>`Calls a function for each ${e} in `+t,at=e=>"The props passed to a component that renders "+e,nt=e=>"A function that takes "+e,ot=(e,t=0)=>Ie+" listening to changes to "+bt[e]+" in "+bt[t],dt=(e,t,l=0)=>ke+" whenever "+bt[e]+" in "+bt[t]+" change"+(l?a:"s"),rt=e=>`the '${e}' `+p,st=e=>"the specified Row in "+rt(e),It=(e,t=0)=>$t[t]+` ${Xe()} `+rt(e),ct=(e,t=0)=>$t[t]+` ${Xe()} `+st(e),ut=(e,t,l=0)=>$t[l]+` the '${t}' Cell for `+st(e),it=(e,t=0)=>$t[t]+` the '${e}' Value`,$t=["Gets","Checks existence of","Sets","Deletes","Sets part of",Pe,"Gets "+Ze,"Sets "+Ze,ke+" whenever",Qe+"set",Qe+"add",Qe+"set part of",Qe+"delete","Renders","Gets "+Ze+Ke,"Sets"+Ke,"Deletes"+Ke],pt=[u,"has","set","del","set","forEach",i,a],bt=[je,b,qe+p+He+$,se+p,qe+h+He+$,se+h,qe+g+He+$,se+g,"invalid Cell changes",T,qe+y+He+$,se+y,"invalid Value changes",qe+"sorted "+h+He+$,qe+g+He+$+" anywhere"],Ct=[a,"tabular ","keyed value "],ht=e=>new Set(S(e)||R(e)?e:[e]),mt=(e,t)=>null==e?void 0:e.add(t),ft=/[^A-Za-z]+/,gt=/[^A-Za-z0-9]+/,wt=/^( *)\/\*\* *(.*?) *\*\/$/gm,yt=(e,t,l)=>e.substring(t,l),Tt=e=>e.includes(n),vt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return q(e,n)?vt(e,t,l,a+1):(ne(e,n,l),n)},Vt=e=>e.replace(wt,((e,t,l)=>{const a=77-xt(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),xt=e=>e.length,Rt=e=>e.flat(1e3),kt=(e,t=0)=>j(N(e.split(gt),((e,l)=>(l>0||t?de:re)(yt(e,0,1))+yt(e,1)))),Pt=e=>de(j((e&&!ft.test(e[0])?e:" "+e).split(gt),"_")),St=e=>`/** ${e}. */`,At=(...e)=>j(G(e,(e=>e)),", "),Ot=(...e)=>"{"+j(e,"; ")+"}",Et=(...e)=>Ot(...N(e,(e=>"readonly "+e))),Dt=()=>{const e=[ee(),ee(),ee(),ee()],t=ee(),l=ee(),n=e=>{const t=e.indexOf(" as ");return-1!=t?e.substring(t+4):e};return[(...e)=>j(Rt(e),"\n"),(t,l,...a)=>D(a,(a=>D([0,1],(n=>(null!=t?t:n)==n?mt(oe(e[n],l,ht),a):0)))),(e,l,n,o=a,d=1)=>vt(t,e,[l,n,o,d]),(e,t,a)=>vt(l,e,S(a)?[`(${t}) => {`,a,"}"]:[`(${t}) => ${a}`]),(e,t)=>te(l,e)===t?e:vt(l,e,t),(t=0)=>N([...E(ae(e[t],((e,t)=>`import {${j(E(K(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>Tt(e)!=Tt(t)?Tt(e)?-1:1:e>t?1:-1)),a],(e=>e.replace("{React}","React"))),()=>ae(t,(([e,t,l,n],o)=>[St(t),`${n?he+" ":a}type ${o}${l} = ${e};`,a])),()=>ae(l,((e,t)=>(e=S(e)?e:[e],M(e,J(e)+";"),[`const ${t} = ${W(e)}`,e,a])))]},jt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Nt=(e,t,l)=>[t=>Z(e,((e,a)=>t(a,kt(a,1),l(Pt(a),`'${a}'`)))),(t,a)=>Z(e[t],((e,t)=>a(t,e[s],e[I],l(Pt(t),`'${t}'`),kt(t,1)))),e=>Z(t,((t,a)=>e(a,t[s],t[I],l(Pt(a),`'${a}'`),kt(a,1))))],Lt=(e,t,l,n)=>[(n,o)=>{const d=n+": "+o,r=e(b,Ot(...t((e=>`'${e}'?: {[rowId: Id]: `+Ot(...l(e,((e,t,l)=>`'${e}'${R(l)?"?":a}: ${t}`)))+"}"))),Ye(1,5)),s=e(b+Ue,Ot(...t((e=>`'${e}'?: {[rowId: Id]: `+Ot(...l(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),Ye(1,5,1)),I=e(p+me,"keyof "+r,"A "+p+" Id in "+je),u=`<TId extends ${I}>`,i=e(p,ve+`<${r}[TId]>`,"A "+p+" in "+je,u),$=e(p+Ue,ve+`<${s}[TId]>`,"A "+p+" in "+je+_e,u),y=e(h,i+"<TId>[Id]","A "+h+" in a "+p,u),T=e(h+Ue,$+"<TId>[Id]","A "+h+" in a "+p+_e,u),v=e(g+me,`Extract<keyof ${y}<TId>, Id>`,"A "+g+" Id in a "+h,u),V=e(g,ve+`<${r}[TId]>[Id][CId]`,"A "+g+" in a "+h,`<TId extends ${I}, CId extends ${v}<TId>>`),x=e("CellIdCellArray",`CId extends ${v}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,g+" Ids and types in a "+h,`<TId extends ${I}, CId = ${v}<TId>>`,0),k=e(g+ue,`(...[cellId, cell]: ${x}<TId>)`+Fe,nt(se+g+" Id, and "+g),u),P=e(h+ue,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Fe+") "+Fe,nt(se+h+" Id, and a "+g+" iterator"),u),S=e(p+g+ue,`(cellId: ${v}<TId>, count: number) `+Fe,nt(se+g+" Id, and count of how many times it appears"),u),A=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${P}<TId>)${Fe}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),O=e(p+ue,`(...[tableId, forEachRow]: ${A})`+Fe,nt(se+p+" Id, and a "+h+" iterator"),a),E=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${v}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${E}) => CellChange`,Ie+" returning information about any Cell's changes during a "+Ge),j=e(b+c,`(${d}, getCellChange: ${D}${Te})`+Fe,ot(1)),N=e(C+c,`(${d})`+Fe,ot(2)),L=e(p+c,`(${d}, tableId: ${I}, getCellChange: ${D}${Te})`+Fe,ot(3)),G=e(p+w+c,`(${d}, tableId: ${I})`+Fe,ot(14,3)),M=e(m+c,`(${d}, tableId: ${I})`+Fe,ot(4,3)),J=e(f+c,"("+At(d,"tableId: "+I,"cellId: Id"+Te,"descending: boolean","offset: number","limit: number"+Te,"sortedRowIds: Ids")+")"+Fe,ot(13,3)),z=e(h+c,"("+At(""+d,"tableId: "+I,Se,`getCellChange: ${D}${Te}`)+")"+Fe,ot(5,3)),W=e(w+c,"("+At(""+d,"tableId: "+I,Se)+")"+Fe,ot(6,5)),B=e("CellListenerArgsArrayInner",`CId extends ${v}<TId> ? [${d}, tableId: TId, ${Se}, cellId: CId, newCell: ${V}<TId, CId> ${Te}, oldCell: ${V}<TId, CId> ${Te}, getCellChange: ${D} ${Te}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${v}<TId>>`,0),F=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+B+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[r,s,I,i,$,y,T,v,V,k,P,S,O,j,N,L,G,M,J,z,W,e(g+c,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${F})`+Fe,ot(7,5)),e(fe+g+c,`(${d}, tableId: Id, ${Se}, cellId: Id, invalidCells: any[])`+Fe,ot(8))]},(t,l)=>{const o=t+": "+l,d=e(T,Ot(...n(((e,t,l)=>`'${e}'${R(l)?"?":a}: ${t}`))),Ye(2,5)),r=e(T+Ue,Ot(...n(((e,t)=>`'${e}'?: ${t}`))),Ye(2,5,1)),s=e(y+me,"keyof "+d,"A "+y+" Id in "+je),I=e(y,ve+`<${d}[VId]>`,"A "+y+" Id in "+je,`<VId extends ${s}>`),u=e("ValueIdValueArray",`VId extends ${s} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+je,`<VId = ${s}>`,0),i=e(y+ue,`(...[valueId, value]: ${u})`+Fe,nt(se+y+" Id, and "+y)),$=e("GetValueChange",`(valueId: ${s}) => ValueChange`,Ie+" returning information about any Value's changes during a "+Ge),p=e(T+c,`(${o}, getValueChange: ${$}${Te})`+Fe,ot(9)),b=e(v+c,`(${o})`+Fe,ot(10)),C=e("ValueListenerArgsArray",`VId extends ${s} ? [${o}, valueId: VId, newValue: ${I}<VId> ${Te}, oldValue: ${I}<VId> ${Te}, getValueChange: ${$} ${Te}] : never`,"Value args for ValueListener",`<VId = ${s}>`,0);return[d,r,s,I,i,p,b,e(y+c,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+Fe,ot(11)),e(fe+y+c,`(${o}, valueId: Id, invalidValues: any[])`+Fe,ot(12))]},(t,l)=>e(Ne+c,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+Fe,Ie+" listening to the completion of a "+Ge)],Gt=(e,t=a,l=a)=>`store.${e}(${t})`+(l?" as "+l:a),Mt=(e,t=a)=>`fluent(() => ${Gt(e,t)})`,Jt=(e,t=a,l=a)=>`store.${e}(${t?t+", ":a}proxy(listener)${l?", "+l:a})`,zt=(e,t,n)=>{const[o,r,u,V,x,k,S,A]=Dt(),[O,E,N]=Nt(e,t,x),[L,G,J]=Lt(u,O,E,N),W=ee(),B=(e=0)=>ae(W,(([t,l,n,o,d],r)=>{const s=e?[r+`: ${d}(${t}): ${l} => ${n},`]:[r+d+`(${t}): ${l};`];return e||z(s,St(o)),M(s,a),s})),F=(e,t,l,n,o,d=a)=>vt(W,e,[t,l,n,o,d]),U=(e,t,l,n,o,d=a,r=a,s=a)=>F(pt[e]+t+(4==e?Ve:a)+l,d,n,(n==H?Mt:Gt)(pt[e]+(4==e?Ve:a)+l,r,e?void 0:n),o,s),_=(e,t,l,n=a,o=a,d=1,r=a)=>F(i+e+c,(n?n+", ":a)+we+": "+t+(d?", mutator?: boolean":a),me,Jt(i+e+c,o,d?"mutator":a),l,r),Z=`./${kt(n)}.d`,H=kt(n,1),q=kt(H),X=[],Y=ee();let oe=[],de=[];if(r(1,Z,H,`create${H} as create${H}Decl`),Q(e))r(null,l,b);else{r(0,l,"CellChange"),r(null,l,$);const[e,t,n,o,c,i,y,T,v,V,k,S,A,N,G,J,z,W,B,F,Q,le,ae]=L(q,H),de=ee();O(((e,t)=>{const l=`<'${e}'>`,a=[u(t+p,o+l,Pe+` the '${e}' `+p),u(t+p+Ue,c+l,Pe+` the '${e}' `+p+_e),u(t+h,i+l,et(e)),u(t+h+Ue,y+l,et(e,1)),u(t+g+me,T+l,`A Cell Id for the '${e}' `+p),u(t+g+ue,V+l,nt(`a Cell Id and value from a Row in the '${e}' `+p)),u(t+h+ue,k+l,nt(`a Row Id from the '${e}' Table, and a Cell iterator`)),u(t+p+g+ue,S+l,nt(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];ne(de,e,a),r(1,Z,...a)})),r(1,Z,e,t,n,T,A,N,G,J,z,W,B,F,Q,le,ae),oe=[e,t,n,T,N,G,J,z,W,B,F,Q,le,de],D([[e],[d],[H,"tables: "+t,"tables"],[H]],(([e,t,l],n)=>U(n,a,b,e,Ye(1,n),t,l))),U(0,a,C,n+De,tt(p,je)),U(5,a,p,Be,lt(p,je),"tableCallback: "+A,"tableCallback as any"),O(((e,t,l)=>{const[n,o,r,s,I,c,u,i]=te(de,e);D([[n],[d],[H,"table: "+o,", table"],[H]],(([n,o,d=a],r)=>U(r,t,p,n,It(e,r),o,l+d))),U(0,t,p+w,$,tt(g,"the whole of "+rt(e)),a,l),U(5,t,p+g,Be,lt(p+g,"the whole of "+rt(e)),"tableCellCallback: "+i,l+", tableCellCallback as any"),U(0,t,m,$,tt(h,rt(e)),a,l),U(0,t,f,$,tt(h,rt(e),1),"cellId?: "+I+Ee,l+", cellId, descending, offset, limit"),U(5,t,h,Be,lt(h,rt(e)),"rowCallback: "+u,l+", rowCallback as any"),D([[r],[d],[H,", row: "+s,", row"],[H],[H,", partialRow: "+s,", partialRow"]],(([n,o=a,d=a],r)=>U(r,t,h,n,ct(e,r),Se+o,l+", rowId"+d))),U(6,t,h,me+Te,"Add a new Row to "+rt(e),"row: "+s+", reuseIds?: boolean",l+", row, reuseIds"),U(0,t,w,I+De,tt(g,st(e)),Se,l+", rowId"),U(5,t,g,Be,lt(g,st(e)),Se+", cellCallback: "+c,l+", rowId, cellCallback as any"),E(e,((n,o,r,s,I)=>{const c="Map"+kt(o,1);ne(Y,o,c);const u=o+(R(r)?Te:a);D([[u],[d],[H,`, cell: ${o} | `+c,", cell as any"],[H]],(([o,d=a,r=a],c)=>U(c,t+I,g,o,ut(e,n,c),Se+d,l+", rowId, "+s+r))),U(1,t+I,p+g,d,$t[1]+` the '${n}' Cell anywhere in `+rt(e),a,l+", "+s)}))})),U(0,a,b+ge,ge,Ye(1,6)),U(2,a,b+ge,H,Ye(1,7),"tablesJson: "+ge,"tables"+ge),_(b,N,Ye(1,8)+" changes"),_(C,G,dt(2,0,1)),_(p,J,dt(3,0),`tableId: ${n} | null`,"tableId"),_(p+w,z,dt(14,3,1),`tableId: ${n} | null`,"tableId"),_(m,W,dt(4,3,1),`tableId: ${n} | null`,"tableId"),_(f,B,dt(13,3,1),At("tableId: TId",`cellId: ${T}<TId>`+Te,"descending: boolean","offset: number","limit: number"+Te),At("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(h,F,dt(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(w,Q,dt(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(g,le,dt(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${j(O((e=>{var t,l;return null!=(l=null==(t=te(de,e))?void 0:t[4])?l:a}))," | ")} | null`,"tableId, rowId, cellId"),_(fe+g,ae,ke+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),r(1,Z,...K(Y)),M(X,".set"+b+Ae+"({",Rt(O(((e,t,l)=>[`[${l}]: {`,...E(e,((e,t,l,n)=>`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(l)?a:`, [${x(Pt(I),`'${I}'`)}]: `+(P(l)?x(Pt(l),`'${l}'`):l)}},`)),"},"]))),"})")}if(Q(t))r(null,l,T);else{const[e,t,n,o,c,u,i,$,p]=G(q,H);r(1,Z,e,t,n,c,u,i,$,p),de=[e,t,n,u,i,$],D([[e],[d],[H,"values: "+t,"values"],[H],[H,"partialValues: "+t,"partialValues"]],(([e,t,l],n)=>U(n,a,T,e,Ye(2,n),t,l))),U(0,a,v,n+De,tt(y,je)),U(5,a,y,"void",lt(y,je),"valueCallback: "+c,"valueCallback as any"),N(((e,t,l,n,o)=>{const r="Map"+kt(t,1);ne(Y,t,r),D([[t],[d],[H,`value: ${t} | `+r,", value as any"],[H]],(([t,l,d=a],r)=>U(r,o,y,t,it(e,r),l,n+d)))})),U(0,a,T+ge,ge,Ye(2,6)),U(2,a,T+ge,H,Ye(2,7),"valuesJson: "+ge,"values"+ge),_(T,u,Ye(2,8)+" changes"),_(v,i,dt(10,0,1)),_(y,$,dt(11,0),`valueId: ${n} | null`,"valueId"),_(fe+y,p,ke+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),r(1,Z,...K(Y)),r(0,l,"ValueChange"),M(X,".set"+T+Ae+"({",N(((e,t,l,n)=>[`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(l)?a:`, [${x(Pt(I),`'${I}'`)}]: `+(P(l)?x(Pt(l),`'${l}'`):l)}},`])),"})")}U(0,a,"Content",`[${b}, ${T}]`,Ye(0,0)),U(2,a,"Content",H,Ye(0,2),`[tables, values]: [${b}, ${T}]`,"[tables, values]"),U(2,a,Le,H,`Applies a set of ${Le} to the Store`,"transactionChanges: "+Le,"transactionChanges"),le(Y,((e,t)=>u(t,`(cell: ${e}${Te}) => `+e,`Takes a ${e} Cell value and returns another`))),r(null,l,"DoRollback",me,"IdOrNull",ge,"Store",Le),r(0,l,"Get"+Le,"GetTransactionLog"),U(0,a,ge,ge,Ye(0,6)),U(2,a,ge,H,Ye(0,7),"tablesAndValuesJson: "+ge,"tablesAndValuesJson"),U(7,a,Ge,"Return",Me,Ce,"actions, doRollback","<Return>"),U(7,a,"start"+Ne,H,Je),U(7,a,"finish"+Ne,H,ze,be,"doRollback");const re=J(q,H);return _("Start"+Ne,re,ke+" just before the start of the "+Ge,a,a,0),_("WillFinish"+Ne,re,ke+" just before "+We,a,a,0),_("DidFinish"+Ne,re,ke+" just after "+We,a,a,0),U(7,a,"call"+c,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,a,c,H,"Remove a listener that was previously added to "+je,"listenerId: Id","listenerId"),F("getStore",a,"Store","store",$t[0]+" the underlying Store object"),r(1,l,"createStore"),r(1,Z,H,`create${H} as create${H}Decl`,re),x("store",["createStore()",...X]),V("fluent","actions: () => Store",["actions();",`return ${q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),x(q,["{",...B(1),"}"]),[o(...k(0),...S(),he+" interface "+H+" {",...B(0),"}",a,St(`Creates a ${H} object`),he+" function create"+H+"(): "+H+";"),o(...k(1),he+" const create"+H+": typeof create"+H+"Decl = () => {",...A(),`return Object.freeze(${q});`,"};"),oe,de]},Wt=e=>u+e,Bt=e=>At(Wt(e),Wt(e)+$e),Ft="debugIds?: boolean",Ut="debugIds={debugIds}",_t="then"+pe,Zt="Parameter",Ht=": (parameter: "+Zt+", store: Store) => ",Qt="const contextValue = useContext(Context);",qt=", based on a parameter",Kt=": ",Xt="<"+Zt+",>",Yt=Zt+"ized"+ue+"<"+Zt+">",el="rowId",tl="rowId={rowId}",ll=", separator, debugIds",al="separator?: ReactElement | string",nl="then?: (store: Store",ol=At(nl+")"+Fe,_t),dl="then, then"+$e,rl=el+Kt+me,sl="View",Il=(e,...t)=>At(...t,we+": "+e,we+pe,"mutator?: boolean"),cl=(...e)=>At(...e,we,we+$e,"mutator"),ul=(e,t,n,o,d)=>{const[r,s,I,u,i,V,x,k]=Dt(),[P,S,A]=Nt(e,t,i),O=`./${kt(n)}.d`,E=`./${kt(n)}-ui-react.d`,D="tinybase/ui-react",N=kt(n,1),L=kt(N),G=N+"Or"+N+me,J=L+"Or"+N+me,W=L+`={${L}}`,B=ee(),F=(e,t,l,n,o,d=a)=>(s(1,E,e+" as "+e+"Decl"),vt(B,e,[t,l,n,o,d])),U=(e,t,l,n,o,d=a)=>F("use"+e,t,l,n,o,d),_=(e,t,l,n,o=a,d=a,r=a,I=a,c=a)=>(s(1,D,`use${t} as use${t}Core`),U(e,At(o,X,I),l,le+`(${J}, use${t}Core, [`+(d||a)+(c?"], ["+c:a)+"]);",n,r)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>ae(B,(([t,l,n,o,d],r)=>{const s=e?[he+` const ${r}: typeof ${r}Decl = ${d}(${t}): ${1==l?"any":l} =>`,n]:[he+` function ${r}${d}(${t}): ${1==l?"ComponentReturnType":l};`];return e||z(s,St(o)),M(s,a),s}));s(null,l,me,"Store",ue,Zt+"ized"+ue),s(0,D,"ComponentReturnType"),s(1,D,"useCellIds"),s(null,D,"ExtraProps"),s(0,O,N);const q=I(G,N+" | "+me,`Used when you need to refer to a ${N} in a React hook or component`),K=I(Re+xe,Et(L+ye+N,L+`ById?: {[${L}Id: Id]: ${N}}`),`Used with the ${Re} component, so that a `+N+" can be passed into the context of an application");s(0,"react","ReactElement","ComponentType"),s(1,"react","React"),s(1,E,q,K);const X=J+ye+q;i("{createContext, useContext, useMemo}","React"),i("Context",`createContext<[${N}?, {[${L}Id: Id]: ${N}}?]>([])`),U("Create"+N,`create: () => ${N}, create`+pe,N,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${N} within a React application with convenient memoization`);const Y=U(N,"id?: Id",N+Te,["{",Qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${N} from within a ${Re} component context`),le=u("useHook",J+`: ${q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${L} = ${Y}(${J} as Id);`,`return hook(...preParams, ((${J} == null || typeof ${J} == 'string')`,`? ${L} : ${J})?.getStore(), ...postParams)`]),ne=u("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=u("wrap",At("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=u("useCustomOrDefaultCellIds",At("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${J}?: ${q} | undefined`),[`const defaultCellIds = ${le}(${J}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),re=i("NullComponent","() => null");if(!Q(e)){const[e,t,n,d,r,i,y,T,v,V,x,k,A,D]=o;s(null,O,e,t,n,r,i,y,T,v,V,x,k,A),s(0,O,d),s(1,O,N),s(null,l,$,"IdOrNull");const G=u("tableView",`{${L}, rowComponent, getRowComponentProps, customCellIds`+ll+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+ne+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",tl,"customCellIds={customCellIds}",W,Ut,"/>","))",ll,", tableId,",");"]),M=u("getDefaultTableComponent","tableId: Id",j(P(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+re),J=u("getDefaultCellComponent","tableId: Id, cellId: Id",j(P(((e,t,l)=>`tableId == ${l} ? ${j(S(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+re} : `)))+re);_(b,b,e,Ye(1,0)+ce);const z=_(C,C,n+De,tt(p,je)+ce);_(Oe+b+ue,Oe+b+ue,Yt,Ye(1,9)+qt,At(Wt(b)+Ht+t,Wt(b)+pe),Bt(b),Xt,At(nl,`tables: ${t})`+Fe,_t),dl),_(ie+b+ue,ie+b+ue,ue,Ye(1,12),a,a,a,ol,dl);const B=I(g+xe,Et("tableId?: TId","rowId: Id","cellId?: CId",L+ye+N,Ft),at(se+g),`<TId extends ${n}, CId extends ${d}<TId>>`),F=I(h+xe,Et("tableId?: TId","rowId: Id",L+ye+N,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${B}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,`customCellIds?: ${d}<TId>[]`,al,Ft),at(se+h),`<TId extends ${n}>`),U=I(p+xe,Et("tableId?: TId",L+ye+N,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",al,Ft),at(se+p),`<TId extends ${n}>`),H=I("Sorted"+p+xe,Et("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",L+ye+N,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",al,Ft),at(se+"sorted "+p),`<TId extends ${n}>`),Q=I(b+xe,Et(L+ye+N,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${U}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,al,Ft),at(Xe(1,1)));s(1,E,Q,U,H,F,B),Z(b+sl,"{"+L+", tableComponents, getTableComponentProps"+ll+"}: "+Q,[oe+`(${z}(${L}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+M+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ne}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",W,Ut,"/>;","}), separator)"],Ye(1,13)+ce),P(((e,t,l)=>{const[n,o,d,r,I]=te(D,e);s(null,O,n,o,d,r,I),_(t+p,p,n,It(e)+ce,a,l),_(t+p+w,p+w,$,tt(g,"the whole of "+rt(e))+ce,a,l);const c=_(t+m,m,$,tt(h,rt(e))+ce,a,l),u=_(t+f,f,$,tt(h,rt(e),1)+ce,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",l+", cellId, descending, offset, limit");_(t+h,h,d,ct(e)+ce,rl,At(l,el)),_(t+w,w,I+De,tt(g,st(e))+ce,rl,At(l,el)),_(Oe+t+p+ue,Oe+p+ue,Yt,It(e,9)+qt,At(Wt(p)+Ht+o,Wt(p)+pe),At(l,Bt(p)),Xt,At(nl,`table: ${o})`+Fe,_t),dl),_(ie+t+p+ue,ie+p+ue,ue,It(e,12),a,l,a,ol,dl),_(Oe+t+h+ue,Oe+h+ue,Yt,ct(e,9)+qt,At(rl,Wt(h)+Ht+r,Wt(h)+pe),At(l,el,Bt(h)),Xt,At(nl,`row: ${r})`+Fe,_t),dl),_("Add"+t+h+ue,"Add"+h+ue,Yt,ct(e,10)+qt,At(Wt(h)+Ht+r,Wt(h)+pe),At(l,Bt(h)),Xt,"then?: ("+At(rl+Te,"store: Store","row: "+r+")"+Fe,"then"+pe)+", reuseRowIds?: boolean",dl+", reuseRowIds"),_(Oe+t+Ve+h+ue,Oe+Ve+h+ue,Yt,ct(e,11)+qt,At(rl,Wt(Ve+h)+Ht+r,Wt(Ve+h)+pe),At(l,el,Bt(Ve+h)),Xt,At(nl,`partialRow: ${r})`+Fe,_t),dl),_(ie+t+h+ue,ie+h+ue,ue,ct(e,12),rl,At(l,el),a,ol,dl);const i=Z(t+h+sl,"{rowId, "+L+", cellComponents, getCellComponentProps, customCellIds"+ll+`}: ${F}<'${e}'>`,[oe+`(${de}(customCellIds, `+l+`, rowId, ${L}).map((cellId: ${I}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+J+`(${l}, cellId)) as React.ComponentType<CellProps<typeof `+l+", typeof cellId>>;","return <Cell",`{...${ne}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${l}}`,tl,"cellId={cellId}",W,Ut,"/>;","})"+ll+", rowId)"],ct(e,13)+ce);Z(t+"Sorted"+p+sl,"{cellId, descending, offset, limit, ...props}: "+H+`<'${e}'>`,G+"(props, "+u+`(cellId, descending, offset, limit, props.${L}), ${l}, ${i});`,It(e,13)+", sorted"+ce),Z(t+p+sl,`props: ${U}<'${e}'>`,G+"(props, "+c+`(props.${L}), ${l}, ${i});`,It(e,13)+ce),S(e,((n,o,d,r,I)=>{const c="Map"+kt(o,1);s(0,O,c),s(1,O,c);const u=_(t+I+g,g,o+(R(d)?Te:a),ut(e,n)+ce,rl,At(l,el,r));_(Oe+t+I+g+ue,Oe+g+ue,Yt,ut(e,n,9)+qt,At(rl,Wt(g)+Ht+o+" | "+c,Wt(g)+pe),At(l,el,r,Bt(g)),Xt,At(nl,`cell: ${o} | ${c})`+Fe,_t),dl),_(ie+t+I+g+ue,ie+g+ue,ue,ut(e,n,12),At(rl,"forceDel?: boolean"),At(l,el,r,"forceDel"),a,ol,dl),Z(t+I+g+sl,`{rowId, ${L}, debugIds}: `+B+`<'${e}', '${n}'>`,[oe+`('' + ${u}(rowId, `+L+`) ?? '', undefined, debugIds, ${r})`],ut(e,n,13)+ce)}))}));const q=j(P((e=>{var t,l;return null!=(l=null==(t=te(D,e))?void 0:t[4])?l:a}))," | ");_(b+c,b+c,Be,Ye(1,8)+" changes",Il(r),cl()),_(C+c,C+c,Be,dt(2,0,1),Il(i),cl()),_(p+c,p+c,Be,dt(3,0),Il(y,`tableId: ${n} | null`),cl("tableId")),_(p+w+c,p+w+c,Be,dt(14,3,1),Il(T,`tableId: ${n} | null`),cl("tableId")),_(m+c,m+c,Be,dt(4,3,1),Il(v,`tableId: ${n} | null`),cl("tableId")),_(f+c,f+c,Be,dt(13,3,1),Il(V,`tableId: ${n} | null`,"cellId: "+q+Te,"descending: boolean","offset: number","limit: number"+Te),cl("tableId","cellId","descending","offset","limit")),_(h+c,h+c,Be,dt(5,3),Il(x,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(w+c,w+c,Be,dt(6,5,1),Il(k,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(g+c,g+c,Be,dt(7,5),Il(A,`tableId: ${n} | null`,el+": IdOrNull",`cellId: ${q} | null`),cl("tableId",el,"cellId"))}if(!Q(t)){const[e,t,l,n,o,r]=d;s(null,O,...d),s(1,O,N);const i=u("getDefaultValueComponent","valueId: Id",j(A(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+re);_(T,T,e,Ye(2,0)+ce);const $=_(v,v,l+De,tt(y,je)+ce);_(Oe+T+ue,Oe+T+ue,Yt,Ye(2,9)+qt,At(Wt(T)+Ht+t,Wt(T)+pe),Bt(T),Xt,At(nl,`values: ${t})`+Fe,_t),dl),_(Oe+Ve+T+ue,Oe+Ve+T+ue,Yt,Ye(2,11)+qt,At(Wt(Ve+T)+Ht+t,Wt(Ve+T)+pe),Bt(Ve+T),Xt,At(nl,`partialValues: ${t})`+Fe,_t),dl),_(ie+T+ue,ie+T+ue,ue,Ye(2,12),a,a,a,ol,dl);const p=I(y+xe,Et("valueId?: VId",L+ye+N,Ft),at("a Value"),`<VId extends ${l}>`),b=I(T+xe,Et(L+ye+N,"valueComponents?: {readonly [VId in "+l+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${l}) => ExtraProps`,al,Ft),at(Xe(2,1)));s(1,E,b,p),Z(T+sl,"{"+L+", valueComponents, getValueComponentProps"+ll+"}: "+b,[oe+`(${$}(${L}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+i+"(valueId);","return <Value",`{...${ne}(getValueComponentProps, valueId)}`,"key={valueId}",W,Ut,"/>;","}), separator)"],Ye(2,13)+ce),A(((e,t,l,n,o)=>{const d="Map"+kt(t,1);s(0,O,d),s(1,O,d);const r=_(o+y,y,t,it(e)+ce,a,n);_(Oe+o+y+ue,Oe+y+ue,Yt,it(e,9)+qt,At(Wt(y)+Ht+t+" | "+d,Wt(y)+pe),At(n,Bt(y)),Xt,At(nl,`value: ${t} | ${d})`+Fe,_t),dl),_(ie+o+y+ue,ie+y+ue,ue,it(e,12),a,n,a,ol,dl),Z(o+y+sl,`{${L}, debugIds}: ${p}<'${e}'>`,[oe+`('' + ${r}(`+L+`) ?? '', undefined, debugIds, ${n})`],it(e,13)+ce)})),_(T+c,T+c,Be,Ye(2,8)+" changes",Il(n),cl()),_(v+c,v+c,Be,dt(10,0,1),Il(o),cl()),_(y+c,y+c,Be,dt(11,0),Il(r,`valueId: ${l} | null`),cl("valueId"))}return Z(Re,`{${L}, ${L}ById, children}: `+K+" & {children: React.ReactNode}",["{",Qt,"return (","<Context."+Re,"value={useMemo(",`() => [${L} ?? contextValue[0], {...contextValue[1], ...${L}ById}],`,`[${L}, ${L}ById, contextValue],`,")}>","{children}",`</Context.${Re}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[r(...V(0),...x(),...H(0)),r(...V(1),...k(),...H(1))]},il=(e,t,l)=>{if(Q(e)&&Q(t))return[a,a,a,a];const[n,o,d,r]=zt(e,t,l);return[n,o,...ul(e,t,l,d,r)]},$l=JSON.parse;var pl=Object.defineProperty,bl=Object.defineProperties,Cl=Object.getOwnPropertyDescriptors,hl=Object.getOwnPropertySymbols,ml=Object.prototype.hasOwnProperty,fl=Object.prototype.propertyIsEnumerable,gl=(e,t,l)=>t in e?pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,wl=(e,t)=>{for(var l in t||(t={}))ml.call(t,l)&&gl(e,l,t[l]);if(hl)for(var l of hl(t))fl.call(t,l)&&gl(e,l,t[l]);return e},yl=(e,t)=>bl(e,Cl(t)),Tl=(e,t,l)=>new Promise(((a,n)=>{var o=e=>{try{r(l.next(e))}catch(e){n(e)}},d=e=>{try{r(l.throw(e))}catch(e){n(e)}},r=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,d);r((l=l.apply(e,t)).next())}));const vl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Vl=jt((e=>{const t=()=>{const t=$l(e.getTablesSchemaJson());return!Q(t)||O(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=ee();if(O(a,(t=>O(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=oe(n,a,(()=>[A(o),ee(),[0],0])),[r,s,[I]]=d,c=oe(s,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),ne(s,o,c),d[3]++,r==A(o)})))))return t[l]={},X(n,(([e,,[,n],o],d)=>{t[l][d]=wl({[s]:e},o==L(a)?{[I]:n}:{})})),1}))?t:{}},l=()=>{const t=$l(e.getValuesSchemaJson());return Q(t)&&e.forEachValue(((e,l)=>{t[e]={[s]:A(l)}})),t},a=e=>il(t(),l(),e),n=e=>Tl(void 0,null,(function*(){const t=["d.ts","ts","d.ts","tsx"];let l;try{l=(yield import("prettier")).format}catch(e){l=e=>e}return N(a(e),((e,a)=>Vt(l(e,yl(wl({},vl),{filepath:"_."+t[a]})))))}));return U({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let r=0,s=0;const I={};d(((e,l)=>{r++;let a=0;l((()=>a++)),s+=a,t&&(I[e]={rowCells:a})})),a+=r,n+=s,t&&(o[e]={tableRows:r,tableCells:s,rows:I})})),wl({totalTables:l,totalRows:a,totalCells:n,totalValues:L(e.getValueIds()),jsonLength:xt(e.getJson())},t?{detail:{tables:o}}:{})},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=Vl},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
|
|
1
|
+
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,l="tinybase",a="",n=",",o=t(a),d=t(!0),r=t(0),s="type",I="default",c="Listener",u="get",$="add",i="Ids",p="Table",b=p+"s",C=p+i,h="Row",m=h+i,f="Sorted"+h+i,g="Cell",w=g+i,y="Value",T=y+"s",v=y+i,V=isFinite,x=(e,t)=>e instanceof t,R=e=>null==e,k=e=>e==o||e==d,P=e=>t(e)==o,S=e=>Array.isArray(e),A=e=>{const l=t(e);return k(l)||l==r&&V(e)?l:void 0},O=(e,t)=>e.every(t),E=(e,t)=>e.sort(t),D=(e,t)=>e.forEach(t),j=(e,t=a)=>e.join(t),N=(e,t)=>e.map(t),G=e=>e.length,L=(e,t)=>e.filter(t),M=(e,...t)=>e.push(...t),J=e=>e.pop(),z=(e,...t)=>e.unshift(...t),W=e=>e.shift(),B=Object,F=B.keys,U=B.freeze,_=e=>x(e,B)&&e.constructor==B,Z=(e,t)=>N(B.entries(e),(([e,l])=>t(l,e))),H=e=>G(F(e)),Q=e=>_(e)&&0==H(e),q=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},K=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},X=(e,t)=>null==e?void 0:e.forEach(t),Y=(e,t)=>null==e?void 0:e.delete(t),ee=e=>new Map(e),te=(e,t)=>null==e?void 0:e.get(t),le=(e,t)=>X(e,((e,l)=>t(l,e))),ae=(e,t)=>{var l;return N([...null!=(l=null==e?void 0:e.entries())?l:[]],(([e,l])=>t(l,e)))},ne=(e,t,l)=>R(l)?(Y(e,t),e):null==e?void 0:e.set(t,l),oe=(e,t,l)=>(q(e,t)||ne(e,t,l()),te(e,t)),de=e=>e.toUpperCase(),re=e=>e.toLowerCase(),se="a ",Ie="A function for",ce=", and registers a listener so that any changes to that result will cause a re-render",ue="Callback",$e="Del",ie="Deps",pe=ie+"?: React.DependencyList",be="doRollback?: DoRollback",Ce="actions: () => Return, "+be,he="export",me="Id",fe="Invalid",ge="Json",we=re(c),ye="?: ",Te=" | undefined",ve="NonNullable",Ve="Partial",xe="Props",Re="Provider",ke=`Registers a ${we} that will be called`,Pe="Represents",Se="rowId: "+me,Ae="Schema",Oe="Set",Ee=", descending?: boolean, offset?: number, limit?: number",De="[]",je="the Store",Ne="Transaction",Ge=Ne+"Changes",Le=re(Ne),Me="Execute a "+Le+" to make multiple mutations",Je="Explicitly starts a "+Le,ze="Explicitly finishes a "+Le,We="the end of the "+Le,Be="void",Fe=" => "+Be,Ue="WhenSet",_e=" when setting it",Ze=se+"string serialization of",He=" ",Qe="Gets a callback that can ",qe="the ",Ke=" the schema for",Xe=(e=0,t=0)=>`the ${Ct[e]}content of`+(t?He+je:a),Ye=(e=0,t,l=0)=>it[t]+He+Xe(e,1)+(l?" when setting it":a),et=(e,t=0)=>Pe+` a Row when ${t?"s":"g"}etting ${Xe()} the '${e}' `+p,tt=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,lt=(e,t)=>`Calls a function for each ${e} in `+t,at=e=>"The props passed to a component that renders "+e,nt=e=>"A function that takes "+e,ot=(e,t=0)=>Ie+" listening to changes to "+bt[e]+" in "+bt[t],dt=(e,t,l=0)=>ke+" whenever "+bt[e]+" in "+bt[t]+" change"+(l?a:"s"),rt=e=>`the '${e}' `+p,st=e=>"the specified Row in "+rt(e),It=(e,t=0)=>it[t]+` ${Xe()} `+rt(e),ct=(e,t=0)=>it[t]+` ${Xe()} `+st(e),ut=(e,t,l=0)=>it[l]+` the '${t}' Cell for `+st(e),$t=(e,t=0)=>it[t]+` the '${e}' Value`,it=["Gets","Checks existence of","Sets","Deletes","Sets part of",Pe,"Gets "+Ze,"Sets "+Ze,ke+" whenever",Qe+"set",Qe+"add",Qe+"set part of",Qe+"delete","Renders","Gets "+Ze+Ke,"Sets"+Ke,"Deletes"+Ke],pt=[u,"has","set","del","set","forEach",$,a],bt=[je,b,qe+p+He+i,se+p,qe+h+He+i,se+h,qe+g+He+i,se+g,"invalid Cell changes",T,qe+y+He+i,se+y,"invalid Value changes",qe+"sorted "+h+He+i,qe+g+He+i+" anywhere",qe+"number of Rows"],Ct=[a,"tabular ","keyed value "],ht=e=>new Set(S(e)||R(e)?e:[e]),mt=(e,t)=>null==e?void 0:e.add(t),ft=/[^A-Za-z]+/,gt=/[^A-Za-z0-9]+/,wt=/^( *)\/\*\* *(.*?) *\*\/$/gm,yt=(e,t,l)=>e.substring(t,l),Tt=e=>e.includes(n),vt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return q(e,n)?vt(e,t,l,a+1):(ne(e,n,l),n)},Vt=e=>e.replace(wt,((e,t,l)=>{const a=77-xt(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),xt=e=>e.length,Rt=e=>e.flat(1e3),kt=(e,t=0)=>j(N(e.split(gt),((e,l)=>(l>0||t?de:re)(yt(e,0,1))+yt(e,1)))),Pt=e=>de(j((e&&!ft.test(e[0])?e:" "+e).split(gt),"_")),St=e=>`/** ${e}. */`,At=(...e)=>j(L(e,(e=>e)),", "),Ot=(...e)=>"{"+j(e,"; ")+"}",Et=(...e)=>Ot(...N(e,(e=>"readonly "+e))),Dt=()=>{const e=[ee(),ee(),ee(),ee()],t=ee(),l=ee(),n=e=>{const t=e.indexOf(" as ");return-1!=t?e.substring(t+4):e};return[(...e)=>j(Rt(e),"\n"),(t,l,...a)=>D(a,(a=>D([0,1],(n=>(null!=t?t:n)==n?mt(oe(e[n],l,ht),a):0)))),(e,l,n,o=a,d=1)=>vt(t,e,[l,n,o,d]),(e,t,a)=>vt(l,e,S(a)?[`(${t}) => {`,a,"}"]:[`(${t}) => ${a}`]),(e,t)=>te(l,e)===t?e:vt(l,e,t),(t=0)=>N([...E(ae(e[t],((e,t)=>`import {${j(E(K(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>Tt(e)!=Tt(t)?Tt(e)?-1:1:e>t?1:-1)),a],(e=>e.replace("{React}","React"))),()=>ae(t,(([e,t,l,n],o)=>[St(t),`${n?he+" ":a}type ${o}${l} = ${e};`,a])),()=>ae(l,((e,t)=>(e=S(e)?e:[e],M(e,J(e)+";"),[`const ${t} = ${W(e)}`,e,a])))]},jt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Nt=(e,t,l)=>[t=>Z(e,((e,a)=>t(a,kt(a,1),l(Pt(a),`'${a}'`)))),(t,a)=>Z(e[t],((e,t)=>a(t,e[s],e[I],l(Pt(t),`'${t}'`),kt(t,1)))),e=>Z(t,((t,a)=>e(a,t[s],t[I],l(Pt(a),`'${a}'`),kt(a,1))))],Gt=(e,t,l,n)=>[(n,o)=>{const d=n+": "+o,r=e(b,Ot(...t((e=>`'${e}'?: {[rowId: Id]: `+Ot(...l(e,((e,t,l)=>`'${e}'${R(l)?"?":a}: ${t}`)))+"}"))),Ye(1,5)),s=e(b+Ue,Ot(...t((e=>`'${e}'?: {[rowId: Id]: `+Ot(...l(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),Ye(1,5,1)),I=e(p+me,"keyof "+r,"A "+p+" Id in "+je),u=`<TId extends ${I}>`,$=e(p,ve+`<${r}[TId]>`,"A "+p+" in "+je,u),i=e(p+Ue,ve+`<${s}[TId]>`,"A "+p+" in "+je+_e,u),y=e(h,$+"<TId>[Id]","A "+h+" in a "+p,u),T=e(h+Ue,i+"<TId>[Id]","A "+h+" in a "+p+_e,u),v=e(g+me,`Extract<keyof ${y}<TId>, Id>`,"A "+g+" Id in a "+h,u),V=e(g,ve+`<${r}[TId]>[Id][CId]`,"A "+g+" in a "+h,`<TId extends ${I}, CId extends ${v}<TId>>`),x=e("CellIdCellArray",`CId extends ${v}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,g+" Ids and types in a "+h,`<TId extends ${I}, CId = ${v}<TId>>`,0),k=e(g+ue,`(...[cellId, cell]: ${x}<TId>)`+Fe,nt(se+g+" Id, and "+g),u),P=e(h+ue,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Fe+") "+Fe,nt(se+h+" Id, and a "+g+" iterator"),u),S=e(p+g+ue,`(cellId: ${v}<TId>, count: number) `+Fe,nt(se+g+" Id, and count of how many times it appears"),u),A=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${P}<TId>)${Fe}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),O=e(p+ue,`(...[tableId, forEachRow]: ${A})`+Fe,nt(se+p+" Id, and a "+h+" iterator"),a),E=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${v}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${E}) => CellChange`,Ie+" returning information about any Cell's changes during a "+Le),j=e(b+c,`(${d}, getCellChange: ${D}${Te})`+Fe,ot(1)),N=e(C+c,`(${d})`+Fe,ot(2)),G=e(p+c,`(${d}, tableId: ${I}, getCellChange: ${D}${Te})`+Fe,ot(3)),L=e(p+w+c,`(${d}, tableId: ${I})`+Fe,ot(14,3)),M=e(h+"Count"+c,`(${d}, tableId: ${I})`+Fe,ot(15,3)),J=e(m+c,`(${d}, tableId: ${I})`+Fe,ot(4,3)),z=e(f+c,"("+At(d,"tableId: "+I,"cellId: Id"+Te,"descending: boolean","offset: number","limit: number"+Te,"sortedRowIds: Ids")+")"+Fe,ot(13,3)),W=e(h+c,"("+At(""+d,"tableId: "+I,Se,`getCellChange: ${D}${Te}`)+")"+Fe,ot(5,3)),B=e(w+c,"("+At(""+d,"tableId: "+I,Se)+")"+Fe,ot(6,5)),F=e("CellListenerArgsArrayInner",`CId extends ${v}<TId> ? [${d}, tableId: TId, ${Se}, cellId: CId, newCell: ${V}<TId, CId> ${Te}, oldCell: ${V}<TId, CId> ${Te}, getCellChange: ${D} ${Te}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${v}<TId>>`,0),U=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+F+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[r,s,I,$,i,y,T,v,V,k,P,S,O,j,N,G,L,M,J,z,W,B,e(g+c,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${U})`+Fe,ot(7,5)),e(fe+g+c,`(${d}, tableId: Id, ${Se}, cellId: Id, invalidCells: any[])`+Fe,ot(8))]},(t,l)=>{const o=t+": "+l,d=e(T,Ot(...n(((e,t,l)=>`'${e}'${R(l)?"?":a}: ${t}`))),Ye(2,5)),r=e(T+Ue,Ot(...n(((e,t)=>`'${e}'?: ${t}`))),Ye(2,5,1)),s=e(y+me,"keyof "+d,"A "+y+" Id in "+je),I=e(y,ve+`<${d}[VId]>`,"A "+y+" Id in "+je,`<VId extends ${s}>`),u=e("ValueIdValueArray",`VId extends ${s} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+je,`<VId = ${s}>`,0),$=e(y+ue,`(...[valueId, value]: ${u})`+Fe,nt(se+y+" Id, and "+y)),i=e("GetValueChange",`(valueId: ${s}) => ValueChange`,Ie+" returning information about any Value's changes during a "+Le),p=e(T+c,`(${o}, getValueChange: ${i}${Te})`+Fe,ot(9)),b=e(v+c,`(${o})`+Fe,ot(10)),C=e("ValueListenerArgsArray",`VId extends ${s} ? [${o}, valueId: VId, newValue: ${I}<VId> ${Te}, oldValue: ${I}<VId> ${Te}, getValueChange: ${i} ${Te}] : never`,"Value args for ValueListener",`<VId = ${s}>`,0);return[d,r,s,I,$,p,b,e(y+c,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+Fe,ot(11)),e(fe+y+c,`(${o}, valueId: Id, invalidValues: any[])`+Fe,ot(12))]},(t,l)=>e(Ne+c,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+Fe,Ie+" listening to the completion of a "+Le)],Lt=(e,t=a,l=a)=>`store.${e}(${t})`+(l?" as "+l:a),Mt=(e,t=a)=>`fluent(() => ${Lt(e,t)})`,Jt=(e,t=a,l=a)=>`store.${e}(${t?t+", ":a}proxy(listener)${l?", "+l:a})`,zt=(e,t,n)=>{const[o,r,u,V,x,k,S,A]=Dt(),[O,E,N]=Nt(e,t,x),[G,L,J]=Gt(u,O,E,N),W=ee(),B=(e=0)=>ae(W,(([t,l,n,o,d],r)=>{const s=e?[r+`: ${d}(${t}): ${l} => ${n},`]:[r+d+`(${t}): ${l};`];return e||z(s,St(o)),M(s,a),s})),F=(e,t,l,n,o,d=a)=>vt(W,e,[t,l,n,o,d]),U=(e,t,l,n,o,d=a,r=a,s=a)=>F(pt[e]+t+(4==e?Ve:a)+l,d,n,(n==H?Mt:Lt)(pt[e]+(4==e?Ve:a)+l,r,e?void 0:n),o,s),_=(e,t,l,n=a,o=a,d=1,r=a)=>F($+e+c,(n?n+", ":a)+we+": "+t+(d?", mutator?: boolean":a),me,Jt($+e+c,o,d?"mutator":a),l,r),Z=`./${kt(n)}.d`,H=kt(n,1),q=kt(H),X=[],Y=ee();let oe=[],de=[];if(r(1,Z,H,`create${H} as create${H}Decl`),Q(e))r(null,l,b);else{r(0,l,"CellChange"),r(null,l,i);const[e,t,n,o,c,$,y,T,v,V,k,S,A,N,L,J,z,W,B,F,Q,le,ae,de]=G(q,H),re=ee();O(((e,t)=>{const l=`<'${e}'>`,a=[u(t+p,o+l,Pe+` the '${e}' `+p),u(t+p+Ue,c+l,Pe+` the '${e}' `+p+_e),u(t+h,$+l,et(e)),u(t+h+Ue,y+l,et(e,1)),u(t+g+me,T+l,`A Cell Id for the '${e}' `+p),u(t+g+ue,V+l,nt(`a Cell Id and value from a Row in the '${e}' `+p)),u(t+h+ue,k+l,nt(`a Row Id from the '${e}' Table, and a Cell iterator`)),u(t+p+g+ue,S+l,nt(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];ne(re,e,a),r(1,Z,...a)})),r(1,Z,e,t,n,T,A,N,L,J,z,W,B,F,Q,le,ae,de),oe=[e,t,n,T,N,L,J,z,W,B,F,Q,le,ae,re],D([[e],[d],[H,"tables: "+t,"tables"],[H]],(([e,t,l],n)=>U(n,a,b,e,Ye(1,n),t,l))),U(0,a,C,n+De,tt(p,je)),U(5,a,p,Be,lt(p,je),"tableCallback: "+A,"tableCallback as any"),O(((e,t,l)=>{const[n,o,r,s,I,c,u,$]=te(re,e);D([[n],[d],[H,"table: "+o,", table"],[H]],(([n,o,d=a],r)=>U(r,t,p,n,It(e,r),o,l+d))),U(0,t,p+w,i,tt(g,"the whole of "+rt(e)),a,l),U(5,t,p+g,Be,lt(p+g,"the whole of "+rt(e)),"tableCellCallback: "+$,l+", tableCellCallback as any"),U(0,t,h+"Count","number","Gets the number of Rows in the "+rt(e),a,l),U(0,t,m,i,tt(h,rt(e)),a,l),U(0,t,f,i,tt(h,rt(e),1),"cellId?: "+I+Ee,l+", cellId, descending, offset, limit"),U(5,t,h,Be,lt(h,rt(e)),"rowCallback: "+u,l+", rowCallback as any"),D([[r],[d],[H,", row: "+s,", row"],[H],[H,", partialRow: "+s,", partialRow"]],(([n,o=a,d=a],r)=>U(r,t,h,n,ct(e,r),Se+o,l+", rowId"+d))),U(6,t,h,me+Te,"Add a new Row to "+rt(e),"row: "+s+", reuseIds?: boolean",l+", row, reuseIds"),U(0,t,w,I+De,tt(g,st(e)),Se,l+", rowId"),U(5,t,g,Be,lt(g,st(e)),Se+", cellCallback: "+c,l+", rowId, cellCallback as any"),E(e,((n,o,r,s,I)=>{const c="Map"+kt(o,1);ne(Y,o,c);const u=o+(R(r)?Te:a);D([[u],[d],[H,`, cell: ${o} | `+c,", cell as any"],[H]],(([o,d=a,r=a],c)=>U(c,t+I,g,o,ut(e,n,c),Se+d,l+", rowId, "+s+r))),U(1,t+I,p+g,d,it[1]+` the '${n}' Cell anywhere in `+rt(e),a,l+", "+s)}))})),U(0,a,b+ge,ge,Ye(1,6)),U(2,a,b+ge,H,Ye(1,7),"tablesJson: "+ge,"tables"+ge),_(b,N,Ye(1,8)+" changes"),_(C,L,dt(2,0,1)),_(p,J,dt(3,0),`tableId: ${n} | null`,"tableId"),_(p+w,z,dt(14,3,1),`tableId: ${n} | null`,"tableId"),_(h+"Count",W,dt(15,3),`tableId: ${n} | null`,"tableId"),_(m,B,dt(4,3,1),`tableId: ${n} | null`,"tableId"),_(f,F,dt(13,3,1),At("tableId: TId",`cellId: ${T}<TId>`+Te,"descending: boolean","offset: number","limit: number"+Te),At("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(h,Q,dt(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(w,le,dt(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(g,ae,dt(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${j(O((e=>{var t,l;return null!=(l=null==(t=te(re,e))?void 0:t[4])?l:a}))," | ")} | null`,"tableId, rowId, cellId"),_(fe+g,de,ke+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),r(1,Z,...K(Y)),M(X,".set"+b+Ae+"({",Rt(O(((e,t,l)=>[`[${l}]: {`,...E(e,((e,t,l,n)=>`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(l)?a:`, [${x(Pt(I),`'${I}'`)}]: `+(P(l)?x(Pt(l),`'${l}'`):l)}},`)),"},"]))),"})")}if(Q(t))r(null,l,T);else{const[e,t,n,o,c,u,$,i,p]=L(q,H);r(1,Z,e,t,n,c,u,$,i,p),de=[e,t,n,u,$,i],D([[e],[d],[H,"values: "+t,"values"],[H],[H,"partialValues: "+t,"partialValues"]],(([e,t,l],n)=>U(n,a,T,e,Ye(2,n),t,l))),U(0,a,v,n+De,tt(y,je)),U(5,a,y,"void",lt(y,je),"valueCallback: "+c,"valueCallback as any"),N(((e,t,l,n,o)=>{const r="Map"+kt(t,1);ne(Y,t,r),D([[t],[d],[H,`value: ${t} | `+r,", value as any"],[H]],(([t,l,d=a],r)=>U(r,o,y,t,$t(e,r),l,n+d)))})),U(0,a,T+ge,ge,Ye(2,6)),U(2,a,T+ge,H,Ye(2,7),"valuesJson: "+ge,"values"+ge),_(T,u,Ye(2,8)+" changes"),_(v,$,dt(10,0,1)),_(y,i,dt(11,0),`valueId: ${n} | null`,"valueId"),_(fe+y,p,ke+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),r(1,Z,...K(Y)),r(0,l,"ValueChange"),M(X,".set"+T+Ae+"({",N(((e,t,l,n)=>[`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(l)?a:`, [${x(Pt(I),`'${I}'`)}]: `+(P(l)?x(Pt(l),`'${l}'`):l)}},`])),"})")}U(0,a,"Content",`[${b}, ${T}]`,Ye(0,0)),U(2,a,"Content",H,Ye(0,2),`[tables, values]: [${b}, ${T}]`,"[tables, values]"),U(2,a,Ge,H,`Applies a set of ${Ge} to the Store`,"transactionChanges: "+Ge,"transactionChanges"),le(Y,((e,t)=>u(t,`(cell: ${e}${Te}) => `+e,`Takes a ${e} Cell value and returns another`))),r(null,l,"DoRollback",me,"IdOrNull",ge,"Store",Ge),r(0,l,"Get"+Ge,"GetTransactionLog"),U(0,a,ge,ge,Ye(0,6)),U(2,a,ge,H,Ye(0,7),"tablesAndValuesJson: "+ge,"tablesAndValuesJson"),U(7,a,Le,"Return",Me,Ce,"actions, doRollback","<Return>"),U(7,a,"start"+Ne,H,Je),U(7,a,"finish"+Ne,H,ze,be,"doRollback");const re=J(q,H);return _("Start"+Ne,re,ke+" just before the start of the "+Le,a,a,0),_("WillFinish"+Ne,re,ke+" just before "+We,a,a,0),_("DidFinish"+Ne,re,ke+" just after "+We,a,a,0),U(7,a,"call"+c,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,a,c,H,"Remove a listener that was previously added to "+je,"listenerId: Id","listenerId"),F("getStore",a,"Store","store",it[0]+" the underlying Store object"),r(1,l,"createStore"),r(1,Z,H,`create${H} as create${H}Decl`,re),x("store",["createStore()",...X]),V("fluent","actions: () => Store",["actions();",`return ${q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),x(q,["{",...B(1),"}"]),[o(...k(0),...S(),he+" interface "+H+" {",...B(0),"}",a,St(`Creates a ${H} object`),he+" function create"+H+"(): "+H+";"),o(...k(1),he+" const create"+H+": typeof create"+H+"Decl = () => {",...A(),`return Object.freeze(${q});`,"};"),oe,de]},Wt=e=>u+e,Bt=e=>At(Wt(e),Wt(e)+ie),Ft="debugIds?: boolean",Ut="debugIds={debugIds}",_t="then"+pe,Zt="Parameter",Ht=": (parameter: "+Zt+", store: Store) => ",Qt="const contextValue = useContext(Context);",qt=", based on a parameter",Kt=": ",Xt="<"+Zt+",>",Yt=Zt+"ized"+ue+"<"+Zt+">",el="rowId",tl="rowId={rowId}",ll=", separator, debugIds",al="separator?: ReactElement | string",nl="then?: (store: Store",ol=At(nl+")"+Fe,_t),dl="then, then"+ie,rl=el+Kt+me,sl="View",Il=(e,...t)=>At(...t,we+": "+e,we+pe,"mutator?: boolean"),cl=(...e)=>At(...e,we,we+ie,"mutator"),ul=(e,t,n,o,d)=>{const[r,s,I,u,$,V,x,k]=Dt(),[P,S,A]=Nt(e,t,$),O=`./${kt(n)}.d`,E=`./${kt(n)}-ui-react.d`,D="tinybase/ui-react",N=kt(n,1),G=kt(N),L=N+"Or"+N+me,J=G+"Or"+N+me,W=G+`={${G}}`,B=ee(),F=(e,t,l,n,o,d=a)=>(s(1,E,e+" as "+e+"Decl"),vt(B,e,[t,l,n,o,d])),U=(e,t,l,n,o,d=a)=>F("use"+e,t,l,n,o,d),_=(e,t,l,n,o=a,d=a,r=a,I=a,c=a)=>(s(1,D,`use${t} as use${t}Core`),U(e,At(o,X,I),l,le+`(${J}, use${t}Core, [`+(d||a)+(c?"], ["+c:a)+"]);",n,r)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>ae(B,(([t,l,n,o,d],r)=>{const s=e?[he+` const ${r}: typeof ${r}Decl = ${d}(${t}): ${1==l?"any":l} =>`,n]:[he+` function ${r}${d}(${t}): ${1==l?"ComponentReturnType":l};`];return e||z(s,St(o)),M(s,a),s}));s(null,l,me,"Store",ue,Zt+"ized"+ue),s(0,D,"ComponentReturnType"),s(1,D,"useCellIds"),s(null,D,"ExtraProps"),s(0,O,N);const q=I(L,N+" | "+me,`Used when you need to refer to a ${N} in a React hook or component`),K=I(Re+xe,Et(G+ye+N,G+`ById?: {[${G}Id: Id]: ${N}}`),`Used with the ${Re} component, so that a `+N+" can be passed into the context of an application");s(0,"react","ReactElement","ComponentType"),s(1,"react","React"),s(1,E,q,K);const X=J+ye+q;$("{createContext, useContext, useMemo}","React"),$("Context",`createContext<[${N}?, {[${G}Id: Id]: ${N}}?]>([])`),U("Create"+N,`create: () => ${N}, create`+pe,N,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${N} within a React application with convenient memoization`);const Y=U(N,"id?: Id",N+Te,["{",Qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${N} from within a ${Re} component context`),le=u("useHook",J+`: ${q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${G} = ${Y}(${J} as Id);`,`return hook(...preParams, ((${J} == null || typeof ${J} == 'string')`,`? ${G} : ${J})?.getStore(), ...postParams)`]),ne=u("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=u("wrap",At("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=u("useCustomOrDefaultCellIds",At("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${J}?: ${q} | undefined`),[`const defaultCellIds = ${le}(${J}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),re=$("NullComponent","() => null");if(!Q(e)){const[e,t,n,d,r,$,y,T,v,V,x,k,A,D,L]=o;s(null,O,e,t,n,r,$,y,T,v,V,x,k,A,D),s(0,O,d),s(1,O,N),s(null,l,i,"IdOrNull");const M=u("tableView",`{${G}, rowComponent, getRowComponentProps, customCellIds`+ll+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+ne+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",tl,"customCellIds={customCellIds}",W,Ut,"/>","))",ll,", tableId,",");"]),J=u("getDefaultTableComponent","tableId: Id",j(P(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+re),z=u("getDefaultCellComponent","tableId: Id, cellId: Id",j(P(((e,t,l)=>`tableId == ${l} ? ${j(S(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+re} : `)))+re);_(b,b,e,Ye(1,0)+ce);const B=_(C,C,n+De,tt(p,je)+ce);_(Oe+b+ue,Oe+b+ue,Yt,Ye(1,9)+qt,At(Wt(b)+Ht+t,Wt(b)+pe),Bt(b),Xt,At(nl,`tables: ${t})`+Fe,_t),dl),_($e+b+ue,$e+b+ue,ue,Ye(1,12),a,a,a,ol,dl);const F=I(g+xe,Et("tableId?: TId","rowId: Id","cellId?: CId",G+ye+N,Ft),at(se+g),`<TId extends ${n}, CId extends ${d}<TId>>`),U=I(h+xe,Et("tableId?: TId","rowId: Id",G+ye+N,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${F}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,`customCellIds?: ${d}<TId>[]`,al,Ft),at(se+h),`<TId extends ${n}>`),H=I(p+xe,Et("tableId?: TId",G+ye+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",al,Ft),at(se+p),`<TId extends ${n}>`),Q=I("Sorted"+p+xe,Et("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",G+ye+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",al,Ft),at(se+"sorted "+p),`<TId extends ${n}>`),q=I(b+xe,Et(G+ye+N,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${H}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,al,Ft),at(Xe(1,1)));s(1,E,q,H,Q,U,F),Z(b+sl,"{"+G+", tableComponents, getTableComponentProps"+ll+"}: "+q,[oe+`(${B}(${G}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+J+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ne}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",W,Ut,"/>;","}), separator)"],Ye(1,13)+ce),P(((e,t,l)=>{const[n,o,d,r,I]=te(L,e);s(null,O,n,o,d,r,I),_(t+p,p,n,It(e)+ce,a,l),_(t+p+w,p+w,i,tt(g,"the whole of "+rt(e))+ce,a,l);const c=_(t+m,m,i,tt(h,rt(e))+ce,a,l),u=_(t+f,f,i,tt(h,rt(e),1)+ce,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",l+", cellId, descending, offset, limit");_(t+h,h,d,ct(e)+ce,rl,At(l,el)),_(t+w,w,I+De,tt(g,st(e))+ce,rl,At(l,el)),_(Oe+t+p+ue,Oe+p+ue,Yt,It(e,9)+qt,At(Wt(p)+Ht+o,Wt(p)+pe),At(l,Bt(p)),Xt,At(nl,`table: ${o})`+Fe,_t),dl),_($e+t+p+ue,$e+p+ue,ue,It(e,12),a,l,a,ol,dl),_(Oe+t+h+ue,Oe+h+ue,Yt,ct(e,9)+qt,At(rl,Wt(h)+Ht+r,Wt(h)+pe),At(l,el,Bt(h)),Xt,At(nl,`row: ${r})`+Fe,_t),dl),_("Add"+t+h+ue,"Add"+h+ue,Yt,ct(e,10)+qt,At(Wt(h)+Ht+r,Wt(h)+pe),At(l,Bt(h)),Xt,"then?: ("+At(rl+Te,"store: Store","row: "+r+")"+Fe,"then"+pe)+", reuseRowIds?: boolean",dl+", reuseRowIds"),_(Oe+t+Ve+h+ue,Oe+Ve+h+ue,Yt,ct(e,11)+qt,At(rl,Wt(Ve+h)+Ht+r,Wt(Ve+h)+pe),At(l,el,Bt(Ve+h)),Xt,At(nl,`partialRow: ${r})`+Fe,_t),dl),_($e+t+h+ue,$e+h+ue,ue,ct(e,12),rl,At(l,el),a,ol,dl);const $=Z(t+h+sl,"{rowId, "+G+", cellComponents, getCellComponentProps, customCellIds"+ll+`}: ${U}<'${e}'>`,[oe+`(${de}(customCellIds, `+l+`, rowId, ${G}).map((cellId: ${I}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+z+`(${l}, cellId)) as React.ComponentType<CellProps<typeof `+l+", typeof cellId>>;","return <Cell",`{...${ne}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${l}}`,tl,"cellId={cellId}",W,Ut,"/>;","})"+ll+", rowId)"],ct(e,13)+ce);Z(t+"Sorted"+p+sl,"{cellId, descending, offset, limit, ...props}: "+Q+`<'${e}'>`,M+"(props, "+u+`(cellId, descending, offset, limit, props.${G}), ${l}, ${$});`,It(e,13)+", sorted"+ce),Z(t+p+sl,`props: ${H}<'${e}'>`,M+"(props, "+c+`(props.${G}), ${l}, ${$});`,It(e,13)+ce),S(e,((n,o,d,r,I)=>{const c="Map"+kt(o,1);s(0,O,c),s(1,O,c);const u=_(t+I+g,g,o+(R(d)?Te:a),ut(e,n)+ce,rl,At(l,el,r));_(Oe+t+I+g+ue,Oe+g+ue,Yt,ut(e,n,9)+qt,At(rl,Wt(g)+Ht+o+" | "+c,Wt(g)+pe),At(l,el,r,Bt(g)),Xt,At(nl,`cell: ${o} | ${c})`+Fe,_t),dl),_($e+t+I+g+ue,$e+g+ue,ue,ut(e,n,12),At(rl,"forceDel?: boolean"),At(l,el,r,"forceDel"),a,ol,dl),Z(t+I+g+sl,`{rowId, ${G}, debugIds}: `+F+`<'${e}', '${n}'>`,[oe+`('' + ${u}(rowId, `+G+`) ?? '', undefined, debugIds, ${r})`],ut(e,n,13)+ce)}))}));const K=j(P((e=>{var t,l;return null!=(l=null==(t=te(L,e))?void 0:t[4])?l:a}))," | ");_(b+c,b+c,Be,Ye(1,8)+" changes",Il(r),cl()),_(C+c,C+c,Be,dt(2,0,1),Il($),cl()),_(p+c,p+c,Be,dt(3,0),Il(y,`tableId: ${n} | null`),cl("tableId")),_(p+w+c,p+w+c,Be,dt(14,3,1),Il(T,`tableId: ${n} | null`),cl("tableId")),_(m+c,m+c,Be,dt(4,3,1),Il(V,`tableId: ${n} | null`),cl("tableId")),_(f+c,f+c,Be,dt(13,3,1),Il(x,`tableId: ${n} | null`,"cellId: "+K+Te,"descending: boolean","offset: number","limit: number"+Te),cl("tableId","cellId","descending","offset","limit")),_(h+c,h+c,Be,dt(5,3),Il(k,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(w+c,w+c,Be,dt(6,5,1),Il(A,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(g+c,g+c,Be,dt(7,5),Il(D,`tableId: ${n} | null`,el+": IdOrNull",`cellId: ${K} | null`),cl("tableId",el,"cellId"))}if(!Q(t)){const[e,t,l,n,o,r]=d;s(null,O,...d),s(1,O,N);const $=u("getDefaultValueComponent","valueId: Id",j(A(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+re);_(T,T,e,Ye(2,0)+ce);const i=_(v,v,l+De,tt(y,je)+ce);_(Oe+T+ue,Oe+T+ue,Yt,Ye(2,9)+qt,At(Wt(T)+Ht+t,Wt(T)+pe),Bt(T),Xt,At(nl,`values: ${t})`+Fe,_t),dl),_(Oe+Ve+T+ue,Oe+Ve+T+ue,Yt,Ye(2,11)+qt,At(Wt(Ve+T)+Ht+t,Wt(Ve+T)+pe),Bt(Ve+T),Xt,At(nl,`partialValues: ${t})`+Fe,_t),dl),_($e+T+ue,$e+T+ue,ue,Ye(2,12),a,a,a,ol,dl);const p=I(y+xe,Et("valueId?: VId",G+ye+N,Ft),at("a Value"),`<VId extends ${l}>`),b=I(T+xe,Et(G+ye+N,"valueComponents?: {readonly [VId in "+l+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${l}) => ExtraProps`,al,Ft),at(Xe(2,1)));s(1,E,b,p),Z(T+sl,"{"+G+", valueComponents, getValueComponentProps"+ll+"}: "+b,[oe+`(${i}(${G}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+$+"(valueId);","return <Value",`{...${ne}(getValueComponentProps, valueId)}`,"key={valueId}",W,Ut,"/>;","}), separator)"],Ye(2,13)+ce),A(((e,t,l,n,o)=>{const d="Map"+kt(t,1);s(0,O,d),s(1,O,d);const r=_(o+y,y,t,$t(e)+ce,a,n);_(Oe+o+y+ue,Oe+y+ue,Yt,$t(e,9)+qt,At(Wt(y)+Ht+t+" | "+d,Wt(y)+pe),At(n,Bt(y)),Xt,At(nl,`value: ${t} | ${d})`+Fe,_t),dl),_($e+o+y+ue,$e+y+ue,ue,$t(e,12),a,n,a,ol,dl),Z(o+y+sl,`{${G}, debugIds}: ${p}<'${e}'>`,[oe+`('' + ${r}(`+G+`) ?? '', undefined, debugIds, ${n})`],$t(e,13)+ce)})),_(T+c,T+c,Be,Ye(2,8)+" changes",Il(n),cl()),_(v+c,v+c,Be,dt(10,0,1),Il(o),cl()),_(y+c,y+c,Be,dt(11,0),Il(r,`valueId: ${l} | null`),cl("valueId"))}return Z(Re,`{${G}, ${G}ById, children}: `+K+" & {children: React.ReactNode}",["{",Qt,"return (","<Context."+Re,"value={useMemo(",`() => [${G} ?? contextValue[0], {...contextValue[1], ...${G}ById}],`,`[${G}, ${G}ById, contextValue],`,")}>","{children}",`</Context.${Re}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[r(...V(0),...x(),...H(0)),r(...V(1),...k(),...H(1))]},$l=(e,t,l)=>{if(Q(e)&&Q(t))return[a,a,a,a];const[n,o,d,r]=zt(e,t,l);return[n,o,...ul(e,t,l,d,r)]},il=JSON.parse;var pl=Object.defineProperty,bl=Object.defineProperties,Cl=Object.getOwnPropertyDescriptors,hl=Object.getOwnPropertySymbols,ml=Object.prototype.hasOwnProperty,fl=Object.prototype.propertyIsEnumerable,gl=(e,t,l)=>t in e?pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,wl=(e,t)=>{for(var l in t||(t={}))ml.call(t,l)&&gl(e,l,t[l]);if(hl)for(var l of hl(t))fl.call(t,l)&&gl(e,l,t[l]);return e},yl=(e,t)=>bl(e,Cl(t)),Tl=(e,t,l)=>new Promise(((a,n)=>{var o=e=>{try{r(l.next(e))}catch(e){n(e)}},d=e=>{try{r(l.throw(e))}catch(e){n(e)}},r=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,d);r((l=l.apply(e,t)).next())}));const vl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Vl=jt((e=>{const t=()=>{const t=il(e.getTablesSchemaJson());return!Q(t)||O(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=ee();if(O(a,(t=>O(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=oe(n,a,(()=>[A(o),ee(),[0],0])),[r,s,[I]]=d,c=oe(s,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),ne(s,o,c),d[3]++,r==A(o)})))))return t[l]={},X(n,(([e,,[,n],o],d)=>{t[l][d]=wl({[s]:e},o==G(a)?{[I]:n}:{})})),1}))?t:{}},l=()=>{const t=il(e.getValuesSchemaJson());return Q(t)&&e.forEachValue(((e,l)=>{t[e]={[s]:A(l)}})),t},a=e=>$l(t(),l(),e),n=e=>Tl(void 0,null,(function*(){const t=["d.ts","ts","d.ts","tsx"];let l;try{l=(yield import("prettier")).format}catch(e){l=e=>e}return N(a(e),((e,a)=>Vt(l(e,yl(wl({},vl),{filepath:"_."+t[a]})))))}));return U({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let r=0,s=0;const I={};d(((e,l)=>{r++;let a=0;l((()=>a++)),s+=a,t&&(I[e]={rowCells:a})})),a+=r,n+=s,t&&(o[e]={tableRows:r,tableCells:s,rows:I})})),wl({totalTables:l,totalRows:a,totalCells:n,totalValues:G(e.getValueIds()),jsonLength:xt(e.getJson())},t?{detail:{tables:o}}:{})},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=Vl},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
|
package/lib/umd-es6/tools.js.gz
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,l;e=this,l=function(e,l,t){"use strict";const n=e=>typeof e,s="",r=n(s),a=n(!0),o=n(0),i=n(n),u="type",d="default",c="Ids",h="Table",m=h+"s",b=h+c,p="Row",g=p+"Count",v=p+c,f="Cell",I=f+c,y="Value",w=y+"s",C=y+c,x="currentTarget",k="value",T=e=>s+e,S=isFinite,V=(e,l)=>e instanceof l,R=e=>null==e,O=(e,l,t)=>R(e)?null==t?void 0:t():l(e),q=e=>e==r||e==a,P=e=>n(e)==i,N=e=>Array.isArray(e),{createElement:L,Fragment:E,useCallback:M,useRef:j,useState:z}=l,$=(e,...l)=>R(e)?{}:e(...l),A=(e,l)=>e.forEach(l),J=(e,l)=>e.map(l),F=e=>e.length,D=e=>0==F(e),B=(e,l,t)=>e.slice(l,t),H=(e,...l)=>e.push(...l),Q=e=>e.shift(),U=Object,W=U.keys,G=U.isFrozen,K=U.freeze,X=e=>V(e,U)&&e.constructor==U,Y=(e=[])=>U.fromEntries(e),Z=(e,l)=>!R(((e,l)=>O(e,(e=>e[l])))(e,l)),_=(e,l)=>(delete e[l],e),ee=(e,l)=>J(U.entries(e),(([e,t])=>l(t,e))),le=e=>X(e)&&0==(e=>F(W(e)))(e),te=e=>JSON.stringify(e,((e,l)=>V(l,Map)?U.fromEntries([...l]):l)),ne=JSON.parse,se="tinybaseStoreInspector",re="TinyBase Store Inspector",ae=["left","top","bottom","right","full"],oe="state",ie="sort",ue="open",de="position",ce=ue,he="editable",me=(...e)=>te(e),be=(e,l)=>J(e.sort(),l),pe=(e,l)=>[!!t.useCell(oe,e,he,l),M((t=>{l.setCell(oe,e,he,(e=>!e)),t.preventDefault()}),[l,e])],ge="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ve='content:url("',fe=ve+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Ie='</svg>")',ye=ve+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",we=J([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>fe+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+Ie)),Ce=fe+"<path d='M20 20l60 60M20 80l60-60' />"+Ie,xe=fe+`<path d='${ge}' />`+Ie,ke=fe+`<path d='${ge}M20 20l60 60' />`+Ie;var Te=Object.defineProperty,Se=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,Re=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,Pe=(e,l,t)=>l in e?Te(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Ne=(e,l)=>{for(var t in l||(l={}))Oe.call(l,t)&&Pe(e,t,l[t]);if(Re)for(var t of Re(l))qe.call(l,t)&&Pe(e,t,l[t]);return e},Le=(e,l)=>Se(e,Ve(l));const Ee="*::-webkit-scrollbar",Me=((e,l="")=>e.join(l))(ee(Le(Ne(Le(Ne(Le(Ne({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ee]:"width:0.5rem;height:0.5rem;",[Ee+"-track"]:"background:#111",[Ee+"-thumb"]:"background:#999;border:1px solid #111",[Ee+"-thumb:hover"]:"background:#fff",[Ee+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+ye},Y(J(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),Y(J(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":ye,"header>img:nth-of-type(6)":Ce}),Y(J(we,((e,l)=>[`header>img[data-id='${l}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":xe,"details[open]>summary img.done":ke,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${se} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left"}),((e,l)=>e?`#${se} ${l}{${e}}`:""))),je=({s:e})=>{var l;const n=null!=(l=t.useValue(de,e))?l:1,s=t.useSetValueCallback(ce,(()=>!0),[],e);return t.useValue(ce,e)?null:L("img",{onClick:s,title:re,"data-position":n})},ze=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!t.useCell(oe,e,ue,a),i=t.useSetCellCallback(oe,e,ue,(e=>e[x].open),[],a);return L("details",{open:o,onToggle:i},L("summary",null,l,s?L("img",{onClick:s,className:n?"done":"edit"}):null),r)},$e=e=>{const l=n(e);return q(l)||l==o&&S(e)?l:void 0},Ae=(e,l,t,n,s)=>R(s)?e.delCell(l,t,n,!0):e.setCell(l,t,n,s),Je=(e,l,t)=>R(t)?e.delValue(l):e.setValue(l,t),Fe=(e,l,t,n)=>e==r?l:e==o?t:n;var De=Object.defineProperty,Be=Object.defineProperties,He=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertySymbols,Ue=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,Ge=(e,l,t)=>l in e?De(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Ke=(e,l)=>{for(var t in l||(l={}))Ue.call(l,t)&&Ge(e,t,l[t]);if(Qe)for(var t of Qe(l))We.call(l,t)&&Ge(e,t,l[t]);return e},Xe=(e,l)=>Be(e,He(l)),Ye=(e,l)=>{var t={};for(var n in e)Ue.call(e,n)&&l.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&Qe)for(var n of Qe(e))l.indexOf(n)<0&&We.call(e,n)&&(t[n]=e[n]);return t};const{useCallback:Ze,useMemo:_e,useState:el}=l,ll="editable",tl=(e,l)=>J(t.useTableCellIds(e,l),(l=>e+"."+l)),nl=(e,l,t)=>{const n=Ze(e,l);return t?n:void 0},sl=(...e)=>_e((()=>e),e),rl=(e,l)=>_e((()=>({store:e,tableId:l})),[e,l]),al=(e,l)=>_e((()=>({queries:e,queryId:l})),[e,l]),ol=(e,l=!1,t,n=0,s,r,a,o)=>{const[[i,u,d],c]=el([e,l,n]),h=Ze((e=>{c(e),null==o||o(e)}),[o]),m=nl((e=>h([e,e==i&&!u,d])),[h,i,u,d],t),b=Ze((e=>h([i,u,e])),[h,i,u]),p=!0===a?yl:a;return[[i,u,d],m,_e((()=>!1===a?null:L(p,{offset:d,limit:s,total:r,onChange:b})),[a,p,d,s,r,b])]},il=(e,l,t)=>_e((()=>{const s=null!=l?l:e;return Y(ee(N(s)?Y(J(s,(e=>[e,e]))):s,((e,l)=>{return[l,Ke(Ke({},{label:l,component:t}),(s=e,n(s)==r?{label:e}:e))];var s})))}),[l,t,e]),ul=({className:e,headerRow:l,idColumn:t,params:[n,s,r,a,o,i]})=>L("table",{className:e},i?L("caption",null,i):null,!1===l?null:L("thead",null,L("tr",null,!1===t?null:L(dl,{sort:null!=a?a:[],label:"Id",onClick:o}),ee(n,(({label:e},l)=>L(dl,{key:l,cellId:l,label:e,sort:null!=a?a:[],onClick:o}))))),L("tbody",null,J(r,(e=>L("tr",{key:e},!1===t?null:L("th",null,e),ee(n,(({component:l,getComponentProps:t},n)=>L("td",{key:n},L(l,Xe(Ke(Ke({},$(t,e,n)),s),{rowId:e,cellId:n})))))))))),dl=({cellId:e,sort:[l,t],label:n=(null!=e?e:s),onClick:r})=>L("th",{onClick:nl((()=>null==r?void 0:r(e)),[r,e],r),className:R(t)||l!=e?void 0:`sorted ${t?"de":"a"}scending`},R(t)||l!=e?null:(t?"↓":"↑")+" ",n),cl=({localRowId:e,params:[n,s,r,a,o,i,u]})=>{const d=t.useRemoteRowId(o,e,i);return L("tr",null,!1===n?null:L(l.Fragment,null,L("th",null,e),L("th",null,d)),ee(s,(({component:l,getComponentProps:t},n)=>{const[s,o]=n.split(".",2),i=s===r?e:s===a?d:null;return R(i)?null:L("td",{key:n},L(l,Xe(Ke({},$(t,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},hl=({thing:e,onThingChange:l,className:t})=>{const[n,s]=el(),[i,u]=el(),[d,c]=el(),[h,m]=el(),[b,p]=el();i!==e&&(s($e(e)),u(e),c(e+""),m(Number(e)||0),p(!!e));const g=Ze(((e,t)=>{t(e),u(e),l(e)}),[l]);return L("div",{className:t},L("button",{className:n,onClick:Ze((()=>{const e=Fe(n,o,a,r),t=Fe(e,d,h,b);s(e),u(t),l(t)}),[l,d,h,b,n])},n),Fe(n,L("input",{key:n,value:d,onChange:Ze((e=>g(e[x][k]+"",c)),[g])}),L("input",{key:n,type:"number",value:h,onChange:Ze((e=>g(Number(e[x][k]||0),m)),[g])}),L("input",{key:n,type:"checkbox",checked:b,onChange:Ze((e=>g(!!e[x].checked,p)),[g])})))},ml=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,b=Ye(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[p,g,v]=ol(s,r,d,a,o,t.useRowCount(n,i),c,h);return L(ul,Xe(Ke({},b),{params:sl(il(t.useTableCellIds(n,i),m,u?fl:t.CellView),rl(i,n),t.useSortedRowIds(n,...p,o,i),p,g,v)}))},bl=({store:e,editable:l=!1,valueComponent:n=(l?Il:t.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>L("table",{className:r},!1===a?null:L("thead",null,L("tr",null,!1===o?null:L("th",null,"Id"),L("th",null,y))),L("tbody",null,J(t.useValueIds(e),(l=>L("tr",{key:l},!1===o?null:L("th",null,l),L("td",null,L(n,Xe(Ke({},$(s,l)),{valueId:l,store:e})))))))),pl=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=l,i=Ye(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(l)])(t.useIndexesOrIndexesById(r),n);return L(ul,Xe(Ke({},i),{params:sl(il(t.useTableCellIds(c,d),o,a?fl:t.CellView),rl(d,c),t.useSliceRowIds(n,s,u))}))},gl=({relationshipId:e,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(l),null==e?void 0:e.getRemoteTableId(l)])(t.useRelationshipsOrRelationshipsById(n),e),m=il([...tl(c,d),...tl(h,d)],r,s?fl:t.CellView),b=sl(i,m,c,h,e,u,d);return L("table",{className:a},!1===o?null:L("thead",null,L("tr",null,!1===i?null:L(l.Fragment,null,L("th",null,c,".Id"),L("th",null,h,".Id")),ee(m,(({label:e},l)=>L("th",{key:l},e))))),L("tbody",null,J(t.useRowIds(c,d),(e=>L(cl,{key:e,localRowId:e,params:b})))))},vl=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=Ye(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,p,g]=ol(s,r,u,a,o,t.useResultRowCount(n,i),d,h);return L(ul,Xe(Ke({},m),{params:sl(il(t.useResultTableCellIds(n,i),c,t.ResultCellView),al(i,n),t.useResultSortedRowIds(n,...b,o,i),b,p,g)}))},fl=({tableId:e,rowId:l,cellId:n,store:s,className:r})=>L(hl,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:ll+f}),Il=({valueId:e,store:l,className:n})=>L(hl,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:ll+y}),yl=({onChange:e,total:t,offset:n=0,limit:s=t,singular:r="row",plural:a=r+"s"})=>{(n>t||n<0)&&(n=0,e(0));const o=nl((()=>e(n-s)),[e,n,s],n>0),i=nl((()=>e(n+s)),[e,n,s],n+s<t);return L(l.Fragment,null,t>s&&L(l.Fragment,null,L("button",{className:"previous",disabled:0==n,onClick:o},"←"),L("button",{className:"next",disabled:n+s>=t,onClick:i},"→"),n+1," to ",Math.min(t,n+s)," of "),t," ",1!=t?a:r)},wl=({indexes:e,indexesId:l,indexId:n,s:s})=>L(ze,{uniqueId:me("i",l,n),summary:"Index: "+n,s:s},J(t.useSliceIds(n,e),(t=>L(Cl,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s})))),Cl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=me("i",l,t,n),[a,o]=pe(r,s);return L(ze,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},L(pl,{sliceId:n,indexId:t,indexes:e,editable:a}))},xl=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return R(n)?null:L(ze,{uniqueId:me("i",e),summary:"Indexes: "+(null!=e?e:d),s:l},D(s)?"No indexes defined":be(s,(t=>L(wl,{indexes:n,indexesId:e,indexId:t,s:l}))))},kl=({metrics:e,metricId:l})=>L("tr",null,L("th",null,l),L("td",null,null==e?void 0:e.getTableId(l)),L("td",null,t.useMetric(l,e))),Tl=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return R(n)?null:L(ze,{uniqueId:me("m",e),summary:"Metrics: "+(null!=e?e:d),s:l},D(s)?"No metrics defined":L("table",null,L("thead",null,L("th",null,"Metric Id"),L("th",null,"Table Id"),L("th",null,"Metric")),L("tbody",null,J(s,(e=>L(kl,{metrics:n,metricId:e}))))))},Sl=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const a=me("q",l,n),[o,i,u]=ne(null!=(r=t.useCell(oe,a,ie,s))?r:"[]"),d=t.useSetCellCallback(oe,a,ie,te,[],s);return L(ze,{uniqueId:a,summary:"Query: "+n,s:s},L(vl,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},Vl=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return R(n)?null:L(ze,{uniqueId:me("q",e),summary:"Queries: "+(null!=e?e:d),s:l},D(s)?"No queries defined":be(s,(t=>L(Sl,{queries:n,queriesId:e,queryId:t,s:l}))))},Rl=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=me("r",l,t),[r,a]=pe(s,n);return L(ze,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:a,s:n},L(gl,{relationshipId:t,relationships:e,editable:r}))},Ol=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return R(n)?null:L(ze,{uniqueId:me("r",e),summary:"Relationships: "+(null!=e?e:d),s:l},D(s)?"No relationships defined":be(s,(t=>L(Rl,{relationships:n,relationshipsId:e,relationshipId:t,s:l}))))},ql=({tableId:e,store:l,storeId:n,s:s})=>{var r;const a=me("t",n,e),[o,i,u]=ne(null!=(r=t.useCell(oe,a,ie,s))?r:"[]"),d=t.useSetCellCallback(oe,a,ie,te,[],s),[c,m]=pe(a,s);return L(ze,{uniqueId:a,summary:h+": "+e,editable:c,handleEditable:m,s:s},L(ml,{tableId:e,store:l,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Pl=({store:e,storeId:l,s:n})=>{const s=me("v",l),[r,a]=pe(s,n);return D(t.useValueIds(e))?null:L(ze,{uniqueId:s,summary:w,editable:r,handleEditable:a,s:n},L(bl,{store:e,editable:r}))},Nl=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return R(n)?null:L(ze,{uniqueId:me("s",e),summary:"Store: "+(null!=e?e:d),s:l},L(Pl,{storeId:e,store:n,s:l}),be(s,(t=>L(ql,{store:n,storeId:e,tableId:t,s:l}))))},Ll=({s:e})=>{const l=j(null),n=l.current,[s,r]=z(!1),{scrollLeft:a,scrollTop:o}=t.useValues(e);n&&!s&&new MutationObserver(((e,l)=>{n.scrollTo(null!=a?a:0,null!=o?o:0),r(!0),l.disconnect()})).observe(n,{childList:!0,subtree:!0});const i=M((l=>{const{scrollLeft:t,scrollTop:n}=l[x];requestIdleCallback((()=>e.setPartialValues({scrollLeft:t,scrollTop:n})))}),[e]);return L("article",{ref:l,onScroll:i},L(Nl,{s:e}),J(t.useStoreIds(),(l=>L(Nl,{storeId:l,key:l,s:e}))),L(Tl,{s:e}),J(t.useMetricsIds(),(l=>L(Tl,{metricsId:l,key:l,s:e}))),L(xl,{s:e}),J(t.useIndexesIds(),(l=>L(xl,{indexesId:l,key:l,s:e}))),L(Ol,{s:e}),J(t.useRelationshipsIds(),(l=>L(Ol,{relationshipsId:l,key:l,s:e}))),L(Vl,{s:e}),J(t.useQueriesIds(),(l=>L(Vl,{queriesId:l,key:l,s:e}))))},El=({s:e})=>{var l;const n=null!=(l=t.useValue(de,e))?l:1,s=t.useSetValueCallback(ce,(()=>!1),[],e),r=t.useSetValueCallback(de,(e=>Number(e[x].dataset.id)),[],e);return L("header",null,L("img",{title:re}),L("span",null,re),J(ae,((e,l)=>l==n?null:L("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),L("img",{onClick:s,title:"Close"}))},Ml=({s:e})=>{var l;const n=null!=(l=t.useValue(de,e))?l:1;return t.useValue(ce,e)?L("main",{"data-position":n},L(El,{s:e}),L(Ll,{s:e})):null},jl=e=>l=>{return t=(l,t)=>l+e(t),Bl(l).reduce(t,0);var t},zl=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},$l=jl(zl),Al=jl($l),Jl=jl(Al),Fl=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Dl=e=>R(e)||0==zl(e),Bl=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Hl=e=>e.clear(),Ql=(e,l)=>null==e?void 0:e.forEach(l),Ul=(e,l)=>null==e?void 0:e.delete(l),Wl=e=>new Map(e),Gl=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},Kl=(e,l)=>null==e?void 0:e.get(l),Xl=(e,l)=>Ql(e,((e,t)=>l(t,e))),Yl=(e,l,t)=>R(t)?(Ul(e,l),e):null==e?void 0:e.set(l,t),Zl=(e,l,t)=>(Fl(e,l)||Yl(e,l,t()),Kl(e,l)),_l=(e,l,t,n=Yl)=>(ee(l,((l,n)=>t(e,n,l))),Xl(e,(t=>Z(l,t)?0:n(e,t))),e),et=(e,l,t)=>{const n={};return Ql(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},lt=(e,l,t)=>et(e,(e=>et(e,l,t)),le),tt=(e,l,t)=>et(e,(e=>lt(e,l,t)),le),nt=(e,l)=>{const t=Wl();return Ql(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},st=e=>nt(e,nt),rt=e=>nt(e,st),at=(e,l,t,n,s=0)=>O((t?Zl:Kl)(e,l[s],s>F(l)-2?t:Wl),(r=>{if(s>F(l)-2)return(null==n?void 0:n(r))&&Yl(e,l[s]),r;const a=at(r,l,t,n,s+1);return Dl(r)&&Yl(e,l[s]),a}));var ot=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const it=Wl(),ut=Wl();var dt=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const ct="storage",ht=globalThis.window,mt=e=>new Set(N(e)||R(e)?e:[e]),bt=(e,l)=>null==e?void 0:e.add(l),pt=/^\d+$/,gt=()=>{const e=[];let l=0;return[t=>{var n;return null!=(n=t?Q(e):null)?n:s+l++},l=>{pt.test(l)&&F(e)<1e3&&H(e,l)}]},vt=e=>[e,e],ft=(e,l=$l)=>l(e[0])+l(e[1]),It=()=>[Wl(),Wl()],yt=e=>[...e],wt=([e,l])=>e===l,Ct=(e,l,t)=>R(e)||!X(e)||le(e)||G(e)?(null==t||t(),!1):(ee(e,((t,n)=>{l(t,n)||_(e,n)})),!le(e)),xt=(e,l,t)=>Yl(e,l,Kl(e,l)==-t?void 0:t),kt=()=>{let e,l,t=!1,n=!1,r=0;const a=Wl(),i=Wl(),c=Wl(),x=Wl(),k=Wl(),S=Wl(),V=Wl(),N=Wl(),L=Wl(),E=Wl(),M=Wl(),j=Wl(),z=Wl(),$=Wl(),D=mt(),Q=Wl(),U=Wl(),W=Wl(),G=Wl(),X=It(),Y=It(),se=It(),re=It(),ae=It(),oe=It(),ie=It(),ue=It(),de=It(),ce=It(),he=It(),me=It(),be=It(),pe=It(),ge=It(),ve=Wl(),fe=It(),[Ie,ye,we,Ce]=(e=>{let l;const[t,n]=gt(),r=Wl();return[(e,n,a,o=[],i=(()=>[]))=>{null!=l||(l=it);const u=t(1);return Yl(r,u,[e,n,a,o,i]),bt(at(n,null!=a?a:[s],mt),u),u},(e,t,...n)=>A(((e,l=[s])=>{const t=[],n=(e,s)=>s==F(l)?H(t,e):null===l[s]?Ql(e,(e=>n(e,s+1))):A([l[s],null],(l=>n(Kl(e,l),s+1)));return n(e,0),t})(e,t),(e=>Ql(e,(e=>Kl(r,e)[0](l,...null!=t?t:[],...n))))),e=>O(Kl(r,e),(([,l,t])=>(at(l,null!=t?t:[s],void 0,(l=>(Ul(l,e),Dl(l)?1:0))),Yl(r,e),n(e),t))),e=>O(Kl(r,e),(([e,,t=[],n,s])=>{const r=(...a)=>{var o,i;const u=F(a);u==F(t)?e(l,...a,...s(a)):R(t[u])?A(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,t[u])};r()}))]})(),xe=e=>{if(!Ct(e,((e,l)=>[u,d].includes(l))))return!1;const l=e[u];return!(!q(l)&&l!=o||($e(e[d])!=l&&_(e,d),0))},ke=(l,t)=>(!e||Fl(M,t)||nl(t))&&Ct(l,((e,l)=>Te(t,l,e)),(()=>nl(t))),Te=(e,l,t,n)=>Ct(n?t:Oe(t,e,l),((n,s)=>O(Se(e,l,s,n),(e=>(t[s]=e,!0)),(()=>!1))),(()=>nl(e,l))),Se=(l,t,n,s)=>e?O(Kl(Kl(M,l),n),(e=>$e(s)!=e[u]?nl(l,t,n,s,e[d]):s),(()=>nl(l,t,n,s))):R($e(s))?nl(l,t,n,s):s,Ve=(e,l)=>Ct(l?e:qe(e),((l,t)=>O(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?O(Kl(z,e),(l=>$e(t)!=l[u]?sl(e,t,l[d]):t),(()=>sl(e,t))):R($e(t))?sl(e,t):t,Oe=(e,l,t)=>(O(Kl(j,l),(([n,s])=>{Ql(n,((l,t)=>{Z(e,t)||(e[t]=l)})),Ql(s,(n=>{Z(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Ql($,((l,t)=>{Z(e,t)||(e[t]=l)})),Ql(D,(l=>{Z(e,l)||sl(l)}))),e),Pe=e=>_l(M,e,((e,l,t)=>{const n=Wl(),s=mt();_l(Zl(M,l,Wl),t,((e,l,t)=>{Yl(e,l,t),O(t[d],(e=>Yl(n,l,e)),(()=>bt(s,l)))})),Yl(j,l,[n,s])}),((e,l)=>{Yl(M,l),Yl(j,l)})),Ne=e=>_l(z,e,((e,l,t)=>{Yl(z,l,t),O(t[d],(e=>Yl($,l,e)),(()=>bt(D,l)))}),((e,l)=>{Yl(z,l),Yl($,l),Ul(D,l)})),Le=e=>le(e)?ql():Tl(e),Ee=e=>_l(W,e,((e,l,t)=>Me(l,t)),((e,l)=>We(l))),Me=(e,l)=>_l(Zl(W,e,(()=>(Ye(e,1),Yl(Q,e,gt()),Yl(U,e,Wl()),Wl()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ge(e,l,t))),je=(e,l,t,n,s)=>_l(Zl(l,t,(()=>(Ze(e,t,1),Wl()))),n,((l,n,s)=>ze(e,t,l,n,s)),((n,r)=>Ke(e,l,t,n,r,s))),ze=(e,l,t,n,s)=>{Fl(t,n)||_e(e,l,n,1);const r=Kl(t,n);s!==r&&(el(e,l,n,r,s),Yl(t,n,s))},Fe=(e,l,t,n,s)=>O(Kl(l,t),(l=>ze(e,t,l,n,s)),(()=>je(e,l,t,Oe({[n]:s},e,t)))),De=e=>le(e)?Ll():Sl(e),Be=e=>_l(G,e,((e,l,t)=>He(l,t)),((e,l)=>Xe(l))),He=(e,l)=>{Fl(G,e)||ll(e,1);const t=Kl(G,e);l!==t&&(tl(e,t,l),Yl(G,e,l))},Qe=(e,l)=>{const[t]=Kl(Q,e),n=t(l);return Fl(Kl(W,e),n)?Qe(e,l):n},Ue=e=>{var l;return null!=(l=Kl(W,e))?l:Me(e,{})},We=e=>Me(e,{}),Ge=(e,l,t)=>{const[,n]=Kl(Q,e);n(t),je(e,l,t,{},!0)},Ke=(e,l,t,n,s,r)=>{var a;const o=Kl(null==(a=Kl(j,e))?void 0:a[0],s);if(!R(o)&&!r)return ze(e,t,n,s,o);const i=l=>{el(e,t,l,Kl(n,l)),_e(e,t,l,-1),Yl(n,l)};R(o)?i(s):Xl(n,i),Dl(n)&&(Ze(e,t,-1),Dl(Yl(l,t))&&(Ye(e,-1),Yl(W,e),Yl(Q,e),Yl(U,e)))},Xe=e=>{const l=Kl($,e);if(!R(l))return He(e,l);tl(e,Kl(G,e)),ll(e,-1),Yl(G,e)},Ye=(e,l)=>xt(a,e,l),Ze=(e,l,t)=>xt(Zl(x,e,Wl),l,t)&&Yl(c,e,Zl(c,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=Kl(U,e),a=null!=(s=Kl(r,t))?s:0;(0==a&&1==n||1==a&&-1==n)&&xt(Zl(i,e,Wl),t,n),Yl(r,t,a!=-n?a+n:null),xt(Zl(Zl(k,e,Wl),l,Wl),t,n)},el=(e,l,t,n,s)=>Zl(Zl(Zl(S,e,Wl),l,Wl),t,(()=>[n,0]))[1]=s,ll=(e,l)=>xt(V,e,l),tl=(e,l,t)=>Zl(N,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(H(Zl(Zl(Zl(L,e,Wl),l,Wl),t,(()=>[])),n),s),sl=(e,l,t)=>(H(Zl(E,e,(()=>[])),l),t),rl=(e,l,t)=>O(Kl(Kl(Kl(S,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...vt(wl(e,l,t))])),al=e=>O(Kl(N,e),(([e,l])=>[!0,e,l]),(()=>[!1,...vt(kl(e))])),ol=e=>Dl(L)||Dl(he[e])?0:Ql(e?rt(L):L,((l,t)=>Ql(l,((l,n)=>Ql(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Dl(E)||Dl(me[e])?0:Ql(e?nt(E):E,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Dl(l))return ye(e,t,(()=>et(l))),1},dl=e=>{const l=Dl(ie[e]),t=Dl(de[e])&&Dl(re[e])&&Dl(ae[e])&&Dl(oe[e])&&l&&Dl(Y[e]),n=Dl(ce[e])&&Dl(ue[e])&&Dl(se[e])&&Dl(X[e]);if(!t||!n){const s=e?[nt(a),st(i),nt(c),st(x),rt(k),rt(S)]:[a,i,c,x,k,S];if(!t){ul(Y[e],s[0]),Ql(s[1],((l,t)=>ul(re[e],l,[t]))),Ql(s[2],((l,t)=>{0!=l&&ye(ae[e],[t],vl(t))}));const t=mt();Ql(s[3],((n,s)=>{ul(oe[e],n,[s])&&!l&&(ye(ie[e],[s,null]),bt(t,s))})),l||Ql(s[5],((l,n)=>{if(!Fl(t,n)){const t=mt();Ql(l,(e=>Ql(e,(([l,n],s)=>n!==l?bt(t,s):Ul(e,s))))),Ql(t,(l=>ye(ie[e],[n,l])))}})),Ql(s[4],((l,t)=>Ql(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Ql(s[5],((t,n)=>{let s;Ql(t,((t,r)=>{let a;Ql(t,(([t,o],i)=>{o!==t&&(ye(ce[e],[n,r,i],o,t,rl),l=s=a=1)})),a&&ye(ue[e],[n,r],rl)})),s&&ye(se[e],[n],rl)})),l&&ye(X[e],void 0,rl)}}},cl=e=>{const l=Dl(pe[e]),t=Dl(ge[e])&&Dl(be[e]);if(!l||!t){const n=e?[nt(V),nt(N)]:[V,N];if(l||ul(pe[e],n[0]),!t){let l;Ql(n[1],(([t,n],s)=>{n!==t&&(ye(ge[e],[s],n,t,al),l=1)})),l&&ye(be[e],void 0,al)}}},hl=(e,...l)=>(jl((()=>e(...J(l,T)))),it),ml=()=>[et(S,((e,l)=>-1===Kl(a,l)?null:et(e,((e,t)=>-1===Kl(Kl(x,l),t)?null:et(e,(([,e])=>null!=e?e:null),((e,l)=>wt(l)))),le)),le),et(N,(([,e])=>null!=e?e:null),((e,l)=>wt(l)))],bl=()=>({cellsTouched:t,valuesTouched:n,changedCells:tt(S,yt,wt),invalidCells:tt(L),changedValues:et(N,yt,wt),invalidValues:et(E),changedTableIds:et(a),changedRowIds:lt(x),changedCellIds:tt(k),changedValueIds:et(V)}),pl=()=>tt(W),gl=()=>Gl(W),vl=e=>zl(Kl(W,T(e))),fl=e=>Gl(Kl(W,T(e))),Il=(e,l,t,n=0,s)=>{return J(B((a=Kl(W,T(e)),o=(e,t)=>[R(l)?t:Kl(e,T(l)),t],r=([e],[l])=>{return((null!=(n=e)?n:0)<(null!=(s=l)?s:0)?-1:1)*(t?-1:1);var n,s},J([...null!=(i=null==a?void 0:a.entries())?i:[]],(([e,l])=>o(l,e))).sort(r)),n,R(s)?s:n+s),(([,e])=>e));var r,a,o,i},yl=(e,l)=>Gl(Kl(Kl(W,T(e)),T(l))),wl=(e,l,t)=>Kl(Kl(Kl(W,T(e)),T(l)),T(t)),Cl=()=>et(G),xl=()=>Gl(G),kl=e=>Kl(G,T(e)),Tl=e=>hl((()=>(e=>Ct(e,ke,nl))(e)?Ee(e):0)),Sl=e=>hl((()=>Ve(e)?Be(e):0)),Vl=e=>{try{Le(ne(e))}catch(e){}return it},Rl=l=>hl((()=>{if((e=Ct(l,(e=>Ct(e,xe))))&&(Pe(l),!Dl(W))){const e=pl();ql(),Tl(e)}})),Ol=e=>hl((()=>{if(l=(e=>Ct(e,xe))(e)){const t=Cl();Ml(),Ll(),l=!0,Ne(e),Sl(t)}})),ql=()=>hl((()=>Ee({}))),Pl=e=>hl((e=>Fl(W,e)?We(e):0),e),Nl=(e,l)=>hl(((e,l)=>O(Kl(W,e),(t=>Fl(t,l)?Ge(e,t,l):0))),e,l),Ll=()=>hl((()=>Be({}))),El=()=>hl((()=>{Pe({}),e=!1})),Ml=()=>hl((()=>{Ne({}),l=!1})),jl=(e,l)=>{if(-1!=r){Bl();const t=e();return ot(l),t}},Bl=()=>(-1!=r&&r++,1==r&&ye(ve,void 0,ml,bl),it),ot=e=>(r>0&&(r--,0==r&&(t=!Dl(S),n=!Dl(N),r=1,ol(1),t&&dl(1),il(1),n&&cl(1),(null==e?void 0:e(ml,bl))&&(Ql(S,((e,l)=>Ql(e,((e,t)=>Ql(e,(([e],n)=>Ae(it,l,t,n,e))))))),Ql(N,(([e],l)=>Je(it,l,e))),t=n=!1),ye(fe[0],void 0,ml,bl),r=-1,ol(0),t&&dl(0),il(0),n&&cl(0),ye(fe[1],void 0,ml,bl),r=0,t=n=!1,A([a,i,c,x,k,S,L,V,N,E],Hl))),it),it={getContent:()=>[pl(),Cl()],getTables:pl,getTableIds:gl,getTable:e=>lt(Kl(W,T(e))),getTableCellIds:e=>Gl(Kl(U,T(e))),getRowCount:vl,getRowIds:fl,getSortedRowIds:Il,getRow:(e,l)=>et(Kl(Kl(W,T(e)),T(l))),getCellIds:yl,getCell:wl,getValues:Cl,getValueIds:xl,getValue:kl,hasTables:()=>!Dl(W),hasTable:e=>Fl(W,T(e)),hasTableCell:(e,l)=>Fl(Kl(U,T(e)),T(l)),hasRow:(e,l)=>Fl(Kl(W,T(e)),T(l)),hasCell:(e,l,t)=>Fl(Kl(Kl(W,T(e)),T(l)),T(t)),hasValues:()=>!Dl(G),hasValue:e=>Fl(G,T(e)),getTablesJson:()=>te(W),getValuesJson:()=>te(G),getJson:()=>te([W,G]),getTablesSchemaJson:()=>te(M),getValuesSchemaJson:()=>te(z),getSchemaJson:()=>te([M,z]),setContent:([e,l])=>hl((()=>{(le(e)?ql:Tl)(e),(le(l)?Ll:Sl)(l)})),setTables:Tl,setTable:(e,l)=>hl((e=>ke(l,e)?Me(e,l):0),e),setRow:(e,l,t)=>hl(((e,l)=>Te(e,l,t)?je(e,Ue(e),l,t):0),e,l),addRow:(e,l,t=!0)=>jl((()=>{let n;return Te(e,n,l)&&(e=T(e),je(e,Ue(e),n=Qe(e,t?1:0),l)),n})),setPartialRow:(e,l,t)=>hl(((e,l)=>{if(Te(e,l,t,1)){const n=Ue(e);ee(t,((t,s)=>Fe(e,n,l,s,t)))}}),e,l),setCell:(e,l,t,n)=>hl(((e,l,t)=>O(Se(e,l,t,P(n)?n(wl(e,l,t)):n),(n=>Fe(e,Ue(e),l,t,n)))),e,l,t),setValues:Sl,setPartialValues:e=>hl((()=>Ve(e,1)?ee(e,((e,l)=>He(l,e))):0)),setValue:(e,l)=>hl((e=>O(Re(e,P(l)?l(kl(e)):l),(l=>He(e,l)))),e),setTransactionChanges:e=>hl((()=>{ee(e[0],((e,l)=>R(e)?Pl(l):ee(e,((e,t)=>R(e)?Nl(l,t):ee(e,((e,n)=>Ae(it,l,t,n,e))))))),ee(e[1],((e,l)=>Je(it,l,e)))})),setTablesJson:Vl,setValuesJson:e=>{try{De(ne(e))}catch(e){}return it},setJson:e=>{try{const[l,t]=ne(e);Le(l),De(t)}catch(l){Vl(e)}return it},setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Pl,delRow:Nl,delCell:(e,l,t,n)=>hl(((e,l,t)=>O(Kl(W,e),(s=>O(Kl(s,l),(r=>Fl(r,t)?Ke(e,s,l,r,t,n):0))))),e,l,t),delValues:Ll,delValue:e=>hl((e=>Fl(G,e)?Xe(e):0),e),delTablesSchema:El,delValuesSchema:Ml,delSchema:()=>hl((()=>{El(),Ml()})),transaction:jl,startTransaction:Bl,finishTransaction:ot,forEachTable:e=>Ql(W,((l,t)=>e(t,(e=>Ql(l,((l,t)=>e(t,(e=>Xl(l,e))))))))),forEachTableCell:(e,l)=>Xl(Kl(U,T(e)),l),forEachRow:(e,l)=>Ql(Kl(W,T(e)),((e,t)=>l(t,(l=>Xl(e,l))))),forEachCell:(e,l,t)=>Xl(Kl(Kl(W,T(e)),T(l)),t),forEachValue:e=>Xl(G,e),addSortedRowIdsListener:(e,l,t,n,s,r,a)=>{let o=Il(e,l,t,n,s);return Ie((()=>{const a=Il(e,l,t,n,s);var i,u,d;u=o,F(i=a)===F(u)&&(d=(e,l)=>u[l]===e,i.every(d))||(o=a,r(it,e,l,t,n,s,o))}),ie[a?1:0],[e,l],[gl])},addStartTransactionListener:e=>Ie(e,ve),addWillFinishTransactionListener:e=>Ie(e,fe[0]),addDidFinishTransactionListener:e=>Ie(e,fe[1]),callListener:e=>(Ce(e),it),delListener:e=>(we(e),it),getListenerStats:()=>({tables:ft(X),tableIds:ft(Y),tableCellIds:ft(re),table:ft(se),rowCount:ft(ae),rowIds:ft(oe),sortedRowIds:ft(ie),row:ft(ue,Al),cellIds:ft(de,Al),cell:ft(ce,Jl),invalidCell:ft(he,Jl),values:ft(be),valueIds:ft(pe),value:ft(ge),invalidValue:ft(me),transaction:$l(ve)+ft(fe)}),createStore:kt,addListener:Ie,callListeners:ye};return ee({[m]:[0,X],[b]:[0,Y],[h]:[1,se,[gl]],[h+I]:[1,re,[gl]],[g]:[1,ae,[gl]],[v]:[1,oe,[gl]],[p]:[2,ue,[gl,fl]],[I]:[2,de,[gl,fl]],[f]:[3,ce,[gl,fl,yl],e=>vt(wl(...e))],InvalidCell:[3,he],[w]:[0,be],[C]:[0,pe],[y]:[1,ge,[xl],e=>vt(kl(e[0]))],InvalidValue:[1,me]},(([e,l,t,n],s)=>{it["add"+s+"Listener"]=(...s)=>Ie(s[e],l[s[e+1]?1:0],e>0?B(s,0,e):void 0,t,n)})),K(it)},Tt=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(kt),s=ae.indexOf(e);return t.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,a=[])=>{let o,i,u,d=0,c=0,h=0,m=0;Zl(it,a,(()=>0)),Zl(ut,a,(()=>[]));const b=e=>ot(void 0,null,(function*(){return 2!=d&&(d=1,c++,yield p.schedule((()=>ot(void 0,null,(function*(){yield e(),d=0}))))),p})),p={load:(t,n)=>ot(void 0,null,(function*(){return yield b((()=>ot(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>ot(void 0,[...t],(function*(t={},s={}){return p.stopAutoLoad(),yield p.load(t,s),m=1,u=n(((t,n)=>ot(void 0,null,(function*(){if(n){const l=n();yield b((()=>ot(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield b((()=>ot(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),p})),stopAutoLoad:()=>(m&&(s(u),u=void 0,m=0),p),save:l=>ot(void 0,null,(function*(){return 1!=d&&(d=2,h++,yield p.schedule((()=>ot(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}d=0}))))),p})),startAutoSave:()=>ot(void 0,null,(function*(){return yield p.stopAutoSave().save(),o=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();le(t)&&le(n)||p.save((()=>[t,n]))})),p})),stopAutoSave:()=>(O(o,e.delListener),p),schedule:(...e)=>ot(void 0,null,(function*(){return H(Kl(ut,a),...e),yield ot(void 0,null,(function*(){if(!Kl(it,a)){for(Yl(it,a,1);!R(i=Q(Kl(ut,a)));)try{yield i()}catch(e){null==r||r(e)}Yl(it,a,0)}})),p})),getStore:()=>e,destroy:()=>p.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return K(p)})(e,(()=>dt(void 0,null,(function*(){return ne(t.getItem(l))}))),(e=>dt(void 0,null,(function*(){return t.setItem(l,te(e()))}))),(e=>{const n=n=>{n.storageArea===t&&n.key===l&&e((()=>ne(n.newValue)))};return ht.addEventListener(ct,n),n}),(e=>ht.removeEventListener(ct,e)),n))(e,se,sessionStorage,l);var l}),void 0,(e=>{return t=function*(){yield e.load(void 0,{position:-1==s?1:s,open:!!l}),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=l=>l.done?e(l.value):Promise.resolve(l.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),L(E,null,L("aside",{id:se},L(je,{s:n}),L(Ml,{s:n})),L("style",null,Me))};var St=Object.defineProperty,Vt=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,qt=(e,l,t)=>l in e?St(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;e.EditableCellView=fl,e.EditableValueView=Il,e.RelationshipInHtmlTable=gl,e.ResultSortedTableInHtmlTable=vl,e.ResultTableInHtmlTable=e=>{var l=e,{queryId:n,queries:s,customCells:r}=l,a=Ye(l,["queryId","queries","customCells"]);return L(ul,Xe(Ke({},a),{params:sl(il(t.useResultTableCellIds(n,s),r,t.ResultCellView),al(s,n),t.useResultRowIds(n,s))}))},e.SliceInHtmlTable=pl,e.SortedTableInHtmlTable=ml,e.SortedTablePaginator=yl,e.StoreInspector=e=>L(Tt,((e,l)=>{for(var t in l||(l={}))Rt.call(l,t)&&qt(e,t,l[t]);if(Vt)for(var t of Vt(l))Ot.call(l,t)&&qt(e,t,l[t]);return e})({},e)),e.TableInHtmlTable=e=>{var l=e,{tableId:n,store:s,editable:r,customCells:a}=l,o=Ye(l,["tableId","store","editable","customCells"]);return L(ul,Xe(Ke({},o),{params:sl(il(t.useTableCellIds(n,s),a,r?fl:t.CellView),rl(s,n),t.useRowIds(n,s))}))},e.ValuesInHtmlTable=bl},"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDomDebug={},e.React,e.TinyBaseUiReact);
|
|
1
|
+
var e,l;e=this,l=function(e,l,t){"use strict";const n=e=>typeof e,s="",r=n(s),a=n(!0),o=n(0),i=n(n),u="type",d="default",c="Ids",h="Table",m=h+"s",b=h+c,g="Row",p=g+"Count",v=g+c,f="Cell",I=f+c,y="Value",C=y+"s",w=y+c,k="currentTarget",x="value",T=e=>s+e,S=Math.floor,V=isFinite,R=(e,l)=>e instanceof l,O=e=>null==e,q=(e,l,t)=>O(e)?null==t?void 0:t():l(e),P=e=>e==r||e==a,N=e=>n(e)==i,L=e=>Array.isArray(e),{createElement:E,Fragment:M,useCallback:j,useLayoutEffect:z,useRef:$,useState:A}=l,J=(e,...l)=>O(e)?{}:e(...l),F=(e,l)=>e.forEach(l),B=(e,l)=>e.map(l),H=e=>e.length,D=e=>0==H(e),Q=(e,l,t)=>e.slice(l,t),W=(e,...l)=>e.push(...l),U=e=>e.shift(),G=Object,K=G.keys,X=G.isFrozen,Y=G.freeze,Z=e=>R(e,G)&&e.constructor==G,_=(e=[])=>G.fromEntries(e),ee=(e,l)=>!O(((e,l)=>q(e,(e=>e[l])))(e,l)),le=(e,l)=>(delete e[l],e),te=(e,l)=>B(G.entries(e),(([e,t])=>l(t,e))),ne=e=>Z(e)&&0==(e=>H(K(e)))(e),se=e=>JSON.stringify(e,((e,l)=>R(l,Map)?G.fromEntries([...l]):l)),re=JSON.parse,ae="tinybaseStoreInspector",oe="TinyBase Store Inspector",ie=["left","top","bottom","right","full"],ue="state",de="sort",ce="open",he="position",me=ce,be="editable",ge=(...e)=>se(e),pe=(e,l)=>B(e.sort(),l),ve=(e,l)=>[!!t.useCell(ue,e,be,l),j((t=>{l.setCell(ue,e,be,(e=>!e)),t.preventDefault()}),[l,e])],fe="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Ie='content:url("',ye=Ie+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Ce='</svg>")',we=Ie+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",ke=B([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>ye+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+Ce)),xe=ye+"<path d='M20 20l60 60M20 80l60-60' />"+Ce,Te=ye+`<path d='${fe}' />`+Ce,Se=ye+`<path d='${fe}M20 20l60 60' />`+Ce;var Ve=Object.defineProperty,Re=Object.defineProperties,Oe=Object.getOwnPropertyDescriptors,qe=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable,Le=(e,l,t)=>l in e?Ve(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Ee=(e,l)=>{for(var t in l||(l={}))Pe.call(l,t)&&Le(e,t,l[t]);if(qe)for(var t of qe(l))Ne.call(l,t)&&Le(e,t,l[t]);return e},Me=(e,l)=>Re(e,Oe(l));const je="*::-webkit-scrollbar",ze=((e,l="")=>e.join(l))(te(Me(Ee(Me(Ee(Me(Ee({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[je]:"width:0.5rem;height:0.5rem;",[je+"-track"]:"background:#111",[je+"-thumb"]:"background:#999;border:1px solid #111",[je+"-thumb:hover"]:"background:#fff",[je+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+we},_(B(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),_(B(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":we,"header>img:nth-of-type(6)":xe}),_(B(ke,((e,l)=>[`header>img[data-id='${l}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":Te,"details[open]>summary img.done":Se,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${ae} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left"}),((e,l)=>e?`#${ae} ${l}{${e}}`:""))),$e=({s:e})=>{var l;const n=null!=(l=t.useValue(he,e))?l:1,s=t.useSetValueCallback(me,(()=>!0),[],e);return t.useValue(me,e)?null:E("img",{onClick:s,title:oe,"data-position":n})},Ae=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!t.useCell(ue,e,ce,a),i=t.useSetCellCallback(ue,e,ce,(e=>e[k].open),[],a);return E("details",{open:o,onToggle:i},E("summary",null,l,s?E("img",{onClick:s,className:n?"done":"edit"}):null),r)},Je=e=>{const l=n(e);return P(l)||l==o&&V(e)?l:void 0},Fe=(e,l,t,n,s)=>O(s)?e.delCell(l,t,n,!0):e.setCell(l,t,n,s),Be=(e,l,t)=>O(t)?e.delValue(l):e.setValue(l,t),He=(e,l,t,n)=>e==r?l:e==o?t:n;var De=Object.defineProperty,Qe=Object.defineProperties,We=Object.getOwnPropertyDescriptors,Ue=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,Xe=(e,l,t)=>l in e?De(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Ye=(e,l)=>{for(var t in l||(l={}))Ge.call(l,t)&&Xe(e,t,l[t]);if(Ue)for(var t of Ue(l))Ke.call(l,t)&&Xe(e,t,l[t]);return e},Ze=(e,l)=>Qe(e,We(l)),_e=(e,l)=>{var t={};for(var n in e)Ge.call(e,n)&&l.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&Ue)for(var n of Ue(e))l.indexOf(n)<0&&Ke.call(e,n)&&(t[n]=e[n]);return t};const{useCallback:el,useMemo:ll,useState:tl}=l,nl="editable",sl=(e,l)=>B(t.useTableCellIds(e,l),(l=>e+"."+l)),rl=(e,l,t)=>{const n=el(e,l);return t?n:void 0},al=(...e)=>ll((()=>e),e),ol=(e,l)=>ll((()=>({store:e,tableId:l})),[e,l]),il=(e,l)=>ll((()=>({queries:e,queryId:l})),[e,l]),ul=(e,l=!1,t,n=0,s,r,a,o)=>{const[[i,u,d],c]=tl([e,l,n]),h=el((e=>{c(e),null==o||o(e)}),[o]),m=rl((e=>h([e,e==i&&!u,d])),[h,i,u,d],t),b=el((e=>h([i,u,e])),[h,i,u]),g=!0===a?wl:a;return[[i,u,d],m,ll((()=>!1===a?null:E(g,{offset:d,limit:s,total:r,onChange:b})),[a,g,d,s,r,b])]},dl=(e,l,t)=>ll((()=>{const s=null!=l?l:e;return _(te(L(s)?_(B(s,(e=>[e,e]))):s,((e,l)=>{return[l,Ye(Ye({},{label:l,component:t}),(s=e,n(s)==r?{label:e}:e))];var s})))}),[l,t,e]),cl=({className:e,headerRow:l,idColumn:t,params:[n,s,r,a,o,i]})=>E("table",{className:e},i?E("caption",null,i):null,!1===l?null:E("thead",null,E("tr",null,!1===t?null:E(hl,{sort:null!=a?a:[],label:"Id",onClick:o}),te(n,(({label:e},l)=>E(hl,{key:l,cellId:l,label:e,sort:null!=a?a:[],onClick:o}))))),E("tbody",null,B(r,(e=>E("tr",{key:e},!1===t?null:E("th",null,e),te(n,(({component:l,getComponentProps:t},n)=>E("td",{key:n},E(l,Ze(Ye(Ye({},J(t,e,n)),s),{rowId:e,cellId:n})))))))))),hl=({cellId:e,sort:[l,t],label:n=(null!=e?e:s),onClick:r})=>E("th",{onClick:rl((()=>null==r?void 0:r(e)),[r,e],r),className:O(t)||l!=e?void 0:`sorted ${t?"de":"a"}scending`},O(t)||l!=e?null:(t?"↓":"↑")+" ",n),ml=({localRowId:e,params:[n,s,r,a,o,i,u]})=>{const d=t.useRemoteRowId(o,e,i);return E("tr",null,!1===n?null:E(l.Fragment,null,E("th",null,e),E("th",null,d)),te(s,(({component:l,getComponentProps:t},n)=>{const[s,o]=n.split(".",2),i=s===r?e:s===a?d:null;return O(i)?null:E("td",{key:n},E(l,Ze(Ye({},J(t,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},bl=({thing:e,onThingChange:l,className:t,hasSchema:n})=>{const[s,i]=tl(),[u,d]=tl(),[c,h]=tl(),[m,b]=tl(),[g,p]=tl();u!==e&&(i(Je(e)),d(e),h(e+""),b(Number(e)||0),p(!!e));const v=el(((e,t)=>{t(e),d(e),l(e)}),[l]);return E("div",{className:t},E("button",{className:s,onClick:el((()=>{if(!(null==n?void 0:n())){const e=He(s,o,a,r),t=He(e,c,m,g);i(e),d(t),l(t)}}),[n,l,c,m,g,s])},s),He(s,E("input",{key:s,value:c,onChange:el((e=>v(e[k][x]+"",h)),[v])}),E("input",{key:s,type:"number",value:m,onChange:el((e=>v(Number(e[k][x]||0),b)),[v])}),E("input",{key:s,type:"checkbox",checked:g,onChange:el((e=>v(!!e[k].checked,p)),[v])})))},gl=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,b=_e(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,p,v]=ul(s,r,d,a,o,t.useRowCount(n,i),c,h);return E(cl,Ze(Ye({},b),{params:al(dl(t.useTableCellIds(n,i),m,u?yl:t.CellView),ol(i,n),t.useSortedRowIds(n,...g,o,i),g,p,v)}))},pl=({store:e,editable:l=!1,valueComponent:n=(l?Cl:t.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>E("table",{className:r},!1===a?null:E("thead",null,E("tr",null,!1===o?null:E("th",null,"Id"),E("th",null,y))),E("tbody",null,B(t.useValueIds(e),(l=>E("tr",{key:l},!1===o?null:E("th",null,l),E("td",null,E(n,Ze(Ye({},J(s,l)),{valueId:l,store:e})))))))),vl=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=l,i=_e(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(l)])(t.useIndexesOrIndexesById(r),n);return E(cl,Ze(Ye({},i),{params:al(dl(t.useTableCellIds(c,d),o,a?yl:t.CellView),ol(d,c),t.useSliceRowIds(n,s,u))}))},fl=({relationshipId:e,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(l),null==e?void 0:e.getRemoteTableId(l)])(t.useRelationshipsOrRelationshipsById(n),e),m=dl([...sl(c,d),...sl(h,d)],r,s?yl:t.CellView),b=al(i,m,c,h,e,u,d);return E("table",{className:a},!1===o?null:E("thead",null,E("tr",null,!1===i?null:E(l.Fragment,null,E("th",null,c,".Id"),E("th",null,h,".Id")),te(m,(({label:e},l)=>E("th",{key:l},e))))),E("tbody",null,B(t.useRowIds(c,d),(e=>E(ml,{key:e,localRowId:e,params:b})))))},Il=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=_e(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,g,p]=ul(s,r,u,a,o,t.useResultRowCount(n,i),d,h);return E(cl,Ze(Ye({},m),{params:al(dl(t.useResultTableCellIds(n,i),c,t.ResultCellView),il(i,n),t.useResultSortedRowIds(n,...b,o,i),b,g,p)}))},yl=({tableId:e,rowId:l,cellId:n,store:s,className:r})=>{var a;return E(bl,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:nl+f,hasSchema:null==(a=t.useStoreOrStoreById(s))?void 0:a.hasTablesSchema})},Cl=({valueId:e,store:l,className:n})=>{var s;return E(bl,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:nl+y,hasSchema:null==(s=t.useStoreOrStoreById(l))?void 0:s.hasValuesSchema})},wl=({onChange:e,total:t,offset:n=0,limit:s=t,singular:r="row",plural:a=r+"s"})=>{(n>t||n<0)&&(n=0,e(0));const o=rl((()=>e(n-s)),[e,n,s],n>0),i=rl((()=>e(n+s)),[e,n,s],n+s<t);return E(l.Fragment,null,t>s&&E(l.Fragment,null,E("button",{className:"previous",disabled:0==n,onClick:o},"←"),E("button",{className:"next",disabled:n+s>=t,onClick:i},"→"),n+1," to ",Math.min(t,n+s)," of "),t," ",1!=t?a:r)},kl=({indexes:e,indexesId:l,indexId:n,s:s})=>E(Ae,{uniqueId:ge("i",l,n),summary:"Index: "+n,s:s},B(t.useSliceIds(n,e),(t=>E(xl,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s})))),xl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=ge("i",l,t,n),[a,o]=ve(r,s);return E(Ae,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},E(vl,{sliceId:n,indexId:t,indexes:e,editable:a}))},Tl=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return O(n)?null:E(Ae,{uniqueId:ge("i",e),summary:"Indexes: "+(null!=e?e:d),s:l},D(s)?"No indexes defined":pe(s,(t=>E(kl,{indexes:n,indexesId:e,indexId:t,s:l}))))},Sl=({metrics:e,metricId:l})=>E("tr",null,E("th",null,l),E("td",null,null==e?void 0:e.getTableId(l)),E("td",null,t.useMetric(l,e))),Vl=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return O(n)?null:E(Ae,{uniqueId:ge("m",e),summary:"Metrics: "+(null!=e?e:d),s:l},D(s)?"No metrics defined":E("table",null,E("thead",null,E("th",null,"Metric Id"),E("th",null,"Table Id"),E("th",null,"Metric")),E("tbody",null,B(s,(e=>E(Sl,{metrics:n,metricId:e}))))))},Rl=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const a=ge("q",l,n),[o,i,u]=re(null!=(r=t.useCell(ue,a,de,s))?r:"[]"),d=t.useSetCellCallback(ue,a,de,se,[],s);return E(Ae,{uniqueId:a,summary:"Query: "+n,s:s},E(Il,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},Ol=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return O(n)?null:E(Ae,{uniqueId:ge("q",e),summary:"Queries: "+(null!=e?e:d),s:l},D(s)?"No queries defined":pe(s,(t=>E(Rl,{queries:n,queriesId:e,queryId:t,s:l}))))},ql=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=ge("r",l,t),[r,a]=ve(s,n);return E(Ae,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:a,s:n},E(fl,{relationshipId:t,relationships:e,editable:r}))},Pl=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return O(n)?null:E(Ae,{uniqueId:ge("r",e),summary:"Relationships: "+(null!=e?e:d),s:l},D(s)?"No relationships defined":pe(s,(t=>E(ql,{relationships:n,relationshipsId:e,relationshipId:t,s:l}))))},Nl=({tableId:e,store:l,storeId:n,s:s})=>{var r;const a=ge("t",n,e),[o,i,u]=re(null!=(r=t.useCell(ue,a,de,s))?r:"[]"),d=t.useSetCellCallback(ue,a,de,se,[],s),[c,m]=ve(a,s);return E(Ae,{uniqueId:a,summary:h+": "+e,editable:c,handleEditable:m,s:s},E(gl,{tableId:e,store:l,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Ll=({store:e,storeId:l,s:n})=>{const s=ge("v",l),[r,a]=ve(s,n);return D(t.useValueIds(e))?null:E(Ae,{uniqueId:s,summary:C,editable:r,handleEditable:a,s:n},E(pl,{store:e,editable:r}))},El=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return O(n)?null:E(Ae,{uniqueId:ge("s",e),summary:"Store: "+(null!=e?e:d),s:l},E(Ll,{storeId:e,store:n,s:l}),pe(s,(t=>E(Nl,{store:n,storeId:e,tableId:t,s:l}))))},Ml=({s:e})=>{const l=$(null),n=$(0),[s,r]=A(!1),{scrollLeft:a,scrollTop:o}=t.useValues(e);z((()=>{const e=l.current;if(e&&!s){const l=new MutationObserver((()=>{e.scrollWidth>=S(a)+e.clientWidth&&e.scrollHeight>=S(o)+e.clientHeight&&e.scrollTo(a,o)}));return l.observe(e,{childList:!0,subtree:!0}),()=>l.disconnect()}}),[s,a,o]);const i=j((l=>{const{scrollLeft:t,scrollTop:s}=l[k];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:t,scrollTop:s})}))}),[e]);return E("article",{ref:l,onScroll:i},E(El,{s:e}),B(t.useStoreIds(),(l=>E(El,{storeId:l,key:l,s:e}))),E(Vl,{s:e}),B(t.useMetricsIds(),(l=>E(Vl,{metricsId:l,key:l,s:e}))),E(Tl,{s:e}),B(t.useIndexesIds(),(l=>E(Tl,{indexesId:l,key:l,s:e}))),E(Pl,{s:e}),B(t.useRelationshipsIds(),(l=>E(Pl,{relationshipsId:l,key:l,s:e}))),E(Ol,{s:e}),B(t.useQueriesIds(),(l=>E(Ol,{queriesId:l,key:l,s:e}))))},jl=({s:e})=>{var l;const n=null!=(l=t.useValue(he,e))?l:1,s=t.useSetValueCallback(me,(()=>!1),[],e),r=t.useSetValueCallback(he,(e=>Number(e[k].dataset.id)),[],e);return E("header",null,E("img",{title:oe}),E("span",null,oe),B(ie,((e,l)=>l==n?null:E("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),E("img",{onClick:s,title:"Close"}))},zl=({s:e})=>{var l;const n=null!=(l=t.useValue(he,e))?l:1;return t.useValue(me,e)?E("main",{"data-position":n},E(jl,{s:e}),E(Ml,{s:e})):null},$l=e=>l=>{return t=(l,t)=>l+e(t),Ql(l).reduce(t,0);var t},Al=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},Jl=$l(Al),Fl=$l(Jl),Bl=$l(Fl),Hl=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Dl=e=>O(e)||0==Al(e),Ql=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Wl=e=>e.clear(),Ul=(e,l)=>null==e?void 0:e.forEach(l),Gl=(e,l)=>null==e?void 0:e.delete(l),Kl=e=>new Map(e),Xl=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},Yl=(e,l)=>null==e?void 0:e.get(l),Zl=(e,l)=>Ul(e,((e,t)=>l(t,e))),_l=(e,l,t)=>O(t)?(Gl(e,l),e):null==e?void 0:e.set(l,t),et=(e,l,t)=>(Hl(e,l)||_l(e,l,t()),Yl(e,l)),lt=(e,l,t,n=_l)=>(te(l,((l,n)=>t(e,n,l))),Zl(e,(t=>ee(l,t)?0:n(e,t))),e),tt=(e,l,t)=>{const n={};return Ul(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},nt=(e,l,t)=>tt(e,(e=>tt(e,l,t)),ne),st=(e,l,t)=>tt(e,(e=>nt(e,l,t)),ne),rt=(e,l)=>{const t=Kl();return Ul(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},at=e=>rt(e,rt),ot=e=>rt(e,at),it=(e,l,t,n,s=0)=>q((t?et:Yl)(e,l[s],s>H(l)-2?t:Kl),(r=>{if(s>H(l)-2)return(null==n?void 0:n(r))&&_l(e,l[s]),r;const a=it(r,l,t,n,s+1);return Dl(r)&&_l(e,l[s]),a}));var ut=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const dt=Kl(),ct=Kl();var ht=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const mt="storage",bt=globalThis.window,gt=e=>new Set(L(e)||O(e)?e:[e]),pt=(e,l)=>null==e?void 0:e.add(l),vt=/^\d+$/,ft=()=>{const e=[];let l=0;return[t=>{var n;return null!=(n=t?U(e):null)?n:s+l++},l=>{vt.test(l)&&H(e)<1e3&&W(e,l)}]},It=e=>[e,e],yt=(e,l=Jl)=>l(e[0])+l(e[1]),Ct=()=>[Kl(),Kl()],wt=e=>[...e],kt=([e,l])=>e===l,xt=(e,l,t)=>O(e)||!Z(e)||ne(e)||X(e)?(null==t||t(),!1):(te(e,((t,n)=>{l(t,n)||le(e,n)})),!ne(e)),Tt=(e,l,t)=>_l(e,l,Yl(e,l)==-t?void 0:t),St=()=>{let e,l,t=!1,n=!1,r=0;const a=Kl(),i=Kl(),c=Kl(),k=Kl(),x=Kl(),S=Kl(),V=Kl(),R=Kl(),L=Kl(),E=Kl(),M=Kl(),j=Kl(),z=Kl(),$=Kl(),A=gt(),J=Kl(),D=Kl(),U=Kl(),G=Kl(),K=Ct(),X=Ct(),Z=Ct(),_=Ct(),ae=Ct(),oe=Ct(),ie=Ct(),ue=Ct(),de=Ct(),ce=Ct(),he=Ct(),me=Ct(),be=Ct(),ge=Ct(),pe=Ct(),ve=Kl(),fe=Ct(),[Ie,ye,Ce,we]=(e=>{let l;const[t,n]=ft(),r=Kl();return[(e,n,a,o=[],i=(()=>[]))=>{null!=l||(l=Ql);const u=t(1);return _l(r,u,[e,n,a,o,i]),pt(it(n,null!=a?a:[s],gt),u),u},(e,t,...n)=>F(((e,l=[s])=>{const t=[],n=(e,s)=>s==H(l)?W(t,e):null===l[s]?Ul(e,(e=>n(e,s+1))):F([l[s],null],(l=>n(Yl(e,l),s+1)));return n(e,0),t})(e,t),(e=>Ul(e,(e=>Yl(r,e)[0](l,...null!=t?t:[],...n))))),e=>q(Yl(r,e),(([,l,t])=>(it(l,null!=t?t:[s],void 0,(l=>(Gl(l,e),Dl(l)?1:0))),_l(r,e),n(e),t))),e=>q(Yl(r,e),(([e,,t=[],n,s])=>{const r=(...a)=>{var o,i;const u=H(a);u==H(t)?e(l,...a,...s(a)):O(t[u])?F(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,t[u])};r()}))]})(),ke=e=>{if(!xt(e,((e,l)=>[u,d].includes(l))))return!1;const l=e[u];return!(!P(l)&&l!=o||(Je(e[d])!=l&&le(e,d),0))},xe=(l,t)=>(!e||Hl(M,t)||nl(t))&&xt(l,((e,l)=>Te(t,l,e)),(()=>nl(t))),Te=(e,l,t,n)=>xt(n?t:Oe(t,e,l),((n,s)=>q(Se(e,l,s,n),(e=>(t[s]=e,!0)),(()=>!1))),(()=>nl(e,l))),Se=(l,t,n,s)=>e?q(Yl(Yl(M,l),n),(e=>Je(s)!=e[u]?nl(l,t,n,s,e[d]):s),(()=>nl(l,t,n,s))):O(Je(s))?nl(l,t,n,s):s,Ve=(e,l)=>xt(l?e:qe(e),((l,t)=>q(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?q(Yl(z,e),(l=>Je(t)!=l[u]?sl(e,t,l[d]):t),(()=>sl(e,t))):O(Je(t))?sl(e,t):t,Oe=(e,l,t)=>(q(Yl(j,l),(([n,s])=>{Ul(n,((l,t)=>{ee(e,t)||(e[t]=l)})),Ul(s,(n=>{ee(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Ul($,((l,t)=>{ee(e,t)||(e[t]=l)})),Ul(A,(l=>{ee(e,l)||sl(l)}))),e),Pe=e=>lt(M,e,((e,l,t)=>{const n=Kl(),s=gt();lt(et(M,l,Kl),t,((e,l,t)=>{_l(e,l,t),q(t[d],(e=>_l(n,l,e)),(()=>pt(s,l)))})),_l(j,l,[n,s])}),((e,l)=>{_l(M,l),_l(j,l)})),Ne=e=>lt(z,e,((e,l,t)=>{_l(z,l,t),q(t[d],(e=>_l($,l,e)),(()=>pt(A,l)))}),((e,l)=>{_l(z,l),_l($,l),Gl(A,l)})),Le=e=>ne(e)?ql():Tl(e),Ee=e=>lt(U,e,((e,l,t)=>Me(l,t)),((e,l)=>Ue(l))),Me=(e,l)=>lt(et(U,e,(()=>(Ye(e,1),_l(J,e,ft()),_l(D,e,Kl()),Kl()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ge(e,l,t))),je=(e,l,t,n,s)=>lt(et(l,t,(()=>(Ze(e,t,1),Kl()))),n,((l,n,s)=>ze(e,t,l,n,s)),((n,r)=>Ke(e,l,t,n,r,s))),ze=(e,l,t,n,s)=>{Hl(t,n)||_e(e,l,n,1);const r=Yl(t,n);s!==r&&(el(e,l,n,r,s),_l(t,n,s))},$e=(e,l,t,n,s)=>q(Yl(l,t),(l=>ze(e,t,l,n,s)),(()=>je(e,l,t,Oe({[n]:s},e,t)))),Ae=e=>ne(e)?Ll():Sl(e),He=e=>lt(G,e,((e,l,t)=>De(l,t)),((e,l)=>Xe(l))),De=(e,l)=>{Hl(G,e)||ll(e,1);const t=Yl(G,e);l!==t&&(tl(e,t,l),_l(G,e,l))},Qe=(e,l)=>{const[t]=Yl(J,e),n=t(l);return Hl(Yl(U,e),n)?Qe(e,l):n},We=e=>{var l;return null!=(l=Yl(U,e))?l:Me(e,{})},Ue=e=>Me(e,{}),Ge=(e,l,t)=>{const[,n]=Yl(J,e);n(t),je(e,l,t,{},!0)},Ke=(e,l,t,n,s,r)=>{var a;const o=Yl(null==(a=Yl(j,e))?void 0:a[0],s);if(!O(o)&&!r)return ze(e,t,n,s,o);const i=l=>{el(e,t,l,Yl(n,l)),_e(e,t,l,-1),_l(n,l)};O(o)?i(s):Zl(n,i),Dl(n)&&(Ze(e,t,-1),Dl(_l(l,t))&&(Ye(e,-1),_l(U,e),_l(J,e),_l(D,e)))},Xe=e=>{const l=Yl($,e);if(!O(l))return De(e,l);tl(e,Yl(G,e)),ll(e,-1),_l(G,e)},Ye=(e,l)=>Tt(a,e,l),Ze=(e,l,t)=>Tt(et(k,e,Kl),l,t)&&_l(c,e,et(c,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=Yl(D,e),a=null!=(s=Yl(r,t))?s:0;(0==a&&1==n||1==a&&-1==n)&&Tt(et(i,e,Kl),t,n),_l(r,t,a!=-n?a+n:null),Tt(et(et(x,e,Kl),l,Kl),t,n)},el=(e,l,t,n,s)=>et(et(et(S,e,Kl),l,Kl),t,(()=>[n,0]))[1]=s,ll=(e,l)=>Tt(V,e,l),tl=(e,l,t)=>et(R,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(W(et(et(et(L,e,Kl),l,Kl),t,(()=>[])),n),s),sl=(e,l,t)=>(W(et(E,e,(()=>[])),l),t),rl=(e,l,t)=>q(Yl(Yl(Yl(S,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...It(Cl(e,l,t))])),al=e=>q(Yl(R,e),(([e,l])=>[!0,e,l]),(()=>[!1,...It(xl(e))])),ol=e=>Dl(L)||Dl(he[e])?0:Ul(e?ot(L):L,((l,t)=>Ul(l,((l,n)=>Ul(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Dl(E)||Dl(me[e])?0:Ul(e?rt(E):E,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Dl(l))return ye(e,t,(()=>tt(l))),1},dl=e=>{const l=Dl(ie[e]),t=Dl(de[e])&&Dl(_[e])&&Dl(ae[e])&&Dl(oe[e])&&l&&Dl(X[e]),n=Dl(ce[e])&&Dl(ue[e])&&Dl(Z[e])&&Dl(K[e]);if(!t||!n){const s=e?[rt(a),at(i),rt(c),at(k),ot(x),ot(S)]:[a,i,c,k,x,S];if(!t){ul(X[e],s[0]),Ul(s[1],((l,t)=>ul(_[e],l,[t]))),Ul(s[2],((l,t)=>{0!=l&&ye(ae[e],[t],vl(t))}));const t=gt();Ul(s[3],((n,s)=>{ul(oe[e],n,[s])&&!l&&(ye(ie[e],[s,null]),pt(t,s))})),l||Ul(s[5],((l,n)=>{if(!Hl(t,n)){const t=gt();Ul(l,(e=>Ul(e,(([l,n],s)=>n!==l?pt(t,s):Gl(e,s))))),Ul(t,(l=>ye(ie[e],[n,l])))}})),Ul(s[4],((l,t)=>Ul(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Ul(s[5],((t,n)=>{let s;Ul(t,((t,r)=>{let a;Ul(t,(([t,o],i)=>{o!==t&&(ye(ce[e],[n,r,i],o,t,rl),l=s=a=1)})),a&&ye(ue[e],[n,r],rl)})),s&&ye(Z[e],[n],rl)})),l&&ye(K[e],void 0,rl)}}},cl=e=>{const l=Dl(ge[e]),t=Dl(pe[e])&&Dl(be[e]);if(!l||!t){const n=e?[rt(V),rt(R)]:[V,R];if(l||ul(ge[e],n[0]),!t){let l;Ul(n[1],(([t,n],s)=>{n!==t&&(ye(pe[e],[s],n,t,al),l=1)})),l&&ye(be[e],void 0,al)}}},hl=(e,...l)=>(jl((()=>e(...B(l,T)))),Ql),ml=()=>[tt(S,((e,l)=>-1===Yl(a,l)?null:tt(e,((e,t)=>-1===Yl(Yl(k,l),t)?null:tt(e,(([,e])=>null!=e?e:null),((e,l)=>kt(l)))),ne)),ne),tt(R,(([,e])=>null!=e?e:null),((e,l)=>kt(l)))],bl=()=>({cellsTouched:t,valuesTouched:n,changedCells:st(S,wt,kt),invalidCells:st(L),changedValues:tt(R,wt,kt),invalidValues:tt(E),changedTableIds:tt(a),changedRowIds:nt(k),changedCellIds:st(x),changedValueIds:tt(V)}),gl=()=>st(U),pl=()=>Xl(U),vl=e=>Al(Yl(U,T(e))),fl=e=>Xl(Yl(U,T(e))),Il=(e,l,t,n=0,s)=>{return B(Q((a=Yl(U,T(e)),o=(e,t)=>[O(l)?t:Yl(e,T(l)),t],r=([e],[l])=>{return((null!=(n=e)?n:0)<(null!=(s=l)?s:0)?-1:1)*(t?-1:1);var n,s},B([...null!=(i=null==a?void 0:a.entries())?i:[]],(([e,l])=>o(l,e))).sort(r)),n,O(s)?s:n+s),(([,e])=>e));var r,a,o,i},yl=(e,l)=>Xl(Yl(Yl(U,T(e)),T(l))),Cl=(e,l,t)=>Yl(Yl(Yl(U,T(e)),T(l)),T(t)),wl=()=>tt(G),kl=()=>Xl(G),xl=e=>Yl(G,T(e)),Tl=e=>hl((()=>(e=>xt(e,xe,nl))(e)?Ee(e):0)),Sl=e=>hl((()=>Ve(e)?He(e):0)),Vl=e=>{try{Le(re(e))}catch(e){}return Ql},Rl=l=>hl((()=>{if((e=xt(l,(e=>xt(e,ke))))&&(Pe(l),!Dl(U))){const e=gl();ql(),Tl(e)}})),Ol=e=>hl((()=>{if(l=(e=>xt(e,ke))(e)){const t=wl();Ml(),Ll(),l=!0,Ne(e),Sl(t)}})),ql=()=>hl((()=>Ee({}))),Pl=e=>hl((e=>Hl(U,e)?Ue(e):0),e),Nl=(e,l)=>hl(((e,l)=>q(Yl(U,e),(t=>Hl(t,l)?Ge(e,t,l):0))),e,l),Ll=()=>hl((()=>He({}))),El=()=>hl((()=>{Pe({}),e=!1})),Ml=()=>hl((()=>{Ne({}),l=!1})),jl=(e,l)=>{if(-1!=r){zl();const t=e();return $l(l),t}},zl=()=>(-1!=r&&r++,1==r&&ye(ve,void 0,ml,bl),Ql),$l=e=>(r>0&&(r--,0==r&&(t=!Dl(S),n=!Dl(R),r=1,ol(1),t&&dl(1),il(1),n&&cl(1),(null==e?void 0:e(ml,bl))&&(Ul(S,((e,l)=>Ul(e,((e,t)=>Ul(e,(([e],n)=>Fe(Ql,l,t,n,e))))))),Ul(R,(([e],l)=>Be(Ql,l,e))),t=n=!1),ye(fe[0],void 0,ml,bl),r=-1,ol(0),t&&dl(0),il(0),n&&cl(0),ye(fe[1],void 0,ml,bl),r=0,t=n=!1,F([a,i,c,k,x,S,L,V,R,E],Wl))),Ql),Ql={getContent:()=>[gl(),wl()],getTables:gl,getTableIds:pl,getTable:e=>nt(Yl(U,T(e))),getTableCellIds:e=>Xl(Yl(D,T(e))),getRowCount:vl,getRowIds:fl,getSortedRowIds:Il,getRow:(e,l)=>tt(Yl(Yl(U,T(e)),T(l))),getCellIds:yl,getCell:Cl,getValues:wl,getValueIds:kl,getValue:xl,hasTables:()=>!Dl(U),hasTable:e=>Hl(U,T(e)),hasTableCell:(e,l)=>Hl(Yl(D,T(e)),T(l)),hasRow:(e,l)=>Hl(Yl(U,T(e)),T(l)),hasCell:(e,l,t)=>Hl(Yl(Yl(U,T(e)),T(l)),T(t)),hasValues:()=>!Dl(G),hasValue:e=>Hl(G,T(e)),getTablesJson:()=>se(U),getValuesJson:()=>se(G),getJson:()=>se([U,G]),getTablesSchemaJson:()=>se(M),getValuesSchemaJson:()=>se(z),getSchemaJson:()=>se([M,z]),hasTablesSchema:()=>e,hasValuesSchema:()=>l,setContent:([e,l])=>hl((()=>{(ne(e)?ql:Tl)(e),(ne(l)?Ll:Sl)(l)})),setTables:Tl,setTable:(e,l)=>hl((e=>xe(l,e)?Me(e,l):0),e),setRow:(e,l,t)=>hl(((e,l)=>Te(e,l,t)?je(e,We(e),l,t):0),e,l),addRow:(e,l,t=!0)=>jl((()=>{let n;return Te(e,n,l)&&(e=T(e),je(e,We(e),n=Qe(e,t?1:0),l)),n})),setPartialRow:(e,l,t)=>hl(((e,l)=>{if(Te(e,l,t,1)){const n=We(e);te(t,((t,s)=>$e(e,n,l,s,t)))}}),e,l),setCell:(e,l,t,n)=>hl(((e,l,t)=>q(Se(e,l,t,N(n)?n(Cl(e,l,t)):n),(n=>$e(e,We(e),l,t,n)))),e,l,t),setValues:Sl,setPartialValues:e=>hl((()=>Ve(e,1)?te(e,((e,l)=>De(l,e))):0)),setValue:(e,l)=>hl((e=>q(Re(e,N(l)?l(xl(e)):l),(l=>De(e,l)))),e),setTransactionChanges:e=>hl((()=>{te(e[0],((e,l)=>O(e)?Pl(l):te(e,((e,t)=>O(e)?Nl(l,t):te(e,((e,n)=>Fe(Ql,l,t,n,e))))))),te(e[1],((e,l)=>Be(Ql,l,e)))})),setTablesJson:Vl,setValuesJson:e=>{try{Ae(re(e))}catch(e){}return Ql},setJson:e=>{try{const[l,t]=re(e);Le(l),Ae(t)}catch(l){Vl(e)}return Ql},setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Pl,delRow:Nl,delCell:(e,l,t,n)=>hl(((e,l,t)=>q(Yl(U,e),(s=>q(Yl(s,l),(r=>Hl(r,t)?Ke(e,s,l,r,t,n):0))))),e,l,t),delValues:Ll,delValue:e=>hl((e=>Hl(G,e)?Xe(e):0),e),delTablesSchema:El,delValuesSchema:Ml,delSchema:()=>hl((()=>{El(),Ml()})),transaction:jl,startTransaction:zl,finishTransaction:$l,forEachTable:e=>Ul(U,((l,t)=>e(t,(e=>Ul(l,((l,t)=>e(t,(e=>Zl(l,e))))))))),forEachTableCell:(e,l)=>Zl(Yl(D,T(e)),l),forEachRow:(e,l)=>Ul(Yl(U,T(e)),((e,t)=>l(t,(l=>Zl(e,l))))),forEachCell:(e,l,t)=>Zl(Yl(Yl(U,T(e)),T(l)),t),forEachValue:e=>Zl(G,e),addSortedRowIdsListener:(e,l,t,n,s,r,a)=>{let o=Il(e,l,t,n,s);return Ie((()=>{const a=Il(e,l,t,n,s);var i,u,d;u=o,H(i=a)===H(u)&&(d=(e,l)=>u[l]===e,i.every(d))||(o=a,r(Ql,e,l,t,n,s,o))}),ie[a?1:0],[e,l],[pl])},addStartTransactionListener:e=>Ie(e,ve),addWillFinishTransactionListener:e=>Ie(e,fe[0]),addDidFinishTransactionListener:e=>Ie(e,fe[1]),callListener:e=>(we(e),Ql),delListener:e=>(Ce(e),Ql),getListenerStats:()=>({tables:yt(K),tableIds:yt(X),tableCellIds:yt(_),table:yt(Z),rowCount:yt(ae),rowIds:yt(oe),sortedRowIds:yt(ie),row:yt(ue,Fl),cellIds:yt(de,Fl),cell:yt(ce,Bl),invalidCell:yt(he,Bl),values:yt(be),valueIds:yt(ge),value:yt(pe),invalidValue:yt(me),transaction:Jl(ve)+yt(fe)}),createStore:St,addListener:Ie,callListeners:ye};return te({[m]:[0,K],[b]:[0,X],[h]:[1,Z,[pl]],[h+I]:[1,_,[pl]],[p]:[1,ae,[pl]],[v]:[1,oe,[pl]],[g]:[2,ue,[pl,fl]],[I]:[2,de,[pl,fl]],[f]:[3,ce,[pl,fl,yl],e=>It(Cl(...e))],InvalidCell:[3,he],[C]:[0,be],[w]:[0,ge],[y]:[1,pe,[kl],e=>It(xl(e[0]))],InvalidValue:[1,me]},(([e,l,t,n],s)=>{Ql["add"+s+"Listener"]=(...s)=>Ie(s[e],l[s[e+1]?1:0],e>0?Q(s,0,e):void 0,t,n)})),Y(Ql)},Vt=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(St),s=ie.indexOf(e);return t.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,a=[])=>{let o,i,u,d=0,c=0,h=0,m=0;et(dt,a,(()=>0)),et(ct,a,(()=>[]));const b=e=>ut(void 0,null,(function*(){return 2!=d&&(d=1,c++,yield g.schedule((()=>ut(void 0,null,(function*(){yield e(),d=0}))))),g})),g={load:(t,n)=>ut(void 0,null,(function*(){return yield b((()=>ut(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>ut(void 0,[...t],(function*(t={},s={}){return g.stopAutoLoad(),yield g.load(t,s),m=1,u=n(((t,n)=>ut(void 0,null,(function*(){if(n){const l=n();yield b((()=>ut(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield b((()=>ut(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),g})),stopAutoLoad:()=>(m&&(s(u),u=void 0,m=0),g),save:l=>ut(void 0,null,(function*(){return 1!=d&&(d=2,h++,yield g.schedule((()=>ut(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}d=0}))))),g})),startAutoSave:()=>ut(void 0,null,(function*(){return yield g.stopAutoSave().save(),o=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();ne(t)&&ne(n)||g.save((()=>[t,n]))})),g})),stopAutoSave:()=>(q(o,e.delListener),g),schedule:(...e)=>ut(void 0,null,(function*(){return W(Yl(ct,a),...e),yield ut(void 0,null,(function*(){if(!Yl(dt,a)){for(_l(dt,a,1);!O(i=U(Yl(ct,a)));)try{yield i()}catch(e){null==r||r(e)}_l(dt,a,0)}})),g})),getStore:()=>e,destroy:()=>g.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return Y(g)})(e,(()=>ht(void 0,null,(function*(){return re(t.getItem(l))}))),(e=>ht(void 0,null,(function*(){return t.setItem(l,se(e()))}))),(e=>{const n=n=>{n.storageArea===t&&n.key===l&&e((()=>re(n.newValue)))};return bt.addEventListener(mt,n),n}),(e=>bt.removeEventListener(mt,e)),n))(e,ae,sessionStorage,l);var l}),void 0,(e=>{return t=function*(){yield e.load(void 0,{position:-1==s?1:s,open:!!l}),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=l=>l.done?e(l.value):Promise.resolve(l.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),E(M,null,E("aside",{id:ae},E($e,{s:n}),E(zl,{s:n})),E("style",null,ze))};var Rt=Object.defineProperty,Ot=Object.getOwnPropertySymbols,qt=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable,Nt=(e,l,t)=>l in e?Rt(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;e.EditableCellView=yl,e.EditableValueView=Cl,e.RelationshipInHtmlTable=fl,e.ResultSortedTableInHtmlTable=Il,e.ResultTableInHtmlTable=e=>{var l=e,{queryId:n,queries:s,customCells:r}=l,a=_e(l,["queryId","queries","customCells"]);return E(cl,Ze(Ye({},a),{params:al(dl(t.useResultTableCellIds(n,s),r,t.ResultCellView),il(s,n),t.useResultRowIds(n,s))}))},e.SliceInHtmlTable=vl,e.SortedTableInHtmlTable=gl,e.SortedTablePaginator=wl,e.StoreInspector=e=>E(Vt,((e,l)=>{for(var t in l||(l={}))qt.call(l,t)&&Nt(e,t,l[t]);if(Ot)for(var t of Ot(l))Pt.call(l,t)&&Nt(e,t,l[t]);return e})({},e)),e.TableInHtmlTable=e=>{var l=e,{tableId:n,store:s,editable:r,customCells:a}=l,o=_e(l,["tableId","store","editable","customCells"]);return E(cl,Ze(Ye({},o),{params:al(dl(t.useTableCellIds(n,s),a,r?yl:t.CellView),ol(s,n),t.useRowIds(n,s))}))},e.ValuesInHtmlTable=pl},"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDomDebug={},e.React,e.TinyBaseUiReact);
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e,t,l){"use strict";const n=e=>typeof e,a=n(""),o=n(!0),r=n(0),i="Value",s="currentTarget",d="value",u=isFinite,c=e=>null==e,{createElement:m,Fragment:b,useCallback:h,useRef:p,useState:g}=t,f=(e,...t)=>c(e)?{}:e(...t),w=(e,t)=>e.map(t),I=Object,y=(e=[])=>I.fromEntries(e),v=(e,t)=>w(I.entries(e),(([e,l])=>t(l,e))),C="tinybaseStoreInspector",k="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",x='content:url("',R=x+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",T='</svg>")',O=x+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",N=w([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>R+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+T)),S=R+"<path d='M20 20l60 60M20 80l60-60' />"+T,V=R+`<path d='${k}' />`+T,j=R+`<path d='${k}M20 20l60 60' />`+T;var z=Object.defineProperty,P=Object.defineProperties,$=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,B=(e,t,l)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,E=(e,t)=>{for(var l in t||(t={}))M.call(t,l)&&B(e,l,t[l]);if(q)for(var l of q(t))H.call(t,l)&&B(e,l,t[l]);return e},F=(e,t)=>P(e,$(t));const D="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(v(F(E(F(E(F(E({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[D]:"width:0.5rem;height:0.5rem;",[D+"-track"]:"background:#111",[D+"-thumb"]:"background:#999;border:1px solid #111",[D+"-thumb:hover"]:"background:#fff",[D+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+O},y(w(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),y(w(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":O,"header>img:nth-of-type(6)":S}),y(w(N,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":V,"details[open]>summary img.done":j,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${C} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left"}),((e,t)=>e?`#${C} ${t}{${e}}`:"")));const A=(e,t,l,n)=>e==a?t:e==r?l:n;var U=Object.defineProperty,L=Object.defineProperties,G=Object.getOwnPropertyDescriptors,J=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,W=(e,t,l)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,X=(e,t)=>{for(var l in t||(t={}))K.call(t,l)&&W(e,l,t[l]);if(J)for(var l of J(t))Q.call(t,l)&&W(e,l,t[l]);return e},Y=(e,t)=>L(e,G(t)),Z=(e,t)=>{var l={};for(var n in e)K.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&J)for(var n of J(e))t.indexOf(n)<0&&Q.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:_,useMemo:ee,useState:te}=t,le="editable",ne=(e,t)=>w(l.useTableCellIds(e,t),(t=>e+"."+t)),ae=(e,t,l)=>{const n=_(e,t);return l?n:void 0},oe=(...e)=>ee((()=>e),e),re=(e,t)=>ee((()=>({store:e,tableId:t})),[e,t]),ie=(e,t)=>ee((()=>({queries:e,queryId:t})),[e,t]),se=(e,t=!1,l,n=0,a,o,r,i)=>{const[[s,d,u],c]=te([e,t,n]),b=_((e=>{c(e),null==i||i(e)}),[i]),h=ae((e=>b([e,e==s&&!d,u])),[b,s,d,u],l),p=_((e=>b([s,d,e])),[b,s,d]),g=!0===r?ge:r;return[[s,d,u],h,ee((()=>!1===r?null:m(g,{offset:u,limit:a,total:o,onChange:p})),[r,g,u,a,o,p])]},de=(e,t,l)=>ee((()=>{const o=null!=t?t:e;return y(v(Array.isArray(o)?y(w(o,(e=>[e,e]))):o,((e,t)=>{return[t,X(X({},{label:t,component:l}),(o=e,n(o)==a?{label:e}:e))];var o})))}),[t,l,e]),ue=({className:e,headerRow:t,idColumn:l,params:[n,a,o,r,i,s]})=>m("table",{className:e},s?m("caption",null,s):null,!1===t?null:m("thead",null,m("tr",null,!1===l?null:m(ce,{sort:null!=r?r:[],label:"Id",onClick:i}),v(n,(({label:e},t)=>m(ce,{key:t,cellId:t,label:e,sort:null!=r?r:[],onClick:i}))))),m("tbody",null,w(o,(e=>m("tr",{key:e},!1===l?null:m("th",null,e),v(n,(({component:t,getComponentProps:l},n)=>m("td",{key:n},m(t,Y(X(X({},f(l,e,n)),a),{rowId:e,cellId:n})))))))))),ce=({cellId:e,sort:[t,l],label:n=(null!=e?e:""),onClick:a})=>m("th",{onClick:ae((()=>null==a?void 0:a(e)),[a,e],a),className:c(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},c(l)||t!=e?null:(l?"↓":"↑")+" ",n),me=({localRowId:e,params:[n,a,o,r,i,s,d]})=>{const u=l.useRemoteRowId(i,e,s);return m("tr",null,!1===n?null:m(t.Fragment,null,m("th",null,e),m("th",null,u)),v(a,(({component:t,getComponentProps:l},n)=>{const[a,i]=n.split(".",2),s=a===o?e:a===r?u:null;return c(s)?null:m("td",{key:n},m(t,Y(X({},f(l,s,i)),{store:d,tableId:a,rowId:s,cellId:i})))})))},be=({thing:e,onThingChange:t,className:l})=>{const[i,c]=te(),[b,h]=te(),[p,g]=te(),[f,w]=te(),[I,y]=te();b!==e&&(c((e=>{const t=n(e);return(e=>e==a||e==o)(t)||t==r&&u(e)?t:void 0})(e)),h(e),g(e+""),w(Number(e)||0),y(!!e));const v=_(((e,l)=>{l(e),h(e),t(e)}),[t]);return m("div",{className:l},m("button",{className:i,onClick:_((()=>{const e=A(i,r,o,a),l=A(e,p,f,I);c(e),h(l),t(l)}),[t,p,f,I,i])},i),A(i,m("input",{key:i,value:p,onChange:_((e=>v(e[s][d]+"",g)),[v])}),m("input",{key:i,type:"number",value:f,onChange:_((e=>v(Number(e[s][d]||0),w)),[v])}),m("input",{key:i,type:"checkbox",checked:I,onChange:_((e=>v(!!e[s].checked,y)),[v])})))},he=({tableId:e,rowId:t,cellId:n,store:a,className:o})=>m(be,{thing:l.useCell(e,t,n,a),onThingChange:l.useSetCellCallback(e,t,n,(e=>e),[],a),className:null!=o?o:le+"Cell"}),pe=({valueId:e,store:t,className:n})=>m(be,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=n?n:le+i}),ge=({onChange:e,total:l,offset:n=0,limit:a=l,singular:o="row",plural:r=o+"s"})=>{(n>l||n<0)&&(n=0,e(0));const i=ae((()=>e(n-a)),[e,n,a],n>0),s=ae((()=>e(n+a)),[e,n,a],n+a<l);return m(t.Fragment,null,l>a&&m(t.Fragment,null,m("button",{className:"previous",disabled:0==n,onClick:i},"←"),m("button",{className:"next",disabled:n+a>=l,onClick:s},"→"),n+1," to ",Math.min(l,n+a)," of "),l," ",1!=l?r:o)},fe=e=>new Map(e);fe(),fe(),e.EditableCellView=he,e.EditableValueView=pe,e.RelationshipInHtmlTable=({relationshipId:e,relationships:n,editable:a,customCells:o,className:r,headerRow:i,idColumn:s=!0})=>{const[d,u,c,b]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(l.useRelationshipsOrRelationshipsById(n),e),h=de([...ne(c,u),...ne(b,u)],o,a?he:l.CellView),p=oe(s,h,c,b,e,d,u);return m("table",{className:r},!1===i?null:m("thead",null,m("tr",null,!1===s?null:m(t.Fragment,null,m("th",null,c,".Id"),m("th",null,b,".Id")),v(h,(({label:e},t)=>m("th",{key:t},e))))),m("tbody",null,w(l.useRowIds(c,u),(e=>m(me,{key:e,localRowId:e,params:p})))))},e.ResultSortedTableInHtmlTable=e=>{var t=e,{queryId:n,cellId:a,descending:o,offset:r,limit:i,queries:s,sortOnClick:d,paginator:u=!1,customCells:c,onChange:b}=t,h=Z(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,g,f]=se(a,o,d,r,i,l.useResultRowCount(n,s),u,b);return m(ue,Y(X({},h),{params:oe(de(l.useResultTableCellIds(n,s),c,l.ResultCellView),ie(s,n),l.useResultSortedRowIds(n,...p,i,s),p,g,f)}))},e.ResultTableInHtmlTable=e=>{var t=e,{queryId:n,queries:a,customCells:o}=t,r=Z(t,["queryId","queries","customCells"]);return m(ue,Y(X({},r),{params:oe(de(l.useResultTableCellIds(n,a),o,l.ResultCellView),ie(a,n),l.useResultRowIds(n,a))}))},e.SliceInHtmlTable=e=>{var t=e,{indexId:n,sliceId:a,indexes:o,editable:r,customCells:i}=t,s=Z(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(l.useIndexesOrIndexesById(o),n);return m(ue,Y(X({},s),{params:oe(de(l.useTableCellIds(c,u),i,r?he:l.CellView),re(u,c),l.useSliceRowIds(n,a,d))}))},e.SortedTableInHtmlTable=e=>{var t=e,{tableId:n,cellId:a,descending:o,offset:r,limit:i,store:s,editable:d,sortOnClick:u,paginator:c=!1,onChange:b,customCells:h}=t,p=Z(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,w]=se(a,o,u,r,i,l.useRowCount(n,s),c,b);return m(ue,Y(X({},p),{params:oe(de(l.useTableCellIds(n,s),h,d?he:l.CellView),re(s,n),l.useSortedRowIds(n,...g,i,s),g,f,w)}))},e.SortedTablePaginator=ge,e.StoreInspector=e=>null,e.TableInHtmlTable=e=>{var t=e,{tableId:n,store:a,editable:o,customCells:r}=t,i=Z(t,["tableId","store","editable","customCells"]);return m(ue,Y(X({},i),{params:oe(de(l.useTableCellIds(n,a),r,o?he:l.CellView),re(a,n),l.useRowIds(n,a))}))},e.ValuesInHtmlTable=({store:e,editable:t=!1,valueComponent:n=(t?pe:l.ValueView),getValueComponentProps:a,className:o,headerRow:r,idColumn:s})=>m("table",{className:o},!1===r?null:m("thead",null,m("tr",null,!1===s?null:m("th",null,"Id"),m("th",null,i))),m("tbody",null,w(l.useValueIds(e),(t=>m("tr",{key:t},!1===s?null:m("th",null,t),m("td",null,m(n,Y(X({},f(a,t)),{valueId:t,store:e}))))))))},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDom={},e.React,e.TinyBaseUiReact);
|
|
1
|
+
var e,t;e=this,t=function(e,t,l){"use strict";const a=e=>typeof e,n=a(""),r=a(!0),o=a(0),i="Value",s="currentTarget",d="value",u=isFinite,c=e=>null==e,{createElement:m,Fragment:h,useCallback:b,useLayoutEffect:p,useRef:g,useState:f}=t,w=(e,...t)=>c(e)?{}:e(...t),v=(e,t)=>e.map(t),y=Object,I=(e=[])=>y.fromEntries(e),C=(e,t)=>v(y.entries(e),(([e,l])=>t(l,e))),k="tinybaseStoreInspector",x="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",R='content:url("',T=R+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",O='</svg>")',S=R+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",N=v([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,a])=>T+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${a}' fill='white'/>`+O)),V=T+"<path d='M20 20l60 60M20 80l60-60' />"+O,j=T+`<path d='${x}' />`+O,z=T+`<path d='${x}M20 20l60 60' />`+O;var P=Object.defineProperty,$=Object.defineProperties,q=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,H=(e,t,l)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,F=(e,t)=>{for(var l in t||(t={}))B.call(t,l)&&H(e,l,t[l]);if(M)for(var l of M(t))E.call(t,l)&&H(e,l,t[l]);return e},D=(e,t)=>$(e,q(t));const A="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(C(D(F(D(F(D(F({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[A]:"width:0.5rem;height:0.5rem;",[A+"-track"]:"background:#111",[A+"-thumb"]:"background:#999;border:1px solid #111",[A+"-thumb:hover"]:"background:#fff",[A+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+S},I(v(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),I(v(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":S,"header>img:nth-of-type(6)":V}),I(v(N,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":j,"details[open]>summary img.done":z,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${k} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left"}),((e,t)=>e?`#${k} ${t}{${e}}`:"")));const L=(e,t,l,a)=>e==n?t:e==o?l:a;var U=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,X=(e,t,l)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Y=(e,t)=>{for(var l in t||(t={}))Q.call(t,l)&&X(e,l,t[l]);if(K)for(var l of K(t))W.call(t,l)&&X(e,l,t[l]);return e},Z=(e,t)=>G(e,J(t)),_=(e,t)=>{var l={};for(var a in e)Q.call(e,a)&&t.indexOf(a)<0&&(l[a]=e[a]);if(null!=e&&K)for(var a of K(e))t.indexOf(a)<0&&W.call(e,a)&&(l[a]=e[a]);return l};const{useCallback:ee,useMemo:te,useState:le}=t,ae="editable",ne=(e,t)=>v(l.useTableCellIds(e,t),(t=>e+"."+t)),re=(e,t,l)=>{const a=ee(e,t);return l?a:void 0},oe=(...e)=>te((()=>e),e),ie=(e,t)=>te((()=>({store:e,tableId:t})),[e,t]),se=(e,t)=>te((()=>({queries:e,queryId:t})),[e,t]),de=(e,t=!1,l,a=0,n,r,o,i)=>{const[[s,d,u],c]=le([e,t,a]),h=ee((e=>{c(e),null==i||i(e)}),[i]),b=re((e=>h([e,e==s&&!d,u])),[h,s,d,u],l),p=ee((e=>h([s,d,e])),[h,s,d]),g=!0===o?fe:o;return[[s,d,u],b,te((()=>!1===o?null:m(g,{offset:u,limit:n,total:r,onChange:p})),[o,g,u,n,r,p])]},ue=(e,t,l)=>te((()=>{const r=null!=t?t:e;return I(C(Array.isArray(r)?I(v(r,(e=>[e,e]))):r,((e,t)=>{return[t,Y(Y({},{label:t,component:l}),(r=e,a(r)==n?{label:e}:e))];var r})))}),[t,l,e]),ce=({className:e,headerRow:t,idColumn:l,params:[a,n,r,o,i,s]})=>m("table",{className:e},s?m("caption",null,s):null,!1===t?null:m("thead",null,m("tr",null,!1===l?null:m(me,{sort:null!=o?o:[],label:"Id",onClick:i}),C(a,(({label:e},t)=>m(me,{key:t,cellId:t,label:e,sort:null!=o?o:[],onClick:i}))))),m("tbody",null,v(r,(e=>m("tr",{key:e},!1===l?null:m("th",null,e),C(a,(({component:t,getComponentProps:l},a)=>m("td",{key:a},m(t,Z(Y(Y({},w(l,e,a)),n),{rowId:e,cellId:a})))))))))),me=({cellId:e,sort:[t,l],label:a=(null!=e?e:""),onClick:n})=>m("th",{onClick:re((()=>null==n?void 0:n(e)),[n,e],n),className:c(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},c(l)||t!=e?null:(l?"↓":"↑")+" ",a),he=({localRowId:e,params:[a,n,r,o,i,s,d]})=>{const u=l.useRemoteRowId(i,e,s);return m("tr",null,!1===a?null:m(t.Fragment,null,m("th",null,e),m("th",null,u)),C(n,(({component:t,getComponentProps:l},a)=>{const[n,i]=a.split(".",2),s=n===r?e:n===o?u:null;return c(s)?null:m("td",{key:a},m(t,Z(Y({},w(l,s,i)),{store:d,tableId:n,rowId:s,cellId:i})))})))},be=({thing:e,onThingChange:t,className:l,hasSchema:i})=>{const[c,h]=le(),[b,p]=le(),[g,f]=le(),[w,v]=le(),[y,I]=le();b!==e&&(h((e=>{const t=a(e);return(e=>e==n||e==r)(t)||t==o&&u(e)?t:void 0})(e)),p(e),f(e+""),v(Number(e)||0),I(!!e));const C=ee(((e,l)=>{l(e),p(e),t(e)}),[t]);return m("div",{className:l},m("button",{className:c,onClick:ee((()=>{if(!(null==i?void 0:i())){const e=L(c,o,r,n),l=L(e,g,w,y);h(e),p(l),t(l)}}),[i,t,g,w,y,c])},c),L(c,m("input",{key:c,value:g,onChange:ee((e=>C(e[s][d]+"",f)),[C])}),m("input",{key:c,type:"number",value:w,onChange:ee((e=>C(Number(e[s][d]||0),v)),[C])}),m("input",{key:c,type:"checkbox",checked:y,onChange:ee((e=>C(!!e[s].checked,I)),[C])})))},pe=({tableId:e,rowId:t,cellId:a,store:n,className:r})=>{var o;return m(be,{thing:l.useCell(e,t,a,n),onThingChange:l.useSetCellCallback(e,t,a,(e=>e),[],n),className:null!=r?r:ae+"Cell",hasSchema:null==(o=l.useStoreOrStoreById(n))?void 0:o.hasTablesSchema})},ge=({valueId:e,store:t,className:a})=>{var n;return m(be,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=a?a:ae+i,hasSchema:null==(n=l.useStoreOrStoreById(t))?void 0:n.hasValuesSchema})},fe=({onChange:e,total:l,offset:a=0,limit:n=l,singular:r="row",plural:o=r+"s"})=>{(a>l||a<0)&&(a=0,e(0));const i=re((()=>e(a-n)),[e,a,n],a>0),s=re((()=>e(a+n)),[e,a,n],a+n<l);return m(t.Fragment,null,l>n&&m(t.Fragment,null,m("button",{className:"previous",disabled:0==a,onClick:i},"←"),m("button",{className:"next",disabled:a+n>=l,onClick:s},"→"),a+1," to ",Math.min(l,a+n)," of "),l," ",1!=l?o:r)},we=e=>new Map(e);we(),we(),e.EditableCellView=pe,e.EditableValueView=ge,e.RelationshipInHtmlTable=({relationshipId:e,relationships:a,editable:n,customCells:r,className:o,headerRow:i,idColumn:s=!0})=>{const[d,u,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(l.useRelationshipsOrRelationshipsById(a),e),b=ue([...ne(c,u),...ne(h,u)],r,n?pe:l.CellView),p=oe(s,b,c,h,e,d,u);return m("table",{className:o},!1===i?null:m("thead",null,m("tr",null,!1===s?null:m(t.Fragment,null,m("th",null,c,".Id"),m("th",null,h,".Id")),C(b,(({label:e},t)=>m("th",{key:t},e))))),m("tbody",null,v(l.useRowIds(c,u),(e=>m(he,{key:e,localRowId:e,params:p})))))},e.ResultSortedTableInHtmlTable=e=>{var t=e,{queryId:a,cellId:n,descending:r,offset:o,limit:i,queries:s,sortOnClick:d,paginator:u=!1,customCells:c,onChange:h}=t,b=_(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,g,f]=de(n,r,d,o,i,l.useResultRowCount(a,s),u,h);return m(ce,Z(Y({},b),{params:oe(ue(l.useResultTableCellIds(a,s),c,l.ResultCellView),se(s,a),l.useResultSortedRowIds(a,...p,i,s),p,g,f)}))},e.ResultTableInHtmlTable=e=>{var t=e,{queryId:a,queries:n,customCells:r}=t,o=_(t,["queryId","queries","customCells"]);return m(ce,Z(Y({},o),{params:oe(ue(l.useResultTableCellIds(a,n),r,l.ResultCellView),se(n,a),l.useResultRowIds(a,n))}))},e.SliceInHtmlTable=e=>{var t=e,{indexId:a,sliceId:n,indexes:r,editable:o,customCells:i}=t,s=_(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(l.useIndexesOrIndexesById(r),a);return m(ce,Z(Y({},s),{params:oe(ue(l.useTableCellIds(c,u),i,o?pe:l.CellView),ie(u,c),l.useSliceRowIds(a,n,d))}))},e.SortedTableInHtmlTable=e=>{var t=e,{tableId:a,cellId:n,descending:r,offset:o,limit:i,store:s,editable:d,sortOnClick:u,paginator:c=!1,onChange:h,customCells:b}=t,p=_(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,w]=de(n,r,u,o,i,l.useRowCount(a,s),c,h);return m(ce,Z(Y({},p),{params:oe(ue(l.useTableCellIds(a,s),b,d?pe:l.CellView),ie(s,a),l.useSortedRowIds(a,...g,i,s),g,f,w)}))},e.SortedTablePaginator=fe,e.StoreInspector=e=>null,e.TableInHtmlTable=e=>{var t=e,{tableId:a,store:n,editable:r,customCells:o}=t,i=_(t,["tableId","store","editable","customCells"]);return m(ce,Z(Y({},i),{params:oe(ue(l.useTableCellIds(a,n),o,r?pe:l.CellView),ie(n,a),l.useRowIds(a,n))}))},e.ValuesInHtmlTable=({store:e,editable:t=!1,valueComponent:a=(t?ge:l.ValueView),getValueComponentProps:n,className:r,headerRow:o,idColumn:s})=>m("table",{className:r},!1===o?null:m("thead",null,m("tr",null,!1===s?null:m("th",null,"Id"),m("th",null,i))),m("tbody",null,v(l.useValueIds(e),(t=>m("tr",{key:t},!1===s?null:m("th",null,t),m("td",null,m(a,Z(Y({},w(n,t)),{valueId:t,store:e}))))))))},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDom={},e.React,e.TinyBaseUiReact);
|
|
Binary file
|
package/lib/umd-es6/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Result",u="Ids",n="Table",d=n+"s",i=n+u,a="Row",c=a+"Count",I=a+u,p="Sorted"+a+u,C="Cell",b=C+u,w="Value",R=w+"s",k=w+u,v=e=>null==e,g=(e,s,t)=>v(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},h=(e,s)=>e.map(s),f=Object.keys,{createContext:L,useContext:V}=s,S=L([]),T=(e,s)=>{const t=V(S);return v(e)?t[s]:y(e)?((e,s)=>g(e,(e=>e[s])))(t[s+1],e):e},x=(e,s)=>{const t=T(e,s);return v(e)||y(e)?t:e},P=e=>f(V(S)[e]),O=e=>x(e,0),q=e=>x(e,2),B=e=>x(e,4),M=e=>x(e,6),j=e=>x(e,8),D=e=>x(e,10),{useCallback:Q,useEffect:F,useMemo:A,useRef:E,useState:G}=s,U=(e,s,t=[])=>{const o=A((()=>s(e)),[e,...t]);return F((()=>()=>o.destroy()),[o]),o},z=(e,s,t,o=[],l)=>{const[,r]=G(),u=Q((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[n]=G(u),d=E(n);return A((()=>d.current=u()),[u]),H(e,s,((...e)=>{d.current=v(l)?u():e[l],r([])}),[],o),d.current},H=(e,s,t,o=[],l=[],...r)=>F((()=>{var o;const u=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...l,...o,...r]),J=(e,s,t,o=[],l=m,r=[],...u)=>{const n=O(e);return Q((e=>g(n,(o=>g(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},K=(e,s,t=m,o=[],...l)=>{const r=O(e);return Q((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},N=(e,s,t)=>{const o=D(e);return Q((()=>null==o?void 0:o[s](t)),[o,s,t])},W=e=>z(i,O(e),[],[]),X=(e,s)=>z(I,O(s),[],[e]),Y=(e,s,t,o=0,l,r)=>z(p,O(r),[],[e,s,t,o,l],6),Z=(e,s,t)=>z(b,O(t),[],[e,s]),$=(e,s,t,o)=>z(C,O(o),void 0,[e,s,t],4),_=e=>z(k,O(e),[],[]),ee=(e,s)=>z(w,O(s),void 0,[e]),se=(e,s)=>z("Metric",q(s),void 0,[e]),te=(e,s)=>z("SliceIds",B(s),[],[e]),oe=(e,s,t)=>z("Slice"+I,B(t),[],[e,s]),le=(e,s,t)=>z("RemoteRowId",M(t),void 0,[e,s]),re=(e,s,t)=>z("Local"+I,M(t),[],[e,s]),ue=(e,s,t)=>z("Linked"+I,M(t),[],[e,s]),ne=(e,s)=>z(r+I,j(s),[],[e]),de=(e,s,t,o=0,l,u)=>z(r+p,j(u),[],[e,s,t,o,l],6),ie=(e,s,t)=>z(r+b,j(t),[],[e,s]),ae=(e,s,t,o)=>z(r+C,j(o),void 0,[e,s,t]),ce=e=>z("CheckpointIds",D(e),[[],void 0,[]]),Ie=(e,s)=>z("Checkpoint",D(s),void 0,[e]),pe=e=>N(e,"goBackward"),Ce=e=>N(e,"goForward"),{createElement:be,Fragment:we,useCallback:Re,useRef:ke,useState:ve}=s,ge=(e,...s)=>v(e)?{}:e(...s),ye=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var me=Object.defineProperty,he=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,Ve=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,Te=(e,s,t)=>s in e?me(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,xe=(e,s)=>{for(var t in s||(s={}))Ve.call(s,t)&&Te(e,t,s[t]);if(Le)for(var t of Le(s))Se.call(s,t)&&Te(e,t,s[t]);return e},Pe=(e,s)=>he(e,fe(s)),Oe=(e,s)=>{var t={};for(var o in e)Ve.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Le)for(var o of Le(e))s.indexOf(o)<0&&Se.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:qe}=s,Be=({tableId:e,store:s,rowComponent:t=Ae,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Qe(h(n,(r=>be(t,Pe(xe({},ge(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),Me=({queryId:e,queries:s,resultRowComponent:t=He,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Qe(h(u,(l=>be(t,Pe(xe({},ge(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),je=({relationshipId:e,relationships:s,rowComponent:t=Ae,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=ye(M(s),e),c=u(e,n,d);return Qe(h(c,(e=>be(t,Pe(xe({},ge(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},De=e=>({checkpoints:s,checkpointComponent:t=Je,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=D(s);return Qe(h(e(ce(u)),(e=>be(t,Pe(xe({},ge(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Qe=(e,s,t,o)=>{const l=v(s)||!Array.isArray(e)?e:h(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},Fe=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Qe(o+(null!=(u=$(e,s,t,l))?u:o),void 0,r,t)},Ae=({tableId:e,rowId:s,store:t,cellComponent:o=Fe,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Qe(h(((e,s,t,o)=>{const l=Z(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>be(o,Pe(xe({},ge(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Ee=e=>Be(e,X(e.tableId,e.store)),Ge=({valueId:e,store:s,debugIds:t})=>{var l;return Qe(o+(null!=(l=ee(e,s))?l:o),void 0,t,e)},Ue=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ae,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(B(t),e),a=oe(e,s,n);return Qe(h(a,(e=>be(o,Pe(xe({},ge(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ze=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Qe(o+(null!=(u=ae(e,s,t,l))?u:o),void 0,r,t)},He=({queryId:e,rowId:s,queries:t,resultCellComponent:o=ze,getResultCellComponentProps:l,separator:r,debugIds:u})=>Qe(h(ie(e,s,t),(r=>be(o,Pe(xe({},ge(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Je=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Qe(null!=(l=Ie(s,e))?l:o,void 0,t,s)},Ke=De((e=>e[0])),Ne=De((e=>v(e[1])?[]:[e[1]])),We=De((e=>e[2]));e.BackwardCheckpointsView=Ke,e.CellView=Fe,e.CheckpointView=Je,e.CurrentCheckpointView=Ne,e.ForwardCheckpointsView=We,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ue,getSliceComponentProps:o,separator:l,debugIds:r})=>Qe(h(te(e,s),(l=>be(t,Pe(xe({},ge(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>je(e,ue,e.firstRowId),e.LocalRowsView=e=>je(e,re,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Qe(null!=(l=se(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(S);return be(S.Provider,{value:qe((()=>[null!=e?e:C[0],xe(xe({},C[1]),t),null!=o?o:C[2],xe(xe({},C[3]),l),null!=r?r:C[4],xe(xe({},C[5]),u),null!=n?n:C[6],xe(xe({},C[7]),d),null!=i?i:C[8],xe(xe({},C[9]),a),null!=c?c:C[10],xe(xe({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ae,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=ye(M(t),e),i=le(e,s,u);return Qe(v(d)||v(i)?null:be(o,Pe(xe({},ge(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ze,e.ResultRowView=He,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=Oe(s,["cellId","descending","offset","limit"]);return Me(u,de(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>Me(e,ne(e.queryId,e.queries)),e.RowView=Ae,e.SliceView=Ue,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=Oe(s,["cellId","descending","offset","limit"]);return Be(u,Y(u.tableId,t,o,l,r,u.store))},e.TableView=Ee,e.TablesView=({store:e,tableComponent:s=Ee,getTableComponentProps:t,separator:o,debugIds:l})=>Qe(h(W(e),(o=>be(s,Pe(xe({},ge(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Ge,e.ValuesView=({store:e,valueComponent:s=Ge,getValueComponentProps:t,separator:o,debugIds:l})=>Qe(h(_(e),(o=>be(s,Pe(xe({},ge(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=O(o);return Q((t=>g(n,(o=>g(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=$,e.useCellIds=Z,e.useCellIdsListener=(e,s,t,o,l,r)=>H(b,O(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>H(C,O(u),o,l,[e,s,t],r),e.useCheckpoint=Ie,e.useCheckpointIds=ce,e.useCheckpointIdsListener=(e,s,t)=>H("CheckpointIds",D(t),e,s),e.useCheckpointListener=(e,s,t,o)=>H("Checkpoint",D(o),s,t,[e]),e.useCheckpoints=e=>T(e,10),e.useCheckpointsIds=()=>P(11),e.useCheckpointsOrCheckpointsById=D,e.useCreateCheckpoints=(e,s,t)=>U(e,s,t),e.useCreateIndexes=(e,s,t)=>U(e,s,t),e.useCreateMetrics=(e,s,t)=>U(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=G(),u=A((()=>s(e)),[e,...t]);return F((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>U(e,s,t),e.useCreateRelationships=(e,s,t)=>U(e,s,t),e.useCreateStore=(e,s=[])=>A(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>K(l,C,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>K(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>K(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>K(e,d,s,t),e.useDelValueCallback=(e,s,t,o)=>K(s,w,t,o,e),e.useDelValuesCallback=(e,s,t)=>K(e,R,s,t),e.useGoBackwardCallback=pe,e.useGoForwardCallback=Ce,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=D(t);return Q((s=>g(r,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>z("IndexIds",B(e),[]),e.useIndexes=e=>T(e,4),e.useIndexesIds=()=>P(5),e.useIndexesOrIndexesById=B,e.useLinkedRowIds=ue,e.useLinkedRowIdsListener=(e,s,t,o,l)=>H("Linked"+I,M(l),t,o,[e,s]),e.useLocalRowIds=re,e.useLocalRowIdsListener=(e,s,t,o,l)=>H("Local"+I,M(l),t,o,[e,s]),e.useMetric=se,e.useMetricIds=e=>z("MetricIds",q(e),[]),e.useMetricListener=(e,s,t,o)=>H("Metric",q(o),s,t,[e]),e.useMetrics=e=>T(e,2),e.useMetricsIds=()=>P(3),e.useMetricsOrMetricsById=q,e.useQueries=e=>T(e,8),e.useQueriesIds=()=>P(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>z("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=D(e),[,,[l]]=ce(t);return[!v(l),Ce(t),l,null!=(s=g(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>z("RelationshipIds",M(e),[]),e.useRelationships=e=>T(e,6),e.useRelationshipsIds=()=>P(7),e.useRelationshipsOrRelationshipsById=M,e.useRemoteRowId=le,e.useRemoteRowIdListener=(e,s,t,o,l)=>H("RemoteRowId",M(l),t,o,[e,s]),e.useResultCell=ae,e.useResultCellIds=ie,e.useResultCellIdsListener=(e,s,t,o,l)=>H(r+b,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,u)=>H(r+C,j(u),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>z(r+a,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>z(r+c,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>H(r+c,j(o),s,t,[e]),e.useResultRowIds=ne,e.useResultRowIdsListener=(e,s,t,o)=>H(r+I,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>H(r+a,j(l),t,o,[e,s]),e.useResultSortedRowIds=de,e.useResultSortedRowIdsListener=(e,s,t,o,l,u,n,d)=>H(r+p,j(d),u,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>z(r+n,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>z(r+n+b,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>H(r+n+b,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>H(r+n,j(o),s,t,[e]),e.useRow=(e,s,t)=>z(a,O(t),{},[e,s]),e.useRowCount=(e,s)=>z(c,O(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>H(c,O(l),s,t,[e],o),e.useRowIds=X,e.useRowIdsListener=(e,s,t,o,l)=>H(I,O(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>H(a,O(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>J(r,C,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=D(t);return Q((s=>g(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>J(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>J(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>J(l,a,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>J(o,n,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>J(t,d,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>J(o,w,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>J(t,R,e,s,o,l),e.useSliceIds=te,e.useSliceIdsListener=(e,s,t,o)=>H("SliceIds",B(o),s,t,[e]),e.useSliceRowIds=oe,e.useSliceRowIdsListener=(e,s,t,o,l)=>H("Slice"+I,B(l),t,o,[e,s]),e.useSortedRowIds=Y,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>H(p,O(d),r,u,[e,s,t,o,l],n),e.useStore=e=>T(e,0),e.useStoreIds=()=>P(1),e.useStoreOrStoreById=O,e.useTable=(e,s)=>z(n,O(s),{},[e]),e.useTableCellIds=(e,s)=>z(n+b,O(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>H(n+b,O(l),s,t,[e],o),e.useTableIds=W,e.useTableIdsListener=(e,s,t,o)=>H(i,O(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>H(n,O(l),s,t,[e],o),e.useTables=e=>z(d,O(e),{}),e.useTablesListener=(e,s,t,o)=>H(d,O(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=D(e),[l,r]=ce(t);return[(u=l,!(0==(e=>e.length)(u))),pe(t),r,null!=(s=g(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=ee,e.useValueIds=_,e.useValueIdsListener=(e,s,t,o)=>H(k,O(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>H(w,O(l),s,t,[e],o),e.useValues=e=>z(R,O(e),{}),e.useValuesListener=(e,s,t,o)=>H(R,O(o),e,s,[],t)},"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="",l=t(o),r="Result",u="Ids",n="Table",d=n+"s",i=n+u,a="Row",c=a+"Count",I=a+u,p="Sorted"+a+u,C="Cell",b=C+u,w="Value",R=w+"s",k=w+u,v=e=>null==e,g=(e,s,t)=>v(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},h=(e,s)=>e.map(s),f=Object.keys,{createContext:L,useContext:V}=s,S=L([]),T=(e,s)=>{const t=V(S);return v(e)?t[s]:y(e)?((e,s)=>g(e,(e=>e[s])))(t[s+1],e):e},x=(e,s)=>{const t=T(e,s);return v(e)||y(e)?t:e},P=e=>f(V(S)[e]),O=e=>x(e,0),q=e=>x(e,2),B=e=>x(e,4),M=e=>x(e,6),j=e=>x(e,8),D=e=>x(e,10),{useCallback:Q,useEffect:E,useMemo:F,useRef:A,useState:G}=s,U=(e,s,t=[])=>{const o=F((()=>s(e)),[e,...t]);return E((()=>()=>o.destroy()),[o]),o},z=(e,s,t,o=[],l)=>{const[,r]=G(),u=Q((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[n]=G(u),d=A(n);return F((()=>d.current=u()),[u]),H(e,s,((...e)=>{d.current=v(l)?u():e[l],r([])}),[],o),d.current},H=(e,s,t,o=[],l=[],...r)=>E((()=>{var o;const u=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...l,...o,...r]),J=(e,s,t,o=[],l=m,r=[],...u)=>{const n=O(e);return Q((e=>g(n,(o=>g(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},K=(e,s,t=m,o=[],...l)=>{const r=O(e);return Q((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},N=(e,s,t)=>{const o=D(e);return Q((()=>null==o?void 0:o[s](t)),[o,s,t])},W=e=>z(i,O(e),[],[]),X=(e,s)=>z(I,O(s),[],[e]),Y=(e,s,t,o=0,l,r)=>z(p,O(r),[],[e,s,t,o,l],6),Z=(e,s,t)=>z(b,O(t),[],[e,s]),$=(e,s,t,o)=>z(C,O(o),void 0,[e,s,t],4),_=e=>z(k,O(e),[],[]),ee=(e,s)=>z(w,O(s),void 0,[e]),se=(e,s)=>z("Metric",q(s),void 0,[e]),te=(e,s)=>z("SliceIds",B(s),[],[e]),oe=(e,s,t)=>z("Slice"+I,B(t),[],[e,s]),le=(e,s,t)=>z("RemoteRowId",M(t),void 0,[e,s]),re=(e,s,t)=>z("Local"+I,M(t),[],[e,s]),ue=(e,s,t)=>z("Linked"+I,M(t),[],[e,s]),ne=(e,s)=>z(r+I,j(s),[],[e]),de=(e,s,t,o=0,l,u)=>z(r+p,j(u),[],[e,s,t,o,l],6),ie=(e,s,t)=>z(r+b,j(t),[],[e,s]),ae=(e,s,t,o)=>z(r+C,j(o),void 0,[e,s,t]),ce=e=>z("CheckpointIds",D(e),[[],void 0,[]]),Ie=(e,s)=>z("Checkpoint",D(s),void 0,[e]),pe=e=>N(e,"goBackward"),Ce=e=>N(e,"goForward"),{createElement:be,Fragment:we,useCallback:Re,useLayoutEffect:ke,useRef:ve,useState:ge}=s,ye=(e,...s)=>v(e)?{}:e(...s),me=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var he=Object.defineProperty,fe=Object.defineProperties,Le=Object.getOwnPropertyDescriptors,Ve=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable,xe=(e,s,t)=>s in e?he(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Pe=(e,s)=>{for(var t in s||(s={}))Se.call(s,t)&&xe(e,t,s[t]);if(Ve)for(var t of Ve(s))Te.call(s,t)&&xe(e,t,s[t]);return e},Oe=(e,s)=>fe(e,Le(s)),qe=(e,s)=>{var t={};for(var o in e)Se.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Ve)for(var o of Ve(e))s.indexOf(o)<0&&Te.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Be}=s,Me=({tableId:e,store:s,rowComponent:t=Ae,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Ee(h(n,(r=>be(t,Oe(Pe({},ye(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),je=({queryId:e,queries:s,resultRowComponent:t=Je,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Ee(h(u,(l=>be(t,Oe(Pe({},ye(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),De=({relationshipId:e,relationships:s,rowComponent:t=Ae,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=me(M(s),e),c=u(e,n,d);return Ee(h(c,(e=>be(t,Oe(Pe({},ye(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Qe=e=>({checkpoints:s,checkpointComponent:t=Ke,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=D(s);return Ee(h(e(ce(u)),(e=>be(t,Oe(Pe({},ye(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Ee=(e,s,t,o)=>{const l=v(s)||!Array.isArray(e)?e:h(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},Fe=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Ee(o+(null!=(u=$(e,s,t,l))?u:o),void 0,r,t)},Ae=({tableId:e,rowId:s,store:t,cellComponent:o=Fe,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Ee(h(((e,s,t,o)=>{const l=Z(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>be(o,Oe(Pe({},ye(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Ge=e=>Me(e,X(e.tableId,e.store)),Ue=({valueId:e,store:s,debugIds:t})=>{var l;return Ee(o+(null!=(l=ee(e,s))?l:o),void 0,t,e)},ze=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ae,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(B(t),e),a=oe(e,s,n);return Ee(h(a,(e=>be(o,Oe(Pe({},ye(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},He=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Ee(o+(null!=(u=ae(e,s,t,l))?u:o),void 0,r,t)},Je=({queryId:e,rowId:s,queries:t,resultCellComponent:o=He,getResultCellComponentProps:l,separator:r,debugIds:u})=>Ee(h(ie(e,s,t),(r=>be(o,Oe(Pe({},ye(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ke=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Ee(null!=(l=Ie(s,e))?l:o,void 0,t,s)},Ne=Qe((e=>e[0])),We=Qe((e=>v(e[1])?[]:[e[1]])),Xe=Qe((e=>e[2]));e.BackwardCheckpointsView=Ne,e.CellView=Fe,e.CheckpointView=Ke,e.CurrentCheckpointView=We,e.ForwardCheckpointsView=Xe,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ze,getSliceComponentProps:o,separator:l,debugIds:r})=>Ee(h(te(e,s),(l=>be(t,Oe(Pe({},ye(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>De(e,ue,e.firstRowId),e.LocalRowsView=e=>De(e,re,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Ee(null!=(l=se(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(S);return be(S.Provider,{value:Be((()=>[null!=e?e:C[0],Pe(Pe({},C[1]),t),null!=o?o:C[2],Pe(Pe({},C[3]),l),null!=r?r:C[4],Pe(Pe({},C[5]),u),null!=n?n:C[6],Pe(Pe({},C[7]),d),null!=i?i:C[8],Pe(Pe({},C[9]),a),null!=c?c:C[10],Pe(Pe({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ae,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=me(M(t),e),i=le(e,s,u);return Ee(v(d)||v(i)?null:be(o,Oe(Pe({},ye(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=He,e.ResultRowView=Je,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=qe(s,["cellId","descending","offset","limit"]);return je(u,de(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>je(e,ne(e.queryId,e.queries)),e.RowView=Ae,e.SliceView=ze,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=qe(s,["cellId","descending","offset","limit"]);return Me(u,Y(u.tableId,t,o,l,r,u.store))},e.TableView=Ge,e.TablesView=({store:e,tableComponent:s=Ge,getTableComponentProps:t,separator:o,debugIds:l})=>Ee(h(W(e),(o=>be(s,Oe(Pe({},ye(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Ue,e.ValuesView=({store:e,valueComponent:s=Ue,getValueComponentProps:t,separator:o,debugIds:l})=>Ee(h(_(e),(o=>be(s,Oe(Pe({},ye(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=O(o);return Q((t=>g(n,(o=>g(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=$,e.useCellIds=Z,e.useCellIdsListener=(e,s,t,o,l,r)=>H(b,O(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>H(C,O(u),o,l,[e,s,t],r),e.useCheckpoint=Ie,e.useCheckpointIds=ce,e.useCheckpointIdsListener=(e,s,t)=>H("CheckpointIds",D(t),e,s),e.useCheckpointListener=(e,s,t,o)=>H("Checkpoint",D(o),s,t,[e]),e.useCheckpoints=e=>T(e,10),e.useCheckpointsIds=()=>P(11),e.useCheckpointsOrCheckpointsById=D,e.useCreateCheckpoints=(e,s,t)=>U(e,s,t),e.useCreateIndexes=(e,s,t)=>U(e,s,t),e.useCreateMetrics=(e,s,t)=>U(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=G(),u=F((()=>s(e)),[e,...t]);return E((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>U(e,s,t),e.useCreateRelationships=(e,s,t)=>U(e,s,t),e.useCreateStore=(e,s=[])=>F(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>K(l,C,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>K(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>K(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>K(e,d,s,t),e.useDelValueCallback=(e,s,t,o)=>K(s,w,t,o,e),e.useDelValuesCallback=(e,s,t)=>K(e,R,s,t),e.useGoBackwardCallback=pe,e.useGoForwardCallback=Ce,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=D(t);return Q((s=>g(r,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>z("IndexIds",B(e),[]),e.useIndexes=e=>T(e,4),e.useIndexesIds=()=>P(5),e.useIndexesOrIndexesById=B,e.useLinkedRowIds=ue,e.useLinkedRowIdsListener=(e,s,t,o,l)=>H("Linked"+I,M(l),t,o,[e,s]),e.useLocalRowIds=re,e.useLocalRowIdsListener=(e,s,t,o,l)=>H("Local"+I,M(l),t,o,[e,s]),e.useMetric=se,e.useMetricIds=e=>z("MetricIds",q(e),[]),e.useMetricListener=(e,s,t,o)=>H("Metric",q(o),s,t,[e]),e.useMetrics=e=>T(e,2),e.useMetricsIds=()=>P(3),e.useMetricsOrMetricsById=q,e.useQueries=e=>T(e,8),e.useQueriesIds=()=>P(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>z("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=D(e),[,,[l]]=ce(t);return[!v(l),Ce(t),l,null!=(s=g(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>z("RelationshipIds",M(e),[]),e.useRelationships=e=>T(e,6),e.useRelationshipsIds=()=>P(7),e.useRelationshipsOrRelationshipsById=M,e.useRemoteRowId=le,e.useRemoteRowIdListener=(e,s,t,o,l)=>H("RemoteRowId",M(l),t,o,[e,s]),e.useResultCell=ae,e.useResultCellIds=ie,e.useResultCellIdsListener=(e,s,t,o,l)=>H(r+b,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,u)=>H(r+C,j(u),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>z(r+a,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>z(r+c,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>H(r+c,j(o),s,t,[e]),e.useResultRowIds=ne,e.useResultRowIdsListener=(e,s,t,o)=>H(r+I,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>H(r+a,j(l),t,o,[e,s]),e.useResultSortedRowIds=de,e.useResultSortedRowIdsListener=(e,s,t,o,l,u,n,d)=>H(r+p,j(d),u,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>z(r+n,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>z(r+n+b,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>H(r+n+b,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>H(r+n,j(o),s,t,[e]),e.useRow=(e,s,t)=>z(a,O(t),{},[e,s]),e.useRowCount=(e,s)=>z(c,O(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>H(c,O(l),s,t,[e],o),e.useRowIds=X,e.useRowIdsListener=(e,s,t,o,l)=>H(I,O(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>H(a,O(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>J(r,C,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=D(t);return Q((s=>g(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>J(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>J(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>J(l,a,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>J(o,n,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>J(t,d,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>J(o,w,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>J(t,R,e,s,o,l),e.useSliceIds=te,e.useSliceIdsListener=(e,s,t,o)=>H("SliceIds",B(o),s,t,[e]),e.useSliceRowIds=oe,e.useSliceRowIdsListener=(e,s,t,o,l)=>H("Slice"+I,B(l),t,o,[e,s]),e.useSortedRowIds=Y,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>H(p,O(d),r,u,[e,s,t,o,l],n),e.useStore=e=>T(e,0),e.useStoreIds=()=>P(1),e.useStoreOrStoreById=O,e.useTable=(e,s)=>z(n,O(s),{},[e]),e.useTableCellIds=(e,s)=>z(n+b,O(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>H(n+b,O(l),s,t,[e],o),e.useTableIds=W,e.useTableIdsListener=(e,s,t,o)=>H(i,O(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>H(n,O(l),s,t,[e],o),e.useTables=e=>z(d,O(e),{}),e.useTablesListener=(e,s,t,o)=>H(d,O(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=D(e),[l,r]=ce(t);return[(u=l,!(0==(e=>e.length)(u))),pe(t),r,null!=(s=g(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=ee,e.useValueIds=_,e.useValueIdsListener=(e,s,t,o)=>H(k,O(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>H(w,O(l),s,t,[e],o),e.useValues=e=>z(R,O(e),{}),e.useValuesListener=(e,s,t,o)=>H(R,O(o),e,s,[],t)},"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": "4.1.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -227,14 +227,14 @@
|
|
|
227
227
|
"@types/jest": "^29.5.3",
|
|
228
228
|
"@types/jest-environment-puppeteer": "^5.0.3",
|
|
229
229
|
"@types/less": "^3.0.3",
|
|
230
|
-
"@types/node": "^20.
|
|
230
|
+
"@types/node": "^20.5.0",
|
|
231
231
|
"@types/puppeteer": "^5.4.7",
|
|
232
232
|
"@types/react": "^18.2.20",
|
|
233
233
|
"@types/react-dom": "^18.2.7",
|
|
234
234
|
"@types/react-test-renderer": "^18.0.0",
|
|
235
235
|
"@types/tmp": "^0.2.3",
|
|
236
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
237
|
-
"@typescript-eslint/parser": "^6.
|
|
236
|
+
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
237
|
+
"@typescript-eslint/parser": "^6.4.0",
|
|
238
238
|
"@vlcn.io/crsqlite-wasm": "^0.14.0",
|
|
239
239
|
"asciichart": "^1.5.25",
|
|
240
240
|
"automerge-repo": "^0.1.0",
|
|
@@ -245,12 +245,12 @@
|
|
|
245
245
|
"buffer-replace": "^1.0.0",
|
|
246
246
|
"country-flag-emoji-json": "^2.0.0",
|
|
247
247
|
"cspell": "^7.0.0",
|
|
248
|
-
"esbuild": "^0.19.
|
|
248
|
+
"esbuild": "^0.19.2",
|
|
249
249
|
"eslint": "^8.47.0",
|
|
250
250
|
"eslint-config-prettier": "^9.0.0",
|
|
251
251
|
"eslint-plugin-jest": "^27.2.3",
|
|
252
252
|
"eslint-plugin-jsdoc": "^46.4.6",
|
|
253
|
-
"eslint-plugin-react": "7.33.
|
|
253
|
+
"eslint-plugin-react": "7.33.2",
|
|
254
254
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
255
255
|
"expo-sqlite": "^11.5.0",
|
|
256
256
|
"fake-indexeddb": "^4.0.2",
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
"rollup-plugin-prettier": "^3.0.0",
|
|
275
275
|
"sqlite3": "^5.1.6",
|
|
276
276
|
"tinybase": "file:./",
|
|
277
|
-
"tinydocs": "^0.1.
|
|
277
|
+
"tinydocs": "^0.1.32",
|
|
278
278
|
"tmp": "^0.2.1",
|
|
279
279
|
"ts-unused-exports": "^10.0.0",
|
|
280
280
|
"typescript": "5.1.6",
|