tokentracker-cli 0.60.2 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dashboard/dist/assets/{ActivityHeatmap-B3Q5GCKL.js → ActivityHeatmap-C81c9-Rw.js} +1 -1
  2. package/dashboard/dist/assets/{Card-C7m_x-dW.js → Card-0VRAMCWY.js} +1 -1
  3. package/dashboard/dist/assets/DashboardPage-Bu1bCvfi.js +19 -0
  4. package/dashboard/dist/assets/{DevicePage-B_zSy31A.js → DevicePage-ZTI61HqT.js} +1 -1
  5. package/dashboard/dist/assets/{DialogTitle-Dprude33.js → DialogTitle-DfyD_iOj.js} +1 -1
  6. package/dashboard/dist/assets/{FadeIn-B70xMHUD.js → FadeIn-C9Ag9Im1.js} +1 -1
  7. package/dashboard/dist/assets/{HeaderGithubStar-Dz_d3Veu.js → HeaderGithubStar-BhqiU6Gm.js} +1 -1
  8. package/dashboard/dist/assets/{IpCheckPage--FQjGxXm.js → IpCheckPage-Divpj0Fv.js} +1 -1
  9. package/dashboard/dist/assets/{LandingPage-B-t8RDCn.js → LandingPage-C7r42Z7k.js} +1 -1
  10. package/dashboard/dist/assets/{LeaderboardAvatar-CVXz36Iz.js → LeaderboardAvatar-CO-rDVdO.js} +1 -1
  11. package/dashboard/dist/assets/{LeaderboardPage-BhZsDjl0.js → LeaderboardPage-CBD82fB2.js} +3 -3
  12. package/dashboard/dist/assets/{LeaderboardProfileModal-DAqjcGRI.js → LeaderboardProfileModal-CmQzo_hb.js} +3 -3
  13. package/dashboard/dist/assets/{LeaderboardProfilePage-CkWHkweP.js → LeaderboardProfilePage-gz9GSOzF.js} +3 -3
  14. package/dashboard/dist/assets/{LimitsPage-DXyn6hkD.js → LimitsPage-B7-bsgYO.js} +2 -2
  15. package/dashboard/dist/assets/{LocalOnlyNotice-CDB66jIa.js → LocalOnlyNotice-BJgjXMgT.js} +1 -1
  16. package/dashboard/dist/assets/{LoginPage-DktOVgCy.js → LoginPage-ZwQCldH1.js} +1 -1
  17. package/dashboard/dist/assets/{PopoverPopup-CatOS4NW.js → PopoverPopup-Cj-J2VcL.js} +1 -1
  18. package/dashboard/dist/assets/{ResetPasswordPage-Cb7h0l-Q.js → ResetPasswordPage-CtPCLFIa.js} +1 -1
  19. package/dashboard/dist/assets/{Select-BiO59Iz-.js → Select-ZozPfhKZ.js} +1 -1
  20. package/dashboard/dist/assets/{SelectItemText-if3W7eDL.js → SelectItemText-CIU-BNpH.js} +1 -1
  21. package/dashboard/dist/assets/SettingsPage-Sy48S-nP.js +1 -0
  22. package/dashboard/dist/assets/{SkillsPage-CTgBETDM.js → SkillsPage-Z6X9LwNj.js} +1 -1
  23. package/dashboard/dist/assets/{WidgetsPage-1lAVZO-r.js → WidgetsPage-BFB-RbBW.js} +1 -1
  24. package/dashboard/dist/assets/{WrappedPage-C1enRwTG.js → WrappedPage-h_4VIbis.js} +1 -1
  25. package/dashboard/dist/assets/{agent-logos-DVuBynPh.js → agent-logos-KdCEpUKp.js} +1 -1
  26. package/dashboard/dist/assets/{arrow-up-right-CzNhkWHp.js → arrow-up-right-CIEWNqae.js} +1 -1
  27. package/dashboard/dist/assets/{download-BgTp-jC3.js → download-DcJ2hsdQ.js} +1 -1
  28. package/dashboard/dist/assets/{info-BE59mcIy.js → info-YUSGgHfZ.js} +1 -1
  29. package/dashboard/dist/assets/main-B-a1jSzx.css +1 -0
  30. package/dashboard/dist/assets/{main-Bko0PBW5.js → main-D8wPoKmZ.js} +25 -14
  31. package/dashboard/dist/assets/pencil-BQqxAErk.js +1 -0
  32. package/dashboard/dist/assets/{use-limits-display-prefs-R5Xj5meQ.js → use-limits-display-prefs-yv7S34by.js} +1 -1
  33. package/dashboard/dist/assets/{use-native-settings-DBQs6ZUK.js → use-native-settings-C1f8CH1M.js} +1 -1
  34. package/dashboard/dist/assets/{use-usage-limits-CP3wivgZ.js → use-usage-limits-DMUxI1VA.js} +1 -1
  35. package/dashboard/dist/assets/{useCurrency-rb01QMwI.js → useCurrency-C91tvaFI.js} +1 -1
  36. package/dashboard/dist/assets/{useScrollLock-DLYGNifa.js → useScrollLock-jO1lwpRu.js} +1 -1
  37. package/dashboard/dist/index.html +2 -2
  38. package/dashboard/dist/share.html +2 -2
  39. package/package.json +1 -1
  40. package/src/lib/opencode-go-limits.js +32 -42
  41. package/src/lib/pricing/seed-snapshot.json +1 -1
  42. package/dashboard/dist/assets/DashboardPage-Ct6CoW1Y.js +0 -19
  43. package/dashboard/dist/assets/SettingsPage-CAP7uK2t.js +0 -1
  44. package/dashboard/dist/assets/main-x6DwHW58.css +0 -1
@@ -1 +1 @@
1
- import{c as Vr,bL as kr,r as l,c4 as Nt,bz as vt,bF as qn,c5 as Hr,b9 as zt,b as _e,bB as Ae,c6 as it,c7 as rn,b$ as nt,c8 as rt,ba as Be,c9 as un,ca as Ct,cb as _t,cc as Nr,cd as Kn,ce as _r,cf as fn,cg as dn,ch as jt,ci as En,cj as Xn,ar as Br,ck as Wr,b5 as Tt,b3 as J,cl as Gn,cm as Ur,bA as ue,cn as Cn,co as Jt,cp as Tn,cq as Qt,bC as ot,bI as at,cr as An,cs as Mt,bO as Jn,ct as Yt,cu as qt,cv as Qn,cw as pn,cx as $r,cy as zr,cz as on,cA as jr,a as gt,cB as Yr,b4 as It,b6 as Le,j as Ie,bP as oe,b2 as z,be as gn,b8 as sn,b7 as qr,bb as Kr,bc as Xr,bd as mn,cC as Gr,cD as Jr,cE as Qr,u as Zn,cF as Zr,bX as eo,cG as to,b_ as no,cH as ro,bE as oo,cI as so,bf as er,cJ as Zt}from"./main-Bko0PBW5.js";import{i as In,c as tr,A as io,P as co,b as nr,d as Ye,B as lo,D as et,E as rr,G as ao,z as or,u as uo,a as sr,m as fo,n as po,H as go,q as mo,J as ho,I as xo,x as yo,y as wo}from"./useScrollLock-DLYGNifa.js";const bo=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ei=Vr("chevron-down",bo),Ro=["top","right","bottom","left"],wt=Math.min,Ne=Math.max,Bt=Math.round,Ot=Math.floor,Ge=e=>({x:e,y:e}),So={left:"right",right:"left",bottom:"top",top:"bottom"};function cn(e,t,n){return Ne(e,wt(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function ut(e){return e.split("-")[1]}function hn(e){return e==="x"?"y":"x"}function xn(e){return e==="y"?"height":"width"}function je(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yn(e){return hn(je(e))}function vo(e,t,n){n===void 0&&(n=!1);const r=ut(e),o=yn(e),s=xn(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wt(i)),[i,Wt(i)]}function Eo(e){const t=Wt(e);return[ln(e),t,ln(t)]}function ln(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Mn=["left","right"],On=["right","left"],Co=["top","bottom"],To=["bottom","top"];function Ao(e,t,n){switch(e){case"top":case"bottom":return n?t?On:Mn:t?Mn:On;case"left":case"right":return t?Co:To;default:return[]}}function Io(e,t,n,r){const o=ut(e);let s=Ao(Ve(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ln)))),s}function Wt(e){const t=Ve(e);return So[t]+e.slice(t.length)}function Mo(e){return{top:0,right:0,bottom:0,left:0,...e}}function ir(e){return typeof e!="number"?Mo(e):{top:e,right:e,bottom:e,left:e}}function At(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function bt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function Oo(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:c=0,reason:a=kr}=t,f="rootStore"in e?e.rootStore:e,g=f.context.dataRef,u=l.useRef(void 0),d=Nt(),p=vt(),m=l.useMemo(()=>{function y(h,R,x,w){const S=_e(a,R,x);h&&w==="touch"&&c>0?p.start(c,()=>{f.setOpen(!0,S)}):f.setOpen(h,S)}function b(h,R,x){const w=g.current.openEvent,S=f.select("domReferenceElement")!==R;return h&&S||!h||!o?!0:w&&i?!x(w.type):!1}return{onPointerDown(h){u.current=h.pointerType},onMouseDown(h){const R=u.current,x=h.nativeEvent,w=f.select("open");if(h.button!==0||r==="click"||In(R,!0)&&s)return;const S=b(w,h.currentTarget,T=>T==="click"||T==="mousedown"),C=qn(x);if(Hr(C)){y(S,x,C,R);return}const P=h.currentTarget;d.request(()=>{y(S,x,P,R)})},onClick(h){if(r==="mousedown-only")return;const R=u.current;if(r==="mousedown"&&R){u.current=void 0;return}if(In(R,!0)&&s)return;const x=f.select("open"),w=b(x,h.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");y(w,h.nativeEvent,h.currentTarget,R)},onKeyDown(){u.current=void 0}}},[g,r,s,a,f,i,o,d,p,c]);return l.useMemo(()=>n?{reference:m}:zt,[n,m])}function Pn(e,t,n){let{reference:r,floating:o}=e;const s=je(t),i=yn(t),c=xn(i),a=Ve(t),f=s==="y",g=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:g,y:r.y-o.height};break;case"bottom":p={x:g,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(ut(t)){case"start":p[i]-=d*(n&&f?-1:1);break;case"end":p[i]+=d*(n&&f?-1:1);break}return p}async function Po(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=st(t,e),m=ir(p),b=c[d?u==="floating"?"reference":"floating":u],h=At(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:g,strategy:a})),R=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),w=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},S=At(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:R,offsetParent:x,strategy:a}):R);return{top:(h.top-S.top+m.top)/w.y,bottom:(S.bottom-h.bottom+m.bottom)/w.y,left:(h.left-S.left+m.left)/w.x,right:(S.right-h.right+m.right)/w.x}}const Do=50,Lo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Po},a=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:u}=Pn(f,r,a),d=r,p=0;const m={};for(let y=0;y<s.length;y++){const b=s[y];if(!b)continue;const{name:h,fn:R}=b,{x,y:w,data:S,reset:C}=await R({x:g,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:f,platform:c,elements:{reference:e,floating:t}});g=x??g,u=w??u,m[h]={...m[h],...S},C&&p<Do&&(p++,typeof C=="object"&&(C.placement&&(d=C.placement),C.rects&&(f=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:g,y:u}=Pn(f,d,a)),y=-1)}return{x:g,y:u,placement:d,strategy:o,middlewareData:m}},Fo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:f}=t,{mainAxis:g=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...b}=st(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const h=Ve(o),R=je(c),x=Ve(c)===c,w=await(a.isRTL==null?void 0:a.isRTL(f.floating)),S=d||(x||!y?[Wt(c)]:Eo(c)),C=m!=="none";!d&&C&&S.push(...Io(c,y,m,w));const P=[c,...S],T=await a.detectOverflow(t,b),L=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(g&&L.push(T[h]),u){const I=vo(o,i,w);L.push(T[I[0]],T[I[1]])}if(_=[..._,{placement:o,overflows:L}],!L.every(I=>I<=0)){var X,B;const I=(((X=s.flip)==null?void 0:X.index)||0)+1,H=P[I];if(H&&(!(u==="alignment"?R!==je(H):!1)||_.every(E=>je(E.placement)===R?E.overflows[0]>0:!0)))return{data:{index:I,overflows:_},reset:{placement:H}};let Y=(B=_.filter(F=>F.overflows[0]<=0).sort((F,E)=>F.overflows[1]-E.overflows[1])[0])==null?void 0:B.placement;if(!Y)switch(p){case"bestFit":{var k;const F=(k=_.filter(E=>{if(C){const W=je(E.placement);return W===R||W==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(W=>W>0).reduce((W,A)=>W+A,0)]).sort((E,W)=>E[1]-W[1])[0])==null?void 0:k[0];F&&(Y=F);break}case"initialPlacement":Y=c;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};function Dn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ln(e){return Ro.some(t=>e[t]>=0)}const Vo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=st(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=Dn(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ln(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=Dn(i,n.floating);return{data:{escapedOffsets:c,escaped:Ln(c)}}}default:return{}}}}},cr=new Set(["left","top"]);async function ko(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ve(n),c=ut(n),a=je(n)==="y",f=cr.has(i)?-1:1,g=s&&a?-1:1,u=st(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),a?{x:p*g,y:d*f}:{x:d*f,y:p*g}}const Ho=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await ko(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},No=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:h=>{let{x:R,y:x}=h;return{x:R,y:x}}},...f}=st(e,t),g={x:n,y:r},u=await s.detectOverflow(t,f),d=je(Ve(o)),p=hn(d);let m=g[p],y=g[d];if(i){const h=p==="y"?"top":"left",R=p==="y"?"bottom":"right",x=m+u[h],w=m-u[R];m=cn(x,m,w)}if(c){const h=d==="y"?"top":"left",R=d==="y"?"bottom":"right",x=y+u[h],w=y-u[R];y=cn(x,y,w)}const b=a.fn({...t,[p]:m,[d]:y});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[p]:i,[d]:c}}}}}},_o=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:a=!0,crossAxis:f=!0}=st(e,t),g={x:n,y:r},u=je(o),d=hn(u);let p=g[d],m=g[u];const y=st(c,t),b=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(a){const x=d==="y"?"height":"width",w=s.reference[d]-s.floating[x]+b.mainAxis,S=s.reference[d]+s.reference[x]-b.mainAxis;p<w?p=w:p>S&&(p=S)}if(f){var h,R;const x=d==="y"?"width":"height",w=cr.has(Ve(o)),S=s.reference[u]-s.floating[x]+(w&&((h=i.offset)==null?void 0:h[u])||0)+(w?0:b.crossAxis),C=s.reference[u]+s.reference[x]+(w?0:((R=i.offset)==null?void 0:R[u])||0)-(w?b.crossAxis:0);m<S?m=S:m>C&&(m=C)}return{[d]:p,[u]:m}}}},Bo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...f}=st(e,t),g=await i.detectOverflow(t,f),u=Ve(o),d=ut(o),p=je(o)==="y",{width:m,height:y}=s.floating;let b,h;u==="top"||u==="bottom"?(b=u,h=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(h=u,b=d==="end"?"top":"bottom");const R=y-g.top-g.bottom,x=m-g.left-g.right,w=wt(y-g[b],R),S=wt(m-g[h],x),C=!t.middlewareData.shift;let P=w,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=R),C&&!d){const _=Ne(g.left,0),X=Ne(g.right,0),B=Ne(g.top,0),k=Ne(g.bottom,0);p?T=m-2*(_!==0||X!==0?_+X:Ne(g.left,g.right)):P=y-2*(B!==0||k!==0?B+k:Ne(g.top,g.bottom))}await a({...t,availableWidth:T,availableHeight:P});const L=await i.getDimensions(c.floating);return m!==L.width||y!==L.height?{reset:{rects:!0}}:{}}}};function lr(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Bt(n)!==s||Bt(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function wn(e){return Ae(e)?e:e.contextElement}function yt(e){const t=wn(e);if(!nt(t))return Ge(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=lr(t);let i=(s?Bt(n.width):n.width)/r,c=(s?Bt(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Wo=Ge(0);function ar(e){const t=Be(e);return!Xn()||!t.visualViewport?Wo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Be(e)?!1:t}function dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wn(e);let i=Ge(1);t&&(r?Ae(r)&&(i=yt(r)):i=yt(e));const c=Uo(s,n,r)?ar(s):Ge(0);let a=(o.left+c.x)/i.x,f=(o.top+c.y)/i.y,g=o.width/i.x,u=o.height/i.y;if(s){const d=Be(s),p=r&&Ae(r)?Be(r):r;let m=d,y=En(m);for(;y&&r&&p!==m;){const b=yt(y),h=y.getBoundingClientRect(),R=rt(y),x=h.left+(y.clientLeft+parseFloat(R.paddingLeft))*b.x,w=h.top+(y.clientTop+parseFloat(R.paddingTop))*b.y;a*=b.x,f*=b.y,g*=b.x,u*=b.y,a+=x,f+=w,m=Be(y),y=En(m)}}return At({width:g,height:u,x:a,y:f})}function Kt(e,t){const n=jt(e).scrollLeft;return t?t.left+n:dt(it(e)).left+n}function ur(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Kt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function $o(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=it(r),c=t?un(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},f=Ge(1);const g=Ge(0),u=nt(r);if((u||!u&&!s)&&((fn(r)!=="body"||dn(i))&&(a=jt(r)),u)){const p=dt(r);f=yt(r),g.x=p.x+r.clientLeft,g.y=p.y+r.clientTop}const d=i&&!u&&!s?ur(i,a):Ge(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+g.x+d.x,y:n.y*f.y-a.scrollTop*f.y+g.y+d.y}}function zo(e){return Array.from(e.getClientRects())}function jo(e){const t=it(e),n=jt(e),r=e.ownerDocument.body,o=Ne(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ne(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Kt(e);const c=-n.scrollTop;return rt(r).direction==="rtl"&&(i+=Ne(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Fn=25;function Yo(e,t){const n=Be(e),r=it(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const g=Xn();(!g||g&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const f=Kt(r);if(f<=0){const g=r.ownerDocument,u=g.body,d=getComputedStyle(u),p=g.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-u.clientWidth-p);m<=Fn&&(s-=m)}else f<=Fn&&(s+=f);return{width:s,height:i,x:c,y:a}}function qo(e,t){const n=dt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=nt(e)?yt(e):Ge(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,f=r*s.y;return{width:i,height:c,x:a,y:f}}function Vn(e,t,n){let r;if(t==="viewport")r=Yo(e,n);else if(t==="document")r=jo(it(e));else if(Ae(t))r=qo(t,n);else{const o=ar(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return At(r)}function fr(e,t){const n=Ct(e);return n===t||!Ae(n)||_t(n)?!1:rt(n).position==="fixed"||fr(n,t)}function Ko(e,t){const n=t.get(e);if(n)return n;let r=rn(e,[],!1).filter(c=>Ae(c)&&fn(c)!=="body"),o=null;const s=rt(e).position==="fixed";let i=s?Ct(e):e;for(;Ae(i)&&!_t(i);){const c=rt(i),a=Kn(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||dn(i)&&!a&&fr(e,i))?r=r.filter(g=>g!==i):o=c,i=Ct(i)}return t.set(e,r),r}function Xo(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?un(t)?[]:Ko(t,this._c):[].concat(n),r],c=Vn(t,i[0],o);let a=c.top,f=c.right,g=c.bottom,u=c.left;for(let d=1;d<i.length;d++){const p=Vn(t,i[d],o);a=Ne(p.top,a),f=wt(p.right,f),g=wt(p.bottom,g),u=Ne(p.left,u)}return{width:f-u,height:g-a,x:u,y:a}}function Go(e){const{width:t,height:n}=lr(e);return{width:t,height:n}}function Jo(e,t,n){const r=nt(t),o=it(t),s=n==="fixed",i=dt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ge(0);function f(){a.x=Kt(o)}if(r||!r&&!s)if((fn(t)!=="body"||dn(o))&&(c=jt(t)),r){const p=dt(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&f();s&&!r&&o&&f();const g=o&&!r&&!s?ur(o,c):Ge(0),u=i.left+c.scrollLeft-a.x-g.x,d=i.top+c.scrollTop-a.y-g.y;return{x:u,y:d,width:i.width,height:i.height}}function en(e){return rt(e).position==="static"}function kn(e,t){if(!nt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return it(e)===n&&(n=n.ownerDocument.body),n}function dr(e,t){const n=Be(e);if(un(e))return n;if(!nt(e)){let o=Ct(e);for(;o&&!_t(o);){if(Ae(o)&&!en(o))return o;o=Ct(o)}return n}let r=kn(e,t);for(;r&&Nr(r)&&en(r);)r=kn(r,t);return r&&_t(r)&&en(r)&&!Kn(r)?n:r||_r(e)||n}const Qo=async function(e){const t=this.getOffsetParent||dr,n=this.getDimensions,r=await n(e.floating);return{reference:Jo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zo(e){return rt(e).direction==="rtl"}const pr={convertOffsetParentRelativeRectToViewportRelativeRect:$o,getDocumentElement:it,getClippingRect:Xo,getOffsetParent:dr,getElementRects:Qo,getClientRects:zo,getDimensions:Go,getScale:yt,isElement:Ae,isRTL:Zo};function gr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function es(e,t){let n=null,r;const o=it(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const f=e.getBoundingClientRect(),{left:g,top:u,width:d,height:p}=f;if(c||t(),!d||!p)return;const m=Ot(u),y=Ot(o.clientWidth-(g+d)),b=Ot(o.clientHeight-(u+p)),h=Ot(g),x={rootMargin:-m+"px "+-y+"px "+-b+"px "+-h+"px",threshold:Ne(0,wt(1,a))||1};let w=!0;function S(C){const P=C[0].intersectionRatio;if(P!==a){if(!w)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!gr(f,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return i(!0),s}function Hn(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,f=wn(e),g=o||s?[...f?rn(f):[],...t?rn(t):[]]:[];g.forEach(h=>{o&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const u=f&&c?es(f,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(h=>{let[R]=h;R&&R.target===f&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),f&&!a&&p.observe(f),t&&p.observe(t));let m,y=a?dt(e):null;a&&b();function b(){const h=dt(e);y&&!gr(y,h)&&n(),y=h,m=requestAnimationFrame(b)}return n(),()=>{var h;g.forEach(R=>{o&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),u?.(),(h=p)==null||h.disconnect(),p=null,a&&cancelAnimationFrame(m)}}const ts=Ho,ns=No,rs=Fo,os=Bo,ss=Vo,is=_o,cs=(e,t,n)=>{const r=new Map,o={platform:pr,...n},s={...o.platform,_c:r};return Lo(e,t,{...o,platform:s})};var ls=typeof document<"u",as=function(){},kt=ls?l.useLayoutEffect:as;function Ut(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ut(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ut(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Nn(e,t){const n=mr(e);return Math.round(t*n)/n}function tn(e){const t=l.useRef(e);return kt(()=>{t.current=e}),t}function us(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:f}=e,[g,u]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=l.useState(r);Ut(d,r)||p(r);const[m,y]=l.useState(null),[b,h]=l.useState(null),R=l.useCallback(E=>{E!==C.current&&(C.current=E,y(E))},[]),x=l.useCallback(E=>{E!==P.current&&(P.current=E,h(E))},[]),w=s||m,S=i||b,C=l.useRef(null),P=l.useRef(null),T=l.useRef(g),L=a!=null,_=tn(a),X=tn(o),B=tn(f),k=l.useCallback(()=>{if(!C.current||!P.current)return;const E={placement:t,strategy:n,middleware:d};X.current&&(E.platform=X.current),cs(C.current,P.current,E).then(W=>{const A={...W,isPositioned:B.current!==!1};I.current&&!Ut(T.current,A)&&(T.current=A,Br.flushSync(()=>{u(A)}))})},[d,t,n,X,B]);kt(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(E=>({...E,isPositioned:!1})))},[f]);const I=l.useRef(!1);kt(()=>(I.current=!0,()=>{I.current=!1}),[]),kt(()=>{if(w&&(C.current=w),S&&(P.current=S),w&&S){if(_.current)return _.current(w,S,k);k()}},[w,S,k,_,L]);const H=l.useMemo(()=>({reference:C,floating:P,setReference:R,setFloating:x}),[R,x]),Y=l.useMemo(()=>({reference:w,floating:S}),[w,S]),F=l.useMemo(()=>{const E={position:n,left:0,top:0};if(!Y.floating)return E;const W=Nn(Y.floating,g.x),A=Nn(Y.floating,g.y);return c?{...E,transform:"translate("+W+"px, "+A+"px)",...mr(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:A}},[n,c,Y.floating,g.x,g.y]);return l.useMemo(()=>({...g,update:k,refs:H,elements:Y,floatingStyles:F}),[g,k,H,Y,F])}const fs=(e,t)=>{const n=ts(e);return{name:n.name,fn:n.fn,options:[e,t]}},ds=(e,t)=>{const n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}},ps=(e,t)=>({fn:is(e).fn,options:[e,t]}),gs=(e,t)=>{const n=rs(e);return{name:n.name,fn:n.fn,options:[e,t]}},ms=(e,t)=>{const n=os(e);return{name:n.name,fn:n.fn,options:[e,t]}},hs=(e,t)=>{const n=ss(e);return{name:n.name,fn:n.fn,options:[e,t]}};function hr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wr(),s=tr()!=null,i=Tt(()=>new io({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new co,floatingId:o,syncOnly:!1,nested:s})).current;return J(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ae(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function xs(e={}){const{nodeId:t,externalTree:n}=e,r=hr(e),o=e.rootContext||r,s=o.useState("referenceElement"),i=o.useState("floatingElement"),c=o.useState("domReferenceElement"),a=o.useState("open"),f=o.useState("floatingId"),[g,u]=l.useState(null),[d,p]=l.useState(void 0),[m,y]=l.useState(void 0),b=l.useRef(null),h=nr(n),R=l.useMemo(()=>({reference:s,floating:i,domReference:c}),[s,i,c]),x=us({...e,elements:{...R,...g&&{reference:g}}}),w=Ae(d)?d:null,S=m===void 0?o.state.floatingElement:m;o.useSyncedValue("referenceElement",d??null),o.useSyncedValue("domReferenceElement",d===void 0?c:w),o.useSyncedValue("floatingElement",S);const C=l.useCallback(B=>{const k=Ae(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;u(k),x.refs.setReference(k)},[x.refs]),P=l.useCallback(B=>{(Ae(B)||B===null)&&(b.current=B,p(B)),(Ae(x.refs.reference.current)||x.refs.reference.current===null||B!==null&&!Ae(B))&&x.refs.setReference(B)},[x.refs,p]),T=l.useCallback(B=>{y(B),x.refs.setFloating(B)},[x.refs]),L=l.useMemo(()=>({...x.refs,setReference:P,setFloating:T,setPositionReference:C,domReference:b}),[x.refs,P,T,C]),_=l.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),X=l.useMemo(()=>({...x,dataRef:o.context.dataRef,open:a,onOpenChange:o.setOpen,events:o.context.events,floatingId:f,refs:L,elements:_,nodeId:t,rootStore:o}),[x,L,_,t,o,a,f]);return J(()=>{c&&(b.current=c)},[c]),J(()=>{o.context.dataRef.current.floatingContext=X;const B=h?.nodesRef.current.find(k=>k.id===t);B&&(B.context=X)}),l.useMemo(()=>({...x,context:X,refs:L,elements:_,rootStore:o}),[x,L,_,X,o])}const ys="Escape";function Xt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Pt(e,t){return Xt(t,e===Qn||e===pn,e===Yt||e===qt)}function nn(e,t,n){return Xt(t,e===pn,n?e===Yt:e===qt)||e==="Enter"||e===" "||e===""}function ws(e,t,n){return Xt(t,n?e===Yt:e===qt,e===pn)}function bs(e,t,n,r){const o=n?e===qt:e===Yt,s=e===Qn;return t==="both"||t==="horizontal"&&r?e===ys:Xt(t,o,s)}function Rs(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:a=!1,nested:f=!1,rtl:g=!1,virtual:u=!1,focusItemOnOpen:d="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:y=void 0,orientation:b="vertical",parentOrientation:h,id:R,resetOnPointerLeave:x=!0,externalTree:w,grid:S}=t,C=S!=null,P="rootStore"in e?e.rootStore:e,T=P.useState("open"),L=P.useState("floatingElement"),_=P.useState("domReferenceElement"),X=P.context.dataRef,B=Gn(L),k=Ur(_),I=Ye(B),H=tr(),Y=nr(w),F=l.useRef(d),E=l.useRef(i??-1),W=l.useRef(null),A=l.useRef(!0),v=ue(M=>{o(E.current===-1?null:E.current,M)}),N=l.useRef(!!L),me=l.useRef(T),q=l.useRef(!1),ye=l.useRef(!1),he=l.useRef(null),O=Ye(y),j=Ye(T),le=Ye(i),Ce=Ye(x),Q=Nt(),ne=Nt(),se=ue(()=>{function M(G){u?Y?.events.emit("virtualfocus",G):he.current=lo(G,{sync:q.current,preventScroll:!0})}const D=n.current[E.current],Z=ye.current;D&&M(D),(q.current?G=>G():G=>Q.request(G))(()=>{const G=n.current[E.current]||D;if(!G)return;D||M(G),we&&(Z||!A.current)&&G.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J(()=>{X.current.orientation=b},[X,b]),J(()=>{s&&(T&&L?(E.current=i??-1,F.current&&i!=null&&(ye.current=!0,v())):N.current&&(E.current=-1,v()))},[s,T,L,i,v]),J(()=>{if(s){if(!T){q.current=!1;return}if(L)if(r==null){if(q.current=!1,le.current!=null)return;if(N.current&&(E.current=-1,se()),(!me.current||!N.current)&&F.current&&(W.current!=null||F.current===!0&&W.current==null)){let M=0;const D=()=>{n.current[0]==null?(M<2&&(M?V=>ne.request(V):queueMicrotask)(D),M+=1):(E.current=W.current==null||nn(W.current,b,g)||f?Jt(n):Tn(n),W.current=null,v())};D()}}else Cn(n.current,r)||(E.current=r,se(),ye.current=!1)}},[s,T,L,r,le,f,n,b,g,v,se,ne]),J(()=>{if(!s||L||!Y||u||!N.current)return;const M=Y.nodesRef.current,D=M.find(G=>G.id===H)?.context?.elements.floating,Z=Qt(ot(_??D??null)),V=M.some(G=>G.context&&at(G.context.elements.floating,Z));D&&!V&&A.current&&D.focus({preventScroll:!0})},[s,L,_,Y,H,u]),J(()=>{me.current=T,N.current=!!L}),J(()=>{T||(W.current=null,F.current=d)},[T,d]);const Se=r!=null,fe=ue(M=>{if(!j.current)return;const D=n.current.indexOf(M.currentTarget);D!==-1&&(E.current!==D||r!==D)&&(E.current=D,v(M))}),de=ue(()=>h??Y?.nodesRef.current.find(M=>M.id===H)?.context?.dataRef?.current.orientation),xe=ue(()=>Jt(n,O.current)),te=ue(M=>{if(A.current=!1,q.current=!0,M.which===229||!j.current&&M.currentTarget===I.current)return;if(f&&bs(M.key,b,g,C)){Pt(M.key,de())||et(M),P.setOpen(!1,_e(An,M.nativeEvent)),nt(_)&&(u?Y?.events.emit("virtualfocus",_):_.focus());return}const D=E.current,Z=Jt(n,y),V=Tn(n,y);if(k||(M.key==="Home"&&(et(M),E.current=Z,v(M)),M.key==="End"&&(et(M),E.current=V,v(M))),S!=null){const G=S(M,E.current,n,b,a,g,y,Z,V);if(G!=null&&(E.current=G,v(M)),b==="both")return}if(Pt(M.key,b)){if(et(M),T&&!u&&Qt(M.currentTarget.ownerDocument)===M.currentTarget){E.current=nn(M.key,b,g)?Z:V,v(M);return}nn(M.key,b,g)?a?D>=V?c&&D!==n.current.length?E.current=-1:(q.current=!1,E.current=Z):E.current=Mt(n.current,{startingIndex:D,disabledIndices:y}):E.current=Math.min(V,Mt(n.current,{startingIndex:D,disabledIndices:y})):a?D<=Z?c&&D!==-1?E.current=n.current.length:(q.current=!1,E.current=V):E.current=Mt(n.current,{startingIndex:D,decrement:!0,disabledIndices:y}):E.current=Math.max(Z,Mt(n.current,{startingIndex:D,decrement:!0,disabledIndices:y})),Cn(n.current,E.current)&&(E.current=-1),v(M)}}),we=l.useMemo(()=>({onFocus(D){q.current=!0,fe(D)},onClick:({currentTarget:D})=>D.focus({preventScroll:!0}),onMouseMove(D){q.current=!0,ye.current=!1,p&&fe(D)},onPointerLeave(D){if(!j.current||!A.current||D.pointerType==="touch")return;q.current=!0;const Z=D.relatedTarget;if(!(!p||n.current.includes(Z))&&Ce.current&&(he.current?.(),he.current=null,E.current=-1,v(D),!u)){const V=I.current,G=Qt(ot(V));V&&at(V,G)&&V.focus({preventScroll:!0})}}}),[fe,j,I,p,n,v,Ce,u]),ce=l.useMemo(()=>u&&T&&Se&&{"aria-activedescendant":`${R}-${r}`},[u,T,Se,R,r]),ie=l.useMemo(()=>({"aria-orientation":b==="both"?void 0:b,...k?{}:ce,onKeyDown(M){if(M.key==="Tab"&&M.shiftKey&&T&&!u){const D=qn(M.nativeEvent);if(D&&!at(I.current,D))return;et(M),P.setOpen(!1,_e(Jn,M.nativeEvent)),nt(_)&&_.focus();return}te(M)},onPointerMove(){A.current=!0}}),[ce,te,I,b,k,P,T,u,_]),re=l.useMemo(()=>{function M(V){P.setOpen(!0,_e(An,V.nativeEvent,V.currentTarget))}function D(V){d==="auto"&&rr(V.nativeEvent)&&(F.current=!u)}function Z(V){F.current=d,d==="auto"&&ao(V.nativeEvent)&&(F.current=!0)}return{onKeyDown(V){const G=P.select("open");A.current=!1;const ke=V.key.startsWith("Arrow"),We=ws(V.key,de(),g),Me=Pt(V.key,b),Fe=(f?We:Me)||V.key==="Enter"||V.key.trim()==="";if(u&&G)return te(V);if(!(!G&&!m&&ke)){if(Fe){const ae=Pt(V.key,de());W.current=f&&ae?null:V.key}if(f){We&&(et(V),G?(E.current=xe(),v(V)):M(V));return}Me&&(le.current!=null&&(E.current=le.current),et(V),!G&&m?M(V):te(V),G&&v(V))}},onFocus(V){P.select("open")&&!u&&(E.current=-1,v(V))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:D,onClick:D}},[te,d,xe,f,v,P,m,b,de,g,le,u]),$=l.useMemo(()=>({...ce,...re}),[ce,re]);return l.useMemo(()=>s?{reference:$,floating:ie,item:we,trigger:re}:{},[s,$,ie,re,we])}function Ss(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:c,enabled:a=!0,resetMs:f=750,selectedIndex:g=null}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),p=vt(),m=l.useRef(""),y=l.useRef(g??o??-1),b=l.useRef(null),h=ue(w=>{function S(I){const H=r?.current[I];return!H||zr(H)}function C(I){return S(I)?i==null||!$r(on,I,i):!1}function P(I,H,Y=0){if(I.length===0)return-1;const F=(Y%I.length+I.length)%I.length,E=H.toLowerCase();for(let W=0;W<I.length;W+=1){const A=(F+W)%I.length;if(!(!I[A]?.toLowerCase().startsWith(E)||!C(A)))return A}return-1}const T=n.current;if(m.current.length>0&&w.key===" "&&(et(w),c?.(!0)),m.current.length>0&&m.current[0]!==" "&&P(T,m.current)===-1&&w.key!==" "&&c?.(!1),T==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;d&&w.key!==" "&&(et(w),c?.(!0));const L=m.current==="";L&&(y.current=g??o??-1),T.every((I,H)=>I&&C(H)?I[0]?.toLowerCase()!==I[1]?.toLowerCase():!0)&&m.current===w.key&&(m.current="",y.current=b.current),m.current+=w.key,p.start(f,()=>{m.current="",y.current=b.current,c?.(!1)});const B=((L?g??o??-1:y.current)??0)+1,k=P(T,m.current,B);k!==-1?(s?.(k),b.current=k):w.key!==" "&&(m.current="",c?.(!1))}),R=ue(w=>{const S=w.relatedTarget,C=u.select("domReferenceElement"),P=u.select("floatingElement");at(C,S)||at(P,S)||(p.clear(),m.current="",y.current=b.current,c?.(!1))});J(()=>{!d&&g!==null||(p.clear(),b.current=null,m.current!==""&&(m.current=""))},[d,g,p]),J(()=>{d&&m.current===""&&(y.current=g??o??-1)},[d,g,o]);const x=l.useMemo(()=>({onKeyDown:h,onBlur:R}),[h,R]);return l.useMemo(()=>a?{reference:x,floating:x}:{},[a,x])}const vs=l.createContext(void 0);function xr(){return l.useContext(vs)?.direction??"ltr"}const Es=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:f,padding:g=0,offsetParent:u="real"}=st(e,t)||{};if(f==null)return{};const d=ir(g),p={x:n,y:r},m=yn(o),y=xn(m),b=await i.getDimensions(f),h=m==="y",R=h?"top":"left",x=h?"bottom":"right",w=h?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[m]-p[m]-s.floating[y],C=p[m]-s.reference[m],P=u==="real"?await i.getOffsetParent?.(f):c.floating;let T=c.floating[w]||s.floating[y];(!T||!await i.isElement?.(P))&&(T=c.floating[w]||s.floating[y]);const L=S/2-C/2,_=T/2-b[y]/2-1,X=Math.min(d[R],_),B=Math.min(d[x],_),k=X,I=T-b[y]-B,H=T/2-b[y]/2+L,Y=cn(k,H,I),F=!a.arrow&&ut(o)!=null&&H!==Y&&s.reference[y]/2-(H<k?X:B)-b[y]/2<0,E=F?H<k?H-k:H-I:0;return{[m]:p[m]+E,data:{[m]:Y,centerOffset:H-Y-E,...F&&{alignmentOffset:E}},reset:F}}}),Cs=(e,t)=>({...Es(e),options:[e,t]}),Ts=hs().fn,As={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await Ts(e)).data?.referenceHidden||s}}}},Ht={sideX:"left",sideY:"top"},Ci={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,a=Be(o),f=a.getComputedStyle(o);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:t,y:n,data:Ht};const u=await s.getOffsetParent?.(o);let d={width:0,height:0};if(i==="fixed"&&a?.visualViewport)d={width:a.visualViewport.width,height:a.visualViewport.height};else if(u===a){const R=ot(o);d={width:R.documentElement.clientWidth,height:R.documentElement.clientHeight}}else await s.isElement?.(u)&&(d=await s.getDimensions(u));const p=Ve(c);let m=t,y=n;p==="left"&&(m=d.width-(t+r.width)),p==="top"&&(y=d.height-(n+r.height));const b=p==="left"?"right":Ht.sideX,h=p==="top"?"bottom":Ht.sideY;return{x:m,y,data:{sideX:b,sideY:h}}}};function yr(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function _n(e,t,n){const{rects:r,placement:o}=e;return{side:yr(t,Ve(o),n),align:ut(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Is(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:a=5,sticky:f=!1,arrowPadding:g=5,disableAnchorTracking:u=!1,inline:d,keepMounted:p=!1,floatingRootContext:m,mounted:y,collisionAvoidance:b,shiftCrossAxis:h=!1,nodeId:R,adaptiveOrigin:x,lazyFlip:w=!1,externalTree:S}=e,[C,P]=l.useState(null);!y&&C!==null&&P(null);const T=b.side||"flip",L=b.align||"flip",_=b.fallbackAxisSide||"end",X=typeof t=="function"?t:void 0,B=ue(X),k=X?B:t,I=Ye(t),H=Ye(y),F=xr()==="rtl",E=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[r],W=s==="center"?E:`${E}-${s}`;let A=a;const v=1,N=r==="bottom"?v:0,me=r==="top"?v:0,q=r==="right"?v:0,ye=r==="left"?v:0;typeof A=="number"?A={top:A+N,right:A+ye,bottom:A+me,left:A+q}:A&&(A={top:(A.top||0)+N,right:(A.right||0)+ye,bottom:(A.bottom||0)+me,left:(A.left||0)+q});const he={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:A},O=l.useRef(null),j=Ye(o),le=Ye(i),Ce=typeof o!="function"?o:0,Q=typeof i!="function"?i:0,ne=[];d&&ne.push(d),ne.push(fs(ee=>{const pe=_n(ee,r,F),ve=typeof j.current=="function"?j.current(pe):j.current,Re=typeof le.current=="function"?le.current(pe):le.current;return{mainAxis:ve,crossAxis:Re,alignmentAxis:Re}},[Ce,Q,F,r]));const se=L==="none"&&T!=="shift",Se=!se&&(f||h||T==="shift"),fe=T==="none"?null:gs({...he,padding:{top:A.top+v,right:A.right+v,bottom:A.bottom+v,left:A.left+v},mainAxis:!h&&T==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),de=se?null:ds(ee=>{const pe=ot(ee.elements.floating).documentElement;return{...he,rootBoundary:h?{x:0,y:0,width:pe.clientWidth,height:pe.clientHeight}:void 0,mainAxis:L!=="none",crossAxis:Se,limiter:f||h?void 0:ps(ve=>{if(!O.current)return{};const{width:Re,height:Te}=O.current.getBoundingClientRect(),be=je(Ve(ve.placement)),Oe=be==="y"?Re:Te,ze=be==="y"?A.left+A.right:A.top+A.bottom;return{offset:Oe/2+ze/2}})}},[he,f,h,A,L]);T==="shift"||L==="shift"||s==="center"?ne.push(de,fe):ne.push(fe,de),ne.push(ms({...he,apply({elements:{floating:ee},availableWidth:pe,availableHeight:ve,rects:Re}){if(!H.current)return;const Te=ee.style;Te.setProperty("--available-width",`${pe}px`),Te.setProperty("--available-height",`${ve}px`);const be=Be(ee).devicePixelRatio||1,{x:Oe,y:ze,width:qe,height:ct}=Re.reference,Pe=(Math.round((Oe+qe)*be)-Math.round(Oe*be))/be,Ke=(Math.round((ze+ct)*be)-Math.round(ze*be))/be;Te.setProperty("--anchor-width",`${Pe}px`),Te.setProperty("--anchor-height",`${Ke}px`)}}),Cs(ee=>({element:O.current||ot(ee.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(ee){const{elements:pe,middlewareData:ve,placement:Re,rects:Te,y:be}=ee,Oe=Ve(Re),ze=je(Oe),qe=O.current,ct=ve.arrow?.x||0,Pe=ve.arrow?.y||0,Ke=qe?.clientWidth||0,ht=qe?.clientHeight||0,lt=ct+Ke/2,xt=Pe+ht/2,K=Math.abs(ve.shift?.y||0),ge=Te.reference.height/2,Ee=typeof o=="function"?o(_n(ee,r,F)):o,De=K>Ee,Xe={top:`${lt}px calc(100% + ${Ee}px)`,bottom:`${lt}px ${-Ee}px`,left:`calc(100% + ${Ee}px) ${xt}px`,right:`${-Ee}px ${xt}px`}[Oe],Ze=`${lt}px ${Te.reference.y+ge-be}px`;return pe.floating.style.setProperty("--transform-origin",Se&&ze==="y"&&De?Ze:Xe),{}}},As,x),J(()=>{!y&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,m]);const xe=l.useMemo(()=>({elementResize:!u&&typeof ResizeObserver<"u",layoutShift:!u&&typeof IntersectionObserver<"u"}),[u]),{refs:te,elements:we,x:ce,y:ie,middlewareData:re,update:$,placement:M,context:D,isPositioned:Z,floatingStyles:V}=xs({rootContext:m,open:p?y:void 0,placement:W,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...ee)=>Hn(...ee,xe),nodeId:R,externalTree:S}),{sideX:G,sideY:ke}=re.adaptiveOrigin||Ht,We=Z?n:"fixed",Me=l.useMemo(()=>{const ee=x?{position:We,[G]:ce,[ke]:ie}:{position:We,...V};return Z||(ee.opacity=0),ee},[x,We,G,ce,ke,ie,V,Z]),Fe=l.useRef(null);J(()=>{if(!y)return;const ee=I.current,pe=typeof ee=="function"?ee():ee,Re=(Bn(pe)?pe.current:pe)||null||null;Re!==Fe.current&&(te.setPositionReference(Re),Fe.current=Re)},[y,te,k,I]),l.useEffect(()=>{if(!y)return;const ee=I.current;typeof ee!="function"&&Bn(ee)&&ee.current!==Fe.current&&(te.setPositionReference(ee.current),Fe.current=ee.current)},[y,te,k,I]),l.useEffect(()=>{if(p&&y&&we.reference&&we.floating)return Hn(we.reference,we.floating,$,xe)},[p,y,we,$,xe]);const ae=Ve(M),Ue=yr(r,ae,F),$e=ut(M)||"center",He=!!re.hide?.referenceHidden;J(()=>{w&&y&&Z&&P(ae)},[w,y,Z,ae]);const Je=l.useMemo(()=>({position:"absolute",top:re.arrow?.y,left:re.arrow?.x}),[re.arrow]),Qe=re.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:Me,arrowStyles:Je,arrowRef:O,arrowUncentered:Qe,side:Ue,align:$e,physicalSide:ae,anchorHidden:He,refs:te,context:D,isPositioned:Z,update:$}),[Me,Je,O,Qe,Ue,$e,ae,He,te,D,Z,$])}function Bn(e){return e!=null&&"current"in e}function wr(e){return e==="starting"?jr:zt}function Ms(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),gt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},wr(r),o],stateAttributesMapping:or})}function Os(e){const t=l.useRef(""),n=l.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:l.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function br(e,t){const n=l.useRef(e),r=ue(t);J(()=>{n.current!==e&&r(n.current)},[e,r]),J(()=>{n.current=e},[e])}function Ps(e,t){const n=ue((s,i)=>{(typeof e=="function"?e():e)||t(i||(Yr?"touch":""))}),{onClick:r,onPointerDown:o}=Os(n);return l.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Ds(e){const[t,n]=l.useState(null),r=Ps(e,n);return br(e,o=>{o&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Ls(e){const[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Fs(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wn({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[s,i]=l.useState(t),c=o?e:s,a=l.useCallback(f=>{o||i(f)},[]);return[c,a]}const Rr=l.createContext(null),Sr=l.createContext(null);function mt(){const e=l.useContext(Rr);if(e===null)throw new Error(It(60));return e}function vr(){const e=l.useContext(Sr);if(e===null)throw new Error(It(61));return e}let Un=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Vs={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Rt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ks={disabled:!1,...Rt},Hs={valid(e){return e===null?null:e?{[Un.valid]:""}:{[Un.invalid]:""}}},Ns={invalid:void 0,name:void 0,validityData:{state:Vs,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,touched:Rt.touched,setTouched:Le,dirty:Rt.dirty,setDirty:Le,filled:Rt.filled,setFilled:Le,focused:Rt.focused,setFocused:Le,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ks,markedDirtyRef:{current:!1},registerFieldControl:Le,validation:{getValidationProps:(e,t=zt)=>t,inputRef:{current:null},registerInput:Le,commit:async()=>{},change:Le}},_s=l.createContext(Ns);function bn(e=!0){const t=l.useContext(_s);if(t.setValidityData===Le&&!e)throw new Error(It(28));return t}function Bs(e,t,n,r,o=!0,s){const{registerFieldControl:i}=bn(),c=l.useRef(null);c.current||(c.current=Symbol()),J(()=>{const a=c.current;return!a||!o?void 0:(i(a,{controlRef:e,getValue:r,id:t,name:s,value:n}),()=>{i(a,void 0)})},[e,o,r,t,s,i,n])}const Ws=l.createContext({controlId:void 0,registerControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function Er(){return l.useContext(Ws)}function Cr(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Er(),i=uo(t),c=n?o:void 0,a=Tt(()=>Symbol("labelable-control")),f=l.useRef(!1),g=l.useRef(t!=null),u=ue(()=>{!f.current||s===Le||(f.current=!1,s(a.current,void 0))});return J(()=>{if(s===Le)return;let d;if(n){const p=r?.current;Ae(p)&&p.closest("label")!=null?d=t??null:d=c??i}else if(t!=null)g.current=!0,d=t;else if(g.current)d=i;else{u();return}if(d===void 0){u();return}f.current=!0,s(a.current,d)},[t,r,c,s,n,i,a,u]),l.useEffect(()=>u,[u]),o??i}const Us=(e,t)=>Object.is(e,t);function pt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function $s(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:pt(t,r,n))}function Et(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:pt(r,t,n))}function zs(e,t,n){return e.filter(r=>!pt(t,r,n))}function an(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function js(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Tr(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Ar(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return an(e)}function ft(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?an(e.value):an(e)}function Ir(e,t,n){function r(){return Ar(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=Tr(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function Ys(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(Ie.jsx(l.Fragment,{children:Ir(o,t,n)},s)),r),[])}const U={id:oe(e=>e.id),labelId:oe(e=>e.labelId),modal:oe(e=>e.modal),multiple:oe(e=>e.multiple),items:oe(e=>e.items),itemToStringLabel:oe(e=>e.itemToStringLabel),itemToStringValue:oe(e=>e.itemToStringValue),isItemEqualToValue:oe(e=>e.isItemEqualToValue),value:oe(e=>e.value),hasSelectedValue:oe(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ft(t,r)!==""}),hasNullItemLabel:oe((e,t)=>t?js(e.items):!1),open:oe(e=>e.open),mounted:oe(e=>e.mounted),forceMount:oe(e=>e.forceMount),transitionStatus:oe(e=>e.transitionStatus),openMethod:oe(e=>e.openMethod),activeIndex:oe(e=>e.activeIndex),selectedIndex:oe(e=>e.selectedIndex),isActive:oe((e,t)=>e.activeIndex===t),isSelected:oe((e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>pt(t,o,n)):pt(t,r,n)}),isSelectedByFocus:oe((e,t)=>e.selectedIndex===t),popupProps:oe(e=>e.popupProps),triggerProps:oe(e=>e.triggerProps),triggerElement:oe(e=>e.triggerElement),positionerElement:oe(e=>e.positionerElement),listElement:oe(e=>e.listElement),popupSide:oe(e=>e.popupSide),scrollUpArrowVisible:oe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:oe(e=>e.scrollDownArrowVisible),hasScrollArrows:oe(e=>e.hasScrollArrows)},qs=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Ks(){return l.useContext(qs)}function Xs(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}const tt=1;function Mr(e,t){return Math.max(0,e-t)}function Gs(e,t){if(t<=0)return 0;const n=bt(e,0,t),r=n,o=t-n,s=r<=tt,i=o<=tt;return s&&i?r<=o?0:t:s?0:i?t:n}function Ti(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:c,name:a,form:f,autoComplete:g,disabled:u=!1,readOnly:d=!1,required:p=!1,modal:m=!0,actionsRef:y,inputRef:b,onOpenChangeComplete:h,items:R,multiple:x=!1,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C=Us,highlightItemOnHover:P=!0,children:T}=e,{clearErrors:L}=Ks(),{setDirty:_,setTouched:X,setFocused:B,validityData:k,setFilled:I,name:H,disabled:Y,validation:F,validationMode:E}=bn(),W=Cr({id:t}),A=Y||u,v=H??a,[N,me]=Wn({controlled:n,default:x?r??on:r,name:"Select",state:"value"}),[q,ye]=Wn({controlled:s,default:i,name:"Select",state:"open"}),he=l.useRef([]),O=l.useRef([]),j=l.useRef(null),le=l.useRef(null),Ce=l.useRef(0),Q=l.useRef(null),ne=l.useRef([]),se=l.useRef(!1),Se=l.useRef(null),fe=l.useRef(null),de=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=l.useRef(!1),{mounted:te,setMounted:we,transitionStatus:ce}=sr(q),{openMethod:ie,triggerProps:re}=Ds(q),$=Tt(()=>new Gr({id:W,labelId:void 0,modal:m,multiple:x,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,value:N,open:q,mounted:te,transitionStatus:ce,items:R,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,M=z($,U.activeIndex),D=z($,U.selectedIndex),Z=z($,U.triggerElement),V=z($,U.positionerElement),G=Ls(ie),ke=ie??G??null,We=l.useMemo(()=>x?"":ft(N,S),[x,N,S]),Me=l.useMemo(()=>x&&Array.isArray(N)?N.map(K=>ft(K,S)):ft(N,S),[x,N,S]),Fe=Ye($.state.triggerElement),ae=ue(()=>Me);Bs(Fe,W,N,ae,!A,a);const Ue=l.useRef(N),$e=x?Array.isArray(N)&&N.length>0:N!=null&&ft(N,S)!=="";J(()=>{N!==Ue.current&&$.set("forceMount",!0)},[$,N]),J(()=>{I($e)},[$e,I]),J(function(){const ge=ne.current;let Ee;if(x){const De=Array.isArray(N)?N:[];if(De.length===0)Ee=null;else{const Xe=De[De.length-1],Ze=Et(ge,Xe,C);Ee=Ze===-1?null:Ze}}else{const De=Et(ge,N,C);Ee=De===-1?null:De}Ee===null&&(fe.current=null),!q&&$.set("selectedIndex",Ee)},[$e,x,q,N,ne,C,$,fe]);function He(K){const ge=k.initialValue;return Array.isArray(K)&&Array.isArray(ge)?!Xs(K,ge,(Ee,De)=>pt(Ee,De,C)):K!==ge}br(N,()=>{L(v),_(He(N)),F.change(N)});const Je=ue((K,ge)=>{c?.(K,ge),!ge.isCanceled&&(ye(K),!K&&(ge.reason===Jn||ge.reason===Jr)&&(X(!0),B(!1),E==="onBlur"&&F.commit(N)))}),Qe=ue(()=>{we(!1),$.update({activeIndex:null,openMethod:null}),h?.(!1)});gn({enabled:!y,open:q,ref:j,onComplete(){q||Qe()}}),l.useImperativeHandle(y,()=>({unmount:Qe}),[Qe]);const ee=ue((K,ge)=>{o?.(K,ge),!ge.isCanceled&&me(K)}),pe=ue(()=>{const K=$.state.listElement||j.current;if(!K)return;const ge=Mr(K.scrollHeight,K.clientHeight),Ee=Gs(K.scrollTop,ge),De=Ee>0,Xe=Ee<ge;$.state.scrollUpArrowVisible!==De&&$.set("scrollUpArrowVisible",De),$.state.scrollDownArrowVisible!==Xe&&$.set("scrollDownArrowVisible",Xe)}),ve=hr({open:q,onOpenChange:Je,elements:{reference:Z,floating:V}}),Re=Oo(ve,{enabled:!d&&!A,event:"mousedown"}),Te=fo(ve),be=Rs(ve,{enabled:!d&&!A,listRef:he,activeIndex:M,selectedIndex:D,disabledIndices:on,onNavigate(K){K===null&&!q||$.set("activeIndex",K)},focusItemOnHover:P}),Oe=Ss(ve,{enabled:!d&&!A&&(q||!x),listRef:O,activeIndex:M,selectedIndex:D,disabledIndices:K=>Fs(he.current[K]),onMatch(K){q?$.set("activeIndex",K):ee(ne.current[K],_e("none"))},onTyping(K){se.current=K}}),ze=l.useMemo(()=>{const K=sn(Oe.reference,be.reference,Te.reference,Re.reference,re);return W&&(K.id=W),K},[Re.reference,Oe.reference,be.reference,Te.reference,re,W]),qe=l.useMemo(()=>sn(po,Oe.floating,be.floating,Te.floating),[Oe.floating,be.floating,Te.floating]),ct=be.item??zt;go(()=>{$.update({popupProps:qe,triggerProps:ze})}),J(()=>{$.update({id:W,modal:m,multiple:x,value:N,open:q,mounted:te,transitionStatus:ce,popupProps:qe,triggerProps:ze,items:R,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,openMethod:ke})},[$,W,m,x,N,q,te,ce,qe,ze,R,w,S,C,ke]);const Pe=l.useMemo(()=>({store:$,name:v,required:p,disabled:A,readOnly:d,multiple:x,highlightItemOnHover:P,setValue:ee,setOpen:Je,listRef:he,popupRef:j,scrollHandlerRef:le,handleScrollArrowVisibility:pe,scrollArrowsMountedCountRef:Ce,itemProps:ct,valueRef:Q,valuesRef:ne,labelsRef:O,typingRef:se,selectionRef:de,firstItemTextRef:Se,selectedItemTextRef:fe,validation:F,onOpenChangeComplete:h,alignItemWithTriggerActiveRef:xe,initialValueRef:Ue}),[$,v,p,A,d,x,P,ee,Je,ct,F,h,pe]),Ke=qr(b,F.inputRef),ht=x&&Array.isArray(N)&&N.length>0,lt=x?void 0:v,xt=l.useMemo(()=>!x||!Array.isArray(N)||!v?null:N.map(K=>{const ge=ft(K,S);return Ie.jsx("input",{type:"hidden",form:f,name:v,value:ge,disabled:A},ge)}),[x,N,f,v,S,A]);return Ie.jsx(Rr.Provider,{value:Pe,children:Ie.jsxs(Sr.Provider,{value:ve,children:[T,Ie.jsx("input",{...F.getValidationProps(A,{onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(K){if(K.nativeEvent.defaultPrevented||A||d)return;const ge=K.currentTarget.value,Ee=_e(mn,K.nativeEvent);function De(){if(x)return;const Xe=ge.toLowerCase();let Ze=ne.current.findIndex(Gt=>ft(Gt,S).toLowerCase()===Xe||Ar(Gt,w).toLowerCase()===Xe);Ze===-1&&(Ze=ne.current.findIndex((Gt,Fr)=>{const vn=O.current[Fr];return vn!=null&&vn.toLowerCase()===Xe}));const Sn=Ze===-1?void 0:ne.current[Ze];Sn!=null&&ee(Sn,Ee)}$.set("forceMount",!0),queueMicrotask(De)}}),id:W&&lt==null?`${W}-hidden-input`:void 0,form:f,name:lt,autoComplete:g,value:We,disabled:A,required:p&&!ht,readOnly:d,ref:Ke,style:v?Kr:Xr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),xt]})})}function Js(e,t){return e??t}function Qs(e){const t=e.getBoundingClientRect(),n=Be(e);if(Qr)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,c=parseFloat(r.height)||0,a=parseFloat(o.width)||0,f=parseFloat(o.height)||0,g=Math.max(t.width,i,a),u=Math.max(t.height,c,f),d=g-t.width,p=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Dt=2,Zs=400,ei={...mo,...Hs,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ai=l.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:c=!0,style:a,...f}=t,{setTouched:g,setFocused:u,validationMode:d,state:p,disabled:m}=bn(),{labelId:y}=Er(),{store:b,setOpen:h,selectionRef:R,validation:x,readOnly:w,required:S,alignItemWithTriggerActiveRef:C,disabled:P}=mt(),T=m||P||i,L=z(b,U.open),_=z(b,U.mounted),X=z(b,U.value),B=z(b,U.triggerProps),k=z(b,U.positionerElement),I=z(b,U.listElement),H=z(b,U.popupSide),Y=z(b,U.id),F=z(b,U.labelId),E=z(b,U.hasSelectedValue),W=_&&k?H:null,A=s??Y,v=Js(y,F);Cr({id:A});const N=Ye(k),me=l.useRef(null),{getButtonProps:q,buttonRef:ye}=Zn({disabled:T,native:c}),he=ue(se=>{b.set("triggerElement",se)}),O=vt(),j=vt(),le=vt();l.useEffect(()=>{if(L)return le.start(Zs,()=>{R.current.allowUnselectedMouseUp=!0,R.current.allowSelectedMouseUp=!0}),()=>{le.clear()};R.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},j.clear()},[L,R,j,le]);const Ce=sn(B,{id:A,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?I?.id??Gn(k)?.id:void 0,"aria-labelledby":v,"aria-readonly":w||void 0,"aria-required":S||void 0,tabIndex:T?-1:0,onFocus(se){u(!0),L&&C.current&&h(!1,_e(mn,se.nativeEvent)),O.start(0,()=>{b.set("forceMount",!0)})},onBlur(se){at(k,se.relatedTarget)||(g(!0),u(!1),d==="onBlur"&&x.commit(X))},onMouseDown(se){if(L)return;const Se=ot(se.currentTarget);function fe(de){if(!me.current)return;const xe=de.target;if(at(me.current,xe)||at(N.current,xe))return;const te=Qs(me.current);de.clientX>=te.left-Dt&&de.clientX<=te.right+Dt&&de.clientY>=te.top-Dt&&de.clientY<=te.bottom+Dt||h(!1,_e(Zr,de))}j.start(0,()=>{Se.addEventListener("mouseup",fe,{once:!0})})}},f,q),Q=x.getValidationProps(T,Ce);Q.role="combobox";const ne={...p,open:L,disabled:T,value:X,readOnly:w,popupSide:W,placeholder:!E};return gt("button",t,{ref:[n,me,ye,he],state:ne,stateAttributesMapping:ei,props:Q})}),ti={value:()=>null},Ii=l.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:c,...a}=t,{store:f,valueRef:g}=mt(),u=z(f,U.value),d=z(f,U.items),p=z(f,U.itemToStringLabel),m=z(f,U.hasSelectedValue),y=!m&&i!=null&&s==null,b=z(f,U.hasNullItemLabel,y),h={value:u,placeholder:!m};let R=null;return typeof s=="function"?R=s(u):s!=null?R=s:!m&&i!=null&&!b?R=i:Array.isArray(u)?R=Ys(u,d,p):R=Ir(u,d,p),gt("span",t,{state:h,ref:[n,g],props:[{children:R},a],stateAttributesMapping:ti})}),ni=l.createContext(void 0),Mi=l.forwardRef(function(t,n){const{store:r}=mt(),o=z(r,U.mounted),s=z(r,U.forceMount);return o||s?Ie.jsx(ni.Provider,{value:!0,children:Ie.jsx(eo,{ref:n,...t})}):null}),Or=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function ri(){return l.useContext(Or)}function oi(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ue(o),i=l.useRef(0),c=Tt(ii).current,a=Tt(si).current,[f,g]=l.useState(0),u=l.useRef(f),d=ue((h,R)=>{a.set(h,R??null),u.current+=1,g(u.current)}),p=ue(h=>{a.delete(h),u.current+=1,g(u.current)}),m=l.useMemo(()=>{const h=new Map;return Array.from(a.keys()).filter(x=>x.isConnected).sort(ci).forEach((x,w)=>{const S=a.get(x)??{};h.set(x,{...S,index:w})}),h},[a,f]);J(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const h=new MutationObserver(R=>{const x=new Set,w=S=>x.has(S)?x.delete(S):x.add(S);R.forEach(S=>{S.removedNodes.forEach(w),S.addedNodes.forEach(w)}),x.size===0&&(u.current+=1,g(u.current))});return m.forEach((R,x)=>{x.parentElement&&h.observe(x.parentElement,{childList:!0})}),()=>{h.disconnect()}},[m]),J(()=>{u.current===f&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),i.current=m.size),s(m)},[s,m,n,r,f]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{r&&(r.current=[])},[r]);const y=ue(h=>(c.add(h),()=>{c.delete(h)}));J(()=>{c.forEach(h=>h(m))},[c,m]);const b=l.useMemo(()=>({register:d,unregister:p,subscribeMapChange:y,elementsRef:n,labelsRef:r,nextIndexRef:i}),[d,p,y,n,r,i]);return Ie.jsx(Or.Provider,{value:b,children:t})}function si(){return new Map}function ii(){return new Set}function ci(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Pr=l.createContext(void 0);function li(){const e=l.useContext(Pr);if(!e)throw new Error(It(59));return e}function $t(e,t){e&&Object.assign(e.style,t)}const ai={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ui=20;function fi(e,t,n,r){const[o,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=ot(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-ui)},[e,t,n]),ho(e&&(!t||o),r)}const di={position:"fixed"},Oi=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:c="bottom",align:a="center",sideOffset:f=0,alignOffset:g=0,collisionBoundary:u="clipping-ancestors",collisionPadding:d,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:y,alignItemWithTrigger:b=!0,collisionAvoidance:h=to,style:R,...x}=t,{store:w,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:P,selectedItemTextRef:T,valuesRef:L,initialValueRef:_,popupRef:X,setValue:B}=mt(),k=vr(),I=z(w,U.open),H=z(w,U.mounted),Y=z(w,U.modal),F=z(w,U.value),E=z(w,U.openMethod),W=z(w,U.positionerElement),A=z(w,U.triggerElement),v=z(w,U.isItemEqualToValue),N=z(w,U.transitionStatus),me=l.useRef(null),q=l.useRef(null),[ye,he]=l.useState(b),O=H&&ye&&E!=="touch";!H&&ye!==b&&he(b),J(()=>{H||(U.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,H]),l.useImperativeHandle(P,()=>O),fi((O||Y)&&I,E==="touch",W,A);const j=Is({anchor:r,floatingRootContext:k,positionMethod:o,mounted:H,side:c,sideOffset:f,align:a,alignOffset:g,arrowPadding:p,collisionBoundary:u,collisionPadding:d,sticky:m,disableAnchorTracking:y??O,collisionAvoidance:h,keepMounted:!0}),le=O?"none":j.side,Ce=O?di:j.positionerStyles,Q={open:I,side:le,align:j.align,anchorHidden:j.anchorHidden};J(()=>{w.set("popupSide",j.side)},[w,j.side]);const ne=ue(xe=>{w.set("positionerElement",xe)}),se=Ms(t,Q,{styles:Ce,transitionStatus:N,props:x,refs:[n,ne],hidden:!H,inert:!I}),Se=l.useRef(0),fe=ue(xe=>{if(xe.size===0&&Se.current===0||L.current.length===0)return;const te=Se.current;if(Se.current=xe.size,xe.size===te)return;const we=_e(mn);if(te!==0&&!w.state.multiple&&F!==null&&Et(L.current,F,v)===-1){const ie=_.current,$=ie!=null&&Et(L.current,ie,v)!==-1?ie:null;B($,we),$===null&&(w.set("selectedIndex",null),T.current=null)}if(te!==0&&w.state.multiple&&Array.isArray(F)){const ce=re=>Et(L.current,re,v)!==-1,ie=F.filter(re=>ce(re));(ie.length!==F.length||ie.some(re=>!$s(F,re,v)))&&(B(ie,we),ie.length===0&&(w.set("selectedIndex",null),T.current=null))}if(I&&O){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ce={height:""};$t(W,ce),$t(X.current,ce)}}),de=l.useMemo(()=>({...j,side:le,alignItemWithTriggerActive:O,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:me,scrollDownArrowRef:q}),[j,le,O,he]);return Ie.jsx(oi,{elementsRef:S,labelsRef:C,onMapChange:fe,children:Ie.jsxs(Pr.Provider,{value:de,children:[H&&Y&&Ie.jsx(xo,{inert:no(!I),cutout:A}),se]})})}),Lt="base-ui-disable-scrollbar",$n={className:Lt,getElement(e){return Ie.jsx("style",{nonce:e,href:Lt,precedence:"base-ui:low",children:`.${Lt}{scrollbar-width:none}.${Lt}::-webkit-scrollbar{display:none}`})}},pi=l.createContext(void 0);function gi(e){return l.useContext(pi)}const mi=l.createContext(void 0),hi={disableStyleElements:!1};function xi(){return l.useContext(mi)??hi}const yi={...or,...er},Pi=l.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...c}=t,{store:a,popupRef:f,onOpenChangeComplete:g,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:y,handleScrollArrowVisibility:b,scrollHandlerRef:h,listRef:R,highlightItemOnHover:x}=mt(),{side:w,align:S,alignItemWithTriggerActive:C,isPositioned:P,setControlledAlignItemWithTrigger:T}=li(),L=gi()!=null,_=vr(),X=xr(),{nonce:B,disableStyleElements:k}=xi(),I=z(a,U.id),H=z(a,U.open),Y=z(a,U.openMethod),F=z(a,U.mounted),E=z(a,U.popupProps),W=z(a,U.transitionStatus),A=z(a,U.triggerElement),v=z(a,U.positionerElement),N=z(a,U.listElement),me=l.useRef(!1),q=l.useRef(!1),ye=l.useRef({}),he=Nt(),O=ue(Q=>{if(!v||!f.current||!q.current)return;if(me.current||!C){b();return}const ne=v.style.top==="0px",se=v.style.bottom==="0px";if(!ne&&!se){b();return}const Se=jn(v),fe=St(v.getBoundingClientRect().height,"y",Se),de=ot(v),xe=Be(v),te=xe.getComputedStyle(v),we=parseFloat(te.marginTop),ce=parseFloat(te.marginBottom),ie=zn(xe.getComputedStyle(f.current)),re=Math.min(de.documentElement.clientHeight-we-ce,ie),$=Q.scrollTop,M=Ft(Q);let D=0,Z=null,V=!1,G=!1;const ke=ae=>{v.style.height=`${ae}px`},We=(ae,Ue)=>{const $e=bt(ae,0,re-fe);$e>0&&ke(fe+$e),Q.scrollTop=Ue,re-(fe+$e)<=tt&&(me.current=!0),b()},Me=ne?M-$:$,Fe=Math.min(fe+Me,re);if(D=Fe,Me<=tt){We(Me,ne?M:0);return}if(re-Fe>tt)ne?G=!0:Z=0;else if(V=!0,se&&$<M){const ae=fe+Me-re;Z=$-(Me-ae)}if(D=Math.ceil(D),D!==0&&ke(D),G||Z!=null){const ae=Ft(Q),Ue=G?ae:bt(Z,0,ae);Math.abs(Q.scrollTop-Ue)>tt&&(Q.scrollTop=Ue)}(V||D>=re-tt)&&(me.current=!0),b()});l.useImperativeHandle(h,()=>O,[O]),gn({open:H,ref:f,onComplete(){H&&g?.(!0)}});const j={open:H,transitionStatus:W,side:w,align:S};J(()=>{!v||!f.current||Object.keys(ye.current).length||(ye.current={top:v.style.top||"0",left:v.style.left||"0",right:v.style.right,height:v.style.height,bottom:v.style.bottom,minHeight:v.style.minHeight,maxHeight:v.style.maxHeight,marginTop:v.style.marginTop,marginBottom:v.style.marginBottom})},[f,v]),J(()=>{H||C||(q.current=!1,me.current=!1,$t(v,ye.current))},[H,C,v,f]),J(()=>{const Q=f.current;if(!H||!A||!v||!Q||C&&!P||a.state.transitionStatus==="ending")return;if(!C){q.current=!0,he.request(b),Q.style.removeProperty("--transform-origin");return}const ne=wi(Q);Q.style.removeProperty("--transform-origin");try{let se=m.current;se?.isConnected||(se=!U.hasSelectedValue(a.state)&&p.current?.isConnected?p.current:null);const Se=d.current,fe=Be(v),de=fe.getComputedStyle(v),xe=fe.getComputedStyle(Q),te=ot(A),we=jn(A),ce=Vt(A.getBoundingClientRect(),we),ie=Vt(v.getBoundingClientRect(),we),re=ce.height,$=N||Q,M=$.scrollHeight,D=parseFloat(xe.borderBottomWidth),Z=parseFloat(de.marginTop)||10,V=parseFloat(de.marginBottom)||10,G=parseFloat(de.minHeight)||100,ke=zn(xe),We=5,Me=5,Fe=20,ae=te.documentElement.clientHeight-Z-V,Ue=te.documentElement.clientWidth,$e=ae-ce.bottom+re;let He,Je=X==="rtl"?ce.right-ie.width:ce.left,Qe=0;if(se&&Se){const Pe=Vt(Se.getBoundingClientRect(),we);He=Vt(se.getBoundingClientRect(),we),Je=ie.left+(X==="rtl"?Pe.right-He.right:Pe.left-He.left);const Ke=Pe.top-ce.top+Pe.height/2;Qe=He.top-ie.top+He.height/2-Ke}const ee=$e+Qe+V+D;let pe=Math.min(ae,ee);const ve=ae-Z-V,Re=ee-pe,Te=Ue-Me;v.style.left=`${bt(Je,We,Te-ie.width)}px`,v.style.height=`${pe}px`,v.style.maxHeight="none",v.style.marginTop=`${Z}px`,v.style.marginBottom=`${V}px`,Q.style.height="100%";const be=Ft($),Oe=Re>=be-tt;Oe&&(pe=Math.min(ae,ie.height)-(Re-be));const ze=ce.top<Fe||ce.bottom>ae-Fe||Math.ceil(pe)+tt<Math.min(M,G),qe=(fe.visualViewport?.scale??1)!==1&&ro;if(ze||qe){q.current=!0,$t(v,ye.current),T(!1);return}const ct=Math.max(G,pe);if(Oe){const Pe=Math.max(0,ae-ee);v.style.top=ie.height>=ve?"0":`${Pe}px`,v.style.height=`${pe}px`,$.scrollTop=Ft($)}else v.style.bottom="0",$.scrollTop=Re;if(He){const Pe=ie.top,Ke=ie.height,ht=He.top+He.height/2,lt=Ke>0?(ht-Pe)/Ke*100:50,xt=bt(lt,0,100);Q.style.setProperty("--transform-origin",`50% ${xt}%`)}(ct===ae||pe>=ke)&&(me.current=!0),b(),x&&a.state.selectedIndex===null&&a.state.activeIndex===null&&R.current[0]!=null&&a.set("activeIndex",0),q.current=!0}finally{ne()}},[a,H,v,A,d,p,m,f,b,C,T,he,N,R,x,X,P]),l.useEffect(()=>{if(!C||!v||!H)return;const Q=Be(v);function ne(se){u(!1,_e(so,se))}return oo(Q,"resize",ne)},[u,C,v,H]);const le={...N?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${I}-list`},onKeyDown(Q){L&&wo.has(Q.key)&&Q.stopPropagation()},onScroll(Q){N||O(Q.currentTarget)},...C&&{style:N?{height:"100%"}:ai}},Ce=gt("div",t,{ref:[n,f],state:j,stateAttributesMapping:yi,props:[E,le,wr(W),{className:!N&&C?$n.className:void 0},c]});return Ie.jsxs(l.Fragment,{children:[!k&&$n.getElement(B),Ie.jsx(yo,{context:_,modal:!1,disabled:!F,openInteractionType:Y,returnFocus:i,restoreFocus:!0,children:Ce})]})});function zn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ft(e){return Mr(e.scrollHeight,e.clientHeight)}function jn(e){return pr.getScale(e)}function St(e,t,n){return e/n[t]}function Vt(e,t){return At({x:St(e.x,"x",t),y:St(e.y,"y",t),width:St(e.width,"x",t),height:St(e.height,"y",t)})}const Yn=[["transform","none"],["scale","1"],["translate","0 0"]];function wi(e){const{style:t}=e,n={};for(const[r,o]of Yn)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Yn){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}let Dr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function bi(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:c,subscribeMapChange:a,elementsRef:f,labelsRef:g,nextIndexRef:u}=ri(),d=l.useRef(-1),[p,m]=l.useState(s??(o===Dr.GuessFromOrder?()=>{if(d.current===-1){const h=u.current;u.current+=1,d.current=h}return d.current}:-1)),y=l.useRef(null),b=l.useCallback(h=>{if(y.current=h,p!==-1&&h!==null&&(f.current[p]=h,g)){const R=t!==void 0;g.current[p]=R?t:r?.current?.textContent??h.textContent}},[p,f,g,t,r]);return J(()=>{if(s!=null)return;const h=y.current;if(h)return i(h,n),()=>{c(h)}},[s,i,c,n]),J(()=>{if(s==null)return a(h=>{const R=y.current?h.get(y.current)?.index:null;R!=null&&m(R)})},[s,a,m]),{ref:b,index:p}}const Lr=l.createContext(void 0);function Rn(){const e=l.useContext(Lr);if(!e)throw new Error(It(57));return e}const Di=l.memo(l.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:c,disabled:a=!1,nativeButton:f=!1,...g}=t,u=l.useRef(null),d=bi({label:c,textRef:u,indexGuessBehavior:Dr.GuessFromOrder}),{store:p,itemProps:m,setOpen:y,setValue:b,selectionRef:h,typingRef:R,valuesRef:x,multiple:w,selectedItemTextRef:S,disabled:C,readOnly:P}=mt(),T=z(p,U.isActive,d.index),L=z(p,U.open),_=z(p,U.isSelected,i),X=z(p,U.isSelectedByFocus,d.index),B=z(p,U.isItemEqualToValue),k=d.index,I=k!==-1,H=l.useRef(null);J(()=>{if(!I)return;const O=x.current;return O[k]=i,()=>{delete O[k]}},[I,k,i,x]),J(()=>{if(!I)return;const O=p.state.value;let j=O;w&&Array.isArray(O)&&(j=O.length>0?O[O.length-1]:void 0),j!==void 0&&pt(i,j,B)&&(p.set("selectedIndex",k),u.current&&(S.current=u.current))},[I,k,w,B,p,i,S]);const Y=l.useRef(null),F=l.useRef("mouse"),E=l.useRef(!1),{getButtonProps:W,buttonRef:A}=Zn({disabled:a,focusableWhenDisabled:!0,native:f,composite:!0}),v={disabled:a,selected:_,highlighted:T};function N(O){if(C||P)return;const j=p.state.value;if(w){const le=Array.isArray(j)?j:[],Ce=_?zs(le,i,B):[...le,i];b(Ce,_e(Zt,O))}else b(i,_e(Zt,O)),y(!1,_e(Zt,O))}function me(){h.current.dragY=0}const q={role:"option","aria-selected":_,tabIndex:L&&T?0:-1,onKeyDown(O){Y.current=O.key,p.set("activeIndex",k),O.key===" "&&R.current&&O.preventDefault()},onClick(O){const j=O.type==="click"&&F.current!=="touch",le=O.nativeEvent.pointerType,Ce=j&&rr(O.nativeEvent)&&(le!==void 0||T),Q=j&&!Ce&&!E.current;E.current=!1,!(O.type==="keydown"&&Y.current===null)&&(a||O.type==="keydown"&&Y.current===" "&&R.current||Q||(Y.current=null,N(O.nativeEvent)))},onPointerEnter(O){F.current=O.pointerType},onPointerMove(O){if(O.pointerType==="mouse"&&O.buttons===1){const j=h.current;j.dragY+=O.movementY,j.dragY**2>=64&&(j.allowUnselectedMouseUp=!0)}},onPointerDown(O){F.current=O.pointerType,E.current=!0,me()},onMouseUp(){if(me(),a||F.current==="touch"||E.current)return;const O=!h.current.allowSelectedMouseUp&&_,j=!h.current.allowUnselectedMouseUp&&!_;O||j||(E.current=!0,H.current?.click(),E.current=!1)}},ye=gt("div",t,{ref:[A,n,d.ref,H],state:v,props:[m,q,g,W]}),he=l.useMemo(()=>({selected:_,index:k,textRef:u,selectedByFocus:X,hasRegistered:I}),[_,k,u,X,I]);return Ie.jsx(Lr.Provider,{value:he,children:ye})})),Li=l.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=Rn();return r||o?Ie.jsx(Ri,{...t,ref:n}):null}),Ri=l.memo(l.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:c}=Rn(),a=l.useRef(null),{transitionStatus:f,setMounted:g}=sr(c),d=gt("span",e,{ref:[t,a],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:er});return gn({open:c,ref:a,onComplete(){c||g(!1)}}),d})),Fi=l.memo(l.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s,hasRegistered:i}=Rn(),{firstItemTextRef:c,selectedItemTextRef:a}=mt(),{render:f,className:g,style:u,...d}=t,p=l.useCallback(y=>{y&&(i&&r===0&&(c.current=y),i&&s&&(a.current=y))},[c,a,r,s,i]);return gt("div",t,{ref:[p,n,o],props:d})}));export{$n as A,Ei as C,ai as L,Ti as S,Ks as a,bn as b,Er as c,Wn as d,Bs as e,Hs as f,br as g,Ai as h,Ii as i,Mi as j,Oi as k,Pi as l,Di as m,Fi as n,Li as o,Oo as p,Ps as q,Is as r,U as s,fi as t,mt as u,Ms as v,Ci as w,gi as x,wr as y,li as z};
1
+ import{c as Vr,bN as kr,r as l,c6 as Nt,bB as vt,bH as qn,c7 as Hr,bb as zt,b as _e,bD as Ae,c8 as it,c9 as rn,c1 as nt,ca as rt,bc as Be,cb as un,cc as Ct,cd as _t,ce as Nr,cf as Kn,cg as _r,ch as fn,ci as dn,cj as jt,ck as En,cl as Xn,au as Br,cm as Wr,b7 as Tt,b5 as J,cn as Gn,co as Ur,bC as ue,cp as Cn,cq as Jt,cr as Tn,cs as Qt,bE as ot,bK as at,ct as An,cu as Mt,bQ as Jn,cv as Yt,cw as qt,cx as Qn,cy as pn,cz as $r,cA as zr,cB as on,cC as jr,a as gt,cD as Yr,b6 as It,b8 as Le,j as Ie,bR as oe,b4 as z,bg as gn,ba as sn,b9 as qr,bd as Kr,be as Xr,bf as mn,cE as Gr,cF as Jr,cG as Qr,u as Zn,cH as Zr,bZ as eo,cI as to,c0 as no,cJ as ro,bG as oo,cK as so,bh as er,cL as Zt}from"./main-D8wPoKmZ.js";import{i as In,c as tr,A as io,P as co,b as nr,d as Ye,B as lo,D as et,E as rr,G as ao,z as or,u as uo,a as sr,m as fo,n as po,H as go,q as mo,J as ho,I as xo,x as yo,y as wo}from"./useScrollLock-jO1lwpRu.js";const bo=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ei=Vr("chevron-down",bo),Ro=["top","right","bottom","left"],wt=Math.min,Ne=Math.max,Bt=Math.round,Ot=Math.floor,Ge=e=>({x:e,y:e}),So={left:"right",right:"left",bottom:"top",top:"bottom"};function cn(e,t,n){return Ne(e,wt(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function ut(e){return e.split("-")[1]}function hn(e){return e==="x"?"y":"x"}function xn(e){return e==="y"?"height":"width"}function je(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yn(e){return hn(je(e))}function vo(e,t,n){n===void 0&&(n=!1);const r=ut(e),o=yn(e),s=xn(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wt(i)),[i,Wt(i)]}function Eo(e){const t=Wt(e);return[ln(e),t,ln(t)]}function ln(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Mn=["left","right"],On=["right","left"],Co=["top","bottom"],To=["bottom","top"];function Ao(e,t,n){switch(e){case"top":case"bottom":return n?t?On:Mn:t?Mn:On;case"left":case"right":return t?Co:To;default:return[]}}function Io(e,t,n,r){const o=ut(e);let s=Ao(Ve(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ln)))),s}function Wt(e){const t=Ve(e);return So[t]+e.slice(t.length)}function Mo(e){return{top:0,right:0,bottom:0,left:0,...e}}function ir(e){return typeof e!="number"?Mo(e):{top:e,right:e,bottom:e,left:e}}function At(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function bt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function Oo(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:c=0,reason:a=kr}=t,f="rootStore"in e?e.rootStore:e,g=f.context.dataRef,u=l.useRef(void 0),d=Nt(),p=vt(),m=l.useMemo(()=>{function y(h,R,x,w){const S=_e(a,R,x);h&&w==="touch"&&c>0?p.start(c,()=>{f.setOpen(!0,S)}):f.setOpen(h,S)}function b(h,R,x){const w=g.current.openEvent,S=f.select("domReferenceElement")!==R;return h&&S||!h||!o?!0:w&&i?!x(w.type):!1}return{onPointerDown(h){u.current=h.pointerType},onMouseDown(h){const R=u.current,x=h.nativeEvent,w=f.select("open");if(h.button!==0||r==="click"||In(R,!0)&&s)return;const S=b(w,h.currentTarget,T=>T==="click"||T==="mousedown"),C=qn(x);if(Hr(C)){y(S,x,C,R);return}const P=h.currentTarget;d.request(()=>{y(S,x,P,R)})},onClick(h){if(r==="mousedown-only")return;const R=u.current;if(r==="mousedown"&&R){u.current=void 0;return}if(In(R,!0)&&s)return;const x=f.select("open"),w=b(x,h.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");y(w,h.nativeEvent,h.currentTarget,R)},onKeyDown(){u.current=void 0}}},[g,r,s,a,f,i,o,d,p,c]);return l.useMemo(()=>n?{reference:m}:zt,[n,m])}function Pn(e,t,n){let{reference:r,floating:o}=e;const s=je(t),i=yn(t),c=xn(i),a=Ve(t),f=s==="y",g=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:g,y:r.y-o.height};break;case"bottom":p={x:g,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(ut(t)){case"start":p[i]-=d*(n&&f?-1:1);break;case"end":p[i]+=d*(n&&f?-1:1);break}return p}async function Po(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=st(t,e),m=ir(p),b=c[d?u==="floating"?"reference":"floating":u],h=At(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:g,strategy:a})),R=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),w=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},S=At(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:R,offsetParent:x,strategy:a}):R);return{top:(h.top-S.top+m.top)/w.y,bottom:(S.bottom-h.bottom+m.bottom)/w.y,left:(h.left-S.left+m.left)/w.x,right:(S.right-h.right+m.right)/w.x}}const Do=50,Lo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Po},a=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:u}=Pn(f,r,a),d=r,p=0;const m={};for(let y=0;y<s.length;y++){const b=s[y];if(!b)continue;const{name:h,fn:R}=b,{x,y:w,data:S,reset:C}=await R({x:g,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:f,platform:c,elements:{reference:e,floating:t}});g=x??g,u=w??u,m[h]={...m[h],...S},C&&p<Do&&(p++,typeof C=="object"&&(C.placement&&(d=C.placement),C.rects&&(f=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:g,y:u}=Pn(f,d,a)),y=-1)}return{x:g,y:u,placement:d,strategy:o,middlewareData:m}},Fo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:f}=t,{mainAxis:g=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...b}=st(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const h=Ve(o),R=je(c),x=Ve(c)===c,w=await(a.isRTL==null?void 0:a.isRTL(f.floating)),S=d||(x||!y?[Wt(c)]:Eo(c)),C=m!=="none";!d&&C&&S.push(...Io(c,y,m,w));const P=[c,...S],T=await a.detectOverflow(t,b),L=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(g&&L.push(T[h]),u){const I=vo(o,i,w);L.push(T[I[0]],T[I[1]])}if(_=[..._,{placement:o,overflows:L}],!L.every(I=>I<=0)){var X,B;const I=(((X=s.flip)==null?void 0:X.index)||0)+1,H=P[I];if(H&&(!(u==="alignment"?R!==je(H):!1)||_.every(E=>je(E.placement)===R?E.overflows[0]>0:!0)))return{data:{index:I,overflows:_},reset:{placement:H}};let Y=(B=_.filter(F=>F.overflows[0]<=0).sort((F,E)=>F.overflows[1]-E.overflows[1])[0])==null?void 0:B.placement;if(!Y)switch(p){case"bestFit":{var k;const F=(k=_.filter(E=>{if(C){const W=je(E.placement);return W===R||W==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(W=>W>0).reduce((W,A)=>W+A,0)]).sort((E,W)=>E[1]-W[1])[0])==null?void 0:k[0];F&&(Y=F);break}case"initialPlacement":Y=c;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};function Dn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ln(e){return Ro.some(t=>e[t]>=0)}const Vo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=st(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=Dn(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ln(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=Dn(i,n.floating);return{data:{escapedOffsets:c,escaped:Ln(c)}}}default:return{}}}}},cr=new Set(["left","top"]);async function ko(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ve(n),c=ut(n),a=je(n)==="y",f=cr.has(i)?-1:1,g=s&&a?-1:1,u=st(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),a?{x:p*g,y:d*f}:{x:d*f,y:p*g}}const Ho=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await ko(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},No=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:h=>{let{x:R,y:x}=h;return{x:R,y:x}}},...f}=st(e,t),g={x:n,y:r},u=await s.detectOverflow(t,f),d=je(Ve(o)),p=hn(d);let m=g[p],y=g[d];if(i){const h=p==="y"?"top":"left",R=p==="y"?"bottom":"right",x=m+u[h],w=m-u[R];m=cn(x,m,w)}if(c){const h=d==="y"?"top":"left",R=d==="y"?"bottom":"right",x=y+u[h],w=y-u[R];y=cn(x,y,w)}const b=a.fn({...t,[p]:m,[d]:y});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[p]:i,[d]:c}}}}}},_o=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:a=!0,crossAxis:f=!0}=st(e,t),g={x:n,y:r},u=je(o),d=hn(u);let p=g[d],m=g[u];const y=st(c,t),b=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(a){const x=d==="y"?"height":"width",w=s.reference[d]-s.floating[x]+b.mainAxis,S=s.reference[d]+s.reference[x]-b.mainAxis;p<w?p=w:p>S&&(p=S)}if(f){var h,R;const x=d==="y"?"width":"height",w=cr.has(Ve(o)),S=s.reference[u]-s.floating[x]+(w&&((h=i.offset)==null?void 0:h[u])||0)+(w?0:b.crossAxis),C=s.reference[u]+s.reference[x]+(w?0:((R=i.offset)==null?void 0:R[u])||0)-(w?b.crossAxis:0);m<S?m=S:m>C&&(m=C)}return{[d]:p,[u]:m}}}},Bo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...f}=st(e,t),g=await i.detectOverflow(t,f),u=Ve(o),d=ut(o),p=je(o)==="y",{width:m,height:y}=s.floating;let b,h;u==="top"||u==="bottom"?(b=u,h=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(h=u,b=d==="end"?"top":"bottom");const R=y-g.top-g.bottom,x=m-g.left-g.right,w=wt(y-g[b],R),S=wt(m-g[h],x),C=!t.middlewareData.shift;let P=w,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=R),C&&!d){const _=Ne(g.left,0),X=Ne(g.right,0),B=Ne(g.top,0),k=Ne(g.bottom,0);p?T=m-2*(_!==0||X!==0?_+X:Ne(g.left,g.right)):P=y-2*(B!==0||k!==0?B+k:Ne(g.top,g.bottom))}await a({...t,availableWidth:T,availableHeight:P});const L=await i.getDimensions(c.floating);return m!==L.width||y!==L.height?{reset:{rects:!0}}:{}}}};function lr(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Bt(n)!==s||Bt(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function wn(e){return Ae(e)?e:e.contextElement}function yt(e){const t=wn(e);if(!nt(t))return Ge(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=lr(t);let i=(s?Bt(n.width):n.width)/r,c=(s?Bt(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Wo=Ge(0);function ar(e){const t=Be(e);return!Xn()||!t.visualViewport?Wo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Be(e)?!1:t}function dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wn(e);let i=Ge(1);t&&(r?Ae(r)&&(i=yt(r)):i=yt(e));const c=Uo(s,n,r)?ar(s):Ge(0);let a=(o.left+c.x)/i.x,f=(o.top+c.y)/i.y,g=o.width/i.x,u=o.height/i.y;if(s){const d=Be(s),p=r&&Ae(r)?Be(r):r;let m=d,y=En(m);for(;y&&r&&p!==m;){const b=yt(y),h=y.getBoundingClientRect(),R=rt(y),x=h.left+(y.clientLeft+parseFloat(R.paddingLeft))*b.x,w=h.top+(y.clientTop+parseFloat(R.paddingTop))*b.y;a*=b.x,f*=b.y,g*=b.x,u*=b.y,a+=x,f+=w,m=Be(y),y=En(m)}}return At({width:g,height:u,x:a,y:f})}function Kt(e,t){const n=jt(e).scrollLeft;return t?t.left+n:dt(it(e)).left+n}function ur(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Kt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function $o(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=it(r),c=t?un(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},f=Ge(1);const g=Ge(0),u=nt(r);if((u||!u&&!s)&&((fn(r)!=="body"||dn(i))&&(a=jt(r)),u)){const p=dt(r);f=yt(r),g.x=p.x+r.clientLeft,g.y=p.y+r.clientTop}const d=i&&!u&&!s?ur(i,a):Ge(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+g.x+d.x,y:n.y*f.y-a.scrollTop*f.y+g.y+d.y}}function zo(e){return Array.from(e.getClientRects())}function jo(e){const t=it(e),n=jt(e),r=e.ownerDocument.body,o=Ne(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ne(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Kt(e);const c=-n.scrollTop;return rt(r).direction==="rtl"&&(i+=Ne(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Fn=25;function Yo(e,t){const n=Be(e),r=it(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const g=Xn();(!g||g&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const f=Kt(r);if(f<=0){const g=r.ownerDocument,u=g.body,d=getComputedStyle(u),p=g.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-u.clientWidth-p);m<=Fn&&(s-=m)}else f<=Fn&&(s+=f);return{width:s,height:i,x:c,y:a}}function qo(e,t){const n=dt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=nt(e)?yt(e):Ge(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,f=r*s.y;return{width:i,height:c,x:a,y:f}}function Vn(e,t,n){let r;if(t==="viewport")r=Yo(e,n);else if(t==="document")r=jo(it(e));else if(Ae(t))r=qo(t,n);else{const o=ar(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return At(r)}function fr(e,t){const n=Ct(e);return n===t||!Ae(n)||_t(n)?!1:rt(n).position==="fixed"||fr(n,t)}function Ko(e,t){const n=t.get(e);if(n)return n;let r=rn(e,[],!1).filter(c=>Ae(c)&&fn(c)!=="body"),o=null;const s=rt(e).position==="fixed";let i=s?Ct(e):e;for(;Ae(i)&&!_t(i);){const c=rt(i),a=Kn(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||dn(i)&&!a&&fr(e,i))?r=r.filter(g=>g!==i):o=c,i=Ct(i)}return t.set(e,r),r}function Xo(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?un(t)?[]:Ko(t,this._c):[].concat(n),r],c=Vn(t,i[0],o);let a=c.top,f=c.right,g=c.bottom,u=c.left;for(let d=1;d<i.length;d++){const p=Vn(t,i[d],o);a=Ne(p.top,a),f=wt(p.right,f),g=wt(p.bottom,g),u=Ne(p.left,u)}return{width:f-u,height:g-a,x:u,y:a}}function Go(e){const{width:t,height:n}=lr(e);return{width:t,height:n}}function Jo(e,t,n){const r=nt(t),o=it(t),s=n==="fixed",i=dt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ge(0);function f(){a.x=Kt(o)}if(r||!r&&!s)if((fn(t)!=="body"||dn(o))&&(c=jt(t)),r){const p=dt(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&f();s&&!r&&o&&f();const g=o&&!r&&!s?ur(o,c):Ge(0),u=i.left+c.scrollLeft-a.x-g.x,d=i.top+c.scrollTop-a.y-g.y;return{x:u,y:d,width:i.width,height:i.height}}function en(e){return rt(e).position==="static"}function kn(e,t){if(!nt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return it(e)===n&&(n=n.ownerDocument.body),n}function dr(e,t){const n=Be(e);if(un(e))return n;if(!nt(e)){let o=Ct(e);for(;o&&!_t(o);){if(Ae(o)&&!en(o))return o;o=Ct(o)}return n}let r=kn(e,t);for(;r&&Nr(r)&&en(r);)r=kn(r,t);return r&&_t(r)&&en(r)&&!Kn(r)?n:r||_r(e)||n}const Qo=async function(e){const t=this.getOffsetParent||dr,n=this.getDimensions,r=await n(e.floating);return{reference:Jo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zo(e){return rt(e).direction==="rtl"}const pr={convertOffsetParentRelativeRectToViewportRelativeRect:$o,getDocumentElement:it,getClippingRect:Xo,getOffsetParent:dr,getElementRects:Qo,getClientRects:zo,getDimensions:Go,getScale:yt,isElement:Ae,isRTL:Zo};function gr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function es(e,t){let n=null,r;const o=it(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const f=e.getBoundingClientRect(),{left:g,top:u,width:d,height:p}=f;if(c||t(),!d||!p)return;const m=Ot(u),y=Ot(o.clientWidth-(g+d)),b=Ot(o.clientHeight-(u+p)),h=Ot(g),x={rootMargin:-m+"px "+-y+"px "+-b+"px "+-h+"px",threshold:Ne(0,wt(1,a))||1};let w=!0;function S(C){const P=C[0].intersectionRatio;if(P!==a){if(!w)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!gr(f,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return i(!0),s}function Hn(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,f=wn(e),g=o||s?[...f?rn(f):[],...t?rn(t):[]]:[];g.forEach(h=>{o&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const u=f&&c?es(f,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(h=>{let[R]=h;R&&R.target===f&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),f&&!a&&p.observe(f),t&&p.observe(t));let m,y=a?dt(e):null;a&&b();function b(){const h=dt(e);y&&!gr(y,h)&&n(),y=h,m=requestAnimationFrame(b)}return n(),()=>{var h;g.forEach(R=>{o&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),u?.(),(h=p)==null||h.disconnect(),p=null,a&&cancelAnimationFrame(m)}}const ts=Ho,ns=No,rs=Fo,os=Bo,ss=Vo,is=_o,cs=(e,t,n)=>{const r=new Map,o={platform:pr,...n},s={...o.platform,_c:r};return Lo(e,t,{...o,platform:s})};var ls=typeof document<"u",as=function(){},kt=ls?l.useLayoutEffect:as;function Ut(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ut(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ut(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Nn(e,t){const n=mr(e);return Math.round(t*n)/n}function tn(e){const t=l.useRef(e);return kt(()=>{t.current=e}),t}function us(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:f}=e,[g,u]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=l.useState(r);Ut(d,r)||p(r);const[m,y]=l.useState(null),[b,h]=l.useState(null),R=l.useCallback(E=>{E!==C.current&&(C.current=E,y(E))},[]),x=l.useCallback(E=>{E!==P.current&&(P.current=E,h(E))},[]),w=s||m,S=i||b,C=l.useRef(null),P=l.useRef(null),T=l.useRef(g),L=a!=null,_=tn(a),X=tn(o),B=tn(f),k=l.useCallback(()=>{if(!C.current||!P.current)return;const E={placement:t,strategy:n,middleware:d};X.current&&(E.platform=X.current),cs(C.current,P.current,E).then(W=>{const A={...W,isPositioned:B.current!==!1};I.current&&!Ut(T.current,A)&&(T.current=A,Br.flushSync(()=>{u(A)}))})},[d,t,n,X,B]);kt(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(E=>({...E,isPositioned:!1})))},[f]);const I=l.useRef(!1);kt(()=>(I.current=!0,()=>{I.current=!1}),[]),kt(()=>{if(w&&(C.current=w),S&&(P.current=S),w&&S){if(_.current)return _.current(w,S,k);k()}},[w,S,k,_,L]);const H=l.useMemo(()=>({reference:C,floating:P,setReference:R,setFloating:x}),[R,x]),Y=l.useMemo(()=>({reference:w,floating:S}),[w,S]),F=l.useMemo(()=>{const E={position:n,left:0,top:0};if(!Y.floating)return E;const W=Nn(Y.floating,g.x),A=Nn(Y.floating,g.y);return c?{...E,transform:"translate("+W+"px, "+A+"px)",...mr(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:A}},[n,c,Y.floating,g.x,g.y]);return l.useMemo(()=>({...g,update:k,refs:H,elements:Y,floatingStyles:F}),[g,k,H,Y,F])}const fs=(e,t)=>{const n=ts(e);return{name:n.name,fn:n.fn,options:[e,t]}},ds=(e,t)=>{const n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}},ps=(e,t)=>({fn:is(e).fn,options:[e,t]}),gs=(e,t)=>{const n=rs(e);return{name:n.name,fn:n.fn,options:[e,t]}},ms=(e,t)=>{const n=os(e);return{name:n.name,fn:n.fn,options:[e,t]}},hs=(e,t)=>{const n=ss(e);return{name:n.name,fn:n.fn,options:[e,t]}};function hr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wr(),s=tr()!=null,i=Tt(()=>new io({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new co,floatingId:o,syncOnly:!1,nested:s})).current;return J(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ae(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function xs(e={}){const{nodeId:t,externalTree:n}=e,r=hr(e),o=e.rootContext||r,s=o.useState("referenceElement"),i=o.useState("floatingElement"),c=o.useState("domReferenceElement"),a=o.useState("open"),f=o.useState("floatingId"),[g,u]=l.useState(null),[d,p]=l.useState(void 0),[m,y]=l.useState(void 0),b=l.useRef(null),h=nr(n),R=l.useMemo(()=>({reference:s,floating:i,domReference:c}),[s,i,c]),x=us({...e,elements:{...R,...g&&{reference:g}}}),w=Ae(d)?d:null,S=m===void 0?o.state.floatingElement:m;o.useSyncedValue("referenceElement",d??null),o.useSyncedValue("domReferenceElement",d===void 0?c:w),o.useSyncedValue("floatingElement",S);const C=l.useCallback(B=>{const k=Ae(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;u(k),x.refs.setReference(k)},[x.refs]),P=l.useCallback(B=>{(Ae(B)||B===null)&&(b.current=B,p(B)),(Ae(x.refs.reference.current)||x.refs.reference.current===null||B!==null&&!Ae(B))&&x.refs.setReference(B)},[x.refs,p]),T=l.useCallback(B=>{y(B),x.refs.setFloating(B)},[x.refs]),L=l.useMemo(()=>({...x.refs,setReference:P,setFloating:T,setPositionReference:C,domReference:b}),[x.refs,P,T,C]),_=l.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),X=l.useMemo(()=>({...x,dataRef:o.context.dataRef,open:a,onOpenChange:o.setOpen,events:o.context.events,floatingId:f,refs:L,elements:_,nodeId:t,rootStore:o}),[x,L,_,t,o,a,f]);return J(()=>{c&&(b.current=c)},[c]),J(()=>{o.context.dataRef.current.floatingContext=X;const B=h?.nodesRef.current.find(k=>k.id===t);B&&(B.context=X)}),l.useMemo(()=>({...x,context:X,refs:L,elements:_,rootStore:o}),[x,L,_,X,o])}const ys="Escape";function Xt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Pt(e,t){return Xt(t,e===Qn||e===pn,e===Yt||e===qt)}function nn(e,t,n){return Xt(t,e===pn,n?e===Yt:e===qt)||e==="Enter"||e===" "||e===""}function ws(e,t,n){return Xt(t,n?e===Yt:e===qt,e===pn)}function bs(e,t,n,r){const o=n?e===qt:e===Yt,s=e===Qn;return t==="both"||t==="horizontal"&&r?e===ys:Xt(t,o,s)}function Rs(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:a=!1,nested:f=!1,rtl:g=!1,virtual:u=!1,focusItemOnOpen:d="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:y=void 0,orientation:b="vertical",parentOrientation:h,id:R,resetOnPointerLeave:x=!0,externalTree:w,grid:S}=t,C=S!=null,P="rootStore"in e?e.rootStore:e,T=P.useState("open"),L=P.useState("floatingElement"),_=P.useState("domReferenceElement"),X=P.context.dataRef,B=Gn(L),k=Ur(_),I=Ye(B),H=tr(),Y=nr(w),F=l.useRef(d),E=l.useRef(i??-1),W=l.useRef(null),A=l.useRef(!0),v=ue(M=>{o(E.current===-1?null:E.current,M)}),N=l.useRef(!!L),me=l.useRef(T),q=l.useRef(!1),ye=l.useRef(!1),he=l.useRef(null),O=Ye(y),j=Ye(T),le=Ye(i),Ce=Ye(x),Q=Nt(),ne=Nt(),se=ue(()=>{function M(G){u?Y?.events.emit("virtualfocus",G):he.current=lo(G,{sync:q.current,preventScroll:!0})}const D=n.current[E.current],Z=ye.current;D&&M(D),(q.current?G=>G():G=>Q.request(G))(()=>{const G=n.current[E.current]||D;if(!G)return;D||M(G),we&&(Z||!A.current)&&G.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J(()=>{X.current.orientation=b},[X,b]),J(()=>{s&&(T&&L?(E.current=i??-1,F.current&&i!=null&&(ye.current=!0,v())):N.current&&(E.current=-1,v()))},[s,T,L,i,v]),J(()=>{if(s){if(!T){q.current=!1;return}if(L)if(r==null){if(q.current=!1,le.current!=null)return;if(N.current&&(E.current=-1,se()),(!me.current||!N.current)&&F.current&&(W.current!=null||F.current===!0&&W.current==null)){let M=0;const D=()=>{n.current[0]==null?(M<2&&(M?V=>ne.request(V):queueMicrotask)(D),M+=1):(E.current=W.current==null||nn(W.current,b,g)||f?Jt(n):Tn(n),W.current=null,v())};D()}}else Cn(n.current,r)||(E.current=r,se(),ye.current=!1)}},[s,T,L,r,le,f,n,b,g,v,se,ne]),J(()=>{if(!s||L||!Y||u||!N.current)return;const M=Y.nodesRef.current,D=M.find(G=>G.id===H)?.context?.elements.floating,Z=Qt(ot(_??D??null)),V=M.some(G=>G.context&&at(G.context.elements.floating,Z));D&&!V&&A.current&&D.focus({preventScroll:!0})},[s,L,_,Y,H,u]),J(()=>{me.current=T,N.current=!!L}),J(()=>{T||(W.current=null,F.current=d)},[T,d]);const Se=r!=null,fe=ue(M=>{if(!j.current)return;const D=n.current.indexOf(M.currentTarget);D!==-1&&(E.current!==D||r!==D)&&(E.current=D,v(M))}),de=ue(()=>h??Y?.nodesRef.current.find(M=>M.id===H)?.context?.dataRef?.current.orientation),xe=ue(()=>Jt(n,O.current)),te=ue(M=>{if(A.current=!1,q.current=!0,M.which===229||!j.current&&M.currentTarget===I.current)return;if(f&&bs(M.key,b,g,C)){Pt(M.key,de())||et(M),P.setOpen(!1,_e(An,M.nativeEvent)),nt(_)&&(u?Y?.events.emit("virtualfocus",_):_.focus());return}const D=E.current,Z=Jt(n,y),V=Tn(n,y);if(k||(M.key==="Home"&&(et(M),E.current=Z,v(M)),M.key==="End"&&(et(M),E.current=V,v(M))),S!=null){const G=S(M,E.current,n,b,a,g,y,Z,V);if(G!=null&&(E.current=G,v(M)),b==="both")return}if(Pt(M.key,b)){if(et(M),T&&!u&&Qt(M.currentTarget.ownerDocument)===M.currentTarget){E.current=nn(M.key,b,g)?Z:V,v(M);return}nn(M.key,b,g)?a?D>=V?c&&D!==n.current.length?E.current=-1:(q.current=!1,E.current=Z):E.current=Mt(n.current,{startingIndex:D,disabledIndices:y}):E.current=Math.min(V,Mt(n.current,{startingIndex:D,disabledIndices:y})):a?D<=Z?c&&D!==-1?E.current=n.current.length:(q.current=!1,E.current=V):E.current=Mt(n.current,{startingIndex:D,decrement:!0,disabledIndices:y}):E.current=Math.max(Z,Mt(n.current,{startingIndex:D,decrement:!0,disabledIndices:y})),Cn(n.current,E.current)&&(E.current=-1),v(M)}}),we=l.useMemo(()=>({onFocus(D){q.current=!0,fe(D)},onClick:({currentTarget:D})=>D.focus({preventScroll:!0}),onMouseMove(D){q.current=!0,ye.current=!1,p&&fe(D)},onPointerLeave(D){if(!j.current||!A.current||D.pointerType==="touch")return;q.current=!0;const Z=D.relatedTarget;if(!(!p||n.current.includes(Z))&&Ce.current&&(he.current?.(),he.current=null,E.current=-1,v(D),!u)){const V=I.current,G=Qt(ot(V));V&&at(V,G)&&V.focus({preventScroll:!0})}}}),[fe,j,I,p,n,v,Ce,u]),ce=l.useMemo(()=>u&&T&&Se&&{"aria-activedescendant":`${R}-${r}`},[u,T,Se,R,r]),ie=l.useMemo(()=>({"aria-orientation":b==="both"?void 0:b,...k?{}:ce,onKeyDown(M){if(M.key==="Tab"&&M.shiftKey&&T&&!u){const D=qn(M.nativeEvent);if(D&&!at(I.current,D))return;et(M),P.setOpen(!1,_e(Jn,M.nativeEvent)),nt(_)&&_.focus();return}te(M)},onPointerMove(){A.current=!0}}),[ce,te,I,b,k,P,T,u,_]),re=l.useMemo(()=>{function M(V){P.setOpen(!0,_e(An,V.nativeEvent,V.currentTarget))}function D(V){d==="auto"&&rr(V.nativeEvent)&&(F.current=!u)}function Z(V){F.current=d,d==="auto"&&ao(V.nativeEvent)&&(F.current=!0)}return{onKeyDown(V){const G=P.select("open");A.current=!1;const ke=V.key.startsWith("Arrow"),We=ws(V.key,de(),g),Me=Pt(V.key,b),Fe=(f?We:Me)||V.key==="Enter"||V.key.trim()==="";if(u&&G)return te(V);if(!(!G&&!m&&ke)){if(Fe){const ae=Pt(V.key,de());W.current=f&&ae?null:V.key}if(f){We&&(et(V),G?(E.current=xe(),v(V)):M(V));return}Me&&(le.current!=null&&(E.current=le.current),et(V),!G&&m?M(V):te(V),G&&v(V))}},onFocus(V){P.select("open")&&!u&&(E.current=-1,v(V))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:D,onClick:D}},[te,d,xe,f,v,P,m,b,de,g,le,u]),$=l.useMemo(()=>({...ce,...re}),[ce,re]);return l.useMemo(()=>s?{reference:$,floating:ie,item:we,trigger:re}:{},[s,$,ie,re,we])}function Ss(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:c,enabled:a=!0,resetMs:f=750,selectedIndex:g=null}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),p=vt(),m=l.useRef(""),y=l.useRef(g??o??-1),b=l.useRef(null),h=ue(w=>{function S(I){const H=r?.current[I];return!H||zr(H)}function C(I){return S(I)?i==null||!$r(on,I,i):!1}function P(I,H,Y=0){if(I.length===0)return-1;const F=(Y%I.length+I.length)%I.length,E=H.toLowerCase();for(let W=0;W<I.length;W+=1){const A=(F+W)%I.length;if(!(!I[A]?.toLowerCase().startsWith(E)||!C(A)))return A}return-1}const T=n.current;if(m.current.length>0&&w.key===" "&&(et(w),c?.(!0)),m.current.length>0&&m.current[0]!==" "&&P(T,m.current)===-1&&w.key!==" "&&c?.(!1),T==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;d&&w.key!==" "&&(et(w),c?.(!0));const L=m.current==="";L&&(y.current=g??o??-1),T.every((I,H)=>I&&C(H)?I[0]?.toLowerCase()!==I[1]?.toLowerCase():!0)&&m.current===w.key&&(m.current="",y.current=b.current),m.current+=w.key,p.start(f,()=>{m.current="",y.current=b.current,c?.(!1)});const B=((L?g??o??-1:y.current)??0)+1,k=P(T,m.current,B);k!==-1?(s?.(k),b.current=k):w.key!==" "&&(m.current="",c?.(!1))}),R=ue(w=>{const S=w.relatedTarget,C=u.select("domReferenceElement"),P=u.select("floatingElement");at(C,S)||at(P,S)||(p.clear(),m.current="",y.current=b.current,c?.(!1))});J(()=>{!d&&g!==null||(p.clear(),b.current=null,m.current!==""&&(m.current=""))},[d,g,p]),J(()=>{d&&m.current===""&&(y.current=g??o??-1)},[d,g,o]);const x=l.useMemo(()=>({onKeyDown:h,onBlur:R}),[h,R]);return l.useMemo(()=>a?{reference:x,floating:x}:{},[a,x])}const vs=l.createContext(void 0);function xr(){return l.useContext(vs)?.direction??"ltr"}const Es=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:f,padding:g=0,offsetParent:u="real"}=st(e,t)||{};if(f==null)return{};const d=ir(g),p={x:n,y:r},m=yn(o),y=xn(m),b=await i.getDimensions(f),h=m==="y",R=h?"top":"left",x=h?"bottom":"right",w=h?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[m]-p[m]-s.floating[y],C=p[m]-s.reference[m],P=u==="real"?await i.getOffsetParent?.(f):c.floating;let T=c.floating[w]||s.floating[y];(!T||!await i.isElement?.(P))&&(T=c.floating[w]||s.floating[y]);const L=S/2-C/2,_=T/2-b[y]/2-1,X=Math.min(d[R],_),B=Math.min(d[x],_),k=X,I=T-b[y]-B,H=T/2-b[y]/2+L,Y=cn(k,H,I),F=!a.arrow&&ut(o)!=null&&H!==Y&&s.reference[y]/2-(H<k?X:B)-b[y]/2<0,E=F?H<k?H-k:H-I:0;return{[m]:p[m]+E,data:{[m]:Y,centerOffset:H-Y-E,...F&&{alignmentOffset:E}},reset:F}}}),Cs=(e,t)=>({...Es(e),options:[e,t]}),Ts=hs().fn,As={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await Ts(e)).data?.referenceHidden||s}}}},Ht={sideX:"left",sideY:"top"},Ci={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,a=Be(o),f=a.getComputedStyle(o);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:t,y:n,data:Ht};const u=await s.getOffsetParent?.(o);let d={width:0,height:0};if(i==="fixed"&&a?.visualViewport)d={width:a.visualViewport.width,height:a.visualViewport.height};else if(u===a){const R=ot(o);d={width:R.documentElement.clientWidth,height:R.documentElement.clientHeight}}else await s.isElement?.(u)&&(d=await s.getDimensions(u));const p=Ve(c);let m=t,y=n;p==="left"&&(m=d.width-(t+r.width)),p==="top"&&(y=d.height-(n+r.height));const b=p==="left"?"right":Ht.sideX,h=p==="top"?"bottom":Ht.sideY;return{x:m,y,data:{sideX:b,sideY:h}}}};function yr(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function _n(e,t,n){const{rects:r,placement:o}=e;return{side:yr(t,Ve(o),n),align:ut(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Is(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:a=5,sticky:f=!1,arrowPadding:g=5,disableAnchorTracking:u=!1,inline:d,keepMounted:p=!1,floatingRootContext:m,mounted:y,collisionAvoidance:b,shiftCrossAxis:h=!1,nodeId:R,adaptiveOrigin:x,lazyFlip:w=!1,externalTree:S}=e,[C,P]=l.useState(null);!y&&C!==null&&P(null);const T=b.side||"flip",L=b.align||"flip",_=b.fallbackAxisSide||"end",X=typeof t=="function"?t:void 0,B=ue(X),k=X?B:t,I=Ye(t),H=Ye(y),F=xr()==="rtl",E=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[r],W=s==="center"?E:`${E}-${s}`;let A=a;const v=1,N=r==="bottom"?v:0,me=r==="top"?v:0,q=r==="right"?v:0,ye=r==="left"?v:0;typeof A=="number"?A={top:A+N,right:A+ye,bottom:A+me,left:A+q}:A&&(A={top:(A.top||0)+N,right:(A.right||0)+ye,bottom:(A.bottom||0)+me,left:(A.left||0)+q});const he={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:A},O=l.useRef(null),j=Ye(o),le=Ye(i),Ce=typeof o!="function"?o:0,Q=typeof i!="function"?i:0,ne=[];d&&ne.push(d),ne.push(fs(ee=>{const pe=_n(ee,r,F),ve=typeof j.current=="function"?j.current(pe):j.current,Re=typeof le.current=="function"?le.current(pe):le.current;return{mainAxis:ve,crossAxis:Re,alignmentAxis:Re}},[Ce,Q,F,r]));const se=L==="none"&&T!=="shift",Se=!se&&(f||h||T==="shift"),fe=T==="none"?null:gs({...he,padding:{top:A.top+v,right:A.right+v,bottom:A.bottom+v,left:A.left+v},mainAxis:!h&&T==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),de=se?null:ds(ee=>{const pe=ot(ee.elements.floating).documentElement;return{...he,rootBoundary:h?{x:0,y:0,width:pe.clientWidth,height:pe.clientHeight}:void 0,mainAxis:L!=="none",crossAxis:Se,limiter:f||h?void 0:ps(ve=>{if(!O.current)return{};const{width:Re,height:Te}=O.current.getBoundingClientRect(),be=je(Ve(ve.placement)),Oe=be==="y"?Re:Te,ze=be==="y"?A.left+A.right:A.top+A.bottom;return{offset:Oe/2+ze/2}})}},[he,f,h,A,L]);T==="shift"||L==="shift"||s==="center"?ne.push(de,fe):ne.push(fe,de),ne.push(ms({...he,apply({elements:{floating:ee},availableWidth:pe,availableHeight:ve,rects:Re}){if(!H.current)return;const Te=ee.style;Te.setProperty("--available-width",`${pe}px`),Te.setProperty("--available-height",`${ve}px`);const be=Be(ee).devicePixelRatio||1,{x:Oe,y:ze,width:qe,height:ct}=Re.reference,Pe=(Math.round((Oe+qe)*be)-Math.round(Oe*be))/be,Ke=(Math.round((ze+ct)*be)-Math.round(ze*be))/be;Te.setProperty("--anchor-width",`${Pe}px`),Te.setProperty("--anchor-height",`${Ke}px`)}}),Cs(ee=>({element:O.current||ot(ee.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(ee){const{elements:pe,middlewareData:ve,placement:Re,rects:Te,y:be}=ee,Oe=Ve(Re),ze=je(Oe),qe=O.current,ct=ve.arrow?.x||0,Pe=ve.arrow?.y||0,Ke=qe?.clientWidth||0,ht=qe?.clientHeight||0,lt=ct+Ke/2,xt=Pe+ht/2,K=Math.abs(ve.shift?.y||0),ge=Te.reference.height/2,Ee=typeof o=="function"?o(_n(ee,r,F)):o,De=K>Ee,Xe={top:`${lt}px calc(100% + ${Ee}px)`,bottom:`${lt}px ${-Ee}px`,left:`calc(100% + ${Ee}px) ${xt}px`,right:`${-Ee}px ${xt}px`}[Oe],Ze=`${lt}px ${Te.reference.y+ge-be}px`;return pe.floating.style.setProperty("--transform-origin",Se&&ze==="y"&&De?Ze:Xe),{}}},As,x),J(()=>{!y&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,m]);const xe=l.useMemo(()=>({elementResize:!u&&typeof ResizeObserver<"u",layoutShift:!u&&typeof IntersectionObserver<"u"}),[u]),{refs:te,elements:we,x:ce,y:ie,middlewareData:re,update:$,placement:M,context:D,isPositioned:Z,floatingStyles:V}=xs({rootContext:m,open:p?y:void 0,placement:W,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...ee)=>Hn(...ee,xe),nodeId:R,externalTree:S}),{sideX:G,sideY:ke}=re.adaptiveOrigin||Ht,We=Z?n:"fixed",Me=l.useMemo(()=>{const ee=x?{position:We,[G]:ce,[ke]:ie}:{position:We,...V};return Z||(ee.opacity=0),ee},[x,We,G,ce,ke,ie,V,Z]),Fe=l.useRef(null);J(()=>{if(!y)return;const ee=I.current,pe=typeof ee=="function"?ee():ee,Re=(Bn(pe)?pe.current:pe)||null||null;Re!==Fe.current&&(te.setPositionReference(Re),Fe.current=Re)},[y,te,k,I]),l.useEffect(()=>{if(!y)return;const ee=I.current;typeof ee!="function"&&Bn(ee)&&ee.current!==Fe.current&&(te.setPositionReference(ee.current),Fe.current=ee.current)},[y,te,k,I]),l.useEffect(()=>{if(p&&y&&we.reference&&we.floating)return Hn(we.reference,we.floating,$,xe)},[p,y,we,$,xe]);const ae=Ve(M),Ue=yr(r,ae,F),$e=ut(M)||"center",He=!!re.hide?.referenceHidden;J(()=>{w&&y&&Z&&P(ae)},[w,y,Z,ae]);const Je=l.useMemo(()=>({position:"absolute",top:re.arrow?.y,left:re.arrow?.x}),[re.arrow]),Qe=re.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:Me,arrowStyles:Je,arrowRef:O,arrowUncentered:Qe,side:Ue,align:$e,physicalSide:ae,anchorHidden:He,refs:te,context:D,isPositioned:Z,update:$}),[Me,Je,O,Qe,Ue,$e,ae,He,te,D,Z,$])}function Bn(e){return e!=null&&"current"in e}function wr(e){return e==="starting"?jr:zt}function Ms(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),gt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},wr(r),o],stateAttributesMapping:or})}function Os(e){const t=l.useRef(""),n=l.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:l.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function br(e,t){const n=l.useRef(e),r=ue(t);J(()=>{n.current!==e&&r(n.current)},[e,r]),J(()=>{n.current=e},[e])}function Ps(e,t){const n=ue((s,i)=>{(typeof e=="function"?e():e)||t(i||(Yr?"touch":""))}),{onClick:r,onPointerDown:o}=Os(n);return l.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Ds(e){const[t,n]=l.useState(null),r=Ps(e,n);return br(e,o=>{o&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Ls(e){const[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Fs(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wn({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[s,i]=l.useState(t),c=o?e:s,a=l.useCallback(f=>{o||i(f)},[]);return[c,a]}const Rr=l.createContext(null),Sr=l.createContext(null);function mt(){const e=l.useContext(Rr);if(e===null)throw new Error(It(60));return e}function vr(){const e=l.useContext(Sr);if(e===null)throw new Error(It(61));return e}let Un=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Vs={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Rt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ks={disabled:!1,...Rt},Hs={valid(e){return e===null?null:e?{[Un.valid]:""}:{[Un.invalid]:""}}},Ns={invalid:void 0,name:void 0,validityData:{state:Vs,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,touched:Rt.touched,setTouched:Le,dirty:Rt.dirty,setDirty:Le,filled:Rt.filled,setFilled:Le,focused:Rt.focused,setFocused:Le,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ks,markedDirtyRef:{current:!1},registerFieldControl:Le,validation:{getValidationProps:(e,t=zt)=>t,inputRef:{current:null},registerInput:Le,commit:async()=>{},change:Le}},_s=l.createContext(Ns);function bn(e=!0){const t=l.useContext(_s);if(t.setValidityData===Le&&!e)throw new Error(It(28));return t}function Bs(e,t,n,r,o=!0,s){const{registerFieldControl:i}=bn(),c=l.useRef(null);c.current||(c.current=Symbol()),J(()=>{const a=c.current;return!a||!o?void 0:(i(a,{controlRef:e,getValue:r,id:t,name:s,value:n}),()=>{i(a,void 0)})},[e,o,r,t,s,i,n])}const Ws=l.createContext({controlId:void 0,registerControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function Er(){return l.useContext(Ws)}function Cr(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Er(),i=uo(t),c=n?o:void 0,a=Tt(()=>Symbol("labelable-control")),f=l.useRef(!1),g=l.useRef(t!=null),u=ue(()=>{!f.current||s===Le||(f.current=!1,s(a.current,void 0))});return J(()=>{if(s===Le)return;let d;if(n){const p=r?.current;Ae(p)&&p.closest("label")!=null?d=t??null:d=c??i}else if(t!=null)g.current=!0,d=t;else if(g.current)d=i;else{u();return}if(d===void 0){u();return}f.current=!0,s(a.current,d)},[t,r,c,s,n,i,a,u]),l.useEffect(()=>u,[u]),o??i}const Us=(e,t)=>Object.is(e,t);function pt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function $s(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:pt(t,r,n))}function Et(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:pt(r,t,n))}function zs(e,t,n){return e.filter(r=>!pt(t,r,n))}function an(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function js(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Tr(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Ar(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return an(e)}function ft(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?an(e.value):an(e)}function Ir(e,t,n){function r(){return Ar(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=Tr(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function Ys(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(Ie.jsx(l.Fragment,{children:Ir(o,t,n)},s)),r),[])}const U={id:oe(e=>e.id),labelId:oe(e=>e.labelId),modal:oe(e=>e.modal),multiple:oe(e=>e.multiple),items:oe(e=>e.items),itemToStringLabel:oe(e=>e.itemToStringLabel),itemToStringValue:oe(e=>e.itemToStringValue),isItemEqualToValue:oe(e=>e.isItemEqualToValue),value:oe(e=>e.value),hasSelectedValue:oe(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ft(t,r)!==""}),hasNullItemLabel:oe((e,t)=>t?js(e.items):!1),open:oe(e=>e.open),mounted:oe(e=>e.mounted),forceMount:oe(e=>e.forceMount),transitionStatus:oe(e=>e.transitionStatus),openMethod:oe(e=>e.openMethod),activeIndex:oe(e=>e.activeIndex),selectedIndex:oe(e=>e.selectedIndex),isActive:oe((e,t)=>e.activeIndex===t),isSelected:oe((e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>pt(t,o,n)):pt(t,r,n)}),isSelectedByFocus:oe((e,t)=>e.selectedIndex===t),popupProps:oe(e=>e.popupProps),triggerProps:oe(e=>e.triggerProps),triggerElement:oe(e=>e.triggerElement),positionerElement:oe(e=>e.positionerElement),listElement:oe(e=>e.listElement),popupSide:oe(e=>e.popupSide),scrollUpArrowVisible:oe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:oe(e=>e.scrollDownArrowVisible),hasScrollArrows:oe(e=>e.hasScrollArrows)},qs=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Ks(){return l.useContext(qs)}function Xs(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}const tt=1;function Mr(e,t){return Math.max(0,e-t)}function Gs(e,t){if(t<=0)return 0;const n=bt(e,0,t),r=n,o=t-n,s=r<=tt,i=o<=tt;return s&&i?r<=o?0:t:s?0:i?t:n}function Ti(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:c,name:a,form:f,autoComplete:g,disabled:u=!1,readOnly:d=!1,required:p=!1,modal:m=!0,actionsRef:y,inputRef:b,onOpenChangeComplete:h,items:R,multiple:x=!1,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C=Us,highlightItemOnHover:P=!0,children:T}=e,{clearErrors:L}=Ks(),{setDirty:_,setTouched:X,setFocused:B,validityData:k,setFilled:I,name:H,disabled:Y,validation:F,validationMode:E}=bn(),W=Cr({id:t}),A=Y||u,v=H??a,[N,me]=Wn({controlled:n,default:x?r??on:r,name:"Select",state:"value"}),[q,ye]=Wn({controlled:s,default:i,name:"Select",state:"open"}),he=l.useRef([]),O=l.useRef([]),j=l.useRef(null),le=l.useRef(null),Ce=l.useRef(0),Q=l.useRef(null),ne=l.useRef([]),se=l.useRef(!1),Se=l.useRef(null),fe=l.useRef(null),de=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=l.useRef(!1),{mounted:te,setMounted:we,transitionStatus:ce}=sr(q),{openMethod:ie,triggerProps:re}=Ds(q),$=Tt(()=>new Gr({id:W,labelId:void 0,modal:m,multiple:x,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,value:N,open:q,mounted:te,transitionStatus:ce,items:R,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,M=z($,U.activeIndex),D=z($,U.selectedIndex),Z=z($,U.triggerElement),V=z($,U.positionerElement),G=Ls(ie),ke=ie??G??null,We=l.useMemo(()=>x?"":ft(N,S),[x,N,S]),Me=l.useMemo(()=>x&&Array.isArray(N)?N.map(K=>ft(K,S)):ft(N,S),[x,N,S]),Fe=Ye($.state.triggerElement),ae=ue(()=>Me);Bs(Fe,W,N,ae,!A,a);const Ue=l.useRef(N),$e=x?Array.isArray(N)&&N.length>0:N!=null&&ft(N,S)!=="";J(()=>{N!==Ue.current&&$.set("forceMount",!0)},[$,N]),J(()=>{I($e)},[$e,I]),J(function(){const ge=ne.current;let Ee;if(x){const De=Array.isArray(N)?N:[];if(De.length===0)Ee=null;else{const Xe=De[De.length-1],Ze=Et(ge,Xe,C);Ee=Ze===-1?null:Ze}}else{const De=Et(ge,N,C);Ee=De===-1?null:De}Ee===null&&(fe.current=null),!q&&$.set("selectedIndex",Ee)},[$e,x,q,N,ne,C,$,fe]);function He(K){const ge=k.initialValue;return Array.isArray(K)&&Array.isArray(ge)?!Xs(K,ge,(Ee,De)=>pt(Ee,De,C)):K!==ge}br(N,()=>{L(v),_(He(N)),F.change(N)});const Je=ue((K,ge)=>{c?.(K,ge),!ge.isCanceled&&(ye(K),!K&&(ge.reason===Jn||ge.reason===Jr)&&(X(!0),B(!1),E==="onBlur"&&F.commit(N)))}),Qe=ue(()=>{we(!1),$.update({activeIndex:null,openMethod:null}),h?.(!1)});gn({enabled:!y,open:q,ref:j,onComplete(){q||Qe()}}),l.useImperativeHandle(y,()=>({unmount:Qe}),[Qe]);const ee=ue((K,ge)=>{o?.(K,ge),!ge.isCanceled&&me(K)}),pe=ue(()=>{const K=$.state.listElement||j.current;if(!K)return;const ge=Mr(K.scrollHeight,K.clientHeight),Ee=Gs(K.scrollTop,ge),De=Ee>0,Xe=Ee<ge;$.state.scrollUpArrowVisible!==De&&$.set("scrollUpArrowVisible",De),$.state.scrollDownArrowVisible!==Xe&&$.set("scrollDownArrowVisible",Xe)}),ve=hr({open:q,onOpenChange:Je,elements:{reference:Z,floating:V}}),Re=Oo(ve,{enabled:!d&&!A,event:"mousedown"}),Te=fo(ve),be=Rs(ve,{enabled:!d&&!A,listRef:he,activeIndex:M,selectedIndex:D,disabledIndices:on,onNavigate(K){K===null&&!q||$.set("activeIndex",K)},focusItemOnHover:P}),Oe=Ss(ve,{enabled:!d&&!A&&(q||!x),listRef:O,activeIndex:M,selectedIndex:D,disabledIndices:K=>Fs(he.current[K]),onMatch(K){q?$.set("activeIndex",K):ee(ne.current[K],_e("none"))},onTyping(K){se.current=K}}),ze=l.useMemo(()=>{const K=sn(Oe.reference,be.reference,Te.reference,Re.reference,re);return W&&(K.id=W),K},[Re.reference,Oe.reference,be.reference,Te.reference,re,W]),qe=l.useMemo(()=>sn(po,Oe.floating,be.floating,Te.floating),[Oe.floating,be.floating,Te.floating]),ct=be.item??zt;go(()=>{$.update({popupProps:qe,triggerProps:ze})}),J(()=>{$.update({id:W,modal:m,multiple:x,value:N,open:q,mounted:te,transitionStatus:ce,popupProps:qe,triggerProps:ze,items:R,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,openMethod:ke})},[$,W,m,x,N,q,te,ce,qe,ze,R,w,S,C,ke]);const Pe=l.useMemo(()=>({store:$,name:v,required:p,disabled:A,readOnly:d,multiple:x,highlightItemOnHover:P,setValue:ee,setOpen:Je,listRef:he,popupRef:j,scrollHandlerRef:le,handleScrollArrowVisibility:pe,scrollArrowsMountedCountRef:Ce,itemProps:ct,valueRef:Q,valuesRef:ne,labelsRef:O,typingRef:se,selectionRef:de,firstItemTextRef:Se,selectedItemTextRef:fe,validation:F,onOpenChangeComplete:h,alignItemWithTriggerActiveRef:xe,initialValueRef:Ue}),[$,v,p,A,d,x,P,ee,Je,ct,F,h,pe]),Ke=qr(b,F.inputRef),ht=x&&Array.isArray(N)&&N.length>0,lt=x?void 0:v,xt=l.useMemo(()=>!x||!Array.isArray(N)||!v?null:N.map(K=>{const ge=ft(K,S);return Ie.jsx("input",{type:"hidden",form:f,name:v,value:ge,disabled:A},ge)}),[x,N,f,v,S,A]);return Ie.jsx(Rr.Provider,{value:Pe,children:Ie.jsxs(Sr.Provider,{value:ve,children:[T,Ie.jsx("input",{...F.getValidationProps(A,{onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(K){if(K.nativeEvent.defaultPrevented||A||d)return;const ge=K.currentTarget.value,Ee=_e(mn,K.nativeEvent);function De(){if(x)return;const Xe=ge.toLowerCase();let Ze=ne.current.findIndex(Gt=>ft(Gt,S).toLowerCase()===Xe||Ar(Gt,w).toLowerCase()===Xe);Ze===-1&&(Ze=ne.current.findIndex((Gt,Fr)=>{const vn=O.current[Fr];return vn!=null&&vn.toLowerCase()===Xe}));const Sn=Ze===-1?void 0:ne.current[Ze];Sn!=null&&ee(Sn,Ee)}$.set("forceMount",!0),queueMicrotask(De)}}),id:W&&lt==null?`${W}-hidden-input`:void 0,form:f,name:lt,autoComplete:g,value:We,disabled:A,required:p&&!ht,readOnly:d,ref:Ke,style:v?Kr:Xr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),xt]})})}function Js(e,t){return e??t}function Qs(e){const t=e.getBoundingClientRect(),n=Be(e);if(Qr)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,c=parseFloat(r.height)||0,a=parseFloat(o.width)||0,f=parseFloat(o.height)||0,g=Math.max(t.width,i,a),u=Math.max(t.height,c,f),d=g-t.width,p=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Dt=2,Zs=400,ei={...mo,...Hs,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ai=l.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:c=!0,style:a,...f}=t,{setTouched:g,setFocused:u,validationMode:d,state:p,disabled:m}=bn(),{labelId:y}=Er(),{store:b,setOpen:h,selectionRef:R,validation:x,readOnly:w,required:S,alignItemWithTriggerActiveRef:C,disabled:P}=mt(),T=m||P||i,L=z(b,U.open),_=z(b,U.mounted),X=z(b,U.value),B=z(b,U.triggerProps),k=z(b,U.positionerElement),I=z(b,U.listElement),H=z(b,U.popupSide),Y=z(b,U.id),F=z(b,U.labelId),E=z(b,U.hasSelectedValue),W=_&&k?H:null,A=s??Y,v=Js(y,F);Cr({id:A});const N=Ye(k),me=l.useRef(null),{getButtonProps:q,buttonRef:ye}=Zn({disabled:T,native:c}),he=ue(se=>{b.set("triggerElement",se)}),O=vt(),j=vt(),le=vt();l.useEffect(()=>{if(L)return le.start(Zs,()=>{R.current.allowUnselectedMouseUp=!0,R.current.allowSelectedMouseUp=!0}),()=>{le.clear()};R.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},j.clear()},[L,R,j,le]);const Ce=sn(B,{id:A,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?I?.id??Gn(k)?.id:void 0,"aria-labelledby":v,"aria-readonly":w||void 0,"aria-required":S||void 0,tabIndex:T?-1:0,onFocus(se){u(!0),L&&C.current&&h(!1,_e(mn,se.nativeEvent)),O.start(0,()=>{b.set("forceMount",!0)})},onBlur(se){at(k,se.relatedTarget)||(g(!0),u(!1),d==="onBlur"&&x.commit(X))},onMouseDown(se){if(L)return;const Se=ot(se.currentTarget);function fe(de){if(!me.current)return;const xe=de.target;if(at(me.current,xe)||at(N.current,xe))return;const te=Qs(me.current);de.clientX>=te.left-Dt&&de.clientX<=te.right+Dt&&de.clientY>=te.top-Dt&&de.clientY<=te.bottom+Dt||h(!1,_e(Zr,de))}j.start(0,()=>{Se.addEventListener("mouseup",fe,{once:!0})})}},f,q),Q=x.getValidationProps(T,Ce);Q.role="combobox";const ne={...p,open:L,disabled:T,value:X,readOnly:w,popupSide:W,placeholder:!E};return gt("button",t,{ref:[n,me,ye,he],state:ne,stateAttributesMapping:ei,props:Q})}),ti={value:()=>null},Ii=l.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:c,...a}=t,{store:f,valueRef:g}=mt(),u=z(f,U.value),d=z(f,U.items),p=z(f,U.itemToStringLabel),m=z(f,U.hasSelectedValue),y=!m&&i!=null&&s==null,b=z(f,U.hasNullItemLabel,y),h={value:u,placeholder:!m};let R=null;return typeof s=="function"?R=s(u):s!=null?R=s:!m&&i!=null&&!b?R=i:Array.isArray(u)?R=Ys(u,d,p):R=Ir(u,d,p),gt("span",t,{state:h,ref:[n,g],props:[{children:R},a],stateAttributesMapping:ti})}),ni=l.createContext(void 0),Mi=l.forwardRef(function(t,n){const{store:r}=mt(),o=z(r,U.mounted),s=z(r,U.forceMount);return o||s?Ie.jsx(ni.Provider,{value:!0,children:Ie.jsx(eo,{ref:n,...t})}):null}),Or=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function ri(){return l.useContext(Or)}function oi(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ue(o),i=l.useRef(0),c=Tt(ii).current,a=Tt(si).current,[f,g]=l.useState(0),u=l.useRef(f),d=ue((h,R)=>{a.set(h,R??null),u.current+=1,g(u.current)}),p=ue(h=>{a.delete(h),u.current+=1,g(u.current)}),m=l.useMemo(()=>{const h=new Map;return Array.from(a.keys()).filter(x=>x.isConnected).sort(ci).forEach((x,w)=>{const S=a.get(x)??{};h.set(x,{...S,index:w})}),h},[a,f]);J(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const h=new MutationObserver(R=>{const x=new Set,w=S=>x.has(S)?x.delete(S):x.add(S);R.forEach(S=>{S.removedNodes.forEach(w),S.addedNodes.forEach(w)}),x.size===0&&(u.current+=1,g(u.current))});return m.forEach((R,x)=>{x.parentElement&&h.observe(x.parentElement,{childList:!0})}),()=>{h.disconnect()}},[m]),J(()=>{u.current===f&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),i.current=m.size),s(m)},[s,m,n,r,f]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{r&&(r.current=[])},[r]);const y=ue(h=>(c.add(h),()=>{c.delete(h)}));J(()=>{c.forEach(h=>h(m))},[c,m]);const b=l.useMemo(()=>({register:d,unregister:p,subscribeMapChange:y,elementsRef:n,labelsRef:r,nextIndexRef:i}),[d,p,y,n,r,i]);return Ie.jsx(Or.Provider,{value:b,children:t})}function si(){return new Map}function ii(){return new Set}function ci(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Pr=l.createContext(void 0);function li(){const e=l.useContext(Pr);if(!e)throw new Error(It(59));return e}function $t(e,t){e&&Object.assign(e.style,t)}const ai={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ui=20;function fi(e,t,n,r){const[o,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=ot(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-ui)},[e,t,n]),ho(e&&(!t||o),r)}const di={position:"fixed"},Oi=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:c="bottom",align:a="center",sideOffset:f=0,alignOffset:g=0,collisionBoundary:u="clipping-ancestors",collisionPadding:d,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:y,alignItemWithTrigger:b=!0,collisionAvoidance:h=to,style:R,...x}=t,{store:w,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:P,selectedItemTextRef:T,valuesRef:L,initialValueRef:_,popupRef:X,setValue:B}=mt(),k=vr(),I=z(w,U.open),H=z(w,U.mounted),Y=z(w,U.modal),F=z(w,U.value),E=z(w,U.openMethod),W=z(w,U.positionerElement),A=z(w,U.triggerElement),v=z(w,U.isItemEqualToValue),N=z(w,U.transitionStatus),me=l.useRef(null),q=l.useRef(null),[ye,he]=l.useState(b),O=H&&ye&&E!=="touch";!H&&ye!==b&&he(b),J(()=>{H||(U.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,H]),l.useImperativeHandle(P,()=>O),fi((O||Y)&&I,E==="touch",W,A);const j=Is({anchor:r,floatingRootContext:k,positionMethod:o,mounted:H,side:c,sideOffset:f,align:a,alignOffset:g,arrowPadding:p,collisionBoundary:u,collisionPadding:d,sticky:m,disableAnchorTracking:y??O,collisionAvoidance:h,keepMounted:!0}),le=O?"none":j.side,Ce=O?di:j.positionerStyles,Q={open:I,side:le,align:j.align,anchorHidden:j.anchorHidden};J(()=>{w.set("popupSide",j.side)},[w,j.side]);const ne=ue(xe=>{w.set("positionerElement",xe)}),se=Ms(t,Q,{styles:Ce,transitionStatus:N,props:x,refs:[n,ne],hidden:!H,inert:!I}),Se=l.useRef(0),fe=ue(xe=>{if(xe.size===0&&Se.current===0||L.current.length===0)return;const te=Se.current;if(Se.current=xe.size,xe.size===te)return;const we=_e(mn);if(te!==0&&!w.state.multiple&&F!==null&&Et(L.current,F,v)===-1){const ie=_.current,$=ie!=null&&Et(L.current,ie,v)!==-1?ie:null;B($,we),$===null&&(w.set("selectedIndex",null),T.current=null)}if(te!==0&&w.state.multiple&&Array.isArray(F)){const ce=re=>Et(L.current,re,v)!==-1,ie=F.filter(re=>ce(re));(ie.length!==F.length||ie.some(re=>!$s(F,re,v)))&&(B(ie,we),ie.length===0&&(w.set("selectedIndex",null),T.current=null))}if(I&&O){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ce={height:""};$t(W,ce),$t(X.current,ce)}}),de=l.useMemo(()=>({...j,side:le,alignItemWithTriggerActive:O,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:me,scrollDownArrowRef:q}),[j,le,O,he]);return Ie.jsx(oi,{elementsRef:S,labelsRef:C,onMapChange:fe,children:Ie.jsxs(Pr.Provider,{value:de,children:[H&&Y&&Ie.jsx(xo,{inert:no(!I),cutout:A}),se]})})}),Lt="base-ui-disable-scrollbar",$n={className:Lt,getElement(e){return Ie.jsx("style",{nonce:e,href:Lt,precedence:"base-ui:low",children:`.${Lt}{scrollbar-width:none}.${Lt}::-webkit-scrollbar{display:none}`})}},pi=l.createContext(void 0);function gi(e){return l.useContext(pi)}const mi=l.createContext(void 0),hi={disableStyleElements:!1};function xi(){return l.useContext(mi)??hi}const yi={...or,...er},Pi=l.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...c}=t,{store:a,popupRef:f,onOpenChangeComplete:g,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:y,handleScrollArrowVisibility:b,scrollHandlerRef:h,listRef:R,highlightItemOnHover:x}=mt(),{side:w,align:S,alignItemWithTriggerActive:C,isPositioned:P,setControlledAlignItemWithTrigger:T}=li(),L=gi()!=null,_=vr(),X=xr(),{nonce:B,disableStyleElements:k}=xi(),I=z(a,U.id),H=z(a,U.open),Y=z(a,U.openMethod),F=z(a,U.mounted),E=z(a,U.popupProps),W=z(a,U.transitionStatus),A=z(a,U.triggerElement),v=z(a,U.positionerElement),N=z(a,U.listElement),me=l.useRef(!1),q=l.useRef(!1),ye=l.useRef({}),he=Nt(),O=ue(Q=>{if(!v||!f.current||!q.current)return;if(me.current||!C){b();return}const ne=v.style.top==="0px",se=v.style.bottom==="0px";if(!ne&&!se){b();return}const Se=jn(v),fe=St(v.getBoundingClientRect().height,"y",Se),de=ot(v),xe=Be(v),te=xe.getComputedStyle(v),we=parseFloat(te.marginTop),ce=parseFloat(te.marginBottom),ie=zn(xe.getComputedStyle(f.current)),re=Math.min(de.documentElement.clientHeight-we-ce,ie),$=Q.scrollTop,M=Ft(Q);let D=0,Z=null,V=!1,G=!1;const ke=ae=>{v.style.height=`${ae}px`},We=(ae,Ue)=>{const $e=bt(ae,0,re-fe);$e>0&&ke(fe+$e),Q.scrollTop=Ue,re-(fe+$e)<=tt&&(me.current=!0),b()},Me=ne?M-$:$,Fe=Math.min(fe+Me,re);if(D=Fe,Me<=tt){We(Me,ne?M:0);return}if(re-Fe>tt)ne?G=!0:Z=0;else if(V=!0,se&&$<M){const ae=fe+Me-re;Z=$-(Me-ae)}if(D=Math.ceil(D),D!==0&&ke(D),G||Z!=null){const ae=Ft(Q),Ue=G?ae:bt(Z,0,ae);Math.abs(Q.scrollTop-Ue)>tt&&(Q.scrollTop=Ue)}(V||D>=re-tt)&&(me.current=!0),b()});l.useImperativeHandle(h,()=>O,[O]),gn({open:H,ref:f,onComplete(){H&&g?.(!0)}});const j={open:H,transitionStatus:W,side:w,align:S};J(()=>{!v||!f.current||Object.keys(ye.current).length||(ye.current={top:v.style.top||"0",left:v.style.left||"0",right:v.style.right,height:v.style.height,bottom:v.style.bottom,minHeight:v.style.minHeight,maxHeight:v.style.maxHeight,marginTop:v.style.marginTop,marginBottom:v.style.marginBottom})},[f,v]),J(()=>{H||C||(q.current=!1,me.current=!1,$t(v,ye.current))},[H,C,v,f]),J(()=>{const Q=f.current;if(!H||!A||!v||!Q||C&&!P||a.state.transitionStatus==="ending")return;if(!C){q.current=!0,he.request(b),Q.style.removeProperty("--transform-origin");return}const ne=wi(Q);Q.style.removeProperty("--transform-origin");try{let se=m.current;se?.isConnected||(se=!U.hasSelectedValue(a.state)&&p.current?.isConnected?p.current:null);const Se=d.current,fe=Be(v),de=fe.getComputedStyle(v),xe=fe.getComputedStyle(Q),te=ot(A),we=jn(A),ce=Vt(A.getBoundingClientRect(),we),ie=Vt(v.getBoundingClientRect(),we),re=ce.height,$=N||Q,M=$.scrollHeight,D=parseFloat(xe.borderBottomWidth),Z=parseFloat(de.marginTop)||10,V=parseFloat(de.marginBottom)||10,G=parseFloat(de.minHeight)||100,ke=zn(xe),We=5,Me=5,Fe=20,ae=te.documentElement.clientHeight-Z-V,Ue=te.documentElement.clientWidth,$e=ae-ce.bottom+re;let He,Je=X==="rtl"?ce.right-ie.width:ce.left,Qe=0;if(se&&Se){const Pe=Vt(Se.getBoundingClientRect(),we);He=Vt(se.getBoundingClientRect(),we),Je=ie.left+(X==="rtl"?Pe.right-He.right:Pe.left-He.left);const Ke=Pe.top-ce.top+Pe.height/2;Qe=He.top-ie.top+He.height/2-Ke}const ee=$e+Qe+V+D;let pe=Math.min(ae,ee);const ve=ae-Z-V,Re=ee-pe,Te=Ue-Me;v.style.left=`${bt(Je,We,Te-ie.width)}px`,v.style.height=`${pe}px`,v.style.maxHeight="none",v.style.marginTop=`${Z}px`,v.style.marginBottom=`${V}px`,Q.style.height="100%";const be=Ft($),Oe=Re>=be-tt;Oe&&(pe=Math.min(ae,ie.height)-(Re-be));const ze=ce.top<Fe||ce.bottom>ae-Fe||Math.ceil(pe)+tt<Math.min(M,G),qe=(fe.visualViewport?.scale??1)!==1&&ro;if(ze||qe){q.current=!0,$t(v,ye.current),T(!1);return}const ct=Math.max(G,pe);if(Oe){const Pe=Math.max(0,ae-ee);v.style.top=ie.height>=ve?"0":`${Pe}px`,v.style.height=`${pe}px`,$.scrollTop=Ft($)}else v.style.bottom="0",$.scrollTop=Re;if(He){const Pe=ie.top,Ke=ie.height,ht=He.top+He.height/2,lt=Ke>0?(ht-Pe)/Ke*100:50,xt=bt(lt,0,100);Q.style.setProperty("--transform-origin",`50% ${xt}%`)}(ct===ae||pe>=ke)&&(me.current=!0),b(),x&&a.state.selectedIndex===null&&a.state.activeIndex===null&&R.current[0]!=null&&a.set("activeIndex",0),q.current=!0}finally{ne()}},[a,H,v,A,d,p,m,f,b,C,T,he,N,R,x,X,P]),l.useEffect(()=>{if(!C||!v||!H)return;const Q=Be(v);function ne(se){u(!1,_e(so,se))}return oo(Q,"resize",ne)},[u,C,v,H]);const le={...N?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${I}-list`},onKeyDown(Q){L&&wo.has(Q.key)&&Q.stopPropagation()},onScroll(Q){N||O(Q.currentTarget)},...C&&{style:N?{height:"100%"}:ai}},Ce=gt("div",t,{ref:[n,f],state:j,stateAttributesMapping:yi,props:[E,le,wr(W),{className:!N&&C?$n.className:void 0},c]});return Ie.jsxs(l.Fragment,{children:[!k&&$n.getElement(B),Ie.jsx(yo,{context:_,modal:!1,disabled:!F,openInteractionType:Y,returnFocus:i,restoreFocus:!0,children:Ce})]})});function zn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ft(e){return Mr(e.scrollHeight,e.clientHeight)}function jn(e){return pr.getScale(e)}function St(e,t,n){return e/n[t]}function Vt(e,t){return At({x:St(e.x,"x",t),y:St(e.y,"y",t),width:St(e.width,"x",t),height:St(e.height,"y",t)})}const Yn=[["transform","none"],["scale","1"],["translate","0 0"]];function wi(e){const{style:t}=e,n={};for(const[r,o]of Yn)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Yn){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}let Dr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function bi(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:c,subscribeMapChange:a,elementsRef:f,labelsRef:g,nextIndexRef:u}=ri(),d=l.useRef(-1),[p,m]=l.useState(s??(o===Dr.GuessFromOrder?()=>{if(d.current===-1){const h=u.current;u.current+=1,d.current=h}return d.current}:-1)),y=l.useRef(null),b=l.useCallback(h=>{if(y.current=h,p!==-1&&h!==null&&(f.current[p]=h,g)){const R=t!==void 0;g.current[p]=R?t:r?.current?.textContent??h.textContent}},[p,f,g,t,r]);return J(()=>{if(s!=null)return;const h=y.current;if(h)return i(h,n),()=>{c(h)}},[s,i,c,n]),J(()=>{if(s==null)return a(h=>{const R=y.current?h.get(y.current)?.index:null;R!=null&&m(R)})},[s,a,m]),{ref:b,index:p}}const Lr=l.createContext(void 0);function Rn(){const e=l.useContext(Lr);if(!e)throw new Error(It(57));return e}const Di=l.memo(l.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:c,disabled:a=!1,nativeButton:f=!1,...g}=t,u=l.useRef(null),d=bi({label:c,textRef:u,indexGuessBehavior:Dr.GuessFromOrder}),{store:p,itemProps:m,setOpen:y,setValue:b,selectionRef:h,typingRef:R,valuesRef:x,multiple:w,selectedItemTextRef:S,disabled:C,readOnly:P}=mt(),T=z(p,U.isActive,d.index),L=z(p,U.open),_=z(p,U.isSelected,i),X=z(p,U.isSelectedByFocus,d.index),B=z(p,U.isItemEqualToValue),k=d.index,I=k!==-1,H=l.useRef(null);J(()=>{if(!I)return;const O=x.current;return O[k]=i,()=>{delete O[k]}},[I,k,i,x]),J(()=>{if(!I)return;const O=p.state.value;let j=O;w&&Array.isArray(O)&&(j=O.length>0?O[O.length-1]:void 0),j!==void 0&&pt(i,j,B)&&(p.set("selectedIndex",k),u.current&&(S.current=u.current))},[I,k,w,B,p,i,S]);const Y=l.useRef(null),F=l.useRef("mouse"),E=l.useRef(!1),{getButtonProps:W,buttonRef:A}=Zn({disabled:a,focusableWhenDisabled:!0,native:f,composite:!0}),v={disabled:a,selected:_,highlighted:T};function N(O){if(C||P)return;const j=p.state.value;if(w){const le=Array.isArray(j)?j:[],Ce=_?zs(le,i,B):[...le,i];b(Ce,_e(Zt,O))}else b(i,_e(Zt,O)),y(!1,_e(Zt,O))}function me(){h.current.dragY=0}const q={role:"option","aria-selected":_,tabIndex:L&&T?0:-1,onKeyDown(O){Y.current=O.key,p.set("activeIndex",k),O.key===" "&&R.current&&O.preventDefault()},onClick(O){const j=O.type==="click"&&F.current!=="touch",le=O.nativeEvent.pointerType,Ce=j&&rr(O.nativeEvent)&&(le!==void 0||T),Q=j&&!Ce&&!E.current;E.current=!1,!(O.type==="keydown"&&Y.current===null)&&(a||O.type==="keydown"&&Y.current===" "&&R.current||Q||(Y.current=null,N(O.nativeEvent)))},onPointerEnter(O){F.current=O.pointerType},onPointerMove(O){if(O.pointerType==="mouse"&&O.buttons===1){const j=h.current;j.dragY+=O.movementY,j.dragY**2>=64&&(j.allowUnselectedMouseUp=!0)}},onPointerDown(O){F.current=O.pointerType,E.current=!0,me()},onMouseUp(){if(me(),a||F.current==="touch"||E.current)return;const O=!h.current.allowSelectedMouseUp&&_,j=!h.current.allowUnselectedMouseUp&&!_;O||j||(E.current=!0,H.current?.click(),E.current=!1)}},ye=gt("div",t,{ref:[A,n,d.ref,H],state:v,props:[m,q,g,W]}),he=l.useMemo(()=>({selected:_,index:k,textRef:u,selectedByFocus:X,hasRegistered:I}),[_,k,u,X,I]);return Ie.jsx(Lr.Provider,{value:he,children:ye})})),Li=l.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=Rn();return r||o?Ie.jsx(Ri,{...t,ref:n}):null}),Ri=l.memo(l.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:c}=Rn(),a=l.useRef(null),{transitionStatus:f,setMounted:g}=sr(c),d=gt("span",e,{ref:[t,a],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:er});return gn({open:c,ref:a,onComplete(){c||g(!1)}}),d})),Fi=l.memo(l.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s,hasRegistered:i}=Rn(),{firstItemTextRef:c,selectedItemTextRef:a}=mt(),{render:f,className:g,style:u,...d}=t,p=l.useCallback(y=>{y&&(i&&r===0&&(c.current=y),i&&s&&(a.current=y))},[c,a,r,s,i]);return gt("div",t,{ref:[p,n,o],props:d})}));export{$n as A,Ei as C,ai as L,Ti as S,Ks as a,bn as b,Er as c,Wn as d,Bs as e,Hs as f,br as g,Ai as h,Ii as i,Mi as j,Oi as k,Pi as l,Di as m,Fi as n,Li as o,Oo as p,Ps as q,Is as r,U as s,fi as t,mt as u,Ms as v,Ci as w,gi as x,wr as y,li as z};
@@ -0,0 +1 @@
1
+ import{c as v,r as l,ar as X,al as q,aO as L,j as n,m as O,U as ee,V as y,G as s,Y as te,ay as ne,aP as ae,aC as ie,aD as se,aE as P,aQ as oe,aR as re,W as le,R as ce,S as ue,T as de,a4 as ge,aS as he,aT as pe,a0 as me,aU as be,K as fe,aV as xe,aW as ye,aX as ve,aY as je,aZ as Ne,a_ as ke,a$ as Se,aj as we}from"./main-D8wPoKmZ.js";import{b as G,l as E,u as Ce,L as A}from"./use-limits-display-prefs-yv7S34by.js";import{S as j,T as N,a as b,b as _,u as D}from"./use-native-settings-C1f8CH1M.js";import{P as Le}from"./pencil-BQqxAErk.js";import{C as Ge}from"./useScrollLock-jO1lwpRu.js";import{u as Ee}from"./useCurrency-C91tvaFI.js";import{S as T}from"./Select-ZozPfhKZ.js";import{I as Ae}from"./info-YUSGgHfZ.js";import{D as Ie}from"./download-DcJ2hsdQ.js";import"./Card-0VRAMCWY.js";import"./SelectItemText-CIU-BNpH.js";const Oe=[["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"}]],Pe=v("activity",Oe);const _e=[["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"}]],De=v("copy",_e);const Te=[["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"}]],Ue=v("grip-vertical",Te);const Me=[["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"}]],Re=v("languages",Me);const Fe=[["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"}]],He=v("log-out",Fe),$e=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach($e);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const Be=l.createContext(null);function ze(){const e=l.useRef(!1);return X(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ve(){const e=ze(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>q.postRender(i),[i]),t]}const U=e=>e===!0,We=e=>U(e===!0)||e==="id",Ze=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(Be),[r,c]=Ve(),u=l.useRef(null),g=i.id||o;u.current===null&&(We(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:U(a)&&i.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:h,children:e})},Ke="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Ye({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:y("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:n.jsx("span",{className:y("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:t,visibility:a,toggle:i,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))},f=()=>{c(null),g(null)},x=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ze,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=a[d]!==!1,k=r===d;return n.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,onDrop:x,className:y("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",k&&"opacity-40"),style:{cursor:k?"grabbing":"grab"},children:[n.jsx(Ue,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),G(d)?n.jsx(ee,{provider:G(d),size:18,className:y("pointer-events-none",Ke)}):null,n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:E(d)}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(Ye,{checked:p,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${E(d)}`})})]},d)})})})}function Qe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function Xe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function qe(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function et(e,t,a){const[i,o]=l.useState(()=>ne()),r=t&&a&&ae(),c=l.useCallback(async()=>{const u=!i;if(ie(u),o(u),!!u)try{await se(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function tt(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,x]=l.useState(!1),[d,p]=l.useState(""),[k,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[W,Z]=l.useState(null),K=l.useMemo(()=>Qe(e),[e]),Y=l.useMemo(()=>Xe(e),[e]),J=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:h,displayName:K,editingGithub:z,editingName:f,email:Y,githubError:W,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:V,setEditingName:x,setGithubError:Z,setGithubInput:B,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:k,userId:J}}function nt(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!i||!o)return;const r=await oe({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function at(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await re({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function it(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function st(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function ot(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function rt(e,t,a){const i=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await t({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),a?.()}})},[t,e,a]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function lt(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=qe(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({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)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function ct(){const e=te(),t=tt(e.user),a=et(e.getAccessToken,e.enabled,e.signedIn);nt(e.getAccessToken,e.signedIn,t.loadSetters);const i=at(e.getAccessToken,t),o=ot(t,i),r=rt(t,i,e.refreshDisplayName),c=lt(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:t.userId,name:it(t,{...o,...r}),github:st(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function M({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,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:i}),n.jsx("button",{type:"button",onClick:t,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:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!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")}),n.jsx(M,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function dt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),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")}),n.jsx(M,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function R({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,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:[n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function F({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function gt({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(N,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function ht({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:x}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(F,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(ut,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:n.jsx(gt,{name:e})})}function pt({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:x,startEditingGithub:d}=e;return n.jsx(F,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(dt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{label:s("settings.account.edit"),onClick:d}),n.jsx(N,{checked:x,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function mt(){const{openLoginModal:e}=le();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.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:t}){return n.jsxs(n.Fragment,{children:[n.jsx(ht,{name:e}),n.jsx(pt,{github:t})]})}function ft(){const e=ct();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(yt,{onSignOut:e.signOut}),children:[n.jsx(xt,{userId:e.userId}),n.jsx(vt,{settings:e}),n.jsx(jt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(Nt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(mt,{}):null}function xt({userId:e}){const[t,a]=ce.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),a(!0),globalThis.setTimeout(()=>a(!1),1200)}catch{a(!1)}};return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),n.jsxs("button",{type:"button",onClick:i,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:[t?n.jsx(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}):n.jsx(De,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?s("settings.account.copied"):s("settings.account.copy")]})]})}function yt({onSignOut:e}){return n.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:[n.jsx(He,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function vt({settings:e}){return e.showLocalCloudSync?n.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(N,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function jt({checked:e,disabled:t,onChange:a}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(N,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function Nt({visible:e,name:t,github:a}){return n.jsx(ue,{initial:!1,children:e?n.jsx(O.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:n.jsx(bt,{name:t,github:a})},"public-profile-fields"):null})}function kt(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:he},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:s("settings.appearance.theme.system"),Icon:me}]}function St(){return[{value:xe,label:s("settings.appearance.language.system")},{value:ye,label:s("settings.appearance.language.english")},{value:ve,label:s("settings.appearance.language.chinese")},{value:je,label:s("settings.appearance.language.traditional_chinese")},{value:Ne,label:s("settings.appearance.language.japanese")},{value:ke,label:s("settings.appearance.language.korean")}]}function wt(e){if(!e)return null;try{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function Ct(e,t){const a=s(`settings.appearance.currency.rate_source.${e}`),i=wt(t),o=i?s("settings.appearance.currency.rate_updated",{when:i}):s("settings.appearance.currency.rate_never");return`${a} · ${o}`}function Lt({locale:e,setLocale:t}){const a=St();return n.jsx(T,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:n.jsx(Re,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function Gt({currency:e,setCurrency:t}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return n.jsx(T,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Et({currency:e,rate:t,rateSource:a,rateFetchedAt:i}){if(e===fe)return n.jsx(n.Fragment,{children:s("settings.appearance.currency.hint")});const o=Ct(a,i);return n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${e}`}),n.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:n.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function At(){const{theme:e,setTheme:t}=de(),{locale:a,setLocale:i}=ge(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ee();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(_,{options:kt(),value:e,onChange:t})}),n.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(Lt,{locale:a,setLocale:i})}),n.jsx(b,{label:s("settings.appearance.currency.label"),hint:n.jsx(Et,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(Gt,{currency:o,setCurrency:g})})]})}function It(){const{available:e,settings:t,setSetting:a,runAction:i}=D();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,u=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[r?n.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(N,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("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:[n.jsx(Se,{className:y("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("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:[n.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Ot(){const{available:e,settings:t,runAction:a}=D(),i=e&&t?.version;return n.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:[i?n.jsxs(n.Fragment,{children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),n.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,n.jsxs("a",{href:we,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:[n.jsx(Pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function Pt({prefs:e}){return n.jsx(_,{options:[{value:A.USED,label:s("limits.settings.display_mode_used")},{value:A.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Vt(){const e=Ce();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(At,{}),n.jsx(It,{}),n.jsx(ft,{}),n.jsx(j,{title:s("settings.section.limits"),action:n.jsx(Pt,{prefs:e}),children:n.jsx(Je,{prefs:e})})]}),n.jsx(Ot,{})]})})})}export{Vt as SettingsPage};