tinybase 4.3.17 → 4.3.18

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.
@@ -195,89 +195,85 @@ const EDIT_SVG = PRE + `<path d='${PENCIL}' />` + POST;
195
195
  const DONE_SVG = PRE + `<path d='${PENCIL}M20 20l60 60' />` + POST;
196
196
 
197
197
  const SCROLLBAR = '*::-webkit-scrollbar';
198
- const APP_STYLESHEET = `#${UNIQUE_ID}{
199
- all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;
200
- ${arrayJoin(
201
- objMap(
202
- {
203
- '*': 'all:revert',
204
- '*::before': 'all:revert',
205
- '*::after': 'all:revert',
206
- [SCROLLBAR]: 'width:0.5rem;height:0.5rem;',
207
- [SCROLLBAR + '-track']: 'background:#111',
208
- [SCROLLBAR + '-thumb']: 'background:#999;border:1px solid #111',
209
- [SCROLLBAR + '-thumb:hover']: 'background:#fff',
210
- [SCROLLBAR + '-corner']: 'background:#111',
211
- img: 'width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom',
212
- // Nub
213
- '>img': 'padding:0.25rem;bottom:0;right:0;position:fixed;' + LOGO_SVG,
214
- ...objNew(
215
- arrayMap(['bottom:0;left:0', 'top:0;right:0'], (css, p) => [
216
- `>img[data-position='${p}']`,
217
- css,
218
- ]),
219
- ),
220
- // Panel
221
- main: 'display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;',
222
- ...objNew(
223
- arrayMap(
224
- [
225
- 'bottom:0;left:0;width:35vw;height:100vh',
226
- 'top:0;right:0;width:100vw;height:30vh',
227
- 'bottom:0;left:0;width:100vw;height:30vh',
228
- 'top:0;right:0;width:35vw;height:100vh',
229
- 'top:0;right:0;width:100vw;height:100vh',
230
- ],
231
- (css, p) => [`main[data-position='${p}']`, css],
232
- ),
233
- ),
234
- // Header
235
- header:
236
- 'display:flex;padding:0.25rem;background:#000;align-items:center',
237
- 'header>img:nth-of-type(1)': LOGO_SVG,
238
- 'header>img:nth-of-type(6)': CLOSE_SVG,
239
- ...objNew(
240
- arrayMap(POSITIONS_SVG, (SVG, p) => [
241
- `header>img[data-id='${p}']`,
242
- SVG,
243
- ]),
198
+ const APP_STYLESHEET = arrayJoin(
199
+ objMap(
200
+ {
201
+ '': 'all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999',
202
+ '*': 'all:revert',
203
+ '*::before': 'all:revert',
204
+ '*::after': 'all:revert',
205
+ [SCROLLBAR]: 'width:0.5rem;height:0.5rem;',
206
+ [SCROLLBAR + '-track']: 'background:#111',
207
+ [SCROLLBAR + '-thumb']: 'background:#999;border:1px solid #111',
208
+ [SCROLLBAR + '-thumb:hover']: 'background:#fff',
209
+ [SCROLLBAR + '-corner']: 'background:#111',
210
+ img: 'width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom',
211
+ // Nub
212
+ '>img': 'padding:0.25rem;bottom:0;right:0;position:fixed;' + LOGO_SVG,
213
+ ...objNew(
214
+ arrayMap(['bottom:0;left:0', 'top:0;right:0'], (css, p) => [
215
+ `>img[data-position='${p}']`,
216
+ css,
217
+ ]),
218
+ ),
219
+ // Panel
220
+ main: 'display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;',
221
+ ...objNew(
222
+ arrayMap(
223
+ [
224
+ 'bottom:0;left:0;width:35vw;height:100vh',
225
+ 'top:0;right:0;width:100vw;height:30vh',
226
+ 'bottom:0;left:0;width:100vw;height:30vh',
227
+ 'top:0;right:0;width:35vw;height:100vh',
228
+ 'top:0;right:0;width:100vw;height:100vh',
229
+ ],
230
+ (css, p) => [`main[data-position='${p}']`, css],
244
231
  ),
245
- 'header>span':
246
- 'flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem',
247
- // Body
248
- article: 'padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1',
249
- details: 'margin-left:0.75rem;width:fit-content;',
250
- 'details img': 'display:none',
251
- 'details[open]>summary img':
252
- 'display:unset;background:none;margin-left:0.25rem',
253
- 'details[open]>summary img.edit': EDIT_SVG,
254
- 'details[open]>summary img.done': DONE_SVG,
255
- summary:
256
- 'margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content',
257
- // tables
258
- table:
259
- 'border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem',
260
- 'table input':
261
- 'background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0',
262
- 'table input[type="number"]': 'width:4rem',
263
- 'table tbody button':
264
- 'font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111',
265
- 'table button:first-letter': 'font-size:0.75rem',
266
- thead: 'background:#222',
267
- 'th:nth-of-type(1)': 'min-width:2rem;',
268
- 'th.sorted': 'background:#000',
269
- 'table caption':
270
- 'text-align:left;white-space:nowrap;line-height:1.25rem',
271
- button: 'width:1.5rem;border:none;background:none;color:#fff;padding:0',
272
- 'button[disabled]': 'color:#777',
273
- 'button.next': 'margin-right:0.5rem',
274
- [`th,td`]:
275
- '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',
276
- 'span.warn': 'margin:0.25rem;color:#d81b60',
277
- },
278
- (style, selector) => (style ? `& ${selector}{${style}}` : ''),
279
- ),
280
- )}`;
232
+ ),
233
+ // Header
234
+ header: 'display:flex;padding:0.25rem;background:#000;align-items:center',
235
+ 'header>img:nth-of-type(1)': LOGO_SVG,
236
+ 'header>img:nth-of-type(6)': CLOSE_SVG,
237
+ ...objNew(
238
+ arrayMap(POSITIONS_SVG, (SVG, p) => [
239
+ `header>img[data-id='${p}']`,
240
+ SVG,
241
+ ]),
242
+ ),
243
+ 'header>span':
244
+ 'flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem',
245
+ // Body
246
+ article: 'padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1',
247
+ details: 'margin-left:0.75rem;width:fit-content;',
248
+ 'details img': 'display:none',
249
+ 'details[open]>summary img':
250
+ 'display:unset;background:none;margin-left:0.25rem',
251
+ 'details[open]>summary img.edit': EDIT_SVG,
252
+ 'details[open]>summary img.done': DONE_SVG,
253
+ summary:
254
+ 'margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content',
255
+ // tables
256
+ table: 'border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem',
257
+ 'table input':
258
+ 'background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0',
259
+ 'table input[type="number"]': 'width:4rem',
260
+ 'table tbody button':
261
+ 'font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111',
262
+ 'table button:first-letter': 'font-size:0.75rem',
263
+ thead: 'background:#222',
264
+ 'th:nth-of-type(1)': 'min-width:2rem;',
265
+ 'th.sorted': 'background:#000',
266
+ 'table caption': 'text-align:left;white-space:nowrap;line-height:1.25rem',
267
+ button: 'width:1.5rem;border:none;background:none;color:#fff;padding:0',
268
+ 'button[disabled]': 'color:#777',
269
+ 'button.next': 'margin-right:0.5rem',
270
+ [`th,#${UNIQUE_ID} td`]:
271
+ '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',
272
+ 'span.warn': 'margin:0.25rem;color:#d81b60',
273
+ },
274
+ (style, selector) => (style ? `#${UNIQUE_ID} ${selector}{${style}}` : ''),
275
+ ),
276
+ );
281
277
 
282
278
  const Nub = ({s}) => {
283
279
  const position = useValue(POSITION_VALUE, s) ?? 1;
@@ -1441,8 +1437,8 @@ class ErrorBoundary extends PureComponent {
1441
1437
  console.error(error, info.componentStack);
1442
1438
  this.state = {e: 0};
1443
1439
  }
1444
- static {
1445
- this.getDerivedStateFromError = () => ({e: 1});
1440
+ static getDerivedStateFromError() {
1441
+ return {e: 1};
1446
1442
  }
1447
1443
  render() {
1448
1444
  return this.state.e
@@ -1 +1 @@
1
- import e from"react";import{useCell as t,useValue as l,useSetValueCallback as n,useSetCellCallback as r,useRowIds as o,useTableCellIds as s,useRowCount as a,useSortedRowIds as i,useValueIds as d,ValueView as u,useIndexesOrIndexesById as c,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useResultRowIds as p,useResultTableCellIds as v,useResultRowCount as g,useResultSortedRowIds as b,useStoreOrStoreById as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as C,useIndexIds as k,useSliceIds as x,useMetrics as T,useMetricIds as S,useMetric as O,useQueries as q,useQueryIds as N,useRelationships as V,useRelationshipIds as P,useStore as L,useTableIds as R,useValues as E,useStoreIds as j,useMetricsIds as M,useIndexesIds as z,useRelationshipsIds as $,useQueriesIds as A,useCreateStore as F,useCreatePersister as J}from"./ui-react";const D=e=>typeof e,B="",W=D(B),H=D(!0),Q=D(0),G=D(D),K="type",U="default",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",le=ee+X,ne="Cell",re=ne+X,oe="Value",se=oe+"s",ae=oe+X,ie="currentTarget",de="value",ue=e=>B+e,ce=Math.floor,he=isFinite,me=(e,t)=>e instanceof t,pe=e=>null==e,ve=(e,t,l)=>pe(e)?null==l?void 0:l():t(e),ge=e=>e==W||e==H,be=e=>D(e)==G,fe=e=>Array.isArray(e),ye=(e,t,l)=>e.slice(t,l),Ie=e=>e.length,{PureComponent:we,Fragment:Ce,createElement:ke,useCallback:xe,useLayoutEffect:Te,useRef:Se,useState:Oe}=e,qe=(e,...t)=>pe(e)?{}:e(...t),Ne=(e,t)=>e.forEach(t),Ve=(e,t)=>e.map(t),Pe=e=>0==Ie(e),Le=(e,...t)=>e.push(...t),Re=e=>e.shift(),Ee=Object,je=Ee.keys,Me=Ee.isFrozen,ze=Ee.freeze,$e=e=>me(e,Ee)&&e.constructor==Ee,Ae=(e=[])=>Ee.fromEntries(e),Fe=(e,t)=>!pe(((e,t)=>ve(e,(e=>e[t])))(e,t)),Je=(e,t)=>(delete e[t],e),De=(e,t)=>Ve(Ee.entries(e),(([e,l])=>t(l,e))),Be=e=>$e(e)&&0==(e=>Ie(je(e)))(e),We=e=>JSON.stringify(e,((e,t)=>me(t,Map)?Ee.fromEntries([...t]):t)),He=JSON.parse,Qe="tinybaseStoreInspector",Ge="TinyBase Store Inspector",Ke=["left","top","bottom","right","full"],Ue="state",Xe="sort",Ye="open",Ze="position",_e=Ye,et="editable",tt=(...e)=>We(e),lt=(e,t)=>Ve(e.sort(),t),nt=(e,l)=>[!!t(Ue,e,et,l),xe((t=>{l.setCell(Ue,e,et,(e=>!e)),t.preventDefault()}),[l,e])],rt="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ot='content:url("',st=ot+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",at='</svg>")',it=ot+"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\")",dt=Ve([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>st+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+at)),ut=st+"<path d='M20 20l60 60M20 80l60-60' />"+at,ct=st+`<path d='${rt}' />`+at,ht=st+`<path d='${rt}M20 20l60 60' />`+at;var mt=Object.defineProperty,pt=Object.defineProperties,vt=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,yt=(e,t,l)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,It=(e,t)=>{for(var l in t||(t={}))bt.call(t,l)&&yt(e,l,t[l]);if(gt)for(var l of gt(t))ft.call(t,l)&&yt(e,l,t[l]);return e},wt=(e,t)=>pt(e,vt(t));const Ct="*::-webkit-scrollbar",kt=`#${Qe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,t="")=>e.join(t))(De(wt(It(wt(It(wt(It({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ct]:"width:0.5rem;height:0.5rem;",[Ct+"-track"]:"background:#111",[Ct+"-thumb"]:"background:#999;border:1px solid #111",[Ct+"-thumb:hover"]:"background:#fff",[Ct+"-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;"+it},Ae(Ve(["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(Ve(["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)":it,"header>img:nth-of-type(6)":ut}),Ae(Ve(dt,((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":ct,"details[open]>summary img.done":ht,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`& ${t}{${e}}`:"")))}`,xt=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!0),[],e);return l(_e,e)?null:ke("img",{onClick:o,title:Ge,"data-position":r})},Tt=({uniqueId:e,summary:l,editable:n,handleEditable:o,children:s,s:a})=>{const i=!!t(Ue,e,Ye,a),d=r(Ue,e,Ye,(e=>e[ie].open),[],a);return ke("details",{open:i,onToggle:d},ke("summary",null,l,o?ke("img",{onClick:o,className:n?"done":"edit"}):null),s)},St=e=>{const t=D(e);return ge(t)||t==Q&&he(e)?t:void 0},Ot=(e,t,l,n,r)=>pe(r)?e.delCell(t,l,n,!0):e.setCell(t,l,n,r),qt=(e,t,l)=>pe(l)?e.delValue(t):e.setValue(t,l),Nt=(e,t,l,n)=>e==W?t:e==Q?l:n;var Vt=Object.defineProperty,Pt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Rt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,Mt=(e,t,l)=>t in e?Vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,zt=(e,t)=>{for(var l in t||(t={}))Et.call(t,l)&&Mt(e,l,t[l]);if(Rt)for(var l of Rt(t))jt.call(t,l)&&Mt(e,l,t[l]);return e},$t=(e,t)=>Pt(e,Lt(t)),At=(e,t)=>{var l={};for(var n in e)Et.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&Rt)for(var n of Rt(e))t.indexOf(n)<0&&jt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:Ft,useMemo:Jt,useState:Dt}=e,Bt="editable",Wt=(e,t)=>Ve(s(e,t),(t=>e+"."+t)),Ht=(e,t,l)=>{const n=Ft(e,t);return l?n:void 0},Qt=(...e)=>Jt((()=>e),e),Gt=(e,t)=>Jt((()=>({store:e,tableId:t})),[e,t]),Kt=(e,t)=>Jt((()=>({queries:e,queryId:t})),[e,t]),Ut=(e,t=!1,l,n=0,r,o,s,a)=>{const[[i,d,u],c]=Dt([e,t,n]),h=Ft((e=>{c(e),null==a||a(e)}),[a]),m=Ht((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),p=Ft((e=>h([i,d,e])),[h,i,d]),v=!0===s?ul:s;return[[i,d,u],m,Jt((()=>!1===s?null:ke(v,{offset:u,limit:r,total:o,onChange:p})),[s,v,u,r,o,p])]},Xt=(e,t,l)=>Jt((()=>{const n=null!=t?t:e;return Ae(De(fe(n)?Ae(Ve(n,(e=>[e,e]))):n,((e,t)=>{return[t,zt(zt({},{label:t,component:l}),(n=e,D(n)==W?{label:e}:e))];var n})))}),[t,l,e]),Yt=({className:e,headerRow:t,idColumn:l,params:[n,r,o,s,a,i]})=>ke("table",{className:e},i?ke("caption",null,i):null,!1===t?null:ke("thead",null,ke("tr",null,!1===l?null:ke(Zt,{sort:null!=s?s:[],label:"Id",onClick:a}),De(n,(({label:e},t)=>ke(Zt,{key:t,cellId:t,label:e,sort:null!=s?s:[],onClick:a}))))),ke("tbody",null,Ve(o,(e=>ke("tr",{key:e},!1===l?null:ke("th",null,e),De(n,(({component:t,getComponentProps:l},n)=>ke("td",{key:n},ke(t,$t(zt(zt({},qe(l,e,n)),r),{rowId:e,cellId:n})))))))))),Zt=({cellId:e,sort:[t,l],label:n=(null!=e?e:B),onClick:r})=>ke("th",{onClick:Ht((()=>null==r?void 0:r(e)),[r,e],r),className:pe(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},pe(l)||t!=e?null:(l?"↓":"↑")+" ",n),_t=({localRowId:t,params:[l,n,r,o,s,a,i]})=>{const d=y(s,t,a);return ke("tr",null,!1===l?null:ke(e.Fragment,null,ke("th",null,t),ke("th",null,d)),De(n,(({component:e,getComponentProps:l},n)=>{const[s,a]=n.split(".",2),u=s===r?t:s===o?d:null;return pe(u)?null:ke("td",{key:n},ke(e,$t(zt({},qe(l,u,a)),{store:i,tableId:s,rowId:u,cellId:a})))})))},el=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:r=!0})=>{const[o,s]=Dt(),[a,i]=Dt(),[d,u]=Dt(),[c,h]=Dt(),[m,p]=Dt();a!==e&&(s(St(e)),i(e),u(e+""),h(Number(e)||0),p(!!e));const v=Ft(((e,l)=>{l(e),i(e),t(e)}),[t]),g=Ft((()=>{if(!(null==n?void 0:n())){const e=Nt(o,Q,H,W),l=Nt(e,d,c,m);s(e),i(l),t(l)}}),[n,t,d,c,m,o]);return ke("div",{className:l},r?ke("button",{className:o,onClick:g},o):null,Nt(o,ke("input",{key:o,value:d,onChange:Ft((e=>v(e[ie][de]+"",u)),[v])}),ke("input",{key:o,type:"number",value:c,onChange:Ft((e=>v(Number(e[ie][de]||0),h)),[v])}),ke("input",{key:o,type:"checkbox",checked:m,onChange:Ft((e=>v(!!e[ie].checked,p)),[v])})))},tl=e=>{var t=e,{tableId:l,store:n,editable:r,customCells:a}=t,i=At(t,["tableId","store","editable","customCells"]);return ke(Yt,$t(zt({},i),{params:Qt(Xt(s(l,n),a,r?il:I),Gt(n,l),o(l,n))}))},ll=e=>{var t=e,{tableId:l,cellId:n,descending:r,offset:o,limit:d,store:u,editable:c,sortOnClick:h,paginator:m=!1,onChange:p,customCells:v}=t,g=At(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,f,y]=Ut(n,r,h,o,d,a(l,u),m,p);return ke(Yt,$t(zt({},g),{params:Qt(Xt(s(l,u),v,c?il:I),Gt(u,l),i(l,...b,d,u),b,f,y)}))},nl=({store:e,editable:t=!1,valueComponent:l=(t?dl:u),getValueComponentProps:n,className:r,headerRow:o,idColumn:s})=>ke("table",{className:r},!1===o?null:ke("thead",null,ke("tr",null,!1===s?null:ke("th",null,"Id"),ke("th",null,oe))),ke("tbody",null,Ve(d(e),(t=>ke("tr",{key:t},!1===s?null:ke("th",null,t),ke("td",null,ke(l,$t(zt({},qe(n,t)),{valueId:t,store:e})))))))),rl=e=>{var t=e,{indexId:l,sliceId:n,indexes:r,editable:o,customCells:a}=t,i=At(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(c(r),l);return ke(Yt,$t(zt({},i),{params:Qt(Xt(s(m,u),a,o?il:I),Gt(u,m),h(l,n,d))}))},ol=({relationshipId:t,relationships:l,editable:n,customCells:r,className:s,headerRow:a,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(m(l),t),p=Xt([...Wt(c,u),...Wt(h,u)],r,n?il:I),v=Qt(i,p,c,h,t,d,u);return ke("table",{className:s},!1===a?null:ke("thead",null,ke("tr",null,!1===i?null:ke(e.Fragment,null,ke("th",null,c,".Id"),ke("th",null,h,".Id")),De(p,(({label:e},t)=>ke("th",{key:t},e))))),ke("tbody",null,Ve(o(c,u),(e=>ke(_t,{key:e,localRowId:e,params:v})))))},sl=e=>{var t=e,{queryId:l,queries:n,customCells:r}=t,o=At(t,["queryId","queries","customCells"]);return ke(Yt,$t(zt({},o),{params:Qt(Xt(v(l,n),r,w),Kt(n,l),p(l,n))}))},al=e=>{var t=e,{queryId:l,cellId:n,descending:r,offset:o,limit:s,queries:a,sortOnClick:i,paginator:d=!1,customCells:u,onChange:c}=t,h=At(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[m,p,f]=Ut(n,r,i,o,s,g(l,a),d,c);return ke(Yt,$t(zt({},h),{params:Qt(Xt(v(l,a),u,w),Kt(a,l),b(l,...m,s,a),m,p,f)}))},il=({tableId:e,rowId:l,cellId:n,store:o,className:s,showType:a})=>{var i;return ke(el,{thing:t(e,l,n,o),onThingChange:r(e,l,n,(e=>e),[],o),className:null!=s?s:Bt+ne,showType:a,hasSchema:null==(i=f(o))?void 0:i.hasTablesSchema})},dl=({valueId:e,store:t,className:r,showType:o})=>{var s;return ke(el,{thing:l(e,t),onThingChange:n(e,(e=>e),[],t),className:null!=r?r:Bt+oe,showType:o,hasSchema:null==(s=f(t))?void 0:s.hasValuesSchema})},ul=({onChange:t,total:l,offset:n=0,limit:r=l,singular:o="row",plural:s=o+"s"})=>{(n>l||n<0)&&(n=0,t(0));const a=Ht((()=>t(n-r)),[t,n,r],n>0),i=Ht((()=>t(n+r)),[t,n,r],n+r<l);return ke(e.Fragment,null,l>r&&ke(e.Fragment,null,ke("button",{className:"previous",disabled:0==n,onClick:a},"←"),ke("button",{className:"next",disabled:n+r>=l,onClick:i},"→"),n+1," to ",Math.min(l,n+r)," of "),l," ",1!=l?s:o)},cl=({indexes:e,indexesId:t,indexId:l,s:n})=>ke(Tt,{uniqueId:tt("i",t,l),summary:"Index: "+l,s:n},Ve(x(l,e),(r=>ke(hl,{indexes:e,indexesId:t,indexId:l,sliceId:r,s:n,key:r})))),hl=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:r})=>{const o=tt("i",t,l,n),[s,a]=nt(o,r);return ke(Tt,{uniqueId:o,summary:"Slice: "+n,editable:s,handleEditable:a,s:r},ke(rl,{sliceId:n,indexId:l,indexes:e,editable:s}))},ml=({indexesId:e,s:t})=>{const l=C(e),n=k(l);return pe(l)?null:ke(Tt,{uniqueId:tt("i",e),summary:"Indexes: "+(null!=e?e:U),s:t},Pe(n)?"No indexes defined":lt(n,(n=>ke(cl,{indexes:l,indexesId:e,indexId:n,s:t,key:n}))))},pl=({metrics:e,metricId:t})=>ke("tr",null,ke("th",null,t),ke("td",null,null==e?void 0:e.getTableId(t)),ke("td",null,O(t,e))),vl=({metricsId:e,s:t})=>{const l=T(e),n=S(l);return pe(l)?null:ke(Tt,{uniqueId:tt("m",e),summary:"Metrics: "+(null!=e?e:U),s:t},Pe(n)?"No metrics defined":ke("table",null,ke("thead",null,ke("th",null,"Metric Id"),ke("th",null,"Table Id"),ke("th",null,"Metric")),ke("tbody",null,Ve(n,(e=>ke(pl,{metrics:l,metricId:e,key:e}))))))},gl=({queries:e,queriesId:l,queryId:n,s:o})=>{var s;const a=tt("q",l,n),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o);return ke(Tt,{uniqueId:a,summary:"Query: "+n,s:o},ke(al,{queryId:n,queries:e,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},bl=({queriesId:e,s:t})=>{const l=q(e),n=N(l);return pe(l)?null:ke(Tt,{uniqueId:tt("q",e),summary:"Queries: "+(null!=e?e:U),s:t},Pe(n)?"No queries defined":lt(n,(n=>ke(gl,{queries:l,queriesId:e,queryId:n,s:t,key:n}))))},fl=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const r=tt("r",t,l),[o,s]=nt(r,n);return ke(Tt,{uniqueId:r,summary:"Relationship: "+l,editable:o,handleEditable:s,s:n},ke(ol,{relationshipId:l,relationships:e,editable:o}))},yl=({relationshipsId:e,s:t})=>{const l=V(e),n=P(l);return pe(l)?null:ke(Tt,{uniqueId:tt("r",e),summary:"Relationships: "+(null!=e?e:U),s:t},Pe(n)?"No relationships defined":lt(n,(n=>ke(fl,{relationships:l,relationshipsId:e,relationshipId:n,s:t,key:n}))))},Il=({tableId:e,store:l,storeId:n,s:o})=>{var s;const a=tt("t",n,e),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o),[h,m]=nt(a,o);return ke(Tt,{uniqueId:a,summary:Y+": "+e,editable:h,handleEditable:m,s:o},ke(ll,{tableId:e,store:l,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:h}))},wl=({store:e,storeId:t,s:l})=>{const n=tt("v",t),[r,o]=nt(n,l);return Pe(d(e))?null:ke(Tt,{uniqueId:n,summary:se,editable:r,handleEditable:o,s:l},ke(nl,{store:e,editable:r}))},Cl=({storeId:e,s:t})=>{const l=L(e),n=R(l);return pe(l)?null:ke(Tt,{uniqueId:tt("s",e),summary:"Store: "+(null!=e?e:U),s:t},ke(wl,{storeId:e,store:l,s:t}),lt(n,(n=>ke(Il,{store:l,storeId:e,tableId:n,s:t,key:n}))))},kl=({s:e})=>{const t=Se(null),l=Se(0),[n,r]=Oe(!1),{scrollLeft:o,scrollTop:s}=E(e);Te((()=>{const e=t.current;if(e&&!n){const t=new MutationObserver((()=>{e.scrollWidth>=ce(o)+e.clientWidth&&e.scrollHeight>=ce(s)+e.clientHeight&&e.scrollTo(o,s)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[n,o,s]);const a=xe((t=>{const{scrollLeft:n,scrollTop:o}=t[ie];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:n,scrollTop:o})}))}),[e]),i=L(),d=j(),u=T(),c=M(),h=C(),m=z(),p=V(),v=$(),g=q(),b=A();return pe(i)&&Pe(d)&&pe(u)&&Pe(c)&&pe(h)&&Pe(m)&&pe(p)&&Pe(v)&&pe(g)&&Pe(b)?ke("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):ke("article",{ref:t,onScroll:a},ke(Cl,{s:e}),Ve(d,(t=>ke(Cl,{storeId:t,s:e,key:t}))),ke(vl,{s:e}),Ve(c,(t=>ke(vl,{metricsId:t,s:e,key:t}))),ke(ml,{s:e}),Ve(m,(t=>ke(ml,{indexesId:t,s:e,key:t}))),ke(yl,{s:e}),Ve(v,(t=>ke(yl,{relationshipsId:t,s:e,key:t}))),ke(bl,{s:e}),Ve(b,(t=>ke(bl,{queriesId:t,s:e,key:t}))))};class xl extends we{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}render(){return this.state.e?ke("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}xl.getDerivedStateFromError=()=>({e:1});const Tl=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!1),[],e),s=n(Ze,(e=>Number(e[ie].dataset.id)),[],e);return ke("header",null,ke("img",{title:Ge}),ke("span",null,Ge),Ve(Ke,((e,t)=>t==r?null:ke("img",{onClick:s,"data-id":t,title:"Dock to "+e,key:t}))),ke("img",{onClick:o,title:"Close"}))},Sl=({s:e})=>{var t;const n=null!=(t=l(Ze,e))?t:1;return l(_e,e)?ke("main",{"data-position":n},ke(Tl,{s:e}),ke(xl,null,ke(kl,{s:e}))):null},Ol=e=>t=>{return l=(t,l)=>t+e(l),El(t).reduce(l,0);var l},ql=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Nl=Ol(ql),Vl=Ol(Nl),Pl=Ol(Vl),Ll=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},Rl=e=>pe(e)||0==ql(e),El=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},jl=e=>e.clear(),Ml=(e,t)=>null==e?void 0:e.forEach(t),zl=(e,t)=>null==e?void 0:e.delete(t),$l=e=>new Map(e),Al=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},Fl=(e,t)=>null==e?void 0:e.get(t),Jl=(e,t)=>Ml(e,((e,l)=>t(l,e))),Dl=(e,t,l)=>pe(l)?(zl(e,t),e):null==e?void 0:e.set(t,l),Bl=(e,t,l)=>(Ll(e,t)||Dl(e,t,l()),Fl(e,t)),Wl=(e,t,l,n=Dl)=>(De(t,((t,n)=>l(e,n,t))),Jl(e,(l=>Fe(t,l)?0:n(e,l))),e),Hl=(e,t,l)=>{const n={};return Ml(e,((e,r)=>{const o=t?t(e,r):e;!(null==l?void 0:l(o,e))&&(n[r]=o)})),n},Ql=(e,t,l)=>Hl(e,(e=>Hl(e,t,l)),Be),Gl=(e,t,l)=>Hl(e,(e=>Ql(e,t,l)),Be),Kl=(e,t)=>{const l=$l();return Ml(e,((e,n)=>{var r;return l.set(n,null!=(r=null==t?void 0:t(e))?r:e)})),l},Ul=e=>Kl(e,Kl),Xl=e=>Kl(e,Ul),Yl=(e,t,l,n,r=0)=>ve((l?Bl:Fl)(e,t[r],r>Ie(t)-2?l:$l),(o=>{if(r>Ie(t)-2)return(null==n?void 0:n(o))&&Dl(e,t[r]),o;const s=Yl(o,t,l,n,r+1);return Rl(o)&&Dl(e,t[r]),s}));var Zl=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const _l=$l(),en=$l();var tn=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const ln="storage",nn=globalThis.window,rn=e=>new Set(fe(e)||pe(e)?e:[e]),on=(e,t)=>null==e?void 0:e.add(t),sn=/^\d+$/,an=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?Re(e):null)?n:B+t++},t=>{sn.test(t)&&Ie(e)<1e3&&Le(e,t)}]},dn=e=>[e,e],un=(e,t=Nl)=>t(e[0])+t(e[1]),cn=()=>[$l(),$l()],hn=e=>[...e],mn=([e,t])=>e===t,pn=(e,t,l)=>pe(e)||!$e(e)||Be(e)||Me(e)?(null==l||l(),!1):(De(e,((l,n)=>{t(l,n)||Je(e,n)})),!Be(e)),vn=(e,t,l)=>Dl(e,t,Fl(e,t)==-l?void 0:l),gn=()=>{let e,t,l=!1,n=!1,r=0;const o=$l(),s=$l(),a=$l(),i=$l(),d=$l(),u=$l(),c=$l(),h=$l(),m=$l(),p=$l(),v=$l(),g=$l(),b=$l(),f=$l(),y=rn(),I=$l(),w=$l(),C=$l(),k=$l(),x=cn(),T=cn(),S=cn(),O=cn(),q=cn(),N=cn(),V=cn(),P=cn(),L=cn(),R=cn(),E=cn(),j=cn(),M=cn(),z=cn(),$=cn(),A=$l(),F=cn(),[J,D,W,H]=(e=>{let t;const[l,n]=an(),r=$l();return[(e,n,o,s=[],a=(()=>[]))=>{null!=t||(t=At);const i=l(1);return Dl(r,i,[e,n,o,s,a]),on(Yl(n,null!=o?o:[B],rn),i),i},(e,l,...n)=>Ne(((e,t=[B])=>{const l=[],n=(e,r)=>r==Ie(t)?Le(l,e):null===t[r]?Ml(e,(e=>n(e,r+1))):Ne([t[r],null],(t=>n(Fl(e,t),r+1)));return n(e,0),l})(e,l),(e=>Ml(e,(e=>Fl(r,e)[0](t,...null!=l?l:[],...n))))),e=>ve(Fl(r,e),(([,t,l])=>(Yl(t,null!=l?l:[B],void 0,(t=>(zl(t,e),Rl(t)?1:0))),Dl(r,e),n(e),l))),e=>ve(Fl(r,e),(([e,,l=[],n,r])=>{const o=(...s)=>{var a,i;const d=Ie(s);d==Ie(l)?e(t,...s,...r(s)):pe(l[d])?Ne(null!=(i=null==(a=n[d])?void 0:a.call(n,...s))?i:[],(e=>o(...s,e))):o(...s,l[d])};o()}))]})(),G=e=>{if(!pn(e,((e,t)=>[K,U].includes(t))))return!1;const t=e[K];return!(!ge(t)&&t!=Q||(St(e[U])!=t&&Je(e,U),0))},X=(t,l)=>(!e||Ll(v,l)||et(l))&&pn(t,((e,t)=>ie(l,t,e)),(()=>et(l))),ie=(e,t,l,n)=>pn(n?l:me(l,e,t),((n,r)=>ve(de(e,t,r,n),(e=>(l[r]=e,!0)),(()=>!1))),(()=>et(e,t))),de=(t,l,n,r)=>e?ve(Fl(Fl(v,t),n),(e=>St(r)!=e[K]?et(t,l,n,r,e[U]):r),(()=>et(t,l,n,r))):pe(St(r))?et(t,l,n,r):r,ce=(e,t)=>pn(t?e:fe(e),((t,l)=>ve(he(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>tt())),he=(e,l)=>t?ve(Fl(b,e),(t=>St(l)!=t[K]?tt(e,l,t[U]):l),(()=>tt(e,l))):pe(St(l))?tt(e,l):l,me=(e,t,l)=>(ve(Fl(g,t),(([n,r])=>{Ml(n,((t,l)=>{Fe(e,l)||(e[l]=t)})),Ml(r,(n=>{Fe(e,n)||et(t,l,n)}))})),e),fe=e=>(t&&(Ml(f,((t,l)=>{Fe(e,l)||(e[l]=t)})),Ml(y,(t=>{Fe(e,t)||tt(t)}))),e),we=e=>Wl(v,e,((e,t,l)=>{const n=$l(),r=rn();Wl(Bl(v,t,$l),l,((e,t,l)=>{Dl(e,t,l),ve(l[U],(e=>Dl(n,t,e)),(()=>on(r,t)))})),Dl(g,t,[n,r])}),((e,t)=>{Dl(v,t),Dl(g,t)})),Ce=e=>Wl(b,e,((e,t,l)=>{Dl(b,t,l),ve(l[U],(e=>Dl(f,t,e)),(()=>on(y,t)))}),((e,t)=>{Dl(b,t),Dl(f,t),zl(y,t)})),ke=e=>Be(e)?Vt():Ct(e),xe=e=>Wl(C,e,((e,t,l)=>Te(t,l)),((e,t)=>$e(t))),Te=(e,t)=>Wl(Bl(C,e,(()=>(Ke(e,1),Dl(I,e,an()),Dl(w,e,$l()),$l()))),t,((t,l,n)=>Se(e,t,l,n)),((t,l)=>Ae(e,t,l))),Se=(e,t,l,n,r)=>Wl(Bl(t,l,(()=>(Ue(e,l,1),$l()))),n,((t,n,r)=>Oe(e,l,t,n,r)),((n,o)=>Qe(e,t,l,n,o,r))),Oe=(e,t,l,n,r)=>{Ll(l,n)||Xe(e,t,n,1);const o=Fl(l,n);r!==o&&(Ye(e,t,n,o,r),Dl(l,n,r))},qe=(e,t,l,n,r)=>ve(Fl(t,l),(t=>Oe(e,l,t,n,r)),(()=>Se(e,t,l,me({[n]:r},e,l)))),Pe=e=>Be(e)?Rt():kt(e),Re=e=>Wl(k,e,((e,t,l)=>Ee(t,l)),((e,t)=>Ge(t))),Ee=(e,t)=>{Ll(k,e)||Ze(e,1);const l=Fl(k,e);t!==l&&(_e(e,l,t),Dl(k,e,t))},je=(e,t)=>{const[l]=Fl(I,e),n=l(t);return Ll(Fl(C,e),n)?je(e,t):n},Me=e=>{var t;return null!=(t=Fl(C,e))?t:Te(e,{})},$e=e=>Te(e,{}),Ae=(e,t,l)=>{const[,n]=Fl(I,e);n(l),Se(e,t,l,{},!0)},Qe=(e,t,l,n,r,o)=>{var s;const a=Fl(null==(s=Fl(g,e))?void 0:s[0],r);if(!pe(a)&&!o)return Oe(e,l,n,r,a);const i=t=>{Ye(e,l,t,Fl(n,t)),Xe(e,l,t,-1),Dl(n,t)};pe(a)?i(r):Jl(n,i),Rl(n)&&(Ue(e,l,-1),Rl(Dl(t,l))&&(Ke(e,-1),Dl(C,e),Dl(I,e),Dl(w,e)))},Ge=e=>{const t=Fl(f,e);if(!pe(t))return Ee(e,t);_e(e,Fl(k,e)),Ze(e,-1),Dl(k,e)},Ke=(e,t)=>vn(o,e,t),Ue=(e,t,l)=>vn(Bl(i,e,$l),t,l)&&Dl(a,e,Bl(a,e,(()=>0))+l),Xe=(e,t,l,n)=>{var r;const o=Fl(w,e),a=null!=(r=Fl(o,l))?r:0;(0==a&&1==n||1==a&&-1==n)&&vn(Bl(s,e,$l),l,n),Dl(o,l,a!=-n?a+n:null),vn(Bl(Bl(d,e,$l),t,$l),l,n)},Ye=(e,t,l,n,r)=>Bl(Bl(Bl(u,e,$l),t,$l),l,(()=>[n,0]))[1]=r,Ze=(e,t)=>vn(c,e,t),_e=(e,t,l)=>Bl(h,e,(()=>[t,0]))[1]=l,et=(e,t,l,n,r)=>(Le(Bl(Bl(Bl(m,e,$l),t,$l),l,(()=>[])),n),r),tt=(e,t,l)=>(Le(Bl(p,e,(()=>[])),t),l),lt=(e,t,l)=>ve(Fl(Fl(Fl(u,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...dn(ft(e,t,l))])),nt=e=>ve(Fl(h,e),(([e,t])=>[!0,e,t]),(()=>[!1,...dn(wt(e))])),rt=e=>Rl(m)||Rl(E[e])?0:Ml(e?Xl(m):m,((t,l)=>Ml(t,((t,n)=>Ml(t,((t,r)=>D(E[e],[l,n,r],t))))))),ot=e=>Rl(p)||Rl(j[e])?0:Ml(e?Kl(p):p,((t,l)=>D(j[e],[l],t))),st=(e,t,l)=>{if(!Rl(t))return D(e,l,(()=>Hl(t))),1},at=e=>{const t=Rl(V[e]),l=Rl(L[e])&&Rl(O[e])&&Rl(q[e])&&Rl(N[e])&&t&&Rl(T[e]),n=Rl(R[e])&&Rl(P[e])&&Rl(S[e])&&Rl(x[e]);if(!l||!n){const r=e?[Kl(o),Ul(s),Kl(a),Ul(i),Xl(d),Xl(u)]:[o,s,a,i,d,u];if(!l){st(T[e],r[0]),Ml(r[1],((t,l)=>st(O[e],t,[l]))),Ml(r[2],((t,l)=>{0!=t&&D(q[e],[l],pt(l))}));const l=rn();Ml(r[3],((n,r)=>{st(N[e],n,[r])&&!t&&(D(V[e],[r,null]),on(l,r))})),t||Ml(r[5],((t,n)=>{if(!Ll(l,n)){const l=rn();Ml(t,(e=>Ml(e,(([t,n],r)=>n!==t?on(l,r):zl(e,r))))),Ml(l,(t=>D(V[e],[n,t])))}})),Ml(r[4],((t,l)=>Ml(t,((t,n)=>st(L[e],t,[l,n])))))}if(!n){let t;Ml(r[5],((l,n)=>{let r;Ml(l,((l,o)=>{let s;Ml(l,(([l,a],i)=>{a!==l&&(D(R[e],[n,o,i],a,l,lt),t=r=s=1)})),s&&D(P[e],[n,o],lt)})),r&&D(S[e],[n],lt)})),t&&D(x[e],void 0,lt)}}},it=e=>{const t=Rl(z[e]),l=Rl($[e])&&Rl(M[e]);if(!t||!l){const n=e?[Kl(c),Kl(h)]:[c,h];if(t||st(z[e],n[0]),!l){let t;Ml(n[1],(([l,n],r)=>{n!==l&&(D($[e],[r],n,l,nt),t=1)})),t&&D(M[e],void 0,nt)}}},dt=(e,...t)=>(Mt((()=>e(...Ve(t,ue)))),At),ut=()=>[Hl(u,((e,t)=>-1===Fl(o,t)?null:Hl(e,((e,l)=>-1===Fl(Fl(i,t),l)?null:Hl(e,(([,e])=>null!=e?e:null),((e,t)=>mn(t)))),Be)),Be),Hl(h,(([,e])=>null!=e?e:null),((e,t)=>mn(t)))],ct=()=>({cellsTouched:l,valuesTouched:n,changedCells:Gl(u,hn,mn),invalidCells:Gl(m),changedValues:Hl(h,hn,mn),invalidValues:Hl(p),changedTableIds:Hl(o),changedRowIds:Ql(i),changedCellIds:Gl(d),changedValueIds:Hl(c)}),ht=()=>Gl(C),mt=()=>Al(C),pt=e=>ql(Fl(C,ue(e))),vt=e=>Al(Fl(C,ue(e))),gt=(e,t,l,n=0,r)=>{return Ve(ye((s=Fl(C,ue(e)),a=(e,l)=>[pe(t)?l:Fl(e,ue(t)),l],o=([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(r=t)?r:0)?-1:1)*(l?-1:1);var n,r},Ve([...null!=(i=null==s?void 0:s.entries())?i:[]],(([e,t])=>a(t,e))).sort(o)),n,pe(r)?r:n+r),(([,e])=>e));var o,s,a,i},bt=(e,t)=>Al(Fl(Fl(C,ue(e)),ue(t))),ft=(e,t,l)=>Fl(Fl(Fl(C,ue(e)),ue(t)),ue(l)),yt=()=>Hl(k),It=()=>Al(k),wt=e=>Fl(k,ue(e)),Ct=e=>dt((()=>(e=>pn(e,X,et))(e)?xe(e):0)),kt=e=>dt((()=>ce(e)?Re(e):0)),xt=e=>{try{ke(He(e))}catch(e){}return At},Tt=t=>dt((()=>{if((e=pn(t,(e=>pn(e,G))))&&(we(t),!Rl(C))){const e=ht();Vt(),Ct(e)}})),Nt=e=>dt((()=>{if(t=(e=>pn(e,G))(e)){const l=yt();jt(),Rt(),t=!0,Ce(e),kt(l)}})),Vt=()=>dt((()=>xe({}))),Pt=e=>dt((e=>Ll(C,e)?$e(e):0),e),Lt=(e,t)=>dt(((e,t)=>ve(Fl(C,e),(l=>Ll(l,t)?Ae(e,l,t):0))),e,t),Rt=()=>dt((()=>Re({}))),Et=()=>dt((()=>{we({}),e=!1})),jt=()=>dt((()=>{Ce({}),t=!1})),Mt=(e,t)=>{if(-1!=r){zt();const l=e();return $t(t),l}},zt=()=>(-1!=r&&r++,1==r&&D(A,void 0,ut,ct),At),$t=e=>(r>0&&(r--,0==r&&(l=!Rl(u),n=!Rl(h),r=1,rt(1),l&&at(1),ot(1),n&&it(1),(null==e?void 0:e(ut,ct))&&(Ml(u,((e,t)=>Ml(e,((e,l)=>Ml(e,(([e],n)=>Ot(At,t,l,n,e))))))),Ml(h,(([e],t)=>qt(At,t,e))),l=n=!1),D(F[0],void 0,ut,ct),r=-1,rt(0),l&&at(0),ot(0),n&&it(0),D(F[1],void 0,ut,ct),r=0,l=n=!1,Ne([o,s,a,i,d,u,m,c,h,p],jl))),At),At={getContent:()=>[ht(),yt()],getTables:ht,getTableIds:mt,getTable:e=>Ql(Fl(C,ue(e))),getTableCellIds:e=>Al(Fl(w,ue(e))),getRowCount:pt,getRowIds:vt,getSortedRowIds:gt,getRow:(e,t)=>Hl(Fl(Fl(C,ue(e)),ue(t))),getCellIds:bt,getCell:ft,getValues:yt,getValueIds:It,getValue:wt,hasTables:()=>!Rl(C),hasTable:e=>Ll(C,ue(e)),hasTableCell:(e,t)=>Ll(Fl(w,ue(e)),ue(t)),hasRow:(e,t)=>Ll(Fl(C,ue(e)),ue(t)),hasCell:(e,t,l)=>Ll(Fl(Fl(C,ue(e)),ue(t)),ue(l)),hasValues:()=>!Rl(k),hasValue:e=>Ll(k,ue(e)),getTablesJson:()=>We(C),getValuesJson:()=>We(k),getJson:()=>We([C,k]),getTablesSchemaJson:()=>We(v),getValuesSchemaJson:()=>We(b),getSchemaJson:()=>We([v,b]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>dt((()=>{(Be(e)?Vt:Ct)(e),(Be(t)?Rt:kt)(t)})),setTables:Ct,setTable:(e,t)=>dt((e=>X(t,e)?Te(e,t):0),e),setRow:(e,t,l)=>dt(((e,t)=>ie(e,t,l)?Se(e,Me(e),t,l):0),e,t),addRow:(e,t,l=!0)=>Mt((()=>{let n;return ie(e,n,t)&&(e=ue(e),Se(e,Me(e),n=je(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>dt(((e,t)=>{if(ie(e,t,l,1)){const n=Me(e);De(l,((l,r)=>qe(e,n,t,r,l)))}}),e,t),setCell:(e,t,l,n)=>dt(((e,t,l)=>ve(de(e,t,l,be(n)?n(ft(e,t,l)):n),(n=>qe(e,Me(e),t,l,n)))),e,t,l),setValues:kt,setPartialValues:e=>dt((()=>ce(e,1)?De(e,((e,t)=>Ee(t,e))):0)),setValue:(e,t)=>dt((e=>ve(he(e,be(t)?t(wt(e)):t),(t=>Ee(e,t)))),e),setTransactionChanges:e=>dt((()=>{De(e[0],((e,t)=>pe(e)?Pt(t):De(e,((e,l)=>pe(e)?Lt(t,l):De(e,((e,n)=>Ot(At,t,l,n,e))))))),De(e[1],((e,t)=>qt(At,t,e)))})),setTablesJson:xt,setValuesJson:e=>{try{Pe(He(e))}catch(e){}return At},setJson:e=>dt((()=>{try{const[t,l]=He(e);ke(t),Pe(l)}catch(t){xt(e)}})),setTablesSchema:Tt,setValuesSchema:Nt,setSchema:(e,t)=>dt((()=>{Tt(e),Nt(t)})),delTables:Vt,delTable:Pt,delRow:Lt,delCell:(e,t,l,n)=>dt(((e,t,l)=>ve(Fl(C,e),(r=>ve(Fl(r,t),(o=>Ll(o,l)?Qe(e,r,t,o,l,n):0))))),e,t,l),delValues:Rt,delValue:e=>dt((e=>Ll(k,e)?Ge(e):0),e),delTablesSchema:Et,delValuesSchema:jt,delSchema:()=>dt((()=>{Et(),jt()})),transaction:Mt,startTransaction:zt,finishTransaction:$t,forEachTable:e=>Ml(C,((t,l)=>e(l,(e=>Ml(t,((t,l)=>e(l,(e=>Jl(t,e))))))))),forEachTableCell:(e,t)=>Jl(Fl(w,ue(e)),t),forEachRow:(e,t)=>Ml(Fl(C,ue(e)),((e,l)=>t(l,(t=>Jl(e,t))))),forEachCell:(e,t,l)=>Jl(Fl(Fl(C,ue(e)),ue(t)),l),forEachValue:e=>Jl(k,e),addSortedRowIdsListener:(e,t,l,n,r,o,s)=>{let a=gt(e,t,l,n,r);return J((()=>{const s=gt(e,t,l,n,r);var i,d,u;d=a,Ie(i=s)===Ie(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(a=s,o(At,e,t,l,n,r,a))}),V[s?1:0],[e,t],[mt])},addStartTransactionListener:e=>J(e,A),addWillFinishTransactionListener:e=>J(e,F[0]),addDidFinishTransactionListener:e=>J(e,F[1]),callListener:e=>(H(e),At),delListener:e=>(W(e),At),getListenerStats:()=>({tables:un(x),tableIds:un(T),tableCellIds:un(O),table:un(S),rowCount:un(q),rowIds:un(N),sortedRowIds:un(V),row:un(P,Vl),cellIds:un(L,Vl),cell:un(R,Pl),invalidCell:un(E,Pl),values:un(M),valueIds:un(z),value:un($),invalidValue:un(j),transaction:Nl(A)+un(F)}),createStore:gn,addListener:J,callListeners:D};return De({[Z]:[0,x],[_]:[0,T],[Y]:[1,S,[mt]],[Y+re]:[1,O,[mt]],[te]:[1,q,[mt]],[le]:[1,N,[mt]],[ee]:[2,P,[mt,vt]],[re]:[2,L,[mt,vt]],[ne]:[3,R,[mt,vt,bt],e=>dn(ft(...e))],InvalidCell:[3,E],[se]:[0,M],[ae]:[0,z],[oe]:[1,$,[It],e=>dn(wt(e[0]))],InvalidValue:[1,j]},(([e,t,l,n],r)=>{At["add"+r+"Listener"]=(...r)=>J(r[e],t[r[e+1]?1:0],e>0?ye(r,0,e):void 0,l,n)})),ze(At)},bn=({position:e="right",open:t=!1})=>{const l=F(gn),n=Ke.indexOf(e);return J(l,(e=>{return((e,t,l,n)=>((e,t,l,n,r,o,[s,a]=[],i=[])=>{let d,u,c,h=0,m=0,p=0,v=0;Bl(_l,i,(()=>0)),Bl(en,i,(()=>[]));const g=e=>Zl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield b.schedule((()=>Zl(void 0,null,(function*(){yield e(),h=0}))))),b})),b={load:(l,n)=>Zl(void 0,null,(function*(){return yield g((()=>Zl(void 0,null,(function*(){try{e.setContent(yield t())}catch(t){e.setContent([l,n])}}))))})),startAutoLoad:(...l)=>Zl(void 0,[...l],(function*(l={},r={}){return b.stopAutoLoad(),yield b.load(l,r),v=1,c=n(((l,n)=>Zl(void 0,null,(function*(){if(n){const t=n();yield g((()=>Zl(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield g((()=>Zl(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==l?void 0:l())?n:yield t())}catch(e){null==o||o(e)}}))))})))),b})),stopAutoLoad:()=>(v&&(r(c),c=void 0,v=0),b),save:t=>Zl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield b.schedule((()=>Zl(void 0,null,(function*(){try{yield l(e.getContent,t)}catch(e){null==o||o(e)}h=0}))))),b})),startAutoSave:()=>Zl(void 0,null,(function*(){return yield b.stopAutoSave().save(),d=e.addDidFinishTransactionListener(((e,t)=>{const[l,n]=t();Be(l)&&Be(n)||b.save((()=>[l,n]))})),b})),stopAutoSave:()=>(ve(d,e.delListener),d=void 0,b),schedule:(...e)=>Zl(void 0,null,(function*(){return Le(Fl(en,i),...e),yield Zl(void 0,null,(function*(){if(!Fl(_l,i)){for(Dl(_l,i,1);!pe(u=Re(Fl(en,i)));)try{yield u()}catch(e){null==o||o(e)}Dl(_l,i,0)}})),b})),getStore:()=>e,destroy:()=>b.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:m,saves:p})};return s&&(b[s]=()=>a),ze(b)})(e,(()=>tn(void 0,null,(function*(){return He(l.getItem(t))}))),(e=>tn(void 0,null,(function*(){return l.setItem(t,We(e()))}))),(e=>{const n=n=>{n.storageArea===l&&n.key===t&&e((()=>He(n.newValue)))};return nn.addEventListener(ln,n),n}),(e=>nn.removeEventListener(ln,e)),n,["getStorageName",t]))(e,Qe,sessionStorage,t);var t}),void 0,(e=>{return l=function*(){yield e.load(void 0,{position:-1==n?1:n,open:!!t}),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{o(l.next(e))}catch(e){t(e)}},r=e=>{try{o(l.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,r);o((l=l.apply(void 0,null)).next())}));var l})),ke(Ce,null,ke("aside",{id:Qe},ke(xt,{s:l}),ke(Sl,{s:l})),ke("style",null,kt))};var fn=Object.defineProperty,yn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable,Cn=(e,t,l)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;const kn=e=>ke(bn,((e,t)=>{for(var l in t||(t={}))In.call(t,l)&&Cn(e,l,t[l]);if(yn)for(var l of yn(t))wn.call(t,l)&&Cn(e,l,t[l]);return e})({},e));export{il as EditableCellView,dl as EditableValueView,ol as RelationshipInHtmlTable,al as ResultSortedTableInHtmlTable,sl as ResultTableInHtmlTable,rl as SliceInHtmlTable,ll as SortedTableInHtmlTable,ul as SortedTablePaginator,kn as StoreInspector,tl as TableInHtmlTable,nl as ValuesInHtmlTable};
1
+ import e from"react";import{useCell as t,useValue as l,useSetValueCallback as n,useSetCellCallback as r,useRowIds as o,useTableCellIds as s,useRowCount as a,useSortedRowIds as i,useValueIds as d,ValueView as u,useIndexesOrIndexesById as c,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useResultRowIds as p,useResultTableCellIds as v,useResultRowCount as g,useResultSortedRowIds as b,useStoreOrStoreById as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as C,useIndexIds as k,useSliceIds as x,useMetrics as T,useMetricIds as S,useMetric as O,useQueries as q,useQueryIds as N,useRelationships as V,useRelationshipIds as P,useStore as L,useTableIds as R,useValues as E,useStoreIds as j,useMetricsIds as M,useIndexesIds as z,useRelationshipsIds as $,useQueriesIds as A,useCreateStore as F,useCreatePersister as J}from"./ui-react";const D=e=>typeof e,B="",W=D(B),H=D(!0),Q=D(0),G=D(D),K="type",U="default",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",le=ee+X,ne="Cell",re=ne+X,oe="Value",se=oe+"s",ae=oe+X,ie="currentTarget",de="value",ue=e=>B+e,ce=Math.floor,he=isFinite,me=(e,t)=>e instanceof t,pe=e=>null==e,ve=(e,t,l)=>pe(e)?null==l?void 0:l():t(e),ge=e=>e==W||e==H,be=e=>D(e)==G,fe=e=>Array.isArray(e),ye=(e,t,l)=>e.slice(t,l),Ie=e=>e.length,{PureComponent:we,Fragment:Ce,createElement:ke,useCallback:xe,useLayoutEffect:Te,useRef:Se,useState:Oe}=e,qe=(e,...t)=>pe(e)?{}:e(...t),Ne=(e,t)=>e.forEach(t),Ve=(e,t)=>e.map(t),Pe=e=>0==Ie(e),Le=(e,...t)=>e.push(...t),Re=e=>e.shift(),Ee=Object,je=Ee.keys,Me=Ee.isFrozen,ze=Ee.freeze,$e=e=>me(e,Ee)&&e.constructor==Ee,Ae=(e=[])=>Ee.fromEntries(e),Fe=(e,t)=>!pe(((e,t)=>ve(e,(e=>e[t])))(e,t)),Je=(e,t)=>(delete e[t],e),De=(e,t)=>Ve(Ee.entries(e),(([e,l])=>t(l,e))),Be=e=>$e(e)&&0==(e=>Ie(je(e)))(e),We=e=>JSON.stringify(e,((e,t)=>me(t,Map)?Ee.fromEntries([...t]):t)),He=JSON.parse,Qe="tinybaseStoreInspector",Ge="TinyBase Store Inspector",Ke=["left","top","bottom","right","full"],Ue="state",Xe="sort",Ye="open",Ze="position",_e=Ye,et="editable",tt=(...e)=>We(e),lt=(e,t)=>Ve(e.sort(),t),nt=(e,l)=>[!!t(Ue,e,et,l),xe((t=>{l.setCell(Ue,e,et,(e=>!e)),t.preventDefault()}),[l,e])],rt="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ot='content:url("',st=ot+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",at='</svg>")',it=ot+"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\")",dt=Ve([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>st+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+at)),ut=st+"<path d='M20 20l60 60M20 80l60-60' />"+at,ct=st+`<path d='${rt}' />`+at,ht=st+`<path d='${rt}M20 20l60 60' />`+at;var mt=Object.defineProperty,pt=Object.defineProperties,vt=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,yt=(e,t,l)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,It=(e,t)=>{for(var l in t||(t={}))bt.call(t,l)&&yt(e,l,t[l]);if(gt)for(var l of gt(t))ft.call(t,l)&&yt(e,l,t[l]);return e},wt=(e,t)=>pt(e,vt(t));const Ct="*::-webkit-scrollbar",kt=((e,t="")=>e.join(t))(De(wt(It(wt(It(wt(It({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ct]:"width:0.5rem;height:0.5rem;",[Ct+"-track"]:"background:#111",[Ct+"-thumb"]:"background:#999;border:1px solid #111",[Ct+"-thumb:hover"]:"background:#fff",[Ct+"-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;"+it},Ae(Ve(["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(Ve(["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)":it,"header>img:nth-of-type(6)":ut}),Ae(Ve(dt,((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":ct,"details[open]>summary img.done":ht,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,#${Qe} 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?`#${Qe} ${t}{${e}}`:""))),xt=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!0),[],e);return l(_e,e)?null:ke("img",{onClick:o,title:Ge,"data-position":r})},Tt=({uniqueId:e,summary:l,editable:n,handleEditable:o,children:s,s:a})=>{const i=!!t(Ue,e,Ye,a),d=r(Ue,e,Ye,(e=>e[ie].open),[],a);return ke("details",{open:i,onToggle:d},ke("summary",null,l,o?ke("img",{onClick:o,className:n?"done":"edit"}):null),s)},St=e=>{const t=D(e);return ge(t)||t==Q&&he(e)?t:void 0},Ot=(e,t,l,n,r)=>pe(r)?e.delCell(t,l,n,!0):e.setCell(t,l,n,r),qt=(e,t,l)=>pe(l)?e.delValue(t):e.setValue(t,l),Nt=(e,t,l,n)=>e==W?t:e==Q?l:n;var Vt=Object.defineProperty,Pt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Rt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,Mt=(e,t,l)=>t in e?Vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,zt=(e,t)=>{for(var l in t||(t={}))Et.call(t,l)&&Mt(e,l,t[l]);if(Rt)for(var l of Rt(t))jt.call(t,l)&&Mt(e,l,t[l]);return e},$t=(e,t)=>Pt(e,Lt(t)),At=(e,t)=>{var l={};for(var n in e)Et.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&Rt)for(var n of Rt(e))t.indexOf(n)<0&&jt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:Ft,useMemo:Jt,useState:Dt}=e,Bt="editable",Wt=(e,t)=>Ve(s(e,t),(t=>e+"."+t)),Ht=(e,t,l)=>{const n=Ft(e,t);return l?n:void 0},Qt=(...e)=>Jt((()=>e),e),Gt=(e,t)=>Jt((()=>({store:e,tableId:t})),[e,t]),Kt=(e,t)=>Jt((()=>({queries:e,queryId:t})),[e,t]),Ut=(e,t=!1,l,n=0,r,o,s,a)=>{const[[i,d,u],c]=Dt([e,t,n]),h=Ft((e=>{c(e),null==a||a(e)}),[a]),m=Ht((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),p=Ft((e=>h([i,d,e])),[h,i,d]),v=!0===s?ul:s;return[[i,d,u],m,Jt((()=>!1===s?null:ke(v,{offset:u,limit:r,total:o,onChange:p})),[s,v,u,r,o,p])]},Xt=(e,t,l)=>Jt((()=>{const n=null!=t?t:e;return Ae(De(fe(n)?Ae(Ve(n,(e=>[e,e]))):n,((e,t)=>{return[t,zt(zt({},{label:t,component:l}),(n=e,D(n)==W?{label:e}:e))];var n})))}),[t,l,e]),Yt=({className:e,headerRow:t,idColumn:l,params:[n,r,o,s,a,i]})=>ke("table",{className:e},i?ke("caption",null,i):null,!1===t?null:ke("thead",null,ke("tr",null,!1===l?null:ke(Zt,{sort:null!=s?s:[],label:"Id",onClick:a}),De(n,(({label:e},t)=>ke(Zt,{key:t,cellId:t,label:e,sort:null!=s?s:[],onClick:a}))))),ke("tbody",null,Ve(o,(e=>ke("tr",{key:e},!1===l?null:ke("th",null,e),De(n,(({component:t,getComponentProps:l},n)=>ke("td",{key:n},ke(t,$t(zt(zt({},qe(l,e,n)),r),{rowId:e,cellId:n})))))))))),Zt=({cellId:e,sort:[t,l],label:n=(null!=e?e:B),onClick:r})=>ke("th",{onClick:Ht((()=>null==r?void 0:r(e)),[r,e],r),className:pe(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},pe(l)||t!=e?null:(l?"↓":"↑")+" ",n),_t=({localRowId:t,params:[l,n,r,o,s,a,i]})=>{const d=y(s,t,a);return ke("tr",null,!1===l?null:ke(e.Fragment,null,ke("th",null,t),ke("th",null,d)),De(n,(({component:e,getComponentProps:l},n)=>{const[s,a]=n.split(".",2),u=s===r?t:s===o?d:null;return pe(u)?null:ke("td",{key:n},ke(e,$t(zt({},qe(l,u,a)),{store:i,tableId:s,rowId:u,cellId:a})))})))},el=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:r=!0})=>{const[o,s]=Dt(),[a,i]=Dt(),[d,u]=Dt(),[c,h]=Dt(),[m,p]=Dt();a!==e&&(s(St(e)),i(e),u(e+""),h(Number(e)||0),p(!!e));const v=Ft(((e,l)=>{l(e),i(e),t(e)}),[t]),g=Ft((()=>{if(!(null==n?void 0:n())){const e=Nt(o,Q,H,W),l=Nt(e,d,c,m);s(e),i(l),t(l)}}),[n,t,d,c,m,o]);return ke("div",{className:l},r?ke("button",{className:o,onClick:g},o):null,Nt(o,ke("input",{key:o,value:d,onChange:Ft((e=>v(e[ie][de]+"",u)),[v])}),ke("input",{key:o,type:"number",value:c,onChange:Ft((e=>v(Number(e[ie][de]||0),h)),[v])}),ke("input",{key:o,type:"checkbox",checked:m,onChange:Ft((e=>v(!!e[ie].checked,p)),[v])})))},tl=e=>{var t=e,{tableId:l,store:n,editable:r,customCells:a}=t,i=At(t,["tableId","store","editable","customCells"]);return ke(Yt,$t(zt({},i),{params:Qt(Xt(s(l,n),a,r?il:I),Gt(n,l),o(l,n))}))},ll=e=>{var t=e,{tableId:l,cellId:n,descending:r,offset:o,limit:d,store:u,editable:c,sortOnClick:h,paginator:m=!1,onChange:p,customCells:v}=t,g=At(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,f,y]=Ut(n,r,h,o,d,a(l,u),m,p);return ke(Yt,$t(zt({},g),{params:Qt(Xt(s(l,u),v,c?il:I),Gt(u,l),i(l,...b,d,u),b,f,y)}))},nl=({store:e,editable:t=!1,valueComponent:l=(t?dl:u),getValueComponentProps:n,className:r,headerRow:o,idColumn:s})=>ke("table",{className:r},!1===o?null:ke("thead",null,ke("tr",null,!1===s?null:ke("th",null,"Id"),ke("th",null,oe))),ke("tbody",null,Ve(d(e),(t=>ke("tr",{key:t},!1===s?null:ke("th",null,t),ke("td",null,ke(l,$t(zt({},qe(n,t)),{valueId:t,store:e})))))))),rl=e=>{var t=e,{indexId:l,sliceId:n,indexes:r,editable:o,customCells:a}=t,i=At(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(c(r),l);return ke(Yt,$t(zt({},i),{params:Qt(Xt(s(m,u),a,o?il:I),Gt(u,m),h(l,n,d))}))},ol=({relationshipId:t,relationships:l,editable:n,customCells:r,className:s,headerRow:a,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(m(l),t),p=Xt([...Wt(c,u),...Wt(h,u)],r,n?il:I),v=Qt(i,p,c,h,t,d,u);return ke("table",{className:s},!1===a?null:ke("thead",null,ke("tr",null,!1===i?null:ke(e.Fragment,null,ke("th",null,c,".Id"),ke("th",null,h,".Id")),De(p,(({label:e},t)=>ke("th",{key:t},e))))),ke("tbody",null,Ve(o(c,u),(e=>ke(_t,{key:e,localRowId:e,params:v})))))},sl=e=>{var t=e,{queryId:l,queries:n,customCells:r}=t,o=At(t,["queryId","queries","customCells"]);return ke(Yt,$t(zt({},o),{params:Qt(Xt(v(l,n),r,w),Kt(n,l),p(l,n))}))},al=e=>{var t=e,{queryId:l,cellId:n,descending:r,offset:o,limit:s,queries:a,sortOnClick:i,paginator:d=!1,customCells:u,onChange:c}=t,h=At(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[m,p,f]=Ut(n,r,i,o,s,g(l,a),d,c);return ke(Yt,$t(zt({},h),{params:Qt(Xt(v(l,a),u,w),Kt(a,l),b(l,...m,s,a),m,p,f)}))},il=({tableId:e,rowId:l,cellId:n,store:o,className:s,showType:a})=>{var i;return ke(el,{thing:t(e,l,n,o),onThingChange:r(e,l,n,(e=>e),[],o),className:null!=s?s:Bt+ne,showType:a,hasSchema:null==(i=f(o))?void 0:i.hasTablesSchema})},dl=({valueId:e,store:t,className:r,showType:o})=>{var s;return ke(el,{thing:l(e,t),onThingChange:n(e,(e=>e),[],t),className:null!=r?r:Bt+oe,showType:o,hasSchema:null==(s=f(t))?void 0:s.hasValuesSchema})},ul=({onChange:t,total:l,offset:n=0,limit:r=l,singular:o="row",plural:s=o+"s"})=>{(n>l||n<0)&&(n=0,t(0));const a=Ht((()=>t(n-r)),[t,n,r],n>0),i=Ht((()=>t(n+r)),[t,n,r],n+r<l);return ke(e.Fragment,null,l>r&&ke(e.Fragment,null,ke("button",{className:"previous",disabled:0==n,onClick:a},"←"),ke("button",{className:"next",disabled:n+r>=l,onClick:i},"→"),n+1," to ",Math.min(l,n+r)," of "),l," ",1!=l?s:o)},cl=({indexes:e,indexesId:t,indexId:l,s:n})=>ke(Tt,{uniqueId:tt("i",t,l),summary:"Index: "+l,s:n},Ve(x(l,e),(r=>ke(hl,{indexes:e,indexesId:t,indexId:l,sliceId:r,s:n,key:r})))),hl=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:r})=>{const o=tt("i",t,l,n),[s,a]=nt(o,r);return ke(Tt,{uniqueId:o,summary:"Slice: "+n,editable:s,handleEditable:a,s:r},ke(rl,{sliceId:n,indexId:l,indexes:e,editable:s}))},ml=({indexesId:e,s:t})=>{const l=C(e),n=k(l);return pe(l)?null:ke(Tt,{uniqueId:tt("i",e),summary:"Indexes: "+(null!=e?e:U),s:t},Pe(n)?"No indexes defined":lt(n,(n=>ke(cl,{indexes:l,indexesId:e,indexId:n,s:t,key:n}))))},pl=({metrics:e,metricId:t})=>ke("tr",null,ke("th",null,t),ke("td",null,null==e?void 0:e.getTableId(t)),ke("td",null,O(t,e))),vl=({metricsId:e,s:t})=>{const l=T(e),n=S(l);return pe(l)?null:ke(Tt,{uniqueId:tt("m",e),summary:"Metrics: "+(null!=e?e:U),s:t},Pe(n)?"No metrics defined":ke("table",null,ke("thead",null,ke("th",null,"Metric Id"),ke("th",null,"Table Id"),ke("th",null,"Metric")),ke("tbody",null,Ve(n,(e=>ke(pl,{metrics:l,metricId:e,key:e}))))))},gl=({queries:e,queriesId:l,queryId:n,s:o})=>{var s;const a=tt("q",l,n),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o);return ke(Tt,{uniqueId:a,summary:"Query: "+n,s:o},ke(al,{queryId:n,queries:e,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},bl=({queriesId:e,s:t})=>{const l=q(e),n=N(l);return pe(l)?null:ke(Tt,{uniqueId:tt("q",e),summary:"Queries: "+(null!=e?e:U),s:t},Pe(n)?"No queries defined":lt(n,(n=>ke(gl,{queries:l,queriesId:e,queryId:n,s:t,key:n}))))},fl=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const r=tt("r",t,l),[o,s]=nt(r,n);return ke(Tt,{uniqueId:r,summary:"Relationship: "+l,editable:o,handleEditable:s,s:n},ke(ol,{relationshipId:l,relationships:e,editable:o}))},yl=({relationshipsId:e,s:t})=>{const l=V(e),n=P(l);return pe(l)?null:ke(Tt,{uniqueId:tt("r",e),summary:"Relationships: "+(null!=e?e:U),s:t},Pe(n)?"No relationships defined":lt(n,(n=>ke(fl,{relationships:l,relationshipsId:e,relationshipId:n,s:t,key:n}))))},Il=({tableId:e,store:l,storeId:n,s:o})=>{var s;const a=tt("t",n,e),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o),[h,m]=nt(a,o);return ke(Tt,{uniqueId:a,summary:Y+": "+e,editable:h,handleEditable:m,s:o},ke(ll,{tableId:e,store:l,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:h}))},wl=({store:e,storeId:t,s:l})=>{const n=tt("v",t),[r,o]=nt(n,l);return Pe(d(e))?null:ke(Tt,{uniqueId:n,summary:se,editable:r,handleEditable:o,s:l},ke(nl,{store:e,editable:r}))},Cl=({storeId:e,s:t})=>{const l=L(e),n=R(l);return pe(l)?null:ke(Tt,{uniqueId:tt("s",e),summary:"Store: "+(null!=e?e:U),s:t},ke(wl,{storeId:e,store:l,s:t}),lt(n,(n=>ke(Il,{store:l,storeId:e,tableId:n,s:t,key:n}))))},kl=({s:e})=>{const t=Se(null),l=Se(0),[n,r]=Oe(!1),{scrollLeft:o,scrollTop:s}=E(e);Te((()=>{const e=t.current;if(e&&!n){const t=new MutationObserver((()=>{e.scrollWidth>=ce(o)+e.clientWidth&&e.scrollHeight>=ce(s)+e.clientHeight&&e.scrollTo(o,s)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[n,o,s]);const a=xe((t=>{const{scrollLeft:n,scrollTop:o}=t[ie];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:n,scrollTop:o})}))}),[e]),i=L(),d=j(),u=T(),c=M(),h=C(),m=z(),p=V(),v=$(),g=q(),b=A();return pe(i)&&Pe(d)&&pe(u)&&Pe(c)&&pe(h)&&Pe(m)&&pe(p)&&Pe(v)&&pe(g)&&Pe(b)?ke("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):ke("article",{ref:t,onScroll:a},ke(Cl,{s:e}),Ve(d,(t=>ke(Cl,{storeId:t,s:e,key:t}))),ke(vl,{s:e}),Ve(c,(t=>ke(vl,{metricsId:t,s:e,key:t}))),ke(ml,{s:e}),Ve(m,(t=>ke(ml,{indexesId:t,s:e,key:t}))),ke(yl,{s:e}),Ve(v,(t=>ke(yl,{relationshipsId:t,s:e,key:t}))),ke(bl,{s:e}),Ve(b,(t=>ke(bl,{queriesId:t,s:e,key:t}))))};class xl extends we{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?ke("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const Tl=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!1),[],e),s=n(Ze,(e=>Number(e[ie].dataset.id)),[],e);return ke("header",null,ke("img",{title:Ge}),ke("span",null,Ge),Ve(Ke,((e,t)=>t==r?null:ke("img",{onClick:s,"data-id":t,title:"Dock to "+e,key:t}))),ke("img",{onClick:o,title:"Close"}))},Sl=({s:e})=>{var t;const n=null!=(t=l(Ze,e))?t:1;return l(_e,e)?ke("main",{"data-position":n},ke(Tl,{s:e}),ke(xl,null,ke(kl,{s:e}))):null},Ol=e=>t=>{return l=(t,l)=>t+e(l),El(t).reduce(l,0);var l},ql=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Nl=Ol(ql),Vl=Ol(Nl),Pl=Ol(Vl),Ll=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},Rl=e=>pe(e)||0==ql(e),El=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},jl=e=>e.clear(),Ml=(e,t)=>null==e?void 0:e.forEach(t),zl=(e,t)=>null==e?void 0:e.delete(t),$l=e=>new Map(e),Al=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},Fl=(e,t)=>null==e?void 0:e.get(t),Jl=(e,t)=>Ml(e,((e,l)=>t(l,e))),Dl=(e,t,l)=>pe(l)?(zl(e,t),e):null==e?void 0:e.set(t,l),Bl=(e,t,l)=>(Ll(e,t)||Dl(e,t,l()),Fl(e,t)),Wl=(e,t,l,n=Dl)=>(De(t,((t,n)=>l(e,n,t))),Jl(e,(l=>Fe(t,l)?0:n(e,l))),e),Hl=(e,t,l)=>{const n={};return Ml(e,((e,r)=>{const o=t?t(e,r):e;!(null==l?void 0:l(o,e))&&(n[r]=o)})),n},Ql=(e,t,l)=>Hl(e,(e=>Hl(e,t,l)),Be),Gl=(e,t,l)=>Hl(e,(e=>Ql(e,t,l)),Be),Kl=(e,t)=>{const l=$l();return Ml(e,((e,n)=>{var r;return l.set(n,null!=(r=null==t?void 0:t(e))?r:e)})),l},Ul=e=>Kl(e,Kl),Xl=e=>Kl(e,Ul),Yl=(e,t,l,n,r=0)=>ve((l?Bl:Fl)(e,t[r],r>Ie(t)-2?l:$l),(o=>{if(r>Ie(t)-2)return(null==n?void 0:n(o))&&Dl(e,t[r]),o;const s=Yl(o,t,l,n,r+1);return Rl(o)&&Dl(e,t[r]),s}));var Zl=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const _l=$l(),en=$l();var tn=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const ln="storage",nn=globalThis.window,rn=e=>new Set(fe(e)||pe(e)?e:[e]),on=(e,t)=>null==e?void 0:e.add(t),sn=/^\d+$/,an=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?Re(e):null)?n:B+t++},t=>{sn.test(t)&&Ie(e)<1e3&&Le(e,t)}]},dn=e=>[e,e],un=(e,t=Nl)=>t(e[0])+t(e[1]),cn=()=>[$l(),$l()],hn=e=>[...e],mn=([e,t])=>e===t,pn=(e,t,l)=>pe(e)||!$e(e)||Be(e)||Me(e)?(null==l||l(),!1):(De(e,((l,n)=>{t(l,n)||Je(e,n)})),!Be(e)),vn=(e,t,l)=>Dl(e,t,Fl(e,t)==-l?void 0:l),gn=()=>{let e,t,l=!1,n=!1,r=0;const o=$l(),s=$l(),a=$l(),i=$l(),d=$l(),u=$l(),c=$l(),h=$l(),m=$l(),p=$l(),v=$l(),g=$l(),b=$l(),f=$l(),y=rn(),I=$l(),w=$l(),C=$l(),k=$l(),x=cn(),T=cn(),S=cn(),O=cn(),q=cn(),N=cn(),V=cn(),P=cn(),L=cn(),R=cn(),E=cn(),j=cn(),M=cn(),z=cn(),$=cn(),A=$l(),F=cn(),[J,D,W,H]=(e=>{let t;const[l,n]=an(),r=$l();return[(e,n,o,s=[],a=(()=>[]))=>{null!=t||(t=At);const i=l(1);return Dl(r,i,[e,n,o,s,a]),on(Yl(n,null!=o?o:[B],rn),i),i},(e,l,...n)=>Ne(((e,t=[B])=>{const l=[],n=(e,r)=>r==Ie(t)?Le(l,e):null===t[r]?Ml(e,(e=>n(e,r+1))):Ne([t[r],null],(t=>n(Fl(e,t),r+1)));return n(e,0),l})(e,l),(e=>Ml(e,(e=>Fl(r,e)[0](t,...null!=l?l:[],...n))))),e=>ve(Fl(r,e),(([,t,l])=>(Yl(t,null!=l?l:[B],void 0,(t=>(zl(t,e),Rl(t)?1:0))),Dl(r,e),n(e),l))),e=>ve(Fl(r,e),(([e,,l=[],n,r])=>{const o=(...s)=>{var a,i;const d=Ie(s);d==Ie(l)?e(t,...s,...r(s)):pe(l[d])?Ne(null!=(i=null==(a=n[d])?void 0:a.call(n,...s))?i:[],(e=>o(...s,e))):o(...s,l[d])};o()}))]})(),G=e=>{if(!pn(e,((e,t)=>[K,U].includes(t))))return!1;const t=e[K];return!(!ge(t)&&t!=Q||(St(e[U])!=t&&Je(e,U),0))},X=(t,l)=>(!e||Ll(v,l)||et(l))&&pn(t,((e,t)=>ie(l,t,e)),(()=>et(l))),ie=(e,t,l,n)=>pn(n?l:me(l,e,t),((n,r)=>ve(de(e,t,r,n),(e=>(l[r]=e,!0)),(()=>!1))),(()=>et(e,t))),de=(t,l,n,r)=>e?ve(Fl(Fl(v,t),n),(e=>St(r)!=e[K]?et(t,l,n,r,e[U]):r),(()=>et(t,l,n,r))):pe(St(r))?et(t,l,n,r):r,ce=(e,t)=>pn(t?e:fe(e),((t,l)=>ve(he(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>tt())),he=(e,l)=>t?ve(Fl(b,e),(t=>St(l)!=t[K]?tt(e,l,t[U]):l),(()=>tt(e,l))):pe(St(l))?tt(e,l):l,me=(e,t,l)=>(ve(Fl(g,t),(([n,r])=>{Ml(n,((t,l)=>{Fe(e,l)||(e[l]=t)})),Ml(r,(n=>{Fe(e,n)||et(t,l,n)}))})),e),fe=e=>(t&&(Ml(f,((t,l)=>{Fe(e,l)||(e[l]=t)})),Ml(y,(t=>{Fe(e,t)||tt(t)}))),e),we=e=>Wl(v,e,((e,t,l)=>{const n=$l(),r=rn();Wl(Bl(v,t,$l),l,((e,t,l)=>{Dl(e,t,l),ve(l[U],(e=>Dl(n,t,e)),(()=>on(r,t)))})),Dl(g,t,[n,r])}),((e,t)=>{Dl(v,t),Dl(g,t)})),Ce=e=>Wl(b,e,((e,t,l)=>{Dl(b,t,l),ve(l[U],(e=>Dl(f,t,e)),(()=>on(y,t)))}),((e,t)=>{Dl(b,t),Dl(f,t),zl(y,t)})),ke=e=>Be(e)?Vt():Ct(e),xe=e=>Wl(C,e,((e,t,l)=>Te(t,l)),((e,t)=>$e(t))),Te=(e,t)=>Wl(Bl(C,e,(()=>(Ke(e,1),Dl(I,e,an()),Dl(w,e,$l()),$l()))),t,((t,l,n)=>Se(e,t,l,n)),((t,l)=>Ae(e,t,l))),Se=(e,t,l,n,r)=>Wl(Bl(t,l,(()=>(Ue(e,l,1),$l()))),n,((t,n,r)=>Oe(e,l,t,n,r)),((n,o)=>Qe(e,t,l,n,o,r))),Oe=(e,t,l,n,r)=>{Ll(l,n)||Xe(e,t,n,1);const o=Fl(l,n);r!==o&&(Ye(e,t,n,o,r),Dl(l,n,r))},qe=(e,t,l,n,r)=>ve(Fl(t,l),(t=>Oe(e,l,t,n,r)),(()=>Se(e,t,l,me({[n]:r},e,l)))),Pe=e=>Be(e)?Rt():kt(e),Re=e=>Wl(k,e,((e,t,l)=>Ee(t,l)),((e,t)=>Ge(t))),Ee=(e,t)=>{Ll(k,e)||Ze(e,1);const l=Fl(k,e);t!==l&&(_e(e,l,t),Dl(k,e,t))},je=(e,t)=>{const[l]=Fl(I,e),n=l(t);return Ll(Fl(C,e),n)?je(e,t):n},Me=e=>{var t;return null!=(t=Fl(C,e))?t:Te(e,{})},$e=e=>Te(e,{}),Ae=(e,t,l)=>{const[,n]=Fl(I,e);n(l),Se(e,t,l,{},!0)},Qe=(e,t,l,n,r,o)=>{var s;const a=Fl(null==(s=Fl(g,e))?void 0:s[0],r);if(!pe(a)&&!o)return Oe(e,l,n,r,a);const i=t=>{Ye(e,l,t,Fl(n,t)),Xe(e,l,t,-1),Dl(n,t)};pe(a)?i(r):Jl(n,i),Rl(n)&&(Ue(e,l,-1),Rl(Dl(t,l))&&(Ke(e,-1),Dl(C,e),Dl(I,e),Dl(w,e)))},Ge=e=>{const t=Fl(f,e);if(!pe(t))return Ee(e,t);_e(e,Fl(k,e)),Ze(e,-1),Dl(k,e)},Ke=(e,t)=>vn(o,e,t),Ue=(e,t,l)=>vn(Bl(i,e,$l),t,l)&&Dl(a,e,Bl(a,e,(()=>0))+l),Xe=(e,t,l,n)=>{var r;const o=Fl(w,e),a=null!=(r=Fl(o,l))?r:0;(0==a&&1==n||1==a&&-1==n)&&vn(Bl(s,e,$l),l,n),Dl(o,l,a!=-n?a+n:null),vn(Bl(Bl(d,e,$l),t,$l),l,n)},Ye=(e,t,l,n,r)=>Bl(Bl(Bl(u,e,$l),t,$l),l,(()=>[n,0]))[1]=r,Ze=(e,t)=>vn(c,e,t),_e=(e,t,l)=>Bl(h,e,(()=>[t,0]))[1]=l,et=(e,t,l,n,r)=>(Le(Bl(Bl(Bl(m,e,$l),t,$l),l,(()=>[])),n),r),tt=(e,t,l)=>(Le(Bl(p,e,(()=>[])),t),l),lt=(e,t,l)=>ve(Fl(Fl(Fl(u,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...dn(ft(e,t,l))])),nt=e=>ve(Fl(h,e),(([e,t])=>[!0,e,t]),(()=>[!1,...dn(wt(e))])),rt=e=>Rl(m)||Rl(E[e])?0:Ml(e?Xl(m):m,((t,l)=>Ml(t,((t,n)=>Ml(t,((t,r)=>D(E[e],[l,n,r],t))))))),ot=e=>Rl(p)||Rl(j[e])?0:Ml(e?Kl(p):p,((t,l)=>D(j[e],[l],t))),st=(e,t,l)=>{if(!Rl(t))return D(e,l,(()=>Hl(t))),1},at=e=>{const t=Rl(V[e]),l=Rl(L[e])&&Rl(O[e])&&Rl(q[e])&&Rl(N[e])&&t&&Rl(T[e]),n=Rl(R[e])&&Rl(P[e])&&Rl(S[e])&&Rl(x[e]);if(!l||!n){const r=e?[Kl(o),Ul(s),Kl(a),Ul(i),Xl(d),Xl(u)]:[o,s,a,i,d,u];if(!l){st(T[e],r[0]),Ml(r[1],((t,l)=>st(O[e],t,[l]))),Ml(r[2],((t,l)=>{0!=t&&D(q[e],[l],pt(l))}));const l=rn();Ml(r[3],((n,r)=>{st(N[e],n,[r])&&!t&&(D(V[e],[r,null]),on(l,r))})),t||Ml(r[5],((t,n)=>{if(!Ll(l,n)){const l=rn();Ml(t,(e=>Ml(e,(([t,n],r)=>n!==t?on(l,r):zl(e,r))))),Ml(l,(t=>D(V[e],[n,t])))}})),Ml(r[4],((t,l)=>Ml(t,((t,n)=>st(L[e],t,[l,n])))))}if(!n){let t;Ml(r[5],((l,n)=>{let r;Ml(l,((l,o)=>{let s;Ml(l,(([l,a],i)=>{a!==l&&(D(R[e],[n,o,i],a,l,lt),t=r=s=1)})),s&&D(P[e],[n,o],lt)})),r&&D(S[e],[n],lt)})),t&&D(x[e],void 0,lt)}}},it=e=>{const t=Rl(z[e]),l=Rl($[e])&&Rl(M[e]);if(!t||!l){const n=e?[Kl(c),Kl(h)]:[c,h];if(t||st(z[e],n[0]),!l){let t;Ml(n[1],(([l,n],r)=>{n!==l&&(D($[e],[r],n,l,nt),t=1)})),t&&D(M[e],void 0,nt)}}},dt=(e,...t)=>(Mt((()=>e(...Ve(t,ue)))),At),ut=()=>[Hl(u,((e,t)=>-1===Fl(o,t)?null:Hl(e,((e,l)=>-1===Fl(Fl(i,t),l)?null:Hl(e,(([,e])=>null!=e?e:null),((e,t)=>mn(t)))),Be)),Be),Hl(h,(([,e])=>null!=e?e:null),((e,t)=>mn(t)))],ct=()=>({cellsTouched:l,valuesTouched:n,changedCells:Gl(u,hn,mn),invalidCells:Gl(m),changedValues:Hl(h,hn,mn),invalidValues:Hl(p),changedTableIds:Hl(o),changedRowIds:Ql(i),changedCellIds:Gl(d),changedValueIds:Hl(c)}),ht=()=>Gl(C),mt=()=>Al(C),pt=e=>ql(Fl(C,ue(e))),vt=e=>Al(Fl(C,ue(e))),gt=(e,t,l,n=0,r)=>{return Ve(ye((s=Fl(C,ue(e)),a=(e,l)=>[pe(t)?l:Fl(e,ue(t)),l],o=([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(r=t)?r:0)?-1:1)*(l?-1:1);var n,r},Ve([...null!=(i=null==s?void 0:s.entries())?i:[]],(([e,t])=>a(t,e))).sort(o)),n,pe(r)?r:n+r),(([,e])=>e));var o,s,a,i},bt=(e,t)=>Al(Fl(Fl(C,ue(e)),ue(t))),ft=(e,t,l)=>Fl(Fl(Fl(C,ue(e)),ue(t)),ue(l)),yt=()=>Hl(k),It=()=>Al(k),wt=e=>Fl(k,ue(e)),Ct=e=>dt((()=>(e=>pn(e,X,et))(e)?xe(e):0)),kt=e=>dt((()=>ce(e)?Re(e):0)),xt=e=>{try{ke(He(e))}catch(e){}return At},Tt=t=>dt((()=>{if((e=pn(t,(e=>pn(e,G))))&&(we(t),!Rl(C))){const e=ht();Vt(),Ct(e)}})),Nt=e=>dt((()=>{if(t=(e=>pn(e,G))(e)){const l=yt();jt(),Rt(),t=!0,Ce(e),kt(l)}})),Vt=()=>dt((()=>xe({}))),Pt=e=>dt((e=>Ll(C,e)?$e(e):0),e),Lt=(e,t)=>dt(((e,t)=>ve(Fl(C,e),(l=>Ll(l,t)?Ae(e,l,t):0))),e,t),Rt=()=>dt((()=>Re({}))),Et=()=>dt((()=>{we({}),e=!1})),jt=()=>dt((()=>{Ce({}),t=!1})),Mt=(e,t)=>{if(-1!=r){zt();const l=e();return $t(t),l}},zt=()=>(-1!=r&&r++,1==r&&D(A,void 0,ut,ct),At),$t=e=>(r>0&&(r--,0==r&&(l=!Rl(u),n=!Rl(h),r=1,rt(1),l&&at(1),ot(1),n&&it(1),(null==e?void 0:e(ut,ct))&&(Ml(u,((e,t)=>Ml(e,((e,l)=>Ml(e,(([e],n)=>Ot(At,t,l,n,e))))))),Ml(h,(([e],t)=>qt(At,t,e))),l=n=!1),D(F[0],void 0,ut,ct),r=-1,rt(0),l&&at(0),ot(0),n&&it(0),D(F[1],void 0,ut,ct),r=0,l=n=!1,Ne([o,s,a,i,d,u,m,c,h,p],jl))),At),At={getContent:()=>[ht(),yt()],getTables:ht,getTableIds:mt,getTable:e=>Ql(Fl(C,ue(e))),getTableCellIds:e=>Al(Fl(w,ue(e))),getRowCount:pt,getRowIds:vt,getSortedRowIds:gt,getRow:(e,t)=>Hl(Fl(Fl(C,ue(e)),ue(t))),getCellIds:bt,getCell:ft,getValues:yt,getValueIds:It,getValue:wt,hasTables:()=>!Rl(C),hasTable:e=>Ll(C,ue(e)),hasTableCell:(e,t)=>Ll(Fl(w,ue(e)),ue(t)),hasRow:(e,t)=>Ll(Fl(C,ue(e)),ue(t)),hasCell:(e,t,l)=>Ll(Fl(Fl(C,ue(e)),ue(t)),ue(l)),hasValues:()=>!Rl(k),hasValue:e=>Ll(k,ue(e)),getTablesJson:()=>We(C),getValuesJson:()=>We(k),getJson:()=>We([C,k]),getTablesSchemaJson:()=>We(v),getValuesSchemaJson:()=>We(b),getSchemaJson:()=>We([v,b]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>dt((()=>{(Be(e)?Vt:Ct)(e),(Be(t)?Rt:kt)(t)})),setTables:Ct,setTable:(e,t)=>dt((e=>X(t,e)?Te(e,t):0),e),setRow:(e,t,l)=>dt(((e,t)=>ie(e,t,l)?Se(e,Me(e),t,l):0),e,t),addRow:(e,t,l=!0)=>Mt((()=>{let n;return ie(e,n,t)&&(e=ue(e),Se(e,Me(e),n=je(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>dt(((e,t)=>{if(ie(e,t,l,1)){const n=Me(e);De(l,((l,r)=>qe(e,n,t,r,l)))}}),e,t),setCell:(e,t,l,n)=>dt(((e,t,l)=>ve(de(e,t,l,be(n)?n(ft(e,t,l)):n),(n=>qe(e,Me(e),t,l,n)))),e,t,l),setValues:kt,setPartialValues:e=>dt((()=>ce(e,1)?De(e,((e,t)=>Ee(t,e))):0)),setValue:(e,t)=>dt((e=>ve(he(e,be(t)?t(wt(e)):t),(t=>Ee(e,t)))),e),setTransactionChanges:e=>dt((()=>{De(e[0],((e,t)=>pe(e)?Pt(t):De(e,((e,l)=>pe(e)?Lt(t,l):De(e,((e,n)=>Ot(At,t,l,n,e))))))),De(e[1],((e,t)=>qt(At,t,e)))})),setTablesJson:xt,setValuesJson:e=>{try{Pe(He(e))}catch(e){}return At},setJson:e=>dt((()=>{try{const[t,l]=He(e);ke(t),Pe(l)}catch(t){xt(e)}})),setTablesSchema:Tt,setValuesSchema:Nt,setSchema:(e,t)=>dt((()=>{Tt(e),Nt(t)})),delTables:Vt,delTable:Pt,delRow:Lt,delCell:(e,t,l,n)=>dt(((e,t,l)=>ve(Fl(C,e),(r=>ve(Fl(r,t),(o=>Ll(o,l)?Qe(e,r,t,o,l,n):0))))),e,t,l),delValues:Rt,delValue:e=>dt((e=>Ll(k,e)?Ge(e):0),e),delTablesSchema:Et,delValuesSchema:jt,delSchema:()=>dt((()=>{Et(),jt()})),transaction:Mt,startTransaction:zt,finishTransaction:$t,forEachTable:e=>Ml(C,((t,l)=>e(l,(e=>Ml(t,((t,l)=>e(l,(e=>Jl(t,e))))))))),forEachTableCell:(e,t)=>Jl(Fl(w,ue(e)),t),forEachRow:(e,t)=>Ml(Fl(C,ue(e)),((e,l)=>t(l,(t=>Jl(e,t))))),forEachCell:(e,t,l)=>Jl(Fl(Fl(C,ue(e)),ue(t)),l),forEachValue:e=>Jl(k,e),addSortedRowIdsListener:(e,t,l,n,r,o,s)=>{let a=gt(e,t,l,n,r);return J((()=>{const s=gt(e,t,l,n,r);var i,d,u;d=a,Ie(i=s)===Ie(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(a=s,o(At,e,t,l,n,r,a))}),V[s?1:0],[e,t],[mt])},addStartTransactionListener:e=>J(e,A),addWillFinishTransactionListener:e=>J(e,F[0]),addDidFinishTransactionListener:e=>J(e,F[1]),callListener:e=>(H(e),At),delListener:e=>(W(e),At),getListenerStats:()=>({tables:un(x),tableIds:un(T),tableCellIds:un(O),table:un(S),rowCount:un(q),rowIds:un(N),sortedRowIds:un(V),row:un(P,Vl),cellIds:un(L,Vl),cell:un(R,Pl),invalidCell:un(E,Pl),values:un(M),valueIds:un(z),value:un($),invalidValue:un(j),transaction:Nl(A)+un(F)}),createStore:gn,addListener:J,callListeners:D};return De({[Z]:[0,x],[_]:[0,T],[Y]:[1,S,[mt]],[Y+re]:[1,O,[mt]],[te]:[1,q,[mt]],[le]:[1,N,[mt]],[ee]:[2,P,[mt,vt]],[re]:[2,L,[mt,vt]],[ne]:[3,R,[mt,vt,bt],e=>dn(ft(...e))],InvalidCell:[3,E],[se]:[0,M],[ae]:[0,z],[oe]:[1,$,[It],e=>dn(wt(e[0]))],InvalidValue:[1,j]},(([e,t,l,n],r)=>{At["add"+r+"Listener"]=(...r)=>J(r[e],t[r[e+1]?1:0],e>0?ye(r,0,e):void 0,l,n)})),ze(At)},bn=({position:e="right",open:t=!1})=>{const l=F(gn),n=Ke.indexOf(e);return J(l,(e=>{return((e,t,l,n)=>((e,t,l,n,r,o,[s,a]=[],i=[])=>{let d,u,c,h=0,m=0,p=0,v=0;Bl(_l,i,(()=>0)),Bl(en,i,(()=>[]));const g=e=>Zl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield b.schedule((()=>Zl(void 0,null,(function*(){yield e(),h=0}))))),b})),b={load:(l,n)=>Zl(void 0,null,(function*(){return yield g((()=>Zl(void 0,null,(function*(){try{e.setContent(yield t())}catch(t){e.setContent([l,n])}}))))})),startAutoLoad:(...l)=>Zl(void 0,[...l],(function*(l={},r={}){return b.stopAutoLoad(),yield b.load(l,r),v=1,c=n(((l,n)=>Zl(void 0,null,(function*(){if(n){const t=n();yield g((()=>Zl(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield g((()=>Zl(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==l?void 0:l())?n:yield t())}catch(e){null==o||o(e)}}))))})))),b})),stopAutoLoad:()=>(v&&(r(c),c=void 0,v=0),b),save:t=>Zl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield b.schedule((()=>Zl(void 0,null,(function*(){try{yield l(e.getContent,t)}catch(e){null==o||o(e)}h=0}))))),b})),startAutoSave:()=>Zl(void 0,null,(function*(){return yield b.stopAutoSave().save(),d=e.addDidFinishTransactionListener(((e,t)=>{const[l,n]=t();Be(l)&&Be(n)||b.save((()=>[l,n]))})),b})),stopAutoSave:()=>(ve(d,e.delListener),d=void 0,b),schedule:(...e)=>Zl(void 0,null,(function*(){return Le(Fl(en,i),...e),yield Zl(void 0,null,(function*(){if(!Fl(_l,i)){for(Dl(_l,i,1);!pe(u=Re(Fl(en,i)));)try{yield u()}catch(e){null==o||o(e)}Dl(_l,i,0)}})),b})),getStore:()=>e,destroy:()=>b.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:m,saves:p})};return s&&(b[s]=()=>a),ze(b)})(e,(()=>tn(void 0,null,(function*(){return He(l.getItem(t))}))),(e=>tn(void 0,null,(function*(){return l.setItem(t,We(e()))}))),(e=>{const n=n=>{n.storageArea===l&&n.key===t&&e((()=>He(n.newValue)))};return nn.addEventListener(ln,n),n}),(e=>nn.removeEventListener(ln,e)),n,["getStorageName",t]))(e,Qe,sessionStorage,t);var t}),void 0,(e=>{return l=function*(){yield e.load(void 0,{position:-1==n?1:n,open:!!t}),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{o(l.next(e))}catch(e){t(e)}},r=e=>{try{o(l.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,r);o((l=l.apply(void 0,null)).next())}));var l})),ke(Ce,null,ke("aside",{id:Qe},ke(xt,{s:l}),ke(Sl,{s:l})),ke("style",null,kt))};var fn=Object.defineProperty,yn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable,Cn=(e,t,l)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;const kn=e=>ke(bn,((e,t)=>{for(var l in t||(t={}))In.call(t,l)&&Cn(e,l,t[l]);if(yn)for(var l of yn(t))wn.call(t,l)&&Cn(e,l,t[l]);return e})({},e));export{il as EditableCellView,dl as EditableValueView,ol as RelationshipInHtmlTable,al as ResultSortedTableInHtmlTable,sl as ResultTableInHtmlTable,rl as SliceInHtmlTable,ll as SortedTableInHtmlTable,ul as SortedTablePaginator,kn as StoreInspector,tl as TableInHtmlTable,nl as ValuesInHtmlTable};
Binary file
@@ -1 +1 @@
1
- import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as r,useSortedRowIds as n,useValueIds as o,ValueView as a,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as u,useResultTableCellIds as c,useResultRowCount as m,useResultSortedRowIds as h,useCell as p,useSetCellCallback as g,useStoreOrStoreById as b,useValue as f,useSetValueCallback as w,useRemoteRowId as v,CellView as y,ResultCellView as k}from"./ui-react";const C=e=>typeof e,I=C(""),x=C(!0),O=C(0),N="Value",j="currentTarget",P="value",z=isFinite,S=e=>null==e,{PureComponent:T,Fragment:M,createElement:$,useCallback:q,useLayoutEffect:F,useRef:R,useState:E}=e,D=(e,...t)=>S(e)?{}:e(...t),V=(e,t)=>e.map(t),A=Object,B=(e=[])=>A.fromEntries(e),L=(e,t)=>V(A.entries(e),(([e,l])=>t(l,e))),G="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",H='content:url("',J=H+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",K='</svg>")',Q=H+"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\")",U=V([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,r])=>J+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+K)),W=J+"<path d='M20 20l60 60M20 80l60-60' />"+K,X=J+`<path d='${G}' />`+K,Y=J+`<path d='${G}M20 20l60 60' />`+K;var Z=Object.defineProperty,_=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,ne=(e,t,l)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,oe=(e,t)=>{for(var l in t||(t={}))le.call(t,l)&&ne(e,l,t[l]);if(te)for(var l of te(t))re.call(t,l)&&ne(e,l,t[l]);return e},ae=(e,t)=>_(e,ee(t));const ie="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(L(ae(oe(ae(oe(ae(oe({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[ie]:"width:0.5rem;height:0.5rem;",[ie+"-track"]:"background:#111",[ie+"-thumb"]:"background:#999;border:1px solid #111",[ie+"-thumb:hover"]:"background:#fff",[ie+"-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;"+Q},B(V(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),B(V(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Q,"header>img:nth-of-type(6)":W}),B(V(U,((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":X,"details[open]>summary img.done":Y,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`& ${t}{${e}}`:"")));const se=(e,t,l,r)=>e==I?t:e==O?l:r;var de=Object.defineProperty,ue=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,ge=(e,t,l)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,be=(e,t)=>{for(var l in t||(t={}))he.call(t,l)&&ge(e,l,t[l]);if(me)for(var l of me(t))pe.call(t,l)&&ge(e,l,t[l]);return e},fe=(e,t)=>ue(e,ce(t)),we=(e,t)=>{var l={};for(var r in e)he.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&me)for(var r of me(e))t.indexOf(r)<0&&pe.call(e,r)&&(l[r]=e[r]);return l};const{useCallback:ve,useMemo:ye,useState:ke}=e,Ce="editable",Ie=(e,t)=>V(l(e,t),(t=>e+"."+t)),xe=(e,t,l)=>{const r=ve(e,t);return l?r:void 0},Oe=(...e)=>ye((()=>e),e),Ne=(e,t)=>ye((()=>({store:e,tableId:t})),[e,t]),je=(e,t)=>ye((()=>({queries:e,queryId:t})),[e,t]),Pe=(e,t=!1,l,r=0,n,o,a,i)=>{const[[s,d,u],c]=ke([e,t,r]),m=ve((e=>{c(e),null==i||i(e)}),[i]),h=xe((e=>m([e,e==s&&!d,u])),[m,s,d,u],l),p=ve((e=>m([s,d,e])),[m,s,d]),g=!0===a?Ge:a;return[[s,d,u],h,ye((()=>!1===a?null:$(g,{offset:u,limit:n,total:o,onChange:p})),[a,g,u,n,o,p])]},ze=(e,t,l)=>ye((()=>{const r=null!=t?t:e;return B(L(Array.isArray(r)?B(V(r,(e=>[e,e]))):r,((e,t)=>{return[t,be(be({},{label:t,component:l}),(r=e,C(r)==I?{label:e}:e))];var r})))}),[t,l,e]),Se=({className:e,headerRow:t,idColumn:l,params:[r,n,o,a,i,s]})=>$("table",{className:e},s?$("caption",null,s):null,!1===t?null:$("thead",null,$("tr",null,!1===l?null:$(Te,{sort:null!=a?a:[],label:"Id",onClick:i}),L(r,(({label:e},t)=>$(Te,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:i}))))),$("tbody",null,V(o,(e=>$("tr",{key:e},!1===l?null:$("th",null,e),L(r,(({component:t,getComponentProps:l},r)=>$("td",{key:r},$(t,fe(be(be({},D(l,e,r)),n),{rowId:e,cellId:r})))))))))),Te=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:n})=>$("th",{onClick:xe((()=>null==n?void 0:n(e)),[n,e],n),className:S(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},S(l)||t!=e?null:(l?"↓":"↑")+" ",r),Me=({localRowId:t,params:[l,r,n,o,a,i,s]})=>{const d=v(a,t,i);return $("tr",null,!1===l?null:$(e.Fragment,null,$("th",null,t),$("th",null,d)),L(r,(({component:e,getComponentProps:l},r)=>{const[a,i]=r.split(".",2),u=a===n?t:a===o?d:null;return S(u)?null:$("td",{key:r},$(e,fe(be({},D(l,u,i)),{store:s,tableId:a,rowId:u,cellId:i})))})))},$e=({thing:e,onThingChange:t,className:l,hasSchema:r,showType:n=!0})=>{const[o,a]=ke(),[i,s]=ke(),[d,u]=ke(),[c,m]=ke(),[h,p]=ke();i!==e&&(a((e=>{const t=C(e);return(e=>e==I||e==x)(t)||t==O&&z(e)?t:void 0})(e)),s(e),u(e+""),m(Number(e)||0),p(!!e));const g=ve(((e,l)=>{l(e),s(e),t(e)}),[t]),b=ve((()=>{if(!(null==r?void 0:r())){const e=se(o,O,x,I),l=se(e,d,c,h);a(e),s(l),t(l)}}),[r,t,d,c,h,o]);return $("div",{className:l},n?$("button",{className:o,onClick:b},o):null,se(o,$("input",{key:o,value:d,onChange:ve((e=>g(e[j][P]+"",u)),[g])}),$("input",{key:o,type:"number",value:c,onChange:ve((e=>g(Number(e[j][P]||0),m)),[g])}),$("input",{key:o,type:"checkbox",checked:h,onChange:ve((e=>g(!!e[j].checked,p)),[g])})))},qe=e=>{var r=e,{tableId:n,store:o,editable:a,customCells:i}=r,s=we(r,["tableId","store","editable","customCells"]);return $(Se,fe(be({},s),{params:Oe(ze(l(n,o),i,a?Be:y),Ne(o,n),t(n,o))}))},Fe=e=>{var t=e,{tableId:o,cellId:a,descending:i,offset:s,limit:d,store:u,editable:c,sortOnClick:m,paginator:h=!1,onChange:p,customCells:g}=t,b=we(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[f,w,v]=Pe(a,i,m,s,d,r(o,u),h,p);return $(Se,fe(be({},b),{params:Oe(ze(l(o,u),g,c?Be:y),Ne(u,o),n(o,...f,d,u),f,w,v)}))},Re=({store:e,editable:t=!1,valueComponent:l=(t?Le:a),getValueComponentProps:r,className:n,headerRow:i,idColumn:s})=>$("table",{className:n},!1===i?null:$("thead",null,$("tr",null,!1===s?null:$("th",null,"Id"),$("th",null,N))),$("tbody",null,V(o(e),(t=>$("tr",{key:t},!1===s?null:$("th",null,t),$("td",null,$(l,fe(be({},D(r,t)),{valueId:t,store:e})))))))),Ee=e=>{var t=e,{indexId:r,sliceId:n,indexes:o,editable:a,customCells:d}=t,u=we(t,["indexId","sliceId","indexes","editable","customCells"]);const[c,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(i(o),r);return $(Se,fe(be({},u),{params:Oe(ze(l(h,m),d,a?Be:y),Ne(m,h),s(r,n,c))}))},De=({relationshipId:l,relationships:r,editable:n,customCells:o,className:a,headerRow:i,idColumn:s=!0})=>{const[u,c,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(d(r),l),p=ze([...Ie(m,c),...Ie(h,c)],o,n?Be:y),g=Oe(s,p,m,h,l,u,c);return $("table",{className:a},!1===i?null:$("thead",null,$("tr",null,!1===s?null:$(e.Fragment,null,$("th",null,m,".Id"),$("th",null,h,".Id")),L(p,(({label:e},t)=>$("th",{key:t},e))))),$("tbody",null,V(t(m,c),(e=>$(Me,{key:e,localRowId:e,params:g})))))},Ve=e=>{var t=e,{queryId:l,queries:r,customCells:n}=t,o=we(t,["queryId","queries","customCells"]);return $(Se,fe(be({},o),{params:Oe(ze(c(l,r),n,k),je(r,l),u(l,r))}))},Ae=e=>{var t=e,{queryId:l,cellId:r,descending:n,offset:o,limit:a,queries:i,sortOnClick:s,paginator:d=!1,customCells:u,onChange:p}=t,g=we(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,f,w]=Pe(r,n,s,o,a,m(l,i),d,p);return $(Se,fe(be({},g),{params:Oe(ze(c(l,i),u,k),je(i,l),h(l,...b,a,i),b,f,w)}))},Be=({tableId:e,rowId:t,cellId:l,store:r,className:n,showType:o})=>{var a;return $($e,{thing:p(e,t,l,r),onThingChange:g(e,t,l,(e=>e),[],r),className:null!=n?n:Ce+"Cell",showType:o,hasSchema:null==(a=b(r))?void 0:a.hasTablesSchema})},Le=({valueId:e,store:t,className:l,showType:r})=>{var n;return $($e,{thing:f(e,t),onThingChange:w(e,(e=>e),[],t),className:null!=l?l:Ce+N,showType:r,hasSchema:null==(n=b(t))?void 0:n.hasValuesSchema})},Ge=({onChange:t,total:l,offset:r=0,limit:n=l,singular:o="row",plural:a=o+"s"})=>{(r>l||r<0)&&(r=0,t(0));const i=xe((()=>t(r-n)),[t,r,n],r>0),s=xe((()=>t(r+n)),[t,r,n],r+n<l);return $(e.Fragment,null,l>n&&$(e.Fragment,null,$("button",{className:"previous",disabled:0==r,onClick:i},"←"),$("button",{className:"next",disabled:r+n>=l,onClick:s},"→"),r+1," to ",Math.min(l,r+n)," of "),l," ",1!=l?a:o)};(class extends T{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}render(){return this.state.e?$("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}).getDerivedStateFromError=()=>({e:1});const He=e=>new Map(e);He(),He();const Je=e=>null;export{Be as EditableCellView,Le as EditableValueView,De as RelationshipInHtmlTable,Ae as ResultSortedTableInHtmlTable,Ve as ResultTableInHtmlTable,Ee as SliceInHtmlTable,Fe as SortedTableInHtmlTable,Ge as SortedTablePaginator,Je as StoreInspector,qe as TableInHtmlTable,Re as ValuesInHtmlTable};
1
+ import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as r,useSortedRowIds as n,useValueIds as o,ValueView as a,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as u,useResultTableCellIds as c,useResultRowCount as m,useResultSortedRowIds as h,useCell as p,useSetCellCallback as g,useStoreOrStoreById as b,useValue as f,useSetValueCallback as w,useRemoteRowId as v,CellView as y,ResultCellView as k}from"./ui-react";const C=e=>typeof e,I=C(""),x=C(!0),O=C(0),N="Value",z="currentTarget",j="value",P=isFinite,$=e=>null==e,{PureComponent:T,Fragment:M,createElement:S,useCallback:q,useLayoutEffect:R,useRef:F,useState:E}=e,V=(e,...t)=>$(e)?{}:e(...t),A=(e,t)=>e.map(t),B=Object,D=(e=[])=>B.fromEntries(e),L=(e,t)=>A(B.entries(e),(([e,l])=>t(l,e))),G="tinybaseStoreInspector",H="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",J='content:url("',K=J+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Q='</svg>")',U=J+"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\")",W=A([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,r])=>K+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+Q)),X=K+"<path d='M20 20l60 60M20 80l60-60' />"+Q,Y=K+`<path d='${H}' />`+Q,Z=K+`<path d='${H}M20 20l60 60' />`+Q;var _=Object.defineProperty,ee=Object.defineProperties,te=Object.getOwnPropertyDescriptors,le=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,oe=(e,t,l)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,ae=(e,t)=>{for(var l in t||(t={}))re.call(t,l)&&oe(e,l,t[l]);if(le)for(var l of le(t))ne.call(t,l)&&oe(e,l,t[l]);return e},ie=(e,t)=>ee(e,te(t));const se="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(L(ie(ae(ie(ae(ie(ae({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[se]:"width:0.5rem;height:0.5rem;",[se+"-track"]:"background:#111",[se+"-thumb"]:"background:#999;border:1px solid #111",[se+"-thumb:hover"]:"background:#fff",[se+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+U},D(A(["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;"}),D(A(["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)":U,"header>img:nth-of-type(6)":X}),D(A(W,((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":Y,"details[open]>summary img.done":Z,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${G} 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?`#${G} ${t}{${e}}`:"")));const de=(e,t,l,r)=>e==I?t:e==O?l:r;var ue=Object.defineProperty,ce=Object.defineProperties,me=Object.getOwnPropertyDescriptors,he=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,be=(e,t,l)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,fe=(e,t)=>{for(var l in t||(t={}))pe.call(t,l)&&be(e,l,t[l]);if(he)for(var l of he(t))ge.call(t,l)&&be(e,l,t[l]);return e},we=(e,t)=>ce(e,me(t)),ve=(e,t)=>{var l={};for(var r in e)pe.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&he)for(var r of he(e))t.indexOf(r)<0&&ge.call(e,r)&&(l[r]=e[r]);return l};const{useCallback:ye,useMemo:ke,useState:Ce}=e,Ie="editable",xe=(e,t)=>A(l(e,t),(t=>e+"."+t)),Oe=(e,t,l)=>{const r=ye(e,t);return l?r:void 0},Ne=(...e)=>ke((()=>e),e),ze=(e,t)=>ke((()=>({store:e,tableId:t})),[e,t]),je=(e,t)=>ke((()=>({queries:e,queryId:t})),[e,t]),Pe=(e,t=!1,l,r=0,n,o,a,i)=>{const[[s,d,u],c]=Ce([e,t,r]),m=ye((e=>{c(e),null==i||i(e)}),[i]),h=Oe((e=>m([e,e==s&&!d,u])),[m,s,d,u],l),p=ye((e=>m([s,d,e])),[m,s,d]),g=!0===a?He:a;return[[s,d,u],h,ke((()=>!1===a?null:S(g,{offset:u,limit:n,total:o,onChange:p})),[a,g,u,n,o,p])]},$e=(e,t,l)=>ke((()=>{const r=null!=t?t:e;return D(L(Array.isArray(r)?D(A(r,(e=>[e,e]))):r,((e,t)=>{return[t,fe(fe({},{label:t,component:l}),(r=e,C(r)==I?{label:e}:e))];var r})))}),[t,l,e]),Te=({className:e,headerRow:t,idColumn:l,params:[r,n,o,a,i,s]})=>S("table",{className:e},s?S("caption",null,s):null,!1===t?null:S("thead",null,S("tr",null,!1===l?null:S(Me,{sort:null!=a?a:[],label:"Id",onClick:i}),L(r,(({label:e},t)=>S(Me,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:i}))))),S("tbody",null,A(o,(e=>S("tr",{key:e},!1===l?null:S("th",null,e),L(r,(({component:t,getComponentProps:l},r)=>S("td",{key:r},S(t,we(fe(fe({},V(l,e,r)),n),{rowId:e,cellId:r})))))))))),Me=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:n})=>S("th",{onClick:Oe((()=>null==n?void 0:n(e)),[n,e],n),className:$(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},$(l)||t!=e?null:(l?"↓":"↑")+" ",r),Se=({localRowId:t,params:[l,r,n,o,a,i,s]})=>{const d=v(a,t,i);return S("tr",null,!1===l?null:S(e.Fragment,null,S("th",null,t),S("th",null,d)),L(r,(({component:e,getComponentProps:l},r)=>{const[a,i]=r.split(".",2),u=a===n?t:a===o?d:null;return $(u)?null:S("td",{key:r},S(e,we(fe({},V(l,u,i)),{store:s,tableId:a,rowId:u,cellId:i})))})))},qe=({thing:e,onThingChange:t,className:l,hasSchema:r,showType:n=!0})=>{const[o,a]=Ce(),[i,s]=Ce(),[d,u]=Ce(),[c,m]=Ce(),[h,p]=Ce();i!==e&&(a((e=>{const t=C(e);return(e=>e==I||e==x)(t)||t==O&&P(e)?t:void 0})(e)),s(e),u(e+""),m(Number(e)||0),p(!!e));const g=ye(((e,l)=>{l(e),s(e),t(e)}),[t]),b=ye((()=>{if(!(null==r?void 0:r())){const e=de(o,O,x,I),l=de(e,d,c,h);a(e),s(l),t(l)}}),[r,t,d,c,h,o]);return S("div",{className:l},n?S("button",{className:o,onClick:b},o):null,de(o,S("input",{key:o,value:d,onChange:ye((e=>g(e[z][j]+"",u)),[g])}),S("input",{key:o,type:"number",value:c,onChange:ye((e=>g(Number(e[z][j]||0),m)),[g])}),S("input",{key:o,type:"checkbox",checked:h,onChange:ye((e=>g(!!e[z].checked,p)),[g])})))},Re=e=>{var r=e,{tableId:n,store:o,editable:a,customCells:i}=r,s=ve(r,["tableId","store","editable","customCells"]);return S(Te,we(fe({},s),{params:Ne($e(l(n,o),i,a?Le:y),ze(o,n),t(n,o))}))},Fe=e=>{var t=e,{tableId:o,cellId:a,descending:i,offset:s,limit:d,store:u,editable:c,sortOnClick:m,paginator:h=!1,onChange:p,customCells:g}=t,b=ve(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[f,w,v]=Pe(a,i,m,s,d,r(o,u),h,p);return S(Te,we(fe({},b),{params:Ne($e(l(o,u),g,c?Le:y),ze(u,o),n(o,...f,d,u),f,w,v)}))},Ee=({store:e,editable:t=!1,valueComponent:l=(t?Ge:a),getValueComponentProps:r,className:n,headerRow:i,idColumn:s})=>S("table",{className:n},!1===i?null:S("thead",null,S("tr",null,!1===s?null:S("th",null,"Id"),S("th",null,N))),S("tbody",null,A(o(e),(t=>S("tr",{key:t},!1===s?null:S("th",null,t),S("td",null,S(l,we(fe({},V(r,t)),{valueId:t,store:e})))))))),Ve=e=>{var t=e,{indexId:r,sliceId:n,indexes:o,editable:a,customCells:d}=t,u=ve(t,["indexId","sliceId","indexes","editable","customCells"]);const[c,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(i(o),r);return S(Te,we(fe({},u),{params:Ne($e(l(h,m),d,a?Le:y),ze(m,h),s(r,n,c))}))},Ae=({relationshipId:l,relationships:r,editable:n,customCells:o,className:a,headerRow:i,idColumn:s=!0})=>{const[u,c,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(d(r),l),p=$e([...xe(m,c),...xe(h,c)],o,n?Le:y),g=Ne(s,p,m,h,l,u,c);return S("table",{className:a},!1===i?null:S("thead",null,S("tr",null,!1===s?null:S(e.Fragment,null,S("th",null,m,".Id"),S("th",null,h,".Id")),L(p,(({label:e},t)=>S("th",{key:t},e))))),S("tbody",null,A(t(m,c),(e=>S(Se,{key:e,localRowId:e,params:g})))))},Be=e=>{var t=e,{queryId:l,queries:r,customCells:n}=t,o=ve(t,["queryId","queries","customCells"]);return S(Te,we(fe({},o),{params:Ne($e(c(l,r),n,k),je(r,l),u(l,r))}))},De=e=>{var t=e,{queryId:l,cellId:r,descending:n,offset:o,limit:a,queries:i,sortOnClick:s,paginator:d=!1,customCells:u,onChange:p}=t,g=ve(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,f,w]=Pe(r,n,s,o,a,m(l,i),d,p);return S(Te,we(fe({},g),{params:Ne($e(c(l,i),u,k),je(i,l),h(l,...b,a,i),b,f,w)}))},Le=({tableId:e,rowId:t,cellId:l,store:r,className:n,showType:o})=>{var a;return S(qe,{thing:p(e,t,l,r),onThingChange:g(e,t,l,(e=>e),[],r),className:null!=n?n:Ie+"Cell",showType:o,hasSchema:null==(a=b(r))?void 0:a.hasTablesSchema})},Ge=({valueId:e,store:t,className:l,showType:r})=>{var n;return S(qe,{thing:f(e,t),onThingChange:w(e,(e=>e),[],t),className:null!=l?l:Ie+N,showType:r,hasSchema:null==(n=b(t))?void 0:n.hasValuesSchema})},He=({onChange:t,total:l,offset:r=0,limit:n=l,singular:o="row",plural:a=o+"s"})=>{(r>l||r<0)&&(r=0,t(0));const i=Oe((()=>t(r-n)),[t,r,n],r>0),s=Oe((()=>t(r+n)),[t,r,n],r+n<l);return S(e.Fragment,null,l>n&&S(e.Fragment,null,S("button",{className:"previous",disabled:0==r,onClick:i},"←"),S("button",{className:"next",disabled:r+n>=l,onClick:s},"→"),r+1," to ",Math.min(l,r+n)," of "),l," ",1!=l?a:o)},Je=e=>new Map(e);Je(),Je();const Ke=e=>null;export{Le as EditableCellView,Ge as EditableValueView,Ae as RelationshipInHtmlTable,De as ResultSortedTableInHtmlTable,Be as ResultTableInHtmlTable,Ve as SliceInHtmlTable,Fe as SortedTableInHtmlTable,He as SortedTablePaginator,Ke as StoreInspector,Re as TableInHtmlTable,Ee as ValuesInHtmlTable};
Binary file
@@ -1 +1 @@
1
- import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as a,useSortedRowIds as n,useValueIds as o,ValueView as r,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as m,useResultTableCellIds as h,useResultRowCount as c,useResultSortedRowIds as u,useCell as g,useSetCellCallback as p,useStoreOrStoreById as b,useValue as f,useSetValueCallback as w,useRemoteRowId as y,CellView as k,ResultCellView as v}from"./ui-react";const C=e=>typeof e,x=C(""),I=C(!0),N=C(0),z="Value",T="currentTarget",M="value",$=isFinite,S=e=>null==e,{PureComponent:F,Fragment:R,createElement:q,useCallback:E,useLayoutEffect:P,useRef:O,useState:V}=e,j=(e,...t)=>S(e)?{}:e(...t),A=(e,t)=>e.map(t),B=Object,D=(e=[])=>B.fromEntries(e),L=(e,t)=>A(B.entries(e),(([e,l])=>t(l,e))),G="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",H='content:url("',J=H+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",K='</svg>")',Q=H+"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\")",U=A([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,a])=>J+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${a}' fill='white'/>`+K)),W=J+"<path d='M20 20l60 60M20 80l60-60' />"+K,X=J+`<path d='${G}' />`+K,Y=J+`<path d='${G}M20 20l60 60' />`+K,Z="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(L({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Z]:"width:0.5rem;height:0.5rem;",[Z+"-track"]:"background:#111",[Z+"-thumb"]:"background:#999;border:1px solid #111",[Z+"-thumb:hover"]:"background:#fff",[Z+"-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;"+Q,...D(A(["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;",...D(A(["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)":Q,"header>img:nth-of-type(6)":W,...D(A(U,((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":X,"details[open]>summary img.done":Y,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"},((e,t)=>e?`& ${t}{${e}}`:"")));const _=(e,t,l,a)=>e==x?t:e==N?l:a,{useCallback:ee,useMemo:te,useState:le}=e,ae="editable",ne=(e,t)=>A(l(e,t),(t=>e+"."+t)),oe=(e,t,l)=>{const a=ee(e,t);return l?a:void 0},re=(...e)=>te((()=>e),e),ie=(e,t)=>te((()=>({store:e,tableId:t})),[e,t]),se=(e,t)=>te((()=>({queries:e,queryId:t})),[e,t]),de=(e,t=!1,l,a=0,n,o,r,i)=>{const[[s,d,m],h]=le([e,t,a]),c=ee((e=>{h(e),i?.(e)}),[i]),u=oe((e=>c([e,e==s&&!d,m])),[c,s,d,m],l),g=ee((e=>c([s,d,e])),[c,s,d]),p=!0===r?Ie:r;return[[s,d,m],u,te((()=>!1===r?null:q(p,{offset:m,limit:n,total:o,onChange:g})),[r,p,m,n,o,g])]},me=(e,t,l)=>te((()=>{const a=t??e;return D(L(Array.isArray(a)?D(A(a,(e=>[e,e]))):a,((e,t)=>{return[t,{label:t,component:l,...(a=e,C(a)==x?{label:e}:e)}];var a})))}),[t,l,e]),he=({className:e,headerRow:t,idColumn:l,params:[a,n,o,r,i,s]})=>q("table",{className:e},s?q("caption",null,s):null,!1===t?null:q("thead",null,q("tr",null,!1===l?null:q(ce,{sort:r??[],label:"Id",onClick:i}),L(a,(({label:e},t)=>q(ce,{key:t,cellId:t,label:e,sort:r??[],onClick:i}))))),q("tbody",null,A(o,(e=>q("tr",{key:e},!1===l?null:q("th",null,e),L(a,(({component:t,getComponentProps:l},a)=>q("td",{key:a},q(t,{...j(l,e,a),...n,rowId:e,cellId:a}))))))))),ce=({cellId:e,sort:[t,l],label:a=e??"",onClick:n})=>q("th",{onClick:oe((()=>n?.(e)),[n,e],n),className:S(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},S(l)||t!=e?null:(l?"↓":"↑")+" ",a),ue=({localRowId:t,params:[l,a,n,o,r,i,s]})=>{const d=y(r,t,i);return q("tr",null,!1===l?null:q(e.Fragment,null,q("th",null,t),q("th",null,d)),L(a,(({component:e,getComponentProps:l},a)=>{const[r,i]=a.split(".",2),m=r===n?t:r===o?d:null;return S(m)?null:q("td",{key:a},q(e,{...j(l,m,i),store:s,tableId:r,rowId:m,cellId:i}))})))},ge=({thing:e,onThingChange:t,className:l,hasSchema:a,showType:n=!0})=>{const[o,r]=le(),[i,s]=le(),[d,m]=le(),[h,c]=le(),[u,g]=le();i!==e&&(r((e=>{const t=C(e);return(e=>e==x||e==I)(t)||t==N&&$(e)?t:void 0})(e)),s(e),m(e+""),c(Number(e)||0),g(!!e));const p=ee(((e,l)=>{l(e),s(e),t(e)}),[t]),b=ee((()=>{if(!a?.()){const e=_(o,N,I,x),l=_(e,d,h,u);r(e),s(l),t(l)}}),[a,t,d,h,u,o]);return q("div",{className:l},n?q("button",{className:o,onClick:b},o):null,_(o,q("input",{key:o,value:d,onChange:ee((e=>p(e[T][M]+"",m)),[p])}),q("input",{key:o,type:"number",value:h,onChange:ee((e=>p(Number(e[T][M]||0),c)),[p])}),q("input",{key:o,type:"checkbox",checked:u,onChange:ee((e=>p(!!e[T].checked,g)),[p])})))},pe=({tableId:e,store:a,editable:n,customCells:o,...r})=>q(he,{...r,params:re(me(l(e,a),o,n?Ce:k),ie(a,e),t(e,a))}),be=({tableId:e,cellId:t,descending:o,offset:r,limit:i,store:s,editable:d,sortOnClick:m,paginator:h=!1,onChange:c,customCells:u,...g})=>{const[p,b,f]=de(t,o,m,r,i,a(e,s),h,c);return q(he,{...g,params:re(me(l(e,s),u,d?Ce:k),ie(s,e),n(e,...p,i,s),p,b,f)})},fe=({store:e,editable:t=!1,valueComponent:l=(t?xe:r),getValueComponentProps:a,className:n,headerRow:i,idColumn:s})=>q("table",{className:n},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q("th",null,"Id"),q("th",null,z))),q("tbody",null,A(o(e),(t=>q("tr",{key:t},!1===s?null:q("th",null,t),q("td",null,q(l,{...j(a,t),valueId:t,store:e}))))))),we=({indexId:e,sliceId:t,indexes:a,editable:n,customCells:o,...r})=>{const[d,m,h]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(i(a),e);return q(he,{...r,params:re(me(l(h,m),o,n?Ce:k),ie(m,h),s(e,t,d))})},ye=({relationshipId:l,relationships:a,editable:n,customCells:o,className:r,headerRow:i,idColumn:s=!0})=>{const[m,h,c,u]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(d(a),l),g=me([...ne(c,h),...ne(u,h)],o,n?Ce:k),p=re(s,g,c,u,l,m,h);return q("table",{className:r},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q(e.Fragment,null,q("th",null,c,".Id"),q("th",null,u,".Id")),L(g,(({label:e},t)=>q("th",{key:t},e))))),q("tbody",null,A(t(c,h),(e=>q(ue,{key:e,localRowId:e,params:p})))))},ke=({queryId:e,queries:t,customCells:l,...a})=>q(he,{...a,params:re(me(h(e,t),l,v),se(t,e),m(e,t))}),ve=({queryId:e,cellId:t,descending:l,offset:a,limit:n,queries:o,sortOnClick:r,paginator:i=!1,customCells:s,onChange:d,...m})=>{const[g,p,b]=de(t,l,r,a,n,c(e,o),i,d);return q(he,{...m,params:re(me(h(e,o),s,v),se(o,e),u(e,...g,n,o),g,p,b)})},Ce=({tableId:e,rowId:t,cellId:l,store:a,className:n,showType:o})=>q(ge,{thing:g(e,t,l,a),onThingChange:p(e,t,l,(e=>e),[],a),className:n??ae+"Cell",showType:o,hasSchema:b(a)?.hasTablesSchema}),xe=({valueId:e,store:t,className:l,showType:a})=>q(ge,{thing:f(e,t),onThingChange:w(e,(e=>e),[],t),className:l??ae+z,showType:a,hasSchema:b(t)?.hasValuesSchema}),Ie=({onChange:t,total:l,offset:a=0,limit:n=l,singular:o="row",plural:r=o+"s"})=>{(a>l||a<0)&&(a=0,t(0));const i=oe((()=>t(a-n)),[t,a,n],a>0),s=oe((()=>t(a+n)),[t,a,n],a+n<l);return q(e.Fragment,null,l>n&&q(e.Fragment,null,q("button",{className:"previous",disabled:0==a,onClick:i},"←"),q("button",{className:"next",disabled:a+n>=l,onClick:s},"→"),a+1," to ",Math.min(l,a+n)," of "),l," ",1!=l?r:o)};class Ne extends F{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}static{this.getDerivedStateFromError=()=>({e:1})}render(){return this.state.e?q("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const ze=e=>new Map(e);ze(),ze();const Te=e=>null;export{Ce as EditableCellView,xe as EditableValueView,ye as RelationshipInHtmlTable,ve as ResultSortedTableInHtmlTable,ke as ResultTableInHtmlTable,we as SliceInHtmlTable,be as SortedTableInHtmlTable,Ie as SortedTablePaginator,Te as StoreInspector,pe as TableInHtmlTable,fe as ValuesInHtmlTable};
1
+ import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as a,useSortedRowIds as n,useValueIds as o,ValueView as r,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as m,useResultTableCellIds as h,useResultRowCount as u,useResultSortedRowIds as c,useCell as g,useSetCellCallback as p,useStoreOrStoreById as b,useValue as f,useSetValueCallback as w,useRemoteRowId as y,CellView as k,ResultCellView as v}from"./ui-react";const C=e=>typeof e,x=C(""),I=C(!0),N=C(0),z="Value",$="currentTarget",T="value",M=isFinite,S=e=>null==e,{PureComponent:R,Fragment:q,createElement:F,useCallback:P,useLayoutEffect:E,useRef:O,useState:V}=e,j=(e,...t)=>S(e)?{}:e(...t),A=(e,t)=>e.map(t),B=Object,L=(e=[])=>B.fromEntries(e),D=(e,t)=>A(B.entries(e),(([e,l])=>t(l,e))),G="tinybaseStoreInspector",H="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",J='content:url("',K=J+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Q='</svg>")',U=J+"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\")",W=A([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,a])=>K+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${a}' fill='white'/>`+Q)),X=K+"<path d='M20 20l60 60M20 80l60-60' />"+Q,Y=K+`<path d='${H}' />`+Q,Z=K+`<path d='${H}M20 20l60 60' />`+Q,_="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(D({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[_]:"width:0.5rem;height:0.5rem;",[_+"-track"]:"background:#111",[_+"-thumb"]:"background:#999;border:1px solid #111",[_+"-thumb:hover"]:"background:#fff",[_+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+U,...L(A(["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;",...L(A(["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)":U,"header>img:nth-of-type(6)":X,...L(A(W,((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":Y,"details[open]>summary img.done":Z,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${G} 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?`#${G} ${t}{${e}}`:"")));const ee=(e,t,l,a)=>e==x?t:e==N?l:a,{useCallback:te,useMemo:le,useState:ae}=e,ne="editable",oe=(e,t)=>A(l(e,t),(t=>e+"."+t)),re=(e,t,l)=>{const a=te(e,t);return l?a:void 0},ie=(...e)=>le((()=>e),e),se=(e,t)=>le((()=>({store:e,tableId:t})),[e,t]),de=(e,t)=>le((()=>({queries:e,queryId:t})),[e,t]),me=(e,t=!1,l,a=0,n,o,r,i)=>{const[[s,d,m],h]=ae([e,t,a]),u=te((e=>{h(e),i?.(e)}),[i]),c=re((e=>u([e,e==s&&!d,m])),[u,s,d,m],l),g=te((e=>u([s,d,e])),[u,s,d]),p=!0===r?Ne:r;return[[s,d,m],c,le((()=>!1===r?null:F(p,{offset:m,limit:n,total:o,onChange:g})),[r,p,m,n,o,g])]},he=(e,t,l)=>le((()=>{const a=t??e;return L(D(Array.isArray(a)?L(A(a,(e=>[e,e]))):a,((e,t)=>{return[t,{label:t,component:l,...(a=e,C(a)==x?{label:e}:e)}];var a})))}),[t,l,e]),ue=({className:e,headerRow:t,idColumn:l,params:[a,n,o,r,i,s]})=>F("table",{className:e},s?F("caption",null,s):null,!1===t?null:F("thead",null,F("tr",null,!1===l?null:F(ce,{sort:r??[],label:"Id",onClick:i}),D(a,(({label:e},t)=>F(ce,{key:t,cellId:t,label:e,sort:r??[],onClick:i}))))),F("tbody",null,A(o,(e=>F("tr",{key:e},!1===l?null:F("th",null,e),D(a,(({component:t,getComponentProps:l},a)=>F("td",{key:a},F(t,{...j(l,e,a),...n,rowId:e,cellId:a}))))))))),ce=({cellId:e,sort:[t,l],label:a=e??"",onClick:n})=>F("th",{onClick:re((()=>n?.(e)),[n,e],n),className:S(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},S(l)||t!=e?null:(l?"↓":"↑")+" ",a),ge=({localRowId:t,params:[l,a,n,o,r,i,s]})=>{const d=y(r,t,i);return F("tr",null,!1===l?null:F(e.Fragment,null,F("th",null,t),F("th",null,d)),D(a,(({component:e,getComponentProps:l},a)=>{const[r,i]=a.split(".",2),m=r===n?t:r===o?d:null;return S(m)?null:F("td",{key:a},F(e,{...j(l,m,i),store:s,tableId:r,rowId:m,cellId:i}))})))},pe=({thing:e,onThingChange:t,className:l,hasSchema:a,showType:n=!0})=>{const[o,r]=ae(),[i,s]=ae(),[d,m]=ae(),[h,u]=ae(),[c,g]=ae();i!==e&&(r((e=>{const t=C(e);return(e=>e==x||e==I)(t)||t==N&&M(e)?t:void 0})(e)),s(e),m(e+""),u(Number(e)||0),g(!!e));const p=te(((e,l)=>{l(e),s(e),t(e)}),[t]),b=te((()=>{if(!a?.()){const e=ee(o,N,I,x),l=ee(e,d,h,c);r(e),s(l),t(l)}}),[a,t,d,h,c,o]);return F("div",{className:l},n?F("button",{className:o,onClick:b},o):null,ee(o,F("input",{key:o,value:d,onChange:te((e=>p(e[$][T]+"",m)),[p])}),F("input",{key:o,type:"number",value:h,onChange:te((e=>p(Number(e[$][T]||0),u)),[p])}),F("input",{key:o,type:"checkbox",checked:c,onChange:te((e=>p(!!e[$].checked,g)),[p])})))},be=({tableId:e,store:a,editable:n,customCells:o,...r})=>F(ue,{...r,params:ie(he(l(e,a),o,n?xe:k),se(a,e),t(e,a))}),fe=({tableId:e,cellId:t,descending:o,offset:r,limit:i,store:s,editable:d,sortOnClick:m,paginator:h=!1,onChange:u,customCells:c,...g})=>{const[p,b,f]=me(t,o,m,r,i,a(e,s),h,u);return F(ue,{...g,params:ie(he(l(e,s),c,d?xe:k),se(s,e),n(e,...p,i,s),p,b,f)})},we=({store:e,editable:t=!1,valueComponent:l=(t?Ie:r),getValueComponentProps:a,className:n,headerRow:i,idColumn:s})=>F("table",{className:n},!1===i?null:F("thead",null,F("tr",null,!1===s?null:F("th",null,"Id"),F("th",null,z))),F("tbody",null,A(o(e),(t=>F("tr",{key:t},!1===s?null:F("th",null,t),F("td",null,F(l,{...j(a,t),valueId:t,store:e}))))))),ye=({indexId:e,sliceId:t,indexes:a,editable:n,customCells:o,...r})=>{const[d,m,h]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(i(a),e);return F(ue,{...r,params:ie(he(l(h,m),o,n?xe:k),se(m,h),s(e,t,d))})},ke=({relationshipId:l,relationships:a,editable:n,customCells:o,className:r,headerRow:i,idColumn:s=!0})=>{const[m,h,u,c]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(d(a),l),g=he([...oe(u,h),...oe(c,h)],o,n?xe:k),p=ie(s,g,u,c,l,m,h);return F("table",{className:r},!1===i?null:F("thead",null,F("tr",null,!1===s?null:F(e.Fragment,null,F("th",null,u,".Id"),F("th",null,c,".Id")),D(g,(({label:e},t)=>F("th",{key:t},e))))),F("tbody",null,A(t(u,h),(e=>F(ge,{key:e,localRowId:e,params:p})))))},ve=({queryId:e,queries:t,customCells:l,...a})=>F(ue,{...a,params:ie(he(h(e,t),l,v),de(t,e),m(e,t))}),Ce=({queryId:e,cellId:t,descending:l,offset:a,limit:n,queries:o,sortOnClick:r,paginator:i=!1,customCells:s,onChange:d,...m})=>{const[g,p,b]=me(t,l,r,a,n,u(e,o),i,d);return F(ue,{...m,params:ie(he(h(e,o),s,v),de(o,e),c(e,...g,n,o),g,p,b)})},xe=({tableId:e,rowId:t,cellId:l,store:a,className:n,showType:o})=>F(pe,{thing:g(e,t,l,a),onThingChange:p(e,t,l,(e=>e),[],a),className:n??ne+"Cell",showType:o,hasSchema:b(a)?.hasTablesSchema}),Ie=({valueId:e,store:t,className:l,showType:a})=>F(pe,{thing:f(e,t),onThingChange:w(e,(e=>e),[],t),className:l??ne+z,showType:a,hasSchema:b(t)?.hasValuesSchema}),Ne=({onChange:t,total:l,offset:a=0,limit:n=l,singular:o="row",plural:r=o+"s"})=>{(a>l||a<0)&&(a=0,t(0));const i=re((()=>t(a-n)),[t,a,n],a>0),s=re((()=>t(a+n)),[t,a,n],a+n<l);return F(e.Fragment,null,l>n&&F(e.Fragment,null,F("button",{className:"previous",disabled:0==a,onClick:i},"←"),F("button",{className:"next",disabled:a+n>=l,onClick:s},"→"),a+1," to ",Math.min(l,a+n)," of "),l," ",1!=l?r:o)},ze=e=>new Map(e);ze(),ze();const $e=e=>null;export{xe as EditableCellView,Ie as EditableValueView,ke as RelationshipInHtmlTable,Ce as ResultSortedTableInHtmlTable,ve as ResultTableInHtmlTable,ye as SliceInHtmlTable,fe as SortedTableInHtmlTable,Ne as SortedTablePaginator,$e as StoreInspector,be as TableInHtmlTable,we as ValuesInHtmlTable};
Binary file