tokentracker-cli 0.35.2 → 0.36.1
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.
- package/dashboard/dist/assets/{ActivityHeatmap-Bb0omCiI.js → ActivityHeatmap-DPmiMH4Q.js} +1 -1
- package/dashboard/dist/assets/{Card-CtI3QMH6.js → Card-BlIsxuah.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-VF6RdezJ.js +19 -0
- package/dashboard/dist/assets/{DevicePage-CyWx9gIK.js → DevicePage-CzlnwSOX.js} +1 -1
- package/dashboard/dist/assets/{DialogTitle-C9pIgpxK.js → DialogTitle-Ds8Zyp-H.js} +2 -2
- package/dashboard/dist/assets/{FadeIn-D1DCy1c9.js → FadeIn-DCdF-JKA.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-D2qhRbZX.js → HeaderGithubStar-C1g-qMrd.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-B_L_cKmD.js → IpCheckPage-BPNjooka.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-MT2qg0bE.js → LandingPage-BDwl_l3N.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-BXi46kQk.js → LeaderboardAvatar-V0mkCkzN.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-CrhD0iRk.js → LeaderboardPage-c2ebFIDI.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfileModal-DRylJ_fc.js → LeaderboardProfileModal-DHdkIr5W.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-DfVriPxC.js → LeaderboardProfilePage-xWY6PJI0.js} +1 -1
- package/dashboard/dist/assets/LimitsPage-rc2lvN6C.js +2 -0
- package/dashboard/dist/assets/{LocalOnlyNotice-CQbMwbCe.js → LocalOnlyNotice-ChC9Z6ZN.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-BuLVMfu2.js → LoginPage-B6vOBqIw.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-BpAU63FH.js → PopoverPopup-DRWRI_6O.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-ZDWZ0OtH.js +1 -0
- package/dashboard/dist/assets/{SkillsPage-BV3LnVvE.js → SkillsPage-CAJxaQG0.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-C-39lx67.js → WidgetsPage-BkZjVQSS.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-DTDJesAM.js → WrappedPage-CXYvtLhV.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-BKtVvn2f.js → agent-logos-DjQzMdSw.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-BjAWXJOu.js → arrow-up-right-OURL9IAS.js} +1 -1
- package/dashboard/dist/assets/check-CESu4eR-.js +1 -0
- package/dashboard/dist/assets/{chevron-down-D6_2sGG-.js → chevron-down-BjIFZNid.js} +1 -1
- package/dashboard/dist/assets/{download-BVdUICgW.js → download-C1FtauDf.js} +1 -1
- package/dashboard/dist/assets/{info-BUs_fkaX.js → info-BTIZccVB.js} +1 -1
- package/dashboard/dist/assets/{main-BBMM0Tgo.js → main-QElo_0bY.js} +16 -15
- package/dashboard/dist/assets/{use-limits-display-prefs-BJRhaKEd.js → use-limits-display-prefs-ClE847BF.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-lyrRoQkg.js → use-native-settings-D20qXg2x.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-COFMsRkg.js → use-usage-limits-CIWlA4Jt.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-C3yqfWiI.js → useCurrency-CUAxzIqS.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/subscriptions.js +25 -13
- package/src/lib/usage-limits.js +40 -9
- package/dashboard/dist/assets/DashboardPage-jCAhwrGj.js +0 -19
- package/dashboard/dist/assets/LimitsPage-Ni3_-kEb.js +0 -2
- package/dashboard/dist/assets/SettingsPage-DX7f066p.js +0 -1
- package/dashboard/dist/assets/check-CRcTlhgH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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-QElo_0bY.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 en,r as x,br as Hn,b8 as nt,b as q,bO as be,bP as Bn,bc as tn,bQ as ot,bd as z,bR as de,bs as ge,bS as $t,bT as fe,b5 as pe,bU as nn,bV as at,bW as Me,bX as _e,bY as $n,bZ as on,b_ as _n,b$ as lt,c0 as ft,c1 as Xe,aj as Ie,c2 as Vn,be as rn,a_ as le,c3 as Wn,c4 as jn,b0 as ee,c5 as Z,b2 as Ve,b6 as sn,b3 as ae,c6 as cn,bm as an,c7 as Nn,ba as ze,c8 as Yn,c9 as Xn,b7 as rt,ca as zn,j as U,cb as Un,u as Gn,a as ut,cc as qn,cd as _t,ce as Kn,cf as Jn,cg as Qn,ch as Zn,bo as eo,ci as to,cj as no,bq as oo,bf as ro,bv as so}from"./main-BBMM0Tgo.js";import{y as Ce,z as io,g as dt,A as co,P as ln,h as gt,f as we,B as ao,R as lo,E as fo,G as uo,m as re,H as go,o as po,J as mo,K as ho,w as xo,L as yo,q as vo,M as Ro,r as fn,l as bo,N as wo,t as Eo,v as Co,O as Oo,I as To,Q as So,x as un,F as Po,C as Ao}from"./DialogTitle-C9pIgpxK.js";const Mo=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],os=en("chevron-right",Mo);const Io=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],rs=en("loader-circle",Io),ko=["top","right","bottom","left"],Oe=Math.min,J=Math.max,We=Math.round,He=Math.floor,ce=e=>({x:e,y:e}),Lo={left:"right",right:"left",bottom:"top",top:"bottom"};function st(e,t,n){return J(e,Oe(t,n))}function ue(e,t){return typeof e=="function"?e(t):e}function K(e){return e.split("-")[0]}function me(e){return e.split("-")[1]}function pt(e){return e==="x"?"y":"x"}function mt(e){return e==="y"?"height":"width"}function te(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ht(e){return pt(te(e))}function Fo(e,t,n){n===void 0&&(n=!1);const o=me(e),r=ht(e),s=mt(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=je(i)),[i,je(i)]}function Do(e){const t=je(e);return[it(e),t,it(t)]}function it(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Vt=["left","right"],Wt=["right","left"],Ho=["top","bottom"],Bo=["bottom","top"];function $o(e,t,n){switch(e){case"top":case"bottom":return n?t?Wt:Vt:t?Vt:Wt;case"left":case"right":return t?Ho:Bo;default:return[]}}function _o(e,t,n,o){const r=me(e);let s=$o(K(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(it)))),s}function je(e){const t=K(e);return Lo[t]+e.slice(t.length)}function Vo(e){return{top:0,right:0,bottom:0,left:0,...e}}function dn(e){return typeof e!="number"?Vo(e):{top:e,right:e,bottom:e,left:e}}function Ne(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Qe(e,t,n){if(n&&!Ce(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const o=e();return typeof o=="number"?o:o?.[t]}return e?.[t]}function Wo(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,{enabled:r=!0,event:s="click",toggle:i=!0,ignoreMouse:l=!1,stickIfOpen:a=!0,touchOpenDelay:d=0}=t,c=x.useRef(void 0),f=Hn(),m=nt(),p=x.useMemo(()=>({onPointerDown(u){c.current=u.pointerType},onMouseDown(u){const g=c.current,R=u.nativeEvent,w=n.select("open");if(u.button!==0||s==="click"||Ce(g,!0)&&l)return;const y=o.current.openEvent,C=y?.type,E=n.select("domReferenceElement")!==u.currentTarget,O=w&&E||!(w&&i&&(!(y&&a)||C==="click"||C==="mousedown"));if(Bn(R.target)){const b=q(be,R,R.target);O&&g==="touch"&&d>0?m.start(d,()=>{n.setOpen(!0,b)}):n.setOpen(O,b);return}const T=u.currentTarget;f.request(()=>{const b=q(be,R,T);O&&g==="touch"&&d>0?m.start(d,()=>{n.setOpen(!0,b)}):n.setOpen(O,b)})},onClick(u){if(s==="mousedown-only")return;const g=c.current;if(s==="mousedown"&&g){c.current=void 0;return}if(Ce(g,!0)&&l)return;const R=n.select("open"),w=o.current.openEvent,y=n.select("domReferenceElement")!==u.currentTarget,C=R&&y||!(R&&i&&(!(w&&a)||io(w))),E=q(be,u.nativeEvent,u.currentTarget);C&&g==="touch"&&d>0?m.start(d,()=>{n.setOpen(!0,E)}):n.setOpen(C,E)},onKeyDown(){c.current=void 0}}),[o,s,l,n,a,i,f,m,d]);return x.useMemo(()=>r?{reference:p}:tn,[r,p])}function jt(e,t,n){let{reference:o,floating:r}=e;const s=te(t),i=ht(t),l=mt(i),a=K(t),d=s==="y",c=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,m=o[l]/2-r[l]/2;let p;switch(a){case"top":p={x:c,y:o.y-r.height};break;case"bottom":p={x:c,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(me(t)){case"start":p[i]-=m*(n&&d?-1:1);break;case"end":p[i]+=m*(n&&d?-1:1);break}return p}async function jo(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:l,strategy:a}=e,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=ue(t,e),u=dn(p),R=l[m?f==="floating"?"reference":"floating":f],w=Ne(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(R)))==null||n?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:c,strategy:a})),y=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),E=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},O=Ne(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:C,strategy:a}):y);return{top:(w.top-O.top+u.top)/E.y,bottom:(O.bottom-w.bottom+u.bottom)/E.y,left:(w.left-O.left+u.left)/E.x,right:(O.right-w.right+u.right)/E.x}}const No=50,Yo=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:jo},a=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:f}=jt(d,o,a),m=o,p=0;const u={};for(let g=0;g<s.length;g++){const R=s[g];if(!R)continue;const{name:w,fn:y}=R,{x:C,y:E,data:O,reset:T}=await y({x:c,y:f,initialPlacement:o,placement:m,strategy:r,middlewareData:u,rects:d,platform:l,elements:{reference:e,floating:t}});c=C??c,f=E??f,u[w]={...u[w],...O},T&&p<No&&(p++,typeof T=="object"&&(T.placement&&(m=T.placement),T.rects&&(d=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):T.rects),{x:c,y:f}=jt(d,m,a)),g=-1)}return{x:c,y:f,placement:m,strategy:r,middlewareData:u}},Xo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:l,platform:a,elements:d}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:u="none",flipAlignment:g=!0,...R}=ue(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=K(r),y=te(l),C=K(l)===l,E=await(a.isRTL==null?void 0:a.isRTL(d.floating)),O=m||(C||!g?[je(l)]:Do(l)),T=u!=="none";!m&&T&&O.push(..._o(l,g,u,E));const b=[l,...O],k=await a.detectOverflow(t,R),$=[];let A=((o=s.flip)==null?void 0:o.overflows)||[];if(c&&$.push(k[w]),f){const L=Fo(r,i,E);$.push(k[L[0]],k[L[1]])}if(A=[...A,{placement:r,overflows:$}],!$.every(L=>L<=0)){var F,S;const L=(((F=s.flip)==null?void 0:F.index)||0)+1,I=b[L];if(I&&(!(f==="alignment"?y!==te(I):!1)||A.every(v=>te(v.placement)===y?v.overflows[0]>0:!0)))return{data:{index:L,overflows:A},reset:{placement:I}};let D=(S=A.filter(M=>M.overflows[0]<=0).sort((M,v)=>M.overflows[1]-v.overflows[1])[0])==null?void 0:S.placement;if(!D)switch(p){case"bestFit":{var h;const M=(h=A.filter(v=>{if(T){const P=te(v.placement);return P===y||P==="y"}return!0}).map(v=>[v.placement,v.overflows.filter(P=>P>0).reduce((P,j)=>P+j,0)]).sort((v,P)=>v[1]-P[1])[0])==null?void 0:h[0];M&&(D=M);break}case"initialPlacement":D=l;break}if(r!==D)return{reset:{placement:D}}}return{}}}};function Nt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yt(e){return ko.some(t=>e[t]>=0)}const zo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=ue(e,t);switch(r){case"referenceHidden":{const i=await o.detectOverflow(t,{...s,elementContext:"reference"}),l=Nt(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Yt(l)}}}case"escaped":{const i=await o.detectOverflow(t,{...s,altBoundary:!0}),l=Nt(i,n.floating);return{data:{escapedOffsets:l,escaped:Yt(l)}}}default:return{}}}}},gn=new Set(["left","top"]);async function Uo(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=K(n),l=me(n),a=te(n)==="y",d=gn.has(i)?-1:1,c=s&&a?-1:1,f=ue(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:u}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof u=="number"&&(p=l==="end"?u*-1:u),a?{x:p*c,y:m*d}:{x:m*d,y:p*c}}const Go=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:l}=t,a=await Uo(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:i}}}}},qo=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:w=>{let{x:y,y:C}=w;return{x:y,y:C}}},...d}=ue(e,t),c={x:n,y:o},f=await s.detectOverflow(t,d),m=te(K(r)),p=pt(m);let u=c[p],g=c[m];if(i){const w=p==="y"?"top":"left",y=p==="y"?"bottom":"right",C=u+f[w],E=u-f[y];u=st(C,u,E)}if(l){const w=m==="y"?"top":"left",y=m==="y"?"bottom":"right",C=g+f[w],E=g-f[y];g=st(C,g,E)}const R=a.fn({...t,[p]:u,[m]:g});return{...R,data:{x:R.x-n,y:R.y-o,enabled:{[p]:i,[m]:l}}}}}},Ko=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:a=!0,crossAxis:d=!0}=ue(e,t),c={x:n,y:o},f=te(r),m=pt(f);let p=c[m],u=c[f];const g=ue(l,t),R=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const C=m==="y"?"height":"width",E=s.reference[m]-s.floating[C]+R.mainAxis,O=s.reference[m]+s.reference[C]-R.mainAxis;p<E?p=E:p>O&&(p=O)}if(d){var w,y;const C=m==="y"?"width":"height",E=gn.has(K(r)),O=s.reference[f]-s.floating[C]+(E&&((w=i.offset)==null?void 0:w[f])||0)+(E?0:R.crossAxis),T=s.reference[f]+s.reference[C]+(E?0:((y=i.offset)==null?void 0:y[f])||0)-(E?R.crossAxis:0);u<O?u=O:u>T&&(u=T)}return{[m]:p,[f]:u}}}},Jo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:i,elements:l}=t,{apply:a=()=>{},...d}=ue(e,t),c=await i.detectOverflow(t,d),f=K(r),m=me(r),p=te(r)==="y",{width:u,height:g}=s.floating;let R,w;f==="top"||f==="bottom"?(R=f,w=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(w=f,R=m==="end"?"top":"bottom");const y=g-c.top-c.bottom,C=u-c.left-c.right,E=Oe(g-c[R],y),O=Oe(u-c[w],C),T=!t.middlewareData.shift;let b=E,k=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=C),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(b=y),T&&!m){const A=J(c.left,0),F=J(c.right,0),S=J(c.top,0),h=J(c.bottom,0);p?k=u-2*(A!==0||F!==0?A+F:J(c.left,c.right)):b=g-2*(S!==0||h!==0?S+h:J(c.top,c.bottom))}await a({...t,availableWidth:k,availableHeight:b});const $=await i.getDimensions(l.floating);return u!==$.width||g!==$.height?{reset:{rects:!0}}:{}}}};function pn(e){const t=fe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=pe(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,l=We(n)!==s||We(o)!==i;return l&&(n=s,o=i),{width:n,height:o,$:l}}function xt(e){return z(e)?e:e.contextElement}function Ee(e){const t=xt(e);if(!pe(t))return ce(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=pn(t);let i=(s?We(n.width):n.width)/o,l=(s?We(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Qo=ce(0);function mn(e){const t=ge(e);return!nn()||!t.visualViewport?Qo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ge(e)?!1:t}function he(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=xt(e);let i=ce(1);t&&(o?z(o)&&(i=Ee(o)):i=Ee(e));const l=Zo(s,n,o)?mn(s):ce(0);let a=(r.left+l.x)/i.x,d=(r.top+l.y)/i.y,c=r.width/i.x,f=r.height/i.y;if(s){const m=ge(s),p=o&&z(o)?ge(o):o;let u=m,g=$t(u);for(;g&&o&&p!==u;){const R=Ee(g),w=g.getBoundingClientRect(),y=fe(g),C=w.left+(g.clientLeft+parseFloat(y.paddingLeft))*R.x,E=w.top+(g.clientTop+parseFloat(y.paddingTop))*R.y;a*=R.x,d*=R.y,c*=R.x,f*=R.y,a+=C,d+=E,u=ge(g),g=$t(u)}}return Ne({width:c,height:f,x:a,y:d})}function Ue(e,t){const n=Xe(e).scrollLeft;return t?t.left+n:he(de(e)).left+n}function hn(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Ue(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function er(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=de(o),l=t?at(t.floating):!1;if(o===i||l&&s)return n;let a={scrollLeft:0,scrollTop:0},d=ce(1);const c=ce(0),f=pe(o);if((f||!f&&!s)&&((lt(o)!=="body"||ft(i))&&(a=Xe(o)),f)){const p=he(o);d=Ee(o),c.x=p.x+o.clientLeft,c.y=p.y+o.clientTop}const m=i&&!f&&!s?hn(i,a):ce(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+c.x+m.x,y:n.y*d.y-a.scrollTop*d.y+c.y+m.y}}function tr(e){return Array.from(e.getClientRects())}function nr(e){const t=de(e),n=Xe(e),o=e.ownerDocument.body,r=J(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=J(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Ue(e);const l=-n.scrollTop;return fe(o).direction==="rtl"&&(i+=J(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:l}}const Xt=25;function or(e,t){const n=ge(e),o=de(e),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,l=0,a=0;if(r){s=r.width,i=r.height;const c=nn();(!c||c&&t==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}const d=Ue(o);if(d<=0){const c=o.ownerDocument,f=c.body,m=getComputedStyle(f),p=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,u=Math.abs(o.clientWidth-f.clientWidth-p);u<=Xt&&(s-=u)}else d<=Xt&&(s+=d);return{width:s,height:i,x:l,y:a}}function rr(e,t){const n=he(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=pe(e)?Ee(e):ce(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,a=r*s.x,d=o*s.y;return{width:i,height:l,x:a,y:d}}function zt(e,t,n){let o;if(t==="viewport")o=or(e,n);else if(t==="document")o=nr(de(e));else if(z(t))o=rr(t,n);else{const r=mn(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ne(o)}function xn(e,t){const n=Me(e);return n===t||!z(n)||_e(n)?!1:fe(n).position==="fixed"||xn(n,t)}function sr(e,t){const n=t.get(e);if(n)return n;let o=ot(e,[],!1).filter(l=>z(l)&<(l)!=="body"),r=null;const s=fe(e).position==="fixed";let i=s?Me(e):e;for(;z(i)&&!_e(i);){const l=fe(i),a=on(i);!a&&l.position==="fixed"&&(r=null),(s?!a&&!r:!a&&l.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||ft(i)&&!a&&xn(e,i))?o=o.filter(c=>c!==i):r=l,i=Me(i)}return t.set(e,o),o}function ir(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?at(t)?[]:sr(t,this._c):[].concat(n),o],l=zt(t,i[0],r);let a=l.top,d=l.right,c=l.bottom,f=l.left;for(let m=1;m<i.length;m++){const p=zt(t,i[m],r);a=J(p.top,a),d=Oe(p.right,d),c=Oe(p.bottom,c),f=J(p.left,f)}return{width:d-f,height:c-a,x:f,y:a}}function cr(e){const{width:t,height:n}=pn(e);return{width:t,height:n}}function ar(e,t,n){const o=pe(t),r=de(t),s=n==="fixed",i=he(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=ce(0);function d(){a.x=Ue(r)}if(o||!o&&!s)if((lt(t)!=="body"||ft(r))&&(l=Xe(t)),o){const p=he(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else r&&d();s&&!o&&r&&d();const c=r&&!o&&!s?hn(r,l):ce(0),f=i.left+l.scrollLeft-a.x-c.x,m=i.top+l.scrollTop-a.y-c.y;return{x:f,y:m,width:i.width,height:i.height}}function Ze(e){return fe(e).position==="static"}function Ut(e,t){if(!pe(e)||fe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return de(e)===n&&(n=n.ownerDocument.body),n}function yn(e,t){const n=ge(e);if(at(e))return n;if(!pe(e)){let r=Me(e);for(;r&&!_e(r);){if(z(r)&&!Ze(r))return r;r=Me(r)}return n}let o=Ut(e,t);for(;o&&$n(o)&&Ze(o);)o=Ut(o,t);return o&&_e(o)&&Ze(o)&&!on(o)?n:o||_n(e)||n}const lr=async function(e){const t=this.getOffsetParent||yn,n=this.getDimensions,o=await n(e.floating);return{reference:ar(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function fr(e){return fe(e).direction==="rtl"}const ur={convertOffsetParentRelativeRectToViewportRelativeRect:er,getDocumentElement:de,getClippingRect:ir,getOffsetParent:yn,getElementRects:lr,getClientRects:tr,getDimensions:cr,getScale:Ee,isElement:z,isRTL:fr};function vn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function dr(e,t){let n=null,o;const r=de(e);function s(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function i(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const d=e.getBoundingClientRect(),{left:c,top:f,width:m,height:p}=d;if(l||t(),!m||!p)return;const u=He(f),g=He(r.clientWidth-(c+m)),R=He(r.clientHeight-(f+p)),w=He(c),C={rootMargin:-u+"px "+-g+"px "+-R+"px "+-w+"px",threshold:J(0,Oe(1,a))||1};let E=!0;function O(T){const b=T[0].intersectionRatio;if(b!==a){if(!E)return i();b?i(!1,b):o=setTimeout(()=>{i(!1,1e-7)},1e3)}b===1&&!vn(d,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(O,{...C,root:r.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(e)}return i(!0),s}function Gt(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,d=xt(e),c=r||s?[...d?ot(d):[],...t?ot(t):[]]:[];c.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const f=d&&l?dr(d,n):null;let m=-1,p=null;i&&(p=new ResizeObserver(w=>{let[y]=w;y&&y.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var C;(C=p)==null||C.observe(t)})),n()}),d&&!a&&p.observe(d),t&&p.observe(t));let u,g=a?he(e):null;a&&R();function R(){const w=he(e);g&&!vn(g,w)&&n(),g=w,u=requestAnimationFrame(R)}return n(),()=>{var w;c.forEach(y=>{r&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),f?.(),(w=p)==null||w.disconnect(),p=null,a&&cancelAnimationFrame(u)}}const gr=Go,pr=qo,mr=Xo,hr=Jo,xr=zo,yr=Ko,vr=(e,t,n)=>{const o=new Map,r={platform:ur,...n},s={...r.platform,_c:o};return Yo(e,t,{...r,platform:s})};var Rr=typeof document<"u",br=function(){},Be=Rr?x.useLayoutEffect:br;function Ye(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,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Ye(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Ye(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Rn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qt(e,t){const n=Rn(e);return Math.round(t*n)/n}function et(e){const t=x.useRef(e);return Be(()=>{t.current=e}),t}function wr(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:a,open:d}=e,[c,f]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=x.useState(o);Ye(m,o)||p(o);const[u,g]=x.useState(null),[R,w]=x.useState(null),y=x.useCallback(v=>{v!==T.current&&(T.current=v,g(v))},[]),C=x.useCallback(v=>{v!==b.current&&(b.current=v,w(v))},[]),E=s||u,O=i||R,T=x.useRef(null),b=x.useRef(null),k=x.useRef(c),$=a!=null,A=et(a),F=et(r),S=et(d),h=x.useCallback(()=>{if(!T.current||!b.current)return;const v={placement:t,strategy:n,middleware:m};F.current&&(v.platform=F.current),vr(T.current,b.current,v).then(P=>{const j={...P,isPositioned:S.current!==!1};L.current&&!Ye(k.current,j)&&(k.current=j,Ie.flushSync(()=>{f(j)}))})},[m,t,n,F,S]);Be(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(v=>({...v,isPositioned:!1})))},[d]);const L=x.useRef(!1);Be(()=>(L.current=!0,()=>{L.current=!1}),[]),Be(()=>{if(E&&(T.current=E),O&&(b.current=O),E&&O){if(A.current)return A.current(E,O,h);h()}},[E,O,h,A,$]);const I=x.useMemo(()=>({reference:T,floating:b,setReference:y,setFloating:C}),[y,C]),D=x.useMemo(()=>({reference:E,floating:O}),[E,O]),M=x.useMemo(()=>{const v={position:n,left:0,top:0};if(!D.floating)return v;const P=qt(D.floating,c.x),j=qt(D.floating,c.y);return l?{...v,transform:"translate("+P+"px, "+j+"px)",...Rn(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:j}},[n,l,D.floating,c.x,c.y]);return x.useMemo(()=>({...c,update:h,refs:I,elements:D,floatingStyles:M}),[c,h,I,D,M])}const Er=(e,t)=>{const n=gr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cr=(e,t)=>{const n=pr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Or=(e,t)=>({fn:yr(e).fn,options:[e,t]}),Tr=(e,t)=>{const n=mr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sr=(e,t)=>{const n=hr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pr=(e,t)=>{const n=xr(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Ar(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,r=Vn(),s=dt()!=null,i=rn(()=>new co({open:t,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new ln,floatingId:r,nested:s,noEmit:e.noEmit||!1})).current;return le(()=>{const l={open:t,floatingId:r};o.reference!==void 0&&(l.referenceElement=o.reference,l.domReferenceElement=z(o.reference)?o.reference:null),o.floating!==void 0&&(l.floatingElement=o.floating),i.update(l)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function Mr(e={}){const{nodeId:t,externalTree:n}=e,o=Ar(e),r=e.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,l]=x.useState(null),a=x.useRef(null),d=gt(n);le(()=>{s.domReference&&(a.current=s.domReference)},[s.domReference]);const c=wr({...e,elements:{...s,...i&&{reference:i}}}),f=x.useCallback(b=>{const k=z(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;l(k),c.refs.setReference(k)},[c.refs]),[m,p]=x.useState(null),[u,g]=x.useState(null);r.useSyncedValue("referenceElement",m),r.useSyncedValue("domReferenceElement",z(m)?m:null),r.useSyncedValue("floatingElement",u);const R=x.useCallback(b=>{(z(b)||b===null)&&(a.current=b,p(b)),(z(c.refs.reference.current)||c.refs.reference.current===null||b!==null&&!z(b))&&c.refs.setReference(b)},[c.refs,p]),w=x.useCallback(b=>{g(b),c.refs.setFloating(b)},[c.refs]),y=x.useMemo(()=>({...c.refs,setReference:R,setFloating:w,setPositionReference:f,domReference:a}),[c.refs,R,w,f]),C=x.useMemo(()=>({...c.elements,domReference:s.domReference}),[c.elements,s.domReference]),E=r.useState("open"),O=r.useState("floatingId"),T=x.useMemo(()=>({...c,dataRef:r.context.dataRef,open:E,onOpenChange:r.setOpen,events:r.context.events,floatingId:O,refs:y,elements:C,nodeId:t,rootStore:r}),[c,y,C,t,r,E,O]);return le(()=>{r.context.dataRef.current.floatingContext=T;const b=d?.nodesRef.current.find(k=>k.id===t);b&&(b.context=T)}),x.useMemo(()=>({...c,context:T,refs:y,elements:C,rootStore:r}),[c,y,C,T,r])}const ct=Wn("safe-polygon"),Ir=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${jn}`;function kr(e){return e?!!e.closest(Ir):!1}function bn(e){const t=x.useRef(void 0),n=x.useRef(!1),o=x.useRef(void 0),r=x.useRef(!0),s=x.useRef(!1),i=x.useRef(()=>{}),l=x.useRef(!1),a=nt(),d=nt(),c=x.useRef(void 0);return x.useMemo(()=>{const f=e.context.dataRef.current;return f.hoverInteractionState||(f.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:o,blockMouseMoveRef:r,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:l,openChangeTimeout:a,restTimeout:d,handleCloseOptionsRef:c}),f.hoverInteractionState},[e,t,n,o,r,s,i,l,a,d,c])}const Lr=new Set(["click","mousedown"]);function Fr(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:l=!0,closeDelay:a=0,externalTree:d}=t,{pointerTypeRef:c,interactedInsideRef:f,handlerRef:m,performedPointerEventsMutationRef:p,unbindMouseMoveRef:u,restTimeoutPendingRef:g,openChangeTimeout:R,handleCloseOptionsRef:w}=bn(n),y=gt(d),C=dt(),E=ee(()=>f.current?!0:i.current.openEvent?Lr.has(i.current.openEvent.type):!1),O=ee(()=>{const A=i.current.openEvent?.type;return A?.includes("mouse")&&A!=="mousedown"}),T=x.useCallback((A,F=!0)=>{const S=Dr(a,c.current);S&&!m.current?R.start(S,()=>n.setOpen(!1,q(Z,A))):F&&(R.clear(),n.setOpen(!1,q(Z,A)))},[a,m,n,c,R]),b=ee(()=>{u.current(),m.current=void 0}),k=ee(()=>{if(p.current){const A=Ve(r).body;A.style.pointerEvents="",A.removeAttribute(ct),p.current=!1}}),$=ee(A=>{const F=sn(A);if(!kr(F)){f.current=!1;return}f.current=!0});le(()=>{o||(c.current=void 0,g.current=!1,f.current=!1,b(),k())},[o,c,g,f,b,k]),x.useEffect(()=>()=>{b()},[b]),x.useEffect(()=>k,[k]),le(()=>{if(l&&o&&w.current?.blockPointerEvents&&O()&&z(s)&&r){p.current=!0;const A=Ve(r).body;A.setAttribute(ct,"");const F=s,S=r,h=y?.nodesRef.current.find(L=>L.id===C)?.context?.elements.floating;return h&&(h.style.pointerEvents=""),A.style.pointerEvents="none",F.style.pointerEvents="auto",S.style.pointerEvents="auto",()=>{A.style.pointerEvents="",F.style.pointerEvents="",S.style.pointerEvents=""}}},[l,o,s,r,w,O,y,C,p]),x.useEffect(()=>{if(!l)return;function A(L){if(E()||!i.current.floatingContext||!n.select("open"))return;const I=n.context.triggerElements;L.relatedTarget&&I.hasElement(L.relatedTarget)||(k(),b(),E()||T(L))}function F(L){R.clear(),k(),m.current?.(L),b()}function S(L){E()||T(L,!1)}const h=r;return h&&(h.addEventListener("mouseleave",A),h.addEventListener("mouseenter",F),h.addEventListener("mouseleave",S),h.addEventListener("pointerdown",$,!0)),()=>{h&&(h.removeEventListener("mouseleave",A),h.removeEventListener("mouseenter",F),h.removeEventListener("mouseleave",S),h.removeEventListener("pointerdown",$,!0))}})}function Dr(e,t){return t&&!Ce(t)?0:typeof e=="function"?e():e}function tt(e){return typeof e=="function"?e():e}const Hr={current:null};function Br(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:l=null,mouseOnly:a=!1,restMs:d=0,move:c=!0,triggerElementRef:f=Hr,externalTree:m,isActiveTrigger:p=!0}=t,u=gt(m),{pointerTypeRef:g,interactedInsideRef:R,handlerRef:w,blockMouseMoveRef:y,performedPointerEventsMutationRef:C,unbindMouseMoveRef:E,restTimeoutPendingRef:O,openChangeTimeout:T,restTimeout:b,handleCloseOptionsRef:k}=bn(n),$=we(l),A=we(i),F=we(d);p&&(k.current=$.current?.__options);const S=ee(()=>R.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),h=x.useCallback((M,v=!0)=>{const P=Qe(A.current,"close",g.current);P&&!w.current?T.start(P,()=>n.setOpen(!1,q(Z,M))):v&&(T.clear(),n.setOpen(!1,q(Z,M)))},[A,w,n,g,T]),L=ee(()=>{E.current(),w.current=void 0}),I=ee(()=>{if(C.current){const M=Ve(n.select("domReferenceElement")).body;M.style.pointerEvents="",M.removeAttribute(ct),C.current=!1}});x.useEffect(()=>{if(!s)return;function M(v){v.open||(T.clear(),b.clear(),y.current=!0,O.current=!1)}return r.on("openchange",M),()=>{r.off("openchange",M)}},[s,r,T,b,y,O]);const D=ee(M=>{if(S()||!o.current.floatingContext)return;const v=n.context.triggerElements;if(M.relatedTarget&&v.hasElement(M.relatedTarget))return;const P=f.current;$.current?.({...o.current.floatingContext,tree:u,x:M.clientX,y:M.clientY,onClose(){I(),L(),!S()&&P===n.select("domReferenceElement")&&h(M)}})(M)});return x.useEffect(()=>{if(!s)return;const M=f.current??(p?n.select("domReferenceElement"):null);if(!z(M))return;function v(_){if(T.clear(),y.current=!1,a&&!Ce(g.current)||tt(F.current)>0&&!Qe(A.current,"open"))return;const V=Qe(A.current,"open",g.current),N=n.select("domReferenceElement"),H=n.context.triggerElements,Y=(H.hasElement(_.target)||H.hasMatchingElement(se=>ae(se,_.target)))&&(!N||!ae(N,_.target)),B=_.currentTarget??null,W=n.select("open"),ne=!W||Y;Y&&W?n.setOpen(!0,q(Z,_,B)):V?T.start(V,()=>{ne&&n.setOpen(!0,q(Z,_,B))}):ne&&n.setOpen(!0,q(Z,_,B))}function P(_){if(S()){I();return}E.current();const V=n.select("domReferenceElement"),N=Ve(V);b.clear(),O.current=!1;const H=n.context.triggerElements;if(_.relatedTarget&&H.hasElement(_.relatedTarget))return;if($.current&&o.current.floatingContext){n.select("open")||T.clear();const B=f.current;w.current=$.current({...o.current.floatingContext,tree:u,x:_.clientX,y:_.clientY,onClose(){I(),L(),!S()&&B===n.select("domReferenceElement")&&h(_,!0)}});const W=w.current;W(_),N.addEventListener("mousemove",W),E.current=()=>{N.removeEventListener("mousemove",W)};return}(g.current!=="touch"||!ae(n.select("floatingElement"),_.relatedTarget))&&h(_)}function j(_){D(_)}return n.select("open")&&M.addEventListener("mouseleave",j),c&&M.addEventListener("mousemove",v,{once:!0}),M.addEventListener("mouseenter",v),M.addEventListener("mouseleave",P),()=>{M.removeEventListener("mouseleave",j),c&&M.removeEventListener("mousemove",v),M.removeEventListener("mouseenter",v),M.removeEventListener("mouseleave",P)}},[L,I,y,o,A,h,n,s,$,D,p,S,a,c,g,F,b,O,T,f,u,E,w]),x.useMemo(()=>{function M(v){g.current=v.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(v){const{nativeEvent:P}=v,j=v.currentTarget,_=n.select("domReferenceElement"),V=n.context.triggerElements,N=n.select("open"),H=(V.hasElement(v.target)||V.hasMatchingElement(B=>ae(B,v.target)))&&(!_||!ae(_,v.target));if(a&&!Ce(g.current)||N&&!H||tt(F.current)===0||!H&&O.current&&v.movementX**2+v.movementY**2<2)return;b.clear();function Y(){if(O.current=!1,S())return;const B=n.select("open");!y.current&&(!B||H)&&n.setOpen(!0,q(Z,P,j))}g.current==="touch"?Ie.flushSync(()=>{Y()}):H&&N?Y():(O.current=!0,b.start(tt(F.current),Y))}}},[y,S,a,n,g,F,b,O])}function Kt(e,t){const[n,o]=e;let r=!1;const s=t.length;for(let i=0,l=s-1;i<s;l=i++){const[a,d]=t[i]||[0,0],[c,f]=t[l]||[0,0];d>=o!=f>=o&&n<=(c-a)*(o-d)/(f-d)+a&&(r=!r)}return r}function $r(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function _r(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,r=new cn;let s=!1,i=null,l=null,a=typeof performance<"u"?performance.now():0;function d(f,m){const p=performance.now(),u=p-a;if(i===null||l===null||u===0)return i=f,l=m,a=p,null;const g=f-i,R=m-l,y=Math.sqrt(g*g+R*R)/u;return i=f,l=m,a=p,y}const c=({x:f,y:m,placement:p,elements:u,onClose:g,nodeId:R,tree:w})=>function(C){function E(){r.clear(),g()}if(r.clear(),!u.domReference||!u.floating||p==null||f==null||m==null)return;const{clientX:O,clientY:T}=C,b=[O,T],k=sn(C),$=C.type==="mouseleave",A=ae(u.floating,k),F=ae(u.domReference,k),S=u.domReference.getBoundingClientRect(),h=u.floating.getBoundingClientRect(),L=p.split("-")[0],I=f>h.right-h.width/2,D=m>h.bottom-h.height/2,M=$r(b,S),v=h.width>S.width,P=h.height>S.height,j=(v?S:h).left,_=(v?S:h).right,V=(P?S:h).top,N=(P?S:h).bottom;if(A&&(s=!0,!$))return;if(F&&(s=!1),F&&!$){s=!0;return}if($&&z(C.relatedTarget)&&ae(u.floating,C.relatedTarget)||w&&ao(w.nodesRef.current,R).some(({context:B})=>B?.open))return;if(L==="top"&&m>=S.bottom-1||L==="bottom"&&m<=S.top+1||L==="left"&&f>=S.right-1||L==="right"&&f<=S.left+1)return E();let H=[];switch(L){case"top":H=[[j,S.top+1],[j,h.bottom-1],[_,h.bottom-1],[_,S.top+1]];break;case"bottom":H=[[j,h.top+1],[j,S.bottom-1],[_,S.bottom-1],[_,h.top+1]];break;case"left":H=[[h.right-1,N],[h.right-1,V],[S.left+1,V],[S.left+1,N]];break;case"right":H=[[S.right-1,N],[S.right-1,V],[h.left+1,V],[h.left+1,N]];break}function Y([B,W]){switch(L){case"top":{const ne=[v?B+t/2:I?B+t*4:B-t*4,W+t+1],se=[v?B-t/2:I?B+t*4:B-t*4,W+t+1],oe=[[h.left,I||v?h.bottom-t:h.top],[h.right,I?v?h.bottom-t:h.top:h.bottom-t]];return[ne,se,...oe]}case"bottom":{const ne=[v?B+t/2:I?B+t*4:B-t*4,W-t],se=[v?B-t/2:I?B+t*4:B-t*4,W-t],oe=[[h.left,I||v?h.top+t:h.bottom],[h.right,I?v?h.top+t:h.bottom:h.top+t]];return[ne,se,...oe]}case"left":{const ne=[B+t+1,P?W+t/2:D?W+t*4:W-t*4],se=[B+t+1,P?W-t/2:D?W+t*4:W-t*4];return[...[[D||P?h.right-t:h.left,h.top],[D?P?h.right-t:h.left:h.right-t,h.bottom]],ne,se]}case"right":{const ne=[B-t,P?W+t/2:D?W+t*4:W-t*4],se=[B-t,P?W-t/2:D?W+t*4:W-t*4],oe=[[D||P?h.left+t:h.right,h.top],[D?P?h.left+t:h.right:h.left+t,h.bottom]];return[ne,se,...oe]}default:return[]}}if(!Kt([O,T],H)){if(s&&!M)return E();if(!$&&o){const B=d(C.clientX,C.clientY);if(B!==null&&B<.1)return E()}Kt([O,T],Y([f,m]))?!s&&o&&r.start(40,E):E()}};return c.__options={blockPointerEvents:n},c}const Vr=x.createContext(void 0);function Wr(){return x.useContext(Vr)?.direction??"ltr"}const jr=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:l,middlewareData:a}=t,{element:d,padding:c=0,offsetParent:f="real"}=ue(e,t)||{};if(d==null)return{};const m=dn(c),p={x:n,y:o},u=ht(r),g=mt(u),R=await i.getDimensions(d),w=u==="y",y=w?"top":"left",C=w?"bottom":"right",E=w?"clientHeight":"clientWidth",O=s.reference[g]+s.reference[u]-p[u]-s.floating[g],T=p[u]-s.reference[u],b=f==="real"?await i.getOffsetParent?.(d):l.floating;let k=l.floating[E]||s.floating[g];(!k||!await i.isElement?.(b))&&(k=l.floating[E]||s.floating[g]);const $=O/2-T/2,A=k/2-R[g]/2-1,F=Math.min(m[y],A),S=Math.min(m[C],A),h=F,L=k-R[g]-S,I=k/2-R[g]/2+$,D=st(h,I,L),M=!a.arrow&&me(r)!=null&&I!==D&&s.reference[g]/2-(I<h?F:S)-R[g]/2<0,v=M?I<h?I-h:I-L:0;return{[u]:p[u]+v,data:{[u]:D,centerOffset:I-D-v,...M&&{alignmentOffset:v}},reset:M}}}),Nr=(e,t)=>({...jr(e),options:[e,t]}),Yr={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0;return{data:{referenceHidden:(await Pr().fn(e)).data?.referenceHidden||s}}}},$e={sideX:"left",sideY:"top"},Xr={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:l}=e,a=ge(r),d=a.getComputedStyle(r);if(!(d.transitionDuration!=="0s"&&d.transitionDuration!==""))return{x:t,y:n,data:$e};const f=await s.getOffsetParent?.(r);let m={width:0,height:0};if(i==="fixed"&&a?.visualViewport)m={width:a.visualViewport.width,height:a.visualViewport.height};else if(f===a){const y=an(r);m={width:y.documentElement.clientWidth,height:y.documentElement.clientHeight}}else await s.isElement?.(f)&&(m=await s.getDimensions(f));const p=K(l);let u=t,g=n;p==="left"&&(u=m.width-(t+o.width)),p==="top"&&(g=m.height-(n+o.height));const R=p==="left"?"right":$e.sideX,w=p==="top"?"bottom":$e.sideY;return{x:u,y:g,data:{sideX:R,sideY:w}}}};function wn(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function Jt(e,t,n){const{rects:o,placement:r}=e;return{side:wn(t,K(r),n),align:me(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function zr(e){const{anchor:t,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:l,collisionPadding:a=5,sticky:d=!1,arrowPadding:c=5,disableAnchorTracking:f=!1,keepMounted:m=!1,floatingRootContext:p,mounted:u,collisionAvoidance:g,shiftCrossAxis:R=!1,nodeId:w,adaptiveOrigin:y,lazyFlip:C=!1,externalTree:E}=e,[O,T]=x.useState(null);!u&&O!==null&&T(null);const b=g.side||"flip",k=g.align||"flip",$=g.fallbackAxisSide||"end",A=typeof t=="function"?t:void 0,F=ee(A),S=A?F:t,h=we(t),I=Wr()==="rtl",D=O||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[o],M=s==="center"?D:`${D}-${s}`;let v=a;const P=1,j=o==="bottom"?P:0,_=o==="top"?P:0,V=o==="right"?P:0,N=o==="left"?P:0;typeof v=="number"?v={top:v+j,right:v+N,bottom:v+_,left:v+V}:v&&(v={top:(v.top||0)+j,right:(v.right||0)+N,bottom:(v.bottom||0)+_,left:(v.left||0)+V});const H={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:v},Y=x.useRef(null),B=we(r),W=we(i),oe=[Er(X=>{const G=Jt(X,o,I),ie=typeof B.current=="function"?B.current(G):B.current,Q=typeof W.current=="function"?W.current(G):W.current;return{mainAxis:ie,crossAxis:Q,alignmentAxis:Q}},[typeof r!="function"?r:0,typeof i!="function"?i:0,I,o])],vt=k==="none"&&b!=="shift",Rt=!vt&&(d||R||b==="shift"),bt=b==="none"?null:Tr({...H,padding:{top:v.top+P,right:v.right+P,bottom:v.bottom+P,left:v.left+P},mainAxis:!R&&b==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:$}),wt=vt?null:Cr(X=>{const G=an(X.elements.floating).documentElement;return{...H,rootBoundary:R?{x:0,y:0,width:G.clientWidth,height:G.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:Rt,limiter:d||R?void 0:Or(ie=>{if(!Y.current)return{};const{width:Q,height:ve}=Y.current.getBoundingClientRect(),Re=te(K(ie.placement)),De=Re==="y"?Q:ve,Ke=Re==="y"?v.left+v.right:v.top+v.bottom;return{offset:De/2+Ke/2}})}},[H,d,R,v,k]);b==="shift"||k==="shift"||s==="center"?oe.push(wt,bt):oe.push(bt,wt),oe.push(Sr({...H,apply({elements:{floating:X},rects:{reference:G},availableWidth:ie,availableHeight:Q}){Object.entries({"--available-width":`${ie}px`,"--available-height":`${Q}px`,"--anchor-width":`${G.width}px`,"--anchor-height":`${G.height}px`}).forEach(([ve,Re])=>{X.style.setProperty(ve,Re)})}}),Nr(()=>({element:Y.current||document.createElement("div"),padding:c,offsetParent:"floating"}),[c]),{name:"transformOrigin",fn(X){const{elements:G,middlewareData:ie,placement:Q,rects:ve,y:Re}=X,De=K(Q),Ke=te(De),Ht=Y.current,Sn=ie.arrow?.x||0,Pn=ie.arrow?.y||0,An=Ht?.clientWidth||0,Mn=Ht?.clientHeight||0,Je=Sn+An/2,Bt=Pn+Mn/2,In=Math.abs(ie.shift?.y||0),kn=ve.reference.height/2,Ae=typeof r=="function"?r(Jt(X,o,I)):r,Ln=In>Ae,Fn={top:`${Je}px calc(100% + ${Ae}px)`,bottom:`${Je}px ${-Ae}px`,left:`calc(100% + ${Ae}px) ${Bt}px`,right:`${-Ae}px ${Bt}px`}[De],Dn=`${Je}px ${ve.reference.y+kn-Re}px`;return G.floating.style.setProperty("--transform-origin",Rt&&Ke==="y"&&Ln?Dn:Fn),{}}},Yr,y),le(()=>{!u&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[u,p]);const Ge=x.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:xe,elements:Te,x:Et,y:Ct,middlewareData:ye,update:Le,placement:Ot,context:Tt,isPositioned:Se,floatingStyles:St}=Mr({rootContext:p,placement:M,middleware:oe,strategy:n,whileElementsMounted:m?void 0:(...X)=>Gt(...X,Ge),nodeId:w,externalTree:E}),{sideX:Pt,sideY:At}=ye.adaptiveOrigin||$e,qe=Se?n:"fixed",Mt=x.useMemo(()=>y?{position:qe,[Pt]:Et,[At]:Ct}:{position:qe,...St},[y,qe,Pt,Et,At,Ct,St]),Fe=x.useRef(null);le(()=>{if(!u)return;const X=h.current,G=typeof X=="function"?X():X,Q=(Qt(G)?G.current:G)||null||null;Q!==Fe.current&&(xe.setPositionReference(Q),Fe.current=Q)},[u,xe,S,h]),x.useEffect(()=>{if(!u)return;const X=h.current;typeof X!="function"&&Qt(X)&&X.current!==Fe.current&&(xe.setPositionReference(X.current),Fe.current=X.current)},[u,xe,S,h]),x.useEffect(()=>{if(m&&u&&Te.domReference&&Te.floating)return Gt(Te.domReference,Te.floating,Le,Ge)},[m,u,Te,Le,Ge]);const Pe=K(Ot),It=wn(o,Pe,I),kt=me(Ot)||"center",Lt=!!ye.hide?.referenceHidden;le(()=>{C&&u&&Se&&T(Pe)},[C,u,Se,Pe]);const Ft=x.useMemo(()=>({position:"absolute",top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Dt=ye.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Mt,arrowStyles:Ft,arrowRef:Y,arrowUncentered:Dt,side:It,align:kt,physicalSide:Pe,anchorHidden:Lt,refs:xe,context:Tt,isPositioned:Se,update:Le}),[Mt,Ft,Y,Dt,It,kt,Pe,Lt,xe,Tt,Se,Le])}function Qt(e){return e!=null&&"current"in e}const Ur=x.createContext(void 0);function Gr(e){return x.useContext(Ur)}function En(e){return e==="starting"?Nn:tn}const Cn=x.createContext(void 0);function ke(e){const t=x.useContext(Cn);if(t===void 0&&!e)throw new Error(ze(47));return t}function qr(){return{...uo(),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 Kr={...fo,disabled:re(e=>e.disabled),instantType:re(e=>e.instantType),openMethod:re(e=>e.openMethod),openChangeReason:re(e=>e.openChangeReason),modal:re(e=>e.modal),stickIfOpen:re(e=>e.stickIfOpen),titleElementId:re(e=>e.titleElementId),descriptionElementId:re(e=>e.descriptionElementId),openOnHover:re(e=>e.openOnHover),closeDelay:re(e=>e.closeDelay),hasViewport:re(e=>e.hasViewport)};class yt extends lo{constructor(t){const n={...qr(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new cn,triggerElements:new ln},Kr)}setOpen=(t,n)=>{const o=n.reason===Z,r=n.reason===be&&n.event.detail===0,s=!t&&(n.reason===Yn||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",i);const a=()=>{const d={open:t,openChangeReason:n.reason},c=n.trigger?.id??null;(c||t)&&(d.activeTriggerId=c,d.activeTriggerElement=n.trigger??null),this.update(d)};o?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Xn,()=>{this.set("stickIfOpen",!1)}),Ie.flushSync(a)):a(),r||s?this.set("instantType",r?"click":"dismiss"):n.reason===rt?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const o=rn(()=>new yt(n)).current,r=t??o;return zn(o.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function Zt({props:e}){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,modal:i=!1,handle:l,triggerId:a,defaultTriggerId:d=null}=e,c=yt.useStore(l?.store,{open:n??o,modal:i,activeTriggerId:a!==void 0?a:d});c.useControlledProp("open",n,o),c.useControlledProp("activeTriggerId",a,d);const f=c.useState("open"),m=c.useState("positionerElement"),p=c.useState("payload"),u=c.useState("openChangeReason");c.useContextCallback("onOpenChange",r),c.useContextCallback("onOpenChangeComplete",s);const{openMethod:g,triggerProps:R,reset:w}=po(f);mo(c);const{forceUnmount:y}=ho(f,c,()=>{c.update({stickIfOpen:!0,openChangeReason:null}),w()});xo(f&&i===!0&&u!==Z&&g!=="touch",m),x.useEffect(()=>{f||c.context.stickIfOpenTimeout.clear()},[c,f]);const C=x.useCallback(I=>{const D=q(I);return D.preventUnmountOnClose=()=>{c.set("preventUnmountingOnClose",!0)},D},[c]),E=x.useCallback(()=>{c.setOpen(!1,C(Un))},[c,C]);x.useImperativeHandle(e.actionsRef,()=>({unmount:y,close:E}),[y,E]);const O=yo({popupStore:c,onOpenChange:c.setOpen}),T=vo(O,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),b=Ro(O),{getReferenceProps:k,getFloatingProps:$,getTriggerProps:A}=fn([T,b]),F=x.useMemo(()=>k(R),[k,R]),S=x.useMemo(()=>A(R),[A,R]),h=x.useMemo(()=>$(),[$]);c.useSyncedValues({modal:i,openMethod:g,activeTriggerProps:F,inactiveTriggerProps:S,popupProps:h,floatingRootContext:O,nested:dt()!=null});const L=x.useMemo(()=>({store:c}),[c]);return U.jsx(Cn.Provider,{value:L,children:typeof t=="function"?t({payload:p}):t})}function ss(e){return ke(!0)?U.jsx(Zt,{props:e}):U.jsx(go,{children:U.jsx(Zt,{props:e})})}const Jr=300,is=x.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,handle:l,payload:a,openOnHover:d=!1,delay:c=Jr,closeDelay:f=0,id:m,...p}=t,u=ke(!0),g=l?.store??u?.store;if(!g)throw new Error(ze(74));const R=bo(m),w=g.useState("isTriggerActive",R),y=g.useState("floatingRootContext"),C=g.useState("isOpenedByTrigger",R),E=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:T}=wo(R,E,g,{payload:a,disabled:s,openOnHover:d,closeDelay:f}),b=g.useState("openChangeReason"),k=g.useState("stickIfOpen"),$=g.useState("openMethod"),A=Br(y,{enabled:y!=null&&d&&($!=="touch"||b!==be),mouseOnly:!0,move:!1,handleClose:_r(),restMs:c,delay:{close:f},triggerElementRef:E,isActiveTrigger:w}),F=Wo(y,{enabled:y!=null,stickIfOpen:k}),S=fn([F]),h=g.useState("triggerProps",T),L=x.useMemo(()=>({disabled:s,open:C}),[s,C]),{getButtonProps:I,buttonRef:D}=Gn({disabled:s,native:i}),M=x.useMemo(()=>({open(V){return V&&b===be?Eo.open(V):Co.open(V)}}),[b]),v=ut("button",t,{state:L,ref:[D,n,O,E],props:[S.getReferenceProps(),A,h,{[qn]:"",id:R},p,I],stateAttributesMapping:M}),P=x.useRef(null),j=ee(V=>{Ie.flushSync(()=>{g.setOpen(!1,q(rt,V.nativeEvent,V.currentTarget))}),Kn(P.current)?.focus()}),_=ee(V=>{const N=g.select("positionerElement");if(N&&Jn(V,N))g.context.beforeContentFocusGuardRef.current?.focus();else{Ie.flushSync(()=>{g.setOpen(!1,q(rt,V.nativeEvent,V.currentTarget))});let H=Qn(g.context.triggerFocusTargetRef.current||E.current);for(;H!==null&&ae(N,H);){const Y=H;if(H=Zn(H),H===Y)break}H?.focus()}});return w?U.jsxs(x.Fragment,{children:[U.jsx(_t,{ref:P,onFocus:j}),U.jsx(x.Fragment,{children:v},R),U.jsx(_t,{ref:g.context.triggerFocusTargetRef,onFocus:_})]}):U.jsx(x.Fragment,{children:v},R)}),On=x.createContext(void 0);function Qr(){const e=x.useContext(On);if(e===void 0)throw new Error(ze(45));return e}const cs=x.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=ke();return s.useState("mounted")||o?U.jsx(On.Provider,{value:o,children:U.jsx(eo,{ref:n,...r,renderGuards:!1})}):null}),Tn=x.createContext(void 0);function Zr(){const e=x.useContext(Tn);if(!e)throw new Error(ze(46));return e}const as=x.forwardRef(function(t,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:l="bottom",align:a="center",sideOffset:d=0,alignOffset:c=0,collisionBoundary:f="clipping-ancestors",collisionPadding:m=5,arrowPadding:p=5,sticky:u=!1,disableAnchorTracking:g=!1,collisionAvoidance:R=to,...w}=t,{store:y}=ke(),C=Qr(),E=Oo(),O=y.useState("floatingRootContext"),T=y.useState("mounted"),b=y.useState("open"),k=y.useState("openChangeReason"),$=y.useState("activeTriggerElement"),A=y.useState("modal"),F=y.useState("positionerElement"),S=y.useState("instantType"),h=y.useState("transitionStatus"),L=y.useState("hasViewport"),I=x.useRef(null),D=no(F,!1,!1),M=zr({anchor:s,floatingRootContext:O,positionMethod:i,mounted:T,side:l,sideOffset:d,align:a,alignOffset:c,arrowPadding:p,collisionBoundary:f,collisionPadding:m,sticky:u,disableAnchorTracking:g,keepMounted:C,nodeId:E,collisionAvoidance:R,adaptiveOrigin:L?Xr:void 0}),v=x.useMemo(()=>{const H={};return b||(H.pointerEvents="none"),{role:"presentation",hidden:!T,style:{...M.positionerStyles,...H}}},[b,T,M.positionerStyles]),P=x.useMemo(()=>({props:v,...M}),[v,M]),j=O?.select("domReferenceElement");le(()=>{const H=j,Y=I.current;if(H&&(I.current=H),Y&&H&&H!==Y){y.set("instantType",void 0);const B=new AbortController;return D(()=>{y.set("instantType","trigger-change")},B.signal),()=>{B.abort()}}},[j,D,y]);const _=x.useMemo(()=>({open:b,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:S}),[b,P.side,P.align,P.anchorHidden,S]),V=x.useCallback(H=>{y.set("positionerElement",H)},[y]),N=ut("div",t,{state:_,props:[P.props,En(h),w],ref:[n,V],stateAttributesMapping:un});return U.jsxs(Tn.Provider,{value:P,children:[T&&A===!0&&k!==Z&&U.jsx(To,{ref:y.context.internalBackdropRef,inert:oo(!b),cutout:$}),U.jsx(So,{id:E,children:N})]})}),es={...un,...so},ls=x.forwardRef(function(t,n){const{className:o,render:r,initialFocus:s,finalFocus:i,...l}=t,{store:a}=ke(),d=Zr(),c=Gr()!=null,f=a.useState("open"),m=a.useState("openMethod"),p=a.useState("instantType"),u=a.useState("transitionStatus"),g=a.useState("popupProps"),R=a.useState("titleElementId"),w=a.useState("descriptionElementId"),y=a.useState("modal"),C=a.useState("mounted"),E=a.useState("openChangeReason"),O=a.useState("activeTriggerElement"),T=a.useState("floatingRootContext");ro({open:f,ref:a.context.popupRef,onComplete(){f&&a.context.onOpenChangeComplete?.(!0)}});const b=a.useState("disabled"),k=a.useState("openOnHover"),$=a.useState("closeDelay");Fr(T,{enabled:k&&!b,closeDelay:$});function A(I){return I==="touch"?a.context.popupRef.current:!0}const F=s===void 0?A:s,S=x.useMemo(()=>({open:f,side:d.side,align:d.align,instant:p,transitionStatus:u}),[f,d.side,d.align,p,u]),h=x.useCallback(I=>{a.set("popupElement",I)},[a]),L=ut("div",t,{state:S,ref:[n,a.context.popupRef,h],props:[g,{"aria-labelledby":R,"aria-describedby":w,onKeyDown(I){c&&Ao.has(I.key)&&I.stopPropagation()}},En(u),l],stateAttributesMapping:es});return U.jsx(Po,{context:T,openInteractionType:m,modal:y==="trap-focus",disabled:!C||E===Z,initialFocus:F,returnFocus:i,restoreFocus:"popup",previousFocusableElement:pe(O)?O:void 0,nextFocusableElement:a.context.triggerFocusTargetRef,beforeContentFocusGuardRef:a.context.beforeContentFocusGuardRef,children:L})});export{os as C,rs as L,ss as P,is as a,cs as b,as as c,ls as d,Wo as e,He as f,zr as g,Gr as h,En as i,Ar as u};
|
|
1
|
+
import{c as en,r as x,bs as Hn,b9 as nt,b as q,bP as be,bQ as Bn,bd as tn,bR as ot,be as z,bS as de,bt as ge,bT as $t,bU as fe,b6 as pe,bV as nn,bW as lt,bX as Me,bY as Ve,bZ as $n,b_ as on,b$ as Vn,c0 as at,c1 as ft,c2 as Xe,ak as Ie,c3 as _n,bf as rn,a$ as ae,c4 as Wn,c5 as jn,b1 as ee,c6 as Z,b3 as _e,b7 as sn,b4 as le,c7 as cn,bn as ln,c8 as Nn,bb as ze,c9 as Yn,ca as Xn,b8 as rt,cb as zn,j as U,cc as Un,u as Gn,a as ut,cd as qn,ce as Vt,cf as Kn,cg as Jn,ch as Qn,ci as Zn,bp as eo,cj as to,ck as no,br as oo,bg as ro,bw as so}from"./main-QElo_0bY.js";import{y as Ce,z as io,g as dt,A as co,P as an,h as gt,f as we,B as lo,R as ao,E as fo,G as uo,m as re,H as go,o as po,J as mo,K as ho,w as xo,L as yo,q as vo,M as Ro,r as fn,l as bo,N as wo,t as Eo,v as Co,O as Oo,I as To,Q as So,x as un,F as Po,C as Ao}from"./DialogTitle-Ds8Zyp-H.js";const Mo=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],os=en("chevron-right",Mo);const Io=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],rs=en("loader-circle",Io),ko=["top","right","bottom","left"],Oe=Math.min,J=Math.max,We=Math.round,He=Math.floor,ce=e=>({x:e,y:e}),Lo={left:"right",right:"left",bottom:"top",top:"bottom"};function st(e,t,n){return J(e,Oe(t,n))}function ue(e,t){return typeof e=="function"?e(t):e}function K(e){return e.split("-")[0]}function me(e){return e.split("-")[1]}function pt(e){return e==="x"?"y":"x"}function mt(e){return e==="y"?"height":"width"}function te(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ht(e){return pt(te(e))}function Fo(e,t,n){n===void 0&&(n=!1);const o=me(e),r=ht(e),s=mt(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=je(i)),[i,je(i)]}function Do(e){const t=je(e);return[it(e),t,it(t)]}function it(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const _t=["left","right"],Wt=["right","left"],Ho=["top","bottom"],Bo=["bottom","top"];function $o(e,t,n){switch(e){case"top":case"bottom":return n?t?Wt:_t:t?_t:Wt;case"left":case"right":return t?Ho:Bo;default:return[]}}function Vo(e,t,n,o){const r=me(e);let s=$o(K(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(it)))),s}function je(e){const t=K(e);return Lo[t]+e.slice(t.length)}function _o(e){return{top:0,right:0,bottom:0,left:0,...e}}function dn(e){return typeof e!="number"?_o(e):{top:e,right:e,bottom:e,left:e}}function Ne(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Qe(e,t,n){if(n&&!Ce(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const o=e();return typeof o=="number"?o:o?.[t]}return e?.[t]}function Wo(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,{enabled:r=!0,event:s="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:l=!0,touchOpenDelay:d=0}=t,c=x.useRef(void 0),f=Hn(),m=nt(),p=x.useMemo(()=>({onPointerDown(u){c.current=u.pointerType},onMouseDown(u){const g=c.current,R=u.nativeEvent,w=n.select("open");if(u.button!==0||s==="click"||Ce(g,!0)&&a)return;const y=o.current.openEvent,C=y?.type,E=n.select("domReferenceElement")!==u.currentTarget,O=w&&E||!(w&&i&&(!(y&&l)||C==="click"||C==="mousedown"));if(Bn(R.target)){const b=q(be,R,R.target);O&&g==="touch"&&d>0?m.start(d,()=>{n.setOpen(!0,b)}):n.setOpen(O,b);return}const T=u.currentTarget;f.request(()=>{const b=q(be,R,T);O&&g==="touch"&&d>0?m.start(d,()=>{n.setOpen(!0,b)}):n.setOpen(O,b)})},onClick(u){if(s==="mousedown-only")return;const g=c.current;if(s==="mousedown"&&g){c.current=void 0;return}if(Ce(g,!0)&&a)return;const R=n.select("open"),w=o.current.openEvent,y=n.select("domReferenceElement")!==u.currentTarget,C=R&&y||!(R&&i&&(!(w&&l)||io(w))),E=q(be,u.nativeEvent,u.currentTarget);C&&g==="touch"&&d>0?m.start(d,()=>{n.setOpen(!0,E)}):n.setOpen(C,E)},onKeyDown(){c.current=void 0}}),[o,s,a,n,l,i,f,m,d]);return x.useMemo(()=>r?{reference:p}:tn,[r,p])}function jt(e,t,n){let{reference:o,floating:r}=e;const s=te(t),i=ht(t),a=mt(i),l=K(t),d=s==="y",c=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,m=o[a]/2-r[a]/2;let p;switch(l){case"top":p={x:c,y:o.y-r.height};break;case"bottom":p={x:c,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(me(t)){case"start":p[i]-=m*(n&&d?-1:1);break;case"end":p[i]+=m*(n&&d?-1:1);break}return p}async function jo(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=ue(t,e),u=dn(p),R=a[m?f==="floating"?"reference":"floating":f],w=Ne(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(R)))==null||n?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:d,rootBoundary:c,strategy:l})),y=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),E=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},O=Ne(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:C,strategy:l}):y);return{top:(w.top-O.top+u.top)/E.y,bottom:(O.bottom-w.bottom+u.bottom)/E.y,left:(w.left-O.left+u.left)/E.x,right:(O.right-w.right+u.right)/E.x}}const No=50,Yo=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:jo},l=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:f}=jt(d,o,l),m=o,p=0;const u={};for(let g=0;g<s.length;g++){const R=s[g];if(!R)continue;const{name:w,fn:y}=R,{x:C,y:E,data:O,reset:T}=await y({x:c,y:f,initialPlacement:o,placement:m,strategy:r,middlewareData:u,rects:d,platform:a,elements:{reference:e,floating:t}});c=C??c,f=E??f,u[w]={...u[w],...O},T&&p<No&&(p++,typeof T=="object"&&(T.placement&&(m=T.placement),T.rects&&(d=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):T.rects),{x:c,y:f}=jt(d,m,l)),g=-1)}return{x:c,y:f,placement:m,strategy:r,middlewareData:u}},Xo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:u="none",flipAlignment:g=!0,...R}=ue(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=K(r),y=te(a),C=K(a)===a,E=await(l.isRTL==null?void 0:l.isRTL(d.floating)),O=m||(C||!g?[je(a)]:Do(a)),T=u!=="none";!m&&T&&O.push(...Vo(a,g,u,E));const b=[a,...O],k=await l.detectOverflow(t,R),$=[];let A=((o=s.flip)==null?void 0:o.overflows)||[];if(c&&$.push(k[w]),f){const L=Fo(r,i,E);$.push(k[L[0]],k[L[1]])}if(A=[...A,{placement:r,overflows:$}],!$.every(L=>L<=0)){var F,S;const L=(((F=s.flip)==null?void 0:F.index)||0)+1,I=b[L];if(I&&(!(f==="alignment"?y!==te(I):!1)||A.every(v=>te(v.placement)===y?v.overflows[0]>0:!0)))return{data:{index:L,overflows:A},reset:{placement:I}};let D=(S=A.filter(M=>M.overflows[0]<=0).sort((M,v)=>M.overflows[1]-v.overflows[1])[0])==null?void 0:S.placement;if(!D)switch(p){case"bestFit":{var h;const M=(h=A.filter(v=>{if(T){const P=te(v.placement);return P===y||P==="y"}return!0}).map(v=>[v.placement,v.overflows.filter(P=>P>0).reduce((P,j)=>P+j,0)]).sort((v,P)=>v[1]-P[1])[0])==null?void 0:h[0];M&&(D=M);break}case"initialPlacement":D=a;break}if(r!==D)return{reset:{placement:D}}}return{}}}};function Nt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yt(e){return ko.some(t=>e[t]>=0)}const zo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=ue(e,t);switch(r){case"referenceHidden":{const i=await o.detectOverflow(t,{...s,elementContext:"reference"}),a=Nt(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Yt(a)}}}case"escaped":{const i=await o.detectOverflow(t,{...s,altBoundary:!0}),a=Nt(i,n.floating);return{data:{escapedOffsets:a,escaped:Yt(a)}}}default:return{}}}}},gn=new Set(["left","top"]);async function Uo(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=K(n),a=me(n),l=te(n)==="y",d=gn.has(i)?-1:1,c=s&&l?-1:1,f=ue(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:u}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof u=="number"&&(p=a==="end"?u*-1:u),l?{x:p*c,y:m*d}:{x:m*d,y:p*c}}const Go=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:a}=t,l=await Uo(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:i}}}}},qo=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x:y,y:C}=w;return{x:y,y:C}}},...d}=ue(e,t),c={x:n,y:o},f=await s.detectOverflow(t,d),m=te(K(r)),p=pt(m);let u=c[p],g=c[m];if(i){const w=p==="y"?"top":"left",y=p==="y"?"bottom":"right",C=u+f[w],E=u-f[y];u=st(C,u,E)}if(a){const w=m==="y"?"top":"left",y=m==="y"?"bottom":"right",C=g+f[w],E=g-f[y];g=st(C,g,E)}const R=l.fn({...t,[p]:u,[m]:g});return{...R,data:{x:R.x-n,y:R.y-o,enabled:{[p]:i,[m]:a}}}}}},Ko=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:d=!0}=ue(e,t),c={x:n,y:o},f=te(r),m=pt(f);let p=c[m],u=c[f];const g=ue(a,t),R=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const C=m==="y"?"height":"width",E=s.reference[m]-s.floating[C]+R.mainAxis,O=s.reference[m]+s.reference[C]-R.mainAxis;p<E?p=E:p>O&&(p=O)}if(d){var w,y;const C=m==="y"?"width":"height",E=gn.has(K(r)),O=s.reference[f]-s.floating[C]+(E&&((w=i.offset)==null?void 0:w[f])||0)+(E?0:R.crossAxis),T=s.reference[f]+s.reference[C]+(E?0:((y=i.offset)==null?void 0:y[f])||0)-(E?R.crossAxis:0);u<O?u=O:u>T&&(u=T)}return{[m]:p,[f]:u}}}},Jo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...d}=ue(e,t),c=await i.detectOverflow(t,d),f=K(r),m=me(r),p=te(r)==="y",{width:u,height:g}=s.floating;let R,w;f==="top"||f==="bottom"?(R=f,w=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=f,R=m==="end"?"top":"bottom");const y=g-c.top-c.bottom,C=u-c.left-c.right,E=Oe(g-c[R],y),O=Oe(u-c[w],C),T=!t.middlewareData.shift;let b=E,k=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=C),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(b=y),T&&!m){const A=J(c.left,0),F=J(c.right,0),S=J(c.top,0),h=J(c.bottom,0);p?k=u-2*(A!==0||F!==0?A+F:J(c.left,c.right)):b=g-2*(S!==0||h!==0?S+h:J(c.top,c.bottom))}await l({...t,availableWidth:k,availableHeight:b});const $=await i.getDimensions(a.floating);return u!==$.width||g!==$.height?{reset:{rects:!0}}:{}}}};function pn(e){const t=fe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=pe(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,a=We(n)!==s||We(o)!==i;return a&&(n=s,o=i),{width:n,height:o,$:a}}function xt(e){return z(e)?e:e.contextElement}function Ee(e){const t=xt(e);if(!pe(t))return ce(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=pn(t);let i=(s?We(n.width):n.width)/o,a=(s?We(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Qo=ce(0);function mn(e){const t=ge(e);return!nn()||!t.visualViewport?Qo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ge(e)?!1:t}function he(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=xt(e);let i=ce(1);t&&(o?z(o)&&(i=Ee(o)):i=Ee(e));const a=Zo(s,n,o)?mn(s):ce(0);let l=(r.left+a.x)/i.x,d=(r.top+a.y)/i.y,c=r.width/i.x,f=r.height/i.y;if(s){const m=ge(s),p=o&&z(o)?ge(o):o;let u=m,g=$t(u);for(;g&&o&&p!==u;){const R=Ee(g),w=g.getBoundingClientRect(),y=fe(g),C=w.left+(g.clientLeft+parseFloat(y.paddingLeft))*R.x,E=w.top+(g.clientTop+parseFloat(y.paddingTop))*R.y;l*=R.x,d*=R.y,c*=R.x,f*=R.y,l+=C,d+=E,u=ge(g),g=$t(u)}}return Ne({width:c,height:f,x:l,y:d})}function Ue(e,t){const n=Xe(e).scrollLeft;return t?t.left+n:he(de(e)).left+n}function hn(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Ue(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function er(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=de(o),a=t?lt(t.floating):!1;if(o===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},d=ce(1);const c=ce(0),f=pe(o);if((f||!f&&!s)&&((at(o)!=="body"||ft(i))&&(l=Xe(o)),f)){const p=he(o);d=Ee(o),c.x=p.x+o.clientLeft,c.y=p.y+o.clientTop}const m=i&&!f&&!s?hn(i,l):ce(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+c.x+m.x,y:n.y*d.y-l.scrollTop*d.y+c.y+m.y}}function tr(e){return Array.from(e.getClientRects())}function nr(e){const t=de(e),n=Xe(e),o=e.ownerDocument.body,r=J(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=J(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Ue(e);const a=-n.scrollTop;return fe(o).direction==="rtl"&&(i+=J(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:a}}const Xt=25;function or(e,t){const n=ge(e),o=de(e),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,a=0,l=0;if(r){s=r.width,i=r.height;const c=nn();(!c||c&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}const d=Ue(o);if(d<=0){const c=o.ownerDocument,f=c.body,m=getComputedStyle(f),p=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,u=Math.abs(o.clientWidth-f.clientWidth-p);u<=Xt&&(s-=u)}else d<=Xt&&(s+=d);return{width:s,height:i,x:a,y:l}}function rr(e,t){const n=he(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=pe(e)?Ee(e):ce(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=r*s.x,d=o*s.y;return{width:i,height:a,x:l,y:d}}function zt(e,t,n){let o;if(t==="viewport")o=or(e,n);else if(t==="document")o=nr(de(e));else if(z(t))o=rr(t,n);else{const r=mn(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ne(o)}function xn(e,t){const n=Me(e);return n===t||!z(n)||Ve(n)?!1:fe(n).position==="fixed"||xn(n,t)}function sr(e,t){const n=t.get(e);if(n)return n;let o=ot(e,[],!1).filter(a=>z(a)&&at(a)!=="body"),r=null;const s=fe(e).position==="fixed";let i=s?Me(e):e;for(;z(i)&&!Ve(i);){const a=fe(i),l=on(i);!l&&a.position==="fixed"&&(r=null),(s?!l&&!r:!l&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||ft(i)&&!l&&xn(e,i))?o=o.filter(c=>c!==i):r=a,i=Me(i)}return t.set(e,o),o}function ir(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?lt(t)?[]:sr(t,this._c):[].concat(n),o],a=zt(t,i[0],r);let l=a.top,d=a.right,c=a.bottom,f=a.left;for(let m=1;m<i.length;m++){const p=zt(t,i[m],r);l=J(p.top,l),d=Oe(p.right,d),c=Oe(p.bottom,c),f=J(p.left,f)}return{width:d-f,height:c-l,x:f,y:l}}function cr(e){const{width:t,height:n}=pn(e);return{width:t,height:n}}function lr(e,t,n){const o=pe(t),r=de(t),s=n==="fixed",i=he(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=ce(0);function d(){l.x=Ue(r)}if(o||!o&&!s)if((at(t)!=="body"||ft(r))&&(a=Xe(t)),o){const p=he(t,!0,s,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else r&&d();s&&!o&&r&&d();const c=r&&!o&&!s?hn(r,a):ce(0),f=i.left+a.scrollLeft-l.x-c.x,m=i.top+a.scrollTop-l.y-c.y;return{x:f,y:m,width:i.width,height:i.height}}function Ze(e){return fe(e).position==="static"}function Ut(e,t){if(!pe(e)||fe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return de(e)===n&&(n=n.ownerDocument.body),n}function yn(e,t){const n=ge(e);if(lt(e))return n;if(!pe(e)){let r=Me(e);for(;r&&!Ve(r);){if(z(r)&&!Ze(r))return r;r=Me(r)}return n}let o=Ut(e,t);for(;o&&$n(o)&&Ze(o);)o=Ut(o,t);return o&&Ve(o)&&Ze(o)&&!on(o)?n:o||Vn(e)||n}const ar=async function(e){const t=this.getOffsetParent||yn,n=this.getDimensions,o=await n(e.floating);return{reference:lr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function fr(e){return fe(e).direction==="rtl"}const ur={convertOffsetParentRelativeRectToViewportRelativeRect:er,getDocumentElement:de,getClippingRect:ir,getOffsetParent:yn,getElementRects:ar,getClientRects:tr,getDimensions:cr,getScale:Ee,isElement:z,isRTL:fr};function vn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function dr(e,t){let n=null,o;const r=de(e);function s(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const d=e.getBoundingClientRect(),{left:c,top:f,width:m,height:p}=d;if(a||t(),!m||!p)return;const u=He(f),g=He(r.clientWidth-(c+m)),R=He(r.clientHeight-(f+p)),w=He(c),C={rootMargin:-u+"px "+-g+"px "+-R+"px "+-w+"px",threshold:J(0,Oe(1,l))||1};let E=!0;function O(T){const b=T[0].intersectionRatio;if(b!==l){if(!E)return i();b?i(!1,b):o=setTimeout(()=>{i(!1,1e-7)},1e3)}b===1&&!vn(d,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(O,{...C,root:r.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(e)}return i(!0),s}function Gt(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,d=xt(e),c=r||s?[...d?ot(d):[],...t?ot(t):[]]:[];c.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const f=d&&a?dr(d,n):null;let m=-1,p=null;i&&(p=new ResizeObserver(w=>{let[y]=w;y&&y.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var C;(C=p)==null||C.observe(t)})),n()}),d&&!l&&p.observe(d),t&&p.observe(t));let u,g=l?he(e):null;l&&R();function R(){const w=he(e);g&&!vn(g,w)&&n(),g=w,u=requestAnimationFrame(R)}return n(),()=>{var w;c.forEach(y=>{r&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),f?.(),(w=p)==null||w.disconnect(),p=null,l&&cancelAnimationFrame(u)}}const gr=Go,pr=qo,mr=Xo,hr=Jo,xr=zo,yr=Ko,vr=(e,t,n)=>{const o=new Map,r={platform:ur,...n},s={...r.platform,_c:o};return Yo(e,t,{...r,platform:s})};var Rr=typeof document<"u",br=function(){},Be=Rr?x.useLayoutEffect:br;function Ye(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,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Ye(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Ye(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Rn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qt(e,t){const n=Rn(e);return Math.round(t*n)/n}function et(e){const t=x.useRef(e);return Be(()=>{t.current=e}),t}function wr(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:d}=e,[c,f]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=x.useState(o);Ye(m,o)||p(o);const[u,g]=x.useState(null),[R,w]=x.useState(null),y=x.useCallback(v=>{v!==T.current&&(T.current=v,g(v))},[]),C=x.useCallback(v=>{v!==b.current&&(b.current=v,w(v))},[]),E=s||u,O=i||R,T=x.useRef(null),b=x.useRef(null),k=x.useRef(c),$=l!=null,A=et(l),F=et(r),S=et(d),h=x.useCallback(()=>{if(!T.current||!b.current)return;const v={placement:t,strategy:n,middleware:m};F.current&&(v.platform=F.current),vr(T.current,b.current,v).then(P=>{const j={...P,isPositioned:S.current!==!1};L.current&&!Ye(k.current,j)&&(k.current=j,Ie.flushSync(()=>{f(j)}))})},[m,t,n,F,S]);Be(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(v=>({...v,isPositioned:!1})))},[d]);const L=x.useRef(!1);Be(()=>(L.current=!0,()=>{L.current=!1}),[]),Be(()=>{if(E&&(T.current=E),O&&(b.current=O),E&&O){if(A.current)return A.current(E,O,h);h()}},[E,O,h,A,$]);const I=x.useMemo(()=>({reference:T,floating:b,setReference:y,setFloating:C}),[y,C]),D=x.useMemo(()=>({reference:E,floating:O}),[E,O]),M=x.useMemo(()=>{const v={position:n,left:0,top:0};if(!D.floating)return v;const P=qt(D.floating,c.x),j=qt(D.floating,c.y);return a?{...v,transform:"translate("+P+"px, "+j+"px)",...Rn(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:j}},[n,a,D.floating,c.x,c.y]);return x.useMemo(()=>({...c,update:h,refs:I,elements:D,floatingStyles:M}),[c,h,I,D,M])}const Er=(e,t)=>{const n=gr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cr=(e,t)=>{const n=pr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Or=(e,t)=>({fn:yr(e).fn,options:[e,t]}),Tr=(e,t)=>{const n=mr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sr=(e,t)=>{const n=hr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pr=(e,t)=>{const n=xr(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Ar(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,r=_n(),s=dt()!=null,i=rn(()=>new co({open:t,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new an,floatingId:r,nested:s,noEmit:e.noEmit||!1})).current;return ae(()=>{const a={open:t,floatingId:r};o.reference!==void 0&&(a.referenceElement=o.reference,a.domReferenceElement=z(o.reference)?o.reference:null),o.floating!==void 0&&(a.floatingElement=o.floating),i.update(a)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function Mr(e={}){const{nodeId:t,externalTree:n}=e,o=Ar(e),r=e.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,a]=x.useState(null),l=x.useRef(null),d=gt(n);ae(()=>{s.domReference&&(l.current=s.domReference)},[s.domReference]);const c=wr({...e,elements:{...s,...i&&{reference:i}}}),f=x.useCallback(b=>{const k=z(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;a(k),c.refs.setReference(k)},[c.refs]),[m,p]=x.useState(null),[u,g]=x.useState(null);r.useSyncedValue("referenceElement",m),r.useSyncedValue("domReferenceElement",z(m)?m:null),r.useSyncedValue("floatingElement",u);const R=x.useCallback(b=>{(z(b)||b===null)&&(l.current=b,p(b)),(z(c.refs.reference.current)||c.refs.reference.current===null||b!==null&&!z(b))&&c.refs.setReference(b)},[c.refs,p]),w=x.useCallback(b=>{g(b),c.refs.setFloating(b)},[c.refs]),y=x.useMemo(()=>({...c.refs,setReference:R,setFloating:w,setPositionReference:f,domReference:l}),[c.refs,R,w,f]),C=x.useMemo(()=>({...c.elements,domReference:s.domReference}),[c.elements,s.domReference]),E=r.useState("open"),O=r.useState("floatingId"),T=x.useMemo(()=>({...c,dataRef:r.context.dataRef,open:E,onOpenChange:r.setOpen,events:r.context.events,floatingId:O,refs:y,elements:C,nodeId:t,rootStore:r}),[c,y,C,t,r,E,O]);return ae(()=>{r.context.dataRef.current.floatingContext=T;const b=d?.nodesRef.current.find(k=>k.id===t);b&&(b.context=T)}),x.useMemo(()=>({...c,context:T,refs:y,elements:C,rootStore:r}),[c,y,C,T,r])}const ct=Wn("safe-polygon"),Ir=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${jn}`;function kr(e){return e?!!e.closest(Ir):!1}function bn(e){const t=x.useRef(void 0),n=x.useRef(!1),o=x.useRef(void 0),r=x.useRef(!0),s=x.useRef(!1),i=x.useRef(()=>{}),a=x.useRef(!1),l=nt(),d=nt(),c=x.useRef(void 0);return x.useMemo(()=>{const f=e.context.dataRef.current;return f.hoverInteractionState||(f.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:o,blockMouseMoveRef:r,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:a,openChangeTimeout:l,restTimeout:d,handleCloseOptionsRef:c}),f.hoverInteractionState},[e,t,n,o,r,s,i,a,l,d,c])}const Lr=new Set(["click","mousedown"]);function Fr(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:l=0,externalTree:d}=t,{pointerTypeRef:c,interactedInsideRef:f,handlerRef:m,performedPointerEventsMutationRef:p,unbindMouseMoveRef:u,restTimeoutPendingRef:g,openChangeTimeout:R,handleCloseOptionsRef:w}=bn(n),y=gt(d),C=dt(),E=ee(()=>f.current?!0:i.current.openEvent?Lr.has(i.current.openEvent.type):!1),O=ee(()=>{const A=i.current.openEvent?.type;return A?.includes("mouse")&&A!=="mousedown"}),T=x.useCallback((A,F=!0)=>{const S=Dr(l,c.current);S&&!m.current?R.start(S,()=>n.setOpen(!1,q(Z,A))):F&&(R.clear(),n.setOpen(!1,q(Z,A)))},[l,m,n,c,R]),b=ee(()=>{u.current(),m.current=void 0}),k=ee(()=>{if(p.current){const A=_e(r).body;A.style.pointerEvents="",A.removeAttribute(ct),p.current=!1}}),$=ee(A=>{const F=sn(A);if(!kr(F)){f.current=!1;return}f.current=!0});ae(()=>{o||(c.current=void 0,g.current=!1,f.current=!1,b(),k())},[o,c,g,f,b,k]),x.useEffect(()=>()=>{b()},[b]),x.useEffect(()=>k,[k]),ae(()=>{if(a&&o&&w.current?.blockPointerEvents&&O()&&z(s)&&r){p.current=!0;const A=_e(r).body;A.setAttribute(ct,"");const F=s,S=r,h=y?.nodesRef.current.find(L=>L.id===C)?.context?.elements.floating;return h&&(h.style.pointerEvents=""),A.style.pointerEvents="none",F.style.pointerEvents="auto",S.style.pointerEvents="auto",()=>{A.style.pointerEvents="",F.style.pointerEvents="",S.style.pointerEvents=""}}},[a,o,s,r,w,O,y,C,p]),x.useEffect(()=>{if(!a)return;function A(L){if(E()||!i.current.floatingContext||!n.select("open"))return;const I=n.context.triggerElements;L.relatedTarget&&I.hasElement(L.relatedTarget)||(k(),b(),E()||T(L))}function F(L){R.clear(),k(),m.current?.(L),b()}function S(L){E()||T(L,!1)}const h=r;return h&&(h.addEventListener("mouseleave",A),h.addEventListener("mouseenter",F),h.addEventListener("mouseleave",S),h.addEventListener("pointerdown",$,!0)),()=>{h&&(h.removeEventListener("mouseleave",A),h.removeEventListener("mouseenter",F),h.removeEventListener("mouseleave",S),h.removeEventListener("pointerdown",$,!0))}})}function Dr(e,t){return t&&!Ce(t)?0:typeof e=="function"?e():e}function tt(e){return typeof e=="function"?e():e}const Hr={current:null};function Br(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:l=!1,restMs:d=0,move:c=!0,triggerElementRef:f=Hr,externalTree:m,isActiveTrigger:p=!0}=t,u=gt(m),{pointerTypeRef:g,interactedInsideRef:R,handlerRef:w,blockMouseMoveRef:y,performedPointerEventsMutationRef:C,unbindMouseMoveRef:E,restTimeoutPendingRef:O,openChangeTimeout:T,restTimeout:b,handleCloseOptionsRef:k}=bn(n),$=we(a),A=we(i),F=we(d);p&&(k.current=$.current?.__options);const S=ee(()=>R.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),h=x.useCallback((M,v=!0)=>{const P=Qe(A.current,"close",g.current);P&&!w.current?T.start(P,()=>n.setOpen(!1,q(Z,M))):v&&(T.clear(),n.setOpen(!1,q(Z,M)))},[A,w,n,g,T]),L=ee(()=>{E.current(),w.current=void 0}),I=ee(()=>{if(C.current){const M=_e(n.select("domReferenceElement")).body;M.style.pointerEvents="",M.removeAttribute(ct),C.current=!1}});x.useEffect(()=>{if(!s)return;function M(v){v.open||(T.clear(),b.clear(),y.current=!0,O.current=!1)}return r.on("openchange",M),()=>{r.off("openchange",M)}},[s,r,T,b,y,O]);const D=ee(M=>{if(S()||!o.current.floatingContext)return;const v=n.context.triggerElements;if(M.relatedTarget&&v.hasElement(M.relatedTarget))return;const P=f.current;$.current?.({...o.current.floatingContext,tree:u,x:M.clientX,y:M.clientY,onClose(){I(),L(),!S()&&P===n.select("domReferenceElement")&&h(M)}})(M)});return x.useEffect(()=>{if(!s)return;const M=f.current??(p?n.select("domReferenceElement"):null);if(!z(M))return;function v(V){if(T.clear(),y.current=!1,l&&!Ce(g.current)||tt(F.current)>0&&!Qe(A.current,"open"))return;const _=Qe(A.current,"open",g.current),N=n.select("domReferenceElement"),H=n.context.triggerElements,Y=(H.hasElement(V.target)||H.hasMatchingElement(se=>le(se,V.target)))&&(!N||!le(N,V.target)),B=V.currentTarget??null,W=n.select("open"),ne=!W||Y;Y&&W?n.setOpen(!0,q(Z,V,B)):_?T.start(_,()=>{ne&&n.setOpen(!0,q(Z,V,B))}):ne&&n.setOpen(!0,q(Z,V,B))}function P(V){if(S()){I();return}E.current();const _=n.select("domReferenceElement"),N=_e(_);b.clear(),O.current=!1;const H=n.context.triggerElements;if(V.relatedTarget&&H.hasElement(V.relatedTarget))return;if($.current&&o.current.floatingContext){n.select("open")||T.clear();const B=f.current;w.current=$.current({...o.current.floatingContext,tree:u,x:V.clientX,y:V.clientY,onClose(){I(),L(),!S()&&B===n.select("domReferenceElement")&&h(V,!0)}});const W=w.current;W(V),N.addEventListener("mousemove",W),E.current=()=>{N.removeEventListener("mousemove",W)};return}(g.current!=="touch"||!le(n.select("floatingElement"),V.relatedTarget))&&h(V)}function j(V){D(V)}return n.select("open")&&M.addEventListener("mouseleave",j),c&&M.addEventListener("mousemove",v,{once:!0}),M.addEventListener("mouseenter",v),M.addEventListener("mouseleave",P),()=>{M.removeEventListener("mouseleave",j),c&&M.removeEventListener("mousemove",v),M.removeEventListener("mouseenter",v),M.removeEventListener("mouseleave",P)}},[L,I,y,o,A,h,n,s,$,D,p,S,l,c,g,F,b,O,T,f,u,E,w]),x.useMemo(()=>{function M(v){g.current=v.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(v){const{nativeEvent:P}=v,j=v.currentTarget,V=n.select("domReferenceElement"),_=n.context.triggerElements,N=n.select("open"),H=(_.hasElement(v.target)||_.hasMatchingElement(B=>le(B,v.target)))&&(!V||!le(V,v.target));if(l&&!Ce(g.current)||N&&!H||tt(F.current)===0||!H&&O.current&&v.movementX**2+v.movementY**2<2)return;b.clear();function Y(){if(O.current=!1,S())return;const B=n.select("open");!y.current&&(!B||H)&&n.setOpen(!0,q(Z,P,j))}g.current==="touch"?Ie.flushSync(()=>{Y()}):H&&N?Y():(O.current=!0,b.start(tt(F.current),Y))}}},[y,S,l,n,g,F,b,O])}function Kt(e,t){const[n,o]=e;let r=!1;const s=t.length;for(let i=0,a=s-1;i<s;a=i++){const[l,d]=t[i]||[0,0],[c,f]=t[a]||[0,0];d>=o!=f>=o&&n<=(c-l)*(o-d)/(f-d)+l&&(r=!r)}return r}function $r(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Vr(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,r=new cn;let s=!1,i=null,a=null,l=typeof performance<"u"?performance.now():0;function d(f,m){const p=performance.now(),u=p-l;if(i===null||a===null||u===0)return i=f,a=m,l=p,null;const g=f-i,R=m-a,y=Math.sqrt(g*g+R*R)/u;return i=f,a=m,l=p,y}const c=({x:f,y:m,placement:p,elements:u,onClose:g,nodeId:R,tree:w})=>function(C){function E(){r.clear(),g()}if(r.clear(),!u.domReference||!u.floating||p==null||f==null||m==null)return;const{clientX:O,clientY:T}=C,b=[O,T],k=sn(C),$=C.type==="mouseleave",A=le(u.floating,k),F=le(u.domReference,k),S=u.domReference.getBoundingClientRect(),h=u.floating.getBoundingClientRect(),L=p.split("-")[0],I=f>h.right-h.width/2,D=m>h.bottom-h.height/2,M=$r(b,S),v=h.width>S.width,P=h.height>S.height,j=(v?S:h).left,V=(v?S:h).right,_=(P?S:h).top,N=(P?S:h).bottom;if(A&&(s=!0,!$))return;if(F&&(s=!1),F&&!$){s=!0;return}if($&&z(C.relatedTarget)&&le(u.floating,C.relatedTarget)||w&&lo(w.nodesRef.current,R).some(({context:B})=>B?.open))return;if(L==="top"&&m>=S.bottom-1||L==="bottom"&&m<=S.top+1||L==="left"&&f>=S.right-1||L==="right"&&f<=S.left+1)return E();let H=[];switch(L){case"top":H=[[j,S.top+1],[j,h.bottom-1],[V,h.bottom-1],[V,S.top+1]];break;case"bottom":H=[[j,h.top+1],[j,S.bottom-1],[V,S.bottom-1],[V,h.top+1]];break;case"left":H=[[h.right-1,N],[h.right-1,_],[S.left+1,_],[S.left+1,N]];break;case"right":H=[[S.right-1,N],[S.right-1,_],[h.left+1,_],[h.left+1,N]];break}function Y([B,W]){switch(L){case"top":{const ne=[v?B+t/2:I?B+t*4:B-t*4,W+t+1],se=[v?B-t/2:I?B+t*4:B-t*4,W+t+1],oe=[[h.left,I||v?h.bottom-t:h.top],[h.right,I?v?h.bottom-t:h.top:h.bottom-t]];return[ne,se,...oe]}case"bottom":{const ne=[v?B+t/2:I?B+t*4:B-t*4,W-t],se=[v?B-t/2:I?B+t*4:B-t*4,W-t],oe=[[h.left,I||v?h.top+t:h.bottom],[h.right,I?v?h.top+t:h.bottom:h.top+t]];return[ne,se,...oe]}case"left":{const ne=[B+t+1,P?W+t/2:D?W+t*4:W-t*4],se=[B+t+1,P?W-t/2:D?W+t*4:W-t*4];return[...[[D||P?h.right-t:h.left,h.top],[D?P?h.right-t:h.left:h.right-t,h.bottom]],ne,se]}case"right":{const ne=[B-t,P?W+t/2:D?W+t*4:W-t*4],se=[B-t,P?W-t/2:D?W+t*4:W-t*4],oe=[[D||P?h.left+t:h.right,h.top],[D?P?h.left+t:h.right:h.left+t,h.bottom]];return[ne,se,...oe]}default:return[]}}if(!Kt([O,T],H)){if(s&&!M)return E();if(!$&&o){const B=d(C.clientX,C.clientY);if(B!==null&&B<.1)return E()}Kt([O,T],Y([f,m]))?!s&&o&&r.start(40,E):E()}};return c.__options={blockPointerEvents:n},c}const _r=x.createContext(void 0);function Wr(){return x.useContext(_r)?.direction??"ltr"}const jr=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:d,padding:c=0,offsetParent:f="real"}=ue(e,t)||{};if(d==null)return{};const m=dn(c),p={x:n,y:o},u=ht(r),g=mt(u),R=await i.getDimensions(d),w=u==="y",y=w?"top":"left",C=w?"bottom":"right",E=w?"clientHeight":"clientWidth",O=s.reference[g]+s.reference[u]-p[u]-s.floating[g],T=p[u]-s.reference[u],b=f==="real"?await i.getOffsetParent?.(d):a.floating;let k=a.floating[E]||s.floating[g];(!k||!await i.isElement?.(b))&&(k=a.floating[E]||s.floating[g]);const $=O/2-T/2,A=k/2-R[g]/2-1,F=Math.min(m[y],A),S=Math.min(m[C],A),h=F,L=k-R[g]-S,I=k/2-R[g]/2+$,D=st(h,I,L),M=!l.arrow&&me(r)!=null&&I!==D&&s.reference[g]/2-(I<h?F:S)-R[g]/2<0,v=M?I<h?I-h:I-L:0;return{[u]:p[u]+v,data:{[u]:D,centerOffset:I-D-v,...M&&{alignmentOffset:v}},reset:M}}}),Nr=(e,t)=>({...jr(e),options:[e,t]}),Yr={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0;return{data:{referenceHidden:(await Pr().fn(e)).data?.referenceHidden||s}}}},$e={sideX:"left",sideY:"top"},Xr={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:a}=e,l=ge(r),d=l.getComputedStyle(r);if(!(d.transitionDuration!=="0s"&&d.transitionDuration!==""))return{x:t,y:n,data:$e};const f=await s.getOffsetParent?.(r);let m={width:0,height:0};if(i==="fixed"&&l?.visualViewport)m={width:l.visualViewport.width,height:l.visualViewport.height};else if(f===l){const y=ln(r);m={width:y.documentElement.clientWidth,height:y.documentElement.clientHeight}}else await s.isElement?.(f)&&(m=await s.getDimensions(f));const p=K(a);let u=t,g=n;p==="left"&&(u=m.width-(t+o.width)),p==="top"&&(g=m.height-(n+o.height));const R=p==="left"?"right":$e.sideX,w=p==="top"?"bottom":$e.sideY;return{x:u,y:g,data:{sideX:R,sideY:w}}}};function wn(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function Jt(e,t,n){const{rects:o,placement:r}=e;return{side:wn(t,K(r),n),align:me(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function zr(e){const{anchor:t,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:l=5,sticky:d=!1,arrowPadding:c=5,disableAnchorTracking:f=!1,keepMounted:m=!1,floatingRootContext:p,mounted:u,collisionAvoidance:g,shiftCrossAxis:R=!1,nodeId:w,adaptiveOrigin:y,lazyFlip:C=!1,externalTree:E}=e,[O,T]=x.useState(null);!u&&O!==null&&T(null);const b=g.side||"flip",k=g.align||"flip",$=g.fallbackAxisSide||"end",A=typeof t=="function"?t:void 0,F=ee(A),S=A?F:t,h=we(t),I=Wr()==="rtl",D=O||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[o],M=s==="center"?D:`${D}-${s}`;let v=l;const P=1,j=o==="bottom"?P:0,V=o==="top"?P:0,_=o==="right"?P:0,N=o==="left"?P:0;typeof v=="number"?v={top:v+j,right:v+N,bottom:v+V,left:v+_}:v&&(v={top:(v.top||0)+j,right:(v.right||0)+N,bottom:(v.bottom||0)+V,left:(v.left||0)+_});const H={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:v},Y=x.useRef(null),B=we(r),W=we(i),oe=[Er(X=>{const G=Jt(X,o,I),ie=typeof B.current=="function"?B.current(G):B.current,Q=typeof W.current=="function"?W.current(G):W.current;return{mainAxis:ie,crossAxis:Q,alignmentAxis:Q}},[typeof r!="function"?r:0,typeof i!="function"?i:0,I,o])],vt=k==="none"&&b!=="shift",Rt=!vt&&(d||R||b==="shift"),bt=b==="none"?null:Tr({...H,padding:{top:v.top+P,right:v.right+P,bottom:v.bottom+P,left:v.left+P},mainAxis:!R&&b==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:$}),wt=vt?null:Cr(X=>{const G=ln(X.elements.floating).documentElement;return{...H,rootBoundary:R?{x:0,y:0,width:G.clientWidth,height:G.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:Rt,limiter:d||R?void 0:Or(ie=>{if(!Y.current)return{};const{width:Q,height:ve}=Y.current.getBoundingClientRect(),Re=te(K(ie.placement)),De=Re==="y"?Q:ve,Ke=Re==="y"?v.left+v.right:v.top+v.bottom;return{offset:De/2+Ke/2}})}},[H,d,R,v,k]);b==="shift"||k==="shift"||s==="center"?oe.push(wt,bt):oe.push(bt,wt),oe.push(Sr({...H,apply({elements:{floating:X},rects:{reference:G},availableWidth:ie,availableHeight:Q}){Object.entries({"--available-width":`${ie}px`,"--available-height":`${Q}px`,"--anchor-width":`${G.width}px`,"--anchor-height":`${G.height}px`}).forEach(([ve,Re])=>{X.style.setProperty(ve,Re)})}}),Nr(()=>({element:Y.current||document.createElement("div"),padding:c,offsetParent:"floating"}),[c]),{name:"transformOrigin",fn(X){const{elements:G,middlewareData:ie,placement:Q,rects:ve,y:Re}=X,De=K(Q),Ke=te(De),Ht=Y.current,Sn=ie.arrow?.x||0,Pn=ie.arrow?.y||0,An=Ht?.clientWidth||0,Mn=Ht?.clientHeight||0,Je=Sn+An/2,Bt=Pn+Mn/2,In=Math.abs(ie.shift?.y||0),kn=ve.reference.height/2,Ae=typeof r=="function"?r(Jt(X,o,I)):r,Ln=In>Ae,Fn={top:`${Je}px calc(100% + ${Ae}px)`,bottom:`${Je}px ${-Ae}px`,left:`calc(100% + ${Ae}px) ${Bt}px`,right:`${-Ae}px ${Bt}px`}[De],Dn=`${Je}px ${ve.reference.y+kn-Re}px`;return G.floating.style.setProperty("--transform-origin",Rt&&Ke==="y"&&Ln?Dn:Fn),{}}},Yr,y),ae(()=>{!u&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[u,p]);const Ge=x.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:xe,elements:Te,x:Et,y:Ct,middlewareData:ye,update:Le,placement:Ot,context:Tt,isPositioned:Se,floatingStyles:St}=Mr({rootContext:p,placement:M,middleware:oe,strategy:n,whileElementsMounted:m?void 0:(...X)=>Gt(...X,Ge),nodeId:w,externalTree:E}),{sideX:Pt,sideY:At}=ye.adaptiveOrigin||$e,qe=Se?n:"fixed",Mt=x.useMemo(()=>y?{position:qe,[Pt]:Et,[At]:Ct}:{position:qe,...St},[y,qe,Pt,Et,At,Ct,St]),Fe=x.useRef(null);ae(()=>{if(!u)return;const X=h.current,G=typeof X=="function"?X():X,Q=(Qt(G)?G.current:G)||null||null;Q!==Fe.current&&(xe.setPositionReference(Q),Fe.current=Q)},[u,xe,S,h]),x.useEffect(()=>{if(!u)return;const X=h.current;typeof X!="function"&&Qt(X)&&X.current!==Fe.current&&(xe.setPositionReference(X.current),Fe.current=X.current)},[u,xe,S,h]),x.useEffect(()=>{if(m&&u&&Te.domReference&&Te.floating)return Gt(Te.domReference,Te.floating,Le,Ge)},[m,u,Te,Le,Ge]);const Pe=K(Ot),It=wn(o,Pe,I),kt=me(Ot)||"center",Lt=!!ye.hide?.referenceHidden;ae(()=>{C&&u&&Se&&T(Pe)},[C,u,Se,Pe]);const Ft=x.useMemo(()=>({position:"absolute",top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Dt=ye.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Mt,arrowStyles:Ft,arrowRef:Y,arrowUncentered:Dt,side:It,align:kt,physicalSide:Pe,anchorHidden:Lt,refs:xe,context:Tt,isPositioned:Se,update:Le}),[Mt,Ft,Y,Dt,It,kt,Pe,Lt,xe,Tt,Se,Le])}function Qt(e){return e!=null&&"current"in e}const Ur=x.createContext(void 0);function Gr(e){return x.useContext(Ur)}function En(e){return e==="starting"?Nn:tn}const Cn=x.createContext(void 0);function ke(e){const t=x.useContext(Cn);if(t===void 0&&!e)throw new Error(ze(47));return t}function qr(){return{...uo(),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 Kr={...fo,disabled:re(e=>e.disabled),instantType:re(e=>e.instantType),openMethod:re(e=>e.openMethod),openChangeReason:re(e=>e.openChangeReason),modal:re(e=>e.modal),stickIfOpen:re(e=>e.stickIfOpen),titleElementId:re(e=>e.titleElementId),descriptionElementId:re(e=>e.descriptionElementId),openOnHover:re(e=>e.openOnHover),closeDelay:re(e=>e.closeDelay),hasViewport:re(e=>e.hasViewport)};class yt extends ao{constructor(t){const n={...qr(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new cn,triggerElements:new an},Kr)}setOpen=(t,n)=>{const o=n.reason===Z,r=n.reason===be&&n.event.detail===0,s=!t&&(n.reason===Yn||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",i);const l=()=>{const d={open:t,openChangeReason:n.reason},c=n.trigger?.id??null;(c||t)&&(d.activeTriggerId=c,d.activeTriggerElement=n.trigger??null),this.update(d)};o?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Xn,()=>{this.set("stickIfOpen",!1)}),Ie.flushSync(l)):l(),r||s?this.set("instantType",r?"click":"dismiss"):n.reason===rt?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const o=rn(()=>new yt(n)).current,r=t??o;return zn(o.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function Zt({props:e}){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,modal:i=!1,handle:a,triggerId:l,defaultTriggerId:d=null}=e,c=yt.useStore(a?.store,{open:n??o,modal:i,activeTriggerId:l!==void 0?l:d});c.useControlledProp("open",n,o),c.useControlledProp("activeTriggerId",l,d);const f=c.useState("open"),m=c.useState("positionerElement"),p=c.useState("payload"),u=c.useState("openChangeReason");c.useContextCallback("onOpenChange",r),c.useContextCallback("onOpenChangeComplete",s);const{openMethod:g,triggerProps:R,reset:w}=po(f);mo(c);const{forceUnmount:y}=ho(f,c,()=>{c.update({stickIfOpen:!0,openChangeReason:null}),w()});xo(f&&i===!0&&u!==Z&&g!=="touch",m),x.useEffect(()=>{f||c.context.stickIfOpenTimeout.clear()},[c,f]);const C=x.useCallback(I=>{const D=q(I);return D.preventUnmountOnClose=()=>{c.set("preventUnmountingOnClose",!0)},D},[c]),E=x.useCallback(()=>{c.setOpen(!1,C(Un))},[c,C]);x.useImperativeHandle(e.actionsRef,()=>({unmount:y,close:E}),[y,E]);const O=yo({popupStore:c,onOpenChange:c.setOpen}),T=vo(O,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),b=Ro(O),{getReferenceProps:k,getFloatingProps:$,getTriggerProps:A}=fn([T,b]),F=x.useMemo(()=>k(R),[k,R]),S=x.useMemo(()=>A(R),[A,R]),h=x.useMemo(()=>$(),[$]);c.useSyncedValues({modal:i,openMethod:g,activeTriggerProps:F,inactiveTriggerProps:S,popupProps:h,floatingRootContext:O,nested:dt()!=null});const L=x.useMemo(()=>({store:c}),[c]);return U.jsx(Cn.Provider,{value:L,children:typeof t=="function"?t({payload:p}):t})}function ss(e){return ke(!0)?U.jsx(Zt,{props:e}):U.jsx(go,{children:U.jsx(Zt,{props:e})})}const Jr=300,is=x.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,handle:a,payload:l,openOnHover:d=!1,delay:c=Jr,closeDelay:f=0,id:m,...p}=t,u=ke(!0),g=a?.store??u?.store;if(!g)throw new Error(ze(74));const R=bo(m),w=g.useState("isTriggerActive",R),y=g.useState("floatingRootContext"),C=g.useState("isOpenedByTrigger",R),E=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:T}=wo(R,E,g,{payload:l,disabled:s,openOnHover:d,closeDelay:f}),b=g.useState("openChangeReason"),k=g.useState("stickIfOpen"),$=g.useState("openMethod"),A=Br(y,{enabled:y!=null&&d&&($!=="touch"||b!==be),mouseOnly:!0,move:!1,handleClose:Vr(),restMs:c,delay:{close:f},triggerElementRef:E,isActiveTrigger:w}),F=Wo(y,{enabled:y!=null,stickIfOpen:k}),S=fn([F]),h=g.useState("triggerProps",T),L=x.useMemo(()=>({disabled:s,open:C}),[s,C]),{getButtonProps:I,buttonRef:D}=Gn({disabled:s,native:i}),M=x.useMemo(()=>({open(_){return _&&b===be?Eo.open(_):Co.open(_)}}),[b]),v=ut("button",t,{state:L,ref:[D,n,O,E],props:[S.getReferenceProps(),A,h,{[qn]:"",id:R},p,I],stateAttributesMapping:M}),P=x.useRef(null),j=ee(_=>{Ie.flushSync(()=>{g.setOpen(!1,q(rt,_.nativeEvent,_.currentTarget))}),Kn(P.current)?.focus()}),V=ee(_=>{const N=g.select("positionerElement");if(N&&Jn(_,N))g.context.beforeContentFocusGuardRef.current?.focus();else{Ie.flushSync(()=>{g.setOpen(!1,q(rt,_.nativeEvent,_.currentTarget))});let H=Qn(g.context.triggerFocusTargetRef.current||E.current);for(;H!==null&&le(N,H);){const Y=H;if(H=Zn(H),H===Y)break}H?.focus()}});return w?U.jsxs(x.Fragment,{children:[U.jsx(Vt,{ref:P,onFocus:j}),U.jsx(x.Fragment,{children:v},R),U.jsx(Vt,{ref:g.context.triggerFocusTargetRef,onFocus:V})]}):U.jsx(x.Fragment,{children:v},R)}),On=x.createContext(void 0);function Qr(){const e=x.useContext(On);if(e===void 0)throw new Error(ze(45));return e}const cs=x.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=ke();return s.useState("mounted")||o?U.jsx(On.Provider,{value:o,children:U.jsx(eo,{ref:n,...r,renderGuards:!1})}):null}),Tn=x.createContext(void 0);function Zr(){const e=x.useContext(Tn);if(!e)throw new Error(ze(46));return e}const ls=x.forwardRef(function(t,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:a="bottom",align:l="center",sideOffset:d=0,alignOffset:c=0,collisionBoundary:f="clipping-ancestors",collisionPadding:m=5,arrowPadding:p=5,sticky:u=!1,disableAnchorTracking:g=!1,collisionAvoidance:R=to,...w}=t,{store:y}=ke(),C=Qr(),E=Oo(),O=y.useState("floatingRootContext"),T=y.useState("mounted"),b=y.useState("open"),k=y.useState("openChangeReason"),$=y.useState("activeTriggerElement"),A=y.useState("modal"),F=y.useState("positionerElement"),S=y.useState("instantType"),h=y.useState("transitionStatus"),L=y.useState("hasViewport"),I=x.useRef(null),D=no(F,!1,!1),M=zr({anchor:s,floatingRootContext:O,positionMethod:i,mounted:T,side:a,sideOffset:d,align:l,alignOffset:c,arrowPadding:p,collisionBoundary:f,collisionPadding:m,sticky:u,disableAnchorTracking:g,keepMounted:C,nodeId:E,collisionAvoidance:R,adaptiveOrigin:L?Xr:void 0}),v=x.useMemo(()=>{const H={};return b||(H.pointerEvents="none"),{role:"presentation",hidden:!T,style:{...M.positionerStyles,...H}}},[b,T,M.positionerStyles]),P=x.useMemo(()=>({props:v,...M}),[v,M]),j=O?.select("domReferenceElement");ae(()=>{const H=j,Y=I.current;if(H&&(I.current=H),Y&&H&&H!==Y){y.set("instantType",void 0);const B=new AbortController;return D(()=>{y.set("instantType","trigger-change")},B.signal),()=>{B.abort()}}},[j,D,y]);const V=x.useMemo(()=>({open:b,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:S}),[b,P.side,P.align,P.anchorHidden,S]),_=x.useCallback(H=>{y.set("positionerElement",H)},[y]),N=ut("div",t,{state:V,props:[P.props,En(h),w],ref:[n,_],stateAttributesMapping:un});return U.jsxs(Tn.Provider,{value:P,children:[T&&A===!0&&k!==Z&&U.jsx(To,{ref:y.context.internalBackdropRef,inert:oo(!b),cutout:$}),U.jsx(So,{id:E,children:N})]})}),es={...un,...so},as=x.forwardRef(function(t,n){const{className:o,render:r,initialFocus:s,finalFocus:i,...a}=t,{store:l}=ke(),d=Zr(),c=Gr()!=null,f=l.useState("open"),m=l.useState("openMethod"),p=l.useState("instantType"),u=l.useState("transitionStatus"),g=l.useState("popupProps"),R=l.useState("titleElementId"),w=l.useState("descriptionElementId"),y=l.useState("modal"),C=l.useState("mounted"),E=l.useState("openChangeReason"),O=l.useState("activeTriggerElement"),T=l.useState("floatingRootContext");ro({open:f,ref:l.context.popupRef,onComplete(){f&&l.context.onOpenChangeComplete?.(!0)}});const b=l.useState("disabled"),k=l.useState("openOnHover"),$=l.useState("closeDelay");Fr(T,{enabled:k&&!b,closeDelay:$});function A(I){return I==="touch"?l.context.popupRef.current:!0}const F=s===void 0?A:s,S=x.useMemo(()=>({open:f,side:d.side,align:d.align,instant:p,transitionStatus:u}),[f,d.side,d.align,p,u]),h=x.useCallback(I=>{l.set("popupElement",I)},[l]),L=ut("div",t,{state:S,ref:[n,l.context.popupRef,h],props:[g,{"aria-labelledby":R,"aria-describedby":w,onKeyDown(I){c&&Ao.has(I.key)&&I.stopPropagation()}},En(u),a],stateAttributesMapping:es});return U.jsx(Po,{context:T,openInteractionType:m,modal:y==="trap-focus",disabled:!C||E===Z,initialFocus:F,returnFocus:i,restoreFocus:"popup",previousFocusableElement:pe(O)?O:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:L})});export{os as C,rs as L,ss as P,is as a,cs as b,ls as c,as as d,Wo as e,He as f,zr as g,Gr as h,En as i,Ar as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as v,r as l,ah as Q,ab as q,aD as L,j as t,m as A,N as f,A as s,Q as X,ao as ee,aE as te,as as ne,at as ae,au as O,aF as ie,aG as se,O as oe,R as re,K as le,M as ce,W as ue,aH as de,aI as ge,aJ as he,aK as pe,E as me,aL as be,aM as xe,aN as fe,aO as ye,aP as ve,aQ as ke,aR as je,a9 as Ne}from"./main-QElo_0bY.js";import{a as Se,b as E,u as we,L as G}from"./use-limits-display-prefs-ClE847BF.js";import{S as k,T as j,a as b,b as _,u as P}from"./use-native-settings-D20qXg2x.js";import{C as Ce}from"./check-CESu4eR-.js";import{u as Le}from"./useCurrency-CUAxzIqS.js";import{C as D}from"./chevron-down-BjIFZNid.js";import{I as Ee}from"./info-BTIZccVB.js";import{D as Ge}from"./download-C1FtauDf.js";import"./Card-BlIsxuah.js";const Ie=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ae=v("activity",Ie);const Oe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],_e=v("copy",Oe);const Pe=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],De=v("grip-vertical",Pe);const Te=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Me=v("languages",Te);const Ue=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Re=v("log-out",Ue);const Fe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],He=v("pencil",Fe),$e=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,n=new WeakMap,i=()=>e.forEach($e);return{add:a=>{e.add(a),n.set(a,a.addEventListener("willUpdate",i))},remove:a=>{e.delete(a);const o=n.get(a);o&&(o(),n.delete(a)),i()},dirty:i}}const Be=l.createContext(null);function ze(){const e=l.useRef(!1);return Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ve(){const e=ze(),[n,i]=l.useState(0),a=l.useCallback(()=>{e.current&&i(n+1)},[n]);return[l.useCallback(()=>q.postRender(a),[a]),n]}const T=e=>e===!0,Ke=e=>T(e===!0)||e==="id",We=({children:e,id:n,inherit:i=!0})=>{const a=l.useContext(L),o=l.useContext(Be),[r,c]=Ve(),u=l.useRef(null),g=a.id||o;u.current===null&&(Ke(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:T(i)&&a.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return t.jsx(L.Provider,{value:h,children:e})},Ze=new Set(["cursor","kiro","copilot","kimi"]);function Ye({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:f("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:f("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Je({prefs:e}){const{order:n,visibility:i,toggle:a,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},x=()=>{c(null),g(null)},y=d=>{d.preventDefault(),c(null),g(null)};return t.jsx(We,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const p=i[d]!==!1,N=r===d;return t.jsxs(A.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:x,onDrop:y,className:f("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[t.jsx(De,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),t.jsx("img",{src:Se[d],alt:"",width:18,height:18,className:f("h-[18px] w-[18px] shrink-0 pointer-events-none",Ze.has(d)&&"dark:invert"),draggable:!1}),t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:E[d]}),t.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:t.jsx(Ye,{checked:p,onChange:()=>a(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${E[d]}`})})]},d)})})})}function Qe(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},a=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof a=="string"&&a.trim()?a.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function qe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function Xe(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),a=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||a?.[1];return o?`https://github.com/${o}`:null}function w(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function et(e,n,i){const[a,o]=l.useState(()=>ee()),r=n&&i&&te(),c=l.useCallback(async()=>{const u=!a;if(ne(u),o(u),!!u)try{await ae(()=>e())}catch(g){w("cloud sync",g)}},[a,e]);return{cloudSyncOn:a,handleCloudSyncToggle:c,showLocalCloudSync:r}}function tt(e){const[n,i]=l.useState(!1),[a,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[x,y]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[F,C]=l.useState(""),[H,$]=l.useState(""),[B,z]=l.useState(!1),[V,K]=l.useState(null),W=l.useMemo(()=>Qe(e),[e]),Z=l.useMemo(()=>qe(e),[e]),Y=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),J=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:i,setShowGithubOn:S}),[]);return{anonymousOn:a,customDisplayName:h,displayName:W,editingGithub:B,editingName:x,email:Z,githubError:V,githubInput:H,githubUrl:F,loadSetters:J,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:z,setEditingName:y,setGithubError:K,setGithubInput:$,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:S,showGithubOn:N,userId:Y}}function nt(e,n,i){l.useEffect(()=>{if(!n)return;let a=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await O({getAccessToken:e});if(!a||!o)return;const r=await ie({accessToken:o});if(!a)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{a&&i.setProfileLoading(!1)}})(),()=>{a=!1}},[e,n,i])}function at(e,n){return l.useCallback(async(i,{label:a,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const c=await O({getAccessToken:e});if(!c)return!1;const u=await se({accessToken:c,...i});return r?.(u),!0}catch(c){return o?o(c):w(a||"mutate profile",c),!1}finally{n.setProfileSaving(!1)}},[e,n])}function it(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function st(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function ot(e,n){const i=l.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function rt(e,n,i){const a=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),i?.()}})},[n,e,i]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:a,startEditingName:o}}function lt(e,n){const i=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),a=l.useCallback(async()=>{const r=Xe(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:a,handleShowGithubToggle:i,startEditingGithub:o}}function ct(){const e=X(),n=tt(e.user),i=et(e.getAccessToken,e.enabled,e.signedIn);nt(e.getAccessToken,e.signedIn,n.loadSetters);const a=at(e.getAccessToken,n),o=ot(n,a),r=rt(n,a,e.refreshDisplayName),c=lt(n,a);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:it(n,{...o,...r}),github:st(n,c),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function M({disabled:e,onCancel:n,onSave:i,saveLabel:a=s("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:a}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function ut({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:a,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),t.jsx(M,{disabled:a||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:a?s("settings.account.saving"):void 0})]})}function dt({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:a,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),t.jsx(M,{disabled:a,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:a?s("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function U({disabled:e=!1,label:n,onClick:i,title:a}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:a,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(He,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function R({actions:e,editing:n,editor:i,hint:a,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),n?null:e]})})}function gt({name:e}){const n=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(U,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function ht({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:a,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:x,startEditingName:y}=e,d=n?s("settings.account.displayNameAnonymousHint"):i||a;return t.jsx(R,{label:s("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(ut,{nameInput:u,setEditingName:m,setNameInput:x,profileSaving:h,handleSaveName:c}),actions:t.jsx(gt,{name:e})})}function pt({github:e}){const{editingGithub:n,githubError:i,githubInput:a,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x,showGithubOn:y,startEditingGithub:d}=e;return t.jsx(R,{label:s("settings.account.githubUrl"),editing:n,hint:o||s("settings.account.githubUrlHint"),editor:t.jsx(dt,{githubError:i,githubInput:a,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(U,{label:s("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function mt(){const{openLoginModal:e}=oe();return t.jsx(k,{title:s("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function bt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(ht,{name:e}),t.jsx(pt,{github:n})]})}function xt(){const e=ct();return e.enabled?e.signedIn?t.jsxs(k,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(yt,{onSignOut:e.signOut}),children:[t.jsx(ft,{userId:e.userId}),t.jsx(vt,{settings:e}),t.jsx(kt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(jt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(mt,{}):null}function ft({userId:e}){const[n,i]=re.useState(!1);if(!e)return null;const a=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[n?t.jsx(Ce,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?s("settings.account.copied"):s("settings.account.copy")]})]})}function yt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function vt({settings:e}){return e.showLocalCloudSync?t.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function kt({checked:e,disabled:n,onChange:i}){return t.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:s("settings.account.publicProfile")})})}function jt({visible:e,name:n,github:i}){return t.jsx(le,{initial:!1,children:e?t.jsx(A.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(bt,{name:n,github:i})},"public-profile-fields"):null})}function Nt(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:de},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ge},{value:"system",label:s("settings.appearance.theme.system"),Icon:he}]}function St(){return[{value:be,label:s("settings.appearance.language.system")},{value:xe,label:s("settings.appearance.language.english")},{value:fe,label:s("settings.appearance.language.chinese")},{value:ye,label:s("settings.appearance.language.traditional_chinese")},{value:ve,label:s("settings.appearance.language.japanese")},{value:ke,label:s("settings.appearance.language.korean")}]}function wt(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Ct(e,n){const i=s(`settings.appearance.currency.rate_source.${e}`),a=wt(n),o=a?s("settings.appearance.currency.rate_updated",{when:a}):s("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Lt({locale:e,setLocale:n}){const i=St();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx(Me,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.language.label"),className:f("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-8 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 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:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))}),t.jsx(D,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Et({currency:e,setCurrency:n}){const i=pe();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.currency.label"),className:f("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-3 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 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:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.code,children:s(a.labelKey)},a.code))}),t.jsx(D,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Gt({currency:e,rate:n,rateSource:i,rateFetchedAt:a}){if(e===me)return t.jsx(t.Fragment,{children:s("settings.appearance.currency.hint")});const o=Ct(i,a);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function It(){const{theme:e,setTheme:n}=ce(),{locale:i,setLocale:a}=ue(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Le();return t.jsxs(k,{title:s("settings.section.appearance"),children:[t.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:t.jsx(_,{options:Nt(),value:e,onChange:n})}),t.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:t.jsx(Lt,{locale:i,setLocale:a})}),t.jsx(b,{label:s("settings.appearance.currency.label"),hint:t.jsx(Gt,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:t.jsx(Et,{currency:o,setCurrency:g})})]})}function At(){const{available:e,settings:n,setSetting:i,runAction:a}=P();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,c=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(k,{title:s("settings.section.menubar"),children:[r?t.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,t.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>a("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(je,{className:f("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),t.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:t.jsxs("button",{type:"button",onClick:()=>a("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Ot(){const{available:e,settings:n,runAction:i}=P(),a=e&&n?.version;return t.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[a?t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["TokenTrackerBar v",n.version]}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,t.jsxs("a",{href:Ne,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function _t({prefs:e}){return t.jsx(_,{options:[{value:G.USED,label:s("limits.settings.display_mode_used")},{value:G.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Bt(){const e=we();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(It,{}),t.jsx(At,{}),t.jsx(xt,{}),t.jsx(k,{title:s("settings.section.limits"),action:t.jsx(_t,{prefs:e}),children:t.jsx(Je,{prefs:e})})]}),t.jsx(Ot,{})]})})})}export{Bt as SettingsPage};
|