tinybase 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/lib/cjs/ui-react-dom-debug.cjs +1 -1
  2. package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
  3. package/lib/cjs/ui-react-dom.cjs +1 -1
  4. package/lib/cjs/ui-react-dom.cjs.gz +0 -0
  5. package/lib/cjs/ui-react.cjs +1 -1
  6. package/lib/cjs/ui-react.cjs.gz +0 -0
  7. package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
  8. package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
  9. package/lib/cjs-es6/ui-react-dom.cjs +1 -1
  10. package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
  11. package/lib/cjs-es6/ui-react.cjs +1 -1
  12. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  13. package/lib/debug/ui-react-dom.js +94 -42
  14. package/lib/debug/ui-react.js +4 -3
  15. package/lib/es6/ui-react-dom-debug.js +1 -1
  16. package/lib/es6/ui-react-dom-debug.js.gz +0 -0
  17. package/lib/es6/ui-react-dom.js +1 -1
  18. package/lib/es6/ui-react-dom.js.gz +0 -0
  19. package/lib/es6/ui-react.js +1 -1
  20. package/lib/es6/ui-react.js.gz +0 -0
  21. package/lib/ui-react-dom.js +1 -1
  22. package/lib/ui-react-dom.js.gz +0 -0
  23. package/lib/ui-react.js +1 -1
  24. package/lib/ui-react.js.gz +0 -0
  25. package/lib/umd/ui-react-dom-debug.js +1 -1
  26. package/lib/umd/ui-react-dom-debug.js.gz +0 -0
  27. package/lib/umd/ui-react-dom.js +1 -1
  28. package/lib/umd/ui-react-dom.js.gz +0 -0
  29. package/lib/umd/ui-react.js +1 -1
  30. package/lib/umd/ui-react.js.gz +0 -0
  31. package/lib/umd-es6/ui-react-dom-debug.js +1 -1
  32. package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
  33. package/lib/umd-es6/ui-react-dom.js +1 -1
  34. package/lib/umd-es6/ui-react-dom.js.gz +0 -0
  35. package/lib/umd-es6/ui-react.js +1 -1
  36. package/lib/umd-es6/ui-react.js.gz +0 -0
  37. package/package.json +13 -13
  38. package/readme.md +1 -1
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("./ui-react");const l=e=>typeof e,s="",a=l(s),n=l(!0),r=l(0),o=l(l),i="type",d="default",u="Ids",c="Table",h=c+"s",m=c+u,b="Row",g=b+"Count",I=b+u,p="Cell",f=p+u,w="Value",C=w+"s",y=w+u,v="currentTarget",k="value",x=e=>s+e,T=Math.floor,S=isFinite,V=(e,t)=>e instanceof t,R=e=>null==e,q=(e,t,l)=>R(e)?l?.():t(e),N=e=>e==a||e==n,L=e=>l(e)==o,M=e=>Array.isArray(e),{createElement:E,Fragment:z,useCallback:$,useLayoutEffect:O,useRef:A,useState:J}=e,F=(e,...t)=>R(e)?{}:e(...t),H=(e,t)=>e.forEach(t),P=(e,t)=>e.map(t),B=e=>e.length,Q=e=>0==B(e),D=(e,t,l)=>e.slice(t,l),W=(e,...t)=>e.push(...t),j=e=>e.shift(),G=Object,K=G.keys,U=G.isFrozen,X=G.freeze,Y=e=>V(e,G)&&e.constructor==G,Z=(e=[])=>G.fromEntries(e),_=(e,t)=>!R(((e,t)=>q(e,(e=>e[t])))(e,t)),ee=(e,t)=>(delete e[t],e),te=(e,t)=>P(G.entries(e),(([e,l])=>t(l,e))),le=e=>Y(e)&&0==(e=>B(K(e)))(e),se=e=>JSON.stringify(e,((e,t)=>V(t,Map)?G.fromEntries([...t]):t)),ae=JSON.parse,ne="tinybaseStoreInspector",re="TinyBase Store Inspector",oe=["left","top","bottom","right","full"],ie="state",de="sort",ue="open",ce="position",he=ue,me="editable",be=(...e)=>se(e),ge=(e,t)=>P(e.sort(),t),Ie=(e,l)=>[!!t.useCell(ie,e,me,l),$((t=>{l.setCell(ie,e,me,(e=>!e)),t.preventDefault()}),[l,e])],pe="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",fe='content:url("',we=fe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Ce='</svg>")',ye=fe+"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\")",ve=P([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,s])=>we+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${s}' fill='white'/>`+Ce)),ke=we+"<path d='M20 20l60 60M20 80l60-60' />"+Ce,xe=we+`<path d='${pe}' />`+Ce,Te=we+`<path d='${pe}M20 20l60 60' />`+Ce,Se="*::-webkit-scrollbar",Ve=((e,t="")=>e.join(t))(te({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Se]:"width:0.5rem;height:0.5rem;",[Se+"-track"]:"background:#111",[Se+"-thumb"]:"background:#999;border:1px solid #111",[Se+"-thumb:hover"]:"background:#fff",[Se+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+ye,...Z(P(["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;",...Z(P(["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)":ye,"header>img:nth-of-type(6)":ke,...Z(P(ve,((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":xe,"details[open]>summary img.done":Te,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,#${ne} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left"},((e,t)=>e?`#${ne} ${t}{${e}}`:""))),Re=({s:e})=>{const l=t.useValue(ce,e)??1,s=t.useSetValueCallback(he,(()=>!0),[],e);return t.useValue(he,e)?null:E("img",{onClick:s,title:re,"data-position":l})},qe=({uniqueId:e,summary:l,editable:s,handleEditable:a,children:n,s:r})=>{const o=!!t.useCell(ie,e,ue,r),i=t.useSetCellCallback(ie,e,ue,(e=>e[v].open),[],r);return E("details",{open:o,onToggle:i},E("summary",null,l,a?E("img",{onClick:a,className:s?"done":"edit"}):null),n)},Ne=e=>{const t=l(e);return N(t)||t==r&&S(e)?t:void 0},Le=(e,t,l,s,a)=>R(a)?e.delCell(t,l,s,!0):e.setCell(t,l,s,a),Me=(e,t,l)=>R(l)?e.delValue(t):e.setValue(t,l),Ee=(e,t,l,s)=>e==a?t:e==r?l:s,{useCallback:ze,useMemo:$e,useState:Oe}=e,Ae="editable",Je=(e,l)=>P(t.useTableCellIds(e,l),(t=>e+"."+t)),Fe=(e,t,l)=>{const s=ze(e,t);return l?s:void 0},He=(...e)=>$e((()=>e),e),Pe=(e,t)=>$e((()=>({store:e,tableId:t})),[e,t]),Be=(e,t)=>$e((()=>({queries:e,queryId:t})),[e,t]),Qe=(e,t=!1,l,s=0,a,n,r,o)=>{const[[i,d,u],c]=Oe([e,t,s]),h=ze((e=>{c(e),o?.(e)}),[o]),m=Fe((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),b=ze((e=>h([i,d,e])),[h,i,d]),g=!0===r?lt:r;return[[i,d,u],m,$e((()=>!1===r?null:E(g,{offset:u,limit:a,total:n,onChange:b})),[r,g,u,a,n,b])]},De=(e,t,s)=>$e((()=>{const n=t??e;return Z(te(M(n)?Z(P(n,(e=>[e,e]))):n,((e,t)=>{return[t,{label:t,component:s,...(n=e,l(n)==a?{label:e}:e)}];var n})))}),[t,s,e]),We=({className:e,headerRow:t,idColumn:l,params:[s,a,n,r,o,i]})=>E("table",{className:e},i?E("caption",null,i):null,!1===t?null:E("thead",null,E("tr",null,!1===l?null:E(je,{sort:r??[],label:"Id",onClick:o}),te(s,(({label:e},t)=>E(je,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),E("tbody",null,P(n,(e=>E("tr",{key:e},!1===l?null:E("th",null,e),te(s,(({component:t,getComponentProps:l},s)=>E("td",{key:s},E(t,{...F(l,e,s),...a,rowId:e,cellId:s}))))))))),je=({cellId:e,sort:[t,l],label:a=e??s,onClick:n})=>E("th",{onClick:Fe((()=>n?.(e)),[n,e],n),className:R(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},R(l)||t!=e?null:(l?"↓":"↑")+" ",a),Ge=({localRowId:l,params:[s,a,n,r,o,i,d]})=>{const u=t.useRemoteRowId(o,l,i);return E("tr",null,!1===s?null:E(e.Fragment,null,E("th",null,l),E("th",null,u)),te(a,(({component:e,getComponentProps:t},s)=>{const[a,o]=s.split(".",2),i=a===n?l:a===r?u:null;return R(i)?null:E("td",{key:s},E(e,{...F(t,i,o),store:d,tableId:a,rowId:i,cellId:o}))})))},Ke=({thing:e,onThingChange:t,className:l,hasSchema:s})=>{const[o,i]=Oe(),[d,u]=Oe(),[c,h]=Oe(),[m,b]=Oe(),[g,I]=Oe();d!==e&&(i(Ne(e)),u(e),h(e+""),b(Number(e)||0),I(!!e));const p=ze(((e,l)=>{l(e),u(e),t(e)}),[t]);return E("div",{className:l},E("button",{className:o,onClick:ze((()=>{if(!s?.()){const e=Ee(o,r,n,a),l=Ee(e,c,m,g);i(e),u(l),t(l)}}),[s,t,c,m,g,o])},o),Ee(o,E("input",{key:o,value:c,onChange:ze((e=>p(e[v][k]+"",h)),[p])}),E("input",{key:o,type:"number",value:m,onChange:ze((e=>p(Number(e[v][k]||0),b)),[p])}),E("input",{key:o,type:"checkbox",checked:g,onChange:ze((e=>p(!!e[v].checked,I)),[p])})))},Ue=({tableId:e,cellId:l,descending:s,offset:a,limit:n,store:r,editable:o,sortOnClick:i,paginator:d=!1,onChange:u,customCells:c,...h})=>{const[m,b,g]=Qe(l,s,i,a,n,t.useRowCount(e,r),d,u);return E(We,{...h,params:He(De(t.useTableCellIds(e,r),c,o?et:t.CellView),Pe(r,e),t.useSortedRowIds(e,...m,n,r),m,b,g)})},Xe=({store:e,editable:l=!1,valueComponent:s=(l?tt:t.ValueView),getValueComponentProps:a,className:n,headerRow:r,idColumn:o})=>E("table",{className:n},!1===r?null:E("thead",null,E("tr",null,!1===o?null:E("th",null,"Id"),E("th",null,w))),E("tbody",null,P(t.useValueIds(e),(t=>E("tr",{key:t},!1===o?null:E("th",null,t),E("td",null,E(s,{...F(a,t),valueId:t,store:e}))))))),Ye=({indexId:e,sliceId:l,indexes:s,editable:a,customCells:n,...r})=>{const[o,i,d]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(t.useIndexesOrIndexesById(s),e);return E(We,{...r,params:He(De(t.useTableCellIds(d,i),n,a?et:t.CellView),Pe(i,d),t.useSliceRowIds(e,l,o))})},Ze=({relationshipId:l,relationships:s,editable:a,customCells:n,className:r,headerRow:o,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(s),l),m=De([...Je(c,u),...Je(h,u)],n,a?et:t.CellView),b=He(i,m,c,h,l,d,u);return E("table",{className:r},!1===o?null:E("thead",null,E("tr",null,!1===i?null:E(e.Fragment,null,E("th",null,c,".Id"),E("th",null,h,".Id")),te(m,(({label:e},t)=>E("th",{key:t},e))))),E("tbody",null,P(t.useRowIds(c,u),(e=>E(Ge,{key:e,localRowId:e,params:b})))))},_e=({queryId:e,cellId:l,descending:s,offset:a,limit:n,queries:r,sortOnClick:o,paginator:i=!1,customCells:d,onChange:u,...c})=>{const[h,m,b]=Qe(l,s,o,a,n,t.useResultRowCount(e,r),i,u);return E(We,{...c,params:He(De(t.useResultTableCellIds(e,r),d,t.ResultCellView),Be(r,e),t.useResultSortedRowIds(e,...h,n,r),h,m,b)})},et=({tableId:e,rowId:l,cellId:s,store:a,className:n})=>E(Ke,{thing:t.useCell(e,l,s,a),onThingChange:t.useSetCellCallback(e,l,s,(e=>e),[],a),className:n??Ae+p,hasSchema:t.useStoreOrStoreById(a)?.hasTablesSchema}),tt=({valueId:e,store:l,className:s})=>E(Ke,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:s??Ae+w,hasSchema:t.useStoreOrStoreById(l)?.hasValuesSchema}),lt=({onChange:t,total:l,offset:s=0,limit:a=l,singular:n="row",plural:r=n+"s"})=>{(s>l||s<0)&&(s=0,t(0));const o=Fe((()=>t(s-a)),[t,s,a],s>0),i=Fe((()=>t(s+a)),[t,s,a],s+a<l);return E(e.Fragment,null,l>a&&E(e.Fragment,null,E("button",{className:"previous",disabled:0==s,onClick:o},"←"),E("button",{className:"next",disabled:s+a>=l,onClick:i},"→"),s+1," to ",Math.min(l,s+a)," of "),l," ",1!=l?r:n)},st=({indexes:e,indexesId:l,indexId:s,s:a})=>E(qe,{uniqueId:be("i",l,s),summary:"Index: "+s,s:a},P(t.useSliceIds(s,e),(t=>E(at,{indexes:e,indexesId:l,indexId:s,sliceId:t,s:a})))),at=({indexes:e,indexesId:t,indexId:l,sliceId:s,s:a})=>{const n=be("i",t,l,s),[r,o]=Ie(n,a);return E(qe,{uniqueId:n,summary:"Slice: "+s,editable:r,handleEditable:o,s:a},E(Ye,{sliceId:s,indexId:l,indexes:e,editable:r}))},nt=({indexesId:e,s:l})=>{const s=t.useIndexes(e),a=t.useIndexIds(s);return R(s)?null:E(qe,{uniqueId:be("i",e),summary:"Indexes: "+(e??d),s:l},Q(a)?"No indexes defined":ge(a,(t=>E(st,{indexes:s,indexesId:e,indexId:t,s:l}))))},rt=({metrics:e,metricId:l})=>E("tr",null,E("th",null,l),E("td",null,e?.getTableId(l)),E("td",null,t.useMetric(l,e))),ot=({metricsId:e,s:l})=>{const s=t.useMetrics(e),a=t.useMetricIds(s);return R(s)?null:E(qe,{uniqueId:be("m",e),summary:"Metrics: "+(e??d),s:l},Q(a)?"No metrics defined":E("table",null,E("thead",null,E("th",null,"Metric Id"),E("th",null,"Table Id"),E("th",null,"Metric")),E("tbody",null,P(a,(e=>E(rt,{metrics:s,metricId:e}))))))},it=({queries:e,queriesId:l,queryId:s,s:a})=>{const n=be("q",l,s),[r,o,i]=ae(t.useCell(ie,n,de,a)??"[]"),d=t.useSetCellCallback(ie,n,de,se,[],a);return E(qe,{uniqueId:n,summary:"Query: "+s,s:a},E(_e,{queryId:s,queries:e,cellId:r,descending:o,offset:i,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},dt=({queriesId:e,s:l})=>{const s=t.useQueries(e),a=t.useQueryIds(s);return R(s)?null:E(qe,{uniqueId:be("q",e),summary:"Queries: "+(e??d),s:l},Q(a)?"No queries defined":ge(a,(t=>E(it,{queries:s,queriesId:e,queryId:t,s:l}))))},ut=({relationships:e,relationshipsId:t,relationshipId:l,s:s})=>{const a=be("r",t,l),[n,r]=Ie(a,s);return E(qe,{uniqueId:a,summary:"Relationship: "+l,editable:n,handleEditable:r,s:s},E(Ze,{relationshipId:l,relationships:e,editable:n}))},ct=({relationshipsId:e,s:l})=>{const s=t.useRelationships(e),a=t.useRelationshipIds(s);return R(s)?null:E(qe,{uniqueId:be("r",e),summary:"Relationships: "+(e??d),s:l},Q(a)?"No relationships defined":ge(a,(t=>E(ut,{relationships:s,relationshipsId:e,relationshipId:t,s:l}))))},ht=({tableId:e,store:l,storeId:s,s:a})=>{const n=be("t",s,e),[r,o,i]=ae(t.useCell(ie,n,de,a)??"[]"),d=t.useSetCellCallback(ie,n,de,se,[],a),[u,h]=Ie(n,a);return E(qe,{uniqueId:n,summary:c+": "+e,editable:u,handleEditable:h,s:a},E(Ue,{tableId:e,store:l,cellId:r,descending:o,offset:i,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:u}))},mt=({store:e,storeId:l,s:s})=>{const a=be("v",l),[n,r]=Ie(a,s);return Q(t.useValueIds(e))?null:E(qe,{uniqueId:a,summary:C,editable:n,handleEditable:r,s:s},E(Xe,{store:e,editable:n}))},bt=({storeId:e,s:l})=>{const s=t.useStore(e),a=t.useTableIds(s);return R(s)?null:E(qe,{uniqueId:be("s",e),summary:"Store: "+(e??d),s:l},E(mt,{storeId:e,store:s,s:l}),ge(a,(t=>E(ht,{store:s,storeId:e,tableId:t,s:l}))))},gt=({s:e})=>{const l=A(null),s=A(0),[a,n]=J(!1),{scrollLeft:r,scrollTop:o}=t.useValues(e);O((()=>{const e=l.current;if(e&&!a){const t=new MutationObserver((()=>{e.scrollWidth>=T(r)+e.clientWidth&&e.scrollHeight>=T(o)+e.clientHeight&&e.scrollTo(r,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[a,r,o]);const i=$((t=>{const{scrollLeft:l,scrollTop:a}=t[v];cancelIdleCallback(s.current),s.current=requestIdleCallback((()=>{n(!0),e.setPartialValues({scrollLeft:l,scrollTop:a})}))}),[e]);return E("article",{ref:l,onScroll:i},E(bt,{s:e}),P(t.useStoreIds(),(t=>E(bt,{storeId:t,key:t,s:e}))),E(ot,{s:e}),P(t.useMetricsIds(),(t=>E(ot,{metricsId:t,key:t,s:e}))),E(nt,{s:e}),P(t.useIndexesIds(),(t=>E(nt,{indexesId:t,key:t,s:e}))),E(ct,{s:e}),P(t.useRelationshipsIds(),(t=>E(ct,{relationshipsId:t,key:t,s:e}))),E(dt,{s:e}),P(t.useQueriesIds(),(t=>E(dt,{queriesId:t,key:t,s:e}))))},It=({s:e})=>{const l=t.useValue(ce,e)??1,s=t.useSetValueCallback(he,(()=>!1),[],e),a=t.useSetValueCallback(ce,(e=>Number(e[v].dataset.id)),[],e);return E("header",null,E("img",{title:re}),E("span",null,re),P(oe,((e,t)=>t==l?null:E("img",{onClick:a,"data-id":t,title:"Dock to "+e,key:t}))),E("img",{onClick:s,title:"Close"}))},pt=({s:e})=>{const l=t.useValue(ce,e)??1;return t.useValue(he,e)?E("main",{"data-position":l},E(It,{s:e}),E(gt,{s:e})):null},ft=e=>t=>{return l=(t,l)=>t+e(l),Tt(t).reduce(l,0);var l},wt=e=>e?.size??0,Ct=ft(wt),yt=ft(Ct),vt=ft(yt),kt=(e,t)=>e?.has(t)??!1,xt=e=>R(e)||0==wt(e),Tt=e=>[...e?.values()??[]],St=e=>e.clear(),Vt=(e,t)=>e?.forEach(t),Rt=(e,t)=>e?.delete(t),qt=e=>new Map(e),Nt=e=>[...e?.keys()??[]],Lt=(e,t)=>e?.get(t),Mt=(e,t)=>Vt(e,((e,l)=>t(l,e))),Et=(e,t,l)=>R(l)?(Rt(e,t),e):e?.set(t,l),zt=(e,t,l)=>(kt(e,t)||Et(e,t,l()),Lt(e,t)),$t=(e,t,l,s=Et)=>(te(t,((t,s)=>l(e,s,t))),Mt(e,(l=>_(t,l)?0:s(e,l))),e),Ot=(e,t,l)=>{const s={};return Vt(e,((e,a)=>{const n=t?t(e,a):e;!l?.(n,e)&&(s[a]=n)})),s},At=(e,t,l)=>Ot(e,(e=>Ot(e,t,l)),le),Jt=(e,t,l)=>Ot(e,(e=>At(e,t,l)),le),Ft=(e,t)=>{const l=qt();return Vt(e,((e,s)=>l.set(s,t?.(e)??e))),l},Ht=e=>Ft(e,Ft),Pt=e=>Ft(e,Ht),Bt=(e,t,l,s,a=0)=>q((l?zt:Lt)(e,t[a],a>B(t)-2?l:qt),(n=>{if(a>B(t)-2)return s?.(n)&&Et(e,t[a]),n;const r=Bt(n,t,l,s,a+1);return xt(n)&&Et(e,t[a]),r})),Qt=qt(),Dt=qt(),Wt="storage",jt=globalThis.window,Gt=e=>new Set(M(e)||R(e)?e:[e]),Kt=(e,t)=>e?.add(t),Ut=/^\d+$/,Xt=()=>{const e=[];let t=0;return[l=>(l?j(e):null)??s+t++,t=>{Ut.test(t)&&B(e)<1e3&&W(e,t)}]},Yt=e=>[e,e],Zt=(e,t=Ct)=>t(e[0])+t(e[1]),_t=()=>[qt(),qt()],el=e=>[...e],tl=([e,t])=>e===t,ll=(e,t,l)=>R(e)||!Y(e)||le(e)||U(e)?(l?.(),!1):(te(e,((l,s)=>{t(l,s)||ee(e,s)})),!le(e)),sl=(e,t,l)=>Et(e,t,Lt(e,t)==-l?void 0:l),al=()=>{let e,t,l=!1,a=!1,n=0;const o=qt(),u=qt(),v=qt(),k=qt(),T=qt(),S=qt(),V=qt(),M=qt(),E=qt(),z=qt(),$=qt(),O=qt(),A=qt(),J=qt(),F=Gt(),Q=qt(),j=qt(),G=qt(),K=qt(),U=_t(),Y=_t(),Z=_t(),ne=_t(),re=_t(),oe=_t(),ie=_t(),de=_t(),ue=_t(),ce=_t(),he=_t(),me=_t(),be=_t(),ge=_t(),Ie=_t(),pe=qt(),fe=_t(),[we,Ce,ye,ve]=(e=>{let t;const[l,a]=Xt(),n=qt();return[(e,a,r,o=[],i=(()=>[]))=>{t??=wl;const d=l(1);return Et(n,d,[e,a,r,o,i]),Kt(Bt(a,r??[s],Gt),d),d},(e,l,...a)=>H(((e,t=[s])=>{const l=[],a=(e,s)=>s==B(t)?W(l,e):null===t[s]?Vt(e,(e=>a(e,s+1))):H([t[s],null],(t=>a(Lt(e,t),s+1)));return a(e,0),l})(e,l),(e=>Vt(e,(e=>Lt(n,e)[0](t,...l??[],...a))))),e=>q(Lt(n,e),(([,t,l])=>(Bt(t,l??[s],void 0,(t=>(Rt(t,e),xt(t)?1:0))),Et(n,e),a(e),l))),e=>q(Lt(n,e),(([e,,l=[],s,a])=>{const n=(...r)=>{const o=B(r);o==B(l)?e(t,...r,...a(r)):R(l[o])?H(s[o]?.(...r)??[],(e=>n(...r,e))):n(...r,l[o])};n()}))]})(),ke=e=>{if(!ll(e,((e,t)=>[i,d].includes(t))))return!1;const t=e[i];return!(!N(t)&&t!=r||(Ne(e[d])!=t&&ee(e,d),0))},xe=(t,l)=>(!e||kt($,l)||st(l))&&ll(t,((e,t)=>Te(l,t,e)),(()=>st(l))),Te=(e,t,l,s)=>ll(s?l:qe(l,e,t),((s,a)=>q(Se(e,t,a,s),(e=>(l[a]=e,!0)),(()=>!1))),(()=>st(e,t))),Se=(t,l,s,a)=>e?q(Lt(Lt($,t),s),(e=>Ne(a)!=e[i]?st(t,l,s,a,e[d]):a),(()=>st(t,l,s,a))):R(Ne(a))?st(t,l,s,a):a,Ve=(e,t)=>ll(t?e:Ee(e),((t,l)=>q(Re(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>at())),Re=(e,l)=>t?q(Lt(A,e),(t=>Ne(l)!=t[i]?at(e,l,t[d]):l),(()=>at(e,l))):R(Ne(l))?at(e,l):l,qe=(e,t,l)=>(q(Lt(O,t),(([s,a])=>{Vt(s,((t,l)=>{_(e,l)||(e[l]=t)})),Vt(a,(s=>{_(e,s)||st(t,l,s)}))})),e),Ee=e=>(t&&(Vt(J,((t,l)=>{_(e,l)||(e[l]=t)})),Vt(F,(t=>{_(e,t)||at(t)}))),e),ze=e=>$t($,e,((e,t,l)=>{const s=qt(),a=Gt();$t(zt($,t,qt),l,((e,t,l)=>{Et(e,t,l),q(l[d],(e=>Et(s,t,e)),(()=>Kt(a,t)))})),Et(O,t,[s,a])}),((e,t)=>{Et($,t),Et(O,t)})),$e=e=>$t(A,e,((e,t,l)=>{Et(A,t,l),q(l[d],(e=>Et(J,t,e)),(()=>Kt(F,t)))}),((e,t)=>{Et(A,t),Et(J,t),Rt(F,t)})),Oe=e=>le(e)?ul():nl(e),Ae=e=>$t(G,e,((e,t,l)=>Je(t,l)),((e,t)=>Ge(t))),Je=(e,t)=>$t(zt(G,e,(()=>(Ye(e,1),Et(Q,e,Xt()),Et(j,e,qt()),qt()))),t,((t,l,s)=>Fe(e,t,l,s)),((t,l)=>Ke(e,t,l))),Fe=(e,t,l,s,a)=>$t(zt(t,l,(()=>(Ze(e,l,1),qt()))),s,((t,s,a)=>He(e,l,t,s,a)),((s,n)=>Ue(e,t,l,s,n,a))),He=(e,t,l,s,a)=>{kt(l,s)||_e(e,t,s,1);const n=Lt(l,s);a!==n&&(et(e,t,s,n,a),Et(l,s,a))},Pe=(e,t,l,s,a)=>q(Lt(t,l),(t=>He(e,l,t,s,a)),(()=>Fe(e,t,l,qe({[s]:a},e,l)))),Be=e=>le(e)?ml():rl(e),Qe=e=>$t(K,e,((e,t,l)=>De(t,l)),((e,t)=>Xe(t))),De=(e,t)=>{kt(K,e)||tt(e,1);const l=Lt(K,e);t!==l&&(lt(e,l,t),Et(K,e,t))},We=(e,t)=>{const[l]=Lt(Q,e),s=l(t);return kt(Lt(G,e),s)?We(e,t):s},je=e=>Lt(G,e)??Je(e,{}),Ge=e=>Je(e,{}),Ke=(e,t,l)=>{const[,s]=Lt(Q,e);s(l),Fe(e,t,l,{},!0)},Ue=(e,t,l,s,a,n)=>{const r=Lt(Lt(O,e)?.[0],a);if(!R(r)&&!n)return He(e,l,s,a,r);const o=t=>{et(e,l,t,Lt(s,t)),_e(e,l,t,-1),Et(s,t)};R(r)?o(a):Mt(s,o),xt(s)&&(Ze(e,l,-1),xt(Et(t,l))&&(Ye(e,-1),Et(G,e),Et(Q,e),Et(j,e)))},Xe=e=>{const t=Lt(J,e);if(!R(t))return De(e,t);lt(e,Lt(K,e)),tt(e,-1),Et(K,e)},Ye=(e,t)=>sl(o,e,t),Ze=(e,t,l)=>sl(zt(k,e,qt),t,l)&&Et(v,e,zt(v,e,(()=>0))+l),_e=(e,t,l,s)=>{const a=Lt(j,e),n=Lt(a,l)??0;(0==n&&1==s||1==n&&-1==s)&&sl(zt(u,e,qt),l,s),Et(a,l,n!=-s?n+s:null),sl(zt(zt(T,e,qt),t,qt),l,s)},et=(e,t,l,s,a)=>zt(zt(zt(S,e,qt),t,qt),l,(()=>[s,0]))[1]=a,tt=(e,t)=>sl(V,e,t),lt=(e,t,l)=>zt(M,e,(()=>[t,0]))[1]=l,st=(e,t,l,s,a)=>(W(zt(zt(zt(E,e,qt),t,qt),l,(()=>[])),s),a),at=(e,t,l)=>(W(zt(z,e,(()=>[])),t),l),nt=(e,t,l)=>q(Lt(Lt(Lt(S,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...Yt(Dt(e,t,l))])),rt=e=>q(Lt(M,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Yt(Ut(e))])),ot=e=>xt(E)||xt(he[e])?0:Vt(e?Pt(E):E,((t,l)=>Vt(t,((t,s)=>Vt(t,((t,a)=>Ce(he[e],[l,s,a],t))))))),it=e=>xt(z)||xt(me[e])?0:Vt(e?Ft(z):z,((t,l)=>Ce(me[e],[l],t))),dt=(e,t,l)=>{if(!xt(t))return Ce(e,l,(()=>Ot(t))),1},ut=e=>{const t=xt(ie[e]),l=xt(ue[e])&&xt(ne[e])&&xt(re[e])&&xt(oe[e])&&t&&xt(Y[e]),s=xt(ce[e])&&xt(de[e])&&xt(Z[e])&&xt(U[e]);if(!l||!s){const a=e?[Ft(o),Ht(u),Ft(v),Ht(k),Pt(T),Pt(S)]:[o,u,v,k,T,S];if(!l){dt(Y[e],a[0]),Vt(a[1],((t,l)=>dt(ne[e],t,[l]))),Vt(a[2],((t,l)=>{0!=t&&Ce(re[e],[l],pt(l))}));const l=Gt();Vt(a[3],((s,a)=>{dt(oe[e],s,[a])&&!t&&(Ce(ie[e],[a,null]),Kt(l,a))})),t||Vt(a[5],((t,s)=>{if(!kt(l,s)){const l=Gt();Vt(t,(e=>Vt(e,(([t,s],a)=>s!==t?Kt(l,a):Rt(e,a))))),Vt(l,(t=>Ce(ie[e],[s,t])))}})),Vt(a[4],((t,l)=>Vt(t,((t,s)=>dt(ue[e],t,[l,s])))))}if(!s){let t;Vt(a[5],((l,s)=>{let a;Vt(l,((l,n)=>{let r;Vt(l,(([l,o],i)=>{o!==l&&(Ce(ce[e],[s,n,i],o,l,nt),t=a=r=1)})),r&&Ce(de[e],[s,n],nt)})),a&&Ce(Z[e],[s],nt)})),t&&Ce(U[e],void 0,nt)}}},ct=e=>{const t=xt(ge[e]),l=xt(Ie[e])&&xt(be[e]);if(!t||!l){const s=e?[Ft(V),Ft(M)]:[V,M];if(t||dt(ge[e],s[0]),!l){let t;Vt(s[1],(([l,s],a)=>{s!==l&&(Ce(Ie[e],[a],s,l,rt),t=1)})),t&&Ce(be[e],void 0,rt)}}},ht=(e,...t)=>(Il((()=>e(...P(t,x)))),wl),mt=()=>[Ot(S,((e,t)=>-1===Lt(o,t)?null:Ot(e,((e,l)=>-1===Lt(Lt(k,t),l)?null:Ot(e,(([,e])=>e??null),((e,t)=>tl(t)))),le)),le),Ot(M,(([,e])=>e??null),((e,t)=>tl(t)))],bt=()=>({cellsTouched:l,valuesTouched:a,changedCells:Jt(S,el,tl),invalidCells:Jt(E),changedValues:Ot(M,el,tl),invalidValues:Ot(z),changedTableIds:Ot(o),changedRowIds:At(k),changedCellIds:Jt(T),changedValueIds:Ot(V)}),gt=()=>Jt(G),It=()=>Nt(G),pt=e=>wt(Lt(G,x(e))),ft=e=>Nt(Lt(G,x(e))),Tt=(e,t,l,s=0,a)=>{return P(D((r=Lt(G,x(e)),o=(e,l)=>[R(t)?l:Lt(e,x(t)),l],n=([e],[t])=>((e??0)<(t??0)?-1:1)*(l?-1:1),P([...r?.entries()??[]],(([e,t])=>o(t,e))).sort(n)),s,R(a)?a:s+a),(([,e])=>e));var n,r,o},Qt=(e,t)=>Nt(Lt(Lt(G,x(e)),x(t))),Dt=(e,t,l)=>Lt(Lt(Lt(G,x(e)),x(t)),x(l)),Wt=()=>Ot(K),jt=()=>Nt(K),Ut=e=>Lt(K,x(e)),nl=e=>ht((()=>(e=>ll(e,xe,st))(e)?Ae(e):0)),rl=e=>ht((()=>Ve(e)?Qe(e):0)),ol=e=>{try{Oe(ae(e))}catch{}return wl},il=t=>ht((()=>{if((e=ll(t,(e=>ll(e,ke))))&&(ze(t),!xt(G))){const e=gt();ul(),nl(e)}})),dl=e=>ht((()=>{if(t=(e=>ll(e,ke))(e)){const l=Wt();gl(),ml(),t=!0,$e(e),rl(l)}})),ul=()=>ht((()=>Ae({}))),cl=e=>ht((e=>kt(G,e)?Ge(e):0),e),hl=(e,t)=>ht(((e,t)=>q(Lt(G,e),(l=>kt(l,t)?Ke(e,l,t):0))),e,t),ml=()=>ht((()=>Qe({}))),bl=()=>ht((()=>{ze({}),e=!1})),gl=()=>ht((()=>{$e({}),t=!1})),Il=(e,t)=>{if(-1!=n){pl();const l=e();return fl(t),l}},pl=()=>(-1!=n&&n++,1==n&&Ce(pe,void 0,mt,bt),wl),fl=e=>(n>0&&(n--,0==n&&(l=!xt(S),a=!xt(M),n=1,ot(1),l&&ut(1),it(1),a&&ct(1),e?.(mt,bt)&&(Vt(S,((e,t)=>Vt(e,((e,l)=>Vt(e,(([e],s)=>Le(wl,t,l,s,e))))))),Vt(M,(([e],t)=>Me(wl,t,e))),l=a=!1),Ce(fe[0],void 0,mt,bt),n=-1,ot(0),l&&ut(0),it(0),a&&ct(0),Ce(fe[1],void 0,mt,bt),n=0,l=a=!1,H([o,u,v,k,T,S,E,V,M,z],St))),wl),wl={getContent:()=>[gt(),Wt()],getTables:gt,getTableIds:It,getTable:e=>At(Lt(G,x(e))),getTableCellIds:e=>Nt(Lt(j,x(e))),getRowCount:pt,getRowIds:ft,getSortedRowIds:Tt,getRow:(e,t)=>Ot(Lt(Lt(G,x(e)),x(t))),getCellIds:Qt,getCell:Dt,getValues:Wt,getValueIds:jt,getValue:Ut,hasTables:()=>!xt(G),hasTable:e=>kt(G,x(e)),hasTableCell:(e,t)=>kt(Lt(j,x(e)),x(t)),hasRow:(e,t)=>kt(Lt(G,x(e)),x(t)),hasCell:(e,t,l)=>kt(Lt(Lt(G,x(e)),x(t)),x(l)),hasValues:()=>!xt(K),hasValue:e=>kt(K,x(e)),getTablesJson:()=>se(G),getValuesJson:()=>se(K),getJson:()=>se([G,K]),getTablesSchemaJson:()=>se($),getValuesSchemaJson:()=>se(A),getSchemaJson:()=>se([$,A]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>ht((()=>{(le(e)?ul:nl)(e),(le(t)?ml:rl)(t)})),setTables:nl,setTable:(e,t)=>ht((e=>xe(t,e)?Je(e,t):0),e),setRow:(e,t,l)=>ht(((e,t)=>Te(e,t,l)?Fe(e,je(e),t,l):0),e,t),addRow:(e,t,l=!0)=>Il((()=>{let s;return Te(e,s,t)&&(e=x(e),Fe(e,je(e),s=We(e,l?1:0),t)),s})),setPartialRow:(e,t,l)=>ht(((e,t)=>{if(Te(e,t,l,1)){const s=je(e);te(l,((l,a)=>Pe(e,s,t,a,l)))}}),e,t),setCell:(e,t,l,s)=>ht(((e,t,l)=>q(Se(e,t,l,L(s)?s(Dt(e,t,l)):s),(s=>Pe(e,je(e),t,l,s)))),e,t,l),setValues:rl,setPartialValues:e=>ht((()=>Ve(e,1)?te(e,((e,t)=>De(t,e))):0)),setValue:(e,t)=>ht((e=>q(Re(e,L(t)?t(Ut(e)):t),(t=>De(e,t)))),e),setTransactionChanges:e=>ht((()=>{te(e[0],((e,t)=>R(e)?cl(t):te(e,((e,l)=>R(e)?hl(t,l):te(e,((e,s)=>Le(wl,t,l,s,e))))))),te(e[1],((e,t)=>Me(wl,t,e)))})),setTablesJson:ol,setValuesJson:e=>{try{Be(ae(e))}catch{}return wl},setJson:e=>{try{const[t,l]=ae(e);Oe(t),Be(l)}catch{ol(e)}return wl},setTablesSchema:il,setValuesSchema:dl,setSchema:(e,t)=>ht((()=>{il(e),dl(t)})),delTables:ul,delTable:cl,delRow:hl,delCell:(e,t,l,s)=>ht(((e,t,l)=>q(Lt(G,e),(a=>q(Lt(a,t),(n=>kt(n,l)?Ue(e,a,t,n,l,s):0))))),e,t,l),delValues:ml,delValue:e=>ht((e=>kt(K,e)?Xe(e):0),e),delTablesSchema:bl,delValuesSchema:gl,delSchema:()=>ht((()=>{bl(),gl()})),transaction:Il,startTransaction:pl,finishTransaction:fl,forEachTable:e=>Vt(G,((t,l)=>e(l,(e=>Vt(t,((t,l)=>e(l,(e=>Mt(t,e))))))))),forEachTableCell:(e,t)=>Mt(Lt(j,x(e)),t),forEachRow:(e,t)=>Vt(Lt(G,x(e)),((e,l)=>t(l,(t=>Mt(e,t))))),forEachCell:(e,t,l)=>Mt(Lt(Lt(G,x(e)),x(t)),l),forEachValue:e=>Mt(K,e),addSortedRowIdsListener:(e,t,l,s,a,n,r)=>{let o=Tt(e,t,l,s,a);return we((()=>{const r=Tt(e,t,l,s,a);var i,d,u;d=o,B(i=r)===B(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(o=r,n(wl,e,t,l,s,a,o))}),ie[r?1:0],[e,t],[It])},addStartTransactionListener:e=>we(e,pe),addWillFinishTransactionListener:e=>we(e,fe[0]),addDidFinishTransactionListener:e=>we(e,fe[1]),callListener:e=>(ve(e),wl),delListener:e=>(ye(e),wl),getListenerStats:()=>({tables:Zt(U),tableIds:Zt(Y),tableCellIds:Zt(ne),table:Zt(Z),rowCount:Zt(re),rowIds:Zt(oe),sortedRowIds:Zt(ie),row:Zt(de,yt),cellIds:Zt(ue,yt),cell:Zt(ce,vt),invalidCell:Zt(he,vt),values:Zt(be),valueIds:Zt(ge),value:Zt(Ie),invalidValue:Zt(me),transaction:Ct(pe)+Zt(fe)}),createStore:al,addListener:we,callListeners:Ce};return te({[h]:[0,U],[m]:[0,Y],[c]:[1,Z,[It]],[c+f]:[1,ne,[It]],[g]:[1,re,[It]],[I]:[1,oe,[It]],[b]:[2,de,[It,ft]],[f]:[2,ue,[It,ft]],[p]:[3,ce,[It,ft,Qt],e=>Yt(Dt(...e))],InvalidCell:[3,he],[C]:[0,be],[y]:[0,ge],[w]:[1,Ie,[jt],e=>Yt(Ut(e[0]))],InvalidValue:[1,me]},(([e,t,l,s],a)=>{wl["add"+a+"Listener"]=(...a)=>we(a[e],t[a[e+1]?1:0],e>0?D(a,0,e):void 0,l,s)})),X(wl)},nl=({position:e="right",open:l=!1})=>{const s=t.useCreateStore(al),a=oe.indexOf(e);return t.useCreatePersister(s,(e=>{return((e,t,l,s)=>((e,t,l,s,a,n,r=[])=>{let o,i,d,u=0,c=0,h=0,m=0;zt(Qt,r,(()=>0)),zt(Dt,r,(()=>[]));const b=async e=>(2!=u&&(u=1,c++,await g.schedule((async()=>{await e(),u=0}))),g),g={load:async(l,s)=>await b((async()=>{try{e.setContent(await t())}catch{e.setContent([l,s])}})),startAutoLoad:async(l={},a={})=>(g.stopAutoLoad(),await g.load(l,a),m=1,d=s((async(l,s)=>{if(s){const t=s();await b((async()=>e.setTransactionChanges(t)))}else await b((async()=>{try{e.setContent(l?.()??await t())}catch(e){n?.(e)}}))})),g),stopAutoLoad:()=>(m&&(a(d),d=void 0,m=0),g),save:async t=>(1!=u&&(u=2,h++,await g.schedule((async()=>{try{await l(e.getContent,t)}catch(e){n?.(e)}u=0}))),g),startAutoSave:async()=>(await g.stopAutoSave().save(),o=e.addDidFinishTransactionListener(((e,t)=>{const[l,s]=t();le(l)&&le(s)||g.save((()=>[l,s]))})),g),stopAutoSave:()=>(q(o,e.delListener),g),schedule:async(...e)=>(W(Lt(Dt,r),...e),await(async()=>{if(!Lt(Qt,r)){for(Et(Qt,r,1);!R(i=j(Lt(Dt,r)));)try{await i()}catch(e){n?.(e)}Et(Qt,r,0)}})(),g),getStore:()=>e,destroy:()=>g.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return X(g)})(e,(async()=>ae(l.getItem(t))),(async e=>l.setItem(t,se(e()))),(e=>{const s=s=>{s.storageArea===l&&s.key===t&&e((()=>ae(s.newValue)))};return jt.addEventListener(Wt,s),s}),(e=>jt.removeEventListener(Wt,e)),s))(e,ne,sessionStorage,t);var t}),void 0,(async e=>{await e.load(void 0,{position:-1==a?1:a,open:!!l}),await e.startAutoSave()})),E(z,null,E("aside",{id:ne},E(Re,{s:s}),E(pt,{s:s})),E("style",null,Ve))};exports.EditableCellView=et,exports.EditableValueView=tt,exports.RelationshipInHtmlTable=Ze,exports.ResultSortedTableInHtmlTable=_e,exports.ResultTableInHtmlTable=({queryId:e,queries:l,customCells:s,...a})=>E(We,{...a,params:He(De(t.useResultTableCellIds(e,l),s,t.ResultCellView),Be(l,e),t.useResultRowIds(e,l))}),exports.SliceInHtmlTable=Ye,exports.SortedTableInHtmlTable=Ue,exports.SortedTablePaginator=lt,exports.StoreInspector=e=>E(nl,{...e}),exports.TableInHtmlTable=({tableId:e,store:l,editable:s,customCells:a,...n})=>E(We,{...n,params:He(De(t.useTableCellIds(e,l),a,s?et:t.CellView),Pe(l,e),t.useRowIds(e,l))}),exports.ValuesInHtmlTable=Xe;
1
+ "use strict";var e=require("react"),t=require("./ui-react");const s=e=>typeof e,l="",a=s(l),n=s(!0),r=s(0),o=s(s),i="type",d="default",u="Ids",c="Table",h=c+"s",m=c+u,b="Row",g=b+"Count",p=b+u,I="Cell",f=I+u,w="Value",C=w+"s",y=w+u,v="currentTarget",k="value",x=e=>l+e,S=Math.floor,T=isFinite,V=(e,t)=>e instanceof t,R=e=>null==e,q=(e,t,s)=>R(e)?s?.():t(e),N=e=>e==a||e==n,L=e=>s(e)==o,M=e=>Array.isArray(e),{PureComponent:E,Fragment:z,createElement:$,useCallback:O,useLayoutEffect:A,useRef:F,useState:J}=e,P=(e,...t)=>R(e)?{}:e(...t),H=(e,t)=>e.forEach(t),B=(e,t)=>e.map(t),D=e=>e.length,Q=e=>0==D(e),j=(e,t,s)=>e.slice(t,s),W=(e,...t)=>e.push(...t),G=e=>e.shift(),K=Object,U=K.keys,X=K.isFrozen,Y=K.freeze,Z=e=>V(e,K)&&e.constructor==K,_=(e=[])=>K.fromEntries(e),ee=(e,t)=>!R(((e,t)=>q(e,(e=>e[t])))(e,t)),te=(e,t)=>(delete e[t],e),se=(e,t)=>B(K.entries(e),(([e,s])=>t(s,e))),le=e=>Z(e)&&0==(e=>D(U(e)))(e),ae=e=>JSON.stringify(e,((e,t)=>V(t,Map)?K.fromEntries([...t]):t)),ne=JSON.parse,re="tinybaseStoreInspector",oe="TinyBase Store Inspector",ie=["left","top","bottom","right","full"],de="state",ue="sort",ce="open",he="position",me=ce,be="editable",ge=(...e)=>ae(e),pe=(e,t)=>B(e.sort(),t),Ie=(e,s)=>[!!t.useCell(de,e,be,s),O((t=>{s.setCell(de,e,be,(e=>!e)),t.preventDefault()}),[s,e])],fe="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",we='content:url("',Ce=we+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",ye='</svg>")',ve=we+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",ke=B([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,s,l])=>Ce+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${s}' height='${l}' fill='white'/>`+ye)),xe=Ce+"<path d='M20 20l60 60M20 80l60-60' />"+ye,Se=Ce+`<path d='${fe}' />`+ye,Te=Ce+`<path d='${fe}M20 20l60 60' />`+ye,Ve="*::-webkit-scrollbar",Re=((e,t="")=>e.join(t))(se({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ve]:"width:0.5rem;height:0.5rem;",[Ve+"-track"]:"background:#111",[Ve+"-thumb"]:"background:#999;border:1px solid #111",[Ve+"-thumb:hover"]:"background:#fff",[Ve+"-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;"+ve,..._(B(["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;",..._(B(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":ve,"header>img:nth-of-type(6)":xe,..._(B(ke,((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":Se,"details[open]>summary img.done":Te,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,#${re} 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?`#${re} ${t}{${e}}`:""))),qe=({s:e})=>{const s=t.useValue(he,e)??1,l=t.useSetValueCallback(me,(()=>!0),[],e);return t.useValue(me,e)?null:$("img",{onClick:l,title:oe,"data-position":s})},Ne=({uniqueId:e,summary:s,editable:l,handleEditable:a,children:n,s:r})=>{const o=!!t.useCell(de,e,ce,r),i=t.useSetCellCallback(de,e,ce,(e=>e[v].open),[],r);return $("details",{open:o,onToggle:i},$("summary",null,s,a?$("img",{onClick:a,className:l?"done":"edit"}):null),n)},Le=e=>{const t=s(e);return N(t)||t==r&&T(e)?t:void 0},Me=(e,t,s,l,a)=>R(a)?e.delCell(t,s,l,!0):e.setCell(t,s,l,a),Ee=(e,t,s)=>R(s)?e.delValue(t):e.setValue(t,s),ze=(e,t,s,l)=>e==a?t:e==r?s:l,{useCallback:$e,useMemo:Oe,useState:Ae}=e,Fe="editable",Je=(e,s)=>B(t.useTableCellIds(e,s),(t=>e+"."+t)),Pe=(e,t,s)=>{const l=$e(e,t);return s?l:void 0},He=(...e)=>Oe((()=>e),e),Be=(e,t)=>Oe((()=>({store:e,tableId:t})),[e,t]),De=(e,t)=>Oe((()=>({queries:e,queryId:t})),[e,t]),Qe=(e,t=!1,s,l=0,a,n,r,o)=>{const[[i,d,u],c]=Ae([e,t,l]),h=$e((e=>{c(e),o?.(e)}),[o]),m=Pe((e=>h([e,e==i&&!d,u])),[h,i,d,u],s),b=$e((e=>h([i,d,e])),[h,i,d]),g=!0===r?lt:r;return[[i,d,u],m,Oe((()=>!1===r?null:$(g,{offset:u,limit:a,total:n,onChange:b})),[r,g,u,a,n,b])]},je=(e,t,l)=>Oe((()=>{const n=t??e;return _(se(M(n)?_(B(n,(e=>[e,e]))):n,((e,t)=>{return[t,{label:t,component:l,...(n=e,s(n)==a?{label:e}:e)}];var n})))}),[t,l,e]),We=({className:e,headerRow:t,idColumn:s,params:[l,a,n,r,o,i]})=>$("table",{className:e},i?$("caption",null,i):null,!1===t?null:$("thead",null,$("tr",null,!1===s?null:$(Ge,{sort:r??[],label:"Id",onClick:o}),se(l,(({label:e},t)=>$(Ge,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),$("tbody",null,B(n,(e=>$("tr",{key:e},!1===s?null:$("th",null,e),se(l,(({component:t,getComponentProps:s},l)=>$("td",{key:l},$(t,{...P(s,e,l),...a,rowId:e,cellId:l}))))))))),Ge=({cellId:e,sort:[t,s],label:a=e??l,onClick:n})=>$("th",{onClick:Pe((()=>n?.(e)),[n,e],n),className:R(s)||t!=e?void 0:`sorted ${s?"de":"a"}scending`},R(s)||t!=e?null:(s?"↓":"↑")+" ",a),Ke=({localRowId:s,params:[l,a,n,r,o,i,d]})=>{const u=t.useRemoteRowId(o,s,i);return $("tr",null,!1===l?null:$(e.Fragment,null,$("th",null,s),$("th",null,u)),se(a,(({component:e,getComponentProps:t},l)=>{const[a,o]=l.split(".",2),i=a===n?s:a===r?u:null;return R(i)?null:$("td",{key:l},$(e,{...P(t,i,o),store:d,tableId:a,rowId:i,cellId:o}))})))},Ue=({thing:e,onThingChange:t,className:s,hasSchema:l})=>{const[o,i]=Ae(),[d,u]=Ae(),[c,h]=Ae(),[m,b]=Ae(),[g,p]=Ae();d!==e&&(i(Le(e)),u(e),h(e+""),b(Number(e)||0),p(!!e));const I=$e(((e,s)=>{s(e),u(e),t(e)}),[t]);return $("div",{className:s},$("button",{className:o,onClick:$e((()=>{if(!l?.()){const e=ze(o,r,n,a),s=ze(e,c,m,g);i(e),u(s),t(s)}}),[l,t,c,m,g,o])},o),ze(o,$("input",{key:o,value:c,onChange:$e((e=>I(e[v][k]+"",h)),[I])}),$("input",{key:o,type:"number",value:m,onChange:$e((e=>I(Number(e[v][k]||0),b)),[I])}),$("input",{key:o,type:"checkbox",checked:g,onChange:$e((e=>I(!!e[v].checked,p)),[I])})))},Xe=({tableId:e,cellId:s,descending:l,offset:a,limit:n,store:r,editable:o,sortOnClick:i,paginator:d=!1,onChange:u,customCells:c,...h})=>{const[m,b,g]=Qe(s,l,i,a,n,t.useRowCount(e,r),d,u);return $(We,{...h,params:He(je(t.useTableCellIds(e,r),c,o?tt:t.CellView),Be(r,e),t.useSortedRowIds(e,...m,n,r),m,b,g)})},Ye=({store:e,editable:s=!1,valueComponent:l=(s?st:t.ValueView),getValueComponentProps:a,className:n,headerRow:r,idColumn:o})=>$("table",{className:n},!1===r?null:$("thead",null,$("tr",null,!1===o?null:$("th",null,"Id"),$("th",null,w))),$("tbody",null,B(t.useValueIds(e),(t=>$("tr",{key:t},!1===o?null:$("th",null,t),$("td",null,$(l,{...P(a,t),valueId:t,store:e}))))))),Ze=({indexId:e,sliceId:s,indexes:l,editable:a,customCells:n,...r})=>{const[o,i,d]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(t.useIndexesOrIndexesById(l),e);return $(We,{...r,params:He(je(t.useTableCellIds(d,i),n,a?tt:t.CellView),Be(i,d),t.useSliceRowIds(e,s,o))})},_e=({relationshipId:s,relationships:l,editable:a,customCells:n,className:r,headerRow:o,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(l),s),m=je([...Je(c,u),...Je(h,u)],n,a?tt:t.CellView),b=He(i,m,c,h,s,d,u);return $("table",{className:r},!1===o?null:$("thead",null,$("tr",null,!1===i?null:$(e.Fragment,null,$("th",null,c,".Id"),$("th",null,h,".Id")),se(m,(({label:e},t)=>$("th",{key:t},e))))),$("tbody",null,B(t.useRowIds(c,u),(e=>$(Ke,{key:e,localRowId:e,params:b})))))},et=({queryId:e,cellId:s,descending:l,offset:a,limit:n,queries:r,sortOnClick:o,paginator:i=!1,customCells:d,onChange:u,...c})=>{const[h,m,b]=Qe(s,l,o,a,n,t.useResultRowCount(e,r),i,u);return $(We,{...c,params:He(je(t.useResultTableCellIds(e,r),d,t.ResultCellView),De(r,e),t.useResultSortedRowIds(e,...h,n,r),h,m,b)})},tt=({tableId:e,rowId:s,cellId:l,store:a,className:n})=>$(Ue,{thing:t.useCell(e,s,l,a),onThingChange:t.useSetCellCallback(e,s,l,(e=>e),[],a),className:n??Fe+I,hasSchema:t.useStoreOrStoreById(a)?.hasTablesSchema}),st=({valueId:e,store:s,className:l})=>$(Ue,{thing:t.useValue(e,s),onThingChange:t.useSetValueCallback(e,(e=>e),[],s),className:l??Fe+w,hasSchema:t.useStoreOrStoreById(s)?.hasValuesSchema}),lt=({onChange:t,total:s,offset:l=0,limit:a=s,singular:n="row",plural:r=n+"s"})=>{(l>s||l<0)&&(l=0,t(0));const o=Pe((()=>t(l-a)),[t,l,a],l>0),i=Pe((()=>t(l+a)),[t,l,a],l+a<s);return $(e.Fragment,null,s>a&&$(e.Fragment,null,$("button",{className:"previous",disabled:0==l,onClick:o},"←"),$("button",{className:"next",disabled:l+a>=s,onClick:i},"→"),l+1," to ",Math.min(s,l+a)," of "),s," ",1!=s?r:n)},at=({indexes:e,indexesId:s,indexId:l,s:a})=>$(Ne,{uniqueId:ge("i",s,l),summary:"Index: "+l,s:a},B(t.useSliceIds(l,e),(t=>$(nt,{indexes:e,indexesId:s,indexId:l,sliceId:t,s:a})))),nt=({indexes:e,indexesId:t,indexId:s,sliceId:l,s:a})=>{const n=ge("i",t,s,l),[r,o]=Ie(n,a);return $(Ne,{uniqueId:n,summary:"Slice: "+l,editable:r,handleEditable:o,s:a},$(Ze,{sliceId:l,indexId:s,indexes:e,editable:r}))},rt=({indexesId:e,s:s})=>{const l=t.useIndexes(e),a=t.useIndexIds(l);return R(l)?null:$(Ne,{uniqueId:ge("i",e),summary:"Indexes: "+(e??d),s:s},Q(a)?"No indexes defined":pe(a,(t=>$(at,{indexes:l,indexesId:e,indexId:t,s:s}))))},ot=({metrics:e,metricId:s})=>$("tr",null,$("th",null,s),$("td",null,e?.getTableId(s)),$("td",null,t.useMetric(s,e))),it=({metricsId:e,s:s})=>{const l=t.useMetrics(e),a=t.useMetricIds(l);return R(l)?null:$(Ne,{uniqueId:ge("m",e),summary:"Metrics: "+(e??d),s:s},Q(a)?"No metrics defined":$("table",null,$("thead",null,$("th",null,"Metric Id"),$("th",null,"Table Id"),$("th",null,"Metric")),$("tbody",null,B(a,(e=>$(ot,{metrics:l,metricId:e}))))))},dt=({queries:e,queriesId:s,queryId:l,s:a})=>{const n=ge("q",s,l),[r,o,i]=ne(t.useCell(de,n,ue,a)??"[]"),d=t.useSetCellCallback(de,n,ue,ae,[],a);return $(Ne,{uniqueId:n,summary:"Query: "+l,s:a},$(et,{queryId:l,queries:e,cellId:r,descending:o,offset:i,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},ut=({queriesId:e,s:s})=>{const l=t.useQueries(e),a=t.useQueryIds(l);return R(l)?null:$(Ne,{uniqueId:ge("q",e),summary:"Queries: "+(e??d),s:s},Q(a)?"No queries defined":pe(a,(t=>$(dt,{queries:l,queriesId:e,queryId:t,s:s}))))},ct=({relationships:e,relationshipsId:t,relationshipId:s,s:l})=>{const a=ge("r",t,s),[n,r]=Ie(a,l);return $(Ne,{uniqueId:a,summary:"Relationship: "+s,editable:n,handleEditable:r,s:l},$(_e,{relationshipId:s,relationships:e,editable:n}))},ht=({relationshipsId:e,s:s})=>{const l=t.useRelationships(e),a=t.useRelationshipIds(l);return R(l)?null:$(Ne,{uniqueId:ge("r",e),summary:"Relationships: "+(e??d),s:s},Q(a)?"No relationships defined":pe(a,(t=>$(ct,{relationships:l,relationshipsId:e,relationshipId:t,s:s}))))},mt=({tableId:e,store:s,storeId:l,s:a})=>{const n=ge("t",l,e),[r,o,i]=ne(t.useCell(de,n,ue,a)??"[]"),d=t.useSetCellCallback(de,n,ue,ae,[],a),[u,h]=Ie(n,a);return $(Ne,{uniqueId:n,summary:c+": "+e,editable:u,handleEditable:h,s:a},$(Xe,{tableId:e,store:s,cellId:r,descending:o,offset:i,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:u}))},bt=({store:e,storeId:s,s:l})=>{const a=ge("v",s),[n,r]=Ie(a,l);return Q(t.useValueIds(e))?null:$(Ne,{uniqueId:a,summary:C,editable:n,handleEditable:r,s:l},$(Ye,{store:e,editable:n}))},gt=({storeId:e,s:s})=>{const l=t.useStore(e),a=t.useTableIds(l);return R(l)?null:$(Ne,{uniqueId:ge("s",e),summary:"Store: "+(e??d),s:s},$(bt,{storeId:e,store:l,s:s}),pe(a,(t=>$(mt,{store:l,storeId:e,tableId:t,s:s}))))},pt=({s:e})=>{const s=F(null),l=F(0),[a,n]=J(!1),{scrollLeft:r,scrollTop:o}=t.useValues(e);A((()=>{const e=s.current;if(e&&!a){const t=new MutationObserver((()=>{e.scrollWidth>=S(r)+e.clientWidth&&e.scrollHeight>=S(o)+e.clientHeight&&e.scrollTo(r,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[a,r,o]);const i=O((t=>{const{scrollLeft:s,scrollTop:a}=t[v];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{n(!0),e.setPartialValues({scrollLeft:s,scrollTop:a})}))}),[e]),d=t.useStore(),u=t.useStoreIds(),c=t.useMetrics(),h=t.useMetricsIds(),m=t.useIndexes(),b=t.useIndexesIds(),g=t.useRelationships(),p=t.useRelationshipsIds(),I=t.useQueries(),f=t.useQueriesIds();return R(d)&&Q(u)&&R(c)&&Q(h)&&R(m)&&Q(b)&&R(g)&&Q(p)&&R(I)&&Q(f)?$("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):$("article",{ref:s,onScroll:i},$(gt,{s:e}),B(u,(t=>$(gt,{storeId:t,key:t,s:e}))),$(it,{s:e}),B(h,(t=>$(it,{metricsId:t,key:t,s:e}))),$(rt,{s:e}),B(b,(t=>$(rt,{indexesId:t,key:t,s:e}))),$(ht,{s:e}),B(p,(t=>$(ht,{relationshipsId:t,key:t,s:e}))),$(ut,{s:e}),B(f,(t=>$(ut,{queriesId:t,key:t,s:e}))))};class It extends E{constructor(e){super(e),this.state={e:0}}static getDerivedStateFromError=()=>({e:1});componentDidCatch=(e,t)=>console.error(e,t.componentStack);render(){return this.state.e?$("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const ft=({s:e})=>{const s=t.useValue(he,e)??1,l=t.useSetValueCallback(me,(()=>!1),[],e),a=t.useSetValueCallback(he,(e=>Number(e[v].dataset.id)),[],e);return $("header",null,$("img",{title:oe}),$("span",null,oe),B(ie,((e,t)=>t==s?null:$("img",{onClick:a,"data-id":t,title:"Dock to "+e,key:t}))),$("img",{onClick:l,title:"Close"}))},wt=({s:e})=>{const s=t.useValue(he,e)??1;return t.useValue(me,e)?$("main",{"data-position":s},$(ft,{s:e}),$(It,null,$(pt,{s:e}))):null},Ct=e=>t=>{return s=(t,s)=>t+e(s),Vt(t).reduce(s,0);var s},yt=e=>e?.size??0,vt=Ct(yt),kt=Ct(vt),xt=Ct(kt),St=(e,t)=>e?.has(t)??!1,Tt=e=>R(e)||0==yt(e),Vt=e=>[...e?.values()??[]],Rt=e=>e.clear(),qt=(e,t)=>e?.forEach(t),Nt=(e,t)=>e?.delete(t),Lt=e=>new Map(e),Mt=e=>[...e?.keys()??[]],Et=(e,t)=>e?.get(t),zt=(e,t)=>qt(e,((e,s)=>t(s,e))),$t=(e,t,s)=>R(s)?(Nt(e,t),e):e?.set(t,s),Ot=(e,t,s)=>(St(e,t)||$t(e,t,s()),Et(e,t)),At=(e,t,s,l=$t)=>(se(t,((t,l)=>s(e,l,t))),zt(e,(s=>ee(t,s)?0:l(e,s))),e),Ft=(e,t,s)=>{const l={};return qt(e,((e,a)=>{const n=t?t(e,a):e;!s?.(n,e)&&(l[a]=n)})),l},Jt=(e,t,s)=>Ft(e,(e=>Ft(e,t,s)),le),Pt=(e,t,s)=>Ft(e,(e=>Jt(e,t,s)),le),Ht=(e,t)=>{const s=Lt();return qt(e,((e,l)=>s.set(l,t?.(e)??e))),s},Bt=e=>Ht(e,Ht),Dt=e=>Ht(e,Bt),Qt=(e,t,s,l,a=0)=>q((s?Ot:Et)(e,t[a],a>D(t)-2?s:Lt),(n=>{if(a>D(t)-2)return l?.(n)&&$t(e,t[a]),n;const r=Qt(n,t,s,l,a+1);return Tt(n)&&$t(e,t[a]),r})),jt=Lt(),Wt=Lt(),Gt="storage",Kt=globalThis.window,Ut=e=>new Set(M(e)||R(e)?e:[e]),Xt=(e,t)=>e?.add(t),Yt=/^\d+$/,Zt=()=>{const e=[];let t=0;return[s=>(s?G(e):null)??l+t++,t=>{Yt.test(t)&&D(e)<1e3&&W(e,t)}]},_t=e=>[e,e],es=(e,t=vt)=>t(e[0])+t(e[1]),ts=()=>[Lt(),Lt()],ss=e=>[...e],ls=([e,t])=>e===t,as=(e,t,s)=>R(e)||!Z(e)||le(e)||X(e)?(s?.(),!1):(se(e,((s,l)=>{t(s,l)||te(e,l)})),!le(e)),ns=(e,t,s)=>$t(e,t,Et(e,t)==-s?void 0:s),rs=()=>{let e,t,s=!1,a=!1,n=0;const o=Lt(),u=Lt(),v=Lt(),k=Lt(),S=Lt(),T=Lt(),V=Lt(),M=Lt(),E=Lt(),z=Lt(),$=Lt(),O=Lt(),A=Lt(),F=Lt(),J=Ut(),P=Lt(),Q=Lt(),G=Lt(),K=Lt(),U=ts(),X=ts(),Z=ts(),_=ts(),re=ts(),oe=ts(),ie=ts(),de=ts(),ue=ts(),ce=ts(),he=ts(),me=ts(),be=ts(),ge=ts(),pe=ts(),Ie=Lt(),fe=ts(),[we,Ce,ye,ve]=(e=>{let t;const[s,a]=Zt(),n=Lt();return[(e,a,r,o=[],i=(()=>[]))=>{t??=ws;const d=s(1);return $t(n,d,[e,a,r,o,i]),Xt(Qt(a,r??[l],Ut),d),d},(e,s,...a)=>H(((e,t=[l])=>{const s=[],a=(e,l)=>l==D(t)?W(s,e):null===t[l]?qt(e,(e=>a(e,l+1))):H([t[l],null],(t=>a(Et(e,t),l+1)));return a(e,0),s})(e,s),(e=>qt(e,(e=>Et(n,e)[0](t,...s??[],...a))))),e=>q(Et(n,e),(([,t,s])=>(Qt(t,s??[l],void 0,(t=>(Nt(t,e),Tt(t)?1:0))),$t(n,e),a(e),s))),e=>q(Et(n,e),(([e,,s=[],l,a])=>{const n=(...r)=>{const o=D(r);o==D(s)?e(t,...r,...a(r)):R(s[o])?H(l[o]?.(...r)??[],(e=>n(...r,e))):n(...r,s[o])};n()}))]})(),ke=e=>{if(!as(e,((e,t)=>[i,d].includes(t))))return!1;const t=e[i];return!(!N(t)&&t!=r||(Le(e[d])!=t&&te(e,d),0))},xe=(t,s)=>(!e||St($,s)||lt(s))&&as(t,((e,t)=>Se(s,t,e)),(()=>lt(s))),Se=(e,t,s,l)=>as(l?s:qe(s,e,t),((l,a)=>q(Te(e,t,a,l),(e=>(s[a]=e,!0)),(()=>!1))),(()=>lt(e,t))),Te=(t,s,l,a)=>e?q(Et(Et($,t),l),(e=>Le(a)!=e[i]?lt(t,s,l,a,e[d]):a),(()=>lt(t,s,l,a))):R(Le(a))?lt(t,s,l,a):a,Ve=(e,t)=>as(t?e:Ne(e),((t,s)=>q(Re(s,t),(t=>(e[s]=t,!0)),(()=>!1))),(()=>at())),Re=(e,s)=>t?q(Et(A,e),(t=>Le(s)!=t[i]?at(e,s,t[d]):s),(()=>at(e,s))):R(Le(s))?at(e,s):s,qe=(e,t,s)=>(q(Et(O,t),(([l,a])=>{qt(l,((t,s)=>{ee(e,s)||(e[s]=t)})),qt(a,(l=>{ee(e,l)||lt(t,s,l)}))})),e),Ne=e=>(t&&(qt(F,((t,s)=>{ee(e,s)||(e[s]=t)})),qt(J,(t=>{ee(e,t)||at(t)}))),e),ze=e=>At($,e,((e,t,s)=>{const l=Lt(),a=Ut();At(Ot($,t,Lt),s,((e,t,s)=>{$t(e,t,s),q(s[d],(e=>$t(l,t,e)),(()=>Xt(a,t)))})),$t(O,t,[l,a])}),((e,t)=>{$t($,t),$t(O,t)})),$e=e=>At(A,e,((e,t,s)=>{$t(A,t,s),q(s[d],(e=>$t(F,t,e)),(()=>Xt(J,t)))}),((e,t)=>{$t(A,t),$t(F,t),Nt(J,t)})),Oe=e=>le(e)?us():Kt(e),Ae=e=>At(G,e,((e,t,s)=>Fe(t,s)),((e,t)=>Ge(t))),Fe=(e,t)=>At(Ot(G,e,(()=>(Ye(e,1),$t(P,e,Zt()),$t(Q,e,Lt()),Lt()))),t,((t,s,l)=>Je(e,t,s,l)),((t,s)=>Ke(e,t,s))),Je=(e,t,s,l,a)=>At(Ot(t,s,(()=>(Ze(e,s,1),Lt()))),l,((t,l,a)=>Pe(e,s,t,l,a)),((l,n)=>Ue(e,t,s,l,n,a))),Pe=(e,t,s,l,a)=>{St(s,l)||_e(e,t,l,1);const n=Et(s,l);a!==n&&(et(e,t,l,n,a),$t(s,l,a))},He=(e,t,s,l,a)=>q(Et(t,s),(t=>Pe(e,s,t,l,a)),(()=>Je(e,t,s,qe({[l]:a},e,s)))),Be=e=>le(e)?ms():Yt(e),De=e=>At(K,e,((e,t,s)=>Qe(t,s)),((e,t)=>Xe(t))),Qe=(e,t)=>{St(K,e)||tt(e,1);const s=Et(K,e);t!==s&&(st(e,s,t),$t(K,e,t))},je=(e,t)=>{const[s]=Et(P,e),l=s(t);return St(Et(G,e),l)?je(e,t):l},We=e=>Et(G,e)??Fe(e,{}),Ge=e=>Fe(e,{}),Ke=(e,t,s)=>{const[,l]=Et(P,e);l(s),Je(e,t,s,{},!0)},Ue=(e,t,s,l,a,n)=>{const r=Et(Et(O,e)?.[0],a);if(!R(r)&&!n)return Pe(e,s,l,a,r);const o=t=>{et(e,s,t,Et(l,t)),_e(e,s,t,-1),$t(l,t)};R(r)?o(a):zt(l,o),Tt(l)&&(Ze(e,s,-1),Tt($t(t,s))&&(Ye(e,-1),$t(G,e),$t(P,e),$t(Q,e)))},Xe=e=>{const t=Et(F,e);if(!R(t))return Qe(e,t);st(e,Et(K,e)),tt(e,-1),$t(K,e)},Ye=(e,t)=>ns(o,e,t),Ze=(e,t,s)=>ns(Ot(k,e,Lt),t,s)&&$t(v,e,Ot(v,e,(()=>0))+s),_e=(e,t,s,l)=>{const a=Et(Q,e),n=Et(a,s)??0;(0==n&&1==l||1==n&&-1==l)&&ns(Ot(u,e,Lt),s,l),$t(a,s,n!=-l?n+l:null),ns(Ot(Ot(S,e,Lt),t,Lt),s,l)},et=(e,t,s,l,a)=>Ot(Ot(Ot(T,e,Lt),t,Lt),s,(()=>[l,0]))[1]=a,tt=(e,t)=>ns(V,e,t),st=(e,t,s)=>Ot(M,e,(()=>[t,0]))[1]=s,lt=(e,t,s,l,a)=>(W(Ot(Ot(Ot(E,e,Lt),t,Lt),s,(()=>[])),l),a),at=(e,t,s)=>(W(Ot(z,e,(()=>[])),t),s),nt=(e,t,s)=>q(Et(Et(Et(T,e),t),s),(([e,t])=>[!0,e,t]),(()=>[!1,..._t(Vt(e,t,s))])),rt=e=>q(Et(M,e),(([e,t])=>[!0,e,t]),(()=>[!1,..._t(Gt(e))])),ot=e=>Tt(E)||Tt(he[e])?0:qt(e?Dt(E):E,((t,s)=>qt(t,((t,l)=>qt(t,((t,a)=>Ce(he[e],[s,l,a],t))))))),it=e=>Tt(z)||Tt(me[e])?0:qt(e?Ht(z):z,((t,s)=>Ce(me[e],[s],t))),dt=(e,t,s)=>{if(!Tt(t))return Ce(e,s,(()=>Ft(t))),1},ut=e=>{const t=Tt(ie[e]),s=Tt(ue[e])&&Tt(_[e])&&Tt(re[e])&&Tt(oe[e])&&t&&Tt(X[e]),l=Tt(ce[e])&&Tt(de[e])&&Tt(Z[e])&&Tt(U[e]);if(!s||!l){const a=e?[Ht(o),Bt(u),Ht(v),Bt(k),Dt(S),Dt(T)]:[o,u,v,k,S,T];if(!s){dt(X[e],a[0]),qt(a[1],((t,s)=>dt(_[e],t,[s]))),qt(a[2],((t,s)=>{0!=t&&Ce(re[e],[s],It(s))}));const s=Ut();qt(a[3],((l,a)=>{dt(oe[e],l,[a])&&!t&&(Ce(ie[e],[a,null]),Xt(s,a))})),t||qt(a[5],((t,l)=>{if(!St(s,l)){const s=Ut();qt(t,(e=>qt(e,(([t,l],a)=>l!==t?Xt(s,a):Nt(e,a))))),qt(s,(t=>Ce(ie[e],[l,t])))}})),qt(a[4],((t,s)=>qt(t,((t,l)=>dt(ue[e],t,[s,l])))))}if(!l){let t;qt(a[5],((s,l)=>{let a;qt(s,((s,n)=>{let r;qt(s,(([s,o],i)=>{o!==s&&(Ce(ce[e],[l,n,i],o,s,nt),t=a=r=1)})),r&&Ce(de[e],[l,n],nt)})),a&&Ce(Z[e],[l],nt)})),t&&Ce(U[e],void 0,nt)}}},ct=e=>{const t=Tt(ge[e]),s=Tt(pe[e])&&Tt(be[e]);if(!t||!s){const l=e?[Ht(V),Ht(M)]:[V,M];if(t||dt(ge[e],l[0]),!s){let t;qt(l[1],(([s,l],a)=>{l!==s&&(Ce(pe[e],[a],l,s,rt),t=1)})),t&&Ce(be[e],void 0,rt)}}},ht=(e,...t)=>(ps((()=>e(...B(t,x)))),ws),mt=()=>[Ft(T,((e,t)=>-1===Et(o,t)?null:Ft(e,((e,s)=>-1===Et(Et(k,t),s)?null:Ft(e,(([,e])=>e??null),((e,t)=>ls(t)))),le)),le),Ft(M,(([,e])=>e??null),((e,t)=>ls(t)))],bt=()=>({cellsTouched:s,valuesTouched:a,changedCells:Pt(T,ss,ls),invalidCells:Pt(E),changedValues:Ft(M,ss,ls),invalidValues:Ft(z),changedTableIds:Ft(o),changedRowIds:Jt(k),changedCellIds:Pt(S),changedValueIds:Ft(V)}),gt=()=>Pt(G),pt=()=>Mt(G),It=e=>yt(Et(G,x(e))),ft=e=>Mt(Et(G,x(e))),wt=(e,t,s,l=0,a)=>{return B(j((r=Et(G,x(e)),o=(e,s)=>[R(t)?s:Et(e,x(t)),s],n=([e],[t])=>((e??0)<(t??0)?-1:1)*(s?-1:1),B([...r?.entries()??[]],(([e,t])=>o(t,e))).sort(n)),l,R(a)?a:l+a),(([,e])=>e));var n,r,o},Ct=(e,t)=>Mt(Et(Et(G,x(e)),x(t))),Vt=(e,t,s)=>Et(Et(Et(G,x(e)),x(t)),x(s)),jt=()=>Ft(K),Wt=()=>Mt(K),Gt=e=>Et(K,x(e)),Kt=e=>ht((()=>(e=>as(e,xe,lt))(e)?Ae(e):0)),Yt=e=>ht((()=>Ve(e)?De(e):0)),os=e=>{try{Oe(ne(e))}catch{}return ws},is=t=>ht((()=>{if((e=as(t,(e=>as(e,ke))))&&(ze(t),!Tt(G))){const e=gt();us(),Kt(e)}})),ds=e=>ht((()=>{if(t=(e=>as(e,ke))(e)){const s=jt();gs(),ms(),t=!0,$e(e),Yt(s)}})),us=()=>ht((()=>Ae({}))),cs=e=>ht((e=>St(G,e)?Ge(e):0),e),hs=(e,t)=>ht(((e,t)=>q(Et(G,e),(s=>St(s,t)?Ke(e,s,t):0))),e,t),ms=()=>ht((()=>De({}))),bs=()=>ht((()=>{ze({}),e=!1})),gs=()=>ht((()=>{$e({}),t=!1})),ps=(e,t)=>{if(-1!=n){Is();const s=e();return fs(t),s}},Is=()=>(-1!=n&&n++,1==n&&Ce(Ie,void 0,mt,bt),ws),fs=e=>(n>0&&(n--,0==n&&(s=!Tt(T),a=!Tt(M),n=1,ot(1),s&&ut(1),it(1),a&&ct(1),e?.(mt,bt)&&(qt(T,((e,t)=>qt(e,((e,s)=>qt(e,(([e],l)=>Me(ws,t,s,l,e))))))),qt(M,(([e],t)=>Ee(ws,t,e))),s=a=!1),Ce(fe[0],void 0,mt,bt),n=-1,ot(0),s&&ut(0),it(0),a&&ct(0),Ce(fe[1],void 0,mt,bt),n=0,s=a=!1,H([o,u,v,k,S,T,E,V,M,z],Rt))),ws),ws={getContent:()=>[gt(),jt()],getTables:gt,getTableIds:pt,getTable:e=>Jt(Et(G,x(e))),getTableCellIds:e=>Mt(Et(Q,x(e))),getRowCount:It,getRowIds:ft,getSortedRowIds:wt,getRow:(e,t)=>Ft(Et(Et(G,x(e)),x(t))),getCellIds:Ct,getCell:Vt,getValues:jt,getValueIds:Wt,getValue:Gt,hasTables:()=>!Tt(G),hasTable:e=>St(G,x(e)),hasTableCell:(e,t)=>St(Et(Q,x(e)),x(t)),hasRow:(e,t)=>St(Et(G,x(e)),x(t)),hasCell:(e,t,s)=>St(Et(Et(G,x(e)),x(t)),x(s)),hasValues:()=>!Tt(K),hasValue:e=>St(K,x(e)),getTablesJson:()=>ae(G),getValuesJson:()=>ae(K),getJson:()=>ae([G,K]),getTablesSchemaJson:()=>ae($),getValuesSchemaJson:()=>ae(A),getSchemaJson:()=>ae([$,A]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>ht((()=>{(le(e)?us:Kt)(e),(le(t)?ms:Yt)(t)})),setTables:Kt,setTable:(e,t)=>ht((e=>xe(t,e)?Fe(e,t):0),e),setRow:(e,t,s)=>ht(((e,t)=>Se(e,t,s)?Je(e,We(e),t,s):0),e,t),addRow:(e,t,s=!0)=>ps((()=>{let l;return Se(e,l,t)&&(e=x(e),Je(e,We(e),l=je(e,s?1:0),t)),l})),setPartialRow:(e,t,s)=>ht(((e,t)=>{if(Se(e,t,s,1)){const l=We(e);se(s,((s,a)=>He(e,l,t,a,s)))}}),e,t),setCell:(e,t,s,l)=>ht(((e,t,s)=>q(Te(e,t,s,L(l)?l(Vt(e,t,s)):l),(l=>He(e,We(e),t,s,l)))),e,t,s),setValues:Yt,setPartialValues:e=>ht((()=>Ve(e,1)?se(e,((e,t)=>Qe(t,e))):0)),setValue:(e,t)=>ht((e=>q(Re(e,L(t)?t(Gt(e)):t),(t=>Qe(e,t)))),e),setTransactionChanges:e=>ht((()=>{se(e[0],((e,t)=>R(e)?cs(t):se(e,((e,s)=>R(e)?hs(t,s):se(e,((e,l)=>Me(ws,t,s,l,e))))))),se(e[1],((e,t)=>Ee(ws,t,e)))})),setTablesJson:os,setValuesJson:e=>{try{Be(ne(e))}catch{}return ws},setJson:e=>{try{const[t,s]=ne(e);Oe(t),Be(s)}catch{os(e)}return ws},setTablesSchema:is,setValuesSchema:ds,setSchema:(e,t)=>ht((()=>{is(e),ds(t)})),delTables:us,delTable:cs,delRow:hs,delCell:(e,t,s,l)=>ht(((e,t,s)=>q(Et(G,e),(a=>q(Et(a,t),(n=>St(n,s)?Ue(e,a,t,n,s,l):0))))),e,t,s),delValues:ms,delValue:e=>ht((e=>St(K,e)?Xe(e):0),e),delTablesSchema:bs,delValuesSchema:gs,delSchema:()=>ht((()=>{bs(),gs()})),transaction:ps,startTransaction:Is,finishTransaction:fs,forEachTable:e=>qt(G,((t,s)=>e(s,(e=>qt(t,((t,s)=>e(s,(e=>zt(t,e))))))))),forEachTableCell:(e,t)=>zt(Et(Q,x(e)),t),forEachRow:(e,t)=>qt(Et(G,x(e)),((e,s)=>t(s,(t=>zt(e,t))))),forEachCell:(e,t,s)=>zt(Et(Et(G,x(e)),x(t)),s),forEachValue:e=>zt(K,e),addSortedRowIdsListener:(e,t,s,l,a,n,r)=>{let o=wt(e,t,s,l,a);return we((()=>{const r=wt(e,t,s,l,a);var i,d,u;d=o,D(i=r)===D(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(o=r,n(ws,e,t,s,l,a,o))}),ie[r?1:0],[e,t],[pt])},addStartTransactionListener:e=>we(e,Ie),addWillFinishTransactionListener:e=>we(e,fe[0]),addDidFinishTransactionListener:e=>we(e,fe[1]),callListener:e=>(ve(e),ws),delListener:e=>(ye(e),ws),getListenerStats:()=>({tables:es(U),tableIds:es(X),tableCellIds:es(_),table:es(Z),rowCount:es(re),rowIds:es(oe),sortedRowIds:es(ie),row:es(de,kt),cellIds:es(ue,kt),cell:es(ce,xt),invalidCell:es(he,xt),values:es(be),valueIds:es(ge),value:es(pe),invalidValue:es(me),transaction:vt(Ie)+es(fe)}),createStore:rs,addListener:we,callListeners:Ce};return se({[h]:[0,U],[m]:[0,X],[c]:[1,Z,[pt]],[c+f]:[1,_,[pt]],[g]:[1,re,[pt]],[p]:[1,oe,[pt]],[b]:[2,de,[pt,ft]],[f]:[2,ue,[pt,ft]],[I]:[3,ce,[pt,ft,Ct],e=>_t(Vt(...e))],InvalidCell:[3,he],[C]:[0,be],[y]:[0,ge],[w]:[1,pe,[Wt],e=>_t(Gt(e[0]))],InvalidValue:[1,me]},(([e,t,s,l],a)=>{ws["add"+a+"Listener"]=(...a)=>we(a[e],t[a[e+1]?1:0],e>0?j(a,0,e):void 0,s,l)})),Y(ws)},os=({position:e="right",open:s=!1})=>{const l=t.useCreateStore(rs),a=ie.indexOf(e);return t.useCreatePersister(l,(e=>{return((e,t,s,l)=>((e,t,s,l,a,n,r=[])=>{let o,i,d,u=0,c=0,h=0,m=0;Ot(jt,r,(()=>0)),Ot(Wt,r,(()=>[]));const b=async e=>(2!=u&&(u=1,c++,await g.schedule((async()=>{await e(),u=0}))),g),g={load:async(s,l)=>await b((async()=>{try{e.setContent(await t())}catch{e.setContent([s,l])}})),startAutoLoad:async(s={},a={})=>(g.stopAutoLoad(),await g.load(s,a),m=1,d=l((async(s,l)=>{if(l){const t=l();await b((async()=>e.setTransactionChanges(t)))}else await b((async()=>{try{e.setContent(s?.()??await t())}catch(e){n?.(e)}}))})),g),stopAutoLoad:()=>(m&&(a(d),d=void 0,m=0),g),save:async t=>(1!=u&&(u=2,h++,await g.schedule((async()=>{try{await s(e.getContent,t)}catch(e){n?.(e)}u=0}))),g),startAutoSave:async()=>(await g.stopAutoSave().save(),o=e.addDidFinishTransactionListener(((e,t)=>{const[s,l]=t();le(s)&&le(l)||g.save((()=>[s,l]))})),g),stopAutoSave:()=>(q(o,e.delListener),g),schedule:async(...e)=>(W(Et(Wt,r),...e),await(async()=>{if(!Et(jt,r)){for($t(jt,r,1);!R(i=G(Et(Wt,r)));)try{await i()}catch(e){n?.(e)}$t(jt,r,0)}})(),g),getStore:()=>e,destroy:()=>g.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return Y(g)})(e,(async()=>ne(s.getItem(t))),(async e=>s.setItem(t,ae(e()))),(e=>{const l=l=>{l.storageArea===s&&l.key===t&&e((()=>ne(l.newValue)))};return Kt.addEventListener(Gt,l),l}),(e=>Kt.removeEventListener(Gt,e)),l))(e,re,sessionStorage,t);var t}),void 0,(async e=>{await e.load(void 0,{position:-1==a?1:a,open:!!s}),await e.startAutoSave()})),$(z,null,$("aside",{id:re},$(qe,{s:l}),$(wt,{s:l})),$("style",null,Re))};exports.EditableCellView=tt,exports.EditableValueView=st,exports.RelationshipInHtmlTable=_e,exports.ResultSortedTableInHtmlTable=et,exports.ResultTableInHtmlTable=({queryId:e,queries:s,customCells:l,...a})=>$(We,{...a,params:He(je(t.useResultTableCellIds(e,s),l,t.ResultCellView),De(s,e),t.useResultRowIds(e,s))}),exports.SliceInHtmlTable=Ze,exports.SortedTableInHtmlTable=Xe,exports.SortedTablePaginator=lt,exports.StoreInspector=e=>$(os,{...e}),exports.TableInHtmlTable=({tableId:e,store:s,editable:l,customCells:a,...n})=>$(We,{...n,params:He(je(t.useTableCellIds(e,s),a,l?tt:t.CellView),Be(s,e),t.useRowIds(e,s))}),exports.ValuesInHtmlTable=Ye;
Binary file
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("./ui-react");const l=e=>typeof e,a=l(""),o=l(!0),n=l(0),r="Value",s="currentTarget",i="value",d=isFinite,u=e=>null==e,{createElement:m,Fragment:h,useCallback:c,useLayoutEffect:b,useRef:g,useState:p}=e,w=(e,...t)=>u(e)?{}:e(...t),f=(e,t)=>e.map(t),I=Object,C=(e=[])=>I.fromEntries(e),y=(e,t)=>f(I.entries(e),(([e,l])=>t(l,e))),x="tinybaseStoreInspector",k="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",v='content:url("',R=v+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",T='</svg>")',S=v+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",N=f([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,a])=>R+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${a}' fill='white'/>`+T)),V=R+"<path d='M20 20l60 60M20 80l60-60' />"+T,z=R+`<path d='${k}' />`+T,$=R+`<path d='${k}M20 20l60 60' />`+T,M="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(y({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[M]:"width:0.5rem;height:0.5rem;",[M+"-track"]:"background:#111",[M+"-thumb"]:"background:#999;border:1px solid #111",[M+"-thumb:hover"]:"background:#fff",[M+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+S,...C(f(["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;",...C(f(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":S,"header>img:nth-of-type(6)":V,...C(f(N,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":z,"details[open]>summary img.done":$,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,#${x} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left"},((e,t)=>e?`#${x} ${t}{${e}}`:"")));const q=(e,t,l,o)=>e==a?t:e==n?l:o,{useCallback:H,useMemo:O,useState:B}=e,F="editable",E=(e,l)=>f(t.useTableCellIds(e,l),(t=>e+"."+t)),P=(e,t,l)=>{const a=H(e,t);return l?a:void 0},j=(...e)=>O((()=>e),e),A=(e,t)=>O((()=>({store:e,tableId:t})),[e,t]),L=(e,t)=>O((()=>({queries:e,queryId:t})),[e,t]),D=(e,t=!1,l,a=0,o,n,r,s)=>{const[[i,d,u],h]=B([e,t,a]),c=H((e=>{h(e),s?.(e)}),[s]),b=P((e=>c([e,e==i&&!d,u])),[c,i,d,u],l),g=H((e=>c([i,d,e])),[c,i,d]),p=!0===r?Y:r;return[[i,d,u],b,O((()=>!1===r?null:m(p,{offset:u,limit:o,total:n,onChange:g})),[r,p,u,o,n,g])]},G=(e,t,o)=>O((()=>{const n=t??e;return C(y(Array.isArray(n)?C(f(n,(e=>[e,e]))):n,((e,t)=>{return[t,{label:t,component:o,...(n=e,l(n)==a?{label:e}:e)}];var n})))}),[t,o,e]),J=({className:e,headerRow:t,idColumn:l,params:[a,o,n,r,s,i]})=>m("table",{className:e},i?m("caption",null,i):null,!1===t?null:m("thead",null,m("tr",null,!1===l?null:m(K,{sort:r??[],label:"Id",onClick:s}),y(a,(({label:e},t)=>m(K,{key:t,cellId:t,label:e,sort:r??[],onClick:s}))))),m("tbody",null,f(n,(e=>m("tr",{key:e},!1===l?null:m("th",null,e),y(a,(({component:t,getComponentProps:l},a)=>m("td",{key:a},m(t,{...w(l,e,a),...o,rowId:e,cellId:a}))))))))),K=({cellId:e,sort:[t,l],label:a=e??"",onClick:o})=>m("th",{onClick:P((()=>o?.(e)),[o,e],o),className:u(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},u(l)||t!=e?null:(l?"↓":"↑")+" ",a),Q=({localRowId:l,params:[a,o,n,r,s,i,d]})=>{const h=t.useRemoteRowId(s,l,i);return m("tr",null,!1===a?null:m(e.Fragment,null,m("th",null,l),m("th",null,h)),y(o,(({component:e,getComponentProps:t},a)=>{const[o,s]=a.split(".",2),i=o===n?l:o===r?h:null;return u(i)?null:m("td",{key:a},m(e,{...w(t,i,s),store:d,tableId:o,rowId:i,cellId:s}))})))},U=({thing:e,onThingChange:t,className:r,hasSchema:u})=>{const[h,c]=B(),[b,g]=B(),[p,w]=B(),[f,I]=B(),[C,y]=B();b!==e&&(c((e=>{const t=l(e);return(e=>e==a||e==o)(t)||t==n&&d(e)?t:void 0})(e)),g(e),w(e+""),I(Number(e)||0),y(!!e));const x=H(((e,l)=>{l(e),g(e),t(e)}),[t]);return m("div",{className:r},m("button",{className:h,onClick:H((()=>{if(!u?.()){const e=q(h,n,o,a),l=q(e,p,f,C);c(e),g(l),t(l)}}),[u,t,p,f,C,h])},h),q(h,m("input",{key:h,value:p,onChange:H((e=>x(e[s][i]+"",w)),[x])}),m("input",{key:h,type:"number",value:f,onChange:H((e=>x(Number(e[s][i]||0),I)),[x])}),m("input",{key:h,type:"checkbox",checked:C,onChange:H((e=>x(!!e[s].checked,y)),[x])})))},W=({tableId:e,rowId:l,cellId:a,store:o,className:n})=>m(U,{thing:t.useCell(e,l,a,o),onThingChange:t.useSetCellCallback(e,l,a,(e=>e),[],o),className:n??F+"Cell",hasSchema:t.useStoreOrStoreById(o)?.hasTablesSchema}),X=({valueId:e,store:l,className:a})=>m(U,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:a??F+r,hasSchema:t.useStoreOrStoreById(l)?.hasValuesSchema}),Y=({onChange:t,total:l,offset:a=0,limit:o=l,singular:n="row",plural:r=n+"s"})=>{(a>l||a<0)&&(a=0,t(0));const s=P((()=>t(a-o)),[t,a,o],a>0),i=P((()=>t(a+o)),[t,a,o],a+o<l);return m(e.Fragment,null,l>o&&m(e.Fragment,null,m("button",{className:"previous",disabled:0==a,onClick:s},"←"),m("button",{className:"next",disabled:a+o>=l,onClick:i},"→"),a+1," to ",Math.min(l,a+o)," of "),l," ",1!=l?r:n)},Z=e=>new Map(e);Z(),Z(),exports.EditableCellView=W,exports.EditableValueView=X,exports.RelationshipInHtmlTable=({relationshipId:l,relationships:a,editable:o,customCells:n,className:r,headerRow:s,idColumn:i=!0})=>{const[d,u,h,c]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(a),l),b=G([...E(h,u),...E(c,u)],n,o?W:t.CellView),g=j(i,b,h,c,l,d,u);return m("table",{className:r},!1===s?null:m("thead",null,m("tr",null,!1===i?null:m(e.Fragment,null,m("th",null,h,".Id"),m("th",null,c,".Id")),y(b,(({label:e},t)=>m("th",{key:t},e))))),m("tbody",null,f(t.useRowIds(h,u),(e=>m(Q,{key:e,localRowId:e,params:g})))))},exports.ResultSortedTableInHtmlTable=({queryId:e,cellId:l,descending:a,offset:o,limit:n,queries:r,sortOnClick:s,paginator:i=!1,customCells:d,onChange:u,...h})=>{const[c,b,g]=D(l,a,s,o,n,t.useResultRowCount(e,r),i,u);return m(J,{...h,params:j(G(t.useResultTableCellIds(e,r),d,t.ResultCellView),L(r,e),t.useResultSortedRowIds(e,...c,n,r),c,b,g)})},exports.ResultTableInHtmlTable=({queryId:e,queries:l,customCells:a,...o})=>m(J,{...o,params:j(G(t.useResultTableCellIds(e,l),a,t.ResultCellView),L(l,e),t.useResultRowIds(e,l))}),exports.SliceInHtmlTable=({indexId:e,sliceId:l,indexes:a,editable:o,customCells:n,...r})=>{const[s,i,d]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(t.useIndexesOrIndexesById(a),e);return m(J,{...r,params:j(G(t.useTableCellIds(d,i),n,o?W:t.CellView),A(i,d),t.useSliceRowIds(e,l,s))})},exports.SortedTableInHtmlTable=({tableId:e,cellId:l,descending:a,offset:o,limit:n,store:r,editable:s,sortOnClick:i,paginator:d=!1,onChange:u,customCells:h,...c})=>{const[b,g,p]=D(l,a,i,o,n,t.useRowCount(e,r),d,u);return m(J,{...c,params:j(G(t.useTableCellIds(e,r),h,s?W:t.CellView),A(r,e),t.useSortedRowIds(e,...b,n,r),b,g,p)})},exports.SortedTablePaginator=Y,exports.StoreInspector=e=>null,exports.TableInHtmlTable=({tableId:e,store:l,editable:a,customCells:o,...n})=>m(J,{...n,params:j(G(t.useTableCellIds(e,l),o,a?W:t.CellView),A(l,e),t.useRowIds(e,l))}),exports.ValuesInHtmlTable=({store:e,editable:l=!1,valueComponent:a=(l?X:t.ValueView),getValueComponentProps:o,className:n,headerRow:s,idColumn:i})=>m("table",{className:n},!1===s?null:m("thead",null,m("tr",null,!1===i?null:m("th",null,"Id"),m("th",null,r))),m("tbody",null,f(t.useValueIds(e),(t=>m("tr",{key:t},!1===i?null:m("th",null,t),m("td",null,m(a,{...w(o,t),valueId:t,store:e})))))));
1
+ "use strict";var e=require("react"),t=require("./ui-react");const l=e=>typeof e,a=l(""),o=l(!0),n=l(0),r="Value",s="currentTarget",i="value",d=isFinite,u=e=>null==e,{PureComponent:m,Fragment:c,createElement:h,useCallback:b,useLayoutEffect:g,useRef:p,useState:w}=e,f=(e,...t)=>u(e)?{}:e(...t),I=(e,t)=>e.map(t),C=Object,y=(e=[])=>C.fromEntries(e),x=(e,t)=>I(C.entries(e),(([e,l])=>t(l,e))),k="tinybaseStoreInspector",v="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",R='content:url("',T=R+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",S='</svg>")',N=R+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",V=I([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,a])=>T+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${a}' fill='white'/>`+S)),z=T+"<path d='M20 20l60 60M20 80l60-60' />"+S,$=T+`<path d='${v}' />`+S,M=T+`<path d='${v}M20 20l60 60' />`+S,q="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(x({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[q]:"width:0.5rem;height:0.5rem;",[q+"-track"]:"background:#111",[q+"-thumb"]:"background:#999;border:1px solid #111",[q+"-thumb:hover"]:"background:#fff",[q+"-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;"+N,...y(I(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...y(I(["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)":N,"header>img:nth-of-type(6)":z,...y(I(V,((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":$,"details[open]>summary img.done":M,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${k} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"},((e,t)=>e?`#${k} ${t}{${e}}`:"")));const H=(e,t,l,o)=>e==a?t:e==n?l:o,{useCallback:O,useMemo:B,useState:F}=e,E="editable",P=(e,l)=>I(t.useTableCellIds(e,l),(t=>e+"."+t)),j=(e,t,l)=>{const a=O(e,t);return l?a:void 0},A=(...e)=>B((()=>e),e),L=(e,t)=>B((()=>({store:e,tableId:t})),[e,t]),D=(e,t)=>B((()=>({queries:e,queryId:t})),[e,t]),G=(e,t=!1,l,a=0,o,n,r,s)=>{const[[i,d,u],m]=F([e,t,a]),c=O((e=>{m(e),s?.(e)}),[s]),b=j((e=>c([e,e==i&&!d,u])),[c,i,d,u],l),g=O((e=>c([i,d,e])),[c,i,d]),p=!0===r?Z:r;return[[i,d,u],b,B((()=>!1===r?null:h(p,{offset:u,limit:o,total:n,onChange:g})),[r,p,u,o,n,g])]},J=(e,t,o)=>B((()=>{const n=t??e;return y(x(Array.isArray(n)?y(I(n,(e=>[e,e]))):n,((e,t)=>{return[t,{label:t,component:o,...(n=e,l(n)==a?{label:e}:e)}];var n})))}),[t,o,e]),K=({className:e,headerRow:t,idColumn:l,params:[a,o,n,r,s,i]})=>h("table",{className:e},i?h("caption",null,i):null,!1===t?null:h("thead",null,h("tr",null,!1===l?null:h(Q,{sort:r??[],label:"Id",onClick:s}),x(a,(({label:e},t)=>h(Q,{key:t,cellId:t,label:e,sort:r??[],onClick:s}))))),h("tbody",null,I(n,(e=>h("tr",{key:e},!1===l?null:h("th",null,e),x(a,(({component:t,getComponentProps:l},a)=>h("td",{key:a},h(t,{...f(l,e,a),...o,rowId:e,cellId:a}))))))))),Q=({cellId:e,sort:[t,l],label:a=e??"",onClick:o})=>h("th",{onClick:j((()=>o?.(e)),[o,e],o),className:u(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},u(l)||t!=e?null:(l?"↓":"↑")+" ",a),U=({localRowId:l,params:[a,o,n,r,s,i,d]})=>{const m=t.useRemoteRowId(s,l,i);return h("tr",null,!1===a?null:h(e.Fragment,null,h("th",null,l),h("th",null,m)),x(o,(({component:e,getComponentProps:t},a)=>{const[o,s]=a.split(".",2),i=o===n?l:o===r?m:null;return u(i)?null:h("td",{key:a},h(e,{...f(t,i,s),store:d,tableId:o,rowId:i,cellId:s}))})))},W=({thing:e,onThingChange:t,className:r,hasSchema:u})=>{const[m,c]=F(),[b,g]=F(),[p,w]=F(),[f,I]=F(),[C,y]=F();b!==e&&(c((e=>{const t=l(e);return(e=>e==a||e==o)(t)||t==n&&d(e)?t:void 0})(e)),g(e),w(e+""),I(Number(e)||0),y(!!e));const x=O(((e,l)=>{l(e),g(e),t(e)}),[t]);return h("div",{className:r},h("button",{className:m,onClick:O((()=>{if(!u?.()){const e=H(m,n,o,a),l=H(e,p,f,C);c(e),g(l),t(l)}}),[u,t,p,f,C,m])},m),H(m,h("input",{key:m,value:p,onChange:O((e=>x(e[s][i]+"",w)),[x])}),h("input",{key:m,type:"number",value:f,onChange:O((e=>x(Number(e[s][i]||0),I)),[x])}),h("input",{key:m,type:"checkbox",checked:C,onChange:O((e=>x(!!e[s].checked,y)),[x])})))},X=({tableId:e,rowId:l,cellId:a,store:o,className:n})=>h(W,{thing:t.useCell(e,l,a,o),onThingChange:t.useSetCellCallback(e,l,a,(e=>e),[],o),className:n??E+"Cell",hasSchema:t.useStoreOrStoreById(o)?.hasTablesSchema}),Y=({valueId:e,store:l,className:a})=>h(W,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:a??E+r,hasSchema:t.useStoreOrStoreById(l)?.hasValuesSchema}),Z=({onChange:t,total:l,offset:a=0,limit:o=l,singular:n="row",plural:r=n+"s"})=>{(a>l||a<0)&&(a=0,t(0));const s=j((()=>t(a-o)),[t,a,o],a>0),i=j((()=>t(a+o)),[t,a,o],a+o<l);return h(e.Fragment,null,l>o&&h(e.Fragment,null,h("button",{className:"previous",disabled:0==a,onClick:s},"←"),h("button",{className:"next",disabled:a+o>=l,onClick:i},"→"),a+1," to ",Math.min(l,a+o)," of "),l," ",1!=l?r:n)},_=e=>new Map(e);_(),_(),exports.EditableCellView=X,exports.EditableValueView=Y,exports.RelationshipInHtmlTable=({relationshipId:l,relationships:a,editable:o,customCells:n,className:r,headerRow:s,idColumn:i=!0})=>{const[d,u,m,c]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(a),l),b=J([...P(m,u),...P(c,u)],n,o?X:t.CellView),g=A(i,b,m,c,l,d,u);return h("table",{className:r},!1===s?null:h("thead",null,h("tr",null,!1===i?null:h(e.Fragment,null,h("th",null,m,".Id"),h("th",null,c,".Id")),x(b,(({label:e},t)=>h("th",{key:t},e))))),h("tbody",null,I(t.useRowIds(m,u),(e=>h(U,{key:e,localRowId:e,params:g})))))},exports.ResultSortedTableInHtmlTable=({queryId:e,cellId:l,descending:a,offset:o,limit:n,queries:r,sortOnClick:s,paginator:i=!1,customCells:d,onChange:u,...m})=>{const[c,b,g]=G(l,a,s,o,n,t.useResultRowCount(e,r),i,u);return h(K,{...m,params:A(J(t.useResultTableCellIds(e,r),d,t.ResultCellView),D(r,e),t.useResultSortedRowIds(e,...c,n,r),c,b,g)})},exports.ResultTableInHtmlTable=({queryId:e,queries:l,customCells:a,...o})=>h(K,{...o,params:A(J(t.useResultTableCellIds(e,l),a,t.ResultCellView),D(l,e),t.useResultRowIds(e,l))}),exports.SliceInHtmlTable=({indexId:e,sliceId:l,indexes:a,editable:o,customCells:n,...r})=>{const[s,i,d]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(t.useIndexesOrIndexesById(a),e);return h(K,{...r,params:A(J(t.useTableCellIds(d,i),n,o?X:t.CellView),L(i,d),t.useSliceRowIds(e,l,s))})},exports.SortedTableInHtmlTable=({tableId:e,cellId:l,descending:a,offset:o,limit:n,store:r,editable:s,sortOnClick:i,paginator:d=!1,onChange:u,customCells:m,...c})=>{const[b,g,p]=G(l,a,i,o,n,t.useRowCount(e,r),d,u);return h(K,{...c,params:A(J(t.useTableCellIds(e,r),m,s?X:t.CellView),L(r,e),t.useSortedRowIds(e,...b,n,r),b,g,p)})},exports.SortedTablePaginator=Z,exports.StoreInspector=e=>null,exports.TableInHtmlTable=({tableId:e,store:l,editable:a,customCells:o,...n})=>h(K,{...n,params:A(J(t.useTableCellIds(e,l),o,a?X:t.CellView),L(l,e),t.useRowIds(e,l))}),exports.ValuesInHtmlTable=({store:e,editable:l=!1,valueComponent:a=(l?Y:t.ValueView),getValueComponentProps:o,className:n,headerRow:s,idColumn:i})=>h("table",{className:n},!1===s?null:h("thead",null,h("tr",null,!1===i?null:h("th",null,"Id"),h("th",null,r))),h("tbody",null,I(t.useValueIds(e),(t=>h("tr",{key:t},!1===i?null:h("th",null,t),h("td",null,h(a,{...f(o,t),valueId:t,store:e})))))));
Binary file
@@ -1 +1 @@
1
- "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Result",u="Ids",d="Table",l=d+"s",p=d+u,n="Row",i=n+"Count",a=n+u,I="Sorted"+n+u,x="Cell",c=x+u,C="Value",w=C+"s",b=C+u,R=e=>null==e,k=(e,s,t)=>R(e)?t?.():s(e),g=e=>s(e)==o,h=()=>{},m=(e,s)=>e.map(s),L=Object.keys,{createContext:y,useContext:V}=e,S=y([]),T=(e,s)=>{const t=V(S);return R(e)?t[s]:g(e)?((e,s)=>k(e,(e=>e[s])))(t[s+1],e):e},v=(e,s)=>{const t=T(e,s);return R(e)||g(e)?t:e},P=e=>L(V(S)[e]),q=e=>v(e,0),B=e=>v(e,2),f=e=>v(e,4),M=e=>v(e,6),O=e=>v(e,8),Q=e=>v(e,10),{useCallback:D,useEffect:F,useMemo:A,useRef:E,useState:G}=e,j=(e,s,t=[])=>{const o=A((()=>s(e)),[e,...t]);return F((()=>()=>o.destroy()),[o]),o},U=(e,s,t,o=[],r)=>{const[,u]=G(),d=D((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=G(d),p=E(l);return A((()=>p.current=d()),[d]),z(e,s,((...e)=>{p.current=R(r)?d():e[r],u([])}),[],o),p.current},z=(e,s,t,o=[],r=[],...u)=>F((()=>{const o=s?.["add"+e+"Listener"]?.(...r,t,...u);return()=>s?.delListener(o)}),[s,...r,...o,...u]),H=(e,s,t,o=[],r=h,u=[],...d)=>{const l=q(e);return D((e=>k(l,(o=>k(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},J=(e,s,t=h,o=[],...r)=>{const u=q(e);return D((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},K=(e,s,t)=>{const o=Q(e);return D((()=>o?.[s](t)),[o,s,t])},N=e=>U(p,q(e),[],[]),W=(e,s)=>U(a,q(s),[],[e]),X=(e,s,t,o=0,r,u)=>U(I,q(u),[],[e,s,t,o,r],6),Y=(e,s,t)=>U(c,q(t),[],[e,s]),Z=(e,s,t,o)=>U(x,q(o),void 0,[e,s,t],4),$=e=>U(b,q(e),[],[]),_=(e,s)=>U(C,q(s),void 0,[e]),ee=(e,s)=>U("Metric",B(s),void 0,[e]),se=(e,s)=>U("SliceIds",f(s),[],[e]),te=(e,s,t)=>U("Slice"+a,f(t),[],[e,s]),oe=(e,s,t)=>U("RemoteRowId",M(t),void 0,[e,s]),re=(e,s,t)=>U("Local"+a,M(t),[],[e,s]),ue=(e,s,t)=>U("Linked"+a,M(t),[],[e,s]),de=(e,s)=>U(r+a,O(s),[],[e]),le=(e,s,t,o=0,u,d)=>U(r+I,O(d),[],[e,s,t,o,u],6),pe=(e,s,t)=>U(r+c,O(t),[],[e,s]),ne=(e,s,t,o)=>U(r+x,O(o),void 0,[e,s,t]),ie=e=>U("CheckpointIds",Q(e),[[],void 0,[]]),ae=(e,s)=>U("Checkpoint",Q(s),void 0,[e]),Ie=e=>K(e,"goBackward"),xe=e=>K(e,"goForward"),{createElement:ce,Fragment:Ce,useCallback:we,useLayoutEffect:be,useRef:Re,useState:ke}=e,ge=(e,...s)=>R(e)?{}:e(...s),he=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:me}=e,Le=({tableId:e,store:s,rowComponent:t=Pe,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Te(m(l,(u=>ce(t,{...ge(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ye=({queryId:e,queries:s,resultRowComponent:t=Oe,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Te(m(d,(r=>ce(t,{...ge(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Ve=({relationshipId:e,relationships:s,rowComponent:t=Pe,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[p,n,i]=he(M(s),e),a=d(e,l,p);return Te(m(a,(e=>ce(t,{...ge(o,e),key:e,tableId:i,rowId:e,store:n,debugIds:u}))),r,u,l)},Se=e=>({checkpoints:s,checkpointComponent:t=Qe,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=Q(s);return Te(m(e(ie(d)),(e=>ce(t,{...ge(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Te=(e,s,t,o)=>{const r=R(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},ve=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>Te(t+(Z(e,s,o,r)??t),void 0,u,o),Pe=({tableId:e,rowId:s,store:t,cellComponent:o=ve,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Te(m(((e,s,t,o)=>{const r=Y(s,t,o);return e??r})(u,e,s,t),(u=>ce(o,{...ge(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),qe=e=>Le(e,W(e.tableId,e.store)),Be=({valueId:e,store:s,debugIds:o})=>Te(t+(_(e,s)??t),void 0,o,e),fe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Pe,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,p,n]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(f(t),e),i=te(e,s,l);return Te(m(i,(e=>ce(o,{...ge(r,e),key:e,tableId:n,rowId:e,store:p,debugIds:d}))),u,d,s)},Me=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>Te(t+(ne(e,s,o,r)??t),void 0,u,o),Oe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Me,getResultCellComponentProps:r,separator:u,debugIds:d})=>Te(m(pe(e,s,t),(u=>ce(o,{...ge(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Qe=({checkpoints:e,checkpointId:s,debugIds:o})=>Te(ae(s,e)??t,void 0,o,s),De=Se((e=>e[0])),Fe=Se((e=>R(e[1])?[]:[e[1]])),Ae=Se((e=>e[2]));exports.BackwardCheckpointsView=De,exports.CellView=ve,exports.CheckpointView=Qe,exports.CurrentCheckpointView=Fe,exports.ForwardCheckpointsView=Ae,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=fe,getSliceComponentProps:o,separator:r,debugIds:u})=>Te(m(se(e,s),(r=>ce(t,{...ge(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Ve(e,ue,e.firstRowId),exports.LocalRowsView=e=>Ve(e,re,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>Te(ee(e,s)??t,void 0,o,e),exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:p,queries:n,queriesById:i,checkpoints:a,checkpointsById:I,children:x})=>{const c=e.useContext(S);return ce(S.Provider,{value:me((()=>[s??c[0],{...c[1],...t},o??c[2],{...c[3],...r},u??c[4],{...c[5],...d},l??c[6],{...c[7],...p},n??c[8],{...c[9],...i},a??c[10],{...c[11],...I}]),[s,t,o,r,u,d,l,p,n,i,a,I,c])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Pe,getRowComponentProps:r,debugIds:u})=>{const[d,l,,p]=he(M(t),e),n=oe(e,s,d);return Te(R(p)||R(n)?null:ce(o,{...ge(r,n),key:n,tableId:p,rowId:n,store:l,debugIds:u}),void 0,u,s)},exports.ResultCellView=Me,exports.ResultRowView=Oe,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ye(r,le(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>ye(e,de(e.queryId,e.queries)),exports.RowView=Pe,exports.SliceView=fe,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Le(r,X(r.tableId,e,s,t,o,r.store)),exports.TableView=qe,exports.TablesView=({store:e,tableComponent:s=qe,getTableComponentProps:t,separator:o,debugIds:r})=>Te(m(N(e),(o=>ce(s,{...ge(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=Be,exports.ValuesView=({store:e,valueComponent:s=Be,getValueComponentProps:t,separator:o,debugIds:r})=>Te(m($(e),(o=>ce(s,{...ge(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=[],o,r=h,u=[],d=!0)=>{const l=q(o);return D((t=>k(l,(o=>k(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},exports.useCell=Z,exports.useCellIds=Y,exports.useCellIdsListener=(e,s,t,o,r,u)=>z(c,q(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,d)=>z(x,q(d),o,r,[e,s,t],u),exports.useCheckpoint=ae,exports.useCheckpointIds=ie,exports.useCheckpointIdsListener=(e,s,t)=>z("CheckpointIds",Q(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>z("Checkpoint",Q(o),s,t,[e]),exports.useCheckpoints=e=>T(e,10),exports.useCheckpointsIds=()=>P(11),exports.useCheckpointsOrCheckpointsById=Q,exports.useCreateCheckpoints=(e,s,t)=>j(e,s,t),exports.useCreateIndexes=(e,s,t)=>j(e,s,t),exports.useCreateMetrics=(e,s,t)=>j(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=G(),d=A((()=>s(e)),[e,...t]);return F((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d.destroy()})),[d,...r]),d},exports.useCreateQueries=(e,s,t)=>j(e,s,t),exports.useCreateRelationships=(e,s,t)=>j(e,s,t),exports.useCreateStore=(e,s=[])=>A(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,d)=>J(r,x,u,d,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>J(t,n,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>J(s,d,t,o,e),exports.useDelTablesCallback=(e,s,t)=>J(e,l,s,t),exports.useDelValueCallback=(e,s,t,o)=>J(s,C,t,o,e),exports.useDelValuesCallback=(e,s,t)=>J(e,w,s,t),exports.useGoBackwardCallback=Ie,exports.useGoForwardCallback=xe,exports.useGoToCallback=(e,s=[],t,o=h,r=[])=>{const u=Q(t);return D((s=>k(u,(t=>k(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useIndexIds=e=>U("IndexIds",f(e),[]),exports.useIndexes=e=>T(e,4),exports.useIndexesIds=()=>P(5),exports.useIndexesOrIndexesById=f,exports.useLinkedRowIds=ue,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>z("Linked"+a,M(r),t,o,[e,s]),exports.useLocalRowIds=re,exports.useLocalRowIdsListener=(e,s,t,o,r)=>z("Local"+a,M(r),t,o,[e,s]),exports.useMetric=ee,exports.useMetricIds=e=>U("MetricIds",B(e),[]),exports.useMetricListener=(e,s,t,o)=>z("Metric",B(o),s,t,[e]),exports.useMetrics=e=>T(e,2),exports.useMetricsIds=()=>P(3),exports.useMetricsOrMetricsById=B,exports.useQueries=e=>T(e,8),exports.useQueriesIds=()=>P(9),exports.useQueriesOrQueriesById=O,exports.useQueryIds=e=>U("QueryIds",O(e),[]),exports.useRedoInformation=e=>{const s=Q(e),[,,[o]]=ie(s);return[!R(o),xe(s),o,k(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>U("RelationshipIds",M(e),[]),exports.useRelationships=e=>T(e,6),exports.useRelationshipsIds=()=>P(7),exports.useRelationshipsOrRelationshipsById=M,exports.useRemoteRowId=oe,exports.useRemoteRowIdListener=(e,s,t,o,r)=>z("RemoteRowId",M(r),t,o,[e,s]),exports.useResultCell=ne,exports.useResultCellIds=pe,exports.useResultCellIdsListener=(e,s,t,o,u)=>z(r+c,O(u),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,u,d)=>z(r+x,O(d),o,u,[e,s,t]),exports.useResultRow=(e,s,t)=>U(r+n,O(t),{},[e,s]),exports.useResultRowCount=(e,s)=>U(r+i,O(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>z(r+i,O(o),s,t,[e]),exports.useResultRowIds=de,exports.useResultRowIdsListener=(e,s,t,o)=>z(r+a,O(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,u)=>z(r+n,O(u),t,o,[e,s]),exports.useResultSortedRowIds=le,exports.useResultSortedRowIdsListener=(e,s,t,o,u,d,l,p)=>z(r+I,O(p),d,l,[e,s,t,o,u]),exports.useResultTable=(e,s)=>U(r+d,O(s),{},[e]),exports.useResultTableCellIds=(e,s)=>U(r+d+c,O(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>z(r+d+c,O(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>z(r+d,O(o),s,t,[e]),exports.useRow=(e,s,t)=>U(n,q(t),{},[e,s]),exports.useRowCount=(e,s)=>U(i,q(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>z(i,q(r),s,t,[e],o),exports.useRowIds=W,exports.useRowIdsListener=(e,s,t,o,r)=>z(a,q(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>z(n,q(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,d,l)=>H(u,x,o,r,d,l,e,s,t),exports.useSetCheckpointCallback=(e=h,s=[],t,o=h,r=[])=>{const u=Q(t);return D((s=>k(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>H(r,"PartialRow",t,o,u,d,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>H(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,d)=>H(r,n,t,o,u,d,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>H(o,d,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>H(t,l,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>H(o,C,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>H(t,w,e,s,o,r),exports.useSliceIds=se,exports.useSliceIdsListener=(e,s,t,o)=>z("SliceIds",f(o),s,t,[e]),exports.useSliceRowIds=te,exports.useSliceRowIdsListener=(e,s,t,o,r)=>z("Slice"+a,f(r),t,o,[e,s]),exports.useSortedRowIds=X,exports.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,p)=>z(I,q(p),u,d,[e,s,t,o,r],l),exports.useStore=e=>T(e,0),exports.useStoreIds=()=>P(1),exports.useStoreOrStoreById=q,exports.useTable=(e,s)=>U(d,q(s),{},[e]),exports.useTableCellIds=(e,s)=>U(d+c,q(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>z(d+c,q(r),s,t,[e],o),exports.useTableIds=N,exports.useTableIdsListener=(e,s,t,o)=>z(p,q(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>z(d,q(r),s,t,[e],o),exports.useTables=e=>U(l,q(e),{}),exports.useTablesListener=(e,s,t,o)=>z(l,q(o),e,s,[],t),exports.useUndoInformation=e=>{const s=Q(e),[o,r]=ie(s);return[(u=o,!(0==(e=>e.length)(u))),Ie(s),r,k(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=_,exports.useValueIds=$,exports.useValueIdsListener=(e,s,t,o)=>z(b,q(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>z(C,q(r),s,t,[e],o),exports.useValues=e=>U(w,q(e),{}),exports.useValuesListener=(e,s,t,o)=>z(w,q(o),e,s,[],t);
1
+ "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Result",u="Ids",d="Table",l=d+"s",p=d+u,n="Row",i=n+"Count",a=n+u,I="Sorted"+n+u,x="Cell",c=x+u,C="Value",w=C+"s",b=C+u,R=e=>null==e,k=(e,s,t)=>R(e)?t?.():s(e),g=e=>s(e)==o,m=()=>{},h=(e,s)=>e.map(s),L=Object.keys,{createContext:y,useContext:V}=e,S=y([]),T=(e,s)=>{const t=V(S);return R(e)?t[s]:g(e)?((e,s)=>k(e,(e=>e[s])))(t[s+1]??{},e):e},v=(e,s)=>{const t=T(e,s);return R(e)||g(e)?t:e},P=e=>L(V(S)[e]??{}),q=e=>v(e,0),B=e=>v(e,2),f=e=>v(e,4),M=e=>v(e,6),O=e=>v(e,8),Q=e=>v(e,10),{useCallback:D,useEffect:F,useMemo:A,useRef:E,useState:G}=e,j=(e,s,t=[])=>{const o=A((()=>s(e)),[e,...t]);return F((()=>()=>o.destroy()),[o]),o},U=(e,s,t,o=[],r)=>{const[,u]=G(),d=D((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=G(d),p=E(l);return A((()=>p.current=d()),[d]),z(e,s,((...e)=>{p.current=R(r)?d():e[r],u([])}),[],o),p.current},z=(e,s,t,o=[],r=[],...u)=>F((()=>{const o=s?.["add"+e+"Listener"]?.(...r,t,...u);return()=>s?.delListener(o)}),[s,...r,...o,...u]),H=(e,s,t,o=[],r=m,u=[],...d)=>{const l=q(e);return D((e=>k(l,(o=>k(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},J=(e,s,t=m,o=[],...r)=>{const u=q(e);return D((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},K=(e,s,t)=>{const o=Q(e);return D((()=>o?.[s](t)),[o,s,t])},N=e=>U(p,q(e),[],[]),W=(e,s)=>U(a,q(s),[],[e]),X=(e,s,t,o=0,r,u)=>U(I,q(u),[],[e,s,t,o,r],6),Y=(e,s,t)=>U(c,q(t),[],[e,s]),Z=(e,s,t,o)=>U(x,q(o),void 0,[e,s,t],4),$=e=>U(b,q(e),[],[]),_=(e,s)=>U(C,q(s),void 0,[e]),ee=(e,s)=>U("Metric",B(s),void 0,[e]),se=(e,s)=>U("SliceIds",f(s),[],[e]),te=(e,s,t)=>U("Slice"+a,f(t),[],[e,s]),oe=(e,s,t)=>U("RemoteRowId",M(t),void 0,[e,s]),re=(e,s,t)=>U("Local"+a,M(t),[],[e,s]),ue=(e,s,t)=>U("Linked"+a,M(t),[],[e,s]),de=(e,s)=>U(r+a,O(s),[],[e]),le=(e,s,t,o=0,u,d)=>U(r+I,O(d),[],[e,s,t,o,u],6),pe=(e,s,t)=>U(r+c,O(t),[],[e,s]),ne=(e,s,t,o)=>U(r+x,O(o),void 0,[e,s,t]),ie=e=>U("CheckpointIds",Q(e),[[],void 0,[]]),ae=(e,s)=>U("Checkpoint",Q(s),void 0,[e]),Ie=e=>K(e,"goBackward"),xe=e=>K(e,"goForward"),{PureComponent:ce,Fragment:Ce,createElement:we,useCallback:be,useLayoutEffect:Re,useRef:ke,useState:ge}=e,me=(e,...s)=>R(e)?{}:e(...s),he=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:Le}=e,ye=({tableId:e,store:s,rowComponent:t=qe,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>ve(h(l,(u=>we(t,{...me(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),Ve=({queryId:e,queries:s,resultRowComponent:t=Qe,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>ve(h(d,(r=>we(t,{...me(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Se=({relationshipId:e,relationships:s,rowComponent:t=qe,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[p,n,i]=he(M(s),e),a=d(e,l,p);return ve(h(a,(e=>we(t,{...me(o,e),key:e,tableId:i,rowId:e,store:n,debugIds:u}))),r,u,l)},Te=e=>({checkpoints:s,checkpointComponent:t=De,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=Q(s);return ve(h(e(ie(d)),(e=>we(t,{...me(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},ve=(e,s,t,o)=>{const r=R(s)||!Array.isArray(e)?e:h(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Pe=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>ve(t+(Z(e,s,o,r)??t),void 0,u,o),qe=({tableId:e,rowId:s,store:t,cellComponent:o=Pe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>ve(h(((e,s,t,o)=>{const r=Y(s,t,o);return e??r})(u,e,s,t),(u=>we(o,{...me(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Be=e=>ye(e,W(e.tableId,e.store)),fe=({valueId:e,store:s,debugIds:o})=>ve(t+(_(e,s)??t),void 0,o,e),Me=({indexId:e,sliceId:s,indexes:t,rowComponent:o=qe,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,p,n]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(f(t),e),i=te(e,s,l);return ve(h(i,(e=>we(o,{...me(r,e),key:e,tableId:n,rowId:e,store:p,debugIds:d}))),u,d,s)},Oe=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>ve(t+(ne(e,s,o,r)??t),void 0,u,o),Qe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Oe,getResultCellComponentProps:r,separator:u,debugIds:d})=>ve(h(pe(e,s,t),(u=>we(o,{...me(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),De=({checkpoints:e,checkpointId:s,debugIds:o})=>ve(ae(s,e)??t,void 0,o,s),Fe=Te((e=>e[0])),Ae=Te((e=>R(e[1])?[]:[e[1]])),Ee=Te((e=>e[2]));exports.BackwardCheckpointsView=Fe,exports.CellView=Pe,exports.CheckpointView=De,exports.CurrentCheckpointView=Ae,exports.ForwardCheckpointsView=Ee,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Me,getSliceComponentProps:o,separator:r,debugIds:u})=>ve(h(se(e,s),(r=>we(t,{...me(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Se(e,ue,e.firstRowId),exports.LocalRowsView=e=>Se(e,re,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>ve(ee(e,s)??t,void 0,o,e),exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:p,queries:n,queriesById:i,checkpoints:a,checkpointsById:I,children:x})=>{const c=e.useContext(S);return we(S.Provider,{value:Le((()=>[s??c[0],{...c[1],...t},o??c[2],{...c[3],...r},u??c[4],{...c[5],...d},l??c[6],{...c[7],...p},n??c[8],{...c[9],...i},a??c[10],{...c[11],...I}]),[s,t,o,r,u,d,l,p,n,i,a,I,c])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=qe,getRowComponentProps:r,debugIds:u})=>{const[d,l,,p]=he(M(t),e),n=oe(e,s,d);return ve(R(p)||R(n)?null:we(o,{...me(r,n),key:n,tableId:p,rowId:n,store:l,debugIds:u}),void 0,u,s)},exports.ResultCellView=Oe,exports.ResultRowView=Qe,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Ve(r,le(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>Ve(e,de(e.queryId,e.queries)),exports.RowView=qe,exports.SliceView=Me,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ye(r,X(r.tableId,e,s,t,o,r.store)),exports.TableView=Be,exports.TablesView=({store:e,tableComponent:s=Be,getTableComponentProps:t,separator:o,debugIds:r})=>ve(h(N(e),(o=>we(s,{...me(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=fe,exports.ValuesView=({store:e,valueComponent:s=fe,getValueComponentProps:t,separator:o,debugIds:r})=>ve(h($(e),(o=>we(s,{...me(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=[],o,r=m,u=[],d=!0)=>{const l=q(o);return D((t=>k(l,(o=>k(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},exports.useCell=Z,exports.useCellIds=Y,exports.useCellIdsListener=(e,s,t,o,r,u)=>z(c,q(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,d)=>z(x,q(d),o,r,[e,s,t],u),exports.useCheckpoint=ae,exports.useCheckpointIds=ie,exports.useCheckpointIdsListener=(e,s,t)=>z("CheckpointIds",Q(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>z("Checkpoint",Q(o),s,t,[e]),exports.useCheckpoints=e=>T(e,10),exports.useCheckpointsIds=()=>P(11),exports.useCheckpointsOrCheckpointsById=Q,exports.useCreateCheckpoints=(e,s,t)=>j(e,s,t),exports.useCreateIndexes=(e,s,t)=>j(e,s,t),exports.useCreateMetrics=(e,s,t)=>j(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=G(),d=A((()=>s(e)),[e,...t]);return F((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d.destroy()})),[d,...r]),d},exports.useCreateQueries=(e,s,t)=>j(e,s,t),exports.useCreateRelationships=(e,s,t)=>j(e,s,t),exports.useCreateStore=(e,s=[])=>A(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,d)=>J(r,x,u,d,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>J(t,n,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>J(s,d,t,o,e),exports.useDelTablesCallback=(e,s,t)=>J(e,l,s,t),exports.useDelValueCallback=(e,s,t,o)=>J(s,C,t,o,e),exports.useDelValuesCallback=(e,s,t)=>J(e,w,s,t),exports.useGoBackwardCallback=Ie,exports.useGoForwardCallback=xe,exports.useGoToCallback=(e,s=[],t,o=m,r=[])=>{const u=Q(t);return D((s=>k(u,(t=>k(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useIndexIds=e=>U("IndexIds",f(e),[]),exports.useIndexes=e=>T(e,4),exports.useIndexesIds=()=>P(5),exports.useIndexesOrIndexesById=f,exports.useLinkedRowIds=ue,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>z("Linked"+a,M(r),t,o,[e,s]),exports.useLocalRowIds=re,exports.useLocalRowIdsListener=(e,s,t,o,r)=>z("Local"+a,M(r),t,o,[e,s]),exports.useMetric=ee,exports.useMetricIds=e=>U("MetricIds",B(e),[]),exports.useMetricListener=(e,s,t,o)=>z("Metric",B(o),s,t,[e]),exports.useMetrics=e=>T(e,2),exports.useMetricsIds=()=>P(3),exports.useMetricsOrMetricsById=B,exports.useQueries=e=>T(e,8),exports.useQueriesIds=()=>P(9),exports.useQueriesOrQueriesById=O,exports.useQueryIds=e=>U("QueryIds",O(e),[]),exports.useRedoInformation=e=>{const s=Q(e),[,,[o]]=ie(s);return[!R(o),xe(s),o,k(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>U("RelationshipIds",M(e),[]),exports.useRelationships=e=>T(e,6),exports.useRelationshipsIds=()=>P(7),exports.useRelationshipsOrRelationshipsById=M,exports.useRemoteRowId=oe,exports.useRemoteRowIdListener=(e,s,t,o,r)=>z("RemoteRowId",M(r),t,o,[e,s]),exports.useResultCell=ne,exports.useResultCellIds=pe,exports.useResultCellIdsListener=(e,s,t,o,u)=>z(r+c,O(u),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,u,d)=>z(r+x,O(d),o,u,[e,s,t]),exports.useResultRow=(e,s,t)=>U(r+n,O(t),{},[e,s]),exports.useResultRowCount=(e,s)=>U(r+i,O(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>z(r+i,O(o),s,t,[e]),exports.useResultRowIds=de,exports.useResultRowIdsListener=(e,s,t,o)=>z(r+a,O(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,u)=>z(r+n,O(u),t,o,[e,s]),exports.useResultSortedRowIds=le,exports.useResultSortedRowIdsListener=(e,s,t,o,u,d,l,p)=>z(r+I,O(p),d,l,[e,s,t,o,u]),exports.useResultTable=(e,s)=>U(r+d,O(s),{},[e]),exports.useResultTableCellIds=(e,s)=>U(r+d+c,O(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>z(r+d+c,O(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>z(r+d,O(o),s,t,[e]),exports.useRow=(e,s,t)=>U(n,q(t),{},[e,s]),exports.useRowCount=(e,s)=>U(i,q(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>z(i,q(r),s,t,[e],o),exports.useRowIds=W,exports.useRowIdsListener=(e,s,t,o,r)=>z(a,q(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>z(n,q(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,d,l)=>H(u,x,o,r,d,l,e,s,t),exports.useSetCheckpointCallback=(e=m,s=[],t,o=m,r=[])=>{const u=Q(t);return D((s=>k(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>H(r,"PartialRow",t,o,u,d,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>H(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,d)=>H(r,n,t,o,u,d,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>H(o,d,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>H(t,l,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>H(o,C,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>H(t,w,e,s,o,r),exports.useSliceIds=se,exports.useSliceIdsListener=(e,s,t,o)=>z("SliceIds",f(o),s,t,[e]),exports.useSliceRowIds=te,exports.useSliceRowIdsListener=(e,s,t,o,r)=>z("Slice"+a,f(r),t,o,[e,s]),exports.useSortedRowIds=X,exports.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,p)=>z(I,q(p),u,d,[e,s,t,o,r],l),exports.useStore=e=>T(e,0),exports.useStoreIds=()=>P(1),exports.useStoreOrStoreById=q,exports.useTable=(e,s)=>U(d,q(s),{},[e]),exports.useTableCellIds=(e,s)=>U(d+c,q(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>z(d+c,q(r),s,t,[e],o),exports.useTableIds=N,exports.useTableIdsListener=(e,s,t,o)=>z(p,q(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>z(d,q(r),s,t,[e],o),exports.useTables=e=>U(l,q(e),{}),exports.useTablesListener=(e,s,t,o)=>z(l,q(o),e,s,[],t),exports.useUndoInformation=e=>{const s=Q(e),[o,r]=ie(s);return[(u=o,!(0==(e=>e.length)(u))),Ie(s),r,k(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=_,exports.useValueIds=$,exports.useValueIdsListener=(e,s,t,o)=>z(b,q(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>z(C,q(r),s,t,[e],o),exports.useValues=e=>U(w,q(e),{}),exports.useValuesListener=(e,s,t,o)=>z(w,q(o),e,s,[],t);
Binary file
@@ -1 +1 @@
1
- "use strict";var e=require("react"),l=require("./ui-react");const t=e=>typeof e,n="",s=t(n),r=t(!0),a=t(0),o=t(t),i="type",u="default",d="Ids",c="Table",h=c+"s",m=c+d,b="Row",p=b+"Count",v=b+d,g="Cell",I=g+d,f="Value",y=f+"s",C=f+d,w="currentTarget",x="value",k=e=>n+e,S=Math.floor,T=isFinite,V=(e,l)=>e instanceof l,R=e=>null==e,O=(e,l,t)=>R(e)?null==t?void 0:t():l(e),q=e=>e==s||e==r,P=e=>t(e)==o,N=e=>Array.isArray(e),{createElement:L,Fragment:E,useCallback:M,useLayoutEffect:j,useRef:z,useState:$}=e,A=(e,...l)=>R(e)?{}:e(...l),J=(e,l)=>e.forEach(l),F=(e,l)=>e.map(l),H=e=>e.length,B=e=>0==H(e),D=(e,l,t)=>e.slice(l,t),Q=(e,...l)=>e.push(...l),W=e=>e.shift(),G=Object,K=G.keys,U=G.isFrozen,X=G.freeze,Y=e=>V(e,G)&&e.constructor==G,Z=(e=[])=>G.fromEntries(e),_=(e,l)=>!R(((e,l)=>O(e,(e=>e[l])))(e,l)),ee=(e,l)=>(delete e[l],e),le=(e,l)=>F(G.entries(e),(([e,t])=>l(t,e))),te=e=>Y(e)&&0==(e=>H(K(e)))(e),ne=e=>JSON.stringify(e,((e,l)=>V(l,Map)?G.fromEntries([...l]):l)),se=JSON.parse,re="tinybaseStoreInspector",ae="TinyBase Store Inspector",oe=["left","top","bottom","right","full"],ie="state",ue="sort",de="open",ce="position",he=de,me="editable",be=(...e)=>ne(e),pe=(e,l)=>F(e.sort(),l),ve=(e,t)=>[!!l.useCell(ie,e,me,t),M((l=>{t.setCell(ie,e,me,(e=>!e)),l.preventDefault()}),[t,e])],ge="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Ie='content:url("',fe=Ie+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",ye='</svg>")',Ce=Ie+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",we=F([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>fe+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+ye)),xe=fe+"<path d='M20 20l60 60M20 80l60-60' />"+ye,ke=fe+`<path d='${ge}' />`+ye,Se=fe+`<path d='${ge}M20 20l60 60' />`+ye;var Te=Object.defineProperty,Ve=Object.defineProperties,Re=Object.getOwnPropertyDescriptors,Oe=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,Ne=(e,l,t)=>l in e?Te(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Le=(e,l)=>{for(var t in l||(l={}))qe.call(l,t)&&Ne(e,t,l[t]);if(Oe)for(var t of Oe(l))Pe.call(l,t)&&Ne(e,t,l[t]);return e},Ee=(e,l)=>Ve(e,Re(l));const Me="*::-webkit-scrollbar",je=((e,l="")=>e.join(l))(le(Ee(Le(Ee(Le(Ee(Le({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Me]:"width:0.5rem;height:0.5rem;",[Me+"-track"]:"background:#111",[Me+"-thumb"]:"background:#999;border:1px solid #111",[Me+"-thumb:hover"]:"background:#fff",[Me+"-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;"+Ce},Z(F(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),Z(F(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Ce,"header>img:nth-of-type(6)":xe}),Z(F(we,((e,l)=>[`header>img[data-id='${l}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":ke,"details[open]>summary img.done":Se,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${re} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left"}),((e,l)=>e?`#${re} ${l}{${e}}`:""))),ze=({s:e})=>{var t;const n=null!=(t=l.useValue(ce,e))?t:1,s=l.useSetValueCallback(he,(()=>!0),[],e);return l.useValue(he,e)?null:L("img",{onClick:s,title:ae,"data-position":n})},$e=({uniqueId:e,summary:t,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!l.useCell(ie,e,de,a),i=l.useSetCellCallback(ie,e,de,(e=>e[w].open),[],a);return L("details",{open:o,onToggle:i},L("summary",null,t,s?L("img",{onClick:s,className:n?"done":"edit"}):null),r)},Ae=e=>{const l=t(e);return q(l)||l==a&&T(e)?l:void 0},Je=(e,l,t,n,s)=>R(s)?e.delCell(l,t,n,!0):e.setCell(l,t,n,s),Fe=(e,l,t)=>R(t)?e.delValue(l):e.setValue(l,t),He=(e,l,t,n)=>e==s?l:e==a?t:n;var Be=Object.defineProperty,De=Object.defineProperties,Qe=Object.getOwnPropertyDescriptors,We=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,Ue=(e,l,t)=>l in e?Be(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Xe=(e,l)=>{for(var t in l||(l={}))Ge.call(l,t)&&Ue(e,t,l[t]);if(We)for(var t of We(l))Ke.call(l,t)&&Ue(e,t,l[t]);return e},Ye=(e,l)=>De(e,Qe(l)),Ze=(e,l)=>{var t={};for(var n in e)Ge.call(e,n)&&l.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&We)for(var n of We(e))l.indexOf(n)<0&&Ke.call(e,n)&&(t[n]=e[n]);return t};const{useCallback:_e,useMemo:el,useState:ll}=e,tl="editable",nl=(e,t)=>F(l.useTableCellIds(e,t),(l=>e+"."+l)),sl=(e,l,t)=>{const n=_e(e,l);return t?n:void 0},rl=(...e)=>el((()=>e),e),al=(e,l)=>el((()=>({store:e,tableId:l})),[e,l]),ol=(e,l)=>el((()=>({queries:e,queryId:l})),[e,l]),il=(e,l=!1,t,n=0,s,r,a,o)=>{const[[i,u,d],c]=ll([e,l,n]),h=_e((e=>{c(e),null==o||o(e)}),[o]),m=sl((e=>h([e,e==i&&!u,d])),[h,i,u,d],t),b=_e((e=>h([i,u,e])),[h,i,u]),p=!0===a?Cl:a;return[[i,u,d],m,el((()=>!1===a?null:L(p,{offset:d,limit:s,total:r,onChange:b})),[a,p,d,s,r,b])]},ul=(e,l,n)=>el((()=>{const r=null!=l?l:e;return Z(le(N(r)?Z(F(r,(e=>[e,e]))):r,((e,l)=>{return[l,Xe(Xe({},{label:l,component:n}),(r=e,t(r)==s?{label:e}:e))];var r})))}),[l,n,e]),dl=({className:e,headerRow:l,idColumn:t,params:[n,s,r,a,o,i]})=>L("table",{className:e},i?L("caption",null,i):null,!1===l?null:L("thead",null,L("tr",null,!1===t?null:L(cl,{sort:null!=a?a:[],label:"Id",onClick:o}),le(n,(({label:e},l)=>L(cl,{key:l,cellId:l,label:e,sort:null!=a?a:[],onClick:o}))))),L("tbody",null,F(r,(e=>L("tr",{key:e},!1===t?null:L("th",null,e),le(n,(({component:l,getComponentProps:t},n)=>L("td",{key:n},L(l,Ye(Xe(Xe({},A(t,e,n)),s),{rowId:e,cellId:n})))))))))),cl=({cellId:e,sort:[l,t],label:s=(null!=e?e:n),onClick:r})=>L("th",{onClick:sl((()=>null==r?void 0:r(e)),[r,e],r),className:R(t)||l!=e?void 0:`sorted ${t?"de":"a"}scending`},R(t)||l!=e?null:(t?"↓":"↑")+" ",s),hl=({localRowId:t,params:[n,s,r,a,o,i,u]})=>{const d=l.useRemoteRowId(o,t,i);return L("tr",null,!1===n?null:L(e.Fragment,null,L("th",null,t),L("th",null,d)),le(s,(({component:e,getComponentProps:l},n)=>{const[s,o]=n.split(".",2),i=s===r?t:s===a?d:null;return R(i)?null:L("td",{key:n},L(e,Ye(Xe({},A(l,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},ml=({thing:e,onThingChange:l,className:t,hasSchema:n})=>{const[o,i]=ll(),[u,d]=ll(),[c,h]=ll(),[m,b]=ll(),[p,v]=ll();u!==e&&(i(Ae(e)),d(e),h(e+""),b(Number(e)||0),v(!!e));const g=_e(((e,t)=>{t(e),d(e),l(e)}),[l]);return L("div",{className:t},L("button",{className:o,onClick:_e((()=>{if(!(null==n?void 0:n())){const e=He(o,a,r,s),t=He(e,c,m,p);i(e),d(t),l(t)}}),[n,l,c,m,p,o])},o),He(o,L("input",{key:o,value:c,onChange:_e((e=>g(e[w][x]+"",h)),[g])}),L("input",{key:o,type:"number",value:m,onChange:_e((e=>g(Number(e[w][x]||0),b)),[g])}),L("input",{key:o,type:"checkbox",checked:p,onChange:_e((e=>g(!!e[w].checked,v)),[g])})))},bl=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,b=Ze(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[p,v,g]=il(s,r,d,a,o,l.useRowCount(n,i),c,h);return L(dl,Ye(Xe({},b),{params:rl(ul(l.useTableCellIds(n,i),m,u?fl:l.CellView),al(i,n),l.useSortedRowIds(n,...p,o,i),p,v,g)}))},pl=({store:e,editable:t=!1,valueComponent:n=(t?yl:l.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>L("table",{className:r},!1===a?null:L("thead",null,L("tr",null,!1===o?null:L("th",null,"Id"),L("th",null,f))),L("tbody",null,F(l.useValueIds(e),(l=>L("tr",{key:l},!1===o?null:L("th",null,l),L("td",null,L(n,Ye(Xe({},A(s,l)),{valueId:l,store:e})))))))),vl=e=>{var t=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=t,i=Ze(t,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(l)])(l.useIndexesOrIndexesById(r),n);return L(dl,Ye(Xe({},i),{params:rl(ul(l.useTableCellIds(c,d),o,a?fl:l.CellView),al(d,c),l.useSliceRowIds(n,s,u))}))},gl=({relationshipId:t,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(l),null==e?void 0:e.getRemoteTableId(l)])(l.useRelationshipsOrRelationshipsById(n),t),m=ul([...nl(c,d),...nl(h,d)],r,s?fl:l.CellView),b=rl(i,m,c,h,t,u,d);return L("table",{className:a},!1===o?null:L("thead",null,L("tr",null,!1===i?null:L(e.Fragment,null,L("th",null,c,".Id"),L("th",null,h,".Id")),le(m,(({label:e},l)=>L("th",{key:l},e))))),L("tbody",null,F(l.useRowIds(c,d),(e=>L(hl,{key:e,localRowId:e,params:b})))))},Il=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=Ze(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,p,v]=il(s,r,u,a,o,l.useResultRowCount(n,i),d,h);return L(dl,Ye(Xe({},m),{params:rl(ul(l.useResultTableCellIds(n,i),c,l.ResultCellView),ol(i,n),l.useResultSortedRowIds(n,...b,o,i),b,p,v)}))},fl=({tableId:e,rowId:t,cellId:n,store:s,className:r})=>{var a;return L(ml,{thing:l.useCell(e,t,n,s),onThingChange:l.useSetCellCallback(e,t,n,(e=>e),[],s),className:null!=r?r:tl+g,hasSchema:null==(a=l.useStoreOrStoreById(s))?void 0:a.hasTablesSchema})},yl=({valueId:e,store:t,className:n})=>{var s;return L(ml,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=n?n:tl+f,hasSchema:null==(s=l.useStoreOrStoreById(t))?void 0:s.hasValuesSchema})},Cl=({onChange:l,total:t,offset:n=0,limit:s=t,singular:r="row",plural:a=r+"s"})=>{(n>t||n<0)&&(n=0,l(0));const o=sl((()=>l(n-s)),[l,n,s],n>0),i=sl((()=>l(n+s)),[l,n,s],n+s<t);return L(e.Fragment,null,t>s&&L(e.Fragment,null,L("button",{className:"previous",disabled:0==n,onClick:o},"←"),L("button",{className:"next",disabled:n+s>=t,onClick:i},"→"),n+1," to ",Math.min(t,n+s)," of "),t," ",1!=t?a:r)},wl=({indexes:e,indexesId:t,indexId:n,s:s})=>L($e,{uniqueId:be("i",t,n),summary:"Index: "+n,s:s},F(l.useSliceIds(n,e),(l=>L(xl,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s})))),xl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=be("i",l,t,n),[a,o]=ve(r,s);return L($e,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},L(vl,{sliceId:n,indexId:t,indexes:e,editable:a}))},kl=({indexesId:e,s:t})=>{const n=l.useIndexes(e),s=l.useIndexIds(n);return R(n)?null:L($e,{uniqueId:be("i",e),summary:"Indexes: "+(null!=e?e:u),s:t},B(s)?"No indexes defined":pe(s,(l=>L(wl,{indexes:n,indexesId:e,indexId:l,s:t}))))},Sl=({metrics:e,metricId:t})=>L("tr",null,L("th",null,t),L("td",null,null==e?void 0:e.getTableId(t)),L("td",null,l.useMetric(t,e))),Tl=({metricsId:e,s:t})=>{const n=l.useMetrics(e),s=l.useMetricIds(n);return R(n)?null:L($e,{uniqueId:be("m",e),summary:"Metrics: "+(null!=e?e:u),s:t},B(s)?"No metrics defined":L("table",null,L("thead",null,L("th",null,"Metric Id"),L("th",null,"Table Id"),L("th",null,"Metric")),L("tbody",null,F(s,(e=>L(Sl,{metrics:n,metricId:e}))))))},Vl=({queries:e,queriesId:t,queryId:n,s:s})=>{var r;const a=be("q",t,n),[o,i,u]=se(null!=(r=l.useCell(ie,a,ue,s))?r:"[]"),d=l.useSetCellCallback(ie,a,ue,ne,[],s);return L($e,{uniqueId:a,summary:"Query: "+n,s:s},L(Il,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},Rl=({queriesId:e,s:t})=>{const n=l.useQueries(e),s=l.useQueryIds(n);return R(n)?null:L($e,{uniqueId:be("q",e),summary:"Queries: "+(null!=e?e:u),s:t},B(s)?"No queries defined":pe(s,(l=>L(Vl,{queries:n,queriesId:e,queryId:l,s:t}))))},Ol=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=be("r",l,t),[r,a]=ve(s,n);return L($e,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:a,s:n},L(gl,{relationshipId:t,relationships:e,editable:r}))},ql=({relationshipsId:e,s:t})=>{const n=l.useRelationships(e),s=l.useRelationshipIds(n);return R(n)?null:L($e,{uniqueId:be("r",e),summary:"Relationships: "+(null!=e?e:u),s:t},B(s)?"No relationships defined":pe(s,(l=>L(Ol,{relationships:n,relationshipsId:e,relationshipId:l,s:t}))))},Pl=({tableId:e,store:t,storeId:n,s:s})=>{var r;const a=be("t",n,e),[o,i,u]=se(null!=(r=l.useCell(ie,a,ue,s))?r:"[]"),d=l.useSetCellCallback(ie,a,ue,ne,[],s),[h,m]=ve(a,s);return L($e,{uniqueId:a,summary:c+": "+e,editable:h,handleEditable:m,s:s},L(bl,{tableId:e,store:t,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:h}))},Nl=({store:e,storeId:t,s:n})=>{const s=be("v",t),[r,a]=ve(s,n);return B(l.useValueIds(e))?null:L($e,{uniqueId:s,summary:y,editable:r,handleEditable:a,s:n},L(pl,{store:e,editable:r}))},Ll=({storeId:e,s:t})=>{const n=l.useStore(e),s=l.useTableIds(n);return R(n)?null:L($e,{uniqueId:be("s",e),summary:"Store: "+(null!=e?e:u),s:t},L(Nl,{storeId:e,store:n,s:t}),pe(s,(l=>L(Pl,{store:n,storeId:e,tableId:l,s:t}))))},El=({s:e})=>{const t=z(null),n=z(0),[s,r]=$(!1),{scrollLeft:a,scrollTop:o}=l.useValues(e);j((()=>{const e=t.current;if(e&&!s){const l=new MutationObserver((()=>{e.scrollWidth>=S(a)+e.clientWidth&&e.scrollHeight>=S(o)+e.clientHeight&&e.scrollTo(a,o)}));return l.observe(e,{childList:!0,subtree:!0}),()=>l.disconnect()}}),[s,a,o]);const i=M((l=>{const{scrollLeft:t,scrollTop:s}=l[w];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:t,scrollTop:s})}))}),[e]);return L("article",{ref:t,onScroll:i},L(Ll,{s:e}),F(l.useStoreIds(),(l=>L(Ll,{storeId:l,key:l,s:e}))),L(Tl,{s:e}),F(l.useMetricsIds(),(l=>L(Tl,{metricsId:l,key:l,s:e}))),L(kl,{s:e}),F(l.useIndexesIds(),(l=>L(kl,{indexesId:l,key:l,s:e}))),L(ql,{s:e}),F(l.useRelationshipsIds(),(l=>L(ql,{relationshipsId:l,key:l,s:e}))),L(Rl,{s:e}),F(l.useQueriesIds(),(l=>L(Rl,{queriesId:l,key:l,s:e}))))},Ml=({s:e})=>{var t;const n=null!=(t=l.useValue(ce,e))?t:1,s=l.useSetValueCallback(he,(()=>!1),[],e),r=l.useSetValueCallback(ce,(e=>Number(e[w].dataset.id)),[],e);return L("header",null,L("img",{title:ae}),L("span",null,ae),F(oe,((e,l)=>l==n?null:L("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),L("img",{onClick:s,title:"Close"}))},jl=({s:e})=>{var t;const n=null!=(t=l.useValue(ce,e))?t:1;return l.useValue(he,e)?L("main",{"data-position":n},L(Ml,{s:e}),L(El,{s:e})):null},zl=e=>l=>{return t=(l,t)=>l+e(t),Dl(l).reduce(t,0);var t},$l=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},Al=zl($l),Jl=zl(Al),Fl=zl(Jl),Hl=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Bl=e=>R(e)||0==$l(e),Dl=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Ql=e=>e.clear(),Wl=(e,l)=>null==e?void 0:e.forEach(l),Gl=(e,l)=>null==e?void 0:e.delete(l),Kl=e=>new Map(e),Ul=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},Xl=(e,l)=>null==e?void 0:e.get(l),Yl=(e,l)=>Wl(e,((e,t)=>l(t,e))),Zl=(e,l,t)=>R(t)?(Gl(e,l),e):null==e?void 0:e.set(l,t),_l=(e,l,t)=>(Hl(e,l)||Zl(e,l,t()),Xl(e,l)),et=(e,l,t,n=Zl)=>(le(l,((l,n)=>t(e,n,l))),Yl(e,(t=>_(l,t)?0:n(e,t))),e),lt=(e,l,t)=>{const n={};return Wl(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},tt=(e,l,t)=>lt(e,(e=>lt(e,l,t)),te),nt=(e,l,t)=>lt(e,(e=>tt(e,l,t)),te),st=(e,l)=>{const t=Kl();return Wl(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},rt=e=>st(e,st),at=e=>st(e,rt),ot=(e,l,t,n,s=0)=>O((t?_l:Xl)(e,l[s],s>H(l)-2?t:Kl),(r=>{if(s>H(l)-2)return(null==n?void 0:n(r))&&Zl(e,l[s]),r;const a=ot(r,l,t,n,s+1);return Bl(r)&&Zl(e,l[s]),a}));var it=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const ut=Kl(),dt=Kl();var ct=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const ht="storage",mt=globalThis.window,bt=e=>new Set(N(e)||R(e)?e:[e]),pt=(e,l)=>null==e?void 0:e.add(l),vt=/^\d+$/,gt=()=>{const e=[];let l=0;return[t=>{var s;return null!=(s=t?W(e):null)?s:n+l++},l=>{vt.test(l)&&H(e)<1e3&&Q(e,l)}]},It=e=>[e,e],ft=(e,l=Al)=>l(e[0])+l(e[1]),yt=()=>[Kl(),Kl()],Ct=e=>[...e],wt=([e,l])=>e===l,xt=(e,l,t)=>R(e)||!Y(e)||te(e)||U(e)?(null==t||t(),!1):(le(e,((t,n)=>{l(t,n)||ee(e,n)})),!te(e)),kt=(e,l,t)=>Zl(e,l,Xl(e,l)==-t?void 0:t),St=()=>{let e,l,t=!1,s=!1,r=0;const o=Kl(),d=Kl(),w=Kl(),x=Kl(),S=Kl(),T=Kl(),V=Kl(),N=Kl(),L=Kl(),E=Kl(),M=Kl(),j=Kl(),z=Kl(),$=Kl(),A=bt(),B=Kl(),W=Kl(),G=Kl(),K=Kl(),U=yt(),Y=yt(),Z=yt(),re=yt(),ae=yt(),oe=yt(),ie=yt(),ue=yt(),de=yt(),ce=yt(),he=yt(),me=yt(),be=yt(),pe=yt(),ve=yt(),ge=Kl(),Ie=yt(),[fe,ye,Ce,we]=(e=>{let l;const[t,s]=gt(),r=Kl();return[(e,s,a,o=[],i=(()=>[]))=>{null!=l||(l=it);const u=t(1);return Zl(r,u,[e,s,a,o,i]),pt(ot(s,null!=a?a:[n],bt),u),u},(e,t,...s)=>J(((e,l=[n])=>{const t=[],s=(e,n)=>n==H(l)?Q(t,e):null===l[n]?Wl(e,(e=>s(e,n+1))):J([l[n],null],(l=>s(Xl(e,l),n+1)));return s(e,0),t})(e,t),(e=>Wl(e,(e=>Xl(r,e)[0](l,...null!=t?t:[],...s))))),e=>O(Xl(r,e),(([,l,t])=>(ot(l,null!=t?t:[n],void 0,(l=>(Gl(l,e),Bl(l)?1:0))),Zl(r,e),s(e),t))),e=>O(Xl(r,e),(([e,,t=[],n,s])=>{const r=(...a)=>{var o,i;const u=H(a);u==H(t)?e(l,...a,...s(a)):R(t[u])?J(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,t[u])};r()}))]})(),xe=e=>{if(!xt(e,((e,l)=>[i,u].includes(l))))return!1;const l=e[i];return!(!q(l)&&l!=a||(Ae(e[u])!=l&&ee(e,u),0))},ke=(l,t)=>(!e||Hl(M,t)||nl(t))&&xt(l,((e,l)=>Se(t,l,e)),(()=>nl(t))),Se=(e,l,t,n)=>xt(n?t:Oe(t,e,l),((n,s)=>O(Te(e,l,s,n),(e=>(t[s]=e,!0)),(()=>!1))),(()=>nl(e,l))),Te=(l,t,n,s)=>e?O(Xl(Xl(M,l),n),(e=>Ae(s)!=e[i]?nl(l,t,n,s,e[u]):s),(()=>nl(l,t,n,s))):R(Ae(s))?nl(l,t,n,s):s,Ve=(e,l)=>xt(l?e:qe(e),((l,t)=>O(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?O(Xl(z,e),(l=>Ae(t)!=l[i]?sl(e,t,l[u]):t),(()=>sl(e,t))):R(Ae(t))?sl(e,t):t,Oe=(e,l,t)=>(O(Xl(j,l),(([n,s])=>{Wl(n,((l,t)=>{_(e,t)||(e[t]=l)})),Wl(s,(n=>{_(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Wl($,((l,t)=>{_(e,t)||(e[t]=l)})),Wl(A,(l=>{_(e,l)||sl(l)}))),e),Pe=e=>et(M,e,((e,l,t)=>{const n=Kl(),s=bt();et(_l(M,l,Kl),t,((e,l,t)=>{Zl(e,l,t),O(t[u],(e=>Zl(n,l,e)),(()=>pt(s,l)))})),Zl(j,l,[n,s])}),((e,l)=>{Zl(M,l),Zl(j,l)})),Ne=e=>et(z,e,((e,l,t)=>{Zl(z,l,t),O(t[u],(e=>Zl($,l,e)),(()=>pt(A,l)))}),((e,l)=>{Zl(z,l),Zl($,l),Gl(A,l)})),Le=e=>te(e)?ql():Sl(e),Ee=e=>et(G,e,((e,l,t)=>Me(l,t)),((e,l)=>Ge(l))),Me=(e,l)=>et(_l(G,e,(()=>(Ye(e,1),Zl(B,e,gt()),Zl(W,e,Kl()),Kl()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ke(e,l,t))),je=(e,l,t,n,s)=>et(_l(l,t,(()=>(Ze(e,t,1),Kl()))),n,((l,n,s)=>ze(e,t,l,n,s)),((n,r)=>Ue(e,l,t,n,r,s))),ze=(e,l,t,n,s)=>{Hl(t,n)||_e(e,l,n,1);const r=Xl(t,n);s!==r&&(el(e,l,n,r,s),Zl(t,n,s))},$e=(e,l,t,n,s)=>O(Xl(l,t),(l=>ze(e,t,l,n,s)),(()=>je(e,l,t,Oe({[n]:s},e,t)))),He=e=>te(e)?Ll():Tl(e),Be=e=>et(K,e,((e,l,t)=>De(l,t)),((e,l)=>Xe(l))),De=(e,l)=>{Hl(K,e)||ll(e,1);const t=Xl(K,e);l!==t&&(tl(e,t,l),Zl(K,e,l))},Qe=(e,l)=>{const[t]=Xl(B,e),n=t(l);return Hl(Xl(G,e),n)?Qe(e,l):n},We=e=>{var l;return null!=(l=Xl(G,e))?l:Me(e,{})},Ge=e=>Me(e,{}),Ke=(e,l,t)=>{const[,n]=Xl(B,e);n(t),je(e,l,t,{},!0)},Ue=(e,l,t,n,s,r)=>{var a;const o=Xl(null==(a=Xl(j,e))?void 0:a[0],s);if(!R(o)&&!r)return ze(e,t,n,s,o);const i=l=>{el(e,t,l,Xl(n,l)),_e(e,t,l,-1),Zl(n,l)};R(o)?i(s):Yl(n,i),Bl(n)&&(Ze(e,t,-1),Bl(Zl(l,t))&&(Ye(e,-1),Zl(G,e),Zl(B,e),Zl(W,e)))},Xe=e=>{const l=Xl($,e);if(!R(l))return De(e,l);tl(e,Xl(K,e)),ll(e,-1),Zl(K,e)},Ye=(e,l)=>kt(o,e,l),Ze=(e,l,t)=>kt(_l(x,e,Kl),l,t)&&Zl(w,e,_l(w,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=Xl(W,e),a=null!=(s=Xl(r,t))?s:0;(0==a&&1==n||1==a&&-1==n)&&kt(_l(d,e,Kl),t,n),Zl(r,t,a!=-n?a+n:null),kt(_l(_l(S,e,Kl),l,Kl),t,n)},el=(e,l,t,n,s)=>_l(_l(_l(T,e,Kl),l,Kl),t,(()=>[n,0]))[1]=s,ll=(e,l)=>kt(V,e,l),tl=(e,l,t)=>_l(N,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(Q(_l(_l(_l(L,e,Kl),l,Kl),t,(()=>[])),n),s),sl=(e,l,t)=>(Q(_l(E,e,(()=>[])),l),t),rl=(e,l,t)=>O(Xl(Xl(Xl(T,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...It(Cl(e,l,t))])),al=e=>O(Xl(N,e),(([e,l])=>[!0,e,l]),(()=>[!1,...It(kl(e))])),ol=e=>Bl(L)||Bl(he[e])?0:Wl(e?at(L):L,((l,t)=>Wl(l,((l,n)=>Wl(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Bl(E)||Bl(me[e])?0:Wl(e?st(E):E,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Bl(l))return ye(e,t,(()=>lt(l))),1},dl=e=>{const l=Bl(ie[e]),t=Bl(de[e])&&Bl(re[e])&&Bl(ae[e])&&Bl(oe[e])&&l&&Bl(Y[e]),n=Bl(ce[e])&&Bl(ue[e])&&Bl(Z[e])&&Bl(U[e]);if(!t||!n){const s=e?[st(o),rt(d),st(w),rt(x),at(S),at(T)]:[o,d,w,x,S,T];if(!t){ul(Y[e],s[0]),Wl(s[1],((l,t)=>ul(re[e],l,[t]))),Wl(s[2],((l,t)=>{0!=l&&ye(ae[e],[t],gl(t))}));const t=bt();Wl(s[3],((n,s)=>{ul(oe[e],n,[s])&&!l&&(ye(ie[e],[s,null]),pt(t,s))})),l||Wl(s[5],((l,n)=>{if(!Hl(t,n)){const t=bt();Wl(l,(e=>Wl(e,(([l,n],s)=>n!==l?pt(t,s):Gl(e,s))))),Wl(t,(l=>ye(ie[e],[n,l])))}})),Wl(s[4],((l,t)=>Wl(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Wl(s[5],((t,n)=>{let s;Wl(t,((t,r)=>{let a;Wl(t,(([t,o],i)=>{o!==t&&(ye(ce[e],[n,r,i],o,t,rl),l=s=a=1)})),a&&ye(ue[e],[n,r],rl)})),s&&ye(Z[e],[n],rl)})),l&&ye(U[e],void 0,rl)}}},cl=e=>{const l=Bl(pe[e]),t=Bl(ve[e])&&Bl(be[e]);if(!l||!t){const n=e?[st(V),st(N)]:[V,N];if(l||ul(pe[e],n[0]),!t){let l;Wl(n[1],(([t,n],s)=>{n!==t&&(ye(ve[e],[s],n,t,al),l=1)})),l&&ye(be[e],void 0,al)}}},hl=(e,...l)=>(jl((()=>e(...F(l,k)))),it),ml=()=>[lt(T,((e,l)=>-1===Xl(o,l)?null:lt(e,((e,t)=>-1===Xl(Xl(x,l),t)?null:lt(e,(([,e])=>null!=e?e:null),((e,l)=>wt(l)))),te)),te),lt(N,(([,e])=>null!=e?e:null),((e,l)=>wt(l)))],bl=()=>({cellsTouched:t,valuesTouched:s,changedCells:nt(T,Ct,wt),invalidCells:nt(L),changedValues:lt(N,Ct,wt),invalidValues:lt(E),changedTableIds:lt(o),changedRowIds:tt(x),changedCellIds:nt(S),changedValueIds:lt(V)}),pl=()=>nt(G),vl=()=>Ul(G),gl=e=>$l(Xl(G,k(e))),Il=e=>Ul(Xl(G,k(e))),fl=(e,l,t,n=0,s)=>{return F(D((a=Xl(G,k(e)),o=(e,t)=>[R(l)?t:Xl(e,k(l)),t],r=([e],[l])=>{return((null!=(n=e)?n:0)<(null!=(s=l)?s:0)?-1:1)*(t?-1:1);var n,s},F([...null!=(i=null==a?void 0:a.entries())?i:[]],(([e,l])=>o(l,e))).sort(r)),n,R(s)?s:n+s),(([,e])=>e));var r,a,o,i},yl=(e,l)=>Ul(Xl(Xl(G,k(e)),k(l))),Cl=(e,l,t)=>Xl(Xl(Xl(G,k(e)),k(l)),k(t)),wl=()=>lt(K),xl=()=>Ul(K),kl=e=>Xl(K,k(e)),Sl=e=>hl((()=>(e=>xt(e,ke,nl))(e)?Ee(e):0)),Tl=e=>hl((()=>Ve(e)?Be(e):0)),Vl=e=>{try{Le(se(e))}catch(e){}return it},Rl=l=>hl((()=>{if((e=xt(l,(e=>xt(e,xe))))&&(Pe(l),!Bl(G))){const e=pl();ql(),Sl(e)}})),Ol=e=>hl((()=>{if(l=(e=>xt(e,xe))(e)){const t=wl();Ml(),Ll(),l=!0,Ne(e),Tl(t)}})),ql=()=>hl((()=>Ee({}))),Pl=e=>hl((e=>Hl(G,e)?Ge(e):0),e),Nl=(e,l)=>hl(((e,l)=>O(Xl(G,e),(t=>Hl(t,l)?Ke(e,t,l):0))),e,l),Ll=()=>hl((()=>Be({}))),El=()=>hl((()=>{Pe({}),e=!1})),Ml=()=>hl((()=>{Ne({}),l=!1})),jl=(e,l)=>{if(-1!=r){zl();const t=e();return Dl(l),t}},zl=()=>(-1!=r&&r++,1==r&&ye(ge,void 0,ml,bl),it),Dl=e=>(r>0&&(r--,0==r&&(t=!Bl(T),s=!Bl(N),r=1,ol(1),t&&dl(1),il(1),s&&cl(1),(null==e?void 0:e(ml,bl))&&(Wl(T,((e,l)=>Wl(e,((e,t)=>Wl(e,(([e],n)=>Je(it,l,t,n,e))))))),Wl(N,(([e],l)=>Fe(it,l,e))),t=s=!1),ye(Ie[0],void 0,ml,bl),r=-1,ol(0),t&&dl(0),il(0),s&&cl(0),ye(Ie[1],void 0,ml,bl),r=0,t=s=!1,J([o,d,w,x,S,T,L,V,N,E],Ql))),it),it={getContent:()=>[pl(),wl()],getTables:pl,getTableIds:vl,getTable:e=>tt(Xl(G,k(e))),getTableCellIds:e=>Ul(Xl(W,k(e))),getRowCount:gl,getRowIds:Il,getSortedRowIds:fl,getRow:(e,l)=>lt(Xl(Xl(G,k(e)),k(l))),getCellIds:yl,getCell:Cl,getValues:wl,getValueIds:xl,getValue:kl,hasTables:()=>!Bl(G),hasTable:e=>Hl(G,k(e)),hasTableCell:(e,l)=>Hl(Xl(W,k(e)),k(l)),hasRow:(e,l)=>Hl(Xl(G,k(e)),k(l)),hasCell:(e,l,t)=>Hl(Xl(Xl(G,k(e)),k(l)),k(t)),hasValues:()=>!Bl(K),hasValue:e=>Hl(K,k(e)),getTablesJson:()=>ne(G),getValuesJson:()=>ne(K),getJson:()=>ne([G,K]),getTablesSchemaJson:()=>ne(M),getValuesSchemaJson:()=>ne(z),getSchemaJson:()=>ne([M,z]),hasTablesSchema:()=>e,hasValuesSchema:()=>l,setContent:([e,l])=>hl((()=>{(te(e)?ql:Sl)(e),(te(l)?Ll:Tl)(l)})),setTables:Sl,setTable:(e,l)=>hl((e=>ke(l,e)?Me(e,l):0),e),setRow:(e,l,t)=>hl(((e,l)=>Se(e,l,t)?je(e,We(e),l,t):0),e,l),addRow:(e,l,t=!0)=>jl((()=>{let n;return Se(e,n,l)&&(e=k(e),je(e,We(e),n=Qe(e,t?1:0),l)),n})),setPartialRow:(e,l,t)=>hl(((e,l)=>{if(Se(e,l,t,1)){const n=We(e);le(t,((t,s)=>$e(e,n,l,s,t)))}}),e,l),setCell:(e,l,t,n)=>hl(((e,l,t)=>O(Te(e,l,t,P(n)?n(Cl(e,l,t)):n),(n=>$e(e,We(e),l,t,n)))),e,l,t),setValues:Tl,setPartialValues:e=>hl((()=>Ve(e,1)?le(e,((e,l)=>De(l,e))):0)),setValue:(e,l)=>hl((e=>O(Re(e,P(l)?l(kl(e)):l),(l=>De(e,l)))),e),setTransactionChanges:e=>hl((()=>{le(e[0],((e,l)=>R(e)?Pl(l):le(e,((e,t)=>R(e)?Nl(l,t):le(e,((e,n)=>Je(it,l,t,n,e))))))),le(e[1],((e,l)=>Fe(it,l,e)))})),setTablesJson:Vl,setValuesJson:e=>{try{He(se(e))}catch(e){}return it},setJson:e=>{try{const[l,t]=se(e);Le(l),He(t)}catch(l){Vl(e)}return it},setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Pl,delRow:Nl,delCell:(e,l,t,n)=>hl(((e,l,t)=>O(Xl(G,e),(s=>O(Xl(s,l),(r=>Hl(r,t)?Ue(e,s,l,r,t,n):0))))),e,l,t),delValues:Ll,delValue:e=>hl((e=>Hl(K,e)?Xe(e):0),e),delTablesSchema:El,delValuesSchema:Ml,delSchema:()=>hl((()=>{El(),Ml()})),transaction:jl,startTransaction:zl,finishTransaction:Dl,forEachTable:e=>Wl(G,((l,t)=>e(t,(e=>Wl(l,((l,t)=>e(t,(e=>Yl(l,e))))))))),forEachTableCell:(e,l)=>Yl(Xl(W,k(e)),l),forEachRow:(e,l)=>Wl(Xl(G,k(e)),((e,t)=>l(t,(l=>Yl(e,l))))),forEachCell:(e,l,t)=>Yl(Xl(Xl(G,k(e)),k(l)),t),forEachValue:e=>Yl(K,e),addSortedRowIdsListener:(e,l,t,n,s,r,a)=>{let o=fl(e,l,t,n,s);return fe((()=>{const a=fl(e,l,t,n,s);var i,u,d;u=o,H(i=a)===H(u)&&(d=(e,l)=>u[l]===e,i.every(d))||(o=a,r(it,e,l,t,n,s,o))}),ie[a?1:0],[e,l],[vl])},addStartTransactionListener:e=>fe(e,ge),addWillFinishTransactionListener:e=>fe(e,Ie[0]),addDidFinishTransactionListener:e=>fe(e,Ie[1]),callListener:e=>(we(e),it),delListener:e=>(Ce(e),it),getListenerStats:()=>({tables:ft(U),tableIds:ft(Y),tableCellIds:ft(re),table:ft(Z),rowCount:ft(ae),rowIds:ft(oe),sortedRowIds:ft(ie),row:ft(ue,Jl),cellIds:ft(de,Jl),cell:ft(ce,Fl),invalidCell:ft(he,Fl),values:ft(be),valueIds:ft(pe),value:ft(ve),invalidValue:ft(me),transaction:Al(ge)+ft(Ie)}),createStore:St,addListener:fe,callListeners:ye};return le({[h]:[0,U],[m]:[0,Y],[c]:[1,Z,[vl]],[c+I]:[1,re,[vl]],[p]:[1,ae,[vl]],[v]:[1,oe,[vl]],[b]:[2,ue,[vl,Il]],[I]:[2,de,[vl,Il]],[g]:[3,ce,[vl,Il,yl],e=>It(Cl(...e))],InvalidCell:[3,he],[y]:[0,be],[C]:[0,pe],[f]:[1,ve,[xl],e=>It(kl(e[0]))],InvalidValue:[1,me]},(([e,l,t,n],s)=>{it["add"+s+"Listener"]=(...s)=>fe(s[e],l[s[e+1]?1:0],e>0?D(s,0,e):void 0,t,n)})),X(it)},Tt=({position:e="right",open:t=!1})=>{const n=l.useCreateStore(St),s=oe.indexOf(e);return l.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,a=[])=>{let o,i,u,d=0,c=0,h=0,m=0;_l(ut,a,(()=>0)),_l(dt,a,(()=>[]));const b=e=>it(void 0,null,(function*(){return 2!=d&&(d=1,c++,yield p.schedule((()=>it(void 0,null,(function*(){yield e(),d=0}))))),p})),p={load:(t,n)=>it(void 0,null,(function*(){return yield b((()=>it(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>it(void 0,[...t],(function*(t={},s={}){return p.stopAutoLoad(),yield p.load(t,s),m=1,u=n(((t,n)=>it(void 0,null,(function*(){if(n){const l=n();yield b((()=>it(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield b((()=>it(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),p})),stopAutoLoad:()=>(m&&(s(u),u=void 0,m=0),p),save:l=>it(void 0,null,(function*(){return 1!=d&&(d=2,h++,yield p.schedule((()=>it(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}d=0}))))),p})),startAutoSave:()=>it(void 0,null,(function*(){return yield p.stopAutoSave().save(),o=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();te(t)&&te(n)||p.save((()=>[t,n]))})),p})),stopAutoSave:()=>(O(o,e.delListener),p),schedule:(...e)=>it(void 0,null,(function*(){return Q(Xl(dt,a),...e),yield it(void 0,null,(function*(){if(!Xl(ut,a)){for(Zl(ut,a,1);!R(i=W(Xl(dt,a)));)try{yield i()}catch(e){null==r||r(e)}Zl(ut,a,0)}})),p})),getStore:()=>e,destroy:()=>p.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return X(p)})(e,(()=>ct(void 0,null,(function*(){return se(t.getItem(l))}))),(e=>ct(void 0,null,(function*(){return t.setItem(l,ne(e()))}))),(e=>{const n=n=>{n.storageArea===t&&n.key===l&&e((()=>se(n.newValue)))};return mt.addEventListener(ht,n),n}),(e=>mt.removeEventListener(ht,e)),n))(e,re,sessionStorage,l);var l}),void 0,(e=>{return l=function*(){yield e.load(void 0,{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=l=>l.done?e(l.value):Promise.resolve(l.value).then(n,s);r((l=l.apply(void 0,null)).next())}));var l})),L(E,null,L("aside",{id:re},L(ze,{s:n}),L(jl,{s:n})),L("style",null,je))};var Vt=Object.defineProperty,Rt=Object.getOwnPropertySymbols,Ot=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,Pt=(e,l,t)=>l in e?Vt(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;exports.EditableCellView=fl,exports.EditableValueView=yl,exports.RelationshipInHtmlTable=gl,exports.ResultSortedTableInHtmlTable=Il,exports.ResultTableInHtmlTable=e=>{var t=e,{queryId:n,queries:s,customCells:r}=t,a=Ze(t,["queryId","queries","customCells"]);return L(dl,Ye(Xe({},a),{params:rl(ul(l.useResultTableCellIds(n,s),r,l.ResultCellView),ol(s,n),l.useResultRowIds(n,s))}))},exports.SliceInHtmlTable=vl,exports.SortedTableInHtmlTable=bl,exports.SortedTablePaginator=Cl,exports.StoreInspector=e=>L(Tt,((e,l)=>{for(var t in l||(l={}))Ot.call(l,t)&&Pt(e,t,l[t]);if(Rt)for(var t of Rt(l))qt.call(l,t)&&Pt(e,t,l[t]);return e})({},e)),exports.TableInHtmlTable=e=>{var t=e,{tableId:n,store:s,editable:r,customCells:a}=t,o=Ze(t,["tableId","store","editable","customCells"]);return L(dl,Ye(Xe({},o),{params:rl(ul(l.useTableCellIds(n,s),a,r?fl:l.CellView),al(s,n),l.useRowIds(n,s))}))},exports.ValuesInHtmlTable=pl;
1
+ "use strict";var e=require("react"),l=require("./ui-react");const t=e=>typeof e,n="",s=t(n),r=t(!0),o=t(0),a=t(t),i="type",u="default",d="Ids",c="Table",h=c+"s",m=c+d,b="Row",p=b+"Count",v=b+d,g="Cell",I=g+d,f="Value",y=f+"s",w=f+d,C="currentTarget",x="value",k=e=>n+e,S=Math.floor,T=isFinite,V=(e,l)=>e instanceof l,R=e=>null==e,O=(e,l,t)=>R(e)?null==t?void 0:t():l(e),q=e=>e==s||e==r,P=e=>t(e)==a,N=e=>Array.isArray(e),{PureComponent:E,Fragment:L,createElement:M,useCallback:j,useLayoutEffect:z,useRef:$,useState:A}=e,F=(e,...l)=>R(e)?{}:e(...l),J=(e,l)=>e.forEach(l),H=(e,l)=>e.map(l),D=e=>e.length,B=e=>0==D(e),Q=(e,l,t)=>e.slice(l,t),W=(e,...l)=>e.push(...l),G=e=>e.shift(),K=Object,U=K.keys,X=K.isFrozen,Y=K.freeze,Z=e=>V(e,K)&&e.constructor==K,_=(e=[])=>K.fromEntries(e),ee=(e,l)=>!R(((e,l)=>O(e,(e=>e[l])))(e,l)),le=(e,l)=>(delete e[l],e),te=(e,l)=>H(K.entries(e),(([e,t])=>l(t,e))),ne=e=>Z(e)&&0==(e=>D(U(e)))(e),se=e=>JSON.stringify(e,((e,l)=>V(l,Map)?K.fromEntries([...l]):l)),re=JSON.parse,oe="tinybaseStoreInspector",ae="TinyBase Store Inspector",ie=["left","top","bottom","right","full"],ue="state",de="sort",ce="open",he="position",me=ce,be="editable",pe=(...e)=>se(e),ve=(e,l)=>H(e.sort(),l),ge=(e,t)=>[!!l.useCell(ue,e,be,t),j((l=>{t.setCell(ue,e,be,(e=>!e)),l.preventDefault()}),[t,e])],Ie="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",fe='content:url("',ye=fe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",we='</svg>")',Ce=fe+"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\")",xe=H([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>ye+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+we)),ke=ye+"<path d='M20 20l60 60M20 80l60-60' />"+we,Se=ye+`<path d='${Ie}' />`+we,Te=ye+`<path d='${Ie}M20 20l60 60' />`+we;var Ve=Object.defineProperty,Re=Object.defineProperties,Oe=Object.getOwnPropertyDescriptors,qe=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable,Ee=(e,l,t)=>l in e?Ve(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Le=(e,l)=>{for(var t in l||(l={}))Pe.call(l,t)&&Ee(e,t,l[t]);if(qe)for(var t of qe(l))Ne.call(l,t)&&Ee(e,t,l[t]);return e},Me=(e,l)=>Re(e,Oe(l));const je="*::-webkit-scrollbar",ze=((e,l="")=>e.join(l))(te(Me(Le(Me(Le(Me(Le({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[je]:"width:0.5rem;height:0.5rem;",[je+"-track"]:"background:#111",[je+"-thumb"]:"background:#999;border:1px solid #111",[je+"-thumb:hover"]:"background:#fff",[je+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+Ce},_(H(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),_(H(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Ce,"header>img:nth-of-type(6)":ke}),_(H(xe,((e,l)=>[`header>img[data-id='${l}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":Se,"details[open]>summary img.done":Te,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,#${oe} 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,l)=>e?`#${oe} ${l}{${e}}`:""))),$e=({s:e})=>{var t;const n=null!=(t=l.useValue(he,e))?t:1,s=l.useSetValueCallback(me,(()=>!0),[],e);return l.useValue(me,e)?null:M("img",{onClick:s,title:ae,"data-position":n})},Ae=({uniqueId:e,summary:t,editable:n,handleEditable:s,children:r,s:o})=>{const a=!!l.useCell(ue,e,ce,o),i=l.useSetCellCallback(ue,e,ce,(e=>e[C].open),[],o);return M("details",{open:a,onToggle:i},M("summary",null,t,s?M("img",{onClick:s,className:n?"done":"edit"}):null),r)},Fe=e=>{const l=t(e);return q(l)||l==o&&T(e)?l:void 0},Je=(e,l,t,n,s)=>R(s)?e.delCell(l,t,n,!0):e.setCell(l,t,n,s),He=(e,l,t)=>R(t)?e.delValue(l):e.setValue(l,t),De=(e,l,t,n)=>e==s?l:e==o?t:n;var Be=Object.defineProperty,Qe=Object.defineProperties,We=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,Xe=(e,l,t)=>l in e?Be(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Ye=(e,l)=>{for(var t in l||(l={}))Ke.call(l,t)&&Xe(e,t,l[t]);if(Ge)for(var t of Ge(l))Ue.call(l,t)&&Xe(e,t,l[t]);return e},Ze=(e,l)=>Qe(e,We(l)),_e=(e,l)=>{var t={};for(var n in e)Ke.call(e,n)&&l.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&Ge)for(var n of Ge(e))l.indexOf(n)<0&&Ue.call(e,n)&&(t[n]=e[n]);return t};const{useCallback:el,useMemo:ll,useState:tl}=e,nl="editable",sl=(e,t)=>H(l.useTableCellIds(e,t),(l=>e+"."+l)),rl=(e,l,t)=>{const n=el(e,l);return t?n:void 0},ol=(...e)=>ll((()=>e),e),al=(e,l)=>ll((()=>({store:e,tableId:l})),[e,l]),il=(e,l)=>ll((()=>({queries:e,queryId:l})),[e,l]),ul=(e,l=!1,t,n=0,s,r,o,a)=>{const[[i,u,d],c]=tl([e,l,n]),h=el((e=>{c(e),null==a||a(e)}),[a]),m=rl((e=>h([e,e==i&&!u,d])),[h,i,u,d],t),b=el((e=>h([i,u,e])),[h,i,u]),p=!0===o?Cl:o;return[[i,u,d],m,ll((()=>!1===o?null:M(p,{offset:d,limit:s,total:r,onChange:b})),[o,p,d,s,r,b])]},dl=(e,l,n)=>ll((()=>{const r=null!=l?l:e;return _(te(N(r)?_(H(r,(e=>[e,e]))):r,((e,l)=>{return[l,Ye(Ye({},{label:l,component:n}),(r=e,t(r)==s?{label:e}:e))];var r})))}),[l,n,e]),cl=({className:e,headerRow:l,idColumn:t,params:[n,s,r,o,a,i]})=>M("table",{className:e},i?M("caption",null,i):null,!1===l?null:M("thead",null,M("tr",null,!1===t?null:M(hl,{sort:null!=o?o:[],label:"Id",onClick:a}),te(n,(({label:e},l)=>M(hl,{key:l,cellId:l,label:e,sort:null!=o?o:[],onClick:a}))))),M("tbody",null,H(r,(e=>M("tr",{key:e},!1===t?null:M("th",null,e),te(n,(({component:l,getComponentProps:t},n)=>M("td",{key:n},M(l,Ze(Ye(Ye({},F(t,e,n)),s),{rowId:e,cellId:n})))))))))),hl=({cellId:e,sort:[l,t],label:s=(null!=e?e:n),onClick:r})=>M("th",{onClick:rl((()=>null==r?void 0:r(e)),[r,e],r),className:R(t)||l!=e?void 0:`sorted ${t?"de":"a"}scending`},R(t)||l!=e?null:(t?"↓":"↑")+" ",s),ml=({localRowId:t,params:[n,s,r,o,a,i,u]})=>{const d=l.useRemoteRowId(a,t,i);return M("tr",null,!1===n?null:M(e.Fragment,null,M("th",null,t),M("th",null,d)),te(s,(({component:e,getComponentProps:l},n)=>{const[s,a]=n.split(".",2),i=s===r?t:s===o?d:null;return R(i)?null:M("td",{key:n},M(e,Ze(Ye({},F(l,i,a)),{store:u,tableId:s,rowId:i,cellId:a})))})))},bl=({thing:e,onThingChange:l,className:t,hasSchema:n})=>{const[a,i]=tl(),[u,d]=tl(),[c,h]=tl(),[m,b]=tl(),[p,v]=tl();u!==e&&(i(Fe(e)),d(e),h(e+""),b(Number(e)||0),v(!!e));const g=el(((e,t)=>{t(e),d(e),l(e)}),[l]);return M("div",{className:t},M("button",{className:a,onClick:el((()=>{if(!(null==n?void 0:n())){const e=De(a,o,r,s),t=De(e,c,m,p);i(e),d(t),l(t)}}),[n,l,c,m,p,a])},a),De(a,M("input",{key:a,value:c,onChange:el((e=>g(e[C][x]+"",h)),[g])}),M("input",{key:a,type:"number",value:m,onChange:el((e=>g(Number(e[C][x]||0),b)),[g])}),M("input",{key:a,type:"checkbox",checked:p,onChange:el((e=>g(!!e[C].checked,v)),[g])})))},pl=e=>{var t=e,{tableId:n,cellId:s,descending:r,offset:o,limit:a,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=t,b=_e(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[p,v,g]=ul(s,r,d,o,a,l.useRowCount(n,i),c,h);return M(cl,Ze(Ye({},b),{params:ol(dl(l.useTableCellIds(n,i),m,u?yl:l.CellView),al(i,n),l.useSortedRowIds(n,...p,a,i),p,v,g)}))},vl=({store:e,editable:t=!1,valueComponent:n=(t?wl:l.ValueView),getValueComponentProps:s,className:r,headerRow:o,idColumn:a})=>M("table",{className:r},!1===o?null:M("thead",null,M("tr",null,!1===a?null:M("th",null,"Id"),M("th",null,f))),M("tbody",null,H(l.useValueIds(e),(l=>M("tr",{key:l},!1===a?null:M("th",null,l),M("td",null,M(n,Ze(Ye({},F(s,l)),{valueId:l,store:e})))))))),gl=e=>{var t=e,{indexId:n,sliceId:s,indexes:r,editable:o,customCells:a}=t,i=_e(t,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(l)])(l.useIndexesOrIndexesById(r),n);return M(cl,Ze(Ye({},i),{params:ol(dl(l.useTableCellIds(c,d),a,o?yl:l.CellView),al(d,c),l.useSliceRowIds(n,s,u))}))},Il=({relationshipId:t,relationships:n,editable:s,customCells:r,className:o,headerRow:a,idColumn:i=!0})=>{const[u,d,c,h]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(l),null==e?void 0:e.getRemoteTableId(l)])(l.useRelationshipsOrRelationshipsById(n),t),m=dl([...sl(c,d),...sl(h,d)],r,s?yl:l.CellView),b=ol(i,m,c,h,t,u,d);return M("table",{className:o},!1===a?null:M("thead",null,M("tr",null,!1===i?null:M(e.Fragment,null,M("th",null,c,".Id"),M("th",null,h,".Id")),te(m,(({label:e},l)=>M("th",{key:l},e))))),M("tbody",null,H(l.useRowIds(c,d),(e=>M(ml,{key:e,localRowId:e,params:b})))))},fl=e=>{var t=e,{queryId:n,cellId:s,descending:r,offset:o,limit:a,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=t,m=_e(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,p,v]=ul(s,r,u,o,a,l.useResultRowCount(n,i),d,h);return M(cl,Ze(Ye({},m),{params:ol(dl(l.useResultTableCellIds(n,i),c,l.ResultCellView),il(i,n),l.useResultSortedRowIds(n,...b,a,i),b,p,v)}))},yl=({tableId:e,rowId:t,cellId:n,store:s,className:r})=>{var o;return M(bl,{thing:l.useCell(e,t,n,s),onThingChange:l.useSetCellCallback(e,t,n,(e=>e),[],s),className:null!=r?r:nl+g,hasSchema:null==(o=l.useStoreOrStoreById(s))?void 0:o.hasTablesSchema})},wl=({valueId:e,store:t,className:n})=>{var s;return M(bl,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=n?n:nl+f,hasSchema:null==(s=l.useStoreOrStoreById(t))?void 0:s.hasValuesSchema})},Cl=({onChange:l,total:t,offset:n=0,limit:s=t,singular:r="row",plural:o=r+"s"})=>{(n>t||n<0)&&(n=0,l(0));const a=rl((()=>l(n-s)),[l,n,s],n>0),i=rl((()=>l(n+s)),[l,n,s],n+s<t);return M(e.Fragment,null,t>s&&M(e.Fragment,null,M("button",{className:"previous",disabled:0==n,onClick:a},"←"),M("button",{className:"next",disabled:n+s>=t,onClick:i},"→"),n+1," to ",Math.min(t,n+s)," of "),t," ",1!=t?o:r)},xl=({indexes:e,indexesId:t,indexId:n,s:s})=>M(Ae,{uniqueId:pe("i",t,n),summary:"Index: "+n,s:s},H(l.useSliceIds(n,e),(l=>M(kl,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s})))),kl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=pe("i",l,t,n),[o,a]=ge(r,s);return M(Ae,{uniqueId:r,summary:"Slice: "+n,editable:o,handleEditable:a,s:s},M(gl,{sliceId:n,indexId:t,indexes:e,editable:o}))},Sl=({indexesId:e,s:t})=>{const n=l.useIndexes(e),s=l.useIndexIds(n);return R(n)?null:M(Ae,{uniqueId:pe("i",e),summary:"Indexes: "+(null!=e?e:u),s:t},B(s)?"No indexes defined":ve(s,(l=>M(xl,{indexes:n,indexesId:e,indexId:l,s:t}))))},Tl=({metrics:e,metricId:t})=>M("tr",null,M("th",null,t),M("td",null,null==e?void 0:e.getTableId(t)),M("td",null,l.useMetric(t,e))),Vl=({metricsId:e,s:t})=>{const n=l.useMetrics(e),s=l.useMetricIds(n);return R(n)?null:M(Ae,{uniqueId:pe("m",e),summary:"Metrics: "+(null!=e?e:u),s:t},B(s)?"No metrics defined":M("table",null,M("thead",null,M("th",null,"Metric Id"),M("th",null,"Table Id"),M("th",null,"Metric")),M("tbody",null,H(s,(e=>M(Tl,{metrics:n,metricId:e}))))))},Rl=({queries:e,queriesId:t,queryId:n,s:s})=>{var r;const o=pe("q",t,n),[a,i,u]=re(null!=(r=l.useCell(ue,o,de,s))?r:"[]"),d=l.useSetCellCallback(ue,o,de,se,[],s);return M(Ae,{uniqueId:o,summary:"Query: "+n,s:s},M(fl,{queryId:n,queries:e,cellId:a,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},Ol=({queriesId:e,s:t})=>{const n=l.useQueries(e),s=l.useQueryIds(n);return R(n)?null:M(Ae,{uniqueId:pe("q",e),summary:"Queries: "+(null!=e?e:u),s:t},B(s)?"No queries defined":ve(s,(l=>M(Rl,{queries:n,queriesId:e,queryId:l,s:t}))))},ql=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=pe("r",l,t),[r,o]=ge(s,n);return M(Ae,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:o,s:n},M(Il,{relationshipId:t,relationships:e,editable:r}))},Pl=({relationshipsId:e,s:t})=>{const n=l.useRelationships(e),s=l.useRelationshipIds(n);return R(n)?null:M(Ae,{uniqueId:pe("r",e),summary:"Relationships: "+(null!=e?e:u),s:t},B(s)?"No relationships defined":ve(s,(l=>M(ql,{relationships:n,relationshipsId:e,relationshipId:l,s:t}))))},Nl=({tableId:e,store:t,storeId:n,s:s})=>{var r;const o=pe("t",n,e),[a,i,u]=re(null!=(r=l.useCell(ue,o,de,s))?r:"[]"),d=l.useSetCellCallback(ue,o,de,se,[],s),[h,m]=ge(o,s);return M(Ae,{uniqueId:o,summary:c+": "+e,editable:h,handleEditable:m,s:s},M(pl,{tableId:e,store:t,cellId:a,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:h}))},El=({store:e,storeId:t,s:n})=>{const s=pe("v",t),[r,o]=ge(s,n);return B(l.useValueIds(e))?null:M(Ae,{uniqueId:s,summary:y,editable:r,handleEditable:o,s:n},M(vl,{store:e,editable:r}))},Ll=({storeId:e,s:t})=>{const n=l.useStore(e),s=l.useTableIds(n);return R(n)?null:M(Ae,{uniqueId:pe("s",e),summary:"Store: "+(null!=e?e:u),s:t},M(El,{storeId:e,store:n,s:t}),ve(s,(l=>M(Nl,{store:n,storeId:e,tableId:l,s:t}))))},Ml=({s:e})=>{const t=$(null),n=$(0),[s,r]=A(!1),{scrollLeft:o,scrollTop:a}=l.useValues(e);z((()=>{const e=t.current;if(e&&!s){const l=new MutationObserver((()=>{e.scrollWidth>=S(o)+e.clientWidth&&e.scrollHeight>=S(a)+e.clientHeight&&e.scrollTo(o,a)}));return l.observe(e,{childList:!0,subtree:!0}),()=>l.disconnect()}}),[s,o,a]);const i=j((l=>{const{scrollLeft:t,scrollTop:s}=l[C];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:t,scrollTop:s})}))}),[e]),u=l.useStore(),d=l.useStoreIds(),c=l.useMetrics(),h=l.useMetricsIds(),m=l.useIndexes(),b=l.useIndexesIds(),p=l.useRelationships(),v=l.useRelationshipsIds(),g=l.useQueries(),I=l.useQueriesIds();return R(u)&&B(d)&&R(c)&&B(h)&&R(m)&&B(b)&&R(p)&&B(v)&&R(g)&&B(I)?M("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):M("article",{ref:t,onScroll:i},M(Ll,{s:e}),H(d,(l=>M(Ll,{storeId:l,key:l,s:e}))),M(Vl,{s:e}),H(h,(l=>M(Vl,{metricsId:l,key:l,s:e}))),M(Sl,{s:e}),H(b,(l=>M(Sl,{indexesId:l,key:l,s:e}))),M(Pl,{s:e}),H(v,(l=>M(Pl,{relationshipsId:l,key:l,s:e}))),M(Ol,{s:e}),H(I,(l=>M(Ol,{queriesId:l,key:l,s:e}))))};var jl=Object.defineProperty,zl=(e,l,t)=>(((e,l,t)=>{l in e?jl(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t})(e,"symbol"!=typeof l?l+"":l,t),t);class $l extends E{constructor(e){super(e),zl(this,"componentDidCatch",((e,l)=>console.error(e,l.componentStack))),this.state={e:0}}render(){return this.state.e?M("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}zl($l,"getDerivedStateFromError",(()=>({e:1})));const Al=({s:e})=>{var t;const n=null!=(t=l.useValue(he,e))?t:1,s=l.useSetValueCallback(me,(()=>!1),[],e),r=l.useSetValueCallback(he,(e=>Number(e[C].dataset.id)),[],e);return M("header",null,M("img",{title:ae}),M("span",null,ae),H(ie,((e,l)=>l==n?null:M("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),M("img",{onClick:s,title:"Close"}))},Fl=({s:e})=>{var t;const n=null!=(t=l.useValue(he,e))?t:1;return l.useValue(me,e)?M("main",{"data-position":n},M(Al,{s:e}),M($l,null,M(Ml,{s:e}))):null},Jl=e=>l=>{return t=(l,t)=>l+e(t),Kl(l).reduce(t,0);var t},Hl=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},Dl=Jl(Hl),Bl=Jl(Dl),Ql=Jl(Bl),Wl=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Gl=e=>R(e)||0==Hl(e),Kl=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Ul=e=>e.clear(),Xl=(e,l)=>null==e?void 0:e.forEach(l),Yl=(e,l)=>null==e?void 0:e.delete(l),Zl=e=>new Map(e),_l=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},et=(e,l)=>null==e?void 0:e.get(l),lt=(e,l)=>Xl(e,((e,t)=>l(t,e))),tt=(e,l,t)=>R(t)?(Yl(e,l),e):null==e?void 0:e.set(l,t),nt=(e,l,t)=>(Wl(e,l)||tt(e,l,t()),et(e,l)),st=(e,l,t,n=tt)=>(te(l,((l,n)=>t(e,n,l))),lt(e,(t=>ee(l,t)?0:n(e,t))),e),rt=(e,l,t)=>{const n={};return Xl(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},ot=(e,l,t)=>rt(e,(e=>rt(e,l,t)),ne),at=(e,l,t)=>rt(e,(e=>ot(e,l,t)),ne),it=(e,l)=>{const t=Zl();return Xl(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},ut=e=>it(e,it),dt=e=>it(e,ut),ct=(e,l,t,n,s=0)=>O((t?nt:et)(e,l[s],s>D(l)-2?t:Zl),(r=>{if(s>D(l)-2)return(null==n?void 0:n(r))&&tt(e,l[s]),r;const o=ct(r,l,t,n,s+1);return Gl(r)&&tt(e,l[s]),o}));var ht=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{a(t.next(e))}catch(e){s(e)}},o=e=>{try{a(t.throw(e))}catch(e){s(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,o);a((t=t.apply(e,l)).next())}));const mt=Zl(),bt=Zl();var pt=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{a(t.next(e))}catch(e){s(e)}},o=e=>{try{a(t.throw(e))}catch(e){s(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,o);a((t=t.apply(e,l)).next())}));const vt="storage",gt=globalThis.window,It=e=>new Set(N(e)||R(e)?e:[e]),ft=(e,l)=>null==e?void 0:e.add(l),yt=/^\d+$/,wt=()=>{const e=[];let l=0;return[t=>{var s;return null!=(s=t?G(e):null)?s:n+l++},l=>{yt.test(l)&&D(e)<1e3&&W(e,l)}]},Ct=e=>[e,e],xt=(e,l=Dl)=>l(e[0])+l(e[1]),kt=()=>[Zl(),Zl()],St=e=>[...e],Tt=([e,l])=>e===l,Vt=(e,l,t)=>R(e)||!Z(e)||ne(e)||X(e)?(null==t||t(),!1):(te(e,((t,n)=>{l(t,n)||le(e,n)})),!ne(e)),Rt=(e,l,t)=>tt(e,l,et(e,l)==-t?void 0:t),Ot=()=>{let e,l,t=!1,s=!1,r=0;const a=Zl(),d=Zl(),C=Zl(),x=Zl(),S=Zl(),T=Zl(),V=Zl(),N=Zl(),E=Zl(),L=Zl(),M=Zl(),j=Zl(),z=Zl(),$=Zl(),A=It(),F=Zl(),B=Zl(),G=Zl(),K=Zl(),U=kt(),X=kt(),Z=kt(),_=kt(),oe=kt(),ae=kt(),ie=kt(),ue=kt(),de=kt(),ce=kt(),he=kt(),me=kt(),be=kt(),pe=kt(),ve=kt(),ge=Zl(),Ie=kt(),[fe,ye,we,Ce]=(e=>{let l;const[t,s]=wt(),r=Zl();return[(e,s,o,a=[],i=(()=>[]))=>{null!=l||(l=Al);const u=t(1);return tt(r,u,[e,s,o,a,i]),ft(ct(s,null!=o?o:[n],It),u),u},(e,t,...s)=>J(((e,l=[n])=>{const t=[],s=(e,n)=>n==D(l)?W(t,e):null===l[n]?Xl(e,(e=>s(e,n+1))):J([l[n],null],(l=>s(et(e,l),n+1)));return s(e,0),t})(e,t),(e=>Xl(e,(e=>et(r,e)[0](l,...null!=t?t:[],...s))))),e=>O(et(r,e),(([,l,t])=>(ct(l,null!=t?t:[n],void 0,(l=>(Yl(l,e),Gl(l)?1:0))),tt(r,e),s(e),t))),e=>O(et(r,e),(([e,,t=[],n,s])=>{const r=(...o)=>{var a,i;const u=D(o);u==D(t)?e(l,...o,...s(o)):R(t[u])?J(null!=(i=null==(a=n[u])?void 0:a.call(n,...o))?i:[],(e=>r(...o,e))):r(...o,t[u])};r()}))]})(),xe=e=>{if(!Vt(e,((e,l)=>[i,u].includes(l))))return!1;const l=e[i];return!(!q(l)&&l!=o||(Fe(e[u])!=l&&le(e,u),0))},ke=(l,t)=>(!e||Wl(M,t)||nl(t))&&Vt(l,((e,l)=>Se(t,l,e)),(()=>nl(t))),Se=(e,l,t,n)=>Vt(n?t:Oe(t,e,l),((n,s)=>O(Te(e,l,s,n),(e=>(t[s]=e,!0)),(()=>!1))),(()=>nl(e,l))),Te=(l,t,n,s)=>e?O(et(et(M,l),n),(e=>Fe(s)!=e[i]?nl(l,t,n,s,e[u]):s),(()=>nl(l,t,n,s))):R(Fe(s))?nl(l,t,n,s):s,Ve=(e,l)=>Vt(l?e:qe(e),((l,t)=>O(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?O(et(z,e),(l=>Fe(t)!=l[i]?sl(e,t,l[u]):t),(()=>sl(e,t))):R(Fe(t))?sl(e,t):t,Oe=(e,l,t)=>(O(et(j,l),(([n,s])=>{Xl(n,((l,t)=>{ee(e,t)||(e[t]=l)})),Xl(s,(n=>{ee(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Xl($,((l,t)=>{ee(e,t)||(e[t]=l)})),Xl(A,(l=>{ee(e,l)||sl(l)}))),e),Pe=e=>st(M,e,((e,l,t)=>{const n=Zl(),s=It();st(nt(M,l,Zl),t,((e,l,t)=>{tt(e,l,t),O(t[u],(e=>tt(n,l,e)),(()=>ft(s,l)))})),tt(j,l,[n,s])}),((e,l)=>{tt(M,l),tt(j,l)})),Ne=e=>st(z,e,((e,l,t)=>{tt(z,l,t),O(t[u],(e=>tt($,l,e)),(()=>ft(A,l)))}),((e,l)=>{tt(z,l),tt($,l),Yl(A,l)})),Ee=e=>ne(e)?ql():Sl(e),Le=e=>st(G,e,((e,l,t)=>Me(l,t)),((e,l)=>Ge(l))),Me=(e,l)=>st(nt(G,e,(()=>(Ye(e,1),tt(F,e,wt()),tt(B,e,Zl()),Zl()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ke(e,l,t))),je=(e,l,t,n,s)=>st(nt(l,t,(()=>(Ze(e,t,1),Zl()))),n,((l,n,s)=>ze(e,t,l,n,s)),((n,r)=>Ue(e,l,t,n,r,s))),ze=(e,l,t,n,s)=>{Wl(t,n)||_e(e,l,n,1);const r=et(t,n);s!==r&&(el(e,l,n,r,s),tt(t,n,s))},$e=(e,l,t,n,s)=>O(et(l,t),(l=>ze(e,t,l,n,s)),(()=>je(e,l,t,Oe({[n]:s},e,t)))),Ae=e=>ne(e)?El():Tl(e),De=e=>st(K,e,((e,l,t)=>Be(l,t)),((e,l)=>Xe(l))),Be=(e,l)=>{Wl(K,e)||ll(e,1);const t=et(K,e);l!==t&&(tl(e,t,l),tt(K,e,l))},Qe=(e,l)=>{const[t]=et(F,e),n=t(l);return Wl(et(G,e),n)?Qe(e,l):n},We=e=>{var l;return null!=(l=et(G,e))?l:Me(e,{})},Ge=e=>Me(e,{}),Ke=(e,l,t)=>{const[,n]=et(F,e);n(t),je(e,l,t,{},!0)},Ue=(e,l,t,n,s,r)=>{var o;const a=et(null==(o=et(j,e))?void 0:o[0],s);if(!R(a)&&!r)return ze(e,t,n,s,a);const i=l=>{el(e,t,l,et(n,l)),_e(e,t,l,-1),tt(n,l)};R(a)?i(s):lt(n,i),Gl(n)&&(Ze(e,t,-1),Gl(tt(l,t))&&(Ye(e,-1),tt(G,e),tt(F,e),tt(B,e)))},Xe=e=>{const l=et($,e);if(!R(l))return Be(e,l);tl(e,et(K,e)),ll(e,-1),tt(K,e)},Ye=(e,l)=>Rt(a,e,l),Ze=(e,l,t)=>Rt(nt(x,e,Zl),l,t)&&tt(C,e,nt(C,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=et(B,e),o=null!=(s=et(r,t))?s:0;(0==o&&1==n||1==o&&-1==n)&&Rt(nt(d,e,Zl),t,n),tt(r,t,o!=-n?o+n:null),Rt(nt(nt(S,e,Zl),l,Zl),t,n)},el=(e,l,t,n,s)=>nt(nt(nt(T,e,Zl),l,Zl),t,(()=>[n,0]))[1]=s,ll=(e,l)=>Rt(V,e,l),tl=(e,l,t)=>nt(N,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(W(nt(nt(nt(E,e,Zl),l,Zl),t,(()=>[])),n),s),sl=(e,l,t)=>(W(nt(L,e,(()=>[])),l),t),rl=(e,l,t)=>O(et(et(et(T,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...Ct(wl(e,l,t))])),ol=e=>O(et(N,e),(([e,l])=>[!0,e,l]),(()=>[!1,...Ct(kl(e))])),al=e=>Gl(E)||Gl(he[e])?0:Xl(e?dt(E):E,((l,t)=>Xl(l,((l,n)=>Xl(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Gl(L)||Gl(me[e])?0:Xl(e?it(L):L,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Gl(l))return ye(e,t,(()=>rt(l))),1},dl=e=>{const l=Gl(ie[e]),t=Gl(de[e])&&Gl(_[e])&&Gl(oe[e])&&Gl(ae[e])&&l&&Gl(X[e]),n=Gl(ce[e])&&Gl(ue[e])&&Gl(Z[e])&&Gl(U[e]);if(!t||!n){const s=e?[it(a),ut(d),it(C),ut(x),dt(S),dt(T)]:[a,d,C,x,S,T];if(!t){ul(X[e],s[0]),Xl(s[1],((l,t)=>ul(_[e],l,[t]))),Xl(s[2],((l,t)=>{0!=l&&ye(oe[e],[t],gl(t))}));const t=It();Xl(s[3],((n,s)=>{ul(ae[e],n,[s])&&!l&&(ye(ie[e],[s,null]),ft(t,s))})),l||Xl(s[5],((l,n)=>{if(!Wl(t,n)){const t=It();Xl(l,(e=>Xl(e,(([l,n],s)=>n!==l?ft(t,s):Yl(e,s))))),Xl(t,(l=>ye(ie[e],[n,l])))}})),Xl(s[4],((l,t)=>Xl(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Xl(s[5],((t,n)=>{let s;Xl(t,((t,r)=>{let o;Xl(t,(([t,a],i)=>{a!==t&&(ye(ce[e],[n,r,i],a,t,rl),l=s=o=1)})),o&&ye(ue[e],[n,r],rl)})),s&&ye(Z[e],[n],rl)})),l&&ye(U[e],void 0,rl)}}},cl=e=>{const l=Gl(pe[e]),t=Gl(ve[e])&&Gl(be[e]);if(!l||!t){const n=e?[it(V),it(N)]:[V,N];if(l||ul(pe[e],n[0]),!t){let l;Xl(n[1],(([t,n],s)=>{n!==t&&(ye(ve[e],[s],n,t,ol),l=1)})),l&&ye(be[e],void 0,ol)}}},hl=(e,...l)=>(jl((()=>e(...H(l,k)))),Al),ml=()=>[rt(T,((e,l)=>-1===et(a,l)?null:rt(e,((e,t)=>-1===et(et(x,l),t)?null:rt(e,(([,e])=>null!=e?e:null),((e,l)=>Tt(l)))),ne)),ne),rt(N,(([,e])=>null!=e?e:null),((e,l)=>Tt(l)))],bl=()=>({cellsTouched:t,valuesTouched:s,changedCells:at(T,St,Tt),invalidCells:at(E),changedValues:rt(N,St,Tt),invalidValues:rt(L),changedTableIds:rt(a),changedRowIds:ot(x),changedCellIds:at(S),changedValueIds:rt(V)}),pl=()=>at(G),vl=()=>_l(G),gl=e=>Hl(et(G,k(e))),Il=e=>_l(et(G,k(e))),fl=(e,l,t,n=0,s)=>{return H(Q((o=et(G,k(e)),a=(e,t)=>[R(l)?t:et(e,k(l)),t],r=([e],[l])=>{return((null!=(n=e)?n:0)<(null!=(s=l)?s:0)?-1:1)*(t?-1:1);var n,s},H([...null!=(i=null==o?void 0:o.entries())?i:[]],(([e,l])=>a(l,e))).sort(r)),n,R(s)?s:n+s),(([,e])=>e));var r,o,a,i},yl=(e,l)=>_l(et(et(G,k(e)),k(l))),wl=(e,l,t)=>et(et(et(G,k(e)),k(l)),k(t)),Cl=()=>rt(K),xl=()=>_l(K),kl=e=>et(K,k(e)),Sl=e=>hl((()=>(e=>Vt(e,ke,nl))(e)?Le(e):0)),Tl=e=>hl((()=>Ve(e)?De(e):0)),Vl=e=>{try{Ee(re(e))}catch(e){}return Al},Rl=l=>hl((()=>{if((e=Vt(l,(e=>Vt(e,xe))))&&(Pe(l),!Gl(G))){const e=pl();ql(),Sl(e)}})),Ol=e=>hl((()=>{if(l=(e=>Vt(e,xe))(e)){const t=Cl();Ml(),El(),l=!0,Ne(e),Tl(t)}})),ql=()=>hl((()=>Le({}))),Pl=e=>hl((e=>Wl(G,e)?Ge(e):0),e),Nl=(e,l)=>hl(((e,l)=>O(et(G,e),(t=>Wl(t,l)?Ke(e,t,l):0))),e,l),El=()=>hl((()=>De({}))),Ll=()=>hl((()=>{Pe({}),e=!1})),Ml=()=>hl((()=>{Ne({}),l=!1})),jl=(e,l)=>{if(-1!=r){zl();const t=e();return $l(l),t}},zl=()=>(-1!=r&&r++,1==r&&ye(ge,void 0,ml,bl),Al),$l=e=>(r>0&&(r--,0==r&&(t=!Gl(T),s=!Gl(N),r=1,al(1),t&&dl(1),il(1),s&&cl(1),(null==e?void 0:e(ml,bl))&&(Xl(T,((e,l)=>Xl(e,((e,t)=>Xl(e,(([e],n)=>Je(Al,l,t,n,e))))))),Xl(N,(([e],l)=>He(Al,l,e))),t=s=!1),ye(Ie[0],void 0,ml,bl),r=-1,al(0),t&&dl(0),il(0),s&&cl(0),ye(Ie[1],void 0,ml,bl),r=0,t=s=!1,J([a,d,C,x,S,T,E,V,N,L],Ul))),Al),Al={getContent:()=>[pl(),Cl()],getTables:pl,getTableIds:vl,getTable:e=>ot(et(G,k(e))),getTableCellIds:e=>_l(et(B,k(e))),getRowCount:gl,getRowIds:Il,getSortedRowIds:fl,getRow:(e,l)=>rt(et(et(G,k(e)),k(l))),getCellIds:yl,getCell:wl,getValues:Cl,getValueIds:xl,getValue:kl,hasTables:()=>!Gl(G),hasTable:e=>Wl(G,k(e)),hasTableCell:(e,l)=>Wl(et(B,k(e)),k(l)),hasRow:(e,l)=>Wl(et(G,k(e)),k(l)),hasCell:(e,l,t)=>Wl(et(et(G,k(e)),k(l)),k(t)),hasValues:()=>!Gl(K),hasValue:e=>Wl(K,k(e)),getTablesJson:()=>se(G),getValuesJson:()=>se(K),getJson:()=>se([G,K]),getTablesSchemaJson:()=>se(M),getValuesSchemaJson:()=>se(z),getSchemaJson:()=>se([M,z]),hasTablesSchema:()=>e,hasValuesSchema:()=>l,setContent:([e,l])=>hl((()=>{(ne(e)?ql:Sl)(e),(ne(l)?El:Tl)(l)})),setTables:Sl,setTable:(e,l)=>hl((e=>ke(l,e)?Me(e,l):0),e),setRow:(e,l,t)=>hl(((e,l)=>Se(e,l,t)?je(e,We(e),l,t):0),e,l),addRow:(e,l,t=!0)=>jl((()=>{let n;return Se(e,n,l)&&(e=k(e),je(e,We(e),n=Qe(e,t?1:0),l)),n})),setPartialRow:(e,l,t)=>hl(((e,l)=>{if(Se(e,l,t,1)){const n=We(e);te(t,((t,s)=>$e(e,n,l,s,t)))}}),e,l),setCell:(e,l,t,n)=>hl(((e,l,t)=>O(Te(e,l,t,P(n)?n(wl(e,l,t)):n),(n=>$e(e,We(e),l,t,n)))),e,l,t),setValues:Tl,setPartialValues:e=>hl((()=>Ve(e,1)?te(e,((e,l)=>Be(l,e))):0)),setValue:(e,l)=>hl((e=>O(Re(e,P(l)?l(kl(e)):l),(l=>Be(e,l)))),e),setTransactionChanges:e=>hl((()=>{te(e[0],((e,l)=>R(e)?Pl(l):te(e,((e,t)=>R(e)?Nl(l,t):te(e,((e,n)=>Je(Al,l,t,n,e))))))),te(e[1],((e,l)=>He(Al,l,e)))})),setTablesJson:Vl,setValuesJson:e=>{try{Ae(re(e))}catch(e){}return Al},setJson:e=>{try{const[l,t]=re(e);Ee(l),Ae(t)}catch(l){Vl(e)}return Al},setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Pl,delRow:Nl,delCell:(e,l,t,n)=>hl(((e,l,t)=>O(et(G,e),(s=>O(et(s,l),(r=>Wl(r,t)?Ue(e,s,l,r,t,n):0))))),e,l,t),delValues:El,delValue:e=>hl((e=>Wl(K,e)?Xe(e):0),e),delTablesSchema:Ll,delValuesSchema:Ml,delSchema:()=>hl((()=>{Ll(),Ml()})),transaction:jl,startTransaction:zl,finishTransaction:$l,forEachTable:e=>Xl(G,((l,t)=>e(t,(e=>Xl(l,((l,t)=>e(t,(e=>lt(l,e))))))))),forEachTableCell:(e,l)=>lt(et(B,k(e)),l),forEachRow:(e,l)=>Xl(et(G,k(e)),((e,t)=>l(t,(l=>lt(e,l))))),forEachCell:(e,l,t)=>lt(et(et(G,k(e)),k(l)),t),forEachValue:e=>lt(K,e),addSortedRowIdsListener:(e,l,t,n,s,r,o)=>{let a=fl(e,l,t,n,s);return fe((()=>{const o=fl(e,l,t,n,s);var i,u,d;u=a,D(i=o)===D(u)&&(d=(e,l)=>u[l]===e,i.every(d))||(a=o,r(Al,e,l,t,n,s,a))}),ie[o?1:0],[e,l],[vl])},addStartTransactionListener:e=>fe(e,ge),addWillFinishTransactionListener:e=>fe(e,Ie[0]),addDidFinishTransactionListener:e=>fe(e,Ie[1]),callListener:e=>(Ce(e),Al),delListener:e=>(we(e),Al),getListenerStats:()=>({tables:xt(U),tableIds:xt(X),tableCellIds:xt(_),table:xt(Z),rowCount:xt(oe),rowIds:xt(ae),sortedRowIds:xt(ie),row:xt(ue,Bl),cellIds:xt(de,Bl),cell:xt(ce,Ql),invalidCell:xt(he,Ql),values:xt(be),valueIds:xt(pe),value:xt(ve),invalidValue:xt(me),transaction:Dl(ge)+xt(Ie)}),createStore:Ot,addListener:fe,callListeners:ye};return te({[h]:[0,U],[m]:[0,X],[c]:[1,Z,[vl]],[c+I]:[1,_,[vl]],[p]:[1,oe,[vl]],[v]:[1,ae,[vl]],[b]:[2,ue,[vl,Il]],[I]:[2,de,[vl,Il]],[g]:[3,ce,[vl,Il,yl],e=>Ct(wl(...e))],InvalidCell:[3,he],[y]:[0,be],[w]:[0,pe],[f]:[1,ve,[xl],e=>Ct(kl(e[0]))],InvalidValue:[1,me]},(([e,l,t,n],s)=>{Al["add"+s+"Listener"]=(...s)=>fe(s[e],l[s[e+1]?1:0],e>0?Q(s,0,e):void 0,t,n)})),Y(Al)},qt=({position:e="right",open:t=!1})=>{const n=l.useCreateStore(Ot),s=ie.indexOf(e);return l.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,o=[])=>{let a,i,u,d=0,c=0,h=0,m=0;nt(mt,o,(()=>0)),nt(bt,o,(()=>[]));const b=e=>ht(void 0,null,(function*(){return 2!=d&&(d=1,c++,yield p.schedule((()=>ht(void 0,null,(function*(){yield e(),d=0}))))),p})),p={load:(t,n)=>ht(void 0,null,(function*(){return yield b((()=>ht(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>ht(void 0,[...t],(function*(t={},s={}){return p.stopAutoLoad(),yield p.load(t,s),m=1,u=n(((t,n)=>ht(void 0,null,(function*(){if(n){const l=n();yield b((()=>ht(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield b((()=>ht(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),p})),stopAutoLoad:()=>(m&&(s(u),u=void 0,m=0),p),save:l=>ht(void 0,null,(function*(){return 1!=d&&(d=2,h++,yield p.schedule((()=>ht(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}d=0}))))),p})),startAutoSave:()=>ht(void 0,null,(function*(){return yield p.stopAutoSave().save(),a=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();ne(t)&&ne(n)||p.save((()=>[t,n]))})),p})),stopAutoSave:()=>(O(a,e.delListener),p),schedule:(...e)=>ht(void 0,null,(function*(){return W(et(bt,o),...e),yield ht(void 0,null,(function*(){if(!et(mt,o)){for(tt(mt,o,1);!R(i=G(et(bt,o)));)try{yield i()}catch(e){null==r||r(e)}tt(mt,o,0)}})),p})),getStore:()=>e,destroy:()=>p.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return Y(p)})(e,(()=>pt(void 0,null,(function*(){return re(t.getItem(l))}))),(e=>pt(void 0,null,(function*(){return t.setItem(l,se(e()))}))),(e=>{const n=n=>{n.storageArea===t&&n.key===l&&e((()=>re(n.newValue)))};return gt.addEventListener(vt,n),n}),(e=>gt.removeEventListener(vt,e)),n))(e,oe,sessionStorage,l);var l}),void 0,(e=>{return l=function*(){yield e.load(void 0,{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=l=>l.done?e(l.value):Promise.resolve(l.value).then(n,s);r((l=l.apply(void 0,null)).next())}));var l})),M(L,null,M("aside",{id:oe},M($e,{s:n}),M(Fl,{s:n})),M("style",null,ze))};var Pt=Object.defineProperty,Nt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable,Mt=(e,l,t)=>l in e?Pt(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;exports.EditableCellView=yl,exports.EditableValueView=wl,exports.RelationshipInHtmlTable=Il,exports.ResultSortedTableInHtmlTable=fl,exports.ResultTableInHtmlTable=e=>{var t=e,{queryId:n,queries:s,customCells:r}=t,o=_e(t,["queryId","queries","customCells"]);return M(cl,Ze(Ye({},o),{params:ol(dl(l.useResultTableCellIds(n,s),r,l.ResultCellView),il(s,n),l.useResultRowIds(n,s))}))},exports.SliceInHtmlTable=gl,exports.SortedTableInHtmlTable=pl,exports.SortedTablePaginator=Cl,exports.StoreInspector=e=>M(qt,((e,l)=>{for(var t in l||(l={}))Et.call(l,t)&&Mt(e,t,l[t]);if(Nt)for(var t of Nt(l))Lt.call(l,t)&&Mt(e,t,l[t]);return e})({},e)),exports.TableInHtmlTable=e=>{var t=e,{tableId:n,store:s,editable:r,customCells:o}=t,a=_e(t,["tableId","store","editable","customCells"]);return M(cl,Ze(Ye({},a),{params:ol(dl(l.useTableCellIds(n,s),o,r?yl:l.CellView),al(s,n),l.useRowIds(n,s))}))},exports.ValuesInHtmlTable=vl;
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("./ui-react");const l=e=>typeof e,r=l(""),a=l(!0),o=l(0),n="Value",s="currentTarget",i="value",d=isFinite,u=e=>null==e,{createElement:c,Fragment:m,useCallback:h,useLayoutEffect:b,useRef:p,useState:g}=e,f=(e,...t)=>u(e)?{}:e(...t),w=(e,t)=>e.map(t),v=Object,I=(e=[])=>v.fromEntries(e),y=(e,t)=>w(v.entries(e),(([e,l])=>t(l,e))),C="tinybaseStoreInspector",x="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",k='content:url("',O=k+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",R='</svg>")',S=k+"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\")",T=w([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,r])=>O+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+R)),N=O+"<path d='M20 20l60 60M20 80l60-60' />"+R,V=O+`<path d='${x}' />`+R,z=O+`<path d='${x}M20 20l60 60' />`+R;var j=Object.defineProperty,P=Object.defineProperties,$=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,H=(e,t,l)=>t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,B=(e,t)=>{for(var l in t||(t={}))M.call(t,l)&&H(e,l,t[l]);if(q)for(var l of q(t))E.call(t,l)&&H(e,l,t[l]);return e},F=(e,t)=>P(e,$(t));const A="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(y(F(B(F(B(F(B({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[A]:"width:0.5rem;height:0.5rem;",[A+"-track"]:"background:#111",[A+"-thumb"]:"background:#999;border:1px solid #111",[A+"-thumb:hover"]:"background:#fff",[A+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+S},I(w(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),I(w(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":S,"header>img:nth-of-type(6)":N}),I(w(T,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":V,"details[open]>summary img.done":z,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${C} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left"}),((e,t)=>e?`#${C} ${t}{${e}}`:"")));const D=(e,t,l,a)=>e==r?t:e==o?l:a;var L=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,W=(e,t,l)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,X=(e,t)=>{for(var l in t||(t={}))Q.call(t,l)&&W(e,l,t[l]);if(K)for(var l of K(t))U.call(t,l)&&W(e,l,t[l]);return e},Y=(e,t)=>G(e,J(t)),Z=(e,t)=>{var l={};for(var r in e)Q.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&K)for(var r of K(e))t.indexOf(r)<0&&U.call(e,r)&&(l[r]=e[r]);return l};const{useCallback:_,useMemo:ee,useState:te}=e,le="editable",re=(e,l)=>w(t.useTableCellIds(e,l),(t=>e+"."+t)),ae=(e,t,l)=>{const r=_(e,t);return l?r:void 0},oe=(...e)=>ee((()=>e),e),ne=(e,t)=>ee((()=>({store:e,tableId:t})),[e,t]),se=(e,t)=>ee((()=>({queries:e,queryId:t})),[e,t]),ie=(e,t=!1,l,r=0,a,o,n,s)=>{const[[i,d,u],m]=te([e,t,r]),h=_((e=>{m(e),null==s||s(e)}),[s]),b=ae((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),p=_((e=>h([i,d,e])),[h,i,d]),g=!0===n?ge:n;return[[i,d,u],b,ee((()=>!1===n?null:c(g,{offset:u,limit:a,total:o,onChange:p})),[n,g,u,a,o,p])]},de=(e,t,a)=>ee((()=>{const o=null!=t?t:e;return I(y(Array.isArray(o)?I(w(o,(e=>[e,e]))):o,((e,t)=>{return[t,X(X({},{label:t,component:a}),(o=e,l(o)==r?{label:e}:e))];var o})))}),[t,a,e]),ue=({className:e,headerRow:t,idColumn:l,params:[r,a,o,n,s,i]})=>c("table",{className:e},i?c("caption",null,i):null,!1===t?null:c("thead",null,c("tr",null,!1===l?null:c(ce,{sort:null!=n?n:[],label:"Id",onClick:s}),y(r,(({label:e},t)=>c(ce,{key:t,cellId:t,label:e,sort:null!=n?n:[],onClick:s}))))),c("tbody",null,w(o,(e=>c("tr",{key:e},!1===l?null:c("th",null,e),y(r,(({component:t,getComponentProps:l},r)=>c("td",{key:r},c(t,Y(X(X({},f(l,e,r)),a),{rowId:e,cellId:r})))))))))),ce=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:a})=>c("th",{onClick:ae((()=>null==a?void 0:a(e)),[a,e],a),className:u(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},u(l)||t!=e?null:(l?"↓":"↑")+" ",r),me=({localRowId:l,params:[r,a,o,n,s,i,d]})=>{const m=t.useRemoteRowId(s,l,i);return c("tr",null,!1===r?null:c(e.Fragment,null,c("th",null,l),c("th",null,m)),y(a,(({component:e,getComponentProps:t},r)=>{const[a,s]=r.split(".",2),i=a===o?l:a===n?m:null;return u(i)?null:c("td",{key:r},c(e,Y(X({},f(t,i,s)),{store:d,tableId:a,rowId:i,cellId:s})))})))},he=({thing:e,onThingChange:t,className:n,hasSchema:u})=>{const[m,h]=te(),[b,p]=te(),[g,f]=te(),[w,v]=te(),[I,y]=te();b!==e&&(h((e=>{const t=l(e);return(e=>e==r||e==a)(t)||t==o&&d(e)?t:void 0})(e)),p(e),f(e+""),v(Number(e)||0),y(!!e));const C=_(((e,l)=>{l(e),p(e),t(e)}),[t]);return c("div",{className:n},c("button",{className:m,onClick:_((()=>{if(!(null==u?void 0:u())){const e=D(m,o,a,r),l=D(e,g,w,I);h(e),p(l),t(l)}}),[u,t,g,w,I,m])},m),D(m,c("input",{key:m,value:g,onChange:_((e=>C(e[s][i]+"",f)),[C])}),c("input",{key:m,type:"number",value:w,onChange:_((e=>C(Number(e[s][i]||0),v)),[C])}),c("input",{key:m,type:"checkbox",checked:I,onChange:_((e=>C(!!e[s].checked,y)),[C])})))},be=({tableId:e,rowId:l,cellId:r,store:a,className:o})=>{var n;return c(he,{thing:t.useCell(e,l,r,a),onThingChange:t.useSetCellCallback(e,l,r,(e=>e),[],a),className:null!=o?o:le+"Cell",hasSchema:null==(n=t.useStoreOrStoreById(a))?void 0:n.hasTablesSchema})},pe=({valueId:e,store:l,className:r})=>{var a;return c(he,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=r?r:le+n,hasSchema:null==(a=t.useStoreOrStoreById(l))?void 0:a.hasValuesSchema})},ge=({onChange:t,total:l,offset:r=0,limit:a=l,singular:o="row",plural:n=o+"s"})=>{(r>l||r<0)&&(r=0,t(0));const s=ae((()=>t(r-a)),[t,r,a],r>0),i=ae((()=>t(r+a)),[t,r,a],r+a<l);return c(e.Fragment,null,l>a&&c(e.Fragment,null,c("button",{className:"previous",disabled:0==r,onClick:s},"←"),c("button",{className:"next",disabled:r+a>=l,onClick:i},"→"),r+1," to ",Math.min(l,r+a)," of "),l," ",1!=l?n:o)},fe=e=>new Map(e);fe(),fe(),exports.EditableCellView=be,exports.EditableValueView=pe,exports.RelationshipInHtmlTable=({relationshipId:l,relationships:r,editable:a,customCells:o,className:n,headerRow:s,idColumn:i=!0})=>{const[d,u,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(r),l),b=de([...re(m,u),...re(h,u)],o,a?be:t.CellView),p=oe(i,b,m,h,l,d,u);return c("table",{className:n},!1===s?null:c("thead",null,c("tr",null,!1===i?null:c(e.Fragment,null,c("th",null,m,".Id"),c("th",null,h,".Id")),y(b,(({label:e},t)=>c("th",{key:t},e))))),c("tbody",null,w(t.useRowIds(m,u),(e=>c(me,{key:e,localRowId:e,params:p})))))},exports.ResultSortedTableInHtmlTable=e=>{var l=e,{queryId:r,cellId:a,descending:o,offset:n,limit:s,queries:i,sortOnClick:d,paginator:u=!1,customCells:m,onChange:h}=l,b=Z(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,g,f]=ie(a,o,d,n,s,t.useResultRowCount(r,i),u,h);return c(ue,Y(X({},b),{params:oe(de(t.useResultTableCellIds(r,i),m,t.ResultCellView),se(i,r),t.useResultSortedRowIds(r,...p,s,i),p,g,f)}))},exports.ResultTableInHtmlTable=e=>{var l=e,{queryId:r,queries:a,customCells:o}=l,n=Z(l,["queryId","queries","customCells"]);return c(ue,Y(X({},n),{params:oe(de(t.useResultTableCellIds(r,a),o,t.ResultCellView),se(a,r),t.useResultRowIds(r,a))}))},exports.SliceInHtmlTable=e=>{var l=e,{indexId:r,sliceId:a,indexes:o,editable:n,customCells:s}=l,i=Z(l,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(t.useIndexesOrIndexesById(o),r);return c(ue,Y(X({},i),{params:oe(de(t.useTableCellIds(m,u),s,n?be:t.CellView),ne(u,m),t.useSliceRowIds(r,a,d))}))},exports.SortedTableInHtmlTable=e=>{var l=e,{tableId:r,cellId:a,descending:o,offset:n,limit:s,store:i,editable:d,sortOnClick:u,paginator:m=!1,onChange:h,customCells:b}=l,p=Z(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,w]=ie(a,o,u,n,s,t.useRowCount(r,i),m,h);return c(ue,Y(X({},p),{params:oe(de(t.useTableCellIds(r,i),b,d?be:t.CellView),ne(i,r),t.useSortedRowIds(r,...g,s,i),g,f,w)}))},exports.SortedTablePaginator=ge,exports.StoreInspector=e=>null,exports.TableInHtmlTable=e=>{var l=e,{tableId:r,store:a,editable:o,customCells:n}=l,s=Z(l,["tableId","store","editable","customCells"]);return c(ue,Y(X({},s),{params:oe(de(t.useTableCellIds(r,a),n,o?be:t.CellView),ne(a,r),t.useRowIds(r,a))}))},exports.ValuesInHtmlTable=({store:e,editable:l=!1,valueComponent:r=(l?pe:t.ValueView),getValueComponentProps:a,className:o,headerRow:s,idColumn:i})=>c("table",{className:o},!1===s?null:c("thead",null,c("tr",null,!1===i?null:c("th",null,"Id"),c("th",null,n))),c("tbody",null,w(t.useValueIds(e),(t=>c("tr",{key:t},!1===i?null:c("th",null,t),c("td",null,c(r,Y(X({},f(a,t)),{valueId:t,store:e}))))))));
1
+ "use strict";var e=require("react"),t=require("./ui-react");const l=e=>typeof e,r=l(""),o=l(!0),a=l(0),n="Value",s="currentTarget",i="value",d=isFinite,u=e=>null==e,{PureComponent:c,Fragment:m,createElement:h,useCallback:b,useLayoutEffect:p,useRef:g,useState:f}=e,w=(e,...t)=>u(e)?{}:e(...t),v=(e,t)=>e.map(t),I=Object,y=(e=[])=>I.fromEntries(e),C=(e,t)=>v(I.entries(e),(([e,l])=>t(l,e))),x="tinybaseStoreInspector",k="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",O='content:url("',R=O+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",S='</svg>")',T=O+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",N=v([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,r])=>R+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+S)),V=R+"<path d='M20 20l60 60M20 80l60-60' />"+S,P=R+`<path d='${k}' />`+S,j=R+`<path d='${k}M20 20l60 60' />`+S;var z=Object.defineProperty,$=Object.defineProperties,q=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,H=(e,t,l)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,B=(e,t)=>{for(var l in t||(t={}))E.call(t,l)&&H(e,l,t[l]);if(M)for(var l of M(t))F.call(t,l)&&H(e,l,t[l]);return e},D=(e,t)=>$(e,q(t));const A="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(C(D(B(D(B(D(B({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[A]:"width:0.5rem;height:0.5rem;",[A+"-track"]:"background:#111",[A+"-thumb"]:"background:#999;border:1px solid #111",[A+"-thumb:hover"]:"background:#fff",[A+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+T},y(v(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),y(v(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":T,"header>img:nth-of-type(6)":V}),y(v(N,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":P,"details[open]>summary img.done":j,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${x} 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?`#${x} ${t}{${e}}`:"")));const L=(e,t,l,o)=>e==r?t:e==a?l:o;var G=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,X=(e,t,l)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Y=(e,t)=>{for(var l in t||(t={}))U.call(t,l)&&X(e,l,t[l]);if(Q)for(var l of Q(t))W.call(t,l)&&X(e,l,t[l]);return e},Z=(e,t)=>J(e,K(t)),_=(e,t)=>{var l={};for(var r in e)U.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&Q)for(var r of Q(e))t.indexOf(r)<0&&W.call(e,r)&&(l[r]=e[r]);return l};const{useCallback:ee,useMemo:te,useState:le}=e,re="editable",oe=(e,l)=>v(t.useTableCellIds(e,l),(t=>e+"."+t)),ae=(e,t,l)=>{const r=ee(e,t);return l?r:void 0},ne=(...e)=>te((()=>e),e),se=(e,t)=>te((()=>({store:e,tableId:t})),[e,t]),ie=(e,t)=>te((()=>({queries:e,queryId:t})),[e,t]),de=(e,t=!1,l,r=0,o,a,n,s)=>{const[[i,d,u],c]=le([e,t,r]),m=ee((e=>{c(e),null==s||s(e)}),[s]),b=ae((e=>m([e,e==i&&!d,u])),[m,i,d,u],l),p=ee((e=>m([i,d,e])),[m,i,d]),g=!0===n?fe:n;return[[i,d,u],b,te((()=>!1===n?null:h(g,{offset:u,limit:o,total:a,onChange:p})),[n,g,u,o,a,p])]},ue=(e,t,o)=>te((()=>{const a=null!=t?t:e;return y(C(Array.isArray(a)?y(v(a,(e=>[e,e]))):a,((e,t)=>{return[t,Y(Y({},{label:t,component:o}),(a=e,l(a)==r?{label:e}:e))];var a})))}),[t,o,e]),ce=({className:e,headerRow:t,idColumn:l,params:[r,o,a,n,s,i]})=>h("table",{className:e},i?h("caption",null,i):null,!1===t?null:h("thead",null,h("tr",null,!1===l?null:h(me,{sort:null!=n?n:[],label:"Id",onClick:s}),C(r,(({label:e},t)=>h(me,{key:t,cellId:t,label:e,sort:null!=n?n:[],onClick:s}))))),h("tbody",null,v(a,(e=>h("tr",{key:e},!1===l?null:h("th",null,e),C(r,(({component:t,getComponentProps:l},r)=>h("td",{key:r},h(t,Z(Y(Y({},w(l,e,r)),o),{rowId:e,cellId:r})))))))))),me=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:o})=>h("th",{onClick:ae((()=>null==o?void 0:o(e)),[o,e],o),className:u(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},u(l)||t!=e?null:(l?"↓":"↑")+" ",r),he=({localRowId:l,params:[r,o,a,n,s,i,d]})=>{const c=t.useRemoteRowId(s,l,i);return h("tr",null,!1===r?null:h(e.Fragment,null,h("th",null,l),h("th",null,c)),C(o,(({component:e,getComponentProps:t},r)=>{const[o,s]=r.split(".",2),i=o===a?l:o===n?c:null;return u(i)?null:h("td",{key:r},h(e,Z(Y({},w(t,i,s)),{store:d,tableId:o,rowId:i,cellId:s})))})))},be=({thing:e,onThingChange:t,className:n,hasSchema:u})=>{const[c,m]=le(),[b,p]=le(),[g,f]=le(),[w,v]=le(),[I,y]=le();b!==e&&(m((e=>{const t=l(e);return(e=>e==r||e==o)(t)||t==a&&d(e)?t:void 0})(e)),p(e),f(e+""),v(Number(e)||0),y(!!e));const C=ee(((e,l)=>{l(e),p(e),t(e)}),[t]);return h("div",{className:n},h("button",{className:c,onClick:ee((()=>{if(!(null==u?void 0:u())){const e=L(c,a,o,r),l=L(e,g,w,I);m(e),p(l),t(l)}}),[u,t,g,w,I,c])},c),L(c,h("input",{key:c,value:g,onChange:ee((e=>C(e[s][i]+"",f)),[C])}),h("input",{key:c,type:"number",value:w,onChange:ee((e=>C(Number(e[s][i]||0),v)),[C])}),h("input",{key:c,type:"checkbox",checked:I,onChange:ee((e=>C(!!e[s].checked,y)),[C])})))},pe=({tableId:e,rowId:l,cellId:r,store:o,className:a})=>{var n;return h(be,{thing:t.useCell(e,l,r,o),onThingChange:t.useSetCellCallback(e,l,r,(e=>e),[],o),className:null!=a?a:re+"Cell",hasSchema:null==(n=t.useStoreOrStoreById(o))?void 0:n.hasTablesSchema})},ge=({valueId:e,store:l,className:r})=>{var o;return h(be,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=r?r:re+n,hasSchema:null==(o=t.useStoreOrStoreById(l))?void 0:o.hasValuesSchema})},fe=({onChange:t,total:l,offset:r=0,limit:o=l,singular:a="row",plural:n=a+"s"})=>{(r>l||r<0)&&(r=0,t(0));const s=ae((()=>t(r-o)),[t,r,o],r>0),i=ae((()=>t(r+o)),[t,r,o],r+o<l);return h(e.Fragment,null,l>o&&h(e.Fragment,null,h("button",{className:"previous",disabled:0==r,onClick:s},"←"),h("button",{className:"next",disabled:r+o>=l,onClick:i},"→"),r+1," to ",Math.min(l,r+o)," of "),l," ",1!=l?n:a)};var we=Object.defineProperty,ve=(e,t,l)=>(((e,t,l)=>{t in e?we(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l})(e,"symbol"!=typeof t?t+"":t,l),l);ve(class extends c{constructor(e){super(e),ve(this,"componentDidCatch",((e,t)=>console.error(e,t.componentStack))),this.state={e:0}}render(){return this.state.e?h("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}},"getDerivedStateFromError",(()=>({e:1})));const Ie=e=>new Map(e);Ie(),Ie(),exports.EditableCellView=pe,exports.EditableValueView=ge,exports.RelationshipInHtmlTable=({relationshipId:l,relationships:r,editable:o,customCells:a,className:n,headerRow:s,idColumn:i=!0})=>{const[d,u,c,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(r),l),b=ue([...oe(c,u),...oe(m,u)],a,o?pe:t.CellView),p=ne(i,b,c,m,l,d,u);return h("table",{className:n},!1===s?null:h("thead",null,h("tr",null,!1===i?null:h(e.Fragment,null,h("th",null,c,".Id"),h("th",null,m,".Id")),C(b,(({label:e},t)=>h("th",{key:t},e))))),h("tbody",null,v(t.useRowIds(c,u),(e=>h(he,{key:e,localRowId:e,params:p})))))},exports.ResultSortedTableInHtmlTable=e=>{var l=e,{queryId:r,cellId:o,descending:a,offset:n,limit:s,queries:i,sortOnClick:d,paginator:u=!1,customCells:c,onChange:m}=l,b=_(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,g,f]=de(o,a,d,n,s,t.useResultRowCount(r,i),u,m);return h(ce,Z(Y({},b),{params:ne(ue(t.useResultTableCellIds(r,i),c,t.ResultCellView),ie(i,r),t.useResultSortedRowIds(r,...p,s,i),p,g,f)}))},exports.ResultTableInHtmlTable=e=>{var l=e,{queryId:r,queries:o,customCells:a}=l,n=_(l,["queryId","queries","customCells"]);return h(ce,Z(Y({},n),{params:ne(ue(t.useResultTableCellIds(r,o),a,t.ResultCellView),ie(o,r),t.useResultRowIds(r,o))}))},exports.SliceInHtmlTable=e=>{var l=e,{indexId:r,sliceId:o,indexes:a,editable:n,customCells:s}=l,i=_(l,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(t.useIndexesOrIndexesById(a),r);return h(ce,Z(Y({},i),{params:ne(ue(t.useTableCellIds(c,u),s,n?pe:t.CellView),se(u,c),t.useSliceRowIds(r,o,d))}))},exports.SortedTableInHtmlTable=e=>{var l=e,{tableId:r,cellId:o,descending:a,offset:n,limit:s,store:i,editable:d,sortOnClick:u,paginator:c=!1,onChange:m,customCells:b}=l,p=_(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,w]=de(o,a,u,n,s,t.useRowCount(r,i),c,m);return h(ce,Z(Y({},p),{params:ne(ue(t.useTableCellIds(r,i),b,d?pe:t.CellView),se(i,r),t.useSortedRowIds(r,...g,s,i),g,f,w)}))},exports.SortedTablePaginator=fe,exports.StoreInspector=e=>null,exports.TableInHtmlTable=e=>{var l=e,{tableId:r,store:o,editable:a,customCells:n}=l,s=_(l,["tableId","store","editable","customCells"]);return h(ce,Z(Y({},s),{params:ne(ue(t.useTableCellIds(r,o),n,a?pe:t.CellView),se(o,r),t.useRowIds(r,o))}))},exports.ValuesInHtmlTable=({store:e,editable:l=!1,valueComponent:r=(l?ge:t.ValueView),getValueComponentProps:o,className:a,headerRow:s,idColumn:i})=>h("table",{className:a},!1===s?null:h("thead",null,h("tr",null,!1===i?null:h("th",null,"Id"),h("th",null,n))),h("tbody",null,v(t.useValueIds(e),(t=>h("tr",{key:t},!1===i?null:h("th",null,t),h("td",null,h(r,Z(Y({},w(o,t)),{valueId:t,store:e}))))))));
Binary file