@lunora/studio 1.0.0-alpha.394 → 1.0.0-alpha.395

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 (126) hide show
  1. package/README.md +2 -0
  2. package/dist/index.mjs +1 -1
  3. package/dist/mount.mjs +1 -1
  4. package/dist/packem_chunks/ai-knowledge.mjs +1 -1
  5. package/dist/packem_shared/StudioApp-CmlMUUAq.mjs +1 -0
  6. package/dist/standalone/{chunk-AWMHWVF7.js → chunk-2ASCHUYZ.js} +1 -1
  7. package/dist/standalone/{chunk-BTHVLHPT.js → chunk-2GY7PZLR.js} +1 -1
  8. package/dist/standalone/{chunk-DUICFFES.js → chunk-2Q2YW6DP.js} +1 -1
  9. package/dist/standalone/{chunk-YQI2YAD7.js → chunk-2SQ4R6JF.js} +1 -1
  10. package/dist/standalone/{chunk-Y4KOJPOW.js → chunk-2V76BRXG.js} +1 -1
  11. package/dist/standalone/{chunk-U4ZQVQZA.js → chunk-37QBGHAB.js} +1 -1
  12. package/dist/standalone/{chunk-YREHZBTG.js → chunk-37YN7GKB.js} +1 -1
  13. package/dist/standalone/{chunk-4Z2GLDF7.js → chunk-3FRO43CC.js} +1 -1
  14. package/dist/standalone/chunk-3NPH3ZH2.js +1 -0
  15. package/dist/standalone/{chunk-DRSX6KR3.js → chunk-3SFU5VY4.js} +1 -1
  16. package/dist/standalone/{chunk-YC3TUO5H.js → chunk-3WPPFTDC.js} +1 -1
  17. package/dist/standalone/{chunk-BUYKTV27.js → chunk-43LNUM4U.js} +1 -1
  18. package/dist/standalone/{chunk-HCLUIJMW.js → chunk-4A6J4C6A.js} +1 -1
  19. package/dist/standalone/chunk-4DZXYINC.js +1 -0
  20. package/dist/standalone/{chunk-26RNXTU3.js → chunk-4EJG4J2A.js} +1 -1
  21. package/dist/standalone/{chunk-BCT3KY76.js → chunk-4FTKFUPJ.js} +1 -1
  22. package/dist/standalone/{chunk-SQO3WGXH.js → chunk-4L2BABMS.js} +1 -1
  23. package/dist/standalone/{chunk-A33FOU2H.js → chunk-5BI76KCT.js} +1 -1
  24. package/dist/standalone/{chunk-BMGMBZAW.js → chunk-5IFJNGRV.js} +1 -1
  25. package/dist/standalone/{chunk-PT4GNZU7.js → chunk-5JCH67JD.js} +1 -1
  26. package/dist/standalone/{chunk-JCJCUWVN.js → chunk-5KNYRYVI.js} +1 -1
  27. package/dist/standalone/{chunk-5J2UX2CO.js → chunk-5PWQ7HBE.js} +1 -1
  28. package/dist/standalone/{chunk-JXW6H6LE.js → chunk-6CVUGL2K.js} +1 -1
  29. package/dist/standalone/{chunk-IC2PEYF7.js → chunk-6E2GHT3X.js} +1 -1
  30. package/dist/standalone/chunk-6MAIN66N.js +1 -0
  31. package/dist/standalone/{chunk-3GBBYV7C.js → chunk-6OE7TT2Y.js} +1 -1
  32. package/dist/standalone/{chunk-T6YZEXZO.js → chunk-6PQX7SHZ.js} +1 -1
  33. package/dist/standalone/{chunk-PVQDT47U.js → chunk-6QP547WA.js} +1 -1
  34. package/dist/standalone/chunk-7EUM7G2I.js +33 -0
  35. package/dist/standalone/{chunk-EEDAK4NS.js → chunk-7TGL5VXY.js} +1 -1
  36. package/dist/standalone/{chunk-TNQHMR76.js → chunk-7UN2ZZZV.js} +1 -1
  37. package/dist/standalone/{chunk-7URG6FZD.js → chunk-AFOBKJOK.js} +1 -1
  38. package/dist/standalone/{chunk-BFV46XUH.js → chunk-AGM656HF.js} +1 -1
  39. package/dist/standalone/{chunk-EBGXOUAO.js → chunk-AHX6CSR3.js} +1 -1
  40. package/dist/standalone/{chunk-2Q4WVEPB.js → chunk-AK6ZI3YN.js} +1 -1
  41. package/dist/standalone/{chunk-VLQU4G6O.js → chunk-AL5S7LVU.js} +1 -1
  42. package/dist/standalone/{chunk-M6WDFEUZ.js → chunk-B65U64C3.js} +1 -1
  43. package/dist/standalone/{chunk-PWHUPKZB.js → chunk-B7W7O2RS.js} +1 -1
  44. package/dist/standalone/chunk-BD76RVBZ.js +7 -0
  45. package/dist/standalone/{chunk-ZARTCW6W.js → chunk-BGU4O7PL.js} +1 -1
  46. package/dist/standalone/{chunk-VUWHTKLJ.js → chunk-BNDXMSLI.js} +1 -1
  47. package/dist/standalone/{chunk-ZG6VEBVA.js → chunk-BYUH4YAY.js} +1 -1
  48. package/dist/standalone/{chunk-N3MKRANL.js → chunk-CKGUHRV2.js} +1 -1
  49. package/dist/standalone/{chunk-ADOZBBJC.js → chunk-DL5ZVSGL.js} +1 -1
  50. package/dist/standalone/{chunk-TAZRDWQE.js → chunk-EE6QEAGV.js} +1 -1
  51. package/dist/standalone/{chunk-5BTQ4VV2.js → chunk-EGO7EG33.js} +1 -1
  52. package/dist/standalone/{chunk-AFUJCRWR.js → chunk-EHQ2LCCB.js} +1 -1
  53. package/dist/standalone/{chunk-HXWW3XML.js → chunk-FGAXBLHE.js} +1 -1
  54. package/dist/standalone/{chunk-K3HWPNON.js → chunk-FHR4JFT7.js} +1 -1
  55. package/dist/standalone/{chunk-EH53XOVI.js → chunk-G237Z4YL.js} +1 -1
  56. package/dist/standalone/{chunk-WVAWKCNQ.js → chunk-H4NGBPG2.js} +1 -1
  57. package/dist/standalone/{chunk-RRIRWVQY.js → chunk-I6TDZTVT.js} +1 -1
  58. package/dist/standalone/{chunk-QJ3M3IQW.js → chunk-IB4M4AI2.js} +1 -1
  59. package/dist/standalone/{chunk-S3HFNWDK.js → chunk-IGQXAWBB.js} +1 -1
  60. package/dist/standalone/{chunk-5XQM44J7.js → chunk-IGSYGAHI.js} +1 -1
  61. package/dist/standalone/{chunk-J2SIGUHW.js → chunk-IJAV3RXF.js} +1 -1
  62. package/dist/standalone/{chunk-NFIFRB3W.js → chunk-IT3JTYC4.js} +1 -1
  63. package/dist/standalone/{chunk-D4CP2AUO.js → chunk-J2IFOOCG.js} +1 -1
  64. package/dist/standalone/{chunk-YQEIOEEC.js → chunk-JARVMFE6.js} +1 -1
  65. package/dist/standalone/{chunk-WARWYT4K.js → chunk-JCHZNPJU.js} +1 -1
  66. package/dist/standalone/{chunk-2ZNMZPPZ.js → chunk-JGSHDQGZ.js} +1 -1
  67. package/dist/standalone/{chunk-EYFAYJYD.js → chunk-KHNHN37V.js} +1 -1
  68. package/dist/standalone/{chunk-ECXQQPVU.js → chunk-LTWCT32V.js} +1 -1
  69. package/dist/standalone/{chunk-HPQLTLIE.js → chunk-LVWOITSU.js} +1 -1
  70. package/dist/standalone/{chunk-TIFTYP3Z.js → chunk-M2NWC7G3.js} +1 -1
  71. package/dist/standalone/{chunk-MEYZIZGX.js → chunk-M2SFKF5Z.js} +1 -1
  72. package/dist/standalone/{chunk-S3WL3QZ2.js → chunk-MCJCCS7G.js} +1 -1
  73. package/dist/standalone/chunk-MYIUZ3KE.js +1 -0
  74. package/dist/standalone/{chunk-TDF4VVIF.js → chunk-N6F3WFL4.js} +1 -1
  75. package/dist/standalone/{chunk-FSY7UKMG.js → chunk-NBJ6DCHA.js} +1 -1
  76. package/dist/standalone/{chunk-QRXJTY2S.js → chunk-NJMFSHMW.js} +1 -1
  77. package/dist/standalone/{chunk-4OWWWAMB.js → chunk-OGRACGHY.js} +1 -1
  78. package/dist/standalone/{chunk-ZSXJJYWN.js → chunk-OSYCXIGN.js} +1 -1
  79. package/dist/standalone/{chunk-FRKRT73U.js → chunk-P5SHS466.js} +1 -1
  80. package/dist/standalone/{chunk-RIRXDYLA.js → chunk-PIFKJ3ES.js} +1 -1
  81. package/dist/standalone/chunk-QE2BYD4G.js +1 -0
  82. package/dist/standalone/{chunk-C4PC3TVC.js → chunk-QJH6HTCT.js} +1 -1
  83. package/dist/standalone/{chunk-OEPNNICC.js → chunk-RELSLYVS.js} +1 -1
  84. package/dist/standalone/{chunk-CBFVQCWS.js → chunk-REZHNEUN.js} +1 -1
  85. package/dist/standalone/{chunk-3BDGZAZD.js → chunk-RG5MG5I4.js} +1 -1
  86. package/dist/standalone/{chunk-5FHGTA7V.js → chunk-SFGYW6JZ.js} +1 -1
  87. package/dist/standalone/{chunk-UB6S6VYI.js → chunk-STKYARMP.js} +1 -1
  88. package/dist/standalone/{chunk-A7L3PZEL.js → chunk-THCO2YN5.js} +1 -1
  89. package/dist/standalone/{chunk-KEHWNM7Q.js → chunk-TPY5BJYD.js} +1 -1
  90. package/dist/standalone/{chunk-HLN47VMG.js → chunk-TWOO3G2Q.js} +1 -1
  91. package/dist/standalone/{chunk-LUHBGCMO.js → chunk-U7U4ADXH.js} +1 -1
  92. package/dist/standalone/{chunk-MLX6ME3Q.js → chunk-UWJXX5AV.js} +1 -1
  93. package/dist/standalone/{chunk-UHFZV34O.js → chunk-V335NVH7.js} +1 -1
  94. package/dist/standalone/{chunk-HE2XT2P7.js → chunk-V4X27TLH.js} +1 -1
  95. package/dist/standalone/{chunk-E32WBVTB.js → chunk-VAZ2FZKT.js} +1 -1
  96. package/dist/standalone/{chunk-WY23EROJ.js → chunk-VKBLXJIZ.js} +1 -1
  97. package/dist/standalone/{chunk-XWLURY4U.js → chunk-VUC5V5XF.js} +1 -1
  98. package/dist/standalone/{chunk-7XZENNML.js → chunk-WC2DKA2R.js} +1 -1
  99. package/dist/standalone/{chunk-4WFEKKAZ.js → chunk-X7ZYE4GP.js} +1 -1
  100. package/dist/standalone/{chunk-KJHVB5KM.js → chunk-XACKMLPO.js} +1 -1
  101. package/dist/standalone/{chunk-EOTHFTZG.js → chunk-YCZQNUZV.js} +1 -1
  102. package/dist/standalone/chunk-YIZDDGWA.js +1 -0
  103. package/dist/standalone/{chunk-VEG327ST.js → chunk-YNO5YLZT.js} +5 -5
  104. package/dist/standalone/chunk-YQJIG7QG.js +167 -0
  105. package/dist/standalone/{chunk-HPCOC223.js → chunk-YRC2DXSL.js} +1 -1
  106. package/dist/standalone/{chunk-VND72OIC.js → chunk-YUENB45T.js} +1 -1
  107. package/dist/standalone/{chunk-F4NZZ3LK.js → chunk-YYRXX5Z4.js} +1 -1
  108. package/dist/standalone/chunk-Z2ERBKWN.js +1 -0
  109. package/dist/standalone/{chunk-VUMS4VIV.js → chunk-ZBAR562M.js} +1 -1
  110. package/dist/standalone/{chunk-V5ZKAZR6.js → chunk-ZKEXJDGJ.js} +1 -1
  111. package/dist/standalone/{chunk-BADHCM45.js → chunk-ZO6KBU54.js} +1 -1
  112. package/dist/standalone/{chunk-5YEMXXQZ.js → chunk-ZQGRGSI7.js} +1 -1
  113. package/dist/standalone/studio.js +5 -5
  114. package/dist/styles.css +1 -1
  115. package/package.json +4 -4
  116. package/dist/packem_shared/StudioApp-DKBDIF7N.mjs +0 -1
  117. package/dist/standalone/chunk-C57KLL4U.js +0 -1
  118. package/dist/standalone/chunk-G4H5DPO6.js +0 -33
  119. package/dist/standalone/chunk-GATWEWRW.js +0 -1
  120. package/dist/standalone/chunk-HQJXQWJM.js +0 -1
  121. package/dist/standalone/chunk-JSVT5VBU.js +0 -1
  122. package/dist/standalone/chunk-KQ6YQP3Z.js +0 -1
  123. package/dist/standalone/chunk-OZUPOUHR.js +0 -1
  124. package/dist/standalone/chunk-PLCYDHU3.js +0 -7
  125. package/dist/standalone/chunk-UG6ZNYWH.js +0 -167
  126. package/dist/standalone/chunk-ZUFBUWT4.js +0 -1
@@ -1 +1 @@
1
- import{a as ee}from"./chunk-2KTN53PK.js";import{a as Z}from"./chunk-YC3TUO5H.js";import{b as Y}from"./chunk-EDL46BPM.js";import{a as X}from"./chunk-DA2CAFXI.js";import{a as W}from"./chunk-M6WDFEUZ.js";import"./chunk-4KPATTV6.js";import{i as D}from"./chunk-2ZNMZPPZ.js";import"./chunk-F4NZZ3LK.js";import"./chunk-SQO3WGXH.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import{b as ae,c as ne}from"./chunk-HXWW3XML.js";import{a as j,b as te}from"./chunk-RIRXDYLA.js";import{a as V}from"./chunk-ECXQQPVU.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import"./chunk-UB6S6VYI.js";import"./chunk-DMQVY5L7.js";import"./chunk-4OWWWAMB.js";import"./chunk-5XQM44J7.js";import"./chunk-WVAWKCNQ.js";import"./chunk-VND72OIC.js";import"./chunk-VLQU4G6O.js";import"./chunk-EOFWXI3T.js";import{a as I}from"./chunk-LYVYUTQY.js";import{c as A}from"./chunk-LUHBGCMO.js";import"./chunk-VUMS4VIV.js";import{n as Q}from"./chunk-PLCYDHU3.js";import"./chunk-WY23EROJ.js";import{B as q,h as M,i as C,o as G,s as N}from"./chunk-G4H5DPO6.js";import"./chunk-JSVT5VBU.js";import{a as me}from"./chunk-A6TVTNKO.js";import{a as he,b as pe}from"./chunk-ADABTCDI.js";import{a as l,d as _}from"./chunk-5PEAXTYQ.js";var E=_(me(),1);var c=_(he(),1);var S=_(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:n}=t;if(typeof n!="string"||n.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:r}=e;return!Array.isArray(a)||a.length===0||a.some(i=>typeof i!="string"||i.length===0)?!1:typeof r=="string"&&r.length>0},"xe"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(n=>JSON.stringify(n)).join(", ")}])`,"ge"),xe=l(t=>{let e=(0,E.c)(19),{fields:n,indexName:a,table:r,testId:i}=t,u=q(),[h,f]=(0,c.useState)(null),m;e[0]!==n||e[1]!==a?(m=l(()=>{let b=be(a,n),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=n,e[1]=a,e[2]=m):m=e[2];let y=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==r||e[7]!==i?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${i}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:r})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${i}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:r}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=r,e[7]=i,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==r?(p=u("Copy index declaration for {table}",{table:r}),e[11]=u,e[12]=r,e[13]=p):p=e[13];let w;return e[14]!==y||e[15]!==T||e[16]!==p||e[17]!==i?(w=(0,S.jsx)(W,{confirmLabel:T,onConfirm:y,testId:i,children:p}),e[14]=y,e[15]=T,e[16]=p,e[17]=i,e[18]=w):w=e[18],w},"ve"),ye=l((t,e)=>{let n=new Map;for(let a of e){let r=`${a.table} ${a.index}`;n.set(r,(n.get(r)??0)+a.reads)}return t.map(a=>({index:a.index,reads:n.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let n of t)for(let a of n.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([n,a])=>({scans:a,table:n}))},"Te"),re=l((t,e)=>e.filter(n=>n.type!=="vector"&&n.unique!==!0).map(n=>({index:n.name,table:t})),"P"),we=l(t=>{let e=ye(t.declaredIndexes??[],t.indexHits??[]),n=ve(t.functions??[]),a=t.shardTraffic??[],r=t.analyticsMetrics,i=r&&r.indexHits.length>0?r.indexHits:e,u=r&&r.tableScans.length>0?r.tableScans:n,h=r&&r.shardTraffic.length>0?r.shardTraffic:a,f=ne({indexHits:i,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(y=>!(y.metadata.kind==="hot_scan"&&typeof y.metadata.table=="string"&&m.has(y.metadata.table)))).map(y=>j(y))},"we"),Se=M(I.listTables),Te=M(I.listTableIndexes),Ie=M(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"H"),se=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),ie=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:se(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:se(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:G(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:n,table:a}=t,r=q(),i;e[0]!==n||e[1]!==a?(i=l(()=>{n(a)},"o"),e[0]=n,e[1]=a,e[2]=i):i=e[2];let u=i,h=`in-add-index-${a}`,f;e[3]!==r||e[4]!==a?(f=r("Add index on {table}",{table:a}),e[3]=r,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(V,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let n=Q(),a=D(),r=q(),{queryShardKey:i,setShardKey:u,shardKey:h}=ee(t),[f,m]=(0,c.useState)(null),[y,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=A(I.getMetrics,{},{live:!0,shardKey:i}),b=A(I.getFunctionStats,{},{live:!0,shardKey:i}),$=A(I.getAdvisories,{},{live:!0,shardKey:i}),L=w.data??null,K=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(s=>n.shardTraffic(s)),le=l(async(s,x)=>{let o=s[0];if(o===void 0||o===""){p.current===x&&T(null);return}try{let g=await oe(o);if(p.current!==x)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===x&&T(null)}},"Y"),de=l(async(s,x)=>{let o=await Promise.allSettled(s.map(async d=>[d,await n.query(Te,{table:d},C(x))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...re(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async s=>{p.current=s;let x=[];try{let o=await n.query(Se,{},C(s));if(p.current!==s)return;Y(s),x=o.map(d=>d.name);let g=[];if(x.length>0)try{let d=await n.query(Ie,{tables:x},C(s));if(p.current!==s)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...re(v,k))}catch{if(g=await de(x,s),p.current!==s)return}m(g)}catch{p.current===s&&m(null)}await le(x,s)});(0,c.useEffect)(()=>{N(z(i))},[i]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(i))});(0,c.useEffect)(()=>{let s=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s)}},[]);let U=(0,c.useCallback)(s=>{N(a({search:{table:s},to:"/schema"}))},[a]),H=(0,c.useMemo)(()=>X(L,K),[K,L]),P=(0,c.useMemo)(()=>new Set(H.filter(s=>s.kind==="missing-index").flatMap(s=>s.tables??[])),[H]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:K,indexHits:J,shardTraffic:y,suppressHotScanTables:P}),[f,K,J,P,y]),ue=(0,c.useMemo)(()=>{let s=H.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?ie(r,o):`${ie(r,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(r,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),x=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=j(o);if(x.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(xe,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...s]},[F,H,U,R,r]),fe=(0,S.jsx)(Z,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(te,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,shardKey:i,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
1
+ import{a as ee}from"./chunk-2KTN53PK.js";import{a as Z}from"./chunk-3WPPFTDC.js";import{b as Y}from"./chunk-EDL46BPM.js";import{a as X}from"./chunk-DA2CAFXI.js";import{a as W}from"./chunk-B65U64C3.js";import"./chunk-4KPATTV6.js";import{i as D}from"./chunk-JGSHDQGZ.js";import"./chunk-YYRXX5Z4.js";import"./chunk-4L2BABMS.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import{b as ae,c as ne}from"./chunk-FGAXBLHE.js";import{a as j,b as te}from"./chunk-PIFKJ3ES.js";import{a as V}from"./chunk-LTWCT32V.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import"./chunk-STKYARMP.js";import"./chunk-DMQVY5L7.js";import"./chunk-OGRACGHY.js";import"./chunk-IGSYGAHI.js";import"./chunk-H4NGBPG2.js";import"./chunk-YUENB45T.js";import"./chunk-AL5S7LVU.js";import"./chunk-EOFWXI3T.js";import{a as I}from"./chunk-LYVYUTQY.js";import{c as A}from"./chunk-U7U4ADXH.js";import"./chunk-ZBAR562M.js";import{n as Q}from"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B as q,h as M,i as C,o as G,s as N}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import{a as me}from"./chunk-A6TVTNKO.js";import{a as he,b as pe}from"./chunk-ADABTCDI.js";import{a as l,d as _}from"./chunk-5PEAXTYQ.js";var E=_(me(),1);var c=_(he(),1);var S=_(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:n}=t;if(typeof n!="string"||n.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:r}=e;return!Array.isArray(a)||a.length===0||a.some(i=>typeof i!="string"||i.length===0)?!1:typeof r=="string"&&r.length>0},"xe"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(n=>JSON.stringify(n)).join(", ")}])`,"ge"),xe=l(t=>{let e=(0,E.c)(19),{fields:n,indexName:a,table:r,testId:i}=t,u=q(),[h,f]=(0,c.useState)(null),m;e[0]!==n||e[1]!==a?(m=l(()=>{let b=be(a,n),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=n,e[1]=a,e[2]=m):m=e[2];let y=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==r||e[7]!==i?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${i}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:r})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${i}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:r}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=r,e[7]=i,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==r?(p=u("Copy index declaration for {table}",{table:r}),e[11]=u,e[12]=r,e[13]=p):p=e[13];let w;return e[14]!==y||e[15]!==T||e[16]!==p||e[17]!==i?(w=(0,S.jsx)(W,{confirmLabel:T,onConfirm:y,testId:i,children:p}),e[14]=y,e[15]=T,e[16]=p,e[17]=i,e[18]=w):w=e[18],w},"ve"),ye=l((t,e)=>{let n=new Map;for(let a of e){let r=`${a.table} ${a.index}`;n.set(r,(n.get(r)??0)+a.reads)}return t.map(a=>({index:a.index,reads:n.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let n of t)for(let a of n.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([n,a])=>({scans:a,table:n}))},"Te"),re=l((t,e)=>e.filter(n=>n.type!=="vector"&&n.unique!==!0).map(n=>({index:n.name,table:t})),"P"),we=l(t=>{let e=ye(t.declaredIndexes??[],t.indexHits??[]),n=ve(t.functions??[]),a=t.shardTraffic??[],r=t.analyticsMetrics,i=r&&r.indexHits.length>0?r.indexHits:e,u=r&&r.tableScans.length>0?r.tableScans:n,h=r&&r.shardTraffic.length>0?r.shardTraffic:a,f=ne({indexHits:i,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(y=>!(y.metadata.kind==="hot_scan"&&typeof y.metadata.table=="string"&&m.has(y.metadata.table)))).map(y=>j(y))},"we"),Se=M(I.listTables),Te=M(I.listTableIndexes),Ie=M(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"H"),se=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),ie=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:se(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:se(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:G(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:n,table:a}=t,r=q(),i;e[0]!==n||e[1]!==a?(i=l(()=>{n(a)},"o"),e[0]=n,e[1]=a,e[2]=i):i=e[2];let u=i,h=`in-add-index-${a}`,f;e[3]!==r||e[4]!==a?(f=r("Add index on {table}",{table:a}),e[3]=r,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(V,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let n=Q(),a=D(),r=q(),{queryShardKey:i,setShardKey:u,shardKey:h}=ee(t),[f,m]=(0,c.useState)(null),[y,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=A(I.getMetrics,{},{live:!0,shardKey:i}),b=A(I.getFunctionStats,{},{live:!0,shardKey:i}),$=A(I.getAdvisories,{},{live:!0,shardKey:i}),L=w.data??null,K=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(s=>n.shardTraffic(s)),le=l(async(s,x)=>{let o=s[0];if(o===void 0||o===""){p.current===x&&T(null);return}try{let g=await oe(o);if(p.current!==x)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===x&&T(null)}},"Y"),de=l(async(s,x)=>{let o=await Promise.allSettled(s.map(async d=>[d,await n.query(Te,{table:d},C(x))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...re(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async s=>{p.current=s;let x=[];try{let o=await n.query(Se,{},C(s));if(p.current!==s)return;Y(s),x=o.map(d=>d.name);let g=[];if(x.length>0)try{let d=await n.query(Ie,{tables:x},C(s));if(p.current!==s)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...re(v,k))}catch{if(g=await de(x,s),p.current!==s)return}m(g)}catch{p.current===s&&m(null)}await le(x,s)});(0,c.useEffect)(()=>{N(z(i))},[i]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(i))});(0,c.useEffect)(()=>{let s=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s)}},[]);let U=(0,c.useCallback)(s=>{N(a({search:{table:s},to:"/schema"}))},[a]),H=(0,c.useMemo)(()=>X(L,K),[K,L]),P=(0,c.useMemo)(()=>new Set(H.filter(s=>s.kind==="missing-index").flatMap(s=>s.tables??[])),[H]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:K,indexHits:J,shardTraffic:y,suppressHotScanTables:P}),[f,K,J,P,y]),ue=(0,c.useMemo)(()=>{let s=H.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?ie(r,o):`${ie(r,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(r,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),x=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=j(o);if(x.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(xe,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...s]},[F,H,U,R,r]),fe=(0,S.jsx)(Z,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(te,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,shardKey:i,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
@@ -1 +1 @@
1
- import{a as de}from"./chunk-ECXQQPVU.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import{a as ee}from"./chunk-V5ZKAZR6.js";import{b as Z}from"./chunk-UB6S6VYI.js";import"./chunk-DMQVY5L7.js";import{a as te}from"./chunk-4OWWWAMB.js";import"./chunk-5XQM44J7.js";import{a as ne,b as oe,c as ce,d as re,e as O,f as S}from"./chunk-WVAWKCNQ.js";import"./chunk-VND72OIC.js";import"./chunk-VLQU4G6O.js";import"./chunk-EOFWXI3T.js";import"./chunk-LYVYUTQY.js";import"./chunk-LUHBGCMO.js";import{h as se,i as ie,j as le}from"./chunk-PLCYDHU3.js";import"./chunk-WY23EROJ.js";import{B as Y,w as X,x as ae}from"./chunk-G4H5DPO6.js";import"./chunk-JSVT5VBU.js";import{a as me}from"./chunk-A6TVTNKO.js";import{a as ve,b as pe}from"./chunk-ADABTCDI.js";import{a as c,d as $}from"./chunk-5PEAXTYQ.js";var _=$(me(),1);var ue=$(ve(),1);var s=$(pe(),1);var ye=new Set(["cancelled","completed","expired","restored"]),fe=c(i=>ye.has(i),"fe"),he=c(i=>i.extendedDueAt??i.dueAt,"me"),xe=c(i=>!fe(i)&&i!=="ready","ve"),ge=c((i,e)=>xe(i.status)&&e.getTime()>he(i).getTime(),"pe"),qe=c((i,e)=>ge({dueAt:new Date(i.dueAt),status:i.status,...i.extendedDueAt===void 0||i.extendedDueAt===null?{}:{extendedDueAt:new Date(i.extendedDueAt)}},new Date(e)),"ye"),Ae=["studio","privacy-requests"],De={cancelled:"outline",completed:"success",expired:"outline",failed:"destructive",grace:"secondary",processing:"warning",ready:"success",received:"info",restored:"outline"},be=c(i=>X(i??void 0,"\u2014"),"Ae"),Pe=c(i=>{let e=(0,_.c)(55),{asOf:u,retrying:t,row:r,onRetry:b}=i,d=Y(),n,o,I;e[0]!==u||e[1]!==r?(o=qe(r,u),n=re,I=ae(o&&"bg-destructive/5"),e[0]=u,e[1]=r,e[2]=n,e[3]=o,e[4]=I):(n=e[2],o=e[3],I=e[4]);let N=o?"true":"false",v;e[5]!==r.id?(v=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.id}),e[5]=r.id,e[6]=v):v=e[6];let m;e[7]!==r.type||e[8]!==d?(m=r.type==="export"?d("Export"):d("Erasure"),e[7]=r.type,e[8]=d,e[9]=m):m=e[9];let E;e[10]!==m?(E=(0,s.jsx)(S,{children:(0,s.jsx)(Z,{variant:"secondary",children:m})}),e[10]=m,e[11]=E):E=e[11];let a;e[12]!==r.subjectId?(a=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.subjectId}),e[12]=r.subjectId,e[13]=a):a=e[13];let T=De[r.status],P;e[14]!==r.status||e[15]!==T?(P=(0,s.jsx)(S,{children:(0,s.jsx)(Z,{variant:T,children:r.status})}),e[14]=r.status,e[15]=T,e[16]=P):P=e[16];let w;e[17]!==r.receivedAt?(w=X(r.receivedAt),e[17]=r.receivedAt,e[18]=w):w=e[18];let R;e[19]!==w?(R=(0,s.jsx)(S,{children:w}),e[19]=w,e[20]=R):R=e[20];let p;e[21]!==r.dueAt?(p=X(r.dueAt),e[21]=r.dueAt,e[22]=p):p=e[22];let y;e[23]!==p?(y=(0,s.jsx)(S,{children:p}),e[23]=p,e[24]=y):y=e[24];let f;e[25]!==r.extendedDueAt?(f=be(r.extendedDueAt),e[25]=r.extendedDueAt,e[26]=f):f=e[26];let h;e[27]!==f?(h=(0,s.jsx)(S,{children:f}),e[27]=f,e[28]=h):h=e[28];let x;e[29]!==o||e[30]!==d?(x=o&&(0,s.jsx)(Z,{"data-testid":"privacy-overdue",variant:"destructive",children:d("Overdue")}),e[29]=o,e[30]=d,e[31]=x):x=e[31];let g;e[32]!==x?(g=(0,s.jsx)(S,{children:x}),e[32]=x,e[33]=g):g=e[33];let q;e[34]!==b||e[35]!==t||e[36]!==r.id||e[37]!==r.status||e[38]!==d?(q=r.status==="failed"&&(0,s.jsx)(de,{disabled:t,onClick:c(()=>{b(r.id)},"onClick"),size:"xs",variant:"outline",children:d("Retry")}),e[34]=b,e[35]=t,e[36]=r.id,e[37]=r.status,e[38]=d,e[39]=q):q=e[39];let A;e[40]!==q?(A=(0,s.jsx)(S,{children:q}),e[40]=q,e[41]=A):A=e[41];let j;return e[42]!==n||e[43]!==I||e[44]!==R||e[45]!==y||e[46]!==h||e[47]!==g||e[48]!==A||e[49]!==N||e[50]!==v||e[51]!==E||e[52]!==a||e[53]!==P?(j=(0,s.jsxs)(n,{className:I,"data-overdue":N,"data-testid":"privacy-request-row",children:[v,E,a,P,R,y,h,g,A]}),e[42]=n,e[43]=I,e[44]=R,e[45]=y,e[46]=h,e[47]=g,e[48]=A,e[49]=N,e[50]=v,e[51]=E,e[52]=a,e[53]=P,e[54]=j):j=e[54],j},"ge"),we=c(i=>{let e=(0,_.c)(95),{source:u}=i,t=Y(),r=se(),b=(0,ue.useId)(),d;e[0]!==b?(d=[...Ae,b],e[0]=b,e[1]=d):d=e[1];let n=d,o;e[2]!==u?(o=c(async()=>({asOf:Date.now(),requests:await u.listOpenPrivacyRequests()}),"c"),e[2]=u,e[3]=o):o=e[3];let I;e[4]!==n||e[5]!==o?(I={queryKey:n,refetchInterval:6e4,queryFn:o,staleTime:0},e[4]=n,e[5]=o,e[6]=I):I=e[6];let N=ie(I),v;e[7]!==u?(v=c(l=>u.retryPrivacyRequest(l),"u"),e[7]=u,e[8]=v):v=e[8];let m;e[9]!==r||e[10]!==n?(m=c(async()=>{await r.invalidateQueries({queryKey:n})},"f"),e[9]=r,e[10]=n,e[11]=m):m=e[11];let E;e[12]!==v||e[13]!==m?(E={mutationFn:v,onSuccess:m},e[12]=v,e[13]=m,e[14]=E):E=e[14];let a=le(E),T;e[15]!==a?(T=c(l=>{a.mutate(l)},"N"),e[15]=a,e[16]=T):T=e[16];let P=T;if(N.isPending){let l;e[17]!==t?(l=t("Loading privacy requests\u2026"),e[17]=t,e[18]=l):l=e[18];let D;return e[19]!==l?(D=(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"privacy-requests-loading",role:"status",children:l}),e[19]=l,e[20]=D):D=e[20],D}if(N.isError){let l;return e[21]!==N.error?(l=(0,s.jsx)(te,{error:N.error,testId:"privacy-requests-error"}),e[21]=N.error,e[22]=l):l=e[22],l}let{asOf:w,requests:R}=N.data;if(R.length===0){let l;e[23]!==t?(l=t("No open privacy requests."),e[23]=t,e[24]=l):l=e[24];let D;return e[25]!==l?(D=(0,s.jsx)(ee,{testId:"privacy-requests-empty",title:l}),e[25]=l,e[26]=D):D=e[26],D}let p;e[27]!==a.error||e[28]!==a.isError?(p=a.isError&&(0,s.jsx)(te,{error:a.error,testId:"privacy-retry-error"}),e[27]=a.error,e[28]=a.isError,e[29]=p):p=e[29];let y;e[30]!==t?(y=t("ID"),e[30]=t,e[31]=y):y=e[31];let f;e[32]!==y?(f=(0,s.jsx)(O,{children:y}),e[32]=y,e[33]=f):f=e[33];let h;e[34]!==t?(h=t("Type"),e[34]=t,e[35]=h):h=e[35];let x;e[36]!==h?(x=(0,s.jsx)(O,{children:h}),e[36]=h,e[37]=x):x=e[37];let g;e[38]!==t?(g=t("Subject"),e[38]=t,e[39]=g):g=e[39];let q;e[40]!==g?(q=(0,s.jsx)(O,{children:g}),e[40]=g,e[41]=q):q=e[41];let A;e[42]!==t?(A=t("Status"),e[42]=t,e[43]=A):A=e[43];let j;e[44]!==A?(j=(0,s.jsx)(O,{children:A}),e[44]=A,e[45]=j):j=e[45];let B;e[46]!==t?(B=t("Received"),e[46]=t,e[47]=B):B=e[47];let Q;e[48]!==B?(Q=(0,s.jsx)(O,{children:B}),e[48]=B,e[49]=Q):Q=e[49];let C;e[50]!==t?(C=t("Due"),e[50]=t,e[51]=C):C=e[51];let F;e[52]!==C?(F=(0,s.jsx)(O,{children:C}),e[52]=C,e[53]=F):F=e[53];let K;e[54]!==t?(K=t("Extended due"),e[54]=t,e[55]=K):K=e[55];let k;e[56]!==K?(k=(0,s.jsx)(O,{children:K}),e[56]=K,e[57]=k):k=e[57];let z;e[58]!==t?(z=t("Overdue"),e[58]=t,e[59]=z):z=e[59];let L;e[60]!==z?(L=(0,s.jsx)(O,{children:z}),e[60]=z,e[61]=L):L=e[61];let M;e[62]!==t?(M=t("Actions"),e[62]=t,e[63]=M):M=e[63];let G;e[64]!==M?(G=(0,s.jsx)(O,{children:M}),e[64]=M,e[65]=G):G=e[65];let H;e[66]!==f||e[67]!==x||e[68]!==q||e[69]!==j||e[70]!==Q||e[71]!==F||e[72]!==k||e[73]!==L||e[74]!==G?(H=(0,s.jsx)(oe,{children:(0,s.jsxs)(re,{children:[f,x,q,j,Q,F,k,L,G]})}),e[66]=f,e[67]=x,e[68]=q,e[69]=j,e[70]=Q,e[71]=F,e[72]=k,e[73]=L,e[74]=G,e[75]=H):H=e[75];let J;if(e[76]!==w||e[77]!==P||e[78]!==R||e[79]!==a.isPending||e[80]!==a.variables){let l;e[82]!==w||e[83]!==P||e[84]!==a.isPending||e[85]!==a.variables?(l=c(D=>(0,s.jsx)(Pe,{asOf:w,onRetry:P,retrying:a.isPending&&a.variables===D.id,row:D},D.id),"l"),e[82]=w,e[83]=P,e[84]=a.isPending,e[85]=a.variables,e[86]=l):l=e[86],J=R.map(l),e[76]=w,e[77]=P,e[78]=R,e[79]=a.isPending,e[80]=a.variables,e[81]=J}else J=e[81];let U;e[87]!==J?(U=(0,s.jsx)(ce,{children:J}),e[87]=J,e[88]=U):U=e[88];let V;e[89]!==H||e[90]!==U?(V=(0,s.jsxs)(ne,{children:[H,U]}),e[89]=H,e[90]=U,e[91]=V):V=e[91];let W;return e[92]!==V||e[93]!==p?(W=(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[p,V]}),e[92]=V,e[93]=p,e[94]=W):W=e[94],W},"Te"),Qe=c(i=>{let e=(0,_.c)(11),u;e[0]!==i?(u=i===void 0?{}:i,e[0]=i,e[1]=u):u=e[1];let{source:t}=u,r=Y();if(t===void 0){let d;e[2]!==r?(d=r("Pass privacyRequests to the Studio to list and retry data-subject requests."),e[2]=r,e[3]=d):d=e[3];let n;e[4]!==r?(n=r("Privacy requests not configured"),e[4]=r,e[5]=n):n=e[5];let o;return e[6]!==d||e[7]!==n?(o=(0,s.jsx)(ee,{description:d,testId:"privacy-requests-not-configured",title:n}),e[6]=d,e[7]=n,e[8]=o):o=e[8],o}let b;return e[9]!==t?(b=(0,s.jsx)(we,{source:t}),e[9]=t,e[10]=b):b=e[10],b},"Be");export{Qe as PrivacyRequestsPanel};
1
+ import{a as de}from"./chunk-LTWCT32V.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import{a as ee}from"./chunk-ZKEXJDGJ.js";import{b as Z}from"./chunk-STKYARMP.js";import"./chunk-DMQVY5L7.js";import{a as te}from"./chunk-OGRACGHY.js";import"./chunk-IGSYGAHI.js";import{a as ne,b as oe,c as ce,d as re,e as O,f as S}from"./chunk-H4NGBPG2.js";import"./chunk-YUENB45T.js";import"./chunk-AL5S7LVU.js";import"./chunk-EOFWXI3T.js";import"./chunk-LYVYUTQY.js";import"./chunk-U7U4ADXH.js";import{h as se,i as ie,j as le}from"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B as Y,w as X,x as ae}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import{a as me}from"./chunk-A6TVTNKO.js";import{a as ve,b as pe}from"./chunk-ADABTCDI.js";import{a as c,d as $}from"./chunk-5PEAXTYQ.js";var _=$(me(),1);var ue=$(ve(),1);var s=$(pe(),1);var ye=new Set(["cancelled","completed","expired","restored"]),fe=c(i=>ye.has(i),"fe"),he=c(i=>i.extendedDueAt??i.dueAt,"me"),xe=c(i=>!fe(i)&&i!=="ready","ve"),ge=c((i,e)=>xe(i.status)&&e.getTime()>he(i).getTime(),"pe"),qe=c((i,e)=>ge({dueAt:new Date(i.dueAt),status:i.status,...i.extendedDueAt===void 0||i.extendedDueAt===null?{}:{extendedDueAt:new Date(i.extendedDueAt)}},new Date(e)),"ye"),Ae=["studio","privacy-requests"],De={cancelled:"outline",completed:"success",expired:"outline",failed:"destructive",grace:"secondary",processing:"warning",ready:"success",received:"info",restored:"outline"},be=c(i=>X(i??void 0,"\u2014"),"Ae"),Pe=c(i=>{let e=(0,_.c)(55),{asOf:u,retrying:t,row:r,onRetry:b}=i,d=Y(),n,o,I;e[0]!==u||e[1]!==r?(o=qe(r,u),n=re,I=ae(o&&"bg-destructive/5"),e[0]=u,e[1]=r,e[2]=n,e[3]=o,e[4]=I):(n=e[2],o=e[3],I=e[4]);let N=o?"true":"false",v;e[5]!==r.id?(v=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.id}),e[5]=r.id,e[6]=v):v=e[6];let m;e[7]!==r.type||e[8]!==d?(m=r.type==="export"?d("Export"):d("Erasure"),e[7]=r.type,e[8]=d,e[9]=m):m=e[9];let E;e[10]!==m?(E=(0,s.jsx)(S,{children:(0,s.jsx)(Z,{variant:"secondary",children:m})}),e[10]=m,e[11]=E):E=e[11];let a;e[12]!==r.subjectId?(a=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.subjectId}),e[12]=r.subjectId,e[13]=a):a=e[13];let T=De[r.status],P;e[14]!==r.status||e[15]!==T?(P=(0,s.jsx)(S,{children:(0,s.jsx)(Z,{variant:T,children:r.status})}),e[14]=r.status,e[15]=T,e[16]=P):P=e[16];let w;e[17]!==r.receivedAt?(w=X(r.receivedAt),e[17]=r.receivedAt,e[18]=w):w=e[18];let R;e[19]!==w?(R=(0,s.jsx)(S,{children:w}),e[19]=w,e[20]=R):R=e[20];let p;e[21]!==r.dueAt?(p=X(r.dueAt),e[21]=r.dueAt,e[22]=p):p=e[22];let y;e[23]!==p?(y=(0,s.jsx)(S,{children:p}),e[23]=p,e[24]=y):y=e[24];let f;e[25]!==r.extendedDueAt?(f=be(r.extendedDueAt),e[25]=r.extendedDueAt,e[26]=f):f=e[26];let h;e[27]!==f?(h=(0,s.jsx)(S,{children:f}),e[27]=f,e[28]=h):h=e[28];let x;e[29]!==o||e[30]!==d?(x=o&&(0,s.jsx)(Z,{"data-testid":"privacy-overdue",variant:"destructive",children:d("Overdue")}),e[29]=o,e[30]=d,e[31]=x):x=e[31];let g;e[32]!==x?(g=(0,s.jsx)(S,{children:x}),e[32]=x,e[33]=g):g=e[33];let q;e[34]!==b||e[35]!==t||e[36]!==r.id||e[37]!==r.status||e[38]!==d?(q=r.status==="failed"&&(0,s.jsx)(de,{disabled:t,onClick:c(()=>{b(r.id)},"onClick"),size:"xs",variant:"outline",children:d("Retry")}),e[34]=b,e[35]=t,e[36]=r.id,e[37]=r.status,e[38]=d,e[39]=q):q=e[39];let A;e[40]!==q?(A=(0,s.jsx)(S,{children:q}),e[40]=q,e[41]=A):A=e[41];let j;return e[42]!==n||e[43]!==I||e[44]!==R||e[45]!==y||e[46]!==h||e[47]!==g||e[48]!==A||e[49]!==N||e[50]!==v||e[51]!==E||e[52]!==a||e[53]!==P?(j=(0,s.jsxs)(n,{className:I,"data-overdue":N,"data-testid":"privacy-request-row",children:[v,E,a,P,R,y,h,g,A]}),e[42]=n,e[43]=I,e[44]=R,e[45]=y,e[46]=h,e[47]=g,e[48]=A,e[49]=N,e[50]=v,e[51]=E,e[52]=a,e[53]=P,e[54]=j):j=e[54],j},"ge"),we=c(i=>{let e=(0,_.c)(95),{source:u}=i,t=Y(),r=se(),b=(0,ue.useId)(),d;e[0]!==b?(d=[...Ae,b],e[0]=b,e[1]=d):d=e[1];let n=d,o;e[2]!==u?(o=c(async()=>({asOf:Date.now(),requests:await u.listOpenPrivacyRequests()}),"c"),e[2]=u,e[3]=o):o=e[3];let I;e[4]!==n||e[5]!==o?(I={queryKey:n,refetchInterval:6e4,queryFn:o,staleTime:0},e[4]=n,e[5]=o,e[6]=I):I=e[6];let N=ie(I),v;e[7]!==u?(v=c(l=>u.retryPrivacyRequest(l),"u"),e[7]=u,e[8]=v):v=e[8];let m;e[9]!==r||e[10]!==n?(m=c(async()=>{await r.invalidateQueries({queryKey:n})},"f"),e[9]=r,e[10]=n,e[11]=m):m=e[11];let E;e[12]!==v||e[13]!==m?(E={mutationFn:v,onSuccess:m},e[12]=v,e[13]=m,e[14]=E):E=e[14];let a=le(E),T;e[15]!==a?(T=c(l=>{a.mutate(l)},"N"),e[15]=a,e[16]=T):T=e[16];let P=T;if(N.isPending){let l;e[17]!==t?(l=t("Loading privacy requests\u2026"),e[17]=t,e[18]=l):l=e[18];let D;return e[19]!==l?(D=(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"privacy-requests-loading",role:"status",children:l}),e[19]=l,e[20]=D):D=e[20],D}if(N.isError){let l;return e[21]!==N.error?(l=(0,s.jsx)(te,{error:N.error,testId:"privacy-requests-error"}),e[21]=N.error,e[22]=l):l=e[22],l}let{asOf:w,requests:R}=N.data;if(R.length===0){let l;e[23]!==t?(l=t("No open privacy requests."),e[23]=t,e[24]=l):l=e[24];let D;return e[25]!==l?(D=(0,s.jsx)(ee,{testId:"privacy-requests-empty",title:l}),e[25]=l,e[26]=D):D=e[26],D}let p;e[27]!==a.error||e[28]!==a.isError?(p=a.isError&&(0,s.jsx)(te,{error:a.error,testId:"privacy-retry-error"}),e[27]=a.error,e[28]=a.isError,e[29]=p):p=e[29];let y;e[30]!==t?(y=t("ID"),e[30]=t,e[31]=y):y=e[31];let f;e[32]!==y?(f=(0,s.jsx)(O,{children:y}),e[32]=y,e[33]=f):f=e[33];let h;e[34]!==t?(h=t("Type"),e[34]=t,e[35]=h):h=e[35];let x;e[36]!==h?(x=(0,s.jsx)(O,{children:h}),e[36]=h,e[37]=x):x=e[37];let g;e[38]!==t?(g=t("Subject"),e[38]=t,e[39]=g):g=e[39];let q;e[40]!==g?(q=(0,s.jsx)(O,{children:g}),e[40]=g,e[41]=q):q=e[41];let A;e[42]!==t?(A=t("Status"),e[42]=t,e[43]=A):A=e[43];let j;e[44]!==A?(j=(0,s.jsx)(O,{children:A}),e[44]=A,e[45]=j):j=e[45];let B;e[46]!==t?(B=t("Received"),e[46]=t,e[47]=B):B=e[47];let Q;e[48]!==B?(Q=(0,s.jsx)(O,{children:B}),e[48]=B,e[49]=Q):Q=e[49];let C;e[50]!==t?(C=t("Due"),e[50]=t,e[51]=C):C=e[51];let F;e[52]!==C?(F=(0,s.jsx)(O,{children:C}),e[52]=C,e[53]=F):F=e[53];let K;e[54]!==t?(K=t("Extended due"),e[54]=t,e[55]=K):K=e[55];let k;e[56]!==K?(k=(0,s.jsx)(O,{children:K}),e[56]=K,e[57]=k):k=e[57];let z;e[58]!==t?(z=t("Overdue"),e[58]=t,e[59]=z):z=e[59];let L;e[60]!==z?(L=(0,s.jsx)(O,{children:z}),e[60]=z,e[61]=L):L=e[61];let M;e[62]!==t?(M=t("Actions"),e[62]=t,e[63]=M):M=e[63];let G;e[64]!==M?(G=(0,s.jsx)(O,{children:M}),e[64]=M,e[65]=G):G=e[65];let H;e[66]!==f||e[67]!==x||e[68]!==q||e[69]!==j||e[70]!==Q||e[71]!==F||e[72]!==k||e[73]!==L||e[74]!==G?(H=(0,s.jsx)(oe,{children:(0,s.jsxs)(re,{children:[f,x,q,j,Q,F,k,L,G]})}),e[66]=f,e[67]=x,e[68]=q,e[69]=j,e[70]=Q,e[71]=F,e[72]=k,e[73]=L,e[74]=G,e[75]=H):H=e[75];let J;if(e[76]!==w||e[77]!==P||e[78]!==R||e[79]!==a.isPending||e[80]!==a.variables){let l;e[82]!==w||e[83]!==P||e[84]!==a.isPending||e[85]!==a.variables?(l=c(D=>(0,s.jsx)(Pe,{asOf:w,onRetry:P,retrying:a.isPending&&a.variables===D.id,row:D},D.id),"l"),e[82]=w,e[83]=P,e[84]=a.isPending,e[85]=a.variables,e[86]=l):l=e[86],J=R.map(l),e[76]=w,e[77]=P,e[78]=R,e[79]=a.isPending,e[80]=a.variables,e[81]=J}else J=e[81];let U;e[87]!==J?(U=(0,s.jsx)(ce,{children:J}),e[87]=J,e[88]=U):U=e[88];let V;e[89]!==H||e[90]!==U?(V=(0,s.jsxs)(ne,{children:[H,U]}),e[89]=H,e[90]=U,e[91]=V):V=e[91];let W;return e[92]!==V||e[93]!==p?(W=(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[p,V]}),e[92]=V,e[93]=p,e[94]=W):W=e[94],W},"Te"),Qe=c(i=>{let e=(0,_.c)(11),u;e[0]!==i?(u=i===void 0?{}:i,e[0]=i,e[1]=u):u=e[1];let{source:t}=u,r=Y();if(t===void 0){let d;e[2]!==r?(d=r("Pass privacyRequests to the Studio to list and retry data-subject requests."),e[2]=r,e[3]=d):d=e[3];let n;e[4]!==r?(n=r("Privacy requests not configured"),e[4]=r,e[5]=n):n=e[5];let o;return e[6]!==d||e[7]!==n?(o=(0,s.jsx)(ee,{description:d,testId:"privacy-requests-not-configured",title:n}),e[6]=d,e[7]=n,e[8]=o):o=e[8],o}let b;return e[9]!==t?(b=(0,s.jsx)(we,{source:t}),e[9]=t,e[10]=b):b=e[10],b},"Be");export{Qe as PrivacyRequestsPanel};
@@ -1,4 +1,4 @@
1
- import{a as nt,b as ot}from"./chunk-5YEMXXQZ.js";import"./chunk-VEG327ST.js";import"./chunk-WARWYT4K.js";import{d as tt}from"./chunk-HLN47VMG.js";import"./chunk-3GBBYV7C.js";import{a as Ae}from"./chunk-CVSIFPI5.js";import{a as Ze}from"./chunk-CBFVQCWS.js";import"./chunk-Y2YLTUMD.js";import"./chunk-JXW6H6LE.js";import"./chunk-SOESES7K.js";import"./chunk-YWGOETFP.js";import"./chunk-6KIDLGYM.js";import{a as et}from"./chunk-DRHZZ7IN.js";import"./chunk-GATWEWRW.js";import"./chunk-ZUFBUWT4.js";import"./chunk-HXFXD5EP.js";import"./chunk-EUNTXABP.js";import"./chunk-2NUCBQFU.js";import"./chunk-B5YCFPYG.js";import{a as Ye}from"./chunk-YC3TUO5H.js";import{b as Ve}from"./chunk-EDL46BPM.js";import"./chunk-M6WDFEUZ.js";import{c as Xe,d as we,e as Ne,f as Ee,g as Me}from"./chunk-4KPATTV6.js";import"./chunk-F4NZZ3LK.js";import{j as ye}from"./chunk-SQO3WGXH.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import"./chunk-ECXQQPVU.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import"./chunk-DMQVY5L7.js";import{a as Je}from"./chunk-5XQM44J7.js";import"./chunk-WVAWKCNQ.js";import{b as Ge}from"./chunk-VLQU4G6O.js";import{a as ve}from"./chunk-LYVYUTQY.js";import"./chunk-LUHBGCMO.js";import{n as Ce}from"./chunk-PLCYDHU3.js";import"./chunk-WY23EROJ.js";import{B as J,h as ge,i as xe,j as Ke,r as Ue,s as le,x as ie}from"./chunk-G4H5DPO6.js";import"./chunk-JSVT5VBU.js";import{a as Et}from"./chunk-A6TVTNKO.js";import{a as Nt,b as Lt}from"./chunk-ADABTCDI.js";import{a as d,d as De}from"./chunk-5PEAXTYQ.js";var V=De(Et(),1),j=De(Nt(),1);var u=De(Lt(),1);var Se=class{static{d(this,"Diff")}diff(e,n,t={}){let o;typeof t=="function"?(o=t,t={}):"callback"in t&&(o=t.callback);let r=this.castInput(e,t),l=this.castInput(n,t),i=this.removeEmpty(this.tokenize(r,t)),a=this.removeEmpty(this.tokenize(l,t));return this.diffWithOptionsObj(i,a,t,o)}diffWithOptionsObj(e,n,t,o){var r;let l=d(h=>{if(h=this.postProcess(h,t),o){setTimeout(function(){o(h)},0);return}else return h},"done"),i=n.length,a=e.length,c=1,m=i+a;t.maxEditLength!=null&&(m=Math.min(m,t.maxEditLength));let p=(r=t.timeout)!==null&&r!==void 0?r:1/0,f=Date.now()+p,b=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(b[0],n,e,0,t);if(b[0].oldPos+1>=a&&g+1>=i)return l(this.buildValues(b[0].lastComponent,n,e));let k=-1/0,q=1/0,N=d(()=>{for(let h=Math.max(k,-c);h<=Math.min(q,c);h+=2){let S,x=b[h-1],v=b[h+1];x&&(b[h-1]=void 0);let y=!1;if(v){let E=v.oldPos-h;y=v&&0<=E&&E<i}let w=x&&x.oldPos+1<a;if(!y&&!w){b[h]=void 0;continue}if(!w||y&&x.oldPos<v.oldPos?S=this.addToPath(v,!0,!1,0,t):S=this.addToPath(x,!1,!0,1,t),g=this.extractCommon(S,n,e,h,t),S.oldPos+1>=a&&g+1>=i)return l(this.buildValues(S.lastComponent,n,e))||!0;b[h]=S,S.oldPos+1>=a&&(q=Math.min(q,h-1)),g+1>=i&&(k=Math.max(k,h+1))}c++},"execEditLength");if(o)d(function h(){setTimeout(function(){if(c>m||Date.now()>f)return o(void 0);N()||h()},0)},"exec")();else for(;c<=m&&Date.now()<=f;){let h=N();if(h)return h}}addToPath(e,n,t,o,r){let l=e.lastComponent;return l&&!r.oneChangePerToken&&l.added===n&&l.removed===t?{oldPos:e.oldPos+o,lastComponent:{count:l.count+1,added:n,removed:t,previousComponent:l.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:t,previousComponent:l}}}extractCommon(e,n,t,o,r){let l=n.length,i=t.length,a=e.oldPos,c=a-o,m=0;for(;c+1<l&&a+1<i&&this.equals(t[a+1],n[c+1],r);)c++,a++,m++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return m&&!r.oneChangePerToken&&(e.lastComponent={count:m,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,c}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){let n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){let o=[],r;for(;e;)o.push(e),r=e.previousComponent,delete e.previousComponent,e=r;o.reverse();let l=o.length,i=0,a=0,c=0;for(;i<l;i++){let m=o[i];if(m.removed)m.value=this.join(t.slice(c,c+m.count)),c+=m.count;else{if(!m.added&&this.useLongestToken){let p=n.slice(a,a+m.count);p=p.map(function(f,b){let g=t[c+b];return g.length>f.length?g:f}),m.value=this.join(p)}else m.value=this.join(n.slice(a,a+m.count));a+=m.count,m.added||(c+=m.count)}}return o}};var $e=class extends Se{static{d(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=_t}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
1
+ import{a as nt,b as ot}from"./chunk-ZQGRGSI7.js";import"./chunk-YNO5YLZT.js";import"./chunk-JCHZNPJU.js";import{d as tt}from"./chunk-TWOO3G2Q.js";import"./chunk-6OE7TT2Y.js";import{a as Ae}from"./chunk-CVSIFPI5.js";import{a as Ze}from"./chunk-REZHNEUN.js";import"./chunk-Y2YLTUMD.js";import"./chunk-6CVUGL2K.js";import"./chunk-SOESES7K.js";import"./chunk-YWGOETFP.js";import"./chunk-6KIDLGYM.js";import{a as et}from"./chunk-DRHZZ7IN.js";import"./chunk-6MAIN66N.js";import"./chunk-YIZDDGWA.js";import"./chunk-HXFXD5EP.js";import"./chunk-EUNTXABP.js";import"./chunk-2NUCBQFU.js";import"./chunk-B5YCFPYG.js";import{a as Ye}from"./chunk-3WPPFTDC.js";import{b as Ve}from"./chunk-EDL46BPM.js";import"./chunk-B65U64C3.js";import{c as Xe,d as we,e as Ne,f as Ee,g as Me}from"./chunk-4KPATTV6.js";import"./chunk-YYRXX5Z4.js";import{j as ye}from"./chunk-4L2BABMS.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import"./chunk-LTWCT32V.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import"./chunk-DMQVY5L7.js";import{a as Je}from"./chunk-IGSYGAHI.js";import"./chunk-H4NGBPG2.js";import{b as Ge}from"./chunk-AL5S7LVU.js";import{a as ve}from"./chunk-LYVYUTQY.js";import"./chunk-U7U4ADXH.js";import{n as Ce}from"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B as J,h as ge,i as xe,j as Ke,r as Ue,s as le,x as ie}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import{a as Et}from"./chunk-A6TVTNKO.js";import{a as Nt,b as Lt}from"./chunk-ADABTCDI.js";import{a as d,d as De}from"./chunk-5PEAXTYQ.js";var V=De(Et(),1),j=De(Nt(),1);var u=De(Lt(),1);var Se=class{static{d(this,"Diff")}diff(e,n,t={}){let o;typeof t=="function"?(o=t,t={}):"callback"in t&&(o=t.callback);let r=this.castInput(e,t),l=this.castInput(n,t),i=this.removeEmpty(this.tokenize(r,t)),a=this.removeEmpty(this.tokenize(l,t));return this.diffWithOptionsObj(i,a,t,o)}diffWithOptionsObj(e,n,t,o){var r;let l=d(h=>{if(h=this.postProcess(h,t),o){setTimeout(function(){o(h)},0);return}else return h},"done"),i=n.length,a=e.length,c=1,m=i+a;t.maxEditLength!=null&&(m=Math.min(m,t.maxEditLength));let p=(r=t.timeout)!==null&&r!==void 0?r:1/0,f=Date.now()+p,b=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(b[0],n,e,0,t);if(b[0].oldPos+1>=a&&g+1>=i)return l(this.buildValues(b[0].lastComponent,n,e));let k=-1/0,q=1/0,N=d(()=>{for(let h=Math.max(k,-c);h<=Math.min(q,c);h+=2){let S,x=b[h-1],v=b[h+1];x&&(b[h-1]=void 0);let y=!1;if(v){let E=v.oldPos-h;y=v&&0<=E&&E<i}let w=x&&x.oldPos+1<a;if(!y&&!w){b[h]=void 0;continue}if(!w||y&&x.oldPos<v.oldPos?S=this.addToPath(v,!0,!1,0,t):S=this.addToPath(x,!1,!0,1,t),g=this.extractCommon(S,n,e,h,t),S.oldPos+1>=a&&g+1>=i)return l(this.buildValues(S.lastComponent,n,e))||!0;b[h]=S,S.oldPos+1>=a&&(q=Math.min(q,h-1)),g+1>=i&&(k=Math.max(k,h+1))}c++},"execEditLength");if(o)d(function h(){setTimeout(function(){if(c>m||Date.now()>f)return o(void 0);N()||h()},0)},"exec")();else for(;c<=m&&Date.now()<=f;){let h=N();if(h)return h}}addToPath(e,n,t,o,r){let l=e.lastComponent;return l&&!r.oneChangePerToken&&l.added===n&&l.removed===t?{oldPos:e.oldPos+o,lastComponent:{count:l.count+1,added:n,removed:t,previousComponent:l.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:t,previousComponent:l}}}extractCommon(e,n,t,o,r){let l=n.length,i=t.length,a=e.oldPos,c=a-o,m=0;for(;c+1<l&&a+1<i&&this.equals(t[a+1],n[c+1],r);)c++,a++,m++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return m&&!r.oneChangePerToken&&(e.lastComponent={count:m,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,c}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){let n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){let o=[],r;for(;e;)o.push(e),r=e.previousComponent,delete e.previousComponent,e=r;o.reverse();let l=o.length,i=0,a=0,c=0;for(;i<l;i++){let m=o[i];if(m.removed)m.value=this.join(t.slice(c,c+m.count)),c+=m.count;else{if(!m.added&&this.useLongestToken){let p=n.slice(a,a+m.count);p=p.map(function(f,b){let g=t[c+b];return g.length>f.length?g:f}),m.value=this.join(p)}else m.value=this.join(n.slice(a,a+m.count));a+=m.count,m.added||(c+=m.count)}}return o}};var $e=class extends Se{static{d(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=_t}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
2
2
  `))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
3
3
  `))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
4
4
  `)&&(e=e.slice(0,-1)),n.endsWith(`
@@ -1 +1 @@
1
- import{a as D}from"./chunk-BCT3KY76.js";import{a as L}from"./chunk-V5ZKAZR6.js";import{b as S}from"./chunk-UB6S6VYI.js";import"./chunk-DMQVY5L7.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-WVAWKCNQ.js";import"./chunk-EOFWXI3T.js";import{a as C}from"./chunk-LYVYUTQY.js";import{c as w}from"./chunk-LUHBGCMO.js";import{a as I,e as $}from"./chunk-VUMS4VIV.js";import"./chunk-PLCYDHU3.js";import"./chunk-WY23EROJ.js";import{B as b}from"./chunk-G4H5DPO6.js";import"./chunk-JSVT5VBU.js";import{a as _}from"./chunk-A6TVTNKO.js";import{b as j}from"./chunk-ADABTCDI.js";import{a as f,d as y}from"./chunk-5PEAXTYQ.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=b(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=w(C.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(L,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(I,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(S,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};
1
+ import{a as D}from"./chunk-4FTKFUPJ.js";import{a as L}from"./chunk-ZKEXJDGJ.js";import{b as S}from"./chunk-STKYARMP.js";import"./chunk-DMQVY5L7.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-H4NGBPG2.js";import"./chunk-EOFWXI3T.js";import{a as C}from"./chunk-LYVYUTQY.js";import{c as w}from"./chunk-U7U4ADXH.js";import{a as I,e as $}from"./chunk-ZBAR562M.js";import"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B as b}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import{a as _}from"./chunk-A6TVTNKO.js";import{b as j}from"./chunk-ADABTCDI.js";import{a as f,d as y}from"./chunk-5PEAXTYQ.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=b(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=w(C.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(L,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(I,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(S,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};
@@ -1 +1 @@
1
- import{a as $e}from"./chunk-CBFVQCWS.js";import{g as Le}from"./chunk-BMGMBZAW.js";import"./chunk-AFLNQEZ5.js";import"./chunk-HE2XT2P7.js";import"./chunk-CL3JOU6F.js";import{a as ae}from"./chunk-BUYKTV27.js";import"./chunk-GATWEWRW.js";import"./chunk-ZUFBUWT4.js";import"./chunk-HXFXD5EP.js";import"./chunk-EUNTXABP.js";import"./chunk-7XZENNML.js";import"./chunk-2NUCBQFU.js";import{a as ge}from"./chunk-2KTN53PK.js";import{a as be}from"./chunk-YC3TUO5H.js";import"./chunk-EDL46BPM.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-M6WDFEUZ.js";import"./chunk-4KPATTV6.js";import"./chunk-2ZNMZPPZ.js";import"./chunk-F4NZZ3LK.js";import{j as Je}from"./chunk-SQO3WGXH.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import{a as ce}from"./chunk-ECXQQPVU.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import{a as se}from"./chunk-V5ZKAZR6.js";import{b as oe}from"./chunk-UB6S6VYI.js";import"./chunk-DMQVY5L7.js";import{a as ee,b as te,c as re,d as z,e as L,f as K}from"./chunk-WVAWKCNQ.js";import"./chunk-VLQU4G6O.js";import"./chunk-EOFWXI3T.js";import{a as me}from"./chunk-LYVYUTQY.js";import{b as ne,c as ve}from"./chunk-LUHBGCMO.js";import{a as Z,e as H}from"./chunk-VUMS4VIV.js";import{l as je,n as de}from"./chunk-PLCYDHU3.js";import"./chunk-WY23EROJ.js";import{B as V,h as fe,i as Ae,j as ie,k as xe,s as Y,w as le,x as Ie}from"./chunk-G4H5DPO6.js";import"./chunk-JSVT5VBU.js";import{a as Ce}from"./chunk-A6TVTNKO.js";import{a as we,b as Se}from"./chunk-ADABTCDI.js";import{a as y,d as he}from"./chunk-5PEAXTYQ.js";var G=he(Ce(),1),Q=he(we(),1);var t=he(Se(),1);var Fe=he(Ce(),1),pe=he(we(),1);var D=he(Se(),1);var Me=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","X"),Ke=y(r=>r.toSorted((e,o)=>e.scheduledFor-o.scheduledFor),"F"),Be=y((r,e,o)=>e!==void 0?e:o===void 0?n=>r.cancelScheduledJob(n):void 0,"Y"),Te=y(r=>{let e=(0,Fe.c)(16),{cancelJob:o,loadJobs:n}=r===void 0?{}:r,l=de(),s=V(),a=n===void 0,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["lunora-scheduled-jobs"],e[0]=i):i=e[0];let c=ne(i,async()=>{let x=await(n??(()=>l.listScheduledJobs()))();return Ke(x)}),[N,p]=(0,pe.useState)(void 0),[h,m]=(0,pe.useState)(void 0),k,f;e[1]!==l||e[2]!==a?(k=y(()=>{if(a)return l.subscribeScheduledJobs(x=>{m(void 0),p(Ke(x))})},"v"),f=[a,l],e[1]=l,e[2]=a,e[3]=k,e[4]=f):(k=e[3],f=e[4]),(0,pe.useEffect)(k,f);let d;e[5]!==c?(d=y(()=>c.poll(),"y"),e[5]=c,e[6]=d):d=e[6],ae(d,!a);let u=Be(l,o,n),v=N??c.data,b=h??c.error,S=y(async x=>{if(u!==void 0){m(void 0);try{await u(x),a||c.refetch()}catch(A){m(ie(A))}}},"E"),I="flex flex-col gap-3",w="lunora-scheduled-jobs",C;e[7]!==b?(C=b!==null&&(0,D.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:b}),e[7]=b,e[8]=C):C=e[8];let J;e[9]!==v?.length||e[10]!==s?(J=v?.length===0&&(0,D.jsx)(se,{description:s("Jobs queued with runAfter / runAt will appear here."),icon:(0,D.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,D.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:s("No scheduled jobs.")}),e[9]=v?.length,e[10]=s,e[11]=J):J=e[11];let $=v!==void 0&&v.length>0&&(0,D.jsx)(Z,{className:"overflow-hidden py-0",children:(0,D.jsx)(H,{className:"px-0",children:(0,D.jsxs)(ee,{"data-testid":"sj-table",children:[(0,D.jsx)(te,{children:(0,D.jsxs)(z,{children:[(0,D.jsx)(L,{children:s("function")}),(0,D.jsx)(L,{children:s("scheduled for")}),(0,D.jsx)(L,{children:s("pool")}),(0,D.jsx)(L,{children:s("attempts")}),(0,D.jsx)(L,{children:s("shard")}),(0,D.jsx)(L,{children:s("id")}),u!==void 0&&(0,D.jsx)(L,{"aria-label":s("Actions")})]})}),(0,D.jsx)(re,{children:v.map(x=>(0,D.jsxs)(z,{"data-testid":`sj-row-${x.id}`,children:[(0,D.jsx)(K,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,D.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Me(x.scheduledFor)}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.pool??""}),(0,D.jsx)(K,{className:"tabular-nums",children:x.attempts??0}),(0,D.jsx)(K,{children:x.shardKey??""}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.id}),u!==void 0&&(0,D.jsx)(K,{className:"text-right",children:(0,D.jsx)(ue,{confirmLabel:s("Cancel job?"),onConfirm:y(()=>{Y(S(x.id))},"onConfirm"),testId:`sj-cancel-${x.id}`,children:s("Cancel")})})]},x.id))})]})})}),j;return e[12]!==$||e[13]!==C||e[14]!==J?(j=(0,D.jsxs)("div",{className:I,"data-testid":w,children:[C,J,$]}),e[12]=$,e[13]=C,e[14]=J,e[15]=j):j=e[15],j},"he");var _e={failed:"destructive",skipped:"warning",succeeded:"success"},Re=25,Pe=y(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"Ee"),Oe=y(r=>{let e=(0,G.c)(39),{inFlight:o,last:n}=r,l=V();if(o!==void 0){let u;e[0]!==l?(u=l("running"),e[0]=l,e[1]=u):u=e[1];let v;e[2]!==u?(v=(0,t.jsx)(oe,{variant:"info",children:u}),e[2]=u,e[3]=v):v=e[3];let b;e[4]!==o.startedAt?(b=le(o.startedAt,"\u2014"),e[4]=o.startedAt,e[5]=b):b=e[5];let S;e[6]!==b?(S=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[6]=b,e[7]=S):S=e[7];let I;e[8]!==o.skipped||e[9]!==l?(I=o.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("{count} ticks skipped",{count:o.skipped})}),e[8]=o.skipped,e[9]=l,e[10]=I):I=e[10];let w;return e[11]!==v||e[12]!==S||e[13]!==I?(w=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[v,S,I]}),e[11]=v,e[12]=S,e[13]=I,e[14]=w):w=e[14],w}if(n===void 0){let u;e[15]!==l?(u=l("never"),e[15]=l,e[16]=u):u=e[16];let v;return e[17]!==u?(v=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[17]=u,e[18]=v):v=e[18],v}let s;e[19]!==l?(s=l("failed"),e[19]=l,e[20]=s):s=e[20];let a;e[21]!==l?(a=l("skipped"),e[21]=l,e[22]=a):a=e[22];let i;e[23]!==l?(i=l("succeeded"),e[23]=l,e[24]=i):i=e[24];let c;e[25]!==s||e[26]!==a||e[27]!==i?(c={failed:s,skipped:a,succeeded:i},e[25]=s,e[26]=a,e[27]=i,e[28]=c):c=e[28];let N=c,p=_e[n.status],h=N[n.status],m;e[29]!==p||e[30]!==h?(m=(0,t.jsx)(oe,{variant:p,children:h}),e[29]=p,e[30]=h,e[31]=m):m=e[31];let k;e[32]!==n.startedAt?(k=le(n.startedAt,"\u2014"),e[32]=n.startedAt,e[33]=k):k=e[33];let f;e[34]!==k?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[34]=k,e[35]=f):f=e[35];let d;return e[36]!==m||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,f]}),e[36]=m,e[37]=f,e[38]=d):d=e[38],d},"Re"),Ee=y(r=>{let e=(0,G.c)(80),{runs:o}=r,n=V();if(o.length===0)return;let l,s,a,i,c,N,p,h,m,k,f;if(e[0]!==o||e[1]!==n){let I=o.toSorted(Ue).slice(0,Re),w;e[13]!==n?(w=n("failed"),e[13]=n,e[14]=w):w=e[14];let C;e[15]!==n?(C=n("skipped"),e[15]=n,e[16]=C):C=e[16];let J;e[17]!==n?(J=n("succeeded"),e[17]=n,e[18]=J):J=e[18];let $;e[19]!==J||e[20]!==w||e[21]!==C?($={failed:w,skipped:C,succeeded:J},e[19]=J,e[20]=w,e[21]=C,e[22]=$):$=e[22];let j=$;m="flex flex-col gap-2",k="cron-run-history";let x;e[23]!==n?(x=n("Recent runs"),e[23]=n,e[24]=x):x=e[24],e[25]!==x?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:x}),e[25]=x,e[26]=f):f=e[26],i=Z,h="overflow-hidden py-0",a=H,p="px-0",s=ee;let A;e[27]!==n?(A=n("name"),e[27]=n,e[28]=A):A=e[28];let g;e[29]!==A?(g=(0,t.jsx)(L,{children:A}),e[29]=A,e[30]=g):g=e[30];let F;e[31]!==n?(F=n("status"),e[31]=n,e[32]=F):F=e[32];let _;e[33]!==F?(_=(0,t.jsx)(L,{children:F}),e[33]=F,e[34]=_):_=e[34];let T;e[35]!==n?(T=n("started"),e[35]=n,e[36]=T):T=e[36];let M;e[37]!==T?(M=(0,t.jsx)(L,{children:T}),e[37]=T,e[38]=M):M=e[38];let R;e[39]!==n?(R=n("duration"),e[39]=n,e[40]=R):R=e[40];let W;e[41]!==R?(W=(0,t.jsx)(L,{children:R}),e[41]=R,e[42]=W):W=e[42];let B;e[43]!==n?(B=n("skipped"),e[43]=n,e[44]=B):B=e[44];let E;e[45]!==B?(E=(0,t.jsx)(L,{children:B}),e[45]=B,e[46]=E):E=e[46];let U;e[47]!==n?(U=n("error"),e[47]=n,e[48]=U):U=e[48];let P;e[49]!==U?(P=(0,t.jsx)(L,{children:U}),e[49]=U,e[50]=P):P=e[50],e[51]!==g||e[52]!==_||e[53]!==M||e[54]!==W||e[55]!==E||e[56]!==P?(N=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[g,_,M,W,E,P]})}),e[51]=g,e[52]=_,e[53]=M,e[54]=W,e[55]=E,e[56]=P,e[57]=N):N=e[57],l=re;let X;e[58]!==j?(X=y(q=>(0,t.jsxs)(z,{"data-testid":`cron-run-row-${q.runId}`,children:[(0,t.jsx)(K,{children:q.name}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{variant:_e[q.status],children:j[q.status]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(q.startedAt,"\u2014")}),(0,t.jsx)(K,{className:"tabular-nums",children:q.status==="skipped"?"":Pe(q.durationMs)}),(0,t.jsx)(K,{className:"tabular-nums",children:q.skipped>0?q.skipped:""}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:q.error??""})]},q.runId),"W"),e[58]=j,e[59]=X):X=e[59],c=I.map(X),e[0]=o,e[1]=n,e[2]=l,e[3]=s,e[4]=a,e[5]=i,e[6]=c,e[7]=N,e[8]=p,e[9]=h,e[10]=m,e[11]=k,e[12]=f}else l=e[2],s=e[3],a=e[4],i=e[5],c=e[6],N=e[7],p=e[8],h=e[9],m=e[10],k=e[11],f=e[12];let d;e[60]!==l||e[61]!==c?(d=(0,t.jsx)(l,{children:c}),e[60]=l,e[61]=c,e[62]=d):d=e[62];let u;e[63]!==s||e[64]!==N||e[65]!==d?(u=(0,t.jsxs)(s,{children:[N,d]}),e[63]=s,e[64]=N,e[65]=d,e[66]=u):u=e[66];let v;e[67]!==a||e[68]!==p||e[69]!==u?(v=(0,t.jsx)(a,{className:p,children:u}),e[67]=a,e[68]=p,e[69]=u,e[70]=v):v=e[70];let b;e[71]!==i||e[72]!==v||e[73]!==h?(b=(0,t.jsx)(i,{className:h,children:v}),e[71]=i,e[72]=v,e[73]=h,e[74]=b):b=e[74];let S;return e[75]!==b||e[76]!==m||e[77]!==k||e[78]!==f?(S=(0,t.jsxs)("div",{className:m,"data-testid":k,children:[f,b]}),e[75]=b,e[76]=m,e[77]=k,e[78]=f,e[79]=S):S=e[79],S},"Le");function Ue(r,e){return e.startedAt-r.startedAt}y(Ue,"Oe");var We=y(()=>{let r=(0,G.c)(50),e=V(),o=$e(""),[n,l]=(0,Q.useState)(""),[s,a]=(0,Q.useState)(void 0),[i,c]=(0,Q.useState)(!1);if(o.unavailable)return null;let N;r[0]!==o?(N=o.pending("cron"),r[0]=o,r[1]=N):N=r[1];let p=N,h;r[2]!==o?(h=o.reason("cron"),r[2]=o,r[3]=h):h=r[3];let m=h,k;r[4]!==n||r[5]!==o?(k=y(()=>{let T=n.trim();T!==""&&Y((async()=>{let M=await o.suggestCron(T);c(!1),a(M)})())},"y"),r[4]=n,r[5]=o,r[6]=k):k=r[6];let f=k,d;r[7]!==s?(d=y(()=>{let T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;T===void 0||s===void 0||Y((async()=>{try{await T.writeText(s),c(!0)}catch{c(!1)}})())},"d"),r[7]=s,r[8]=d):d=r[8];let u=d,v;r[9]!==e?(v=e("Describe a schedule"),r[9]=e,r[10]=v):v=r[10];let b;r[11]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{l(T.target.value)},"b"),r[11]=b):b=r[11];let S;r[12]!==f?(S=y(T=>{T.key==="Enter"&&(T.preventDefault(),f())},"w"),r[12]=f,r[13]=S):S=r[13];let I;r[14]!==e?(I=e("Describe a schedule"),r[14]=e,r[15]=I):I=r[15];let w;r[16]!==p||r[17]!==n||r[18]!==v||r[19]!==S||r[20]!==I?(w=(0,t.jsx)(Je,{"aria-label":v,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:p,onChange:b,onKeyDown:S,placeholder:I,value:n}),r[16]=p,r[17]=n,r[18]=v,r[19]=S,r[20]=I,r[21]=w):w=r[21];let C=p&&"opacity-60",J;r[22]!==C?(J=Ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",C),r[22]=C,r[23]=J):J=r[23];let $;r[24]!==p||r[25]!==n?($=p||n.trim()==="",r[24]=p,r[25]=n,r[26]=$):$=r[26];let j;r[27]!==p||r[28]!==e?(j=e(p?"Thinking\u2026":"Suggest schedule"),r[27]=p,r[28]=e,r[29]=j):j=r[29];let x;r[30]!==f||r[31]!==J||r[32]!==$||r[33]!==j?(x=(0,t.jsx)("button",{className:J,"data-testid":"cron-assistant-generate",disabled:$,onClick:f,type:"button",children:j}),r[30]=f,r[31]=J,r[32]=$,r[33]=j,r[34]=x):x=r[34];let A;r[35]!==x||r[36]!==w?(A=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w,x]}),r[35]=x,r[36]=w,r[37]=A):A=r[37];let g;r[38]!==i||r[39]!==u||r[40]!==s||r[41]!==e?(g=s!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:s}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:u,type:"button",children:e(i?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=i,r[39]=u,r[40]=s,r[41]=e,r[42]=g):g=r[42];let F;r[43]!==m||r[44]!==e?(F=m!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(m==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=m,r[44]=e,r[45]=F):F=r[45];let _;return r[46]!==A||r[47]!==g||r[48]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[A,g,F]}),r[46]=A,r[47]=g,r[48]=F,r[49]=_):_=r[49],_},"Ke"),ze={kind:"idle"},qe="SCHEDULER_NOT_CONFIGURED",ye={inFlight:[],runs:[]},Ve=y((r,e,o)=>o!==void 0?o:e===void 0?n=>r.runCronJob(n):void 0,"Fe"),Ge=y(({loadCronJobs:r,loadCronRuns:e,runCronJob:o}={})=>{let n=de(),l=V(),[s,a]=(0,Q.useState)({}),i=ne(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>n.getCronJobs()))()),{data:c,error:N}=i,p=e??(r===void 0?()=>n.listCronRuns():void 0),h=ne(["lunora-cron-runs",e?"custom":"default"],async()=>p===void 0?ye:p().catch(d=>{if(xe(d)===qe)return ye;throw d})),m=h.data??ye;ae(()=>h.poll(),p!==void 0);let k=Ve(n,r,o),f=y(async d=>{if(k!==void 0){a(u=>({...u,[d]:{kind:"running"}}));try{await k(d),a(u=>({...u,[d]:{kind:"ok"}})),i.refetch(),h.refetch()}catch(u){a(v=>({...v,[d]:{kind:"error",message:ie(u)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(We,{}),N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),c?.length===0&&(0,t.jsx)(se,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),c!==void 0&&c.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"cron-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:l("name")}),(0,t.jsx)(L,{children:l("schedule")}),(0,t.jsx)(L,{children:l("target")}),(0,t.jsx)(L,{children:l("shard")}),(0,t.jsx)(L,{children:l("last run")}),k!==void 0&&(0,t.jsx)(L,{"aria-label":l("Actions")})]})}),(0,t.jsx)(re,{children:c.map(d=>{let u=s[d.name]??ze;return(0,t.jsxs)(z,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(K,{children:d.name}),(0,t.jsx)(K,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(K,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:l("function")}):(0,t.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(K,{children:d.shardKey??""}),(0,t.jsx)(K,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Oe,{inFlight:m.inFlight.find(v=>v.name===d.name),last:m.runs.find(v=>v.name===d.name)})}),k!==void 0&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[u.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:l("ran")}),u.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:u.message}),(0,t.jsx)(ue,{confirmLabel:l("Run now?"),disabled:u.kind==="running",onConfirm:y(()=>{Y(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:u.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(Ee,{runs:m.runs})]})},"Je"),Qe=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","Me"),Xe=y(r=>{let e=(0,G.c)(34),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n,removeJob:l,retryJob:s}=o,a=de(),i=V(),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-dead-jobs"],e[2]=c):c=e[2];let N;e[3]!==a||e[4]!==n?(N=y(async()=>(await(n??(()=>a.listDeadJobs()))()).toSorted(Ye),"v"),e[3]=a,e[4]=n,e[5]=N):N=e[5];let p=ne(c,N),h=p.data,[m,k]=(0,Q.useState)(void 0),f=p.error??m,d=n===void 0,u;e[6]!==a||e[7]!==d||e[8]!==s?(u=s??(d?g=>a.retryDeadJob(g):void 0),e[6]=a,e[7]=d,e[8]=s,e[9]=u):u=e[9];let v=u,b;e[10]!==a||e[11]!==d||e[12]!==l?(b=l??(d?g=>a.removeDeadJob(g):void 0),e[10]=a,e[11]=d,e[12]=l,e[13]=b):b=e[13];let S=b,I;e[14]!==p?(I=y(()=>p.poll(),"S"),e[14]=p,e[15]=I):I=e[15],ae(I,!0);let w;e[16]!==p?(w=y(async g=>{k(void 0);try{await g,p.refetch()}catch(F){k(ie(F))}},"N"),e[16]=p,e[17]=w):w=e[17];let C=w,J=v!==void 0||S!==void 0,$;e[18]!==f?($=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=$):$=e[19];let j;e[20]!==h?.length||e[21]!==i?(j=h?.length===0&&(0,t.jsx)(se,{description:i("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:i("No dead-letter jobs.")}),e[20]=h?.length,e[21]=i,e[22]=j):j=e[22];let x;e[23]!==C||e[24]!==J||e[25]!==h||e[26]!==S||e[27]!==v||e[28]!==i?(x=h!==void 0&&h.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"dlq-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:i("function")}),(0,t.jsx)(L,{children:i("attempts")}),(0,t.jsx)(L,{children:i("last tried")}),(0,t.jsx)(L,{children:i("pool")}),(0,t.jsx)(L,{children:i("shard")}),(0,t.jsx)(L,{children:i("id")}),J&&(0,t.jsx)(L,{"aria-label":i("Actions")})]})}),(0,t.jsx)(re,{children:h.map(g=>(0,t.jsxs)(z,{"data-testid":`dlq-row-${g.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:g.workflow??g.functionPath}),(0,t.jsx)(K,{className:"tabular-nums",children:g.attempts??0}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Qe(g.scheduledFor)}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.pool??""}),(0,t.jsx)(K,{children:g.shardKey??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.id}),J&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ce,{"data-testid":`dlq-retry-${g.id}`,onClick:y(()=>{Y(C(v(g.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Retry")}),S!==void 0&&(0,t.jsx)(ue,{confirmLabel:i("Drop job?"),onConfirm:y(()=>{Y(C(S(g.id)))},"onConfirm"),testId:`dlq-remove-${g.id}`,children:i("Drop")})]})})]},g.id))})]})})}),e[23]=C,e[24]=J,e[25]=h,e[26]=S,e[27]=v,e[28]=i,e[29]=x):x=e[29];let A;return e[30]!==x||e[31]!==$||e[32]!==j?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,j,x]}),e[30]=x,e[31]=$,e[32]=j,e[33]=A):A=e[33],A},"Pe");function Ye(r,e){return(e.attempts??0)-(r.attempts??0)}y(Ye,"qe");var Ze={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},He=y(r=>{let e=(0,G.c)(47),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n}=o,l=de(),s=V(),a;e[2]!==l||e[3]!==n?(a=n??(async O=>l.listScheduledHistory(O===void 0?{}:{cursor:O})),e[2]=l,e[3]=n,e[4]=a):a=e[4];let i=a,c=n?"custom":"default",N;e[5]!==c?(N=["lunora-job-history",c],e[5]=c,e[6]=N):N=e[6];let p;e[7]!==i?(p=y(async()=>i(),"f"),e[7]=i,e[8]=p):p=e[8];let h=ne(N,p),[m,k]=(0,Q.useState)(void 0),[f,d]=(0,Q.useState)(!1),[u,v]=(0,Q.useState)(void 0),b=h.data?.records,S;e[9]!==b?(S=new Set(b?.map(et)),e[9]=b,e[10]=S):S=e[10];let I=S,w=b===void 0?void 0:[...b,...(m?.records??[]).filter(O=>!I.has(O.id))],C=m===void 0?h.data?.cursor:m.cursor,J;e[11]!==i||e[12]!==C?(J=y(async()=>{d(!0),v(void 0);try{let O=await i(C);k(De=>({cursor:O.cursor,records:[...De?.records??[],...O.records]})),d(!1)}catch(O){v(ie(O)),d(!1)}},"L"),e[11]=i,e[12]=C,e[13]=J):J=e[13];let $=J,j;e[14]!==s?(j=s("canceled"),e[14]=s,e[15]=j):j=e[15];let x;e[16]!==s?(x=s("failed"),e[16]=s,e[17]=x):x=e[17];let A;e[18]!==s?(A=s("pending"),e[18]=s,e[19]=A):A=e[19];let g;e[20]!==s?(g=s("running"),e[20]=s,e[21]=g):g=e[21];let F;e[22]!==s?(F=s("succeeded"),e[22]=s,e[23]=F):F=e[23];let _;e[24]!==A||e[25]!==g||e[26]!==F||e[27]!==j||e[28]!==x?(_={canceled:j,failed:x,pending:A,running:g,succeeded:F},e[24]=A,e[25]=g,e[26]=F,e[27]=j,e[28]=x,e[29]=_):_=e[29];let T=_,M;e[30]!==h?(M=y(()=>h.poll(),"_"),e[30]=h,e[31]=M):M=e[31],ae(M,m===void 0);let R="flex flex-col gap-3",W="lunora-job-history",B;e[32]!==h.error?(B=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=B):B=e[33];let E=w?.length===0&&(0,t.jsx)(se,{description:s("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:s("No finished jobs.")}),U=w!==void 0&&w.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"job-history-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:s("function")}),(0,t.jsx)(L,{children:s("state")}),(0,t.jsx)(L,{children:s("finished")}),(0,t.jsx)(L,{children:s("error")}),(0,t.jsx)(L,{children:s("id")})]})}),(0,t.jsx)(re,{children:w.map(O=>(0,t.jsxs)(z,{"data-testid":`job-history-row-${O.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:O.workflow??O.functionPath}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${O.id}`,variant:Ze[O.state],children:T[O.state]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(O.completedAt,"\u2014")}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:O.error??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:O.id})]},O.id))})]})})}),P;e[34]!==u?(P=u!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:u}),e[34]=u,e[35]=P):P=e[35];let X;e[36]!==f||e[37]!==C||e[38]!==$||e[39]!==s?(X=C!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"job-history-load-more",disabled:f,onClick:y(()=>{Y($())},"onClick"),variant:"outline",children:s(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=C,e[38]=$,e[39]=s,e[40]=X):X=e[40];let q;return e[41]!==B||e[42]!==E||e[43]!==U||e[44]!==P||e[45]!==X?(q=(0,t.jsxs)("div",{className:R,"data-testid":W,children:[B,E,U,P,X]}),e[41]=B,e[42]=E,e[43]=U,e[44]=P,e[45]=X,e[46]=q):q=e[46],q},"Be");function et(r){return r.id}y(et,"He");var tt=fe(me.dropOutboxEntry),rt=fe(me.retryOutboxEntry),lt=y(()=>{let r=(0,G.c)(8),e=V(),o;r[0]!==e?(o=e("Jobs whose mutation committed but that the scheduler has not accepted yet wait here."),r[0]=e,r[1]=o):o=r[1];let n;r[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 4h16v12H4zM4 16l4 4h8l4-4"})}),r[2]=n):n=r[2];let l;r[3]!==e?(l=e("Nothing is waiting for the scheduler."),r[3]=e,r[4]=l):l=r[4];let s;return r[5]!==o||r[6]!==l?(s=(0,t.jsx)(se,{description:o,icon:n,testId:"outbox-empty",title:l}),r[5]=o,r[6]=l,r[7]=s):s=r[7],s},"ze"),at=y(r=>{let e=(0,G.c)(58),{entry:o,onAct:n}=r,l=V(),s=`outbox-row-${o.id}`,a;e[0]!==o.target||e[1]!==l?(a=o.target??l("unreadable"),e[0]=o.target,e[1]=l,e[2]=a):a=e[2];let i;e[3]!==a?(i=(0,t.jsx)(K,{className:"font-mono text-xs",children:a}),e[3]=a,e[4]=i):i=e[4];let c=o.parked?"destructive":"secondary",N;e[5]!==o.parked||e[6]!==l?(N=o.parked?l("parked"):l("retrying"),e[5]=o.parked,e[6]=l,e[7]=N):N=e[7];let p;e[8]!==c||e[9]!==N?(p=(0,t.jsx)(oe,{variant:c,children:N}),e[8]=c,e[9]=N,e[10]=p):p=e[10];let h;e[11]!==o.forever||e[12]!==l?(h=o.forever&&(0,t.jsx)(oe,{variant:"outline",children:l("forever")}),e[11]=o.forever,e[12]=l,e[13]=h):h=e[13];let m;e[14]!==p||e[15]!==h?(m=(0,t.jsx)(K,{children:(0,t.jsxs)("div",{className:"flex gap-1",children:[p,h]})}),e[14]=p,e[15]=h,e[16]=m):m=e[16];let k;e[17]!==o.attempts?(k=(0,t.jsx)(K,{className:"tabular-nums",children:o.attempts}),e[17]=o.attempts,e[18]=k):k=e[18];let f;e[19]!==o.nextAttemptAt||e[20]!==o.parked?(f=o.parked?"\u2014":le(o.nextAttemptAt,"\u2014"),e[19]=o.nextAttemptAt,e[20]=o.parked,e[21]=f):f=e[21];let d;e[22]!==f?(d=(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:f}),e[22]=f,e[23]=d):d=e[23];let u;e[24]!==o.id?(u=(0,t.jsx)(K,{className:"font-mono text-xs",children:o.id}),e[24]=o.id,e[25]=u):u=e[25];let v=`outbox-retry-${o.id}`,b;e[26]!==o.id||e[27]!==n?(b=y(()=>{Y(n(rt,o.id))},"b"),e[26]=o.id,e[27]=n,e[28]=b):b=e[28];let S;e[29]!==l?(S=l("Retry now"),e[29]=l,e[30]=S):S=e[30];let I;e[31]!==v||e[32]!==b||e[33]!==S?(I=(0,t.jsx)(ce,{"data-testid":v,onClick:b,size:"sm",type:"button",variant:"outline",children:S}),e[31]=v,e[32]=b,e[33]=S,e[34]=I):I=e[34];let w;e[35]!==l?(w=l("Drop job?"),e[35]=l,e[36]=w):w=e[36];let C;e[37]!==o.id||e[38]!==n?(C=y(()=>{Y(n(tt,o.id))},"T"),e[37]=o.id,e[38]=n,e[39]=C):C=e[39];let J=`outbox-drop-${o.id}`,$;e[40]!==l?($=l("Drop"),e[40]=l,e[41]=$):$=e[41];let j;e[42]!==w||e[43]!==C||e[44]!==J||e[45]!==$?(j=(0,t.jsx)(ue,{confirmLabel:w,onConfirm:C,testId:J,children:$}),e[42]=w,e[43]=C,e[44]=J,e[45]=$,e[46]=j):j=e[46];let x;e[47]!==I||e[48]!==j?(x=(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[I,j]})}),e[47]=I,e[48]=j,e[49]=x):x=e[49];let A;return e[50]!==s||e[51]!==d||e[52]!==u||e[53]!==x||e[54]!==i||e[55]!==m||e[56]!==k?(A=(0,t.jsxs)(z,{"data-testid":s,children:[i,m,k,d,u,x]}),e[50]=s,e[51]=d,e[52]=u,e[53]=x,e[54]=i,e[55]=m,e[56]=k,e[57]=A):A=e[57],A},"We"),ot=y(r=>{let e=(0,G.c)(41),{entries:o,onAct:n}=r,l=V(),s;e[0]!==l?(s=l("function"),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,t.jsx)(L,{children:s}),e[2]=s,e[3]=a):a=e[3];let i;e[4]!==l?(i=l("state"),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,t.jsx)(L,{children:i}),e[6]=i,e[7]=c):c=e[7];let N;e[8]!==l?(N=l("attempts"),e[8]=l,e[9]=N):N=e[9];let p;e[10]!==N?(p=(0,t.jsx)(L,{children:N}),e[10]=N,e[11]=p):p=e[11];let h;e[12]!==l?(h=l("next attempt"),e[12]=l,e[13]=h):h=e[13];let m;e[14]!==h?(m=(0,t.jsx)(L,{children:h}),e[14]=h,e[15]=m):m=e[15];let k;e[16]!==l?(k=l("id"),e[16]=l,e[17]=k):k=e[17];let f;e[18]!==k?(f=(0,t.jsx)(L,{children:k}),e[18]=k,e[19]=f):f=e[19];let d;e[20]!==l?(d=l("Actions"),e[20]=l,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,t.jsx)(L,{"aria-label":d}),e[22]=d,e[23]=u):u=e[23];let v;e[24]!==f||e[25]!==u||e[26]!==a||e[27]!==c||e[28]!==p||e[29]!==m?(v=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[a,c,p,m,f,u]})}),e[24]=f,e[25]=u,e[26]=a,e[27]=c,e[28]=p,e[29]=m,e[30]=v):v=e[30];let b;if(e[31]!==o||e[32]!==n){let w;e[34]!==n?(w=y(C=>(0,t.jsx)(at,{entry:C,onAct:n},C.id),"N"),e[34]=n,e[35]=w):w=e[35],b=o.map(w),e[31]=o,e[32]=n,e[33]=b}else b=e[33];let S;e[36]!==b?(S=(0,t.jsx)(re,{children:b}),e[36]=b,e[37]=S):S=e[37];let I;return e[38]!==v||e[39]!==S?(I=(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"outbox-table",children:[v,S]})})}),e[38]=v,e[39]=S,e[40]=I):I=e[40],I},"Ge"),nt=y(r=>{let e=(0,G.c)(11),{cursor:o,nextCursor:n,onFirst:l,onNext:s}=r,a=V();if(o===void 0&&n===void 0)return;let i;e[0]!==o||e[1]!==l||e[2]!==a?(i=o!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-first-page",onClick:l,size:"sm",type:"button",variant:"outline",children:a("First page")}),e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let c;e[4]!==n||e[5]!==s||e[6]!==a?(c=n!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-next-page",onClick:y(()=>{s(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Next page")}),e[4]=n,e[5]=s,e[6]=a,e[7]=c):c=e[7];let N;return e[8]!==i||e[9]!==c?(N=(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[i,c]}),e[8]=i,e[9]=c,e[10]=N):N=e[10],N},"Ye"),st=y(r=>{let e=(0,G.c)(38),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n}=o,l=je(),s=V(),{queryShardKey:a,setShardKey:i,shardKey:c}=ge(n),N;e[2]!==a?(N={cursor:void 0,shardKey:a},e[2]=a,e[3]=N):N=e[3];let[p,h]=(0,Q.useState)(N);p.shardKey!==a&&h({cursor:void 0,shardKey:a});let m=p.shardKey===a?p.cursor:void 0,k=c.trim()!==a,f;e[4]!==m?(f=m===void 0?{}:{cursor:m},e[4]=m,e[5]=f):f=e[5];let d;e[6]!==a?(d={shardKey:a},e[6]=a,e[7]=d):d=e[7];let{data:u,error:v,poll:b,refetch:S}=ve(me.getScheduleOutbox,f,d),I=k?void 0:u?.entries,w=k?void 0:u?.nextCursor,[C,J]=(0,Q.useState)(void 0),$=v??(C?.shardKey===a?C.message:void 0);ae(b,!0);let j;e[8]!==l||e[9]!==a||e[10]!==S||e[11]!==s?(j=y(async(B,E)=>{J(void 0);try{(await l.query(B,{id:E},Ae(a))).retried===!1&&J({message:s("That job is no longer in the outbox."),shardKey:a}),S()}catch(U){J({message:ie(U),shardKey:a})}},"A"),e[8]=l,e[9]=a,e[10]=S,e[11]=s,e[12]=j):j=e[12];let x=j,A;e[13]!==i||e[14]!==c?(A=(0,t.jsx)(be,{onChange:i,testId:"outbox-shard-input",value:c}),e[13]=i,e[14]=c,e[15]=A):A=e[15];let g;e[16]!==$?(g=$!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"outbox-error",role:"alert",children:$}),e[16]=$,e[17]=g):g=e[17];let F;e[18]!==m||e[19]!==I?.length?(F=I?.length===0&&m===void 0&&(0,t.jsx)(lt,{}),e[18]=m,e[19]=I?.length,e[20]=F):F=e[20];let _;e[21]!==x||e[22]!==I?(_=I!==void 0&&I.length>0&&(0,t.jsx)(ot,{entries:I,onAct:x}),e[21]=x,e[22]=I,e[23]=_):_=e[23];let T,M;e[24]!==a?(T=y(()=>{h({cursor:void 0,shardKey:a})},"E"),M=y(B=>{h({cursor:B,shardKey:a})},"_"),e[24]=a,e[25]=T,e[26]=M):(T=e[25],M=e[26]);let R;e[27]!==m||e[28]!==w||e[29]!==T||e[30]!==M?(R=(0,t.jsx)(nt,{cursor:m,nextCursor:w,onFirst:T,onNext:M}),e[27]=m,e[28]=w,e[29]=T,e[30]=M,e[31]=R):R=e[31];let W;return e[32]!==R||e[33]!==A||e[34]!==g||e[35]!==F||e[36]!==_?(W=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-schedule-outbox",children:[A,g,F,_,R]}),e[32]=R,e[33]=A,e[34]=g,e[35]=F,e[36]=_,e[37]=W):W=e[37],W},"je"),it="scheduler.lag_ms",Ne=y(r=>{let e=r.attributes?.function;return typeof e=="string"?e:r.functionPath},"he"),ke=y(r=>{let e=(0,G.c)(8),{label:o,testId:n,value:l}=r,s;e[0]!==o?(s=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=s):s=e[1];let a;e[2]!==n||e[3]!==l?(a=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=(0,t.jsx)(Z,{className:"flex-1 py-0",children:(0,t.jsxs)(H,{className:"flex flex-col gap-1 p-4",children:[s,a]})}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i},"fe"),dt=y(r=>{let e=(0,G.c)(65),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadStatus:l}=o,s=de(),a=V(),i=l===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let N;e[4]!==s||e[5]!==l?(N=y(async()=>{let B=await(l??(()=>s.schedulerStatus()))();return{...B,pools:B.pools.toSorted(ct)}},"v"),e[4]=s,e[5]=l,e[6]=N):N=e[6];let p=ne(c,N),{data:h,error:m}=p,{queryShardKey:k,setShardKey:f,shardKey:d}=ge(n),u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u={},e[7]=u):u=e[7];let v;e[8]!==k?(v={shardKey:k},e[8]=k,e[9]=v):v=e[9];let b=ve(me.getMetricSeries,u,v),{data:S,errorSource:I}=b,w;e[10]!==I||e[11]!==b.error?(w=xe(I)==="FUNCTION_NOT_FOUND"?null:b.error,e[10]=I,e[11]=b.error,e[12]=w):w=e[12];let C=w,J;e[13]!==p?(J=y(()=>p.poll(),"L"),e[13]=p,e[14]=J):J=e[14],ae(J,!0);let $;e[15]!==b?($=y(()=>b.poll(),"$"),e[15]=b,e[16]=$):$=e[16],ae($,!0);let j,x,A,g,F,_,T,M;if(e[17]!==m||e[18]!==S||e[19]!==C||e[20]!==f||e[21]!==d||e[22]!==h||e[23]!==a){let B=(Array.isArray(S?.series)?S.series:[]).filter(ht).toSorted(ut);j="flex flex-col gap-3",x="lunora-scheduler-pools",e[32]!==m?(A=m!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m}),e[32]=m,e[33]=A):A=e[33],e[34]!==h||e[35]!==a?(g=h!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(ke,{label:a("backlog"),testId:"pools-backlog",value:h.backlog}),(0,t.jsx)(ke,{label:a("in flight"),testId:"pools-inflight",value:h.inFlight}),(0,t.jsx)(ke,{label:a("pools"),testId:"pools-count",value:h.pools.length})]}),e[34]=h,e[35]=a,e[36]=g):g=e[36],e[37]!==h?.pools.length||e[38]!==a?(F=h?.pools.length===0&&(0,t.jsx)(se,{description:a("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:a("No workpools.")}),e[37]=h?.pools.length,e[38]=a,e[39]=F):F=e[39];let E;e[40]!==f||e[41]!==d?(E=(0,t.jsx)(be,{onChange:f,testId:"lag-shard-input",value:d}),e[40]=f,e[41]=d,e[42]=E):E=e[42];let U;e[43]!==a?(U=a("Start lag per job on this shard since it last woke; the series reset when the shard hibernates."),e[43]=a,e[44]=U):U=e[44];let P;e[45]!==U?(P=(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"lag-scope",children:U}),e[45]=U,e[46]=P):P=e[46],e[47]!==E||e[48]!==P?(_=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[E,P]}),e[47]=E,e[48]=P,e[49]=_):_=e[49],e[50]!==C?(T=C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lag-error",role:"alert",children:C}),e[50]=C,e[51]=T):T=e[51],M=C===null&&B.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"lag-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("function")}),(0,t.jsx)(L,{children:a("runs")}),(0,t.jsx)(L,{children:a("mean lag (ms)")}),(0,t.jsx)(L,{children:a("max lag (ms)")}),(0,t.jsx)(L,{children:a("last lag (ms)")})]})}),(0,t.jsx)(re,{children:B.map(mt)})]})})}),e[17]=m,e[18]=S,e[19]=C,e[20]=f,e[21]=d,e[22]=h,e[23]=a,e[24]=j,e[25]=x,e[26]=A,e[27]=g,e[28]=F,e[29]=_,e[30]=T,e[31]=M}else j=e[24],x=e[25],A=e[26],g=e[27],F=e[28],_=e[29],T=e[30],M=e[31];let R;e[52]!==h||e[53]!==a?(R=h!==void 0&&h.pools.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"pools-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("pool")}),(0,t.jsx)(L,{children:a("queued")}),(0,t.jsx)(L,{children:a("in flight")}),(0,t.jsx)(L,{children:a("max concurrency")})]})}),(0,t.jsx)(re,{children:h.pools.map(pt)})]})})}),e[52]=h,e[53]=a,e[54]=R):R=e[54];let W;return e[55]!==j||e[56]!==x||e[57]!==A||e[58]!==g||e[59]!==F||e[60]!==_||e[61]!==T||e[62]!==M||e[63]!==R?(W=(0,t.jsxs)("div",{className:j,"data-testid":x,children:[A,g,F,_,T,M,R]}),e[55]=j,e[56]=x,e[57]=A,e[58]=g,e[59]=F,e[60]=_,e[61]=T,e[62]=M,e[63]=R,e[64]=W):W=e[64],W},"Ze");function ct(r,e){return e.queued-r.queued}y(ct,"et");function ht(r){return r.name===it&&r.kind==="histogram"&&r.count>0}y(ht,"tt");function ut(r,e){return e.max-r.max}y(ut,"st");function mt(r){return(0,t.jsxs)(z,{"data-testid":`lag-row-${Ne(r)}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:Ne(r)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.count}),(0,t.jsx)(K,{className:"tabular-nums",children:Math.round(r.sum/r.count)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.max}),(0,t.jsx)(K,{className:"tabular-nums",children:r.last})]},Ne(r))}y(mt,"lt");function pt(r){return(0,t.jsxs)(z,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(K,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(K,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(K,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}y(pt,"rt");var ft=["jobs","outbox","history","dead","pools","cron"],Vt=y(r=>{let e=(0,G.c)(55),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadCronJobs:l,scheduledCancel:s,scheduledLoad:a}=o,i=V(),[c,N]=(0,Q.useState)("jobs"),p;e[2]!==i?(p=i("Cron triggers"),e[2]=i,e[3]=p):p=e[3];let h;e[4]!==i?(h=i("Dead letter"),e[4]=i,e[5]=h):h=e[5];let m;e[6]!==i?(m=i("History"),e[6]=i,e[7]=m):m=e[7];let k;e[8]!==i?(k=i("Scheduled jobs"),e[8]=i,e[9]=k):k=e[9];let f;e[10]!==i?(f=i("Outbox"),e[10]=i,e[11]=f):f=e[11];let d;e[12]!==i?(d=i("Pools"),e[12]=i,e[13]=d):d=e[13];let u;e[14]!==p||e[15]!==h||e[16]!==m||e[17]!==k||e[18]!==f||e[19]!==d?(u={cron:p,dead:h,history:m,jobs:k,outbox:f,pools:d},e[14]=p,e[15]=h,e[16]=m,e[17]=k,e[18]=f,e[19]=d,e[20]=u):u=e[20];let v=u,b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{N(T.currentTarget.dataset.view)},"b"),e[21]=b):b=e[21];let S=b,I;e[22]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(Le,{}),e[22]=I):I=e[22];let w;e[23]!==i?(w=i("Schedule view"),e[23]=i,e[24]=w):w=e[24];let C;e[25]!==c||e[26]!==v?(C=ft.map(T=>(0,t.jsx)(ce,{"aria-selected":c===T,"data-testid":`schedule-view-${T}`,"data-view":T,onClick:S,role:"tab",size:"sm",type:"button",variant:c===T?"default":"outline",children:v[T]},T)),e[25]=c,e[26]=v,e[27]=C):C=e[27];let J;e[28]!==w||e[29]!==C?(J=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:C}),e[28]=w,e[29]=C,e[30]=J):J=e[30];let $;e[31]!==s||e[32]!==a||e[33]!==c?($=c==="jobs"&&(0,t.jsx)(Te,{cancelJob:s,loadJobs:a}),e[31]=s,e[32]=a,e[33]=c,e[34]=$):$=e[34];let j;e[35]!==c?(j=c==="outbox"&&(0,t.jsx)(st,{}),e[35]=c,e[36]=j):j=e[36];let x;e[37]!==c?(x=c==="history"&&(0,t.jsx)(He,{}),e[37]=c,e[38]=x):x=e[38];let A;e[39]!==c?(A=c==="dead"&&(0,t.jsx)(Xe,{}),e[39]=c,e[40]=A):A=e[40];let g;e[41]!==n||e[42]!==c?(g=c==="pools"&&(0,t.jsx)(dt,{initialShardKey:n}),e[41]=n,e[42]=c,e[43]=g):g=e[43];let F;e[44]!==l||e[45]!==c?(F=c==="cron"&&(0,t.jsx)(Ge,{loadCronJobs:l}),e[44]=l,e[45]=c,e[46]=F):F=e[46];let _;return e[47]!==J||e[48]!==$||e[49]!==j||e[50]!==x||e[51]!==A||e[52]!==g||e[53]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,J,$,j,x,A,g,F]}),e[47]=J,e[48]=$,e[49]=j,e[50]=x,e[51]=A,e[52]=g,e[53]=F,e[54]=_):_=e[54],_},"It");export{Vt as SchedulePanel};
1
+ import{a as $e}from"./chunk-REZHNEUN.js";import{g as Le}from"./chunk-5IFJNGRV.js";import"./chunk-AFLNQEZ5.js";import"./chunk-V4X27TLH.js";import"./chunk-CL3JOU6F.js";import{a as ae}from"./chunk-43LNUM4U.js";import"./chunk-6MAIN66N.js";import"./chunk-YIZDDGWA.js";import"./chunk-HXFXD5EP.js";import"./chunk-EUNTXABP.js";import"./chunk-WC2DKA2R.js";import"./chunk-2NUCBQFU.js";import{a as ge}from"./chunk-2KTN53PK.js";import{a as be}from"./chunk-3WPPFTDC.js";import"./chunk-EDL46BPM.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-B65U64C3.js";import"./chunk-4KPATTV6.js";import"./chunk-JGSHDQGZ.js";import"./chunk-YYRXX5Z4.js";import{j as Je}from"./chunk-4L2BABMS.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import{a as ce}from"./chunk-LTWCT32V.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import{a as se}from"./chunk-ZKEXJDGJ.js";import{b as oe}from"./chunk-STKYARMP.js";import"./chunk-DMQVY5L7.js";import{a as ee,b as te,c as re,d as z,e as L,f as K}from"./chunk-H4NGBPG2.js";import"./chunk-AL5S7LVU.js";import"./chunk-EOFWXI3T.js";import{a as me}from"./chunk-LYVYUTQY.js";import{b as ne,c as ve}from"./chunk-U7U4ADXH.js";import{a as Z,e as H}from"./chunk-ZBAR562M.js";import{l as je,n as de}from"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B as V,h as fe,i as Ae,j as ie,k as xe,s as Y,w as le,x as Ie}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import{a as Ce}from"./chunk-A6TVTNKO.js";import{a as we,b as Se}from"./chunk-ADABTCDI.js";import{a as y,d as he}from"./chunk-5PEAXTYQ.js";var G=he(Ce(),1),Q=he(we(),1);var t=he(Se(),1);var Fe=he(Ce(),1),pe=he(we(),1);var D=he(Se(),1);var Me=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","X"),Ke=y(r=>r.toSorted((e,o)=>e.scheduledFor-o.scheduledFor),"F"),Be=y((r,e,o)=>e!==void 0?e:o===void 0?n=>r.cancelScheduledJob(n):void 0,"Y"),Te=y(r=>{let e=(0,Fe.c)(16),{cancelJob:o,loadJobs:n}=r===void 0?{}:r,l=de(),s=V(),a=n===void 0,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["lunora-scheduled-jobs"],e[0]=i):i=e[0];let c=ne(i,async()=>{let x=await(n??(()=>l.listScheduledJobs()))();return Ke(x)}),[N,p]=(0,pe.useState)(void 0),[h,m]=(0,pe.useState)(void 0),k,f;e[1]!==l||e[2]!==a?(k=y(()=>{if(a)return l.subscribeScheduledJobs(x=>{m(void 0),p(Ke(x))})},"v"),f=[a,l],e[1]=l,e[2]=a,e[3]=k,e[4]=f):(k=e[3],f=e[4]),(0,pe.useEffect)(k,f);let d;e[5]!==c?(d=y(()=>c.poll(),"y"),e[5]=c,e[6]=d):d=e[6],ae(d,!a);let u=Be(l,o,n),v=N??c.data,b=h??c.error,S=y(async x=>{if(u!==void 0){m(void 0);try{await u(x),a||c.refetch()}catch(A){m(ie(A))}}},"E"),I="flex flex-col gap-3",w="lunora-scheduled-jobs",C;e[7]!==b?(C=b!==null&&(0,D.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:b}),e[7]=b,e[8]=C):C=e[8];let J;e[9]!==v?.length||e[10]!==s?(J=v?.length===0&&(0,D.jsx)(se,{description:s("Jobs queued with runAfter / runAt will appear here."),icon:(0,D.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,D.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:s("No scheduled jobs.")}),e[9]=v?.length,e[10]=s,e[11]=J):J=e[11];let $=v!==void 0&&v.length>0&&(0,D.jsx)(Z,{className:"overflow-hidden py-0",children:(0,D.jsx)(H,{className:"px-0",children:(0,D.jsxs)(ee,{"data-testid":"sj-table",children:[(0,D.jsx)(te,{children:(0,D.jsxs)(z,{children:[(0,D.jsx)(L,{children:s("function")}),(0,D.jsx)(L,{children:s("scheduled for")}),(0,D.jsx)(L,{children:s("pool")}),(0,D.jsx)(L,{children:s("attempts")}),(0,D.jsx)(L,{children:s("shard")}),(0,D.jsx)(L,{children:s("id")}),u!==void 0&&(0,D.jsx)(L,{"aria-label":s("Actions")})]})}),(0,D.jsx)(re,{children:v.map(x=>(0,D.jsxs)(z,{"data-testid":`sj-row-${x.id}`,children:[(0,D.jsx)(K,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,D.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Me(x.scheduledFor)}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.pool??""}),(0,D.jsx)(K,{className:"tabular-nums",children:x.attempts??0}),(0,D.jsx)(K,{children:x.shardKey??""}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.id}),u!==void 0&&(0,D.jsx)(K,{className:"text-right",children:(0,D.jsx)(ue,{confirmLabel:s("Cancel job?"),onConfirm:y(()=>{Y(S(x.id))},"onConfirm"),testId:`sj-cancel-${x.id}`,children:s("Cancel")})})]},x.id))})]})})}),j;return e[12]!==$||e[13]!==C||e[14]!==J?(j=(0,D.jsxs)("div",{className:I,"data-testid":w,children:[C,J,$]}),e[12]=$,e[13]=C,e[14]=J,e[15]=j):j=e[15],j},"he");var _e={failed:"destructive",skipped:"warning",succeeded:"success"},Re=25,Pe=y(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"Ee"),Oe=y(r=>{let e=(0,G.c)(39),{inFlight:o,last:n}=r,l=V();if(o!==void 0){let u;e[0]!==l?(u=l("running"),e[0]=l,e[1]=u):u=e[1];let v;e[2]!==u?(v=(0,t.jsx)(oe,{variant:"info",children:u}),e[2]=u,e[3]=v):v=e[3];let b;e[4]!==o.startedAt?(b=le(o.startedAt,"\u2014"),e[4]=o.startedAt,e[5]=b):b=e[5];let S;e[6]!==b?(S=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[6]=b,e[7]=S):S=e[7];let I;e[8]!==o.skipped||e[9]!==l?(I=o.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("{count} ticks skipped",{count:o.skipped})}),e[8]=o.skipped,e[9]=l,e[10]=I):I=e[10];let w;return e[11]!==v||e[12]!==S||e[13]!==I?(w=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[v,S,I]}),e[11]=v,e[12]=S,e[13]=I,e[14]=w):w=e[14],w}if(n===void 0){let u;e[15]!==l?(u=l("never"),e[15]=l,e[16]=u):u=e[16];let v;return e[17]!==u?(v=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[17]=u,e[18]=v):v=e[18],v}let s;e[19]!==l?(s=l("failed"),e[19]=l,e[20]=s):s=e[20];let a;e[21]!==l?(a=l("skipped"),e[21]=l,e[22]=a):a=e[22];let i;e[23]!==l?(i=l("succeeded"),e[23]=l,e[24]=i):i=e[24];let c;e[25]!==s||e[26]!==a||e[27]!==i?(c={failed:s,skipped:a,succeeded:i},e[25]=s,e[26]=a,e[27]=i,e[28]=c):c=e[28];let N=c,p=_e[n.status],h=N[n.status],m;e[29]!==p||e[30]!==h?(m=(0,t.jsx)(oe,{variant:p,children:h}),e[29]=p,e[30]=h,e[31]=m):m=e[31];let k;e[32]!==n.startedAt?(k=le(n.startedAt,"\u2014"),e[32]=n.startedAt,e[33]=k):k=e[33];let f;e[34]!==k?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[34]=k,e[35]=f):f=e[35];let d;return e[36]!==m||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,f]}),e[36]=m,e[37]=f,e[38]=d):d=e[38],d},"Re"),Ee=y(r=>{let e=(0,G.c)(80),{runs:o}=r,n=V();if(o.length===0)return;let l,s,a,i,c,N,p,h,m,k,f;if(e[0]!==o||e[1]!==n){let I=o.toSorted(Ue).slice(0,Re),w;e[13]!==n?(w=n("failed"),e[13]=n,e[14]=w):w=e[14];let C;e[15]!==n?(C=n("skipped"),e[15]=n,e[16]=C):C=e[16];let J;e[17]!==n?(J=n("succeeded"),e[17]=n,e[18]=J):J=e[18];let $;e[19]!==J||e[20]!==w||e[21]!==C?($={failed:w,skipped:C,succeeded:J},e[19]=J,e[20]=w,e[21]=C,e[22]=$):$=e[22];let j=$;m="flex flex-col gap-2",k="cron-run-history";let x;e[23]!==n?(x=n("Recent runs"),e[23]=n,e[24]=x):x=e[24],e[25]!==x?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:x}),e[25]=x,e[26]=f):f=e[26],i=Z,h="overflow-hidden py-0",a=H,p="px-0",s=ee;let A;e[27]!==n?(A=n("name"),e[27]=n,e[28]=A):A=e[28];let g;e[29]!==A?(g=(0,t.jsx)(L,{children:A}),e[29]=A,e[30]=g):g=e[30];let F;e[31]!==n?(F=n("status"),e[31]=n,e[32]=F):F=e[32];let _;e[33]!==F?(_=(0,t.jsx)(L,{children:F}),e[33]=F,e[34]=_):_=e[34];let T;e[35]!==n?(T=n("started"),e[35]=n,e[36]=T):T=e[36];let M;e[37]!==T?(M=(0,t.jsx)(L,{children:T}),e[37]=T,e[38]=M):M=e[38];let R;e[39]!==n?(R=n("duration"),e[39]=n,e[40]=R):R=e[40];let W;e[41]!==R?(W=(0,t.jsx)(L,{children:R}),e[41]=R,e[42]=W):W=e[42];let B;e[43]!==n?(B=n("skipped"),e[43]=n,e[44]=B):B=e[44];let E;e[45]!==B?(E=(0,t.jsx)(L,{children:B}),e[45]=B,e[46]=E):E=e[46];let U;e[47]!==n?(U=n("error"),e[47]=n,e[48]=U):U=e[48];let P;e[49]!==U?(P=(0,t.jsx)(L,{children:U}),e[49]=U,e[50]=P):P=e[50],e[51]!==g||e[52]!==_||e[53]!==M||e[54]!==W||e[55]!==E||e[56]!==P?(N=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[g,_,M,W,E,P]})}),e[51]=g,e[52]=_,e[53]=M,e[54]=W,e[55]=E,e[56]=P,e[57]=N):N=e[57],l=re;let X;e[58]!==j?(X=y(q=>(0,t.jsxs)(z,{"data-testid":`cron-run-row-${q.runId}`,children:[(0,t.jsx)(K,{children:q.name}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{variant:_e[q.status],children:j[q.status]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(q.startedAt,"\u2014")}),(0,t.jsx)(K,{className:"tabular-nums",children:q.status==="skipped"?"":Pe(q.durationMs)}),(0,t.jsx)(K,{className:"tabular-nums",children:q.skipped>0?q.skipped:""}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:q.error??""})]},q.runId),"W"),e[58]=j,e[59]=X):X=e[59],c=I.map(X),e[0]=o,e[1]=n,e[2]=l,e[3]=s,e[4]=a,e[5]=i,e[6]=c,e[7]=N,e[8]=p,e[9]=h,e[10]=m,e[11]=k,e[12]=f}else l=e[2],s=e[3],a=e[4],i=e[5],c=e[6],N=e[7],p=e[8],h=e[9],m=e[10],k=e[11],f=e[12];let d;e[60]!==l||e[61]!==c?(d=(0,t.jsx)(l,{children:c}),e[60]=l,e[61]=c,e[62]=d):d=e[62];let u;e[63]!==s||e[64]!==N||e[65]!==d?(u=(0,t.jsxs)(s,{children:[N,d]}),e[63]=s,e[64]=N,e[65]=d,e[66]=u):u=e[66];let v;e[67]!==a||e[68]!==p||e[69]!==u?(v=(0,t.jsx)(a,{className:p,children:u}),e[67]=a,e[68]=p,e[69]=u,e[70]=v):v=e[70];let b;e[71]!==i||e[72]!==v||e[73]!==h?(b=(0,t.jsx)(i,{className:h,children:v}),e[71]=i,e[72]=v,e[73]=h,e[74]=b):b=e[74];let S;return e[75]!==b||e[76]!==m||e[77]!==k||e[78]!==f?(S=(0,t.jsxs)("div",{className:m,"data-testid":k,children:[f,b]}),e[75]=b,e[76]=m,e[77]=k,e[78]=f,e[79]=S):S=e[79],S},"Le");function Ue(r,e){return e.startedAt-r.startedAt}y(Ue,"Oe");var We=y(()=>{let r=(0,G.c)(50),e=V(),o=$e(""),[n,l]=(0,Q.useState)(""),[s,a]=(0,Q.useState)(void 0),[i,c]=(0,Q.useState)(!1);if(o.unavailable)return null;let N;r[0]!==o?(N=o.pending("cron"),r[0]=o,r[1]=N):N=r[1];let p=N,h;r[2]!==o?(h=o.reason("cron"),r[2]=o,r[3]=h):h=r[3];let m=h,k;r[4]!==n||r[5]!==o?(k=y(()=>{let T=n.trim();T!==""&&Y((async()=>{let M=await o.suggestCron(T);c(!1),a(M)})())},"y"),r[4]=n,r[5]=o,r[6]=k):k=r[6];let f=k,d;r[7]!==s?(d=y(()=>{let T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;T===void 0||s===void 0||Y((async()=>{try{await T.writeText(s),c(!0)}catch{c(!1)}})())},"d"),r[7]=s,r[8]=d):d=r[8];let u=d,v;r[9]!==e?(v=e("Describe a schedule"),r[9]=e,r[10]=v):v=r[10];let b;r[11]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{l(T.target.value)},"b"),r[11]=b):b=r[11];let S;r[12]!==f?(S=y(T=>{T.key==="Enter"&&(T.preventDefault(),f())},"w"),r[12]=f,r[13]=S):S=r[13];let I;r[14]!==e?(I=e("Describe a schedule"),r[14]=e,r[15]=I):I=r[15];let w;r[16]!==p||r[17]!==n||r[18]!==v||r[19]!==S||r[20]!==I?(w=(0,t.jsx)(Je,{"aria-label":v,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:p,onChange:b,onKeyDown:S,placeholder:I,value:n}),r[16]=p,r[17]=n,r[18]=v,r[19]=S,r[20]=I,r[21]=w):w=r[21];let C=p&&"opacity-60",J;r[22]!==C?(J=Ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",C),r[22]=C,r[23]=J):J=r[23];let $;r[24]!==p||r[25]!==n?($=p||n.trim()==="",r[24]=p,r[25]=n,r[26]=$):$=r[26];let j;r[27]!==p||r[28]!==e?(j=e(p?"Thinking\u2026":"Suggest schedule"),r[27]=p,r[28]=e,r[29]=j):j=r[29];let x;r[30]!==f||r[31]!==J||r[32]!==$||r[33]!==j?(x=(0,t.jsx)("button",{className:J,"data-testid":"cron-assistant-generate",disabled:$,onClick:f,type:"button",children:j}),r[30]=f,r[31]=J,r[32]=$,r[33]=j,r[34]=x):x=r[34];let A;r[35]!==x||r[36]!==w?(A=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w,x]}),r[35]=x,r[36]=w,r[37]=A):A=r[37];let g;r[38]!==i||r[39]!==u||r[40]!==s||r[41]!==e?(g=s!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:s}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:u,type:"button",children:e(i?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=i,r[39]=u,r[40]=s,r[41]=e,r[42]=g):g=r[42];let F;r[43]!==m||r[44]!==e?(F=m!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(m==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=m,r[44]=e,r[45]=F):F=r[45];let _;return r[46]!==A||r[47]!==g||r[48]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[A,g,F]}),r[46]=A,r[47]=g,r[48]=F,r[49]=_):_=r[49],_},"Ke"),ze={kind:"idle"},qe="SCHEDULER_NOT_CONFIGURED",ye={inFlight:[],runs:[]},Ve=y((r,e,o)=>o!==void 0?o:e===void 0?n=>r.runCronJob(n):void 0,"Fe"),Ge=y(({loadCronJobs:r,loadCronRuns:e,runCronJob:o}={})=>{let n=de(),l=V(),[s,a]=(0,Q.useState)({}),i=ne(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>n.getCronJobs()))()),{data:c,error:N}=i,p=e??(r===void 0?()=>n.listCronRuns():void 0),h=ne(["lunora-cron-runs",e?"custom":"default"],async()=>p===void 0?ye:p().catch(d=>{if(xe(d)===qe)return ye;throw d})),m=h.data??ye;ae(()=>h.poll(),p!==void 0);let k=Ve(n,r,o),f=y(async d=>{if(k!==void 0){a(u=>({...u,[d]:{kind:"running"}}));try{await k(d),a(u=>({...u,[d]:{kind:"ok"}})),i.refetch(),h.refetch()}catch(u){a(v=>({...v,[d]:{kind:"error",message:ie(u)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(We,{}),N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),c?.length===0&&(0,t.jsx)(se,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),c!==void 0&&c.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"cron-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:l("name")}),(0,t.jsx)(L,{children:l("schedule")}),(0,t.jsx)(L,{children:l("target")}),(0,t.jsx)(L,{children:l("shard")}),(0,t.jsx)(L,{children:l("last run")}),k!==void 0&&(0,t.jsx)(L,{"aria-label":l("Actions")})]})}),(0,t.jsx)(re,{children:c.map(d=>{let u=s[d.name]??ze;return(0,t.jsxs)(z,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(K,{children:d.name}),(0,t.jsx)(K,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(K,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:l("function")}):(0,t.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(K,{children:d.shardKey??""}),(0,t.jsx)(K,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Oe,{inFlight:m.inFlight.find(v=>v.name===d.name),last:m.runs.find(v=>v.name===d.name)})}),k!==void 0&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[u.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:l("ran")}),u.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:u.message}),(0,t.jsx)(ue,{confirmLabel:l("Run now?"),disabled:u.kind==="running",onConfirm:y(()=>{Y(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:u.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(Ee,{runs:m.runs})]})},"Je"),Qe=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","Me"),Xe=y(r=>{let e=(0,G.c)(34),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n,removeJob:l,retryJob:s}=o,a=de(),i=V(),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-dead-jobs"],e[2]=c):c=e[2];let N;e[3]!==a||e[4]!==n?(N=y(async()=>(await(n??(()=>a.listDeadJobs()))()).toSorted(Ye),"v"),e[3]=a,e[4]=n,e[5]=N):N=e[5];let p=ne(c,N),h=p.data,[m,k]=(0,Q.useState)(void 0),f=p.error??m,d=n===void 0,u;e[6]!==a||e[7]!==d||e[8]!==s?(u=s??(d?g=>a.retryDeadJob(g):void 0),e[6]=a,e[7]=d,e[8]=s,e[9]=u):u=e[9];let v=u,b;e[10]!==a||e[11]!==d||e[12]!==l?(b=l??(d?g=>a.removeDeadJob(g):void 0),e[10]=a,e[11]=d,e[12]=l,e[13]=b):b=e[13];let S=b,I;e[14]!==p?(I=y(()=>p.poll(),"S"),e[14]=p,e[15]=I):I=e[15],ae(I,!0);let w;e[16]!==p?(w=y(async g=>{k(void 0);try{await g,p.refetch()}catch(F){k(ie(F))}},"N"),e[16]=p,e[17]=w):w=e[17];let C=w,J=v!==void 0||S!==void 0,$;e[18]!==f?($=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=$):$=e[19];let j;e[20]!==h?.length||e[21]!==i?(j=h?.length===0&&(0,t.jsx)(se,{description:i("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:i("No dead-letter jobs.")}),e[20]=h?.length,e[21]=i,e[22]=j):j=e[22];let x;e[23]!==C||e[24]!==J||e[25]!==h||e[26]!==S||e[27]!==v||e[28]!==i?(x=h!==void 0&&h.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"dlq-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:i("function")}),(0,t.jsx)(L,{children:i("attempts")}),(0,t.jsx)(L,{children:i("last tried")}),(0,t.jsx)(L,{children:i("pool")}),(0,t.jsx)(L,{children:i("shard")}),(0,t.jsx)(L,{children:i("id")}),J&&(0,t.jsx)(L,{"aria-label":i("Actions")})]})}),(0,t.jsx)(re,{children:h.map(g=>(0,t.jsxs)(z,{"data-testid":`dlq-row-${g.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:g.workflow??g.functionPath}),(0,t.jsx)(K,{className:"tabular-nums",children:g.attempts??0}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Qe(g.scheduledFor)}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.pool??""}),(0,t.jsx)(K,{children:g.shardKey??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.id}),J&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ce,{"data-testid":`dlq-retry-${g.id}`,onClick:y(()=>{Y(C(v(g.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Retry")}),S!==void 0&&(0,t.jsx)(ue,{confirmLabel:i("Drop job?"),onConfirm:y(()=>{Y(C(S(g.id)))},"onConfirm"),testId:`dlq-remove-${g.id}`,children:i("Drop")})]})})]},g.id))})]})})}),e[23]=C,e[24]=J,e[25]=h,e[26]=S,e[27]=v,e[28]=i,e[29]=x):x=e[29];let A;return e[30]!==x||e[31]!==$||e[32]!==j?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,j,x]}),e[30]=x,e[31]=$,e[32]=j,e[33]=A):A=e[33],A},"Pe");function Ye(r,e){return(e.attempts??0)-(r.attempts??0)}y(Ye,"qe");var Ze={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},He=y(r=>{let e=(0,G.c)(47),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n}=o,l=de(),s=V(),a;e[2]!==l||e[3]!==n?(a=n??(async O=>l.listScheduledHistory(O===void 0?{}:{cursor:O})),e[2]=l,e[3]=n,e[4]=a):a=e[4];let i=a,c=n?"custom":"default",N;e[5]!==c?(N=["lunora-job-history",c],e[5]=c,e[6]=N):N=e[6];let p;e[7]!==i?(p=y(async()=>i(),"f"),e[7]=i,e[8]=p):p=e[8];let h=ne(N,p),[m,k]=(0,Q.useState)(void 0),[f,d]=(0,Q.useState)(!1),[u,v]=(0,Q.useState)(void 0),b=h.data?.records,S;e[9]!==b?(S=new Set(b?.map(et)),e[9]=b,e[10]=S):S=e[10];let I=S,w=b===void 0?void 0:[...b,...(m?.records??[]).filter(O=>!I.has(O.id))],C=m===void 0?h.data?.cursor:m.cursor,J;e[11]!==i||e[12]!==C?(J=y(async()=>{d(!0),v(void 0);try{let O=await i(C);k(De=>({cursor:O.cursor,records:[...De?.records??[],...O.records]})),d(!1)}catch(O){v(ie(O)),d(!1)}},"L"),e[11]=i,e[12]=C,e[13]=J):J=e[13];let $=J,j;e[14]!==s?(j=s("canceled"),e[14]=s,e[15]=j):j=e[15];let x;e[16]!==s?(x=s("failed"),e[16]=s,e[17]=x):x=e[17];let A;e[18]!==s?(A=s("pending"),e[18]=s,e[19]=A):A=e[19];let g;e[20]!==s?(g=s("running"),e[20]=s,e[21]=g):g=e[21];let F;e[22]!==s?(F=s("succeeded"),e[22]=s,e[23]=F):F=e[23];let _;e[24]!==A||e[25]!==g||e[26]!==F||e[27]!==j||e[28]!==x?(_={canceled:j,failed:x,pending:A,running:g,succeeded:F},e[24]=A,e[25]=g,e[26]=F,e[27]=j,e[28]=x,e[29]=_):_=e[29];let T=_,M;e[30]!==h?(M=y(()=>h.poll(),"_"),e[30]=h,e[31]=M):M=e[31],ae(M,m===void 0);let R="flex flex-col gap-3",W="lunora-job-history",B;e[32]!==h.error?(B=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=B):B=e[33];let E=w?.length===0&&(0,t.jsx)(se,{description:s("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:s("No finished jobs.")}),U=w!==void 0&&w.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"job-history-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:s("function")}),(0,t.jsx)(L,{children:s("state")}),(0,t.jsx)(L,{children:s("finished")}),(0,t.jsx)(L,{children:s("error")}),(0,t.jsx)(L,{children:s("id")})]})}),(0,t.jsx)(re,{children:w.map(O=>(0,t.jsxs)(z,{"data-testid":`job-history-row-${O.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:O.workflow??O.functionPath}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${O.id}`,variant:Ze[O.state],children:T[O.state]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(O.completedAt,"\u2014")}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:O.error??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:O.id})]},O.id))})]})})}),P;e[34]!==u?(P=u!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:u}),e[34]=u,e[35]=P):P=e[35];let X;e[36]!==f||e[37]!==C||e[38]!==$||e[39]!==s?(X=C!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"job-history-load-more",disabled:f,onClick:y(()=>{Y($())},"onClick"),variant:"outline",children:s(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=C,e[38]=$,e[39]=s,e[40]=X):X=e[40];let q;return e[41]!==B||e[42]!==E||e[43]!==U||e[44]!==P||e[45]!==X?(q=(0,t.jsxs)("div",{className:R,"data-testid":W,children:[B,E,U,P,X]}),e[41]=B,e[42]=E,e[43]=U,e[44]=P,e[45]=X,e[46]=q):q=e[46],q},"Be");function et(r){return r.id}y(et,"He");var tt=fe(me.dropOutboxEntry),rt=fe(me.retryOutboxEntry),lt=y(()=>{let r=(0,G.c)(8),e=V(),o;r[0]!==e?(o=e("Jobs whose mutation committed but that the scheduler has not accepted yet wait here."),r[0]=e,r[1]=o):o=r[1];let n;r[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 4h16v12H4zM4 16l4 4h8l4-4"})}),r[2]=n):n=r[2];let l;r[3]!==e?(l=e("Nothing is waiting for the scheduler."),r[3]=e,r[4]=l):l=r[4];let s;return r[5]!==o||r[6]!==l?(s=(0,t.jsx)(se,{description:o,icon:n,testId:"outbox-empty",title:l}),r[5]=o,r[6]=l,r[7]=s):s=r[7],s},"ze"),at=y(r=>{let e=(0,G.c)(58),{entry:o,onAct:n}=r,l=V(),s=`outbox-row-${o.id}`,a;e[0]!==o.target||e[1]!==l?(a=o.target??l("unreadable"),e[0]=o.target,e[1]=l,e[2]=a):a=e[2];let i;e[3]!==a?(i=(0,t.jsx)(K,{className:"font-mono text-xs",children:a}),e[3]=a,e[4]=i):i=e[4];let c=o.parked?"destructive":"secondary",N;e[5]!==o.parked||e[6]!==l?(N=o.parked?l("parked"):l("retrying"),e[5]=o.parked,e[6]=l,e[7]=N):N=e[7];let p;e[8]!==c||e[9]!==N?(p=(0,t.jsx)(oe,{variant:c,children:N}),e[8]=c,e[9]=N,e[10]=p):p=e[10];let h;e[11]!==o.forever||e[12]!==l?(h=o.forever&&(0,t.jsx)(oe,{variant:"outline",children:l("forever")}),e[11]=o.forever,e[12]=l,e[13]=h):h=e[13];let m;e[14]!==p||e[15]!==h?(m=(0,t.jsx)(K,{children:(0,t.jsxs)("div",{className:"flex gap-1",children:[p,h]})}),e[14]=p,e[15]=h,e[16]=m):m=e[16];let k;e[17]!==o.attempts?(k=(0,t.jsx)(K,{className:"tabular-nums",children:o.attempts}),e[17]=o.attempts,e[18]=k):k=e[18];let f;e[19]!==o.nextAttemptAt||e[20]!==o.parked?(f=o.parked?"\u2014":le(o.nextAttemptAt,"\u2014"),e[19]=o.nextAttemptAt,e[20]=o.parked,e[21]=f):f=e[21];let d;e[22]!==f?(d=(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:f}),e[22]=f,e[23]=d):d=e[23];let u;e[24]!==o.id?(u=(0,t.jsx)(K,{className:"font-mono text-xs",children:o.id}),e[24]=o.id,e[25]=u):u=e[25];let v=`outbox-retry-${o.id}`,b;e[26]!==o.id||e[27]!==n?(b=y(()=>{Y(n(rt,o.id))},"b"),e[26]=o.id,e[27]=n,e[28]=b):b=e[28];let S;e[29]!==l?(S=l("Retry now"),e[29]=l,e[30]=S):S=e[30];let I;e[31]!==v||e[32]!==b||e[33]!==S?(I=(0,t.jsx)(ce,{"data-testid":v,onClick:b,size:"sm",type:"button",variant:"outline",children:S}),e[31]=v,e[32]=b,e[33]=S,e[34]=I):I=e[34];let w;e[35]!==l?(w=l("Drop job?"),e[35]=l,e[36]=w):w=e[36];let C;e[37]!==o.id||e[38]!==n?(C=y(()=>{Y(n(tt,o.id))},"T"),e[37]=o.id,e[38]=n,e[39]=C):C=e[39];let J=`outbox-drop-${o.id}`,$;e[40]!==l?($=l("Drop"),e[40]=l,e[41]=$):$=e[41];let j;e[42]!==w||e[43]!==C||e[44]!==J||e[45]!==$?(j=(0,t.jsx)(ue,{confirmLabel:w,onConfirm:C,testId:J,children:$}),e[42]=w,e[43]=C,e[44]=J,e[45]=$,e[46]=j):j=e[46];let x;e[47]!==I||e[48]!==j?(x=(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[I,j]})}),e[47]=I,e[48]=j,e[49]=x):x=e[49];let A;return e[50]!==s||e[51]!==d||e[52]!==u||e[53]!==x||e[54]!==i||e[55]!==m||e[56]!==k?(A=(0,t.jsxs)(z,{"data-testid":s,children:[i,m,k,d,u,x]}),e[50]=s,e[51]=d,e[52]=u,e[53]=x,e[54]=i,e[55]=m,e[56]=k,e[57]=A):A=e[57],A},"We"),ot=y(r=>{let e=(0,G.c)(41),{entries:o,onAct:n}=r,l=V(),s;e[0]!==l?(s=l("function"),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,t.jsx)(L,{children:s}),e[2]=s,e[3]=a):a=e[3];let i;e[4]!==l?(i=l("state"),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,t.jsx)(L,{children:i}),e[6]=i,e[7]=c):c=e[7];let N;e[8]!==l?(N=l("attempts"),e[8]=l,e[9]=N):N=e[9];let p;e[10]!==N?(p=(0,t.jsx)(L,{children:N}),e[10]=N,e[11]=p):p=e[11];let h;e[12]!==l?(h=l("next attempt"),e[12]=l,e[13]=h):h=e[13];let m;e[14]!==h?(m=(0,t.jsx)(L,{children:h}),e[14]=h,e[15]=m):m=e[15];let k;e[16]!==l?(k=l("id"),e[16]=l,e[17]=k):k=e[17];let f;e[18]!==k?(f=(0,t.jsx)(L,{children:k}),e[18]=k,e[19]=f):f=e[19];let d;e[20]!==l?(d=l("Actions"),e[20]=l,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,t.jsx)(L,{"aria-label":d}),e[22]=d,e[23]=u):u=e[23];let v;e[24]!==f||e[25]!==u||e[26]!==a||e[27]!==c||e[28]!==p||e[29]!==m?(v=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[a,c,p,m,f,u]})}),e[24]=f,e[25]=u,e[26]=a,e[27]=c,e[28]=p,e[29]=m,e[30]=v):v=e[30];let b;if(e[31]!==o||e[32]!==n){let w;e[34]!==n?(w=y(C=>(0,t.jsx)(at,{entry:C,onAct:n},C.id),"N"),e[34]=n,e[35]=w):w=e[35],b=o.map(w),e[31]=o,e[32]=n,e[33]=b}else b=e[33];let S;e[36]!==b?(S=(0,t.jsx)(re,{children:b}),e[36]=b,e[37]=S):S=e[37];let I;return e[38]!==v||e[39]!==S?(I=(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"outbox-table",children:[v,S]})})}),e[38]=v,e[39]=S,e[40]=I):I=e[40],I},"Ge"),nt=y(r=>{let e=(0,G.c)(11),{cursor:o,nextCursor:n,onFirst:l,onNext:s}=r,a=V();if(o===void 0&&n===void 0)return;let i;e[0]!==o||e[1]!==l||e[2]!==a?(i=o!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-first-page",onClick:l,size:"sm",type:"button",variant:"outline",children:a("First page")}),e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let c;e[4]!==n||e[5]!==s||e[6]!==a?(c=n!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-next-page",onClick:y(()=>{s(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Next page")}),e[4]=n,e[5]=s,e[6]=a,e[7]=c):c=e[7];let N;return e[8]!==i||e[9]!==c?(N=(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[i,c]}),e[8]=i,e[9]=c,e[10]=N):N=e[10],N},"Ye"),st=y(r=>{let e=(0,G.c)(38),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n}=o,l=je(),s=V(),{queryShardKey:a,setShardKey:i,shardKey:c}=ge(n),N;e[2]!==a?(N={cursor:void 0,shardKey:a},e[2]=a,e[3]=N):N=e[3];let[p,h]=(0,Q.useState)(N);p.shardKey!==a&&h({cursor:void 0,shardKey:a});let m=p.shardKey===a?p.cursor:void 0,k=c.trim()!==a,f;e[4]!==m?(f=m===void 0?{}:{cursor:m},e[4]=m,e[5]=f):f=e[5];let d;e[6]!==a?(d={shardKey:a},e[6]=a,e[7]=d):d=e[7];let{data:u,error:v,poll:b,refetch:S}=ve(me.getScheduleOutbox,f,d),I=k?void 0:u?.entries,w=k?void 0:u?.nextCursor,[C,J]=(0,Q.useState)(void 0),$=v??(C?.shardKey===a?C.message:void 0);ae(b,!0);let j;e[8]!==l||e[9]!==a||e[10]!==S||e[11]!==s?(j=y(async(B,E)=>{J(void 0);try{(await l.query(B,{id:E},Ae(a))).retried===!1&&J({message:s("That job is no longer in the outbox."),shardKey:a}),S()}catch(U){J({message:ie(U),shardKey:a})}},"A"),e[8]=l,e[9]=a,e[10]=S,e[11]=s,e[12]=j):j=e[12];let x=j,A;e[13]!==i||e[14]!==c?(A=(0,t.jsx)(be,{onChange:i,testId:"outbox-shard-input",value:c}),e[13]=i,e[14]=c,e[15]=A):A=e[15];let g;e[16]!==$?(g=$!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"outbox-error",role:"alert",children:$}),e[16]=$,e[17]=g):g=e[17];let F;e[18]!==m||e[19]!==I?.length?(F=I?.length===0&&m===void 0&&(0,t.jsx)(lt,{}),e[18]=m,e[19]=I?.length,e[20]=F):F=e[20];let _;e[21]!==x||e[22]!==I?(_=I!==void 0&&I.length>0&&(0,t.jsx)(ot,{entries:I,onAct:x}),e[21]=x,e[22]=I,e[23]=_):_=e[23];let T,M;e[24]!==a?(T=y(()=>{h({cursor:void 0,shardKey:a})},"E"),M=y(B=>{h({cursor:B,shardKey:a})},"_"),e[24]=a,e[25]=T,e[26]=M):(T=e[25],M=e[26]);let R;e[27]!==m||e[28]!==w||e[29]!==T||e[30]!==M?(R=(0,t.jsx)(nt,{cursor:m,nextCursor:w,onFirst:T,onNext:M}),e[27]=m,e[28]=w,e[29]=T,e[30]=M,e[31]=R):R=e[31];let W;return e[32]!==R||e[33]!==A||e[34]!==g||e[35]!==F||e[36]!==_?(W=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-schedule-outbox",children:[A,g,F,_,R]}),e[32]=R,e[33]=A,e[34]=g,e[35]=F,e[36]=_,e[37]=W):W=e[37],W},"je"),it="scheduler.lag_ms",Ne=y(r=>{let e=r.attributes?.function;return typeof e=="string"?e:r.functionPath},"he"),ke=y(r=>{let e=(0,G.c)(8),{label:o,testId:n,value:l}=r,s;e[0]!==o?(s=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=s):s=e[1];let a;e[2]!==n||e[3]!==l?(a=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=(0,t.jsx)(Z,{className:"flex-1 py-0",children:(0,t.jsxs)(H,{className:"flex flex-col gap-1 p-4",children:[s,a]})}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i},"fe"),dt=y(r=>{let e=(0,G.c)(65),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadStatus:l}=o,s=de(),a=V(),i=l===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let N;e[4]!==s||e[5]!==l?(N=y(async()=>{let B=await(l??(()=>s.schedulerStatus()))();return{...B,pools:B.pools.toSorted(ct)}},"v"),e[4]=s,e[5]=l,e[6]=N):N=e[6];let p=ne(c,N),{data:h,error:m}=p,{queryShardKey:k,setShardKey:f,shardKey:d}=ge(n),u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u={},e[7]=u):u=e[7];let v;e[8]!==k?(v={shardKey:k},e[8]=k,e[9]=v):v=e[9];let b=ve(me.getMetricSeries,u,v),{data:S,errorSource:I}=b,w;e[10]!==I||e[11]!==b.error?(w=xe(I)==="FUNCTION_NOT_FOUND"?null:b.error,e[10]=I,e[11]=b.error,e[12]=w):w=e[12];let C=w,J;e[13]!==p?(J=y(()=>p.poll(),"L"),e[13]=p,e[14]=J):J=e[14],ae(J,!0);let $;e[15]!==b?($=y(()=>b.poll(),"$"),e[15]=b,e[16]=$):$=e[16],ae($,!0);let j,x,A,g,F,_,T,M;if(e[17]!==m||e[18]!==S||e[19]!==C||e[20]!==f||e[21]!==d||e[22]!==h||e[23]!==a){let B=(Array.isArray(S?.series)?S.series:[]).filter(ht).toSorted(ut);j="flex flex-col gap-3",x="lunora-scheduler-pools",e[32]!==m?(A=m!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m}),e[32]=m,e[33]=A):A=e[33],e[34]!==h||e[35]!==a?(g=h!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(ke,{label:a("backlog"),testId:"pools-backlog",value:h.backlog}),(0,t.jsx)(ke,{label:a("in flight"),testId:"pools-inflight",value:h.inFlight}),(0,t.jsx)(ke,{label:a("pools"),testId:"pools-count",value:h.pools.length})]}),e[34]=h,e[35]=a,e[36]=g):g=e[36],e[37]!==h?.pools.length||e[38]!==a?(F=h?.pools.length===0&&(0,t.jsx)(se,{description:a("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:a("No workpools.")}),e[37]=h?.pools.length,e[38]=a,e[39]=F):F=e[39];let E;e[40]!==f||e[41]!==d?(E=(0,t.jsx)(be,{onChange:f,testId:"lag-shard-input",value:d}),e[40]=f,e[41]=d,e[42]=E):E=e[42];let U;e[43]!==a?(U=a("Start lag per job on this shard since it last woke; the series reset when the shard hibernates."),e[43]=a,e[44]=U):U=e[44];let P;e[45]!==U?(P=(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"lag-scope",children:U}),e[45]=U,e[46]=P):P=e[46],e[47]!==E||e[48]!==P?(_=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[E,P]}),e[47]=E,e[48]=P,e[49]=_):_=e[49],e[50]!==C?(T=C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lag-error",role:"alert",children:C}),e[50]=C,e[51]=T):T=e[51],M=C===null&&B.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"lag-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("function")}),(0,t.jsx)(L,{children:a("runs")}),(0,t.jsx)(L,{children:a("mean lag (ms)")}),(0,t.jsx)(L,{children:a("max lag (ms)")}),(0,t.jsx)(L,{children:a("last lag (ms)")})]})}),(0,t.jsx)(re,{children:B.map(mt)})]})})}),e[17]=m,e[18]=S,e[19]=C,e[20]=f,e[21]=d,e[22]=h,e[23]=a,e[24]=j,e[25]=x,e[26]=A,e[27]=g,e[28]=F,e[29]=_,e[30]=T,e[31]=M}else j=e[24],x=e[25],A=e[26],g=e[27],F=e[28],_=e[29],T=e[30],M=e[31];let R;e[52]!==h||e[53]!==a?(R=h!==void 0&&h.pools.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"pools-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("pool")}),(0,t.jsx)(L,{children:a("queued")}),(0,t.jsx)(L,{children:a("in flight")}),(0,t.jsx)(L,{children:a("max concurrency")})]})}),(0,t.jsx)(re,{children:h.pools.map(pt)})]})})}),e[52]=h,e[53]=a,e[54]=R):R=e[54];let W;return e[55]!==j||e[56]!==x||e[57]!==A||e[58]!==g||e[59]!==F||e[60]!==_||e[61]!==T||e[62]!==M||e[63]!==R?(W=(0,t.jsxs)("div",{className:j,"data-testid":x,children:[A,g,F,_,T,M,R]}),e[55]=j,e[56]=x,e[57]=A,e[58]=g,e[59]=F,e[60]=_,e[61]=T,e[62]=M,e[63]=R,e[64]=W):W=e[64],W},"Ze");function ct(r,e){return e.queued-r.queued}y(ct,"et");function ht(r){return r.name===it&&r.kind==="histogram"&&r.count>0}y(ht,"tt");function ut(r,e){return e.max-r.max}y(ut,"st");function mt(r){return(0,t.jsxs)(z,{"data-testid":`lag-row-${Ne(r)}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:Ne(r)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.count}),(0,t.jsx)(K,{className:"tabular-nums",children:Math.round(r.sum/r.count)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.max}),(0,t.jsx)(K,{className:"tabular-nums",children:r.last})]},Ne(r))}y(mt,"lt");function pt(r){return(0,t.jsxs)(z,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(K,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(K,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(K,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}y(pt,"rt");var ft=["jobs","outbox","history","dead","pools","cron"],Vt=y(r=>{let e=(0,G.c)(55),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadCronJobs:l,scheduledCancel:s,scheduledLoad:a}=o,i=V(),[c,N]=(0,Q.useState)("jobs"),p;e[2]!==i?(p=i("Cron triggers"),e[2]=i,e[3]=p):p=e[3];let h;e[4]!==i?(h=i("Dead letter"),e[4]=i,e[5]=h):h=e[5];let m;e[6]!==i?(m=i("History"),e[6]=i,e[7]=m):m=e[7];let k;e[8]!==i?(k=i("Scheduled jobs"),e[8]=i,e[9]=k):k=e[9];let f;e[10]!==i?(f=i("Outbox"),e[10]=i,e[11]=f):f=e[11];let d;e[12]!==i?(d=i("Pools"),e[12]=i,e[13]=d):d=e[13];let u;e[14]!==p||e[15]!==h||e[16]!==m||e[17]!==k||e[18]!==f||e[19]!==d?(u={cron:p,dead:h,history:m,jobs:k,outbox:f,pools:d},e[14]=p,e[15]=h,e[16]=m,e[17]=k,e[18]=f,e[19]=d,e[20]=u):u=e[20];let v=u,b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{N(T.currentTarget.dataset.view)},"b"),e[21]=b):b=e[21];let S=b,I;e[22]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(Le,{}),e[22]=I):I=e[22];let w;e[23]!==i?(w=i("Schedule view"),e[23]=i,e[24]=w):w=e[24];let C;e[25]!==c||e[26]!==v?(C=ft.map(T=>(0,t.jsx)(ce,{"aria-selected":c===T,"data-testid":`schedule-view-${T}`,"data-view":T,onClick:S,role:"tab",size:"sm",type:"button",variant:c===T?"default":"outline",children:v[T]},T)),e[25]=c,e[26]=v,e[27]=C):C=e[27];let J;e[28]!==w||e[29]!==C?(J=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:C}),e[28]=w,e[29]=C,e[30]=J):J=e[30];let $;e[31]!==s||e[32]!==a||e[33]!==c?($=c==="jobs"&&(0,t.jsx)(Te,{cancelJob:s,loadJobs:a}),e[31]=s,e[32]=a,e[33]=c,e[34]=$):$=e[34];let j;e[35]!==c?(j=c==="outbox"&&(0,t.jsx)(st,{}),e[35]=c,e[36]=j):j=e[36];let x;e[37]!==c?(x=c==="history"&&(0,t.jsx)(He,{}),e[37]=c,e[38]=x):x=e[38];let A;e[39]!==c?(A=c==="dead"&&(0,t.jsx)(Xe,{}),e[39]=c,e[40]=A):A=e[40];let g;e[41]!==n||e[42]!==c?(g=c==="pools"&&(0,t.jsx)(dt,{initialShardKey:n}),e[41]=n,e[42]=c,e[43]=g):g=e[43];let F;e[44]!==l||e[45]!==c?(F=c==="cron"&&(0,t.jsx)(Ge,{loadCronJobs:l}),e[44]=l,e[45]=c,e[46]=F):F=e[46];let _;return e[47]!==J||e[48]!==$||e[49]!==j||e[50]!==x||e[51]!==A||e[52]!==g||e[53]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,J,$,j,x,A,g,F]}),e[47]=J,e[48]=$,e[49]=j,e[50]=x,e[51]=A,e[52]=g,e[53]=F,e[54]=_):_=e[54],_},"It");export{Vt as SchedulePanel};
@@ -1 +1 @@
1
- import{m as h,n as v}from"./chunk-VEG327ST.js";import{x as g}from"./chunk-G4H5DPO6.js";import{a as x}from"./chunk-A6TVTNKO.js";import{b as y}from"./chunk-ADABTCDI.js";import{a as u,d as p}from"./chunk-5PEAXTYQ.js";var b=p(x(),1);var n=p(y(),1);var w={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},j=u(i=>{let a=(0,b.c)(12),{ariaLabel:c,className:m,series:l,testId:d}=i;if(l.length<2)return null;let t;a[0]!==l?(t=l.slice(-40).map(N),a[0]=l,a[1]=t):t=a[1];let f=t,e;a[2]!==m?(e=g("h-6 w-[120px]",m),a[2]=m,a[3]=e):e=a[3];let o;a[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(v,{dataKey:"value"}),a[4]=o):o=a[4];let r;a[5]!==f?(r=(0,n.jsx)(h,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:w,data:f,children:o}),a[5]=f,a[6]=r):r=a[6];let s;return a[7]!==c||a[8]!==e||a[9]!==r||a[10]!==d?(s=(0,n.jsx)("div",{"aria-label":c,className:e,"data-testid":d,role:"img",children:r}),a[7]=c,a[8]=e,a[9]=r,a[10]=d,a[11]=s):s=a[11],s},"w");function N(i,a){return{index:a,value:i}}u(N,"b");export{j as a};
1
+ import{m as h,n as v}from"./chunk-YNO5YLZT.js";import{x as g}from"./chunk-7EUM7G2I.js";import{a as x}from"./chunk-A6TVTNKO.js";import{b as y}from"./chunk-ADABTCDI.js";import{a as u,d as p}from"./chunk-5PEAXTYQ.js";var b=p(x(),1);var n=p(y(),1);var w={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},j=u(i=>{let a=(0,b.c)(12),{ariaLabel:c,className:m,series:l,testId:d}=i;if(l.length<2)return null;let t;a[0]!==l?(t=l.slice(-40).map(N),a[0]=l,a[1]=t):t=a[1];let f=t,e;a[2]!==m?(e=g("h-6 w-[120px]",m),a[2]=m,a[3]=e):e=a[3];let o;a[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(v,{dataKey:"value"}),a[4]=o):o=a[4];let r;a[5]!==f?(r=(0,n.jsx)(h,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:w,data:f,children:o}),a[5]=f,a[6]=r):r=a[6];let s;return a[7]!==c||a[8]!==e||a[9]!==r||a[10]!==d?(s=(0,n.jsx)("div",{"aria-label":c,className:e,"data-testid":d,role:"img",children:r}),a[7]=c,a[8]=e,a[9]=r,a[10]=d,a[11]=s):s=a[11],s},"w");function N(i,a){return{index:a,value:i}}u(N,"b");export{j as a};
@@ -1,3 +1,3 @@
1
- import{a as X}from"./chunk-CVSIFPI5.js";import{a as Q}from"./chunk-CBFVQCWS.js";import{d as O}from"./chunk-UG6ZNYWH.js";import{j as J}from"./chunk-SQO3WGXH.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import{a as R}from"./chunk-ECXQQPVU.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import"./chunk-DMQVY5L7.js";import"./chunk-LYVYUTQY.js";import"./chunk-LUHBGCMO.js";import"./chunk-PLCYDHU3.js";import"./chunk-WY23EROJ.js";import{B as H,s as Y,v as G}from"./chunk-G4H5DPO6.js";import"./chunk-JSVT5VBU.js";import{a as st}from"./chunk-A6TVTNKO.js";import{a as et,b as at}from"./chunk-ADABTCDI.js";import{a as u,d as V}from"./chunk-5PEAXTYQ.js";var B=V(st(),1);var d=V(at(),1);var z=V(et(),1);var nt=u(h=>{let t=(0,B.c)(28),{draft:e,onDraftChange:r,onSend:n,pending:a}=h,l=H(),s;t[0]!==l?(s=l("Ask about your data"),t[0]=l,t[1]=s):s=t[1];let o;t[2]!==r?(o=u(v=>{r(v.target.value)},"o"),t[2]=r,t[3]=o):o=t[3];let i;t[4]!==n?(i=u(v=>{v.key==="Enter"&&(v.preventDefault(),n())},"r"),t[4]=n,t[5]=i):i=t[5];let c;t[6]!==l?(c=l("Ask about your data"),t[6]=l,t[7]=c):c=t[7];let p;t[8]!==e||t[9]!==a||t[10]!==s||t[11]!==o||t[12]!==i||t[13]!==c?(p=(0,d.jsx)(J,{"aria-label":s,"data-testid":"assistant-input",disabled:a,onChange:o,onKeyDown:i,placeholder:c,value:e}),t[8]=e,t[9]=a,t[10]=s,t[11]=o,t[12]=i,t[13]=c,t[14]=p):p=t[14];let x;t[15]!==e||t[16]!==a?(x=a||e.trim()==="",t[15]=e,t[16]=a,t[17]=x):x=t[17];let m;t[18]!==a||t[19]!==l?(m=l(a?"Thinking\u2026":"Send"),t[18]=a,t[19]=l,t[20]=m):m=t[20];let f;t[21]!==n||t[22]!==x||t[23]!==m?(f=(0,d.jsx)(R,{"data-testid":"assistant-send",disabled:x,onClick:n,size:"xs",type:"button",children:m}),t[21]=n,t[22]=x,t[23]=m,t[24]=f):f=t[24];let g;return t[25]!==p||t[26]!==f?(g=(0,d.jsxs)("div",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[p,f]}),t[25]=p,t[26]=f,t[27]=g):g=t[27],g},"nt"),lt=u(h=>{let t=(0,B.c)(17),{onClose:e}=h,r=H(),n;t[0]!==r?(n=r("Assistant"),t[0]=r,t[1]=n):n=t[1];let a;t[2]!==n?(a=(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:n}),t[2]=n,t[3]=a):a=t[3];let l;t[4]!==r?(l=r("Answers are suggestions \u2014 nothing runs until you insert and run it."),t[4]=r,t[5]=l):l=t[5];let s;t[6]!==l?(s=(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l}),t[6]=l,t[7]=s):s=t[7];let o;t[8]!==r?(o=r("Close assistant"),t[8]=r,t[9]=o):o=t[9];let i;t[10]!==e||t[11]!==o?(i=(0,d.jsx)(R,{"aria-label":o,className:"ms-auto","data-testid":"assistant-close",onClick:e,size:"xs",type:"button",variant:"ghost",children:"\xD7"}),t[10]=e,t[11]=o,t[12]=i):i=t[12];let c;return t[13]!==a||t[14]!==s||t[15]!==i?(c=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[a,s,i]}),t[13]=a,t[14]=s,t[15]=i,t[16]=c):c=t[16],c},"lt"),ot={img:u(()=>null,"img")},Z=u(h=>{let t=(0,B.c)(2),{text:e}=h,r;return t[0]!==e?(r=(0,d.jsx)("div",{className:"prose-sm max-w-none text-xs","data-testid":"assistant-turn-body",children:(0,d.jsx)(O,{components:ot,children:e})}),t[0]=e,t[1]=r):r=t[1],r},"U"),_=u(h=>{let t=(0,B.c)(6),{children:e,label:r,testId:n}=h,a;t[0]!==r?(a=(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:r}),t[0]=r,t[1]=a):a=t[1];let l;return t[2]!==e||t[3]!==a||t[4]!==n?(l=(0,d.jsxs)("li",{className:"flex flex-col gap-1 border-b border-border px-3 py-2 last:border-b-0","data-testid":n,children:[a,e]}),t[2]=e,t[3]=a,t[4]=n,t[5]=l):l=t[5],l},"W"),rt=u(h=>{let t=(0,B.c)(7),{text:e}=h,r=H(),n;t[0]!==r?(n=r("Assistant"),t[0]=r,t[1]=n):n=t[1];let a;t[2]!==e?(a=(0,d.jsx)(Z,{text:e}),t[2]=e,t[3]=a):a=t[3];let l;return t[4]!==n||t[5]!==a?(l=(0,d.jsx)(_,{label:n,testId:"assistant-turn-live",children:a}),t[4]=n,t[5]=a,t[6]=l):l=t[6],l},"ot"),it=u(h=>{let t=(0,B.c)(20),{activeId:e,onDelete:r,onNew:n,onSelect:a,sessions:l}=h,s=H(),o;if(t[0]!==e||t[1]!==r||t[2]!==a||t[3]!==l||t[4]!==s){let x;t[6]!==e||t[7]!==r||t[8]!==a||t[9]!==l.length||t[10]!==s?(x=u(m=>(0,d.jsxs)("span",{className:"flex shrink-0 items-center",children:[(0,d.jsx)(R,{"data-testid":"assistant-session",onClick:u(()=>{a(m.id)},"onClick"),size:"xs",type:"button",variant:m.id===e?"secondary":"ghost",children:m.name}),l.length>1&&(0,d.jsx)(R,{"aria-label":s("Close chat"),"data-testid":"assistant-session-close",onClick:u(()=>{r(m.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:"\xD7"})]},m.id),"p"),t[6]=e,t[7]=r,t[8]=a,t[9]=l.length,t[10]=s,t[11]=x):x=t[11],o=l.map(x),t[0]=e,t[1]=r,t[2]=a,t[3]=l,t[4]=s,t[5]=o}else o=t[5];let i;t[12]!==s?(i=s("New chat"),t[12]=s,t[13]=i):i=t[13];let c;t[14]!==n||t[15]!==i?(c=(0,d.jsx)(R,{"aria-label":i,className:"shrink-0","data-testid":"assistant-session-new",onClick:n,size:"xs",type:"button",variant:"ghost",children:"+"}),t[14]=n,t[15]=i,t[16]=c):c=t[16];let p;return t[17]!==o||t[18]!==c?(p=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1 overflow-x-auto border-b border-border px-2 py-1","data-testid":"assistant-sessions",children:[o,c]}),t[17]=o,t[18]=c,t[19]=p):p=t[19],p},"at"),dt=u(h=>{let t=(0,B.c)(9),{reason:e,truncated:r}=h,n=H(),a;t[0]!==n||t[1]!==r?(a=r&&(0,d.jsx)("p",{className:"px-3 py-1 text-[11px] text-muted-foreground","data-testid":"assistant-truncated",children:n("Older turns were dropped to fit the context budget.")}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let l;t[3]!==e||t[4]!==n?(l=e!==void 0&&(0,d.jsx)("p",{className:"px-3 py-1 text-[11px] text-destructive","data-testid":"assistant-error",children:X(e,n)}),t[3]=e,t[4]=n,t[5]=l):l=t[5];let s;return t[6]!==a||t[7]!==l?(s=(0,d.jsxs)(d.Fragment,{children:[a,l]}),t[6]=a,t[7]=l,t[8]=s):s=t[8],s},"rt"),ct=u(h=>{let t=(0,B.c)(12),{onPick:e,suggestions:r}=h,n=H(),a;t[0]!==n?(a=n("Try asking"),t[0]=n,t[1]=a):a=t[1];let l;t[2]!==a?(l=(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:a}),t[2]=a,t[3]=l):l=t[3];let s;if(t[4]!==e||t[5]!==r){let i;t[7]!==e?(i=u(c=>(0,d.jsx)("button",{className:"self-start rounded-md border border-border px-2 py-1 text-start text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"assistant-suggestion",onClick:u(()=>{e(c)},"onClick"),type:"button",children:c},c),"r"),t[7]=e,t[8]=i):i=t[8],s=r.map(i),t[4]=e,t[5]=r,t[6]=s}else s=t[6];let o;return t[9]!==l||t[10]!==s?(o=(0,d.jsxs)("div",{className:"flex flex-col gap-1 px-3 py-2","data-testid":"assistant-suggestions",children:[l,s]}),t[9]=l,t[10]=s,t[11]=o):o=t[11],o},"dt"),L="```",ut=u(h=>{if(h.startsWith(L))return h.slice(L.length).trim().toLowerCase()==="sql"?"sql":"foreign"},"ct"),pt=u(h=>{let t=[],e=h.split(`
1
+ import{a as X}from"./chunk-CVSIFPI5.js";import{a as Q}from"./chunk-REZHNEUN.js";import{d as O}from"./chunk-YQJIG7QG.js";import{j as J}from"./chunk-4L2BABMS.js";import"./chunk-R76ATTPC.js";import"./chunk-4AG356VE.js";import{a as R}from"./chunk-LTWCT32V.js";import"./chunk-EOHXBC4U.js";import"./chunk-JEJV6SVN.js";import"./chunk-DMQVY5L7.js";import"./chunk-LYVYUTQY.js";import"./chunk-U7U4ADXH.js";import"./chunk-BD76RVBZ.js";import"./chunk-VKBLXJIZ.js";import{B as H,s as Y,v as G}from"./chunk-7EUM7G2I.js";import"./chunk-Z2ERBKWN.js";import{a as st}from"./chunk-A6TVTNKO.js";import{a as et,b as at}from"./chunk-ADABTCDI.js";import{a as u,d as V}from"./chunk-5PEAXTYQ.js";var B=V(st(),1);var d=V(at(),1);var z=V(et(),1);var nt=u(h=>{let t=(0,B.c)(28),{draft:e,onDraftChange:r,onSend:n,pending:a}=h,l=H(),s;t[0]!==l?(s=l("Ask about your data"),t[0]=l,t[1]=s):s=t[1];let o;t[2]!==r?(o=u(v=>{r(v.target.value)},"o"),t[2]=r,t[3]=o):o=t[3];let i;t[4]!==n?(i=u(v=>{v.key==="Enter"&&(v.preventDefault(),n())},"r"),t[4]=n,t[5]=i):i=t[5];let c;t[6]!==l?(c=l("Ask about your data"),t[6]=l,t[7]=c):c=t[7];let p;t[8]!==e||t[9]!==a||t[10]!==s||t[11]!==o||t[12]!==i||t[13]!==c?(p=(0,d.jsx)(J,{"aria-label":s,"data-testid":"assistant-input",disabled:a,onChange:o,onKeyDown:i,placeholder:c,value:e}),t[8]=e,t[9]=a,t[10]=s,t[11]=o,t[12]=i,t[13]=c,t[14]=p):p=t[14];let x;t[15]!==e||t[16]!==a?(x=a||e.trim()==="",t[15]=e,t[16]=a,t[17]=x):x=t[17];let m;t[18]!==a||t[19]!==l?(m=l(a?"Thinking\u2026":"Send"),t[18]=a,t[19]=l,t[20]=m):m=t[20];let f;t[21]!==n||t[22]!==x||t[23]!==m?(f=(0,d.jsx)(R,{"data-testid":"assistant-send",disabled:x,onClick:n,size:"xs",type:"button",children:m}),t[21]=n,t[22]=x,t[23]=m,t[24]=f):f=t[24];let g;return t[25]!==p||t[26]!==f?(g=(0,d.jsxs)("div",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[p,f]}),t[25]=p,t[26]=f,t[27]=g):g=t[27],g},"nt"),lt=u(h=>{let t=(0,B.c)(17),{onClose:e}=h,r=H(),n;t[0]!==r?(n=r("Assistant"),t[0]=r,t[1]=n):n=t[1];let a;t[2]!==n?(a=(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:n}),t[2]=n,t[3]=a):a=t[3];let l;t[4]!==r?(l=r("Answers are suggestions \u2014 nothing runs until you insert and run it."),t[4]=r,t[5]=l):l=t[5];let s;t[6]!==l?(s=(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l}),t[6]=l,t[7]=s):s=t[7];let o;t[8]!==r?(o=r("Close assistant"),t[8]=r,t[9]=o):o=t[9];let i;t[10]!==e||t[11]!==o?(i=(0,d.jsx)(R,{"aria-label":o,className:"ms-auto","data-testid":"assistant-close",onClick:e,size:"xs",type:"button",variant:"ghost",children:"\xD7"}),t[10]=e,t[11]=o,t[12]=i):i=t[12];let c;return t[13]!==a||t[14]!==s||t[15]!==i?(c=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[a,s,i]}),t[13]=a,t[14]=s,t[15]=i,t[16]=c):c=t[16],c},"lt"),ot={img:u(()=>null,"img")},Z=u(h=>{let t=(0,B.c)(2),{text:e}=h,r;return t[0]!==e?(r=(0,d.jsx)("div",{className:"prose-sm max-w-none text-xs","data-testid":"assistant-turn-body",children:(0,d.jsx)(O,{components:ot,children:e})}),t[0]=e,t[1]=r):r=t[1],r},"U"),_=u(h=>{let t=(0,B.c)(6),{children:e,label:r,testId:n}=h,a;t[0]!==r?(a=(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:r}),t[0]=r,t[1]=a):a=t[1];let l;return t[2]!==e||t[3]!==a||t[4]!==n?(l=(0,d.jsxs)("li",{className:"flex flex-col gap-1 border-b border-border px-3 py-2 last:border-b-0","data-testid":n,children:[a,e]}),t[2]=e,t[3]=a,t[4]=n,t[5]=l):l=t[5],l},"W"),rt=u(h=>{let t=(0,B.c)(7),{text:e}=h,r=H(),n;t[0]!==r?(n=r("Assistant"),t[0]=r,t[1]=n):n=t[1];let a;t[2]!==e?(a=(0,d.jsx)(Z,{text:e}),t[2]=e,t[3]=a):a=t[3];let l;return t[4]!==n||t[5]!==a?(l=(0,d.jsx)(_,{label:n,testId:"assistant-turn-live",children:a}),t[4]=n,t[5]=a,t[6]=l):l=t[6],l},"ot"),it=u(h=>{let t=(0,B.c)(20),{activeId:e,onDelete:r,onNew:n,onSelect:a,sessions:l}=h,s=H(),o;if(t[0]!==e||t[1]!==r||t[2]!==a||t[3]!==l||t[4]!==s){let x;t[6]!==e||t[7]!==r||t[8]!==a||t[9]!==l.length||t[10]!==s?(x=u(m=>(0,d.jsxs)("span",{className:"flex shrink-0 items-center",children:[(0,d.jsx)(R,{"data-testid":"assistant-session",onClick:u(()=>{a(m.id)},"onClick"),size:"xs",type:"button",variant:m.id===e?"secondary":"ghost",children:m.name}),l.length>1&&(0,d.jsx)(R,{"aria-label":s("Close chat"),"data-testid":"assistant-session-close",onClick:u(()=>{r(m.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:"\xD7"})]},m.id),"p"),t[6]=e,t[7]=r,t[8]=a,t[9]=l.length,t[10]=s,t[11]=x):x=t[11],o=l.map(x),t[0]=e,t[1]=r,t[2]=a,t[3]=l,t[4]=s,t[5]=o}else o=t[5];let i;t[12]!==s?(i=s("New chat"),t[12]=s,t[13]=i):i=t[13];let c;t[14]!==n||t[15]!==i?(c=(0,d.jsx)(R,{"aria-label":i,className:"shrink-0","data-testid":"assistant-session-new",onClick:n,size:"xs",type:"button",variant:"ghost",children:"+"}),t[14]=n,t[15]=i,t[16]=c):c=t[16];let p;return t[17]!==o||t[18]!==c?(p=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1 overflow-x-auto border-b border-border px-2 py-1","data-testid":"assistant-sessions",children:[o,c]}),t[17]=o,t[18]=c,t[19]=p):p=t[19],p},"at"),dt=u(h=>{let t=(0,B.c)(9),{reason:e,truncated:r}=h,n=H(),a;t[0]!==n||t[1]!==r?(a=r&&(0,d.jsx)("p",{className:"px-3 py-1 text-[11px] text-muted-foreground","data-testid":"assistant-truncated",children:n("Older turns were dropped to fit the context budget.")}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let l;t[3]!==e||t[4]!==n?(l=e!==void 0&&(0,d.jsx)("p",{className:"px-3 py-1 text-[11px] text-destructive","data-testid":"assistant-error",children:X(e,n)}),t[3]=e,t[4]=n,t[5]=l):l=t[5];let s;return t[6]!==a||t[7]!==l?(s=(0,d.jsxs)(d.Fragment,{children:[a,l]}),t[6]=a,t[7]=l,t[8]=s):s=t[8],s},"rt"),ct=u(h=>{let t=(0,B.c)(12),{onPick:e,suggestions:r}=h,n=H(),a;t[0]!==n?(a=n("Try asking"),t[0]=n,t[1]=a):a=t[1];let l;t[2]!==a?(l=(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:a}),t[2]=a,t[3]=l):l=t[3];let s;if(t[4]!==e||t[5]!==r){let i;t[7]!==e?(i=u(c=>(0,d.jsx)("button",{className:"self-start rounded-md border border-border px-2 py-1 text-start text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"assistant-suggestion",onClick:u(()=>{e(c)},"onClick"),type:"button",children:c},c),"r"),t[7]=e,t[8]=i):i=t[8],s=r.map(i),t[4]=e,t[5]=r,t[6]=s}else s=t[6];let o;return t[9]!==l||t[10]!==s?(o=(0,d.jsxs)("div",{className:"flex flex-col gap-1 px-3 py-2","data-testid":"assistant-suggestions",children:[l,s]}),t[9]=l,t[10]=s,t[11]=o):o=t[11],o},"dt"),L="```",ut=u(h=>{if(h.startsWith(L))return h.slice(L.length).trim().toLowerCase()==="sql"?"sql":"foreign"},"ct"),pt=u(h=>{let t=[],e=h.split(`
2
2
  `),r,n=!1;for(let a of e){let l=a.trim();if(n){n=l!==L;continue}if(r===void 0){let s=ut(l);s==="sql"?r=[]:s==="foreign"&&(n=!0);continue}if(l===L){let s=r.join(`
3
3
  `).trim();s!==""&&t.push(s),r=void 0;continue}r.push(a)}return t},"ft"),mt=u(h=>{let t=(0,B.c)(29),{approval:e,onDecide:r}=h,n=H(),a;t[0]!==n?(a=n("The assistant wants to read rows before answering. Nothing runs until you allow it."),t[0]=n,t[1]=a):a=t[1];let l;t[2]!==a?(l=(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:a}),t[2]=a,t[3]=l):l=t[3];let s;t[4]!==e.sql?(s=(0,d.jsx)("pre",{className:"overflow-x-auto rounded bg-background p-1.5 font-mono text-[11px]","data-testid":"assistant-approval-sql",children:e.sql}),t[4]=e.sql,t[5]=s):s=t[5];let o;t[6]!==e||t[7]!==r?(o=u(()=>{r(!0,e)},"o"),t[6]=e,t[7]=r,t[8]=o):o=t[8];let i;t[9]!==n?(i=n("Allow"),t[9]=n,t[10]=i):i=t[10];let c;t[11]!==o||t[12]!==i?(c=(0,d.jsx)(R,{"data-testid":"assistant-approval-allow",onClick:o,size:"xs",type:"button",children:i}),t[11]=o,t[12]=i,t[13]=c):c=t[13];let p;t[14]!==e||t[15]!==r?(p=u(()=>{r(!1,e)},"f"),t[14]=e,t[15]=r,t[16]=p):p=t[16];let x;t[17]!==n?(x=n("Deny"),t[17]=n,t[18]=x):x=t[18];let m;t[19]!==p||t[20]!==x?(m=(0,d.jsx)(R,{"data-testid":"assistant-approval-deny",onClick:p,size:"xs",type:"button",variant:"secondary",children:x}),t[19]=p,t[20]=x,t[21]=m):m=t[21];let f;t[22]!==c||t[23]!==m?(f=(0,d.jsxs)("div",{className:"flex gap-2",children:[c,m]}),t[22]=c,t[23]=m,t[24]=f):f=t[24];let g;return t[25]!==f||t[26]!==l||t[27]!==s?(g=(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-md border border-border bg-muted/40 p-2","data-testid":"assistant-approval",children:[l,s,f]}),t[25]=f,t[26]=l,t[27]=s,t[28]=g):g=t[28],g},"ut"),xt=u(h=>{let t=(0,B.c)(15),{level:e,turn:r}=h,n=H(),a;t[0]!==r.toolCalls?(a=r.toolCalls??[],t[0]=r.toolCalls,t[1]=a):a=t[1];let l=a;if(l.length===0&&r.partial!==!0)return null;let s;if(t[2]!==l||t[3]!==e||t[4]!==n){let c;t[6]!==e||t[7]!==n?(c=u((p,x)=>(0,d.jsxs)("li",{children:[(0,d.jsx)("span",{className:"font-mono",children:p.name??n("(no such tool)")}),p.sql===void 0?null:(0,d.jsx)("span",{className:"ms-1 font-mono opacity-80",children:p.sql}),p.refused===void 0?null:(0,d.jsx)("span",{className:"ms-1 text-destructive",children:n("refused")}),p.needs===void 0?null:(0,d.jsx)("span",{className:"block text-muted-foreground","data-testid":"assistant-tool-needs",children:n("Needs the {needs} data-sharing level; this deployment is set to {level}. Change LUNORA_AI_OPT_IN in wrangler.jsonc.",{level:e??n("a lower level"),needs:p.needs})})]},`${String(x)}:${p.name??"?"}`),"d"),t[6]=e,t[7]=n,t[8]=c):c=t[8],s=l.map(c),t[2]=l,t[3]=e,t[4]=n,t[5]=s}else s=t[5];let o;t[9]!==n||t[10]!==r.partial?(o=r.partial===!0&&(0,d.jsx)("li",{"data-testid":"assistant-turn-partial",children:n("Stopped early \u2014 this answer is incomplete.")}),t[9]=n,t[10]=r.partial,t[11]=o):o=t[11];let i;return t[12]!==s||t[13]!==o?(i=(0,d.jsxs)("ul",{className:"flex flex-col gap-0.5 border-s border-border ps-2 text-[11px] text-muted-foreground","data-testid":"assistant-tool-calls",children:[s,o]}),t[12]=s,t[13]=o,t[14]=i):i=t[14],i},"pt"),ht=u(h=>{let t=(0,B.c)(60),{index:e,level:r,onBranch:n,onDecide:a,onInsert:l,onTruncate:s,turn:o}=h,i=H(),c,p,x,m,f;if(t[0]!==l||t[1]!==i||t[2]!==o.role||t[3]!==o.text){let $=o.role==="assistant"&&l!==void 0?pt(o.text):[];c=_,t[9]!==i||t[10]!==o.role?(p=o.role==="user"?i("You"):i("Assistant"),t[9]=i,t[10]=o.role,t[11]=p):p=t[11],x=`assistant-turn-${o.role}`,t[12]!==o.role||t[13]!==o.text?(m=o.role==="assistant"?(0,d.jsx)(Z,{text:o.text}):(0,d.jsx)("p",{className:"text-xs whitespace-pre-wrap","data-testid":"assistant-turn-body",children:o.text}),t[12]=o.role,t[13]=o.text,t[14]=m):m=t[14];let F;t[15]!==l||t[16]!==i?(F=u((T,j)=>(0,d.jsx)(R,{className:"self-start","data-testid":"assistant-insert",onClick:u(()=>{l?.(T)},"onClick"),size:"xs",type:"button",variant:"secondary",children:i("Insert into editor")},`${String(j)}:${T.slice(0,32)}`),"R"),t[15]=l,t[16]=i,t[17]=F):F=t[17],f=$.map(F),t[0]=l,t[1]=i,t[2]=o.role,t[3]=o.text,t[4]=c,t[5]=p,t[6]=x,t[7]=m,t[8]=f}else c=t[4],p=t[5],x=t[6],m=t[7],f=t[8];let g;t[18]!==a||t[19]!==o.pendingApproval?(g=o.pendingApproval!==void 0&&a!==void 0&&(0,d.jsx)(mt,{approval:o.pendingApproval,onDecide:a}),t[18]=a,t[19]=o.pendingApproval,t[20]=g):g=t[20];let v;t[21]!==r||t[22]!==o?(v=o.role==="assistant"&&(0,d.jsx)(xt,{level:r,turn:o}),t[21]=r,t[22]=o,t[23]=v):v=t[23];let S;t[24]!==o.text?(S=u(()=>{G(o.text)},"q"),t[24]=o.text,t[25]=S):S=t[25];let q;t[26]!==i?(q=i("Copy"),t[26]=i,t[27]=q):q=t[27];let k;t[28]!==S||t[29]!==q?(k=(0,d.jsx)("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"assistant-copy",onClick:S,type:"button",children:q}),t[28]=S,t[29]=q,t[30]=k):k=t[30];let y;t[31]!==e||t[32]!==n?(y=u(()=>{n(e)},"y"),t[31]=e,t[32]=n,t[33]=y):y=t[33];let b;t[34]!==i?(b=i("Branch from here"),t[34]=i,t[35]=b):b=t[35];let w;t[36]!==y||t[37]!==b?(w=(0,d.jsx)("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"assistant-branch",onClick:y,type:"button",children:b}),t[36]=y,t[37]=b,t[38]=w):w=t[38];let N;t[39]!==e||t[40]!==s?(N=u(()=>{s(e)},"k"),t[39]=e,t[40]=s,t[41]=N):N=t[41];let I;t[42]!==i?(I=i("Delete from here"),t[42]=i,t[43]=I):I=t[43];let A;t[44]!==N||t[45]!==I?(A=(0,d.jsx)("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"assistant-truncate",onClick:N,type:"button",children:I}),t[44]=N,t[45]=I,t[46]=A):A=t[46];let C;t[47]!==w||t[48]!==A||t[49]!==k?(C=(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[k,w,A]}),t[47]=w,t[48]=A,t[49]=k,t[50]=C):C=t[50];let P;return t[51]!==c||t[52]!==p||t[53]!==C||t[54]!==x||t[55]!==m||t[56]!==f||t[57]!==g||t[58]!==v?(P=(0,d.jsxs)(c,{label:p,testId:x,children:[m,f,g,v,C]}),t[51]=c,t[52]=p,t[53]=C,t[54]=x,t[55]=m,t[56]=f,t[57]=g,t[58]=v,t[59]=P):P=t[59],P},"ht"),ft=u(({assistant:h,ops:t,session:e})=>{let[r,n]=(0,z.useState)(""),[a,l]=(0,z.useState)(e?.id);e?.id!==a&&(l(e?.id),n(""));let[s,o]=(0,z.useState)(void 0),[i,c]=(0,z.useState)(void 0),[p,x]=(0,z.useState)(void 0),[m,f]=(0,z.useState)(void 0),g=(0,z.useRef)(void 0);(0,z.useEffect)(()=>()=>{g.current?.abort()},[]);let v=t.pending("chat"),S=t.reason("chat"),{setTurns:q,takeAsk:k,unavailable:y}=h,b=e?.id,w=S==="ai-disabled"||S==="no-ai-binding"||p===b?S:void 0,N=u(T=>{b!==void 0&&h.branchFrom(b,T)},"k"),I=u(T=>{b!==void 0&&h.truncateFrom(b,T)},"A"),A=u((T,j,K)=>{if(T===""||v||g.current!==void 0||e===void 0)return;let E=new AbortController;g.current=E;let W={role:"user",text:T},tt=[...j,W];q(e.id,tt),o({sessionId:e.id,text:""}),x(e.id),Y(t.chat(T,j.map(D=>({role:D.role,text:D.text})),e.schema,K,D=>{o(M=>M?.sessionId===e.id?{sessionId:e.id,text:D.type==="delta"?`${M.text}${D.text}`:""}:M)},E.signal).then(D=>{if(D!==void 0&&!E.signal.aborted){c(D.truncated?e.id:void 0);let M={partial:D.partial,...D.pendingApproval===void 0?{}:{pendingApproval:D.pendingApproval},role:"assistant",text:D.reply,toolCalls:D.toolCalls};q(e.id,U=>U.at(-1)===W?[...U,M]:U)}return D}).finally(()=>{g.current=void 0,o(void 0)}))},"I"),C=u(T=>{let j=(T??r).trim();j===""||v||g.current!==void 0||e===void 0||(n(""),A(j,e.turns))},"C"),P=u((T,j)=>{if(e===void 0||v||g.current!==void 0)return;let K=e.turns.slice(0,-1),E=K.at(-1);E?.role==="user"&&A(E.text,K.slice(0,-1),{allow:T,sql:j.sql,ticket:j.ticket})},"F"),$=h.draft;$!==void 0&&$.id!==m&&(f($.id),n($.text));let F=h.pendingAsk;return(0,z.useEffect)(()=>{F===void 0||F.sessionId!==b||v||y||(k(F.id),queueMicrotask(()=>{C(F.text)}))},[F,b,k,v,y]),{branchHere:N,decide:P,draft:r,live:s,pending:v,reason:w,send:C,setDraft:n,truncatedFor:i,truncateHere:I}},"mt"),Zt=u(h=>{let t=(0,B.c)(39),{assistant:e}=h,r=H(),n;t[0]!==e.activeId?(n=u(C=>C.id===e.activeId,"l"),t[0]=e.activeId,t[1]=n):n=t[1];let a=e.sessions.find(n),l=Q(a?.shardKey??""),s=ft({assistant:e,ops:l,session:a});if(l.unavailable||a===void 0)return null;let{turns:o}=a,i;t[2]!==r?(i=r("Assistant"),t[2]=r,t[3]=i):i=t[3];let c="flex h-full w-96 min-w-0 shrink-0 flex-col border-s border-border bg-card",p="assistant-panel",x;t[4]!==e.close?(x=(0,d.jsx)(lt,{onClose:e.close}),t[4]=e.close,t[5]=x):x=t[5];let m;t[6]!==e||t[7]!==r?(m=u(()=>{e.newChat({title:r("New chat")})},"u"),t[6]=e,t[7]=r,t[8]=m):m=t[8];let f;t[9]!==e.activeId||t[10]!==e.deleteChat||t[11]!==e.selectChat||t[12]!==e.sessions||t[13]!==m?(f=(0,d.jsx)(it,{activeId:e.activeId,onDelete:e.deleteChat,onNew:m,onSelect:e.selectChat,sessions:e.sessions}),t[9]=e.activeId,t[10]=e.deleteChat,t[11]=e.selectChat,t[12]=e.sessions,t[13]=m,t[14]=f):f=t[14];let g=o.length===0&&a.suggestions.length>0&&(0,d.jsx)(ct,{onPick:u(C=>{s.send(C)},"onPick"),suggestions:a.suggestions}),v="min-h-0 flex-1 overflow-y-auto",S="assistant-turns",q=o.map((C,P)=>(0,d.jsx)(ht,{index:P,level:l.level,onBranch:s.branchHere,onDecide:P===o.length-1?s.decide:void 0,onInsert:e.hasEditor?e.requestInsert:void 0,onTruncate:s.truncateHere,turn:C},`${String(P)}:${C.role}`)),k;t[15]!==s.live||t[16]!==a.id?(k=s.live?.sessionId===a.id&&s.live.text!==""&&(0,d.jsx)(rt,{text:s.live.text}),t[15]=s.live,t[16]=a.id,t[17]=k):k=t[17];let y;t[18]!==q||t[19]!==k?(y=(0,d.jsxs)("ul",{className:v,"data-testid":S,children:[q,k]}),t[18]=q,t[19]=k,t[20]=y):y=t[20];let b=s.truncatedFor===a.id,w;t[21]!==s.reason||t[22]!==b?(w=(0,d.jsx)(dt,{reason:s.reason,truncated:b}),t[21]=s.reason,t[22]=b,t[23]=w):w=t[23];let N;t[24]!==s?(N=u(()=>{s.send()},"k"),t[24]=s,t[25]=N):N=t[25];let I;t[26]!==s.draft||t[27]!==s.pending||t[28]!==s.setDraft||t[29]!==N?(I=(0,d.jsx)(nt,{draft:s.draft,onDraftChange:s.setDraft,onSend:N,pending:s.pending}),t[26]=s.draft,t[27]=s.pending,t[28]=s.setDraft,t[29]=N,t[30]=I):I=t[30];let A;return t[31]!==y||t[32]!==w||t[33]!==I||t[34]!==i||t[35]!==x||t[36]!==f||t[37]!==g?(A=(0,d.jsxs)("section",{"aria-label":i,className:c,"data-testid":p,children:[x,f,g,y,w,I]}),t[31]=y,t[32]=w,t[33]=I,t[34]=i,t[35]=x,t[36]=f,t[37]=g,t[38]=A):A=t[38],A},"It");export{Zt as default};