tinybase 4.3.17 → 4.3.19

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 (40) 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 +80 -84
  14. package/lib/debug/ui-react.js +9 -5
  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/types/ui-react.d.ts +24 -2
  22. package/lib/types/with-schemas/ui-react.d.ts +26 -2
  23. package/lib/ui-react-dom.js +1 -1
  24. package/lib/ui-react-dom.js.gz +0 -0
  25. package/lib/ui-react.js +1 -1
  26. package/lib/ui-react.js.gz +0 -0
  27. package/lib/umd/ui-react-dom-debug.js +1 -1
  28. package/lib/umd/ui-react-dom-debug.js.gz +0 -0
  29. package/lib/umd/ui-react-dom.js +1 -1
  30. package/lib/umd/ui-react-dom.js.gz +0 -0
  31. package/lib/umd/ui-react.js +1 -1
  32. package/lib/umd/ui-react.js.gz +0 -0
  33. package/lib/umd-es6/ui-react-dom-debug.js +1 -1
  34. package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
  35. package/lib/umd-es6/ui-react-dom.js +1 -1
  36. package/lib/umd-es6/ui-react-dom.js.gz +0 -0
  37. package/lib/umd-es6/ui-react.js +1 -1
  38. package/lib/umd-es6/ui-react.js.gz +0 -0
  39. package/package.json +4 -4
  40. package/readme.md +2 -2
@@ -1 +1 @@
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",w=I+u,f="Value",y=f+"s",C=f+u,v="currentTarget",k="value",T=e=>l+e,x=Math.floor,S=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),E=(e,t,s)=>e.slice(t,s),z=e=>e.length,{PureComponent:$,Fragment:O,createElement:A,useCallback:F,useLayoutEffect:J,useRef:P,useState:H}=e,B=(e,...t)=>R(e)?{}:e(...t),D=(e,t)=>e.forEach(t),Q=(e,t)=>e.map(t),j=e=>0==z(e),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)=>Q(K.entries(e),(([e,s])=>t(s,e))),le=e=>Z(e)&&0==(e=>z(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)=>Q(e.sort(),t),Ie=(e,s)=>[!!t.useCell(de,e,be,s),F((t=>{s.setCell(de,e,be,(e=>!e)),t.preventDefault()}),[s,e])],we="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'>",Ce='</svg>")',ve=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\")",ke=Q([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,s,l])=>ye+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${s}' height='${l}' fill='white'/>`+Ce)),Te=ye+"<path d='M20 20l60 60M20 80l60-60' />"+Ce,xe=ye+`<path d='${we}' />`+Ce,Se=ye+`<path d='${we}M20 20l60 60' />`+Ce,Ve="*::-webkit-scrollbar",Re=`#${re}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,t="")=>e.join(t))(se({"*":"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,..._(Q(["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;",..._(Q(["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)":Te,..._(Q(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":xe,"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,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?`& ${t}{${e}}`:"")))}`,qe=({s:e})=>{const s=t.useValue(he,e)??1,l=t.useSetValueCallback(me,(()=>!0),[],e);return t.useValue(me,e)?null:A("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 A("details",{open:o,onToggle:i},A("summary",null,s,a?A("img",{onClick:a,className:l?"done":"edit"}):null),n)},Le=e=>{const t=s(e);return N(t)||t==r&&S(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)=>Q(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:A(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)?_(Q(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]})=>A("table",{className:e},i?A("caption",null,i):null,!1===t?null:A("thead",null,A("tr",null,!1===s?null:A(Ge,{sort:r??[],label:"Id",onClick:o}),se(l,(({label:e},t)=>A(Ge,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),A("tbody",null,Q(n,(e=>A("tr",{key:e},!1===s?null:A("th",null,e),se(l,(({component:t,getComponentProps:s},l)=>A("td",{key:l},A(t,{...B(s,e,l),...a,rowId:e,cellId:l}))))))))),Ge=({cellId:e,sort:[t,s],label:a=e??l,onClick:n})=>A("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 A("tr",null,!1===l?null:A(e.Fragment,null,A("th",null,s),A("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:A("td",{key:l},A(e,{...B(t,i,o),store:d,tableId:a,rowId:i,cellId:o}))})))},Ue=({thing:e,onThingChange:t,className:s,hasSchema:l,showType:o=!0})=>{const[i,d]=Ae(),[u,c]=Ae(),[h,m]=Ae(),[b,g]=Ae(),[p,I]=Ae();u!==e&&(d(Le(e)),c(e),m(e+""),g(Number(e)||0),I(!!e));const w=$e(((e,s)=>{s(e),c(e),t(e)}),[t]),f=$e((()=>{if(!l?.()){const e=ze(i,r,n,a),s=ze(e,h,b,p);d(e),c(s),t(s)}}),[l,t,h,b,p,i]);return A("div",{className:s},o?A("button",{className:i,onClick:f},i):null,ze(i,A("input",{key:i,value:h,onChange:$e((e=>w(e[v][k]+"",m)),[w])}),A("input",{key:i,type:"number",value:b,onChange:$e((e=>w(Number(e[v][k]||0),g)),[w])}),A("input",{key:i,type:"checkbox",checked:p,onChange:$e((e=>w(!!e[v].checked,I)),[w])})))},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 A(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})=>A("table",{className:n},!1===r?null:A("thead",null,A("tr",null,!1===o?null:A("th",null,"Id"),A("th",null,f))),A("tbody",null,Q(t.useValueIds(e),(t=>A("tr",{key:t},!1===o?null:A("th",null,t),A("td",null,A(l,{...B(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 A(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 A("table",{className:r},!1===o?null:A("thead",null,A("tr",null,!1===i?null:A(e.Fragment,null,A("th",null,c,".Id"),A("th",null,h,".Id")),se(m,(({label:e},t)=>A("th",{key:t},e))))),A("tbody",null,Q(t.useRowIds(c,u),(e=>A(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 A(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,showType:r})=>A(Ue,{thing:t.useCell(e,s,l,a),onThingChange:t.useSetCellCallback(e,s,l,(e=>e),[],a),className:n??Fe+I,showType:r,hasSchema:t.useStoreOrStoreById(a)?.hasTablesSchema}),st=({valueId:e,store:s,className:l,showType:a})=>A(Ue,{thing:t.useValue(e,s),onThingChange:t.useSetValueCallback(e,(e=>e),[],s),className:l??Fe+f,showType:a,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 A(e.Fragment,null,s>a&&A(e.Fragment,null,A("button",{className:"previous",disabled:0==l,onClick:o},"←"),A("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})=>A(Ne,{uniqueId:ge("i",s,l),summary:"Index: "+l,s:a},Q(t.useSliceIds(l,e),(t=>A(nt,{indexes:e,indexesId:s,indexId:l,sliceId:t,s:a,key:t})))),nt=({indexes:e,indexesId:t,indexId:s,sliceId:l,s:a})=>{const n=ge("i",t,s,l),[r,o]=Ie(n,a);return A(Ne,{uniqueId:n,summary:"Slice: "+l,editable:r,handleEditable:o,s:a},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:A(Ne,{uniqueId:ge("i",e),summary:"Indexes: "+(e??d),s:s},j(a)?"No indexes defined":pe(a,(t=>A(at,{indexes:l,indexesId:e,indexId:t,s:s,key:t}))))},ot=({metrics:e,metricId:s})=>A("tr",null,A("th",null,s),A("td",null,e?.getTableId(s)),A("td",null,t.useMetric(s,e))),it=({metricsId:e,s:s})=>{const l=t.useMetrics(e),a=t.useMetricIds(l);return R(l)?null:A(Ne,{uniqueId:ge("m",e),summary:"Metrics: "+(e??d),s:s},j(a)?"No metrics defined":A("table",null,A("thead",null,A("th",null,"Metric Id"),A("th",null,"Table Id"),A("th",null,"Metric")),A("tbody",null,Q(a,(e=>A(ot,{metrics:l,metricId:e,key: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 A(Ne,{uniqueId:n,summary:"Query: "+l,s:a},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:A(Ne,{uniqueId:ge("q",e),summary:"Queries: "+(e??d),s:s},j(a)?"No queries defined":pe(a,(t=>A(dt,{queries:l,queriesId:e,queryId:t,s:s,key:t}))))},ct=({relationships:e,relationshipsId:t,relationshipId:s,s:l})=>{const a=ge("r",t,s),[n,r]=Ie(a,l);return A(Ne,{uniqueId:a,summary:"Relationship: "+s,editable:n,handleEditable:r,s:l},A(_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:A(Ne,{uniqueId:ge("r",e),summary:"Relationships: "+(e??d),s:s},j(a)?"No relationships defined":pe(a,(t=>A(ct,{relationships:l,relationshipsId:e,relationshipId:t,s:s,key:t}))))},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 A(Ne,{uniqueId:n,summary:c+": "+e,editable:u,handleEditable:h,s:a},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 j(t.useValueIds(e))?null:A(Ne,{uniqueId:a,summary:y,editable:n,handleEditable:r,s:l},A(Ye,{store:e,editable:n}))},gt=({storeId:e,s:s})=>{const l=t.useStore(e),a=t.useTableIds(l);return R(l)?null:A(Ne,{uniqueId:ge("s",e),summary:"Store: "+(e??d),s:s},A(bt,{storeId:e,store:l,s:s}),pe(a,(t=>A(mt,{store:l,storeId:e,tableId:t,s:s,key:t}))))},pt=({s:e})=>{const s=P(null),l=P(0),[a,n]=H(!1),{scrollLeft:r,scrollTop:o}=t.useValues(e);J((()=>{const e=s.current;if(e&&!a){const t=new MutationObserver((()=>{e.scrollWidth>=x(r)+e.clientWidth&&e.scrollHeight>=x(o)+e.clientHeight&&e.scrollTo(r,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[a,r,o]);const i=F((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(),w=t.useQueriesIds();return R(d)&&j(u)&&R(c)&&j(h)&&R(m)&&j(b)&&R(g)&&j(p)&&R(I)&&j(w)?A("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):A("article",{ref:s,onScroll:i},A(gt,{s:e}),Q(u,(t=>A(gt,{storeId:t,s:e,key:t}))),A(it,{s:e}),Q(h,(t=>A(it,{metricsId:t,s:e,key:t}))),A(rt,{s:e}),Q(b,(t=>A(rt,{indexesId:t,s:e,key:t}))),A(ht,{s:e}),Q(p,(t=>A(ht,{relationshipsId:t,s:e,key:t}))),A(ut,{s:e}),Q(w,(t=>A(ut,{queriesId:t,s:e,key:t}))))};class It extends ${constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}static{this.getDerivedStateFromError=()=>({e:1})}render(){return this.state.e?A("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const wt=({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 A("header",null,A("img",{title:oe}),A("span",null,oe),Q(ie,((e,t)=>t==s?null:A("img",{onClick:a,"data-id":t,title:"Dock to "+e,key:t}))),A("img",{onClick:l,title:"Close"}))},ft=({s:e})=>{const s=t.useValue(he,e)??1;return t.useValue(me,e)?A("main",{"data-position":s},A(wt,{s:e}),A(It,null,A(pt,{s:e}))):null},yt=e=>t=>{return s=(t,s)=>t+e(s),Vt(t).reduce(s,0);var s},Ct=e=>e?.size??0,vt=yt(Ct),kt=yt(vt),Tt=yt(kt),xt=(e,t)=>e?.has(t)??!1,St=e=>R(e)||0==Ct(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)=>(xt(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>z(t)-2?s:Lt),(n=>{if(a>z(t)-2)return l?.(n)&&$t(e,t[a]),n;const r=Qt(n,t,s,l,a+1);return St(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)&&z(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(),x=Lt(),S=Lt(),V=Lt(),M=Lt(),$=Lt(),O=Lt(),A=Lt(),F=Lt(),J=Lt(),P=Lt(),H=Ut(),B=Lt(),j=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(),we=ts(),[fe,ye,Ce,ve]=(e=>{let t;const[s,a]=Zt(),n=Lt();return[(e,a,r,o=[],i=(()=>[]))=>{t??=fs;const d=s(1);return $t(n,d,[e,a,r,o,i]),Xt(Qt(a,r??[l],Ut),d),d},(e,s,...a)=>D(((e,t=[l])=>{const s=[],a=(e,l)=>l==z(t)?W(s,e):null===t[l]?qt(e,(e=>a(e,l+1))):D([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),St(t)?1:0))),$t(n,e),a(e),s))),e=>q(Et(n,e),(([e,,s=[],l,a])=>{const n=(...r)=>{const o=z(r);o==z(s)?e(t,...r,...a(r)):R(s[o])?D(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))},Te=(t,s)=>(!e||xt(A,s)||lt(s))&&as(t,((e,t)=>xe(s,t,e)),(()=>lt(s))),xe=(e,t,s,l)=>as(l?s:qe(s,e,t),((l,a)=>q(Se(e,t,a,l),(e=>(s[a]=e,!0)),(()=>!1))),(()=>lt(e,t))),Se=(t,s,l,a)=>e?q(Et(Et(A,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(J,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(F,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(P,((t,s)=>{ee(e,s)||(e[s]=t)})),qt(H,(t=>{ee(e,t)||at(t)}))),e),ze=e=>At(A,e,((e,t,s)=>{const l=Lt(),a=Ut();At(Ot(A,t,Lt),s,((e,t,s)=>{$t(e,t,s),q(s[d],(e=>$t(l,t,e)),(()=>Xt(a,t)))})),$t(F,t,[l,a])}),((e,t)=>{$t(A,t),$t(F,t)})),$e=e=>At(J,e,((e,t,s)=>{$t(J,t,s),q(s[d],(e=>$t(P,t,e)),(()=>Xt(H,t)))}),((e,t)=>{$t(J,t),$t(P,t),Nt(H,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(B,e,Zt()),$t(j,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)=>{xt(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)=>{xt(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(B,e),l=s(t);return xt(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(B,e);l(s),Je(e,t,s,{},!0)},Ue=(e,t,s,l,a,n)=>{const r=Et(Et(F,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),St(l)&&(Ze(e,s,-1),St($t(t,s))&&(Ye(e,-1),$t(G,e),$t(B,e),$t(j,e)))},Xe=e=>{const t=Et(P,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(j,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(x,e,Lt),t,Lt),s,l)},et=(e,t,s,l,a)=>Ot(Ot(Ot(S,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,Lt),t,Lt),s,(()=>[])),l),a),at=(e,t,s)=>(W(Ot(O,e,(()=>[])),t),s),nt=(e,t,s)=>q(Et(Et(Et(S,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=>St($)||St(he[e])?0:qt(e?Dt($):$,((t,s)=>qt(t,((t,l)=>qt(t,((t,a)=>ye(he[e],[s,l,a],t))))))),it=e=>St(O)||St(me[e])?0:qt(e?Ht(O):O,((t,s)=>ye(me[e],[s],t))),dt=(e,t,s)=>{if(!St(t))return ye(e,s,(()=>Ft(t))),1},ut=e=>{const t=St(ie[e]),s=St(ue[e])&&St(_[e])&&St(re[e])&&St(oe[e])&&t&&St(X[e]),l=St(ce[e])&&St(de[e])&&St(Z[e])&&St(U[e]);if(!s||!l){const a=e?[Ht(o),Bt(u),Ht(v),Bt(k),Dt(x),Dt(S)]:[o,u,v,k,x,S];if(!s){dt(X[e],a[0]),qt(a[1],((t,s)=>dt(_[e],t,[s]))),qt(a[2],((t,s)=>{0!=t&&ye(re[e],[s],It(s))}));const s=Ut();qt(a[3],((l,a)=>{dt(oe[e],l,[a])&&!t&&(ye(ie[e],[a,null]),Xt(s,a))})),t||qt(a[5],((t,l)=>{if(!xt(s,l)){const s=Ut();qt(t,(e=>qt(e,(([t,l],a)=>l!==t?Xt(s,a):Nt(e,a))))),qt(s,(t=>ye(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&&(ye(ce[e],[l,n,i],o,s,nt),t=a=r=1)})),r&&ye(de[e],[l,n],nt)})),a&&ye(Z[e],[l],nt)})),t&&ye(U[e],void 0,nt)}}},ct=e=>{const t=St(ge[e]),s=St(pe[e])&&St(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&&(ye(pe[e],[a],l,s,rt),t=1)})),t&&ye(be[e],void 0,rt)}}},ht=(e,...t)=>(ps((()=>e(...Q(t,T)))),fs),mt=()=>[Ft(S,((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(S,ss,ls),invalidCells:Pt($),changedValues:Ft(M,ss,ls),invalidValues:Ft(O),changedTableIds:Ft(o),changedRowIds:Jt(k),changedCellIds:Pt(x),changedValueIds:Ft(V)}),gt=()=>Pt(G),pt=()=>Mt(G),It=e=>Ct(Et(G,T(e))),wt=e=>Mt(Et(G,T(e))),ft=(e,t,s,l=0,a)=>{return Q(E((r=Et(G,T(e)),o=(e,s)=>[R(t)?s:Et(e,T(t)),s],n=([e],[t])=>((e??0)<(t??0)?-1:1)*(s?-1:1),Q([...r?.entries()??[]],(([e,t])=>o(t,e))).sort(n)),l,R(a)?a:l+a),(([,e])=>e));var n,r,o},yt=(e,t)=>Mt(Et(Et(G,T(e)),T(t))),Vt=(e,t,s)=>Et(Et(Et(G,T(e)),T(t)),T(s)),jt=()=>Ft(K),Wt=()=>Mt(K),Gt=e=>Et(K,T(e)),Kt=e=>ht((()=>(e=>as(e,Te,lt))(e)?Ae(e):0)),Yt=e=>ht((()=>Ve(e)?De(e):0)),os=e=>{try{Oe(ne(e))}catch{}return fs},is=t=>ht((()=>{if((e=as(t,(e=>as(e,ke))))&&(ze(t),!St(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=>xt(G,e)?Ge(e):0),e),hs=(e,t)=>ht(((e,t)=>q(Et(G,e),(s=>xt(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 ws(t),s}},Is=()=>(-1!=n&&n++,1==n&&ye(Ie,void 0,mt,bt),fs),ws=e=>(n>0&&(n--,0==n&&(s=!St(S),a=!St(M),n=1,ot(1),s&&ut(1),it(1),a&&ct(1),e?.(mt,bt)&&(qt(S,((e,t)=>qt(e,((e,s)=>qt(e,(([e],l)=>Me(fs,t,s,l,e))))))),qt(M,(([e],t)=>Ee(fs,t,e))),s=a=!1),ye(we[0],void 0,mt,bt),n=-1,ot(0),s&&ut(0),it(0),a&&ct(0),ye(we[1],void 0,mt,bt),n=0,s=a=!1,D([o,u,v,k,x,S,$,V,M,O],Rt))),fs),fs={getContent:()=>[gt(),jt()],getTables:gt,getTableIds:pt,getTable:e=>Jt(Et(G,T(e))),getTableCellIds:e=>Mt(Et(j,T(e))),getRowCount:It,getRowIds:wt,getSortedRowIds:ft,getRow:(e,t)=>Ft(Et(Et(G,T(e)),T(t))),getCellIds:yt,getCell:Vt,getValues:jt,getValueIds:Wt,getValue:Gt,hasTables:()=>!St(G),hasTable:e=>xt(G,T(e)),hasTableCell:(e,t)=>xt(Et(j,T(e)),T(t)),hasRow:(e,t)=>xt(Et(G,T(e)),T(t)),hasCell:(e,t,s)=>xt(Et(Et(G,T(e)),T(t)),T(s)),hasValues:()=>!St(K),hasValue:e=>xt(K,T(e)),getTablesJson:()=>ae(G),getValuesJson:()=>ae(K),getJson:()=>ae([G,K]),getTablesSchemaJson:()=>ae(A),getValuesSchemaJson:()=>ae(J),getSchemaJson:()=>ae([A,J]),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=>Te(t,e)?Fe(e,t):0),e),setRow:(e,t,s)=>ht(((e,t)=>xe(e,t,s)?Je(e,We(e),t,s):0),e,t),addRow:(e,t,s=!0)=>ps((()=>{let l;return xe(e,l,t)&&(e=T(e),Je(e,We(e),l=je(e,s?1:0),t)),l})),setPartialRow:(e,t,s)=>ht(((e,t)=>{if(xe(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(Se(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(fs,t,s,l,e))))))),se(e[1],((e,t)=>Ee(fs,t,e)))})),setTablesJson:os,setValuesJson:e=>{try{Be(ne(e))}catch{}return fs},setJson:e=>ht((()=>{try{const[t,s]=ne(e);Oe(t),Be(s)}catch{os(e)}})),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=>xt(n,s)?Ue(e,a,t,n,s,l):0))))),e,t,s),delValues:ms,delValue:e=>ht((e=>xt(K,e)?Xe(e):0),e),delTablesSchema:bs,delValuesSchema:gs,delSchema:()=>ht((()=>{bs(),gs()})),transaction:ps,startTransaction:Is,finishTransaction:ws,forEachTable:e=>qt(G,((t,s)=>e(s,(e=>qt(t,((t,s)=>e(s,(e=>zt(t,e))))))))),forEachTableCell:(e,t)=>zt(Et(j,T(e)),t),forEachRow:(e,t)=>qt(Et(G,T(e)),((e,s)=>t(s,(t=>zt(e,t))))),forEachCell:(e,t,s)=>zt(Et(Et(G,T(e)),T(t)),s),forEachValue:e=>zt(K,e),addSortedRowIdsListener:(e,t,s,l,a,n,r)=>{let o=ft(e,t,s,l,a);return fe((()=>{const r=ft(e,t,s,l,a);var i,d,u;d=o,z(i=r)===z(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(o=r,n(fs,e,t,s,l,a,o))}),ie[r?1:0],[e,t],[pt])},addStartTransactionListener:e=>fe(e,Ie),addWillFinishTransactionListener:e=>fe(e,we[0]),addDidFinishTransactionListener:e=>fe(e,we[1]),callListener:e=>(ve(e),fs),delListener:e=>(Ce(e),fs),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,Tt),invalidCell:es(he,Tt),values:es(be),valueIds:es(ge),value:es(pe),invalidValue:es(me),transaction:vt(Ie)+es(we)}),createStore:rs,addListener:fe,callListeners:ye};return se({[h]:[0,U],[m]:[0,X],[c]:[1,Z,[pt]],[c+w]:[1,_,[pt]],[g]:[1,re,[pt]],[p]:[1,oe,[pt]],[b]:[2,de,[pt,wt]],[w]:[2,ue,[pt,wt]],[I]:[3,ce,[pt,wt,yt],e=>_t(Vt(...e))],InvalidCell:[3,he],[y]:[0,be],[C]:[0,ge],[f]:[1,pe,[Wt],e=>_t(Gt(e[0]))],InvalidValue:[1,me]},(([e,t,s,l],a)=>{fs["add"+a+"Listener"]=(...a)=>fe(a[e],t[a[e+1]?1:0],e>0?E(a,0,e):void 0,s,l)})),Y(fs)},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,o]=[],i=[])=>{let d,u,c,h=0,m=0,b=0,g=0;Ot(jt,i,(()=>0)),Ot(Wt,i,(()=>[]));const p=async e=>(2!=h&&(h=1,m++,await I.schedule((async()=>{await e(),h=0}))),I),I={load:async(s,l)=>await p((async()=>{try{e.setContent(await t())}catch{e.setContent([s,l])}})),startAutoLoad:async(s={},a={})=>(I.stopAutoLoad(),await I.load(s,a),g=1,c=l((async(s,l)=>{if(l){const t=l();await p((async()=>e.setTransactionChanges(t)))}else await p((async()=>{try{e.setContent(s?.()??await t())}catch(e){n?.(e)}}))})),I),stopAutoLoad:()=>(g&&(a(c),c=void 0,g=0),I),save:async t=>(1!=h&&(h=2,b++,await I.schedule((async()=>{try{await s(e.getContent,t)}catch(e){n?.(e)}h=0}))),I),startAutoSave:async()=>(await I.stopAutoSave().save(),d=e.addDidFinishTransactionListener(((e,t)=>{const[s,l]=t();le(s)&&le(l)||I.save((()=>[s,l]))})),I),stopAutoSave:()=>(q(d,e.delListener),d=void 0,I),schedule:async(...e)=>(W(Et(Wt,i),...e),await(async()=>{if(!Et(jt,i)){for($t(jt,i,1);!R(u=G(Et(Wt,i)));)try{await u()}catch(e){n?.(e)}$t(jt,i,0)}})(),I),getStore:()=>e,destroy:()=>I.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:m,saves:b})};return r&&(I[r]=()=>o),Y(I)})(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,["getStorageName",t]))(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()})),A(O,null,A("aside",{id:re},A(qe,{s:l}),A(ft,{s:l})),A("style",null,Re))};exports.EditableCellView=tt,exports.EditableValueView=st,exports.RelationshipInHtmlTable=_e,exports.ResultSortedTableInHtmlTable=et,exports.ResultTableInHtmlTable=({queryId:e,queries:s,customCells:l,...a})=>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=>A(os,{...e}),exports.TableInHtmlTable=({tableId:e,store:s,editable:l,customCells:a,...n})=>A(We,{...n,params:He(je(t.useTableCellIds(e,s),a,l?tt:t.CellView),Be(s,e),t.useRowIds(e,s))}),exports.ValuesInHtmlTable=Ye;
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",w=I+u,f="Value",y=f+"s",C=f+u,v="currentTarget",k="value",T=e=>l+e,x=Math.floor,S=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),E=(e,t,s)=>e.slice(t,s),z=e=>e.length,{PureComponent:$,Fragment:O,createElement:A,useCallback:F,useLayoutEffect:J,useRef:P,useState:H}=e,B=(e,...t)=>R(e)?{}:e(...t),D=(e,t)=>e.forEach(t),Q=(e,t)=>e.map(t),j=e=>0==z(e),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)=>Q(K.entries(e),(([e,s])=>t(s,e))),le=e=>Z(e)&&0==(e=>z(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)=>Q(e.sort(),t),Ie=(e,s)=>[!!t.useCell(de,e,be,s),F((t=>{s.setCell(de,e,be,(e=>!e)),t.preventDefault()}),[s,e])],we="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'>",Ce='</svg>")',ve=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\")",ke=Q([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,s,l])=>ye+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${s}' height='${l}' fill='white'/>`+Ce)),Te=ye+"<path d='M20 20l60 60M20 80l60-60' />"+Ce,xe=ye+`<path d='${we}' />`+Ce,Se=ye+`<path d='${we}M20 20l60 60' />`+Ce,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,..._(Q(["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;",..._(Q(["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)":Te,..._(Q(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":xe,"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","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:A("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 A("details",{open:o,onToggle:i},A("summary",null,s,a?A("img",{onClick:a,className:l?"done":"edit"}):null),n)},Le=e=>{const t=s(e);return N(t)||t==r&&S(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)=>Q(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:A(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)?_(Q(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]})=>A("table",{className:e},i?A("caption",null,i):null,!1===t?null:A("thead",null,A("tr",null,!1===s?null:A(Ge,{sort:r??[],label:"Id",onClick:o}),se(l,(({label:e},t)=>A(Ge,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),A("tbody",null,Q(n,(e=>A("tr",{key:e},!1===s?null:A("th",null,e),se(l,(({component:t,getComponentProps:s},l)=>A("td",{key:l},A(t,{...B(s,e,l),...a,rowId:e,cellId:l}))))))))),Ge=({cellId:e,sort:[t,s],label:a=e??l,onClick:n})=>A("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 A("tr",null,!1===l?null:A(e.Fragment,null,A("th",null,s),A("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:A("td",{key:l},A(e,{...B(t,i,o),store:d,tableId:a,rowId:i,cellId:o}))})))},Ue=({thing:e,onThingChange:t,className:s,hasSchema:l,showType:o=!0})=>{const[i,d]=Ae(),[u,c]=Ae(),[h,m]=Ae(),[b,g]=Ae(),[p,I]=Ae();u!==e&&(d(Le(e)),c(e),m(e+""),g(Number(e)||0),I(!!e));const w=$e(((e,s)=>{s(e),c(e),t(e)}),[t]),f=$e((()=>{if(!l?.()){const e=ze(i,r,n,a),s=ze(e,h,b,p);d(e),c(s),t(s)}}),[l,t,h,b,p,i]);return A("div",{className:s},o?A("button",{className:i,onClick:f},i):null,ze(i,A("input",{key:i,value:h,onChange:$e((e=>w(e[v][k]+"",m)),[w])}),A("input",{key:i,type:"number",value:b,onChange:$e((e=>w(Number(e[v][k]||0),g)),[w])}),A("input",{key:i,type:"checkbox",checked:p,onChange:$e((e=>w(!!e[v].checked,I)),[w])})))},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 A(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})=>A("table",{className:n},!1===r?null:A("thead",null,A("tr",null,!1===o?null:A("th",null,"Id"),A("th",null,f))),A("tbody",null,Q(t.useValueIds(e),(t=>A("tr",{key:t},!1===o?null:A("th",null,t),A("td",null,A(l,{...B(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 A(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 A("table",{className:r},!1===o?null:A("thead",null,A("tr",null,!1===i?null:A(e.Fragment,null,A("th",null,c,".Id"),A("th",null,h,".Id")),se(m,(({label:e},t)=>A("th",{key:t},e))))),A("tbody",null,Q(t.useRowIds(c,u),(e=>A(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 A(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,showType:r})=>A(Ue,{thing:t.useCell(e,s,l,a),onThingChange:t.useSetCellCallback(e,s,l,(e=>e),[],a),className:n??Fe+I,showType:r,hasSchema:t.useStoreOrStoreById(a)?.hasTablesSchema}),st=({valueId:e,store:s,className:l,showType:a})=>A(Ue,{thing:t.useValue(e,s),onThingChange:t.useSetValueCallback(e,(e=>e),[],s),className:l??Fe+f,showType:a,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 A(e.Fragment,null,s>a&&A(e.Fragment,null,A("button",{className:"previous",disabled:0==l,onClick:o},"←"),A("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})=>A(Ne,{uniqueId:ge("i",s,l),summary:"Index: "+l,s:a},Q(t.useSliceIds(l,e),(t=>A(nt,{indexes:e,indexesId:s,indexId:l,sliceId:t,s:a,key:t})))),nt=({indexes:e,indexesId:t,indexId:s,sliceId:l,s:a})=>{const n=ge("i",t,s,l),[r,o]=Ie(n,a);return A(Ne,{uniqueId:n,summary:"Slice: "+l,editable:r,handleEditable:o,s:a},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:A(Ne,{uniqueId:ge("i",e),summary:"Indexes: "+(e??d),s:s},j(a)?"No indexes defined":pe(a,(t=>A(at,{indexes:l,indexesId:e,indexId:t,s:s,key:t}))))},ot=({metrics:e,metricId:s})=>A("tr",null,A("th",null,s),A("td",null,e?.getTableId(s)),A("td",null,t.useMetric(s,e))),it=({metricsId:e,s:s})=>{const l=t.useMetrics(e),a=t.useMetricIds(l);return R(l)?null:A(Ne,{uniqueId:ge("m",e),summary:"Metrics: "+(e??d),s:s},j(a)?"No metrics defined":A("table",null,A("thead",null,A("th",null,"Metric Id"),A("th",null,"Table Id"),A("th",null,"Metric")),A("tbody",null,Q(a,(e=>A(ot,{metrics:l,metricId:e,key: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 A(Ne,{uniqueId:n,summary:"Query: "+l,s:a},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:A(Ne,{uniqueId:ge("q",e),summary:"Queries: "+(e??d),s:s},j(a)?"No queries defined":pe(a,(t=>A(dt,{queries:l,queriesId:e,queryId:t,s:s,key:t}))))},ct=({relationships:e,relationshipsId:t,relationshipId:s,s:l})=>{const a=ge("r",t,s),[n,r]=Ie(a,l);return A(Ne,{uniqueId:a,summary:"Relationship: "+s,editable:n,handleEditable:r,s:l},A(_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:A(Ne,{uniqueId:ge("r",e),summary:"Relationships: "+(e??d),s:s},j(a)?"No relationships defined":pe(a,(t=>A(ct,{relationships:l,relationshipsId:e,relationshipId:t,s:s,key:t}))))},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 A(Ne,{uniqueId:n,summary:c+": "+e,editable:u,handleEditable:h,s:a},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 j(t.useValueIds(e))?null:A(Ne,{uniqueId:a,summary:y,editable:n,handleEditable:r,s:l},A(Ye,{store:e,editable:n}))},gt=({storeId:e,s:s})=>{const l=t.useStore(e),a=t.useTableIds(l);return R(l)?null:A(Ne,{uniqueId:ge("s",e),summary:"Store: "+(e??d),s:s},A(bt,{storeId:e,store:l,s:s}),pe(a,(t=>A(mt,{store:l,storeId:e,tableId:t,s:s,key:t}))))},pt=({s:e})=>{const s=P(null),l=P(0),[a,n]=H(!1),{scrollLeft:r,scrollTop:o}=t.useValues(e);J((()=>{const e=s.current;if(e&&!a){const t=new MutationObserver((()=>{e.scrollWidth>=x(r)+e.clientWidth&&e.scrollHeight>=x(o)+e.clientHeight&&e.scrollTo(r,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[a,r,o]);const i=F((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(),w=t.useQueriesIds();return R(d)&&j(u)&&R(c)&&j(h)&&R(m)&&j(b)&&R(g)&&j(p)&&R(I)&&j(w)?A("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):A("article",{ref:s,onScroll:i},A(gt,{s:e}),Q(u,(t=>A(gt,{storeId:t,s:e,key:t}))),A(it,{s:e}),Q(h,(t=>A(it,{metricsId:t,s:e,key:t}))),A(rt,{s:e}),Q(b,(t=>A(rt,{indexesId:t,s:e,key:t}))),A(ht,{s:e}),Q(p,(t=>A(ht,{relationshipsId:t,s:e,key:t}))),A(ut,{s:e}),Q(w,(t=>A(ut,{queriesId:t,s:e,key:t}))))};class It extends ${constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?A("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const wt=({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 A("header",null,A("img",{title:oe}),A("span",null,oe),Q(ie,((e,t)=>t==s?null:A("img",{onClick:a,"data-id":t,title:"Dock to "+e,key:t}))),A("img",{onClick:l,title:"Close"}))},ft=({s:e})=>{const s=t.useValue(he,e)??1;return t.useValue(me,e)?A("main",{"data-position":s},A(wt,{s:e}),A(It,null,A(pt,{s:e}))):null},yt=e=>t=>{return s=(t,s)=>t+e(s),Vt(t).reduce(s,0);var s},Ct=e=>e?.size??0,vt=yt(Ct),kt=yt(vt),Tt=yt(kt),xt=(e,t)=>e?.has(t)??!1,St=e=>R(e)||0==Ct(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)=>(xt(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>z(t)-2?s:Lt),(n=>{if(a>z(t)-2)return l?.(n)&&$t(e,t[a]),n;const r=Qt(n,t,s,l,a+1);return St(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)&&z(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(),x=Lt(),S=Lt(),V=Lt(),M=Lt(),$=Lt(),O=Lt(),A=Lt(),F=Lt(),J=Lt(),P=Lt(),H=Ut(),B=Lt(),j=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(),we=ts(),[fe,ye,Ce,ve]=(e=>{let t;const[s,a]=Zt(),n=Lt();return[(e,a,r,o=[],i=(()=>[]))=>{t??=fs;const d=s(1);return $t(n,d,[e,a,r,o,i]),Xt(Qt(a,r??[l],Ut),d),d},(e,s,...a)=>D(((e,t=[l])=>{const s=[],a=(e,l)=>l==z(t)?W(s,e):null===t[l]?qt(e,(e=>a(e,l+1))):D([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),St(t)?1:0))),$t(n,e),a(e),s))),e=>q(Et(n,e),(([e,,s=[],l,a])=>{const n=(...r)=>{const o=z(r);o==z(s)?e(t,...r,...a(r)):R(s[o])?D(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))},Te=(t,s)=>(!e||xt(A,s)||lt(s))&&as(t,((e,t)=>xe(s,t,e)),(()=>lt(s))),xe=(e,t,s,l)=>as(l?s:qe(s,e,t),((l,a)=>q(Se(e,t,a,l),(e=>(s[a]=e,!0)),(()=>!1))),(()=>lt(e,t))),Se=(t,s,l,a)=>e?q(Et(Et(A,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(J,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(F,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(P,((t,s)=>{ee(e,s)||(e[s]=t)})),qt(H,(t=>{ee(e,t)||at(t)}))),e),ze=e=>At(A,e,((e,t,s)=>{const l=Lt(),a=Ut();At(Ot(A,t,Lt),s,((e,t,s)=>{$t(e,t,s),q(s[d],(e=>$t(l,t,e)),(()=>Xt(a,t)))})),$t(F,t,[l,a])}),((e,t)=>{$t(A,t),$t(F,t)})),$e=e=>At(J,e,((e,t,s)=>{$t(J,t,s),q(s[d],(e=>$t(P,t,e)),(()=>Xt(H,t)))}),((e,t)=>{$t(J,t),$t(P,t),Nt(H,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(B,e,Zt()),$t(j,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)=>{xt(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)=>{xt(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(B,e),l=s(t);return xt(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(B,e);l(s),Je(e,t,s,{},!0)},Ue=(e,t,s,l,a,n)=>{const r=Et(Et(F,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),St(l)&&(Ze(e,s,-1),St($t(t,s))&&(Ye(e,-1),$t(G,e),$t(B,e),$t(j,e)))},Xe=e=>{const t=Et(P,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(j,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(x,e,Lt),t,Lt),s,l)},et=(e,t,s,l,a)=>Ot(Ot(Ot(S,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,Lt),t,Lt),s,(()=>[])),l),a),at=(e,t,s)=>(W(Ot(O,e,(()=>[])),t),s),nt=(e,t,s)=>q(Et(Et(Et(S,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=>St($)||St(he[e])?0:qt(e?Dt($):$,((t,s)=>qt(t,((t,l)=>qt(t,((t,a)=>ye(he[e],[s,l,a],t))))))),it=e=>St(O)||St(me[e])?0:qt(e?Ht(O):O,((t,s)=>ye(me[e],[s],t))),dt=(e,t,s)=>{if(!St(t))return ye(e,s,(()=>Ft(t))),1},ut=e=>{const t=St(ie[e]),s=St(ue[e])&&St(_[e])&&St(re[e])&&St(oe[e])&&t&&St(X[e]),l=St(ce[e])&&St(de[e])&&St(Z[e])&&St(U[e]);if(!s||!l){const a=e?[Ht(o),Bt(u),Ht(v),Bt(k),Dt(x),Dt(S)]:[o,u,v,k,x,S];if(!s){dt(X[e],a[0]),qt(a[1],((t,s)=>dt(_[e],t,[s]))),qt(a[2],((t,s)=>{0!=t&&ye(re[e],[s],It(s))}));const s=Ut();qt(a[3],((l,a)=>{dt(oe[e],l,[a])&&!t&&(ye(ie[e],[a,null]),Xt(s,a))})),t||qt(a[5],((t,l)=>{if(!xt(s,l)){const s=Ut();qt(t,(e=>qt(e,(([t,l],a)=>l!==t?Xt(s,a):Nt(e,a))))),qt(s,(t=>ye(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&&(ye(ce[e],[l,n,i],o,s,nt),t=a=r=1)})),r&&ye(de[e],[l,n],nt)})),a&&ye(Z[e],[l],nt)})),t&&ye(U[e],void 0,nt)}}},ct=e=>{const t=St(ge[e]),s=St(pe[e])&&St(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&&(ye(pe[e],[a],l,s,rt),t=1)})),t&&ye(be[e],void 0,rt)}}},ht=(e,...t)=>(ps((()=>e(...Q(t,T)))),fs),mt=()=>[Ft(S,((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(S,ss,ls),invalidCells:Pt($),changedValues:Ft(M,ss,ls),invalidValues:Ft(O),changedTableIds:Ft(o),changedRowIds:Jt(k),changedCellIds:Pt(x),changedValueIds:Ft(V)}),gt=()=>Pt(G),pt=()=>Mt(G),It=e=>Ct(Et(G,T(e))),wt=e=>Mt(Et(G,T(e))),ft=(e,t,s,l=0,a)=>{return Q(E((r=Et(G,T(e)),o=(e,s)=>[R(t)?s:Et(e,T(t)),s],n=([e],[t])=>((e??0)<(t??0)?-1:1)*(s?-1:1),Q([...r?.entries()??[]],(([e,t])=>o(t,e))).sort(n)),l,R(a)?a:l+a),(([,e])=>e));var n,r,o},yt=(e,t)=>Mt(Et(Et(G,T(e)),T(t))),Vt=(e,t,s)=>Et(Et(Et(G,T(e)),T(t)),T(s)),jt=()=>Ft(K),Wt=()=>Mt(K),Gt=e=>Et(K,T(e)),Kt=e=>ht((()=>(e=>as(e,Te,lt))(e)?Ae(e):0)),Yt=e=>ht((()=>Ve(e)?De(e):0)),os=e=>{try{Oe(ne(e))}catch{}return fs},is=t=>ht((()=>{if((e=as(t,(e=>as(e,ke))))&&(ze(t),!St(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=>xt(G,e)?Ge(e):0),e),hs=(e,t)=>ht(((e,t)=>q(Et(G,e),(s=>xt(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 ws(t),s}},Is=()=>(-1!=n&&n++,1==n&&ye(Ie,void 0,mt,bt),fs),ws=e=>(n>0&&(n--,0==n&&(s=!St(S),a=!St(M),n=1,ot(1),s&&ut(1),it(1),a&&ct(1),e?.(mt,bt)&&(qt(S,((e,t)=>qt(e,((e,s)=>qt(e,(([e],l)=>Me(fs,t,s,l,e))))))),qt(M,(([e],t)=>Ee(fs,t,e))),s=a=!1),ye(we[0],void 0,mt,bt),n=-1,ot(0),s&&ut(0),it(0),a&&ct(0),ye(we[1],void 0,mt,bt),n=0,s=a=!1,D([o,u,v,k,x,S,$,V,M,O],Rt))),fs),fs={getContent:()=>[gt(),jt()],getTables:gt,getTableIds:pt,getTable:e=>Jt(Et(G,T(e))),getTableCellIds:e=>Mt(Et(j,T(e))),getRowCount:It,getRowIds:wt,getSortedRowIds:ft,getRow:(e,t)=>Ft(Et(Et(G,T(e)),T(t))),getCellIds:yt,getCell:Vt,getValues:jt,getValueIds:Wt,getValue:Gt,hasTables:()=>!St(G),hasTable:e=>xt(G,T(e)),hasTableCell:(e,t)=>xt(Et(j,T(e)),T(t)),hasRow:(e,t)=>xt(Et(G,T(e)),T(t)),hasCell:(e,t,s)=>xt(Et(Et(G,T(e)),T(t)),T(s)),hasValues:()=>!St(K),hasValue:e=>xt(K,T(e)),getTablesJson:()=>ae(G),getValuesJson:()=>ae(K),getJson:()=>ae([G,K]),getTablesSchemaJson:()=>ae(A),getValuesSchemaJson:()=>ae(J),getSchemaJson:()=>ae([A,J]),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=>Te(t,e)?Fe(e,t):0),e),setRow:(e,t,s)=>ht(((e,t)=>xe(e,t,s)?Je(e,We(e),t,s):0),e,t),addRow:(e,t,s=!0)=>ps((()=>{let l;return xe(e,l,t)&&(e=T(e),Je(e,We(e),l=je(e,s?1:0),t)),l})),setPartialRow:(e,t,s)=>ht(((e,t)=>{if(xe(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(Se(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(fs,t,s,l,e))))))),se(e[1],((e,t)=>Ee(fs,t,e)))})),setTablesJson:os,setValuesJson:e=>{try{Be(ne(e))}catch{}return fs},setJson:e=>ht((()=>{try{const[t,s]=ne(e);Oe(t),Be(s)}catch{os(e)}})),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=>xt(n,s)?Ue(e,a,t,n,s,l):0))))),e,t,s),delValues:ms,delValue:e=>ht((e=>xt(K,e)?Xe(e):0),e),delTablesSchema:bs,delValuesSchema:gs,delSchema:()=>ht((()=>{bs(),gs()})),transaction:ps,startTransaction:Is,finishTransaction:ws,forEachTable:e=>qt(G,((t,s)=>e(s,(e=>qt(t,((t,s)=>e(s,(e=>zt(t,e))))))))),forEachTableCell:(e,t)=>zt(Et(j,T(e)),t),forEachRow:(e,t)=>qt(Et(G,T(e)),((e,s)=>t(s,(t=>zt(e,t))))),forEachCell:(e,t,s)=>zt(Et(Et(G,T(e)),T(t)),s),forEachValue:e=>zt(K,e),addSortedRowIdsListener:(e,t,s,l,a,n,r)=>{let o=ft(e,t,s,l,a);return fe((()=>{const r=ft(e,t,s,l,a);var i,d,u;d=o,z(i=r)===z(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(o=r,n(fs,e,t,s,l,a,o))}),ie[r?1:0],[e,t],[pt])},addStartTransactionListener:e=>fe(e,Ie),addWillFinishTransactionListener:e=>fe(e,we[0]),addDidFinishTransactionListener:e=>fe(e,we[1]),callListener:e=>(ve(e),fs),delListener:e=>(Ce(e),fs),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,Tt),invalidCell:es(he,Tt),values:es(be),valueIds:es(ge),value:es(pe),invalidValue:es(me),transaction:vt(Ie)+es(we)}),createStore:rs,addListener:fe,callListeners:ye};return se({[h]:[0,U],[m]:[0,X],[c]:[1,Z,[pt]],[c+w]:[1,_,[pt]],[g]:[1,re,[pt]],[p]:[1,oe,[pt]],[b]:[2,de,[pt,wt]],[w]:[2,ue,[pt,wt]],[I]:[3,ce,[pt,wt,yt],e=>_t(Vt(...e))],InvalidCell:[3,he],[y]:[0,be],[C]:[0,ge],[f]:[1,pe,[Wt],e=>_t(Gt(e[0]))],InvalidValue:[1,me]},(([e,t,s,l],a)=>{fs["add"+a+"Listener"]=(...a)=>fe(a[e],t[a[e+1]?1:0],e>0?E(a,0,e):void 0,s,l)})),Y(fs)},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,o]=[],i=[])=>{let d,u,c,h=0,m=0,b=0,g=0;Ot(jt,i,(()=>0)),Ot(Wt,i,(()=>[]));const p=async e=>(2!=h&&(h=1,m++,await I.schedule((async()=>{await e(),h=0}))),I),I={load:async(s,l)=>await p((async()=>{try{e.setContent(await t())}catch{e.setContent([s,l])}})),startAutoLoad:async(s={},a={})=>(I.stopAutoLoad(),await I.load(s,a),g=1,c=l((async(s,l)=>{if(l){const t=l();await p((async()=>e.setTransactionChanges(t)))}else await p((async()=>{try{e.setContent(s?.()??await t())}catch(e){n?.(e)}}))})),I),stopAutoLoad:()=>(g&&(a(c),c=void 0,g=0),I),save:async t=>(1!=h&&(h=2,b++,await I.schedule((async()=>{try{await s(e.getContent,t)}catch(e){n?.(e)}h=0}))),I),startAutoSave:async()=>(await I.stopAutoSave().save(),d=e.addDidFinishTransactionListener(((e,t)=>{const[s,l]=t();le(s)&&le(l)||I.save((()=>[s,l]))})),I),stopAutoSave:()=>(q(d,e.delListener),d=void 0,I),schedule:async(...e)=>(W(Et(Wt,i),...e),await(async()=>{if(!Et(jt,i)){for($t(jt,i,1);!R(u=G(Et(Wt,i)));)try{await u()}catch(e){n?.(e)}$t(jt,i,0)}})(),I),getStore:()=>e,destroy:()=>I.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:m,saves:b})};return r&&(I[r]=()=>o),Y(I)})(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,["getStorageName",t]))(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()})),A(O,null,A("aside",{id:re},A(qe,{s:l}),A(ft,{s:l})),A("style",null,Re))};exports.EditableCellView=tt,exports.EditableValueView=st,exports.RelationshipInHtmlTable=_e,exports.ResultSortedTableInHtmlTable=et,exports.ResultTableInHtmlTable=({queryId:e,queries:s,customCells:l,...a})=>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=>A(os,{...e}),exports.TableInHtmlTable=({tableId:e,store:s,editable:l,customCells:a,...n})=>A(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),r=l(0),n="Value",s="currentTarget",i="value",d=isFinite,u=e=>null==e,{PureComponent:m,Fragment:c,createElement:h,useCallback:p,useLayoutEffect:b,useRef:g,useState:w}=e,f=(e,...t)=>u(e)?{}:e(...t),I=(e,t)=>e.map(t),C=Object,y=(e=[])=>C.fromEntries(e),k=(e,t)=>I(C.entries(e),(([e,l])=>t(l,e))),v="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",x='content:url("',T=x+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",R='</svg>")',S=x+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",N=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'/>`+R)),V=T+"<path d='M20 20l60 60M20 80l60-60' />"+R,z=T+`<path d='${v}' />`+R,M=T+`<path d='${v}M20 20l60 60' />`+R,$="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(k({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[$]:"width:0.5rem;height:0.5rem;",[$+"-track"]:"background:#111",[$+"-thumb"]:"background:#999;border:1px solid #111",[$+"-thumb:hover"]:"background:#fff",[$+"-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,...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)":S,"header>img:nth-of-type(6)":V,...y(I(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":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,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?`& ${t}{${e}}`:"")));const q=(e,t,l,o)=>e==a?t:e==r?l:o,{useCallback:F,useMemo:H,useState:O}=e,B="editable",E=(e,l)=>I(t.useTableCellIds(e,l),(t=>e+"."+t)),P=(e,t,l)=>{const a=F(e,t);return l?a:void 0},j=(...e)=>H((()=>e),e),A=(e,t)=>H((()=>({store:e,tableId:t})),[e,t]),D=(e,t)=>H((()=>({queries:e,queryId:t})),[e,t]),L=(e,t=!1,l,a=0,o,r,n,s)=>{const[[i,d,u],m]=O([e,t,a]),c=F((e=>{m(e),s?.(e)}),[s]),p=P((e=>c([e,e==i&&!d,u])),[c,i,d,u],l),b=F((e=>c([i,d,e])),[c,i,d]),g=!0===n?Y:n;return[[i,d,u],p,H((()=>!1===n?null:h(g,{offset:u,limit:o,total:r,onChange:b})),[n,g,u,o,r,b])]},G=(e,t,o)=>H((()=>{const r=t??e;return y(k(Array.isArray(r)?y(I(r,(e=>[e,e]))):r,((e,t)=>{return[t,{label:t,component:o,...(r=e,l(r)==a?{label:e}:e)}];var r})))}),[t,o,e]),J=({className:e,headerRow:t,idColumn:l,params:[a,o,r,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(K,{sort:n??[],label:"Id",onClick:s}),k(a,(({label:e},t)=>h(K,{key:t,cellId:t,label:e,sort:n??[],onClick:s}))))),h("tbody",null,I(r,(e=>h("tr",{key:e},!1===l?null:h("th",null,e),k(a,(({component:t,getComponentProps:l},a)=>h("td",{key:a},h(t,{...f(l,e,a),...o,rowId:e,cellId:a}))))))))),K=({cellId:e,sort:[t,l],label:a=e??"",onClick:o})=>h("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,r,n,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)),k(o,(({component:e,getComponentProps:t},a)=>{const[o,s]=a.split(".",2),i=o===r?l:o===n?m:null;return u(i)?null:h("td",{key:a},h(e,{...f(t,i,s),store:d,tableId:o,rowId:i,cellId:s}))})))},U=({thing:e,onThingChange:t,className:n,hasSchema:u,showType:m=!0})=>{const[c,p]=O(),[b,g]=O(),[w,f]=O(),[I,C]=O(),[y,k]=O();b!==e&&(p((e=>{const t=l(e);return(e=>e==a||e==o)(t)||t==r&&d(e)?t:void 0})(e)),g(e),f(e+""),C(Number(e)||0),k(!!e));const v=F(((e,l)=>{l(e),g(e),t(e)}),[t]),x=F((()=>{if(!u?.()){const e=q(c,r,o,a),l=q(e,w,I,y);p(e),g(l),t(l)}}),[u,t,w,I,y,c]);return h("div",{className:n},m?h("button",{className:c,onClick:x},c):null,q(c,h("input",{key:c,value:w,onChange:F((e=>v(e[s][i]+"",f)),[v])}),h("input",{key:c,type:"number",value:I,onChange:F((e=>v(Number(e[s][i]||0),C)),[v])}),h("input",{key:c,type:"checkbox",checked:y,onChange:F((e=>v(!!e[s].checked,k)),[v])})))},W=({tableId:e,rowId:l,cellId:a,store:o,className:r,showType:n})=>h(U,{thing:t.useCell(e,l,a,o),onThingChange:t.useSetCellCallback(e,l,a,(e=>e),[],o),className:r??B+"Cell",showType:n,hasSchema:t.useStoreOrStoreById(o)?.hasTablesSchema}),X=({valueId:e,store:l,className:a,showType:o})=>h(U,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:a??B+n,showType:o,hasSchema:t.useStoreOrStoreById(l)?.hasValuesSchema}),Y=({onChange:t,total:l,offset:a=0,limit:o=l,singular:r="row",plural:n=r+"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 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?n:r)};class Z extends m{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}static{this.getDerivedStateFromError=()=>({e:1})}render(){return this.state.e?h("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const _=e=>new Map(e);_(),_(),exports.EditableCellView=W,exports.EditableValueView=X,exports.RelationshipInHtmlTable=({relationshipId:l,relationships:a,editable:o,customCells:r,className:n,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),p=G([...E(m,u),...E(c,u)],r,o?W:t.CellView),b=j(i,p,m,c,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,m,".Id"),h("th",null,c,".Id")),k(p,(({label:e},t)=>h("th",{key:t},e))))),h("tbody",null,I(t.useRowIds(m,u),(e=>h(Q,{key:e,localRowId:e,params:b})))))},exports.ResultSortedTableInHtmlTable=({queryId:e,cellId:l,descending:a,offset:o,limit:r,queries:n,sortOnClick:s,paginator:i=!1,customCells:d,onChange:u,...m})=>{const[c,p,b]=L(l,a,s,o,r,t.useResultRowCount(e,n),i,u);return h(J,{...m,params:j(G(t.useResultTableCellIds(e,n),d,t.ResultCellView),D(n,e),t.useResultSortedRowIds(e,...c,r,n),c,p,b)})},exports.ResultTableInHtmlTable=({queryId:e,queries:l,customCells:a,...o})=>h(J,{...o,params:j(G(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:r,...n})=>{const[s,i,d]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(t.useIndexesOrIndexesById(a),e);return h(J,{...n,params:j(G(t.useTableCellIds(d,i),r,o?W:t.CellView),A(i,d),t.useSliceRowIds(e,l,s))})},exports.SortedTableInHtmlTable=({tableId:e,cellId:l,descending:a,offset:o,limit:r,store:n,editable:s,sortOnClick:i,paginator:d=!1,onChange:u,customCells:m,...c})=>{const[p,b,g]=L(l,a,i,o,r,t.useRowCount(e,n),d,u);return h(J,{...c,params:j(G(t.useTableCellIds(e,n),m,s?W:t.CellView),A(n,e),t.useSortedRowIds(e,...p,r,n),p,b,g)})},exports.SortedTablePaginator=Y,exports.StoreInspector=e=>null,exports.TableInHtmlTable=({tableId:e,store:l,editable:a,customCells:o,...r})=>h(J,{...r,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:r,headerRow:s,idColumn:i})=>h("table",{className:r},!1===s?null:h("thead",null,h("tr",null,!1===i?null:h("th",null,"Id"),h("th",null,n))),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})))))));
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:h,createElement:c,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",T='content:url("',R=T+"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=T+"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])=>R+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${a}' fill='white'/>`+S)),z=R+"<path d='M20 20l60 60M20 80l60-60' />"+S,$=R+`<path d='${v}' />`+S,M=R+`<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]),h=O((e=>{m(e),s?.(e)}),[s]),b=j((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),g=O((e=>h([i,d,e])),[h,i,d]),p=!0===r?Z:r;return[[i,d,u],b,B((()=>!1===r?null:c(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]})=>c("table",{className:e},i?c("caption",null,i):null,!1===t?null:c("thead",null,c("tr",null,!1===l?null:c(Q,{sort:r??[],label:"Id",onClick:s}),x(a,(({label:e},t)=>c(Q,{key:t,cellId:t,label:e,sort:r??[],onClick:s}))))),c("tbody",null,I(n,(e=>c("tr",{key:e},!1===l?null:c("th",null,e),x(a,(({component:t,getComponentProps:l},a)=>c("td",{key:a},c(t,{...f(l,e,a),...o,rowId:e,cellId:a}))))))))),Q=({cellId:e,sort:[t,l],label:a=e??"",onClick:o})=>c("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 c("tr",null,!1===a?null:c(e.Fragment,null,c("th",null,l),c("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:c("td",{key:a},c(e,{...f(t,i,s),store:d,tableId:o,rowId:i,cellId:s}))})))},W=({thing:e,onThingChange:t,className:r,hasSchema:u,showType:m=!0})=>{const[h,b]=F(),[g,p]=F(),[w,f]=F(),[I,C]=F(),[y,x]=F();g!==e&&(b((e=>{const t=l(e);return(e=>e==a||e==o)(t)||t==n&&d(e)?t:void 0})(e)),p(e),f(e+""),C(Number(e)||0),x(!!e));const k=O(((e,l)=>{l(e),p(e),t(e)}),[t]),v=O((()=>{if(!u?.()){const e=H(h,n,o,a),l=H(e,w,I,y);b(e),p(l),t(l)}}),[u,t,w,I,y,h]);return c("div",{className:r},m?c("button",{className:h,onClick:v},h):null,H(h,c("input",{key:h,value:w,onChange:O((e=>k(e[s][i]+"",f)),[k])}),c("input",{key:h,type:"number",value:I,onChange:O((e=>k(Number(e[s][i]||0),C)),[k])}),c("input",{key:h,type:"checkbox",checked:y,onChange:O((e=>k(!!e[s].checked,x)),[k])})))},X=({tableId:e,rowId:l,cellId:a,store:o,className:n,showType:r})=>c(W,{thing:t.useCell(e,l,a,o),onThingChange:t.useSetCellCallback(e,l,a,(e=>e),[],o),className:n??E+"Cell",showType:r,hasSchema:t.useStoreOrStoreById(o)?.hasTablesSchema}),Y=({valueId:e,store:l,className:a,showType:o})=>c(W,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:a??E+r,showType:o,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 c(e.Fragment,null,l>o&&c(e.Fragment,null,c("button",{className:"previous",disabled:0==a,onClick:s},"←"),c("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,h]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(a),l),b=J([...P(m,u),...P(h,u)],n,o?X:t.CellView),g=A(i,b,m,h,l,d,u);return c("table",{className:r},!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")),x(b,(({label:e},t)=>c("th",{key:t},e))))),c("tbody",null,I(t.useRowIds(m,u),(e=>c(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[h,b,g]=G(l,a,s,o,n,t.useResultRowCount(e,r),i,u);return c(K,{...m,params:A(J(t.useResultTableCellIds(e,r),d,t.ResultCellView),D(r,e),t.useResultSortedRowIds(e,...h,n,r),h,b,g)})},exports.ResultTableInHtmlTable=({queryId:e,queries:l,customCells:a,...o})=>c(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 c(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,...h})=>{const[b,g,p]=G(l,a,i,o,n,t.useRowCount(e,r),d,u);return c(K,{...h,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})=>c(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})=>c("table",{className:n},!1===s?null:c("thead",null,c("tr",null,!1===i?null:c("th",null,"Id"),c("th",null,r))),c("tbody",null,I(t.useValueIds(e),(t=>c("tr",{key:t},!1===i?null:c("th",null,t),c("td",null,c(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="Listener",u="Result",d="Ids",l="Table",n=l+"s",p=l+d,i="Row",a=i+"Count",I=i+d,x="Sorted"+i+d,c="Cell",C=c+d,w="Value",b=w+"s",R=w+d,k=e=>null==e,g=(e,s,t)=>k(e)?t?.():s(e),h=e=>s(e)==o,L=()=>{},m=(e,s)=>e.map(s),y=Object.keys,{createContext:S,useContext:V}=e,T=S([]),v=(e,s)=>{const t=V(T);return k(e)?t[s]:h(e)?((e,s)=>g(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return k(e)||h(e)?t:e},q=e=>y(V(T)[e]??{}),B=e=>P(e,0),f=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),F=e=>P(e,8),O=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const A="Transaction";Q(A);const{useCallback:E,useEffect:G,useMemo:W,useRef:j,useState:U}=e,z=(e,s,t=[])=>{const o=W((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},H=(e,s,t,o=[],r)=>{const[,u]=U(),d=E((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=U(d),n=j(l);return W((()=>n.current=d()),[d]),J(e,s,((...e)=>{n.current=k(r)?d():e[r],u([])}),[],o),n.current},J=(e,s,t,o=[],u=[],...d)=>G((()=>{const o=s?.["add"+e+r]?.(...u,t,...d);return()=>s?.delListener(o)}),[s,...u,...o,...d]),K=(e,s,t,o=[],r=L,u=[],...d)=>{const l=B(e);return E((e=>g(l,(o=>g(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},N=(e,s,t=L,o=[],...r)=>{const u=B(e);return E((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},X=(e,s,t)=>{const o=O(e);return E((()=>o?.[s](t)),[o,s,t])},Y=e=>H(p,B(e),[],[]),Z=(e,s)=>H(I,B(s),[],[e]),$=(e,s,t,o=0,r,u)=>H(x,B(u),[],[e,s,t,o,r],6),_=(e,s,t)=>H(C,B(t),[],[e,s]),ee=(e,s,t,o)=>H(c,B(o),void 0,[e,s,t],4),se=e=>H(R,B(e),[],[]),te=(e,s)=>H(w,B(s),void 0,[e]),oe=(e,s)=>H("Metric",f(s),void 0,[e]),re=(e,s)=>H("SliceIds",M(s),[],[e]),ue=(e,s,t)=>H("Slice"+I,M(t),[],[e,s]),de=(e,s,t)=>H("RemoteRowId",D(t),void 0,[e,s]),le=(e,s,t)=>H("Local"+I,D(t),[],[e,s]),ne=(e,s,t)=>H("Linked"+I,D(t),[],[e,s]),pe=(e,s)=>H(u+I,F(s),[],[e]),ie=(e,s,t,o=0,r,d)=>H(u+x,F(d),[],[e,s,t,o,r],6),ae=(e,s,t)=>H(u+C,F(t),[],[e,s]),Ie=(e,s,t,o)=>H(u+c,F(o),void 0,[e,s,t]),xe=e=>H("CheckpointIds",O(e),[[],void 0,[]]),ce=(e,s)=>H("Checkpoint",O(s),void 0,[e]),Ce=e=>X(e,"goBackward"),we=e=>X(e,"goForward"),{PureComponent:be,Fragment:Re,createElement:ke,useCallback:ge,useLayoutEffect:he,useRef:Le,useState:me}=e,ye=(e,...s)=>k(e)?{}:e(...s),Se=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:Ve}=e,Te=({tableId:e,store:s,rowComponent:t=Me,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(m(l,(u=>ke(t,{...ye(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ae,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(m(d,(r=>ke(t,{...ye(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=Me,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,p,i]=Se(D(s),e),a=d(e,l,n);return Be(m(a,(e=>ke(t,{...ye(o,e),key:e,tableId:i,rowId:e,store:p,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ee,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=O(s);return Be(m(e(xe(d)),(e=>ke(t,{...ye(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=k(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},fe=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>Be(t+(ee(e,s,o,r)??t),void 0,u,o),Me=({tableId:e,rowId:s,store:t,cellComponent:o=fe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(m(((e,s,t,o)=>{const r=_(s,t,o);return e??r})(u,e,s,t),(u=>ke(o,{...ye(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),De=e=>Te(e,Z(e.tableId,e.store)),Fe=({valueId:e,store:s,debugIds:o})=>Be(t+(te(e,s)??t),void 0,o,e),Oe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Me,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(M(t),e),i=ue(e,s,l);return Be(m(i,(e=>ke(o,{...ye(r,e),key:e,tableId:p,rowId:e,store:n,debugIds:d}))),u,d,s)},Qe=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>Be(t+(Ie(e,s,o,r)??t),void 0,u,o),Ae=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Qe,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(m(ae(e,s,t),(u=>ke(o,{...ye(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ee=({checkpoints:e,checkpointId:s,debugIds:o})=>Be(ce(s,e)??t,void 0,o,s),Ge=qe((e=>e[0])),We=qe((e=>k(e[1])?[]:[e[1]])),je=qe((e=>e[2]));exports.BackwardCheckpointsView=Ge,exports.CellView=fe,exports.CheckpointView=Ee,exports.CurrentCheckpointView=We,exports.ForwardCheckpointsView=je,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Oe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(m(re(e,s),(r=>ke(t,{...ye(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Pe(e,ne,e.firstRowId),exports.LocalRowsView=e=>Pe(e,le,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>Be(oe(e,s)??t,void 0,o,e),exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:p,queriesById:i,checkpoints:a,checkpointsById:I,children:x})=>{const c=e.useContext(T);return ke(T.Provider,{value:Ve((()=>[s??c[0],{...c[1],...t},o??c[2],{...c[3],...r},u??c[4],{...c[5],...d},l??c[6],{...c[7],...n},p??c[8],{...c[9],...i},a??c[10],{...c[11],...I}]),[s,t,o,r,u,d,l,n,p,i,a,I,c])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Me,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Se(D(t),e),p=de(e,s,d);return Be(k(n)||k(p)?null:ke(o,{...ye(r,p),key:p,tableId:n,rowId:p,store:l,debugIds:u}),void 0,u,s)},exports.ResultCellView=Qe,exports.ResultRowView=Ae,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,ie(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>ve(e,pe(e.queryId,e.queries)),exports.RowView=Me,exports.SliceView=Oe,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Te(r,$(r.tableId,e,s,t,o,r.store)),exports.TableView=De,exports.TablesView=({store:e,tableComponent:s=De,getTableComponentProps:t,separator:o,debugIds:r})=>Be(m(Y(e),(o=>ke(s,{...ye(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})=>Be(m(se(e),(o=>ke(s,{...ye(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=[],o,r=L,u=[],d=!0)=>{const l=B(o);return E((t=>g(l,(o=>g(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},exports.useCell=ee,exports.useCellIds=_,exports.useCellIdsListener=(e,s,t,o,r,u)=>J(C,B(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,d)=>J(c,B(d),o,r,[e,s,t],u),exports.useCheckpoint=ce,exports.useCheckpointIds=xe,exports.useCheckpointIdsListener=(e,s,t)=>J("CheckpointIds",O(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>J("Checkpoint",O(o),s,t,[e]),exports.useCheckpoints=e=>v(e,10),exports.useCheckpointsIds=()=>q(11),exports.useCheckpointsOrCheckpointsById=O,exports.useCreateCheckpoints=(e,s,t)=>z(e,s,t),exports.useCreateIndexes=(e,s,t)=>z(e,s,t),exports.useCreateMetrics=(e,s,t)=>z(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=U(),d=W((()=>s(e)),[e,...t]);return G((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d?.destroy()})),[d,...r]),d},exports.useCreateQueries=(e,s,t)=>z(e,s,t),exports.useCreateRelationships=(e,s,t)=>z(e,s,t),exports.useCreateStore=(e,s=[])=>W(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,d)=>N(r,c,u,d,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>N(t,i,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>N(s,l,t,o,e),exports.useDelTablesCallback=(e,s,t)=>N(e,n,s,t),exports.useDelValueCallback=(e,s,t,o)=>N(s,w,t,o,e),exports.useDelValuesCallback=(e,s,t)=>N(e,b,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>J("DidFinish"+A,B(t),e,s),exports.useGoBackwardCallback=Ce,exports.useGoForwardCallback=we,exports.useGoToCallback=(e,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useIndexIds=e=>H("IndexIds",M(e),[]),exports.useIndexes=e=>v(e,4),exports.useIndexesIds=()=>q(5),exports.useIndexesOrIndexesById=M,exports.useLinkedRowIds=ne,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>J("Linked"+I,D(r),t,o,[e,s]),exports.useLocalRowIds=le,exports.useLocalRowIdsListener=(e,s,t,o,r)=>J("Local"+I,D(r),t,o,[e,s]),exports.useMetric=oe,exports.useMetricIds=e=>H("MetricIds",f(e),[]),exports.useMetricListener=(e,s,t,o)=>J("Metric",f(o),s,t,[e]),exports.useMetrics=e=>v(e,2),exports.useMetricsIds=()=>q(3),exports.useMetricsOrMetricsById=f,exports.useQueries=e=>v(e,8),exports.useQueriesIds=()=>q(9),exports.useQueriesOrQueriesById=F,exports.useQueryIds=e=>H("QueryIds",F(e),[]),exports.useRedoInformation=e=>{const s=O(e),[,,[o]]=xe(s);return[!k(o),we(s),o,g(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>H("RelationshipIds",D(e),[]),exports.useRelationships=e=>v(e,6),exports.useRelationshipsIds=()=>q(7),exports.useRelationshipsOrRelationshipsById=D,exports.useRemoteRowId=de,exports.useRemoteRowIdListener=(e,s,t,o,r)=>J("RemoteRowId",D(r),t,o,[e,s]),exports.useResultCell=Ie,exports.useResultCellIds=ae,exports.useResultCellIdsListener=(e,s,t,o,r)=>J(u+C,F(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,d)=>J(u+c,F(d),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>H(u+i,F(t),{},[e,s]),exports.useResultRowCount=(e,s)=>H(u+a,F(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>J(u+a,F(o),s,t,[e]),exports.useResultRowIds=pe,exports.useResultRowIdsListener=(e,s,t,o)=>J(u+I,F(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>J(u+i,F(r),t,o,[e,s]),exports.useResultSortedRowIds=ie,exports.useResultSortedRowIdsListener=(e,s,t,o,r,d,l,n)=>J(u+x,F(n),d,l,[e,s,t,o,r]),exports.useResultTable=(e,s)=>H(u+l,F(s),{},[e]),exports.useResultTableCellIds=(e,s)=>H(u+l+C,F(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>J(u+l+C,F(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>J(u+l,F(o),s,t,[e]),exports.useRow=(e,s,t)=>H(i,B(t),{},[e,s]),exports.useRowCount=(e,s)=>H(a,B(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>J(a,B(r),s,t,[e],o),exports.useRowIds=Z,exports.useRowIdsListener=(e,s,t,o,r)=>J(I,B(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>J(i,B(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,d,l)=>K(u,c,o,r,d,l,e,s,t),exports.useSetCheckpointCallback=(e=L,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>K(r,"PartialRow",t,o,u,d,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>K(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,d)=>K(r,i,t,o,u,d,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>K(o,l,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>K(t,n,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>K(o,w,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>K(t,b,e,s,o,r),exports.useSliceIds=re,exports.useSliceIdsListener=(e,s,t,o)=>J("SliceIds",M(o),s,t,[e]),exports.useSliceRowIds=ue,exports.useSliceRowIdsListener=(e,s,t,o,r)=>J("Slice"+I,M(r),t,o,[e,s]),exports.useSortedRowIds=$,exports.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>J(x,B(n),u,d,[e,s,t,o,r],l),exports.useStartTransactionListener=(e,s,t)=>J("Start"+A,B(t),e,s),exports.useStore=e=>v(e,0),exports.useStoreIds=()=>q(1),exports.useStoreOrStoreById=B,exports.useTable=(e,s)=>H(l,B(s),{},[e]),exports.useTableCellIds=(e,s)=>H(l+C,B(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>J(l+C,B(r),s,t,[e],o),exports.useTableIds=Y,exports.useTableIdsListener=(e,s,t,o)=>J(p,B(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>J(l,B(r),s,t,[e],o),exports.useTables=e=>H(n,B(e),{}),exports.useTablesListener=(e,s,t,o)=>J(n,B(o),e,s,[],t),exports.useUndoInformation=e=>{const s=O(e),[o,r]=xe(s);return[(u=o,!(0==u.length)),Ce(s),r,g(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=te,exports.useValueIds=se,exports.useValueIdsListener=(e,s,t,o)=>J(R,B(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>J(w,B(r),s,t,[e],o),exports.useValues=e=>H(b,B(e),{}),exports.useValuesListener=(e,s,t,o)=>J(b,B(o),e,s,[],t),exports.useWillFinishTransactionListener=(e,s,t)=>J("WillFinish"+A,B(t),e,s);
1
+ "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Listener",u="Result",d="Ids",l="Table",n=l+"s",p=l+d,i="Row",a=i+"Count",I=i+d,x="Sorted"+i+d,c="Cell",C=c+d,w="Value",b=w+"s",R=w+d,k=e=>null==e,g=(e,s,t)=>k(e)?t?.():s(e),h=e=>s(e)==o,L=()=>{},m=(e,s)=>e.map(s),y=Object.keys,{createContext:S,useContext:V}=e,T=S([]),v=(e,s)=>{const t=V(T);return k(e)?t[s]:h(e)?((e,s)=>g(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return k(e)||h(e)?t:e},q=e=>y(V(T)[e]??{}),B=e=>P(e,0),f=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),F=e=>P(e,8),O=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const A="Transaction";Q(A);const{useCallback:E,useEffect:G,useMemo:W,useRef:j,useState:U}=e,z=(e,s,t=[])=>{const o=W((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},H=(e,s,t,o=[],r)=>{const[,u]=U(),d=E((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=U(d),n=j(l);return W((()=>n.current=d()),[d]),J(e,s,((...e)=>{n.current=k(r)?d():e[r],u([])}),[],o),n.current},J=(e,s,t,o=[],u=[],...d)=>G((()=>{const o=s?.["add"+e+r]?.(...u,t,...d);return()=>s?.delListener(o)}),[s,...u,...o,...d]),K=(e,s,t,o=[],r=L,u=[],...d)=>{const l=B(e);return E((e=>g(l,(o=>g(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},N=(e,s,t=L,o=[],...r)=>{const u=B(e);return E((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},X=(e,s,t)=>{const o=O(e);return E((()=>o?.[s](t)),[o,s,t])},Y=e=>H(p,B(e),[],[]),Z=(e,s)=>H(I,B(s),[],[e]),$=(e,s,t,o=0,r,u)=>H(x,B(u),[],[e,s,t,o,r],6),_=(e,s,t)=>H(C,B(t),[],[e,s]),ee=(e,s,t,o)=>H(c,B(o),void 0,[e,s,t],4),se=e=>H(R,B(e),[],[]),te=(e,s)=>H(w,B(s),void 0,[e]),oe=(e,s)=>H("Metric",f(s),void 0,[e]),re=(e,s)=>H("SliceIds",M(s),[],[e]),ue=(e,s,t)=>H("Slice"+I,M(t),[],[e,s]),de=(e,s,t)=>H("RemoteRowId",D(t),void 0,[e,s]),le=(e,s,t)=>H("Local"+I,D(t),[],[e,s]),ne=(e,s,t)=>H("Linked"+I,D(t),[],[e,s]),pe=(e,s)=>H(u+I,F(s),[],[e]),ie=(e,s,t,o=0,r,d)=>H(u+x,F(d),[],[e,s,t,o,r],6),ae=(e,s,t)=>H(u+C,F(t),[],[e,s]),Ie=(e,s,t,o)=>H(u+c,F(o),void 0,[e,s,t]),xe=e=>H("CheckpointIds",O(e),[[],void 0,[]]),ce=(e,s)=>H("Checkpoint",O(s),void 0,[e]),Ce=e=>X(e,"goBackward"),we=e=>X(e,"goForward"),{PureComponent:be,Fragment:Re,createElement:ke,useCallback:ge,useLayoutEffect:he,useRef:Le,useState:me}=e,ye=(e,...s)=>k(e)?{}:e(...s),Se=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:Ve}=e,Te=({tableId:e,store:s,rowComponent:t=Me,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(m(l,(u=>ke(t,{...ye(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ae,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(m(d,(r=>ke(t,{...ye(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=Me,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,p,i]=Se(D(s),e),a=d(e,l,n);return Be(m(a,(e=>ke(t,{...ye(o,e),key:e,tableId:i,rowId:e,store:p,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ee,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=O(s);return Be(m(e(xe(d)),(e=>ke(t,{...ye(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=k(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},fe=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>Be(t+(ee(e,s,o,r)??t),void 0,u,o),Me=({tableId:e,rowId:s,store:t,cellComponent:o=fe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(m(((e,s,t,o)=>{const r=_(s,t,o);return e??r})(u,e,s,t),(u=>ke(o,{...ye(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),De=e=>Te(e,Z(e.tableId,e.store)),Fe=({valueId:e,store:s,debugIds:o})=>Be(t+(te(e,s)??t),void 0,o,e),Oe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Me,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(M(t),e),i=ue(e,s,l);return Be(m(i,(e=>ke(o,{...ye(r,e),key:e,tableId:p,rowId:e,store:n,debugIds:d}))),u,d,s)},Qe=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>Be(t+(Ie(e,s,o,r)??t),void 0,u,o),Ae=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Qe,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(m(ae(e,s,t),(u=>ke(o,{...ye(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ee=({checkpoints:e,checkpointId:s,debugIds:o})=>Be(ce(s,e)??t,void 0,o,s),Ge=qe((e=>e[0])),We=qe((e=>k(e[1])?[]:[e[1]])),je=qe((e=>e[2]));exports.BackwardCheckpointsView=Ge,exports.CellView=fe,exports.CheckpointView=Ee,exports.CurrentCheckpointView=We,exports.ForwardCheckpointsView=je,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Oe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(m(re(e,s),(r=>ke(t,{...ye(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Pe(e,ne,e.firstRowId),exports.LocalRowsView=e=>Pe(e,le,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>Be(oe(e,s)??t,void 0,o,e),exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:p,queriesById:i,checkpoints:a,checkpointsById:I,children:x})=>{const c=e.useContext(T);return ke(T.Provider,{value:Ve((()=>[s??c[0],{...c[1],...t},o??c[2],{...c[3],...r},u??c[4],{...c[5],...d},l??c[6],{...c[7],...n},p??c[8],{...c[9],...i},a??c[10],{...c[11],...I}]),[s,t,o,r,u,d,l,n,p,i,a,I,c])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Me,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Se(D(t),e),p=de(e,s,d);return Be(k(n)||k(p)?null:ke(o,{...ye(r,p),key:p,tableId:n,rowId:p,store:l,debugIds:u}),void 0,u,s)},exports.ResultCellView=Qe,exports.ResultRowView=Ae,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,ie(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>ve(e,pe(e.queryId,e.queries)),exports.RowView=Me,exports.SliceView=Oe,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Te(r,$(r.tableId,e,s,t,o,r.store)),exports.TableView=De,exports.TablesView=({store:e,tableComponent:s=De,getTableComponentProps:t,separator:o,debugIds:r})=>Be(m(Y(e),(o=>ke(s,{...ye(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})=>Be(m(se(e),(o=>ke(s,{...ye(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=[],o,r=L,u=[],d=!0)=>{const l=B(o);return E((t=>g(l,(o=>g(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},exports.useCell=ee,exports.useCellIds=_,exports.useCellIdsListener=(e,s,t,o,r,u)=>J(C,B(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,d)=>J(c,B(d),o,r,[e,s,t],u),exports.useCheckpoint=ce,exports.useCheckpointIds=xe,exports.useCheckpointIdsListener=(e,s,t)=>J("CheckpointIds",O(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>J("Checkpoint",O(o),s,t,[e]),exports.useCheckpoints=e=>v(e,10),exports.useCheckpointsIds=()=>q(11),exports.useCheckpointsOrCheckpointsById=O,exports.useCreateCheckpoints=(e,s,t)=>z(e,s,t),exports.useCreateIndexes=(e,s,t)=>z(e,s,t),exports.useCreateMetrics=(e,s,t)=>z(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[],u,d=[])=>{const[,l]=U(),n=W((()=>s(e)),[e,...t]);return G((()=>((async()=>{o&&(await o(n),l([]))})(),()=>{n?.destroy(),u?.(n)})),[n,...r,...d]),n},exports.useCreateQueries=(e,s,t)=>z(e,s,t),exports.useCreateRelationships=(e,s,t)=>z(e,s,t),exports.useCreateStore=(e,s=[])=>W(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,d)=>N(r,c,u,d,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>N(t,i,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>N(s,l,t,o,e),exports.useDelTablesCallback=(e,s,t)=>N(e,n,s,t),exports.useDelValueCallback=(e,s,t,o)=>N(s,w,t,o,e),exports.useDelValuesCallback=(e,s,t)=>N(e,b,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>J("DidFinish"+A,B(t),e,s),exports.useGoBackwardCallback=Ce,exports.useGoForwardCallback=we,exports.useGoToCallback=(e,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useIndexIds=e=>H("IndexIds",M(e),[]),exports.useIndexes=e=>v(e,4),exports.useIndexesIds=()=>q(5),exports.useIndexesOrIndexesById=M,exports.useLinkedRowIds=ne,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>J("Linked"+I,D(r),t,o,[e,s]),exports.useLocalRowIds=le,exports.useLocalRowIdsListener=(e,s,t,o,r)=>J("Local"+I,D(r),t,o,[e,s]),exports.useMetric=oe,exports.useMetricIds=e=>H("MetricIds",f(e),[]),exports.useMetricListener=(e,s,t,o)=>J("Metric",f(o),s,t,[e]),exports.useMetrics=e=>v(e,2),exports.useMetricsIds=()=>q(3),exports.useMetricsOrMetricsById=f,exports.useQueries=e=>v(e,8),exports.useQueriesIds=()=>q(9),exports.useQueriesOrQueriesById=F,exports.useQueryIds=e=>H("QueryIds",F(e),[]),exports.useRedoInformation=e=>{const s=O(e),[,,[o]]=xe(s);return[!k(o),we(s),o,g(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>H("RelationshipIds",D(e),[]),exports.useRelationships=e=>v(e,6),exports.useRelationshipsIds=()=>q(7),exports.useRelationshipsOrRelationshipsById=D,exports.useRemoteRowId=de,exports.useRemoteRowIdListener=(e,s,t,o,r)=>J("RemoteRowId",D(r),t,o,[e,s]),exports.useResultCell=Ie,exports.useResultCellIds=ae,exports.useResultCellIdsListener=(e,s,t,o,r)=>J(u+C,F(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,d)=>J(u+c,F(d),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>H(u+i,F(t),{},[e,s]),exports.useResultRowCount=(e,s)=>H(u+a,F(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>J(u+a,F(o),s,t,[e]),exports.useResultRowIds=pe,exports.useResultRowIdsListener=(e,s,t,o)=>J(u+I,F(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>J(u+i,F(r),t,o,[e,s]),exports.useResultSortedRowIds=ie,exports.useResultSortedRowIdsListener=(e,s,t,o,r,d,l,n)=>J(u+x,F(n),d,l,[e,s,t,o,r]),exports.useResultTable=(e,s)=>H(u+l,F(s),{},[e]),exports.useResultTableCellIds=(e,s)=>H(u+l+C,F(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>J(u+l+C,F(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>J(u+l,F(o),s,t,[e]),exports.useRow=(e,s,t)=>H(i,B(t),{},[e,s]),exports.useRowCount=(e,s)=>H(a,B(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>J(a,B(r),s,t,[e],o),exports.useRowIds=Z,exports.useRowIdsListener=(e,s,t,o,r)=>J(I,B(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>J(i,B(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,d,l)=>K(u,c,o,r,d,l,e,s,t),exports.useSetCheckpointCallback=(e=L,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>K(r,"PartialRow",t,o,u,d,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>K(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,d)=>K(r,i,t,o,u,d,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>K(o,l,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>K(t,n,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>K(o,w,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>K(t,b,e,s,o,r),exports.useSliceIds=re,exports.useSliceIdsListener=(e,s,t,o)=>J("SliceIds",M(o),s,t,[e]),exports.useSliceRowIds=ue,exports.useSliceRowIdsListener=(e,s,t,o,r)=>J("Slice"+I,M(r),t,o,[e,s]),exports.useSortedRowIds=$,exports.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>J(x,B(n),u,d,[e,s,t,o,r],l),exports.useStartTransactionListener=(e,s,t)=>J("Start"+A,B(t),e,s),exports.useStore=e=>v(e,0),exports.useStoreIds=()=>q(1),exports.useStoreOrStoreById=B,exports.useTable=(e,s)=>H(l,B(s),{},[e]),exports.useTableCellIds=(e,s)=>H(l+C,B(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>J(l+C,B(r),s,t,[e],o),exports.useTableIds=Y,exports.useTableIdsListener=(e,s,t,o)=>J(p,B(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>J(l,B(r),s,t,[e],o),exports.useTables=e=>H(n,B(e),{}),exports.useTablesListener=(e,s,t,o)=>J(n,B(o),e,s,[],t),exports.useUndoInformation=e=>{const s=O(e),[o,r]=xe(s);return[(u=o,!(0==u.length)),Ce(s),r,g(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=te,exports.useValueIds=se,exports.useValueIdsListener=(e,s,t,o)=>J(R,B(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>J(w,B(r),s,t,[e],o),exports.useValues=e=>H(b,B(e),{}),exports.useValuesListener=(e,s,t,o)=>J(b,B(o),e,s,[],t),exports.useWillFinishTransactionListener=(e,s,t)=>J("WillFinish"+A,B(t),e,s);
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),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,N=e=>t(e)==a,P=e=>Array.isArray(e),E=(e,l,t)=>e.slice(l,t),L=e=>e.length,{PureComponent:M,Fragment:j,createElement:z,useCallback:$,useLayoutEffect:A,useRef:F,useState:J}=e,H=(e,...l)=>R(e)?{}:e(...l),D=(e,l)=>e.forEach(l),B=(e,l)=>e.map(l),Q=e=>0==L(e),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)=>B(K.entries(e),(([e,t])=>l(t,e))),ne=e=>Z(e)&&0==(e=>L(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)=>B(e.sort(),l),ge=(e,t)=>[!!l.useCell(ue,e,be,t),$((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=B([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>ye+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+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,Ne=Object.prototype.hasOwnProperty,Pe=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={}))Ne.call(l,t)&&Ee(e,t,l[t]);if(qe)for(var t of qe(l))Pe.call(l,t)&&Ee(e,t,l[t]);return e},Me=(e,l)=>Re(e,Oe(l));const je="*::-webkit-scrollbar",ze=`#${oe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,l="")=>e.join(l))(te(Me(Le(Me(Le(Me(Le({"*":"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},_(B(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),_(B(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Ce,"header>img:nth-of-type(6)":ke}),_(B(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,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?`& ${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:z("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 z("details",{open:a,onToggle:i},z("summary",null,t,s?z("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)=>B(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:z(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(P(r)?_(B(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]})=>z("table",{className:e},i?z("caption",null,i):null,!1===l?null:z("thead",null,z("tr",null,!1===t?null:z(hl,{sort:null!=o?o:[],label:"Id",onClick:a}),te(n,(({label:e},l)=>z(hl,{key:l,cellId:l,label:e,sort:null!=o?o:[],onClick:a}))))),z("tbody",null,B(r,(e=>z("tr",{key:e},!1===t?null:z("th",null,e),te(n,(({component:l,getComponentProps:t},n)=>z("td",{key:n},z(l,Ze(Ye(Ye({},H(t,e,n)),s),{rowId:e,cellId:n})))))))))),hl=({cellId:e,sort:[l,t],label:s=(null!=e?e:n),onClick:r})=>z("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 z("tr",null,!1===n?null:z(e.Fragment,null,z("th",null,t),z("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:z("td",{key:n},z(e,Ze(Ye({},H(l,i,a)),{store:u,tableId:s,rowId:i,cellId:a})))})))},bl=({thing:e,onThingChange:l,className:t,hasSchema:n,showType:a=!0})=>{const[i,u]=tl(),[d,c]=tl(),[h,m]=tl(),[b,p]=tl(),[v,g]=tl();d!==e&&(u(Fe(e)),c(e),m(e+""),p(Number(e)||0),g(!!e));const I=el(((e,t)=>{t(e),c(e),l(e)}),[l]),f=el((()=>{if(!(null==n?void 0:n())){const e=De(i,o,r,s),t=De(e,h,b,v);u(e),c(t),l(t)}}),[n,l,h,b,v,i]);return z("div",{className:t},a?z("button",{className:i,onClick:f},i):null,De(i,z("input",{key:i,value:h,onChange:el((e=>I(e[C][x]+"",m)),[I])}),z("input",{key:i,type:"number",value:b,onChange:el((e=>I(Number(e[C][x]||0),p)),[I])}),z("input",{key:i,type:"checkbox",checked:v,onChange:el((e=>I(!!e[C].checked,g)),[I])})))},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 z(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})=>z("table",{className:r},!1===o?null:z("thead",null,z("tr",null,!1===a?null:z("th",null,"Id"),z("th",null,f))),z("tbody",null,B(l.useValueIds(e),(l=>z("tr",{key:l},!1===a?null:z("th",null,l),z("td",null,z(n,Ze(Ye({},H(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 z(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 z("table",{className:o},!1===a?null:z("thead",null,z("tr",null,!1===i?null:z(e.Fragment,null,z("th",null,c,".Id"),z("th",null,h,".Id")),te(m,(({label:e},l)=>z("th",{key:l},e))))),z("tbody",null,B(l.useRowIds(c,d),(e=>z(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 z(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,showType:o})=>{var a;return z(bl,{thing:l.useCell(e,t,n,s),onThingChange:l.useSetCellCallback(e,t,n,(e=>e),[],s),className:null!=r?r:nl+g,showType:o,hasSchema:null==(a=l.useStoreOrStoreById(s))?void 0:a.hasTablesSchema})},wl=({valueId:e,store:t,className:n,showType:s})=>{var r;return z(bl,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=n?n:nl+f,showType:s,hasSchema:null==(r=l.useStoreOrStoreById(t))?void 0:r.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 z(e.Fragment,null,t>s&&z(e.Fragment,null,z("button",{className:"previous",disabled:0==n,onClick:a},"←"),z("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})=>z(Ae,{uniqueId:pe("i",t,n),summary:"Index: "+n,s:s},B(l.useSliceIds(n,e),(l=>z(kl,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),kl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=pe("i",l,t,n),[o,a]=ge(r,s);return z(Ae,{uniqueId:r,summary:"Slice: "+n,editable:o,handleEditable:a,s:s},z(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:z(Ae,{uniqueId:pe("i",e),summary:"Indexes: "+(null!=e?e:u),s:t},Q(s)?"No indexes defined":ve(s,(l=>z(xl,{indexes:n,indexesId:e,indexId:l,s:t,key:l}))))},Tl=({metrics:e,metricId:t})=>z("tr",null,z("th",null,t),z("td",null,null==e?void 0:e.getTableId(t)),z("td",null,l.useMetric(t,e))),Vl=({metricsId:e,s:t})=>{const n=l.useMetrics(e),s=l.useMetricIds(n);return R(n)?null:z(Ae,{uniqueId:pe("m",e),summary:"Metrics: "+(null!=e?e:u),s:t},Q(s)?"No metrics defined":z("table",null,z("thead",null,z("th",null,"Metric Id"),z("th",null,"Table Id"),z("th",null,"Metric")),z("tbody",null,B(s,(e=>z(Tl,{metrics:n,metricId:e,key: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 z(Ae,{uniqueId:o,summary:"Query: "+n,s:s},z(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:z(Ae,{uniqueId:pe("q",e),summary:"Queries: "+(null!=e?e:u),s:t},Q(s)?"No queries defined":ve(s,(l=>z(Rl,{queries:n,queriesId:e,queryId:l,s:t,key:l}))))},ql=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=pe("r",l,t),[r,o]=ge(s,n);return z(Ae,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:o,s:n},z(Il,{relationshipId:t,relationships:e,editable:r}))},Nl=({relationshipsId:e,s:t})=>{const n=l.useRelationships(e),s=l.useRelationshipIds(n);return R(n)?null:z(Ae,{uniqueId:pe("r",e),summary:"Relationships: "+(null!=e?e:u),s:t},Q(s)?"No relationships defined":ve(s,(l=>z(ql,{relationships:n,relationshipsId:e,relationshipId:l,s:t,key:l}))))},Pl=({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 z(Ae,{uniqueId:o,summary:c+": "+e,editable:h,handleEditable:m,s:s},z(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 Q(l.useValueIds(e))?null:z(Ae,{uniqueId:s,summary:y,editable:r,handleEditable:o,s:n},z(vl,{store:e,editable:r}))},Ll=({storeId:e,s:t})=>{const n=l.useStore(e),s=l.useTableIds(n);return R(n)?null:z(Ae,{uniqueId:pe("s",e),summary:"Store: "+(null!=e?e:u),s:t},z(El,{storeId:e,store:n,s:t}),ve(s,(l=>z(Pl,{store:n,storeId:e,tableId:l,s:t,key:l}))))},Ml=({s:e})=>{const t=F(null),n=F(0),[s,r]=J(!1),{scrollLeft:o,scrollTop:a}=l.useValues(e);A((()=>{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=$((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)&&Q(d)&&R(c)&&Q(h)&&R(m)&&Q(b)&&R(p)&&Q(v)&&R(g)&&Q(I)?z("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):z("article",{ref:t,onScroll:i},z(Ll,{s:e}),B(d,(l=>z(Ll,{storeId:l,s:e,key:l}))),z(Vl,{s:e}),B(h,(l=>z(Vl,{metricsId:l,s:e,key:l}))),z(Sl,{s:e}),B(b,(l=>z(Sl,{indexesId:l,s:e,key:l}))),z(Nl,{s:e}),B(v,(l=>z(Nl,{relationshipsId:l,s:e,key:l}))),z(Ol,{s:e}),B(I,(l=>z(Ol,{queriesId:l,s:e,key:l}))))};class jl extends M{constructor(e){super(e),this.componentDidCatch=(e,l)=>console.error(e,l.componentStack),this.state={e:0}}render(){return this.state.e?z("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}jl.getDerivedStateFromError=()=>({e:1});const zl=({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 z("header",null,z("img",{title:ae}),z("span",null,ae),B(ie,((e,l)=>l==n?null:z("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),z("img",{onClick:s,title:"Close"}))},$l=({s:e})=>{var t;const n=null!=(t=l.useValue(he,e))?t:1;return l.useValue(me,e)?z("main",{"data-position":n},z(zl,{s:e}),z(jl,null,z(Ml,{s:e}))):null},Al=e=>l=>{return t=(l,t)=>l+e(t),Wl(l).reduce(t,0);var t},Fl=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},Jl=Al(Fl),Hl=Al(Jl),Dl=Al(Hl),Bl=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Ql=e=>R(e)||0==Fl(e),Wl=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Gl=e=>e.clear(),Kl=(e,l)=>null==e?void 0:e.forEach(l),Ul=(e,l)=>null==e?void 0:e.delete(l),Xl=e=>new Map(e),Yl=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},Zl=(e,l)=>null==e?void 0:e.get(l),_l=(e,l)=>Kl(e,((e,t)=>l(t,e))),et=(e,l,t)=>R(t)?(Ul(e,l),e):null==e?void 0:e.set(l,t),lt=(e,l,t)=>(Bl(e,l)||et(e,l,t()),Zl(e,l)),tt=(e,l,t,n=et)=>(te(l,((l,n)=>t(e,n,l))),_l(e,(t=>ee(l,t)?0:n(e,t))),e),nt=(e,l,t)=>{const n={};return Kl(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},st=(e,l,t)=>nt(e,(e=>nt(e,l,t)),ne),rt=(e,l,t)=>nt(e,(e=>st(e,l,t)),ne),ot=(e,l)=>{const t=Xl();return Kl(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},at=e=>ot(e,ot),it=e=>ot(e,at),ut=(e,l,t,n,s=0)=>O((t?lt:Zl)(e,l[s],s>L(l)-2?t:Xl),(r=>{if(s>L(l)-2)return(null==n?void 0:n(r))&&et(e,l[s]),r;const o=ut(r,l,t,n,s+1);return Ql(r)&&et(e,l[s]),o}));var dt=(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 ct=Xl(),ht=Xl();var mt=(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 bt="storage",pt=globalThis.window,vt=e=>new Set(P(e)||R(e)?e:[e]),gt=(e,l)=>null==e?void 0:e.add(l),It=/^\d+$/,ft=()=>{const e=[];let l=0;return[t=>{var s;return null!=(s=t?G(e):null)?s:n+l++},l=>{It.test(l)&&L(e)<1e3&&W(e,l)}]},yt=e=>[e,e],wt=(e,l=Jl)=>l(e[0])+l(e[1]),Ct=()=>[Xl(),Xl()],xt=e=>[...e],kt=([e,l])=>e===l,St=(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)),Tt=(e,l,t)=>et(e,l,Zl(e,l)==-t?void 0:t),Vt=()=>{let e,l,t=!1,s=!1,r=0;const a=Xl(),d=Xl(),C=Xl(),x=Xl(),S=Xl(),T=Xl(),V=Xl(),P=Xl(),M=Xl(),j=Xl(),z=Xl(),$=Xl(),A=Xl(),F=Xl(),J=vt(),H=Xl(),Q=Xl(),G=Xl(),K=Xl(),U=Ct(),X=Ct(),Z=Ct(),_=Ct(),oe=Ct(),ae=Ct(),ie=Ct(),ue=Ct(),de=Ct(),ce=Ct(),he=Ct(),me=Ct(),be=Ct(),pe=Ct(),ve=Ct(),ge=Xl(),Ie=Ct(),[fe,ye,we,Ce]=(e=>{let l;const[t,s]=ft(),r=Xl();return[(e,s,o,a=[],i=(()=>[]))=>{null!=l||(l=Al);const u=t(1);return et(r,u,[e,s,o,a,i]),gt(ut(s,null!=o?o:[n],vt),u),u},(e,t,...s)=>D(((e,l=[n])=>{const t=[],s=(e,n)=>n==L(l)?W(t,e):null===l[n]?Kl(e,(e=>s(e,n+1))):D([l[n],null],(l=>s(Zl(e,l),n+1)));return s(e,0),t})(e,t),(e=>Kl(e,(e=>Zl(r,e)[0](l,...null!=t?t:[],...s))))),e=>O(Zl(r,e),(([,l,t])=>(ut(l,null!=t?t:[n],void 0,(l=>(Ul(l,e),Ql(l)?1:0))),et(r,e),s(e),t))),e=>O(Zl(r,e),(([e,,t=[],n,s])=>{const r=(...o)=>{var a,i;const u=L(o);u==L(t)?e(l,...o,...s(o)):R(t[u])?D(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(!St(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||Bl(z,t)||nl(t))&&St(l,((e,l)=>Se(t,l,e)),(()=>nl(t))),Se=(e,l,t,n)=>St(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(Zl(Zl(z,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)=>St(l?e:qe(e),((l,t)=>O(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?O(Zl(A,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(Zl($,l),(([n,s])=>{Kl(n,((l,t)=>{ee(e,t)||(e[t]=l)})),Kl(s,(n=>{ee(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Kl(F,((l,t)=>{ee(e,t)||(e[t]=l)})),Kl(J,(l=>{ee(e,l)||sl(l)}))),e),Ne=e=>tt(z,e,((e,l,t)=>{const n=Xl(),s=vt();tt(lt(z,l,Xl),t,((e,l,t)=>{et(e,l,t),O(t[u],(e=>et(n,l,e)),(()=>gt(s,l)))})),et($,l,[n,s])}),((e,l)=>{et(z,l),et($,l)})),Pe=e=>tt(A,e,((e,l,t)=>{et(A,l,t),O(t[u],(e=>et(F,l,e)),(()=>gt(J,l)))}),((e,l)=>{et(A,l),et(F,l),Ul(J,l)})),Ee=e=>ne(e)?ql():Sl(e),Le=e=>tt(G,e,((e,l,t)=>Me(l,t)),((e,l)=>Ge(l))),Me=(e,l)=>tt(lt(G,e,(()=>(Ye(e,1),et(H,e,ft()),et(Q,e,Xl()),Xl()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ke(e,l,t))),je=(e,l,t,n,s)=>tt(lt(l,t,(()=>(Ze(e,t,1),Xl()))),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)=>{Bl(t,n)||_e(e,l,n,1);const r=Zl(t,n);s!==r&&(el(e,l,n,r,s),et(t,n,s))},$e=(e,l,t,n,s)=>O(Zl(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=>tt(K,e,((e,l,t)=>Be(l,t)),((e,l)=>Xe(l))),Be=(e,l)=>{Bl(K,e)||ll(e,1);const t=Zl(K,e);l!==t&&(tl(e,t,l),et(K,e,l))},Qe=(e,l)=>{const[t]=Zl(H,e),n=t(l);return Bl(Zl(G,e),n)?Qe(e,l):n},We=e=>{var l;return null!=(l=Zl(G,e))?l:Me(e,{})},Ge=e=>Me(e,{}),Ke=(e,l,t)=>{const[,n]=Zl(H,e);n(t),je(e,l,t,{},!0)},Ue=(e,l,t,n,s,r)=>{var o;const a=Zl(null==(o=Zl($,e))?void 0:o[0],s);if(!R(a)&&!r)return ze(e,t,n,s,a);const i=l=>{el(e,t,l,Zl(n,l)),_e(e,t,l,-1),et(n,l)};R(a)?i(s):_l(n,i),Ql(n)&&(Ze(e,t,-1),Ql(et(l,t))&&(Ye(e,-1),et(G,e),et(H,e),et(Q,e)))},Xe=e=>{const l=Zl(F,e);if(!R(l))return Be(e,l);tl(e,Zl(K,e)),ll(e,-1),et(K,e)},Ye=(e,l)=>Tt(a,e,l),Ze=(e,l,t)=>Tt(lt(x,e,Xl),l,t)&&et(C,e,lt(C,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=Zl(Q,e),o=null!=(s=Zl(r,t))?s:0;(0==o&&1==n||1==o&&-1==n)&&Tt(lt(d,e,Xl),t,n),et(r,t,o!=-n?o+n:null),Tt(lt(lt(S,e,Xl),l,Xl),t,n)},el=(e,l,t,n,s)=>lt(lt(lt(T,e,Xl),l,Xl),t,(()=>[n,0]))[1]=s,ll=(e,l)=>Tt(V,e,l),tl=(e,l,t)=>lt(P,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(W(lt(lt(lt(M,e,Xl),l,Xl),t,(()=>[])),n),s),sl=(e,l,t)=>(W(lt(j,e,(()=>[])),l),t),rl=(e,l,t)=>O(Zl(Zl(Zl(T,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...yt(wl(e,l,t))])),ol=e=>O(Zl(P,e),(([e,l])=>[!0,e,l]),(()=>[!1,...yt(kl(e))])),al=e=>Ql(M)||Ql(he[e])?0:Kl(e?it(M):M,((l,t)=>Kl(l,((l,n)=>Kl(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Ql(j)||Ql(me[e])?0:Kl(e?ot(j):j,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Ql(l))return ye(e,t,(()=>nt(l))),1},dl=e=>{const l=Ql(ie[e]),t=Ql(de[e])&&Ql(_[e])&&Ql(oe[e])&&Ql(ae[e])&&l&&Ql(X[e]),n=Ql(ce[e])&&Ql(ue[e])&&Ql(Z[e])&&Ql(U[e]);if(!t||!n){const s=e?[ot(a),at(d),ot(C),at(x),it(S),it(T)]:[a,d,C,x,S,T];if(!t){ul(X[e],s[0]),Kl(s[1],((l,t)=>ul(_[e],l,[t]))),Kl(s[2],((l,t)=>{0!=l&&ye(oe[e],[t],gl(t))}));const t=vt();Kl(s[3],((n,s)=>{ul(ae[e],n,[s])&&!l&&(ye(ie[e],[s,null]),gt(t,s))})),l||Kl(s[5],((l,n)=>{if(!Bl(t,n)){const t=vt();Kl(l,(e=>Kl(e,(([l,n],s)=>n!==l?gt(t,s):Ul(e,s))))),Kl(t,(l=>ye(ie[e],[n,l])))}})),Kl(s[4],((l,t)=>Kl(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Kl(s[5],((t,n)=>{let s;Kl(t,((t,r)=>{let o;Kl(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=Ql(pe[e]),t=Ql(ve[e])&&Ql(be[e]);if(!l||!t){const n=e?[ot(V),ot(P)]:[V,P];if(l||ul(pe[e],n[0]),!t){let l;Kl(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(...B(l,k)))),Al),ml=()=>[nt(T,((e,l)=>-1===Zl(a,l)?null:nt(e,((e,t)=>-1===Zl(Zl(x,l),t)?null:nt(e,(([,e])=>null!=e?e:null),((e,l)=>kt(l)))),ne)),ne),nt(P,(([,e])=>null!=e?e:null),((e,l)=>kt(l)))],bl=()=>({cellsTouched:t,valuesTouched:s,changedCells:rt(T,xt,kt),invalidCells:rt(M),changedValues:nt(P,xt,kt),invalidValues:nt(j),changedTableIds:nt(a),changedRowIds:st(x),changedCellIds:rt(S),changedValueIds:nt(V)}),pl=()=>rt(G),vl=()=>Yl(G),gl=e=>Fl(Zl(G,k(e))),Il=e=>Yl(Zl(G,k(e))),fl=(e,l,t,n=0,s)=>{return B(E((o=Zl(G,k(e)),a=(e,t)=>[R(l)?t:Zl(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},B([...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)=>Yl(Zl(Zl(G,k(e)),k(l))),wl=(e,l,t)=>Zl(Zl(Zl(G,k(e)),k(l)),k(t)),Cl=()=>nt(K),xl=()=>Yl(K),kl=e=>Zl(K,k(e)),Sl=e=>hl((()=>(e=>St(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=St(l,(e=>St(e,xe))))&&(Ne(l),!Ql(G))){const e=pl();ql(),Sl(e)}})),Ol=e=>hl((()=>{if(l=(e=>St(e,xe))(e)){const t=Cl();Ml(),El(),l=!0,Pe(e),Tl(t)}})),ql=()=>hl((()=>Le({}))),Nl=e=>hl((e=>Bl(G,e)?Ge(e):0),e),Pl=(e,l)=>hl(((e,l)=>O(Zl(G,e),(t=>Bl(t,l)?Ke(e,t,l):0))),e,l),El=()=>hl((()=>De({}))),Ll=()=>hl((()=>{Ne({}),e=!1})),Ml=()=>hl((()=>{Pe({}),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=!Ql(T),s=!Ql(P),r=1,al(1),t&&dl(1),il(1),s&&cl(1),(null==e?void 0:e(ml,bl))&&(Kl(T,((e,l)=>Kl(e,((e,t)=>Kl(e,(([e],n)=>Je(Al,l,t,n,e))))))),Kl(P,(([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,D([a,d,C,x,S,T,M,V,P,j],Gl))),Al),Al={getContent:()=>[pl(),Cl()],getTables:pl,getTableIds:vl,getTable:e=>st(Zl(G,k(e))),getTableCellIds:e=>Yl(Zl(Q,k(e))),getRowCount:gl,getRowIds:Il,getSortedRowIds:fl,getRow:(e,l)=>nt(Zl(Zl(G,k(e)),k(l))),getCellIds:yl,getCell:wl,getValues:Cl,getValueIds:xl,getValue:kl,hasTables:()=>!Ql(G),hasTable:e=>Bl(G,k(e)),hasTableCell:(e,l)=>Bl(Zl(Q,k(e)),k(l)),hasRow:(e,l)=>Bl(Zl(G,k(e)),k(l)),hasCell:(e,l,t)=>Bl(Zl(Zl(G,k(e)),k(l)),k(t)),hasValues:()=>!Ql(K),hasValue:e=>Bl(K,k(e)),getTablesJson:()=>se(G),getValuesJson:()=>se(K),getJson:()=>se([G,K]),getTablesSchemaJson:()=>se(z),getValuesSchemaJson:()=>se(A),getSchemaJson:()=>se([z,A]),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,N(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,N(l)?l(kl(e)):l),(l=>Be(e,l)))),e),setTransactionChanges:e=>hl((()=>{te(e[0],((e,l)=>R(e)?Nl(l):te(e,((e,t)=>R(e)?Pl(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=>hl((()=>{try{const[l,t]=re(e);Ee(l),Ae(t)}catch(l){Vl(e)}})),setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Nl,delRow:Pl,delCell:(e,l,t,n)=>hl(((e,l,t)=>O(Zl(G,e),(s=>O(Zl(s,l),(r=>Bl(r,t)?Ue(e,s,l,r,t,n):0))))),e,l,t),delValues:El,delValue:e=>hl((e=>Bl(K,e)?Xe(e):0),e),delTablesSchema:Ll,delValuesSchema:Ml,delSchema:()=>hl((()=>{Ll(),Ml()})),transaction:jl,startTransaction:zl,finishTransaction:$l,forEachTable:e=>Kl(G,((l,t)=>e(t,(e=>Kl(l,((l,t)=>e(t,(e=>_l(l,e))))))))),forEachTableCell:(e,l)=>_l(Zl(Q,k(e)),l),forEachRow:(e,l)=>Kl(Zl(G,k(e)),((e,t)=>l(t,(l=>_l(e,l))))),forEachCell:(e,l,t)=>_l(Zl(Zl(G,k(e)),k(l)),t),forEachValue:e=>_l(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,L(i=o)===L(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:wt(U),tableIds:wt(X),tableCellIds:wt(_),table:wt(Z),rowCount:wt(oe),rowIds:wt(ae),sortedRowIds:wt(ie),row:wt(ue,Hl),cellIds:wt(de,Hl),cell:wt(ce,Dl),invalidCell:wt(he,Dl),values:wt(be),valueIds:wt(pe),value:wt(ve),invalidValue:wt(me),transaction:Jl(ge)+wt(Ie)}),createStore:Vt,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=>yt(wl(...e))],InvalidCell:[3,he],[y]:[0,be],[w]:[0,pe],[f]:[1,ve,[xl],e=>yt(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?E(s,0,e):void 0,t,n)})),Y(Al)},Rt=({position:e="right",open:t=!1})=>{const n=l.useCreateStore(Vt),s=ie.indexOf(e);return l.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,[o,a]=[],i=[])=>{let u,d,c,h=0,m=0,b=0,p=0;lt(ct,i,(()=>0)),lt(ht,i,(()=>[]));const v=e=>dt(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield g.schedule((()=>dt(void 0,null,(function*(){yield e(),h=0}))))),g})),g={load:(t,n)=>dt(void 0,null,(function*(){return yield v((()=>dt(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>dt(void 0,[...t],(function*(t={},s={}){return g.stopAutoLoad(),yield g.load(t,s),p=1,c=n(((t,n)=>dt(void 0,null,(function*(){if(n){const l=n();yield v((()=>dt(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield v((()=>dt(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),g})),stopAutoLoad:()=>(p&&(s(c),c=void 0,p=0),g),save:l=>dt(void 0,null,(function*(){return 1!=h&&(h=2,b++,yield g.schedule((()=>dt(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}h=0}))))),g})),startAutoSave:()=>dt(void 0,null,(function*(){return yield g.stopAutoSave().save(),u=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();ne(t)&&ne(n)||g.save((()=>[t,n]))})),g})),stopAutoSave:()=>(O(u,e.delListener),u=void 0,g),schedule:(...e)=>dt(void 0,null,(function*(){return W(Zl(ht,i),...e),yield dt(void 0,null,(function*(){if(!Zl(ct,i)){for(et(ct,i,1);!R(d=G(Zl(ht,i)));)try{yield d()}catch(e){null==r||r(e)}et(ct,i,0)}})),g})),getStore:()=>e,destroy:()=>g.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:m,saves:b})};return o&&(g[o]=()=>a),Y(g)})(e,(()=>mt(void 0,null,(function*(){return re(t.getItem(l))}))),(e=>mt(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 pt.addEventListener(bt,n),n}),(e=>pt.removeEventListener(bt,e)),n,["getStorageName",l]))(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})),z(j,null,z("aside",{id:oe},z($e,{s:n}),z($l,{s:n})),z("style",null,ze))};var Ot=Object.defineProperty,qt=Object.getOwnPropertySymbols,Nt=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable,Et=(e,l,t)=>l in e?Ot(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 z(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=>z(Rt,((e,l)=>{for(var t in l||(l={}))Nt.call(l,t)&&Et(e,t,l[t]);if(qt)for(var t of qt(l))Pt.call(l,t)&&Et(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 z(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
+ "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,N=e=>t(e)==a,P=e=>Array.isArray(e),E=(e,l,t)=>e.slice(l,t),L=e=>e.length,{PureComponent:M,Fragment:j,createElement:z,useCallback:$,useLayoutEffect:A,useRef:F,useState:J}=e,H=(e,...l)=>R(e)?{}:e(...l),D=(e,l)=>e.forEach(l),B=(e,l)=>e.map(l),Q=e=>0==L(e),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)=>B(K.entries(e),(([e,t])=>l(t,e))),ne=e=>Z(e)&&0==(e=>L(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)=>B(e.sort(),l),ge=(e,t)=>[!!l.useCell(ue,e,be,t),$((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=B([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>ye+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+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,Ne=Object.prototype.hasOwnProperty,Pe=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={}))Ne.call(l,t)&&Ee(e,t,l[t]);if(qe)for(var t of qe(l))Pe.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},_(B(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),_(B(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Ce,"header>img:nth-of-type(6)":ke}),_(B(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:z("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 z("details",{open:a,onToggle:i},z("summary",null,t,s?z("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)=>B(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:z(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(P(r)?_(B(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]})=>z("table",{className:e},i?z("caption",null,i):null,!1===l?null:z("thead",null,z("tr",null,!1===t?null:z(hl,{sort:null!=o?o:[],label:"Id",onClick:a}),te(n,(({label:e},l)=>z(hl,{key:l,cellId:l,label:e,sort:null!=o?o:[],onClick:a}))))),z("tbody",null,B(r,(e=>z("tr",{key:e},!1===t?null:z("th",null,e),te(n,(({component:l,getComponentProps:t},n)=>z("td",{key:n},z(l,Ze(Ye(Ye({},H(t,e,n)),s),{rowId:e,cellId:n})))))))))),hl=({cellId:e,sort:[l,t],label:s=(null!=e?e:n),onClick:r})=>z("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 z("tr",null,!1===n?null:z(e.Fragment,null,z("th",null,t),z("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:z("td",{key:n},z(e,Ze(Ye({},H(l,i,a)),{store:u,tableId:s,rowId:i,cellId:a})))})))},bl=({thing:e,onThingChange:l,className:t,hasSchema:n,showType:a=!0})=>{const[i,u]=tl(),[d,c]=tl(),[h,m]=tl(),[b,p]=tl(),[v,g]=tl();d!==e&&(u(Fe(e)),c(e),m(e+""),p(Number(e)||0),g(!!e));const I=el(((e,t)=>{t(e),c(e),l(e)}),[l]),f=el((()=>{if(!(null==n?void 0:n())){const e=De(i,o,r,s),t=De(e,h,b,v);u(e),c(t),l(t)}}),[n,l,h,b,v,i]);return z("div",{className:t},a?z("button",{className:i,onClick:f},i):null,De(i,z("input",{key:i,value:h,onChange:el((e=>I(e[C][x]+"",m)),[I])}),z("input",{key:i,type:"number",value:b,onChange:el((e=>I(Number(e[C][x]||0),p)),[I])}),z("input",{key:i,type:"checkbox",checked:v,onChange:el((e=>I(!!e[C].checked,g)),[I])})))},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 z(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})=>z("table",{className:r},!1===o?null:z("thead",null,z("tr",null,!1===a?null:z("th",null,"Id"),z("th",null,f))),z("tbody",null,B(l.useValueIds(e),(l=>z("tr",{key:l},!1===a?null:z("th",null,l),z("td",null,z(n,Ze(Ye({},H(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 z(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 z("table",{className:o},!1===a?null:z("thead",null,z("tr",null,!1===i?null:z(e.Fragment,null,z("th",null,c,".Id"),z("th",null,h,".Id")),te(m,(({label:e},l)=>z("th",{key:l},e))))),z("tbody",null,B(l.useRowIds(c,d),(e=>z(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 z(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,showType:o})=>{var a;return z(bl,{thing:l.useCell(e,t,n,s),onThingChange:l.useSetCellCallback(e,t,n,(e=>e),[],s),className:null!=r?r:nl+g,showType:o,hasSchema:null==(a=l.useStoreOrStoreById(s))?void 0:a.hasTablesSchema})},wl=({valueId:e,store:t,className:n,showType:s})=>{var r;return z(bl,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=n?n:nl+f,showType:s,hasSchema:null==(r=l.useStoreOrStoreById(t))?void 0:r.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 z(e.Fragment,null,t>s&&z(e.Fragment,null,z("button",{className:"previous",disabled:0==n,onClick:a},"←"),z("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})=>z(Ae,{uniqueId:pe("i",t,n),summary:"Index: "+n,s:s},B(l.useSliceIds(n,e),(l=>z(kl,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),kl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=pe("i",l,t,n),[o,a]=ge(r,s);return z(Ae,{uniqueId:r,summary:"Slice: "+n,editable:o,handleEditable:a,s:s},z(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:z(Ae,{uniqueId:pe("i",e),summary:"Indexes: "+(null!=e?e:u),s:t},Q(s)?"No indexes defined":ve(s,(l=>z(xl,{indexes:n,indexesId:e,indexId:l,s:t,key:l}))))},Tl=({metrics:e,metricId:t})=>z("tr",null,z("th",null,t),z("td",null,null==e?void 0:e.getTableId(t)),z("td",null,l.useMetric(t,e))),Vl=({metricsId:e,s:t})=>{const n=l.useMetrics(e),s=l.useMetricIds(n);return R(n)?null:z(Ae,{uniqueId:pe("m",e),summary:"Metrics: "+(null!=e?e:u),s:t},Q(s)?"No metrics defined":z("table",null,z("thead",null,z("th",null,"Metric Id"),z("th",null,"Table Id"),z("th",null,"Metric")),z("tbody",null,B(s,(e=>z(Tl,{metrics:n,metricId:e,key: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 z(Ae,{uniqueId:o,summary:"Query: "+n,s:s},z(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:z(Ae,{uniqueId:pe("q",e),summary:"Queries: "+(null!=e?e:u),s:t},Q(s)?"No queries defined":ve(s,(l=>z(Rl,{queries:n,queriesId:e,queryId:l,s:t,key:l}))))},ql=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=pe("r",l,t),[r,o]=ge(s,n);return z(Ae,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:o,s:n},z(Il,{relationshipId:t,relationships:e,editable:r}))},Nl=({relationshipsId:e,s:t})=>{const n=l.useRelationships(e),s=l.useRelationshipIds(n);return R(n)?null:z(Ae,{uniqueId:pe("r",e),summary:"Relationships: "+(null!=e?e:u),s:t},Q(s)?"No relationships defined":ve(s,(l=>z(ql,{relationships:n,relationshipsId:e,relationshipId:l,s:t,key:l}))))},Pl=({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 z(Ae,{uniqueId:o,summary:c+": "+e,editable:h,handleEditable:m,s:s},z(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 Q(l.useValueIds(e))?null:z(Ae,{uniqueId:s,summary:y,editable:r,handleEditable:o,s:n},z(vl,{store:e,editable:r}))},Ll=({storeId:e,s:t})=>{const n=l.useStore(e),s=l.useTableIds(n);return R(n)?null:z(Ae,{uniqueId:pe("s",e),summary:"Store: "+(null!=e?e:u),s:t},z(El,{storeId:e,store:n,s:t}),ve(s,(l=>z(Pl,{store:n,storeId:e,tableId:l,s:t,key:l}))))},Ml=({s:e})=>{const t=F(null),n=F(0),[s,r]=J(!1),{scrollLeft:o,scrollTop:a}=l.useValues(e);A((()=>{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=$((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)&&Q(d)&&R(c)&&Q(h)&&R(m)&&Q(b)&&R(p)&&Q(v)&&R(g)&&Q(I)?z("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):z("article",{ref:t,onScroll:i},z(Ll,{s:e}),B(d,(l=>z(Ll,{storeId:l,s:e,key:l}))),z(Vl,{s:e}),B(h,(l=>z(Vl,{metricsId:l,s:e,key:l}))),z(Sl,{s:e}),B(b,(l=>z(Sl,{indexesId:l,s:e,key:l}))),z(Nl,{s:e}),B(v,(l=>z(Nl,{relationshipsId:l,s:e,key:l}))),z(Ol,{s:e}),B(I,(l=>z(Ol,{queriesId:l,s:e,key:l}))))};class jl extends M{constructor(e){super(e),this.componentDidCatch=(e,l)=>console.error(e,l.componentStack),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?z("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const zl=({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 z("header",null,z("img",{title:ae}),z("span",null,ae),B(ie,((e,l)=>l==n?null:z("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),z("img",{onClick:s,title:"Close"}))},$l=({s:e})=>{var t;const n=null!=(t=l.useValue(he,e))?t:1;return l.useValue(me,e)?z("main",{"data-position":n},z(zl,{s:e}),z(jl,null,z(Ml,{s:e}))):null},Al=e=>l=>{return t=(l,t)=>l+e(t),Wl(l).reduce(t,0);var t},Fl=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},Jl=Al(Fl),Hl=Al(Jl),Dl=Al(Hl),Bl=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Ql=e=>R(e)||0==Fl(e),Wl=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Gl=e=>e.clear(),Kl=(e,l)=>null==e?void 0:e.forEach(l),Ul=(e,l)=>null==e?void 0:e.delete(l),Xl=e=>new Map(e),Yl=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},Zl=(e,l)=>null==e?void 0:e.get(l),_l=(e,l)=>Kl(e,((e,t)=>l(t,e))),et=(e,l,t)=>R(t)?(Ul(e,l),e):null==e?void 0:e.set(l,t),lt=(e,l,t)=>(Bl(e,l)||et(e,l,t()),Zl(e,l)),tt=(e,l,t,n=et)=>(te(l,((l,n)=>t(e,n,l))),_l(e,(t=>ee(l,t)?0:n(e,t))),e),nt=(e,l,t)=>{const n={};return Kl(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},st=(e,l,t)=>nt(e,(e=>nt(e,l,t)),ne),rt=(e,l,t)=>nt(e,(e=>st(e,l,t)),ne),ot=(e,l)=>{const t=Xl();return Kl(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},at=e=>ot(e,ot),it=e=>ot(e,at),ut=(e,l,t,n,s=0)=>O((t?lt:Zl)(e,l[s],s>L(l)-2?t:Xl),(r=>{if(s>L(l)-2)return(null==n?void 0:n(r))&&et(e,l[s]),r;const o=ut(r,l,t,n,s+1);return Ql(r)&&et(e,l[s]),o}));var dt=(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 ct=Xl(),ht=Xl();var mt=(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 bt="storage",pt=globalThis.window,vt=e=>new Set(P(e)||R(e)?e:[e]),gt=(e,l)=>null==e?void 0:e.add(l),It=/^\d+$/,ft=()=>{const e=[];let l=0;return[t=>{var s;return null!=(s=t?G(e):null)?s:n+l++},l=>{It.test(l)&&L(e)<1e3&&W(e,l)}]},yt=e=>[e,e],wt=(e,l=Jl)=>l(e[0])+l(e[1]),Ct=()=>[Xl(),Xl()],xt=e=>[...e],kt=([e,l])=>e===l,St=(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)),Tt=(e,l,t)=>et(e,l,Zl(e,l)==-t?void 0:t),Vt=()=>{let e,l,t=!1,s=!1,r=0;const a=Xl(),d=Xl(),C=Xl(),x=Xl(),S=Xl(),T=Xl(),V=Xl(),P=Xl(),M=Xl(),j=Xl(),z=Xl(),$=Xl(),A=Xl(),F=Xl(),J=vt(),H=Xl(),Q=Xl(),G=Xl(),K=Xl(),U=Ct(),X=Ct(),Z=Ct(),_=Ct(),oe=Ct(),ae=Ct(),ie=Ct(),ue=Ct(),de=Ct(),ce=Ct(),he=Ct(),me=Ct(),be=Ct(),pe=Ct(),ve=Ct(),ge=Xl(),Ie=Ct(),[fe,ye,we,Ce]=(e=>{let l;const[t,s]=ft(),r=Xl();return[(e,s,o,a=[],i=(()=>[]))=>{null!=l||(l=Al);const u=t(1);return et(r,u,[e,s,o,a,i]),gt(ut(s,null!=o?o:[n],vt),u),u},(e,t,...s)=>D(((e,l=[n])=>{const t=[],s=(e,n)=>n==L(l)?W(t,e):null===l[n]?Kl(e,(e=>s(e,n+1))):D([l[n],null],(l=>s(Zl(e,l),n+1)));return s(e,0),t})(e,t),(e=>Kl(e,(e=>Zl(r,e)[0](l,...null!=t?t:[],...s))))),e=>O(Zl(r,e),(([,l,t])=>(ut(l,null!=t?t:[n],void 0,(l=>(Ul(l,e),Ql(l)?1:0))),et(r,e),s(e),t))),e=>O(Zl(r,e),(([e,,t=[],n,s])=>{const r=(...o)=>{var a,i;const u=L(o);u==L(t)?e(l,...o,...s(o)):R(t[u])?D(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(!St(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||Bl(z,t)||nl(t))&&St(l,((e,l)=>Se(t,l,e)),(()=>nl(t))),Se=(e,l,t,n)=>St(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(Zl(Zl(z,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)=>St(l?e:qe(e),((l,t)=>O(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?O(Zl(A,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(Zl($,l),(([n,s])=>{Kl(n,((l,t)=>{ee(e,t)||(e[t]=l)})),Kl(s,(n=>{ee(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Kl(F,((l,t)=>{ee(e,t)||(e[t]=l)})),Kl(J,(l=>{ee(e,l)||sl(l)}))),e),Ne=e=>tt(z,e,((e,l,t)=>{const n=Xl(),s=vt();tt(lt(z,l,Xl),t,((e,l,t)=>{et(e,l,t),O(t[u],(e=>et(n,l,e)),(()=>gt(s,l)))})),et($,l,[n,s])}),((e,l)=>{et(z,l),et($,l)})),Pe=e=>tt(A,e,((e,l,t)=>{et(A,l,t),O(t[u],(e=>et(F,l,e)),(()=>gt(J,l)))}),((e,l)=>{et(A,l),et(F,l),Ul(J,l)})),Ee=e=>ne(e)?ql():Sl(e),Le=e=>tt(G,e,((e,l,t)=>Me(l,t)),((e,l)=>Ge(l))),Me=(e,l)=>tt(lt(G,e,(()=>(Ye(e,1),et(H,e,ft()),et(Q,e,Xl()),Xl()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ke(e,l,t))),je=(e,l,t,n,s)=>tt(lt(l,t,(()=>(Ze(e,t,1),Xl()))),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)=>{Bl(t,n)||_e(e,l,n,1);const r=Zl(t,n);s!==r&&(el(e,l,n,r,s),et(t,n,s))},$e=(e,l,t,n,s)=>O(Zl(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=>tt(K,e,((e,l,t)=>Be(l,t)),((e,l)=>Xe(l))),Be=(e,l)=>{Bl(K,e)||ll(e,1);const t=Zl(K,e);l!==t&&(tl(e,t,l),et(K,e,l))},Qe=(e,l)=>{const[t]=Zl(H,e),n=t(l);return Bl(Zl(G,e),n)?Qe(e,l):n},We=e=>{var l;return null!=(l=Zl(G,e))?l:Me(e,{})},Ge=e=>Me(e,{}),Ke=(e,l,t)=>{const[,n]=Zl(H,e);n(t),je(e,l,t,{},!0)},Ue=(e,l,t,n,s,r)=>{var o;const a=Zl(null==(o=Zl($,e))?void 0:o[0],s);if(!R(a)&&!r)return ze(e,t,n,s,a);const i=l=>{el(e,t,l,Zl(n,l)),_e(e,t,l,-1),et(n,l)};R(a)?i(s):_l(n,i),Ql(n)&&(Ze(e,t,-1),Ql(et(l,t))&&(Ye(e,-1),et(G,e),et(H,e),et(Q,e)))},Xe=e=>{const l=Zl(F,e);if(!R(l))return Be(e,l);tl(e,Zl(K,e)),ll(e,-1),et(K,e)},Ye=(e,l)=>Tt(a,e,l),Ze=(e,l,t)=>Tt(lt(x,e,Xl),l,t)&&et(C,e,lt(C,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=Zl(Q,e),o=null!=(s=Zl(r,t))?s:0;(0==o&&1==n||1==o&&-1==n)&&Tt(lt(d,e,Xl),t,n),et(r,t,o!=-n?o+n:null),Tt(lt(lt(S,e,Xl),l,Xl),t,n)},el=(e,l,t,n,s)=>lt(lt(lt(T,e,Xl),l,Xl),t,(()=>[n,0]))[1]=s,ll=(e,l)=>Tt(V,e,l),tl=(e,l,t)=>lt(P,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(W(lt(lt(lt(M,e,Xl),l,Xl),t,(()=>[])),n),s),sl=(e,l,t)=>(W(lt(j,e,(()=>[])),l),t),rl=(e,l,t)=>O(Zl(Zl(Zl(T,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...yt(wl(e,l,t))])),ol=e=>O(Zl(P,e),(([e,l])=>[!0,e,l]),(()=>[!1,...yt(kl(e))])),al=e=>Ql(M)||Ql(he[e])?0:Kl(e?it(M):M,((l,t)=>Kl(l,((l,n)=>Kl(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Ql(j)||Ql(me[e])?0:Kl(e?ot(j):j,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Ql(l))return ye(e,t,(()=>nt(l))),1},dl=e=>{const l=Ql(ie[e]),t=Ql(de[e])&&Ql(_[e])&&Ql(oe[e])&&Ql(ae[e])&&l&&Ql(X[e]),n=Ql(ce[e])&&Ql(ue[e])&&Ql(Z[e])&&Ql(U[e]);if(!t||!n){const s=e?[ot(a),at(d),ot(C),at(x),it(S),it(T)]:[a,d,C,x,S,T];if(!t){ul(X[e],s[0]),Kl(s[1],((l,t)=>ul(_[e],l,[t]))),Kl(s[2],((l,t)=>{0!=l&&ye(oe[e],[t],gl(t))}));const t=vt();Kl(s[3],((n,s)=>{ul(ae[e],n,[s])&&!l&&(ye(ie[e],[s,null]),gt(t,s))})),l||Kl(s[5],((l,n)=>{if(!Bl(t,n)){const t=vt();Kl(l,(e=>Kl(e,(([l,n],s)=>n!==l?gt(t,s):Ul(e,s))))),Kl(t,(l=>ye(ie[e],[n,l])))}})),Kl(s[4],((l,t)=>Kl(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Kl(s[5],((t,n)=>{let s;Kl(t,((t,r)=>{let o;Kl(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=Ql(pe[e]),t=Ql(ve[e])&&Ql(be[e]);if(!l||!t){const n=e?[ot(V),ot(P)]:[V,P];if(l||ul(pe[e],n[0]),!t){let l;Kl(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(...B(l,k)))),Al),ml=()=>[nt(T,((e,l)=>-1===Zl(a,l)?null:nt(e,((e,t)=>-1===Zl(Zl(x,l),t)?null:nt(e,(([,e])=>null!=e?e:null),((e,l)=>kt(l)))),ne)),ne),nt(P,(([,e])=>null!=e?e:null),((e,l)=>kt(l)))],bl=()=>({cellsTouched:t,valuesTouched:s,changedCells:rt(T,xt,kt),invalidCells:rt(M),changedValues:nt(P,xt,kt),invalidValues:nt(j),changedTableIds:nt(a),changedRowIds:st(x),changedCellIds:rt(S),changedValueIds:nt(V)}),pl=()=>rt(G),vl=()=>Yl(G),gl=e=>Fl(Zl(G,k(e))),Il=e=>Yl(Zl(G,k(e))),fl=(e,l,t,n=0,s)=>{return B(E((o=Zl(G,k(e)),a=(e,t)=>[R(l)?t:Zl(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},B([...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)=>Yl(Zl(Zl(G,k(e)),k(l))),wl=(e,l,t)=>Zl(Zl(Zl(G,k(e)),k(l)),k(t)),Cl=()=>nt(K),xl=()=>Yl(K),kl=e=>Zl(K,k(e)),Sl=e=>hl((()=>(e=>St(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=St(l,(e=>St(e,xe))))&&(Ne(l),!Ql(G))){const e=pl();ql(),Sl(e)}})),Ol=e=>hl((()=>{if(l=(e=>St(e,xe))(e)){const t=Cl();Ml(),El(),l=!0,Pe(e),Tl(t)}})),ql=()=>hl((()=>Le({}))),Nl=e=>hl((e=>Bl(G,e)?Ge(e):0),e),Pl=(e,l)=>hl(((e,l)=>O(Zl(G,e),(t=>Bl(t,l)?Ke(e,t,l):0))),e,l),El=()=>hl((()=>De({}))),Ll=()=>hl((()=>{Ne({}),e=!1})),Ml=()=>hl((()=>{Pe({}),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=!Ql(T),s=!Ql(P),r=1,al(1),t&&dl(1),il(1),s&&cl(1),(null==e?void 0:e(ml,bl))&&(Kl(T,((e,l)=>Kl(e,((e,t)=>Kl(e,(([e],n)=>Je(Al,l,t,n,e))))))),Kl(P,(([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,D([a,d,C,x,S,T,M,V,P,j],Gl))),Al),Al={getContent:()=>[pl(),Cl()],getTables:pl,getTableIds:vl,getTable:e=>st(Zl(G,k(e))),getTableCellIds:e=>Yl(Zl(Q,k(e))),getRowCount:gl,getRowIds:Il,getSortedRowIds:fl,getRow:(e,l)=>nt(Zl(Zl(G,k(e)),k(l))),getCellIds:yl,getCell:wl,getValues:Cl,getValueIds:xl,getValue:kl,hasTables:()=>!Ql(G),hasTable:e=>Bl(G,k(e)),hasTableCell:(e,l)=>Bl(Zl(Q,k(e)),k(l)),hasRow:(e,l)=>Bl(Zl(G,k(e)),k(l)),hasCell:(e,l,t)=>Bl(Zl(Zl(G,k(e)),k(l)),k(t)),hasValues:()=>!Ql(K),hasValue:e=>Bl(K,k(e)),getTablesJson:()=>se(G),getValuesJson:()=>se(K),getJson:()=>se([G,K]),getTablesSchemaJson:()=>se(z),getValuesSchemaJson:()=>se(A),getSchemaJson:()=>se([z,A]),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,N(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,N(l)?l(kl(e)):l),(l=>Be(e,l)))),e),setTransactionChanges:e=>hl((()=>{te(e[0],((e,l)=>R(e)?Nl(l):te(e,((e,t)=>R(e)?Pl(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=>hl((()=>{try{const[l,t]=re(e);Ee(l),Ae(t)}catch(l){Vl(e)}})),setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Nl,delRow:Pl,delCell:(e,l,t,n)=>hl(((e,l,t)=>O(Zl(G,e),(s=>O(Zl(s,l),(r=>Bl(r,t)?Ue(e,s,l,r,t,n):0))))),e,l,t),delValues:El,delValue:e=>hl((e=>Bl(K,e)?Xe(e):0),e),delTablesSchema:Ll,delValuesSchema:Ml,delSchema:()=>hl((()=>{Ll(),Ml()})),transaction:jl,startTransaction:zl,finishTransaction:$l,forEachTable:e=>Kl(G,((l,t)=>e(t,(e=>Kl(l,((l,t)=>e(t,(e=>_l(l,e))))))))),forEachTableCell:(e,l)=>_l(Zl(Q,k(e)),l),forEachRow:(e,l)=>Kl(Zl(G,k(e)),((e,t)=>l(t,(l=>_l(e,l))))),forEachCell:(e,l,t)=>_l(Zl(Zl(G,k(e)),k(l)),t),forEachValue:e=>_l(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,L(i=o)===L(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:wt(U),tableIds:wt(X),tableCellIds:wt(_),table:wt(Z),rowCount:wt(oe),rowIds:wt(ae),sortedRowIds:wt(ie),row:wt(ue,Hl),cellIds:wt(de,Hl),cell:wt(ce,Dl),invalidCell:wt(he,Dl),values:wt(be),valueIds:wt(pe),value:wt(ve),invalidValue:wt(me),transaction:Jl(ge)+wt(Ie)}),createStore:Vt,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=>yt(wl(...e))],InvalidCell:[3,he],[y]:[0,be],[w]:[0,pe],[f]:[1,ve,[xl],e=>yt(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?E(s,0,e):void 0,t,n)})),Y(Al)},Rt=({position:e="right",open:t=!1})=>{const n=l.useCreateStore(Vt),s=ie.indexOf(e);return l.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,[o,a]=[],i=[])=>{let u,d,c,h=0,m=0,b=0,p=0;lt(ct,i,(()=>0)),lt(ht,i,(()=>[]));const v=e=>dt(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield g.schedule((()=>dt(void 0,null,(function*(){yield e(),h=0}))))),g})),g={load:(t,n)=>dt(void 0,null,(function*(){return yield v((()=>dt(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>dt(void 0,[...t],(function*(t={},s={}){return g.stopAutoLoad(),yield g.load(t,s),p=1,c=n(((t,n)=>dt(void 0,null,(function*(){if(n){const l=n();yield v((()=>dt(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield v((()=>dt(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),g})),stopAutoLoad:()=>(p&&(s(c),c=void 0,p=0),g),save:l=>dt(void 0,null,(function*(){return 1!=h&&(h=2,b++,yield g.schedule((()=>dt(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}h=0}))))),g})),startAutoSave:()=>dt(void 0,null,(function*(){return yield g.stopAutoSave().save(),u=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();ne(t)&&ne(n)||g.save((()=>[t,n]))})),g})),stopAutoSave:()=>(O(u,e.delListener),u=void 0,g),schedule:(...e)=>dt(void 0,null,(function*(){return W(Zl(ht,i),...e),yield dt(void 0,null,(function*(){if(!Zl(ct,i)){for(et(ct,i,1);!R(d=G(Zl(ht,i)));)try{yield d()}catch(e){null==r||r(e)}et(ct,i,0)}})),g})),getStore:()=>e,destroy:()=>g.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:m,saves:b})};return o&&(g[o]=()=>a),Y(g)})(e,(()=>mt(void 0,null,(function*(){return re(t.getItem(l))}))),(e=>mt(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 pt.addEventListener(bt,n),n}),(e=>pt.removeEventListener(bt,e)),n,["getStorageName",l]))(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})),z(j,null,z("aside",{id:oe},z($e,{s:n}),z($l,{s:n})),z("style",null,ze))};var Ot=Object.defineProperty,qt=Object.getOwnPropertySymbols,Nt=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable,Et=(e,l,t)=>l in e?Ot(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 z(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=>z(Rt,((e,l)=>{for(var t in l||(l={}))Nt.call(l,t)&&Et(e,t,l[t]);if(qt)for(var t of qt(l))Pt.call(l,t)&&Et(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 z(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(""),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:p,useLayoutEffect:b,useRef:g,useState:w}=e,f=(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="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",k='content:url("',T=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'>",O='</svg>")',R=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\")",S=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])=>T+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+O)),N=T+"<path d='M20 20l60 60M20 80l60-60' />"+O,V=T+`<path d='${x}' />`+O,P=T+`<path d='${x}M20 20l60 60' />`+O;var j=Object.defineProperty,z=Object.defineProperties,q=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,F=(e,t,l)=>t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,H=(e,t)=>{for(var l in t||(t={}))$.call(t,l)&&F(e,l,t[l]);if(M)for(var l of M(t))E.call(t,l)&&F(e,l,t[l]);return e},B=(e,t)=>z(e,q(t));const D="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(C(B(H(B(H(B(H({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[D]:"width:0.5rem;height:0.5rem;",[D+"-track"]:"background:#111",[D+"-thumb"]:"background:#999;border:1px solid #111",[D+"-thumb:hover"]:"background:#fff",[D+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+R},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)":R,"header>img:nth-of-type(6)":N}),y(v(S,((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":P,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,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?`& ${t}{${e}}`:"")));const A=(e,t,l,o)=>e==r?t:e==a?l:o;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)=>v(t.useTableCellIds(e,l),(t=>e+"."+t)),oe=(e,t,l)=>{const r=_(e,t);return l?r:void 0},ae=(...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,o,a,n,s)=>{const[[i,d,u],c]=te([e,t,r]),m=_((e=>{c(e),null==s||s(e)}),[s]),p=oe((e=>m([e,e==i&&!d,u])),[m,i,d,u],l),b=_((e=>m([i,d,e])),[m,i,d]),g=!0===n?ge:n;return[[i,d,u],p,ee((()=>!1===n?null:h(g,{offset:u,limit:o,total:a,onChange:b})),[n,g,u,o,a,b])]},de=(e,t,o)=>ee((()=>{const a=null!=t?t:e;return y(C(Array.isArray(a)?y(v(a,(e=>[e,e]))):a,((e,t)=>{return[t,X(X({},{label:t,component:o}),(a=e,l(a)==r?{label:e}:e))];var a})))}),[t,o,e]),ue=({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(ce,{sort:null!=n?n:[],label:"Id",onClick:s}),C(r,(({label:e},t)=>h(ce,{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,Y(X(X({},f(l,e,r)),o),{rowId:e,cellId:r})))))))))),ce=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:o})=>h("th",{onClick:oe((()=>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),me=({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,Y(X({},f(t,i,s)),{store:d,tableId:o,rowId:i,cellId:s})))})))},he=({thing:e,onThingChange:t,className:n,hasSchema:u,showType:c=!0})=>{const[m,p]=te(),[b,g]=te(),[w,f]=te(),[v,I]=te(),[y,C]=te();b!==e&&(p((e=>{const t=l(e);return(e=>e==r||e==o)(t)||t==a&&d(e)?t:void 0})(e)),g(e),f(e+""),I(Number(e)||0),C(!!e));const x=_(((e,l)=>{l(e),g(e),t(e)}),[t]),k=_((()=>{if(!(null==u?void 0:u())){const e=A(m,a,o,r),l=A(e,w,v,y);p(e),g(l),t(l)}}),[u,t,w,v,y,m]);return h("div",{className:n},c?h("button",{className:m,onClick:k},m):null,A(m,h("input",{key:m,value:w,onChange:_((e=>x(e[s][i]+"",f)),[x])}),h("input",{key:m,type:"number",value:v,onChange:_((e=>x(Number(e[s][i]||0),I)),[x])}),h("input",{key:m,type:"checkbox",checked:y,onChange:_((e=>x(!!e[s].checked,C)),[x])})))},pe=({tableId:e,rowId:l,cellId:r,store:o,className:a,showType:n})=>{var s;return h(he,{thing:t.useCell(e,l,r,o),onThingChange:t.useSetCellCallback(e,l,r,(e=>e),[],o),className:null!=a?a:le+"Cell",showType:n,hasSchema:null==(s=t.useStoreOrStoreById(o))?void 0:s.hasTablesSchema})},be=({valueId:e,store:l,className:r,showType:o})=>{var a;return h(he,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=r?r:le+n,showType:o,hasSchema:null==(a=t.useStoreOrStoreById(l))?void 0:a.hasValuesSchema})},ge=({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=oe((()=>t(r-o)),[t,r,o],r>0),i=oe((()=>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)};(class extends c{constructor(e){super(e),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 we=e=>new Map(e);we(),we(),exports.EditableCellView=pe,exports.EditableValueView=be,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),p=de([...re(c,u),...re(m,u)],a,o?pe:t.CellView),b=ae(i,p,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(p,(({label:e},t)=>h("th",{key:t},e))))),h("tbody",null,v(t.useRowIds(c,u),(e=>h(me,{key:e,localRowId:e,params:b})))))},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,p=Z(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,g,w]=ie(o,a,d,n,s,t.useResultRowCount(r,i),u,m);return h(ue,Y(X({},p),{params:ae(de(t.useResultTableCellIds(r,i),c,t.ResultCellView),se(i,r),t.useResultSortedRowIds(r,...b,s,i),b,g,w)}))},exports.ResultTableInHtmlTable=e=>{var l=e,{queryId:r,queries:o,customCells:a}=l,n=Z(l,["queryId","queries","customCells"]);return h(ue,Y(X({},n),{params:ae(de(t.useResultTableCellIds(r,o),a,t.ResultCellView),se(o,r),t.useResultRowIds(r,o))}))},exports.SliceInHtmlTable=e=>{var l=e,{indexId:r,sliceId:o,indexes:a,editable:n,customCells:s}=l,i=Z(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(ue,Y(X({},i),{params:ae(de(t.useTableCellIds(c,u),s,n?pe:t.CellView),ne(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:p}=l,b=Z(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,w,f]=ie(o,a,u,n,s,t.useRowCount(r,i),c,m);return h(ue,Y(X({},b),{params:ae(de(t.useTableCellIds(r,i),p,d?pe:t.CellView),ne(i,r),t.useSortedRowIds(r,...g,s,i),g,w,f)}))},exports.SortedTablePaginator=ge,exports.StoreInspector=e=>null,exports.TableInHtmlTable=e=>{var l=e,{tableId:r,store:o,editable:a,customCells:n}=l,s=Z(l,["tableId","store","editable","customCells"]);return h(ue,Y(X({},s),{params:ae(de(t.useTableCellIds(r,o),n,a?pe:t.CellView),ne(o,r),t.useRowIds(r,o))}))},exports.ValuesInHtmlTable=({store:e,editable:l=!1,valueComponent:r=(l?be: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,Y(X({},f(o,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",T='content:url("',O=T+"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=T+"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])=>O+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+R)),V=O+"<path d='M20 20l60 60M20 80l60-60' />"+R,z=O+`<path d='${k}' />`+R,P=O+`<path d='${k}M20 20l60 60' />`+R;var j=Object.defineProperty,$=Object.defineProperties,q=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,B=(e,t,l)=>t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,F=(e,t)=>{for(var l in t||(t={}))E.call(t,l)&&B(e,l,t[l]);if(M)for(var l of M(t))H.call(t,l)&&B(e,l,t[l]);return e},A=(e,t)=>$(e,q(t));const D="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(C(A(F(A(F(A(F({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[D]:"width:0.5rem;height:0.5rem;",[D+"-track"]:"background:#111",[D+"-thumb"]:"background:#999;border:1px solid #111",[D+"-thumb:hover"]:"background:#fff",[D+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+S},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)":S,"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":z,"details[open]>summary img.done":P,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,showType:c=!0})=>{const[m,b]=le(),[p,g]=le(),[f,w]=le(),[v,I]=le(),[y,C]=le();p!==e&&(b((e=>{const t=l(e);return(e=>e==r||e==o)(t)||t==a&&d(e)?t:void 0})(e)),g(e),w(e+""),I(Number(e)||0),C(!!e));const x=ee(((e,l)=>{l(e),g(e),t(e)}),[t]),k=ee((()=>{if(!(null==u?void 0:u())){const e=L(m,a,o,r),l=L(e,f,v,y);b(e),g(l),t(l)}}),[u,t,f,v,y,m]);return h("div",{className:n},c?h("button",{className:m,onClick:k},m):null,L(m,h("input",{key:m,value:f,onChange:ee((e=>x(e[s][i]+"",w)),[x])}),h("input",{key:m,type:"number",value:v,onChange:ee((e=>x(Number(e[s][i]||0),I)),[x])}),h("input",{key:m,type:"checkbox",checked:y,onChange:ee((e=>x(!!e[s].checked,C)),[x])})))},pe=({tableId:e,rowId:l,cellId:r,store:o,className:a,showType:n})=>{var s;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",showType:n,hasSchema:null==(s=t.useStoreOrStoreById(o))?void 0:s.hasTablesSchema})},ge=({valueId:e,store:l,className:r,showType:o})=>{var a;return h(be,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=r?r:re+n,showType:o,hasSchema:null==(a=t.useStoreOrStoreById(l))?void 0:a.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)},we=e=>new Map(e);we(),we(),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