@lunora/studio 1.0.0-alpha.354 → 1.0.0-alpha.356

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 (67) hide show
  1. package/dist/standalone/{chunk-35BGGOWV.js → chunk-2CWGRQ5L.js} +1 -1
  2. package/dist/standalone/{chunk-FST24UXA.js → chunk-2PHY5V5E.js} +1 -1
  3. package/dist/standalone/{chunk-BKH2NALB.js → chunk-3QGR4DC7.js} +1 -1
  4. package/dist/standalone/{chunk-4EDOPHLM.js → chunk-4BNWYVLP.js} +1 -1
  5. package/dist/standalone/{chunk-ZKPRORLI.js → chunk-4SJDWMH3.js} +1 -1
  6. package/dist/standalone/{chunk-BTOOJXUL.js → chunk-5IIX2STA.js} +1 -1
  7. package/dist/standalone/{chunk-V74BXQXC.js → chunk-5KD75VXP.js} +1 -1
  8. package/dist/standalone/{chunk-LYHEBMM6.js → chunk-64S3IDR2.js} +1 -1
  9. package/dist/standalone/{chunk-6GPEHYCG.js → chunk-7DMOBHYC.js} +1 -1
  10. package/dist/standalone/{chunk-TTD7BKB6.js → chunk-7W6WESSS.js} +1 -1
  11. package/dist/standalone/{chunk-QEVFVWGC.js → chunk-AMLIZFTD.js} +1 -1
  12. package/dist/standalone/{chunk-BAGJYLSU.js → chunk-AQJXOPBW.js} +1 -1
  13. package/dist/standalone/{chunk-W6ZKEW5M.js → chunk-AZRUSOAH.js} +1 -1
  14. package/dist/standalone/{chunk-22O2JDWR.js → chunk-BCIFRJ3Q.js} +1 -1
  15. package/dist/standalone/{chunk-HWTX54JM.js → chunk-CDV6T5KM.js} +1 -1
  16. package/dist/standalone/{chunk-X7GSROPX.js → chunk-CHGMDVEQ.js} +1 -1
  17. package/dist/standalone/{chunk-ACNWZIAH.js → chunk-D5LY65EX.js} +1 -1
  18. package/dist/standalone/{chunk-TBDJVYCB.js → chunk-DN3HPAOA.js} +1 -1
  19. package/dist/standalone/{chunk-DTW4E5AB.js → chunk-DUQ7KXNS.js} +1 -1
  20. package/dist/standalone/{chunk-OJG65AG4.js → chunk-E423VRTC.js} +1 -1
  21. package/dist/standalone/{chunk-453GHHZ4.js → chunk-EEPCLLGE.js} +1 -1
  22. package/dist/standalone/{chunk-2DV455PX.js → chunk-ESUUPILO.js} +1 -1
  23. package/dist/standalone/{chunk-T4VAXHRL.js → chunk-F7GMBSJP.js} +1 -1
  24. package/dist/standalone/{chunk-ZM4K2ETZ.js → chunk-FIJVZCBO.js} +1 -1
  25. package/dist/standalone/chunk-FKM35PXF.js +21 -0
  26. package/dist/standalone/{chunk-4QRVJDM4.js → chunk-FXTT2XP3.js} +1 -1
  27. package/dist/standalone/{chunk-UKKZJRJT.js → chunk-GNVWTK4S.js} +1 -1
  28. package/dist/standalone/{chunk-T2QAOXUO.js → chunk-GZX5XABE.js} +1 -1
  29. package/dist/standalone/{chunk-6DYXTEU7.js → chunk-I2PP6Q6F.js} +1 -1
  30. package/dist/standalone/{chunk-W4X4J7BU.js → chunk-ILLDX6LU.js} +1 -1
  31. package/dist/standalone/{chunk-DSTNWB4N.js → chunk-IMF6DJKL.js} +1 -1
  32. package/dist/standalone/{chunk-UCK6ITED.js → chunk-M3KSCNKR.js} +1 -1
  33. package/dist/standalone/{chunk-MKVZXGJQ.js → chunk-MQ3FFFP4.js} +1 -1
  34. package/dist/standalone/{chunk-3MQ477EE.js → chunk-N5FOHLIG.js} +1 -1
  35. package/dist/standalone/{chunk-IRCUXARN.js → chunk-NQX6SAC6.js} +1 -1
  36. package/dist/standalone/{chunk-S5S2YICJ.js → chunk-NXNUGQHB.js} +1 -1
  37. package/dist/standalone/{chunk-C6FNBKCO.js → chunk-O6XMGPGY.js} +1 -1
  38. package/dist/standalone/{chunk-YRQHFMEY.js → chunk-OGKRWT6I.js} +1 -1
  39. package/dist/standalone/{chunk-57ZNR6IA.js → chunk-OKSZWLJX.js} +1 -1
  40. package/dist/standalone/{chunk-SDTHCM5H.js → chunk-OT4KZ6Y6.js} +1 -1
  41. package/dist/standalone/{chunk-BCOOULSO.js → chunk-Q5GY7D5H.js} +1 -1
  42. package/dist/standalone/{chunk-K7FZTYAY.js → chunk-QSNQXPIX.js} +1 -1
  43. package/dist/standalone/{chunk-FNWRS4VQ.js → chunk-R5ACA3OC.js} +1 -1
  44. package/dist/standalone/{chunk-ZLSNET6H.js → chunk-R66XCM3J.js} +1 -1
  45. package/dist/standalone/{chunk-IVQKQBKK.js → chunk-RNHTOEL7.js} +1 -1
  46. package/dist/standalone/{chunk-WIYDA4XT.js → chunk-S6OBDEAQ.js} +1 -1
  47. package/dist/standalone/{chunk-6QBK3Z7A.js → chunk-SL7LF2SO.js} +1 -1
  48. package/dist/standalone/{chunk-FXGYX2V6.js → chunk-SOVH524I.js} +1 -1
  49. package/dist/standalone/{chunk-4UWYDYM5.js → chunk-SPPJFTWE.js} +1 -1
  50. package/dist/standalone/{chunk-RQDSPVVH.js → chunk-SV34MAIK.js} +1 -1
  51. package/dist/standalone/{chunk-HZCLLEWP.js → chunk-TAGWTOFD.js} +1 -1
  52. package/dist/standalone/{chunk-VHMA6YPT.js → chunk-TIQ3NI77.js} +1 -1
  53. package/dist/standalone/{chunk-4CITH2NU.js → chunk-TNII7Q2L.js} +1 -1
  54. package/dist/standalone/{chunk-ANACHJRU.js → chunk-U2YFL6EA.js} +1 -1
  55. package/dist/standalone/{chunk-Q4N3TJPV.js → chunk-UHGLZ5RV.js} +1 -1
  56. package/dist/standalone/{chunk-7EAHHRJR.js → chunk-UWAVY3IF.js} +1 -1
  57. package/dist/standalone/{chunk-S6JFSLBK.js → chunk-VO6GV6F2.js} +1 -1
  58. package/dist/standalone/{chunk-2EMNPL3B.js → chunk-VPG46PCA.js} +1 -1
  59. package/dist/standalone/{chunk-6GRI2HXU.js → chunk-XFTWGZKD.js} +1 -1
  60. package/dist/standalone/{chunk-M2RIGPGL.js → chunk-YHK5UBXI.js} +1 -1
  61. package/dist/standalone/{chunk-RHOQJNDW.js → chunk-YJYXN3WQ.js} +1 -1
  62. package/dist/standalone/{chunk-Y7SN6CTX.js → chunk-Z3NZJ4C2.js} +1 -1
  63. package/dist/standalone/{chunk-SM2IQWCJ.js → chunk-ZXUEBA56.js} +1 -1
  64. package/dist/standalone/{chunk-KNX3KB7E.js → chunk-ZZ5564FZ.js} +1 -1
  65. package/dist/standalone/studio.js +1 -1
  66. package/package.json +5 -5
  67. package/dist/standalone/chunk-OIDFWEJX.js +0 -21
@@ -1 +1 @@
1
- import{a as O}from"./chunk-W4X4J7BU.js";import{a as H}from"./chunk-ZWDORIZY.js";import{a as ee}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as Z}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{b as E}from"./chunk-ZKPRORLI.js";import{p as W}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as R}from"./chunk-3Y5K3IQO.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-CW57Q264.js";import{a as A,e as T}from"./chunk-MD67S53Z.js";import{f as M,j as G,s as _,w as X}from"./chunk-LPINY2IJ.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-OXFKZ4BM.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1),Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"F"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=W(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let v=await(d??(()=>f.listScheduledJobs()))();return le(v)}),[x,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(v=>{m(void 0),n(le(v))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let g;e[5]!==N?(g=c(()=>N.poll(),"y"),e[5]=N,e[6]=g):g=e[6],O(g,!l);let J=ce(f,i,d),b=x??N.data,j=s??N.error,L=c(async v=>{if(J!==void 0){m(void 0);try{await J(v),l||N.refetch()}catch(D){m(G(D))}}},"E"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",S;e[7]!==j?(S=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=S):S=e[8];let $;e[9]!==b?.length||e[10]!==r?($=b?.length===0&&(0,h.jsx)(R,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=$):$=e[11];let I=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(v=>(0,h.jsxs)(F,{"data-testid":`sj-row-${v.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:v.workflow??v.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(v.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:v.attempts??0}),(0,h.jsx)(p,{children:v.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.id}),J!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{_(L(v.id))},"onConfirm"),testId:`sj-cancel-${v.id}`,children:r("Cancel")})})]},v.id))})]})})}),w;return e[12]!==I||e[13]!==S||e[14]!==$?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[S,$,I]}),e[12]=I,e[13]=S,e[14]=$,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=W(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,x=me(i,a,e),n=c(async s=>{if(x!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await x(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(R,{description:d("Triggers declared with the cronJobs() builder appear here."),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)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),x!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),x!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{_(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=W(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let x;e[3]!==l||e[4]!==d?(x=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=x):x=e[5];let n=E(N,x),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,g=d===void 0,J;e[6]!==l||e[7]!==g||e[8]!==r?(J=r??(g?C=>l.retryDeadJob(C):void 0),e[6]=l,e[7]=g,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==g||e[12]!==f?(j=f??(g?C=>l.removeDeadJob(C):void 0),e[10]=l,e[11]=g,e[12]=f,e[13]=j):j=e[13];let L=j,q;e[14]!==n?(q=c(()=>n.poll(),"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async C=>{y(void 0);try{await C,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let S=B,$=b!==void 0||L!==void 0,I;e[18]!==k?(I=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=I):I=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(R,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),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:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let v;e[23]!==S||e[24]!==$||e[25]!==s||e[26]!==L||e[27]!==b||e[28]!==o?(v=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),$&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(C=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${C.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:C.workflow??C.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:C.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(C.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.pool??""}),(0,t.jsx)(p,{children:C.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.id}),$&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${C.id}`,onClick:c(()=>{_(S(b(C.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),L!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{_(S(L(C.id)))},"onConfirm"),testId:`dlq-remove-${C.id}`,children:o("Drop")})]})})]},C.id))})]})})}),e[23]=S,e[24]=$,e[25]=s,e[26]=L,e[27]=b,e[28]=o,e[29]=v):v=e[29];let D;return e[30]!==v||e[31]!==I||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[I,w,v]}),e[30]=v,e[31]=I,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=W(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let x=E(o,N),{data:n,error:s}=x,m;e[7]!==x?(m=c(()=>x.poll(),"d"),e[7]=x,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let g;e[14]!==n?.pools.length||e[15]!==r?(g=n?.pools.length===0&&(0,t.jsx)(R,{description:r("Pools created with createWorkpool appear here once they have activity."),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:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=g):g=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==g||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,g,J]}),e[20]=y,e[21]=k,e[22]=g,e[23]=J,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),x;e[2]!==l?(x=l("Cron triggers"),e[2]=l,e[3]=x):x=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==x||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:x,dead:n,jobs:s,pools:m},e[10]=x,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=g):g=e[15];let J=g,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:J,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let L;e[21]!==b||e[22]!==j?(L=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=L):L=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let S;e[30]!==o?(S=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=S):S=e[31];let $;e[32]!==d||e[33]!==o?($=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=$):$=e[34];let I;return e[35]!==L||e[36]!==q||e[37]!==B||e[38]!==S||e[39]!==$?(I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[L,q,B,S,$]}),e[35]=L,e[36]=q,e[37]=B,e[38]=S,e[39]=$,e[40]=I):I=e[40],I},"Ie");export{Ve as SchedulePanel};
1
+ import{a as O}from"./chunk-ILLDX6LU.js";import{a as H}from"./chunk-ZWDORIZY.js";import{a as ee}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as Z}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{b as E}from"./chunk-4SJDWMH3.js";import{p as W}from"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as R}from"./chunk-3Y5K3IQO.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-CW57Q264.js";import{a as A,e as T}from"./chunk-MD67S53Z.js";import{f as M,j as G,s as _,w as X}from"./chunk-LPINY2IJ.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-OXFKZ4BM.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1),Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"F"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=W(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let v=await(d??(()=>f.listScheduledJobs()))();return le(v)}),[x,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(v=>{m(void 0),n(le(v))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let g;e[5]!==N?(g=c(()=>N.poll(),"y"),e[5]=N,e[6]=g):g=e[6],O(g,!l);let J=ce(f,i,d),b=x??N.data,j=s??N.error,L=c(async v=>{if(J!==void 0){m(void 0);try{await J(v),l||N.refetch()}catch(D){m(G(D))}}},"E"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",S;e[7]!==j?(S=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=S):S=e[8];let $;e[9]!==b?.length||e[10]!==r?($=b?.length===0&&(0,h.jsx)(R,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=$):$=e[11];let I=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(v=>(0,h.jsxs)(F,{"data-testid":`sj-row-${v.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:v.workflow??v.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(v.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:v.attempts??0}),(0,h.jsx)(p,{children:v.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.id}),J!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{_(L(v.id))},"onConfirm"),testId:`sj-cancel-${v.id}`,children:r("Cancel")})})]},v.id))})]})})}),w;return e[12]!==I||e[13]!==S||e[14]!==$?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[S,$,I]}),e[12]=I,e[13]=S,e[14]=$,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=W(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,x=me(i,a,e),n=c(async s=>{if(x!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await x(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(R,{description:d("Triggers declared with the cronJobs() builder appear here."),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)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),x!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),x!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{_(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=W(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let x;e[3]!==l||e[4]!==d?(x=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=x):x=e[5];let n=E(N,x),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,g=d===void 0,J;e[6]!==l||e[7]!==g||e[8]!==r?(J=r??(g?C=>l.retryDeadJob(C):void 0),e[6]=l,e[7]=g,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==g||e[12]!==f?(j=f??(g?C=>l.removeDeadJob(C):void 0),e[10]=l,e[11]=g,e[12]=f,e[13]=j):j=e[13];let L=j,q;e[14]!==n?(q=c(()=>n.poll(),"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async C=>{y(void 0);try{await C,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let S=B,$=b!==void 0||L!==void 0,I;e[18]!==k?(I=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=I):I=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(R,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),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:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let v;e[23]!==S||e[24]!==$||e[25]!==s||e[26]!==L||e[27]!==b||e[28]!==o?(v=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),$&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(C=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${C.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:C.workflow??C.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:C.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(C.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.pool??""}),(0,t.jsx)(p,{children:C.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.id}),$&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${C.id}`,onClick:c(()=>{_(S(b(C.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),L!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{_(S(L(C.id)))},"onConfirm"),testId:`dlq-remove-${C.id}`,children:o("Drop")})]})})]},C.id))})]})})}),e[23]=S,e[24]=$,e[25]=s,e[26]=L,e[27]=b,e[28]=o,e[29]=v):v=e[29];let D;return e[30]!==v||e[31]!==I||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[I,w,v]}),e[30]=v,e[31]=I,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=W(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let x=E(o,N),{data:n,error:s}=x,m;e[7]!==x?(m=c(()=>x.poll(),"d"),e[7]=x,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let g;e[14]!==n?.pools.length||e[15]!==r?(g=n?.pools.length===0&&(0,t.jsx)(R,{description:r("Pools created with createWorkpool appear here once they have activity."),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:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=g):g=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==g||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,g,J]}),e[20]=y,e[21]=k,e[22]=g,e[23]=J,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),x;e[2]!==l?(x=l("Cron triggers"),e[2]=l,e[3]=x):x=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==x||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:x,dead:n,jobs:s,pools:m},e[10]=x,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=g):g=e[15];let J=g,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:J,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let L;e[21]!==b||e[22]!==j?(L=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=L):L=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let S;e[30]!==o?(S=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=S):S=e[31];let $;e[32]!==d||e[33]!==o?($=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=$):$=e[34];let I;return e[35]!==L||e[36]!==q||e[37]!==B||e[38]!==S||e[39]!==$?(I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[L,q,B,S,$]}),e[35]=L,e[36]=q,e[37]=B,e[38]=S,e[39]=$,e[40]=I):I=e[40],I},"Ie");export{Ve as SchedulePanel};
@@ -1 +1 @@
1
- import{i as R}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as B}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as S}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as q}from"./chunk-DSTNWB4N.js";import"./chunk-OSJ7HV7B.js";import"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import{a as U}from"./chunk-6UTZXEW3.js";import{c as O}from"./chunk-ZKPRORLI.js";import"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as D}from"./chunk-3Y5K3IQO.js";import{a as G,b as J,c as K,d as F,e as s,f as o}from"./chunk-CW57Q264.js";import{a as V,e as W}from"./chunk-MD67S53Z.js";import{f as P,w as H}from"./chunk-LPINY2IJ.js";import{a as n,d as j,e as re,f as ae,g as ie}from"./chunk-OXFKZ4BM.js";var X=j(ae(),1),M=j(re(),1);var t=j(ie(),1);var ne=n(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","te"),Q=n(e=>e.endpoint??e.id,"M"),ve=n(()=>{let e=(0,X.c)(38),r=P(),[i,Y]=(0,M.useState)("all"),[l,Z]=(0,M.useState)(""),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let{data:I,error:d,errorSource:x,isLoading:_,refetch:v}=O(U.listPushSubscriptions,g),N;if(e[1]!==I?.subscriptions||e[2]!==d||e[3]!==x||e[4]!==_||e[5]!==i||e[6]!==v||e[7]!==l||e[8]!==r){let L=I?.subscriptions??[],T=l.trim().toLowerCase(),A=L.filter(a=>i!=="all"&&a.kind!==i?!1:T===""?!0:`${Q(a)} ${a.userId??""}`.toLowerCase().includes(T)),b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=n(a=>{Z(a.target.value)},"w"),e[10]=b):b=e[10];let ee=b,w;e[11]!==v?(w=n(()=>{v()},"y"),e[11]=v,e[12]=w):w=e[12];let E=w,k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=["all","web-push","fcm"],e[13]=k):k=e[13];let te=k,c;e[14]!==i||e[15]!==r?(c=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:te.map(a=>(0,t.jsx)(B,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:n(()=>{Y(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=c):c=e[16];let m;e[17]!==r?(m=r("Filter devices"),e[17]=r,e[18]=m):m=e[18];let h;e[19]!==r?(h=r("filter endpoint, user"),e[19]=r,e[20]=h):h=e[20];let u;e[21]!==l||e[22]!==m||e[23]!==h?(u=(0,t.jsx)(R,{"aria-label":m,className:"h-8 w-56","data-testid":"nt-search",onChange:ee,placeholder:h,value:l}),e[21]=l,e[22]=m,e[23]=h,e[24]=u):u=e[24];let f;e[25]!==r?(f=r("Refresh"),e[25]=r,e[26]=f):f=e[26];let p;e[27]!==E||e[28]!==f?(p=(0,t.jsx)(B,{className:"ml-auto","data-testid":"nt-refresh",onClick:E,size:"sm",type:"button",variant:"outline",children:f}),e[27]=E,e[28]=f,e[29]=p):p=e[29];let $=L.length>0&&(0,t.jsx)(S,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:L.length})}),y;e[30]!==p||e[31]!==$||e[32]!==c||e[33]!==u?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p,$]}),e[30]=p,e[31]=$,e[32]=c,e[33]=u,e[34]=y):y=e[34];let C;e[35]!==d||e[36]!==x?(C=d!==null&&(0,t.jsx)(q,{error:x,testId:"nt-error"}),e[35]=d,e[36]=x,e[37]=C):C=e[37],N=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[y,C,d===null&&!_&&A.length===0&&(0,t.jsx)(D,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),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:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&(0,t.jsx)(V,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"nt-table",children:[(0,t.jsx)(J,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(s,{children:r("kind")}),(0,t.jsx)(s,{children:r("endpoint")}),(0,t.jsx)(s,{children:r("user")}),(0,t.jsx)(s,{children:r("last seen")}),(0,t.jsx)(s,{children:r("status")}),(0,t.jsx)(s,{children:r("error")})]})}),(0,t.jsx)(K,{children:A.map(a=>{let z=Q(a);return(0,t.jsxs)(F,{"data-testid":"nt-row",children:[(0,t.jsx)(o,{children:(0,t.jsx)(S,{variant:"outline",children:a.kind})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs",title:z,children:z}),(0,t.jsx)(o,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(o,{className:"text-muted-foreground tabular-nums",children:H(a.lastSeenAt,"\u2014")}),(0,t.jsx)(o,{children:(0,t.jsx)(S,{"data-testid":`nt-status-${a.id}`,variant:ne(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=I?.subscriptions,e[2]=d,e[3]=x,e[4]=_,e[5]=i,e[6]=v,e[7]=l,e[8]=r,e[9]=N}else N=e[9];return N},"ge");export{ve as default};
1
+ import{i as R}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as B}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as S}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as q}from"./chunk-IMF6DJKL.js";import"./chunk-OSJ7HV7B.js";import"./chunk-SL7LF2SO.js";import"./chunk-E26OT26O.js";import{a as U}from"./chunk-6UTZXEW3.js";import{c as O}from"./chunk-4SJDWMH3.js";import"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as D}from"./chunk-3Y5K3IQO.js";import{a as G,b as J,c as K,d as F,e as s,f as o}from"./chunk-CW57Q264.js";import{a as V,e as W}from"./chunk-MD67S53Z.js";import{f as P,w as H}from"./chunk-LPINY2IJ.js";import{a as n,d as j,e as re,f as ae,g as ie}from"./chunk-OXFKZ4BM.js";var X=j(ae(),1),M=j(re(),1);var t=j(ie(),1);var ne=n(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","te"),Q=n(e=>e.endpoint??e.id,"M"),ve=n(()=>{let e=(0,X.c)(38),r=P(),[i,Y]=(0,M.useState)("all"),[l,Z]=(0,M.useState)(""),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let{data:I,error:d,errorSource:x,isLoading:_,refetch:v}=O(U.listPushSubscriptions,g),N;if(e[1]!==I?.subscriptions||e[2]!==d||e[3]!==x||e[4]!==_||e[5]!==i||e[6]!==v||e[7]!==l||e[8]!==r){let L=I?.subscriptions??[],T=l.trim().toLowerCase(),A=L.filter(a=>i!=="all"&&a.kind!==i?!1:T===""?!0:`${Q(a)} ${a.userId??""}`.toLowerCase().includes(T)),b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=n(a=>{Z(a.target.value)},"w"),e[10]=b):b=e[10];let ee=b,w;e[11]!==v?(w=n(()=>{v()},"y"),e[11]=v,e[12]=w):w=e[12];let E=w,k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=["all","web-push","fcm"],e[13]=k):k=e[13];let te=k,c;e[14]!==i||e[15]!==r?(c=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:te.map(a=>(0,t.jsx)(B,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:n(()=>{Y(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=c):c=e[16];let m;e[17]!==r?(m=r("Filter devices"),e[17]=r,e[18]=m):m=e[18];let h;e[19]!==r?(h=r("filter endpoint, user"),e[19]=r,e[20]=h):h=e[20];let u;e[21]!==l||e[22]!==m||e[23]!==h?(u=(0,t.jsx)(R,{"aria-label":m,className:"h-8 w-56","data-testid":"nt-search",onChange:ee,placeholder:h,value:l}),e[21]=l,e[22]=m,e[23]=h,e[24]=u):u=e[24];let f;e[25]!==r?(f=r("Refresh"),e[25]=r,e[26]=f):f=e[26];let p;e[27]!==E||e[28]!==f?(p=(0,t.jsx)(B,{className:"ml-auto","data-testid":"nt-refresh",onClick:E,size:"sm",type:"button",variant:"outline",children:f}),e[27]=E,e[28]=f,e[29]=p):p=e[29];let $=L.length>0&&(0,t.jsx)(S,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:L.length})}),y;e[30]!==p||e[31]!==$||e[32]!==c||e[33]!==u?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p,$]}),e[30]=p,e[31]=$,e[32]=c,e[33]=u,e[34]=y):y=e[34];let C;e[35]!==d||e[36]!==x?(C=d!==null&&(0,t.jsx)(q,{error:x,testId:"nt-error"}),e[35]=d,e[36]=x,e[37]=C):C=e[37],N=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[y,C,d===null&&!_&&A.length===0&&(0,t.jsx)(D,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),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:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&(0,t.jsx)(V,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"nt-table",children:[(0,t.jsx)(J,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(s,{children:r("kind")}),(0,t.jsx)(s,{children:r("endpoint")}),(0,t.jsx)(s,{children:r("user")}),(0,t.jsx)(s,{children:r("last seen")}),(0,t.jsx)(s,{children:r("status")}),(0,t.jsx)(s,{children:r("error")})]})}),(0,t.jsx)(K,{children:A.map(a=>{let z=Q(a);return(0,t.jsxs)(F,{"data-testid":"nt-row",children:[(0,t.jsx)(o,{children:(0,t.jsx)(S,{variant:"outline",children:a.kind})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs",title:z,children:z}),(0,t.jsx)(o,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(o,{className:"text-muted-foreground tabular-nums",children:H(a.lastSeenAt,"\u2014")}),(0,t.jsx)(o,{children:(0,t.jsx)(S,{"data-testid":`nt-status-${a.id}`,variant:ne(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=I?.subscriptions,e[2]=d,e[3]=x,e[4]=_,e[5]=i,e[6]=v,e[7]=l,e[8]=r,e[9]=N}else N=e[9];return N},"ge");export{ve as default};
@@ -1,4 +1,4 @@
1
- import{a as le}from"./chunk-SJLEEYCR.js";import{a as Pe}from"./chunk-P6L6ABWO.js";import{a as he}from"./chunk-OUFWXYEF.js";import{a as V}from"./chunk-HKLF627N.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-XYR5NST4.js";import{a as Ce}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{i as ve}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as U}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as ye}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as $e}from"./chunk-6UTZXEW3.js";import{a as be,p as F}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as E}from"./chunk-3Y5K3IQO.js";import{b as ue,f as M,g as Se,h as se,i as ie,j as fe,p as Ie,s as Oe,v as ae}from"./chunk-LPINY2IJ.js";import{a as u,d as L,e as me,f as te,g as re}from"./chunk-OXFKZ4BM.js";var Qe=L(te(),1),xe=L(me(),1);var Y=L(te(),1),X=L(me(),1);var R=L(re(),1);var Xe=se($e.listTables),Ye=["react","client","cli"],Ze={action:"action",mutation:"mutation",query:"query"},Te=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),et=u(({file:t,fn:e,kind:a})=>`await client.${Ze[a]}(api.${t}.${e}, { /* args */ });`,"ae"),tt=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),rt=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),at=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
1
+ import{a as le}from"./chunk-SJLEEYCR.js";import{a as Pe}from"./chunk-P6L6ABWO.js";import{a as he}from"./chunk-OUFWXYEF.js";import{a as V}from"./chunk-HKLF627N.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-XYR5NST4.js";import{a as Ce}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{i as ve}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as U}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as ye}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as $e}from"./chunk-6UTZXEW3.js";import{a as be,p as F}from"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as E}from"./chunk-3Y5K3IQO.js";import{b as ue,f as M,g as Se,h as se,i as ie,j as fe,p as Ie,s as Oe,v as ae}from"./chunk-LPINY2IJ.js";import{a as u,d as L,e as me,f as te,g as re}from"./chunk-OXFKZ4BM.js";var Qe=L(te(),1),xe=L(me(),1);var Y=L(te(),1),X=L(me(),1);var R=L(re(),1);var Xe=se($e.listTables),Ye=["react","client","cli"],Ze={action:"action",mutation:"mutation",query:"query"},Te=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),et=u(({file:t,fn:e,kind:a})=>`await client.${Ze[a]}(api.${t}.${e}, { /* args */ });`,"ae"),tt=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),rt=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),at=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
2
2
  `),"ce"),nt=u((t,e)=>{switch(t){case"cli":return rt(e);case"client":return et(e);default:return tt(e)}},"re"),Re=u(t=>{let e=(0,Y.c)(19),{code:a,label:r,testId:n}=t,s=M(),o;e[0]!==a?(o=u(()=>{ae(a)},"c"),e[0]=a,e[1]=o):o=e[1];let i=o,c;e[2]!==r?(c=(0,R.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:r}),e[2]=r,e[3]=c):c=e[3];let m=`${n}-copy`,l;e[4]!==s?(l=s("Copy"),e[4]=s,e[5]=l):l=e[5];let p;e[6]!==i||e[7]!==m||e[8]!==l?(p=(0,R.jsx)(U,{"data-testid":m,onClick:i,size:"xs",type:"button",variant:"ghost",children:l}),e[6]=i,e[7]=m,e[8]=l,e[9]=p):p=e[9];let f;e[10]!==c||e[11]!==p?(f=(0,R.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[c,p]}),e[10]=c,e[11]=p,e[12]=f):f=e[12];let h;e[13]!==a||e[14]!==n?(h=(0,R.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:a}),e[13]=a,e[14]=n,e[15]=h):h=e[15];let g;return e[16]!==f||e[17]!==h?(g=(0,R.jsxs)("div",{className:"flex flex-col gap-1.5",children:[f,h]}),e[16]=f,e[17]=h,e[18]=g):g=e[18],g},"U"),ot=u(t=>{let e=(0,Y.c)(46),{file:a,fn:r,kind:n}=t,s=M(),[o,i]=(0,X.useState)("react"),c,m,l;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==s||e[4]!==o){let w={file:a,fn:r,kind:n},P;e[8]!==s?(P=s("CLI"),e[8]=s,e[9]=P):P=e[9];let O;e[10]!==s?(O=s("Client"),e[10]=s,e[11]=O):O=e[11];let S;e[12]!==s?(S=s("React"),e[12]=s,e[13]=S):S=e[13];let T;e[14]!==P||e[15]!==O||e[16]!==S?(T={cli:P,client:O,react:S},e[14]=P,e[15]=O,e[16]=S,e[17]=T):T=e[17],l=T;let A;e[18]===Symbol.for("react.memo_cache_sentinel")?(A=u(_=>{i(_.currentTarget.dataset.tab)},"B"),e[18]=A):A=e[18],c=A,m=nt(o,w),e[0]=a,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=c,e[6]=m,e[7]=l}else c=e[5],m=e[6],l=e[7];let p=m,f=`api.${a}.${r}`,h;e[19]!==f?(h=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:f}),e[19]=f,e[20]=h):h=e[20];let g;e[21]!==n||e[22]!==s?(g=s("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=s,e[23]=g):g=e[23];let x;e[24]!==g?(x=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),e[24]=g,e[25]=x):x=e[25];let v;e[26]!==h||e[27]!==x?(v=(0,R.jsxs)("div",{children:[h,x]}),e[26]=h,e[27]=x,e[28]=v):v=e[28];let N;e[29]!==s?(N=s("Snippet flavour"),e[29]=s,e[30]=N):N=e[30];let y;e[31]!==c||e[32]!==o||e[33]!==l?(y=Ye.map(w=>(0,R.jsx)(U,{"aria-selected":o===w,"data-tab":w,"data-testid":`api-tab-${w}`,onClick:c,role:"tab",size:"xs",type:"button",variant:o===w?"default":"outline",children:l[w]},w)),e[31]=c,e[32]=o,e[33]=l,e[34]=y):y=e[34];let b;e[35]!==N||e[36]!==y?(b=(0,R.jsx)("div",{"aria-label":N,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:y}),e[35]=N,e[36]=y,e[37]=b):b=e[37];let I=l[o],C=`api-snippet-${o}`,$;e[38]!==p||e[39]!==I||e[40]!==C?($=(0,R.jsx)(Re,{code:p,label:I,testId:C}),e[38]=p,e[39]=I,e[40]=C,e[41]=$):$=e[41];let k;return e[42]!==$||e[43]!==v||e[44]!==b?(k=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[v,b,$]}),e[42]=$,e[43]=v,e[44]=b,e[45]=k):k=e[45],k},"de"),st=u(t=>{let e=(0,Y.c)(19),{name:a}=t,r=M(),n;e[0]!==a?(n=at(a),e[0]=a,e[1]=n):n=e[1];let s=n,o;e[2]!==a?(o=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:a}),e[2]=a,e[3]=o):o=e[3];let i;e[4]!==r?(i=r("Read and write this table through the typed data model."),e[4]=r,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==o||e[9]!==c?(m=(0,R.jsxs)("div",{children:[o,c]}),e[8]=o,e[9]=c,e[10]=m):m=e[10];let l;e[11]!==r?(l=r("Data model"),e[11]=r,e[12]=l):l=e[12];let p;e[13]!==s||e[14]!==l?(p=(0,R.jsx)(Re,{code:s,label:l,testId:"api-snippet-table"}),e[13]=s,e[14]=l,e[15]=p):p=e[15];let f;return e[16]!==m||e[17]!==p?(f=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[m,p]}),e[16]=m,e[17]=p,e[18]=f):f=e[18],f},"fe"),je=u(t=>{let e=(0,Y.c)(8),{active:a,label:r,onSelect:n,testId:s,value:o}=t,i;e[0]!==n||e[1]!==o?(i=u(()=>{n(o)},"m"),e[0]=n,e[1]=o,e[2]=i):i=e[2];let c=i,m=a?"page":void 0,l;return e[3]!==r||e[4]!==c||e[5]!==m||e[6]!==s?(l=(0,R.jsx)("button",{"aria-current":m,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":s,onClick:c,type:"button",children:r}),e[3]=r,e[4]=c,e[5]=m,e[6]=s,e[7]=l):l=e[7],l},"G"),it=u(t=>{let e=new Map;for(let a of t){let{file:r,fn:n}=Te(a.path),s=e.get(r)??[];s.push({fn:n,kind:a.kind,path:a.path}),e.set(r,s)}return[...e.entries()].map(([a,r])=>({file:a,items:r.toSorted((n,s)=>n.fn.localeCompare(s.fn))})).toSorted((a,r)=>a.file.localeCompare(r.file))},"pe"),Ae=u(t=>{let e=(0,Y.c)(58),{functions:a,initialShardKey:r}=t,n=M(),s=F(),[o,i]=(0,X.useState)(null),[c,m]=(0,X.useState)(null),l,p;e[0]!==s||e[1]!==r?(l=u(()=>{let _=!1;return s.query(Xe,{},ie(r??"")).then(j=>(_||i(j),j)).catch(()=>{_||i([])}),()=>{_=!0}},"o"),p=[s,r],e[0]=s,e[1]=r,e[2]=l,e[3]=p):(l=e[2],p=e[3]),(0,X.useEffect)(l,p);let f,h,g,x,v,N,y,b,I,C;if(e[4]!==a||e[5]!==c||e[6]!==n||e[7]!==o){let _=a??[],j=it(_),q=(o??[]).map(lt).toSorted(dt),J;e[18]===Symbol.for("react.memo_cache_sentinel")?(J=u(K=>{m({kind:"fn",path:K})},"P"),e[18]=J):J=e[18];let W=J,Q;e[19]===Symbol.for("react.memo_cache_sentinel")?(Q=u(K=>{m({kind:"table",name:K})},"j"),e[19]=Q):Q=e[19];let Ve=Q;h=c?.kind==="fn"?_.find(K=>K.path===c.path):void 0,f=_.length>0||q.length>0,g=h===void 0?void 0:Te(h.path),I="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",C="lunora-api-docs",e[20]!==n?(x=n("API resources"),e[20]=n,e[21]=x):x=e[21],v="flex flex-col gap-4 overflow-y-auto",N="api-rail";let ne;e[22]!==c||e[23]!==n?(ne=u(K=>(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:K.file||n("(root)")}),K.items.map(ee=>(0,R.jsx)(je,{active:c?.kind==="fn"&&c.path===ee.path,label:ee.fn,onSelect:W,testId:`api-rail-fn-${ee.path}`,value:ee.path},ee.path))]},K.file),"q"),e[22]=c,e[23]=n,e[24]=ne):ne=e[24],y=j.map(ne),b=q.length>0&&(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")}),q.map(K=>(0,R.jsx)(je,{active:c?.kind==="table"&&c.name===K,label:K,onSelect:Ve,testId:`api-rail-table-${K}`,value:K},K))]}),e[4]=a,e[5]=c,e[6]=n,e[7]=o,e[8]=f,e[9]=h,e[10]=g,e[11]=x,e[12]=v,e[13]=N,e[14]=y,e[15]=b,e[16]=I,e[17]=C}else f=e[8],h=e[9],g=e[10],x=e[11],v=e[12],N=e[13],y=e[14],b=e[15],I=e[16],C=e[17];let $;e[25]!==f||e[26]!==n?($=!f&&(0,R.jsx)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")}),e[25]=f,e[26]=n,e[27]=$):$=e[27];let k;e[28]!==$||e[29]!==x||e[30]!==v||e[31]!==N||e[32]!==y||e[33]!==b?(k=(0,R.jsxs)("nav",{"aria-label":x,className:v,"data-testid":N,children:[y,b,$]}),e[28]=$,e[29]=x,e[30]=v,e[31]=N,e[32]=y,e[33]=b,e[34]=k):k=e[34];let w;e[35]!==c||e[36]!==n?(w=c===null&&(0,R.jsx)(E,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")}),e[35]=c,e[36]=n,e[37]=w):w=e[37];let P;e[38]!==c?.kind||e[39]!==h||e[40]!==g?(P=c?.kind==="fn"&&h!==void 0&&g!==void 0&&(0,R.jsx)(ot,{file:g.file,fn:g.fn,kind:h.kind},h.path),e[38]=c?.kind,e[39]=h,e[40]=g,e[41]=P):P=e[41];let O;e[42]!==c?.kind||e[43]!==h||e[44]!==n?(O=c?.kind==="fn"&&h===void 0&&(0,R.jsx)(E,{testId:"api-empty",title:n("API usage snippets")}),e[42]=c?.kind,e[43]=h,e[44]=n,e[45]=O):O=e[45];let S;e[46]!==c?(S=c?.kind==="table"&&(0,R.jsx)(st,{name:c.name}),e[46]=c,e[47]=S):S=e[47];let T;e[48]!==w||e[49]!==P||e[50]!==O||e[51]!==S?(T=(0,R.jsxs)("div",{className:"min-w-0",children:[w,P,O,S]}),e[48]=w,e[49]=P,e[50]=O,e[51]=S,e[52]=T):T=e[52];let A;return e[53]!==k||e[54]!==T||e[55]!==I||e[56]!==C?(A=(0,R.jsxs)("div",{className:I,"data-testid":C,children:[k,T]}),e[53]=k,e[54]=T,e[55]=I,e[56]=C,e[57]=A):A=e[57],A},"ke");function lt(t){return t.name}u(lt,"ue");function dt(t,e){return t.localeCompare(e)}u(dt,"me");var We=L(te(),1);var B=L(te(),1);var z=L(me(),1);var d=L(re(),1);var ct=u(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","we"),Me=u(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"Q"),ce=u(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>ce(e)).join(" | "):t.type==="array"?`array<${ce(t.items)}>`:t.type??"any","z"),pt=u(t=>{let e=Me(t);return e!==void 0?t.type??ct(e[0]):ce(t)},"ke"),mt=u(t=>{let e=Me(t);return e===void 0?void 0:e.map(a=>JSON.stringify(a)).join(" | ")},"Oe"),ut=u(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let a=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let r=e.length>(a?2:1);return a||r?e.join(" "):void 0},"$e"),ft=u(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"Te"),Z=u(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return Z(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[a,r]of Object.entries(t.properties??{}))e[a]=Z(r);return e}case"string":return"";default:return null}},"D"),de=u(t=>{let e=(0,B.c)(7),{label:a,value:r}=t,n;e[0]!==a?(n=(0,d.jsx)("span",{className:"text-muted-foreground",children:a}),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==r?(s=(0,d.jsx)("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"K"),ht=u(t=>{let e=(0,B.c)(40),{name:a,required:r,schema:n}=t,s=M(),o;e[0]!==n?(o=ut(n),e[0]=n,e[1]=o):o=e[1];let i=o,c;e[2]!==n?(c=mt(n),e[2]=n,e[3]=c):c=e[3];let m=c,l=n["x-lunora-table"],p=n.format!==void 0||i!==void 0||m!==void 0||l!==void 0,f;e[4]!==n?(f=ft(n),e[4]=n,e[5]=f):f=e[5];let h=f,g=r?"*":"?",x;e[6]!==g?(x=(0,d.jsx)("span",{className:"text-muted-foreground",children:g}),e[6]=g,e[7]=x):x=e[7];let v;e[8]!==a||e[9]!==x?(v=(0,d.jsxs)("span",{className:"font-mono text-foreground",children:[a,x]}),e[8]=a,e[9]=x,e[10]=v):v=e[10];let N;e[11]!==n?(N=pt(n),e[11]=n,e[12]=N):N=e[12];let y;e[13]!==N?(y=(0,d.jsx)("span",{className:"font-mono text-muted-foreground",children:N}),e[13]=N,e[14]=y):y=e[14];let b;e[15]!==v||e[16]!==y?(b=(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[v,y]}),e[15]=v,e[16]=y,e[17]=b):b=e[17];let I;e[18]!==n.description?(I=n.description!==void 0&&(0,d.jsx)("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=I):I=e[19];let C;e[20]!==p||e[21]!==i||e[22]!==l||e[23]!==n.format||e[24]!==s||e[25]!==m?(C=p&&(0,d.jsxs)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,d.jsx)(de,{label:s("Format"),value:n.format}),i!==void 0&&(0,d.jsx)(de,{label:s("Range"),value:i}),m!==void 0&&(0,d.jsx)(de,{label:s("Value in"),value:m}),l!==void 0&&(0,d.jsx)(de,{label:s("relation"),value:l})]}),e[20]=p,e[21]=i,e[22]=l,e[23]=n.format,e[24]=s,e[25]=m,e[26]=C):C=e[26];let $;e[27]!==I||e[28]!==C||e[29]!==b?($=(0,d.jsxs)("div",{className:"flex flex-col gap-1 py-2",children:[b,I,C]}),e[27]=I,e[28]=C,e[29]=b,e[30]=$):$=e[30];let k=$;if(h===void 0){let S;return e[31]!==k?(S=(0,d.jsx)("div",{className:"border-b border-border/50 last:border-b-0",children:k}),e[31]=k,e[32]=S):S=e[32],S}let w;e[33]!==k?(w=(0,d.jsx)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:k}),e[33]=k,e[34]=w):w=e[34];let P;e[35]!==h?(P=(0,d.jsx)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,d.jsx)(qe,{schema:h})}),e[35]=h,e[36]=P):P=e[36];let O;return e[37]!==w||e[38]!==P?(O=(0,d.jsxs)("details",{className:"border-b border-border/50 last:border-b-0",children:[w,P]}),e[37]=w,e[38]=P,e[39]=O):O=e[39],O},"Ce"),qe=u(t=>{let e=(0,B.c)(7),{schema:a}=t,r;e[0]!==a.required?(r=new Set(a.required),e[0]=a.required,e[1]=r):r=e[1];let n=r,s;e[2]!==a.properties?(s=Object.entries(a.properties??{}),e[2]=a.properties,e[3]=s):s=e[3];let o=s,i;return e[4]!==n||e[5]!==o?(i=(0,d.jsx)("div",{className:"flex flex-col",children:o.map(c=>{let[m,l]=c;return(0,d.jsx)(ht,{name:m,required:n.has(m),schema:l},m)})}),e[4]=n,e[5]=o,e[6]=i):i=e[6],i},"Z"),_e=u(t=>{let e=(0,B.c)(10),{schema:a,testId:r}=t;if(a?.type!=="object"||Object.keys(a.properties??{}).length===0){let o;e[0]!==a?(o=ce(a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==o||e[3]!==r?(i=(0,d.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":r,children:o}),e[2]=o,e[3]=r,e[4]=i):i=e[4],i}let n;e[5]!==a?(n=(0,d.jsx)(qe,{schema:a}),e[5]=a,e[6]=n):n=e[6];let s;return e[7]!==n||e[8]!==r?(s=(0,d.jsx)("div",{className:"text-xs","data-testid":r,children:n}),e[7]=n,e[8]=r,e[9]=s):s=e[9],s},"V"),gt=["curl","javascript","lunora"],xt={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},bt=u(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"Ae"),yt=u(t=>{let e=Z(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"je"),vt=u((t,e,a)=>{let r=`${a}${e.httpPath}`,n=JSON.stringify(yt(e),void 0,2),s=JSON.stringify(Z(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let o=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(r)}`];return o&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
3
3
  `)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
4
4
  import { api } from "./_generated/api";
@@ -1 +1 @@
1
- import{a as q}from"./chunk-W4X4J7BU.js";import{a as F}from"./chunk-5DNGK3NT.js";import{a as D}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-ZBON5T5A.js";import{b as S}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as L}from"./chunk-DSTNWB4N.js";import"./chunk-OSJ7HV7B.js";import"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import{a as B}from"./chunk-6UTZXEW3.js";import{c as _}from"./chunk-ZKPRORLI.js";import"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as j}from"./chunk-3Y5K3IQO.js";import{a as O,b as P,c as W,d as C,e as h,f as p}from"./chunk-CW57Q264.js";import{a as T,e as $}from"./chunk-MD67S53Z.js";import{f as M,p as E}from"./chunk-LPINY2IJ.js";import{a as N,d as A,f as H,g as U}from"./chunk-OXFKZ4BM.js";var R=A(H(),1);var t=A(U(),1);var J=80,Z=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a,E);return e.length>J?`${e.slice(0,J)}\u2026`:e},"G"),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((d,o)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${o.toString()}`,subscription:d})})}return e},"J"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),ce=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=M(),{queryShardKey:d,setShardKey:o,shardKey:m}=F(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==d?(b={keepPreviousData:!0,shardKey:d},e[1]=d,e[2]=b):b=e[2];let{data:s,error:i,errorSource:u,poll:G}=_(B.listSubscriptions,f,b);q(G,!0);let x;if(e[3]!==i||e[4]!==u||e[5]!==s||e[6]!==o||e[7]!==m||e[8]!==n){let k=s===void 0?[]:z(s.connections),c;e[10]!==o||e[11]!==m?(c=(0,t.jsx)(D,{onChange:o,testId:"subs-shard-input",value:m}),e[10]=o,e[11]=m,e[12]=c):c=e[12];let l;e[13]!==s||e[14]!==n?(l=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]=l):l=e[15];let g;e[16]!==c||e[17]!==l?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,l]}),e[16]=c,e[17]=l,e[18]=g):g=e[18];let v;e[19]!==i||e[20]!==u?(v=i!==null&&(0,t.jsx)(L,{error:u,testId:"subs-error"}),e[19]=i,e[20]=u,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,i===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.")}),i===null&&k.length>0&&(0,t.jsx)(T,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(O,{"data-testid":"subs-table",children:[(0,t.jsx)(P,{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)(W,{children:k.map(y=>{let{subscription:I}=y,K=Z(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]=i,e[4]=u,e[5]=s,e[6]=o,e[7]=m,e[8]=n,e[9]=x}else x=e[9];return x},"ae");export{ce as default};
1
+ import{a as q}from"./chunk-ILLDX6LU.js";import{a as F}from"./chunk-5DNGK3NT.js";import{a as D}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-ZBON5T5A.js";import{b as S}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as L}from"./chunk-IMF6DJKL.js";import"./chunk-OSJ7HV7B.js";import"./chunk-SL7LF2SO.js";import"./chunk-E26OT26O.js";import{a as B}from"./chunk-6UTZXEW3.js";import{c as _}from"./chunk-4SJDWMH3.js";import"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as j}from"./chunk-3Y5K3IQO.js";import{a as O,b as P,c as W,d as C,e as h,f as p}from"./chunk-CW57Q264.js";import{a as T,e as $}from"./chunk-MD67S53Z.js";import{f as M,p as E}from"./chunk-LPINY2IJ.js";import{a as N,d as A,f as H,g as U}from"./chunk-OXFKZ4BM.js";var R=A(H(),1);var t=A(U(),1);var J=80,Z=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a,E);return e.length>J?`${e.slice(0,J)}\u2026`:e},"G"),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((d,o)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${o.toString()}`,subscription:d})})}return e},"J"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),ce=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=M(),{queryShardKey:d,setShardKey:o,shardKey:m}=F(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==d?(b={keepPreviousData:!0,shardKey:d},e[1]=d,e[2]=b):b=e[2];let{data:s,error:i,errorSource:u,poll:G}=_(B.listSubscriptions,f,b);q(G,!0);let x;if(e[3]!==i||e[4]!==u||e[5]!==s||e[6]!==o||e[7]!==m||e[8]!==n){let k=s===void 0?[]:z(s.connections),c;e[10]!==o||e[11]!==m?(c=(0,t.jsx)(D,{onChange:o,testId:"subs-shard-input",value:m}),e[10]=o,e[11]=m,e[12]=c):c=e[12];let l;e[13]!==s||e[14]!==n?(l=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]=l):l=e[15];let g;e[16]!==c||e[17]!==l?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,l]}),e[16]=c,e[17]=l,e[18]=g):g=e[18];let v;e[19]!==i||e[20]!==u?(v=i!==null&&(0,t.jsx)(L,{error:u,testId:"subs-error"}),e[19]=i,e[20]=u,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,i===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.")}),i===null&&k.length>0&&(0,t.jsx)(T,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(O,{"data-testid":"subs-table",children:[(0,t.jsx)(P,{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)(W,{children:k.map(y=>{let{subscription:I}=y,K=Z(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]=i,e[4]=u,e[5]=s,e[6]=o,e[7]=m,e[8]=n,e[9]=x}else x=e[9];return x},"ae");export{ce as default};
@@ -1 +1 @@
1
- import{p as A}from"./chunk-OIDFWEJX.js";import{l as v}from"./chunk-LPINY2IJ.js";import{a as o,d as R,e as _,f as F}from"./chunk-OXFKZ4BM.js";var M=R(F(),1),i=R(_(),1);var U=6e4,b=o(e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function","g"),g=5e3,x=o((e,r,s)=>{let t=(0,M.c)(9),n=s===void 0?g:s,h=A(),d=(0,i.useRef)(e),c;t[0]!==e?(c=o(()=>{d.current=e},"c"),t[0]=e,t[1]=c):c=t[1],(0,i.useEffect)(c);let u;t[2]!==r||t[3]!==n?(u=o(()=>{if(!r)return;let l=n,p=!1,T,m=o(()=>{p||(T=setTimeout(P,l))},"f"),y=o(()=>{l=n,m()},"p"),E=o(a=>{v(a)||(l=Math.max(n,Math.min(l*2,U)),m())},"_"),P=o(()=>{if(globalThis.document?.hidden===!0){m();return}let a;try{a=d.current()}catch(S){E(S);return}b(a)?Promise.resolve(a).then(y).catch(E):y()},"A");return m(),()=>{p=!0,clearTimeout(T)}},"i"),t[2]=r,t[3]=n,t[4]=u):u=t[4];let f;t[5]!==h||t[6]!==r||t[7]!==n?(f=[h,r,n],t[5]=h,t[6]=r,t[7]=n,t[8]=f):f=t[8],(0,i.useEffect)(u,f)},"U"),D=o(async e=>{let r=(await Promise.allSettled(e)).find(s=>s.status==="rejected");if(r!==void 0)throw r.reason},"v");export{x as a,D as b};
1
+ import{p as A}from"./chunk-FKM35PXF.js";import{l as v}from"./chunk-LPINY2IJ.js";import{a as o,d as R,e as _,f as F}from"./chunk-OXFKZ4BM.js";var M=R(F(),1),i=R(_(),1);var U=6e4,b=o(e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function","g"),g=5e3,x=o((e,r,s)=>{let t=(0,M.c)(9),n=s===void 0?g:s,h=A(),d=(0,i.useRef)(e),c;t[0]!==e?(c=o(()=>{d.current=e},"c"),t[0]=e,t[1]=c):c=t[1],(0,i.useEffect)(c);let u;t[2]!==r||t[3]!==n?(u=o(()=>{if(!r)return;let l=n,p=!1,T,m=o(()=>{p||(T=setTimeout(P,l))},"f"),y=o(()=>{l=n,m()},"p"),E=o(a=>{v(a)||(l=Math.max(n,Math.min(l*2,U)),m())},"_"),P=o(()=>{if(globalThis.document?.hidden===!0){m();return}let a;try{a=d.current()}catch(S){E(S);return}b(a)?Promise.resolve(a).then(y).catch(E):y()},"A");return m(),()=>{p=!0,clearTimeout(T)}},"i"),t[2]=r,t[3]=n,t[4]=u):u=t[4];let f;t[5]!==h||t[6]!==r||t[7]!==n?(f=[h,r,n],t[5]=h,t[6]=r,t[7]=n,t[8]=f):f=t[8],(0,i.useEffect)(u,f)},"U"),D=o(async e=>{let r=(await Promise.allSettled(e)).find(s=>s.status==="rejected");if(r!==void 0)throw r.reason},"v");export{x as a,D as b};
@@ -1 +1 @@
1
- import{a as D}from"./chunk-OSJ7HV7B.js";import{a as T}from"./chunk-6QBK3Z7A.js";import{b as E}from"./chunk-E26OT26O.js";import{b as A}from"./chunk-OIDFWEJX.js";import{f as H,j as I,m as O,n as S}from"./chunk-LPINY2IJ.js";import{a as C,d as q,f as _,g as z}from"./chunk-OXFKZ4BM.js";var K=q(_(),1);var l=q(z(),1);var P=C(U=>{let e=(0,K.c)(42),{className:y,error:t,testId:g}=U,k=H(),r=E(),n,i,a,c,m,p,o,s,d;if(e[0]!==y||e[1]!==t||e[2]!==r||e[3]!==g){let V=O(t),b;e[13]!==t?(b=S(t),e[13]=t,e[14]=b):b=e[14],i=b;let v;e[15]!==t?(v=T(t),e[15]=t,e[16]=v):v=e[16];let j=v,w=t?.why,N;e[17]!==r||e[18]!==j?(N=C(()=>{r?.openConsole({errorsOnly:!0,seq:j})},"y"),e[17]=r,e[18]=j,e[19]=N):N=e[19],a=N,n=D,c=y,m=g,p="destructive";let h;e[20]!==t?(h=I(t),e[20]=t,e[21]=h):h=e[21],e[22]!==h?(o=(0,l.jsx)("p",{className:"font-medium",children:h}),e[22]=h,e[23]=o):o=e[23],e[24]!==w?(s=typeof w=="string"?(0,l.jsx)("p",{className:"mt-1 text-xs opacity-90",children:w}):null,e[24]=w,e[25]=s):s=e[25],d=V===void 0?null:(0,l.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:A(V)}),e[0]=y,e[1]=t,e[2]=r,e[3]=g,e[4]=n,e[5]=i,e[6]=a,e[7]=c,e[8]=m,e[9]=p,e[10]=o,e[11]=s,e[12]=d}else n=e[4],i=e[5],a=e[6],c=e[7],m=e[8],p=e[9],o=e[10],s=e[11],d=e[12];let f;e[26]!==i?(f=i===void 0?null:(0,l.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:i,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[26]=i,e[27]=f):f=e[27];let u;e[28]!==r||e[29]!==a||e[30]!==k?(u=r===void 0?null:(0,l.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:a,type:"button",children:k("Show in console")}),e[28]=r,e[29]=a,e[30]=k,e[31]=u):u=e[31];let x;return e[32]!==n||e[33]!==c||e[34]!==m||e[35]!==p||e[36]!==o||e[37]!==s||e[38]!==d||e[39]!==f||e[40]!==u?(x=(0,l.jsxs)(n,{className:c,testId:m,variant:p,children:[o,s,d,f,u]}),e[32]=n,e[33]=c,e[34]=m,e[35]=p,e[36]=o,e[37]=s,e[38]=d,e[39]=f,e[40]=u,e[41]=x):x=e[41],x},"K");export{P as a};
1
+ import{a as D}from"./chunk-OSJ7HV7B.js";import{a as T}from"./chunk-SL7LF2SO.js";import{b as E}from"./chunk-E26OT26O.js";import{b as A}from"./chunk-FKM35PXF.js";import{f as H,j as I,m as O,n as S}from"./chunk-LPINY2IJ.js";import{a as C,d as q,f as _,g as z}from"./chunk-OXFKZ4BM.js";var K=q(_(),1);var l=q(z(),1);var P=C(U=>{let e=(0,K.c)(42),{className:y,error:t,testId:g}=U,k=H(),r=E(),n,i,a,c,m,p,o,s,d;if(e[0]!==y||e[1]!==t||e[2]!==r||e[3]!==g){let V=O(t),b;e[13]!==t?(b=S(t),e[13]=t,e[14]=b):b=e[14],i=b;let v;e[15]!==t?(v=T(t),e[15]=t,e[16]=v):v=e[16];let j=v,w=t?.why,N;e[17]!==r||e[18]!==j?(N=C(()=>{r?.openConsole({errorsOnly:!0,seq:j})},"y"),e[17]=r,e[18]=j,e[19]=N):N=e[19],a=N,n=D,c=y,m=g,p="destructive";let h;e[20]!==t?(h=I(t),e[20]=t,e[21]=h):h=e[21],e[22]!==h?(o=(0,l.jsx)("p",{className:"font-medium",children:h}),e[22]=h,e[23]=o):o=e[23],e[24]!==w?(s=typeof w=="string"?(0,l.jsx)("p",{className:"mt-1 text-xs opacity-90",children:w}):null,e[24]=w,e[25]=s):s=e[25],d=V===void 0?null:(0,l.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:A(V)}),e[0]=y,e[1]=t,e[2]=r,e[3]=g,e[4]=n,e[5]=i,e[6]=a,e[7]=c,e[8]=m,e[9]=p,e[10]=o,e[11]=s,e[12]=d}else n=e[4],i=e[5],a=e[6],c=e[7],m=e[8],p=e[9],o=e[10],s=e[11],d=e[12];let f;e[26]!==i?(f=i===void 0?null:(0,l.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:i,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[26]=i,e[27]=f):f=e[27];let u;e[28]!==r||e[29]!==a||e[30]!==k?(u=r===void 0?null:(0,l.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:a,type:"button",children:k("Show in console")}),e[28]=r,e[29]=a,e[30]=k,e[31]=u):u=e[31];let x;return e[32]!==n||e[33]!==c||e[34]!==m||e[35]!==p||e[36]!==o||e[37]!==s||e[38]!==d||e[39]!==f||e[40]!==u?(x=(0,l.jsxs)(n,{className:c,testId:m,variant:p,children:[o,s,d,f,u]}),e[32]=n,e[33]=c,e[34]=m,e[35]=p,e[36]=o,e[37]=s,e[38]=d,e[39]=f,e[40]=u,e[41]=x):x=e[41],x},"K");export{P as a};