@lunora/studio 1.0.0-alpha.333 → 1.0.0-alpha.334

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 (62) hide show
  1. package/dist/standalone/{chunk-2YEDTLGD.js → chunk-2OSBOZSF.js} +1 -1
  2. package/dist/standalone/{chunk-TNF67D54.js → chunk-35LRTD6L.js} +1 -1
  3. package/dist/standalone/{chunk-QA5RUU7W.js → chunk-3APWNQJ3.js} +1 -1
  4. package/dist/standalone/{chunk-UJTSGF6S.js → chunk-3DRBFZ2R.js} +1 -1
  5. package/dist/standalone/{chunk-5V4REVOK.js → chunk-3EFAEGID.js} +1 -1
  6. package/dist/standalone/{chunk-ZODHG66O.js → chunk-3LD7PBIC.js} +1 -1
  7. package/dist/standalone/{chunk-V5JA533L.js → chunk-3SSDUHUE.js} +1 -1
  8. package/dist/standalone/{chunk-KLDGZ5FU.js → chunk-3VI2EZN2.js} +1 -1
  9. package/dist/standalone/{chunk-RGUL4AQZ.js → chunk-5AXRIRHW.js} +1 -1
  10. package/dist/standalone/{chunk-IWF4IWJT.js → chunk-5OGXAO7S.js} +1 -1
  11. package/dist/standalone/{chunk-6JMKSAOS.js → chunk-5UDEPHRK.js} +1 -1
  12. package/dist/standalone/{chunk-PPXPRPMU.js → chunk-6K7ZB6M6.js} +1 -1
  13. package/dist/standalone/{chunk-3TL6EMCG.js → chunk-6RYVH5BG.js} +1 -1
  14. package/dist/standalone/{chunk-YXTJSSB4.js → chunk-6XRGQ3ND.js} +1 -1
  15. package/dist/standalone/{chunk-4RDTHNCM.js → chunk-7COKTU5I.js} +1 -1
  16. package/dist/standalone/{chunk-DCD562KJ.js → chunk-7XBIOLIW.js} +1 -1
  17. package/dist/standalone/{chunk-JPEXFCD7.js → chunk-AUUB5SEX.js} +1 -1
  18. package/dist/standalone/{chunk-CMAPNVCT.js → chunk-AWGYECJN.js} +1 -1
  19. package/dist/standalone/{chunk-MBW5C5GU.js → chunk-AX2GEOKC.js} +1 -1
  20. package/dist/standalone/{chunk-F2JMVU2F.js → chunk-BOUF5HG7.js} +1 -1
  21. package/dist/standalone/{chunk-NGPK5RSU.js → chunk-BPDWF4EX.js} +1 -1
  22. package/dist/standalone/{chunk-CWVYS5LB.js → chunk-BUH67LRI.js} +1 -1
  23. package/dist/standalone/{chunk-GBAQ5M7Y.js → chunk-CS7K5PAU.js} +1 -1
  24. package/dist/standalone/{chunk-KTJR54TW.js → chunk-EA2RNGEE.js} +1 -1
  25. package/dist/standalone/{chunk-ESQNSJEK.js → chunk-EOCVVABQ.js} +1 -1
  26. package/dist/standalone/{chunk-KPRNLQKZ.js → chunk-EQRZJZD4.js} +3 -3
  27. package/dist/standalone/{chunk-QYPMUUYF.js → chunk-FKS6EUNJ.js} +1 -1
  28. package/dist/standalone/{chunk-2VIGYW3S.js → chunk-FYW6TV4Q.js} +1 -1
  29. package/dist/standalone/{chunk-6T6JFHWU.js → chunk-GW4GGPRY.js} +1 -1
  30. package/dist/standalone/{chunk-I6VQ56RO.js → chunk-HD2IF5L4.js} +1 -1
  31. package/dist/standalone/{chunk-KU2V3NDJ.js → chunk-HFR5DYKT.js} +1 -1
  32. package/dist/standalone/{chunk-KNYZMZPY.js → chunk-IIIYLX6U.js} +1 -1
  33. package/dist/standalone/{chunk-HNMSVHPM.js → chunk-JNW2ARJO.js} +1 -1
  34. package/dist/standalone/{chunk-NQNI4E56.js → chunk-JT3XCMAO.js} +1 -1
  35. package/dist/standalone/{chunk-DVCBS7Z6.js → chunk-KT4UNIZB.js} +1 -1
  36. package/dist/standalone/{chunk-PRQKA5BT.js → chunk-KVEG7CIS.js} +1 -1
  37. package/dist/standalone/{chunk-WDWGLJNK.js → chunk-L3NY3CEL.js} +1 -1
  38. package/dist/standalone/{chunk-L5ZKGZHX.js → chunk-L5UNLRGK.js} +1 -1
  39. package/dist/standalone/{chunk-OOQHMMNK.js → chunk-LVKT5NQQ.js} +1 -1
  40. package/dist/standalone/{chunk-VKSSPTTK.js → chunk-MW6W7DGV.js} +1 -1
  41. package/dist/standalone/{chunk-YF3GD7OV.js → chunk-P7I3HBJN.js} +1 -1
  42. package/dist/standalone/{chunk-7NGFZ7OK.js → chunk-Q5KTZWZ2.js} +1 -1
  43. package/dist/standalone/{chunk-V6IC22GP.js → chunk-R36PEHB2.js} +1 -1
  44. package/dist/standalone/{chunk-I5PK6SLS.js → chunk-SBDEC37M.js} +1 -1
  45. package/dist/standalone/{chunk-6M5R5VXY.js → chunk-SHCUZSRI.js} +1 -1
  46. package/dist/standalone/{chunk-IHAUHNTM.js → chunk-SL7YMFRX.js} +1 -1
  47. package/dist/standalone/{chunk-544PMJL6.js → chunk-T4Y5DPRN.js} +1 -1
  48. package/dist/standalone/{chunk-357O3FBE.js → chunk-T6J6Q5Q2.js} +1 -1
  49. package/dist/standalone/{chunk-ZVGDUDHN.js → chunk-TKMI2XAK.js} +1 -1
  50. package/dist/standalone/{chunk-I5U5LU6L.js → chunk-VHL2HNC5.js} +1 -1
  51. package/dist/standalone/{chunk-XSVQZ5JW.js → chunk-VOLGQ2EF.js} +1 -1
  52. package/dist/standalone/{chunk-UHCFEXE5.js → chunk-VQH2F33R.js} +1 -1
  53. package/dist/standalone/{chunk-UUESQ5A2.js → chunk-XBTCFWYG.js} +1 -1
  54. package/dist/standalone/{chunk-R7SRERCX.js → chunk-XC2LTW44.js} +1 -1
  55. package/dist/standalone/{chunk-DMEGDUGQ.js → chunk-XN2YDTTH.js} +1 -1
  56. package/dist/standalone/{chunk-LSNLFUZ6.js → chunk-YHTANVUO.js} +1 -1
  57. package/dist/standalone/{chunk-QTDX7WSP.js → chunk-YSPQIRER.js} +1 -1
  58. package/dist/standalone/{chunk-2CDRWAL6.js → chunk-Z643LPA5.js} +1 -1
  59. package/dist/standalone/{chunk-KQ7RUNQV.js → chunk-ZPYEW5ZL.js} +1 -1
  60. package/dist/standalone/{chunk-3ZVTL2VM.js → chunk-ZRFRFHRU.js} +1 -1
  61. package/dist/standalone/studio.js +1 -1
  62. package/package.json +4 -4
@@ -1 +1 @@
1
- import{a as g}from"./chunk-4ZEL6BYL.js";import{c as k}from"./chunk-QTDX7WSP.js";import{l as S}from"./chunk-KPRNLQKZ.js";import{d as _,f as y,g as v,p as C}from"./chunk-74IYYDDI.js";import{a as i,d as N,e as L,f as T,g as F}from"./chunk-I26MS5PJ.js";var w=N(L(),1);var j={},A=y(g.aiGenerateSql),I=y(g.aiTableFilter),O=y(g.aiChartConfig),Q=i(s=>{let e=S(),[l,d]=(0,w.useState)({}),[n,t]=(0,w.useState)({}),a=k(g.aiAvailable,j,{shardKey:s}),[u,c]=(0,w.useState)(!1),x=u||a.data?.available===!1,p=i(o=>{d(r=>({...r,[o]:!0})),t(r=>({...r,[o]:void 0}))},"i"),h=i((o,r)=>{d(b=>({...b,[o]:!1})),r!==void 0&&t(b=>({...b,[o]:r})),r==="no-ai-binding"&&c(!0)},"a"),f=i(async o=>{p("sql");try{let{result:r}=await e.query(A,o,v(s));return h("sql",r.degraded?r.reason:void 0),r.degraded?void 0:r.sql}catch{h("sql","ai-error");return}},"f");return{generate:i(async(o,r)=>f({failedError:r?.error,failedSql:r?.sql,prompt:o}),"generate"),inferChart:i(async o=>{p("chart");try{let{result:r}=await e.query(O,o,v(s));return h("chart",r.degraded?r.reason:void 0),r.degraded?void 0:r.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:i(o=>l[o]===!0,"pending"),reason:i(o=>n[o],"reason"),rewrite:i(async(o,r)=>f({editSql:r,prompt:o}),"rewrite"),suggestFilter:i(async(o,r)=>{p("filter");try{let{result:b}=await e.query(I,{prompt:o,table:r},v(s));return h("filter",b.degraded?b.reason:void 0),b.degraded?void 0:b.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:x}},"Q");var q=N(T(),1);var m=N(F(),1);var G=i((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let l=[],d=s.toLowerCase(),n=e.toLowerCase(),t=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,t))a>t&&l.push({match:!1,offset:t,text:s.slice(t,a)}),l.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),t=a+e.length;return t<s.length&&l.push({match:!1,offset:t,text:s.slice(t)}),l},"N"),U=i(s=>{let e=(0,q.c)(9),{highlight:l,value:d}=s;if(d==null){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=c):c=e[0],c}let n,t,a;if(e[1]!==l||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let c=C(d);if(l===void 0||l===""){a=(0,m.jsx)("span",{title:c,children:c});break e}n=c,t=G(c,l).map(z)}e[1]=l,e[2]=d,e[3]=n,e[4]=t,e[5]=a}else n=e[3],t=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let u;return e[6]!==n||e[7]!==t?(u=(0,m.jsx)("span",{title:n,children:t}),e[6]=n,e[7]=t,e[8]=u):u=e[8],u},"v"),P=i(s=>{let e=(0,q.c)(22),{columns:l,rows:d}=s,n=_(),t;e[0]!==n?(t=n("Field"),e[0]=n,e[1]=t):t=e[1];let a;e[2]!==t?(a=(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let u;if(e[4]!==d||e[5]!==n){let f;e[7]!==n?(f=i((o,r)=>(0,m.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:n("Row {n}",{n:r+1})},r),"c"),e[7]=n,e[8]=f):f=e[8],u=d.map(f),e[4]=d,e[5]=n,e[6]=u}else u=e[6];let c;e[9]!==a||e[10]!==u?(c=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,u]})}),e[9]=a,e[10]=u,e[11]=c):c=e[11];let x;if(e[12]!==l||e[13]!==d){let f;e[15]!==d?(f=i(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:o}),d.map((r,b)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(U,{value:r[o]})},b))]},o),"c"),e[15]=d,e[16]=f):f=e[16],x=l.map(f),e[12]=l,e[13]=d,e[14]=x}else x=e[14];let p;e[17]!==x?(p=(0,m.jsx)("tbody",{children:x}),e[17]=x,e[18]=p):p=e[18];let h;return e[19]!==c||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[c,p]})}),e[19]=c,e[20]=p,e[21]=h):h=e[21],h},"T"),V=i(({children:s,layout:e="card",testId:l})=>(0,m.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":l,children:s}),"j");function z(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}i(z,"_");export{Q as a,U as b,P as c,V as d};
1
+ import{a as g}from"./chunk-4ZEL6BYL.js";import{c as k}from"./chunk-YSPQIRER.js";import{l as S}from"./chunk-EQRZJZD4.js";import{d as _,f as y,g as v,p as C}from"./chunk-74IYYDDI.js";import{a as i,d as N,e as L,f as T,g as F}from"./chunk-I26MS5PJ.js";var w=N(L(),1);var j={},A=y(g.aiGenerateSql),I=y(g.aiTableFilter),O=y(g.aiChartConfig),Q=i(s=>{let e=S(),[l,d]=(0,w.useState)({}),[n,t]=(0,w.useState)({}),a=k(g.aiAvailable,j,{shardKey:s}),[u,c]=(0,w.useState)(!1),x=u||a.data?.available===!1,p=i(o=>{d(r=>({...r,[o]:!0})),t(r=>({...r,[o]:void 0}))},"i"),h=i((o,r)=>{d(b=>({...b,[o]:!1})),r!==void 0&&t(b=>({...b,[o]:r})),r==="no-ai-binding"&&c(!0)},"a"),f=i(async o=>{p("sql");try{let{result:r}=await e.query(A,o,v(s));return h("sql",r.degraded?r.reason:void 0),r.degraded?void 0:r.sql}catch{h("sql","ai-error");return}},"f");return{generate:i(async(o,r)=>f({failedError:r?.error,failedSql:r?.sql,prompt:o}),"generate"),inferChart:i(async o=>{p("chart");try{let{result:r}=await e.query(O,o,v(s));return h("chart",r.degraded?r.reason:void 0),r.degraded?void 0:r.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:i(o=>l[o]===!0,"pending"),reason:i(o=>n[o],"reason"),rewrite:i(async(o,r)=>f({editSql:r,prompt:o}),"rewrite"),suggestFilter:i(async(o,r)=>{p("filter");try{let{result:b}=await e.query(I,{prompt:o,table:r},v(s));return h("filter",b.degraded?b.reason:void 0),b.degraded?void 0:b.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:x}},"Q");var q=N(T(),1);var m=N(F(),1);var G=i((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let l=[],d=s.toLowerCase(),n=e.toLowerCase(),t=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,t))a>t&&l.push({match:!1,offset:t,text:s.slice(t,a)}),l.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),t=a+e.length;return t<s.length&&l.push({match:!1,offset:t,text:s.slice(t)}),l},"N"),U=i(s=>{let e=(0,q.c)(9),{highlight:l,value:d}=s;if(d==null){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=c):c=e[0],c}let n,t,a;if(e[1]!==l||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let c=C(d);if(l===void 0||l===""){a=(0,m.jsx)("span",{title:c,children:c});break e}n=c,t=G(c,l).map(z)}e[1]=l,e[2]=d,e[3]=n,e[4]=t,e[5]=a}else n=e[3],t=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let u;return e[6]!==n||e[7]!==t?(u=(0,m.jsx)("span",{title:n,children:t}),e[6]=n,e[7]=t,e[8]=u):u=e[8],u},"v"),P=i(s=>{let e=(0,q.c)(22),{columns:l,rows:d}=s,n=_(),t;e[0]!==n?(t=n("Field"),e[0]=n,e[1]=t):t=e[1];let a;e[2]!==t?(a=(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let u;if(e[4]!==d||e[5]!==n){let f;e[7]!==n?(f=i((o,r)=>(0,m.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:n("Row {n}",{n:r+1})},r),"c"),e[7]=n,e[8]=f):f=e[8],u=d.map(f),e[4]=d,e[5]=n,e[6]=u}else u=e[6];let c;e[9]!==a||e[10]!==u?(c=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,u]})}),e[9]=a,e[10]=u,e[11]=c):c=e[11];let x;if(e[12]!==l||e[13]!==d){let f;e[15]!==d?(f=i(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:o}),d.map((r,b)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(U,{value:r[o]})},b))]},o),"c"),e[15]=d,e[16]=f):f=e[16],x=l.map(f),e[12]=l,e[13]=d,e[14]=x}else x=e[14];let p;e[17]!==x?(p=(0,m.jsx)("tbody",{children:x}),e[17]=x,e[18]=p):p=e[18];let h;return e[19]!==c||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[c,p]})}),e[19]=c,e[20]=p,e[21]=h):h=e[21],h},"T"),V=i(({children:s,layout:e="card",testId:l})=>(0,m.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":l,children:s}),"j");function z(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}i(z,"_");export{Q as a,U as b,P as c,V as d};
@@ -1 +1 @@
1
- import{a as C}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as v}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as j}from"./chunk-R7SRERCX.js";import"./chunk-NCPW7WHO.js";import"./chunk-RGUL4AQZ.js";import"./chunk-55UGUCQ6.js";import{a as g}from"./chunk-4ZEL6BYL.js";import{c as h}from"./chunk-QTDX7WSP.js";import"./chunk-KPRNLQKZ.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as $}from"./chunk-RWVIV3U7.js";import{a as I,b as _,c as q,d as p,e as o,f as i}from"./chunk-HCTJKP5J.js";import{a as S,e as K}from"./chunk-2IKDEUCX.js";import{d as T,u as F}from"./chunk-74IYYDDI.js";import{a as d,d as k,e as ne,f as oe,g as ie}from"./chunk-I26MS5PJ.js";var Q=k(oe(),1),G=k(ne(),1);var e=k(ie(),1);var H="agent_threads",de="agent_messages",L="agent_run_queue",J=100,N=250,le={},ce={filters:[],limit:J,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:H},c=d((s,t)=>{let a=s[t];return typeof a=="string"?a:void 0},"c"),B=d((s,t)=>{let a=s[t];return typeof a=="number"?a:void 0},"E"),O=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"H"),me=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"de"),ue=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"le"),he=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"ie"),ge=d(s=>{let t=(0,Q.c)(3),{fetched:a}=s,m=T(),l;return t[0]!==a||t[1]!==m?(l=a<=N?null:(0,e.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"agents-messages-truncated",children:m("Showing the latest {count} messages; older ones are not shown.",{count:N})}),t[0]=a,t[1]=m,t[2]=l):l=t[2],l},"ce"),Te=d(({initialShardKey:s=""})=>{let t=T(),[a,m]=(0,G.useState)(void 0),{data:l}=h(g.listTables,le,{live:!0,shardKey:s}),V=l!==void 0,f=Array.isArray(l)&&l.some(r=>r.name===H),W=Array.isArray(l)&&l.some(r=>r.name===L),{data:E,error:X,errorSource:Y,liveError:Z}=h(g.readTablePage,ce,{enabled:f,live:!0,shardKey:s}),ee={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:N+1,offset:0,orderBy:{column:"seq",direction:"desc"},skipCount:!0,table:de},{data:P}=h(g.readTablePage,{limit:J,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:L},{enabled:W,live:!0,shardKey:s}),{data:U,error:te,errorSource:ae}=h(g.readTablePage,ee,{enabled:f&&a!==void 0,live:!0,shardKey:s}),b=Array.isArray(E?.rows)?E.rows:[],re=Array.isArray(P?.rows)?P.rows:[],z=d(r=>re.filter(n=>c(n,"threadKey")===r).length,"C"),M=Array.isArray(U?.rows)?U.rows:[],R=M.slice(0,N).toReversed(),D=b.find(r=>c(r,"key")===a),x;return V&&!f?x=(0,e.jsx)($,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):f&&b.length===0?x=(0,e.jsx)($,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):x=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(S,{className:"overflow-hidden py-0",children:(0,e.jsx)(K,{className:"px-0",children:(0,e.jsxs)(I,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Agent")}),(0,e.jsx)(o,{children:t("Key")}),(0,e.jsx)(o,{children:t("Status")}),(0,e.jsx)(o,{children:t("Queued")}),(0,e.jsx)(o,{children:t("Messages")}),(0,e.jsx)(o,{children:t("Tokens")}),(0,e.jsx)(o,{children:t("Updated")}),(0,e.jsx)(o,{"aria-label":t("Actions")})]})}),(0,e.jsx)(q,{children:b.map(r=>{let n=c(r,"key")??"",u=c(r,"status"),y=O(r);return(0,e.jsxs)(p,{"data-active":n===a?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:c(r,"agent")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(i,{children:(0,e.jsx)(v,{"data-testid":`agents-thread-status-${n}`,variant:ue(u),children:u??"\u2014"})}),(0,e.jsx)(i,{className:"tabular-nums",children:z(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:z(n)})}),(0,e.jsx)(i,{className:"tabular-nums",children:B(r,"messageCount")??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums text-muted-foreground",children:y??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:F(B(r,"updatedAt"),"\u2014")}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsx)(C,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{m(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),te!==null&&(0,e.jsx)(j,{error:ae,testId:"agents-messages-error"}),a!==void 0&&(0,e.jsx)(S,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(K,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,D!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",O(D)??0," ",t("Tokens")]})]}),(0,e.jsx)(C,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{m(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),(0,e.jsx)(ge,{fetched:M.length}),R.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(I,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Role")}),(0,e.jsx)(o,{children:t("Content")}),(0,e.jsx)(o,{children:t("Tool")}),(0,e.jsx)(o,{children:t("Approval")})]})}),(0,e.jsx)(q,{children:R.map((r,n)=>{let u=c(r,"role")??"\u2014",y=me(r),se=c(r,"toolName"),w=c(r,"status"),A=B(r,"seq")??n;return(0,e.jsxs)(p,{"data-testid":`agents-message-${String(A)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:u}),(0,e.jsx)(i,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:c(r,"content")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:se??(y.length>0?y.join(", "):"\u2014")}),(0,e.jsx)(i,{className:"align-top",children:w===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-message-approval-${String(A)}`,variant:he(w),children:w})})]},c(r,"messageKey")??`${u}:${String(A)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[X!==null&&(0,e.jsx)(j,{error:Y,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),Z!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),x]})},"Ee");export{Te as default};
1
+ import{a as C}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as v}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as j}from"./chunk-XC2LTW44.js";import"./chunk-NCPW7WHO.js";import"./chunk-5AXRIRHW.js";import"./chunk-55UGUCQ6.js";import{a as g}from"./chunk-4ZEL6BYL.js";import{c as h}from"./chunk-YSPQIRER.js";import"./chunk-EQRZJZD4.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as $}from"./chunk-RWVIV3U7.js";import{a as I,b as _,c as q,d as p,e as o,f as i}from"./chunk-HCTJKP5J.js";import{a as S,e as K}from"./chunk-2IKDEUCX.js";import{d as T,u as F}from"./chunk-74IYYDDI.js";import{a as d,d as k,e as ne,f as oe,g as ie}from"./chunk-I26MS5PJ.js";var Q=k(oe(),1),G=k(ne(),1);var e=k(ie(),1);var H="agent_threads",de="agent_messages",L="agent_run_queue",J=100,N=250,le={},ce={filters:[],limit:J,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:H},c=d((s,t)=>{let a=s[t];return typeof a=="string"?a:void 0},"c"),B=d((s,t)=>{let a=s[t];return typeof a=="number"?a:void 0},"E"),O=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"H"),me=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"de"),ue=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"le"),he=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"ie"),ge=d(s=>{let t=(0,Q.c)(3),{fetched:a}=s,m=T(),l;return t[0]!==a||t[1]!==m?(l=a<=N?null:(0,e.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"agents-messages-truncated",children:m("Showing the latest {count} messages; older ones are not shown.",{count:N})}),t[0]=a,t[1]=m,t[2]=l):l=t[2],l},"ce"),Te=d(({initialShardKey:s=""})=>{let t=T(),[a,m]=(0,G.useState)(void 0),{data:l}=h(g.listTables,le,{live:!0,shardKey:s}),V=l!==void 0,f=Array.isArray(l)&&l.some(r=>r.name===H),W=Array.isArray(l)&&l.some(r=>r.name===L),{data:E,error:X,errorSource:Y,liveError:Z}=h(g.readTablePage,ce,{enabled:f,live:!0,shardKey:s}),ee={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:N+1,offset:0,orderBy:{column:"seq",direction:"desc"},skipCount:!0,table:de},{data:P}=h(g.readTablePage,{limit:J,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:L},{enabled:W,live:!0,shardKey:s}),{data:U,error:te,errorSource:ae}=h(g.readTablePage,ee,{enabled:f&&a!==void 0,live:!0,shardKey:s}),b=Array.isArray(E?.rows)?E.rows:[],re=Array.isArray(P?.rows)?P.rows:[],z=d(r=>re.filter(n=>c(n,"threadKey")===r).length,"C"),M=Array.isArray(U?.rows)?U.rows:[],R=M.slice(0,N).toReversed(),D=b.find(r=>c(r,"key")===a),x;return V&&!f?x=(0,e.jsx)($,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):f&&b.length===0?x=(0,e.jsx)($,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):x=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(S,{className:"overflow-hidden py-0",children:(0,e.jsx)(K,{className:"px-0",children:(0,e.jsxs)(I,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Agent")}),(0,e.jsx)(o,{children:t("Key")}),(0,e.jsx)(o,{children:t("Status")}),(0,e.jsx)(o,{children:t("Queued")}),(0,e.jsx)(o,{children:t("Messages")}),(0,e.jsx)(o,{children:t("Tokens")}),(0,e.jsx)(o,{children:t("Updated")}),(0,e.jsx)(o,{"aria-label":t("Actions")})]})}),(0,e.jsx)(q,{children:b.map(r=>{let n=c(r,"key")??"",u=c(r,"status"),y=O(r);return(0,e.jsxs)(p,{"data-active":n===a?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:c(r,"agent")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(i,{children:(0,e.jsx)(v,{"data-testid":`agents-thread-status-${n}`,variant:ue(u),children:u??"\u2014"})}),(0,e.jsx)(i,{className:"tabular-nums",children:z(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:z(n)})}),(0,e.jsx)(i,{className:"tabular-nums",children:B(r,"messageCount")??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums text-muted-foreground",children:y??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:F(B(r,"updatedAt"),"\u2014")}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsx)(C,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{m(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),te!==null&&(0,e.jsx)(j,{error:ae,testId:"agents-messages-error"}),a!==void 0&&(0,e.jsx)(S,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(K,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,D!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",O(D)??0," ",t("Tokens")]})]}),(0,e.jsx)(C,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{m(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),(0,e.jsx)(ge,{fetched:M.length}),R.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(I,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Role")}),(0,e.jsx)(o,{children:t("Content")}),(0,e.jsx)(o,{children:t("Tool")}),(0,e.jsx)(o,{children:t("Approval")})]})}),(0,e.jsx)(q,{children:R.map((r,n)=>{let u=c(r,"role")??"\u2014",y=me(r),se=c(r,"toolName"),w=c(r,"status"),A=B(r,"seq")??n;return(0,e.jsxs)(p,{"data-testid":`agents-message-${String(A)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:u}),(0,e.jsx)(i,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:c(r,"content")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:se??(y.length>0?y.join(", "):"\u2014")}),(0,e.jsx)(i,{className:"align-top",children:w===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-message-approval-${String(A)}`,variant:he(w),children:w})})]},c(r,"messageKey")??`${u}:${String(A)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[X!==null&&(0,e.jsx)(j,{error:Y,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),Z!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),x]})},"Ee");export{Te as default};
@@ -1 +1 @@
1
- import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import"./chunk-OPM7ESDV.js";import{a as Ve}from"./chunk-WVWCUB4S.js";import{a as qe}from"./chunk-EWMBX5N2.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as Le}from"./chunk-R6U22RSY.js";import{a as _e}from"./chunk-7Q256NLI.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as ke}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as ie}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as me}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as U}from"./chunk-4ZEL6BYL.js";import{c as Ee}from"./chunk-QTDX7WSP.js";import{l as Ne}from"./chunk-KPRNLQKZ.js";import"./chunk-QAQDMS6R.js";import{b as Ie,c as $e}from"./chunk-NRAAYZ4C.js";import{a as Ae}from"./chunk-RWVIV3U7.js";import{a as ze,b as Re,c as je,d as pe,e as B,f as z}from"./chunk-HCTJKP5J.js";import{a as Me,e as Ce}from"./chunk-2IKDEUCX.js";import{d as ue,f as re,g as be,h as Ke,q as le,u as Te}from"./chunk-74IYYDDI.js";import{a as d,d as ye,e as Oe,f as Ge,g as He}from"./chunk-I26MS5PJ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Se="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=re(U.resolveIssue),Xe=re(U.ignoreIssue),Fe=re(U.assignIssue),Ye=re(U.setIssueSeverity),Ze=re(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=Ne(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=Ve(),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},I=await i.query(Ze,g,be($));o(I)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let L=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Ie(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]!==L||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(ie,{"data-testid":b,disabled:_,onClick:L,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=L,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)(z,{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 S;return e[41]!==c||e[42]!==E?(S=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=S):S=e[43],S},"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===Se?null:ae;le(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let L=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();le(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)(z,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let S=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let I;e[33]!==s.status||e[34]!==S||e[35]!==g?(I=(0,t.jsx)(z,{children:(0,t.jsx)(me,{"data-testid":S,variant:g,children:s.status})}),e[33]=s.status,e[34]=S,e[35]=g,e[36]=I):I=e[36];let j=s.severity??Se,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,V;e[39]!==a?(V=a("\u2014"),e[39]=a,e[40]=V):V=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]!==V||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:V,children:N}),e[44]=V,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:Se,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==L||e[58]!==j||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(z,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:L,value:j,children:[q,D]})}),e[56]=u,e[57]=L,e[58]=j,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)(z,{children:(0,t.jsx)(ke,{"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)(z,{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=Te(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(z,{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)(ie,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{le(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)(ie,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{le(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)(ie,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{le(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)(z,{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]!==I||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,I,F,H,J,Q,ee]}),e[103]=c,e[104]=I,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(),$=Ne(),{queryShardKey:i,setShardKey:l,shardKey:a}=Le(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,L]=(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}=Ee(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,V)=>{L(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,{...V,hash:r},be(i))}catch(N){let C=Ke(N);L(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"S"),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 S;e[27]!==x?(S=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=S):S=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(ie,{"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 I;e[32]!==g?(I=(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]=I):I=e[33];let j;e[34]!==I||e[35]!==c||e[36]!==S?(j=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,S,I]}),e[34]=I,e[35]=c,e[36]=S,e[37]=j):j=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,j,M&&y.length===0?(0,t.jsx)(Ae,{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)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(ze,{"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)(je,{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 Be,b as Ue,c as We,d as De,e as we}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import"./chunk-OPM7ESDV.js";import{a as Ve}from"./chunk-WVWCUB4S.js";import{a as qe}from"./chunk-EWMBX5N2.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as Le}from"./chunk-R6U22RSY.js";import{a as _e}from"./chunk-7Q256NLI.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as ke}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as ie}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as me}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as U}from"./chunk-4ZEL6BYL.js";import{c as Ee}from"./chunk-YSPQIRER.js";import{l as Ne}from"./chunk-EQRZJZD4.js";import"./chunk-QAQDMS6R.js";import{b as Ie,c as $e}from"./chunk-NRAAYZ4C.js";import{a as Ae}from"./chunk-RWVIV3U7.js";import{a as ze,b as Re,c as je,d as pe,e as B,f as z}from"./chunk-HCTJKP5J.js";import{a as Me,e as Ce}from"./chunk-2IKDEUCX.js";import{d as ue,f as re,g as be,h as Ke,q as le,u as Te}from"./chunk-74IYYDDI.js";import{a as d,d as ye,e as Oe,f as Ge,g as He}from"./chunk-I26MS5PJ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Se="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=re(U.resolveIssue),Xe=re(U.ignoreIssue),Fe=re(U.assignIssue),Ye=re(U.setIssueSeverity),Ze=re(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=Ne(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=Ve(),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},I=await i.query(Ze,g,be($));o(I)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let L=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Ie(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]!==L||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(ie,{"data-testid":b,disabled:_,onClick:L,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=L,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)(z,{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 S;return e[41]!==c||e[42]!==E?(S=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=S):S=e[43],S},"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===Se?null:ae;le(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let L=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();le(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)(z,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let S=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let I;e[33]!==s.status||e[34]!==S||e[35]!==g?(I=(0,t.jsx)(z,{children:(0,t.jsx)(me,{"data-testid":S,variant:g,children:s.status})}),e[33]=s.status,e[34]=S,e[35]=g,e[36]=I):I=e[36];let j=s.severity??Se,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,V;e[39]!==a?(V=a("\u2014"),e[39]=a,e[40]=V):V=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]!==V||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:V,children:N}),e[44]=V,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:Se,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==L||e[58]!==j||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(z,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:L,value:j,children:[q,D]})}),e[56]=u,e[57]=L,e[58]=j,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)(z,{children:(0,t.jsx)(ke,{"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)(z,{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=Te(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(z,{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)(ie,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{le(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)(ie,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{le(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)(ie,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{le(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)(z,{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]!==I||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,I,F,H,J,Q,ee]}),e[103]=c,e[104]=I,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(),$=Ne(),{queryShardKey:i,setShardKey:l,shardKey:a}=Le(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,L]=(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}=Ee(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,V)=>{L(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,{...V,hash:r},be(i))}catch(N){let C=Ke(N);L(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"S"),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 S;e[27]!==x?(S=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=S):S=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(ie,{"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 I;e[32]!==g?(I=(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]=I):I=e[33];let j;e[34]!==I||e[35]!==c||e[36]!==S?(j=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,S,I]}),e[34]=I,e[35]=c,e[36]=S,e[37]=j):j=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,j,M&&y.length===0?(0,t.jsx)(Ae,{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)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(ze,{"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)(je,{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 +1 @@
1
- import{b as h}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as A}from"./chunk-QTDX7WSP.js";import{l as k}from"./chunk-KPRNLQKZ.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as y,e as S}from"./chunk-2IKDEUCX.js";import{d as I}from"./chunk-74IYYDDI.js";import{a as u,d as w,f as z,g as P}from"./chunk-I26MS5PJ.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{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=I(),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}=A(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 $=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($)]},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(L)})})]})}),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 L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};
1
+ import{b as h}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as A}from"./chunk-YSPQIRER.js";import{l as k}from"./chunk-EQRZJZD4.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as y,e as S}from"./chunk-2IKDEUCX.js";import{d as I}from"./chunk-74IYYDDI.js";import{a as u,d as w,f as z,g as P}from"./chunk-I26MS5PJ.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{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=I(),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}=A(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 $=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($)]},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(L)})})]})}),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 L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};
@@ -1 +1 @@
1
- import{a as Ot}from"./chunk-FPI7AMQJ.js";import{a as Et}from"./chunk-6JMKSAOS.js";import{a as me}from"./chunk-WVWCUB4S.js";import{a as Lt}from"./chunk-QJLHH3ET.js";import{a as Mt}from"./chunk-37WYCOQ2.js";import{a as _t,b as jt}from"./chunk-VQRCJJXS.js";import"./chunk-PSMQQV6S.js";import{a as be,b as Ft}from"./chunk-3ZVTL2VM.js";import{i as X}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as L}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as he}from"./chunk-QTDX7WSP.js";import{l as oe}from"./chunk-KPRNLQKZ.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as ge}from"./chunk-RWVIV3U7.js";import{a as Nt,b as At,c as Dt,d as Ve,e as de,f as ce}from"./chunk-HCTJKP5J.js";import{a as zt,e as kt}from"./chunk-2IKDEUCX.js";import{d as Q,h as Rt,p as D,q as St,u as $t}from"./chunk-74IYYDDI.js";import{a as m,d as wt,e as Yt,f as qt,g as Gt}from"./chunk-I26MS5PJ.js";var H=wt(qt(),1);var E=wt(Yt(),1);var l=wt(Gt(),1);var Kt=m(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Pt"),Wt=m(t=>{let e=Kt(t),r={};for(let[c,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${c}" must map to an array of action strings`);r[c]=h}return r},"qt"),Qt=m(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jt"),W=m(t=>{let e=(0,H.c)(6),{children:r,htmlFor:c,label:h}=t,i;e[0]!==c||e[1]!==h?(i=(0,l.jsx)(Mt,{htmlFor:c,children:h}),e[0]=c,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"W"),ue=m(({busy:t,canSubmit:e,children:r,destructive:c=!1,error:h,onClose:i,onSubmit:o,submitLabel:a,testId:n,title:d})=>{let s=Q();return(0,l.jsxs)(Lt,{label:d,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,l.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:d}),r,h!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,l.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,l.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:s("Cancel")}),(0,l.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:c?"destructive":"default",children:t?s("Saving\u2026"):a})]})]})},"de"),Pt=m(t=>{let e=(0,H.c)(79),{mode:r,onClose:c,onDone:h,org:i}=t,o=oe(),a=Q(),{busy:n,error:d,run:s}=me(),p;e[0]!==i?(p=i?D(i.name):"",e[0]=i,e[1]=p):p=e[1];let[u,b]=(0,E.useState)(p),v;e[2]!==i?(v=i?D(i.slug):"",e[2]=i,e[3]=v):v=e[3];let[g,f]=(0,E.useState)(v),z;e[4]!==i?(z=i?D(i.logo):"",e[4]=i,e[5]=z):z=e[5];let[y,C]=(0,E.useState)(z),[x,w]=(0,E.useState)(""),I;e[6]!==r||e[7]!==i?.metadata?(I=r==="edit"?Qt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=I):I=e[8];let[k,S]=(0,E.useState)(I),_;e[9]!==o||e[10]!==y||e[11]!==k||e[12]!==r||e[13]!==u||e[14]!==c||e[15]!==h||e[16]!==i?.id||e[17]!==x||e[18]!==s||e[19]!==g?(_=m(()=>{s(async()=>{let N=k.trim()===""?void 0:Kt(k);r==="create"?await o.createAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:N,name:u.trim(),ownerId:x.trim()===""?void 0:x.trim(),slug:g.trim()===""?void 0:g.trim()}):await o.updateAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:N,name:u.trim()===""?void 0:u.trim(),organizationId:D(i?.id),slug:g.trim()===""?void 0:g.trim()}),h(),c()})},"O"),e[9]=o,e[10]=y,e[11]=k,e[12]=r,e[13]=u,e[14]=c,e[15]=h,e[16]=i?.id,e[17]=x,e[18]=s,e[19]=g,e[20]=_):_=e[20];let A=_,O;e[21]!==r||e[22]!==u?(O=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=O):O=e[23];let T;e[24]!==r||e[25]!==a?(T=a(r==="create"?"Create":"Save"),e[24]=r,e[25]=a,e[26]=T):T=e[26];let R;e[27]!==r||e[28]!==a?(R=a(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=a,e[29]=R):R=e[29];let F;e[30]!==a?(F=a("name"),e[30]=a,e[31]=F):F=e[31];let Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=m(N=>{b(N.target.value)},"H"),e[32]=Z):Z=e[32];let B;e[33]!==u?(B=(0,l.jsx)(X,{"data-testid":"org-form-name",id:"org-form-name",onChange:Z,value:u}),e[33]=u,e[34]=B):B=e[34];let K;e[35]!==B||e[36]!==F?(K=(0,l.jsx)(W,{htmlFor:"org-form-name",label:F,children:B}),e[35]=B,e[36]=F,e[37]=K):K=e[37];let J;e[38]!==a?(J=a("Slug (optional \u2014 derived from name)"),e[38]=a,e[39]=J):J=e[39];let j;e[40]===Symbol.for("react.memo_cache_sentinel")?(j=m(N=>{f(N.target.value)},"F"),e[40]=j):j=e[40];let U;e[41]!==g?(U=(0,l.jsx)(X,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:j,value:g}),e[41]=g,e[42]=U):U=e[42];let P;e[43]!==J||e[44]!==U?(P=(0,l.jsx)(W,{htmlFor:"org-form-slug",label:J,children:U}),e[43]=J,e[44]=U,e[45]=P):P=e[45];let Y;e[46]!==a?(Y=a("Logo URL (optional)"),e[46]=a,e[47]=Y):Y=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=m(N=>{C(N.target.value)},"M"),e[48]=M):M=e[48];let $;e[49]!==y?($=(0,l.jsx)(X,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:y}),e[49]=y,e[50]=$):$=e[50];let q;e[51]!==Y||e[52]!==$?(q=(0,l.jsx)(W,{htmlFor:"org-form-logo",label:Y,children:$}),e[51]=Y,e[52]=$,e[53]=q):q=e[53];let V;e[54]!==r||e[55]!==x||e[56]!==a?(V=r==="create"&&(0,l.jsx)(W,{htmlFor:"org-form-owner",label:a("Owner user id (optional)"),children:(0,l.jsx)(X,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:m(N=>{w(N.target.value)},"onChange"),value:x})}),e[54]=r,e[55]=x,e[56]=a,e[57]=V):V=e[57];let te;e[58]!==a?(te=a("Metadata (JSON, optional)"),e[58]=a,e[59]=te):te=e[59];let le;e[60]===Symbol.for("react.memo_cache_sentinel")?(le=m(N=>{S(N.target.value)},"oe"),e[60]=le):le=e[60];let re;e[61]!==k?(re=(0,l.jsx)(Ot,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:le,value:k}),e[61]=k,e[62]=re):re=e[62];let ee;e[63]!==te||e[64]!==re?(ee=(0,l.jsx)(W,{htmlFor:"org-form-metadata",label:te,children:re}),e[63]=te,e[64]=re,e[65]=ee):ee=e[65];let ae;return e[66]!==n||e[67]!==d||e[68]!==c||e[69]!==A||e[70]!==K||e[71]!==P||e[72]!==q||e[73]!==V||e[74]!==ee||e[75]!==O||e[76]!==T||e[77]!==R?(ae=(0,l.jsxs)(ue,{busy:n,canSubmit:O,error:d,onClose:c,onSubmit:A,submitLabel:T,testId:"org-form",title:R,children:[K,P,q,V,ee]}),e[66]=n,e[67]=d,e[68]=c,e[69]=A,e[70]=K,e[71]=P,e[72]=q,e[73]=V,e[74]=ee,e[75]=O,e[76]=T,e[77]=R,e[78]=ae):ae=e[78],ae},"Dt"),Xt=m(t=>{let e=(0,H.c)(40),{onClose:r,onDone:c,organizationId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),[u,b]=(0,E.useState)(""),v;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==h||e[4]!==u||e[5]!==d||e[6]!==s?(v=m(()=>{d(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:s.trim()}),c(),r()})},"p"),e[0]=i,e[1]=r,e[2]=c,e[3]=h,e[4]=u,e[5]=d,e[6]=s,e[7]=v):v=e[7];let g=v,f;e[8]!==s?(f=s.trim(),e[8]=s,e[9]=f):f=e[9];let z=f!=="",y;e[10]!==o?(y=o("Add member"),e[10]=o,e[11]=y):y=e[11];let C;e[12]!==o?(C=o("Add member"),e[12]=o,e[13]=C):C=e[13];let x;e[14]!==o?(x=o("User id"),e[14]=o,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=m(R=>{p(R.target.value)},"I"),e[16]=w):w=e[16];let I;e[17]!==s?(I=(0,l.jsx)(X,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:w,value:s}),e[17]=s,e[18]=I):I=e[18];let k;e[19]!==x||e[20]!==I?(k=(0,l.jsx)(W,{htmlFor:"org-add-member-user",label:x,children:I}),e[19]=x,e[20]=I,e[21]=k):k=e[21];let S;e[22]!==o?(S=o("Role (optional)"),e[22]=o,e[23]=S):S=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{b(R.target.value)},"O"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,l.jsx)(X,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u}),e[25]=u,e[26]=A):A=e[26];let O;e[27]!==S||e[28]!==A?(O=(0,l.jsx)(W,{htmlFor:"org-add-member-role",label:S,children:A}),e[27]=S,e[28]=A,e[29]=O):O=e[29];let T;return e[30]!==a||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==z||e[36]!==y||e[37]!==C||e[38]!==k?(T=(0,l.jsxs)(ue,{busy:a,canSubmit:z,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-add-member",title:C,children:[k,O]}),e[30]=a,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=z,e[36]=y,e[37]=C,e[38]=k,e[39]=T):T=e[39],T},"Kt"),Vt=m(t=>{let e=(0,H.c)(40),{onClose:r,onDone:c,organizationId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),[u,b]=(0,E.useState)(""),v;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==c||e[4]!==h||e[5]!==u||e[6]!==d?(v=m(()=>{d(async()=>{await i.inviteAuthOrgMember({email:s.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),c(),r()})},"p"),e[0]=i,e[1]=s,e[2]=r,e[3]=c,e[4]=h,e[5]=u,e[6]=d,e[7]=v):v=e[7];let g=v,f;e[8]!==s?(f=s.trim(),e[8]=s,e[9]=f):f=e[9];let z=f!=="",y;e[10]!==o?(y=o("Send invitation"),e[10]=o,e[11]=y):y=e[11];let C;e[12]!==o?(C=o("Invite member"),e[12]=o,e[13]=C):C=e[13];let x;e[14]!==o?(x=o("email"),e[14]=o,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=m(R=>{p(R.target.value)},"I"),e[16]=w):w=e[16];let I;e[17]!==s?(I=(0,l.jsx)(X,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:w,type:"email",value:s}),e[17]=s,e[18]=I):I=e[18];let k;e[19]!==x||e[20]!==I?(k=(0,l.jsx)(W,{htmlFor:"org-invite-member-email",label:x,children:I}),e[19]=x,e[20]=I,e[21]=k):k=e[21];let S;e[22]!==o?(S=o("Role (optional)"),e[22]=o,e[23]=S):S=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{b(R.target.value)},"O"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,l.jsx)(X,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u}),e[25]=u,e[26]=A):A=e[26];let O;e[27]!==S||e[28]!==A?(O=(0,l.jsx)(W,{htmlFor:"org-invite-member-role",label:S,children:A}),e[27]=S,e[28]=A,e[29]=O):O=e[29];let T;return e[30]!==a||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==z||e[36]!==y||e[37]!==C||e[38]!==k?(T=(0,l.jsxs)(ue,{busy:a,canSubmit:z,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-invite-member",title:C,children:[k,O]}),e[30]=a,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=z,e[36]=y,e[37]=C,e[38]=k,e[39]=T):T=e[39],T},"Vt"),er=m(t=>{let e=(0,H.c)(32),{member:r,onClose:c,onDone:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),s;e[0]!==r.role?(s=m(()=>D(r.role),"a"),e[0]=r.role,e[1]=s):s=e[1];let[p,u]=(0,E.useState)(s),b;e[2]!==i||e[3]!==r.id||e[4]!==c||e[5]!==h||e[6]!==p||e[7]!==d?(b=m(()=>{d(async()=>{await i.setAuthOrgMemberRole({memberId:D(r.id),role:p.trim()}),h(),c()})},"g"),e[2]=i,e[3]=r.id,e[4]=c,e[5]=h,e[6]=p,e[7]=d,e[8]=b):b=e[8];let v=b,g;e[9]!==p?(g=p.trim(),e[9]=p,e[10]=g):g=e[10];let f=g!=="",z;e[11]!==o?(z=o("Save"),e[11]=o,e[12]=z):z=e[12];let y;e[13]!==o?(y=o("Change member role"),e[13]=o,e[14]=y):y=e[14];let C;e[15]!==o?(C=o("Role"),e[15]=o,e[16]=C):C=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=m(S=>{u(S.target.value)},"x"),e[17]=x):x=e[17];let w;e[18]!==p?(w=(0,l.jsx)(X,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:x,value:p}),e[18]=p,e[19]=w):w=e[19];let I;e[20]!==C||e[21]!==w?(I=(0,l.jsx)(W,{htmlFor:"org-member-role-value",label:C,children:w}),e[20]=C,e[21]=w,e[22]=I):I=e[22];let k;return e[23]!==a||e[24]!==n||e[25]!==c||e[26]!==v||e[27]!==I||e[28]!==f||e[29]!==z||e[30]!==y?(k=(0,l.jsx)(ue,{busy:a,canSubmit:f,error:n,onClose:c,onSubmit:v,submitLabel:z,testId:"org-member-role",title:y,children:I}),e[23]=a,e[24]=n,e[25]=c,e[26]=v,e[27]=I,e[28]=f,e[29]=z,e[30]=y,e[31]=k):k=e[31],k},"Wt"),Bt=m(t=>{let e=(0,H.c)(36),{mode:r,onClose:c,onDone:h,organizationId:i,team:o}=t,a=oe(),n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==o?(u=o?D(o.name):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,E.useState)(u),g;e[2]!==a||e[3]!==r||e[4]!==b||e[5]!==c||e[6]!==h||e[7]!==i||e[8]!==p||e[9]!==o?.id?(g=m(()=>{p(async()=>{await(r==="create"?a.createAuthOrgTeam({name:b.trim(),organizationId:i}):a.updateAuthOrgTeam({name:b.trim(),teamId:D(o?.id)})),h(),c()})},"f"),e[2]=a,e[3]=r,e[4]=b,e[5]=c,e[6]=h,e[7]=i,e[8]=p,e[9]=o?.id,e[10]=g):g=e[10];let f=g,z;e[11]!==b?(z=b.trim(),e[11]=b,e[12]=z):z=e[12];let y=z!=="",C;e[13]!==r||e[14]!==n?(C=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=C):C=e[15];let x;e[16]!==r||e[17]!==n?(x=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=x):x=e[18];let w;e[19]!==n?(w=n("name"),e[19]=n,e[20]=w):w=e[20];let I;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=m(A=>{v(A.target.value)},"C"),e[21]=I):I=e[21];let k;e[22]!==b?(k=(0,l.jsx)(X,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:I,value:b}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==w||e[25]!==k?(S=(0,l.jsx)(W,{htmlFor:"org-team-form-name",label:w,children:k}),e[24]=w,e[25]=k,e[26]=S):S=e[26];let _;return e[27]!==d||e[28]!==s||e[29]!==c||e[30]!==f||e[31]!==S||e[32]!==y||e[33]!==C||e[34]!==x?(_=(0,l.jsx)(ue,{busy:d,canSubmit:y,error:s,onClose:c,onSubmit:f,submitLabel:C,testId:"org-team-form",title:x,children:S}),e[27]=d,e[28]=s,e[29]=c,e[30]=f,e[31]=S,e[32]=y,e[33]=C,e[34]=x,e[35]=_):_=e[35],_},"zt"),tr=m(t=>{let e=(0,H.c)(30),{onClose:r,onDone:c,teamId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==d||e[4]!==h||e[5]!==s?(u=m(()=>{d(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:s.trim()}),c(),r()})},"c"),e[0]=i,e[1]=r,e[2]=c,e[3]=d,e[4]=h,e[5]=s,e[6]=u):u=e[6];let b=u,v;e[7]!==s?(v=s.trim(),e[7]=s,e[8]=v):v=e[8];let g=v!=="",f;e[9]!==o?(f=o("Add member"),e[9]=o,e[10]=f):f=e[10];let z;e[11]!==o?(z=o("Add team member"),e[11]=o,e[12]=z):z=e[12];let y;e[13]!==o?(y=o("User id"),e[13]=o,e[14]=y):y=e[14];let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=m(k=>{p(k.target.value)},"y"),e[15]=C):C=e[15];let x;e[16]!==s?(x=(0,l.jsx)(X,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:C,value:s}),e[16]=s,e[17]=x):x=e[17];let w;e[18]!==y||e[19]!==x?(w=(0,l.jsx)(W,{htmlFor:"org-team-add-member-user",label:y,children:x}),e[18]=y,e[19]=x,e[20]=w):w=e[20];let I;return e[21]!==a||e[22]!==n||e[23]!==r||e[24]!==b||e[25]!==g||e[26]!==f||e[27]!==z||e[28]!==w?(I=(0,l.jsx)(ue,{busy:a,canSubmit:g,error:n,onClose:r,onSubmit:b,submitLabel:f,testId:"org-team-add-member",title:z,children:w}),e[21]=a,e[22]=n,e[23]=r,e[24]=b,e[25]=g,e[26]=f,e[27]=z,e[28]=w,e[29]=I):I=e[29],I},"Xt"),Jt=m(t=>{let e=(0,H.c)(47),{mode:r,onClose:c,onDone:h,organizationId:i,role:o}=t,a=oe(),n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==o?(u=o?D(o.role):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,E.useState)(u),g;e[2]!==r||e[3]!==o?.permission?(g=r==="edit"?Qt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=g):g=e[4];let[f,z]=(0,E.useState)(g),y;e[5]!==a||e[6]!==r||e[7]!==b||e[8]!==c||e[9]!==h||e[10]!==i||e[11]!==f||e[12]!==o?.id||e[13]!==p?(y=m(()=>{p(async()=>{let R=Wt(f);await(r==="create"?a.createAuthOrgRole({organizationId:i,permission:R,role:b.trim()}):a.updateAuthOrgRole({permission:R,roleId:D(o?.id)})),h(),c()})},"v"),e[5]=a,e[6]=r,e[7]=b,e[8]=c,e[9]=h,e[10]=i,e[11]=f,e[12]=o?.id,e[13]=p,e[14]=y):y=e[14];let C=y,x;e[15]!==r||e[16]!==b||e[17]!==f?(x=f.trim()!==""&&(r==="edit"||b.trim()!==""),e[15]=r,e[16]=b,e[17]=f,e[18]=x):x=e[18];let w;e[19]!==r||e[20]!==n?(w=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=w):w=e[21];let I;e[22]!==r||e[23]!==n?(I=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=I):I=e[24];let k;e[25]!==r||e[26]!==b||e[27]!==n?(k=r==="create"&&(0,l.jsx)(W,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,l.jsx)(X,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:m(R=>{v(R.target.value)},"onChange"),value:b})}),e[25]=r,e[26]=b,e[27]=n,e[28]=k):k=e[28];let S;e[29]!==n?(S=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=S):S=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{z(R.target.value)},"O"),e[31]=_):_=e[31];let A;e[32]!==f?(A=(0,l.jsx)(Ot,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:f}),e[32]=f,e[33]=A):A=e[33];let O;e[34]!==A||e[35]!==S?(O=(0,l.jsx)(W,{htmlFor:"org-role-form-permission",label:S,children:A}),e[34]=A,e[35]=S,e[36]=O):O=e[36];let T;return e[37]!==d||e[38]!==s||e[39]!==c||e[40]!==C||e[41]!==O||e[42]!==x||e[43]!==w||e[44]!==I||e[45]!==k?(T=(0,l.jsxs)(ue,{busy:d,canSubmit:x,error:s,onClose:c,onSubmit:C,submitLabel:w,testId:"org-role-form",title:I,children:[k,O]}),e[37]=d,e[38]=s,e[39]=c,e[40]=C,e[41]=O,e[42]=x,e[43]=w,e[44]=I,e[45]=k,e[46]=T):T=e[46],T},"At"),Zt=m(t=>{let e=(0,H.c)(18),{action:r,message:c,onClose:h,onDone:i,testId:o,title:a}=t,n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==p?(u=m(()=>{p(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=p,e[4]=u):u=e[4];let b=u,v;e[5]!==n?(v=n("Delete"),e[5]=n,e[6]=v):v=e[6];let g;e[7]!==c?(g=(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:c}),e[7]=c,e[8]=g):g=e[8];let f;return e[9]!==d||e[10]!==s||e[11]!==h||e[12]!==b||e[13]!==v||e[14]!==g||e[15]!==o||e[16]!==a?(f=(0,l.jsx)(ue,{busy:d,canSubmit:!0,destructive:!0,error:s,onClose:h,onSubmit:b,submitLabel:v,testId:o,title:a,children:g}),e[9]=d,e[10]=s,e[11]=h,e[12]=b,e[13]=v,e[14]=g,e[15]=o,e[16]=a,e[17]=f):f=e[17],f},"Lt"),et=m(t=>{let e=(0,H.c)(13),{action:r,children:c,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,l.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let a;e[2]!==r?(a=r!==void 0&&(0,l.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=a):a=e[3];let n;e[4]!==o||e[5]!==a?(n=(0,l.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,a]}),e[4]=o,e[5]=a,e[6]=n):n=e[6];let d;e[7]!==c?(d=(0,l.jsx)(kt,{className:"px-0",children:c}),e[7]=c,e[8]=d):d=e[8];let s;return e[9]!==n||e[10]!==d||e[11]!==i?(s=(0,l.jsxs)(zt,{className:"overflow-hidden py-0","data-testid":i,children:[n,d]}),e[9]=n,e[10]=d,e[11]=i,e[12]=s):s=e[12],s},"Ye"),tt=m(t=>{let e=(0,H.c)(23),{columns:r,rowActions:c,rowPrefix:h,rows:i}=t,o=Q(),a;e[0]!==r?(a=r.map(rr),e[0]=r,e[1]=a):a=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let d;e[4]!==n?(d=(0,l.jsx)(de,{"aria-label":n}),e[4]=n,e[5]=d):d=e[5];let s;e[6]!==a||e[7]!==d?(s=(0,l.jsx)(At,{children:(0,l.jsxs)(Ve,{children:[a,d]})}),e[6]=a,e[7]=d,e[8]=s):s=e[8];let p;if(e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i){let v;e[14]!==r||e[15]!==c||e[16]!==h?(v=m((g,f)=>{let z=D(g.id),y=z===""?`index-${f.toString()}`:z;return(0,l.jsxs)(Ve,{"data-testid":`${h}-${y}`,children:[r.map(C=>(0,l.jsx)(ce,{className:C.className,children:C.render(g)},C.head)),(0,l.jsx)(ce,{children:(0,l.jsx)("div",{className:"flex justify-end gap-1",children:c(g)})})]},y)},"p"),e[14]=r,e[15]=c,e[16]=h,e[17]=v):v=e[17],p=i.map(v),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=p}else p=e[13];let u;e[18]!==p?(u=(0,l.jsx)(Dt,{children:p}),e[18]=p,e[19]=u):u=e[19];let b;return e[20]!==s||e[21]!==u?(b=(0,l.jsxs)(Nt,{children:[s,u]}),e[20]=s,e[21]=u,e[22]=b):b=e[22],b},"et");function rr(t){return(0,l.jsx)(de,{children:t.head},t.head)}m(rr,"Yt");var or=m(t=>{let e=(0,H.c)(30),{actionBusy:r,onRemoveMember:c,memberColumns:h,members:i,onDialog:o}=t,a=Q(),n;e[0]!==o?(n=m(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let d;e[2]!==a?(d=a("Add member"),e[2]=a,e[3]=d):d=e[3];let s;e[4]!==n||e[5]!==d?(s=(0,l.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:d}),e[4]=n,e[5]=d,e[6]=s):s=e[6];let p;e[7]!==o?(p=m(()=>{o({kind:"invite-member"})},"h"),e[7]=o,e[8]=p):p=e[8];let u;e[9]!==a?(u=a("Invite member"),e[9]=a,e[10]=u):u=e[10];let b;e[11]!==p||e[12]!==u?(b=(0,l.jsx)(L,{"data-testid":"org-open-invite-member",onClick:p,size:"xs",type:"button",variant:"outline",children:u}),e[11]=p,e[12]=u,e[13]=b):b=e[13];let v;e[14]!==s||e[15]!==b?(v=(0,l.jsxs)(l.Fragment,{children:[s,b]}),e[14]=s,e[15]=b,e[16]=v):v=e[16];let g;e[17]!==a?(g=a("Members"),e[17]=a,e[18]=g):g=e[18];let f;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==c||e[24]!==a?(f=i.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-members-empty",title:a("No members.")})}):(0,l.jsx)(tt,{columns:h,rowActions:m(y=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"data-testid":`org-member-role-${D(y.id)}`,onClick:m(()=>{o({kind:"member-role",member:y})},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Change role")}),(0,l.jsx)(L,{"data-testid":`org-remove-member-${D(y.id)}`,disabled:r,onClick:m(()=>{c(D(y.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=c,e[24]=a,e[25]=f):f=e[25];let z;return e[26]!==v||e[27]!==g||e[28]!==f?(z=(0,l.jsx)(et,{action:v,heading:g,testId:"org-members",children:f}),e[26]=v,e[27]=g,e[28]=f,e[29]=z):z=e[29],z},"el"),lr=m(t=>{let e=(0,H.c)(21),{onConfirmDeleteTeam:r,onDialog:c,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:a}=t,n=Q(),d;e[0]!==c?(d=m(()=>{c({kind:"team-create"})},"m"),e[0]=c,e[1]=d):d=e[1];let s;e[2]!==n?(s=n("New team"),e[2]=n,e[3]=s):s=e[3];let p;e[4]!==d||e[5]!==s?(p=(0,l.jsx)(L,{"data-testid":"org-open-create-team",onClick:d,size:"xs",type:"button",variant:"outline",children:s}),e[4]=d,e[5]=s,e[6]=p):p=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let b;e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==a?(b=a.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-teams-empty",title:n("No teams.")})}):(0,l.jsx)(tt,{columns:o,rowActions:m(g=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"aria-pressed":i===D(g.id),"data-testid":`org-team-select-${D(g.id)}`,onClick:m(()=>{h(D(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,l.jsx)(L,{"data-testid":`org-team-rename-${D(g.id)}`,onClick:m(()=>{c({kind:"team-rename",team:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,l.jsx)(L,{"data-testid":`org-team-delete-${D(g.id)}`,onClick:m(()=>{r(g)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:a}),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=a,e[16]=b):b=e[16];let v;return e[17]!==p||e[18]!==u||e[19]!==b?(v=(0,l.jsx)(et,{action:p,heading:u,testId:"org-teams",children:b}),e[17]=p,e[18]=u,e[19]=b,e[20]=v):v=e[20],v},"tl"),ar=m(t=>{let e=(0,H.c)(20),{actionBusy:r,onRemoveTeamMember:c,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:a}=t,n=Q(),d;e[0]!==h||e[1]!==i?(d=m(()=>{h({kind:"team-add-member",teamId:i})},"m"),e[0]=h,e[1]=i,e[2]=d):d=e[2];let s;e[3]!==n?(s=n("Add member"),e[3]=n,e[4]=s):s=e[4];let p;e[5]!==d||e[6]!==s?(p=(0,l.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:d,size:"xs",type:"button",variant:"outline",children:s}),e[5]=d,e[6]=s,e[7]=p):p=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let b;e[10]!==r||e[11]!==c||e[12]!==n||e[13]!==o||e[14]!==a?(b=a.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,l.jsx)(tt,{columns:o,rowActions:m(g=>(0,l.jsx)(L,{"data-testid":`org-team-remove-member-${D(g.id)}`,disabled:r,onClick:m(()=>{c(D(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:a}),e[10]=r,e[11]=c,e[12]=n,e[13]=o,e[14]=a,e[15]=b):b=e[15];let v;return e[16]!==p||e[17]!==u||e[18]!==b?(v=(0,l.jsx)(et,{action:p,heading:u,testId:"org-team-members",children:b}),e[16]=p,e[17]=u,e[18]=b,e[19]=v):v=e[19],v},"ll"),nr=m(t=>{let e=(0,H.c)(19),{onConfirmDeleteRole:r,onDialog:c,roleColumns:h,roles:i}=t,o=Q(),a;e[0]!==c?(a=m(()=>{c({kind:"role-create"})},"i"),e[0]=c,e[1]=a):a=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let d;e[4]!==a||e[5]!==n?(d=(0,l.jsx)(L,{"data-testid":"org-open-create-role",onClick:a,size:"xs",type:"button",variant:"outline",children:n}),e[4]=a,e[5]=n,e[6]=d):d=e[6];let s;e[7]!==o?(s=o("Roles"),e[7]=o,e[8]=s):s=e[8];let p;e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i||e[13]!==o?(p=i.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,l.jsx)(tt,{columns:h,rowActions:m(b=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"data-testid":`org-role-edit-${D(b.id)}`,onClick:m(()=>{c({kind:"role-edit",role:b})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,l.jsx)(L,{"data-testid":`org-role-delete-${D(b.id)}`,onClick:m(()=>{r(D(b.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=o,e[14]=p):p=e[14];let u;return e[15]!==d||e[16]!==s||e[17]!==p?(u=(0,l.jsx)(et,{action:d,heading:s,testId:"org-roles",children:p}),e[15]=d,e[16]=s,e[17]=p,e[18]=u):u=e[18],u},"ol"),Ut=200,ir=m(t=>{let e=(0,H.c)(217),{organizationId:r,rolesEnabled:c,teamsEnabled:h}=t,i=oe(),o=Q(),[a,n]=(0,E.useState)(null),[d,s]=(0,E.useState)(null),[p,u]=(0,E.useState)(!1),[b,v]=(0,E.useState)(null),[g,f]=jt(r),z;e[0]!==g||e[1]!==r?(z=["lunora-auth-org-members",r,g],e[0]=g,e[1]=r,e[2]=z):z=e[2];let y;e[3]!==i||e[4]!==g||e[5]!==r?(y=m(()=>i.listAuthOrgMembers({limit:Ut,offset:g,organizationId:r}),"v"),e[3]=i,e[4]=g,e[5]=r,e[6]=y):y=e[6];let C=he(z,y),x;e[7]!==r?(x=["lunora-auth-org-invitations",r],e[7]=r,e[8]=x):x=e[8];let w;e[9]!==i||e[10]!==r?(w=m(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"I"),e[9]=i,e[10]=r,e[11]=w):w=e[11];let I=he(x,w),k;e[12]!==r?(k=["lunora-auth-org-teams",r],e[12]=r,e[13]=k):k=e[13];let S;e[14]!==i||e[15]!==r?(S=m(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"k"),e[14]=i,e[15]=r,e[16]=S):S=e[16];let _;e[17]!==h?(_={enabled:h},e[17]=h,e[18]=_):_=e[18];let A=he(k,S,_),O;e[19]!==r?(O=["lunora-auth-org-roles",r],e[19]=r,e[20]=O):O=e[20];let T;e[21]!==i||e[22]!==r?(T=m(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"_"),e[21]=i,e[22]=r,e[23]=T):T=e[23];let R;e[24]!==c?(R={enabled:c},e[24]=c,e[25]=R):R=e[25];let F=he(O,T,R),Z;e[26]!==d?(Z=["lunora-auth-org-team-members",d],e[26]=d,e[27]=Z):Z=e[27];let B;e[28]!==i||e[29]!==d?(B=m(()=>i.listAuthOrgTeamMembers({limit:200,teamId:d??""}),"B"),e[28]=i,e[29]=d,e[30]=B):B=e[30];let K=d!==null,J;e[31]!==K?(J={enabled:K},e[31]=K,e[32]=J):J=e[32];let j=he(Z,B,J),U;e[33]!==C.data?.rows?(U=C.data?.rows??[],e[33]=C.data?.rows,e[34]=U):U=e[34];let P=U,Y;e[35]!==I.data?.rows?(Y=I.data?.rows??[],e[35]=I.data?.rows,e[36]=Y):Y=e[36];let M=Y,$;e[37]!==A.data?.rows?($=A.data?.rows??[],e[37]=A.data?.rows,e[38]=$):$=e[38];let q=$,V;e[39]!==F.data?.rows?(V=F.data?.rows??[],e[39]=F.data?.rows,e[40]=V):V=e[40];let te=V,le;e[41]!==d||e[42]!==j.data?.rows?(le=d===null?[]:j.data?.rows??[],e[41]=d,e[42]=j.data?.rows,e[43]=le):le=e[43];let re=le,ee=C.error??I.error??A.error??F.error??j.error,ae;if(e[44]!==I||e[45]!==C||e[46]!==c||e[47]!==F||e[48]!==d||e[49]!==j||e[50]!==h||e[51]!==A){let G=m(()=>{let se=[C.poll(),I.poll()];return h&&se.push(A.poll()),c&&se.push(F.poll()),d!==null&&se.push(j.poll()),Ft(se)},"V");ae=m(()=>{St(G())},"ie"),e[44]=I,e[45]=C,e[46]=c,e[47]=F,e[48]=d,e[49]=j,e[50]=h,e[51]=A,e[52]=ae}else ae=e[52];let N=ae,rt;e[53]!==C?(rt=m(()=>C.poll(),"tt"),e[53]=C,e[54]=rt):rt=e[54],be(rt,!0);let ot;e[55]!==I?(ot=m(()=>I.poll(),"lt"),e[55]=I,e[56]=ot):ot=e[56],be(ot,!0);let lt;e[57]!==A?(lt=m(()=>A.poll(),"ot"),e[57]=A,e[58]=lt):lt=e[58],be(lt,h);let at;e[59]!==F?(at=m(()=>F.poll(),"it"),e[59]=F,e[60]=at):at=e[60],be(at,c);let nt;e[61]!==j?(nt=m(()=>j.poll(),"rt"),e[61]=j,e[62]=nt):nt=e[62],be(nt,d!==null);let it;e[63]===Symbol.for("react.memo_cache_sentinel")?(it=m(()=>{n(null)},"st"),e[63]=it):it=e[63];let ne=it,st;e[64]!==N?(st=m(G=>{St((async()=>{u(!0),v(null);try{await G(),N(),u(!1)}catch(se){v(Rt(se)),u(!1)}})())},"nt"),e[64]=N,e[65]=st):st=e[65];let ie=st,mt;e[66]!==i||e[67]!==o?(mt=m(G=>{let se=D(G.id);n({action:m(async()=>{await i.removeAuthOrgTeam({teamId:se}),s(Tt=>Tt===se?null:Tt)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"at"),e[66]=i,e[67]=o,e[68]=mt):mt=e[68];let pt=mt,pe;e[69]!==o?(pe=o("userId"),e[69]=o,e[70]=pe):pe=e[70];let fe;e[71]!==pe?(fe={head:pe,render:sr},e[71]=pe,e[72]=fe):fe=e[72];let ve;e[73]!==o?(ve=o("role"),e[73]=o,e[74]=ve):ve=e[74];let ye;e[75]!==ve?(ye={head:ve,render:mr},e[75]=ve,e[76]=ye):ye=e[76];let dt;e[77]!==fe||e[78]!==ye?(dt=[fe,ye],e[77]=fe,e[78]=ye,e[79]=dt):dt=e[79];let ft=dt,Ce;e[80]!==o?(Ce=o("email"),e[80]=o,e[81]=Ce):Ce=e[81];let Ie;e[82]!==Ce?(Ie={head:Ce,render:dr},e[82]=Ce,e[83]=Ie):Ie=e[83];let xe;e[84]!==o?(xe=o("role"),e[84]=o,e[85]=xe):xe=e[85];let we;e[86]!==xe?(we={head:xe,render:cr},e[86]=xe,e[87]=we):we=e[87];let ze;e[88]!==o?(ze=o("status"),e[88]=o,e[89]=ze):ze=e[89];let ke;e[90]!==ze?(ke={head:ze,render:ur},e[90]=ze,e[91]=ke):ke=e[91];let ct;e[92]!==Ie||e[93]!==we||e[94]!==ke?(ct=[Ie,we,ke],e[92]=Ie,e[93]=we,e[94]=ke,e[95]=ct):ct=e[95];let vt=ct,Se;e[96]!==o?(Se=o("id"),e[96]=o,e[97]=Se):Se=e[97];let Ne;e[98]!==Se?(Ne={className:"font-mono text-xs",head:Se,render:gr},e[98]=Se,e[99]=Ne):Ne=e[99];let Ae;e[100]!==o?(Ae=o("name"),e[100]=o,e[101]=Ae):Ae=e[101];let De;e[102]!==Ae?(De={head:Ae,render:hr},e[102]=Ae,e[103]=De):De=e[103];let ut;e[104]!==Ne||e[105]!==De?(ut=[Ne,De],e[104]=Ne,e[105]=De,e[106]=ut):ut=e[106];let yt=ut,Oe;e[107]!==o?(Oe=o("userId"),e[107]=o,e[108]=Oe):Oe=e[108];let gt;e[109]!==Oe?(gt=[{head:Oe,render:br}],e[109]=Oe,e[110]=gt):gt=e[110];let Ct=gt,_e;e[111]!==o?(_e=o("role"),e[111]=o,e[112]=_e):_e=e[112];let Te;e[113]!==_e?(Te={head:_e,render:pr},e[113]=_e,e[114]=Te):Te=e[114];let Re;e[115]!==o?(Re=o("Permission"),e[115]=o,e[116]=Re):Re=e[116];let $e;e[117]!==Re?($e={className:"font-mono text-xs whitespace-pre-wrap",head:Re,render:fr},e[117]=Re,e[118]=$e):$e=e[118];let ht;e[119]!==Te||e[120]!==$e?(ht=[Te,$e],e[119]=Te,e[120]=$e,e[121]=ht):ht=e[121];let It=ht,Me;e[122]!==ee?(Me=ee!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[122]=ee,e[123]=Me):Me=e[123];let Fe;e[124]!==b?(Fe=b!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:b}),e[124]=b,e[125]=Fe):Fe=e[125];let je;e[126]!==i||e[127]!==ie?(je=m(G=>{ie(()=>i.removeAuthOrgMember({memberId:G}))},"Me"),e[126]=i,e[127]=ie,e[128]=je):je=e[128];let Ee;e[129]!==p||e[130]!==ft||e[131]!==P||e[132]!==je?(Ee=(0,l.jsx)(or,{actionBusy:p,memberColumns:ft,members:P,onDialog:n,onRemoveMember:je}),e[129]=p,e[130]=ft,e[131]=P,e[132]=je,e[133]=Ee):Ee=e[133];let xt=C.data?.total,Le;e[134]!==P.length||e[135]!==g||e[136]!==f||e[137]!==xt?(Le=(0,l.jsx)(_t,{count:P.length,offset:g,onOffsetChange:f,pageSize:Ut,prefix:"org-members",total:xt}),e[134]=P.length,e[135]=g,e[136]=f,e[137]=xt,e[138]=Le):Le=e[138];let Pe;e[139]!==p||e[140]!==i||e[141]!==vt||e[142]!==M||e[143]!==ie||e[144]!==o?(Pe=M.length>0&&(0,l.jsx)(et,{heading:o("Invitations"),testId:"org-invitations",children:(0,l.jsx)(tt,{columns:vt,rowActions:m(G=>(0,l.jsx)(L,{"data-testid":`org-cancel-invitation-${D(G.id)}`,disabled:p,onClick:m(()=>{ie(()=>i.cancelAuthOrgInvitation({invitationId:D(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:M})}),e[139]=p,e[140]=i,e[141]=vt,e[142]=M,e[143]=ie,e[144]=o,e[145]=Pe):Pe=e[145];let Be;e[146]!==pt||e[147]!==d||e[148]!==yt||e[149]!==q||e[150]!==h?(Be=h&&(0,l.jsx)(lr,{onConfirmDeleteTeam:pt,onDialog:n,onSelectTeam:s,selectedTeam:d,teamColumns:yt,teams:q}),e[146]=pt,e[147]=d,e[148]=yt,e[149]=q,e[150]=h,e[151]=Be):Be=e[151];let Je;e[152]!==p||e[153]!==i||e[154]!==ie||e[155]!==d||e[156]!==Ct||e[157]!==re||e[158]!==h?(Je=h&&d!==null&&(0,l.jsx)(ar,{actionBusy:p,onDialog:n,onRemoveTeamMember:m(G=>{ie(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:d,teamMemberColumns:Ct,teamMembers:re}),e[152]=p,e[153]=i,e[154]=ie,e[155]=d,e[156]=Ct,e[157]=re,e[158]=h,e[159]=Je):Je=e[159];let Ue;e[160]!==i||e[161]!==It||e[162]!==te||e[163]!==c||e[164]!==o?(Ue=c&&(0,l.jsx)(nr,{onConfirmDeleteRole:m(G=>{n({action:m(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:It,roles:te}),e[160]=i,e[161]=It,e[162]=te,e[163]=c,e[164]=o,e[165]=Ue):Ue=e[165];let He;e[166]!==a?.kind||e[167]!==r||e[168]!==N?(He=a?.kind==="add-member"&&(0,l.jsx)(Xt,{onClose:ne,onDone:N,organizationId:r}),e[166]=a?.kind,e[167]=r,e[168]=N,e[169]=He):He=e[169];let Ke;e[170]!==a?.kind||e[171]!==r||e[172]!==N?(Ke=a?.kind==="invite-member"&&(0,l.jsx)(Vt,{onClose:ne,onDone:N,organizationId:r}),e[170]=a?.kind,e[171]=r,e[172]=N,e[173]=Ke):Ke=e[173];let Qe;e[174]!==a||e[175]!==N?(Qe=a?.kind==="member-role"&&(0,l.jsx)(er,{member:a.member,onClose:ne,onDone:N}),e[174]=a,e[175]=N,e[176]=Qe):Qe=e[176];let Ze;e[177]!==a?.kind||e[178]!==r||e[179]!==N?(Ze=a?.kind==="team-create"&&(0,l.jsx)(Bt,{mode:"create",onClose:ne,onDone:N,organizationId:r}),e[177]=a?.kind,e[178]=r,e[179]=N,e[180]=Ze):Ze=e[180];let Ye;e[181]!==a||e[182]!==r||e[183]!==N?(Ye=a?.kind==="team-rename"&&(0,l.jsx)(Bt,{mode:"edit",onClose:ne,onDone:N,organizationId:r,team:a.team}),e[181]=a,e[182]=r,e[183]=N,e[184]=Ye):Ye=e[184];let qe;e[185]!==a||e[186]!==N?(qe=a?.kind==="team-add-member"&&(0,l.jsx)(tr,{onClose:ne,onDone:N,teamId:a.teamId}),e[185]=a,e[186]=N,e[187]=qe):qe=e[187];let Ge;e[188]!==a?.kind||e[189]!==r||e[190]!==N?(Ge=a?.kind==="role-create"&&(0,l.jsx)(Jt,{mode:"create",onClose:ne,onDone:N,organizationId:r}),e[188]=a?.kind,e[189]=r,e[190]=N,e[191]=Ge):Ge=e[191];let We;e[192]!==a||e[193]!==r||e[194]!==N?(We=a?.kind==="role-edit"&&(0,l.jsx)(Jt,{mode:"edit",onClose:ne,onDone:N,organizationId:r,role:a.role}),e[192]=a,e[193]=r,e[194]=N,e[195]=We):We=e[195];let Xe;e[196]!==a||e[197]!==N?(Xe=a?.kind==="confirm"&&(0,l.jsx)(Zt,{action:a.action,message:a.message,onClose:ne,onDone:N,testId:a.testId,title:a.title}),e[196]=a,e[197]=N,e[198]=Xe):Xe=e[198];let bt;return e[199]!==Me||e[200]!==Fe||e[201]!==Ee||e[202]!==Le||e[203]!==Pe||e[204]!==Be||e[205]!==Je||e[206]!==Ue||e[207]!==He||e[208]!==Ke||e[209]!==Qe||e[210]!==Ze||e[211]!==Ye||e[212]!==qe||e[213]!==Ge||e[214]!==We||e[215]!==Xe?(bt=(0,l.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Me,Fe,Ee,Le,Pe,Be,Je,Ue,He,Ke,Qe,Ze,Ye,qe,Ge,We,Xe]}),e[199]=Me,e[200]=Fe,e[201]=Ee,e[202]=Le,e[203]=Pe,e[204]=Be,e[205]=Je,e[206]=Ue,e[207]=He,e[208]=Ke,e[209]=Qe,e[210]=Ze,e[211]=Ye,e[212]=qe,e[213]=Ge,e[214]=We,e[215]=Xe,e[216]=bt):bt=e[216],bt},"il");function sr(t){return(0,l.jsx)("span",{className:"font-mono text-xs",children:D(t.userId)})}m(sr,"rl");function mr(t){return D(t.role)}m(mr,"sl");function dr(t){return D(t.email)}m(dr,"nl");function cr(t){return D(t.role)}m(cr,"al");function ur(t){return D(t.status)}m(ur,"ml");function gr(t){return D(t.id)}m(gr,"dl");function hr(t){return D(t.name)}m(hr,"cl");function br(t){return(0,l.jsx)("span",{className:"font-mono text-xs",children:D(t.userId)})}m(br,"fl");function pr(t){return D(t.role)}m(pr,"ul");function fr(t){return D(t.permission)}m(fr,"gl");var Ht=100,$r=m(()=>{let t=(0,H.c)(69),e=oe(),r=Q(),{config:c,ready:h}=Et(),i=c.capabilities.organization,[o,a]=(0,E.useState)(null),[n,d]=(0,E.useState)(null),[s,p]=(0,E.useState)(0),u;t[0]!==s?(u=["lunora-auth-orgs",s],t[0]=s,t[1]=u):u=t[1];let b;t[2]!==e||t[3]!==s?(b=m(()=>e.listAuthOrganizations({limit:Ht,offset:s}),"g"),t[2]=e,t[3]=s,t[4]=b):b=t[4];let v;t[5]!==i?(v={enabled:i},t[5]=i,t[6]=v):v=t[6];let g=he(u,b,v),f=g.data?.rows??null,z;t[7]!==g?(z=m(()=>g.poll(),"S"),t[7]=g,t[8]=z):z=t[8],be(z,i);let y;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=m(()=>{d(null)},"v"),t[9]=y):y=t[9];let C=y,x;t[10]!==g?(x=m(()=>{g.refetch()},"x"),t[10]=g,t[11]=x):x=t[11];let w=x,I;t[12]===Symbol.for("react.memo_cache_sentinel")?(I=m(M=>{a(M)},"C"),t[12]=I):I=t[12];let k=I;if(h&&!i){let M;t[13]!==r?(M=r("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=r,t[14]=M):M=t[14];let $;t[15]!==r?($=r("Organizations are not enabled."),t[15]=r,t[16]=$):$=t[16];let q;return t[17]!==M||t[18]!==$?(q=(0,l.jsx)(ge,{description:M,testId:"org-disabled",title:$}),t[17]=M,t[18]=$,t[19]=q):q=t[19],q}let S;t[20]!==r?(S=r("Organizations"),t[20]=r,t[21]=S):S=t[21];let _;t[22]!==S?(_=(0,l.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),t[22]=S,t[23]=_):_=t[23];let A;t[24]===Symbol.for("react.memo_cache_sentinel")?(A=m(()=>{d({kind:"create"})},"z"),t[24]=A):A=t[24];let O;t[25]!==r?(O=r("New organization"),t[25]=r,t[26]=O):O=t[26];let T;t[27]!==O?(T=(0,l.jsx)(L,{"data-testid":"org-new",onClick:A,size:"sm",type:"button",children:O}),t[27]=O,t[28]=T):T=t[28];let R;t[29]!==T||t[30]!==_?(R=(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[_,T]}),t[29]=T,t[30]=_,t[31]=R):R=t[31];let F;t[32]!==g.error?(F=g.error!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[32]=g.error,t[33]=F):F=t[33];let Z;t[34]!==f||t[35]!==r?(Z=f!==null&&f.length===0&&(0,l.jsx)(ge,{testId:"org-empty",title:r("No organizations.")}),t[34]=f,t[35]=r,t[36]=Z):Z=t[36];let B;t[37]!==f||t[38]!==o||t[39]!==r?(B=f!==null&&f.length>0&&(0,l.jsx)(zt,{className:"overflow-hidden py-0",children:(0,l.jsx)(kt,{className:"px-0",children:(0,l.jsxs)(Nt,{"data-testid":"org-table",children:[(0,l.jsx)(At,{children:(0,l.jsxs)(Ve,{children:[(0,l.jsx)(de,{children:r("id")}),(0,l.jsx)(de,{children:r("name")}),(0,l.jsx)(de,{children:r("slug")}),(0,l.jsx)(de,{children:r("created")}),(0,l.jsx)(de,{"aria-label":r("Actions")})]})}),(0,l.jsx)(Dt,{children:f.map(M=>{let $=D(M.id);return(0,l.jsxs)(Ve,{"data-testid":`org-row-${$}`,children:[(0,l.jsx)(ce,{className:"font-mono text-xs",children:$}),(0,l.jsx)(ce,{children:D(M.name)}),(0,l.jsx)(ce,{children:D(M.slug)}),(0,l.jsx)(ce,{className:"text-muted-foreground tabular-nums",children:$t(M.createdAt)}),(0,l.jsx)(ce,{children:(0,l.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,l.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:m(()=>{k($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,l.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:m(()=>{d({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,l.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:m(()=>{d({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[37]=f,t[38]=o,t[39]=r,t[40]=B):B=t[40];let K;t[41]!==s||t[42]!==f||t[43]!==g.data?.total?(K=f!==null&&(0,l.jsx)(_t,{count:f.length,offset:s,onOffsetChange:p,pageSize:Ht,prefix:"org",total:g.data?.total}),t[41]=s,t[42]=f,t[43]=g.data?.total,t[44]=K):K=t[44];let J;t[45]!==c.organization||t[46]!==o?(J=o!==null&&(0,l.jsx)(ir,{organizationId:o,rolesEnabled:c.organization.roles,teamsEnabled:c.organization.teams}),t[45]=c.organization,t[46]=o,t[47]=J):J=t[47];let j;t[48]!==n?.kind||t[49]!==w?(j=n?.kind==="create"&&(0,l.jsx)(Pt,{mode:"create",onClose:C,onDone:w}),t[48]=n?.kind,t[49]=w,t[50]=j):j=t[50];let U;t[51]!==n||t[52]!==w?(U=n?.kind==="edit"&&(0,l.jsx)(Pt,{mode:"edit",onClose:C,onDone:w,org:n.org}),t[51]=n,t[52]=w,t[53]=U):U=t[53];let P;t[54]!==e||t[55]!==n||t[56]!==w||t[57]!==r?(P=n?.kind==="delete"&&(0,l.jsx)(Zt,{action:m(async()=>{let M=D(n.org.id);await e.deleteAuthOrganization({organizationId:M}),a($=>$===M?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:C,onDone:w,testId:"org-delete",title:r("Delete organization")}),t[54]=e,t[55]=n,t[56]=w,t[57]=r,t[58]=P):P=t[58];let Y;return t[59]!==R||t[60]!==F||t[61]!==Z||t[62]!==B||t[63]!==K||t[64]!==J||t[65]!==j||t[66]!==U||t[67]!==P?(Y=(0,l.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[R,F,Z,B,K,J,j,U,P]}),t[59]=R,t[60]=F,t[61]=Z,t[62]=B,t[63]=K,t[64]=J,t[65]=j,t[66]=U,t[67]=P,t[68]=Y):Y=t[68],Y},"Ml");export{$r as default};
1
+ import{a as Ot}from"./chunk-FPI7AMQJ.js";import{a as Et}from"./chunk-5UDEPHRK.js";import{a as me}from"./chunk-WVWCUB4S.js";import{a as Lt}from"./chunk-QJLHH3ET.js";import{a as Mt}from"./chunk-37WYCOQ2.js";import{a as _t,b as jt}from"./chunk-VQRCJJXS.js";import"./chunk-PSMQQV6S.js";import{a as be,b as Ft}from"./chunk-ZRFRFHRU.js";import{i as X}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as L}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as he}from"./chunk-YSPQIRER.js";import{l as oe}from"./chunk-EQRZJZD4.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as ge}from"./chunk-RWVIV3U7.js";import{a as Nt,b as At,c as Dt,d as Ve,e as de,f as ce}from"./chunk-HCTJKP5J.js";import{a as zt,e as kt}from"./chunk-2IKDEUCX.js";import{d as Q,h as Rt,p as D,q as St,u as $t}from"./chunk-74IYYDDI.js";import{a as m,d as wt,e as Yt,f as qt,g as Gt}from"./chunk-I26MS5PJ.js";var H=wt(qt(),1);var E=wt(Yt(),1);var l=wt(Gt(),1);var Kt=m(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Pt"),Wt=m(t=>{let e=Kt(t),r={};for(let[c,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${c}" must map to an array of action strings`);r[c]=h}return r},"qt"),Qt=m(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jt"),W=m(t=>{let e=(0,H.c)(6),{children:r,htmlFor:c,label:h}=t,i;e[0]!==c||e[1]!==h?(i=(0,l.jsx)(Mt,{htmlFor:c,children:h}),e[0]=c,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"W"),ue=m(({busy:t,canSubmit:e,children:r,destructive:c=!1,error:h,onClose:i,onSubmit:o,submitLabel:a,testId:n,title:d})=>{let s=Q();return(0,l.jsxs)(Lt,{label:d,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,l.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:d}),r,h!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,l.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,l.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:s("Cancel")}),(0,l.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:c?"destructive":"default",children:t?s("Saving\u2026"):a})]})]})},"de"),Pt=m(t=>{let e=(0,H.c)(79),{mode:r,onClose:c,onDone:h,org:i}=t,o=oe(),a=Q(),{busy:n,error:d,run:s}=me(),p;e[0]!==i?(p=i?D(i.name):"",e[0]=i,e[1]=p):p=e[1];let[u,b]=(0,E.useState)(p),v;e[2]!==i?(v=i?D(i.slug):"",e[2]=i,e[3]=v):v=e[3];let[g,f]=(0,E.useState)(v),z;e[4]!==i?(z=i?D(i.logo):"",e[4]=i,e[5]=z):z=e[5];let[y,C]=(0,E.useState)(z),[x,w]=(0,E.useState)(""),I;e[6]!==r||e[7]!==i?.metadata?(I=r==="edit"?Qt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=I):I=e[8];let[k,S]=(0,E.useState)(I),_;e[9]!==o||e[10]!==y||e[11]!==k||e[12]!==r||e[13]!==u||e[14]!==c||e[15]!==h||e[16]!==i?.id||e[17]!==x||e[18]!==s||e[19]!==g?(_=m(()=>{s(async()=>{let N=k.trim()===""?void 0:Kt(k);r==="create"?await o.createAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:N,name:u.trim(),ownerId:x.trim()===""?void 0:x.trim(),slug:g.trim()===""?void 0:g.trim()}):await o.updateAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:N,name:u.trim()===""?void 0:u.trim(),organizationId:D(i?.id),slug:g.trim()===""?void 0:g.trim()}),h(),c()})},"O"),e[9]=o,e[10]=y,e[11]=k,e[12]=r,e[13]=u,e[14]=c,e[15]=h,e[16]=i?.id,e[17]=x,e[18]=s,e[19]=g,e[20]=_):_=e[20];let A=_,O;e[21]!==r||e[22]!==u?(O=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=O):O=e[23];let T;e[24]!==r||e[25]!==a?(T=a(r==="create"?"Create":"Save"),e[24]=r,e[25]=a,e[26]=T):T=e[26];let R;e[27]!==r||e[28]!==a?(R=a(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=a,e[29]=R):R=e[29];let F;e[30]!==a?(F=a("name"),e[30]=a,e[31]=F):F=e[31];let Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=m(N=>{b(N.target.value)},"H"),e[32]=Z):Z=e[32];let B;e[33]!==u?(B=(0,l.jsx)(X,{"data-testid":"org-form-name",id:"org-form-name",onChange:Z,value:u}),e[33]=u,e[34]=B):B=e[34];let K;e[35]!==B||e[36]!==F?(K=(0,l.jsx)(W,{htmlFor:"org-form-name",label:F,children:B}),e[35]=B,e[36]=F,e[37]=K):K=e[37];let J;e[38]!==a?(J=a("Slug (optional \u2014 derived from name)"),e[38]=a,e[39]=J):J=e[39];let j;e[40]===Symbol.for("react.memo_cache_sentinel")?(j=m(N=>{f(N.target.value)},"F"),e[40]=j):j=e[40];let U;e[41]!==g?(U=(0,l.jsx)(X,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:j,value:g}),e[41]=g,e[42]=U):U=e[42];let P;e[43]!==J||e[44]!==U?(P=(0,l.jsx)(W,{htmlFor:"org-form-slug",label:J,children:U}),e[43]=J,e[44]=U,e[45]=P):P=e[45];let Y;e[46]!==a?(Y=a("Logo URL (optional)"),e[46]=a,e[47]=Y):Y=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=m(N=>{C(N.target.value)},"M"),e[48]=M):M=e[48];let $;e[49]!==y?($=(0,l.jsx)(X,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:y}),e[49]=y,e[50]=$):$=e[50];let q;e[51]!==Y||e[52]!==$?(q=(0,l.jsx)(W,{htmlFor:"org-form-logo",label:Y,children:$}),e[51]=Y,e[52]=$,e[53]=q):q=e[53];let V;e[54]!==r||e[55]!==x||e[56]!==a?(V=r==="create"&&(0,l.jsx)(W,{htmlFor:"org-form-owner",label:a("Owner user id (optional)"),children:(0,l.jsx)(X,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:m(N=>{w(N.target.value)},"onChange"),value:x})}),e[54]=r,e[55]=x,e[56]=a,e[57]=V):V=e[57];let te;e[58]!==a?(te=a("Metadata (JSON, optional)"),e[58]=a,e[59]=te):te=e[59];let le;e[60]===Symbol.for("react.memo_cache_sentinel")?(le=m(N=>{S(N.target.value)},"oe"),e[60]=le):le=e[60];let re;e[61]!==k?(re=(0,l.jsx)(Ot,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:le,value:k}),e[61]=k,e[62]=re):re=e[62];let ee;e[63]!==te||e[64]!==re?(ee=(0,l.jsx)(W,{htmlFor:"org-form-metadata",label:te,children:re}),e[63]=te,e[64]=re,e[65]=ee):ee=e[65];let ae;return e[66]!==n||e[67]!==d||e[68]!==c||e[69]!==A||e[70]!==K||e[71]!==P||e[72]!==q||e[73]!==V||e[74]!==ee||e[75]!==O||e[76]!==T||e[77]!==R?(ae=(0,l.jsxs)(ue,{busy:n,canSubmit:O,error:d,onClose:c,onSubmit:A,submitLabel:T,testId:"org-form",title:R,children:[K,P,q,V,ee]}),e[66]=n,e[67]=d,e[68]=c,e[69]=A,e[70]=K,e[71]=P,e[72]=q,e[73]=V,e[74]=ee,e[75]=O,e[76]=T,e[77]=R,e[78]=ae):ae=e[78],ae},"Dt"),Xt=m(t=>{let e=(0,H.c)(40),{onClose:r,onDone:c,organizationId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),[u,b]=(0,E.useState)(""),v;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==h||e[4]!==u||e[5]!==d||e[6]!==s?(v=m(()=>{d(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:s.trim()}),c(),r()})},"p"),e[0]=i,e[1]=r,e[2]=c,e[3]=h,e[4]=u,e[5]=d,e[6]=s,e[7]=v):v=e[7];let g=v,f;e[8]!==s?(f=s.trim(),e[8]=s,e[9]=f):f=e[9];let z=f!=="",y;e[10]!==o?(y=o("Add member"),e[10]=o,e[11]=y):y=e[11];let C;e[12]!==o?(C=o("Add member"),e[12]=o,e[13]=C):C=e[13];let x;e[14]!==o?(x=o("User id"),e[14]=o,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=m(R=>{p(R.target.value)},"I"),e[16]=w):w=e[16];let I;e[17]!==s?(I=(0,l.jsx)(X,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:w,value:s}),e[17]=s,e[18]=I):I=e[18];let k;e[19]!==x||e[20]!==I?(k=(0,l.jsx)(W,{htmlFor:"org-add-member-user",label:x,children:I}),e[19]=x,e[20]=I,e[21]=k):k=e[21];let S;e[22]!==o?(S=o("Role (optional)"),e[22]=o,e[23]=S):S=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{b(R.target.value)},"O"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,l.jsx)(X,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u}),e[25]=u,e[26]=A):A=e[26];let O;e[27]!==S||e[28]!==A?(O=(0,l.jsx)(W,{htmlFor:"org-add-member-role",label:S,children:A}),e[27]=S,e[28]=A,e[29]=O):O=e[29];let T;return e[30]!==a||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==z||e[36]!==y||e[37]!==C||e[38]!==k?(T=(0,l.jsxs)(ue,{busy:a,canSubmit:z,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-add-member",title:C,children:[k,O]}),e[30]=a,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=z,e[36]=y,e[37]=C,e[38]=k,e[39]=T):T=e[39],T},"Kt"),Vt=m(t=>{let e=(0,H.c)(40),{onClose:r,onDone:c,organizationId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),[u,b]=(0,E.useState)(""),v;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==c||e[4]!==h||e[5]!==u||e[6]!==d?(v=m(()=>{d(async()=>{await i.inviteAuthOrgMember({email:s.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),c(),r()})},"p"),e[0]=i,e[1]=s,e[2]=r,e[3]=c,e[4]=h,e[5]=u,e[6]=d,e[7]=v):v=e[7];let g=v,f;e[8]!==s?(f=s.trim(),e[8]=s,e[9]=f):f=e[9];let z=f!=="",y;e[10]!==o?(y=o("Send invitation"),e[10]=o,e[11]=y):y=e[11];let C;e[12]!==o?(C=o("Invite member"),e[12]=o,e[13]=C):C=e[13];let x;e[14]!==o?(x=o("email"),e[14]=o,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=m(R=>{p(R.target.value)},"I"),e[16]=w):w=e[16];let I;e[17]!==s?(I=(0,l.jsx)(X,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:w,type:"email",value:s}),e[17]=s,e[18]=I):I=e[18];let k;e[19]!==x||e[20]!==I?(k=(0,l.jsx)(W,{htmlFor:"org-invite-member-email",label:x,children:I}),e[19]=x,e[20]=I,e[21]=k):k=e[21];let S;e[22]!==o?(S=o("Role (optional)"),e[22]=o,e[23]=S):S=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{b(R.target.value)},"O"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,l.jsx)(X,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u}),e[25]=u,e[26]=A):A=e[26];let O;e[27]!==S||e[28]!==A?(O=(0,l.jsx)(W,{htmlFor:"org-invite-member-role",label:S,children:A}),e[27]=S,e[28]=A,e[29]=O):O=e[29];let T;return e[30]!==a||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==z||e[36]!==y||e[37]!==C||e[38]!==k?(T=(0,l.jsxs)(ue,{busy:a,canSubmit:z,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-invite-member",title:C,children:[k,O]}),e[30]=a,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=z,e[36]=y,e[37]=C,e[38]=k,e[39]=T):T=e[39],T},"Vt"),er=m(t=>{let e=(0,H.c)(32),{member:r,onClose:c,onDone:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),s;e[0]!==r.role?(s=m(()=>D(r.role),"a"),e[0]=r.role,e[1]=s):s=e[1];let[p,u]=(0,E.useState)(s),b;e[2]!==i||e[3]!==r.id||e[4]!==c||e[5]!==h||e[6]!==p||e[7]!==d?(b=m(()=>{d(async()=>{await i.setAuthOrgMemberRole({memberId:D(r.id),role:p.trim()}),h(),c()})},"g"),e[2]=i,e[3]=r.id,e[4]=c,e[5]=h,e[6]=p,e[7]=d,e[8]=b):b=e[8];let v=b,g;e[9]!==p?(g=p.trim(),e[9]=p,e[10]=g):g=e[10];let f=g!=="",z;e[11]!==o?(z=o("Save"),e[11]=o,e[12]=z):z=e[12];let y;e[13]!==o?(y=o("Change member role"),e[13]=o,e[14]=y):y=e[14];let C;e[15]!==o?(C=o("Role"),e[15]=o,e[16]=C):C=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=m(S=>{u(S.target.value)},"x"),e[17]=x):x=e[17];let w;e[18]!==p?(w=(0,l.jsx)(X,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:x,value:p}),e[18]=p,e[19]=w):w=e[19];let I;e[20]!==C||e[21]!==w?(I=(0,l.jsx)(W,{htmlFor:"org-member-role-value",label:C,children:w}),e[20]=C,e[21]=w,e[22]=I):I=e[22];let k;return e[23]!==a||e[24]!==n||e[25]!==c||e[26]!==v||e[27]!==I||e[28]!==f||e[29]!==z||e[30]!==y?(k=(0,l.jsx)(ue,{busy:a,canSubmit:f,error:n,onClose:c,onSubmit:v,submitLabel:z,testId:"org-member-role",title:y,children:I}),e[23]=a,e[24]=n,e[25]=c,e[26]=v,e[27]=I,e[28]=f,e[29]=z,e[30]=y,e[31]=k):k=e[31],k},"Wt"),Bt=m(t=>{let e=(0,H.c)(36),{mode:r,onClose:c,onDone:h,organizationId:i,team:o}=t,a=oe(),n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==o?(u=o?D(o.name):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,E.useState)(u),g;e[2]!==a||e[3]!==r||e[4]!==b||e[5]!==c||e[6]!==h||e[7]!==i||e[8]!==p||e[9]!==o?.id?(g=m(()=>{p(async()=>{await(r==="create"?a.createAuthOrgTeam({name:b.trim(),organizationId:i}):a.updateAuthOrgTeam({name:b.trim(),teamId:D(o?.id)})),h(),c()})},"f"),e[2]=a,e[3]=r,e[4]=b,e[5]=c,e[6]=h,e[7]=i,e[8]=p,e[9]=o?.id,e[10]=g):g=e[10];let f=g,z;e[11]!==b?(z=b.trim(),e[11]=b,e[12]=z):z=e[12];let y=z!=="",C;e[13]!==r||e[14]!==n?(C=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=C):C=e[15];let x;e[16]!==r||e[17]!==n?(x=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=x):x=e[18];let w;e[19]!==n?(w=n("name"),e[19]=n,e[20]=w):w=e[20];let I;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=m(A=>{v(A.target.value)},"C"),e[21]=I):I=e[21];let k;e[22]!==b?(k=(0,l.jsx)(X,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:I,value:b}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==w||e[25]!==k?(S=(0,l.jsx)(W,{htmlFor:"org-team-form-name",label:w,children:k}),e[24]=w,e[25]=k,e[26]=S):S=e[26];let _;return e[27]!==d||e[28]!==s||e[29]!==c||e[30]!==f||e[31]!==S||e[32]!==y||e[33]!==C||e[34]!==x?(_=(0,l.jsx)(ue,{busy:d,canSubmit:y,error:s,onClose:c,onSubmit:f,submitLabel:C,testId:"org-team-form",title:x,children:S}),e[27]=d,e[28]=s,e[29]=c,e[30]=f,e[31]=S,e[32]=y,e[33]=C,e[34]=x,e[35]=_):_=e[35],_},"zt"),tr=m(t=>{let e=(0,H.c)(30),{onClose:r,onDone:c,teamId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==d||e[4]!==h||e[5]!==s?(u=m(()=>{d(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:s.trim()}),c(),r()})},"c"),e[0]=i,e[1]=r,e[2]=c,e[3]=d,e[4]=h,e[5]=s,e[6]=u):u=e[6];let b=u,v;e[7]!==s?(v=s.trim(),e[7]=s,e[8]=v):v=e[8];let g=v!=="",f;e[9]!==o?(f=o("Add member"),e[9]=o,e[10]=f):f=e[10];let z;e[11]!==o?(z=o("Add team member"),e[11]=o,e[12]=z):z=e[12];let y;e[13]!==o?(y=o("User id"),e[13]=o,e[14]=y):y=e[14];let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=m(k=>{p(k.target.value)},"y"),e[15]=C):C=e[15];let x;e[16]!==s?(x=(0,l.jsx)(X,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:C,value:s}),e[16]=s,e[17]=x):x=e[17];let w;e[18]!==y||e[19]!==x?(w=(0,l.jsx)(W,{htmlFor:"org-team-add-member-user",label:y,children:x}),e[18]=y,e[19]=x,e[20]=w):w=e[20];let I;return e[21]!==a||e[22]!==n||e[23]!==r||e[24]!==b||e[25]!==g||e[26]!==f||e[27]!==z||e[28]!==w?(I=(0,l.jsx)(ue,{busy:a,canSubmit:g,error:n,onClose:r,onSubmit:b,submitLabel:f,testId:"org-team-add-member",title:z,children:w}),e[21]=a,e[22]=n,e[23]=r,e[24]=b,e[25]=g,e[26]=f,e[27]=z,e[28]=w,e[29]=I):I=e[29],I},"Xt"),Jt=m(t=>{let e=(0,H.c)(47),{mode:r,onClose:c,onDone:h,organizationId:i,role:o}=t,a=oe(),n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==o?(u=o?D(o.role):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,E.useState)(u),g;e[2]!==r||e[3]!==o?.permission?(g=r==="edit"?Qt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=g):g=e[4];let[f,z]=(0,E.useState)(g),y;e[5]!==a||e[6]!==r||e[7]!==b||e[8]!==c||e[9]!==h||e[10]!==i||e[11]!==f||e[12]!==o?.id||e[13]!==p?(y=m(()=>{p(async()=>{let R=Wt(f);await(r==="create"?a.createAuthOrgRole({organizationId:i,permission:R,role:b.trim()}):a.updateAuthOrgRole({permission:R,roleId:D(o?.id)})),h(),c()})},"v"),e[5]=a,e[6]=r,e[7]=b,e[8]=c,e[9]=h,e[10]=i,e[11]=f,e[12]=o?.id,e[13]=p,e[14]=y):y=e[14];let C=y,x;e[15]!==r||e[16]!==b||e[17]!==f?(x=f.trim()!==""&&(r==="edit"||b.trim()!==""),e[15]=r,e[16]=b,e[17]=f,e[18]=x):x=e[18];let w;e[19]!==r||e[20]!==n?(w=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=w):w=e[21];let I;e[22]!==r||e[23]!==n?(I=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=I):I=e[24];let k;e[25]!==r||e[26]!==b||e[27]!==n?(k=r==="create"&&(0,l.jsx)(W,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,l.jsx)(X,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:m(R=>{v(R.target.value)},"onChange"),value:b})}),e[25]=r,e[26]=b,e[27]=n,e[28]=k):k=e[28];let S;e[29]!==n?(S=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=S):S=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{z(R.target.value)},"O"),e[31]=_):_=e[31];let A;e[32]!==f?(A=(0,l.jsx)(Ot,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:f}),e[32]=f,e[33]=A):A=e[33];let O;e[34]!==A||e[35]!==S?(O=(0,l.jsx)(W,{htmlFor:"org-role-form-permission",label:S,children:A}),e[34]=A,e[35]=S,e[36]=O):O=e[36];let T;return e[37]!==d||e[38]!==s||e[39]!==c||e[40]!==C||e[41]!==O||e[42]!==x||e[43]!==w||e[44]!==I||e[45]!==k?(T=(0,l.jsxs)(ue,{busy:d,canSubmit:x,error:s,onClose:c,onSubmit:C,submitLabel:w,testId:"org-role-form",title:I,children:[k,O]}),e[37]=d,e[38]=s,e[39]=c,e[40]=C,e[41]=O,e[42]=x,e[43]=w,e[44]=I,e[45]=k,e[46]=T):T=e[46],T},"At"),Zt=m(t=>{let e=(0,H.c)(18),{action:r,message:c,onClose:h,onDone:i,testId:o,title:a}=t,n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==p?(u=m(()=>{p(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=p,e[4]=u):u=e[4];let b=u,v;e[5]!==n?(v=n("Delete"),e[5]=n,e[6]=v):v=e[6];let g;e[7]!==c?(g=(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:c}),e[7]=c,e[8]=g):g=e[8];let f;return e[9]!==d||e[10]!==s||e[11]!==h||e[12]!==b||e[13]!==v||e[14]!==g||e[15]!==o||e[16]!==a?(f=(0,l.jsx)(ue,{busy:d,canSubmit:!0,destructive:!0,error:s,onClose:h,onSubmit:b,submitLabel:v,testId:o,title:a,children:g}),e[9]=d,e[10]=s,e[11]=h,e[12]=b,e[13]=v,e[14]=g,e[15]=o,e[16]=a,e[17]=f):f=e[17],f},"Lt"),et=m(t=>{let e=(0,H.c)(13),{action:r,children:c,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,l.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let a;e[2]!==r?(a=r!==void 0&&(0,l.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=a):a=e[3];let n;e[4]!==o||e[5]!==a?(n=(0,l.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,a]}),e[4]=o,e[5]=a,e[6]=n):n=e[6];let d;e[7]!==c?(d=(0,l.jsx)(kt,{className:"px-0",children:c}),e[7]=c,e[8]=d):d=e[8];let s;return e[9]!==n||e[10]!==d||e[11]!==i?(s=(0,l.jsxs)(zt,{className:"overflow-hidden py-0","data-testid":i,children:[n,d]}),e[9]=n,e[10]=d,e[11]=i,e[12]=s):s=e[12],s},"Ye"),tt=m(t=>{let e=(0,H.c)(23),{columns:r,rowActions:c,rowPrefix:h,rows:i}=t,o=Q(),a;e[0]!==r?(a=r.map(rr),e[0]=r,e[1]=a):a=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let d;e[4]!==n?(d=(0,l.jsx)(de,{"aria-label":n}),e[4]=n,e[5]=d):d=e[5];let s;e[6]!==a||e[7]!==d?(s=(0,l.jsx)(At,{children:(0,l.jsxs)(Ve,{children:[a,d]})}),e[6]=a,e[7]=d,e[8]=s):s=e[8];let p;if(e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i){let v;e[14]!==r||e[15]!==c||e[16]!==h?(v=m((g,f)=>{let z=D(g.id),y=z===""?`index-${f.toString()}`:z;return(0,l.jsxs)(Ve,{"data-testid":`${h}-${y}`,children:[r.map(C=>(0,l.jsx)(ce,{className:C.className,children:C.render(g)},C.head)),(0,l.jsx)(ce,{children:(0,l.jsx)("div",{className:"flex justify-end gap-1",children:c(g)})})]},y)},"p"),e[14]=r,e[15]=c,e[16]=h,e[17]=v):v=e[17],p=i.map(v),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=p}else p=e[13];let u;e[18]!==p?(u=(0,l.jsx)(Dt,{children:p}),e[18]=p,e[19]=u):u=e[19];let b;return e[20]!==s||e[21]!==u?(b=(0,l.jsxs)(Nt,{children:[s,u]}),e[20]=s,e[21]=u,e[22]=b):b=e[22],b},"et");function rr(t){return(0,l.jsx)(de,{children:t.head},t.head)}m(rr,"Yt");var or=m(t=>{let e=(0,H.c)(30),{actionBusy:r,onRemoveMember:c,memberColumns:h,members:i,onDialog:o}=t,a=Q(),n;e[0]!==o?(n=m(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let d;e[2]!==a?(d=a("Add member"),e[2]=a,e[3]=d):d=e[3];let s;e[4]!==n||e[5]!==d?(s=(0,l.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:d}),e[4]=n,e[5]=d,e[6]=s):s=e[6];let p;e[7]!==o?(p=m(()=>{o({kind:"invite-member"})},"h"),e[7]=o,e[8]=p):p=e[8];let u;e[9]!==a?(u=a("Invite member"),e[9]=a,e[10]=u):u=e[10];let b;e[11]!==p||e[12]!==u?(b=(0,l.jsx)(L,{"data-testid":"org-open-invite-member",onClick:p,size:"xs",type:"button",variant:"outline",children:u}),e[11]=p,e[12]=u,e[13]=b):b=e[13];let v;e[14]!==s||e[15]!==b?(v=(0,l.jsxs)(l.Fragment,{children:[s,b]}),e[14]=s,e[15]=b,e[16]=v):v=e[16];let g;e[17]!==a?(g=a("Members"),e[17]=a,e[18]=g):g=e[18];let f;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==c||e[24]!==a?(f=i.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-members-empty",title:a("No members.")})}):(0,l.jsx)(tt,{columns:h,rowActions:m(y=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"data-testid":`org-member-role-${D(y.id)}`,onClick:m(()=>{o({kind:"member-role",member:y})},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Change role")}),(0,l.jsx)(L,{"data-testid":`org-remove-member-${D(y.id)}`,disabled:r,onClick:m(()=>{c(D(y.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=c,e[24]=a,e[25]=f):f=e[25];let z;return e[26]!==v||e[27]!==g||e[28]!==f?(z=(0,l.jsx)(et,{action:v,heading:g,testId:"org-members",children:f}),e[26]=v,e[27]=g,e[28]=f,e[29]=z):z=e[29],z},"el"),lr=m(t=>{let e=(0,H.c)(21),{onConfirmDeleteTeam:r,onDialog:c,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:a}=t,n=Q(),d;e[0]!==c?(d=m(()=>{c({kind:"team-create"})},"m"),e[0]=c,e[1]=d):d=e[1];let s;e[2]!==n?(s=n("New team"),e[2]=n,e[3]=s):s=e[3];let p;e[4]!==d||e[5]!==s?(p=(0,l.jsx)(L,{"data-testid":"org-open-create-team",onClick:d,size:"xs",type:"button",variant:"outline",children:s}),e[4]=d,e[5]=s,e[6]=p):p=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let b;e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==a?(b=a.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-teams-empty",title:n("No teams.")})}):(0,l.jsx)(tt,{columns:o,rowActions:m(g=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"aria-pressed":i===D(g.id),"data-testid":`org-team-select-${D(g.id)}`,onClick:m(()=>{h(D(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,l.jsx)(L,{"data-testid":`org-team-rename-${D(g.id)}`,onClick:m(()=>{c({kind:"team-rename",team:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,l.jsx)(L,{"data-testid":`org-team-delete-${D(g.id)}`,onClick:m(()=>{r(g)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:a}),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=a,e[16]=b):b=e[16];let v;return e[17]!==p||e[18]!==u||e[19]!==b?(v=(0,l.jsx)(et,{action:p,heading:u,testId:"org-teams",children:b}),e[17]=p,e[18]=u,e[19]=b,e[20]=v):v=e[20],v},"tl"),ar=m(t=>{let e=(0,H.c)(20),{actionBusy:r,onRemoveTeamMember:c,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:a}=t,n=Q(),d;e[0]!==h||e[1]!==i?(d=m(()=>{h({kind:"team-add-member",teamId:i})},"m"),e[0]=h,e[1]=i,e[2]=d):d=e[2];let s;e[3]!==n?(s=n("Add member"),e[3]=n,e[4]=s):s=e[4];let p;e[5]!==d||e[6]!==s?(p=(0,l.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:d,size:"xs",type:"button",variant:"outline",children:s}),e[5]=d,e[6]=s,e[7]=p):p=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let b;e[10]!==r||e[11]!==c||e[12]!==n||e[13]!==o||e[14]!==a?(b=a.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,l.jsx)(tt,{columns:o,rowActions:m(g=>(0,l.jsx)(L,{"data-testid":`org-team-remove-member-${D(g.id)}`,disabled:r,onClick:m(()=>{c(D(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:a}),e[10]=r,e[11]=c,e[12]=n,e[13]=o,e[14]=a,e[15]=b):b=e[15];let v;return e[16]!==p||e[17]!==u||e[18]!==b?(v=(0,l.jsx)(et,{action:p,heading:u,testId:"org-team-members",children:b}),e[16]=p,e[17]=u,e[18]=b,e[19]=v):v=e[19],v},"ll"),nr=m(t=>{let e=(0,H.c)(19),{onConfirmDeleteRole:r,onDialog:c,roleColumns:h,roles:i}=t,o=Q(),a;e[0]!==c?(a=m(()=>{c({kind:"role-create"})},"i"),e[0]=c,e[1]=a):a=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let d;e[4]!==a||e[5]!==n?(d=(0,l.jsx)(L,{"data-testid":"org-open-create-role",onClick:a,size:"xs",type:"button",variant:"outline",children:n}),e[4]=a,e[5]=n,e[6]=d):d=e[6];let s;e[7]!==o?(s=o("Roles"),e[7]=o,e[8]=s):s=e[8];let p;e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i||e[13]!==o?(p=i.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,l.jsx)(tt,{columns:h,rowActions:m(b=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"data-testid":`org-role-edit-${D(b.id)}`,onClick:m(()=>{c({kind:"role-edit",role:b})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,l.jsx)(L,{"data-testid":`org-role-delete-${D(b.id)}`,onClick:m(()=>{r(D(b.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=o,e[14]=p):p=e[14];let u;return e[15]!==d||e[16]!==s||e[17]!==p?(u=(0,l.jsx)(et,{action:d,heading:s,testId:"org-roles",children:p}),e[15]=d,e[16]=s,e[17]=p,e[18]=u):u=e[18],u},"ol"),Ut=200,ir=m(t=>{let e=(0,H.c)(217),{organizationId:r,rolesEnabled:c,teamsEnabled:h}=t,i=oe(),o=Q(),[a,n]=(0,E.useState)(null),[d,s]=(0,E.useState)(null),[p,u]=(0,E.useState)(!1),[b,v]=(0,E.useState)(null),[g,f]=jt(r),z;e[0]!==g||e[1]!==r?(z=["lunora-auth-org-members",r,g],e[0]=g,e[1]=r,e[2]=z):z=e[2];let y;e[3]!==i||e[4]!==g||e[5]!==r?(y=m(()=>i.listAuthOrgMembers({limit:Ut,offset:g,organizationId:r}),"v"),e[3]=i,e[4]=g,e[5]=r,e[6]=y):y=e[6];let C=he(z,y),x;e[7]!==r?(x=["lunora-auth-org-invitations",r],e[7]=r,e[8]=x):x=e[8];let w;e[9]!==i||e[10]!==r?(w=m(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"I"),e[9]=i,e[10]=r,e[11]=w):w=e[11];let I=he(x,w),k;e[12]!==r?(k=["lunora-auth-org-teams",r],e[12]=r,e[13]=k):k=e[13];let S;e[14]!==i||e[15]!==r?(S=m(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"k"),e[14]=i,e[15]=r,e[16]=S):S=e[16];let _;e[17]!==h?(_={enabled:h},e[17]=h,e[18]=_):_=e[18];let A=he(k,S,_),O;e[19]!==r?(O=["lunora-auth-org-roles",r],e[19]=r,e[20]=O):O=e[20];let T;e[21]!==i||e[22]!==r?(T=m(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"_"),e[21]=i,e[22]=r,e[23]=T):T=e[23];let R;e[24]!==c?(R={enabled:c},e[24]=c,e[25]=R):R=e[25];let F=he(O,T,R),Z;e[26]!==d?(Z=["lunora-auth-org-team-members",d],e[26]=d,e[27]=Z):Z=e[27];let B;e[28]!==i||e[29]!==d?(B=m(()=>i.listAuthOrgTeamMembers({limit:200,teamId:d??""}),"B"),e[28]=i,e[29]=d,e[30]=B):B=e[30];let K=d!==null,J;e[31]!==K?(J={enabled:K},e[31]=K,e[32]=J):J=e[32];let j=he(Z,B,J),U;e[33]!==C.data?.rows?(U=C.data?.rows??[],e[33]=C.data?.rows,e[34]=U):U=e[34];let P=U,Y;e[35]!==I.data?.rows?(Y=I.data?.rows??[],e[35]=I.data?.rows,e[36]=Y):Y=e[36];let M=Y,$;e[37]!==A.data?.rows?($=A.data?.rows??[],e[37]=A.data?.rows,e[38]=$):$=e[38];let q=$,V;e[39]!==F.data?.rows?(V=F.data?.rows??[],e[39]=F.data?.rows,e[40]=V):V=e[40];let te=V,le;e[41]!==d||e[42]!==j.data?.rows?(le=d===null?[]:j.data?.rows??[],e[41]=d,e[42]=j.data?.rows,e[43]=le):le=e[43];let re=le,ee=C.error??I.error??A.error??F.error??j.error,ae;if(e[44]!==I||e[45]!==C||e[46]!==c||e[47]!==F||e[48]!==d||e[49]!==j||e[50]!==h||e[51]!==A){let G=m(()=>{let se=[C.poll(),I.poll()];return h&&se.push(A.poll()),c&&se.push(F.poll()),d!==null&&se.push(j.poll()),Ft(se)},"V");ae=m(()=>{St(G())},"ie"),e[44]=I,e[45]=C,e[46]=c,e[47]=F,e[48]=d,e[49]=j,e[50]=h,e[51]=A,e[52]=ae}else ae=e[52];let N=ae,rt;e[53]!==C?(rt=m(()=>C.poll(),"tt"),e[53]=C,e[54]=rt):rt=e[54],be(rt,!0);let ot;e[55]!==I?(ot=m(()=>I.poll(),"lt"),e[55]=I,e[56]=ot):ot=e[56],be(ot,!0);let lt;e[57]!==A?(lt=m(()=>A.poll(),"ot"),e[57]=A,e[58]=lt):lt=e[58],be(lt,h);let at;e[59]!==F?(at=m(()=>F.poll(),"it"),e[59]=F,e[60]=at):at=e[60],be(at,c);let nt;e[61]!==j?(nt=m(()=>j.poll(),"rt"),e[61]=j,e[62]=nt):nt=e[62],be(nt,d!==null);let it;e[63]===Symbol.for("react.memo_cache_sentinel")?(it=m(()=>{n(null)},"st"),e[63]=it):it=e[63];let ne=it,st;e[64]!==N?(st=m(G=>{St((async()=>{u(!0),v(null);try{await G(),N(),u(!1)}catch(se){v(Rt(se)),u(!1)}})())},"nt"),e[64]=N,e[65]=st):st=e[65];let ie=st,mt;e[66]!==i||e[67]!==o?(mt=m(G=>{let se=D(G.id);n({action:m(async()=>{await i.removeAuthOrgTeam({teamId:se}),s(Tt=>Tt===se?null:Tt)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"at"),e[66]=i,e[67]=o,e[68]=mt):mt=e[68];let pt=mt,pe;e[69]!==o?(pe=o("userId"),e[69]=o,e[70]=pe):pe=e[70];let fe;e[71]!==pe?(fe={head:pe,render:sr},e[71]=pe,e[72]=fe):fe=e[72];let ve;e[73]!==o?(ve=o("role"),e[73]=o,e[74]=ve):ve=e[74];let ye;e[75]!==ve?(ye={head:ve,render:mr},e[75]=ve,e[76]=ye):ye=e[76];let dt;e[77]!==fe||e[78]!==ye?(dt=[fe,ye],e[77]=fe,e[78]=ye,e[79]=dt):dt=e[79];let ft=dt,Ce;e[80]!==o?(Ce=o("email"),e[80]=o,e[81]=Ce):Ce=e[81];let Ie;e[82]!==Ce?(Ie={head:Ce,render:dr},e[82]=Ce,e[83]=Ie):Ie=e[83];let xe;e[84]!==o?(xe=o("role"),e[84]=o,e[85]=xe):xe=e[85];let we;e[86]!==xe?(we={head:xe,render:cr},e[86]=xe,e[87]=we):we=e[87];let ze;e[88]!==o?(ze=o("status"),e[88]=o,e[89]=ze):ze=e[89];let ke;e[90]!==ze?(ke={head:ze,render:ur},e[90]=ze,e[91]=ke):ke=e[91];let ct;e[92]!==Ie||e[93]!==we||e[94]!==ke?(ct=[Ie,we,ke],e[92]=Ie,e[93]=we,e[94]=ke,e[95]=ct):ct=e[95];let vt=ct,Se;e[96]!==o?(Se=o("id"),e[96]=o,e[97]=Se):Se=e[97];let Ne;e[98]!==Se?(Ne={className:"font-mono text-xs",head:Se,render:gr},e[98]=Se,e[99]=Ne):Ne=e[99];let Ae;e[100]!==o?(Ae=o("name"),e[100]=o,e[101]=Ae):Ae=e[101];let De;e[102]!==Ae?(De={head:Ae,render:hr},e[102]=Ae,e[103]=De):De=e[103];let ut;e[104]!==Ne||e[105]!==De?(ut=[Ne,De],e[104]=Ne,e[105]=De,e[106]=ut):ut=e[106];let yt=ut,Oe;e[107]!==o?(Oe=o("userId"),e[107]=o,e[108]=Oe):Oe=e[108];let gt;e[109]!==Oe?(gt=[{head:Oe,render:br}],e[109]=Oe,e[110]=gt):gt=e[110];let Ct=gt,_e;e[111]!==o?(_e=o("role"),e[111]=o,e[112]=_e):_e=e[112];let Te;e[113]!==_e?(Te={head:_e,render:pr},e[113]=_e,e[114]=Te):Te=e[114];let Re;e[115]!==o?(Re=o("Permission"),e[115]=o,e[116]=Re):Re=e[116];let $e;e[117]!==Re?($e={className:"font-mono text-xs whitespace-pre-wrap",head:Re,render:fr},e[117]=Re,e[118]=$e):$e=e[118];let ht;e[119]!==Te||e[120]!==$e?(ht=[Te,$e],e[119]=Te,e[120]=$e,e[121]=ht):ht=e[121];let It=ht,Me;e[122]!==ee?(Me=ee!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[122]=ee,e[123]=Me):Me=e[123];let Fe;e[124]!==b?(Fe=b!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:b}),e[124]=b,e[125]=Fe):Fe=e[125];let je;e[126]!==i||e[127]!==ie?(je=m(G=>{ie(()=>i.removeAuthOrgMember({memberId:G}))},"Me"),e[126]=i,e[127]=ie,e[128]=je):je=e[128];let Ee;e[129]!==p||e[130]!==ft||e[131]!==P||e[132]!==je?(Ee=(0,l.jsx)(or,{actionBusy:p,memberColumns:ft,members:P,onDialog:n,onRemoveMember:je}),e[129]=p,e[130]=ft,e[131]=P,e[132]=je,e[133]=Ee):Ee=e[133];let xt=C.data?.total,Le;e[134]!==P.length||e[135]!==g||e[136]!==f||e[137]!==xt?(Le=(0,l.jsx)(_t,{count:P.length,offset:g,onOffsetChange:f,pageSize:Ut,prefix:"org-members",total:xt}),e[134]=P.length,e[135]=g,e[136]=f,e[137]=xt,e[138]=Le):Le=e[138];let Pe;e[139]!==p||e[140]!==i||e[141]!==vt||e[142]!==M||e[143]!==ie||e[144]!==o?(Pe=M.length>0&&(0,l.jsx)(et,{heading:o("Invitations"),testId:"org-invitations",children:(0,l.jsx)(tt,{columns:vt,rowActions:m(G=>(0,l.jsx)(L,{"data-testid":`org-cancel-invitation-${D(G.id)}`,disabled:p,onClick:m(()=>{ie(()=>i.cancelAuthOrgInvitation({invitationId:D(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:M})}),e[139]=p,e[140]=i,e[141]=vt,e[142]=M,e[143]=ie,e[144]=o,e[145]=Pe):Pe=e[145];let Be;e[146]!==pt||e[147]!==d||e[148]!==yt||e[149]!==q||e[150]!==h?(Be=h&&(0,l.jsx)(lr,{onConfirmDeleteTeam:pt,onDialog:n,onSelectTeam:s,selectedTeam:d,teamColumns:yt,teams:q}),e[146]=pt,e[147]=d,e[148]=yt,e[149]=q,e[150]=h,e[151]=Be):Be=e[151];let Je;e[152]!==p||e[153]!==i||e[154]!==ie||e[155]!==d||e[156]!==Ct||e[157]!==re||e[158]!==h?(Je=h&&d!==null&&(0,l.jsx)(ar,{actionBusy:p,onDialog:n,onRemoveTeamMember:m(G=>{ie(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:d,teamMemberColumns:Ct,teamMembers:re}),e[152]=p,e[153]=i,e[154]=ie,e[155]=d,e[156]=Ct,e[157]=re,e[158]=h,e[159]=Je):Je=e[159];let Ue;e[160]!==i||e[161]!==It||e[162]!==te||e[163]!==c||e[164]!==o?(Ue=c&&(0,l.jsx)(nr,{onConfirmDeleteRole:m(G=>{n({action:m(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:It,roles:te}),e[160]=i,e[161]=It,e[162]=te,e[163]=c,e[164]=o,e[165]=Ue):Ue=e[165];let He;e[166]!==a?.kind||e[167]!==r||e[168]!==N?(He=a?.kind==="add-member"&&(0,l.jsx)(Xt,{onClose:ne,onDone:N,organizationId:r}),e[166]=a?.kind,e[167]=r,e[168]=N,e[169]=He):He=e[169];let Ke;e[170]!==a?.kind||e[171]!==r||e[172]!==N?(Ke=a?.kind==="invite-member"&&(0,l.jsx)(Vt,{onClose:ne,onDone:N,organizationId:r}),e[170]=a?.kind,e[171]=r,e[172]=N,e[173]=Ke):Ke=e[173];let Qe;e[174]!==a||e[175]!==N?(Qe=a?.kind==="member-role"&&(0,l.jsx)(er,{member:a.member,onClose:ne,onDone:N}),e[174]=a,e[175]=N,e[176]=Qe):Qe=e[176];let Ze;e[177]!==a?.kind||e[178]!==r||e[179]!==N?(Ze=a?.kind==="team-create"&&(0,l.jsx)(Bt,{mode:"create",onClose:ne,onDone:N,organizationId:r}),e[177]=a?.kind,e[178]=r,e[179]=N,e[180]=Ze):Ze=e[180];let Ye;e[181]!==a||e[182]!==r||e[183]!==N?(Ye=a?.kind==="team-rename"&&(0,l.jsx)(Bt,{mode:"edit",onClose:ne,onDone:N,organizationId:r,team:a.team}),e[181]=a,e[182]=r,e[183]=N,e[184]=Ye):Ye=e[184];let qe;e[185]!==a||e[186]!==N?(qe=a?.kind==="team-add-member"&&(0,l.jsx)(tr,{onClose:ne,onDone:N,teamId:a.teamId}),e[185]=a,e[186]=N,e[187]=qe):qe=e[187];let Ge;e[188]!==a?.kind||e[189]!==r||e[190]!==N?(Ge=a?.kind==="role-create"&&(0,l.jsx)(Jt,{mode:"create",onClose:ne,onDone:N,organizationId:r}),e[188]=a?.kind,e[189]=r,e[190]=N,e[191]=Ge):Ge=e[191];let We;e[192]!==a||e[193]!==r||e[194]!==N?(We=a?.kind==="role-edit"&&(0,l.jsx)(Jt,{mode:"edit",onClose:ne,onDone:N,organizationId:r,role:a.role}),e[192]=a,e[193]=r,e[194]=N,e[195]=We):We=e[195];let Xe;e[196]!==a||e[197]!==N?(Xe=a?.kind==="confirm"&&(0,l.jsx)(Zt,{action:a.action,message:a.message,onClose:ne,onDone:N,testId:a.testId,title:a.title}),e[196]=a,e[197]=N,e[198]=Xe):Xe=e[198];let bt;return e[199]!==Me||e[200]!==Fe||e[201]!==Ee||e[202]!==Le||e[203]!==Pe||e[204]!==Be||e[205]!==Je||e[206]!==Ue||e[207]!==He||e[208]!==Ke||e[209]!==Qe||e[210]!==Ze||e[211]!==Ye||e[212]!==qe||e[213]!==Ge||e[214]!==We||e[215]!==Xe?(bt=(0,l.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Me,Fe,Ee,Le,Pe,Be,Je,Ue,He,Ke,Qe,Ze,Ye,qe,Ge,We,Xe]}),e[199]=Me,e[200]=Fe,e[201]=Ee,e[202]=Le,e[203]=Pe,e[204]=Be,e[205]=Je,e[206]=Ue,e[207]=He,e[208]=Ke,e[209]=Qe,e[210]=Ze,e[211]=Ye,e[212]=qe,e[213]=Ge,e[214]=We,e[215]=Xe,e[216]=bt):bt=e[216],bt},"il");function sr(t){return(0,l.jsx)("span",{className:"font-mono text-xs",children:D(t.userId)})}m(sr,"rl");function mr(t){return D(t.role)}m(mr,"sl");function dr(t){return D(t.email)}m(dr,"nl");function cr(t){return D(t.role)}m(cr,"al");function ur(t){return D(t.status)}m(ur,"ml");function gr(t){return D(t.id)}m(gr,"dl");function hr(t){return D(t.name)}m(hr,"cl");function br(t){return(0,l.jsx)("span",{className:"font-mono text-xs",children:D(t.userId)})}m(br,"fl");function pr(t){return D(t.role)}m(pr,"ul");function fr(t){return D(t.permission)}m(fr,"gl");var Ht=100,$r=m(()=>{let t=(0,H.c)(69),e=oe(),r=Q(),{config:c,ready:h}=Et(),i=c.capabilities.organization,[o,a]=(0,E.useState)(null),[n,d]=(0,E.useState)(null),[s,p]=(0,E.useState)(0),u;t[0]!==s?(u=["lunora-auth-orgs",s],t[0]=s,t[1]=u):u=t[1];let b;t[2]!==e||t[3]!==s?(b=m(()=>e.listAuthOrganizations({limit:Ht,offset:s}),"g"),t[2]=e,t[3]=s,t[4]=b):b=t[4];let v;t[5]!==i?(v={enabled:i},t[5]=i,t[6]=v):v=t[6];let g=he(u,b,v),f=g.data?.rows??null,z;t[7]!==g?(z=m(()=>g.poll(),"S"),t[7]=g,t[8]=z):z=t[8],be(z,i);let y;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=m(()=>{d(null)},"v"),t[9]=y):y=t[9];let C=y,x;t[10]!==g?(x=m(()=>{g.refetch()},"x"),t[10]=g,t[11]=x):x=t[11];let w=x,I;t[12]===Symbol.for("react.memo_cache_sentinel")?(I=m(M=>{a(M)},"C"),t[12]=I):I=t[12];let k=I;if(h&&!i){let M;t[13]!==r?(M=r("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=r,t[14]=M):M=t[14];let $;t[15]!==r?($=r("Organizations are not enabled."),t[15]=r,t[16]=$):$=t[16];let q;return t[17]!==M||t[18]!==$?(q=(0,l.jsx)(ge,{description:M,testId:"org-disabled",title:$}),t[17]=M,t[18]=$,t[19]=q):q=t[19],q}let S;t[20]!==r?(S=r("Organizations"),t[20]=r,t[21]=S):S=t[21];let _;t[22]!==S?(_=(0,l.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),t[22]=S,t[23]=_):_=t[23];let A;t[24]===Symbol.for("react.memo_cache_sentinel")?(A=m(()=>{d({kind:"create"})},"z"),t[24]=A):A=t[24];let O;t[25]!==r?(O=r("New organization"),t[25]=r,t[26]=O):O=t[26];let T;t[27]!==O?(T=(0,l.jsx)(L,{"data-testid":"org-new",onClick:A,size:"sm",type:"button",children:O}),t[27]=O,t[28]=T):T=t[28];let R;t[29]!==T||t[30]!==_?(R=(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[_,T]}),t[29]=T,t[30]=_,t[31]=R):R=t[31];let F;t[32]!==g.error?(F=g.error!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[32]=g.error,t[33]=F):F=t[33];let Z;t[34]!==f||t[35]!==r?(Z=f!==null&&f.length===0&&(0,l.jsx)(ge,{testId:"org-empty",title:r("No organizations.")}),t[34]=f,t[35]=r,t[36]=Z):Z=t[36];let B;t[37]!==f||t[38]!==o||t[39]!==r?(B=f!==null&&f.length>0&&(0,l.jsx)(zt,{className:"overflow-hidden py-0",children:(0,l.jsx)(kt,{className:"px-0",children:(0,l.jsxs)(Nt,{"data-testid":"org-table",children:[(0,l.jsx)(At,{children:(0,l.jsxs)(Ve,{children:[(0,l.jsx)(de,{children:r("id")}),(0,l.jsx)(de,{children:r("name")}),(0,l.jsx)(de,{children:r("slug")}),(0,l.jsx)(de,{children:r("created")}),(0,l.jsx)(de,{"aria-label":r("Actions")})]})}),(0,l.jsx)(Dt,{children:f.map(M=>{let $=D(M.id);return(0,l.jsxs)(Ve,{"data-testid":`org-row-${$}`,children:[(0,l.jsx)(ce,{className:"font-mono text-xs",children:$}),(0,l.jsx)(ce,{children:D(M.name)}),(0,l.jsx)(ce,{children:D(M.slug)}),(0,l.jsx)(ce,{className:"text-muted-foreground tabular-nums",children:$t(M.createdAt)}),(0,l.jsx)(ce,{children:(0,l.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,l.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:m(()=>{k($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,l.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:m(()=>{d({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,l.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:m(()=>{d({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[37]=f,t[38]=o,t[39]=r,t[40]=B):B=t[40];let K;t[41]!==s||t[42]!==f||t[43]!==g.data?.total?(K=f!==null&&(0,l.jsx)(_t,{count:f.length,offset:s,onOffsetChange:p,pageSize:Ht,prefix:"org",total:g.data?.total}),t[41]=s,t[42]=f,t[43]=g.data?.total,t[44]=K):K=t[44];let J;t[45]!==c.organization||t[46]!==o?(J=o!==null&&(0,l.jsx)(ir,{organizationId:o,rolesEnabled:c.organization.roles,teamsEnabled:c.organization.teams}),t[45]=c.organization,t[46]=o,t[47]=J):J=t[47];let j;t[48]!==n?.kind||t[49]!==w?(j=n?.kind==="create"&&(0,l.jsx)(Pt,{mode:"create",onClose:C,onDone:w}),t[48]=n?.kind,t[49]=w,t[50]=j):j=t[50];let U;t[51]!==n||t[52]!==w?(U=n?.kind==="edit"&&(0,l.jsx)(Pt,{mode:"edit",onClose:C,onDone:w,org:n.org}),t[51]=n,t[52]=w,t[53]=U):U=t[53];let P;t[54]!==e||t[55]!==n||t[56]!==w||t[57]!==r?(P=n?.kind==="delete"&&(0,l.jsx)(Zt,{action:m(async()=>{let M=D(n.org.id);await e.deleteAuthOrganization({organizationId:M}),a($=>$===M?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:C,onDone:w,testId:"org-delete",title:r("Delete organization")}),t[54]=e,t[55]=n,t[56]=w,t[57]=r,t[58]=P):P=t[58];let Y;return t[59]!==R||t[60]!==F||t[61]!==Z||t[62]!==B||t[63]!==K||t[64]!==J||t[65]!==j||t[66]!==U||t[67]!==P?(Y=(0,l.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[R,F,Z,B,K,J,j,U,P]}),t[59]=R,t[60]=F,t[61]=Z,t[62]=B,t[63]=K,t[64]=J,t[65]=j,t[66]=U,t[67]=P,t[68]=Y):Y=t[68],Y},"Ml");export{$r as default};
@@ -1 +1 @@
1
- import{a as s}from"./chunk-QTDX7WSP.js";import{a as n}from"./chunk-I26MS5PJ.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
1
+ import{a as s}from"./chunk-YSPQIRER.js";import{a as n}from"./chunk-I26MS5PJ.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
@@ -1 +1 @@
1
- import{a as $}from"./chunk-X4MAMXRE.js";import{a as b}from"./chunk-R7SRERCX.js";import"./chunk-NCPW7WHO.js";import"./chunk-RGUL4AQZ.js";import"./chunk-55UGUCQ6.js";import{a as u}from"./chunk-4ZEL6BYL.js";import{c as p}from"./chunk-QTDX7WSP.js";import"./chunk-KPRNLQKZ.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as y,b as w,c as j,d as h,e as c,f as i}from"./chunk-HCTJKP5J.js";import{a as d,e as l}from"./chunk-2IKDEUCX.js";import{d as k}from"./chunk-74IYYDDI.js";import{a as o,d as I,g as T,i as x}from"./chunk-I26MS5PJ.js";var e=I(T(),1);var m={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},A={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},C=o((r,a)=>`exempt: ${r.exemptReason===void 0||r.exemptReason===""?a:r.exemptReason}`,"E"),E=o(r=>r.toSorted((a,n)=>a.coverage==="clean"&&n.coverage!=="clean"?1:n.coverage==="clean"&&a.coverage!=="clean"?-1:a.score-n.score),"S"),Y=o(({testId:r="advisor-health"})=>{let a=k(),n=p(u.getAdvisories,{},{live:!0}),g=p(u.getAdvisorProcedures,{},{live:!0}),f=n.data?.advisories??null,N=g.data?.procedures??null,t=f===null||N===null?null:$(N,f),v=g.error??n.error;if(v!==null)return(0,e.jsx)(b,{error:v,testId:`${r}-error`});if(t===null)return(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"py-8 text-center text-muted-foreground","data-testid":`${r}-loading`,children:a("Loading\u2026")})});let R=E(t.procedures);return(0,e.jsxs)("div",{className:"space-y-4","data-testid":r,children:[(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:x("text-4xl font-semibold tabular-nums",A[t.grade]),"data-testid":`${r}-score`,children:t.score}),(0,e.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,e.jsx)("span",{className:x("text-sm font-medium uppercase tracking-wide",A[t.grade]),"data-testid":`${r}-grade`,children:t.grade}),(0,e.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${r}-summary`,children:[(0,e.jsxs)("span",{className:m.clean,children:[t.summary.clean," ",a("clean")]}),(0,e.jsxs)("span",{className:m.warned,children:[t.summary.warned," ",a("warned")]}),(0,e.jsxs)("span",{className:m.failing,children:[t.summary.failing," ",a("failing")]}),(0,e.jsxs)("span",{className:m.exempt,children:[t.summary.exempt," ",a("exempt")]})]})]})}),t.project.checks.length>0&&(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"py-4 text-sm","data-testid":`${r}-project`,children:[(0,e.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",t.project.score,"/100"]}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",t.project.checks.map(s=>s.name).join(", ")]})]})}),(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"p-0",children:(0,e.jsxs)(y,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(c,{className:"w-20",children:a("Score")}),(0,e.jsx)(c,{children:a("Procedure")}),(0,e.jsx)(c,{className:"w-32",children:a("Kind")}),(0,e.jsx)(c,{children:a("Rules fired")})]})}),(0,e.jsx)(j,{children:R.map(s=>(0,e.jsxs)(h,{"data-testid":`${r}-row`,children:[(0,e.jsx)(i,{className:x("tabular-nums font-medium",m[s.coverage]),children:s.coverage==="exempt"?"\u2014":s.score}),(0,e.jsx)(i,{className:"font-mono text-xs",children:s.id}),(0,e.jsxs)(i,{className:"text-muted-foreground text-xs",children:[s.visibility," ",s.kind,s.sensitivity.level==="high"&&(0,e.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,e.jsx)(i,{className:"text-muted-foreground text-xs",children:s.coverage==="exempt"?C(s,a("no reason given")):s.checks.map(S=>S.name).join(", ")})]},s.id))})]})})})]})},"Y");export{Y as default};
1
+ import{a as $}from"./chunk-X4MAMXRE.js";import{a as b}from"./chunk-XC2LTW44.js";import"./chunk-NCPW7WHO.js";import"./chunk-5AXRIRHW.js";import"./chunk-55UGUCQ6.js";import{a as u}from"./chunk-4ZEL6BYL.js";import{c as p}from"./chunk-YSPQIRER.js";import"./chunk-EQRZJZD4.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as y,b as w,c as j,d as h,e as c,f as i}from"./chunk-HCTJKP5J.js";import{a as d,e as l}from"./chunk-2IKDEUCX.js";import{d as k}from"./chunk-74IYYDDI.js";import{a as o,d as I,g as T,i as x}from"./chunk-I26MS5PJ.js";var e=I(T(),1);var m={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},A={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},C=o((r,a)=>`exempt: ${r.exemptReason===void 0||r.exemptReason===""?a:r.exemptReason}`,"E"),E=o(r=>r.toSorted((a,n)=>a.coverage==="clean"&&n.coverage!=="clean"?1:n.coverage==="clean"&&a.coverage!=="clean"?-1:a.score-n.score),"S"),Y=o(({testId:r="advisor-health"})=>{let a=k(),n=p(u.getAdvisories,{},{live:!0}),g=p(u.getAdvisorProcedures,{},{live:!0}),f=n.data?.advisories??null,N=g.data?.procedures??null,t=f===null||N===null?null:$(N,f),v=g.error??n.error;if(v!==null)return(0,e.jsx)(b,{error:v,testId:`${r}-error`});if(t===null)return(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"py-8 text-center text-muted-foreground","data-testid":`${r}-loading`,children:a("Loading\u2026")})});let R=E(t.procedures);return(0,e.jsxs)("div",{className:"space-y-4","data-testid":r,children:[(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:x("text-4xl font-semibold tabular-nums",A[t.grade]),"data-testid":`${r}-score`,children:t.score}),(0,e.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,e.jsx)("span",{className:x("text-sm font-medium uppercase tracking-wide",A[t.grade]),"data-testid":`${r}-grade`,children:t.grade}),(0,e.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${r}-summary`,children:[(0,e.jsxs)("span",{className:m.clean,children:[t.summary.clean," ",a("clean")]}),(0,e.jsxs)("span",{className:m.warned,children:[t.summary.warned," ",a("warned")]}),(0,e.jsxs)("span",{className:m.failing,children:[t.summary.failing," ",a("failing")]}),(0,e.jsxs)("span",{className:m.exempt,children:[t.summary.exempt," ",a("exempt")]})]})]})}),t.project.checks.length>0&&(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"py-4 text-sm","data-testid":`${r}-project`,children:[(0,e.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",t.project.score,"/100"]}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",t.project.checks.map(s=>s.name).join(", ")]})]})}),(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"p-0",children:(0,e.jsxs)(y,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(c,{className:"w-20",children:a("Score")}),(0,e.jsx)(c,{children:a("Procedure")}),(0,e.jsx)(c,{className:"w-32",children:a("Kind")}),(0,e.jsx)(c,{children:a("Rules fired")})]})}),(0,e.jsx)(j,{children:R.map(s=>(0,e.jsxs)(h,{"data-testid":`${r}-row`,children:[(0,e.jsx)(i,{className:x("tabular-nums font-medium",m[s.coverage]),children:s.coverage==="exempt"?"\u2014":s.score}),(0,e.jsx)(i,{className:"font-mono text-xs",children:s.id}),(0,e.jsxs)(i,{className:"text-muted-foreground text-xs",children:[s.visibility," ",s.kind,s.sensitivity.level==="high"&&(0,e.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,e.jsx)(i,{className:"text-muted-foreground text-xs",children:s.coverage==="exempt"?C(s,a("no reason given")):s.checks.map(S=>S.name).join(", ")})]},s.id))})]})})})]})},"Y");export{Y as default};
@@ -1 +1 @@
1
- import{b as c}from"./chunk-QTDX7WSP.js";import{l}from"./chunk-KPRNLQKZ.js";import{a as r,d as f,f as g}from"./chunk-I26MS5PJ.js";var m=f(g(),1);var p={capabilities:{accounts:!0,admin:!0,inviteOnly:!1,organization:!1,passkey:!1,twoFactor:!1},emailAndPassword:!1,organization:{enabled:!1,roles:!1,teams:!1},plugins:[],rateLimit:{enabled:!1},session:{},socialProviders:[],userFields:[]},h=r(()=>{let o=(0,m.c)(6),t=l(),a;o[0]===Symbol.for("react.memo_cache_sentinel")?(a=["lunora-auth-config"],o[0]=a):a=o[0];let e;o[1]!==t?(e=r(()=>t.getAuthConfig(),"t"),o[1]=t,o[2]=e):e=o[2];let{data:u,isLoading:d}=c(a,e),s=u??p,n=!d,i;return o[3]!==s||o[4]!==n?(i={config:s,ready:n},o[3]=s,o[4]=n,o[5]=i):i=o[5],i},"b");export{h as a};
1
+ import{b as c}from"./chunk-YSPQIRER.js";import{l}from"./chunk-EQRZJZD4.js";import{a as r,d as f,f as g}from"./chunk-I26MS5PJ.js";var m=f(g(),1);var p={capabilities:{accounts:!0,admin:!0,inviteOnly:!1,organization:!1,passkey:!1,twoFactor:!1},emailAndPassword:!1,organization:{enabled:!1,roles:!1,teams:!1},plugins:[],rateLimit:{enabled:!1},session:{},socialProviders:[],userFields:[]},h=r(()=>{let o=(0,m.c)(6),t=l(),a;o[0]===Symbol.for("react.memo_cache_sentinel")?(a=["lunora-auth-config"],o[0]=a):a=o[0];let e;o[1]!==t?(e=r(()=>t.getAuthConfig(),"t"),o[1]=t,o[2]=e):e=o[2];let{data:u,isLoading:d}=c(a,e),s=u??p,n=!d,i;return o[3]!==s||o[4]!==n?(i={config:s,ready:n},o[3]=s,o[4]=n,o[5]=i):i=o[5],i},"b");export{h as a};
@@ -1 +1 @@
1
- import{b as me}from"./chunk-2I4NHEKA.js";import{a as $}from"./chunk-7FTJLXZH.js";import{a as ue}from"./chunk-EWMBX5N2.js";import"./chunk-W4CQMJH3.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import{a as de}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{b as P}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as A}from"./chunk-4ZEL6BYL.js";import{c as ce}from"./chunk-QTDX7WSP.js";import{l as ne,m as oe}from"./chunk-KPRNLQKZ.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as C}from"./chunk-2IKDEUCX.js";import{d as D,f as I,g as Q,h as W,q as _,u as ie}from"./chunk-74IYYDDI.js";import{a as f,d as T,e as qe,f as ae,g as le,i as M}from"./chunk-I26MS5PJ.js";var Y=T(ae(),1);var h=T(qe(),1);var fe=T(ae(),1);var B=T(le(),1);var Me={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive",polling:"bg-warning"},he=f(()=>{let t=(0,fe.c)(18),e=D(),a=oe(),s;e:switch(a){case"connected":{let n;t[0]!==e?(n=e("Connected"),t[0]=e,t[1]=n):n=t[1],s=n;break e}case"connecting":{let n;t[2]!==e?(n=e("Connecting\u2026"),t[2]=e,t[3]=n):n=t[3],s=n;break e}case"idle":{let n;t[4]!==e?(n=e("Idle"),t[4]=e,t[5]=n):n=t[5],s=n;break e}case"offline":{let n;t[6]!==e?(n=e("Offline"),t[6]=e,t[7]=n):n=t[7],s=n;break e}case"polling":{let n;t[8]!==e?(n=e("Polling"),t[8]=e,t[9]=n):n=t[9],s=n;break e}default:s=a}let l=Me[a],c;t[10]!==l?(c=M("size-2 rounded-full",l),t[10]=l,t[11]=c):c=t[11];let i;t[12]!==c?(i=(0,B.jsx)("span",{"aria-hidden":"true",className:c}),t[12]=c,t[13]=i):i=t[13];let o;return t[14]!==a||t[15]!==i||t[16]!==s?(o=(0,B.jsxs)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[i,s]}),t[14]=a,t[15]=i,t[16]=s,t[17]=o):o=t[17],o},"T");var r=T(le(),1);var Ae={crit:"destructive",ok:"secondary",warn:"default"},U=f((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"P"),X=f((t,e,a)=>Number.isNaN(t)?"ok":t>=a?"crit":t>=e?"warn":"ok","z"),xe=.01,ve=.05,je=f(t=>{let e=(0,Y.c)(36),{errorCount:a,logsError:s,topErrors:l,worstFunctions:c}=t,i=D(),o;e[0]!==i?(o=i("Functions by error rate"),e[0]=i,e[1]=o):o=e[1];let n;e[2]!==o?(n=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==i||e[5]!==c?(m=c.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:c.map(w=>(0,r.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:w.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:w.calls.toString()})}),(0,r.jsx)(P,{variant:Ae[X(w.errors/w.calls,xe,ve)],children:U(w.errors,w.calls)})]})]},w.path))}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==m?(p=(0,r.jsxs)(C,{className:"gap-0 py-0","data-testid":"hl-functions",children:[n,m]}),e[7]=n,e[8]=m,e[9]=p):p=e[9];let v;e[10]!==i?(v=i("Recent errors"),e[10]=i,e[11]=v):v=e[11];let d;e[12]!==v?(d=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[12]=v,e[13]=d):d=e[13];let u=a>0?"destructive":"outline",g;e[14]!==a||e[15]!==u?(g=(0,r.jsx)(P,{"data-testid":"hl-error-count",variant:u,children:a}),e[14]=a,e[15]=u,e[16]=g):g=e[16];let x;e[17]!==d||e[18]!==g?(x=(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[d,g]}),e[17]=d,e[18]=g,e[19]=x):x=e[19];let S;e[20]!==s?(S=s!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:s}),e[20]=s,e[21]=S):S=e[21];let E;e[22]!==s||e[23]!==i||e[24]!==l.length?(E=s===null&&l.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=s,e[23]=i,e[24]=l.length,e[25]=E):E=e[25];let q;e[26]!==l?(q=l.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:l.map(Ce)}),e[26]=l,e[27]=q):q=e[27];let N;e[28]!==S||e[29]!==E||e[30]!==q||e[31]!==x?(N=(0,r.jsxs)(C,{className:"gap-0 py-0",children:[x,S,E,q]}),e[28]=S,e[29]=E,e[30]=q,e[31]=x,e[32]=N):N=e[32];let k;return e[33]!==N||e[34]!==p?(k=(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[p,N]}),e[33]=N,e[34]=p,e[35]=k):k=e[35],k},"ye");function Ce(t,e){return(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ie(t.timestamp)}),t.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}f(Ce,"Te");var pe={completed:0,failed:2,in_progress:1},Ie=f(t=>{let e=0,a=0,s=0,l=0,c=!1,i=[];for(let{metrics:o}of t){if(o===null){l+=1;continue}s+=1,e+=o.requests,a+=o.errors,i.push(...o.history??[]),c||=o.historyTruncated===!0}return{errors:a,failed:l,history:i,historyTruncated:c,reachable:s,requests:e}},"Ae"),Te=f(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"ke"),De=f(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let c=pe[s.status]-pe[l.status];(c>0||c===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"Re"),Pe=I(A.getAuthMetrics),Fe=I(A.getFunctionStats),Le=I(A.getLogs),Re=I(A.getMetrics),ze=I(A.migrationStatus),Oe=5,ge=2e3,Ke=5,_e=.1,$e=.3,Be=1,He=50,Ue=f((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","Pe"),Ge=f(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"Ge"),Ve=f(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"Ve"),Je=f((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"Be"),be={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Qe={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},We=f(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Ke"),H=f(t=>{let e=(0,Y.c)(19),{chart:a,label:s,level:l,testId:c,value:i}=t,o=be[l],n;e[0]!==o?(n=M("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=n):n=e[1];let m;e[2]!==n?(m=(0,r.jsx)("span",{"aria-hidden":"true",className:n}),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==s||e[5]!==m?(p=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[m,s]}),e[4]=s,e[5]=m,e[6]=p):p=e[6];let v=Ne[l],d;e[7]!==v?(d=M("truncate text-2xl font-semibold tabular-nums",v),e[7]=v,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==c||e[11]!==i?(u=(0,r.jsx)("span",{className:d,"data-testid":c,children:i}),e[9]=d,e[10]=c,e[11]=i,e[12]=u):u=e[12];let g;e[13]!==a||e[14]!==u?(g=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,a]}),e[13]=a,e[14]=u,e[15]=g):g=e[15];let x;return e[16]!==p||e[17]!==g?(x=(0,r.jsx)(C,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]})}),e[16]=p,e[17]=g,e[18]=x):x=e[18],x},"U"),Xe=f(async(t,e,a)=>{let s=await Promise.all(a.map(d=>{let u=Q(d);return Promise.allSettled([t.query(Re,{},u),t.query(Fe,{},u),t.query(ze,{},u)])})),l=Q(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,o,n]=await Promise.allSettled([t.query(Le,{},l),t.query(Pe,{},l),c]),m=s.map(([d,u,g])=>({functions:u.status==="fulfilled"?u.value.functions:[],metrics:d.status==="fulfilled"?d.value:null,migrations:g.status==="fulfilled"?g.value.migrations:[]})),p=Ie(m),v=s[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:Te(m.map(d=>d.functions)),logsError:i.status==="rejected"?W(i.reason):null,metricsError:p.reachable===0&&v?.status==="rejected"?W(v.reason):null,migrations:De(m.map(d=>d.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:p}},"$e"),Ye=f(t=>{let e=t?.history??[];return{attempts:e.map(a=>a.attempts),failures:e.map(a=>a.failures)}},"ze"),xt=f(({initialShardKey:t})=>{let e=ne(),a=D(),[s,l]=(0,h.useState)([]),[c,i]=(0,h.useState)(null),[o,n]=(0,h.useState)(null),[m,p]=(0,h.useState)(null),[v,d]=(0,h.useState)([]),[u,g]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),[E,q]=(0,h.useState)([]),[N]=(0,h.useState)(de),k=(0,h.useRef)(!1),w=(0,h.useRef)(0),G=(0,h.useRef)(0),j=(0,h.useRef)(null),F=t??"",L=(0,h.useCallback)(async()=>{if(k.current)return;k.current=!0;let b=w.current,y=await Xe(e,F,me(F,N));b===w.current&&(n(y.totals),p(y.metricsError),d(y.functions),q(y.migrations),l(y.entries),i(y.logsError),g(y.auth),S(y.scheduler),k.current=!1)},[e,N,F]);(0,h.useEffect)(()=>(_(L()),()=>{w.current+=1,k.current=!1,j.current!==null&&(clearTimeout(j.current),j.current=null)}),[L]);let ye=f(()=>{let b=Date.now()-G.current;if(b>=ge){G.current=Date.now(),_(L());return}j.current===null&&(j.current=setTimeout(()=>{j.current=null,G.current=Date.now(),_(L())},ge-b))},"ue"),{data:Z,liveError:we}=ce(A.getMetrics,{},{live:!0,shardKey:F});(0,h.useEffect)(()=>{Z!==void 0&&ye()},[Z]);let ee=s.filter(b=>b.level==="error"),ke=ee.slice(0,Oe),R=Ge(o?.history),te=Ye(u),Se=v.filter(b=>b.calls>0).toSorted((b,y)=>y.errors/y.calls-b.errors/b.calls||y.calls-b.calls).slice(0,Ke),V=Ve(E),Ee=o===null||o.requests===0?0:o.errors/o.requests,J=X(Ee,xe,ve),re=u===null?"ok":X(u.failureRate,_e,$e),se=x===null?"ok":Ue(x.backlog,Be,He),z=We([J,re,se,V.level]),O,K;return z==="crit"?(O=a("Critical"),K=a("One or more service levels are breached.")):z==="warn"?(O=a("Degraded"),K=a("Some service levels need attention.")):(O=a("All systems healthy"),K=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(C,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:M("flex size-10 shrink-0 items-center justify-center rounded-full",Qe[z]),children:(0,r.jsx)("span",{className:M("size-3 rounded-full",be[z])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:K})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[R.requests.length>=2&&(0,r.jsx)($,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:R.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(o?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:M("text-lg font-semibold tabular-nums",Ne[J]),"data-testid":"hl-error-rate",children:o===null?"\u2014":U(o.errors,o.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(he,{}),(0,r.jsx)(ue,{message:we,prefix:"hl"})]})]})]}),m!==null&&(0,r.jsx)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:m}),m===null&&o?.historyTruncated===!0&&(0,r.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:a("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(H,{chart:R.errors.length>=2?(0,r.jsx)($,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:R.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:J,testId:"hl-slo-errorrate",value:o===null?"\u2014":U(o.errors,o.requests)}),(0,r.jsx)(H,{chart:te.failures.length>=2?(0,r.jsx)($,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:te.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:re,testId:"hl-slo-auth",value:u===null?"\u2014":U(u.failures,u.attempts)}),(0,r.jsx)(H,{label:a("Scheduler backlog"),level:se,testId:"hl-slo-backlog",value:x===null?"\u2014":x.backlog.toString()}),(0,r.jsx)(H,{label:a("Migrations"),level:V.level,testId:"hl-slo-migrations",value:Je(V,a)})]}),(0,r.jsx)(je,{errorCount:ee.length,logsError:c,topErrors:ke,worstFunctions:Se}),(0,r.jsxs)(C,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")}),(0,r.jsx)(P,{"data-testid":"hl-shard-count",variant:"outline",children:N.length})]}),N.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:N.map(b=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(P,{variant:"secondary",children:b})},b))})]})]})},"ut");export{xt as HealthPanel};
1
+ import{b as me}from"./chunk-2I4NHEKA.js";import{a as $}from"./chunk-7FTJLXZH.js";import{a as ue}from"./chunk-EWMBX5N2.js";import"./chunk-W4CQMJH3.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import{a as de}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{b as P}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as A}from"./chunk-4ZEL6BYL.js";import{c as ce}from"./chunk-YSPQIRER.js";import{l as ne,m as oe}from"./chunk-EQRZJZD4.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as C}from"./chunk-2IKDEUCX.js";import{d as D,f as I,g as Q,h as W,q as _,u as ie}from"./chunk-74IYYDDI.js";import{a as f,d as T,e as qe,f as ae,g as le,i as M}from"./chunk-I26MS5PJ.js";var Y=T(ae(),1);var h=T(qe(),1);var fe=T(ae(),1);var B=T(le(),1);var Me={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive",polling:"bg-warning"},he=f(()=>{let t=(0,fe.c)(18),e=D(),a=oe(),s;e:switch(a){case"connected":{let n;t[0]!==e?(n=e("Connected"),t[0]=e,t[1]=n):n=t[1],s=n;break e}case"connecting":{let n;t[2]!==e?(n=e("Connecting\u2026"),t[2]=e,t[3]=n):n=t[3],s=n;break e}case"idle":{let n;t[4]!==e?(n=e("Idle"),t[4]=e,t[5]=n):n=t[5],s=n;break e}case"offline":{let n;t[6]!==e?(n=e("Offline"),t[6]=e,t[7]=n):n=t[7],s=n;break e}case"polling":{let n;t[8]!==e?(n=e("Polling"),t[8]=e,t[9]=n):n=t[9],s=n;break e}default:s=a}let l=Me[a],c;t[10]!==l?(c=M("size-2 rounded-full",l),t[10]=l,t[11]=c):c=t[11];let i;t[12]!==c?(i=(0,B.jsx)("span",{"aria-hidden":"true",className:c}),t[12]=c,t[13]=i):i=t[13];let o;return t[14]!==a||t[15]!==i||t[16]!==s?(o=(0,B.jsxs)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[i,s]}),t[14]=a,t[15]=i,t[16]=s,t[17]=o):o=t[17],o},"T");var r=T(le(),1);var Ae={crit:"destructive",ok:"secondary",warn:"default"},U=f((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"P"),X=f((t,e,a)=>Number.isNaN(t)?"ok":t>=a?"crit":t>=e?"warn":"ok","z"),xe=.01,ve=.05,je=f(t=>{let e=(0,Y.c)(36),{errorCount:a,logsError:s,topErrors:l,worstFunctions:c}=t,i=D(),o;e[0]!==i?(o=i("Functions by error rate"),e[0]=i,e[1]=o):o=e[1];let n;e[2]!==o?(n=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==i||e[5]!==c?(m=c.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:c.map(w=>(0,r.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:w.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:w.calls.toString()})}),(0,r.jsx)(P,{variant:Ae[X(w.errors/w.calls,xe,ve)],children:U(w.errors,w.calls)})]})]},w.path))}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==m?(p=(0,r.jsxs)(C,{className:"gap-0 py-0","data-testid":"hl-functions",children:[n,m]}),e[7]=n,e[8]=m,e[9]=p):p=e[9];let v;e[10]!==i?(v=i("Recent errors"),e[10]=i,e[11]=v):v=e[11];let d;e[12]!==v?(d=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[12]=v,e[13]=d):d=e[13];let u=a>0?"destructive":"outline",g;e[14]!==a||e[15]!==u?(g=(0,r.jsx)(P,{"data-testid":"hl-error-count",variant:u,children:a}),e[14]=a,e[15]=u,e[16]=g):g=e[16];let x;e[17]!==d||e[18]!==g?(x=(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[d,g]}),e[17]=d,e[18]=g,e[19]=x):x=e[19];let S;e[20]!==s?(S=s!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:s}),e[20]=s,e[21]=S):S=e[21];let E;e[22]!==s||e[23]!==i||e[24]!==l.length?(E=s===null&&l.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=s,e[23]=i,e[24]=l.length,e[25]=E):E=e[25];let q;e[26]!==l?(q=l.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:l.map(Ce)}),e[26]=l,e[27]=q):q=e[27];let N;e[28]!==S||e[29]!==E||e[30]!==q||e[31]!==x?(N=(0,r.jsxs)(C,{className:"gap-0 py-0",children:[x,S,E,q]}),e[28]=S,e[29]=E,e[30]=q,e[31]=x,e[32]=N):N=e[32];let k;return e[33]!==N||e[34]!==p?(k=(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[p,N]}),e[33]=N,e[34]=p,e[35]=k):k=e[35],k},"ye");function Ce(t,e){return(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ie(t.timestamp)}),t.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}f(Ce,"Te");var pe={completed:0,failed:2,in_progress:1},Ie=f(t=>{let e=0,a=0,s=0,l=0,c=!1,i=[];for(let{metrics:o}of t){if(o===null){l+=1;continue}s+=1,e+=o.requests,a+=o.errors,i.push(...o.history??[]),c||=o.historyTruncated===!0}return{errors:a,failed:l,history:i,historyTruncated:c,reachable:s,requests:e}},"Ae"),Te=f(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"ke"),De=f(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let c=pe[s.status]-pe[l.status];(c>0||c===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"Re"),Pe=I(A.getAuthMetrics),Fe=I(A.getFunctionStats),Le=I(A.getLogs),Re=I(A.getMetrics),ze=I(A.migrationStatus),Oe=5,ge=2e3,Ke=5,_e=.1,$e=.3,Be=1,He=50,Ue=f((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","Pe"),Ge=f(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"Ge"),Ve=f(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"Ve"),Je=f((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"Be"),be={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Qe={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},We=f(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Ke"),H=f(t=>{let e=(0,Y.c)(19),{chart:a,label:s,level:l,testId:c,value:i}=t,o=be[l],n;e[0]!==o?(n=M("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=n):n=e[1];let m;e[2]!==n?(m=(0,r.jsx)("span",{"aria-hidden":"true",className:n}),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==s||e[5]!==m?(p=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[m,s]}),e[4]=s,e[5]=m,e[6]=p):p=e[6];let v=Ne[l],d;e[7]!==v?(d=M("truncate text-2xl font-semibold tabular-nums",v),e[7]=v,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==c||e[11]!==i?(u=(0,r.jsx)("span",{className:d,"data-testid":c,children:i}),e[9]=d,e[10]=c,e[11]=i,e[12]=u):u=e[12];let g;e[13]!==a||e[14]!==u?(g=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,a]}),e[13]=a,e[14]=u,e[15]=g):g=e[15];let x;return e[16]!==p||e[17]!==g?(x=(0,r.jsx)(C,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]})}),e[16]=p,e[17]=g,e[18]=x):x=e[18],x},"U"),Xe=f(async(t,e,a)=>{let s=await Promise.all(a.map(d=>{let u=Q(d);return Promise.allSettled([t.query(Re,{},u),t.query(Fe,{},u),t.query(ze,{},u)])})),l=Q(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,o,n]=await Promise.allSettled([t.query(Le,{},l),t.query(Pe,{},l),c]),m=s.map(([d,u,g])=>({functions:u.status==="fulfilled"?u.value.functions:[],metrics:d.status==="fulfilled"?d.value:null,migrations:g.status==="fulfilled"?g.value.migrations:[]})),p=Ie(m),v=s[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:Te(m.map(d=>d.functions)),logsError:i.status==="rejected"?W(i.reason):null,metricsError:p.reachable===0&&v?.status==="rejected"?W(v.reason):null,migrations:De(m.map(d=>d.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:p}},"$e"),Ye=f(t=>{let e=t?.history??[];return{attempts:e.map(a=>a.attempts),failures:e.map(a=>a.failures)}},"ze"),xt=f(({initialShardKey:t})=>{let e=ne(),a=D(),[s,l]=(0,h.useState)([]),[c,i]=(0,h.useState)(null),[o,n]=(0,h.useState)(null),[m,p]=(0,h.useState)(null),[v,d]=(0,h.useState)([]),[u,g]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),[E,q]=(0,h.useState)([]),[N]=(0,h.useState)(de),k=(0,h.useRef)(!1),w=(0,h.useRef)(0),G=(0,h.useRef)(0),j=(0,h.useRef)(null),F=t??"",L=(0,h.useCallback)(async()=>{if(k.current)return;k.current=!0;let b=w.current,y=await Xe(e,F,me(F,N));b===w.current&&(n(y.totals),p(y.metricsError),d(y.functions),q(y.migrations),l(y.entries),i(y.logsError),g(y.auth),S(y.scheduler),k.current=!1)},[e,N,F]);(0,h.useEffect)(()=>(_(L()),()=>{w.current+=1,k.current=!1,j.current!==null&&(clearTimeout(j.current),j.current=null)}),[L]);let ye=f(()=>{let b=Date.now()-G.current;if(b>=ge){G.current=Date.now(),_(L());return}j.current===null&&(j.current=setTimeout(()=>{j.current=null,G.current=Date.now(),_(L())},ge-b))},"ue"),{data:Z,liveError:we}=ce(A.getMetrics,{},{live:!0,shardKey:F});(0,h.useEffect)(()=>{Z!==void 0&&ye()},[Z]);let ee=s.filter(b=>b.level==="error"),ke=ee.slice(0,Oe),R=Ge(o?.history),te=Ye(u),Se=v.filter(b=>b.calls>0).toSorted((b,y)=>y.errors/y.calls-b.errors/b.calls||y.calls-b.calls).slice(0,Ke),V=Ve(E),Ee=o===null||o.requests===0?0:o.errors/o.requests,J=X(Ee,xe,ve),re=u===null?"ok":X(u.failureRate,_e,$e),se=x===null?"ok":Ue(x.backlog,Be,He),z=We([J,re,se,V.level]),O,K;return z==="crit"?(O=a("Critical"),K=a("One or more service levels are breached.")):z==="warn"?(O=a("Degraded"),K=a("Some service levels need attention.")):(O=a("All systems healthy"),K=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(C,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:M("flex size-10 shrink-0 items-center justify-center rounded-full",Qe[z]),children:(0,r.jsx)("span",{className:M("size-3 rounded-full",be[z])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:K})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[R.requests.length>=2&&(0,r.jsx)($,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:R.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(o?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:M("text-lg font-semibold tabular-nums",Ne[J]),"data-testid":"hl-error-rate",children:o===null?"\u2014":U(o.errors,o.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(he,{}),(0,r.jsx)(ue,{message:we,prefix:"hl"})]})]})]}),m!==null&&(0,r.jsx)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:m}),m===null&&o?.historyTruncated===!0&&(0,r.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:a("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(H,{chart:R.errors.length>=2?(0,r.jsx)($,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:R.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:J,testId:"hl-slo-errorrate",value:o===null?"\u2014":U(o.errors,o.requests)}),(0,r.jsx)(H,{chart:te.failures.length>=2?(0,r.jsx)($,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:te.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:re,testId:"hl-slo-auth",value:u===null?"\u2014":U(u.failures,u.attempts)}),(0,r.jsx)(H,{label:a("Scheduler backlog"),level:se,testId:"hl-slo-backlog",value:x===null?"\u2014":x.backlog.toString()}),(0,r.jsx)(H,{label:a("Migrations"),level:V.level,testId:"hl-slo-migrations",value:Je(V,a)})]}),(0,r.jsx)(je,{errorCount:ee.length,logsError:c,topErrors:ke,worstFunctions:Se}),(0,r.jsxs)(C,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")}),(0,r.jsx)(P,{"data-testid":"hl-shard-count",variant:"outline",children:N.length})]}),N.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:N.map(b=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(P,{variant:"secondary",children:b})},b))})]})]})},"ut");export{xt as HealthPanel};
@@ -1 +1 @@
1
- import{a as H}from"./chunk-VQRCJJXS.js";import"./chunk-PSMQQV6S.js";import{a as F}from"./chunk-3ZVTL2VM.js";import{a as I}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as $}from"./chunk-QTDX7WSP.js";import{l as S}from"./chunk-KPRNLQKZ.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as B}from"./chunk-RWVIV3U7.js";import{a as L,b as O,c as E,d as k,e as l,f as n}from"./chunk-HCTJKP5J.js";import{a as j,e as z}from"./chunk-2IKDEUCX.js";import{d as C,q as R,u as T}from"./chunk-74IYYDDI.js";import{a as f,d as y,e as D,f as G,g as J}from"./chunk-I26MS5PJ.js";var P=y(G(),1);var Q=y(D(),1);var s=y(J(),1);var w=200,se=f(()=>{let e=(0,P.c)(28),d=S(),a=C(),[r,q]=(0,Q.useState)(0),p;e[0]!==r?(p=["lunora-auth-sessions",w,r],e[0]=r,e[1]=p):p=e[1];let x;e[2]!==d||e[3]!==r?(x=f(()=>d.listAuthSessions({limit:w,offset:r}),"p"),e[2]=d,e[3]=r,e[4]=x):x=e[4];let o=$(p,x),{error:g}=o,t=o.data?.rows??null,N;e[5]!==o?(N=f(()=>o.poll(),"b"),e[5]=o,e[6]=N):N=e[6],F(N,!0);let v;e[7]!==d||e[8]!==o?(v=f(i=>{R((async()=>{await d.revokeAuthSession({sessionId:i}),o.refetch()})())},"g"),e[7]=d,e[8]=o,e[9]=v):v=e[9];let b=v,m;e[10]!==g?(m=g!==null&&(0,s.jsx)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:g}),e[10]=g,e[11]=m):m=e[11];let c;e[12]!==t||e[13]!==a?(c=t!==null&&t.length===0&&(0,s.jsx)(B,{testId:"auth-sessions-empty",title:a("No active sessions.")}),e[12]=t,e[13]=a,e[14]=c):c=e[14];let h;e[15]!==b||e[16]!==t||e[17]!==a?(h=t!==null&&t.length>0&&(0,s.jsx)(j,{className:"overflow-hidden py-0",children:(0,s.jsx)(z,{className:"px-0",children:(0,s.jsxs)(L,{"data-testid":"auth-sessions-table",children:[(0,s.jsx)(O,{children:(0,s.jsxs)(k,{children:[(0,s.jsx)(l,{children:a("user")}),(0,s.jsx)(l,{children:a("expires")}),(0,s.jsx)(l,{children:a("ip")}),(0,s.jsx)(l,{children:a("user agent")}),(0,s.jsx)(l,{children:a("impersonated by")}),(0,s.jsx)(l,{"aria-label":a("Actions")})]})}),(0,s.jsx)(E,{children:t.map(i=>(0,s.jsxs)(k,{"data-testid":`auth-session-${i.id}`,children:[(0,s.jsx)(n,{className:"font-mono text-xs",children:i.userId}),(0,s.jsx)(n,{className:"text-muted-foreground tabular-nums",children:T(i.expiresAt)}),(0,s.jsx)(n,{children:i.ipAddress??""}),(0,s.jsx)(n,{className:"max-w-40 truncate",children:i.userAgent??""}),(0,s.jsx)(n,{className:"font-mono text-xs",children:i.impersonatedBy??""}),(0,s.jsx)(n,{children:(0,s.jsx)(I,{"data-testid":`auth-session-revoke-${i.id}`,onClick:f(()=>{b(i.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Revoke")})})]},i.id))})]})})}),e[15]=b,e[16]=t,e[17]=a,e[18]=h):h=e[18];let u;e[19]!==r||e[20]!==t||e[21]!==o.data?.total?(u=t!==null&&(0,s.jsx)(H,{count:t.length,offset:r,onOffsetChange:q,pageSize:w,prefix:"auth-sessions",total:o.data?.total}),e[19]=r,e[20]=t,e[21]=o.data?.total,e[22]=u):u=e[22];let A;return e[23]!==m||e[24]!==c||e[25]!==h||e[26]!==u?(A=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[m,c,h,u]}),e[23]=m,e[24]=c,e[25]=h,e[26]=u,e[27]=A):A=e[27],A},"ee");export{se as default};
1
+ import{a as H}from"./chunk-VQRCJJXS.js";import"./chunk-PSMQQV6S.js";import{a as F}from"./chunk-ZRFRFHRU.js";import{a as I}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as $}from"./chunk-YSPQIRER.js";import{l as S}from"./chunk-EQRZJZD4.js";import"./chunk-QAQDMS6R.js";import"./chunk-NRAAYZ4C.js";import{a as B}from"./chunk-RWVIV3U7.js";import{a as L,b as O,c as E,d as k,e as l,f as n}from"./chunk-HCTJKP5J.js";import{a as j,e as z}from"./chunk-2IKDEUCX.js";import{d as C,q as R,u as T}from"./chunk-74IYYDDI.js";import{a as f,d as y,e as D,f as G,g as J}from"./chunk-I26MS5PJ.js";var P=y(G(),1);var Q=y(D(),1);var s=y(J(),1);var w=200,se=f(()=>{let e=(0,P.c)(28),d=S(),a=C(),[r,q]=(0,Q.useState)(0),p;e[0]!==r?(p=["lunora-auth-sessions",w,r],e[0]=r,e[1]=p):p=e[1];let x;e[2]!==d||e[3]!==r?(x=f(()=>d.listAuthSessions({limit:w,offset:r}),"p"),e[2]=d,e[3]=r,e[4]=x):x=e[4];let o=$(p,x),{error:g}=o,t=o.data?.rows??null,N;e[5]!==o?(N=f(()=>o.poll(),"b"),e[5]=o,e[6]=N):N=e[6],F(N,!0);let v;e[7]!==d||e[8]!==o?(v=f(i=>{R((async()=>{await d.revokeAuthSession({sessionId:i}),o.refetch()})())},"g"),e[7]=d,e[8]=o,e[9]=v):v=e[9];let b=v,m;e[10]!==g?(m=g!==null&&(0,s.jsx)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:g}),e[10]=g,e[11]=m):m=e[11];let c;e[12]!==t||e[13]!==a?(c=t!==null&&t.length===0&&(0,s.jsx)(B,{testId:"auth-sessions-empty",title:a("No active sessions.")}),e[12]=t,e[13]=a,e[14]=c):c=e[14];let h;e[15]!==b||e[16]!==t||e[17]!==a?(h=t!==null&&t.length>0&&(0,s.jsx)(j,{className:"overflow-hidden py-0",children:(0,s.jsx)(z,{className:"px-0",children:(0,s.jsxs)(L,{"data-testid":"auth-sessions-table",children:[(0,s.jsx)(O,{children:(0,s.jsxs)(k,{children:[(0,s.jsx)(l,{children:a("user")}),(0,s.jsx)(l,{children:a("expires")}),(0,s.jsx)(l,{children:a("ip")}),(0,s.jsx)(l,{children:a("user agent")}),(0,s.jsx)(l,{children:a("impersonated by")}),(0,s.jsx)(l,{"aria-label":a("Actions")})]})}),(0,s.jsx)(E,{children:t.map(i=>(0,s.jsxs)(k,{"data-testid":`auth-session-${i.id}`,children:[(0,s.jsx)(n,{className:"font-mono text-xs",children:i.userId}),(0,s.jsx)(n,{className:"text-muted-foreground tabular-nums",children:T(i.expiresAt)}),(0,s.jsx)(n,{children:i.ipAddress??""}),(0,s.jsx)(n,{className:"max-w-40 truncate",children:i.userAgent??""}),(0,s.jsx)(n,{className:"font-mono text-xs",children:i.impersonatedBy??""}),(0,s.jsx)(n,{children:(0,s.jsx)(I,{"data-testid":`auth-session-revoke-${i.id}`,onClick:f(()=>{b(i.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Revoke")})})]},i.id))})]})})}),e[15]=b,e[16]=t,e[17]=a,e[18]=h):h=e[18];let u;e[19]!==r||e[20]!==t||e[21]!==o.data?.total?(u=t!==null&&(0,s.jsx)(H,{count:t.length,offset:r,onOffsetChange:q,pageSize:w,prefix:"auth-sessions",total:o.data?.total}),e[19]=r,e[20]=t,e[21]=o.data?.total,e[22]=u):u=e[22];let A;return e[23]!==m||e[24]!==c||e[25]!==h||e[26]!==u?(A=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[m,c,h,u]}),e[23]=m,e[24]=c,e[25]=h,e[26]=u,e[27]=A):A=e[27],A},"ee");export{se as default};