@lunora/studio 1.0.0-alpha.96 → 1.0.0-alpha.98

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 (64) hide show
  1. package/dist/standalone/{chunk-NQ4FA65F.js → chunk-2TFGS62O.js} +1 -1
  2. package/dist/standalone/{chunk-JRAUQ4L2.js → chunk-3J6AAVUL.js} +1 -1
  3. package/dist/standalone/{chunk-AUXEGD24.js → chunk-4D56O2UT.js} +1 -1
  4. package/dist/standalone/{chunk-3PXUIMP2.js → chunk-5GMRSN6L.js} +1 -1
  5. package/dist/standalone/chunk-6FQJRXVI.js +11 -0
  6. package/dist/standalone/{chunk-7KU3LR7G.js → chunk-6IKXBSNY.js} +1 -1
  7. package/dist/standalone/{chunk-VWKQ6X2S.js → chunk-7CWPU3LW.js} +1 -1
  8. package/dist/standalone/{chunk-FA6AR5QU.js → chunk-7HWEPGII.js} +1 -1
  9. package/dist/standalone/{chunk-ZURV2PEP.js → chunk-7IIICQZ7.js} +1 -1
  10. package/dist/standalone/{chunk-LV5UVTHL.js → chunk-AIB3GCQI.js} +1 -1
  11. package/dist/standalone/{chunk-D7B2KFWM.js → chunk-AS4WSCMT.js} +1 -1
  12. package/dist/standalone/{chunk-57BUSXRD.js → chunk-ATLV7KWK.js} +1 -1
  13. package/dist/standalone/{chunk-ZCPQGIQW.js → chunk-BAZ2VU7R.js} +1 -1
  14. package/dist/standalone/{chunk-2FRLB5SB.js → chunk-BG54FBTO.js} +1 -1
  15. package/dist/standalone/{chunk-NSUBZT43.js → chunk-BLHSTFG3.js} +1 -1
  16. package/dist/standalone/{chunk-TAWXVVAZ.js → chunk-BMZPRRSX.js} +1 -1
  17. package/dist/standalone/{chunk-ESIEIGR3.js → chunk-D34YXUQY.js} +1 -1
  18. package/dist/standalone/{chunk-UE6A3CRB.js → chunk-DK4J7ZBH.js} +1 -1
  19. package/dist/standalone/{chunk-DGO2XJOT.js → chunk-DSU54IAT.js} +1 -1
  20. package/dist/standalone/{chunk-YOKL7XDT.js → chunk-FKBHX7BD.js} +1 -1
  21. package/dist/standalone/{chunk-LZGOETI3.js → chunk-HRRFUAP6.js} +1 -1
  22. package/dist/standalone/{chunk-TKFI6XYV.js → chunk-II5ZTRTW.js} +1 -1
  23. package/dist/standalone/{chunk-7URLLMST.js → chunk-IMME7XEE.js} +1 -1
  24. package/dist/standalone/{chunk-U5MIBWJD.js → chunk-IXAMI2KV.js} +1 -1
  25. package/dist/standalone/{chunk-UZHRBXA7.js → chunk-J3Q3ESBP.js} +1 -1
  26. package/dist/standalone/{chunk-AQZMKZMP.js → chunk-J6PMARYI.js} +1 -1
  27. package/dist/standalone/{chunk-TVRCPIAV.js → chunk-JNY7CFF4.js} +1 -1
  28. package/dist/standalone/{chunk-WOBRLIBX.js → chunk-JR4LDDRW.js} +1 -1
  29. package/dist/standalone/{chunk-SFQX7RUJ.js → chunk-JZUM7FBJ.js} +1 -1
  30. package/dist/standalone/{chunk-3WISGFZ7.js → chunk-KBBOZRRX.js} +1 -1
  31. package/dist/standalone/{chunk-2NO45MRI.js → chunk-KVYAMWYX.js} +1 -1
  32. package/dist/standalone/{chunk-LT236J7E.js → chunk-M2M3RYJU.js} +1 -1
  33. package/dist/standalone/{chunk-BLJANR7J.js → chunk-MCPDCNPO.js} +1 -1
  34. package/dist/standalone/{chunk-2IFGRS6R.js → chunk-N6N6MMWG.js} +1 -1
  35. package/dist/standalone/{chunk-Q2QILUP4.js → chunk-NTAN75BV.js} +1 -1
  36. package/dist/standalone/{chunk-WPERYUTG.js → chunk-O36FXWMR.js} +1 -1
  37. package/dist/standalone/{chunk-ECF57FQF.js → chunk-O3BG6T4B.js} +1 -1
  38. package/dist/standalone/{chunk-U7ILDM43.js → chunk-OQIGV6FX.js} +1 -1
  39. package/dist/standalone/{chunk-YEGFNH56.js → chunk-P33WK7YI.js} +1 -1
  40. package/dist/standalone/{chunk-GL7YL3VF.js → chunk-PLFTCTMX.js} +1 -1
  41. package/dist/standalone/{chunk-DXJWFZFI.js → chunk-QVK5DESS.js} +1 -1
  42. package/dist/standalone/{chunk-HJC67CE4.js → chunk-RE7VLJ6H.js} +1 -1
  43. package/dist/standalone/{chunk-I7FF5IIJ.js → chunk-T2NCAYLT.js} +1 -1
  44. package/dist/standalone/{chunk-OZK52CH2.js → chunk-T7AVSVIA.js} +1 -1
  45. package/dist/standalone/{chunk-KGPNIBOV.js → chunk-T7YW6OMG.js} +1 -1
  46. package/dist/standalone/{chunk-BAJXBWFJ.js → chunk-TLVSMHK2.js} +1 -1
  47. package/dist/standalone/{chunk-QNQTMABQ.js → chunk-TMZQNRFA.js} +1 -1
  48. package/dist/standalone/{chunk-WQJOV6L5.js → chunk-U3Y2BI4W.js} +2 -2
  49. package/dist/standalone/{chunk-2YGNOZPZ.js → chunk-UE2NC2ZZ.js} +1 -1
  50. package/dist/standalone/{chunk-44T6NSYY.js → chunk-URCRLZN7.js} +1 -1
  51. package/dist/standalone/{chunk-E2C6CK7F.js → chunk-UYOSHHOV.js} +1 -1
  52. package/dist/standalone/{chunk-BMYWOK5Q.js → chunk-V3EN6YQV.js} +1 -1
  53. package/dist/standalone/{chunk-QVPKPH2T.js → chunk-V4R4HI3U.js} +1 -1
  54. package/dist/standalone/{chunk-CFXL7MQK.js → chunk-VKK7A4VH.js} +1 -1
  55. package/dist/standalone/{chunk-LZ2RREQV.js → chunk-VOYG35OH.js} +1 -1
  56. package/dist/standalone/{chunk-EYIEO5QZ.js → chunk-W2GXYXCQ.js} +1 -1
  57. package/dist/standalone/{chunk-TGQH54CS.js → chunk-WG3WC2F2.js} +1 -1
  58. package/dist/standalone/{chunk-34WN3PEC.js → chunk-WZXZ6YN5.js} +1 -1
  59. package/dist/standalone/{chunk-MVJMAEP4.js → chunk-XGL7QCYN.js} +1 -1
  60. package/dist/standalone/{chunk-J4POSI6T.js → chunk-XUQEE25M.js} +1 -1
  61. package/dist/standalone/{chunk-IGBUUFPN.js → chunk-XYENOWOR.js} +1 -1
  62. package/dist/standalone/studio.js +1 -1
  63. package/package.json +6 -6
  64. package/dist/standalone/chunk-ETU7KIO4.js +0 -11
@@ -1 +1 @@
1
- import{a as Ve}from"./chunk-LEDWUPXM.js";import"./chunk-2PJNAWB3.js";import{a as He}from"./chunk-V53KNYRN.js";import{a as Ke}from"./chunk-54MMVNPT.js";import"./chunk-BGBLQ563.js";import{a as Ge}from"./chunk-AREBQI6D.js";import{R as We}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as le}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as de}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as Pe}from"./chunk-3WISGFZ7.js";import{a as Ue}from"./chunk-XXQUMVWH.js";import"./chunk-DGO2XJOT.js";import"./chunk-QLQADHFE.js";import{a as F}from"./chunk-VDW32UET.js";import{c as _e}from"./chunk-LZGOETI3.js";import{f as ze}from"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as ie}from"./chunk-XQCVZAGU.js";import{a as Te,b as ke,c as Be,d as G,e as C,f as w}from"./chunk-WJQLNYGX.js";import{a as De,e as Ee}from"./chunk-WQH3LT2P.js";import{d as $,f as ce,g as ue,h as me,o as he,r as je}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as h,e as Me,f as rt,g as nt,h as ot}from"./chunk-3XIESWL4.js";var z=Me(nt(),1);var A=Me(rt(),1);var t=Me(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,it=ce(F.sendQueueMessage),ct=ce(F.replayQueueMessage),ut=ce(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ut"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ct"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,z.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ie,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(De,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ee,{className:"px-0",children:(0,t.jsxs)(Te,{"data-testid":"queues-table",children:[(0,t.jsx)(ke,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(Be,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ht"),xt=h(n=>{let e=(0,z.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,u,x,N,y,i,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let W=mt(a.body);r=G,N=`queues-message-${a.id}`;let j=a.exportName??a.queue;e[19]!==j?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:j}),e[19]=j,e[20]=y):y=e[20],e[21]!==a.messageId?(i=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=i):i=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let D=`queues-outcome-${a.id}`,E;e[25]!==a.outcome?(E=pt(a.outcome),e[25]=a.outcome,e[26]=E):E=e[26];let I;e[27]!==a.outcome||e[28]!==D||e[29]!==E?(I=(0,t.jsx)(de,{"data-testid":D,variant:E,children:a.outcome}),e[27]=a.outcome,e[28]=D,e[29]=E,e[30]=I):I=e[30];let _;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(_=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=_):_=e[34],e[35]!==I||e[36]!==_?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,_]})}),e[35]=I,e[36]=_,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=W,x=ht(W),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=u,e[13]=x,e[14]=N,e[15]=y,e[16]=i,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],u=e[12],x=e[13],N=e[14],y=e[15],i=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==u||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:u,children:x}),e[38]=o,e[39]=p,e[40]=u,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=je(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,M=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==M||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:M,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=M,e[55]=Q,e[56]=L):L=e[56];let T;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==i||e[63]!==m||e[64]!==f||e[65]!==g?(T=(0,t.jsxs)(r,{"data-testid":N,children:[y,i,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=i,e[63]=m,e[64]=f,e[65]=g,e[66]=T):T=e[66],T},"pt"),yt=h(n=>{let e=(0,z.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let u;e[2]!==p?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=u):u=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let i;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(i=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=i):i=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==u||e[18]!==i||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,i,m]}),e[17]=u,e[18]=i,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ie,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(De,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ee,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(Te,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(ke,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(Be,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"gt"),Nt=h(n=>{let e=(0,z.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:u,queues:x,selectedExportName:N,sending:y}=n,i=$(),m;e[0]!==i?(m=i("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=i,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==u||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==i?(g=x.length===0?(0,t.jsx)(ie,{description:i("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:i("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":i("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(We,{"aria-label":i("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:i("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),i("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:u,type:"button",children:i(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":i("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=u,e[12]=x,e[13]=N,e[14]=y,e[15]=i,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"ft"),Ft=h(n=>{let e=(0,z.c)(59),{limit:a}=n,l=a??lt,d=ze(),s=$(),[o,r]=(0,A.useState)("declared"),[p,u]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:i}=_e(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=_e(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],M=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:T}=dt(S,M),[W,j]=(0,A.useState)(""),[D,E]=(0,A.useState)(""),[I,_]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(c=>c.exportName===W)?W:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:i,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{u(null);let c=H;if(c==="")return;let v=null,$e=D.trim();if($e!=="")try{v=JSON.parse($e)}catch{u(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){u(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){u(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:c}:{body:v,delaySeconds:Ae,exportName:c};try{await d.query(it,st,ue("")),b()}catch(P){u(me(P))}Oe(!1)},"ce"),V;e[5]!==d||e[6]!==b?(V=h(async c=>{u(null),Re(c);try{await d.query(ct,{id:c},ue("")),b()}catch(v){u(me(v))}Re(null)},"K"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{u(null);try{await d.query(ut,{},ue("")),b()}catch(c){u(me(c))}},"V"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(c=>{let v=c.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(c=>{j(c.currentTarget.value)},"Y"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(c=>{E(c.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(c=>{_(c.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(c=>{Ye(c.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"ae"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(c=>{let{id:v}=c.currentTarget.dataset;v!==void 0&&he(Ne(v))},"se"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",k;e[22]!==s||e[23]!==o?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>(0,t.jsx)(le,{"aria-selected":o===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===c?"secondary":"ghost",children:gt(c,s)},c))}),e[22]=s,e[23]=o,e[24]=k):k=e[24];let B;e[25]!==fe||e[26]!==xe?(B=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=B):B=e[27];let Le=T&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==M||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:M,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=M,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==D||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:D,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=D,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==k||e[53]!==B||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[k,B,Le,O,R,J]}),e[52]=k,e[53]=B,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"Nt");function St(n){return n.name}h(St,"bt");export{Ft as default};
1
+ import{a as Ve}from"./chunk-LEDWUPXM.js";import"./chunk-2PJNAWB3.js";import{a as He}from"./chunk-V53KNYRN.js";import{a as Ke}from"./chunk-54MMVNPT.js";import"./chunk-BGBLQ563.js";import{a as Ge}from"./chunk-AREBQI6D.js";import{R as We}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as le}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as de}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as Pe}from"./chunk-KBBOZRRX.js";import{a as Ue}from"./chunk-XXQUMVWH.js";import"./chunk-DSU54IAT.js";import"./chunk-QLQADHFE.js";import{a as F}from"./chunk-VDW32UET.js";import{c as _e}from"./chunk-HRRFUAP6.js";import{f as ze}from"./chunk-6FQJRXVI.js";import"./chunk-XBDKZZ67.js";import{a as ie}from"./chunk-XQCVZAGU.js";import{a as Te,b as ke,c as Be,d as G,e as C,f as w}from"./chunk-WJQLNYGX.js";import{a as De,e as Ee}from"./chunk-WQH3LT2P.js";import{d as $,f as ce,g as ue,h as me,o as he,r as je}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as h,e as Me,f as rt,g as nt,h as ot}from"./chunk-3XIESWL4.js";var z=Me(nt(),1);var A=Me(rt(),1);var t=Me(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,it=ce(F.sendQueueMessage),ct=ce(F.replayQueueMessage),ut=ce(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ut"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ct"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,z.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ie,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(De,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ee,{className:"px-0",children:(0,t.jsxs)(Te,{"data-testid":"queues-table",children:[(0,t.jsx)(ke,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(Be,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ht"),xt=h(n=>{let e=(0,z.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,u,x,N,y,i,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let W=mt(a.body);r=G,N=`queues-message-${a.id}`;let j=a.exportName??a.queue;e[19]!==j?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:j}),e[19]=j,e[20]=y):y=e[20],e[21]!==a.messageId?(i=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=i):i=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let D=`queues-outcome-${a.id}`,E;e[25]!==a.outcome?(E=pt(a.outcome),e[25]=a.outcome,e[26]=E):E=e[26];let I;e[27]!==a.outcome||e[28]!==D||e[29]!==E?(I=(0,t.jsx)(de,{"data-testid":D,variant:E,children:a.outcome}),e[27]=a.outcome,e[28]=D,e[29]=E,e[30]=I):I=e[30];let _;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(_=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=_):_=e[34],e[35]!==I||e[36]!==_?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,_]})}),e[35]=I,e[36]=_,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=W,x=ht(W),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=u,e[13]=x,e[14]=N,e[15]=y,e[16]=i,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],u=e[12],x=e[13],N=e[14],y=e[15],i=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==u||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:u,children:x}),e[38]=o,e[39]=p,e[40]=u,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=je(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,M=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==M||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:M,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=M,e[55]=Q,e[56]=L):L=e[56];let T;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==i||e[63]!==m||e[64]!==f||e[65]!==g?(T=(0,t.jsxs)(r,{"data-testid":N,children:[y,i,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=i,e[63]=m,e[64]=f,e[65]=g,e[66]=T):T=e[66],T},"pt"),yt=h(n=>{let e=(0,z.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let u;e[2]!==p?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=u):u=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let i;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(i=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=i):i=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==u||e[18]!==i||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,i,m]}),e[17]=u,e[18]=i,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ie,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(De,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ee,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(Te,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(ke,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(Be,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"gt"),Nt=h(n=>{let e=(0,z.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:u,queues:x,selectedExportName:N,sending:y}=n,i=$(),m;e[0]!==i?(m=i("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=i,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==u||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==i?(g=x.length===0?(0,t.jsx)(ie,{description:i("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:i("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":i("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(We,{"aria-label":i("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:i("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),i("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:u,type:"button",children:i(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":i("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=u,e[12]=x,e[13]=N,e[14]=y,e[15]=i,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"ft"),Ft=h(n=>{let e=(0,z.c)(59),{limit:a}=n,l=a??lt,d=ze(),s=$(),[o,r]=(0,A.useState)("declared"),[p,u]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:i}=_e(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=_e(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],M=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:T}=dt(S,M),[W,j]=(0,A.useState)(""),[D,E]=(0,A.useState)(""),[I,_]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(c=>c.exportName===W)?W:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:i,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{u(null);let c=H;if(c==="")return;let v=null,$e=D.trim();if($e!=="")try{v=JSON.parse($e)}catch{u(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){u(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){u(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:c}:{body:v,delaySeconds:Ae,exportName:c};try{await d.query(it,st,ue("")),b()}catch(P){u(me(P))}Oe(!1)},"ce"),V;e[5]!==d||e[6]!==b?(V=h(async c=>{u(null),Re(c);try{await d.query(ct,{id:c},ue("")),b()}catch(v){u(me(v))}Re(null)},"K"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{u(null);try{await d.query(ut,{},ue("")),b()}catch(c){u(me(c))}},"V"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(c=>{let v=c.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(c=>{j(c.currentTarget.value)},"Y"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(c=>{E(c.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(c=>{_(c.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(c=>{Ye(c.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"ae"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(c=>{let{id:v}=c.currentTarget.dataset;v!==void 0&&he(Ne(v))},"se"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",k;e[22]!==s||e[23]!==o?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>(0,t.jsx)(le,{"aria-selected":o===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===c?"secondary":"ghost",children:gt(c,s)},c))}),e[22]=s,e[23]=o,e[24]=k):k=e[24];let B;e[25]!==fe||e[26]!==xe?(B=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=B):B=e[27];let Le=T&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==M||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:M,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=M,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==D||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:D,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=D,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==k||e[53]!==B||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[k,B,Le,O,R,J]}),e[52]=k,e[53]=B,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"Nt");function St(n){return n.name}h(St,"bt");export{Ft as default};
@@ -1 +1 @@
1
- import{a as D}from"./chunk-XXQUMVWH.js";import{a as U}from"./chunk-DGO2XJOT.js";import{b as q}from"./chunk-QLQADHFE.js";import{d as A,h as C,j as H,k as O}from"./chunk-IUYFXK4X.js";import{a as V}from"./chunk-YEGFNH56.js";import{a as y,e as I,g as T,h as _}from"./chunk-3XIESWL4.js";var G=I(T(),1);var i=I(_(),1);var K=y(S=>{let e=(0,G.c)(38),{className:w,error:t,testId:N}=S,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 j=H(t),h;e[12]!==t?(h=O(t),e[12]=t,e[13]=h):h=e[13],s=h;let x;e[14]!==t?(x=U(t),e[14]=t,e[15]=x):x=e[15];let k=x,v;e[16]!==r||e[17]!==k?(v=y(()=>{r?.openConsole({errorsOnly:!0,seq:k})},"x"),e[16]=r,e[17]=k,e[18]=v):v=e[18],n=v,l=D,a=w,c=N,m="destructive";let u;e[19]!==t?(u=C(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=j===void 0?null:(0,i.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:V(j)}),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 b;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?(b=(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]=b):b=e[37],b},"G");export{K as a};
1
+ import{a as D}from"./chunk-XXQUMVWH.js";import{a as U}from"./chunk-DSU54IAT.js";import{b as q}from"./chunk-QLQADHFE.js";import{d as A,h as C,j as H,k as O}from"./chunk-IUYFXK4X.js";import{a as V}from"./chunk-P33WK7YI.js";import{a as y,e as I,g as T,h as _}from"./chunk-3XIESWL4.js";var G=I(T(),1);var i=I(_(),1);var K=y(S=>{let e=(0,G.c)(38),{className:w,error:t,testId:N}=S,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 j=H(t),h;e[12]!==t?(h=O(t),e[12]=t,e[13]=h):h=e[13],s=h;let x;e[14]!==t?(x=U(t),e[14]=t,e[15]=x):x=e[15];let k=x,v;e[16]!==r||e[17]!==k?(v=y(()=>{r?.openConsole({errorsOnly:!0,seq:k})},"x"),e[16]=r,e[17]=k,e[18]=v):v=e[18],n=v,l=D,a=w,c=N,m="destructive";let u;e[19]!==t?(u=C(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=j===void 0?null:(0,i.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:V(j)}),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 b;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?(b=(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]=b):b=e[37],b},"G");export{K as a};
@@ -1 +1 @@
1
- import{a as Ze}from"./chunk-NSUBZT43.js";import"./chunk-GMR677FL.js";import"./chunk-4KIQ5RLS.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as Me}from"./chunk-5Y3QLNWX.js";import{a as Ye}from"./chunk-IGCNMZSB.js";import"./chunk-I6A5C46N.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import"./chunk-4UOFSGUS.js";import{a as Xe}from"./chunk-AREBQI6D.js";import{a as ze}from"./chunk-3CWGJYBB.js";import{a as We}from"./chunk-RMN2JN4S.js";import{b as Ve}from"./chunk-GRL5MG3Z.js";import{d as De,e as Fe}from"./chunk-SMIESS7P.js";import"./chunk-7T7UOTYK.js";import{R as Ae}from"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{c as Ee}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as _e}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as we}from"./chunk-3WISGFZ7.js";import"./chunk-XXQUMVWH.js";import"./chunk-DGO2XJOT.js";import"./chunk-QLQADHFE.js";import{a as C}from"./chunk-VDW32UET.js";import{c as de}from"./chunk-LZGOETI3.js";import{f as Te}from"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as ye}from"./chunk-XQCVZAGU.js";import{a as Ge,b as He,c as Qe,d as Ie,e as O,f as I}from"./chunk-WJQLNYGX.js";import{a as Le,e as Je}from"./chunk-WQH3LT2P.js";import{d as oe,f as Ue,g as Pe,h as Be,o as ke,r as Ne}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as m,e as ie,f as qe,g as Ce,h as Ke,j as ne}from"./chunk-3XIESWL4.js";var me=ie(Ce(),1),ce=ie(qe(),1);var et=ie(Ce(),1);var j=ie(qe(),1);var l=ie(Ke(),1);var ct=Ue(C.runMigration),tt=m(a=>{let e=(0,et.c)(98),{initialShardKey:r}=a,s=Te(),t=oe(),{queryShardKey:d,setShardKey:i,shardKey:n}=ze(r),[u,b]=(0,j.useState)(""),[h,v]=(0,j.useState)("up"),[p,g]=(0,j.useState)(!0),[f,y]=(0,j.useState)(!1),[x,c]=(0,j.useState)(null),[N,k]=(0,j.useState)(null),K;e[0]!==n?(K=n.trim(),e[0]=n,e[1]=K):K=e[1];let M=K===d,S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S={},e[2]=S):S=e[2];let R;e[3]!==d?(R={live:!0,shardKey:d},e[3]=d,e[4]=R):R=e[4];let w=de(C.migrationStatus,S,R),$=w.data?.migrations??null,$e=w.error,{errorSource:je,liveError:Se}=w,ue,he;e[5]!==d||e[6]!==w.data?(ue=m(()=>{w.data!==void 0&&Ve(d)},"Q"),he=[w.data,d],e[5]=d,e[6]=w.data,e[7]=ue,e[8]=he):(ue=e[7],he=e[8]),(0,j.useEffect)(ue,he);let pe;if(e[9]!==s||e[10]!==h||e[11]!==p||e[12]!==u||e[13]!==n||e[14]!==w||e[15]!==t){let q=m(async()=>{let Re=u.trim();if(Re===""){k(t("Enter a migration id")),c(null);return}y(!0),k(null);try{let Oe=await s.query(ct,{direction:h,dryRun:p,id:Re},Pe(n));c(Oe),w.refetch()}catch(Oe){let lt=Oe;c(null),k(Be(lt))}y(!1)},"m");pe=m(()=>{ke(q())},"X"),e[9]=s,e[10]=h,e[11]=p,e[12]=u,e[13]=n,e[14]=w,e[15]=t,e[16]=pe}else pe=e[16];let fe=pe,ge;e[17]===Symbol.for("react.memo_cache_sentinel")?(ge=m(q=>{b(q.target.value)},"Z"),e[17]=ge):ge=e[17];let nt=ge,be;e[18]===Symbol.for("react.memo_cache_sentinel")?(be=m(q=>{v(q.target.value==="down"?"down":"up")},"H"),e[18]=be):be=e[18];let ot=be,ve;e[19]===Symbol.for("react.memo_cache_sentinel")?(ve=m(q=>{g(q.target.checked)},"ee"),e[19]=ve):ve=e[19];let dt=ve,T;e[20]!==i||e[21]!==n?(T=(0,l.jsx)(We,{onChange:i,testId:"mg-shard-input",value:n}),e[20]=i,e[21]=n,e[22]=T):T=e[22];let D;e[23]!==Se?(D=(0,l.jsx)(Ye,{message:Se,prefix:"mg"}),e[23]=Se,e[24]=D):D=e[24];let F;e[25]!==T||e[26]!==D?(F=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[T,D]}),e[25]=T,e[26]=D,e[27]=F):F=e[27];let _;e[28]!==$e||e[29]!==je?(_=$e!==null&&(0,l.jsx)(we,{error:je,testId:"mg-status-error"}),e[28]=$e,e[29]=je,e[30]=_):_=e[30];let A;e[31]!==$||e[32]!==t?(A=$!==null&&$.length===0&&(0,l.jsx)(ye,{description:t("Data migrations you run against this shard will be tracked here."),icon:(0,l.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.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"})}),testId:"mg-empty",title:t("No migrations have run on this shard.")}),e[31]=$,e[32]=t,e[33]=A):A=e[33];let E;e[34]!==$||e[35]!==t?(E=$!==null&&$.length>0&&(0,l.jsx)(Le,{className:"overflow-hidden py-0",children:(0,l.jsx)(Je,{className:"px-0",children:(0,l.jsxs)(Ge,{"data-testid":"mg-table",children:[(0,l.jsx)(He,{children:(0,l.jsxs)(Ie,{children:[(0,l.jsx)(O,{children:t("id")}),(0,l.jsx)(O,{children:t("direction")}),(0,l.jsx)(O,{children:t("status")}),(0,l.jsx)(O,{children:t("processed")}),(0,l.jsx)(O,{children:t("changed")}),(0,l.jsx)(O,{children:t("updated")}),(0,l.jsx)(O,{children:t("error")})]})}),(0,l.jsx)(Qe,{children:$.map(mt)})]})})}),e[34]=$,e[35]=t,e[36]=E):E=e[36];let L;e[37]!==t?(L=t("Run migration"),e[37]=t,e[38]=L):L=e[38];let J;e[39]!==L?(J=(0,l.jsx)(Me,{children:L}),e[39]=L,e[40]=J):J=e[40];let U;e[41]!==t?(U=t("Migration id"),e[41]=t,e[42]=U):U=e[42];let P;e[43]!==t?(P=t("migration id"),e[43]=t,e[44]=P):P=e[44];let B;e[45]!==u||e[46]!==U||e[47]!==P?(B=(0,l.jsx)(Ae,{"aria-label":U,className:"w-auto","data-testid":"mg-id-input",onChange:nt,placeholder:P,value:u}),e[45]=u,e[46]=U,e[47]=P,e[48]=B):B=e[48];let V;e[49]!==t?(V=t("Direction"),e[49]=t,e[50]=V):V=e[50];let W;e[51]!==t?(W=t("up"),e[51]=t,e[52]=W):W=e[52];let z;e[53]!==W?(z=(0,l.jsx)("option",{value:"up",children:W}),e[53]=W,e[54]=z):z=e[54];let G;e[55]!==t?(G=t("down"),e[55]=t,e[56]=G):G=e[56];let H;e[57]!==G?(H=(0,l.jsx)("option",{value:"down",children:G}),e[57]=G,e[58]=H):H=e[58];let Q;e[59]!==h||e[60]!==V||e[61]!==z||e[62]!==H?(Q=(0,l.jsxs)("select",{"aria-label":V,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:ot,value:h,children:[z,H]}),e[59]=h,e[60]=V,e[61]=z,e[62]=H,e[63]=Q):Q=e[63];let X;e[64]!==p?(X=(0,l.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:dt,type:"checkbox"}),e[64]=p,e[65]=X):X=e[65];let Y;e[66]!==t?(Y=t("Dry run"),e[66]=t,e[67]=Y):Y=e[67];let Z;e[68]!==X||e[69]!==Y?(Z=(0,l.jsxs)(Me,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[X,Y]}),e[68]=X,e[69]=Y,e[70]=Z):Z=e[70];let ee;e[71]!==p||e[72]!==fe||e[73]!==f||e[74]!==M||e[75]!==t?(ee=p?(0,l.jsx)(Ee,{"data-testid":"mg-run",disabled:f||!M,onClick:fe,type:"button",children:t(f?"Running\u2026":"Run")}):(0,l.jsx)(Xe,{confirmLabel:t(f?"Running\u2026":"Run migration?"),disabled:f||!M,onConfirm:fe,testId:"mg-run",children:t("Run")}),e[71]=p,e[72]=fe,e[73]=f,e[74]=M,e[75]=t,e[76]=ee):ee=e[76];let te;e[77]!==B||e[78]!==Q||e[79]!==Z||e[80]!==ee?(te=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[B,Q,Z,ee]}),e[77]=B,e[78]=Q,e[79]=Z,e[80]=ee,e[81]=te):te=e[81];let ae;e[82]!==J||e[83]!==te?(ae=(0,l.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[J,te]}),e[82]=J,e[83]=te,e[84]=ae):ae=e[84];let re;e[85]!==N?(re=N!==null&&(0,l.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:N}),e[85]=N,e[86]=re):re=e[86];let se;e[87]!==x||e[88]!==t?(se=x!==null&&(0,l.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[x.dryRun?t("Dry run: "):"",t("{status} \u2014 processed",{status:x.status}),x.processed,t(", changed"),x.changed]}),e[87]=x,e[88]=t,e[89]=se):se=e[89];let xe;return e[90]!==F||e[91]!==_||e[92]!==A||e[93]!==E||e[94]!==ae||e[95]!==re||e[96]!==se?(xe=(0,l.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[F,_,A,E,ae,re,se]}),e[90]=F,e[91]=_,e[92]=A,e[93]=E,e[94]=ae,e[95]=re,e[96]=se,e[97]=xe):xe=e[97],xe},"yr");function mt(a){return(0,l.jsxs)(Ie,{"data-testid":`mg-row-${a.id}`,children:[(0,l.jsx)(I,{children:a.id}),(0,l.jsx)(I,{children:a.direction}),(0,l.jsx)(I,{children:(0,l.jsx)(_e,{variant:"secondary",children:a.status})}),(0,l.jsx)(I,{children:a.processed}),(0,l.jsx)(I,{children:a.changed}),(0,l.jsx)(I,{children:Ne(a.updatedAt)}),(0,l.jsx)(I,{children:a.error??""})]},a.id)}m(mt,"Ve");var o=ie(Ke(),1);var le=m(a=>typeof a=="object"&&a!==null,"k"),ut=m(a=>le(a)&&le(a.fields)&&le(a.indexes)&&le(a.relations)&&typeof a.shardMode=="string","z"),ht=m(a=>{if(a===void 0||a.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(a)}catch(r){return{error:`baseline is not valid JSON: ${r instanceof Error?r.message:String(r)}`,status:"invalid"}}if(!le(e)||e.version!==1||!le(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(1)})`,status:"invalid"};for(let[r,s]of Object.entries(e.tables))if(!ut(s))return{error:`baseline table "${r}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:1},status:"ok"}},"B"),pt=m((a,e)=>a.unique===e.unique&&a.fields.length===e.fields.length&&a.fields.every((r,s)=>r===e.fields[s]),"L"),ft=m((a,e,r,s)=>{let t=[];return r.kind!==s.kind&&t.push({severity:"breaking",summary:`field ${a}.${e} changed type: ${r.kind} \u2192 ${s.kind} \u2014 add a data migration to convert existing values`,table:a,scope:"table",type:"changedFieldKind"}),r.optional&&!s.optional?t.push({severity:"breaking",summary:`field ${a}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:a,scope:"table",type:"fieldOptionalToRequired"}):!r.optional&&s.optional&&t.push({scope:"table",severity:"safe",summary:`field ${a}.${e} became optional`,table:a,type:"fieldRequiredToOptional"}),t},"Q"),gt=m((a,e,r)=>r.optional?{scope:"table",severity:"safe",summary:`added optional field ${a}.${e}`,table:a,type:"addedOptionalField"}:{severity:"breaking",summary:`added required field ${a}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:a,scope:"table",type:"addedRequiredField"},"G"),bt=m((a,e,r,s)=>{for(let[t,d]of Object.entries(r.fields)){let i=e.fields[t];i===void 0?s.push(gt(a,t,d)):s.push(...ft(a,t,i,d))}for(let t of Object.keys(e.fields))r.fields[t]===void 0&&s.push({severity:"breaking",summary:`removed field ${a}.${t} \u2014 add a data migration if stored data must be cleaned up`,table:a,scope:"table",type:"removedField"})},"X"),vt=m((a,e,r,s)=>{for(let[t,d]of Object.entries(r.indexes)){let i=e.indexes[t];if(i===void 0){s.push({scope:"table",severity:"safe",summary:`added index ${t} on ${a}`,table:a,type:"addedIndex"});continue}pt(i,d)||s.push({severity:"breaking",summary:`index ${t} on ${a} changed shape \u2014 a query may have relied on the old index`,table:a,scope:"table",type:"changedIndex"})}for(let t of Object.keys(e.indexes))r.indexes[t]===void 0&&s.push({severity:"breaking",summary:`removed index ${t} on ${a} \u2014 a query that used \`.withIndex("${t}")\` would break`,table:a,scope:"table",type:"removedIndex"})},"Y"),xt=m((a,e,r,s)=>{for(let t of Object.keys(r.relations))e.relations[t]===void 0&&s.push({scope:"schema",severity:"safe",summary:`added relation ${a}.${t}`,table:a,type:"addedRelation"});for(let t of Object.keys(e.relations))r.relations[t]===void 0&&s.push({scope:"schema",severity:"breaking",summary:`removed relation ${a}.${t}`,table:a,type:"removedRelation"})},"Z"),yt=m((a,e,r,s)=>{e.shardMode!==r.shardMode&&s.push({severity:"breaking",summary:`table ${a} changed shard mode: ${e.shardMode} \u2192 ${r.shardMode} \u2014 its physical storage moves; add a data migration / re-shard plan`,table:a,scope:"table",type:"changedShardMode"}),bt(a,e,r,s),vt(a,e,r,s),xt(a,e,r,s)},"ee"),kt=m((a,e)=>{let r=[],s=a?.tables??{};for(let[t,d]of Object.entries(e.tables)){let i=s[t];if(i===void 0){r.push({scope:"table",severity:"safe",summary:`added table ${t}`,table:t,type:"addedTable"});continue}yt(t,i,d,r)}for(let t of Object.keys(s))e.tables[t]===void 0&&r.push({scope:"table",severity:"breaking",summary:`removed table ${t} \u2014 add a data migration if its data must be archived/cleaned up`,table:t,type:"removedTable"});if(a!==void 0&&a.jurisdiction!==e.jurisdiction){let t=a.jurisdiction??"(none)",d=e.jurisdiction??"(none)";r.push({scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${t} to ${d} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:r}},"te"),at=m(a=>Object.entries(a.fields).map(([e,r])=>({name:e,optional:r.optional,ref:Object.values(a.relations).find(s=>s.field===e&&s.kind==="one")?.table,type:r.kind})),"T"),rt=m((a,e)=>{let r={},s=a?.fields??{},t=e?.fields??{};for(let[d,i]of Object.entries(t)){let n=s[d];n===void 0?r[d]=a===void 0?"unchanged":"added":r[d]=n.kind===i.kind&&n.optional===i.optional?"unchanged":"changed"}for(let d of Object.keys(s))t[d]===void 0&&(r[d]="removed");return r},"F"),Nt=m((a,e)=>{let{changes:r}=kt(a,e),s=new Set(r.filter(i=>i.scope==="table"&&i.table!==void 0).map(i=>i.table)),t=[],d=m((i,n)=>i?"added":s.has(n)?"changed":"context","o");for(let[i,n]of Object.entries(e.tables)){let u=a?.tables[i],b=d(u===void 0,i);t.push({columns:at(n),fieldStatus:rt(u,n),name:i,shardMode:n.shardMode,status:b})}for(let[i,n]of Object.entries(a?.tables??{}))e.tables[i]===void 0&&t.push({columns:at(n),fieldStatus:rt(n,void 0),name:i,shardMode:n.shardMode,status:"removed"});return t.sort((i,n)=>i.name.localeCompare(n.name)),{breakingCount:r.filter(i=>i.severity==="breaking").length,changes:r,tables:t}},"ae"),st=m(a=>{let e=ht(a);return e.status==="ok"?e.snapshot:void 0},"K"),wt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},$t=m(a=>a==="global"?"global":"shard","se"),jt=m(a=>{let e=(0,me.c)(24),{appliedAt:r,hash:s,onSelect:t,selected:d,seq:i}=a,n=d?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",u;e[0]!==n?(u=ne("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",n),e[0]=n,e[1]=u):u=e[1];let b=`sh-version-${s}`,h;e[2]!==s||e[3]!==t?(h=m(()=>{t(s)},"m"),e[2]=s,e[3]=t,e[4]=h):h=e[4];let v;e[5]!==i?(v=(0,o.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",i]}),e[5]=i,e[6]=v):v=e[6];let p;e[7]!==s?(p=s.slice(0,7),e[7]=s,e[8]=p):p=e[8];let g;e[9]!==p?(g=(0,o.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=g):g=e[10];let f;e[11]!==v||e[12]!==g?(f=(0,o.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[v,g]}),e[11]=v,e[12]=g,e[13]=f):f=e[13];let y;e[14]!==r?(y=Ne(r),e[14]=r,e[15]=y):y=e[15];let x;e[16]!==y?(x=(0,o.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:y}),e[16]=y,e[17]=x):x=e[17];let c;return e[18]!==x||e[19]!==u||e[20]!==b||e[21]!==h||e[22]!==f?(c=(0,o.jsx)("li",{children:(0,o.jsxs)("button",{className:u,"data-testid":b,onClick:h,type:"button",children:[f,x]})}),e[18]=x,e[19]=u,e[20]=b,e[21]=h,e[22]=f,e[23]=c):c=e[23],c},"ie"),St=m(a=>{let e=(0,me.c)(26),{breaking:r,count:s,first:t}=a,d=oe();if(t){let g;e[0]!==s?(g=(0,o.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:s}),e[0]=s,e[1]=g):g=e[1];let f;e[2]!==d?(f=d("tables"),e[2]=d,e[3]=f):f=e[3];let y;e[4]!==f?(y=(0,o.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[4]=f,e[5]=y):y=e[5];let x;return e[6]!==g||e[7]!==y?(x=(0,o.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[g,y]}),e[6]=g,e[7]=y,e[8]=x):x=e[8],x}let i=r>0&&"text-destructive",n;e[9]!==i?(n=ne("text-3xl leading-none font-light tracking-tight tabular-nums",i),e[9]=i,e[10]=n):n=e[10];let u;e[11]!==s||e[12]!==n?(u=(0,o.jsx)("span",{className:n,children:s}),e[11]=s,e[12]=n,e[13]=u):u=e[13];let b;e[14]!==s||e[15]!==d?(b=d(s===1?"change":"changes"),e[14]=s,e[15]=d,e[16]=b):b=e[16];let h;e[17]!==b?(h=(0,o.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:b}),e[17]=b,e[18]=h):h=e[18];let v;e[19]!==r||e[20]!==d?(v=r>0&&(0,o.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",d("{count} breaking",{count:r})]}),e[19]=r,e[20]=d,e[21]=v):v=e[21];let p;return e[22]!==u||e[23]!==h||e[24]!==v?(p=(0,o.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[u,h,v]}),e[22]=u,e[23]=h,e[24]=v,e[25]=p):p=e[25],p},"re"),it={addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedFieldKind:{action:"changed",kind:"field kind"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedShardMode:{action:"changed",kind:"shard mode"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"}},Ot=m((a,e)=>{let r=`${it[a.type].action} ${e} `;return a.summary.startsWith(r)?a.summary.slice(r.length):a.summary},"oe"),It=m(a=>{let e=new Map;for(let s of a){let t=s.table??"",d=e.get(t);d===void 0?e.set(t,[s]):d.push(s)}let r=[...e].map(([s,t])=>({changes:t,table:s}));return[...r.filter(s=>s.table!==""),...r.filter(s=>s.table==="")]},"de"),Mt=m(a=>{let e=(0,me.c)(2),{children:r}=a,s;return e[0]!==r?(s=(0,o.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:r}),e[0]=r,e[1]=s):s=e[1],s},"le"),Rt=m(({pane:a,shardKey:e=""})=>{let r=oe(),s=Fe(),t=De({strict:!1}).version,d=m(c=>{ke(s({search:{version:c},to:"/migrations"}))},"o"),i=de(C.schemaHistory,{},{shardKey:e}),n=i.data?.versions??[],u=t!==void 0&&n.some(c=>c.hash===t)?t:n[0]?.hash,b=n.findIndex(c=>c.hash===u),h=b===-1?void 0:n[b+1]?.hash,v=de(C.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),p=de(C.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),g=(0,ce.useMemo)(()=>{let c=st(v.data?.version?.snapshotJson);if(c!==void 0)return Nt(st(p.data?.version?.snapshotJson),c)},[v.data,p.data]),f=(0,ce.useMemo)(()=>(g?.tables??[]).map(c=>({columns:c.columns,name:c.name,tier:$t(c.shardMode)})),[g]),y=(0,ce.useMemo)(()=>{let c={};for(let N of g?.tables??[])c[N.name]=wt[N.status];return c},[g]);if(i.error!==null)return(0,o.jsx)(we,{error:i.errorSource,testId:"sh-error"});if(n.length===0)return(0,o.jsx)(ye,{description:r("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:r("No schema versions recorded yet.")});let x=g?.changes??[];return(0,o.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,o.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,o.jsx)(Mt,{children:r("Schema versions")}),(0,o.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:n.map(c=>(0,o.jsx)(jt,{appliedAt:c.appliedAt,hash:c.hash,onSelect:d,selected:c.hash===u,seq:c.seq},c.hash))})]}),(0,o.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,o.jsx)(St,{breaking:g?.breakingCount??0,count:h===void 0?f.length:x.length,first:h===void 0}),a==="diagram"?(0,o.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,o.jsx)(Ze,{fill:!0,nodeClasses:y,tables:f,testIdPrefix:"sh"})}):(0,o.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:It(x).map(c=>{let N=(g?.tables??[]).find(k=>k.name===c.table);return(0,o.jsxs)("section",{className:"mb-6",children:[(0,o.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,o.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:c.table===""?r("schema"):c.table}),N!==void 0&&(0,o.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:r("{count} columns",{count:N.columns.length})}),c.changes.length>1&&(0,o.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:c.changes.length})]}),(0,o.jsx)("ul",{children:c.changes.map(k=>{let{action:K,kind:M}=it[k.type],S=k.severity==="breaking",R=Ot(k,M);return(0,o.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,o.jsx)("span",{"aria-hidden":"true",className:ne("-ms-3 h-3 w-0.5 shrink-0 self-center",S?"bg-destructive":"bg-transparent")}),(0,o.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[r(K)," ",M]}),R!==c.table&&(0,o.jsx)("span",{className:ne("min-w-0 font-mono text-[13px]",S?"text-destructive":"text-foreground"),children:R}),S&&(0,o.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:r("breaking")})]},`${k.type}-${k.summary}`)})})]},c.table)})})]})]})},"ce"),qt=m(a=>ne("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",a?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"me"),da=m(a=>{let e=(0,me.c)(11),{initialShardKey:r}=a,s=oe(),[t,d]=(0,ce.useState)("diagram"),i;e[0]!==t?(i=m((v,p,g,f)=>(0,o.jsxs)("button",{"aria-selected":t===v,className:qt(t===v),"data-testid":g,onClick:m(()=>{d(v)},"onClick"),role:"tab",type:"button",children:[p,f!==void 0&&(0,o.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:f})]}),"i"),e[0]=t,e[1]=i):i=e[1];let n=i,u;e[2]!==s||e[3]!==n?(u=(0,o.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[n("diagram",s("Diagram"),"mg-pane-diagram"),n("changes",s("Changes"),"mg-pane-changes"),n("data",s("Data migrations"),"mg-pane-data")]}),e[2]=s,e[3]=n,e[4]=u):u=e[4];let b;e[5]!==r||e[6]!==t?(b=(0,o.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:t==="data"?(0,o.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,o.jsx)(tt,{initialShardKey:r})}):(0,o.jsx)(Rt,{pane:t,shardKey:r})}),e[5]=r,e[6]=t,e[7]=b):b=e[7];let h;return e[8]!==u||e[9]!==b?(h=(0,o.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[u,b]}),e[8]=u,e[9]=b,e[10]=h):h=e[10],h},"je");export{da as default};
1
+ import{a as Ze}from"./chunk-BLHSTFG3.js";import"./chunk-GMR677FL.js";import"./chunk-4KIQ5RLS.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as Me}from"./chunk-5Y3QLNWX.js";import{a as Ye}from"./chunk-IGCNMZSB.js";import"./chunk-I6A5C46N.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import"./chunk-4UOFSGUS.js";import{a as Xe}from"./chunk-AREBQI6D.js";import{a as ze}from"./chunk-3CWGJYBB.js";import{a as We}from"./chunk-RMN2JN4S.js";import{b as Ve}from"./chunk-GRL5MG3Z.js";import{d as De,e as Fe}from"./chunk-SMIESS7P.js";import"./chunk-7T7UOTYK.js";import{R as Ae}from"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{c as Ee}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as _e}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as we}from"./chunk-KBBOZRRX.js";import"./chunk-XXQUMVWH.js";import"./chunk-DSU54IAT.js";import"./chunk-QLQADHFE.js";import{a as C}from"./chunk-VDW32UET.js";import{c as de}from"./chunk-HRRFUAP6.js";import{f as Te}from"./chunk-6FQJRXVI.js";import"./chunk-XBDKZZ67.js";import{a as ye}from"./chunk-XQCVZAGU.js";import{a as Ge,b as He,c as Qe,d as Ie,e as O,f as I}from"./chunk-WJQLNYGX.js";import{a as Le,e as Je}from"./chunk-WQH3LT2P.js";import{d as oe,f as Ue,g as Pe,h as Be,o as ke,r as Ne}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as m,e as ie,f as qe,g as Ce,h as Ke,j as ne}from"./chunk-3XIESWL4.js";var me=ie(Ce(),1),ce=ie(qe(),1);var et=ie(Ce(),1);var j=ie(qe(),1);var l=ie(Ke(),1);var ct=Ue(C.runMigration),tt=m(a=>{let e=(0,et.c)(98),{initialShardKey:r}=a,s=Te(),t=oe(),{queryShardKey:d,setShardKey:i,shardKey:n}=ze(r),[u,b]=(0,j.useState)(""),[h,v]=(0,j.useState)("up"),[p,g]=(0,j.useState)(!0),[f,y]=(0,j.useState)(!1),[x,c]=(0,j.useState)(null),[N,k]=(0,j.useState)(null),K;e[0]!==n?(K=n.trim(),e[0]=n,e[1]=K):K=e[1];let M=K===d,S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S={},e[2]=S):S=e[2];let R;e[3]!==d?(R={live:!0,shardKey:d},e[3]=d,e[4]=R):R=e[4];let w=de(C.migrationStatus,S,R),$=w.data?.migrations??null,$e=w.error,{errorSource:je,liveError:Se}=w,ue,he;e[5]!==d||e[6]!==w.data?(ue=m(()=>{w.data!==void 0&&Ve(d)},"Q"),he=[w.data,d],e[5]=d,e[6]=w.data,e[7]=ue,e[8]=he):(ue=e[7],he=e[8]),(0,j.useEffect)(ue,he);let pe;if(e[9]!==s||e[10]!==h||e[11]!==p||e[12]!==u||e[13]!==n||e[14]!==w||e[15]!==t){let q=m(async()=>{let Re=u.trim();if(Re===""){k(t("Enter a migration id")),c(null);return}y(!0),k(null);try{let Oe=await s.query(ct,{direction:h,dryRun:p,id:Re},Pe(n));c(Oe),w.refetch()}catch(Oe){let lt=Oe;c(null),k(Be(lt))}y(!1)},"m");pe=m(()=>{ke(q())},"X"),e[9]=s,e[10]=h,e[11]=p,e[12]=u,e[13]=n,e[14]=w,e[15]=t,e[16]=pe}else pe=e[16];let fe=pe,ge;e[17]===Symbol.for("react.memo_cache_sentinel")?(ge=m(q=>{b(q.target.value)},"Z"),e[17]=ge):ge=e[17];let nt=ge,be;e[18]===Symbol.for("react.memo_cache_sentinel")?(be=m(q=>{v(q.target.value==="down"?"down":"up")},"H"),e[18]=be):be=e[18];let ot=be,ve;e[19]===Symbol.for("react.memo_cache_sentinel")?(ve=m(q=>{g(q.target.checked)},"ee"),e[19]=ve):ve=e[19];let dt=ve,T;e[20]!==i||e[21]!==n?(T=(0,l.jsx)(We,{onChange:i,testId:"mg-shard-input",value:n}),e[20]=i,e[21]=n,e[22]=T):T=e[22];let D;e[23]!==Se?(D=(0,l.jsx)(Ye,{message:Se,prefix:"mg"}),e[23]=Se,e[24]=D):D=e[24];let F;e[25]!==T||e[26]!==D?(F=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[T,D]}),e[25]=T,e[26]=D,e[27]=F):F=e[27];let _;e[28]!==$e||e[29]!==je?(_=$e!==null&&(0,l.jsx)(we,{error:je,testId:"mg-status-error"}),e[28]=$e,e[29]=je,e[30]=_):_=e[30];let A;e[31]!==$||e[32]!==t?(A=$!==null&&$.length===0&&(0,l.jsx)(ye,{description:t("Data migrations you run against this shard will be tracked here."),icon:(0,l.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.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"})}),testId:"mg-empty",title:t("No migrations have run on this shard.")}),e[31]=$,e[32]=t,e[33]=A):A=e[33];let E;e[34]!==$||e[35]!==t?(E=$!==null&&$.length>0&&(0,l.jsx)(Le,{className:"overflow-hidden py-0",children:(0,l.jsx)(Je,{className:"px-0",children:(0,l.jsxs)(Ge,{"data-testid":"mg-table",children:[(0,l.jsx)(He,{children:(0,l.jsxs)(Ie,{children:[(0,l.jsx)(O,{children:t("id")}),(0,l.jsx)(O,{children:t("direction")}),(0,l.jsx)(O,{children:t("status")}),(0,l.jsx)(O,{children:t("processed")}),(0,l.jsx)(O,{children:t("changed")}),(0,l.jsx)(O,{children:t("updated")}),(0,l.jsx)(O,{children:t("error")})]})}),(0,l.jsx)(Qe,{children:$.map(mt)})]})})}),e[34]=$,e[35]=t,e[36]=E):E=e[36];let L;e[37]!==t?(L=t("Run migration"),e[37]=t,e[38]=L):L=e[38];let J;e[39]!==L?(J=(0,l.jsx)(Me,{children:L}),e[39]=L,e[40]=J):J=e[40];let U;e[41]!==t?(U=t("Migration id"),e[41]=t,e[42]=U):U=e[42];let P;e[43]!==t?(P=t("migration id"),e[43]=t,e[44]=P):P=e[44];let B;e[45]!==u||e[46]!==U||e[47]!==P?(B=(0,l.jsx)(Ae,{"aria-label":U,className:"w-auto","data-testid":"mg-id-input",onChange:nt,placeholder:P,value:u}),e[45]=u,e[46]=U,e[47]=P,e[48]=B):B=e[48];let V;e[49]!==t?(V=t("Direction"),e[49]=t,e[50]=V):V=e[50];let W;e[51]!==t?(W=t("up"),e[51]=t,e[52]=W):W=e[52];let z;e[53]!==W?(z=(0,l.jsx)("option",{value:"up",children:W}),e[53]=W,e[54]=z):z=e[54];let G;e[55]!==t?(G=t("down"),e[55]=t,e[56]=G):G=e[56];let H;e[57]!==G?(H=(0,l.jsx)("option",{value:"down",children:G}),e[57]=G,e[58]=H):H=e[58];let Q;e[59]!==h||e[60]!==V||e[61]!==z||e[62]!==H?(Q=(0,l.jsxs)("select",{"aria-label":V,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:ot,value:h,children:[z,H]}),e[59]=h,e[60]=V,e[61]=z,e[62]=H,e[63]=Q):Q=e[63];let X;e[64]!==p?(X=(0,l.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:dt,type:"checkbox"}),e[64]=p,e[65]=X):X=e[65];let Y;e[66]!==t?(Y=t("Dry run"),e[66]=t,e[67]=Y):Y=e[67];let Z;e[68]!==X||e[69]!==Y?(Z=(0,l.jsxs)(Me,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[X,Y]}),e[68]=X,e[69]=Y,e[70]=Z):Z=e[70];let ee;e[71]!==p||e[72]!==fe||e[73]!==f||e[74]!==M||e[75]!==t?(ee=p?(0,l.jsx)(Ee,{"data-testid":"mg-run",disabled:f||!M,onClick:fe,type:"button",children:t(f?"Running\u2026":"Run")}):(0,l.jsx)(Xe,{confirmLabel:t(f?"Running\u2026":"Run migration?"),disabled:f||!M,onConfirm:fe,testId:"mg-run",children:t("Run")}),e[71]=p,e[72]=fe,e[73]=f,e[74]=M,e[75]=t,e[76]=ee):ee=e[76];let te;e[77]!==B||e[78]!==Q||e[79]!==Z||e[80]!==ee?(te=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[B,Q,Z,ee]}),e[77]=B,e[78]=Q,e[79]=Z,e[80]=ee,e[81]=te):te=e[81];let ae;e[82]!==J||e[83]!==te?(ae=(0,l.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[J,te]}),e[82]=J,e[83]=te,e[84]=ae):ae=e[84];let re;e[85]!==N?(re=N!==null&&(0,l.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:N}),e[85]=N,e[86]=re):re=e[86];let se;e[87]!==x||e[88]!==t?(se=x!==null&&(0,l.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[x.dryRun?t("Dry run: "):"",t("{status} \u2014 processed",{status:x.status}),x.processed,t(", changed"),x.changed]}),e[87]=x,e[88]=t,e[89]=se):se=e[89];let xe;return e[90]!==F||e[91]!==_||e[92]!==A||e[93]!==E||e[94]!==ae||e[95]!==re||e[96]!==se?(xe=(0,l.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[F,_,A,E,ae,re,se]}),e[90]=F,e[91]=_,e[92]=A,e[93]=E,e[94]=ae,e[95]=re,e[96]=se,e[97]=xe):xe=e[97],xe},"yr");function mt(a){return(0,l.jsxs)(Ie,{"data-testid":`mg-row-${a.id}`,children:[(0,l.jsx)(I,{children:a.id}),(0,l.jsx)(I,{children:a.direction}),(0,l.jsx)(I,{children:(0,l.jsx)(_e,{variant:"secondary",children:a.status})}),(0,l.jsx)(I,{children:a.processed}),(0,l.jsx)(I,{children:a.changed}),(0,l.jsx)(I,{children:Ne(a.updatedAt)}),(0,l.jsx)(I,{children:a.error??""})]},a.id)}m(mt,"Ve");var o=ie(Ke(),1);var le=m(a=>typeof a=="object"&&a!==null,"k"),ut=m(a=>le(a)&&le(a.fields)&&le(a.indexes)&&le(a.relations)&&typeof a.shardMode=="string","z"),ht=m(a=>{if(a===void 0||a.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(a)}catch(r){return{error:`baseline is not valid JSON: ${r instanceof Error?r.message:String(r)}`,status:"invalid"}}if(!le(e)||e.version!==1||!le(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(1)})`,status:"invalid"};for(let[r,s]of Object.entries(e.tables))if(!ut(s))return{error:`baseline table "${r}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:1},status:"ok"}},"B"),pt=m((a,e)=>a.unique===e.unique&&a.fields.length===e.fields.length&&a.fields.every((r,s)=>r===e.fields[s]),"L"),ft=m((a,e,r,s)=>{let t=[];return r.kind!==s.kind&&t.push({severity:"breaking",summary:`field ${a}.${e} changed type: ${r.kind} \u2192 ${s.kind} \u2014 add a data migration to convert existing values`,table:a,scope:"table",type:"changedFieldKind"}),r.optional&&!s.optional?t.push({severity:"breaking",summary:`field ${a}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:a,scope:"table",type:"fieldOptionalToRequired"}):!r.optional&&s.optional&&t.push({scope:"table",severity:"safe",summary:`field ${a}.${e} became optional`,table:a,type:"fieldRequiredToOptional"}),t},"Q"),gt=m((a,e,r)=>r.optional?{scope:"table",severity:"safe",summary:`added optional field ${a}.${e}`,table:a,type:"addedOptionalField"}:{severity:"breaking",summary:`added required field ${a}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:a,scope:"table",type:"addedRequiredField"},"G"),bt=m((a,e,r,s)=>{for(let[t,d]of Object.entries(r.fields)){let i=e.fields[t];i===void 0?s.push(gt(a,t,d)):s.push(...ft(a,t,i,d))}for(let t of Object.keys(e.fields))r.fields[t]===void 0&&s.push({severity:"breaking",summary:`removed field ${a}.${t} \u2014 add a data migration if stored data must be cleaned up`,table:a,scope:"table",type:"removedField"})},"X"),vt=m((a,e,r,s)=>{for(let[t,d]of Object.entries(r.indexes)){let i=e.indexes[t];if(i===void 0){s.push({scope:"table",severity:"safe",summary:`added index ${t} on ${a}`,table:a,type:"addedIndex"});continue}pt(i,d)||s.push({severity:"breaking",summary:`index ${t} on ${a} changed shape \u2014 a query may have relied on the old index`,table:a,scope:"table",type:"changedIndex"})}for(let t of Object.keys(e.indexes))r.indexes[t]===void 0&&s.push({severity:"breaking",summary:`removed index ${t} on ${a} \u2014 a query that used \`.withIndex("${t}")\` would break`,table:a,scope:"table",type:"removedIndex"})},"Y"),xt=m((a,e,r,s)=>{for(let t of Object.keys(r.relations))e.relations[t]===void 0&&s.push({scope:"schema",severity:"safe",summary:`added relation ${a}.${t}`,table:a,type:"addedRelation"});for(let t of Object.keys(e.relations))r.relations[t]===void 0&&s.push({scope:"schema",severity:"breaking",summary:`removed relation ${a}.${t}`,table:a,type:"removedRelation"})},"Z"),yt=m((a,e,r,s)=>{e.shardMode!==r.shardMode&&s.push({severity:"breaking",summary:`table ${a} changed shard mode: ${e.shardMode} \u2192 ${r.shardMode} \u2014 its physical storage moves; add a data migration / re-shard plan`,table:a,scope:"table",type:"changedShardMode"}),bt(a,e,r,s),vt(a,e,r,s),xt(a,e,r,s)},"ee"),kt=m((a,e)=>{let r=[],s=a?.tables??{};for(let[t,d]of Object.entries(e.tables)){let i=s[t];if(i===void 0){r.push({scope:"table",severity:"safe",summary:`added table ${t}`,table:t,type:"addedTable"});continue}yt(t,i,d,r)}for(let t of Object.keys(s))e.tables[t]===void 0&&r.push({scope:"table",severity:"breaking",summary:`removed table ${t} \u2014 add a data migration if its data must be archived/cleaned up`,table:t,type:"removedTable"});if(a!==void 0&&a.jurisdiction!==e.jurisdiction){let t=a.jurisdiction??"(none)",d=e.jurisdiction??"(none)";r.push({scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${t} to ${d} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:r}},"te"),at=m(a=>Object.entries(a.fields).map(([e,r])=>({name:e,optional:r.optional,ref:Object.values(a.relations).find(s=>s.field===e&&s.kind==="one")?.table,type:r.kind})),"T"),rt=m((a,e)=>{let r={},s=a?.fields??{},t=e?.fields??{};for(let[d,i]of Object.entries(t)){let n=s[d];n===void 0?r[d]=a===void 0?"unchanged":"added":r[d]=n.kind===i.kind&&n.optional===i.optional?"unchanged":"changed"}for(let d of Object.keys(s))t[d]===void 0&&(r[d]="removed");return r},"F"),Nt=m((a,e)=>{let{changes:r}=kt(a,e),s=new Set(r.filter(i=>i.scope==="table"&&i.table!==void 0).map(i=>i.table)),t=[],d=m((i,n)=>i?"added":s.has(n)?"changed":"context","o");for(let[i,n]of Object.entries(e.tables)){let u=a?.tables[i],b=d(u===void 0,i);t.push({columns:at(n),fieldStatus:rt(u,n),name:i,shardMode:n.shardMode,status:b})}for(let[i,n]of Object.entries(a?.tables??{}))e.tables[i]===void 0&&t.push({columns:at(n),fieldStatus:rt(n,void 0),name:i,shardMode:n.shardMode,status:"removed"});return t.sort((i,n)=>i.name.localeCompare(n.name)),{breakingCount:r.filter(i=>i.severity==="breaking").length,changes:r,tables:t}},"ae"),st=m(a=>{let e=ht(a);return e.status==="ok"?e.snapshot:void 0},"K"),wt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},$t=m(a=>a==="global"?"global":"shard","se"),jt=m(a=>{let e=(0,me.c)(24),{appliedAt:r,hash:s,onSelect:t,selected:d,seq:i}=a,n=d?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",u;e[0]!==n?(u=ne("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",n),e[0]=n,e[1]=u):u=e[1];let b=`sh-version-${s}`,h;e[2]!==s||e[3]!==t?(h=m(()=>{t(s)},"m"),e[2]=s,e[3]=t,e[4]=h):h=e[4];let v;e[5]!==i?(v=(0,o.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",i]}),e[5]=i,e[6]=v):v=e[6];let p;e[7]!==s?(p=s.slice(0,7),e[7]=s,e[8]=p):p=e[8];let g;e[9]!==p?(g=(0,o.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=g):g=e[10];let f;e[11]!==v||e[12]!==g?(f=(0,o.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[v,g]}),e[11]=v,e[12]=g,e[13]=f):f=e[13];let y;e[14]!==r?(y=Ne(r),e[14]=r,e[15]=y):y=e[15];let x;e[16]!==y?(x=(0,o.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:y}),e[16]=y,e[17]=x):x=e[17];let c;return e[18]!==x||e[19]!==u||e[20]!==b||e[21]!==h||e[22]!==f?(c=(0,o.jsx)("li",{children:(0,o.jsxs)("button",{className:u,"data-testid":b,onClick:h,type:"button",children:[f,x]})}),e[18]=x,e[19]=u,e[20]=b,e[21]=h,e[22]=f,e[23]=c):c=e[23],c},"ie"),St=m(a=>{let e=(0,me.c)(26),{breaking:r,count:s,first:t}=a,d=oe();if(t){let g;e[0]!==s?(g=(0,o.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:s}),e[0]=s,e[1]=g):g=e[1];let f;e[2]!==d?(f=d("tables"),e[2]=d,e[3]=f):f=e[3];let y;e[4]!==f?(y=(0,o.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[4]=f,e[5]=y):y=e[5];let x;return e[6]!==g||e[7]!==y?(x=(0,o.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[g,y]}),e[6]=g,e[7]=y,e[8]=x):x=e[8],x}let i=r>0&&"text-destructive",n;e[9]!==i?(n=ne("text-3xl leading-none font-light tracking-tight tabular-nums",i),e[9]=i,e[10]=n):n=e[10];let u;e[11]!==s||e[12]!==n?(u=(0,o.jsx)("span",{className:n,children:s}),e[11]=s,e[12]=n,e[13]=u):u=e[13];let b;e[14]!==s||e[15]!==d?(b=d(s===1?"change":"changes"),e[14]=s,e[15]=d,e[16]=b):b=e[16];let h;e[17]!==b?(h=(0,o.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:b}),e[17]=b,e[18]=h):h=e[18];let v;e[19]!==r||e[20]!==d?(v=r>0&&(0,o.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",d("{count} breaking",{count:r})]}),e[19]=r,e[20]=d,e[21]=v):v=e[21];let p;return e[22]!==u||e[23]!==h||e[24]!==v?(p=(0,o.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[u,h,v]}),e[22]=u,e[23]=h,e[24]=v,e[25]=p):p=e[25],p},"re"),it={addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedFieldKind:{action:"changed",kind:"field kind"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedShardMode:{action:"changed",kind:"shard mode"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"}},Ot=m((a,e)=>{let r=`${it[a.type].action} ${e} `;return a.summary.startsWith(r)?a.summary.slice(r.length):a.summary},"oe"),It=m(a=>{let e=new Map;for(let s of a){let t=s.table??"",d=e.get(t);d===void 0?e.set(t,[s]):d.push(s)}let r=[...e].map(([s,t])=>({changes:t,table:s}));return[...r.filter(s=>s.table!==""),...r.filter(s=>s.table==="")]},"de"),Mt=m(a=>{let e=(0,me.c)(2),{children:r}=a,s;return e[0]!==r?(s=(0,o.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:r}),e[0]=r,e[1]=s):s=e[1],s},"le"),Rt=m(({pane:a,shardKey:e=""})=>{let r=oe(),s=Fe(),t=De({strict:!1}).version,d=m(c=>{ke(s({search:{version:c},to:"/migrations"}))},"o"),i=de(C.schemaHistory,{},{shardKey:e}),n=i.data?.versions??[],u=t!==void 0&&n.some(c=>c.hash===t)?t:n[0]?.hash,b=n.findIndex(c=>c.hash===u),h=b===-1?void 0:n[b+1]?.hash,v=de(C.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),p=de(C.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),g=(0,ce.useMemo)(()=>{let c=st(v.data?.version?.snapshotJson);if(c!==void 0)return Nt(st(p.data?.version?.snapshotJson),c)},[v.data,p.data]),f=(0,ce.useMemo)(()=>(g?.tables??[]).map(c=>({columns:c.columns,name:c.name,tier:$t(c.shardMode)})),[g]),y=(0,ce.useMemo)(()=>{let c={};for(let N of g?.tables??[])c[N.name]=wt[N.status];return c},[g]);if(i.error!==null)return(0,o.jsx)(we,{error:i.errorSource,testId:"sh-error"});if(n.length===0)return(0,o.jsx)(ye,{description:r("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:r("No schema versions recorded yet.")});let x=g?.changes??[];return(0,o.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,o.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,o.jsx)(Mt,{children:r("Schema versions")}),(0,o.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:n.map(c=>(0,o.jsx)(jt,{appliedAt:c.appliedAt,hash:c.hash,onSelect:d,selected:c.hash===u,seq:c.seq},c.hash))})]}),(0,o.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,o.jsx)(St,{breaking:g?.breakingCount??0,count:h===void 0?f.length:x.length,first:h===void 0}),a==="diagram"?(0,o.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,o.jsx)(Ze,{fill:!0,nodeClasses:y,tables:f,testIdPrefix:"sh"})}):(0,o.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:It(x).map(c=>{let N=(g?.tables??[]).find(k=>k.name===c.table);return(0,o.jsxs)("section",{className:"mb-6",children:[(0,o.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,o.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:c.table===""?r("schema"):c.table}),N!==void 0&&(0,o.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:r("{count} columns",{count:N.columns.length})}),c.changes.length>1&&(0,o.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:c.changes.length})]}),(0,o.jsx)("ul",{children:c.changes.map(k=>{let{action:K,kind:M}=it[k.type],S=k.severity==="breaking",R=Ot(k,M);return(0,o.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,o.jsx)("span",{"aria-hidden":"true",className:ne("-ms-3 h-3 w-0.5 shrink-0 self-center",S?"bg-destructive":"bg-transparent")}),(0,o.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[r(K)," ",M]}),R!==c.table&&(0,o.jsx)("span",{className:ne("min-w-0 font-mono text-[13px]",S?"text-destructive":"text-foreground"),children:R}),S&&(0,o.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:r("breaking")})]},`${k.type}-${k.summary}`)})})]},c.table)})})]})]})},"ce"),qt=m(a=>ne("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",a?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"me"),da=m(a=>{let e=(0,me.c)(11),{initialShardKey:r}=a,s=oe(),[t,d]=(0,ce.useState)("diagram"),i;e[0]!==t?(i=m((v,p,g,f)=>(0,o.jsxs)("button",{"aria-selected":t===v,className:qt(t===v),"data-testid":g,onClick:m(()=>{d(v)},"onClick"),role:"tab",type:"button",children:[p,f!==void 0&&(0,o.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:f})]}),"i"),e[0]=t,e[1]=i):i=e[1];let n=i,u;e[2]!==s||e[3]!==n?(u=(0,o.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[n("diagram",s("Diagram"),"mg-pane-diagram"),n("changes",s("Changes"),"mg-pane-changes"),n("data",s("Data migrations"),"mg-pane-data")]}),e[2]=s,e[3]=n,e[4]=u):u=e[4];let b;e[5]!==r||e[6]!==t?(b=(0,o.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:t==="data"?(0,o.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,o.jsx)(tt,{initialShardKey:r})}):(0,o.jsx)(Rt,{pane:t,shardKey:r})}),e[5]=r,e[6]=t,e[7]=b):b=e[7];let h;return e[8]!==u||e[9]!==b?(h=(0,o.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[u,b]}),e[8]=u,e[9]=b,e[10]=h):h=e[10],h},"je");export{da as default};
@@ -1 +1 @@
1
- import{m as g,n as b}from"./chunk-U7ILDM43.js";import{a as c,e as p,g as y,h as M,j as d}from"./chunk-3XIESWL4.js";var w=c(e=>{let t=0,s=0,r=0,a=0,i=0,l=0,o=0;for(let{metrics:n}of e){if(n===null){i+=1;continue}a+=1,t+=n.requests,s+=n.errors,r+=n.databaseSize??0,n.cache!==null&&(l+=n.cache.hits,o+=n.cache.hits+n.cache.misses)}return{failed:i,hitRate:o===0?null:l/o,reachable:a,totalDatabaseSize:r,totalErrors:s,totalRequests:t}},"u"),C=c((e,t)=>{let s=new Set,r=[];for(let a of["",e.trim(),...t])s.has(a)||(s.add(a),r.push(a));return r},"h"),v=c((e,t)=>{if(e.length===0)return 0;if(e.sort((r,a)=>r-a),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;let s=Math.ceil(t/100*e.length)-1;return e[s]??0},"i"),N=c(e=>{let t=e.functions;if(!t||t.length===0)return{p90:0,p95:0};let s=1e3,r=[];for(let a of t){if(a.calls<=0)continue;let i=a.totalDurationMs/a.calls,l=Math.min(a.calls,s);for(let o=0;o<l;o+=1)r.push(i)}return r.length===0?{p90:0,p95:0}:{p90:v([...r],90),p95:v([...r],95)}},"f");var q=c(e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0})),"g");var x=p(y(),1);var m=p(M(),1);var S={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},T=c(e=>{let t=(0,x.c)(12),{ariaLabel:s,className:r,series:a,testId:i}=e;if(a.length<2)return null;let l;t[0]!==a?(l=a.slice(-40).map(D),t[0]=a,t[1]=l):l=t[1];let o=l,n;t[2]!==r?(n=d("h-6 w-[120px]",r),t[2]=r,t[3]=n):n=t[3];let f;t[4]===Symbol.for("react.memo_cache_sentinel")?(f=(0,m.jsx)(b,{dataKey:"value"}),t[4]=f):f=t[4];let u;t[5]!==o?(u=(0,m.jsx)(g,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:S,data:o,children:f}),t[5]=o,t[6]=u):u=t[6];let h;return t[7]!==s||t[8]!==n||t[9]!==u||t[10]!==i?(h=(0,m.jsx)("div",{"aria-label":s,className:n,"data-testid":i,role:"img",children:u}),t[7]=s,t[8]=n,t[9]=u,t[10]=i,t[11]=h):h=t[11],h},"S");function D(e,t){return{index:t,value:e}}c(D,"b");export{w as a,C as b,N as c,q as d,T as e};
1
+ import{m as g,n as b}from"./chunk-OQIGV6FX.js";import{a as c,e as p,g as y,h as M,j as d}from"./chunk-3XIESWL4.js";var w=c(e=>{let t=0,s=0,r=0,a=0,i=0,l=0,o=0;for(let{metrics:n}of e){if(n===null){i+=1;continue}a+=1,t+=n.requests,s+=n.errors,r+=n.databaseSize??0,n.cache!==null&&(l+=n.cache.hits,o+=n.cache.hits+n.cache.misses)}return{failed:i,hitRate:o===0?null:l/o,reachable:a,totalDatabaseSize:r,totalErrors:s,totalRequests:t}},"u"),C=c((e,t)=>{let s=new Set,r=[];for(let a of["",e.trim(),...t])s.has(a)||(s.add(a),r.push(a));return r},"h"),v=c((e,t)=>{if(e.length===0)return 0;if(e.sort((r,a)=>r-a),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;let s=Math.ceil(t/100*e.length)-1;return e[s]??0},"i"),N=c(e=>{let t=e.functions;if(!t||t.length===0)return{p90:0,p95:0};let s=1e3,r=[];for(let a of t){if(a.calls<=0)continue;let i=a.totalDurationMs/a.calls,l=Math.min(a.calls,s);for(let o=0;o<l;o+=1)r.push(i)}return r.length===0?{p90:0,p95:0}:{p90:v([...r],90),p95:v([...r],95)}},"f");var q=c(e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0})),"g");var x=p(y(),1);var m=p(M(),1);var S={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},T=c(e=>{let t=(0,x.c)(12),{ariaLabel:s,className:r,series:a,testId:i}=e;if(a.length<2)return null;let l;t[0]!==a?(l=a.slice(-40).map(D),t[0]=a,t[1]=l):l=t[1];let o=l,n;t[2]!==r?(n=d("h-6 w-[120px]",r),t[2]=r,t[3]=n):n=t[3];let f;t[4]===Symbol.for("react.memo_cache_sentinel")?(f=(0,m.jsx)(b,{dataKey:"value"}),t[4]=f):f=t[4];let u;t[5]!==o?(u=(0,m.jsx)(g,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:S,data:o,children:f}),t[5]=o,t[6]=u):u=t[6];let h;return t[7]!==s||t[8]!==n||t[9]!==u||t[10]!==i?(h=(0,m.jsx)("div",{"aria-label":s,className:n,"data-testid":i,role:"img",children:u}),t[7]=s,t[8]=n,t[9]=u,t[10]=i,t[11]=h):h=t[11],h},"S");function D(e,t){return{index:t,value:e}}c(D,"b");export{w as a,C as b,N as c,q as d,T as e};