@lunora/studio 1.0.0-alpha.383 → 1.0.0-alpha.384

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 (68) hide show
  1. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  2. package/dist/standalone/{chunk-D3MLU3PX.js → chunk-2G5OZPH5.js} +1 -1
  3. package/dist/standalone/{chunk-JPBTM43K.js → chunk-2HJOQZQ5.js} +1 -1
  4. package/dist/standalone/{chunk-I33WWIBV.js → chunk-3MU55LYE.js} +1 -1
  5. package/dist/standalone/{chunk-APYV4J3H.js → chunk-3O5KRHWI.js} +1 -1
  6. package/dist/standalone/{chunk-IPRJMLLL.js → chunk-42U2JUGB.js} +1 -1
  7. package/dist/standalone/{chunk-PUQ3LURH.js → chunk-4JR7B43V.js} +1 -1
  8. package/dist/standalone/{chunk-YNYH4P7E.js → chunk-4VF4BIOZ.js} +1 -1
  9. package/dist/standalone/{chunk-EU3IVSBQ.js → chunk-6U3PB43O.js} +1 -1
  10. package/dist/standalone/{chunk-7O6F7GJ2.js → chunk-6WNYDTK5.js} +1 -1
  11. package/dist/standalone/{chunk-Q6MWEK4M.js → chunk-7MPWIS3R.js} +1 -1
  12. package/dist/standalone/{chunk-7OMB6F3L.js → chunk-7QZQZYJT.js} +1 -1
  13. package/dist/standalone/{chunk-NIIWN6ZY.js → chunk-7THIXUEZ.js} +1 -1
  14. package/dist/standalone/{chunk-BCD7WQYW.js → chunk-B2EUIUL5.js} +1 -1
  15. package/dist/standalone/{chunk-MT3K66QU.js → chunk-BN6JGS64.js} +1 -1
  16. package/dist/standalone/{chunk-SFZ6IAL2.js → chunk-BZ6CJVEW.js} +1 -1
  17. package/dist/standalone/{chunk-BIEYPLQZ.js → chunk-C56YDP56.js} +1 -1
  18. package/dist/standalone/{chunk-XUSA5BXI.js → chunk-CSDAZN5R.js} +1 -1
  19. package/dist/standalone/chunk-DJNEJ3BZ.js +1 -0
  20. package/dist/standalone/{chunk-FKY2ID3J.js → chunk-DVTU6UE5.js} +1 -1
  21. package/dist/standalone/{chunk-FYSSF7AJ.js → chunk-DZZ3N75F.js} +1 -1
  22. package/dist/standalone/{chunk-E52THCJJ.js → chunk-E6KWXZCK.js} +1 -1
  23. package/dist/standalone/{chunk-WSJTPPUQ.js → chunk-EFTLHOFA.js} +1 -1
  24. package/dist/standalone/{chunk-DKTTK2SX.js → chunk-EZ2K57JT.js} +1 -1
  25. package/dist/standalone/{chunk-VKX7HSAS.js → chunk-FJ43BFJ4.js} +1 -1
  26. package/dist/standalone/{chunk-CNALVIPZ.js → chunk-FQRAKX6V.js} +1 -1
  27. package/dist/standalone/{chunk-WKRUXQXB.js → chunk-FUPX23QR.js} +1 -1
  28. package/dist/standalone/{chunk-ABY6J4SX.js → chunk-GX2UAEGW.js} +1 -1
  29. package/dist/standalone/{chunk-ZO6OZV4D.js → chunk-H2ZCM66S.js} +1 -1
  30. package/dist/standalone/{chunk-PXDQGWZR.js → chunk-HJ7QDXCT.js} +1 -1
  31. package/dist/standalone/{chunk-J5SYXVIK.js → chunk-I37NPLQI.js} +1 -1
  32. package/dist/standalone/{chunk-YDDMKWPI.js → chunk-IR2MDKXQ.js} +1 -1
  33. package/dist/standalone/{chunk-N2XUTYZJ.js → chunk-ISTQIPTN.js} +1 -1
  34. package/dist/standalone/{chunk-TQH2BN2P.js → chunk-IUUXVNAP.js} +1 -1
  35. package/dist/standalone/{chunk-Q4SE33KY.js → chunk-KCSVWLPM.js} +1 -1
  36. package/dist/standalone/{chunk-UN3QTZ6X.js → chunk-KE7ZGUGO.js} +1 -1
  37. package/dist/standalone/{chunk-HPTF52JF.js → chunk-KSATOQ6G.js} +1 -1
  38. package/dist/standalone/{chunk-PQB2QX4Q.js → chunk-L34AGC7Z.js} +1 -1
  39. package/dist/standalone/{chunk-G7GMOSDG.js → chunk-LLSKRNQ5.js} +1 -1
  40. package/dist/standalone/{chunk-WDQDRE4G.js → chunk-LQJQDJNH.js} +1 -1
  41. package/dist/standalone/{chunk-OVMZ7DXR.js → chunk-LVU6W6MM.js} +1 -1
  42. package/dist/standalone/{chunk-7YHT6DLF.js → chunk-MBCU5GIY.js} +1 -1
  43. package/dist/standalone/{chunk-WEZRVKSV.js → chunk-MCDKIVLH.js} +1 -1
  44. package/dist/standalone/{chunk-2IYIVCPN.js → chunk-MIDNWFNN.js} +1 -1
  45. package/dist/standalone/{chunk-SI5L5HDG.js → chunk-MMLEHOX7.js} +1 -1
  46. package/dist/standalone/{chunk-7JIVSWQM.js → chunk-O2HPBDEC.js} +1 -1
  47. package/dist/standalone/{chunk-6NZOJI3N.js → chunk-O4BQMWIN.js} +1 -1
  48. package/dist/standalone/{chunk-5CHKXJYN.js → chunk-PSBRO6JX.js} +1 -1
  49. package/dist/standalone/{chunk-V3A3775O.js → chunk-R6ZR7FZZ.js} +1 -1
  50. package/dist/standalone/{chunk-5IOQXXYH.js → chunk-SM3PFHGD.js} +1 -1
  51. package/dist/standalone/{chunk-HI3U4W6T.js → chunk-SSFKYC7M.js} +1 -1
  52. package/dist/standalone/{chunk-LFVPR2JB.js → chunk-SYOJ4TRA.js} +1 -1
  53. package/dist/standalone/chunk-UK5OOCLQ.js +7 -0
  54. package/dist/standalone/{chunk-UHF224OV.js → chunk-V6JMOE7W.js} +1 -1
  55. package/dist/standalone/{chunk-IW5TW36H.js → chunk-V7W37FDL.js} +1 -1
  56. package/dist/standalone/chunk-VEKOLZ4X.js +1 -0
  57. package/dist/standalone/{chunk-PAGLAE5H.js → chunk-VLAEMGPY.js} +1 -1
  58. package/dist/standalone/{chunk-7HIZZYHW.js → chunk-WSYQMHC4.js} +1 -1
  59. package/dist/standalone/{chunk-C6NIFA7C.js → chunk-WXV3KCFJ.js} +1 -1
  60. package/dist/standalone/{chunk-6OIS24US.js → chunk-XD5CKMBE.js} +1 -1
  61. package/dist/standalone/{chunk-SBJ4LWXW.js → chunk-XWEMSCUN.js} +1 -1
  62. package/dist/standalone/{chunk-GB7MHA6L.js → chunk-YGSVIF7L.js} +1 -1
  63. package/dist/standalone/{chunk-IEOOQ2NW.js → chunk-ZYQQJ5FK.js} +1 -1
  64. package/dist/standalone/studio.js +1 -1
  65. package/package.json +1 -1
  66. package/dist/standalone/chunk-5KQSRLQP.js +0 -7
  67. package/dist/standalone/chunk-7VZFX5O4.js +0 -1
  68. package/dist/standalone/chunk-OEHBCBV4.js +0 -1
@@ -1 +1 @@
1
- import{i as G}from"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as E}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as Q}from"./chunk-S3TDGFRE.js";import{b as $}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as X}from"./chunk-D3MLU3PX.js";import"./chunk-S7NFUY75.js";import{a as Y,b as Z,c as ee,d as V,e as c,f as d}from"./chunk-J3ZEO3PJ.js";import"./chunk-YDDMKWPI.js";import"./chunk-5CHKXJYN.js";import"./chunk-EOFWXI3T.js";import{a as U}from"./chunk-LYVYUTQY.js";import{c as O}from"./chunk-UN3QTZ6X.js";import{a as J,e as K}from"./chunk-TN4Z3P6S.js";import"./chunk-5KQSRLQP.js";import"./chunk-ZPQBVYNN.js";import{B as q,w as H}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as le}from"./chunk-A6TVTNKO.js";import{a as oe,b as ce}from"./chunk-ADABTCDI.js";import{a as s,d as R}from"./chunk-5PEAXTYQ.js";var te=R(le(),1),j=R(oe(),1);var t=R(ce(),1);var re=s(e=>e.endpoint??e.id,"V"),de=s((e,r,i,z)=>{let n=i.trim().toLowerCase(),y=[],o=[];for(let l of e){let m=r==="all"||l.kind===r,h=n===""||`${re(l)} ${l.userId??""}`.toLowerCase().includes(n);m&&h&&(y.push(l),l.lastStatus==="failed"&&o.push(l))}return{failing:o,filtered:z?o:y}},"ie"),me=s(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","oe"),Ce=s(()=>{let e=(0,te.c)(40),r=q(),[i,z]=(0,j.useState)("all"),[n,y]=(0,j.useState)(""),[o,l]=(0,j.useState)(!1),m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={},e[0]=m):m=e[0];let{data:h,error:u,errorSource:k,isLoading:B,refetch:w}=O(U.listPushSubscriptions,m),C;if(e[1]!==h||e[2]!==u||e[3]!==k||e[4]!==o||e[5]!==B||e[6]!==i||e[7]!==w||e[8]!==n||e[9]!==r){let f=h?.subscriptions??[],ae=f.length>=1e3,{failing:se,filtered:F}=de(f,i,n,o),W=se.length,S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=s(a=>{y(a.target.value)},"S"),e[11]=S):S=e[11];let ie=S,I;e[12]!==w?(I=s(()=>{w()},"T"),e[12]=w,e[13]=I):I=e[13];let M=I,_;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=["all","web-push","fcm"],e[14]=_):_=e[14];let ne=_,p;e[15]!==i||e[16]!==r?(p=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:ne.map(a=>(0,t.jsx)(E,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:s(()=>{z(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[15]=i,e[16]=r,e[17]=p):p=e[17];let T=h!==void 0&&(0,t.jsx)(E,{"aria-pressed":o,"data-testid":"nt-failing-filter",onClick:s(()=>{l(he)},"onClick"),size:"sm",type:"button",variant:o?"secondary":"ghost",children:ae?r("{count}+ failing",{count:W}):r("{count} failing",{count:W})}),g;e[18]!==r?(g=r("Filter devices"),e[18]=r,e[19]=g):g=e[19];let v;e[20]!==r?(v=r("filter endpoint, user"),e[20]=r,e[21]=v):v=e[21];let x;e[22]!==n||e[23]!==g||e[24]!==v?(x=(0,t.jsx)(G,{"aria-label":g,className:"h-8 w-56","data-testid":"nt-search",onChange:ie,placeholder:v,value:n}),e[22]=n,e[23]=g,e[24]=v,e[25]=x):x=e[25];let N;e[26]!==r?(N=r("Refresh"),e[26]=r,e[27]=N):N=e[27];let b;e[28]!==M||e[29]!==N?(b=(0,t.jsx)(E,{className:"ml-auto","data-testid":"nt-refresh",onClick:M,size:"sm",type:"button",variant:"outline",children:N}),e[28]=M,e[29]=N,e[30]=b):b=e[30];let P=f.length>0&&(0,t.jsx)($,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:f.length})}),L;e[31]!==b||e[32]!==P||e[33]!==p||e[34]!==T||e[35]!==x?(L=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,T,x,b,P]}),e[31]=b,e[32]=P,e[33]=p,e[34]=T,e[35]=x,e[36]=L):L=e[36];let A;e[37]!==u||e[38]!==k?(A=u!==null&&(0,t.jsx)(X,{error:k,testId:"nt-error"}),e[37]=u,e[38]=k,e[39]=A):A=e[39],C=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[L,A,u===null&&!B&&F.length===0&&(0,t.jsx)(Q,{description:f.length>0?r("No device matches the current kind, search or failing filter."):r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:f.length>0?r("No matching devices."):r("No registered devices.")}),F.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(Y,{"data-testid":"nt-table",children:[(0,t.jsx)(Z,{children:(0,t.jsxs)(V,{children:[(0,t.jsx)(c,{children:r("kind")}),(0,t.jsx)(c,{children:r("endpoint")}),(0,t.jsx)(c,{children:r("user")}),(0,t.jsx)(c,{children:r("last seen")}),(0,t.jsx)(c,{children:r("status")}),(0,t.jsx)(c,{children:r("error")})]})}),(0,t.jsx)(ee,{children:F.map(a=>{let D=re(a);return(0,t.jsxs)(V,{"data-testid":"nt-row",children:[(0,t.jsx)(d,{children:(0,t.jsx)($,{variant:"outline",children:a.kind})}),(0,t.jsx)(d,{className:"max-w-[28ch] truncate font-mono text-xs",title:D,children:D}),(0,t.jsx)(d,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(d,{className:"text-muted-foreground tabular-nums",children:H(a.lastSeenAt,"\u2014")}),(0,t.jsx)(d,{children:(0,t.jsx)($,{"data-testid":`nt-status-${a.id}`,variant:me(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(d,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=h,e[2]=u,e[3]=k,e[4]=o,e[5]=B,e[6]=i,e[7]=w,e[8]=n,e[9]=r,e[10]=C}else C=e[10];return C},"ke");function he(e){return!e}s(he,"le");export{Ce as default};
1
+ import{i as G}from"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as E}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as Q}from"./chunk-S3TDGFRE.js";import{b as $}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as X}from"./chunk-2G5OZPH5.js";import"./chunk-S7NFUY75.js";import{a as Y,b as Z,c as ee,d as V,e as c,f as d}from"./chunk-J3ZEO3PJ.js";import"./chunk-IR2MDKXQ.js";import"./chunk-PSBRO6JX.js";import"./chunk-EOFWXI3T.js";import{a as U}from"./chunk-LYVYUTQY.js";import{c as O}from"./chunk-KE7ZGUGO.js";import{a as J,e as K}from"./chunk-TN4Z3P6S.js";import"./chunk-UK5OOCLQ.js";import"./chunk-ZPQBVYNN.js";import{B as q,w as H}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as le}from"./chunk-A6TVTNKO.js";import{a as oe,b as ce}from"./chunk-ADABTCDI.js";import{a as s,d as R}from"./chunk-5PEAXTYQ.js";var te=R(le(),1),j=R(oe(),1);var t=R(ce(),1);var re=s(e=>e.endpoint??e.id,"V"),de=s((e,r,i,z)=>{let n=i.trim().toLowerCase(),y=[],o=[];for(let l of e){let m=r==="all"||l.kind===r,h=n===""||`${re(l)} ${l.userId??""}`.toLowerCase().includes(n);m&&h&&(y.push(l),l.lastStatus==="failed"&&o.push(l))}return{failing:o,filtered:z?o:y}},"ie"),me=s(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","oe"),Ce=s(()=>{let e=(0,te.c)(40),r=q(),[i,z]=(0,j.useState)("all"),[n,y]=(0,j.useState)(""),[o,l]=(0,j.useState)(!1),m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={},e[0]=m):m=e[0];let{data:h,error:u,errorSource:k,isLoading:B,refetch:w}=O(U.listPushSubscriptions,m),C;if(e[1]!==h||e[2]!==u||e[3]!==k||e[4]!==o||e[5]!==B||e[6]!==i||e[7]!==w||e[8]!==n||e[9]!==r){let f=h?.subscriptions??[],ae=f.length>=1e3,{failing:se,filtered:F}=de(f,i,n,o),W=se.length,S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=s(a=>{y(a.target.value)},"S"),e[11]=S):S=e[11];let ie=S,I;e[12]!==w?(I=s(()=>{w()},"T"),e[12]=w,e[13]=I):I=e[13];let M=I,_;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=["all","web-push","fcm"],e[14]=_):_=e[14];let ne=_,p;e[15]!==i||e[16]!==r?(p=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:ne.map(a=>(0,t.jsx)(E,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:s(()=>{z(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[15]=i,e[16]=r,e[17]=p):p=e[17];let T=h!==void 0&&(0,t.jsx)(E,{"aria-pressed":o,"data-testid":"nt-failing-filter",onClick:s(()=>{l(he)},"onClick"),size:"sm",type:"button",variant:o?"secondary":"ghost",children:ae?r("{count}+ failing",{count:W}):r("{count} failing",{count:W})}),g;e[18]!==r?(g=r("Filter devices"),e[18]=r,e[19]=g):g=e[19];let v;e[20]!==r?(v=r("filter endpoint, user"),e[20]=r,e[21]=v):v=e[21];let x;e[22]!==n||e[23]!==g||e[24]!==v?(x=(0,t.jsx)(G,{"aria-label":g,className:"h-8 w-56","data-testid":"nt-search",onChange:ie,placeholder:v,value:n}),e[22]=n,e[23]=g,e[24]=v,e[25]=x):x=e[25];let N;e[26]!==r?(N=r("Refresh"),e[26]=r,e[27]=N):N=e[27];let b;e[28]!==M||e[29]!==N?(b=(0,t.jsx)(E,{className:"ml-auto","data-testid":"nt-refresh",onClick:M,size:"sm",type:"button",variant:"outline",children:N}),e[28]=M,e[29]=N,e[30]=b):b=e[30];let P=f.length>0&&(0,t.jsx)($,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:f.length})}),L;e[31]!==b||e[32]!==P||e[33]!==p||e[34]!==T||e[35]!==x?(L=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,T,x,b,P]}),e[31]=b,e[32]=P,e[33]=p,e[34]=T,e[35]=x,e[36]=L):L=e[36];let A;e[37]!==u||e[38]!==k?(A=u!==null&&(0,t.jsx)(X,{error:k,testId:"nt-error"}),e[37]=u,e[38]=k,e[39]=A):A=e[39],C=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[L,A,u===null&&!B&&F.length===0&&(0,t.jsx)(Q,{description:f.length>0?r("No device matches the current kind, search or failing filter."):r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:f.length>0?r("No matching devices."):r("No registered devices.")}),F.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(Y,{"data-testid":"nt-table",children:[(0,t.jsx)(Z,{children:(0,t.jsxs)(V,{children:[(0,t.jsx)(c,{children:r("kind")}),(0,t.jsx)(c,{children:r("endpoint")}),(0,t.jsx)(c,{children:r("user")}),(0,t.jsx)(c,{children:r("last seen")}),(0,t.jsx)(c,{children:r("status")}),(0,t.jsx)(c,{children:r("error")})]})}),(0,t.jsx)(ee,{children:F.map(a=>{let D=re(a);return(0,t.jsxs)(V,{"data-testid":"nt-row",children:[(0,t.jsx)(d,{children:(0,t.jsx)($,{variant:"outline",children:a.kind})}),(0,t.jsx)(d,{className:"max-w-[28ch] truncate font-mono text-xs",title:D,children:D}),(0,t.jsx)(d,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(d,{className:"text-muted-foreground tabular-nums",children:H(a.lastSeenAt,"\u2014")}),(0,t.jsx)(d,{children:(0,t.jsx)($,{"data-testid":`nt-status-${a.id}`,variant:me(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(d,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=h,e[2]=u,e[3]=k,e[4]=o,e[5]=B,e[6]=i,e[7]=w,e[8]=n,e[9]=r,e[10]=C}else C=e[10];return C},"ke");function he(e){return!e}s(he,"le");export{Ce as default};
@@ -1 +1 @@
1
- import{a as re}from"./chunk-2LKJSQKF.js";import{a as X}from"./chunk-2KTN53PK.js";import{a as V}from"./chunk-PAFHBQFL.js";import"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as W}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as Q}from"./chunk-S3TDGFRE.js";import{b as G}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as Y}from"./chunk-D3MLU3PX.js";import"./chunk-S7NFUY75.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-J3ZEO3PJ.js";import"./chunk-YDDMKWPI.js";import"./chunk-5CHKXJYN.js";import"./chunk-EOFWXI3T.js";import{a as R}from"./chunk-LYVYUTQY.js";import{c as O}from"./chunk-UN3QTZ6X.js";import{a as H,e as J}from"./chunk-TN4Z3P6S.js";import"./chunk-5KQSRLQP.js";import"./chunk-ZPQBVYNN.js";import{B as U,w as z,x as L}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as me}from"./chunk-A6TVTNKO.js";import{a as de,b as he}from"./chunk-ADABTCDI.js";import{a as l,d as B}from"./chunk-5PEAXTYQ.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},De=l(r=>{let e=(0,se.c)(49),{functions:_,initialShardKey:ne}=r,s=U(),{queryShardKey:i,setShardKey:v,shardKey:S}=X(ne),[c,oe]=(0,le.useState)("recent"),C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C={},e[0]=C):C=e[0];let $;e[1]!==i?($={live:!0,shardKey:i},e[1]=i,e[2]=$):$=e[2];let{data:ie,error:d,errorSource:b,liveError:k}=O(R.getFunctionStats,C,$),M=ie?.functions??null,F;e[3]!==_?(F=new Map((_??[]).map(ge)),e[3]=_,e[4]=F):F=e[4];let T=F,I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=l(w=>{oe(w.currentTarget.dataset.sort)},"E"),e[5]=I):I=e[5];let ce=I,K;if(e[6]!==d||e[7]!==b||e[8]!==T||e[9]!==k||e[10]!==i||e[11]!==v||e[12]!==S||e[13]!==c||e[14]!==M||e[15]!==s){let w=M===null?[]:M.toSorted(xe[c]),m;e[17]!==s?(m=s("Recent"),e[17]=s,e[18]=m):m=e[18];let h;e[19]!==m?(h={key:"recent",label:m},e[19]=m,e[20]=h):h=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let f;e[23]!==u?(f={key:"calls",label:u},e[23]=u,e[24]=f):f=e[24];let p;e[25]!==s?(p=s("Slowest"),e[25]=s,e[26]=p):p=e[26];let x;e[27]!==p?(x={key:"slowest",label:p},e[27]=p,e[28]=x):x=e[28];let A;e[29]!==x||e[30]!==h||e[31]!==f?(A=[h,f,x],e[29]=x,e[30]=h,e[31]=f,e[32]=A):A=e[32];let j=A,g;e[33]!==v||e[34]!==S?(g=(0,t.jsx)(V,{onChange:v,testId:"fs-shard-input",value:S}),e[33]=v,e[34]=S,e[35]=g):g=e[35];let y;e[36]!==k?(y=(0,t.jsx)(re,{message:k,prefix:"fs"}),e[36]=k,e[37]=y):y=e[37];let N;e[38]!==j||e[39]!==c?(N=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(W,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:c===a.key?"secondary":"ghost",children:a.label},a.key))}),e[38]=j,e[39]=c,e[40]=N):N=e[40];let D;e[41]!==g||e[42]!==y||e[43]!==N?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g,y,N]}),e[41]=g,e[42]=y,e[43]=N,e[44]=D):D=e[44];let E;e[45]!==d||e[46]!==b||e[47]!==i?(E=d!==null&&(0,t.jsx)(Y,{error:b,shardKey:i,testId:"fs-error"}),e[45]=d,e[46]=b,e[47]=i,e[48]=E):E=e[48],K=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,M!==null&&w.length===0&&d===null&&(0,t.jsx)(Q,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),w.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(J,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:w.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(G,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:z(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=d,e[7]=b,e[8]=T,e[9]=k,e[10]=i,e[11]=v,e[12]=S,e[13]=c,e[14]=M,e[15]=s,e[16]=K}else K=e[16];return K},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{De as FunctionStatsPanel};
1
+ import{a as re}from"./chunk-2LKJSQKF.js";import{a as X}from"./chunk-2KTN53PK.js";import{a as V}from"./chunk-PAFHBQFL.js";import"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as W}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as Q}from"./chunk-S3TDGFRE.js";import{b as G}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as Y}from"./chunk-2G5OZPH5.js";import"./chunk-S7NFUY75.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-J3ZEO3PJ.js";import"./chunk-IR2MDKXQ.js";import"./chunk-PSBRO6JX.js";import"./chunk-EOFWXI3T.js";import{a as R}from"./chunk-LYVYUTQY.js";import{c as O}from"./chunk-KE7ZGUGO.js";import{a as H,e as J}from"./chunk-TN4Z3P6S.js";import"./chunk-UK5OOCLQ.js";import"./chunk-ZPQBVYNN.js";import{B as U,w as z,x as L}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as me}from"./chunk-A6TVTNKO.js";import{a as de,b as he}from"./chunk-ADABTCDI.js";import{a as l,d as B}from"./chunk-5PEAXTYQ.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},De=l(r=>{let e=(0,se.c)(49),{functions:_,initialShardKey:ne}=r,s=U(),{queryShardKey:i,setShardKey:v,shardKey:S}=X(ne),[c,oe]=(0,le.useState)("recent"),C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C={},e[0]=C):C=e[0];let $;e[1]!==i?($={live:!0,shardKey:i},e[1]=i,e[2]=$):$=e[2];let{data:ie,error:d,errorSource:b,liveError:k}=O(R.getFunctionStats,C,$),M=ie?.functions??null,F;e[3]!==_?(F=new Map((_??[]).map(ge)),e[3]=_,e[4]=F):F=e[4];let T=F,I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=l(w=>{oe(w.currentTarget.dataset.sort)},"E"),e[5]=I):I=e[5];let ce=I,K;if(e[6]!==d||e[7]!==b||e[8]!==T||e[9]!==k||e[10]!==i||e[11]!==v||e[12]!==S||e[13]!==c||e[14]!==M||e[15]!==s){let w=M===null?[]:M.toSorted(xe[c]),m;e[17]!==s?(m=s("Recent"),e[17]=s,e[18]=m):m=e[18];let h;e[19]!==m?(h={key:"recent",label:m},e[19]=m,e[20]=h):h=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let f;e[23]!==u?(f={key:"calls",label:u},e[23]=u,e[24]=f):f=e[24];let p;e[25]!==s?(p=s("Slowest"),e[25]=s,e[26]=p):p=e[26];let x;e[27]!==p?(x={key:"slowest",label:p},e[27]=p,e[28]=x):x=e[28];let A;e[29]!==x||e[30]!==h||e[31]!==f?(A=[h,f,x],e[29]=x,e[30]=h,e[31]=f,e[32]=A):A=e[32];let j=A,g;e[33]!==v||e[34]!==S?(g=(0,t.jsx)(V,{onChange:v,testId:"fs-shard-input",value:S}),e[33]=v,e[34]=S,e[35]=g):g=e[35];let y;e[36]!==k?(y=(0,t.jsx)(re,{message:k,prefix:"fs"}),e[36]=k,e[37]=y):y=e[37];let N;e[38]!==j||e[39]!==c?(N=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(W,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:c===a.key?"secondary":"ghost",children:a.label},a.key))}),e[38]=j,e[39]=c,e[40]=N):N=e[40];let D;e[41]!==g||e[42]!==y||e[43]!==N?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g,y,N]}),e[41]=g,e[42]=y,e[43]=N,e[44]=D):D=e[44];let E;e[45]!==d||e[46]!==b||e[47]!==i?(E=d!==null&&(0,t.jsx)(Y,{error:b,shardKey:i,testId:"fs-error"}),e[45]=d,e[46]=b,e[47]=i,e[48]=E):E=e[48],K=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,M!==null&&w.length===0&&d===null&&(0,t.jsx)(Q,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),w.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(J,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:w.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(G,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:z(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=d,e[7]=b,e[8]=T,e[9]=k,e[10]=i,e[11]=v,e[12]=S,e[13]=c,e[14]=M,e[15]=s,e[16]=K}else K=e[16];return K},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{De as FunctionStatsPanel};
@@ -1 +1 @@
1
- import{b as h}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{b as I}from"./chunk-UN3QTZ6X.js";import{a as y,e as S}from"./chunk-TN4Z3P6S.js";import{n as k}from"./chunk-5KQSRLQP.js";import"./chunk-ZPQBVYNN.js";import{B as A}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as $}from"./chunk-A6TVTNKO.js";import{b as z}from"./chunk-ADABTCDI.js";import{a as u,d as w}from"./chunk-5PEAXTYQ.js";var N=w($(),1);var a=w(z(),1);var j=[{key:"accounts",label:"Accounts"},{key:"apiKey",label:"API keys"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=A(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=I(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let P=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m(P)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(q)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function q(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(q,"z");export{M as default};
1
+ import{b as h}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{b as I}from"./chunk-KE7ZGUGO.js";import{a as y,e as S}from"./chunk-TN4Z3P6S.js";import{n as k}from"./chunk-UK5OOCLQ.js";import"./chunk-ZPQBVYNN.js";import{B as A}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as $}from"./chunk-A6TVTNKO.js";import{b as z}from"./chunk-ADABTCDI.js";import{a as u,d as w}from"./chunk-5PEAXTYQ.js";var N=w($(),1);var a=w(z(),1);var j=[{key:"accounts",label:"Accounts"},{key:"apiKey",label:"API keys"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=A(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=I(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let P=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m(P)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(q)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function q(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(q,"z");export{M as default};
@@ -1 +1 @@
1
- import{b as Ke}from"./chunk-R6NJ4ER6.js";import{a as Ie,b as De,c as Oe}from"./chunk-AFLNQEZ5.js";import{a as Ee}from"./chunk-DWNWEMQK.js";import"./chunk-4KPATTV6.js";import{i as we}from"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as ke}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{b as _e}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as je}from"./chunk-D3MLU3PX.js";import"./chunk-S7NFUY75.js";import{a as Se,b as Te,c as Ce,d as ie,e as M,f as W}from"./chunk-J3ZEO3PJ.js";import"./chunk-YDDMKWPI.js";import"./chunk-5CHKXJYN.js";import"./chunk-EOFWXI3T.js";import{a as ve}from"./chunk-LYVYUTQY.js";import{c as ye}from"./chunk-UN3QTZ6X.js";import{a as le,e as oe}from"./chunk-TN4Z3P6S.js";import{n as Ae}from"./chunk-5KQSRLQP.js";import"./chunk-ZPQBVYNN.js";import{B as xe,j as pe,s as he,w as fe}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as ze}from"./chunk-A6TVTNKO.js";import{a as Ue,b as Pe}from"./chunk-ADABTCDI.js";import{a as b,d as Ne}from"./chunk-5PEAXTYQ.js";var ce=Ne(ze(),1);var I=Ne(Ue(),1);var a=Ne(Pe(),1);var Le=["disabled","schema","schema_and_log","schema_and_log_and_data"],$e={describeTables:"schema",readAdvisors:"schema",readLogs:"schema_and_log",readPolicies:"schema",runSql:"schema_and_log_and_data"},Be=864e5,qe=b(()=>{let t=(0,ce.c)(67),e=Ae(),r=xe(),n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],t[0]=n):n=t[0];let g;t[1]!==e?(g={owner:e,tokens:n},t[1]=e,t[2]=g):g=t[2];let[h,N]=(0,I.useState)(g),x=h.owner===e?h.tokens:[],[c,m]=(0,I.useState)(null),[p,o]=(0,I.useState)(null);p!==null&&p.owner!==e&&o(null);let d=p?.owner===e?p.token:null,[l,i]=(0,I.useState)(""),[s,u]=(0,I.useState)(""),[_,k]=(0,I.useState)(null),D=_===e,v=(0,I.useRef)(0),w=(0,I.useRef)(e),O,j;t[3]!==e?(O=b(()=>{w.current=e},"D"),j=[e],t[3]=e,t[4]=O,t[5]=j):(O=t[4],j=t[5]),(0,I.useEffect)(O,j);let K;t[6]!==e?(K=b(async()=>{if(w.current!==e)return;v.current=v.current+1;let f=v.current;try{let E=await e.listAdminTokens();f===v.current&&(N({owner:e,tokens:E}),m(null))}catch(E){let de=E;f===v.current&&m(pe(de))}},"L"),t[6]=e,t[7]=K):K=t[7];let y=K,L,R;t[8]!==y?(L=b(()=>{he(y())},"O"),R=[y],t[8]=y,t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,I.useEffect)(L,R);let U;t[11]!==e||t[12]!==d||t[13]!==D||t[14]!==s||t[15]!==l||t[16]!==y?(U=b(f=>{if(f.preventDefault(),D||d!==null)return;k(e);let E=e,de=s===""?void 0:Date.now()+Number(s)*Be;he((async()=>{try{let se=await E.createAdminToken({expiresAt:de,name:l.trim()});w.current===E&&(o({owner:E,token:se}),i(""),u(""),await y())}catch(se){m(pe(se))}k(se=>se===E?null:se)})())},"K"),t[11]=e,t[12]=d,t[13]=D,t[14]=s,t[15]=l,t[16]=y,t[17]=U):U=t[17];let B=U,H=b(f=>{he((async()=>{try{await e.revokeAdminToken(f),o(E=>E?.token.name===f?null:E),await y()}catch(E){let de=E;await y(),w.current===e&&m(pe(de))}})())},"q"),q=le,G="py-0",J="set-admin-tokens",S;t[18]!==r?(S=r("Admin tokens"),t[18]=r,t[19]=S):S=t[19];let T;t[20]!==S?(T=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S})}),t[20]=S,t[21]=T):T=t[21];let F=oe,Q="flex flex-col gap-3 py-3",C;t[22]!==r?(C=r("Named tokens use the admin API but cannot manage tokens or open admin WebSockets. A revoked token is refused within 30 seconds."),t[22]=r,t[23]=C):C=t[23];let z;t[24]!==C?(z=(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:C}),t[24]=C,t[25]=z):z=t[25];let V;t[26]!==c?(V=c!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"set-admin-tokens-error",role:"alert",children:c}),t[26]=c,t[27]=V):V=t[27];let P;t[28]!==d||t[29]!==r?(P=d!==null&&(0,a.jsxs)("div",{className:"rounded-md border border-border p-3 text-xs","data-testid":"set-admin-token-created",role:"status",children:[(0,a.jsx)("p",{className:"pb-1 text-muted-foreground",children:r("Copy this token now. It is not shown again.")}),(0,a.jsx)("code",{className:"font-mono break-all select-all",children:d.token}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(ke,{"data-testid":"set-admin-token-dismiss",onClick:b(()=>{o(null)},"onClick"),size:"xs",variant:"outline",children:r("Dismiss")})})]}),t[28]=d,t[29]=r,t[30]=P):P=t[30];let A;t[31]!==r?(A=r("Token name"),t[31]=r,t[32]=A):A=t[32];let $;t[33]===Symbol.for("react.memo_cache_sentinel")?($=b(f=>{i(f.target.value)},"B"),t[33]=$):$=t[33];let X;t[34]!==l||t[35]!==A?(X=(0,a.jsx)(we,{"aria-label":A,className:"w-48","data-testid":"set-admin-token-name",onChange:$,pattern:"[a-z0-9][a-z0-9_\\-]{0,63}",placeholder:"ci-deploy",required:!0,value:l}),t[34]=l,t[35]=A,t[36]=X):X=t[36];let Y;t[37]!==r?(Y=r("Expires in days (optional)"),t[37]=r,t[38]=Y):Y=t[38];let me;t[39]===Symbol.for("react.memo_cache_sentinel")?(me=b(f=>{u(f.target.value)},"de"),t[39]=me):me=t[39];let Z;t[40]!==r?(Z=r("Expires in days (optional)"),t[40]=r,t[41]=Z):Z=t[41];let ee;t[42]!==s||t[43]!==Y||t[44]!==Z?(ee=(0,a.jsx)(we,{"aria-label":Y,className:"w-40",min:1,onChange:me,placeholder:Z,type:"number",value:s}),t[42]=s,t[43]=Y,t[44]=Z,t[45]=ee):ee=t[45];let be=D||d!==null,te;t[46]!==r?(te=r("Create token"),t[46]=r,t[47]=te):te=t[47];let ae;t[48]!==be||t[49]!==te?(ae=(0,a.jsx)(ke,{"data-testid":"set-admin-token-create",disabled:be,size:"sm",type:"submit",children:te}),t[48]=be,t[49]=te,t[50]=ae):ae=t[50];let ne;t[51]!==B||t[52]!==X||t[53]!==ee||t[54]!==ae?(ne=(0,a.jsxs)("form",{className:"flex flex-wrap items-end gap-2",onSubmit:B,children:[X,ee,ae]}),t[51]=B,t[52]=X,t[53]=ee,t[54]=ae,t[55]=ne):ne=t[55];let ge=x.length>0&&(0,a.jsxs)(Se,{"data-testid":"set-admin-tokens-table",children:[(0,a.jsx)(Te,{children:(0,a.jsxs)(ie,{children:[(0,a.jsx)(M,{children:r("name")}),(0,a.jsx)(M,{children:r("Created")}),(0,a.jsx)(M,{children:r("Last used")}),(0,a.jsx)(M,{children:r("Expires")}),(0,a.jsx)(M,{})]})}),(0,a.jsx)(Ce,{children:x.map(f=>(0,a.jsxs)(ie,{"data-testid":"set-admin-token-row",children:[(0,a.jsxs)(W,{className:"font-mono text-xs",children:[f.name,f.revoked===!0&&(0,a.jsx)("span",{className:"pl-2 text-destructive",children:r("Revoked")})]}),(0,a.jsx)(W,{className:"text-xs",children:fe(f.createdAt)}),(0,a.jsx)(W,{className:"text-xs",children:fe(f.lastUsedAt,"\u2014")}),(0,a.jsx)(W,{className:"text-xs",children:fe(f.expiresAt,r("Never"))}),(0,a.jsx)(W,{children:(0,a.jsx)(Ee,{onConfirm:b(()=>{H(f.name)},"onConfirm"),testId:`set-admin-token-revoke-${f.name}`,children:r("Revoke")})})]},f.name))})]}),re;t[56]!==F||t[57]!==z||t[58]!==V||t[59]!==P||t[60]!==ne||t[61]!==ge?(re=(0,a.jsxs)(F,{className:Q,children:[z,V,P,ne,ge]}),t[56]=F,t[57]=z,t[58]=V,t[59]=P,t[60]=ne,t[61]=ge,t[62]=re):re=t[62];let ue;return t[63]!==q||t[64]!==T||t[65]!==re?(ue=(0,a.jsxs)(q,{className:G,"data-testid":J,children:[T,re]}),t[63]=q,t[64]=T,t[65]=re,t[66]=ue):ue=t[66],ue},"Fe"),Fe={binding:"outline",secret:"destructive",var:"secondary"},Ve=b((t,e)=>{if(t===void 0)return[];let r=[];return t.workerUrl!==void 0&&r.push({label:e("URL"),value:t.workerUrl}),t.environment!==void 0&&r.push({label:e("Environment"),value:t.environment}),t.deploymentId!==void 0&&r.push({label:e("Deployment"),value:t.deploymentId}),t.versionTag!==void 0&&r.push({label:e("Version"),value:t.versionTag}),r},"Pe"),Me={disabled:"The assistant is off. Nothing about this deployment is sent to a model.",schema:"Table and column names.",schema_and_log:"Table and column names, plus recent log lines.",schema_and_log_and_data:"Table and column names, log lines, and rows read with SELECT."},We=b(t=>{let e=[];for(let[r,n]of Object.entries($e))n===t&&e.push(r);return e},"qe"),He=b(()=>{let t=(0,ce.c)(29),e=xe(),r,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},n={shardKey:""},t[0]=r,t[1]=n):(r=t[0],n=t[1]);let{data:g}=ye(ve.aiAvailable,r,n),h=g?.level,N;t[2]!==h?(N=h===void 0?-1:Le.indexOf(h),t[2]=h,t[3]=N):N=t[3];let x=N,c;t[4]!==e?(c=e("AI assistant data sharing"),t[4]=e,t[5]=c):c=t[5];let m;t[6]!==c?(m=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),t[6]=c,t[7]=m):m=t[7];let p;t[8]!==h?(p=h!==void 0&&(0,a.jsx)(_e,{"data-testid":"set-ai-level",variant:h==="disabled"?"outline":"secondary",children:h}),t[8]=h,t[9]=p):p=t[9];let o;t[10]!==m||t[11]!==p?(o=(0,a.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[m,p]}),t[10]=m,t[11]=p,t[12]=o):o=t[12];let d;t[13]!==x||t[14]!==h||t[15]!==e?(d=Le.map((k,D)=>{let v=x>=D,w=We(k);return(0,a.jsxs)("li",{className:v?"flex flex-col gap-0.5":"flex flex-col gap-0.5 opacity-50","data-granted":String(v),"data-testid":`set-ai-tier-${k}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:k}),k===h&&(0,a.jsx)("span",{className:"text-[11px] text-primary",children:e("current")})]}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:e(Me[k])}),w.length>0&&(0,a.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:w.join(", ")})]},k)}),t[13]=x,t[14]=h,t[15]=e,t[16]=d):d=t[16];let l;t[17]!==d?(l=(0,a.jsx)("ul",{className:"flex flex-col gap-1.5 text-sm",children:d}),t[17]=d,t[18]=l):l=t[18];let i;t[19]!==e?(i=e("Set LUNORA_AI_OPT_IN in wrangler.jsonc and redeploy to change this. The Studio can read this level but never raise it."),t[19]=e,t[20]=i):i=t[20];let s;t[21]!==i?(s=(0,a.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"set-ai-howto",children:i}),t[21]=i,t[22]=s):s=t[22];let u;t[23]!==s||t[24]!==l?(u=(0,a.jsxs)(oe,{className:"flex flex-col gap-3 py-3",children:[l,s]}),t[23]=s,t[24]=l,t[25]=u):u=t[25];let _;return t[26]!==u||t[27]!==o?(_=(0,a.jsxs)(le,{className:"py-0","data-testid":"set-ai-sharing",children:[o,u]}),t[26]=u,t[27]=o,t[28]=_):_=t[28],_},"ze"),Re=b(t=>{let e=(0,ce.c)(18),{modifier:r,name:n,label:g}=t,h=Ie(),N;e[0]!==n?(N=b(u=>{if(!["Escape","Tab"].includes(u.key)){if(u.shiftKey){u.preventDefault();return}u.preventDefault(),De(n,u.key)}},"N"),e[0]=n,e[1]=N):N=e[1];let x=N,c=`set-shortcut-${n}`,m;e[2]!==g?(m=(0,a.jsx)("dt",{className:"text-muted-foreground",children:g}),e[2]=g,e[3]=m):m=e[3];let p;e[4]!==r?(p=(0,a.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:r}),e[4]=r,e[5]=p):p=e[5];let o=`set-shortcut-input-${n}`,d=h[n],l;e[6]!==g||e[7]!==x||e[8]!==o||e[9]!==d?(l=(0,a.jsx)("input",{"aria-label":g,className:"h-7 w-12 rounded-md border border-border bg-background text-center font-mono text-xs uppercase outline-none focus-visible:border-ring","data-testid":o,onKeyDown:x,readOnly:!0,value:d}),e[6]=g,e[7]=x,e[8]=o,e[9]=d,e[10]=l):l=e[10];let i;e[11]!==p||e[12]!==l?(i=(0,a.jsxs)("dd",{className:"flex items-center gap-1.5",children:[p,l]}),e[11]=p,e[12]=l,e[13]=i):i=e[13];let s;return e[14]!==c||e[15]!==m||e[16]!==i?(s=(0,a.jsxs)("div",{className:"contents","data-testid":c,children:[m,i]}),e[14]=c,e[15]=m,e[16]=i,e[17]=s):s=e[17],s},"we"),ct=b(t=>{let e=(0,ce.c)(87),{initialShardKey:r}=t,n=xe(),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let h=r??"",N;e[1]!==h?(N={shardKey:h},e[1]=h,e[2]=N):N=e[2];let{data:x,error:c,errorSource:m,isLoading:p}=ye(ve.getSettings,g,N),o,d,l,i,s,u,_;if(e[3]!==c||e[4]!==m||e[5]!==x?.deploy||e[6]!==x?.settings||e[7]!==n){let V=Ve(x?.deploy,n),P;e[15]!==x?.settings?(P=x?.settings??[],e[15]=x?.settings,e[16]=P):P=e[16],o=P,d="flex flex-col gap-4",l="lunora-settings";let A;e[17]!==n?(A=n("Open in Cloudflare"),e[17]=n,e[18]=A):A=e[18],e[19]!==A?(i=(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,a.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:Ke,rel:"noreferrer",target:"_blank",children:A})}),e[19]=A,e[20]=i):i=e[20];let $;e[21]!==n?($=n("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=n,e[22]=$):$=e[22],e[23]!==$?(s=(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:$}),e[23]=$,e[24]=s):s=e[24],e[25]!==c||e[26]!==m?(u=c!==null&&(0,a.jsx)(je,{error:m,testId:"set-error"}),e[25]=c,e[26]=m,e[27]=u):u=e[27],_=V.length>0&&(0,a.jsxs)(le,{className:"py-0","data-testid":"set-deploy",children:[(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Deployment")})}),(0,a.jsx)(oe,{className:"py-3",children:(0,a.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:V.map(Ge)})})]}),e[3]=c,e[4]=m,e[5]=x?.deploy,e[6]=x?.settings,e[7]=n,e[8]=o,e[9]=d,e[10]=l,e[11]=i,e[12]=s,e[13]=u,e[14]=_}else o=e[8],d=e[9],l=e[10],i=e[11],s=e[12],u=e[13],_=e[14];let k,D;e[28]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsx)(He,{}),D=(0,a.jsx)(qe,{}),e[28]=k,e[29]=D):(k=e[28],D=e[29]);let v;e[30]!==n?(v=n("Keyboard shortcuts"),e[30]=n,e[31]=v):v=e[31];let w;e[32]!==v?(w=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[32]=v,e[33]=w):w=e[33];let O;e[34]!==n?(O=n("Reset"),e[34]=n,e[35]=O):O=e[35];let j;e[36]!==O?(j=(0,a.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"set-shortcut-reset",onClick:Oe,type:"button",children:O}),e[36]=O,e[37]=j):j=e[37];let K;e[38]!==w||e[39]!==j?(K=(0,a.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[w,j]}),e[38]=w,e[39]=j,e[40]=K):K=e[40];let y;e[41]!==n?(y=n("Command palette"),e[41]=n,e[42]=y):y=e[42];let L;e[43]!==y?(L=(0,a.jsx)(Re,{label:y,modifier:"\u2318/Ctrl",name:"palette"}),e[43]=y,e[44]=L):L=e[44];let R;e[45]!==n?(R=n("Operation console"),e[45]=n,e[46]=R):R=e[46];let U;e[47]!==R?(U=(0,a.jsx)(Re,{label:R,modifier:"Ctrl",name:"console"}),e[47]=R,e[48]=U):U=e[48];let B;e[49]!==L||e[50]!==U?(B=(0,a.jsxs)("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[L,U]}),e[49]=L,e[50]=U,e[51]=B):B=e[51];let H;e[52]!==n?(H=n("Stored in this browser. Focus a box and press a key to rebind it."),e[52]=n,e[53]=H):H=e[53];let q;e[54]!==H?(q=(0,a.jsx)("p",{className:"pt-3 text-xs text-muted-foreground",children:H}),e[54]=H,e[55]=q):q=e[55];let G;e[56]!==B||e[57]!==q?(G=(0,a.jsxs)(oe,{className:"py-3",children:[B,q]}),e[56]=B,e[57]=q,e[58]=G):G=e[58];let J;e[59]!==K||e[60]!==G?(J=(0,a.jsxs)(le,{className:"py-0","data-testid":"set-preferences",children:[K,G]}),e[59]=K,e[60]=G,e[61]=J):J=e[61];let S;e[62]!==n?(S=n("Environment & bindings"),e[62]=n,e[63]=S):S=e[63];let T;e[64]!==S?(T=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S})}),e[64]=S,e[65]=T):T=e[65];let F;e[66]!==c||e[67]!==p||e[68]!==o.length||e[69]!==n?(F=c===null&&!p&&o.length===0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:n("No environment variables or bindings.")}),e[66]=c,e[67]=p,e[68]=o.length,e[69]=n,e[70]=F):F=e[70];let Q;e[71]!==o||e[72]!==n?(Q=o.length>0&&(0,a.jsx)(oe,{className:"px-0 py-0",children:(0,a.jsxs)(Se,{"data-testid":"set-table",children:[(0,a.jsx)(Te,{children:(0,a.jsxs)(ie,{children:[(0,a.jsx)(M,{children:n("name")}),(0,a.jsx)(M,{children:n("kind")}),(0,a.jsx)(M,{children:n("value")})]})}),(0,a.jsx)(Ce,{children:o.map(Je)})]})}),e[71]=o,e[72]=n,e[73]=Q):Q=e[73];let C;e[74]!==T||e[75]!==F||e[76]!==Q?(C=(0,a.jsxs)(le,{className:"py-0",children:[T,F,Q]}),e[74]=T,e[75]=F,e[76]=Q,e[77]=C):C=e[77];let z;return e[78]!==J||e[79]!==C||e[80]!==d||e[81]!==l||e[82]!==i||e[83]!==s||e[84]!==u||e[85]!==_?(z=(0,a.jsxs)("div",{className:d,"data-testid":l,children:[i,s,u,_,k,D,J,C]}),e[78]=J,e[79]=C,e[80]=d,e[81]=l,e[82]=i,e[83]=s,e[84]=u,e[85]=_,e[86]=z):z=e[86],z},"ft");function Ge(t){return(0,a.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:t.label}),(0,a.jsx)("dd",{className:"truncate font-mono text-xs",title:t.value,children:t.value})]},t.label)}b(Ge,"He");function Je(t){return(0,a.jsxs)(ie,{"data-testid":"set-row",children:[(0,a.jsx)(W,{className:"font-mono text-xs font-medium",children:t.name}),(0,a.jsx)(W,{children:(0,a.jsx)(_e,{variant:Fe[t.kind],children:t.bindingType??t.kind})}),(0,a.jsx)(W,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:t.value??(0,a.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},t.name)}b(Je,"We");export{ct as SettingsPanel};
1
+ import{b as Ke}from"./chunk-R6NJ4ER6.js";import{a as Ie,b as De,c as Oe}from"./chunk-AFLNQEZ5.js";import{a as Ee}from"./chunk-DWNWEMQK.js";import"./chunk-4KPATTV6.js";import{i as we}from"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as ke}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{b as _e}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as je}from"./chunk-2G5OZPH5.js";import"./chunk-S7NFUY75.js";import{a as Se,b as Te,c as Ce,d as ie,e as M,f as W}from"./chunk-J3ZEO3PJ.js";import"./chunk-IR2MDKXQ.js";import"./chunk-PSBRO6JX.js";import"./chunk-EOFWXI3T.js";import{a as ve}from"./chunk-LYVYUTQY.js";import{c as ye}from"./chunk-KE7ZGUGO.js";import{a as le,e as oe}from"./chunk-TN4Z3P6S.js";import{n as Ae}from"./chunk-UK5OOCLQ.js";import"./chunk-ZPQBVYNN.js";import{B as xe,j as pe,s as he,w as fe}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as ze}from"./chunk-A6TVTNKO.js";import{a as Ue,b as Pe}from"./chunk-ADABTCDI.js";import{a as b,d as Ne}from"./chunk-5PEAXTYQ.js";var ce=Ne(ze(),1);var I=Ne(Ue(),1);var a=Ne(Pe(),1);var Le=["disabled","schema","schema_and_log","schema_and_log_and_data"],$e={describeTables:"schema",readAdvisors:"schema",readLogs:"schema_and_log",readPolicies:"schema",runSql:"schema_and_log_and_data"},Be=864e5,qe=b(()=>{let t=(0,ce.c)(67),e=Ae(),r=xe(),n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],t[0]=n):n=t[0];let g;t[1]!==e?(g={owner:e,tokens:n},t[1]=e,t[2]=g):g=t[2];let[h,N]=(0,I.useState)(g),x=h.owner===e?h.tokens:[],[c,m]=(0,I.useState)(null),[p,o]=(0,I.useState)(null);p!==null&&p.owner!==e&&o(null);let d=p?.owner===e?p.token:null,[l,i]=(0,I.useState)(""),[s,u]=(0,I.useState)(""),[_,k]=(0,I.useState)(null),D=_===e,v=(0,I.useRef)(0),w=(0,I.useRef)(e),O,j;t[3]!==e?(O=b(()=>{w.current=e},"D"),j=[e],t[3]=e,t[4]=O,t[5]=j):(O=t[4],j=t[5]),(0,I.useEffect)(O,j);let K;t[6]!==e?(K=b(async()=>{if(w.current!==e)return;v.current=v.current+1;let f=v.current;try{let E=await e.listAdminTokens();f===v.current&&(N({owner:e,tokens:E}),m(null))}catch(E){let de=E;f===v.current&&m(pe(de))}},"L"),t[6]=e,t[7]=K):K=t[7];let y=K,L,R;t[8]!==y?(L=b(()=>{he(y())},"O"),R=[y],t[8]=y,t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,I.useEffect)(L,R);let U;t[11]!==e||t[12]!==d||t[13]!==D||t[14]!==s||t[15]!==l||t[16]!==y?(U=b(f=>{if(f.preventDefault(),D||d!==null)return;k(e);let E=e,de=s===""?void 0:Date.now()+Number(s)*Be;he((async()=>{try{let se=await E.createAdminToken({expiresAt:de,name:l.trim()});w.current===E&&(o({owner:E,token:se}),i(""),u(""),await y())}catch(se){m(pe(se))}k(se=>se===E?null:se)})())},"K"),t[11]=e,t[12]=d,t[13]=D,t[14]=s,t[15]=l,t[16]=y,t[17]=U):U=t[17];let B=U,H=b(f=>{he((async()=>{try{await e.revokeAdminToken(f),o(E=>E?.token.name===f?null:E),await y()}catch(E){let de=E;await y(),w.current===e&&m(pe(de))}})())},"q"),q=le,G="py-0",J="set-admin-tokens",S;t[18]!==r?(S=r("Admin tokens"),t[18]=r,t[19]=S):S=t[19];let T;t[20]!==S?(T=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S})}),t[20]=S,t[21]=T):T=t[21];let F=oe,Q="flex flex-col gap-3 py-3",C;t[22]!==r?(C=r("Named tokens use the admin API but cannot manage tokens or open admin WebSockets. A revoked token is refused within 30 seconds."),t[22]=r,t[23]=C):C=t[23];let z;t[24]!==C?(z=(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:C}),t[24]=C,t[25]=z):z=t[25];let V;t[26]!==c?(V=c!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"set-admin-tokens-error",role:"alert",children:c}),t[26]=c,t[27]=V):V=t[27];let P;t[28]!==d||t[29]!==r?(P=d!==null&&(0,a.jsxs)("div",{className:"rounded-md border border-border p-3 text-xs","data-testid":"set-admin-token-created",role:"status",children:[(0,a.jsx)("p",{className:"pb-1 text-muted-foreground",children:r("Copy this token now. It is not shown again.")}),(0,a.jsx)("code",{className:"font-mono break-all select-all",children:d.token}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(ke,{"data-testid":"set-admin-token-dismiss",onClick:b(()=>{o(null)},"onClick"),size:"xs",variant:"outline",children:r("Dismiss")})})]}),t[28]=d,t[29]=r,t[30]=P):P=t[30];let A;t[31]!==r?(A=r("Token name"),t[31]=r,t[32]=A):A=t[32];let $;t[33]===Symbol.for("react.memo_cache_sentinel")?($=b(f=>{i(f.target.value)},"B"),t[33]=$):$=t[33];let X;t[34]!==l||t[35]!==A?(X=(0,a.jsx)(we,{"aria-label":A,className:"w-48","data-testid":"set-admin-token-name",onChange:$,pattern:"[a-z0-9][a-z0-9_\\-]{0,63}",placeholder:"ci-deploy",required:!0,value:l}),t[34]=l,t[35]=A,t[36]=X):X=t[36];let Y;t[37]!==r?(Y=r("Expires in days (optional)"),t[37]=r,t[38]=Y):Y=t[38];let me;t[39]===Symbol.for("react.memo_cache_sentinel")?(me=b(f=>{u(f.target.value)},"de"),t[39]=me):me=t[39];let Z;t[40]!==r?(Z=r("Expires in days (optional)"),t[40]=r,t[41]=Z):Z=t[41];let ee;t[42]!==s||t[43]!==Y||t[44]!==Z?(ee=(0,a.jsx)(we,{"aria-label":Y,className:"w-40",min:1,onChange:me,placeholder:Z,type:"number",value:s}),t[42]=s,t[43]=Y,t[44]=Z,t[45]=ee):ee=t[45];let be=D||d!==null,te;t[46]!==r?(te=r("Create token"),t[46]=r,t[47]=te):te=t[47];let ae;t[48]!==be||t[49]!==te?(ae=(0,a.jsx)(ke,{"data-testid":"set-admin-token-create",disabled:be,size:"sm",type:"submit",children:te}),t[48]=be,t[49]=te,t[50]=ae):ae=t[50];let ne;t[51]!==B||t[52]!==X||t[53]!==ee||t[54]!==ae?(ne=(0,a.jsxs)("form",{className:"flex flex-wrap items-end gap-2",onSubmit:B,children:[X,ee,ae]}),t[51]=B,t[52]=X,t[53]=ee,t[54]=ae,t[55]=ne):ne=t[55];let ge=x.length>0&&(0,a.jsxs)(Se,{"data-testid":"set-admin-tokens-table",children:[(0,a.jsx)(Te,{children:(0,a.jsxs)(ie,{children:[(0,a.jsx)(M,{children:r("name")}),(0,a.jsx)(M,{children:r("Created")}),(0,a.jsx)(M,{children:r("Last used")}),(0,a.jsx)(M,{children:r("Expires")}),(0,a.jsx)(M,{})]})}),(0,a.jsx)(Ce,{children:x.map(f=>(0,a.jsxs)(ie,{"data-testid":"set-admin-token-row",children:[(0,a.jsxs)(W,{className:"font-mono text-xs",children:[f.name,f.revoked===!0&&(0,a.jsx)("span",{className:"pl-2 text-destructive",children:r("Revoked")})]}),(0,a.jsx)(W,{className:"text-xs",children:fe(f.createdAt)}),(0,a.jsx)(W,{className:"text-xs",children:fe(f.lastUsedAt,"\u2014")}),(0,a.jsx)(W,{className:"text-xs",children:fe(f.expiresAt,r("Never"))}),(0,a.jsx)(W,{children:(0,a.jsx)(Ee,{onConfirm:b(()=>{H(f.name)},"onConfirm"),testId:`set-admin-token-revoke-${f.name}`,children:r("Revoke")})})]},f.name))})]}),re;t[56]!==F||t[57]!==z||t[58]!==V||t[59]!==P||t[60]!==ne||t[61]!==ge?(re=(0,a.jsxs)(F,{className:Q,children:[z,V,P,ne,ge]}),t[56]=F,t[57]=z,t[58]=V,t[59]=P,t[60]=ne,t[61]=ge,t[62]=re):re=t[62];let ue;return t[63]!==q||t[64]!==T||t[65]!==re?(ue=(0,a.jsxs)(q,{className:G,"data-testid":J,children:[T,re]}),t[63]=q,t[64]=T,t[65]=re,t[66]=ue):ue=t[66],ue},"Fe"),Fe={binding:"outline",secret:"destructive",var:"secondary"},Ve=b((t,e)=>{if(t===void 0)return[];let r=[];return t.workerUrl!==void 0&&r.push({label:e("URL"),value:t.workerUrl}),t.environment!==void 0&&r.push({label:e("Environment"),value:t.environment}),t.deploymentId!==void 0&&r.push({label:e("Deployment"),value:t.deploymentId}),t.versionTag!==void 0&&r.push({label:e("Version"),value:t.versionTag}),r},"Pe"),Me={disabled:"The assistant is off. Nothing about this deployment is sent to a model.",schema:"Table and column names.",schema_and_log:"Table and column names, plus recent log lines.",schema_and_log_and_data:"Table and column names, log lines, and rows read with SELECT."},We=b(t=>{let e=[];for(let[r,n]of Object.entries($e))n===t&&e.push(r);return e},"qe"),He=b(()=>{let t=(0,ce.c)(29),e=xe(),r,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},n={shardKey:""},t[0]=r,t[1]=n):(r=t[0],n=t[1]);let{data:g}=ye(ve.aiAvailable,r,n),h=g?.level,N;t[2]!==h?(N=h===void 0?-1:Le.indexOf(h),t[2]=h,t[3]=N):N=t[3];let x=N,c;t[4]!==e?(c=e("AI assistant data sharing"),t[4]=e,t[5]=c):c=t[5];let m;t[6]!==c?(m=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),t[6]=c,t[7]=m):m=t[7];let p;t[8]!==h?(p=h!==void 0&&(0,a.jsx)(_e,{"data-testid":"set-ai-level",variant:h==="disabled"?"outline":"secondary",children:h}),t[8]=h,t[9]=p):p=t[9];let o;t[10]!==m||t[11]!==p?(o=(0,a.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[m,p]}),t[10]=m,t[11]=p,t[12]=o):o=t[12];let d;t[13]!==x||t[14]!==h||t[15]!==e?(d=Le.map((k,D)=>{let v=x>=D,w=We(k);return(0,a.jsxs)("li",{className:v?"flex flex-col gap-0.5":"flex flex-col gap-0.5 opacity-50","data-granted":String(v),"data-testid":`set-ai-tier-${k}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:k}),k===h&&(0,a.jsx)("span",{className:"text-[11px] text-primary",children:e("current")})]}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:e(Me[k])}),w.length>0&&(0,a.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:w.join(", ")})]},k)}),t[13]=x,t[14]=h,t[15]=e,t[16]=d):d=t[16];let l;t[17]!==d?(l=(0,a.jsx)("ul",{className:"flex flex-col gap-1.5 text-sm",children:d}),t[17]=d,t[18]=l):l=t[18];let i;t[19]!==e?(i=e("Set LUNORA_AI_OPT_IN in wrangler.jsonc and redeploy to change this. The Studio can read this level but never raise it."),t[19]=e,t[20]=i):i=t[20];let s;t[21]!==i?(s=(0,a.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"set-ai-howto",children:i}),t[21]=i,t[22]=s):s=t[22];let u;t[23]!==s||t[24]!==l?(u=(0,a.jsxs)(oe,{className:"flex flex-col gap-3 py-3",children:[l,s]}),t[23]=s,t[24]=l,t[25]=u):u=t[25];let _;return t[26]!==u||t[27]!==o?(_=(0,a.jsxs)(le,{className:"py-0","data-testid":"set-ai-sharing",children:[o,u]}),t[26]=u,t[27]=o,t[28]=_):_=t[28],_},"ze"),Re=b(t=>{let e=(0,ce.c)(18),{modifier:r,name:n,label:g}=t,h=Ie(),N;e[0]!==n?(N=b(u=>{if(!["Escape","Tab"].includes(u.key)){if(u.shiftKey){u.preventDefault();return}u.preventDefault(),De(n,u.key)}},"N"),e[0]=n,e[1]=N):N=e[1];let x=N,c=`set-shortcut-${n}`,m;e[2]!==g?(m=(0,a.jsx)("dt",{className:"text-muted-foreground",children:g}),e[2]=g,e[3]=m):m=e[3];let p;e[4]!==r?(p=(0,a.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:r}),e[4]=r,e[5]=p):p=e[5];let o=`set-shortcut-input-${n}`,d=h[n],l;e[6]!==g||e[7]!==x||e[8]!==o||e[9]!==d?(l=(0,a.jsx)("input",{"aria-label":g,className:"h-7 w-12 rounded-md border border-border bg-background text-center font-mono text-xs uppercase outline-none focus-visible:border-ring","data-testid":o,onKeyDown:x,readOnly:!0,value:d}),e[6]=g,e[7]=x,e[8]=o,e[9]=d,e[10]=l):l=e[10];let i;e[11]!==p||e[12]!==l?(i=(0,a.jsxs)("dd",{className:"flex items-center gap-1.5",children:[p,l]}),e[11]=p,e[12]=l,e[13]=i):i=e[13];let s;return e[14]!==c||e[15]!==m||e[16]!==i?(s=(0,a.jsxs)("div",{className:"contents","data-testid":c,children:[m,i]}),e[14]=c,e[15]=m,e[16]=i,e[17]=s):s=e[17],s},"we"),ct=b(t=>{let e=(0,ce.c)(87),{initialShardKey:r}=t,n=xe(),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let h=r??"",N;e[1]!==h?(N={shardKey:h},e[1]=h,e[2]=N):N=e[2];let{data:x,error:c,errorSource:m,isLoading:p}=ye(ve.getSettings,g,N),o,d,l,i,s,u,_;if(e[3]!==c||e[4]!==m||e[5]!==x?.deploy||e[6]!==x?.settings||e[7]!==n){let V=Ve(x?.deploy,n),P;e[15]!==x?.settings?(P=x?.settings??[],e[15]=x?.settings,e[16]=P):P=e[16],o=P,d="flex flex-col gap-4",l="lunora-settings";let A;e[17]!==n?(A=n("Open in Cloudflare"),e[17]=n,e[18]=A):A=e[18],e[19]!==A?(i=(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,a.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:Ke,rel:"noreferrer",target:"_blank",children:A})}),e[19]=A,e[20]=i):i=e[20];let $;e[21]!==n?($=n("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=n,e[22]=$):$=e[22],e[23]!==$?(s=(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:$}),e[23]=$,e[24]=s):s=e[24],e[25]!==c||e[26]!==m?(u=c!==null&&(0,a.jsx)(je,{error:m,testId:"set-error"}),e[25]=c,e[26]=m,e[27]=u):u=e[27],_=V.length>0&&(0,a.jsxs)(le,{className:"py-0","data-testid":"set-deploy",children:[(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Deployment")})}),(0,a.jsx)(oe,{className:"py-3",children:(0,a.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:V.map(Ge)})})]}),e[3]=c,e[4]=m,e[5]=x?.deploy,e[6]=x?.settings,e[7]=n,e[8]=o,e[9]=d,e[10]=l,e[11]=i,e[12]=s,e[13]=u,e[14]=_}else o=e[8],d=e[9],l=e[10],i=e[11],s=e[12],u=e[13],_=e[14];let k,D;e[28]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsx)(He,{}),D=(0,a.jsx)(qe,{}),e[28]=k,e[29]=D):(k=e[28],D=e[29]);let v;e[30]!==n?(v=n("Keyboard shortcuts"),e[30]=n,e[31]=v):v=e[31];let w;e[32]!==v?(w=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[32]=v,e[33]=w):w=e[33];let O;e[34]!==n?(O=n("Reset"),e[34]=n,e[35]=O):O=e[35];let j;e[36]!==O?(j=(0,a.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"set-shortcut-reset",onClick:Oe,type:"button",children:O}),e[36]=O,e[37]=j):j=e[37];let K;e[38]!==w||e[39]!==j?(K=(0,a.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[w,j]}),e[38]=w,e[39]=j,e[40]=K):K=e[40];let y;e[41]!==n?(y=n("Command palette"),e[41]=n,e[42]=y):y=e[42];let L;e[43]!==y?(L=(0,a.jsx)(Re,{label:y,modifier:"\u2318/Ctrl",name:"palette"}),e[43]=y,e[44]=L):L=e[44];let R;e[45]!==n?(R=n("Operation console"),e[45]=n,e[46]=R):R=e[46];let U;e[47]!==R?(U=(0,a.jsx)(Re,{label:R,modifier:"Ctrl",name:"console"}),e[47]=R,e[48]=U):U=e[48];let B;e[49]!==L||e[50]!==U?(B=(0,a.jsxs)("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[L,U]}),e[49]=L,e[50]=U,e[51]=B):B=e[51];let H;e[52]!==n?(H=n("Stored in this browser. Focus a box and press a key to rebind it."),e[52]=n,e[53]=H):H=e[53];let q;e[54]!==H?(q=(0,a.jsx)("p",{className:"pt-3 text-xs text-muted-foreground",children:H}),e[54]=H,e[55]=q):q=e[55];let G;e[56]!==B||e[57]!==q?(G=(0,a.jsxs)(oe,{className:"py-3",children:[B,q]}),e[56]=B,e[57]=q,e[58]=G):G=e[58];let J;e[59]!==K||e[60]!==G?(J=(0,a.jsxs)(le,{className:"py-0","data-testid":"set-preferences",children:[K,G]}),e[59]=K,e[60]=G,e[61]=J):J=e[61];let S;e[62]!==n?(S=n("Environment & bindings"),e[62]=n,e[63]=S):S=e[63];let T;e[64]!==S?(T=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S})}),e[64]=S,e[65]=T):T=e[65];let F;e[66]!==c||e[67]!==p||e[68]!==o.length||e[69]!==n?(F=c===null&&!p&&o.length===0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:n("No environment variables or bindings.")}),e[66]=c,e[67]=p,e[68]=o.length,e[69]=n,e[70]=F):F=e[70];let Q;e[71]!==o||e[72]!==n?(Q=o.length>0&&(0,a.jsx)(oe,{className:"px-0 py-0",children:(0,a.jsxs)(Se,{"data-testid":"set-table",children:[(0,a.jsx)(Te,{children:(0,a.jsxs)(ie,{children:[(0,a.jsx)(M,{children:n("name")}),(0,a.jsx)(M,{children:n("kind")}),(0,a.jsx)(M,{children:n("value")})]})}),(0,a.jsx)(Ce,{children:o.map(Je)})]})}),e[71]=o,e[72]=n,e[73]=Q):Q=e[73];let C;e[74]!==T||e[75]!==F||e[76]!==Q?(C=(0,a.jsxs)(le,{className:"py-0",children:[T,F,Q]}),e[74]=T,e[75]=F,e[76]=Q,e[77]=C):C=e[77];let z;return e[78]!==J||e[79]!==C||e[80]!==d||e[81]!==l||e[82]!==i||e[83]!==s||e[84]!==u||e[85]!==_?(z=(0,a.jsxs)("div",{className:d,"data-testid":l,children:[i,s,u,_,k,D,J,C]}),e[78]=J,e[79]=C,e[80]=d,e[81]=l,e[82]=i,e[83]=s,e[84]=u,e[85]=_,e[86]=z):z=e[86],z},"ft");function Ge(t){return(0,a.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:t.label}),(0,a.jsx)("dd",{className:"truncate font-mono text-xs",title:t.value,children:t.value})]},t.label)}b(Ge,"He");function Je(t){return(0,a.jsxs)(ie,{"data-testid":"set-row",children:[(0,a.jsx)(W,{className:"font-mono text-xs font-medium",children:t.name}),(0,a.jsx)(W,{children:(0,a.jsx)(_e,{variant:Fe[t.kind],children:t.bindingType??t.kind})}),(0,a.jsx)(W,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:t.value??(0,a.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},t.name)}b(Je,"We");export{ct as SettingsPanel};
@@ -1 +1 @@
1
- import{a as Re,b as Pe,c as qe}from"./chunk-THRRRMIZ.js";import{b as Ie,c as Te}from"./chunk-LJLNIVUA.js";import{a as Se}from"./chunk-SRNRWSMY.js";import"./chunk-QLZGKBOW.js";import{a as de}from"./chunk-R6NJ4ER6.js";import{a as Le}from"./chunk-W7CLOQOU.js";import{c as ke}from"./chunk-MHZNDDGI.js";import{a as Ce}from"./chunk-2LKJSQKF.js";import{a as ie}from"./chunk-DRHZZ7IN.js";import{a as be}from"./chunk-2KTN53PK.js";import{a as ve}from"./chunk-PAFHBQFL.js";import{b as fe}from"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import{i as D}from"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as pe}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as J}from"./chunk-S3TDGFRE.js";import{b as ne}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as xe}from"./chunk-D3MLU3PX.js";import"./chunk-S7NFUY75.js";import{a as ye,b as we,c as Ne,d as se,e as j,f as B}from"./chunk-J3ZEO3PJ.js";import"./chunk-YDDMKWPI.js";import"./chunk-5CHKXJYN.js";import"./chunk-EOFWXI3T.js";import{a as oe}from"./chunk-LYVYUTQY.js";import{c as le}from"./chunk-UN3QTZ6X.js";import{n as ge}from"./chunk-5KQSRLQP.js";import"./chunk-ZPQBVYNN.js";import{B as z,j as re,k as he,s as ae,x as W}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as Ue}from"./chunk-A6TVTNKO.js";import{a as $e,b as ze}from"./chunk-ADABTCDI.js";import{a as v,d as te}from"./chunk-5PEAXTYQ.js";var K=te(Ue(),1);var q=te($e(),1);var r=te(ze(),1);var ue=["trace","debug","log","info","warn","error","fatal"],De="LOG_ARCHIVE_NOT_CONFIGURED",je={cursor:void 0,error:null,generation:0,loading:!1,notConfigured:!1,rows:null},Be=v((i,e)=>{switch(e.type){case"append":return{...i,cursor:e.cursor,error:null,loading:!1,rows:[...i.rows??[],...e.rows]};case"failed":return{...i,cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,generation:i.generation+1,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...i,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{...i,cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...i,error:e.message,loading:!1};default:return i}},"ze"),We=v(i=>{let e=(0,K.c)(36),{row:t}=i,s;e[0]!==t.fields?(s=Ie(t.fields),e[0]=t.fields,e[1]=s):s=e[1];let n=s,o=`lg-archive-row-${String(t.ts)}`,c;e[2]!==t.ts?(c=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=c):c=e[3];let p;e[4]!==c?(p=(0,r.jsx)(B,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:c}),e[4]=c,e[5]=p):p=e[5];let m=Re[t.level],d;e[6]!==t.level||e[7]!==m?(d=(0,r.jsx)(B,{children:(0,r.jsx)(ne,{variant:m,children:t.level})}),e[6]=t.level,e[7]=m,e[8]=d):d=e[8];let a;e[9]!==t.functionPath?(a=(0,r.jsx)(B,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=a):a=e[10];let h;e[11]!==t.message?(h=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=h):h=e[12];let l;e[13]!==n.text?(l=n.text!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:n.text,children:n.text}),e[13]=n.text,e[14]=l):l=e[14];let g;e[15]!==n.errors?(g=n.errors.length>0&&(0,r.jsx)(Pe,{errors:n.errors}),e[15]=n.errors,e[16]=g):g=e[16];let u;e[17]!==g||e[18]!==h||e[19]!==l?(u=(0,r.jsxs)(B,{className:"max-w-md",children:[h,l,g]}),e[17]=g,e[18]=h,e[19]=l,e[20]=u):u=e[20];let x=t.traceId??"\u2014",f;e[21]!==x?(f=(0,r.jsx)(B,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[21]=x,e[22]=f):f=e[22];let C=t.shardKey??"\u2014",y;e[23]!==C?(y=(0,r.jsx)(B,{className:"font-mono text-[11px] text-muted-foreground",children:C}),e[23]=C,e[24]=y):y=e[24];let w=t.userId??"\u2014",k;e[25]!==w?(k=(0,r.jsx)(B,{className:"font-mono text-[11px] text-muted-foreground",children:w}),e[25]=w,e[26]=k):k=e[26];let L;return e[27]!==u||e[28]!==f||e[29]!==y||e[30]!==k||e[31]!==o||e[32]!==p||e[33]!==d||e[34]!==a?(L=(0,r.jsxs)(se,{"data-testid":o,children:[p,d,a,u,f,y,k]}),e[27]=u,e[28]=f,e[29]=y,e[30]=k,e[31]=o,e[32]=p,e[33]=d,e[34]=a,e[35]=L):L=e[35],L},"Ge"),Ve=v(({shardKey:i})=>{let e=ge(),t=z(),[s,n]=(0,q.useState)(""),[o,c]=(0,q.useState)(""),[p,m]=(0,q.useState)(""),[{cursor:d,error:a,generation:h,loading:l,notConfigured:g,rows:u},x]=(0,q.useReducer)(Be,je),f=ie(s.trim(),400),C=ie(o.trim(),400),y={...f===""?{}:{functionPathPrefix:f},...p===""?{}:{minLevel:p},...i===""?{}:{shardKey:i},...C===""?{}:{userId:C}},w=JSON.stringify(y),k=(0,q.useRef)(w);(0,q.useEffect)(()=>{let b={cancelled:!1};return k.current=w,ae((async()=>{x({type:"loading"});try{let N=await e.queryLogArchive(y);b.cancelled||x({cursor:N.nextCursor,rows:N.rows,type:"loaded"})}catch(N){b.cancelled||x(he(N)===De?{type:"notConfigured"}:{message:re(N),type:"failed"})}})()),()=>{b.cancelled=!0}},[e,w]);let L=v(async()=>{if(d===void 0)return;let b=w;x({type:"loading"});try{let N=await e.queryLogArchive({...y,cursor:d});k.current===b&&x({cursor:N.nextCursor,rows:N.rows,type:"append"})}catch(N){k.current===b&&x({message:re(N),type:"pageFailed"})}},"N"),S=v(b=>{n(b.target.value)},"I"),T=v(b=>{c(b.target.value)},"T"),R=v(b=>{m(b.target.value)},"R"),P=v(()=>{ae(L())},"k");return g?(0,r.jsx)(J,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:S,placeholder:t("function path\u2026"),value:s}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:T,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:R,value:p,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),ue.map(b=>(0,r.jsx)("option",{value:b,children:b},b))]})]}),a!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:a}),l&&u===null&&a===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),u!==null&&u.length===0&&(0,r.jsx)(J,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),u!==null&&u.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(ye,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(we,{children:(0,r.jsxs)(se,{children:[(0,r.jsx)(j,{children:t("Time")}),(0,r.jsx)(j,{children:t("Level")}),(0,r.jsx)(j,{children:t("Function")}),(0,r.jsx)(j,{children:t("Message")}),(0,r.jsx)(j,{children:t("Trace")}),(0,r.jsx)(j,{children:t("Shard")}),(0,r.jsx)(j,{children:t("User")})]})}),(0,r.jsx)(Ne,{children:u.map((b,N)=>(0,r.jsx)(We,{row:b},`${String(h)}:${String(b.ts)}-${String(N)}`))})]})}),d!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(pe,{"data-testid":"lg-archive-more",disabled:l,onClick:P,size:"sm",variant:"outline",children:t(l?"Loading\u2026":"Load more")})})]})},"He"),Qe=v(i=>{let e=(0,K.c)(11),{level:t,onToggle:s,selected:n}=i,o;e[0]!==t||e[1]!==s?(o=v(()=>{s(t)},"o"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let c=o,p=n?"border-border bg-muted font-medium":"border-input text-muted-foreground",m;e[3]!==p?(m=W("rounded-md border px-2 py-1 text-xs",p),e[3]=p,e[4]=m):m=e[4];let d=`logs-level-${t}`,a;return e[5]!==t||e[6]!==c||e[7]!==n||e[8]!==m||e[9]!==d?(a=(0,r.jsx)("button",{"aria-pressed":n,className:m,"data-testid":d,onClick:c,type:"button",children:t}),e[5]=t,e[6]=c,e[7]=n,e[8]=m,e[9]=d,e[10]=a):a=e[10],a},"We"),Ye=v(i=>{let e=(0,K.c)(68),{levelFilter:t,onLogPathChange:s,onSearchChange:n,onTimeRangeChange:o,onToggleLevel:c,onToggleSummary:p,pathFilter:m,search:d,showSummary:a,timeRange:h}=i,l=z(),g;e[0]!==l?(g=l("Search messages"),e[0]=l,e[1]=g):g=e[1];let u;e[2]!==l?(u=l("search message"),e[2]=l,e[3]=u):u=e[3];let x;e[4]!==n||e[5]!==d||e[6]!==g||e[7]!==u?(x=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-48","data-testid":"lg-search",onChange:n,placeholder:u,value:d}),e[4]=n,e[5]=d,e[6]=g,e[7]=u,e[8]=x):x=e[8];let f;e[9]!==l?(f=l("Function path"),e[9]=l,e[10]=f):f=e[10];let C;e[11]!==l?(C=l("filter path"),e[11]=l,e[12]=C):C=e[12];let y;e[13]!==s||e[14]!==m||e[15]!==f||e[16]!==C?(y=(0,r.jsx)(D,{"aria-label":f,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:s,placeholder:C,value:m}),e[13]=s,e[14]=m,e[15]=f,e[16]=C,e[17]=y):y=e[17];let w;e[18]!==l?(w=l("Level filter"),e[18]=l,e[19]=w):w=e[19];let k;e[20]!==t||e[21]!==c?(k=ue.map(Q=>(0,r.jsx)(Qe,{level:Q,onToggle:c,selected:t.has(Q)},Q)),e[20]=t,e[21]=c,e[22]=k):k=e[22];let L;e[23]!==w||e[24]!==k?(L=(0,r.jsx)("div",{"aria-label":w,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:k}),e[23]=w,e[24]=k,e[25]=L):L=e[25];let S;e[26]!==l?(S=l("Time range"),e[26]=l,e[27]=S):S=e[27];let T;e[28]!==l?(T=l("All time"),e[28]=l,e[29]=T):T=e[29];let R;e[30]!==T?(R=(0,r.jsx)("option",{value:"all",children:T}),e[30]=T,e[31]=R):R=e[31];let P;e[32]!==l?(P=l("Last 5m"),e[32]=l,e[33]=P):P=e[33];let b;e[34]!==P?(b=(0,r.jsx)("option",{value:"5m",children:P}),e[34]=P,e[35]=b):b=e[35];let N;e[36]!==l?(N=l("Last 15m"),e[36]=l,e[37]=N):N=e[37];let F;e[38]!==N?(F=(0,r.jsx)("option",{value:"15m",children:N}),e[38]=N,e[39]=F):F=e[39];let E;e[40]!==l?(E=l("Last hour"),e[40]=l,e[41]=E):E=e[41];let O;e[42]!==E?(O=(0,r.jsx)("option",{value:"1h",children:E}),e[42]=E,e[43]=O):O=e[43];let M;e[44]!==o||e[45]!==S||e[46]!==R||e[47]!==b||e[48]!==F||e[49]!==O||e[50]!==h?(M=(0,r.jsxs)("select",{"aria-label":S,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:h,children:[R,b,F,O]}),e[44]=o,e[45]=S,e[46]=R,e[47]=b,e[48]=F,e[49]=O,e[50]=h,e[51]=M):M=e[51];let V=a?"border-border bg-muted font-medium":"border-input text-muted-foreground",_;e[52]!==V?(_=W("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=_):_=e[53];let U;e[54]!==a||e[55]!==l?(U=l(a?"List":"Summary"),e[54]=a,e[55]=l,e[56]=U):U=e[56];let A;e[57]!==p||e[58]!==a||e[59]!==_||e[60]!==U?(A=(0,r.jsx)("button",{"aria-pressed":a,className:_,"data-testid":"logs-summary-toggle",onClick:p,type:"button",children:U}),e[57]=p,e[58]=a,e[59]=_,e[60]=U,e[61]=A):A=e[61];let $;return e[62]!==M||e[63]!==A||e[64]!==x||e[65]!==y||e[66]!==L?($=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[x,y,L,M,A]}),e[62]=M,e[63]=A,e[64]=x,e[65]=y,e[66]=L,e[67]=$):$=e[67],$},"Ye"),Ge=v(i=>{let e=(0,K.c)(53),{onOutcomeChange:t,onPathChange:s,onTableChange:n,onUserChange:o,outcomeFilter:c,pathPrefix:p,tableFilter:m,userIdFilter:d}=i,a=z(),h;e[0]!==a?(h=a("Function path"),e[0]=a,e[1]=h):h=e[1];let l;e[2]!==a?(l=a("file:function"),e[2]=a,e[3]=l):l=e[3];let g;e[4]!==s||e[5]!==p||e[6]!==h||e[7]!==l?(g=(0,r.jsx)(D,{"aria-label":h,className:"h-8 w-44","data-testid":"lg-req-path",onChange:s,placeholder:l,value:p}),e[4]=s,e[5]=p,e[6]=h,e[7]=l,e[8]=g):g=e[8];let u;e[9]!==a?(u=a("User id"),e[9]=a,e[10]=u):u=e[10];let x;e[11]!==a?(x=a("userId"),e[11]=a,e[12]=x):x=e[12];let f;e[13]!==o||e[14]!==u||e[15]!==x||e[16]!==d?(f=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:x,value:d}),e[13]=o,e[14]=u,e[15]=x,e[16]=d,e[17]=f):f=e[17];let C;e[18]!==a?(C=a("Table touched"),e[18]=a,e[19]=C):C=e[19];let y;e[20]!==a?(y=a("table"),e[20]=a,e[21]=y):y=e[21];let w;e[22]!==n||e[23]!==C||e[24]!==y||e[25]!==m?(w=(0,r.jsx)(D,{"aria-label":C,className:"h-8 w-32","data-testid":"lg-req-table",onChange:n,placeholder:y,value:m}),e[22]=n,e[23]=C,e[24]=y,e[25]=m,e[26]=w):w=e[26];let k;e[27]!==a?(k=a("Outcome filter"),e[27]=a,e[28]=k):k=e[28];let L;e[29]!==a?(L=a("all"),e[29]=a,e[30]=L):L=e[30];let S;e[31]!==L?(S=(0,r.jsx)("option",{value:"all",children:L}),e[31]=L,e[32]=S):S=e[32];let T;e[33]!==a?(T=a("ok"),e[33]=a,e[34]=T):T=e[34];let R;e[35]!==T?(R=(0,r.jsx)("option",{value:"ok",children:T}),e[35]=T,e[36]=R):R=e[36];let P;e[37]!==a?(P=a("error"),e[37]=a,e[38]=P):P=e[38];let b;e[39]!==P?(b=(0,r.jsx)("option",{value:"error",children:P}),e[39]=P,e[40]=b):b=e[40];let N;e[41]!==t||e[42]!==c||e[43]!==k||e[44]!==S||e[45]!==R||e[46]!==b?(N=(0,r.jsxs)("select",{"aria-label":k,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:c,children:[S,R,b]}),e[41]=t,e[42]=c,e[43]=k,e[44]=S,e[45]=R,e[46]=b,e[47]=N):N=e[47];let F;return e[48]!==N||e[49]!==g||e[50]!==f||e[51]!==w?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g,f,w,N]}),e[48]=N,e[49]=g,e[50]=f,e[51]=w,e[52]=F):F=e[52],F},"je"),Oe=v(i=>{let e=(0,K.c)(7),{bucket:t}=i,s;e[0]!==t.key?(s=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=s):s=e[1];let n;e[2]!==t.count?(n=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=n):n=e[3];let o;return e[4]!==s||e[5]!==n?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[s,n]}),e[4]=s,e[5]=n,e[6]=o):o=e[6],o},"pe"),He=v(i=>{let e=(0,K.c)(31),{summary:t}=i,s=z(),n;e[0]!==t.total||e[1]!==s?(n=s("{count} entries",{count:t.total}),e[0]=t.total,e[1]=s,e[2]=n):n=e[2];let o;e[3]!==n?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:n}),e[3]=n,e[4]=o):o=e[4];let c;e[5]!==s?(c=s("By level"),e[5]=s,e[6]=c):c=e[6];let p;e[7]!==c?(p=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),e[7]=c,e[8]=p):p=e[8];let m;e[9]!==t.byLevel?(m=t.byLevel.map(Je),e[9]=t.byLevel,e[10]=m):m=e[10];let d;e[11]!==m?(d=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:m}),e[11]=m,e[12]=d):d=e[12];let a;e[13]!==p||e[14]!==d?(a=(0,r.jsxs)("div",{children:[p,d]}),e[13]=p,e[14]=d,e[15]=a):a=e[15];let h;e[16]!==s?(h=s("By function"),e[16]=s,e[17]=h):h=e[17];let l;e[18]!==h?(l=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[18]=h,e[19]=l):l=e[19];let g;e[20]!==t.byPath?(g=t.byPath.map(Xe),e[20]=t.byPath,e[21]=g):g=e[21];let u;e[22]!==g?(u=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:g}),e[22]=g,e[23]=u):u=e[23];let x;e[24]!==u||e[25]!==l?(x=(0,r.jsxs)("div",{children:[l,u]}),e[24]=u,e[25]=l,e[26]=x):x=e[26];let f;return e[27]!==x||e[28]!==o||e[29]!==a?(f=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,a,x]}),e[27]=x,e[28]=o,e[29]=a,e[30]=f):f=e[30],f},"Je");function Je(i){return(0,r.jsx)(Oe,{bucket:i},i.key)}v(Je,"Xe");function Xe(i){return(0,r.jsx)(Oe,{bucket:i},i.key)}v(Xe,"Ze");var Ze=v(i=>{let e=(0,K.c)(46),{liveError:t,onShardKeyChange:s,onShowArchive:n,onShowErrors:o,onShowRequests:c,shardKey:p,view:m}=i,d=z(),a=m==="requests",h=m==="requests"?"bg-muted font-medium":"text-muted-foreground",l;e[0]!==h?(l=W("px-3 py-1 text-sm",h),e[0]=h,e[1]=l):l=e[1];let g;e[2]!==d?(g=d("Requests"),e[2]=d,e[3]=g):g=e[3];let u;e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==g?(u=(0,r.jsx)("button",{"aria-selected":a,className:l,"data-testid":"lg-view-requests",onClick:c,role:"tab",type:"button",children:g}),e[4]=c,e[5]=a,e[6]=l,e[7]=g,e[8]=u):u=e[8];let x=m==="errors",f=m==="errors"?"bg-muted font-medium":"text-muted-foreground",C;e[9]!==f?(C=W("px-3 py-1 text-sm",f),e[9]=f,e[10]=C):C=e[10];let y;e[11]!==d?(y=d("Errors"),e[11]=d,e[12]=y):y=e[12];let w;e[13]!==o||e[14]!==x||e[15]!==C||e[16]!==y?(w=(0,r.jsx)("button",{"aria-selected":x,className:C,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:y}),e[13]=o,e[14]=x,e[15]=C,e[16]=y,e[17]=w):w=e[17];let k=m==="archive",L=m==="archive"?"bg-muted font-medium":"text-muted-foreground",S;e[18]!==L?(S=W("px-3 py-1 text-sm",L),e[18]=L,e[19]=S):S=e[19];let T;e[20]!==d?(T=d("Archive"),e[20]=d,e[21]=T):T=e[21];let R;e[22]!==n||e[23]!==k||e[24]!==S||e[25]!==T?(R=(0,r.jsx)("button",{"aria-selected":k,className:S,"data-testid":"lg-view-archive",onClick:n,role:"tab",type:"button",children:T}),e[22]=n,e[23]=k,e[24]=S,e[25]=T,e[26]=R):R=e[26];let P;e[27]!==w||e[28]!==R||e[29]!==u?(P=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[u,w,R]}),e[27]=w,e[28]=R,e[29]=u,e[30]=P):P=e[30];let b;e[31]!==s||e[32]!==p?(b=(0,r.jsx)(ve,{onChange:s,testId:"lg-shard-input",value:p}),e[31]=s,e[32]=p,e[33]=b):b=e[33];let N;e[34]!==t||e[35]!==m?(N=m!=="archive"&&(0,r.jsx)(Ce,{message:t,prefix:"lg"}),e[34]=t,e[35]=m,e[36]=N):N=e[36];let F;e[37]!==d?(F=d("Open in Cloudflare"),e[37]=d,e[38]=F):F=e[38];let E;e[39]!==F?(E=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=E):E=e[40];let O;return e[41]!==P||e[42]!==b||e[43]!==N||e[44]!==E?(O=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[P,b,N,E]}),e[41]=P,e[42]=b,e[43]=N,e[44]=E,e[45]=O):O=e[45],O},"et"),ce=400,et=36,tt={height:ce,overflow:"auto"},Ke={left:0,position:"absolute",top:0,width:"100%"},rt={error:"destructive",ok:"secondary"},Me=v(i=>{let e=(0,K.c)(6),{onOpenTrace:t,traceId:s}=i,n=z(),o;e[0]!==t||e[1]!==n||e[2]!==s?(o=s===void 0?null:(0,r.jsx)("button",{className:"text-primary underline-offset-2 hover:underline","data-testid":"lg-trace-link",onClick:v(()=>{t(s)},"onClick"),type:"button",children:n("Trace")}),e[0]=t,e[1]=n,e[2]=s,e[3]=o):o=e[3];let c;return e[4]!==o?(c=(0,r.jsx)("span",{className:"w-16 shrink-0 text-right",role:"gridcell",children:o}),e[4]=o,e[5]=c):c=e[5],c},"be"),at=v(i=>{let e=(0,K.c)(13),{entry:t,index:s,measureRef:n,onOpenTrace:o,start:c}=i,p=`translateY(${String(c)}px)`,m;e[0]!==p?(m={...Ke,transform:p},e[0]=p,e[1]=m):m=e[1];let d=m,a;e[2]!==t?(a=(0,r.jsx)(qe,{entry:t}),e[2]=t,e[3]=a):a=e[3];let h;e[4]!==t.traceId||e[5]!==o?(h=(0,r.jsx)(Me,{onOpenTrace:o,traceId:t.traceId}),e[4]=t.traceId,e[5]=o,e[6]=h):h=e[6];let l;return e[7]!==s||e[8]!==n||e[9]!==d||e[10]!==a||e[11]!==h?(l=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-row",ref:n,role:"row",style:d,children:[a,h]}),e[7]=s,e[8]=n,e[9]=d,e[10]=a,e[11]=h,e[12]=l):l=e[12],l},"lt"),Fe=v(i=>i.length===0?"\u2014":i.join(", "),"ce"),lt=v(i=>{let e=(0,K.c)(41),{entry:t,index:s,measureRef:n,onOpenTrace:o,start:c}=i,p=`translateY(${String(c)}px)`,m;e[0]!==p?(m={...Ke,transform:p},e[0]=p,e[1]=m):m=e[1];let d=m,a;e[2]!==t.ts?(a=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=a):a=e[3];let h;e[4]!==a?(h=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:a}),e[4]=a,e[5]=h):h=e[5];let l=rt[t.outcome],g;e[6]!==t.outcome||e[7]!==l?(g=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(ne,{variant:l,children:t.outcome})}),e[6]=t.outcome,e[7]=l,e[8]=g):g=e[8];let u;e[9]!==t.functionPath?(u=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=u):u=e[10];let x=t.shardKey??"\u2014",f;e[11]!==x?(f=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:x}),e[11]=x,e[12]=f):f=e[12];let C=t.userId??"\u2014",y;e[13]!==C?(y=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:C}),e[13]=C,e[14]=y):y=e[14];let w;e[15]!==t.durationMs?(w=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=w):w=e[16];let k=`${String(w)}ms`,L;e[17]!==k?(L=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:k}),e[17]=k,e[18]=L):L=e[18];let S;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(S=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${Fe(t.tablesRead)} \xB7 w:${Fe(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=S):S=e[23];let T;e[24]!==S?(T=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:S}),e[24]=S,e[25]=T):T=e[25];let R;e[26]!==t.traceId||e[27]!==o?(R=(0,r.jsx)(Me,{onOpenTrace:o,traceId:t.traceId}),e[26]=t.traceId,e[27]=o,e[28]=R):R=e[28];let P;return e[29]!==s||e[30]!==n||e[31]!==d||e[32]!==y||e[33]!==L||e[34]!==T||e[35]!==R||e[36]!==h||e[37]!==g||e[38]!==u||e[39]!==f?(P=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-req-row",ref:n,role:"row",style:d,children:[h,g,u,f,y,L,T,R]}),e[29]=s,e[30]=n,e[31]=d,e[32]=y,e[33]=L,e[34]=T,e[35]=R,e[36]=h,e[37]=g,e[38]=u,e[39]=f,e[40]=P):P=e[40],P},"ot"),Ee=v(i=>{let{entries:e}=i??{};return Array.isArray(e)?e:[]},"de"),ot=v(i=>{let e={};return i.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=i.functionPathPrefix.trim()),i.userId.trim()!==""&&(e.userId=i.userId.trim()),i.tableTouched.trim()!==""&&(e.tableTouched=i.tableTouched.trim()),(i.outcome==="ok"||i.outcome==="error")&&(e.outcome=i.outcome),e},"nt"),nt={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},st=v((i,e)=>{let t=e.search.trim().toLowerCase(),s=e.path.trim().toLowerCase(),n=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-nt[e.range];return i.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<n||s!==""&&!(o.functionPath??"").toLowerCase().includes(s)?!1:t===""||o.message.toLowerCase().includes(t)||Te(o.fields).toLowerCase().includes(t))},"it"),it="\u2014",dt=v(i=>{let e=new Map,t=new Map;for(let o of i){e.set(o.level,(e.get(o.level)??0)+1);let c=o.functionPath??it;t.set(c,(t.get(c)??0)+1)}let s=ue.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),n=[...t.entries()].map(([o,c])=>({count:c,key:o})).toSorted((o,c)=>c.count===o.count?o.key.localeCompare(c.key):c.count-o.count);return{byLevel:s,byPath:n,total:i.length}},"dt"),Et=v(({initialShardKey:i})=>{let e=z(),[t,s]=(0,q.useState)("requests"),{queryShardKey:n,setShardKey:o,shardKey:c}=be(i),[p,m]=(0,q.useState)(""),[d,a]=(0,q.useState)(()=>new Set),[h,l]=(0,q.useState)(""),[g,u]=(0,q.useState)("all"),[x,f]=(0,q.useState)(!1),[C,y]=(0,q.useState)(""),[w,k]=(0,q.useState)(""),[L,S]=(0,q.useState)(""),[T,R]=(0,q.useState)("all"),P=ot({functionPathPrefix:C,outcome:T,tableTouched:L,userId:w}),b=le(oe.getRequestLog,P,{enabled:t==="requests",live:!0,shardKey:n}),N=le(oe.getLogs,{},{enabled:t==="errors",live:!0,shardKey:n}),F=t==="requests"?b:N,{error:E,errorSource:O,isLoading:M,liveError:V}=F,_=Se(n),U=Ee(N.data),A=Ee(b.data);(0,q.useEffect)(()=>{F.data!==void 0&&fe(n)},[F.data,n]);let $=st(U,{levels:d,now:Date.now(),path:h,range:g,search:p}),Q=dt($),X=t==="requests"?A.length:$.length,Z=t==="errors"&&x,Y=(0,q.useMemo)(()=>E!==null?"error":X===0?M?Z?"summary":"list":"empty":Z?"summary":"list",[X,M,E,Z]),me=(0,q.useRef)(null),G=ke({count:X,estimateSize:v(()=>et,"estimateSize"),getItemKey:v(I=>t==="errors"?$[I]?.id??I:I,"getItemKey"),getScrollElement:v(()=>me.current,"getScrollElement"),initialRect:{height:ce,width:800},observeElementRect:v((I,ee)=>Le(I,ee,ce),"observeElementRect"),overscan:8}),_e=G.getVirtualItems(),Ae={height:G.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Ze,{liveError:V,onShardKeyChange:o,onShowArchive:v(()=>{s("archive"),f(!1)},"onShowArchive"),onShowErrors:v(()=>{s("errors"),f(!1)},"onShowErrors"),onShowRequests:v(()=>{s("requests"),f(!1)},"onShowRequests"),shardKey:c,view:t}),t==="errors"&&(0,r.jsx)(Ye,{levelFilter:d,onLogPathChange:v(I=>{l(I.target.value)},"onLogPathChange"),onSearchChange:v(I=>{m(I.target.value)},"onSearchChange"),onTimeRangeChange:v(I=>{u(I.target.value)},"onTimeRangeChange"),onToggleLevel:v(I=>{a(ee=>{let H=new Set(ee);return H.has(I)?H.delete(I):H.add(I),H})},"onToggleLevel"),onToggleSummary:v(()=>{f(I=>!I)},"onToggleSummary"),pathFilter:h,search:p,showSummary:x,timeRange:g}),t==="requests"&&(0,r.jsx)(Ge,{onOutcomeChange:v(I=>{R(I.target.value)},"onOutcomeChange"),onPathChange:v(I=>{y(I.target.value)},"onPathChange"),onTableChange:v(I=>{S(I.target.value)},"onTableChange"),onUserChange:v(I=>{k(I.target.value)},"onUserChange"),outcomeFilter:T,pathPrefix:C,tableFilter:L,userIdFilter:w}),t==="archive"?(0,r.jsx)(Ve,{shardKey:n}):(0,r.jsxs)(r.Fragment,{children:[Y==="error"&&(0,r.jsx)(xe,{error:O,shardKey:n,testId:"lg-error"}),Y==="empty"&&(0,r.jsx)(J,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Y==="summary"&&(0,r.jsx)(He,{summary:Q}),Y==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:me,style:tt,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Ae,children:_e.map(I=>t==="requests"?(0,r.jsx)(lt,{entry:A[I.index],index:I.index,measureRef:G.measureElement,onOpenTrace:_,start:I.start},I.key):(0,r.jsx)(at,{entry:$[I.index],index:I.index,measureRef:G.measureElement,onOpenTrace:_,start:I.start},I.key))})})]})]})},"jt");export{Et as LogsPanel,st as filterLogs,dt as summarizeLogs};
1
+ import{a as Re,b as Pe,c as qe}from"./chunk-THRRRMIZ.js";import{b as Ie,c as Te}from"./chunk-LJLNIVUA.js";import{a as Se}from"./chunk-SRNRWSMY.js";import"./chunk-QLZGKBOW.js";import{a as de}from"./chunk-R6NJ4ER6.js";import{a as Le}from"./chunk-W7CLOQOU.js";import{c as ke}from"./chunk-MHZNDDGI.js";import{a as Ce}from"./chunk-2LKJSQKF.js";import{a as ie}from"./chunk-DRHZZ7IN.js";import{a as be}from"./chunk-2KTN53PK.js";import{a as ve}from"./chunk-PAFHBQFL.js";import{b as fe}from"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import{i as D}from"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as pe}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as J}from"./chunk-S3TDGFRE.js";import{b as ne}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as xe}from"./chunk-2G5OZPH5.js";import"./chunk-S7NFUY75.js";import{a as ye,b as we,c as Ne,d as se,e as j,f as B}from"./chunk-J3ZEO3PJ.js";import"./chunk-IR2MDKXQ.js";import"./chunk-PSBRO6JX.js";import"./chunk-EOFWXI3T.js";import{a as oe}from"./chunk-LYVYUTQY.js";import{c as le}from"./chunk-KE7ZGUGO.js";import{n as ge}from"./chunk-UK5OOCLQ.js";import"./chunk-ZPQBVYNN.js";import{B as z,j as re,k as he,s as ae,x as W}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as Ue}from"./chunk-A6TVTNKO.js";import{a as $e,b as ze}from"./chunk-ADABTCDI.js";import{a as v,d as te}from"./chunk-5PEAXTYQ.js";var K=te(Ue(),1);var q=te($e(),1);var r=te(ze(),1);var ue=["trace","debug","log","info","warn","error","fatal"],De="LOG_ARCHIVE_NOT_CONFIGURED",je={cursor:void 0,error:null,generation:0,loading:!1,notConfigured:!1,rows:null},Be=v((i,e)=>{switch(e.type){case"append":return{...i,cursor:e.cursor,error:null,loading:!1,rows:[...i.rows??[],...e.rows]};case"failed":return{...i,cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,generation:i.generation+1,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...i,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{...i,cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...i,error:e.message,loading:!1};default:return i}},"ze"),We=v(i=>{let e=(0,K.c)(36),{row:t}=i,s;e[0]!==t.fields?(s=Ie(t.fields),e[0]=t.fields,e[1]=s):s=e[1];let n=s,o=`lg-archive-row-${String(t.ts)}`,c;e[2]!==t.ts?(c=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=c):c=e[3];let p;e[4]!==c?(p=(0,r.jsx)(B,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:c}),e[4]=c,e[5]=p):p=e[5];let m=Re[t.level],d;e[6]!==t.level||e[7]!==m?(d=(0,r.jsx)(B,{children:(0,r.jsx)(ne,{variant:m,children:t.level})}),e[6]=t.level,e[7]=m,e[8]=d):d=e[8];let a;e[9]!==t.functionPath?(a=(0,r.jsx)(B,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=a):a=e[10];let h;e[11]!==t.message?(h=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=h):h=e[12];let l;e[13]!==n.text?(l=n.text!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:n.text,children:n.text}),e[13]=n.text,e[14]=l):l=e[14];let g;e[15]!==n.errors?(g=n.errors.length>0&&(0,r.jsx)(Pe,{errors:n.errors}),e[15]=n.errors,e[16]=g):g=e[16];let u;e[17]!==g||e[18]!==h||e[19]!==l?(u=(0,r.jsxs)(B,{className:"max-w-md",children:[h,l,g]}),e[17]=g,e[18]=h,e[19]=l,e[20]=u):u=e[20];let x=t.traceId??"\u2014",f;e[21]!==x?(f=(0,r.jsx)(B,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[21]=x,e[22]=f):f=e[22];let C=t.shardKey??"\u2014",y;e[23]!==C?(y=(0,r.jsx)(B,{className:"font-mono text-[11px] text-muted-foreground",children:C}),e[23]=C,e[24]=y):y=e[24];let w=t.userId??"\u2014",k;e[25]!==w?(k=(0,r.jsx)(B,{className:"font-mono text-[11px] text-muted-foreground",children:w}),e[25]=w,e[26]=k):k=e[26];let L;return e[27]!==u||e[28]!==f||e[29]!==y||e[30]!==k||e[31]!==o||e[32]!==p||e[33]!==d||e[34]!==a?(L=(0,r.jsxs)(se,{"data-testid":o,children:[p,d,a,u,f,y,k]}),e[27]=u,e[28]=f,e[29]=y,e[30]=k,e[31]=o,e[32]=p,e[33]=d,e[34]=a,e[35]=L):L=e[35],L},"Ge"),Ve=v(({shardKey:i})=>{let e=ge(),t=z(),[s,n]=(0,q.useState)(""),[o,c]=(0,q.useState)(""),[p,m]=(0,q.useState)(""),[{cursor:d,error:a,generation:h,loading:l,notConfigured:g,rows:u},x]=(0,q.useReducer)(Be,je),f=ie(s.trim(),400),C=ie(o.trim(),400),y={...f===""?{}:{functionPathPrefix:f},...p===""?{}:{minLevel:p},...i===""?{}:{shardKey:i},...C===""?{}:{userId:C}},w=JSON.stringify(y),k=(0,q.useRef)(w);(0,q.useEffect)(()=>{let b={cancelled:!1};return k.current=w,ae((async()=>{x({type:"loading"});try{let N=await e.queryLogArchive(y);b.cancelled||x({cursor:N.nextCursor,rows:N.rows,type:"loaded"})}catch(N){b.cancelled||x(he(N)===De?{type:"notConfigured"}:{message:re(N),type:"failed"})}})()),()=>{b.cancelled=!0}},[e,w]);let L=v(async()=>{if(d===void 0)return;let b=w;x({type:"loading"});try{let N=await e.queryLogArchive({...y,cursor:d});k.current===b&&x({cursor:N.nextCursor,rows:N.rows,type:"append"})}catch(N){k.current===b&&x({message:re(N),type:"pageFailed"})}},"N"),S=v(b=>{n(b.target.value)},"I"),T=v(b=>{c(b.target.value)},"T"),R=v(b=>{m(b.target.value)},"R"),P=v(()=>{ae(L())},"k");return g?(0,r.jsx)(J,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:S,placeholder:t("function path\u2026"),value:s}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:T,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:R,value:p,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),ue.map(b=>(0,r.jsx)("option",{value:b,children:b},b))]})]}),a!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:a}),l&&u===null&&a===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),u!==null&&u.length===0&&(0,r.jsx)(J,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),u!==null&&u.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(ye,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(we,{children:(0,r.jsxs)(se,{children:[(0,r.jsx)(j,{children:t("Time")}),(0,r.jsx)(j,{children:t("Level")}),(0,r.jsx)(j,{children:t("Function")}),(0,r.jsx)(j,{children:t("Message")}),(0,r.jsx)(j,{children:t("Trace")}),(0,r.jsx)(j,{children:t("Shard")}),(0,r.jsx)(j,{children:t("User")})]})}),(0,r.jsx)(Ne,{children:u.map((b,N)=>(0,r.jsx)(We,{row:b},`${String(h)}:${String(b.ts)}-${String(N)}`))})]})}),d!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(pe,{"data-testid":"lg-archive-more",disabled:l,onClick:P,size:"sm",variant:"outline",children:t(l?"Loading\u2026":"Load more")})})]})},"He"),Qe=v(i=>{let e=(0,K.c)(11),{level:t,onToggle:s,selected:n}=i,o;e[0]!==t||e[1]!==s?(o=v(()=>{s(t)},"o"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let c=o,p=n?"border-border bg-muted font-medium":"border-input text-muted-foreground",m;e[3]!==p?(m=W("rounded-md border px-2 py-1 text-xs",p),e[3]=p,e[4]=m):m=e[4];let d=`logs-level-${t}`,a;return e[5]!==t||e[6]!==c||e[7]!==n||e[8]!==m||e[9]!==d?(a=(0,r.jsx)("button",{"aria-pressed":n,className:m,"data-testid":d,onClick:c,type:"button",children:t}),e[5]=t,e[6]=c,e[7]=n,e[8]=m,e[9]=d,e[10]=a):a=e[10],a},"We"),Ye=v(i=>{let e=(0,K.c)(68),{levelFilter:t,onLogPathChange:s,onSearchChange:n,onTimeRangeChange:o,onToggleLevel:c,onToggleSummary:p,pathFilter:m,search:d,showSummary:a,timeRange:h}=i,l=z(),g;e[0]!==l?(g=l("Search messages"),e[0]=l,e[1]=g):g=e[1];let u;e[2]!==l?(u=l("search message"),e[2]=l,e[3]=u):u=e[3];let x;e[4]!==n||e[5]!==d||e[6]!==g||e[7]!==u?(x=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-48","data-testid":"lg-search",onChange:n,placeholder:u,value:d}),e[4]=n,e[5]=d,e[6]=g,e[7]=u,e[8]=x):x=e[8];let f;e[9]!==l?(f=l("Function path"),e[9]=l,e[10]=f):f=e[10];let C;e[11]!==l?(C=l("filter path"),e[11]=l,e[12]=C):C=e[12];let y;e[13]!==s||e[14]!==m||e[15]!==f||e[16]!==C?(y=(0,r.jsx)(D,{"aria-label":f,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:s,placeholder:C,value:m}),e[13]=s,e[14]=m,e[15]=f,e[16]=C,e[17]=y):y=e[17];let w;e[18]!==l?(w=l("Level filter"),e[18]=l,e[19]=w):w=e[19];let k;e[20]!==t||e[21]!==c?(k=ue.map(Q=>(0,r.jsx)(Qe,{level:Q,onToggle:c,selected:t.has(Q)},Q)),e[20]=t,e[21]=c,e[22]=k):k=e[22];let L;e[23]!==w||e[24]!==k?(L=(0,r.jsx)("div",{"aria-label":w,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:k}),e[23]=w,e[24]=k,e[25]=L):L=e[25];let S;e[26]!==l?(S=l("Time range"),e[26]=l,e[27]=S):S=e[27];let T;e[28]!==l?(T=l("All time"),e[28]=l,e[29]=T):T=e[29];let R;e[30]!==T?(R=(0,r.jsx)("option",{value:"all",children:T}),e[30]=T,e[31]=R):R=e[31];let P;e[32]!==l?(P=l("Last 5m"),e[32]=l,e[33]=P):P=e[33];let b;e[34]!==P?(b=(0,r.jsx)("option",{value:"5m",children:P}),e[34]=P,e[35]=b):b=e[35];let N;e[36]!==l?(N=l("Last 15m"),e[36]=l,e[37]=N):N=e[37];let F;e[38]!==N?(F=(0,r.jsx)("option",{value:"15m",children:N}),e[38]=N,e[39]=F):F=e[39];let E;e[40]!==l?(E=l("Last hour"),e[40]=l,e[41]=E):E=e[41];let O;e[42]!==E?(O=(0,r.jsx)("option",{value:"1h",children:E}),e[42]=E,e[43]=O):O=e[43];let M;e[44]!==o||e[45]!==S||e[46]!==R||e[47]!==b||e[48]!==F||e[49]!==O||e[50]!==h?(M=(0,r.jsxs)("select",{"aria-label":S,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:h,children:[R,b,F,O]}),e[44]=o,e[45]=S,e[46]=R,e[47]=b,e[48]=F,e[49]=O,e[50]=h,e[51]=M):M=e[51];let V=a?"border-border bg-muted font-medium":"border-input text-muted-foreground",_;e[52]!==V?(_=W("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=_):_=e[53];let U;e[54]!==a||e[55]!==l?(U=l(a?"List":"Summary"),e[54]=a,e[55]=l,e[56]=U):U=e[56];let A;e[57]!==p||e[58]!==a||e[59]!==_||e[60]!==U?(A=(0,r.jsx)("button",{"aria-pressed":a,className:_,"data-testid":"logs-summary-toggle",onClick:p,type:"button",children:U}),e[57]=p,e[58]=a,e[59]=_,e[60]=U,e[61]=A):A=e[61];let $;return e[62]!==M||e[63]!==A||e[64]!==x||e[65]!==y||e[66]!==L?($=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[x,y,L,M,A]}),e[62]=M,e[63]=A,e[64]=x,e[65]=y,e[66]=L,e[67]=$):$=e[67],$},"Ye"),Ge=v(i=>{let e=(0,K.c)(53),{onOutcomeChange:t,onPathChange:s,onTableChange:n,onUserChange:o,outcomeFilter:c,pathPrefix:p,tableFilter:m,userIdFilter:d}=i,a=z(),h;e[0]!==a?(h=a("Function path"),e[0]=a,e[1]=h):h=e[1];let l;e[2]!==a?(l=a("file:function"),e[2]=a,e[3]=l):l=e[3];let g;e[4]!==s||e[5]!==p||e[6]!==h||e[7]!==l?(g=(0,r.jsx)(D,{"aria-label":h,className:"h-8 w-44","data-testid":"lg-req-path",onChange:s,placeholder:l,value:p}),e[4]=s,e[5]=p,e[6]=h,e[7]=l,e[8]=g):g=e[8];let u;e[9]!==a?(u=a("User id"),e[9]=a,e[10]=u):u=e[10];let x;e[11]!==a?(x=a("userId"),e[11]=a,e[12]=x):x=e[12];let f;e[13]!==o||e[14]!==u||e[15]!==x||e[16]!==d?(f=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:x,value:d}),e[13]=o,e[14]=u,e[15]=x,e[16]=d,e[17]=f):f=e[17];let C;e[18]!==a?(C=a("Table touched"),e[18]=a,e[19]=C):C=e[19];let y;e[20]!==a?(y=a("table"),e[20]=a,e[21]=y):y=e[21];let w;e[22]!==n||e[23]!==C||e[24]!==y||e[25]!==m?(w=(0,r.jsx)(D,{"aria-label":C,className:"h-8 w-32","data-testid":"lg-req-table",onChange:n,placeholder:y,value:m}),e[22]=n,e[23]=C,e[24]=y,e[25]=m,e[26]=w):w=e[26];let k;e[27]!==a?(k=a("Outcome filter"),e[27]=a,e[28]=k):k=e[28];let L;e[29]!==a?(L=a("all"),e[29]=a,e[30]=L):L=e[30];let S;e[31]!==L?(S=(0,r.jsx)("option",{value:"all",children:L}),e[31]=L,e[32]=S):S=e[32];let T;e[33]!==a?(T=a("ok"),e[33]=a,e[34]=T):T=e[34];let R;e[35]!==T?(R=(0,r.jsx)("option",{value:"ok",children:T}),e[35]=T,e[36]=R):R=e[36];let P;e[37]!==a?(P=a("error"),e[37]=a,e[38]=P):P=e[38];let b;e[39]!==P?(b=(0,r.jsx)("option",{value:"error",children:P}),e[39]=P,e[40]=b):b=e[40];let N;e[41]!==t||e[42]!==c||e[43]!==k||e[44]!==S||e[45]!==R||e[46]!==b?(N=(0,r.jsxs)("select",{"aria-label":k,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:c,children:[S,R,b]}),e[41]=t,e[42]=c,e[43]=k,e[44]=S,e[45]=R,e[46]=b,e[47]=N):N=e[47];let F;return e[48]!==N||e[49]!==g||e[50]!==f||e[51]!==w?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g,f,w,N]}),e[48]=N,e[49]=g,e[50]=f,e[51]=w,e[52]=F):F=e[52],F},"je"),Oe=v(i=>{let e=(0,K.c)(7),{bucket:t}=i,s;e[0]!==t.key?(s=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=s):s=e[1];let n;e[2]!==t.count?(n=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=n):n=e[3];let o;return e[4]!==s||e[5]!==n?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[s,n]}),e[4]=s,e[5]=n,e[6]=o):o=e[6],o},"pe"),He=v(i=>{let e=(0,K.c)(31),{summary:t}=i,s=z(),n;e[0]!==t.total||e[1]!==s?(n=s("{count} entries",{count:t.total}),e[0]=t.total,e[1]=s,e[2]=n):n=e[2];let o;e[3]!==n?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:n}),e[3]=n,e[4]=o):o=e[4];let c;e[5]!==s?(c=s("By level"),e[5]=s,e[6]=c):c=e[6];let p;e[7]!==c?(p=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),e[7]=c,e[8]=p):p=e[8];let m;e[9]!==t.byLevel?(m=t.byLevel.map(Je),e[9]=t.byLevel,e[10]=m):m=e[10];let d;e[11]!==m?(d=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:m}),e[11]=m,e[12]=d):d=e[12];let a;e[13]!==p||e[14]!==d?(a=(0,r.jsxs)("div",{children:[p,d]}),e[13]=p,e[14]=d,e[15]=a):a=e[15];let h;e[16]!==s?(h=s("By function"),e[16]=s,e[17]=h):h=e[17];let l;e[18]!==h?(l=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[18]=h,e[19]=l):l=e[19];let g;e[20]!==t.byPath?(g=t.byPath.map(Xe),e[20]=t.byPath,e[21]=g):g=e[21];let u;e[22]!==g?(u=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:g}),e[22]=g,e[23]=u):u=e[23];let x;e[24]!==u||e[25]!==l?(x=(0,r.jsxs)("div",{children:[l,u]}),e[24]=u,e[25]=l,e[26]=x):x=e[26];let f;return e[27]!==x||e[28]!==o||e[29]!==a?(f=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,a,x]}),e[27]=x,e[28]=o,e[29]=a,e[30]=f):f=e[30],f},"Je");function Je(i){return(0,r.jsx)(Oe,{bucket:i},i.key)}v(Je,"Xe");function Xe(i){return(0,r.jsx)(Oe,{bucket:i},i.key)}v(Xe,"Ze");var Ze=v(i=>{let e=(0,K.c)(46),{liveError:t,onShardKeyChange:s,onShowArchive:n,onShowErrors:o,onShowRequests:c,shardKey:p,view:m}=i,d=z(),a=m==="requests",h=m==="requests"?"bg-muted font-medium":"text-muted-foreground",l;e[0]!==h?(l=W("px-3 py-1 text-sm",h),e[0]=h,e[1]=l):l=e[1];let g;e[2]!==d?(g=d("Requests"),e[2]=d,e[3]=g):g=e[3];let u;e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==g?(u=(0,r.jsx)("button",{"aria-selected":a,className:l,"data-testid":"lg-view-requests",onClick:c,role:"tab",type:"button",children:g}),e[4]=c,e[5]=a,e[6]=l,e[7]=g,e[8]=u):u=e[8];let x=m==="errors",f=m==="errors"?"bg-muted font-medium":"text-muted-foreground",C;e[9]!==f?(C=W("px-3 py-1 text-sm",f),e[9]=f,e[10]=C):C=e[10];let y;e[11]!==d?(y=d("Errors"),e[11]=d,e[12]=y):y=e[12];let w;e[13]!==o||e[14]!==x||e[15]!==C||e[16]!==y?(w=(0,r.jsx)("button",{"aria-selected":x,className:C,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:y}),e[13]=o,e[14]=x,e[15]=C,e[16]=y,e[17]=w):w=e[17];let k=m==="archive",L=m==="archive"?"bg-muted font-medium":"text-muted-foreground",S;e[18]!==L?(S=W("px-3 py-1 text-sm",L),e[18]=L,e[19]=S):S=e[19];let T;e[20]!==d?(T=d("Archive"),e[20]=d,e[21]=T):T=e[21];let R;e[22]!==n||e[23]!==k||e[24]!==S||e[25]!==T?(R=(0,r.jsx)("button",{"aria-selected":k,className:S,"data-testid":"lg-view-archive",onClick:n,role:"tab",type:"button",children:T}),e[22]=n,e[23]=k,e[24]=S,e[25]=T,e[26]=R):R=e[26];let P;e[27]!==w||e[28]!==R||e[29]!==u?(P=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[u,w,R]}),e[27]=w,e[28]=R,e[29]=u,e[30]=P):P=e[30];let b;e[31]!==s||e[32]!==p?(b=(0,r.jsx)(ve,{onChange:s,testId:"lg-shard-input",value:p}),e[31]=s,e[32]=p,e[33]=b):b=e[33];let N;e[34]!==t||e[35]!==m?(N=m!=="archive"&&(0,r.jsx)(Ce,{message:t,prefix:"lg"}),e[34]=t,e[35]=m,e[36]=N):N=e[36];let F;e[37]!==d?(F=d("Open in Cloudflare"),e[37]=d,e[38]=F):F=e[38];let E;e[39]!==F?(E=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=E):E=e[40];let O;return e[41]!==P||e[42]!==b||e[43]!==N||e[44]!==E?(O=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[P,b,N,E]}),e[41]=P,e[42]=b,e[43]=N,e[44]=E,e[45]=O):O=e[45],O},"et"),ce=400,et=36,tt={height:ce,overflow:"auto"},Ke={left:0,position:"absolute",top:0,width:"100%"},rt={error:"destructive",ok:"secondary"},Me=v(i=>{let e=(0,K.c)(6),{onOpenTrace:t,traceId:s}=i,n=z(),o;e[0]!==t||e[1]!==n||e[2]!==s?(o=s===void 0?null:(0,r.jsx)("button",{className:"text-primary underline-offset-2 hover:underline","data-testid":"lg-trace-link",onClick:v(()=>{t(s)},"onClick"),type:"button",children:n("Trace")}),e[0]=t,e[1]=n,e[2]=s,e[3]=o):o=e[3];let c;return e[4]!==o?(c=(0,r.jsx)("span",{className:"w-16 shrink-0 text-right",role:"gridcell",children:o}),e[4]=o,e[5]=c):c=e[5],c},"be"),at=v(i=>{let e=(0,K.c)(13),{entry:t,index:s,measureRef:n,onOpenTrace:o,start:c}=i,p=`translateY(${String(c)}px)`,m;e[0]!==p?(m={...Ke,transform:p},e[0]=p,e[1]=m):m=e[1];let d=m,a;e[2]!==t?(a=(0,r.jsx)(qe,{entry:t}),e[2]=t,e[3]=a):a=e[3];let h;e[4]!==t.traceId||e[5]!==o?(h=(0,r.jsx)(Me,{onOpenTrace:o,traceId:t.traceId}),e[4]=t.traceId,e[5]=o,e[6]=h):h=e[6];let l;return e[7]!==s||e[8]!==n||e[9]!==d||e[10]!==a||e[11]!==h?(l=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-row",ref:n,role:"row",style:d,children:[a,h]}),e[7]=s,e[8]=n,e[9]=d,e[10]=a,e[11]=h,e[12]=l):l=e[12],l},"lt"),Fe=v(i=>i.length===0?"\u2014":i.join(", "),"ce"),lt=v(i=>{let e=(0,K.c)(41),{entry:t,index:s,measureRef:n,onOpenTrace:o,start:c}=i,p=`translateY(${String(c)}px)`,m;e[0]!==p?(m={...Ke,transform:p},e[0]=p,e[1]=m):m=e[1];let d=m,a;e[2]!==t.ts?(a=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=a):a=e[3];let h;e[4]!==a?(h=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:a}),e[4]=a,e[5]=h):h=e[5];let l=rt[t.outcome],g;e[6]!==t.outcome||e[7]!==l?(g=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(ne,{variant:l,children:t.outcome})}),e[6]=t.outcome,e[7]=l,e[8]=g):g=e[8];let u;e[9]!==t.functionPath?(u=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=u):u=e[10];let x=t.shardKey??"\u2014",f;e[11]!==x?(f=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:x}),e[11]=x,e[12]=f):f=e[12];let C=t.userId??"\u2014",y;e[13]!==C?(y=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:C}),e[13]=C,e[14]=y):y=e[14];let w;e[15]!==t.durationMs?(w=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=w):w=e[16];let k=`${String(w)}ms`,L;e[17]!==k?(L=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:k}),e[17]=k,e[18]=L):L=e[18];let S;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(S=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${Fe(t.tablesRead)} \xB7 w:${Fe(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=S):S=e[23];let T;e[24]!==S?(T=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:S}),e[24]=S,e[25]=T):T=e[25];let R;e[26]!==t.traceId||e[27]!==o?(R=(0,r.jsx)(Me,{onOpenTrace:o,traceId:t.traceId}),e[26]=t.traceId,e[27]=o,e[28]=R):R=e[28];let P;return e[29]!==s||e[30]!==n||e[31]!==d||e[32]!==y||e[33]!==L||e[34]!==T||e[35]!==R||e[36]!==h||e[37]!==g||e[38]!==u||e[39]!==f?(P=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-req-row",ref:n,role:"row",style:d,children:[h,g,u,f,y,L,T,R]}),e[29]=s,e[30]=n,e[31]=d,e[32]=y,e[33]=L,e[34]=T,e[35]=R,e[36]=h,e[37]=g,e[38]=u,e[39]=f,e[40]=P):P=e[40],P},"ot"),Ee=v(i=>{let{entries:e}=i??{};return Array.isArray(e)?e:[]},"de"),ot=v(i=>{let e={};return i.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=i.functionPathPrefix.trim()),i.userId.trim()!==""&&(e.userId=i.userId.trim()),i.tableTouched.trim()!==""&&(e.tableTouched=i.tableTouched.trim()),(i.outcome==="ok"||i.outcome==="error")&&(e.outcome=i.outcome),e},"nt"),nt={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},st=v((i,e)=>{let t=e.search.trim().toLowerCase(),s=e.path.trim().toLowerCase(),n=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-nt[e.range];return i.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<n||s!==""&&!(o.functionPath??"").toLowerCase().includes(s)?!1:t===""||o.message.toLowerCase().includes(t)||Te(o.fields).toLowerCase().includes(t))},"it"),it="\u2014",dt=v(i=>{let e=new Map,t=new Map;for(let o of i){e.set(o.level,(e.get(o.level)??0)+1);let c=o.functionPath??it;t.set(c,(t.get(c)??0)+1)}let s=ue.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),n=[...t.entries()].map(([o,c])=>({count:c,key:o})).toSorted((o,c)=>c.count===o.count?o.key.localeCompare(c.key):c.count-o.count);return{byLevel:s,byPath:n,total:i.length}},"dt"),Et=v(({initialShardKey:i})=>{let e=z(),[t,s]=(0,q.useState)("requests"),{queryShardKey:n,setShardKey:o,shardKey:c}=be(i),[p,m]=(0,q.useState)(""),[d,a]=(0,q.useState)(()=>new Set),[h,l]=(0,q.useState)(""),[g,u]=(0,q.useState)("all"),[x,f]=(0,q.useState)(!1),[C,y]=(0,q.useState)(""),[w,k]=(0,q.useState)(""),[L,S]=(0,q.useState)(""),[T,R]=(0,q.useState)("all"),P=ot({functionPathPrefix:C,outcome:T,tableTouched:L,userId:w}),b=le(oe.getRequestLog,P,{enabled:t==="requests",live:!0,shardKey:n}),N=le(oe.getLogs,{},{enabled:t==="errors",live:!0,shardKey:n}),F=t==="requests"?b:N,{error:E,errorSource:O,isLoading:M,liveError:V}=F,_=Se(n),U=Ee(N.data),A=Ee(b.data);(0,q.useEffect)(()=>{F.data!==void 0&&fe(n)},[F.data,n]);let $=st(U,{levels:d,now:Date.now(),path:h,range:g,search:p}),Q=dt($),X=t==="requests"?A.length:$.length,Z=t==="errors"&&x,Y=(0,q.useMemo)(()=>E!==null?"error":X===0?M?Z?"summary":"list":"empty":Z?"summary":"list",[X,M,E,Z]),me=(0,q.useRef)(null),G=ke({count:X,estimateSize:v(()=>et,"estimateSize"),getItemKey:v(I=>t==="errors"?$[I]?.id??I:I,"getItemKey"),getScrollElement:v(()=>me.current,"getScrollElement"),initialRect:{height:ce,width:800},observeElementRect:v((I,ee)=>Le(I,ee,ce),"observeElementRect"),overscan:8}),_e=G.getVirtualItems(),Ae={height:G.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Ze,{liveError:V,onShardKeyChange:o,onShowArchive:v(()=>{s("archive"),f(!1)},"onShowArchive"),onShowErrors:v(()=>{s("errors"),f(!1)},"onShowErrors"),onShowRequests:v(()=>{s("requests"),f(!1)},"onShowRequests"),shardKey:c,view:t}),t==="errors"&&(0,r.jsx)(Ye,{levelFilter:d,onLogPathChange:v(I=>{l(I.target.value)},"onLogPathChange"),onSearchChange:v(I=>{m(I.target.value)},"onSearchChange"),onTimeRangeChange:v(I=>{u(I.target.value)},"onTimeRangeChange"),onToggleLevel:v(I=>{a(ee=>{let H=new Set(ee);return H.has(I)?H.delete(I):H.add(I),H})},"onToggleLevel"),onToggleSummary:v(()=>{f(I=>!I)},"onToggleSummary"),pathFilter:h,search:p,showSummary:x,timeRange:g}),t==="requests"&&(0,r.jsx)(Ge,{onOutcomeChange:v(I=>{R(I.target.value)},"onOutcomeChange"),onPathChange:v(I=>{y(I.target.value)},"onPathChange"),onTableChange:v(I=>{S(I.target.value)},"onTableChange"),onUserChange:v(I=>{k(I.target.value)},"onUserChange"),outcomeFilter:T,pathPrefix:C,tableFilter:L,userIdFilter:w}),t==="archive"?(0,r.jsx)(Ve,{shardKey:n}):(0,r.jsxs)(r.Fragment,{children:[Y==="error"&&(0,r.jsx)(xe,{error:O,shardKey:n,testId:"lg-error"}),Y==="empty"&&(0,r.jsx)(J,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Y==="summary"&&(0,r.jsx)(He,{summary:Q}),Y==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:me,style:tt,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Ae,children:_e.map(I=>t==="requests"?(0,r.jsx)(lt,{entry:A[I.index],index:I.index,measureRef:G.measureElement,onOpenTrace:_,start:I.start},I.key):(0,r.jsx)(at,{entry:$[I.index],index:I.index,measureRef:G.measureElement,onOpenTrace:_,start:I.start},I.key))})})]})]})},"jt");export{Et as LogsPanel,st as filterLogs,dt as summarizeLogs};
@@ -1 +1 @@
1
- import{a as q}from"./chunk-7VZFX5O4.js";import{a as D}from"./chunk-D3MLU3PX.js";import"./chunk-S7NFUY75.js";import{a as O,b as K,c as M,d as A,e as b,f as w}from"./chunk-J3ZEO3PJ.js";import"./chunk-YDDMKWPI.js";import"./chunk-5CHKXJYN.js";import"./chunk-EOFWXI3T.js";import{a as U}from"./chunk-LYVYUTQY.js";import{c as R}from"./chunk-UN3QTZ6X.js";import{a as x,e as v}from"./chunk-TN4Z3P6S.js";import{i as I,n as P}from"./chunk-5KQSRLQP.js";import"./chunk-ZPQBVYNN.js";import{B as _,j as C,u as E,x as T}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as B}from"./chunk-A6TVTNKO.js";import{a as z,b as H}from"./chunk-ADABTCDI.js";import{a as l,d as S}from"./chunk-5PEAXTYQ.js";var k=S(z(),1);var V=S(B(),1);var r=S(H(),1);var F="/__lunora/advisor-procedures",Q=6e4,G=l(t=>{if(t.localProcedures)return{kind:"local"};if(t.advisorCompanion){let e=t.token===null||t.token===""?void 0:t.token;return{kind:"remote",remote:{baseUrl:E(t.workerUrl),token:e}}}return{kind:"none"}},"F"),$=class extends Error{static{l(this,"$")}constructor(){super("companion not deployed"),this.name="CompanionNotDeployedError"}},J=l(async t=>{let e=t===void 0?await fetch(F):await fetch(`${t.baseUrl}${F}`,{credentials:"include",headers:t.token===void 0?{}:{authorization:`Bearer ${t.token}`}});if(t!==void 0&&e.status===404)throw new $;if(e.ok&&!(e.headers.get("content-type")??"").includes("application/json"))throw new Error("The advisor procedure route is not available on this host.");if(!e.ok){let a=await e.json().catch(()=>{}),n=typeof a=="object"&&a&&"error"in a?String(a.error):`HTTP ${String(e.status)}`;throw new Error(n)}let o=await e.json();if(typeof o!="object"||o===null||!Array.isArray(o.procedures))throw new Error("The advisor procedure route answered without a procedure list.");return o},"G"),Y=l(t=>{let e=(0,V.c)(16),{enabled:o,refreshKey:a,remote:n}=t,[c,y]=(0,k.useState)(a),[m,p]=(0,k.useState)(0);c!==a&&(y(a),c!==void 0&&p(W));let h;e[0]!==n?(h=l(()=>J(n),"p"),e[0]=n,e[1]=h):h=e[1];let i;e[2]!==n||e[3]!==m?(i=["studio","advisor-procedures",n,m],e[2]=n,e[3]=m,e[4]=i):i=e[4];let f;e[5]!==o||e[6]!==h||e[7]!==i?(f={enabled:o,queryFn:h,queryKey:i,refetchInterval:Q,retry:!1,staleTime:0},e[5]=o,e[6]=h,e[7]=i,e[8]=f):f=e[8];let s=I(f),u;e[9]!==s.error?(u=s.error?C(s.error):void 0,e[9]=s.error,e[10]=u):u=e[10];let N=s.error instanceof $,d=c!==a,g;return e[11]!==s.data||e[12]!==u||e[13]!==N||e[14]!==d?(g={data:s.data,error:u,notDeployed:N,stale:d},e[11]=s.data,e[12]=u,e[13]=N,e[14]=d,e[15]=g):g=e[15],g},"Y");function W(t){return t+1}l(W,"z");var j={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},L={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},X=l((t,e)=>`exempt: ${t.exemptReason===void 0||t.exemptReason===""?e:t.exemptReason}`,"I"),Z=l(t=>t.toSorted((e,o)=>e.coverage==="clean"&&o.coverage!=="clean"?1:o.coverage==="clean"&&e.coverage!=="clean"?-1:e.score-o.score),"J"),me=l(({advisorCompanion:t=!1,localProcedures:e=!1,testId:o="advisor-health"})=>{let a=_(),n=P(),c=G({advisorCompanion:t,localProcedures:e,token:n.getAuthToken(),workerUrl:n.url}),y=R(U.getAdvisories,{},{enabled:c.kind!=="none",live:!0}),m=Y({enabled:c.kind!=="none",refreshKey:y.data,remote:c.kind==="remote"?c.remote:void 0}),[p,h]=(0,k.useState)(),i=y.data?.advisories,f=m.stale?void 0:m.data?.procedures;i!==void 0&&f!==void 0&&(p?.advisories!==i||p.procedures!==f)&&h({advisories:i,procedures:f});let s=(0,k.useMemo)(()=>p===void 0?null:q(p.procedures,p.advisories),[p]);if(c.kind==="none")return(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"py-8 text-center text-muted-foreground","data-testid":`${o}-local-only`,children:a("The health score needs `lunora dev`, or a Studio build with VITE_LUNORA_ADVISOR_COMPANION set to true.")})});if(m.notDeployed)return(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"py-8 text-center text-muted-foreground","data-testid":`${o}-companion-missing`,children:a("The health score needs the companion worker: it is not deployed for this Studio, so the advisor procedure list is unavailable.")})});if(m.data?.analysis==="disabled")return(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"py-8 text-center text-muted-foreground","data-testid":`${o}-lint-disabled`,children:a("The advisor analysis is disabled for this build: `lunora codegen` ran with `lint: false`, so there is no procedure list to score.")})});let u=m.error??y.error??null;if(u!==null)return(0,r.jsx)(D,{error:u,testId:`${o}-error`});if(s===null)return(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"py-8 text-center text-muted-foreground","data-testid":`${o}-loading`,children:a("Loading\u2026")})});let N=Z(s.procedures);return(0,r.jsxs)("div",{className:"space-y-4","data-testid":o,children:[(0,r.jsx)(x,{children:(0,r.jsxs)(v,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:T("text-4xl font-semibold tabular-nums",L[s.grade]),"data-testid":`${o}-score`,children:s.score}),(0,r.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,r.jsx)("span",{className:T("text-sm font-medium uppercase tracking-wide",L[s.grade]),"data-testid":`${o}-grade`,children:s.grade}),(0,r.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${o}-summary`,children:[(0,r.jsxs)("span",{className:j.clean,children:[s.summary.clean," ",a("clean")]}),(0,r.jsxs)("span",{className:j.warned,children:[s.summary.warned," ",a("warned")]}),(0,r.jsxs)("span",{className:j.failing,children:[s.summary.failing," ",a("failing")]}),(0,r.jsxs)("span",{className:j.exempt,children:[s.summary.exempt," ",a("exempt")]})]})]})}),s.project.checks.length>0&&(0,r.jsx)(x,{children:(0,r.jsxs)(v,{className:"py-4 text-sm","data-testid":`${o}-project`,children:[(0,r.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",s.project.score,"/100"]}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",s.project.checks.map(d=>d.name).join(", ")]})]})}),(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"p-0",children:(0,r.jsxs)(O,{children:[(0,r.jsx)(K,{children:(0,r.jsxs)(A,{children:[(0,r.jsx)(b,{className:"w-20",children:a("Score")}),(0,r.jsx)(b,{children:a("Procedure")}),(0,r.jsx)(b,{className:"w-32",children:a("Kind")}),(0,r.jsx)(b,{children:a("Rules fired")})]})}),(0,r.jsx)(M,{children:N.map(d=>(0,r.jsxs)(A,{"data-testid":`${o}-row`,children:[(0,r.jsx)(w,{className:T("tabular-nums font-medium",j[d.coverage]),children:d.coverage==="exempt"?"\u2014":d.score}),(0,r.jsx)(w,{className:"font-mono text-xs",children:d.id}),(0,r.jsxs)(w,{className:"text-muted-foreground text-xs",children:[d.visibility," ",d.kind,d.sensitivity.level==="high"&&(0,r.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,r.jsx)(w,{className:"text-muted-foreground text-xs",children:d.coverage==="exempt"?X(d,a("no reason given")):d.checks.map(g=>g.name).join(", ")})]},d.id))})]})})})]})},"me");export{me as default};
1
+ import{a as q}from"./chunk-DJNEJ3BZ.js";import{a as D}from"./chunk-2G5OZPH5.js";import"./chunk-S7NFUY75.js";import{a as O,b as K,c as M,d as A,e as b,f as w}from"./chunk-J3ZEO3PJ.js";import"./chunk-IR2MDKXQ.js";import"./chunk-PSBRO6JX.js";import"./chunk-EOFWXI3T.js";import{a as U}from"./chunk-LYVYUTQY.js";import{c as R}from"./chunk-KE7ZGUGO.js";import{a as x,e as v}from"./chunk-TN4Z3P6S.js";import{i as I,n as P}from"./chunk-UK5OOCLQ.js";import"./chunk-ZPQBVYNN.js";import{B as _,j as C,u as E,x as T}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as B}from"./chunk-A6TVTNKO.js";import{a as z,b as H}from"./chunk-ADABTCDI.js";import{a as l,d as S}from"./chunk-5PEAXTYQ.js";var k=S(z(),1);var V=S(B(),1);var r=S(H(),1);var F="/__lunora/advisor-procedures",Q=6e4,G=l(t=>{if(t.localProcedures)return{kind:"local"};if(t.advisorCompanion){let e=t.token===null||t.token===""?void 0:t.token;return{kind:"remote",remote:{baseUrl:E(t.workerUrl),token:e}}}return{kind:"none"}},"F"),$=class extends Error{static{l(this,"$")}constructor(){super("companion not deployed"),this.name="CompanionNotDeployedError"}},J=l(async t=>{let e=t===void 0?await fetch(F):await fetch(`${t.baseUrl}${F}`,{credentials:"include",headers:t.token===void 0?{}:{authorization:`Bearer ${t.token}`}});if(t!==void 0&&e.status===404)throw new $;if(e.ok&&!(e.headers.get("content-type")??"").includes("application/json"))throw new Error("The advisor procedure route is not available on this host.");if(!e.ok){let a=await e.json().catch(()=>{}),n=typeof a=="object"&&a&&"error"in a?String(a.error):`HTTP ${String(e.status)}`;throw new Error(n)}let o=await e.json();if(typeof o!="object"||o===null||!Array.isArray(o.procedures))throw new Error("The advisor procedure route answered without a procedure list.");return o},"G"),Y=l(t=>{let e=(0,V.c)(16),{enabled:o,refreshKey:a,remote:n}=t,[c,y]=(0,k.useState)(a),[m,p]=(0,k.useState)(0);c!==a&&(y(a),c!==void 0&&p(W));let h;e[0]!==n?(h=l(()=>J(n),"p"),e[0]=n,e[1]=h):h=e[1];let i;e[2]!==n||e[3]!==m?(i=["studio","advisor-procedures",n,m],e[2]=n,e[3]=m,e[4]=i):i=e[4];let f;e[5]!==o||e[6]!==h||e[7]!==i?(f={enabled:o,queryFn:h,queryKey:i,refetchInterval:Q,retry:!1,staleTime:0},e[5]=o,e[6]=h,e[7]=i,e[8]=f):f=e[8];let s=I(f),u;e[9]!==s.error?(u=s.error?C(s.error):void 0,e[9]=s.error,e[10]=u):u=e[10];let N=s.error instanceof $,d=c!==a,g;return e[11]!==s.data||e[12]!==u||e[13]!==N||e[14]!==d?(g={data:s.data,error:u,notDeployed:N,stale:d},e[11]=s.data,e[12]=u,e[13]=N,e[14]=d,e[15]=g):g=e[15],g},"Y");function W(t){return t+1}l(W,"z");var j={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},L={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},X=l((t,e)=>`exempt: ${t.exemptReason===void 0||t.exemptReason===""?e:t.exemptReason}`,"I"),Z=l(t=>t.toSorted((e,o)=>e.coverage==="clean"&&o.coverage!=="clean"?1:o.coverage==="clean"&&e.coverage!=="clean"?-1:e.score-o.score),"J"),me=l(({advisorCompanion:t=!1,localProcedures:e=!1,testId:o="advisor-health"})=>{let a=_(),n=P(),c=G({advisorCompanion:t,localProcedures:e,token:n.getAuthToken(),workerUrl:n.url}),y=R(U.getAdvisories,{},{enabled:c.kind!=="none",live:!0}),m=Y({enabled:c.kind!=="none",refreshKey:y.data,remote:c.kind==="remote"?c.remote:void 0}),[p,h]=(0,k.useState)(),i=y.data?.advisories,f=m.stale?void 0:m.data?.procedures;i!==void 0&&f!==void 0&&(p?.advisories!==i||p.procedures!==f)&&h({advisories:i,procedures:f});let s=(0,k.useMemo)(()=>p===void 0?null:q(p.procedures,p.advisories),[p]);if(c.kind==="none")return(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"py-8 text-center text-muted-foreground","data-testid":`${o}-local-only`,children:a("The health score needs `lunora dev`, or a Studio build with VITE_LUNORA_ADVISOR_COMPANION set to true.")})});if(m.notDeployed)return(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"py-8 text-center text-muted-foreground","data-testid":`${o}-companion-missing`,children:a("The health score needs the companion worker: it is not deployed for this Studio, so the advisor procedure list is unavailable.")})});if(m.data?.analysis==="disabled")return(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"py-8 text-center text-muted-foreground","data-testid":`${o}-lint-disabled`,children:a("The advisor analysis is disabled for this build: `lunora codegen` ran with `lint: false`, so there is no procedure list to score.")})});let u=m.error??y.error??null;if(u!==null)return(0,r.jsx)(D,{error:u,testId:`${o}-error`});if(s===null)return(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"py-8 text-center text-muted-foreground","data-testid":`${o}-loading`,children:a("Loading\u2026")})});let N=Z(s.procedures);return(0,r.jsxs)("div",{className:"space-y-4","data-testid":o,children:[(0,r.jsx)(x,{children:(0,r.jsxs)(v,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:T("text-4xl font-semibold tabular-nums",L[s.grade]),"data-testid":`${o}-score`,children:s.score}),(0,r.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,r.jsx)("span",{className:T("text-sm font-medium uppercase tracking-wide",L[s.grade]),"data-testid":`${o}-grade`,children:s.grade}),(0,r.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${o}-summary`,children:[(0,r.jsxs)("span",{className:j.clean,children:[s.summary.clean," ",a("clean")]}),(0,r.jsxs)("span",{className:j.warned,children:[s.summary.warned," ",a("warned")]}),(0,r.jsxs)("span",{className:j.failing,children:[s.summary.failing," ",a("failing")]}),(0,r.jsxs)("span",{className:j.exempt,children:[s.summary.exempt," ",a("exempt")]})]})]})}),s.project.checks.length>0&&(0,r.jsx)(x,{children:(0,r.jsxs)(v,{className:"py-4 text-sm","data-testid":`${o}-project`,children:[(0,r.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",s.project.score,"/100"]}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",s.project.checks.map(d=>d.name).join(", ")]})]})}),(0,r.jsx)(x,{children:(0,r.jsx)(v,{className:"p-0",children:(0,r.jsxs)(O,{children:[(0,r.jsx)(K,{children:(0,r.jsxs)(A,{children:[(0,r.jsx)(b,{className:"w-20",children:a("Score")}),(0,r.jsx)(b,{children:a("Procedure")}),(0,r.jsx)(b,{className:"w-32",children:a("Kind")}),(0,r.jsx)(b,{children:a("Rules fired")})]})}),(0,r.jsx)(M,{children:N.map(d=>(0,r.jsxs)(A,{"data-testid":`${o}-row`,children:[(0,r.jsx)(w,{className:T("tabular-nums font-medium",j[d.coverage]),children:d.coverage==="exempt"?"\u2014":d.score}),(0,r.jsx)(w,{className:"font-mono text-xs",children:d.id}),(0,r.jsxs)(w,{className:"text-muted-foreground text-xs",children:[d.visibility," ",d.kind,d.sensitivity.level==="high"&&(0,r.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,r.jsx)(w,{className:"text-muted-foreground text-xs",children:d.coverage==="exempt"?X(d,a("no reason given")):d.checks.map(g=>g.name).join(", ")})]},d.id))})]})})})]})},"me");export{me as default};
@@ -1 +1 @@
1
- import{a as je}from"./chunk-G7KYDZGL.js";import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-54X7HWI6.js";import"./chunk-T7UKRA6J.js";import{a as qe}from"./chunk-2LKJSQKF.js";import"./chunk-QF743FSL.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import{a as ze}from"./chunk-2KTN53PK.js";import{a as _e}from"./chunk-PAFHBQFL.js";import"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import"./chunk-N7FOBAV3.js";import{i as Ae}from"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as le}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as Ee}from"./chunk-S3TDGFRE.js";import{b as me}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as Le,b as Re,c as Ve,d as pe,e as B,f as L}from"./chunk-J3ZEO3PJ.js";import"./chunk-EOFWXI3T.js";import{a as U}from"./chunk-LYVYUTQY.js";import{c as Ce}from"./chunk-UN3QTZ6X.js";import{a as Ke,e as Te}from"./chunk-TN4Z3P6S.js";import{n as be}from"./chunk-5KQSRLQP.js";import"./chunk-ZPQBVYNN.js";import{B as ue,e as Se,f as $e,h as ie,i as Ne,j as ke,s as re,w as Me}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as Ge}from"./chunk-A6TVTNKO.js";import{a as Oe,b as He}from"./chunk-ADABTCDI.js";import{a as d,d as ye}from"./chunk-5PEAXTYQ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Ie="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=ie(U.resolveIssue),Xe=ie(U.ignoreIssue),Fe=ie(U.assignIssue),Ye=ie(U.setIssueSeverity),Ze=ie(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=be(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=je(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},S=await i.query(Ze,g,Ne($));o(S)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let z=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Se(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==z||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(le,{"data-testid":b,disabled:_,onClick:z,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=z,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(L,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let I;return e[41]!==c||e[42]!==E?(I=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=I):I=e[43],I},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Ie?null:ae;re(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let z=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();re(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(L,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let I=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let S;e[33]!==s.status||e[34]!==I||e[35]!==g?(S=(0,t.jsx)(L,{children:(0,t.jsx)(me,{"data-testid":I,variant:g,children:s.status})}),e[33]=s.status,e[34]=I,e[35]=g,e[36]=S):S=e[36];let V=s.severity??Ie,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,j;e[39]!==a?(j=a("\u2014"),e[39]=a,e[40]=j):j=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==j||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:j,children:N}),e[44]=j,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Ie,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==z||e[58]!==V||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(L,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:z,value:V,children:[q,D]})}),e[56]=u,e[57]=z,e[58]=V,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(L,{children:(0,t.jsx)(Ae,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Me(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(L,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(le,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(le,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(le,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==S||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,S,F,H,J,Q,ee]}),e[103]=c,e[104]=S,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=be(),{queryShardKey:i,setShardKey:l,shardKey:a}=ze(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,z]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ce(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,j)=>{z(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...j,hash:r},Ne(i))}catch(N){let C=ke(N);z(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"v"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let I;e[27]!==x?(I=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=I):I=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(le,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let S;e[32]!==g?(S=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=S):S=e[33];let V;e[34]!==S||e[35]!==c||e[36]!==I?(V=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,I,S]}),e[34]=S,e[35]=c,e[36]=I,e[37]=V):V=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,V,M&&y.length===0?(0,t.jsx)(Ee,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Ke,{className:"overflow-hidden py-0",children:(0,t.jsx)(Te,{className:"px-0",children:(0,t.jsxs)(Le,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(Ve,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
1
+ import{a as je}from"./chunk-G7KYDZGL.js";import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-54X7HWI6.js";import"./chunk-T7UKRA6J.js";import{a as qe}from"./chunk-2LKJSQKF.js";import"./chunk-QF743FSL.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import{a as ze}from"./chunk-2KTN53PK.js";import{a as _e}from"./chunk-PAFHBQFL.js";import"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import"./chunk-N7FOBAV3.js";import{i as Ae}from"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as le}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as Ee}from"./chunk-S3TDGFRE.js";import{b as me}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as Le,b as Re,c as Ve,d as pe,e as B,f as L}from"./chunk-J3ZEO3PJ.js";import"./chunk-EOFWXI3T.js";import{a as U}from"./chunk-LYVYUTQY.js";import{c as Ce}from"./chunk-KE7ZGUGO.js";import{a as Ke,e as Te}from"./chunk-TN4Z3P6S.js";import{n as be}from"./chunk-UK5OOCLQ.js";import"./chunk-ZPQBVYNN.js";import{B as ue,e as Se,f as $e,h as ie,i as Ne,j as ke,s as re,w as Me}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as Ge}from"./chunk-A6TVTNKO.js";import{a as Oe,b as He}from"./chunk-ADABTCDI.js";import{a as d,d as ye}from"./chunk-5PEAXTYQ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Ie="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=ie(U.resolveIssue),Xe=ie(U.ignoreIssue),Fe=ie(U.assignIssue),Ye=ie(U.setIssueSeverity),Ze=ie(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=be(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=je(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},S=await i.query(Ze,g,Ne($));o(S)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let z=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Se(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==z||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(le,{"data-testid":b,disabled:_,onClick:z,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=z,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(L,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let I;return e[41]!==c||e[42]!==E?(I=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=I):I=e[43],I},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Ie?null:ae;re(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let z=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();re(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(L,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let I=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let S;e[33]!==s.status||e[34]!==I||e[35]!==g?(S=(0,t.jsx)(L,{children:(0,t.jsx)(me,{"data-testid":I,variant:g,children:s.status})}),e[33]=s.status,e[34]=I,e[35]=g,e[36]=S):S=e[36];let V=s.severity??Ie,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,j;e[39]!==a?(j=a("\u2014"),e[39]=a,e[40]=j):j=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==j||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:j,children:N}),e[44]=j,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Ie,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==z||e[58]!==V||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(L,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:z,value:V,children:[q,D]})}),e[56]=u,e[57]=z,e[58]=V,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(L,{children:(0,t.jsx)(Ae,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Me(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(L,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(le,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(le,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(le,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==S||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,S,F,H,J,Q,ee]}),e[103]=c,e[104]=S,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=be(),{queryShardKey:i,setShardKey:l,shardKey:a}=ze(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,z]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ce(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,j)=>{z(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...j,hash:r},Ne(i))}catch(N){let C=ke(N);z(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"v"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let I;e[27]!==x?(I=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=I):I=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(le,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let S;e[32]!==g?(S=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=S):S=e[33];let V;e[34]!==S||e[35]!==c||e[36]!==I?(V=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,I,S]}),e[34]=S,e[35]=c,e[36]=I,e[37]=V):V=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,V,M&&y.length===0?(0,t.jsx)(Ee,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Ke,{className:"overflow-hidden py-0",children:(0,t.jsx)(Te,{className:"px-0",children:(0,t.jsxs)(Le,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(Ve,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};