@lunora/studio 1.0.0-alpha.47 → 1.0.0-alpha.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/index.d.ts +3 -3
  2. package/dist/index.js +2 -2
  3. package/dist/mount.d.ts +1 -1
  4. package/dist/mount.js +1 -1
  5. package/dist/packem_chunks/agents-panel.js +326 -0
  6. package/dist/packem_chunks/kv-browser.js +1 -1
  7. package/dist/packem_shared/{Studio-sfBFghzO.js → Studio-MB2VTLwI.js} +1 -1
  8. package/dist/packem_shared/{StudioApp-Ism1gXfJ.js → StudioApp-Ds6u0iY5.js} +1 -1
  9. package/dist/packem_shared/{app.d-CNLRTrWw.d.ts → app.d-Bly6zmWK.d.ts} +1 -1
  10. package/dist/packem_shared/{studio-CFC_pv0f.js → studio-Bv27fj7n.js} +602 -575
  11. package/dist/standalone/{chunk-JQ4WOPMF.js → chunk-2CCWLKQW.js} +1 -1
  12. package/dist/standalone/{chunk-EYSL7KEQ.js → chunk-2JUOJEKE.js} +1 -1
  13. package/dist/standalone/{chunk-FNQQ3B5G.js → chunk-2O4BHAHA.js} +1 -1
  14. package/dist/standalone/{chunk-7YXOPTWI.js → chunk-3GXGLNKW.js} +1 -1
  15. package/dist/standalone/{chunk-4KSX53SI.js → chunk-3JXKA6BH.js} +1 -1
  16. package/dist/standalone/chunk-4TV6S6AO.js +3 -0
  17. package/dist/standalone/{chunk-CTPCJNOP.js → chunk-5OZQHQ26.js} +1 -1
  18. package/dist/standalone/{chunk-ADP5UEHQ.js → chunk-5YPIP3G7.js} +1 -1
  19. package/dist/standalone/{chunk-Y2GJJVS5.js → chunk-6U45TJXA.js} +1 -1
  20. package/dist/standalone/{chunk-37HPVOYP.js → chunk-7LDYSHOU.js} +1 -1
  21. package/dist/standalone/{chunk-2CQ2YNER.js → chunk-A3ZJACVT.js} +1 -1
  22. package/dist/standalone/{chunk-CGGZAYGG.js → chunk-AHDVD4KF.js} +1 -1
  23. package/dist/standalone/{chunk-PL2KY6IG.js → chunk-ALTQC4S5.js} +1 -1
  24. package/dist/standalone/{chunk-QBAT52GB.js → chunk-APSSZB6Z.js} +1 -1
  25. package/dist/standalone/{chunk-HROXYAZT.js → chunk-BGG56IF5.js} +1 -1
  26. package/dist/standalone/{chunk-GSCV2N3F.js → chunk-BTODL6SI.js} +1 -1
  27. package/dist/standalone/{chunk-K2CB2CHL.js → chunk-CCRVGYTN.js} +1 -1
  28. package/dist/standalone/{chunk-CJTT4TBP.js → chunk-CDHEMVIY.js} +1 -1
  29. package/dist/standalone/{chunk-V4ECZI2R.js → chunk-CTOOUWO4.js} +1 -1
  30. package/dist/standalone/{chunk-DDE62TRL.js → chunk-ECJPFPHR.js} +1 -1
  31. package/dist/standalone/{chunk-YAECF5LW.js → chunk-EOE5NDMK.js} +1 -1
  32. package/dist/standalone/{chunk-SHK6RAFG.js → chunk-FFCUV3TZ.js} +1 -1
  33. package/dist/standalone/{chunk-SEQ43UW2.js → chunk-GA6K5WS5.js} +1 -1
  34. package/dist/standalone/{chunk-WD2LBHJZ.js → chunk-JUDPYSJZ.js} +1 -1
  35. package/dist/standalone/{chunk-CLMGPTAI.js → chunk-L4UCG6XZ.js} +1 -1
  36. package/dist/standalone/{chunk-DH4K2OLM.js → chunk-LUP4YTBS.js} +1 -1
  37. package/dist/standalone/{chunk-YSPZSTDI.js → chunk-N4TGVH2R.js} +1 -1
  38. package/dist/standalone/{chunk-YFA7NUCL.js → chunk-NH4FSHFO.js} +1 -1
  39. package/dist/standalone/{chunk-3HS3ZXFB.js → chunk-NS23QR4W.js} +1 -1
  40. package/dist/standalone/{chunk-3OZDR3RM.js → chunk-Q6356GAQ.js} +1 -1
  41. package/dist/standalone/{chunk-FKVCHCYV.js → chunk-Q7HPS6TW.js} +1 -1
  42. package/dist/standalone/{chunk-WOXVMXSQ.js → chunk-QCW4BAH5.js} +1 -1
  43. package/dist/standalone/{chunk-F4HDP4XW.js → chunk-R2HA2NVX.js} +1 -1
  44. package/dist/standalone/{chunk-F5I22A4W.js → chunk-R6H6DUPU.js} +1 -1
  45. package/dist/standalone/{chunk-XVR74IFC.js → chunk-RE4LLVPN.js} +1 -1
  46. package/dist/standalone/chunk-RYF5EUQA.js +1 -0
  47. package/dist/standalone/{chunk-VON7JUPG.js → chunk-S5NTGHCG.js} +1 -1
  48. package/dist/standalone/{chunk-LRYLU6EY.js → chunk-SDMZKBTD.js} +1 -1
  49. package/dist/standalone/{chunk-KSKXW5PX.js → chunk-SHERR7ZP.js} +1 -1
  50. package/dist/standalone/{chunk-BIBCC7EE.js → chunk-TO6D2PJC.js} +1 -1
  51. package/dist/standalone/{chunk-5UKRVDFD.js → chunk-UTHHHJYS.js} +1 -1
  52. package/dist/standalone/{chunk-KCMKEMUL.js → chunk-UWSLX56Q.js} +1 -1
  53. package/dist/standalone/{chunk-LNZIB2MD.js → chunk-V43BLH4J.js} +1 -1
  54. package/dist/standalone/{chunk-3CJW6NWG.js → chunk-VL23Y44O.js} +1 -1
  55. package/dist/standalone/{chunk-L7WR3C4Z.js → chunk-W5BAQMIE.js} +1 -1
  56. package/dist/standalone/{chunk-HVRDZZHL.js → chunk-W666BB6V.js} +1 -1
  57. package/dist/standalone/{chunk-S3Q6R7BA.js → chunk-W6JKUZKD.js} +1 -1
  58. package/dist/standalone/{chunk-WMWDJLRO.js → chunk-WK7VHQTQ.js} +1 -1
  59. package/dist/standalone/{chunk-IXDH4GL5.js → chunk-WVTPZ6CM.js} +1 -1
  60. package/dist/standalone/{chunk-TXTJPS5F.js → chunk-XGPFWZPJ.js} +1 -1
  61. package/dist/standalone/{chunk-H27CRIP3.js → chunk-XPLUSBKA.js} +1 -1
  62. package/dist/standalone/{chunk-KKD46QVN.js → chunk-ZANX3V5B.js} +1 -1
  63. package/dist/standalone/{chunk-AYANIT5P.js → chunk-ZVLQVBTM.js} +1 -1
  64. package/dist/standalone/studio.js +1 -1
  65. package/dist/styles.css +1 -1
  66. package/package.json +3 -3
  67. package/dist/standalone/chunk-IRSIK3HT.js +0 -3
@@ -1 +1 @@
1
- import{a as Oe,b as Je}from"./chunk-HROXYAZT.js";import{a as Ke}from"./chunk-7YXOPTWI.js";import{a as qe}from"./chunk-AHILM3ZP.js";import{a as We}from"./chunk-J6J54MBP.js";import"./chunk-L7SK4ZZD.js";import{a as Ge}from"./chunk-2K47A3P6.js";import{a as De,b as Re,c as Pe,d as j,e as D,f as R}from"./chunk-GTM65MVX.js";import{a as V}from"./chunk-JSEXCW5Q.js";import"./chunk-4QHKBC77.js";import{R as B}from"./chunk-3CJW6NWG.js";import{c as U}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as Qe}from"./chunk-TAD43CG5.js";import{a as Ze}from"./chunk-HVRDZZHL.js";import{a as we,e as Ce}from"./chunk-SEU5V7I6.js";import{b as $}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as H}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as Y,h as ze,k as Ae,l as Ue,p as Fe}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as i,e as je,f as _e,g as et,h as tt}from"./chunk-RRCPZMC2.js";var k=je(_e(),1);var Q=je(et(),1);var t=je(tt(),1);var st=i(()=>{let u=(0,Q.c)(3),{config:e,ready:a}=Oe(),l;return u[0]!==e.capabilities||u[1]!==a?(l={capabilities:e.capabilities,ready:a},u[0]=e.capabilities,u[1]=a,u[2]=l):l=u[2],l},"useAuthCapabilities"),lt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},at=i((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"isFieldFilled"),it=i((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let a=typeof e=="string"?e.trim():"";if(a!==""){if(u.type==="number"){let l=Number(a);return Number.isNaN(l)?void 0:{value:l}}return{value:a}}},"coerceFieldValue"),ot=i(u=>{let e=(0,Q.c)(105),{onClose:a,onCreated:l}=u,c=H(),s=Y(),{config:r}=Oe(),{busy:o,error:n,run:f}=Je(),[w,S]=(0,k.useState)(""),[x,C]=(0,k.useState)(""),[y,F]=(0,k.useState)(""),[v,g]=(0,k.useState)(""),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let[h,d]=(0,k.useState)(p),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{S(m.target.value)},"t2"),e[1]=A):A=e[1];let b=A,I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=i(m=>{C(m.target.value)},"t3"),e[2]=I):I=e[2];let M=I,E;e[3]===Symbol.for("react.memo_cache_sentinel")?(E=i(m=>{F(m.target.value)},"t4"),e[3]=E):E=e[3];let Be=E,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=i(m=>{g(m.target.value)},"t5"),e[4]=Z):Z=e[4];let $e=Z,G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=i((m,P)=>{d(q=>({...q,[m]:P}))},"t6"),e[5]=G):G=e[5];let Ee=G,W;e[6]!==h?(W=i(m=>h[m.name]??(m.type==="boolean"?!1:""),"t7"),e[6]=h,e[7]=W):W=e[7];let T=W,J;if(e[8]!==r.userFields||e[9]!==T){let m;e[11]!==T?(m=i(P=>!P.required||at(P,T(P)),"t92"),e[11]=T,e[12]=m):m=e[12],J=r.userFields.every(m),e[8]=r.userFields,e[9]=T,e[10]=J}else J=e[10];let Ie=J,K;e[13]!==o||e[14]!==w||e[15]!==x||e[16]!==Ie?(K=!o&&w.trim()!==""&&x.trim()!==""&&Ie,e[13]=o,e[14]=w,e[15]=x,e[16]=Ie,e[17]=K):K=e[17];let Ve=K,X;e[18]!==r.userFields||e[19]!==T?(X=i(()=>{let m={};for(let P of r.userFields){let q=it(P,T(P));q!==void 0&&(m[P.name]=q.value)}return Object.keys(m).length===0?void 0:m},"t10"),e[18]=r.userFields,e[19]=T,e[20]=X):X=e[20];let Se=X,_;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==x||e[25]!==a||e[26]!==l||e[27]!==y||e[28]!==v||e[29]!==f?(_=i(()=>{f(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:x.trim(),password:y===""?void 0:y,role:v.trim()===""?void 0:v.trim()}),l(),a()})},"t11"),e[21]=Se,e[22]=c,e[23]=w,e[24]=x,e[25]=a,e[26]=l,e[27]=y,e[28]=v,e[29]=f,e[30]=_):_=e[30];let N=_,z;e[31]!==s?(z=s("Create user"),e[31]=s,e[32]=z):z=e[32];let L;e[33]!==s?(L=s("Create user"),e[33]=s,e[34]=L):L=e[34];let O;e[35]!==L?(O=(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:L},void 0,!1),e[35]=L,e[36]=O):O=e[36];let ee;e[37]!==s?(ee=s("email"),e[37]=s,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsxDEV)(V,{htmlFor:"uc-email",children:ee},void 0,!1),e[39]=ee,e[40]=te):te=e[40];let se;e[41]!==w?(se=(0,t.jsxDEV)(B,{"data-testid":"uc-email",id:"uc-email",onChange:b,type:"email",value:w},void 0,!1),e[41]=w,e[42]=se):se=e[42];let le;e[43]!==te||e[44]!==se?(le=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[te,se]},void 0,!0),e[43]=te,e[44]=se,e[45]=le):le=e[45];let ae;e[46]!==s?(ae=s("name"),e[46]=s,e[47]=ae):ae=e[47];let ie;e[48]!==ae?(ie=(0,t.jsxDEV)(V,{htmlFor:"uc-name",children:ae},void 0,!1),e[48]=ae,e[49]=ie):ie=e[49];let oe;e[50]!==x?(oe=(0,t.jsxDEV)(B,{"data-testid":"uc-name",id:"uc-name",onChange:M,value:x},void 0,!1),e[50]=x,e[51]=oe):oe=e[51];let ne;e[52]!==ie||e[53]!==oe?(ne=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ie,oe]},void 0,!0),e[52]=ie,e[53]=oe,e[54]=ne):ne=e[54];let de;e[55]!==s?(de=s("Password (optional)"),e[55]=s,e[56]=de):de=e[56];let re;e[57]!==de?(re=(0,t.jsxDEV)(V,{htmlFor:"uc-password",children:de},void 0,!1),e[57]=de,e[58]=re):re=e[58];let ce;e[59]!==y?(ce=(0,t.jsxDEV)(B,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:y},void 0,!1),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==re||e[62]!==ce?(ue=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[re,ce]},void 0,!0),e[61]=re,e[62]=ce,e[63]=ue):ue=e[63];let fe;e[64]!==s?(fe=s("Role (optional)"),e[64]=s,e[65]=fe):fe=e[65];let ve;e[66]!==fe?(ve=(0,t.jsxDEV)(V,{htmlFor:"uc-role",children:fe},void 0,!1),e[66]=fe,e[67]=ve):ve=e[67];let me;e[68]!==v?(me=(0,t.jsxDEV)(B,{"data-testid":"uc-role",id:"uc-role",onChange:$e,value:v},void 0,!1),e[68]=v,e[69]=me):me=e[69];let he;e[70]!==ve||e[71]!==me?(he=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ve,me]},void 0,!0),e[70]=ve,e[71]=me,e[72]=he):he=e[72];let pe;e[73]!==r.userFields||e[74]!==T||e[75]!==s?(pe=r.userFields.length>0&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")},void 0,!1),r.userFields.map(m=>{let P=`uc-field-${m.name}`,q=m.required?"":` (${s("optional")})`;if(m.type==="boolean"){let Le=T(m)===!0;return(0,t.jsxDEV)("label",{className:"flex items-center gap-2",htmlFor:P,children:[(0,t.jsxDEV)(Ke,{checked:Le,"data-testid":P,id:P,onCheckedChange:i(Xe=>{Ee(m.name,Xe)},"onCheckedChange")},void 0,!1),(0,t.jsxDEV)("span",{className:"text-sm",children:[m.name,q]},void 0,!0)]},m.name,!0)}let Ye=T(m);return(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:P,children:[m.name,q]},void 0,!0),(0,t.jsxDEV)(B,{"data-testid":P,id:P,onChange:i(Le=>{Ee(m.name,Le.target.value)},"onChange"),type:lt[m.type],value:typeof Ye=="string"?Ye:""},void 0,!1)]},m.name,!0)})]},void 0,!0),e[73]=r.userFields,e[74]=T,e[75]=s,e[76]=pe):pe=e[76];let be;e[77]!==n?(be=n!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n},void 0,!1),e[77]=n,e[78]=be):be=e[78];let xe;e[79]!==s?(xe=s("Cancel"),e[79]=s,e[80]=xe):xe=e[80];let ye;e[81]!==a||e[82]!==xe?(ye=(0,t.jsxDEV)(U,{"data-testid":"uc-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:xe},void 0,!1),e[81]=a,e[82]=xe,e[83]=ye):ye=e[83];let Me=!Ve,ge;e[84]!==o||e[85]!==s?(ge=s(o?"Creating\u2026":"Create"),e[84]=o,e[85]=s,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Me||e[89]!==ge?(Ne=(0,t.jsxDEV)(U,{"data-testid":"uc-submit",disabled:Me,onClick:N,size:"sm",type:"button",children:ge},void 0,!1),e[87]=N,e[88]=Me,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]},void 0,!0),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Te;return e[94]!==a||e[95]!==z||e[96]!==O||e[97]!==le||e[98]!==ne||e[99]!==ue||e[100]!==he||e[101]!==pe||e[102]!==be||e[103]!==ke?(Te=(0,t.jsxDEV)(qe,{label:z,onClose:a,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[O,le,ne,ue,he,pe,be,ke]},void 0,!0),e[94]=a,e[95]=z,e[96]=O,e[97]=le,e[98]=ne,e[99]=ue,e[100]=he,e[101]=pe,e[102]=be,e[103]=ke,e[104]=Te):Te=e[104],Te},"UserCreateDialog"),He=i(u=>{let e=(0,Q.c)(2),{children:a}=u,l;return e[0]!==a?(l=(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a},void 0,!1),e[0]=a,e[1]=l):l=e[1],l},"SectionHeading"),nt=i(u=>{let e=(0,Q.c)(29),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{let b=await r.listAuthSessions({limit:50,userId:c});f(b.rows)}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l?(y=i(b=>{l(()=>r.revokeAuthSession({sessionId:b}))},"t3"),e[7]=r,e[8]=l,e[9]=y):y=e[9];let F=y,v;e[10]!==o?(v=o("Sessions"),e[10]=o,e[11]=v):v=e[11];let g;e[12]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[12]=v,e[13]=g):g=e[13];let p;e[14]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w},void 0,!1),e[14]=w,e[15]=p):p=e[15];let h;e[16]!==n||e[17]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:o("No active sessions.")},void 0,!1),e[16]=n,e[17]=o,e[18]=h):h=e[18];let d;e[19]!==a||e[20]!==F||e[21]!==n||e[22]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-sessions-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("expires")},void 0,!1),(0,t.jsxDEV)(D,{children:o("ip")},void 0,!1),(0,t.jsxDEV)(D,{children:o("user agent")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>(0,t.jsxDEV)(j,{"data-testid":`ud-session-${b.id}`,children:[(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.expiresAt)},void 0,!1),(0,t.jsxDEV)(R,{children:b.ipAddress??""},void 0,!1),(0,t.jsxDEV)(R,{className:"max-w-40 truncate",children:b.userAgent??""},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-revoke-${b.id}`,disabled:a,onClick:i(()=>{F(b.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Revoke")},void 0,!1)},void 0,!1)]},b.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=a,e[20]=F,e[21]=n,e[22]=o,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==p||e[26]!==h||e[27]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,p,h,d]},void 0,!0),e[24]=g,e[25]=p,e[26]=h,e[27]=d,e[28]=A):A=e[28],A},"UserSessionsPanel"),dt=i(u=>{let e=(0,Q.c)(30),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{f(await r.listAuthAccounts({userId:c}))}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l||e[9]!==c?(y=i(b=>{l(()=>r.unlinkAuthAccount({accountId:b,userId:c}))},"t3"),e[7]=r,e[8]=l,e[9]=c,e[10]=y):y=e[10];let F=y,v;e[11]!==o?(v=o("Linked accounts"),e[11]=o,e[12]=v):v=e[12];let g;e[13]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[13]=v,e[14]=g):g=e[14];let p;e[15]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:w},void 0,!1),e[15]=w,e[16]=p):p=e[16];let h;e[17]!==n||e[18]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o("No linked accounts.")},void 0,!1),e[17]=n,e[18]=o,e[19]=h):h=e[19];let d;e[20]!==n||e[21]!==a||e[22]!==F||e[23]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-accounts-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("provider")},void 0,!1),(0,t.jsxDEV)(D,{children:o("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>{let I=Ae(b.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-account-${I}`,children:[(0,t.jsxDEV)(R,{children:Ae(b.providerId)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-unlink-${I}`,disabled:a,onClick:i(()=>{F(I)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Unlink")},void 0,!1)},void 0,!1)]},I,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=n,e[21]=a,e[22]=F,e[23]=o,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==p||e[27]!==h||e[28]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,p,h,d]},void 0,!0),e[25]=g,e[26]=p,e[27]=h,e[28]=d,e[29]=A):A=e[29],A},"UserAccountsPanel"),rt=i(u=>{let e=(0,Q.c)(40),{busy:a,capabilities:l,runAction:c,userId:s,version:r}=u,o=H(),n=Y(),[f,w]=(0,k.useState)(null),S;e[0]!==l.passkey||e[1]!==o||e[2]!==s?(S=i(()=>{l.passkey&&Ue((async()=>{try{w(await o.listAuthPasskeys({userId:s}))}catch{w(null)}})())},"t1"),e[0]=l.passkey,e[1]=o,e[2]=s,e[3]=S):S=e[3];let x;e[4]!==l.passkey||e[5]!==o||e[6]!==s||e[7]!==r?(x=[l.passkey,o,s,r],e[4]=l.passkey,e[5]=o,e[6]=s,e[7]=r,e[8]=x):x=e[8],(0,k.useEffect)(S,x);let C;e[9]!==o||e[10]!==c||e[11]!==s?(C=i(()=>{c(()=>o.disableAuthTwoFactor({userId:s}))},"t3"),e[9]=o,e[10]=c,e[11]=s,e[12]=C):C=e[12];let y=C,F;e[13]!==o||e[14]!==c?(F=i(I=>{c(()=>o.deleteAuthPasskey({passkeyId:I}))},"t4"),e[13]=o,e[14]=c,e[15]=F):F=e[15];let v=F,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let p;e[18]!==g?(p=(0,t.jsxDEV)(He,{children:g},void 0,!1),e[18]=g,e[19]=p):p=e[19];let h;e[20]!==a||e[21]!==l.twoFactor||e[22]!==y||e[23]!==n?(h=l.twoFactor&&(0,t.jsxDEV)(U,{"data-testid":"ud-disable-2fa",disabled:a,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")},void 0,!1),e[20]=a,e[21]=l.twoFactor,e[22]=y,e[23]=n,e[24]=h):h=e[24];let d;e[25]!==l.passkey||e[26]!==f||e[27]!==n?(d=l.passkey&&f!==null&&f.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")},void 0,!1),e[25]=l.passkey,e[26]=f,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==a||e[30]!==l.passkey||e[31]!==v||e[32]!==f||e[33]!==n?(A=l.passkey&&f!==null&&f.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-passkeys-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:n("name")},void 0,!1),(0,t.jsxDEV)(D,{children:n("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":n("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:f.map(I=>{let M=Ae(I.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-passkey-${M}`,children:[(0,t.jsxDEV)(R,{children:Ae(I.name)||M},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(I.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-delete-passkey-${M}`,disabled:a,onClick:i(()=>{v(M)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")},void 0,!1)},void 0,!1)]},M,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=a,e[30]=l.passkey,e[31]=v,e[32]=f,e[33]=n,e[34]=A):A=e[34];let b;return e[35]!==p||e[36]!==h||e[37]!==d||e[38]!==A?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[p,h,d,A]},void 0,!0),e[35]=p,e[36]=h,e[37]=d,e[38]=A,e[39]=b):b=e[39],b},"UserSecurityPanel"),ct=/(?:at|expires)$/iu,ut=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ft=i((u,e)=>typeof e=="number"&&ct.test(u)?Fe(e):Ae(e),"formatField"),vt=i(({capabilities:u,onChanged:e,onClose:a,user:l})=>{let c=H(),s=Y(),r=l.banned===!0,[o,n]=(0,k.useState)(null),[f,w]=(0,k.useState)(!1),[S,x]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof l.role=="string"?l.role:""),[F,v]=(0,k.useState)(""),[g,p]=(0,k.useState)(""),[h,d]=(0,k.useState)(""),[A,b]=(0,k.useState)(null),[I,M]=(0,k.useState)(!1),E=i((N,z)=>{Ue((async()=>{w(!0),n(null);try{let L=await N();z?.refresh!==!1&&(x(O=>O+1),e()),z?.onResult?.(L)}catch(L){n(ze(L))}finally{w(!1)}})())},"runAction"),Be=i(N=>{y(N.target.value)},"onRoleInputChange"),Z=i(N=>{v(N.target.value)},"onBanReasonChange"),$e=i(N=>{p(N.target.value)},"onBanDaysChange"),G=i(N=>{d(N.target.value)},"onNewPasswordChange"),Ee=i(()=>{let N=C.trim();N!==""&&E(async()=>{await c.setAuthUserRole({role:N,userId:l.id})})},"onSetRole"),W=i(()=>{let N=Number.parseInt(g,10),z=Number.isFinite(N)&&N>0?N*86400:void 0;E(async()=>{await c.banAuthUser({expiresInSeconds:z,reason:F.trim()===""?void 0:F.trim(),userId:l.id})})},"onBan"),T=i(()=>{E(async()=>{await c.unbanAuthUser({userId:l.id})})},"onUnban"),J=i(()=>{E(async()=>{await c.setAuthUserPassword({newPassword:h,userId:l.id}),d("")})},"onSetPassword"),Ie=i(()=>{E(()=>c.impersonateAuthUser({userId:l.id}),{onResult:i(N=>{b(N.token)},"onResult"),refresh:!1})},"onImpersonate"),K=i(()=>{E(async()=>{await c.revokeAuthUserSessions({userId:l.id})})},"onRevokeAll"),Ve=i(()=>{E(async()=>{await c.removeAuthUser({userId:l.id}),a()})},"onDelete"),X=i(()=>{M(!0)},"onConfirmDelete"),Se=i(()=>{M(!1)},"onCancelDelete"),_=Object.entries(l).filter(([N])=>!ut.has(N));return(0,t.jsxDEV)(qe,{label:s("User details"),onClose:a,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id},void 0,!1),(0,t.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsxDEV)($,{variant:"secondary",children:l.role},void 0,!1),r?(0,t.jsxDEV)($,{variant:"destructive",children:s("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("Active")},void 0,!1),l.emailVerified===!0?(0,t.jsxDEV)($,{variant:"secondary",children:s("verified")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-close",onClick:a,size:"sm",type:"button",variant:"ghost",children:s("Close")},void 0,!1)]},void 0,!0),o!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:o},void 0,!1),u.admin&&(0,t.jsxDEV)(we,{className:"gap-0 py-0",children:[(0,t.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-role",children:s("Role")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:C},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-role",disabled:f||C.trim()==="",onClick:Ee,size:"sm",type:"button",variant:"outline",children:s("Set role")},void 0,!1)]},void 0,!0),r?(0,t.jsxDEV)(U,{"data-testid":"ud-unban",disabled:f,onClick:T,size:"sm",type:"button",variant:"outline",children:s("Unban")},void 0,!1):(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:F},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-days",children:s("Days")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:$e,type:"number",value:g},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-ban",disabled:f,onClick:W,size:"sm",type:"button",variant:"destructive",children:s("Ban user")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-password",children:s("New password")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-password",id:"ud-password",onChange:G,type:"password",value:h},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-password",disabled:f||h==="",onClick:J,size:"sm",type:"button",variant:"outline",children:s("Set password")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxDEV)(U,{"data-testid":"ud-impersonate",disabled:f,onClick:Ie,size:"sm",type:"button",variant:"outline",children:s("Impersonate")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-revoke-all",disabled:f,onClick:K,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")},void 0,!1),I?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(U,{"data-testid":"ud-delete-confirm",disabled:f,onClick:Ve,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:s("Cancel")},void 0,!1)]},void 0,!0):(0,t.jsxDEV)(U,{"data-testid":"ud-delete",disabled:f,onClick:X,size:"sm",type:"button",variant:"destructive",children:s("Delete user")},void 0,!1)]},void 0,!0),A!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-token",children:s("Impersonation token")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(nt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),u.accounts&&(0,t.jsxDEV)(dt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),(u.twoFactor||u.passkey)&&(0,t.jsxDEV)(rt,{busy:f,capabilities:u,runAction:E,userId:l.id,version:S},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")},void 0,!1),(0,t.jsxDEV)("dl",{className:"flex flex-col",children:_.map(([N,z])=>(0,t.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N},void 0,!1),(0,t.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:ft(N,z)},void 0,!1)]},N,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),mt=50,Rt=i(({pageSize:u=mt}={})=>{let e=H(),a=Y(),[l,c]=(0,k.useState)(""),[s,r]=(0,k.useState)(""),o=Ge(l),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:x}=st(),C=o.trim(),y=s.trim(),F=Ze(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),v=F.data?.rows??null,g=F.error,p=i(()=>{F.refetch()},"reloadUsers");We(()=>{F.refetch()},!0);let h=n===null?null:v?.find(d=>d.id===n)??null;return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(B,{"aria-label":a("Search users"),className:"w-56","data-testid":"us-search",onChange:i(d=>{c(d.target.value)},"onChange"),placeholder:a("Search by email or name\u2026"),value:l},void 0,!1),(0,t.jsxDEV)(B,{"aria-label":a("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:i(d=>{r(d.target.value)},"onChange"),placeholder:a("Filter by role"),value:s},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"us-new",onClick:i(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:a("New user")},void 0,!1)]},void 0,!0),g!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g},void 0,!1),v!==null&&v.length===0&&(0,t.jsxDEV)(Qe,{description:a("Users who sign up to your app will appear here."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:a("No users.")},void 0,!1),v!==null&&v.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"us-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:a("id")},void 0,!1),(0,t.jsxDEV)(D,{children:a("email")},void 0,!1),(0,t.jsxDEV)(D,{children:a("name")},void 0,!1),(0,t.jsxDEV)(D,{children:a("role")},void 0,!1),(0,t.jsxDEV)(D,{children:a("status")},void 0,!1),(0,t.jsxDEV)(D,{children:a("verified")},void 0,!1),(0,t.jsxDEV)(D,{children:a("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":a("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:v.map(d=>(0,t.jsxDEV)(j,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsxDEV)(R,{className:"font-mono text-xs",children:d.id},void 0,!1),(0,t.jsxDEV)(R,{children:d.email??""},void 0,!1),(0,t.jsxDEV)(R,{children:d.name??""},void 0,!1),(0,t.jsxDEV)(R,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsxDEV)($,{variant:"secondary",children:d.role},void 0,!1):""},void 0,!1),(0,t.jsxDEV)(R,{children:d.banned===!0?(0,t.jsxDEV)($,{variant:"destructive",children:a("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"success",children:a("Active")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{children:d.emailVerified===!0?(0,t.jsxDEV)($,{variant:"success",children:a("yes")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:a("no")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(d.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`us-manage-${d.id}`,onClick:i(()=>{f(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Manage")},void 0,!1)},void 0,!1)]},d.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),h!==null&&(0,t.jsxDEV)(vt,{capabilities:x,onChanged:p,onClose:i(()=>{f(null)},"onClose"),user:h},void 0,!1),w&&(0,t.jsxDEV)(ot,{onClose:i(()=>{S(!1)},"onClose"),onCreated:p},void 0,!1)]},void 0,!0)},"UsersPanel");export{Rt as UsersPanel};
1
+ import{a as Oe,b as Je}from"./chunk-BGG56IF5.js";import{a as Ke}from"./chunk-3GXGLNKW.js";import{a as qe}from"./chunk-AHILM3ZP.js";import{a as We}from"./chunk-J6J54MBP.js";import"./chunk-L7SK4ZZD.js";import{a as Ge}from"./chunk-2K47A3P6.js";import{a as Ze}from"./chunk-W666BB6V.js";import{a as De,b as Re,c as Pe,d as j,e as D,f as R}from"./chunk-GTM65MVX.js";import{a as we,e as Ce}from"./chunk-SEU5V7I6.js";import{a as V}from"./chunk-JSEXCW5Q.js";import"./chunk-4QHKBC77.js";import{R as B}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as U}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as $}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as H}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as Qe}from"./chunk-TAD43CG5.js";import{d as Y,h as ze,k as Ae,l as Ue,p as Fe}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as i,e as je,f as _e,g as et,h as tt}from"./chunk-RRCPZMC2.js";var k=je(_e(),1);var Q=je(et(),1);var t=je(tt(),1);var st=i(()=>{let u=(0,Q.c)(3),{config:e,ready:a}=Oe(),l;return u[0]!==e.capabilities||u[1]!==a?(l={capabilities:e.capabilities,ready:a},u[0]=e.capabilities,u[1]=a,u[2]=l):l=u[2],l},"useAuthCapabilities"),lt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},at=i((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"isFieldFilled"),it=i((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let a=typeof e=="string"?e.trim():"";if(a!==""){if(u.type==="number"){let l=Number(a);return Number.isNaN(l)?void 0:{value:l}}return{value:a}}},"coerceFieldValue"),ot=i(u=>{let e=(0,Q.c)(105),{onClose:a,onCreated:l}=u,c=H(),s=Y(),{config:r}=Oe(),{busy:o,error:n,run:f}=Je(),[w,S]=(0,k.useState)(""),[x,C]=(0,k.useState)(""),[y,F]=(0,k.useState)(""),[v,g]=(0,k.useState)(""),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let[h,d]=(0,k.useState)(p),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{S(m.target.value)},"t2"),e[1]=A):A=e[1];let b=A,I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=i(m=>{C(m.target.value)},"t3"),e[2]=I):I=e[2];let M=I,E;e[3]===Symbol.for("react.memo_cache_sentinel")?(E=i(m=>{F(m.target.value)},"t4"),e[3]=E):E=e[3];let Be=E,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=i(m=>{g(m.target.value)},"t5"),e[4]=Z):Z=e[4];let $e=Z,G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=i((m,P)=>{d(q=>({...q,[m]:P}))},"t6"),e[5]=G):G=e[5];let Ee=G,W;e[6]!==h?(W=i(m=>h[m.name]??(m.type==="boolean"?!1:""),"t7"),e[6]=h,e[7]=W):W=e[7];let T=W,J;if(e[8]!==r.userFields||e[9]!==T){let m;e[11]!==T?(m=i(P=>!P.required||at(P,T(P)),"t92"),e[11]=T,e[12]=m):m=e[12],J=r.userFields.every(m),e[8]=r.userFields,e[9]=T,e[10]=J}else J=e[10];let Ie=J,K;e[13]!==o||e[14]!==w||e[15]!==x||e[16]!==Ie?(K=!o&&w.trim()!==""&&x.trim()!==""&&Ie,e[13]=o,e[14]=w,e[15]=x,e[16]=Ie,e[17]=K):K=e[17];let Ve=K,X;e[18]!==r.userFields||e[19]!==T?(X=i(()=>{let m={};for(let P of r.userFields){let q=it(P,T(P));q!==void 0&&(m[P.name]=q.value)}return Object.keys(m).length===0?void 0:m},"t10"),e[18]=r.userFields,e[19]=T,e[20]=X):X=e[20];let Se=X,_;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==x||e[25]!==a||e[26]!==l||e[27]!==y||e[28]!==v||e[29]!==f?(_=i(()=>{f(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:x.trim(),password:y===""?void 0:y,role:v.trim()===""?void 0:v.trim()}),l(),a()})},"t11"),e[21]=Se,e[22]=c,e[23]=w,e[24]=x,e[25]=a,e[26]=l,e[27]=y,e[28]=v,e[29]=f,e[30]=_):_=e[30];let N=_,z;e[31]!==s?(z=s("Create user"),e[31]=s,e[32]=z):z=e[32];let L;e[33]!==s?(L=s("Create user"),e[33]=s,e[34]=L):L=e[34];let O;e[35]!==L?(O=(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:L},void 0,!1),e[35]=L,e[36]=O):O=e[36];let ee;e[37]!==s?(ee=s("email"),e[37]=s,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsxDEV)(V,{htmlFor:"uc-email",children:ee},void 0,!1),e[39]=ee,e[40]=te):te=e[40];let se;e[41]!==w?(se=(0,t.jsxDEV)(B,{"data-testid":"uc-email",id:"uc-email",onChange:b,type:"email",value:w},void 0,!1),e[41]=w,e[42]=se):se=e[42];let le;e[43]!==te||e[44]!==se?(le=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[te,se]},void 0,!0),e[43]=te,e[44]=se,e[45]=le):le=e[45];let ae;e[46]!==s?(ae=s("name"),e[46]=s,e[47]=ae):ae=e[47];let ie;e[48]!==ae?(ie=(0,t.jsxDEV)(V,{htmlFor:"uc-name",children:ae},void 0,!1),e[48]=ae,e[49]=ie):ie=e[49];let oe;e[50]!==x?(oe=(0,t.jsxDEV)(B,{"data-testid":"uc-name",id:"uc-name",onChange:M,value:x},void 0,!1),e[50]=x,e[51]=oe):oe=e[51];let ne;e[52]!==ie||e[53]!==oe?(ne=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ie,oe]},void 0,!0),e[52]=ie,e[53]=oe,e[54]=ne):ne=e[54];let de;e[55]!==s?(de=s("Password (optional)"),e[55]=s,e[56]=de):de=e[56];let re;e[57]!==de?(re=(0,t.jsxDEV)(V,{htmlFor:"uc-password",children:de},void 0,!1),e[57]=de,e[58]=re):re=e[58];let ce;e[59]!==y?(ce=(0,t.jsxDEV)(B,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:y},void 0,!1),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==re||e[62]!==ce?(ue=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[re,ce]},void 0,!0),e[61]=re,e[62]=ce,e[63]=ue):ue=e[63];let fe;e[64]!==s?(fe=s("Role (optional)"),e[64]=s,e[65]=fe):fe=e[65];let ve;e[66]!==fe?(ve=(0,t.jsxDEV)(V,{htmlFor:"uc-role",children:fe},void 0,!1),e[66]=fe,e[67]=ve):ve=e[67];let me;e[68]!==v?(me=(0,t.jsxDEV)(B,{"data-testid":"uc-role",id:"uc-role",onChange:$e,value:v},void 0,!1),e[68]=v,e[69]=me):me=e[69];let he;e[70]!==ve||e[71]!==me?(he=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ve,me]},void 0,!0),e[70]=ve,e[71]=me,e[72]=he):he=e[72];let pe;e[73]!==r.userFields||e[74]!==T||e[75]!==s?(pe=r.userFields.length>0&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")},void 0,!1),r.userFields.map(m=>{let P=`uc-field-${m.name}`,q=m.required?"":` (${s("optional")})`;if(m.type==="boolean"){let Le=T(m)===!0;return(0,t.jsxDEV)("label",{className:"flex items-center gap-2",htmlFor:P,children:[(0,t.jsxDEV)(Ke,{checked:Le,"data-testid":P,id:P,onCheckedChange:i(Xe=>{Ee(m.name,Xe)},"onCheckedChange")},void 0,!1),(0,t.jsxDEV)("span",{className:"text-sm",children:[m.name,q]},void 0,!0)]},m.name,!0)}let Ye=T(m);return(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:P,children:[m.name,q]},void 0,!0),(0,t.jsxDEV)(B,{"data-testid":P,id:P,onChange:i(Le=>{Ee(m.name,Le.target.value)},"onChange"),type:lt[m.type],value:typeof Ye=="string"?Ye:""},void 0,!1)]},m.name,!0)})]},void 0,!0),e[73]=r.userFields,e[74]=T,e[75]=s,e[76]=pe):pe=e[76];let be;e[77]!==n?(be=n!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n},void 0,!1),e[77]=n,e[78]=be):be=e[78];let xe;e[79]!==s?(xe=s("Cancel"),e[79]=s,e[80]=xe):xe=e[80];let ye;e[81]!==a||e[82]!==xe?(ye=(0,t.jsxDEV)(U,{"data-testid":"uc-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:xe},void 0,!1),e[81]=a,e[82]=xe,e[83]=ye):ye=e[83];let Me=!Ve,ge;e[84]!==o||e[85]!==s?(ge=s(o?"Creating\u2026":"Create"),e[84]=o,e[85]=s,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Me||e[89]!==ge?(Ne=(0,t.jsxDEV)(U,{"data-testid":"uc-submit",disabled:Me,onClick:N,size:"sm",type:"button",children:ge},void 0,!1),e[87]=N,e[88]=Me,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]},void 0,!0),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Te;return e[94]!==a||e[95]!==z||e[96]!==O||e[97]!==le||e[98]!==ne||e[99]!==ue||e[100]!==he||e[101]!==pe||e[102]!==be||e[103]!==ke?(Te=(0,t.jsxDEV)(qe,{label:z,onClose:a,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[O,le,ne,ue,he,pe,be,ke]},void 0,!0),e[94]=a,e[95]=z,e[96]=O,e[97]=le,e[98]=ne,e[99]=ue,e[100]=he,e[101]=pe,e[102]=be,e[103]=ke,e[104]=Te):Te=e[104],Te},"UserCreateDialog"),He=i(u=>{let e=(0,Q.c)(2),{children:a}=u,l;return e[0]!==a?(l=(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a},void 0,!1),e[0]=a,e[1]=l):l=e[1],l},"SectionHeading"),nt=i(u=>{let e=(0,Q.c)(29),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{let b=await r.listAuthSessions({limit:50,userId:c});f(b.rows)}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l?(y=i(b=>{l(()=>r.revokeAuthSession({sessionId:b}))},"t3"),e[7]=r,e[8]=l,e[9]=y):y=e[9];let F=y,v;e[10]!==o?(v=o("Sessions"),e[10]=o,e[11]=v):v=e[11];let g;e[12]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[12]=v,e[13]=g):g=e[13];let p;e[14]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w},void 0,!1),e[14]=w,e[15]=p):p=e[15];let h;e[16]!==n||e[17]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:o("No active sessions.")},void 0,!1),e[16]=n,e[17]=o,e[18]=h):h=e[18];let d;e[19]!==a||e[20]!==F||e[21]!==n||e[22]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-sessions-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("expires")},void 0,!1),(0,t.jsxDEV)(D,{children:o("ip")},void 0,!1),(0,t.jsxDEV)(D,{children:o("user agent")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>(0,t.jsxDEV)(j,{"data-testid":`ud-session-${b.id}`,children:[(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.expiresAt)},void 0,!1),(0,t.jsxDEV)(R,{children:b.ipAddress??""},void 0,!1),(0,t.jsxDEV)(R,{className:"max-w-40 truncate",children:b.userAgent??""},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-revoke-${b.id}`,disabled:a,onClick:i(()=>{F(b.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Revoke")},void 0,!1)},void 0,!1)]},b.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=a,e[20]=F,e[21]=n,e[22]=o,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==p||e[26]!==h||e[27]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,p,h,d]},void 0,!0),e[24]=g,e[25]=p,e[26]=h,e[27]=d,e[28]=A):A=e[28],A},"UserSessionsPanel"),dt=i(u=>{let e=(0,Q.c)(30),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{f(await r.listAuthAccounts({userId:c}))}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l||e[9]!==c?(y=i(b=>{l(()=>r.unlinkAuthAccount({accountId:b,userId:c}))},"t3"),e[7]=r,e[8]=l,e[9]=c,e[10]=y):y=e[10];let F=y,v;e[11]!==o?(v=o("Linked accounts"),e[11]=o,e[12]=v):v=e[12];let g;e[13]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[13]=v,e[14]=g):g=e[14];let p;e[15]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:w},void 0,!1),e[15]=w,e[16]=p):p=e[16];let h;e[17]!==n||e[18]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o("No linked accounts.")},void 0,!1),e[17]=n,e[18]=o,e[19]=h):h=e[19];let d;e[20]!==n||e[21]!==a||e[22]!==F||e[23]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-accounts-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("provider")},void 0,!1),(0,t.jsxDEV)(D,{children:o("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>{let I=Ae(b.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-account-${I}`,children:[(0,t.jsxDEV)(R,{children:Ae(b.providerId)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-unlink-${I}`,disabled:a,onClick:i(()=>{F(I)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Unlink")},void 0,!1)},void 0,!1)]},I,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=n,e[21]=a,e[22]=F,e[23]=o,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==p||e[27]!==h||e[28]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,p,h,d]},void 0,!0),e[25]=g,e[26]=p,e[27]=h,e[28]=d,e[29]=A):A=e[29],A},"UserAccountsPanel"),rt=i(u=>{let e=(0,Q.c)(40),{busy:a,capabilities:l,runAction:c,userId:s,version:r}=u,o=H(),n=Y(),[f,w]=(0,k.useState)(null),S;e[0]!==l.passkey||e[1]!==o||e[2]!==s?(S=i(()=>{l.passkey&&Ue((async()=>{try{w(await o.listAuthPasskeys({userId:s}))}catch{w(null)}})())},"t1"),e[0]=l.passkey,e[1]=o,e[2]=s,e[3]=S):S=e[3];let x;e[4]!==l.passkey||e[5]!==o||e[6]!==s||e[7]!==r?(x=[l.passkey,o,s,r],e[4]=l.passkey,e[5]=o,e[6]=s,e[7]=r,e[8]=x):x=e[8],(0,k.useEffect)(S,x);let C;e[9]!==o||e[10]!==c||e[11]!==s?(C=i(()=>{c(()=>o.disableAuthTwoFactor({userId:s}))},"t3"),e[9]=o,e[10]=c,e[11]=s,e[12]=C):C=e[12];let y=C,F;e[13]!==o||e[14]!==c?(F=i(I=>{c(()=>o.deleteAuthPasskey({passkeyId:I}))},"t4"),e[13]=o,e[14]=c,e[15]=F):F=e[15];let v=F,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let p;e[18]!==g?(p=(0,t.jsxDEV)(He,{children:g},void 0,!1),e[18]=g,e[19]=p):p=e[19];let h;e[20]!==a||e[21]!==l.twoFactor||e[22]!==y||e[23]!==n?(h=l.twoFactor&&(0,t.jsxDEV)(U,{"data-testid":"ud-disable-2fa",disabled:a,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")},void 0,!1),e[20]=a,e[21]=l.twoFactor,e[22]=y,e[23]=n,e[24]=h):h=e[24];let d;e[25]!==l.passkey||e[26]!==f||e[27]!==n?(d=l.passkey&&f!==null&&f.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")},void 0,!1),e[25]=l.passkey,e[26]=f,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==a||e[30]!==l.passkey||e[31]!==v||e[32]!==f||e[33]!==n?(A=l.passkey&&f!==null&&f.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-passkeys-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:n("name")},void 0,!1),(0,t.jsxDEV)(D,{children:n("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":n("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:f.map(I=>{let M=Ae(I.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-passkey-${M}`,children:[(0,t.jsxDEV)(R,{children:Ae(I.name)||M},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(I.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-delete-passkey-${M}`,disabled:a,onClick:i(()=>{v(M)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")},void 0,!1)},void 0,!1)]},M,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=a,e[30]=l.passkey,e[31]=v,e[32]=f,e[33]=n,e[34]=A):A=e[34];let b;return e[35]!==p||e[36]!==h||e[37]!==d||e[38]!==A?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[p,h,d,A]},void 0,!0),e[35]=p,e[36]=h,e[37]=d,e[38]=A,e[39]=b):b=e[39],b},"UserSecurityPanel"),ct=/(?:at|expires)$/iu,ut=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ft=i((u,e)=>typeof e=="number"&&ct.test(u)?Fe(e):Ae(e),"formatField"),vt=i(({capabilities:u,onChanged:e,onClose:a,user:l})=>{let c=H(),s=Y(),r=l.banned===!0,[o,n]=(0,k.useState)(null),[f,w]=(0,k.useState)(!1),[S,x]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof l.role=="string"?l.role:""),[F,v]=(0,k.useState)(""),[g,p]=(0,k.useState)(""),[h,d]=(0,k.useState)(""),[A,b]=(0,k.useState)(null),[I,M]=(0,k.useState)(!1),E=i((N,z)=>{Ue((async()=>{w(!0),n(null);try{let L=await N();z?.refresh!==!1&&(x(O=>O+1),e()),z?.onResult?.(L)}catch(L){n(ze(L))}finally{w(!1)}})())},"runAction"),Be=i(N=>{y(N.target.value)},"onRoleInputChange"),Z=i(N=>{v(N.target.value)},"onBanReasonChange"),$e=i(N=>{p(N.target.value)},"onBanDaysChange"),G=i(N=>{d(N.target.value)},"onNewPasswordChange"),Ee=i(()=>{let N=C.trim();N!==""&&E(async()=>{await c.setAuthUserRole({role:N,userId:l.id})})},"onSetRole"),W=i(()=>{let N=Number.parseInt(g,10),z=Number.isFinite(N)&&N>0?N*86400:void 0;E(async()=>{await c.banAuthUser({expiresInSeconds:z,reason:F.trim()===""?void 0:F.trim(),userId:l.id})})},"onBan"),T=i(()=>{E(async()=>{await c.unbanAuthUser({userId:l.id})})},"onUnban"),J=i(()=>{E(async()=>{await c.setAuthUserPassword({newPassword:h,userId:l.id}),d("")})},"onSetPassword"),Ie=i(()=>{E(()=>c.impersonateAuthUser({userId:l.id}),{onResult:i(N=>{b(N.token)},"onResult"),refresh:!1})},"onImpersonate"),K=i(()=>{E(async()=>{await c.revokeAuthUserSessions({userId:l.id})})},"onRevokeAll"),Ve=i(()=>{E(async()=>{await c.removeAuthUser({userId:l.id}),a()})},"onDelete"),X=i(()=>{M(!0)},"onConfirmDelete"),Se=i(()=>{M(!1)},"onCancelDelete"),_=Object.entries(l).filter(([N])=>!ut.has(N));return(0,t.jsxDEV)(qe,{label:s("User details"),onClose:a,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id},void 0,!1),(0,t.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsxDEV)($,{variant:"secondary",children:l.role},void 0,!1),r?(0,t.jsxDEV)($,{variant:"destructive",children:s("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("Active")},void 0,!1),l.emailVerified===!0?(0,t.jsxDEV)($,{variant:"secondary",children:s("verified")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-close",onClick:a,size:"sm",type:"button",variant:"ghost",children:s("Close")},void 0,!1)]},void 0,!0),o!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:o},void 0,!1),u.admin&&(0,t.jsxDEV)(we,{className:"gap-0 py-0",children:[(0,t.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-role",children:s("Role")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:C},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-role",disabled:f||C.trim()==="",onClick:Ee,size:"sm",type:"button",variant:"outline",children:s("Set role")},void 0,!1)]},void 0,!0),r?(0,t.jsxDEV)(U,{"data-testid":"ud-unban",disabled:f,onClick:T,size:"sm",type:"button",variant:"outline",children:s("Unban")},void 0,!1):(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:F},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-days",children:s("Days")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:$e,type:"number",value:g},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-ban",disabled:f,onClick:W,size:"sm",type:"button",variant:"destructive",children:s("Ban user")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-password",children:s("New password")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-password",id:"ud-password",onChange:G,type:"password",value:h},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-password",disabled:f||h==="",onClick:J,size:"sm",type:"button",variant:"outline",children:s("Set password")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxDEV)(U,{"data-testid":"ud-impersonate",disabled:f,onClick:Ie,size:"sm",type:"button",variant:"outline",children:s("Impersonate")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-revoke-all",disabled:f,onClick:K,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")},void 0,!1),I?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(U,{"data-testid":"ud-delete-confirm",disabled:f,onClick:Ve,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:s("Cancel")},void 0,!1)]},void 0,!0):(0,t.jsxDEV)(U,{"data-testid":"ud-delete",disabled:f,onClick:X,size:"sm",type:"button",variant:"destructive",children:s("Delete user")},void 0,!1)]},void 0,!0),A!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-token",children:s("Impersonation token")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(nt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),u.accounts&&(0,t.jsxDEV)(dt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),(u.twoFactor||u.passkey)&&(0,t.jsxDEV)(rt,{busy:f,capabilities:u,runAction:E,userId:l.id,version:S},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")},void 0,!1),(0,t.jsxDEV)("dl",{className:"flex flex-col",children:_.map(([N,z])=>(0,t.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N},void 0,!1),(0,t.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:ft(N,z)},void 0,!1)]},N,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),mt=50,Rt=i(({pageSize:u=mt}={})=>{let e=H(),a=Y(),[l,c]=(0,k.useState)(""),[s,r]=(0,k.useState)(""),o=Ge(l),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:x}=st(),C=o.trim(),y=s.trim(),F=Ze(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),v=F.data?.rows??null,g=F.error,p=i(()=>{F.refetch()},"reloadUsers");We(()=>{F.refetch()},!0);let h=n===null?null:v?.find(d=>d.id===n)??null;return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(B,{"aria-label":a("Search users"),className:"w-56","data-testid":"us-search",onChange:i(d=>{c(d.target.value)},"onChange"),placeholder:a("Search by email or name\u2026"),value:l},void 0,!1),(0,t.jsxDEV)(B,{"aria-label":a("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:i(d=>{r(d.target.value)},"onChange"),placeholder:a("Filter by role"),value:s},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"us-new",onClick:i(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:a("New user")},void 0,!1)]},void 0,!0),g!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g},void 0,!1),v!==null&&v.length===0&&(0,t.jsxDEV)(Qe,{description:a("Users who sign up to your app will appear here."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:a("No users.")},void 0,!1),v!==null&&v.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"us-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:a("id")},void 0,!1),(0,t.jsxDEV)(D,{children:a("email")},void 0,!1),(0,t.jsxDEV)(D,{children:a("name")},void 0,!1),(0,t.jsxDEV)(D,{children:a("role")},void 0,!1),(0,t.jsxDEV)(D,{children:a("status")},void 0,!1),(0,t.jsxDEV)(D,{children:a("verified")},void 0,!1),(0,t.jsxDEV)(D,{children:a("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":a("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:v.map(d=>(0,t.jsxDEV)(j,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsxDEV)(R,{className:"font-mono text-xs",children:d.id},void 0,!1),(0,t.jsxDEV)(R,{children:d.email??""},void 0,!1),(0,t.jsxDEV)(R,{children:d.name??""},void 0,!1),(0,t.jsxDEV)(R,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsxDEV)($,{variant:"secondary",children:d.role},void 0,!1):""},void 0,!1),(0,t.jsxDEV)(R,{children:d.banned===!0?(0,t.jsxDEV)($,{variant:"destructive",children:a("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"success",children:a("Active")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{children:d.emailVerified===!0?(0,t.jsxDEV)($,{variant:"success",children:a("yes")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:a("no")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(d.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`us-manage-${d.id}`,onClick:i(()=>{f(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Manage")},void 0,!1)},void 0,!1)]},d.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),h!==null&&(0,t.jsxDEV)(vt,{capabilities:x,onChanged:p,onClose:i(()=>{f(null)},"onClose"),user:h},void 0,!1),w&&(0,t.jsxDEV)(ot,{onClose:i(()=>{S(!1)},"onClose"),onCreated:p},void 0,!1)]},void 0,!0)},"UsersPanel");export{Rt as UsersPanel};
@@ -1 +1 @@
1
- import{a as w}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as S}from"./chunk-BOXSWNXZ.js";import{a as T}from"./chunk-TAD43CG5.js";import{b as k}from"./chunk-HVRDZZHL.js";import{a as N,e as R}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as p,e as x,g as O,h as B}from"./chunk-RRCPZMC2.js";var I=x(O(),1);var t=x(B(),1);var D=p((e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],"operationLabel"),E={delete:2,list:3,read:0,write:1},_=p(e=>[...e].toSorted((r,a)=>r.bucket.localeCompare(a.bucket)||E[r.on]-E[a.on]||(r.prefix??"").localeCompare(a.prefix??"")),"sortRules"),Q=p(()=>{let e=(0,I.c)(14),r=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:d,errorSource:i}=k(S.storageRules,a),h=l!==void 0,f;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==r){let g=_(Array.isArray(l?.rules)?l.rules:[]),m;e[7]!==d||e[8]!==i?(m=d!==null&&(0,t.jsxDEV)(w,{error:i,testId:"storage-rules-error"},void 0,!1),e[7]=d,e[8]=i,e[9]=m):m=e[9];let s;e[10]!==r?(s=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=s):s=e[11];let u;e[12]!==s?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s},void 0,!1),e[12]=s,e[13]=u):u=e[13],f=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[m,u,h&&g.length===0?(0,t.jsxDEV)(T,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")},void 0,!1):(0,t.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(R,{className:"px-0",children:(0,t.jsxDEV)(C,{"data-testid":"storage-rules-table",children:[(0,t.jsxDEV)($,{children:(0,t.jsxDEV)(v,{children:[(0,t.jsxDEV)(n,{children:r("Bucket")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Operation")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Key prefix")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(A,{children:g.map(o=>(0,t.jsxDEV)(v,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.bucket},void 0,!1),(0,t.jsxDEV)(c,{children:(0,t.jsxDEV)(y,{variant:"secondary",children:D(r,o.on)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.prefix??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("(whole bucket)")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:o.procedure},void 0,!1)]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=r,e[6]=f}else f=e[6];return f},"StorageRulesPanel");export{Q as StorageRulesPanel};
1
+ import{a as w}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as k}from"./chunk-W666BB6V.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as N,e as R}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as S}from"./chunk-BOXSWNXZ.js";import"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as T}from"./chunk-TAD43CG5.js";import{d as b}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as p,e as x,g as O,h as B}from"./chunk-RRCPZMC2.js";var I=x(O(),1);var t=x(B(),1);var D=p((e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],"operationLabel"),E={delete:2,list:3,read:0,write:1},_=p(e=>[...e].toSorted((r,a)=>r.bucket.localeCompare(a.bucket)||E[r.on]-E[a.on]||(r.prefix??"").localeCompare(a.prefix??"")),"sortRules"),Q=p(()=>{let e=(0,I.c)(14),r=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:d,errorSource:i}=k(S.storageRules,a),h=l!==void 0,f;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==r){let g=_(Array.isArray(l?.rules)?l.rules:[]),m;e[7]!==d||e[8]!==i?(m=d!==null&&(0,t.jsxDEV)(w,{error:i,testId:"storage-rules-error"},void 0,!1),e[7]=d,e[8]=i,e[9]=m):m=e[9];let s;e[10]!==r?(s=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=s):s=e[11];let u;e[12]!==s?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s},void 0,!1),e[12]=s,e[13]=u):u=e[13],f=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[m,u,h&&g.length===0?(0,t.jsxDEV)(T,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")},void 0,!1):(0,t.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(R,{className:"px-0",children:(0,t.jsxDEV)(C,{"data-testid":"storage-rules-table",children:[(0,t.jsxDEV)($,{children:(0,t.jsxDEV)(v,{children:[(0,t.jsxDEV)(n,{children:r("Bucket")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Operation")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Key prefix")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(A,{children:g.map(o=>(0,t.jsxDEV)(v,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.bucket},void 0,!1),(0,t.jsxDEV)(c,{children:(0,t.jsxDEV)(y,{variant:"secondary",children:D(r,o.on)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.prefix??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("(whole bucket)")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:o.procedure},void 0,!1)]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=r,e[6]=f}else f=e[6];return f},"StorageRulesPanel");export{Q as StorageRulesPanel};
@@ -1 +1 @@
1
- import{b as pe,c as fn,d as gn,e as xn}from"./chunk-QBAT52GB.js";import{a as Rn}from"./chunk-QAFAJBAW.js";import{a as $o,c as Ko,d as Qo,e as dn}from"./chunk-IXDH4GL5.js";import{A as To,D as U,E as wo,F as ko,I as _o,K as Do,L as Ao,O as Vo,P as Bo,Q as Fo,S as Lo,T as Uo,U as Go,V as Ho,W as jo,Y as Yo,_ as zo,aa as Jo,ba as at,ca as Wo,da as Xo,ea as ut,ha as qo,ia as Gt,ja as Ge,l as Ut,la as Zo,ma as en,n as Eo,na as on,o as Io,oa as nn,pa as rn,q as yo,qa as sn,r as nt,ra as an,s as rt,t as Po,ta as un,u as st,ua as cn,v as So,va as pn,w as No,x as Oo,y as it}from"./chunk-KSKXW5PX.js";import{b as tn}from"./chunk-5OIBXYZM.js";import{i as ln,k as mn}from"./chunk-4QHKBC77.js";import{C as Se,I as Fe,J as vo,K as Le,L as tt,M as ot,O as y,P as J,d as Ft,e as ee,h as We,i as Co,p as Lt}from"./chunk-3CJW6NWG.js";import{a as ct,b as Ue}from"./chunk-UK64ZSUW.js";import{a as me,b as xo,c as Be,i as Mo,q as ho,t as bo}from"./chunk-O3NAGRTR.js";import{a as he,c as go,d as et,f as Ro,h as Je,i as ce,j as E}from"./chunk-CKSHCYGC.js";import{a as Me}from"./chunk-3OA7PECS.js";import{a as n,d as Xn,e as f,f as C,g as qn,h as Qn,j as Ve}from"./chunk-RRCPZMC2.js";var ke=f(qn(),1),Oc=f(C(),1);var te={};Xn(te,{Arrow:()=>Ht,Backdrop:()=>jt,CheckboxItem:()=>$t,CheckboxItemIndicator:()=>Kt,Group:()=>zt,GroupLabel:()=>Jt,Handle:()=>Qe,Item:()=>Wt,LinkItem:()=>Xt,Popup:()=>qt,Portal:()=>Zt,Positioner:()=>eo,RadioGroup:()=>oo,RadioItem:()=>no,RadioItemIndicator:()=>ro,Root:()=>qe,Separator:()=>Rn,SubmenuRoot:()=>Vn,SubmenuTrigger:()=>po,Trigger:()=>uo,Viewport:()=>co,createHandle:()=>jn});var Mn=f(C(),1);var pt=f(C(),1);var dt=pt.createContext(void 0);dt.displayName="MenuPositionerContext";function W(t){let e=pt.useContext(dt);if(e===void 0&&!t)throw new Error("Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.");return e}n(W,"useMenuPositionerContext");var lt=f(C(),1);var mt=lt.createContext(void 0);mt.displayName="MenuRootContext";function O(t){let e=lt.useContext(mt);if(e===void 0&&!t)throw new Error("Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.");return e}n(O,"useMenuRootContext");var Ht=Mn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,...d}=e,{store:l}=O(),{arrowRef:r,side:m,align:R,arrowUncentered:g,arrowStyles:x}=W(),v={open:l.useState("open"),side:m,align:R,uncentered:g};return E("div",e,{ref:[r,o],stateAttributesMapping:Ge,state:v,props:{style:x,"aria-hidden":!0,...d}})},"MenuArrow"));Ht.displayName="MenuArrow";var bn=f(C(),1);var ft=f(C(),1);var hn=ft.createContext(void 0);hn.displayName="ContextMenuRootContext";function be(t=!0){let e=ft.useContext(hn);if(e===void 0&&!t)throw new Error("Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.");return e}n(be,"useContextMenuRootContext");var Zn={...Ge,...Fe},jt=bn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,...d}=e,{store:l}=O(),r=l.useState("open"),m=l.useState("mounted"),R=l.useState("transitionStatus"),g=l.useState("lastOpenChangeReason"),x=be(),M={open:r,transitionStatus:R};return E("div",e,{ref:x?.backdropRef?[o,x.backdropRef]:o,state:M,stateAttributesMapping:Zn,props:[{role:"presentation",hidden:!m,style:{pointerEvents:g===y.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},d]})},"MenuBackdrop"));jt.displayName="MenuBackdrop";var Mt=f(C(),1);var gt=f(C(),1);var Rt=gt.createContext(void 0);Rt.displayName="MenuCheckboxItemContext";function Cn(){let t=gt.useContext(Rt);if(t===void 0)throw new Error("Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.");return t}n(Cn,"useMenuCheckboxItemContext");var He=f(C(),1);var vn=f(C(),1);function xt(t){let{closeOnClick:e,highlighted:o,id:i,nodeId:u,store:a,typingRef:d,itemRef:l,itemMetadata:r}=t,{events:m}=a.useState("floatingTreeRoot"),R=a.useState("open"),g=be(!0),x=g!==void 0;return vn.useMemo(()=>({id:i,role:"menuitem",tabIndex:R&&o?0:-1,onKeyDown(M){M.key===" "&&d?.current&&M.preventDefault()},onMouseMove(M){u&&m.emit("itemhover",{nodeId:u,target:M.currentTarget})},onClick(M){e&&m.emit("close",{domEvent:M,reason:y.itemPress})},onMouseUp(M){if(g){let v=g.initialCursorPointRef.current;if(g.initialCursorPointRef.current=null,x&&v&&Math.abs(M.clientX-v.x)<=1&&Math.abs(M.clientY-v.y)<=1||x&&!Co.os.mac&&M.button===2)return}l.current&&a.context.allowMouseUpTriggerRef.current&&(!x||M.button===2)&&(!r||r.type==="regular-item")&&l.current.click()}}),[e,o,i,m,u,R,a,d,l,g,x,r])}n(xt,"useMenuItemCommonProps");var je={type:"regular-item"};function Ne(t){let{closeOnClick:e,disabled:o=!1,highlighted:i,id:u,store:a,typingRef:d=a.context.typingRef,nativeButton:l,itemMetadata:r,nodeId:m}=t,R=a.useState("disabled"),g=o||R,x=He.useRef(null),{getButtonProps:M,buttonRef:v}=Ue({disabled:g,focusableWhenDisabled:!0,native:l,composite:!0}),S=xt({closeOnClick:e,highlighted:i,id:u,nodeId:m,store:a,typingRef:d,itemRef:x,itemMetadata:r}),c=He.useCallback(b=>he(S,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()}},b,M),[S,M,r]),h=et(x,v);return He.useMemo(()=>({getItemProps:c,itemRef:h}),[c,h])}n(Ne,"useMenuItem");var Yt=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.disabled="data-disabled",t.highlighted="data-highlighted",t})({});var Oe={checked(t){return t?{[Yt.checked]:""}:{[Yt.unchecked]:""}},...Fe};var En=f(Me(),1);var $t=Mt.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,nativeButton:l=!1,disabled:r=!1,closeOnClick:m=!1,checked:R,defaultChecked:g,onCheckedChange:x,style:M,...v}=e,S=pe({label:d}),c=W(!0),h=ee(a),{store:b}=O(),p=b.useState("isActive",S.index),T=b.useState("itemProps"),[V,s]=ot({controlled:R,default:g??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:k,itemRef:P}=Ne({closeOnClick:m,disabled:r,highlighted:p,id:h,store:b,nativeButton:l,nodeId:c?.context.nodeId,itemMetadata:je}),H=Mt.useMemo(()=>({disabled:r,highlighted:p,checked:V}),[r,p,V]);function N(D){let F=J(y.itemPress,D.nativeEvent,void 0,{preventUnmountOnClose(){}});x?.(!V,F),!F.isCanceled&&s(Y=>!Y)}n(N,"handleClick");let _=E("div",e,{state:H,stateAttributesMapping:Oe,props:[T,{role:"menuitemcheckbox","aria-checked":V,onClick:N},v,k],ref:[P,o,S.ref]});return(0,En.jsx)(Rt.Provider,{value:H,children:_})},"MenuCheckboxItem"));$t.displayName="MenuCheckboxItem";var ht=f(C(),1);var Kt=ht.forwardRef(n(function(e,o){let{render:i,className:u,style:a,keepMounted:d=!1,...l}=e,r=Cn(),m=ht.useRef(null),{transitionStatus:R,setMounted:g}=tt(r.checked);Le({open:r.checked,ref:m,onComplete(){r.checked||g(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:R};return E("span",e,{state:x,ref:[o,m],stateAttributesMapping:Oe,props:{"aria-hidden":!0,...l},enabled:d||r.checked})},"MenuCheckboxItemIndicator"));Kt.displayName="MenuCheckboxItemIndicator";var Ct=f(C(),1);var bt=f(C(),1);var Ye=bt.createContext(void 0);Ye.displayName="MenuGroupContext";function In(){let t=bt.useContext(Ye);if(t===void 0)throw new Error("Base UI: MenuGroupContext is missing. Menu group parts must be used within <Menu.Group> or <Menu.RadioGroup>.");return t}n(In,"useMenuGroupRootContext");var yn=f(Me(),1);var zt=Ct.forwardRef(n(function(e,o){let{render:i,className:u,style:a,...d}=e,[l,r]=Ct.useState(void 0),m=E("div",e,{ref:o,props:{role:"group","aria-labelledby":l,...d}});return(0,yn.jsx)(Ye.Provider,{value:r,children:m})},"MenuGroup"));zt.displayName="MenuGroup";var Pn=f(C(),1);var Jt=Pn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,id:d,...l}=e,r=ee(d),m=In();return me(()=>(m(r),()=>{m(void 0)}),[m,r]),E("div",e,{ref:o,props:{id:r,role:"presentation",...l}})},"MenuGroupLabel"));Jt.displayName="MenuGroupLabel";var Sn=f(C(),1);var Wt=Sn.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,nativeButton:l=!1,disabled:r=!1,closeOnClick:m=!0,style:R,...g}=e,x=pe({label:d}),M=W(!0),v=ee(a),{store:S}=O(),c=S.useState("isActive",x.index),h=S.useState("itemProps"),{getItemProps:b,itemRef:p}=Ne({closeOnClick:m,disabled:r,highlighted:c,id:v,store:S,nativeButton:l,nodeId:M?.context.nodeId,itemMetadata:je});return E("div",e,{state:{disabled:r,highlighted:c},props:[h,g,b],ref:[p,o,x.ref]})},"MenuItem"));Wt.displayName="MenuItem";var vt=f(C(),1);var Xt=vt.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,closeOnClick:l=!1,style:r,...m}=e,R=vt.useRef(null),g=pe({label:d}),M=W(!0)?.context.nodeId,v=ee(a),{store:S}=O(),c=S.useState("isActive",g.index),h=S.useState("itemProps"),b=S.context.typingRef,{getButtonProps:p,buttonRef:T}=Ue({native:!1,composite:!0}),V=xt({closeOnClick:l,highlighted:c,id:v,nodeId:M,store:S,typingRef:b,itemRef:R});function s(P){return he(V,P,p)}return n(s,"getItemProps"),E("a",e,{state:{highlighted:c},props:[h,m,s],ref:[R,T,o,g.ref]})},"MenuLinkItem"));Xt.displayName="MenuLinkItem";var $e=f(C(),1);var Nn=f(Me(),1);var er={...Ge,...Fe},qt=$e.forwardRef(n(function(e,o){let{render:i,className:u,style:a,finalFocus:d,...l}=e,{store:r}=O(),{side:m,align:R}=W(),g=pn(!0)!=null,x=r.useState("open"),M=r.useState("transitionStatus"),v=r.useState("popupProps"),S=r.useState("mounted"),c=r.useState("instantType"),h=r.useState("activeTriggerElement"),b=r.useState("parent"),p=r.useState("lastOpenChangeReason"),T=r.useState("rootId"),V=r.useState("floatingRootContext"),s=r.useState("floatingTreeRoot"),k=r.useState("closeDelay"),P=r.useState("activeTriggerElement"),H=r.useState("hoverEnabled"),N=r.useState("disabled"),_=r.useState("openMethod"),D=b.type==="context-menu";Le({open:x,ref:r.context.popupRef,onComplete(){x&&r.context.onOpenChangeComplete?.(!0)}}),$e.useEffect(()=>{function K(w){r.setOpen(!1,J(w.reason,w.domEvent))}return n(K,"handleClose"),s.events.on("close",K),()=>{s.events.off("close",K)}},[s.events,r]),Jo(V,{enabled:H&&!N&&!D&&b.type!=="menubar",closeDelay:k});let F=$e.useCallback(K=>{r.set("popupElement",K)},[r]),Y={transitionStatus:M,side:m,align:R,open:x,nested:b.type==="menu",instant:c},$=E("div",e,{state:Y,ref:[o,r.context.popupRef,F],stateAttributesMapping:er,props:[v,{onKeyDown(K){g&&cn.has(K.key)&&K.stopPropagation()}},sn(M),l,{"data-rootownerid":T}]}),q=b.type===void 0||D;return(h||b.type==="menubar"&&p!==y.outsidePress)&&(q=!0),(0,Nn.jsx)(Oo,{context:V,openInteractionType:_,modal:D,disabled:!S,returnFocus:d===void 0?q:d,initialFocus:b.type!=="menu",restoreFocus:!0,externalTree:b.type!=="menubar"?s:void 0,previousFocusableElement:P,nextFocusableElement:b.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:b.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:$})},"MenuPopup"));qt.displayName="MenuPopup";var Tn=f(C(),1);var Et=f(C(),1);var It=Et.createContext(void 0);It.displayName="MenuPortalContext";function On(){let t=Et.useContext(It);if(t===void 0)throw new Error("Base UI: <Menu.Portal> is missing.");return t}n(On,"useMenuPortalContext");var Qt=f(Me(),1);var Zt=Tn.forwardRef(n(function(e,o){let{keepMounted:i=!1,...u}=e,{store:a}=O();return a.useState("mounted")||i?(0,Qt.jsx)(It.Provider,{value:i,children:(0,Qt.jsx)(yo,{ref:o,...u})}):null},"MenuPortal"));Zt.displayName="MenuPortal";var Ce=f(C(),1);var Ke=f(Me(),1);var eo=Ce.forwardRef(n(function(e,o){let{anchor:i,positionMethod:u="absolute",className:a,render:d,side:l,align:r,sideOffset:m=0,alignOffset:R=0,collisionBoundary:g="clipping-ancestors",collisionPadding:x=5,arrowPadding:M=5,sticky:v=!1,disableAnchorTracking:S=!1,collisionAvoidance:c=Eo,style:h,...b}=e,{store:p}=O(),T=On(),V=be(!0),s=p.useState("parent"),k=p.useState("floatingRootContext"),P=p.useState("floatingTreeRoot"),H=p.useState("mounted"),N=p.useState("open"),_=p.useState("modal"),D=p.useState("openMethod"),F=p.useState("activeTriggerElement"),Y=p.useState("transitionStatus"),$=p.useState("positionerElement"),q=p.useState("instantType"),K=p.useState("hasViewport"),w=p.useState("lastOpenChangeReason"),Q=p.useState("floatingNodeId"),ne=p.useState("floatingParentNodeId"),ve=k.useState("domReferenceElement"),de=Ce.useRef(null),ie=vo($,!1,!1),fe=i,ge=m,ye=R,j=r,re=c;s.type==="context-menu"&&(fe=i??s.context?.anchor,j=j??"start",!l&&j!=="center"&&(ye=e.alignOffset??2,ge=e.sideOffset??-5));let ae=l,Re=j;s.type==="menu"?(ae=ae??"inline-end",Re=Re??"start",re=e.collisionAvoidance??Io):s.type==="menubar"&&(ae=ae??(s.context.orientation==="vertical"?"inline-end":"bottom"),Re=Re??"start");let xe=s.type==="context-menu",se=nn({anchor:fe,floatingRootContext:k,positionMethod:V?"fixed":u,mounted:H,side:ae,sideOffset:ge,align:Re,alignOffset:ye,arrowPadding:xe?0:M,collisionBoundary:g,collisionPadding:x,sticky:v,nodeId:Q,keepMounted:T,disableAnchorTracking:S,collisionAvoidance:re,shiftCrossAxis:xe&&!("side"in re&&re.side==="flip"),externalTree:P,adaptiveOrigin:K?on:void 0});Ce.useEffect(()=>{function B(A){A.open&&(A.parentNodeId===Q&&p.set("hoverEnabled",!1),A.nodeId!==Q&&A.parentNodeId===p.select("floatingParentNodeId")&&p.setOpen(!1,J(y.siblingOpen)))}return n(B,"onMenuOpenChange"),P.events.on("menuopenchange",B),()=>{P.events.off("menuopenchange",B)}},[p,P.events,Q]),Ce.useEffect(()=>{if(p.select("floatingParentNodeId")==null)return;function B(A){if(A.open||A.nodeId!==p.select("floatingParentNodeId"))return;let Ee=A.reason??y.siblingOpen;p.setOpen(!1,J(Ee))}return n(B,"onParentClose"),P.events.on("menuopenchange",B),()=>{P.events.off("menuopenchange",B)}},[P.events,p]);let ue=Se();Ce.useEffect(()=>{N||ue.clear()},[N,ue]),Ce.useEffect(()=>{function B(A){if(!(!N||A.nodeId!==p.select("floatingParentNodeId")))if(A.target&&F&&F!==A.target){let Ee=p.select("closeDelay");Ee>0?ue.isStarted()||ue.start(Ee,()=>{p.setOpen(!1,J(y.siblingOpen))}):p.setOpen(!1,J(y.siblingOpen))}else ue.clear()}return n(B,"onItemHover"),P.events.on("itemhover",B),()=>{P.events.off("itemhover",B)}},[P.events,N,F,p,ue]),Ce.useEffect(()=>{let B={open:N,nodeId:Q,parentNodeId:ne,reason:p.select("lastOpenChangeReason")};P.events.emit("menuopenchange",B)},[P.events,N,p,Q,ne]),me(()=>{let B=ve,A=de.current;if(B&&(de.current=B),A&&B&&B!==A){p.set("instantType",void 0);let Ee=new AbortController;return ie(()=>{p.set("instantType","trigger-change")},Ee.signal),()=>{Ee.abort()}}},[ve,ie,p]);let _e={open:N,side:se.side,align:se.align,anchorHidden:se.anchorHidden,nested:s.type==="menu",instant:q},Pe=s.type==="menubar"&&s.context.modal,le=_&&w!==y.triggerHover;un(N&&(Pe||le),D==="touch",$,F);let De=an(e,_e,{styles:se.positionerStyles,transitionStatus:Y,props:b,refs:[o,p.useStateSetter("positionerElement")],hidden:!H,inert:!N}),Ae=H&&s.type!=="menu"&&(s.type!=="menubar"&&_&&w!==y.triggerHover||s.type==="menubar"&&s.context.modal),L=null;return s.type==="menubar"?L=s.context.contentElement:s.type===void 0&&(L=F),(0,Ke.jsxs)(dt.Provider,{value:se,children:[Ae&&(0,Ke.jsx)(rn,{ref:s.type==="context-menu"||s.type==="nested-context-menu"?s.context.internalBackdropRef:null,inert:en(!N),cutout:L}),(0,Ke.jsx)(So,{id:Q,children:(0,Ke.jsx)(fn,{elementsRef:p.context.itemDomElements,labelsRef:p.context.itemLabels,children:De})})]})},"MenuPositioner"));eo.displayName="MenuPositioner";var Te=f(C(),1);var yt=f(C(),1);var Pt=yt.createContext(void 0);Pt.displayName="MenuRadioGroupContext";function wn(){let t=yt.useContext(Pt);if(t===void 0)throw new Error("Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.");return t}n(wn,"useMenuRadioGroupContext");var to=f(Me(),1);var oo=Te.memo(Te.forwardRef(n(function(e,o){let{render:i,className:u,value:a,defaultValue:d,onValueChange:l,disabled:r=!1,style:m,"aria-labelledby":R,...g}=e,[x,M]=Te.useState(void 0),[v,S]=ot({controlled:a,default:d,name:"MenuRadioGroup"}),c=Be((T,V)=>{l?.(T,V),!V.isCanceled&&S(T)}),b=E("div",e,{state:{disabled:r},ref:o,props:{role:"group","aria-labelledby":R??x,"aria-disabled":r||void 0,...g}}),p=Te.useMemo(()=>({value:v,setValue:c,disabled:r}),[v,c,r]);return(0,to.jsx)(Ye.Provider,{value:M,children:(0,to.jsx)(Pt.Provider,{value:p,children:b})})},"MenuRadioGroup")));oo.displayName="MenuRadioGroup";var Ot=f(C(),1);var St=f(C(),1);var Nt=St.createContext(void 0);Nt.displayName="MenuRadioItemContext";function kn(){let t=St.useContext(Nt);if(t===void 0)throw new Error("Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.");return t}n(kn,"useMenuRadioItemContext");var _n=f(Me(),1);var no=Ot.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,nativeButton:l=!1,disabled:r=!1,closeOnClick:m=!1,value:R,style:g,...x}=e,M=pe({label:d}),v=W(!0),S=ee(a),{store:c}=O(),h=c.useState("isActive",M.index),b=c.useState("itemProps"),{value:p,setValue:T,disabled:V}=wn(),s=V||r,k=p===R,{getItemProps:P,itemRef:H}=Ne({closeOnClick:m,disabled:s,highlighted:h,id:S,store:c,nativeButton:l,nodeId:v?.context.nodeId,itemMetadata:je}),N=Ot.useMemo(()=>({disabled:s,highlighted:h,checked:k}),[s,h,k]);function _(F){let Y=J(y.itemPress,F.nativeEvent,void 0,{preventUnmountOnClose(){}});T(R,Y)}n(_,"handleClick");let D=E("div",e,{state:N,stateAttributesMapping:Oe,props:[b,{role:"menuitemradio","aria-checked":k,onClick:_},x,P],ref:[H,o,M.ref]});return(0,_n.jsx)(Nt.Provider,{value:N,children:D})},"MenuRadioItem"));no.displayName="MenuRadioItem";var Tt=f(C(),1);var ro=Tt.forwardRef(n(function(e,o){let{render:i,className:u,style:a,keepMounted:d=!1,...l}=e,r=kn(),m=Tt.useRef(null),{transitionStatus:R,setMounted:g}=tt(r.checked);Le({open:r.checked,ref:m,onComplete(){r.checked||g(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:R};return E("span",e,{state:x,stateAttributesMapping:Oe,ref:[o,m],props:{"aria-hidden":!0,...l},enabled:d||r.checked})},"MenuRadioItemIndicator"));ro.displayName="MenuRadioItemIndicator";var G=f(C(),1);var wt=f(C(),1);var Dn=wt.createContext(null);Dn.displayName="MenubarContext";function kt(t){let e=wt.useContext(Dn);if(e===null&&!t)throw new Error("Base UI: MenubarContext is missing. Menubar parts must be placed within <Menubar>.");return e}n(kt,"useMenubarContext");var Xe=f(C(),1);var tr={...Ko,disabled:U(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled),modal:U(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0)),openMethod:U(t=>t.openMethod),allowMouseEnter:U(t=>t.allowMouseEnter),highlightItemOnHover:U(t=>t.highlightItemOnHover),stickIfOpen:U(t=>t.stickIfOpen),parent:U(t=>t.parent),rootId:U(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId),activeIndex:U(t=>t.activeIndex),isActive:U((t,e)=>t.activeIndex===e),hoverEnabled:U(t=>t.hoverEnabled),instantType:U(t=>t.instantType),lastOpenChangeReason:U(t=>t.openChangeReason),floatingTreeRoot:U(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot),floatingNodeId:U(t=>t.floatingNodeId),floatingParentNodeId:U(t=>t.floatingParentNodeId),itemProps:U(t=>t.itemProps),closeDelay:U(t=>t.closeDelay),hasViewport:U(t=>t.hasViewport),keyboardEventRelay:U(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")})},ze=class t extends _o{static{n(this,"MenuStore")}constructor(e){super({...or(),...e},{positionerRef:Xe.createRef(),popupRef:Xe.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Xe.createRef(),beforeContentFocusGuardRef:Xe.createRef(),onOpenChangeComplete:void 0,triggerElements:new Yo},tr),this.unsubscribeParentListener=this.observe("parent",o=>{if(this.unsubscribeParentListener?.(),o.type==="menu"){let i=o.store.select("rootId"),u=o.store.select("floatingTreeRoot"),a=o.store.select("keyboardEventRelay");this.unsubscribeParentListener=o.store.subscribe(()=>{let d=o.store.select("rootId"),l=o.store.select("floatingTreeRoot"),r=o.store.select("keyboardEventRelay");i===d&&u===l&&a===r||(i=d,u=l,a=r,this.notifyAll())}),this.context.allowMouseUpTriggerRef=o.store.context.allowMouseUpTriggerRef;return}o.type!==void 0&&(this.context.allowMouseUpTriggerRef=o.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,o){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:o})}static useStore(e,o){let i=go(()=>new t(o)).current;return e??i}unsubscribeParentListener=null};function or(){return{...$o(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new nt,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ce,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}n(or,"createInitialState");var _t=f(C(),1);var Dt=_t.createContext(void 0);Dt.displayName="MenuSubmenuRootContext";function At(){return _t.useContext(Dt)}n(At,"useMenuSubmenuRootContext");var so=f(Me(),1);var qe=wo(n(function(e){let{children:o,open:i,onOpenChange:u,onOpenChangeComplete:a,defaultOpen:d=!1,disabled:l=!1,modal:r,loopFocus:m=!0,orientation:R="vertical",actionsRef:g,closeParentOnEsc:x=!1,handle:M,triggerId:v,defaultTriggerId:S=null,highlightItemOnHover:c=!0}=e,h=be(!0),b=O(!0),p=kt(!0),T=At(),V=G.useMemo(()=>T&&b?{type:"menu",store:b.store}:p?{type:"menubar",context:p}:h&&!b?{type:"context-menu",context:h}:{type:void 0},[h,b,p,T]),s=ze.useStore(M?.store,{open:d,openProp:i,activeTriggerId:S,triggerIdProp:v,parent:V});Lo(s,i,d,S),s.useControlledProp("openProp",i),s.useControlledProp("triggerIdProp",v),s.useContextCallback("onOpenChangeComplete",a);let k=Ft(),P=Ft(),H=s.useState("floatingTreeRoot"),N=st(H),_=rt(),D=s.useState("open"),F=s.useState("activeTriggerElement"),Y=s.useState("positionerElement"),$=s.useState("hoverEnabled"),q=s.useState("disabled"),K=s.useState("lastOpenChangeReason"),w=s.useState("parent"),Q=s.useState("activeIndex"),ne=s.useState("payload"),ve=s.useState("floatingParentNodeId"),de=G.useRef(null),ie=G.useRef(w.type!=="context-menu"),fe=Se(),ge=G.useRef(!0),ye=Se(),j=ve!=null;w.type!==void 0&&r!==void 0&&console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored.");let{openMethod:re,triggerProps:ae}=Zo(D);s.useSyncedValues({disabled:l,highlightItemOnHover:c,modal:w.type===void 0?r:void 0,openMethod:re,rootId:k}),Go(s);let{forceUnmount:Re}=Ho(D,s,()=>{s.update({allowMouseEnter:!1,stickIfOpen:!0})});me(()=>{h&&!b?s.update({parent:{type:"context-menu",context:h},floatingNodeId:N,floatingParentNodeId:_}):b&&s.update({floatingNodeId:N,floatingParentNodeId:_})},[h,b,N,_,s]),G.useEffect(()=>{if(D||(de.current=null),w.type==="context-menu"){if(!D){fe.clear(),ie.current=!1;return}fe.start(500,()=>{ie.current=!0})}},[fe,D,w.type]),me(()=>{!D&&!$&&s.set("hoverEnabled",!0)},[D,$,s]);let xe=Be((I,z)=>{let Z=z.reason;if(D===I&&z.trigger===F&&K===Z)return;let Jn=Fo(z);if(!I&&z.trigger==null&&(z.trigger=F??void 0),u?.(I,z),z.isCanceled)return;s.state.floatingRootContext.dispatchOpenChange(I,z);let Ze=z.event;if(I===!1&&Ze?.type==="click"&&Ze.pointerType==="touch"&&!ge.current)return;I&&Z===y.triggerFocus?(ge.current=!1,ye.start(300,()=>{ge.current=!0})):(ge.current=!0,ye.clear());let mo=(Z===y.triggerPress||Z===y.itemPress)&&Ze.detail===0&&Ze?.isTrusted,Wn=!I&&(Z===y.escapeKey||Z==null),fo={open:I,openChangeReason:Z};de.current=z.event??null,Bo(fo,I,z.trigger,Jn()),s.update(fo),w.type==="menubar"&&(Z===y.triggerFocus||Z===y.focusOut||Z===y.triggerHover||Z===y.listNavigation||Z===y.siblingOpen)?s.set("instantType","group"):mo||Wn?s.set("instantType",mo?"click":"dismiss"):s.set("instantType",void 0)}),se=Do({popupStore:s,floatingId:P,nested:_!=null,onOpenChange:xe}),ue=se.context.events;G.useEffect(()=>{let I=n(({open:z,eventDetails:Z})=>xe(z,Z),"handleSetOpenEvent");return ue.on("setOpen",I),()=>{ue?.off("setOpen",I)}},[ue,xe]);let _e=G.useCallback(()=>{s.setOpen(!1,J(y.imperativeAction))},[s]);G.useImperativeHandle(g,()=>({unmount:Re,close:_e}),[Re,_e]);let Pe;w.type==="context-menu"&&(Pe=w.context),G.useImperativeHandle(Pe?.positionerRef,()=>Y,[Y]),G.useImperativeHandle(Pe?.actionsRef,()=>({setOpen:xe}),[xe]);let le=To(se,{enabled:!q,bubbles:{escapeKey:x&&w.type==="menu"},outsidePress(){return w.type!=="context-menu"||de.current?.type==="contextmenu"?!0:ie.current},externalTree:j?H:void 0}),De=tn(),Ae=G.useCallback(I=>{s.select("activeIndex")!==I&&s.set("activeIndex",I)},[s]),L=Wo(se,{enabled:!q,listRef:s.context.itemDomElements,activeIndex:Q,nested:w.type!==void 0,loopFocus:m,orientation:R,parentOrientation:w.type==="menubar"?w.context.orientation:void 0,rtl:De==="rtl",disabledIndices:Je,onNavigate:Ae,openOnArrowKeyDown:w.type!=="context-menu",externalTree:j?H:void 0,focusItemOnHover:c}),B=G.useCallback(I=>{s.context.typingRef.current=I},[s]),A=Xo(se,{enabled:!q,listRef:s.context.itemLabels,elementsRef:s.context.itemDomElements,activeIndex:Q,resetMs:500,onMatch:n(I=>{D&&I!==Q&&s.set("activeIndex",I)},"onMatch"),onTyping:B}),Ee=G.useMemo(()=>{let I=he(A.reference,L.reference,le.reference,{onMouseMove(){s.set("allowMouseEnter",!0)}},ae);return I["aria-haspopup"]="menu",I["aria-expanded"]=D,I},[s,A.reference,L.reference,le.reference,ae,D]),Yn=G.useMemo(()=>{let I=he(L.trigger,le.trigger,ae);return I["aria-haspopup"]="menu",I["aria-expanded"]=!1,I},[L.trigger,le.trigger,ae]),$n=G.useMemo(()=>he(Ao,{id:P,role:"menu","aria-labelledby":F?.id,onMouseMove(){s.set("allowMouseEnter",!0),w.type==="menu"&&s.set("hoverEnabled",!1)},onClick(){s.select("hoverEnabled")&&s.set("hoverEnabled",!1)},onKeyDown(I){let z=s.select("keyboardEventRelay");z&&!I.isPropagationStopped()&&z(I)}},A.floating,L.floating,le.floating),[F,P,w.type,s,A.floating,L.floating,le.floating]),Kn=L.item??ce;jo(s,{floatingRootContext:se,activeTriggerProps:Ee,inactiveTriggerProps:Yn,popupProps:$n,itemProps:Kn});let zn=G.useMemo(()=>({store:s,parent:V}),[s,V]),lo=(0,so.jsx)(mt.Provider,{value:zn,children:typeof o=="function"?o({payload:ne}):o});return w.type===void 0||w.type==="context-menu"?(0,so.jsx)(No,{externalTree:H,children:lo}):lo},"MenuRoot"));qe.displayName="MenuRoot";var An=f(C(),1);var io=f(Me(),1);function Vn(t){let e=O().store,o=An.useMemo(()=>({parentMenu:e}),[e]);return(0,io.jsx)(Dt.Provider,{value:o,children:(0,io.jsx)(qe,{...t})})}n(Vn,"MenuSubmenuRoot");var X=f(C(),1);var Bn=f(C(),1);function Fn(t={}){let{highlightItemOnHover:e,highlightedIndex:o,onHighlightedIndexChange:i}=ct(),{ref:u,index:a}=pe(t),d=o===a,l=Bn.useRef(null),r=et(u,l);return{compositeProps:{tabIndex:d?0:-1,onFocus(){i(a)},onMouseMove(){let R=l.current;if(!e||!R)return;let g=R.hasAttribute("disabled")||R.ariaDisabled==="true";!d&&!g&&R.focus()}},compositeRef:r,index:a}}n(Fn,"useCompositeItem");function Ln(t){let{render:e,className:o,style:i,state:u=ce,props:a=Je,refs:d=Je,metadata:l,stateAttributesMapping:r,tag:m="div",...R}=t,{compositeProps:g,compositeRef:x}=Fn({metadata:l});return E(m,t,{state:u,ref:[...d,x],props:[g,...a,R],stateAttributesMapping:r})}n(Ln,"CompositeItem");function ao(t){if(Mo(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid")??void 0;if(!ho(t))return ao(bo(t))}n(ao,"findRootOwnerId");var Vt=f(C(),1);function Un(t){let{enabled:e=!0,mouseDownAction:o,open:i}=t,u=Vt.useRef(!1);return Vt.useMemo(()=>e?{onMouseDown:n(a=>{(o==="open"&&!i||o==="close"&&i)&&(u.current=!0,We(a.currentTarget).addEventListener("click",()=>{u.current=!1},{once:!0}))},"onMouseDown"),onClick:n(a=>{u.current&&(u.current=!1,a.preventBaseUIHandler())},"onClick")}:ce,[e,o,i])}n(Un,"useMixedToggleClickHandler");var we=f(Me(),1);var Bt=2,uo=ko(n(function(e,o){let{render:i,className:u,style:a,disabled:d=!1,nativeButton:l=!0,id:r,openOnHover:m,delay:R=100,closeDelay:g=0,handle:x,payload:M,...v}=e,S=O(!0),c=x?.store??S?.store;if(!c)throw new Error("Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.");let h=ee(r),b=c.useState("isTriggerActive",h),p=c.useState("floatingRootContext"),T=c.useState("isOpenedByTrigger",h),V=c.useState("triggerPopupId",h),s=X.useRef(null),k=rr(),P=ct(!0),H=Po(),N=X.useMemo(()=>H??new nt,[H]),_=st(N),D=rt(),{registerTrigger:F,isMountedByThisTrigger:Y}=Uo(h,s,c,{payload:M,closeDelay:g,parent:k,floatingTreeRoot:N,floatingNodeId:_,floatingParentNodeId:D,keyboardEventRelay:P?.relayKeyboardEvent}),$=k.type==="menubar",q=c.useState("disabled"),K=d||q||$&&k.context.disabled,{getButtonProps:w,buttonRef:Q}=Ue({disabled:K,native:l});X.useEffect(()=>{!T&&k.type===void 0&&(c.context.allowMouseUpTriggerRef.current=!1)},[c,T,k.type]);let ne=X.useRef(null),ve=Se(),de=Be(L=>{if(!ne.current)return;ve.clear(),c.context.allowMouseUpTriggerRef.current=!1;let B=L.target;if(Lt(ne.current,B)||Lt(c.select("positionerElement"),B)||B===ne.current||B!=null&&ao(B)===c.select("rootId"))return;let A=gn(ne.current);L.clientX>=A.left-Bt&&L.clientX<=A.right+Bt&&L.clientY>=A.top-Bt&&L.clientY<=A.bottom+Bt||N.events.emit("close",{domEvent:L,reason:y.cancelOpen})});X.useEffect(()=>{T&&c.select("lastOpenChangeReason")===y.triggerHover&&We(ne.current).addEventListener("mouseup",de,{once:!0})},[T,de,c]);let ie=$&&k.context.hasSubmenuOpen,ge=at(p,{enabled:(m??ie)&&!K&&k.type!=="context-menu"&&(!$||ie&&!Y),handleClose:ut({blockPointerEvents:!$}),mouseOnly:!0,move:!1,restMs:k.type===void 0?R:void 0,delay:{close:g},triggerElementRef:s,externalTree:N,isActiveTrigger:b,isClosing:n(()=>c.select("transitionStatus")==="ending","isClosing")}),ye=nr(T,c.select("lastOpenChangeReason")),j=it(p,{enabled:!K&&k.type!=="context-menu",event:T&&$?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:k.type===void 0?ye:!1}),re=zo(p,{enabled:!K&&ie}),ae=Un({open:T,enabled:$,mouseDownAction:"open"}),Re=X.useMemo(()=>he(re.reference,j.reference),[re.reference,j.reference]),xe=c.useState("triggerProps",Y),{preFocusGuardRef:se,handlePreFocusGuardFocus:ue,handleFocusTargetFocus:_e}=Qo(c,s),Pe={disabled:K,open:T},le=[ne,o,Q,F,s],De=[Re,ge??ce,xe,{"aria-haspopup":"menu","aria-controls":V,id:h,onMouseDown:n(L=>{if(c.select("open"))return;ve.start(200,()=>{c.context.allowMouseUpTriggerRef.current=!0}),We(L.currentTarget).addEventListener("mouseup",de,{once:!0})},"onMouseDown")},$?{role:"menuitem"}:{},ae,v,w],Ae=E("button",e,{enabled:!$,stateAttributesMapping:Gt,state:Pe,ref:le,props:De});return $?(0,we.jsx)(Ln,{tag:"button",render:i,className:u,style:a,state:Pe,refs:le,props:De,stateAttributesMapping:Gt}):T?(0,we.jsxs)(X.Fragment,{children:[(0,we.jsx)(Ut,{ref:se,onFocus:ue},`${h}-pre-focus-guard`),(0,we.jsx)(X.Fragment,{children:Ae},h),(0,we.jsx)(Ut,{ref:c.context.triggerFocusTargetRef,onFocus:_e},`${h}-post-focus-guard`)]}):(0,we.jsx)(X.Fragment,{children:Ae},h)},"MenuTrigger"));uo.displayName="MenuTrigger";function nr(t,e){let o=Se(),[i,u]=X.useState(!1);return me(()=>{t&&e==="trigger-hover"?(u(!0),o.start(500,()=>{u(!1)})):t||(o.clear(),u(!1))},[t,e,o]),i}n(nr,"useStickIfOpen");function rr(){let t=be(!0),e=O(!0),o=kt(!0);return X.useMemo(()=>o?{type:"menubar",context:o}:t&&!e?{type:"context-menu",context:t}:{type:void 0},[t,e,o])}n(rr,"useMenuParent");var Hn=f(C(),1);var Gn=(function(t){return t.popupWidth="--popup-width",t.popupHeight="--popup-height",t})({});var sr={activationDirection:n(t=>t?{"data-activation-direction":t}:null,"activationDirection")},co=Hn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,children:d,...l}=e,{store:r}=O(),{side:m}=W(),R=r.useState("instantType"),{children:g,state:x}=dn({store:r,side:m,cssVars:Gn,children:d}),M={activationDirection:x.activationDirection,transitioning:x.transitioning,instant:R};return E("div",e,{state:M,ref:o,props:[l,{children:g}],stateAttributesMapping:sr})},"MenuViewport"));co.displayName="MenuViewport";var Ie=f(C(),1);var po=Ie.forwardRef(n(function(e,o){let{render:i,className:u,style:a,label:d,id:l,nativeButton:r=!1,openOnHover:m=!0,delay:R=100,closeDelay:g=0,disabled:x=!1,...M}=e,v=pe({label:d}),S=W(),{store:c}=O(),h=ee(l),b=c.useState("open"),p=c.useState("floatingRootContext"),T=c.useState("floatingTreeRoot"),V=c.useState("triggerPopupId",h),s=Vo(h,c),k=Ie.useCallback(j=>{let re=s(j);return j!==null&&c.select("open")&&c.select("activeTriggerId")==null&&c.update({activeTriggerId:h,activeTriggerElement:j,closeDelay:g}),re},[s,g,c,h]),P=Ie.useRef(null),H=Ie.useCallback(j=>{P.current=j,c.set("activeTriggerElement",j)},[c]),N=At();if(!N?.parentMenu)throw new Error("Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>.");c.useSyncedValue("closeDelay",g);let _=N.parentMenu,D=c.useState("disabled"),F=_.useState("disabled"),Y=x||D||F;me(()=>{let j=P.current;if(j&&xn(j)&&!Y){let re=xo.captureOwnerStack?.()||"";Ro(`A disabled element was detected on <Menu.SubmenuTrigger>. To properly disable the trigger, use the \`disabled\` prop on the component instead of setting it on the rendered element.${re}`)}});let $=_.useState("itemProps"),q=_.useState("isActive",v.index),K=Ie.useMemo(()=>({type:"submenu-trigger",setActive(){_.select("highlightItemOnHover")&&_.set("activeIndex",v.index)}}),[_,v.index]),{getItemProps:w,itemRef:Q}=Ne({closeOnClick:!1,disabled:Y,highlighted:q,id:h,store:c,typingRef:_.context.typingRef,nativeButton:r,itemMetadata:K,nodeId:S?.context.nodeId}),ne=c.useState("hoverEnabled"),ve=at(p,{enabled:ne&&m&&!Y,handleClose:ut({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:R,delay:{open:R,close:g},shouldOpen:R>0?()=>_.select("allowMouseEnter"):void 0,triggerElementRef:P,externalTree:T,isClosing:n(()=>c.select("transitionStatus")==="ending","isClosing")}),ie=it(p,{enabled:!Y,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}).reference??ce,fe=c.useState("triggerProps",!0);return delete fe.id,E("div",e,{state:{disabled:Y,highlighted:q,open:b},stateAttributesMapping:qo,props:[ie,ve,fe,$,{"aria-controls":V,tabIndex:b||q?0:-1,onBlur(){q&&_.set("activeIndex",null)}},M,w],ref:[o,v.ref,Q,k,H]})},"MenuSubmenuTrigger"));po.displayName="MenuSubmenuTrigger";var Qe=class{static{n(this,"MenuHandle")}constructor(){this.store=new ze}open(e){let o=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!o)throw new Error(`Base UI: MenuHandle.open: No trigger found with id "${e}".`);this.store.setOpen(!0,J("imperative-action",void 0,o))}close(){this.store.setOpen(!1,J("imperative-action",void 0,void 0))}get isOpen(){return this.store.select("open")}};function jn(){return new Qe}n(jn,"createMenuHandle");var oe=f(Qn(),1);function Dc(t){let e=(0,ke.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==o?(i=(0,oe.jsxDEV)(te.Root,{"data-slot":"dropdown-menu",...o},void 0,!1),e[2]=o,e[3]=i):i=e[3],i}n(Dc,"DropdownMenu");function Ac(t){let e=(0,ke.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==o?(i=(0,oe.jsxDEV)(te.Trigger,{"data-slot":"dropdown-menu-trigger",...o},void 0,!1),e[2]=o,e[3]=i):i=e[3],i}n(Ac,"DropdownMenuTrigger");function Vc({align:t="start",alignOffset:e=0,side:o="bottom",sideOffset:i=4,className:u,...a}){return(0,oe.jsxDEV)(te.Portal,{children:(0,oe.jsxDEV)(te.Positioner,{className:"isolate z-50 outline-none",align:t,alignOffset:e,side:o,sideOffset:i,children:(0,oe.jsxDEV)(te.Popup,{"data-slot":"dropdown-menu-content",className:Ve("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",u),...a},void 0,!1)},void 0,!1)},void 0,!1)}n(Vc,"DropdownMenuContent");function Bc(t){let e=(0,ke.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==o?(i=(0,oe.jsxDEV)(te.Group,{"data-slot":"dropdown-menu-group",...o},void 0,!1),e[2]=o,e[3]=i):i=e[3],i}n(Bc,"DropdownMenuGroup");function Fc(t){let e=(0,ke.c)(10),o,i,u;e[0]!==t?({className:o,inset:i,...u}=t,e[0]=t,e[1]=o,e[2]=i,e[3]=u):(o=e[1],i=e[2],u=e[3]);let a;e[4]!==o?(a=Ve("px-2 py-2 text-xs text-muted-foreground data-inset:ps-7",o),e[4]=o,e[5]=a):a=e[5];let d;return e[6]!==i||e[7]!==u||e[8]!==a?(d=(0,oe.jsxDEV)(te.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":i,className:a,...u},void 0,!1),e[6]=i,e[7]=u,e[8]=a,e[9]=d):d=e[9],d}n(Fc,"DropdownMenuLabel");function Lc({className:t,inset:e,variant:o="default",...i}){return(0,oe.jsxDEV)(te.Item,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":o,className:Ve("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",t),...i},void 0,!1)}n(Lc,"DropdownMenuItem");function Uc(t){let e=(0,ke.c)(15),o,i,u,a,d;e[0]!==t?({className:u,children:i,checked:o,inset:a,...d}=t,e[0]=t,e[1]=o,e[2]=i,e[3]=u,e[4]=a,e[5]=d):(o=e[1],i=e[2],u=e[3],a=e[4],d=e[5]);let l;e[6]!==u?(l=Ve("relative flex cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:ps-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",u),e[6]=u,e[7]=l):l=e[7];let r;e[8]===Symbol.for("react.memo_cache_sentinel")?(r=(0,oe.jsxDEV)("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:(0,oe.jsxDEV)(te.CheckboxItemIndicator,{children:(0,oe.jsxDEV)(mn,{icon:ln,strokeWidth:2},void 0,!1)},void 0,!1)},void 0,!1),e[8]=r):r=e[8];let m;return e[9]!==o||e[10]!==i||e[11]!==a||e[12]!==d||e[13]!==l?(m=(0,oe.jsxDEV)(te.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":a,className:l,checked:o,...d,children:[r,i]},void 0,!0),e[9]=o,e[10]=i,e[11]=a,e[12]=d,e[13]=l,e[14]=m):m=e[14],m}n(Uc,"DropdownMenuCheckboxItem");function Gc(t){let e=(0,ke.c)(8),o,i;e[0]!==t?({className:o,...i}=t,e[0]=t,e[1]=o,e[2]=i):(o=e[1],i=e[2]);let u;e[3]!==o?(u=Ve("-mx-1 h-px bg-border",o),e[3]=o,e[4]=u):u=e[4];let a;return e[5]!==i||e[6]!==u?(a=(0,oe.jsxDEV)(te.Separator,{"data-slot":"dropdown-menu-separator",className:u,...i},void 0,!1),e[5]=i,e[6]=u,e[7]=a):a=e[7],a}n(Gc,"DropdownMenuSeparator");export{Dc as a,Ac as b,Vc as c,Bc as d,Fc as e,Lc as f,Uc as g,Gc as h};
1
+ import{b as pe,c as fn,d as gn,e as xn}from"./chunk-APSSZB6Z.js";import{a as Rn}from"./chunk-QAFAJBAW.js";import{a as $o,c as Ko,d as Qo,e as dn}from"./chunk-WVTPZ6CM.js";import{A as To,D as U,E as wo,F as ko,I as _o,K as Do,L as Ao,O as Vo,P as Bo,Q as Fo,S as Lo,T as Uo,U as Go,V as Ho,W as jo,Y as Yo,_ as zo,aa as Jo,ba as at,ca as Wo,da as Xo,ea as ut,ha as qo,ia as Gt,ja as Ge,l as Ut,la as Zo,ma as en,n as Eo,na as on,o as Io,oa as nn,pa as rn,q as yo,qa as sn,r as nt,ra as an,s as rt,t as Po,ta as un,u as st,ua as cn,v as So,va as pn,w as No,x as Oo,y as it}from"./chunk-SHERR7ZP.js";import{b as tn}from"./chunk-5OIBXYZM.js";import{i as ln,k as mn}from"./chunk-4QHKBC77.js";import{C as Se,I as Fe,J as vo,K as Le,L as tt,M as ot,O as y,P as J,d as Ft,e as ee,h as We,i as Co,p as Lt}from"./chunk-VL23Y44O.js";import{a as ct,b as Ue}from"./chunk-UK64ZSUW.js";import{a as me,b as xo,c as Be,i as Mo,q as ho,t as bo}from"./chunk-O3NAGRTR.js";import{a as he,c as go,d as et,f as Ro,h as Je,i as ce,j as E}from"./chunk-CKSHCYGC.js";import{a as Me}from"./chunk-3OA7PECS.js";import{a as n,d as Xn,e as f,f as C,g as qn,h as Qn,j as Ve}from"./chunk-RRCPZMC2.js";var ke=f(qn(),1),Oc=f(C(),1);var te={};Xn(te,{Arrow:()=>Ht,Backdrop:()=>jt,CheckboxItem:()=>$t,CheckboxItemIndicator:()=>Kt,Group:()=>zt,GroupLabel:()=>Jt,Handle:()=>Qe,Item:()=>Wt,LinkItem:()=>Xt,Popup:()=>qt,Portal:()=>Zt,Positioner:()=>eo,RadioGroup:()=>oo,RadioItem:()=>no,RadioItemIndicator:()=>ro,Root:()=>qe,Separator:()=>Rn,SubmenuRoot:()=>Vn,SubmenuTrigger:()=>po,Trigger:()=>uo,Viewport:()=>co,createHandle:()=>jn});var Mn=f(C(),1);var pt=f(C(),1);var dt=pt.createContext(void 0);dt.displayName="MenuPositionerContext";function W(t){let e=pt.useContext(dt);if(e===void 0&&!t)throw new Error("Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.");return e}n(W,"useMenuPositionerContext");var lt=f(C(),1);var mt=lt.createContext(void 0);mt.displayName="MenuRootContext";function O(t){let e=lt.useContext(mt);if(e===void 0&&!t)throw new Error("Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.");return e}n(O,"useMenuRootContext");var Ht=Mn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,...d}=e,{store:l}=O(),{arrowRef:r,side:m,align:R,arrowUncentered:g,arrowStyles:x}=W(),v={open:l.useState("open"),side:m,align:R,uncentered:g};return E("div",e,{ref:[r,o],stateAttributesMapping:Ge,state:v,props:{style:x,"aria-hidden":!0,...d}})},"MenuArrow"));Ht.displayName="MenuArrow";var bn=f(C(),1);var ft=f(C(),1);var hn=ft.createContext(void 0);hn.displayName="ContextMenuRootContext";function be(t=!0){let e=ft.useContext(hn);if(e===void 0&&!t)throw new Error("Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.");return e}n(be,"useContextMenuRootContext");var Zn={...Ge,...Fe},jt=bn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,...d}=e,{store:l}=O(),r=l.useState("open"),m=l.useState("mounted"),R=l.useState("transitionStatus"),g=l.useState("lastOpenChangeReason"),x=be(),M={open:r,transitionStatus:R};return E("div",e,{ref:x?.backdropRef?[o,x.backdropRef]:o,state:M,stateAttributesMapping:Zn,props:[{role:"presentation",hidden:!m,style:{pointerEvents:g===y.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},d]})},"MenuBackdrop"));jt.displayName="MenuBackdrop";var Mt=f(C(),1);var gt=f(C(),1);var Rt=gt.createContext(void 0);Rt.displayName="MenuCheckboxItemContext";function Cn(){let t=gt.useContext(Rt);if(t===void 0)throw new Error("Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.");return t}n(Cn,"useMenuCheckboxItemContext");var He=f(C(),1);var vn=f(C(),1);function xt(t){let{closeOnClick:e,highlighted:o,id:i,nodeId:u,store:a,typingRef:d,itemRef:l,itemMetadata:r}=t,{events:m}=a.useState("floatingTreeRoot"),R=a.useState("open"),g=be(!0),x=g!==void 0;return vn.useMemo(()=>({id:i,role:"menuitem",tabIndex:R&&o?0:-1,onKeyDown(M){M.key===" "&&d?.current&&M.preventDefault()},onMouseMove(M){u&&m.emit("itemhover",{nodeId:u,target:M.currentTarget})},onClick(M){e&&m.emit("close",{domEvent:M,reason:y.itemPress})},onMouseUp(M){if(g){let v=g.initialCursorPointRef.current;if(g.initialCursorPointRef.current=null,x&&v&&Math.abs(M.clientX-v.x)<=1&&Math.abs(M.clientY-v.y)<=1||x&&!Co.os.mac&&M.button===2)return}l.current&&a.context.allowMouseUpTriggerRef.current&&(!x||M.button===2)&&(!r||r.type==="regular-item")&&l.current.click()}}),[e,o,i,m,u,R,a,d,l,g,x,r])}n(xt,"useMenuItemCommonProps");var je={type:"regular-item"};function Ne(t){let{closeOnClick:e,disabled:o=!1,highlighted:i,id:u,store:a,typingRef:d=a.context.typingRef,nativeButton:l,itemMetadata:r,nodeId:m}=t,R=a.useState("disabled"),g=o||R,x=He.useRef(null),{getButtonProps:M,buttonRef:v}=Ue({disabled:g,focusableWhenDisabled:!0,native:l,composite:!0}),S=xt({closeOnClick:e,highlighted:i,id:u,nodeId:m,store:a,typingRef:d,itemRef:x,itemMetadata:r}),c=He.useCallback(b=>he(S,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()}},b,M),[S,M,r]),h=et(x,v);return He.useMemo(()=>({getItemProps:c,itemRef:h}),[c,h])}n(Ne,"useMenuItem");var Yt=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.disabled="data-disabled",t.highlighted="data-highlighted",t})({});var Oe={checked(t){return t?{[Yt.checked]:""}:{[Yt.unchecked]:""}},...Fe};var En=f(Me(),1);var $t=Mt.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,nativeButton:l=!1,disabled:r=!1,closeOnClick:m=!1,checked:R,defaultChecked:g,onCheckedChange:x,style:M,...v}=e,S=pe({label:d}),c=W(!0),h=ee(a),{store:b}=O(),p=b.useState("isActive",S.index),T=b.useState("itemProps"),[V,s]=ot({controlled:R,default:g??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:k,itemRef:P}=Ne({closeOnClick:m,disabled:r,highlighted:p,id:h,store:b,nativeButton:l,nodeId:c?.context.nodeId,itemMetadata:je}),H=Mt.useMemo(()=>({disabled:r,highlighted:p,checked:V}),[r,p,V]);function N(D){let F=J(y.itemPress,D.nativeEvent,void 0,{preventUnmountOnClose(){}});x?.(!V,F),!F.isCanceled&&s(Y=>!Y)}n(N,"handleClick");let _=E("div",e,{state:H,stateAttributesMapping:Oe,props:[T,{role:"menuitemcheckbox","aria-checked":V,onClick:N},v,k],ref:[P,o,S.ref]});return(0,En.jsx)(Rt.Provider,{value:H,children:_})},"MenuCheckboxItem"));$t.displayName="MenuCheckboxItem";var ht=f(C(),1);var Kt=ht.forwardRef(n(function(e,o){let{render:i,className:u,style:a,keepMounted:d=!1,...l}=e,r=Cn(),m=ht.useRef(null),{transitionStatus:R,setMounted:g}=tt(r.checked);Le({open:r.checked,ref:m,onComplete(){r.checked||g(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:R};return E("span",e,{state:x,ref:[o,m],stateAttributesMapping:Oe,props:{"aria-hidden":!0,...l},enabled:d||r.checked})},"MenuCheckboxItemIndicator"));Kt.displayName="MenuCheckboxItemIndicator";var Ct=f(C(),1);var bt=f(C(),1);var Ye=bt.createContext(void 0);Ye.displayName="MenuGroupContext";function In(){let t=bt.useContext(Ye);if(t===void 0)throw new Error("Base UI: MenuGroupContext is missing. Menu group parts must be used within <Menu.Group> or <Menu.RadioGroup>.");return t}n(In,"useMenuGroupRootContext");var yn=f(Me(),1);var zt=Ct.forwardRef(n(function(e,o){let{render:i,className:u,style:a,...d}=e,[l,r]=Ct.useState(void 0),m=E("div",e,{ref:o,props:{role:"group","aria-labelledby":l,...d}});return(0,yn.jsx)(Ye.Provider,{value:r,children:m})},"MenuGroup"));zt.displayName="MenuGroup";var Pn=f(C(),1);var Jt=Pn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,id:d,...l}=e,r=ee(d),m=In();return me(()=>(m(r),()=>{m(void 0)}),[m,r]),E("div",e,{ref:o,props:{id:r,role:"presentation",...l}})},"MenuGroupLabel"));Jt.displayName="MenuGroupLabel";var Sn=f(C(),1);var Wt=Sn.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,nativeButton:l=!1,disabled:r=!1,closeOnClick:m=!0,style:R,...g}=e,x=pe({label:d}),M=W(!0),v=ee(a),{store:S}=O(),c=S.useState("isActive",x.index),h=S.useState("itemProps"),{getItemProps:b,itemRef:p}=Ne({closeOnClick:m,disabled:r,highlighted:c,id:v,store:S,nativeButton:l,nodeId:M?.context.nodeId,itemMetadata:je});return E("div",e,{state:{disabled:r,highlighted:c},props:[h,g,b],ref:[p,o,x.ref]})},"MenuItem"));Wt.displayName="MenuItem";var vt=f(C(),1);var Xt=vt.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,closeOnClick:l=!1,style:r,...m}=e,R=vt.useRef(null),g=pe({label:d}),M=W(!0)?.context.nodeId,v=ee(a),{store:S}=O(),c=S.useState("isActive",g.index),h=S.useState("itemProps"),b=S.context.typingRef,{getButtonProps:p,buttonRef:T}=Ue({native:!1,composite:!0}),V=xt({closeOnClick:l,highlighted:c,id:v,nodeId:M,store:S,typingRef:b,itemRef:R});function s(P){return he(V,P,p)}return n(s,"getItemProps"),E("a",e,{state:{highlighted:c},props:[h,m,s],ref:[R,T,o,g.ref]})},"MenuLinkItem"));Xt.displayName="MenuLinkItem";var $e=f(C(),1);var Nn=f(Me(),1);var er={...Ge,...Fe},qt=$e.forwardRef(n(function(e,o){let{render:i,className:u,style:a,finalFocus:d,...l}=e,{store:r}=O(),{side:m,align:R}=W(),g=pn(!0)!=null,x=r.useState("open"),M=r.useState("transitionStatus"),v=r.useState("popupProps"),S=r.useState("mounted"),c=r.useState("instantType"),h=r.useState("activeTriggerElement"),b=r.useState("parent"),p=r.useState("lastOpenChangeReason"),T=r.useState("rootId"),V=r.useState("floatingRootContext"),s=r.useState("floatingTreeRoot"),k=r.useState("closeDelay"),P=r.useState("activeTriggerElement"),H=r.useState("hoverEnabled"),N=r.useState("disabled"),_=r.useState("openMethod"),D=b.type==="context-menu";Le({open:x,ref:r.context.popupRef,onComplete(){x&&r.context.onOpenChangeComplete?.(!0)}}),$e.useEffect(()=>{function K(w){r.setOpen(!1,J(w.reason,w.domEvent))}return n(K,"handleClose"),s.events.on("close",K),()=>{s.events.off("close",K)}},[s.events,r]),Jo(V,{enabled:H&&!N&&!D&&b.type!=="menubar",closeDelay:k});let F=$e.useCallback(K=>{r.set("popupElement",K)},[r]),Y={transitionStatus:M,side:m,align:R,open:x,nested:b.type==="menu",instant:c},$=E("div",e,{state:Y,ref:[o,r.context.popupRef,F],stateAttributesMapping:er,props:[v,{onKeyDown(K){g&&cn.has(K.key)&&K.stopPropagation()}},sn(M),l,{"data-rootownerid":T}]}),q=b.type===void 0||D;return(h||b.type==="menubar"&&p!==y.outsidePress)&&(q=!0),(0,Nn.jsx)(Oo,{context:V,openInteractionType:_,modal:D,disabled:!S,returnFocus:d===void 0?q:d,initialFocus:b.type!=="menu",restoreFocus:!0,externalTree:b.type!=="menubar"?s:void 0,previousFocusableElement:P,nextFocusableElement:b.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:b.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:$})},"MenuPopup"));qt.displayName="MenuPopup";var Tn=f(C(),1);var Et=f(C(),1);var It=Et.createContext(void 0);It.displayName="MenuPortalContext";function On(){let t=Et.useContext(It);if(t===void 0)throw new Error("Base UI: <Menu.Portal> is missing.");return t}n(On,"useMenuPortalContext");var Qt=f(Me(),1);var Zt=Tn.forwardRef(n(function(e,o){let{keepMounted:i=!1,...u}=e,{store:a}=O();return a.useState("mounted")||i?(0,Qt.jsx)(It.Provider,{value:i,children:(0,Qt.jsx)(yo,{ref:o,...u})}):null},"MenuPortal"));Zt.displayName="MenuPortal";var Ce=f(C(),1);var Ke=f(Me(),1);var eo=Ce.forwardRef(n(function(e,o){let{anchor:i,positionMethod:u="absolute",className:a,render:d,side:l,align:r,sideOffset:m=0,alignOffset:R=0,collisionBoundary:g="clipping-ancestors",collisionPadding:x=5,arrowPadding:M=5,sticky:v=!1,disableAnchorTracking:S=!1,collisionAvoidance:c=Eo,style:h,...b}=e,{store:p}=O(),T=On(),V=be(!0),s=p.useState("parent"),k=p.useState("floatingRootContext"),P=p.useState("floatingTreeRoot"),H=p.useState("mounted"),N=p.useState("open"),_=p.useState("modal"),D=p.useState("openMethod"),F=p.useState("activeTriggerElement"),Y=p.useState("transitionStatus"),$=p.useState("positionerElement"),q=p.useState("instantType"),K=p.useState("hasViewport"),w=p.useState("lastOpenChangeReason"),Q=p.useState("floatingNodeId"),ne=p.useState("floatingParentNodeId"),ve=k.useState("domReferenceElement"),de=Ce.useRef(null),ie=vo($,!1,!1),fe=i,ge=m,ye=R,j=r,re=c;s.type==="context-menu"&&(fe=i??s.context?.anchor,j=j??"start",!l&&j!=="center"&&(ye=e.alignOffset??2,ge=e.sideOffset??-5));let ae=l,Re=j;s.type==="menu"?(ae=ae??"inline-end",Re=Re??"start",re=e.collisionAvoidance??Io):s.type==="menubar"&&(ae=ae??(s.context.orientation==="vertical"?"inline-end":"bottom"),Re=Re??"start");let xe=s.type==="context-menu",se=nn({anchor:fe,floatingRootContext:k,positionMethod:V?"fixed":u,mounted:H,side:ae,sideOffset:ge,align:Re,alignOffset:ye,arrowPadding:xe?0:M,collisionBoundary:g,collisionPadding:x,sticky:v,nodeId:Q,keepMounted:T,disableAnchorTracking:S,collisionAvoidance:re,shiftCrossAxis:xe&&!("side"in re&&re.side==="flip"),externalTree:P,adaptiveOrigin:K?on:void 0});Ce.useEffect(()=>{function B(A){A.open&&(A.parentNodeId===Q&&p.set("hoverEnabled",!1),A.nodeId!==Q&&A.parentNodeId===p.select("floatingParentNodeId")&&p.setOpen(!1,J(y.siblingOpen)))}return n(B,"onMenuOpenChange"),P.events.on("menuopenchange",B),()=>{P.events.off("menuopenchange",B)}},[p,P.events,Q]),Ce.useEffect(()=>{if(p.select("floatingParentNodeId")==null)return;function B(A){if(A.open||A.nodeId!==p.select("floatingParentNodeId"))return;let Ee=A.reason??y.siblingOpen;p.setOpen(!1,J(Ee))}return n(B,"onParentClose"),P.events.on("menuopenchange",B),()=>{P.events.off("menuopenchange",B)}},[P.events,p]);let ue=Se();Ce.useEffect(()=>{N||ue.clear()},[N,ue]),Ce.useEffect(()=>{function B(A){if(!(!N||A.nodeId!==p.select("floatingParentNodeId")))if(A.target&&F&&F!==A.target){let Ee=p.select("closeDelay");Ee>0?ue.isStarted()||ue.start(Ee,()=>{p.setOpen(!1,J(y.siblingOpen))}):p.setOpen(!1,J(y.siblingOpen))}else ue.clear()}return n(B,"onItemHover"),P.events.on("itemhover",B),()=>{P.events.off("itemhover",B)}},[P.events,N,F,p,ue]),Ce.useEffect(()=>{let B={open:N,nodeId:Q,parentNodeId:ne,reason:p.select("lastOpenChangeReason")};P.events.emit("menuopenchange",B)},[P.events,N,p,Q,ne]),me(()=>{let B=ve,A=de.current;if(B&&(de.current=B),A&&B&&B!==A){p.set("instantType",void 0);let Ee=new AbortController;return ie(()=>{p.set("instantType","trigger-change")},Ee.signal),()=>{Ee.abort()}}},[ve,ie,p]);let _e={open:N,side:se.side,align:se.align,anchorHidden:se.anchorHidden,nested:s.type==="menu",instant:q},Pe=s.type==="menubar"&&s.context.modal,le=_&&w!==y.triggerHover;un(N&&(Pe||le),D==="touch",$,F);let De=an(e,_e,{styles:se.positionerStyles,transitionStatus:Y,props:b,refs:[o,p.useStateSetter("positionerElement")],hidden:!H,inert:!N}),Ae=H&&s.type!=="menu"&&(s.type!=="menubar"&&_&&w!==y.triggerHover||s.type==="menubar"&&s.context.modal),L=null;return s.type==="menubar"?L=s.context.contentElement:s.type===void 0&&(L=F),(0,Ke.jsxs)(dt.Provider,{value:se,children:[Ae&&(0,Ke.jsx)(rn,{ref:s.type==="context-menu"||s.type==="nested-context-menu"?s.context.internalBackdropRef:null,inert:en(!N),cutout:L}),(0,Ke.jsx)(So,{id:Q,children:(0,Ke.jsx)(fn,{elementsRef:p.context.itemDomElements,labelsRef:p.context.itemLabels,children:De})})]})},"MenuPositioner"));eo.displayName="MenuPositioner";var Te=f(C(),1);var yt=f(C(),1);var Pt=yt.createContext(void 0);Pt.displayName="MenuRadioGroupContext";function wn(){let t=yt.useContext(Pt);if(t===void 0)throw new Error("Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.");return t}n(wn,"useMenuRadioGroupContext");var to=f(Me(),1);var oo=Te.memo(Te.forwardRef(n(function(e,o){let{render:i,className:u,value:a,defaultValue:d,onValueChange:l,disabled:r=!1,style:m,"aria-labelledby":R,...g}=e,[x,M]=Te.useState(void 0),[v,S]=ot({controlled:a,default:d,name:"MenuRadioGroup"}),c=Be((T,V)=>{l?.(T,V),!V.isCanceled&&S(T)}),b=E("div",e,{state:{disabled:r},ref:o,props:{role:"group","aria-labelledby":R??x,"aria-disabled":r||void 0,...g}}),p=Te.useMemo(()=>({value:v,setValue:c,disabled:r}),[v,c,r]);return(0,to.jsx)(Ye.Provider,{value:M,children:(0,to.jsx)(Pt.Provider,{value:p,children:b})})},"MenuRadioGroup")));oo.displayName="MenuRadioGroup";var Ot=f(C(),1);var St=f(C(),1);var Nt=St.createContext(void 0);Nt.displayName="MenuRadioItemContext";function kn(){let t=St.useContext(Nt);if(t===void 0)throw new Error("Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.");return t}n(kn,"useMenuRadioItemContext");var _n=f(Me(),1);var no=Ot.forwardRef(n(function(e,o){let{render:i,className:u,id:a,label:d,nativeButton:l=!1,disabled:r=!1,closeOnClick:m=!1,value:R,style:g,...x}=e,M=pe({label:d}),v=W(!0),S=ee(a),{store:c}=O(),h=c.useState("isActive",M.index),b=c.useState("itemProps"),{value:p,setValue:T,disabled:V}=wn(),s=V||r,k=p===R,{getItemProps:P,itemRef:H}=Ne({closeOnClick:m,disabled:s,highlighted:h,id:S,store:c,nativeButton:l,nodeId:v?.context.nodeId,itemMetadata:je}),N=Ot.useMemo(()=>({disabled:s,highlighted:h,checked:k}),[s,h,k]);function _(F){let Y=J(y.itemPress,F.nativeEvent,void 0,{preventUnmountOnClose(){}});T(R,Y)}n(_,"handleClick");let D=E("div",e,{state:N,stateAttributesMapping:Oe,props:[b,{role:"menuitemradio","aria-checked":k,onClick:_},x,P],ref:[H,o,M.ref]});return(0,_n.jsx)(Nt.Provider,{value:N,children:D})},"MenuRadioItem"));no.displayName="MenuRadioItem";var Tt=f(C(),1);var ro=Tt.forwardRef(n(function(e,o){let{render:i,className:u,style:a,keepMounted:d=!1,...l}=e,r=kn(),m=Tt.useRef(null),{transitionStatus:R,setMounted:g}=tt(r.checked);Le({open:r.checked,ref:m,onComplete(){r.checked||g(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:R};return E("span",e,{state:x,stateAttributesMapping:Oe,ref:[o,m],props:{"aria-hidden":!0,...l},enabled:d||r.checked})},"MenuRadioItemIndicator"));ro.displayName="MenuRadioItemIndicator";var G=f(C(),1);var wt=f(C(),1);var Dn=wt.createContext(null);Dn.displayName="MenubarContext";function kt(t){let e=wt.useContext(Dn);if(e===null&&!t)throw new Error("Base UI: MenubarContext is missing. Menubar parts must be placed within <Menubar>.");return e}n(kt,"useMenubarContext");var Xe=f(C(),1);var tr={...Ko,disabled:U(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled),modal:U(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0)),openMethod:U(t=>t.openMethod),allowMouseEnter:U(t=>t.allowMouseEnter),highlightItemOnHover:U(t=>t.highlightItemOnHover),stickIfOpen:U(t=>t.stickIfOpen),parent:U(t=>t.parent),rootId:U(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId),activeIndex:U(t=>t.activeIndex),isActive:U((t,e)=>t.activeIndex===e),hoverEnabled:U(t=>t.hoverEnabled),instantType:U(t=>t.instantType),lastOpenChangeReason:U(t=>t.openChangeReason),floatingTreeRoot:U(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot),floatingNodeId:U(t=>t.floatingNodeId),floatingParentNodeId:U(t=>t.floatingParentNodeId),itemProps:U(t=>t.itemProps),closeDelay:U(t=>t.closeDelay),hasViewport:U(t=>t.hasViewport),keyboardEventRelay:U(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")})},ze=class t extends _o{static{n(this,"MenuStore")}constructor(e){super({...or(),...e},{positionerRef:Xe.createRef(),popupRef:Xe.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Xe.createRef(),beforeContentFocusGuardRef:Xe.createRef(),onOpenChangeComplete:void 0,triggerElements:new Yo},tr),this.unsubscribeParentListener=this.observe("parent",o=>{if(this.unsubscribeParentListener?.(),o.type==="menu"){let i=o.store.select("rootId"),u=o.store.select("floatingTreeRoot"),a=o.store.select("keyboardEventRelay");this.unsubscribeParentListener=o.store.subscribe(()=>{let d=o.store.select("rootId"),l=o.store.select("floatingTreeRoot"),r=o.store.select("keyboardEventRelay");i===d&&u===l&&a===r||(i=d,u=l,a=r,this.notifyAll())}),this.context.allowMouseUpTriggerRef=o.store.context.allowMouseUpTriggerRef;return}o.type!==void 0&&(this.context.allowMouseUpTriggerRef=o.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,o){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:o})}static useStore(e,o){let i=go(()=>new t(o)).current;return e??i}unsubscribeParentListener=null};function or(){return{...$o(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new nt,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ce,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}n(or,"createInitialState");var _t=f(C(),1);var Dt=_t.createContext(void 0);Dt.displayName="MenuSubmenuRootContext";function At(){return _t.useContext(Dt)}n(At,"useMenuSubmenuRootContext");var so=f(Me(),1);var qe=wo(n(function(e){let{children:o,open:i,onOpenChange:u,onOpenChangeComplete:a,defaultOpen:d=!1,disabled:l=!1,modal:r,loopFocus:m=!0,orientation:R="vertical",actionsRef:g,closeParentOnEsc:x=!1,handle:M,triggerId:v,defaultTriggerId:S=null,highlightItemOnHover:c=!0}=e,h=be(!0),b=O(!0),p=kt(!0),T=At(),V=G.useMemo(()=>T&&b?{type:"menu",store:b.store}:p?{type:"menubar",context:p}:h&&!b?{type:"context-menu",context:h}:{type:void 0},[h,b,p,T]),s=ze.useStore(M?.store,{open:d,openProp:i,activeTriggerId:S,triggerIdProp:v,parent:V});Lo(s,i,d,S),s.useControlledProp("openProp",i),s.useControlledProp("triggerIdProp",v),s.useContextCallback("onOpenChangeComplete",a);let k=Ft(),P=Ft(),H=s.useState("floatingTreeRoot"),N=st(H),_=rt(),D=s.useState("open"),F=s.useState("activeTriggerElement"),Y=s.useState("positionerElement"),$=s.useState("hoverEnabled"),q=s.useState("disabled"),K=s.useState("lastOpenChangeReason"),w=s.useState("parent"),Q=s.useState("activeIndex"),ne=s.useState("payload"),ve=s.useState("floatingParentNodeId"),de=G.useRef(null),ie=G.useRef(w.type!=="context-menu"),fe=Se(),ge=G.useRef(!0),ye=Se(),j=ve!=null;w.type!==void 0&&r!==void 0&&console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored.");let{openMethod:re,triggerProps:ae}=Zo(D);s.useSyncedValues({disabled:l,highlightItemOnHover:c,modal:w.type===void 0?r:void 0,openMethod:re,rootId:k}),Go(s);let{forceUnmount:Re}=Ho(D,s,()=>{s.update({allowMouseEnter:!1,stickIfOpen:!0})});me(()=>{h&&!b?s.update({parent:{type:"context-menu",context:h},floatingNodeId:N,floatingParentNodeId:_}):b&&s.update({floatingNodeId:N,floatingParentNodeId:_})},[h,b,N,_,s]),G.useEffect(()=>{if(D||(de.current=null),w.type==="context-menu"){if(!D){fe.clear(),ie.current=!1;return}fe.start(500,()=>{ie.current=!0})}},[fe,D,w.type]),me(()=>{!D&&!$&&s.set("hoverEnabled",!0)},[D,$,s]);let xe=Be((I,z)=>{let Z=z.reason;if(D===I&&z.trigger===F&&K===Z)return;let Jn=Fo(z);if(!I&&z.trigger==null&&(z.trigger=F??void 0),u?.(I,z),z.isCanceled)return;s.state.floatingRootContext.dispatchOpenChange(I,z);let Ze=z.event;if(I===!1&&Ze?.type==="click"&&Ze.pointerType==="touch"&&!ge.current)return;I&&Z===y.triggerFocus?(ge.current=!1,ye.start(300,()=>{ge.current=!0})):(ge.current=!0,ye.clear());let mo=(Z===y.triggerPress||Z===y.itemPress)&&Ze.detail===0&&Ze?.isTrusted,Wn=!I&&(Z===y.escapeKey||Z==null),fo={open:I,openChangeReason:Z};de.current=z.event??null,Bo(fo,I,z.trigger,Jn()),s.update(fo),w.type==="menubar"&&(Z===y.triggerFocus||Z===y.focusOut||Z===y.triggerHover||Z===y.listNavigation||Z===y.siblingOpen)?s.set("instantType","group"):mo||Wn?s.set("instantType",mo?"click":"dismiss"):s.set("instantType",void 0)}),se=Do({popupStore:s,floatingId:P,nested:_!=null,onOpenChange:xe}),ue=se.context.events;G.useEffect(()=>{let I=n(({open:z,eventDetails:Z})=>xe(z,Z),"handleSetOpenEvent");return ue.on("setOpen",I),()=>{ue?.off("setOpen",I)}},[ue,xe]);let _e=G.useCallback(()=>{s.setOpen(!1,J(y.imperativeAction))},[s]);G.useImperativeHandle(g,()=>({unmount:Re,close:_e}),[Re,_e]);let Pe;w.type==="context-menu"&&(Pe=w.context),G.useImperativeHandle(Pe?.positionerRef,()=>Y,[Y]),G.useImperativeHandle(Pe?.actionsRef,()=>({setOpen:xe}),[xe]);let le=To(se,{enabled:!q,bubbles:{escapeKey:x&&w.type==="menu"},outsidePress(){return w.type!=="context-menu"||de.current?.type==="contextmenu"?!0:ie.current},externalTree:j?H:void 0}),De=tn(),Ae=G.useCallback(I=>{s.select("activeIndex")!==I&&s.set("activeIndex",I)},[s]),L=Wo(se,{enabled:!q,listRef:s.context.itemDomElements,activeIndex:Q,nested:w.type!==void 0,loopFocus:m,orientation:R,parentOrientation:w.type==="menubar"?w.context.orientation:void 0,rtl:De==="rtl",disabledIndices:Je,onNavigate:Ae,openOnArrowKeyDown:w.type!=="context-menu",externalTree:j?H:void 0,focusItemOnHover:c}),B=G.useCallback(I=>{s.context.typingRef.current=I},[s]),A=Xo(se,{enabled:!q,listRef:s.context.itemLabels,elementsRef:s.context.itemDomElements,activeIndex:Q,resetMs:500,onMatch:n(I=>{D&&I!==Q&&s.set("activeIndex",I)},"onMatch"),onTyping:B}),Ee=G.useMemo(()=>{let I=he(A.reference,L.reference,le.reference,{onMouseMove(){s.set("allowMouseEnter",!0)}},ae);return I["aria-haspopup"]="menu",I["aria-expanded"]=D,I},[s,A.reference,L.reference,le.reference,ae,D]),Yn=G.useMemo(()=>{let I=he(L.trigger,le.trigger,ae);return I["aria-haspopup"]="menu",I["aria-expanded"]=!1,I},[L.trigger,le.trigger,ae]),$n=G.useMemo(()=>he(Ao,{id:P,role:"menu","aria-labelledby":F?.id,onMouseMove(){s.set("allowMouseEnter",!0),w.type==="menu"&&s.set("hoverEnabled",!1)},onClick(){s.select("hoverEnabled")&&s.set("hoverEnabled",!1)},onKeyDown(I){let z=s.select("keyboardEventRelay");z&&!I.isPropagationStopped()&&z(I)}},A.floating,L.floating,le.floating),[F,P,w.type,s,A.floating,L.floating,le.floating]),Kn=L.item??ce;jo(s,{floatingRootContext:se,activeTriggerProps:Ee,inactiveTriggerProps:Yn,popupProps:$n,itemProps:Kn});let zn=G.useMemo(()=>({store:s,parent:V}),[s,V]),lo=(0,so.jsx)(mt.Provider,{value:zn,children:typeof o=="function"?o({payload:ne}):o});return w.type===void 0||w.type==="context-menu"?(0,so.jsx)(No,{externalTree:H,children:lo}):lo},"MenuRoot"));qe.displayName="MenuRoot";var An=f(C(),1);var io=f(Me(),1);function Vn(t){let e=O().store,o=An.useMemo(()=>({parentMenu:e}),[e]);return(0,io.jsx)(Dt.Provider,{value:o,children:(0,io.jsx)(qe,{...t})})}n(Vn,"MenuSubmenuRoot");var X=f(C(),1);var Bn=f(C(),1);function Fn(t={}){let{highlightItemOnHover:e,highlightedIndex:o,onHighlightedIndexChange:i}=ct(),{ref:u,index:a}=pe(t),d=o===a,l=Bn.useRef(null),r=et(u,l);return{compositeProps:{tabIndex:d?0:-1,onFocus(){i(a)},onMouseMove(){let R=l.current;if(!e||!R)return;let g=R.hasAttribute("disabled")||R.ariaDisabled==="true";!d&&!g&&R.focus()}},compositeRef:r,index:a}}n(Fn,"useCompositeItem");function Ln(t){let{render:e,className:o,style:i,state:u=ce,props:a=Je,refs:d=Je,metadata:l,stateAttributesMapping:r,tag:m="div",...R}=t,{compositeProps:g,compositeRef:x}=Fn({metadata:l});return E(m,t,{state:u,ref:[...d,x],props:[g,...a,R],stateAttributesMapping:r})}n(Ln,"CompositeItem");function ao(t){if(Mo(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid")??void 0;if(!ho(t))return ao(bo(t))}n(ao,"findRootOwnerId");var Vt=f(C(),1);function Un(t){let{enabled:e=!0,mouseDownAction:o,open:i}=t,u=Vt.useRef(!1);return Vt.useMemo(()=>e?{onMouseDown:n(a=>{(o==="open"&&!i||o==="close"&&i)&&(u.current=!0,We(a.currentTarget).addEventListener("click",()=>{u.current=!1},{once:!0}))},"onMouseDown"),onClick:n(a=>{u.current&&(u.current=!1,a.preventBaseUIHandler())},"onClick")}:ce,[e,o,i])}n(Un,"useMixedToggleClickHandler");var we=f(Me(),1);var Bt=2,uo=ko(n(function(e,o){let{render:i,className:u,style:a,disabled:d=!1,nativeButton:l=!0,id:r,openOnHover:m,delay:R=100,closeDelay:g=0,handle:x,payload:M,...v}=e,S=O(!0),c=x?.store??S?.store;if(!c)throw new Error("Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.");let h=ee(r),b=c.useState("isTriggerActive",h),p=c.useState("floatingRootContext"),T=c.useState("isOpenedByTrigger",h),V=c.useState("triggerPopupId",h),s=X.useRef(null),k=rr(),P=ct(!0),H=Po(),N=X.useMemo(()=>H??new nt,[H]),_=st(N),D=rt(),{registerTrigger:F,isMountedByThisTrigger:Y}=Uo(h,s,c,{payload:M,closeDelay:g,parent:k,floatingTreeRoot:N,floatingNodeId:_,floatingParentNodeId:D,keyboardEventRelay:P?.relayKeyboardEvent}),$=k.type==="menubar",q=c.useState("disabled"),K=d||q||$&&k.context.disabled,{getButtonProps:w,buttonRef:Q}=Ue({disabled:K,native:l});X.useEffect(()=>{!T&&k.type===void 0&&(c.context.allowMouseUpTriggerRef.current=!1)},[c,T,k.type]);let ne=X.useRef(null),ve=Se(),de=Be(L=>{if(!ne.current)return;ve.clear(),c.context.allowMouseUpTriggerRef.current=!1;let B=L.target;if(Lt(ne.current,B)||Lt(c.select("positionerElement"),B)||B===ne.current||B!=null&&ao(B)===c.select("rootId"))return;let A=gn(ne.current);L.clientX>=A.left-Bt&&L.clientX<=A.right+Bt&&L.clientY>=A.top-Bt&&L.clientY<=A.bottom+Bt||N.events.emit("close",{domEvent:L,reason:y.cancelOpen})});X.useEffect(()=>{T&&c.select("lastOpenChangeReason")===y.triggerHover&&We(ne.current).addEventListener("mouseup",de,{once:!0})},[T,de,c]);let ie=$&&k.context.hasSubmenuOpen,ge=at(p,{enabled:(m??ie)&&!K&&k.type!=="context-menu"&&(!$||ie&&!Y),handleClose:ut({blockPointerEvents:!$}),mouseOnly:!0,move:!1,restMs:k.type===void 0?R:void 0,delay:{close:g},triggerElementRef:s,externalTree:N,isActiveTrigger:b,isClosing:n(()=>c.select("transitionStatus")==="ending","isClosing")}),ye=nr(T,c.select("lastOpenChangeReason")),j=it(p,{enabled:!K&&k.type!=="context-menu",event:T&&$?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:k.type===void 0?ye:!1}),re=zo(p,{enabled:!K&&ie}),ae=Un({open:T,enabled:$,mouseDownAction:"open"}),Re=X.useMemo(()=>he(re.reference,j.reference),[re.reference,j.reference]),xe=c.useState("triggerProps",Y),{preFocusGuardRef:se,handlePreFocusGuardFocus:ue,handleFocusTargetFocus:_e}=Qo(c,s),Pe={disabled:K,open:T},le=[ne,o,Q,F,s],De=[Re,ge??ce,xe,{"aria-haspopup":"menu","aria-controls":V,id:h,onMouseDown:n(L=>{if(c.select("open"))return;ve.start(200,()=>{c.context.allowMouseUpTriggerRef.current=!0}),We(L.currentTarget).addEventListener("mouseup",de,{once:!0})},"onMouseDown")},$?{role:"menuitem"}:{},ae,v,w],Ae=E("button",e,{enabled:!$,stateAttributesMapping:Gt,state:Pe,ref:le,props:De});return $?(0,we.jsx)(Ln,{tag:"button",render:i,className:u,style:a,state:Pe,refs:le,props:De,stateAttributesMapping:Gt}):T?(0,we.jsxs)(X.Fragment,{children:[(0,we.jsx)(Ut,{ref:se,onFocus:ue},`${h}-pre-focus-guard`),(0,we.jsx)(X.Fragment,{children:Ae},h),(0,we.jsx)(Ut,{ref:c.context.triggerFocusTargetRef,onFocus:_e},`${h}-post-focus-guard`)]}):(0,we.jsx)(X.Fragment,{children:Ae},h)},"MenuTrigger"));uo.displayName="MenuTrigger";function nr(t,e){let o=Se(),[i,u]=X.useState(!1);return me(()=>{t&&e==="trigger-hover"?(u(!0),o.start(500,()=>{u(!1)})):t||(o.clear(),u(!1))},[t,e,o]),i}n(nr,"useStickIfOpen");function rr(){let t=be(!0),e=O(!0),o=kt(!0);return X.useMemo(()=>o?{type:"menubar",context:o}:t&&!e?{type:"context-menu",context:t}:{type:void 0},[t,e,o])}n(rr,"useMenuParent");var Hn=f(C(),1);var Gn=(function(t){return t.popupWidth="--popup-width",t.popupHeight="--popup-height",t})({});var sr={activationDirection:n(t=>t?{"data-activation-direction":t}:null,"activationDirection")},co=Hn.forwardRef(n(function(e,o){let{render:i,className:u,style:a,children:d,...l}=e,{store:r}=O(),{side:m}=W(),R=r.useState("instantType"),{children:g,state:x}=dn({store:r,side:m,cssVars:Gn,children:d}),M={activationDirection:x.activationDirection,transitioning:x.transitioning,instant:R};return E("div",e,{state:M,ref:o,props:[l,{children:g}],stateAttributesMapping:sr})},"MenuViewport"));co.displayName="MenuViewport";var Ie=f(C(),1);var po=Ie.forwardRef(n(function(e,o){let{render:i,className:u,style:a,label:d,id:l,nativeButton:r=!1,openOnHover:m=!0,delay:R=100,closeDelay:g=0,disabled:x=!1,...M}=e,v=pe({label:d}),S=W(),{store:c}=O(),h=ee(l),b=c.useState("open"),p=c.useState("floatingRootContext"),T=c.useState("floatingTreeRoot"),V=c.useState("triggerPopupId",h),s=Vo(h,c),k=Ie.useCallback(j=>{let re=s(j);return j!==null&&c.select("open")&&c.select("activeTriggerId")==null&&c.update({activeTriggerId:h,activeTriggerElement:j,closeDelay:g}),re},[s,g,c,h]),P=Ie.useRef(null),H=Ie.useCallback(j=>{P.current=j,c.set("activeTriggerElement",j)},[c]),N=At();if(!N?.parentMenu)throw new Error("Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>.");c.useSyncedValue("closeDelay",g);let _=N.parentMenu,D=c.useState("disabled"),F=_.useState("disabled"),Y=x||D||F;me(()=>{let j=P.current;if(j&&xn(j)&&!Y){let re=xo.captureOwnerStack?.()||"";Ro(`A disabled element was detected on <Menu.SubmenuTrigger>. To properly disable the trigger, use the \`disabled\` prop on the component instead of setting it on the rendered element.${re}`)}});let $=_.useState("itemProps"),q=_.useState("isActive",v.index),K=Ie.useMemo(()=>({type:"submenu-trigger",setActive(){_.select("highlightItemOnHover")&&_.set("activeIndex",v.index)}}),[_,v.index]),{getItemProps:w,itemRef:Q}=Ne({closeOnClick:!1,disabled:Y,highlighted:q,id:h,store:c,typingRef:_.context.typingRef,nativeButton:r,itemMetadata:K,nodeId:S?.context.nodeId}),ne=c.useState("hoverEnabled"),ve=at(p,{enabled:ne&&m&&!Y,handleClose:ut({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:R,delay:{open:R,close:g},shouldOpen:R>0?()=>_.select("allowMouseEnter"):void 0,triggerElementRef:P,externalTree:T,isClosing:n(()=>c.select("transitionStatus")==="ending","isClosing")}),ie=it(p,{enabled:!Y,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}).reference??ce,fe=c.useState("triggerProps",!0);return delete fe.id,E("div",e,{state:{disabled:Y,highlighted:q,open:b},stateAttributesMapping:qo,props:[ie,ve,fe,$,{"aria-controls":V,tabIndex:b||q?0:-1,onBlur(){q&&_.set("activeIndex",null)}},M,w],ref:[o,v.ref,Q,k,H]})},"MenuSubmenuTrigger"));po.displayName="MenuSubmenuTrigger";var Qe=class{static{n(this,"MenuHandle")}constructor(){this.store=new ze}open(e){let o=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!o)throw new Error(`Base UI: MenuHandle.open: No trigger found with id "${e}".`);this.store.setOpen(!0,J("imperative-action",void 0,o))}close(){this.store.setOpen(!1,J("imperative-action",void 0,void 0))}get isOpen(){return this.store.select("open")}};function jn(){return new Qe}n(jn,"createMenuHandle");var oe=f(Qn(),1);function Dc(t){let e=(0,ke.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==o?(i=(0,oe.jsxDEV)(te.Root,{"data-slot":"dropdown-menu",...o},void 0,!1),e[2]=o,e[3]=i):i=e[3],i}n(Dc,"DropdownMenu");function Ac(t){let e=(0,ke.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==o?(i=(0,oe.jsxDEV)(te.Trigger,{"data-slot":"dropdown-menu-trigger",...o},void 0,!1),e[2]=o,e[3]=i):i=e[3],i}n(Ac,"DropdownMenuTrigger");function Vc({align:t="start",alignOffset:e=0,side:o="bottom",sideOffset:i=4,className:u,...a}){return(0,oe.jsxDEV)(te.Portal,{children:(0,oe.jsxDEV)(te.Positioner,{className:"isolate z-50 outline-none",align:t,alignOffset:e,side:o,sideOffset:i,children:(0,oe.jsxDEV)(te.Popup,{"data-slot":"dropdown-menu-content",className:Ve("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",u),...a},void 0,!1)},void 0,!1)},void 0,!1)}n(Vc,"DropdownMenuContent");function Bc(t){let e=(0,ke.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==o?(i=(0,oe.jsxDEV)(te.Group,{"data-slot":"dropdown-menu-group",...o},void 0,!1),e[2]=o,e[3]=i):i=e[3],i}n(Bc,"DropdownMenuGroup");function Fc(t){let e=(0,ke.c)(10),o,i,u;e[0]!==t?({className:o,inset:i,...u}=t,e[0]=t,e[1]=o,e[2]=i,e[3]=u):(o=e[1],i=e[2],u=e[3]);let a;e[4]!==o?(a=Ve("px-2 py-2 text-xs text-muted-foreground data-inset:ps-7",o),e[4]=o,e[5]=a):a=e[5];let d;return e[6]!==i||e[7]!==u||e[8]!==a?(d=(0,oe.jsxDEV)(te.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":i,className:a,...u},void 0,!1),e[6]=i,e[7]=u,e[8]=a,e[9]=d):d=e[9],d}n(Fc,"DropdownMenuLabel");function Lc({className:t,inset:e,variant:o="default",...i}){return(0,oe.jsxDEV)(te.Item,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":o,className:Ve("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",t),...i},void 0,!1)}n(Lc,"DropdownMenuItem");function Uc(t){let e=(0,ke.c)(15),o,i,u,a,d;e[0]!==t?({className:u,children:i,checked:o,inset:a,...d}=t,e[0]=t,e[1]=o,e[2]=i,e[3]=u,e[4]=a,e[5]=d):(o=e[1],i=e[2],u=e[3],a=e[4],d=e[5]);let l;e[6]!==u?(l=Ve("relative flex cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:ps-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",u),e[6]=u,e[7]=l):l=e[7];let r;e[8]===Symbol.for("react.memo_cache_sentinel")?(r=(0,oe.jsxDEV)("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:(0,oe.jsxDEV)(te.CheckboxItemIndicator,{children:(0,oe.jsxDEV)(mn,{icon:ln,strokeWidth:2},void 0,!1)},void 0,!1)},void 0,!1),e[8]=r):r=e[8];let m;return e[9]!==o||e[10]!==i||e[11]!==a||e[12]!==d||e[13]!==l?(m=(0,oe.jsxDEV)(te.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":a,className:l,checked:o,...d,children:[r,i]},void 0,!0),e[9]=o,e[10]=i,e[11]=a,e[12]=d,e[13]=l,e[14]=m):m=e[14],m}n(Uc,"DropdownMenuCheckboxItem");function Gc(t){let e=(0,ke.c)(8),o,i;e[0]!==t?({className:o,...i}=t,e[0]=t,e[1]=o,e[2]=i):(o=e[1],i=e[2]);let u;e[3]!==o?(u=Ve("-mx-1 h-px bg-border",o),e[3]=o,e[4]=u):u=e[4];let a;return e[5]!==i||e[6]!==u?(a=(0,oe.jsxDEV)(te.Separator,{"data-slot":"dropdown-menu-separator",className:u,...i},void 0,!1),e[5]=i,e[6]=u,e[7]=a):a=e[7],a}n(Gc,"DropdownMenuSeparator");export{Dc as a,Ac as b,Vc as c,Bc as d,Fc as e,Lc as f,Uc as g,Gc as h};
@@ -1,4 +1,4 @@
1
- import{a as D,b as xe,c as T,h as Ce,i as Ie,j as Nt,w as de}from"./chunk-O3NAGRTR.js";import{a as Fr}from"./chunk-HV7G6DFP.js";import{a as St,c as H,g as N,i as ue,j as $}from"./chunk-CKSHCYGC.js";import{a as ce}from"./chunk-3OA7PECS.js";import{a as r,d as re,e as g,f as y,g as Tr,h as Dr,j as At}from"./chunk-RRCPZMC2.js";var hr=g(Tr(),1),Wa=g(y(),1);var gr=g(y(),1);var He={};re(He,{Control:()=>vt,Description:()=>ht,Error:()=>Rt,Item:()=>It,Label:()=>pt,Root:()=>mt,Validity:()=>Et});var S=g(y(),1);var ye=g(y(),1);var et=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});var oe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},fe={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},wt={disabled:!1,...fe},W={valid(e){return e===null?null:e?{[et.valid]:""}:{[et.invalid]:""}}};var Vr={invalid:void 0,name:void 0,validityData:{state:oe,errors:[],error:"",value:"",initialValue:null},setValidityData:N,disabled:void 0,touched:fe.touched,setTouched:N,dirty:fe.dirty,setDirty:N,filled:fe.filled,setFilled:N,focused:fe.focused,setFocused:N,validate:r(()=>null,"validate"),validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:r(()=>!1,"shouldValidateOnChange"),state:wt,markedDirtyRef:{current:!1},registerFieldControl:N,validation:{getValidationProps:r((e,t=ue)=>t,"getValidationProps"),inputRef:{current:null},registerInput:N,commit:r(async()=>{},"commit"),change:N}},Fe=ye.createContext(Vr);Fe.displayName="FieldRootContext";function B(e=!0){let t=ye.useContext(Fe);if(t.setValidityData===N&&!e)throw new Error("Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.");return t}r(B,"useFieldRootContext");var Te=g(y(),1);var _t=Te.createContext(void 0);_t.displayName="FieldsetRootContext";function Ot(e=!1){let t=Te.useContext(_t);if(!t&&!e)throw new Error("Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.");return t}r(Ot,"useFieldsetRootContext");var De=g(y(),1);var Mt=De.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:N,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});Mt.displayName="FormContext";function z(){return De.useContext(Mt)}r(z,"useFormContext");var Z=g(y(),1);var Ve=g(y(),1);var Lt=0;function Ar(e,t="mui"){let[o,n]=Ve.useState(e),i=e||o;return Ve.useEffect(()=>{o==null&&(Lt+=1,n(`${t}-${Lt}`))},[o,t]),i}r(Ar,"useGlobalId");var Pt=xe.useId;function kt(e,t){if(Pt!==void 0){let o=Pt();return e??(t?`${t}-${o}`:o)}return Ar(e,t)}r(kt,"useId");function J(e){return kt(e,"base-ui")}r(J,"useBaseUiId");var Ae=g(y(),1);var Se=Ae.createContext({controlId:void 0,registerControlId:N,labelId:void 0,setLabelId:N,messageIds:[],setMessageIds:N,getDescriptionProps:r(e=>e,"getDescriptionProps")});Se.displayName="LabelableContext";function P(){return Ae.useContext(Se)}r(P,"useLabelableContext");var Ut=g(ce(),1);var ge=r(function(t){let o=J(),n=t.controlId===void 0?o:t.controlId,[i,s]=Z.useState(n),[a,l]=Z.useState(t.labelId),[u,d]=Z.useState([]),m=H(()=>new Map),{messageIds:f}=P(),h=T((R,F)=>{let V=m.current;if(F===void 0){V.delete(R);return}V.set(R,F),s(E=>{if(V.size===0)return;let k;for(let c of V.values()){if(E!==void 0&&c===E)return E;k===void 0&&(k=c)}return k})}),p=Z.useCallback(R=>{let F=R["aria-describedby"]?R["aria-describedby"].split(" "):[];return F.push(...f,...u),{...R,"aria-describedby":Array.from(new Set(F)).join(" ")||void 0}},[f,u]),v=Z.useMemo(()=>({controlId:i,registerControlId:h,labelId:a,setLabelId:l,messageIds:u,setMessageIds:d,getDescriptionProps:p}),[i,h,a,l,u,d,p]);return(0,Ut.jsx)(Se.Provider,{value:v,children:t.children})},"LabelableProvider");ge.displayName="LabelableProvider";var Re=g(y(),1);function jt(e={}){let{id:t,implicit:o=!1,controlRef:n}=e,{controlId:i,registerControlId:s}=P(),a=J(t),l=o?i:void 0,u=H(()=>Symbol("labelable-control")),d=Re.useRef(!1),m=Re.useRef(t!=null),f=T(()=>{!d.current||s===N||(d.current=!1,s(u.current,void 0))});return D(()=>{if(s===N)return;let h;if(o){let p=n?.current;Ce(p)&&p.closest("label")!=null?h=t??null:h=l??a}else if(t!=null)m.current=!0,h=t;else if(m.current)h=a;else{f();return}if(h===void 0){f();return}d.current=!0,s(u.current,h)},[t,n,l,s,o,a,u,f]),Re.useEffect(()=>f,[f]),i??a}r(jt,"useLabelableId");function Ne(e){return e?.ownerDocument||document}r(Ne,"ownerDocument");var we={};re(we,{engine:()=>it,env:()=>at,os:()=>ot,screenReader:()=>st});var ot={};re(ot,{android:()=>Wt,apple:()=>rt,ios:()=>tt,linux:()=>Or,mac:()=>qt,windows:()=>_r});function Sr(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};{let e=navigator.userAgentData;if(e&&Array.isArray(e.brands))return{userAgent:e.brands.map(({brand:t,version:o})=>`${t}/${o}`).join(" "),platform:e.platform??navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}r(Sr,"readRawData");var{userAgent:Nr,platform:wr,maxTouchPoints:Bt}=Sr(),ne=Nr.toLowerCase(),ie=wr.toLowerCase();var tt=/^i(os$|p)/.test(ie)||ie==="macintel"&&Bt>1,$t="android",Wt=ie===$t||ne.includes($t),qt=!tt&&ie.startsWith("mac"),_r=ie.startsWith("win"),Or=!Wt&&/^(linux|chrome os)/.test(ie),rt=qt||tt;var it={};re(it,{blink:()=>Lr,gecko:()=>Mr,webkit:()=>nt});var nt=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Mr=!nt&&ne.includes("firefox"),Lr=!nt&&ne.includes("chrom");var st={};re(st,{voiceOver:()=>Pr});var Pr=rt;var at={};re(at,{jsdom:()=>kr});var kr=/jsdom|happydom/.test(ne);var lt="data-base-ui-focusable";var ct="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Tn="ArrowLeft",Dn="ArrowRight",Vn="ArrowUp",An="ArrowDown";function ut(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}r(ut,"activeElement");function Gt(e,t){if(!e||!t)return!1;let o=t.getRootNode?.();if(e.contains(t))return!0;if(o&&Nt(o)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}r(Gt,"contains");function dt(e){return"composedPath"in e?e.composedPath()[0]:e.target}r(dt,"getTarget");function kn(e,t){if(!Ce(e))return!1;let o=e;if(t.hasElement(o))return!o.hasAttribute("data-trigger-disabled");for(let[,n]of t.entries())if(Gt(n,o))return!n.hasAttribute("data-trigger-disabled");return!1}r(kn,"isTargetInsideEnabledTrigger");function Un(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let o=e;return o.target!=null&&t.contains(o.target)}r(Un,"isEventTargetWithin");function jn(e){return e.matches("html,body")}r(jn,"isRootElement");function Ur(e){return Ie(e)&&e.matches(ct)}r(Ur,"isTypeableElement");function Bn(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ct}`)!=null}r(Bn,"isInteractiveElement");function $n(e){return e?e.getAttribute("role")==="combobox"&&Ur(e):!1}r($n,"isTypeableCombobox");function Wn(e){if(!e||we.env.jsdom)return!0;try{return e.matches(":focus-visible")}catch{return!0}}r(Wn,"matchesFocusVisible");function qn(e){return e?e.hasAttribute(lt)?e:e.querySelector(`[${lt}]`)||e:null}r(qn,"getFloatingFocusElement");function Yt(e,t){let o=J(e);return D(()=>(t(o),()=>{t(void 0)}),[o,t]),o}r(Yt,"useRegisteredLabelId");function Kt(e={}){let{id:t,fallbackControlId:o,native:n=!1,setLabelId:i,focusControl:s}=e,{controlId:a,setLabelId:l}=P(),u=T(p=>{l(p),i?.(p)}),d=Yt(t,u),m=a??o;function f(p){if(s){s(p,m);return}if(!m)return;let v=Ne(p.currentTarget).getElementById(m);Ie(v)&&jr(v)}r(f,"focusControl");function h(p){dt(p.nativeEvent)?.closest("button,input,select,textarea")||(!p.defaultPrevented&&p.detail>1&&p.preventDefault(),!n&&f(p))}return r(h,"handleInteraction"),n?{id:d,htmlFor:m??void 0,onMouseDown:h}:{id:d,onClick:h,onPointerDown(p){p.preventDefault()}}}r(Kt,"useLabel");function jr(e){e.focus({focusVisible:!0})}r(jr,"focusElementWithVisible");var ee=g(y(),1);var Ht=g(y(),1);var Br=[];function _e(e){Ht.useEffect(e,Br)}r(_e,"useOnMount");var he=0,ft=class e{static{r(this,"Timeout")}static create(){return new e}currentId=he;start(t,o){this.clear(),this.currentId=setTimeout(()=>{this.currentId=he,o()},t)}isStarted(){return this.currentId!==he}clear=r(()=>{this.currentId!==he&&(clearTimeout(this.currentId),this.currentId=he)},"clear");disposeEffect=r(()=>this.clear,"disposeEffect")};function zt(){let e=H(ft.create).current;return _e(e.disposeEffect),e}r(zt,"useTimeout");function se(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}r(se,"getCombinedFieldValidityData");var Oe=Object.keys(oe);function $r(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(let o of Oe)o!=="valid"&&(o==="valueMissing"?t=e[o]:e[o]&&(t=!1));return t}r($r,"isOnlyValueMissing");function Wr(e){let t=null;for(let o of e)if(!o.disabled){if(!o.validity.valid)return o;t??=o}return t}r(Wr,"findRepresentativeInput");function Jt(e,t){let o=!1;for(let n of t)n.setCustomValidity(""),o||=n===e;o||e.setCustomValidity("")}r(Jt,"clearCustomValidity");function Xt(e){let{formRef:t}=z(),{setValidityData:o,validate:n,validityData:i,validationDebounceTime:s,invalid:a,markedDirtyRef:l,state:u,shouldValidateOnChange:d,getRegisteredFieldId:m}=e,{controlId:f,getDescriptionProps:h}=P(),p=zt(),v=ee.useRef(null),R=H(()=>new Set).current,F=ee.useRef(0),V=ee.useCallback(b=>{if(b)return R.add(b),()=>{R.delete(b)}},[R]),E=T(async(b,w=!1)=>{let C=Wr(R)??v.current;if(!C)return;F.current+=1;let te=F.current;function q(L,A=a){let O=m()??f;if(O==null)return;let x=t.current.fields.get(O);if(!x)return;let K=se(L,A);t.current.fields.set(O,{...x,validityData:K})}if(r(q,"updateRegisteredFieldValidity"),w){if(u.valid!==!1)return;let L=C.validity;if(!L.valueMissing){let O={value:b,state:{...oe,valid:!0},error:"",errors:[],initialValue:i.initialValue};Jt(C,R),q(O,!1),o(O);return}let A=Oe.reduce((O,x)=>(O[x]=L[x],O),{});if(!A.valid&&!$r(A))return}function G(L){let A=Oe.reduce((x,K)=>(x[K]=L.validity[K],x),{}),O=!1;for(let x of Oe)if(x!=="valid"){if(x==="valueMissing"&&A[x])O=!0;else if(A[x])return A}return O&&!l.current&&(A.valid=!0,A.valueMissing=!1),A}r(G,"getState"),p.clear();let I=null,M=[],U=G(C),j,Y=d();if(C.validationMessage&&!Y)j=C.validationMessage,M=[C.validationMessage];else{let L=Array.from(t.current.fields.values()).reduce((O,x)=>(x.name&&(O[x.name]=x.getValue()),O),{}),A=n(b,L);if(typeof A=="object"&&A!==null&&"then"in A){if(I=await A,te!==F.current)return}else I=A;I!==null?(U.valid=!1,U.customError=!0,Array.isArray(I)?(M=I,C.setCustomValidity(I.join(`
1
+ import{a as Fr}from"./chunk-HV7G6DFP.js";import{a as D,b as xe,c as T,h as Ce,i as Ie,j as Nt,w as de}from"./chunk-O3NAGRTR.js";import{a as St,c as H,g as N,i as ue,j as $}from"./chunk-CKSHCYGC.js";import{a as ce}from"./chunk-3OA7PECS.js";import{a as r,d as re,e as g,f as y,g as Tr,h as Dr,j as At}from"./chunk-RRCPZMC2.js";var hr=g(Tr(),1),Wa=g(y(),1);var gr=g(y(),1);var He={};re(He,{Control:()=>vt,Description:()=>ht,Error:()=>Rt,Item:()=>It,Label:()=>pt,Root:()=>mt,Validity:()=>Et});var S=g(y(),1);var ye=g(y(),1);var et=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});var oe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},fe={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},wt={disabled:!1,...fe},W={valid(e){return e===null?null:e?{[et.valid]:""}:{[et.invalid]:""}}};var Vr={invalid:void 0,name:void 0,validityData:{state:oe,errors:[],error:"",value:"",initialValue:null},setValidityData:N,disabled:void 0,touched:fe.touched,setTouched:N,dirty:fe.dirty,setDirty:N,filled:fe.filled,setFilled:N,focused:fe.focused,setFocused:N,validate:r(()=>null,"validate"),validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:r(()=>!1,"shouldValidateOnChange"),state:wt,markedDirtyRef:{current:!1},registerFieldControl:N,validation:{getValidationProps:r((e,t=ue)=>t,"getValidationProps"),inputRef:{current:null},registerInput:N,commit:r(async()=>{},"commit"),change:N}},Fe=ye.createContext(Vr);Fe.displayName="FieldRootContext";function B(e=!0){let t=ye.useContext(Fe);if(t.setValidityData===N&&!e)throw new Error("Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.");return t}r(B,"useFieldRootContext");var Te=g(y(),1);var _t=Te.createContext(void 0);_t.displayName="FieldsetRootContext";function Ot(e=!1){let t=Te.useContext(_t);if(!t&&!e)throw new Error("Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.");return t}r(Ot,"useFieldsetRootContext");var De=g(y(),1);var Mt=De.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:N,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});Mt.displayName="FormContext";function z(){return De.useContext(Mt)}r(z,"useFormContext");var Z=g(y(),1);var Ve=g(y(),1);var Lt=0;function Ar(e,t="mui"){let[o,n]=Ve.useState(e),i=e||o;return Ve.useEffect(()=>{o==null&&(Lt+=1,n(`${t}-${Lt}`))},[o,t]),i}r(Ar,"useGlobalId");var Pt=xe.useId;function kt(e,t){if(Pt!==void 0){let o=Pt();return e??(t?`${t}-${o}`:o)}return Ar(e,t)}r(kt,"useId");function J(e){return kt(e,"base-ui")}r(J,"useBaseUiId");var Ae=g(y(),1);var Se=Ae.createContext({controlId:void 0,registerControlId:N,labelId:void 0,setLabelId:N,messageIds:[],setMessageIds:N,getDescriptionProps:r(e=>e,"getDescriptionProps")});Se.displayName="LabelableContext";function P(){return Ae.useContext(Se)}r(P,"useLabelableContext");var Ut=g(ce(),1);var ge=r(function(t){let o=J(),n=t.controlId===void 0?o:t.controlId,[i,s]=Z.useState(n),[a,l]=Z.useState(t.labelId),[u,d]=Z.useState([]),m=H(()=>new Map),{messageIds:f}=P(),h=T((R,F)=>{let V=m.current;if(F===void 0){V.delete(R);return}V.set(R,F),s(E=>{if(V.size===0)return;let k;for(let c of V.values()){if(E!==void 0&&c===E)return E;k===void 0&&(k=c)}return k})}),p=Z.useCallback(R=>{let F=R["aria-describedby"]?R["aria-describedby"].split(" "):[];return F.push(...f,...u),{...R,"aria-describedby":Array.from(new Set(F)).join(" ")||void 0}},[f,u]),v=Z.useMemo(()=>({controlId:i,registerControlId:h,labelId:a,setLabelId:l,messageIds:u,setMessageIds:d,getDescriptionProps:p}),[i,h,a,l,u,d,p]);return(0,Ut.jsx)(Se.Provider,{value:v,children:t.children})},"LabelableProvider");ge.displayName="LabelableProvider";var Re=g(y(),1);function jt(e={}){let{id:t,implicit:o=!1,controlRef:n}=e,{controlId:i,registerControlId:s}=P(),a=J(t),l=o?i:void 0,u=H(()=>Symbol("labelable-control")),d=Re.useRef(!1),m=Re.useRef(t!=null),f=T(()=>{!d.current||s===N||(d.current=!1,s(u.current,void 0))});return D(()=>{if(s===N)return;let h;if(o){let p=n?.current;Ce(p)&&p.closest("label")!=null?h=t??null:h=l??a}else if(t!=null)m.current=!0,h=t;else if(m.current)h=a;else{f();return}if(h===void 0){f();return}d.current=!0,s(u.current,h)},[t,n,l,s,o,a,u,f]),Re.useEffect(()=>f,[f]),i??a}r(jt,"useLabelableId");function Ne(e){return e?.ownerDocument||document}r(Ne,"ownerDocument");var we={};re(we,{engine:()=>it,env:()=>at,os:()=>ot,screenReader:()=>st});var ot={};re(ot,{android:()=>Wt,apple:()=>rt,ios:()=>tt,linux:()=>Or,mac:()=>qt,windows:()=>_r});function Sr(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};{let e=navigator.userAgentData;if(e&&Array.isArray(e.brands))return{userAgent:e.brands.map(({brand:t,version:o})=>`${t}/${o}`).join(" "),platform:e.platform??navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}r(Sr,"readRawData");var{userAgent:Nr,platform:wr,maxTouchPoints:Bt}=Sr(),ne=Nr.toLowerCase(),ie=wr.toLowerCase();var tt=/^i(os$|p)/.test(ie)||ie==="macintel"&&Bt>1,$t="android",Wt=ie===$t||ne.includes($t),qt=!tt&&ie.startsWith("mac"),_r=ie.startsWith("win"),Or=!Wt&&/^(linux|chrome os)/.test(ie),rt=qt||tt;var it={};re(it,{blink:()=>Lr,gecko:()=>Mr,webkit:()=>nt});var nt=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Mr=!nt&&ne.includes("firefox"),Lr=!nt&&ne.includes("chrom");var st={};re(st,{voiceOver:()=>Pr});var Pr=rt;var at={};re(at,{jsdom:()=>kr});var kr=/jsdom|happydom/.test(ne);var lt="data-base-ui-focusable";var ct="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Tn="ArrowLeft",Dn="ArrowRight",Vn="ArrowUp",An="ArrowDown";function ut(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}r(ut,"activeElement");function Gt(e,t){if(!e||!t)return!1;let o=t.getRootNode?.();if(e.contains(t))return!0;if(o&&Nt(o)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}r(Gt,"contains");function dt(e){return"composedPath"in e?e.composedPath()[0]:e.target}r(dt,"getTarget");function kn(e,t){if(!Ce(e))return!1;let o=e;if(t.hasElement(o))return!o.hasAttribute("data-trigger-disabled");for(let[,n]of t.entries())if(Gt(n,o))return!n.hasAttribute("data-trigger-disabled");return!1}r(kn,"isTargetInsideEnabledTrigger");function Un(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let o=e;return o.target!=null&&t.contains(o.target)}r(Un,"isEventTargetWithin");function jn(e){return e.matches("html,body")}r(jn,"isRootElement");function Ur(e){return Ie(e)&&e.matches(ct)}r(Ur,"isTypeableElement");function Bn(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ct}`)!=null}r(Bn,"isInteractiveElement");function $n(e){return e?e.getAttribute("role")==="combobox"&&Ur(e):!1}r($n,"isTypeableCombobox");function Wn(e){if(!e||we.env.jsdom)return!0;try{return e.matches(":focus-visible")}catch{return!0}}r(Wn,"matchesFocusVisible");function qn(e){return e?e.hasAttribute(lt)?e:e.querySelector(`[${lt}]`)||e:null}r(qn,"getFloatingFocusElement");function Yt(e,t){let o=J(e);return D(()=>(t(o),()=>{t(void 0)}),[o,t]),o}r(Yt,"useRegisteredLabelId");function Kt(e={}){let{id:t,fallbackControlId:o,native:n=!1,setLabelId:i,focusControl:s}=e,{controlId:a,setLabelId:l}=P(),u=T(p=>{l(p),i?.(p)}),d=Yt(t,u),m=a??o;function f(p){if(s){s(p,m);return}if(!m)return;let v=Ne(p.currentTarget).getElementById(m);Ie(v)&&jr(v)}r(f,"focusControl");function h(p){dt(p.nativeEvent)?.closest("button,input,select,textarea")||(!p.defaultPrevented&&p.detail>1&&p.preventDefault(),!n&&f(p))}return r(h,"handleInteraction"),n?{id:d,htmlFor:m??void 0,onMouseDown:h}:{id:d,onClick:h,onPointerDown(p){p.preventDefault()}}}r(Kt,"useLabel");function jr(e){e.focus({focusVisible:!0})}r(jr,"focusElementWithVisible");var ee=g(y(),1);var Ht=g(y(),1);var Br=[];function _e(e){Ht.useEffect(e,Br)}r(_e,"useOnMount");var he=0,ft=class e{static{r(this,"Timeout")}static create(){return new e}currentId=he;start(t,o){this.clear(),this.currentId=setTimeout(()=>{this.currentId=he,o()},t)}isStarted(){return this.currentId!==he}clear=r(()=>{this.currentId!==he&&(clearTimeout(this.currentId),this.currentId=he)},"clear");disposeEffect=r(()=>this.clear,"disposeEffect")};function zt(){let e=H(ft.create).current;return _e(e.disposeEffect),e}r(zt,"useTimeout");function se(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}r(se,"getCombinedFieldValidityData");var Oe=Object.keys(oe);function $r(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(let o of Oe)o!=="valid"&&(o==="valueMissing"?t=e[o]:e[o]&&(t=!1));return t}r($r,"isOnlyValueMissing");function Wr(e){let t=null;for(let o of e)if(!o.disabled){if(!o.validity.valid)return o;t??=o}return t}r(Wr,"findRepresentativeInput");function Jt(e,t){let o=!1;for(let n of t)n.setCustomValidity(""),o||=n===e;o||e.setCustomValidity("")}r(Jt,"clearCustomValidity");function Xt(e){let{formRef:t}=z(),{setValidityData:o,validate:n,validityData:i,validationDebounceTime:s,invalid:a,markedDirtyRef:l,state:u,shouldValidateOnChange:d,getRegisteredFieldId:m}=e,{controlId:f,getDescriptionProps:h}=P(),p=zt(),v=ee.useRef(null),R=H(()=>new Set).current,F=ee.useRef(0),V=ee.useCallback(b=>{if(b)return R.add(b),()=>{R.delete(b)}},[R]),E=T(async(b,w=!1)=>{let C=Wr(R)??v.current;if(!C)return;F.current+=1;let te=F.current;function q(L,A=a){let O=m()??f;if(O==null)return;let x=t.current.fields.get(O);if(!x)return;let K=se(L,A);t.current.fields.set(O,{...x,validityData:K})}if(r(q,"updateRegisteredFieldValidity"),w){if(u.valid!==!1)return;let L=C.validity;if(!L.valueMissing){let O={value:b,state:{...oe,valid:!0},error:"",errors:[],initialValue:i.initialValue};Jt(C,R),q(O,!1),o(O);return}let A=Oe.reduce((O,x)=>(O[x]=L[x],O),{});if(!A.valid&&!$r(A))return}function G(L){let A=Oe.reduce((x,K)=>(x[K]=L.validity[K],x),{}),O=!1;for(let x of Oe)if(x!=="valid"){if(x==="valueMissing"&&A[x])O=!0;else if(A[x])return A}return O&&!l.current&&(A.valid=!0,A.valueMissing=!1),A}r(G,"getState"),p.clear();let I=null,M=[],U=G(C),j,Y=d();if(C.validationMessage&&!Y)j=C.validationMessage,M=[C.validationMessage];else{let L=Array.from(t.current.fields.values()).reduce((O,x)=>(x.name&&(O[x.name]=x.getValue()),O),{}),A=n(b,L);if(typeof A=="object"&&A!==null&&"then"in A){if(I=await A,te!==F.current)return}else I=A;I!==null?(U.valid=!1,U.customError=!0,Array.isArray(I)?(M=I,C.setCustomValidity(I.join(`
2
2
  `))):I&&(M=[I],C.setCustomValidity(I))):Y&&(Jt(C,R),U.customError=!1,C.validationMessage?(j=C.validationMessage,M=[C.validationMessage]):C.validity.valid&&!U.valid&&(U.valid=!0))}let _={value:b,state:U,error:j??(Array.isArray(I)?I[0]:I??""),errors:M,initialValue:i.initialValue};q(_),o(_)}),k=T(b=>{p.clear();let w=d();w&&b!==""&&s?(F.current+=1,p.start(s,()=>{E(b)})):E(b,!w)}),c=ee.useCallback((b,w={})=>St(h(w),u.valid===!1&&!u.disabled&&!b?{"aria-invalid":!0}:ue),[h,u.disabled,u.valid]);return ee.useMemo(()=>({getValidationProps:c,inputRef:v,registerInput:V,commit:E,change:k}),[c,V,E,k])}r(Xt,"useFieldValidation");var Me=g(y(),1);function Qt(e){let{commit:t,invalid:o,markedDirtyRef:n,name:i,setRegisteredFieldName:s,setRegisteredFieldId:a,setValidityData:l,validityData:u}=e,{formRef:d}=z(),m=Me.useRef(null),f=Me.useRef(null),h=Me.useRef(null),p=T(()=>{let c=f.current;if(c)return c.getValue?c.getValue():c.value});function v(c){return c.value===void 0?p():c.value}r(v,"getRegistrationValue");let R=T(()=>{let c=f.current;if(n.current=!0,!c){t(u.value);return}t(v(c))});function F(){let c=f.current;!c||!c.id||d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R})}r(F,"refreshRegistration");function V(c=f.current?.id){c&&d.current.fields.delete(c)}r(V,"deleteRegistration");function E(){let c=f.current;if(!c)return;let b=v(c);u.initialValue===null&&b!==null&&l(w=>({...w,initialValue:b}))}r(E,"syncInitialValue"),D(()=>{let c=f.current;!c||!c.id||(s(i?void 0:c.name),d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R}))},[d,p,o,i,s,R,u]),D(()=>{let c=d.current.fields;return()=>{let b=f.current?.id;b&&c.delete(b)}},[d]);let k=T((c,b)=>{if(!b){m.current===c&&(m.current=null,V(),f.current=null,s(void 0),a(void 0));return}let w=f.current?.id;m.current=c,f.current=b,i||s(b.name),a(b.id),w&&w!==b.id&&V(w),E(),F()});return[R,k]}r(Qt,"useFieldControlRegistration");var Le=g(ce(),1);var Zt=S.forwardRef(r(function(t,o){let{errors:n,validationMode:i,submitAttemptedRef:s}=z(),{render:a,className:l,validate:u,validationDebounceTime:d=0,validationMode:m=i,name:f,disabled:h=!1,invalid:p,dirty:v,touched:R,actionsRef:F,style:V,...E}=t,k=Ot(!0)?.disabled,c=T(u||(()=>null)),b=k||h,[w,C]=S.useState(!1),[te,q]=S.useState(!1),[G,I]=S.useState(!1),[M,U]=S.useState(!1),j=v??te,Y=R??w,_=S.useRef(j),L=S.useRef(void 0),[A,O]=S.useState(),x=f??A;D(()=>{v!==void 0&&(_.current=v)},[v]);let K=S.useCallback(()=>L.current,[]),Er=S.useCallback(le=>{L.current=le},[]),yt=T(le=>{v===void 0&&(le&&(_.current=!0),q(le))}),Ft=T(le=>{R===void 0&&C(le)}),Je=T(()=>m==="onChange"||m==="onSubmit"&&s.current),Xe=x&&Object.hasOwn(n,x)?n[x]:null,Cr=!!(Array.isArray(Xe)?Xe.length:Xe),pe=p===!0||Cr,[be,Qe]=S.useState({state:oe,error:"",errors:[],value:null,initialValue:null}),Tt=b?null:!pe&&be.state.valid,Ee=S.useMemo(()=>({disabled:b,touched:Y,dirty:j,valid:Tt,filled:G,focused:M}),[b,Y,j,Tt,G,M]),Ze=Xt({setValidityData:Qe,validate:c,validityData:be,validationDebounceTime:d,invalid:pe,markedDirtyRef:_,state:Ee,shouldValidateOnChange:Je,getRegisteredFieldId:K}),[Dt,Vt]=Qt({commit:Ze.commit,invalid:pe,markedDirtyRef:_,name:f,setRegisteredFieldName:O,setRegisteredFieldId:Er,setValidityData:Qe,validityData:be});S.useImperativeHandle(F,()=>({validate:Dt}),[Dt]);let Ir=S.useMemo(()=>({invalid:pe,name:x,validityData:be,setValidityData:Qe,disabled:b,touched:Y,setTouched:Ft,dirty:j,setDirty:yt,filled:G,setFilled:I,focused:M,setFocused:U,validate:c,validationMode:m,validationDebounceTime:d,shouldValidateOnChange:Je,state:Ee,markedDirtyRef:_,registerFieldControl:Vt,validation:Ze}),[pe,x,be,b,Y,Ft,j,yt,G,I,M,U,c,m,d,Je,Ee,Vt,Ze]),yr=$("div",t,{ref:o,state:Ee,props:E,stateAttributesMapping:W});return(0,Le.jsx)(Fe.Provider,{value:Ir,children:yr})},"FieldRootInner"));Zt.displayName="FieldRootInner";var mt=S.forwardRef(r(function(t,o){return(0,Le.jsx)(ge,{children:(0,Le.jsx)(Zt,{...t,ref:o})})},"FieldRoot"));mt.displayName="FieldRoot";var me=g(y(),1);var Pe=g(y(),1);var ke=Pe.createContext({disabled:!1});ke.displayName="FieldItemContext";function Ue(){return Pe.useContext(ke)}r(Ue,"useFieldItemContext");var pt=me.forwardRef(r(function(t,o){let{render:n,className:i,style:s,id:a,nativeLabel:l=!0,...u}=t,d=B(!1),m=Ue(),{labelId:f}=P(),h={...d.state,disabled:d.disabled||m.disabled},p=me.useRef(null),v=Kt({id:f??a,native:l});return me.useEffect(()=>{if(!p.current)return;let F=p.current.tagName==="LABEL";if(l){if(!F){let V=xe.captureOwnerStack?.()||"";de(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${V}`)}}else if(F){let V=xe.captureOwnerStack?.()||"";de(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${V}`)}},[l]),$("label",t,{ref:[o,p],state:h,props:[v,u],stateAttributesMapping:W})},"FieldLabel"));pt.displayName="FieldLabel";var ae=g(y(),1);var sr=g(y(),1);var nr=g(Fr(),1);var je=null,er=globalThis.requestAnimationFrame,bt=class{static{r(this,"Scheduler")}callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=r(t=>{this.isScheduled=!1;let o=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let i=0;i<o.length;i+=1)o[i]?.(t)},"tick");request(t){let o=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;let n=er!==requestAnimationFrame&&(er=requestAnimationFrame,!0);return(!this.isScheduled||n)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),o}cancel(t){let o=t-this.startId;o<0||o>=this.callbacks.length||(this.callbacks[o]=null,this.callbacksCount-=1)}},Be=new bt,X=class e{static{r(this,"AnimationFrame")}static create(){return new e}static request(t){return Be.request(t)}static cancel(t){return Be.cancel(t)}currentId=je;request(t){this.cancel(),this.currentId=Be.request(()=>{this.currentId=je,t()})}cancel=r(()=>{this.currentId!==je&&(Be.cancel(this.currentId),this.currentId=je)},"cancel");disposeEffect=r(()=>this.cancel,"disposeEffect")};function tr(){let e=H(X.create).current;return _e(e.disposeEffect),e}r(tr,"useAnimationFrame");function rr(e){return e==null?e:"current"in e?e.current:e}r(rr,"resolveRef");var $e=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({}),qr={[$e.startingStyle]:""},Gr={[$e.endingStyle]:""},or={transitionStatus(e){return e==="starting"?qr:e==="ending"?Gr:null}};function ir(e,t=!1,o=!0){let n=tr();return T((i,s=null)=>{n.cancel();let a=rr(e);if(a==null)return;let l=a,u=r(()=>{nr.flushSync(i)},"done");if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function d(){Promise.all(l.getAnimations().map(m=>m.finished)).then(()=>{s?.aborted||u()}).catch(()=>{if(o){s?.aborted||u();return}let m=l.getAnimations();!s?.aborted&&m.length>0&&m.some(f=>f.pending||f.playState!=="finished")&&d()})}if(r(d,"exec"),t){let m=$e.startingStyle;if(!l.hasAttribute(m)){n.request(d);return}let f=new MutationObserver(()=>{l.hasAttribute(m)||(f.disconnect(),d())});f.observe(l,{attributes:!0,attributeFilter:[m]}),s?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}n.request(d)})}r(ir,"useAnimationsFinished");function ar(e){let{enabled:t=!0,open:o,ref:n,onComplete:i}=e,s=T(i),a=ir(n,o,!1);sr.useEffect(()=>{if(!t)return;let l=new AbortController;return a(s,l.signal),()=>{l.abort()}},[t,o,s,a])}r(ar,"useOpenChangeComplete");var xt=g(y(),1);function We(e,t=!1,o=!1){let[n,i]=xt.useState(e&&t?"idle":void 0),[s,a]=xt.useState(e);return e&&!s&&(a(!0),i("starting")),!e&&s&&n!=="ending"&&!o&&i("ending"),!e&&!s&&n==="ending"&&i(void 0),D(()=>{if(!e&&s&&n!=="ending"&&o){let l=X.request(()=>{i("ending")});return()=>{X.cancel(l)}}},[e,s,n,o]),D(()=>{if(!e||t)return;let l=X.request(()=>{i(void 0)});return()=>{X.cancel(l)}},[t,e]),D(()=>{if(!e||!t)return;e&&s&&n!=="idle"&&i("starting");let l=X.request(()=>{i("idle")});return()=>{X.cancel(l)}},[t,e,s,n]),{mounted:s,setMounted:a,transitionStatus:n}}r(We,"useTransitionStatus");var gt=g(ce(),1);var Yr={...W,...or},Rt=ae.forwardRef(r(function(t,o){let{render:n,id:i,className:s,match:a,style:l,...u}=t,d=J(i),{validityData:m,state:f,name:h}=B(!1),{setMessageIds:p}=P(),{errors:v}=z(),R=h&&Object.hasOwn(v,h)?v[h]:null,F=!!(Array.isArray(R)?R.length:R),V=typeof a=="string",E=!1;a===!0?E=!0:f.disabled?E=!1:V?E=!!m.state[a]:E=F||m.state.valid===!1;let{mounted:k,transitionStatus:c,setMounted:b}=We(E);D(()=>{if(!(!E||!d))return p(_=>_.concat(d)),()=>{p(_=>_.filter(L=>L!==d))}},[E,d,p]);let w=ae.useRef(null),[C,te]=ae.useState(null),[q,G]=ae.useState(null),I=m.error;!V&&F?I=R:m.errors.length>1&&(I=m.errors);let M=I??"";Array.isArray(I)&&(M=I.length>1?(0,gt.jsx)("ul",{children:I.map(_=>(0,gt.jsx)("li",{children:_},_))}):I[0]??"");let U=Array.isArray(I)?JSON.stringify(I):I;E&&U!==q&&(G(U),te(M)),ar({open:E,ref:w,onComplete(){E||b(!1)}});let j={...f,transitionStatus:c},Y=$("div",t,{ref:[o,w],state:j,props:[{id:d,children:E?M:C},u],stateAttributesMapping:Yr,enabled:k});return k?Y:null},"FieldError"));Rt.displayName="FieldError";var lr=g(y(),1);var ht=lr.forwardRef(r(function(t,o){let{render:n,id:i,className:s,style:a,...l}=t,u=J(i),d=B(!1),m=Ue(),{setMessageIds:f}=P(),h={...d.state,disabled:d.disabled||m.disabled};return D(()=>{if(u)return f(v=>v.concat(u)),()=>{f(v=>v.filter(R=>R!==u))}},[u,f]),$("p",t,{ref:o,state:h,props:[{id:u},l],stateAttributesMapping:W})},"FieldDescription"));ht.displayName="FieldDescription";var Ge=g(y(),1);var Q=g(y(),1);function ur({controlled:e,default:t,name:o,state:n="value"}){let{current:i}=Q.useRef(e!==void 0),[s,a]=Q.useState(t),l=i?e:s;{Q.useEffect(()=>{i!==(e!==void 0)&&de([`A component is changing the ${i?"":"un"}controlled ${n} state of ${o} to be ${i?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${o} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
3
3
  `))},[n,o,e]);let{current:d}=Q.useRef(t);Q.useEffect(()=>{!i&&cr(d)!==cr(t)&&de([`A component is changing the default ${n} state of an uncontrolled ${o} after being initialized. To suppress this warning opt to use a controlled ${o}.`].join(`
4
4
  `))},[t])}let u=Q.useCallback(d=>{i||a(d)},[]);return[l,u]}r(ur,"useControlled");function cr(e){let t=0,o=new WeakMap;try{return JSON.stringify(e,r(function(s,a){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof a=="bigint")return`__bigint__:${a}`;if(a!==null&&typeof a=="object"){let l=o.get(a);if(l!==void 0)return`__object__:${l}`;o.set(a,t),t+=1}return a}},"replacer"))??`__top__:${typeof e}`}catch{return"__unserializable__"}}r(cr,"serializeToDevModeString");var dr=g(y(),1);function fr(e,t,o,n,i=!0,s){let{registerFieldControl:a}=B(),l=dr.useRef(null);l.current||(l.current=Symbol()),D(()=>{let u=l.current;return!u||!i?void 0:(a(u,{controlRef:e,getValue:n,id:t,name:s,value:o}),()=>{a(u,void 0)})},[e,i,n,t,s,a,o])}r(fr,"useRegisterFieldControl");var qe={};re(qe,{cancelOpen:()=>Eo,chipRemovePress:()=>ro,clearPress:()=>to,closePress:()=>Zr,closeWatcher:()=>po,decrementPress:()=>io,disabled:()=>Io,drag:()=>Ro,escapeKey:()=>mo,focusOut:()=>fo,imperativeAction:()=>To,incrementPress:()=>no,initial:()=>Fo,inputBlur:()=>lo,inputChange:()=>so,inputClear:()=>ao,inputPaste:()=>co,inputPress:()=>uo,itemPress:()=>Qr,keyboard:()=>xo,linkPress:()=>eo,listNavigation:()=>bo,missing:()=>yo,none:()=>Kr,outsidePress:()=>Xr,pointer:()=>go,scrub:()=>vo,siblingOpen:()=>Co,swipe:()=>Do,trackPress:()=>oo,triggerFocus:()=>Jr,triggerHover:()=>zr,triggerPress:()=>Hr,wheel:()=>ho,windowResize:()=>Vo});var Kr="none",Hr="trigger-press",zr="trigger-hover",Jr="trigger-focus",Xr="outside-press",Qr="item-press",Zr="close-press",eo="link-press",to="clear-press",ro="chip-remove-press",oo="track-press",no="increment-press",io="decrement-press",so="input-change",ao="input-clear",lo="input-blur",co="input-paste",uo="input-press",fo="focus-out",mo="escape-key",po="close-watcher",bo="list-navigation",xo="keyboard",go="pointer",Ro="drag",ho="wheel",vo="scrub",Eo="cancel-open",Co="sibling-open",Io="disabled",yo="missing",Fo="initial",To="imperative-action",Do="swipe",Vo="window-resize";function mr(e,t,o,n){let i=!1,s=!1,a=n??ue;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){s=!0},get isCanceled(){return i},get isPropagationAllowed(){return s},trigger:o,...a}}r(mr,"createChangeEventDetails");var vt=Ge.forwardRef(r(function(t,o){let{render:n,className:i,id:s,name:a,value:l,disabled:u=!1,onValueChange:d,defaultValue:m,autoFocus:f=!1,style:h,...p}=t,{state:v,name:R,disabled:F,setTouched:V,setDirty:E,validityData:k,setFocused:c,setFilled:b,validationMode:w,validation:C}=B(),{clearErrors:te}=z(),q=F||u,G=R??a,I={...v,disabled:q},{labelId:M}=P(),U=jt({id:s});D(()=>{let x=l!=null;C.inputRef.current?.value||x&&l!==""?b(!0):x&&l===""&&b(!1)},[C.inputRef,b,l]);let j=Ge.useRef(null);D(()=>{f&&j.current===ut(Ne(j.current))&&c(!0)},[f,c]);let[Y]=ur({controlled:l,default:m,name:"FieldControl",state:"value"}),_=l!==void 0,L=_?Y:void 0,A=T(()=>C.inputRef.current?.value);return fr(C.inputRef,U,L,A,!q,a),$("input",t,{ref:[o,j],state:I,props:[{id:U,disabled:q,name:G,ref:C.inputRef,"aria-labelledby":M,autoFocus:f,..._?{value:L}:{defaultValue:m},onChange(x){let K=x.currentTarget.value;d?.(K,mr(qe.none,x.nativeEvent)),E(K!==k.initialValue),b(K!==""),x.nativeEvent.defaultPrevented||(te(G),C.change(K))},onFocus(){c(!0)},onBlur(x){V(!0),c(!1),w==="onBlur"&&C.commit(x.currentTarget.value)},onKeyDown(x){x.currentTarget.tagName==="INPUT"&&x.key==="Enter"&&(V(!0),C.commit(x.currentTarget.value))}},p,x=>C.getValidationProps(q,x)],stateAttributesMapping:W})},"FieldControl"));vt.displayName="FieldControl";var ve=g(y(),1);var pr=g(ce(),1);var Et=r(function(t){let{children:o}=t,{validityData:n,invalid:i}=B(!1),s=ve.useMemo(()=>se(n,i),[n,i]),a=s.state.valid===!1,{transitionStatus:l}=We(a),u=ve.useMemo(()=>({...s,validity:s.state,transitionStatus:l}),[s,l]);return(0,pr.jsx)(ve.Fragment,{children:o(u)})},"FieldValidity");Et.displayName="FieldValidity";var Ke=g(y(),1);var Ye=g(y(),1);var br=Ye.createContext(void 0);br.displayName="CheckboxGroupContext";function xr(e=!0){let t=Ye.useContext(br);if(t===void 0&&!e)throw new Error("Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>.");return t}r(xr,"useCheckboxGroupContext");var Ct=g(ce(),1);var It=Ke.forwardRef(r(function(t,o){let{render:n,className:i,style:s,disabled:a=!1,...l}=t,{state:u,disabled:d}=B(!1),m=d||a,f={...u,disabled:m},h=xr(),v=h?.allValues!==void 0?h?.parent.id:void 0,R=Ke.useMemo(()=>({disabled:m}),[m]),F=$("div",t,{ref:o,state:f,props:l,stateAttributesMapping:W});return(0,Ct.jsx)(ge,{controlId:v,children:(0,Ct.jsx)(ke.Provider,{value:R,children:F})})},"FieldItem"));It.displayName="FieldItem";var Rr=g(ce(),1);var ze=gr.forwardRef(r(function(t,o){return(0,Rr.jsx)(He.Control,{ref:o,...t})},"Input"));ze.displayName="Input";var vr=g(Dr(),1);function Ya(e){let t=(0,hr.c)(10),o,n,i;t[0]!==e?({className:o,type:i,...n}=e,t[0]=e,t[1]=o,t[2]=n,t[3]=i):(o=t[1],n=t[2],i=t[3]);let s;t[4]!==o?(s=At("h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",o),t[4]=o,t[5]=s):s=t[5];let a;return t[6]!==n||t[7]!==s||t[8]!==i?(a=(0,vr.jsxDEV)(ze,{type:i,"data-slot":"input",className:s,...n},void 0,!1),t[6]=n,t[7]=s,t[8]=i,t[9]=a):a=t[9],a}r(Ya,"Input");export{W as a,B as b,z as c,kt as d,J as e,P as f,jt as g,Ne as h,we as i,lt as j,Tn as k,Dn as l,Vn as m,An as n,ut as o,Gt as p,dt as q,kn as r,Un as s,jn as t,Ur as u,Bn as v,$n as w,Wn as x,qn as y,Kt as z,_e as A,ft as B,zt as C,Ue as D,X as E,tr as F,rr as G,$e as H,or as I,ir as J,ar as K,We as L,ur as M,fr as N,qe as O,mr as P,xr as Q,Ya as R};
@@ -1 +1 @@
1
- import{a as H}from"./chunk-VLXV72QE.js";import{a as v}from"./chunk-JSEXCW5Q.js";import{a as q}from"./chunk-DH4K2OLM.js";import{b as V}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as B}from"./chunk-3CJW6NWG.js";import{c as p}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as z}from"./chunk-BOXSWNXZ.js";import{b as S}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as L}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as j,e as K,f as U,h as J,l as M,p as P}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a,e as D,f as ne,h as ie}from"./chunk-RRCPZMC2.js";var n=D(ne(),1);var e=D(ie(),1);var de=a(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"argumentType"),le=a(r=>r===void 0||r.length===0?"()":`(${r.map(i=>`${i.name}${i.optional?"?":""}: ${de(i)}`).join(", ")})`,"formatSignature"),ce=a(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"placeholderValue"),ue=a(r=>{let i={};for(let s of r??[])s.optional||(i[s.name]=ce(s.kind));return JSON.stringify(i,void 0,2)},"argumentsTemplate"),fe=U(z.runAs),me=10,he=a(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"formatResult"),Ae=a(({functions:r,runAsIdentity:i=!1}={})=>{let s=j(),u=L(),[X,Y]=(0,n.useState)(null),[w,G]=(0,n.useState)(null),g=r??X??[],[R,I]=(0,n.useState)(""),[f,x]=(0,n.useState)("{}"),[c,k]=(0,n.useState)(""),[m,Q]=(0,n.useState)(""),[b,h]=(0,n.useState)("idle"),[W,N]=(0,n.useState)(void 0),[A,y]=(0,n.useState)(null),[C,Z]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Y(d),d)).catch(d=>{t||G(J(d))}),()=>{t=!0}},[u,r]);let T=R===""?g[0]?.path??"":R,o=g.find(t=>t.path===T),_=a(async()=>{if(!o)return;let t;try{t=f.trim()===""?{}:JSON.parse(f)}catch(l){h("error"),N(void 0),y(s("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:o.path},F=c.trim()===""?{}:{shardKey:c.trim()},$=i?m.trim():"",E=a(l=>{Z(O=>[{argsText:f,at:Date.now(),id:(O[0]?.id??0)+1,kind:o.kind,path:o.path,shardKey:c,status:l},...O].slice(0,me))},"record");h("running"),y(null);try{let l=$===""?await K(u,o.kind,d,t,F):await u.query(fe,{args:t,functionPath:o.path,userId:$},F);V(c),N(l),h("success"),E("success")}catch(l){N(void 0),y(l.message),h("error"),E("error")}},"run"),ee=a(t=>{I(t.path),x(t.argsText),k(t.shardKey)},"loadRun"),te=a(t=>{I(t.target.value)},"onSelectChange"),re=a(t=>{x(t.target.value)},"onArgsChange"),se=a(t=>{Q(t.target.value)},"onRunAsChange"),ae=a(()=>{M(_())},"runOnce"),oe=a(()=>{x(ue(o?.args))},"prefillArgs");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[w!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:w},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxDEV)(v,{htmlFor:"function-select",children:s("Function")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":s("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:T,children:g.map(t=>(0,e.jsxDEV)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path,!0))},void 0,!1),o!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsxDEV)("span",{className:"mr-1.5 font-medium",children:s("Signature")},void 0,!1),(0,e.jsxDEV)("code",{className:"font-mono","data-testid":"function-signature",children:le(o.args)},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)(v,{htmlFor:"args-input",children:s("Arguments")},void 0,!1),(0,e.jsxDEV)(p,{"data-testid":"prefill-button",disabled:o===void 0,onClick:oe,size:"xs",type:"button",variant:"ghost",children:s("Prefill")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(H,{"aria-label":s("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:f},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(q,{onChange:k,testId:"shard-input",value:c},void 0,!1),i&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsxDEV)(v,{htmlFor:"run-as-input",children:s("Run as identity (userId)")},void 0,!1),(0,e.jsxDEV)(B,{"aria-label":s("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:se,placeholder:s("Leave empty to run as admin"),value:m},void 0,!1),(0,e.jsxDEV)("p",{className:"text-[11px] text-muted-foreground",children:s("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(p,{"data-testid":"run-button",disabled:b==="running"||o===void 0,onClick:ae,type:"button",children:s("Run")},void 0,!1),o!==void 0&&(0,e.jsxDEV)(S,{variant:"outline",children:o.kind},void 0,!1),i&&m.trim()!==""&&(0,e.jsxDEV)(S,{"data-testid":"run-as-badge",variant:"secondary",children:s("as {userId}",{userId:m.trim()})},void 0,!1)]},void 0,!0)]},void 0,!0),b==="error"&&A!==null&&(0,e.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:A},void 0,!1),b==="success"&&(0,e.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:he(W)},void 0,!1),C.length>0&&(0,e.jsxDEV)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:C.map((t,d)=>(0,e.jsxDEV)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsxDEV)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"},void 0,!1)," ",(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]},void 0,!0)," ",(0,e.jsxDEV)("time",{className:"text-xs text-muted-foreground",children:P(t.at)},void 0,!1)," ",(0,e.jsxDEV)(p,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:a(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Load")},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},"FunctionRunner");export{Ae as FunctionRunner};
1
+ import{a as H}from"./chunk-VLXV72QE.js";import{a as v}from"./chunk-JSEXCW5Q.js";import{a as q}from"./chunk-LUP4YTBS.js";import{b as V}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as B}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as p}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as S}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as z}from"./chunk-BOXSWNXZ.js";import{f as L}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as j,e as K,f as U,h as J,l as M,p as P}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a,e as D,f as ne,h as ie}from"./chunk-RRCPZMC2.js";var n=D(ne(),1);var e=D(ie(),1);var de=a(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"argumentType"),le=a(r=>r===void 0||r.length===0?"()":`(${r.map(i=>`${i.name}${i.optional?"?":""}: ${de(i)}`).join(", ")})`,"formatSignature"),ce=a(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"placeholderValue"),ue=a(r=>{let i={};for(let s of r??[])s.optional||(i[s.name]=ce(s.kind));return JSON.stringify(i,void 0,2)},"argumentsTemplate"),fe=U(z.runAs),me=10,he=a(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"formatResult"),Ae=a(({functions:r,runAsIdentity:i=!1}={})=>{let s=j(),u=L(),[X,Y]=(0,n.useState)(null),[w,G]=(0,n.useState)(null),g=r??X??[],[R,I]=(0,n.useState)(""),[f,x]=(0,n.useState)("{}"),[c,k]=(0,n.useState)(""),[m,Q]=(0,n.useState)(""),[b,h]=(0,n.useState)("idle"),[W,N]=(0,n.useState)(void 0),[A,y]=(0,n.useState)(null),[C,Z]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Y(d),d)).catch(d=>{t||G(J(d))}),()=>{t=!0}},[u,r]);let T=R===""?g[0]?.path??"":R,o=g.find(t=>t.path===T),_=a(async()=>{if(!o)return;let t;try{t=f.trim()===""?{}:JSON.parse(f)}catch(l){h("error"),N(void 0),y(s("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:o.path},F=c.trim()===""?{}:{shardKey:c.trim()},$=i?m.trim():"",E=a(l=>{Z(O=>[{argsText:f,at:Date.now(),id:(O[0]?.id??0)+1,kind:o.kind,path:o.path,shardKey:c,status:l},...O].slice(0,me))},"record");h("running"),y(null);try{let l=$===""?await K(u,o.kind,d,t,F):await u.query(fe,{args:t,functionPath:o.path,userId:$},F);V(c),N(l),h("success"),E("success")}catch(l){N(void 0),y(l.message),h("error"),E("error")}},"run"),ee=a(t=>{I(t.path),x(t.argsText),k(t.shardKey)},"loadRun"),te=a(t=>{I(t.target.value)},"onSelectChange"),re=a(t=>{x(t.target.value)},"onArgsChange"),se=a(t=>{Q(t.target.value)},"onRunAsChange"),ae=a(()=>{M(_())},"runOnce"),oe=a(()=>{x(ue(o?.args))},"prefillArgs");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[w!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:w},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxDEV)(v,{htmlFor:"function-select",children:s("Function")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":s("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:T,children:g.map(t=>(0,e.jsxDEV)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path,!0))},void 0,!1),o!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsxDEV)("span",{className:"mr-1.5 font-medium",children:s("Signature")},void 0,!1),(0,e.jsxDEV)("code",{className:"font-mono","data-testid":"function-signature",children:le(o.args)},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)(v,{htmlFor:"args-input",children:s("Arguments")},void 0,!1),(0,e.jsxDEV)(p,{"data-testid":"prefill-button",disabled:o===void 0,onClick:oe,size:"xs",type:"button",variant:"ghost",children:s("Prefill")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(H,{"aria-label":s("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:f},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(q,{onChange:k,testId:"shard-input",value:c},void 0,!1),i&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsxDEV)(v,{htmlFor:"run-as-input",children:s("Run as identity (userId)")},void 0,!1),(0,e.jsxDEV)(B,{"aria-label":s("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:se,placeholder:s("Leave empty to run as admin"),value:m},void 0,!1),(0,e.jsxDEV)("p",{className:"text-[11px] text-muted-foreground",children:s("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(p,{"data-testid":"run-button",disabled:b==="running"||o===void 0,onClick:ae,type:"button",children:s("Run")},void 0,!1),o!==void 0&&(0,e.jsxDEV)(S,{variant:"outline",children:o.kind},void 0,!1),i&&m.trim()!==""&&(0,e.jsxDEV)(S,{"data-testid":"run-as-badge",variant:"secondary",children:s("as {userId}",{userId:m.trim()})},void 0,!1)]},void 0,!0)]},void 0,!0),b==="error"&&A!==null&&(0,e.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:A},void 0,!1),b==="success"&&(0,e.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:he(W)},void 0,!1),C.length>0&&(0,e.jsxDEV)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:C.map((t,d)=>(0,e.jsxDEV)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsxDEV)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"},void 0,!1)," ",(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]},void 0,!0)," ",(0,e.jsxDEV)("time",{className:"text-xs text-muted-foreground",children:P(t.at)},void 0,!1)," ",(0,e.jsxDEV)(p,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:a(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Load")},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},"FunctionRunner");export{Ae as FunctionRunner};
@@ -1 +1 @@
1
- import{b,c as v,d as g,f as D}from"./chunk-LRYLU6EY.js";import{f as y,g as p,h as P,l as O}from"./chunk-ITQKVEP7.js";import{a as n,e as Q,f as N,g as _}from"./chunk-RRCPZMC2.js";var E=Q(_(),1);var c=Q(N(),1);var C=n((e,r,o)=>["lunora-admin",e,r,o.trim()],"adminQueryKey"),h=1e3,S=25,q=new Map,k=n(e=>{let r=Date.now(),o=(q.get(e)??[]).filter(s=>r-s<h);o.push(r),q.set(e,o),o.length===S&&(console.error(`[lunora-studio] possible request loop: ${e} fired ${String(S)}\xD7 in <1s \u2014 a render/effect is re-issuing this read unbounded.`),console.trace("[lunora-studio] request-loop call site"))},"noteQueryFetch");function R(e,r,o={}){let{enabled:s=!0,keepPreviousData:a=!1,staleTime:i=0}=o,t=g({enabled:s,queryFn:n(()=>(k(JSON.stringify(e)),r()),"trackedQueryFunction"),placeholderData:a?b:void 0,queryKey:e,staleTime:i});return{data:t.data,error:t.error?P(t.error):t.error,errorSource:t.error??void 0,isLoading:t.isLoading,liveError:void 0,refetch:n(()=>{O(t.refetch())},"refetch")}}n(R,"useClientQuery");function K(e,r,o={}){let s=D(),a=v(),{enabled:i=!0,keepPreviousData:u=!1,live:t=!1,shardKey:l="",staleTime:I}=o,d=C(e,r,l),L=R(d,()=>s.query(y(e),r,p(l)),{enabled:i,keepPreviousData:u,staleTime:I??(t?Number.POSITIVE_INFINITY:0)}),[T,f]=(0,c.useState)(void 0),F=JSON.stringify(d);return(0,c.useEffect)(()=>{if(!(!i||!t))return f(void 0),s.subscribe(y(e),r,m=>{f(void 0),a.setQueryData(d,m)},{...p(l),onError:n(m=>{f(m.message)},"onError")})},[F,i,t]),{...L,liveError:i&&t?T:void 0}}n(K,"useAdminQuery");var M=n(()=>{let e=(0,E.c)(2),r=v(),o;return e[0]!==r?(o=n((s,a,i)=>{let u=a===void 0?["lunora-admin",s]:C(s,a,i??"");O(r.invalidateQueries({queryKey:u}))},"t0"),e[0]=r,e[1]=o):o=e[1],o},"useInvalidateAdmin");export{R as a,K as b,M as c};
1
+ import{b,c as v,d as g,f as D}from"./chunk-SDMZKBTD.js";import{f as y,g as p,h as P,l as O}from"./chunk-ITQKVEP7.js";import{a as n,e as Q,f as N,g as _}from"./chunk-RRCPZMC2.js";var E=Q(_(),1);var c=Q(N(),1);var C=n((e,r,o)=>["lunora-admin",e,r,o.trim()],"adminQueryKey"),h=1e3,S=25,q=new Map,k=n(e=>{let r=Date.now(),o=(q.get(e)??[]).filter(s=>r-s<h);o.push(r),q.set(e,o),o.length===S&&(console.error(`[lunora-studio] possible request loop: ${e} fired ${String(S)}\xD7 in <1s \u2014 a render/effect is re-issuing this read unbounded.`),console.trace("[lunora-studio] request-loop call site"))},"noteQueryFetch");function R(e,r,o={}){let{enabled:s=!0,keepPreviousData:a=!1,staleTime:i=0}=o,t=g({enabled:s,queryFn:n(()=>(k(JSON.stringify(e)),r()),"trackedQueryFunction"),placeholderData:a?b:void 0,queryKey:e,staleTime:i});return{data:t.data,error:t.error?P(t.error):t.error,errorSource:t.error??void 0,isLoading:t.isLoading,liveError:void 0,refetch:n(()=>{O(t.refetch())},"refetch")}}n(R,"useClientQuery");function K(e,r,o={}){let s=D(),a=v(),{enabled:i=!0,keepPreviousData:u=!1,live:t=!1,shardKey:l="",staleTime:I}=o,d=C(e,r,l),L=R(d,()=>s.query(y(e),r,p(l)),{enabled:i,keepPreviousData:u,staleTime:I??(t?Number.POSITIVE_INFINITY:0)}),[T,f]=(0,c.useState)(void 0),F=JSON.stringify(d);return(0,c.useEffect)(()=>{if(!(!i||!t))return f(void 0),s.subscribe(y(e),r,m=>{f(void 0),a.setQueryData(d,m)},{...p(l),onError:n(m=>{f(m.message)},"onError")})},[F,i,t]),{...L,liveError:i&&t?T:void 0}}n(K,"useAdminQuery");var M=n(()=>{let e=(0,E.c)(2),r=v(),o;return e[0]!==r?(o=n((s,a,i)=>{let u=a===void 0?["lunora-admin",s]:C(s,a,i??"");O(r.invalidateQueries({queryKey:u}))},"t0"),e[0]=r,e[1]=o):o=e[1],o},"useInvalidateAdmin");export{R as a,K as b,M as c};
@@ -1 +1 @@
1
- import{a as k,b as N,c as O,d as x,e as q,f as D}from"./chunk-GTM65MVX.js";import{a as C}from"./chunk-TAD43CG5.js";import{a as g}from"./chunk-SEU5V7I6.js";import{d as T,h as I,k as _,l as w}from"./chunk-ITQKVEP7.js";import{b as L}from"./chunk-22C6COGE.js";import{a as d,e as b,f as U,g as Y,h as F}from"./chunk-RRCPZMC2.js";var M=b(Y(),1);var H="https://api.cloudflare.com/client/v4/accounts",E=class extends L{static{d(this,"AnalyticsSqlError")}constructor(e,f){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(e)}: ${f}`,{name:"AnalyticsSqlError",status:e})}},v=d(t=>{let e=t.fetch??globalThis.fetch,f=`${H}/${encodeURIComponent(t.accountId)}/analytics_engine/sql`;return{query:d(async s=>{let l=await e(f,{body:s,headers:{Authorization:`Bearer ${t.apiToken}`,"Content-Type":"text/plain"},method:"POST"});if(!l.ok)throw new E(l.status,await l.text());let n;try{n=await l.json()}catch{throw new E(l.status,"Analytics Engine SQL API returned a non-JSON body.")}let o=n,a=o.data??[];return{columns:o.meta??[],rowCount:o.rows??a.length,rows:a}},"query")}},"createAnalyticsSqlClient");var m=b(U(),1);var r=b(F(),1);var W="ANALYTICS",P=[{key:"volume",sql:d(t=>`SELECT blob2 AS fn, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:d(t=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:d(t=>`SELECT blob3 AS shard, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],j={error:null,loading:!0,result:null},G=d(t=>{let e=(0,M.c)(27),{state:f,title:p}=t,s=T(),{error:l,loading:n,result:o}=f,a=`analytics-panel-${p}`,i;e[0]!==s||e[1]!==p?(i=s(p),e[0]=s,e[1]=p,e[2]=i):i=e[2];let c;e[3]!==i?(c=(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i},void 0,!1)},void 0,!1),e[3]=i,e[4]=c):c=e[4];let u;e[5]!==n||e[6]!==s?(u=n&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:s("Loading\u2026")},void 0,!1),e[5]=n,e[6]=s,e[7]=u):u=e[7];let y;e[8]!==l||e[9]!==n?(y=!n&&l!==null&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:l},void 0,!1),e[8]=l,e[9]=n,e[10]=y):y=e[10];let h;e[11]!==l||e[12]!==n||e[13]!==o||e[14]!==s?(h=!n&&l===null&&o!==null&&o.rows.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:s("No data points yet.")},void 0,!1),e[11]=l,e[12]=n,e[13]=o,e[14]=s,e[15]=h):h=e[15];let A;e[16]!==l||e[17]!==n||e[18]!==o?(A=!n&&l===null&&o!==null&&o.rows.length>0&&(0,r.jsxDEV)(k,{children:[(0,r.jsxDEV)(N,{children:(0,r.jsxDEV)(x,{children:o.columns.map(Q)},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{children:o.rows.map((B,$)=>(0,r.jsxDEV)(x,{children:o.columns.map(R=>(0,r.jsxDEV)(D,{className:"font-mono text-xs",children:_(B[R.name])},R.name,!1))},$,!1))},void 0,!1)]},void 0,!0),e[16]=l,e[17]=n,e[18]=o,e[19]=A):A=e[19];let S;return e[20]!==a||e[21]!==c||e[22]!==u||e[23]!==y||e[24]!==h||e[25]!==A?(S=(0,r.jsxDEV)(g,{className:"gap-0 py-0","data-testid":a,children:[c,u,y,h,A]},void 0,!0),e[20]=a,e[21]=c,e[22]=u,e[23]=y,e[24]=h,e[25]=A,e[26]=S):S=e[26],S},"PanelResult"),re=d(({config:t,dataset:e=W,runQuery:f}={})=>{let p=T(),[s,l]=(0,m.useState)({}),n=(0,m.useMemo)(()=>{if(f!==void 0)return f;if(t===void 0)return null;let a=v({accountId:t.accountId,apiToken:t.apiToken});return i=>a.query(i)},[t,f]),o=(0,m.useCallback)(async a=>{if(n!==null)for(let i of P){if(a.cancelled)return;l(c=>({...c,[i.key]:{error:null,loading:!0,result:null}}));try{let c=await n(i.sql(e));a.cancelled||l(u=>({...u,[i.key]:{error:null,loading:!1,result:c}}))}catch(c){a.cancelled||l(u=>({...u,[i.key]:{error:I(c),loading:!1,result:null}}))}}},[n,e]);return(0,m.useEffect)(()=>{let a={cancelled:!1};return w(o(a)),()=>{a.cancelled=!0}},[o]),n===null?(0,r.jsxDEV)(C,{description:p("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,r.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1)},void 0,!1),testId:"analytics-not-configured",title:p("Analytics is not configured.")},void 0,!1):(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:P.map(a=>(0,r.jsxDEV)(G,{state:s[a.key]??j,title:a.title},a.key,!1))},void 0,!1)},"AnalyticsPanel");function Q(t){return(0,r.jsxDEV)(q,{children:t.name},t.name,!1)}d(Q,"_temp");export{re as AnalyticsPanel};
1
+ import{a as k,b as N,c as O,d as x,e as q,f as D}from"./chunk-GTM65MVX.js";import{a as g}from"./chunk-SEU5V7I6.js";import{a as C}from"./chunk-TAD43CG5.js";import{d as T,h as I,k as _,l as w}from"./chunk-ITQKVEP7.js";import{b as L}from"./chunk-22C6COGE.js";import{a as d,e as b,f as U,g as Y,h as F}from"./chunk-RRCPZMC2.js";var M=b(Y(),1);var H="https://api.cloudflare.com/client/v4/accounts",E=class extends L{static{d(this,"AnalyticsSqlError")}constructor(e,f){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(e)}: ${f}`,{name:"AnalyticsSqlError",status:e})}},v=d(t=>{let e=t.fetch??globalThis.fetch,f=`${H}/${encodeURIComponent(t.accountId)}/analytics_engine/sql`;return{query:d(async s=>{let l=await e(f,{body:s,headers:{Authorization:`Bearer ${t.apiToken}`,"Content-Type":"text/plain"},method:"POST"});if(!l.ok)throw new E(l.status,await l.text());let n;try{n=await l.json()}catch{throw new E(l.status,"Analytics Engine SQL API returned a non-JSON body.")}let o=n,a=o.data??[];return{columns:o.meta??[],rowCount:o.rows??a.length,rows:a}},"query")}},"createAnalyticsSqlClient");var m=b(U(),1);var r=b(F(),1);var W="ANALYTICS",P=[{key:"volume",sql:d(t=>`SELECT blob2 AS fn, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:d(t=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:d(t=>`SELECT blob3 AS shard, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],j={error:null,loading:!0,result:null},G=d(t=>{let e=(0,M.c)(27),{state:f,title:p}=t,s=T(),{error:l,loading:n,result:o}=f,a=`analytics-panel-${p}`,i;e[0]!==s||e[1]!==p?(i=s(p),e[0]=s,e[1]=p,e[2]=i):i=e[2];let c;e[3]!==i?(c=(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i},void 0,!1)},void 0,!1),e[3]=i,e[4]=c):c=e[4];let u;e[5]!==n||e[6]!==s?(u=n&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:s("Loading\u2026")},void 0,!1),e[5]=n,e[6]=s,e[7]=u):u=e[7];let y;e[8]!==l||e[9]!==n?(y=!n&&l!==null&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:l},void 0,!1),e[8]=l,e[9]=n,e[10]=y):y=e[10];let h;e[11]!==l||e[12]!==n||e[13]!==o||e[14]!==s?(h=!n&&l===null&&o!==null&&o.rows.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:s("No data points yet.")},void 0,!1),e[11]=l,e[12]=n,e[13]=o,e[14]=s,e[15]=h):h=e[15];let A;e[16]!==l||e[17]!==n||e[18]!==o?(A=!n&&l===null&&o!==null&&o.rows.length>0&&(0,r.jsxDEV)(k,{children:[(0,r.jsxDEV)(N,{children:(0,r.jsxDEV)(x,{children:o.columns.map(Q)},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{children:o.rows.map((B,$)=>(0,r.jsxDEV)(x,{children:o.columns.map(R=>(0,r.jsxDEV)(D,{className:"font-mono text-xs",children:_(B[R.name])},R.name,!1))},$,!1))},void 0,!1)]},void 0,!0),e[16]=l,e[17]=n,e[18]=o,e[19]=A):A=e[19];let S;return e[20]!==a||e[21]!==c||e[22]!==u||e[23]!==y||e[24]!==h||e[25]!==A?(S=(0,r.jsxDEV)(g,{className:"gap-0 py-0","data-testid":a,children:[c,u,y,h,A]},void 0,!0),e[20]=a,e[21]=c,e[22]=u,e[23]=y,e[24]=h,e[25]=A,e[26]=S):S=e[26],S},"PanelResult"),re=d(({config:t,dataset:e=W,runQuery:f}={})=>{let p=T(),[s,l]=(0,m.useState)({}),n=(0,m.useMemo)(()=>{if(f!==void 0)return f;if(t===void 0)return null;let a=v({accountId:t.accountId,apiToken:t.apiToken});return i=>a.query(i)},[t,f]),o=(0,m.useCallback)(async a=>{if(n!==null)for(let i of P){if(a.cancelled)return;l(c=>({...c,[i.key]:{error:null,loading:!0,result:null}}));try{let c=await n(i.sql(e));a.cancelled||l(u=>({...u,[i.key]:{error:null,loading:!1,result:c}}))}catch(c){a.cancelled||l(u=>({...u,[i.key]:{error:I(c),loading:!1,result:null}}))}}},[n,e]);return(0,m.useEffect)(()=>{let a={cancelled:!1};return w(o(a)),()=>{a.cancelled=!0}},[o]),n===null?(0,r.jsxDEV)(C,{description:p("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,r.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1)},void 0,!1),testId:"analytics-not-configured",title:p("Analytics is not configured.")},void 0,!1):(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:P.map(a=>(0,r.jsxDEV)(G,{state:s[a.key]??j,title:a.title},a.key,!1))},void 0,!1)},"AnalyticsPanel");function Q(t){return(0,r.jsxDEV)(q,{children:t.name},t.name,!1)}d(Q,"_temp");export{re as AnalyticsPanel};