@gup-fe/js-sdk 2.4.0 → 2.4.2

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.
@@ -16,7 +16,7 @@ Avoid returning a new reference inside your input selector, e.g.
16
16
  `));return f.cloneElement(s,o)}if(e&&typeof e=="string")return t0(e,n);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":ft(8))}function e0(e){const t=e.name;t.length!==0&&Kb.test(t)&&Jb.test(t)&&$b(`The \`render\` prop received a function named \`${t}\` that starts with an uppercase letter.`,"This usually means a React component was passed directly as `render={Component}`.","Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.","If this is an intentional render callback, rename it to start with a lowercase letter.","Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.","https://base-ui.com/r/invalid-render-prop")}function t0(e,t){return e==="button"?oe.createElement("button",{type:"button",...t,key:t.key}):e==="img"?oe.createElement("img",{alt:"",...t,key:t.key}):f.createElement(e,t)}let n0=(function(e){return e.frontmostHeight="--toast-frontmost-height",e})({});const Ul=f.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,...a}=t,c=Hu(),u=Gt(),l=f.useRef(!1),d=f.useRef(!1),p=f.useRef(!1),h=c.useState("isEmpty"),m=c.useState("toasts"),g=c.useState("focused"),v=c.useState("expanded"),y=c.useState("prevFocusElement"),C=m[0]?.height??0,S=f.useMemo(()=>m.some(_=>_.transitionStatus==="ending"),[m]);f.useEffect(()=>{const _=c.state.viewport;if(!_)return;function M(j){h||j.key==="F6"&&lt(j)!==_&&(j.preventDefault(),c.setPrevFocusElement(Pt(Ie(_))),_?.focus({preventScroll:!0}),c.pauseTimers(),c.setFocused(!0))}const A=tt(_);return Fe(A,"keydown",M)},[c,h]),f.useEffect(()=>{const _=c.state.viewport;if(!_||h)return;const M=tt(_);function A(B){lt(B)===M&&(c.setIsWindowFocused(!1),c.pauseTimers())}function j(B){if(B.relatedTarget)return;const U=lt(B),W=Pt(Ie(_));(U===M||!we(_,U)||!Ji(W))&&c.resumeTimers(),u.start(0,()=>c.setIsWindowFocused(!0))}return gn(Fe(M,"blur",A,!0),Fe(M,"focus",j,!0))},[c,u,h]),f.useEffect(()=>{const _=c.state.viewport;if(!_||h)return;const M=Ie(_);return Fe(M,"pointerdown",c.handleDocumentPointerDown,!0)},[h,c]);function E(_){const M=c.state.viewport;M&&(l.current=!0,_.relatedTarget===M?m[0]?.ref?.current?.focus():c.restoreFocusToPrevElement())}function b(_){_.key==="Tab"&&_.shiftKey&&lt(_.nativeEvent)===c.state.viewport&&(_.preventDefault(),c.restoreFocusToPrevElement(),c.resumeTimers())}function x(){const _=c.state.toasts.some(M=>M.transitionStatus==="ending");!c.state.isWindowFocused||_||p.current||!d.current||(c.resumeTimers(),c.setHovering(!1),d.current=!1)}f.useEffect(x,[S,c]);function T(){c.pauseTimers(),c.setHovering(!0),d.current=!1}function P(){S||p.current?d.current=!0:(c.resumeTimers(),c.setHovering(!1))}function z(_){_.pointerType==="touch"&&(p.current=!0)}function I(_){_.pointerType==="touch"&&(p.current=!1,x())}function D(){if(l.current){l.current=!1;return}g||Ji(Pt(Ie(c.state.viewport)))&&(c.setFocused(!0),c.pauseTimers())}function $(_){!g||we(c.state.viewport,_.relatedTarget)||(c.setFocused(!1),c.resumeTimers())}const V={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:T,onMouseMove:T,onMouseLeave:P,onFocus:D,onBlur:$,onKeyDown:b,onClick:D,onPointerDown:z,onPointerUp:I,onPointerCancel:I},N={expanded:v},O=qe("div",t,{ref:[n,c.setViewport],state:N,props:[V,{style:{[n0.frontmostHeight]:C?`${C}px`:void 0}},a,{children:w.jsxs(f.Fragment,{children:[!h&&y&&w.jsx(Sn,{onFocus:E}),i,!h&&y&&w.jsx(Sn,{onFocus:E})]})}]}),k=f.useMemo(()=>m.filter(_=>_.priority==="high"),[m]);return w.jsxs(f.Fragment,{children:[!h&&y&&w.jsx(Sn,{onFocus:E}),O,!g&&k.length>0&&w.jsx("div",{style:ss,children:k.map(_=>w.jsxs("div",{role:"alert","aria-atomic":!0,children:[w.jsx("div",{children:_.title}),w.jsx("div",{children:_.description})]},_.id))})]})});process.env.NODE_ENV!=="production"&&(Ul.displayName="ToastViewport");function cs(e){return zi(19)?e:e?"true":void 0}const pa=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(pa.displayName="ToastRootContext");function r0(){const e=f.useContext(pa);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.":ft(66));return e}let sr=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const o0={[sr.startingStyle]:""},s0={[sr.endingStyle]:""},tn={transitionStatus(e){return e==="starting"?o0:e==="ending"?s0:null}};function An(e){return e==null?e:"current"in e?e.current:e}function Bl(e,t=!1,n=!0){const r=ao();return ie((o,s=null)=>{r.cancel();const i=An(e);if(i==null)return;const a=i,c=()=>{Kt.flushSync(o)};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function u(){Promise.all(a.getAnimations().map(l=>l.finished)).then(()=>{s?.aborted||c()}).catch(()=>{if(n){s?.aborted||c();return}const l=a.getAnimations();!s?.aborted&&l.length>0&&l.some(d=>d.pending||d.playState!=="finished")&&u()})}if(t){const l=sr.startingStyle;if(!a.hasAttribute(l)){r.request(u);return}const d=new MutationObserver(()=>{a.hasAttribute(l)||(d.disconnect(),u())});d.observe(a,{attributes:!0,attributeFilter:[l]}),s?.addEventListener("abort",()=>d.disconnect(),{once:!0});return}r.request(u)})}function xn(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=ie(o),i=Bl(r,n,!1);f.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}let ir=(function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e})({});const i0=500,a0={style:{transition:"none"}},ha="data-base-ui-click-trigger",c0="data-base-ui-swipe-ignore",u0="data-swipe-ignore",Wl=`[${c0}]`,l0=`[${u0}]`,d0={fallbackAxisSide:"none"},f0={fallbackAxisSide:"end"},p0={clipPath:"inset(50%)",position:"fixed",top:0,left:0},h0={...tn,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},go=40,m0=10,Yn=.5,g0=1,y0=`${Wl},${l0}`;function Zl(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function v0(e){const n=tt(e).getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const a=i[1].split(", ").map(parseFloat);a.length===6?(r=a[4],o=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],o=a[13],s=a[0])}}return{x:r,y:o,scale:s}}const Gl=f.forwardRef(function(t,n){const{toast:r,render:o,className:s,swipeDirection:i=["down","right"],style:a,...c}=t,u=r.positionerProps?.anchor!==void 0;let l=[];u||(l=Array.isArray(i)?i:[i]);const d=l.length>0,p=Hu(),[h,m]=f.useState(void 0),[g,v]=f.useState(!1),[y,C]=f.useState(!1),[S,E]=f.useState(!1),[b,x]=f.useState({x:0,y:0}),[T,P]=f.useState({x:0,y:0,scale:1}),[z,I]=f.useState(),[D,$]=f.useState(),[V,N]=f.useState(null),O=f.useRef(null),k=f.useRef({x:0,y:0}),_=f.useRef({x:0,y:0,scale:1}),M=f.useRef(void 0),A=f.useRef(0),j=f.useRef(!1),B=f.useRef({x:0,y:0}),U=f.useRef(!1),W=p.useState("toastIndex",r.id),G=p.useState("toastVisibleIndex",r.id),Z=p.useState("toastOffsetY",r.id),X=p.useState("focused"),K=p.useState("expanded");xn({open:r.transitionStatus!=="ending",ref:O,onComplete(){r.transitionStatus==="ending"&&p.removeToast(r.id)}});const J=ie((R=!1)=>{const H=O.current;if(!H)return;const L=H.style.height;H.style.height="auto";const F=H.offsetHeight;H.style.height=L;function Q(){p.updateToastInternal(r.id,{ref:O,height:F,...r.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}R?Kt.flushSync(Q):Q()});he(J,[J]);function se(R,H){let L=R,F=H;return!l.includes("left")&&!l.includes("right")?L=R>0?R**Yn:-(Math.abs(R)**Yn):(!l.includes("right")&&R>0&&(L=R**Yn),!l.includes("left")&&R<0&&(L=-(Math.abs(R)**Yn))),!l.includes("up")&&!l.includes("down")?F=H>0?H**Yn:-(Math.abs(H)**Yn):(!l.includes("down")&&H>0&&(F=H**Yn),!l.includes("up")&&H<0&&(F=-(Math.abs(H)**Yn))),{x:L,y:F}}function ae(R){if(R.button!==0)return;R.pointerType==="touch"&&p.pauseTimers();const H=lt(R.nativeEvent);if(!(H&&H.closest(`button,a,input,textarea,[role="button"],${y0}`))){if(j.current=!1,M.current=void 0,A.current=0,k.current={x:R.clientX,y:R.clientY},B.current=k.current,O.current){const F=v0(O.current);_.current=F,P(F),x({x:F.x,y:F.y})}p.setHovering(!0),v(!0),C(!1),N(null),U.current=!0,O.current?.setPointerCapture(R.pointerId)}}function pe(R){if(!g)return;R.preventDefault(),U.current&&(k.current={x:R.clientX,y:R.clientY},U.current=!1);const{clientY:H,clientX:L,movementX:F,movementY:Q}=R;(Q<0&&H>B.current.y||Q>0&&H<B.current.y)&&(B.current={x:B.current.x,y:H}),(F<0&&L>B.current.x||F>0&&L<B.current.x)&&(B.current={x:L,y:B.current.y});const ne=L-k.current.x,te=H-k.current.y,ye=H-B.current.y,_e=L-B.current.x;if(!y&&Math.sqrt(ne*ne+te*te)>=g0&&(C(!0),V===null)){const He=l.includes("left")||l.includes("right"),nt=l.includes("up")||l.includes("down");if(He&&nt){const st=Math.abs(ne),Re=Math.abs(te);N(st>Re?"horizontal":"vertical")}}let Ee;if(!M.current)V==="vertical"?te>0?Ee="down":te<0&&(Ee="up"):V==="horizontal"?ne>0?Ee="right":ne<0&&(Ee="left"):Math.abs(ne)>=Math.abs(te)?Ee=ne>0?"right":"left":Ee=te>0?"down":"up",Ee&&l.includes(Ee)&&(M.current=Ee,A.current=Zl(Ee,ne,te),m(Ee));else{const Ge=M.current,He=Zl(Ge,_e,ye);He>go?(j.current=!1,m(Ge)):!(l.includes("left")&&l.includes("right"))&&!(l.includes("up")&&l.includes("down"))&&A.current-He>=m0&&(j.current=!0)}const Ce=se(ne,te);let Pe=_.current.x,Ve=_.current.y;V==="horizontal"?(l.includes("left")||l.includes("right"))&&(Pe+=Ce.x):(V==="vertical"||(l.includes("left")||l.includes("right"))&&(Pe+=Ce.x),(l.includes("up")||l.includes("down"))&&(Ve+=Ce.y)),x({x:Pe,y:Ve})}function Y(R){if(!g)return;if(v(!1),C(!1),N(null),O.current?.releasePointerCapture(R.pointerId),j.current){x({x:T.x,y:T.y}),m(void 0);return}let H=!1;const L=b.x-T.x,F=b.y-T.y;let Q;for(const ne of l){switch(ne){case"right":L>go&&(H=!0,Q="right");break;case"left":L<-go&&(H=!0,Q="left");break;case"down":F>go&&(H=!0,Q="down");break;case"up":F<-go&&(H=!0,Q="up");break}if(H)break}H?(m(Q),E(!0),p.closeToast(r.id)):(x({x:T.x,y:T.y}),m(void 0))}function me(){g&&(v(!1),C(!1),N(null),x({x:T.x,y:T.y}),m(void 0))}function ge(R){if(R.key==="Escape"){if(!O.current||!we(O.current,Pt(Ie(O.current))))return;p.closeToast(r.id)}}f.useEffect(()=>{if(!d)return;const R=O.current;if(!R)return;function H(L){we(R,lt(L))&&L.preventDefault()}return Fe(R,"touchmove",H,{passive:!1})},[d]);function fe(){if(!g&&b.x===T.x&&b.y===T.y&&!S)return{[ir.swipeMovementX]:"0px",[ir.swipeMovementY]:"0px"};const R=b.x-T.x,H=b.y-T.y;return{transition:g?"none":void 0,transform:g?`translateX(${b.x}px) translateY(${b.y}px) scale(${T.scale})`:void 0,[ir.swipeMovementX]:`${R}px`,[ir.swipeMovementY]:`${H}px`}}const le=r.priority==="high",ce={role:le?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":z,"aria-describedby":D,"aria-hidden":le&&!X?!0:void 0,onPointerDown:d?ae:void 0,onPointerMove:d?pe:void 0,onPointerUp:d?Y:void 0,onPointerCancel:d?me:void 0,onKeyDown:ge,inert:cs(r.limited),style:{...fe(),[ir.index]:r.transitionStatus==="ending"?W:G,[ir.offsetY]:`${Z}px`,[ir.height]:r.height?`${r.height}px`:void 0}},ve=f.useMemo(()=>({rootRef:O,toast:r,titleId:z,setTitleId:I,descriptionId:D,setDescriptionId:$,swiping:g,swipeDirection:h,recalculateHeight:J,index:W,visibleIndex:G,expanded:K}),[r,z,D,g,h,J,W,G,K]),ue={transitionStatus:r.transitionStatus,expanded:K,limited:r.limited||!1,type:r.type,swiping:ve.swiping,swipeDirection:ve.swipeDirection},Se=qe("div",t,{ref:[n,ve.rootRef],state:ue,stateAttributesMapping:h0,props:[ce,c]});return w.jsx(pa.Provider,{value:ve,children:Se})});process.env.NODE_ENV!=="production"&&(Gl.displayName="ToastRoot");const Dr={...f};let Yl=0;function b0(e,t="mui"){const[n,r]=f.useState(e),o=e||n;return f.useEffect(()=>{n==null&&(Yl+=1,r(`${t}-${Yl}`))},[n,t]),o}const Xl=Dr.useId;function Xn(e,t){if(Xl!==void 0){const n=Xl();return e??(t?`${t}-${n}`:n)}return b0(e,t)}const ql=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,children:a,...c}=t,{toast:u,setDescriptionId:l}=r0(),d=a??u.description,p=!!d,h=Xn(i);he(()=>{if(p)return l(h),()=>{l(void 0)}},[p,h,l]);const m={type:u.type},g=qe("p",t,{ref:n,state:m,props:{...c,id:h,children:d}});return p?g:null});process.env.NODE_ENV!=="production"&&(ql.displayName="ToastDescription");let ma;process.env.NODE_ENV!=="production"&&(ma=new Set);function ar(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");ma.has(t)||(ma.add(t),console.error(`Base UI: ${t}`))}}const Kl=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Kl.displayName="CompositeRootContext");function w0(e=!1){const t=f.useContext(Kl);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":ft(16));return t}function S0(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,a=r&&t===!1;return{props:f.useMemo(()=>{const u={onKeyDown(l){n&&t&&l.key!=="Tab"&&l.preventDefault()}};return r||(u.tabIndex=o,!s&&n&&(u.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(u["aria-disabled"]=n),s&&(!t||a)&&(u.disabled=n),u},[r,n,t,i,a,s,o])}}function Lr(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=f.useRef(null),a=w0(!0),c=s??a!==void 0,{props:u}=S0({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!i.current)return;const h=us(i.current);if(o){if(!h){const m=Dr.captureOwnerStack?.()||"";ar(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${m}`)}}else if(h){const m=Dr.captureOwnerStack?.()||"";ar(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${m}`)}},[o]);const l=f.useCallback(()=>{const h=i.current;us(h)&&c&&t&&u.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,u.disabled,c]);he(l,[l]);const d=f.useCallback((h={})=>{const{onClick:m,onMouseDown:g,onKeyUp:v,onKeyDown:y,onPointerDown:C,...S}=h;return En({type:o?"button":void 0,onClick(b){if(t){b.preventDefault();return}m?.(b)},onMouseDown(b){t||g?.(b)},onKeyDown(b){if(t||(as(b),y?.(b),b.baseUIHandlerPrevented))return;const x=b.target===b.currentTarget,T=b.currentTarget,P=us(T),z=!o&&E0(T),I=x&&(o?P:!z),D=b.key==="Enter",$=b.key===" ",V=T.getAttribute("role"),N=V?.startsWith("menuitem")||V==="option"||V==="gridcell";if(x&&c&&$){if(b.defaultPrevented&&N)return;b.preventDefault(),z||o&&P?(T.click(),b.preventBaseUIHandler()):I&&(m?.(b),b.preventBaseUIHandler());return}I&&(!o&&($||D)&&b.preventDefault(),!o&&D&&m?.(b))},onKeyUp(b){if(!t){if(as(b),v?.(b),b.target===b.currentTarget&&o&&c&&us(b.currentTarget)&&b.key===" "){b.preventDefault();return}b.baseUIHandlerPrevented||b.target===b.currentTarget&&!o&&!c&&b.key===" "&&m?.(b)}},onPointerDown(b){if(t){b.preventDefault();return}C?.(b)}},o?void 0:{role:"button"},u,S)},[t,u,c,o]),p=ie(h=>{i.current=h,l()});return{getButtonProps:d,buttonRef:p}}function us(e){return it(e)&&e.tagName==="BUTTON"}function E0(e){return!!(e?.tagName==="A"&&e?.href)}function x0(e,t){return t!=null&&!fo(t)?0:typeof e=="function"?e():e}function ga(e,t,n){const r=x0(e,n);return typeof r=="number"?r:r?.[t]}function Jl(e){return typeof e=="function"?e():e}function Ql(e,t){return t||e==="click"||e==="mousedown"}const cr="none",Fr="trigger-press",Lt="trigger-hover",ya="outside-press",va="item-press",C0="close-press",ur="focus-out",ed="escape-key",T0="close-watcher",ba="list-navigation",O0="cancel-open",td="imperative-action",ls="swipe",P0="window-resize";function Ae(e,t,n,r){let o=!1,s=!1;const i=mt;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}function _0(e,t,n){const r=mt;return{reason:e,event:t??new Event("base-ui"),...r}}function vt(e){const t=wt(I0,e).current;return t.next=e,he(t.effect),t}function I0(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ds(e){return`data-base-ui-${e}`}let fs=0;function ps(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(fs);const s=()=>e?.focus({preventScroll:n});if(o)return s(),Ct;const i=requestAnimationFrame(s);return fs=i,()=>{fs===i&&(cancelAnimationFrame(i),fs=0)}}const wa={inert:new WeakMap,"aria-hidden":new WeakMap},nd="data-base-ui-inert",Sa={inert:new WeakSet,"aria-hidden":new WeakSet};let yo=new WeakMap,Ea=0;function k0(e){return Sa[e]}function rd(e){return e?kr(e)?e.host:rd(e.parentNode):null}const xa=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=rd(n);return e.contains(r)?r:null}).filter(n=>n!=null),od=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},sd=(e,t,n)=>{const r=[],o=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{kt(i)!=="script"&&(t.has(i)?o(i):r.push(i))})};return o(e),r};function R0(e,t,n,r,{mark:o=!0,markerIgnoreElements:s=[]}){const i=r?"inert":n?"aria-hidden":null;let a=null,c=null;const u=xa(t,e),l=o?xa(t,s):[],d=new Set(l),p=o?sd(t,od(u),new Set(u)).filter(g=>!d.has(g)):[],h=[],m=[];if(i){const g=wa[i],v=k0(i);c=v,a=g;const y=xa(t,Array.from(t.querySelectorAll("[aria-live]"))),C=u.concat(y);sd(t,od(C),new Set(C)).forEach(E=>{const b=E.getAttribute(i),x=b!==null&&b!=="false",T=(g.get(E)||0)+1;g.set(E,T),h.push(E),T===1&&x&&v.add(E),x||E.setAttribute(i,i==="inert"?"":"true")})}return o&&p.forEach(g=>{const v=(yo.get(g)||0)+1;yo.set(g,v),m.push(g),v===1&&g.setAttribute(nd,"")}),Ea+=1,()=>{a&&h.forEach(g=>{const y=(a.get(g)||0)-1;a.set(g,y),y||(!c?.has(g)&&i&&g.removeAttribute(i),c?.delete(g))}),o&&m.forEach(g=>{const v=(yo.get(g)||0)-1;yo.set(g,v),v||g.removeAttribute(nd)}),Ea-=1,Ea||(wa.inert=new WeakMap,wa["aria-hidden"]=new WeakMap,Sa.inert=new WeakSet,Sa["aria-hidden"]=new WeakSet,yo=new WeakMap)}}function id(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0,markerIgnoreElements:s=[]}=t,i=Ie(e[0]).body;return R0(e,i,n,r,{mark:o,markerIgnoreElements:s})}const Ca=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ca.displayName="PortalContext");const ad=()=>f.useContext(Ca),N0=ds("portal");function cd(e={}){const{ref:t,container:n,componentProps:r=mt,elementProps:o}=e,s=Xn(),a=ad()?.portalNode,[c,u]=f.useState(null),[l,d]=f.useState(null),p=ie(v=>{v!==null&&d(v)}),h=f.useRef(null);he(()=>{if(n===null){h.current&&(h.current=null,d(null),u(null));return}if(s==null)return;const v=(n&&(ji(n)?n:n.current))??a??document.body;if(v==null){h.current&&(h.current=null,d(null),u(null));return}h.current!==v&&(h.current=v,d(null),u(v))},[n,a,s]);const m=qe("div",r,{ref:[t,p],props:[{id:s,[N0]:""},o]});return{portalNode:l,portalSubtree:c&&m?Kt.createPortal(m,c):null}}const hs=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,renderGuards:a,style:c,...u}=t,{portalNode:l,portalSubtree:d}=cd({container:o,ref:n,componentProps:t,elementProps:u}),p=f.useRef(null),h=f.useRef(null),m=f.useRef(null),g=f.useRef(null),[v,y]=f.useState(null),C=f.useRef(!1),S=v?.modal,E=v?.open,b=typeof a=="boolean"?a:!!v&&!v.modal&&v.open&&!!l;f.useEffect(()=>{if(!l||S)return;function T(P){l&&P.relatedTarget&&Ar(P)&&(P.type==="focusin"?C.current&&(Rl(l),C.current=!1):(Db(l),C.current=!0))}return gn(Fe(l,"focusin",T,!0),Fe(l,"focusout",T,!0))},[l,S]),f.useEffect(()=>{!l||E!==!1||(Rl(l),C.current=!1)},[E,l]);const x=f.useMemo(()=>({beforeOutsideRef:p,afterOutsideRef:h,beforeInsideRef:m,afterInsideRef:g,portalNode:l,setFocusManagerState:y}),[l]);return w.jsxs(f.Fragment,{children:[d,w.jsxs(Ca.Provider,{value:x,children:[b&&l&&w.jsx(Sn,{"data-type":"outside",ref:p,onFocus:T=>{if(Ar(T,l))m.current?.focus();else{const P=v?v.domReference:null;Il(P)?.focus()}}}),b&&l&&w.jsx("span",{"aria-owns":l.id,style:p0}),l&&Kt.createPortal(r,l),b&&l&&w.jsx(Sn,{"data-type":"outside",ref:h,onFocus:T=>{if(Ar(T,l))g.current?.focus();else{const P=v?v.domReference:null;ca(P)?.focus(),v?.closeOnFocusOut&&v?.onOpenChange(!1,Ae(ur,T.nativeEvent))}}})]})]})});process.env.NODE_ENV!=="production"&&(hs.displayName="FloatingPortal");function ud(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class M0{nodesRef={current:[]};events=ud();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Ta=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ta.displayName="FloatingNodeContext");const Oa=f.createContext(null);process.env.NODE_ENV!=="production"&&(Oa.displayName="FloatingTreeContext");const qn=()=>f.useContext(Ta)?.id||null,lr=e=>{const t=f.useContext(Oa);return e??t};function A0(e){const t=Xn(),n=lr(e),r=qn();return he(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function D0(e){const{children:t,id:n}=e,r=qn();return w.jsx(Ta.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function L0(e){const{children:t,externalTree:n}=e,r=wt(()=>n??new M0).current;return w.jsx(Oa.Provider,{value:r,children:t})}function F0(e,t){const n=tt(lt(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const ld=20;let Kn=[];function Pa(){Kn=Kn.filter(e=>e.deref()?.isConnected)}function V0(e){Pa(),e&&kt(e)!=="body"&&(Kn.push(new WeakRef(e)),Kn.length>ld&&(Kn=Kn.slice(-ld)))}function _a(){return Pa(),Kn[Kn.length-1]?.deref()}function z0(e){return e?aa(e)?e:ho(e)[0]||e:null}function dd(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=Pl(e).filter(s=>{const i=s.getAttribute("data-tabindex")||"";return aa(s)||s.hasAttribute("data-tabindex")&&!i.startsWith("-")}),o=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?o!=="0"&&e.setAttribute("tabindex","0"):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ms(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:c=!0,openInteractionType:u="",nextFocusableElement:l,previousFocusableElement:d,beforeContentFocusGuardRef:p,externalTree:h,getInsideElements:m}=e,g="rootStore"in t?t.rootStore:t,v=g.useState("open"),y=g.useState("domReferenceElement"),C=g.useState("floatingElement"),{events:S,dataRef:E}=g.context,b=ie(()=>E.current.floatingContext?.nodeId),x=o===!1,T=Ki(y)&&x,P=f.useRef(["content"]),z=vt(o),I=vt(s),D=vt(u),$=lr(h),V=ad(),N=f.useRef(!1),O=f.useRef(!1),k=f.useRef(!1),_=f.useRef(null),M=f.useRef(""),A=f.useRef(""),j=f.useRef(null),B=f.useRef(null),U=or(j,p,V?.beforeInsideRef),W=or(B,V?.afterInsideRef),G=Gt(),Z=Gt(),X=ao(),K=V!=null,J=lo(C),se=ie((Y=J)=>Y?ho(Y):[]),ae=ie(()=>m?.().filter(Y=>Y!=null)??[]);f.useEffect(()=>{if(r||!a)return;function Y(ge){ge.key==="Tab"&&we(J,Pt(Ie(J)))&&se().length===0&&!T&&Yt(ge)}const me=Ie(J);return Fe(me,"keydown",Y)},[r,y,J,a,P,T,se]),f.useEffect(()=>{if(r||!v)return;const Y=Ie(J);function me(){k.current=!1}function ge(le){const ce=lt(le),ve=ae(),ue=we(C,ce)||we(y,ce)||we(V?.portalNode,ce)||ve.some(Se=>Se===ce||we(Se,ce));k.current=!ue,A.current=le.pointerType||"keyboard",ce?.closest(`[${ha}]`)&&(O.current=!0)}function fe(){A.current="keyboard"}return gn(Fe(Y,"pointerdown",ge,!0),Fe(Y,"pointerup",me,!0),Fe(Y,"pointercancel",me,!0),Fe(Y,"keydown",fe,!0))},[r,C,y,J,v,V,ae]),f.useEffect(()=>{if(r||!c)return;const Y=Ie(J);function me(){O.current=!0,Z.start(0,()=>{O.current=!1})}function ge(ve){const ue=lt(ve);aa(ue)&&(_.current=ue)}function fe(ve){const ue=ve.relatedTarget,Se=ve.currentTarget,R=lt(ve);queueMicrotask(()=>{const H=b(),L=g.context.triggerElements,F=ae(),Q=ue?.hasAttribute(ds("focus-guard"))&&[j.current,B.current,V?.beforeInsideRef.current,V?.afterInsideRef.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,An(d),An(l)].includes(ue),ne=!(we(y,ue)||we(C,ue)||we(ue,C)||we(V?.portalNode,ue)||F.some(te=>te===ue||we(te,ue))||ue!=null&&L.hasElement(ue)||L.hasMatchingElement(te=>we(te,ue))||Q||$&&(vn($.nodesRef.current,H).find(te=>we(te.context?.elements.floating,ue)||we(te.context?.elements.domReference,ue))||pl($.nodesRef.current,H).find(te=>[te.context?.elements.floating,lo(te.context?.elements.floating)].includes(ue)||te.context?.elements.domReference===ue)));if(Se===y&&J&&dd(J,P),i&&Se!==y&&!rs(R)&&Pt(Y)===Y.body){if(it(J)&&(J.focus(),i==="popup")){X.request(()=>{J.focus()});return}const te=se(),ye=_.current,_e=(ye&&te.includes(ye)?ye:null)||te[te.length-1]||J;it(_e)&&_e.focus()}if(E.current.insideReactTree){E.current.insideReactTree=!1;return}(T||!a)&&ue&&ne&&!O.current&&(T||ue!==_a())&&(N.current=!0,g.setOpen(!1,Ae(ur,ve)))})}function le(){k.current||(E.current.insideReactTree=!0,G.start(0,()=>{E.current.insideReactTree=!1}))}const ce=it(y)?y:null;if(!(!C&&!ce))return gn(ce&&Fe(ce,"focusout",fe),ce&&Fe(ce,"pointerdown",me),C&&Fe(C,"focusin",ge),C&&Fe(C,"focusout",fe),C&&V&&Fe(C,"focusout",le,!0))},[r,y,C,J,a,$,V,g,c,i,se,T,b,P,E,G,Z,X,l,d,ae]),f.useEffect(()=>{if(r||!C||!v)return;const Y=Array.from(V?.portalNode?.querySelectorAll(`[${ds("portal")}]`)||[]),ge=($?pl($.nodesRef.current,b()):[]).find(Se=>Ki(Se.context?.elements.domReference||null))?.context?.elements.domReference,le=[...[C,...Y,j.current,B.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,...ae()],ge,An(d),An(l),T?y:null].filter(Se=>Se!=null),ce=id(le,{ariaHidden:a||T,mark:!1}),ve=[C,...Y].filter(Se=>Se!=null),ue=id(ve);return()=>{ue(),ce()}},[v,r,y,C,a,P,V,T,$,b,l,d,ae]),he(()=>{if(!v||r||!it(J))return;const Y=Ie(J),me=Pt(Y);queueMicrotask(()=>{const ge=z.current,fe=typeof ge=="function"?ge(D.current||""):ge;if(fe===void 0||fe===!1||we(J,me))return;let ce=null;const ve=()=>(ce==null&&(ce=se(J)),ce[0]||J);let ue;fe===!0||fe===null?ue=ve():ue=An(fe),ue=ue||ve(),ps(ue,{preventScroll:ue===J})})},[r,v,J,x,se,z,D]),he(()=>{if(r||!J)return;const Y=Ie(J),me=Pt(Y);V0(me);function ge(le){if(le.open||(M.current=F0(le.nativeEvent,A.current)),le.reason===Lt&&le.nativeEvent.type==="mouseleave"&&(N.current=!0),le.reason===ya)if(le.nested)N.current=!1;else if(hl(le.nativeEvent)||ml(le.nativeEvent))N.current=!1;else{let ce=!1;Ie(J).createElement("div").focus({get preventScroll(){return ce=!0,!1}}),ce?N.current=!1:N.current=!0}}S.on("openchange",ge);function fe(){const le=I.current;let ce=typeof le=="function"?le(M.current):le;if(ce===void 0||ce===!1)return null;if(ce===null&&(ce=!0),typeof ce=="boolean"){const ue=y||_a();return ue&&ue.isConnected?ue:null}const ve=y||_a();return An(ce)||ve||null}return()=>{S.off("openchange",ge);const le=Pt(Y),ce=ae(),ve=we(C,le)||ce.some(R=>R===le||we(R,le))||$&&vn($.nodesRef.current,b(),!1).some(R=>we(R.context?.elements.floating,le)),ue=I.current,Se=fe();queueMicrotask(()=>{const R=z0(Se),H=typeof ue!="boolean";ue&&!N.current&&it(R)&&(!(!H&&R!==le&&le!==Y.body)||ve)&&R.focus({preventScroll:!0}),N.current=!1})}},[r,C,J,I,E,S,$,y,b,ae]),he(()=>{if(!Gi||v||!C)return;const Y=Pt(Ie(C));!it(Y)||!qi(Y)||we(C,Y)&&Y.blur()},[v,C]),he(()=>{if(!(r||!V))return V.setFocusManagerState({modal:a,closeOnFocusOut:c,open:v,onOpenChange:g.setOpen,domReference:y}),()=>{V.setFocusManagerState(null)}},[r,V,a,v,g,c,y]),he(()=>{if(!(r||!J))return dd(J,P),()=>{queueMicrotask(Pa)}},[r,J,P]);const pe=!r&&(a?!T:!0)&&(K||a);return w.jsxs(f.Fragment,{children:[pe&&w.jsx(Sn,{"data-type":"inside",ref:U,onFocus:Y=>{if(a){const me=se();ps(me[me.length-1])}else V?.portalNode&&(N.current=!1,Ar(Y,V.portalNode)?ca(y)?.focus():An(d??V.beforeOutsideRef)?.focus())}}),n,pe&&w.jsx(Sn,{"data-type":"inside",ref:W,onFocus:Y=>{a?ps(se()[0]):V?.portalNode&&(c&&(N.current=!0),Ar(Y,V.portalNode)?Il(y)?.focus():An(l??V.afterOutsideRef)?.focus())}})]})}function Ia(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:c=!0,touchOpenDelay:u=0,reason:l=Fr}=t,d=f.useRef(void 0),p=ao(),h=Gt(),m=f.useMemo(()=>({onPointerDown(g){d.current=g.pointerType},onMouseDown(g){const v=d.current,y=g.nativeEvent,C=n.select("open");if(g.button!==0||s==="click"||fo(v,!0)&&a)return;const S=r.current.openEvent,E=S?.type,b=n.select("domReferenceElement")!==g.currentTarget,x=C&&b||!(C&&i&&(!(S&&c)||E==="click"||E==="mousedown")),T=lt(y);if(qi(T)){const z=Ae(l,y,T);x&&v==="touch"&&u>0?h.start(u,()=>{n.setOpen(!0,z)}):n.setOpen(x,z);return}const P=g.currentTarget;p.request(()=>{const z=Ae(l,y,P);x&&v==="touch"&&u>0?h.start(u,()=>{n.setOpen(!0,z)}):n.setOpen(x,z)})},onClick(g){if(s==="mousedown-only")return;const v=d.current;if(s==="mousedown"&&v){d.current=void 0;return}if(fo(v,!0)&&a)return;const y=n.select("open"),C=r.current.openEvent,S=n.select("domReferenceElement")!==g.currentTarget,E=y&&S||!(y&&i&&(!(C&&c)||gl(C))),b=Ae(l,g.nativeEvent,g.currentTarget);E&&v==="touch"&&u>0?h.start(u,()=>{n.setOpen(!0,b)}):n.setOpen(E,b)},onKeyDown(){d.current=void 0}}),[r,s,a,n,c,i,p,h,u,l]);return f.useMemo(()=>o?{reference:m}:mt,[o,m])}const $0={intentional:"onClick",sloppy:"onPointerDown"};function j0(){return!1}function H0(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function ka(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),{dataRef:s}=n.context,{enabled:i=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:u="sloppy",referencePress:l=j0,referencePressEvent:d="sloppy",bubbles:p,externalTree:h}=t,m=lr(h),g=ie(typeof c=="function"?c:()=>!1),v=typeof c=="function"?g:c,y=v!==!1,C=ie(()=>u),S=f.useRef(!1),E=f.useRef(!1),b=f.useRef(!1),{escapeKey:x,outsidePress:T}=H0(p),P=f.useRef(null),z=Gt(),I=Gt(),D=ie(()=>{I.clear(),s.current.insideReactTree=!1}),$=f.useRef(!1),V=f.useRef(""),N=ie(l),O=ie(B=>{if(!r||!i||!a||B.key!=="Escape"||$.current)return;const U=s.current.floatingContext?.nodeId,W=m?vn(m.nodesRef.current,U):[];if(!x&&W.length>0){let X=!0;if(W.forEach(K=>{K.context?.open&&!K.context.dataRef.current.__escapeKeyBubbles&&(X=!1)}),!X)return}const G=pb(B)?B.nativeEvent:B,Z=Ae(ed,G);n.setOpen(!1,Z),!x&&!Z.isPropagationAllowed&&B.stopPropagation()}),k=ie(()=>{s.current.insideReactTree=!0,I.start(0,D)});f.useEffect(()=>{if(!r||!i)return;s.current.__escapeKeyBubbles=x,s.current.__outsidePressBubbles=T;const B=new Zt,U=new Zt;function W(){B.clear(),$.current=!0}function G(){B.start(Yo()?5:0,()=>{$.current=!1})}function Z(){b.current=!0,U.start(0,()=>{b.current=!1})}function X(){S.current=!1,E.current=!1}function K(){const L=V.current,F=L==="pen"||!L?"mouse":L,Q=C(),ne=typeof Q=="function"?Q():Q;return typeof ne=="string"?ne:ne[F]}function J(L){const F=K();return F==="intentional"&&L.type!=="click"||F==="sloppy"&&L.type==="click"}function se(L){const F=s.current.floatingContext?.nodeId,Q=m&&vn(m.nodesRef.current,F).some(ne=>un(L,ne.context?.elements.floating));return un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement"))||Q}function ae(L){if(J(L)){D();return}if(s.current.insideReactTree){D();return}const F=lt(L),Q=`[${ds("inert")}]`,ne=$e(F)?F.getRootNode():null,te=Array.from((kr(ne)?ne:Ie(n.select("floatingElement"))).querySelectorAll(Q)),ye=n.context.triggerElements;if(F&&(ye.hasElement(F)||ye.hasMatchingElement(Pe=>we(Pe,F))))return;let _e=$e(F)?F:null;for(;_e&&!Rn(_e);){const Pe=Nn(_e);if(Rn(Pe)||!$e(Pe))break;_e=Pe}if(te.length&&$e(F)&&!db(F)&&!we(F,n.select("floatingElement"))&&te.every(Pe=>!we(_e,Pe)))return;if(it(F)&&!("touches"in L)){const Pe=Rn(F),Ve=At(F),Ge=/auto|scroll/,He=Pe||Ge.test(Ve.overflowX),nt=Pe||Ge.test(Ve.overflowY),st=He&&F.clientWidth>0&&F.scrollWidth>F.clientWidth,Re=nt&&F.clientHeight>0&&F.scrollHeight>F.clientHeight,Te=Ve.direction==="rtl",Ue=Re&&(Te?L.offsetX<=F.offsetWidth-F.clientWidth:L.offsetX>F.clientWidth),Be=st&&L.offsetY>F.clientHeight;if(Ue||Be)return}if(se(L))return;if(K()==="intentional"&&b.current){U.clear(),b.current=!1;return}if(typeof v=="function"&&!v(L))return;const Ee=s.current.floatingContext?.nodeId,Ce=m?vn(m.nodesRef.current,Ee):[];if(Ce.length>0){let Pe=!0;if(Ce.forEach(Ve=>{Ve.context?.open&&!Ve.context.dataRef.current.__outsidePressBubbles&&(Pe=!1)}),!Pe)return}n.setOpen(!1,Ae(ya,L)),D()}function pe(L){K()!=="sloppy"||L.pointerType==="touch"||!n.select("open")||!i||un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement"))||ae(L)}function Y(L){if(K()!=="sloppy"||!n.select("open")||!i||un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement")))return;const F=L.touches[0];F&&(P.current={startTime:Date.now(),startX:F.clientX,startY:F.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},z.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function me(L,F){const Q=lt(L);if(!Q)return;const ne=Fe(Q,L.type,()=>{F(L),ne()})}function ge(L){V.current="touch",me(L,Y)}function fe(L){z.clear(),L.type==="pointerdown"&&(V.current=L.pointerType),!(L.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&me(L,F=>{F.type==="pointerdown"?pe(F):ae(F)})}function le(L){if(!S.current)return;const F=E.current;if(X(),K()==="intentional"){if(L.type==="pointercancel"){F&&Z();return}if(!se(L)){if(F){Z();return}typeof v=="function"&&!v(L)||(U.clear(),b.current=!0,D())}}}function ce(L){if(K()!=="sloppy"||!P.current||un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement")))return;const F=L.touches[0];if(!F)return;const Q=Math.abs(F.clientX-P.current.startX),ne=Math.abs(F.clientY-P.current.startY),te=Math.sqrt(Q*Q+ne*ne);te>5&&(P.current.dismissOnTouchEnd=!0),te>10&&(ae(L),z.clear(),P.current=null)}function ve(L){me(L,ce)}function ue(L){K()!=="sloppy"||!P.current||un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement"))||(P.current.dismissOnTouchEnd&&ae(L),z.clear(),P.current=null)}function Se(L){me(L,ue)}const R=Ie(o),H=gn(a&&gn(Fe(R,"keydown",O),Fe(R,"compositionstart",W),Fe(R,"compositionend",G)),y&&gn(Fe(R,"click",fe,!0),Fe(R,"pointerdown",fe,!0),Fe(R,"pointerup",le,!0),Fe(R,"pointercancel",le,!0),Fe(R,"mousedown",fe,!0),Fe(R,"mouseup",le,!0),Fe(R,"touchstart",ge,!0),Fe(R,"touchmove",ve,!0),Fe(R,"touchend",Se,!0)));return()=>{H(),B.clear(),U.clear(),X(),b.current=!1}},[s,o,a,y,v,r,i,x,T,O,D,C,m,n,z]),f.useEffect(D,[v,D]);const _=f.useMemo(()=>({onKeyDown:O,[$0[d]]:B=>{N()&&n.setOpen(!1,Ae(Fr,B.nativeEvent))},...d!=="intentional"&&{onClick(B){N()&&n.setOpen(!1,Ae(Fr,B.nativeEvent))}}}),[O,n,d,N]),M=ie(B=>{if(!r||!i||B.button!==0)return;const U=lt(B.nativeEvent);we(n.select("floatingElement"),U)&&(S.current||(S.current=!0,E.current=!1))}),A=ie(B=>{!r||!i||(B.defaultPrevented||B.nativeEvent.defaultPrevented)&&S.current&&(E.current=!0)}),j=f.useMemo(()=>({onKeyDown:O,onPointerDown:A,onMouseDown:A,onClickCapture:k,onMouseDownCapture(B){k(),M(B)},onPointerDownCapture(B){k(),M(B)},onMouseUpCapture:k,onTouchEndCapture:k,onTouchMoveCapture:k}),[O,k,M,A]);return f.useMemo(()=>i?{reference:_,floating:j,trigger:_}:{},[i,_,j])}function fd(e,t,n){let{reference:r,floating:o}=e;const s=en(t),i=na(t),a=ta(i),c=jt(t),u=s==="y",l=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let h;switch(c){case"top":h={x:l,y:r.y-o.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(Gn(t)){case"start":h[i]-=p*(n&&u?-1:1);break;case"end":h[i]+=p*(n&&u?-1:1);break}return h}async function U0(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=Mn(t,e),m=bl(h),v=a[p?d==="floating"?"reference":"floating":d],y=po(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),C=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),E=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},b=po(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:S,strategy:c}):C);return{top:(y.top-b.top+m.top)/E.y,bottom:(b.bottom-y.bottom+m.bottom)/E.y,left:(y.left-b.left+m.left)/E.x,right:(b.right-y.right+m.right)/E.x}}const B0=50,W0=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:U0},c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:d}=fd(u,r,c),p=r,h=0;const m={};for(let g=0;g<s.length;g++){const v=s[g];if(!v)continue;const{name:y,fn:C}=v,{x:S,y:E,data:b,reset:x}=await C({x:l,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:m,rects:u,platform:a,elements:{reference:e,floating:t}});l=S??l,d=E??d,m[y]={...m[y],...b},x&&h<B0&&(h++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(u=x.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):x.rects),{x:l,y:d}=fd(u,p,c)),g=-1)}return{x:l,y:d,placement:p,strategy:o,middlewareData:m}},Z0=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:a,platform:c,elements:u}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...v}=Mn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=jt(o),C=en(a),S=jt(a)===a,E=await(c.isRTL==null?void 0:c.isRTL(u.floating)),b=p||(S||!g?[es(a)]:yb(a)),x=m!=="none";!p&&x&&b.push(...Sb(a,g,m,E));const T=[a,...b],P=await c.detectOverflow(t,v),z=[];let I=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&z.push(P[y]),d){const N=gb(o,i,E);z.push(P[N[0]],P[N[1]])}if(I=[...I,{placement:o,overflows:z}],!z.every(N=>N<=0)){var D,$;const N=(((D=s.flip)==null?void 0:D.index)||0)+1,O=T[N];if(O&&(!(d==="alignment"?C!==en(O):!1)||I.every(M=>en(M.placement)===C?M.overflows[0]>0:!0)))return{data:{index:N,overflows:I},reset:{placement:O}};let k=($=I.filter(_=>_.overflows[0]<=0).sort((_,M)=>_.overflows[1]-M.overflows[1])[0])==null?void 0:$.placement;if(!k)switch(h){case"bestFit":{var V;const _=(V=I.filter(M=>{if(x){const A=en(M.placement);return A===C||A==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(A=>A>0).reduce((A,j)=>A+j,0)]).sort((M,A)=>M[1]-A[1])[0])==null?void 0:V[0];_&&(k=_);break}case"initialPlacement":k=a;break}if(o!==k)return{reset:{placement:k}}}return{}}}};function pd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hd(e){return hb.some(t=>e[t]>=0)}const G0=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Mn(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=pd(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:hd(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=pd(i,n.floating);return{data:{escapedOffsets:a,escaped:hd(a)}}}default:return{}}}}},md=new Set(["left","top"]);async function Y0(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=jt(n),a=Gn(n),c=en(n)==="y",u=md.has(i)?-1:1,l=s&&c?-1:1,d=Mn(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),c?{x:h*l,y:p*u}:{x:p*u,y:h*l}}const X0=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:a}=t,c=await Y0(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},q0=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:a=!1,limiter:c={fn:y=>{let{x:C,y:S}=y;return{x:C,y:S}}},...u}=Mn(e,t),l={x:n,y:r},d=await s.detectOverflow(t,u),p=en(jt(o)),h=ea(p);let m=l[h],g=l[p];if(i){const y=h==="y"?"top":"left",C=h==="y"?"bottom":"right",S=m+d[y],E=m-d[C];m=Qi(S,m,E)}if(a){const y=p==="y"?"top":"left",C=p==="y"?"bottom":"right",S=g+d[y],E=g-d[C];g=Qi(S,g,E)}const v=c.fn({...t,[h]:m,[p]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[p]:a}}}}}},K0=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Mn(e,t),l={x:n,y:r},d=en(o),p=ea(d);let h=l[p],m=l[d];const g=Mn(a,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const S=p==="y"?"height":"width",E=s.reference[p]-s.floating[S]+v.mainAxis,b=s.reference[p]+s.reference[S]-v.mainAxis;h<E?h=E:h>b&&(h=b)}if(u){var y,C;const S=p==="y"?"width":"height",E=md.has(jt(o)),b=s.reference[d]-s.floating[S]+(E&&((y=i.offset)==null?void 0:y[d])||0)+(E?0:v.crossAxis),x=s.reference[d]+s.reference[S]+(E?0:((C=i.offset)==null?void 0:C[d])||0)-(E?v.crossAxis:0);m<b?m=b:m>x&&(m=x)}return{[p]:h,[d]:m}}}},J0=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:a}=t,{apply:c=()=>{},...u}=Mn(e,t),l=await i.detectOverflow(t,u),d=jt(o),p=Gn(o),h=en(o)==="y",{width:m,height:g}=s.floating;let v,y;d==="top"||d==="bottom"?(v=d,y=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,v=p==="end"?"top":"bottom");const C=g-l.top-l.bottom,S=m-l.left-l.right,E=Nr(g-l[v],C),b=Nr(m-l[y],S),x=!t.middlewareData.shift;let T=E,P=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=C),x&&!p){const I=Xt(l.left,0),D=Xt(l.right,0),$=Xt(l.top,0),V=Xt(l.bottom,0);h?P=m-2*(I!==0||D!==0?I+D:Xt(l.left,l.right)):T=g-2*($!==0||V!==0?$+V:Xt(l.top,l.bottom))}await c({...t,availableWidth:P,availableHeight:T});const z=await i.getDimensions(a.floating);return m!==z.width||g!==z.height?{reset:{rects:!0}}:{}}}};function gd(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=it(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Qo(n)!==s||Qo(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Ra(e){return $e(e)?e:e.contextElement}function Vr(e){const t=Ra(e);if(!it(t))return bn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=gd(t);let i=(s?Qo(n.width):n.width)/r,a=(s?Qo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Q0=bn(0);function yd(e){const t=tt(e);return!Yo()||!t.visualViewport?Q0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ew(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==tt(e)?!1:t}function dr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ra(e);let i=bn(1);t&&(r?$e(r)&&(i=Vr(r)):i=Vr(e));const a=ew(s,n,r)?yd(s):bn(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,l=o.width/i.x,d=o.height/i.y;if(s){const p=tt(s),h=r&&$e(r)?tt(r):r;let m=p,g=Bi(m);for(;g&&r&&h!==m;){const v=Vr(g),y=g.getBoundingClientRect(),C=At(g),S=y.left+(g.clientLeft+parseFloat(C.paddingLeft))*v.x,E=y.top+(g.clientTop+parseFloat(C.paddingTop))*v.y;c*=v.x,u*=v.y,l*=v.x,d*=v.y,c+=S,u+=E,m=tt(g),g=Bi(m)}}return po({width:l,height:d,x:c,y:u})}function gs(e,t){const n=Xo(e).scrollLeft;return t?t.left+n:dr(mn(e)).left+n}function vd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gs(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function tw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=mn(r),a=t?Go(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=bn(1);const l=bn(0),d=it(r);if((d||!d&&!s)&&((kt(r)!=="body"||Bn(i))&&(c=Xo(r)),d)){const h=dr(r);u=Vr(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}const p=i&&!d&&!s?vd(i,c):bn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+l.x+p.x,y:n.y*u.y-c.scrollTop*u.y+l.y+p.y}}function nw(e){return Array.from(e.getClientRects())}function rw(e){const t=mn(e),n=Xo(e),r=e.ownerDocument.body,o=Xt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Xt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+gs(e);const a=-n.scrollTop;return At(r).direction==="rtl"&&(i+=Xt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const bd=25;function ow(e,t){const n=tt(e),r=mn(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const l=Yo();(!l||l&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=gs(r);if(u<=0){const l=r.ownerDocument,d=l.body,p=getComputedStyle(d),h=l.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-h);m<=bd&&(s-=m)}else u<=bd&&(s+=u);return{width:s,height:i,x:a,y:c}}function sw(e,t){const n=dr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=it(e)?Vr(e):bn(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function wd(e,t,n){let r;if(t==="viewport")r=ow(e,n);else if(t==="document")r=rw(mn(e));else if($e(t))r=sw(t,n);else{const o=yd(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return po(r)}function Sd(e,t){const n=Nn(e);return n===t||!$e(n)||Rn(n)?!1:At(n).position==="fixed"||Sd(n,t)}function iw(e,t){const n=t.get(e);if(n)return n;let r=io(e,[],!1).filter(a=>$e(a)&&kt(a)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?Nn(e):e;for(;$e(i)&&!Rn(i);){const a=At(i),c=Ui(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Bn(i)&&!c&&Sd(e,i))?r=r.filter(l=>l!==i):o=a,i=Nn(i)}return t.set(e,r),r}function aw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Go(t)?[]:iw(t,this._c):[].concat(n),r],a=wd(t,i[0],o);let c=a.top,u=a.right,l=a.bottom,d=a.left;for(let p=1;p<i.length;p++){const h=wd(t,i[p],o);c=Xt(h.top,c),u=Nr(h.right,u),l=Nr(h.bottom,l),d=Xt(h.left,d)}return{width:u-d,height:l-c,x:d,y:c}}function cw(e){const{width:t,height:n}=gd(e);return{width:t,height:n}}function uw(e,t,n){const r=it(t),o=mn(t),s=n==="fixed",i=dr(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=bn(0);function u(){c.x=gs(o)}if(r||!r&&!s)if((kt(t)!=="body"||Bn(o))&&(a=Xo(t)),r){const h=dr(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?vd(o,a):bn(0),d=i.left+a.scrollLeft-c.x-l.x,p=i.top+a.scrollTop-c.y-l.y;return{x:d,y:p,width:i.width,height:i.height}}function Na(e){return At(e).position==="static"}function Ed(e,t){if(!it(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mn(e)===n&&(n=n.ownerDocument.body),n}function xd(e,t){const n=tt(e);if(Go(e))return n;if(!it(e)){let o=Nn(e);for(;o&&!Rn(o);){if($e(o)&&!Na(o))return o;o=Nn(o)}return n}let r=Ed(e,t);for(;r&&tb(r)&&Na(r);)r=Ed(r,t);return r&&Rn(r)&&Na(r)&&!Ui(r)?n:r||ob(e)||n}const lw=async function(e){const t=this.getOffsetParent||xd,n=this.getDimensions,r=await n(e.floating);return{reference:uw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function dw(e){return At(e).direction==="rtl"}const Cd={convertOffsetParentRelativeRectToViewportRelativeRect:tw,getDocumentElement:mn,getClippingRect:aw,getOffsetParent:xd,getElementRects:lw,getClientRects:nw,getDimensions:cw,getScale:Vr,isElement:$e,isRTL:dw};function Td(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function fw(e,t){let n=null,r;const o=mn(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:l,top:d,width:p,height:h}=u;if(a||t(),!p||!h)return;const m=rr(d),g=rr(o.clientWidth-(l+p)),v=rr(o.clientHeight-(d+h)),y=rr(l),S={rootMargin:-m+"px "+-g+"px "+-v+"px "+-y+"px",threshold:Xt(0,Nr(1,c))||1};let E=!0;function b(x){const T=x[0].intersectionRatio;if(T!==c){if(!E)return i();T?i(!1,T):r=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!Td(u,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(b,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(b,S)}n.observe(e)}return i(!0),s}function Od(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ra(e),l=o||s?[...u?io(u):[],...t?io(t):[]]:[];l.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=u&&a?fw(u,n):null;let p=-1,h=null;i&&(h=new ResizeObserver(y=>{let[C]=y;C&&C.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=h)==null||S.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let m,g=c?dr(e):null;c&&v();function v(){const y=dr(e);g&&!Td(g,y)&&n(),g=y,m=requestAnimationFrame(v)}return n(),()=>{var y;l.forEach(C=>{o&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),d?.(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(m)}}const pw=X0,hw=q0,mw=Z0,gw=J0,yw=G0,vw=K0,bw=(e,t,n)=>{const r=new Map,o={platform:Cd,...n},s={...o.platform,_c:r};return W0(e,t,{...o,platform:s})};var ww=typeof document<"u",Sw=function(){},ys=ww?oe.useLayoutEffect:Sw;function vs(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(!vs(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)&&!vs(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Pd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _d(e,t){const n=Pd(e);return Math.round(t*n)/n}function Ma(e){const t=f.useRef(e);return ys(()=>{t.current=e}),t}function Ew(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[l,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=f.useState(r);vs(p,r)||h(r);const[m,g]=f.useState(null),[v,y]=f.useState(null),C=f.useCallback(M=>{M!==x.current&&(x.current=M,g(M))},[]),S=f.useCallback(M=>{M!==T.current&&(T.current=M,y(M))},[]),E=s||m,b=i||v,x=f.useRef(null),T=f.useRef(null),P=f.useRef(l),z=c!=null,I=Ma(c),D=Ma(o),$=Ma(u),V=f.useCallback(()=>{if(!x.current||!T.current)return;const M={placement:t,strategy:n,middleware:p};D.current&&(M.platform=D.current),bw(x.current,T.current,M).then(A=>{const j={...A,isPositioned:$.current!==!1};N.current&&!vs(P.current,j)&&(P.current=j,Kt.flushSync(()=>{d(j)}))})},[p,t,n,D,$]);ys(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(M=>({...M,isPositioned:!1})))},[u]);const N=f.useRef(!1);ys(()=>(N.current=!0,()=>{N.current=!1}),[]),ys(()=>{if(E&&(x.current=E),b&&(T.current=b),E&&b){if(I.current)return I.current(E,b,V);V()}},[E,b,V,I,z]);const O=f.useMemo(()=>({reference:x,floating:T,setReference:C,setFloating:S}),[C,S]),k=f.useMemo(()=>({reference:E,floating:b}),[E,b]),_=f.useMemo(()=>{const M={position:n,left:0,top:0};if(!k.floating)return M;const A=_d(k.floating,l.x),j=_d(k.floating,l.y);return a?{...M,transform:"translate("+A+"px, "+j+"px)",...Pd(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:A,top:j}},[n,a,k.floating,l.x,l.y]);return f.useMemo(()=>({...l,update:V,refs:O,elements:k,floatingStyles:_}),[l,V,O,k,_])}const xw=(e,t)=>{const n=pw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cw=(e,t)=>{const n=hw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tw=(e,t)=>({fn:vw(e).fn,options:[e,t]}),Ow=(e,t)=>{const n=mw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pw=(e,t)=>{const n=gw(e);return{name:n.name,fn:n.fn,options:[e,t]}},_w=(e,t)=>{const n=yw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Iw={open:de(e=>e.open),transitionStatus:de(e=>e.transitionStatus),domReferenceElement:de(e=>e.domReferenceElement),referenceElement:de(e=>e.positionReference??e.referenceElement),floatingElement:de(e=>e.floatingElement),floatingId:de(e=>e.floatingId)};class Aa extends Wo{constructor(t){const{syncOnly:n,nested:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:ud(),nested:r,triggerElements:s},Iw),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&gl(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function vo(e,t=!1,n=!1){const[r,o]=f.useState(e&&t?"idle":void 0),[s,i]=f.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),he(()=>{if(!e&&s&&r!=="ending"&&n){const a=yn.request(()=>{o("ending")});return()=>{yn.cancel(a)}}},[e,s,r,n]),he(()=>{if(!e||t)return;const a=yn.request(()=>{o(void 0)});return()=>{yn.cancel(a)}},[t,e]),he(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=yn.request(()=>{o("idle")});return()=>{yn.cancel(a)}},[t,e,s,r]),{mounted:s,setMounted:i,transitionStatus:r}}function kw(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(o=>{if(e!==void 0){if(n.current!==null){const s=n.current,i=r.current,a=t.context.triggerElements.getById(s);i&&a===i&&t.context.triggerElements.delete(s),n.current=null,r.current=null}o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o))}},[t,e])}function Id(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=kw(e,n),i=ie(a=>{if(s(a),!a||!n.select("open"))return;const c=n.select("activeTriggerId");if(c===e){n.update({activeTriggerElement:a,...r});return}c==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...r})});return he(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function kd(e){const t=e.useState("open");he(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function Rd(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=vo(e);t.useSyncedValues({mounted:r,transitionStatus:s});const i=ie(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return xn({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class bs{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);if(r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n),process.env.NODE_ENV!=="production"&&this.elementsSet.size!==this.idMap.size))throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.")}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function Rw(){return new Aa({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new bs,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0})}function Nd(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Rw(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:mt,inactiveTriggerProps:mt,popupProps:mt}}const ws=de(e=>e.triggerIdProp??e.activeTriggerId),Md={open:de(e=>e.openProp??e.open),mounted:de(e=>e.mounted),transitionStatus:de(e=>e.transitionStatus),floatingRootContext:de(e=>e.floatingRootContext),preventUnmountingOnClose:de(e=>e.preventUnmountingOnClose),payload:de(e=>e.payload),activeTriggerId:ws,activeTriggerElement:de(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:de((e,t)=>t!==void 0&&ws(e)===t),isOpenedByTrigger:de((e,t)=>t!==void 0&&ws(e)===t&&e.open),isMountedByTrigger:de((e,t)=>t!==void 0&&ws(e)===t&&e.mounted),triggerProps:de((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:de(e=>e.popupProps),popupElement:de(e=>e.popupElement),positionerElement:de(e=>e.positionerElement)};function Ad(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Xn(),s=qn()!=null;if(process.env.NODE_ENV!=="production"){const a=r.reference;a&&!$e(a)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`","instead.")}const i=wt(()=>new Aa({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new bs,floatingId:o,syncOnly:!1,nested:s})).current;return he(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=$e(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function Nw(e={}){const{nodeId:t,externalTree:n}=e,r=Ad(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=f.useState(null),c=f.useRef(null),u=lr(n);he(()=>{s.domReference&&(c.current=s.domReference)},[s.domReference]);const l=Ew({...e,elements:{...s,...i&&{reference:i}}}),d=f.useCallback(P=>{const z=$e(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;a(z),l.refs.setReference(z)},[l.refs]),[p,h]=f.useState(void 0),[m,g]=f.useState(null);o.useSyncedValue("referenceElement",p??null);const v=$e(p)?p:null;o.useSyncedValue("domReferenceElement",p===void 0?s.domReference:v),o.useSyncedValue("floatingElement",m);const y=f.useCallback(P=>{($e(P)||P===null)&&(c.current=P,h(P)),($e(l.refs.reference.current)||l.refs.reference.current===null||P!==null&&!$e(P))&&l.refs.setReference(P)},[l.refs,h]),C=f.useCallback(P=>{g(P),l.refs.setFloating(P)},[l.refs]),S=f.useMemo(()=>({...l.refs,setReference:y,setFloating:C,setPositionReference:d,domReference:c}),[l.refs,y,C,d]),E=f.useMemo(()=>({...l.elements,domReference:s.domReference}),[l.elements,s.domReference]),b=o.useState("open"),x=o.useState("floatingId"),T=f.useMemo(()=>({...l,dataRef:o.context.dataRef,open:b,onOpenChange:o.setOpen,events:o.context.events,floatingId:x,refs:S,elements:E,nodeId:t,rootStore:o}),[l,S,E,t,o,b,x]);return he(()=>{o.context.dataRef.current.floatingContext=T;const P=u?.nodesRef.current.find(z=>z.id===t);P&&(P.context=T)}),f.useMemo(()=>({...l,context:T,refs:S,elements:E,rootStore:o}),[l,S,E,T,o])}function Dd(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,o=Xn(),s=qn()!=null,i=t.useState("open"),a=t.useState("activeTriggerElement"),c=t.useState(n?"popupElement":"positionerElement"),u=t.context.triggerElements,l=wt(()=>new Aa({open:i,transitionStatus:void 0,referenceElement:a,floatingElement:c,triggerElements:u,onOpenChange:r,floatingId:o,syncOnly:!0,nested:s})).current;return he(()=>{const d={open:i,floatingId:o,referenceElement:a,floatingElement:c};$e(a)&&(d.domReferenceElement=a),l.state.positionReference===l.state.referenceElement&&(d.positionReference=a),l.update(d)},[i,o,a,c,l]),l.context.onOpenChange=r,l.context.nested=s,l}class Da{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Zt,this.restTimeout=new Zt,this.handleCloseOptions=void 0}static create(){return new Da}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Ss=new WeakMap;function Es(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Ss.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Ss.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ld(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=Ss.get(n);s&&s!==e&&Es(s),Es(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Ss.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function Fd(e){const t=wt(Da.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),so(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Mw(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:c=0,nodeId:u}=t,l=Fd(n),d=lr(),p=qn(),h=ie(()=>Ql(i.current.openEvent?.type,l.interactedInside)),m=ie(()=>{const E=i.current.openEvent?.type;return E?.includes("mouse")&&E!=="mousedown"}),g=ie(E=>fl(E,n.context.triggerElements)),v=f.useCallback(E=>{const b=ga(c,"close",l.pointerType),x=()=>{n.setOpen(!1,Ae(Lt,E)),d?.events.emit("floating.closed",E)};b?l.openChangeTimeout.start(b,x):(l.openChangeTimeout.clear(),x())},[c,n,l,d]),y=ie(()=>{Es(l)}),C=ie(E=>{const b=lt(E);if(!fb(b)){l.interactedInside=!1;return}l.interactedInside=b?.closest("[aria-haspopup]")!=null});he(()=>{r||(l.pointerType=void 0,l.restTimeoutPending=!1,l.interactedInside=!1,y())},[r,l,y]),f.useEffect(()=>y,[y]),he(()=>{if(a&&r&&l.handleCloseOptions?.blockPointerEvents&&m()&&$e(s)&&o){const E=s,b=o,x=Ie(o),T=d?.nodesRef.current.find(z=>z.id===p)?.context?.elements.floating;T&&(T.style.pointerEvents="");const P=l.handleCloseOptions?.getScope?.()??l.pointerEventsScopeElement??T??E.closest("[data-rootownerid]")??x.body;return Ld(l,{scopeElement:P,referenceElement:E,floatingElement:b}),()=>{y()}}},[a,r,s,o,l,m,d,p,y]);const S=Gt();f.useEffect(()=>{if(!a)return;function E(){l.openChangeTimeout.clear(),S.clear(),d?.events.off("floating.closed",x),y()}function b(P){if(d&&p&&vn(d.nodesRef.current,p).length>0){d.events.on("floating.closed",x);return}if(g(P.relatedTarget))return;const z=i.current.floatingContext?.nodeId??u,I=P.relatedTarget;if(!(d&&z&&$e(I)&&vn(d.nodesRef.current,z,!1).some($=>we($.context?.elements.floating,I)))){if(l.handler){l.handler(P);return}y(),h()||v(P)}}function x(P){!d||!p||vn(d.nodesRef.current,p).length>0||S.start(0,()=>{d.events.off("floating.closed",x),n.setOpen(!1,Ae(Lt,P)),d.events.emit("floating.closed",P)})}const T=o;return gn(T&&Fe(T,"mouseenter",E),T&&Fe(T,"mouseleave",b),T&&Fe(T,"pointerdown",C,!0),()=>{d?.events.off("floating.closed",x)})},[a,o,n,i,u,h,g,v,y,C,l,d,p,S])}const Aw={current:null};function Dw(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:c=!1,restMs:u=0,move:l=!0,triggerElementRef:d=Aw,externalTree:p,isActiveTrigger:h=!0,getHandleCloseContext:m,isClosing:g}=t,v=lr(p),y=Fd(n),C=f.useRef(!1),S=vt(a),E=vt(i),b=vt(u),x=vt(s),T=vt(g);h&&(y.handleCloseOptions=S.current?.__options);const P=ie(()=>Ql(r.current.openEvent?.type,y.interactedInside)),z=ie(N=>fl(N,n.context.triggerElements)),I=ie((N,O,k)=>{const _=n.context.triggerElements;if(_.hasElement(O))return!N||!we(N,O);if(!$e(k))return!1;const M=k;return _.hasMatchingElement(A=>we(A,M))&&(!N||!we(N,M))}),D=ie((N,O=!0)=>{const k=ga(E.current,"close",y.pointerType);k?y.openChangeTimeout.start(k,()=>{n.setOpen(!1,Ae(Lt,N)),v?.events.emit("floating.closed",N)}):O&&(y.openChangeTimeout.clear(),n.setOpen(!1,Ae(Lt,N)),v?.events.emit("floating.closed",N))}),$=ie(()=>{if(!y.handler)return;Ie(n.select("domReferenceElement")).removeEventListener("mousemove",y.handler),y.handler=void 0}),V=ie(()=>{Es(y)});return f.useEffect(()=>$,[$]),f.useEffect(()=>{if(!s)return;function N(O){O.open?C.current=!1:(C.current=O.reason===Lt,$(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return o.on("openchange",N),()=>{o.off("openchange",N)}},[s,o,y,$]),f.useEffect(()=>{if(!s)return;const N=d.current??(h?n.select("domReferenceElement"):null);if(!$e(N))return;function O(_){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,c&&!fo(y.pointerType))return;const M=Jl(b.current),A=ga(E.current,"open",y.pointerType),j=lt(_),B=_.currentTarget??null,U=n.select("domReferenceElement");let W=B;if($e(j)&&!n.context.triggerElements.hasElement(j)){for(const Y of n.context.triggerElements.elements())if(we(Y,j)){W=Y;break}}$e(B)&&$e(U)&&!n.context.triggerElements.hasElement(B)&&we(B,U)&&(W=U);const G=W==null?!1:I(U,W,j),Z=n.select("open"),X=T.current?.()??n.select("transitionStatus")==="ending",K=!Z&&X&&C.current,J=!G&&$e(W)&&$e(U)&&we(U,W)&&K,se=M>0&&!A,ae=G&&(Z||K)||J,pe=!Z||G;if(ae){n.setOpen(!0,Ae(Lt,_,W));return}se||(A?y.openChangeTimeout.start(A,()=>{pe&&n.setOpen(!0,Ae(Lt,_,W))}):pe&&n.setOpen(!0,Ae(Lt,_,W)))}function k(_){if(P()){V();return}$();const M=n.select("domReferenceElement"),A=Ie(M);y.restTimeout.clear(),y.restTimeoutPending=!1;const j=r.current.floatingContext??m?.();if(z(_.relatedTarget))return;if(S.current&&j){n.select("open")||y.openChangeTimeout.clear();const W=d.current;y.handler=S.current({...j,tree:v,x:_.clientX,y:_.clientY,onClose(){V(),$(),x.current&&!P()&&W===n.select("domReferenceElement")&&D(_,!0)}}),A.addEventListener("mousemove",y.handler),y.handler(_);return}(y.pointerType!=="touch"||!we(n.select("floatingElement"),_.relatedTarget))&&D(_)}return l?gn(Fe(N,"mousemove",O,{once:!0}),Fe(N,"mouseenter",O),Fe(N,"mouseleave",k)):gn(Fe(N,"mouseenter",O),Fe(N,"mouseleave",k))},[$,V,r,E,D,n,s,S,y,h,I,P,z,c,l,b,d,v,x,m,T]),f.useMemo(()=>{if(!s)return;function N(O){y.pointerType=O.pointerType}return{onPointerDown:N,onPointerEnter:N,onMouseMove(O){const{nativeEvent:k}=O,_=O.currentTarget,M=n.select("domReferenceElement"),A=n.select("open"),j=I(M,_,O.target);if(c&&!fo(y.pointerType))return;if(A&&j&&y.handleCloseOptions?.blockPointerEvents){const W=n.select("floatingElement");if(W){const G=y.handleCloseOptions?.getScope?.()??_.ownerDocument.body;Ld(y,{scopeElement:G,referenceElement:_,floatingElement:W})}}const B=Jl(b.current);if(A&&!j||B===0||!j&&y.restTimeoutPending&&O.movementX**2+O.movementY**2<2)return;y.restTimeout.clear();function U(){if(y.restTimeoutPending=!1,P())return;const W=n.select("open");!y.blockMouseMove&&(!W||j)&&n.setOpen(!0,Ae(Lt,k,_))}y.pointerType==="touch"?Kt.flushSync(()=>{U()}):j&&A?U():(y.restTimeoutPending=!0,y.restTimeout.start(B,U))}}},[s,y,P,I,c,n,b])}function bo(e=[]){const t=e.map(u=>u?.reference),n=e.map(u=>u?.floating),r=e.map(u=>u?.item),o=e.map(u=>u?.trigger),s=f.useCallback(u=>xs(u,e,"reference"),t),i=f.useCallback(u=>xs(u,e,"floating"),n),a=f.useCallback(u=>xs(u,e,"item"),r),c=f.useCallback(u=>xs(u,e,"trigger"),o);return f.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:c}),[s,i,a,c])}function xs(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Yi]="");for(const i in e)o&&e&&(i===ul||i===ll)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const c=t[i]?.[n];typeof c=="function"?a=e?c(e):null:a=c,a&&Vd(s,a,o,r)}return Vd(s,e,o,r),s}function Vd(e,t,n,r){for(const o in t){const s=t[o];n&&(o===ul||o===ll)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...i)=>r.get(o)?.map(a=>a(...i)).find(a=>a!==void 0))):e[o]=s)}}const Lw="Escape";function Cs(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ts(e,t){return Cs(t,e===Xi||e===uo,e===Wn||e===Zn)}function La(e,t,n){return Cs(t,e===uo,n?e===Wn:e===Zn)||e==="Enter"||e===" "||e===""}function Fw(e,t,n){return Cs(t,n?e===Wn:e===Zn,e===uo)}function Vw(e,t,n,r){const o=n?e===Zn:e===Wn,s=e===Xi;return t==="both"||t==="horizontal"&&r&&r>1?e===Lw:Cs(t,o,s)}function zw(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:a,activeIndex:c,onNavigate:u=()=>{},enabled:l=!0,selectedIndex:d=null,allowEscape:p=!1,loopFocus:h=!1,nested:m=!1,rtl:g=!1,virtual:v=!1,focusItemOnOpen:y="auto",focusItemOnHover:C=!0,openOnArrowKeyDown:S=!0,disabledIndices:E=void 0,orientation:b="vertical",parentOrientation:x,cols:T=1,id:P,resetOnPointerLeave:z=!0,externalTree:I}=t;process.env.NODE_ENV!=="production"&&(p&&(h||console.warn("`useListNavigation` looping must be enabled to allow escaping."),v||console.warn("`useListNavigation` must be virtual to allow escaping.")),b==="vertical"&&T>1&&console.warn("In grid list navigation mode (`cols` > 1), the `orientation` should",'be either "horizontal" or "both".'));const D=lo(o),$=vt(D),V=qn(),N=lr(I);he(()=>{i.current.orientation=b},[i,b]);const O=Ki(s),k=f.useRef(y),_=f.useRef(d??-1),M=f.useRef(null),A=f.useRef(!0),j=ie(R=>{u(_.current===-1?null:_.current,R)}),B=f.useRef(j),U=f.useRef(!!o),W=f.useRef(r),G=f.useRef(!1),Z=f.useRef(!1),X=f.useRef(null),K=vt(E),J=vt(r),se=vt(d),ae=vt(z),pe=ie(()=>{function R(Q){v?N?.events.emit("virtualfocus",Q):X.current=ps(Q,{sync:G.current,preventScroll:!0})}const H=a.current[_.current],L=Z.current;H&&R(H),(G.current?Q=>Q():requestAnimationFrame)(()=>{const Q=a.current[_.current]||H;if(!Q)return;H||R(Q),ge&&(L||!A.current)&&Q.scrollIntoView?.({block:"nearest",inline:"nearest"})})});he(()=>{l&&(r&&o?(_.current=d??-1,k.current&&d!=null&&(Z.current=!0,j())):U.current&&(_.current=-1,B.current()))},[l,r,o,d,j]),he(()=>{if(l){if(!r){G.current=!1;return}if(o)if(c==null){if(G.current=!1,se.current!=null)return;if(U.current&&(_.current=-1,pe()),(!W.current||!U.current)&&k.current&&(M.current!=null||k.current===!0&&M.current==null)){let R=0;const H=()=>{a.current[0]==null?(R<2&&(R?requestAnimationFrame:queueMicrotask)(H),R+=1):(_.current=M.current==null||La(M.current,b,g)||m?oa(a):wl(a),M.current=null,j())};H()}}else ns(a.current,c)||(_.current=c,pe(),Z.current=!1)}},[l,r,o,c,se,m,a,b,g,j,pe,K]),he(()=>{if(!l||o||!N||v||!U.current)return;const R=N.nodesRef.current,H=R.find(Q=>Q.id===V)?.context?.elements.floating,L=Pt(Ie(o)),F=R.some(Q=>Q.context&&we(Q.context.elements.floating,L));H&&!F&&A.current&&H.focus({preventScroll:!0})},[l,o,N,V,v]),he(()=>{B.current=j,W.current=r,U.current=!!o}),he(()=>{r||(M.current=null,k.current=y)},[r,y]);const Y=c!=null,me=ie(R=>{if(!J.current)return;const H=a.current.indexOf(R.currentTarget);H!==-1&&(_.current!==H||c!==H)&&(_.current=H,j(R))}),ge=f.useMemo(()=>({onFocus(H){G.current=!0,me(H)},onClick:({currentTarget:H})=>H.focus({preventScroll:!0}),onMouseMove(H){G.current=!0,Z.current=!1,C&&me(H)},onPointerLeave(H){if(!J.current||!A.current||H.pointerType==="touch")return;G.current=!0;const L=H.relatedTarget;if(!(!C||a.current.includes(L))&&ae.current&&(X.current?.(),X.current=null,_.current=-1,j(H),!v)){const F=$.current,Q=Pt(Ie(F));F&&we(F,Q)&&F.focus({preventScroll:!0})}}}),[me,J,$,C,a,j,ae,v]),fe=f.useCallback(()=>x??N?.nodesRef.current.find(R=>R.id===V)?.context?.dataRef?.current.orientation,[V,N,x]),le=ie(R=>{if(A.current=!1,G.current=!0,R.which===229||!J.current&&R.currentTarget===$.current)return;if(m&&Vw(R.key,b,g,T)){Ts(R.key,fe())||Yt(R),n.setOpen(!1,Ae(ba,R.nativeEvent)),it(s)&&(v?N?.events.emit("virtualfocus",s):s.focus());return}const H=_.current,L=oa(a,E),F=wl(a,E);if(O||(R.key==="Home"&&(Yt(R),_.current=L,j(R)),R.key==="End"&&(Yt(R),_.current=F,j(R))),T>1){const Q=Array.from({length:a.current.length},()=>({width:1,height:1})),ne=Cb(Q,T),te=ne.findIndex(Ee=>Ee!=null&&!Mr(a.current,Ee,E)),ye=ne.reduce((Ee,Ce,Pe)=>Ce!=null&&!Mr(a.current,Ce,E)?Pe:Ee,-1),_e=ne[xb(ne.map(Ee=>Ee!=null?a.current[Ee]:null),{event:R,orientation:b,loopFocus:h,rtl:g,cols:T,disabledIndices:Ob([...(typeof E!="function"?E:null)||a.current.map((Ee,Ce)=>Mr(a.current,Ce,E)?Ce:void 0),void 0],ne),minIndex:te,maxIndex:ye,prevIndex:Tb(_.current>F?L:_.current,Q,ne,T,R.key===uo?"bl":R.key===(g?Wn:Zn)?"tr":"tl"),stopEvent:!0})];if(_e!=null&&(_.current=_e,j(R)),b==="both")return}if(Ts(R.key,b)){if(Yt(R),r&&!v&&Pt(R.currentTarget.ownerDocument)===R.currentTarget){_.current=La(R.key,b,g)?L:F,j(R);return}La(R.key,b,g)?h?H>=F?p&&H!==a.current.length?_.current=-1:(G.current=!1,_.current=L):_.current=Dt(a.current,{startingIndex:H,disabledIndices:E}):_.current=Math.min(F,Dt(a.current,{startingIndex:H,disabledIndices:E})):h?H<=L?p&&H!==-1?_.current=a.current.length:(G.current=!1,_.current=F):_.current=Dt(a.current,{startingIndex:H,decrement:!0,disabledIndices:E}):_.current=Math.max(L,Dt(a.current,{startingIndex:H,decrement:!0,disabledIndices:E})),ns(a.current,_.current)&&(_.current=-1),j(R)}}),ce=f.useMemo(()=>v&&r&&Y&&{"aria-activedescendant":`${P}-${c}`},[v,r,Y,P,c]),ve=f.useMemo(()=>({"aria-orientation":b==="both"?void 0:b,...O?{}:ce,onKeyDown(R){if(R.key==="Tab"&&R.shiftKey&&r&&!v){const H=lt(R.nativeEvent);if(H&&!we($.current,H))return;Yt(R),n.setOpen(!1,Ae(ur,R.nativeEvent)),it(s)&&s.focus();return}le(R)},onPointerMove(){A.current=!0}}),[ce,le,$,b,O,n,r,v,s]),ue=f.useMemo(()=>{function R(L){y==="auto"&&hl(L.nativeEvent)&&(k.current=!v)}function H(L){k.current=y,y==="auto"&&ml(L.nativeEvent)&&(k.current=!0)}return{onKeyDown(L){const F=n.select("open");A.current=!1;const Q=L.key.startsWith("Arrow"),ne=Fw(L.key,fe(),g),te=Ts(L.key,b),ye=(m?ne:te)||L.key==="Enter"||L.key.trim()==="";if(v&&F)return le(L);if(!(!F&&!S&&Q)){if(ye){const _e=Ts(L.key,fe());M.current=m&&_e?null:L.key}if(m){ne&&(Yt(L),F?(_.current=oa(a,K.current),j(L)):n.setOpen(!0,Ae(ba,L.nativeEvent,L.currentTarget)));return}te&&(se.current!=null&&(_.current=se.current),Yt(L),!F&&S?n.setOpen(!0,Ae(ba,L.nativeEvent,L.currentTarget)):le(L),F&&j(L))}},onFocus(L){n.select("open")&&!v&&(_.current=-1,j(L))},onPointerDown:H,onPointerEnter:H,onMouseDown:R,onClick:R}},[le,K,y,a,m,j,n,S,b,fe,g,se,v]),Se=f.useMemo(()=>({...ce,...ue}),[ce,ue]);return f.useMemo(()=>l?{reference:Se,floating:ve,item:ge,trigger:ue}:{},[l,Se,ve,ue,ge])}const $w=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function zd(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:a="dialog"}=t,c=Xn(),u=s?.id||c,l=f.useMemo(()=>lo(i)?.id||o,[i,o]),d=$w.get(a)??a,h=qn()!=null,m=f.useMemo(()=>d==="tooltip"||a==="label"?mt:{"aria-haspopup":d==="alertdialog"?"dialog":d,"aria-expanded":"false",...d==="listbox"&&{role:"combobox"},...d==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,h,a]),g=f.useMemo(()=>d==="tooltip"||a==="label"?{[`aria-${a==="label"?"labelledby":"describedby"}`]:r?l:void 0}:{...m,"aria-expanded":r?"true":"false","aria-controls":r?l:void 0,...d==="menu"&&{id:u}},[d,l,r,u,a,m]),v=f.useMemo(()=>{const C={id:l,...d&&{role:d}};return d==="tooltip"||a==="label"?C:{...C,...d==="menu"&&{"aria-labelledby":u}}},[d,l,u,a]),y=f.useCallback(({active:C,selected:S})=>{const E={role:"option",...C&&{id:`${l}-fui-option`}};switch(a){case"select":case"combobox":return{...E,"aria-selected":S}}return{}},[l,a]);return f.useMemo(()=>({reference:g,floating:v,item:y,trigger:m}),[g,v,m,y])}function jw(e,t){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,o=n.useState("open"),{listRef:s,elementsRef:i,activeIndex:a,onMatch:c,onTypingChange:u,enabled:l=!0,resetMs:d=750,selectedIndex:p=null}=t,h=Gt(),m=f.useRef(""),g=f.useRef(p??a??-1),v=f.useRef(null);he(()=>{!o&&p!==null||(h.clear(),v.current=null,m.current!==""&&(m.current=""))},[o,p,h]),he(()=>{o&&m.current===""&&(g.current=p??a??-1)},[o,p,a]);const y=ie(x=>{x?r.current.typing||(r.current.typing=x,u?.(x)):r.current.typing&&(r.current.typing=x,u?.(x))}),C=ie(x=>{function T(O){const k=i?.current[O];return!k||rs(k)}function P(O,k,_=0){if(O.length===0)return-1;const M=(_%O.length+O.length)%O.length,A=k.toLocaleLowerCase();for(let j=0;j<O.length;j+=1){const B=(M+j)%O.length;if(!(!O[B]?.toLocaleLowerCase().startsWith(A)||!T(B)))return B}return-1}const z=s.current;if(m.current.length>0&&x.key===" "&&(Yt(x),y(!0)),m.current.length>0&&m.current[0]!==" "&&P(z,m.current)===-1&&x.key!==" "&&y(!1),z==null||x.key.length!==1||x.ctrlKey||x.metaKey||x.altKey)return;o&&x.key!==" "&&(Yt(x),y(!0));const I=m.current==="";I&&(g.current=p??a??-1),z.every(O=>O?O[0]?.toLocaleLowerCase()!==O[1]?.toLocaleLowerCase():!0)&&m.current===x.key&&(m.current="",g.current=v.current),m.current+=x.key,h.start(d,()=>{m.current="",g.current=v.current,y(!1)});const V=((I?p??a??-1:g.current)??0)+1,N=P(z,m.current,V);N!==-1?(c?.(N),v.current=N):x.key!==" "&&(m.current="",y(!1))}),S=ie(x=>{const T=x.relatedTarget,P=n.select("domReferenceElement"),z=n.select("floatingElement"),I=we(P,T),D=we(z,T);I||D||(h.clear(),m.current="",g.current=v.current,y(!1))}),E=f.useMemo(()=>({onKeyDown:C,onBlur:S}),[C,S]),b=f.useMemo(()=>({onKeyDown:C,onBlur:S}),[C,S]);return f.useMemo(()=>l?{reference:E,floating:b}:{},[l,E,b])}const $d=.1,Hw=$d*$d,rt=.5;function Os(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function Ps(e,t,n,r,o,s,i,a,c,u){let l=!1;return Os(e,t,n,r,o,s)&&(l=!l),Os(e,t,o,s,i,a)&&(l=!l),Os(e,t,i,a,c,u)&&(l=!l),Os(e,t,c,u,n,r)&&(l=!l),l}function Uw(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function _s(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),c=Math.min(r,s),u=Math.max(r,s);return e>=i&&e<=a&&t>=c&&t<=u}function Bw(e={}){const{blockPointerEvents:t=!1}=e,n=new Zt,r=({x:o,y:s,placement:i,elements:a,onClose:c,nodeId:u,tree:l})=>{const d=i?.split("-")[0];let p=!1,h=null,m=null,g=typeof performance<"u"?performance.now():0;function v(C,S){const E=performance.now(),b=E-g;if(h===null||m===null||b===0)return h=C,m=S,g=E,!1;const x=C-h,T=S-m,P=x*x+T*T,z=b*b*Hw;return h=C,m=S,g=E,P<z}function y(){n.clear(),c()}return function(S){n.clear();const E=a.domReference,b=a.floating;if(!E||!b||d==null||o==null||s==null)return;const{clientX:x,clientY:T}=S,P=lt(S),z=S.type==="mouseleave",I=we(b,P),D=we(E,P);if(I&&(p=!0,!z))return;if(D&&(p=!1,!z)){p=!0;return}if(z&&$e(S.relatedTarget)&&we(b,S.relatedTarget))return;function $(){return!!(l&&vn(l.nodesRef.current,u).length>0)}function V(){$()||y()}if($())return;const N=E.getBoundingClientRect(),O=b.getBoundingClientRect(),k=o>O.right-O.width/2,_=s>O.bottom-O.height/2,M=O.width>N.width,A=O.height>N.height,j=(M?N:O).left,B=(M?N:O).right,U=(A?N:O).top,W=(A?N:O).bottom;if(d==="top"&&s>=N.bottom-1||d==="bottom"&&s<=N.top+1||d==="left"&&o>=N.right-1||d==="right"&&o<=N.left+1){V();return}let G=!1;switch(d){case"top":G=_s(x,T,j,N.top+1,B,O.bottom-1);break;case"bottom":G=_s(x,T,j,O.top+1,B,N.bottom-1);break;case"left":G=_s(x,T,O.right-1,W,N.left+1,U);break;case"right":G=_s(x,T,N.right-1,W,O.left+1,U);break}if(G)return;if(p&&!Uw(x,T,N)){V();return}if(!z&&v(x,T)){V();return}let Z=!1;switch(d){case"top":{const X=M?rt/2:rt*4,K=M||k?o+X:o-X,J=M?o-X:k?o+X:o-X,se=s+rt+1,ae=k||M?O.bottom-rt:O.top,pe=k?M?O.bottom-rt:O.top:O.bottom-rt;Z=Ps(x,T,K,se,J,se,O.left,ae,O.right,pe);break}case"bottom":{const X=M?rt/2:rt*4,K=M||k?o+X:o-X,J=M?o-X:k?o+X:o-X,se=s-rt,ae=k||M?O.top+rt:O.bottom,pe=k?M?O.top+rt:O.bottom:O.top+rt;Z=Ps(x,T,K,se,J,se,O.left,ae,O.right,pe);break}case"left":{const X=A?rt/2:rt*4,K=A||_?s+X:s-X,J=A?s-X:_?s+X:s-X,se=o+rt+1,ae=_||A?O.right-rt:O.left,pe=_?A?O.right-rt:O.left:O.right-rt;Z=Ps(x,T,ae,O.top,pe,O.bottom,se,K,se,J);break}case"right":{const X=A?rt/2:rt*4,K=A||_?s+X:s-X,J=A?s-X:_?s+X:s-X,se=o-rt,ae=_||A?O.left+rt:O.right,pe=_?A?O.left+rt:O.right:O.left+rt;Z=Ps(x,T,se,K,se,J,ae,O.top,pe,O.bottom);break}}Z?p||n.start(40,V):V()}};return r.__options={...e,blockPointerEvents:t},r}const jd=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:a,...c}=t,{portalNode:u,portalSubtree:l}=cd({container:o,ref:n,componentProps:t,elementProps:c});return!l&&!u?null:w.jsxs(f.Fragment,{children:[l,u&&Kt.createPortal(r,u)]})});process.env.NODE_ENV!=="production"&&(jd.displayName="FloatingPortalLite");const Ww=jd,Hd=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Hd.displayName="DirectionContext");function Ud(){return f.useContext(Hd)?.direction??"ltr"}const Zw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:l=0,offsetParent:d="real"}=Mn(e,t)||{};if(u==null)return{};const p=bl(l),h={x:n,y:r},m=na(o),g=ta(m),v=await i.getDimensions(u),y=m==="y",C=y?"top":"left",S=y?"bottom":"right",E=y?"clientHeight":"clientWidth",b=s.reference[g]+s.reference[m]-h[m]-s.floating[g],x=h[m]-s.reference[m],T=d==="real"?await i.getOffsetParent?.(u):a.floating;let P=a.floating[E]||s.floating[g];(!P||!await i.isElement?.(T))&&(P=a.floating[E]||s.floating[g]);const z=b/2-x/2,I=P/2-v[g]/2-1,D=Math.min(p[C],I),$=Math.min(p[S],I),V=D,N=P-v[g]-$,O=P/2-v[g]/2+z,k=Qi(V,O,N),_=!c.arrow&&Gn(o)!=null&&O!==k&&s.reference[g]/2-(O<V?D:$)-v[g]/2<0,M=_?O<V?O-V:O-N:0;return{[m]:h[m]+M,data:{[m]:k,centerOffset:O-k-M,..._&&{alignmentOffset:M}},reset:_}}}),Gw=(e,t)=>({...Zw(e),options:[e,t]}),Yw={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 _w().fn(e)).data?.referenceHidden||s}}}},Is={sideX:"left",sideY:"top"},Xw={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=e,c=tt(o),u=c.getComputedStyle(o);if(!(u.transitionDuration!=="0s"&&u.transitionDuration!==""))return{x:t,y:n,data:Is};const d=await s.getOffsetParent?.(o);let p={width:0,height:0};if(i==="fixed"&&c?.visualViewport)p={width:c.visualViewport.width,height:c.visualViewport.height};else if(d===c){const C=Ie(o);p={width:C.documentElement.clientWidth,height:C.documentElement.clientHeight}}else await s.isElement?.(d)&&(p=await s.getDimensions(d));const h=jt(a);let m=t,g=n;h==="left"&&(m=p.width-(t+r.width)),h==="top"&&(g=p.height-(n+r.height));const v=h==="left"?"right":Is.sideX,y=h==="top"?"bottom":Is.sideY;return{x:m,y:g,data:{sideX:v,sideY:y}}}};function Bd(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 Wd(e,t,n){const{rects:r,placement:o}=e;return{side:Bd(t,jt(o),n),align:Gn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Zd(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:c=5,sticky:u=!1,arrowPadding:l=5,disableAnchorTracking:d=!1,keepMounted:p=!1,floatingRootContext:h,mounted:m,collisionAvoidance:g,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:C,lazyFlip:S=!1,externalTree:E}=e,[b,x]=f.useState(null);!m&&b!==null&&x(null);const T=g.side||"flip",P=g.align||"flip",z=g.fallbackAxisSide||"end",I=typeof t=="function"?t:void 0,D=ie(I),$=I?D:t,V=vt(t),N=vt(m),k=Ud()==="rtl",_=b||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":k?"left":"right","inline-start":k?"right":"left"}[r],M=s==="center"?_:`${_}-${s}`;let A=c;const j=1,B=r==="bottom"?j:0,U=r==="top"?j:0,W=r==="right"?j:0,G=r==="left"?j:0;typeof A=="number"?A={top:A+B,right:A+G,bottom:A+U,left:A+W}:A&&(A={top:(A.top||0)+B,right:(A.right||0)+G,bottom:(A.bottom||0)+U,left:(A.left||0)+W});const Z={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:A},X=f.useRef(null),K=vt(o),J=vt(i),pe=[xw(Re=>{const Te=Wd(Re,r,k),Ue=typeof K.current=="function"?K.current(Te):K.current,Be=typeof J.current=="function"?J.current(Te):J.current;return{mainAxis:Ue,crossAxis:Be,alignmentAxis:Be}},[typeof o!="function"?o:0,typeof i!="function"?i:0,k,r])],Y=P==="none"&&T!=="shift",me=!Y&&(u||v||T==="shift"),ge=T==="none"?null:Ow({...Z,padding:{top:A.top+j,right:A.right+j,bottom:A.bottom+j,left:A.left+j},mainAxis:!v&&T==="flip",crossAxis:P==="flip"?"alignment":!1,fallbackAxisSideDirection:z}),fe=Y?null:Cw(Re=>{const Te=Ie(Re.elements.floating).documentElement;return{...Z,rootBoundary:v?{x:0,y:0,width:Te.clientWidth,height:Te.clientHeight}:void 0,mainAxis:P!=="none",crossAxis:me,limiter:u||v?void 0:Tw(Ue=>{if(!X.current)return{};const{width:Be,height:ct}=X.current.getBoundingClientRect(),Ye=en(jt(Ue.placement)),Ut=Ye==="y"?Be:ct,$t=Ye==="y"?A.left+A.right:A.top+A.bottom;return{offset:Ut/2+$t/2}})}},[Z,u,v,A,P]);T==="shift"||P==="shift"||s==="center"?pe.push(fe,ge):pe.push(ge,fe),pe.push(Pw({...Z,apply({elements:{floating:Re},availableWidth:Te,availableHeight:Ue,rects:Be}){if(!N.current)return;const ct=Re.style;ct.setProperty("--available-width",`${Te}px`),ct.setProperty("--available-height",`${Ue}px`);const Ye=tt(Re).devicePixelRatio||1,{x:Ut,y:$t,width:Ke,height:q}=Be.reference,re=(Math.round((Ut+Ke)*Ye)-Math.round(Ut*Ye))/Ye,be=(Math.round(($t+q)*Ye)-Math.round($t*Ye))/Ye;ct.setProperty("--anchor-width",`${re}px`),ct.setProperty("--anchor-height",`${be}px`)}}),Gw(()=>({element:X.current||Ie(X.current).createElement("div"),padding:l,offsetParent:"floating"}),[l]),{name:"transformOrigin",fn(Re){const{elements:Te,middlewareData:Ue,placement:Be,rects:ct,y:Ye}=Re,Ut=jt(Be),$t=en(Ut),Ke=X.current,q=Ue.arrow?.x||0,re=Ue.arrow?.y||0,be=Ke?.clientWidth||0,Le=Ke?.clientHeight||0,je=q+be/2,De=re+Le/2,Qe=Math.abs(Ue.shift?.y||0),Oe=ct.reference.height/2,xe=typeof o=="function"?o(Wd(Re,r,k)):o,Ne=Qe>xe,Me={top:`${je}px calc(100% + ${xe}px)`,bottom:`${je}px ${-xe}px`,left:`calc(100% + ${xe}px) ${De}px`,right:`${-xe}px ${De}px`}[Ut],Xe=`${je}px ${ct.reference.y+Oe-Ye}px`;return Te.floating.style.setProperty("--transform-origin",me&&$t==="y"&&Ne?Xe:Me),{}}},Yw,C),he(()=>{!m&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,h]);const le=f.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:ce,elements:ve,x:ue,y:Se,middlewareData:R,update:H,placement:L,context:F,isPositioned:Q,floatingStyles:ne}=Nw({rootContext:h,open:p?m:void 0,placement:M,middleware:pe,strategy:n,whileElementsMounted:p?void 0:(...Re)=>Od(...Re,le),nodeId:y,externalTree:E}),{sideX:te,sideY:ye}=R.adaptiveOrigin||Is,_e=Q?n:"fixed",Ee=f.useMemo(()=>{const Re=C?{position:_e,[te]:ue,[ye]:Se}:{position:_e,...ne};return Q||(Re.opacity=0),Re},[C,_e,te,ue,ye,Se,ne,Q]),Ce=f.useRef(null);he(()=>{if(!m)return;const Re=V.current,Te=typeof Re=="function"?Re():Re,Be=(Gd(Te)?Te.current:Te)||null||null;Be!==Ce.current&&(ce.setPositionReference(Be),Ce.current=Be)},[m,ce,$,V]),f.useEffect(()=>{if(!m)return;const Re=V.current;typeof Re!="function"&&Gd(Re)&&Re.current!==Ce.current&&(ce.setPositionReference(Re.current),Ce.current=Re.current)},[m,ce,$,V]),f.useEffect(()=>{if(p&&m&&ve.domReference&&ve.floating)return Od(ve.domReference,ve.floating,H,le)},[p,m,ve,H,le]);const Pe=jt(L),Ve=Bd(r,Pe,k),Ge=Gn(L)||"center",He=!!R.hide?.referenceHidden;he(()=>{S&&m&&Q&&x(Pe)},[S,m,Q,Pe]);const nt=f.useMemo(()=>({position:"absolute",top:R.arrow?.y,left:R.arrow?.x}),[R.arrow]),st=R.arrow?.centerOffset!==0;return f.useMemo(()=>({positionerStyles:Ee,arrowStyles:nt,arrowRef:X,arrowUncentered:st,side:Ve,align:Ge,physicalSide:Pe,anchorHidden:He,refs:ce,context:F,isPositioned:Q,update:H}),[Ee,nt,X,st,Ve,Ge,Pe,He,ce,F,Q,H])}function Gd(e){return e!=null&&"current"in e}let Ft=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=sr.startingStyle]="startingStyle",e[e.endingStyle=sr.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),Fa=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const qw={[Fa.popupOpen]:""},Kw={[Fa.popupOpen]:"",[Fa.pressed]:""},Jw={[Ft.open]:""},Qw={[Ft.closed]:""},eS={[Ft.anchorHidden]:""},Yd={open(e){return e?qw:null}},Xd={open(e){return e?Kw:null}},Cn={open(e){return e?Jw:Qw},anchorHidden(e){return e?eS:null}};function Va(e){return e==="starting"?a0:mt}function qd(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:a=!1}){const c={...n};return a&&(c.pointerEvents="none"),qe("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:c},Va(r),o],stateAttributesMapping:Cn})}function Kd(){const e=f.useContext(zo);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":ft(73));const t=e.useState("toasts");return f.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function fr(...e){return Mi(Mu(e))}const Jd={Viewport:"_Viewport_ai81v_1",Toast:"_Toast_ai81v_14"};let zr=null,wo=3e3;function tS({timeout:e}){const t=Kd();return f.useEffect(()=>(zr=t,wo=e,()=>{zr=null}),[t,e]),null}const gt={success:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo}),error:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo}),info:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo}),warning:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo})};function nS({toastConfigs:e}){const t=e?.timeout??3e3;return w.jsxs(Nl,{timeout:t,children:[w.jsx(tS,{timeout:t}),w.jsx(rS,{configs:e})]})}function rS({configs:e}){const{toasts:t}=Kd();return w.jsx(Ww,{children:w.jsx(Ul,{className:fr(Jd.Viewport,e?.viewportClassName),children:t.map(n=>w.jsx(Gl,{toast:n,className:fr("pointer-events-none flex items-center justify-center px-6 py-3 min-w-[200px] max-w-[80vw]","text-white text-base rounded-md bg-black/80",Jd.Toast,e?.className),style:e?.style,children:w.jsx(ql,{className:"text-xs",children:n.description})},n.id))})})}class oS{baseUrl;credentials;interceptors;timeout;onError;headers;constructor({baseUrl:t,timeout:n=1/0,responseInterceptor:r=c=>c.data,requestInterceptor:o=c=>c,onError:s=()=>{},headers:i,credentials:a="include"}){this.baseUrl=t,this.timeout=n,this.credentials=a,this.interceptors={request:o,response:r},this.headers=new Headers({"Content-Type":"application/json",...i}),this.onError=s}async request(t){const n=new AbortController;t.url=`${this.baseUrl}${t.url}`,t=this.interceptors.request(t);const r=new Headers(this.headers);Object.entries(t.headers||{}).forEach(([a,c])=>{r.set(a,c)});const o=this.headers.get("content-type");let s=null;if(t.data instanceof FormData)s=t.data,r.delete("Content-Type");else if(t.data!==void 0&&t.method!=="GET")if(o==="application/x-www-form-urlencoded"){const a=new URLSearchParams;for(const c in t.data)t.data[c]!==void 0&&a.append(c,t.data[c]);s=a.toString()}else s=JSON.stringify(t.data);else if(t.method==="GET"){const a=new URLSearchParams;for(const u in t.data)t.data[u]!==void 0&&a.append(u,t.data[u]);const c=a.toString();t.url+=c?`?${c}`:""}const i=fetch(t.url,{method:t.method,headers:r,body:s,signal:t.signal||n.signal,credentials:this.credentials});try{const a=t.timeout||this.timeout,{timeoutId:c,timeoutPromise:u}=this._setTimeout(a,n),l=await Promise.race([i,u].filter(Boolean));if(c&&clearTimeout(c),l.ok){const d=await l.json();return this.interceptors.response(d,l).catch(p=>(this.onError({data:p,response:l}),Promise.reject(d)))}else{const d=await l.json();return this.onError({data:d,response:l}),Promise.reject(d)}}catch(a){return a.name!=="AbortError"&&this.onError({}),Promise.reject(a)}}_setTimeout(t,n){let r=null,o=null;return t!==1/0&&(o=new Promise((s,i)=>{r=setTimeout(()=>{i(new Error("请求超时")),n.abort()},t)})),{timeoutPromise:o,timeoutId:r}}get(t,n,r){return this.request({...r,url:t,method:"GET",data:n})}post(t,n,r){return this.request({...r,url:t,method:"POST",data:n})}put(t,n,r){return this.request({...r,url:t,method:"PUT",data:n})}delete(t,n){return this.request({...n,url:t,method:"DELETE"})}patch(t,n,r){return this.request({...r,url:t,method:"PATCH",data:n})}}const _t=new oS({baseUrl:"https://apis.sdk.mobileztgame.com",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded"},async responseInterceptor(e,t){if(["/passport-api/v2/ztgame/auth/login","/passport-api/v2/sms-captchas","/passport-api/v2/ztgame/auth/mobile-register","/passport-api/v2/ztgame/auth/auth","/passport-api/v2/ztgame/auth/re-auth","/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys","/passport-api/v2/ztgame/user-center/forget-password/","/passport-api/v2/ztgame/user-center/forget-password/sms-captchas","/passport-api/v2/ztgame/user-center/forget-password/forget-password-update","/idcard"].some(r=>t.url.includes(r))){const r=t.headers.get("set-authentication")||t.headers.get("Set-Authentication")||"";return{...e,_auth:r}}if(e?.code!==0)throw new Error(e.error);return e},onError({response:e,data:t}){if(e&&e?.status!==401){const n=`${t?.message||t?.detail||"未知错误"}`;gt.error(n)}}});function Qd(e){_t.headers.set("Authentication",e)}const at={ROLE_ID:"roleid",GIANT:"giant",MOBILE:"mobile"},ks={default:{types:[at.GIANT,at.MOBILE],default:at.GIANT},5327:{types:[at.GIANT,at.MOBILE],default:at.MOBILE},5273:{types:[at.ROLE_ID],default:at.ROLE_ID},5199:{types:[at.ROLE_ID],default:at.ROLE_ID},5012:{types:[at.ROLE_ID],default:at.ROLE_ID},5242:{types:[at.GIANT,at.MOBILE],default:at.MOBILE}};function St(...e){return Mi(Mu(e))}function sS(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,n)=>String.fromCharCode(Number.parseInt(n,16))))}function iS(e){return e==="5199"||e==="5012"}function aS(e){const{entity:t,gaplaySign:n}=e;return sS(`${JSON.stringify(t)}$$${n}`)}function Rs(e,t){return t||ks[e]?.types||ks.default?.types||[]}function cS(e,t){return t||ks[e]?.default||ks.default?.default}function ef({loginTypes:e,gameId:t}){return Rs(t,e).includes(at.GIANT)}function tf({loginTypes:e,gameId:t}){return Rs(t,e).includes(at.ROLE_ID)}function nf({loginTypes:e,gameId:t}){return Rs(t,e).includes(at.MOBILE)}function rf({gameId:e}){_t.headers.set("X-GAME-ID",e),_t.headers.set("X-Login-H5","1");const t=localStorage.getItem("UNIQUE_ID");t&&_t.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:t,appunid:t}))}async function uS({gameId:e}){rf({gameId:e});let t=localStorage.getItem("UNIQUE_ID");t||(t=(await(await $y.load()).get()).visitorId,localStorage.setItem("UNIQUE_ID",t)),_t.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:t,appunid:t}))}const lS=[{code:"86",name:"中国大陆"},{code:"886",name:"台湾地区"},{code:"852",name:"香港特别行政区"},{code:"853",name:"澳门特别行政区"},{code:"1",name:"美国"},{code:"81",name:"日本"},{code:"376",name:"安道尔"},{code:"971",name:"阿拉伯联合酋长国"},{code:"93",name:"阿富汗"},{code:"1268",name:"安提瓜和巴布达"},{code:"1264",name:"安圭拉"},{code:"355",name:"阿尔巴尼亚"},{code:"374",name:"亚美尼亚"},{code:"244",name:"安哥拉"},{code:"54",name:"阿根廷"},{code:"1684",name:"美属萨摩亚"},{code:"43",name:"奥地利"},{code:"61",name:"澳大利亚"},{code:"297",name:"阿鲁巴"},{code:"994",name:"阿塞拜疆"},{code:"387",name:"波斯尼亚和黑塞哥维那"},{code:"1246",name:"巴巴多斯"},{code:"880",name:"孟加拉国"},{code:"32",name:"比利时"},{code:"226",name:"布基纳法索"},{code:"359",name:"保加利亚"},{code:"973",name:"巴林"},{code:"257",name:"布隆迪"},{code:"229",name:"贝宁"},{code:"1441",name:"百慕大群岛"},{code:"673",name:"文莱"},{code:"591",name:"玻利维亚"},{code:"599",name:"荷兰加勒比"},{code:"55",name:"巴西"},{code:"1242",name:"巴哈马"},{code:"975",name:"不丹"},{code:"267",name:"博茨瓦纳"},{code:"375",name:"白俄罗斯"},{code:"501",name:"伯利兹"},{code:"1",name:"加拿大"},{code:"243",name:"刚果民主共和国"},{code:"236",name:"中非共和国"},{code:"242",name:"刚果共和国"},{code:"41",name:"瑞士"},{code:"225",name:"象牙海岸"},{code:"682",name:"库克群岛"},{code:"56",name:"智利"},{code:"237",name:"喀麦隆"},{code:"57",name:"哥伦比亚"},{code:"506",name:"哥斯达黎加"},{code:"53",name:"古巴"},{code:"238",name:"佛得角共和国"},{code:"599",name:"库拉索"},{code:"357",name:"塞浦路斯"},{code:"420",name:"捷克"},{code:"49",name:"德国"},{code:"253",name:"吉布提"},{code:"45",name:"丹麦"},{code:"1767",name:"多米尼加"},{code:"1809",name:"多米尼加共和国"},{code:"213",name:"阿尔及利亚"},{code:"593",name:"厄瓜多尔"},{code:"372",name:"爱沙尼亚"},{code:"20",name:"埃及"},{code:"291",name:"厄立特里亚"},{code:"34",name:"西班牙"},{code:"251",name:"埃塞俄比亚"},{code:"358",name:"芬兰"},{code:"679",name:"斐济"},{code:"691",name:"密克罗尼西亚"},{code:"298",name:"法罗群岛"},{code:"33",name:"法国"},{code:"241",name:"加蓬"},{code:"44",name:"英国"},{code:"1473",name:"格林纳达"},{code:"995",name:"格鲁吉亚"},{code:"594",name:"法属圭亚那"},{code:"233",name:"加纳"},{code:"350",name:"直布罗陀"},{code:"299",name:"格陵兰岛"},{code:"220",name:"冈比亚"},{code:"224",name:"几内亚"},{code:"590",name:"瓜德罗普岛"},{code:"240",name:"赤道几内亚"},{code:"30",name:"希腊"},{code:"502",name:"瓜地马拉"},{code:"1671",name:"关岛"},{code:"245",name:"几内亚比绍共和国"},{code:"592",name:"圭亚那"},{code:"504",name:"洪都拉斯"},{code:"385",name:"克罗地亚"},{code:"509",name:"海地"},{code:"36",name:"匈牙利"},{code:"62",name:"印度尼西亚"},{code:"353",name:"爱尔兰"},{code:"972",name:"以色列"},{code:"91",name:"印度"},{code:"964",name:"伊拉克"},{code:"98",name:"伊朗"},{code:"354",name:"冰岛"},{code:"39",name:"意大利"},{code:"1876",name:"牙买加"},{code:"962",name:"约旦"},{code:"254",name:"肯尼亚"},{code:"996",name:"吉尔吉斯斯坦"},{code:"855",name:"柬埔寨"},{code:"686",name:"基里巴斯"},{code:"269",name:"科摩罗"},{code:"1869",name:"圣基茨和尼维斯"},{code:"850",name:"朝鲜"},{code:"82",name:"韩国"},{code:"965",name:"科威特"},{code:"1345",name:"开曼群岛"},{code:"7",name:"哈萨克斯坦"},{code:"856",name:"老挝"},{code:"961",name:"黎巴嫩"},{code:"1758",name:"圣露西亚"},{code:"423",name:"列支敦士登"},{code:"94",name:"斯里兰卡"},{code:"231",name:"利比里亚"},{code:"266",name:"莱索托"},{code:"370",name:"立陶宛"},{code:"352",name:"卢森堡"},{code:"371",name:"拉脱维亚"},{code:"218",name:"利比亚"},{code:"212",name:"摩洛哥"},{code:"377",name:"摩纳哥"},{code:"373",name:"摩尔多瓦"},{code:"382",name:"黑山"},{code:"261",name:"马达加斯加"},{code:"692",name:"马绍尔群岛"},{code:"389",name:"北马其顿"},{code:"223",name:"马里"},{code:"95",name:"缅甸"},{code:"976",name:"蒙古"},{code:"222",name:"毛里塔尼亚"},{code:"1664",name:"蒙特塞拉特岛"},{code:"356",name:"马耳他"},{code:"230",name:"毛里求斯"},{code:"960",name:"马尔代夫"},{code:"265",name:"马拉维"},{code:"52",name:"墨西哥"},{code:"60",name:"马来西亚"},{code:"258",name:"莫桑比克"},{code:"264",name:"纳米比亚"},{code:"687",name:"新喀里多尼亚"},{code:"227",name:"尼日尔"},{code:"234",name:"尼日利亚"},{code:"505",name:"尼加拉瓜"},{code:"31",name:"荷兰"},{code:"47",name:"挪威"},{code:"977",name:"尼泊尔"},{code:"674",name:"拿鲁岛"},{code:"64",name:"新西兰"},{code:"968",name:"阿曼"},{code:"507",name:"巴拿马"},{code:"51",name:"秘鲁"},{code:"689",name:"法属波利尼西亚"},{code:"675",name:"巴布亚新几内亚"},{code:"63",name:"菲律宾"},{code:"92",name:"巴基斯坦"},{code:"48",name:"波兰"},{code:"508",name:"圣彼埃尔和密克隆岛"},{code:"1787",name:"波多黎各"},{code:"351",name:"葡萄牙"},{code:"680",name:"帕劳"},{code:"595",name:"巴拉圭"},{code:"974",name:"卡塔尔"},{code:"262",name:"留尼汪"},{code:"40",name:"罗马尼亚"},{code:"381",name:"塞尔维亚"},{code:"7",name:"俄罗斯"},{code:"250",name:"卢旺达"},{code:"966",name:"沙特阿拉伯"},{code:"677",name:"所罗门群岛"},{code:"248",name:"塞舌尔"},{code:"249",name:"苏丹"},{code:"46",name:"瑞典"},{code:"65",name:"新加坡"},{code:"386",name:"斯洛文尼亚"},{code:"421",name:"斯洛伐克"},{code:"232",name:"塞拉利昂"},{code:"378",name:"圣马力诺"},{code:"221",name:"塞内加尔"},{code:"252",name:"索马里"},{code:"597",name:"苏里南"},{code:"239",name:"圣多美和普林西比"},{code:"503",name:"萨尔瓦多"},{code:"963",name:"叙利亚"},{code:"268",name:"埃斯瓦蒂尼"},{code:"1649",name:"特克斯和凯科斯群岛"},{code:"235",name:"乍得"},{code:"228",name:"多哥"},{code:"66",name:"泰国"},{code:"992",name:"塔吉克斯坦"},{code:"670",name:"东帝汶"},{code:"993",name:"土库曼斯坦"},{code:"216",name:"突尼斯"},{code:"676",name:"汤加"},{code:"90",name:"土耳其"},{code:"1868",name:"特立尼达和多巴哥"},{code:"255",name:"坦桑尼亚"},{code:"380",name:"乌克兰"},{code:"256",name:"乌干达"},{code:"598",name:"乌拉圭"},{code:"998",name:"乌兹别克斯坦"},{code:"1784",name:"圣文森特和格林纳丁斯"},{code:"58",name:"委内瑞拉"},{code:"1284",name:"英属处女群岛"},{code:"84",name:"越南"},{code:"678",name:"瓦努阿图"},{code:"685",name:"萨摩亚"},{code:"967",name:"也门"},{code:"269",name:"马约特"},{code:"27",name:"南非"},{code:"260",name:"赞比亚"},{code:"263",name:"津巴布韦"}].map(e=>({label:e.name,value:e.code,id:`${e.code}-${e.name}`}));function dS(e){return lS}function fS(e){return"account"in e}function pS({gameId:e,serverUserInfo:t,extraState:n}){const r={game_id:e,xToken:aS(t),saveTime:t.entity.time,$version:"v2",extraState:n};if(fS(t))r.openid=t.entity.openid,r.gaplaySign=t.gaplaySign,r.account=t.account,r.username=t.account.view_name,r.loginByRoleMail=!1,r.channelId=t.channel||6;else if(t.gaplaySign){const{ZONEID:o,openid:s,CHARID:i,NAME:a,REALZONEID:c,ZONENAME:u}=t.entity;r.openid=s,r.zone={zoneid:c||o,zonename:u,area:o},r.char={...t.entity,CHARID:i,NAME:a,GAMEPOINT:t.entity.GAMEPOINT,VIPLEVEL:t.entity.VIPLEVEL},r.loginByRoleMail=!0,r.gaplaySign=t.gaplaySign}else{const{ZONEID:o,CHARID:s,NAME:i,REALZONEID:a,ZONENAME:c,OPENID:u,CHANNELID:l,GAMEPOINT:d,VIPLEVEL:p}=t.entity;r.openid=u,r.channelId=l,r.char={CHARID:s,NAME:i,GAMEPOINT:d,VIPLEVEL:p},r.loginByRoleMail=!1,r.username=i,r.zone={zoneid:a||o,zonename:c,area:o},r.xToken=void 0}return r}function of(){try{const e=localStorage.getItem("userInfo")||"[]";return JSON.parse(e)}catch{return[]}}function za(e){return of().find(n=>n.game_id===e)}function hS(e){const t=localStorage.getItem("userInfo")||"[]",n=JSON.parse(t),r=n.find(s=>s.game_id===e);r?.openid&&sf(r.openid,e);const o=n.filter(s=>s.game_id!==e);localStorage.setItem("userInfo",JSON.stringify(o))}function mS(e){const t=of(),n=za(e.game_id),r=t.findIndex(o=>o.game_id===e.game_id);n?t[r]=e:t.push(e),localStorage.setItem("userInfo",JSON.stringify(t))}const So="LOGIN_SDK_ACCOUNTS";function $r(e){try{const t=JSON.parse(localStorage.getItem(So)||"[]");return e?t.filter(n=>n.gameId===e):t}catch{return[]}}function Ns(e,t,n){if(!n)return;const r=JSON.parse(localStorage.getItem(So)||"[]");let o=1;const s=r.filter(c=>c.openid===e.accid&&c.gameId===n?(o=(c.loginCnt||1)+1,!1):!0),a=[{openid:e.accid,username:e.account?.view_name||"",uid:e.account?.uid||"",mobile:e.account?.mobile||"",accountType:e.account?.account_type||0,authorization:t,loginAt:Date.now(),loginCnt:o,gameId:n},...s].slice(0,20);localStorage.setItem(So,JSON.stringify(a))}function sf(e,t){if(!t)return;const r=JSON.parse(localStorage.getItem(So)||"[]").filter(o=>!(o.openid===e&&o.gameId===t));localStorage.setItem(So,JSON.stringify(r))}let af={};function cf(e){af=e}function pr(e){const t=e||af.gameId;if(!t)throw new Error("gameId is required. Call init({ gameId }) first or pass it as an argument.");return t}const uf=oe.createContext(void 0),gS={enabled:!0,days:7},lf={"--primary-color":"#787bf4","--icon-color":"#a9aad1","--input-border-color":"#cad0e0","--input-label-color":"var(--jssdk-primary-color)","--input-bg-color":"#fff"};function Dn(){const e=oe.use(uf);if(!e)throw new Error("useConfig 必须在 ConfigProvider 中使用");return e}function df({children:e,value:t}){const n=pr(t.gameId),r=Rs(n,t.loginTypes),o=cS(n,t.defaultLoginType),s=oe.useRef(null);rf({gameId:n});const i=oe.useMemo(()=>!t.defaultLoginType&&$r(n).length>0?"quick":o,[t.defaultLoginType,n,o]),[a,c]=oe.useState(i),[u,l]=oe.useState(!0),[d,p]=oe.useState(!1),[h,m]=oe.useState(!1),[g,v]=oe.useState(""),y=()=>{p(!0)};oe.useEffect(()=>{uS({gameId:n})},[n]);const C={...t,gameId:n,loginTypes:r,defaultLoginType:o,autoLoginConfig:{...gS,...t.autoLoginConfig}};oe.useEffect(()=>{document.body.classList.add(`game-${n}`)},[n]);function S(E){Object.entries(E).forEach(([b,x])=>{const T=`--jssdk-${b.replace(/^--/,"")}`;document.documentElement.style.setProperty(T,x)})}return oe.useEffect(()=>{const E=s.current;if(E){const b={...lf,...t.styleVars};S(b)}return()=>{E&&S(lf)}},[t.styleVars]),w.jsx("div",{ref:s,children:w.jsx(uf,{value:{...C,currentLoginType:a,setCurrentLoginType:c,isShowGiantLogo:u,setIsShowGiantLogo:l,showRealNameModal:d,setShowRealNameModal:p,triggerRealNameAuth:y,isAutoLoggingIn:h,setIsAutoLoggingIn:m,autoLoginAccountName:g,setAutoLoginAccountName:v,onClose:t.onClose},children:e})})}function Eo({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=f.useRef(e!==void 0),[s,i]=f.useState(t),a=o?e:s;if(process.env.NODE_ENV!=="production"){f.useEffect(()=>{o!==(e!==void 0)&&ar([`A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
17
17
  `))},[r,n,e]);const{current:u}=f.useRef(t);f.useEffect(()=>{!o&&ff(u)!==ff(t)&&ar([`A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
18
18
  `))},[t])}const c=f.useCallback(u=>{o||i(u)},[]);return[a,c]}function ff(e){let t=0;const n=new WeakMap;try{return JSON.stringify(e,function(s,i){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof i=="bigint")return`__bigint__:${i}`;if(i!==null&&typeof i=="object"){const a=n.get(i);if(a!==void 0)return`__object__:${a}`;n.set(i,t),t+=1}return i}})??`__top__:${typeof e}`}catch{return"__unserializable__"}}const $a=f.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});process.env.NODE_ENV!=="production"&&($a.displayName="CompositeListContext");function yS(){return f.useContext($a)}function vS(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ie(o),i=f.useRef(0),a=wt(wS).current,c=wt(bS).current,[u,l]=f.useState(0),d=f.useRef(u),p=ie((y,C)=>{c.set(y,C??null),d.current+=1,l(d.current)}),h=ie(y=>{c.delete(y),d.current+=1,l(d.current)}),m=f.useMemo(()=>{const y=new Map;return Array.from(c.keys()).filter(S=>S.isConnected).sort(SS).forEach((S,E)=>{const b=c.get(S)??{};y.set(S,{...b,index:E})}),y},[c,u]);he(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const y=new MutationObserver(C=>{const S=new Set,E=b=>S.has(b)?S.delete(b):S.add(b);C.forEach(b=>{b.removedNodes.forEach(E),b.addedNodes.forEach(E)}),S.size===0&&(d.current+=1,l(d.current))});return m.forEach((C,S)=>{S.parentElement&&y.observe(S.parentElement,{childList:!0})}),()=>{y.disconnect()}},[m]),he(()=>{d.current===u&&(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,u]),he(()=>()=>{n.current=[]},[n]),he(()=>()=>{r&&(r.current=[])},[r]);const g=ie(y=>(a.add(y),()=>{a.delete(y)}));he(()=>{a.forEach(y=>y(m))},[a,m]);const v=f.useMemo(()=>({register:p,unregister:h,subscribeMapChange:g,elementsRef:n,labelsRef:r,nextIndexRef:i}),[p,h,g,n,r,i]);return w.jsx($a.Provider,{value:v,children:t})}function bS(){return new Map}function wS(){return new Set}function SS(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}function qt(e){return Xn(e,"base-ui")}let pf=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function ES(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:c,elementsRef:u,labelsRef:l,nextIndexRef:d}=yS(),p=f.useRef(-1),[h,m]=f.useState(s??(o===pf.GuessFromOrder?()=>{if(p.current===-1){const y=d.current;d.current+=1,p.current=y}return p.current}:-1)),g=f.useRef(null),v=f.useCallback(y=>{if(g.current=y,h!==-1&&y!==null&&(u.current[h]=y,l)){const C=t!==void 0;l.current[h]=C?t:r?.current?.textContent??y.textContent}},[h,u,l,t,r]);return he(()=>{if(s!=null)return;const y=g.current;if(y)return i(y,n),()=>{a(y)}},[s,i,a,n]),he(()=>{if(s==null)return c(y=>{const C=g.current?y.get(g.current)?.index:null;C!=null&&m(C)})},[s,c,m]),f.useMemo(()=>({ref:v,index:h}),[h,v])}const hf="ArrowUp",mf="ArrowDown",gf="ArrowLeft",yf="ArrowRight",vf="Home",bf="End",xS=new Set([gf,yf]),CS=new Set([hf,mf]),TS=new Set([...xS,...CS]);[...TS];const Ms=new Set([hf,mf,gf,yf,vf,bf]);function ja(e){const t=f.useRef(!0);t.current&&(t.current=!1,e())}let wf={},Sf={},Ef="";function OS(e){if(typeof document>"u")return!1;const t=Ie(e);return tt(t).innerWidth-t.documentElement.clientWidth>0}function PS(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Ie(e),r=n.documentElement,o=n.body,s=Bn(r)?r:o,i=s.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const c=s.offsetWidth;s.style.overflowY="hidden";const u=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=a,c===u}function _S(e){const t=Ie(e),n=t.documentElement,r=t.body,o=Bn(n)?n:r,s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}function IS(e){const t=Ie(e),n=t.documentElement,r=t.body,o=tt(n);let s=0,i=0,a=!1;const c=yn.create();if(Gi&&(o.visualViewport?.scale??1)!==1)return()=>{};function u(){const h=o.getComputedStyle(n),m=o.getComputedStyle(r),y=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,wf={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ef=n.style.scrollBehavior,Sf={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const C=n.scrollHeight>n.clientHeight,S=n.scrollWidth>n.clientWidth,E=h.overflowY==="scroll"||m.overflowY==="scroll",b=h.overflowX==="scroll"||m.overflowX==="scroll",x=Math.max(0,o.innerWidth-r.clientWidth),T=Math.max(0,o.innerHeight-r.clientHeight),P=parseFloat(m.marginTop)+parseFloat(m.marginBottom),z=parseFloat(m.marginLeft)+parseFloat(m.marginRight),I=Bn(n)?n:r;if(a=PS(e),a){n.style.scrollbarGutter=y,I.style.overflowY="hidden",I.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(C||E)&&(n.style.overflowY="scroll"),(S||b)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:P||T?`calc(100dvh - ${P+T}px)`:"100dvh",width:z||x?`calc(100vw - ${z+x}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function l(){Object.assign(n.style,wf),Object.assign(r.style,Sf),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ef)}function d(){l(),c.request(u)}u();const p=Fe(o,"resize",d);return()=>{c.cancel(),l(),typeof o.removeEventListener=="function"&&p()}}class kS{lockCount=0;restore=null;timeoutLock=Zt.create();timeoutUnlock=Zt.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Ie(t).documentElement,o=tt(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=Ct;return}const s=al||!OS(t);this.restore=s?_S(t):IS(t)}}const RS=new kS;function xf(e=!0,t=null){he(()=>{if(e)return RS.acquire(t)},[e,t])}function NS(e){const t=f.useRef(""),n=f.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:f.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 As(e,t){const n=f.useRef(e),r=ie(t);he(()=>{n.current!==e&&r(n.current)},[e,r]),he(()=>{n.current=e},[e])}function Ha(e){const[t,n]=f.useState(null),r=ie((i,a)=>{e||n(a||(al?"touch":""))});As(e,i=>{i&&!e&&n(null)});const{onClick:o,onPointerDown:s}=NS(r);return f.useMemo(()=>({openMethod:t,triggerProps:{onClick:o,onPointerDown:s}}),[t,o,s])}function MS(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:o}=e,s=t.useState("open"),i=t.useState("disablePointerDismissal"),a=t.useState("modal"),c=t.useState("popupElement"),{openMethod:u,triggerProps:l}=Ha(s);kd(t);const{forceUnmount:d}=Rd(s,t),p=f.useCallback(()=>{t.setOpen(!1,Ae(td))},[t]);f.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);const h=Dd({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,g]=f.useState(0),[v,y]=f.useState(0),C=m===0,S=zd(h),E=ka(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(D){if(!t.context.outsidePressEnabledRef.current||"button"in D&&D.button!==0||"touches"in D&&D.touches.length!==1)return!1;const $=lt(D);if(C&&!i){const V=$;return a&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===V||t.context.backdropRef.current===V||we(V,c)&&!V?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:C});xf(s&&a===!0,c);const{getReferenceProps:b,getFloatingProps:x,getTriggerProps:T}=bo([S,E]);t.useContextCallback("onNestedDialogOpen",(D,$)=>{g(D),y($)}),t.useContextCallback("onNestedDialogClose",()=>{g(0),y(0)}),f.useEffect(()=>(n?.onNestedDialogOpen&&s&&n.onNestedDialogOpen(m+1,v+(o?1:0)),n?.onNestedDialogClose&&!s&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&s&&n.onNestedDialogClose()}),[o,s,m,v,n]);const P=f.useMemo(()=>b(l),[b,l]),z=f.useMemo(()=>T(l),[T,l]),I=f.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:u,activeTriggerProps:P,inactiveTriggerProps:z,popupProps:I,floatingRootContext:h,nestedOpenDialogCount:m,nestedOpenDrawerCount:v})}const Ua=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ua.displayName="DialogRootContext");function Vt(e){const t=f.useContext(Ua);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.":ft(27));return t}const AS={...Md,modal:de(e=>e.modal),nested:de(e=>e.nested),nestedOpenDialogCount:de(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:de(e=>e.nestedOpenDrawerCount),disablePointerDismissal:de(e=>e.disablePointerDismissal),openMethod:de(e=>e.openMethod),descriptionElementId:de(e=>e.descriptionElementId),titleElementId:de(e=>e.titleElementId),viewportElement:de(e=>e.viewportElement),role:de(e=>e.role)};class Ba extends Wo{constructor(t){super(DS(t),{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new bs,onOpenChange:void 0,onOpenChangeComplete:void 0},AS)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t},o=n.trigger?.id??null;(o||t)&&(r.activeTriggerId=o,r.activeTriggerElement=n.trigger??null),this.update(r)};static useStore(t,n){const r=wt(()=>new Ba(n)).current;return t??r}}function DS(e={}){return{...Nd(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}const Ds=f.createContext(!1);process.env.NODE_ENV!=="production"&&(Ds.displayName="IsDrawerContext");function Wa(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:c,handle:u,triggerId:l,defaultTriggerId:d=null}=e,p=Vt(!0),h=f.useContext(Ds),m=!!p,g=Ba.useStore(u?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:l,modal:a,disablePointerDismissal:i,nested:m});ja(()=>{n===void 0&&g.state.open===!1&&r===!0&&g.update({open:!0,activeTriggerId:d})}),g.useControlledProp("openProp",n),g.useControlledProp("triggerIdProp",l),g.useSyncedValues({disablePointerDismissal:i,nested:m,modal:a}),g.useContextCallback("onOpenChange",o),g.useContextCallback("onOpenChangeComplete",s);const v=g.useState("payload");MS({store:g,actionsRef:c,parentContext:p?.store.context,isDrawer:h});const y=f.useMemo(()=>({store:g}),[g]);return w.jsx(Ds.Provider,{value:!1,children:w.jsx(Ua.Provider,{value:y,children:typeof t=="function"?t({payload:v}):t})})}const LS={...Cn,...tn},Za=f.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,{store:c}=Vt(),u=c.useState("open"),l=c.useState("nested"),d=c.useState("mounted"),p=c.useState("transitionStatus");return qe("div",t,{state:{open:u,transitionStatus:p},ref:[c.context.backdropRef,n],stateAttributesMapping:LS,props:[{role:"presentation",hidden:!d,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!l})});process.env.NODE_ENV!=="production"&&(Za.displayName="DialogBackdrop");const Ga=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,style:a,...c}=t,{store:u}=Vt(),l=u.useState("open");function d(g){l&&u.setOpen(!1,Ae(C0,g.nativeEvent))}const{getButtonProps:p,buttonRef:h}=Lr({disabled:s,native:i});return qe("button",t,{state:{disabled:s},ref:[n,h],props:[{onClick:d},c,p]})});process.env.NODE_ENV!=="production"&&(Ga.displayName="DialogClose");const Ya=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,{store:c}=Vt(),u=qt(i);return c.useSyncedValueWithCleanup("descriptionElementId",u),qe("p",t,{ref:n,props:[{id:u},a]})});process.env.NODE_ENV!=="production"&&(Ya.displayName="DialogDescription");let FS=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),VS=(function(e){return e[e.open=Ft.open]="open",e[e.closed=Ft.closed]="closed",e[e.startingStyle=Ft.startingStyle]="startingStyle",e[e.endingStyle=Ft.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Xa=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Xa.displayName="DialogPortalContext");function qa(){const e=f.useContext(Xa);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Portal> is missing.":ft(26));return e}const zS={...Cn,...tn,nestedDialogOpen(e){return e?{[VS.nestedDialogOpen]:""}:null}},Ka=f.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:i,style:a,...c}=t,{store:u}=Vt(),l=u.useState("descriptionElementId"),d=u.useState("disablePointerDismissal"),p=u.useState("floatingRootContext"),h=u.useState("popupProps"),m=u.useState("modal"),g=u.useState("mounted"),v=u.useState("nested"),y=u.useState("nestedOpenDialogCount"),C=u.useState("open"),S=u.useState("openMethod"),E=u.useState("titleElementId"),b=u.useState("transitionStatus"),x=u.useState("role");qa(),xn({open:C,ref:u.context.popupRef,onComplete(){C&&u.context.onOpenChangeComplete?.(!0)}});function T($){return $==="touch"?u.context.popupRef.current:!0}const P=s===void 0?T:s,z=y>0,D=qe("div",t,{state:{open:C,nested:v,transitionStatus:b,nestedDialogOpen:z},props:[h,{"aria-labelledby":E??void 0,"aria-describedby":l??void 0,role:x,tabIndex:-1,hidden:!g,onKeyDown($){Ms.has($.key)&&$.stopPropagation()},style:{[FS.nestedDialogs]:y}},c],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:zS});return w.jsx(ms,{context:p,openInteractionType:S,disabled:!g,closeOnFocusOut:!d,initialFocus:P,returnFocus:o,modal:m!==!1,restoreFocus:"popup",children:D})});process.env.NODE_ENV!=="production"&&(Ka.displayName="DialogPopup");const Ls=f.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return w.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});process.env.NODE_ENV!=="production"&&(Ls.displayName="InternalBackdrop");const Fs=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Vt(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||r?w.jsx(Xa.Provider,{value:r,children:w.jsxs(hs,{ref:n,...o,children:[i&&a===!0&&w.jsx(Ls,{ref:s.context.internalBackdropRef,inert:cs(!c)}),t.children]})}):null});process.env.NODE_ENV!=="production"&&(Fs.displayName="DialogPortal");const Vs=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,{store:c}=Vt(),u=qt(i);return c.useSyncedValueWithCleanup("titleElementId",u),qe("h2",t,{ref:n,props:[{id:u},a]})});process.env.NODE_ENV!=="production"&&(Vs.displayName="DialogTitle");const zs=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,id:a,payload:c,handle:u,style:l,...d}=t,p=Vt(!0),h=u?.store??p?.store;if(!h)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.":ft(79));const m=qt(a),g=h.useState("floatingRootContext"),v=h.useState("isOpenedByTrigger",m),y=f.useRef(null),{registerTrigger:C,isMountedByThisTrigger:S}=Id(m,y,h,{payload:c}),{getButtonProps:E,buttonRef:b}=Lr({disabled:s,native:i}),x=Ia(g,{enabled:g!=null}),T=bo([x]),P={disabled:s,open:v},z=h.useState("triggerProps",S);return qe("button",t,{state:P,ref:[b,n,C,y],props:[T.getReferenceProps(),z,{[ha]:"",id:m},d,E],stateAttributesMapping:Yd})});process.env.NODE_ENV!=="production"&&(zs.displayName="DialogTrigger");let Cf=(function(e){return e[e.open=Ft.open]="open",e[e.closed=Ft.closed]="closed",e[e.startingStyle=Ft.startingStyle]="startingStyle",e[e.endingStyle=Ft.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const $S={...Cn,...tn,nested(e){return e?{[Cf.nested]:""}:null},nestedDialogOpen(e){return e?{[Cf.nestedDialogOpen]:""}:null}},Tf=f.forwardRef(function(t,n){const{className:r,render:o,children:s,style:i,...a}=t,c=qa(),{store:u}=Vt(),l=u.useState("open"),d=u.useState("nested"),p=u.useState("transitionStatus"),h=u.useState("nestedOpenDialogCount"),m=u.useState("mounted"),g=h>0;return qe("div",t,{enabled:c||m,state:{open:l,nested:d,transitionStatus:p,nestedDialogOpen:g},ref:[n,u.useStateSetter("viewportElement")],stateAttributesMapping:$S,props:[{role:"presentation",hidden:!m,style:{pointerEvents:l?void 0:"none"},children:s},a]})});process.env.NODE_ENV!=="production"&&(Tf.displayName="DialogViewport");const jS=(e,t)=>Object.is(e,t);function jr(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function HS(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:jr(t,r,n))}function xo(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:jr(r,t,n))}function US(e,t,n){return e.filter(r=>!jr(t,r,n))}function Ja(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function BS(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function WS(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(BS(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 ZS(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 Ja(e)}function Hr(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Ja(e.value):Ja(e)}let Of=(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 $s={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Co={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},GS={disabled:!1,...Co},hr={valid(e){return e===null?null:e?{[Of.valid]:""}:{[Of.invalid]:""}}},Qa=f.createContext({invalid:void 0,name:void 0,validityData:{state:$s,errors:[],error:"",value:"",initialValue:null},setValidityData:Ct,disabled:void 0,touched:Co.touched,setTouched:Ct,dirty:Co.dirty,setDirty:Ct,filled:Co.filled,setFilled:Ct,focused:Co.focused,setFocused:Ct,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:GS,markedDirtyRef:{current:!1},registerFieldControl:Ct,validation:{getValidationProps:(e=mt)=>e,getInputValidationProps:(e=mt)=>e,inputRef:{current:null},commit:async()=>{}}});process.env.NODE_ENV!=="production"&&(Qa.displayName="FieldRootContext");function mr(e=!0){const t=f.useContext(Qa);if(t.setValidityData===Ct&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.":ft(28));return t}function ec(e,t){const{enabled:n=!0,getValue:r,id:o,value:s}=t,{registerFieldControl:i}=mr(),a=f.useRef(null);a.current||(a.current=Symbol()),he(()=>{const c=a.current;if(!(!c||!n))return i(c,{controlRef:e,getValue:r,id:o,value:s}),()=>{i(c,void 0)}},[e,n,r,o,i,s])}const tc=f.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ct,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});process.env.NODE_ENV!=="production"&&(tc.displayName="FormContext");function Ur(){return f.useContext(tc)}const nc=f.createContext({controlId:void 0,registerControlId:Ct,labelId:void 0,setLabelId:Ct,messageIds:[],setMessageIds:Ct,getDescriptionProps:e=>e});process.env.NODE_ENV!=="production"&&(nc.displayName="LabelableContext");function Ln(){return f.useContext(nc)}function rc(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Ln(),i=qt(t),a=n?o:void 0,c=wt(()=>Symbol("labelable-control")),u=f.useRef(!1),l=f.useRef(t!=null),d=ie(()=>{!u.current||s===Ct||(u.current=!1,s(c.current,void 0))});return he(()=>{if(s===Ct)return;let p;if(n){const h=r?.current;$e(h)&&h.closest("label")!=null?p=t??null:p=a??i}else if(t!=null)l.current=!0,p=t;else if(l.current)p=i;else{d();return}if(p===void 0){d();return}u.current=!0,s(c.current,p)},[t,r,a,s,n,i,c,d]),f.useEffect(()=>d,[d]),o??i}function YS(e){const t=e.getBoundingClientRect();if(process.env.NODE_ENV!=="production")return t;const n=tt(e),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,a=parseFloat(r.height)||0,c=parseFloat(o.width)||0,u=parseFloat(o.height)||0,l=Math.max(t.width,i,c),d=Math.max(t.height,a,u),p=l-t.width,h=d-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-h/2,bottom:t.bottom+h/2}}function XS(e,t){return e??t}const qS=20;function Pf(e,t,n,r){const[o,s]=f.useState(!1);he(()=>{if(!e||!t||n==null){s(!1);return}const i=Ie(n).documentElement.clientWidth,a=n.offsetWidth;s(i>0&&a>0&&a>=i-qS)},[e,t,n]),xf(e&&(!t||o),r)}let _f=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.indeterminate="data-indeterminate",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",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})({});function If(e){return f.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[_f.checked]:""}:{[_f.unchecked]:""}},...hr}),[e.indeterminate])}const kf=f.createContext({disabled:!1});process.env.NODE_ENV!=="production"&&(kf.displayName="FieldItemContext");function KS(){return f.useContext(kf)}function JS(e,t,n,r=!0,o){const[s,i]=f.useState(),a=qt(o?`${o}-label`:void 0),c=e??t??s;return he(()=>{const u=e||t||!r?void 0:QS(n.current,a);s!==u&&i(u)}),c}function QS(e,t){const n=eE(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function eE(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const o=e.nextElementSibling;if(o&&o.htmlFor===n)return o}const r=e.labels;return r&&r[0]}const Rf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Rf.displayName="CheckboxGroupContext");function tE(e=!0){const t=f.useContext(Rf);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>.":ft(3));return t}const oc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(oc.displayName="CheckboxRootContext");function nE(){const e=f.useContext(oc);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.":ft(14));return e}const rE="data-parent",sc=f.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s=!1,"aria-labelledby":i,disabled:a=!1,form:c,id:u,indeterminate:l=!1,inputRef:d,name:p,onCheckedChange:h,parent:m=!1,readOnly:g=!1,render:v,required:y=!1,uncheckedValue:C,value:S,nativeButton:E=!1,style:b,...x}=t,{clearErrors:T}=Ur(),{disabled:P,name:z,setDirty:I,setFilled:D,setFocused:$,setTouched:V,state:N,validationMode:O,validityData:k,shouldValidateOnChange:_,validation:M}=mr(),A=KS(),{labelId:j,controlId:B,registerControlId:U,getDescriptionProps:W}=Ln(),G=tE(),Z=G?.parent,X=Z&&G.allValues,K=P||A.disabled||G?.disabled||a,J=z??p,se=S??J,ae=qt(),pe=qt();let Y=B;X?Y=m?pe:`${Z.id}-${se}`:u&&(Y=u);let me={};X&&(m?me=G.parent.getParentProps():se&&(me=G.parent.getChildProps(se)));const ge=ie(h),{checked:fe=r,indeterminate:le=l,onCheckedChange:ce,...ve}=me,ue=G?.value,Se=G?.setValue,R=G?.defaultValue,H=f.useRef(null),L=wt(()=>Symbol("checkbox-control")),F=f.useRef(!1),{getButtonProps:Q,buttonRef:ne}=Lr({disabled:K,native:E}),te=G?.validation??M,[ye,_e]=Eo({controlled:se&&ue&&!m?ue.includes(se):fe,default:se&&R&&!m?R.includes(se):s,name:"Checkbox",state:"checked"});he(()=>{U!==Ct&&(F.current=!0,U(L.current,Y))},[Y,G,U,m,L]),f.useEffect(()=>{const Te=L.current;return()=>{!F.current||U===Ct||(F.current=!1,U(Te,void 0))}},[U,L]),ec(H,{enabled:!G,id:ae,value:ye});const Ee=f.useRef(null),Ce=or(d,Ee,te.inputRef),Pe=JS(i,j,Ee,!E,Y??void 0);he(()=>{Ee.current&&(Ee.current.indeterminate=le,ye&&D(!0))},[ye,le,D]),As(ye,()=>{G&&!m||(T(J),D(ye),I(ye!==k.initialValue),_()?te.commit(ye):te.commit(ye,!0))});const Ve=En({checked:ye,disabled:K,form:c,name:m?void 0:J,id:E?void 0:Y??void 0,required:y,ref:Ce,style:J?Al:ss,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Te){if(Te.nativeEvent.defaultPrevented)return;if(g){Te.preventDefault();return}const Ue=Te.currentTarget.checked,Be=Ae(cr,Te.nativeEvent);if(ce?.(Ue,Be),ge(Ue,Be),!Be.isCanceled&&(_e(Ue),se&&ue&&Se&&!m&&!X)){const ct=Ue?[...ue,se]:ue.filter(Ye=>Ye!==se);Se(ct,Be)}},onFocus(){H.current?.focus()}},S!==void 0?{value:(G?ye&&S:S)||""}:mt,W,G?te.getValidationProps:te.getInputValidationProps),Ge=X?!!fe:ye,He=X&&le||l;f.useEffect(()=>{if(!Z||!se)return;const Te=Z.disabledStatesRef.current;return Te.set(se,K),()=>{Te.delete(se)}},[Z,K,se]);const nt=f.useMemo(()=>({...N,checked:Ge,disabled:K,readOnly:g,required:y,indeterminate:He}),[N,Ge,K,g,y,He]),st=If(nt),Re=qe("span",t,{state:nt,ref:[ne,H,n,G?.registerControlRef],props:[{id:E?Y??void 0:ae,role:"checkbox","aria-checked":le?"mixed":ye,"aria-readonly":g||void 0,"aria-required":y||void 0,"aria-labelledby":Pe,[rE]:m?"":void 0,onFocus(){$(!0)},onBlur(){const Te=Ee.current;Te&&(V(!0),$(!1),O==="onBlur"&&te.commit(G?ue:Te.checked))},onClick(Te){g||K||(Te.preventDefault(),Ee.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:Te.shiftKey,ctrlKey:Te.ctrlKey,altKey:Te.altKey,metaKey:Te.metaKey})))}},W,te.getValidationProps,x,ve,Q],stateAttributesMapping:st});return w.jsxs(oc.Provider,{value:nt,children:[Re,!ye&&!G&&J&&!m&&C!==void 0&&w.jsx("input",{type:"hidden",form:c,name:J,value:C}),w.jsx("input",{...Ve,suppressHydrationWarning:!0})]})});process.env.NODE_ENV!=="production"&&(sc.displayName="CheckboxRoot");const ic=f.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,c=nE(),u=c.checked||c.indeterminate,{mounted:l,transitionStatus:d,setMounted:p}=vo(u),h=f.useRef(null),m={...c,transitionStatus:d};xn({open:u,ref:h,onComplete(){u||p(!1)}});const g=If(c),v=f.useMemo(()=>({...g,...tn,...hr}),[g]),y=i||l,C=qe("span",t,{ref:[n,h],state:m,stateAttributesMapping:v,props:a});return y?C:null});process.env.NODE_ENV!=="production"&&(ic.displayName="CheckboxIndicator");function oE(e,t){const n=qt(e);return he(()=>(t(n),()=>{t(void 0)}),[n,t]),n}function sE(e={}){const{id:t,fallbackControlId:n,native:r=!1,setLabelId:o,focusControl:s}=e,{controlId:i,setLabelId:a}=Ln(),c=ie(h=>{a(h),o?.(h)}),u=oE(t,c),l=i??n;function d(h){if(s){s(h,l);return}if(!l)return;const m=Ie(h.currentTarget).getElementById(l);it(m)&&iE(m)}function p(h){lt(h.nativeEvent)?.closest("button,input,select,textarea")||(!h.defaultPrevented&&h.detail>1&&h.preventDefault(),!r&&d(h))}return r?{id:u,htmlFor:l??void 0,onMouseDown:p}:{id:u,onClick:p,onPointerDown(h){h.preventDefault()}}}function iE(e){e.focus({focusVisible:!0})}const Nf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Nf.displayName="ToolbarRootContext");function Mf(e){return f.useContext(Nf)}function aE(e,t){const n=f.useRef(null),r=ie(s=>{Kt.flushSync(()=>{e.setOpen(!1,Ae(ur,s.nativeEvent,s.currentTarget))}),Ab(n.current)?.focus()}),o=ie(s=>{const i=e.select("positionerElement");if(i&&Ar(s,i))e.context.beforeContentFocusGuardRef.current?.focus();else{Kt.flushSync(()=>{e.setOpen(!1,Ae(ur,s.nativeEvent,s.currentTarget))});let a=Mb(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&we(i,a);){const c=a;if(a=ca(a),a===c)break}a?.focus()}});return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:o}}function cE(e){const[t,n]=f.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}const Af=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Af.displayName="CSPContext");const uE={disableStyleElements:!1};function lE(){return f.useContext(Af)??uE}let Tt=(function(e){return e.nestedDrawers="--nested-drawers",e.height="--drawer-height",e.frontmostHeight="--drawer-frontmost-height",e.swipeMovementX="--drawer-swipe-movement-x",e.swipeMovementY="--drawer-swipe-movement-y",e.snapPointOffset="--drawer-snap-point-offset",e.swipeStrength="--drawer-swipe-strength",e})({}),Fn=(function(e){return e.swipeProgress="--drawer-swipe-progress",e})({});const dE={...Cn,...tn},Df=f.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,{store:c}=Vt(),u=c.useState("open"),l=c.useState("nested"),d=c.useState("mounted"),p=c.useState("transitionStatus");return qe("div",t,{state:{open:u,transitionStatus:p},ref:[c.context.backdropRef,n],stateAttributesMapping:dE,props:[{role:"presentation",hidden:!d,style:{pointerEvents:u?void 0:"none",userSelect:"none",WebkitUserSelect:"none",[Fn.swipeProgress]:"0",[Tt.swipeStrength]:"1"}},a],enabled:i||!l})});process.env.NODE_ENV!=="production"&&(Df.displayName="DrawerBackdrop");const Lf="data-drawer-content",Ff=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t;return Vt(),qe("div",t,{ref:n,props:[{[Lf]:""},i]})});process.env.NODE_ENV!=="production"&&(Ff.displayName="DrawerContent");const Vf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Vf.displayName="DrawerProviderContext");function zf(e){return f.useContext(Vf)}let ln=(function(e){return e[e.open=Ft.open]="open",e[e.closed=Ft.closed]="closed",e[e.startingStyle=Ft.startingStyle]="startingStyle",e[e.endingStyle=Ft.endingStyle]="endingStyle",e.expanded="data-expanded",e.nestedDrawerOpen="data-nested-drawer-open",e.nestedDrawerSwiping="data-nested-drawer-swiping",e.swipeDismiss="data-swipe-dismiss",e.swipeDirection="data-swipe-direction",e.swiping="data-swiping",e})({});const ac=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(ac.displayName="DrawerRootContext");function js(e){const t=f.useContext(ac);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DrawerRootContext is missing. Drawer parts must be placed within <Drawer.Root>.":ft(90));return t}function bt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function $f(e,t,n){if(!Number.isFinite(t)||t<=0)return null;if(typeof e=="number")return Number.isFinite(e)?e<=1?bt(e,0,1)*t:e:null;const r=e.trim();if(r.endsWith("px")){const o=Number.parseFloat(r);return Number.isFinite(o)?o:null}if(r.endsWith("rem")){const o=Number.parseFloat(r);return Number.isFinite(o)?o*n:null}return null}function fE(e,t){let n=null,r=1/0;for(const o of t){const s=Math.abs(o.height-e);s<r&&(r=s,n=o)}return n}function jf(){const{store:e}=Vt(),{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:o}=js(),s=e.useState("viewportElement"),[i,a]=f.useState(0),[c,u]=f.useState(16),l=ie(()=>{const m=Ie(s).documentElement;s&&a(s.offsetHeight),s||a(m.clientHeight);const g=parseFloat(getComputedStyle(m).fontSize);Number.isFinite(g)&&u(g)});he(()=>{if(l(),!s||typeof ResizeObserver!="function")return;const h=new ResizeObserver(l);return h.observe(s),()=>{h.disconnect()}},[l,s]);const d=f.useMemo(()=>{if(!t||t.length===0||i<=0||o<=0)return[];const h=Math.min(o,i);if(!Number.isFinite(h)||h<=0)return[];const m=t.map(y=>{const C=$f(y,i,c);if(C===null||!Number.isFinite(C))return null;const S=bt(C,0,h);return{value:y,height:S,offset:Math.max(0,o-S)}}).filter(y=>!!y);if(m.length<=1)return m;const g=[],v=[];for(let y=m.length-1;y>=0;y-=1){const C=m[y];v.some(E=>Math.abs(E-C.height)<=1)||(v.push(C.height),g.push(C))}return g.reverse(),g},[o,c,t,i]),p=f.useMemo(()=>{if(n===void 0)return d[0];if(n===null)return;const h=d.find(y=>Object.is(y.value,n));if(h)return h;const m=Math.min(o,i),g=$f(n,i,c);if(g===null||!Number.isFinite(g))return;const v=bt(g,0,m);return fE(v,d)??void 0},[n,o,d,c,i]);return{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:o,viewportHeight:i,resolvedSnapPoints:d,activeSnapPointOffset:p?.offset??null}}const cc=f.createContext(null);process.env.NODE_ENV!=="production"&&(cc.displayName="DrawerViewportContext");function pE(e){return f.useContext(cc)}let Hf=!1;function hE(){Hf||(typeof CSS<"u"&&"registerProperty"in CSS&&([Tt.swipeMovementX,Tt.swipeMovementY,Tt.snapPointOffset].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),[{name:Fn.swipeProgress,initialValue:"0"},{name:Tt.swipeStrength,initialValue:"1"}].forEach(({name:e,initialValue:t})=>{try{CSS.registerProperty({name:e,syntax:"<number>",inherits:!1,initialValue:t})}catch{}})),Hf=!0)}const mE={...Cn,...tn,expanded(e){return e?{[ln.expanded]:""}:null},nestedDrawerOpen(e){return e?{[ln.nestedDrawerOpen]:""}:null},nestedDrawerSwiping(e){return e?{[ln.nestedDrawerSwiping]:""}:null},swipeDirection(e){return e?{[ln.swipeDirection]:e}:null},swiping(e){return e?{[ln.swiping]:""}:null}},Uf=f.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:i,style:a,...c}=t,{store:u}=Vt(),{swipeDirection:l,frontmostHeight:d,hasNestedDrawer:p,nestedSwiping:h,nestedSwipeProgressStore:m,onPopupHeightChange:g,notifyParentFrontmostHeight:v,notifyParentHasNestedDrawer:y}=js(),C=u.useState("descriptionElementId"),S=u.useState("disablePointerDismissal"),E=u.useState("floatingRootContext"),b=u.useState("popupProps"),x=u.useState("modal"),T=u.useState("mounted"),P=u.useState("nested"),z=u.useState("nestedOpenDrawerCount"),I=u.useState("transitionStatus"),D=u.useState("open"),$=u.useState("openMethod"),V=u.useState("titleElementId"),N=u.useState("role"),O=z>0,k=pE(),_=k?.swiping??!1,M=k?.swipeStrength??null,{snapPoints:A,activeSnapPoint:j,activeSnapPointOffset:B}=jf();qa();const[U,W]=f.useState(0),G=f.useRef(0);process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(k)return;const ge=Dr.captureOwnerStack?.()||"";ar(`<Drawer.Popup> expected to be rendered within <Drawer.Viewport>. Omitting the viewport disables drawer swipe handling and touch scroll locking. Wrap <Drawer.Popup> in <Drawer.Viewport>.${ge}`)},[k]);const Z=ie(()=>{const ge=u.context.popupRef.current;if(!ge)return;const fe=ge.offsetHeight;if(G.current>0&&d>G.current&&fe>G.current)return;if(G.current>0&&p){const ve=G.current;W(ve),g(ve);return}const ce=fe;ce!==G.current&&(G.current=ce,W(ce),g(ce))});he(()=>{if(!T){G.current=0,W(0),g(0);return}const ge=u.context.popupRef.current;if(!ge||(hE(),Z(),typeof ResizeObserver!="function"))return;const fe=new ResizeObserver(Z);return fe.observe(ge),()=>{fe.disconnect()}},[Z,T,O,g,u.context.popupRef]),he(()=>{const ge=u.context.popupRef,fe=()=>{const ce=ge.current;if(!ce)return;const ve=m.getSnapshot();ve>0?ce.style.setProperty(Fn.swipeProgress,`${ve}`):ce.style.setProperty(Fn.swipeProgress,"0")};fe();const le=m.subscribe(fe);return()=>{le();const ce=ge.current;ce&&ce.style.setProperty(Fn.swipeProgress,"0")}},[m,u.context.popupRef]),f.useEffect(()=>{if(D)return v?.(d),()=>{v?.(0)}},[d,D,v]),f.useEffect(()=>y?(y(D||I==="ending"),()=>{y(!1)}):void 0,[y,D,I]),xn({open:D,ref:u.context.popupRef,onComplete(){D&&u.context.onOpenChangeComplete?.(!0)}});const X=s===void 0?u.context.popupRef:s,K={open:D,nested:P,transitionStatus:I,expanded:j===1,nestedDrawerOpen:O,nestedDrawerSwiping:h,swipeDirection:l,swiping:_};let J;U&&!(!p&&I!=="ending")&&(J=`${U}px`);const ae=A&&A.length>0&&(l==="down"||l==="up");let pe=null;ae&&B!==null&&(pe=l==="up"?-B:B);let Y=k?k.getDragStyles():mt;if(ae&&l==="down"){const ge=B??0,fe=Number.parseFloat(String(Y[Tt.swipeMovementY]??0)),le=Number.isFinite(fe)?ge+fe:ge,ce=le<0;if(_&&ce&&Number.isFinite(fe)){const ve=Math.abs(le),Se=-Math.sqrt(ve)-ge;Y={...Y,transform:void 0,[Tt.swipeMovementY]:`${Se}px`}}else Y={...Y,transform:void 0}}const me=qe("div",t,{state:K,props:[b,{"aria-labelledby":V,"aria-describedby":C,role:N,tabIndex:-1,hidden:!T,onKeyDown(ge){Ms.has(ge.key)&&ge.stopPropagation()},style:{...Y,[Fn.swipeProgress]:"0",[Tt.nestedDrawers]:z,[Tt.height]:J,[Tt.snapPointOffset]:typeof pe=="number"?`${pe}px`:"0px",[Tt.frontmostHeight]:d?`${d}px`:void 0,[Tt.swipeStrength]:typeof M=="number"&&Number.isFinite(M)&&M>0?`${M}`:"1"}},c],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:mE});return w.jsx(ms,{context:E,openInteractionType:$,disabled:!T,closeOnFocusOut:!S,initialFocus:X,returnFocus:o,modal:x!==!1,restoreFocus:"popup",children:me})});process.env.NODE_ENV!=="production"&&(Uf.displayName="DrawerPopup");const gE=Fs;var Bf,Wf;function yE(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:c,handle:u,triggerId:l,defaultTriggerId:d=null,swipeDirection:p="down",snapToSequentialPoints:h=!1,snapPoints:m,snapPoint:g,defaultSnapPoint:v,onSnapPointChange:y}=e,C=ie(y),S=js(!0),E=S?.onNestedSwipeProgressChange,b=S?.onNestedFrontmostHeightChange,x=S?.onNestedSwipingChange,T=S?.onNestedDrawerPresenceChange,[P,z]=f.useState(0),[I,D]=f.useState(0),[$,V]=f.useState(!1),[N,O]=f.useState(!1),[k]=f.useState(vE),_=v!==void 0?v:m?.[0]??null,M=g!==void 0,[A,j]=Eo({controlled:g,default:_,name:"Drawer",state:"snapPoint"}),B=f.useRef(!1),U=ie((Y,me)=>{const ge=me??Ae(cr);C?.(Y,ge),!ge.isCanceled&&j(Y)}),W=f.useMemo(()=>M||!m||m.length===0?A:A===null||!m.some(Y=>Object.is(Y,A))?_:A,[A,M,_,m]),G=ie(Y=>{z(Y),!B.current&&Y>0&&D(Y)}),Z=ie(Y=>{if(Y>0){B.current=!0,D(Y);return}B.current=!1,P>0&&D(P)}),X=ie(Y=>{V(Y)}),K=ie(Y=>{k.set(Y),E?.(Y)}),J=ie(Y=>{O(Y),x?.(Y)}),se=ie((Y,me)=>{o?.(Y,me),!me.isCanceled&&!Y&&m&&m.length>0&&U(_,Ae(me.reason,me.event,me.trigger))}),ae=f.useMemo(()=>({swipeDirection:p,snapToSequentialPoints:h,snapPoints:m,activeSnapPoint:W,setActiveSnapPoint:U,frontmostHeight:I,popupHeight:P,hasNestedDrawer:$,nestedSwiping:N,nestedSwipeProgressStore:k,onNestedDrawerPresenceChange:X,onPopupHeightChange:G,onNestedFrontmostHeightChange:Z,onNestedSwipingChange:J,onNestedSwipeProgressChange:K,notifyParentFrontmostHeight:b,notifyParentSwipingChange:x,notifyParentSwipeProgressChange:E,notifyParentHasNestedDrawer:T}),[W,I,$,N,k,T,E,x,b,X,Z,K,J,G,P,U,m,h,p]),pe=typeof t=="function"?Y=>w.jsxs(f.Fragment,{children:[Bf||(Bf=w.jsx(Zf,{})),t(Y)]}):w.jsxs(f.Fragment,{children:[Wf||(Wf=w.jsx(Zf,{})),t]});return w.jsx(ac.Provider,{value:ae,children:w.jsx(Ds.Provider,{value:!0,children:w.jsx(Wa,{open:n,defaultOpen:r,onOpenChange:se,onOpenChangeComplete:s,disablePointerDismissal:i,modal:a,actionsRef:c,handle:u,triggerId:l,defaultTriggerId:d,children:pe})})})}function vE(){let e=0;const t=new Set;return{getSnapshot:()=>e,set(n){const r=Number.isFinite(n)?n:0;r!==e&&(e=r,t.forEach(o=>{o()}))},subscribe(n){return t.add(n),()=>{t.delete(n)}}}}function Zf(){const e=Xn(),t=zf(),n=Vt(!1),r=n.store.useState("open"),o=n.store.useState("nestedOpenDialogCount"),s=n.store.useState("popupElement"),i=o===0;return f.useEffect(()=>{if(!(!t||e==null))return()=>{t.removeDrawer(e)}},[e,t]),f.useEffect(()=>{e!=null&&t?.setDrawerOpen(e,r)},[e,r,t]),f.useEffect(()=>{if(!r||!i||!Jo)return;const c=tt(s).CloseWatcher;if(!c)return;function u(p){n.store.select("open")&&n.store.setOpen(!1,Ae(T0,p))}const l=new c,d=Fe(l,"close",u);return()=>{d(),l.destroy()}},[n.store,i,r,s]),null}function uc(e,t){const n=At(e);if(t==="vertical"){const o=n.overflowY;return(o==="auto"||o==="scroll")&&e.scrollHeight>e.clientHeight}const r=n.overflowX;return(r==="auto"||r==="scroll")&&e.scrollWidth>e.clientWidth}function bE(e,t,n){let r=e;for(;r&&r!==t;){for(const o of n)if(uc(r,o))return!0;r=r.parentElement}return!1}function Br(e,t,n="vertical"){let r=it(e)?e:null;for(;r&&r!==t;){if(uc(r,n))return r;r=r.parentElement}return uc(t,n)?t:null}function Hs(e,t,n){return typeof e?.elementFromPoint=="function"?e.elementFromPoint(t,n):null}const wE=40,SE=10,EE=1,xE=50,Gf=16,CE=80,TE='button,a,input,select,textarea,label,[role="button"]';function lc(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function OE(e){const n=tt(e).getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const a=i[1].split(", ").map(parseFloat);a.length===6?(r=a[4],o=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],o=a[13],s=a[0])}}return{x:r,y:o,scale:s}}function Us(e){return Number.isFinite(e)&&e>0?e:null}function PE(e){return e%2===1}function dc(e,t,n){const r=e[n];if(typeof r=="function")try{r.call(e,t)}catch(o){if(o&&typeof o=="object"&&"name"in o&&o.name==="NotFoundError")return;throw o}}function _E(e){const{enabled:t,directions:n,elementRef:r,movementCssVars:o,canStart:s,ignoreSelectorWhenTouch:i=!0,ignoreScrollableAncestors:a=!1,swipeThreshold:c,onDismiss:u,onProgress:l,onCancel:d,onSwipeStart:p,onRelease:h,onSwipingChange:m,trackDrag:g=!0}=e,v=TE,y=n.length===1?n[0]:void 0,C=Math.max(0,typeof c=="number"?c:wE),S=n.includes("left"),E=n.includes("right"),b=n.includes("up"),x=n.includes("down"),T=S||E,P=b||x,z=f.useMemo(()=>{const q=[];return P&&q.push("vertical"),T&&q.push("horizontal"),q},[T,P]),[I,D]=f.useState(void 0),[$,V]=f.useState(!1),[N,O]=f.useState(!1),[k,_]=f.useState(!1),[M,A]=f.useState({x:0,y:0}),[j,B]=f.useState({x:0,y:0,scale:1}),[U,W]=f.useState(null),G=f.useRef({x:0,y:0}),Z=f.useRef({x:0,y:0}),X=f.useRef(null),K=f.useRef({x:0,y:0,scale:1}),J=f.useRef(void 0),se=f.useRef(0),ae=f.useRef(!1),pe=f.useRef({x:0,y:0}),Y=f.useRef(!1),me=f.useRef(!1),ge=f.useRef(null),fe=f.useRef(!1),le=f.useRef(!1),ce=f.useRef({width:0,height:0}),ve=f.useRef(0),ue=f.useRef(C),Se=f.useRef(null),R=f.useRef(null),H=f.useRef({x:0,y:0}),L=f.useRef(null),F=f.useRef(!1),Q=ie(q=>{F.current!==q&&(F.current=q,V(q),m?.(q))});function ne(q){if(!q)return;if(typeof c!="function"){ue.current=C;return}const re=r.current;if(!re)return;const be=c({element:re,direction:q});ue.current=Math.max(0,be)}const te=ie((q,re)=>{const be=Number.isFinite(q)?bt(q,0,1):0,Le=be!==ve.current;let je=!1;if(re){const De=L.current;je=!De||De.deltaX!==re.deltaX||De.deltaY!==re.deltaY||De.direction!==re.direction}!Le&&!je||(ve.current=be,re?L.current=re:Le&&(L.current=null),l?.(be,re))});function ye(q,re){if(re===null)return;const be=R.current;if(be&&re>be.time){const Le=Math.max(re-be.time,Gf);H.current={x:(q.x-be.x)/Le,y:(q.y-be.y)/Le}}R.current={x:q.x,y:q.y,time:re}}const _e=f.useCallback(()=>{D(void 0),Q(!1),O(!1),_(!1),A({x:0,y:0}),B({x:0,y:0,scale:1}),W(null),te(0),ue.current=C,G.current={x:0,y:0},Z.current={x:0,y:0},K.current={x:0,y:0,scale:1},J.current=void 0,se.current=0,ae.current=!1,pe.current={x:0,y:0},Y.current=!1,X.current=null,me.current=!1,ge.current=null,fe.current=!1,le.current=!1,ce.current={width:0,height:0},Se.current=null,R.current=null,H.current={x:0,y:0},L.current=null},[Q,C,te]);f.useEffect(()=>{typeof c!="function"&&(ue.current=C)},[C,c]);function Ee(q){if("touches"in q){const re=q.touches[0];return re?{x:re.clientX,y:re.clientY}:null}return{x:q.clientX,y:q.clientY}}function Ce(q){return"touches"in q?!0:q.pointerType==="touch"}function Pe(q,re){const be=Ie(r.current);return Hs(be,q.x,q.y)??lt(re)}function Ve(q,re){return T&&!P?Br(q,re,"horizontal"):P&&!T?Br(q,re,"vertical"):Br(q,re,"vertical")??Br(q,re,"horizontal")}function Ge(q,re,be){fe.current=!1;const Le=Ce(q),je=Pe(re,q.nativeEvent),Qe=Ie(r.current).body,Oe=Le&&Qe?Ve(je,Qe):null,xe=be?.ignoreScrollableTarget??!1;if(Oe&&!xe||(fe.current=!!(Oe&&xe),(je?je.closest(v):!1)&&(!Le||i)))return!1;const Me=r.current;if(a&&Me&&je&&z.length>0&&!(be?.ignoreScrollableAncestors??!1)&&bE(je,Me,z))return!1;if(ae.current=!1,J.current=void 0,se.current=0,G.current=re,Se.current=Us(q.timeStamp),pe.current=re,X.current=re,Me){ce.current={width:Me.offsetWidth,height:Me.offsetHeight},ne(y);const Xe=OE(Me);K.current=Xe,Z.current={x:Xe.x,y:Xe.y},B(Xe),A({x:Xe.x,y:Xe.y}),ye({x:Xe.x,y:Xe.y},Se.current),"touches"in q||dc(Me,q.pointerId,"setPointerCapture")}return p?.(q.nativeEvent),Q(!0),O(!1),W(null),Y.current=!0,te(0),!0}function He(){nt(),fe.current=!1,X.current=null}function nt(){me.current=!1,ge.current=null}function st(q){if(He(),!F.current)return;Q(!1),O(!1),W(null);const re=g?j:K.current;Z.current={x:re.x,y:re.y},A({x:re.x,y:re.y}),D(void 0),le.current=!1;const be=r.current;be&&dc(be,q.pointerId,"releasePointerCapture"),te(0,{deltaX:0,deltaY:0,direction:void 0}),d?.(q.nativeEvent)}function Re(q,re){const be=Qe=>Qe>=0?Qe**.5:-(Math.abs(Qe)**.5),Le=(Qe,Oe,xe)=>!Oe&&Qe<0||!xe&&Qe>0?be(Qe):Qe,je=T?Le(q,S,E):be(q),De=P?Le(re,b,x):be(re);return{x:je,y:De}}function Te(q,re,be){const Le=Math.abs(re),je=Math.abs(be);if(P&&be!==0&&(!T||je>=Le)){const Oe=Math.max(0,q.scrollHeight-q.clientHeight),xe=q.scrollTop<=0,Ne=q.scrollTop>=Oe,Me=be>0,Xe=be<0;return Me&&xe&&x||Xe&&Ne&&b}if(T&&re!==0&&(!P||Le>je)){const Oe=Math.max(0,q.scrollWidth-q.clientWidth),xe=q.scrollLeft<=0,Ne=q.scrollLeft>=Oe,Me=re>0,Xe=re<0;return Me&&xe&&E||Xe&&Ne&&S}return null}const Ue=ie(q=>{if(!t||q.defaultPrevented||q.nativeEvent.defaultPrevented||!("touches"in q)&&q.button!==0)return;const re=Ee(q);!re||(me.current=!0,ge.current=re,fe.current=!1,le.current=!1,!(s?s(re,{nativeEvent:q.nativeEvent,direction:y}):!0))||Ge(q,re)&&nt()});function Be(q,re,be){if(!t||!F.current)return;const Le=lt(q.nativeEvent);if(Ce(q)&&!fe.current){const on=q.currentTarget;if(Ve(Le,on))return}if("touches"in q||q.preventDefault(),Y.current){G.current=re;const on=Us(q.timeStamp);on!==null&&(Se.current=on),Y.current=!1}const je=re.x,De=re.y,Qe=be.x,Oe=be.y;(Oe<0&&De>pe.current.y||Oe>0&&De<pe.current.y)&&(pe.current={x:pe.current.x,y:De}),(Qe<0&&je>pe.current.x||Qe>0&&je<pe.current.x)&&(pe.current={x:je,y:pe.current.y});const xe=je-G.current.x,Ne=De-G.current.y,Me=De-pe.current.y,Xe=je-pe.current.x;if(!N&&Math.sqrt(xe*xe+Ne*Ne)>=EE&&(O(!0),U===null&&T&&P)){const qr=Math.abs(xe),Hc=Math.abs(Ne);W(qr>Hc?"horizontal":"vertical")}let Je;if(!J.current)U==="vertical"?Ne>0?Je="down":Ne<0&&(Je="up"):U==="horizontal"?xe>0?Je="right":xe<0&&(Je="left"):Math.abs(xe)>=Math.abs(Ne)?Je=xe>0?"right":"left":Je=Ne>0?"down":"up",Je&&(Je==="left"&&S||Je==="right"&&E||Je==="up"&&b||Je==="down"&&x)&&(J.current=Je,se.current=lc(Je,xe,Ne),D(Je),ne(Je));else{const on=J.current,qr=lc(on,Xe,Me);qr>ue.current?(ae.current=!1,D(on)):!(S&&E)&&!(b&&x)&&se.current-qr>=SE&&(ae.current=!0)}const dn=Re(xe,Ne);let rn=K.current.x,Bt=K.current.y;U==="horizontal"?T&&(rn+=dn.x):(U==="vertical"||T&&(rn+=dn.x),P&&(Bt+=dn.y)),Z.current={x:rn,y:Bt},g&&A({x:rn,y:Bt}),ye({x:rn,y:Bt},Us(q.timeStamp));const er=rn-K.current.x,Pn=Bt-K.current.y,Er=J.current,xr=y??J.current;if(!xr){te(0,{deltaX:er,deltaY:Pn,direction:Er});return}const _n=xr==="left"||xr==="right"?ce.current.width:ce.current.height,fn=K.current.scale||1;if(_n<=0||fn<=0){te(0,{deltaX:er,deltaY:Pn,direction:Er});return}const Cr=lc(xr,rn-K.current.x,Bt-K.current.y);if(Cr<=0){te(0,{deltaX:er,deltaY:Pn,direction:Er});return}te(Cr/(_n*fn),{deltaX:er,deltaY:Pn,direction:Er})}const ct=ie(q=>{const re=Ee(q);if(!re)return;if(!("touches"in q)){const je=PE(q.buttons);je&&(le.current=!0);const De=q.buttons===0&&le.current;if(q.buttons!==0&&!je||De){st(q);return}}if(!$&&me.current){if(!Ce(q)&&(q.defaultPrevented||q.nativeEvent.defaultPrevented)){He();return}if(s?s(re,{nativeEvent:q.nativeEvent,direction:y}):!0){const De=ge.current;let Qe=!1;if(Ce(q)){const xe=r.current;if(De&&xe){const Ne=Pe(re,q.nativeEvent),Xe=Ie(xe).body,Je=Xe?Ve(Ne,Xe):null;if(Je&&(we(xe,Je)||we(Je,xe))){const dn=re.x-De.x,rn=re.y-De.y,Bt=Te(Je,dn,rn);if(Bt===!1)return;Bt===!0&&(Qe=!0)}}}Ge(q,re,{ignoreScrollableTarget:Qe,ignoreScrollableAncestors:Qe})&&(De&&Qe?(nt(),G.current=De,pe.current=De,X.current=De,Y.current=!1):(nt(),fe.current=!1))}}const be=X.current,Le=be===null?{x:0,y:0}:{x:re.x-be.x,y:re.y-be.y};X.current=re,Be(q,re,Le)}),Ye=ie(q=>{if(!t)return;const re=Z.current,be=K.current,Le=re.x-be.x,je=re.y-be.y,De={deltaX:Le,deltaY:je,direction:I??J.current};if(!F.current){He(),te(0,De);return}Q(!1),O(!1),W(null),He(),le.current=!1;const Qe=r.current;Qe&&("touches"in q||dc(Qe,q.pointerId,"releasePointerCapture"));const Oe=Le,xe=je,Ne=Se.current,Me=Us(q.timeStamp),Xe=Ne!==null&&Me!==null&&Me>Ne?Me-Ne:0,Je=Xe>0?Math.max(Xe,xE):0,dn=Je>0?Oe/Je:0,rn=Je>0?xe/Je:0;let Bt=H.current.x,er=H.current.y;const Pn=R.current;if(Pn&&Me!==null&&Me>=Pn.time){const Cr=Me-Pn.time;if(Cr<=CE){const on=Math.max(Cr,Gf),qr=re.x-Pn.x,Hc=re.y-Pn.y,Jh=qr/on,Qh=Hc/on;Jh!==0&&(Bt=Jh),Qh!==0&&(er=Qh)}else Bt=0,er=0}const Er=h?.({event:q.nativeEvent,direction:I??J.current,deltaX:Oe,deltaY:xe,velocityX:dn,velocityY:rn,releaseVelocityX:Bt,releaseVelocityY:er}),xr=typeof Er=="boolean";if(ae.current&&!xr){Z.current={x:be.x,y:be.y},A({x:be.x,y:be.y}),D(void 0),te(0,De);return}let _n=!1,fn;if(xr)_n=Er,fn=I??J.current??y;else for(const Cr of n){switch(Cr){case"right":Oe>ue.current&&(_n=!0,fn="right");break;case"left":Oe<-ue.current&&(_n=!0,fn="left");break;case"down":xe>ue.current&&(_n=!0,fn="down");break;case"up":xe<-ue.current&&(_n=!0,fn="up");break}if(_n)break}_n&&fn?(D(fn),_(!0),u?.(q.nativeEvent,{direction:fn})):(Z.current={x:be.x,y:be.y},A({x:be.x,y:be.y}),D(void 0),te(0,De))}),Ut=f.useCallback(()=>{const q=g?M:Z.current,re=g?j:K.current;if(!$&&q.x===re.x&&q.y===re.y&&!k)return{[o.x]:"0px",[o.y]:"0px"};const be=q.x-re.x,Le=q.y-re.y;return{transition:$?"none":void 0,transform:$?`translateX(${q.x}px) translateY(${q.y}px) scale(${re.scale})`:void 0,[o.x]:`${be}px`,[o.y]:`${Le}px`}},[k,M,j,$,o,g]),$t=f.useCallback(()=>t?{onPointerDown:Ue,onPointerMove:ct,onPointerUp:Ye,onPointerCancel:Ye}:{},[t,Ye,ct,Ue]),Ke=f.useCallback(()=>t?{onTouchStart:Ue,onTouchMove:ct,onTouchEnd:Ye,onTouchCancel:Ye}:{},[t,Ye,ct,Ue]);return{swiping:$,swipeDirection:I,dragDismissed:k,getPointerProps:$t,getTouchProps:Ke,getDragStyles:Ut,reset:_e}}const IE=Vs,kE=zs,fc=10,Yf=.5,Xf=.5,RE=300,qf=4,Kf=.2,NE=4,pc=80,Jf=360,hc=.1,Qf=1,ME=`[${Lf}]`,ep=f.forwardRef(function(t,n){const{className:r,render:o,style:s,children:i,...a}=t,{store:c}=Vt(),{swipeDirection:u,notifyParentSwipingChange:l,notifyParentSwipeProgressChange:d,frontmostHeight:p,snapToSequentialPoints:h}=js(),g=zf()?.visualStateStore,v=c.useState("open"),y=c.useState("mounted"),C=c.useState("nested"),S=c.useState("nestedOpenDrawerCount"),E=c.useState("viewportElement"),b=c.useState("popupElement"),x=S>0,T=u==="left"||u==="right"?"horizontal":"vertical",P=T==="vertical",z=P?"horizontal":"vertical",{snapPoints:I,resolvedSnapPoints:D,activeSnapPoint:$,activeSnapPointOffset:V,setActiveSnapPoint:N,popupHeight:O}=jf(),[k,_]=f.useState(null),M=f.useRef(void 0),A=f.useRef(null),j=ao(),B=f.useRef(!1),U=f.useRef(""),W=f.useRef(!1),G=f.useRef(!1),Z=f.useRef(null),X=f.useMemo(()=>{if(!I||I.length<2||u!=="down"&&u!=="up"||D.length<2)return null;const R=D.map(ne=>ne.offset).filter(ne=>Number.isFinite(ne)).sort((ne,te)=>ne-te);if(R.length<2)return null;const H=R[0],L=R[1],F=R[R.length-1];let Q=L-H;if(!Number.isFinite(Q)||Q<=0){const ne=F-H;if(!Number.isFinite(ne)||ne<=0)return null;Q=ne}return{minOffset:H,range:Q}},[D,I,u]),K=f.useMemo(()=>!X||V===null?null:bt((V-X.minOffset)/X.range,0,1),[V,X]),J=f.useMemo(()=>I&&I.length>0&&(u==="down"||u==="up")?u==="down"?["down","up"]:["up","down"]:[u],[I,u]),se=ie(R=>{tp(c.context.popupRef.current,c.context.backdropRef.current,R)}),ae=ie(()=>{se(!1),c.context.popupRef.current?.removeAttribute(sr.endingStyle),_(null)}),pe=ie(()=>{B.current&&(B.current=!1,l?.(!1))}),Y=ie(({resolvedProgress:R,shouldTrackProgress:H,notifyParent:L})=>{const F=v&&!C&&H,Q=F?R:0,ne=v&&H?R:0;L&&d&&(d(ne),ne<=0&&pe()),g?.set({swipeProgress:Q,frontmostHeight:Q>0?p:0});const te=c.context.backdropRef.current;if(te){if(!F||Q<=0){te.style.setProperty(Fn.swipeProgress,"0"),te.style.removeProperty(Tt.height);return}te.style.setProperty(Fn.swipeProgress,`${Q}`),p>0?te.style.setProperty(Tt.height,`${p}px`):te.style.removeProperty(Tt.height)}});function me({direction:R,deltaX:H,deltaY:L,velocityX:F,velocityY:Q,releaseVelocityX:ne,releaseVelocityY:te}){if(!R)return null;const ye=c.context.popupRef.current;if(!ye)return null;const _e=R==="left"||R==="right"?ye.offsetWidth:ye.offsetHeight;if(!Number.isFinite(_e)||_e<=0)return null;const Ee=R==="left"||R==="right"?H:L,Ce=I&&I.length>0?V??0:0;let Pe=0;R==="down"?Pe=Ce:R==="up"&&(Pe=-Ce);const Ve=Pe+Ee,Ge=R==="left"||R==="up"?-Ve:Ve,He=Math.max(0,_e-Ge);if(!Number.isFinite(He)||He<=0)return null;const nt=R==="left"||R==="right"?ne:te,st=R==="left"||R==="right"?F:Q,Re=Math.abs(nt)>0&&Number.isFinite(nt)?nt:st,Te=R==="left"||R==="up"?-Re:Re;if(!Number.isFinite(Te)||Te<=Kf)return null;const Ue=bt(Te,Kf,NE),Be=bt(He/Ue,pc,Jf);if(!Number.isFinite(Be))return null;const ct=(Be-pc)/(Jf-pc),Ye=bt(hc+ct*(Qf-hc),hc,Qf);return!Number.isFinite(Ye)||Ye<=0?null:Ye}function ge(R){if(B.current||!R)return;const H=R.direction??u,L=H==="left"||H==="right"?R.deltaX:R.deltaY;!Number.isFinite(L)||Math.abs(L)<fc||(B.current=!0,l?.(!0))}const fe=_E({enabled:y&&!x,directions:J,elementRef:c.context.popupRef,ignoreSelectorWhenTouch:!1,ignoreScrollableAncestors:!0,movementCssVars:{x:Tt.swipeMovementX,y:Tt.swipeMovementY},onSwipeStart(R){if("touches"in R||"pointerType"in R&&R.pointerType==="touch")return;const H=c.context.popupRef.current;if(!H)return;const F=Ie(H).getSelection?.();if(!F||F.isCollapsed)return;const Q=$e(F.anchorNode)?F.anchorNode:F.anchorNode?.parentElement,ne=$e(F.focusNode)?F.focusNode:F.focusNode?.parentElement;!we(H,Q)&&!we(H,ne)||F.removeAllRanges()},onSwipingChange(R){np(c.context.backdropRef.current,R),!R&&!d&&pe()},swipeThreshold({element:R,direction:H}){return rp(R,H)},canStart(R,H){const L=c.context.popupRef.current;if(!L)return!1;const F=L.ownerDocument,Q=Hs(F,R.x,R.y);if(!Q||!we(L,Q))return!1;const ne=H.nativeEvent;return!(("touches"in ne||"pointerType"in ne&&ne.pointerType==="touch")&&sp(F,L)||ne.type==="touchstart"&&mc(Q))},onProgress(R,H){ge(H);const L=H?.direction??fe.swipeDirection,F=L===void 0||L===u,Q=!!(I&&I.length>0),te=Q&&(u==="down"||u==="up")||!Q||u==="left"||u==="right"||F;let ye=R;if(X&&O>0){if(H&&Number.isFinite(H.deltaY)){const _e=V??X.minOffset,Ee=bt(_e+H.deltaY,0,O);ye=bt((Ee-X.minOffset)/X.range,0,1)}else if(K!==null)ye=K;else if(L==="down"||L==="up"){const _e=R*O,Ee=V??X.minOffset,Ce=L==="down"?Ee+_e:Ee-_e;ye=bt((Ce-X.minOffset)/X.range,0,1)}}Y({resolvedProgress:ye,shouldTrackProgress:te,notifyParent:!0})},onRelease({event:R,deltaX:H,deltaY:L,direction:F,velocityX:Q,velocityY:ne,releaseVelocityX:te,releaseVelocityY:ye}){const _e={deltaX:H,deltaY:L,velocityX:Q,velocityY:ne,releaseVelocityX:te,releaseVelocityY:ye};function Ee(Ke){const q=c.context.popupRef.current;q&&(pe(),se(!0),q.style.removeProperty("transition"),q.setAttribute(sr.endingStyle,""),Kt.flushSync(()=>{_(me({direction:Ke,..._e}))}))}if(!I||I.length===0){if(!F){ae();return}const Ke=c.context.popupRef.current;if(!Ke){ae();return}const q=rp(Ke,F),re=F==="left"||F==="right"?H:L;if(!Number.isFinite(re)){ae();return}const be=F==="left"||F==="up"?-re:re;if(be<=0)return ae(),!1;const Le=F==="left"||F==="right"?Q:ne;if((F==="left"||F==="up"?-Le:Le)>=Yf&&be>0)return Ee(F),!0;const De=be>q;return De?Ee(F):ae(),De}if(u!=="down"&&u!=="up"){ae();return}if(!O||D.length===0){ae();return}const Ce=u==="down"?L:-L;if(!Number.isFinite(Ce)){ae();return}const Pe=Math.sign(Ce),Ve=u==="down"?ye:-ye,Ge=u==="down"?ne:-ne;let He=Number.isFinite(Ve)?Ve:Ge;if(Pe!==0&&Math.abs(Ce)>=fc&&Number.isFinite(He)){const Ke=Math.sign(He);Ke!==0&&Ke!==Pe&&(He=Ge)}const nt=V??0,st=bt(nt+Ce,0,O),Re=Number.isFinite(He)&&Math.abs(He)>=Xf?bt(He,-qf,qf)*RE:0,Te=h?st:bt(st+Re,0,O),Ue=Ae(ls,R),Be=()=>(M.current=$,N?.(null,Ue),Ee(u),!0);if(h){const Ke=[...D].sort((Ne,Me)=>Ne.offset-Me.offset);if(Ke.length===0)return ae(),!1;let q=0,re=Math.abs(nt-Ke[0].offset);for(let Ne=1;Ne<Ke.length;Ne+=1){const Me=Math.abs(nt-Ke[Ne].offset);Me<re&&(re=Me,q=Ne)}let be=Ke[0];re=Math.abs(Te-be.offset);for(const Ne of Ke){const Me=Math.abs(Te-Ne.offset);Me<re&&(re=Me,be=Ne)}const Le=Math.sign(He),je=Pe!==0&&Le!==0&&Le===Pe&&Math.abs(He)>=Xf;let De=Te;if(je){const Ne=bt(q+Pe,0,Ke.length-1);if(Ne!==q){const Me=Ke[Ne];(Pe>0?Te<Me.offset:Te>Me.offset)&&(be=Me,De=Me.offset)}else if(Pe>0)return Be()}const Oe=Math.abs(De-O),xe=Math.abs(De-be.offset);return Oe<xe?Be():(N?.(be.value,Ue),ae(),!1)}if(He>=Yf&&Ce>0)return Be();let ct=D[0],Ye=Math.abs(Te-ct.offset);for(const Ke of D){const q=Math.abs(Te-Ke.offset);q<Ye&&(Ye=q,ct=Ke)}return Math.abs(Te-O)<Ye?Be():(N?.(ct.value,Ue),ae(),!1)},onDismiss(R){g?.set({swipeProgress:0,frontmostHeight:0});const H=c.context.backdropRef.current;H&&(H.style.setProperty(Fn.swipeProgress,"0"),H.style.removeProperty(Tt.height));const L=Ae(ls,R);if(c.setOpen(!1,L),L.isCanceled){const F=M.current;F!==void 0&&N?.(F,Ae(ls,R)),M.current=void 0,A.current?.(),ae();return}if(c.select("open")){const F=R;j.request(()=>{if(c.select("open")){const Q=M.current;Q!==void 0&&N?.(Q,Ae(ls,F)),M.current=void 0,ae(),A.current?.()}else M.current=void 0});return}M.current=void 0,se(!0)}}),le=fe.getPointerProps(),ce=fe.getTouchProps(),ve=fe.reset;A.current=ve,f.useEffect(()=>{const R=E??b;if(!R)return;const H=R,L=Ie(H),F=tt(L);function Q(ne){if(G.current)return;const te=Z.current,ye=ne.touches[0];if(!ye||!te)return;const _e=P?ye.clientY-te.lastY:ye.clientX-te.lastX;if(ip(ne,F)){te.allowSwipe=!1,gr(te,ye);return}if(ne.touches.length===2){gr(te,ye);return}if(sp(L,H)||!v||!y||x){gr(te,ye);return}if(FE(te,ye,P)){gr(te,ye);return}const Ce=te.scrollTarget;if(!Ce||Ce===L.documentElement||Ce===L.body){ne.cancelable&&ne.preventDefault(),gr(te,ye);return}if(!VE(Ce,T)){ne.cancelable&&ne.preventDefault(),gr(te,ye);return}const Ve=_e;if(Ve!==0){const Ge=$E(Ce,T,u,Ve);te.allowSwipe?ne.cancelable&&ne.preventDefault():ne.cancelable&&Ge?(te.allowSwipe=!0,ne.preventDefault()):te.allowSwipe=!1}gr(te,ye)}return Fe(L,"touchmove",Q,{passive:!1,capture:!0})},[y,x,v,b,P,T,u,E]),f.useEffect(()=>{if(!X||fe.swiping)return;Y({resolvedProgress:!v||C?0:K??0,shouldTrackProgress:!0,notifyParent:!1})},[Y,p,C,d,v,K,X,fe.swiping,c,g]),f.useEffect(()=>{if(d)return v||d(0),()=>{d(0)}},[d,v]),f.useEffect(()=>{v&&(ve(),ae())},[ae,v,ve]),f.useEffect(()=>()=>{g?.set({swipeProgress:0,frontmostHeight:0}),np(c.context.backdropRef.current,!1),pe()},[pe,c,g]);const ue=f.useMemo(()=>({swiping:fe.swiping,getDragStyles:fe.getDragStyles,swipeStrength:k??null,setSwipeDismissed(R){tp(c.context.popupRef.current,c.context.backdropRef.current,R)}}),[c,fe.getDragStyles,fe.swiping,k]);function Se(){G.current=!1,Z.current=null,U.current="",W.current=!1}return w.jsx(Tf,{ref:n,className:r,render:o,...En(a,{onPointerDown(R){if(U.current=R.pointerType,W.current=R.pointerType==="pen",!v||!y||x)return;const H=Ie(R.currentTarget),L=Hs(H,R.clientX,R.clientY);mc(L)||AE(L)||R.pointerType!=="touch"&&le.onPointerDown?.(R)},onPointerMove(R){R.pointerType!=="touch"&&le.onPointerMove?.(R)},onPointerUp(R){U.current===R.pointerType&&(U.current=""),R.pointerType!=="touch"&&le.onPointerUp?.(R)},onPointerCancel(R){U.current===R.pointerType&&(U.current=""),R.pointerType!=="touch"&&le.onPointerCancel?.(R)},onTouchStart(R){if(U.current==="pen"&&W.current){W.current=!1,G.current=!1,Z.current=null;return}if(!v||!y||x){G.current=!1,Z.current=null;return}const L=R.touches[0];if(!L)return;if(ap(R)){G.current=!1,Z.current=null;return}const F=Ie(R.currentTarget),Q=Hs(F,L.clientX,L.clientY);if(G.current=mc(Q),G.current){Z.current=null;return}const ne=E??b,te=lt(R.nativeEvent),ye=$e(te)?te:null;if(ne&&ye&&!we(ne,ye)){G.current=!0,Z.current=null;return}let _e=null,Ee=!1;ne&&ye&&(_e=Br(ye,ne,T),Ee=Br(ye,ne,z)!=null);let Ce=null;_e&&(Ce=zE(_e,T,u)?null:!1),Z.current={startX:L.clientX,startY:L.clientY,lastX:L.clientX,lastY:L.clientY,scrollTarget:_e,hasCrossAxisScrollableContent:Ee,allowSwipe:Ce,preserveNativeCrossAxisScroll:!1},ce.onTouchStart?.(R)},onTouchMove(R){if(G.current||ap(R))return;const H=Z.current;H?.preserveNativeCrossAxisScroll||H?.allowSwipe===!1||H?.scrollTarget!=null&&!H.allowSwipe||ce.onTouchMove?.(R)},onTouchEnd(R){Se(),ce.onTouchEnd?.(R)},onTouchCancel(R){Se(),ce.onTouchCancel?.(R)},"data-nested-dialog-open":void 0}),children:w.jsx(cc.Provider,{value:ue,children:i})})});process.env.NODE_ENV!=="production"&&(ep.displayName="DrawerViewport");function tp(e,t,n){if(n){e?.setAttribute(ln.swipeDismiss,""),t?.setAttribute(ln.swipeDismiss,"");return}e?.removeAttribute(ln.swipeDismiss),t?.removeAttribute(ln.swipeDismiss)}function np(e,t){if(e){if(t){e.setAttribute(ln.swiping,"");return}e.removeAttribute(ln.swiping)}}function mc(e){return!!e?.closest(Wl)}function AE(e){return!!e?.closest(ME)}function rp(e,t){const n=t==="left"||t==="right"?e.offsetWidth:e.offsetHeight;return Math.max(n*.5,fc)}function op(e,t){return e instanceof t.HTMLInputElement&&e.type==="range"}function DE(e){return $e(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA":!1}function LE(e,t){const n=$e(e.anchorNode)?e.anchorNode:e.anchorNode?.parentElement,r=$e(e.focusNode)?e.focusNode:e.focusNode?.parentElement;return e.containsNode(t,!0)||we(t,n)||we(t,r)}function sp(e,t){const n=Pt(e);if(!!(n&&we(t,n))&&DE(n)){const{selectionStart:s,selectionEnd:i}=n;if(s!=null&&i!=null&&s<i)return!0}const o=e.getSelection?.();return!o||o.isCollapsed?!1:LE(o,t)}function ip(e,t){const n=e.composedPath();return n?n.some(r=>op(r,t)):op(lt(e),t)}function ap(e){return ip(e.nativeEvent,tt(e.currentTarget))}function gr(e,t){e.lastX=t.clientX,e.lastY=t.clientY}function FE(e,t,n){if(e.preserveNativeCrossAxisScroll)return!0;if(e.allowSwipe===!0||!e.hasCrossAxisScrollableContent)return!1;const r=n?t.clientY-e.startY:t.clientX-e.startX,o=n?t.clientX-e.startX:t.clientY-e.startY,s=Math.abs(r),i=Math.abs(o);return i<6||i<=s+2?!1:(e.preserveNativeCrossAxisScroll=!0,!0)}function VE(e,t){return t==="vertical"?e.scrollHeight>e.clientHeight:e.scrollWidth>e.clientWidth}function cp(e,t){if(t==="vertical"){const r=Math.max(0,e.scrollHeight-e.clientHeight);return{offset:e.scrollTop,max:r}}const n=Math.max(0,e.scrollWidth-e.clientWidth);return{offset:e.scrollLeft,max:n}}function zE(e,t,n){const{offset:r,max:o}=cp(e,t),s=up(n,t);return s===null?!1:s?r<=0:r>=o}function $E(e,t,n,r){const{offset:o,max:s}=cp(e,t),i=up(n,t);return i===null||!(i?r>0:r<0)?!1:i?o<=0:o>=s}function up(e,t){return t==="vertical"?e==="down"?!0:e==="up"?!1:null:e==="right"?!0:e==="left"?!1:null}const lp=f.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0});process.env.NODE_ENV!=="production"&&(lp.displayName="FieldsetRootContext");function jE(e=!1){const t=f.useContext(lp);if(!t&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.":ft(86));return t}const dp=function(t){const n=qt(),r=t.controlId===void 0?n:t.controlId,[o,s]=f.useState(r),[i,a]=f.useState(t.labelId),[c,u]=f.useState([]),l=wt(()=>new Map),{messageIds:d}=Ln(),p=ie((g,v)=>{const y=l.current;if(v===void 0){y.delete(g);return}y.set(g,v),s(C=>{if(y.size===0)return;let S;for(const E of y.values()){if(C!==void 0&&E===C)return C;S===void 0&&(S=E)}return S})}),h=f.useCallback(g=>En({"aria-describedby":d.concat(c).join(" ")||void 0},g),[d,c]),m=f.useMemo(()=>({controlId:o,registerControlId:p,labelId:i,setLabelId:a,messageIds:c,setMessageIds:u,getDescriptionProps:h}),[o,p,i,a,c,u,h]);return w.jsx(nc.Provider,{value:m,children:t.children})};process.env.NODE_ENV!=="production"&&(dp.displayName="LabelableProvider");function Bs(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const Ws=Object.keys($s);function HE(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(const n of Ws)n!=="valid"&&(n==="valueMissing"&&(t=e[n]),e[n]&&(t=!1));return t}function UE(e){const{formRef:t,clearErrors:n}=Ur(),{setValidityData:r,validate:o,validityData:s,validationDebounceTime:i,invalid:a,markedDirtyRef:c,state:u,name:l,shouldValidateOnChange:d}=e,{controlId:p,getDescriptionProps:h}=Ln(),m=Gt(),g=f.useRef(null),v=ie(async(S,E=!1)=>{const b=g.current;if(!b)return;if(E){if(u.valid!==!1)return;const V=b.validity;if(!V.valueMissing){const O={value:S,state:{...$s,valid:!0},error:"",errors:[],initialValue:s.initialValue};if(b.setCustomValidity(""),p){const k=t.current.fields.get(p);k&&t.current.fields.set(p,{...k,...Bs(O,!1)})}r(O);return}const N=Ws.reduce((O,k)=>(O[k]=V[k],O),{});if(!N.valid&&!HE(N))return}function x(V){const N=Ws.reduce((k,_)=>(k[_]=V.validity[_],k),{});let O=!1;for(const k of Ws)if(k!=="valid"){if(k==="valueMissing"&&N[k])O=!0;else if(N[k])return N}return O&&!c.current&&(N.valid=!0,N.valueMissing=!1),N}m.clear();let T=null,P=[];const z=x(b);let I;const D=d();if(b.validationMessage&&!D)I=b.validationMessage,P=[b.validationMessage];else{const V=Array.from(t.current.fields.values()).reduce((O,k)=>(k.name&&(O[k.name]=k.getValue()),O),{}),N=o(S,V);typeof N=="object"&&N!==null&&"then"in N?T=await N:T=N,T!==null?(z.valid=!1,z.customError=!0,Array.isArray(T)?(P=T,b.setCustomValidity(T.join(`
19
- `))):T&&(P=[T],b.setCustomValidity(T))):D&&(b.setCustomValidity(""),z.customError=!1,b.validationMessage?(I=b.validationMessage,P=[b.validationMessage]):b.validity.valid&&!z.valid&&(z.valid=!0))}const $={value:S,state:z,error:I??(Array.isArray(T)?T[0]:T??""),errors:P,initialValue:s.initialValue};if(p){const V=t.current.fields.get(p);V&&t.current.fields.set(p,{...V,...Bs($,a)})}r($)}),y=f.useCallback((S={})=>En(h,u.valid===!1?{"aria-invalid":!0}:mt,S),[h,u.valid]),C=f.useCallback((S={})=>En({onChange(E){if(E.nativeEvent.defaultPrevented)return;if(n(l),!d()){v(E.currentTarget.value,!0);return}const b=E.currentTarget;if(b.value===""){v(b.value);return}m.clear(),i?m.start(i,()=>{v(b.value)}):v(b.value)}},y(S)),[y,n,l,m,v,i,d]);return f.useMemo(()=>({getValidationProps:y,getInputValidationProps:C,inputRef:g,commit:v}),[y,C,v])}function BE(e){const{commit:t,invalid:n,markedDirtyRef:r,name:o,setValidityData:s,validityData:i}=e,{formRef:a}=Ur(),c=f.useRef(null),u=f.useRef(null),l=f.useRef(null),d=ie(()=>{const v=u.current;if(v)return v.getValue?v.getValue():v.value}),p=ie((v=!0)=>{const y=u.current;if(!y)return;let C=y.value;C===void 0&&(C=d()),r.current=!0,v?Kt.flushSync(()=>t(C)):t(C)});function h(){const v=u.current;!v||!v.id||a.current.fields.set(v.id,{getValue:d,name:o,controlRef:v.controlRef??l,validityData:Bs(i,n),validate:p})}function m(v=u.current?.id){v&&a.current.fields.delete(v)}function g(){const v=u.current;if(!v)return;let y=v.value;y===void 0&&(y=d()),i.initialValue===null&&y!==null&&s(C=>({...C,initialValue:y}))}return he(()=>{const v=u.current;!v||!v.id||a.current.fields.set(v.id,{getValue:d,name:o,controlRef:v.controlRef??l,validityData:Bs(i,n),validate:p})},[a,d,n,o,p,i]),he(()=>{const v=a.current.fields;return()=>{const y=u.current?.id;y&&v.delete(y)}},[a]),ie((v,y)=>{if(!y){c.current===v&&(c.current=null,m(),u.current=null);return}const C=u.current?.id;c.current=v,u.current=y,C&&C!==y.id&&m(C),g(),h()})}const fp=f.forwardRef(function(t,n){const{errors:r,validationMode:o,submitAttemptedRef:s}=Ur(),{render:i,className:a,validate:c,validationDebounceTime:u=0,validationMode:l=o,name:d,disabled:p=!1,invalid:h,dirty:m,touched:g,actionsRef:v,style:y,...C}=t,{disabled:S}=jE(),E=ie(c||(()=>null)),b=S||p,[x,T]=f.useState(!1),[P,z]=f.useState(!1),[I,D]=f.useState(!1),[$,V]=f.useState(!1),N=m??P,O=g??x,k=f.useRef(!1),_=ie(pe=>{m===void 0&&(pe&&(k.current=!0),z(pe))}),M=ie(pe=>{g===void 0&&T(pe)}),A=ie(()=>l==="onChange"||l==="onSubmit"&&s.current),j=!!d&&Object.hasOwn(r,d)&&r[d]!==void 0,B=h===!0||j,[U,W]=f.useState({state:$s,error:"",errors:[],value:null,initialValue:null}),G=!B&&U.state.valid,Z=f.useMemo(()=>({disabled:b,touched:O,dirty:N,valid:G,filled:I,focused:$}),[b,O,N,G,I,$]),X=UE({setValidityData:W,validate:E,validityData:U,validationDebounceTime:u,invalid:B,markedDirtyRef:k,state:Z,name:d,shouldValidateOnChange:A}),K=f.useCallback(()=>{k.current=!0,X.commit(U.value)},[X,U]),J=BE({commit:X.commit,invalid:B,markedDirtyRef:k,name:d,setValidityData:W,validityData:U});f.useImperativeHandle(v,()=>({validate:K}),[K]);const se=f.useMemo(()=>({invalid:B,name:d,validityData:U,setValidityData:W,disabled:b,touched:O,setTouched:M,dirty:N,setDirty:_,filled:I,setFilled:D,focused:$,setFocused:V,validate:E,validationMode:l,validationDebounceTime:u,shouldValidateOnChange:A,state:Z,markedDirtyRef:k,registerFieldControl:J,validation:X}),[B,d,U,b,O,M,N,_,I,D,$,V,E,l,u,A,Z,J,X]),ae=qe("div",t,{ref:n,state:Z,props:C,stateAttributesMapping:hr});return w.jsx(Qa.Provider,{value:se,children:ae})});process.env.NODE_ENV!=="production"&&(fp.displayName="FieldRootInner");const Wr=f.forwardRef(function(t,n){return w.jsx(dp,{children:w.jsx(fp,{...t,ref:n})})});process.env.NODE_ENV!=="production"&&(Wr.displayName="FieldRoot");const gc=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,nativeLabel:a=!0,...c}=t,u=mr(!1),{labelId:l}=Ln(),d=f.useRef(null),p=sE({id:l??i,native:a});return process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!d.current)return;const m=d.current.tagName==="LABEL";if(a){if(!m){const g=Dr.captureOwnerStack?.()||"";ar(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${g}`)}}else if(m){const g=Dr.captureOwnerStack?.()||"";ar(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${g}`)}},[a]),qe("label",t,{ref:[n,d],state:u.state,props:[p,c],stateAttributesMapping:hr})});process.env.NODE_ENV!=="production"&&(gc.displayName="FieldLabel");const WE={...hr,...tn},Zs=f.forwardRef(function(t,n){const{render:r,id:o,className:s,match:i,style:a,...c}=t,u=qt(o),{validityData:l,state:d,name:p}=mr(!1),{setMessageIds:h}=Ln(),{errors:m}=Ur(),g=p?m[p]:null,v=typeof i=="string";let y=!1;i===!0?y=!0:v?y=!!l.state[i]:y=!!g||l.state.valid===!1;const{mounted:C,transitionStatus:S,setMounted:E}=vo(y);he(()=>{if(!(!y||!u))return h(O=>O.concat(u)),()=>{h(O=>O.filter(k=>k!==u))}},[y,u,h]);const b=f.useRef(null),[x,T]=f.useState(null),[P,z]=f.useState(null),I=l.errors.length>1?w.jsx("ul",{children:l.errors.map(O=>w.jsx("li",{children:O},O))}):l.error,D=v?I:g||I;let $=l.error;g!=null?$=Array.isArray(g)?JSON.stringify(g):g:l.errors.length>1&&($=JSON.stringify(l.errors)),y&&$!==P&&(z($),T(D)),xn({open:y,ref:b,onComplete(){y||E(!1)}});const V={...d,transitionStatus:S},N=qe("div",t,{ref:[n,b],state:V,props:[{id:u,children:y?D:x},c],stateAttributesMapping:WE,enabled:C});return C?N:null});process.env.NODE_ENV!=="production"&&(Zs.displayName="FieldError");const Gs=f.forwardRef(function(t,n){const{render:r,className:o,id:s,name:i,value:a,disabled:c=!1,onValueChange:u,defaultValue:l,autoFocus:d=!1,style:p,...h}=t,{state:m,name:g,disabled:v,setTouched:y,setDirty:C,validityData:S,setFocused:E,setFilled:b,validationMode:x,validation:T}=mr(),P=v||c,z=g??i,I={...m,disabled:P},{labelId:D}=Ln(),$=rc({id:s});he(()=>{const A=a!=null;T.inputRef.current?.value||A&&a!==""?b(!0):A&&a===""&&b(!1)},[T.inputRef,b,a]);const V=f.useRef(null);he(()=>{d&&V.current===Pt(Ie(V.current))&&E(!0)},[d,E]);const[N]=Eo({controlled:a,default:l,name:"FieldControl",state:"value"}),O=a!==void 0,k=O?N:void 0,_=ie(()=>T.inputRef.current?.value);return ec(T.inputRef,{id:$,value:k,getValue:_}),qe("input",t,{ref:[n,V],state:I,props:[{id:$,disabled:P,name:z,ref:T.inputRef,"aria-labelledby":D,autoFocus:d,...O?{value:k}:{defaultValue:l},onChange(A){const j=A.currentTarget.value;u?.(j,Ae(cr,A.nativeEvent)),C(j!==S.initialValue),b(j!=="")},onFocus(){E(!0)},onBlur(A){y(!0),E(!1),x==="onBlur"&&T.commit(A.currentTarget.value)},onKeyDown(A){A.currentTarget.tagName==="INPUT"&&A.key==="Enter"&&(y(!0),T.commit(A.currentTarget.value))}},T.getInputValidationProps(),h],stateAttributesMapping:hr})});process.env.NODE_ENV!=="production"&&(Gs.displayName="FieldControl");const To=f.forwardRef(function(t,n){const{render:r,className:o,validationMode:s="onSubmit",errors:i,onSubmit:a,onFormSubmit:c,actionsRef:u,style:l,...d}=t,p=f.useRef({fields:new Map}),h=f.useRef(!1),m=f.useRef(!1),g=ie(x=>{x&&(x.focus(),x.tagName==="INPUT"&&x.select())}),[v,y]=f.useState(i);As(i,()=>{y(i)}),f.useEffect(()=>{if(!h.current)return;h.current=!1;const x=Array.from(p.current.fields.values()).filter(T=>T.validityData.state.valid===!1);x.length&&g(x[0].controlRef.current)},[v,g]);const C=f.useCallback(x=>{const T=Array.from(p.current.fields.values());if(x){const P=T.find(z=>z.name===x);P&&P.validate(!1)}else T.forEach(P=>{P.validate(!1)})},[]);f.useImperativeHandle(u,()=>({validate:C}),[C]);const S=qe("form",t,{ref:n,props:[{noValidate:!0,onSubmit(x){m.current=!0;let T=Array.from(p.current.fields.values());T.forEach(z=>{z.validate()}),T=Array.from(p.current.fields.values());const P=T.filter(z=>!z.validityData.state.valid);if(P.length)x.preventDefault(),g(P[0].controlRef.current);else if(h.current=!0,a?.(x),c){x.preventDefault();const z=T.reduce((I,D)=>(D.name&&(I[D.name]=D.getValue()),I),{});c(z,_0(cr,x.nativeEvent))}}},d]}),E=ie(x=>{if(x&&v&&mt.hasOwnProperty.call(v,x)){const T={...v};delete T[x],y(T)}}),b=f.useMemo(()=>({formRef:p,validationMode:s,errors:v??mt,clearErrors:E,submitAttemptedRef:m}),[p,s,v,E]);return w.jsx(tc.Provider,{value:b,children:S})});process.env.NODE_ENV!=="production"&&(To.displayName="Form");const yc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(yc.displayName="PopoverRootContext");function Vn(e){const t=f.useContext(yc);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.":ft(47));return t}function ZE(){return{...Nd(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const GE={...Md,disabled:de(e=>e.disabled),instantType:de(e=>e.instantType),openMethod:de(e=>e.openMethod),openChangeReason:de(e=>e.openChangeReason),modal:de(e=>e.modal),focusManagerModal:de(e=>e.focusManagerModal),stickIfOpen:de(e=>e.stickIfOpen),titleElementId:de(e=>e.titleElementId),descriptionElementId:de(e=>e.descriptionElementId),openOnHover:de(e=>e.openOnHover),closeDelay:de(e=>e.closeDelay),hasViewport:de(e=>e.hasViewport)};class vc extends Wo{constructor(t){const n={...ZE(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:f.createRef(),beforeContentFocusGuardRef:f.createRef(),stickIfOpenTimeout:new Zt,triggerElements:new bs},GE)}setOpen=(t,n)=>{const r=n.reason===Lt,o=n.reason===Fr&&n.event.detail===0,s=!t&&(n.reason===ed||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const i=()=>{const a={open:t,openChangeReason:n.reason},c=n.trigger?.id??null;(c||t)&&(a.activeTriggerId=c,a.activeTriggerElement=n.trigger??null),this.update(a)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(i0,()=>{this.set("stickIfOpen",!1)}),Kt.flushSync(i)):i(),o||s?this.set("instantType",o?"click":"dismiss"):n.reason===ur?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const r=wt(()=>new vc(n)).current,o=t??r;return so(r.disposeEffect),o}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function pp({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,modal:i=!1,handle:a,triggerId:c,defaultTriggerId:u=null}=e,l=vc.useStore(a?.store,{modal:i,open:r,openProp:n,activeTriggerId:u,triggerIdProp:c});ja(()=>{n===void 0&&l.state.open===!1&&r===!0&&l.update({open:!0,activeTriggerId:u})}),l.useControlledProp("openProp",n),l.useControlledProp("triggerIdProp",c);const d=l.useState("open"),p=l.useState("payload");l.useContextCallback("onOpenChange",o),l.useContextCallback("onOpenChangeComplete",s);const{openMethod:h,triggerProps:m}=Ha(d);kd(l);const{forceUnmount:g}=Rd(d,l,()=>{l.update({stickIfOpen:!0,openChangeReason:null})});f.useEffect(()=>{d||l.context.stickIfOpenTimeout.clear()},[l,d]);const v=f.useCallback(()=>{l.setOpen(!1,Ae(td))},[l]);f.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:v}),[g,v]);const y=Dd({popupStore:l,onOpenChange:l.setOpen}),C=ka(y,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),S=zd(y),{getReferenceProps:E,getFloatingProps:b,getTriggerProps:x}=bo([C,S]),T=f.useMemo(()=>E(m),[E,m]),P=f.useMemo(()=>x(m),[x,m]),z=f.useMemo(()=>b(),[b]);l.useSyncedValues({modal:i,openMethod:h,activeTriggerProps:T,inactiveTriggerProps:P,popupProps:z,floatingRootContext:y,nested:qn()!=null});const I=f.useMemo(()=>({store:l}),[l]);return w.jsx(yc.Provider,{value:I,children:typeof t=="function"?t({payload:p}):t})}function YE(e){return Vn(!0)?w.jsx(pp,{props:e}):w.jsx(L0,{children:w.jsx(pp,{props:e})})}const XE=300,hp=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,handle:a,payload:c,openOnHover:u=!1,delay:l=XE,closeDelay:d=0,id:p,style:h,...m}=t,g=Vn(!0),v=a?.store??g?.store;if(!v)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle.":ft(74));const y=qt(p),C=v.useState("isTriggerActive",y),S=v.useState("floatingRootContext"),E=v.useState("isOpenedByTrigger",y),b=f.useRef(null),{registerTrigger:x,isMountedByThisTrigger:T}=Id(y,b,v,{payload:c,disabled:s,openOnHover:u,closeDelay:d}),P=v.useState("openChangeReason"),z=v.useState("stickIfOpen"),I=v.useState("openMethod"),D=v.useState("focusManagerModal"),$=Dw(S,{enabled:S!=null&&u&&(I!=="touch"||P!==Fr),mouseOnly:!0,move:!1,handleClose:Bw(),restMs:l,delay:{close:d},triggerElementRef:b,isActiveTrigger:C,isClosing:()=>v.select("transitionStatus")==="ending"}),V=Ia(S,{enabled:S!=null,stickIfOpen:z}),N=bo([V]),O=v.useState("triggerProps",T),k={disabled:s,open:E},{getButtonProps:_,buttonRef:M}=Lr({disabled:s,native:i}),A=f.useMemo(()=>({open(G){return G&&P===Fr?Xd.open(G):Yd.open(G)}}),[P]),j=qe("button",t,{state:k,ref:[M,n,x,b],props:[N.getReferenceProps(),$,O,{[ha]:"",id:y},m,_],stateAttributesMapping:A}),{preFocusGuardRef:B,handlePreFocusGuardFocus:U,handleFocusTargetFocus:W}=aE(v,b);return C&&!D?w.jsxs(f.Fragment,{children:[w.jsx(Sn,{ref:B,onFocus:U}),w.jsx(f.Fragment,{children:j},y),w.jsx(Sn,{ref:v.context.triggerFocusTargetRef,onFocus:W})]}):w.jsx(f.Fragment,{children:j},y)});process.env.NODE_ENV!=="production"&&(hp.displayName="PopoverTrigger");const bc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(bc.displayName="PopoverPortalContext");function qE(){const e=f.useContext(bc);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Portal> is missing.":ft(45));return e}const mp=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Vn();return s.useState("mounted")||r?w.jsx(bc.Provider,{value:r,children:w.jsx(hs,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(mp.displayName="PopoverPortal");const wc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(wc.displayName="PopoverPositionerContext");function gp(){const e=f.useContext(wc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.":ft(46));return e}const yp=f.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="bottom",align:c="center",sideOffset:u=0,alignOffset:l=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:h=5,sticky:m=!1,disableAnchorTracking:g=!1,collisionAvoidance:v=f0,style:y,...C}=t,{store:S}=Vn(),E=qE(),b=A0(),x=S.useState("floatingRootContext"),T=S.useState("mounted"),P=S.useState("open"),z=S.useState("openChangeReason"),I=S.useState("activeTriggerElement"),D=S.useState("modal"),$=S.useState("openMethod"),V=S.useState("positionerElement"),N=S.useState("instantType"),O=S.useState("transitionStatus"),k=S.useState("hasViewport"),_=f.useRef(null),M=Bl(V,!1,!1),A=Zd({anchor:s,floatingRootContext:x,positionMethod:i,mounted:T,side:a,sideOffset:u,align:c,alignOffset:l,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:m,disableAnchorTracking:g,keepMounted:E,nodeId:b,collisionAvoidance:v,adaptiveOrigin:k?Xw:void 0}),j=x.useState("domReferenceElement");he(()=>{const G=j,Z=_.current;if(G&&(_.current=G),Z&&G&&G!==Z){S.set("instantType",void 0);const X=new AbortController;return M(()=>{S.set("instantType","trigger-change")},X.signal),()=>{X.abort()}}},[j,M,S]);const B={open:P,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:N};Pf(P&&D===!0&&z!==Lt,$==="touch",V,I);const U=f.useCallback(G=>{S.set("positionerElement",G)},[S]),W=qd(t,B,{styles:A.positionerStyles,transitionStatus:O,props:C,refs:[n,U],hidden:!T,inert:!P});return w.jsxs(wc.Provider,{value:A,children:[T&&D===!0&&z!==Lt&&w.jsx(Ls,{ref:S.context.internalBackdropRef,inert:cs(!P),cutout:I}),w.jsx(D0,{id:b,children:W})]})});process.env.NODE_ENV!=="production"&&(yp.displayName="PopoverPositioner");const vp=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(vp.displayName="ClosePartContext");function KE(){const[e,t]=f.useState(0),n=ie(()=>(t(o=>o+1),()=>{t(o=>Math.max(0,o-1))}));return{context:f.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function JE(e){const{value:t,children:n}=e;return w.jsx(vp.Provider,{value:t,children:n})}const QE={...Cn,...tn},bp=f.forwardRef(function(t,n){const{className:r,render:o,initialFocus:s,finalFocus:i,style:a,...c}=t,{store:u}=Vn(),l=gp(),d=Mf()!=null,{context:p,hasClosePart:h}=KE(),m=u.useState("open"),g=u.useState("openMethod"),v=u.useState("instantType"),y=u.useState("transitionStatus"),C=u.useState("popupProps"),S=u.useState("titleElementId"),E=u.useState("descriptionElementId"),b=u.useState("modal"),x=u.useState("mounted"),T=u.useState("openChangeReason"),P=u.useState("activeTriggerElement"),z=u.useState("floatingRootContext");xn({open:m,ref:u.context.popupRef,onComplete(){m&&u.context.onOpenChangeComplete?.(!0)}});const I=u.useState("disabled"),D=u.useState("openOnHover"),$=u.useState("closeDelay");Mw(z,{enabled:D&&!I,closeDelay:$});function V(A){return A==="touch"?u.context.popupRef.current:!0}const N=s===void 0?V:s,O={open:m,side:l.side,align:l.align,instant:v,transitionStatus:y},k=b!==!1&&h;u.useSyncedValue("focusManagerModal",k);const _=f.useCallback(A=>{u.set("popupElement",A)},[u]),M=qe("div",t,{state:O,ref:[n,u.context.popupRef,_],props:[C,{"aria-labelledby":S,"aria-describedby":E,onKeyDown(A){d&&Ms.has(A.key)&&A.stopPropagation()}},Va(y),c],stateAttributesMapping:QE});return w.jsx(ms,{context:z,openInteractionType:g,modal:k,disabled:!x||T===Lt,initialFocus:N,returnFocus:i,restoreFocus:"popup",previousFocusableElement:it(P)?P:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:w.jsx(JE,{value:p,children:M})})});process.env.NODE_ENV!=="production"&&(bp.displayName="PopoverPopup");const wp=f.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,{store:a}=Vn(),c=a.useState("open"),{arrowRef:u,side:l,align:d,arrowUncentered:p,arrowStyles:h}=gp();return qe("div",t,{state:{open:c,side:l,align:d,uncentered:p},ref:[n,u],props:[{style:h,"aria-hidden":!0},i],stateAttributesMapping:Cn})});process.env.NODE_ENV!=="production"&&(wp.displayName="PopoverArrow");const e1={...Cn,...tn},Sp=f.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,{store:a}=Vn(),c=a.useState("open"),u=a.useState("mounted"),l=a.useState("transitionStatus"),d=a.useState("openChangeReason");return qe("div",t,{state:{open:c,transitionStatus:l},ref:[a.context.backdropRef,n],props:[{role:"presentation",hidden:!u,style:{pointerEvents:d===Lt?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},i],stateAttributesMapping:e1})});process.env.NODE_ENV!=="production"&&(Sp.displayName="PopoverBackdrop");const Ep=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vn(),c=qt(i.id);return he(()=>(a.set("titleElementId",c),()=>{a.set("titleElementId",void 0)}),[a,c]),qe("h2",t,{ref:n,props:[{id:c},i]})});process.env.NODE_ENV!=="production"&&(Ep.displayName="PopoverTitle");const xp=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vn(),c=qt(i.id);return he(()=>(a.set("descriptionElementId",c),()=>{a.set("descriptionElementId",void 0)}),[a,c]),qe("p",t,{ref:n,props:[{id:c},i]})});process.env.NODE_ENV!=="production"&&(xp.displayName="PopoverDescription");const Ys="base-ui-disable-scrollbar",Sc={className:Ys,getElement(e){return w.jsx("style",{nonce:e,href:Ys,precedence:"base-ui:low",children:`.${Ys}{scrollbar-width:none}.${Ys}::-webkit-scrollbar{display:none}`})}};process.env.NODE_ENV!=="production"&&(Sc.getElement.displayName="styleDisableScrollbar.getElement");const zn=1;function Cp(e,t){return Math.max(0,e-t)}function t1(e,t){if(t<=0)return 0;const n=bt(e,0,t),r=n,o=t-n,s=r<=zn,i=o<=zn;return s&&i?r<=o?0:t:s?0:i?t:n}const Ec=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ec.displayName="SelectRootContext");const xc=f.createContext(null);process.env.NODE_ENV!=="production"&&(xc.displayName="SelectFloatingContext");function Zr(){const e=f.useContext(Ec);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.":ft(60));return e}function Tp(){const e=f.useContext(xc);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.":ft(61));return e}const Ze={id:de(e=>e.id),labelId:de(e=>e.labelId),modal:de(e=>e.modal),multiple:de(e=>e.multiple),items:de(e=>e.items),itemToStringLabel:de(e=>e.itemToStringLabel),itemToStringValue:de(e=>e.itemToStringValue),isItemEqualToValue:de(e=>e.isItemEqualToValue),value:de(e=>e.value),hasSelectedValue:de(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Hr(t,r)!==""}),hasNullItemLabel:de((e,t)=>t?WS(e.items):!1),open:de(e=>e.open),mounted:de(e=>e.mounted),forceMount:de(e=>e.forceMount),transitionStatus:de(e=>e.transitionStatus),openMethod:de(e=>e.openMethod),activeIndex:de(e=>e.activeIndex),selectedIndex:de(e=>e.selectedIndex),isActive:de((e,t)=>e.activeIndex===t),isSelected:de((e,t,n)=>{const r=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(s=>jr(n,s,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:jr(n,o,r)}),isSelectedByFocus:de((e,t)=>e.selectedIndex===t),popupProps:de(e=>e.popupProps),triggerProps:de(e=>e.triggerProps),triggerElement:de(e=>e.triggerElement),positionerElement:de(e=>e.positionerElement),listElement:de(e=>e.listElement),scrollUpArrowVisible:de(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:de(e=>e.scrollDownArrowVisible),hasScrollArrows:de(e=>e.hasScrollArrows)};function n1(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:a,name:c,form:u,autoComplete:l,disabled:d=!1,readOnly:p=!1,required:h=!1,modal:m=!0,actionsRef:g,inputRef:v,onOpenChangeComplete:y,items:C,multiple:S=!1,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x=jS,highlightItemOnHover:T=!0,children:P}=e,{clearErrors:z}=Ur(),{setDirty:I,setTouched:D,setFocused:$,shouldValidateOnChange:V,validityData:N,setFilled:O,name:k,disabled:_,validation:M,validationMode:A}=mr(),j=rc({id:t}),B=_||d,U=k??c,[W,G]=Eo({controlled:n,default:S?r??tl:r,name:"Select",state:"value"}),[Z,X]=Eo({controlled:s,default:i,name:"Select",state:"open"}),K=f.useRef([]),J=f.useRef([]),se=f.useRef(null),ae=f.useRef(null),pe=f.useRef(0),Y=f.useRef(null),me=f.useRef([]),ge=f.useRef(!1),fe=f.useRef(!1),le=f.useRef(null),ce=f.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ve=f.useRef(!1),{mounted:ue,setMounted:Se,transitionStatus:R}=vo(Z),{openMethod:H,triggerProps:L}=Ha(Z),F=wt(()=>new el({id:j,labelId:void 0,modal:m,multiple:S,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x,value:W,open:Z,mounted:ue,transitionStatus:R,items:C,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Q=We(F,Ze.activeIndex),ne=We(F,Ze.selectedIndex),te=We(F,Ze.triggerElement),ye=We(F,Ze.positionerElement),_e=cE(H),Ee=H??_e,Ce=f.useMemo(()=>S&&Array.isArray(W)&&W.length===0?"":Hr(W,b),[S,W,b]),Pe=f.useMemo(()=>S&&Array.isArray(W)?W.map(Oe=>Hr(Oe,b)):Hr(W,b),[S,W,b]),Ve=vt(F.state.triggerElement),Ge=ie(()=>Pe);ec(Ve,{id:j,value:W,getValue:Ge});const He=f.useRef(W);he(()=>{W!==He.current&&F.set("forceMount",!0)},[F,W]),he(()=>{O(S?Array.isArray(W)&&W.length>0:W!=null)},[S,W,O]),he(function(){if(Z)return;const xe=me.current;if(S){const Me=Array.isArray(W)?W:[];if(Me.length===0){F.set("selectedIndex",null);return}const Xe=Me[Me.length-1],Je=xo(xe,Xe,x);F.set("selectedIndex",Je===-1?null:Je);return}const Ne=xo(xe,W,x);F.set("selectedIndex",Ne===-1?null:Ne)},[S,Z,W,me,x,F]),As(W,()=>{z(U),I(W!==N.initialValue),V()?M.commit(W):M.commit(W,!0)});const nt=ie((Oe,xe)=>{if(a?.(Oe,xe),!xe.isCanceled&&(X(Oe),!Oe&&(xe.reason===ur||xe.reason===ya)&&(D(!0),$(!1),A==="onBlur"&&M.commit(W)),!Oe&&F.state.activeIndex!==null)){const Ne=K.current[F.state.activeIndex];queueMicrotask(()=>{Ne?.setAttribute("tabindex","-1")})}}),st=ie(()=>{Se(!1),F.update({activeIndex:null,openMethod:null}),y?.(!1)});xn({enabled:!g,open:Z,ref:se,onComplete(){Z||st()}}),f.useImperativeHandle(g,()=>({unmount:st}),[st]);const Re=ie((Oe,xe)=>{o?.(Oe,xe),!xe.isCanceled&&G(Oe)}),Te=ie(()=>{const Oe=F.state.listElement||se.current;if(!Oe)return;const xe=Cp(Oe.scrollHeight,Oe.clientHeight),Ne=t1(Oe.scrollTop,xe),Me=Ne>0,Xe=Ne<xe;F.state.scrollUpArrowVisible!==Me&&F.set("scrollUpArrowVisible",Me),F.state.scrollDownArrowVisible!==Xe&&F.set("scrollDownArrowVisible",Xe)}),Ue=Ad({open:Z,onOpenChange:nt,elements:{reference:te,floating:ye}}),Be=Ia(Ue,{enabled:!p&&!B,event:"mousedown"}),ct=ka(Ue,{bubbles:!1}),Ye=zw(Ue,{enabled:!p&&!B,listRef:K,activeIndex:Q,selectedIndex:ne,disabledIndices:tl,onNavigate(Oe){Oe===null&&!Z||F.set("activeIndex",Oe)},focusItemOnHover:T}),Ut=jw(Ue,{enabled:!p&&!B&&(Z||!S),listRef:J,activeIndex:Q,selectedIndex:ne,onMatch(Oe){Z?F.set("activeIndex",Oe):Re(me.current[Oe],Ae("none"))},onTypingChange(Oe){ge.current=Oe}}),{getReferenceProps:$t,getFloatingProps:Ke,getItemProps:q}=bo([Be,ct,Ye,Ut]),re=f.useMemo(()=>En($t(),L,j?{id:j}:mt),[$t,L,j]);ja(()=>{F.update({popupProps:Ke(),triggerProps:re})}),he(()=>{F.update({id:j,modal:m,multiple:S,value:W,open:Z,mounted:ue,transitionStatus:R,popupProps:Ke(),triggerProps:re,items:C,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x,openMethod:Ee})},[F,j,m,S,W,Z,ue,R,Ke,re,C,E,b,x,Ee]);const be=f.useMemo(()=>({store:F,name:U,required:h,disabled:B,readOnly:p,multiple:S,highlightItemOnHover:T,setValue:Re,setOpen:nt,listRef:K,popupRef:se,scrollHandlerRef:ae,handleScrollArrowVisibility:Te,scrollArrowsMountedCountRef:pe,getItemProps:q,events:Ue.context.events,valueRef:Y,valuesRef:me,labelsRef:J,typingRef:ge,selectionRef:ce,selectedItemTextRef:le,validation:M,onOpenChangeComplete:y,keyboardActiveRef:fe,alignItemWithTriggerActiveRef:ve,initialValueRef:He}),[F,U,h,B,p,S,T,Re,nt,q,Ue.context.events,M,y,Te]),Le=or(v,M.inputRef),je=S&&Array.isArray(W)&&W.length>0,De=S?void 0:U,Qe=f.useMemo(()=>!S||!Array.isArray(W)||!U?null:W.map(Oe=>{const xe=Hr(Oe,b);return w.jsx("input",{type:"hidden",form:u,name:U,value:xe},xe)}),[S,W,u,U,b]);return w.jsx(Ec.Provider,{value:be,children:w.jsxs(xc.Provider,{value:Ue,children:[P,w.jsx("input",{...M.getInputValidationProps({onFocus(){F.state.triggerElement?.focus({focusVisible:!0})},onChange(Oe){if(Oe.nativeEvent.defaultPrevented)return;const xe=Oe.currentTarget.value,Ne=Ae(cr,Oe.nativeEvent);function Me(){if(S)return;const Xe=me.current.find(Je=>Hr(Je,b).toLowerCase()===xe.toLowerCase()||ZS(Je,E).toLowerCase()===xe.toLowerCase());Xe!=null&&(I(Xe!==N.initialValue),Re(Xe,Ne),V()&&M.commit(Xe))}F.set("forceMount",!0),queueMicrotask(Me)}}),id:j&&De==null?`${j}-hidden-input`:void 0,form:u,name:De,autoComplete:l,value:Ce,disabled:B,required:h&&!je,readOnly:p,ref:Le,style:U?Al:ss,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Qe]})})}const Xs=2,r1=400,Op=200,o1={...Xd,...hr,value:()=>null},Pp=f.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:a=!0,style:c,...u}=t,{setTouched:l,setFocused:d,validationMode:p,state:h,disabled:m}=mr(),{labelId:g}=Ln(),{store:v,setOpen:y,selectionRef:C,validation:S,readOnly:E,required:b,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:P}=Zr(),z=m||T||i,I=We(v,Ze.open),D=We(v,Ze.value),$=We(v,Ze.triggerProps),V=We(v,Ze.positionerElement),N=We(v,Ze.listElement),O=We(v,Ze.id),k=We(v,Ze.labelId),_=We(v,Ze.hasSelectedValue),M=!_&&I,A=We(v,Ze.hasNullItemLabel,M),j=s??O,B=XS(g,k);rc({id:j});const U=vt(V),W=f.useRef(null),{getButtonProps:G,buttonRef:Z}=Lr({disabled:z,native:a}),X=ie(fe=>{v.set("triggerElement",fe)}),K=or(n,W,Z,X),J=Gt(),se=Gt(),ae=Gt(),pe=Gt();f.useEffect(()=>{if(I)return!(_||A)?ae.start(r1,()=>{C.current.allowUnselectedMouseUp=!0,C.current.allowSelectedMouseUp=!0}):pe.start(Op,()=>{C.current.allowUnselectedMouseUp=!0,ae.start(Op,()=>{C.current.allowSelectedMouseUp=!0})}),()=>{ae.clear(),pe.clear()};C.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},se.clear()},[I,_,A,C,se,ae,pe]);const Y=f.useMemo(()=>N?.id??lo(V)?.id,[N,V]),me=En($,{id:j,role:"combobox","aria-expanded":I?"true":"false","aria-haspopup":"listbox","aria-controls":I?Y:void 0,"aria-labelledby":B,"aria-readonly":E||void 0,"aria-required":b||void 0,tabIndex:z?-1:0,ref:K,onFocus(fe){d(!0),I&&x.current&&y(!1,Ae(cr,fe.nativeEvent)),J.start(0,()=>{v.set("forceMount",!0)})},onBlur(fe){we(V,fe.relatedTarget)||(l(!0),d(!1),p==="onBlur"&&S.commit(D))},onPointerMove(){P.current=!1},onKeyDown(){P.current=!0},onMouseDown(fe){if(I)return;const le=Ie(fe.currentTarget);function ce(ve){if(!W.current)return;const ue=ve.target;if(we(W.current,ue)||we(U.current,ue)||ue===W.current)return;const Se=YS(W.current);ve.clientX>=Se.left-Xs&&ve.clientX<=Se.right+Xs&&ve.clientY>=Se.top-Xs&&ve.clientY<=Se.bottom+Xs||y(!1,Ae(O0,ve))}se.start(0,()=>{le.addEventListener("mouseup",ce,{once:!0})})}},S.getValidationProps,u,G);me.role="combobox";const ge={...h,open:I,disabled:z,value:D,readOnly:E,placeholder:!_};return qe("button",t,{ref:[n,W],state:ge,stateAttributesMapping:o1,props:me})});process.env.NODE_ENV!=="production"&&(Pp.displayName="SelectTrigger");const _p=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(_p.displayName="SelectPortalContext");const Ip=f.forwardRef(function(t,n){const{store:r}=Zr(),o=We(r,Ze.mounted),s=We(r,Ze.forceMount);return o||s?w.jsx(_p.Provider,{value:!0,children:w.jsx(hs,{ref:n,...t})}):null});process.env.NODE_ENV!=="production"&&(Ip.displayName="SelectPortal");const Cc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Cc.displayName="SelectPositionerContext");function s1(){const e=f.useContext(Cc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.":ft(59));return e}function qs(e,t){e&&Object.assign(e.style,t)}const i1={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},a1={position:"fixed"},kp=f.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a="bottom",align:c="center",sideOffset:u=0,alignOffset:l=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:h=5,sticky:m=!1,disableAnchorTracking:g,alignItemWithTrigger:v=!0,collisionAvoidance:y=d0,style:C,...S}=t,{store:E,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:T,selectedItemTextRef:P,valuesRef:z,initialValueRef:I,popupRef:D,setValue:$}=Zr(),V=Tp(),N=We(E,Ze.open),O=We(E,Ze.mounted),k=We(E,Ze.modal),_=We(E,Ze.value),M=We(E,Ze.openMethod),A=We(E,Ze.positionerElement),j=We(E,Ze.triggerElement),B=We(E,Ze.isItemEqualToValue),U=We(E,Ze.transitionStatus),W=f.useRef(null),G=f.useRef(null),[Z,X]=f.useState(v),K=O&&Z&&M!=="touch";!O&&Z!==v&&X(v),he(()=>{O||(Ze.scrollUpArrowVisible(E.state)&&E.set("scrollUpArrowVisible",!1),Ze.scrollDownArrowVisible(E.state)&&E.set("scrollDownArrowVisible",!1))},[E,O]),f.useImperativeHandle(T,()=>K),Pf((K||k)&&N,M==="touch",A,j);const J=Zd({anchor:r,floatingRootContext:V,positionMethod:o,mounted:O,side:a,sideOffset:u,align:c,alignOffset:l,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:m,disableAnchorTracking:g??K,collisionAvoidance:y,keepMounted:!0}),se=K?"none":J.side,ae=K?a1:J.positionerStyles,pe={open:N,side:se,align:J.align,anchorHidden:J.anchorHidden},Y=ie(ce=>{E.set("positionerElement",ce)}),me=qd(t,pe,{styles:ae,transitionStatus:U,props:S,refs:[n,Y],hidden:!O,inert:!N}),ge=f.useRef(0),fe=ie(ce=>{if(ce.size===0&&ge.current===0||z.current.length===0)return;const ve=ge.current;if(ge.current=ce.size,ce.size===ve)return;const ue=Ae(cr);if(ve!==0&&!E.state.multiple&&_!==null&&xo(z.current,_,B)===-1){const R=I.current,L=R!=null&&xo(z.current,R,B)!==-1?R:null;$(L,ue),L===null&&(E.set("selectedIndex",null),P.current=null)}if(ve!==0&&E.state.multiple&&Array.isArray(_)){const Se=H=>xo(z.current,H,B)!==-1,R=_.filter(H=>Se(H));(R.length!==_.length||R.some(H=>!HS(_,H,B)))&&($(R,ue),R.length===0&&(E.set("selectedIndex",null),P.current=null))}if(N&&K){E.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Se={height:""};qs(A,Se),qs(D.current,Se)}}),le=f.useMemo(()=>({...J,side:se,alignItemWithTriggerActive:K,setControlledAlignItemWithTrigger:X,scrollUpArrowRef:W,scrollDownArrowRef:G}),[J,se,K,X]);return w.jsx(vS,{elementsRef:b,labelsRef:x,onMapChange:fe,children:w.jsxs(Cc.Provider,{value:le,children:[O&&k&&w.jsx(Ls,{inert:cs(!N),cutout:j}),me]})})});process.env.NODE_ENV!=="production"&&(kp.displayName="SelectPositioner");const c1={...Cn,...tn},Rp=f.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:c,popupRef:u,onOpenChangeComplete:l,setOpen:d,valueRef:p,selectedItemTextRef:h,keyboardActiveRef:m,multiple:g,handleScrollArrowVisibility:v,scrollHandlerRef:y,listRef:C,highlightItemOnHover:S}=Zr(),{side:E,align:b,alignItemWithTriggerActive:x,isPositioned:T,setControlledAlignItemWithTrigger:P,scrollDownArrowRef:z,scrollUpArrowRef:I}=s1(),D=Mf()!=null,$=Tp(),V=Ud(),{nonce:N,disableStyleElements:O}=lE(),k=We(c,Ze.id),_=We(c,Ze.open),M=We(c,Ze.mounted),A=We(c,Ze.popupProps),j=We(c,Ze.transitionStatus),B=We(c,Ze.triggerElement),U=We(c,Ze.positionerElement),W=We(c,Ze.listElement),G=f.useRef(!1),Z=f.useRef(!1),X=f.useRef({}),K=ao(),J=ie(Y=>{if(!U||!u.current||!Z.current)return;if(G.current||!x){v();return}const me=U.style.top==="0px",ge=U.style.bottom==="0px";if(!me&&!ge){v();return}const fe=Mp(U),le=Oo(U.getBoundingClientRect().height,"y",fe),ce=Ie(U),ve=getComputedStyle(U),ue=parseFloat(ve.marginTop),Se=parseFloat(ve.marginBottom),R=Np(getComputedStyle(u.current)),H=Math.min(ce.documentElement.clientHeight-ue-Se,R),L=Y.scrollTop,F=Ks(Y);let Q=0,ne=null,te=!1,ye=!1;const _e=Ve=>{U.style.height=`${Ve}px`},Ee=(Ve,Ge)=>{const He=bt(Ve,0,H-le);He>0&&_e(le+He),Y.scrollTop=Ge,H-(le+He)<=zn&&(G.current=!0),v()},Ce=me?F-L:L,Pe=Math.min(le+Ce,H);if(Q=Pe,Ce<=zn){Ee(Ce,me?F:0);return}if(H-Pe>zn)me?ye=!0:ne=0;else if(te=!0,ge&&L<F){const Ve=le+Ce-H;ne=L-(Ce-Ve)}if(Q=Math.ceil(Q),Q!==0&&_e(Q),ye||ne!=null){const Ve=Ks(Y),Ge=ye?Ve:bt(ne,0,Ve);Math.abs(Y.scrollTop-Ge)>zn&&(Y.scrollTop=Ge)}(te||Q>=H-zn)&&(G.current=!0),v()});f.useImperativeHandle(y,()=>J,[J]),xn({open:_,ref:u,onComplete(){_&&l?.(!0)}});const se={open:_,transitionStatus:j,side:E,align:b};he(()=>{!U||!u.current||Object.keys(X.current).length||(X.current={top:U.style.top||"0",left:U.style.left||"0",right:U.style.right,height:U.style.height,bottom:U.style.bottom,minHeight:U.style.minHeight,maxHeight:U.style.maxHeight,marginTop:U.style.marginTop,marginBottom:U.style.marginBottom})},[u,U]),he(()=>{_||x||(Z.current=!1,G.current=!1,qs(U,X.current))},[_,x,U,u]),he(()=>{const Y=u.current;if(!_||!B||!U||!Y||x&&!T||c.state.transitionStatus==="ending")return;if(!x){Z.current=!0,K.request(v),Y.style.removeProperty("--transform-origin");return}const me=u1(Y);Y.style.removeProperty("--transform-origin");try{const ge=h.current,fe=p.current,le=getComputedStyle(U),ce=getComputedStyle(Y),ve=Ie(B),ue=tt(U),Se=Mp(B),R=Js(B.getBoundingClientRect(),Se),H=Js(U.getBoundingClientRect(),Se),L=R.height,F=W||Y,Q=F.scrollHeight,ne=parseFloat(ce.borderBottomWidth),te=parseFloat(le.marginTop)||10,ye=parseFloat(le.marginBottom)||10,_e=parseFloat(le.minHeight)||100,Ee=Np(ce),Ce=5,Pe=5,Ve=20,Ge=ve.documentElement.clientHeight-te-ye,He=ve.documentElement.clientWidth,nt=Ge-R.bottom+L;let st,Re=V==="rtl"?R.right-H.width:R.left,Te=0;if(ge&&fe){const Le=Js(fe.getBoundingClientRect(),Se);st=Js(ge.getBoundingClientRect(),Se),Re=H.left+(V==="rtl"?Le.right-st.right:Le.left-st.left);const je=Le.top-R.top+Le.height/2;Te=st.top-H.top+st.height/2-je}const Ue=nt+Te+ye+ne;let Be=Math.min(Ge,Ue);const ct=Ge-te-ye,Ye=Ue-Be,Ut=He-Pe;U.style.left=`${bt(Re,Ce,Ut-H.width)}px`,U.style.height=`${Be}px`,U.style.maxHeight="auto",U.style.marginTop=`${te}px`,U.style.marginBottom=`${ye}px`,Y.style.height="100%";const $t=Ks(F),Ke=Ye>=$t-zn;Ke&&(Be=Math.min(Ge,H.height)-(Ye-$t));const q=R.top<Ve||R.bottom>Ge-Ve||Math.ceil(Be)+zn<Math.min(Q,_e),re=(ue.visualViewport?.scale??1)!==1&&Gi;if(q||re){Z.current=!0,qs(U,X.current),P(!1);return}const be=Math.max(_e,Be);if(Ke){const Le=Math.max(0,Ge-Ue);U.style.top=H.height>=ct?"0":`${Le}px`,U.style.height=`${Be}px`,F.scrollTop=Ks(F)}else U.style.bottom="0",F.scrollTop=Ye;if(st){const Le=H.top,je=H.height,De=st.top+st.height/2,Qe=je>0?(De-Le)/je*100:50,Oe=bt(Qe,0,100);Y.style.setProperty("--transform-origin",`50% ${Oe}%`)}(be===Ge||Be>=Ee)&&(G.current=!0),v(),S&&c.state.selectedIndex===null&&c.state.activeIndex===null&&C.current[0]!=null&&c.set("activeIndex",0),Z.current=!0}finally{me()}},[c,_,U,B,p,h,u,v,x,P,K,z,I,W,C,S,V,T]),f.useEffect(()=>{if(!x||!U||!_)return;const Y=tt(U);function me(ge){d(!1,Ae(P0,ge))}return Fe(Y,"resize",me)},[d,x,U,_]);const ae={...W?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":g||void 0,id:`${k}-list`},onKeyDown(Y){m.current=!0,D&&Ms.has(Y.key)&&Y.stopPropagation()},onMouseMove(){m.current=!1},onScroll(Y){W||J(Y.currentTarget)},...x&&{style:W?{height:"100%"}:i1}},pe=qe("div",t,{ref:[n,u],state:se,stateAttributesMapping:c1,props:[A,ae,Va(j),{className:!W&&x?Sc.className:void 0},a]});return w.jsxs(f.Fragment,{children:[!O&&Sc.getElement(N),w.jsx(ms,{context:$,modal:!1,disabled:!M,returnFocus:i,restoreFocus:!0,children:pe})]})});process.env.NODE_ENV!=="production"&&(Rp.displayName="SelectPopup");function Np(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ks(e){return Cp(e.scrollHeight,e.clientHeight)}function Mp(e){return Cd.getScale(e)}function Oo(e,t,n){return e/n[t]}function Js(e,t){return po({x:Oo(e.x,"x",t),y:Oo(e.y,"y",t),width:Oo(e.width,"x",t),height:Oo(e.height,"y",t)})}const Ap=[["transform","none"],["scale","1"],["translate","0 0"]];function u1(e){const{style:t}=e,n={};for(const[r,o]of Ap)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Ap){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const Tc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Tc.displayName="SelectItemContext");function Oc(){const e=f.useContext(Tc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.":ft(57));return e}const Dp=f.memo(f.forwardRef(function(t,n){const{render:r,className:o,value:s=null,label:i,disabled:a=!1,nativeButton:c=!1,style:u,...l}=t,d=f.useRef(null),p=ES({label:i,textRef:d,indexGuessBehavior:pf.GuessFromOrder}),{store:h,getItemProps:m,setOpen:g,setValue:v,selectionRef:y,typingRef:C,valuesRef:S,multiple:E,selectedItemTextRef:b}=Zr(),x=We(h,Ze.isActive,p.index),T=We(h,Ze.isSelected,p.index,s),P=We(h,Ze.isSelectedByFocus,p.index),z=We(h,Ze.isItemEqualToValue),I=p.index,D=I!==-1,$=f.useRef(null),V=vt(I);he(()=>{if(!D)return;const Z=S.current;return Z[I]=s,()=>{delete Z[I]}},[D,I,s,S]),he(()=>{if(!D)return;const Z=h.state.value;let X=Z;E&&Array.isArray(Z)&&Z.length>0&&(X=Z[Z.length-1]),X!==void 0&&jr(s,X,z)&&(h.set("selectedIndex",I),d.current&&(b.current=d.current))},[D,I,E,z,h,s,b]);const N={disabled:a,selected:T,highlighted:x},O=m({active:x,selected:T});O.id=void 0;const k=f.useRef(null),_=f.useRef("mouse"),M=f.useRef(!1),{getButtonProps:A,buttonRef:j}=Lr({disabled:a,focusableWhenDisabled:!0,native:c,composite:!0});function B(Z){const X=h.state.value;if(E){const K=Array.isArray(X)?X:[],J=T?US(K,s,z):[...K,s];v(J,Ae(va,Z))}else v(s,Ae(va,Z)),g(!1,Ae(va,Z))}const U={role:"option","aria-selected":T,tabIndex:x?0:-1,onTouchStart(){y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(Z){k.current=Z.key,h.set("activeIndex",I),Z.key===" "&&C.current&&Z.preventDefault()},onClick(Z){M.current=!1,!(Z.type==="keydown"&&k.current===null)&&(a||Z.type==="keydown"&&k.current===" "&&C.current||_.current!=="touch"&&!x||(k.current=null,B(Z.nativeEvent)))},onPointerEnter(Z){_.current=Z.pointerType},onPointerDown(Z){_.current=Z.pointerType,M.current=!0},onMouseUp(){if(a)return;if(M.current){M.current=!1;return}const Z=!y.current.allowSelectedMouseUp&&T,X=!y.current.allowUnselectedMouseUp&&!T;Z||X||_.current!=="touch"&&!x||$.current?.click()}},W=qe("div",t,{ref:[j,n,p.ref,$],state:N,props:[O,U,l,A]}),G=f.useMemo(()=>({selected:T,indexRef:V,textRef:d,selectedByFocus:P,hasRegistered:D}),[T,V,d,P,D]);return w.jsx(Tc.Provider,{value:G,children:W})}));process.env.NODE_ENV!=="production"&&(Dp.displayName="SelectItem");const Lp=f.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=Oc();return r||o?w.jsx(Fp,{...t,ref:n}):null});process.env.NODE_ENV!=="production"&&(Lp.displayName="SelectItemIndicator");const Fp=f.memo(f.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:a}=Oc(),c=f.useRef(null),{transitionStatus:u,setMounted:l}=vo(a),p=qe("span",e,{ref:[t,c],state:{selected:a,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:tn});return xn({open:a,ref:c,onComplete(){a||l(!1)}}),p}));process.env.NODE_ENV!=="production"&&(Fp.displayName="Inner");const Vp=f.memo(f.forwardRef(function(t,n){const{indexRef:r,textRef:o,selectedByFocus:s,hasRegistered:i}=Oc(),{selectedItemTextRef:a}=Zr(),{className:c,render:u,style:l,...d}=t,p=f.useCallback(m=>{if(!m||!i)return;const g=a.current===null||!a.current.isConnected;(s||g&&r.current===0)&&(a.current=m)},[a,r,s,i]);return qe("div",t,{ref:[p,n,o],props:d})}));process.env.NODE_ENV!=="production"&&(Vp.displayName="SelectItemText");function Rt({as:e,children:t,className:n,disabled:r,...o}){const s=e||"button",i=s==="button";return w.jsx(s,{className:Mi("align-middle inline-flex items-center justify-center transition-all cursor-pointer hover:brightness-110 active:brightness-90 active:scale-90 disabled:cursor-not-allowed disabled:grayscale",n),...i?{disabled:r}:{"aria-disabled":r},...r&&!i?{onClick:a=>{a.preventDefault(),a.stopPropagation()}}:{},...o,children:t})}const l1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),d1=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),zp=e=>{const t=d1(e);return t.charAt(0).toUpperCase()+t.slice(1)},$p=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),f1=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var p1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const h1=oe.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>oe.createElement("svg",{ref:c,...p1,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$p("lucide",o),...!s&&!f1(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,l])=>oe.createElement(u,l)),...Array.isArray(s)?s:[s]]));const $n=(e,t)=>{const n=oe.forwardRef(({className:r,...o},s)=>oe.createElement(h1,{ref:s,iconNode:t,className:$p(`lucide-${l1(zp(e))}`,`lucide-${e}`,r),...o}));return n.displayName=zp(e),n};const Pc=$n("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const jp=$n("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Hp=$n("eye-closed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);const Up=$n("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const m1=$n("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const g1=$n("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const y1=$n("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);const v1=$n("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const Bp=$n("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function b1(e){return _t.get("/channel/game/role/mail-captcha",e)}function w1(e){return _t.get("/channel/game/role/auth",e)}function S1(e){return _t.post("/passport-api/v2/ztgame/auth/login",{account:e.account,password:e.password,channel_login:1,channel_id:6})}function E1(e){return _t.post("/passport-api/v2/sms-captchas",{mobile:e.mobile,type:e.type||"register",is_voice:0,nationcode:e.countryCode})}function x1(e){return _t.post("/passport-api/v2/ztgame/auth/mobile-register",{mobile:e.mobile,captcha:e.captcha,channel_login:1,channel_id:6,nationcode:e.countryCode,ad_id:""})}function Wp(){return _t.post("/passport-api/v2/ztgame/auth/auth",{channel_login:1,channel_id:6})}function C1(e){return _t.post(`/passport-api/v2/ztgame/users/${e.uid}/idcard`,{name:e.name,idcard:e.idcard},{headers:{Authentication:e.authorization}})}function T1(e){return _t.post("/passport-api/v2/ztgame/auth/re-auth",{type:"auth",channel_id:6,ad_id:"",channel_login:1},{headers:{Authentication:e}})}function O1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/",e)}function P1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/sms-captchas",e)}function Zp(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys",e)}function _1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-update",e)}const I1="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAYAAADk3wSdAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFJ0lEQVQ4jW2VW4ydVRXHf2tfvu87Z+5znEtnxnLR0pYJatEHWxhBEZUSCE8YESImRnzwQTEEY6KJGrQJXiFGXzAxaowkSkyoIgjYlEqEIIrSS6KmpTPDdJgz55w5t++29/bhjDQFVrKf9lq/rGSt/3/J+v2XExRQgNsKuJbH9QLFKaE4BWqUu6TCvXhGQsajOD6D4BJfQBCuvvaLLE/uhLTN/8PwVlGCxIJZCJ9XYzwYBEIGdLkztBE8d1rvSJWlbSLw/oJy9UZe8AOAGglfNbt4UE2CSkBikASwfKpE6blOncdndtOauAjy3gWM8516wCGiuFGPyT2Mhw+EQvC9wZ+UEAw4UfXZtBU6cZX7Fm+C4IDwBmgAPHdguEGPy1VqSO0MObhewHc9UgC5gAKXKmpbW3fV8i1/8JovsDyzG5ortxK4DpFzwP1A2yAcUpHciwURCLngOgFVBkIOOPBd/qrWir/MrTV/k6nk2N3v/Rx/uHgJmqvfrqb5l3sioBVofTsi18hrDywGqQ46IQBFwHcCRT1QrrmfDjXaP/TrvNRerrIiM/xq98d4bH6ROK3fV3XlV0QU60azajTOGND6R4YIpAqiAsEDVnB1UM30lonQ/t0/G3t4uXkZqxM1TkztpDmUXP7uzVcO2SA3FVrR0hoEOkrRCAFCGDMScUJX3V6lPCEIrqexsb82quVHnji6xJ9PH8Bbtc9G2f4dW42PznbDzc5qerGlnURURMidEPT2sIw5bFTMYVMp94rxEASfyananu6RI0/t49G/f4gdMxu/jExxm/QF1fMURtEdshRKMSo5GZa1OKJlDVSSc1STx4wedi/paomKPMELSfAv9NKY5569jNGk89nIFLeFIAQFISiMC9jCMZzlHJ+cfPn5uem9G6AQBdXkReKoacxw0TDDHhWX4BQqLjY3z4zTaVapVLODIch5YchAHNa7rJ4k1//pit3LRRT9h9a2RCvJJtai7JgbN1ObqOlzqJlzMJxPjF7cZnSkT78V/1Hk/GJLgKBlKyqLfUcX33m0mJu9lLIU4giSGOJ4gjhG2Zn6uxhvk+kqfRvDWPdKc8UrfPgTz+E2R34cUvMwKhAEvOL0Rcud95+pLZw4eeB94N2VGAtRNHjW7qOajBlG+gcb3QXq3XHaZUzFdvfOmY2r5JNnjw39+2/Iz3Z9vGbCDyTORyr94ul/LEbFr+8YhWoLmvJpbDSQqggYPUsSf0TSjYmw0p6nnlnqmWUji8Frp4bzm1eS7PfHf3sJ5eMLjHQtJ/eUPH39GAzNvI2txUdIZ66mtzVwKQGshaHqz00ImsxruqWmkRleS4W1VOvQqBz2OvnJ2aW1B55cXD1BfQqG50fpRbdTn/oG0UQNayC24MIAGllQqiO+FX13pXnp3Sebk5zuaZZ7hvVU86+e5vlMcIWjwDxJmG3i3/5B9PwkageoKWAanAKXDUzCmrMovWRE5V+aH//vcaS8oe+n97/at3ObheLFAtK+h7wCevo6dA10ddsjuxASEAW6UqLNMSR6BpHv4GkaPIjJH1oYXn+onY1E3UJuXE3VPb0tvZ9Cg66A0oNz4FNQMfg20Gkj5lvI+C9Qc8vI1GCJX3d+D6mzlEHy2PhH3lF1B95T8d9ECYQAFBByCH3wLXBnnsWd2QP9Q6CXt+X2Fs6/7Xy5F4oAOyxfQ/sGRfa919NCAX75GVBLmF1AzGBCF8abDp8ARuDVnoJMvo/JSrz/OpIaKJ7CN25Batul4U1AgP8BRjZPP9WeeTQAAAAASUVORK5CYII=";function k1(e){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 500 500",...e,children:[w.jsx("path",{fill:"url(#a)",d:"M0 250C0 111.929 111.929 0 250 0s250 111.929 250 250-111.929 250-250 250S0 388.071 0 250Z"}),w.jsx("path",{fill:"#fff",d:"M159.432 341h-33.008V158.949h33.008V341Zm220.263-76.172c0 11.087-1.946 21.286-5.84 30.596-3.808 9.31-9.098 17.35-15.869 24.121-6.771 6.686-14.811 11.934-24.121 15.742-9.31 3.809-19.424 5.713-30.342 5.713h-89.121c-2.369 0-4.57-.423-6.601-1.27-2.031-.846-3.809-1.988-5.332-3.427-1.439-1.524-2.582-3.301-3.428-5.332-.846-2.032-1.27-4.232-1.27-6.602V175.58c0-2.285.424-4.443 1.27-6.475.846-2.031 1.989-3.808 3.428-5.332a16.354 16.354 0 0 1 5.332-3.554c2.031-.847 4.232-1.27 6.601-1.27h89.121c10.918 0 21.032 1.905 30.342 5.713 9.31 3.809 17.35 9.098 24.121 15.869 6.771 6.686 12.061 14.727 15.869 24.121 3.894 9.31 5.84 19.466 5.84 30.469v29.707Zm-33.007-29.707c0-6.432-1.058-12.314-3.174-17.646-2.032-5.332-4.952-9.86-8.76-13.584-3.809-3.809-8.379-6.729-13.711-8.76-5.247-2.116-11.087-3.174-17.52-3.174h-72.744v116.035h72.744c6.433 0 12.273-1.015 17.52-3.047 5.332-2.116 9.902-5.035 13.711-8.759 3.808-3.809 6.728-8.337 8.76-13.584 2.116-5.332 3.174-11.257 3.174-17.774v-29.707Z"}),w.jsx("defs",{children:w.jsxs("linearGradient",{id:"a",x1:250,x2:250,y1:0,y2:500,gradientUnits:"userSpaceOnUse",children:[w.jsx("stop",{stopColor:"#497EFE"}),w.jsx("stop",{offset:1,stopColor:"#947AFA"})]})})]})}function Qs(){const{gameId:e,loginTypes:t,currentLoginType:n,setCurrentLoginType:r}=Dn(),o=tf({loginTypes:t,gameId:e}),s=nf({loginTypes:t,gameId:e}),i=ef({loginTypes:t,gameId:e}),a=[];return i&&n!==at.GIANT&&a.push({type:at.GIANT,label:e==="5327"?"账号密码登录":"巨人账号",icon:e==="5327"?null:w.jsx("img",{className:"size-4",src:I1})}),s&&n!==at.MOBILE&&a.push({type:at.MOBILE,label:"手机号登录",icon:w.jsx(m1,{className:"size-4"})}),o&&n!==at.ROLE_ID&&a.push({type:at.ROLE_ID,label:"ID 登录",icon:w.jsx(k1,{className:"size-4"})}),n!=="quick"&&$r(e).length>0&&a.push({type:"quick",label:"快捷登录",icon:w.jsx(v1,{className:"size-4"})}),a.length?w.jsx("div",{className:"text-gray-500 text-xs flex justify-center items-center gap-2 mb-4",children:a.map((c,u)=>w.jsxs(Rt,{className:"h-7 px-3 border rounded-full border-gray-300 gap-1.5",onClick:()=>r(c.type),children:[c.icon,w.jsx("span",{children:c.label})]},c.type))}):null}function R1(e){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 90 90",fill:"currentColor",...e,children:w.jsx("path",{d:"M41.415 1.601c6.427-2.244 13.363 2.04 14.18 8.773.611 5.508-2.959 10.609-8.365 11.833-.408.102-.918.203-1.326.305-.918.204-1.735.409-2.653.613-.306.102-.714.204-1.122.306h-.101c-.816.306-1.633.51-2.448.816-.306.102-.715.306-1.021.408l-2.754 1.223c-.408.103-.714.307-1.02.511-1.224.612-2.346 1.326-3.468 2.142l-.307.306c-.612.409-1.122.919-1.632 1.327-.51.408-1.02.816-1.53 1.326-.408.306-.714.713-1.122 1.02-.408.407-.816.918-1.326 1.428-.306.612-.409 1.224-.612 1.836-.204 1.122-.51 2.143-.714 3.265-.204 1.02-.408 2.04-.51 3.06 0 .611-.103 1.122-.103 1.734v1.632c0 1.02 0 1.938.103 2.958.102 1.02.306 2.143.51 3.163.204.816.408 1.733.612 2.55.204.816.408 1.53.612 2.346.102.306.204.51.408.714.51.612 1.122 1.122 1.632 1.734 1.02.918 2.04 1.836 3.162 2.754.816.612 1.734 1.224 2.55 1.836.51.306.919.612 1.429.918.102 0 .204 0 .204.103.204 0 .306.102.51.204.408.204.714.408 1.122.612.918.408 1.734.714 2.652 1.122.714.204 1.326.51 2.04.714 1.122.306 2.143.612 3.265.918.51.204 1.122.204 1.632 0 .306-.102.51-.102.816-.204.816-.204 1.53-.51 2.346-.714 1.53-.408 2.958-1.02 4.386-1.633h.102c.816-.408 1.735-.815 2.55-1.325.307-.204.714-.408 1.02-.612 1.02-.714 2.04-1.428 3.06-2.244.613-.51 1.123-1.02 1.735-1.53l2.142-2.143c.408-.408.714-.816.816-1.428 0-.102.103-.102.103-.204.306-1.02.611-2.142.815-3.162.306-1.326.612-2.755.714-4.183v-.204c.102-1.224.103-2.448.103-3.672-.102-.816-.102-1.53-.204-2.346 0-.102 0-.204-.102-.205-.918.408-1.735.715-2.55 1.225-1.633.918-3.061 1.938-4.489 3.06-.102.101-.204.102-.306.204-1.02.918-1.938 1.734-2.856 2.652-1.02 1.02-2.041 2.04-2.96 3.162-1.937 2.244-4.487 3.469-7.445 3.673-5.713.306-10.61-3.673-11.324-9.283-.816-5.61 2.959-10.813 8.467-11.935a52.639 52.639 0 0 0 7.856-2.142h.101c.816-.408 1.734-.715 2.55-1.122 3.264-1.53 6.121-3.672 8.773-6.12 1.327-1.327 2.652-2.653 3.876-4.082 2.347-2.55 5.305-3.774 8.773-3.57 5.1.306 9.283 4.285 9.895 9.283.204 1.53.102 3.06-.408 4.489-.612 1.938-1.224 3.876-1.734 5.916-.102 1.02-.408 1.939-.51 2.958-.408 2.449-.51 4.795-.306 7.141v.306c.102.816.204 1.53.306 2.347a46.28 46.28 0 0 0 1.224 5.406c.102 0 .102.102.102.204.51 1.632 1.224 3.264 1.224 4.794.306 3.162-.51 5.917-2.55 8.365-1.632 1.938-3.774 3.06-6.223 3.57-1.734.408-3.57.817-5.304 1.326-.102.102-.204.102-.306.102-1.836.612-3.775 1.326-5.509 2.244h-.101c-.918.408-1.735.919-2.551 1.429-.306.204-.714.51-1.02.714a30.738 30.738 0 0 0-2.856 2.244c-.816.714-1.633 1.53-2.347 2.244a.22.22 0 0 1-.204.204c-.918.918-1.734 1.836-2.55 2.754-2.346 2.55-5.202 3.877-8.67 3.775-3.06-.102-5.61-1.428-7.651-3.672-1.428-1.633-2.958-3.163-4.488-4.591v-.102c-.51-.408-1.02-.918-1.53-1.326-.715-.612-1.53-1.122-2.245-1.734l-1.53-.918c-.612-.306-1.122-.612-1.734-.918l-2.754-1.225c-1.326-.612-2.653-1.02-4.081-1.428-1.326-.407-2.652-.714-3.978-1.02a11.146 11.146 0 0 1-3.673-1.224c-3.264-1.734-5.1-4.489-5.61-8.16-.204-1.633 0-3.265.51-4.795.816-2.244 1.428-4.59 1.938-6.936.102-.102.102-.103.102-.204.102-.715.204-1.531.306-2.347.102-.714.205-1.428.205-2.142V43.63l-.087-.956a39.328 39.328 0 0 0-1.24-6.695c-.102-.102-.102-.205-.102-.306-.51-1.734-1.224-3.469-1.53-5.203-1.122-5.712 2.55-11.22 8.263-12.445.714-.204 1.53-.306 2.244-.51 1.224-.306 2.55-.612 3.775-1.02 1.224-.408 2.448-.816 3.672-1.326l1.223-.612c.918-.408 1.837-.918 2.755-1.428 1.122-.714 2.244-1.53 3.366-2.346.408-.306.715-.612 1.122-.918.408-.408.918-.918 1.428-1.326a40.49 40.49 0 0 0 2.96-2.96c1.53-1.835 3.161-3.16 5.405-3.977Z"})})}function N1(e){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",fill:"currentColor",...e,children:w.jsx("path",{d:"M842.667 384H768V277.333a234.667 234.667 0 1 0-469.333 0V384H224a53.393 53.393 0 0 0-53.333 53.333V928A53.393 53.393 0 0 0 224 981.333h618.667A53.393 53.393 0 0 0 896 928V437.333A53.393 53.393 0 0 0 842.667 384zm-288 295.007v110.326a21.333 21.333 0 0 1-42.667 0V679.007a64 64 0 1 1 42.667 0zM725.333 384h-384V277.333c0-105.866 86.134-192 192-192s192 86.134 192 192z"})})}var _c,Gp;function M1(){if(Gp)return _c;Gp=1;var e="Expected a function",t=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,c=typeof Ho=="object"&&Ho&&Ho.Object===Object&&Ho,u=typeof self=="object"&&self&&self.Object===Object&&self,l=c||u||Function("return this")(),d=Object.prototype,p=d.toString,h=Math.max,m=Math.min,g=function(){return l.Date.now()};function v(b,x,T){var P,z,I,D,$,V,N=0,O=!1,k=!1,_=!0;if(typeof b!="function")throw new TypeError(e);x=E(x)||0,y(T)&&(O=!!T.leading,k="maxWait"in T,I=k?h(E(T.maxWait)||0,x):I,_="trailing"in T?!!T.trailing:_);function M(K){var J=P,se=z;return P=z=void 0,N=K,D=b.apply(se,J),D}function A(K){return N=K,$=setTimeout(U,x),O?M(K):D}function j(K){var J=K-V,se=K-N,ae=x-J;return k?m(ae,I-se):ae}function B(K){var J=K-V,se=K-N;return V===void 0||J>=x||J<0||k&&se>=I}function U(){var K=g();if(B(K))return W(K);$=setTimeout(U,j(K))}function W(K){return $=void 0,_&&P?M(K):(P=z=void 0,D)}function G(){$!==void 0&&clearTimeout($),N=0,P=V=z=$=void 0}function Z(){return $===void 0?D:W(g())}function X(){var K=g(),J=B(K);if(P=arguments,z=this,V=K,J){if($===void 0)return A(V);if(k)return $=setTimeout(U,x),M(V)}return $===void 0&&($=setTimeout(U,x)),D}return X.cancel=G,X.flush=Z,X}function y(b){var x=typeof b;return!!b&&(x=="object"||x=="function")}function C(b){return!!b&&typeof b=="object"}function S(b){return typeof b=="symbol"||C(b)&&p.call(b)==n}function E(b){if(typeof b=="number")return b;if(S(b))return t;if(y(b)){var x=typeof b.valueOf=="function"?b.valueOf():b;b=y(x)?x+"":x}if(typeof b!="string")return b===0?b:+b;b=b.replace(r,"");var T=s.test(b);return T||i.test(b)?a(b.slice(2),T?2:8):o.test(b)?t:+b}return _c=v,_c}M1();function A1(e=!1){if(typeof e!="boolean")throw new Error("defaultValue must be `true` or `false`");const[t,n]=oe.useState(e),r=oe.useCallback(()=>{n(!0)},[]),o=oe.useCallback(()=>{n(!1)},[]),s=oe.useCallback(()=>{n(i=>!i)},[]);return{value:t,setValue:n,setTrue:r,setFalse:o,toggle:s}}var Yp=typeof window<"u"?oe.useLayoutEffect:oe.useEffect;function D1(e){const[t,n]=oe.useState(e),r=oe.useCallback(()=>{n(i=>i+1)},[]),o=oe.useCallback(()=>{n(i=>i-1)},[]),s=oe.useCallback(()=>{n(e)},[e]);return{count:t,increment:r,decrement:o,reset:s,setCount:n}}function L1(e,t){const n=oe.useRef(e);Yp(()=>{n.current=e},[e]),oe.useEffect(()=>{if(t===null)return;const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}function F1({countStart:e,countStop:t=0,intervalMs:n=1e3,isIncrement:r=!1}){const{count:o,increment:s,decrement:i,reset:a}=D1(e),{value:c,setTrue:u,setFalse:l}=A1(!1),d=oe.useCallback(()=>{l(),a()},[l,a]),p=oe.useCallback(()=>{if(o===t){l();return}r?s():i()},[o,t,i,s,r,l]);return L1(p,c?n:null),[o,{startCountdown:u,stopCountdown:l,resetCountdown:d}]}var V1=typeof window>"u";function z1(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const r=a=>V1?t:window.matchMedia(a).matches,[o,s]=oe.useState(()=>n?r(e):t);function i(){s(r(e))}return Yp(()=>{const a=window.matchMedia(e);return i(),a.addListener?a.addListener(i):a.addEventListener("change",i),()=>{a.removeListener?a.removeListener(i):a.removeEventListener("change",i)}},[e]),o}function Xp({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,zIndex:a,classNames:c}){return z1("(min-width: 1024px)")?w.jsxs(Wa,{open:o,onOpenChange:i,disablePointerDismissal:!0,children:[e&&w.jsx(zs,{className:c?.trigger,children:e}),w.jsxs(Fs,{children:[w.jsx(Za,{style:{zIndex:a},className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),w.jsxs(Ka,{style:{zIndex:a},className:fr("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",c?.desktopPopup),children:[t&&w.jsx(Vs,{className:fr("-mt-1.5 mb-1 text-lg font-medium",c?.title),children:t}),n&&w.jsx(Ya,{className:fr("mb-6 text-base text-gray-600",c?.description),children:n}),s&&w.jsx(Ga,{className:"absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",children:w.jsx(Bp,{})}),w.jsx("div",{children:r})]})]})]}):w.jsxs(yE,{open:o,onOpenChange:i,children:[e&&w.jsx(kE,{className:c?.trigger,children:e}),w.jsxs(gE,{children:[w.jsx(Df,{style:{zIndex:a},className:fr("fixed inset-0 bg-black/70 transition-opacity duration-300 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",c?.backdrop)}),w.jsx(ep,{style:{zIndex:a},className:"fixed inset-0 z-[991]",children:w.jsx(Uf,{className:fr("fixed bottom-0 left-0 right-0 rounded-t-xl bg-white p-4 transition-transform duration-300 data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full","[transform:translateY(var(--drawer-swipe-movement-y))]",c?.mobilePopup),children:w.jsxs(Ff,{children:[w.jsx("div",{"aria-hidden":!0,className:"mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-4"}),w.jsx(IE,{className:"sr-only",children:t}),w.jsx("div",{children:r})]})})})]})]})}function qp({checked:e,onChange:t}){const[n,r]=oe.useState(!1),[o,s]=oe.useState(!1);return w.jsxs("div",{children:[w.jsx(Xp,{title:"用户协议",open:n,onOpenChange:r,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:w.jsx("iframe",{src:"https://www.gatribe.com/license-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),w.jsx(Xp,{title:"隐私政策",open:o,onOpenChange:s,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:w.jsx("iframe",{src:"https://www.gatribe.com/privacy-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),w.jsx(Wr,{name:"rememberLogin",children:w.jsxs(gc,{className:"flex items-center justify-center text-gray-500 text-xs md:text-sm",children:[w.jsx(sc,{checked:e,className:"size-4 md:size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-[var(--jssdk-input-border-color)]",onCheckedChange:i=>t(!!i),children:w.jsx(ic,{children:w.jsx(Pc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),w.jsx("span",{className:"ml-2",children:"我已详细阅读并同意"}),w.jsx(Rt,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>r(!0),type:"button",children:"《用户协议》"}),w.jsx("span",{children:"及"}),w.jsx(Rt,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>s(!0),type:"button",children:"《隐私政策》"})]})})]})}function Po({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,disablePointerDismissal:a=!1,classNames:c}){return w.jsxs(Wa,{open:o,onOpenChange:i,disablePointerDismissal:a,children:[e&&w.jsx(zs,{className:c?.trigger,children:e}),w.jsxs(Fs,{children:[w.jsx(Za,{className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",forceRender:!0}),w.jsxs(Ka,{className:St("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[990]",c?.popup),children:[t&&w.jsx(Vs,{className:St("-mt-1.5 mb-1 text-lg font-medium",c?.title),children:t}),n&&w.jsx(Ya,{className:St("mb-6 text-base text-gray-600",c?.description),children:n}),s&&w.jsx(Ga,{className:St("absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",c?.close),children:w.jsx(Bp,{})}),w.jsx("div",{children:r})]})]})]})}function Tn({name:e,prefix:t,suffix:n,className:r,inputClassName:o,error:s,...i}){return w.jsxs(Wr,{name:e,className:"group",children:[w.jsxs("div",{className:St("flex items-center border border-[var(--jssdk-input-border-color)] group-data-[focused]:border-[var(--jssdk-primary-color)] group-data-[focused]:shadow-[0_0_6px_color-mix(in_srgb,var(--jssdk-primary-color),transparent_80%)] rounded-full bg-white px-3 gap-2 h-12 transition-all duration-200",s&&"border-red-500",r),children:[t,w.jsx(Gs,{className:St("flex-1 w-0 outline-none rounded-full h-full pl-1",o),...i}),n]}),w.jsx(Zs,{className:"text-red-500 text-xs mt-1 ml-3"})]})}function $1({account:e,forgetPasswordKey:t,onSuccess:n}){const[r,o]=oe.useState(""),[s,i]=oe.useState(!1),{mutate:a,isPending:c}=sn({mutationFn:()=>_1({account:e,forget_password_key:t,password:r}),onSuccess:l=>{l?.code===0||!l?.error?n():gt.warning(l.detail||l.error||"重置失败")}}),u=()=>{if(!r){gt.warning("请输入新密码");return}if(r.length<6||r.length>18){gt.warning("密码长度需要在6-18位之间");return}a()};return w.jsxs("div",{className:"space-y-4",children:[w.jsx("div",{className:"text-sm text-gray-500 mb-4 text-center",children:"请设置新的登录密码"}),w.jsx(Tn,{name:"password",type:s?"text":"password",autoComplete:"off",inputClassName:"placeholder:text-sm",placeholder:"请输入6-18位由数字、字母组成的密码",value:r,autoFocus:!0,onValueChange:l=>o(l),suffix:w.jsx(Rt,{onClick:()=>i(!s),type:"button",children:s?w.jsx(Up,{className:"size-5 text-gray-400"}):w.jsx(Hp,{className:"size-5 text-gray-400"})})}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:u,disabled:!r||c,children:c?"重置中...":"确定修改"})]})}var j1=function(e){return typeof e=="number"};function H1(e){var t=oe.useRef(e);return t.current=e,t}var ei={exports:{}},U1=ei.exports,Kp;function B1(){return Kp||(Kp=1,(function(e,t){(function(n,r){e.exports=r()})(U1,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",i="second",a="minute",c="hour",u="day",l="week",d="month",p="quarter",h="year",m="date",g="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var O=["th","st","nd","rd"],k=N%100;return"["+N+(O[(k-20)%10]||O[k]||O[0])+"]"}},S=function(N,O,k){var _=String(N);return!_||_.length>=O?N:""+Array(O+1-_.length).join(k)+N},E={s:S,z:function(N){var O=-N.utcOffset(),k=Math.abs(O),_=Math.floor(k/60),M=k%60;return(O<=0?"+":"-")+S(_,2,"0")+":"+S(M,2,"0")},m:function N(O,k){if(O.date()<k.date())return-N(k,O);var _=12*(k.year()-O.year())+(k.month()-O.month()),M=O.clone().add(_,d),A=k-M<0,j=O.clone().add(_+(A?-1:1),d);return+(-(_+(k-M)/(A?M-j:j-M))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:d,y:h,w:l,d:u,D:m,h:c,m:a,s:i,ms:s,Q:p}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},b="en",x={};x[b]=C;var T="$isDayjsObject",P=function(N){return N instanceof $||!(!N||!N[T])},z=function N(O,k,_){var M;if(!O)return b;if(typeof O=="string"){var A=O.toLowerCase();x[A]&&(M=A),k&&(x[A]=k,M=A);var j=O.split("-");if(!M&&j.length>1)return N(j[0])}else{var B=O.name;x[B]=O,M=B}return!_&&M&&(b=M),M||!_&&b},I=function(N,O){if(P(N))return N.clone();var k=typeof O=="object"?O:{};return k.date=N,k.args=arguments,new $(k)},D=E;D.l=z,D.i=P,D.w=function(N,O){return I(N,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var $=(function(){function N(k){this.$L=z(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[T]=!0}var O=N.prototype;return O.parse=function(k){this.$d=(function(_){var M=_.date,A=_.utc;if(M===null)return new Date(NaN);if(D.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var j=M.match(v);if(j){var B=j[2]-1||0,U=(j[7]||"0").substring(0,3);return A?new Date(Date.UTC(j[1],B,j[3]||1,j[4]||0,j[5]||0,j[6]||0,U)):new Date(j[1],B,j[3]||1,j[4]||0,j[5]||0,j[6]||0,U)}}return new Date(M)})(k),this.init()},O.init=function(){var k=this.$d;this.$y=k.getFullYear(),this.$M=k.getMonth(),this.$D=k.getDate(),this.$W=k.getDay(),this.$H=k.getHours(),this.$m=k.getMinutes(),this.$s=k.getSeconds(),this.$ms=k.getMilliseconds()},O.$utils=function(){return D},O.isValid=function(){return this.$d.toString()!==g},O.isSame=function(k,_){var M=I(k);return this.startOf(_)<=M&&M<=this.endOf(_)},O.isAfter=function(k,_){return I(k)<this.startOf(_)},O.isBefore=function(k,_){return this.endOf(_)<I(k)},O.$g=function(k,_,M){return D.u(k)?this[_]:this.set(M,k)},O.unix=function(){return Math.floor(this.valueOf()/1e3)},O.valueOf=function(){return this.$d.getTime()},O.startOf=function(k,_){var M=this,A=!!D.u(_)||_,j=D.p(k),B=function(se,ae){var pe=D.w(M.$u?Date.UTC(M.$y,ae,se):new Date(M.$y,ae,se),M);return A?pe:pe.endOf(u)},U=function(se,ae){return D.w(M.toDate()[se].apply(M.toDate("s"),(A?[0,0,0,0]:[23,59,59,999]).slice(ae)),M)},W=this.$W,G=this.$M,Z=this.$D,X="set"+(this.$u?"UTC":"");switch(j){case h:return A?B(1,0):B(31,11);case d:return A?B(1,G):B(0,G+1);case l:var K=this.$locale().weekStart||0,J=(W<K?W+7:W)-K;return B(A?Z-J:Z+(6-J),G);case u:case m:return U(X+"Hours",0);case c:return U(X+"Minutes",1);case a:return U(X+"Seconds",2);case i:return U(X+"Milliseconds",3);default:return this.clone()}},O.endOf=function(k){return this.startOf(k,!1)},O.$set=function(k,_){var M,A=D.p(k),j="set"+(this.$u?"UTC":""),B=(M={},M[u]=j+"Date",M[m]=j+"Date",M[d]=j+"Month",M[h]=j+"FullYear",M[c]=j+"Hours",M[a]=j+"Minutes",M[i]=j+"Seconds",M[s]=j+"Milliseconds",M)[A],U=A===u?this.$D+(_-this.$W):_;if(A===d||A===h){var W=this.clone().set(m,1);W.$d[B](U),W.init(),this.$d=W.set(m,Math.min(this.$D,W.daysInMonth())).$d}else B&&this.$d[B](U);return this.init(),this},O.set=function(k,_){return this.clone().$set(k,_)},O.get=function(k){return this[D.p(k)]()},O.add=function(k,_){var M,A=this;k=Number(k);var j=D.p(_),B=function(G){var Z=I(A);return D.w(Z.date(Z.date()+Math.round(G*k)),A)};if(j===d)return this.set(d,this.$M+k);if(j===h)return this.set(h,this.$y+k);if(j===u)return B(1);if(j===l)return B(7);var U=(M={},M[a]=r,M[c]=o,M[i]=n,M)[j]||1,W=this.$d.getTime()+k*U;return D.w(W,this)},O.subtract=function(k,_){return this.add(-1*k,_)},O.format=function(k){var _=this,M=this.$locale();if(!this.isValid())return M.invalidDate||g;var A=k||"YYYY-MM-DDTHH:mm:ssZ",j=D.z(this),B=this.$H,U=this.$m,W=this.$M,G=M.weekdays,Z=M.months,X=M.meridiem,K=function(ae,pe,Y,me){return ae&&(ae[pe]||ae(_,A))||Y[pe].slice(0,me)},J=function(ae){return D.s(B%12||12,ae,"0")},se=X||function(ae,pe,Y){var me=ae<12?"AM":"PM";return Y?me.toLowerCase():me};return A.replace(y,(function(ae,pe){return pe||(function(Y){switch(Y){case"YY":return String(_.$y).slice(-2);case"YYYY":return D.s(_.$y,4,"0");case"M":return W+1;case"MM":return D.s(W+1,2,"0");case"MMM":return K(M.monthsShort,W,Z,3);case"MMMM":return K(Z,W);case"D":return _.$D;case"DD":return D.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return K(M.weekdaysMin,_.$W,G,2);case"ddd":return K(M.weekdaysShort,_.$W,G,3);case"dddd":return G[_.$W];case"H":return String(B);case"HH":return D.s(B,2,"0");case"h":return J(1);case"hh":return J(2);case"a":return se(B,U,!0);case"A":return se(B,U,!1);case"m":return String(U);case"mm":return D.s(U,2,"0");case"s":return String(_.$s);case"ss":return D.s(_.$s,2,"0");case"SSS":return D.s(_.$ms,3,"0");case"Z":return j}return null})(ae)||j.replace(":","")}))},O.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},O.diff=function(k,_,M){var A,j=this,B=D.p(_),U=I(k),W=(U.utcOffset()-this.utcOffset())*r,G=this-U,Z=function(){return D.m(j,U)};switch(B){case h:A=Z()/12;break;case d:A=Z();break;case p:A=Z()/3;break;case l:A=(G-W)/6048e5;break;case u:A=(G-W)/864e5;break;case c:A=G/o;break;case a:A=G/r;break;case i:A=G/n;break;default:A=G}return M?A:D.a(A)},O.daysInMonth=function(){return this.endOf(d).$D},O.$locale=function(){return x[this.$L]},O.locale=function(k,_){if(!k)return this.$L;var M=this.clone(),A=z(k,_,!0);return A&&(M.$L=A),M},O.clone=function(){return D.w(this.$d,this)},O.toDate=function(){return new Date(this.valueOf())},O.toJSON=function(){return this.isValid()?this.toISOString():null},O.toISOString=function(){return this.$d.toISOString()},O.toString=function(){return this.$d.toUTCString()},N})(),V=$.prototype;return I.prototype=V,[["$ms",s],["$s",i],["$m",a],["$H",c],["$W",u],["$M",d],["$y",h],["$D",m]].forEach((function(N){V[N[1]]=function(O){return this.$g(O,N[0],N[1])}})),I.extend=function(N,O){return N.$i||(N(O,$,I),N.$i=!0),I},I.locale=z,I.isDayjs=P,I.unix=function(N){return I(1e3*N)},I.en=x[b],I.Ls=x,I.p={},I}))})(ei)),ei.exports}var W1=B1();const Z1=zv(W1);var Ic=function(e){if(!e)return 0;var t=Z1(e).valueOf()-Date.now();return t<0?0:t},G1=function(e){return{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}},Jp=function(e){e===void 0&&(e={});var t=e||{},n=t.leftTime,r=t.targetDate,o=t.interval,s=o===void 0?1e3:o,i=t.onEnd,a=oe.useMemo(function(){return j1(n)&&n>0?Date.now()+n:void 0},[n]),c="leftTime"in e?a:r,u=Im(oe.useState(function(){return Ic(c)}),2),l=u[0],d=u[1],p=H1(i);oe.useEffect(function(){if(!c){d(0);return}d(Ic(c));var m=setInterval(function(){var g,v=Ic(c);d(v),v===0&&(clearInterval(m),(g=p.current)===null||g===void 0||g.call(p))},s);return function(){return clearInterval(m)}},[c,s]);var h=oe.useMemo(function(){return G1(l)},[l]);return[l,h]};function Y1({account:e,mobile:t,onNext:n}){const[r,o]=oe.useState(""),[s,i]=oe.useState(),[a]=Jp({leftTime:s?s*1e3:void 0,interval:1e3,onEnd(){i(void 0)}}),{mutate:c,isPending:u}=sn({mutationFn:()=>P1({account:e,type:"reset-password",is_voice:0,t:"ctoken"}),onSuccess:h=>{i(h.lock_time),gt.success("验证码已发送,请注意查收")}}),{mutate:l,isPending:d}=sn({mutationFn:()=>Zp({account:e,captcha:r,t:"reset-password"}),onSuccess:h=>{h?.forget_password_key?n(h.forget_password_key):gt.warning("安全验证失败")},onError:h=>{gt.warning(h?.message||h?.detail||"验证失败")}}),p=()=>{if(!r){gt.warning("请输入验证码");return}l()};return w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"请输入验证码,短信将发送至您的绑定手机"," ",w.jsx("span",{className:"font-semibold text-gray-700",children:t})]}),w.jsx(Tn,{name:"verificationCode",placeholder:"请输入验证码",value:r,type:"number",autoFocus:!0,onValueChange:h=>o(h),suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>c(),disabled:!!s||u,children:u?"发送中...":s?`${Math.round(a/1e3)}s 后重新获取`:"获取验证码"})}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:p,disabled:d,children:d?"验证中...":"下一步"})]})}function X1({account:e,onNext:t}){const[n,r]=oe.useState(""),{mutate:o,isPending:s}=sn({mutationFn:()=>Zp({account:e,idcard:n,t:"reset-password"}),onSuccess:a=>{a?.forget_password_key?t(a.forget_password_key):gt.warning("安全验证失败")}}),i=()=>{if(!n){gt.warning("请输入身份证号");return}o()};return w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"该账号未绑定手机,请输入注册时填写的身份证信息"]}),w.jsx(Tn,{name:"idCard",placeholder:"请输入身份证号",value:n,autoFocus:!0,onChange:a=>r(a.currentTarget.value)}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:i,disabled:s,children:s?"验证中...":"下一步"})]})}function q1({onClose:e,defaultAccount:t=""}){const[n,r]=oe.useState("account"),[o,s]=oe.useState(t),[i,a]=oe.useState(""),[c,u]=oe.useState(2),[l,d]=oe.useState(""),p=oe.useRef(null);oe.useEffect(()=>{if(!window.captchaZtgame){const y=document.createElement("script");y.type="text/javascript",y.src=`//nocaptcha.ztgame.com/static/verify2023/js/captcha.js?t=${new Date().getTime()}`,y.id="captchaZtgameScript",document.body.appendChild(y)}},[]);const{mutate:h,isPending:m}=sn({mutationFn:async y=>O1({account:o,nonce:y.nonce,token:y.token,type:y.type,t:"ctoken"}),onSuccess:y=>{const C=y.type;u(C),a(C===2?y.mobile:""),r("secure"),p.current?.onRefresh?.()},onError:y=>{gt.warning(y?.message||y?.detail||"验证失败"),p.current?.onRefresh?.()}}),g=()=>{if(!o){gt.warning("请输入账号信息");return}window.captchaZtgame?window.captchaZtgame.init({appsceneid:"pt_login",usertype:"1",el:"captcha-forget-pwd",mode:"popup",styles:{width:300,height:150,fontSize:"14px"},popupStyles:{position:"fixed",top:"30%",left:"50%",zIndex:"99999"},onSuccess(y,C){p.current=y,h({nonce:y.nonce,token:C.data.token,type:y.type})},onLoad(y){p.current=y,y.onVerify()},onFail(){}}):gt.warning("安全组件未加载,请稍后再试")},v=y=>{d(y),r("reset")};return w.jsxs("div",{className:"space-y-5",children:[w.jsx("div",{id:"captcha-forget-pwd"}),n==="account"&&w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"请输入您的账号信息"]}),w.jsx(Tn,{name:"account",placeholder:"请输入账号信息",autoFocus:!0,value:o,onChange:y=>s(y.currentTarget.value)}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:g,disabled:!o||m,children:m?"验证中...":"下一步"})]}),n==="secure"&&(c===2?w.jsx(Y1,{account:o,mobile:i,onNext:v}):w.jsx(X1,{account:o,onNext:v})),n==="reset"&&w.jsx($1,{account:o,forgetPasswordKey:l,onSuccess:()=>r("success")}),n==="success"&&w.jsxs("div",{className:"space-y-4 py-6",children:[w.jsx("div",{className:"text-center text-lg font-medium text-gray-800",children:"重置密码成功"}),w.jsx(Rt,{className:"mt-6 h-10 w-full bg-gray-100 text-gray-700 rounded-full hover:bg-gray-200",onClick:()=>e?.(),children:"返回登录"})]})]})}function K1(){const{gameId:e,onAccountLoginSuccess:t,onLoginSuccess:n,onLoginError:r,triggerRealNameAuth:o}=Dn(),s=oe.useRef(null),[i,a]=oe.useState(""),[c,u]=oe.useState(""),[l,d]=oe.useState(!1),[p,h]=oe.useState(!0),[m,g]=oe.useState(!1),{mutate:v,isPending:y}=sn({mutationFn:()=>S1({account:i,password:c}),onSuccess:S=>{const E={account:S.account,entity:S.channel_info.entity,token:S.channel_info.token,sign:S.channel_info.sign,accid:S.channel_info.entity.openid,extra_data:S.channel_info.extra_data,gaplaySign:S.channel_info.gaplaySign,realname:S.channel_info.realname};if(Ns(E,S._auth,e),E.realname&&E.realname.reject>=2){o();return}t?.(E),n?.(E)},onError:S=>{r?.(S)}});async function C(S){if(S.preventDefault(),!p){gt.warning("请先阅读并同意用户协议和隐私政策");return}if(!i||!c){gt.warning("请输入账号和密码");return}v()}return w.jsx(w.Fragment,{children:w.jsxs(To,{ref:s,onSubmit:C,className:"space-y-5",children:[w.jsx(Tn,{name:"account",placeholder:e==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:S=>a(S.currentTarget.value),prefix:e==="5327"?w.jsx(y1,{className:"size-5 text-gray-400"}):w.jsx(R1,{className:"size-5 text-gray-400"})}),w.jsx(Tn,{name:"password",type:l?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:c,onValueChange:S=>u(S),prefix:w.jsx(N1,{className:"size-5 text-gray-400"}),suffix:w.jsx(Rt,{onClick:()=>d(!l),type:"button",children:l?w.jsx(Up,{className:"size-5 text-gray-400"}):w.jsx(Hp,{className:"size-5 text-gray-400"})})}),w.jsxs("section",{children:[w.jsx("div",{className:"flex justify-end mb-1",children:w.jsx(Po,{title:"忘记密码",open:m,onOpenChange:g,trigger:w.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:w.jsx(q1,{onClose:()=>g(!1),defaultAccount:i})})}),w.jsx(Rt,{className:"h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",type:"submit",disabled:y,children:"登录"})]}),w.jsx(Qs,{}),w.jsx(qp,{checked:p,onChange:h})]})})}var Qp;function ee(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){const p=l[d];p in a||(a[p]=u[p].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Gr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eh extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Qp=globalThis).__zod_globalConfig??(Qp.__zod_globalConfig={});const kc=globalThis.__zod_globalConfig;function yr(e){return kc}function th(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Rc(e,t){return typeof t=="bigint"?t.toString():t}function Nc(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mc(e){return e==null}function Ac(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const nh=Symbol("evaluating");function ot(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==nh)return r===void 0&&(r=nh,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Jn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function rh(e){return JSON.stringify(e)}function J1(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const oh="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ti(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Q1=Nc(()=>{if(kc.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function _o(e){if(ti(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ti(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function sh(e){return _o(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const ex=new Set(["string","number","symbol"]);function ni(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ke(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function tx(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function nx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Jn(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return vr(this,"shape",i),i},checks:[]});return Qn(e,s)}function rx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Jn(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return vr(this,"shape",i),i},checks:[]});return Qn(e,s)}function ox(e,t){if(!_o(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Jn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return vr(this,"shape",s),s}});return Qn(e,o)}function sx(e,t){if(!_o(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Jn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vr(this,"shape",r),r}});return Qn(e,n)}function ix(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Jn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return vr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Qn(e,n)}function ax(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Jn(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return vr(this,"shape",c),c},checks:[]});return Qn(t,i)}function cx(e,t,n){const r=Jn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return vr(this,"shape",s),s}});return Qn(t,r)}function Yr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ux(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ih(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ri(e){return typeof e=="string"?e:e?.message}function br(e,t,n){const r=e.message?e.message:ri(e.inst?._zod.def?.error?.(e))??ri(t?.error?.(e))??ri(n.customError?.(e))??ri(n.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=i),a}function Dc(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Io(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ah=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Rc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ch=ee("$ZodError",ah),uh=ee("$ZodError",ah,{Parent:Error});function oi(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function lx(e,t=n=>n.message){const n={_errors:[]},r=(o,s=[])=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{const a=[...s,...i.path];if(a.length===0)n._errors.push(t(i));else{let c=n,u=0;for(;u<a.length;){const l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return r(e),n}const Lc=e=>(t,n,r,o)=>{const s=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Gr;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>br(c,s,yr())));throw oh(a,o?.callee),a}return i.value},Fc=e=>async(t,n,r,o)=>{const s=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>br(c,s,yr())));throw oh(a,o?.callee),a}return i.value},si=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Gr;return s.issues.length?{success:!1,error:new(e??ch)(s.issues.map(i=>br(i,o,yr())))}:{success:!0,data:s.value}},dx=si(uh),ii=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>br(i,o,yr())))}:{success:!0,data:s.value}},fx=ii(uh),px=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Lc(e)(t,n,o)},hx=e=>(t,n,r)=>Lc(e)(t,n,r),mx=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Fc(e)(t,n,o)},gx=e=>async(t,n,r)=>Fc(e)(t,n,r),yx=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return si(e)(t,n,o)},vx=e=>(t,n,r)=>si(e)(t,n,r),bx=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return ii(e)(t,n,o)},wx=e=>async(t,n,r)=>ii(e)(t,n,r),Sx=/^[cC][0-9a-z]{6,}$/,Ex=/^[0-9a-z]+$/,xx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cx=/^[0-9a-vA-V]{20}$/,Tx=/^[A-Za-z0-9]{27}$/,Ox=/^[a-zA-Z0-9_-]{21}$/,Px=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_x=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lh=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ix=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,kx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rx(){return new RegExp(kx,"u")}const Nx=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ax=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Dx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Lx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dh=/^[A-Za-z0-9_-]*$/,Fx=/^https?$/,Vx=/^\+[1-9]\d{6,14}$/,fh="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",zx=new RegExp(`^${fh}$`);function ph(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $x(e){return new RegExp(`^${ph(e)}$`)}function jx(e){const t=ph({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${fh}T(?:${r})$`)}const Hx=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ux=/^[^A-Z]*$/,Bx=/^[^a-z]*$/,On=ee("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Wx=ee("$ZodCheckMaxLength",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=Dc(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Zx=ee("$ZodCheckMinLength",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=Dc(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gx=ee("$ZodCheckLengthEquals",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Dc(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ai=ee("$ZodCheckStringFormat",(e,t)=>{var n,r;On.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Yx=ee("$ZodCheckRegex",(e,t)=>{ai.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xx=ee("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ux),ai.init(e,t)}),qx=ee("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Bx),ai.init(e,t)}),Kx=ee("$ZodCheckIncludes",(e,t)=>{On.init(e,t);const n=ni(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Jx=ee("$ZodCheckStartsWith",(e,t)=>{On.init(e,t);const n=new RegExp(`^${ni(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Qx=ee("$ZodCheckEndsWith",(e,t)=>{On.init(e,t);const n=new RegExp(`.*${ni(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),eC=ee("$ZodCheckOverwrite",(e,t)=>{On.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class tC{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
19
+ `))):T&&(P=[T],b.setCustomValidity(T))):D&&(b.setCustomValidity(""),z.customError=!1,b.validationMessage?(I=b.validationMessage,P=[b.validationMessage]):b.validity.valid&&!z.valid&&(z.valid=!0))}const $={value:S,state:z,error:I??(Array.isArray(T)?T[0]:T??""),errors:P,initialValue:s.initialValue};if(p){const V=t.current.fields.get(p);V&&t.current.fields.set(p,{...V,...Bs($,a)})}r($)}),y=f.useCallback((S={})=>En(h,u.valid===!1?{"aria-invalid":!0}:mt,S),[h,u.valid]),C=f.useCallback((S={})=>En({onChange(E){if(E.nativeEvent.defaultPrevented)return;if(n(l),!d()){v(E.currentTarget.value,!0);return}const b=E.currentTarget;if(b.value===""){v(b.value);return}m.clear(),i?m.start(i,()=>{v(b.value)}):v(b.value)}},y(S)),[y,n,l,m,v,i,d]);return f.useMemo(()=>({getValidationProps:y,getInputValidationProps:C,inputRef:g,commit:v}),[y,C,v])}function BE(e){const{commit:t,invalid:n,markedDirtyRef:r,name:o,setValidityData:s,validityData:i}=e,{formRef:a}=Ur(),c=f.useRef(null),u=f.useRef(null),l=f.useRef(null),d=ie(()=>{const v=u.current;if(v)return v.getValue?v.getValue():v.value}),p=ie((v=!0)=>{const y=u.current;if(!y)return;let C=y.value;C===void 0&&(C=d()),r.current=!0,v?Kt.flushSync(()=>t(C)):t(C)});function h(){const v=u.current;!v||!v.id||a.current.fields.set(v.id,{getValue:d,name:o,controlRef:v.controlRef??l,validityData:Bs(i,n),validate:p})}function m(v=u.current?.id){v&&a.current.fields.delete(v)}function g(){const v=u.current;if(!v)return;let y=v.value;y===void 0&&(y=d()),i.initialValue===null&&y!==null&&s(C=>({...C,initialValue:y}))}return he(()=>{const v=u.current;!v||!v.id||a.current.fields.set(v.id,{getValue:d,name:o,controlRef:v.controlRef??l,validityData:Bs(i,n),validate:p})},[a,d,n,o,p,i]),he(()=>{const v=a.current.fields;return()=>{const y=u.current?.id;y&&v.delete(y)}},[a]),ie((v,y)=>{if(!y){c.current===v&&(c.current=null,m(),u.current=null);return}const C=u.current?.id;c.current=v,u.current=y,C&&C!==y.id&&m(C),g(),h()})}const fp=f.forwardRef(function(t,n){const{errors:r,validationMode:o,submitAttemptedRef:s}=Ur(),{render:i,className:a,validate:c,validationDebounceTime:u=0,validationMode:l=o,name:d,disabled:p=!1,invalid:h,dirty:m,touched:g,actionsRef:v,style:y,...C}=t,{disabled:S}=jE(),E=ie(c||(()=>null)),b=S||p,[x,T]=f.useState(!1),[P,z]=f.useState(!1),[I,D]=f.useState(!1),[$,V]=f.useState(!1),N=m??P,O=g??x,k=f.useRef(!1),_=ie(pe=>{m===void 0&&(pe&&(k.current=!0),z(pe))}),M=ie(pe=>{g===void 0&&T(pe)}),A=ie(()=>l==="onChange"||l==="onSubmit"&&s.current),j=!!d&&Object.hasOwn(r,d)&&r[d]!==void 0,B=h===!0||j,[U,W]=f.useState({state:$s,error:"",errors:[],value:null,initialValue:null}),G=!B&&U.state.valid,Z=f.useMemo(()=>({disabled:b,touched:O,dirty:N,valid:G,filled:I,focused:$}),[b,O,N,G,I,$]),X=UE({setValidityData:W,validate:E,validityData:U,validationDebounceTime:u,invalid:B,markedDirtyRef:k,state:Z,name:d,shouldValidateOnChange:A}),K=f.useCallback(()=>{k.current=!0,X.commit(U.value)},[X,U]),J=BE({commit:X.commit,invalid:B,markedDirtyRef:k,name:d,setValidityData:W,validityData:U});f.useImperativeHandle(v,()=>({validate:K}),[K]);const se=f.useMemo(()=>({invalid:B,name:d,validityData:U,setValidityData:W,disabled:b,touched:O,setTouched:M,dirty:N,setDirty:_,filled:I,setFilled:D,focused:$,setFocused:V,validate:E,validationMode:l,validationDebounceTime:u,shouldValidateOnChange:A,state:Z,markedDirtyRef:k,registerFieldControl:J,validation:X}),[B,d,U,b,O,M,N,_,I,D,$,V,E,l,u,A,Z,J,X]),ae=qe("div",t,{ref:n,state:Z,props:C,stateAttributesMapping:hr});return w.jsx(Qa.Provider,{value:se,children:ae})});process.env.NODE_ENV!=="production"&&(fp.displayName="FieldRootInner");const Wr=f.forwardRef(function(t,n){return w.jsx(dp,{children:w.jsx(fp,{...t,ref:n})})});process.env.NODE_ENV!=="production"&&(Wr.displayName="FieldRoot");const gc=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,nativeLabel:a=!0,...c}=t,u=mr(!1),{labelId:l}=Ln(),d=f.useRef(null),p=sE({id:l??i,native:a});return process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!d.current)return;const m=d.current.tagName==="LABEL";if(a){if(!m){const g=Dr.captureOwnerStack?.()||"";ar(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${g}`)}}else if(m){const g=Dr.captureOwnerStack?.()||"";ar(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${g}`)}},[a]),qe("label",t,{ref:[n,d],state:u.state,props:[p,c],stateAttributesMapping:hr})});process.env.NODE_ENV!=="production"&&(gc.displayName="FieldLabel");const WE={...hr,...tn},Zs=f.forwardRef(function(t,n){const{render:r,id:o,className:s,match:i,style:a,...c}=t,u=qt(o),{validityData:l,state:d,name:p}=mr(!1),{setMessageIds:h}=Ln(),{errors:m}=Ur(),g=p?m[p]:null,v=typeof i=="string";let y=!1;i===!0?y=!0:v?y=!!l.state[i]:y=!!g||l.state.valid===!1;const{mounted:C,transitionStatus:S,setMounted:E}=vo(y);he(()=>{if(!(!y||!u))return h(O=>O.concat(u)),()=>{h(O=>O.filter(k=>k!==u))}},[y,u,h]);const b=f.useRef(null),[x,T]=f.useState(null),[P,z]=f.useState(null),I=l.errors.length>1?w.jsx("ul",{children:l.errors.map(O=>w.jsx("li",{children:O},O))}):l.error,D=v?I:g||I;let $=l.error;g!=null?$=Array.isArray(g)?JSON.stringify(g):g:l.errors.length>1&&($=JSON.stringify(l.errors)),y&&$!==P&&(z($),T(D)),xn({open:y,ref:b,onComplete(){y||E(!1)}});const V={...d,transitionStatus:S},N=qe("div",t,{ref:[n,b],state:V,props:[{id:u,children:y?D:x},c],stateAttributesMapping:WE,enabled:C});return C?N:null});process.env.NODE_ENV!=="production"&&(Zs.displayName="FieldError");const Gs=f.forwardRef(function(t,n){const{render:r,className:o,id:s,name:i,value:a,disabled:c=!1,onValueChange:u,defaultValue:l,autoFocus:d=!1,style:p,...h}=t,{state:m,name:g,disabled:v,setTouched:y,setDirty:C,validityData:S,setFocused:E,setFilled:b,validationMode:x,validation:T}=mr(),P=v||c,z=g??i,I={...m,disabled:P},{labelId:D}=Ln(),$=rc({id:s});he(()=>{const A=a!=null;T.inputRef.current?.value||A&&a!==""?b(!0):A&&a===""&&b(!1)},[T.inputRef,b,a]);const V=f.useRef(null);he(()=>{d&&V.current===Pt(Ie(V.current))&&E(!0)},[d,E]);const[N]=Eo({controlled:a,default:l,name:"FieldControl",state:"value"}),O=a!==void 0,k=O?N:void 0,_=ie(()=>T.inputRef.current?.value);return ec(T.inputRef,{id:$,value:k,getValue:_}),qe("input",t,{ref:[n,V],state:I,props:[{id:$,disabled:P,name:z,ref:T.inputRef,"aria-labelledby":D,autoFocus:d,...O?{value:k}:{defaultValue:l},onChange(A){const j=A.currentTarget.value;u?.(j,Ae(cr,A.nativeEvent)),C(j!==S.initialValue),b(j!=="")},onFocus(){E(!0)},onBlur(A){y(!0),E(!1),x==="onBlur"&&T.commit(A.currentTarget.value)},onKeyDown(A){A.currentTarget.tagName==="INPUT"&&A.key==="Enter"&&(y(!0),T.commit(A.currentTarget.value))}},T.getInputValidationProps(),h],stateAttributesMapping:hr})});process.env.NODE_ENV!=="production"&&(Gs.displayName="FieldControl");const To=f.forwardRef(function(t,n){const{render:r,className:o,validationMode:s="onSubmit",errors:i,onSubmit:a,onFormSubmit:c,actionsRef:u,style:l,...d}=t,p=f.useRef({fields:new Map}),h=f.useRef(!1),m=f.useRef(!1),g=ie(x=>{x&&(x.focus(),x.tagName==="INPUT"&&x.select())}),[v,y]=f.useState(i);As(i,()=>{y(i)}),f.useEffect(()=>{if(!h.current)return;h.current=!1;const x=Array.from(p.current.fields.values()).filter(T=>T.validityData.state.valid===!1);x.length&&g(x[0].controlRef.current)},[v,g]);const C=f.useCallback(x=>{const T=Array.from(p.current.fields.values());if(x){const P=T.find(z=>z.name===x);P&&P.validate(!1)}else T.forEach(P=>{P.validate(!1)})},[]);f.useImperativeHandle(u,()=>({validate:C}),[C]);const S=qe("form",t,{ref:n,props:[{noValidate:!0,onSubmit(x){m.current=!0;let T=Array.from(p.current.fields.values());T.forEach(z=>{z.validate()}),T=Array.from(p.current.fields.values());const P=T.filter(z=>!z.validityData.state.valid);if(P.length)x.preventDefault(),g(P[0].controlRef.current);else if(h.current=!0,a?.(x),c){x.preventDefault();const z=T.reduce((I,D)=>(D.name&&(I[D.name]=D.getValue()),I),{});c(z,_0(cr,x.nativeEvent))}}},d]}),E=ie(x=>{if(x&&v&&mt.hasOwnProperty.call(v,x)){const T={...v};delete T[x],y(T)}}),b=f.useMemo(()=>({formRef:p,validationMode:s,errors:v??mt,clearErrors:E,submitAttemptedRef:m}),[p,s,v,E]);return w.jsx(tc.Provider,{value:b,children:S})});process.env.NODE_ENV!=="production"&&(To.displayName="Form");const yc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(yc.displayName="PopoverRootContext");function Vn(e){const t=f.useContext(yc);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.":ft(47));return t}function ZE(){return{...Nd(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const GE={...Md,disabled:de(e=>e.disabled),instantType:de(e=>e.instantType),openMethod:de(e=>e.openMethod),openChangeReason:de(e=>e.openChangeReason),modal:de(e=>e.modal),focusManagerModal:de(e=>e.focusManagerModal),stickIfOpen:de(e=>e.stickIfOpen),titleElementId:de(e=>e.titleElementId),descriptionElementId:de(e=>e.descriptionElementId),openOnHover:de(e=>e.openOnHover),closeDelay:de(e=>e.closeDelay),hasViewport:de(e=>e.hasViewport)};class vc extends Wo{constructor(t){const n={...ZE(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:f.createRef(),beforeContentFocusGuardRef:f.createRef(),stickIfOpenTimeout:new Zt,triggerElements:new bs},GE)}setOpen=(t,n)=>{const r=n.reason===Lt,o=n.reason===Fr&&n.event.detail===0,s=!t&&(n.reason===ed||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const i=()=>{const a={open:t,openChangeReason:n.reason},c=n.trigger?.id??null;(c||t)&&(a.activeTriggerId=c,a.activeTriggerElement=n.trigger??null),this.update(a)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(i0,()=>{this.set("stickIfOpen",!1)}),Kt.flushSync(i)):i(),o||s?this.set("instantType",o?"click":"dismiss"):n.reason===ur?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const r=wt(()=>new vc(n)).current,o=t??r;return so(r.disposeEffect),o}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function pp({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,modal:i=!1,handle:a,triggerId:c,defaultTriggerId:u=null}=e,l=vc.useStore(a?.store,{modal:i,open:r,openProp:n,activeTriggerId:u,triggerIdProp:c});ja(()=>{n===void 0&&l.state.open===!1&&r===!0&&l.update({open:!0,activeTriggerId:u})}),l.useControlledProp("openProp",n),l.useControlledProp("triggerIdProp",c);const d=l.useState("open"),p=l.useState("payload");l.useContextCallback("onOpenChange",o),l.useContextCallback("onOpenChangeComplete",s);const{openMethod:h,triggerProps:m}=Ha(d);kd(l);const{forceUnmount:g}=Rd(d,l,()=>{l.update({stickIfOpen:!0,openChangeReason:null})});f.useEffect(()=>{d||l.context.stickIfOpenTimeout.clear()},[l,d]);const v=f.useCallback(()=>{l.setOpen(!1,Ae(td))},[l]);f.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:v}),[g,v]);const y=Dd({popupStore:l,onOpenChange:l.setOpen}),C=ka(y,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),S=zd(y),{getReferenceProps:E,getFloatingProps:b,getTriggerProps:x}=bo([C,S]),T=f.useMemo(()=>E(m),[E,m]),P=f.useMemo(()=>x(m),[x,m]),z=f.useMemo(()=>b(),[b]);l.useSyncedValues({modal:i,openMethod:h,activeTriggerProps:T,inactiveTriggerProps:P,popupProps:z,floatingRootContext:y,nested:qn()!=null});const I=f.useMemo(()=>({store:l}),[l]);return w.jsx(yc.Provider,{value:I,children:typeof t=="function"?t({payload:p}):t})}function YE(e){return Vn(!0)?w.jsx(pp,{props:e}):w.jsx(L0,{children:w.jsx(pp,{props:e})})}const XE=300,hp=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,handle:a,payload:c,openOnHover:u=!1,delay:l=XE,closeDelay:d=0,id:p,style:h,...m}=t,g=Vn(!0),v=a?.store??g?.store;if(!v)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle.":ft(74));const y=qt(p),C=v.useState("isTriggerActive",y),S=v.useState("floatingRootContext"),E=v.useState("isOpenedByTrigger",y),b=f.useRef(null),{registerTrigger:x,isMountedByThisTrigger:T}=Id(y,b,v,{payload:c,disabled:s,openOnHover:u,closeDelay:d}),P=v.useState("openChangeReason"),z=v.useState("stickIfOpen"),I=v.useState("openMethod"),D=v.useState("focusManagerModal"),$=Dw(S,{enabled:S!=null&&u&&(I!=="touch"||P!==Fr),mouseOnly:!0,move:!1,handleClose:Bw(),restMs:l,delay:{close:d},triggerElementRef:b,isActiveTrigger:C,isClosing:()=>v.select("transitionStatus")==="ending"}),V=Ia(S,{enabled:S!=null,stickIfOpen:z}),N=bo([V]),O=v.useState("triggerProps",T),k={disabled:s,open:E},{getButtonProps:_,buttonRef:M}=Lr({disabled:s,native:i}),A=f.useMemo(()=>({open(G){return G&&P===Fr?Xd.open(G):Yd.open(G)}}),[P]),j=qe("button",t,{state:k,ref:[M,n,x,b],props:[N.getReferenceProps(),$,O,{[ha]:"",id:y},m,_],stateAttributesMapping:A}),{preFocusGuardRef:B,handlePreFocusGuardFocus:U,handleFocusTargetFocus:W}=aE(v,b);return C&&!D?w.jsxs(f.Fragment,{children:[w.jsx(Sn,{ref:B,onFocus:U}),w.jsx(f.Fragment,{children:j},y),w.jsx(Sn,{ref:v.context.triggerFocusTargetRef,onFocus:W})]}):w.jsx(f.Fragment,{children:j},y)});process.env.NODE_ENV!=="production"&&(hp.displayName="PopoverTrigger");const bc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(bc.displayName="PopoverPortalContext");function qE(){const e=f.useContext(bc);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Portal> is missing.":ft(45));return e}const mp=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Vn();return s.useState("mounted")||r?w.jsx(bc.Provider,{value:r,children:w.jsx(hs,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(mp.displayName="PopoverPortal");const wc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(wc.displayName="PopoverPositionerContext");function gp(){const e=f.useContext(wc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.":ft(46));return e}const yp=f.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="bottom",align:c="center",sideOffset:u=0,alignOffset:l=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:h=5,sticky:m=!1,disableAnchorTracking:g=!1,collisionAvoidance:v=f0,style:y,...C}=t,{store:S}=Vn(),E=qE(),b=A0(),x=S.useState("floatingRootContext"),T=S.useState("mounted"),P=S.useState("open"),z=S.useState("openChangeReason"),I=S.useState("activeTriggerElement"),D=S.useState("modal"),$=S.useState("openMethod"),V=S.useState("positionerElement"),N=S.useState("instantType"),O=S.useState("transitionStatus"),k=S.useState("hasViewport"),_=f.useRef(null),M=Bl(V,!1,!1),A=Zd({anchor:s,floatingRootContext:x,positionMethod:i,mounted:T,side:a,sideOffset:u,align:c,alignOffset:l,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:m,disableAnchorTracking:g,keepMounted:E,nodeId:b,collisionAvoidance:v,adaptiveOrigin:k?Xw:void 0}),j=x.useState("domReferenceElement");he(()=>{const G=j,Z=_.current;if(G&&(_.current=G),Z&&G&&G!==Z){S.set("instantType",void 0);const X=new AbortController;return M(()=>{S.set("instantType","trigger-change")},X.signal),()=>{X.abort()}}},[j,M,S]);const B={open:P,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:N};Pf(P&&D===!0&&z!==Lt,$==="touch",V,I);const U=f.useCallback(G=>{S.set("positionerElement",G)},[S]),W=qd(t,B,{styles:A.positionerStyles,transitionStatus:O,props:C,refs:[n,U],hidden:!T,inert:!P});return w.jsxs(wc.Provider,{value:A,children:[T&&D===!0&&z!==Lt&&w.jsx(Ls,{ref:S.context.internalBackdropRef,inert:cs(!P),cutout:I}),w.jsx(D0,{id:b,children:W})]})});process.env.NODE_ENV!=="production"&&(yp.displayName="PopoverPositioner");const vp=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(vp.displayName="ClosePartContext");function KE(){const[e,t]=f.useState(0),n=ie(()=>(t(o=>o+1),()=>{t(o=>Math.max(0,o-1))}));return{context:f.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function JE(e){const{value:t,children:n}=e;return w.jsx(vp.Provider,{value:t,children:n})}const QE={...Cn,...tn},bp=f.forwardRef(function(t,n){const{className:r,render:o,initialFocus:s,finalFocus:i,style:a,...c}=t,{store:u}=Vn(),l=gp(),d=Mf()!=null,{context:p,hasClosePart:h}=KE(),m=u.useState("open"),g=u.useState("openMethod"),v=u.useState("instantType"),y=u.useState("transitionStatus"),C=u.useState("popupProps"),S=u.useState("titleElementId"),E=u.useState("descriptionElementId"),b=u.useState("modal"),x=u.useState("mounted"),T=u.useState("openChangeReason"),P=u.useState("activeTriggerElement"),z=u.useState("floatingRootContext");xn({open:m,ref:u.context.popupRef,onComplete(){m&&u.context.onOpenChangeComplete?.(!0)}});const I=u.useState("disabled"),D=u.useState("openOnHover"),$=u.useState("closeDelay");Mw(z,{enabled:D&&!I,closeDelay:$});function V(A){return A==="touch"?u.context.popupRef.current:!0}const N=s===void 0?V:s,O={open:m,side:l.side,align:l.align,instant:v,transitionStatus:y},k=b!==!1&&h;u.useSyncedValue("focusManagerModal",k);const _=f.useCallback(A=>{u.set("popupElement",A)},[u]),M=qe("div",t,{state:O,ref:[n,u.context.popupRef,_],props:[C,{"aria-labelledby":S,"aria-describedby":E,onKeyDown(A){d&&Ms.has(A.key)&&A.stopPropagation()}},Va(y),c],stateAttributesMapping:QE});return w.jsx(ms,{context:z,openInteractionType:g,modal:k,disabled:!x||T===Lt,initialFocus:N,returnFocus:i,restoreFocus:"popup",previousFocusableElement:it(P)?P:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:w.jsx(JE,{value:p,children:M})})});process.env.NODE_ENV!=="production"&&(bp.displayName="PopoverPopup");const wp=f.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,{store:a}=Vn(),c=a.useState("open"),{arrowRef:u,side:l,align:d,arrowUncentered:p,arrowStyles:h}=gp();return qe("div",t,{state:{open:c,side:l,align:d,uncentered:p},ref:[n,u],props:[{style:h,"aria-hidden":!0},i],stateAttributesMapping:Cn})});process.env.NODE_ENV!=="production"&&(wp.displayName="PopoverArrow");const e1={...Cn,...tn},Sp=f.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,{store:a}=Vn(),c=a.useState("open"),u=a.useState("mounted"),l=a.useState("transitionStatus"),d=a.useState("openChangeReason");return qe("div",t,{state:{open:c,transitionStatus:l},ref:[a.context.backdropRef,n],props:[{role:"presentation",hidden:!u,style:{pointerEvents:d===Lt?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},i],stateAttributesMapping:e1})});process.env.NODE_ENV!=="production"&&(Sp.displayName="PopoverBackdrop");const Ep=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vn(),c=qt(i.id);return he(()=>(a.set("titleElementId",c),()=>{a.set("titleElementId",void 0)}),[a,c]),qe("h2",t,{ref:n,props:[{id:c},i]})});process.env.NODE_ENV!=="production"&&(Ep.displayName="PopoverTitle");const xp=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vn(),c=qt(i.id);return he(()=>(a.set("descriptionElementId",c),()=>{a.set("descriptionElementId",void 0)}),[a,c]),qe("p",t,{ref:n,props:[{id:c},i]})});process.env.NODE_ENV!=="production"&&(xp.displayName="PopoverDescription");const Ys="base-ui-disable-scrollbar",Sc={className:Ys,getElement(e){return w.jsx("style",{nonce:e,href:Ys,precedence:"base-ui:low",children:`.${Ys}{scrollbar-width:none}.${Ys}::-webkit-scrollbar{display:none}`})}};process.env.NODE_ENV!=="production"&&(Sc.getElement.displayName="styleDisableScrollbar.getElement");const zn=1;function Cp(e,t){return Math.max(0,e-t)}function t1(e,t){if(t<=0)return 0;const n=bt(e,0,t),r=n,o=t-n,s=r<=zn,i=o<=zn;return s&&i?r<=o?0:t:s?0:i?t:n}const Ec=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ec.displayName="SelectRootContext");const xc=f.createContext(null);process.env.NODE_ENV!=="production"&&(xc.displayName="SelectFloatingContext");function Zr(){const e=f.useContext(Ec);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.":ft(60));return e}function Tp(){const e=f.useContext(xc);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.":ft(61));return e}const Ze={id:de(e=>e.id),labelId:de(e=>e.labelId),modal:de(e=>e.modal),multiple:de(e=>e.multiple),items:de(e=>e.items),itemToStringLabel:de(e=>e.itemToStringLabel),itemToStringValue:de(e=>e.itemToStringValue),isItemEqualToValue:de(e=>e.isItemEqualToValue),value:de(e=>e.value),hasSelectedValue:de(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Hr(t,r)!==""}),hasNullItemLabel:de((e,t)=>t?WS(e.items):!1),open:de(e=>e.open),mounted:de(e=>e.mounted),forceMount:de(e=>e.forceMount),transitionStatus:de(e=>e.transitionStatus),openMethod:de(e=>e.openMethod),activeIndex:de(e=>e.activeIndex),selectedIndex:de(e=>e.selectedIndex),isActive:de((e,t)=>e.activeIndex===t),isSelected:de((e,t,n)=>{const r=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(s=>jr(n,s,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:jr(n,o,r)}),isSelectedByFocus:de((e,t)=>e.selectedIndex===t),popupProps:de(e=>e.popupProps),triggerProps:de(e=>e.triggerProps),triggerElement:de(e=>e.triggerElement),positionerElement:de(e=>e.positionerElement),listElement:de(e=>e.listElement),scrollUpArrowVisible:de(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:de(e=>e.scrollDownArrowVisible),hasScrollArrows:de(e=>e.hasScrollArrows)};function n1(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:a,name:c,form:u,autoComplete:l,disabled:d=!1,readOnly:p=!1,required:h=!1,modal:m=!0,actionsRef:g,inputRef:v,onOpenChangeComplete:y,items:C,multiple:S=!1,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x=jS,highlightItemOnHover:T=!0,children:P}=e,{clearErrors:z}=Ur(),{setDirty:I,setTouched:D,setFocused:$,shouldValidateOnChange:V,validityData:N,setFilled:O,name:k,disabled:_,validation:M,validationMode:A}=mr(),j=rc({id:t}),B=_||d,U=k??c,[W,G]=Eo({controlled:n,default:S?r??tl:r,name:"Select",state:"value"}),[Z,X]=Eo({controlled:s,default:i,name:"Select",state:"open"}),K=f.useRef([]),J=f.useRef([]),se=f.useRef(null),ae=f.useRef(null),pe=f.useRef(0),Y=f.useRef(null),me=f.useRef([]),ge=f.useRef(!1),fe=f.useRef(!1),le=f.useRef(null),ce=f.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ve=f.useRef(!1),{mounted:ue,setMounted:Se,transitionStatus:R}=vo(Z),{openMethod:H,triggerProps:L}=Ha(Z),F=wt(()=>new el({id:j,labelId:void 0,modal:m,multiple:S,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x,value:W,open:Z,mounted:ue,transitionStatus:R,items:C,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Q=We(F,Ze.activeIndex),ne=We(F,Ze.selectedIndex),te=We(F,Ze.triggerElement),ye=We(F,Ze.positionerElement),_e=cE(H),Ee=H??_e,Ce=f.useMemo(()=>S&&Array.isArray(W)&&W.length===0?"":Hr(W,b),[S,W,b]),Pe=f.useMemo(()=>S&&Array.isArray(W)?W.map(Oe=>Hr(Oe,b)):Hr(W,b),[S,W,b]),Ve=vt(F.state.triggerElement),Ge=ie(()=>Pe);ec(Ve,{id:j,value:W,getValue:Ge});const He=f.useRef(W);he(()=>{W!==He.current&&F.set("forceMount",!0)},[F,W]),he(()=>{O(S?Array.isArray(W)&&W.length>0:W!=null)},[S,W,O]),he(function(){if(Z)return;const xe=me.current;if(S){const Me=Array.isArray(W)?W:[];if(Me.length===0){F.set("selectedIndex",null);return}const Xe=Me[Me.length-1],Je=xo(xe,Xe,x);F.set("selectedIndex",Je===-1?null:Je);return}const Ne=xo(xe,W,x);F.set("selectedIndex",Ne===-1?null:Ne)},[S,Z,W,me,x,F]),As(W,()=>{z(U),I(W!==N.initialValue),V()?M.commit(W):M.commit(W,!0)});const nt=ie((Oe,xe)=>{if(a?.(Oe,xe),!xe.isCanceled&&(X(Oe),!Oe&&(xe.reason===ur||xe.reason===ya)&&(D(!0),$(!1),A==="onBlur"&&M.commit(W)),!Oe&&F.state.activeIndex!==null)){const Ne=K.current[F.state.activeIndex];queueMicrotask(()=>{Ne?.setAttribute("tabindex","-1")})}}),st=ie(()=>{Se(!1),F.update({activeIndex:null,openMethod:null}),y?.(!1)});xn({enabled:!g,open:Z,ref:se,onComplete(){Z||st()}}),f.useImperativeHandle(g,()=>({unmount:st}),[st]);const Re=ie((Oe,xe)=>{o?.(Oe,xe),!xe.isCanceled&&G(Oe)}),Te=ie(()=>{const Oe=F.state.listElement||se.current;if(!Oe)return;const xe=Cp(Oe.scrollHeight,Oe.clientHeight),Ne=t1(Oe.scrollTop,xe),Me=Ne>0,Xe=Ne<xe;F.state.scrollUpArrowVisible!==Me&&F.set("scrollUpArrowVisible",Me),F.state.scrollDownArrowVisible!==Xe&&F.set("scrollDownArrowVisible",Xe)}),Ue=Ad({open:Z,onOpenChange:nt,elements:{reference:te,floating:ye}}),Be=Ia(Ue,{enabled:!p&&!B,event:"mousedown"}),ct=ka(Ue,{bubbles:!1}),Ye=zw(Ue,{enabled:!p&&!B,listRef:K,activeIndex:Q,selectedIndex:ne,disabledIndices:tl,onNavigate(Oe){Oe===null&&!Z||F.set("activeIndex",Oe)},focusItemOnHover:T}),Ut=jw(Ue,{enabled:!p&&!B&&(Z||!S),listRef:J,activeIndex:Q,selectedIndex:ne,onMatch(Oe){Z?F.set("activeIndex",Oe):Re(me.current[Oe],Ae("none"))},onTypingChange(Oe){ge.current=Oe}}),{getReferenceProps:$t,getFloatingProps:Ke,getItemProps:q}=bo([Be,ct,Ye,Ut]),re=f.useMemo(()=>En($t(),L,j?{id:j}:mt),[$t,L,j]);ja(()=>{F.update({popupProps:Ke(),triggerProps:re})}),he(()=>{F.update({id:j,modal:m,multiple:S,value:W,open:Z,mounted:ue,transitionStatus:R,popupProps:Ke(),triggerProps:re,items:C,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x,openMethod:Ee})},[F,j,m,S,W,Z,ue,R,Ke,re,C,E,b,x,Ee]);const be=f.useMemo(()=>({store:F,name:U,required:h,disabled:B,readOnly:p,multiple:S,highlightItemOnHover:T,setValue:Re,setOpen:nt,listRef:K,popupRef:se,scrollHandlerRef:ae,handleScrollArrowVisibility:Te,scrollArrowsMountedCountRef:pe,getItemProps:q,events:Ue.context.events,valueRef:Y,valuesRef:me,labelsRef:J,typingRef:ge,selectionRef:ce,selectedItemTextRef:le,validation:M,onOpenChangeComplete:y,keyboardActiveRef:fe,alignItemWithTriggerActiveRef:ve,initialValueRef:He}),[F,U,h,B,p,S,T,Re,nt,q,Ue.context.events,M,y,Te]),Le=or(v,M.inputRef),je=S&&Array.isArray(W)&&W.length>0,De=S?void 0:U,Qe=f.useMemo(()=>!S||!Array.isArray(W)||!U?null:W.map(Oe=>{const xe=Hr(Oe,b);return w.jsx("input",{type:"hidden",form:u,name:U,value:xe},xe)}),[S,W,u,U,b]);return w.jsx(Ec.Provider,{value:be,children:w.jsxs(xc.Provider,{value:Ue,children:[P,w.jsx("input",{...M.getInputValidationProps({onFocus(){F.state.triggerElement?.focus({focusVisible:!0})},onChange(Oe){if(Oe.nativeEvent.defaultPrevented)return;const xe=Oe.currentTarget.value,Ne=Ae(cr,Oe.nativeEvent);function Me(){if(S)return;const Xe=me.current.find(Je=>Hr(Je,b).toLowerCase()===xe.toLowerCase()||ZS(Je,E).toLowerCase()===xe.toLowerCase());Xe!=null&&(I(Xe!==N.initialValue),Re(Xe,Ne),V()&&M.commit(Xe))}F.set("forceMount",!0),queueMicrotask(Me)}}),id:j&&De==null?`${j}-hidden-input`:void 0,form:u,name:De,autoComplete:l,value:Ce,disabled:B,required:h&&!je,readOnly:p,ref:Le,style:U?Al:ss,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Qe]})})}const Xs=2,r1=400,Op=200,o1={...Xd,...hr,value:()=>null},Pp=f.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:a=!0,style:c,...u}=t,{setTouched:l,setFocused:d,validationMode:p,state:h,disabled:m}=mr(),{labelId:g}=Ln(),{store:v,setOpen:y,selectionRef:C,validation:S,readOnly:E,required:b,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:P}=Zr(),z=m||T||i,I=We(v,Ze.open),D=We(v,Ze.value),$=We(v,Ze.triggerProps),V=We(v,Ze.positionerElement),N=We(v,Ze.listElement),O=We(v,Ze.id),k=We(v,Ze.labelId),_=We(v,Ze.hasSelectedValue),M=!_&&I,A=We(v,Ze.hasNullItemLabel,M),j=s??O,B=XS(g,k);rc({id:j});const U=vt(V),W=f.useRef(null),{getButtonProps:G,buttonRef:Z}=Lr({disabled:z,native:a}),X=ie(fe=>{v.set("triggerElement",fe)}),K=or(n,W,Z,X),J=Gt(),se=Gt(),ae=Gt(),pe=Gt();f.useEffect(()=>{if(I)return!(_||A)?ae.start(r1,()=>{C.current.allowUnselectedMouseUp=!0,C.current.allowSelectedMouseUp=!0}):pe.start(Op,()=>{C.current.allowUnselectedMouseUp=!0,ae.start(Op,()=>{C.current.allowSelectedMouseUp=!0})}),()=>{ae.clear(),pe.clear()};C.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},se.clear()},[I,_,A,C,se,ae,pe]);const Y=f.useMemo(()=>N?.id??lo(V)?.id,[N,V]),me=En($,{id:j,role:"combobox","aria-expanded":I?"true":"false","aria-haspopup":"listbox","aria-controls":I?Y:void 0,"aria-labelledby":B,"aria-readonly":E||void 0,"aria-required":b||void 0,tabIndex:z?-1:0,ref:K,onFocus(fe){d(!0),I&&x.current&&y(!1,Ae(cr,fe.nativeEvent)),J.start(0,()=>{v.set("forceMount",!0)})},onBlur(fe){we(V,fe.relatedTarget)||(l(!0),d(!1),p==="onBlur"&&S.commit(D))},onPointerMove(){P.current=!1},onKeyDown(){P.current=!0},onMouseDown(fe){if(I)return;const le=Ie(fe.currentTarget);function ce(ve){if(!W.current)return;const ue=ve.target;if(we(W.current,ue)||we(U.current,ue)||ue===W.current)return;const Se=YS(W.current);ve.clientX>=Se.left-Xs&&ve.clientX<=Se.right+Xs&&ve.clientY>=Se.top-Xs&&ve.clientY<=Se.bottom+Xs||y(!1,Ae(O0,ve))}se.start(0,()=>{le.addEventListener("mouseup",ce,{once:!0})})}},S.getValidationProps,u,G);me.role="combobox";const ge={...h,open:I,disabled:z,value:D,readOnly:E,placeholder:!_};return qe("button",t,{ref:[n,W],state:ge,stateAttributesMapping:o1,props:me})});process.env.NODE_ENV!=="production"&&(Pp.displayName="SelectTrigger");const _p=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(_p.displayName="SelectPortalContext");const Ip=f.forwardRef(function(t,n){const{store:r}=Zr(),o=We(r,Ze.mounted),s=We(r,Ze.forceMount);return o||s?w.jsx(_p.Provider,{value:!0,children:w.jsx(hs,{ref:n,...t})}):null});process.env.NODE_ENV!=="production"&&(Ip.displayName="SelectPortal");const Cc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Cc.displayName="SelectPositionerContext");function s1(){const e=f.useContext(Cc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.":ft(59));return e}function qs(e,t){e&&Object.assign(e.style,t)}const i1={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},a1={position:"fixed"},kp=f.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a="bottom",align:c="center",sideOffset:u=0,alignOffset:l=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:h=5,sticky:m=!1,disableAnchorTracking:g,alignItemWithTrigger:v=!0,collisionAvoidance:y=d0,style:C,...S}=t,{store:E,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:T,selectedItemTextRef:P,valuesRef:z,initialValueRef:I,popupRef:D,setValue:$}=Zr(),V=Tp(),N=We(E,Ze.open),O=We(E,Ze.mounted),k=We(E,Ze.modal),_=We(E,Ze.value),M=We(E,Ze.openMethod),A=We(E,Ze.positionerElement),j=We(E,Ze.triggerElement),B=We(E,Ze.isItemEqualToValue),U=We(E,Ze.transitionStatus),W=f.useRef(null),G=f.useRef(null),[Z,X]=f.useState(v),K=O&&Z&&M!=="touch";!O&&Z!==v&&X(v),he(()=>{O||(Ze.scrollUpArrowVisible(E.state)&&E.set("scrollUpArrowVisible",!1),Ze.scrollDownArrowVisible(E.state)&&E.set("scrollDownArrowVisible",!1))},[E,O]),f.useImperativeHandle(T,()=>K),Pf((K||k)&&N,M==="touch",A,j);const J=Zd({anchor:r,floatingRootContext:V,positionMethod:o,mounted:O,side:a,sideOffset:u,align:c,alignOffset:l,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:m,disableAnchorTracking:g??K,collisionAvoidance:y,keepMounted:!0}),se=K?"none":J.side,ae=K?a1:J.positionerStyles,pe={open:N,side:se,align:J.align,anchorHidden:J.anchorHidden},Y=ie(ce=>{E.set("positionerElement",ce)}),me=qd(t,pe,{styles:ae,transitionStatus:U,props:S,refs:[n,Y],hidden:!O,inert:!N}),ge=f.useRef(0),fe=ie(ce=>{if(ce.size===0&&ge.current===0||z.current.length===0)return;const ve=ge.current;if(ge.current=ce.size,ce.size===ve)return;const ue=Ae(cr);if(ve!==0&&!E.state.multiple&&_!==null&&xo(z.current,_,B)===-1){const R=I.current,L=R!=null&&xo(z.current,R,B)!==-1?R:null;$(L,ue),L===null&&(E.set("selectedIndex",null),P.current=null)}if(ve!==0&&E.state.multiple&&Array.isArray(_)){const Se=H=>xo(z.current,H,B)!==-1,R=_.filter(H=>Se(H));(R.length!==_.length||R.some(H=>!HS(_,H,B)))&&($(R,ue),R.length===0&&(E.set("selectedIndex",null),P.current=null))}if(N&&K){E.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Se={height:""};qs(A,Se),qs(D.current,Se)}}),le=f.useMemo(()=>({...J,side:se,alignItemWithTriggerActive:K,setControlledAlignItemWithTrigger:X,scrollUpArrowRef:W,scrollDownArrowRef:G}),[J,se,K,X]);return w.jsx(vS,{elementsRef:b,labelsRef:x,onMapChange:fe,children:w.jsxs(Cc.Provider,{value:le,children:[O&&k&&w.jsx(Ls,{inert:cs(!N),cutout:j}),me]})})});process.env.NODE_ENV!=="production"&&(kp.displayName="SelectPositioner");const c1={...Cn,...tn},Rp=f.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:c,popupRef:u,onOpenChangeComplete:l,setOpen:d,valueRef:p,selectedItemTextRef:h,keyboardActiveRef:m,multiple:g,handleScrollArrowVisibility:v,scrollHandlerRef:y,listRef:C,highlightItemOnHover:S}=Zr(),{side:E,align:b,alignItemWithTriggerActive:x,isPositioned:T,setControlledAlignItemWithTrigger:P,scrollDownArrowRef:z,scrollUpArrowRef:I}=s1(),D=Mf()!=null,$=Tp(),V=Ud(),{nonce:N,disableStyleElements:O}=lE(),k=We(c,Ze.id),_=We(c,Ze.open),M=We(c,Ze.mounted),A=We(c,Ze.popupProps),j=We(c,Ze.transitionStatus),B=We(c,Ze.triggerElement),U=We(c,Ze.positionerElement),W=We(c,Ze.listElement),G=f.useRef(!1),Z=f.useRef(!1),X=f.useRef({}),K=ao(),J=ie(Y=>{if(!U||!u.current||!Z.current)return;if(G.current||!x){v();return}const me=U.style.top==="0px",ge=U.style.bottom==="0px";if(!me&&!ge){v();return}const fe=Mp(U),le=Oo(U.getBoundingClientRect().height,"y",fe),ce=Ie(U),ve=getComputedStyle(U),ue=parseFloat(ve.marginTop),Se=parseFloat(ve.marginBottom),R=Np(getComputedStyle(u.current)),H=Math.min(ce.documentElement.clientHeight-ue-Se,R),L=Y.scrollTop,F=Ks(Y);let Q=0,ne=null,te=!1,ye=!1;const _e=Ve=>{U.style.height=`${Ve}px`},Ee=(Ve,Ge)=>{const He=bt(Ve,0,H-le);He>0&&_e(le+He),Y.scrollTop=Ge,H-(le+He)<=zn&&(G.current=!0),v()},Ce=me?F-L:L,Pe=Math.min(le+Ce,H);if(Q=Pe,Ce<=zn){Ee(Ce,me?F:0);return}if(H-Pe>zn)me?ye=!0:ne=0;else if(te=!0,ge&&L<F){const Ve=le+Ce-H;ne=L-(Ce-Ve)}if(Q=Math.ceil(Q),Q!==0&&_e(Q),ye||ne!=null){const Ve=Ks(Y),Ge=ye?Ve:bt(ne,0,Ve);Math.abs(Y.scrollTop-Ge)>zn&&(Y.scrollTop=Ge)}(te||Q>=H-zn)&&(G.current=!0),v()});f.useImperativeHandle(y,()=>J,[J]),xn({open:_,ref:u,onComplete(){_&&l?.(!0)}});const se={open:_,transitionStatus:j,side:E,align:b};he(()=>{!U||!u.current||Object.keys(X.current).length||(X.current={top:U.style.top||"0",left:U.style.left||"0",right:U.style.right,height:U.style.height,bottom:U.style.bottom,minHeight:U.style.minHeight,maxHeight:U.style.maxHeight,marginTop:U.style.marginTop,marginBottom:U.style.marginBottom})},[u,U]),he(()=>{_||x||(Z.current=!1,G.current=!1,qs(U,X.current))},[_,x,U,u]),he(()=>{const Y=u.current;if(!_||!B||!U||!Y||x&&!T||c.state.transitionStatus==="ending")return;if(!x){Z.current=!0,K.request(v),Y.style.removeProperty("--transform-origin");return}const me=u1(Y);Y.style.removeProperty("--transform-origin");try{const ge=h.current,fe=p.current,le=getComputedStyle(U),ce=getComputedStyle(Y),ve=Ie(B),ue=tt(U),Se=Mp(B),R=Js(B.getBoundingClientRect(),Se),H=Js(U.getBoundingClientRect(),Se),L=R.height,F=W||Y,Q=F.scrollHeight,ne=parseFloat(ce.borderBottomWidth),te=parseFloat(le.marginTop)||10,ye=parseFloat(le.marginBottom)||10,_e=parseFloat(le.minHeight)||100,Ee=Np(ce),Ce=5,Pe=5,Ve=20,Ge=ve.documentElement.clientHeight-te-ye,He=ve.documentElement.clientWidth,nt=Ge-R.bottom+L;let st,Re=V==="rtl"?R.right-H.width:R.left,Te=0;if(ge&&fe){const Le=Js(fe.getBoundingClientRect(),Se);st=Js(ge.getBoundingClientRect(),Se),Re=H.left+(V==="rtl"?Le.right-st.right:Le.left-st.left);const je=Le.top-R.top+Le.height/2;Te=st.top-H.top+st.height/2-je}const Ue=nt+Te+ye+ne;let Be=Math.min(Ge,Ue);const ct=Ge-te-ye,Ye=Ue-Be,Ut=He-Pe;U.style.left=`${bt(Re,Ce,Ut-H.width)}px`,U.style.height=`${Be}px`,U.style.maxHeight="auto",U.style.marginTop=`${te}px`,U.style.marginBottom=`${ye}px`,Y.style.height="100%";const $t=Ks(F),Ke=Ye>=$t-zn;Ke&&(Be=Math.min(Ge,H.height)-(Ye-$t));const q=R.top<Ve||R.bottom>Ge-Ve||Math.ceil(Be)+zn<Math.min(Q,_e),re=(ue.visualViewport?.scale??1)!==1&&Gi;if(q||re){Z.current=!0,qs(U,X.current),P(!1);return}const be=Math.max(_e,Be);if(Ke){const Le=Math.max(0,Ge-Ue);U.style.top=H.height>=ct?"0":`${Le}px`,U.style.height=`${Be}px`,F.scrollTop=Ks(F)}else U.style.bottom="0",F.scrollTop=Ye;if(st){const Le=H.top,je=H.height,De=st.top+st.height/2,Qe=je>0?(De-Le)/je*100:50,Oe=bt(Qe,0,100);Y.style.setProperty("--transform-origin",`50% ${Oe}%`)}(be===Ge||Be>=Ee)&&(G.current=!0),v(),S&&c.state.selectedIndex===null&&c.state.activeIndex===null&&C.current[0]!=null&&c.set("activeIndex",0),Z.current=!0}finally{me()}},[c,_,U,B,p,h,u,v,x,P,K,z,I,W,C,S,V,T]),f.useEffect(()=>{if(!x||!U||!_)return;const Y=tt(U);function me(ge){d(!1,Ae(P0,ge))}return Fe(Y,"resize",me)},[d,x,U,_]);const ae={...W?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":g||void 0,id:`${k}-list`},onKeyDown(Y){m.current=!0,D&&Ms.has(Y.key)&&Y.stopPropagation()},onMouseMove(){m.current=!1},onScroll(Y){W||J(Y.currentTarget)},...x&&{style:W?{height:"100%"}:i1}},pe=qe("div",t,{ref:[n,u],state:se,stateAttributesMapping:c1,props:[A,ae,Va(j),{className:!W&&x?Sc.className:void 0},a]});return w.jsxs(f.Fragment,{children:[!O&&Sc.getElement(N),w.jsx(ms,{context:$,modal:!1,disabled:!M,returnFocus:i,restoreFocus:!0,children:pe})]})});process.env.NODE_ENV!=="production"&&(Rp.displayName="SelectPopup");function Np(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ks(e){return Cp(e.scrollHeight,e.clientHeight)}function Mp(e){return Cd.getScale(e)}function Oo(e,t,n){return e/n[t]}function Js(e,t){return po({x:Oo(e.x,"x",t),y:Oo(e.y,"y",t),width:Oo(e.width,"x",t),height:Oo(e.height,"y",t)})}const Ap=[["transform","none"],["scale","1"],["translate","0 0"]];function u1(e){const{style:t}=e,n={};for(const[r,o]of Ap)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Ap){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const Tc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Tc.displayName="SelectItemContext");function Oc(){const e=f.useContext(Tc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.":ft(57));return e}const Dp=f.memo(f.forwardRef(function(t,n){const{render:r,className:o,value:s=null,label:i,disabled:a=!1,nativeButton:c=!1,style:u,...l}=t,d=f.useRef(null),p=ES({label:i,textRef:d,indexGuessBehavior:pf.GuessFromOrder}),{store:h,getItemProps:m,setOpen:g,setValue:v,selectionRef:y,typingRef:C,valuesRef:S,multiple:E,selectedItemTextRef:b}=Zr(),x=We(h,Ze.isActive,p.index),T=We(h,Ze.isSelected,p.index,s),P=We(h,Ze.isSelectedByFocus,p.index),z=We(h,Ze.isItemEqualToValue),I=p.index,D=I!==-1,$=f.useRef(null),V=vt(I);he(()=>{if(!D)return;const Z=S.current;return Z[I]=s,()=>{delete Z[I]}},[D,I,s,S]),he(()=>{if(!D)return;const Z=h.state.value;let X=Z;E&&Array.isArray(Z)&&Z.length>0&&(X=Z[Z.length-1]),X!==void 0&&jr(s,X,z)&&(h.set("selectedIndex",I),d.current&&(b.current=d.current))},[D,I,E,z,h,s,b]);const N={disabled:a,selected:T,highlighted:x},O=m({active:x,selected:T});O.id=void 0;const k=f.useRef(null),_=f.useRef("mouse"),M=f.useRef(!1),{getButtonProps:A,buttonRef:j}=Lr({disabled:a,focusableWhenDisabled:!0,native:c,composite:!0});function B(Z){const X=h.state.value;if(E){const K=Array.isArray(X)?X:[],J=T?US(K,s,z):[...K,s];v(J,Ae(va,Z))}else v(s,Ae(va,Z)),g(!1,Ae(va,Z))}const U={role:"option","aria-selected":T,tabIndex:x?0:-1,onTouchStart(){y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(Z){k.current=Z.key,h.set("activeIndex",I),Z.key===" "&&C.current&&Z.preventDefault()},onClick(Z){M.current=!1,!(Z.type==="keydown"&&k.current===null)&&(a||Z.type==="keydown"&&k.current===" "&&C.current||_.current!=="touch"&&!x||(k.current=null,B(Z.nativeEvent)))},onPointerEnter(Z){_.current=Z.pointerType},onPointerDown(Z){_.current=Z.pointerType,M.current=!0},onMouseUp(){if(a)return;if(M.current){M.current=!1;return}const Z=!y.current.allowSelectedMouseUp&&T,X=!y.current.allowUnselectedMouseUp&&!T;Z||X||_.current!=="touch"&&!x||$.current?.click()}},W=qe("div",t,{ref:[j,n,p.ref,$],state:N,props:[O,U,l,A]}),G=f.useMemo(()=>({selected:T,indexRef:V,textRef:d,selectedByFocus:P,hasRegistered:D}),[T,V,d,P,D]);return w.jsx(Tc.Provider,{value:G,children:W})}));process.env.NODE_ENV!=="production"&&(Dp.displayName="SelectItem");const Lp=f.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=Oc();return r||o?w.jsx(Fp,{...t,ref:n}):null});process.env.NODE_ENV!=="production"&&(Lp.displayName="SelectItemIndicator");const Fp=f.memo(f.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:a}=Oc(),c=f.useRef(null),{transitionStatus:u,setMounted:l}=vo(a),p=qe("span",e,{ref:[t,c],state:{selected:a,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:tn});return xn({open:a,ref:c,onComplete(){a||l(!1)}}),p}));process.env.NODE_ENV!=="production"&&(Fp.displayName="Inner");const Vp=f.memo(f.forwardRef(function(t,n){const{indexRef:r,textRef:o,selectedByFocus:s,hasRegistered:i}=Oc(),{selectedItemTextRef:a}=Zr(),{className:c,render:u,style:l,...d}=t,p=f.useCallback(m=>{if(!m||!i)return;const g=a.current===null||!a.current.isConnected;(s||g&&r.current===0)&&(a.current=m)},[a,r,s,i]);return qe("div",t,{ref:[p,n,o],props:d})}));process.env.NODE_ENV!=="production"&&(Vp.displayName="SelectItemText");function Rt({as:e,children:t,className:n,disabled:r,...o}){const s=e||"button",i=s==="button";return w.jsx(s,{className:Mi("align-middle inline-flex items-center justify-center transition-all cursor-pointer hover:brightness-110 active:brightness-90 active:scale-90 disabled:cursor-not-allowed disabled:grayscale",n),...i?{disabled:r}:{"aria-disabled":r},...r&&!i?{onClick:a=>{a.preventDefault(),a.stopPropagation()}}:{},...o,children:t})}const l1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),d1=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),zp=e=>{const t=d1(e);return t.charAt(0).toUpperCase()+t.slice(1)},$p=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),f1=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var p1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const h1=oe.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>oe.createElement("svg",{ref:c,...p1,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$p("lucide",o),...!s&&!f1(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,l])=>oe.createElement(u,l)),...Array.isArray(s)?s:[s]]));const $n=(e,t)=>{const n=oe.forwardRef(({className:r,...o},s)=>oe.createElement(h1,{ref:s,iconNode:t,className:$p(`lucide-${l1(zp(e))}`,`lucide-${e}`,r),...o}));return n.displayName=zp(e),n};const Pc=$n("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const jp=$n("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Hp=$n("eye-closed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);const Up=$n("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const m1=$n("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const g1=$n("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const y1=$n("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);const v1=$n("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const Bp=$n("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function b1(e){return _t.get("/channel/game/role/mail-captcha",e)}function w1(e){return _t.get("/channel/game/role/auth",e)}function S1(e){return _t.post("/passport-api/v2/ztgame/auth/login",{account:e.account,password:e.password,channel_login:1,channel_id:6})}function E1(e){return _t.post("/passport-api/v2/sms-captchas",{mobile:e.mobile,type:e.type||"register",is_voice:0,nationcode:e.countryCode})}function x1(e){return _t.post("/passport-api/v2/ztgame/auth/mobile-register",{mobile:e.mobile,captcha:e.captcha,channel_login:1,channel_id:6,nationcode:e.countryCode,ad_id:""})}function Wp(){return _t.post("/passport-api/v2/ztgame/auth/auth",{channel_login:1,channel_id:6})}function C1(e){return _t.post(`/passport-api/v2/ztgame/users/${e.uid}/idcard`,{name:e.name,idcard:e.idcard},{headers:{Authentication:e.authorization}})}function T1(e){return _t.post("/passport-api/v2/ztgame/auth/re-auth",{type:"auth",channel_id:6,ad_id:"",channel_login:1},{headers:{Authentication:e}})}function O1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/",e)}function P1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/sms-captchas",e)}function Zp(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys",e)}function _1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-update",e)}const I1="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAYAAADk3wSdAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFJ0lEQVQ4jW2VW4ydVRXHf2tfvu87Z+5znEtnxnLR0pYJatEHWxhBEZUSCE8YESImRnzwQTEEY6KJGrQJXiFGXzAxaowkSkyoIgjYlEqEIIrSS6KmpTPDdJgz55w5t++29/bhjDQFVrKf9lq/rGSt/3/J+v2XExRQgNsKuJbH9QLFKaE4BWqUu6TCvXhGQsajOD6D4BJfQBCuvvaLLE/uhLTN/8PwVlGCxIJZCJ9XYzwYBEIGdLkztBE8d1rvSJWlbSLw/oJy9UZe8AOAGglfNbt4UE2CSkBikASwfKpE6blOncdndtOauAjy3gWM8516wCGiuFGPyT2Mhw+EQvC9wZ+UEAw4UfXZtBU6cZX7Fm+C4IDwBmgAPHdguEGPy1VqSO0MObhewHc9UgC5gAKXKmpbW3fV8i1/8JovsDyzG5ortxK4DpFzwP1A2yAcUpHciwURCLngOgFVBkIOOPBd/qrWir/MrTV/k6nk2N3v/Rx/uHgJmqvfrqb5l3sioBVofTsi18hrDywGqQ46IQBFwHcCRT1QrrmfDjXaP/TrvNRerrIiM/xq98d4bH6ROK3fV3XlV0QU60azajTOGND6R4YIpAqiAsEDVnB1UM30lonQ/t0/G3t4uXkZqxM1TkztpDmUXP7uzVcO2SA3FVrR0hoEOkrRCAFCGDMScUJX3V6lPCEIrqexsb82quVHnji6xJ9PH8Bbtc9G2f4dW42PznbDzc5qerGlnURURMidEPT2sIw5bFTMYVMp94rxEASfyananu6RI0/t49G/f4gdMxu/jExxm/QF1fMURtEdshRKMSo5GZa1OKJlDVSSc1STx4wedi/paomKPMELSfAv9NKY5569jNGk89nIFLeFIAQFISiMC9jCMZzlHJ+cfPn5uem9G6AQBdXkReKoacxw0TDDHhWX4BQqLjY3z4zTaVapVLODIch5YchAHNa7rJ4k1//pit3LRRT9h9a2RCvJJtai7JgbN1ObqOlzqJlzMJxPjF7cZnSkT78V/1Hk/GJLgKBlKyqLfUcX33m0mJu9lLIU4giSGOJ4gjhG2Zn6uxhvk+kqfRvDWPdKc8UrfPgTz+E2R34cUvMwKhAEvOL0Rcud95+pLZw4eeB94N2VGAtRNHjW7qOajBlG+gcb3QXq3XHaZUzFdvfOmY2r5JNnjw39+2/Iz3Z9vGbCDyTORyr94ul/LEbFr+8YhWoLmvJpbDSQqggYPUsSf0TSjYmw0p6nnlnqmWUji8Frp4bzm1eS7PfHf3sJ5eMLjHQtJ/eUPH39GAzNvI2txUdIZ66mtzVwKQGshaHqz00ImsxruqWmkRleS4W1VOvQqBz2OvnJ2aW1B55cXD1BfQqG50fpRbdTn/oG0UQNayC24MIAGllQqiO+FX13pXnp3Sebk5zuaZZ7hvVU86+e5vlMcIWjwDxJmG3i3/5B9PwkageoKWAanAKXDUzCmrMovWRE5V+aH//vcaS8oe+n97/at3ObheLFAtK+h7wCevo6dA10ddsjuxASEAW6UqLNMSR6BpHv4GkaPIjJH1oYXn+onY1E3UJuXE3VPb0tvZ9Cg66A0oNz4FNQMfg20Gkj5lvI+C9Qc8vI1GCJX3d+D6mzlEHy2PhH3lF1B95T8d9ECYQAFBByCH3wLXBnnsWd2QP9Q6CXt+X2Fs6/7Xy5F4oAOyxfQ/sGRfa919NCAX75GVBLmF1AzGBCF8abDp8ARuDVnoJMvo/JSrz/OpIaKJ7CN25Batul4U1AgP8BRjZPP9WeeTQAAAAASUVORK5CYII=";function k1(e){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 500 500",...e,children:[w.jsx("path",{fill:"url(#a)",d:"M0 250C0 111.929 111.929 0 250 0s250 111.929 250 250-111.929 250-250 250S0 388.071 0 250Z"}),w.jsx("path",{fill:"#fff",d:"M159.432 341h-33.008V158.949h33.008V341Zm220.263-76.172c0 11.087-1.946 21.286-5.84 30.596-3.808 9.31-9.098 17.35-15.869 24.121-6.771 6.686-14.811 11.934-24.121 15.742-9.31 3.809-19.424 5.713-30.342 5.713h-89.121c-2.369 0-4.57-.423-6.601-1.27-2.031-.846-3.809-1.988-5.332-3.427-1.439-1.524-2.582-3.301-3.428-5.332-.846-2.032-1.27-4.232-1.27-6.602V175.58c0-2.285.424-4.443 1.27-6.475.846-2.031 1.989-3.808 3.428-5.332a16.354 16.354 0 0 1 5.332-3.554c2.031-.847 4.232-1.27 6.601-1.27h89.121c10.918 0 21.032 1.905 30.342 5.713 9.31 3.809 17.35 9.098 24.121 15.869 6.771 6.686 12.061 14.727 15.869 24.121 3.894 9.31 5.84 19.466 5.84 30.469v29.707Zm-33.007-29.707c0-6.432-1.058-12.314-3.174-17.646-2.032-5.332-4.952-9.86-8.76-13.584-3.809-3.809-8.379-6.729-13.711-8.76-5.247-2.116-11.087-3.174-17.52-3.174h-72.744v116.035h72.744c6.433 0 12.273-1.015 17.52-3.047 5.332-2.116 9.902-5.035 13.711-8.759 3.808-3.809 6.728-8.337 8.76-13.584 2.116-5.332 3.174-11.257 3.174-17.774v-29.707Z"}),w.jsx("defs",{children:w.jsxs("linearGradient",{id:"a",x1:250,x2:250,y1:0,y2:500,gradientUnits:"userSpaceOnUse",children:[w.jsx("stop",{stopColor:"#497EFE"}),w.jsx("stop",{offset:1,stopColor:"#947AFA"})]})})]})}function Qs(){const{gameId:e,loginTypes:t,currentLoginType:n,setCurrentLoginType:r}=Dn(),o=tf({loginTypes:t,gameId:e}),s=nf({loginTypes:t,gameId:e}),i=ef({loginTypes:t,gameId:e}),a=[];return i&&n!==at.GIANT&&a.push({type:at.GIANT,label:e==="5327"?"账号密码登录":"巨人账号",icon:e==="5327"?null:w.jsx("img",{className:"size-4",src:I1})}),s&&n!==at.MOBILE&&a.push({type:at.MOBILE,label:"手机号登录",icon:w.jsx(m1,{className:"size-4"})}),o&&n!==at.ROLE_ID&&a.push({type:at.ROLE_ID,label:"ID 登录",icon:w.jsx(k1,{className:"size-4"})}),n!=="quick"&&$r(e).length>0&&a.push({type:"quick",label:"快捷登录",icon:w.jsx(v1,{className:"size-4"})}),a.length?w.jsx("div",{className:"text-gray-500 text-xs flex justify-center items-center gap-2 mb-4",children:a.map((c,u)=>w.jsxs(Rt,{className:"h-7 px-3 border rounded-full border-gray-300 gap-1.5",onClick:()=>r(c.type),children:[c.icon,w.jsx("span",{children:c.label})]},c.type))}):null}function R1(e){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 90 90",fill:"currentColor",...e,children:w.jsx("path",{d:"M41.415 1.601c6.427-2.244 13.363 2.04 14.18 8.773.611 5.508-2.959 10.609-8.365 11.833-.408.102-.918.203-1.326.305-.918.204-1.735.409-2.653.613-.306.102-.714.204-1.122.306h-.101c-.816.306-1.633.51-2.448.816-.306.102-.715.306-1.021.408l-2.754 1.223c-.408.103-.714.307-1.02.511-1.224.612-2.346 1.326-3.468 2.142l-.307.306c-.612.409-1.122.919-1.632 1.327-.51.408-1.02.816-1.53 1.326-.408.306-.714.713-1.122 1.02-.408.407-.816.918-1.326 1.428-.306.612-.409 1.224-.612 1.836-.204 1.122-.51 2.143-.714 3.265-.204 1.02-.408 2.04-.51 3.06 0 .611-.103 1.122-.103 1.734v1.632c0 1.02 0 1.938.103 2.958.102 1.02.306 2.143.51 3.163.204.816.408 1.733.612 2.55.204.816.408 1.53.612 2.346.102.306.204.51.408.714.51.612 1.122 1.122 1.632 1.734 1.02.918 2.04 1.836 3.162 2.754.816.612 1.734 1.224 2.55 1.836.51.306.919.612 1.429.918.102 0 .204 0 .204.103.204 0 .306.102.51.204.408.204.714.408 1.122.612.918.408 1.734.714 2.652 1.122.714.204 1.326.51 2.04.714 1.122.306 2.143.612 3.265.918.51.204 1.122.204 1.632 0 .306-.102.51-.102.816-.204.816-.204 1.53-.51 2.346-.714 1.53-.408 2.958-1.02 4.386-1.633h.102c.816-.408 1.735-.815 2.55-1.325.307-.204.714-.408 1.02-.612 1.02-.714 2.04-1.428 3.06-2.244.613-.51 1.123-1.02 1.735-1.53l2.142-2.143c.408-.408.714-.816.816-1.428 0-.102.103-.102.103-.204.306-1.02.611-2.142.815-3.162.306-1.326.612-2.755.714-4.183v-.204c.102-1.224.103-2.448.103-3.672-.102-.816-.102-1.53-.204-2.346 0-.102 0-.204-.102-.205-.918.408-1.735.715-2.55 1.225-1.633.918-3.061 1.938-4.489 3.06-.102.101-.204.102-.306.204-1.02.918-1.938 1.734-2.856 2.652-1.02 1.02-2.041 2.04-2.96 3.162-1.937 2.244-4.487 3.469-7.445 3.673-5.713.306-10.61-3.673-11.324-9.283-.816-5.61 2.959-10.813 8.467-11.935a52.639 52.639 0 0 0 7.856-2.142h.101c.816-.408 1.734-.715 2.55-1.122 3.264-1.53 6.121-3.672 8.773-6.12 1.327-1.327 2.652-2.653 3.876-4.082 2.347-2.55 5.305-3.774 8.773-3.57 5.1.306 9.283 4.285 9.895 9.283.204 1.53.102 3.06-.408 4.489-.612 1.938-1.224 3.876-1.734 5.916-.102 1.02-.408 1.939-.51 2.958-.408 2.449-.51 4.795-.306 7.141v.306c.102.816.204 1.53.306 2.347a46.28 46.28 0 0 0 1.224 5.406c.102 0 .102.102.102.204.51 1.632 1.224 3.264 1.224 4.794.306 3.162-.51 5.917-2.55 8.365-1.632 1.938-3.774 3.06-6.223 3.57-1.734.408-3.57.817-5.304 1.326-.102.102-.204.102-.306.102-1.836.612-3.775 1.326-5.509 2.244h-.101c-.918.408-1.735.919-2.551 1.429-.306.204-.714.51-1.02.714a30.738 30.738 0 0 0-2.856 2.244c-.816.714-1.633 1.53-2.347 2.244a.22.22 0 0 1-.204.204c-.918.918-1.734 1.836-2.55 2.754-2.346 2.55-5.202 3.877-8.67 3.775-3.06-.102-5.61-1.428-7.651-3.672-1.428-1.633-2.958-3.163-4.488-4.591v-.102c-.51-.408-1.02-.918-1.53-1.326-.715-.612-1.53-1.122-2.245-1.734l-1.53-.918c-.612-.306-1.122-.612-1.734-.918l-2.754-1.225c-1.326-.612-2.653-1.02-4.081-1.428-1.326-.407-2.652-.714-3.978-1.02a11.146 11.146 0 0 1-3.673-1.224c-3.264-1.734-5.1-4.489-5.61-8.16-.204-1.633 0-3.265.51-4.795.816-2.244 1.428-4.59 1.938-6.936.102-.102.102-.103.102-.204.102-.715.204-1.531.306-2.347.102-.714.205-1.428.205-2.142V43.63l-.087-.956a39.328 39.328 0 0 0-1.24-6.695c-.102-.102-.102-.205-.102-.306-.51-1.734-1.224-3.469-1.53-5.203-1.122-5.712 2.55-11.22 8.263-12.445.714-.204 1.53-.306 2.244-.51 1.224-.306 2.55-.612 3.775-1.02 1.224-.408 2.448-.816 3.672-1.326l1.223-.612c.918-.408 1.837-.918 2.755-1.428 1.122-.714 2.244-1.53 3.366-2.346.408-.306.715-.612 1.122-.918.408-.408.918-.918 1.428-1.326a40.49 40.49 0 0 0 2.96-2.96c1.53-1.835 3.161-3.16 5.405-3.977Z"})})}function N1(e){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",fill:"currentColor",...e,children:w.jsx("path",{d:"M842.667 384H768V277.333a234.667 234.667 0 1 0-469.333 0V384H224a53.393 53.393 0 0 0-53.333 53.333V928A53.393 53.393 0 0 0 224 981.333h618.667A53.393 53.393 0 0 0 896 928V437.333A53.393 53.393 0 0 0 842.667 384zm-288 295.007v110.326a21.333 21.333 0 0 1-42.667 0V679.007a64 64 0 1 1 42.667 0zM725.333 384h-384V277.333c0-105.866 86.134-192 192-192s192 86.134 192 192z"})})}var _c,Gp;function M1(){if(Gp)return _c;Gp=1;var e="Expected a function",t=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,c=typeof Ho=="object"&&Ho&&Ho.Object===Object&&Ho,u=typeof self=="object"&&self&&self.Object===Object&&self,l=c||u||Function("return this")(),d=Object.prototype,p=d.toString,h=Math.max,m=Math.min,g=function(){return l.Date.now()};function v(b,x,T){var P,z,I,D,$,V,N=0,O=!1,k=!1,_=!0;if(typeof b!="function")throw new TypeError(e);x=E(x)||0,y(T)&&(O=!!T.leading,k="maxWait"in T,I=k?h(E(T.maxWait)||0,x):I,_="trailing"in T?!!T.trailing:_);function M(K){var J=P,se=z;return P=z=void 0,N=K,D=b.apply(se,J),D}function A(K){return N=K,$=setTimeout(U,x),O?M(K):D}function j(K){var J=K-V,se=K-N,ae=x-J;return k?m(ae,I-se):ae}function B(K){var J=K-V,se=K-N;return V===void 0||J>=x||J<0||k&&se>=I}function U(){var K=g();if(B(K))return W(K);$=setTimeout(U,j(K))}function W(K){return $=void 0,_&&P?M(K):(P=z=void 0,D)}function G(){$!==void 0&&clearTimeout($),N=0,P=V=z=$=void 0}function Z(){return $===void 0?D:W(g())}function X(){var K=g(),J=B(K);if(P=arguments,z=this,V=K,J){if($===void 0)return A(V);if(k)return $=setTimeout(U,x),M(V)}return $===void 0&&($=setTimeout(U,x)),D}return X.cancel=G,X.flush=Z,X}function y(b){var x=typeof b;return!!b&&(x=="object"||x=="function")}function C(b){return!!b&&typeof b=="object"}function S(b){return typeof b=="symbol"||C(b)&&p.call(b)==n}function E(b){if(typeof b=="number")return b;if(S(b))return t;if(y(b)){var x=typeof b.valueOf=="function"?b.valueOf():b;b=y(x)?x+"":x}if(typeof b!="string")return b===0?b:+b;b=b.replace(r,"");var T=s.test(b);return T||i.test(b)?a(b.slice(2),T?2:8):o.test(b)?t:+b}return _c=v,_c}M1();function A1(e=!1){if(typeof e!="boolean")throw new Error("defaultValue must be `true` or `false`");const[t,n]=oe.useState(e),r=oe.useCallback(()=>{n(!0)},[]),o=oe.useCallback(()=>{n(!1)},[]),s=oe.useCallback(()=>{n(i=>!i)},[]);return{value:t,setValue:n,setTrue:r,setFalse:o,toggle:s}}var Yp=typeof window<"u"?oe.useLayoutEffect:oe.useEffect;function D1(e){const[t,n]=oe.useState(e),r=oe.useCallback(()=>{n(i=>i+1)},[]),o=oe.useCallback(()=>{n(i=>i-1)},[]),s=oe.useCallback(()=>{n(e)},[e]);return{count:t,increment:r,decrement:o,reset:s,setCount:n}}function L1(e,t){const n=oe.useRef(e);Yp(()=>{n.current=e},[e]),oe.useEffect(()=>{if(t===null)return;const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}function F1({countStart:e,countStop:t=0,intervalMs:n=1e3,isIncrement:r=!1}){const{count:o,increment:s,decrement:i,reset:a}=D1(e),{value:c,setTrue:u,setFalse:l}=A1(!1),d=oe.useCallback(()=>{l(),a()},[l,a]),p=oe.useCallback(()=>{if(o===t){l();return}r?s():i()},[o,t,i,s,r,l]);return L1(p,c?n:null),[o,{startCountdown:u,stopCountdown:l,resetCountdown:d}]}var V1=typeof window>"u";function z1(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const r=a=>V1?t:window.matchMedia(a).matches,[o,s]=oe.useState(()=>n?r(e):t);function i(){s(r(e))}return Yp(()=>{const a=window.matchMedia(e);return i(),a.addListener?a.addListener(i):a.addEventListener("change",i),()=>{a.removeListener?a.removeListener(i):a.removeEventListener("change",i)}},[e]),o}function Xp({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,zIndex:a,classNames:c}){return z1("(min-width: 1024px)")?w.jsxs(Wa,{open:o,onOpenChange:i,disablePointerDismissal:!0,children:[e&&w.jsx(zs,{className:c?.trigger,children:e}),w.jsxs(Fs,{children:[w.jsx(Za,{style:{zIndex:a},className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),w.jsxs(Ka,{style:{zIndex:a},className:fr("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",c?.desktopPopup),children:[t&&w.jsx(Vs,{className:fr("-mt-1.5 mb-1 text-lg font-medium",c?.title),children:t}),n&&w.jsx(Ya,{className:fr("mb-6 text-base text-gray-600",c?.description),children:n}),s&&w.jsx(Ga,{className:"absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",children:w.jsx(Bp,{})}),w.jsx("div",{children:r})]})]})]}):w.jsxs(yE,{open:o,onOpenChange:i,children:[e&&w.jsx(kE,{className:c?.trigger,children:e}),w.jsxs(gE,{children:[w.jsx(Df,{style:{zIndex:a},className:fr("fixed inset-0 bg-black/70 transition-opacity duration-300 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",c?.backdrop)}),w.jsx(ep,{style:{zIndex:a},className:"fixed inset-0 z-[991]",children:w.jsx(Uf,{className:fr("fixed bottom-0 left-0 right-0 rounded-t-xl bg-white p-4 transition-transform duration-300 data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full","[transform:translateY(var(--drawer-swipe-movement-y))]",c?.mobilePopup),children:w.jsxs(Ff,{children:[w.jsx("div",{"aria-hidden":!0,className:"mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-4"}),w.jsx(IE,{className:"sr-only",children:t}),w.jsx("div",{children:r})]})})})]})]})}function qp({checked:e,onChange:t}){const[n,r]=oe.useState(!1),[o,s]=oe.useState(!1);return w.jsxs("div",{children:[w.jsx(Xp,{title:"用户协议",open:n,onOpenChange:r,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:w.jsx("iframe",{src:"https://www.gatribe.com/license-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),w.jsx(Xp,{title:"隐私政策",open:o,onOpenChange:s,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:w.jsx("iframe",{src:"https://www.gatribe.com/privacy-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),w.jsx(Wr,{name:"rememberLogin",children:w.jsxs(gc,{className:"flex items-center justify-center text-gray-500 text-xs md:text-sm",children:[w.jsx(sc,{checked:e,className:"size-4 md:size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-[var(--jssdk-input-border-color)]",onCheckedChange:i=>t(!!i),children:w.jsx(ic,{children:w.jsx(Pc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),w.jsx("span",{className:"ml-2 text-xs md:text-sm",children:"我已详细阅读并同意"}),w.jsx(Rt,{className:"text-[var(--jssdk-primary-color)] text-xs md:text-sm",onClick:()=>r(!0),type:"button",children:"《用户协议》"}),w.jsx("span",{children:"及"}),w.jsx(Rt,{className:"text-[var(--jssdk-primary-color)] text-xs md:text-sm",onClick:()=>s(!0),type:"button",children:"《隐私政策》"})]})})]})}function Po({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,disablePointerDismissal:a=!1,classNames:c}){return w.jsxs(Wa,{open:o,onOpenChange:i,disablePointerDismissal:a,children:[e&&w.jsx(zs,{className:c?.trigger,children:e}),w.jsxs(Fs,{children:[w.jsx(Za,{className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",forceRender:!0}),w.jsxs(Ka,{className:St("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[990]",c?.popup),children:[t&&w.jsx(Vs,{className:St("-mt-1.5 mb-1 text-lg font-medium",c?.title),children:t}),n&&w.jsx(Ya,{className:St("mb-6 text-base text-gray-600",c?.description),children:n}),s&&w.jsx(Ga,{className:St("absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",c?.close),children:w.jsx(Bp,{})}),w.jsx("div",{children:r})]})]})]})}function Tn({name:e,prefix:t,suffix:n,className:r,inputClassName:o,error:s,...i}){return w.jsxs(Wr,{name:e,className:"group",children:[w.jsxs("div",{className:St("flex items-center border border-[var(--jssdk-input-border-color)] group-data-[focused]:border-[var(--jssdk-primary-color)] group-data-[focused]:shadow-[0_0_6px_color-mix(in_srgb,var(--jssdk-primary-color),transparent_80%)] rounded-full bg-white px-3 gap-2 h-12 transition-all duration-200",s&&"border-red-500",r),children:[t,w.jsx(Gs,{className:St("flex-1 w-0 outline-none rounded-full h-full pl-1",o),...i}),n]}),w.jsx(Zs,{className:"text-red-500 text-xs mt-1 ml-3"})]})}function $1({account:e,forgetPasswordKey:t,onSuccess:n}){const[r,o]=oe.useState(""),[s,i]=oe.useState(!1),{mutate:a,isPending:c}=sn({mutationFn:()=>_1({account:e,forget_password_key:t,password:r}),onSuccess:l=>{l?.code===0||!l?.error?n():gt.warning(l.detail||l.error||"重置失败")}}),u=()=>{if(!r){gt.warning("请输入新密码");return}if(r.length<6||r.length>18){gt.warning("密码长度需要在6-18位之间");return}a()};return w.jsxs("div",{className:"space-y-4",children:[w.jsx("div",{className:"text-sm text-gray-500 mb-4 text-center",children:"请设置新的登录密码"}),w.jsx(Tn,{name:"password",type:s?"text":"password",autoComplete:"off",inputClassName:"placeholder:text-sm",placeholder:"请输入6-18位由数字、字母组成的密码",value:r,autoFocus:!0,onValueChange:l=>o(l),suffix:w.jsx(Rt,{onClick:()=>i(!s),type:"button",children:s?w.jsx(Up,{className:"size-5 text-gray-400"}):w.jsx(Hp,{className:"size-5 text-gray-400"})})}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:u,disabled:!r||c,children:c?"重置中...":"确定修改"})]})}var j1=function(e){return typeof e=="number"};function H1(e){var t=oe.useRef(e);return t.current=e,t}var ei={exports:{}},U1=ei.exports,Kp;function B1(){return Kp||(Kp=1,(function(e,t){(function(n,r){e.exports=r()})(U1,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",i="second",a="minute",c="hour",u="day",l="week",d="month",p="quarter",h="year",m="date",g="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var O=["th","st","nd","rd"],k=N%100;return"["+N+(O[(k-20)%10]||O[k]||O[0])+"]"}},S=function(N,O,k){var _=String(N);return!_||_.length>=O?N:""+Array(O+1-_.length).join(k)+N},E={s:S,z:function(N){var O=-N.utcOffset(),k=Math.abs(O),_=Math.floor(k/60),M=k%60;return(O<=0?"+":"-")+S(_,2,"0")+":"+S(M,2,"0")},m:function N(O,k){if(O.date()<k.date())return-N(k,O);var _=12*(k.year()-O.year())+(k.month()-O.month()),M=O.clone().add(_,d),A=k-M<0,j=O.clone().add(_+(A?-1:1),d);return+(-(_+(k-M)/(A?M-j:j-M))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:d,y:h,w:l,d:u,D:m,h:c,m:a,s:i,ms:s,Q:p}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},b="en",x={};x[b]=C;var T="$isDayjsObject",P=function(N){return N instanceof $||!(!N||!N[T])},z=function N(O,k,_){var M;if(!O)return b;if(typeof O=="string"){var A=O.toLowerCase();x[A]&&(M=A),k&&(x[A]=k,M=A);var j=O.split("-");if(!M&&j.length>1)return N(j[0])}else{var B=O.name;x[B]=O,M=B}return!_&&M&&(b=M),M||!_&&b},I=function(N,O){if(P(N))return N.clone();var k=typeof O=="object"?O:{};return k.date=N,k.args=arguments,new $(k)},D=E;D.l=z,D.i=P,D.w=function(N,O){return I(N,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var $=(function(){function N(k){this.$L=z(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[T]=!0}var O=N.prototype;return O.parse=function(k){this.$d=(function(_){var M=_.date,A=_.utc;if(M===null)return new Date(NaN);if(D.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var j=M.match(v);if(j){var B=j[2]-1||0,U=(j[7]||"0").substring(0,3);return A?new Date(Date.UTC(j[1],B,j[3]||1,j[4]||0,j[5]||0,j[6]||0,U)):new Date(j[1],B,j[3]||1,j[4]||0,j[5]||0,j[6]||0,U)}}return new Date(M)})(k),this.init()},O.init=function(){var k=this.$d;this.$y=k.getFullYear(),this.$M=k.getMonth(),this.$D=k.getDate(),this.$W=k.getDay(),this.$H=k.getHours(),this.$m=k.getMinutes(),this.$s=k.getSeconds(),this.$ms=k.getMilliseconds()},O.$utils=function(){return D},O.isValid=function(){return this.$d.toString()!==g},O.isSame=function(k,_){var M=I(k);return this.startOf(_)<=M&&M<=this.endOf(_)},O.isAfter=function(k,_){return I(k)<this.startOf(_)},O.isBefore=function(k,_){return this.endOf(_)<I(k)},O.$g=function(k,_,M){return D.u(k)?this[_]:this.set(M,k)},O.unix=function(){return Math.floor(this.valueOf()/1e3)},O.valueOf=function(){return this.$d.getTime()},O.startOf=function(k,_){var M=this,A=!!D.u(_)||_,j=D.p(k),B=function(se,ae){var pe=D.w(M.$u?Date.UTC(M.$y,ae,se):new Date(M.$y,ae,se),M);return A?pe:pe.endOf(u)},U=function(se,ae){return D.w(M.toDate()[se].apply(M.toDate("s"),(A?[0,0,0,0]:[23,59,59,999]).slice(ae)),M)},W=this.$W,G=this.$M,Z=this.$D,X="set"+(this.$u?"UTC":"");switch(j){case h:return A?B(1,0):B(31,11);case d:return A?B(1,G):B(0,G+1);case l:var K=this.$locale().weekStart||0,J=(W<K?W+7:W)-K;return B(A?Z-J:Z+(6-J),G);case u:case m:return U(X+"Hours",0);case c:return U(X+"Minutes",1);case a:return U(X+"Seconds",2);case i:return U(X+"Milliseconds",3);default:return this.clone()}},O.endOf=function(k){return this.startOf(k,!1)},O.$set=function(k,_){var M,A=D.p(k),j="set"+(this.$u?"UTC":""),B=(M={},M[u]=j+"Date",M[m]=j+"Date",M[d]=j+"Month",M[h]=j+"FullYear",M[c]=j+"Hours",M[a]=j+"Minutes",M[i]=j+"Seconds",M[s]=j+"Milliseconds",M)[A],U=A===u?this.$D+(_-this.$W):_;if(A===d||A===h){var W=this.clone().set(m,1);W.$d[B](U),W.init(),this.$d=W.set(m,Math.min(this.$D,W.daysInMonth())).$d}else B&&this.$d[B](U);return this.init(),this},O.set=function(k,_){return this.clone().$set(k,_)},O.get=function(k){return this[D.p(k)]()},O.add=function(k,_){var M,A=this;k=Number(k);var j=D.p(_),B=function(G){var Z=I(A);return D.w(Z.date(Z.date()+Math.round(G*k)),A)};if(j===d)return this.set(d,this.$M+k);if(j===h)return this.set(h,this.$y+k);if(j===u)return B(1);if(j===l)return B(7);var U=(M={},M[a]=r,M[c]=o,M[i]=n,M)[j]||1,W=this.$d.getTime()+k*U;return D.w(W,this)},O.subtract=function(k,_){return this.add(-1*k,_)},O.format=function(k){var _=this,M=this.$locale();if(!this.isValid())return M.invalidDate||g;var A=k||"YYYY-MM-DDTHH:mm:ssZ",j=D.z(this),B=this.$H,U=this.$m,W=this.$M,G=M.weekdays,Z=M.months,X=M.meridiem,K=function(ae,pe,Y,me){return ae&&(ae[pe]||ae(_,A))||Y[pe].slice(0,me)},J=function(ae){return D.s(B%12||12,ae,"0")},se=X||function(ae,pe,Y){var me=ae<12?"AM":"PM";return Y?me.toLowerCase():me};return A.replace(y,(function(ae,pe){return pe||(function(Y){switch(Y){case"YY":return String(_.$y).slice(-2);case"YYYY":return D.s(_.$y,4,"0");case"M":return W+1;case"MM":return D.s(W+1,2,"0");case"MMM":return K(M.monthsShort,W,Z,3);case"MMMM":return K(Z,W);case"D":return _.$D;case"DD":return D.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return K(M.weekdaysMin,_.$W,G,2);case"ddd":return K(M.weekdaysShort,_.$W,G,3);case"dddd":return G[_.$W];case"H":return String(B);case"HH":return D.s(B,2,"0");case"h":return J(1);case"hh":return J(2);case"a":return se(B,U,!0);case"A":return se(B,U,!1);case"m":return String(U);case"mm":return D.s(U,2,"0");case"s":return String(_.$s);case"ss":return D.s(_.$s,2,"0");case"SSS":return D.s(_.$ms,3,"0");case"Z":return j}return null})(ae)||j.replace(":","")}))},O.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},O.diff=function(k,_,M){var A,j=this,B=D.p(_),U=I(k),W=(U.utcOffset()-this.utcOffset())*r,G=this-U,Z=function(){return D.m(j,U)};switch(B){case h:A=Z()/12;break;case d:A=Z();break;case p:A=Z()/3;break;case l:A=(G-W)/6048e5;break;case u:A=(G-W)/864e5;break;case c:A=G/o;break;case a:A=G/r;break;case i:A=G/n;break;default:A=G}return M?A:D.a(A)},O.daysInMonth=function(){return this.endOf(d).$D},O.$locale=function(){return x[this.$L]},O.locale=function(k,_){if(!k)return this.$L;var M=this.clone(),A=z(k,_,!0);return A&&(M.$L=A),M},O.clone=function(){return D.w(this.$d,this)},O.toDate=function(){return new Date(this.valueOf())},O.toJSON=function(){return this.isValid()?this.toISOString():null},O.toISOString=function(){return this.$d.toISOString()},O.toString=function(){return this.$d.toUTCString()},N})(),V=$.prototype;return I.prototype=V,[["$ms",s],["$s",i],["$m",a],["$H",c],["$W",u],["$M",d],["$y",h],["$D",m]].forEach((function(N){V[N[1]]=function(O){return this.$g(O,N[0],N[1])}})),I.extend=function(N,O){return N.$i||(N(O,$,I),N.$i=!0),I},I.locale=z,I.isDayjs=P,I.unix=function(N){return I(1e3*N)},I.en=x[b],I.Ls=x,I.p={},I}))})(ei)),ei.exports}var W1=B1();const Z1=zv(W1);var Ic=function(e){if(!e)return 0;var t=Z1(e).valueOf()-Date.now();return t<0?0:t},G1=function(e){return{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}},Jp=function(e){e===void 0&&(e={});var t=e||{},n=t.leftTime,r=t.targetDate,o=t.interval,s=o===void 0?1e3:o,i=t.onEnd,a=oe.useMemo(function(){return j1(n)&&n>0?Date.now()+n:void 0},[n]),c="leftTime"in e?a:r,u=Im(oe.useState(function(){return Ic(c)}),2),l=u[0],d=u[1],p=H1(i);oe.useEffect(function(){if(!c){d(0);return}d(Ic(c));var m=setInterval(function(){var g,v=Ic(c);d(v),v===0&&(clearInterval(m),(g=p.current)===null||g===void 0||g.call(p))},s);return function(){return clearInterval(m)}},[c,s]);var h=oe.useMemo(function(){return G1(l)},[l]);return[l,h]};function Y1({account:e,mobile:t,onNext:n}){const[r,o]=oe.useState(""),[s,i]=oe.useState(),[a]=Jp({leftTime:s?s*1e3:void 0,interval:1e3,onEnd(){i(void 0)}}),{mutate:c,isPending:u}=sn({mutationFn:()=>P1({account:e,type:"reset-password",is_voice:0,t:"ctoken"}),onSuccess:h=>{i(h.lock_time),gt.success("验证码已发送,请注意查收")}}),{mutate:l,isPending:d}=sn({mutationFn:()=>Zp({account:e,captcha:r,t:"reset-password"}),onSuccess:h=>{h?.forget_password_key?n(h.forget_password_key):gt.warning("安全验证失败")},onError:h=>{gt.warning(h?.message||h?.detail||"验证失败")}}),p=()=>{if(!r){gt.warning("请输入验证码");return}l()};return w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"请输入验证码,短信将发送至您的绑定手机"," ",w.jsx("span",{className:"font-semibold text-gray-700",children:t})]}),w.jsx(Tn,{name:"verificationCode",placeholder:"请输入验证码",value:r,type:"number",autoFocus:!0,onValueChange:h=>o(h),suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>c(),disabled:!!s||u,children:u?"发送中...":s?`${Math.round(a/1e3)}s 后重新获取`:"获取验证码"})}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:p,disabled:d,children:d?"验证中...":"下一步"})]})}function X1({account:e,onNext:t}){const[n,r]=oe.useState(""),{mutate:o,isPending:s}=sn({mutationFn:()=>Zp({account:e,idcard:n,t:"reset-password"}),onSuccess:a=>{a?.forget_password_key?t(a.forget_password_key):gt.warning("安全验证失败")}}),i=()=>{if(!n){gt.warning("请输入身份证号");return}o()};return w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"该账号未绑定手机,请输入注册时填写的身份证信息"]}),w.jsx(Tn,{name:"idCard",placeholder:"请输入身份证号",value:n,autoFocus:!0,onChange:a=>r(a.currentTarget.value)}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:i,disabled:s,children:s?"验证中...":"下一步"})]})}function q1({onClose:e,defaultAccount:t=""}){const[n,r]=oe.useState("account"),[o,s]=oe.useState(t),[i,a]=oe.useState(""),[c,u]=oe.useState(2),[l,d]=oe.useState(""),p=oe.useRef(null);oe.useEffect(()=>{if(!window.captchaZtgame){const y=document.createElement("script");y.type="text/javascript",y.src=`//nocaptcha.ztgame.com/static/verify2023/js/captcha.js?t=${new Date().getTime()}`,y.id="captchaZtgameScript",document.body.appendChild(y)}},[]);const{mutate:h,isPending:m}=sn({mutationFn:async y=>O1({account:o,nonce:y.nonce,token:y.token,type:y.type,t:"ctoken"}),onSuccess:y=>{const C=y.type;u(C),a(C===2?y.mobile:""),r("secure"),p.current?.onRefresh?.()},onError:y=>{gt.warning(y?.message||y?.detail||"验证失败"),p.current?.onRefresh?.()}}),g=()=>{if(!o){gt.warning("请输入账号信息");return}window.captchaZtgame?window.captchaZtgame.init({appsceneid:"pt_login",usertype:"1",el:"captcha-forget-pwd",mode:"popup",styles:{width:300,height:150,fontSize:"14px"},popupStyles:{position:"fixed",top:"30%",left:"50%",zIndex:"99999"},onSuccess(y,C){p.current=y,h({nonce:y.nonce,token:C.data.token,type:y.type})},onLoad(y){p.current=y,y.onVerify()},onFail(){}}):gt.warning("安全组件未加载,请稍后再试")},v=y=>{d(y),r("reset")};return w.jsxs("div",{className:"space-y-5",children:[w.jsx("div",{id:"captcha-forget-pwd"}),n==="account"&&w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"请输入您的账号信息"]}),w.jsx(Tn,{name:"account",placeholder:"请输入账号信息",autoFocus:!0,value:o,onChange:y=>s(y.currentTarget.value)}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:g,disabled:!o||m,children:m?"验证中...":"下一步"})]}),n==="secure"&&(c===2?w.jsx(Y1,{account:o,mobile:i,onNext:v}):w.jsx(X1,{account:o,onNext:v})),n==="reset"&&w.jsx($1,{account:o,forgetPasswordKey:l,onSuccess:()=>r("success")}),n==="success"&&w.jsxs("div",{className:"space-y-4 py-6",children:[w.jsx("div",{className:"text-center text-lg font-medium text-gray-800",children:"重置密码成功"}),w.jsx(Rt,{className:"mt-6 h-10 w-full bg-gray-100 text-gray-700 rounded-full hover:bg-gray-200",onClick:()=>e?.(),children:"返回登录"})]})]})}function K1(){const{gameId:e,onAccountLoginSuccess:t,onLoginSuccess:n,onLoginError:r,triggerRealNameAuth:o}=Dn(),s=oe.useRef(null),[i,a]=oe.useState(""),[c,u]=oe.useState(""),[l,d]=oe.useState(!1),[p,h]=oe.useState(!0),[m,g]=oe.useState(!1),{mutate:v,isPending:y}=sn({mutationFn:()=>S1({account:i,password:c}),onSuccess:S=>{const E={account:S.account,entity:S.channel_info.entity,token:S.channel_info.token,sign:S.channel_info.sign,accid:S.channel_info.entity.openid,extra_data:S.channel_info.extra_data,gaplaySign:S.channel_info.gaplaySign,realname:S.channel_info.realname};if(Ns(E,S._auth,e),E.realname&&E.realname.reject>=2){o();return}t?.(E),n?.(E)},onError:S=>{r?.(S)}});async function C(S){if(S.preventDefault(),!p){gt.warning("请先阅读并同意用户协议和隐私政策");return}if(!i||!c){gt.warning("请输入账号和密码");return}v()}return w.jsx(w.Fragment,{children:w.jsxs(To,{ref:s,onSubmit:C,className:"space-y-5",children:[w.jsx(Tn,{name:"account",placeholder:e==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:S=>a(S.currentTarget.value),prefix:e==="5327"?w.jsx(y1,{className:"size-5 text-gray-400"}):w.jsx(R1,{className:"size-5 text-gray-400"})}),w.jsx(Tn,{name:"password",type:l?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:c,onValueChange:S=>u(S),prefix:w.jsx(N1,{className:"size-5 text-gray-400"}),suffix:w.jsx(Rt,{onClick:()=>d(!l),type:"button",children:l?w.jsx(Up,{className:"size-5 text-gray-400"}):w.jsx(Hp,{className:"size-5 text-gray-400"})})}),w.jsxs("section",{children:[w.jsx("div",{className:"flex justify-end mb-1",children:w.jsx(Po,{title:"忘记密码",open:m,onOpenChange:g,trigger:w.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:w.jsx(q1,{onClose:()=>g(!1),defaultAccount:i})})}),w.jsx(Rt,{className:"h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",type:"submit",disabled:y,children:"登录"})]}),w.jsx(Qs,{}),w.jsx(qp,{checked:p,onChange:h})]})})}var Qp;function ee(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){const p=l[d];p in a||(a[p]=u[p].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Gr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eh extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Qp=globalThis).__zod_globalConfig??(Qp.__zod_globalConfig={});const kc=globalThis.__zod_globalConfig;function yr(e){return kc}function th(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Rc(e,t){return typeof t=="bigint"?t.toString():t}function Nc(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mc(e){return e==null}function Ac(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const nh=Symbol("evaluating");function ot(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==nh)return r===void 0&&(r=nh,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Jn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function rh(e){return JSON.stringify(e)}function J1(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const oh="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ti(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Q1=Nc(()=>{if(kc.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function _o(e){if(ti(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ti(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function sh(e){return _o(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const ex=new Set(["string","number","symbol"]);function ni(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ke(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function tx(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function nx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Jn(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return vr(this,"shape",i),i},checks:[]});return Qn(e,s)}function rx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Jn(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return vr(this,"shape",i),i},checks:[]});return Qn(e,s)}function ox(e,t){if(!_o(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Jn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return vr(this,"shape",s),s}});return Qn(e,o)}function sx(e,t){if(!_o(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Jn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vr(this,"shape",r),r}});return Qn(e,n)}function ix(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Jn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return vr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Qn(e,n)}function ax(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Jn(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return vr(this,"shape",c),c},checks:[]});return Qn(t,i)}function cx(e,t,n){const r=Jn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return vr(this,"shape",s),s}});return Qn(t,r)}function Yr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ux(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ih(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ri(e){return typeof e=="string"?e:e?.message}function br(e,t,n){const r=e.message?e.message:ri(e.inst?._zod.def?.error?.(e))??ri(t?.error?.(e))??ri(n.customError?.(e))??ri(n.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=i),a}function Dc(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Io(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ah=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Rc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ch=ee("$ZodError",ah),uh=ee("$ZodError",ah,{Parent:Error});function oi(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function lx(e,t=n=>n.message){const n={_errors:[]},r=(o,s=[])=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{const a=[...s,...i.path];if(a.length===0)n._errors.push(t(i));else{let c=n,u=0;for(;u<a.length;){const l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return r(e),n}const Lc=e=>(t,n,r,o)=>{const s=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Gr;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>br(c,s,yr())));throw oh(a,o?.callee),a}return i.value},Fc=e=>async(t,n,r,o)=>{const s=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>br(c,s,yr())));throw oh(a,o?.callee),a}return i.value},si=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Gr;return s.issues.length?{success:!1,error:new(e??ch)(s.issues.map(i=>br(i,o,yr())))}:{success:!0,data:s.value}},dx=si(uh),ii=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>br(i,o,yr())))}:{success:!0,data:s.value}},fx=ii(uh),px=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Lc(e)(t,n,o)},hx=e=>(t,n,r)=>Lc(e)(t,n,r),mx=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Fc(e)(t,n,o)},gx=e=>async(t,n,r)=>Fc(e)(t,n,r),yx=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return si(e)(t,n,o)},vx=e=>(t,n,r)=>si(e)(t,n,r),bx=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return ii(e)(t,n,o)},wx=e=>async(t,n,r)=>ii(e)(t,n,r),Sx=/^[cC][0-9a-z]{6,}$/,Ex=/^[0-9a-z]+$/,xx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cx=/^[0-9a-vA-V]{20}$/,Tx=/^[A-Za-z0-9]{27}$/,Ox=/^[a-zA-Z0-9_-]{21}$/,Px=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_x=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lh=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ix=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,kx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rx(){return new RegExp(kx,"u")}const Nx=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ax=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Dx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Lx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dh=/^[A-Za-z0-9_-]*$/,Fx=/^https?$/,Vx=/^\+[1-9]\d{6,14}$/,fh="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",zx=new RegExp(`^${fh}$`);function ph(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $x(e){return new RegExp(`^${ph(e)}$`)}function jx(e){const t=ph({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${fh}T(?:${r})$`)}const Hx=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ux=/^[^A-Z]*$/,Bx=/^[^a-z]*$/,On=ee("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Wx=ee("$ZodCheckMaxLength",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=Dc(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Zx=ee("$ZodCheckMinLength",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=Dc(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gx=ee("$ZodCheckLengthEquals",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Dc(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ai=ee("$ZodCheckStringFormat",(e,t)=>{var n,r;On.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Yx=ee("$ZodCheckRegex",(e,t)=>{ai.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xx=ee("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ux),ai.init(e,t)}),qx=ee("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Bx),ai.init(e,t)}),Kx=ee("$ZodCheckIncludes",(e,t)=>{On.init(e,t);const n=ni(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Jx=ee("$ZodCheckStartsWith",(e,t)=>{On.init(e,t);const n=new RegExp(`^${ni(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Qx=ee("$ZodCheckEndsWith",(e,t)=>{On.init(e,t);const n=new RegExp(`.*${ni(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),eC=ee("$ZodCheckOverwrite",(e,t)=>{On.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class tC{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
20
20
  `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
21
21
  `))}}const nC={major:4,minor:4,patch:3},Et=ee("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=nC;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,c)=>{let u=Yr(i),l;for(const d of a){if(d._zod.def.when){if(ux(i)||!d._zod.def.when(i))continue}else if(u)continue;const p=i.issues.length,h=d._zod.check(i);if(h instanceof Promise&&c?.async===!1)throw new Gr;if(l||h instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await h,i.issues.length!==p&&(u||(u=Yr(i,p)))});else{if(i.issues.length===p)continue;u||(u=Yr(i,p))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(Yr(i))return i.aborted=!0,i;const u=o(a,r,c);if(u instanceof Promise){if(c.async===!1)throw new Gr;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Gr;return c.then(u=>o(u,r,a))}return o(c,r,a)}}ot(e,"~standard",()=>({validate:o=>{try{const s=dx(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return fx(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Vc=ee("$ZodString",(e,t)=>{Et.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Hx(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),pt=ee("$ZodStringFormat",(e,t)=>{ai.init(e,t),Vc.init(e,t)}),rC=ee("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_x),pt.init(e,t)}),oC=ee("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lh(r))}else t.pattern??(t.pattern=lh());pt.init(e,t)}),sC=ee("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ix),pt.init(e,t)}),iC=ee("$ZodURL",(e,t)=>{pt.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===Fx.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),aC=ee("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Rx()),pt.init(e,t)}),cC=ee("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ox),pt.init(e,t)}),uC=ee("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Sx),pt.init(e,t)}),lC=ee("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ex),pt.init(e,t)}),dC=ee("$ZodULID",(e,t)=>{t.pattern??(t.pattern=xx),pt.init(e,t)}),fC=ee("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cx),pt.init(e,t)}),pC=ee("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Tx),pt.init(e,t)}),hC=ee("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=jx(t)),pt.init(e,t)}),mC=ee("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=zx),pt.init(e,t)}),gC=ee("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$x(t)),pt.init(e,t)}),yC=ee("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Px),pt.init(e,t)}),vC=ee("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Nx),pt.init(e,t),e._zod.bag.format="ipv4"}),bC=ee("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Mx),pt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),wC=ee("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ax),pt.init(e,t)}),SC=ee("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Dx),pt.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function hh(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const EC=ee("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Lx),pt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{hh(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function xC(e){if(!dh.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return hh(n)}const CC=ee("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=dh),pt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{xC(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),TC=ee("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Vx),pt.init(e,t)});function OC(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const PC=ee("$ZodJWT",(e,t)=>{pt.init(e,t),e._zod.check=n=>{OC(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),_C=ee("$ZodUnknown",(e,t)=>{Et.init(e,t),e._zod.parse=n=>n}),IC=ee("$ZodNever",(e,t)=>{Et.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function mh(e,t,n){e.issues.length&&t.issues.push(...ih(n,e.issues)),t.value[n]=e.value}const kC=ee("$ZodArray",(e,t)=>{Et.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>mh(u,n,i))):mh(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function ci(e,t,n,r,o,s){const i=n in r;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...ih(n,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?i&&(t.value[n]=void 0):t.value[n]=e.value}function gh(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=tx(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function yh(e,t,n,r,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(const p in t){if(p==="__proto__"||a.has(p))continue;if(u==="never"){i.push(p);continue}const h=c.run({value:t[p],issues:[]},r);h instanceof Promise?e.push(h.then(m=>ci(m,n,p,t,l,d))):ci(h,n,p,t,l,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const RC=ee("$ZodObject",(e,t)=>{if(Et.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Nc(()=>gh(t));ot(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(const d of l.values)c[u].add(d)}}return c});const o=ti,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=r.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const l=[],d=i.shape;for(const p of i.keys){const h=d[p],m=h._zod.optin==="optional",g=h._zod.optout==="optional",v=h._zod.run({value:u[p],issues:[]},c);v instanceof Promise?l.push(v.then(y=>ci(y,a,p,u,m,g))):ci(v,a,p,u,m,g)}return s?yh(l,u,a,c,r.value,e):l.length?Promise.all(l).then(()=>a):a}}),NC=ee("$ZodObjectJIT",(e,t)=>{RC.init(e,t);const n=e._zod.parse,r=Nc(()=>gh(t)),o=p=>{const h=new tC(["shape","payload","ctx"]),m=r.value,g=S=>{const E=rh(S);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};h.write("const input = payload.value;");const v=Object.create(null);let y=0;for(const S of m.keys)v[S]=`key_${y++}`;h.write("const newResult = {};");for(const S of m.keys){const E=v[S],b=rh(S),x=p[S],T=x?._zod?.optin==="optional",P=x?._zod?.optout==="optional";h.write(`const ${E} = ${g(S)};`),T&&P?h.write(`
22
22
  if (${E}.issues.length) {