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