tokentracker-cli 0.37.0 → 0.38.0

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 (43) hide show
  1. package/dashboard/dist/assets/{ActivityHeatmap-CHyQx8kb.js → ActivityHeatmap-DN2mmuWt.js} +1 -1
  2. package/dashboard/dist/assets/{Card-DnFsEPmk.js → Card-eNDH0TxH.js} +1 -1
  3. package/dashboard/dist/assets/{DashboardPage-C7Ec-LrI.js → DashboardPage-CzS5TxMe.js} +1 -1
  4. package/dashboard/dist/assets/{DevicePage-DFp21WlU.js → DevicePage-DEVImOIW.js} +1 -1
  5. package/dashboard/dist/assets/{DialogTitle-C7CwLbYz.js → DialogTitle-BJKAi66j.js} +1 -1
  6. package/dashboard/dist/assets/{FadeIn-CmqK4vog.js → FadeIn-DFk4dbUG.js} +1 -1
  7. package/dashboard/dist/assets/{HeaderGithubStar-Cu0-A7WB.js → HeaderGithubStar-D-r1KB-R.js} +1 -1
  8. package/dashboard/dist/assets/{IpCheckPage-Ct9pgqbB.js → IpCheckPage-D4FmaQyH.js} +1 -1
  9. package/dashboard/dist/assets/{LandingPage-Bb4n4XoT.js → LandingPage-DLwmI1xA.js} +1 -1
  10. package/dashboard/dist/assets/{LeaderboardAvatar-snuxOX5K.js → LeaderboardAvatar-DDZO2W2u.js} +1 -1
  11. package/dashboard/dist/assets/{LeaderboardPage-B-kigZ8J.js → LeaderboardPage-DcdnX8ha.js} +3 -3
  12. package/dashboard/dist/assets/{LeaderboardProfileModal-OqodFCGv.js → LeaderboardProfileModal-D3PwKHWY.js} +1 -1
  13. package/dashboard/dist/assets/{LeaderboardProfilePage-BspW68Xd.js → LeaderboardProfilePage-CnAg45qs.js} +1 -1
  14. package/dashboard/dist/assets/{LimitsPage-CS2NBEIP.js → LimitsPage-onwdR9lM.js} +1 -1
  15. package/dashboard/dist/assets/{LocalOnlyNotice-D0XXnH8l.js → LocalOnlyNotice-CbVonMVs.js} +1 -1
  16. package/dashboard/dist/assets/{LoginPage-8S9O3Gsb.js → LoginPage-DZpN9E7q.js} +1 -1
  17. package/dashboard/dist/assets/{PopoverPopup-BJb6Du8x.js → PopoverPopup-DCGh4euQ.js} +1 -1
  18. package/dashboard/dist/assets/{Select-DksFSHRb.js → Select-aIEVSJVR.js} +1 -1
  19. package/dashboard/dist/assets/{SelectItemText-DmE9ZyEL.js → SelectItemText-BH_vsFMS.js} +1 -1
  20. package/dashboard/dist/assets/{SettingsPage-BDRMT04n.js → SettingsPage-D2jlgb1x.js} +1 -1
  21. package/dashboard/dist/assets/{SkillsPage-DPHemuRK.js → SkillsPage-CTVaKIo2.js} +1 -1
  22. package/dashboard/dist/assets/{WidgetsPage-BOX3tPr8.js → WidgetsPage-B67l27g8.js} +1 -1
  23. package/dashboard/dist/assets/{WrappedPage-DWVJ6uf1.js → WrappedPage-wY4L8E_D.js} +1 -1
  24. package/dashboard/dist/assets/{agent-logos-C2IT3yLV.js → agent-logos-Bfb8Gcna.js} +1 -1
  25. package/dashboard/dist/assets/{arrow-up-right-CnvG5D97.js → arrow-up-right-RH7MeYHL.js} +1 -1
  26. package/dashboard/dist/assets/{download-C1zysMDD.js → download-Ds1ViaQ9.js} +1 -1
  27. package/dashboard/dist/assets/{info-DnI8z26t.js → info-DD3Xh30V.js} +1 -1
  28. package/dashboard/dist/assets/{main-BpChBpB7.js → main-BZBATt4l.js} +2 -2
  29. package/dashboard/dist/assets/{use-limits-display-prefs-sb2nFpV_.js → use-limits-display-prefs-C9k19eUo.js} +1 -1
  30. package/dashboard/dist/assets/{use-native-settings-DWh-bpfp.js → use-native-settings-HjLLYUkn.js} +1 -1
  31. package/dashboard/dist/assets/{use-usage-limits-DLSUBzW9.js → use-usage-limits-iJ3HJWfz.js} +1 -1
  32. package/dashboard/dist/assets/{useCurrency-B1Aa7Unc.js → useCurrency-Cr1NSPgK.js} +1 -1
  33. package/dashboard/dist/assets/{useOpenInteractionType-2Q4xhr62.js → useOpenInteractionType-B65bQ4-n.js} +1 -1
  34. package/dashboard/dist/index.html +1 -1
  35. package/dashboard/dist/share.html +1 -1
  36. package/package.json +1 -1
  37. package/src/commands/init.js +3 -3
  38. package/src/commands/status.js +9 -4
  39. package/src/commands/sync.js +26 -0
  40. package/src/lib/pricing/curated-overrides.json +1 -0
  41. package/src/lib/pricing/seed-snapshot.json +1 -1
  42. package/src/lib/rollout.js +208 -0
  43. package/src/lib/usage-limits.js +15 -1
@@ -1 +1 @@
1
- import{am as Y,aB as Z,Q as ee,r,A as s,j as e,L as G,N as v}from"./main-BpChBpB7.js";function te(n){const a=new URLSearchParams(n).get("next");return typeof a!="string"||a.length===0||!a.startsWith("/")||a.startsWith("//")?"/dashboard":a}const Q={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",linkedin:"LinkedIn",facebook:"Facebook",instagram:"Instagram",tiktok:"TikTok",apple:"Apple",x:"X",spotify:"Spotify"};function V(n){const a=String(n||"").trim();return Q[a]?Q[a]:a.replace(/-/g," ")}function ie(){const n=Y(),[a,A]=Z(),{enabled:o,loading:g,signedIn:f,refreshUser:C,signInWithPassword:E,signUp:M,signInWithOAuth:I,getPublicAuthConfig:F}=ee(),m=r.useMemo(()=>te(a.toString()),[a]),[l,j]=r.useState("signin"),[x,$]=r.useState(""),[h,H]=r.useState(""),[N,X]=r.useState(""),[k,p]=r.useState(!1),[O,c]=r.useState(null),[B,b]=r.useState(null),[S,U]=r.useState(!0),[_,R]=r.useState([]),[P,T]=r.useState([]),[W,z]=r.useState(8);r.useEffect(()=>{const t=a.get("insforge_status"),i=a.get("insforge_type"),u=a.get("insforge_error");t==="success"&&i==="verify_email"?b(s("login.verify_email_success")):t==="error"&&i==="verify_email"&&u&&b(s("shared.error.prefix",{error:u}))},[a]),r.useEffect(()=>{if(!o){U(!1);return}let t=!0;return(async()=>{const{data:i,error:u}=await F();t&&(u||!i?(R(["google","github"]),T([])):(R(Array.isArray(i.oAuthProviders)?i.oAuthProviders:[]),T(Array.isArray(i.customOAuthProviders)?i.customOAuthProviders:[]),typeof i.passwordMinLength=="number"&&i.passwordMinLength>0&&z(i.passwordMinLength)),U(!1))})(),()=>{t=!1}},[o,F]);const d=r.useMemo(()=>a.get("native")==="1",[a]),y=r.useMemo(()=>a.get("provider")||null,[a]);r.useEffect(()=>{if(!(!o||g)&&f){if(d){window.location.href="/auth/native-callback";return}n(m,{replace:!0})}},[o,g,f,n,m,d]),r.useEffect(()=>{o&&C()},[o,C]);const q=r.useMemo(()=>typeof window>"u"||d?"":`${window.location.origin}/`,[d]),D=r.useMemo(()=>typeof window>"u"?"":`${window.location.origin}/`,[]),J=r.useCallback(async t=>{t.preventDefault(),c(null),p(!0);try{if(l==="signup"){const{data:u,error:L}=await M({email:x.trim(),password:h,name:N.trim()||void 0,redirectTo:D});if(L){c(L.message||String(L));return}if(u?.requireEmailVerification){b(s("login.verify_email_pending")),j("signin");return}n(m,{replace:!0});return}const{error:i}=await E({email:x.trim(),password:h});if(i){c(i.message||String(i));return}n(m,{replace:!0})}finally{p(!1)}},[l,x,h,N,M,E,n,m,D]),w=r.useCallback(async t=>{c(null),p(!0);try{const{error:i}=await I(t,q);i&&c(i.message||String(i))}finally{p(!1)}},[I,q]);r.useEffect(()=>{if(d&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[d]),r.useEffect(()=>{if(!o||g||f||S||!d||!y)return;[..._,...P].includes(y)&&w(y)},[o,g,f,S,d,y,_,P,w]);const K=r.useCallback(()=>{A(t=>{const i=new URLSearchParams(t);return i.delete("insforge_status"),i.delete("insforge_type"),i.delete("insforge_error"),i},{replace:!0}),b(null)},[A]);return o?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold text-white tracking-tight",children:s("login.title")}),e.jsx("p",{className:"mt-2 text-sm text-oai-gray-500",children:s("login.subtitle")})]}),B?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:B}),e.jsx("button",{type:"button",onClick:K,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,O?e.jsx("p",{className:"text-sm text-red-400",role:"alert",children:s("shared.error.prefix",{error:O})}):null,e.jsx("div",{className:"space-y-3",children:S?e.jsx("div",{className:"h-11 rounded-lg bg-oai-gray-900 animate-pulse","aria-hidden":!0}):e.jsxs(e.Fragment,{children:[_.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t)),P.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t))]})}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center","aria-hidden":!0,children:e.jsx("span",{className:"w-full border-t border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-oai-gray-950 px-3 text-oai-gray-600",children:s("login.divider")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-800 p-0.5 bg-oai-gray-900/50",children:[e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signin"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signin"),c(null)},children:s("login.tab.sign_in")}),e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signup"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signup"),c(null)},children:s("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:J,className:"space-y-4",children:[l==="signup"?e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.name")}),e.jsx("input",{id:"login-name",type:"text",autoComplete:"name",value:N,onChange:t=>X(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:s("login.field.name_placeholder")})]}):null,e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.email")}),e.jsx("input",{id:"login-email",type:"email",autoComplete:"email",required:!0,value:x,onChange:t=>$(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.password")}),e.jsx("input",{id:"login-password",type:"password",autoComplete:l==="signup"?"new-password":"current-password",required:!0,minLength:l==="signup"?W:void 0,value:h,onChange:t=>H(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),l==="signup"?e.jsx("p",{className:"mt-1 text-xs text-oai-gray-600",children:s("login.password_hint",{min:String(W)})}):null]}),e.jsx("button",{type:"submit",disabled:k||g,className:"w-full h-11 rounded-lg bg-white text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:l==="signup"?s("login.submit.sign_up"):s("login.submit.sign_in")})]})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{ie as LoginPage};
1
+ import{am as Y,aB as Z,Q as ee,r,A as s,j as e,L as G,N as v}from"./main-BZBATt4l.js";function te(n){const a=new URLSearchParams(n).get("next");return typeof a!="string"||a.length===0||!a.startsWith("/")||a.startsWith("//")?"/dashboard":a}const Q={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",linkedin:"LinkedIn",facebook:"Facebook",instagram:"Instagram",tiktok:"TikTok",apple:"Apple",x:"X",spotify:"Spotify"};function V(n){const a=String(n||"").trim();return Q[a]?Q[a]:a.replace(/-/g," ")}function ie(){const n=Y(),[a,A]=Z(),{enabled:o,loading:g,signedIn:f,refreshUser:C,signInWithPassword:E,signUp:M,signInWithOAuth:I,getPublicAuthConfig:F}=ee(),m=r.useMemo(()=>te(a.toString()),[a]),[l,j]=r.useState("signin"),[x,$]=r.useState(""),[h,H]=r.useState(""),[N,X]=r.useState(""),[k,p]=r.useState(!1),[O,c]=r.useState(null),[B,b]=r.useState(null),[S,U]=r.useState(!0),[_,R]=r.useState([]),[P,T]=r.useState([]),[W,z]=r.useState(8);r.useEffect(()=>{const t=a.get("insforge_status"),i=a.get("insforge_type"),u=a.get("insforge_error");t==="success"&&i==="verify_email"?b(s("login.verify_email_success")):t==="error"&&i==="verify_email"&&u&&b(s("shared.error.prefix",{error:u}))},[a]),r.useEffect(()=>{if(!o){U(!1);return}let t=!0;return(async()=>{const{data:i,error:u}=await F();t&&(u||!i?(R(["google","github"]),T([])):(R(Array.isArray(i.oAuthProviders)?i.oAuthProviders:[]),T(Array.isArray(i.customOAuthProviders)?i.customOAuthProviders:[]),typeof i.passwordMinLength=="number"&&i.passwordMinLength>0&&z(i.passwordMinLength)),U(!1))})(),()=>{t=!1}},[o,F]);const d=r.useMemo(()=>a.get("native")==="1",[a]),y=r.useMemo(()=>a.get("provider")||null,[a]);r.useEffect(()=>{if(!(!o||g)&&f){if(d){window.location.href="/auth/native-callback";return}n(m,{replace:!0})}},[o,g,f,n,m,d]),r.useEffect(()=>{o&&C()},[o,C]);const q=r.useMemo(()=>typeof window>"u"||d?"":`${window.location.origin}/`,[d]),D=r.useMemo(()=>typeof window>"u"?"":`${window.location.origin}/`,[]),J=r.useCallback(async t=>{t.preventDefault(),c(null),p(!0);try{if(l==="signup"){const{data:u,error:L}=await M({email:x.trim(),password:h,name:N.trim()||void 0,redirectTo:D});if(L){c(L.message||String(L));return}if(u?.requireEmailVerification){b(s("login.verify_email_pending")),j("signin");return}n(m,{replace:!0});return}const{error:i}=await E({email:x.trim(),password:h});if(i){c(i.message||String(i));return}n(m,{replace:!0})}finally{p(!1)}},[l,x,h,N,M,E,n,m,D]),w=r.useCallback(async t=>{c(null),p(!0);try{const{error:i}=await I(t,q);i&&c(i.message||String(i))}finally{p(!1)}},[I,q]);r.useEffect(()=>{if(d&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[d]),r.useEffect(()=>{if(!o||g||f||S||!d||!y)return;[..._,...P].includes(y)&&w(y)},[o,g,f,S,d,y,_,P,w]);const K=r.useCallback(()=>{A(t=>{const i=new URLSearchParams(t);return i.delete("insforge_status"),i.delete("insforge_type"),i.delete("insforge_error"),i},{replace:!0}),b(null)},[A]);return o?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold text-white tracking-tight",children:s("login.title")}),e.jsx("p",{className:"mt-2 text-sm text-oai-gray-500",children:s("login.subtitle")})]}),B?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:B}),e.jsx("button",{type:"button",onClick:K,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,O?e.jsx("p",{className:"text-sm text-red-400",role:"alert",children:s("shared.error.prefix",{error:O})}):null,e.jsx("div",{className:"space-y-3",children:S?e.jsx("div",{className:"h-11 rounded-lg bg-oai-gray-900 animate-pulse","aria-hidden":!0}):e.jsxs(e.Fragment,{children:[_.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t)),P.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t))]})}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center","aria-hidden":!0,children:e.jsx("span",{className:"w-full border-t border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-oai-gray-950 px-3 text-oai-gray-600",children:s("login.divider")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-800 p-0.5 bg-oai-gray-900/50",children:[e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signin"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signin"),c(null)},children:s("login.tab.sign_in")}),e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signup"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signup"),c(null)},children:s("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:J,className:"space-y-4",children:[l==="signup"?e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.name")}),e.jsx("input",{id:"login-name",type:"text",autoComplete:"name",value:N,onChange:t=>X(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:s("login.field.name_placeholder")})]}):null,e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.email")}),e.jsx("input",{id:"login-email",type:"email",autoComplete:"email",required:!0,value:x,onChange:t=>$(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.password")}),e.jsx("input",{id:"login-password",type:"password",autoComplete:l==="signup"?"new-password":"current-password",required:!0,minLength:l==="signup"?W:void 0,value:h,onChange:t=>H(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),l==="signup"?e.jsx("p",{className:"mt-1 text-xs text-oai-gray-600",children:s("login.password_hint",{min:String(W)})}):null]}),e.jsx("button",{type:"submit",disabled:k||g,className:"w-full h-11 rounded-lg bg-white text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:l==="signup"?s("login.submit.sign_up"):s("login.submit.sign_in")})]})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{ie as LoginPage};
@@ -1 +1 @@
1
- import{c as ve,r,bn as me,bo as Fe,bp as we,aX as $,b as W,bq as U,br as te,bs as Re,aY as ae,bt as de,bu as Q,ak as ne,bv as Te,aW as re,bw as ue,bx as Le,by as Ae,bz as le,bA as He,bB as je,j as V,bC as Be,u as De,a as pe,bD as Ne,bE as he,bF as _e,bG as Ye,bH as Ge,bI as Ve,bJ as Xe,bK as Ke,bL as Ue,bM as qe,b4 as We,bN as $e,b5 as ze}from"./main-BpChBpB7.js";import{i as oe,c as Ce,d as Pe,e as se,g as Je,R as Qe,P as Ze,f as q,F as et,h as tt,j as nt,k as ot,l as Se,u as rt,p as st,t as it,m as ct,I as at,n as ut,o as Oe,q as lt,r as ft}from"./useOpenInteractionType-2Q4xhr62.js";import{p as dt,f as pt,g as gt,h as mt,i as ht,j as Et,k as bt}from"./DialogTitle-C7CwLbYz.js";import{p as vt,q as Rt,r as ye,t as Tt,v as Ct}from"./SelectItemText-DmE9ZyEL.js";const Pt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xt=ve("chevron-right",Pt);const St=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kt=ve("loader-circle",St);function ie(o,e,t){if(t&&!oe(t))return 0;if(typeof o=="number")return o;if(typeof o=="function"){const l=o();return typeof l=="number"?l:l?.[e]}return o?.[e]}const fe=Fe("safe-polygon"),Ot=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${we}`;function yt(o){return o?!!o.closest(Ot):!1}function Ie(o){const e=r.useRef(void 0),t=r.useRef(!1),l=r.useRef(void 0),E=r.useRef(!0),g=r.useRef(!1),v=r.useRef(()=>{}),k=r.useRef(!1),s=me(),P=me(),i=r.useRef(void 0);return r.useMemo(()=>{const a=o.context.dataRef.current;return a.hoverInteractionState||(a.hoverInteractionState={pointerTypeRef:e,interactedInsideRef:t,handlerRef:l,blockMouseMoveRef:E,performedPointerEventsMutationRef:g,unbindMouseMoveRef:v,restTimeoutPendingRef:k,openChangeTimeout:s,restTimeout:P,handleCloseOptionsRef:i}),a.hoverInteractionState},[o,e,t,l,E,g,v,k,s,P,i])}const It=new Set(["click","mousedown"]);function Mt(o,e={}){const t="rootStore"in o?o.rootStore:o,l=t.useState("open"),E=t.useState("floatingElement"),g=t.useState("domReferenceElement"),{dataRef:v}=t.context,{enabled:k=!0,closeDelay:s=0,externalTree:P}=e,{pointerTypeRef:i,interactedInsideRef:a,handlerRef:L,performedPointerEventsMutationRef:H,unbindMouseMoveRef:F,restTimeoutPendingRef:u,openChangeTimeout:I,handleCloseOptionsRef:D}=Ie(t),f=Ce(P),B=Pe(),M=$(()=>a.current?!0:v.current.openEvent?It.has(v.current.openEvent.type):!1),x=$(()=>{const m=v.current.openEvent?.type;return m?.includes("mouse")&&m!=="mousedown"}),O=r.useCallback((m,w=!0)=>{const c=xt(s,i.current);c&&!L.current?I.start(c,()=>t.setOpen(!1,W(U,m))):w&&(I.clear(),t.setOpen(!1,W(U,m)))},[s,L,t,i,I]),T=$(()=>{F.current(),L.current=void 0}),_=$(()=>{if(H.current){const m=te(E).body;m.style.pointerEvents="",m.removeAttribute(fe),H.current=!1}}),N=$(m=>{const w=Re(m);if(!yt(w)){a.current=!1;return}a.current=!0});ae(()=>{l||(i.current=void 0,u.current=!1,a.current=!1,T(),_())},[l,i,u,a,T,_]),r.useEffect(()=>()=>{T()},[T]),r.useEffect(()=>_,[_]),ae(()=>{if(k&&l&&D.current?.blockPointerEvents&&x()&&de(g)&&E){H.current=!0;const m=te(E).body;m.setAttribute(fe,"");const w=g,c=E,n=f?.nodesRef.current.find(y=>y.id===B)?.context?.elements.floating;return n&&(n.style.pointerEvents=""),m.style.pointerEvents="none",w.style.pointerEvents="auto",c.style.pointerEvents="auto",()=>{m.style.pointerEvents="",w.style.pointerEvents="",c.style.pointerEvents=""}}},[k,l,g,E,D,x,f,B,H]),r.useEffect(()=>{if(!k)return;function m(y){if(M()||!v.current.floatingContext||!t.select("open"))return;const S=t.context.triggerElements;y.relatedTarget&&S.hasElement(y.relatedTarget)||(_(),T(),M()||O(y))}function w(y){I.clear(),_(),L.current?.(y),T()}function c(y){M()||O(y,!1)}const n=E;return n&&(n.addEventListener("mouseleave",m),n.addEventListener("mouseenter",w),n.addEventListener("mouseleave",c),n.addEventListener("pointerdown",N,!0)),()=>{n&&(n.removeEventListener("mouseleave",m),n.removeEventListener("mouseenter",w),n.removeEventListener("mouseleave",c),n.removeEventListener("pointerdown",N,!0))}})}function xt(o,e){return e&&!oe(e)?0:typeof o=="function"?o():o}function ce(o){return typeof o=="function"?o():o}const kt={current:null};function Ft(o,e={}){const t="rootStore"in o?o.rootStore:o,{dataRef:l,events:E}=t.context,{enabled:g=!0,delay:v=0,handleClose:k=null,mouseOnly:s=!1,restMs:P=0,move:i=!0,triggerElementRef:a=kt,externalTree:L,isActiveTrigger:H=!0}=e,F=Ce(L),{pointerTypeRef:u,interactedInsideRef:I,handlerRef:D,blockMouseMoveRef:f,performedPointerEventsMutationRef:B,unbindMouseMoveRef:M,restTimeoutPendingRef:x,openChangeTimeout:O,restTimeout:T,handleCloseOptionsRef:_}=Ie(t),N=se(k),m=se(v),w=se(P);H&&(_.current=N.current?.__options);const c=$(()=>I.current?!0:l.current.openEvent?["click","mousedown"].includes(l.current.openEvent.type):!1),n=r.useCallback((d,p=!0)=>{const R=ie(m.current,"close",u.current);R&&!D.current?O.start(R,()=>t.setOpen(!1,W(U,d))):p&&(O.clear(),t.setOpen(!1,W(U,d)))},[m,D,t,u,O]),y=$(()=>{M.current(),D.current=void 0}),S=$(()=>{if(B.current){const d=te(t.select("domReferenceElement")).body;d.style.pointerEvents="",d.removeAttribute(fe),B.current=!1}});r.useEffect(()=>{if(!g)return;function d(p){p.open||(O.clear(),T.clear(),f.current=!0,x.current=!1)}return E.on("openchange",d),()=>{E.off("openchange",d)}},[g,E,O,T,f,x]);const G=$(d=>{if(c()||!l.current.floatingContext)return;const p=t.context.triggerElements;if(d.relatedTarget&&p.hasElement(d.relatedTarget))return;const R=a.current;N.current?.({...l.current.floatingContext,tree:F,x:d.clientX,y:d.clientY,onClose(){S(),y(),!c()&&R===t.select("domReferenceElement")&&n(d)}})(d)});return r.useEffect(()=>{if(!g)return;const d=a.current??(H?t.select("domReferenceElement"):null);if(!de(d))return;function p(C){if(O.clear(),f.current=!1,s&&!oe(u.current)||ce(w.current)>0&&!ie(m.current,"open"))return;const A=ie(m.current,"open",u.current),Y=t.select("domReferenceElement"),b=t.context.triggerElements,K=(b.hasElement(C.target)||b.hasMatchingElement(J=>Q(J,C.target)))&&(!Y||!Q(Y,C.target)),h=C.currentTarget??null,j=t.select("open"),z=!j||K;K&&j?t.setOpen(!0,W(U,C,h)):A?O.start(A,()=>{z&&t.setOpen(!0,W(U,C,h))}):z&&t.setOpen(!0,W(U,C,h))}function R(C){if(c()){S();return}M.current();const A=t.select("domReferenceElement"),Y=te(A);T.clear(),x.current=!1;const b=t.context.triggerElements;if(C.relatedTarget&&b.hasElement(C.relatedTarget))return;if(N.current&&l.current.floatingContext){t.select("open")||O.clear();const h=a.current;D.current=N.current({...l.current.floatingContext,tree:F,x:C.clientX,y:C.clientY,onClose(){S(),y(),!c()&&h===t.select("domReferenceElement")&&n(C,!0)}});const j=D.current;j(C),Y.addEventListener("mousemove",j),M.current=()=>{Y.removeEventListener("mousemove",j)};return}(u.current!=="touch"||!Q(t.select("floatingElement"),C.relatedTarget))&&n(C)}function X(C){G(C)}return t.select("open")&&d.addEventListener("mouseleave",X),i&&d.addEventListener("mousemove",p,{once:!0}),d.addEventListener("mouseenter",p),d.addEventListener("mouseleave",R),()=>{d.removeEventListener("mouseleave",X),i&&d.removeEventListener("mousemove",p),d.removeEventListener("mouseenter",p),d.removeEventListener("mouseleave",R)}},[y,S,f,l,m,n,t,g,N,G,H,c,s,i,u,w,T,x,O,a,F,M,D]),r.useMemo(()=>{function d(p){u.current=p.pointerType}return{onPointerDown:d,onPointerEnter:d,onMouseMove(p){const{nativeEvent:R}=p,X=p.currentTarget,C=t.select("domReferenceElement"),A=t.context.triggerElements,Y=t.select("open"),b=(A.hasElement(p.target)||A.hasMatchingElement(h=>Q(h,p.target)))&&(!C||!Q(C,p.target));if(s&&!oe(u.current)||Y&&!b||ce(w.current)===0||!b&&x.current&&p.movementX**2+p.movementY**2<2)return;T.clear();function K(){if(x.current=!1,c())return;const h=t.select("open");!f.current&&(!h||b)&&t.setOpen(!0,W(U,R,X))}u.current==="touch"?ne.flushSync(()=>{K()}):b&&Y?K():(x.current=!0,T.start(ce(w.current),K))}}},[f,c,s,t,u,w,T,x])}function Ee(o,e){const[t,l]=o;let E=!1;const g=e.length;for(let v=0,k=g-1;v<g;k=v++){const[s,P]=e[v]||[0,0],[i,a]=e[k]||[0,0];P>=l!=a>=l&&t<=(i-s)*(l-P)/(a-P)+s&&(E=!E)}return E}function wt(o,e){return o[0]>=e.x&&o[0]<=e.x+e.width&&o[1]>=e.y&&o[1]<=e.y+e.height}function Lt(o={}){const{buffer:e=.5,blockPointerEvents:t=!1,requireIntent:l=!0}=o,E=new Te;let g=!1,v=null,k=null,s=typeof performance<"u"?performance.now():0;function P(a,L){const H=performance.now(),F=H-s;if(v===null||k===null||F===0)return v=a,k=L,s=H,null;const u=a-v,I=L-k,f=Math.sqrt(u*u+I*I)/F;return v=a,k=L,s=H,f}const i=({x:a,y:L,placement:H,elements:F,onClose:u,nodeId:I,tree:D})=>function(B){function M(){E.clear(),u()}if(E.clear(),!F.domReference||!F.floating||H==null||a==null||L==null)return;const{clientX:x,clientY:O}=B,T=[x,O],_=Re(B),N=B.type==="mouseleave",m=Q(F.floating,_),w=Q(F.domReference,_),c=F.domReference.getBoundingClientRect(),n=F.floating.getBoundingClientRect(),y=H.split("-")[0],S=a>n.right-n.width/2,G=L>n.bottom-n.height/2,d=wt(T,c),p=n.width>c.width,R=n.height>c.height,X=(p?c:n).left,C=(p?c:n).right,A=(R?c:n).top,Y=(R?c:n).bottom;if(m&&(g=!0,!N))return;if(w&&(g=!1),w&&!N){g=!0;return}if(N&&de(B.relatedTarget)&&Q(F.floating,B.relatedTarget)||D&&Je(D.nodesRef.current,I).some(({context:h})=>h?.open))return;if(y==="top"&&L>=c.bottom-1||y==="bottom"&&L<=c.top+1||y==="left"&&a>=c.right-1||y==="right"&&a<=c.left+1)return M();let b=[];switch(y){case"top":b=[[X,c.top+1],[X,n.bottom-1],[C,n.bottom-1],[C,c.top+1]];break;case"bottom":b=[[X,n.top+1],[X,c.bottom-1],[C,c.bottom-1],[C,n.top+1]];break;case"left":b=[[n.right-1,Y],[n.right-1,A],[c.left+1,A],[c.left+1,Y]];break;case"right":b=[[c.right-1,Y],[c.right-1,A],[n.left+1,A],[n.left+1,Y]];break}function K([h,j]){switch(y){case"top":{const z=[p?h+e/2:S?h+e*4:h-e*4,j+e+1],J=[p?h-e/2:S?h+e*4:h-e*4,j+e+1],Z=[[n.left,S||p?n.bottom-e:n.top],[n.right,S?p?n.bottom-e:n.top:n.bottom-e]];return[z,J,...Z]}case"bottom":{const z=[p?h+e/2:S?h+e*4:h-e*4,j-e],J=[p?h-e/2:S?h+e*4:h-e*4,j-e],Z=[[n.left,S||p?n.top+e:n.bottom],[n.right,S?p?n.top+e:n.bottom:n.top+e]];return[z,J,...Z]}case"left":{const z=[h+e+1,R?j+e/2:G?j+e*4:j-e*4],J=[h+e+1,R?j-e/2:G?j+e*4:j-e*4];return[...[[G||R?n.right-e:n.left,n.top],[G?R?n.right-e:n.left:n.right-e,n.bottom]],z,J]}case"right":{const z=[h-e,R?j+e/2:G?j+e*4:j-e*4],J=[h-e,R?j-e/2:G?j+e*4:j-e*4],Z=[[G||R?n.left+e:n.right,n.top],[G?R?n.left+e:n.right:n.left+e,n.bottom]];return[z,J,...Z]}default:return[]}}if(!Ee([x,O],b)){if(g&&!d)return M();if(!N&&l){const h=P(B.clientX,B.clientY);if(h!==null&&h<.1)return M()}Ee([x,O],K([a,L]))?!g&&l&&E.start(40,M):M()}};return i.__options={blockPointerEvents:t},i}const Me=r.createContext(void 0);function ee(o){const e=r.useContext(Me);if(e===void 0&&!o)throw new Error(re(47));return e}function At(){return{...pt(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const Ht={...dt,disabled:q(o=>o.disabled),instantType:q(o=>o.instantType),openMethod:q(o=>o.openMethod),openChangeReason:q(o=>o.openChangeReason),modal:q(o=>o.modal),stickIfOpen:q(o=>o.stickIfOpen),titleElementId:q(o=>o.titleElementId),descriptionElementId:q(o=>o.descriptionElementId),openOnHover:q(o=>o.openOnHover),closeDelay:q(o=>o.closeDelay),hasViewport:q(o=>o.hasViewport)};class ge extends Qe{constructor(e){const t={...At(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:r.createRef(),backdropRef:r.createRef(),internalBackdropRef:r.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:r.createRef(),beforeContentFocusGuardRef:r.createRef(),stickIfOpenTimeout:new Te,triggerElements:new Ze},Ht)}setOpen=(e,t)=>{const l=t.reason===U,E=t.reason===ue&&t.event.detail===0,g=!e&&(t.reason===Le||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;const v={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested,triggerElement:t.trigger};this.state.floatingRootContext.context.events?.emit("openchange",v);const s=()=>{const P={open:e,openChangeReason:t.reason},i=t.trigger?.id??null;(i||e)&&(P.activeTriggerId=i,P.activeTriggerElement=t.trigger??null),this.update(P)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Ae,()=>{this.set("stickIfOpen",!1)}),ne.flushSync(s)):s(),E||g?this.set("instantType",E?"click":"dismiss"):t.reason===le?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,t){const l=He(()=>new ge(t)).current,E=e??l;return je(l.disposeEffect),E}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function be({props:o}){const{children:e,open:t,defaultOpen:l=!1,onOpenChange:E,onOpenChangeComplete:g,modal:v=!1,handle:k,triggerId:s,defaultTriggerId:P=null}=o,i=ge.useStore(k?.store,{open:t??l,modal:v,activeTriggerId:s!==void 0?s:P});i.useControlledProp("open",t,l),i.useControlledProp("activeTriggerId",s,P);const a=i.useState("open"),L=i.useState("positionerElement"),H=i.useState("payload"),F=i.useState("openChangeReason");i.useContextCallback("onOpenChange",E),i.useContextCallback("onOpenChangeComplete",g);const{openMethod:u,triggerProps:I,reset:D}=tt(a);gt(i);const{forceUnmount:f}=mt(a,i,()=>{i.update({stickIfOpen:!0,openChangeReason:null}),D()});nt(a&&v===!0&&F!==U&&u!=="touch",L),r.useEffect(()=>{a||i.context.stickIfOpenTimeout.clear()},[i,a]);const B=r.useCallback(S=>{const G=W(S);return G.preventUnmountOnClose=()=>{i.set("preventUnmountingOnClose",!0)},G},[i]),M=r.useCallback(()=>{i.setOpen(!1,B(Be))},[i,B]);r.useImperativeHandle(o.actionsRef,()=>({unmount:f,close:M}),[f,M]);const x=ht({popupStore:i,onOpenChange:i.setOpen}),O=ot(x,{outsidePressEvent:{mouse:v==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),T=Et(x),{getReferenceProps:_,getFloatingProps:N,getTriggerProps:m}=Se([O,T]),w=r.useMemo(()=>_(I),[_,I]),c=r.useMemo(()=>m(I),[m,I]),n=r.useMemo(()=>N(),[N]);i.useSyncedValues({modal:v,openMethod:u,activeTriggerProps:w,inactiveTriggerProps:c,popupProps:n,floatingRootContext:x,nested:Pe()!=null});const y=r.useMemo(()=>({store:i}),[i]);return V.jsx(Me.Provider,{value:y,children:typeof e=="function"?e({payload:H}):e})}function Ut(o){return ee(!0)?V.jsx(be,{props:o}):V.jsx(et,{children:V.jsx(be,{props:o})})}const jt=300,qt=r.forwardRef(function(e,t){const{render:l,className:E,disabled:g=!1,nativeButton:v=!0,handle:k,payload:s,openOnHover:P=!1,delay:i=jt,closeDelay:a=0,id:L,...H}=e,F=ee(!0),u=k?.store??F?.store;if(!u)throw new Error(re(74));const I=rt(L),D=u.useState("isTriggerActive",I),f=u.useState("floatingRootContext"),B=u.useState("isOpenedByTrigger",I),M=r.useRef(null),{registerTrigger:x,isMountedByThisTrigger:O}=bt(I,M,u,{payload:s,disabled:g,openOnHover:P,closeDelay:a}),T=u.useState("openChangeReason"),_=u.useState("stickIfOpen"),N=u.useState("openMethod"),m=Ft(f,{enabled:f!=null&&P&&(N!=="touch"||T!==ue),mouseOnly:!0,move:!1,handleClose:Lt(),restMs:i,delay:{close:a},triggerElementRef:M,isActiveTrigger:D}),w=vt(f,{enabled:f!=null,stickIfOpen:_}),c=Se([w]),n=u.useState("triggerProps",O),y=r.useMemo(()=>({disabled:g,open:B}),[g,B]),{getButtonProps:S,buttonRef:G}=De({disabled:g,native:v}),d=r.useMemo(()=>({open(A){return A&&T===ue?st.open(A):it.open(A)}}),[T]),p=pe("button",e,{state:y,ref:[G,t,x,M],props:[c.getReferenceProps(),m,n,{[Ne]:"",id:I},H,S],stateAttributesMapping:d}),R=r.useRef(null),X=$(A=>{ne.flushSync(()=>{u.setOpen(!1,W(le,A.nativeEvent,A.currentTarget))}),_e(R.current)?.focus()}),C=$(A=>{const Y=u.select("positionerElement");if(Y&&Ye(A,Y))u.context.beforeContentFocusGuardRef.current?.focus();else{ne.flushSync(()=>{u.setOpen(!1,W(le,A.nativeEvent,A.currentTarget))});let b=Ge(u.context.triggerFocusTargetRef.current||M.current);for(;b!==null&&Q(Y,b);){const K=b;if(b=Ve(b),b===K)break}b?.focus()}});return D?V.jsxs(r.Fragment,{children:[V.jsx(he,{ref:R,onFocus:X}),V.jsx(r.Fragment,{children:p},I),V.jsx(he,{ref:u.context.triggerFocusTargetRef,onFocus:C})]}):V.jsx(r.Fragment,{children:p},I)}),xe=r.createContext(void 0);function Bt(){const o=r.useContext(xe);if(o===void 0)throw new Error(re(45));return o}const Wt=r.forwardRef(function(e,t){const{keepMounted:l=!1,...E}=e,{store:g}=ee();return g.useState("mounted")||l?V.jsx(xe.Provider,{value:l,children:V.jsx(Xe,{ref:t,...E,renderGuards:!1})}):null}),ke=r.createContext(void 0);function Dt(){const o=r.useContext(ke);if(!o)throw new Error(re(46));return o}const $t=r.forwardRef(function(e,t){const{render:l,className:E,anchor:g,positionMethod:v="absolute",side:k="bottom",align:s="center",sideOffset:P=0,alignOffset:i=0,collisionBoundary:a="clipping-ancestors",collisionPadding:L=5,arrowPadding:H=5,sticky:F=!1,disableAnchorTracking:u=!1,collisionAvoidance:I=Ke,...D}=e,{store:f}=ee(),B=Bt(),M=ct(),x=f.useState("floatingRootContext"),O=f.useState("mounted"),T=f.useState("open"),_=f.useState("openChangeReason"),N=f.useState("activeTriggerElement"),m=f.useState("modal"),w=f.useState("positionerElement"),c=f.useState("instantType"),n=f.useState("transitionStatus"),y=f.useState("hasViewport"),S=r.useRef(null),G=Ue(w,!1,!1),d=Rt({anchor:g,floatingRootContext:x,positionMethod:v,mounted:O,side:k,sideOffset:P,align:s,alignOffset:i,arrowPadding:H,collisionBoundary:a,collisionPadding:L,sticky:F,disableAnchorTracking:u,keepMounted:B,nodeId:M,collisionAvoidance:I,adaptiveOrigin:y?Tt:void 0}),p=r.useMemo(()=>{const b={};return T||(b.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...d.positionerStyles,...b}}},[T,O,d.positionerStyles]),R=r.useMemo(()=>({props:p,...d}),[p,d]),X=x?.select("domReferenceElement");ae(()=>{const b=X,K=S.current;if(b&&(S.current=b),K&&b&&b!==K){f.set("instantType",void 0);const h=new AbortController;return G(()=>{f.set("instantType","trigger-change")},h.signal),()=>{h.abort()}}},[X,G,f]);const C=r.useMemo(()=>({open:T,side:R.side,align:R.align,anchorHidden:R.anchorHidden,instant:c}),[T,R.side,R.align,R.anchorHidden,c]),A=r.useCallback(b=>{f.set("positionerElement",b)},[f]),Y=pe("div",e,{state:C,props:[R.props,ye(n),D],ref:[t,A],stateAttributesMapping:Oe});return V.jsxs(ke.Provider,{value:R,children:[O&&m===!0&&_!==U&&V.jsx(at,{ref:f.context.internalBackdropRef,inert:qe(!T),cutout:N}),V.jsx(ut,{id:M,children:Y})]})}),Nt={...Oe,...ze},zt=r.forwardRef(function(e,t){const{className:l,render:E,initialFocus:g,finalFocus:v,...k}=e,{store:s}=ee(),P=Dt(),i=Ct()!=null,a=s.useState("open"),L=s.useState("openMethod"),H=s.useState("instantType"),F=s.useState("transitionStatus"),u=s.useState("popupProps"),I=s.useState("titleElementId"),D=s.useState("descriptionElementId"),f=s.useState("modal"),B=s.useState("mounted"),M=s.useState("openChangeReason"),x=s.useState("activeTriggerElement"),O=s.useState("floatingRootContext");We({open:a,ref:s.context.popupRef,onComplete(){a&&s.context.onOpenChangeComplete?.(!0)}});const T=s.useState("disabled"),_=s.useState("openOnHover"),N=s.useState("closeDelay");Mt(O,{enabled:_&&!T,closeDelay:N});function m(S){return S==="touch"?s.context.popupRef.current:!0}const w=g===void 0?m:g,c=r.useMemo(()=>({open:a,side:P.side,align:P.align,instant:H,transitionStatus:F}),[a,P.side,P.align,H,F]),n=r.useCallback(S=>{s.set("popupElement",S)},[s]),y=pe("div",e,{state:c,ref:[t,s.context.popupRef,n],props:[u,{"aria-labelledby":I,"aria-describedby":D,onKeyDown(S){i&&ft.has(S.key)&&S.stopPropagation()}},ye(F),k],stateAttributesMapping:Nt});return V.jsx(lt,{context:O,openInteractionType:L,modal:f==="trap-focus",disabled:!B||M===U,initialFocus:w,returnFocus:v,restoreFocus:"popup",previousFocusableElement:$e(x)?x:void 0,nextFocusableElement:s.context.triggerFocusTargetRef,beforeContentFocusGuardRef:s.context.beforeContentFocusGuardRef,children:y})});export{Xt as C,Kt as L,Ut as P,qt as a,Wt as b,$t as c,zt as d};
1
+ import{c as ve,r,bn as me,bo as Fe,bp as we,aX as $,b as W,bq as U,br as te,bs as Re,aY as ae,bt as de,bu as Q,ak as ne,bv as Te,aW as re,bw as ue,bx as Le,by as Ae,bz as le,bA as He,bB as je,j as V,bC as Be,u as De,a as pe,bD as Ne,bE as he,bF as _e,bG as Ye,bH as Ge,bI as Ve,bJ as Xe,bK as Ke,bL as Ue,bM as qe,b4 as We,bN as $e,b5 as ze}from"./main-BZBATt4l.js";import{i as oe,c as Ce,d as Pe,e as se,g as Je,R as Qe,P as Ze,f as q,F as et,h as tt,j as nt,k as ot,l as Se,u as rt,p as st,t as it,m as ct,I as at,n as ut,o as Oe,q as lt,r as ft}from"./useOpenInteractionType-B65bQ4-n.js";import{p as dt,f as pt,g as gt,h as mt,i as ht,j as Et,k as bt}from"./DialogTitle-BJKAi66j.js";import{p as vt,q as Rt,r as ye,t as Tt,v as Ct}from"./SelectItemText-BH_vsFMS.js";const Pt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xt=ve("chevron-right",Pt);const St=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kt=ve("loader-circle",St);function ie(o,e,t){if(t&&!oe(t))return 0;if(typeof o=="number")return o;if(typeof o=="function"){const l=o();return typeof l=="number"?l:l?.[e]}return o?.[e]}const fe=Fe("safe-polygon"),Ot=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${we}`;function yt(o){return o?!!o.closest(Ot):!1}function Ie(o){const e=r.useRef(void 0),t=r.useRef(!1),l=r.useRef(void 0),E=r.useRef(!0),g=r.useRef(!1),v=r.useRef(()=>{}),k=r.useRef(!1),s=me(),P=me(),i=r.useRef(void 0);return r.useMemo(()=>{const a=o.context.dataRef.current;return a.hoverInteractionState||(a.hoverInteractionState={pointerTypeRef:e,interactedInsideRef:t,handlerRef:l,blockMouseMoveRef:E,performedPointerEventsMutationRef:g,unbindMouseMoveRef:v,restTimeoutPendingRef:k,openChangeTimeout:s,restTimeout:P,handleCloseOptionsRef:i}),a.hoverInteractionState},[o,e,t,l,E,g,v,k,s,P,i])}const It=new Set(["click","mousedown"]);function Mt(o,e={}){const t="rootStore"in o?o.rootStore:o,l=t.useState("open"),E=t.useState("floatingElement"),g=t.useState("domReferenceElement"),{dataRef:v}=t.context,{enabled:k=!0,closeDelay:s=0,externalTree:P}=e,{pointerTypeRef:i,interactedInsideRef:a,handlerRef:L,performedPointerEventsMutationRef:H,unbindMouseMoveRef:F,restTimeoutPendingRef:u,openChangeTimeout:I,handleCloseOptionsRef:D}=Ie(t),f=Ce(P),B=Pe(),M=$(()=>a.current?!0:v.current.openEvent?It.has(v.current.openEvent.type):!1),x=$(()=>{const m=v.current.openEvent?.type;return m?.includes("mouse")&&m!=="mousedown"}),O=r.useCallback((m,w=!0)=>{const c=xt(s,i.current);c&&!L.current?I.start(c,()=>t.setOpen(!1,W(U,m))):w&&(I.clear(),t.setOpen(!1,W(U,m)))},[s,L,t,i,I]),T=$(()=>{F.current(),L.current=void 0}),_=$(()=>{if(H.current){const m=te(E).body;m.style.pointerEvents="",m.removeAttribute(fe),H.current=!1}}),N=$(m=>{const w=Re(m);if(!yt(w)){a.current=!1;return}a.current=!0});ae(()=>{l||(i.current=void 0,u.current=!1,a.current=!1,T(),_())},[l,i,u,a,T,_]),r.useEffect(()=>()=>{T()},[T]),r.useEffect(()=>_,[_]),ae(()=>{if(k&&l&&D.current?.blockPointerEvents&&x()&&de(g)&&E){H.current=!0;const m=te(E).body;m.setAttribute(fe,"");const w=g,c=E,n=f?.nodesRef.current.find(y=>y.id===B)?.context?.elements.floating;return n&&(n.style.pointerEvents=""),m.style.pointerEvents="none",w.style.pointerEvents="auto",c.style.pointerEvents="auto",()=>{m.style.pointerEvents="",w.style.pointerEvents="",c.style.pointerEvents=""}}},[k,l,g,E,D,x,f,B,H]),r.useEffect(()=>{if(!k)return;function m(y){if(M()||!v.current.floatingContext||!t.select("open"))return;const S=t.context.triggerElements;y.relatedTarget&&S.hasElement(y.relatedTarget)||(_(),T(),M()||O(y))}function w(y){I.clear(),_(),L.current?.(y),T()}function c(y){M()||O(y,!1)}const n=E;return n&&(n.addEventListener("mouseleave",m),n.addEventListener("mouseenter",w),n.addEventListener("mouseleave",c),n.addEventListener("pointerdown",N,!0)),()=>{n&&(n.removeEventListener("mouseleave",m),n.removeEventListener("mouseenter",w),n.removeEventListener("mouseleave",c),n.removeEventListener("pointerdown",N,!0))}})}function xt(o,e){return e&&!oe(e)?0:typeof o=="function"?o():o}function ce(o){return typeof o=="function"?o():o}const kt={current:null};function Ft(o,e={}){const t="rootStore"in o?o.rootStore:o,{dataRef:l,events:E}=t.context,{enabled:g=!0,delay:v=0,handleClose:k=null,mouseOnly:s=!1,restMs:P=0,move:i=!0,triggerElementRef:a=kt,externalTree:L,isActiveTrigger:H=!0}=e,F=Ce(L),{pointerTypeRef:u,interactedInsideRef:I,handlerRef:D,blockMouseMoveRef:f,performedPointerEventsMutationRef:B,unbindMouseMoveRef:M,restTimeoutPendingRef:x,openChangeTimeout:O,restTimeout:T,handleCloseOptionsRef:_}=Ie(t),N=se(k),m=se(v),w=se(P);H&&(_.current=N.current?.__options);const c=$(()=>I.current?!0:l.current.openEvent?["click","mousedown"].includes(l.current.openEvent.type):!1),n=r.useCallback((d,p=!0)=>{const R=ie(m.current,"close",u.current);R&&!D.current?O.start(R,()=>t.setOpen(!1,W(U,d))):p&&(O.clear(),t.setOpen(!1,W(U,d)))},[m,D,t,u,O]),y=$(()=>{M.current(),D.current=void 0}),S=$(()=>{if(B.current){const d=te(t.select("domReferenceElement")).body;d.style.pointerEvents="",d.removeAttribute(fe),B.current=!1}});r.useEffect(()=>{if(!g)return;function d(p){p.open||(O.clear(),T.clear(),f.current=!0,x.current=!1)}return E.on("openchange",d),()=>{E.off("openchange",d)}},[g,E,O,T,f,x]);const G=$(d=>{if(c()||!l.current.floatingContext)return;const p=t.context.triggerElements;if(d.relatedTarget&&p.hasElement(d.relatedTarget))return;const R=a.current;N.current?.({...l.current.floatingContext,tree:F,x:d.clientX,y:d.clientY,onClose(){S(),y(),!c()&&R===t.select("domReferenceElement")&&n(d)}})(d)});return r.useEffect(()=>{if(!g)return;const d=a.current??(H?t.select("domReferenceElement"):null);if(!de(d))return;function p(C){if(O.clear(),f.current=!1,s&&!oe(u.current)||ce(w.current)>0&&!ie(m.current,"open"))return;const A=ie(m.current,"open",u.current),Y=t.select("domReferenceElement"),b=t.context.triggerElements,K=(b.hasElement(C.target)||b.hasMatchingElement(J=>Q(J,C.target)))&&(!Y||!Q(Y,C.target)),h=C.currentTarget??null,j=t.select("open"),z=!j||K;K&&j?t.setOpen(!0,W(U,C,h)):A?O.start(A,()=>{z&&t.setOpen(!0,W(U,C,h))}):z&&t.setOpen(!0,W(U,C,h))}function R(C){if(c()){S();return}M.current();const A=t.select("domReferenceElement"),Y=te(A);T.clear(),x.current=!1;const b=t.context.triggerElements;if(C.relatedTarget&&b.hasElement(C.relatedTarget))return;if(N.current&&l.current.floatingContext){t.select("open")||O.clear();const h=a.current;D.current=N.current({...l.current.floatingContext,tree:F,x:C.clientX,y:C.clientY,onClose(){S(),y(),!c()&&h===t.select("domReferenceElement")&&n(C,!0)}});const j=D.current;j(C),Y.addEventListener("mousemove",j),M.current=()=>{Y.removeEventListener("mousemove",j)};return}(u.current!=="touch"||!Q(t.select("floatingElement"),C.relatedTarget))&&n(C)}function X(C){G(C)}return t.select("open")&&d.addEventListener("mouseleave",X),i&&d.addEventListener("mousemove",p,{once:!0}),d.addEventListener("mouseenter",p),d.addEventListener("mouseleave",R),()=>{d.removeEventListener("mouseleave",X),i&&d.removeEventListener("mousemove",p),d.removeEventListener("mouseenter",p),d.removeEventListener("mouseleave",R)}},[y,S,f,l,m,n,t,g,N,G,H,c,s,i,u,w,T,x,O,a,F,M,D]),r.useMemo(()=>{function d(p){u.current=p.pointerType}return{onPointerDown:d,onPointerEnter:d,onMouseMove(p){const{nativeEvent:R}=p,X=p.currentTarget,C=t.select("domReferenceElement"),A=t.context.triggerElements,Y=t.select("open"),b=(A.hasElement(p.target)||A.hasMatchingElement(h=>Q(h,p.target)))&&(!C||!Q(C,p.target));if(s&&!oe(u.current)||Y&&!b||ce(w.current)===0||!b&&x.current&&p.movementX**2+p.movementY**2<2)return;T.clear();function K(){if(x.current=!1,c())return;const h=t.select("open");!f.current&&(!h||b)&&t.setOpen(!0,W(U,R,X))}u.current==="touch"?ne.flushSync(()=>{K()}):b&&Y?K():(x.current=!0,T.start(ce(w.current),K))}}},[f,c,s,t,u,w,T,x])}function Ee(o,e){const[t,l]=o;let E=!1;const g=e.length;for(let v=0,k=g-1;v<g;k=v++){const[s,P]=e[v]||[0,0],[i,a]=e[k]||[0,0];P>=l!=a>=l&&t<=(i-s)*(l-P)/(a-P)+s&&(E=!E)}return E}function wt(o,e){return o[0]>=e.x&&o[0]<=e.x+e.width&&o[1]>=e.y&&o[1]<=e.y+e.height}function Lt(o={}){const{buffer:e=.5,blockPointerEvents:t=!1,requireIntent:l=!0}=o,E=new Te;let g=!1,v=null,k=null,s=typeof performance<"u"?performance.now():0;function P(a,L){const H=performance.now(),F=H-s;if(v===null||k===null||F===0)return v=a,k=L,s=H,null;const u=a-v,I=L-k,f=Math.sqrt(u*u+I*I)/F;return v=a,k=L,s=H,f}const i=({x:a,y:L,placement:H,elements:F,onClose:u,nodeId:I,tree:D})=>function(B){function M(){E.clear(),u()}if(E.clear(),!F.domReference||!F.floating||H==null||a==null||L==null)return;const{clientX:x,clientY:O}=B,T=[x,O],_=Re(B),N=B.type==="mouseleave",m=Q(F.floating,_),w=Q(F.domReference,_),c=F.domReference.getBoundingClientRect(),n=F.floating.getBoundingClientRect(),y=H.split("-")[0],S=a>n.right-n.width/2,G=L>n.bottom-n.height/2,d=wt(T,c),p=n.width>c.width,R=n.height>c.height,X=(p?c:n).left,C=(p?c:n).right,A=(R?c:n).top,Y=(R?c:n).bottom;if(m&&(g=!0,!N))return;if(w&&(g=!1),w&&!N){g=!0;return}if(N&&de(B.relatedTarget)&&Q(F.floating,B.relatedTarget)||D&&Je(D.nodesRef.current,I).some(({context:h})=>h?.open))return;if(y==="top"&&L>=c.bottom-1||y==="bottom"&&L<=c.top+1||y==="left"&&a>=c.right-1||y==="right"&&a<=c.left+1)return M();let b=[];switch(y){case"top":b=[[X,c.top+1],[X,n.bottom-1],[C,n.bottom-1],[C,c.top+1]];break;case"bottom":b=[[X,n.top+1],[X,c.bottom-1],[C,c.bottom-1],[C,n.top+1]];break;case"left":b=[[n.right-1,Y],[n.right-1,A],[c.left+1,A],[c.left+1,Y]];break;case"right":b=[[c.right-1,Y],[c.right-1,A],[n.left+1,A],[n.left+1,Y]];break}function K([h,j]){switch(y){case"top":{const z=[p?h+e/2:S?h+e*4:h-e*4,j+e+1],J=[p?h-e/2:S?h+e*4:h-e*4,j+e+1],Z=[[n.left,S||p?n.bottom-e:n.top],[n.right,S?p?n.bottom-e:n.top:n.bottom-e]];return[z,J,...Z]}case"bottom":{const z=[p?h+e/2:S?h+e*4:h-e*4,j-e],J=[p?h-e/2:S?h+e*4:h-e*4,j-e],Z=[[n.left,S||p?n.top+e:n.bottom],[n.right,S?p?n.top+e:n.bottom:n.top+e]];return[z,J,...Z]}case"left":{const z=[h+e+1,R?j+e/2:G?j+e*4:j-e*4],J=[h+e+1,R?j-e/2:G?j+e*4:j-e*4];return[...[[G||R?n.right-e:n.left,n.top],[G?R?n.right-e:n.left:n.right-e,n.bottom]],z,J]}case"right":{const z=[h-e,R?j+e/2:G?j+e*4:j-e*4],J=[h-e,R?j-e/2:G?j+e*4:j-e*4],Z=[[G||R?n.left+e:n.right,n.top],[G?R?n.left+e:n.right:n.left+e,n.bottom]];return[z,J,...Z]}default:return[]}}if(!Ee([x,O],b)){if(g&&!d)return M();if(!N&&l){const h=P(B.clientX,B.clientY);if(h!==null&&h<.1)return M()}Ee([x,O],K([a,L]))?!g&&l&&E.start(40,M):M()}};return i.__options={blockPointerEvents:t},i}const Me=r.createContext(void 0);function ee(o){const e=r.useContext(Me);if(e===void 0&&!o)throw new Error(re(47));return e}function At(){return{...pt(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const Ht={...dt,disabled:q(o=>o.disabled),instantType:q(o=>o.instantType),openMethod:q(o=>o.openMethod),openChangeReason:q(o=>o.openChangeReason),modal:q(o=>o.modal),stickIfOpen:q(o=>o.stickIfOpen),titleElementId:q(o=>o.titleElementId),descriptionElementId:q(o=>o.descriptionElementId),openOnHover:q(o=>o.openOnHover),closeDelay:q(o=>o.closeDelay),hasViewport:q(o=>o.hasViewport)};class ge extends Qe{constructor(e){const t={...At(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:r.createRef(),backdropRef:r.createRef(),internalBackdropRef:r.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:r.createRef(),beforeContentFocusGuardRef:r.createRef(),stickIfOpenTimeout:new Te,triggerElements:new Ze},Ht)}setOpen=(e,t)=>{const l=t.reason===U,E=t.reason===ue&&t.event.detail===0,g=!e&&(t.reason===Le||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;const v={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested,triggerElement:t.trigger};this.state.floatingRootContext.context.events?.emit("openchange",v);const s=()=>{const P={open:e,openChangeReason:t.reason},i=t.trigger?.id??null;(i||e)&&(P.activeTriggerId=i,P.activeTriggerElement=t.trigger??null),this.update(P)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Ae,()=>{this.set("stickIfOpen",!1)}),ne.flushSync(s)):s(),E||g?this.set("instantType",E?"click":"dismiss"):t.reason===le?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,t){const l=He(()=>new ge(t)).current,E=e??l;return je(l.disposeEffect),E}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function be({props:o}){const{children:e,open:t,defaultOpen:l=!1,onOpenChange:E,onOpenChangeComplete:g,modal:v=!1,handle:k,triggerId:s,defaultTriggerId:P=null}=o,i=ge.useStore(k?.store,{open:t??l,modal:v,activeTriggerId:s!==void 0?s:P});i.useControlledProp("open",t,l),i.useControlledProp("activeTriggerId",s,P);const a=i.useState("open"),L=i.useState("positionerElement"),H=i.useState("payload"),F=i.useState("openChangeReason");i.useContextCallback("onOpenChange",E),i.useContextCallback("onOpenChangeComplete",g);const{openMethod:u,triggerProps:I,reset:D}=tt(a);gt(i);const{forceUnmount:f}=mt(a,i,()=>{i.update({stickIfOpen:!0,openChangeReason:null}),D()});nt(a&&v===!0&&F!==U&&u!=="touch",L),r.useEffect(()=>{a||i.context.stickIfOpenTimeout.clear()},[i,a]);const B=r.useCallback(S=>{const G=W(S);return G.preventUnmountOnClose=()=>{i.set("preventUnmountingOnClose",!0)},G},[i]),M=r.useCallback(()=>{i.setOpen(!1,B(Be))},[i,B]);r.useImperativeHandle(o.actionsRef,()=>({unmount:f,close:M}),[f,M]);const x=ht({popupStore:i,onOpenChange:i.setOpen}),O=ot(x,{outsidePressEvent:{mouse:v==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),T=Et(x),{getReferenceProps:_,getFloatingProps:N,getTriggerProps:m}=Se([O,T]),w=r.useMemo(()=>_(I),[_,I]),c=r.useMemo(()=>m(I),[m,I]),n=r.useMemo(()=>N(),[N]);i.useSyncedValues({modal:v,openMethod:u,activeTriggerProps:w,inactiveTriggerProps:c,popupProps:n,floatingRootContext:x,nested:Pe()!=null});const y=r.useMemo(()=>({store:i}),[i]);return V.jsx(Me.Provider,{value:y,children:typeof e=="function"?e({payload:H}):e})}function Ut(o){return ee(!0)?V.jsx(be,{props:o}):V.jsx(et,{children:V.jsx(be,{props:o})})}const jt=300,qt=r.forwardRef(function(e,t){const{render:l,className:E,disabled:g=!1,nativeButton:v=!0,handle:k,payload:s,openOnHover:P=!1,delay:i=jt,closeDelay:a=0,id:L,...H}=e,F=ee(!0),u=k?.store??F?.store;if(!u)throw new Error(re(74));const I=rt(L),D=u.useState("isTriggerActive",I),f=u.useState("floatingRootContext"),B=u.useState("isOpenedByTrigger",I),M=r.useRef(null),{registerTrigger:x,isMountedByThisTrigger:O}=bt(I,M,u,{payload:s,disabled:g,openOnHover:P,closeDelay:a}),T=u.useState("openChangeReason"),_=u.useState("stickIfOpen"),N=u.useState("openMethod"),m=Ft(f,{enabled:f!=null&&P&&(N!=="touch"||T!==ue),mouseOnly:!0,move:!1,handleClose:Lt(),restMs:i,delay:{close:a},triggerElementRef:M,isActiveTrigger:D}),w=vt(f,{enabled:f!=null,stickIfOpen:_}),c=Se([w]),n=u.useState("triggerProps",O),y=r.useMemo(()=>({disabled:g,open:B}),[g,B]),{getButtonProps:S,buttonRef:G}=De({disabled:g,native:v}),d=r.useMemo(()=>({open(A){return A&&T===ue?st.open(A):it.open(A)}}),[T]),p=pe("button",e,{state:y,ref:[G,t,x,M],props:[c.getReferenceProps(),m,n,{[Ne]:"",id:I},H,S],stateAttributesMapping:d}),R=r.useRef(null),X=$(A=>{ne.flushSync(()=>{u.setOpen(!1,W(le,A.nativeEvent,A.currentTarget))}),_e(R.current)?.focus()}),C=$(A=>{const Y=u.select("positionerElement");if(Y&&Ye(A,Y))u.context.beforeContentFocusGuardRef.current?.focus();else{ne.flushSync(()=>{u.setOpen(!1,W(le,A.nativeEvent,A.currentTarget))});let b=Ge(u.context.triggerFocusTargetRef.current||M.current);for(;b!==null&&Q(Y,b);){const K=b;if(b=Ve(b),b===K)break}b?.focus()}});return D?V.jsxs(r.Fragment,{children:[V.jsx(he,{ref:R,onFocus:X}),V.jsx(r.Fragment,{children:p},I),V.jsx(he,{ref:u.context.triggerFocusTargetRef,onFocus:C})]}):V.jsx(r.Fragment,{children:p},I)}),xe=r.createContext(void 0);function Bt(){const o=r.useContext(xe);if(o===void 0)throw new Error(re(45));return o}const Wt=r.forwardRef(function(e,t){const{keepMounted:l=!1,...E}=e,{store:g}=ee();return g.useState("mounted")||l?V.jsx(xe.Provider,{value:l,children:V.jsx(Xe,{ref:t,...E,renderGuards:!1})}):null}),ke=r.createContext(void 0);function Dt(){const o=r.useContext(ke);if(!o)throw new Error(re(46));return o}const $t=r.forwardRef(function(e,t){const{render:l,className:E,anchor:g,positionMethod:v="absolute",side:k="bottom",align:s="center",sideOffset:P=0,alignOffset:i=0,collisionBoundary:a="clipping-ancestors",collisionPadding:L=5,arrowPadding:H=5,sticky:F=!1,disableAnchorTracking:u=!1,collisionAvoidance:I=Ke,...D}=e,{store:f}=ee(),B=Bt(),M=ct(),x=f.useState("floatingRootContext"),O=f.useState("mounted"),T=f.useState("open"),_=f.useState("openChangeReason"),N=f.useState("activeTriggerElement"),m=f.useState("modal"),w=f.useState("positionerElement"),c=f.useState("instantType"),n=f.useState("transitionStatus"),y=f.useState("hasViewport"),S=r.useRef(null),G=Ue(w,!1,!1),d=Rt({anchor:g,floatingRootContext:x,positionMethod:v,mounted:O,side:k,sideOffset:P,align:s,alignOffset:i,arrowPadding:H,collisionBoundary:a,collisionPadding:L,sticky:F,disableAnchorTracking:u,keepMounted:B,nodeId:M,collisionAvoidance:I,adaptiveOrigin:y?Tt:void 0}),p=r.useMemo(()=>{const b={};return T||(b.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...d.positionerStyles,...b}}},[T,O,d.positionerStyles]),R=r.useMemo(()=>({props:p,...d}),[p,d]),X=x?.select("domReferenceElement");ae(()=>{const b=X,K=S.current;if(b&&(S.current=b),K&&b&&b!==K){f.set("instantType",void 0);const h=new AbortController;return G(()=>{f.set("instantType","trigger-change")},h.signal),()=>{h.abort()}}},[X,G,f]);const C=r.useMemo(()=>({open:T,side:R.side,align:R.align,anchorHidden:R.anchorHidden,instant:c}),[T,R.side,R.align,R.anchorHidden,c]),A=r.useCallback(b=>{f.set("positionerElement",b)},[f]),Y=pe("div",e,{state:C,props:[R.props,ye(n),D],ref:[t,A],stateAttributesMapping:Oe});return V.jsxs(ke.Provider,{value:R,children:[O&&m===!0&&_!==U&&V.jsx(at,{ref:f.context.internalBackdropRef,inert:qe(!T),cutout:N}),V.jsx(ut,{id:M,children:Y})]})}),Nt={...Oe,...ze},zt=r.forwardRef(function(e,t){const{className:l,render:E,initialFocus:g,finalFocus:v,...k}=e,{store:s}=ee(),P=Dt(),i=Ct()!=null,a=s.useState("open"),L=s.useState("openMethod"),H=s.useState("instantType"),F=s.useState("transitionStatus"),u=s.useState("popupProps"),I=s.useState("titleElementId"),D=s.useState("descriptionElementId"),f=s.useState("modal"),B=s.useState("mounted"),M=s.useState("openChangeReason"),x=s.useState("activeTriggerElement"),O=s.useState("floatingRootContext");We({open:a,ref:s.context.popupRef,onComplete(){a&&s.context.onOpenChangeComplete?.(!0)}});const T=s.useState("disabled"),_=s.useState("openOnHover"),N=s.useState("closeDelay");Mt(O,{enabled:_&&!T,closeDelay:N});function m(S){return S==="touch"?s.context.popupRef.current:!0}const w=g===void 0?m:g,c=r.useMemo(()=>({open:a,side:P.side,align:P.align,instant:H,transitionStatus:F}),[a,P.side,P.align,H,F]),n=r.useCallback(S=>{s.set("popupElement",S)},[s]),y=pe("div",e,{state:c,ref:[t,s.context.popupRef,n],props:[u,{"aria-labelledby":I,"aria-describedby":D,onKeyDown(S){i&&ft.has(S.key)&&S.stopPropagation()}},ye(F),k],stateAttributesMapping:Nt});return V.jsx(lt,{context:O,openInteractionType:L,modal:f==="trap-focus",disabled:!B||M===U,initialFocus:w,returnFocus:v,restoreFocus:"popup",previousFocusableElement:$e(x)?x:void 0,nextFocusableElement:s.context.triggerFocusTargetRef,beforeContentFocusGuardRef:s.context.beforeContentFocusGuardRef,children:y})});export{Xt as C,Kt as L,Ut as P,qt as a,Wt as b,$t as c,zt as d};
@@ -1 +1 @@
1
- import{r as S,aX as v,a as w,j as e,N as y}from"./main-BpChBpB7.js";import{u as k,w as j,s as l,L as N,x as C,S as E,h as I,i as R,C as T,j as L,k as A,l as P,m as _,o as D,n as G}from"./SelectItemText-DmE9ZyEL.js";import{a as i,C as M}from"./useOpenInteractionType-2Q4xhr62.js";const O=S.forwardRef(function(s,o){const{className:n,render:f,...t}=s,{store:r,scrollHandlerRef:c}=k(),{alignItemWithTriggerActive:d}=j(),g=i(r,l.hasScrollArrows),u=i(r,l.openMethod),h=i(r,l.multiple),m={id:`${i(r,l.id)}-list`,role:"listbox","aria-multiselectable":h||void 0,onScroll(b){c.current?.(b.currentTarget)},...d&&{style:N},className:g&&u!=="touch"?C.className:void 0},x=v(b=>{r.set("listElement",b)});return w("div",s,{ref:[o,x],props:[m,t]})}),V="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function H({value:p,onValueChange:s,options:o=[],ariaLabel:n,id:f,disabled:t=!1,leadingIcon:r=null,className:c="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=o.map(a=>({value:a.value,label:a.label}));return e.jsxs(E,{value:p,items:h,disabled:t,onValueChange:a=>{!t&&a!=null&&s?.(a)},children:[e.jsxs(I,{id:f,"aria-label":n,className:y(V,t&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",c),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r,e.jsx(R,{className:"truncate"})]}),e.jsx(T,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(A,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(P,{className:y("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(O,{role:"listbox","aria-label":n,children:o.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:m,disabled:x})=>y("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",m?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",x&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(D,{children:e.jsx(M,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{H as S};
1
+ import{r as S,aX as v,a as w,j as e,N as y}from"./main-BZBATt4l.js";import{u as k,w as j,s as l,L as N,x as C,S as E,h as I,i as R,C as T,j as L,k as A,l as P,m as _,o as D,n as G}from"./SelectItemText-BH_vsFMS.js";import{a as i,C as M}from"./useOpenInteractionType-B65bQ4-n.js";const O=S.forwardRef(function(s,o){const{className:n,render:f,...t}=s,{store:r,scrollHandlerRef:c}=k(),{alignItemWithTriggerActive:d}=j(),g=i(r,l.hasScrollArrows),u=i(r,l.openMethod),h=i(r,l.multiple),m={id:`${i(r,l.id)}-list`,role:"listbox","aria-multiselectable":h||void 0,onScroll(b){c.current?.(b.currentTarget)},...d&&{style:N},className:g&&u!=="touch"?C.className:void 0},x=v(b=>{r.set("listElement",b)});return w("div",s,{ref:[o,x],props:[m,t]})}),V="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function H({value:p,onValueChange:s,options:o=[],ariaLabel:n,id:f,disabled:t=!1,leadingIcon:r=null,className:c="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=o.map(a=>({value:a.value,label:a.label}));return e.jsxs(E,{value:p,items:h,disabled:t,onValueChange:a=>{!t&&a!=null&&s?.(a)},children:[e.jsxs(I,{id:f,"aria-label":n,className:y(V,t&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",c),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r,e.jsx(R,{className:"truncate"})]}),e.jsx(T,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(A,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(P,{className:y("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(O,{role:"listbox","aria-label":n,children:o.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:m,disabled:x})=>y("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",m?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",x&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(D,{children:e.jsx(M,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{H as S};
@@ -1 +1 @@
1
- import{c as Sr,bT as tn,bU as St,bV as nt,bW as rt,r as u,bX as Nn,bn as tt,b as Me,bw as Wt,bY as Er,b0 as Rt,bZ as Xt,bt as Ce,b_ as et,b$ as qe,c0 as pn,c1 as Je,bN as Ze,c2 as Bn,c3 as nn,c4 as bt,c5 as Pt,c6 as Cr,c7 as Un,c8 as Mr,c9 as rn,ca as on,cb as Nt,ak as sn,cc as Ar,bA as Lt,aY as X,cd as Wn,ce as Or,aX as xe,cf as xn,br as Tr,bu as xt,cg as _t,bs as Ir,bz as _n,ch as Gt,ci as vt,aW as Et,aZ as je,j as Ae,b4 as cn,a$ as $n,a_ as zn,b1 as Pr,b2 as Lr,b3 as ln,cj as Dr,u as jn,a as ct,ck as Vr,bJ as kr,cl as Fr,bM as Hr,cm as Nr,cn as Br,co as Ur,b5 as Yn,cp as $t}from"./main-BpChBpB7.js";import{s as Le,i as yn,v as Wr,d as qn,w as _r,P as $r,c as Kn,e as $e,x as zr,y as jr,z as Yr,u as qr,f as oe,b as Xn,h as Kr,a as j,k as Xr,l as Gr,S as Jr,p as Zr,j as Qr,I as eo,o as Gn,q as to,r as no}from"./useOpenInteractionType-2Q4xhr62.js";const ro=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],si=Sr("chevron-down",ro),oo=["top","right","bottom","left"],gt=Math.min,We=Math.max,Dt=Math.round,ft=Math.floor,Ke=e=>({x:e,y:e}),so={left:"right",right:"left",bottom:"top",top:"bottom"};function Jt(e,t,n){return We(e,gt(t,n))}function Qe(e,t){return typeof e=="function"?e(t):e}function Fe(e){return e.split("-")[0]}function ot(e){return e.split("-")[1]}function an(e){return e==="x"?"y":"x"}function un(e){return e==="y"?"height":"width"}function ze(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function fn(e){return an(ze(e))}function io(e,t,n){n===void 0&&(n=!1);const r=ot(e),s=fn(e),o=un(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Vt(i)),[i,Vt(i)]}function co(e){const t=Vt(e);return[Zt(e),t,Zt(t)]}function Zt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const wn=["left","right"],Rn=["right","left"],lo=["top","bottom"],ao=["bottom","top"];function uo(e,t,n){switch(e){case"top":case"bottom":return n?t?Rn:wn:t?wn:Rn;case"left":case"right":return t?lo:ao;default:return[]}}function fo(e,t,n,r){const s=ot(e);let o=uo(Fe(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(Zt)))),o}function Vt(e){const t=Fe(e);return so[t]+e.slice(t.length)}function go(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jn(e){return typeof e!="number"?go(e):{top:e,right:e,bottom:e,left:e}}function kt(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function Ct(e,t,n){return Math.floor(e/t)!==n}function yt(e,t){return t<0||t>=e.current.length}function zt(e,t){return Ee(e,{disabledIndices:t})}function bn(e,t){return Ee(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Ee(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:s=1}={}){let o=t;do o+=n?-s:s;while(o>=0&&o<=e.current.length-1&&wt(e,o,r));return o}function mo(e,{event:t,orientation:n,loopFocus:r,rtl:s,cols:o,disabledIndices:i,minIndex:c,maxIndex:m,prevIndex:d,stopEvent:l=!1}){let a=d;const g=[],x={};let h=!1;{let f=null,b=-1;e.current.forEach((p,w)=>{if(p==null)return;const E=p.closest('[role="row"]');E&&(h=!0),(E!==f||b===-1)&&(f=E,b+=1,g[b]=[]),g[b].push(w),x[w]=b})}const y=h&&g.length>0&&g.some(f=>f.length!==o);function v(f){if(!y||d===-1)return;const b=x[d];if(b==null)return;const p=g[b].indexOf(d);let w=f==="up"?b-1:b+1;r&&(w<0?w=g.length-1:w>=g.length&&(w=0));const E=new Set;for(;w>=0&&w<g.length&&!E.has(w);){E.add(w);const M=g[w];if(M.length===0){w=f==="up"?w-1:w+1;continue}const C=Math.min(p,M.length-1);for(let O=C;O>=0;O-=1){const Y=M[O];if(!wt(e,Y,i))return Y}w=f==="up"?w-1:w+1,r&&(w<0?w=g.length-1:w>=g.length&&(w=0))}}if(t.key===tn){const f=v("up");if(f!==void 0)l&&Le(t),a=f;else{if(l&&Le(t),d===-1)a=m;else if(a=Ee(e,{startingIndex:a,amount:o,decrement:!0,disabledIndices:i}),r&&(d-o<c||a<0)){const b=d%o,p=m%o,w=m-(p-b);p===b?a=m:a=p>b?w:w-o}yt(e,a)&&(a=d)}}if(t.key===St){const f=v("down");f!==void 0?(l&&Le(t),a=f):(l&&Le(t),d===-1?a=c:(a=Ee(e,{startingIndex:d,amount:o,disabledIndices:i}),r&&d+o>m&&(a=Ee(e,{startingIndex:d%o-o,amount:o,disabledIndices:i}))),yt(e,a)&&(a=d))}if(n==="both"){const f=ft(d/o);t.key===(s?nt:rt)&&(l&&Le(t),d%o!==o-1?(a=Ee(e,{startingIndex:d,disabledIndices:i}),r&&Ct(a,o,f)&&(a=Ee(e,{startingIndex:d-d%o-1,disabledIndices:i}))):r&&(a=Ee(e,{startingIndex:d-d%o-1,disabledIndices:i})),Ct(a,o,f)&&(a=d)),t.key===(s?rt:nt)&&(l&&Le(t),d%o!==0?(a=Ee(e,{startingIndex:d,decrement:!0,disabledIndices:i}),r&&Ct(a,o,f)&&(a=Ee(e,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:i}))):r&&(a=Ee(e,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:i})),Ct(a,o,f)&&(a=d));const b=ft(m/o)===f;yt(e,a)&&(r&&b?a=t.key===(s?rt:nt)?m:Ee(e,{startingIndex:d-d%o-1,disabledIndices:i}):a=d)}return a}function ho(e,t,n){const r=[];let s=0;return e.forEach(({width:o,height:i},c)=>{let m=!1;for(n&&(s=0);!m;){const d=[];for(let l=0;l<o;l+=1)for(let a=0;a<i;a+=1)d.push(s+l+a*t);s%t+o<=t&&d.every(l=>r[l]==null)?(d.forEach(l=>{r[l]=c}),m=!0):s+=1}}),[...r]}function po(e,t,n,r,s){if(e===-1)return-1;const o=n.indexOf(e),i=t[e];switch(s){case"tl":return o;case"tr":return i?o+i.width-1:o;case"bl":return i?o+(i.height-1)*r:o;case"br":return n.lastIndexOf(e);default:return-1}}function xo(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function wt(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}function yo(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:s=!0,event:o="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:m=!0,touchOpenDelay:d=0}=t,l=u.useRef(void 0),a=Nn(),g=tt(),x=u.useMemo(()=>({onPointerDown(h){l.current=h.pointerType},onMouseDown(h){const y=l.current,v=h.nativeEvent,f=n.select("open");if(h.button!==0||o==="click"||yn(y,!0)&&c)return;const b=r.current.openEvent,p=b?.type,w=n.select("domReferenceElement")!==h.currentTarget,E=f&&w||!(f&&i&&(!(b&&m)||p==="click"||p==="mousedown"));if(Er(v.target)){const C=Me(Wt,v,v.target);E&&y==="touch"&&d>0?g.start(d,()=>{n.setOpen(!0,C)}):n.setOpen(E,C);return}const M=h.currentTarget;a.request(()=>{const C=Me(Wt,v,M);E&&y==="touch"&&d>0?g.start(d,()=>{n.setOpen(!0,C)}):n.setOpen(E,C)})},onClick(h){if(o==="mousedown-only")return;const y=l.current;if(o==="mousedown"&&y){l.current=void 0;return}if(yn(y,!0)&&c)return;const v=n.select("open"),f=r.current.openEvent,b=n.select("domReferenceElement")!==h.currentTarget,p=v&&b||!(v&&i&&(!(f&&m)||Wr(f))),w=Me(Wt,h.nativeEvent,h.currentTarget);p&&y==="touch"&&d>0?g.start(d,()=>{n.setOpen(!0,w)}):n.setOpen(p,w)},onKeyDown(){l.current=void 0}}),[r,o,c,n,m,i,a,g,d]);return u.useMemo(()=>s?{reference:x}:Rt,[s,x])}function vn(e,t,n){let{reference:r,floating:s}=e;const o=ze(t),i=fn(t),c=un(i),m=Fe(t),d=o==="y",l=r.x+r.width/2-s.width/2,a=r.y+r.height/2-s.height/2,g=r[c]/2-s[c]/2;let x;switch(m){case"top":x={x:l,y:r.y-s.height};break;case"bottom":x={x:l,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:a};break;case"left":x={x:r.x-s.width,y:a};break;default:x={x:r.x,y:r.y}}switch(ot(t)){case"start":x[i]-=g*(n&&d?-1:1);break;case"end":x[i]+=g*(n&&d?-1:1);break}return x}async function wo(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:c,strategy:m}=e,{boundary:d="clippingAncestors",rootBoundary:l="viewport",elementContext:a="floating",altBoundary:g=!1,padding:x=0}=Qe(t,e),h=Jn(x),v=c[g?a==="floating"?"reference":"floating":a],f=kt(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(v)))==null||n?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:d,rootBoundary:l,strategy:m})),b=a==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,p=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),w=await(o.isElement==null?void 0:o.isElement(p))?await(o.getScale==null?void 0:o.getScale(p))||{x:1,y:1}:{x:1,y:1},E=kt(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:p,strategy:m}):b);return{top:(f.top-E.top+h.top)/w.y,bottom:(E.bottom-f.bottom+h.bottom)/w.y,left:(f.left-E.left+h.left)/w.x,right:(E.right-f.right+h.right)/w.x}}const Ro=50,bo=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:wo},m=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:l,y:a}=vn(d,r,m),g=r,x=0;const h={};for(let y=0;y<o.length;y++){const v=o[y];if(!v)continue;const{name:f,fn:b}=v,{x:p,y:w,data:E,reset:M}=await b({x:l,y:a,initialPlacement:r,placement:g,strategy:s,middlewareData:h,rects:d,platform:c,elements:{reference:e,floating:t}});l=p??l,a=w??a,h[f]={...h[f],...E},M&&x<Ro&&(x++,typeof M=="object"&&(M.placement&&(g=M.placement),M.rects&&(d=M.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):M.rects),{x:l,y:a}=vn(d,g,m)),y=-1)}return{x:l,y:a,placement:g,strategy:s,middlewareData:h}},vo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:c,platform:m,elements:d}=t,{mainAxis:l=!0,crossAxis:a=!0,fallbackPlacements:g,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:y=!0,...v}=Qe(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const f=Fe(s),b=ze(c),p=Fe(c)===c,w=await(m.isRTL==null?void 0:m.isRTL(d.floating)),E=g||(p||!y?[Vt(c)]:co(c)),M=h!=="none";!g&&M&&E.push(...fo(c,y,h,w));const C=[c,...E],O=await m.detectOverflow(t,v),Y=[];let q=((r=o.flip)==null?void 0:r.overflows)||[];if(l&&Y.push(O[f]),a){const K=io(s,i,w);Y.push(O[K[0]],O[K[1]])}if(q=[...q,{placement:s,overflows:Y}],!Y.every(K=>K<=0)){var N,W;const K=(((N=o.flip)==null?void 0:N.index)||0)+1,H=C[K];if(H&&(!(a==="alignment"?b!==ze(H):!1)||q.every(R=>ze(R.placement)===b?R.overflows[0]>0:!0)))return{data:{index:K,overflows:q},reset:{placement:H}};let P=(W=q.filter(B=>B.overflows[0]<=0).sort((B,R)=>B.overflows[1]-R.overflows[1])[0])==null?void 0:W.placement;if(!P)switch(x){case"bestFit":{var D;const B=(D=q.filter(R=>{if(M){const L=ze(R.placement);return L===b||L==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(L=>L>0).reduce((L,A)=>L+A,0)]).sort((R,L)=>R[1]-L[1])[0])==null?void 0:D[0];B&&(P=B);break}case"initialPlacement":P=c;break}if(s!==P)return{reset:{placement:P}}}return{}}}};function Sn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function En(e){return oo.some(t=>e[t]>=0)}const So=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=Qe(e,t);switch(s){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),c=Sn(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:En(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),c=Sn(i,n.floating);return{data:{escapedOffsets:c,escaped:En(c)}}}default:return{}}}}},Zn=new Set(["left","top"]);async function Eo(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=Fe(n),c=ot(n),m=ze(n)==="y",d=Zn.has(i)?-1:1,l=o&&m?-1:1,a=Qe(t,e);let{mainAxis:g,crossAxis:x,alignmentAxis:h}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return c&&typeof h=="number"&&(x=c==="end"?h*-1:h),m?{x:x*l,y:g*d}:{x:g*d,y:x*l}}const Co=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:c}=t,m=await Eo(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+m.x,y:o+m.y,data:{...m,placement:i}}}}},Mo=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:m={fn:f=>{let{x:b,y:p}=f;return{x:b,y:p}}},...d}=Qe(e,t),l={x:n,y:r},a=await o.detectOverflow(t,d),g=ze(Fe(s)),x=an(g);let h=l[x],y=l[g];if(i){const f=x==="y"?"top":"left",b=x==="y"?"bottom":"right",p=h+a[f],w=h-a[b];h=Jt(p,h,w)}if(c){const f=g==="y"?"top":"left",b=g==="y"?"bottom":"right",p=y+a[f],w=y-a[b];y=Jt(p,y,w)}const v=m.fn({...t,[x]:h,[g]:y});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[x]:i,[g]:c}}}}}},Ao=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:c=0,mainAxis:m=!0,crossAxis:d=!0}=Qe(e,t),l={x:n,y:r},a=ze(s),g=an(a);let x=l[g],h=l[a];const y=Qe(c,t),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(m){const p=g==="y"?"height":"width",w=o.reference[g]-o.floating[p]+v.mainAxis,E=o.reference[g]+o.reference[p]-v.mainAxis;x<w?x=w:x>E&&(x=E)}if(d){var f,b;const p=g==="y"?"width":"height",w=Zn.has(Fe(s)),E=o.reference[a]-o.floating[p]+(w&&((f=i.offset)==null?void 0:f[a])||0)+(w?0:v.crossAxis),M=o.reference[a]+o.reference[p]+(w?0:((b=i.offset)==null?void 0:b[a])||0)-(w?v.crossAxis:0);h<E?h=E:h>M&&(h=M)}return{[g]:x,[a]:h}}}},Oo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:c}=t,{apply:m=()=>{},...d}=Qe(e,t),l=await i.detectOverflow(t,d),a=Fe(s),g=ot(s),x=ze(s)==="y",{width:h,height:y}=o.floating;let v,f;a==="top"||a==="bottom"?(v=a,f=g===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(f=a,v=g==="end"?"top":"bottom");const b=y-l.top-l.bottom,p=h-l.left-l.right,w=gt(y-l[v],b),E=gt(h-l[f],p),M=!t.middlewareData.shift;let C=w,O=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=p),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=b),M&&!g){const q=We(l.left,0),N=We(l.right,0),W=We(l.top,0),D=We(l.bottom,0);x?O=h-2*(q!==0||N!==0?q+N:We(l.left,l.right)):C=y-2*(W!==0||D!==0?W+D:We(l.top,l.bottom))}await m({...t,availableWidth:O,availableHeight:C});const Y=await i.getDimensions(c.floating);return h!==Y.width||y!==Y.height?{reset:{rects:!0}}:{}}}};function Qn(e){const t=Je(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ze(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,c=Dt(n)!==o||Dt(r)!==i;return c&&(n=o,r=i),{width:n,height:r,$:c}}function dn(e){return Ce(e)?e:e.contextElement}function dt(e){const t=dn(e);if(!Ze(t))return Ke(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Qn(t);let i=(o?Dt(n.width):n.width)/r,c=(o?Dt(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const To=Ke(0);function er(e){const t=qe(e);return!Bn()||!t.visualViewport?To:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Io(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==qe(e)?!1:t}function it(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=dn(e);let i=Ke(1);t&&(r?Ce(r)&&(i=dt(r)):i=dt(e));const c=Io(o,n,r)?er(o):Ke(0);let m=(s.left+c.x)/i.x,d=(s.top+c.y)/i.y,l=s.width/i.x,a=s.height/i.y;if(o){const g=qe(o),x=r&&Ce(r)?qe(r):r;let h=g,y=pn(h);for(;y&&r&&x!==h;){const v=dt(y),f=y.getBoundingClientRect(),b=Je(y),p=f.left+(y.clientLeft+parseFloat(b.paddingLeft))*v.x,w=f.top+(y.clientTop+parseFloat(b.paddingTop))*v.y;m*=v.x,d*=v.y,l*=v.x,a*=v.y,m+=p,d+=w,h=qe(y),y=pn(h)}}return kt({width:l,height:a,x:m,y:d})}function Bt(e,t){const n=Nt(e).scrollLeft;return t?t.left+n:it(et(e)).left+n}function tr(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Bt(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Po(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=et(r),c=t?nn(t.floating):!1;if(r===i||c&&o)return n;let m={scrollLeft:0,scrollTop:0},d=Ke(1);const l=Ke(0),a=Ze(r);if((a||!a&&!o)&&((rn(r)!=="body"||on(i))&&(m=Nt(r)),a)){const x=it(r);d=dt(r),l.x=x.x+r.clientLeft,l.y=x.y+r.clientTop}const g=i&&!a&&!o?tr(i,m):Ke(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-m.scrollLeft*d.x+l.x+g.x,y:n.y*d.y-m.scrollTop*d.y+l.y+g.y}}function Lo(e){return Array.from(e.getClientRects())}function Do(e){const t=et(e),n=Nt(e),r=e.ownerDocument.body,s=We(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=We(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Bt(e);const c=-n.scrollTop;return Je(r).direction==="rtl"&&(i+=We(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:c}}const Cn=25;function Vo(e,t){const n=qe(e),r=et(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,c=0,m=0;if(s){o=s.width,i=s.height;const l=Bn();(!l||l&&t==="fixed")&&(c=s.offsetLeft,m=s.offsetTop)}const d=Bt(r);if(d<=0){const l=r.ownerDocument,a=l.body,g=getComputedStyle(a),x=l.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,h=Math.abs(r.clientWidth-a.clientWidth-x);h<=Cn&&(o-=h)}else d<=Cn&&(o+=d);return{width:o,height:i,x:c,y:m}}function ko(e,t){const n=it(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Ze(e)?dt(e):Ke(1),i=e.clientWidth*o.x,c=e.clientHeight*o.y,m=s*o.x,d=r*o.y;return{width:i,height:c,x:m,y:d}}function Mn(e,t,n){let r;if(t==="viewport")r=Vo(e,n);else if(t==="document")r=Do(et(e));else if(Ce(t))r=ko(t,n);else{const s=er(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return kt(r)}function nr(e,t){const n=bt(e);return n===t||!Ce(n)||Pt(n)?!1:Je(n).position==="fixed"||nr(n,t)}function Fo(e,t){const n=t.get(e);if(n)return n;let r=Xt(e,[],!1).filter(c=>Ce(c)&&rn(c)!=="body"),s=null;const o=Je(e).position==="fixed";let i=o?bt(e):e;for(;Ce(i)&&!Pt(i);){const c=Je(i),m=Un(i);!m&&c.position==="fixed"&&(s=null),(o?!m&&!s:!m&&c.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||on(i)&&!m&&nr(e,i))?r=r.filter(l=>l!==i):s=c,i=bt(i)}return t.set(e,r),r}function Ho(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?nn(t)?[]:Fo(t,this._c):[].concat(n),r],c=Mn(t,i[0],s);let m=c.top,d=c.right,l=c.bottom,a=c.left;for(let g=1;g<i.length;g++){const x=Mn(t,i[g],s);m=We(x.top,m),d=gt(x.right,d),l=gt(x.bottom,l),a=We(x.left,a)}return{width:d-a,height:l-m,x:a,y:m}}function No(e){const{width:t,height:n}=Qn(e);return{width:t,height:n}}function Bo(e,t,n){const r=Ze(t),s=et(t),o=n==="fixed",i=it(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const m=Ke(0);function d(){m.x=Bt(s)}if(r||!r&&!o)if((rn(t)!=="body"||on(s))&&(c=Nt(t)),r){const x=it(t,!0,o,t);m.x=x.x+t.clientLeft,m.y=x.y+t.clientTop}else s&&d();o&&!r&&s&&d();const l=s&&!r&&!o?tr(s,c):Ke(0),a=i.left+c.scrollLeft-m.x-l.x,g=i.top+c.scrollTop-m.y-l.y;return{x:a,y:g,width:i.width,height:i.height}}function jt(e){return Je(e).position==="static"}function An(e,t){if(!Ze(e)||Je(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return et(e)===n&&(n=n.ownerDocument.body),n}function rr(e,t){const n=qe(e);if(nn(e))return n;if(!Ze(e)){let s=bt(e);for(;s&&!Pt(s);){if(Ce(s)&&!jt(s))return s;s=bt(s)}return n}let r=An(e,t);for(;r&&Cr(r)&&jt(r);)r=An(r,t);return r&&Pt(r)&&jt(r)&&!Un(r)?n:r||Mr(e)||n}const Uo=async function(e){const t=this.getOffsetParent||rr,n=this.getDimensions,r=await n(e.floating);return{reference:Bo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Wo(e){return Je(e).direction==="rtl"}const _o={convertOffsetParentRelativeRectToViewportRelativeRect:Po,getDocumentElement:et,getClippingRect:Ho,getOffsetParent:rr,getElementRects:Uo,getClientRects:Lo,getDimensions:No,getScale:dt,isElement:Ce,isRTL:Wo};function or(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $o(e,t){let n=null,r;const s=et(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,m){c===void 0&&(c=!1),m===void 0&&(m=1),o();const d=e.getBoundingClientRect(),{left:l,top:a,width:g,height:x}=d;if(c||t(),!g||!x)return;const h=ft(a),y=ft(s.clientWidth-(l+g)),v=ft(s.clientHeight-(a+x)),f=ft(l),p={rootMargin:-h+"px "+-y+"px "+-v+"px "+-f+"px",threshold:We(0,gt(1,m))||1};let w=!0;function E(M){const C=M[0].intersectionRatio;if(C!==m){if(!w)return i();C?i(!1,C):r=setTimeout(()=>{i(!1,1e-7)},1e3)}C===1&&!or(d,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(E,{...p,root:s.ownerDocument})}catch{n=new IntersectionObserver(E,p)}n.observe(e)}return i(!0),o}function On(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,d=dn(e),l=s||o?[...d?Xt(d):[],...t?Xt(t):[]]:[];l.forEach(f=>{s&&f.addEventListener("scroll",n,{passive:!0}),o&&f.addEventListener("resize",n)});const a=d&&c?$o(d,n):null;let g=-1,x=null;i&&(x=new ResizeObserver(f=>{let[b]=f;b&&b.target===d&&x&&t&&(x.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var p;(p=x)==null||p.observe(t)})),n()}),d&&!m&&x.observe(d),t&&x.observe(t));let h,y=m?it(e):null;m&&v();function v(){const f=it(e);y&&!or(y,f)&&n(),y=f,h=requestAnimationFrame(v)}return n(),()=>{var f;l.forEach(b=>{s&&b.removeEventListener("scroll",n),o&&b.removeEventListener("resize",n)}),a?.(),(f=x)==null||f.disconnect(),x=null,m&&cancelAnimationFrame(h)}}const zo=Co,jo=Mo,Yo=vo,qo=Oo,Ko=So,Xo=Ao,Go=(e,t,n)=>{const r=new Map,s={platform:_o,...n},o={...s.platform,_c:r};return bo(e,t,{...s,platform:o})};var Jo=typeof document<"u",Zo=function(){},Tt=Jo?u.useLayoutEffect:Zo;function Ft(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ft(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!Ft(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function sr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tn(e,t){const n=sr(e);return Math.round(t*n)/n}function Yt(e){const t=u.useRef(e);return Tt(()=>{t.current=e}),t}function Qo(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:c=!0,whileElementsMounted:m,open:d}=e,[l,a]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,x]=u.useState(r);Ft(g,r)||x(r);const[h,y]=u.useState(null),[v,f]=u.useState(null),b=u.useCallback(R=>{R!==M.current&&(M.current=R,y(R))},[]),p=u.useCallback(R=>{R!==C.current&&(C.current=R,f(R))},[]),w=o||h,E=i||v,M=u.useRef(null),C=u.useRef(null),O=u.useRef(l),Y=m!=null,q=Yt(m),N=Yt(s),W=Yt(d),D=u.useCallback(()=>{if(!M.current||!C.current)return;const R={placement:t,strategy:n,middleware:g};N.current&&(R.platform=N.current),Go(M.current,C.current,R).then(L=>{const A={...L,isPositioned:W.current!==!1};K.current&&!Ft(O.current,A)&&(O.current=A,sn.flushSync(()=>{a(A)}))})},[g,t,n,N,W]);Tt(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,a(R=>({...R,isPositioned:!1})))},[d]);const K=u.useRef(!1);Tt(()=>(K.current=!0,()=>{K.current=!1}),[]),Tt(()=>{if(w&&(M.current=w),E&&(C.current=E),w&&E){if(q.current)return q.current(w,E,D);D()}},[w,E,D,q,Y]);const H=u.useMemo(()=>({reference:M,floating:C,setReference:b,setFloating:p}),[b,p]),P=u.useMemo(()=>({reference:w,floating:E}),[w,E]),B=u.useMemo(()=>{const R={position:n,left:0,top:0};if(!P.floating)return R;const L=Tn(P.floating,l.x),A=Tn(P.floating,l.y);return c?{...R,transform:"translate("+L+"px, "+A+"px)",...sr(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:A}},[n,c,P.floating,l.x,l.y]);return u.useMemo(()=>({...l,update:D,refs:H,elements:P,floatingStyles:B}),[l,D,H,P,B])}const es=(e,t)=>{const n=zo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ts=(e,t)=>{const n=jo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ns=(e,t)=>({fn:Xo(e).fn,options:[e,t]}),rs=(e,t)=>{const n=Yo(e);return{name:n.name,fn:n.fn,options:[e,t]}},os=(e,t)=>{const n=qo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ss=(e,t)=>{const n=Ko(e);return{name:n.name,fn:n.fn,options:[e,t]}};function ir(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=Ar(),o=qn()!=null,i=Lt(()=>new _r({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new $r,floatingId:s,nested:o,noEmit:e.noEmit||!1})).current;return X(()=>{const c={open:t,floatingId:s};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ce(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,s,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=o,i.context.noEmit=e.noEmit||!1,i}function is(e={}){const{nodeId:t,externalTree:n}=e,r=ir(e),s=e.rootContext||r,o={reference:s.useState("referenceElement"),floating:s.useState("floatingElement"),domReference:s.useState("domReferenceElement")},[i,c]=u.useState(null),m=u.useRef(null),d=Kn(n);X(()=>{o.domReference&&(m.current=o.domReference)},[o.domReference]);const l=Qo({...e,elements:{...o,...i&&{reference:i}}}),a=u.useCallback(C=>{const O=Ce(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;c(O),l.refs.setReference(O)},[l.refs]),[g,x]=u.useState(null),[h,y]=u.useState(null);s.useSyncedValue("referenceElement",g),s.useSyncedValue("domReferenceElement",Ce(g)?g:null),s.useSyncedValue("floatingElement",h);const v=u.useCallback(C=>{(Ce(C)||C===null)&&(m.current=C,x(C)),(Ce(l.refs.reference.current)||l.refs.reference.current===null||C!==null&&!Ce(C))&&l.refs.setReference(C)},[l.refs,x]),f=u.useCallback(C=>{y(C),l.refs.setFloating(C)},[l.refs]),b=u.useMemo(()=>({...l.refs,setReference:v,setFloating:f,setPositionReference:a,domReference:m}),[l.refs,v,f,a]),p=u.useMemo(()=>({...l.elements,domReference:o.domReference}),[l.elements,o.domReference]),w=s.useState("open"),E=s.useState("floatingId"),M=u.useMemo(()=>({...l,dataRef:s.context.dataRef,open:w,onOpenChange:s.setOpen,events:s.context.events,floatingId:E,refs:b,elements:p,nodeId:t,rootStore:s}),[l,b,p,t,s,w,E]);return X(()=>{s.context.dataRef.current.floatingContext=M;const C=d?.nodesRef.current.find(O=>O.id===t);C&&(C.context=M)}),u.useMemo(()=>({...l,context:M,refs:b,elements:p,rootStore:s}),[l,b,p,M,s])}const cs="Escape";function Ut(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Mt(e,t){return Ut(t,e===tn||e===St,e===nt||e===rt)}function qt(e,t,n){return Ut(t,e===St,n?e===nt:e===rt)||e==="Enter"||e===" "||e===""}function ls(e,t,n){return Ut(t,n?e===nt:e===rt,e===St)}function as(e,t,n,r){const s=n?e===rt:e===nt,o=e===tn;return t==="both"||t==="horizontal"&&r&&r>1?e===cs:Ut(t,s,o)}function us(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingElement"),o=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:c,activeIndex:m,onNavigate:d=()=>{},enabled:l=!0,selectedIndex:a=null,allowEscape:g=!1,loopFocus:x=!1,nested:h=!1,rtl:y=!1,virtual:v=!1,focusItemOnOpen:f="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:p=!0,disabledIndices:w=void 0,orientation:E="vertical",parentOrientation:M,cols:C=1,scrollItemIntoView:O=!0,itemSizes:Y,dense:q=!1,id:N,resetOnPointerLeave:W=!0,externalTree:D}=t,K=Wn(s),H=$e(K),P=qn(),B=Kn(D);X(()=>{i.current.orientation=E},[i,E]);const R=Or(o),L=u.useRef(f),A=u.useRef(a??-1),I=u.useRef(null),ge=u.useRef(!0),k=xe(S=>{d(A.current===-1?null:A.current,S)}),ae=u.useRef(k),Q=u.useRef(!!s),V=u.useRef(r),z=u.useRef(!1),fe=u.useRef(!1),De=$e(w),U=$e(r),le=$e(O),te=$e(a),me=$e(W),Re=xe(()=>{function S(ne){v?B?.events.emit("virtualfocus",ne):zr(ne,{sync:z.current,preventScroll:!0})}const F=c.current[A.current],T=fe.current;F&&S(F),(z.current?ne=>ne():requestAnimationFrame)(()=>{const ne=c.current[A.current]||F;if(!ne)return;F||S(ne);const se=le.current;se&&G&&(T||!ge.current)&&ne.scrollIntoView?.(typeof se=="boolean"?{block:"nearest",inline:"nearest"}:se)})});X(()=>{l&&(r&&s?(A.current=a??-1,L.current&&a!=null&&(fe.current=!0,k())):Q.current&&(A.current=-1,ae.current()))},[l,r,s,a,k]),X(()=>{if(l){if(!r){z.current=!1;return}if(s)if(m==null){if(z.current=!1,te.current!=null)return;if(Q.current&&(A.current=-1,Re()),(!V.current||!Q.current)&&L.current&&(I.current!=null||L.current===!0&&I.current==null)){let S=0;const F=()=>{c.current[0]==null?(S<2&&(S?requestAnimationFrame:queueMicrotask)(F),S+=1):(A.current=I.current==null||qt(I.current,E,y)||h?zt(c):bn(c),I.current=null,k())};F()}}else yt(c,m)||(A.current=m,Re(),fe.current=!1)}},[l,r,s,m,te,h,c,E,y,k,Re,De]),X(()=>{if(!l||s||!B||v||!Q.current)return;const S=B.nodesRef.current,F=S.find(ne=>ne.id===P)?.context?.elements.floating,T=xn(Tr(s)),ee=S.some(ne=>ne.context&&xt(ne.context.elements.floating,T));F&&!ee&&ge.current&&F.focus({preventScroll:!0})},[l,s,B,P,v]),X(()=>{ae.current=k,V.current=r,Q.current=!!s}),X(()=>{r||(I.current=null,L.current=f)},[r,f]);const ue=m!=null,G=u.useMemo(()=>{function S(T){if(!U.current)return;const ee=c.current.indexOf(T.currentTarget);ee!==-1&&A.current!==ee&&(A.current=ee,k(T))}return{onFocus(T){z.current=!0,S(T)},onClick:({currentTarget:T})=>T.focus({preventScroll:!0}),onMouseMove(T){z.current=!0,fe.current=!1,b&&S(T)},onPointerLeave(T){if(!U.current||!ge.current||T.pointerType==="touch")return;z.current=!0;const ee=T.relatedTarget;!b||c.current.includes(ee)||me.current&&(A.current=-1,k(T),v||H.current?.focus({preventScroll:!0}))}}},[U,H,b,c,k,me,v]),J=u.useCallback(()=>M??B?.nodesRef.current.find(S=>S.id===P)?.context?.dataRef?.current.orientation,[P,B,M]),we=xe(S=>{if(ge.current=!1,z.current=!0,S.which===229||!U.current&&S.currentTarget===H.current)return;if(h&&as(S.key,E,y,C)){Mt(S.key,J())||Le(S),n.setOpen(!1,Me(_t,S.nativeEvent)),Ze(o)&&(v?B?.events.emit("virtualfocus",o):o.focus());return}const F=A.current,T=zt(c,w),ee=bn(c,w);if(R||(S.key==="Home"&&(Le(S),A.current=T,k(S)),S.key==="End"&&(Le(S),A.current=ee,k(S))),C>1){const ne=Y||Array.from({length:c.current.length},()=>({width:1,height:1})),se=ho(ne,C,q),ye=se.findIndex(ve=>ve!=null&&!wt(c,ve,w)),he=se.reduce((ve,Te,_e)=>Te!=null&&!wt(c,Te,w)?_e:ve,-1),Oe=se[mo({current:se.map(ve=>ve!=null?c.current[ve]:null)},{event:S,orientation:E,loopFocus:x,rtl:y,cols:C,disabledIndices:xo([...(typeof w!="function"?w:null)||c.current.map((ve,Te)=>wt(c,Te,w)?Te:void 0),void 0],se),minIndex:ye,maxIndex:he,prevIndex:po(A.current>ee?T:A.current,ne,se,C,S.key===St?"bl":S.key===(y?nt:rt)?"tr":"tl"),stopEvent:!0})];if(Oe!=null&&(A.current=Oe,k(S)),E==="both")return}if(Mt(S.key,E)){if(Le(S),r&&!v&&xn(S.currentTarget.ownerDocument)===S.currentTarget){A.current=qt(S.key,E,y)?T:ee,k(S);return}qt(S.key,E,y)?x?F>=ee?g&&F!==c.current.length?A.current=-1:(z.current=!1,A.current=T):A.current=Ee(c,{startingIndex:F,disabledIndices:w}):A.current=Math.min(ee,Ee(c,{startingIndex:F,disabledIndices:w})):x?F<=T?g&&F!==-1?A.current=c.current.length:(z.current=!1,A.current=ee):A.current=Ee(c,{startingIndex:F,decrement:!0,disabledIndices:w}):A.current=Math.max(T,Ee(c,{startingIndex:F,decrement:!0,disabledIndices:w})),yt(c,A.current)&&(A.current=-1),k(S)}}),re=u.useMemo(()=>v&&r&&ue&&{"aria-activedescendant":`${N}-${m}`},[v,r,ue,N,m]),Z=u.useMemo(()=>({"aria-orientation":E==="both"?void 0:E,...R?{}:re,onKeyDown(S){if(S.key==="Tab"&&S.shiftKey&&r&&!v){const F=Ir(S.nativeEvent);if(F&&!xt(H.current,F))return;Le(S),n.setOpen(!1,Me(_n,S.nativeEvent)),Ze(o)&&o.focus();return}we(S)},onPointerMove(){ge.current=!0}}),[re,we,H,E,R,n,r,v,o]),be=u.useMemo(()=>{function S(T){f==="auto"&&jr(T.nativeEvent)&&(L.current=!v)}function F(T){L.current=f,f==="auto"&&Yr(T.nativeEvent)&&(L.current=!0)}return{onKeyDown(T){const ee=n.select("open");ge.current=!1;const ne=T.key.startsWith("Arrow"),se=ls(T.key,J(),y),ye=Mt(T.key,E),he=(h?se:ye)||T.key==="Enter"||T.key.trim()==="";if(v&&ee)return we(T);if(!(!ee&&!p&&ne)){if(he){const Oe=Mt(T.key,J());I.current=h&&Oe?null:T.key}if(h){se&&(Le(T),ee?(A.current=zt(c,De.current),k(T)):n.setOpen(!0,Me(_t,T.nativeEvent,T.currentTarget)));return}ye&&(te.current!=null&&(A.current=te.current),Le(T),!ee&&p?n.setOpen(!0,Me(_t,T.nativeEvent,T.currentTarget)):we(T),ee&&k(T))}},onFocus(T){n.select("open")&&!v&&(A.current=-1,k(T))},onPointerDown:F,onPointerEnter:F,onMouseDown:S,onClick:S}},[we,De,f,c,h,k,n,p,E,J,y,te,v]),Ve=u.useMemo(()=>({...re,...be}),[re,be]);return u.useMemo(()=>l?{reference:Ve,floating:Z,item:G,trigger:be}:{},[l,Ve,Z,be,G])}function fs(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.context.dataRef,{listRef:o,activeIndex:i,onMatch:c,onTypingChange:m,enabled:d=!0,findMatch:l=null,resetMs:a=750,ignoreKeys:g=Gt,selectedIndex:x=null}=t,h=tt(),y=u.useRef(""),v=u.useRef(x??i??-1),f=u.useRef(null);X(()=>{r&&(h.clear(),f.current=null,y.current="")},[r,h]),X(()=>{r&&y.current===""&&(v.current=x??i??-1)},[r,x,i]);const b=xe(M=>{M?s.current.typing||(s.current.typing=M,m?.(M)):s.current.typing&&(s.current.typing=M,m?.(M))}),p=xe(M=>{function C(W,D,K){const H=l?l(D,K):D.find(P=>P?.toLocaleLowerCase().indexOf(K.toLocaleLowerCase())===0);return H?W.indexOf(H):-1}const O=o.current;if(y.current.length>0&&y.current[0]!==" "&&(C(O,O,y.current)===-1?b(!1):M.key===" "&&Le(M)),O==null||g.includes(M.key)||M.key.length!==1||M.ctrlKey||M.metaKey||M.altKey)return;r&&M.key!==" "&&(Le(M),b(!0)),O.every(W=>W?W[0]?.toLocaleLowerCase()!==W[1]?.toLocaleLowerCase():!0)&&y.current===M.key&&(y.current="",v.current=f.current),y.current+=M.key,h.start(a,()=>{y.current="",v.current=f.current,b(!1)});const q=v.current,N=C(O,[...O.slice((q||0)+1),...O.slice(0,(q||0)+1)],y.current);N!==-1?(c?.(N),f.current=N):M.key!==" "&&(y.current="",b(!1))}),w=u.useMemo(()=>({onKeyDown:p}),[p]),E=u.useMemo(()=>({onKeyDown:p,onKeyUp(M){M.key===" "&&b(!1)}}),[p,b]);return u.useMemo(()=>d?{reference:w,floating:E}:{},[d,w,E])}const ds=u.createContext(void 0);function gs(){return u.useContext(ds)?.direction??"ltr"}const ms=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:c,middlewareData:m}=t,{element:d,padding:l=0,offsetParent:a="real"}=Qe(e,t)||{};if(d==null)return{};const g=Jn(l),x={x:n,y:r},h=fn(s),y=un(h),v=await i.getDimensions(d),f=h==="y",b=f?"top":"left",p=f?"bottom":"right",w=f?"clientHeight":"clientWidth",E=o.reference[y]+o.reference[h]-x[h]-o.floating[y],M=x[h]-o.reference[h],C=a==="real"?await i.getOffsetParent?.(d):c.floating;let O=c.floating[w]||o.floating[y];(!O||!await i.isElement?.(C))&&(O=c.floating[w]||o.floating[y]);const Y=E/2-M/2,q=O/2-v[y]/2-1,N=Math.min(g[b],q),W=Math.min(g[p],q),D=N,K=O-v[y]-W,H=O/2-v[y]/2+Y,P=Jt(D,H,K),B=!m.arrow&&ot(s)!=null&&H!==P&&o.reference[y]/2-(H<D?N:W)-v[y]/2<0,R=B?H<D?H-D:H-K:0;return{[h]:x[h]+R,data:{[h]:P,centerOffset:H-P-R,...B&&{alignmentOffset:R}},reset:B}}}),hs=(e,t)=>({...ms(e),options:[e,t]}),ps={name:"hide",async fn(e){const{width:t,height:n,x:r,y:s}=e.rects.reference,o=t===0&&n===0&&r===0&&s===0;return{data:{referenceHidden:(await ss().fn(e)).data?.referenceHidden||o}}}},It={sideX:"left",sideY:"top"},ii={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:s},platform:o,strategy:i,placement:c}=e,m=qe(s),d=m.getComputedStyle(s);if(!(d.transitionDuration!=="0s"&&d.transitionDuration!==""))return{x:t,y:n,data:It};const a=await o.getOffsetParent?.(s);let g={width:0,height:0};if(i==="fixed"&&m?.visualViewport)g={width:m.visualViewport.width,height:m.visualViewport.height};else if(a===m){const b=vt(s);g={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await o.isElement?.(a)&&(g=await o.getDimensions(a));const x=Fe(c);let h=t,y=n;x==="left"&&(h=g.width-(t+r.width)),x==="top"&&(y=g.height-(n+r.height));const v=x==="left"?"right":It.sideX,f=x==="top"?"bottom":It.sideY;return{x:h,y,data:{sideX:v,sideY:f}}}};function cr(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function In(e,t,n){const{rects:r,placement:s}=e;return{side:cr(t,Fe(s),n),align:ot(s)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function xs(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:m=5,sticky:d=!1,arrowPadding:l=5,disableAnchorTracking:a=!1,keepMounted:g=!1,floatingRootContext:x,mounted:h,collisionAvoidance:y,shiftCrossAxis:v=!1,nodeId:f,adaptiveOrigin:b,lazyFlip:p=!1,externalTree:w}=e,[E,M]=u.useState(null);!h&&E!==null&&M(null);const C=y.side||"flip",O=y.align||"flip",Y=y.fallbackAxisSide||"end",q=typeof t=="function"?t:void 0,N=xe(q),W=q?N:t,D=$e(t),H=gs()==="rtl",P=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":H?"left":"right","inline-start":H?"right":"left"}[r],B=o==="center"?P:`${P}-${o}`;let R=m;const L=1,A=r==="bottom"?L:0,I=r==="top"?L:0,ge=r==="right"?L:0,k=r==="left"?L:0;typeof R=="number"?R={top:R+A,right:R+k,bottom:R+I,left:R+ge}:R&&(R={top:(R.top||0)+A,right:(R.right||0)+k,bottom:(R.bottom||0)+I,left:(R.left||0)+ge});const ae={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:R},Q=u.useRef(null),V=$e(s),z=$e(i),U=[es(ce=>{const pe=In(ce,r,H),de=typeof V.current=="function"?V.current(pe):V.current,Se=typeof z.current=="function"?z.current(pe):z.current;return{mainAxis:de,crossAxis:Se,alignmentAxis:Se}},[typeof s!="function"?s:0,typeof i!="function"?i:0,H,r])],le=O==="none"&&C!=="shift",te=!le&&(d||v||C==="shift"),me=C==="none"?null:rs({...ae,padding:{top:R.top+L,right:R.right+L,bottom:R.bottom+L,left:R.left+L},mainAxis:!v&&C==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:Y}),Re=le?null:ts(ce=>{const pe=vt(ce.elements.floating).documentElement;return{...ae,rootBoundary:v?{x:0,y:0,width:pe.clientWidth,height:pe.clientHeight}:void 0,mainAxis:O!=="none",crossAxis:te,limiter:d||v?void 0:ns(de=>{if(!Q.current)return{};const{width:Se,height:Be}=Q.current.getBoundingClientRect(),Ue=ze(Fe(de.placement)),Xe=Ue==="y"?Se:Be,Ge=Ue==="y"?R.left+R.right:R.top+R.bottom;return{offset:Xe/2+Ge/2}})}},[ae,d,v,R,O]);C==="shift"||O==="shift"||o==="center"?U.push(Re,me):U.push(me,Re),U.push(os({...ae,apply({elements:{floating:ce},rects:{reference:pe},availableWidth:de,availableHeight:Se}){Object.entries({"--available-width":`${de}px`,"--available-height":`${Se}px`,"--anchor-width":`${pe.width}px`,"--anchor-height":`${pe.height}px`}).forEach(([Be,Ue])=>{ce.style.setProperty(Be,Ue)})}}),hs(()=>({element:Q.current||document.createElement("div"),padding:l,offsetParent:"floating"}),[l]),{name:"transformOrigin",fn(ce){const{elements:pe,middlewareData:de,placement:Se,rects:Be,y:Ue}=ce,Xe=Fe(Se),Ge=ze(Xe),st=Q.current,at=de.arrow?.x||0,ht=de.arrow?.y||0,pt=st?.clientWidth||0,$=st?.clientHeight||0,ie=at+pt/2,Ie=ht+$/2,ke=Math.abs(de.shift?.y||0),Pe=Be.reference.height/2,Ye=typeof s=="function"?s(In(ce,r,H)):s,hn=ke>Ye,br={top:`${ie}px calc(100% + ${Ye}px)`,bottom:`${ie}px ${-Ye}px`,left:`calc(100% + ${Ye}px) ${Ie}px`,right:`${-Ye}px ${Ie}px`}[Xe],vr=`${ie}px ${Be.reference.y+Pe-Ue}px`;return pe.floating.style.setProperty("--transform-origin",te&&Ge==="y"&&hn?vr:br),{}}},ps,b),X(()=>{!h&&x&&x.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[h,x]);const ue=u.useMemo(()=>({elementResize:!a&&typeof ResizeObserver<"u",layoutShift:!a&&typeof IntersectionObserver<"u"}),[a]),{refs:G,elements:J,x:we,y:re,middlewareData:Z,update:be,placement:Ve,context:S,isPositioned:F,floatingStyles:T}=is({rootContext:x,placement:B,middleware:U,strategy:n,whileElementsMounted:g?void 0:(...ce)=>On(...ce,ue),nodeId:f,externalTree:w}),{sideX:ee,sideY:ne}=Z.adaptiveOrigin||It,se=F?n:"fixed",ye=u.useMemo(()=>b?{position:se,[ee]:we,[ne]:re}:{position:se,...T},[b,se,ee,we,ne,re,T]),he=u.useRef(null);X(()=>{if(!h)return;const ce=D.current,pe=typeof ce=="function"?ce():ce,Se=(Pn(pe)?pe.current:pe)||null||null;Se!==he.current&&(G.setPositionReference(Se),he.current=Se)},[h,G,W,D]),u.useEffect(()=>{if(!h)return;const ce=D.current;typeof ce!="function"&&Pn(ce)&&ce.current!==he.current&&(G.setPositionReference(ce.current),he.current=ce.current)},[h,G,W,D]),u.useEffect(()=>{if(g&&h&&J.domReference&&J.floating)return On(J.domReference,J.floating,be,ue)},[g,h,J,be,ue]);const Oe=Fe(Ve),ve=cr(r,Oe,H),Te=ot(Ve)||"center",_e=!!Z.hide?.referenceHidden;X(()=>{p&&h&&F&&M(Oe)},[p,h,F,Oe]);const He=u.useMemo(()=>({position:"absolute",top:Z.arrow?.y,left:Z.arrow?.x}),[Z.arrow]),Ne=Z.arrow?.centerOffset!==0;return u.useMemo(()=>({positionerStyles:ye,arrowStyles:He,arrowRef:Q,arrowUncentered:Ne,side:ve,align:Te,physicalSide:Oe,anchorHidden:_e,refs:G,context:S,isPositioned:F,update:be}),[ye,He,Q,Ne,ve,Te,Oe,_e,G,S,F,be])}function Pn(e){return e!=null&&"current"in e}function ys(e){const t=u.useRef(!0);t.current&&(t.current=!1,e())}function Ln({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=u.useRef(e!==void 0),[o,i]=u.useState(t),c=s?e:o,m=u.useCallback(d=>{s||i(d)},[]);return[c,m]}const lr=u.createContext(null),ar=u.createContext(null);function lt(){const e=u.useContext(lr);if(e===null)throw new Error(Et(60));return e}function ur(){const e=u.useContext(ar);if(e===null)throw new Error(Et(61));return e}let Dn=(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})({});const ws={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Rs={valid(e){return e===null?null:e?{[Dn.valid]:""}:{[Dn.invalid]:""}}},bs=u.createContext({invalid:void 0,name:void 0,validityData:{state:ws,errors:[],error:"",value:"",initialValue:null},setValidityData:je,disabled:void 0,touched:!1,setTouched:je,dirty:!1,setDirty:je,filled:!1,setFilled:je,focused:!1,setFocused:je,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Rt)=>e,getInputValidationProps:(e=Rt)=>e,inputRef:{current:null},commit:async()=>{}}});function gn(e=!0){const t=u.useContext(bs);if(t.setValidityData===je&&!e)throw new Error(Et(28));return t}const vs=u.createContext({controlId:void 0,setControlId:je,labelId:void 0,setLabelId:je,messageIds:[],setMessageIds:je,getDescriptionProps:e=>e});function fr(){return u.useContext(vs)}function dr(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:s,setControlId:o}=fr(),i=qr(t);return X(()=>{if(!(!n&&!t||o===je)){if(n){const c=r?.current;Ce(c)&&c.closest("label")!=null?o(t??null):o(s??i)}else t&&o(t);return()=>{t&&o(void 0)}}},[t,r,s,o,n,i]),s??i}const Ss=(e,t)=>Object.is(e,t);function mt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Kt(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:mt(r,t,n))}function Qt(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:mt(r,t,n))}function Es(e,t,n){return e.filter(r=>!mt(r,t,n))}function en(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function gr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Cs(e){if(!Array.isArray(e))return e!=null&&!("null"in e);if(gr(e)){for(const t of e)for(const n of t.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function Ms(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return en(e)}function ut(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?en(e.value):en(e)}function mr(e,t,n){function r(){return Ms(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const s=gr(t)?t.flatMap(o=>o.items):t;if(e==null||typeof e!="object"){const o=s.find(i=>i.value===e);return o&&o.label!=null?o.label:r()}if("value"in e){const o=s.find(i=>i&&i.value===e.value);if(o&&o.label!=null)return o.label}}return r()}function As(e,t,n){return e.reduce((r,s,o)=>(o>0&&r.push(", "),r.push(Ae.jsx(u.Fragment,{children:mr(s,t,n)},o)),r),[])}const _={id:oe(e=>e.id),modal:oe(e=>e.modal),multiple:oe(e=>e.multiple),items:oe(e=>e.items),itemToStringLabel:oe(e=>e.itemToStringLabel),itemToStringValue:oe(e=>e.itemToStringValue),isItemEqualToValue:oe(e=>e.isItemEqualToValue),value:oe(e=>e.value),hasSelectedValue:oe(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ut(t,r)!==""}),hasNullItemLabel:oe((e,t)=>t?Cs(e.items):!1),open:oe(e=>e.open),mounted:oe(e=>e.mounted),forceMount:oe(e=>e.forceMount),transitionStatus:oe(e=>e.transitionStatus),openMethod:oe(e=>e.openMethod),activeIndex:oe(e=>e.activeIndex),selectedIndex:oe(e=>e.selectedIndex),isActive:oe((e,t)=>e.activeIndex===t),isSelected:oe((e,t,n)=>{const r=e.isItemEqualToValue,s=e.value;return e.multiple?Array.isArray(s)&&s.some(o=>mt(o,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:mt(s,n,r)}),isSelectedByFocus:oe((e,t)=>e.selectedIndex===t),popupProps:oe(e=>e.popupProps),triggerProps:oe(e=>e.triggerProps),triggerElement:oe(e=>e.triggerElement),positionerElement:oe(e=>e.positionerElement),listElement:oe(e=>e.listElement),scrollUpArrowVisible:oe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:oe(e=>e.scrollDownArrowVisible),hasScrollArrows:oe(e=>e.hasScrollArrows)},Os=u.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:je,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function hr(){return u.useContext(Os)}function Ts(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Is(e){const{enabled:t=!0,value:n,id:r,name:s,controlRef:o,commit:i}=e,{formRef:c}=hr(),{invalid:m,markedDirtyRef:d,validityData:l,setValidityData:a}=gn(),g=xe(e.getValue);X(()=>{if(!t)return;let x=n;x===void 0&&(x=g()),l.initialValue===null&&x!==null&&a(h=>({...h,initialValue:x}))},[t,a,n,l.initialValue,g]),X(()=>{!t||!r||c.current.fields.set(r,{getValue:g,name:s,controlRef:o,validityData:Ts(l,m),validate(x=!0){let h=n;h===void 0&&(h=g()),d.current=!0,x?sn.flushSync(()=>i(h)):i(h)}})},[i,o,t,c,g,r,m,d,s,l,n]),X(()=>{const x=c.current.fields;return()=>{r&&x.delete(r)}},[c,r])}function Ps(e,t){const n=u.useRef(e),r=xe(t);X(()=>{n.current!==e&&r(n.current)},[e,r]),X(()=>{n.current=e},[e])}function ci(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:o,defaultOpen:i=!1,onOpenChange:c,name:m,disabled:d=!1,readOnly:l=!1,required:a=!1,modal:g=!0,actionsRef:x,inputRef:h,onOpenChangeComplete:y,items:v,multiple:f=!1,itemToStringLabel:b,itemToStringValue:p,isItemEqualToValue:w=Ss,highlightItemOnHover:E=!0,children:M}=e,{clearErrors:C}=hr(),{setDirty:O,setTouched:Y,setFocused:q,shouldValidateOnChange:N,validityData:W,setFilled:D,name:K,disabled:H,validation:P,validationMode:B}=gn(),R=dr({id:t}),L=H||d,A=K??m,[I,ge]=Ln({controlled:n,default:f?r??Gt:r,name:"Select",state:"value"}),[k,ae]=Ln({controlled:o,default:i,name:"Select",state:"open"}),Q=u.useRef([]),V=u.useRef([]),z=u.useRef(null),fe=u.useRef(null),De=u.useRef(0),U=u.useRef(null),le=u.useRef([]),te=u.useRef(!1),me=u.useRef(!1),Re=u.useRef(null),ue=u.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),G=u.useRef(!1),{mounted:J,setMounted:we,transitionStatus:re}=Xn(k),{openMethod:Z,triggerProps:be,reset:Ve}=Kr(k),S=Lt(()=>new Jr({id:R,modal:g,multiple:f,itemToStringLabel:b,itemToStringValue:p,isItemEqualToValue:w,value:I,open:k,mounted:J,transitionStatus:re,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,F=j(S,_.activeIndex),T=j(S,_.selectedIndex),ee=j(S,_.triggerElement),ne=j(S,_.positionerElement),se=u.useMemo(()=>f&&Array.isArray(I)&&I.length===0?"":ut(I,p),[f,I,p]),ye=u.useMemo(()=>f&&Array.isArray(I)?I.map($=>ut($,p)):ut(I,p),[f,I,p]),he=$e(S.state.triggerElement);Is({id:R,commit:P.commit,value:I,controlRef:he,name:A,getValue:()=>ye});const Oe=u.useRef(I);X(()=>{I!==Oe.current&&S.set("forceMount",!0)},[S,I]),X(()=>{D(f?Array.isArray(I)&&I.length>0:I!=null)},[f,I,D]),X(function(){if(k)return;const ie=le.current;if(f){const ke=Array.isArray(I)?I:[];if(ke.length===0){S.set("selectedIndex",null);return}const Pe=ke[ke.length-1],Ye=Qt(ie,Pe,w);S.set("selectedIndex",Ye===-1?null:Ye);return}const Ie=Qt(ie,I,w);S.set("selectedIndex",Ie===-1?null:Ie)},[f,k,I,le,w,S]),Ps(I,()=>{C(A),O(I!==W.initialValue),N()?P.commit(I):P.commit(I,!0)});const ve=xe(($,ie)=>{if(c?.($,ie),!ie.isCanceled&&(ae($),!$&&(ie.reason===_n||ie.reason===Dr)&&(Y(!0),q(!1),B==="onBlur"&&P.commit(I)),!$&&S.state.activeIndex!==null)){const Ie=Q.current[S.state.activeIndex];queueMicrotask(()=>{Ie?.setAttribute("tabindex","-1")})}}),Te=xe(()=>{we(!1),S.set("activeIndex",null),Ve(),y?.(!1)});cn({enabled:!x,open:k,ref:z,onComplete(){k||Te()}}),u.useImperativeHandle(x,()=>({unmount:Te}),[Te]);const _e=xe(($,ie)=>{s?.($,ie),!ie.isCanceled&&ge($)}),He=xe(()=>{const $=S.state.listElement||z.current;if(!$)return;const ie=$.scrollTop,Ie=$.scrollTop+$.clientHeight,ke=ie>1,Pe=Ie<$.scrollHeight-1;S.state.scrollUpArrowVisible!==ke&&S.set("scrollUpArrowVisible",ke),S.state.scrollDownArrowVisible!==Pe&&S.set("scrollDownArrowVisible",Pe)}),Ne=ir({open:k,onOpenChange:ve,elements:{reference:ee,floating:ne}}),ce=yo(Ne,{enabled:!l&&!L,event:"mousedown"}),pe=Xr(Ne,{bubbles:!1}),de=us(Ne,{enabled:!l&&!L,listRef:Q,activeIndex:F,selectedIndex:T,disabledIndices:Gt,onNavigate($){$===null&&!k||S.set("activeIndex",$)},focusItemOnHover:!1}),Se=fs(Ne,{enabled:!l&&!L&&(k||!f),listRef:V,activeIndex:F,selectedIndex:T,onMatch($){k?S.set("activeIndex",$):_e(le.current[$],Me("none"))},onTypingChange($){te.current=$}}),{getReferenceProps:Be,getFloatingProps:Ue,getItemProps:Xe}=Gr([ce,pe,de,Se]),Ge=u.useMemo(()=>$n(Be(),be,R?{id:R}:Rt),[Be,be,R]);ys(()=>{S.update({popupProps:Ue(),triggerProps:Ge})}),X(()=>{S.update({id:R,modal:g,multiple:f,value:I,open:k,mounted:J,transitionStatus:re,popupProps:Ue(),triggerProps:Ge,items:v,itemToStringLabel:b,itemToStringValue:p,isItemEqualToValue:w,openMethod:Z})},[S,R,g,f,I,k,J,re,Ue,Ge,v,b,p,w,Z]);const st=u.useMemo(()=>({store:S,name:A,required:a,disabled:L,readOnly:l,multiple:f,itemToStringLabel:b,itemToStringValue:p,highlightItemOnHover:E,setValue:_e,setOpen:ve,listRef:Q,popupRef:z,scrollHandlerRef:fe,handleScrollArrowVisibility:He,scrollArrowsMountedCountRef:De,getItemProps:Xe,events:Ne.context.events,valueRef:U,valuesRef:le,labelsRef:V,typingRef:te,selectionRef:ue,selectedItemTextRef:Re,validation:P,onOpenChangeComplete:y,keyboardActiveRef:me,alignItemWithTriggerActiveRef:G,initialValueRef:Oe}),[S,A,a,L,l,f,b,p,E,_e,ve,Xe,Ne.context.events,P,y,He]),at=zn(h,P.inputRef),ht=f&&Array.isArray(I)&&I.length>0,pt=u.useMemo(()=>!f||!Array.isArray(I)||!A?null:I.map($=>{const ie=ut($,p);return Ae.jsx("input",{type:"hidden",name:A,value:ie},ie)}),[f,I,A,p]);return Ae.jsx(lr.Provider,{value:st,children:Ae.jsxs(ar.Provider,{value:Ne,children:[M,Ae.jsx("input",{...P.getInputValidationProps({onFocus(){S.state.triggerElement?.focus({focusVisible:!0})},onChange($){if($.nativeEvent.defaultPrevented)return;const ie=$.target.value,Ie=Me(ln,$.nativeEvent);function ke(){if(f)return;const Pe=le.current.find(Ye=>ut(Ye,p).toLowerCase()===ie.toLowerCase());Pe!=null&&(O(Pe!==W.initialValue),_e(Pe,Ie),N()&&P.commit(Pe))}S.set("forceMount",!0),queueMicrotask(ke)}}),name:f?void 0:A,value:se,disabled:L,required:a&&!ht,readOnly:l,ref:at,style:A?Pr:Lr,tabIndex:-1,"aria-hidden":!0}),pt]})})}function Ls(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const o=parseFloat(n.width)||0,i=parseFloat(n.height)||0,c=parseFloat(r.width)||0,m=parseFloat(r.height)||0,d=Math.max(t.width,o,c),l=Math.max(t.height,i,m),a=d-t.width,g=l-t.height;return{left:t.left-a/2,right:t.right+a/2,top:t.top-g/2,bottom:t.bottom+g/2}}const At=2,Ds=400,Vn=200,Vs={...Zr,...Rs,value:()=>null},li=u.forwardRef(function(t,n){const{render:r,className:s,id:o,disabled:i=!1,nativeButton:c=!0,...m}=t,{setTouched:d,setFocused:l,validationMode:a,state:g,disabled:x}=gn(),{labelId:h}=fr(),{store:y,setOpen:v,selectionRef:f,validation:b,readOnly:p,required:w,alignItemWithTriggerActiveRef:E,disabled:M,keyboardActiveRef:C}=lt(),O=x||M||i,Y=j(y,_.open),q=j(y,_.value),N=j(y,_.triggerProps),W=j(y,_.positionerElement),D=j(y,_.listElement),K=j(y,_.id),H=j(y,_.hasSelectedValue),P=!H&&Y,B=j(y,_.hasNullItemLabel,P),R=o??K;dr({id:R});const L=$e(W),A=u.useRef(null),{getButtonProps:I,buttonRef:ge}=jn({disabled:O,native:c}),k=xe(te=>{y.set("triggerElement",te)}),ae=zn(n,A,ge,k),Q=tt(),V=tt(),z=tt(),fe=tt();u.useEffect(()=>{if(Y)return!(H||B)?z.start(Ds,()=>{f.current.allowUnselectedMouseUp=!0,f.current.allowSelectedMouseUp=!0}):fe.start(Vn,()=>{f.current.allowUnselectedMouseUp=!0,z.start(Vn,()=>{f.current.allowSelectedMouseUp=!0})}),()=>{z.clear(),fe.clear()};f.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},V.clear()},[Y,H,B,f,V,z,fe]);const De=u.useMemo(()=>D?.id??Wn(W)?.id,[D,W]),U=$n(N,{id:R,role:"combobox","aria-expanded":Y?"true":"false","aria-haspopup":"listbox","aria-controls":Y?De:void 0,"aria-labelledby":h,"aria-readonly":p||void 0,"aria-required":w||void 0,tabIndex:O?-1:0,ref:ae,onFocus(te){l(!0),Y&&E.current&&v(!1,Me(ln,te.nativeEvent)),Q.start(0,()=>{y.set("forceMount",!0)})},onBlur(te){xt(W,te.relatedTarget)||(d(!0),l(!1),a==="onBlur"&&b.commit(q))},onPointerMove(){C.current=!1},onKeyDown(){C.current=!0},onMouseDown(te){if(Y)return;const me=vt(te.currentTarget);function Re(ue){if(!A.current)return;const G=ue.target;if(xt(A.current,G)||xt(L.current,G)||G===A.current)return;const J=Ls(A.current);ue.clientX>=J.left-At&&ue.clientX<=J.right+At&&ue.clientY>=J.top-At&&ue.clientY<=J.bottom+At||v(!1,Me(Vr,ue))}V.start(0,()=>{me.addEventListener("mouseup",Re,{once:!0})})}},b.getValidationProps,m,I);U.role="combobox";const le=u.useMemo(()=>({...g,open:Y,disabled:O,value:q,readOnly:p,placeholder:!H}),[g,Y,O,q,p,H]);return ct("button",t,{ref:[n,A],state:le,stateAttributesMapping:Vs,props:U})}),ks={value:()=>null},ai=u.forwardRef(function(t,n){const{className:r,render:s,children:o,placeholder:i,...c}=t,{store:m,valueRef:d}=lt(),l=j(m,_.value),a=j(m,_.items),g=j(m,_.itemToStringLabel),x=j(m,_.hasSelectedValue),h=!x&&i!=null&&o==null,y=j(m,_.hasNullItemLabel,h),v=u.useMemo(()=>({value:l,placeholder:!x}),[l,x]);let f=null;return typeof o=="function"?f=o(l):o!=null?f=o:!x&&i!=null&&!y?f=i:Array.isArray(l)?f=As(l,a,g):f=mr(l,a,g),ct("span",t,{state:v,ref:[n,d],props:[{children:f},c],stateAttributesMapping:ks})}),Fs=u.createContext(void 0),ui=u.forwardRef(function(t,n){const{store:r}=lt(),s=j(r,_.mounted),o=j(r,_.forceMount);return s||o?Ae.jsx(Fs.Provider,{value:!0,children:Ae.jsx(kr,{ref:n,...t})}):null}),pr=u.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Hs(){return u.useContext(pr)}function Ns(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,o=xe(s),i=u.useRef(0),c=Lt(Us).current,m=Lt(Bs).current,[d,l]=u.useState(0),a=u.useRef(d),g=xe((f,b)=>{m.set(f,b??null),a.current+=1,l(a.current)}),x=xe(f=>{m.delete(f),a.current+=1,l(a.current)}),h=u.useMemo(()=>{const f=new Map;return Array.from(m.keys()).filter(p=>p.isConnected).sort(Ws).forEach((p,w)=>{const E=m.get(p)??{};f.set(p,{...E,index:w})}),f},[m,d]);X(()=>{if(typeof MutationObserver!="function"||h.size===0)return;const f=new MutationObserver(b=>{const p=new Set,w=E=>p.has(E)?p.delete(E):p.add(E);b.forEach(E=>{E.removedNodes.forEach(w),E.addedNodes.forEach(w)}),p.size===0&&(a.current+=1,l(a.current))});return h.forEach((b,p)=>{p.parentElement&&f.observe(p.parentElement,{childList:!0})}),()=>{f.disconnect()}},[h]),X(()=>{a.current===d&&(n.current.length!==h.size&&(n.current.length=h.size),r&&r.current.length!==h.size&&(r.current.length=h.size),i.current=h.size),o(h)},[o,h,n,r,d]),X(()=>()=>{n.current=[]},[n]),X(()=>()=>{r&&(r.current=[])},[r]);const y=xe(f=>(c.add(f),()=>{c.delete(f)}));X(()=>{c.forEach(f=>f(h))},[c,h]);const v=u.useMemo(()=>({register:g,unregister:x,subscribeMapChange:y,elementsRef:n,labelsRef:r,nextIndexRef:i}),[g,x,y,n,r,i]);return Ae.jsx(pr.Provider,{value:v,children:t})}function Bs(){return new Map}function Us(){return new Set}function Ws(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const xr=u.createContext(void 0);function _s(){const e=u.useContext(xr);if(!e)throw new Error(Et(59));return e}function Ht(e,t){e&&Object.assign(e.style,t)}const $s={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},zs={position:"fixed"},fi=u.forwardRef(function(t,n){const{anchor:r,positionMethod:s="absolute",className:o,render:i,side:c="bottom",align:m="center",sideOffset:d=0,alignOffset:l=0,collisionBoundary:a="clipping-ancestors",collisionPadding:g,arrowPadding:x=5,sticky:h=!1,disableAnchorTracking:y,alignItemWithTrigger:v=!0,collisionAvoidance:f=Fr,...b}=t,{store:p,listRef:w,labelsRef:E,alignItemWithTriggerActiveRef:M,selectedItemTextRef:C,valuesRef:O,initialValueRef:Y,popupRef:q,setValue:N}=lt(),W=ur(),D=j(p,_.open),K=j(p,_.mounted),H=j(p,_.modal),P=j(p,_.value),B=j(p,_.openMethod),R=j(p,_.positionerElement),L=j(p,_.triggerElement),A=j(p,_.isItemEqualToValue),I=u.useRef(null),ge=u.useRef(null),[k,ae]=u.useState(v),Q=K&&k&&B!=="touch";!K&&k!==v&&ae(v),X(()=>{K||(_.scrollUpArrowVisible(p.state)&&p.set("scrollUpArrowVisible",!1),_.scrollDownArrowVisible(p.state)&&p.set("scrollDownArrowVisible",!1))},[p,K]),u.useImperativeHandle(M,()=>Q),Qr((Q||H)&&D&&B!=="touch",L);const V=xs({anchor:r,floatingRootContext:W,positionMethod:s,mounted:K,side:c,sideOffset:d,align:m,alignOffset:l,arrowPadding:x,collisionBoundary:a,collisionPadding:g,sticky:h,disableAnchorTracking:y??Q,collisionAvoidance:f,keepMounted:!0}),z=Q?"none":V.side,fe=Q?zs:V.positionerStyles,De=u.useMemo(()=>{const G={};return D||(G.pointerEvents="none"),{role:"presentation",hidden:!K,style:{...fe,...G}}},[D,K,fe]),U=u.useMemo(()=>({open:D,side:z,align:V.align,anchorHidden:V.anchorHidden}),[D,z,V.align,V.anchorHidden]),le=xe(G=>{p.set("positionerElement",G)}),te=ct("div",t,{ref:[n,le],state:U,stateAttributesMapping:Gn,props:[De,b]}),me=u.useRef(0),Re=xe(G=>{if(G.size===0&&me.current===0||O.current.length===0)return;const J=me.current;if(me.current=G.size,G.size===J)return;const we=Me(ln);if(J!==0&&!p.state.multiple&&P!==null&&Qt(O.current,P,A)===-1){const Z=Y.current,Ve=Z!=null&&Kt(O.current,Z,A)?Z:null;N(Ve,we),Ve===null&&(p.set("selectedIndex",null),C.current=null)}if(J!==0&&p.state.multiple&&Array.isArray(P)){const re=P.filter(Z=>Kt(O.current,Z,A));(re.length!==P.length||re.some(Z=>!Kt(P,Z,A)))&&(N(re,we),re.length===0&&(p.set("selectedIndex",null),C.current=null))}if(D&&Q){p.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const re={height:""};Ht(R,re),Ht(q.current,re)}}),ue=u.useMemo(()=>({...V,side:z,alignItemWithTriggerActive:Q,setControlledAlignItemWithTrigger:ae,scrollUpArrowRef:I,scrollDownArrowRef:ge}),[V,z,Q,ae]);return Ae.jsx(Ns,{elementsRef:w,labelsRef:E,onMapChange:Re,children:Ae.jsxs(xr.Provider,{value:ue,children:[K&&H&&Ae.jsx(eo,{inert:Hr(!D),cutout:L}),te]})})});function yr(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const Ot="base-ui-disable-scrollbar",kn={className:Ot,getElement(e){return Ae.jsx("style",{nonce:e,href:Ot,precedence:"base-ui:low",children:`.${Ot}{scrollbar-width:none}.${Ot}::-webkit-scrollbar{display:none}`})}},js=u.createContext(void 0);function Ys(e){return u.useContext(js)}function qs(e){return e==="starting"?Nr:Rt}function Ks(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Xs=u.createContext(void 0),Gs={disableStyleElements:!1};function Js(){return u.useContext(Xs)??Gs}const Zs={...Gn,...Yn},di=u.forwardRef(function(t,n){const{render:r,className:s,...o}=t,{store:i,popupRef:c,onOpenChangeComplete:m,setOpen:d,valueRef:l,selectedItemTextRef:a,keyboardActiveRef:g,multiple:x,handleScrollArrowVisibility:h,scrollHandlerRef:y,highlightItemOnHover:v}=lt(),{side:f,align:b,alignItemWithTriggerActive:p,setControlledAlignItemWithTrigger:w,scrollDownArrowRef:E,scrollUpArrowRef:M}=_s(),C=Ys()!=null,O=ur(),{nonce:Y,disableStyleElements:q}=Js(),N=tt(),W=j(i,_.id),D=j(i,_.open),K=j(i,_.mounted),H=j(i,_.popupProps),P=j(i,_.transitionStatus),B=j(i,_.triggerElement),R=j(i,_.positionerElement),L=j(i,_.listElement),A=u.useRef(0),I=u.useRef(!1),ge=u.useRef(0),k=u.useRef(!1),ae=u.useRef({}),Q=Nn(),V=xe(U=>{if(!R||!c.current||!k.current)return;if(I.current||!p){h();return}const le=R.style.top==="0px",te=R.style.bottom==="0px",me=R.getBoundingClientRect().height,Re=vt(R),ue=getComputedStyle(R),G=parseFloat(ue.marginTop),J=parseFloat(ue.marginBottom),we=Fn(getComputedStyle(c.current)),re=Re.documentElement.clientHeight-G-J,Z=U.scrollTop,be=U.scrollHeight,Ve=U.clientHeight,S=be-Ve;let F=0,T=null,ee=!1;if(le){const ne=S-Z,se=me+ne,ye=Math.min(se,re);F=ye,ye!==re?T=S:ee=!0}else if(te){const ne=Z-0,se=me+ne,ye=Math.min(se,re),he=se-re;F=ye,ye!==re?T=0:(ee=!0,Z<S&&(T=Z-(ne-he)))}F!==0&&(R.style.height=`${F}px`),T!=null&&(U.scrollTop=T),(ee||F>=we)&&(I.current=!0),h()});u.useImperativeHandle(y,()=>V,[V]),cn({open:D,ref:c,onComplete(){D&&m?.(!0)}});const z=u.useMemo(()=>({open:D,transitionStatus:P,side:f,align:b}),[D,P,f,b]);X(()=>{!R||!c.current||Object.keys(ae.current).length||(ae.current={top:R.style.top||"0",left:R.style.left||"0",right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),X(()=>{D||p||(k.current=!1,I.current=!1,A.current=0,ge.current=0,Ht(R,ae.current))},[D,p,R,c]),X(()=>{const U=c.current;if(!(!D||!B||!R||!U||i.state.transitionStatus==="ending")){if(!p){k.current=!0,Q.request(h),U.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const le=ei(U);U.style.removeProperty("--transform-origin");try{const te=getComputedStyle(R),me=getComputedStyle(U),Re=vt(B),ue=qe(R),G=B.getBoundingClientRect(),J=R.getBoundingClientRect(),we=G.left,re=G.height,Z=L||U,be=Z.scrollHeight,Ve=parseFloat(me.borderBottomWidth),S=parseFloat(te.marginTop)||10,F=parseFloat(te.marginBottom)||10,T=parseFloat(te.minHeight)||100,ee=Fn(me),ne=5,se=5,ye=20,he=Re.documentElement.clientHeight-S-F,Oe=Re.documentElement.clientWidth,ve=he-G.bottom+re,Te=a.current,_e=l.current;let He,Ne=0,ce=0;if(Te&&_e){const $=_e.getBoundingClientRect();He=Te.getBoundingClientRect();const ie=$.left-we,Ie=He.left-J.left,ke=$.top-G.top+$.height/2,Pe=He.top-J.top+He.height/2;Ne=ie-Ie,ce=Pe-ke}const pe=ve+ce+F+Ve;let de=Math.min(he,pe);const Se=he-S-F,Be=pe-de,Ue=Math.max(ne,we+Ne),Xe=Oe-se,Ge=Math.max(0,Ue+J.width-Xe);R.style.left=`${Ue-Ge}px`,R.style.height=`${de}px`,R.style.maxHeight="auto",R.style.marginTop=`${S}px`,R.style.marginBottom=`${F}px`,U.style.height="100%";const st=Z.scrollHeight-Z.clientHeight,at=Be>=st;at&&(de=Math.min(he,J.height)-(Be-st));const ht=G.top<ye||G.bottom>he-ye||de<Math.min(be,T),pt=(ue.visualViewport?.scale??1)!==1&&Br;if(ht||pt){k.current=!0,Ht(R,ae.current),sn.flushSync(()=>w(!1));return}if(at){const $=Math.max(0,he-pe);R.style.top=J.height>=Se?"0":`${$}px`,R.style.height=`${de}px`,Z.scrollTop=Z.scrollHeight-Z.clientHeight,A.current=Math.max(T,de)}else R.style.bottom="0",A.current=Math.max(T,de),Z.scrollTop=Be;if(He){const $=J.top,ie=J.height,Ie=He.top+He.height/2,ke=ie>0?(Ie-$)/ie*100:50,Pe=Ks(ke,0,100);U.style.setProperty("--transform-origin",`50% ${Pe}%`)}(A.current===he||de>=ee)&&(I.current=!0),h(),setTimeout(()=>{k.current=!0})}finally{le()}})}},[i,D,R,B,l,a,c,h,p,w,Q,E,M,L]),u.useEffect(()=>{if(!p||!R||!D)return;const U=qe(R);function le(te){d(!1,Me(Ur,te))}return U.addEventListener("resize",le),()=>{U.removeEventListener("resize",le)}},[d,p,R,D]);const fe={...L?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":x||void 0,id:`${W}-list`},onKeyDown(U){g.current=!0,C&&no.has(U.key)&&U.stopPropagation()},onMouseMove(){g.current=!1},onPointerLeave(U){if(!v||yr(U)||U.pointerType==="touch")return;const le=U.currentTarget;N.start(0,()=>{i.set("activeIndex",null),le.focus({preventScroll:!0})})},onScroll(U){L||y.current?.(U.currentTarget)},...p&&{style:L?{height:"100%"}:$s}},De=ct("div",t,{ref:[n,c],state:z,stateAttributesMapping:Zs,props:[H,fe,qs(P),{className:!L&&p?kn.className:void 0},o]});return Ae.jsxs(u.Fragment,{children:[!q&&kn.getElement(Y),Ae.jsx(to,{context:O,modal:!1,disabled:!K,restoreFocus:!0,children:De})]})});function Fn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const Hn={transform:"none",scale:"1",translate:"0 0"};function Qs(e,t,n){n?e.setProperty(t,n):e.removeProperty(t)}function ei(e){const{style:t}=e,n={},r=Object.keys(Hn);for(const s of r)n[s]=t.getPropertyValue(s),t.setProperty(s,Hn[s]);return()=>{for(const s of r)Qs(t,s,n[s])}}let wr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function ti(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:s,index:o}=e,{register:i,unregister:c,subscribeMapChange:m,elementsRef:d,labelsRef:l,nextIndexRef:a}=Hs(),g=u.useRef(-1),[x,h]=u.useState(o??(s===wr.GuessFromOrder?()=>{if(g.current===-1){const f=a.current;a.current+=1,g.current=f}return g.current}:-1)),y=u.useRef(null),v=u.useCallback(f=>{if(y.current=f,x!==-1&&f!==null&&(d.current[x]=f,l)){const b=t!==void 0;l.current[x]=b?t:r?.current?.textContent??f.textContent}},[x,d,l,t,r]);return X(()=>{if(o!=null)return;const f=y.current;if(f)return i(f,n),()=>{c(f)}},[o,i,c,n]),X(()=>{if(o==null)return m(f=>{const b=y.current?f.get(y.current)?.index:null;b!=null&&h(b)})},[o,m,h]),u.useMemo(()=>({ref:v,index:x}),[x,v])}const Rr=u.createContext(void 0);function mn(){const e=u.useContext(Rr);if(!e)throw new Error(Et(57));return e}const gi=u.memo(u.forwardRef(function(t,n){const{render:r,className:s,value:o=null,label:i,disabled:c=!1,nativeButton:m=!1,...d}=t,l=u.useRef(null),a=ti({label:i,textRef:l,indexGuessBehavior:wr.GuessFromOrder}),{store:g,getItemProps:x,setOpen:h,setValue:y,selectionRef:v,typingRef:f,valuesRef:b,keyboardActiveRef:p,multiple:w,highlightItemOnHover:E}=lt(),M=tt(),C=j(g,_.isActive,a.index),O=j(g,_.isSelected,a.index,o),Y=j(g,_.isSelectedByFocus,a.index),q=j(g,_.isItemEqualToValue),N=a.index,W=N!==-1,D=u.useRef(null),K=$e(N);X(()=>{if(!W)return;const V=b.current;return V[N]=o,()=>{delete V[N]}},[W,N,o,b]),X(()=>{if(!W)return;const V=g.state.value;let z=V;w&&Array.isArray(V)&&V.length>0&&(z=V[V.length-1]),z!==void 0&&mt(z,o,q)&&g.set("selectedIndex",N)},[W,N,w,q,g,o]);const H=u.useMemo(()=>({disabled:c,selected:O,highlighted:C}),[c,O,C]),P=x({active:C,selected:O});P.onFocus=void 0,P.id=void 0;const B=u.useRef(null),R=u.useRef("mouse"),L=u.useRef(!1),{getButtonProps:A,buttonRef:I}=jn({disabled:c,focusableWhenDisabled:!0,native:m});function ge(V){const z=g.state.value;if(w){const fe=Array.isArray(z)?z:[],De=O?Es(fe,o,q):[...fe,o];y(De,Me($t,V))}else y(o,Me($t,V)),h(!1,Me($t,V))}const k={role:"option","aria-selected":O,tabIndex:C?0:-1,onFocus(){g.set("activeIndex",N)},onMouseEnter(){!p.current&&g.state.selectedIndex===null&&g.set("activeIndex",N)},onMouseMove(){E&&g.set("activeIndex",N)},onMouseLeave(V){!E||p.current||yr(V)||M.start(0,()=>{g.state.activeIndex===N&&g.set("activeIndex",null)})},onTouchStart(){v.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(V){B.current=V.key,g.set("activeIndex",N)},onClick(V){L.current=!1,!(V.type==="keydown"&&B.current===null)&&(c||B.current===" "&&f.current||R.current!=="touch"&&!C||(B.current=null,ge(V.nativeEvent)))},onPointerEnter(V){R.current=V.pointerType},onPointerDown(V){R.current=V.pointerType,L.current=!0},onMouseUp(V){if(c)return;if(L.current){L.current=!1;return}const z=!v.current.allowSelectedMouseUp&&O,fe=!v.current.allowUnselectedMouseUp&&!O;z||fe||R.current!=="touch"&&!C||ge(V.nativeEvent)}},ae=ct("div",t,{ref:[I,n,a.ref,D],state:H,props:[P,k,d,A]}),Q=u.useMemo(()=>({selected:O,indexRef:K,textRef:l,selectedByFocus:Y,hasRegistered:W}),[O,K,l,Y,W]);return Ae.jsx(Rr.Provider,{value:Q,children:ae})})),mi=u.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:s}=mn();return r||s?Ae.jsx(ni,{...t,ref:n}):null}),ni=u.memo(u.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:s,...o}=e,{selected:i}=mn(),c=u.useRef(null),{transitionStatus:m,setMounted:d}=Xn(i),l=u.useMemo(()=>({selected:i,transitionStatus:m}),[i,m]),a=ct("span",e,{ref:[t,c],state:l,props:[{"aria-hidden":!0,children:"✔️"},o],stateAttributesMapping:Yn});return cn({open:i,ref:c,onComplete(){i||d(!1)}}),a})),hi=u.memo(u.forwardRef(function(t,n){const{indexRef:r,textRef:s,selectedByFocus:o,hasRegistered:i}=mn(),{selectedItemTextRef:c}=lt(),{className:m,render:d,...l}=t,a=u.useCallback(x=>{if(!x||!i)return;const h=c.current===null||!c.current.isConnected;(o||h&&r.current===0)&&(c.current=x)},[c,r,o,i]);return ct("div",t,{ref:[a,n,s],props:l})}));export{si as C,$s as L,ci as S,hr as a,gn as b,fr as c,Ln as d,Is as e,Rs as f,Ps as g,li as h,ai as i,ui as j,fi as k,di as l,gi as m,hi as n,mi as o,yo as p,xs as q,qs as r,_ as s,ii as t,lt as u,Ys as v,_s as w,kn as x};
1
+ import{c as Sr,bT as tn,bU as St,bV as nt,bW as rt,r as u,bX as Nn,bn as tt,b as Me,bw as Wt,bY as Er,b0 as Rt,bZ as Xt,bt as Ce,b_ as et,b$ as qe,c0 as pn,c1 as Je,bN as Ze,c2 as Bn,c3 as nn,c4 as bt,c5 as Pt,c6 as Cr,c7 as Un,c8 as Mr,c9 as rn,ca as on,cb as Nt,ak as sn,cc as Ar,bA as Lt,aY as X,cd as Wn,ce as Or,aX as xe,cf as xn,br as Tr,bu as xt,cg as _t,bs as Ir,bz as _n,ch as Gt,ci as vt,aW as Et,aZ as je,j as Ae,b4 as cn,a$ as $n,a_ as zn,b1 as Pr,b2 as Lr,b3 as ln,cj as Dr,u as jn,a as ct,ck as Vr,bJ as kr,cl as Fr,bM as Hr,cm as Nr,cn as Br,co as Ur,b5 as Yn,cp as $t}from"./main-BZBATt4l.js";import{s as Le,i as yn,v as Wr,d as qn,w as _r,P as $r,c as Kn,e as $e,x as zr,y as jr,z as Yr,u as qr,f as oe,b as Xn,h as Kr,a as j,k as Xr,l as Gr,S as Jr,p as Zr,j as Qr,I as eo,o as Gn,q as to,r as no}from"./useOpenInteractionType-B65bQ4-n.js";const ro=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],si=Sr("chevron-down",ro),oo=["top","right","bottom","left"],gt=Math.min,We=Math.max,Dt=Math.round,ft=Math.floor,Ke=e=>({x:e,y:e}),so={left:"right",right:"left",bottom:"top",top:"bottom"};function Jt(e,t,n){return We(e,gt(t,n))}function Qe(e,t){return typeof e=="function"?e(t):e}function Fe(e){return e.split("-")[0]}function ot(e){return e.split("-")[1]}function an(e){return e==="x"?"y":"x"}function un(e){return e==="y"?"height":"width"}function ze(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function fn(e){return an(ze(e))}function io(e,t,n){n===void 0&&(n=!1);const r=ot(e),s=fn(e),o=un(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Vt(i)),[i,Vt(i)]}function co(e){const t=Vt(e);return[Zt(e),t,Zt(t)]}function Zt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const wn=["left","right"],Rn=["right","left"],lo=["top","bottom"],ao=["bottom","top"];function uo(e,t,n){switch(e){case"top":case"bottom":return n?t?Rn:wn:t?wn:Rn;case"left":case"right":return t?lo:ao;default:return[]}}function fo(e,t,n,r){const s=ot(e);let o=uo(Fe(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(Zt)))),o}function Vt(e){const t=Fe(e);return so[t]+e.slice(t.length)}function go(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jn(e){return typeof e!="number"?go(e):{top:e,right:e,bottom:e,left:e}}function kt(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function Ct(e,t,n){return Math.floor(e/t)!==n}function yt(e,t){return t<0||t>=e.current.length}function zt(e,t){return Ee(e,{disabledIndices:t})}function bn(e,t){return Ee(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Ee(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:s=1}={}){let o=t;do o+=n?-s:s;while(o>=0&&o<=e.current.length-1&&wt(e,o,r));return o}function mo(e,{event:t,orientation:n,loopFocus:r,rtl:s,cols:o,disabledIndices:i,minIndex:c,maxIndex:m,prevIndex:d,stopEvent:l=!1}){let a=d;const g=[],x={};let h=!1;{let f=null,b=-1;e.current.forEach((p,w)=>{if(p==null)return;const E=p.closest('[role="row"]');E&&(h=!0),(E!==f||b===-1)&&(f=E,b+=1,g[b]=[]),g[b].push(w),x[w]=b})}const y=h&&g.length>0&&g.some(f=>f.length!==o);function v(f){if(!y||d===-1)return;const b=x[d];if(b==null)return;const p=g[b].indexOf(d);let w=f==="up"?b-1:b+1;r&&(w<0?w=g.length-1:w>=g.length&&(w=0));const E=new Set;for(;w>=0&&w<g.length&&!E.has(w);){E.add(w);const M=g[w];if(M.length===0){w=f==="up"?w-1:w+1;continue}const C=Math.min(p,M.length-1);for(let O=C;O>=0;O-=1){const Y=M[O];if(!wt(e,Y,i))return Y}w=f==="up"?w-1:w+1,r&&(w<0?w=g.length-1:w>=g.length&&(w=0))}}if(t.key===tn){const f=v("up");if(f!==void 0)l&&Le(t),a=f;else{if(l&&Le(t),d===-1)a=m;else if(a=Ee(e,{startingIndex:a,amount:o,decrement:!0,disabledIndices:i}),r&&(d-o<c||a<0)){const b=d%o,p=m%o,w=m-(p-b);p===b?a=m:a=p>b?w:w-o}yt(e,a)&&(a=d)}}if(t.key===St){const f=v("down");f!==void 0?(l&&Le(t),a=f):(l&&Le(t),d===-1?a=c:(a=Ee(e,{startingIndex:d,amount:o,disabledIndices:i}),r&&d+o>m&&(a=Ee(e,{startingIndex:d%o-o,amount:o,disabledIndices:i}))),yt(e,a)&&(a=d))}if(n==="both"){const f=ft(d/o);t.key===(s?nt:rt)&&(l&&Le(t),d%o!==o-1?(a=Ee(e,{startingIndex:d,disabledIndices:i}),r&&Ct(a,o,f)&&(a=Ee(e,{startingIndex:d-d%o-1,disabledIndices:i}))):r&&(a=Ee(e,{startingIndex:d-d%o-1,disabledIndices:i})),Ct(a,o,f)&&(a=d)),t.key===(s?rt:nt)&&(l&&Le(t),d%o!==0?(a=Ee(e,{startingIndex:d,decrement:!0,disabledIndices:i}),r&&Ct(a,o,f)&&(a=Ee(e,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:i}))):r&&(a=Ee(e,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:i})),Ct(a,o,f)&&(a=d));const b=ft(m/o)===f;yt(e,a)&&(r&&b?a=t.key===(s?rt:nt)?m:Ee(e,{startingIndex:d-d%o-1,disabledIndices:i}):a=d)}return a}function ho(e,t,n){const r=[];let s=0;return e.forEach(({width:o,height:i},c)=>{let m=!1;for(n&&(s=0);!m;){const d=[];for(let l=0;l<o;l+=1)for(let a=0;a<i;a+=1)d.push(s+l+a*t);s%t+o<=t&&d.every(l=>r[l]==null)?(d.forEach(l=>{r[l]=c}),m=!0):s+=1}}),[...r]}function po(e,t,n,r,s){if(e===-1)return-1;const o=n.indexOf(e),i=t[e];switch(s){case"tl":return o;case"tr":return i?o+i.width-1:o;case"bl":return i?o+(i.height-1)*r:o;case"br":return n.lastIndexOf(e);default:return-1}}function xo(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function wt(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}function yo(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:s=!0,event:o="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:m=!0,touchOpenDelay:d=0}=t,l=u.useRef(void 0),a=Nn(),g=tt(),x=u.useMemo(()=>({onPointerDown(h){l.current=h.pointerType},onMouseDown(h){const y=l.current,v=h.nativeEvent,f=n.select("open");if(h.button!==0||o==="click"||yn(y,!0)&&c)return;const b=r.current.openEvent,p=b?.type,w=n.select("domReferenceElement")!==h.currentTarget,E=f&&w||!(f&&i&&(!(b&&m)||p==="click"||p==="mousedown"));if(Er(v.target)){const C=Me(Wt,v,v.target);E&&y==="touch"&&d>0?g.start(d,()=>{n.setOpen(!0,C)}):n.setOpen(E,C);return}const M=h.currentTarget;a.request(()=>{const C=Me(Wt,v,M);E&&y==="touch"&&d>0?g.start(d,()=>{n.setOpen(!0,C)}):n.setOpen(E,C)})},onClick(h){if(o==="mousedown-only")return;const y=l.current;if(o==="mousedown"&&y){l.current=void 0;return}if(yn(y,!0)&&c)return;const v=n.select("open"),f=r.current.openEvent,b=n.select("domReferenceElement")!==h.currentTarget,p=v&&b||!(v&&i&&(!(f&&m)||Wr(f))),w=Me(Wt,h.nativeEvent,h.currentTarget);p&&y==="touch"&&d>0?g.start(d,()=>{n.setOpen(!0,w)}):n.setOpen(p,w)},onKeyDown(){l.current=void 0}}),[r,o,c,n,m,i,a,g,d]);return u.useMemo(()=>s?{reference:x}:Rt,[s,x])}function vn(e,t,n){let{reference:r,floating:s}=e;const o=ze(t),i=fn(t),c=un(i),m=Fe(t),d=o==="y",l=r.x+r.width/2-s.width/2,a=r.y+r.height/2-s.height/2,g=r[c]/2-s[c]/2;let x;switch(m){case"top":x={x:l,y:r.y-s.height};break;case"bottom":x={x:l,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:a};break;case"left":x={x:r.x-s.width,y:a};break;default:x={x:r.x,y:r.y}}switch(ot(t)){case"start":x[i]-=g*(n&&d?-1:1);break;case"end":x[i]+=g*(n&&d?-1:1);break}return x}async function wo(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:c,strategy:m}=e,{boundary:d="clippingAncestors",rootBoundary:l="viewport",elementContext:a="floating",altBoundary:g=!1,padding:x=0}=Qe(t,e),h=Jn(x),v=c[g?a==="floating"?"reference":"floating":a],f=kt(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(v)))==null||n?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:d,rootBoundary:l,strategy:m})),b=a==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,p=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),w=await(o.isElement==null?void 0:o.isElement(p))?await(o.getScale==null?void 0:o.getScale(p))||{x:1,y:1}:{x:1,y:1},E=kt(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:p,strategy:m}):b);return{top:(f.top-E.top+h.top)/w.y,bottom:(E.bottom-f.bottom+h.bottom)/w.y,left:(f.left-E.left+h.left)/w.x,right:(E.right-f.right+h.right)/w.x}}const Ro=50,bo=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:wo},m=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:l,y:a}=vn(d,r,m),g=r,x=0;const h={};for(let y=0;y<o.length;y++){const v=o[y];if(!v)continue;const{name:f,fn:b}=v,{x:p,y:w,data:E,reset:M}=await b({x:l,y:a,initialPlacement:r,placement:g,strategy:s,middlewareData:h,rects:d,platform:c,elements:{reference:e,floating:t}});l=p??l,a=w??a,h[f]={...h[f],...E},M&&x<Ro&&(x++,typeof M=="object"&&(M.placement&&(g=M.placement),M.rects&&(d=M.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):M.rects),{x:l,y:a}=vn(d,g,m)),y=-1)}return{x:l,y:a,placement:g,strategy:s,middlewareData:h}},vo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:c,platform:m,elements:d}=t,{mainAxis:l=!0,crossAxis:a=!0,fallbackPlacements:g,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:y=!0,...v}=Qe(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const f=Fe(s),b=ze(c),p=Fe(c)===c,w=await(m.isRTL==null?void 0:m.isRTL(d.floating)),E=g||(p||!y?[Vt(c)]:co(c)),M=h!=="none";!g&&M&&E.push(...fo(c,y,h,w));const C=[c,...E],O=await m.detectOverflow(t,v),Y=[];let q=((r=o.flip)==null?void 0:r.overflows)||[];if(l&&Y.push(O[f]),a){const K=io(s,i,w);Y.push(O[K[0]],O[K[1]])}if(q=[...q,{placement:s,overflows:Y}],!Y.every(K=>K<=0)){var N,W;const K=(((N=o.flip)==null?void 0:N.index)||0)+1,H=C[K];if(H&&(!(a==="alignment"?b!==ze(H):!1)||q.every(R=>ze(R.placement)===b?R.overflows[0]>0:!0)))return{data:{index:K,overflows:q},reset:{placement:H}};let P=(W=q.filter(B=>B.overflows[0]<=0).sort((B,R)=>B.overflows[1]-R.overflows[1])[0])==null?void 0:W.placement;if(!P)switch(x){case"bestFit":{var D;const B=(D=q.filter(R=>{if(M){const L=ze(R.placement);return L===b||L==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(L=>L>0).reduce((L,A)=>L+A,0)]).sort((R,L)=>R[1]-L[1])[0])==null?void 0:D[0];B&&(P=B);break}case"initialPlacement":P=c;break}if(s!==P)return{reset:{placement:P}}}return{}}}};function Sn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function En(e){return oo.some(t=>e[t]>=0)}const So=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=Qe(e,t);switch(s){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),c=Sn(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:En(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),c=Sn(i,n.floating);return{data:{escapedOffsets:c,escaped:En(c)}}}default:return{}}}}},Zn=new Set(["left","top"]);async function Eo(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=Fe(n),c=ot(n),m=ze(n)==="y",d=Zn.has(i)?-1:1,l=o&&m?-1:1,a=Qe(t,e);let{mainAxis:g,crossAxis:x,alignmentAxis:h}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return c&&typeof h=="number"&&(x=c==="end"?h*-1:h),m?{x:x*l,y:g*d}:{x:g*d,y:x*l}}const Co=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:c}=t,m=await Eo(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+m.x,y:o+m.y,data:{...m,placement:i}}}}},Mo=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:m={fn:f=>{let{x:b,y:p}=f;return{x:b,y:p}}},...d}=Qe(e,t),l={x:n,y:r},a=await o.detectOverflow(t,d),g=ze(Fe(s)),x=an(g);let h=l[x],y=l[g];if(i){const f=x==="y"?"top":"left",b=x==="y"?"bottom":"right",p=h+a[f],w=h-a[b];h=Jt(p,h,w)}if(c){const f=g==="y"?"top":"left",b=g==="y"?"bottom":"right",p=y+a[f],w=y-a[b];y=Jt(p,y,w)}const v=m.fn({...t,[x]:h,[g]:y});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[x]:i,[g]:c}}}}}},Ao=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:c=0,mainAxis:m=!0,crossAxis:d=!0}=Qe(e,t),l={x:n,y:r},a=ze(s),g=an(a);let x=l[g],h=l[a];const y=Qe(c,t),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(m){const p=g==="y"?"height":"width",w=o.reference[g]-o.floating[p]+v.mainAxis,E=o.reference[g]+o.reference[p]-v.mainAxis;x<w?x=w:x>E&&(x=E)}if(d){var f,b;const p=g==="y"?"width":"height",w=Zn.has(Fe(s)),E=o.reference[a]-o.floating[p]+(w&&((f=i.offset)==null?void 0:f[a])||0)+(w?0:v.crossAxis),M=o.reference[a]+o.reference[p]+(w?0:((b=i.offset)==null?void 0:b[a])||0)-(w?v.crossAxis:0);h<E?h=E:h>M&&(h=M)}return{[g]:x,[a]:h}}}},Oo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:c}=t,{apply:m=()=>{},...d}=Qe(e,t),l=await i.detectOverflow(t,d),a=Fe(s),g=ot(s),x=ze(s)==="y",{width:h,height:y}=o.floating;let v,f;a==="top"||a==="bottom"?(v=a,f=g===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(f=a,v=g==="end"?"top":"bottom");const b=y-l.top-l.bottom,p=h-l.left-l.right,w=gt(y-l[v],b),E=gt(h-l[f],p),M=!t.middlewareData.shift;let C=w,O=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=p),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=b),M&&!g){const q=We(l.left,0),N=We(l.right,0),W=We(l.top,0),D=We(l.bottom,0);x?O=h-2*(q!==0||N!==0?q+N:We(l.left,l.right)):C=y-2*(W!==0||D!==0?W+D:We(l.top,l.bottom))}await m({...t,availableWidth:O,availableHeight:C});const Y=await i.getDimensions(c.floating);return h!==Y.width||y!==Y.height?{reset:{rects:!0}}:{}}}};function Qn(e){const t=Je(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ze(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,c=Dt(n)!==o||Dt(r)!==i;return c&&(n=o,r=i),{width:n,height:r,$:c}}function dn(e){return Ce(e)?e:e.contextElement}function dt(e){const t=dn(e);if(!Ze(t))return Ke(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Qn(t);let i=(o?Dt(n.width):n.width)/r,c=(o?Dt(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const To=Ke(0);function er(e){const t=qe(e);return!Bn()||!t.visualViewport?To:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Io(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==qe(e)?!1:t}function it(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=dn(e);let i=Ke(1);t&&(r?Ce(r)&&(i=dt(r)):i=dt(e));const c=Io(o,n,r)?er(o):Ke(0);let m=(s.left+c.x)/i.x,d=(s.top+c.y)/i.y,l=s.width/i.x,a=s.height/i.y;if(o){const g=qe(o),x=r&&Ce(r)?qe(r):r;let h=g,y=pn(h);for(;y&&r&&x!==h;){const v=dt(y),f=y.getBoundingClientRect(),b=Je(y),p=f.left+(y.clientLeft+parseFloat(b.paddingLeft))*v.x,w=f.top+(y.clientTop+parseFloat(b.paddingTop))*v.y;m*=v.x,d*=v.y,l*=v.x,a*=v.y,m+=p,d+=w,h=qe(y),y=pn(h)}}return kt({width:l,height:a,x:m,y:d})}function Bt(e,t){const n=Nt(e).scrollLeft;return t?t.left+n:it(et(e)).left+n}function tr(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Bt(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Po(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=et(r),c=t?nn(t.floating):!1;if(r===i||c&&o)return n;let m={scrollLeft:0,scrollTop:0},d=Ke(1);const l=Ke(0),a=Ze(r);if((a||!a&&!o)&&((rn(r)!=="body"||on(i))&&(m=Nt(r)),a)){const x=it(r);d=dt(r),l.x=x.x+r.clientLeft,l.y=x.y+r.clientTop}const g=i&&!a&&!o?tr(i,m):Ke(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-m.scrollLeft*d.x+l.x+g.x,y:n.y*d.y-m.scrollTop*d.y+l.y+g.y}}function Lo(e){return Array.from(e.getClientRects())}function Do(e){const t=et(e),n=Nt(e),r=e.ownerDocument.body,s=We(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=We(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Bt(e);const c=-n.scrollTop;return Je(r).direction==="rtl"&&(i+=We(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:c}}const Cn=25;function Vo(e,t){const n=qe(e),r=et(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,c=0,m=0;if(s){o=s.width,i=s.height;const l=Bn();(!l||l&&t==="fixed")&&(c=s.offsetLeft,m=s.offsetTop)}const d=Bt(r);if(d<=0){const l=r.ownerDocument,a=l.body,g=getComputedStyle(a),x=l.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,h=Math.abs(r.clientWidth-a.clientWidth-x);h<=Cn&&(o-=h)}else d<=Cn&&(o+=d);return{width:o,height:i,x:c,y:m}}function ko(e,t){const n=it(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Ze(e)?dt(e):Ke(1),i=e.clientWidth*o.x,c=e.clientHeight*o.y,m=s*o.x,d=r*o.y;return{width:i,height:c,x:m,y:d}}function Mn(e,t,n){let r;if(t==="viewport")r=Vo(e,n);else if(t==="document")r=Do(et(e));else if(Ce(t))r=ko(t,n);else{const s=er(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return kt(r)}function nr(e,t){const n=bt(e);return n===t||!Ce(n)||Pt(n)?!1:Je(n).position==="fixed"||nr(n,t)}function Fo(e,t){const n=t.get(e);if(n)return n;let r=Xt(e,[],!1).filter(c=>Ce(c)&&rn(c)!=="body"),s=null;const o=Je(e).position==="fixed";let i=o?bt(e):e;for(;Ce(i)&&!Pt(i);){const c=Je(i),m=Un(i);!m&&c.position==="fixed"&&(s=null),(o?!m&&!s:!m&&c.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||on(i)&&!m&&nr(e,i))?r=r.filter(l=>l!==i):s=c,i=bt(i)}return t.set(e,r),r}function Ho(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?nn(t)?[]:Fo(t,this._c):[].concat(n),r],c=Mn(t,i[0],s);let m=c.top,d=c.right,l=c.bottom,a=c.left;for(let g=1;g<i.length;g++){const x=Mn(t,i[g],s);m=We(x.top,m),d=gt(x.right,d),l=gt(x.bottom,l),a=We(x.left,a)}return{width:d-a,height:l-m,x:a,y:m}}function No(e){const{width:t,height:n}=Qn(e);return{width:t,height:n}}function Bo(e,t,n){const r=Ze(t),s=et(t),o=n==="fixed",i=it(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const m=Ke(0);function d(){m.x=Bt(s)}if(r||!r&&!o)if((rn(t)!=="body"||on(s))&&(c=Nt(t)),r){const x=it(t,!0,o,t);m.x=x.x+t.clientLeft,m.y=x.y+t.clientTop}else s&&d();o&&!r&&s&&d();const l=s&&!r&&!o?tr(s,c):Ke(0),a=i.left+c.scrollLeft-m.x-l.x,g=i.top+c.scrollTop-m.y-l.y;return{x:a,y:g,width:i.width,height:i.height}}function jt(e){return Je(e).position==="static"}function An(e,t){if(!Ze(e)||Je(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return et(e)===n&&(n=n.ownerDocument.body),n}function rr(e,t){const n=qe(e);if(nn(e))return n;if(!Ze(e)){let s=bt(e);for(;s&&!Pt(s);){if(Ce(s)&&!jt(s))return s;s=bt(s)}return n}let r=An(e,t);for(;r&&Cr(r)&&jt(r);)r=An(r,t);return r&&Pt(r)&&jt(r)&&!Un(r)?n:r||Mr(e)||n}const Uo=async function(e){const t=this.getOffsetParent||rr,n=this.getDimensions,r=await n(e.floating);return{reference:Bo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Wo(e){return Je(e).direction==="rtl"}const _o={convertOffsetParentRelativeRectToViewportRelativeRect:Po,getDocumentElement:et,getClippingRect:Ho,getOffsetParent:rr,getElementRects:Uo,getClientRects:Lo,getDimensions:No,getScale:dt,isElement:Ce,isRTL:Wo};function or(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $o(e,t){let n=null,r;const s=et(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,m){c===void 0&&(c=!1),m===void 0&&(m=1),o();const d=e.getBoundingClientRect(),{left:l,top:a,width:g,height:x}=d;if(c||t(),!g||!x)return;const h=ft(a),y=ft(s.clientWidth-(l+g)),v=ft(s.clientHeight-(a+x)),f=ft(l),p={rootMargin:-h+"px "+-y+"px "+-v+"px "+-f+"px",threshold:We(0,gt(1,m))||1};let w=!0;function E(M){const C=M[0].intersectionRatio;if(C!==m){if(!w)return i();C?i(!1,C):r=setTimeout(()=>{i(!1,1e-7)},1e3)}C===1&&!or(d,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(E,{...p,root:s.ownerDocument})}catch{n=new IntersectionObserver(E,p)}n.observe(e)}return i(!0),o}function On(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,d=dn(e),l=s||o?[...d?Xt(d):[],...t?Xt(t):[]]:[];l.forEach(f=>{s&&f.addEventListener("scroll",n,{passive:!0}),o&&f.addEventListener("resize",n)});const a=d&&c?$o(d,n):null;let g=-1,x=null;i&&(x=new ResizeObserver(f=>{let[b]=f;b&&b.target===d&&x&&t&&(x.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var p;(p=x)==null||p.observe(t)})),n()}),d&&!m&&x.observe(d),t&&x.observe(t));let h,y=m?it(e):null;m&&v();function v(){const f=it(e);y&&!or(y,f)&&n(),y=f,h=requestAnimationFrame(v)}return n(),()=>{var f;l.forEach(b=>{s&&b.removeEventListener("scroll",n),o&&b.removeEventListener("resize",n)}),a?.(),(f=x)==null||f.disconnect(),x=null,m&&cancelAnimationFrame(h)}}const zo=Co,jo=Mo,Yo=vo,qo=Oo,Ko=So,Xo=Ao,Go=(e,t,n)=>{const r=new Map,s={platform:_o,...n},o={...s.platform,_c:r};return bo(e,t,{...s,platform:o})};var Jo=typeof document<"u",Zo=function(){},Tt=Jo?u.useLayoutEffect:Zo;function Ft(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ft(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!Ft(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function sr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tn(e,t){const n=sr(e);return Math.round(t*n)/n}function Yt(e){const t=u.useRef(e);return Tt(()=>{t.current=e}),t}function Qo(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:c=!0,whileElementsMounted:m,open:d}=e,[l,a]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,x]=u.useState(r);Ft(g,r)||x(r);const[h,y]=u.useState(null),[v,f]=u.useState(null),b=u.useCallback(R=>{R!==M.current&&(M.current=R,y(R))},[]),p=u.useCallback(R=>{R!==C.current&&(C.current=R,f(R))},[]),w=o||h,E=i||v,M=u.useRef(null),C=u.useRef(null),O=u.useRef(l),Y=m!=null,q=Yt(m),N=Yt(s),W=Yt(d),D=u.useCallback(()=>{if(!M.current||!C.current)return;const R={placement:t,strategy:n,middleware:g};N.current&&(R.platform=N.current),Go(M.current,C.current,R).then(L=>{const A={...L,isPositioned:W.current!==!1};K.current&&!Ft(O.current,A)&&(O.current=A,sn.flushSync(()=>{a(A)}))})},[g,t,n,N,W]);Tt(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,a(R=>({...R,isPositioned:!1})))},[d]);const K=u.useRef(!1);Tt(()=>(K.current=!0,()=>{K.current=!1}),[]),Tt(()=>{if(w&&(M.current=w),E&&(C.current=E),w&&E){if(q.current)return q.current(w,E,D);D()}},[w,E,D,q,Y]);const H=u.useMemo(()=>({reference:M,floating:C,setReference:b,setFloating:p}),[b,p]),P=u.useMemo(()=>({reference:w,floating:E}),[w,E]),B=u.useMemo(()=>{const R={position:n,left:0,top:0};if(!P.floating)return R;const L=Tn(P.floating,l.x),A=Tn(P.floating,l.y);return c?{...R,transform:"translate("+L+"px, "+A+"px)",...sr(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:A}},[n,c,P.floating,l.x,l.y]);return u.useMemo(()=>({...l,update:D,refs:H,elements:P,floatingStyles:B}),[l,D,H,P,B])}const es=(e,t)=>{const n=zo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ts=(e,t)=>{const n=jo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ns=(e,t)=>({fn:Xo(e).fn,options:[e,t]}),rs=(e,t)=>{const n=Yo(e);return{name:n.name,fn:n.fn,options:[e,t]}},os=(e,t)=>{const n=qo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ss=(e,t)=>{const n=Ko(e);return{name:n.name,fn:n.fn,options:[e,t]}};function ir(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=Ar(),o=qn()!=null,i=Lt(()=>new _r({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new $r,floatingId:s,nested:o,noEmit:e.noEmit||!1})).current;return X(()=>{const c={open:t,floatingId:s};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ce(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,s,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=o,i.context.noEmit=e.noEmit||!1,i}function is(e={}){const{nodeId:t,externalTree:n}=e,r=ir(e),s=e.rootContext||r,o={reference:s.useState("referenceElement"),floating:s.useState("floatingElement"),domReference:s.useState("domReferenceElement")},[i,c]=u.useState(null),m=u.useRef(null),d=Kn(n);X(()=>{o.domReference&&(m.current=o.domReference)},[o.domReference]);const l=Qo({...e,elements:{...o,...i&&{reference:i}}}),a=u.useCallback(C=>{const O=Ce(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;c(O),l.refs.setReference(O)},[l.refs]),[g,x]=u.useState(null),[h,y]=u.useState(null);s.useSyncedValue("referenceElement",g),s.useSyncedValue("domReferenceElement",Ce(g)?g:null),s.useSyncedValue("floatingElement",h);const v=u.useCallback(C=>{(Ce(C)||C===null)&&(m.current=C,x(C)),(Ce(l.refs.reference.current)||l.refs.reference.current===null||C!==null&&!Ce(C))&&l.refs.setReference(C)},[l.refs,x]),f=u.useCallback(C=>{y(C),l.refs.setFloating(C)},[l.refs]),b=u.useMemo(()=>({...l.refs,setReference:v,setFloating:f,setPositionReference:a,domReference:m}),[l.refs,v,f,a]),p=u.useMemo(()=>({...l.elements,domReference:o.domReference}),[l.elements,o.domReference]),w=s.useState("open"),E=s.useState("floatingId"),M=u.useMemo(()=>({...l,dataRef:s.context.dataRef,open:w,onOpenChange:s.setOpen,events:s.context.events,floatingId:E,refs:b,elements:p,nodeId:t,rootStore:s}),[l,b,p,t,s,w,E]);return X(()=>{s.context.dataRef.current.floatingContext=M;const C=d?.nodesRef.current.find(O=>O.id===t);C&&(C.context=M)}),u.useMemo(()=>({...l,context:M,refs:b,elements:p,rootStore:s}),[l,b,p,M,s])}const cs="Escape";function Ut(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Mt(e,t){return Ut(t,e===tn||e===St,e===nt||e===rt)}function qt(e,t,n){return Ut(t,e===St,n?e===nt:e===rt)||e==="Enter"||e===" "||e===""}function ls(e,t,n){return Ut(t,n?e===nt:e===rt,e===St)}function as(e,t,n,r){const s=n?e===rt:e===nt,o=e===tn;return t==="both"||t==="horizontal"&&r&&r>1?e===cs:Ut(t,s,o)}function us(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingElement"),o=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:c,activeIndex:m,onNavigate:d=()=>{},enabled:l=!0,selectedIndex:a=null,allowEscape:g=!1,loopFocus:x=!1,nested:h=!1,rtl:y=!1,virtual:v=!1,focusItemOnOpen:f="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:p=!0,disabledIndices:w=void 0,orientation:E="vertical",parentOrientation:M,cols:C=1,scrollItemIntoView:O=!0,itemSizes:Y,dense:q=!1,id:N,resetOnPointerLeave:W=!0,externalTree:D}=t,K=Wn(s),H=$e(K),P=qn(),B=Kn(D);X(()=>{i.current.orientation=E},[i,E]);const R=Or(o),L=u.useRef(f),A=u.useRef(a??-1),I=u.useRef(null),ge=u.useRef(!0),k=xe(S=>{d(A.current===-1?null:A.current,S)}),ae=u.useRef(k),Q=u.useRef(!!s),V=u.useRef(r),z=u.useRef(!1),fe=u.useRef(!1),De=$e(w),U=$e(r),le=$e(O),te=$e(a),me=$e(W),Re=xe(()=>{function S(ne){v?B?.events.emit("virtualfocus",ne):zr(ne,{sync:z.current,preventScroll:!0})}const F=c.current[A.current],T=fe.current;F&&S(F),(z.current?ne=>ne():requestAnimationFrame)(()=>{const ne=c.current[A.current]||F;if(!ne)return;F||S(ne);const se=le.current;se&&G&&(T||!ge.current)&&ne.scrollIntoView?.(typeof se=="boolean"?{block:"nearest",inline:"nearest"}:se)})});X(()=>{l&&(r&&s?(A.current=a??-1,L.current&&a!=null&&(fe.current=!0,k())):Q.current&&(A.current=-1,ae.current()))},[l,r,s,a,k]),X(()=>{if(l){if(!r){z.current=!1;return}if(s)if(m==null){if(z.current=!1,te.current!=null)return;if(Q.current&&(A.current=-1,Re()),(!V.current||!Q.current)&&L.current&&(I.current!=null||L.current===!0&&I.current==null)){let S=0;const F=()=>{c.current[0]==null?(S<2&&(S?requestAnimationFrame:queueMicrotask)(F),S+=1):(A.current=I.current==null||qt(I.current,E,y)||h?zt(c):bn(c),I.current=null,k())};F()}}else yt(c,m)||(A.current=m,Re(),fe.current=!1)}},[l,r,s,m,te,h,c,E,y,k,Re,De]),X(()=>{if(!l||s||!B||v||!Q.current)return;const S=B.nodesRef.current,F=S.find(ne=>ne.id===P)?.context?.elements.floating,T=xn(Tr(s)),ee=S.some(ne=>ne.context&&xt(ne.context.elements.floating,T));F&&!ee&&ge.current&&F.focus({preventScroll:!0})},[l,s,B,P,v]),X(()=>{ae.current=k,V.current=r,Q.current=!!s}),X(()=>{r||(I.current=null,L.current=f)},[r,f]);const ue=m!=null,G=u.useMemo(()=>{function S(T){if(!U.current)return;const ee=c.current.indexOf(T.currentTarget);ee!==-1&&A.current!==ee&&(A.current=ee,k(T))}return{onFocus(T){z.current=!0,S(T)},onClick:({currentTarget:T})=>T.focus({preventScroll:!0}),onMouseMove(T){z.current=!0,fe.current=!1,b&&S(T)},onPointerLeave(T){if(!U.current||!ge.current||T.pointerType==="touch")return;z.current=!0;const ee=T.relatedTarget;!b||c.current.includes(ee)||me.current&&(A.current=-1,k(T),v||H.current?.focus({preventScroll:!0}))}}},[U,H,b,c,k,me,v]),J=u.useCallback(()=>M??B?.nodesRef.current.find(S=>S.id===P)?.context?.dataRef?.current.orientation,[P,B,M]),we=xe(S=>{if(ge.current=!1,z.current=!0,S.which===229||!U.current&&S.currentTarget===H.current)return;if(h&&as(S.key,E,y,C)){Mt(S.key,J())||Le(S),n.setOpen(!1,Me(_t,S.nativeEvent)),Ze(o)&&(v?B?.events.emit("virtualfocus",o):o.focus());return}const F=A.current,T=zt(c,w),ee=bn(c,w);if(R||(S.key==="Home"&&(Le(S),A.current=T,k(S)),S.key==="End"&&(Le(S),A.current=ee,k(S))),C>1){const ne=Y||Array.from({length:c.current.length},()=>({width:1,height:1})),se=ho(ne,C,q),ye=se.findIndex(ve=>ve!=null&&!wt(c,ve,w)),he=se.reduce((ve,Te,_e)=>Te!=null&&!wt(c,Te,w)?_e:ve,-1),Oe=se[mo({current:se.map(ve=>ve!=null?c.current[ve]:null)},{event:S,orientation:E,loopFocus:x,rtl:y,cols:C,disabledIndices:xo([...(typeof w!="function"?w:null)||c.current.map((ve,Te)=>wt(c,Te,w)?Te:void 0),void 0],se),minIndex:ye,maxIndex:he,prevIndex:po(A.current>ee?T:A.current,ne,se,C,S.key===St?"bl":S.key===(y?nt:rt)?"tr":"tl"),stopEvent:!0})];if(Oe!=null&&(A.current=Oe,k(S)),E==="both")return}if(Mt(S.key,E)){if(Le(S),r&&!v&&xn(S.currentTarget.ownerDocument)===S.currentTarget){A.current=qt(S.key,E,y)?T:ee,k(S);return}qt(S.key,E,y)?x?F>=ee?g&&F!==c.current.length?A.current=-1:(z.current=!1,A.current=T):A.current=Ee(c,{startingIndex:F,disabledIndices:w}):A.current=Math.min(ee,Ee(c,{startingIndex:F,disabledIndices:w})):x?F<=T?g&&F!==-1?A.current=c.current.length:(z.current=!1,A.current=ee):A.current=Ee(c,{startingIndex:F,decrement:!0,disabledIndices:w}):A.current=Math.max(T,Ee(c,{startingIndex:F,decrement:!0,disabledIndices:w})),yt(c,A.current)&&(A.current=-1),k(S)}}),re=u.useMemo(()=>v&&r&&ue&&{"aria-activedescendant":`${N}-${m}`},[v,r,ue,N,m]),Z=u.useMemo(()=>({"aria-orientation":E==="both"?void 0:E,...R?{}:re,onKeyDown(S){if(S.key==="Tab"&&S.shiftKey&&r&&!v){const F=Ir(S.nativeEvent);if(F&&!xt(H.current,F))return;Le(S),n.setOpen(!1,Me(_n,S.nativeEvent)),Ze(o)&&o.focus();return}we(S)},onPointerMove(){ge.current=!0}}),[re,we,H,E,R,n,r,v,o]),be=u.useMemo(()=>{function S(T){f==="auto"&&jr(T.nativeEvent)&&(L.current=!v)}function F(T){L.current=f,f==="auto"&&Yr(T.nativeEvent)&&(L.current=!0)}return{onKeyDown(T){const ee=n.select("open");ge.current=!1;const ne=T.key.startsWith("Arrow"),se=ls(T.key,J(),y),ye=Mt(T.key,E),he=(h?se:ye)||T.key==="Enter"||T.key.trim()==="";if(v&&ee)return we(T);if(!(!ee&&!p&&ne)){if(he){const Oe=Mt(T.key,J());I.current=h&&Oe?null:T.key}if(h){se&&(Le(T),ee?(A.current=zt(c,De.current),k(T)):n.setOpen(!0,Me(_t,T.nativeEvent,T.currentTarget)));return}ye&&(te.current!=null&&(A.current=te.current),Le(T),!ee&&p?n.setOpen(!0,Me(_t,T.nativeEvent,T.currentTarget)):we(T),ee&&k(T))}},onFocus(T){n.select("open")&&!v&&(A.current=-1,k(T))},onPointerDown:F,onPointerEnter:F,onMouseDown:S,onClick:S}},[we,De,f,c,h,k,n,p,E,J,y,te,v]),Ve=u.useMemo(()=>({...re,...be}),[re,be]);return u.useMemo(()=>l?{reference:Ve,floating:Z,item:G,trigger:be}:{},[l,Ve,Z,be,G])}function fs(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.context.dataRef,{listRef:o,activeIndex:i,onMatch:c,onTypingChange:m,enabled:d=!0,findMatch:l=null,resetMs:a=750,ignoreKeys:g=Gt,selectedIndex:x=null}=t,h=tt(),y=u.useRef(""),v=u.useRef(x??i??-1),f=u.useRef(null);X(()=>{r&&(h.clear(),f.current=null,y.current="")},[r,h]),X(()=>{r&&y.current===""&&(v.current=x??i??-1)},[r,x,i]);const b=xe(M=>{M?s.current.typing||(s.current.typing=M,m?.(M)):s.current.typing&&(s.current.typing=M,m?.(M))}),p=xe(M=>{function C(W,D,K){const H=l?l(D,K):D.find(P=>P?.toLocaleLowerCase().indexOf(K.toLocaleLowerCase())===0);return H?W.indexOf(H):-1}const O=o.current;if(y.current.length>0&&y.current[0]!==" "&&(C(O,O,y.current)===-1?b(!1):M.key===" "&&Le(M)),O==null||g.includes(M.key)||M.key.length!==1||M.ctrlKey||M.metaKey||M.altKey)return;r&&M.key!==" "&&(Le(M),b(!0)),O.every(W=>W?W[0]?.toLocaleLowerCase()!==W[1]?.toLocaleLowerCase():!0)&&y.current===M.key&&(y.current="",v.current=f.current),y.current+=M.key,h.start(a,()=>{y.current="",v.current=f.current,b(!1)});const q=v.current,N=C(O,[...O.slice((q||0)+1),...O.slice(0,(q||0)+1)],y.current);N!==-1?(c?.(N),f.current=N):M.key!==" "&&(y.current="",b(!1))}),w=u.useMemo(()=>({onKeyDown:p}),[p]),E=u.useMemo(()=>({onKeyDown:p,onKeyUp(M){M.key===" "&&b(!1)}}),[p,b]);return u.useMemo(()=>d?{reference:w,floating:E}:{},[d,w,E])}const ds=u.createContext(void 0);function gs(){return u.useContext(ds)?.direction??"ltr"}const ms=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:c,middlewareData:m}=t,{element:d,padding:l=0,offsetParent:a="real"}=Qe(e,t)||{};if(d==null)return{};const g=Jn(l),x={x:n,y:r},h=fn(s),y=un(h),v=await i.getDimensions(d),f=h==="y",b=f?"top":"left",p=f?"bottom":"right",w=f?"clientHeight":"clientWidth",E=o.reference[y]+o.reference[h]-x[h]-o.floating[y],M=x[h]-o.reference[h],C=a==="real"?await i.getOffsetParent?.(d):c.floating;let O=c.floating[w]||o.floating[y];(!O||!await i.isElement?.(C))&&(O=c.floating[w]||o.floating[y]);const Y=E/2-M/2,q=O/2-v[y]/2-1,N=Math.min(g[b],q),W=Math.min(g[p],q),D=N,K=O-v[y]-W,H=O/2-v[y]/2+Y,P=Jt(D,H,K),B=!m.arrow&&ot(s)!=null&&H!==P&&o.reference[y]/2-(H<D?N:W)-v[y]/2<0,R=B?H<D?H-D:H-K:0;return{[h]:x[h]+R,data:{[h]:P,centerOffset:H-P-R,...B&&{alignmentOffset:R}},reset:B}}}),hs=(e,t)=>({...ms(e),options:[e,t]}),ps={name:"hide",async fn(e){const{width:t,height:n,x:r,y:s}=e.rects.reference,o=t===0&&n===0&&r===0&&s===0;return{data:{referenceHidden:(await ss().fn(e)).data?.referenceHidden||o}}}},It={sideX:"left",sideY:"top"},ii={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:s},platform:o,strategy:i,placement:c}=e,m=qe(s),d=m.getComputedStyle(s);if(!(d.transitionDuration!=="0s"&&d.transitionDuration!==""))return{x:t,y:n,data:It};const a=await o.getOffsetParent?.(s);let g={width:0,height:0};if(i==="fixed"&&m?.visualViewport)g={width:m.visualViewport.width,height:m.visualViewport.height};else if(a===m){const b=vt(s);g={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await o.isElement?.(a)&&(g=await o.getDimensions(a));const x=Fe(c);let h=t,y=n;x==="left"&&(h=g.width-(t+r.width)),x==="top"&&(y=g.height-(n+r.height));const v=x==="left"?"right":It.sideX,f=x==="top"?"bottom":It.sideY;return{x:h,y,data:{sideX:v,sideY:f}}}};function cr(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function In(e,t,n){const{rects:r,placement:s}=e;return{side:cr(t,Fe(s),n),align:ot(s)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function xs(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:m=5,sticky:d=!1,arrowPadding:l=5,disableAnchorTracking:a=!1,keepMounted:g=!1,floatingRootContext:x,mounted:h,collisionAvoidance:y,shiftCrossAxis:v=!1,nodeId:f,adaptiveOrigin:b,lazyFlip:p=!1,externalTree:w}=e,[E,M]=u.useState(null);!h&&E!==null&&M(null);const C=y.side||"flip",O=y.align||"flip",Y=y.fallbackAxisSide||"end",q=typeof t=="function"?t:void 0,N=xe(q),W=q?N:t,D=$e(t),H=gs()==="rtl",P=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":H?"left":"right","inline-start":H?"right":"left"}[r],B=o==="center"?P:`${P}-${o}`;let R=m;const L=1,A=r==="bottom"?L:0,I=r==="top"?L:0,ge=r==="right"?L:0,k=r==="left"?L:0;typeof R=="number"?R={top:R+A,right:R+k,bottom:R+I,left:R+ge}:R&&(R={top:(R.top||0)+A,right:(R.right||0)+k,bottom:(R.bottom||0)+I,left:(R.left||0)+ge});const ae={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:R},Q=u.useRef(null),V=$e(s),z=$e(i),U=[es(ce=>{const pe=In(ce,r,H),de=typeof V.current=="function"?V.current(pe):V.current,Se=typeof z.current=="function"?z.current(pe):z.current;return{mainAxis:de,crossAxis:Se,alignmentAxis:Se}},[typeof s!="function"?s:0,typeof i!="function"?i:0,H,r])],le=O==="none"&&C!=="shift",te=!le&&(d||v||C==="shift"),me=C==="none"?null:rs({...ae,padding:{top:R.top+L,right:R.right+L,bottom:R.bottom+L,left:R.left+L},mainAxis:!v&&C==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:Y}),Re=le?null:ts(ce=>{const pe=vt(ce.elements.floating).documentElement;return{...ae,rootBoundary:v?{x:0,y:0,width:pe.clientWidth,height:pe.clientHeight}:void 0,mainAxis:O!=="none",crossAxis:te,limiter:d||v?void 0:ns(de=>{if(!Q.current)return{};const{width:Se,height:Be}=Q.current.getBoundingClientRect(),Ue=ze(Fe(de.placement)),Xe=Ue==="y"?Se:Be,Ge=Ue==="y"?R.left+R.right:R.top+R.bottom;return{offset:Xe/2+Ge/2}})}},[ae,d,v,R,O]);C==="shift"||O==="shift"||o==="center"?U.push(Re,me):U.push(me,Re),U.push(os({...ae,apply({elements:{floating:ce},rects:{reference:pe},availableWidth:de,availableHeight:Se}){Object.entries({"--available-width":`${de}px`,"--available-height":`${Se}px`,"--anchor-width":`${pe.width}px`,"--anchor-height":`${pe.height}px`}).forEach(([Be,Ue])=>{ce.style.setProperty(Be,Ue)})}}),hs(()=>({element:Q.current||document.createElement("div"),padding:l,offsetParent:"floating"}),[l]),{name:"transformOrigin",fn(ce){const{elements:pe,middlewareData:de,placement:Se,rects:Be,y:Ue}=ce,Xe=Fe(Se),Ge=ze(Xe),st=Q.current,at=de.arrow?.x||0,ht=de.arrow?.y||0,pt=st?.clientWidth||0,$=st?.clientHeight||0,ie=at+pt/2,Ie=ht+$/2,ke=Math.abs(de.shift?.y||0),Pe=Be.reference.height/2,Ye=typeof s=="function"?s(In(ce,r,H)):s,hn=ke>Ye,br={top:`${ie}px calc(100% + ${Ye}px)`,bottom:`${ie}px ${-Ye}px`,left:`calc(100% + ${Ye}px) ${Ie}px`,right:`${-Ye}px ${Ie}px`}[Xe],vr=`${ie}px ${Be.reference.y+Pe-Ue}px`;return pe.floating.style.setProperty("--transform-origin",te&&Ge==="y"&&hn?vr:br),{}}},ps,b),X(()=>{!h&&x&&x.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[h,x]);const ue=u.useMemo(()=>({elementResize:!a&&typeof ResizeObserver<"u",layoutShift:!a&&typeof IntersectionObserver<"u"}),[a]),{refs:G,elements:J,x:we,y:re,middlewareData:Z,update:be,placement:Ve,context:S,isPositioned:F,floatingStyles:T}=is({rootContext:x,placement:B,middleware:U,strategy:n,whileElementsMounted:g?void 0:(...ce)=>On(...ce,ue),nodeId:f,externalTree:w}),{sideX:ee,sideY:ne}=Z.adaptiveOrigin||It,se=F?n:"fixed",ye=u.useMemo(()=>b?{position:se,[ee]:we,[ne]:re}:{position:se,...T},[b,se,ee,we,ne,re,T]),he=u.useRef(null);X(()=>{if(!h)return;const ce=D.current,pe=typeof ce=="function"?ce():ce,Se=(Pn(pe)?pe.current:pe)||null||null;Se!==he.current&&(G.setPositionReference(Se),he.current=Se)},[h,G,W,D]),u.useEffect(()=>{if(!h)return;const ce=D.current;typeof ce!="function"&&Pn(ce)&&ce.current!==he.current&&(G.setPositionReference(ce.current),he.current=ce.current)},[h,G,W,D]),u.useEffect(()=>{if(g&&h&&J.domReference&&J.floating)return On(J.domReference,J.floating,be,ue)},[g,h,J,be,ue]);const Oe=Fe(Ve),ve=cr(r,Oe,H),Te=ot(Ve)||"center",_e=!!Z.hide?.referenceHidden;X(()=>{p&&h&&F&&M(Oe)},[p,h,F,Oe]);const He=u.useMemo(()=>({position:"absolute",top:Z.arrow?.y,left:Z.arrow?.x}),[Z.arrow]),Ne=Z.arrow?.centerOffset!==0;return u.useMemo(()=>({positionerStyles:ye,arrowStyles:He,arrowRef:Q,arrowUncentered:Ne,side:ve,align:Te,physicalSide:Oe,anchorHidden:_e,refs:G,context:S,isPositioned:F,update:be}),[ye,He,Q,Ne,ve,Te,Oe,_e,G,S,F,be])}function Pn(e){return e!=null&&"current"in e}function ys(e){const t=u.useRef(!0);t.current&&(t.current=!1,e())}function Ln({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=u.useRef(e!==void 0),[o,i]=u.useState(t),c=s?e:o,m=u.useCallback(d=>{s||i(d)},[]);return[c,m]}const lr=u.createContext(null),ar=u.createContext(null);function lt(){const e=u.useContext(lr);if(e===null)throw new Error(Et(60));return e}function ur(){const e=u.useContext(ar);if(e===null)throw new Error(Et(61));return e}let Dn=(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})({});const ws={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Rs={valid(e){return e===null?null:e?{[Dn.valid]:""}:{[Dn.invalid]:""}}},bs=u.createContext({invalid:void 0,name:void 0,validityData:{state:ws,errors:[],error:"",value:"",initialValue:null},setValidityData:je,disabled:void 0,touched:!1,setTouched:je,dirty:!1,setDirty:je,filled:!1,setFilled:je,focused:!1,setFocused:je,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Rt)=>e,getInputValidationProps:(e=Rt)=>e,inputRef:{current:null},commit:async()=>{}}});function gn(e=!0){const t=u.useContext(bs);if(t.setValidityData===je&&!e)throw new Error(Et(28));return t}const vs=u.createContext({controlId:void 0,setControlId:je,labelId:void 0,setLabelId:je,messageIds:[],setMessageIds:je,getDescriptionProps:e=>e});function fr(){return u.useContext(vs)}function dr(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:s,setControlId:o}=fr(),i=qr(t);return X(()=>{if(!(!n&&!t||o===je)){if(n){const c=r?.current;Ce(c)&&c.closest("label")!=null?o(t??null):o(s??i)}else t&&o(t);return()=>{t&&o(void 0)}}},[t,r,s,o,n,i]),s??i}const Ss=(e,t)=>Object.is(e,t);function mt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Kt(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:mt(r,t,n))}function Qt(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:mt(r,t,n))}function Es(e,t,n){return e.filter(r=>!mt(r,t,n))}function en(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function gr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Cs(e){if(!Array.isArray(e))return e!=null&&!("null"in e);if(gr(e)){for(const t of e)for(const n of t.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function Ms(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return en(e)}function ut(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?en(e.value):en(e)}function mr(e,t,n){function r(){return Ms(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const s=gr(t)?t.flatMap(o=>o.items):t;if(e==null||typeof e!="object"){const o=s.find(i=>i.value===e);return o&&o.label!=null?o.label:r()}if("value"in e){const o=s.find(i=>i&&i.value===e.value);if(o&&o.label!=null)return o.label}}return r()}function As(e,t,n){return e.reduce((r,s,o)=>(o>0&&r.push(", "),r.push(Ae.jsx(u.Fragment,{children:mr(s,t,n)},o)),r),[])}const _={id:oe(e=>e.id),modal:oe(e=>e.modal),multiple:oe(e=>e.multiple),items:oe(e=>e.items),itemToStringLabel:oe(e=>e.itemToStringLabel),itemToStringValue:oe(e=>e.itemToStringValue),isItemEqualToValue:oe(e=>e.isItemEqualToValue),value:oe(e=>e.value),hasSelectedValue:oe(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ut(t,r)!==""}),hasNullItemLabel:oe((e,t)=>t?Cs(e.items):!1),open:oe(e=>e.open),mounted:oe(e=>e.mounted),forceMount:oe(e=>e.forceMount),transitionStatus:oe(e=>e.transitionStatus),openMethod:oe(e=>e.openMethod),activeIndex:oe(e=>e.activeIndex),selectedIndex:oe(e=>e.selectedIndex),isActive:oe((e,t)=>e.activeIndex===t),isSelected:oe((e,t,n)=>{const r=e.isItemEqualToValue,s=e.value;return e.multiple?Array.isArray(s)&&s.some(o=>mt(o,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:mt(s,n,r)}),isSelectedByFocus:oe((e,t)=>e.selectedIndex===t),popupProps:oe(e=>e.popupProps),triggerProps:oe(e=>e.triggerProps),triggerElement:oe(e=>e.triggerElement),positionerElement:oe(e=>e.positionerElement),listElement:oe(e=>e.listElement),scrollUpArrowVisible:oe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:oe(e=>e.scrollDownArrowVisible),hasScrollArrows:oe(e=>e.hasScrollArrows)},Os=u.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:je,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function hr(){return u.useContext(Os)}function Ts(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Is(e){const{enabled:t=!0,value:n,id:r,name:s,controlRef:o,commit:i}=e,{formRef:c}=hr(),{invalid:m,markedDirtyRef:d,validityData:l,setValidityData:a}=gn(),g=xe(e.getValue);X(()=>{if(!t)return;let x=n;x===void 0&&(x=g()),l.initialValue===null&&x!==null&&a(h=>({...h,initialValue:x}))},[t,a,n,l.initialValue,g]),X(()=>{!t||!r||c.current.fields.set(r,{getValue:g,name:s,controlRef:o,validityData:Ts(l,m),validate(x=!0){let h=n;h===void 0&&(h=g()),d.current=!0,x?sn.flushSync(()=>i(h)):i(h)}})},[i,o,t,c,g,r,m,d,s,l,n]),X(()=>{const x=c.current.fields;return()=>{r&&x.delete(r)}},[c,r])}function Ps(e,t){const n=u.useRef(e),r=xe(t);X(()=>{n.current!==e&&r(n.current)},[e,r]),X(()=>{n.current=e},[e])}function ci(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:o,defaultOpen:i=!1,onOpenChange:c,name:m,disabled:d=!1,readOnly:l=!1,required:a=!1,modal:g=!0,actionsRef:x,inputRef:h,onOpenChangeComplete:y,items:v,multiple:f=!1,itemToStringLabel:b,itemToStringValue:p,isItemEqualToValue:w=Ss,highlightItemOnHover:E=!0,children:M}=e,{clearErrors:C}=hr(),{setDirty:O,setTouched:Y,setFocused:q,shouldValidateOnChange:N,validityData:W,setFilled:D,name:K,disabled:H,validation:P,validationMode:B}=gn(),R=dr({id:t}),L=H||d,A=K??m,[I,ge]=Ln({controlled:n,default:f?r??Gt:r,name:"Select",state:"value"}),[k,ae]=Ln({controlled:o,default:i,name:"Select",state:"open"}),Q=u.useRef([]),V=u.useRef([]),z=u.useRef(null),fe=u.useRef(null),De=u.useRef(0),U=u.useRef(null),le=u.useRef([]),te=u.useRef(!1),me=u.useRef(!1),Re=u.useRef(null),ue=u.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),G=u.useRef(!1),{mounted:J,setMounted:we,transitionStatus:re}=Xn(k),{openMethod:Z,triggerProps:be,reset:Ve}=Kr(k),S=Lt(()=>new Jr({id:R,modal:g,multiple:f,itemToStringLabel:b,itemToStringValue:p,isItemEqualToValue:w,value:I,open:k,mounted:J,transitionStatus:re,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,F=j(S,_.activeIndex),T=j(S,_.selectedIndex),ee=j(S,_.triggerElement),ne=j(S,_.positionerElement),se=u.useMemo(()=>f&&Array.isArray(I)&&I.length===0?"":ut(I,p),[f,I,p]),ye=u.useMemo(()=>f&&Array.isArray(I)?I.map($=>ut($,p)):ut(I,p),[f,I,p]),he=$e(S.state.triggerElement);Is({id:R,commit:P.commit,value:I,controlRef:he,name:A,getValue:()=>ye});const Oe=u.useRef(I);X(()=>{I!==Oe.current&&S.set("forceMount",!0)},[S,I]),X(()=>{D(f?Array.isArray(I)&&I.length>0:I!=null)},[f,I,D]),X(function(){if(k)return;const ie=le.current;if(f){const ke=Array.isArray(I)?I:[];if(ke.length===0){S.set("selectedIndex",null);return}const Pe=ke[ke.length-1],Ye=Qt(ie,Pe,w);S.set("selectedIndex",Ye===-1?null:Ye);return}const Ie=Qt(ie,I,w);S.set("selectedIndex",Ie===-1?null:Ie)},[f,k,I,le,w,S]),Ps(I,()=>{C(A),O(I!==W.initialValue),N()?P.commit(I):P.commit(I,!0)});const ve=xe(($,ie)=>{if(c?.($,ie),!ie.isCanceled&&(ae($),!$&&(ie.reason===_n||ie.reason===Dr)&&(Y(!0),q(!1),B==="onBlur"&&P.commit(I)),!$&&S.state.activeIndex!==null)){const Ie=Q.current[S.state.activeIndex];queueMicrotask(()=>{Ie?.setAttribute("tabindex","-1")})}}),Te=xe(()=>{we(!1),S.set("activeIndex",null),Ve(),y?.(!1)});cn({enabled:!x,open:k,ref:z,onComplete(){k||Te()}}),u.useImperativeHandle(x,()=>({unmount:Te}),[Te]);const _e=xe(($,ie)=>{s?.($,ie),!ie.isCanceled&&ge($)}),He=xe(()=>{const $=S.state.listElement||z.current;if(!$)return;const ie=$.scrollTop,Ie=$.scrollTop+$.clientHeight,ke=ie>1,Pe=Ie<$.scrollHeight-1;S.state.scrollUpArrowVisible!==ke&&S.set("scrollUpArrowVisible",ke),S.state.scrollDownArrowVisible!==Pe&&S.set("scrollDownArrowVisible",Pe)}),Ne=ir({open:k,onOpenChange:ve,elements:{reference:ee,floating:ne}}),ce=yo(Ne,{enabled:!l&&!L,event:"mousedown"}),pe=Xr(Ne,{bubbles:!1}),de=us(Ne,{enabled:!l&&!L,listRef:Q,activeIndex:F,selectedIndex:T,disabledIndices:Gt,onNavigate($){$===null&&!k||S.set("activeIndex",$)},focusItemOnHover:!1}),Se=fs(Ne,{enabled:!l&&!L&&(k||!f),listRef:V,activeIndex:F,selectedIndex:T,onMatch($){k?S.set("activeIndex",$):_e(le.current[$],Me("none"))},onTypingChange($){te.current=$}}),{getReferenceProps:Be,getFloatingProps:Ue,getItemProps:Xe}=Gr([ce,pe,de,Se]),Ge=u.useMemo(()=>$n(Be(),be,R?{id:R}:Rt),[Be,be,R]);ys(()=>{S.update({popupProps:Ue(),triggerProps:Ge})}),X(()=>{S.update({id:R,modal:g,multiple:f,value:I,open:k,mounted:J,transitionStatus:re,popupProps:Ue(),triggerProps:Ge,items:v,itemToStringLabel:b,itemToStringValue:p,isItemEqualToValue:w,openMethod:Z})},[S,R,g,f,I,k,J,re,Ue,Ge,v,b,p,w,Z]);const st=u.useMemo(()=>({store:S,name:A,required:a,disabled:L,readOnly:l,multiple:f,itemToStringLabel:b,itemToStringValue:p,highlightItemOnHover:E,setValue:_e,setOpen:ve,listRef:Q,popupRef:z,scrollHandlerRef:fe,handleScrollArrowVisibility:He,scrollArrowsMountedCountRef:De,getItemProps:Xe,events:Ne.context.events,valueRef:U,valuesRef:le,labelsRef:V,typingRef:te,selectionRef:ue,selectedItemTextRef:Re,validation:P,onOpenChangeComplete:y,keyboardActiveRef:me,alignItemWithTriggerActiveRef:G,initialValueRef:Oe}),[S,A,a,L,l,f,b,p,E,_e,ve,Xe,Ne.context.events,P,y,He]),at=zn(h,P.inputRef),ht=f&&Array.isArray(I)&&I.length>0,pt=u.useMemo(()=>!f||!Array.isArray(I)||!A?null:I.map($=>{const ie=ut($,p);return Ae.jsx("input",{type:"hidden",name:A,value:ie},ie)}),[f,I,A,p]);return Ae.jsx(lr.Provider,{value:st,children:Ae.jsxs(ar.Provider,{value:Ne,children:[M,Ae.jsx("input",{...P.getInputValidationProps({onFocus(){S.state.triggerElement?.focus({focusVisible:!0})},onChange($){if($.nativeEvent.defaultPrevented)return;const ie=$.target.value,Ie=Me(ln,$.nativeEvent);function ke(){if(f)return;const Pe=le.current.find(Ye=>ut(Ye,p).toLowerCase()===ie.toLowerCase());Pe!=null&&(O(Pe!==W.initialValue),_e(Pe,Ie),N()&&P.commit(Pe))}S.set("forceMount",!0),queueMicrotask(ke)}}),name:f?void 0:A,value:se,disabled:L,required:a&&!ht,readOnly:l,ref:at,style:A?Pr:Lr,tabIndex:-1,"aria-hidden":!0}),pt]})})}function Ls(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const o=parseFloat(n.width)||0,i=parseFloat(n.height)||0,c=parseFloat(r.width)||0,m=parseFloat(r.height)||0,d=Math.max(t.width,o,c),l=Math.max(t.height,i,m),a=d-t.width,g=l-t.height;return{left:t.left-a/2,right:t.right+a/2,top:t.top-g/2,bottom:t.bottom+g/2}}const At=2,Ds=400,Vn=200,Vs={...Zr,...Rs,value:()=>null},li=u.forwardRef(function(t,n){const{render:r,className:s,id:o,disabled:i=!1,nativeButton:c=!0,...m}=t,{setTouched:d,setFocused:l,validationMode:a,state:g,disabled:x}=gn(),{labelId:h}=fr(),{store:y,setOpen:v,selectionRef:f,validation:b,readOnly:p,required:w,alignItemWithTriggerActiveRef:E,disabled:M,keyboardActiveRef:C}=lt(),O=x||M||i,Y=j(y,_.open),q=j(y,_.value),N=j(y,_.triggerProps),W=j(y,_.positionerElement),D=j(y,_.listElement),K=j(y,_.id),H=j(y,_.hasSelectedValue),P=!H&&Y,B=j(y,_.hasNullItemLabel,P),R=o??K;dr({id:R});const L=$e(W),A=u.useRef(null),{getButtonProps:I,buttonRef:ge}=jn({disabled:O,native:c}),k=xe(te=>{y.set("triggerElement",te)}),ae=zn(n,A,ge,k),Q=tt(),V=tt(),z=tt(),fe=tt();u.useEffect(()=>{if(Y)return!(H||B)?z.start(Ds,()=>{f.current.allowUnselectedMouseUp=!0,f.current.allowSelectedMouseUp=!0}):fe.start(Vn,()=>{f.current.allowUnselectedMouseUp=!0,z.start(Vn,()=>{f.current.allowSelectedMouseUp=!0})}),()=>{z.clear(),fe.clear()};f.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},V.clear()},[Y,H,B,f,V,z,fe]);const De=u.useMemo(()=>D?.id??Wn(W)?.id,[D,W]),U=$n(N,{id:R,role:"combobox","aria-expanded":Y?"true":"false","aria-haspopup":"listbox","aria-controls":Y?De:void 0,"aria-labelledby":h,"aria-readonly":p||void 0,"aria-required":w||void 0,tabIndex:O?-1:0,ref:ae,onFocus(te){l(!0),Y&&E.current&&v(!1,Me(ln,te.nativeEvent)),Q.start(0,()=>{y.set("forceMount",!0)})},onBlur(te){xt(W,te.relatedTarget)||(d(!0),l(!1),a==="onBlur"&&b.commit(q))},onPointerMove(){C.current=!1},onKeyDown(){C.current=!0},onMouseDown(te){if(Y)return;const me=vt(te.currentTarget);function Re(ue){if(!A.current)return;const G=ue.target;if(xt(A.current,G)||xt(L.current,G)||G===A.current)return;const J=Ls(A.current);ue.clientX>=J.left-At&&ue.clientX<=J.right+At&&ue.clientY>=J.top-At&&ue.clientY<=J.bottom+At||v(!1,Me(Vr,ue))}V.start(0,()=>{me.addEventListener("mouseup",Re,{once:!0})})}},b.getValidationProps,m,I);U.role="combobox";const le=u.useMemo(()=>({...g,open:Y,disabled:O,value:q,readOnly:p,placeholder:!H}),[g,Y,O,q,p,H]);return ct("button",t,{ref:[n,A],state:le,stateAttributesMapping:Vs,props:U})}),ks={value:()=>null},ai=u.forwardRef(function(t,n){const{className:r,render:s,children:o,placeholder:i,...c}=t,{store:m,valueRef:d}=lt(),l=j(m,_.value),a=j(m,_.items),g=j(m,_.itemToStringLabel),x=j(m,_.hasSelectedValue),h=!x&&i!=null&&o==null,y=j(m,_.hasNullItemLabel,h),v=u.useMemo(()=>({value:l,placeholder:!x}),[l,x]);let f=null;return typeof o=="function"?f=o(l):o!=null?f=o:!x&&i!=null&&!y?f=i:Array.isArray(l)?f=As(l,a,g):f=mr(l,a,g),ct("span",t,{state:v,ref:[n,d],props:[{children:f},c],stateAttributesMapping:ks})}),Fs=u.createContext(void 0),ui=u.forwardRef(function(t,n){const{store:r}=lt(),s=j(r,_.mounted),o=j(r,_.forceMount);return s||o?Ae.jsx(Fs.Provider,{value:!0,children:Ae.jsx(kr,{ref:n,...t})}):null}),pr=u.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Hs(){return u.useContext(pr)}function Ns(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,o=xe(s),i=u.useRef(0),c=Lt(Us).current,m=Lt(Bs).current,[d,l]=u.useState(0),a=u.useRef(d),g=xe((f,b)=>{m.set(f,b??null),a.current+=1,l(a.current)}),x=xe(f=>{m.delete(f),a.current+=1,l(a.current)}),h=u.useMemo(()=>{const f=new Map;return Array.from(m.keys()).filter(p=>p.isConnected).sort(Ws).forEach((p,w)=>{const E=m.get(p)??{};f.set(p,{...E,index:w})}),f},[m,d]);X(()=>{if(typeof MutationObserver!="function"||h.size===0)return;const f=new MutationObserver(b=>{const p=new Set,w=E=>p.has(E)?p.delete(E):p.add(E);b.forEach(E=>{E.removedNodes.forEach(w),E.addedNodes.forEach(w)}),p.size===0&&(a.current+=1,l(a.current))});return h.forEach((b,p)=>{p.parentElement&&f.observe(p.parentElement,{childList:!0})}),()=>{f.disconnect()}},[h]),X(()=>{a.current===d&&(n.current.length!==h.size&&(n.current.length=h.size),r&&r.current.length!==h.size&&(r.current.length=h.size),i.current=h.size),o(h)},[o,h,n,r,d]),X(()=>()=>{n.current=[]},[n]),X(()=>()=>{r&&(r.current=[])},[r]);const y=xe(f=>(c.add(f),()=>{c.delete(f)}));X(()=>{c.forEach(f=>f(h))},[c,h]);const v=u.useMemo(()=>({register:g,unregister:x,subscribeMapChange:y,elementsRef:n,labelsRef:r,nextIndexRef:i}),[g,x,y,n,r,i]);return Ae.jsx(pr.Provider,{value:v,children:t})}function Bs(){return new Map}function Us(){return new Set}function Ws(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const xr=u.createContext(void 0);function _s(){const e=u.useContext(xr);if(!e)throw new Error(Et(59));return e}function Ht(e,t){e&&Object.assign(e.style,t)}const $s={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},zs={position:"fixed"},fi=u.forwardRef(function(t,n){const{anchor:r,positionMethod:s="absolute",className:o,render:i,side:c="bottom",align:m="center",sideOffset:d=0,alignOffset:l=0,collisionBoundary:a="clipping-ancestors",collisionPadding:g,arrowPadding:x=5,sticky:h=!1,disableAnchorTracking:y,alignItemWithTrigger:v=!0,collisionAvoidance:f=Fr,...b}=t,{store:p,listRef:w,labelsRef:E,alignItemWithTriggerActiveRef:M,selectedItemTextRef:C,valuesRef:O,initialValueRef:Y,popupRef:q,setValue:N}=lt(),W=ur(),D=j(p,_.open),K=j(p,_.mounted),H=j(p,_.modal),P=j(p,_.value),B=j(p,_.openMethod),R=j(p,_.positionerElement),L=j(p,_.triggerElement),A=j(p,_.isItemEqualToValue),I=u.useRef(null),ge=u.useRef(null),[k,ae]=u.useState(v),Q=K&&k&&B!=="touch";!K&&k!==v&&ae(v),X(()=>{K||(_.scrollUpArrowVisible(p.state)&&p.set("scrollUpArrowVisible",!1),_.scrollDownArrowVisible(p.state)&&p.set("scrollDownArrowVisible",!1))},[p,K]),u.useImperativeHandle(M,()=>Q),Qr((Q||H)&&D&&B!=="touch",L);const V=xs({anchor:r,floatingRootContext:W,positionMethod:s,mounted:K,side:c,sideOffset:d,align:m,alignOffset:l,arrowPadding:x,collisionBoundary:a,collisionPadding:g,sticky:h,disableAnchorTracking:y??Q,collisionAvoidance:f,keepMounted:!0}),z=Q?"none":V.side,fe=Q?zs:V.positionerStyles,De=u.useMemo(()=>{const G={};return D||(G.pointerEvents="none"),{role:"presentation",hidden:!K,style:{...fe,...G}}},[D,K,fe]),U=u.useMemo(()=>({open:D,side:z,align:V.align,anchorHidden:V.anchorHidden}),[D,z,V.align,V.anchorHidden]),le=xe(G=>{p.set("positionerElement",G)}),te=ct("div",t,{ref:[n,le],state:U,stateAttributesMapping:Gn,props:[De,b]}),me=u.useRef(0),Re=xe(G=>{if(G.size===0&&me.current===0||O.current.length===0)return;const J=me.current;if(me.current=G.size,G.size===J)return;const we=Me(ln);if(J!==0&&!p.state.multiple&&P!==null&&Qt(O.current,P,A)===-1){const Z=Y.current,Ve=Z!=null&&Kt(O.current,Z,A)?Z:null;N(Ve,we),Ve===null&&(p.set("selectedIndex",null),C.current=null)}if(J!==0&&p.state.multiple&&Array.isArray(P)){const re=P.filter(Z=>Kt(O.current,Z,A));(re.length!==P.length||re.some(Z=>!Kt(P,Z,A)))&&(N(re,we),re.length===0&&(p.set("selectedIndex",null),C.current=null))}if(D&&Q){p.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const re={height:""};Ht(R,re),Ht(q.current,re)}}),ue=u.useMemo(()=>({...V,side:z,alignItemWithTriggerActive:Q,setControlledAlignItemWithTrigger:ae,scrollUpArrowRef:I,scrollDownArrowRef:ge}),[V,z,Q,ae]);return Ae.jsx(Ns,{elementsRef:w,labelsRef:E,onMapChange:Re,children:Ae.jsxs(xr.Provider,{value:ue,children:[K&&H&&Ae.jsx(eo,{inert:Hr(!D),cutout:L}),te]})})});function yr(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const Ot="base-ui-disable-scrollbar",kn={className:Ot,getElement(e){return Ae.jsx("style",{nonce:e,href:Ot,precedence:"base-ui:low",children:`.${Ot}{scrollbar-width:none}.${Ot}::-webkit-scrollbar{display:none}`})}},js=u.createContext(void 0);function Ys(e){return u.useContext(js)}function qs(e){return e==="starting"?Nr:Rt}function Ks(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Xs=u.createContext(void 0),Gs={disableStyleElements:!1};function Js(){return u.useContext(Xs)??Gs}const Zs={...Gn,...Yn},di=u.forwardRef(function(t,n){const{render:r,className:s,...o}=t,{store:i,popupRef:c,onOpenChangeComplete:m,setOpen:d,valueRef:l,selectedItemTextRef:a,keyboardActiveRef:g,multiple:x,handleScrollArrowVisibility:h,scrollHandlerRef:y,highlightItemOnHover:v}=lt(),{side:f,align:b,alignItemWithTriggerActive:p,setControlledAlignItemWithTrigger:w,scrollDownArrowRef:E,scrollUpArrowRef:M}=_s(),C=Ys()!=null,O=ur(),{nonce:Y,disableStyleElements:q}=Js(),N=tt(),W=j(i,_.id),D=j(i,_.open),K=j(i,_.mounted),H=j(i,_.popupProps),P=j(i,_.transitionStatus),B=j(i,_.triggerElement),R=j(i,_.positionerElement),L=j(i,_.listElement),A=u.useRef(0),I=u.useRef(!1),ge=u.useRef(0),k=u.useRef(!1),ae=u.useRef({}),Q=Nn(),V=xe(U=>{if(!R||!c.current||!k.current)return;if(I.current||!p){h();return}const le=R.style.top==="0px",te=R.style.bottom==="0px",me=R.getBoundingClientRect().height,Re=vt(R),ue=getComputedStyle(R),G=parseFloat(ue.marginTop),J=parseFloat(ue.marginBottom),we=Fn(getComputedStyle(c.current)),re=Re.documentElement.clientHeight-G-J,Z=U.scrollTop,be=U.scrollHeight,Ve=U.clientHeight,S=be-Ve;let F=0,T=null,ee=!1;if(le){const ne=S-Z,se=me+ne,ye=Math.min(se,re);F=ye,ye!==re?T=S:ee=!0}else if(te){const ne=Z-0,se=me+ne,ye=Math.min(se,re),he=se-re;F=ye,ye!==re?T=0:(ee=!0,Z<S&&(T=Z-(ne-he)))}F!==0&&(R.style.height=`${F}px`),T!=null&&(U.scrollTop=T),(ee||F>=we)&&(I.current=!0),h()});u.useImperativeHandle(y,()=>V,[V]),cn({open:D,ref:c,onComplete(){D&&m?.(!0)}});const z=u.useMemo(()=>({open:D,transitionStatus:P,side:f,align:b}),[D,P,f,b]);X(()=>{!R||!c.current||Object.keys(ae.current).length||(ae.current={top:R.style.top||"0",left:R.style.left||"0",right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),X(()=>{D||p||(k.current=!1,I.current=!1,A.current=0,ge.current=0,Ht(R,ae.current))},[D,p,R,c]),X(()=>{const U=c.current;if(!(!D||!B||!R||!U||i.state.transitionStatus==="ending")){if(!p){k.current=!0,Q.request(h),U.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const le=ei(U);U.style.removeProperty("--transform-origin");try{const te=getComputedStyle(R),me=getComputedStyle(U),Re=vt(B),ue=qe(R),G=B.getBoundingClientRect(),J=R.getBoundingClientRect(),we=G.left,re=G.height,Z=L||U,be=Z.scrollHeight,Ve=parseFloat(me.borderBottomWidth),S=parseFloat(te.marginTop)||10,F=parseFloat(te.marginBottom)||10,T=parseFloat(te.minHeight)||100,ee=Fn(me),ne=5,se=5,ye=20,he=Re.documentElement.clientHeight-S-F,Oe=Re.documentElement.clientWidth,ve=he-G.bottom+re,Te=a.current,_e=l.current;let He,Ne=0,ce=0;if(Te&&_e){const $=_e.getBoundingClientRect();He=Te.getBoundingClientRect();const ie=$.left-we,Ie=He.left-J.left,ke=$.top-G.top+$.height/2,Pe=He.top-J.top+He.height/2;Ne=ie-Ie,ce=Pe-ke}const pe=ve+ce+F+Ve;let de=Math.min(he,pe);const Se=he-S-F,Be=pe-de,Ue=Math.max(ne,we+Ne),Xe=Oe-se,Ge=Math.max(0,Ue+J.width-Xe);R.style.left=`${Ue-Ge}px`,R.style.height=`${de}px`,R.style.maxHeight="auto",R.style.marginTop=`${S}px`,R.style.marginBottom=`${F}px`,U.style.height="100%";const st=Z.scrollHeight-Z.clientHeight,at=Be>=st;at&&(de=Math.min(he,J.height)-(Be-st));const ht=G.top<ye||G.bottom>he-ye||de<Math.min(be,T),pt=(ue.visualViewport?.scale??1)!==1&&Br;if(ht||pt){k.current=!0,Ht(R,ae.current),sn.flushSync(()=>w(!1));return}if(at){const $=Math.max(0,he-pe);R.style.top=J.height>=Se?"0":`${$}px`,R.style.height=`${de}px`,Z.scrollTop=Z.scrollHeight-Z.clientHeight,A.current=Math.max(T,de)}else R.style.bottom="0",A.current=Math.max(T,de),Z.scrollTop=Be;if(He){const $=J.top,ie=J.height,Ie=He.top+He.height/2,ke=ie>0?(Ie-$)/ie*100:50,Pe=Ks(ke,0,100);U.style.setProperty("--transform-origin",`50% ${Pe}%`)}(A.current===he||de>=ee)&&(I.current=!0),h(),setTimeout(()=>{k.current=!0})}finally{le()}})}},[i,D,R,B,l,a,c,h,p,w,Q,E,M,L]),u.useEffect(()=>{if(!p||!R||!D)return;const U=qe(R);function le(te){d(!1,Me(Ur,te))}return U.addEventListener("resize",le),()=>{U.removeEventListener("resize",le)}},[d,p,R,D]);const fe={...L?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":x||void 0,id:`${W}-list`},onKeyDown(U){g.current=!0,C&&no.has(U.key)&&U.stopPropagation()},onMouseMove(){g.current=!1},onPointerLeave(U){if(!v||yr(U)||U.pointerType==="touch")return;const le=U.currentTarget;N.start(0,()=>{i.set("activeIndex",null),le.focus({preventScroll:!0})})},onScroll(U){L||y.current?.(U.currentTarget)},...p&&{style:L?{height:"100%"}:$s}},De=ct("div",t,{ref:[n,c],state:z,stateAttributesMapping:Zs,props:[H,fe,qs(P),{className:!L&&p?kn.className:void 0},o]});return Ae.jsxs(u.Fragment,{children:[!q&&kn.getElement(Y),Ae.jsx(to,{context:O,modal:!1,disabled:!K,restoreFocus:!0,children:De})]})});function Fn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const Hn={transform:"none",scale:"1",translate:"0 0"};function Qs(e,t,n){n?e.setProperty(t,n):e.removeProperty(t)}function ei(e){const{style:t}=e,n={},r=Object.keys(Hn);for(const s of r)n[s]=t.getPropertyValue(s),t.setProperty(s,Hn[s]);return()=>{for(const s of r)Qs(t,s,n[s])}}let wr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function ti(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:s,index:o}=e,{register:i,unregister:c,subscribeMapChange:m,elementsRef:d,labelsRef:l,nextIndexRef:a}=Hs(),g=u.useRef(-1),[x,h]=u.useState(o??(s===wr.GuessFromOrder?()=>{if(g.current===-1){const f=a.current;a.current+=1,g.current=f}return g.current}:-1)),y=u.useRef(null),v=u.useCallback(f=>{if(y.current=f,x!==-1&&f!==null&&(d.current[x]=f,l)){const b=t!==void 0;l.current[x]=b?t:r?.current?.textContent??f.textContent}},[x,d,l,t,r]);return X(()=>{if(o!=null)return;const f=y.current;if(f)return i(f,n),()=>{c(f)}},[o,i,c,n]),X(()=>{if(o==null)return m(f=>{const b=y.current?f.get(y.current)?.index:null;b!=null&&h(b)})},[o,m,h]),u.useMemo(()=>({ref:v,index:x}),[x,v])}const Rr=u.createContext(void 0);function mn(){const e=u.useContext(Rr);if(!e)throw new Error(Et(57));return e}const gi=u.memo(u.forwardRef(function(t,n){const{render:r,className:s,value:o=null,label:i,disabled:c=!1,nativeButton:m=!1,...d}=t,l=u.useRef(null),a=ti({label:i,textRef:l,indexGuessBehavior:wr.GuessFromOrder}),{store:g,getItemProps:x,setOpen:h,setValue:y,selectionRef:v,typingRef:f,valuesRef:b,keyboardActiveRef:p,multiple:w,highlightItemOnHover:E}=lt(),M=tt(),C=j(g,_.isActive,a.index),O=j(g,_.isSelected,a.index,o),Y=j(g,_.isSelectedByFocus,a.index),q=j(g,_.isItemEqualToValue),N=a.index,W=N!==-1,D=u.useRef(null),K=$e(N);X(()=>{if(!W)return;const V=b.current;return V[N]=o,()=>{delete V[N]}},[W,N,o,b]),X(()=>{if(!W)return;const V=g.state.value;let z=V;w&&Array.isArray(V)&&V.length>0&&(z=V[V.length-1]),z!==void 0&&mt(z,o,q)&&g.set("selectedIndex",N)},[W,N,w,q,g,o]);const H=u.useMemo(()=>({disabled:c,selected:O,highlighted:C}),[c,O,C]),P=x({active:C,selected:O});P.onFocus=void 0,P.id=void 0;const B=u.useRef(null),R=u.useRef("mouse"),L=u.useRef(!1),{getButtonProps:A,buttonRef:I}=jn({disabled:c,focusableWhenDisabled:!0,native:m});function ge(V){const z=g.state.value;if(w){const fe=Array.isArray(z)?z:[],De=O?Es(fe,o,q):[...fe,o];y(De,Me($t,V))}else y(o,Me($t,V)),h(!1,Me($t,V))}const k={role:"option","aria-selected":O,tabIndex:C?0:-1,onFocus(){g.set("activeIndex",N)},onMouseEnter(){!p.current&&g.state.selectedIndex===null&&g.set("activeIndex",N)},onMouseMove(){E&&g.set("activeIndex",N)},onMouseLeave(V){!E||p.current||yr(V)||M.start(0,()=>{g.state.activeIndex===N&&g.set("activeIndex",null)})},onTouchStart(){v.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(V){B.current=V.key,g.set("activeIndex",N)},onClick(V){L.current=!1,!(V.type==="keydown"&&B.current===null)&&(c||B.current===" "&&f.current||R.current!=="touch"&&!C||(B.current=null,ge(V.nativeEvent)))},onPointerEnter(V){R.current=V.pointerType},onPointerDown(V){R.current=V.pointerType,L.current=!0},onMouseUp(V){if(c)return;if(L.current){L.current=!1;return}const z=!v.current.allowSelectedMouseUp&&O,fe=!v.current.allowUnselectedMouseUp&&!O;z||fe||R.current!=="touch"&&!C||ge(V.nativeEvent)}},ae=ct("div",t,{ref:[I,n,a.ref,D],state:H,props:[P,k,d,A]}),Q=u.useMemo(()=>({selected:O,indexRef:K,textRef:l,selectedByFocus:Y,hasRegistered:W}),[O,K,l,Y,W]);return Ae.jsx(Rr.Provider,{value:Q,children:ae})})),mi=u.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:s}=mn();return r||s?Ae.jsx(ni,{...t,ref:n}):null}),ni=u.memo(u.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:s,...o}=e,{selected:i}=mn(),c=u.useRef(null),{transitionStatus:m,setMounted:d}=Xn(i),l=u.useMemo(()=>({selected:i,transitionStatus:m}),[i,m]),a=ct("span",e,{ref:[t,c],state:l,props:[{"aria-hidden":!0,children:"✔️"},o],stateAttributesMapping:Yn});return cn({open:i,ref:c,onComplete(){i||d(!1)}}),a})),hi=u.memo(u.forwardRef(function(t,n){const{indexRef:r,textRef:s,selectedByFocus:o,hasRegistered:i}=mn(),{selectedItemTextRef:c}=lt(),{className:m,render:d,...l}=t,a=u.useCallback(x=>{if(!x||!i)return;const h=c.current===null||!c.current.isConnected;(o||h&&r.current===0)&&(c.current=x)},[c,r,o,i]);return ct("div",t,{ref:[a,n,s],props:l})}));export{si as C,$s as L,ci as S,hr as a,gn as b,fr as c,Ln as d,Is as e,Rs as f,Ps as g,li as h,ai as i,ui as j,fi as k,di as l,gi as m,hi as n,mi as o,yo as p,xs as q,qs as r,_ as s,ii as t,lt as u,Ys as v,_s as w,kn as x};