tinybase 5.3.0-beta.0 → 5.3.0-beta.2

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 (87) hide show
  1. package/@types/index.d.cts +0 -2
  2. package/@types/index.d.ts +0 -2
  3. package/@types/persisters/persister-partykit-client/index.d.cts +2 -2
  4. package/@types/persisters/persister-partykit-client/index.d.ts +2 -2
  5. package/@types/persisters/persister-partykit-client/with-schemas/index.d.cts +2 -2
  6. package/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +2 -2
  7. package/@types/ui-react/index.d.cts +88 -0
  8. package/@types/ui-react/index.d.ts +88 -0
  9. package/@types/ui-react/with-schemas/index.d.cts +21 -0
  10. package/@types/ui-react/with-schemas/index.d.ts +21 -0
  11. package/@types/with-schemas/index.d.cts +0 -2
  12. package/@types/with-schemas/index.d.ts +0 -2
  13. package/cjs/es6/min/ui-react/index.cjs +1 -1
  14. package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
  15. package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
  16. package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
  17. package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
  18. package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
  19. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  20. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  21. package/cjs/es6/ui-react/index.cjs +99 -30
  22. package/cjs/es6/ui-react/with-schemas/index.cjs +99 -30
  23. package/cjs/es6/ui-react-inspector/index.cjs +1 -1
  24. package/cjs/es6/ui-react-inspector/with-schemas/index.cjs +1 -1
  25. package/cjs/min/ui-react/index.cjs +1 -1
  26. package/cjs/min/ui-react/index.cjs.gz +0 -0
  27. package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
  28. package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
  29. package/cjs/min/ui-react-inspector/index.cjs +1 -1
  30. package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
  31. package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  32. package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  33. package/cjs/ui-react/index.cjs +73 -31
  34. package/cjs/ui-react/with-schemas/index.cjs +73 -31
  35. package/cjs/ui-react-inspector/index.cjs +1 -1
  36. package/cjs/ui-react-inspector/with-schemas/index.cjs +1 -1
  37. package/es6/min/ui-react/index.js +1 -1
  38. package/es6/min/ui-react/index.js.gz +0 -0
  39. package/es6/min/ui-react/with-schemas/index.js +1 -1
  40. package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  41. package/es6/min/ui-react-inspector/index.js +1 -1
  42. package/es6/min/ui-react-inspector/index.js.gz +0 -0
  43. package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  44. package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  45. package/es6/ui-react/index.js +99 -30
  46. package/es6/ui-react/with-schemas/index.js +99 -30
  47. package/es6/ui-react-inspector/index.js +1 -1
  48. package/es6/ui-react-inspector/with-schemas/index.js +1 -1
  49. package/min/ui-react/index.js +1 -1
  50. package/min/ui-react/index.js.gz +0 -0
  51. package/min/ui-react/with-schemas/index.js +1 -1
  52. package/min/ui-react/with-schemas/index.js.gz +0 -0
  53. package/min/ui-react-inspector/index.js +1 -1
  54. package/min/ui-react-inspector/index.js.gz +0 -0
  55. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  56. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  57. package/package.json +2 -2
  58. package/readme.md +14 -14
  59. package/releases.md +24 -24
  60. package/ui-react/index.js +73 -31
  61. package/ui-react/with-schemas/index.js +73 -31
  62. package/ui-react-inspector/index.js +1 -1
  63. package/ui-react-inspector/with-schemas/index.js +1 -1
  64. package/umd/es6/min/ui-react/index.js +1 -1
  65. package/umd/es6/min/ui-react/index.js.gz +0 -0
  66. package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
  67. package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  68. package/umd/es6/min/ui-react-inspector/index.js +1 -1
  69. package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
  70. package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  71. package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  72. package/umd/es6/ui-react/index.js +102 -34
  73. package/umd/es6/ui-react/with-schemas/index.js +102 -34
  74. package/umd/es6/ui-react-inspector/index.js +2 -1
  75. package/umd/es6/ui-react-inspector/with-schemas/index.js +2 -1
  76. package/umd/min/ui-react/index.js +1 -1
  77. package/umd/min/ui-react/index.js.gz +0 -0
  78. package/umd/min/ui-react/with-schemas/index.js +1 -1
  79. package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
  80. package/umd/min/ui-react-inspector/index.js +1 -1
  81. package/umd/min/ui-react-inspector/index.js.gz +0 -0
  82. package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
  83. package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  84. package/umd/ui-react/index.js +77 -31
  85. package/umd/ui-react/with-schemas/index.js +77 -31
  86. package/umd/ui-react-inspector/index.js +2 -1
  87. package/umd/ui-react-inspector/with-schemas/index.js +2 -1
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("../ui-react/index.cjs");const l=e=>typeof e,n="",s=l(n),r=l(!0),a=l(0),o=l(l),i="type",u="default",d="Has",c="Ids",h="Table",m=h+"s",p=h+c,b="Row",g=b+"Count",v=b+c,f="Cell",I=f+c,y="Value",w=y+"s",C=y+c,k="currentTarget",x="value",S=e=>n+e,T=globalThis.window,V=Math,O=V.min,R=V.floor,q=isFinite,M=e=>null==e,P=(e,t,l)=>M(e)?null==l?void 0:l():t(e),N=e=>e==s||e==r,L=e=>l(e)==o,E=e=>Array.isArray(e),j=(e,t,l)=>e.slice(t,l),z=e=>e.length,$=e=>{throw Error(e)},{PureComponent:A,Fragment:F,createElement:J,useCallback:D,useLayoutEffect:B,useRef:Q,useState:H}=e,W=(e,...t)=>M(e)?{}:e(...t),G=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),U=(e,t)=>e.map(t),X=e=>0==z(e),Y=(e,...t)=>e.push(...t),Z=e=>e.shift(),_=Object,ee=e=>_.getPrototypeOf(e),te=_.entries,le=_.isFrozen,ne=e=>!M(e)&&P(ee(e),(e=>e==_.prototype||M(ee(e))),(()=>!0)),se=_.keys,re=_.freeze,ae=(e=[])=>_.fromEntries(e),oe=(e,t)=>t in e,ie=(e,t)=>(delete e[t],e),ue=(e,t)=>U(te(e),(([e,l])=>t(l,e))),de=e=>ne(e)&&0==(e=>z(se(e)))(e),ce=(e,t,l,n=0)=>M(e)||!ne(e)||!n&&de(e)||le(e)?(null==l||l(),!1):(ue(e,((l,n)=>{t(l,n)||ie(e,n)})),!!n||!de(e)),he=JSON.stringify,me=JSON.parse,pe=e=>he(e,((e,t)=>t instanceof Map?_.fromEntries([...t]):t)),be="tinybaseInspector",ge="TinyBase Inspector",ve=["left","top","bottom","right","full"],fe="state",Ie="sort",ye="open",we="position",Ce=ye,ke="editable",xe=(...e)=>pe(e),Se=(e,t)=>U(G(e),t),Te=(e,l)=>[!!t.useCell(fe,e,ke,l),D((t=>{l.setCell(fe,e,ke,(e=>!e)),t.preventDefault()}),[l,e])],Ve="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Oe='content:url("',Re=Oe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",qe='</svg>")',Me=Oe+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Pe=U([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>Re+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+qe)),Ne=Re+"<path d='M20 20l60 60M20 80l60-60' />"+qe,Le=Re+`<path d='${Ve}' />`+qe,Ee=Re+`<path d='${Ve}M20 20l60 60' />`+qe;var je=Object.defineProperty,ze=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,Ae=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,De=(e,t,l)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Be=(e,t)=>{for(var l in t||(t={}))Fe.call(t,l)&&De(e,l,t[l]);if(Ae)for(var l of Ae(t))Je.call(t,l)&&De(e,l,t[l]);return e},Qe=(e,t)=>ze(e,$e(t));const He="*::-webkit-scrollbar",We=((e,t="")=>e.join(t))(ue(Qe(Be(Qe(Be(Qe(Be({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[He]:"width:0.5rem;height:0.5rem;",[He+"-track"]:"background:#111",[He+"-thumb"]:"background:#999;border:1px solid #111",[He+"-thumb:hover"]:"background:#fff",[He+"-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;"+Me},ae(U(["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;"}),ae(U(["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)":Me,"header>img:nth-of-type(6)":Ne}),ae(U(Pe,((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":Le,"details[open]>summary img.done":Ee,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,#${be} 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?`#${be} ${t}{${e}}`:""))),Ge=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1,s=t.useSetValueCallback(Ce,(()=>!0),[],e);return t.useValue(Ce,e)?null:J("img",{onClick:s,title:ge,"data-position":n})},Ke=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!t.useCell(fe,e,ye,a),i=t.useSetCellCallback(fe,e,ye,(e=>e[k].open),[],a);return J("details",{open:o,onToggle:i},J("summary",null,l,s?J("img",{onClick:s,className:n?"done":"edit"}):null),r)},Ue=e=>{const t=l(e);return N(t)||t==a&&q(e)?t:void 0},Xe=(e,t,l,n,s)=>M(s)?e.delCell(t,l,n,!0):e.setCell(t,l,n,s),Ye=(e,t,l)=>M(l)?e.delValue(t):e.setValue(t,l),Ze=(e,t,l,n)=>e==s?t:e==a?l:n;var _e=Object.defineProperty,et=Object.defineProperties,tt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,nt=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,rt=(e,t,l)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,at=(e,t)=>{for(var l in t||(t={}))nt.call(t,l)&&rt(e,l,t[l]);if(lt)for(var l of lt(t))st.call(t,l)&&rt(e,l,t[l]);return e},ot=(e,t)=>et(e,tt(t)),it=(e,t)=>{var l={};for(var n in e)nt.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&lt)for(var n of lt(e))t.indexOf(n)<0&&st.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:ut,useMemo:dt,useState:ct}=e,ht="editable",mt=(e,l)=>U(t.useTableCellIds(e,l),(t=>e+"."+t)),pt=(e,t,l)=>{const n=ut(e,t);return l?n:void 0},bt=(...e)=>dt((()=>e),e),gt=(e,t)=>dt((()=>({store:e,tableId:t})),[e,t]),vt=(e,t)=>dt((()=>({queries:e,queryId:t})),[e,t]),ft=(e,t=!1,l,n=0,s,r,a,o)=>{const[[i,u,d],c]=ct([e,t,n]),h=ut((e=>{c(e),null==o||o(e)}),[o]),m=pt((e=>h([e,e==i&&!u,d])),[h,i,u,d],l),p=ut((e=>h([i,u,e])),[h,i,u]),b=!0===a?Mt:a;return[[i,u,d],m,dt((()=>!1===a?null:J(b,{offset:d,limit:s,total:r,onChange:p})),[a,b,d,s,r,p])]},It=(e,t,n)=>dt((()=>{const r=null!=t?t:e;return a=E(r)?ae(U(r,(e=>[e,e]))):r,o=(e,t)=>at(at({},{label:t,component:n}),l(e)==s?{label:e}:e),ae(ue(a,((e,t)=>[t,o(e,t)])));var a,o}),[t,n,e]),yt=({className:e,headerRow:t,idColumn:l,params:[n,s,r,a,o,i]})=>J("table",{className:e},i?J("caption",null,i):null,!1===t?null:J("thead",null,J("tr",null,!1===l?null:J(wt,{sort:null!=a?a:[],label:"Id",onClick:o}),ue(n,(({label:e},t)=>J(wt,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:o}))))),J("tbody",null,U(r,(e=>J("tr",{key:e},!1===l?null:J("th",null,e),ue(n,(({component:t,getComponentProps:l},n)=>J("td",{key:n},J(t,ot(at(at({},W(l,e,n)),s),{rowId:e,cellId:n})))))))))),wt=({cellId:e,sort:[t,l],label:s=(null!=e?e:n),onClick:r})=>J("th",{onClick:pt((()=>null==r?void 0:r(e)),[r,e],r),className:M(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},M(l)||t!=e?null:(l?"↓":"↑")+" ",s),Ct=({localRowId:l,params:[n,s,r,a,o,i,u]})=>{const d=t.useRemoteRowId(o,l,i);return J("tr",null,!1===n?null:J(e.Fragment,null,J("th",null,l),J("th",null,d)),ue(s,(({component:e,getComponentProps:t},n)=>{const[s,o]=n.split(".",2),i=s===r?l:s===a?d:null;return M(i)?null:J("td",{key:n},J(e,ot(at({},W(t,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},kt=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:o=!0})=>{const[i,u]=ct(),[d,c]=ct(),[h,m]=ct(),[p,b]=ct(),[g,v]=ct();d!==e&&(u(Ue(e)),c(e),m(e+""),b(Number(e)||0),v(!!e));const f=ut(((e,l)=>{l(e),c(e),t(e)}),[t]),I=ut((()=>{if(!(null==n?void 0:n())){const e=Ze(i,a,r,s),l=Ze(e,h,p,g);u(e),c(l),t(l)}}),[n,t,h,p,g,i]);return J("div",{className:l},o?J("button",{className:i,onClick:I},i):null,Ze(i,J("input",{key:i,value:h,onChange:ut((e=>f(e[k][x]+"",m)),[f])}),J("input",{key:i,type:"number",value:p,onChange:ut((e=>f(Number(e[k][x]||0),b)),[f])}),J("input",{key:i,type:"checkbox",checked:g,onChange:ut((e=>f(!!e[k].checked,v)),[f])})))},xt=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,p=it(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,g,v]=ft(s,r,d,a,o,t.useRowCount(n,i),c,h);return J(yt,ot(at({},p),{params:bt(It(t.useTableCellIds(n,i),m,u?Rt:t.CellView),gt(i,n),t.useSortedRowIds(n,...b,o,i),b,g,v)}))},St=({store:e,editable:l=!1,valueComponent:n=(l?qt:t.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>J("table",{className:r},!1===a?null:J("thead",null,J("tr",null,!1===o?null:J("th",null,"Id"),J("th",null,y))),J("tbody",null,U(t.useValueIds(e),(t=>J("tr",{key:t},!1===o?null:J("th",null,t),J("td",null,J(n,ot(at({},W(s,t)),{valueId:t,store:e})))))))),Tt=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=l,i=it(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(t.useIndexesOrIndexesById(r),n);return J(yt,ot(at({},i),{params:bt(It(t.useTableCellIds(c,d),o,a?Rt:t.CellView),gt(d,c),t.useSliceRowIds(n,s,u))}))},Vt=({relationshipId:l,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(n),l),m=It([...mt(c,d),...mt(h,d)],r,s?Rt:t.CellView),p=bt(i,m,c,h,l,u,d);return J("table",{className:a},!1===o?null:J("thead",null,J("tr",null,!1===i?null:J(e.Fragment,null,J("th",null,c,".Id"),J("th",null,h,".Id")),ue(m,(({label:e},t)=>J("th",{key:t},e))))),J("tbody",null,U(t.useRowIds(c,d),(e=>J(Ct,{key:e,localRowId:e,params:p})))))},Ot=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=it(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,b,g]=ft(s,r,u,a,o,t.useResultRowCount(n,i),d,h);return J(yt,ot(at({},m),{params:bt(It(t.useResultTableCellIds(n,i),c,t.ResultCellView),vt(i,n),t.useResultSortedRowIds(n,...p,o,i),p,b,g)}))},Rt=({tableId:e,rowId:l,cellId:n,store:s,className:r,showType:a})=>{var o;return J(kt,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:ht+f,showType:a,hasSchema:null==(o=t.useStoreOrStoreById(s))?void 0:o.hasTablesSchema})},qt=({valueId:e,store:l,className:n,showType:s})=>{var r;return J(kt,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:ht+y,showType:s,hasSchema:null==(r=t.useStoreOrStoreById(l))?void 0:r.hasValuesSchema})},Mt=({onChange:t,total:l,offset:n=0,limit:s=l,singular:r="row",plural:a=r+"s"})=>{(n>l||n<0)&&(n=0,t(0));const o=pt((()=>t(n-s)),[t,n,s],n>0),i=pt((()=>t(n+s)),[t,n,s],n+s<l);return J(e.Fragment,null,l>s&&J(e.Fragment,null,J("button",{className:"previous",disabled:0==n,onClick:o},"←"),J("button",{className:"next",disabled:n+s>=l,onClick:i},"→"),n+1," to ",O(l,n+s)," of "),l," ",1!=l?a:r)},Pt=({indexes:e,indexesId:l,indexId:n,s:s})=>J(Ke,{uniqueId:xe("i",l,n),summary:"Index: "+n,s:s},U(t.useSliceIds(n,e),(t=>J(Nt,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s,key:t})))),Nt=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:s})=>{const r=xe("i",t,l,n),[a,o]=Te(r,s);return J(Ke,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},J(Tt,{sliceId:n,indexId:l,indexes:e,editable:a}))},Lt=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return M(n)?null:J(Ke,{uniqueId:xe("i",e),summary:"Indexes: "+(null!=e?e:u),s:l},X(s)?"No indexes defined":Se(s,(t=>J(Pt,{indexes:n,indexesId:e,indexId:t,s:l,key:t}))))},Et=({metrics:e,metricId:l})=>J("tr",null,J("th",null,l),J("td",null,null==e?void 0:e.getTableId(l)),J("td",null,t.useMetric(l,e))),jt=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return M(n)?null:J(Ke,{uniqueId:xe("m",e),summary:"Metrics: "+(null!=e?e:u),s:l},X(s)?"No metrics defined":J("table",null,J("thead",null,J("th",null,"Metric Id"),J("th",null,"Table Id"),J("th",null,"Metric")),J("tbody",null,U(s,(e=>J(Et,{metrics:n,metricId:e,key:e}))))))},zt=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const a=xe("q",l,n),[o,i,u]=me(null!=(r=t.useCell(fe,a,Ie,s))?r:"[]"),d=t.useSetCellCallback(fe,a,Ie,pe,[],s);return J(Ke,{uniqueId:a,summary:"Query: "+n,s:s},J(Ot,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},$t=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return M(n)?null:J(Ke,{uniqueId:xe("q",e),summary:"Queries: "+(null!=e?e:u),s:l},X(s)?"No queries defined":Se(s,(t=>J(zt,{queries:n,queriesId:e,queryId:t,s:l,key:t}))))},At=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const s=xe("r",t,l),[r,a]=Te(s,n);return J(Ke,{uniqueId:s,summary:"Relationship: "+l,editable:r,handleEditable:a,s:n},J(Vt,{relationshipId:l,relationships:e,editable:r}))},Ft=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return M(n)?null:J(Ke,{uniqueId:xe("r",e),summary:"Relationships: "+(null!=e?e:u),s:l},X(s)?"No relationships defined":Se(s,(t=>J(At,{relationships:n,relationshipsId:e,relationshipId:t,s:l,key:t}))))},Jt=({tableId:e,store:l,storeId:n,s:s})=>{var r;const a=xe("t",n,e),[o,i,u]=me(null!=(r=t.useCell(fe,a,Ie,s))?r:"[]"),d=t.useSetCellCallback(fe,a,Ie,pe,[],s),[c,m]=Te(a,s);return J(Ke,{uniqueId:a,summary:h+": "+e,editable:c,handleEditable:m,s:s},J(xt,{tableId:e,store:l,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Dt=({store:e,storeId:l,s:n})=>{const s=xe("v",l),[r,a]=Te(s,n);return X(t.useValueIds(e))?null:J(Ke,{uniqueId:s,summary:w,editable:r,handleEditable:a,s:n},J(St,{store:e,editable:r}))},Bt=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return M(n)?null:J(Ke,{uniqueId:xe("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(null!=e?e:u),s:l},J(Dt,{storeId:e,store:n,s:l}),Se(s,(t=>J(Jt,{store:n,storeId:e,tableId:t,s:l,key:t}))))},Qt=({s:e})=>{const l=Q(null),n=Q(0),[s,r]=H(!1),{scrollLeft:a,scrollTop:o}=t.useValues(e);B((()=>{const e=l.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=R(a)+e.clientWidth&&e.scrollHeight>=R(o)+e.clientHeight&&e.scrollTo(a,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,o]);const i=D((t=>{const{scrollLeft:l,scrollTop:s}=t[k];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:l,scrollTop:s})}))}),[e]),u=t.useStore(),d=t.useStoreIds(),c=t.useMetrics(),h=t.useMetricsIds(),m=t.useIndexes(),p=t.useIndexesIds(),b=t.useRelationships(),g=t.useRelationshipsIds(),v=t.useQueries(),f=t.useQueriesIds();return M(u)&&X(d)&&M(c)&&X(h)&&M(m)&&X(p)&&M(b)&&X(g)&&M(v)&&X(f)?J("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):J("article",{ref:l,onScroll:i},J(Bt,{s:e}),U(d,(t=>J(Bt,{storeId:t,s:e,key:t}))),J(jt,{s:e}),U(h,(t=>J(jt,{metricsId:t,s:e,key:t}))),J(Lt,{s:e}),U(p,(t=>J(Lt,{indexesId:t,s:e,key:t}))),J(Ft,{s:e}),U(g,(t=>J(Ft,{relationshipsId:t,s:e,key:t}))),J($t,{s:e}),U(f,(t=>J($t,{queriesId:t,s:e,key:t}))))};var Ht=Object.defineProperty;class Wt extends A{constructor(e){var t,l,n;super(e),n=(e,t)=>console.error(e,t.componentStack),(l="componentDidCatch")in(t=this)?Ht(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?J("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const Gt=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1,s=t.useSetValueCallback(Ce,(()=>!1),[],e),r=t.useSetValueCallback(we,(e=>Number(e[k].dataset.id)),[],e);return J("header",null,J("img",{title:ge}),J("span",null,ge),U(ve,((e,t)=>t==n?null:J("img",{onClick:r,"data-id":t,title:"Dock to "+e,key:t}))),J("img",{onClick:s,title:"Close"}))},Kt=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1;return t.useValue(Ce,e)?J("main",{"data-position":n},J(Gt,{s:e}),J(Wt,null,J(Qt,{s:e}))):null},Ut=e=>t=>{return l=(t,l)=>t+e(l),ll(t).reduce(l,0);var l},Xt=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Yt=Ut(Xt),Zt=Ut(Yt),_t=Ut(Zt),el=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},tl=e=>M(e)||0==Xt(e),ll=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},nl=e=>e.clear(),sl=(e,t)=>null==e?void 0:e.forEach(t),rl=(e,t)=>null==e?void 0:e.delete(t),al=e=>new Map(e),ol=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},il=(e,t)=>null==e?void 0:e.get(t),ul=(e,t)=>sl(e,((e,l)=>t(l,e))),dl=(e,t,l)=>M(l)?(rl(e,t),e):null==e?void 0:e.set(t,l),cl=(e,t,l,n)=>(el(e,t)?null==n||n(il(e,t)):dl(e,t,l()),il(e,t)),hl=(e,t,l,n=dl)=>(ue(t,((t,n)=>l(e,n,t))),ul(e,(l=>oe(t,l)?0:n(e,l))),e),ml=(e,t,l,n)=>{const s={};return sl(e,((e,r)=>{if(!(null==l?void 0:l(e,r))){const l=t?t(e,r):e;(null==n?void 0:n(l))||(s[r]=l)}})),s},pl=(e,t,l)=>ml(e,(e=>ml(e,t,l)),tl,de),bl=(e,t,l)=>ml(e,(e=>pl(e,t,l)),tl,de),gl=(e,t)=>{const l=al();return sl(e,((e,n)=>{var s;return l.set(n,null!=(s=null==t?void 0:t(e))?s:e)})),l},vl=e=>gl(e,gl),fl=e=>gl(e,vl),Il=(e,t,l,n,s=0)=>P((l?cl:il)(e,t[s],s>z(t)-2?l:al),(r=>{if(s>z(t)-2)return(null==n?void 0:n(r))&&dl(e,t[s]),r;const a=Il(r,t,l,n,s+1);return tl(r)&&dl(e,t[s]),a}));var yl=Object.defineProperty,wl=Object.getOwnPropertySymbols,Cl=Object.prototype.hasOwnProperty,kl=Object.prototype.propertyIsEnumerable,xl=(e,t,l)=>t in e?yl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Sl=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Tl=al(),Vl=al();var Ol=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Rl="storage",ql=e=>new Set(E(e)||M(e)?e:[e]),Ml=(e,t)=>null==e?void 0:e.add(t),Pl=/^\d+$/,Nl=()=>{const e=[];let t=0;return[l=>{var s;return null!=(s=l?Z(e):null)?s:n+t++},t=>{Pl.test(t)&&z(e)<1e3&&Y(e,t)}]},Ll=e=>[e,e],El=(e,t=Yt)=>t(e[0])+t(e[1]),jl=()=>[al(),al()],zl=e=>[...e],$l=([e,t])=>e===t;al(U("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(n),((e,t)=>[e,t])));const Al=(e,t,l)=>dl(e,t,il(e,t)==-l?void 0:l),Fl=()=>{let e,t,l=!1,s=!1,r=0,o=[];const c=al(),k=al(),x=al(),T=al(),V=al(),O=al(),R=al(),q=al(),$=al(),A=al(),F=al(),J=al(),D=al(),B=al(),Q=ql(),H=al(),W=al(),X=al(),Z=al(),_=jl(),ee=jl(),te=jl(),le=jl(),ne=jl(),se=jl(),ae=jl(),he=jl(),be=jl(),ge=jl(),ve=jl(),fe=jl(),Ie=jl(),ye=jl(),we=jl(),Ce=jl(),ke=jl(),xe=jl(),Se=jl(),Te=jl(),Ve=jl(),Oe=jl(),Re=al(),qe=jl(),[Me,Pe,Ne,Le]=(()=>{let e;const[t,l]=Nl(),s=al();return[(l,r,a,o=[],i=()=>[])=>{null!=e||(e=Vl);const u=t(1);return dl(s,u,[l,r,a,o,i]),Ml(Il(r,null!=a?a:[n],ql),u),u},(t,l,...r)=>K(((e,t=[n])=>{const l=[],s=(e,n)=>n==z(t)?Y(l,e):null===t[n]?sl(e,(e=>s(e,n+1))):K([t[n],null],(t=>s(il(e,t),n+1)));return s(e,0),l})(t,l),(t=>sl(t,(t=>il(s,t)[0](e,...null!=l?l:[],...r))))),e=>P(il(s,e),(([,t,r])=>(Il(t,null!=r?r:[n],void 0,(t=>(rl(t,e),tl(t)?1:0))),dl(s,e),l(e),r))),t=>P(il(s,t),(([t,,l=[],n,s])=>{const r=(...a)=>{var o,i;const u=z(a);u==z(l)?t(e,...a,...s(a)):M(l[u])?K(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,l[u])};r()}))]})(),Ee=e=>{if(!ce(e,((e,t)=>[i,u].includes(t))))return!1;const t=e[i];return!(!N(t)&&t!=a||(Ue(e[u])!=t&&ie(e,u),0))},je=E,ze=(t,l)=>(!e||el(F,l)||gt(l))&&ce(t,((e,t)=>$e(l,t,e)),(()=>gt(l))),$e=(e,t,l,n)=>ce(n?l:De(l,e,t),((n,s)=>P(Ae(e,t,s,n),(e=>(l[s]=e,!0)),(()=>!1))),(()=>gt(e,t))),Ae=(t,l,n,s)=>e?P(il(il(F,t),n),(e=>Ue(s)!=e[i]?gt(t,l,n,s,e[u]):s),(()=>gt(t,l,n,s))):M(Ue(s))?gt(t,l,n,s):s,Fe=(e,t)=>ce(t?e:Be(e),((t,l)=>P(Je(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>vt())),Je=(e,l)=>t?P(il(D,e),(t=>Ue(l)!=t[i]?vt(e,l,t[u]):l),(()=>vt(e,l))):M(Ue(l))?vt(e,l):l,De=(e,t,l)=>(P(il(J,t),(([n,s])=>{sl(n,((t,l)=>{oe(e,l)||(e[l]=t)})),sl(s,(n=>{oe(e,n)||gt(t,l,n)}))})),e),Be=e=>(t&&(sl(B,((t,l)=>{oe(e,l)||(e[l]=t)})),sl(Q,(t=>{oe(e,t)||vt(t)}))),e),Qe=e=>hl(F,e,((e,t,l)=>{const n=al(),s=ql();hl(cl(F,t,al),l,((e,t,l)=>{dl(e,t,l),P(l[u],(e=>dl(n,t,e)),(()=>Ml(s,t)))})),dl(J,t,[n,s])}),((e,t)=>{dl(F,t),dl(J,t)})),He=e=>hl(D,e,((e,t,l)=>{dl(D,t,l),P(l[u],(e=>dl(B,t,e)),(()=>Ml(Q,t)))}),((e,t)=>{dl(D,t),dl(B,t),rl(Q,t)})),We=e=>de(e)?Ut():Qt(e),Ge=e=>hl(X,e,((e,t,l)=>Ke(t,l)),((e,t)=>at(t))),Ke=(e,t)=>hl(cl(X,e,(()=>(dt(e,1),dl(H,e,Nl()),dl(W,e,al()),al()))),t,((t,l,n)=>Ze(e,t,l,n)),((t,l)=>ot(e,t,l))),Ze=(e,t,l,n,s)=>hl(cl(t,l,(()=>(ct(e,l,1),al()))),n,((t,n,s)=>_e(e,l,t,n,s)),((n,r)=>it(e,t,l,n,r,s))),_e=(e,t,l,n,s)=>{el(l,n)||ht(e,t,n,1);const r=il(l,n);s!==r&&(mt(e,t,n,r,s),dl(l,n,s))},et=(e,t,l,n,s)=>P(il(t,l),(t=>_e(e,l,t,n,s)),(()=>Ze(e,t,l,De({[n]:s},e,l)))),tt=e=>de(e)?wl():Ht(e),lt=e=>hl(Z,e,((e,t,l)=>nt(t,l)),((e,t)=>ut(t))),nt=(e,t)=>{el(Z,e)||pt(e,1);const l=il(Z,e);t!==l&&(bt(e,l,t),dl(Z,e,t))},st=(e,t)=>{const[l]=il(H,e),n=l(t);return el(il(X,e),n)?st(e,t):n},rt=e=>{var t;return null!=(t=il(X,e))?t:Ke(e,{})},at=e=>Ke(e,{}),ot=(e,t,l)=>{const[,n]=il(H,e);n(l),Ze(e,t,l,{},!0)},it=(e,t,l,n,s,r)=>{var a;const o=il(null==(a=il(J,e))?void 0:a[0],s);if(!M(o)&&!r)return _e(e,l,n,s,o);const i=t=>{mt(e,l,t,il(n,t)),ht(e,l,t,-1),dl(n,t)};M(o)?i(s):ul(n,i),tl(n)&&(ct(e,l,-1),tl(dl(t,l))&&(dt(e,-1),dl(X,e),dl(H,e),dl(W,e)))},ut=e=>{const t=il(B,e);if(!M(t))return nt(e,t);bt(e,il(Z,e)),pt(e,-1),dl(Z,e)},dt=(e,t)=>Al(c,e,t),ct=(e,t,l)=>Al(cl(T,e,al),t,l)&&dl(x,e,cl(x,e,(()=>0))+l),ht=(e,t,l,n)=>{var s;const r=il(W,e),a=null!=(s=il(r,l))?s:0;(0==a&&1==n||1==a&&-1==n)&&Al(cl(k,e,al),l,n),dl(r,l,a!=-n?a+n:null),Al(cl(cl(V,e,al),t,al),l,n)},mt=(e,t,l,n,s)=>{var r;cl(cl(cl(O,e,al),t,al),l,(()=>[n,0]))[1]=s,null==(r=o[3])||r.call(o,e,t,l,s)},pt=(e,t)=>Al(R,e,t),bt=(e,t,l)=>{var n;cl(q,e,(()=>[t,0]))[1]=l,null==(n=o[4])||n.call(o,e,l)},gt=(e,t,l,n,s)=>(Y(cl(cl(cl($,e,al),t,al),l,(()=>[])),n),s),vt=(e,t,l)=>(Y(cl(A,e,(()=>[])),t),l),ft=(e,t,l)=>P(il(il(il(O,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...Ll(Nt(e,t,l))])),It=e=>P(il(q,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Ll(jt(e))])),yt=e=>tl($)||tl(Ce[e])?0:sl(e?fl($):$,((t,l)=>sl(t,((t,n)=>sl(t,((t,s)=>Pe(Ce[e],[l,n,s],t))))))),wt=e=>tl(A)||tl(ke[e])?0:sl(e?gl(A):A,((t,l)=>Pe(ke[e],[l],t))),Ct=(e,t,l,n)=>{if(!tl(e))return Pe(t,n,(()=>ml(e))),ul(e,((e,t)=>Pe(l,[...null!=n?n:[],e],1==t))),1},kt=e=>{const t=zt();t!=l&&Pe(_[e],void 0,t);const n=tl(ge[e]),s=tl(Ie[e])&&tl(ye[e])&&tl(be[e])&&tl(ve[e])&&tl(se[e])&&tl(ae[e])&&tl(he[e])&&n&&tl(te[e])&&tl(le[e]),r=tl(we[e])&&tl(fe[e])&&tl(ne[e])&&tl(ee[e]);if(!s||!r){const t=e?[gl(c),vl(k),gl(x),vl(T),fl(V),fl(O)]:[c,k,x,T,V,O];if(!s){Ct(t[0],te[e],le[e]),sl(t[1],((t,l)=>Ct(t,se[e],ae[e],[l]))),sl(t[2],((t,l)=>{0!=t&&Pe(he[e],[l],Rt(l))}));const l=ql();sl(t[3],((t,s)=>{Ct(t,be[e],ve[e],[s])&&!n&&(Pe(ge[e],[s,null]),Ml(l,s))})),n||sl(t[5],((t,n)=>{if(!el(l,n)){const l=ql();sl(t,(e=>sl(e,(([t,n],s)=>n!==t?Ml(l,s):rl(e,s))))),sl(l,(t=>Pe(ge[e],[n,t])))}})),sl(t[4],((t,l)=>sl(t,((t,n)=>Ct(t,Ie[e],ye[e],[l,n])))))}if(!r){let l;sl(t[5],((t,n)=>{let s;sl(t,((t,r)=>{let a;sl(t,(([t,o],i)=>{o!==t&&(Pe(we[e],[n,r,i],o,t,ft),l=s=a=1)})),a&&Pe(fe[e],[n,r],ft)})),s&&Pe(ne[e],[n],ft)})),l&&Pe(ee[e],void 0,ft)}}},xt=e=>{const t=Dt();t!=s&&Pe(xe[e],void 0,t);const l=tl(Te[e])&&tl(Ve[e]),n=tl(Oe[e])&&tl(Se[e]);if(!l||!n){const t=e?[gl(R),gl(q)]:[R,q];if(l||Ct(t[0],Te[e],Ve[e]),!n){let l;sl(t[1],(([t,n],s)=>{n!==t&&(Pe(Oe[e],[s],n,t,It),l=1)})),l&&Pe(Se[e],void 0,It)}}},St=(e,...t)=>(xl((()=>e(...U(t,S)))),Vl),Tt=()=>bl(X),Vt=()=>ol(X),Ot=e=>ol(il(W,S(e))),Rt=e=>Xt(il(X,S(e))),qt=e=>ol(il(X,S(e))),Mt=(e,t,l,n=0,s)=>{return U(j(G((r=il(X,S(e)),a=(e,l)=>[M(t)?l:il(e,S(t)),l],U([...null!=(o=null==r?void 0:r.entries())?o:[]],(([e,t])=>a(t,e)))),(([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(s=t)?s:0)?-1:1)*(l?-1:1);var n,s})),n,M(s)?s:n+s),(([,e])=>e));var r,a,o},Pt=(e,t)=>ol(il(il(X,S(e)),S(t))),Nt=(e,t,l)=>il(il(il(X,S(e)),S(t)),S(l)),Lt=()=>ml(Z),Et=()=>ol(Z),jt=e=>il(Z,S(e)),zt=()=>!tl(X),$t=e=>el(X,S(e)),At=(e,t)=>el(il(W,S(e)),S(t)),Ft=(e,t)=>el(il(X,S(e)),S(t)),Jt=(e,t,l)=>el(il(il(X,S(e)),S(t)),S(l)),Dt=()=>!tl(Z),Bt=e=>el(Z,S(e)),Qt=e=>St((()=>(e=>ce(e,ze,gt))(e)?Ge(e):0)),Ht=e=>St((()=>Fe(e)?lt(e):0)),Wt=e=>{try{We(me(e))}catch(e){}return Vl},Gt=t=>St((()=>{if((e=ce(t,(e=>ce(e,Ee))))&&(Qe(t),!tl(X))){const e=Tt();Ut(),Qt(e)}})),Kt=e=>St((()=>{if(t=(e=>ce(e,Ee))(e)){const l=Lt();kl(),wl(),t=!0,He(e),Ht(l)}})),Ut=()=>St((()=>Ge({}))),ll=e=>St((e=>el(X,e)?at(e):0),e),yl=(e,t)=>St(((e,t)=>P(il(X,e),(l=>el(l,t)?ot(e,l,t):0))),e,t),wl=()=>St((()=>lt({}))),Cl=()=>St((()=>{Qe({}),e=!1})),kl=()=>St((()=>{He({}),t=!1})),xl=(e,t)=>{if(-1!=r){Sl();const l=e();return Tl(t),l}},Sl=()=>{var e;return-1!=r&&r++,1==r&&(null==(e=o[0])||e.call(o),Pe(Re)),Vl},Tl=e=>{var t,n;return r>0&&(r--,0==r&&(r=1,yt(1),tl(O)||kt(1),wt(1),tl(q)||xt(1),(null==e?void 0:e(Vl))&&(sl(O,((e,t)=>sl(e,((e,l)=>sl(e,(([e],n)=>Xe(Vl,t,l,n,e))))))),nl(O),sl(q,(([e],t)=>Ye(Vl,t,e))),nl(q)),Pe(qe[0],void 0),r=-1,yt(0),tl(O)||kt(0),wt(0),tl(q)||xt(0),null==(t=o[1])||t.call(o),Pe(qe[1],void 0),null==(n=o[2])||n.call(o),r=0,l=zt(),s=Dt(),K([c,k,x,T,V,O,$,R,q,A],nl))),Vl},Vl={getContent:()=>[Tt(),Lt()],getTables:Tt,getTableIds:Vt,getTable:e=>pl(il(X,S(e))),getTableCellIds:Ot,getRowCount:Rt,getRowIds:qt,getSortedRowIds:Mt,getRow:(e,t)=>ml(il(il(X,S(e)),S(t))),getCellIds:Pt,getCell:Nt,getValues:Lt,getValueIds:Et,getValue:jt,hasTables:zt,hasTable:$t,hasTableCell:At,hasRow:Ft,hasCell:Jt,hasValues:Dt,hasValue:Bt,getTablesJson:()=>pe(X),getValuesJson:()=>pe(Z),getJson:()=>pe([X,Z]),getTablesSchemaJson:()=>pe(F),getValuesSchemaJson:()=>pe(D),getSchemaJson:()=>pe([F,D]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>St((()=>je(e)?(([e,t])=>{(de(e)?Ut:Qt)(e),(de(t)?wl:Ht)(t)})(e):0)),setTables:Qt,setTable:(e,t)=>St((e=>ze(t,e)?Ke(e,t):0),e),setRow:(e,t,l)=>St(((e,t)=>$e(e,t,l)?Ze(e,rt(e),t,l):0),e,t),addRow:(e,t,l=!0)=>xl((()=>{let n;return $e(e,n,t)&&(e=S(e),Ze(e,rt(e),n=st(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>St(((e,t)=>{if($e(e,t,l,1)){const n=rt(e);ue(l,((l,s)=>et(e,n,t,s,l)))}}),e,t),setCell:(e,t,l,n)=>St(((e,t,l)=>P(Ae(e,t,l,L(n)?n(Nt(e,t,l)):n),(n=>et(e,rt(e),t,l,n)))),e,t,l),setValues:Ht,setPartialValues:e=>St((()=>Fe(e,1)?ue(e,((e,t)=>nt(t,e))):0)),setValue:(e,t)=>St((e=>P(Je(e,L(t)?t(jt(e)):t),(t=>nt(e,t)))),e),applyChanges:e=>St((()=>{ue(e[0],((e,t)=>M(e)?ll(t):ue(e,((e,l)=>M(e)?yl(t,l):ue(e,((e,n)=>Xe(Vl,t,l,n,e))))))),ue(e[1],((e,t)=>Ye(Vl,t,e)))})),setTablesJson:Wt,setValuesJson:e=>{try{tt(me(e))}catch(e){}return Vl},setJson:e=>St((()=>{try{const[t,l]=me(e);We(t),tt(l)}catch(t){Wt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>St((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:ll,delRow:yl,delCell:(e,t,l,n)=>St(((e,t,l)=>P(il(X,e),(s=>P(il(s,t),(r=>el(r,l)?it(e,s,t,r,l,n):0))))),e,t,l),delValues:wl,delValue:e=>St((e=>el(Z,e)?ut(e):0),e),delTablesSchema:Cl,delValuesSchema:kl,delSchema:()=>St((()=>{Cl(),kl()})),transaction:xl,startTransaction:Sl,getTransactionChanges:()=>[ml(O,((e,t)=>-1===il(c,t)?void 0:ml(e,((e,l)=>-1===il(il(T,t),l)?void 0:ml(e,(([,e])=>e),(e=>$l(e)))),tl,de)),tl,de),ml(q,(([,e])=>e),(e=>$l(e))),1],getTransactionLog:()=>[!tl(O),!tl(q),bl(O,zl,$l),bl($),ml(q,zl,$l),ml(A),ml(c),pl(T),bl(V),ml(R)],finishTransaction:Tl,forEachTable:e=>sl(X,((t,l)=>e(l,(e=>sl(t,((t,l)=>e(l,(e=>ul(t,e))))))))),forEachTableCell:(e,t)=>ul(il(W,S(e)),t),forEachRow:(e,t)=>sl(il(X,S(e)),((e,l)=>t(l,(t=>ul(e,t))))),forEachCell:(e,t,l)=>ul(il(il(X,S(e)),S(t)),l),forEachValue:e=>ul(Z,e),addSortedRowIdsListener:(e,t,l,n,s,r,a)=>{let o=Mt(e,t,l,n,s);return Me((()=>{const a=Mt(e,t,l,n,s);var i,u,d;u=o,z(i=a)===z(u)&&(d=(e,t)=>u[t]===e,i.every(d))||(o=a,r(Vl,e,t,l,n,s,o))}),ge[a?1:0],[e,t],[Vt])},addStartTransactionListener:e=>Me(e,Re),addWillFinishTransactionListener:e=>Me(e,qe[0]),addDidFinishTransactionListener:e=>Me(e,qe[1]),callListener:e=>(Le(e),Vl),delListener:e=>(Ne(e),Vl),getListenerStats:()=>({hasTables:El(_),tables:El(ee),tableIds:El(te),hasTable:El(le),table:El(ne),tableCellIds:El(se),hasTableCell:El(ae,Zt),rowCount:El(he),rowIds:El(be),sortedRowIds:El(ge),hasRow:El(ve,Zt),row:El(fe,Zt),cellIds:El(Ie,Zt),hasCell:El(ye,_t),cell:El(we,_t),invalidCell:El(Ce,_t),hasValues:El(xe),values:El(Se),valueIds:El(Te),hasValue:El(Ve),value:El(Oe),invalidValue:El(ke),transaction:Yt(Re)+El(qe)}),isMergeable:()=>!1,createStore:Fl,addListener:Me,callListeners:Pe,setInternalListeners:(e,t,l,n,s)=>o=[e,t,l,n,s]};return ue({[d+m]:[0,_,[],()=>[zt()]],[m]:[0,ee],[p]:[0,te],[d+h]:[1,le,[Vt],e=>[$t(...e)]],[h]:[1,ne,[Vt]],[h+I]:[1,se,[Vt]],[d+h+f]:[2,ae,[Vt,Ot],e=>[At(...e)]],[g]:[1,he,[Vt]],[v]:[1,be,[Vt]],[d+b]:[2,ve,[Vt,qt],e=>[Ft(...e)]],[b]:[2,fe,[Vt,qt]],[I]:[2,Ie,[Vt,qt]],[d+f]:[3,ye,[Vt,qt,Pt],e=>[Jt(...e)]],[f]:[3,we,[Vt,qt,Pt],e=>Ll(Nt(...e))],InvalidCell:[3,Ce],[d+w]:[0,xe,[],()=>[Dt()]],[w]:[0,Se],[C]:[0,Te],[d+y]:[1,Ve,[Et],e=>[Bt(...e)]],[y]:[1,Oe,[Et],e=>Ll(jt(e[0]))],InvalidValue:[1,ke]},(([e,t,l,n],s)=>{Vl["add"+s+"Listener"]=(...s)=>Me(s[e],t[s[e+1]?1:0],e>0?j(s,0,e):void 0,l,n)})),re(Vl)};exports.Inspector=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(Fl),s=ve.indexOf(e);return t.useCreatePersister(n,(e=>{return t=be,l=sessionStorage,((e,t,l,n,s,r,a,o={},i=[])=>{let u,d,c,h=0,m=0,p=0;cl(Tl,i,(()=>0)),cl(Vl,i,(()=>[]));const[b,g,v,f,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!de(e)||!de(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!de(e)||!de(t),t.setContent]:$("Store type not supported by this Persister"))(a,e),y=t=>{(b&&E(null==t?void 0:t[0])?1===(null==t?void 0:t[2])?e.applyMergeableChanges:e.setMergeableContent:1===(null==t?void 0:t[2])?e.applyChanges:e.setContent)(t)},w=e=>Sl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield S((()=>Sl(void 0,null,(function*(){try{const e=yield t();E(e)?y(e):$("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))))),T})),C=()=>(d&&(s(d),d=void 0),T),k=e=>Sl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield S((()=>Sl(void 0,null,(function*(){try{yield l(g,e)}catch(e){}h=0}))))),T})),x=()=>(P(c,e.delListener),c=void 0,T),S=(...e)=>Sl(void 0,null,(function*(){return Y(il(Vl,i),...e),yield Sl(void 0,null,(function*(){if(!il(Tl,i)){for(dl(Tl,i,1);!M(u=Z(il(Vl,i)));)try{yield u()}catch(e){}dl(Tl,i,0)}})),T})),T=((e,t)=>{for(var l in t||(t={}))Cl.call(t,l)&&xl(e,l,t[l]);if(wl)for(var l of wl(t))kl.call(t,l)&&xl(e,l,t[l]);return e})({load:w,startAutoLoad:e=>Sl(void 0,null,(function*(){yield C().load(e);try{d=yield n(((e,t)=>Sl(void 0,null,(function*(){t||e?2!=h&&(h=1,m++,y(null!=t?t:e),h=0):yield w()}))))}catch(e){}return T})),stopAutoLoad:C,isAutoLoading:()=>!M(d),save:k,startAutoSave:()=>Sl(void 0,null,(function*(){return yield x().save(),c=e.addDidFinishTransactionListener((()=>{const e=v();f(e)&&k(e)})),T})),stopAutoSave:x,isAutoSaving:()=>!M(c),schedule:S,getStore:()=>e,destroy:()=>(il(Vl,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:p})},o);return re(T)})(e,(()=>Ol(void 0,null,(function*(){return e=l.getItem(t),me(e,((e,t)=>""===t?void 0:t));var e}))),(e=>Ol(void 0,null,(function*(){return l.setItem(t,(n=e(),he(n,((e,t)=>void 0===t?"":t))));var n}))),(e=>{const n=n=>{if(n.storageArea===l&&n.key===t)try{e(me(n.newValue))}catch(t){e()}};return T.addEventListener(Rl,n),n}),(e=>T.removeEventListener(Rl,e)),0,3,{getStorageName:()=>t});var t,l}),void 0,(e=>{return t=function*(){yield e.load([{},{position:-1==s?1:s,open:!!l}]),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),J(F,null,J("aside",{id:be},J(Ge,{s:n}),J(Kt,{s:n})),J("style",null,We))};
1
+ "use strict";var e=require("react"),t=require("../ui-react/index.cjs");const l=e=>typeof e,n="",s=l(n),r=l(!0),a=l(0),o=l(l),i="type",u="default",d="Has",c="Ids",h="Table",m=h+"s",p=h+c,b="Row",g=b+"Count",v=b+c,f="Cell",I=f+c,y="Value",w=y+"s",C=y+c,k="currentTarget",x="value",S=e=>n+e,T=globalThis.window,V=Math,O=V.min,R=V.floor,q=isFinite,M=e=>null==e,P=(e,t,l)=>M(e)?null==l?void 0:l():t(e),N=e=>e==s||e==r,L=e=>l(e)==o,E=e=>Array.isArray(e),j=(e,t,l)=>e.slice(t,l),z=e=>e.length,$=e=>{throw Error(e)},{PureComponent:A,Fragment:F,createElement:J,useCallback:D,useLayoutEffect:B,useRef:Q,useState:H}=e,W=(e,...t)=>M(e)?{}:e(...t),G=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),U=(e,t)=>e.map(t),X=e=>0==z(e),Y=(e,...t)=>e.push(...t),Z=e=>e.shift(),_=Object,ee=e=>_.getPrototypeOf(e),te=_.entries,le=_.isFrozen,ne=e=>!M(e)&&P(ee(e),(e=>e==_.prototype||M(ee(e))),(()=>!0)),se=_.keys,re=_.freeze,ae=(e=[])=>_.fromEntries(e),oe=(e,t)=>t in e,ie=(e,t)=>(delete e[t],e),ue=(e,t)=>U(te(e),(([e,l])=>t(l,e))),de=e=>ne(e)&&0==(e=>z(se(e)))(e),ce=(e,t,l,n=0)=>M(e)||!ne(e)||!n&&de(e)||le(e)?(null==l||l(),!1):(ue(e,((l,n)=>{t(l,n)||ie(e,n)})),!!n||!de(e)),he=JSON.stringify,me=JSON.parse,pe=e=>he(e,((e,t)=>t instanceof Map?_.fromEntries([...t]):t)),be="tinybaseInspector",ge="TinyBase Inspector",ve=["left","top","bottom","right","full"],fe="state",Ie="sort",ye="open",we="position",Ce=ye,ke="editable",xe=(...e)=>pe(e),Se=(e,t)=>U(G([...e]),t),Te=(e,l)=>[!!t.useCell(fe,e,ke,l),D((t=>{l.setCell(fe,e,ke,(e=>!e)),t.preventDefault()}),[l,e])],Ve="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Oe='content:url("',Re=Oe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",qe='</svg>")',Me=Oe+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Pe=U([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>Re+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+qe)),Ne=Re+"<path d='M20 20l60 60M20 80l60-60' />"+qe,Le=Re+`<path d='${Ve}' />`+qe,Ee=Re+`<path d='${Ve}M20 20l60 60' />`+qe;var je=Object.defineProperty,ze=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,Ae=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,De=(e,t,l)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Be=(e,t)=>{for(var l in t||(t={}))Fe.call(t,l)&&De(e,l,t[l]);if(Ae)for(var l of Ae(t))Je.call(t,l)&&De(e,l,t[l]);return e},Qe=(e,t)=>ze(e,$e(t));const He="*::-webkit-scrollbar",We=((e,t="")=>e.join(t))(ue(Qe(Be(Qe(Be(Qe(Be({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[He]:"width:0.5rem;height:0.5rem;",[He+"-track"]:"background:#111",[He+"-thumb"]:"background:#999;border:1px solid #111",[He+"-thumb:hover"]:"background:#fff",[He+"-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;"+Me},ae(U(["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;"}),ae(U(["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)":Me,"header>img:nth-of-type(6)":Ne}),ae(U(Pe,((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":Le,"details[open]>summary img.done":Ee,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,#${be} 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?`#${be} ${t}{${e}}`:""))),Ge=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1,s=t.useSetValueCallback(Ce,(()=>!0),[],e);return t.useValue(Ce,e)?null:J("img",{onClick:s,title:ge,"data-position":n})},Ke=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!t.useCell(fe,e,ye,a),i=t.useSetCellCallback(fe,e,ye,(e=>e[k].open),[],a);return J("details",{open:o,onToggle:i},J("summary",null,l,s?J("img",{onClick:s,className:n?"done":"edit"}):null),r)},Ue=e=>{const t=l(e);return N(t)||t==a&&q(e)?t:void 0},Xe=(e,t,l,n,s)=>M(s)?e.delCell(t,l,n,!0):e.setCell(t,l,n,s),Ye=(e,t,l)=>M(l)?e.delValue(t):e.setValue(t,l),Ze=(e,t,l,n)=>e==s?t:e==a?l:n;var _e=Object.defineProperty,et=Object.defineProperties,tt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,nt=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,rt=(e,t,l)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,at=(e,t)=>{for(var l in t||(t={}))nt.call(t,l)&&rt(e,l,t[l]);if(lt)for(var l of lt(t))st.call(t,l)&&rt(e,l,t[l]);return e},ot=(e,t)=>et(e,tt(t)),it=(e,t)=>{var l={};for(var n in e)nt.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&lt)for(var n of lt(e))t.indexOf(n)<0&&st.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:ut,useMemo:dt,useState:ct}=e,ht="editable",mt=(e,l)=>U(t.useTableCellIds(e,l),(t=>e+"."+t)),pt=(e,t,l)=>{const n=ut(e,t);return l?n:void 0},bt=(...e)=>dt((()=>e),e),gt=(e,t)=>dt((()=>({store:e,tableId:t})),[e,t]),vt=(e,t)=>dt((()=>({queries:e,queryId:t})),[e,t]),ft=(e,t=!1,l,n=0,s,r,a,o)=>{const[[i,u,d],c]=ct([e,t,n]),h=ut((e=>{c(e),null==o||o(e)}),[o]),m=pt((e=>h([e,e==i&&!u,d])),[h,i,u,d],l),p=ut((e=>h([i,u,e])),[h,i,u]),b=!0===a?Mt:a;return[[i,u,d],m,dt((()=>!1===a?null:J(b,{offset:d,limit:s,total:r,onChange:p})),[a,b,d,s,r,p])]},It=(e,t,n)=>dt((()=>{const r=null!=t?t:e;return a=E(r)?ae(U(r,(e=>[e,e]))):r,o=(e,t)=>at(at({},{label:t,component:n}),l(e)==s?{label:e}:e),ae(ue(a,((e,t)=>[t,o(e,t)])));var a,o}),[t,n,e]),yt=({className:e,headerRow:t,idColumn:l,params:[n,s,r,a,o,i]})=>J("table",{className:e},i?J("caption",null,i):null,!1===t?null:J("thead",null,J("tr",null,!1===l?null:J(wt,{sort:null!=a?a:[],label:"Id",onClick:o}),ue(n,(({label:e},t)=>J(wt,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:o}))))),J("tbody",null,U(r,(e=>J("tr",{key:e},!1===l?null:J("th",null,e),ue(n,(({component:t,getComponentProps:l},n)=>J("td",{key:n},J(t,ot(at(at({},W(l,e,n)),s),{rowId:e,cellId:n})))))))))),wt=({cellId:e,sort:[t,l],label:s=(null!=e?e:n),onClick:r})=>J("th",{onClick:pt((()=>null==r?void 0:r(e)),[r,e],r),className:M(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},M(l)||t!=e?null:(l?"↓":"↑")+" ",s),Ct=({localRowId:l,params:[n,s,r,a,o,i,u]})=>{const d=t.useRemoteRowId(o,l,i);return J("tr",null,!1===n?null:J(e.Fragment,null,J("th",null,l),J("th",null,d)),ue(s,(({component:e,getComponentProps:t},n)=>{const[s,o]=n.split(".",2),i=s===r?l:s===a?d:null;return M(i)?null:J("td",{key:n},J(e,ot(at({},W(t,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},kt=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:o=!0})=>{const[i,u]=ct(),[d,c]=ct(),[h,m]=ct(),[p,b]=ct(),[g,v]=ct();d!==e&&(u(Ue(e)),c(e),m(e+""),b(Number(e)||0),v(!!e));const f=ut(((e,l)=>{l(e),c(e),t(e)}),[t]),I=ut((()=>{if(!(null==n?void 0:n())){const e=Ze(i,a,r,s),l=Ze(e,h,p,g);u(e),c(l),t(l)}}),[n,t,h,p,g,i]);return J("div",{className:l},o?J("button",{className:i,onClick:I},i):null,Ze(i,J("input",{key:i,value:h,onChange:ut((e=>f(e[k][x]+"",m)),[f])}),J("input",{key:i,type:"number",value:p,onChange:ut((e=>f(Number(e[k][x]||0),b)),[f])}),J("input",{key:i,type:"checkbox",checked:g,onChange:ut((e=>f(!!e[k].checked,v)),[f])})))},xt=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,p=it(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,g,v]=ft(s,r,d,a,o,t.useRowCount(n,i),c,h);return J(yt,ot(at({},p),{params:bt(It(t.useTableCellIds(n,i),m,u?Rt:t.CellView),gt(i,n),t.useSortedRowIds(n,...b,o,i),b,g,v)}))},St=({store:e,editable:l=!1,valueComponent:n=(l?qt:t.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>J("table",{className:r},!1===a?null:J("thead",null,J("tr",null,!1===o?null:J("th",null,"Id"),J("th",null,y))),J("tbody",null,U(t.useValueIds(e),(t=>J("tr",{key:t},!1===o?null:J("th",null,t),J("td",null,J(n,ot(at({},W(s,t)),{valueId:t,store:e})))))))),Tt=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=l,i=it(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(t.useIndexesOrIndexesById(r),n);return J(yt,ot(at({},i),{params:bt(It(t.useTableCellIds(c,d),o,a?Rt:t.CellView),gt(d,c),t.useSliceRowIds(n,s,u))}))},Vt=({relationshipId:l,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(n),l),m=It([...mt(c,d),...mt(h,d)],r,s?Rt:t.CellView),p=bt(i,m,c,h,l,u,d);return J("table",{className:a},!1===o?null:J("thead",null,J("tr",null,!1===i?null:J(e.Fragment,null,J("th",null,c,".Id"),J("th",null,h,".Id")),ue(m,(({label:e},t)=>J("th",{key:t},e))))),J("tbody",null,U(t.useRowIds(c,d),(e=>J(Ct,{key:e,localRowId:e,params:p})))))},Ot=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=it(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,b,g]=ft(s,r,u,a,o,t.useResultRowCount(n,i),d,h);return J(yt,ot(at({},m),{params:bt(It(t.useResultTableCellIds(n,i),c,t.ResultCellView),vt(i,n),t.useResultSortedRowIds(n,...p,o,i),p,b,g)}))},Rt=({tableId:e,rowId:l,cellId:n,store:s,className:r,showType:a})=>{var o;return J(kt,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:ht+f,showType:a,hasSchema:null==(o=t.useStoreOrStoreById(s))?void 0:o.hasTablesSchema})},qt=({valueId:e,store:l,className:n,showType:s})=>{var r;return J(kt,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:ht+y,showType:s,hasSchema:null==(r=t.useStoreOrStoreById(l))?void 0:r.hasValuesSchema})},Mt=({onChange:t,total:l,offset:n=0,limit:s=l,singular:r="row",plural:a=r+"s"})=>{(n>l||n<0)&&(n=0,t(0));const o=pt((()=>t(n-s)),[t,n,s],n>0),i=pt((()=>t(n+s)),[t,n,s],n+s<l);return J(e.Fragment,null,l>s&&J(e.Fragment,null,J("button",{className:"previous",disabled:0==n,onClick:o},"←"),J("button",{className:"next",disabled:n+s>=l,onClick:i},"→"),n+1," to ",O(l,n+s)," of "),l," ",1!=l?a:r)},Pt=({indexes:e,indexesId:l,indexId:n,s:s})=>J(Ke,{uniqueId:xe("i",l,n),summary:"Index: "+n,s:s},U(t.useSliceIds(n,e),(t=>J(Nt,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s,key:t})))),Nt=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:s})=>{const r=xe("i",t,l,n),[a,o]=Te(r,s);return J(Ke,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},J(Tt,{sliceId:n,indexId:l,indexes:e,editable:a}))},Lt=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return M(n)?null:J(Ke,{uniqueId:xe("i",e),summary:"Indexes: "+(null!=e?e:u),s:l},X(s)?"No indexes defined":Se(s,(t=>J(Pt,{indexes:n,indexesId:e,indexId:t,s:l,key:t}))))},Et=({metrics:e,metricId:l})=>J("tr",null,J("th",null,l),J("td",null,null==e?void 0:e.getTableId(l)),J("td",null,t.useMetric(l,e))),jt=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return M(n)?null:J(Ke,{uniqueId:xe("m",e),summary:"Metrics: "+(null!=e?e:u),s:l},X(s)?"No metrics defined":J("table",null,J("thead",null,J("th",null,"Metric Id"),J("th",null,"Table Id"),J("th",null,"Metric")),J("tbody",null,U(s,(e=>J(Et,{metrics:n,metricId:e,key:e}))))))},zt=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const a=xe("q",l,n),[o,i,u]=me(null!=(r=t.useCell(fe,a,Ie,s))?r:"[]"),d=t.useSetCellCallback(fe,a,Ie,pe,[],s);return J(Ke,{uniqueId:a,summary:"Query: "+n,s:s},J(Ot,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},$t=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return M(n)?null:J(Ke,{uniqueId:xe("q",e),summary:"Queries: "+(null!=e?e:u),s:l},X(s)?"No queries defined":Se(s,(t=>J(zt,{queries:n,queriesId:e,queryId:t,s:l,key:t}))))},At=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const s=xe("r",t,l),[r,a]=Te(s,n);return J(Ke,{uniqueId:s,summary:"Relationship: "+l,editable:r,handleEditable:a,s:n},J(Vt,{relationshipId:l,relationships:e,editable:r}))},Ft=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return M(n)?null:J(Ke,{uniqueId:xe("r",e),summary:"Relationships: "+(null!=e?e:u),s:l},X(s)?"No relationships defined":Se(s,(t=>J(At,{relationships:n,relationshipsId:e,relationshipId:t,s:l,key:t}))))},Jt=({tableId:e,store:l,storeId:n,s:s})=>{var r;const a=xe("t",n,e),[o,i,u]=me(null!=(r=t.useCell(fe,a,Ie,s))?r:"[]"),d=t.useSetCellCallback(fe,a,Ie,pe,[],s),[c,m]=Te(a,s);return J(Ke,{uniqueId:a,summary:h+": "+e,editable:c,handleEditable:m,s:s},J(xt,{tableId:e,store:l,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Dt=({store:e,storeId:l,s:n})=>{const s=xe("v",l),[r,a]=Te(s,n);return X(t.useValueIds(e))?null:J(Ke,{uniqueId:s,summary:w,editable:r,handleEditable:a,s:n},J(St,{store:e,editable:r}))},Bt=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return M(n)?null:J(Ke,{uniqueId:xe("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(null!=e?e:u),s:l},J(Dt,{storeId:e,store:n,s:l}),Se(s,(t=>J(Jt,{store:n,storeId:e,tableId:t,s:l,key:t}))))},Qt=({s:e})=>{const l=Q(null),n=Q(0),[s,r]=H(!1),{scrollLeft:a,scrollTop:o}=t.useValues(e);B((()=>{const e=l.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=R(a)+e.clientWidth&&e.scrollHeight>=R(o)+e.clientHeight&&e.scrollTo(a,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,o]);const i=D((t=>{const{scrollLeft:l,scrollTop:s}=t[k];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:l,scrollTop:s})}))}),[e]),u=t.useStore(),d=t.useStoreIds(),c=t.useMetrics(),h=t.useMetricsIds(),m=t.useIndexes(),p=t.useIndexesIds(),b=t.useRelationships(),g=t.useRelationshipsIds(),v=t.useQueries(),f=t.useQueriesIds();return M(u)&&X(d)&&M(c)&&X(h)&&M(m)&&X(p)&&M(b)&&X(g)&&M(v)&&X(f)?J("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):J("article",{ref:l,onScroll:i},J(Bt,{s:e}),U(d,(t=>J(Bt,{storeId:t,s:e,key:t}))),J(jt,{s:e}),U(h,(t=>J(jt,{metricsId:t,s:e,key:t}))),J(Lt,{s:e}),U(p,(t=>J(Lt,{indexesId:t,s:e,key:t}))),J(Ft,{s:e}),U(g,(t=>J(Ft,{relationshipsId:t,s:e,key:t}))),J($t,{s:e}),U(f,(t=>J($t,{queriesId:t,s:e,key:t}))))};var Ht=Object.defineProperty;class Wt extends A{constructor(e){var t,l,n;super(e),n=(e,t)=>console.error(e,t.componentStack),(l="componentDidCatch")in(t=this)?Ht(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?J("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const Gt=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1,s=t.useSetValueCallback(Ce,(()=>!1),[],e),r=t.useSetValueCallback(we,(e=>Number(e[k].dataset.id)),[],e);return J("header",null,J("img",{title:ge}),J("span",null,ge),U(ve,((e,t)=>t==n?null:J("img",{onClick:r,"data-id":t,title:"Dock to "+e,key:t}))),J("img",{onClick:s,title:"Close"}))},Kt=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1;return t.useValue(Ce,e)?J("main",{"data-position":n},J(Gt,{s:e}),J(Wt,null,J(Qt,{s:e}))):null},Ut=e=>t=>{return l=(t,l)=>t+e(l),ll(t).reduce(l,0);var l},Xt=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Yt=Ut(Xt),Zt=Ut(Yt),_t=Ut(Zt),el=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},tl=e=>M(e)||0==Xt(e),ll=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},nl=e=>e.clear(),sl=(e,t)=>null==e?void 0:e.forEach(t),rl=(e,t)=>null==e?void 0:e.delete(t),al=e=>new Map(e),ol=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},il=(e,t)=>null==e?void 0:e.get(t),ul=(e,t)=>sl(e,((e,l)=>t(l,e))),dl=(e,t,l)=>M(l)?(rl(e,t),e):null==e?void 0:e.set(t,l),cl=(e,t,l,n)=>(el(e,t)?null==n||n(il(e,t)):dl(e,t,l()),il(e,t)),hl=(e,t,l,n=dl)=>(ue(t,((t,n)=>l(e,n,t))),ul(e,(l=>oe(t,l)?0:n(e,l))),e),ml=(e,t,l,n)=>{const s={};return sl(e,((e,r)=>{if(!(null==l?void 0:l(e,r))){const l=t?t(e,r):e;(null==n?void 0:n(l))||(s[r]=l)}})),s},pl=(e,t,l)=>ml(e,(e=>ml(e,t,l)),tl,de),bl=(e,t,l)=>ml(e,(e=>pl(e,t,l)),tl,de),gl=(e,t)=>{const l=al();return sl(e,((e,n)=>{var s;return l.set(n,null!=(s=null==t?void 0:t(e))?s:e)})),l},vl=e=>gl(e,gl),fl=e=>gl(e,vl),Il=(e,t,l,n,s=0)=>P((l?cl:il)(e,t[s],s>z(t)-2?l:al),(r=>{if(s>z(t)-2)return(null==n?void 0:n(r))&&dl(e,t[s]),r;const a=Il(r,t,l,n,s+1);return tl(r)&&dl(e,t[s]),a}));var yl=Object.defineProperty,wl=Object.getOwnPropertySymbols,Cl=Object.prototype.hasOwnProperty,kl=Object.prototype.propertyIsEnumerable,xl=(e,t,l)=>t in e?yl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Sl=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Tl=al(),Vl=al();var Ol=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Rl="storage",ql=e=>new Set(E(e)||M(e)?e:[e]),Ml=(e,t)=>null==e?void 0:e.add(t),Pl=/^\d+$/,Nl=()=>{const e=[];let t=0;return[l=>{var s;return null!=(s=l?Z(e):null)?s:n+t++},t=>{Pl.test(t)&&z(e)<1e3&&Y(e,t)}]},Ll=e=>[e,e],El=(e,t=Yt)=>t(e[0])+t(e[1]),jl=()=>[al(),al()],zl=e=>[...e],$l=([e,t])=>e===t;al(U("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(n),((e,t)=>[e,t])));const Al=(e,t,l)=>dl(e,t,il(e,t)==-l?void 0:l),Fl=()=>{let e,t,l=!1,s=!1,r=0,o=[];const c=al(),k=al(),x=al(),T=al(),V=al(),O=al(),R=al(),q=al(),$=al(),A=al(),F=al(),J=al(),D=al(),B=al(),Q=ql(),H=al(),W=al(),X=al(),Z=al(),_=jl(),ee=jl(),te=jl(),le=jl(),ne=jl(),se=jl(),ae=jl(),he=jl(),be=jl(),ge=jl(),ve=jl(),fe=jl(),Ie=jl(),ye=jl(),we=jl(),Ce=jl(),ke=jl(),xe=jl(),Se=jl(),Te=jl(),Ve=jl(),Oe=jl(),Re=al(),qe=jl(),[Me,Pe,Ne,Le]=(()=>{let e;const[t,l]=Nl(),s=al();return[(l,r,a,o=[],i=()=>[])=>{null!=e||(e=Vl);const u=t(1);return dl(s,u,[l,r,a,o,i]),Ml(Il(r,null!=a?a:[n],ql),u),u},(t,l,...r)=>K(((e,t=[n])=>{const l=[],s=(e,n)=>n==z(t)?Y(l,e):null===t[n]?sl(e,(e=>s(e,n+1))):K([t[n],null],(t=>s(il(e,t),n+1)));return s(e,0),l})(t,l),(t=>sl(t,(t=>il(s,t)[0](e,...null!=l?l:[],...r))))),e=>P(il(s,e),(([,t,r])=>(Il(t,null!=r?r:[n],void 0,(t=>(rl(t,e),tl(t)?1:0))),dl(s,e),l(e),r))),t=>P(il(s,t),(([t,,l=[],n,s])=>{const r=(...a)=>{var o,i;const u=z(a);u==z(l)?t(e,...a,...s(a)):M(l[u])?K(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,l[u])};r()}))]})(),Ee=e=>{if(!ce(e,((e,t)=>[i,u].includes(t))))return!1;const t=e[i];return!(!N(t)&&t!=a||(Ue(e[u])!=t&&ie(e,u),0))},je=E,ze=(t,l)=>(!e||el(F,l)||gt(l))&&ce(t,((e,t)=>$e(l,t,e)),(()=>gt(l))),$e=(e,t,l,n)=>ce(n?l:De(l,e,t),((n,s)=>P(Ae(e,t,s,n),(e=>(l[s]=e,!0)),(()=>!1))),(()=>gt(e,t))),Ae=(t,l,n,s)=>e?P(il(il(F,t),n),(e=>Ue(s)!=e[i]?gt(t,l,n,s,e[u]):s),(()=>gt(t,l,n,s))):M(Ue(s))?gt(t,l,n,s):s,Fe=(e,t)=>ce(t?e:Be(e),((t,l)=>P(Je(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>vt())),Je=(e,l)=>t?P(il(D,e),(t=>Ue(l)!=t[i]?vt(e,l,t[u]):l),(()=>vt(e,l))):M(Ue(l))?vt(e,l):l,De=(e,t,l)=>(P(il(J,t),(([n,s])=>{sl(n,((t,l)=>{oe(e,l)||(e[l]=t)})),sl(s,(n=>{oe(e,n)||gt(t,l,n)}))})),e),Be=e=>(t&&(sl(B,((t,l)=>{oe(e,l)||(e[l]=t)})),sl(Q,(t=>{oe(e,t)||vt(t)}))),e),Qe=e=>hl(F,e,((e,t,l)=>{const n=al(),s=ql();hl(cl(F,t,al),l,((e,t,l)=>{dl(e,t,l),P(l[u],(e=>dl(n,t,e)),(()=>Ml(s,t)))})),dl(J,t,[n,s])}),((e,t)=>{dl(F,t),dl(J,t)})),He=e=>hl(D,e,((e,t,l)=>{dl(D,t,l),P(l[u],(e=>dl(B,t,e)),(()=>Ml(Q,t)))}),((e,t)=>{dl(D,t),dl(B,t),rl(Q,t)})),We=e=>de(e)?Ut():Qt(e),Ge=e=>hl(X,e,((e,t,l)=>Ke(t,l)),((e,t)=>at(t))),Ke=(e,t)=>hl(cl(X,e,(()=>(dt(e,1),dl(H,e,Nl()),dl(W,e,al()),al()))),t,((t,l,n)=>Ze(e,t,l,n)),((t,l)=>ot(e,t,l))),Ze=(e,t,l,n,s)=>hl(cl(t,l,(()=>(ct(e,l,1),al()))),n,((t,n,s)=>_e(e,l,t,n,s)),((n,r)=>it(e,t,l,n,r,s))),_e=(e,t,l,n,s)=>{el(l,n)||ht(e,t,n,1);const r=il(l,n);s!==r&&(mt(e,t,n,r,s),dl(l,n,s))},et=(e,t,l,n,s)=>P(il(t,l),(t=>_e(e,l,t,n,s)),(()=>Ze(e,t,l,De({[n]:s},e,l)))),tt=e=>de(e)?wl():Ht(e),lt=e=>hl(Z,e,((e,t,l)=>nt(t,l)),((e,t)=>ut(t))),nt=(e,t)=>{el(Z,e)||pt(e,1);const l=il(Z,e);t!==l&&(bt(e,l,t),dl(Z,e,t))},st=(e,t)=>{const[l]=il(H,e),n=l(t);return el(il(X,e),n)?st(e,t):n},rt=e=>{var t;return null!=(t=il(X,e))?t:Ke(e,{})},at=e=>Ke(e,{}),ot=(e,t,l)=>{const[,n]=il(H,e);n(l),Ze(e,t,l,{},!0)},it=(e,t,l,n,s,r)=>{var a;const o=il(null==(a=il(J,e))?void 0:a[0],s);if(!M(o)&&!r)return _e(e,l,n,s,o);const i=t=>{mt(e,l,t,il(n,t)),ht(e,l,t,-1),dl(n,t)};M(o)?i(s):ul(n,i),tl(n)&&(ct(e,l,-1),tl(dl(t,l))&&(dt(e,-1),dl(X,e),dl(H,e),dl(W,e)))},ut=e=>{const t=il(B,e);if(!M(t))return nt(e,t);bt(e,il(Z,e)),pt(e,-1),dl(Z,e)},dt=(e,t)=>Al(c,e,t),ct=(e,t,l)=>Al(cl(T,e,al),t,l)&&dl(x,e,cl(x,e,(()=>0))+l),ht=(e,t,l,n)=>{var s;const r=il(W,e),a=null!=(s=il(r,l))?s:0;(0==a&&1==n||1==a&&-1==n)&&Al(cl(k,e,al),l,n),dl(r,l,a!=-n?a+n:null),Al(cl(cl(V,e,al),t,al),l,n)},mt=(e,t,l,n,s)=>{var r;cl(cl(cl(O,e,al),t,al),l,(()=>[n,0]))[1]=s,null==(r=o[3])||r.call(o,e,t,l,s)},pt=(e,t)=>Al(R,e,t),bt=(e,t,l)=>{var n;cl(q,e,(()=>[t,0]))[1]=l,null==(n=o[4])||n.call(o,e,l)},gt=(e,t,l,n,s)=>(Y(cl(cl(cl($,e,al),t,al),l,(()=>[])),n),s),vt=(e,t,l)=>(Y(cl(A,e,(()=>[])),t),l),ft=(e,t,l)=>P(il(il(il(O,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...Ll(Nt(e,t,l))])),It=e=>P(il(q,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Ll(jt(e))])),yt=e=>tl($)||tl(Ce[e])?0:sl(e?fl($):$,((t,l)=>sl(t,((t,n)=>sl(t,((t,s)=>Pe(Ce[e],[l,n,s],t))))))),wt=e=>tl(A)||tl(ke[e])?0:sl(e?gl(A):A,((t,l)=>Pe(ke[e],[l],t))),Ct=(e,t,l,n)=>{if(!tl(e))return Pe(t,n,(()=>ml(e))),ul(e,((e,t)=>Pe(l,[...null!=n?n:[],e],1==t))),1},kt=e=>{const t=zt();t!=l&&Pe(_[e],void 0,t);const n=tl(ge[e]),s=tl(Ie[e])&&tl(ye[e])&&tl(be[e])&&tl(ve[e])&&tl(se[e])&&tl(ae[e])&&tl(he[e])&&n&&tl(te[e])&&tl(le[e]),r=tl(we[e])&&tl(fe[e])&&tl(ne[e])&&tl(ee[e]);if(!s||!r){const t=e?[gl(c),vl(k),gl(x),vl(T),fl(V),fl(O)]:[c,k,x,T,V,O];if(!s){Ct(t[0],te[e],le[e]),sl(t[1],((t,l)=>Ct(t,se[e],ae[e],[l]))),sl(t[2],((t,l)=>{0!=t&&Pe(he[e],[l],Rt(l))}));const l=ql();sl(t[3],((t,s)=>{Ct(t,be[e],ve[e],[s])&&!n&&(Pe(ge[e],[s,null]),Ml(l,s))})),n||sl(t[5],((t,n)=>{if(!el(l,n)){const l=ql();sl(t,(e=>sl(e,(([t,n],s)=>n!==t?Ml(l,s):rl(e,s))))),sl(l,(t=>Pe(ge[e],[n,t])))}})),sl(t[4],((t,l)=>sl(t,((t,n)=>Ct(t,Ie[e],ye[e],[l,n])))))}if(!r){let l;sl(t[5],((t,n)=>{let s;sl(t,((t,r)=>{let a;sl(t,(([t,o],i)=>{o!==t&&(Pe(we[e],[n,r,i],o,t,ft),l=s=a=1)})),a&&Pe(fe[e],[n,r],ft)})),s&&Pe(ne[e],[n],ft)})),l&&Pe(ee[e],void 0,ft)}}},xt=e=>{const t=Dt();t!=s&&Pe(xe[e],void 0,t);const l=tl(Te[e])&&tl(Ve[e]),n=tl(Oe[e])&&tl(Se[e]);if(!l||!n){const t=e?[gl(R),gl(q)]:[R,q];if(l||Ct(t[0],Te[e],Ve[e]),!n){let l;sl(t[1],(([t,n],s)=>{n!==t&&(Pe(Oe[e],[s],n,t,It),l=1)})),l&&Pe(Se[e],void 0,It)}}},St=(e,...t)=>(xl((()=>e(...U(t,S)))),Vl),Tt=()=>bl(X),Vt=()=>ol(X),Ot=e=>ol(il(W,S(e))),Rt=e=>Xt(il(X,S(e))),qt=e=>ol(il(X,S(e))),Mt=(e,t,l,n=0,s)=>{return U(j(G((r=il(X,S(e)),a=(e,l)=>[M(t)?l:il(e,S(t)),l],U([...null!=(o=null==r?void 0:r.entries())?o:[]],(([e,t])=>a(t,e)))),(([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(s=t)?s:0)?-1:1)*(l?-1:1);var n,s})),n,M(s)?s:n+s),(([,e])=>e));var r,a,o},Pt=(e,t)=>ol(il(il(X,S(e)),S(t))),Nt=(e,t,l)=>il(il(il(X,S(e)),S(t)),S(l)),Lt=()=>ml(Z),Et=()=>ol(Z),jt=e=>il(Z,S(e)),zt=()=>!tl(X),$t=e=>el(X,S(e)),At=(e,t)=>el(il(W,S(e)),S(t)),Ft=(e,t)=>el(il(X,S(e)),S(t)),Jt=(e,t,l)=>el(il(il(X,S(e)),S(t)),S(l)),Dt=()=>!tl(Z),Bt=e=>el(Z,S(e)),Qt=e=>St((()=>(e=>ce(e,ze,gt))(e)?Ge(e):0)),Ht=e=>St((()=>Fe(e)?lt(e):0)),Wt=e=>{try{We(me(e))}catch(e){}return Vl},Gt=t=>St((()=>{if((e=ce(t,(e=>ce(e,Ee))))&&(Qe(t),!tl(X))){const e=Tt();Ut(),Qt(e)}})),Kt=e=>St((()=>{if(t=(e=>ce(e,Ee))(e)){const l=Lt();kl(),wl(),t=!0,He(e),Ht(l)}})),Ut=()=>St((()=>Ge({}))),ll=e=>St((e=>el(X,e)?at(e):0),e),yl=(e,t)=>St(((e,t)=>P(il(X,e),(l=>el(l,t)?ot(e,l,t):0))),e,t),wl=()=>St((()=>lt({}))),Cl=()=>St((()=>{Qe({}),e=!1})),kl=()=>St((()=>{He({}),t=!1})),xl=(e,t)=>{if(-1!=r){Sl();const l=e();return Tl(t),l}},Sl=()=>{var e;return-1!=r&&r++,1==r&&(null==(e=o[0])||e.call(o),Pe(Re)),Vl},Tl=e=>{var t,n;return r>0&&(r--,0==r&&(r=1,yt(1),tl(O)||kt(1),wt(1),tl(q)||xt(1),(null==e?void 0:e(Vl))&&(sl(O,((e,t)=>sl(e,((e,l)=>sl(e,(([e],n)=>Xe(Vl,t,l,n,e))))))),nl(O),sl(q,(([e],t)=>Ye(Vl,t,e))),nl(q)),Pe(qe[0],void 0),r=-1,yt(0),tl(O)||kt(0),wt(0),tl(q)||xt(0),null==(t=o[1])||t.call(o),Pe(qe[1],void 0),null==(n=o[2])||n.call(o),r=0,l=zt(),s=Dt(),K([c,k,x,T,V,O,$,R,q,A],nl))),Vl},Vl={getContent:()=>[Tt(),Lt()],getTables:Tt,getTableIds:Vt,getTable:e=>pl(il(X,S(e))),getTableCellIds:Ot,getRowCount:Rt,getRowIds:qt,getSortedRowIds:Mt,getRow:(e,t)=>ml(il(il(X,S(e)),S(t))),getCellIds:Pt,getCell:Nt,getValues:Lt,getValueIds:Et,getValue:jt,hasTables:zt,hasTable:$t,hasTableCell:At,hasRow:Ft,hasCell:Jt,hasValues:Dt,hasValue:Bt,getTablesJson:()=>pe(X),getValuesJson:()=>pe(Z),getJson:()=>pe([X,Z]),getTablesSchemaJson:()=>pe(F),getValuesSchemaJson:()=>pe(D),getSchemaJson:()=>pe([F,D]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>St((()=>je(e)?(([e,t])=>{(de(e)?Ut:Qt)(e),(de(t)?wl:Ht)(t)})(e):0)),setTables:Qt,setTable:(e,t)=>St((e=>ze(t,e)?Ke(e,t):0),e),setRow:(e,t,l)=>St(((e,t)=>$e(e,t,l)?Ze(e,rt(e),t,l):0),e,t),addRow:(e,t,l=!0)=>xl((()=>{let n;return $e(e,n,t)&&(e=S(e),Ze(e,rt(e),n=st(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>St(((e,t)=>{if($e(e,t,l,1)){const n=rt(e);ue(l,((l,s)=>et(e,n,t,s,l)))}}),e,t),setCell:(e,t,l,n)=>St(((e,t,l)=>P(Ae(e,t,l,L(n)?n(Nt(e,t,l)):n),(n=>et(e,rt(e),t,l,n)))),e,t,l),setValues:Ht,setPartialValues:e=>St((()=>Fe(e,1)?ue(e,((e,t)=>nt(t,e))):0)),setValue:(e,t)=>St((e=>P(Je(e,L(t)?t(jt(e)):t),(t=>nt(e,t)))),e),applyChanges:e=>St((()=>{ue(e[0],((e,t)=>M(e)?ll(t):ue(e,((e,l)=>M(e)?yl(t,l):ue(e,((e,n)=>Xe(Vl,t,l,n,e))))))),ue(e[1],((e,t)=>Ye(Vl,t,e)))})),setTablesJson:Wt,setValuesJson:e=>{try{tt(me(e))}catch(e){}return Vl},setJson:e=>St((()=>{try{const[t,l]=me(e);We(t),tt(l)}catch(t){Wt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>St((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:ll,delRow:yl,delCell:(e,t,l,n)=>St(((e,t,l)=>P(il(X,e),(s=>P(il(s,t),(r=>el(r,l)?it(e,s,t,r,l,n):0))))),e,t,l),delValues:wl,delValue:e=>St((e=>el(Z,e)?ut(e):0),e),delTablesSchema:Cl,delValuesSchema:kl,delSchema:()=>St((()=>{Cl(),kl()})),transaction:xl,startTransaction:Sl,getTransactionChanges:()=>[ml(O,((e,t)=>-1===il(c,t)?void 0:ml(e,((e,l)=>-1===il(il(T,t),l)?void 0:ml(e,(([,e])=>e),(e=>$l(e)))),tl,de)),tl,de),ml(q,(([,e])=>e),(e=>$l(e))),1],getTransactionLog:()=>[!tl(O),!tl(q),bl(O,zl,$l),bl($),ml(q,zl,$l),ml(A),ml(c),pl(T),bl(V),ml(R)],finishTransaction:Tl,forEachTable:e=>sl(X,((t,l)=>e(l,(e=>sl(t,((t,l)=>e(l,(e=>ul(t,e))))))))),forEachTableCell:(e,t)=>ul(il(W,S(e)),t),forEachRow:(e,t)=>sl(il(X,S(e)),((e,l)=>t(l,(t=>ul(e,t))))),forEachCell:(e,t,l)=>ul(il(il(X,S(e)),S(t)),l),forEachValue:e=>ul(Z,e),addSortedRowIdsListener:(e,t,l,n,s,r,a)=>{let o=Mt(e,t,l,n,s);return Me((()=>{const a=Mt(e,t,l,n,s);var i,u,d;u=o,z(i=a)===z(u)&&(d=(e,t)=>u[t]===e,i.every(d))||(o=a,r(Vl,e,t,l,n,s,o))}),ge[a?1:0],[e,t],[Vt])},addStartTransactionListener:e=>Me(e,Re),addWillFinishTransactionListener:e=>Me(e,qe[0]),addDidFinishTransactionListener:e=>Me(e,qe[1]),callListener:e=>(Le(e),Vl),delListener:e=>(Ne(e),Vl),getListenerStats:()=>({hasTables:El(_),tables:El(ee),tableIds:El(te),hasTable:El(le),table:El(ne),tableCellIds:El(se),hasTableCell:El(ae,Zt),rowCount:El(he),rowIds:El(be),sortedRowIds:El(ge),hasRow:El(ve,Zt),row:El(fe,Zt),cellIds:El(Ie,Zt),hasCell:El(ye,_t),cell:El(we,_t),invalidCell:El(Ce,_t),hasValues:El(xe),values:El(Se),valueIds:El(Te),hasValue:El(Ve),value:El(Oe),invalidValue:El(ke),transaction:Yt(Re)+El(qe)}),isMergeable:()=>!1,createStore:Fl,addListener:Me,callListeners:Pe,setInternalListeners:(e,t,l,n,s)=>o=[e,t,l,n,s]};return ue({[d+m]:[0,_,[],()=>[zt()]],[m]:[0,ee],[p]:[0,te],[d+h]:[1,le,[Vt],e=>[$t(...e)]],[h]:[1,ne,[Vt]],[h+I]:[1,se,[Vt]],[d+h+f]:[2,ae,[Vt,Ot],e=>[At(...e)]],[g]:[1,he,[Vt]],[v]:[1,be,[Vt]],[d+b]:[2,ve,[Vt,qt],e=>[Ft(...e)]],[b]:[2,fe,[Vt,qt]],[I]:[2,Ie,[Vt,qt]],[d+f]:[3,ye,[Vt,qt,Pt],e=>[Jt(...e)]],[f]:[3,we,[Vt,qt,Pt],e=>Ll(Nt(...e))],InvalidCell:[3,Ce],[d+w]:[0,xe,[],()=>[Dt()]],[w]:[0,Se],[C]:[0,Te],[d+y]:[1,Ve,[Et],e=>[Bt(...e)]],[y]:[1,Oe,[Et],e=>Ll(jt(e[0]))],InvalidValue:[1,ke]},(([e,t,l,n],s)=>{Vl["add"+s+"Listener"]=(...s)=>Me(s[e],t[s[e+1]?1:0],e>0?j(s,0,e):void 0,l,n)})),re(Vl)};exports.Inspector=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(Fl),s=ve.indexOf(e);return t.useCreatePersister(n,(e=>{return t=be,l=sessionStorage,((e,t,l,n,s,r,a,o={},i=[])=>{let u,d,c,h=0,m=0,p=0;cl(Tl,i,(()=>0)),cl(Vl,i,(()=>[]));const[b,g,v,f,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!de(e)||!de(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!de(e)||!de(t),t.setContent]:$("Store type not supported by this Persister"))(a,e),y=t=>{(b&&E(null==t?void 0:t[0])?1===(null==t?void 0:t[2])?e.applyMergeableChanges:e.setMergeableContent:1===(null==t?void 0:t[2])?e.applyChanges:e.setContent)(t)},w=e=>Sl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield S((()=>Sl(void 0,null,(function*(){try{const e=yield t();E(e)?y(e):$("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))))),T})),C=()=>(d&&(s(d),d=void 0),T),k=e=>Sl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield S((()=>Sl(void 0,null,(function*(){try{yield l(g,e)}catch(e){}h=0}))))),T})),x=()=>(P(c,e.delListener),c=void 0,T),S=(...e)=>Sl(void 0,null,(function*(){return Y(il(Vl,i),...e),yield Sl(void 0,null,(function*(){if(!il(Tl,i)){for(dl(Tl,i,1);!M(u=Z(il(Vl,i)));)try{yield u()}catch(e){}dl(Tl,i,0)}})),T})),T=((e,t)=>{for(var l in t||(t={}))Cl.call(t,l)&&xl(e,l,t[l]);if(wl)for(var l of wl(t))kl.call(t,l)&&xl(e,l,t[l]);return e})({load:w,startAutoLoad:e=>Sl(void 0,null,(function*(){yield C().load(e);try{d=yield n(((e,t)=>Sl(void 0,null,(function*(){t||e?2!=h&&(h=1,m++,y(null!=t?t:e),h=0):yield w()}))))}catch(e){}return T})),stopAutoLoad:C,isAutoLoading:()=>!M(d),save:k,startAutoSave:()=>Sl(void 0,null,(function*(){return yield x().save(),c=e.addDidFinishTransactionListener((()=>{const e=v();f(e)&&k(e)})),T})),stopAutoSave:x,isAutoSaving:()=>!M(c),schedule:S,getStore:()=>e,destroy:()=>(il(Vl,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:p})},o);return re(T)})(e,(()=>Ol(void 0,null,(function*(){return e=l.getItem(t),me(e,((e,t)=>""===t?void 0:t));var e}))),(e=>Ol(void 0,null,(function*(){return l.setItem(t,(n=e(),he(n,((e,t)=>void 0===t?"":t))));var n}))),(e=>{const n=n=>{if(n.storageArea===l&&n.key===t)try{e(me(n.newValue))}catch(t){e()}};return T.addEventListener(Rl,n),n}),(e=>T.removeEventListener(Rl,e)),0,3,{getStorageName:()=>t});var t,l}),void 0,(e=>{return t=function*(){yield e.load([{},{position:-1==s?1:s,open:!!l}]),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),J(F,null,J("aside",{id:be},J(Ge,{s:n}),J(Kt,{s:n})),J("style",null,We))};
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("../../ui-react/with-schemas/index.cjs");const l=e=>typeof e,n="",s=l(n),r=l(!0),a=l(0),o=l(l),i="type",u="default",d="Has",c="Ids",h="Table",m=h+"s",p=h+c,b="Row",g=b+"Count",v=b+c,f="Cell",I=f+c,y="Value",w=y+"s",C=y+c,k="currentTarget",x="value",S=e=>n+e,T=globalThis.window,V=Math,O=V.min,R=V.floor,q=isFinite,M=e=>null==e,P=(e,t,l)=>M(e)?null==l?void 0:l():t(e),N=e=>e==s||e==r,L=e=>l(e)==o,E=e=>Array.isArray(e),j=(e,t,l)=>e.slice(t,l),z=e=>e.length,$=e=>{throw Error(e)},{PureComponent:A,Fragment:F,createElement:J,useCallback:D,useLayoutEffect:B,useRef:Q,useState:H}=e,W=(e,...t)=>M(e)?{}:e(...t),G=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),U=(e,t)=>e.map(t),X=e=>0==z(e),Y=(e,...t)=>e.push(...t),Z=e=>e.shift(),_=Object,ee=e=>_.getPrototypeOf(e),te=_.entries,le=_.isFrozen,ne=e=>!M(e)&&P(ee(e),(e=>e==_.prototype||M(ee(e))),(()=>!0)),se=_.keys,re=_.freeze,ae=(e=[])=>_.fromEntries(e),oe=(e,t)=>t in e,ie=(e,t)=>(delete e[t],e),ue=(e,t)=>U(te(e),(([e,l])=>t(l,e))),de=e=>ne(e)&&0==(e=>z(se(e)))(e),ce=(e,t,l,n=0)=>M(e)||!ne(e)||!n&&de(e)||le(e)?(null==l||l(),!1):(ue(e,((l,n)=>{t(l,n)||ie(e,n)})),!!n||!de(e)),he=JSON.stringify,me=JSON.parse,pe=e=>he(e,((e,t)=>t instanceof Map?_.fromEntries([...t]):t)),be="tinybaseInspector",ge="TinyBase Inspector",ve=["left","top","bottom","right","full"],fe="state",Ie="sort",ye="open",we="position",Ce=ye,ke="editable",xe=(...e)=>pe(e),Se=(e,t)=>U(G(e),t),Te=(e,l)=>[!!t.useCell(fe,e,ke,l),D((t=>{l.setCell(fe,e,ke,(e=>!e)),t.preventDefault()}),[l,e])],Ve="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Oe='content:url("',Re=Oe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",qe='</svg>")',Me=Oe+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Pe=U([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>Re+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+qe)),Ne=Re+"<path d='M20 20l60 60M20 80l60-60' />"+qe,Le=Re+`<path d='${Ve}' />`+qe,Ee=Re+`<path d='${Ve}M20 20l60 60' />`+qe;var je=Object.defineProperty,ze=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,Ae=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,De=(e,t,l)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Be=(e,t)=>{for(var l in t||(t={}))Fe.call(t,l)&&De(e,l,t[l]);if(Ae)for(var l of Ae(t))Je.call(t,l)&&De(e,l,t[l]);return e},Qe=(e,t)=>ze(e,$e(t));const He="*::-webkit-scrollbar",We=((e,t="")=>e.join(t))(ue(Qe(Be(Qe(Be(Qe(Be({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[He]:"width:0.5rem;height:0.5rem;",[He+"-track"]:"background:#111",[He+"-thumb"]:"background:#999;border:1px solid #111",[He+"-thumb:hover"]:"background:#fff",[He+"-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;"+Me},ae(U(["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;"}),ae(U(["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)":Me,"header>img:nth-of-type(6)":Ne}),ae(U(Pe,((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":Le,"details[open]>summary img.done":Ee,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,#${be} 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?`#${be} ${t}{${e}}`:""))),Ge=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1,s=t.useSetValueCallback(Ce,(()=>!0),[],e);return t.useValue(Ce,e)?null:J("img",{onClick:s,title:ge,"data-position":n})},Ke=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!t.useCell(fe,e,ye,a),i=t.useSetCellCallback(fe,e,ye,(e=>e[k].open),[],a);return J("details",{open:o,onToggle:i},J("summary",null,l,s?J("img",{onClick:s,className:n?"done":"edit"}):null),r)},Ue=e=>{const t=l(e);return N(t)||t==a&&q(e)?t:void 0},Xe=(e,t,l,n,s)=>M(s)?e.delCell(t,l,n,!0):e.setCell(t,l,n,s),Ye=(e,t,l)=>M(l)?e.delValue(t):e.setValue(t,l),Ze=(e,t,l,n)=>e==s?t:e==a?l:n;var _e=Object.defineProperty,et=Object.defineProperties,tt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,nt=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,rt=(e,t,l)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,at=(e,t)=>{for(var l in t||(t={}))nt.call(t,l)&&rt(e,l,t[l]);if(lt)for(var l of lt(t))st.call(t,l)&&rt(e,l,t[l]);return e},ot=(e,t)=>et(e,tt(t)),it=(e,t)=>{var l={};for(var n in e)nt.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&lt)for(var n of lt(e))t.indexOf(n)<0&&st.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:ut,useMemo:dt,useState:ct}=e,ht="editable",mt=(e,l)=>U(t.useTableCellIds(e,l),(t=>e+"."+t)),pt=(e,t,l)=>{const n=ut(e,t);return l?n:void 0},bt=(...e)=>dt((()=>e),e),gt=(e,t)=>dt((()=>({store:e,tableId:t})),[e,t]),vt=(e,t)=>dt((()=>({queries:e,queryId:t})),[e,t]),ft=(e,t=!1,l,n=0,s,r,a,o)=>{const[[i,u,d],c]=ct([e,t,n]),h=ut((e=>{c(e),null==o||o(e)}),[o]),m=pt((e=>h([e,e==i&&!u,d])),[h,i,u,d],l),p=ut((e=>h([i,u,e])),[h,i,u]),b=!0===a?Mt:a;return[[i,u,d],m,dt((()=>!1===a?null:J(b,{offset:d,limit:s,total:r,onChange:p})),[a,b,d,s,r,p])]},It=(e,t,n)=>dt((()=>{const r=null!=t?t:e;return a=E(r)?ae(U(r,(e=>[e,e]))):r,o=(e,t)=>at(at({},{label:t,component:n}),l(e)==s?{label:e}:e),ae(ue(a,((e,t)=>[t,o(e,t)])));var a,o}),[t,n,e]),yt=({className:e,headerRow:t,idColumn:l,params:[n,s,r,a,o,i]})=>J("table",{className:e},i?J("caption",null,i):null,!1===t?null:J("thead",null,J("tr",null,!1===l?null:J(wt,{sort:null!=a?a:[],label:"Id",onClick:o}),ue(n,(({label:e},t)=>J(wt,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:o}))))),J("tbody",null,U(r,(e=>J("tr",{key:e},!1===l?null:J("th",null,e),ue(n,(({component:t,getComponentProps:l},n)=>J("td",{key:n},J(t,ot(at(at({},W(l,e,n)),s),{rowId:e,cellId:n})))))))))),wt=({cellId:e,sort:[t,l],label:s=(null!=e?e:n),onClick:r})=>J("th",{onClick:pt((()=>null==r?void 0:r(e)),[r,e],r),className:M(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},M(l)||t!=e?null:(l?"↓":"↑")+" ",s),Ct=({localRowId:l,params:[n,s,r,a,o,i,u]})=>{const d=t.useRemoteRowId(o,l,i);return J("tr",null,!1===n?null:J(e.Fragment,null,J("th",null,l),J("th",null,d)),ue(s,(({component:e,getComponentProps:t},n)=>{const[s,o]=n.split(".",2),i=s===r?l:s===a?d:null;return M(i)?null:J("td",{key:n},J(e,ot(at({},W(t,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},kt=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:o=!0})=>{const[i,u]=ct(),[d,c]=ct(),[h,m]=ct(),[p,b]=ct(),[g,v]=ct();d!==e&&(u(Ue(e)),c(e),m(e+""),b(Number(e)||0),v(!!e));const f=ut(((e,l)=>{l(e),c(e),t(e)}),[t]),I=ut((()=>{if(!(null==n?void 0:n())){const e=Ze(i,a,r,s),l=Ze(e,h,p,g);u(e),c(l),t(l)}}),[n,t,h,p,g,i]);return J("div",{className:l},o?J("button",{className:i,onClick:I},i):null,Ze(i,J("input",{key:i,value:h,onChange:ut((e=>f(e[k][x]+"",m)),[f])}),J("input",{key:i,type:"number",value:p,onChange:ut((e=>f(Number(e[k][x]||0),b)),[f])}),J("input",{key:i,type:"checkbox",checked:g,onChange:ut((e=>f(!!e[k].checked,v)),[f])})))},xt=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,p=it(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,g,v]=ft(s,r,d,a,o,t.useRowCount(n,i),c,h);return J(yt,ot(at({},p),{params:bt(It(t.useTableCellIds(n,i),m,u?Rt:t.CellView),gt(i,n),t.useSortedRowIds(n,...b,o,i),b,g,v)}))},St=({store:e,editable:l=!1,valueComponent:n=(l?qt:t.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>J("table",{className:r},!1===a?null:J("thead",null,J("tr",null,!1===o?null:J("th",null,"Id"),J("th",null,y))),J("tbody",null,U(t.useValueIds(e),(t=>J("tr",{key:t},!1===o?null:J("th",null,t),J("td",null,J(n,ot(at({},W(s,t)),{valueId:t,store:e})))))))),Tt=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=l,i=it(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(t.useIndexesOrIndexesById(r),n);return J(yt,ot(at({},i),{params:bt(It(t.useTableCellIds(c,d),o,a?Rt:t.CellView),gt(d,c),t.useSliceRowIds(n,s,u))}))},Vt=({relationshipId:l,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(n),l),m=It([...mt(c,d),...mt(h,d)],r,s?Rt:t.CellView),p=bt(i,m,c,h,l,u,d);return J("table",{className:a},!1===o?null:J("thead",null,J("tr",null,!1===i?null:J(e.Fragment,null,J("th",null,c,".Id"),J("th",null,h,".Id")),ue(m,(({label:e},t)=>J("th",{key:t},e))))),J("tbody",null,U(t.useRowIds(c,d),(e=>J(Ct,{key:e,localRowId:e,params:p})))))},Ot=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=it(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,b,g]=ft(s,r,u,a,o,t.useResultRowCount(n,i),d,h);return J(yt,ot(at({},m),{params:bt(It(t.useResultTableCellIds(n,i),c,t.ResultCellView),vt(i,n),t.useResultSortedRowIds(n,...p,o,i),p,b,g)}))},Rt=({tableId:e,rowId:l,cellId:n,store:s,className:r,showType:a})=>{var o;return J(kt,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:ht+f,showType:a,hasSchema:null==(o=t.useStoreOrStoreById(s))?void 0:o.hasTablesSchema})},qt=({valueId:e,store:l,className:n,showType:s})=>{var r;return J(kt,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:ht+y,showType:s,hasSchema:null==(r=t.useStoreOrStoreById(l))?void 0:r.hasValuesSchema})},Mt=({onChange:t,total:l,offset:n=0,limit:s=l,singular:r="row",plural:a=r+"s"})=>{(n>l||n<0)&&(n=0,t(0));const o=pt((()=>t(n-s)),[t,n,s],n>0),i=pt((()=>t(n+s)),[t,n,s],n+s<l);return J(e.Fragment,null,l>s&&J(e.Fragment,null,J("button",{className:"previous",disabled:0==n,onClick:o},"←"),J("button",{className:"next",disabled:n+s>=l,onClick:i},"→"),n+1," to ",O(l,n+s)," of "),l," ",1!=l?a:r)},Pt=({indexes:e,indexesId:l,indexId:n,s:s})=>J(Ke,{uniqueId:xe("i",l,n),summary:"Index: "+n,s:s},U(t.useSliceIds(n,e),(t=>J(Nt,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s,key:t})))),Nt=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:s})=>{const r=xe("i",t,l,n),[a,o]=Te(r,s);return J(Ke,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},J(Tt,{sliceId:n,indexId:l,indexes:e,editable:a}))},Lt=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return M(n)?null:J(Ke,{uniqueId:xe("i",e),summary:"Indexes: "+(null!=e?e:u),s:l},X(s)?"No indexes defined":Se(s,(t=>J(Pt,{indexes:n,indexesId:e,indexId:t,s:l,key:t}))))},Et=({metrics:e,metricId:l})=>J("tr",null,J("th",null,l),J("td",null,null==e?void 0:e.getTableId(l)),J("td",null,t.useMetric(l,e))),jt=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return M(n)?null:J(Ke,{uniqueId:xe("m",e),summary:"Metrics: "+(null!=e?e:u),s:l},X(s)?"No metrics defined":J("table",null,J("thead",null,J("th",null,"Metric Id"),J("th",null,"Table Id"),J("th",null,"Metric")),J("tbody",null,U(s,(e=>J(Et,{metrics:n,metricId:e,key:e}))))))},zt=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const a=xe("q",l,n),[o,i,u]=me(null!=(r=t.useCell(fe,a,Ie,s))?r:"[]"),d=t.useSetCellCallback(fe,a,Ie,pe,[],s);return J(Ke,{uniqueId:a,summary:"Query: "+n,s:s},J(Ot,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},$t=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return M(n)?null:J(Ke,{uniqueId:xe("q",e),summary:"Queries: "+(null!=e?e:u),s:l},X(s)?"No queries defined":Se(s,(t=>J(zt,{queries:n,queriesId:e,queryId:t,s:l,key:t}))))},At=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const s=xe("r",t,l),[r,a]=Te(s,n);return J(Ke,{uniqueId:s,summary:"Relationship: "+l,editable:r,handleEditable:a,s:n},J(Vt,{relationshipId:l,relationships:e,editable:r}))},Ft=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return M(n)?null:J(Ke,{uniqueId:xe("r",e),summary:"Relationships: "+(null!=e?e:u),s:l},X(s)?"No relationships defined":Se(s,(t=>J(At,{relationships:n,relationshipsId:e,relationshipId:t,s:l,key:t}))))},Jt=({tableId:e,store:l,storeId:n,s:s})=>{var r;const a=xe("t",n,e),[o,i,u]=me(null!=(r=t.useCell(fe,a,Ie,s))?r:"[]"),d=t.useSetCellCallback(fe,a,Ie,pe,[],s),[c,m]=Te(a,s);return J(Ke,{uniqueId:a,summary:h+": "+e,editable:c,handleEditable:m,s:s},J(xt,{tableId:e,store:l,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Dt=({store:e,storeId:l,s:n})=>{const s=xe("v",l),[r,a]=Te(s,n);return X(t.useValueIds(e))?null:J(Ke,{uniqueId:s,summary:w,editable:r,handleEditable:a,s:n},J(St,{store:e,editable:r}))},Bt=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return M(n)?null:J(Ke,{uniqueId:xe("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(null!=e?e:u),s:l},J(Dt,{storeId:e,store:n,s:l}),Se(s,(t=>J(Jt,{store:n,storeId:e,tableId:t,s:l,key:t}))))},Qt=({s:e})=>{const l=Q(null),n=Q(0),[s,r]=H(!1),{scrollLeft:a,scrollTop:o}=t.useValues(e);B((()=>{const e=l.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=R(a)+e.clientWidth&&e.scrollHeight>=R(o)+e.clientHeight&&e.scrollTo(a,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,o]);const i=D((t=>{const{scrollLeft:l,scrollTop:s}=t[k];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:l,scrollTop:s})}))}),[e]),u=t.useStore(),d=t.useStoreIds(),c=t.useMetrics(),h=t.useMetricsIds(),m=t.useIndexes(),p=t.useIndexesIds(),b=t.useRelationships(),g=t.useRelationshipsIds(),v=t.useQueries(),f=t.useQueriesIds();return M(u)&&X(d)&&M(c)&&X(h)&&M(m)&&X(p)&&M(b)&&X(g)&&M(v)&&X(f)?J("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):J("article",{ref:l,onScroll:i},J(Bt,{s:e}),U(d,(t=>J(Bt,{storeId:t,s:e,key:t}))),J(jt,{s:e}),U(h,(t=>J(jt,{metricsId:t,s:e,key:t}))),J(Lt,{s:e}),U(p,(t=>J(Lt,{indexesId:t,s:e,key:t}))),J(Ft,{s:e}),U(g,(t=>J(Ft,{relationshipsId:t,s:e,key:t}))),J($t,{s:e}),U(f,(t=>J($t,{queriesId:t,s:e,key:t}))))};var Ht=Object.defineProperty;class Wt extends A{constructor(e){var t,l,n;super(e),n=(e,t)=>console.error(e,t.componentStack),(l="componentDidCatch")in(t=this)?Ht(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?J("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const Gt=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1,s=t.useSetValueCallback(Ce,(()=>!1),[],e),r=t.useSetValueCallback(we,(e=>Number(e[k].dataset.id)),[],e);return J("header",null,J("img",{title:ge}),J("span",null,ge),U(ve,((e,t)=>t==n?null:J("img",{onClick:r,"data-id":t,title:"Dock to "+e,key:t}))),J("img",{onClick:s,title:"Close"}))},Kt=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1;return t.useValue(Ce,e)?J("main",{"data-position":n},J(Gt,{s:e}),J(Wt,null,J(Qt,{s:e}))):null},Ut=e=>t=>{return l=(t,l)=>t+e(l),ll(t).reduce(l,0);var l},Xt=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Yt=Ut(Xt),Zt=Ut(Yt),_t=Ut(Zt),el=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},tl=e=>M(e)||0==Xt(e),ll=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},nl=e=>e.clear(),sl=(e,t)=>null==e?void 0:e.forEach(t),rl=(e,t)=>null==e?void 0:e.delete(t),al=e=>new Map(e),ol=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},il=(e,t)=>null==e?void 0:e.get(t),ul=(e,t)=>sl(e,((e,l)=>t(l,e))),dl=(e,t,l)=>M(l)?(rl(e,t),e):null==e?void 0:e.set(t,l),cl=(e,t,l,n)=>(el(e,t)?null==n||n(il(e,t)):dl(e,t,l()),il(e,t)),hl=(e,t,l,n=dl)=>(ue(t,((t,n)=>l(e,n,t))),ul(e,(l=>oe(t,l)?0:n(e,l))),e),ml=(e,t,l,n)=>{const s={};return sl(e,((e,r)=>{if(!(null==l?void 0:l(e,r))){const l=t?t(e,r):e;(null==n?void 0:n(l))||(s[r]=l)}})),s},pl=(e,t,l)=>ml(e,(e=>ml(e,t,l)),tl,de),bl=(e,t,l)=>ml(e,(e=>pl(e,t,l)),tl,de),gl=(e,t)=>{const l=al();return sl(e,((e,n)=>{var s;return l.set(n,null!=(s=null==t?void 0:t(e))?s:e)})),l},vl=e=>gl(e,gl),fl=e=>gl(e,vl),Il=(e,t,l,n,s=0)=>P((l?cl:il)(e,t[s],s>z(t)-2?l:al),(r=>{if(s>z(t)-2)return(null==n?void 0:n(r))&&dl(e,t[s]),r;const a=Il(r,t,l,n,s+1);return tl(r)&&dl(e,t[s]),a}));var yl=Object.defineProperty,wl=Object.getOwnPropertySymbols,Cl=Object.prototype.hasOwnProperty,kl=Object.prototype.propertyIsEnumerable,xl=(e,t,l)=>t in e?yl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Sl=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Tl=al(),Vl=al();var Ol=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Rl="storage",ql=e=>new Set(E(e)||M(e)?e:[e]),Ml=(e,t)=>null==e?void 0:e.add(t),Pl=/^\d+$/,Nl=()=>{const e=[];let t=0;return[l=>{var s;return null!=(s=l?Z(e):null)?s:n+t++},t=>{Pl.test(t)&&z(e)<1e3&&Y(e,t)}]},Ll=e=>[e,e],El=(e,t=Yt)=>t(e[0])+t(e[1]),jl=()=>[al(),al()],zl=e=>[...e],$l=([e,t])=>e===t;al(U("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(n),((e,t)=>[e,t])));const Al=(e,t,l)=>dl(e,t,il(e,t)==-l?void 0:l),Fl=()=>{let e,t,l=!1,s=!1,r=0,o=[];const c=al(),k=al(),x=al(),T=al(),V=al(),O=al(),R=al(),q=al(),$=al(),A=al(),F=al(),J=al(),D=al(),B=al(),Q=ql(),H=al(),W=al(),X=al(),Z=al(),_=jl(),ee=jl(),te=jl(),le=jl(),ne=jl(),se=jl(),ae=jl(),he=jl(),be=jl(),ge=jl(),ve=jl(),fe=jl(),Ie=jl(),ye=jl(),we=jl(),Ce=jl(),ke=jl(),xe=jl(),Se=jl(),Te=jl(),Ve=jl(),Oe=jl(),Re=al(),qe=jl(),[Me,Pe,Ne,Le]=(()=>{let e;const[t,l]=Nl(),s=al();return[(l,r,a,o=[],i=()=>[])=>{null!=e||(e=Vl);const u=t(1);return dl(s,u,[l,r,a,o,i]),Ml(Il(r,null!=a?a:[n],ql),u),u},(t,l,...r)=>K(((e,t=[n])=>{const l=[],s=(e,n)=>n==z(t)?Y(l,e):null===t[n]?sl(e,(e=>s(e,n+1))):K([t[n],null],(t=>s(il(e,t),n+1)));return s(e,0),l})(t,l),(t=>sl(t,(t=>il(s,t)[0](e,...null!=l?l:[],...r))))),e=>P(il(s,e),(([,t,r])=>(Il(t,null!=r?r:[n],void 0,(t=>(rl(t,e),tl(t)?1:0))),dl(s,e),l(e),r))),t=>P(il(s,t),(([t,,l=[],n,s])=>{const r=(...a)=>{var o,i;const u=z(a);u==z(l)?t(e,...a,...s(a)):M(l[u])?K(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,l[u])};r()}))]})(),Ee=e=>{if(!ce(e,((e,t)=>[i,u].includes(t))))return!1;const t=e[i];return!(!N(t)&&t!=a||(Ue(e[u])!=t&&ie(e,u),0))},je=E,ze=(t,l)=>(!e||el(F,l)||gt(l))&&ce(t,((e,t)=>$e(l,t,e)),(()=>gt(l))),$e=(e,t,l,n)=>ce(n?l:De(l,e,t),((n,s)=>P(Ae(e,t,s,n),(e=>(l[s]=e,!0)),(()=>!1))),(()=>gt(e,t))),Ae=(t,l,n,s)=>e?P(il(il(F,t),n),(e=>Ue(s)!=e[i]?gt(t,l,n,s,e[u]):s),(()=>gt(t,l,n,s))):M(Ue(s))?gt(t,l,n,s):s,Fe=(e,t)=>ce(t?e:Be(e),((t,l)=>P(Je(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>vt())),Je=(e,l)=>t?P(il(D,e),(t=>Ue(l)!=t[i]?vt(e,l,t[u]):l),(()=>vt(e,l))):M(Ue(l))?vt(e,l):l,De=(e,t,l)=>(P(il(J,t),(([n,s])=>{sl(n,((t,l)=>{oe(e,l)||(e[l]=t)})),sl(s,(n=>{oe(e,n)||gt(t,l,n)}))})),e),Be=e=>(t&&(sl(B,((t,l)=>{oe(e,l)||(e[l]=t)})),sl(Q,(t=>{oe(e,t)||vt(t)}))),e),Qe=e=>hl(F,e,((e,t,l)=>{const n=al(),s=ql();hl(cl(F,t,al),l,((e,t,l)=>{dl(e,t,l),P(l[u],(e=>dl(n,t,e)),(()=>Ml(s,t)))})),dl(J,t,[n,s])}),((e,t)=>{dl(F,t),dl(J,t)})),He=e=>hl(D,e,((e,t,l)=>{dl(D,t,l),P(l[u],(e=>dl(B,t,e)),(()=>Ml(Q,t)))}),((e,t)=>{dl(D,t),dl(B,t),rl(Q,t)})),We=e=>de(e)?Ut():Qt(e),Ge=e=>hl(X,e,((e,t,l)=>Ke(t,l)),((e,t)=>at(t))),Ke=(e,t)=>hl(cl(X,e,(()=>(dt(e,1),dl(H,e,Nl()),dl(W,e,al()),al()))),t,((t,l,n)=>Ze(e,t,l,n)),((t,l)=>ot(e,t,l))),Ze=(e,t,l,n,s)=>hl(cl(t,l,(()=>(ct(e,l,1),al()))),n,((t,n,s)=>_e(e,l,t,n,s)),((n,r)=>it(e,t,l,n,r,s))),_e=(e,t,l,n,s)=>{el(l,n)||ht(e,t,n,1);const r=il(l,n);s!==r&&(mt(e,t,n,r,s),dl(l,n,s))},et=(e,t,l,n,s)=>P(il(t,l),(t=>_e(e,l,t,n,s)),(()=>Ze(e,t,l,De({[n]:s},e,l)))),tt=e=>de(e)?wl():Ht(e),lt=e=>hl(Z,e,((e,t,l)=>nt(t,l)),((e,t)=>ut(t))),nt=(e,t)=>{el(Z,e)||pt(e,1);const l=il(Z,e);t!==l&&(bt(e,l,t),dl(Z,e,t))},st=(e,t)=>{const[l]=il(H,e),n=l(t);return el(il(X,e),n)?st(e,t):n},rt=e=>{var t;return null!=(t=il(X,e))?t:Ke(e,{})},at=e=>Ke(e,{}),ot=(e,t,l)=>{const[,n]=il(H,e);n(l),Ze(e,t,l,{},!0)},it=(e,t,l,n,s,r)=>{var a;const o=il(null==(a=il(J,e))?void 0:a[0],s);if(!M(o)&&!r)return _e(e,l,n,s,o);const i=t=>{mt(e,l,t,il(n,t)),ht(e,l,t,-1),dl(n,t)};M(o)?i(s):ul(n,i),tl(n)&&(ct(e,l,-1),tl(dl(t,l))&&(dt(e,-1),dl(X,e),dl(H,e),dl(W,e)))},ut=e=>{const t=il(B,e);if(!M(t))return nt(e,t);bt(e,il(Z,e)),pt(e,-1),dl(Z,e)},dt=(e,t)=>Al(c,e,t),ct=(e,t,l)=>Al(cl(T,e,al),t,l)&&dl(x,e,cl(x,e,(()=>0))+l),ht=(e,t,l,n)=>{var s;const r=il(W,e),a=null!=(s=il(r,l))?s:0;(0==a&&1==n||1==a&&-1==n)&&Al(cl(k,e,al),l,n),dl(r,l,a!=-n?a+n:null),Al(cl(cl(V,e,al),t,al),l,n)},mt=(e,t,l,n,s)=>{var r;cl(cl(cl(O,e,al),t,al),l,(()=>[n,0]))[1]=s,null==(r=o[3])||r.call(o,e,t,l,s)},pt=(e,t)=>Al(R,e,t),bt=(e,t,l)=>{var n;cl(q,e,(()=>[t,0]))[1]=l,null==(n=o[4])||n.call(o,e,l)},gt=(e,t,l,n,s)=>(Y(cl(cl(cl($,e,al),t,al),l,(()=>[])),n),s),vt=(e,t,l)=>(Y(cl(A,e,(()=>[])),t),l),ft=(e,t,l)=>P(il(il(il(O,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...Ll(Nt(e,t,l))])),It=e=>P(il(q,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Ll(jt(e))])),yt=e=>tl($)||tl(Ce[e])?0:sl(e?fl($):$,((t,l)=>sl(t,((t,n)=>sl(t,((t,s)=>Pe(Ce[e],[l,n,s],t))))))),wt=e=>tl(A)||tl(ke[e])?0:sl(e?gl(A):A,((t,l)=>Pe(ke[e],[l],t))),Ct=(e,t,l,n)=>{if(!tl(e))return Pe(t,n,(()=>ml(e))),ul(e,((e,t)=>Pe(l,[...null!=n?n:[],e],1==t))),1},kt=e=>{const t=zt();t!=l&&Pe(_[e],void 0,t);const n=tl(ge[e]),s=tl(Ie[e])&&tl(ye[e])&&tl(be[e])&&tl(ve[e])&&tl(se[e])&&tl(ae[e])&&tl(he[e])&&n&&tl(te[e])&&tl(le[e]),r=tl(we[e])&&tl(fe[e])&&tl(ne[e])&&tl(ee[e]);if(!s||!r){const t=e?[gl(c),vl(k),gl(x),vl(T),fl(V),fl(O)]:[c,k,x,T,V,O];if(!s){Ct(t[0],te[e],le[e]),sl(t[1],((t,l)=>Ct(t,se[e],ae[e],[l]))),sl(t[2],((t,l)=>{0!=t&&Pe(he[e],[l],Rt(l))}));const l=ql();sl(t[3],((t,s)=>{Ct(t,be[e],ve[e],[s])&&!n&&(Pe(ge[e],[s,null]),Ml(l,s))})),n||sl(t[5],((t,n)=>{if(!el(l,n)){const l=ql();sl(t,(e=>sl(e,(([t,n],s)=>n!==t?Ml(l,s):rl(e,s))))),sl(l,(t=>Pe(ge[e],[n,t])))}})),sl(t[4],((t,l)=>sl(t,((t,n)=>Ct(t,Ie[e],ye[e],[l,n])))))}if(!r){let l;sl(t[5],((t,n)=>{let s;sl(t,((t,r)=>{let a;sl(t,(([t,o],i)=>{o!==t&&(Pe(we[e],[n,r,i],o,t,ft),l=s=a=1)})),a&&Pe(fe[e],[n,r],ft)})),s&&Pe(ne[e],[n],ft)})),l&&Pe(ee[e],void 0,ft)}}},xt=e=>{const t=Dt();t!=s&&Pe(xe[e],void 0,t);const l=tl(Te[e])&&tl(Ve[e]),n=tl(Oe[e])&&tl(Se[e]);if(!l||!n){const t=e?[gl(R),gl(q)]:[R,q];if(l||Ct(t[0],Te[e],Ve[e]),!n){let l;sl(t[1],(([t,n],s)=>{n!==t&&(Pe(Oe[e],[s],n,t,It),l=1)})),l&&Pe(Se[e],void 0,It)}}},St=(e,...t)=>(xl((()=>e(...U(t,S)))),Vl),Tt=()=>bl(X),Vt=()=>ol(X),Ot=e=>ol(il(W,S(e))),Rt=e=>Xt(il(X,S(e))),qt=e=>ol(il(X,S(e))),Mt=(e,t,l,n=0,s)=>{return U(j(G((r=il(X,S(e)),a=(e,l)=>[M(t)?l:il(e,S(t)),l],U([...null!=(o=null==r?void 0:r.entries())?o:[]],(([e,t])=>a(t,e)))),(([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(s=t)?s:0)?-1:1)*(l?-1:1);var n,s})),n,M(s)?s:n+s),(([,e])=>e));var r,a,o},Pt=(e,t)=>ol(il(il(X,S(e)),S(t))),Nt=(e,t,l)=>il(il(il(X,S(e)),S(t)),S(l)),Lt=()=>ml(Z),Et=()=>ol(Z),jt=e=>il(Z,S(e)),zt=()=>!tl(X),$t=e=>el(X,S(e)),At=(e,t)=>el(il(W,S(e)),S(t)),Ft=(e,t)=>el(il(X,S(e)),S(t)),Jt=(e,t,l)=>el(il(il(X,S(e)),S(t)),S(l)),Dt=()=>!tl(Z),Bt=e=>el(Z,S(e)),Qt=e=>St((()=>(e=>ce(e,ze,gt))(e)?Ge(e):0)),Ht=e=>St((()=>Fe(e)?lt(e):0)),Wt=e=>{try{We(me(e))}catch(e){}return Vl},Gt=t=>St((()=>{if((e=ce(t,(e=>ce(e,Ee))))&&(Qe(t),!tl(X))){const e=Tt();Ut(),Qt(e)}})),Kt=e=>St((()=>{if(t=(e=>ce(e,Ee))(e)){const l=Lt();kl(),wl(),t=!0,He(e),Ht(l)}})),Ut=()=>St((()=>Ge({}))),ll=e=>St((e=>el(X,e)?at(e):0),e),yl=(e,t)=>St(((e,t)=>P(il(X,e),(l=>el(l,t)?ot(e,l,t):0))),e,t),wl=()=>St((()=>lt({}))),Cl=()=>St((()=>{Qe({}),e=!1})),kl=()=>St((()=>{He({}),t=!1})),xl=(e,t)=>{if(-1!=r){Sl();const l=e();return Tl(t),l}},Sl=()=>{var e;return-1!=r&&r++,1==r&&(null==(e=o[0])||e.call(o),Pe(Re)),Vl},Tl=e=>{var t,n;return r>0&&(r--,0==r&&(r=1,yt(1),tl(O)||kt(1),wt(1),tl(q)||xt(1),(null==e?void 0:e(Vl))&&(sl(O,((e,t)=>sl(e,((e,l)=>sl(e,(([e],n)=>Xe(Vl,t,l,n,e))))))),nl(O),sl(q,(([e],t)=>Ye(Vl,t,e))),nl(q)),Pe(qe[0],void 0),r=-1,yt(0),tl(O)||kt(0),wt(0),tl(q)||xt(0),null==(t=o[1])||t.call(o),Pe(qe[1],void 0),null==(n=o[2])||n.call(o),r=0,l=zt(),s=Dt(),K([c,k,x,T,V,O,$,R,q,A],nl))),Vl},Vl={getContent:()=>[Tt(),Lt()],getTables:Tt,getTableIds:Vt,getTable:e=>pl(il(X,S(e))),getTableCellIds:Ot,getRowCount:Rt,getRowIds:qt,getSortedRowIds:Mt,getRow:(e,t)=>ml(il(il(X,S(e)),S(t))),getCellIds:Pt,getCell:Nt,getValues:Lt,getValueIds:Et,getValue:jt,hasTables:zt,hasTable:$t,hasTableCell:At,hasRow:Ft,hasCell:Jt,hasValues:Dt,hasValue:Bt,getTablesJson:()=>pe(X),getValuesJson:()=>pe(Z),getJson:()=>pe([X,Z]),getTablesSchemaJson:()=>pe(F),getValuesSchemaJson:()=>pe(D),getSchemaJson:()=>pe([F,D]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>St((()=>je(e)?(([e,t])=>{(de(e)?Ut:Qt)(e),(de(t)?wl:Ht)(t)})(e):0)),setTables:Qt,setTable:(e,t)=>St((e=>ze(t,e)?Ke(e,t):0),e),setRow:(e,t,l)=>St(((e,t)=>$e(e,t,l)?Ze(e,rt(e),t,l):0),e,t),addRow:(e,t,l=!0)=>xl((()=>{let n;return $e(e,n,t)&&(e=S(e),Ze(e,rt(e),n=st(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>St(((e,t)=>{if($e(e,t,l,1)){const n=rt(e);ue(l,((l,s)=>et(e,n,t,s,l)))}}),e,t),setCell:(e,t,l,n)=>St(((e,t,l)=>P(Ae(e,t,l,L(n)?n(Nt(e,t,l)):n),(n=>et(e,rt(e),t,l,n)))),e,t,l),setValues:Ht,setPartialValues:e=>St((()=>Fe(e,1)?ue(e,((e,t)=>nt(t,e))):0)),setValue:(e,t)=>St((e=>P(Je(e,L(t)?t(jt(e)):t),(t=>nt(e,t)))),e),applyChanges:e=>St((()=>{ue(e[0],((e,t)=>M(e)?ll(t):ue(e,((e,l)=>M(e)?yl(t,l):ue(e,((e,n)=>Xe(Vl,t,l,n,e))))))),ue(e[1],((e,t)=>Ye(Vl,t,e)))})),setTablesJson:Wt,setValuesJson:e=>{try{tt(me(e))}catch(e){}return Vl},setJson:e=>St((()=>{try{const[t,l]=me(e);We(t),tt(l)}catch(t){Wt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>St((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:ll,delRow:yl,delCell:(e,t,l,n)=>St(((e,t,l)=>P(il(X,e),(s=>P(il(s,t),(r=>el(r,l)?it(e,s,t,r,l,n):0))))),e,t,l),delValues:wl,delValue:e=>St((e=>el(Z,e)?ut(e):0),e),delTablesSchema:Cl,delValuesSchema:kl,delSchema:()=>St((()=>{Cl(),kl()})),transaction:xl,startTransaction:Sl,getTransactionChanges:()=>[ml(O,((e,t)=>-1===il(c,t)?void 0:ml(e,((e,l)=>-1===il(il(T,t),l)?void 0:ml(e,(([,e])=>e),(e=>$l(e)))),tl,de)),tl,de),ml(q,(([,e])=>e),(e=>$l(e))),1],getTransactionLog:()=>[!tl(O),!tl(q),bl(O,zl,$l),bl($),ml(q,zl,$l),ml(A),ml(c),pl(T),bl(V),ml(R)],finishTransaction:Tl,forEachTable:e=>sl(X,((t,l)=>e(l,(e=>sl(t,((t,l)=>e(l,(e=>ul(t,e))))))))),forEachTableCell:(e,t)=>ul(il(W,S(e)),t),forEachRow:(e,t)=>sl(il(X,S(e)),((e,l)=>t(l,(t=>ul(e,t))))),forEachCell:(e,t,l)=>ul(il(il(X,S(e)),S(t)),l),forEachValue:e=>ul(Z,e),addSortedRowIdsListener:(e,t,l,n,s,r,a)=>{let o=Mt(e,t,l,n,s);return Me((()=>{const a=Mt(e,t,l,n,s);var i,u,d;u=o,z(i=a)===z(u)&&(d=(e,t)=>u[t]===e,i.every(d))||(o=a,r(Vl,e,t,l,n,s,o))}),ge[a?1:0],[e,t],[Vt])},addStartTransactionListener:e=>Me(e,Re),addWillFinishTransactionListener:e=>Me(e,qe[0]),addDidFinishTransactionListener:e=>Me(e,qe[1]),callListener:e=>(Le(e),Vl),delListener:e=>(Ne(e),Vl),getListenerStats:()=>({hasTables:El(_),tables:El(ee),tableIds:El(te),hasTable:El(le),table:El(ne),tableCellIds:El(se),hasTableCell:El(ae,Zt),rowCount:El(he),rowIds:El(be),sortedRowIds:El(ge),hasRow:El(ve,Zt),row:El(fe,Zt),cellIds:El(Ie,Zt),hasCell:El(ye,_t),cell:El(we,_t),invalidCell:El(Ce,_t),hasValues:El(xe),values:El(Se),valueIds:El(Te),hasValue:El(Ve),value:El(Oe),invalidValue:El(ke),transaction:Yt(Re)+El(qe)}),isMergeable:()=>!1,createStore:Fl,addListener:Me,callListeners:Pe,setInternalListeners:(e,t,l,n,s)=>o=[e,t,l,n,s]};return ue({[d+m]:[0,_,[],()=>[zt()]],[m]:[0,ee],[p]:[0,te],[d+h]:[1,le,[Vt],e=>[$t(...e)]],[h]:[1,ne,[Vt]],[h+I]:[1,se,[Vt]],[d+h+f]:[2,ae,[Vt,Ot],e=>[At(...e)]],[g]:[1,he,[Vt]],[v]:[1,be,[Vt]],[d+b]:[2,ve,[Vt,qt],e=>[Ft(...e)]],[b]:[2,fe,[Vt,qt]],[I]:[2,Ie,[Vt,qt]],[d+f]:[3,ye,[Vt,qt,Pt],e=>[Jt(...e)]],[f]:[3,we,[Vt,qt,Pt],e=>Ll(Nt(...e))],InvalidCell:[3,Ce],[d+w]:[0,xe,[],()=>[Dt()]],[w]:[0,Se],[C]:[0,Te],[d+y]:[1,Ve,[Et],e=>[Bt(...e)]],[y]:[1,Oe,[Et],e=>Ll(jt(e[0]))],InvalidValue:[1,ke]},(([e,t,l,n],s)=>{Vl["add"+s+"Listener"]=(...s)=>Me(s[e],t[s[e+1]?1:0],e>0?j(s,0,e):void 0,l,n)})),re(Vl)};exports.Inspector=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(Fl),s=ve.indexOf(e);return t.useCreatePersister(n,(e=>{return t=be,l=sessionStorage,((e,t,l,n,s,r,a,o={},i=[])=>{let u,d,c,h=0,m=0,p=0;cl(Tl,i,(()=>0)),cl(Vl,i,(()=>[]));const[b,g,v,f,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!de(e)||!de(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!de(e)||!de(t),t.setContent]:$("Store type not supported by this Persister"))(a,e),y=t=>{(b&&E(null==t?void 0:t[0])?1===(null==t?void 0:t[2])?e.applyMergeableChanges:e.setMergeableContent:1===(null==t?void 0:t[2])?e.applyChanges:e.setContent)(t)},w=e=>Sl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield S((()=>Sl(void 0,null,(function*(){try{const e=yield t();E(e)?y(e):$("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))))),T})),C=()=>(d&&(s(d),d=void 0),T),k=e=>Sl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield S((()=>Sl(void 0,null,(function*(){try{yield l(g,e)}catch(e){}h=0}))))),T})),x=()=>(P(c,e.delListener),c=void 0,T),S=(...e)=>Sl(void 0,null,(function*(){return Y(il(Vl,i),...e),yield Sl(void 0,null,(function*(){if(!il(Tl,i)){for(dl(Tl,i,1);!M(u=Z(il(Vl,i)));)try{yield u()}catch(e){}dl(Tl,i,0)}})),T})),T=((e,t)=>{for(var l in t||(t={}))Cl.call(t,l)&&xl(e,l,t[l]);if(wl)for(var l of wl(t))kl.call(t,l)&&xl(e,l,t[l]);return e})({load:w,startAutoLoad:e=>Sl(void 0,null,(function*(){yield C().load(e);try{d=yield n(((e,t)=>Sl(void 0,null,(function*(){t||e?2!=h&&(h=1,m++,y(null!=t?t:e),h=0):yield w()}))))}catch(e){}return T})),stopAutoLoad:C,isAutoLoading:()=>!M(d),save:k,startAutoSave:()=>Sl(void 0,null,(function*(){return yield x().save(),c=e.addDidFinishTransactionListener((()=>{const e=v();f(e)&&k(e)})),T})),stopAutoSave:x,isAutoSaving:()=>!M(c),schedule:S,getStore:()=>e,destroy:()=>(il(Vl,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:p})},o);return re(T)})(e,(()=>Ol(void 0,null,(function*(){return e=l.getItem(t),me(e,((e,t)=>""===t?void 0:t));var e}))),(e=>Ol(void 0,null,(function*(){return l.setItem(t,(n=e(),he(n,((e,t)=>void 0===t?"":t))));var n}))),(e=>{const n=n=>{if(n.storageArea===l&&n.key===t)try{e(me(n.newValue))}catch(t){e()}};return T.addEventListener(Rl,n),n}),(e=>T.removeEventListener(Rl,e)),0,3,{getStorageName:()=>t});var t,l}),void 0,(e=>{return t=function*(){yield e.load([{},{position:-1==s?1:s,open:!!l}]),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),J(F,null,J("aside",{id:be},J(Ge,{s:n}),J(Kt,{s:n})),J("style",null,We))};
1
+ "use strict";var e=require("react"),t=require("../../ui-react/with-schemas/index.cjs");const l=e=>typeof e,n="",s=l(n),r=l(!0),a=l(0),o=l(l),i="type",u="default",d="Has",c="Ids",h="Table",m=h+"s",p=h+c,b="Row",g=b+"Count",v=b+c,f="Cell",I=f+c,y="Value",w=y+"s",C=y+c,k="currentTarget",x="value",S=e=>n+e,T=globalThis.window,V=Math,O=V.min,R=V.floor,q=isFinite,M=e=>null==e,P=(e,t,l)=>M(e)?null==l?void 0:l():t(e),N=e=>e==s||e==r,L=e=>l(e)==o,E=e=>Array.isArray(e),j=(e,t,l)=>e.slice(t,l),z=e=>e.length,$=e=>{throw Error(e)},{PureComponent:A,Fragment:F,createElement:J,useCallback:D,useLayoutEffect:B,useRef:Q,useState:H}=e,W=(e,...t)=>M(e)?{}:e(...t),G=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),U=(e,t)=>e.map(t),X=e=>0==z(e),Y=(e,...t)=>e.push(...t),Z=e=>e.shift(),_=Object,ee=e=>_.getPrototypeOf(e),te=_.entries,le=_.isFrozen,ne=e=>!M(e)&&P(ee(e),(e=>e==_.prototype||M(ee(e))),(()=>!0)),se=_.keys,re=_.freeze,ae=(e=[])=>_.fromEntries(e),oe=(e,t)=>t in e,ie=(e,t)=>(delete e[t],e),ue=(e,t)=>U(te(e),(([e,l])=>t(l,e))),de=e=>ne(e)&&0==(e=>z(se(e)))(e),ce=(e,t,l,n=0)=>M(e)||!ne(e)||!n&&de(e)||le(e)?(null==l||l(),!1):(ue(e,((l,n)=>{t(l,n)||ie(e,n)})),!!n||!de(e)),he=JSON.stringify,me=JSON.parse,pe=e=>he(e,((e,t)=>t instanceof Map?_.fromEntries([...t]):t)),be="tinybaseInspector",ge="TinyBase Inspector",ve=["left","top","bottom","right","full"],fe="state",Ie="sort",ye="open",we="position",Ce=ye,ke="editable",xe=(...e)=>pe(e),Se=(e,t)=>U(G([...e]),t),Te=(e,l)=>[!!t.useCell(fe,e,ke,l),D((t=>{l.setCell(fe,e,ke,(e=>!e)),t.preventDefault()}),[l,e])],Ve="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Oe='content:url("',Re=Oe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",qe='</svg>")',Me=Oe+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Pe=U([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>Re+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+qe)),Ne=Re+"<path d='M20 20l60 60M20 80l60-60' />"+qe,Le=Re+`<path d='${Ve}' />`+qe,Ee=Re+`<path d='${Ve}M20 20l60 60' />`+qe;var je=Object.defineProperty,ze=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,Ae=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,De=(e,t,l)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Be=(e,t)=>{for(var l in t||(t={}))Fe.call(t,l)&&De(e,l,t[l]);if(Ae)for(var l of Ae(t))Je.call(t,l)&&De(e,l,t[l]);return e},Qe=(e,t)=>ze(e,$e(t));const He="*::-webkit-scrollbar",We=((e,t="")=>e.join(t))(ue(Qe(Be(Qe(Be(Qe(Be({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[He]:"width:0.5rem;height:0.5rem;",[He+"-track"]:"background:#111",[He+"-thumb"]:"background:#999;border:1px solid #111",[He+"-thumb:hover"]:"background:#fff",[He+"-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;"+Me},ae(U(["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;"}),ae(U(["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)":Me,"header>img:nth-of-type(6)":Ne}),ae(U(Pe,((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":Le,"details[open]>summary img.done":Ee,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,#${be} 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?`#${be} ${t}{${e}}`:""))),Ge=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1,s=t.useSetValueCallback(Ce,(()=>!0),[],e);return t.useValue(Ce,e)?null:J("img",{onClick:s,title:ge,"data-position":n})},Ke=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!t.useCell(fe,e,ye,a),i=t.useSetCellCallback(fe,e,ye,(e=>e[k].open),[],a);return J("details",{open:o,onToggle:i},J("summary",null,l,s?J("img",{onClick:s,className:n?"done":"edit"}):null),r)},Ue=e=>{const t=l(e);return N(t)||t==a&&q(e)?t:void 0},Xe=(e,t,l,n,s)=>M(s)?e.delCell(t,l,n,!0):e.setCell(t,l,n,s),Ye=(e,t,l)=>M(l)?e.delValue(t):e.setValue(t,l),Ze=(e,t,l,n)=>e==s?t:e==a?l:n;var _e=Object.defineProperty,et=Object.defineProperties,tt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,nt=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,rt=(e,t,l)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,at=(e,t)=>{for(var l in t||(t={}))nt.call(t,l)&&rt(e,l,t[l]);if(lt)for(var l of lt(t))st.call(t,l)&&rt(e,l,t[l]);return e},ot=(e,t)=>et(e,tt(t)),it=(e,t)=>{var l={};for(var n in e)nt.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&lt)for(var n of lt(e))t.indexOf(n)<0&&st.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:ut,useMemo:dt,useState:ct}=e,ht="editable",mt=(e,l)=>U(t.useTableCellIds(e,l),(t=>e+"."+t)),pt=(e,t,l)=>{const n=ut(e,t);return l?n:void 0},bt=(...e)=>dt((()=>e),e),gt=(e,t)=>dt((()=>({store:e,tableId:t})),[e,t]),vt=(e,t)=>dt((()=>({queries:e,queryId:t})),[e,t]),ft=(e,t=!1,l,n=0,s,r,a,o)=>{const[[i,u,d],c]=ct([e,t,n]),h=ut((e=>{c(e),null==o||o(e)}),[o]),m=pt((e=>h([e,e==i&&!u,d])),[h,i,u,d],l),p=ut((e=>h([i,u,e])),[h,i,u]),b=!0===a?Mt:a;return[[i,u,d],m,dt((()=>!1===a?null:J(b,{offset:d,limit:s,total:r,onChange:p})),[a,b,d,s,r,p])]},It=(e,t,n)=>dt((()=>{const r=null!=t?t:e;return a=E(r)?ae(U(r,(e=>[e,e]))):r,o=(e,t)=>at(at({},{label:t,component:n}),l(e)==s?{label:e}:e),ae(ue(a,((e,t)=>[t,o(e,t)])));var a,o}),[t,n,e]),yt=({className:e,headerRow:t,idColumn:l,params:[n,s,r,a,o,i]})=>J("table",{className:e},i?J("caption",null,i):null,!1===t?null:J("thead",null,J("tr",null,!1===l?null:J(wt,{sort:null!=a?a:[],label:"Id",onClick:o}),ue(n,(({label:e},t)=>J(wt,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:o}))))),J("tbody",null,U(r,(e=>J("tr",{key:e},!1===l?null:J("th",null,e),ue(n,(({component:t,getComponentProps:l},n)=>J("td",{key:n},J(t,ot(at(at({},W(l,e,n)),s),{rowId:e,cellId:n})))))))))),wt=({cellId:e,sort:[t,l],label:s=(null!=e?e:n),onClick:r})=>J("th",{onClick:pt((()=>null==r?void 0:r(e)),[r,e],r),className:M(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},M(l)||t!=e?null:(l?"↓":"↑")+" ",s),Ct=({localRowId:l,params:[n,s,r,a,o,i,u]})=>{const d=t.useRemoteRowId(o,l,i);return J("tr",null,!1===n?null:J(e.Fragment,null,J("th",null,l),J("th",null,d)),ue(s,(({component:e,getComponentProps:t},n)=>{const[s,o]=n.split(".",2),i=s===r?l:s===a?d:null;return M(i)?null:J("td",{key:n},J(e,ot(at({},W(t,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},kt=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:o=!0})=>{const[i,u]=ct(),[d,c]=ct(),[h,m]=ct(),[p,b]=ct(),[g,v]=ct();d!==e&&(u(Ue(e)),c(e),m(e+""),b(Number(e)||0),v(!!e));const f=ut(((e,l)=>{l(e),c(e),t(e)}),[t]),I=ut((()=>{if(!(null==n?void 0:n())){const e=Ze(i,a,r,s),l=Ze(e,h,p,g);u(e),c(l),t(l)}}),[n,t,h,p,g,i]);return J("div",{className:l},o?J("button",{className:i,onClick:I},i):null,Ze(i,J("input",{key:i,value:h,onChange:ut((e=>f(e[k][x]+"",m)),[f])}),J("input",{key:i,type:"number",value:p,onChange:ut((e=>f(Number(e[k][x]||0),b)),[f])}),J("input",{key:i,type:"checkbox",checked:g,onChange:ut((e=>f(!!e[k].checked,v)),[f])})))},xt=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,p=it(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,g,v]=ft(s,r,d,a,o,t.useRowCount(n,i),c,h);return J(yt,ot(at({},p),{params:bt(It(t.useTableCellIds(n,i),m,u?Rt:t.CellView),gt(i,n),t.useSortedRowIds(n,...b,o,i),b,g,v)}))},St=({store:e,editable:l=!1,valueComponent:n=(l?qt:t.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>J("table",{className:r},!1===a?null:J("thead",null,J("tr",null,!1===o?null:J("th",null,"Id"),J("th",null,y))),J("tbody",null,U(t.useValueIds(e),(t=>J("tr",{key:t},!1===o?null:J("th",null,t),J("td",null,J(n,ot(at({},W(s,t)),{valueId:t,store:e})))))))),Tt=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=l,i=it(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(t.useIndexesOrIndexesById(r),n);return J(yt,ot(at({},i),{params:bt(It(t.useTableCellIds(c,d),o,a?Rt:t.CellView),gt(d,c),t.useSliceRowIds(n,s,u))}))},Vt=({relationshipId:l,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(t.useRelationshipsOrRelationshipsById(n),l),m=It([...mt(c,d),...mt(h,d)],r,s?Rt:t.CellView),p=bt(i,m,c,h,l,u,d);return J("table",{className:a},!1===o?null:J("thead",null,J("tr",null,!1===i?null:J(e.Fragment,null,J("th",null,c,".Id"),J("th",null,h,".Id")),ue(m,(({label:e},t)=>J("th",{key:t},e))))),J("tbody",null,U(t.useRowIds(c,d),(e=>J(Ct,{key:e,localRowId:e,params:p})))))},Ot=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=it(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,b,g]=ft(s,r,u,a,o,t.useResultRowCount(n,i),d,h);return J(yt,ot(at({},m),{params:bt(It(t.useResultTableCellIds(n,i),c,t.ResultCellView),vt(i,n),t.useResultSortedRowIds(n,...p,o,i),p,b,g)}))},Rt=({tableId:e,rowId:l,cellId:n,store:s,className:r,showType:a})=>{var o;return J(kt,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:ht+f,showType:a,hasSchema:null==(o=t.useStoreOrStoreById(s))?void 0:o.hasTablesSchema})},qt=({valueId:e,store:l,className:n,showType:s})=>{var r;return J(kt,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:ht+y,showType:s,hasSchema:null==(r=t.useStoreOrStoreById(l))?void 0:r.hasValuesSchema})},Mt=({onChange:t,total:l,offset:n=0,limit:s=l,singular:r="row",plural:a=r+"s"})=>{(n>l||n<0)&&(n=0,t(0));const o=pt((()=>t(n-s)),[t,n,s],n>0),i=pt((()=>t(n+s)),[t,n,s],n+s<l);return J(e.Fragment,null,l>s&&J(e.Fragment,null,J("button",{className:"previous",disabled:0==n,onClick:o},"←"),J("button",{className:"next",disabled:n+s>=l,onClick:i},"→"),n+1," to ",O(l,n+s)," of "),l," ",1!=l?a:r)},Pt=({indexes:e,indexesId:l,indexId:n,s:s})=>J(Ke,{uniqueId:xe("i",l,n),summary:"Index: "+n,s:s},U(t.useSliceIds(n,e),(t=>J(Nt,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s,key:t})))),Nt=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:s})=>{const r=xe("i",t,l,n),[a,o]=Te(r,s);return J(Ke,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},J(Tt,{sliceId:n,indexId:l,indexes:e,editable:a}))},Lt=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return M(n)?null:J(Ke,{uniqueId:xe("i",e),summary:"Indexes: "+(null!=e?e:u),s:l},X(s)?"No indexes defined":Se(s,(t=>J(Pt,{indexes:n,indexesId:e,indexId:t,s:l,key:t}))))},Et=({metrics:e,metricId:l})=>J("tr",null,J("th",null,l),J("td",null,null==e?void 0:e.getTableId(l)),J("td",null,t.useMetric(l,e))),jt=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return M(n)?null:J(Ke,{uniqueId:xe("m",e),summary:"Metrics: "+(null!=e?e:u),s:l},X(s)?"No metrics defined":J("table",null,J("thead",null,J("th",null,"Metric Id"),J("th",null,"Table Id"),J("th",null,"Metric")),J("tbody",null,U(s,(e=>J(Et,{metrics:n,metricId:e,key:e}))))))},zt=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const a=xe("q",l,n),[o,i,u]=me(null!=(r=t.useCell(fe,a,Ie,s))?r:"[]"),d=t.useSetCellCallback(fe,a,Ie,pe,[],s);return J(Ke,{uniqueId:a,summary:"Query: "+n,s:s},J(Ot,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},$t=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return M(n)?null:J(Ke,{uniqueId:xe("q",e),summary:"Queries: "+(null!=e?e:u),s:l},X(s)?"No queries defined":Se(s,(t=>J(zt,{queries:n,queriesId:e,queryId:t,s:l,key:t}))))},At=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const s=xe("r",t,l),[r,a]=Te(s,n);return J(Ke,{uniqueId:s,summary:"Relationship: "+l,editable:r,handleEditable:a,s:n},J(Vt,{relationshipId:l,relationships:e,editable:r}))},Ft=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return M(n)?null:J(Ke,{uniqueId:xe("r",e),summary:"Relationships: "+(null!=e?e:u),s:l},X(s)?"No relationships defined":Se(s,(t=>J(At,{relationships:n,relationshipsId:e,relationshipId:t,s:l,key:t}))))},Jt=({tableId:e,store:l,storeId:n,s:s})=>{var r;const a=xe("t",n,e),[o,i,u]=me(null!=(r=t.useCell(fe,a,Ie,s))?r:"[]"),d=t.useSetCellCallback(fe,a,Ie,pe,[],s),[c,m]=Te(a,s);return J(Ke,{uniqueId:a,summary:h+": "+e,editable:c,handleEditable:m,s:s},J(xt,{tableId:e,store:l,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Dt=({store:e,storeId:l,s:n})=>{const s=xe("v",l),[r,a]=Te(s,n);return X(t.useValueIds(e))?null:J(Ke,{uniqueId:s,summary:w,editable:r,handleEditable:a,s:n},J(St,{store:e,editable:r}))},Bt=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return M(n)?null:J(Ke,{uniqueId:xe("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(null!=e?e:u),s:l},J(Dt,{storeId:e,store:n,s:l}),Se(s,(t=>J(Jt,{store:n,storeId:e,tableId:t,s:l,key:t}))))},Qt=({s:e})=>{const l=Q(null),n=Q(0),[s,r]=H(!1),{scrollLeft:a,scrollTop:o}=t.useValues(e);B((()=>{const e=l.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=R(a)+e.clientWidth&&e.scrollHeight>=R(o)+e.clientHeight&&e.scrollTo(a,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,o]);const i=D((t=>{const{scrollLeft:l,scrollTop:s}=t[k];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:l,scrollTop:s})}))}),[e]),u=t.useStore(),d=t.useStoreIds(),c=t.useMetrics(),h=t.useMetricsIds(),m=t.useIndexes(),p=t.useIndexesIds(),b=t.useRelationships(),g=t.useRelationshipsIds(),v=t.useQueries(),f=t.useQueriesIds();return M(u)&&X(d)&&M(c)&&X(h)&&M(m)&&X(p)&&M(b)&&X(g)&&M(v)&&X(f)?J("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):J("article",{ref:l,onScroll:i},J(Bt,{s:e}),U(d,(t=>J(Bt,{storeId:t,s:e,key:t}))),J(jt,{s:e}),U(h,(t=>J(jt,{metricsId:t,s:e,key:t}))),J(Lt,{s:e}),U(p,(t=>J(Lt,{indexesId:t,s:e,key:t}))),J(Ft,{s:e}),U(g,(t=>J(Ft,{relationshipsId:t,s:e,key:t}))),J($t,{s:e}),U(f,(t=>J($t,{queriesId:t,s:e,key:t}))))};var Ht=Object.defineProperty;class Wt extends A{constructor(e){var t,l,n;super(e),n=(e,t)=>console.error(e,t.componentStack),(l="componentDidCatch")in(t=this)?Ht(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?J("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const Gt=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1,s=t.useSetValueCallback(Ce,(()=>!1),[],e),r=t.useSetValueCallback(we,(e=>Number(e[k].dataset.id)),[],e);return J("header",null,J("img",{title:ge}),J("span",null,ge),U(ve,((e,t)=>t==n?null:J("img",{onClick:r,"data-id":t,title:"Dock to "+e,key:t}))),J("img",{onClick:s,title:"Close"}))},Kt=({s:e})=>{var l;const n=null!=(l=t.useValue(we,e))?l:1;return t.useValue(Ce,e)?J("main",{"data-position":n},J(Gt,{s:e}),J(Wt,null,J(Qt,{s:e}))):null},Ut=e=>t=>{return l=(t,l)=>t+e(l),ll(t).reduce(l,0);var l},Xt=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Yt=Ut(Xt),Zt=Ut(Yt),_t=Ut(Zt),el=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},tl=e=>M(e)||0==Xt(e),ll=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},nl=e=>e.clear(),sl=(e,t)=>null==e?void 0:e.forEach(t),rl=(e,t)=>null==e?void 0:e.delete(t),al=e=>new Map(e),ol=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},il=(e,t)=>null==e?void 0:e.get(t),ul=(e,t)=>sl(e,((e,l)=>t(l,e))),dl=(e,t,l)=>M(l)?(rl(e,t),e):null==e?void 0:e.set(t,l),cl=(e,t,l,n)=>(el(e,t)?null==n||n(il(e,t)):dl(e,t,l()),il(e,t)),hl=(e,t,l,n=dl)=>(ue(t,((t,n)=>l(e,n,t))),ul(e,(l=>oe(t,l)?0:n(e,l))),e),ml=(e,t,l,n)=>{const s={};return sl(e,((e,r)=>{if(!(null==l?void 0:l(e,r))){const l=t?t(e,r):e;(null==n?void 0:n(l))||(s[r]=l)}})),s},pl=(e,t,l)=>ml(e,(e=>ml(e,t,l)),tl,de),bl=(e,t,l)=>ml(e,(e=>pl(e,t,l)),tl,de),gl=(e,t)=>{const l=al();return sl(e,((e,n)=>{var s;return l.set(n,null!=(s=null==t?void 0:t(e))?s:e)})),l},vl=e=>gl(e,gl),fl=e=>gl(e,vl),Il=(e,t,l,n,s=0)=>P((l?cl:il)(e,t[s],s>z(t)-2?l:al),(r=>{if(s>z(t)-2)return(null==n?void 0:n(r))&&dl(e,t[s]),r;const a=Il(r,t,l,n,s+1);return tl(r)&&dl(e,t[s]),a}));var yl=Object.defineProperty,wl=Object.getOwnPropertySymbols,Cl=Object.prototype.hasOwnProperty,kl=Object.prototype.propertyIsEnumerable,xl=(e,t,l)=>t in e?yl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Sl=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Tl=al(),Vl=al();var Ol=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Rl="storage",ql=e=>new Set(E(e)||M(e)?e:[e]),Ml=(e,t)=>null==e?void 0:e.add(t),Pl=/^\d+$/,Nl=()=>{const e=[];let t=0;return[l=>{var s;return null!=(s=l?Z(e):null)?s:n+t++},t=>{Pl.test(t)&&z(e)<1e3&&Y(e,t)}]},Ll=e=>[e,e],El=(e,t=Yt)=>t(e[0])+t(e[1]),jl=()=>[al(),al()],zl=e=>[...e],$l=([e,t])=>e===t;al(U("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(n),((e,t)=>[e,t])));const Al=(e,t,l)=>dl(e,t,il(e,t)==-l?void 0:l),Fl=()=>{let e,t,l=!1,s=!1,r=0,o=[];const c=al(),k=al(),x=al(),T=al(),V=al(),O=al(),R=al(),q=al(),$=al(),A=al(),F=al(),J=al(),D=al(),B=al(),Q=ql(),H=al(),W=al(),X=al(),Z=al(),_=jl(),ee=jl(),te=jl(),le=jl(),ne=jl(),se=jl(),ae=jl(),he=jl(),be=jl(),ge=jl(),ve=jl(),fe=jl(),Ie=jl(),ye=jl(),we=jl(),Ce=jl(),ke=jl(),xe=jl(),Se=jl(),Te=jl(),Ve=jl(),Oe=jl(),Re=al(),qe=jl(),[Me,Pe,Ne,Le]=(()=>{let e;const[t,l]=Nl(),s=al();return[(l,r,a,o=[],i=()=>[])=>{null!=e||(e=Vl);const u=t(1);return dl(s,u,[l,r,a,o,i]),Ml(Il(r,null!=a?a:[n],ql),u),u},(t,l,...r)=>K(((e,t=[n])=>{const l=[],s=(e,n)=>n==z(t)?Y(l,e):null===t[n]?sl(e,(e=>s(e,n+1))):K([t[n],null],(t=>s(il(e,t),n+1)));return s(e,0),l})(t,l),(t=>sl(t,(t=>il(s,t)[0](e,...null!=l?l:[],...r))))),e=>P(il(s,e),(([,t,r])=>(Il(t,null!=r?r:[n],void 0,(t=>(rl(t,e),tl(t)?1:0))),dl(s,e),l(e),r))),t=>P(il(s,t),(([t,,l=[],n,s])=>{const r=(...a)=>{var o,i;const u=z(a);u==z(l)?t(e,...a,...s(a)):M(l[u])?K(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,l[u])};r()}))]})(),Ee=e=>{if(!ce(e,((e,t)=>[i,u].includes(t))))return!1;const t=e[i];return!(!N(t)&&t!=a||(Ue(e[u])!=t&&ie(e,u),0))},je=E,ze=(t,l)=>(!e||el(F,l)||gt(l))&&ce(t,((e,t)=>$e(l,t,e)),(()=>gt(l))),$e=(e,t,l,n)=>ce(n?l:De(l,e,t),((n,s)=>P(Ae(e,t,s,n),(e=>(l[s]=e,!0)),(()=>!1))),(()=>gt(e,t))),Ae=(t,l,n,s)=>e?P(il(il(F,t),n),(e=>Ue(s)!=e[i]?gt(t,l,n,s,e[u]):s),(()=>gt(t,l,n,s))):M(Ue(s))?gt(t,l,n,s):s,Fe=(e,t)=>ce(t?e:Be(e),((t,l)=>P(Je(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>vt())),Je=(e,l)=>t?P(il(D,e),(t=>Ue(l)!=t[i]?vt(e,l,t[u]):l),(()=>vt(e,l))):M(Ue(l))?vt(e,l):l,De=(e,t,l)=>(P(il(J,t),(([n,s])=>{sl(n,((t,l)=>{oe(e,l)||(e[l]=t)})),sl(s,(n=>{oe(e,n)||gt(t,l,n)}))})),e),Be=e=>(t&&(sl(B,((t,l)=>{oe(e,l)||(e[l]=t)})),sl(Q,(t=>{oe(e,t)||vt(t)}))),e),Qe=e=>hl(F,e,((e,t,l)=>{const n=al(),s=ql();hl(cl(F,t,al),l,((e,t,l)=>{dl(e,t,l),P(l[u],(e=>dl(n,t,e)),(()=>Ml(s,t)))})),dl(J,t,[n,s])}),((e,t)=>{dl(F,t),dl(J,t)})),He=e=>hl(D,e,((e,t,l)=>{dl(D,t,l),P(l[u],(e=>dl(B,t,e)),(()=>Ml(Q,t)))}),((e,t)=>{dl(D,t),dl(B,t),rl(Q,t)})),We=e=>de(e)?Ut():Qt(e),Ge=e=>hl(X,e,((e,t,l)=>Ke(t,l)),((e,t)=>at(t))),Ke=(e,t)=>hl(cl(X,e,(()=>(dt(e,1),dl(H,e,Nl()),dl(W,e,al()),al()))),t,((t,l,n)=>Ze(e,t,l,n)),((t,l)=>ot(e,t,l))),Ze=(e,t,l,n,s)=>hl(cl(t,l,(()=>(ct(e,l,1),al()))),n,((t,n,s)=>_e(e,l,t,n,s)),((n,r)=>it(e,t,l,n,r,s))),_e=(e,t,l,n,s)=>{el(l,n)||ht(e,t,n,1);const r=il(l,n);s!==r&&(mt(e,t,n,r,s),dl(l,n,s))},et=(e,t,l,n,s)=>P(il(t,l),(t=>_e(e,l,t,n,s)),(()=>Ze(e,t,l,De({[n]:s},e,l)))),tt=e=>de(e)?wl():Ht(e),lt=e=>hl(Z,e,((e,t,l)=>nt(t,l)),((e,t)=>ut(t))),nt=(e,t)=>{el(Z,e)||pt(e,1);const l=il(Z,e);t!==l&&(bt(e,l,t),dl(Z,e,t))},st=(e,t)=>{const[l]=il(H,e),n=l(t);return el(il(X,e),n)?st(e,t):n},rt=e=>{var t;return null!=(t=il(X,e))?t:Ke(e,{})},at=e=>Ke(e,{}),ot=(e,t,l)=>{const[,n]=il(H,e);n(l),Ze(e,t,l,{},!0)},it=(e,t,l,n,s,r)=>{var a;const o=il(null==(a=il(J,e))?void 0:a[0],s);if(!M(o)&&!r)return _e(e,l,n,s,o);const i=t=>{mt(e,l,t,il(n,t)),ht(e,l,t,-1),dl(n,t)};M(o)?i(s):ul(n,i),tl(n)&&(ct(e,l,-1),tl(dl(t,l))&&(dt(e,-1),dl(X,e),dl(H,e),dl(W,e)))},ut=e=>{const t=il(B,e);if(!M(t))return nt(e,t);bt(e,il(Z,e)),pt(e,-1),dl(Z,e)},dt=(e,t)=>Al(c,e,t),ct=(e,t,l)=>Al(cl(T,e,al),t,l)&&dl(x,e,cl(x,e,(()=>0))+l),ht=(e,t,l,n)=>{var s;const r=il(W,e),a=null!=(s=il(r,l))?s:0;(0==a&&1==n||1==a&&-1==n)&&Al(cl(k,e,al),l,n),dl(r,l,a!=-n?a+n:null),Al(cl(cl(V,e,al),t,al),l,n)},mt=(e,t,l,n,s)=>{var r;cl(cl(cl(O,e,al),t,al),l,(()=>[n,0]))[1]=s,null==(r=o[3])||r.call(o,e,t,l,s)},pt=(e,t)=>Al(R,e,t),bt=(e,t,l)=>{var n;cl(q,e,(()=>[t,0]))[1]=l,null==(n=o[4])||n.call(o,e,l)},gt=(e,t,l,n,s)=>(Y(cl(cl(cl($,e,al),t,al),l,(()=>[])),n),s),vt=(e,t,l)=>(Y(cl(A,e,(()=>[])),t),l),ft=(e,t,l)=>P(il(il(il(O,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...Ll(Nt(e,t,l))])),It=e=>P(il(q,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Ll(jt(e))])),yt=e=>tl($)||tl(Ce[e])?0:sl(e?fl($):$,((t,l)=>sl(t,((t,n)=>sl(t,((t,s)=>Pe(Ce[e],[l,n,s],t))))))),wt=e=>tl(A)||tl(ke[e])?0:sl(e?gl(A):A,((t,l)=>Pe(ke[e],[l],t))),Ct=(e,t,l,n)=>{if(!tl(e))return Pe(t,n,(()=>ml(e))),ul(e,((e,t)=>Pe(l,[...null!=n?n:[],e],1==t))),1},kt=e=>{const t=zt();t!=l&&Pe(_[e],void 0,t);const n=tl(ge[e]),s=tl(Ie[e])&&tl(ye[e])&&tl(be[e])&&tl(ve[e])&&tl(se[e])&&tl(ae[e])&&tl(he[e])&&n&&tl(te[e])&&tl(le[e]),r=tl(we[e])&&tl(fe[e])&&tl(ne[e])&&tl(ee[e]);if(!s||!r){const t=e?[gl(c),vl(k),gl(x),vl(T),fl(V),fl(O)]:[c,k,x,T,V,O];if(!s){Ct(t[0],te[e],le[e]),sl(t[1],((t,l)=>Ct(t,se[e],ae[e],[l]))),sl(t[2],((t,l)=>{0!=t&&Pe(he[e],[l],Rt(l))}));const l=ql();sl(t[3],((t,s)=>{Ct(t,be[e],ve[e],[s])&&!n&&(Pe(ge[e],[s,null]),Ml(l,s))})),n||sl(t[5],((t,n)=>{if(!el(l,n)){const l=ql();sl(t,(e=>sl(e,(([t,n],s)=>n!==t?Ml(l,s):rl(e,s))))),sl(l,(t=>Pe(ge[e],[n,t])))}})),sl(t[4],((t,l)=>sl(t,((t,n)=>Ct(t,Ie[e],ye[e],[l,n])))))}if(!r){let l;sl(t[5],((t,n)=>{let s;sl(t,((t,r)=>{let a;sl(t,(([t,o],i)=>{o!==t&&(Pe(we[e],[n,r,i],o,t,ft),l=s=a=1)})),a&&Pe(fe[e],[n,r],ft)})),s&&Pe(ne[e],[n],ft)})),l&&Pe(ee[e],void 0,ft)}}},xt=e=>{const t=Dt();t!=s&&Pe(xe[e],void 0,t);const l=tl(Te[e])&&tl(Ve[e]),n=tl(Oe[e])&&tl(Se[e]);if(!l||!n){const t=e?[gl(R),gl(q)]:[R,q];if(l||Ct(t[0],Te[e],Ve[e]),!n){let l;sl(t[1],(([t,n],s)=>{n!==t&&(Pe(Oe[e],[s],n,t,It),l=1)})),l&&Pe(Se[e],void 0,It)}}},St=(e,...t)=>(xl((()=>e(...U(t,S)))),Vl),Tt=()=>bl(X),Vt=()=>ol(X),Ot=e=>ol(il(W,S(e))),Rt=e=>Xt(il(X,S(e))),qt=e=>ol(il(X,S(e))),Mt=(e,t,l,n=0,s)=>{return U(j(G((r=il(X,S(e)),a=(e,l)=>[M(t)?l:il(e,S(t)),l],U([...null!=(o=null==r?void 0:r.entries())?o:[]],(([e,t])=>a(t,e)))),(([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(s=t)?s:0)?-1:1)*(l?-1:1);var n,s})),n,M(s)?s:n+s),(([,e])=>e));var r,a,o},Pt=(e,t)=>ol(il(il(X,S(e)),S(t))),Nt=(e,t,l)=>il(il(il(X,S(e)),S(t)),S(l)),Lt=()=>ml(Z),Et=()=>ol(Z),jt=e=>il(Z,S(e)),zt=()=>!tl(X),$t=e=>el(X,S(e)),At=(e,t)=>el(il(W,S(e)),S(t)),Ft=(e,t)=>el(il(X,S(e)),S(t)),Jt=(e,t,l)=>el(il(il(X,S(e)),S(t)),S(l)),Dt=()=>!tl(Z),Bt=e=>el(Z,S(e)),Qt=e=>St((()=>(e=>ce(e,ze,gt))(e)?Ge(e):0)),Ht=e=>St((()=>Fe(e)?lt(e):0)),Wt=e=>{try{We(me(e))}catch(e){}return Vl},Gt=t=>St((()=>{if((e=ce(t,(e=>ce(e,Ee))))&&(Qe(t),!tl(X))){const e=Tt();Ut(),Qt(e)}})),Kt=e=>St((()=>{if(t=(e=>ce(e,Ee))(e)){const l=Lt();kl(),wl(),t=!0,He(e),Ht(l)}})),Ut=()=>St((()=>Ge({}))),ll=e=>St((e=>el(X,e)?at(e):0),e),yl=(e,t)=>St(((e,t)=>P(il(X,e),(l=>el(l,t)?ot(e,l,t):0))),e,t),wl=()=>St((()=>lt({}))),Cl=()=>St((()=>{Qe({}),e=!1})),kl=()=>St((()=>{He({}),t=!1})),xl=(e,t)=>{if(-1!=r){Sl();const l=e();return Tl(t),l}},Sl=()=>{var e;return-1!=r&&r++,1==r&&(null==(e=o[0])||e.call(o),Pe(Re)),Vl},Tl=e=>{var t,n;return r>0&&(r--,0==r&&(r=1,yt(1),tl(O)||kt(1),wt(1),tl(q)||xt(1),(null==e?void 0:e(Vl))&&(sl(O,((e,t)=>sl(e,((e,l)=>sl(e,(([e],n)=>Xe(Vl,t,l,n,e))))))),nl(O),sl(q,(([e],t)=>Ye(Vl,t,e))),nl(q)),Pe(qe[0],void 0),r=-1,yt(0),tl(O)||kt(0),wt(0),tl(q)||xt(0),null==(t=o[1])||t.call(o),Pe(qe[1],void 0),null==(n=o[2])||n.call(o),r=0,l=zt(),s=Dt(),K([c,k,x,T,V,O,$,R,q,A],nl))),Vl},Vl={getContent:()=>[Tt(),Lt()],getTables:Tt,getTableIds:Vt,getTable:e=>pl(il(X,S(e))),getTableCellIds:Ot,getRowCount:Rt,getRowIds:qt,getSortedRowIds:Mt,getRow:(e,t)=>ml(il(il(X,S(e)),S(t))),getCellIds:Pt,getCell:Nt,getValues:Lt,getValueIds:Et,getValue:jt,hasTables:zt,hasTable:$t,hasTableCell:At,hasRow:Ft,hasCell:Jt,hasValues:Dt,hasValue:Bt,getTablesJson:()=>pe(X),getValuesJson:()=>pe(Z),getJson:()=>pe([X,Z]),getTablesSchemaJson:()=>pe(F),getValuesSchemaJson:()=>pe(D),getSchemaJson:()=>pe([F,D]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>St((()=>je(e)?(([e,t])=>{(de(e)?Ut:Qt)(e),(de(t)?wl:Ht)(t)})(e):0)),setTables:Qt,setTable:(e,t)=>St((e=>ze(t,e)?Ke(e,t):0),e),setRow:(e,t,l)=>St(((e,t)=>$e(e,t,l)?Ze(e,rt(e),t,l):0),e,t),addRow:(e,t,l=!0)=>xl((()=>{let n;return $e(e,n,t)&&(e=S(e),Ze(e,rt(e),n=st(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>St(((e,t)=>{if($e(e,t,l,1)){const n=rt(e);ue(l,((l,s)=>et(e,n,t,s,l)))}}),e,t),setCell:(e,t,l,n)=>St(((e,t,l)=>P(Ae(e,t,l,L(n)?n(Nt(e,t,l)):n),(n=>et(e,rt(e),t,l,n)))),e,t,l),setValues:Ht,setPartialValues:e=>St((()=>Fe(e,1)?ue(e,((e,t)=>nt(t,e))):0)),setValue:(e,t)=>St((e=>P(Je(e,L(t)?t(jt(e)):t),(t=>nt(e,t)))),e),applyChanges:e=>St((()=>{ue(e[0],((e,t)=>M(e)?ll(t):ue(e,((e,l)=>M(e)?yl(t,l):ue(e,((e,n)=>Xe(Vl,t,l,n,e))))))),ue(e[1],((e,t)=>Ye(Vl,t,e)))})),setTablesJson:Wt,setValuesJson:e=>{try{tt(me(e))}catch(e){}return Vl},setJson:e=>St((()=>{try{const[t,l]=me(e);We(t),tt(l)}catch(t){Wt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>St((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:ll,delRow:yl,delCell:(e,t,l,n)=>St(((e,t,l)=>P(il(X,e),(s=>P(il(s,t),(r=>el(r,l)?it(e,s,t,r,l,n):0))))),e,t,l),delValues:wl,delValue:e=>St((e=>el(Z,e)?ut(e):0),e),delTablesSchema:Cl,delValuesSchema:kl,delSchema:()=>St((()=>{Cl(),kl()})),transaction:xl,startTransaction:Sl,getTransactionChanges:()=>[ml(O,((e,t)=>-1===il(c,t)?void 0:ml(e,((e,l)=>-1===il(il(T,t),l)?void 0:ml(e,(([,e])=>e),(e=>$l(e)))),tl,de)),tl,de),ml(q,(([,e])=>e),(e=>$l(e))),1],getTransactionLog:()=>[!tl(O),!tl(q),bl(O,zl,$l),bl($),ml(q,zl,$l),ml(A),ml(c),pl(T),bl(V),ml(R)],finishTransaction:Tl,forEachTable:e=>sl(X,((t,l)=>e(l,(e=>sl(t,((t,l)=>e(l,(e=>ul(t,e))))))))),forEachTableCell:(e,t)=>ul(il(W,S(e)),t),forEachRow:(e,t)=>sl(il(X,S(e)),((e,l)=>t(l,(t=>ul(e,t))))),forEachCell:(e,t,l)=>ul(il(il(X,S(e)),S(t)),l),forEachValue:e=>ul(Z,e),addSortedRowIdsListener:(e,t,l,n,s,r,a)=>{let o=Mt(e,t,l,n,s);return Me((()=>{const a=Mt(e,t,l,n,s);var i,u,d;u=o,z(i=a)===z(u)&&(d=(e,t)=>u[t]===e,i.every(d))||(o=a,r(Vl,e,t,l,n,s,o))}),ge[a?1:0],[e,t],[Vt])},addStartTransactionListener:e=>Me(e,Re),addWillFinishTransactionListener:e=>Me(e,qe[0]),addDidFinishTransactionListener:e=>Me(e,qe[1]),callListener:e=>(Le(e),Vl),delListener:e=>(Ne(e),Vl),getListenerStats:()=>({hasTables:El(_),tables:El(ee),tableIds:El(te),hasTable:El(le),table:El(ne),tableCellIds:El(se),hasTableCell:El(ae,Zt),rowCount:El(he),rowIds:El(be),sortedRowIds:El(ge),hasRow:El(ve,Zt),row:El(fe,Zt),cellIds:El(Ie,Zt),hasCell:El(ye,_t),cell:El(we,_t),invalidCell:El(Ce,_t),hasValues:El(xe),values:El(Se),valueIds:El(Te),hasValue:El(Ve),value:El(Oe),invalidValue:El(ke),transaction:Yt(Re)+El(qe)}),isMergeable:()=>!1,createStore:Fl,addListener:Me,callListeners:Pe,setInternalListeners:(e,t,l,n,s)=>o=[e,t,l,n,s]};return ue({[d+m]:[0,_,[],()=>[zt()]],[m]:[0,ee],[p]:[0,te],[d+h]:[1,le,[Vt],e=>[$t(...e)]],[h]:[1,ne,[Vt]],[h+I]:[1,se,[Vt]],[d+h+f]:[2,ae,[Vt,Ot],e=>[At(...e)]],[g]:[1,he,[Vt]],[v]:[1,be,[Vt]],[d+b]:[2,ve,[Vt,qt],e=>[Ft(...e)]],[b]:[2,fe,[Vt,qt]],[I]:[2,Ie,[Vt,qt]],[d+f]:[3,ye,[Vt,qt,Pt],e=>[Jt(...e)]],[f]:[3,we,[Vt,qt,Pt],e=>Ll(Nt(...e))],InvalidCell:[3,Ce],[d+w]:[0,xe,[],()=>[Dt()]],[w]:[0,Se],[C]:[0,Te],[d+y]:[1,Ve,[Et],e=>[Bt(...e)]],[y]:[1,Oe,[Et],e=>Ll(jt(e[0]))],InvalidValue:[1,ke]},(([e,t,l,n],s)=>{Vl["add"+s+"Listener"]=(...s)=>Me(s[e],t[s[e+1]?1:0],e>0?j(s,0,e):void 0,l,n)})),re(Vl)};exports.Inspector=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(Fl),s=ve.indexOf(e);return t.useCreatePersister(n,(e=>{return t=be,l=sessionStorage,((e,t,l,n,s,r,a,o={},i=[])=>{let u,d,c,h=0,m=0,p=0;cl(Tl,i,(()=>0)),cl(Vl,i,(()=>[]));const[b,g,v,f,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!de(e)||!de(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!de(e)||!de(t),t.setContent]:$("Store type not supported by this Persister"))(a,e),y=t=>{(b&&E(null==t?void 0:t[0])?1===(null==t?void 0:t[2])?e.applyMergeableChanges:e.setMergeableContent:1===(null==t?void 0:t[2])?e.applyChanges:e.setContent)(t)},w=e=>Sl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield S((()=>Sl(void 0,null,(function*(){try{const e=yield t();E(e)?y(e):$("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))))),T})),C=()=>(d&&(s(d),d=void 0),T),k=e=>Sl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield S((()=>Sl(void 0,null,(function*(){try{yield l(g,e)}catch(e){}h=0}))))),T})),x=()=>(P(c,e.delListener),c=void 0,T),S=(...e)=>Sl(void 0,null,(function*(){return Y(il(Vl,i),...e),yield Sl(void 0,null,(function*(){if(!il(Tl,i)){for(dl(Tl,i,1);!M(u=Z(il(Vl,i)));)try{yield u()}catch(e){}dl(Tl,i,0)}})),T})),T=((e,t)=>{for(var l in t||(t={}))Cl.call(t,l)&&xl(e,l,t[l]);if(wl)for(var l of wl(t))kl.call(t,l)&&xl(e,l,t[l]);return e})({load:w,startAutoLoad:e=>Sl(void 0,null,(function*(){yield C().load(e);try{d=yield n(((e,t)=>Sl(void 0,null,(function*(){t||e?2!=h&&(h=1,m++,y(null!=t?t:e),h=0):yield w()}))))}catch(e){}return T})),stopAutoLoad:C,isAutoLoading:()=>!M(d),save:k,startAutoSave:()=>Sl(void 0,null,(function*(){return yield x().save(),c=e.addDidFinishTransactionListener((()=>{const e=v();f(e)&&k(e)})),T})),stopAutoSave:x,isAutoSaving:()=>!M(c),schedule:S,getStore:()=>e,destroy:()=>(il(Vl,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:p})},o);return re(T)})(e,(()=>Ol(void 0,null,(function*(){return e=l.getItem(t),me(e,((e,t)=>""===t?void 0:t));var e}))),(e=>Ol(void 0,null,(function*(){return l.setItem(t,(n=e(),he(n,((e,t)=>void 0===t?"":t))));var n}))),(e=>{const n=n=>{if(n.storageArea===l&&n.key===t)try{e(me(n.newValue))}catch(t){e()}};return T.addEventListener(Rl,n),n}),(e=>T.removeEventListener(Rl,e)),0,3,{getStorageName:()=>t});var t,l}),void 0,(e=>{return t=function*(){yield e.load([{},{position:-1==s?1:s,open:!!l}]),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),J(F,null,J("aside",{id:be},J(Ge,{s:n}),J(Kt,{s:n})),J("style",null,We))};
@@ -3,6 +3,7 @@
3
3
  var React = require('react');
4
4
 
5
5
  const getTypeOf = (thing) => typeof thing;
6
+ const TINYBASE = 'tinybase';
6
7
  const EMPTY_STRING = '';
7
8
  const STRING = getTypeOf(EMPTY_STRING);
8
9
  const FUNCTION = getTypeOf(getTypeOf);
@@ -26,6 +27,7 @@ const VALUE = 'Value';
26
27
  const VALUES = VALUE + 's';
27
28
  const VALUE_IDS = VALUE + IDS;
28
29
 
30
+ const GLOBAL = globalThis;
29
31
  const isUndefined = (thing) => thing == void 0;
30
32
  const ifNotUndefined = (value, then, otherwise) =>
31
33
  isUndefined(value) ? (otherwise == null ? void 0 : otherwise()) : then(value);
@@ -42,6 +44,7 @@ const arrayIsEqual = (array1, array2) =>
42
44
  const arrayMap = (array, cb) => array.map(cb);
43
45
  const arrayIsEmpty = (array) => size(array) == 0;
44
46
  const arrayFilter = (array, cb) => array.filter(cb);
47
+ const arrayWith = (array, index, value) => array.with(index, value);
45
48
 
46
49
  const object = Object;
47
50
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
@@ -59,6 +62,7 @@ const isObject = (obj) =>
59
62
  );
60
63
  const objIds = object.keys;
61
64
  const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
65
+ const objHas = (obj, id) => id in obj;
62
66
  const objDel = (obj, id) => {
63
67
  delete obj[id];
64
68
  return obj;
@@ -77,9 +81,15 @@ const objIsEqual = (obj1, obj2) => {
77
81
  )
78
82
  );
79
83
  };
84
+ const objEnsure = (obj, id, getDefaultValue) => {
85
+ if (!objHas(obj, id)) {
86
+ obj[id] = getDefaultValue();
87
+ }
88
+ return obj[id];
89
+ };
80
90
 
81
91
  const {createContext, useContext: useContext$1, useEffect: useEffect$1} = React;
82
- const Context = createContext([]);
92
+ const Context = objEnsure(GLOBAL, TINYBASE + '_uirc', () => createContext([]));
83
93
  const useThing = (id, offset) => {
84
94
  var _a;
85
95
  const contextValue = useContext$1(Context);
@@ -95,6 +105,16 @@ const useThingOrThingById = (thingOrThingId, offset) => {
95
105
  ? thing
96
106
  : thingOrThingId;
97
107
  };
108
+ const useProvideThing = (thingId, thing, offset) => {
109
+ const {12: addExtraThingById, 13: delExtraThingById} = useContext$1(Context);
110
+ useEffect$1(() => {
111
+ addExtraThingById == null
112
+ ? void 0
113
+ : addExtraThingById(offset, thingId, thing);
114
+ return () =>
115
+ delExtraThingById == null ? void 0 : delExtraThingById(offset, thingId);
116
+ }, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
117
+ };
98
118
  const useThingIds = (offset) => {
99
119
  var _a;
100
120
  return objIds((_a = useContext$1(Context)[offset]) != null ? _a : {});
@@ -102,28 +122,32 @@ const useThingIds = (offset) => {
102
122
  const useStore = (id) => useThing(id, 0);
103
123
  const useStoreOrStoreById = (storeOrStoreId) =>
104
124
  useThingOrThingById(storeOrStoreId, 0);
105
- const useProvideStore = (storeId, store) => {
106
- const {12: addExtraStore, 13: delExtraStore} = useContext$1(Context);
107
- useEffect$1(() => {
108
- addExtraStore == null ? void 0 : addExtraStore(storeId, store);
109
- return () => (delExtraStore == null ? void 0 : delExtraStore(storeId));
110
- }, [addExtraStore, storeId, store, delExtraStore]);
111
- };
125
+ const useProvideStore = (storeId, store) => useProvideThing(storeId, store, 0);
112
126
  const useMetrics = (id) => useThing(id, 2);
113
127
  const useMetricsOrMetricsById = (metricsOrMetricsId) =>
114
128
  useThingOrThingById(metricsOrMetricsId, 2);
129
+ const useProvideMetrics = (metricsId, metrics) =>
130
+ useProvideThing(metricsId, metrics, 1);
115
131
  const useIndexes = (id) => useThing(id, 4);
116
132
  const useIndexesOrIndexesById = (indexesOrIndexesId) =>
117
133
  useThingOrThingById(indexesOrIndexesId, 4);
134
+ const useProvideIndexes = (indexesId, indexes) =>
135
+ useProvideThing(indexesId, indexes, 2);
118
136
  const useRelationships = (id) => useThing(id, 6);
119
137
  const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
120
138
  useThingOrThingById(relationshipsOrRelationshipsId, 6);
139
+ const useProvideRelationships = (relationshipsId, relationships) =>
140
+ useProvideThing(relationshipsId, relationships, 3);
121
141
  const useQueries = (id) => useThing(id, 8);
122
142
  const useQueriesOrQueriesById = (queriesOrQueriesId) =>
123
143
  useThingOrThingById(queriesOrQueriesId, 8);
144
+ const useProvideQueries = (queriesId, queries) =>
145
+ useProvideThing(queriesId, queries, 4);
124
146
  const useCheckpoints = (id) => useThing(id, 10);
125
147
  const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
126
148
  useThingOrThingById(checkpointsOrCheckpointsId, 10);
149
+ const useProvideCheckpoints = (checkpointsId, checkpoints) =>
150
+ useProvideThing(checkpointsId, checkpoints, 5);
127
151
 
128
152
  const lower = (str) => str.toLowerCase();
129
153
  lower(LISTENER);
@@ -1692,20 +1716,39 @@ const Provider = ({
1692
1716
  children,
1693
1717
  }) => {
1694
1718
  const parentValue = useContext(Context);
1695
- const [extraStoresById, setExtraStoresById] = useState({});
1696
- const addExtraStore = useCallback(
1697
- (id, store2) =>
1698
- setExtraStoresById((extraStoresById2) =>
1699
- objGet(extraStoresById2, id) == store2
1700
- ? extraStoresById2
1701
- : __spreadProps(__spreadValues({}, extraStoresById2), {[id]: store2}),
1719
+ const [extraThingsById, setExtraThingsById] = useState([
1720
+ {},
1721
+ {},
1722
+ {},
1723
+ {},
1724
+ {},
1725
+ {},
1726
+ ]);
1727
+ const addExtraThingById = useCallback(
1728
+ (thingOffset, id, thing) =>
1729
+ setExtraThingsById((extraThingsById2) =>
1730
+ objGet(extraThingsById2[thingOffset], id) == thing
1731
+ ? extraThingsById2
1732
+ : arrayWith(
1733
+ extraThingsById2,
1734
+ thingOffset,
1735
+ __spreadProps(__spreadValues({}, extraThingsById2[thingOffset]), {
1736
+ [id]: thing,
1737
+ }),
1738
+ ),
1702
1739
  ),
1703
1740
  [],
1704
1741
  );
1705
- const delExtraStore = useCallback(
1706
- (id) =>
1707
- setExtraStoresById((extraStoresById2) =>
1708
- __spreadValues({}, objDel(extraStoresById2, id)),
1742
+ const delExtraThingById = useCallback(
1743
+ (thingOffset, id) =>
1744
+ setExtraThingsById((extraThingsById2) =>
1745
+ !objHas(extraThingsById2[thingOffset], id)
1746
+ ? extraThingsById2
1747
+ : arrayWith(
1748
+ extraThingsById2,
1749
+ thingOffset,
1750
+ objDel(extraThingsById2[thingOffset], id),
1751
+ ),
1709
1752
  ),
1710
1753
  [],
1711
1754
  );
@@ -1717,25 +1760,46 @@ const Provider = ({
1717
1760
  store != null ? store : parentValue[0],
1718
1761
  __spreadValues(
1719
1762
  __spreadValues(__spreadValues({}, parentValue[1]), storesById),
1720
- extraStoresById,
1763
+ extraThingsById[0],
1721
1764
  ),
1722
1765
  metrics != null ? metrics : parentValue[2],
1723
- __spreadValues(__spreadValues({}, parentValue[3]), metricsById),
1766
+ __spreadValues(
1767
+ __spreadValues(__spreadValues({}, parentValue[3]), metricsById),
1768
+ extraThingsById[1],
1769
+ ),
1724
1770
  indexes != null ? indexes : parentValue[4],
1725
- __spreadValues(__spreadValues({}, parentValue[5]), indexesById),
1771
+ __spreadValues(
1772
+ __spreadValues(__spreadValues({}, parentValue[5]), indexesById),
1773
+ extraThingsById[2],
1774
+ ),
1726
1775
  relationships != null ? relationships : parentValue[6],
1727
- __spreadValues(__spreadValues({}, parentValue[7]), relationshipsById),
1776
+ __spreadValues(
1777
+ __spreadValues(
1778
+ __spreadValues({}, parentValue[7]),
1779
+ relationshipsById,
1780
+ ),
1781
+ extraThingsById[3],
1782
+ ),
1728
1783
  queries != null ? queries : parentValue[8],
1729
- __spreadValues(__spreadValues({}, parentValue[9]), queriesById),
1784
+ __spreadValues(
1785
+ __spreadValues(__spreadValues({}, parentValue[9]), queriesById),
1786
+ extraThingsById[4],
1787
+ ),
1730
1788
  checkpoints != null ? checkpoints : parentValue[10],
1731
- __spreadValues(__spreadValues({}, parentValue[11]), checkpointsById),
1732
- addExtraStore,
1733
- delExtraStore,
1789
+ __spreadValues(
1790
+ __spreadValues(
1791
+ __spreadValues({}, parentValue[11]),
1792
+ checkpointsById,
1793
+ ),
1794
+ extraThingsById[5],
1795
+ ),
1796
+ addExtraThingById,
1797
+ delExtraThingById,
1734
1798
  ],
1735
1799
  [
1736
1800
  store,
1737
1801
  storesById,
1738
- extraStoresById,
1802
+ extraThingsById,
1739
1803
  metrics,
1740
1804
  metricsById,
1741
1805
  indexes,
@@ -1747,8 +1811,8 @@ const Provider = ({
1747
1811
  checkpoints,
1748
1812
  checkpointsById,
1749
1813
  parentValue,
1750
- addExtraStore,
1751
- delExtraStore,
1814
+ addExtraThingById,
1815
+ delExtraThingById,
1752
1816
  ],
1753
1817
  ),
1754
1818
  },
@@ -2162,6 +2226,11 @@ exports.useMetricListener = useMetricListener;
2162
2226
  exports.useMetrics = useMetrics;
2163
2227
  exports.useMetricsIds = useMetricsIds;
2164
2228
  exports.useMetricsOrMetricsById = useMetricsOrMetricsById;
2229
+ exports.useProvideCheckpoints = useProvideCheckpoints;
2230
+ exports.useProvideIndexes = useProvideIndexes;
2231
+ exports.useProvideMetrics = useProvideMetrics;
2232
+ exports.useProvideQueries = useProvideQueries;
2233
+ exports.useProvideRelationships = useProvideRelationships;
2165
2234
  exports.useProvideStore = useProvideStore;
2166
2235
  exports.useQueries = useQueries;
2167
2236
  exports.useQueriesIds = useQueriesIds;