@lunora/studio 1.0.0-alpha.120 → 1.0.0-alpha.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/packem_chunks/ApiTab.js +1 -1
  3. package/dist/packem_shared/{ApiReferencePanel-DXrGI45U.js → ApiReferencePanel-CZDVN7zg.js} +1 -1
  4. package/dist/packem_shared/{OpenRpcReferencePanel-DkYBLJGb.js → OpenRpcReferencePanel-XoYdKuMg.js} +1 -1
  5. package/dist/packem_shared/reference-view-DY3CaRxH.js +13 -0
  6. package/dist/standalone/{chunk-QXLU6YPU.js → chunk-2AJMY73I.js} +1 -1
  7. package/dist/standalone/{chunk-D3ZLKFO4.js → chunk-2EWSVBWG.js} +1 -1
  8. package/dist/standalone/{chunk-2VLBFSIX.js → chunk-2FFV3NB7.js} +1 -1
  9. package/dist/standalone/{chunk-BKW7FMAU.js → chunk-2HW5M4MK.js} +1 -1
  10. package/dist/standalone/{chunk-6KJLNWPJ.js → chunk-33TNFS73.js} +1 -1
  11. package/dist/standalone/{chunk-WFABZPAK.js → chunk-3K4F3B56.js} +1 -1
  12. package/dist/standalone/{chunk-4DJQV5UA.js → chunk-3WFIPW6W.js} +1 -1
  13. package/dist/standalone/{chunk-2RASQG3R.js → chunk-4HWTEDVV.js} +1 -1
  14. package/dist/standalone/{chunk-T5SC5RAD.js → chunk-4O7MEQMU.js} +1 -1
  15. package/dist/standalone/{chunk-L6ATKZKO.js → chunk-5DEXJ766.js} +1 -1
  16. package/dist/standalone/{chunk-TCKQ4E5Y.js → chunk-5VKIJNHE.js} +1 -1
  17. package/dist/standalone/{chunk-XUX7B54Z.js → chunk-7EOXUWAI.js} +1 -1
  18. package/dist/standalone/{chunk-5COHJLQF.js → chunk-7MO56FXL.js} +1 -1
  19. package/dist/standalone/{chunk-PRWFHSHC.js → chunk-AVBUV42G.js} +1 -1
  20. package/dist/standalone/{chunk-6QKKYBML.js → chunk-B6YM5NAF.js} +1 -1
  21. package/dist/standalone/{chunk-W3PCX3TU.js → chunk-DXXXNZ3P.js} +1 -1
  22. package/dist/standalone/{chunk-DYKGLIBC.js → chunk-E4RVRJHD.js} +1 -1
  23. package/dist/standalone/{chunk-ATGYWQUI.js → chunk-EIWXXEVA.js} +1 -1
  24. package/dist/standalone/{chunk-J2GQE4PW.js → chunk-FKXX3Y2J.js} +1 -1
  25. package/dist/standalone/{chunk-JIPVSPSG.js → chunk-FS7FGJOU.js} +1 -1
  26. package/dist/standalone/{chunk-P4QIDUCY.js → chunk-GDC3W3DZ.js} +1 -1
  27. package/dist/standalone/{chunk-2F6FYL5O.js → chunk-GISVVEPU.js} +1 -1
  28. package/dist/standalone/{chunk-RSG2DVHH.js → chunk-GNN5HJ56.js} +1 -1
  29. package/dist/standalone/{chunk-YN2KHW3B.js → chunk-ICQTVV6U.js} +1 -1
  30. package/dist/standalone/{chunk-B3BKR5ZW.js → chunk-JCSDJBBZ.js} +1 -1
  31. package/dist/standalone/{chunk-RK5XWYUL.js → chunk-K3SXMDKL.js} +1 -1
  32. package/dist/standalone/{chunk-KWGHNORP.js → chunk-KJNDUIZG.js} +1 -1
  33. package/dist/standalone/{chunk-PS66CRK5.js → chunk-KNI5YDPT.js} +1 -1
  34. package/dist/standalone/{chunk-BYJZGWWY.js → chunk-KR6SZXOI.js} +1 -1
  35. package/dist/standalone/{chunk-VDSFYFDH.js → chunk-KTEVBZIV.js} +1 -1
  36. package/dist/standalone/{chunk-P54YTPHL.js → chunk-MHB2TOAK.js} +1 -1
  37. package/dist/standalone/{chunk-XFU6YBYL.js → chunk-MTGEDJQH.js} +1 -1
  38. package/dist/standalone/{chunk-A44VDLY3.js → chunk-N7PPYEHW.js} +1 -1
  39. package/dist/standalone/{chunk-YTYRZTG6.js → chunk-NIUA7EHL.js} +1 -1
  40. package/dist/standalone/{chunk-GTEXP4P3.js → chunk-O4RQGUJ7.js} +1 -1
  41. package/dist/standalone/{chunk-WYSR5F77.js → chunk-OCZ2IP5A.js} +1 -1
  42. package/dist/standalone/{chunk-GK2UBSBQ.js → chunk-PAJQOSEU.js} +1 -1
  43. package/dist/standalone/{chunk-D52S7TOI.js → chunk-PGTCEMBA.js} +1 -1
  44. package/dist/standalone/{chunk-WIFYD4A6.js → chunk-POD66K2Y.js} +1 -1
  45. package/dist/standalone/{chunk-KPQROFH5.js → chunk-QBONDY5I.js} +1 -1
  46. package/dist/standalone/{chunk-2QLWSNDL.js → chunk-R7EV3YND.js} +1 -1
  47. package/dist/standalone/{chunk-G3NGXYJY.js → chunk-RAFPVMXJ.js} +1 -1
  48. package/dist/standalone/{chunk-QLG2EJU3.js → chunk-SQSMHFA7.js} +1 -1
  49. package/dist/standalone/{chunk-5JF2HAU4.js → chunk-TCAX32PK.js} +1 -1
  50. package/dist/standalone/{chunk-27IF4PXG.js → chunk-TDH7K7E7.js} +1 -1
  51. package/dist/standalone/{chunk-5HICO276.js → chunk-THTL2KBP.js} +1 -1
  52. package/dist/standalone/{chunk-R3G55P4J.js → chunk-TI5RJJRX.js} +1 -1
  53. package/dist/standalone/{chunk-QDGAB4R2.js → chunk-TKKRBSUB.js} +1 -1
  54. package/dist/standalone/{chunk-QKN5EHEF.js → chunk-U2FRMJAN.js} +1 -1
  55. package/dist/standalone/{chunk-6J5TEYI5.js → chunk-U32MMDFO.js} +1 -1
  56. package/dist/standalone/chunk-UDCFI5NF.js +14 -0
  57. package/dist/standalone/{chunk-XRC7KEEN.js → chunk-UFUOW6UJ.js} +1 -1
  58. package/dist/standalone/{chunk-4PVSXT34.js → chunk-VJQAOU2U.js} +1 -1
  59. package/dist/standalone/{chunk-4LVLLM6B.js → chunk-VTFMI4DC.js} +1 -1
  60. package/dist/standalone/{chunk-4Y2QHI65.js → chunk-XYWLXNTV.js} +1 -1
  61. package/dist/standalone/{chunk-R52YOHVU.js → chunk-ZWATJNSU.js} +1 -1
  62. package/dist/standalone/studio.js +1 -1
  63. package/package.json +3 -3
  64. package/dist/packem_shared/reference-view-CxW7paCK.js +0 -12
  65. package/dist/standalone/chunk-XTNSQYXW.js +0 -13
@@ -1 +1 @@
1
- import{a as D}from"./chunk-E6P2ERQV.js";import{b as C}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import"./chunk-F7JOSNAT.js";import{a as L}from"./chunk-DZGOHOOE.js";import{c as $}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as I}from"./chunk-UANVABQG.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-L4EZAHCD.js";import{a as b,e as S}from"./chunk-IYWVSMAY.js";import{d as w}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as f,d as y,f as _,g as j}from"./chunk-R5ZTCHCE.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=w(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=$(L.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(I,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(b,{className:"overflow-hidden py-0",children:(0,t.jsx)(S,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(C,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};
1
+ import{a as D}from"./chunk-E6P2ERQV.js";import{b as C}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import"./chunk-F7JOSNAT.js";import{a as L}from"./chunk-DZGOHOOE.js";import{c as $}from"./chunk-5DEXJ766.js";import"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as I}from"./chunk-UANVABQG.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-L4EZAHCD.js";import{a as b,e as S}from"./chunk-IYWVSMAY.js";import{d as w}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as f,d as y,f as _,g as j}from"./chunk-R5ZTCHCE.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=w(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=$(L.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(I,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(b,{className:"overflow-hidden py-0",children:(0,t.jsx)(S,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(C,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};
@@ -1 +1 @@
1
- import{b as y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as R}from"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as v}from"./chunk-DZGOHOOE.js";import{c as $}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as S}from"./chunk-UANVABQG.js";import{a as A,b as C,c as I,d as x,e as c,f as n}from"./chunk-L4EZAHCD.js";import{a as k,e as w}from"./chunk-IYWVSMAY.js";import{d as N}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as f,d as b,f as E,g as O}from"./chunk-R5ZTCHCE.js";var j=b(E(),1);var r=b(O(),1);var _=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"I"),T={delete:2,list:3,read:0,write:1},B=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||T[t.on]-T[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"O"),q=f(()=>{let e=(0,j.c)(14),t=N(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=B(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(C,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(c,{children:t("Bucket")}),(0,r.jsx)(c,{children:t("Operation")}),(0,r.jsx)(c,{children:t("Key prefix")}),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(I,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(n,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(n,{children:(0,r.jsx)(y,{variant:"secondary",children:_(t,s.on)})}),(0,r.jsx)(n,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(n,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"M");export{q as default};
1
+ import{b as y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as R}from"./chunk-JCSDJBBZ.js";import"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as v}from"./chunk-DZGOHOOE.js";import{c as $}from"./chunk-5DEXJ766.js";import"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as S}from"./chunk-UANVABQG.js";import{a as A,b as C,c as I,d as x,e as c,f as n}from"./chunk-L4EZAHCD.js";import{a as k,e as w}from"./chunk-IYWVSMAY.js";import{d as N}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as f,d as b,f as E,g as O}from"./chunk-R5ZTCHCE.js";var j=b(E(),1);var r=b(O(),1);var _=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"I"),T={delete:2,list:3,read:0,write:1},B=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||T[t.on]-T[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"O"),q=f(()=>{let e=(0,j.c)(14),t=N(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=B(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(C,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(c,{children:t("Bucket")}),(0,r.jsx)(c,{children:t("Operation")}),(0,r.jsx)(c,{children:t("Key prefix")}),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(I,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(n,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(n,{children:(0,r.jsx)(y,{variant:"secondary",children:_(t,s.on)})}),(0,r.jsx)(n,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(n,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"M");export{q as default};
@@ -1 +1 @@
1
- import{a as Z}from"./chunk-2EJQ7SPV.js";import{a as W}from"./chunk-CKTKI4IY.js";import{a as V}from"./chunk-6UN4V2HB.js";import{b as G}from"./chunk-KVSQKUWD.js";import{a as Q}from"./chunk-TNKECJW4.js";import{e as U}from"./chunk-4YTSKL4R.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{b as ee,c as te}from"./chunk-5QAT5NQ4.js";import{a as q,b as Y}from"./chunk-27IF4PXG.js";import{a as z}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as $}from"./chunk-DZGOHOOE.js";import{c as C}from"./chunk-L6ATKZKO.js";import{f as P}from"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import"./chunk-L4EZAHCD.js";import"./chunk-IYWVSMAY.js";import{d as A,f as H,g as K,o as k,r as M}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as l,d as _,e as he,f as me,g as pe}from"./chunk-R5ZTCHCE.js";var F=_(me(),1);var u=_(he(),1);var I=_(pe(),1);var be=l(t=>{let{suggestedIndex:e,table:r}=t;return!(typeof r!="string"||r.length===0||typeof e!="object"||e===null||!Array.isArray(e.fields)||e.fields.length===0)},"xe"),ge=l((t,e,r)=>{let n=M(t),a=M(e),o=r.map(c=>M(c)).join(", ");return`CREATE INDEX IF NOT EXISTS ${a} ON ${n} (${o});`},"ye"),ve=l(t=>{let e=(0,F.c)(19),{fields:r,indexName:n,table:a,testId:o}=t,c=A(),[T,p]=(0,u.useState)(!1),f;e[0]!==r||e[1]!==n||e[2]!==a?(f=l(()=>{let S="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if(S===void 0)return;let x=ge(a,n,r);k(S.writeText(x)),p(!0)},"u"),e[0]=r,e[1]=n,e[2]=a,e[3]=f):f=e[3];let v=f;if(T){let S=`${o}-applied`,x;e[4]!==c?(x=c("CREATE INDEX SQL copied to clipboard."),e[4]=c,e[5]=x):x=e[5];let E;return e[6]!==S||e[7]!==x?(E=(0,I.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":S,children:x}),e[6]=S,e[7]=x,e[8]=E):E=e[8],E}let w;e[9]!==c?(w=c("Apply?"),e[9]=c,e[10]=w):w=e[10];let h;e[11]!==c||e[12]!==a?(h=c("Apply index on {table}",{table:a}),e[11]=c,e[12]=a,e[13]=h):h=e[13];let y;return e[14]!==v||e[15]!==w||e[16]!==h||e[17]!==o?(y=(0,I.jsx)(Z,{confirmLabel:w,onConfirm:v,testId:o,children:h}),e[14]=v,e[15]=w,e[16]=h,e[17]=o,e[18]=y):y=e[18],y},"ve"),ye=l((t,e)=>{let r=new Map;for(let n of e){let a=`${n.table} ${n.index}`;r.set(a,(r.get(a)??0)+n.reads)}return t.map(n=>({index:n.index,reads:r.get(`${n.table} ${n.index}`)??0,table:n.table}))},"Se"),xe=l(t=>{let e=new Map;for(let r of t)for(let n of r.scannedTables??[])e.set(n.table,(e.get(n.table)??0)+n.scans);return[...e].map(([r,n])=>({scans:n,table:r}))},"Te"),ne=l((t,e)=>e.map(r=>({index:r.name,table:t})),"X"),we=l(t=>{let e=ye(t.declaredIndexes??[],t.indexHits??[]),r=xe(t.functions??[]),n=t.shardTraffic??[],a=t.analyticsMetrics,o=a&&a.indexHits.length>0?a.indexHits:e,c=a&&a.tableScans.length>0?a.tableScans:r,T=a&&a.shardTraffic.length>0?a.shardTraffic:n,p=te({indexHits:o,schema:{tables:[]},shardTraffic:T,tableScans:c},{lints:ee,source:"runtime"}),f=t.suppressHotScanTables;return(f===void 0?p:p.filter(v=>!(v.metadata.kind==="hot_scan"&&typeof v.metadata.table=="string"&&f.has(v.metadata.table)))).map(v=>q(v))},"ge"),Se=H($.listTables),Te=H($.listTableIndexes),Ie=H($.listTablesIndexes),j=l(t=>`${(t*100).toFixed(1)}%`,"H"),ae=l(t=>`${(t/1e3).toFixed(2)}s`,"P"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ee"),Ee=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function")})[e.kind],"$e"),re=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:j(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:j(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:j(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:ae(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:ae(e.value)})})[e.kind],"V"),Ne=l(t=>{let e=(0,F.c)(10),{onJump:r,table:n}=t,a=A(),o;e[0]!==r||e[1]!==n?(o=l(()=>{r(n)},"i"),e[0]=r,e[1]=n,e[2]=o):o=e[2];let c=o,T=`in-add-index-${n}`,p;e[3]!==a||e[4]!==n?(p=a("Add index on {table}",{table:n}),e[3]=a,e[4]=n,e[5]=p):p=e[5];let f;return e[6]!==c||e[7]!==T||e[8]!==p?(f=(0,I.jsx)(z,{"data-testid":T,onClick:c,size:"sm",type:"button",variant:"outline",children:p}),e[6]=c,e[7]=T,e[8]=p,e[9]=f):f=e[9],f},"Ne"),De=l(({initialShardKey:t,loadShardTraffic:e})=>{let r=P(),n=U(),a=A(),{queryShardKey:o,setShardKey:c,shardKey:T}=W(t),[p,f]=(0,u.useState)(null),[v,w]=(0,u.useState)(null),h=(0,u.useRef)(""),y=C($.getMetrics,{},{live:!0,shardKey:o}),S=C($.getFunctionStats,{},{live:!0,shardKey:o}),x=C($.getAdvisories,{},{live:!0,shardKey:o}),E=y.data??null,O=S.data?.functions??null,R=x.data?.advisories??null,se=y.data?.indexHits??null,B=y.error!==null&&S.error!==null?y.error:null,ie=e??(s=>r.shardTraffic(s)),oe=l(async(s,b)=>{let i=s[0];if(i===void 0||i===""){h.current===b&&w(null);return}try{let m=await ie(i);if(h.current!==b)return;let d=new Map;for(let g of m.shards)d.has(g.shardKey)||d.set(g.shardKey,{requests:g.requests,shardKey:g.shardKey});w([...d.values()])}catch{h.current===b&&w(null)}},"W"),le=l(async(s,b)=>{let i=await Promise.allSettled(s.map(async d=>[d,await r.query(Te,{table:d},K(b))])),m=[];for(let d of i)if(d.status==="fulfilled"){let[g,N]=d.value;m.push(...ne(g,N.indexes))}return m},"Y"),D=(0,u.useEffectEvent)(async s=>{h.current=s;let b=[];try{let i=await r.query(Se,{},K(s));if(h.current!==s)return;G(s),b=i.map(d=>d.name);let m=[];if(b.length>0)try{let d=await r.query(Ie,{tables:b},K(s));if(h.current!==s)return;for(let[g,N]of Object.entries(d.indexesByTable))m.push(...ne(g,N))}catch{if(m=await le(b,s),h.current!==s)return}f(m)}catch{h.current===s&&f(null)}await oe(b,s)});(0,u.useEffect)(()=>{k(D(o))},[o]);let ce=(0,u.useEffectEvent)(()=>{y.refetch(),S.refetch(),x.refetch(),k(D(o))});(0,u.useEffect)(()=>{let s=l(()=>{document.visibilityState==="visible"&&ce()},"a");return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s)}},[]);let J=(0,u.useCallback)(s=>{k(n({search:{table:s},to:"/schema"}))},[n]),L=Q(E,O),de=new Set(L.filter(s=>s.kind==="missing-index").flatMap(s=>s.tables??[])),X=we({declaredIndexes:p??[],functions:O,indexHits:se,shardTraffic:v,suppressHotScanTables:de}),ue=(0,u.useMemo)(()=>{let s=L.map(i=>{let m=i.kind==="missing-index"?i.tables??[]:[];return{action:m.length>0?m.map(d=>(0,I.jsx)(Ne,{onJump:J,table:d},d)):void 0,description:i.message===void 0?re(a,i):`${re(a,i)} \u2014 ${i.message}`,entity:i.fn,issueType:Ee(a,i),key:`${i.kind}:${i.fn??""}`,level:i.severity}}),b=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(R??[]).map(i=>{let m=q(i);if(b.has(i.name)&&be(i.metadata)){let{table:d,suggestedIndex:g}=i.metadata,N=`in-apply-index-${d}-${g.name}`;return{...m,action:(0,I.jsx)(ve,{fields:g.fields,indexName:g.name,table:d,testId:N})}}return m}),...X,...s]},[R,L,J,X,a]),fe=(0,I.jsx)(V,{onChange:c,testId:"in-shard-input",value:T});return(0,I.jsx)(Y,{error:B,errorSource:B===null?void 0:y.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Je");export{De as InsightsPanel};
1
+ import{a as Z}from"./chunk-2EJQ7SPV.js";import{a as W}from"./chunk-CKTKI4IY.js";import{a as V}from"./chunk-6UN4V2HB.js";import{b as G}from"./chunk-KVSQKUWD.js";import{a as Q}from"./chunk-TNKECJW4.js";import{e as U}from"./chunk-4YTSKL4R.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{b as ee,c as te}from"./chunk-5QAT5NQ4.js";import{a as q,b as Y}from"./chunk-TDH7K7E7.js";import{a as z}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import"./chunk-JCSDJBBZ.js";import"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as $}from"./chunk-DZGOHOOE.js";import{c as C}from"./chunk-5DEXJ766.js";import{f as P}from"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import"./chunk-L4EZAHCD.js";import"./chunk-IYWVSMAY.js";import{d as A,f as H,g as K,o as k,r as M}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as l,d as _,e as he,f as me,g as pe}from"./chunk-R5ZTCHCE.js";var F=_(me(),1);var u=_(he(),1);var I=_(pe(),1);var be=l(t=>{let{suggestedIndex:e,table:r}=t;return!(typeof r!="string"||r.length===0||typeof e!="object"||e===null||!Array.isArray(e.fields)||e.fields.length===0)},"xe"),ge=l((t,e,r)=>{let n=M(t),a=M(e),o=r.map(c=>M(c)).join(", ");return`CREATE INDEX IF NOT EXISTS ${a} ON ${n} (${o});`},"ye"),ve=l(t=>{let e=(0,F.c)(19),{fields:r,indexName:n,table:a,testId:o}=t,c=A(),[T,p]=(0,u.useState)(!1),f;e[0]!==r||e[1]!==n||e[2]!==a?(f=l(()=>{let S="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if(S===void 0)return;let x=ge(a,n,r);k(S.writeText(x)),p(!0)},"u"),e[0]=r,e[1]=n,e[2]=a,e[3]=f):f=e[3];let v=f;if(T){let S=`${o}-applied`,x;e[4]!==c?(x=c("CREATE INDEX SQL copied to clipboard."),e[4]=c,e[5]=x):x=e[5];let E;return e[6]!==S||e[7]!==x?(E=(0,I.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":S,children:x}),e[6]=S,e[7]=x,e[8]=E):E=e[8],E}let w;e[9]!==c?(w=c("Apply?"),e[9]=c,e[10]=w):w=e[10];let h;e[11]!==c||e[12]!==a?(h=c("Apply index on {table}",{table:a}),e[11]=c,e[12]=a,e[13]=h):h=e[13];let y;return e[14]!==v||e[15]!==w||e[16]!==h||e[17]!==o?(y=(0,I.jsx)(Z,{confirmLabel:w,onConfirm:v,testId:o,children:h}),e[14]=v,e[15]=w,e[16]=h,e[17]=o,e[18]=y):y=e[18],y},"ve"),ye=l((t,e)=>{let r=new Map;for(let n of e){let a=`${n.table} ${n.index}`;r.set(a,(r.get(a)??0)+n.reads)}return t.map(n=>({index:n.index,reads:r.get(`${n.table} ${n.index}`)??0,table:n.table}))},"Se"),xe=l(t=>{let e=new Map;for(let r of t)for(let n of r.scannedTables??[])e.set(n.table,(e.get(n.table)??0)+n.scans);return[...e].map(([r,n])=>({scans:n,table:r}))},"Te"),ne=l((t,e)=>e.map(r=>({index:r.name,table:t})),"X"),we=l(t=>{let e=ye(t.declaredIndexes??[],t.indexHits??[]),r=xe(t.functions??[]),n=t.shardTraffic??[],a=t.analyticsMetrics,o=a&&a.indexHits.length>0?a.indexHits:e,c=a&&a.tableScans.length>0?a.tableScans:r,T=a&&a.shardTraffic.length>0?a.shardTraffic:n,p=te({indexHits:o,schema:{tables:[]},shardTraffic:T,tableScans:c},{lints:ee,source:"runtime"}),f=t.suppressHotScanTables;return(f===void 0?p:p.filter(v=>!(v.metadata.kind==="hot_scan"&&typeof v.metadata.table=="string"&&f.has(v.metadata.table)))).map(v=>q(v))},"ge"),Se=H($.listTables),Te=H($.listTableIndexes),Ie=H($.listTablesIndexes),j=l(t=>`${(t*100).toFixed(1)}%`,"H"),ae=l(t=>`${(t/1e3).toFixed(2)}s`,"P"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ee"),Ee=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function")})[e.kind],"$e"),re=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:j(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:j(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:j(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:ae(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:ae(e.value)})})[e.kind],"V"),Ne=l(t=>{let e=(0,F.c)(10),{onJump:r,table:n}=t,a=A(),o;e[0]!==r||e[1]!==n?(o=l(()=>{r(n)},"i"),e[0]=r,e[1]=n,e[2]=o):o=e[2];let c=o,T=`in-add-index-${n}`,p;e[3]!==a||e[4]!==n?(p=a("Add index on {table}",{table:n}),e[3]=a,e[4]=n,e[5]=p):p=e[5];let f;return e[6]!==c||e[7]!==T||e[8]!==p?(f=(0,I.jsx)(z,{"data-testid":T,onClick:c,size:"sm",type:"button",variant:"outline",children:p}),e[6]=c,e[7]=T,e[8]=p,e[9]=f):f=e[9],f},"Ne"),De=l(({initialShardKey:t,loadShardTraffic:e})=>{let r=P(),n=U(),a=A(),{queryShardKey:o,setShardKey:c,shardKey:T}=W(t),[p,f]=(0,u.useState)(null),[v,w]=(0,u.useState)(null),h=(0,u.useRef)(""),y=C($.getMetrics,{},{live:!0,shardKey:o}),S=C($.getFunctionStats,{},{live:!0,shardKey:o}),x=C($.getAdvisories,{},{live:!0,shardKey:o}),E=y.data??null,O=S.data?.functions??null,R=x.data?.advisories??null,se=y.data?.indexHits??null,B=y.error!==null&&S.error!==null?y.error:null,ie=e??(s=>r.shardTraffic(s)),oe=l(async(s,b)=>{let i=s[0];if(i===void 0||i===""){h.current===b&&w(null);return}try{let m=await ie(i);if(h.current!==b)return;let d=new Map;for(let g of m.shards)d.has(g.shardKey)||d.set(g.shardKey,{requests:g.requests,shardKey:g.shardKey});w([...d.values()])}catch{h.current===b&&w(null)}},"W"),le=l(async(s,b)=>{let i=await Promise.allSettled(s.map(async d=>[d,await r.query(Te,{table:d},K(b))])),m=[];for(let d of i)if(d.status==="fulfilled"){let[g,N]=d.value;m.push(...ne(g,N.indexes))}return m},"Y"),D=(0,u.useEffectEvent)(async s=>{h.current=s;let b=[];try{let i=await r.query(Se,{},K(s));if(h.current!==s)return;G(s),b=i.map(d=>d.name);let m=[];if(b.length>0)try{let d=await r.query(Ie,{tables:b},K(s));if(h.current!==s)return;for(let[g,N]of Object.entries(d.indexesByTable))m.push(...ne(g,N))}catch{if(m=await le(b,s),h.current!==s)return}f(m)}catch{h.current===s&&f(null)}await oe(b,s)});(0,u.useEffect)(()=>{k(D(o))},[o]);let ce=(0,u.useEffectEvent)(()=>{y.refetch(),S.refetch(),x.refetch(),k(D(o))});(0,u.useEffect)(()=>{let s=l(()=>{document.visibilityState==="visible"&&ce()},"a");return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s)}},[]);let J=(0,u.useCallback)(s=>{k(n({search:{table:s},to:"/schema"}))},[n]),L=Q(E,O),de=new Set(L.filter(s=>s.kind==="missing-index").flatMap(s=>s.tables??[])),X=we({declaredIndexes:p??[],functions:O,indexHits:se,shardTraffic:v,suppressHotScanTables:de}),ue=(0,u.useMemo)(()=>{let s=L.map(i=>{let m=i.kind==="missing-index"?i.tables??[]:[];return{action:m.length>0?m.map(d=>(0,I.jsx)(Ne,{onJump:J,table:d},d)):void 0,description:i.message===void 0?re(a,i):`${re(a,i)} \u2014 ${i.message}`,entity:i.fn,issueType:Ee(a,i),key:`${i.kind}:${i.fn??""}`,level:i.severity}}),b=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(R??[]).map(i=>{let m=q(i);if(b.has(i.name)&&be(i.metadata)){let{table:d,suggestedIndex:g}=i.metadata,N=`in-apply-index-${d}-${g.name}`;return{...m,action:(0,I.jsx)(ve,{fields:g.fields,indexName:g.name,table:d,testId:N})}}return m}),...X,...s]},[R,L,J,X,a]),fe=(0,I.jsx)(V,{onChange:c,testId:"in-shard-input",value:T});return(0,I.jsx)(Y,{error:B,errorSource:B===null?void 0:y.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Je");export{De as InsightsPanel};
@@ -1 +1 @@
1
- import{a as s}from"./chunk-L6ATKZKO.js";import{a as n}from"./chunk-R5ZTCHCE.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
1
+ import{a as s}from"./chunk-5DEXJ766.js";import{a as n}from"./chunk-R5ZTCHCE.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
@@ -1 +1 @@
1
- import{a as W}from"./chunk-WUW4ZHRL.js";import{a as D}from"./chunk-CKTKI4IY.js";import{a as B}from"./chunk-6UN4V2HB.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-XQS7KSHL.js";import{b as S}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as F}from"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as _}from"./chunk-DZGOHOOE.js";import{c as E}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as j}from"./chunk-UANVABQG.js";import{a as L,b as O,c as P,d as C,e as h,f as p}from"./chunk-L4EZAHCD.js";import{a as T,e as $}from"./chunk-IYWVSMAY.js";import{d as M}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as N,d as A,f as H,g as J}from"./chunk-R5ZTCHCE.js";var R=A(H(),1);var t=A(J(),1);var q=80,U=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>q?`${e.slice(0,q)}\u2026`:e},"q"),Z=N(a=>{let e=[];for(let r of a){let n=r.id.toString();if(r.subscriptions.length===0){e.push({admin:r.admin,connectionId:r.id,key:`c${n}`,subscription:null});continue}r.subscriptions.forEach((l,i)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${i.toString()}`,subscription:l})})}return e},"G"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),oe=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=M(),{queryShardKey:l,setShardKey:i,shardKey:u}=D(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==l?(b={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=b):b=e[2];let{data:s,error:o,errorSource:m,refetch:G}=E(_.listSubscriptions,f,b);W(G,!0);let x;if(e[3]!==o||e[4]!==m||e[5]!==s||e[6]!==i||e[7]!==u||e[8]!==n){let k=s===void 0?[]:Z(s.connections),c;e[10]!==i||e[11]!==u?(c=(0,t.jsx)(B,{onChange:i,testId:"subs-shard-input",value:u}),e[10]=i,e[11]=u,e[12]=c):c=e[12];let d;e[13]!==s||e[14]!==n?(d=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:s.totalSubscriptions})})]}),e[13]=s,e[14]=n,e[15]=d):d=e[15];let g;e[16]!==c||e[17]!==d?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[16]=c,e[17]=d,e[18]=g):g=e[18];let v;e[19]!==o||e[20]!==m?(v=o!==null&&(0,t.jsx)(F,{error:m,testId:"subs-error"}),e[19]=o,e[20]=m,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&s!==void 0&&k.length===0&&(0,t.jsx)(j,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&k.length>0&&(0,t.jsx)(T,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(L,{"data-testid":"subs-table",children:[(0,t.jsx)(O,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(h,{children:n("Connection")}),(0,t.jsx)(h,{children:n("Function path")}),(0,t.jsx)(h,{children:n("Table")}),(0,t.jsx)(h,{children:n("Arguments")})]})}),(0,t.jsx)(P,{children:k.map(y=>{let{subscription:I}=y,K=U(I?.args);return(0,t.jsxs)(C,{"data-testid":"subs-row",children:[(0,t.jsx)(p,{className:"font-medium tabular-nums",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",y.connectionId,y.admin&&(0,t.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,t.jsx)(p,{className:"font-mono text-xs",children:I?.functionPath??w}),(0,t.jsx)(p,{children:I?.table??w}),(0,t.jsx)(p,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:K||void 0,children:K||w})]},y.key)})})]})})})]}),e[3]=o,e[4]=m,e[5]=s,e[6]=i,e[7]=u,e[8]=n,e[9]=x}else x=e[9];return x},"oe");export{oe as default};
1
+ import{a as W}from"./chunk-WUW4ZHRL.js";import{a as D}from"./chunk-CKTKI4IY.js";import{a as B}from"./chunk-6UN4V2HB.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-XQS7KSHL.js";import{b as S}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as F}from"./chunk-JCSDJBBZ.js";import"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as _}from"./chunk-DZGOHOOE.js";import{c as E}from"./chunk-5DEXJ766.js";import"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as j}from"./chunk-UANVABQG.js";import{a as L,b as O,c as P,d as C,e as h,f as p}from"./chunk-L4EZAHCD.js";import{a as T,e as $}from"./chunk-IYWVSMAY.js";import{d as M}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as N,d as A,f as H,g as J}from"./chunk-R5ZTCHCE.js";var R=A(H(),1);var t=A(J(),1);var q=80,U=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>q?`${e.slice(0,q)}\u2026`:e},"q"),Z=N(a=>{let e=[];for(let r of a){let n=r.id.toString();if(r.subscriptions.length===0){e.push({admin:r.admin,connectionId:r.id,key:`c${n}`,subscription:null});continue}r.subscriptions.forEach((l,i)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${i.toString()}`,subscription:l})})}return e},"G"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),oe=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=M(),{queryShardKey:l,setShardKey:i,shardKey:u}=D(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==l?(b={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=b):b=e[2];let{data:s,error:o,errorSource:m,refetch:G}=E(_.listSubscriptions,f,b);W(G,!0);let x;if(e[3]!==o||e[4]!==m||e[5]!==s||e[6]!==i||e[7]!==u||e[8]!==n){let k=s===void 0?[]:Z(s.connections),c;e[10]!==i||e[11]!==u?(c=(0,t.jsx)(B,{onChange:i,testId:"subs-shard-input",value:u}),e[10]=i,e[11]=u,e[12]=c):c=e[12];let d;e[13]!==s||e[14]!==n?(d=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:s.totalSubscriptions})})]}),e[13]=s,e[14]=n,e[15]=d):d=e[15];let g;e[16]!==c||e[17]!==d?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[16]=c,e[17]=d,e[18]=g):g=e[18];let v;e[19]!==o||e[20]!==m?(v=o!==null&&(0,t.jsx)(F,{error:m,testId:"subs-error"}),e[19]=o,e[20]=m,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&s!==void 0&&k.length===0&&(0,t.jsx)(j,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&k.length>0&&(0,t.jsx)(T,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(L,{"data-testid":"subs-table",children:[(0,t.jsx)(O,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(h,{children:n("Connection")}),(0,t.jsx)(h,{children:n("Function path")}),(0,t.jsx)(h,{children:n("Table")}),(0,t.jsx)(h,{children:n("Arguments")})]})}),(0,t.jsx)(P,{children:k.map(y=>{let{subscription:I}=y,K=U(I?.args);return(0,t.jsxs)(C,{"data-testid":"subs-row",children:[(0,t.jsx)(p,{className:"font-medium tabular-nums",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",y.connectionId,y.admin&&(0,t.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,t.jsx)(p,{className:"font-mono text-xs",children:I?.functionPath??w}),(0,t.jsx)(p,{children:I?.table??w}),(0,t.jsx)(p,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:K||void 0,children:K||w})]},y.key)})})]})})})]}),e[3]=o,e[4]=m,e[5]=s,e[6]=i,e[7]=u,e[8]=n,e[9]=x}else x=e[9];return x},"oe");export{oe as default};
@@ -1 +1 @@
1
- import{a as w}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as C}from"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as h}from"./chunk-DZGOHOOE.js";import{c as u}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as T}from"./chunk-UANVABQG.js";import{a as S,b as K,c as $,d as g,e as i,f as o}from"./chunk-L4EZAHCD.js";import{a as A,e as k}from"./chunk-IYWVSMAY.js";import{d as M,s as D}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as d,d as z,e as ae,g as re}from"./chunk-R5ZTCHCE.js";var O=z(ae(),1);var e=z(re(),1);var Q="agent_threads",se="agent_messages",F="agent_run_queue",R=100,ne=250,ie={},oe={filters:[],limit:R,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:Q},l=d((s,t)=>{let r=s[t];return typeof r=="string"?r:void 0},"i"),j=d((s,t)=>{let r=s[t];return typeof r=="number"?r:void 0},"A"),L=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:r}=t;return typeof r=="number"?r:void 0},"U"),de=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(r=>r!==null&&typeof r=="object"?r.name:void 0).filter(r=>typeof r=="string"):[]},"ne"),le=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"oe"),ce=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"de"),Ne=d(({initialShardKey:s=""})=>{let t=M(),[r,I]=(0,O.useState)(void 0),{data:c}=u(h.listTables,ie,{live:!0,shardKey:s}),G=c!==void 0,p=Array.isArray(c)&&c.some(a=>a.name===Q),H=Array.isArray(c)&&c.some(a=>a.name===F),{data:_,error:J,errorSource:V,liveError:W}=u(h.readTablePage,oe,{enabled:p,live:!0,shardKey:s}),X={filters:[{column:"threadKey",operator:"eq",value:r??""}],limit:ne,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:se},{data:q}=u(h.readTablePage,{limit:R,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:F},{enabled:H,live:!0,shardKey:s}),{data:B,error:Y,errorSource:Z}=u(h.readTablePage,X,{enabled:p&&r!==void 0,live:!0,shardKey:s}),v=Array.isArray(_?.rows)?_.rows:[],ee=Array.isArray(q?.rows)?q.rows:[],E=d(a=>ee.filter(n=>l(n,"threadKey")===a).length,"w"),P=Array.isArray(B?.rows)?B.rows:[],U=v.find(a=>l(a,"key")===r),f;return G&&!p?f=(0,e.jsx)(T,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):p&&v.length===0?f=(0,e.jsx)(T,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):f=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(A,{className:"overflow-hidden py-0",children:(0,e.jsx)(k,{className:"px-0",children:(0,e.jsxs)(S,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(i,{children:t("Agent")}),(0,e.jsx)(i,{children:t("Key")}),(0,e.jsx)(i,{children:t("Status")}),(0,e.jsx)(i,{children:t("Queued")}),(0,e.jsx)(i,{children:t("Messages")}),(0,e.jsx)(i,{children:t("Tokens")}),(0,e.jsx)(i,{children:t("Updated")}),(0,e.jsx)(i,{"aria-label":t("Actions")})]})}),(0,e.jsx)($,{children:v.map(a=>{let n=l(a,"key")??"",m=l(a,"status"),x=L(a);return(0,e.jsxs)(g,{"data-active":n===r?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:l(a,"agent")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(o,{children:(0,e.jsx)(y,{"data-testid":`agents-thread-status-${n}`,variant:le(m),children:m??"\u2014"})}),(0,e.jsx)(o,{className:"tabular-nums",children:E(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:E(n)})}),(0,e.jsx)(o,{className:"tabular-nums",children:j(a,"messageCount")??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums text-muted-foreground",children:x??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:D(j(a,"updatedAt"),"\u2014")}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsx)(w,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{I(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),Y!==null&&(0,e.jsx)(C,{error:Z,testId:"agents-messages-error"}),r!==void 0&&(0,e.jsx)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(k,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",r,U!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",L(U)??0," ",t("Tokens")]})]}),(0,e.jsx)(w,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{I(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),P.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(S,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(i,{children:t("Role")}),(0,e.jsx)(i,{children:t("Content")}),(0,e.jsx)(i,{children:t("Tool")}),(0,e.jsx)(i,{children:t("Approval")})]})}),(0,e.jsx)($,{children:P.map((a,n)=>{let m=l(a,"role")??"\u2014",x=de(a),te=l(a,"toolName"),b=l(a,"status"),N=j(a,"seq")??n;return(0,e.jsxs)(g,{"data-testid":`agents-message-${String(N)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:m}),(0,e.jsx)(o,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(a,"content")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:te??(x.length>0?x.join(", "):"\u2014")}),(0,e.jsx)(o,{className:"align-top",children:b===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-message-approval-${String(N)}`,variant:ce(b),children:b})})]},l(a,"messageKey")??`${m}:${String(N)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[J!==null&&(0,e.jsx)(C,{error:V,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),W!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),f]})},"be");export{Ne as default};
1
+ import{a as w}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as C}from"./chunk-JCSDJBBZ.js";import"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as h}from"./chunk-DZGOHOOE.js";import{c as u}from"./chunk-5DEXJ766.js";import"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as T}from"./chunk-UANVABQG.js";import{a as S,b as K,c as $,d as g,e as i,f as o}from"./chunk-L4EZAHCD.js";import{a as A,e as k}from"./chunk-IYWVSMAY.js";import{d as M,s as D}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as d,d as z,e as ae,g as re}from"./chunk-R5ZTCHCE.js";var O=z(ae(),1);var e=z(re(),1);var Q="agent_threads",se="agent_messages",F="agent_run_queue",R=100,ne=250,ie={},oe={filters:[],limit:R,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:Q},l=d((s,t)=>{let r=s[t];return typeof r=="string"?r:void 0},"i"),j=d((s,t)=>{let r=s[t];return typeof r=="number"?r:void 0},"A"),L=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:r}=t;return typeof r=="number"?r:void 0},"U"),de=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(r=>r!==null&&typeof r=="object"?r.name:void 0).filter(r=>typeof r=="string"):[]},"ne"),le=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"oe"),ce=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"de"),Ne=d(({initialShardKey:s=""})=>{let t=M(),[r,I]=(0,O.useState)(void 0),{data:c}=u(h.listTables,ie,{live:!0,shardKey:s}),G=c!==void 0,p=Array.isArray(c)&&c.some(a=>a.name===Q),H=Array.isArray(c)&&c.some(a=>a.name===F),{data:_,error:J,errorSource:V,liveError:W}=u(h.readTablePage,oe,{enabled:p,live:!0,shardKey:s}),X={filters:[{column:"threadKey",operator:"eq",value:r??""}],limit:ne,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:se},{data:q}=u(h.readTablePage,{limit:R,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:F},{enabled:H,live:!0,shardKey:s}),{data:B,error:Y,errorSource:Z}=u(h.readTablePage,X,{enabled:p&&r!==void 0,live:!0,shardKey:s}),v=Array.isArray(_?.rows)?_.rows:[],ee=Array.isArray(q?.rows)?q.rows:[],E=d(a=>ee.filter(n=>l(n,"threadKey")===a).length,"w"),P=Array.isArray(B?.rows)?B.rows:[],U=v.find(a=>l(a,"key")===r),f;return G&&!p?f=(0,e.jsx)(T,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):p&&v.length===0?f=(0,e.jsx)(T,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):f=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(A,{className:"overflow-hidden py-0",children:(0,e.jsx)(k,{className:"px-0",children:(0,e.jsxs)(S,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(i,{children:t("Agent")}),(0,e.jsx)(i,{children:t("Key")}),(0,e.jsx)(i,{children:t("Status")}),(0,e.jsx)(i,{children:t("Queued")}),(0,e.jsx)(i,{children:t("Messages")}),(0,e.jsx)(i,{children:t("Tokens")}),(0,e.jsx)(i,{children:t("Updated")}),(0,e.jsx)(i,{"aria-label":t("Actions")})]})}),(0,e.jsx)($,{children:v.map(a=>{let n=l(a,"key")??"",m=l(a,"status"),x=L(a);return(0,e.jsxs)(g,{"data-active":n===r?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:l(a,"agent")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(o,{children:(0,e.jsx)(y,{"data-testid":`agents-thread-status-${n}`,variant:le(m),children:m??"\u2014"})}),(0,e.jsx)(o,{className:"tabular-nums",children:E(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:E(n)})}),(0,e.jsx)(o,{className:"tabular-nums",children:j(a,"messageCount")??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums text-muted-foreground",children:x??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:D(j(a,"updatedAt"),"\u2014")}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsx)(w,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{I(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),Y!==null&&(0,e.jsx)(C,{error:Z,testId:"agents-messages-error"}),r!==void 0&&(0,e.jsx)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(k,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",r,U!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",L(U)??0," ",t("Tokens")]})]}),(0,e.jsx)(w,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{I(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),P.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(S,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(i,{children:t("Role")}),(0,e.jsx)(i,{children:t("Content")}),(0,e.jsx)(i,{children:t("Tool")}),(0,e.jsx)(i,{children:t("Approval")})]})}),(0,e.jsx)($,{children:P.map((a,n)=>{let m=l(a,"role")??"\u2014",x=de(a),te=l(a,"toolName"),b=l(a,"status"),N=j(a,"seq")??n;return(0,e.jsxs)(g,{"data-testid":`agents-message-${String(N)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:m}),(0,e.jsx)(o,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(a,"content")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:te??(x.length>0?x.join(", "):"\u2014")}),(0,e.jsx)(o,{className:"align-top",children:b===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-message-approval-${String(N)}`,variant:ce(b),children:b})})]},l(a,"messageKey")??`${m}:${String(N)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[J!==null&&(0,e.jsx)(C,{error:V,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),W!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),f]})},"be");export{Ne as default};
@@ -1,4 +1,4 @@
1
- import{c as An,d as Ln}from"./chunk-7CVIN6KU.js";import{a as Gn,b as Hn,c as jn,d as Bn}from"./chunk-JUWOEHDD.js";import{a as zn,b as ut,c as On,d as $t}from"./chunk-2RASQG3R.js";import{a as Ft}from"./chunk-57VX76PR.js";import{b as _t}from"./chunk-BQK2C2Z4.js";import{d as qn}from"./chunk-W2JBKQNU.js";import{a as Rt}from"./chunk-7SROZWKL.js";import"./chunk-FJ6G6FNE.js";import"./chunk-CP4ZFBVW.js";import"./chunk-CN2AINNY.js";import{a as yt}from"./chunk-NIX2QSSN.js";import{a as qt}from"./chunk-5JLIP2HH.js";import{a as Dn}from"./chunk-WUW4ZHRL.js";import{b as _n,c as Ht}from"./chunk-XJSWM47N.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import{a as Jt}from"./chunk-M3NNNOD5.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as Ct}from"./chunk-2EJQ7SPV.js";import{a as Pn}from"./chunk-6UN4V2HB.js";import{a as Nn,b as Mn}from"./chunk-KVSQKUWD.js";import{c as wn,d as xn,e as Sn}from"./chunk-4YTSKL4R.js";import{b as Fn,c as $n,f as jt}from"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{a as de}from"./chunk-DZGOHOOE.js";import{b as Gt,c as at}from"./chunk-L6ATKZKO.js";import{f as je}from"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as St}from"./chunk-UANVABQG.js";import{a as kn,b as Vn,c as En,d as Bt,e as In,f as Tn}from"./chunk-L4EZAHCD.js";import{d as q,f as Pe,g as Me,h as Cn,m as nt,n as yn,o as Z,s as Rn}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as i,d as ue,e as st,f as pt,g as ht,i as tt}from"./chunk-R5ZTCHCE.js";var zo=ue(pt(),1);var gt=ue(st(),1);var ot=ue(pt(),1);var z=ue(ht(),1),ke=ue(st(),1);var mr=[25,50,100,250],pr=i(t=>{let e=(0,ot.c)(18),{onChange:n,options:o,prefix:r,value:l}=t,s=q(),u;e[0]!==n?(u=i(w=>{n(Number.parseInt(w.target.value,10))},"b"),e[0]=n,e[1]=u):u=e[1];let a=u,d=`${r}-page-size`,g;e[2]!==s?(g=s("Rows per page"),e[2]=s,e[3]=g):g=e[3];let p;e[4]!==g?(p=(0,z.jsx)("span",{children:g}),e[4]=g,e[5]=p):p=e[5];let f=`${r}-page-size`,c=`${r}-page-size`,m;e[6]!==o?(m=o.map(vr),e[6]=o,e[7]=m):m=e[7];let h;e[8]!==a||e[9]!==f||e[10]!==c||e[11]!==m||e[12]!==l?(h=(0,z.jsx)("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":f,id:c,onChange:a,value:l,children:m}),e[8]=a,e[9]=f,e[10]=c,e[11]=m,e[12]=l,e[13]=h):h=e[13];let b;return e[14]!==d||e[15]!==p||e[16]!==h?(b=(0,z.jsxs)("label",{className:"flex items-center gap-1.5",htmlFor:d,children:[p,h]}),e[14]=d,e[15]=p,e[16]=h,e[17]=b):b=e[17],b},"A"),hr=i(t=>{let e=(0,ot.c)(25),{onJump:n,page:o,pages:r,prefix:l}=t,s=q(),u;e[0]!==n||e[1]!==r?(u=i(C=>{let R=Number.parseInt(C,10);Number.isNaN(R)||n(Math.min(Math.max(1,R),Math.max(1,r)))},"b"),e[0]=n,e[1]=r,e[2]=u):u=e[2];let a=u,d;e[3]!==a?(d=i(C=>{C.key==="Enter"&&a(C.currentTarget.value)},"d"),e[3]=a,e[4]=d):d=e[4];let g=d,p;e[5]!==a?(p=i(C=>{a(C.currentTarget.value)},"n"),e[5]=a,e[6]=p):p=e[6];let f=p,c;e[7]!==s?(c=s("Page"),e[7]=s,e[8]=c):c=e[8];let m;e[9]!==s?(m=s("Page"),e[9]=s,e[10]=m):m=e[10];let h=`${l}-page-jump`,b=Math.max(1,r),w;e[11]!==f||e[12]!==g||e[13]!==o||e[14]!==m||e[15]!==h||e[16]!==b?(w=(0,z.jsx)("input",{"aria-label":m,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":h,defaultValue:o,max:b,min:1,onBlur:f,onKeyDown:g,type:"number"},o),e[11]=f,e[12]=g,e[13]=o,e[14]=m,e[15]=h,e[16]=b,e[17]=w):w=e[17];let x;e[18]!==r||e[19]!==s?(x=s("of {pages}",{pages:r}),e[18]=r,e[19]=s,e[20]=x):x=e[20];let S;return e[21]!==c||e[22]!==w||e[23]!==x?(S=(0,z.jsxs)("span",{className:"flex items-center gap-1.5 tabular-nums",children:[c,w,x]}),e[21]=c,e[22]=w,e[23]=x,e[24]=S):S=e[24],S},"G"),Nt=i(({hasNext:t,hasPrevious:e,onJumpToPage:n,onNext:o,onPageSizeChange:r,onPrevious:l,pageSize:s,pageSizeOptions:u=mr,prefix:a,rangeEnd:d,rangeStart:g,total:p})=>{let f=q(),c="rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",m=s!==void 0&&s>0?Math.max(1,Math.ceil(p/s)):1,h=s!==void 0&&s>0?Math.floor(Math.max(0,g-1)/s)+1:1;return(0,z.jsxs)("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,z.jsxs)("div",{className:"flex items-center gap-3",children:[s!==void 0&&r!==void 0&&(0,z.jsx)(pr,{onChange:r,options:u,prefix:a,value:s}),(0,z.jsx)("span",{className:"tabular-nums","data-testid":`${a}-page-info`,children:f("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:d,rangeStart:g,total:p})})]}),(0,z.jsxs)("div",{className:"flex items-center gap-3",children:[(0,z.jsx)("button",{className:c,"data-testid":`${a}-prev`,disabled:!e,onClick:l,type:"button",children:f("Previous")}),s!==void 0&&n!==void 0&&(0,z.jsx)(hr,{onJump:n,page:h,pages:m,prefix:a}),(0,z.jsx)("button",{className:c,"data-testid":`${a}-next`,disabled:!t,onClick:o,type:"button",children:f("Next")})]})]})},"_");function vr(t){return(0,z.jsx)("option",{value:t,children:t},t)}i(vr,"q");var Jn=i(t=>t==null?"\u2205":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),"j"),br=i(t=>{let e=(0,ot.c)(32),{column:n,onFacetFilter:o,state:r}=t,l=q(),s;e[0]!==n||e[1]!==o||e[2]!==r.result?.values?(s=i(b=>{let w=Number(b.currentTarget.dataset.index),x=r.result?.values[w];x!==void 0&&o(n,x.value)},"i"),e[0]=n,e[1]=o,e[2]=r.result?.values,e[3]=s):s=e[3];let u=s,a=`db-facet-${n}`,d;e[4]!==n?(d=(0,z.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=d):d=e[5];let g;e[6]!==r.loading||e[7]!==r.result||e[8]!==l?(g=r.loading&&r.result===null&&(0,z.jsx)("span",{className:"text-muted-foreground",children:l("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=l,e[9]=g):g=e[9];let p;e[10]!==r.error?(p=r.error!==null&&(0,z.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=p):p=e[11];let f;e[12]!==r.result?.values?(f=r.result?.values??[],e[12]=r.result?.values,e[13]=f):f=e[13];let c;if(e[14]!==n||e[15]!==u||e[16]!==f){let b;e[18]!==n||e[19]!==u?(b=i((w,x)=>(0,z.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":x,"data-testid":`db-facet-value-${n}`,onClick:u,type:"button",children:[(0,z.jsx)("span",{className:"truncate",children:Jn(w.value)}),(0,z.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:w.count})]},Jn(w.value)),"u"),e[18]=n,e[19]=u,e[20]=b):b=e[20],c=f.map(b),e[14]=n,e[15]=u,e[16]=f,e[17]=c}else c=e[17];let m;e[21]!==n||e[22]!==r.result||e[23]!==l?(m=r.result?.truncated===!0&&(0,z.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:l("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=l,e[24]=m):m=e[24];let h;return e[25]!==a||e[26]!==d||e[27]!==g||e[28]!==p||e[29]!==c||e[30]!==m?(h=(0,z.jsxs)("section",{className:"flex flex-col gap-1","data-testid":a,children:[d,g,p,c,m]}),e[25]=a,e[26]=d,e[27]=g,e[28]=p,e[29]=c,e[30]=m,e[31]=h):h=e[31],h},"D"),Mt=i(t=>{let e=(0,ot.c)(26),{columns:n,facets:o,onFacetFilter:r,onToggleFacet:l}=t,s=q(),u;e[0]!==l?(u=i(w=>{let{column:x}=w.currentTarget.dataset;x!==void 0&&l(x)},"b"),e[0]=l,e[1]=u):u=e[1];let a=u;if(n.length===0)return null;let d;e[2]!==s?(d=s("Facets"),e[2]=s,e[3]=d):d=e[3];let g;e[4]!==d?(g=(0,z.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:d}),e[4]=d,e[5]=g):g=e[5];let p;if(e[6]!==n||e[7]!==o||e[8]!==a){let w;e[10]!==o||e[11]!==a?(w=i(x=>(0,z.jsx)("button",{"aria-pressed":x in o,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":x,"data-testid":`db-facet-toggle-${x}`,onClick:a,type:"button",children:x},x),"c"),e[10]=o,e[11]=a,e[12]=w):w=e[12],p=n.map(w),e[6]=n,e[7]=o,e[8]=a,e[9]=p}else p=e[9];let f;e[13]!==p?(f=(0,z.jsx)("div",{className:"flex flex-wrap gap-1",children:p}),e[13]=p,e[14]=f):f=e[14];let c;e[15]!==g||e[16]!==f?(c=(0,z.jsxs)("div",{className:"flex flex-col gap-1.5",children:[g,f]}),e[15]=g,e[16]=f,e[17]=c):c=e[17];let m;e[18]!==o?(m=Object.entries(o),e[18]=o,e[19]=m):m=e[19];let h;e[20]!==r||e[21]!==m?(h=m.map(w=>{let[x,S]=w;return(0,z.jsx)(br,{column:x,onFacetFilter:r,state:S},x)}),e[20]=r,e[21]=m,e[22]=h):h=e[22];let b;return e[23]!==c||e[24]!==h?(b=(0,z.jsxs)("aside",{className:"flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs","data-testid":"db-facets",children:[c,h]}),e[23]=c,e[24]=h,e[25]=b):b=e[25],b},"ee");function Be(t){let e=(0,ot.c)(2),n=(0,ke.useRef)(t),o;return e[0]!==t?(o=i(()=>{n.current=t},"a"),e[0]=t,e[1]=o):o=e[1],(0,ke.useEffect)(o),n}i(Be,"J");var Pt=i(()=>{let[t,e]=(0,ke.useState)({}),n=Be(t),o=(0,ke.useRef)({}),r=i(async(l,s)=>{let u=(o.current[l]??0)+1;o.current[l]=u,e(a=>l in a?{...a,[l]:{error:null,loading:!0,result:a[l]?.result??null}}:a);try{let a=await s(l);if(o.current[l]!==u)return;e(d=>l in d?{...d,[l]:{error:null,loading:!1,result:a}}:d)}catch(a){if(o.current[l]!==u)return;e(d=>l in d?{...d,[l]:{error:Cn(a),loading:!1,result:null}}:d)}},"s");return{clearFacets:i(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:i(l=>{for(let s of Object.keys(n.current))Z(r(s,l))},"refetchFacets"),toggleFacet:i((l,s)=>{if(l in n.current){e(u=>Object.fromEntries(Object.entries(u).filter(([a])=>a!==l)));return}e(u=>({...u,[l]:{error:null,loading:!0,result:null}})),s!==null&&Z(r(l,s))},"toggleFacet")}},"te"),Un=34,Kn=600,wr=i(t=>{let e=(0,ot.c)(21),{item:n,onSelect:o,prefix:r,selected:l,start:s}=t,u;e[0]!==n.name||e[1]!==o?(u=i(()=>{o(n.name)},"b"),e[0]=n.name,e[1]=o,e[2]=u):u=e[2];let a=u,d=`translateY(${String(s)}px)`,g;e[3]!==d?(g={insetInline:0,position:"absolute",top:0,transform:d},e[3]=d,e[4]=g):g=e[4];let p=g,f=l?"bg-accent font-medium text-accent-foreground":"text-foreground",c;e[5]!==f?(c=tt("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",f),e[5]=f,e[6]=c):c=e[6];let m=`${r}-table-${n.name}`,h;e[7]!==n.name?(h=(0,z.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=h):h=e[8];let b;e[9]!==n.rowCount?(b=(0,z.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=b):b=e[10];let w;e[11]!==a||e[12]!==l||e[13]!==c||e[14]!==m||e[15]!==h||e[16]!==b?(w=(0,z.jsxs)("button",{"aria-pressed":l,className:c,"data-testid":m,onClick:a,type:"button",children:[h,b]}),e[11]=a,e[12]=l,e[13]=c,e[14]=m,e[15]=h,e[16]=b,e[17]=w):w=e[17];let x;return e[18]!==p||e[19]!==w?(x=(0,z.jsx)("li",{style:p,children:w}),e[18]=p,e[19]=w,e[20]=x):x=e[20],x},"W"),kt=i(({header:t,onReload:e,onSelect:n,prefix:o,reloadLabel:r,selected:l,tables:s})=>{let u=q(),[a,d]=(0,ke.useState)(""),g=(0,ke.useRef)(null),p=i(h=>{d(h.target.value)},"n"),f=(0,ke.useMemo)(()=>{let h=a.trim().toLowerCase();return h===""?s:s.filter(b=>b.name.toLowerCase().includes(h))},[a,s]),c=_t({count:f.length,estimateSize:i(()=>Un,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:Kn,width:240},observeElementRect:i((h,b)=>Ft(h,b,Kn),"observeElementRect"),overscan:12}).getVirtualItems(),m={height:f.length*Un};return(0,z.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${o}-table-list`,children:[t,(0,z.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,z.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:u("Tables")}),e!==void 0&&(0,z.jsx)("button",{"aria-label":r??u("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${o}-load-tables`,onClick:e,title:r??u("Refresh"),type:"button",children:(0,z.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,z.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,z.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,z.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${o}-table-search`,onChange:p,placeholder:u("search table\u2026"),type:"search",value:a})}),(0,z.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${o}-table-list-rows`,ref:g,children:[(0,z.jsx)("li",{"aria-hidden":"true",style:m}),c.map(h=>{let b=f[h.index];return b===void 0?null:(0,z.jsx)(wr,{item:b,onSelect:n,prefix:o,selected:l===b.name,start:h.start},b.name)})]})]})},"re");var j=ue(pt(),1);var P=ue(st(),1);var wt=ue(st(),1);function We(t,e){return typeof t=="function"?t(e):t}i(We,"functionalUpdate");function Ce(t,e){return n=>{e.setState(o=>({...o,[t]:We(n,o[t])}))}}i(Ce,"makeStateUpdater");function Tt(t){return t instanceof Function}i(Tt,"isFunction");function xr(t){return Array.isArray(t)&&t.every(e=>typeof e=="number")}i(xr,"isNumberArray");function Sr(t,e){let n=[],o=i(r=>{r.forEach(l=>{n.push(l);let s=e(l);s!=null&&s.length&&o(s)})},"recurse");return o(t),n}i(Sr,"flattenBy");function I(t,e,n){let o=[],r;return l=>{let s;n.key&&n.debug&&(s=Date.now());let u=t(l);if(!(u.length!==o.length||u.some((g,p)=>o[p]!==g)))return r;o=u;let d;if(n.key&&n.debug&&(d=Date.now()),r=e(...u),n==null||n.onChange==null||n.onChange(r),n.key&&n.debug&&n!=null&&n.debug()){let g=Math.round((Date.now()-s)*100)/100,p=Math.round((Date.now()-d)*100)/100,f=p/16,c=i((m,h)=>{for(m=String(m);m.length<h;)m=" "+m;return m},"pad");console.info(`%c\u23F1 ${c(p,5)} /${c(g,5)} ms`,`
1
+ import{c as An,d as Ln}from"./chunk-7CVIN6KU.js";import{a as Gn,b as Hn,c as jn,d as Bn}from"./chunk-JUWOEHDD.js";import{a as zn,b as ut,c as On,d as $t}from"./chunk-4HWTEDVV.js";import{a as Ft}from"./chunk-57VX76PR.js";import{b as _t}from"./chunk-BQK2C2Z4.js";import{d as qn}from"./chunk-W2JBKQNU.js";import{a as Rt}from"./chunk-7SROZWKL.js";import"./chunk-FJ6G6FNE.js";import"./chunk-CP4ZFBVW.js";import"./chunk-CN2AINNY.js";import{a as yt}from"./chunk-NIX2QSSN.js";import{a as qt}from"./chunk-5JLIP2HH.js";import{a as Dn}from"./chunk-WUW4ZHRL.js";import{b as _n,c as Ht}from"./chunk-XJSWM47N.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import{a as Jt}from"./chunk-M3NNNOD5.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as Ct}from"./chunk-2EJQ7SPV.js";import{a as Pn}from"./chunk-6UN4V2HB.js";import{a as Nn,b as Mn}from"./chunk-KVSQKUWD.js";import{c as wn,d as xn,e as Sn}from"./chunk-4YTSKL4R.js";import{b as Fn,c as $n,f as jt}from"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{a as de}from"./chunk-DZGOHOOE.js";import{b as Gt,c as at}from"./chunk-5DEXJ766.js";import{f as je}from"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as St}from"./chunk-UANVABQG.js";import{a as kn,b as Vn,c as En,d as Bt,e as In,f as Tn}from"./chunk-L4EZAHCD.js";import{d as q,f as Pe,g as Me,h as Cn,m as nt,n as yn,o as Z,s as Rn}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as i,d as ue,e as st,f as pt,g as ht,i as tt}from"./chunk-R5ZTCHCE.js";var zo=ue(pt(),1);var gt=ue(st(),1);var ot=ue(pt(),1);var z=ue(ht(),1),ke=ue(st(),1);var mr=[25,50,100,250],pr=i(t=>{let e=(0,ot.c)(18),{onChange:n,options:o,prefix:r,value:l}=t,s=q(),u;e[0]!==n?(u=i(w=>{n(Number.parseInt(w.target.value,10))},"b"),e[0]=n,e[1]=u):u=e[1];let a=u,d=`${r}-page-size`,g;e[2]!==s?(g=s("Rows per page"),e[2]=s,e[3]=g):g=e[3];let p;e[4]!==g?(p=(0,z.jsx)("span",{children:g}),e[4]=g,e[5]=p):p=e[5];let f=`${r}-page-size`,c=`${r}-page-size`,m;e[6]!==o?(m=o.map(vr),e[6]=o,e[7]=m):m=e[7];let h;e[8]!==a||e[9]!==f||e[10]!==c||e[11]!==m||e[12]!==l?(h=(0,z.jsx)("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":f,id:c,onChange:a,value:l,children:m}),e[8]=a,e[9]=f,e[10]=c,e[11]=m,e[12]=l,e[13]=h):h=e[13];let b;return e[14]!==d||e[15]!==p||e[16]!==h?(b=(0,z.jsxs)("label",{className:"flex items-center gap-1.5",htmlFor:d,children:[p,h]}),e[14]=d,e[15]=p,e[16]=h,e[17]=b):b=e[17],b},"A"),hr=i(t=>{let e=(0,ot.c)(25),{onJump:n,page:o,pages:r,prefix:l}=t,s=q(),u;e[0]!==n||e[1]!==r?(u=i(C=>{let R=Number.parseInt(C,10);Number.isNaN(R)||n(Math.min(Math.max(1,R),Math.max(1,r)))},"b"),e[0]=n,e[1]=r,e[2]=u):u=e[2];let a=u,d;e[3]!==a?(d=i(C=>{C.key==="Enter"&&a(C.currentTarget.value)},"d"),e[3]=a,e[4]=d):d=e[4];let g=d,p;e[5]!==a?(p=i(C=>{a(C.currentTarget.value)},"n"),e[5]=a,e[6]=p):p=e[6];let f=p,c;e[7]!==s?(c=s("Page"),e[7]=s,e[8]=c):c=e[8];let m;e[9]!==s?(m=s("Page"),e[9]=s,e[10]=m):m=e[10];let h=`${l}-page-jump`,b=Math.max(1,r),w;e[11]!==f||e[12]!==g||e[13]!==o||e[14]!==m||e[15]!==h||e[16]!==b?(w=(0,z.jsx)("input",{"aria-label":m,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":h,defaultValue:o,max:b,min:1,onBlur:f,onKeyDown:g,type:"number"},o),e[11]=f,e[12]=g,e[13]=o,e[14]=m,e[15]=h,e[16]=b,e[17]=w):w=e[17];let x;e[18]!==r||e[19]!==s?(x=s("of {pages}",{pages:r}),e[18]=r,e[19]=s,e[20]=x):x=e[20];let S;return e[21]!==c||e[22]!==w||e[23]!==x?(S=(0,z.jsxs)("span",{className:"flex items-center gap-1.5 tabular-nums",children:[c,w,x]}),e[21]=c,e[22]=w,e[23]=x,e[24]=S):S=e[24],S},"G"),Nt=i(({hasNext:t,hasPrevious:e,onJumpToPage:n,onNext:o,onPageSizeChange:r,onPrevious:l,pageSize:s,pageSizeOptions:u=mr,prefix:a,rangeEnd:d,rangeStart:g,total:p})=>{let f=q(),c="rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",m=s!==void 0&&s>0?Math.max(1,Math.ceil(p/s)):1,h=s!==void 0&&s>0?Math.floor(Math.max(0,g-1)/s)+1:1;return(0,z.jsxs)("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,z.jsxs)("div",{className:"flex items-center gap-3",children:[s!==void 0&&r!==void 0&&(0,z.jsx)(pr,{onChange:r,options:u,prefix:a,value:s}),(0,z.jsx)("span",{className:"tabular-nums","data-testid":`${a}-page-info`,children:f("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:d,rangeStart:g,total:p})})]}),(0,z.jsxs)("div",{className:"flex items-center gap-3",children:[(0,z.jsx)("button",{className:c,"data-testid":`${a}-prev`,disabled:!e,onClick:l,type:"button",children:f("Previous")}),s!==void 0&&n!==void 0&&(0,z.jsx)(hr,{onJump:n,page:h,pages:m,prefix:a}),(0,z.jsx)("button",{className:c,"data-testid":`${a}-next`,disabled:!t,onClick:o,type:"button",children:f("Next")})]})]})},"_");function vr(t){return(0,z.jsx)("option",{value:t,children:t},t)}i(vr,"q");var Jn=i(t=>t==null?"\u2205":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),"j"),br=i(t=>{let e=(0,ot.c)(32),{column:n,onFacetFilter:o,state:r}=t,l=q(),s;e[0]!==n||e[1]!==o||e[2]!==r.result?.values?(s=i(b=>{let w=Number(b.currentTarget.dataset.index),x=r.result?.values[w];x!==void 0&&o(n,x.value)},"i"),e[0]=n,e[1]=o,e[2]=r.result?.values,e[3]=s):s=e[3];let u=s,a=`db-facet-${n}`,d;e[4]!==n?(d=(0,z.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=d):d=e[5];let g;e[6]!==r.loading||e[7]!==r.result||e[8]!==l?(g=r.loading&&r.result===null&&(0,z.jsx)("span",{className:"text-muted-foreground",children:l("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=l,e[9]=g):g=e[9];let p;e[10]!==r.error?(p=r.error!==null&&(0,z.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=p):p=e[11];let f;e[12]!==r.result?.values?(f=r.result?.values??[],e[12]=r.result?.values,e[13]=f):f=e[13];let c;if(e[14]!==n||e[15]!==u||e[16]!==f){let b;e[18]!==n||e[19]!==u?(b=i((w,x)=>(0,z.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":x,"data-testid":`db-facet-value-${n}`,onClick:u,type:"button",children:[(0,z.jsx)("span",{className:"truncate",children:Jn(w.value)}),(0,z.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:w.count})]},Jn(w.value)),"u"),e[18]=n,e[19]=u,e[20]=b):b=e[20],c=f.map(b),e[14]=n,e[15]=u,e[16]=f,e[17]=c}else c=e[17];let m;e[21]!==n||e[22]!==r.result||e[23]!==l?(m=r.result?.truncated===!0&&(0,z.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:l("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=l,e[24]=m):m=e[24];let h;return e[25]!==a||e[26]!==d||e[27]!==g||e[28]!==p||e[29]!==c||e[30]!==m?(h=(0,z.jsxs)("section",{className:"flex flex-col gap-1","data-testid":a,children:[d,g,p,c,m]}),e[25]=a,e[26]=d,e[27]=g,e[28]=p,e[29]=c,e[30]=m,e[31]=h):h=e[31],h},"D"),Mt=i(t=>{let e=(0,ot.c)(26),{columns:n,facets:o,onFacetFilter:r,onToggleFacet:l}=t,s=q(),u;e[0]!==l?(u=i(w=>{let{column:x}=w.currentTarget.dataset;x!==void 0&&l(x)},"b"),e[0]=l,e[1]=u):u=e[1];let a=u;if(n.length===0)return null;let d;e[2]!==s?(d=s("Facets"),e[2]=s,e[3]=d):d=e[3];let g;e[4]!==d?(g=(0,z.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:d}),e[4]=d,e[5]=g):g=e[5];let p;if(e[6]!==n||e[7]!==o||e[8]!==a){let w;e[10]!==o||e[11]!==a?(w=i(x=>(0,z.jsx)("button",{"aria-pressed":x in o,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":x,"data-testid":`db-facet-toggle-${x}`,onClick:a,type:"button",children:x},x),"c"),e[10]=o,e[11]=a,e[12]=w):w=e[12],p=n.map(w),e[6]=n,e[7]=o,e[8]=a,e[9]=p}else p=e[9];let f;e[13]!==p?(f=(0,z.jsx)("div",{className:"flex flex-wrap gap-1",children:p}),e[13]=p,e[14]=f):f=e[14];let c;e[15]!==g||e[16]!==f?(c=(0,z.jsxs)("div",{className:"flex flex-col gap-1.5",children:[g,f]}),e[15]=g,e[16]=f,e[17]=c):c=e[17];let m;e[18]!==o?(m=Object.entries(o),e[18]=o,e[19]=m):m=e[19];let h;e[20]!==r||e[21]!==m?(h=m.map(w=>{let[x,S]=w;return(0,z.jsx)(br,{column:x,onFacetFilter:r,state:S},x)}),e[20]=r,e[21]=m,e[22]=h):h=e[22];let b;return e[23]!==c||e[24]!==h?(b=(0,z.jsxs)("aside",{className:"flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs","data-testid":"db-facets",children:[c,h]}),e[23]=c,e[24]=h,e[25]=b):b=e[25],b},"ee");function Be(t){let e=(0,ot.c)(2),n=(0,ke.useRef)(t),o;return e[0]!==t?(o=i(()=>{n.current=t},"a"),e[0]=t,e[1]=o):o=e[1],(0,ke.useEffect)(o),n}i(Be,"J");var Pt=i(()=>{let[t,e]=(0,ke.useState)({}),n=Be(t),o=(0,ke.useRef)({}),r=i(async(l,s)=>{let u=(o.current[l]??0)+1;o.current[l]=u,e(a=>l in a?{...a,[l]:{error:null,loading:!0,result:a[l]?.result??null}}:a);try{let a=await s(l);if(o.current[l]!==u)return;e(d=>l in d?{...d,[l]:{error:null,loading:!1,result:a}}:d)}catch(a){if(o.current[l]!==u)return;e(d=>l in d?{...d,[l]:{error:Cn(a),loading:!1,result:null}}:d)}},"s");return{clearFacets:i(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:i(l=>{for(let s of Object.keys(n.current))Z(r(s,l))},"refetchFacets"),toggleFacet:i((l,s)=>{if(l in n.current){e(u=>Object.fromEntries(Object.entries(u).filter(([a])=>a!==l)));return}e(u=>({...u,[l]:{error:null,loading:!0,result:null}})),s!==null&&Z(r(l,s))},"toggleFacet")}},"te"),Un=34,Kn=600,wr=i(t=>{let e=(0,ot.c)(21),{item:n,onSelect:o,prefix:r,selected:l,start:s}=t,u;e[0]!==n.name||e[1]!==o?(u=i(()=>{o(n.name)},"b"),e[0]=n.name,e[1]=o,e[2]=u):u=e[2];let a=u,d=`translateY(${String(s)}px)`,g;e[3]!==d?(g={insetInline:0,position:"absolute",top:0,transform:d},e[3]=d,e[4]=g):g=e[4];let p=g,f=l?"bg-accent font-medium text-accent-foreground":"text-foreground",c;e[5]!==f?(c=tt("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",f),e[5]=f,e[6]=c):c=e[6];let m=`${r}-table-${n.name}`,h;e[7]!==n.name?(h=(0,z.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=h):h=e[8];let b;e[9]!==n.rowCount?(b=(0,z.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=b):b=e[10];let w;e[11]!==a||e[12]!==l||e[13]!==c||e[14]!==m||e[15]!==h||e[16]!==b?(w=(0,z.jsxs)("button",{"aria-pressed":l,className:c,"data-testid":m,onClick:a,type:"button",children:[h,b]}),e[11]=a,e[12]=l,e[13]=c,e[14]=m,e[15]=h,e[16]=b,e[17]=w):w=e[17];let x;return e[18]!==p||e[19]!==w?(x=(0,z.jsx)("li",{style:p,children:w}),e[18]=p,e[19]=w,e[20]=x):x=e[20],x},"W"),kt=i(({header:t,onReload:e,onSelect:n,prefix:o,reloadLabel:r,selected:l,tables:s})=>{let u=q(),[a,d]=(0,ke.useState)(""),g=(0,ke.useRef)(null),p=i(h=>{d(h.target.value)},"n"),f=(0,ke.useMemo)(()=>{let h=a.trim().toLowerCase();return h===""?s:s.filter(b=>b.name.toLowerCase().includes(h))},[a,s]),c=_t({count:f.length,estimateSize:i(()=>Un,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:Kn,width:240},observeElementRect:i((h,b)=>Ft(h,b,Kn),"observeElementRect"),overscan:12}).getVirtualItems(),m={height:f.length*Un};return(0,z.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${o}-table-list`,children:[t,(0,z.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,z.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:u("Tables")}),e!==void 0&&(0,z.jsx)("button",{"aria-label":r??u("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${o}-load-tables`,onClick:e,title:r??u("Refresh"),type:"button",children:(0,z.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,z.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,z.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,z.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${o}-table-search`,onChange:p,placeholder:u("search table\u2026"),type:"search",value:a})}),(0,z.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${o}-table-list-rows`,ref:g,children:[(0,z.jsx)("li",{"aria-hidden":"true",style:m}),c.map(h=>{let b=f[h.index];return b===void 0?null:(0,z.jsx)(wr,{item:b,onSelect:n,prefix:o,selected:l===b.name,start:h.start},b.name)})]})]})},"re");var j=ue(pt(),1);var P=ue(st(),1);var wt=ue(st(),1);function We(t,e){return typeof t=="function"?t(e):t}i(We,"functionalUpdate");function Ce(t,e){return n=>{e.setState(o=>({...o,[t]:We(n,o[t])}))}}i(Ce,"makeStateUpdater");function Tt(t){return t instanceof Function}i(Tt,"isFunction");function xr(t){return Array.isArray(t)&&t.every(e=>typeof e=="number")}i(xr,"isNumberArray");function Sr(t,e){let n=[],o=i(r=>{r.forEach(l=>{n.push(l);let s=e(l);s!=null&&s.length&&o(s)})},"recurse");return o(t),n}i(Sr,"flattenBy");function I(t,e,n){let o=[],r;return l=>{let s;n.key&&n.debug&&(s=Date.now());let u=t(l);if(!(u.length!==o.length||u.some((g,p)=>o[p]!==g)))return r;o=u;let d;if(n.key&&n.debug&&(d=Date.now()),r=e(...u),n==null||n.onChange==null||n.onChange(r),n.key&&n.debug&&n!=null&&n.debug()){let g=Math.round((Date.now()-s)*100)/100,p=Math.round((Date.now()-d)*100)/100,f=p/16,c=i((m,h)=>{for(m=String(m);m.length<h;)m=" "+m;return m},"pad");console.info(`%c\u23F1 ${c(p,5)} /${c(g,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,n?.key)}return r}}i(I,"memo");function T(t,e,n,o){return{debug:i(()=>{var r;return(r=t?.debugAll)!=null?r:t[e]},"debug"),key:!1,onChange:o}}i(T,"getMemoOptions");function Cr(t,e,n,o){let r=i(()=>{var s;return(s=l.getValue())!=null?s:t.options.renderFallbackValue},"getRenderValue"),l={id:`${e.id}_${n.id}`,row:e,column:n,getValue:i(()=>e.getValue(o),"getValue"),renderValue:r,getContext:I(()=>[t,n,e,l],(s,u,a,d)=>({table:s,column:u,row:a,cell:d,getValue:d.getValue,renderValue:d.renderValue}),T(t.options,"debugCells","cell.getContext"))};return t._features.forEach(s=>{s.createCell==null||s.createCell(l,n,e,t)},{}),l}i(Cr,"createCell");function yr(t,e,n,o){var r,l;let u={...t._getDefaultColumnDef(),...e},a=u.accessorKey,d=(r=(l=u.id)!=null?l:a?typeof String.prototype.replaceAll=="function"?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)!=null?r:typeof u.header=="string"?u.header:void 0,g;if(u.accessorFn?g=u.accessorFn:a&&(a.includes(".")?g=i(f=>{let c=f;for(let h of a.split(".")){var m;c=(m=c)==null?void 0:m[h]}return c},"accessorFn"):g=i(f=>f[u.accessorKey],"accessorFn")),!d)throw new Error;let p={id:`${String(d)}`,accessorFn:g,parent:o,depth:n,columnDef:u,columns:[],getFlatColumns:I(()=>[!0],()=>{var f;return[p,...(f=p.columns)==null?void 0:f.flatMap(c=>c.getFlatColumns())]},T(t.options,"debugColumns","column.getFlatColumns")),getLeafColumns:I(()=>[t._getOrderColumnsFn()],f=>{var c;if((c=p.columns)!=null&&c.length){let m=p.columns.flatMap(h=>h.getLeafColumns());return f(m)}return[p]},T(t.options,"debugColumns","column.getLeafColumns"))};for(let f of t._features)f.createColumn==null||f.createColumn(p,t);return p}i(yr,"createColumn");var ce="debugHeaders";function Qn(t,e,n){var o;let l={id:(o=n.id)!=null?o:e.id,column:e,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:i(()=>{let s=[],u=i(a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(u),s.push(a)},"recurseHeader");return u(l),s},"getLeafHeaders"),getContext:i(()=>({table:t,header:l,column:e}),"getContext")};return t._features.forEach(s=>{s.createHeader==null||s.createHeader(l,t)}),l}i(Qn,"createHeader");var Rr={createTable:i(t=>{t.getHeaderGroups=I(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,o,r)=>{var l,s;let u=(l=o?.map(p=>n.find(f=>f.id===p)).filter(Boolean))!=null?l:[],a=(s=r?.map(p=>n.find(f=>f.id===p)).filter(Boolean))!=null?s:[],d=n.filter(p=>!(o!=null&&o.includes(p.id))&&!(r!=null&&r.includes(p.id)));return Vt(e,[...u,...d,...a],t)},T(t.options,ce,"getHeaderGroups")),t.getCenterHeaderGroups=I(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,o,r)=>(n=n.filter(l=>!(o!=null&&o.includes(l.id))&&!(r!=null&&r.includes(l.id))),Vt(e,n,t,"center")),T(t.options,ce,"getCenterHeaderGroups")),t.getLeftHeaderGroups=I(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(e,n,o)=>{var r;let l=(r=o?.map(s=>n.find(u=>u.id===s)).filter(Boolean))!=null?r:[];return Vt(e,l,t,"left")},T(t.options,ce,"getLeftHeaderGroups")),t.getRightHeaderGroups=I(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(e,n,o)=>{var r;let l=(r=o?.map(s=>n.find(u=>u.id===s)).filter(Boolean))!=null?r:[];return Vt(e,l,t,"right")},T(t.options,ce,"getRightHeaderGroups")),t.getFooterGroups=I(()=>[t.getHeaderGroups()],e=>[...e].reverse(),T(t.options,ce,"getFooterGroups")),t.getLeftFooterGroups=I(()=>[t.getLeftHeaderGroups()],e=>[...e].reverse(),T(t.options,ce,"getLeftFooterGroups")),t.getCenterFooterGroups=I(()=>[t.getCenterHeaderGroups()],e=>[...e].reverse(),T(t.options,ce,"getCenterFooterGroups")),t.getRightFooterGroups=I(()=>[t.getRightHeaderGroups()],e=>[...e].reverse(),T(t.options,ce,"getRightFooterGroups")),t.getFlatHeaders=I(()=>[t.getHeaderGroups()],e=>e.map(n=>n.headers).flat(),T(t.options,ce,"getFlatHeaders")),t.getLeftFlatHeaders=I(()=>[t.getLeftHeaderGroups()],e=>e.map(n=>n.headers).flat(),T(t.options,ce,"getLeftFlatHeaders")),t.getCenterFlatHeaders=I(()=>[t.getCenterHeaderGroups()],e=>e.map(n=>n.headers).flat(),T(t.options,ce,"getCenterFlatHeaders")),t.getRightFlatHeaders=I(()=>[t.getRightHeaderGroups()],e=>e.map(n=>n.headers).flat(),T(t.options,ce,"getRightFlatHeaders")),t.getCenterLeafHeaders=I(()=>[t.getCenterFlatHeaders()],e=>e.filter(n=>{var o;return!((o=n.subHeaders)!=null&&o.length)}),T(t.options,ce,"getCenterLeafHeaders")),t.getLeftLeafHeaders=I(()=>[t.getLeftFlatHeaders()],e=>e.filter(n=>{var o;return!((o=n.subHeaders)!=null&&o.length)}),T(t.options,ce,"getLeftLeafHeaders")),t.getRightLeafHeaders=I(()=>[t.getRightFlatHeaders()],e=>e.filter(n=>{var o;return!((o=n.subHeaders)!=null&&o.length)}),T(t.options,ce,"getRightLeafHeaders")),t.getLeafHeaders=I(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(e,n,o)=>{var r,l,s,u,a,d;return[...(r=(l=e[0])==null?void 0:l.headers)!=null?r:[],...(s=(u=n[0])==null?void 0:u.headers)!=null?s:[],...(a=(d=o[0])==null?void 0:d.headers)!=null?a:[]].map(g=>g.getLeafHeaders()).flat()},T(t.options,ce,"getLeafHeaders"))},"createTable")};function Vt(t,e,n,o){var r,l;let s=0,u=i(function(f,c){c===void 0&&(c=1),s=Math.max(s,c),f.filter(m=>m.getIsVisible()).forEach(m=>{var h;(h=m.columns)!=null&&h.length&&u(m.columns,c+1)},0)},"findMaxDepth");u(t);let a=[],d=i((f,c)=>{let m={depth:c,id:[o,`${c}`].filter(Boolean).join("_"),headers:[]},h=[];f.forEach(b=>{let w=[...h].reverse()[0],x=b.column.depth===m.depth,S,C=!1;if(x&&b.column.parent?S=b.column.parent:(S=b.column,C=!0),w&&w?.column===S)w.subHeaders.push(b);else{let R=Qn(n,S,{id:[o,c,S.id,b?.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${h.filter(_=>_.column===S).length}`:void 0,depth:c,index:h.length});R.subHeaders.push(b),h.push(R)}m.headers.push(b),b.headerGroup=m}),a.push(m),c>0&&d(h,c-1)},"createHeaderGroup"),g=e.map((f,c)=>Qn(n,f,{depth:s,index:c}));d(g,s-1),a.reverse();let p=i(f=>f.filter(m=>m.column.getIsVisible()).map(m=>{let h=0,b=0,w=[0];m.subHeaders&&m.subHeaders.length?(w=[],p(m.subHeaders).forEach(S=>{let{colSpan:C,rowSpan:R}=S;h+=C,w.push(R)})):h=1;let x=Math.min(...w);return b=b+x,m.colSpan=h,m.rowSpan=b,{colSpan:h,rowSpan:b}}),"recurseHeadersForSpans");return p((r=(l=a[0])==null?void 0:l.headers)!=null?r:[]),a}i(Vt,"buildHeaderGroups");var _r=i((t,e,n,o,r,l,s)=>{let u={id:e,index:o,original:n,depth:r,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:i(a=>{if(u._valuesCache.hasOwnProperty(a))return u._valuesCache[a];let d=t.getColumn(a);if(d!=null&&d.accessorFn)return u._valuesCache[a]=d.accessorFn(u.original,o),u._valuesCache[a]},"getValue"),getUniqueValues:i(a=>{if(u._uniqueValuesCache.hasOwnProperty(a))return u._uniqueValuesCache[a];let d=t.getColumn(a);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(u._uniqueValuesCache[a]=d.columnDef.getUniqueValues(u.original,o),u._uniqueValuesCache[a]):(u._uniqueValuesCache[a]=[u.getValue(a)],u._uniqueValuesCache[a])},"getUniqueValues"),renderValue:i(a=>{var d;return(d=u.getValue(a))!=null?d:t.options.renderFallbackValue},"renderValue"),subRows:l??[],getLeafRows:i(()=>Sr(u.subRows,a=>a.subRows),"getLeafRows"),getParentRow:i(()=>u.parentId?t.getRow(u.parentId,!0):void 0,"getParentRow"),getParentRows:i(()=>{let a=[],d=u;for(;;){let g=d.getParentRow();if(!g)break;a.push(g),d=g}return a.reverse()},"getParentRows"),getAllCells:I(()=>[t.getAllLeafColumns()],a=>a.map(d=>Cr(t,u,d,d.id)),T(t.options,"debugRows","getAllCells")),_getAllCellsByColumnId:I(()=>[u.getAllCells()],a=>a.reduce((d,g)=>(d[g.column.id]=g,d),{}),T(t.options,"debugRows","getAllCellsByColumnId"))};for(let a=0;a<t._features.length;a++){let d=t._features[a];d==null||d.createRow==null||d.createRow(u,t)}return u},"createRow"),Fr={createColumn:i((t,e)=>{t._getFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,t.id),t.getFacetedRowModel=()=>t._getFacetedRowModel?t._getFacetedRowModel():e.getPreFilteredRowModel(),t._getFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,t.id),t.getFacetedUniqueValues=()=>t._getFacetedUniqueValues?t._getFacetedUniqueValues():new Map,t._getFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,t.id),t.getFacetedMinMaxValues=()=>{if(t._getFacetedMinMaxValues)return t._getFacetedMinMaxValues()}},"createColumn")},Xn=i((t,e,n)=>{var o,r;let l=n==null||(o=n.toString())==null?void 0:o.toLowerCase();return!!(!((r=t.getValue(e))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(l))},"includesString");Xn.autoRemove=t=>Ve(t);var Yn=i((t,e,n)=>{var o;return!!(!((o=t.getValue(e))==null||(o=o.toString())==null)&&o.includes(n))},"includesStringSensitive");Yn.autoRemove=t=>Ve(t);var Zn=i((t,e,n)=>{var o;return((o=t.getValue(e))==null||(o=o.toString())==null?void 0:o.toLowerCase())===n?.toLowerCase()},"equalsString");Zn.autoRemove=t=>Ve(t);var eo=i((t,e,n)=>{var o;return(o=t.getValue(e))==null?void 0:o.includes(n)},"arrIncludes");eo.autoRemove=t=>Ve(t);var to=i((t,e,n)=>!n.some(o=>{var r;return!((r=t.getValue(e))!=null&&r.includes(o))}),"arrIncludesAll");to.autoRemove=t=>Ve(t)||!(t!=null&&t.length);var no=i((t,e,n)=>n.some(o=>{var r;return(r=t.getValue(e))==null?void 0:r.includes(o)}),"arrIncludesSome");no.autoRemove=t=>Ve(t)||!(t!=null&&t.length);var oo=i((t,e,n)=>t.getValue(e)===n,"equals");oo.autoRemove=t=>Ve(t);var ro=i((t,e,n)=>t.getValue(e)==n,"weakEquals");ro.autoRemove=t=>Ve(t);var ln=i((t,e,n)=>{let[o,r]=n,l=t.getValue(e);return l>=o&&l<=r},"inNumberRange");ln.resolveFilterValue=t=>{let[e,n]=t,o=typeof e!="number"?parseFloat(e):e,r=typeof n!="number"?parseFloat(n):n,l=e===null||Number.isNaN(o)?-1/0:o,s=n===null||Number.isNaN(r)?1/0:r;if(l>s){let u=l;l=s,s=u}return[l,s]};ln.autoRemove=t=>Ve(t)||Ve(t[0])&&Ve(t[1]);var qe={includesString:Xn,includesStringSensitive:Yn,equalsString:Zn,arrIncludes:eo,arrIncludesAll:to,arrIncludesSome:no,equals:oo,weakEquals:ro,inNumberRange:ln};function Ve(t){return t==null||t===""}i(Ve,"testFalsey");var $r={getDefaultColumnDef:i(()=>({filterFn:"auto"}),"getDefaultColumnDef"),getInitialState:i(t=>({columnFilters:[],...t}),"getInitialState"),getDefaultOptions:i(t=>({onColumnFiltersChange:Ce("columnFilters",t),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),"getDefaultOptions"),createColumn:i((t,e)=>{t.getAutoFilterFn=()=>{let n=e.getCoreRowModel().flatRows[0],o=n?.getValue(t.id);return typeof o=="string"?qe.includesString:typeof o=="number"?qe.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?qe.equals:Array.isArray(o)?qe.arrIncludes:qe.weakEquals},t.getFilterFn=()=>{var n,o;return Tt(t.columnDef.filterFn)?t.columnDef.filterFn:t.columnDef.filterFn==="auto"?t.getAutoFilterFn():(n=(o=e.options.filterFns)==null?void 0:o[t.columnDef.filterFn])!=null?n:qe[t.columnDef.filterFn]},t.getCanFilter=()=>{var n,o,r;return((n=t.columnDef.enableColumnFilter)!=null?n:!0)&&((o=e.options.enableColumnFilters)!=null?o:!0)&&((r=e.options.enableFilters)!=null?r:!0)&&!!t.accessorFn},t.getIsFiltered=()=>t.getFilterIndex()>-1,t.getFilterValue=()=>{var n;return(n=e.getState().columnFilters)==null||(n=n.find(o=>o.id===t.id))==null?void 0:n.value},t.getFilterIndex=()=>{var n,o;return(n=(o=e.getState().columnFilters)==null?void 0:o.findIndex(r=>r.id===t.id))!=null?n:-1},t.setFilterValue=n=>{e.setColumnFilters(o=>{let r=t.getFilterFn(),l=o?.find(g=>g.id===t.id),s=We(n,l?l.value:void 0);if(Wn(r,s,t)){var u;return(u=o?.filter(g=>g.id!==t.id))!=null?u:[]}let a={id:t.id,value:s};if(l){var d;return(d=o?.map(g=>g.id===t.id?a:g))!=null?d:[]}return o!=null&&o.length?[...o,a]:[a]})}},"createColumn"),createRow:i((t,e)=>{t.columnFilters={},t.columnFiltersMeta={}},"createRow"),createTable:i(t=>{t.setColumnFilters=e=>{let n=t.getAllLeafColumns(),o=i(r=>{var l;return(l=We(e,r))==null?void 0:l.filter(s=>{let u=n.find(a=>a.id===s.id);if(u){let a=u.getFilterFn();if(Wn(a,s.value,u))return!1}return!0})},"updateFn");t.options.onColumnFiltersChange==null||t.options.onColumnFiltersChange(o)},t.resetColumnFilters=e=>{var n,o;t.setColumnFilters(e?[]:(n=(o=t.initialState)==null?void 0:o.columnFilters)!=null?n:[])},t.getPreFilteredRowModel=()=>t.getCoreRowModel(),t.getFilteredRowModel=()=>(!t._getFilteredRowModel&&t.options.getFilteredRowModel&&(t._getFilteredRowModel=t.options.getFilteredRowModel(t)),t.options.manualFiltering||!t._getFilteredRowModel?t.getPreFilteredRowModel():t._getFilteredRowModel())},"createTable")};function Wn(t,e,n){return(t&&t.autoRemove?t.autoRemove(e,n):!1)||typeof e>"u"||typeof e=="string"&&!e}i(Wn,"shouldAutoRemoveFilter");var Nr=i((t,e,n)=>n.reduce((o,r)=>{let l=r.getValue(t);return o+(typeof l=="number"?l:0)},0),"sum"),Mr=i((t,e,n)=>{let o;return n.forEach(r=>{let l=r.getValue(t);l!=null&&(o>l||o===void 0&&l>=l)&&(o=l)}),o},"min"),Pr=i((t,e,n)=>{let o;return n.forEach(r=>{let l=r.getValue(t);l!=null&&(o<l||o===void 0&&l>=l)&&(o=l)}),o},"max"),kr=i((t,e,n)=>{let o,r;return n.forEach(l=>{let s=l.getValue(t);s!=null&&(o===void 0?s>=s&&(o=r=s):(o>s&&(o=s),r<s&&(r=s)))}),[o,r]},"extent"),Vr=i((t,e)=>{let n=0,o=0;if(e.forEach(r=>{let l=r.getValue(t);l!=null&&(l=+l)>=l&&(++n,o+=l)}),n)return o/n},"mean"),Er=i((t,e)=>{if(!e.length)return;let n=e.map(l=>l.getValue(t));if(!xr(n))return;if(n.length===1)return n[0];let o=Math.floor(n.length/2),r=n.sort((l,s)=>l-s);return n.length%2!==0?r[o]:(r[o-1]+r[o])/2},"median"),Ir=i((t,e)=>Array.from(new Set(e.map(n=>n.getValue(t))).values()),"unique"),Tr=i((t,e)=>new Set(e.map(n=>n.getValue(t))).size,"uniqueCount"),Dr=i((t,e)=>e.length,"count"),Ut={sum:Nr,min:Mr,max:Pr,extent:kr,mean:Vr,median:Er,unique:Ir,uniqueCount:Tr,count:Dr},zr={getDefaultColumnDef:i(()=>({aggregatedCell:i(t=>{var e,n;return(e=(n=t.getValue())==null||n.toString==null?void 0:n.toString())!=null?e:null},"aggregatedCell"),aggregationFn:"auto"}),"getDefaultColumnDef"),getInitialState:i(t=>({grouping:[],...t}),"getInitialState"),getDefaultOptions:i(t=>({onGroupingChange:Ce("grouping",t),groupedColumnMode:"reorder"}),"getDefaultOptions"),createColumn:i((t,e)=>{t.toggleGrouping=()=>{e.setGrouping(n=>n!=null&&n.includes(t.id)?n.filter(o=>o!==t.id):[...n??[],t.id])},t.getCanGroup=()=>{var n,o;return((n=t.columnDef.enableGrouping)!=null?n:!0)&&((o=e.options.enableGrouping)!=null?o:!0)&&(!!t.accessorFn||!!t.columnDef.getGroupingValue)},t.getIsGrouped=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.includes(t.id)},t.getGroupedIndex=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.indexOf(t.id)},t.getToggleGroupingHandler=()=>{let n=t.getCanGroup();return()=>{n&&t.toggleGrouping()}},t.getAutoAggregationFn=()=>{let n=e.getCoreRowModel().flatRows[0],o=n?.getValue(t.id);if(typeof o=="number")return Ut.sum;if(Object.prototype.toString.call(o)==="[object Date]")return Ut.extent},t.getAggregationFn=()=>{var n,o;if(!t)throw new Error;return Tt(t.columnDef.aggregationFn)?t.columnDef.aggregationFn:t.columnDef.aggregationFn==="auto"?t.getAutoAggregationFn():(n=(o=e.options.aggregationFns)==null?void 0:o[t.columnDef.aggregationFn])!=null?n:Ut[t.columnDef.aggregationFn]}},"createColumn"),createTable:i(t=>{t.setGrouping=e=>t.options.onGroupingChange==null?void 0:t.options.onGroupingChange(e),t.resetGrouping=e=>{var n,o;t.setGrouping(e?[]:(n=(o=t.initialState)==null?void 0:o.grouping)!=null?n:[])},t.getPreGroupedRowModel=()=>t.getFilteredRowModel(),t.getGroupedRowModel=()=>(!t._getGroupedRowModel&&t.options.getGroupedRowModel&&(t._getGroupedRowModel=t.options.getGroupedRowModel(t)),t.options.manualGrouping||!t._getGroupedRowModel?t.getPreGroupedRowModel():t._getGroupedRowModel())},"createTable"),createRow:i((t,e)=>{t.getIsGrouped=()=>!!t.groupingColumnId,t.getGroupingValue=n=>{if(t._groupingValuesCache.hasOwnProperty(n))return t._groupingValuesCache[n];let o=e.getColumn(n);return o!=null&&o.columnDef.getGroupingValue?(t._groupingValuesCache[n]=o.columnDef.getGroupingValue(t.original),t._groupingValuesCache[n]):t.getValue(n)},t._groupingValuesCache={}},"createRow"),createCell:i((t,e,n,o)=>{t.getIsGrouped=()=>e.getIsGrouped()&&e.id===n.groupingColumnId,t.getIsPlaceholder=()=>!t.getIsGrouped()&&e.getIsGrouped(),t.getIsAggregated=()=>{var r;return!t.getIsGrouped()&&!t.getIsPlaceholder()&&!!((r=n.subRows)!=null&&r.length)}},"createCell")};function Or(t,e,n){if(!(e!=null&&e.length)||!n)return t;let o=t.filter(l=>!e.includes(l.id));return n==="remove"?o:[...e.map(l=>t.find(s=>s.id===l)).filter(Boolean),...o]}i(Or,"orderColumns");var Ar={getInitialState:i(t=>({columnOrder:[],...t}),"getInitialState"),getDefaultOptions:i(t=>({onColumnOrderChange:Ce("columnOrder",t)}),"getDefaultOptions"),createColumn:i((t,e)=>{t.getIndex=I(n=>[bt(e,n)],n=>n.findIndex(o=>o.id===t.id),T(e.options,"debugColumns","getIndex")),t.getIsFirstColumn=n=>{var o;return((o=bt(e,n)[0])==null?void 0:o.id)===t.id},t.getIsLastColumn=n=>{var o;let r=bt(e,n);return((o=r[r.length-1])==null?void 0:o.id)===t.id}},"createColumn"),createTable:i(t=>{t.setColumnOrder=e=>t.options.onColumnOrderChange==null?void 0:t.options.onColumnOrderChange(e),t.resetColumnOrder=e=>{var n;t.setColumnOrder(e?[]:(n=t.initialState.columnOrder)!=null?n:[])},t._getOrderColumnsFn=I(()=>[t.getState().columnOrder,t.getState().grouping,t.options.groupedColumnMode],(e,n,o)=>r=>{let l=[];if(!(e!=null&&e.length))l=r;else{let s=[...e],u=[...r];for(;u.length&&s.length;){let a=s.shift(),d=u.findIndex(g=>g.id===a);d>-1&&l.push(u.splice(d,1)[0])}l=[...l,...u]}return Or(l,n,o)},T(t.options,"debugTable","_getOrderColumnsFn"))},"createTable")},Kt=i(()=>({left:[],right:[]}),"getDefaultColumnPinningState"),Lr={getInitialState:i(t=>({columnPinning:Kt(),...t}),"getInitialState"),getDefaultOptions:i(t=>({onColumnPinningChange:Ce("columnPinning",t)}),"getDefaultOptions"),createColumn:i((t,e)=>{t.pin=n=>{let o=t.getLeafColumns().map(r=>r.id).filter(Boolean);e.setColumnPinning(r=>{var l,s;if(n==="right"){var u,a;return{left:((u=r?.left)!=null?u:[]).filter(p=>!(o!=null&&o.includes(p))),right:[...((a=r?.right)!=null?a:[]).filter(p=>!(o!=null&&o.includes(p))),...o]}}if(n==="left"){var d,g;return{left:[...((d=r?.left)!=null?d:[]).filter(p=>!(o!=null&&o.includes(p))),...o],right:((g=r?.right)!=null?g:[]).filter(p=>!(o!=null&&o.includes(p)))}}return{left:((l=r?.left)!=null?l:[]).filter(p=>!(o!=null&&o.includes(p))),right:((s=r?.right)!=null?s:[]).filter(p=>!(o!=null&&o.includes(p)))}})},t.getCanPin=()=>t.getLeafColumns().some(o=>{var r,l,s;return((r=o.columnDef.enablePinning)!=null?r:!0)&&((l=(s=e.options.enableColumnPinning)!=null?s:e.options.enablePinning)!=null?l:!0)}),t.getIsPinned=()=>{let n=t.getLeafColumns().map(u=>u.id),{left:o,right:r}=e.getState().columnPinning,l=n.some(u=>o?.includes(u)),s=n.some(u=>r?.includes(u));return l?"left":s?"right":!1},t.getPinnedIndex=()=>{var n,o;let r=t.getIsPinned();return r?(n=(o=e.getState().columnPinning)==null||(o=o[r])==null?void 0:o.indexOf(t.id))!=null?n:-1:0}},"createColumn"),createRow:i((t,e)=>{t.getCenterVisibleCells=I(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,o,r)=>{let l=[...o??[],...r??[]];return n.filter(s=>!l.includes(s.column.id))},T(e.options,"debugRows","getCenterVisibleCells")),t.getLeftVisibleCells=I(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left],(n,o)=>(o??[]).map(l=>n.find(s=>s.column.id===l)).filter(Boolean).map(l=>({...l,position:"left"})),T(e.options,"debugRows","getLeftVisibleCells")),t.getRightVisibleCells=I(()=>[t._getAllVisibleCells(),e.getState().columnPinning.right],(n,o)=>(o??[]).map(l=>n.find(s=>s.column.id===l)).filter(Boolean).map(l=>({...l,position:"right"})),T(e.options,"debugRows","getRightVisibleCells"))},"createRow"),createTable:i(t=>{t.setColumnPinning=e=>t.options.onColumnPinningChange==null?void 0:t.options.onColumnPinningChange(e),t.resetColumnPinning=e=>{var n,o;return t.setColumnPinning(e?Kt():(n=(o=t.initialState)==null?void 0:o.columnPinning)!=null?n:Kt())},t.getIsSomeColumnsPinned=e=>{var n;let o=t.getState().columnPinning;if(!e){var r,l;return!!((r=o.left)!=null&&r.length||(l=o.right)!=null&&l.length)}return!!((n=o[e])!=null&&n.length)},t.getLeftLeafColumns=I(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(e,n)=>(n??[]).map(o=>e.find(r=>r.id===o)).filter(Boolean),T(t.options,"debugColumns","getLeftLeafColumns")),t.getRightLeafColumns=I(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(e,n)=>(n??[]).map(o=>e.find(r=>r.id===o)).filter(Boolean),T(t.options,"debugColumns","getRightLeafColumns")),t.getCenterLeafColumns=I(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,o)=>{let r=[...n??[],...o??[]];return e.filter(l=>!r.includes(l.id))},T(t.options,"debugColumns","getCenterLeafColumns"))},"createTable")};function Gr(t){return t||(typeof document<"u"?document:null)}i(Gr,"safelyAccessDocument");var Et={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Qt=i(()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),"getDefaultColumnSizingInfoState"),Hr={getDefaultColumnDef:i(()=>Et,"getDefaultColumnDef"),getInitialState:i(t=>({columnSizing:{},columnSizingInfo:Qt(),...t}),"getInitialState"),getDefaultOptions:i(t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Ce("columnSizing",t),onColumnSizingInfoChange:Ce("columnSizingInfo",t)}),"getDefaultOptions"),createColumn:i((t,e)=>{t.getSize=()=>{var n,o,r;let l=e.getState().columnSizing[t.id];return Math.min(Math.max((n=t.columnDef.minSize)!=null?n:Et.minSize,(o=l??t.columnDef.size)!=null?o:Et.size),(r=t.columnDef.maxSize)!=null?r:Et.maxSize)},t.getStart=I(n=>[n,bt(e,n),e.getState().columnSizing],(n,o)=>o.slice(0,t.getIndex(n)).reduce((r,l)=>r+l.getSize(),0),T(e.options,"debugColumns","getStart")),t.getAfter=I(n=>[n,bt(e,n),e.getState().columnSizing],(n,o)=>o.slice(t.getIndex(n)+1).reduce((r,l)=>r+l.getSize(),0),T(e.options,"debugColumns","getAfter")),t.resetSize=()=>{e.setColumnSizing(n=>{let{[t.id]:o,...r}=n;return r})},t.getCanResize=()=>{var n,o;return((n=t.columnDef.enableResizing)!=null?n:!0)&&((o=e.options.enableColumnResizing)!=null?o:!0)},t.getIsResizing=()=>e.getState().columnSizingInfo.isResizingColumn===t.id},"createColumn"),createHeader:i((t,e)=>{t.getSize=()=>{let n=0,o=i(r=>{if(r.subHeaders.length)r.subHeaders.forEach(o);else{var l;n+=(l=r.column.getSize())!=null?l:0}},"recurse");return o(t),n},t.getStart=()=>{if(t.index>0){let n=t.headerGroup.headers[t.index-1];return n.getStart()+n.getSize()}return 0},t.getResizeHandler=n=>{let o=e.getColumn(t.column.id),r=o?.getCanResize();return l=>{if(!o||!r||(l.persist==null||l.persist(),Wt(l)&&l.touches&&l.touches.length>1))return;let s=t.getSize(),u=t?t.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[o.id,o.getSize()]],a=Wt(l)?Math.round(l.touches[0].clientX):l.clientX,d={},g=i((w,x)=>{typeof x=="number"&&(e.setColumnSizingInfo(S=>{var C,R;let _=e.options.columnResizeDirection==="rtl"?-1:1,y=(x-((C=S?.startOffset)!=null?C:0))*_,F=Math.max(y/((R=S?.startSize)!=null?R:0),-.999999);return S.columnSizingStart.forEach(M=>{let[$,k]=M;d[$]=Math.round(Math.max(k+k*F,0)*100)/100}),{...S,deltaOffset:y,deltaPercentage:F}}),(e.options.columnResizeMode==="onChange"||w==="end")&&e.setColumnSizing(S=>({...S,...d})))},"updateOffset"),p=i(w=>g("move",w),"onMove"),f=i(w=>{g("end",w),e.setColumnSizingInfo(x=>({...x,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},"onEnd"),c=Gr(n),m={moveHandler:i(w=>p(w.clientX),"moveHandler"),upHandler:i(w=>{c?.removeEventListener("mousemove",m.moveHandler),c?.removeEventListener("mouseup",m.upHandler),f(w.clientX)},"upHandler")},h={moveHandler:i(w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),p(w.touches[0].clientX),!1),"moveHandler"),upHandler:i(w=>{var x;c?.removeEventListener("touchmove",h.moveHandler),c?.removeEventListener("touchend",h.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),f((x=w.touches[0])==null?void 0:x.clientX)},"upHandler")},b=jr()?{passive:!1}:!1;Wt(l)?(c?.addEventListener("touchmove",h.moveHandler,b),c?.addEventListener("touchend",h.upHandler,b)):(c?.addEventListener("mousemove",m.moveHandler,b),c?.addEventListener("mouseup",m.upHandler,b)),e.setColumnSizingInfo(w=>({...w,startOffset:a,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:o.id}))}}},"createHeader"),createTable:i(t=>{t.setColumnSizing=e=>t.options.onColumnSizingChange==null?void 0:t.options.onColumnSizingChange(e),t.setColumnSizingInfo=e=>t.options.onColumnSizingInfoChange==null?void 0:t.options.onColumnSizingInfoChange(e),t.resetColumnSizing=e=>{var n;t.setColumnSizing(e?{}:(n=t.initialState.columnSizing)!=null?n:{})},t.resetHeaderSizeInfo=e=>{var n;t.setColumnSizingInfo(e?Qt():(n=t.initialState.columnSizingInfo)!=null?n:Qt())},t.getTotalSize=()=>{var e,n;return(e=(n=t.getHeaderGroups()[0])==null?void 0:n.headers.reduce((o,r)=>o+r.getSize(),0))!=null?e:0},t.getLeftTotalSize=()=>{var e,n;return(e=(n=t.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((o,r)=>o+r.getSize(),0))!=null?e:0},t.getCenterTotalSize=()=>{var e,n;return(e=(n=t.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((o,r)=>o+r.getSize(),0))!=null?e:0},t.getRightTotalSize=()=>{var e,n;return(e=(n=t.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((o,r)=>o+r.getSize(),0))!=null?e:0}},"createTable")},It=null;function jr(){if(typeof It=="boolean")return It;let t=!1;try{let e={get passive(){return t=!0,!1}},n=i(()=>{},"noop");window.addEventListener("test",n,e),window.removeEventListener("test",n)}catch{t=!1}return It=t,It}i(jr,"passiveEventSupported");function Wt(t){return t.type==="touchstart"}i(Wt,"isTouchStartEvent");var Br={getInitialState:i(t=>({columnVisibility:{},...t}),"getInitialState"),getDefaultOptions:i(t=>({onColumnVisibilityChange:Ce("columnVisibility",t)}),"getDefaultOptions"),createColumn:i((t,e)=>{t.toggleVisibility=n=>{t.getCanHide()&&e.setColumnVisibility(o=>({...o,[t.id]:n??!t.getIsVisible()}))},t.getIsVisible=()=>{var n,o;let r=t.columns;return(n=r.length?r.some(l=>l.getIsVisible()):(o=e.getState().columnVisibility)==null?void 0:o[t.id])!=null?n:!0},t.getCanHide=()=>{var n,o;return((n=t.columnDef.enableHiding)!=null?n:!0)&&((o=e.options.enableHiding)!=null?o:!0)},t.getToggleVisibilityHandler=()=>n=>{t.toggleVisibility==null||t.toggleVisibility(n.target.checked)}},"createColumn"),createRow:i((t,e)=>{t._getAllVisibleCells=I(()=>[t.getAllCells(),e.getState().columnVisibility],n=>n.filter(o=>o.column.getIsVisible()),T(e.options,"debugRows","_getAllVisibleCells")),t.getVisibleCells=I(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(n,o,r)=>[...n,...o,...r],T(e.options,"debugRows","getVisibleCells"))},"createRow"),createTable:i(t=>{let e=i((n,o)=>I(()=>[o(),o().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(l=>l.getIsVisible==null?void 0:l.getIsVisible()),T(t.options,"debugColumns",n)),"makeVisibleColumnsMethod");t.getVisibleFlatColumns=e("getVisibleFlatColumns",()=>t.getAllFlatColumns()),t.getVisibleLeafColumns=e("getVisibleLeafColumns",()=>t.getAllLeafColumns()),t.getLeftVisibleLeafColumns=e("getLeftVisibleLeafColumns",()=>t.getLeftLeafColumns()),t.getRightVisibleLeafColumns=e("getRightVisibleLeafColumns",()=>t.getRightLeafColumns()),t.getCenterVisibleLeafColumns=e("getCenterVisibleLeafColumns",()=>t.getCenterLeafColumns()),t.setColumnVisibility=n=>t.options.onColumnVisibilityChange==null?void 0:t.options.onColumnVisibilityChange(n),t.resetColumnVisibility=n=>{var o;t.setColumnVisibility(n?{}:(o=t.initialState.columnVisibility)!=null?o:{})},t.toggleAllColumnsVisible=n=>{var o;n=(o=n)!=null?o:!t.getIsAllColumnsVisible(),t.setColumnVisibility(t.getAllLeafColumns().reduce((r,l)=>({...r,[l.id]:n||!(l.getCanHide!=null&&l.getCanHide())}),{}))},t.getIsAllColumnsVisible=()=>!t.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),t.getIsSomeColumnsVisible=()=>t.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),t.getToggleAllColumnsVisibilityHandler=()=>n=>{var o;t.toggleAllColumnsVisible((o=n.target)==null?void 0:o.checked)}},"createTable")};function bt(t,e){return e?e==="center"?t.getCenterVisibleLeafColumns():e==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns()}i(bt,"_getVisibleLeafColumns");var qr={createTable:i(t=>{t._getGlobalFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,"__global__"),t.getGlobalFacetedRowModel=()=>t.options.manualFiltering||!t._getGlobalFacetedRowModel?t.getPreFilteredRowModel():t._getGlobalFacetedRowModel(),t._getGlobalFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,"__global__"),t.getGlobalFacetedUniqueValues=()=>t._getGlobalFacetedUniqueValues?t._getGlobalFacetedUniqueValues():new Map,t._getGlobalFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,"__global__"),t.getGlobalFacetedMinMaxValues=()=>{if(t._getGlobalFacetedMinMaxValues)return t._getGlobalFacetedMinMaxValues()}},"createTable")},Jr={getInitialState:i(t=>({globalFilter:void 0,...t}),"getInitialState"),getDefaultOptions:i(t=>({onGlobalFilterChange:Ce("globalFilter",t),globalFilterFn:"auto",getColumnCanGlobalFilter:i(e=>{var n;let o=(n=t.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[e.id])==null?void 0:n.getValue();return typeof o=="string"||typeof o=="number"},"getColumnCanGlobalFilter")}),"getDefaultOptions"),createColumn:i((t,e)=>{t.getCanGlobalFilter=()=>{var n,o,r,l;return((n=t.columnDef.enableGlobalFilter)!=null?n:!0)&&((o=e.options.enableGlobalFilter)!=null?o:!0)&&((r=e.options.enableFilters)!=null?r:!0)&&((l=e.options.getColumnCanGlobalFilter==null?void 0:e.options.getColumnCanGlobalFilter(t))!=null?l:!0)&&!!t.accessorFn}},"createColumn"),createTable:i(t=>{t.getGlobalAutoFilterFn=()=>qe.includesString,t.getGlobalFilterFn=()=>{var e,n;let{globalFilterFn:o}=t.options;return Tt(o)?o:o==="auto"?t.getGlobalAutoFilterFn():(e=(n=t.options.filterFns)==null?void 0:n[o])!=null?e:qe[o]},t.setGlobalFilter=e=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(e)},t.resetGlobalFilter=e=>{t.setGlobalFilter(e?void 0:t.initialState.globalFilter)}},"createTable")},Ur={getInitialState:i(t=>({expanded:{},...t}),"getInitialState"),getDefaultOptions:i(t=>({onExpandedChange:Ce("expanded",t),paginateExpandedRows:!0}),"getDefaultOptions"),createTable:i(t=>{let e=!1,n=!1;t._autoResetExpanded=()=>{var o,r;if(!e){t._queue(()=>{e=!0});return}if((o=(r=t.options.autoResetAll)!=null?r:t.options.autoResetExpanded)!=null?o:!t.options.manualExpanding){if(n)return;n=!0,t._queue(()=>{t.resetExpanded(),n=!1})}},t.setExpanded=o=>t.options.onExpandedChange==null?void 0:t.options.onExpandedChange(o),t.toggleAllRowsExpanded=o=>{o??!t.getIsAllRowsExpanded()?t.setExpanded(!0):t.setExpanded({})},t.resetExpanded=o=>{var r,l;t.setExpanded(o?{}:(r=(l=t.initialState)==null?void 0:l.expanded)!=null?r:{})},t.getCanSomeRowsExpand=()=>t.getPrePaginationRowModel().flatRows.some(o=>o.getCanExpand()),t.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),t.toggleAllRowsExpanded()},t.getIsSomeRowsExpanded=()=>{let o=t.getState().expanded;return o===!0||Object.values(o).some(Boolean)},t.getIsAllRowsExpanded=()=>{let o=t.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||t.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},t.getExpandedDepth=()=>{let o=0;return(t.getState().expanded===!0?Object.keys(t.getRowModel().rowsById):Object.keys(t.getState().expanded)).forEach(l=>{let s=l.split(".");o=Math.max(o,s.length)}),o},t.getPreExpandedRowModel=()=>t.getSortedRowModel(),t.getExpandedRowModel=()=>(!t._getExpandedRowModel&&t.options.getExpandedRowModel&&(t._getExpandedRowModel=t.options.getExpandedRowModel(t)),t.options.manualExpanding||!t._getExpandedRowModel?t.getPreExpandedRowModel():t._getExpandedRowModel())},"createTable"),createRow:i((t,e)=>{t.toggleExpanded=n=>{e.setExpanded(o=>{var r;let l=o===!0?!0:!!(o!=null&&o[t.id]),s={};if(o===!0?Object.keys(e.getRowModel().rowsById).forEach(u=>{s[u]=!0}):s=o,n=(r=n)!=null?r:!l,!l&&n)return{...s,[t.id]:!0};if(l&&!n){let{[t.id]:u,...a}=s;return a}return o})},t.getIsExpanded=()=>{var n;let o=e.getState().expanded;return!!((n=e.options.getIsRowExpanded==null?void 0:e.options.getIsRowExpanded(t))!=null?n:o===!0||o?.[t.id])},t.getCanExpand=()=>{var n,o,r;return(n=e.options.getRowCanExpand==null?void 0:e.options.getRowCanExpand(t))!=null?n:((o=e.options.enableExpanding)!=null?o:!0)&&!!((r=t.subRows)!=null&&r.length)},t.getIsAllParentsExpanded=()=>{let n=!0,o=t;for(;n&&o.parentId;)o=e.getRow(o.parentId,!0),n=o.getIsExpanded();return n},t.getToggleExpandedHandler=()=>{let n=t.getCanExpand();return()=>{n&&t.toggleExpanded()}}},"createRow")},en=0,tn=10,Xt=i(()=>({pageIndex:en,pageSize:tn}),"getDefaultPaginationState"),Kr={getInitialState:i(t=>({...t,pagination:{...Xt(),...t?.pagination}}),"getInitialState"),getDefaultOptions:i(t=>({onPaginationChange:Ce("pagination",t)}),"getDefaultOptions"),createTable:i(t=>{let e=!1,n=!1;t._autoResetPageIndex=()=>{var o,r;if(!e){t._queue(()=>{e=!0});return}if((o=(r=t.options.autoResetAll)!=null?r:t.options.autoResetPageIndex)!=null?o:!t.options.manualPagination){if(n)return;n=!0,t._queue(()=>{t.resetPageIndex(),n=!1})}},t.setPagination=o=>{let r=i(l=>We(o,l),"safeUpdater");return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(r)},t.resetPagination=o=>{var r;t.setPagination(o?Xt():(r=t.initialState.pagination)!=null?r:Xt())},t.setPageIndex=o=>{t.setPagination(r=>{let l=We(o,r.pageIndex),s=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return l=Math.max(0,Math.min(l,s)),{...r,pageIndex:l}})},t.resetPageIndex=o=>{var r,l;t.setPageIndex(o?en:(r=(l=t.initialState)==null||(l=l.pagination)==null?void 0:l.pageIndex)!=null?r:en)},t.resetPageSize=o=>{var r,l;t.setPageSize(o?tn:(r=(l=t.initialState)==null||(l=l.pagination)==null?void 0:l.pageSize)!=null?r:tn)},t.setPageSize=o=>{t.setPagination(r=>{let l=Math.max(1,We(o,r.pageSize)),s=r.pageSize*r.pageIndex,u=Math.floor(s/l);return{...r,pageIndex:u,pageSize:l}})},t.setPageCount=o=>t.setPagination(r=>{var l;let s=We(o,(l=t.options.pageCount)!=null?l:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...r,pageCount:s}}),t.getPageOptions=I(()=>[t.getPageCount()],o=>{let r=[];return o&&o>0&&(r=[...new Array(o)].fill(null).map((l,s)=>s)),r},T(t.options,"debugTable","getPageOptions")),t.getCanPreviousPage=()=>t.getState().pagination.pageIndex>0,t.getCanNextPage=()=>{let{pageIndex:o}=t.getState().pagination,r=t.getPageCount();return r===-1?!0:r===0?!1:o<r-1},t.previousPage=()=>t.setPageIndex(o=>o-1),t.nextPage=()=>t.setPageIndex(o=>o+1),t.firstPage=()=>t.setPageIndex(0),t.lastPage=()=>t.setPageIndex(t.getPageCount()-1),t.getPrePaginationRowModel=()=>t.getExpandedRowModel(),t.getPaginationRowModel=()=>(!t._getPaginationRowModel&&t.options.getPaginationRowModel&&(t._getPaginationRowModel=t.options.getPaginationRowModel(t)),t.options.manualPagination||!t._getPaginationRowModel?t.getPrePaginationRowModel():t._getPaginationRowModel()),t.getPageCount=()=>{var o;return(o=t.options.pageCount)!=null?o:Math.ceil(t.getRowCount()/t.getState().pagination.pageSize)},t.getRowCount=()=>{var o;return(o=t.options.rowCount)!=null?o:t.getPrePaginationRowModel().rows.length}},"createTable")},Yt=i(()=>({top:[],bottom:[]}),"getDefaultRowPinningState"),Qr={getInitialState:i(t=>({rowPinning:Yt(),...t}),"getInitialState"),getDefaultOptions:i(t=>({onRowPinningChange:Ce("rowPinning",t)}),"getDefaultOptions"),createRow:i((t,e)=>{t.pin=(n,o,r)=>{let l=o?t.getLeafRows().map(a=>{let{id:d}=a;return d}):[],s=r?t.getParentRows().map(a=>{let{id:d}=a;return d}):[],u=new Set([...s,t.id,...l]);e.setRowPinning(a=>{var d,g;if(n==="bottom"){var p,f;return{top:((p=a?.top)!=null?p:[]).filter(h=>!(u!=null&&u.has(h))),bottom:[...((f=a?.bottom)!=null?f:[]).filter(h=>!(u!=null&&u.has(h))),...Array.from(u)]}}if(n==="top"){var c,m;return{top:[...((c=a?.top)!=null?c:[]).filter(h=>!(u!=null&&u.has(h))),...Array.from(u)],bottom:((m=a?.bottom)!=null?m:[]).filter(h=>!(u!=null&&u.has(h)))}}return{top:((d=a?.top)!=null?d:[]).filter(h=>!(u!=null&&u.has(h))),bottom:((g=a?.bottom)!=null?g:[]).filter(h=>!(u!=null&&u.has(h)))}})},t.getCanPin=()=>{var n;let{enableRowPinning:o,enablePinning:r}=e.options;return typeof o=="function"?o(t):(n=o??r)!=null?n:!0},t.getIsPinned=()=>{let n=[t.id],{top:o,bottom:r}=e.getState().rowPinning,l=n.some(u=>o?.includes(u)),s=n.some(u=>r?.includes(u));return l?"top":s?"bottom":!1},t.getPinnedIndex=()=>{var n,o;let r=t.getIsPinned();if(!r)return-1;let l=(n=r==="top"?e.getTopRows():e.getBottomRows())==null?void 0:n.map(s=>{let{id:u}=s;return u});return(o=l?.indexOf(t.id))!=null?o:-1}},"createRow"),createTable:i(t=>{t.setRowPinning=e=>t.options.onRowPinningChange==null?void 0:t.options.onRowPinningChange(e),t.resetRowPinning=e=>{var n,o;return t.setRowPinning(e?Yt():(n=(o=t.initialState)==null?void 0:o.rowPinning)!=null?n:Yt())},t.getIsSomeRowsPinned=e=>{var n;let o=t.getState().rowPinning;if(!e){var r,l;return!!((r=o.top)!=null&&r.length||(l=o.bottom)!=null&&l.length)}return!!((n=o[e])!=null&&n.length)},t._getPinnedRows=(e,n,o)=>{var r;return((r=t.options.keepPinnedRows)==null||r?(n??[]).map(s=>{let u=t.getRow(s,!0);return u.getIsAllParentsExpanded()?u:null}):(n??[]).map(s=>e.find(u=>u.id===s))).filter(Boolean).map(s=>({...s,position:o}))},t.getTopRows=I(()=>[t.getRowModel().rows,t.getState().rowPinning.top],(e,n)=>t._getPinnedRows(e,n,"top"),T(t.options,"debugRows","getTopRows")),t.getBottomRows=I(()=>[t.getRowModel().rows,t.getState().rowPinning.bottom],(e,n)=>t._getPinnedRows(e,n,"bottom"),T(t.options,"debugRows","getBottomRows")),t.getCenterRows=I(()=>[t.getRowModel().rows,t.getState().rowPinning.top,t.getState().rowPinning.bottom],(e,n,o)=>{let r=new Set([...n??[],...o??[]]);return e.filter(l=>!r.has(l.id))},T(t.options,"debugRows","getCenterRows"))},"createTable")},Wr={getInitialState:i(t=>({rowSelection:{},...t}),"getInitialState"),getDefaultOptions:i(t=>({onRowSelectionChange:Ce("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),"getDefaultOptions"),createTable:i(t=>{t.setRowSelection=e=>t.options.onRowSelectionChange==null?void 0:t.options.onRowSelectionChange(e),t.resetRowSelection=e=>{var n;return t.setRowSelection(e?{}:(n=t.initialState.rowSelection)!=null?n:{})},t.toggleAllRowsSelected=e=>{t.setRowSelection(n=>{e=typeof e<"u"?e:!t.getIsAllRowsSelected();let o={...n},r=t.getPreGroupedRowModel().flatRows;return e?r.forEach(l=>{l.getCanSelect()&&(o[l.id]=!0)}):r.forEach(l=>{delete o[l.id]}),o})},t.toggleAllPageRowsSelected=e=>t.setRowSelection(n=>{let o=typeof e<"u"?e:!t.getIsAllPageRowsSelected(),r={...n};return t.getRowModel().rows.forEach(l=>{nn(r,l.id,o,!0,t)}),r}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=I(()=>[t.getState().rowSelection,t.getCoreRowModel()],(e,n)=>Object.keys(e).length?Zt(t,n):{rows:[],flatRows:[],rowsById:{}},T(t.options,"debugTable","getSelectedRowModel")),t.getFilteredSelectedRowModel=I(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(e,n)=>Object.keys(e).length?Zt(t,n):{rows:[],flatRows:[],rowsById:{}},T(t.options,"debugTable","getFilteredSelectedRowModel")),t.getGroupedSelectedRowModel=I(()=>[t.getState().rowSelection,t.getSortedRowModel()],(e,n)=>Object.keys(e).length?Zt(t,n):{rows:[],flatRows:[],rowsById:{}},T(t.options,"debugTable","getGroupedSelectedRowModel")),t.getIsAllRowsSelected=()=>{let e=t.getFilteredRowModel().flatRows,{rowSelection:n}=t.getState(),o=!!(e.length&&Object.keys(n).length);return o&&e.some(r=>r.getCanSelect()&&!n[r.id])&&(o=!1),o},t.getIsAllPageRowsSelected=()=>{let e=t.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:n}=t.getState(),o=!!e.length;return o&&e.some(r=>!n[r.id])&&(o=!1),o},t.getIsSomeRowsSelected=()=>{var e;let n=Object.keys((e=t.getState().rowSelection)!=null?e:{}).length;return n>0&&n<t.getFilteredRowModel().flatRows.length},t.getIsSomePageRowsSelected=()=>{let e=t.getPaginationRowModel().flatRows;return t.getIsAllPageRowsSelected()?!1:e.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},t.getToggleAllRowsSelectedHandler=()=>e=>{t.toggleAllRowsSelected(e.target.checked)},t.getToggleAllPageRowsSelectedHandler=()=>e=>{t.toggleAllPageRowsSelected(e.target.checked)}},"createTable"),createRow:i((t,e)=>{t.toggleSelected=(n,o)=>{let r=t.getIsSelected();e.setRowSelection(l=>{var s;if(n=typeof n<"u"?n:!r,t.getCanSelect()&&r===n)return l;let u={...l};return nn(u,t.id,n,(s=o?.selectChildren)!=null?s:!0,e),u})},t.getIsSelected=()=>{let{rowSelection:n}=e.getState();return sn(t,n)},t.getIsSomeSelected=()=>{let{rowSelection:n}=e.getState();return on(t,n)==="some"},t.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=e.getState();return on(t,n)==="all"},t.getCanSelect=()=>{var n;return typeof e.options.enableRowSelection=="function"?e.options.enableRowSelection(t):(n=e.options.enableRowSelection)!=null?n:!0},t.getCanSelectSubRows=()=>{var n;return typeof e.options.enableSubRowSelection=="function"?e.options.enableSubRowSelection(t):(n=e.options.enableSubRowSelection)!=null?n:!0},t.getCanMultiSelect=()=>{var n;return typeof e.options.enableMultiRowSelection=="function"?e.options.enableMultiRowSelection(t):(n=e.options.enableMultiRowSelection)!=null?n:!0},t.getToggleSelectedHandler=()=>{let n=t.getCanSelect();return o=>{var r;n&&t.toggleSelected((r=o.target)==null?void 0:r.checked)}}},"createRow")},nn=i((t,e,n,o,r)=>{var l;let s=r.getRow(e,!0);n?(s.getCanMultiSelect()||Object.keys(t).forEach(u=>delete t[u]),s.getCanSelect()&&(t[e]=!0)):delete t[e],o&&(l=s.subRows)!=null&&l.length&&s.getCanSelectSubRows()&&s.subRows.forEach(u=>nn(t,u.id,n,o,r))},"mutateRowIsSelected");function Zt(t,e){let n=t.getState().rowSelection,o=[],r={},l=i(function(s,u){return s.map(a=>{var d;let g=sn(a,n);if(g&&(o.push(a),r[a.id]=a),(d=a.subRows)!=null&&d.length&&(a={...a,subRows:l(a.subRows)}),g)return a}).filter(Boolean)},"recurseRows");return{rows:l(e.rows),flatRows:o,rowsById:r}}i(Zt,"selectRowsFn");function sn(t,e){var n;return(n=e[t.id])!=null?n:!1}i(sn,"isRowSelected");function on(t,e,n){var o;if(!((o=t.subRows)!=null&&o.length))return!1;let r=!0,l=!1;return t.subRows.forEach(s=>{if(!(l&&!r)&&(s.getCanSelect()&&(sn(s,e)?l=!0:r=!1),s.subRows&&s.subRows.length)){let u=on(s,e);u==="all"?l=!0:(u==="some"&&(l=!0),r=!1)}}),r?"all":l?"some":!1}i(on,"isSubRowSelected");var rn=/([0-9]+)/gm,Xr=i((t,e,n)=>lo(Xe(t.getValue(n)).toLowerCase(),Xe(e.getValue(n)).toLowerCase()),"alphanumeric"),Yr=i((t,e,n)=>lo(Xe(t.getValue(n)),Xe(e.getValue(n))),"alphanumericCaseSensitive"),Zr=i((t,e,n)=>an(Xe(t.getValue(n)).toLowerCase(),Xe(e.getValue(n)).toLowerCase()),"text"),el=i((t,e,n)=>an(Xe(t.getValue(n)),Xe(e.getValue(n))),"textCaseSensitive"),tl=i((t,e,n)=>{let o=t.getValue(n),r=e.getValue(n);return o>r?1:o<r?-1:0},"datetime"),nl=i((t,e,n)=>an(t.getValue(n),e.getValue(n)),"basic");function an(t,e){return t===e?0:t>e?1:-1}i(an,"compareBasic");function Xe(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}i(Xe,"toString");function lo(t,e){let n=t.split(rn).filter(Boolean),o=e.split(rn).filter(Boolean);for(;n.length&&o.length;){let r=n.shift(),l=o.shift(),s=parseInt(r,10),u=parseInt(l,10),a=[s,u].sort();if(isNaN(a[0])){if(r>l)return 1;if(l>r)return-1;continue}if(isNaN(a[1]))return isNaN(s)?-1:1;if(s>u)return 1;if(u>s)return-1}return n.length-o.length}i(lo,"compareAlphanumeric");var vt={alphanumeric:Xr,alphanumericCaseSensitive:Yr,text:Zr,textCaseSensitive:el,datetime:tl,basic:nl},ol={getInitialState:i(t=>({sorting:[],...t}),"getInitialState"),getDefaultColumnDef:i(()=>({sortingFn:"auto",sortUndefined:1}),"getDefaultColumnDef"),getDefaultOptions:i(t=>({onSortingChange:Ce("sorting",t),isMultiSortEvent:i(e=>e.shiftKey,"isMultiSortEvent")}),"getDefaultOptions"),createColumn:i((t,e)=>{t.getAutoSortingFn=()=>{let n=e.getFilteredRowModel().flatRows.slice(10),o=!1;for(let r of n){let l=r?.getValue(t.id);if(Object.prototype.toString.call(l)==="[object Date]")return vt.datetime;if(typeof l=="string"&&(o=!0,l.split(rn).length>1))return vt.alphanumeric}return o?vt.text:vt.basic},t.getAutoSortDir=()=>{let n=e.getFilteredRowModel().flatRows[0];return typeof n?.getValue(t.id)=="string"?"asc":"desc"},t.getSortingFn=()=>{var n,o;if(!t)throw new Error;return Tt(t.columnDef.sortingFn)?t.columnDef.sortingFn:t.columnDef.sortingFn==="auto"?t.getAutoSortingFn():(n=(o=e.options.sortingFns)==null?void 0:o[t.columnDef.sortingFn])!=null?n:vt[t.columnDef.sortingFn]},t.toggleSorting=(n,o)=>{let r=t.getNextSortingOrder(),l=typeof n<"u"&&n!==null;e.setSorting(s=>{let u=s?.find(c=>c.id===t.id),a=s?.findIndex(c=>c.id===t.id),d=[],g,p=l?n:r==="desc";if(s!=null&&s.length&&t.getCanMultiSort()&&o?u?g="toggle":g="add":s!=null&&s.length&&a!==s.length-1?g="replace":u?g="toggle":g="replace",g==="toggle"&&(l||r||(g="remove")),g==="add"){var f;d=[...s,{id:t.id,desc:p}],d.splice(0,d.length-((f=e.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else g==="toggle"?d=s.map(c=>c.id===t.id?{...c,desc:p}:c):g==="remove"?d=s.filter(c=>c.id!==t.id):d=[{id:t.id,desc:p}];return d})},t.getFirstSortDir=()=>{var n,o;return((n=(o=t.columnDef.sortDescFirst)!=null?o:e.options.sortDescFirst)!=null?n:t.getAutoSortDir()==="desc")?"desc":"asc"},t.getNextSortingOrder=n=>{var o,r;let l=t.getFirstSortDir(),s=t.getIsSorted();return s?s!==l&&((o=e.options.enableSortingRemoval)==null||o)&&(!(n&&(r=e.options.enableMultiRemove)!=null)||r)?!1:s==="desc"?"asc":"desc":l},t.getCanSort=()=>{var n,o;return((n=t.columnDef.enableSorting)!=null?n:!0)&&((o=e.options.enableSorting)!=null?o:!0)&&!!t.accessorFn},t.getCanMultiSort=()=>{var n,o;return(n=(o=t.columnDef.enableMultiSort)!=null?o:e.options.enableMultiSort)!=null?n:!!t.accessorFn},t.getIsSorted=()=>{var n;let o=(n=e.getState().sorting)==null?void 0:n.find(r=>r.id===t.id);return o?o.desc?"desc":"asc":!1},t.getSortIndex=()=>{var n,o;return(n=(o=e.getState().sorting)==null?void 0:o.findIndex(r=>r.id===t.id))!=null?n:-1},t.clearSorting=()=>{e.setSorting(n=>n!=null&&n.length?n.filter(o=>o.id!==t.id):[])},t.getToggleSortingHandler=()=>{let n=t.getCanSort();return o=>{n&&(o.persist==null||o.persist(),t.toggleSorting==null||t.toggleSorting(void 0,t.getCanMultiSort()?e.options.isMultiSortEvent==null?void 0:e.options.isMultiSortEvent(o):!1))}}},"createColumn"),createTable:i(t=>{t.setSorting=e=>t.options.onSortingChange==null?void 0:t.options.onSortingChange(e),t.resetSorting=e=>{var n,o;t.setSorting(e?[]:(n=(o=t.initialState)==null?void 0:o.sorting)!=null?n:[])},t.getPreSortedRowModel=()=>t.getGroupedRowModel(),t.getSortedRowModel=()=>(!t._getSortedRowModel&&t.options.getSortedRowModel&&(t._getSortedRowModel=t.options.getSortedRowModel(t)),t.options.manualSorting||!t._getSortedRowModel?t.getPreSortedRowModel():t._getSortedRowModel())},"createTable")},rl=[Rr,Br,Ar,Lr,Fr,$r,qr,Jr,ol,zr,Ur,Kr,Qr,Wr,Hr];function io(t){var e,n;let o=[...rl,...(e=t._features)!=null?e:[]],r={_features:o},l=r._features.reduce((f,c)=>Object.assign(f,c.getDefaultOptions==null?void 0:c.getDefaultOptions(r)),{}),s=i(f=>r.options.mergeOptions?r.options.mergeOptions(l,f):{...l,...f},"mergeOptions"),a={...{},...(n=t.initialState)!=null?n:{}};r._features.forEach(f=>{var c;a=(c=f.getInitialState==null?void 0:f.getInitialState(a))!=null?c:a});let d=[],g=!1,p={_features:o,options:{...l,...t},initialState:a,_queue:i(f=>{d.push(f),g||(g=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();g=!1}).catch(c=>setTimeout(()=>{throw c})))},"_queue"),reset:i(()=>{r.setState(r.initialState)},"reset"),setOptions:i(f=>{let c=We(f,r.options);r.options=s(c)},"setOptions"),getState:i(()=>r.options.state,"getState"),setState:i(f=>{r.options.onStateChange==null||r.options.onStateChange(f)},"setState"),_getRowId:i((f,c,m)=>{var h;return(h=r.options.getRowId==null?void 0:r.options.getRowId(f,c,m))!=null?h:`${m?[m.id,c].join("."):c}`},"_getRowId"),getCoreRowModel:i(()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),"getCoreRowModel"),getRowModel:i(()=>r.getPaginationRowModel(),"getRowModel"),getRow:i((f,c)=>{let m=(c?r.getPrePaginationRowModel():r.getRowModel()).rowsById[f];if(!m&&(m=r.getCoreRowModel().rowsById[f],!m))throw new Error;return m},"getRow"),_getDefaultColumnDef:I(()=>[r.options.defaultColumn],f=>{var c;return f=(c=f)!=null?c:{},{header:i(m=>{let h=m.header.column.columnDef;return h.accessorKey?h.accessorKey:h.accessorFn?h.id:null},"header"),cell:i(m=>{var h,b;return(h=(b=m.renderValue())==null||b.toString==null?void 0:b.toString())!=null?h:null},"cell"),...r._features.reduce((m,h)=>Object.assign(m,h.getDefaultColumnDef==null?void 0:h.getDefaultColumnDef()),{}),...f}},T(t,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:i(()=>r.options.columns,"_getColumnDefs"),getAllColumns:I(()=>[r._getColumnDefs()],f=>{let c=i(function(m,h,b){return b===void 0&&(b=0),m.map(w=>{let x=yr(r,w,b,h),S=w;return x.columns=S.columns?c(S.columns,x,b+1):[],x})},"recurseColumns");return c(f)},T(t,"debugColumns","getAllColumns")),getAllFlatColumns:I(()=>[r.getAllColumns()],f=>f.flatMap(c=>c.getFlatColumns()),T(t,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:I(()=>[r.getAllFlatColumns()],f=>f.reduce((c,m)=>(c[m.id]=m,c),{}),T(t,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:I(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(f,c)=>{let m=f.flatMap(h=>h.getLeafColumns());return c(m)},T(t,"debugColumns","getAllLeafColumns")),getColumn:i(f=>r._getAllFlatColumnsById()[f],"getColumn")};Object.assign(r,p);for(let f=0;f<r._features.length;f++){let c=r._features[f];c==null||c.createTable==null||c.createTable(r)}return r}i(io,"createTable");function so(){return t=>I(()=>[t.options.data],e=>{let n={rows:[],flatRows:[],rowsById:{}},o=i(function(r,l,s){l===void 0&&(l=0);let u=[];for(let d=0;d<r.length;d++){let g=_r(t,t._getRowId(r[d],d,s),r[d],d,l,void 0,s?.id);if(n.flatRows.push(g),n.rowsById[g.id]=g,u.push(g),t.options.getSubRows){var a;g.originalSubRows=t.options.getSubRows(r[d],d),(a=g.originalSubRows)!=null&&a.length&&(g.subRows=o(g.originalSubRows,l+1,g))}}return u},"accessRows");return n.rows=o(e),n},T(t.options,"debugTable","getRowModel",()=>t._autoResetPageIndex()))}i(so,"getCoreRowModel");function ao(){return t=>I(()=>[t.getState().sorting,t.getPreSortedRowModel()],(e,n)=>{if(!n.rows.length||!(e!=null&&e.length))return n;let o=t.getState().sorting,r=[],l=o.filter(a=>{var d;return(d=t.getColumn(a.id))==null?void 0:d.getCanSort()}),s={};l.forEach(a=>{let d=t.getColumn(a.id);d&&(s[a.id]={sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortingFn:d.getSortingFn()})});let u=i(a=>{let d=a.map(g=>({...g}));return d.sort((g,p)=>{for(let c=0;c<l.length;c+=1){var f;let m=l[c],h=s[m.id],b=h.sortUndefined,w=(f=m?.desc)!=null?f:!1,x=0;if(b){let S=g.getValue(m.id),C=p.getValue(m.id),R=S===void 0,_=C===void 0;if(R||_){if(b==="first")return R?-1:1;if(b==="last")return R?1:-1;x=R&&_?0:R?b:-b}}if(x===0&&(x=h.sortingFn(g,p,m.id)),x!==0)return w&&(x*=-1),h.invertSorting&&(x*=-1),x}return g.index-p.index}),d.forEach(g=>{var p;r.push(g),(p=g.subRows)!=null&&p.length&&(g.subRows=u(g.subRows))}),d},"sortData");return{rows:u(n.rows),flatRows:r,rowsById:n.rowsById}},T(t.options,"debugTable","getSortedRowModel",()=>t._autoResetPageIndex()))}i(ao,"getSortedRowModel");function uo(t,e){return t?ll(t)?wt.createElement(t,e):t:null}i(uo,"flexRender");function ll(t){return il(t)||typeof t=="function"||sl(t)}i(ll,"isReactComponent");function il(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}i(il,"isClassComponent");function sl(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}i(sl,"isExoticComponent");function co(t){let e={state:{},onStateChange:i(()=>{},"onStateChange"),renderFallbackValue:null,...t},[n]=wt.useState(()=>({current:io(e)})),[o,r]=wt.useState(()=>n.current.initialState);return n.current.setOptions(l=>({...l,...t,state:{...o,...t.state},onStateChange:i(s=>{r(s),t.onStateChange==null||t.onStateChange(s)},"onStateChange")})),n.current}i(co,"useReactTable");var v=ue(ht(),1);var go=ue(pt(),1),fo=ue(st(),1),ae=ue(ht(),1);var al=[{label:"=",value:"eq"},{label:"\u2260",value:"ne"},{label:"<",value:"lt"},{label:"\u2264",value:"lte"},{label:">",value:"gt"},{label:"\u2265",value:"gte"},{label:"contains",value:"contains"}],ul=i(t=>{let e=t.trim(),n=Number(e);return e!==""&&Number.isFinite(n)&&String(n)===e?n:t},"K"),Ye=i(t=>t.filter(e=>e.column!=="").map(e=>({column:e.column,operator:e.operator,value:e.operator==="contains"?e.value:ul(e.value)})),"I"),mo=i(t=>{let e=(0,go.c)(44),{columns:n,filters:o,onAskAi:r,onFiltersChange:l,onSearchChange:s,search:u}=t,[a,d]=(0,fo.useState)(""),g;e[0]!==n[0]||e[1]!==o||e[2]!==l?(g=i(()=>{l([...o,{column:n[0]??"",operator:"eq",value:""}])},"N"),e[0]=n[0],e[1]=o,e[2]=l,e[3]=g):g=e[3];let p=g,f;e[4]!==o||e[5]!==l?(f=i($=>{let k=Number($.currentTarget.dataset.index);l(o.filter((N,V)=>V!==k))},"T"),e[4]=o,e[5]=l,e[6]=f):f=e[6];let c=f,m;e[7]!==o||e[8]!==l?(m=i($=>{let k=Number($.currentTarget.dataset.index),N=$.currentTarget.value;l(o.map((V,D)=>D===k?{...V,column:N}:V))},"S"),e[7]=o,e[8]=l,e[9]=m):m=e[9];let h=m,b;e[10]!==o||e[11]!==l?(b=i($=>{let k=Number($.currentTarget.dataset.index),N=$.currentTarget.value;l(o.map((V,D)=>D===k?{...V,operator:N}:V))},"k"),e[10]=o,e[11]=l,e[12]=b):b=e[12];let w=b,x;e[13]!==o||e[14]!==l?(x=i($=>{let k=Number($.currentTarget.dataset.index),N=$.currentTarget.value;l(o.map((V,D)=>D===k?{...V,value:N}:V))},"w"),e[13]=o,e[14]=l,e[15]=x):x=e[15];let S=x,C;e[16]!==s||e[17]!==u?(C=(0,ae.jsx)("input",{"aria-label":"Search rows","data-testid":"db-filter",onChange:s,placeholder:"search table\u2026",value:u}),e[16]=s,e[17]=u,e[18]=C):C=e[18];let R;e[19]!==p?(R=(0,ae.jsx)("button",{"data-testid":"db-add-filter",onClick:p,type:"button",children:"Add filter"}),e[19]=p,e[20]=R):R=e[20];let _;e[21]!==a||e[22]!==r?(_=r!==void 0&&(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("input",{"aria-label":"Describe a filter","data-testid":"db-ai-prompt",onChange:i($=>{d($.target.value)},"onChange"),onKeyDown:i($=>{$.key==="Enter"&&a.trim()!==""&&($.preventDefault(),r(a.trim()))},"onKeyDown"),placeholder:"describe a filter\u2026",value:a}),(0,ae.jsx)("button",{"data-testid":"db-ai-filter",disabled:a.trim()==="",onClick:i(()=>{r(a.trim())},"onClick"),type:"button",children:"Suggest"})]}),e[21]=a,e[22]=r,e[23]=_):_=e[23];let y;e[24]!==C||e[25]!==R||e[26]!==_?(y=(0,ae.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[C,R,_]}),e[24]=C,e[25]=R,e[26]=_,e[27]=y):y=e[27];let F;if(e[28]!==h||e[29]!==w||e[30]!==S||e[31]!==n||e[32]!==o||e[33]!==c){let $;e[35]!==h||e[36]!==w||e[37]!==S||e[38]!==n||e[39]!==c?($=i((k,N)=>(0,ae.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-filter-row",children:[(0,ae.jsx)("select",{"aria-label":"Filter column","data-index":N,"data-testid":"db-filter-column",onChange:h,value:k.column,children:n.map(dl)}),(0,ae.jsx)("select",{"aria-label":"Filter operator","data-index":N,"data-testid":"db-filter-operator",onChange:w,value:k.operator,children:al.map(cl)}),(0,ae.jsx)("input",{"aria-label":"Filter value","data-index":N,"data-testid":"db-filter-value",onChange:S,placeholder:"value",value:k.value}),(0,ae.jsx)("button",{"aria-label":"Remove filter","data-index":N,"data-testid":"db-filter-remove",onClick:c,type:"button",children:"\u2715"})]},N),"t"),e[35]=h,e[36]=w,e[37]=S,e[38]=n,e[39]=c,e[40]=$):$=e[40],F=o.map($),e[28]=h,e[29]=w,e[30]=S,e[31]=n,e[32]=o,e[33]=c,e[34]=F}else F=e[34];let M;return e[41]!==F||e[42]!==y?(M=(0,ae.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"db-filters",children:[y,F]}),e[41]=F,e[42]=y,e[43]=M):M=e[43],M},"J");function dl(t){return(0,ae.jsx)("option",{value:t,children:t},t)}i(dl,"$");function cl(t){return(0,ae.jsx)("option",{value:t.value,children:t.label},t.value)}i(cl,"z");var po=i((t,e)=>{let n=[];for(let[o,r]of Object.entries(e))for(let l of r)l.ref===t&&n.push({column:l.name,table:o});return n.sort((o,r)=>o.table.localeCompare(r.table)||o.column.localeCompare(r.column)),n},"wt"),fn=i(t=>`${t.table}.${t.column}`,"pt"),gl=/([a-z\d])([A-Z])/gu,fl=/[\s_-]+/u,ml=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),pl=i(t=>{let e=t.replaceAll(gl,"$1 $2").split(fl).map(o=>o.toLowerCase()).filter(o=>o.length>0),n=new Set(e);for(let o=0;o<e.length-1;o+=1){let r=e[o],l=e[o+1];r===void 0||l===void 0||(n.add(`${r}${l}`),n.add(`${r}_${l}`))}return[...n]},"qn"),ho="\u2022\u2022\u2022",hl=i(t=>{let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.codePointAt(n)??0,e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")},"St"),$o=i((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:hl(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):ho}catch{return ho}},"Ot"),vl=i((t,e)=>{let n=new Map;for(let o of t)o.table===e&&n.set(o.column,o.strategy);return n},"Wn"),bl=i(t=>{for(let e of pl(t))if(ml.has(e))return!0;return!1},"Hn"),wl=i((t,e)=>{let n=e.filter(r=>!t.has(r)&&bl(r));if(n.length===0)return t;let o=new Map(t);for(let r of n)o.set(r,"redact");return o},"Un"),xl=i((t,e,n)=>{if(!n.enabled)return t;let o=n.columns.get(e);return o===void 0?t:$o(t,o)},"Qn"),vo=i((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>{let o={...n};for(let[r,l]of e.columns)r in o&&(o[r]=$o(o[r],l));return o}),"Ct"),Sl=i((t,e,n,o,r=300)=>{if(o<=0)return{ids:new Set(t.map(p=>p.id)),leadPx:0,tailPx:0};let l=n-r,s=n+o+r,u=new Set,a=0,d=0,g=0;for(let p of t){let f=p.getSize(),c=e.has(p.id),m=a+f>l&&a<s;c||m?u.add(p.id):a<l?d+=f:g+=f,a+=f}return{ids:u,leadPx:d,tailPx:g}},"Yn"),Cl=i((t,e)=>{let n=new Map,o=0;for(let r of t)e.has(r.id)&&(n.set(r.id,o),o+=r.getSize());return n},"Xn"),yl=i(()=>{let t=(0,j.c)(11),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let[n,o]=(0,P.useState)(e),r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=i((c,m,h)=>{o(b=>({...b,[c]:{...b[c],[m]:h}}))},"t"),t[1]=r):r=t[1];let l=r,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=i(()=>{o({})},"a"),t[2]=s):s=t[2];let u=s,a;t[3]!==n?(a=i((c,m)=>{let h=n[c];return h!==void 0&&m in h?{value:h[m]}:void 0},"r"),t[3]=n,t[4]=a):a=t[4];let d=a,g;t[5]!==n?(g=Object.values(n).reduce(_l,0),t[5]=n,t[6]=g):g=t[6];let p=g,f;return t[7]!==p||t[8]!==n||t[9]!==d?(f={clear:u,count:p,stage:l,staged:n,stagedValue:d},t[7]=p,t[8]=n,t[9]=d,t[10]=f):f=t[10],f},"Zn"),No=i((t,e)=>{if(typeof e=="number"){let n=Number(t);return t.trim()===""||Number.isNaN(n)?t:n}if(typeof e=="boolean"){if(t==="true")return!0;if(t==="false")return!1}return t},"Pt"),Rl=i(t=>{let e=(0,j.c)(29),{changes:n,committing:o,onCommit:r,onDiscard:l}=t,s=q(),u;e[0]!==n.length||e[1]!==s?(u=s("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=s,e[2]=u):u=e[2];let a;e[3]!==u?(a=(0,v.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:u}),e[3]=u,e[4]=a):a=e[4];let d;e[5]!==o||e[6]!==s?(d=s(o?"Committing\u2026":"Commit"),e[5]=o,e[6]=s,e[7]=d):d=e[7];let g;e[8]!==o||e[9]!==r||e[10]!==d?(g=(0,v.jsx)("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:o,onClick:r,type:"button",children:d}),e[8]=o,e[9]=r,e[10]=d,e[11]=g):g=e[11];let p;e[12]!==s?(p=s("Discard"),e[12]=s,e[13]=p):p=e[13];let f;e[14]!==o||e[15]!==l||e[16]!==p?(f=(0,v.jsx)("button",{className:"rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-discard",disabled:o,onClick:l,type:"button",children:p}),e[14]=o,e[15]=l,e[16]=p,e[17]=f):f=e[17];let c;e[18]!==a||e[19]!==g||e[20]!==f?(c=(0,v.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a,g,f]}),e[18]=a,e[19]=g,e[20]=f,e[21]=c):c=e[21];let m;e[22]!==n?(m=n.map(Fl),e[22]=n,e[23]=m):m=e[23];let h;e[24]!==m?(h=(0,v.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:m}),e[24]=m,e[25]=h):h=e[25];let b;return e[26]!==c||e[27]!==h?(b=(0,v.jsxs)("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[c,h]}),e[26]=c,e[27]=h,e[28]=b):b=e[28],b},"eo");function _l(t,e){return t+Object.keys(e).length}i(_l,"to");function Fl(t){return(0,v.jsxs)("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[(0,v.jsxs)("span",{className:"text-muted-foreground",children:[t.rowId,".",t.column]}),(0,v.jsx)("span",{className:"text-destructive line-through",children:nt(t.oldValue)}),(0,v.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2192"}),(0,v.jsx)("span",{className:"text-foreground",children:nt(t.newValue)})]},`${t.rowId}:${t.column}`)}i(Fl,"no");var bo=400,$l=36,Nl={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},Ml={width:"100%"},Pl=/\n$/u,kl={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Vl={display:"flex",width:"100%"},wo={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},El="2.5rem",Mo={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},mn=i(t=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${t.toString()}px`}),"bt"),Po=i((t,e)=>({...mn(t),left:`calc(${El} + ${e.toString()}px)`,position:"sticky",zIndex:2}),"Ft"),xo="rounded-md px-2 py-0.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",Il=i((t,e,n)=>e.enabled&&e.columns.has(n)?void 0:t,"uo"),cn="__back__:",Tl=i(t=>`${cn}${t.table}.${t.column}`,"fo"),Dl=i(t=>{let e=(0,j.c)(3),{counts:n,rowId:o}=t;if(n===void 0){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,v.jsx)("span",{className:"text-muted-foreground/50",children:"\u2014"}),e[0]=s):s=e[0],s}let r=n[o]??0,l;return e[1]!==r?(l=(0,v.jsx)("span",{className:"tabular-nums",children:r}),e[1]=r,e[2]=l):l=e[2],l},"mo"),Ae=i(t=>{for(let e of["id","__id__","_id"]){let n=t[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},"ke"),zl=i((t,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(t)||t===""&&e.nullable===!0?{value:t===""?null:t}:void 0;if(e.type==="boolean")return t==="true"||t==="false"?{value:t==="true"}:void 0;if(e.type==="number"){let n=Number(t);return t.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:t}},"go"),Ol=i((t,e,n)=>{if(n!==void 0&&n.type!=="any")return zl(t,n);let o=No(t,e);return typeof e=="number"&&typeof o!="number"?void 0:{value:o}},"po"),Al=i(({anchor:t,columnIds:e,columnMeta:n,editableColumn:o,rows:r,text:l})=>{let s=l.replaceAll(`\r
@@ -1 +1 @@
1
- import{a as T}from"./chunk-PZ4QDWTI.js";import{a as S}from"./chunk-P4QIDUCY.js";import{b as q}from"./chunk-F7JOSNAT.js";import{d as A,h as E,j as H,k as O}from"./chunk-BKM6PMSO.js";import{a as I}from"./chunk-VYW2PAWC.js";import{a as j,d as C,f as U,g as _}from"./chunk-R5ZTCHCE.js";var V=C(U(),1);var i=C(_(),1);var L=j(G=>{let e=(0,V.c)(38),{className:w,error:t,testId:N}=G,g=A(),r=q(),l,s,n,a,c,m,o,d;if(e[0]!==w||e[1]!==t||e[2]!==r||e[3]!==N){let y=H(t),b;e[12]!==t?(b=O(t),e[12]=t,e[13]=b):b=e[13],s=b;let x;e[14]!==t?(x=S(t),e[14]=t,e[15]=x):x=e[15];let k=x,v;e[16]!==r||e[17]!==k?(v=j(()=>{r?.openConsole({errorsOnly:!0,seq:k})},"x"),e[16]=r,e[17]=k,e[18]=v):v=e[18],n=v,l=T,a=w,c=N,m="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(o=(0,i.jsx)("p",{className:"font-medium",children:u}),e[21]=u,e[22]=o):o=e[22],d=y===void 0?null:(0,i.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(y)}),e[0]=w,e[1]=t,e[2]=r,e[3]=N,e[4]=l,e[5]=s,e[6]=n,e[7]=a,e[8]=c,e[9]=m,e[10]=o,e[11]=d}else l=e[4],s=e[5],n=e[6],a=e[7],c=e[8],m=e[9],o=e[10],d=e[11];let p;e[23]!==s?(p=s===void 0?null:(0,i.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:s,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=s,e[24]=p):p=e[24];let f;e[25]!==r||e[26]!==n||e[27]!==g?(f=r===void 0?null:(0,i.jsx)("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:n,type:"button",children:g("Show in console")}),e[25]=r,e[26]=n,e[27]=g,e[28]=f):f=e[28];let h;return e[29]!==l||e[30]!==a||e[31]!==c||e[32]!==m||e[33]!==o||e[34]!==d||e[35]!==p||e[36]!==f?(h=(0,i.jsxs)(l,{className:a,testId:c,variant:m,children:[o,d,p,f]}),e[29]=l,e[30]=a,e[31]=c,e[32]=m,e[33]=o,e[34]=d,e[35]=p,e[36]=f,e[37]=h):h=e[37],h},"G");export{L as a};
1
+ import{a as T}from"./chunk-PZ4QDWTI.js";import{a as S}from"./chunk-GDC3W3DZ.js";import{b as q}from"./chunk-F7JOSNAT.js";import{d as A,h as E,j as H,k as O}from"./chunk-BKM6PMSO.js";import{a as I}from"./chunk-VYW2PAWC.js";import{a as j,d as C,f as U,g as _}from"./chunk-R5ZTCHCE.js";var V=C(U(),1);var i=C(_(),1);var L=j(G=>{let e=(0,V.c)(38),{className:w,error:t,testId:N}=G,g=A(),r=q(),l,s,n,a,c,m,o,d;if(e[0]!==w||e[1]!==t||e[2]!==r||e[3]!==N){let y=H(t),b;e[12]!==t?(b=O(t),e[12]=t,e[13]=b):b=e[13],s=b;let x;e[14]!==t?(x=S(t),e[14]=t,e[15]=x):x=e[15];let k=x,v;e[16]!==r||e[17]!==k?(v=j(()=>{r?.openConsole({errorsOnly:!0,seq:k})},"x"),e[16]=r,e[17]=k,e[18]=v):v=e[18],n=v,l=T,a=w,c=N,m="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(o=(0,i.jsx)("p",{className:"font-medium",children:u}),e[21]=u,e[22]=o):o=e[22],d=y===void 0?null:(0,i.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(y)}),e[0]=w,e[1]=t,e[2]=r,e[3]=N,e[4]=l,e[5]=s,e[6]=n,e[7]=a,e[8]=c,e[9]=m,e[10]=o,e[11]=d}else l=e[4],s=e[5],n=e[6],a=e[7],c=e[8],m=e[9],o=e[10],d=e[11];let p;e[23]!==s?(p=s===void 0?null:(0,i.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:s,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=s,e[24]=p):p=e[24];let f;e[25]!==r||e[26]!==n||e[27]!==g?(f=r===void 0?null:(0,i.jsx)("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:n,type:"button",children:g("Show in console")}),e[25]=r,e[26]=n,e[27]=g,e[28]=f):f=e[28];let h;return e[29]!==l||e[30]!==a||e[31]!==c||e[32]!==m||e[33]!==o||e[34]!==d||e[35]!==p||e[36]!==f?(h=(0,i.jsxs)(l,{className:a,testId:c,variant:m,children:[o,d,p,f]}),e[29]=l,e[30]=a,e[31]=c,e[32]=m,e[33]=o,e[34]=d,e[35]=p,e[36]=f,e[37]=h):h=e[37],h},"G");export{L as a};
@@ -1 +1 @@
1
- import{a as G}from"./chunk-METRMDIQ.js";import{a as x}from"./chunk-NXXGISFB.js";import{a as U}from"./chunk-6UN4V2HB.js";import{b as M}from"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as O}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as h}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as w}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as E}from"./chunk-DZGOHOOE.js";import{f as D}from"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{d as K,e as _,f as z,h as B,o as P,s as q}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-R5ZTCHCE.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
1
+ import{a as G}from"./chunk-METRMDIQ.js";import{a as x}from"./chunk-NXXGISFB.js";import{a as U}from"./chunk-6UN4V2HB.js";import{b as M}from"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as O}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as h}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as w}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as E}from"./chunk-DZGOHOOE.js";import{f as D}from"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{d as K,e as _,f as z,h as B,o as P,s as q}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-R5ZTCHCE.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
@@ -1 +1 @@
1
- import{a as re}from"./chunk-E6P2ERQV.js";import{a as X}from"./chunk-CKTKI4IY.js";import{a as V}from"./chunk-6UN4V2HB.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as R}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as O}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as Y}from"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as Q}from"./chunk-DZGOHOOE.js";import{c as J}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as G}from"./chunk-UANVABQG.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-L4EZAHCD.js";import{a as U,e as W}from"./chunk-IYWVSMAY.js";import{d as z,s as H}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as l,d as B,e as de,f as me,g as he,i as L}from"./chunk-R5ZTCHCE.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ee=l(r=>{let e=(0,se.c)(47),{functions:K,initialShardKey:ne}=r,s=z(),{queryShardKey:_,setShardKey:N,shardKey:v}=X(ne),[i,oe]=(0,le.useState)("recent"),w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];let C;e[1]!==_?(C={live:!0,shardKey:_},e[1]=_,e[2]=C):C=e[2];let{data:ie,error:c,errorSource:S,liveError:b}=J(Q.getFunctionStats,w,C),k=ie?.functions??null,$;e[3]!==K?($=new Map((K??[]).map(ge)),e[3]=K,e[4]=$):$=e[4];let T=$,F;e[5]===Symbol.for("react.memo_cache_sentinel")?(F=l(M=>{oe(M.currentTarget.dataset.sort)},"E"),e[5]=F):F=e[5];let ce=F,I;if(e[6]!==c||e[7]!==S||e[8]!==T||e[9]!==b||e[10]!==N||e[11]!==v||e[12]!==i||e[13]!==k||e[14]!==s){let M=k===null?[]:k.toSorted(xe[i]),d;e[16]!==s?(d=s("Recent"),e[16]=s,e[17]=d):d=e[17];let m;e[18]!==d?(m={key:"recent",label:d},e[18]=d,e[19]=m):m=e[19];let h;e[20]!==s?(h=s("Most called"),e[20]=s,e[21]=h):h=e[21];let u;e[22]!==h?(u={key:"calls",label:h},e[22]=h,e[23]=u):u=e[23];let f;e[24]!==s?(f=s("Slowest"),e[24]=s,e[25]=f):f=e[25];let p;e[26]!==f?(p={key:"slowest",label:f},e[26]=f,e[27]=p):p=e[27];let A;e[28]!==p||e[29]!==m||e[30]!==u?(A=[m,u,p],e[28]=p,e[29]=m,e[30]=u,e[31]=A):A=e[31];let j=A,x;e[32]!==N||e[33]!==v?(x=(0,t.jsx)(V,{onChange:N,testId:"fs-shard-input",value:v}),e[32]=N,e[33]=v,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsx)(re,{message:b,prefix:"fs"}),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==j||e[38]!==i?(y=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(R,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:i===a.key?"secondary":"ghost",children:a.label},a.key))}),e[37]=j,e[38]=i,e[39]=y):y=e[39];let D;e[40]!==x||e[41]!==g||e[42]!==y?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]}),e[40]=x,e[41]=g,e[42]=y,e[43]=D):D=e[43];let E;e[44]!==c||e[45]!==S?(E=c!==null&&(0,t.jsx)(Y,{error:S,testId:"fs-error"}),e[44]=c,e[45]=S,e[46]=E):E=e[46],I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,k!==null&&M.length===0&&c===null&&(0,t.jsx)(G,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),M.length>0&&(0,t.jsx)(U,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:M.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(O,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:H(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=c,e[7]=S,e[8]=T,e[9]=b,e[10]=N,e[11]=v,e[12]=i,e[13]=k,e[14]=s,e[15]=I}else I=e[15];return I},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{Ee as FunctionStatsPanel};
1
+ import{a as re}from"./chunk-E6P2ERQV.js";import{a as X}from"./chunk-CKTKI4IY.js";import{a as V}from"./chunk-6UN4V2HB.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as R}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as O}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as Y}from"./chunk-JCSDJBBZ.js";import"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as Q}from"./chunk-DZGOHOOE.js";import{c as J}from"./chunk-5DEXJ766.js";import"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as G}from"./chunk-UANVABQG.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-L4EZAHCD.js";import{a as U,e as W}from"./chunk-IYWVSMAY.js";import{d as z,s as H}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as l,d as B,e as de,f as me,g as he,i as L}from"./chunk-R5ZTCHCE.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ee=l(r=>{let e=(0,se.c)(47),{functions:K,initialShardKey:ne}=r,s=z(),{queryShardKey:_,setShardKey:N,shardKey:v}=X(ne),[i,oe]=(0,le.useState)("recent"),w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];let C;e[1]!==_?(C={live:!0,shardKey:_},e[1]=_,e[2]=C):C=e[2];let{data:ie,error:c,errorSource:S,liveError:b}=J(Q.getFunctionStats,w,C),k=ie?.functions??null,$;e[3]!==K?($=new Map((K??[]).map(ge)),e[3]=K,e[4]=$):$=e[4];let T=$,F;e[5]===Symbol.for("react.memo_cache_sentinel")?(F=l(M=>{oe(M.currentTarget.dataset.sort)},"E"),e[5]=F):F=e[5];let ce=F,I;if(e[6]!==c||e[7]!==S||e[8]!==T||e[9]!==b||e[10]!==N||e[11]!==v||e[12]!==i||e[13]!==k||e[14]!==s){let M=k===null?[]:k.toSorted(xe[i]),d;e[16]!==s?(d=s("Recent"),e[16]=s,e[17]=d):d=e[17];let m;e[18]!==d?(m={key:"recent",label:d},e[18]=d,e[19]=m):m=e[19];let h;e[20]!==s?(h=s("Most called"),e[20]=s,e[21]=h):h=e[21];let u;e[22]!==h?(u={key:"calls",label:h},e[22]=h,e[23]=u):u=e[23];let f;e[24]!==s?(f=s("Slowest"),e[24]=s,e[25]=f):f=e[25];let p;e[26]!==f?(p={key:"slowest",label:f},e[26]=f,e[27]=p):p=e[27];let A;e[28]!==p||e[29]!==m||e[30]!==u?(A=[m,u,p],e[28]=p,e[29]=m,e[30]=u,e[31]=A):A=e[31];let j=A,x;e[32]!==N||e[33]!==v?(x=(0,t.jsx)(V,{onChange:N,testId:"fs-shard-input",value:v}),e[32]=N,e[33]=v,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsx)(re,{message:b,prefix:"fs"}),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==j||e[38]!==i?(y=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(R,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:i===a.key?"secondary":"ghost",children:a.label},a.key))}),e[37]=j,e[38]=i,e[39]=y):y=e[39];let D;e[40]!==x||e[41]!==g||e[42]!==y?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]}),e[40]=x,e[41]=g,e[42]=y,e[43]=D):D=e[43];let E;e[44]!==c||e[45]!==S?(E=c!==null&&(0,t.jsx)(Y,{error:S,testId:"fs-error"}),e[44]=c,e[45]=S,e[46]=E):E=e[46],I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,k!==null&&M.length===0&&c===null&&(0,t.jsx)(G,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),M.length>0&&(0,t.jsx)(U,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:M.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(O,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:H(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=c,e[7]=S,e[8]=T,e[9]=b,e[10]=N,e[11]=v,e[12]=i,e[13]=k,e[14]=s,e[15]=I}else I=e[15];return I},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{Ee as FunctionStatsPanel};
@@ -1,4 +1,4 @@
1
- import{a as rt,b as ot}from"./chunk-WYSR5F77.js";import{a as nt}from"./chunk-7CVIN6KU.js";import{a as tt}from"./chunk-2RASQG3R.js";import"./chunk-FJ6G6FNE.js";import"./chunk-CP4ZFBVW.js";import"./chunk-CN2AINNY.js";import"./chunk-5JLIP2HH.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import{a as et}from"./chunk-M3NNNOD5.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-XL2OT5WB.js";import"./chunk-JV7KTJPY.js";import"./chunk-DPNEFSEC.js";import"./chunk-2EJQ7SPV.js";import{a as Je}from"./chunk-6UN4V2HB.js";import{b as Xe}from"./chunk-KVSQKUWD.js";import{c as Ve,d as qe,e as Le,f as _e,g as Pe}from"./chunk-ZHPDAJBM.js";import{P as Ge}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{a as Ze}from"./chunk-PZ4QDWTI.js";import{a as Ne}from"./chunk-DZGOHOOE.js";import"./chunk-L6ATKZKO.js";import{f as Ee}from"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import"./chunk-L4EZAHCD.js";import{d as ce,f as we,g as ke,h as Ke,o as ue}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as l,d as We,e as vt,f as yt,g as St,i as me}from"./chunk-R5ZTCHCE.js";var G=We(yt(),1);var z=We(vt(),1);var c=We(St(),1);var wt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],kt=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],Me=String.fromCodePoint(0),Nt=new RegExp(`${Me}${String.raw`(\d+)`}${Me}`,"gu"),qt=wt.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Ct=kt.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
1
+ import{a as rt,b as ot}from"./chunk-OCZ2IP5A.js";import{a as nt}from"./chunk-7CVIN6KU.js";import{a as tt}from"./chunk-4HWTEDVV.js";import"./chunk-FJ6G6FNE.js";import"./chunk-CP4ZFBVW.js";import"./chunk-CN2AINNY.js";import"./chunk-5JLIP2HH.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import{a as et}from"./chunk-M3NNNOD5.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-XL2OT5WB.js";import"./chunk-JV7KTJPY.js";import"./chunk-DPNEFSEC.js";import"./chunk-2EJQ7SPV.js";import{a as Je}from"./chunk-6UN4V2HB.js";import{b as Xe}from"./chunk-KVSQKUWD.js";import{c as Ve,d as qe,e as Le,f as _e,g as Pe}from"./chunk-ZHPDAJBM.js";import{P as Ge}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{a as Ze}from"./chunk-PZ4QDWTI.js";import{a as Ne}from"./chunk-DZGOHOOE.js";import"./chunk-5DEXJ766.js";import{f as Ee}from"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import"./chunk-L4EZAHCD.js";import{d as ce,f as we,g as ke,h as Ke,o as ue}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as l,d as We,e as vt,f as yt,g as St,i as me}from"./chunk-R5ZTCHCE.js";var G=We(yt(),1);var z=We(vt(),1);var c=We(St(),1);var wt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],kt=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],Me=String.fromCodePoint(0),Nt=new RegExp(`${Me}${String.raw`(\d+)`}${Me}`,"gu"),qt=wt.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Ct=kt.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
2
2
  ${s}`})),Tt=l(s=>{let e=[],n=s.replaceAll(/'(?:[^']|'')*'/gu,t=>(e.push(t),`${Me}${(e.length-1).toString()}${Me}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:t,replacement:o}of qt)n=n.replaceAll(t,o);for(let{pattern:t,replacement:o}of Ct)n=n.replaceAll(t,o);return n=n.replaceAll(Nt,(t,o)=>e[Number(o)]??""),n},"Lt"),je="x",It={'"':'"',"'":"'","[":"]","`":"`"},Rt=l((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
3
3
  `;)n+=1;return n},"qt"),Et=l((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"At"),ct=l(s=>{let e=s.split(""),n=0;for(;n<s.length;){let t=s[n]??"",o=It[t];if(t==="-"&&s[n+1]==="-"){let r=Rt(s,n);e.fill(je,n,r),n=r}else if(t==="/"&&s[n+1]==="*"){let r=Et(s,n);if(r===-1)return;e.fill(je,n,r),n=r}else if(o!==void 0){let r=n+1;for(;r<s.length;)if(s[r]!==o)r+=1;else if(o!=="]"&&s[r+1]===o)r+=2;else break;if(r>=s.length)return;e.fill(je,n,r+1),n=r+1}else n+=1}for(let t=0;t<s.length;t+=1)s[t]===`
4
4
  `&&(e[t]=`
@@ -1 +1 @@
1
- import{a as $}from"./chunk-5QAT5NQ4.js";import{a as b}from"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as u}from"./chunk-DZGOHOOE.js";import{c as p}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as y,b as w,c as j,d as h,e as c,f as i}from"./chunk-L4EZAHCD.js";import{a as d,e as l}from"./chunk-IYWVSMAY.js";import{d as k}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as o,d as I,g as T,i as x}from"./chunk-R5ZTCHCE.js";var e=I(T(),1);var m={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},A={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},C=o((r,a)=>`exempt: ${r.exemptReason===void 0||r.exemptReason===""?a:r.exemptReason}`,"E"),E=o(r=>r.toSorted((a,n)=>a.coverage==="clean"&&n.coverage!=="clean"?1:n.coverage==="clean"&&a.coverage!=="clean"?-1:a.score-n.score),"S"),Y=o(({testId:r="advisor-health"})=>{let a=k(),n=p(u.getAdvisories,{},{live:!0}),g=p(u.getAdvisorProcedures,{},{live:!0}),f=n.data?.advisories??null,N=g.data?.procedures??null,t=f===null||N===null?null:$(N,f),v=g.error??n.error;if(v!==null)return(0,e.jsx)(b,{error:v,testId:`${r}-error`});if(t===null)return(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"py-8 text-center text-muted-foreground","data-testid":`${r}-loading`,children:a("Loading\u2026")})});let R=E(t.procedures);return(0,e.jsxs)("div",{className:"space-y-4","data-testid":r,children:[(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:x("text-4xl font-semibold tabular-nums",A[t.grade]),"data-testid":`${r}-score`,children:t.score}),(0,e.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,e.jsx)("span",{className:x("text-sm font-medium uppercase tracking-wide",A[t.grade]),"data-testid":`${r}-grade`,children:t.grade}),(0,e.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${r}-summary`,children:[(0,e.jsxs)("span",{className:m.clean,children:[t.summary.clean," ",a("clean")]}),(0,e.jsxs)("span",{className:m.warned,children:[t.summary.warned," ",a("warned")]}),(0,e.jsxs)("span",{className:m.failing,children:[t.summary.failing," ",a("failing")]}),(0,e.jsxs)("span",{className:m.exempt,children:[t.summary.exempt," ",a("exempt")]})]})]})}),t.project.checks.length>0&&(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"py-4 text-sm","data-testid":`${r}-project`,children:[(0,e.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",t.project.score,"/100"]}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",t.project.checks.map(s=>s.name).join(", ")]})]})}),(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"p-0",children:(0,e.jsxs)(y,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(c,{className:"w-20",children:a("Score")}),(0,e.jsx)(c,{children:a("Procedure")}),(0,e.jsx)(c,{className:"w-32",children:a("Kind")}),(0,e.jsx)(c,{children:a("Rules fired")})]})}),(0,e.jsx)(j,{children:R.map(s=>(0,e.jsxs)(h,{"data-testid":`${r}-row`,children:[(0,e.jsx)(i,{className:x("tabular-nums font-medium",m[s.coverage]),children:s.coverage==="exempt"?"\u2014":s.score}),(0,e.jsx)(i,{className:"font-mono text-xs",children:s.id}),(0,e.jsxs)(i,{className:"text-muted-foreground text-xs",children:[s.visibility," ",s.kind,s.sensitivity.level==="high"&&(0,e.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,e.jsx)(i,{className:"text-muted-foreground text-xs",children:s.coverage==="exempt"?C(s,a("no reason given")):s.checks.map(S=>S.name).join(", ")})]},s.id))})]})})})]})},"Y");export{Y as default};
1
+ import{a as $}from"./chunk-5QAT5NQ4.js";import{a as b}from"./chunk-JCSDJBBZ.js";import"./chunk-PZ4QDWTI.js";import"./chunk-GDC3W3DZ.js";import"./chunk-F7JOSNAT.js";import{a as u}from"./chunk-DZGOHOOE.js";import{c as p}from"./chunk-5DEXJ766.js";import"./chunk-NIUA7EHL.js";import"./chunk-RCZTUWG3.js";import{a as y,b as w,c as j,d as h,e as c,f as i}from"./chunk-L4EZAHCD.js";import{a as d,e as l}from"./chunk-IYWVSMAY.js";import{d as k}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as o,d as I,g as T,i as x}from"./chunk-R5ZTCHCE.js";var e=I(T(),1);var m={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},A={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},C=o((r,a)=>`exempt: ${r.exemptReason===void 0||r.exemptReason===""?a:r.exemptReason}`,"E"),E=o(r=>r.toSorted((a,n)=>a.coverage==="clean"&&n.coverage!=="clean"?1:n.coverage==="clean"&&a.coverage!=="clean"?-1:a.score-n.score),"S"),Y=o(({testId:r="advisor-health"})=>{let a=k(),n=p(u.getAdvisories,{},{live:!0}),g=p(u.getAdvisorProcedures,{},{live:!0}),f=n.data?.advisories??null,N=g.data?.procedures??null,t=f===null||N===null?null:$(N,f),v=g.error??n.error;if(v!==null)return(0,e.jsx)(b,{error:v,testId:`${r}-error`});if(t===null)return(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"py-8 text-center text-muted-foreground","data-testid":`${r}-loading`,children:a("Loading\u2026")})});let R=E(t.procedures);return(0,e.jsxs)("div",{className:"space-y-4","data-testid":r,children:[(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:x("text-4xl font-semibold tabular-nums",A[t.grade]),"data-testid":`${r}-score`,children:t.score}),(0,e.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,e.jsx)("span",{className:x("text-sm font-medium uppercase tracking-wide",A[t.grade]),"data-testid":`${r}-grade`,children:t.grade}),(0,e.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${r}-summary`,children:[(0,e.jsxs)("span",{className:m.clean,children:[t.summary.clean," ",a("clean")]}),(0,e.jsxs)("span",{className:m.warned,children:[t.summary.warned," ",a("warned")]}),(0,e.jsxs)("span",{className:m.failing,children:[t.summary.failing," ",a("failing")]}),(0,e.jsxs)("span",{className:m.exempt,children:[t.summary.exempt," ",a("exempt")]})]})]})}),t.project.checks.length>0&&(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"py-4 text-sm","data-testid":`${r}-project`,children:[(0,e.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",t.project.score,"/100"]}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",t.project.checks.map(s=>s.name).join(", ")]})]})}),(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"p-0",children:(0,e.jsxs)(y,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(c,{className:"w-20",children:a("Score")}),(0,e.jsx)(c,{children:a("Procedure")}),(0,e.jsx)(c,{className:"w-32",children:a("Kind")}),(0,e.jsx)(c,{children:a("Rules fired")})]})}),(0,e.jsx)(j,{children:R.map(s=>(0,e.jsxs)(h,{"data-testid":`${r}-row`,children:[(0,e.jsx)(i,{className:x("tabular-nums font-medium",m[s.coverage]),children:s.coverage==="exempt"?"\u2014":s.score}),(0,e.jsx)(i,{className:"font-mono text-xs",children:s.id}),(0,e.jsxs)(i,{className:"text-muted-foreground text-xs",children:[s.visibility," ",s.kind,s.sensitivity.level==="high"&&(0,e.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,e.jsx)(i,{className:"text-muted-foreground text-xs",children:s.coverage==="exempt"?C(s,a("no reason given")):s.checks.map(S=>S.name).join(", ")})]},s.id))})]})})})]})},"Y");export{Y as default};