@als-tp/als-react-ts-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +172 -0
- package/dist/als-react-ts-ui.cjs +21 -0
- package/dist/als-react-ts-ui.cjs.map +1 -0
- package/dist/als-react-ts-ui.css +1 -0
- package/dist/als-react-ts-ui.js +11369 -0
- package/dist/als-react-ts-ui.js.map +1 -0
- package/dist/components/ALSAccordion/index.d.ts +67 -0
- package/dist/components/ALSAccordion/index.d.ts.map +1 -0
- package/dist/components/ALSAlertDialog/index.d.ts +5 -0
- package/dist/components/ALSAlertDialog/index.d.ts.map +1 -0
- package/dist/components/ALSAutocomplete/index.d.ts +5 -0
- package/dist/components/ALSAutocomplete/index.d.ts.map +1 -0
- package/dist/components/ALSAvatar/index.d.ts +5 -0
- package/dist/components/ALSAvatar/index.d.ts.map +1 -0
- package/dist/components/ALSButton/index.d.ts +14 -0
- package/dist/components/ALSButton/index.d.ts.map +1 -0
- package/dist/components/ALSCheckbox/index.d.ts +5 -0
- package/dist/components/ALSCheckbox/index.d.ts.map +1 -0
- package/dist/components/ALSCheckboxGroup/index.d.ts +5 -0
- package/dist/components/ALSCheckboxGroup/index.d.ts.map +1 -0
- package/dist/components/ALSCollapsible/index.d.ts +5 -0
- package/dist/components/ALSCollapsible/index.d.ts.map +1 -0
- package/dist/components/ALSCombobox/index.d.ts +5 -0
- package/dist/components/ALSCombobox/index.d.ts.map +1 -0
- package/dist/components/ALSContextMenu/index.d.ts +5 -0
- package/dist/components/ALSContextMenu/index.d.ts.map +1 -0
- package/dist/components/ALSDialog/index.d.ts +79 -0
- package/dist/components/ALSDialog/index.d.ts.map +1 -0
- package/dist/components/ALSField/index.d.ts +5 -0
- package/dist/components/ALSField/index.d.ts.map +1 -0
- package/dist/components/ALSFieldset/index.d.ts +5 -0
- package/dist/components/ALSFieldset/index.d.ts.map +1 -0
- package/dist/components/ALSForm/index.d.ts +5 -0
- package/dist/components/ALSForm/index.d.ts.map +1 -0
- package/dist/components/ALSInput/index.d.ts +51 -0
- package/dist/components/ALSInput/index.d.ts.map +1 -0
- package/dist/components/ALSMenu/index.d.ts +5 -0
- package/dist/components/ALSMenu/index.d.ts.map +1 -0
- package/dist/components/ALSMenubar/index.d.ts +5 -0
- package/dist/components/ALSMenubar/index.d.ts.map +1 -0
- package/dist/components/ALSMeter/index.d.ts +5 -0
- package/dist/components/ALSMeter/index.d.ts.map +1 -0
- package/dist/components/ALSNavigationMenu/index.d.ts +5 -0
- package/dist/components/ALSNavigationMenu/index.d.ts.map +1 -0
- package/dist/components/ALSNumberField/index.d.ts +5 -0
- package/dist/components/ALSNumberField/index.d.ts.map +1 -0
- package/dist/components/ALSPopover/index.d.ts +50 -0
- package/dist/components/ALSPopover/index.d.ts.map +1 -0
- package/dist/components/ALSPreviewCard/index.d.ts +5 -0
- package/dist/components/ALSPreviewCard/index.d.ts.map +1 -0
- package/dist/components/ALSProgress/index.d.ts +5 -0
- package/dist/components/ALSProgress/index.d.ts.map +1 -0
- package/dist/components/ALSRadio/index.d.ts +5 -0
- package/dist/components/ALSRadio/index.d.ts.map +1 -0
- package/dist/components/ALSScrollArea/index.d.ts +5 -0
- package/dist/components/ALSScrollArea/index.d.ts.map +1 -0
- package/dist/components/ALSSelect/index.d.ts +41 -0
- package/dist/components/ALSSelect/index.d.ts.map +1 -0
- package/dist/components/ALSSeparator/index.d.ts +5 -0
- package/dist/components/ALSSeparator/index.d.ts.map +1 -0
- package/dist/components/ALSSlider/index.d.ts +5 -0
- package/dist/components/ALSSlider/index.d.ts.map +1 -0
- package/dist/components/ALSSwitch/index.d.ts +5 -0
- package/dist/components/ALSSwitch/index.d.ts.map +1 -0
- package/dist/components/ALSTabs/index.d.ts +5 -0
- package/dist/components/ALSTabs/index.d.ts.map +1 -0
- package/dist/components/ALSToast/index.d.ts +94 -0
- package/dist/components/ALSToast/index.d.ts.map +1 -0
- package/dist/components/ALSToggle/index.d.ts +5 -0
- package/dist/components/ALSToggle/index.d.ts.map +1 -0
- package/dist/components/ALSToggleGroup/index.d.ts +5 -0
- package/dist/components/ALSToggleGroup/index.d.ts.map +1 -0
- package/dist/components/ALSToolbar/index.d.ts +5 -0
- package/dist/components/ALSToolbar/index.d.ts.map +1 -0
- package/dist/components/ALSTooltip/index.d.ts +5 -0
- package/dist/components/ALSTooltip/index.d.ts.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/layout/MainLayout/index.d.ts +68 -0
- package/dist/layout/MainLayout/index.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),ne=require("react"),Sl=require("react-dom");function ui(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const a=ui(ne),rt=ui(Sl);function Cn({controlled:e,default:t,name:n,state:o="value"}){const{current:r}=a.useRef(e!==void 0),[s,i]=a.useState(t),c=r?e:s;if(process.env.NODE_ENV!=="production"){a.useEffect(()=>{r!==(e!==void 0)&&console.error([`Base UI: A component is changing the ${r?"":"un"}controlled ${o} state of ${n} to be ${r?"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(`
|
|
2
|
+
`))},[o,n,e]);const{current:l}=a.useRef(t);a.useEffect(()=>{!r&&JSON.stringify(l)!==JSON.stringify(t)&&console.error([`Base UI: A component is changing the default ${o} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
|
|
3
|
+
`))},[JSON.stringify(t)])}const u=a.useCallback(l=>{r||i(l)},[]);return[c,u]}const gs={};function Je(e,t){const n=a.useRef(gs);return n.current===gs&&(n.current=e(t)),n}const Ao=a[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],wl=Ao&&Ao!==a.useLayoutEffect?Ao:e=>e();function Q(e){const t=Je(Rl).current;return t.next=e,wl(t.effect),t.trampoline}function Rl(){const e={next:void 0,callback:Cl,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Cl(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}const _l=()=>{},X=typeof document<"u"?a.useLayoutEffect:_l;let Go;process.env.NODE_ENV!=="production"&&(Go=new Set);function mr(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");Go.has(t)||(Go.add(t),console.warn(`Base UI: ${t}`))}}const gr=a.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});process.env.NODE_ENV!=="production"&&(gr.displayName="CompositeListContext");function Tl(){return a.useContext(gr)}function fi(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:r}=e,s=Q(r),i=a.useRef(0),c=Je(Pl).current,u=Je(Ol).current,[l,f]=a.useState(0),d=a.useRef(l),p=Q((b,y)=>{u.set(b,y??null),d.current+=1,f(d.current)}),m=Q(b=>{u.delete(b),d.current+=1,f(d.current)}),g=a.useMemo(()=>{const b=new Map;return Array.from(u.keys()).sort(Al).forEach((x,v)=>{const R=u.get(x)??{};b.set(x,{...R,index:v})}),b},[u,l]);X(()=>{if(typeof MutationObserver!="function"||g.size===0)return;const b=new MutationObserver(y=>{const x=new Set,v=R=>x.has(R)?x.delete(R):x.add(R);y.forEach(R=>{R.removedNodes.forEach(v),R.addedNodes.forEach(v)}),x.size===0&&(d.current+=1,f(d.current))});return g.forEach((y,x)=>{x.parentElement&&b.observe(x.parentElement,{childList:!0})}),()=>{b.disconnect()}},[g]),X(()=>{d.current===l&&(n.current.length!==g.size&&(n.current.length=g.size),o&&o.current.length!==g.size&&(o.current.length=g.size),i.current=g.size),s(g)},[s,g,n,o,l]),X(()=>()=>{n.current=[]},[n]),X(()=>()=>{o&&(o.current=[])},[o]);const h=Q(b=>(c.add(b),()=>{c.delete(b)}));X(()=>{c.forEach(b=>b(g))},[c,g]);const E=a.useMemo(()=>({register:p,unregister:m,subscribeMapChange:h,elementsRef:n,labelsRef:o,nextIndexRef:i}),[p,m,h,n,o,i]);return P.jsx(gr.Provider,{value:E,children:t})}function Ol(){return new Map}function Pl(){return new Set}function Al(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const di=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(di.displayName="DirectionContext");function hr(){return a.useContext(di)?.direction??"ltr"}function Ae(e,...t){const n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(o=>n.searchParams.append("args[]",o)),`Base UI error #${e}; visit ${n} for the full message.`}const yr=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(yr.displayName="AccordionRootContext");function br(){const e=a.useContext(yr);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: AccordionRootContext is missing. Accordion parts must be placed within <Accordion.Root>.":Ae(10));return e}function Pt(e,t,n,o){const r=Je(pi).current;return Il(r,e,t,n,o)&&mi(r,[e,t,n,o]),r.callback}function Nl(e){const t=Je(pi).current;return Ml(t,e)&&mi(t,e),t.callback}function pi(){return{callback:null,cleanup:null,refs:[]}}function Il(e,t,n,o,r){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==r}function Ml(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}function mi(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const o=Array(t.length).fill(null);for(let r=0;r<t.length;r+=1){const s=t[r];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(o[r]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let r=0;r<t.length;r+=1){const s=t[r];if(s!=null)switch(typeof s){case"function":{const i=o[r];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}const Dl=parseInt(a.version,10);function gi(e){return Dl>=e}function hs(e){if(!a.isValidElement(e))return null;const t=e,n=t.props;return(gi(19)?n?.ref:t.ref)??null}function Yo(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Ll(e,t){const n={};for(const o in e){const r=e[o];if(t?.hasOwnProperty(o)){const s=t[o](r);s!=null&&Object.assign(n,s);continue}r===!0?n[`data-${o.toLowerCase()}`]="":r&&(n[`data-${o.toLowerCase()}`]=r.toString())}return n}function kl(e,t){return typeof e=="function"?e(t):e}function Fl(e,t){return typeof e=="function"?e(t):e}const xn={};function vr(e,t,n,o,r){let s={...Xo(e,xn)};return t&&(s=vn(s,t)),n&&(s=vn(s,n)),o&&(s=vn(s,o)),r&&(s=vn(s,r)),s}function Vl(e){if(e.length===0)return xn;if(e.length===1)return Xo(e[0],xn);let t={...Xo(e[0],xn)};for(let n=1;n<e.length;n+=1)t=vn(t,e[n]);return t}function vn(e,t){return hi(t)?t(e):jl(e,t)}function jl(e,t){if(!t)return e;for(const n in t){const o=t[n];switch(n){case"style":{e[n]=Yo(e.style,o);break}case"className":{e[n]=yi(e.className,o);break}default:$l(n,o)?e[n]=Bl(e[n],o):e[n]=o}}return e}function $l(e,t){const n=e.charCodeAt(0),o=e.charCodeAt(1),r=e.charCodeAt(2);return n===111&&o===110&&r>=65&&r<=90&&(typeof t=="function"||typeof t>"u")}function hi(e){return typeof e=="function"}function Xo(e,t){return hi(e)?e(t):e??xn}function Bl(e,t){return t?e?n=>{if(Hl(n)){const r=n;Zo(r);const s=t(r);return r.baseUIHandlerPrevented||e?.(r),s}const o=t(n);return e?.(n),o}:t:e}function Zo(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function yi(e,t){return t?e?t+" "+e:t:e}function Hl(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function nt(){}const Jo=Object.freeze([]),ze=Object.freeze({}),zl=500,Ul={style:{transition:"none"}},Er="data-base-ui-click-trigger",Wl={fallbackAxisSide:"none"},ql={fallbackAxisSide:"end"},Kl={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function ye(e,t,n={}){const o=t.render,r=Gl(t,n);if(n.enabled===!1)return null;const s=n.state??ze;return Yl(e,o,r,s)}function Gl(e,t={}){const{className:n,style:o,render:r}=e,{state:s=ze,ref:i,props:c,stateAttributesMapping:u,enabled:l=!0}=t,f=l?kl(n,s):void 0,d=l?Fl(o,s):void 0,p=l?Ll(s,u):ze,m=l?Yo(p,Array.isArray(c)?Vl(c):c)??ze:ze;return typeof document<"u"&&(l?Array.isArray(i)?m.ref=Nl([m.ref,hs(r),...i]):m.ref=Pt(m.ref,hs(r),i):Pt(null,null)),l?(f!==void 0&&(m.className=yi(m.className,f)),d!==void 0&&(m.style=Yo(m.style,d)),m):ze}function Yl(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);const r=vr(n,t.props);return r.ref=n.ref,a.cloneElement(t,r)}if(e&&typeof e=="string")return Xl(e,n);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":Ae(8))}function Xl(e,t){return e==="button"?ne.createElement("button",{type:"button",...t,key:t.key}):e==="img"?ne.createElement("img",{alt:"",...t,key:t.key}):a.createElement(e,t)}const ln="none",ht="trigger-press",ot="trigger-hover",bi="outside-press",No="item-press",vi="close-press",Ut="focus-out",Ei="escape-key",Io="list-navigation",Zl="cancel-open",xi="imperative-action",Jl="window-resize";function ge(e,t,n,o){let r=!1,s=!1;const i=ze;return{reason:e,event:t??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...i}}const Ql={value:()=>null},Si=a.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,hiddenUntilFound:i,keepMounted:c,loopFocus:u=!0,onValueChange:l,multiple:f=!1,orientation:d="vertical",value:p,defaultValue:m,...g}=t,h=hr();process.env.NODE_ENV!=="production"&&X(()=>{i&&c===!1&&mr("The `keepMounted={false}` prop on a Accordion.Root will be ignored when using `hiddenUntilFound` since it requires Panels to remain mounted when closed.")},[i,c]);const E=a.useMemo(()=>{if(p===void 0)return m??[]},[p,m]),b=Q(l),y=a.useRef([]),[x,v]=Cn({controlled:p,default:E,name:"Accordion",state:"value"}),R=Q((F,L)=>{const k=ge(ln);if(f)if(L){const A=x.slice();if(A.push(F),b(A,k),k.isCanceled)return;v(A)}else{const A=x.filter(w=>w!==F);if(b(A,k),k.isCanceled)return;v(A)}else{const A=x[0]===F?[]:[F];if(b(A,k),k.isCanceled)return;v(A)}}),_=a.useMemo(()=>({value:x,disabled:s,orientation:d}),[x,s,d]),T=a.useMemo(()=>({accordionItemRefs:y,direction:h,disabled:s,handleValueChange:R,hiddenUntilFound:i??!1,keepMounted:c??!1,loopFocus:u,orientation:d,state:_,value:x}),[h,s,R,i,c,u,d,_,x]),N=ye("div",t,{state:_,ref:n,props:[{dir:h,role:"region"},g],stateAttributesMapping:Ql});return P.jsx(yr.Provider,{value:T,children:P.jsx(fi,{elementsRef:y,children:N})})});process.env.NODE_ENV!=="production"&&(Si.displayName="AccordionRoot");const eu={...a};let ys=0;function tu(e,t="mui"){const[n,o]=a.useState(e),r=e||n;return a.useEffect(()=>{n==null&&(ys+=1,o(`${t}-${ys}`))},[n,t]),r}const bs=eu.useId;function Nt(e,t){if(bs!==void 0){const n=bs();return e??(t?`${t}-${n}`:n)}return tu(e,t)}function ut(e){return Nt(e,"base-ui")}const nu=[];function io(e){a.useEffect(e,nu)}const Ln=null;let vs=globalThis.requestAnimationFrame;class ou{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let r=0;r<n.length;r+=1)n[r]?.(t)};request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const o=process.env.NODE_ENV==="test"&&vs!==requestAnimationFrame&&(vs=requestAnimationFrame,!0);return(!this.isScheduled||o)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const kn=new ou;class Ie{static create(){return new Ie}static request(t){return kn.request(t)}static cancel(t){return kn.cancel(t)}currentId=Ln;request(t){this.cancel(),this.currentId=kn.request(()=>{this.currentId=Ln,t()})}cancel=()=>{this.currentId!==Ln&&(kn.cancel(this.currentId),this.currentId=Ln)};disposeEffect=()=>this.cancel}function un(){const e=Je(Ie.create).current;return io(e.disposeEffect),e}function Bt(e){return e==null?e:"current"in e?e.current:e}function co(e,t=!1,n=!0){const o=un();return Q((r,s=null)=>{o.cancel();const i=Bt(e);i!=null&&(typeof i.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?r():o.request(()=>{function c(){i&&Promise.all(i.getAnimations().map(u=>u.finished)).then(()=>{s!=null&&s.aborted||rt.flushSync(r)}).catch(()=>{if(n){if(s!=null&&s.aborted)return;rt.flushSync(r)}else i.getAnimations().length>0&&i.getAnimations().some(u=>u.pending||u.playState!=="finished")&&c()})}t?o.request(c):c()}))})}function ao(e,t=!1,n=!1){const[o,r]=a.useState(e&&t?"idle":void 0),[s,i]=a.useState(e);return e&&!s&&(i(!0),r("starting")),!e&&s&&o!=="ending"&&!n&&r("ending"),!e&&!s&&o==="ending"&&r(void 0),X(()=>{if(!e&&s&&o!=="ending"&&n){const c=Ie.request(()=>{r("ending")});return()=>{Ie.cancel(c)}}},[e,s,o,n]),X(()=>{if(!e||t)return;const c=Ie.request(()=>{rt.flushSync(()=>{r(void 0)})});return()=>{Ie.cancel(c)}},[t,e]),X(()=>{if(!e||!t)return;e&&s&&o!=="idle"&&r("starting");const c=Ie.request(()=>{r("idle")});return()=>{Ie.cancel(c)}},[t,e,s,r,o]),a.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:o}),[s,o])}function ru(e){const{open:t,defaultOpen:n,onOpenChange:o,disabled:r}=e,s=t!==void 0,[i,c]=Cn({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:u,setMounted:l,transitionStatus:f}=ao(i,!0,!0),[d,p]=a.useState(i),[{height:m,width:g},h]=a.useState({height:void 0,width:void 0}),E=ut(),[b,y]=a.useState(),x=b??E,[v,R]=a.useState(!1),[_,T]=a.useState(!1),N=a.useRef(null),F=a.useRef(null),L=a.useRef(null),k=a.useRef(null),A=co(k,!1),w=Q(I=>{const C=!i,O=ge(ht,I.nativeEvent);if(o(C,O),O.isCanceled)return;const D=k.current;F.current==="css-animation"&&D!=null&&D.style.removeProperty("animation-name"),!v&&!_&&(F.current!=null&&F.current!=="css-animation"&&!u&&C&&l(!0),F.current==="css-animation"&&(!d&&C&&p(!0),!u&&C&&l(!0))),c(C),F.current==="none"&&u&&!C&&l(!1)});return X(()=>{s&&F.current==="none"&&!_&&!i&&l(!1)},[s,_,i,t,l]),a.useMemo(()=>({abortControllerRef:N,animationTypeRef:F,disabled:r,handleTrigger:w,height:m,mounted:u,open:i,panelId:x,panelRef:k,runOnceAnimationsFinish:A,setDimensions:h,setHiddenUntilFound:R,setKeepMounted:T,setMounted:l,setOpen:c,setPanelIdState:y,setVisible:p,transitionDimensionRef:L,transitionStatus:f,visible:d,width:g}),[N,F,r,w,m,u,i,x,k,A,h,R,T,l,c,p,L,f,d,g])}const xr=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(xr.displayName="CollapsibleRootContext");function wi(){const e=a.useContext(xr);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>.":Ae(15));return e}let Ri=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Ci(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:r,index:s}=e,{register:i,unregister:c,subscribeMapChange:u,elementsRef:l,labelsRef:f,nextIndexRef:d}=Tl(),p=a.useRef(-1),[m,g]=a.useState(s??(r===Ri.GuessFromOrder?()=>{if(p.current===-1){const b=d.current;d.current+=1,p.current=b}return p.current}:-1)),h=a.useRef(null),E=a.useCallback(b=>{if(h.current=b,m!==-1&&b!==null&&(l.current[m]=b,f)){const y=t!==void 0;f.current[m]=y?t:o?.current?.textContent??b.textContent}},[m,l,f,t,o]);return X(()=>{if(s!=null)return;const b=h.current;if(b)return i(b,n),()=>{c(b)}},[s,i,c,n]),X(()=>{if(s==null)return u(b=>{const y=h.current?b.get(h.current)?.index:null;y!=null&&g(y)})},[s,u,g]),a.useMemo(()=>({ref:E,index:m}),[m,E])}const Sr=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(Sr.displayName="AccordionItemContext");function wr(){const e=a.useContext(Sr);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: AccordionItemContext is missing. Accordion parts must be placed within <Accordion.Item>.":Ae(9));return e}let nn=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const su={[nn.startingStyle]:""},iu={[nn.endingStyle]:""},It={transitionStatus(e){return e==="starting"?su:e==="ending"?iu:null}};let Sn=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=nn.startingStyle]="startingStyle",e[e.endingStyle=nn.endingStyle]="endingStyle",e})({}),cu=(function(e){return e.panelOpen="data-panel-open",e})({});const au={[Sn.open]:""},lu={[Sn.closed]:""},uu={open(e){return e?{[cu.panelOpen]:""}:null}},fu={open(e){return e?au:lu}};let du=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const Rr={...fu,index:e=>Number.isInteger(e)?{[du.index]:String(e)}:null,...It,value:()=>null},_i=a.forwardRef(function(t,n){const{className:o,disabled:r=!1,onOpenChange:s,render:i,value:c,...u}=t,{ref:l,index:f}=Ci(),d=Pt(n,l),{disabled:p,handleValueChange:m,state:g,value:h}=br(),E=ut(),b=c??E,y=r||p,x=a.useMemo(()=>{if(!h)return!1;for(let w=0;w<h.length;w+=1)if(h[w]===b)return!0;return!1},[h,b]),v=Q((w,I)=>{s?.(w,I),!I.isCanceled&&m(b,w)}),R=ru({open:x,onOpenChange:v,disabled:y}),_=a.useMemo(()=>({open:R.open,disabled:R.disabled,hidden:!R.mounted,transitionStatus:R.transitionStatus}),[R.open,R.disabled,R.mounted,R.transitionStatus]),T=a.useMemo(()=>({...R,onOpenChange:v,state:_}),[R,_,v]),N=a.useMemo(()=>({...g,index:f,disabled:y,open:x}),[y,f,x,g]),[F,L]=a.useState(ut()),k=a.useMemo(()=>({open:x,state:N,setTriggerId:L,triggerId:F}),[x,N,L,F]),A=ye("div",t,{state:N,ref:d,props:u,stateAttributesMapping:Rr});return P.jsx(xr.Provider,{value:T,children:P.jsx(Sr.Provider,{value:k,children:A})})});process.env.NODE_ENV!=="production"&&(_i.displayName="AccordionItem");const Ti=a.forwardRef(function(t,n){const{render:o,className:r,...s}=t,{state:i}=wr();return ye("h3",t,{state:i,ref:n,props:s,stateAttributesMapping:Rr})});process.env.NODE_ENV!=="production"&&(Ti.displayName="AccordionHeader");function Es(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function lo(){return typeof window<"u"}function Mt(e){return Cr(e)?(e.nodeName||"").toLowerCase():"#document"}function De(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mt(e){var t;return(t=(Cr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Cr(e){return lo()?e instanceof Node||e instanceof De(e).Node:!1}function _e(e){return lo()?e instanceof Element||e instanceof De(e).Element:!1}function Me(e){return lo()?e instanceof HTMLElement||e instanceof De(e).HTMLElement:!1}function Qo(e){return!lo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof De(e).ShadowRoot}const pu=new Set(["inline","contents"]);function Kt(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Qe(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!pu.has(r)}const mu=new Set(["table","td","th"]);function gu(e){return mu.has(Mt(e))}const hu=[":popover-open",":modal"];function uo(e){return hu.some(t=>{try{return e.matches(t)}catch{return!1}})}const yu=["transform","translate","scale","rotate","perspective"],bu=["transform","translate","scale","rotate","perspective","filter"],vu=["paint","layout","strict","content"];function _r(e){const t=fo(),n=_e(e)?Qe(e):e;return yu.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||bu.some(o=>(n.willChange||"").includes(o))||vu.some(o=>(n.contain||"").includes(o))}function Eu(e){let t=vt(e);for(;Me(t)&&!yt(t);){if(_r(t))return t;if(uo(t))return null;t=vt(t)}return null}function fo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const xu=new Set(["html","body","#document"]);function yt(e){return xu.has(Mt(e))}function Qe(e){return De(e).getComputedStyle(e)}function po(e){return _e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function vt(e){if(Mt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qo(e)&&e.host||mt(e);return Qo(t)?t.host:t}function Oi(e){const t=vt(e);return yt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Me(t)&&Kt(t)?t:Oi(t)}function _t(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Oi(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),i=De(r);if(s){const c=er(i);return t.concat(i,i.visualViewport||[],Kt(r)?r:[],c&&n?_t(c):[])}return t.concat(r,_t(r,[],n))}function er(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}let tr;process.env.NODE_ENV!=="production"&&(tr=new Set);function xs(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");tr.has(t)||(tr.add(t),console.error(`Base UI: ${t}`))}}const Pi=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(Pi.displayName="CompositeRootContext");function Su(e=!1){const t=a.useContext(Pi);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>.":Ae(16));return t}function wu(e){const{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:r=0,isNativeButton:s}=e,i=o&&t!==!1,c=o&&t===!1;return{props:a.useMemo(()=>{const l={onKeyDown(f){n&&t&&f.key!=="Tab"&&f.preventDefault()}};return o||(l.tabIndex=r,!s&&n&&(l.tabIndex=t?r:-1)),(s&&(t||i)||!s&&n)&&(l["aria-disabled"]=n),s&&(!t||c)&&(l.disabled=n),l},[o,n,t,i,c,s,r])}}function St(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:o=0,native:r=!0}=e,s=a.useRef(null),i=Su(!0)!==void 0,c=Q(()=>{const p=s.current;return!!(p?.tagName==="A"&&p?.href)}),{props:u}=wu({focusableWhenDisabled:n,disabled:t,composite:i,tabIndex:o,isNativeButton:r});process.env.NODE_ENV!=="production"&&a.useEffect(()=>{if(!s.current)return;const p=s.current.tagName==="BUTTON";r?p||xs("A component that acts as a button was not rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is a real <button>, or set the `nativeButton` prop on the component to `false`."):p&&xs("A component that acts as a button was rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is not a real <button>, or set the `nativeButton` prop on the component to `true`.")},[r]);const l=a.useCallback(()=>{const p=s.current;Ru(p)&&i&&t&&u.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,u.disabled,i]);X(l,[l]);const f=a.useCallback((p={})=>{const{onClick:m,onMouseDown:g,onKeyUp:h,onKeyDown:E,onPointerDown:b,...y}=p;return vr({type:r?"button":void 0,onClick(v){if(t){v.preventDefault();return}m?.(v)},onMouseDown(v){t||g?.(v)},onKeyDown(v){if(t||(Zo(v),E?.(v)),v.baseUIHandlerPrevented)return;const R=v.target===v.currentTarget&&!r&&!c()&&!t,_=v.key==="Enter",T=v.key===" ";R&&((T||_)&&v.preventDefault(),_&&m?.(v))},onKeyUp(v){t||(Zo(v),h?.(v)),!v.baseUIHandlerPrevented&&v.target===v.currentTarget&&!r&&!t&&v.key===" "&&m?.(v)},onPointerDown(v){if(t){v.preventDefault();return}b?.(v)}},r?void 0:{role:"button"},u,y)},[t,u,r,c]),d=Q(p=>{s.current=p,l()});return{getButtonProps:f,buttonRef:d}}function Ru(e){return Me(e)&&e.tagName==="BUTTON"}const fn=typeof navigator<"u",Mo=Tu(),Ai=Pu(),Ni=Ou(),Ii=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Cu=Mo.platform==="MacIntel"&&Mo.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Mo.platform),_u=fn&&/apple/i.test(navigator.vendor),nr=fn&&/android/i.test(Ai)||/android/i.test(Ni);fn&&Ai.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const Mi=Ni.includes("jsdom/");function Tu(){if(!fn)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Ou(){if(!fn)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function Pu(){if(!fn)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const or="data-base-ui-focusable",Di="active",Li="selected",ki="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Tt="ArrowLeft",Ot="ArrowRight",Tr="ArrowUp",Nn="ArrowDown";function ct(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function xe(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Qo(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function qe(e){return"composedPath"in e?e.composedPath()[0]:e.target}function lt(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Au(e){return e.matches("html,body")}function Le(e){return e?.ownerDocument||document}function Fi(e){return Me(e)&&e.matches(ki)}function rr(e){return e?e.getAttribute("role")==="combobox"&&Fi(e):!1}function sr(e){if(!e||Mi)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function _n(e){return e?e.hasAttribute(or)?e:e.querySelector(`[${or}]`)||e:null}function zt(e,t,n=!0){return e.filter(r=>r.parentId===t&&(!n||r.context?.open)).flatMap(r=>[r,...zt(e,r.id,n)])}function Ss(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){const r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function He(e){e.preventDefault(),e.stopPropagation()}function Nu(e){return"nativeEvent"in e}function Vi(e){return e.mozInputSource===0&&e.isTrusted?!0:nr&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function ji(e){return Mi?!1:!nr&&e.width===0&&e.height===0||nr&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function on(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}const Iu=["top","right","bottom","left"],rn=Math.min,tt=Math.max,sn=Math.round,Zt=Math.floor,ft=e=>({x:e,y:e}),Mu={left:"right",right:"left",bottom:"top",top:"bottom"},Du={start:"end",end:"start"};function ir(e,t,n){return tt(e,rn(t,n))}function Et(e,t){return typeof e=="function"?e(t):e}function Ze(e){return e.split("-")[0]}function Dt(e){return e.split("-")[1]}function Or(e){return e==="x"?"y":"x"}function Pr(e){return e==="y"?"height":"width"}const Lu=new Set(["top","bottom"]);function at(e){return Lu.has(Ze(e))?"y":"x"}function Ar(e){return Or(at(e))}function ku(e,t,n){n===void 0&&(n=!1);const o=Dt(e),r=Ar(e),s=Pr(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Jn(i)),[i,Jn(i)]}function Fu(e){const t=Jn(e);return[cr(e),t,cr(t)]}function cr(e){return e.replace(/start|end/g,t=>Du[t])}const ws=["left","right"],Rs=["right","left"],Vu=["top","bottom"],ju=["bottom","top"];function $u(e,t,n){switch(e){case"top":case"bottom":return n?t?Rs:ws:t?ws:Rs;case"left":case"right":return t?Vu:ju;default:return[]}}function Bu(e,t,n,o){const r=Dt(e);let s=$u(Ze(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(cr)))),s}function Jn(e){return e.replace(/left|right|bottom|top/g,t=>Mu[t])}function Hu(e){return{top:0,right:0,bottom:0,left:0,...e}}function $i(e){return typeof e!="number"?Hu(e):{top:e,right:e,bottom:e,left:e}}function Qn(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Fn(e,t,n){return Math.floor(e/t)!==n}function wn(e,t){return t<0||t>=e.current.length}function Do(e,t){return We(e,{disabledIndices:t})}function Cs(e,t){return We(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function We(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:r=1}={}){let s=t;do s+=n?-r:r;while(s>=0&&s<=e.current.length-1&&Rn(e,s,o));return s}function zu(e,{event:t,orientation:n,loopFocus:o,rtl:r,cols:s,disabledIndices:i,minIndex:c,maxIndex:u,prevIndex:l,stopEvent:f=!1}){let d=l;const p=[],m={};let g=!1;{let b=null,y=-1;e.current.forEach((x,v)=>{if(x==null)return;const R=x.closest('[role="row"]');R&&(g=!0),(R!==b||y===-1)&&(b=R,y+=1,p[y]=[]),p[y].push(v),m[v]=y})}const h=g&&p.length>0&&p.some(b=>b.length!==s);function E(b){if(!h||l===-1)return;const y=m[l];if(y==null)return;const x=p[y].indexOf(l);let v=b==="up"?y-1:y+1;o&&(v<0?v=p.length-1:v>=p.length&&(v=0));const R=new Set;for(;v>=0&&v<p.length&&!R.has(v);){R.add(v);const _=p[v];if(_.length===0){v=b==="up"?v-1:v+1;continue}const T=Math.min(x,_.length-1);for(let N=T;N>=0;N-=1){const F=_[N];if(!Rn(e,F,i))return F}v=b==="up"?v-1:v+1,o&&(v<0?v=p.length-1:v>=p.length&&(v=0))}}if(t.key===Tr){const b=E("up");if(b!==void 0)f&&He(t),d=b;else{if(f&&He(t),l===-1)d=u;else if(d=We(e,{startingIndex:d,amount:s,decrement:!0,disabledIndices:i}),o&&(l-s<c||d<0)){const y=l%s,x=u%s,v=u-(x-y);x===y?d=u:d=x>y?v:v-s}wn(e,d)&&(d=l)}}if(t.key===Nn){const b=E("down");b!==void 0?(f&&He(t),d=b):(f&&He(t),l===-1?d=c:(d=We(e,{startingIndex:l,amount:s,disabledIndices:i}),o&&l+s>u&&(d=We(e,{startingIndex:l%s-s,amount:s,disabledIndices:i}))),wn(e,d)&&(d=l))}if(n==="both"){const b=Zt(l/s);t.key===(r?Tt:Ot)&&(f&&He(t),l%s!==s-1?(d=We(e,{startingIndex:l,disabledIndices:i}),o&&Fn(d,s,b)&&(d=We(e,{startingIndex:l-l%s-1,disabledIndices:i}))):o&&(d=We(e,{startingIndex:l-l%s-1,disabledIndices:i})),Fn(d,s,b)&&(d=l)),t.key===(r?Ot:Tt)&&(f&&He(t),l%s!==0?(d=We(e,{startingIndex:l,decrement:!0,disabledIndices:i}),o&&Fn(d,s,b)&&(d=We(e,{startingIndex:l+(s-l%s),decrement:!0,disabledIndices:i}))):o&&(d=We(e,{startingIndex:l+(s-l%s),decrement:!0,disabledIndices:i})),Fn(d,s,b)&&(d=l));const y=Zt(u/s)===b;wn(e,d)&&(o&&y?d=t.key===(r?Ot:Tt)?u:We(e,{startingIndex:l-l%s-1,disabledIndices:i}):d=l)}return d}function Uu(e,t,n){const o=[];let r=0;return e.forEach(({width:s,height:i},c)=>{if(s>t&&process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV!=="production"?`[Floating UI]: Invalid grid - item width at index ${c} is greater than grid columns`:Ae(29,c));let u=!1;for(n&&(r=0);!u;){const l=[];for(let f=0;f<s;f+=1)for(let d=0;d<i;d+=1)l.push(r+f+d*t);r%t+s<=t&&l.every(f=>o[f]==null)?(l.forEach(f=>{o[f]=c}),u=!0):r+=1}}),[...o]}function Wu(e,t,n,o,r){if(e===-1)return-1;const s=n.indexOf(e),i=t[e];switch(r){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*o:s;case"br":return n.lastIndexOf(e);default:return-1}}function qu(e,t){return t.flatMap((n,o)=>e.includes(n)?[o]:[])}function Rn(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const o=e.current[t];return o?o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true":!1}var Ku=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],eo=Ku.join(","),Bi=typeof Element>"u",cn=Bi?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,to=!Bi&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Tn=function(t,n){var o;n===void 0&&(n=!0);var r=t==null||(o=t.getAttribute)===null||o===void 0?void 0:o.call(t,"inert"),s=r===""||r==="true",i=s||n&&t&&Tn(t.parentNode);return i},Gu=function(t){var n,o=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return o===""||o==="true"},Hi=function(t,n,o){if(Tn(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(eo));return n&&cn.call(t,eo)&&r.unshift(t),r=r.filter(o),r},no=function(t,n,o){for(var r=[],s=Array.from(t);s.length;){var i=s.shift();if(!Tn(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),u=c.length?c:i.children,l=no(u,!0,o);o.flatten?r.push.apply(r,l):r.push({scopeParent:i,candidates:l})}else{var f=cn.call(i,eo);f&&o.filter(i)&&(n||!t.includes(i))&&r.push(i);var d=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),p=!Tn(d,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(d&&p){var m=no(d===!0?i.children:d.children,!0,o);o.flatten?r.push.apply(r,m):r.push({scopeParent:i,candidates:m})}else s.unshift.apply(s,i.children)}}return r},zi=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Ui=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Gu(t))&&!zi(t)?0:t.tabIndex},Yu=function(t,n){var o=Ui(t);return o<0&&n&&!zi(t)?0:o},Xu=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Wi=function(t){return t.tagName==="INPUT"},Zu=function(t){return Wi(t)&&t.type==="hidden"},Ju=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(o){return o.tagName==="SUMMARY"});return n},Qu=function(t,n){for(var o=0;o<t.length;o++)if(t[o].checked&&t[o].form===n)return t[o]},ef=function(t){if(!t.name)return!0;var n=t.form||to(t),o=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(t.name));else try{r=o(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Qu(r,t.form);return!s||s===t},tf=function(t){return Wi(t)&&t.type==="radio"},nf=function(t){return tf(t)&&!ef(t)},of=function(t){var n,o=t&&to(t),r=(n=o)===null||n===void 0?void 0:n.host,s=!1;if(o&&o!==t){var i,c,u;for(s=!!((i=r)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(r)||t!=null&&(u=t.ownerDocument)!==null&&u!==void 0&&u.contains(t));!s&&r;){var l,f,d;o=to(r),r=(l=o)===null||l===void 0?void 0:l.host,s=!!((f=r)!==null&&f!==void 0&&(d=f.ownerDocument)!==null&&d!==void 0&&d.contains(r))}}return s},_s=function(t){var n=t.getBoundingClientRect(),o=n.width,r=n.height;return o===0&&r===0},rf=function(t,n){var o=n.displayCheck,r=n.getShadowRoot;if(o==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=cn.call(t,"details>summary:first-of-type"),c=i?t.parentElement:t;if(cn.call(c,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var u=t;t;){var l=t.parentElement,f=to(t);if(l&&!l.shadowRoot&&r(l)===!0)return _s(t);t.assignedSlot?t=t.assignedSlot:!l&&f!==t.ownerDocument?t=f.host:t=l}t=u}if(of(t))return!t.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return _s(t);return!1},sf=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var o=0;o<n.children.length;o++){var r=n.children.item(o);if(r.tagName==="LEGEND")return cn.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}return!1},ar=function(t,n){return!(n.disabled||Tn(n)||Zu(n)||rf(n,t)||Ju(n)||sf(n))},lr=function(t,n){return!(nf(n)||Ui(n)<0||!ar(t,n))},cf=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},qi=function(t){var n=[],o=[];return t.forEach(function(r,s){var i=!!r.scopeParent,c=i?r.scopeParent:r,u=Yu(c,i),l=i?qi(r.candidates):c;u===0?i?n.push.apply(n,l):n.push(c):o.push({documentOrder:s,tabIndex:u,item:r,isScope:i,content:l})}),o.sort(Xu).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(n)},In=function(t,n){n=n||{};var o;return n.getShadowRoot?o=no([t],n.includeContainer,{filter:lr.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:cf}):o=Hi(t,n.includeContainer,lr.bind(null,n)),qi(o)},af=function(t,n){n=n||{};var o;return n.getShadowRoot?o=no([t],n.includeContainer,{filter:ar.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):o=Hi(t,n.includeContainer,ar.bind(null,n)),o},Ki=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return cn.call(t,eo)===!1?!1:lr(n,t)};const dn=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Gi(e,t){const n=In(e,dn()),o=n.length;if(o===0)return;const r=ct(Le(e)),s=n.indexOf(r),i=s===-1?t===1?0:o-1:s+t;return n[i]}function Nr(e){return Gi(Le(e).body,1)||e}function Yi(e){return Gi(Le(e).body,-1)||e}function Xi(e,t){if(!e)return null;const n=In(Le(e).body,dn()),o=n.length;if(o===0)return null;const r=n.indexOf(e);if(r===-1)return null;const s=(r+t+o)%o;return n[s]}function lf(e){return Xi(e,1)}function uf(e){return Xi(e,-1)}function Jt(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!xe(n,o)}function ff(e){In(e,dn()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Ts(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}const mo="ArrowUp",go="ArrowDown",ho="ArrowLeft",yo="ArrowRight",Ir="Home",Mr="End",df=new Set([ho,yo]),pf=new Set([mo,go]),mf=new Set([...df,...pf]);[...mf];const Dr=new Set([mo,go,ho,yo,Ir,Mr]),gf=new Set([go,mo,yo,ho,Ir,Mr]);function hf(e){const{current:t}=e,n=[];for(let o=0;o<t.length;o+=1){const r=t[o];if(!Es(r)){const s=r?.querySelector('[type="button"]');Es(s)||n.push(s)}}return n}const Zi=a.forwardRef(function(t,n){const{disabled:o,className:r,id:s,render:i,nativeButton:c=!0,...u}=t,{panelId:l,open:f,handleTrigger:d,disabled:p}=wi(),m=o??p,{getButtonProps:g,buttonRef:h}=St({disabled:m,focusableWhenDisabled:!0,native:c}),{accordionItemRefs:E,direction:b,loopFocus:y,orientation:x}=br(),v=b==="rtl",R=x==="horizontal",{state:_,setTriggerId:T,triggerId:N}=wr();X(()=>(s&&T(s),()=>{T(void 0)}),[s,T]);const F=a.useMemo(()=>({"aria-controls":f?l:void 0,"aria-expanded":f,disabled:m,id:N,onClick:d,onKeyDown(k){if(!gf.has(k.key))return;He(k);const A=hf(E),I=A.length-1;let C=-1;const O=A.indexOf(k.target);function D(){y?C=O+1>I?0:O+1:C=Math.min(O+1,I)}function S(){y?C=O===0?I:O-1:C=O-1}switch(k.key){case go:R||D();break;case mo:R||S();break;case yo:R&&(v?S():D());break;case ho:R&&(v?D():S());break;case"Home":C=0;break;case"End":C=I;break}C>-1&&A[C].focus()}}),[E,m,d,N,R,v,y,f,l]);return ye("button",t,{state:_,ref:[n,h],props:[F,u,g],stateAttributesMapping:uu})});process.env.NODE_ENV!=="production"&&(Zi.displayName="AccordionTrigger");let yf=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function bf(e){const{abortControllerRef:t,animationTypeRef:n,externalRef:o,height:r,hiddenUntilFound:s,keepMounted:i,id:c,mounted:u,onOpenChange:l,open:f,panelRef:d,runOnceAnimationsFinish:p,setDimensions:m,setMounted:g,setOpen:h,setVisible:E,transitionDimensionRef:b,visible:y,width:x}=e,v=a.useRef(!1),R=a.useRef(null),_=a.useRef(f),T=a.useRef(f),N=un(),F=a.useMemo(()=>n.current==="css-animation"?!y:!f&&!u,[f,u,y,n]),L=Q(A=>{if(!A)return;if(n.current==null||b.current==null){const C=getComputedStyle(A),O=C.animationName!=="none"&&C.animationName!=="",D=C.transitionDuration!=="0s"&&C.transitionDuration!=="";O&&D?process.env.NODE_ENV!=="production"&&mr("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.","Only one of either animation type should be used."):C.animationName==="none"&&C.transitionDuration!=="0s"?n.current="css-transition":C.animationName!=="none"&&C.transitionDuration==="0s"?n.current="css-animation":n.current="none",A.getAttribute(yf.orientation)==="horizontal"||C.transitionProperty.indexOf("width")>-1?b.current="width":b.current="height"}if(n.current!=="css-transition")return;(r===void 0||x===void 0)&&(m({height:A.scrollHeight,width:A.scrollWidth}),T.current&&A.style.setProperty("transition-duration","0s"));let w=-1,I=-1;return w=Ie.request(()=>{T.current=!1,I=Ie.request(()=>{setTimeout(()=>{A.style.removeProperty("transition-duration")})})}),()=>{Ie.cancel(w),Ie.cancel(I)}}),k=Pt(o,d,L);return X(()=>{if(n.current!=="css-transition")return;const A=d.current;if(!A)return;let w=-1;if(t.current!=null&&(t.current.abort(),t.current=null),f){const I={"justify-content":A.style.justifyContent,"align-items":A.style.alignItems,"align-content":A.style.alignContent,"justify-items":A.style.justifyItems};Object.keys(I).forEach(C=>{A.style.setProperty(C,"initial","important")}),!T.current&&!i&&A.setAttribute(Sn.startingStyle,""),m({height:A.scrollHeight,width:A.scrollWidth}),w=Ie.request(()=>{Object.entries(I).forEach(([C,O])=>{O===""?A.style.removeProperty(C):A.style.setProperty(C,O)})})}else{if(A.scrollHeight===0&&A.scrollWidth===0)return;m({height:A.scrollHeight,width:A.scrollWidth});const I=new AbortController;t.current=I;const C=I.signal;let O=null;const D=Sn.endingStyle;return O=new MutationObserver(S=>{S.some($=>$.type==="attributes"&&$.attributeName===D)&&(O?.disconnect(),O=null,p(()=>{m({height:0,width:0}),A.style.removeProperty("content-visibility"),g(!1),t.current===I&&(t.current=null)},C))}),O.observe(A,{attributes:!0,attributeFilter:[D]}),()=>{O?.disconnect(),N.cancel(),t.current===I&&(I.abort(),t.current=null)}}return()=>{Ie.cancel(w)}},[t,n,N,s,i,u,f,d,p,m,g]),X(()=>{if(n.current!=="css-animation")return;const A=d.current;A&&(R.current=A.style.animationName||R.current,A.style.setProperty("animation-name","none"),m({height:A.scrollHeight,width:A.scrollWidth}),!_.current&&!v.current&&A.style.removeProperty("animation-name"),f?(t.current!=null&&(t.current.abort(),t.current=null),g(!0),E(!0)):(t.current=new AbortController,p(()=>{g(!1),E(!1),t.current=null},t.current.signal)))},[t,n,f,d,p,m,g,E,y]),io(()=>{const A=Ie.request(()=>{_.current=!1});return()=>Ie.cancel(A)}),X(()=>{if(!s)return;const A=d.current;if(!A)return;let w=-1,I=-1;return f&&v.current&&(A.style.transitionDuration="0s",m({height:A.scrollHeight,width:A.scrollWidth}),w=Ie.request(()=>{v.current=!1,I=Ie.request(()=>{setTimeout(()=>{A.style.removeProperty("transition-duration")})})})),()=>{Ie.cancel(w),Ie.cancel(I)}},[s,f,d,m]),X(()=>{const A=d.current;A&&s&&F&&(A.setAttribute("hidden","until-found"),n.current==="css-transition"&&A.setAttribute(Sn.startingStyle,""))},[s,F,n,d]),a.useEffect(function(){const w=d.current;if(!w)return;function I(C){v.current=!0,h(!0),l(!0,ge(ln,C))}return w.addEventListener("beforematch",I),()=>{w.removeEventListener("beforematch",I)}},[l,d,h]),a.useMemo(()=>({props:{hidden:F,id:c,ref:k}}),[F,c,k])}let Os=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});function Ve(e){const t=Je(vf,e).current;return t.next=e,X(t.effect),t}function vf(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function Lt(e){const{enabled:t=!0,open:n,ref:o,onComplete:r}=e,s=Ve(n),i=Q(r),c=co(o,n);a.useEffect(()=>{t&&c(()=>{n===s.current&&i()})},[t,n,i,c,s])}const Ji=a.forwardRef(function(t,n){const{className:o,hiddenUntilFound:r,keepMounted:s,id:i,render:c,...u}=t,{hiddenUntilFound:l,keepMounted:f}=br(),{abortControllerRef:d,animationTypeRef:p,height:m,mounted:g,onOpenChange:h,open:E,panelId:b,panelRef:y,runOnceAnimationsFinish:x,setDimensions:v,setHiddenUntilFound:R,setKeepMounted:_,setMounted:T,setOpen:N,setVisible:F,transitionDimensionRef:L,visible:k,width:A,setPanelIdState:w,transitionStatus:I}=wi(),C=r??l,O=s??f;process.env.NODE_ENV!=="production"&&X(()=>{s===!1&&C&&mr("The `keepMounted={false}` prop on a Accordion.Panel will be ignored when using `contextHiddenUntilFound` on the Panel or the Root since it requires the panel to remain mounted when closed.")},[C,s]),X(()=>{if(i)return w(i),()=>{w(void 0)}},[i,w]),X(()=>{R(C)},[R,C]),X(()=>{_(O)},[_,O]),Lt({open:E&&I==="idle",ref:y,onComplete(){E&&v({width:void 0,height:void 0})}});const{props:D}=bf({abortControllerRef:d,animationTypeRef:p,externalRef:n,height:m,hiddenUntilFound:C,id:i??b,keepMounted:O,mounted:g,onOpenChange:h,open:E,panelRef:y,runOnceAnimationsFinish:x,setDimensions:v,setMounted:T,setOpen:N,setVisible:F,transitionDimensionRef:L,visible:k,width:A}),{state:S,triggerId:M}=wr(),$=a.useMemo(()=>({...S,transitionStatus:I}),[S,I]),z=ye("div",t,{state:$,ref:[n,y],props:[D,{"aria-labelledby":M,role:"region",style:{[Os.accordionPanelHeight]:m===void 0?"auto":`${m}px`,[Os.accordionPanelWidth]:A===void 0?"auto":`${A}px`}},u],stateAttributesMapping:Rr});return O||C||!O&&g?z:null});process.env.NODE_ENV!=="production"&&(Ji.displayName="AccordionPanel");const Ef="_root_l6s1z_10",xf="_item_l6s1z_53",Sf="_header_l6s1z_100",wf="_trigger_l6s1z_109",Rf="_triggerContent_l6s1z_195",Cf="_triggerIcon_l6s1z_201",_f="_chevronSvg_l6s1z_214",Tf="_panel_l6s1z_222",Of="_panelContent_l6s1z_255",je={root:Ef,"root--default":"_root--default_l6s1z_17","root--bordered":"_root--bordered_l6s1z_21","root--separated":"_root--separated_l6s1z_28","root--minimal":"_root--minimal_l6s1z_32","root--sm":"_root--sm_l6s1z_37","root--md":"_root--md_l6s1z_41","root--lg":"_root--lg_l6s1z_45",item:xf,"item--default":"_item--default_l6s1z_60","item--bordered":"_item--bordered_l6s1z_68","item--separated":"_item--separated_l6s1z_76","item--minimal":"_item--minimal_l6s1z_82",header:Sf,trigger:wf,"trigger--default":"_trigger--default_l6s1z_142","trigger--bordered":"_trigger--bordered_l6s1z_150","trigger--separated":"_trigger--separated_l6s1z_158","trigger--minimal":"_trigger--minimal_l6s1z_167","trigger--sm":"_trigger--sm_l6s1z_179","trigger--md":"_trigger--md_l6s1z_184","trigger--lg":"_trigger--lg_l6s1z_189",triggerContent:Rf,triggerIcon:Cf,chevronSvg:_f,panel:Tf,"panel--default":"_panel--default_l6s1z_238","panel--bordered":"_panel--bordered_l6s1z_242","panel--separated":"_panel--separated_l6s1z_246","panel--minimal":"_panel--minimal_l6s1z_250",panelContent:Of,"panel--sm":"_panel--sm_l6s1z_262","panel--md":"_panel--md_l6s1z_267","panel--lg":"_panel--lg_l6s1z_272"},Qi=ne.createContext({variant:"default",size:"md"}),bo=()=>ne.useContext(Qi),ec=ne.forwardRef(({value:e,defaultValue:t,onValueChange:n,openMultiple:o=!1,disabled:r=!1,orientation:s="vertical",variant:i="default",size:c="md",className:u,children:l},f)=>{const d=[je.root,je[`root--${i}`],je[`root--${c}`],u].filter(Boolean).join(" ");return P.jsx(Qi.Provider,{value:{variant:i,size:c},children:P.jsx(Si,{ref:f,value:e,defaultValue:t,onValueChange:n,multiple:o,disabled:r,orientation:s,className:d,children:l})})});ec.displayName="ALSAccordion.Root";const tc=ne.forwardRef(({value:e,disabled:t,onOpenChange:n,className:o,children:r},s)=>{const{variant:i,size:c}=bo(),u=[je.item,je[`item--${i}`],je[`item--${c}`],o].filter(Boolean).join(" ");return P.jsx(_i,{ref:s,value:e,disabled:t,onOpenChange:n,className:u,children:r})});tc.displayName="ALSAccordion.Item";const nc=ne.forwardRef(({className:e,children:t},n)=>{const{variant:o,size:r}=bo(),s=[je.header,je[`header--${o}`],je[`header--${r}`],e].filter(Boolean).join(" ");return P.jsx(Ti,{ref:n,className:s,children:t})});nc.displayName="ALSAccordion.Header";const oc=ne.forwardRef(({className:e,children:t},n)=>{const{variant:o,size:r}=bo(),s=[je.trigger,je[`trigger--${o}`],je[`trigger--${r}`],e].filter(Boolean).join(" ");return P.jsxs(Zi,{ref:n,className:s,children:[P.jsx("span",{className:je.triggerContent,children:t}),P.jsx("span",{className:je.triggerIcon,"aria-hidden":"true",children:P.jsx(Pf,{})})]})});oc.displayName="ALSAccordion.Trigger";const rc=ne.forwardRef(({keepMounted:e=!1,className:t,children:n},o)=>{const{variant:r,size:s}=bo(),i=[je.panel,je[`panel--${r}`],je[`panel--${s}`],t].filter(Boolean).join(" ");return P.jsx(Ji,{ref:o,keepMounted:e,className:i,children:P.jsx("div",{className:je.panelContent,children:n})})});rc.displayName="ALSAccordion.Panel";const Pf=()=>P.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:je.chevronSvg,children:P.jsx("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Af={Root:ec,Item:tc,Header:nc,Trigger:oc,Panel:rc},Nf="_root_1n1xb_1",If={root:Nf};function Mf(e){return P.jsx("div",{className:If.root})}const Df="_root_1wdul_1",Lf={root:Df};function kf(e){return P.jsx("div",{className:Lf.root})}const Ff="_root_rauug_1",Vf={root:Ff};function jf(e){return P.jsx("div",{className:Vf.root})}const $f="_button_1enjc_2",Bf="_block_1enjc_34",Hf="_disabled_1enjc_372",Xt={button:$f,block:Bf,"size-sm":"_size-sm_1enjc_40","size-md":"_size-md_1enjc_46","size-lg":"_size-lg_1enjc_51","size-full":"_size-full_1enjc_57","variant-primary":"_variant-primary_1enjc_68","style-full":"_style-full_1enjc_68","style-outline":"_style-outline_1enjc_87","style-ghost":"_style-ghost_1enjc_100","style-empty":"_style-empty_1enjc_112","variant-secondary":"_variant-secondary_1enjc_129","variant-success":"_variant-success_1enjc_189","variant-danger":"_variant-danger_1enjc_250","variant-warning":"_variant-warning_1enjc_311",disabled:Hf},sc=ne.forwardRef(({variant:e="primary",buttonStyle:t="full",size:n="md",block:o=!1,className:r="",children:s,disabled:i=!1,type:c="button",...u},l)=>{const f=[Xt.button,Xt[`variant-${e}`],Xt[`style-${t}`],Xt[`size-${n}`],o?Xt.block:"",i?Xt.disabled:"",r].filter(Boolean).join(" ");return P.jsx("button",{ref:l,className:f,disabled:i,type:c,...u,children:s})});sc.displayName="ALSButton";const zf="_root_11pg6_1",Uf={root:zf};function Wf(e){return P.jsx("div",{className:Uf.root})}const qf="_root_1mrxf_1",Kf={root:qf};function Gf(e){return P.jsx("div",{className:Kf.root})}const Yf="_root_1yvsq_1",Xf={root:Yf};function Zf(e){return P.jsx("div",{className:Xf.root})}const Jf="_root_1kg0t_1",Qf={root:Jf};function ed(e){return P.jsx("div",{className:Qf.root})}const td="_root_9j2r3_1",nd={root:td};function od(e){return P.jsx("div",{className:nd.root})}const Lr=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(Lr.displayName="DialogRootContext");function kt(e){const t=a.useContext(Lr);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>.":Ae(27));return t}let Ht=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=nn.startingStyle]="startingStyle",e[e.endingStyle=nn.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),ur=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const rd={[ur.popupOpen]:""},sd={[ur.popupOpen]:"",[ur.pressed]:""},id={[Ht.open]:""},cd={[Ht.closed]:""},ad={[Ht.anchorHidden]:""},kr={open(e){return e?rd:null}},ic={open(e){return e?sd:null}},Ft={open(e){return e?id:cd},anchorHidden(e){return e?ad:null}},ld={...Ft,...It},cc=a.forwardRef(function(t,n){const{render:o,className:r,forceRender:s=!1,...i}=t,{store:c}=kt(),u=c.useState("open"),l=c.useState("nested"),f=c.useState("mounted"),d=c.useState("transitionStatus"),p=a.useMemo(()=>({open:u,transitionStatus:d}),[u,d]);return ye("div",t,{state:p,ref:[c.context.backdropRef,n],stateAttributesMapping:ld,props:[{role:"presentation",hidden:!f,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:s||!l})});process.env.NODE_ENV!=="production"&&(cc.displayName="DialogBackdrop");const ac=a.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,...c}=t,{store:u}=kt(),l=u.useState("open");function f(g){l&&u.setOpen(!1,ge(vi,g.nativeEvent))}const{getButtonProps:d,buttonRef:p}=St({disabled:s,native:i}),m=a.useMemo(()=>({disabled:s}),[s]);return ye("button",t,{state:m,ref:[n,p],props:[{onClick:f},c,d]})});process.env.NODE_ENV!=="production"&&(ac.displayName="DialogClose");const lc=a.forwardRef(function(t,n){const{render:o,className:r,id:s,...i}=t,{store:c}=kt(),u=ut(s);return c.useSyncedValueWithCleanup("descriptionElementId",u),ye("p",t,{ref:n,props:[{id:u},i]})});process.env.NODE_ENV!=="production"&&(lc.displayName="DialogDescription");const hn=0;class pt{static create(){return new pt}currentId=hn;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=hn,n()},t)}isStarted(){return this.currentId!==hn}clear=()=>{this.currentId!==hn&&(clearTimeout(this.currentId),this.currentId=hn)};disposeEffect=()=>this.clear}function Xe(){const e=Je(pt.create).current;return io(e.disposeEffect),e}function uc(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(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 ud{nodesRef={current:[]};events=uc();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Fr=a.createContext(null);process.env.NODE_ENV!=="production"&&(Fr.displayName="FloatingNodeContext");const Vr=a.createContext(null);process.env.NODE_ENV!=="production"&&(Vr.displayName="FloatingTreeContext");const Vt=()=>a.useContext(Fr)?.id||null,Gt=e=>{const t=a.useContext(Vr);return e??t};function fd(e){const t=Nt(),n=Gt(e),o=Vt();return X(()=>{if(!t)return;const r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function dd(e){const{children:t,id:n}=e,o=Vt();return P.jsx(Fr.Provider,{value:a.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function pd(e){const{children:t,externalTree:n}=e,o=Je(()=>n??new ud).current;return P.jsx(Vr.Provider,{value:o,children:t})}function On(e){return`data-base-ui-${e}`}function Lo(e,t,n){if(n&&!on(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const o=e();return typeof o=="number"?o:o?.[t]}return e?.[t]}const vo={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1};function Ke(e){return e?.ownerDocument||document}const dt=a.forwardRef(function(t,n){const[o,r]=a.useState();X(()=>{_u&&r("button")},[]);const s={tabIndex:0,role:o};return P.jsx("span",{...t,ref:n,style:vo,"aria-hidden":o?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(dt.displayName="FocusGuard");let Ps=0;function Gn(e,t={}){const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Ps);const s=()=>e?.focus({preventScroll:n});r?s():Ps=requestAnimationFrame(s)}const Qt={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function As(e){return e==="inert"?Qt.inert:e==="aria-hidden"?Qt["aria-hidden"]:Qt.none}let Vn=new WeakSet,jn={},ko=0;const fc=e=>e&&(e.host||fc(e.parentNode)),md=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=fc(n);return e.contains(o)?o:null}).filter(n=>n!=null);function gd(e,t,n,o){const r="data-base-ui-inert",s=o?"inert":n?"aria-hidden":null,i=md(t,e),c=new Set,u=new Set(i),l=[];jn[r]||(jn[r]=new WeakMap);const f=jn[r];i.forEach(d),p(t),c.clear();function d(m){!m||c.has(m)||(c.add(m),m.parentNode&&d(m.parentNode))}function p(m){!m||u.has(m)||[].forEach.call(m.children,g=>{if(Mt(g)!=="script")if(c.has(g))p(g);else{const h=s?g.getAttribute(s):null,E=h!==null&&h!=="false",b=As(s),y=(b.get(g)||0)+1,x=(f.get(g)||0)+1;b.set(g,y),f.set(g,x),l.push(g),y===1&&E&&Vn.add(g),x===1&&g.setAttribute(r,""),!E&&s&&g.setAttribute(s,s==="inert"?"":"true")}})}return ko+=1,()=>{l.forEach(m=>{const g=As(s),E=(g.get(m)||0)-1,b=(f.get(m)||0)-1;g.set(m,E),f.set(m,b),E||(!Vn.has(m)&&s&&m.removeAttribute(s),Vn.delete(m)),b||m.removeAttribute(r)}),ko-=1,ko||(Qt.inert=new WeakMap,Qt["aria-hidden"]=new WeakMap,Qt.none=new WeakMap,Vn=new WeakSet,jn={})}}function hd(e,t=!1,n=!1){const o=Le(e[0]).body;return gd(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const jr=a.createContext(null);process.env.NODE_ENV!=="production"&&(jr.displayName="PortalContext");const dc=()=>a.useContext(jr),yd=On("portal");function pc(e={}){const{ref:t,container:n,componentProps:o=ze,elementProps:r,elementState:s}=e,i=Nt(),u=dc()?.portalNode,[l,f]=a.useState(null),[d,p]=a.useState(null),m=a.useRef(null);X(()=>{if(n===null){m.current&&(m.current=null,p(null),f(null));return}if(i==null)return;const E=(n&&(Cr(n)?n:n.current))??u??document.body;if(E==null){m.current&&(m.current=null,p(null),f(null));return}m.current!==E&&(m.current=E,p(null),f(E))},[n,u,i]);const g=ye("div",o,{ref:[t,p],state:s,props:[{id:i,[yd]:""},r]});return{portalNode:d,portalSubtree:l&&g?rt.createPortal(g,l):null}}const Eo=a.forwardRef(function(t,n){const{children:o,container:r,className:s,render:i,renderGuards:c,...u}=t,{portalNode:l,portalSubtree:f}=pc({container:r,ref:n,componentProps:t,elementProps:u}),d=a.useRef(null),p=a.useRef(null),m=a.useRef(null),g=a.useRef(null),[h,E]=a.useState(null),b=h?.modal,y=h?.open,x=typeof c=="boolean"?c:!!h&&!h.modal&&h.open&&!!l;a.useEffect(()=>{if(!l||b)return;function R(_){l&&Jt(_)&&(_.type==="focusin"?Ts:ff)(l)}return l.addEventListener("focusin",R,!0),l.addEventListener("focusout",R,!0),()=>{l.removeEventListener("focusin",R,!0),l.removeEventListener("focusout",R,!0)}},[l,b]),a.useEffect(()=>{!l||y||Ts(l)},[y,l]);const v=a.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:g,portalNode:l,setFocusManagerState:E}),[l]);return P.jsxs(a.Fragment,{children:[f,P.jsxs(jr.Provider,{value:v,children:[x&&l&&P.jsx(dt,{"data-type":"outside",ref:d,onFocus:R=>{if(Jt(R,l))m.current?.focus();else{const _=h?h.domReference:null;Yi(_)?.focus()}}}),x&&l&&P.jsx("span",{"aria-owns":l.id,style:Kl}),l&&rt.createPortal(o,l),x&&l&&P.jsx(dt,{"data-type":"outside",ref:p,onFocus:R=>{if(Jt(R,l))g.current?.focus();else{const _=h?h.domReference:null;Nr(_)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,ge(Ut,R.nativeEvent))}}})]})]})});process.env.NODE_ENV!=="production"&&(Eo.displayName="FloatingPortal");function bd(e,t){const n=De(e.target);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 Ns=20;let Ct=[];function $r(){Ct=Ct.filter(e=>e.isConnected)}function vd(e){$r(),e&&Mt(e)!=="body"&&(Ct.push(e),Ct.length>Ns&&(Ct=Ct.slice(-Ns)))}function Fo(){return $r(),Ct[Ct.length-1]}function Ed(e){if(!e)return null;const t=dn();return Ki(e,t)?e:In(e,t)[0]||e}function xd(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Qe(e).display!=="none"}function Is(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=dn(),r=af(e,n).filter(i=>{const c=i.getAttribute("data-tabindex")||"";return Ki(i,n)||i.hasAttribute("data-tabindex")&&!c.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Br(e){const{context:t,children:n,disabled:o=!1,order:r=["content"],initialFocus:s=!0,returnFocus:i=!0,restoreFocus:c=!1,modal:u=!0,closeOnFocusOut:l=!0,openInteractionType:f="",getInsideElements:d=()=>[],nextFocusableElement:p,previousFocusableElement:m,beforeContentFocusGuardRef:g,externalTree:h}=e,E="rootStore"in t?t.rootStore:t,b=E.useState("open"),y=E.useState("domReferenceElement"),x=E.useState("floatingElement"),{events:v,dataRef:R}=E.context,_=Q(()=>R.current.floatingContext?.nodeId),T=Q(d),N=s===!1,F=rr(y)&&N,L=Ve(r),k=Ve(s),A=Ve(i),w=Ve(f),I=Gt(h),C=dc(),O=a.useRef(null),D=a.useRef(null),S=a.useRef(!1),M=a.useRef(!1),$=a.useRef(-1),z=a.useRef(""),Z=a.useRef(""),Y=Xe(),te=Xe(),G=un(),H=C!=null,j=_n(x),ae=Q((U=j)=>U?In(U,dn()):[]),de=Q(U=>{const K=ae(U);return L.current.map(()=>K).filter(Boolean).flat()});a.useEffect(()=>{if(o||!u)return;function U(W){W.key==="Tab"&&xe(j,ct(Le(j)))&&ae().length===0&&!F&&He(W)}const K=Le(j);return K.addEventListener("keydown",U),()=>{K.removeEventListener("keydown",U)}},[o,y,j,u,L,F,ae,de]),a.useEffect(()=>{if(o||!x)return;function U(K){const W=qe(K),le=ae().indexOf(W);le!==-1&&($.current=le)}return x.addEventListener("focusin",U),()=>{x.removeEventListener("focusin",U)}},[o,x,ae]),a.useEffect(()=>{if(o||!b)return;const U=Le(j);function K(pe){Z.current=pe.pointerType||"keyboard"}function W(){Z.current="keyboard"}return U.addEventListener("pointerdown",K,!0),U.addEventListener("keydown",W,!0),()=>{U.removeEventListener("pointerdown",K,!0),U.removeEventListener("keydown",W,!0)}},[o,x,y,j,b]),a.useEffect(()=>{if(o||!l)return;function U(){M.current=!0,te.start(0,()=>{M.current=!1})}function K(re){const V=re.relatedTarget,ce=re.currentTarget,ee=qe(re);queueMicrotask(()=>{const q=_(),J=E.context.triggerElements,ue=!(xe(y,V)||xe(x,V)||xe(V,x)||xe(C?.portalNode,V)||V!=null&&J.hasElement(V)||J.hasMatchingElement(fe=>xe(fe,V))||V?.hasAttribute(On("focus-guard"))||I&&(zt(I.nodesRef.current,q).find(fe=>xe(fe.context?.elements.floating,V)||xe(fe.context?.elements.domReference,V))||Ss(I.nodesRef.current,q).find(fe=>[fe.context?.elements.floating,_n(fe.context?.elements.floating)].includes(V)||fe.context?.elements.domReference===V)));if(ce===y&&j&&Is(j,L),c&&ce!==y&&!xd(ee)&&ct(Le(j))===Le(j).body){if(Me(j)&&(j.focus(),c==="popup")){G.request(()=>{j.focus()});return}const fe=$.current,Re=ae(),we=Re[fe]||Re[Re.length-1]||j;Me(we)&&we.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(F||!u)&&V&&ue&&(F||V!==Fo())&&(S.current=!0,E.setOpen(!1,ge(Ut,re)))})}function W(){R.current.insideReactTree=!0,Y.start(0,()=>{R.current.insideReactTree=!1})}const pe=Me(y)?y:null,le=[];if(!(!x&&!pe))return pe&&(pe.addEventListener("focusout",K),pe.addEventListener("pointerdown",U),le.push(()=>{pe.removeEventListener("focusout",K),pe.removeEventListener("pointerdown",U)})),x&&(x.addEventListener("focusout",K),C&&(x.addEventListener("focusout",W,!0),le.push(()=>{x.removeEventListener("focusout",W,!0)})),le.push(()=>{x.removeEventListener("focusout",K)})),()=>{le.forEach(re=>{re()})}},[o,y,x,j,u,I,C,E,l,c,ae,F,_,L,R,Y,te,G]);const Ee=a.useRef(null),B=a.useRef(null),ie=Pt(Ee,g,C?.beforeInsideRef),oe=Pt(B,C?.afterInsideRef);a.useEffect(()=>{if(o||!x||!b)return;const U=Array.from(C?.portalNode?.querySelectorAll(`[${On("portal")}]`)||[]),W=(I?Ss(I.nodesRef.current,_()):[]).find(re=>rr(re.context?.elements.domReference||null))?.context?.elements.domReference,pe=[x,W,...U,...T(),O.current,D.current,Ee.current,B.current,C?.beforeOutsideRef.current,C?.afterOutsideRef.current,Bt(m),Bt(p),F?y:null].filter(re=>re!=null),le=hd(pe,u||F);return()=>{le()}},[b,o,y,x,u,L,C,F,I,_,T,p,m]),X(()=>{if(!b||o||!Me(j))return;const U=Le(j),K=ct(U);queueMicrotask(()=>{const W=de(j),pe=k.current,le=typeof pe=="function"?pe(w.current||""):pe;if(le===void 0||le===!1)return;let re;le===!0||le===null?re=W[0]||j:re=Bt(le),re=re||W[0]||j,!xe(j,K)&&Gn(re,{preventScroll:re===j})})},[o,b,j,N,de,k,w]),X(()=>{if(o||!j)return;const U=Le(j),K=ct(U);vd(K);function W(re){if(re.open||(z.current=bd(re.nativeEvent,Z.current)),re.reason===ot&&re.nativeEvent.type==="mouseleave"&&(S.current=!0),re.reason===bi)if(re.nested)S.current=!1;else if(Vi(re.nativeEvent)||ji(re.nativeEvent))S.current=!1;else{let V=!1;document.createElement("div").focus({get preventScroll(){return V=!0,!1}}),V?S.current=!1:S.current=!0}}v.on("openchange",W);const pe=U.createElement("span");pe.setAttribute("tabindex","-1"),pe.setAttribute("aria-hidden","true"),Object.assign(pe.style,vo),H&&y&&y.insertAdjacentElement("afterend",pe);function le(){const re=A.current;let V=typeof re=="function"?re(z.current):re;if(V===void 0||V===!1)return null;if(V===null&&(V=!0),typeof V=="boolean"){const ee=y||Fo();return ee&&ee.isConnected?ee:pe}const ce=y||Fo()||pe;return Bt(V)||ce}return()=>{v.off("openchange",W);const re=ct(U),V=xe(x,re)||I&&zt(I.nodesRef.current,_(),!1).some(ee=>xe(ee.context?.elements.floating,re)),ce=le();queueMicrotask(()=>{const ee=Ed(ce),q=typeof A.current!="boolean";A.current&&!S.current&&Me(ee)&&(!(!q&&ee!==re&&re!==U.body)||V)&&ee.focus({preventScroll:!0}),pe.remove()})}},[o,x,j,A,R,v,I,H,y,_]),a.useEffect(()=>{queueMicrotask(()=>{S.current=!1})},[o]),a.useEffect(()=>{if(o||!b)return;function U(W){qe(W)?.closest(`[${Er}]`)&&(M.current=!0)}const K=Le(j);return K.addEventListener("pointerdown",U,!0),()=>{K.removeEventListener("pointerdown",U,!0)}},[o,b,j]),X(()=>{if(!o&&C)return C.setFocusManagerState({modal:u,closeOnFocusOut:l,open:b,onOpenChange:E.setOpen,domReference:y}),()=>{C.setFocusManagerState(null)}},[o,C,u,b,E,l,y]),X(()=>{if(!(o||!j))return Is(j,L),()=>{queueMicrotask($r)}},[o,j,L]);const Se=!o&&(u?!F:!0)&&(H||u);return P.jsxs(a.Fragment,{children:[Se&&P.jsx(dt,{"data-type":"inside",ref:ie,onFocus:U=>{if(u){const K=de();Gn(K[K.length-1])}else C?.portalNode&&(S.current=!1,Jt(U,C.portalNode)?Nr(y)?.focus():Bt(m??C.beforeOutsideRef)?.focus())}}),n,Se&&P.jsx(dt,{"data-type":"inside",ref:oe,onFocus:U=>{u?Gn(de()[0]):C?.portalNode&&(l&&(S.current=!0),Jt(U,C.portalNode)?Yi(y)?.focus():Bt(p??C.afterOutsideRef)?.focus())}})]})}function Hr(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,{enabled:r=!0,event:s="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:l=0}=t,f=a.useRef(void 0),d=un(),p=Xe(),m=a.useMemo(()=>({onPointerDown(g){f.current=g.pointerType},onMouseDown(g){const h=f.current,E=g.nativeEvent,b=n.select("open");if(g.button!==0||s==="click"||on(h,!0)&&c)return;const y=o.current.openEvent,x=y?.type,v=n.select("domReferenceElement")!==g.currentTarget,R=b&&v||!(b&&i&&(!(y&&u)||x==="click"||x==="mousedown"));if(Fi(E.target)){const T=ge(ht,E,E.target);R&&h==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,T)}):n.setOpen(R,T);return}const _=g.currentTarget;d.request(()=>{const T=ge(ht,E,_);R&&h==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,T)}):n.setOpen(R,T)})},onClick(g){if(s==="mousedown-only")return;const h=f.current;if(s==="mousedown"&&h){f.current=void 0;return}if(on(h,!0)&&c)return;const E=n.select("open"),b=o.current.openEvent,y=b?.type,x=n.select("domReferenceElement")!==g.currentTarget,v=E&&x||!(E&&i&&(!(b&&u)||y==="click"||y==="mousedown"||y==="keydown"||y==="keyup")),R=ge(ht,g.nativeEvent,g.currentTarget);v&&h==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,R)}):n.setOpen(v,R)},onKeyDown(){f.current=void 0}}),[o,s,c,n,u,i,d,p,l]);return a.useMemo(()=>r?{reference:m}:ze,[r,m])}function Ms(e,t,n){let{reference:o,floating:r}=e;const s=at(t),i=Ar(t),c=Pr(i),u=Ze(t),l=s==="y",f=o.x+o.width/2-r.width/2,d=o.y+o.height/2-r.height/2,p=o[c]/2-r[c]/2;let m;switch(u){case"top":m={x:f,y:o.y-r.height};break;case"bottom":m={x:f,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:d};break;case"left":m={x:o.x-r.width,y:d};break;default:m={x:o.x,y:o.y}}switch(Dt(t)){case"start":m[i]-=p*(n&&l?-1:1);break;case"end":m[i]+=p*(n&&l?-1:1);break}return m}const Sd=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:d}=Ms(l,o,u),p=o,m={},g=0;for(let h=0;h<c.length;h++){const{name:E,fn:b}=c[h],{x:y,y:x,data:v,reset:R}=await b({x:f,y:d,initialPlacement:o,placement:p,strategy:r,middlewareData:m,rects:l,platform:i,elements:{reference:e,floating:t}});f=y??f,d=x??d,m={...m,[E]:{...m[E],...v}},R&&g<=50&&(g++,typeof R=="object"&&(R.placement&&(p=R.placement),R.rects&&(l=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):R.rects),{x:f,y:d}=Ms(l,p,u)),h=-1)}return{x:f,y:d,placement:p,strategy:r,middlewareData:m}};async function Pn(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:c,strategy:u}=e,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:p=!1,padding:m=0}=Et(t,e),g=$i(m),E=c[p?d==="floating"?"reference":"floating":d],b=Qn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(E)))==null||n?E:E.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:f,strategy:u})),y=d==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),v=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},R=Qn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:x,strategy:u}):y);return{top:(b.top-R.top+g.top)/v.y,bottom:(R.bottom-b.bottom+g.bottom)/v.y,left:(b.left-R.left+g.left)/v.x,right:(R.right-b.right+g.right)/v.x}}const wd=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:u,elements:l}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...E}=Et(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Ze(r),y=at(c),x=Ze(c)===c,v=await(u.isRTL==null?void 0:u.isRTL(l.floating)),R=p||(x||!h?[Jn(c)]:Fu(c)),_=g!=="none";!p&&_&&R.push(...Bu(c,h,g,v));const T=[c,...R],N=await Pn(t,E),F=[];let L=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&F.push(N[b]),d){const I=ku(r,i,v);F.push(N[I[0]],N[I[1]])}if(L=[...L,{placement:r,overflows:F}],!F.every(I=>I<=0)){var k,A;const I=(((k=s.flip)==null?void 0:k.index)||0)+1,C=T[I];if(C&&(!(d==="alignment"?y!==at(C):!1)||L.every(S=>at(S.placement)===y?S.overflows[0]>0:!0)))return{data:{index:I,overflows:L},reset:{placement:C}};let O=(A=L.filter(D=>D.overflows[0]<=0).sort((D,S)=>D.overflows[1]-S.overflows[1])[0])==null?void 0:A.placement;if(!O)switch(m){case"bestFit":{var w;const D=(w=L.filter(S=>{if(_){const M=at(S.placement);return M===y||M==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(M=>M>0).reduce((M,$)=>M+$,0)]).sort((S,M)=>S[1]-M[1])[0])==null?void 0:w[0];D&&(O=D);break}case"initialPlacement":O=c;break}if(r!==O)return{reset:{placement:O}}}return{}}}};function Ds(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ls(e){return Iu.some(t=>e[t]>=0)}const Rd=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...r}=Et(e,t);switch(o){case"referenceHidden":{const s=await Pn(t,{...r,elementContext:"reference"}),i=Ds(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ls(i)}}}case"escaped":{const s=await Pn(t,{...r,altBoundary:!0}),i=Ds(s,n.floating);return{data:{escapedOffsets:i,escaped:Ls(i)}}}default:return{}}}}},mc=new Set(["left","top"]);async function Cd(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=Ze(n),c=Dt(n),u=at(n)==="y",l=mc.has(i)?-1:1,f=s&&u?-1:1,d=Et(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof g=="number"&&(m=c==="end"?g*-1:g),u?{x:m*f,y:p*l}:{x:p*l,y:m*f}}const _d=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:c}=t,u=await Cd(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+u.x,y:s+u.y,data:{...u,placement:i}}}}},Td=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:E=>{let{x:b,y}=E;return{x:b,y}}},...u}=Et(e,t),l={x:n,y:o},f=await Pn(t,u),d=at(Ze(r)),p=Or(d);let m=l[p],g=l[d];if(s){const E=p==="y"?"top":"left",b=p==="y"?"bottom":"right",y=m+f[E],x=m-f[b];m=ir(y,m,x)}if(i){const E=d==="y"?"top":"left",b=d==="y"?"bottom":"right",y=g+f[E],x=g-f[b];g=ir(y,g,x)}const h=c.fn({...t,[p]:m,[d]:g});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[p]:s,[d]:i}}}}}},Od=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:u=!0,crossAxis:l=!0}=Et(e,t),f={x:n,y:o},d=at(r),p=Or(d);let m=f[p],g=f[d];const h=Et(c,t),E=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){const x=p==="y"?"height":"width",v=s.reference[p]-s.floating[x]+E.mainAxis,R=s.reference[p]+s.reference[x]-E.mainAxis;m<v?m=v:m>R&&(m=R)}if(l){var b,y;const x=p==="y"?"width":"height",v=mc.has(Ze(r)),R=s.reference[d]-s.floating[x]+(v&&((b=i.offset)==null?void 0:b[d])||0)+(v?0:E.crossAxis),_=s.reference[d]+s.reference[x]+(v?0:((y=i.offset)==null?void 0:y[d])||0)-(v?E.crossAxis:0);g<R?g=R:g>_&&(g=_)}return{[p]:m,[d]:g}}}},Pd=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:i,elements:c}=t,{apply:u=()=>{},...l}=Et(e,t),f=await Pn(t,l),d=Ze(r),p=Dt(r),m=at(r)==="y",{width:g,height:h}=s.floating;let E,b;d==="top"||d==="bottom"?(E=d,b=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(b=d,E=p==="end"?"top":"bottom");const y=h-f.top-f.bottom,x=g-f.left-f.right,v=rn(h-f[E],y),R=rn(g-f[b],x),_=!t.middlewareData.shift;let T=v,N=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=x),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(T=y),_&&!p){const L=tt(f.left,0),k=tt(f.right,0),A=tt(f.top,0),w=tt(f.bottom,0);m?N=g-2*(L!==0||k!==0?L+k:tt(f.left,f.right)):T=h-2*(A!==0||w!==0?A+w:tt(f.top,f.bottom))}await u({...t,availableWidth:N,availableHeight:T});const F=await i.getDimensions(c.floating);return g!==F.width||h!==F.height?{reset:{rects:!0}}:{}}}};function gc(e){const t=Qe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Me(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,c=sn(n)!==s||sn(o)!==i;return c&&(n=s,o=i),{width:n,height:o,$:c}}function zr(e){return _e(e)?e:e.contextElement}function en(e){const t=zr(e);if(!Me(t))return ft(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=gc(t);let i=(s?sn(n.width):n.width)/o,c=(s?sn(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Ad=ft(0);function hc(e){const t=De(e);return!fo()||!t.visualViewport?Ad:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Nd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==De(e)?!1:t}function Wt(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=zr(e);let i=ft(1);t&&(o?_e(o)&&(i=en(o)):i=en(e));const c=Nd(s,n,o)?hc(s):ft(0);let u=(r.left+c.x)/i.x,l=(r.top+c.y)/i.y,f=r.width/i.x,d=r.height/i.y;if(s){const p=De(s),m=o&&_e(o)?De(o):o;let g=p,h=er(g);for(;h&&o&&m!==g;){const E=en(h),b=h.getBoundingClientRect(),y=Qe(h),x=b.left+(h.clientLeft+parseFloat(y.paddingLeft))*E.x,v=b.top+(h.clientTop+parseFloat(y.paddingTop))*E.y;u*=E.x,l*=E.y,f*=E.x,d*=E.y,u+=x,l+=v,g=De(h),h=er(g)}}return Qn({width:f,height:d,x:u,y:l})}function xo(e,t){const n=po(e).scrollLeft;return t?t.left+n:Wt(mt(e)).left+n}function yc(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-xo(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Id(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=mt(o),c=t?uo(t.floating):!1;if(o===i||c&&s)return n;let u={scrollLeft:0,scrollTop:0},l=ft(1);const f=ft(0),d=Me(o);if((d||!d&&!s)&&((Mt(o)!=="body"||Kt(i))&&(u=po(o)),Me(o))){const m=Wt(o);l=en(o),f.x=m.x+o.clientLeft,f.y=m.y+o.clientTop}const p=i&&!d&&!s?yc(i,u):ft(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-u.scrollLeft*l.x+f.x+p.x,y:n.y*l.y-u.scrollTop*l.y+f.y+p.y}}function Md(e){return Array.from(e.getClientRects())}function Dd(e){const t=mt(e),n=po(e),o=e.ownerDocument.body,r=tt(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=tt(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+xo(e);const c=-n.scrollTop;return Qe(o).direction==="rtl"&&(i+=tt(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:c}}const ks=25;function Ld(e,t){const n=De(e),o=mt(e),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,c=0,u=0;if(r){s=r.width,i=r.height;const f=fo();(!f||f&&t==="fixed")&&(c=r.offsetLeft,u=r.offsetTop)}const l=xo(o);if(l<=0){const f=o.ownerDocument,d=f.body,p=getComputedStyle(d),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(o.clientWidth-d.clientWidth-m);g<=ks&&(s-=g)}else l<=ks&&(s+=l);return{width:s,height:i,x:c,y:u}}const kd=new Set(["absolute","fixed"]);function Fd(e,t){const n=Wt(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=Me(e)?en(e):ft(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,u=r*s.x,l=o*s.y;return{width:i,height:c,x:u,y:l}}function Fs(e,t,n){let o;if(t==="viewport")o=Ld(e,n);else if(t==="document")o=Dd(mt(e));else if(_e(t))o=Fd(t,n);else{const r=hc(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Qn(o)}function bc(e,t){const n=vt(e);return n===t||!_e(n)||yt(n)?!1:Qe(n).position==="fixed"||bc(n,t)}function Vd(e,t){const n=t.get(e);if(n)return n;let o=_t(e,[],!1).filter(c=>_e(c)&&Mt(c)!=="body"),r=null;const s=Qe(e).position==="fixed";let i=s?vt(e):e;for(;_e(i)&&!yt(i);){const c=Qe(i),u=_r(i);!u&&c.position==="fixed"&&(r=null),(s?!u&&!r:!u&&c.position==="static"&&!!r&&kd.has(r.position)||Kt(i)&&!u&&bc(e,i))?o=o.filter(f=>f!==i):r=c,i=vt(i)}return t.set(e,o),o}function jd(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?uo(t)?[]:Vd(t,this._c):[].concat(n),o],c=i[0],u=i.reduce((l,f)=>{const d=Fs(t,f,r);return l.top=tt(d.top,l.top),l.right=rn(d.right,l.right),l.bottom=rn(d.bottom,l.bottom),l.left=tt(d.left,l.left),l},Fs(t,c,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function $d(e){const{width:t,height:n}=gc(e);return{width:t,height:n}}function Bd(e,t,n){const o=Me(t),r=mt(t),s=n==="fixed",i=Wt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const u=ft(0);function l(){u.x=xo(r)}if(o||!o&&!s)if((Mt(t)!=="body"||Kt(r))&&(c=po(t)),o){const m=Wt(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else r&&l();s&&!o&&r&&l();const f=r&&!o&&!s?yc(r,c):ft(0),d=i.left+c.scrollLeft-u.x-f.x,p=i.top+c.scrollTop-u.y-f.y;return{x:d,y:p,width:i.width,height:i.height}}function Vo(e){return Qe(e).position==="static"}function Vs(e,t){if(!Me(e)||Qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mt(e)===n&&(n=n.ownerDocument.body),n}function vc(e,t){const n=De(e);if(uo(e))return n;if(!Me(e)){let r=vt(e);for(;r&&!yt(r);){if(_e(r)&&!Vo(r))return r;r=vt(r)}return n}let o=Vs(e,t);for(;o&&gu(o)&&Vo(o);)o=Vs(o,t);return o&&yt(o)&&Vo(o)&&!_r(o)?n:o||Eu(e)||n}const Hd=async function(e){const t=this.getOffsetParent||vc,n=this.getDimensions,o=await n(e.floating);return{reference:Bd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function zd(e){return Qe(e).direction==="rtl"}const Ud={convertOffsetParentRelativeRectToViewportRelativeRect:Id,getDocumentElement:mt,getClippingRect:jd,getOffsetParent:vc,getElementRects:Hd,getClientRects:Md,getDimensions:$d,getScale:en,isElement:_e,isRTL:zd};function Ec(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wd(e,t){let n=null,o;const r=mt(e);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),s();const l=e.getBoundingClientRect(),{left:f,top:d,width:p,height:m}=l;if(c||t(),!p||!m)return;const g=Zt(d),h=Zt(r.clientWidth-(f+p)),E=Zt(r.clientHeight-(d+m)),b=Zt(f),x={rootMargin:-g+"px "+-h+"px "+-E+"px "+-b+"px",threshold:tt(0,rn(1,u))||1};let v=!0;function R(_){const T=_[0].intersectionRatio;if(T!==u){if(!v)return i();T?i(!1,T):o=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!Ec(l,e.getBoundingClientRect())&&i(),v=!1}try{n=new IntersectionObserver(R,{...x,root:r.ownerDocument})}catch{n=new IntersectionObserver(R,x)}n.observe(e)}return i(!0),s}function js(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=o,l=zr(e),f=r||s?[...l?_t(l):[],..._t(t)]:[];f.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const d=l&&c?Wd(l,n):null;let p=-1,m=null;i&&(m=new ResizeObserver(b=>{let[y]=b;y&&y.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),n()}),l&&!u&&m.observe(l),m.observe(t));let g,h=u?Wt(e):null;u&&E();function E(){const b=Wt(e);h&&!Ec(h,b)&&n(),h=b,g=requestAnimationFrame(E)}return n(),()=>{var b;f.forEach(y=>{r&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),d?.(),(b=m)==null||b.disconnect(),m=null,u&&cancelAnimationFrame(g)}}const qd=_d,Kd=Td,Gd=wd,Yd=Pd,Xd=Rd,Zd=Od,Jd=(e,t,n)=>{const o=new Map,r={platform:Ud,...n},s={...r.platform,_c:o};return Sd(e,t,{...r,platform:s})};var Qd=typeof document<"u",ep=function(){},Yn=Qd?ne.useLayoutEffect:ep;function oo(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!oo(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!oo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function xc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $s(e,t){const n=xc(e);return Math.round(t*n)/n}function jo(e){const t=a.useRef(e);return Yn(()=>{t.current=e}),t}function tp(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:u,open:l}=e,[f,d]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=a.useState(o);oo(p,o)||m(o);const[g,h]=a.useState(null),[E,b]=a.useState(null),y=a.useCallback(S=>{S!==_.current&&(_.current=S,h(S))},[]),x=a.useCallback(S=>{S!==T.current&&(T.current=S,b(S))},[]),v=s||g,R=i||E,_=a.useRef(null),T=a.useRef(null),N=a.useRef(f),F=u!=null,L=jo(u),k=jo(r),A=jo(l),w=a.useCallback(()=>{if(!_.current||!T.current)return;const S={placement:t,strategy:n,middleware:p};k.current&&(S.platform=k.current),Jd(_.current,T.current,S).then(M=>{const $={...M,isPositioned:A.current!==!1};I.current&&!oo(N.current,$)&&(N.current=$,rt.flushSync(()=>{d($)}))})},[p,t,n,k,A]);Yn(()=>{l===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,d(S=>({...S,isPositioned:!1})))},[l]);const I=a.useRef(!1);Yn(()=>(I.current=!0,()=>{I.current=!1}),[]),Yn(()=>{if(v&&(_.current=v),R&&(T.current=R),v&&R){if(L.current)return L.current(v,R,w);w()}},[v,R,w,L,F]);const C=a.useMemo(()=>({reference:_,floating:T,setReference:y,setFloating:x}),[y,x]),O=a.useMemo(()=>({reference:v,floating:R}),[v,R]),D=a.useMemo(()=>{const S={position:n,left:0,top:0};if(!O.floating)return S;const M=$s(O.floating,f.x),$=$s(O.floating,f.y);return c?{...S,transform:"translate("+M+"px, "+$+"px)",...xc(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:$}},[n,c,O.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:w,refs:C,elements:O,floatingStyles:D}),[f,w,C,O,D])}const np=(e,t)=>({...qd(e),options:[e,t]}),op=(e,t)=>({...Kd(e),options:[e,t]}),rp=(e,t)=>({...Zd(e),options:[e,t]}),sp=(e,t)=>({...Gd(e),options:[e,t]}),ip=(e,t)=>({...Yd(e),options:[e,t]}),cp=(e,t)=>({...Xd(e),options:[e,t]}),ap={intentional:"onClick",sloppy:"onPointerDown"};function lp(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Ur(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:c,dataRef:u}=n.context,{enabled:l=!0,escapeKey:f=!0,outsidePress:d=!0,outsidePressEvent:p="sloppy",referencePress:m=!1,referencePressEvent:g="sloppy",ancestorScroll:h=!1,bubbles:E,externalTree:b}=t,y=Gt(b),x=Q(typeof d=="function"?d:()=>!1),v=typeof d=="function"?x:d,R=a.useRef(!1),{escapeKey:_,outsidePress:T}=lp(E),N=a.useRef(null),F=Xe(),L=Xe(),k=Q(()=>{L.clear(),u.current.insideReactTree=!1}),A=a.useRef(!1),w=a.useRef(""),I=Q(B=>{w.current=B.pointerType}),C=Q(()=>{const B=w.current,ie=B==="pen"||!B?"mouse":B,oe=typeof p=="function"?p():p;return typeof oe=="string"?oe:oe[ie]}),O=Q(B=>{if(!o||!l||!f||B.key!=="Escape"||A.current)return;const ie=u.current.floatingContext?.nodeId,oe=y?zt(y.nodesRef.current,ie):[];if(!_&&oe.length>0){let K=!0;if(oe.forEach(W=>{W.context?.open&&!W.context.dataRef.current.__escapeKeyBubbles&&(K=!1)}),!K)return}const Se=Nu(B)?B.nativeEvent:B,U=ge(Ei,Se);n.setOpen(!1,U),!_&&!U.isPropagationAllowed&&B.stopPropagation()}),D=Q(B=>{const ie=C();return ie==="intentional"&&B.type!=="click"||ie==="sloppy"&&B.type==="click"}),S=Q(()=>{u.current.insideReactTree=!0,L.start(0,k)}),M=Q((B,ie=!1)=>{if(D(B)){k();return}if(u.current.insideReactTree){k();return}if(C()==="intentional"&&ie||typeof v=="function"&&!v(B))return;const oe=qe(B),Se=`[${On("inert")}]`,U=Le(n.select("floatingElement")).querySelectorAll(Se),K=n.context.triggerElements;if(oe&&(K.hasElement(oe)||K.hasMatchingElement(V=>xe(V,oe))))return;let W=_e(oe)?oe:null;for(;W&&!yt(W);){const V=vt(W);if(yt(V)||!_e(V))break;W=V}if(U.length&&_e(oe)&&!Au(oe)&&!xe(oe,n.select("floatingElement"))&&Array.from(U).every(V=>!xe(W,V)))return;if(Me(oe)&&!("touches"in B)){const V=yt(oe),ce=Qe(oe),ee=/auto|scroll/,q=V||ee.test(ce.overflowX),J=V||ee.test(ce.overflowY),ue=q&&oe.clientWidth>0&&oe.scrollWidth>oe.clientWidth,fe=J&&oe.clientHeight>0&&oe.scrollHeight>oe.clientHeight,Re=ce.direction==="rtl",we=fe&&(Re?B.offsetX<=oe.offsetWidth-oe.clientWidth:B.offsetX>oe.clientWidth),Ce=ue&&B.offsetY>oe.clientHeight;if(we||Ce)return}const pe=u.current.floatingContext?.nodeId,le=y&&zt(y.nodesRef.current,pe).some(V=>lt(B,V.context?.elements.floating));if(lt(B,n.select("floatingElement"))||lt(B,n.select("domReferenceElement"))||le)return;const re=y?zt(y.nodesRef.current,pe):[];if(re.length>0){let V=!0;if(re.forEach(ce=>{ce.context?.open&&!ce.context.dataRef.current.__outsidePressBubbles&&(V=!1)}),!V)return}n.setOpen(!1,ge(bi,B)),k()}),$=Q(B=>{C()!=="sloppy"||B.pointerType==="touch"||!n.select("open")||!l||lt(B,n.select("floatingElement"))||lt(B,n.select("domReferenceElement"))||M(B)}),z=Q(B=>{if(C()!=="sloppy"||!n.select("open")||!l||lt(B,n.select("floatingElement"))||lt(B,n.select("domReferenceElement")))return;const ie=B.touches[0];ie&&(N.current={startTime:Date.now(),startX:ie.clientX,startY:ie.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},F.start(1e3,()=>{N.current&&(N.current.dismissOnTouchEnd=!1,N.current.dismissOnMouseDown=!1)}))}),Z=Q(B=>{const ie=qe(B);function oe(){z(B),ie?.removeEventListener(B.type,oe)}ie?.addEventListener(B.type,oe)}),Y=Q(B=>{const ie=R.current;if(R.current=!1,F.clear(),B.type==="mousedown"&&N.current&&!N.current.dismissOnMouseDown)return;const oe=qe(B);function Se(){B.type==="pointerdown"?$(B):M(B,ie),oe?.removeEventListener(B.type,Se)}oe?.addEventListener(B.type,Se)}),te=Q(B=>{if(C()!=="sloppy"||!N.current||lt(B,n.select("floatingElement"))||lt(B,n.select("domReferenceElement")))return;const ie=B.touches[0];if(!ie)return;const oe=Math.abs(ie.clientX-N.current.startX),Se=Math.abs(ie.clientY-N.current.startY),U=Math.sqrt(oe*oe+Se*Se);U>5&&(N.current.dismissOnTouchEnd=!0),U>10&&(M(B),F.clear(),N.current=null)}),G=Q(B=>{const ie=qe(B);function oe(){te(B),ie?.removeEventListener(B.type,oe)}ie?.addEventListener(B.type,oe)}),H=Q(B=>{C()!=="sloppy"||!N.current||lt(B,n.select("floatingElement"))||lt(B,n.select("domReferenceElement"))||(N.current.dismissOnTouchEnd&&M(B),F.clear(),N.current=null)}),j=Q(B=>{const ie=qe(B);function oe(){H(B),ie?.removeEventListener(B.type,oe)}ie?.addEventListener(B.type,oe)});a.useEffect(()=>{if(!o||!l)return;u.current.__escapeKeyBubbles=_,u.current.__outsidePressBubbles=T;const B=new pt;function ie(W){n.setOpen(!1,ge(ln,W))}function oe(){B.clear(),A.current=!0}function Se(){B.start(fo()?5:0,()=>{A.current=!1})}const U=Le(r);U.addEventListener("pointerdown",I,!0),f&&(U.addEventListener("keydown",O),U.addEventListener("compositionstart",oe),U.addEventListener("compositionend",Se)),v&&(U.addEventListener("click",Y,!0),U.addEventListener("pointerdown",Y,!0),U.addEventListener("touchstart",Z,!0),U.addEventListener("touchmove",G,!0),U.addEventListener("touchend",j,!0),U.addEventListener("mousedown",Y,!0));let K=[];return h&&(_e(i)&&(K=_t(i)),_e(r)&&(K=K.concat(_t(r))),!_e(s)&&s&&s.contextElement&&(K=K.concat(_t(s.contextElement)))),K=K.filter(W=>W!==U.defaultView?.visualViewport),K.forEach(W=>{W.addEventListener("scroll",ie,{passive:!0})}),()=>{U.removeEventListener("pointerdown",I,!0),f&&(U.removeEventListener("keydown",O),U.removeEventListener("compositionstart",oe),U.removeEventListener("compositionend",Se)),v&&(U.removeEventListener("click",Y,!0),U.removeEventListener("pointerdown",Y,!0),U.removeEventListener("touchstart",Z,!0),U.removeEventListener("touchmove",G,!0),U.removeEventListener("touchend",j,!0),U.removeEventListener("mousedown",Y,!0)),K.forEach(W=>{W.removeEventListener("scroll",ie)}),B.clear()}},[u,r,s,i,f,v,o,c,h,l,_,T,O,M,Y,$,Z,G,j,I,n]),a.useEffect(k,[v,k]);const ae=a.useMemo(()=>({onKeyDown:O,...m&&{[ap[g]]:B=>{n.setOpen(!1,ge(ht,B.nativeEvent))},...g!=="intentional"&&{onClick(B){n.setOpen(!1,ge(ht,B.nativeEvent))}}}}),[O,n,m,g]),de=Q(B=>{const ie=qe(B.nativeEvent);!xe(n.select("floatingElement"),ie)||B.button!==0||(R.current=!0)}),Ee=a.useMemo(()=>({onKeyDown:O,onMouseDown:de,onMouseUp:de,onPointerDownCapture:S,onMouseDownCapture:S,onClickCapture:S,onMouseUpCapture:S,onTouchEndCapture:S,onTouchMoveCapture:S}),[O,de,S]);return a.useMemo(()=>l?{reference:ae,floating:Ee,trigger:ae}:{},[l,ae,Ee])}var up=(e,t,n)=>{if(t.length===1&&t[0]===n){let o=!1;try{const r={};e(r)===r&&(o=!0)}catch{}if(o){let r;try{throw new Error}catch(s){({stack:r}=s)}console.warn(`The result function returned its own inputs without modification. e.g
|
|
4
|
+
\`createSelector([state => state.todos], todos => todos)\`
|
|
5
|
+
This could lead to inefficient memoization and unnecessary re-renders.
|
|
6
|
+
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:r})}}},fp=(e,t,n)=>{const{memoize:o,memoizeOptions:r}=t,{inputSelectorResults:s,inputSelectorResultsCopy:i}=e,c=o(()=>({}),...r);if(!(c.apply(null,s)===c.apply(null,i))){let l;try{throw new Error}catch(f){({stack:l}=f)}console.warn(`An input selector returned a different result when passed same arguments.
|
|
7
|
+
This means your output selector will likely run more frequently than intended.
|
|
8
|
+
Avoid returning a new reference inside your input selector, e.g.
|
|
9
|
+
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:s,secondInputs:i,stack:l})}},dp={inputStabilityCheck:"once",identityFunctionCheck:"once"},ro=Symbol("NOT_FOUND");function pp(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function mp(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function gp(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(o=>typeof o=="function"?`function ${o.name||"unnamed"}()`:typeof o).join(", ");throw new TypeError(`${t}[${n}]`)}}var Bs=e=>Array.isArray(e)?e:[e];function hp(e){const t=Array.isArray(e[0])?e[0]:e;return gp(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Hs(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}var yp=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...dp,...t};return{identityFunctionCheck:{shouldRun:n==="always"||n==="once"&&e,run:up},inputStabilityCheck:{shouldRun:o==="always"||o==="once"&&e,run:fp}}};function bp(e){let t;return{get(n){return t&&e(t.key,n)?t.value:ro},put(n,o){t={key:n,value:o}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function vp(e,t){let n=[];function o(c){const u=n.findIndex(l=>t(c,l.key));if(u>-1){const l=n[u];return u>0&&(n.splice(u,1),n.unshift(l)),l.value}return ro}function r(c,u){o(c)===ro&&(n.unshift({key:c,value:u}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:o,put:r,getEntries:s,clear:i}}var Ep=(e,t)=>e===t;function xp(e){return function(n,o){if(n===null||o===null||n.length!==o.length)return!1;const{length:r}=n;for(let s=0;s<r;s++)if(!e(n[s],o[s]))return!1;return!0}}function Sp(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:o=Ep,maxSize:r=1,resultEqualityCheck:s}=n,i=xp(o);let c=0;const u=r<=1?bp(i):vp(r,i);function l(){let f=u.get(arguments);if(f===ro){if(f=e.apply(null,arguments),c++,s){const p=u.getEntries().find(m=>s(m.value,f));p&&(f=p.value,c!==0&&c--)}u.put(arguments,f)}return f}return l.clearCache=()=>{u.clear(),l.resetResultsCount()},l.resultsCount=()=>c,l.resetResultsCount=()=>{c=0},l}var wp=class{constructor(e){this.value=e}deref(){return this.value}},Rp=typeof WeakRef<"u"?WeakRef:wp,Cp=0,zs=1;function $n(){return{s:Cp,v:void 0,o:null,p:null}}function Sc(e,t={}){let n=$n();const{resultEqualityCheck:o}=t;let r,s=0;function i(){let c=n;const{length:u}=arguments;for(let d=0,p=u;d<p;d++){const m=arguments[d];if(typeof m=="function"||typeof m=="object"&&m!==null){let g=c.o;g===null&&(c.o=g=new WeakMap);const h=g.get(m);h===void 0?(c=$n(),g.set(m,c)):c=h}else{let g=c.p;g===null&&(c.p=g=new Map);const h=g.get(m);h===void 0?(c=$n(),g.set(m,c)):c=h}}const l=c;let f;if(c.s===zs)f=c.v;else if(f=e.apply(null,arguments),s++,o){const d=r?.deref?.()??r;d!=null&&o(d,f)&&(f=d,s!==0&&s--),r=typeof f=="object"&&f!==null||typeof f=="function"?new Rp(f):f}return l.s=zs,l.v=f,f}return i.clearCache=()=>{n=$n(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function wc(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,o=(...r)=>{let s=0,i=0,c,u={},l=r.pop();typeof l=="object"&&(u=l,l=r.pop()),pp(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const f={...n,...u},{memoize:d,memoizeOptions:p=[],argsMemoize:m=Sc,argsMemoizeOptions:g=[],devModeChecks:h={}}=f,E=Bs(p),b=Bs(g),y=hp(r),x=d(function(){return s++,l.apply(null,arguments)},...E);let v=!0;const R=m(function(){i++;const T=Hs(y,arguments);if(c=x.apply(null,T),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:N,inputStabilityCheck:F}=yp(v,h);if(N.shouldRun&&N.run(l,T,c),F.shouldRun){const L=Hs(y,arguments);F.run({inputSelectorResults:T,inputSelectorResultsCopy:L},{memoize:d,memoizeOptions:E},arguments)}v&&(v=!1)}return c},...b);return Object.assign(R,{resultFunc:l,memoizedResultFunc:x,dependencies:y,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>c,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:m})};return Object.assign(o,{withTypes:()=>o}),o}var _p=wc(Sc),Tp=Object.assign((e,t=_p)=>{mp(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),o=n.map(s=>e[s]);return t(o,(...s)=>s.reduce((i,c,u)=>(i[n[u]]=c,i),{}))},{withTypes:()=>Tp});wc({memoize:Sp,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const se=(e,t,n,o,r,s,...i)=>{if(i.length>0)throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of selectors":Ae(1));let c;if(e)c=e;else throw new Error("Missing arguments");return c};var Bn={exports:{}},$o={},Hn={exports:{}},Bo={};var Us;function Op(){if(Us)return Bo;Us=1;var e=ne;function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(d,p){var m=p(),g=o({inst:{value:m,getSnapshot:p}}),h=g[0].inst,E=g[1];return s(function(){h.value=m,h.getSnapshot=p,u(h)&&E({inst:h})},[d,m,p]),r(function(){return u(h)&&E({inst:h}),d(function(){u(h)&&E({inst:h})})},[d]),i(m),m}function u(d){var p=d.getSnapshot;d=d.value;try{var m=p();return!n(d,m)}catch{return!0}}function l(d,p){return p()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:c;return Bo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Bo}var Ho={};var Ws;function Pp(){return Ws||(Ws=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}function t(m,g){f||r.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=g();if(!d){var E=g();s(h,E)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}E=i({inst:{value:h,getSnapshot:g}});var b=E[0].inst,y=E[1];return u(function(){b.value=h,b.getSnapshot=g,n(b)&&y({inst:b})},[m,h,g]),c(function(){return n(b)&&y({inst:b}),m(function(){n(b)&&y({inst:b})})},[m]),l(h),h}function n(m){var g=m.getSnapshot;m=m.value;try{var h=g();return!s(m,h)}catch{return!0}}function o(m,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=ne,s=typeof Object.is=="function"?Object.is:e,i=r.useState,c=r.useEffect,u=r.useLayoutEffect,l=r.useDebugValue,f=!1,d=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;Ho.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ho}var qs;function Rc(){return qs||(qs=1,process.env.NODE_ENV==="production"?Hn.exports=Op():Hn.exports=Pp()),Hn.exports}var Ks;function Ap(){if(Ks)return $o;Ks=1;var e=ne,t=Rc();function n(l,f){return l===f&&(l!==0||1/l===1/f)||l!==l&&f!==f}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,c=e.useMemo,u=e.useDebugValue;return $o.useSyncExternalStoreWithSelector=function(l,f,d,p,m){var g=s(null);if(g.current===null){var h={hasValue:!1,value:null};g.current=h}else h=g.current;g=c(function(){function b(_){if(!y){if(y=!0,x=_,_=p(_),m!==void 0&&h.hasValue){var T=h.value;if(m(T,_))return v=T}return v=_}if(T=v,o(x,_))return T;var N=p(_);return m!==void 0&&m(T,N)?(x=_,T):(x=_,v=N)}var y=!1,x,v,R=d===void 0?null:d;return[function(){return b(f())},R===null?void 0:function(){return b(R())}]},[f,d,p,m]);var E=r(l,g[0],g[1]);return i(function(){h.hasValue=!0,h.value=E},[E]),u(E),E},$o}var zo={};var Gs;function Np(){return Gs||(Gs=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,f){return l===f&&(l!==0||1/l===1/f)||l!==l&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=ne,n=Rc(),o=typeof Object.is=="function"?Object.is:e,r=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,u=t.useDebugValue;zo.useSyncExternalStoreWithSelector=function(l,f,d,p,m){var g=s(null);if(g.current===null){var h={hasValue:!1,value:null};g.current=h}else h=g.current;g=c(function(){function b(_){if(!y){if(y=!0,x=_,_=p(_),m!==void 0&&h.hasValue){var T=h.value;if(m(T,_))return v=T}return v=_}if(T=v,o(x,_))return T;var N=p(_);return m!==void 0&&m(T,N)?(x=_,T):(x=_,v=N)}var y=!1,x,v,R=d===void 0?null:d;return[function(){return b(f())},R===null?void 0:function(){return b(R())}]},[f,d,p,m]);var E=r(l,g[0],g[1]);return i(function(){h.hasValue=!0,h.value=E},[E]),u(E),E},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),zo}var Ys;function Ip(){return Ys||(Ys=1,process.env.NODE_ENV==="production"?Bn.exports=Ap():Bn.exports=Np()),Bn.exports}var Mp=Ip();function ve(e,t,n,o,r){const s=i=>t(i,n,o,r);return Mp.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s)}class tn{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){tn.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||tn.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};tn.prototype.setState.call(this,t)}}class Wr extends tn{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}controlledValues=new Map;useSyncedValue(t,n){a.useDebugValue(t),X(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){X(()=>(this.state[t]!==n&&this.set(t,n),()=>{this.set(t,void 0)}),[t,n])}useSyncedValues(t){if(process.env.NODE_ENV!=="production"){a.useDebugValue(t,s=>Object.keys(s));const o=a.useRef(Object.keys(t)).current,r=Object.keys(t);(o.length!==r.length||o.some((s,i)=>s!==r[i]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const n=Object.values(t);X(()=>{this.update(t)},n)}useControlledProp(t,n,o){a.useDebugValue(t);const r=n!==void 0;if(process.env.NODE_ENV!=="production"){const s=this.controlledValues.get(t);s!==void 0&&s!==r&&console.error(`A component is changing the ${r?"":"un"}controlled state of ${t.toString()} to be ${r?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}this.controlledValues.has(t)||(this.controlledValues.set(t,r),!r&&!Object.is(this.state[t],o)&&super.setState({...this.state,[t]:o})),X(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,o,r])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.update(n)}setState(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.setState({...this.state,...n})}select=(t,n,o,r)=>{const s=this.selectors[t];return s(this.state,n,o,r)};useState=(t,n,o,r)=>{a.useDebugValue(t);const s=this.selectors[t];return ve(this,s,n,o,r)};useContextCallback(t,n){a.useDebugValue(t);const o=Q(n??nt);this.context[t]=o}useStateSetter(t){const n=a.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{const i=o(s);if(!Object.is(r,i)){const c=r;r=i,n(i,c,this)}})}}const Dp={open:se(e=>e.open),domReferenceElement:se(e=>e.domReferenceElement),referenceElement:se(e=>e.positionReference??e.referenceElement),floatingElement:se(e=>e.floatingElement),floatingId:se(e=>e.floatingId)};class qr extends Wr{constructor(t){const{nested:n,noEmit:o,onOpenChange:r,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:uc(),nested:n,noEmit:o,triggerElements:s},Dp)}setOpen=(t,n)=>{if(this.context.dataRef.current.openEvent=t?n.event:void 0,!this.context.noEmit){const o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)}this.context.onOpenChange?.(t,n)}}function Lp(e,t){const n=a.useRef(null);return a.useCallback(o=>{if(e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),o!==null))return n.current=e,t.context.triggerElements.add(e,o),()=>{n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null)}},[t,e])}function Cc(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=Lp(e,n),i=Q(c=>{const u=s(c);return c!==null&&n.select("open")&&n.select("activeTriggerId")==null&&n.update({activeTriggerId:e,activeTriggerElement:c,...o}),u});return X(()=>{r&&n.update({activeTriggerElement:t,...o})},[r,n,t,...Object.values(o)]),{registerTrigger:i,isMountedByThisTrigger:r}}function _c(e){const t=e.useState("open");X(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[o,r]=n.value;e.update({activeTriggerId:o,activeTriggerElement:r})}}},[t,e])}function Tc(e,t,n){const{mounted:o,setMounted:r,transitionStatus:s}=ao(e);t.useSyncedValues({mounted:o,transitionStatus:s});const i=Q(()=>{r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),c=t.useState("preventUnmountingOnClose");return Lt({enabled:!c,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class So{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const o=this.idMap.get(t);if(o!==n&&(o!==void 0&&this.elements.delete(o),this.elements.add(n),this.idMap.set(t,n),process.env.NODE_ENV!=="production"&&this.elements.size!==this.idMap.size))throw new Error(process.env.NODE_ENV!=="production"?"Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.":Ae(87))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function kp(){return new qr({open:!1,floatingElement:null,referenceElement:null,triggerElements:new So,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Oc(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:kp(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:ze,inactiveTriggerProps:ze,popupProps:ze}}const Pc={open:se(e=>e.open),mounted:se(e=>e.mounted),transitionStatus:se(e=>e.transitionStatus),floatingRootContext:se(e=>e.floatingRootContext),preventUnmountingOnClose:se(e=>e.preventUnmountingOnClose),payload:se(e=>e.payload),activeTriggerId:se(e=>e.activeTriggerId),activeTriggerElement:se(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:se((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:se((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:se((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:se((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:se(e=>e.popupProps),popupElement:se(e=>e.popupElement),positionerElement:se(e=>e.positionerElement)};function Ac(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,r=Nt(),s=Vt()!=null;if(process.env.NODE_ENV!=="production"){const c=o.reference;c&&!_e(c)&&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=Je(()=>new qr({open:t,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new So,floatingId:r,nested:s,noEmit:e.noEmit||!1})).current;return X(()=>{const c={open:t,floatingId:r};o.reference!==void 0&&(c.referenceElement=o.reference,c.domReferenceElement=_e(o.reference)?o.reference:null),o.floating!==void 0&&(c.floatingElement=o.floating),i.update(c)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function Fp(e={}){const{nodeId:t,externalTree:n}=e,o=Ac(e),r=e.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,c]=a.useState(null),u=a.useRef(null),l=Gt(n);X(()=>{s.domReference&&(u.current=s.domReference)},[s.domReference]);const f=tp({...e,elements:{...s,...i&&{reference:i}}}),d=a.useCallback(T=>{const N=_e(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;c(N),f.refs.setReference(N)},[f.refs]),[p,m]=a.useState(null),[g,h]=a.useState(null);r.useSyncedValue("referenceElement",p),r.useSyncedValue("domReferenceElement",_e(p)?p:null),r.useSyncedValue("floatingElement",g);const E=a.useCallback(T=>{(_e(T)||T===null)&&(u.current=T,m(T)),(_e(f.refs.reference.current)||f.refs.reference.current===null||T!==null&&!_e(T))&&f.refs.setReference(T)},[f.refs,m]),b=a.useCallback(T=>{h(T),f.refs.setFloating(T)},[f.refs]),y=a.useMemo(()=>({...f.refs,setReference:E,setFloating:b,setPositionReference:d,domReference:u}),[f.refs,E,b,d]),x=a.useMemo(()=>({...f.elements,domReference:s.domReference}),[f.elements,s.domReference]),v=r.useState("open"),R=r.useState("floatingId"),_=a.useMemo(()=>({...f,dataRef:r.context.dataRef,open:v,onOpenChange:r.setOpen,events:r.context.events,floatingId:R,refs:y,elements:x,nodeId:t,rootStore:r}),[f,y,x,t,r,v,R]);return X(()=>{r.context.dataRef.current.floatingContext=_;const T=l?.nodesRef.current.find(N=>N.id===t);T&&(T.context=_)}),a.useMemo(()=>({...f,context:_,refs:y,elements:x,rootStore:r}),[f,y,x,_,r])}function Nc(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:o=!1,onOpenChange:r}=e,s=Nt(),i=Vt()!=null,c=t.useState("open"),u=t.useState("activeTriggerElement"),l=t.useState(o?"popupElement":"positionerElement"),f=t.context.triggerElements,d=Je(()=>new qr({open:c,referenceElement:u,floatingElement:l,triggerElements:f,onOpenChange:r,floatingId:s,nested:i,noEmit:n})).current;return X(()=>{const p={open:c,floatingId:s,referenceElement:u,floatingElement:l};_e(u)&&(p.domReferenceElement=u),d.update(p)},[c,s,u,l,d]),d.context.onOpenChange=r,d.context.nested=i,d.context.noEmit=n,d}const fr=On("safe-polygon"),Vp=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${ki}`;function jp(e){return e?!!e.closest(Vp):!1}function Ic(e){const t=a.useRef(void 0),n=a.useRef(!1),o=a.useRef(void 0),r=a.useRef(!0),s=a.useRef(!1),i=a.useRef(()=>{}),c=a.useRef(!1),u=Xe(),l=Xe(),f=a.useRef(void 0);return a.useMemo(()=>{const d=e.context.dataRef.current;return d.hoverInteractionState||(d.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:o,blockMouseMoveRef:r,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:c,openChangeTimeout:u,restTimeout:l,handleCloseOptionsRef:f}),d.hoverInteractionState},[e,t,n,o,r,s,i,c,u,l,f])}const $p=new Set(["click","mousedown"]);function Bp(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:c=!0,closeDelay:u=0,externalTree:l}=t,{pointerTypeRef:f,interactedInsideRef:d,handlerRef:p,performedPointerEventsMutationRef:m,unbindMouseMoveRef:g,restTimeoutPendingRef:h,openChangeTimeout:E,handleCloseOptionsRef:b}=Ic(n),y=Gt(l),x=Vt(),v=Q(()=>d.current?!0:i.current.openEvent?$p.has(i.current.openEvent.type):!1),R=Q(()=>{const L=i.current.openEvent?.type;return L?.includes("mouse")&&L!=="mousedown"}),_=a.useCallback((L,k=!0)=>{const A=Hp(u,f.current);A&&!p.current?E.start(A,()=>n.setOpen(!1,ge(ot,L))):k&&(E.clear(),n.setOpen(!1,ge(ot,L)))},[u,p,n,f,E]),T=Q(()=>{g.current(),p.current=void 0}),N=Q(()=>{if(m.current){const L=Le(r).body;L.style.pointerEvents="",L.removeAttribute(fr),m.current=!1}}),F=Q(L=>{const k=qe(L);if(!jp(k)){d.current=!1;return}d.current=!0});X(()=>{o||(f.current=void 0,h.current=!1,d.current=!1,T(),N())},[o,f,h,d,T,N]),a.useEffect(()=>()=>{T()},[T]),a.useEffect(()=>N,[N]),X(()=>{if(c&&o&&b.current?.blockPointerEvents&&R()&&_e(s)&&r){m.current=!0;const L=Le(r).body;L.setAttribute(fr,"");const k=s,A=r,w=y?.nodesRef.current.find(I=>I.id===x)?.context?.elements.floating;return w&&(w.style.pointerEvents=""),L.style.pointerEvents="none",k.style.pointerEvents="auto",A.style.pointerEvents="auto",()=>{L.style.pointerEvents="",k.style.pointerEvents="",A.style.pointerEvents=""}}},[c,o,s,r,b,R,y,x,m]),a.useEffect(()=>{if(!c)return;function L(I){if(v()||!i.current.floatingContext)return;const C=n.context.triggerElements;I.relatedTarget&&C.hasElement(I.relatedTarget)||(N(),T(),v()||_(I))}function k(I){E.clear(),N(),p.current?.(I),T()}function A(I){v()||_(I,!1)}const w=r;return w&&(w.addEventListener("mouseleave",L),w.addEventListener("mouseenter",k),w.addEventListener("mouseleave",A),w.addEventListener("pointerdown",F,!0)),()=>{w&&(w.removeEventListener("mouseleave",L),w.removeEventListener("mouseenter",k),w.removeEventListener("mouseleave",A),w.removeEventListener("pointerdown",F,!0))}})}function Hp(e,t){return t&&!on(t)?0:typeof e=="function"?e():e}function Uo(e){return typeof e=="function"?e():e}function zp(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:c=null,mouseOnly:u=!1,restMs:l=0,move:f=!0,triggerElement:d=null,externalTree:p,isActiveTrigger:m=!0}=t,g=Gt(p),{pointerTypeRef:h,interactedInsideRef:E,handlerRef:b,blockMouseMoveRef:y,performedPointerEventsMutationRef:x,unbindMouseMoveRef:v,restTimeoutPendingRef:R,openChangeTimeout:_,restTimeout:T,handleCloseOptionsRef:N}=Ic(n),F=Ve(c),L=Ve(i),k=Ve(l);m&&(N.current=F.current?.__options);const A=Q(()=>E.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),w=a.useCallback((D,S=!0)=>{const M=Lo(L.current,"close",h.current);M&&!b.current?_.start(M,()=>n.setOpen(!1,ge(ot,D))):S&&(_.clear(),n.setOpen(!1,ge(ot,D)))},[L,b,n,h,_]),I=Q(()=>{v.current(),b.current=void 0}),C=Q(()=>{if(x.current){const D=Le(n.select("domReferenceElement")).body;D.style.pointerEvents="",D.removeAttribute(fr),x.current=!1}});a.useEffect(()=>{if(!s)return;function D(S){S.open||(_.clear(),T.clear(),y.current=!0,R.current=!1)}return r.on("openchange",D),()=>{r.off("openchange",D)}},[s,r,_,T,y,R]);const O=Q(D=>{if(A()||!o.current.floatingContext)return;const S=n.context.triggerElements;D.relatedTarget&&S.hasElement(D.relatedTarget)||F.current?.({...o.current.floatingContext,tree:g,x:D.clientX,y:D.clientY,onClose(){C(),I(),A()||w(D)}})(D)});return a.useEffect(()=>{if(!s)return;const D=d??(m?n.select("domReferenceElement"):null);if(!_e(D))return;function S(z){if(_.clear(),y.current=!1,u&&!on(h.current)||Uo(k.current)>0&&!Lo(L.current,"open"))return;const Z=Lo(L.current,"open",h.current),Y=n.select("domReferenceElement"),te=n.context.triggerElements,G=(te.hasElement(z.target)||te.hasMatchingElement(j=>xe(j,z.target)))&&(!Y||!xe(Y,z.target)),H=z.currentTarget??null;Z?_.start(Z,()=>{n.select("open")||n.setOpen(!0,ge(ot,z,H))}):(!n.select("open")||G)&&n.setOpen(!0,ge(ot,z,H))}function M(z){if(A()){C();return}v.current();const Z=n.select("domReferenceElement"),Y=Le(Z);T.clear(),R.current=!1;const te=n.context.triggerElements;if(z.relatedTarget&&te.hasElement(z.relatedTarget))return;if(F.current&&o.current.floatingContext){n.select("open")||_.clear(),b.current=F.current({...o.current.floatingContext,tree:g,x:z.clientX,y:z.clientY,onClose(){C(),I(),A()||w(z,!0)}});const H=b.current;H(z),Y.addEventListener("mousemove",H),v.current=()=>{Y.removeEventListener("mousemove",H)};return}(h.current==="touch"?!xe(n.select("floatingElement"),z.relatedTarget):!0)&&w(z)}function $(z){O(z)}return n.select("open")&&D.addEventListener("mouseleave",$),f&&D.addEventListener("mousemove",S,{once:!0}),D.addEventListener("mouseenter",S),D.addEventListener("mouseleave",M),()=>{D.removeEventListener("mouseleave",$),f&&D.removeEventListener("mousemove",S),D.removeEventListener("mouseenter",S),D.removeEventListener("mouseleave",M)}},[I,C,y,o,L,w,n,s,F,O,m,A,u,f,h,k,T,R,_,d,g,v,b]),a.useMemo(()=>{function D(S){h.current=S.pointerType}return{onPointerDown:D,onPointerEnter:D,onMouseMove(S){const{nativeEvent:M}=S,$=S.currentTarget,z=n.select("domReferenceElement"),Z=n.context.triggerElements,Y=n.select("open"),te=(Z.hasElement(S.target)||Z.hasMatchingElement(H=>xe(H,S.target)))&&(!z||!xe(z,S.target));if(u&&!on(h.current)||Y&&!te||Uo(k.current)===0||!te&&R.current&&S.movementX**2+S.movementY**2<2)return;T.clear();function G(){!y.current&&(!Y||te)&&n.setOpen(!0,ge(ot,M,$))}h.current==="touch"?rt.flushSync(()=>{G()}):te&&Y?G():(R.current=!0,T.start(Uo(k.current),G))}}},[y,u,n,h,k,T,R])}function Mn(e=[]){const t=e.map(l=>l?.reference),n=e.map(l=>l?.floating),o=e.map(l=>l?.item),r=e.map(l=>l?.trigger),s=a.useCallback(l=>zn(l,e,"reference"),t),i=a.useCallback(l=>zn(l,e,"floating"),n),c=a.useCallback(l=>zn(l,e,"item"),o),u=a.useCallback(l=>zn(l,e,"trigger"),r);return a.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:c,getTriggerProps:u}),[s,i,c,u])}function zn(e,t,n){const o=new Map,r=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[or]="");for(const i in e)r&&e&&(i===Di||i===Li)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let c;const u=t[i]?.[n];typeof u=="function"?c=e?u(e):null:c=u,c&&Xs(s,c,r,o)}return Xs(s,e,r,o),s}function Xs(e,t,n,o){for(const r in t){const s=t[r];n&&(r===Di||r===Li)||(r.startsWith("on")?(o.has(r)||o.set(r,[]),typeof s=="function"&&(o.get(r)?.push(s),e[r]=(...i)=>o.get(r)?.map(c=>c(...i)).find(c=>c!==void 0))):e[r]=s)}}const Up="Escape";function wo(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Un(e,t){return wo(t,e===Tr||e===Nn,e===Tt||e===Ot)}function Wo(e,t,n){return wo(t,e===Nn,n?e===Tt:e===Ot)||e==="Enter"||e===" "||e===""}function Wp(e,t,n){return wo(t,n?e===Tt:e===Ot,e===Nn)}function qp(e,t,n,o){const r=n?e===Ot:e===Tt,s=e===Tr;return t==="both"||t==="horizontal"&&o&&o>1?e===Up:wo(t,r,s)}function Kp(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:c,activeIndex:u,onNavigate:l=()=>{},enabled:f=!0,selectedIndex:d=null,allowEscape:p=!1,loopFocus:m=!1,nested:g=!1,rtl:h=!1,virtual:E=!1,focusItemOnOpen:b="auto",focusItemOnHover:y=!0,openOnArrowKeyDown:x=!0,disabledIndices:v=void 0,orientation:R="vertical",parentOrientation:_,cols:T=1,scrollItemIntoView:N=!0,itemSizes:F,dense:L=!1,id:k,externalTree:A}=t;process.env.NODE_ENV!=="production"&&(p&&(m||console.warn("`useListNavigation` looping must be enabled to allow escaping."),E||console.warn("`useListNavigation` must be virtual to allow escaping.")),R==="vertical"&&T>1&&console.warn("In grid list navigation mode (`cols` > 1), the `orientation` should",'be either "horizontal" or "both".'));const w=_n(r),I=Ve(w),C=Vt(),O=Gt(A);X(()=>{i.current.orientation=R},[i,R]);const D=rr(s),S=a.useRef(b),M=a.useRef(d??-1),$=a.useRef(null),z=a.useRef(!0),Z=Q(V=>{l(M.current===-1?null:M.current,V)}),Y=a.useRef(Z),te=a.useRef(!!r),G=a.useRef(o),H=a.useRef(!1),j=a.useRef(!1),ae=Ve(v),de=Ve(o),Ee=Ve(N),B=Ve(d),ie=Q(()=>{function V(J){E?O?.events.emit("virtualfocus",J):Gn(J,{sync:H.current,preventScroll:!0})}const ce=c.current[M.current],ee=j.current;ce&&V(ce),(H.current?J=>J():requestAnimationFrame)(()=>{const J=c.current[M.current]||ce;if(!J)return;ce||V(J);const ue=Ee.current;ue&&Se&&(ee||!z.current)&&J.scrollIntoView?.(typeof ue=="boolean"?{block:"nearest",inline:"nearest"}:ue)})});X(()=>{f&&(o&&r?(M.current=d??-1,S.current&&d!=null&&(j.current=!0,Z())):te.current&&(M.current=-1,Y.current()))},[f,o,r,d,Z]),X(()=>{if(f){if(!o){H.current=!1;return}if(r)if(u==null){if(H.current=!1,B.current!=null)return;if(te.current&&(M.current=-1,ie()),(!G.current||!te.current)&&S.current&&($.current!=null||S.current===!0&&$.current==null)){let V=0;const ce=()=>{c.current[0]==null?(V<2&&(V?requestAnimationFrame:queueMicrotask)(ce),V+=1):(M.current=$.current==null||Wo($.current,R,h)||g?Do(c):Cs(c),$.current=null,Z())};ce()}}else wn(c,u)||(M.current=u,ie(),j.current=!1)}},[f,o,r,u,B,g,c,R,h,Z,ie,ae]),X(()=>{if(!f||r||!O||E||!te.current)return;const V=O.nodesRef.current,ce=V.find(J=>J.id===C)?.context?.elements.floating,ee=ct(Le(r)),q=V.some(J=>J.context&&xe(J.context.elements.floating,ee));ce&&!q&&z.current&&ce.focus({preventScroll:!0})},[f,r,O,C,E]),X(()=>{Y.current=Z,G.current=o,te.current=!!r}),X(()=>{o||($.current=null,S.current=b)},[o,b]);const oe=u!=null,Se=a.useMemo(()=>{function V(ee){if(!de.current)return;const q=c.current.indexOf(ee.currentTarget);q!==-1&&M.current!==q&&(M.current=q,Z(ee))}return{onFocus(ee){H.current=!0,V(ee)},onClick:({currentTarget:ee})=>ee.focus({preventScroll:!0}),onMouseMove(ee){H.current=!0,j.current=!1,y&&V(ee)},onPointerLeave(ee){if(!de.current||!z.current||ee.pointerType==="touch")return;H.current=!0;const q=ee.relatedTarget;!y||c.current.includes(q)||(M.current=-1,Z(ee),E||I.current?.focus({preventScroll:!0}))}}},[de,I,y,c,Z,E]),U=a.useCallback(()=>_??O?.nodesRef.current.find(V=>V.id===C)?.context?.dataRef?.current.orientation,[C,O,_]),K=Q(V=>{if(z.current=!1,H.current=!0,V.which===229||!de.current&&V.currentTarget===I.current)return;if(g&&qp(V.key,R,h,T)){Un(V.key,U())||He(V),n.setOpen(!1,ge(Io,V.nativeEvent)),Me(s)&&(E?O?.events.emit("virtualfocus",s):s.focus());return}const ce=M.current,ee=Do(c,v),q=Cs(c,v);if(D||(V.key==="Home"&&(He(V),M.current=ee,Z(V)),V.key==="End"&&(He(V),M.current=q,Z(V))),T>1){const J=F||Array.from({length:c.current.length},()=>({width:1,height:1})),ue=Uu(J,T,L),fe=ue.findIndex(Ce=>Ce!=null&&!Rn(c,Ce,v)),Re=ue.reduce((Ce,$e,st)=>$e!=null&&!Rn(c,$e,v)?st:Ce,-1),we=ue[zu({current:ue.map(Ce=>Ce!=null?c.current[Ce]:null)},{event:V,orientation:R,loopFocus:m,rtl:h,cols:T,disabledIndices:qu([...(typeof v!="function"?v:null)||c.current.map((Ce,$e)=>Rn(c,$e,v)?$e:void 0),void 0],ue),minIndex:fe,maxIndex:Re,prevIndex:Wu(M.current>q?ee:M.current,J,ue,T,V.key===Nn?"bl":V.key===(h?Tt:Ot)?"tr":"tl"),stopEvent:!0})];if(we!=null&&(M.current=we,Z(V)),R==="both")return}if(Un(V.key,R)){if(He(V),o&&!E&&ct(V.currentTarget.ownerDocument)===V.currentTarget){M.current=Wo(V.key,R,h)?ee:q,Z(V);return}Wo(V.key,R,h)?m?ce>=q?p&&ce!==c.current.length?M.current=-1:(H.current=!1,M.current=ee):M.current=We(c,{startingIndex:ce,disabledIndices:v}):M.current=Math.min(q,We(c,{startingIndex:ce,disabledIndices:v})):m?ce<=ee?p&&ce!==-1?M.current=c.current.length:(H.current=!1,M.current=q):M.current=We(c,{startingIndex:ce,decrement:!0,disabledIndices:v}):M.current=Math.max(ee,We(c,{startingIndex:ce,decrement:!0,disabledIndices:v})),wn(c,M.current)&&(M.current=-1),Z(V)}}),W=a.useMemo(()=>E&&o&&oe&&{"aria-activedescendant":`${k}-${u}`},[E,o,oe,k,u]),pe=a.useMemo(()=>({"aria-orientation":R==="both"?void 0:R,...D?{}:W,onKeyDown(V){if(V.key==="Tab"&&V.shiftKey&&o&&!E){const ce=qe(V.nativeEvent);if(ce&&!xe(I.current,ce))return;He(V),n.setOpen(!1,ge(Ut,V.nativeEvent)),Me(s)&&s.focus();return}K(V)},onPointerMove(){z.current=!0}}),[W,K,I,R,D,n,o,E,s]),le=a.useMemo(()=>{function V(ee){b==="auto"&&Vi(ee.nativeEvent)&&(S.current=!E)}function ce(ee){S.current=b,b==="auto"&&ji(ee.nativeEvent)&&(S.current=!0)}return{onKeyDown(ee){const q=n.select("open");z.current=!1;const J=ee.key.startsWith("Arrow"),ue=Wp(ee.key,U(),h),fe=Un(ee.key,R),Re=(g?ue:fe)||ee.key==="Enter"||ee.key.trim()==="";if(E&&q)return K(ee);if(!(!q&&!x&&J)){if(Re){const we=Un(ee.key,U());$.current=g&&we?null:ee.key}if(g){ue&&(He(ee),q?(M.current=Do(c,ae.current),Z(ee)):n.setOpen(!0,ge(Io,ee.nativeEvent,ee.currentTarget)));return}fe&&(B.current!=null&&(M.current=B.current),He(ee),!q&&x?n.setOpen(!0,ge(Io,ee.nativeEvent,ee.currentTarget)):K(ee),q&&Z(ee))}},onFocus(ee){n.select("open")&&!E&&(M.current=-1,Z(ee))},onPointerDown:ce,onPointerEnter:ce,onMouseDown:V,onClick:V}},[K,ae,b,c,g,Z,n,x,R,U,h,B,E]),re=a.useMemo(()=>({...W,...le}),[W,le]);return a.useMemo(()=>f?{reference:re,floating:pe,item:Se,trigger:le}:{},[f,re,pe,le,Se])}const Gp=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Mc(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{enabled:c=!0,role:u="dialog"}=t,l=Nt(),f=s?.id||l,d=a.useMemo(()=>_n(i)?.id||r,[i,r]),p=Gp.get(u)??u,g=Vt()!=null,h=a.useMemo(()=>p==="tooltip"||u==="label"?ze:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&g&&{role:"menuitem"},...u==="select"&&{"aria-autocomplete":"none"},...u==="combobox"&&{"aria-autocomplete":"list"}},[p,g,u]),E=a.useMemo(()=>p==="tooltip"||u==="label"?{[`aria-${u==="label"?"labelledby":"describedby"}`]:o?d:void 0}:{...h,"aria-expanded":o?"true":"false","aria-controls":o?d:void 0,...p==="menu"&&{id:f}},[p,d,o,f,u,h]),b=a.useMemo(()=>{const x={id:d,...p&&{role:p}};return p==="tooltip"||u==="label"?x:{...x,...p==="menu"&&{"aria-labelledby":f}}},[p,d,f,u]),y=a.useCallback(({active:x,selected:v})=>{const R={role:"option",...x&&{id:`${d}-fui-option`}};switch(u){case"select":case"combobox":return{...R,"aria-selected":v}}return{}},[d,u]);return a.useMemo(()=>c?{reference:E,floating:b,item:y,trigger:h}:{},[c,E,b,h,y])}function Yp(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.context.dataRef,{listRef:s,activeIndex:i,onMatch:c,onTypingChange:u,enabled:l=!0,findMatch:f=null,resetMs:d=750,ignoreKeys:p=Jo,selectedIndex:m=null}=t,g=Xe(),h=a.useRef(""),E=a.useRef(m??i??-1),b=a.useRef(null);X(()=>{o&&(g.clear(),b.current=null,h.current="")},[o,g]),X(()=>{o&&h.current===""&&(E.current=m??i??-1)},[o,m,i]);const y=Q(_=>{_?r.current.typing||(r.current.typing=_,u?.(_)):r.current.typing&&(r.current.typing=_,u?.(_))}),x=Q(_=>{function T(A,w,I){const C=f?f(w,I):w.find(O=>O?.toLocaleLowerCase().indexOf(I.toLocaleLowerCase())===0);return C?A.indexOf(C):-1}const N=s.current;if(h.current.length>0&&h.current[0]!==" "&&(T(N,N,h.current)===-1?y(!1):_.key===" "&&He(_)),N==null||p.includes(_.key)||_.key.length!==1||_.ctrlKey||_.metaKey||_.altKey)return;o&&_.key!==" "&&(He(_),y(!0)),N.every(A=>A?A[0]?.toLocaleLowerCase()!==A[1]?.toLocaleLowerCase():!0)&&h.current===_.key&&(h.current="",E.current=b.current),h.current+=_.key,g.start(d,()=>{h.current="",E.current=b.current,y(!1)});const L=E.current,k=T(N,[...N.slice((L||0)+1),...N.slice(0,(L||0)+1)],h.current);k!==-1?(c?.(k),b.current=k):_.key!==" "&&(h.current="",y(!1))}),v=a.useMemo(()=>({onKeyDown:x}),[x]),R=a.useMemo(()=>({onKeyDown:x,onKeyUp(_){_.key===" "&&y(!1)}}),[x,y]);return a.useMemo(()=>l?{reference:v,floating:R}:{},[l,v,R])}function Zs(e,t){const[n,o]=e;let r=!1;const s=t.length;for(let i=0,c=s-1;i<s;c=i++){const[u,l]=t[i]||[0,0],[f,d]=t[c]||[0,0];l>=o!=d>=o&&n<=(f-u)*(o-l)/(d-l)+u&&(r=!r)}return r}function Xp(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Zp(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,r=new pt;let s=!1,i=null,c=null,u=typeof performance<"u"?performance.now():0;function l(d,p){const m=performance.now(),g=m-u;if(i===null||c===null||g===0)return i=d,c=p,u=m,null;const h=d-i,E=p-c,y=Math.sqrt(h*h+E*E)/g;return i=d,c=p,u=m,y}const f=({x:d,y:p,placement:m,elements:g,onClose:h,nodeId:E,tree:b})=>function(x){function v(){r.clear(),h()}if(r.clear(),!g.domReference||!g.floating||m==null||d==null||p==null)return;const{clientX:R,clientY:_}=x,T=[R,_],N=qe(x),F=x.type==="mouseleave",L=xe(g.floating,N),k=xe(g.domReference,N),A=g.domReference.getBoundingClientRect(),w=g.floating.getBoundingClientRect(),I=m.split("-")[0],C=d>w.right-w.width/2,O=p>w.bottom-w.height/2,D=Xp(T,A),S=w.width>A.width,M=w.height>A.height,$=(S?A:w).left,z=(S?A:w).right,Z=(M?A:w).top,Y=(M?A:w).bottom;if(L&&(s=!0,!F))return;if(k&&(s=!1),k&&!F){s=!0;return}if(F&&_e(x.relatedTarget)&&xe(g.floating,x.relatedTarget)||b&&zt(b.nodesRef.current,E).some(({context:H})=>H?.open))return;if(I==="top"&&p>=A.bottom-1||I==="bottom"&&p<=A.top+1||I==="left"&&d>=A.right-1||I==="right"&&d<=A.left+1)return v();let te=[];switch(I){case"top":te=[[$,A.top+1],[$,w.bottom-1],[z,w.bottom-1],[z,A.top+1]];break;case"bottom":te=[[$,w.top+1],[$,A.bottom-1],[z,A.bottom-1],[z,w.top+1]];break;case"left":te=[[w.right-1,Y],[w.right-1,Z],[A.left+1,Z],[A.left+1,Y]];break;case"right":te=[[A.right-1,Y],[A.right-1,Z],[w.left+1,Z],[w.left+1,Y]];break}function G([H,j]){switch(I){case"top":{const ae=[S?H+t/2:C?H+t*4:H-t*4,j+t+1],de=[S?H-t/2:C?H+t*4:H-t*4,j+t+1],Ee=[[w.left,C||S?w.bottom-t:w.top],[w.right,C?S?w.bottom-t:w.top:w.bottom-t]];return[ae,de,...Ee]}case"bottom":{const ae=[S?H+t/2:C?H+t*4:H-t*4,j-t],de=[S?H-t/2:C?H+t*4:H-t*4,j-t],Ee=[[w.left,C||S?w.top+t:w.bottom],[w.right,C?S?w.top+t:w.bottom:w.top+t]];return[ae,de,...Ee]}case"left":{const ae=[H+t+1,M?j+t/2:O?j+t*4:j-t*4],de=[H+t+1,M?j-t/2:O?j+t*4:j-t*4];return[...[[O||M?w.right-t:w.left,w.top],[O?M?w.right-t:w.left:w.right-t,w.bottom]],ae,de]}case"right":{const ae=[H-t,M?j+t/2:O?j+t*4:j-t*4],de=[H-t,M?j-t/2:O?j+t*4:j-t*4],Ee=[[O||M?w.left+t:w.right,w.top],[O?M?w.left+t:w.right:w.left+t,w.bottom]];return[ae,de,...Ee]}default:return[]}}if(!Zs([R,_],te)){if(s&&!D)return v();if(!F&&o){const H=l(x.clientX,x.clientY);if(H!==null&&H<.1)return v()}Zs([R,_],G([d,p]))?!s&&o&&r.start(40,v):v()}};return f.__options={blockPointerEvents:n},f}let Jp=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Qp=(function(e){return e[e.open=Ht.open]="open",e[e.closed=Ht.closed]="closed",e[e.startingStyle=Ht.startingStyle]="startingStyle",e[e.endingStyle=Ht.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Kr=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(Kr.displayName="DialogPortalContext");function em(){const e=a.useContext(Kr);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Portal> is missing.":Ae(26));return e}const tm={...Ft,...It,nestedDialogOpen(e){return e?{[Qp.nestedDialogOpen]:""}:null}},Dc=a.forwardRef(function(t,n){const{className:o,finalFocus:r,initialFocus:s,render:i,...c}=t,{store:u}=kt(),l=u.useState("descriptionElementId"),f=u.useState("disablePointerDismissal"),d=u.useState("floatingRootContext"),p=u.useState("popupProps"),m=u.useState("modal"),g=u.useState("mounted"),h=u.useState("nested"),E=u.useState("nestedOpenDialogCount"),b=u.useState("open"),y=u.useState("openMethod"),x=u.useState("titleElementId"),v=u.useState("transitionStatus"),R=u.useState("role");em(),Lt({open:b,ref:u.context.popupRef,onComplete(){b&&u.context.onOpenChangeComplete?.(!0)}});function _(k){return k==="touch"?u.context.popupRef.current:!0}const T=s===void 0?_:s,N=E>0,F=a.useMemo(()=>({open:b,nested:h,transitionStatus:v,nestedDialogOpen:N}),[b,h,v,N]),L=ye("div",t,{state:F,props:[p,{"aria-labelledby":x??void 0,"aria-describedby":l??void 0,role:R,tabIndex:-1,hidden:!g,onKeyDown(k){Dr.has(k.key)&&k.stopPropagation()},style:{[Jp.nestedDialogs]:E}},c],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:tm});return P.jsx(Br,{context:d,openInteractionType:y,disabled:!g,closeOnFocusOut:!f,initialFocus:T,returnFocus:r,modal:m!==!1,restoreFocus:"popup",children:L})});process.env.NODE_ENV!=="production"&&(Dc.displayName="DialogPopup");function Ro(e){return gi(19)?e:e?"true":void 0}const Co=a.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const i=o?.getBoundingClientRect();s=`polygon(
|
|
10
|
+
0% 0%,
|
|
11
|
+
100% 0%,
|
|
12
|
+
100% 100%,
|
|
13
|
+
0% 100%,
|
|
14
|
+
0% 0%,
|
|
15
|
+
${i.left}px ${i.top}px,
|
|
16
|
+
${i.left}px ${i.bottom}px,
|
|
17
|
+
${i.right}px ${i.bottom}px,
|
|
18
|
+
${i.right}px ${i.top}px,
|
|
19
|
+
${i.left}px ${i.top}px
|
|
20
|
+
)`}return P.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});process.env.NODE_ENV!=="production"&&(Co.displayName="InternalBackdrop");const Lc=a.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=kt(),i=s.useState("mounted"),c=s.useState("modal");return i||o?P.jsx(Kr.Provider,{value:o,children:P.jsxs(Eo,{ref:n,...r,children:[i&&c===!0&&P.jsx(Co,{ref:s.context.internalBackdropRef,inert:Ro(!open)}),t.children]})}):null});process.env.NODE_ENV!=="production"&&(Lc.displayName="DialogPortal");let Js={},Qs={},ei="";function nm(e){if(typeof document>"u")return!1;const t=Ke(e);return De(t).innerWidth-t.documentElement.clientWidth>0}function om(e){const t=Ke(e),n=t.documentElement,o=t.body,r=Kt(n)?n:o,s=r.style.overflow;return r.style.overflow="hidden",()=>{r.style.overflow=s}}function rm(e){const t=Ke(e),n=t.documentElement,o=t.body,r=De(n);let s=0,i=0;const c=Ie.create(),u=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(Ii&&(r.visualViewport?.scale??1)!==1)return()=>{};function l(){const p=r.getComputedStyle(n),m=r.getComputedStyle(o),E=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Js={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},ei=n.style.scrollBehavior,Qs={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const b=n.scrollHeight>n.clientHeight,y=n.scrollWidth>n.clientWidth,x=p.overflowY==="scroll"||m.overflowY==="scroll",v=p.overflowX==="scroll"||m.overflowX==="scroll",R=Math.max(0,r.innerWidth-n.clientWidth),_=Math.max(0,r.innerHeight-n.clientHeight),T=parseFloat(m.marginTop)+parseFloat(m.marginBottom),N=parseFloat(m.marginLeft)+parseFloat(m.marginRight),F=Kt(n)?n:o;if(u){n.style.scrollbarGutter=E,F.style.overflowY="hidden",F.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(b||x)&&(n.style.overflowY="scroll"),(y||v)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:T||_?`calc(100dvh - ${T+_}px)`:"100dvh",width:N||R?`calc(100vw - ${N+R}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,Js),Object.assign(o.style,Qs),u||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=ei)}function d(){f(),c.request(l)}return l(),r.addEventListener("resize",d),()=>{c.cancel(),f(),typeof r.removeEventListener=="function"&&r.removeEventListener("resize",d)}}class sm{lockCount=0;restore=null;timeoutLock=pt.create();timeoutUnlock=pt.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 o=Ke(t).documentElement,r=De(o).getComputedStyle(o).overflowY;if(r==="hidden"||r==="clip"){this.restore=nt;return}const s=Cu||!nm(t);this.restore=s?om(t):rm(t)}}const im=new sm;function Gr(e=!0,t=null){X(()=>{if(e)return im.acquire(t)},[e,t])}function cm(e){const t=a.useRef(""),n=a.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:a.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r&&e(r,r.pointerType),e(r,t.current),t.current=""},[e]),onPointerDown:n}}function kc(e){const[t,n]=a.useState(null),o=Q((c,u)=>{e||n(u)}),r=a.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:i}=cm(o);return a.useMemo(()=>({openMethod:t,reset:r,triggerProps:{onClick:s,onPointerDown:i}}),[t,r,s,i])}function am(e){const{store:t,parentContext:n,actionsRef:o}=e,r=t.useState("open"),s=t.useState("disablePointerDismissal"),i=t.useState("modal"),c=t.useState("popupElement"),{openMethod:u,triggerProps:l,reset:f}=kc(r);_c(t);const{forceUnmount:d}=Tc(r,t,()=>{f()}),p=Q(L=>{const k=ge(L);return k.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},k}),m=a.useCallback(()=>{t.setOpen(!1,p(xi))},[t,p]);a.useImperativeHandle(o,()=>({unmount:d,close:m}),[d,m]);const g=Nc({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,E]=a.useState(0),b=h===0,y=Mc(g),x=Ur(g,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(L){if("button"in L&&L.button!==0||"touches"in L&&L.touches.length!==1)return!1;const k=qe(L);if(b&&!s){const A=k;return i&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===A||t.context.backdropRef.current===A||xe(A,c)&&!A?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:b});Gr(r&&i===!0,c);const{getReferenceProps:v,getFloatingProps:R,getTriggerProps:_}=Mn([y,x]);t.useContextCallback("onNestedDialogOpen",L=>{E(L+1)}),t.useContextCallback("onNestedDialogClose",()=>{E(0)}),a.useEffect(()=>(n?.onNestedDialogOpen&&r&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!r&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&r&&n.onNestedDialogClose()}),[r,n,h]);const T=a.useMemo(()=>v(l),[v,l]),N=a.useMemo(()=>_(l),[_,l]),F=a.useMemo(()=>R(),[R]);t.useSyncedValues({openMethod:u,activeTriggerProps:T,inactiveTriggerProps:N,popupProps:F,floatingRootContext:g,nestedOpenDialogCount:h})}const lm={...Pc,modal:se(e=>e.modal),nested:se(e=>e.nested),nestedOpenDialogCount:se(e=>e.nestedOpenDialogCount),disablePointerDismissal:se(e=>e.disablePointerDismissal),openMethod:se(e=>e.openMethod),descriptionElementId:se(e=>e.descriptionElementId),titleElementId:se(e=>e.titleElementId),viewportElement:se(e=>e.viewportElement),role:se(e=>e.role)};class um extends Wr{constructor(t){super(fm(t),{popupRef:a.createRef(),backdropRef:a.createRef(),internalBackdropRef:a.createRef(),triggerElements:new So,onOpenChange:void 0,onOpenChangeComplete:void 0},lm)}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;const o={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const r={open:t},s=n.trigger?.id??null;(s||t)&&(r.activeTriggerId=s,r.activeTriggerElement=n.trigger??null),this.update(r)}}function fm(e={}){return{...Oc(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function dm(e){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:c=!0,actionsRef:u,handle:l,triggerId:f,defaultTriggerId:d=null}=e,p=kt(!0),m=!!p,g=Je(()=>l?.store??new um({open:n??o,activeTriggerId:f!==void 0?f:d,modal:c,disablePointerDismissal:i,nested:m})).current;g.useControlledProp("open",n,o),g.useControlledProp("activeTriggerId",f,d),g.useSyncedValues({disablePointerDismissal:i,nested:m,modal:c}),g.useContextCallback("onOpenChange",r),g.useContextCallback("onOpenChangeComplete",s);const h=g.useState("payload");am({store:g,actionsRef:u,parentContext:p?.store.context});const E=a.useMemo(()=>({store:g}),[g]);return P.jsx(Lr.Provider,{value:E,children:typeof t=="function"?t({payload:h}):t})}const Fc=a.forwardRef(function(t,n){const{render:o,className:r,id:s,...i}=t,{store:c}=kt(),u=ut(s);return c.useSyncedValueWithCleanup("titleElementId",u),ye("h2",t,{ref:n,props:[{id:u},i]})});process.env.NODE_ENV!=="production"&&(Fc.displayName="DialogTitle");const Vc=a.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,id:c,payload:u,handle:l,...f}=t,d=kt(!0),p=l?.store??d?.store;if(!p)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.":Ae(79));const m=ut(c),g=p.useState("floatingRootContext"),h=p.useState("isOpenedByTrigger",m),[E,b]=a.useState(null),{registerTrigger:y,isMountedByThisTrigger:x}=Cc(m,E,p,{payload:u}),{getButtonProps:v,buttonRef:R}=St({disabled:s,native:i}),_=Hr(g,{enabled:g!=null}),T=Mn([_]),N=a.useMemo(()=>({disabled:s,open:h}),[s,h]),F=p.useState("triggerProps",x);return ye("button",t,{state:N,ref:[R,n,y,b],props:[T.getReferenceProps(),F,{[Er]:"",id:m},f,v],stateAttributesMapping:kr})});process.env.NODE_ENV!=="production"&&(Vc.displayName="DialogTrigger");const pm="_backdrop_n0fed_10",mm="_popup_n0fed_32",gm="_title_n0fed_137",hm="_description_n0fed_150",ym="_close_n0fed_161",bm="_closeIcon_n0fed_194",vm="_trigger_n0fed_203",bt={backdrop:pm,popup:mm,"popup--default":"_popup--default_n0fed_59","popup--centered":"_popup--centered_n0fed_74","popup--fullscreen":"_popup--fullscreen_n0fed_89","popup--sm":"_popup--sm_n0fed_111","popup--md":"_popup--md_n0fed_117","popup--lg":"_popup--lg_n0fed_123",title:gm,description:hm,close:ym,closeIcon:bm,trigger:vm},jc=ne.createContext({variant:"default",size:"md"}),Em=()=>ne.useContext(jc),$c=ne.forwardRef(({open:e,defaultOpen:t=!1,onOpenChange:n,modal:o=!0,variant:r="default",size:s="md",children:i})=>P.jsx(jc.Provider,{value:{variant:r,size:s},children:P.jsx(dm,{open:e,defaultOpen:t,onOpenChange:n,modal:o,children:i})}));$c.displayName="ALSDialog.Root";const Bc=ne.forwardRef(({className:e,children:t},n)=>{const o=[bt.trigger,e].filter(Boolean).join(" ");return P.jsx(Vc,{ref:n,className:o,nativeButton:!1,render:r=>ne.cloneElement(t,r)})});Bc.displayName="ALSDialog.Trigger";const Hc=ne.forwardRef(({className:e},t)=>{const n=[bt.backdrop,e].filter(Boolean).join(" ");return P.jsx(cc,{ref:t,className:n})});Hc.displayName="ALSDialog.Backdrop";const zc=({container:e,keepMounted:t=!1,children:n})=>P.jsx(Lc,{container:e,keepMounted:t,children:n});zc.displayName="ALSDialog.Portal";const Uc=ne.forwardRef(({className:e,children:t},n)=>{const{variant:o,size:r}=Em(),s=[bt.popup,bt[`popup--${o}`],bt[`popup--${r}`],e].filter(Boolean).join(" ");return P.jsx(Dc,{ref:n,className:s,children:t})});Uc.displayName="ALSDialog.Popup";const Wc=ne.forwardRef(({className:e,children:t},n)=>{const o=[bt.title,e].filter(Boolean).join(" ");return P.jsx(Fc,{ref:n,className:o,children:t})});Wc.displayName="ALSDialog.Title";const qc=ne.forwardRef(({className:e,children:t},n)=>{const o=[bt.description,e].filter(Boolean).join(" ");return P.jsx(lc,{ref:n,className:o,children:t})});qc.displayName="ALSDialog.Description";const Kc=ne.forwardRef(({className:e,children:t},n)=>{const o=[bt.close,e].filter(Boolean).join(" ");return P.jsx(ac,{ref:n,className:o,children:t||P.jsx(xm,{})})});Kc.displayName="ALSDialog.Close";const xm=()=>P.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:bt.closeIcon,children:P.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Sm={Root:$c,Trigger:Bc,Backdrop:Hc,Portal:zc,Popup:Uc,Title:Wc,Description:qc,Close:Kc},wm="_root_1yzve_1",Rm={root:wm};function Cm(e){return P.jsx("div",{className:Rm.root})}const _m="_root_o7syy_1",Tm={root:_m};function Om(e){return P.jsx("div",{className:Tm.root})}const Pm="_root_199mu_1",Am={root:Pm};function Nm(e){return P.jsx("div",{className:Am.root})}let ti=(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 Im={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Gc={valid(e){return e===null?null:e?{[ti.valid]:""}:{[ti.invalid]:""}}},Yc=a.createContext({invalid:void 0,name:void 0,validityData:{state:Im,errors:[],error:"",value:"",initialValue:null},setValidityData:nt,disabled:void 0,touched:!1,setTouched:nt,dirty:!1,setDirty:nt,filled:!1,setFilled:nt,focused:!1,setFocused:nt,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=ze)=>e,getInputValidationProps:(e=ze)=>e,inputRef:{current:null},commit:async()=>{}}});process.env.NODE_ENV!=="production"&&(Yc.displayName="FieldRootContext");function An(e=!0){const t=a.useContext(Yc);if(t.setValidityData===nt&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.":Ae(28));return t}const Xc=a.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:nt,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});process.env.NODE_ENV!=="production"&&(Xc.displayName="FormContext");function Zc(){return a.useContext(Xc)}const Jc=a.createContext({controlId:void 0,setControlId:nt,labelId:void 0,setLabelId:nt,messageIds:[],setMessageIds:nt,getDescriptionProps:e=>e});process.env.NODE_ENV!=="production"&&(Jc.displayName="LabelableContext");function _o(){return a.useContext(Jc)}function Mm(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Qc(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:r,setControlId:s}=_o(),i=ut(t);return X(()=>{if(!(!n&&!t||s===nt)){if(n){const c=o?.current;_e(c)&&c.closest("label")!=null?s(t??null):s(r??i)}else t&&s(t);return()=>{t&&s(void 0)}}},[t,o,r,s,n,i]),r??i}function ea(e){const{enabled:t=!0,value:n,id:o,name:r,controlRef:s,commit:i}=e,{formRef:c}=Zc(),{invalid:u,markedDirtyRef:l,validityData:f,setValidityData:d}=An(),p=Q(e.getValue);X(()=>{if(!t)return;let m=n;m===void 0&&(m=p()),f.initialValue===null&&m!==null&&d(g=>({...g,initialValue:m}))},[t,d,n,f.initialValue,p]),X(()=>{!t||!o||c.current.fields.set(o,{getValue:p,name:r,controlRef:s,validityData:Mm(f,u),validate(){let m=n;m===void 0&&(m=p()),l.current=!0,rt.flushSync(()=>i(m))}})},[i,s,t,c,p,o,u,l,r,f,n]),X(()=>{const m=c.current.fields;return()=>{o&&m.delete(o)}},[c,o])}const ta=a.forwardRef(function(t,n){const{render:o,className:r,id:s,name:i,value:c,disabled:u=!1,onValueChange:l,defaultValue:f,...d}=t,{state:p,name:m,disabled:g}=An(),h=g||u,E=m??i,b=a.useMemo(()=>({...p,disabled:h}),[p,h]),{setTouched:y,setDirty:x,validityData:v,setFocused:R,setFilled:_,validationMode:T,validation:N}=An(),{labelId:F}=_o(),L=Qc({id:s});X(()=>{const O=c!=null;N.inputRef.current?.value||O&&c!==""?_(!0):O&&c===""&&_(!1)},[N.inputRef,_,c]);const[k,A]=Cn({controlled:c,default:f,name:"FieldControl",state:"value"}),w=c!==void 0,I=Q((O,D)=>{l?.(O,D),!D.isCanceled&&A(O)});return ea({id:L,name:E,commit:N.commit,value:k,getValue:()=>N.inputRef.current?.value,controlRef:N.inputRef}),ye("input",t,{ref:n,state:b,props:[{id:L,disabled:h,name:E,ref:N.inputRef,"aria-labelledby":F,...w?{value:k}:{defaultValue:f},onChange(O){const D=O.currentTarget.value;I(D,ge(ln,O.nativeEvent)),x(D!==v.initialValue),_(D!=="")},onFocus(){R(!0)},onBlur(O){y(!0),R(!1),T==="onBlur"&&N.commit(O.currentTarget.value)},onKeyDown(O){O.currentTarget.tagName==="INPUT"&&O.key==="Enter"&&(y(!0),N.commit(O.currentTarget.value))}},N.getInputValidationProps(),d],stateAttributesMapping:Gc})});process.env.NODE_ENV!=="production"&&(ta.displayName="FieldControl");const na=a.forwardRef(function(t,n){return P.jsx(ta,{ref:n,...t})});process.env.NODE_ENV!=="production"&&(na.displayName="Input");const Dm="_input_1ph0q_5",Wn={input:Dm,"input--outlined":"_input--outlined_1ph0q_25","input--filled":"_input--filled_1ph0q_40","input--sm":"_input--sm_1ph0q_59","input--md":"_input--md_1ph0q_64","input--lg":"_input--lg_1ph0q_69","input--success":"_input--success_1ph0q_78","input--warning":"_input--warning_1ph0q_87","input--error":"_input--error_1ph0q_96"},oa=ne.forwardRef(({variant:e="outlined",size:t="md",status:n="default",className:o,disabled:r=!1,...s},i)=>{const c=[Wn.input,Wn[`input--${e}`],Wn[`input--${t}`],Wn[`input--${n}`],o].filter(Boolean).join(" ");return P.jsx(na,{ref:i,className:c,disabled:r,...s})});oa.displayName="ALSInput";const Lm="_root_so1gq_1",km={root:Lm};function Fm(e){return P.jsx("div",{className:km.root})}const Vm="_root_g8l8f_1",jm={root:Vm};function $m(e){return P.jsx("div",{className:jm.root})}const Bm="_root_krv6e_1",Hm={root:Bm};function zm(e){return P.jsx("div",{className:Hm.root})}const Um="_root_qmqvr_1",Wm={root:Um};function qm(e){return P.jsx("div",{className:Wm.root})}const Km="_root_1jbox_1",Gm={root:Km};function Ym(e){return P.jsx("div",{className:Gm.root})}const Yr=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(Yr.displayName="PopoverRootContext");function gt(e){const t=a.useContext(Yr);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>.":Ae(47));return t}function Xm(){return{...Oc(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0}}const Zm={...Pc,disabled:se(e=>e.disabled),instantType:se(e=>e.instantType),openMethod:se(e=>e.openMethod),openChangeReason:se(e=>e.openChangeReason),modal:se(e=>e.modal),stickIfOpen:se(e=>e.stickIfOpen),titleElementId:se(e=>e.titleElementId),descriptionElementId:se(e=>e.descriptionElementId),openOnHover:se(e=>e.openOnHover),closeDelay:se(e=>e.closeDelay)};class Xr extends Wr{constructor(t){const n={...Xm(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:a.createRef(),backdropRef:a.createRef(),internalBackdropRef:a.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:a.createRef(),beforeContentFocusGuardRef:a.createRef(),stickIfOpenTimeout:new pt,triggerElements:new So},Zm)}setOpen=(t,n)=>{const o=n.reason===ot,r=n.reason===ht&&n.event.detail===0,s=!t&&(n.reason===Ei||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",i);const u=()=>{const l={open:t,openChangeReason:n.reason},f=n.trigger?.id??null;(f||t)&&(l.activeTriggerId=f,l.activeTriggerElement=n.trigger??null),this.update(l)};o?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(zl,()=>{this.set("stickIfOpen",!1)}),rt.flushSync(u)):u(),r||s?this.set("instantType",r?"click":"dismiss"):n.reason===Ut?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const o=Je(()=>t??new Xr(n)).current;return io(o.disposeEffect),o}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ni({props:e}){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,modal:i=!1,handle:c,triggerId:u,defaultTriggerId:l=null}=e,f=Xr.useStore(c?.store,{open:n??o,modal:i,activeTriggerId:u!==void 0?u:l});f.useControlledProp("open",n,o),f.useControlledProp("activeTriggerId",u,l);const d=f.useState("open"),p=f.useState("positionerElement"),m=f.useState("payload"),g=f.useState("openChangeReason");f.useContextCallback("onOpenChange",r),f.useContextCallback("onOpenChangeComplete",s);const{openMethod:h,triggerProps:E,reset:b}=kc(d);_c(f);const{forceUnmount:y}=Tc(d,f,()=>{f.update({stickIfOpen:!0,openChangeReason:null}),b()});Gr(d&&i===!0&&g!==ot&&h!=="touch",p),a.useEffect(()=>{d||f.context.stickIfOpenTimeout.clear()},[f,d]);const x=a.useCallback(C=>{const O=ge(C);return O.preventUnmountOnClose=()=>{f.set("preventUnmountingOnClose",!0)},O},[f]),v=a.useCallback(()=>{f.setOpen(!1,x(xi))},[f,x]);a.useImperativeHandle(e.actionsRef,()=>({unmount:y,close:v}),[y,v]);const R=Nc({popupStore:f,onOpenChange:f.setOpen}),_=Ur(R,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),T=Mc(R),{getReferenceProps:N,getFloatingProps:F,getTriggerProps:L}=Mn([_,T]),k=a.useMemo(()=>N(E),[N,E]),A=a.useMemo(()=>L(E),[L,E]),w=a.useMemo(()=>F(),[F]);f.useSyncedValues({modal:i,openMethod:h,activeTriggerProps:k,inactiveTriggerProps:A,popupProps:w,floatingRootContext:R,nested:Vt()!=null});const I=a.useMemo(()=>({store:f}),[f]);return P.jsx(Yr.Provider,{value:I,children:typeof t=="function"?t({payload:m}):t})}function Jm(e){return gt(!0)?P.jsx(ni,{props:e}):P.jsx(pd,{children:P.jsx(ni,{props:e})})}const Qm=300,ra=a.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,handle:c,payload:u,openOnHover:l=!1,delay:f=Qm,closeDelay:d=0,id:p,...m}=t,g=gt(!0),h=c?.store??g?.store;if(!h)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.":Ae(74));const E=ut(p),b=h.useState("isTriggerActive",E),y=h.useState("floatingRootContext"),x=h.useState("isOpenedByTrigger",E),[v,R]=a.useState(null),{registerTrigger:_,isMountedByThisTrigger:T}=Cc(E,v,h,{payload:u,disabled:s,openOnHover:l,closeDelay:d}),N=h.useState("openChangeReason"),F=h.useState("stickIfOpen"),L=h.useState("openMethod"),k=zp(y,{enabled:y!=null&&l&&(L!=="touch"||N!==ht),mouseOnly:!0,move:!1,handleClose:Zp(),restMs:f,delay:{close:d},triggerElement:v,isActiveTrigger:b}),A=Hr(y,{enabled:y!=null,stickIfOpen:F}),w=Mn([A]),I=h.useState("triggerProps",T),C=a.useMemo(()=>({disabled:s,open:x}),[s,x]),{getButtonProps:O,buttonRef:D}=St({disabled:s,native:i}),S=a.useMemo(()=>({open(Y){return Y&&N===ht?ic.open(Y):kr.open(Y)}}),[N]),M=ye("button",t,{state:C,ref:[D,n,_,R],props:[w.getReferenceProps(),k,I,{[Er]:"",id:E},m,O],stateAttributesMapping:S}),$=a.useRef(null),z=Q(Y=>{rt.flushSync(()=>{h.setOpen(!1,ge(Ut,Y.nativeEvent,Y.currentTarget))}),uf($.current)?.focus()}),Z=Q(Y=>{const te=h.select("positionerElement");if(te&&Jt(Y,te))h.context.beforeContentFocusGuardRef.current?.focus();else{rt.flushSync(()=>{h.setOpen(!1,ge(Ut,Y.nativeEvent,Y.currentTarget))});let G=lf(v);for(;G!==null&&xe(te,G)||G?.hasAttribute("aria-hidden");){const H=G;if(G=Nr(G),G===H)break}G?.focus()}});return b?P.jsxs(a.Fragment,{children:[P.jsx(dt,{ref:$,onFocus:z}),P.jsx(a.Fragment,{children:M},E),P.jsx(dt,{ref:h.context.triggerFocusTargetRef,onFocus:Z})]}):P.jsx(a.Fragment,{children:M},E)});process.env.NODE_ENV!=="production"&&(ra.displayName="PopoverTrigger");const Zr=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(Zr.displayName="PopoverPortalContext");function eg(){const e=a.useContext(Zr);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Portal> is missing.":Ae(45));return e}const sa=a.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=gt();return s.useState("mounted")||o?P.jsx(Zr.Provider,{value:o,children:P.jsx(Eo,{ref:n,...r,renderGuards:!1})}):null});process.env.NODE_ENV!=="production"&&(sa.displayName="PopoverPortal");const Jr=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(Jr.displayName="PopoverPositionerContext");function ia(){const e=a.useContext(Jr);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.":Ae(46));return e}const tg=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:u}=t,{element:l,padding:f=0,offsetParent:d="real"}=Et(e,t)||{};if(l==null)return{};const p=$i(f),m={x:n,y:o},g=Ar(r),h=Pr(g),E=await i.getDimensions(l),b=g==="y",y=b?"top":"left",x=b?"bottom":"right",v=b?"clientHeight":"clientWidth",R=s.reference[h]+s.reference[g]-m[g]-s.floating[h],_=m[g]-s.reference[g],T=d==="real"?await i.getOffsetParent?.(l):c.floating;let N=c.floating[v]||s.floating[h];(!N||!await i.isElement?.(T))&&(N=c.floating[v]||s.floating[h]);const F=R/2-_/2,L=N/2-E[h]/2-1,k=Math.min(p[y],L),A=Math.min(p[x],L),w=k,I=N-E[h]-A,C=N/2-E[h]/2+F,O=ir(w,C,I),D=!u.arrow&&Dt(r)!=null&&C!==O&&s.reference[h]/2-(C<w?k:A)-E[h]/2<0,S=D?C<w?C-w:C-I:0;return{[g]:m[g]+S,data:{[g]:O,centerOffset:C-O-S,...D&&{alignmentOffset:S}},reset:D}}}),ng=(e,t)=>({...tg(e),options:[e,t]}),og={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0;return{data:{referenceHidden:(await cp().fn(e)).data?.referenceHidden||s}}}},Xn={sideX:"left",sideY:"top"},rg={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:c}=e,u=De(r),l=u.getComputedStyle(r);if(!(l.transitionDuration!=="0s"&&l.transitionDuration!==""))return{x:t,y:n,data:Xn};const d=await s.getOffsetParent?.(r);let p={width:0,height:0};if(i==="fixed"&&u?.visualViewport)p={width:u.visualViewport.width,height:u.visualViewport.height};else if(d===u){const y=Ke(r);p={width:y.documentElement.clientWidth,height:y.documentElement.clientHeight}}else await s.isElement?.(d)&&(p=await s.getDimensions(d));const m=Ze(c);let g=t,h=n;m==="left"&&(g=p.width-(t+o.width)),m==="top"&&(h=p.height-(n+o.height));const E=m==="left"?"right":Xn.sideX,b=m==="top"?"bottom":Xn.sideY;return{x:g,y:h,data:{sideX:E,sideY:b}}}};function ca(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function oi(e,t,n){const{rects:o,placement:r}=e;return{side:ca(t,Ze(r),n),align:Dt(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function aa(e){const{anchor:t,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:u=5,sticky:l=!1,arrowPadding:f=5,disableAnchorTracking:d=!1,keepMounted:p=!1,floatingRootContext:m,mounted:g,collisionAvoidance:h,shiftCrossAxis:E=!1,nodeId:b,adaptiveOrigin:y,lazyFlip:x=!1,externalTree:v}=e,[R,_]=a.useState(null);!g&&R!==null&&_(null);const T=h.side||"flip",N=h.align||"flip",F=h.fallbackAxisSide||"end",L=typeof t=="function"?t:void 0,k=Q(L),A=L?k:t,w=Ve(t),C=hr()==="rtl",O=R||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":C?"left":"right","inline-start":C?"right":"left"}[o],D=s==="center"?O:`${O}-${s}`;let S=u;const M=1,$=o==="bottom"?M:0,z=o==="top"?M:0,Z=o==="right"?M:0,Y=o==="left"?M:0;typeof S=="number"?S={top:S+$,right:S+Y,bottom:S+z,left:S+Z}:S&&(S={top:(S.top||0)+$,right:(S.right||0)+Y,bottom:(S.bottom||0)+z,left:(S.left||0)+Z});const te={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:S},G=a.useRef(null),H=Ve(r),j=Ve(i),Ee=[np(Te=>{const Ne=oi(Te,o,C),Be=typeof H.current=="function"?H.current(Ne):H.current,ke=typeof j.current=="function"?j.current(Ne):j.current;return{mainAxis:Be,crossAxis:ke,alignmentAxis:ke}},[typeof r!="function"?r:0,typeof i!="function"?i:0,C,o])],B=N==="none"&&T!=="shift",ie=!B&&(l||E||T==="shift"),oe=T==="none"?null:sp({...te,padding:{top:S.top+M,right:S.right+M,bottom:S.bottom+M,left:S.left+M},mainAxis:!E&&T==="flip",crossAxis:N==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),Se=B?null:op(Te=>{const Ne=Ke(Te.elements.floating).documentElement;return{...te,rootBoundary:E?{x:0,y:0,width:Ne.clientWidth,height:Ne.clientHeight}:void 0,mainAxis:N!=="none",crossAxis:ie,limiter:l||E?void 0:rp(Be=>{if(!G.current)return{};const{width:ke,height:be}=G.current.getBoundingClientRect(),Pe=at(Ze(Be.placement)),Fe=Pe==="y"?ke:be,Ue=Pe==="y"?S.left+S.right:S.top+S.bottom;return{offset:Fe/2+Ue/2}})}},[te,l,E,S,N]);T==="shift"||N==="shift"||s==="center"?Ee.push(Se,oe):Ee.push(oe,Se),Ee.push(ip({...te,apply({elements:{floating:Te},rects:{reference:Ne},availableWidth:Be,availableHeight:ke}){Object.entries({"--available-width":`${Be}px`,"--available-height":`${ke}px`,"--anchor-width":`${Ne.width}px`,"--anchor-height":`${Ne.height}px`}).forEach(([be,Pe])=>{Te.style.setProperty(be,Pe)})}}),ng(()=>({element:G.current||document.createElement("div"),padding:f,offsetParent:"floating"}),[f]),{name:"transformOrigin",fn(Te){const{elements:Ne,middlewareData:Be,placement:ke,rects:be,y:Pe}=Te,Fe=Ze(ke),Ue=at(Fe),Ye=G.current,wt=Be.arrow?.x||0,Dn=Be.arrow?.y||0,Oo=Ye?.clientWidth||0,hl=Ye?.clientHeight||0,Po=wt+Oo/2,ms=Dn+hl/2,yl=Math.abs(Be.shift?.y||0),bl=be.reference.height/2,gn=typeof r=="function"?r(oi(Te,o,C)):r,vl=yl>gn,El={top:`${Po}px calc(100% + ${gn}px)`,bottom:`${Po}px ${-gn}px`,left:`calc(100% + ${gn}px) ${ms}px`,right:`${-gn}px ${ms}px`}[Fe],xl=`${Po}px ${be.reference.y+bl-Pe}px`;return Ne.floating.style.setProperty("--transform-origin",ie&&Ue==="y"&&vl?xl:El),{}}},og,y),X(()=>{!g&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[g,m]);const U=a.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:K,elements:W,x:pe,y:le,middlewareData:re,update:V,placement:ce,context:ee,isPositioned:q,floatingStyles:J}=Fp({rootContext:m,placement:D,middleware:Ee,strategy:n,whileElementsMounted:p?void 0:(...Te)=>js(...Te,U),nodeId:b,externalTree:v}),{sideX:ue,sideY:fe}=re.adaptiveOrigin||Xn,Re=q?n:"fixed",we=a.useMemo(()=>y?{position:Re,[ue]:pe,[fe]:le}:{position:Re,...J},[y,Re,ue,pe,fe,le,J]),Ce=a.useRef(null);X(()=>{if(!g)return;const Te=w.current,Ne=typeof Te=="function"?Te():Te,ke=(ri(Ne)?Ne.current:Ne)||null||null;ke!==Ce.current&&(K.setPositionReference(ke),Ce.current=ke)},[g,K,A,w]),a.useEffect(()=>{if(!g)return;const Te=w.current;typeof Te!="function"&&ri(Te)&&Te.current!==Ce.current&&(K.setPositionReference(Te.current),Ce.current=Te.current)},[g,K,A,w]),a.useEffect(()=>{if(p&&g&&W.domReference&&W.floating)return js(W.domReference,W.floating,V,U)},[p,g,W,V,U]);const $e=Ze(ce),st=ca(o,$e,C),Oe=Dt(ce)||"center",et=!!re.hide?.referenceHidden;X(()=>{x&&g&&q&&_($e)},[x,g,q,$e]);const Ge=a.useMemo(()=>({position:"absolute",top:re.arrow?.y,left:re.arrow?.x}),[re.arrow]),it=re.arrow?.centerOffset!==0;return a.useMemo(()=>({positionerStyles:we,arrowStyles:Ge,arrowRef:G,arrowUncentered:it,side:st,align:Oe,physicalSide:$e,anchorHidden:et,refs:K,context:ee,isPositioned:q,update:V}),[we,Ge,G,it,st,Oe,$e,et,K,ee,q,V])}function ri(e){return e!=null&&"current"in e}function Qr(e){return e==="starting"?Ul:ze}const la=a.forwardRef(function(t,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:c="bottom",align:u="center",sideOffset:l=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:E=ql,...b}=t,{store:y}=gt(),x=eg(),v=fd(),R=y.useState("floatingRootContext"),_=y.useState("mounted"),T=y.useState("open"),N=y.useState("openMethod"),F=y.useState("openChangeReason"),L=y.useState("activeTriggerElement"),k=y.useState("modal"),A=y.useState("positionerElement"),w=y.useState("instantType"),I=y.useState("transitionStatus"),C=a.useRef(null),O=co(A,!1,!1),D=aa({anchor:s,floatingRootContext:R,positionMethod:i,mounted:_,side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:g,disableAnchorTracking:h,keepMounted:x,nodeId:v,collisionAvoidance:E,adaptiveOrigin:rg}),S=a.useMemo(()=>{const te={};return T||(te.pointerEvents="none"),{role:"presentation",hidden:!_,style:{...D.positionerStyles,...te}}},[T,_,D.positionerStyles]),M=a.useMemo(()=>({props:S,...D}),[S,D]),$=R?.select("domReferenceElement");X(()=>{const te=$,G=C.current;if(te&&(C.current=te),G&&te&&te!==G){y.set("instantType",void 0);const H=new AbortController;return O(()=>{y.set("instantType","trigger-change")},H.signal),()=>{H.abort()}}},[$,O,y]);const z=a.useMemo(()=>({open:T,side:M.side,align:M.align,anchorHidden:M.anchorHidden,instant:w}),[T,M.side,M.align,M.anchorHidden,w]),Z=a.useCallback(te=>{y.set("positionerElement",te)},[y]),Y=ye("div",t,{state:z,props:[M.props,Qr(I),b],ref:[n,Z],stateAttributesMapping:Ft});return P.jsxs(Jr.Provider,{value:M,children:[_&&k===!0&&F!==ot&&N!=="touch"&&P.jsx(Co,{ref:y.context.internalBackdropRef,inert:Ro(!T),cutout:L}),P.jsx(dd,{id:v,children:Y})]})});process.env.NODE_ENV!=="production"&&(la.displayName="PopoverPositioner");function si(e){const t=Qe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Me(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o;return(sn(n)!==s||sn(o)!==i)&&(n=s,o=i),{width:n,height:o}}const sg=typeof ResizeObserver<"u",ig=()=>!0;function cg(e){const{popupElement:t,positionerElement:n,content:o,mounted:r,enabled:s=ig,onMeasureLayout:i,onMeasureLayoutComplete:c}=e,u=a.useRef(!0),l=co(t,!0,!1),f=un(),d=a.useRef(null),p=Q(i),m=Q(c);X(()=>{if(!r||!s()||!sg){u.current=!0,d.current=null;return}if(!t||!n)return;const g=new ResizeObserver(_=>{const T=_[0];T&&(d.current===null?d.current={width:Math.ceil(T.borderBoxSize[0].inlineSize),height:Math.ceil(T.borderBoxSize[0].blockSize)}:(d.current.width=Math.ceil(T.borderBoxSize[0].inlineSize),d.current.height=Math.ceil(T.borderBoxSize[0].blockSize)))});g.observe(t),t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto");const h=yn(t,"position","static"),E=yn(t,"transform","none"),b=yn(t,"scale","1"),y=yn(n,"--available-width","max-content"),x=yn(n,"--available-height","max-content");if(p?.(),u.current||d.current===null){n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const _=si(t);return n.style.setProperty("--positioner-width",`${_.width}px`),n.style.setProperty("--positioner-height",`${_.height}px`),h(),E(),b(),y(),x(),m?.(null,_),u.current=!1,()=>{g.disconnect()}}t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto"),n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const v=si(t);t.style.setProperty("--popup-width",`${d.current.width}px`),t.style.setProperty("--popup-height",`${d.current.height}px`),h(),E(),y(),x(),m?.(d.current,v),n.style.setProperty("--positioner-width",`${v.width}px`),n.style.setProperty("--positioner-height",`${v.height}px`);const R=new AbortController;return f.request(()=>{t.style.setProperty("--popup-width",`${v.width}px`),t.style.setProperty("--popup-height",`${v.height}px`),l(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},R.signal)}),()=>{g.disconnect(),R.abort(),f.cancel()}},[o,t,n,l,f,s,r,p,m])}function yn(e,t,n){const o=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,o)}}const ua=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(ua.displayName="ToolbarRootContext");function fa(e){return a.useContext(ua)}const ag={...Ft,...It},da=a.forwardRef(function(t,n){const{className:o,render:r,initialFocus:s,finalFocus:i,...c}=t,{store:u}=gt(),l=ia(),f=fa()!=null,d=hr(),p=u.useState("open"),m=u.useState("openMethod"),g=u.useState("instantType"),h=u.useState("transitionStatus"),E=u.useState("popupProps"),b=u.useState("titleElementId"),y=u.useState("descriptionElementId"),x=u.useState("modal"),v=u.useState("mounted"),R=u.useState("openChangeReason"),_=u.useState("popupElement"),T=u.useState("payload"),N=u.useState("positionerElement"),F=u.useState("activeTriggerElement"),L=u.useState("floatingRootContext");Lt({open:p,ref:u.context.popupRef,onComplete(){p&&u.context.onOpenChangeComplete?.(!0)}});const k=u.useState("disabled"),A=u.useState("openOnHover"),w=u.useState("closeDelay");Bp(L,{enabled:A&&!k,closeDelay:w});function I(Y){return Y==="touch"?u.context.popupRef.current:!0}const C=s===void 0?I:s,O=a.useMemo(()=>({open:p,side:l.side,align:l.align,instant:g,transitionStatus:h}),[p,l.side,l.align,g,h]),D=a.useCallback(Y=>{u.set("popupElement",Y)},[u]);function S(){L.context.events.emit("measure-layout")}function M(Y,te){L.context.events.emit("measure-layout-complete",{previousDimensions:Y,nextDimensions:te})}cg({popupElement:_,positionerElement:N,mounted:v,content:T,enabled:()=>u.context.triggerElements.size>1,onMeasureLayout:S,onMeasureLayoutComplete:M});const z=a.useMemo(()=>{let Y=l.side==="top",te=l.side==="left";return d==="rtl"?(Y=Y||l.side==="inline-end",te=te||l.side==="inline-end"):(Y=Y||l.side==="inline-start",te=te||l.side==="inline-start"),Y?{position:"absolute",[l.side==="top"?"bottom":"top"]:"0",[te?"right":"left"]:"0"}:ze},[l.side,d]),Z=ye("div",t,{state:O,ref:[n,u.context.popupRef,D],props:[E,{"aria-labelledby":b,"aria-describedby":y,style:z,onKeyDown(Y){f&&Dr.has(Y.key)&&Y.stopPropagation()}},Qr(h),c],stateAttributesMapping:ag});return P.jsx(Br,{context:L,openInteractionType:m,modal:x==="trap-focus",disabled:!v||R===ot,initialFocus:C,returnFocus:i,restoreFocus:"popup",previousFocusableElement:Me(F)?F:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:Z})});process.env.NODE_ENV!=="production"&&(da.displayName="PopoverPopup");const pa=a.forwardRef(function(t,n){const{className:o,render:r,...s}=t,{store:i}=gt(),c=i.useState("open"),{arrowRef:u,side:l,align:f,arrowUncentered:d,arrowStyles:p}=ia(),m=a.useMemo(()=>({open:c,side:l,align:f,uncentered:d}),[c,l,f,d]);return ye("div",t,{state:m,ref:[n,u],props:[{style:p,"aria-hidden":!0},s],stateAttributesMapping:Ft})});process.env.NODE_ENV!=="production"&&(pa.displayName="PopoverArrow");const lg={...Ft,...It},ma=a.forwardRef(function(t,n){const{className:o,render:r,...s}=t,{store:i}=gt(),c=i.useState("open"),u=i.useState("mounted"),l=i.useState("transitionStatus"),f=i.useState("openChangeReason"),d=a.useMemo(()=>({open:c,transitionStatus:l}),[c,l]);return ye("div",t,{state:d,ref:[i.context.backdropRef,n],props:[{role:"presentation",hidden:!u,style:{pointerEvents:f===ot?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},s],stateAttributesMapping:lg})});process.env.NODE_ENV!=="production"&&(ma.displayName="PopoverBackdrop");const ga=a.forwardRef(function(t,n){const{render:o,className:r,...s}=t,{store:i}=gt(),c=ut(s.id);return X(()=>(i.set("titleElementId",c),()=>{i.set("titleElementId",void 0)}),[i,c]),ye("h2",t,{ref:n,props:[{id:c},s]})});process.env.NODE_ENV!=="production"&&(ga.displayName="PopoverTitle");const ha=a.forwardRef(function(t,n){const{render:o,className:r,...s}=t,{store:i}=gt(),c=ut(s.id);return X(()=>(i.set("descriptionElementId",c),()=>{i.set("descriptionElementId",void 0)}),[i,c]),ye("p",t,{ref:n,props:[{id:c},s]})});process.env.NODE_ENV!=="production"&&(ha.displayName="PopoverDescription");const ya=a.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,...c}=t,{buttonRef:u,getButtonProps:l}=St({disabled:s,focusableWhenDisabled:!1,native:i}),{store:f}=gt();return ye("button",t,{ref:[n,u],props:[{onClick(p){f.setOpen(!1,ge(vi,p.nativeEvent,p.currentTarget))}},c,l]})});process.env.NODE_ENV!=="production"&&(ya.displayName="PopoverClose");const ug="_popup_1w2m7_1",fg="_arrow_1w2m7_25",dg="_title_1w2m7_35",pg="_description_1w2m7_42",mg="_close_1w2m7_49",gg="_backdrop_1w2m7_76",pn={popup:ug,arrow:fg,title:dg,description:pg,close:mg,backdrop:gg},ba=Jm,va=a.forwardRef(function({children:t,...n},o){return P.jsx(ra,{...n,ref:o,nativeButton:!1,render:r=>a.cloneElement(t,r)})}),Ea=sa,xa=a.forwardRef(function(t,n){return P.jsx(la,{...t,ref:n})}),Sa=a.forwardRef(function({className:t,...n},o){return P.jsx(da,{...n,className:`${pn.popup} ${t||""}`,ref:o})}),wa=a.forwardRef(function({className:t,...n},o){return P.jsx(pa,{...n,className:`${pn.arrow} ${t||""}`,ref:o})}),Ra=a.forwardRef(function({className:t,...n},o){return P.jsx(ga,{...n,className:`${pn.title} ${t||""}`,ref:o})}),Ca=a.forwardRef(function({className:t,...n},o){return P.jsx(ha,{...n,className:`${pn.description} ${t||""}`,ref:o})}),_a=a.forwardRef(function({className:t,...n},o){return P.jsx(ya,{...n,className:`${pn.close} ${t||""}`,ref:o})}),Ta=a.forwardRef(function({className:t,...n},o){return P.jsx(ma,{...n,className:`${pn.backdrop} ${t||""}`,ref:o})}),hg={Root:ba,Trigger:va,Portal:Ea,Positioner:xa,Popup:Sa,Arrow:wa,Title:Ra,Description:Ca,Close:_a,Backdrop:Ta},yg="_root_1iiym_1",bg={root:yg};function vg(e){return P.jsx("div",{className:bg.root})}const Eg="_root_1hnog_1",xg={root:Eg};function Sg(e){return P.jsx("div",{className:xg.root})}const wg="_root_1ei9z_1",Rg={root:wg};function Cg(e){return P.jsx("div",{className:Rg.root})}const _g="_root_1kuso_1",Tg={root:_g};function Og(e){return P.jsx("div",{className:Tg.root})}function Pg(e){const t=a.useRef(!0);t.current&&(t.current=!1,e())}const es=a.createContext(null);process.env.NODE_ENV!=="production"&&(es.displayName="SelectRootContext");const ts=a.createContext(null);process.env.NODE_ENV!=="production"&&(ts.displayName="SelectFloatingContext");function jt(){const e=a.useContext(es);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.":Ae(60));return e}function Oa(){const e=a.useContext(ts);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.":Ae(61));return e}const Ag=(e,t)=>Object.is(e,t);function an(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function qo(e,t,n){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:an(o,t,n))}function dr(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:an(o,t,n))}function Ng(e,t,n){return e.filter(o=>!an(o,t,n))}function pr(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Ig(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function En(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 pr(e)}function Zn(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?pr(e.value):pr(e)}function Mg(e,t,n){if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??En(e,n);if(Array.isArray(t)){const o=Ig(t)?t.flatMap(r=>r.items):t;if(e==null){const r=o.find(s=>s.value==null);return r&&r.label!=null?r.label:En(e,n)}if(typeof e!="object"){const r=o.find(s=>s&&s.value===e);return r&&r.label!=null?r.label:En(e,n)}if("value"in e){const r=o.find(s=>s&&s.value===e.value);if(r&&r.label!=null)return r.label}}return En(e,n)}function Dg(e,t){return!Array.isArray(e)||e.length===0?"":e.map(n=>En(n,t)).join(", ")}const he={id:se(e=>e.id),modal:se(e=>e.modal),multiple:se(e=>e.multiple),items:se(e=>e.items),itemToStringLabel:se(e=>e.itemToStringLabel),itemToStringValue:se(e=>e.itemToStringValue),isItemEqualToValue:se(e=>e.isItemEqualToValue),value:se(e=>e.value),open:se(e=>e.open),mounted:se(e=>e.mounted),forceMount:se(e=>e.forceMount),transitionStatus:se(e=>e.transitionStatus),touchModality:se(e=>e.touchModality),activeIndex:se(e=>e.activeIndex),selectedIndex:se(e=>e.selectedIndex),isActive:se((e,t)=>e.activeIndex===t),isSelected:se((e,t,n)=>{const o=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(s=>an(s,n,o)):e.selectedIndex===t&&e.selectedIndex!==null?!0:an(r,n,o)}),isSelectedByFocus:se((e,t)=>e.selectedIndex===t),popupProps:se(e=>e.popupProps),triggerProps:se(e=>e.triggerProps),triggerElement:se(e=>e.triggerElement),positionerElement:se(e=>e.positionerElement),listElement:se(e=>e.listElement),scrollUpArrowVisible:se(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:se(e=>e.scrollDownArrowVisible),hasScrollArrows:se(e=>e.hasScrollArrows),serializedValue:se(e=>{const{multiple:t,value:n,itemToStringValue:o}=e;return t&&Array.isArray(n)&&n.length===0?"":Zn(n,o)})};function Lg(e,t){const n=a.useRef(e),o=Q(t);X(()=>{n.current!==e&&o(n.current)},[e,o]),X(()=>{n.current=e},[e])}function kg(e){const{id:t,value:n,defaultValue:o=null,onValueChange:r,open:s,defaultOpen:i=!1,onOpenChange:c,name:u,disabled:l=!1,readOnly:f=!1,required:d=!1,modal:p=!0,actionsRef:m,inputRef:g,onOpenChangeComplete:h,items:E,multiple:b=!1,itemToStringLabel:y,itemToStringValue:x,isItemEqualToValue:v=Ag,children:R}=e,{clearErrors:_}=Zc(),{setDirty:T,shouldValidateOnChange:N,validityData:F,setFilled:L,name:k,disabled:A,validation:w}=An(),{controlId:I}=_o(),C=Qc({id:t}),O=A||l,D=k??u,[S,M]=Cn({controlled:n,default:b?o??Jo:o,name:"Select",state:"value"}),[$,z]=Cn({controlled:s,default:i,name:"Select",state:"open"}),Z=a.useRef([]),Y=a.useRef([]),te=a.useRef(null),G=a.useRef(null),H=a.useRef(0),j=a.useRef(null),ae=a.useRef([]),de=a.useRef(!1),Ee=a.useRef(!1),B=a.useRef(null),ie=a.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),oe=a.useRef(!1),{mounted:Se,setMounted:U,transitionStatus:K}=ao($),W=Je(()=>new tn({id:C,modal:p,multiple:b,itemToStringLabel:y,itemToStringValue:x,isItemEqualToValue:v,value:S,open:$,mounted:Se,transitionStatus:K,items:E,forceMount:!1,touchModality:!1,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,pe=ve(W,he.activeIndex),le=ve(W,he.selectedIndex),re=ve(W,he.triggerElement),V=ve(W,he.positionerElement),ce=a.useMemo(()=>b&&Array.isArray(S)&&S.length===0?"":Zn(S,x),[b,S,x]),ee=Ve(W.state.triggerElement);ea({id:C,commit:w.commit,value:S,controlRef:ee,name:D,getValue:()=>S});const q=a.useRef(S);X(()=>{S!==q.current&&W.set("forceMount",!0)},[W,S]),X(()=>{L(S!==null)},[S,L]),X(function(){if($)return;const Pe=ae.current;if(b){const Ue=Array.isArray(S)?S:[];if(Ue.length===0){W.set("selectedIndex",null);return}const Ye=Ue[Ue.length-1],wt=dr(Pe,Ye,v);W.set("selectedIndex",wt===-1?null:wt);return}const Fe=dr(Pe,S,v);W.set("selectedIndex",Fe===-1?null:Fe)},[b,$,S,ae,v,W]),Lg(S,()=>{_(D),T(S!==F.initialValue),N()?w.commit(S):w.commit(S,!0)});const J=Q((be,Pe)=>{if(c?.(be,Pe),!Pe.isCanceled&&(z(be),!be&&W.state.activeIndex!==null)){const Fe=Z.current[W.state.activeIndex];queueMicrotask(()=>{Fe?.setAttribute("tabindex","-1")})}}),ue=Q(()=>{U(!1),W.set("activeIndex",null),h?.(!1)});Lt({enabled:!m,open:$,ref:te,onComplete(){$||ue()}}),a.useImperativeHandle(m,()=>({unmount:ue}),[ue]);const fe=Q((be,Pe)=>{r?.(be,Pe),!Pe.isCanceled&&M(be)}),Re=Q(()=>{const be=W.state.listElement||te.current;if(!be)return;const Pe=be.scrollTop,Fe=be.scrollTop+be.clientHeight,Ue=Pe>1,Ye=Fe<be.scrollHeight-1;W.state.scrollUpArrowVisible!==Ue&&W.set("scrollUpArrowVisible",Ue),W.state.scrollDownArrowVisible!==Ye&&W.set("scrollDownArrowVisible",Ye)}),we=Ac({open:$,onOpenChange:J,elements:{reference:re,floating:V}}),Ce=Hr(we,{enabled:!f&&!O,event:"mousedown"}),$e=Ur(we,{bubbles:!1}),st=Kp(we,{enabled:!f&&!O,listRef:Z,activeIndex:pe,selectedIndex:le,disabledIndices:Jo,onNavigate(be){be===null&&!$||W.set("activeIndex",be)},focusItemOnHover:!1}),Oe=Yp(we,{enabled:!f&&!O&&($||!b),listRef:Y,activeIndex:pe,selectedIndex:le,onMatch(be){$?W.set("activeIndex",be):fe(ae.current[be],ge("none"))},onTypingChange(be){de.current=be}}),{getReferenceProps:et,getFloatingProps:Ge,getItemProps:it}=Mn([Ce,$e,st,Oe]);Pg(()=>{W.update({popupProps:Ge(),triggerProps:et()})}),X(()=>{W.update({id:C,modal:p,multiple:b,value:S,open:$,mounted:Se,transitionStatus:K,popupProps:Ge(),triggerProps:et(),items:E,itemToStringLabel:y,itemToStringValue:x,isItemEqualToValue:v})},[W,C,p,b,S,$,Se,K,Ge,et,E,y,x,v]);const Te=a.useMemo(()=>({store:W,name:D,required:d,disabled:O,readOnly:f,multiple:b,itemToStringLabel:y,itemToStringValue:x,setValue:fe,setOpen:J,listRef:Z,popupRef:te,scrollHandlerRef:G,handleScrollArrowVisibility:Re,scrollArrowsMountedCountRef:H,getItemProps:it,events:we.context.events,valueRef:j,valuesRef:ae,labelsRef:Y,typingRef:de,selectionRef:ie,selectedItemTextRef:B,validation:w,onOpenChangeComplete:h,keyboardActiveRef:Ee,alignItemWithTriggerActiveRef:oe,initialValueRef:q}),[W,D,d,O,f,b,y,x,fe,J,it,we.context.events,w,h,Re]),Ne=Pt(g,w.inputRef),Be=b&&Array.isArray(S)&&S.length>0,ke=a.useMemo(()=>!b||!Array.isArray(S)||!D?null:S.map(be=>{const Pe=Zn(be,x);return P.jsx("input",{type:"hidden",name:D,value:Pe},Pe)}),[b,S,D,x]);return P.jsx(es.Provider,{value:Te,children:P.jsxs(ts.Provider,{value:we,children:[R,P.jsx("input",{...w.getInputValidationProps({onFocus(){W.state.triggerElement?.focus()},onChange(be){if(be.nativeEvent.defaultPrevented)return;const Pe=be.target.value,Fe=ge(ln,be.nativeEvent);function Ue(){if(b)return;const Ye=ae.current.find(wt=>Zn(wt,x).toLowerCase()===Pe.toLowerCase());Ye!=null&&(T(Ye!==F.initialValue),fe(Ye,Fe),N()&&w.commit(Ye))}W.set("forceMount",!0),queueMicrotask(Ue)}}),id:t||I||void 0,name:b?void 0:D,value:ce,disabled:O,required:d&&!Be,readOnly:f,ref:Ne,style:vo,tabIndex:-1,"aria-hidden":!0}),ke]})})}function Fg(e){const t=e.getBoundingClientRect();if(process.env.NODE_ENV==="test")return t;const n=window.getComputedStyle(e,"::before"),o=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||o.content!=="none"))return t;const s=parseFloat(n.width)||0,i=parseFloat(n.height)||0,c=parseFloat(o.width)||0,u=parseFloat(o.height)||0,l=Math.max(t.width,s,c),f=Math.max(t.height,i,u),d=l-t.width,p=f-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const qn=2,Vg={...ic,...Gc,value:()=>null},Pa=a.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,...c}=t,{setTouched:u,setFocused:l,validationMode:f,state:d,disabled:p}=An(),{labelId:m}=_o(),{store:g,setOpen:h,selectionRef:E,validation:b,readOnly:y,alignItemWithTriggerActiveRef:x,disabled:v,keyboardActiveRef:R}=jt(),_=p||v||s,T=ve(g,he.open),N=ve(g,he.value),F=ve(g,he.triggerProps),L=ve(g,he.positionerElement),k=ve(g,he.listElement),A=ve(g,he.serializedValue),w=Ve(L),I=a.useRef(null),C=Xe(),O=Xe(),{getButtonProps:D,buttonRef:S}=St({disabled:_,native:i}),M=Q(H=>{g.set("triggerElement",H)}),$=Pt(n,I,S,M),z=Xe(),Z=Xe();a.useEffect(()=>{if(T)return Z.start(200,()=>{E.current.allowUnselectedMouseUp=!0,z.start(200,()=>{E.current.allowSelectedMouseUp=!0})}),()=>{z.clear(),Z.clear()};E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},O.clear()},[T,E,O,z,Z]);const Y=a.useMemo(()=>k?.id??_n(L)?.id,[k,L]),te=vr(F,{role:"combobox","aria-expanded":T?"true":"false","aria-haspopup":"listbox","aria-controls":T?Y:void 0,"aria-labelledby":m,"aria-readonly":y||void 0,tabIndex:_?-1:0,ref:$,onFocus(H){l(!0),T&&x.current&&h(!1,ge(Ut,H.nativeEvent)),C.start(0,()=>{g.set("forceMount",!0)})},onBlur(){u(!0),l(!1),f==="onBlur"&&b.commit(N)},onPointerMove({pointerType:H}){R.current=!1,g.set("touchModality",H==="touch")},onPointerDown({pointerType:H}){g.set("touchModality",H==="touch")},onKeyDown(){R.current=!0},onMouseDown(H){if(T)return;const j=Ke(H.currentTarget);function ae(de){if(!I.current)return;const Ee=de.target;if(xe(I.current,Ee)||xe(w.current,Ee)||Ee===I.current)return;const B=Fg(I.current);de.clientX>=B.left-qn&&de.clientX<=B.right+qn&&de.clientY>=B.top-qn&&de.clientY<=B.bottom+qn||h(!1,ge(Zl,de))}O.start(0,()=>{j.addEventListener("mouseup",ae,{once:!0})})}},b.getValidationProps,c,D);te.role="combobox";const G=a.useMemo(()=>({...d,open:T,disabled:_,value:N,readOnly:y,placeholder:!A}),[d,T,_,N,y,A]);return ye("button",t,{ref:[n,I],state:G,stateAttributesMapping:Vg,props:te})});process.env.NODE_ENV!=="production"&&(Pa.displayName="SelectTrigger");const jg={value:()=>null},Aa=a.forwardRef(function(t,n){const{className:o,render:r,children:s,...i}=t,{store:c,valueRef:u}=jt(),l=ve(c,he.value),f=ve(c,he.items),d=ve(c,he.itemToStringLabel),p=ve(c,he.serializedValue),m=a.useMemo(()=>({value:l,placeholder:!p}),[l,p]),g=typeof s=="function"?s(l):s??(Array.isArray(l)?Dg(l,d):Mg(l,f,d));return ye("span",t,{state:m,ref:[n,u],props:[{children:g},i],stateAttributesMapping:jg})});process.env.NODE_ENV!=="production"&&(Aa.displayName="SelectValue");const Na=a.forwardRef(function(t,n){const{className:o,render:r,...s}=t,{store:i}=jt(),c=ve(i,he.open),u=a.useMemo(()=>({open:c}),[c]);return ye("span",t,{state:u,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:kr})});process.env.NODE_ENV!=="production"&&(Na.displayName="SelectIcon");const Ia=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ia.displayName="SelectPortalContext");const Ma=a.forwardRef(function(t,n){const{store:o}=jt(),r=ve(o,he.mounted),s=ve(o,he.forceMount);return r||s?P.jsx(Ia.Provider,{value:!0,children:P.jsx(Eo,{ref:n,...t})}):null});process.env.NODE_ENV!=="production"&&(Ma.displayName="SelectPortal");const ns=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(ns.displayName="SelectPositionerContext");function $g(){const e=a.useContext(ns);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.":Ae(59));return e}function so(e,t){e&&Object.assign(e.style,t)}const Bg={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Hg={position:"fixed"},Da=a.forwardRef(function(t,n){const{anchor:o,positionMethod:r="absolute",className:s,render:i,side:c="bottom",align:u="center",sideOffset:l=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h,alignItemWithTrigger:E=!0,collisionAvoidance:b=Wl,...y}=t,{store:x,listRef:v,labelsRef:R,alignItemWithTriggerActiveRef:_,selectedItemTextRef:T,valuesRef:N,initialValueRef:F,popupRef:L,setValue:k}=jt(),A=Oa(),w=ve(x,he.open),I=ve(x,he.mounted),C=ve(x,he.modal),O=ve(x,he.value),D=ve(x,he.touchModality),S=ve(x,he.positionerElement),M=ve(x,he.triggerElement),$=ve(x,he.isItemEqualToValue),z=a.useRef(null),Z=a.useRef(null),[Y,te]=a.useState(E),G=I&&Y&&!D;!I&&Y!==E&&te(E),X(()=>{I||(he.scrollUpArrowVisible(x.state)&&x.set("scrollUpArrowVisible",!1),he.scrollDownArrowVisible(x.state)&&x.set("scrollDownArrowVisible",!1))},[x,I]),a.useImperativeHandle(_,()=>G),Gr((G||C)&&w&&!D,M);const H=aa({anchor:o,floatingRootContext:A,positionMethod:r,mounted:I,side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:g,disableAnchorTracking:h??G,collisionAvoidance:b,keepMounted:!0}),j=G?"none":H.side,ae=G?Hg:H.positionerStyles,de=a.useMemo(()=>{const K={};return w||(K.pointerEvents="none"),{role:"presentation",hidden:!I,style:{...ae,...K}}},[w,I,ae]),Ee=a.useMemo(()=>({open:w,side:j,align:H.align,anchorHidden:H.anchorHidden}),[w,j,H.align,H.anchorHidden]),B=Q(K=>{x.set("positionerElement",K)}),ie=ye("div",t,{ref:[n,B],state:Ee,stateAttributesMapping:Ft,props:[de,y]}),oe=a.useRef(0),Se=Q(K=>{if(K.size===0&&oe.current===0||N.current.length===0)return;const W=oe.current;if(oe.current=K.size,K.size===W)return;const pe=ge(ln);if(W!==0&&!x.state.multiple&&O!==null&&dr(N.current,O,$)===-1){const re=F.current,ce=re!=null&&qo(N.current,re,$)?re:null;k(ce,pe),ce===null&&(x.set("selectedIndex",null),T.current=null)}if(W!==0&&x.state.multiple&&Array.isArray(O)){const le=O.filter(re=>qo(N.current,re,$));(le.length!==O.length||le.some(re=>!qo(O,re,$)))&&(k(le,pe),le.length===0&&(x.set("selectedIndex",null),T.current=null))}if(w&&G){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const le={height:""};so(S,le),so(L.current,le)}}),U=a.useMemo(()=>({...H,side:j,alignItemWithTriggerActive:G,setControlledAlignItemWithTrigger:te,scrollUpArrowRef:z,scrollDownArrowRef:Z}),[H,j,G,te]);return P.jsx(fi,{elementsRef:v,labelsRef:R,onMapChange:Se,children:P.jsxs(ns.Provider,{value:U,children:[I&&C&&P.jsx(Co,{inert:Ro(!w),cutout:M}),ie]})})});process.env.NODE_ENV!=="production"&&(Da.displayName="SelectPositioner");function La(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const Kn="base-ui-disable-scrollbar",ii={className:Kn,element:P.jsx("style",{href:Kn,precedence:"base-ui:low",children:`.${Kn}{scrollbar-width:none}.${Kn}::-webkit-scrollbar{display:none}`})},zg={...Ft,...It},ka=a.forwardRef(function(t,n){const{render:o,className:r,...s}=t,{store:i,popupRef:c,onOpenChangeComplete:u,setOpen:l,valueRef:f,selectedItemTextRef:d,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:g,scrollHandlerRef:h}=jt(),{side:E,align:b,alignItemWithTriggerActive:y,setControlledAlignItemWithTrigger:x,scrollDownArrowRef:v,scrollUpArrowRef:R}=$g(),_=fa()!=null,T=Oa(),N=Xe(),F=ve(i,he.id),L=ve(i,he.open),k=ve(i,he.mounted),A=ve(i,he.popupProps),w=ve(i,he.transitionStatus),I=ve(i,he.triggerElement),C=ve(i,he.positionerElement),O=ve(i,he.listElement),D=a.useRef(0),S=a.useRef(!1),M=a.useRef(0),$=a.useRef(!1),z=a.useRef({}),Z=un(),Y=Q(j=>{if(!C||!c.current||!$.current)return;if(S.current||!y){g();return}const ae=C.style.top==="0px",de=C.style.bottom==="0px",Ee=C.getBoundingClientRect().height,B=Ke(C),ie=getComputedStyle(C),oe=parseFloat(ie.marginTop),Se=parseFloat(ie.marginBottom),U=B.documentElement.clientHeight-oe-Se,K=j.scrollTop,W=j.scrollHeight,pe=j.clientHeight,le=W-pe;let re=null,V=null,ce=!1;if(ae){const ee=le-K,q=Ee+ee,J=Math.min(q,U);re=J,J!==U?V=le:ce=!0}else if(de){const ee=K-0,q=Ee+ee,J=Math.min(q,U),ue=q-U;re=J,J!==U?V=0:(ce=!0,K<le&&(V=K-(ee-ue)))}re!=null&&(C.style.height=`${re}px`),V!=null&&(j.scrollTop=V),ce&&(S.current=!0),g()});a.useImperativeHandle(h,()=>Y,[Y]),Lt({open:L,ref:c,onComplete(){L&&u?.(!0)}});const te=a.useMemo(()=>({open:L,transitionStatus:w,side:E,align:b}),[L,w,E,b]);X(()=>{!C||!c.current||Object.keys(z.current).length||(z.current={top:C.style.top||"0",left:C.style.left||"0",right:C.style.right,height:C.style.height,bottom:C.style.bottom,minHeight:C.style.minHeight,maxHeight:C.style.maxHeight,marginTop:C.style.marginTop,marginBottom:C.style.marginBottom})},[c,C]),X(()=>{k||y||($.current=!1,S.current=!1,D.current=0,M.current=0,so(C,z.current))},[k,y,C,c]),X(()=>{const j=c.current;if(!(!k||!I||!C||!j)){if(!y){$.current=!0,Z.request(g);return}queueMicrotask(()=>{const ae=getComputedStyle(C),de=getComputedStyle(j),Ee=Ke(I),B=De(C),ie=I.getBoundingClientRect(),oe=C.getBoundingClientRect(),Se=ie.left,U=ie.height,K=O||j,W=K.scrollHeight,pe=parseFloat(de.borderBottomWidth),le=parseFloat(ae.marginTop)||10,re=parseFloat(ae.marginBottom)||10,V=parseFloat(ae.minHeight)||100,ce=5,ee=5,q=20,J=Ee.documentElement.clientHeight-le-re,ue=Ee.documentElement.clientWidth,fe=J-ie.bottom+U,Re=d.current,we=f.current;let Ce=0,$e=0;if(Re&&we){const Fe=we.getBoundingClientRect(),Ue=Re.getBoundingClientRect(),Ye=Fe.left-Se,wt=Ue.left-oe.left,Dn=Fe.top-ie.top+Fe.height/2,Oo=Ue.top-oe.top+Ue.height/2;Ce=Ye-wt,$e=Oo-Dn}const st=fe+$e+re+pe;let Oe=Math.min(J,st);const et=J-le-re,Ge=st-Oe,it=Math.max(ce,Se+Ce),Te=ue-ee,Ne=Math.max(0,it+oe.width-Te);C.style.left=`${it-Ne}px`,C.style.height=`${Oe}px`,C.style.maxHeight="auto",C.style.marginTop=`${le}px`,C.style.marginBottom=`${re}px`,j.style.height="100%";const Be=K.scrollHeight-K.clientHeight,ke=Ge>=Be;ke&&(Oe=Math.min(J,oe.height)-(Ge-Be));const be=ie.top<q||ie.bottom>J-q||Oe<Math.min(W,V),Pe=(B.visualViewport?.scale??1)!==1&&Ii;if(be||Pe){$.current=!0,so(C,z.current),rt.flushSync(()=>x(!1));return}if(ke){const Fe=Math.max(0,J-st);C.style.top=oe.height>=et?"0":`${Fe}px`,C.style.height=`${Oe}px`,K.scrollTop=K.scrollHeight-K.clientHeight,D.current=Math.max(V,Oe)}else C.style.bottom="0",D.current=Math.max(V,Oe),K.scrollTop=Ge;D.current===J&&(S.current=!0),g(),setTimeout(()=>{$.current=!0})})}},[i,k,C,I,f,d,c,g,y,x,Z,v,R,O]),a.useEffect(()=>{if(!y||!C||!k)return;const j=De(C);function ae(de){l(!1,ge(Jl,de))}return j.addEventListener("resize",ae),()=>{j.removeEventListener("resize",ae)}},[l,y,C,k]);const G={...O?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${F}-list`},onKeyDown(j){p.current=!0,_&&Dr.has(j.key)&&j.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(j){if(La(j)||j.pointerType==="touch")return;const ae=j.currentTarget;N.start(0,()=>{i.set("activeIndex",null),ae.focus({preventScroll:!0})})},onScroll(j){O||h.current?.(j.currentTarget)},...y&&{style:O?{height:"100%"}:Bg}},H=ye("div",t,{ref:[n,c],state:te,stateAttributesMapping:zg,props:[A,G,Qr(w),{className:!O&&y?ii.className:void 0},s]});return P.jsxs(a.Fragment,{children:[ii.element,P.jsx(Br,{context:T,modal:!1,disabled:!k,restoreFocus:!0,children:H})]})});process.env.NODE_ENV!=="production"&&(ka.displayName="SelectPopup");const os=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(os.displayName="SelectItemContext");function rs(){const e=a.useContext(os);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.":Ae(57));return e}const Fa=a.memo(a.forwardRef(function(t,n){const{render:o,className:r,value:s=null,label:i,disabled:c=!1,nativeButton:u=!1,...l}=t,f=a.useRef(null),d=Ci({label:i,textRef:f,indexGuessBehavior:Ri.GuessFromOrder}),{store:p,getItemProps:m,setOpen:g,setValue:h,selectionRef:E,typingRef:b,valuesRef:y,keyboardActiveRef:x,multiple:v}=jt(),R=Xe(),_=ve(p,he.isActive,d.index),T=ve(p,he.isSelected,d.index,s),N=ve(p,he.isSelectedByFocus,d.index),F=ve(p,he.isItemEqualToValue),L=d.index,k=L!==-1,A=a.useRef(null),w=Ve(L);X(()=>{if(!k)return;const G=y.current;return G[L]=s,()=>{delete G[L]}},[k,L,s,y]),X(()=>{if(!k)return;const G=p.state.value;let H=G;v&&Array.isArray(G)&&G.length>0&&(H=G[G.length-1]),H!==void 0&&an(H,s,F)&&p.set("selectedIndex",L)},[k,L,v,F,p,s]);const I=a.useMemo(()=>({disabled:c,selected:T,highlighted:_}),[c,T,_]),C=m({active:_,selected:T});C.onFocus=void 0,C.id=void 0;const O=a.useRef(null),D=a.useRef("mouse"),S=a.useRef(!1),{getButtonProps:M,buttonRef:$}=St({disabled:c,focusableWhenDisabled:!0,native:u});function z(G){const H=p.state.value;if(v){const j=Array.isArray(H)?H:[],ae=T?Ng(j,s,F):[...j,s];h(ae,ge(No,G))}else h(s,ge(No,G)),g(!1,ge(No,G))}const Z={role:"option","aria-selected":T,"aria-disabled":c||void 0,tabIndex:_?0:-1,onFocus(){p.set("activeIndex",L)},onMouseEnter(){!x.current&&p.state.selectedIndex===null&&p.set("activeIndex",L)},onMouseMove(){p.set("activeIndex",L)},onMouseLeave(G){x.current||La(G)||R.start(0,()=>{p.state.activeIndex===L&&p.set("activeIndex",null)})},onTouchStart(){E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(G){O.current=G.key,p.set("activeIndex",L)},onClick(G){S.current=!1,!(G.type==="keydown"&&O.current===null)&&(c||O.current===" "&&b.current||D.current!=="touch"&&!_||(O.current=null,z(G.nativeEvent)))},onPointerEnter(G){D.current=G.pointerType},onPointerDown(G){D.current=G.pointerType,S.current=!0},onMouseUp(G){if(c)return;if(S.current){S.current=!1;return}const H=!E.current.allowSelectedMouseUp&&T,j=!E.current.allowUnselectedMouseUp&&!T;H||j||D.current!=="touch"&&!_||z(G.nativeEvent)}},Y=ye("div",t,{ref:[$,n,d.ref,A],state:I,props:[C,Z,l,M]}),te=a.useMemo(()=>({selected:T,indexRef:w,textRef:f,selectedByFocus:N,hasRegistered:k}),[T,w,f,N,k]);return P.jsx(os.Provider,{value:te,children:Y})}));process.env.NODE_ENV!=="production"&&(Fa.displayName="SelectItem");const Va=a.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:r}=rs();return o||r?P.jsx(ja,{...t,ref:n}):null});process.env.NODE_ENV!=="production"&&(Va.displayName="SelectItemIndicator");const ja=a.memo(a.forwardRef((e,t)=>{const{render:n,className:o,keepMounted:r,...s}=e,{selected:i}=rs(),c=a.useRef(null),{transitionStatus:u,setMounted:l}=ao(i),f=a.useMemo(()=>({selected:i,transitionStatus:u}),[i,u]),d=ye("span",e,{ref:[t,c],state:f,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:It});return Lt({open:i,ref:c,onComplete(){i||l(!1)}}),d}));process.env.NODE_ENV!=="production"&&(ja.displayName="Inner");const $a=a.memo(a.forwardRef(function(t,n){const{indexRef:o,textRef:r,selectedByFocus:s,hasRegistered:i}=rs(),{selectedItemTextRef:c}=jt(),{className:u,render:l,...f}=t,d=a.useCallback(m=>{if(!m||!i)return;const g=c.current===null||!c.current.isConnected;(s||g&&o.current===0)&&(c.current=m)},[c,o,s,i]);return ye("div",t,{ref:[d,n,r],props:f})}));process.env.NODE_ENV!=="production"&&($a.displayName="SelectItemText");const ss=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(ss.displayName="SelectGroupContext");function Ug(){const e=a.useContext(ss);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.":Ae(56));return e}const Ba=a.forwardRef(function(t,n){const{className:o,render:r,...s}=t,[i,c]=a.useState(),u=a.useMemo(()=>({labelId:i,setLabelId:c}),[i,c]),l=ye("div",t,{ref:n,props:[{role:"group","aria-labelledby":i},s]});return P.jsx(ss.Provider,{value:u,children:l})});process.env.NODE_ENV!=="production"&&(Ba.displayName="SelectGroup");const Ha=a.forwardRef(function(t,n){const{className:o,render:r,id:s,...i}=t,{setLabelId:c}=Ug(),u=ut(s);return X(()=>{c(u)},[u,c]),ye("div",t,{ref:n,props:[{id:u},i]})});process.env.NODE_ENV!=="production"&&(Ha.displayName="SelectGroupLabel");const za=a.forwardRef(function(t,n){const{className:o,render:r,orientation:s="horizontal",...i}=t,c=a.useMemo(()=>({orientation:s}),[s]);return ye("div",t,{state:c,ref:n,props:[{role:"separator","aria-orientation":s},i]})});process.env.NODE_ENV!=="production"&&(za.displayName="Separator");const Wg=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qg=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),ci=e=>{const t=qg(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ua=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),Kg=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Gg={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 Yg=ne.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:s,iconNode:i,...c},u)=>ne.createElement("svg",{ref:u,...Gg,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Ua("lucide",r),...!s&&!Kg(c)&&{"aria-hidden":"true"},...c},[...i.map(([l,f])=>ne.createElement(l,f)),...Array.isArray(s)?s:[s]]));const Wa=(e,t)=>{const n=ne.forwardRef(({className:o,...r},s)=>ne.createElement(Yg,{ref:s,iconNode:t,className:Ua(`lucide-${Wg(ci(e))}`,`lucide-${e}`,o),...r}));return n.displayName=ci(e),n};const Xg=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Zg=Wa("check",Xg);const Jg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Qg=Wa("chevron-down",Jg);function qa(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=qa(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Yt(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=qa(e))&&(o&&(o+=" "),o+=t);return o}const eh="_trigger_krl6a_1",th="_icon_krl6a_40",nh="_popup_krl6a_48",oh="_item_krl6a_69",rh="_itemIndicator_krl6a_99",sh="_group_krl6a_107",ih="_label_krl6a_111",ch="_separator_krl6a_118",At={trigger:eh,icon:th,popup:nh,item:oh,itemIndicator:rh,group:sh,label:ih,separator:ch};function ah(e){return P.jsx(kg,{...e})}const Ka=a.forwardRef(({className:e,children:t,placeholder:n,renderValue:o,...r},s)=>{const i=(c,u)=>!u.value||Array.isArray(u.value)&&u.value.length===0?P.jsx("span",{...c,children:n||"Select..."}):Array.isArray(u.value)?P.jsx("span",{...c,children:u.value.join(", ")}):P.jsx("span",{...c,children:String(u.value)});return P.jsxs(Pa,{ref:s,className:Yt(At.trigger,e),...r,children:[P.jsx(Aa,{render:o||i}),P.jsx(Na,{className:At.icon,children:P.jsx(Qg,{size:16})})]})});Ka.displayName="ALSSelect.Trigger";function lh(e){return P.jsx(Ma,{...e})}const Ga=a.forwardRef(({className:e,...t},n)=>P.jsx(Da,{ref:n,className:Yt(e),sideOffset:4,...t}));Ga.displayName="ALSSelect.Positioner";const Ya=a.forwardRef(({className:e,...t},n)=>P.jsx(ka,{ref:n,className:Yt(At.popup,e),...t}));Ya.displayName="ALSSelect.Popup";const Xa=a.forwardRef(({className:e,children:t,...n},o)=>P.jsxs(Fa,{ref:o,className:Yt(At.item,e),...n,children:[P.jsx($a,{children:t}),P.jsx(Va,{className:At.itemIndicator,children:P.jsx(Zg,{size:16})})]}));Xa.displayName="ALSSelect.Item";const Za=a.forwardRef(({className:e,...t},n)=>P.jsx(Ba,{ref:n,className:Yt(At.group,e),...t}));Za.displayName="ALSSelect.Group";const Ja=a.forwardRef(({className:e,...t},n)=>P.jsx(Ha,{ref:n,className:Yt(At.label,e),...t}));Ja.displayName="ALSSelect.Label";const Qa=a.forwardRef(({className:e,...t},n)=>P.jsx(za,{ref:n,className:Yt(At.separator,e),...t}));Qa.displayName="ALSSelect.Separator";const uh={Root:ah,Trigger:Ka,Portal:lh,Positioner:Ga,Popup:Ya,Item:Xa,Group:Za,Label:Ja,Separator:Qa},fh="_root_qrq0m_1",dh={root:fh};function ph(e){return P.jsx("div",{className:dh.root})}const mh="_root_10n3a_1",gh={root:mh};function hh(e){return P.jsx("div",{className:gh.root})}const yh="_root_1vneq_1",bh={root:yh};function vh(e){return P.jsx("div",{className:bh.root})}const Eh="_root_1gw46_1",xh={root:Eh};function Sh(e){return P.jsx("div",{className:xh.root})}let ai=0;function el(e){return ai+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${ai}`}const To=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(To.displayName="ToastContext");function is(){const e=a.useContext(To);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":Ae(73));return e}function Ko(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}const tl=function(t){const{children:n,timeout:o=5e3,limit:r=3,toastManager:s}=t,[i,c]=a.useState([]),[u,l]=a.useState(!1),[f,d]=a.useState(!1),[p,m]=a.useState(null);i.length===0&&(u&&l(!1),f&&d(!1));const g=u||f,h=a.useRef(new Map),E=a.useRef(null),b=a.useRef(!0),y=a.useRef(!1);function x(w){const I=ct(Ke(E.current));if(!E.current||!xe(E.current,I)||!sr(I))return;const C=i.findIndex(S=>S.id===w);let O=null,D=C+1;for(;D<i.length;){if(i[D].transitionStatus!=="ending"){O=i[D];break}D+=1}if(!O)for(D=C-1;D>=0;){if(i[D].transitionStatus!=="ending"){O=i[D];break}D-=1}O?O.ref?.current?.focus():p?.focus({preventScroll:!0})}const v=Q(()=>{y.current||(y.current=!0,h.current.forEach(w=>{if(w.timeout){w.timeout.clear();const I=Date.now()-w.start,C=w.delay-I;w.remaining=C>0?C:0}}))}),R=Q(()=>{y.current&&(y.current=!1,h.current.forEach((w,I)=>{w.remaining=w.remaining>0?w.remaining:w.delay,w.timeout??=pt.create(),w.timeout.start(w.remaining,()=>{h.current.delete(I),w.callback()}),w.start=Date.now()}))}),_=Q(w=>{c(O=>{const D=O.map(M=>M.id===w?{...M,transitionStatus:"ending",height:0}:M),S=D.filter(M=>M.transitionStatus!=="ending");return D.map(M=>{if(M.transitionStatus==="ending")return M;const $=S.indexOf(M)>=r;return{...M,limited:$}})});const I=h.current.get(w);I&&I.timeout&&(I.timeout.clear(),h.current.delete(w)),i.find(O=>O.id===w)?.onClose?.(),x(w),i.length===1&&(l(!1),d(!1))}),T=Q(w=>{c(C=>C.filter(O=>O.id!==w)),i.find(C=>C.id===w)?.onRemove?.()}),N=Q((w,I,C)=>{const O=Date.now(),D=b.current&&!u&&!f,S=D?pt.create():void 0;S?.start(I,()=>{h.current.delete(w),C()}),h.current.set(w,{timeout:S,start:D?O:0,delay:I,remaining:I,callback:C})}),F=Q(w=>{const I=w.id||el("toast"),C={...w,id:I,transitionStatus:"starting"};c(D=>{const S=[C,...D],M=S.filter($=>$.transitionStatus!=="ending");if(M.length>r){const $=M.length-r,z=M.slice(-$);return S.map(Z=>z.some(Y=>Y.id===Z.id)?{...Z,limited:!0}:{...Z,limited:!1})}return S.map($=>({...$,limited:!1}))});const O=C.timeout??o;return C.type!=="loading"&&O>0&&N(I,O,()=>_(I)),(u||f||!b.current)&&v(),I}),L=Q((w,I)=>{c(C=>C.map(O=>O.id===w?{...O,...I}:O))}),k=Q((w,I)=>{const C=Ko(I.loading),O=F({...C,type:"loading"}),D=w.then(S=>{const M=Ko(I.success,S);L(O,{...M,type:"success"});const $=M.timeout??o;return $>0&&N(O,$,()=>_(O)),(u||f||!b.current)&&v(),S}).catch(S=>{const M=Ko(I.error,S);L(O,{...M,type:"error"});const $=M.timeout??o;return $>0&&N(O,$,()=>_(O)),(u||f||!b.current)&&v(),Promise.reject(S)});return{}.hasOwnProperty.call(I,"setPromise")&&I.setPromise(D),D});a.useEffect(function(){return s?s[" subscribe"](({action:C,options:O})=>{const D=O.id;C==="promise"&&O.promise?k(O.promise,O):C==="update"&&D?L(D,O):C==="close"&&D?_(D):F(O)}):void 0},[F,L,N,o,s,k,_]);const A=a.useMemo(()=>({toasts:i,setToasts:c,hovering:u,setHovering:l,focused:f,setFocused:d,expanded:g,add:F,close:_,remove:T,update:L,promise:k,pauseTimers:v,resumeTimers:R,prevFocusElement:p,setPrevFocusElement:m,viewportRef:E,scheduleTimer:N,windowFocusedRef:b}),[F,_,f,u,g,v,p,k,T,R,N,i,L]);return P.jsx(To.Provider,{value:A,children:n})};process.env.NODE_ENV!=="production"&&(tl.displayName="ToastProvider");const nl=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(nl.displayName="ToastViewportContext");let wh=(function(e){return e.frontmostHeight="--toast-frontmost-height",e})({});const ol=a.forwardRef(function(t,n){const{render:o,className:r,children:s,...i}=t,{toasts:c,pauseTimers:u,resumeTimers:l,setHovering:f,setFocused:d,viewportRef:p,windowFocusedRef:m,prevFocusElement:g,setPrevFocusElement:h,expanded:E,focused:b}=is(),y=a.useRef(!1),x=a.useRef(!1),v=c.length,R=c[0]?.height??0,_=a.useMemo(()=>c.some(S=>S.transitionStatus==="ending"),[c]);a.useEffect(()=>{if(!p.current)return;function S($){v!==0&&$.key==="F6"&&$.target!==p.current&&($.preventDefault(),h(ct(Ke(p.current))),p.current?.focus({preventScroll:!0}),u(),d(!0))}const M=De(p.current);return M.addEventListener("keydown",S),()=>{M.removeEventListener("keydown",S)}},[u,d,h,v,p]),a.useEffect(()=>{if(!p.current||!v)return;const S=De(p.current);function M(z){z.target===S&&(m.current=!1,u())}function $(z){if(z.relatedTarget||z.target===S)return;const Z=qe(z),Y=ct(Ke(p.current));(!xe(p.current,Z)||!sr(Y))&&l(),setTimeout(()=>{m.current=!0})}return S.addEventListener("blur",M,!0),S.addEventListener("focus",$,!0),()=>{S.removeEventListener("blur",M,!0),S.removeEventListener("focus",$,!0)}},[u,l,p,m,d,v]),a.useEffect(()=>{const S=p.current;if(!S||v===0)return;const M=Ke(S);function $(z){if(z.pointerType!=="touch")return;const Z=qe(z);xe(S,Z)||(l(),f(!1),d(!1))}return M.addEventListener("pointerdown",$,!0),()=>{M.removeEventListener("pointerdown",$,!0)}},[v,l,d,f,p]);function T(S){p.current&&(y.current=!0,S.relatedTarget===p.current?c[0]?.ref?.current?.focus():g?.focus({preventScroll:!0}))}function N(S){S.key==="Tab"&&S.shiftKey&&S.target===p.current&&(S.preventDefault(),g?.focus({preventScroll:!0}),l())}a.useEffect(()=>{!m.current||_||!x.current||(l(),f(!1),x.current=!1)},[_,l,f,m]);function F(){u(),f(!0),x.current=!1}function L(){c.some(S=>S.transitionStatus==="ending")?x.current=!0:(l(),f(!1))}function k(){if(y.current){y.current=!1;return}b||sr(Ke(p.current).activeElement)&&(d(!0),u())}function A(S){!b||xe(p.current,S.relatedTarget)||(d(!1),l())}const w={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:F,onMouseMove:F,onMouseLeave:L,onFocus:k,onBlur:A,onKeyDown:N,onClick:k},I=a.useMemo(()=>({expanded:E}),[E]),C=ye("div",t,{ref:[n,p],state:I,props:[w,{style:{[wh.frontmostHeight]:R?`${R}px`:void 0}},i,{children:P.jsxs(a.Fragment,{children:[v>0&&g&&P.jsx(dt,{onFocus:T}),s,v>0&&g&&P.jsx(dt,{onFocus:T})]})}]}),O=a.useMemo(()=>({viewportRef:p}),[p]),D=a.useMemo(()=>c.filter(S=>S.priority==="high"),[c]);return P.jsxs(nl.Provider,{value:O,children:[v>0&&g&&P.jsx(dt,{onFocus:T}),C,!b&&D.length>0&&P.jsx("div",{style:vo,children:D.map(S=>P.jsxs("div",{role:"alert","aria-atomic":!0,children:[P.jsx("div",{children:S.title}),P.jsx("div",{children:S.description})]},S.id))})]})});process.env.NODE_ENV!=="production"&&(ol.displayName="ToastViewport");const cs=a.createContext(void 0);process.env.NODE_ENV!=="production"&&(cs.displayName="ToastRootContext");function qt(){const e=a.useContext(cs);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.":Ae(66));return e}let $t=(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 Rh={...It,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},bn=40,Ch=10,Rt=.5,_h=1;function li(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 Th(e){const n=window.getComputedStyle(e).transform;let o=0,r=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const c=i[1].split(", ").map(parseFloat);c.length===6?(o=c[4],r=c[5],s=Math.sqrt(c[0]*c[0]+c[1]*c[1])):c.length===16&&(o=c[12],r=c[13],s=c[0])}}return{x:o,y:r,scale:s}}const rl=a.forwardRef(function(t,n){const{toast:o,render:r,className:s,swipeDirection:i=["down","right"],...c}=t,u=o.positionerProps?.anchor!==void 0;let l=[];u||(l=Array.isArray(i)?i:[i]);const f=l.length>0,{toasts:d,focused:p,close:m,remove:g,setToasts:h,pauseTimers:E,expanded:b,setHovering:y}=is(),[x,v]=a.useState(void 0),[R,_]=a.useState(!1),[T,N]=a.useState(!1),[F,L]=a.useState(!1),[k,A]=a.useState({x:0,y:0}),[w,I]=a.useState({x:0,y:0,scale:1}),[C,O]=a.useState(),[D,S]=a.useState(),[M,$]=a.useState(null),z=a.useRef(null),Z=a.useRef({x:0,y:0}),Y=a.useRef({x:0,y:0,scale:1}),te=a.useRef(void 0),G=a.useRef(0),H=a.useRef(!1),j=a.useRef({x:0,y:0}),ae=a.useRef(!1),de=a.useMemo(()=>d.indexOf(o),[o,d]),Ee=a.useMemo(()=>d.filter(q=>q.transitionStatus!=="ending").indexOf(o),[o,d]),B=a.useMemo(()=>d.slice(0,d.indexOf(o)).reduce((q,J)=>q+(J.height||0),0),[d,o]);Lt({open:o.transitionStatus!=="ending",ref:z,onComplete(){o.transitionStatus==="ending"&&g(o.id)}});const ie=Q(()=>{const q=z.current;if(!q)return;const J=q.style.height;q.style.height="auto";const ue=q.offsetHeight;q.style.height=J,h(fe=>fe.map(Re=>Re.id===o.id?{...Re,ref:z,height:ue,transitionStatus:void 0}:Re))});X(ie,[ie]);function oe(q,J){let ue=q,fe=J;return!l.includes("left")&&!l.includes("right")?ue=q>0?q**Rt:-(Math.abs(q)**Rt):(!l.includes("right")&&q>0&&(ue=q**Rt),!l.includes("left")&&q<0&&(ue=-(Math.abs(q)**Rt))),!l.includes("up")&&!l.includes("down")?fe=J>0?J**Rt:-(Math.abs(J)**Rt):(!l.includes("down")&&J>0&&(fe=J**Rt),!l.includes("up")&&J<0&&(fe=-(Math.abs(J)**Rt))),{x:ue,y:fe}}function Se(q){if(q.button!==0)return;q.pointerType==="touch"&&E();const J=qe(q.nativeEvent);if(!(J&&J.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(H.current=!1,te.current=void 0,G.current=0,Z.current={x:q.clientX,y:q.clientY},j.current=Z.current,z.current){const fe=Th(z.current);Y.current=fe,I(fe),A({x:fe.x,y:fe.y})}y(!0),_(!0),N(!1),$(null),ae.current=!0,z.current?.setPointerCapture(q.pointerId)}}function U(q){if(!R)return;q.preventDefault(),ae.current&&(Z.current={x:q.clientX,y:q.clientY},ae.current=!1);const{clientY:J,clientX:ue,movementX:fe,movementY:Re}=q;(Re<0&&J>j.current.y||Re>0&&J<j.current.y)&&(j.current={x:j.current.x,y:J}),(fe<0&&ue>j.current.x||fe>0&&ue<j.current.x)&&(j.current={x:ue,y:j.current.y});const we=ue-Z.current.x,Ce=J-Z.current.y,$e=J-j.current.y,st=ue-j.current.x;if(!T&&Math.sqrt(we*we+Ce*Ce)>=_h&&(N(!0),M===null)){const Ne=l.includes("left")||l.includes("right"),Be=l.includes("up")||l.includes("down");if(Ne&&Be){const ke=Math.abs(we),be=Math.abs(Ce);$(ke>be?"horizontal":"vertical")}}let Oe;if(!te.current)M==="vertical"?Ce>0?Oe="down":Ce<0&&(Oe="up"):M==="horizontal"?we>0?Oe="right":we<0&&(Oe="left"):Math.abs(we)>=Math.abs(Ce)?Oe=we>0?"right":"left":Oe=Ce>0?"down":"up",Oe&&l.includes(Oe)&&(te.current=Oe,G.current=li(Oe,we,Ce),v(Oe));else{const Te=te.current,Ne=li(Te,st,$e);Ne>bn?(H.current=!1,v(Te)):G.current-Ne>=Ch&&(H.current=!0)}const et=oe(we,Ce);let Ge=Y.current.x,it=Y.current.y;M==="horizontal"?(l.includes("left")||l.includes("right"))&&(Ge+=et.x):(M==="vertical"||(l.includes("left")||l.includes("right"))&&(Ge+=et.x),(l.includes("up")||l.includes("down"))&&(it+=et.y)),A({x:Ge,y:it})}function K(q){if(!R)return;if(_(!1),N(!1),$(null),z.current?.releasePointerCapture(q.pointerId),H.current){A({x:w.x,y:w.y}),v(void 0);return}let J=!1;const ue=k.x-w.x,fe=k.y-w.y;let Re;for(const we of l){switch(we){case"right":ue>bn&&(J=!0,Re="right");break;case"left":ue<-bn&&(J=!0,Re="left");break;case"down":fe>bn&&(J=!0,Re="down");break;case"up":fe<-bn&&(J=!0,Re="up");break}if(J)break}J?(v(Re),L(!0),m(o.id)):(A({x:w.x,y:w.y}),v(void 0))}function W(q){if(q.key==="Escape"){if(!z.current||!xe(z.current,ct(Ke(z.current))))return;m(o.id)}}a.useEffect(()=>{if(!f)return;const q=z.current;if(!q)return;function J(ue){xe(q,ue.target)&&ue.preventDefault()}return q.addEventListener("touchmove",J,{passive:!1}),()=>{q.removeEventListener("touchmove",J)}},[f]);function pe(){if(!R&&k.x===w.x&&k.y===w.y&&!F)return{[$t.swipeMovementX]:"0px",[$t.swipeMovementY]:"0px"};const q=k.x-w.x,J=k.y-w.y;return{transition:R?"none":void 0,transform:R?`translateX(${k.x}px) translateY(${k.y}px) scale(${w.scale})`:void 0,[$t.swipeMovementX]:`${q}px`,[$t.swipeMovementY]:`${J}px`}}const le=o.priority==="high",re={role:le?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":C,"aria-describedby":D,"aria-hidden":le&&!p?!0:void 0,onPointerDown:f?Se:void 0,onPointerMove:f?U:void 0,onPointerUp:f?K:void 0,onKeyDown:W,inert:Ro(o.limited),style:{...pe(),[$t.index]:o.transitionStatus==="ending"?de:Ee,[$t.offsetY]:`${B}px`,[$t.height]:o.height?`${o.height}px`:void 0}},V=a.useMemo(()=>({rootRef:z,toast:o,titleId:C,setTitleId:O,descriptionId:D,setDescriptionId:S,swiping:R,swipeDirection:x,recalculateHeight:ie,index:de,visibleIndex:Ee,expanded:b}),[o,C,D,R,x,ie,de,Ee,b]),ce=a.useMemo(()=>({transitionStatus:o.transitionStatus,expanded:b,limited:o.limited||!1,type:o.type,swiping:V.swiping,swipeDirection:V.swipeDirection}),[b,o.transitionStatus,o.limited,o.type,V.swiping,V.swipeDirection]),ee=ye("div",t,{ref:[n,V.rootRef],state:ce,stateAttributesMapping:Rh,props:[re,c]});return P.jsx(cs.Provider,{value:V,children:ee})});process.env.NODE_ENV!=="production"&&(rl.displayName="ToastRoot");const sl=a.forwardRef(function(t,n){const{render:o,className:r,...s}=t,{visibleIndex:i,expanded:c,recalculateHeight:u}=qt(),l=a.useRef(null);X(()=>{const m=l.current;if(!m||(u(),typeof ResizeObserver!="function"))return;const g=new ResizeObserver(u);return g.observe(m),()=>{g.disconnect()}},[u]);const f=i>0,d=a.useMemo(()=>({expanded:c,behind:f}),[c,f]);return ye("div",t,{ref:[n,l],state:d,props:s})});process.env.NODE_ENV!=="production"&&(sl.displayName="ToastContent");const il=a.forwardRef(function(t,n){const{render:o,className:r,id:s,children:i,...c}=t,{toast:u}=qt(),l=i??u.description,f=!!l,d=Nt(s),{setDescriptionId:p}=qt();X(()=>{if(f)return p(d),()=>{p(void 0)}},[f,d,p]);const m=a.useMemo(()=>({type:u.type}),[u.type]),g=ye("p",t,{ref:n,state:m,props:{...c,id:d,children:l}});return f?g:null});process.env.NODE_ENV!=="production"&&(il.displayName="ToastDescription");const cl=a.forwardRef(function(t,n){const{render:o,className:r,id:s,children:i,...c}=t,{toast:u}=qt(),l=i??u.title,f=!!l,d=Nt(s),{setTitleId:p}=qt();X(()=>{if(f)return p(d),()=>{p(void 0)}},[f,d,p]);const m=a.useMemo(()=>({type:u.type}),[u.type]),g=ye("h2",t,{ref:n,state:m,props:{...c,id:d,children:l}});return f?g:null});process.env.NODE_ENV!=="production"&&(cl.displayName="ToastTitle");const al=a.forwardRef(function(t,n){const{render:o,className:r,disabled:s,nativeButton:i=!0,...c}=t,{close:u,expanded:l}=is(),{toast:f}=qt(),{getButtonProps:d,buttonRef:p}=St({disabled:s,native:i}),m=a.useMemo(()=>({type:f.type}),[f.type]);return ye("button",t,{ref:[n,p],state:m,props:[{"aria-hidden":!l,onClick(){u(f.id)}},c,d]})});process.env.NODE_ENV!=="production"&&(al.displayName="ToastClose");const ll=a.forwardRef(function(t,n){const{render:o,className:r,disabled:s,nativeButton:i=!0,...c}=t,{toast:u}=qt(),l=u.actionProps?.children??c.children,f=!!l,{getButtonProps:d,buttonRef:p}=St({disabled:s,native:i}),m=a.useMemo(()=>({type:u.type}),[u.type]),g=ye("button",t,{ref:[n,p],state:m,props:[c,u.actionProps,d,{children:l}]});return f?g:null});process.env.NODE_ENV!=="production"&&(ll.displayName="ToastAction");const ul=a.forwardRef(function(t,n){const{children:o,container:r,className:s,render:i,...c}=t,{portalNode:u,portalSubtree:l}=pc({container:r,ref:n,componentProps:t,elementProps:c});return!l&&!u?null:P.jsxs(a.Fragment,{children:[l,u&&rt.createPortal(o,u)]})});process.env.NODE_ENV!=="production"&&(ul.displayName="FloatingPortalLite");const Oh=ul;function fl(){const e=a.useContext(To);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":Ae(73));const{toasts:t,add:n,close:o,update:r,promise:s}=e;return a.useMemo(()=>({toasts:t,add:n,close:o,update:r,promise:s}),[t,n,o,r,s])}function Ph(){const e=[];function t(n){e.forEach(o=>o(n))}return{" subscribe":function(o){return e.push(o),()=>{const r=e.indexOf(o);r!==-1&&e.splice(r,1)}},add(n){const o=n.id||el("toast"),r={...n,id:o,transitionStatus:"starting"};return t({action:"add",options:r}),o},close(n){t({action:"close",options:{id:n}})},update(n,o){t({action:"update",options:{...o,id:n}})},promise(n,o){let r=n;return t({action:"promise",options:{...o,promise:n,setPromise(s){r=s}}}),r}}}const Ah="_viewport_x4zrf_2",Nh="_root_x4zrf_16",Ih="_content_x4zrf_120",Mh="_title_x4zrf_133",Dh="_description_x4zrf_158",Lh="_action_x4zrf_166",kh="_close_x4zrf_194",Fh="_closeIcon_x4zrf_225",xt={viewport:Ah,root:Nh,"root--success":"_root--success_x4zrf_99","root--error":"_root--error_x4zrf_103","root--warning":"_root--warning_x4zrf_107","root--info":"_root--info_x4zrf_111","root--default":"_root--default_x4zrf_115",content:Ih,title:Mh,description:Dh,action:Lh,close:kh,closeIcon:Fh},dl=({limit:e=3,timeout:t=5e3,toastManager:n,children:o})=>P.jsx(tl,{limit:e,timeout:t,toastManager:n,children:o});dl.displayName="ALSToast.Provider";const pl=({container:e,children:t})=>P.jsx(Oh,{container:e,children:t});pl.displayName="ALSToast.Portal";const ml=ne.forwardRef(({className:e,style:t},n)=>{const{toasts:o}=fl(),r=[xt.viewport,e].filter(Boolean).join(" ");return P.jsx(ol,{ref:n,className:r,style:t,children:o.slice().map((s,i)=>P.jsx(as,{toast:s,style:{"--toast-index":i},children:P.jsxs(ls,{children:[s.title&&P.jsx(us,{children:s.title}),s.description&&P.jsx(fs,{children:s.description}),s.actionProps&&P.jsx(ds,{...s.actionProps}),P.jsx(ps,{})]})},s.id))})});ml.displayName="ALSToast.Viewport";const as=ne.forwardRef(({toast:e,swipeDirection:t=["down","right"],className:n,style:o,children:r},s)=>{const i=e.type||"default",c=[xt.root,xt[`root--${i}`],n].filter(Boolean).join(" ");return P.jsx(rl,{ref:s,toast:e,swipeDirection:t,className:c,style:o,children:r})});as.displayName="ALSToast.Root";const ls=ne.forwardRef(({className:e,style:t,children:n},o)=>{const r=[xt.content,e].filter(Boolean).join(" ");return P.jsx(sl,{ref:o,className:r,style:t,children:n})});ls.displayName="ALSToast.Content";const us=ne.forwardRef(({className:e,style:t,children:n},o)=>{const r=[xt.title,e].filter(Boolean).join(" ");return P.jsx(cl,{ref:o,className:r,style:t,children:n})});us.displayName="ALSToast.Title";const fs=ne.forwardRef(({className:e,style:t,children:n},o)=>{const r=[xt.description,e].filter(Boolean).join(" ");return P.jsx(il,{ref:o,className:r,style:t,children:n})});fs.displayName="ALSToast.Description";const ds=ne.forwardRef(({className:e,style:t,children:n,onClick:o},r)=>{const s=[xt.action,e].filter(Boolean).join(" ");return P.jsx(ll,{ref:r,className:s,style:t,onClick:o,children:n})});ds.displayName="ALSToast.Action";const ps=ne.forwardRef(({className:e,style:t,children:n},o)=>{const r=[xt.close,e].filter(Boolean).join(" ");return P.jsx(al,{ref:o,className:r,style:t,children:n||P.jsx(Vh,{})})});ps.displayName="ALSToast.Close";const Vh=()=>P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:xt.closeIcon,children:P.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jh={Provider:dl,Portal:pl,Viewport:ml,Root:as,Content:ls,Title:us,Description:fs,Action:ds,Close:ps,useToastManager:fl,createToastManager:Ph},$h="_root_19t9o_1",Bh={root:$h};function Hh(e){return P.jsx("div",{className:Bh.root})}const zh="_root_u2979_1",Uh={root:zh};function Wh(e){return P.jsx("div",{className:Uh.root})}const qh="_root_6lo3f_1",Kh={root:qh};function Gh(e){return P.jsx("div",{className:Kh.root})}const Yh="_root_z5dqm_1",Xh={root:Yh};function Zh(e){return P.jsx("div",{className:Xh.root})}const Jh="_layout_hwro4_4",Qh="_layoutLeft_hwro4_28",ey="_layoutRight_hwro4_38",ty="_layoutAsideHidden_hwro4_48",ny="_layoutAsideFullHeight_hwro4_58",oy="_header_hwro4_77",ry="_headerSticky_hwro4_93",sy="_headerFixed_hwro4_98",iy="_headerRelative_hwro4_106",cy="_headerHideOnScroll_hwro4_110",ay="_headerElevated_hwro4_122",ly="_headerTransparent_hwro4_127",uy="_headerWithFullHeightAside_hwro4_133",fy="_layoutAsideCollapsed_hwro4_141",dy="_aside_hwro4_150",py="_asideFullHeight_hwro4_169",my="_asideContent_hwro4_203",gy="_asideContentCollapsed_hwro4_235",hy="_asideRelative_hwro4_240",yy="_asideFixed_hwro4_244",by="_asideCollapsed_hwro4_276",vy="_asideOverlay_hwro4_327",Ey="_asideOverlayClosing_hwro4_370",xy="_asideOverlayBackdrop_hwro4_401",Sy="_asideOverlayBackdropClosing_hwro4_421",wy="_asideResizeHandle_hwro4_437",Ry="_asideResizing_hwro4_470",Cy="_main_hwro4_490",_y="_mainPaddingNone_hwro4_522",Ty="_mainPaddingSm_hwro4_526",Oy="_mainPaddingMd_hwro4_530",Py="_mainPaddingLg_hwro4_534",Ay="_mainPaddingXl_hwro4_538",Ny="_mainFullWidth_hwro4_543",Iy="_mainWithFullHeightAside_hwro4_548",My="_footer_hwro4_565",Dy="_footerRelative_hwro4_577",Ly="_footerSticky_hwro4_581",ky="_footerFixed_hwro4_588",Fy="_footerWithFullHeightAside_hwro4_598",me={layout:Jh,layoutLeft:Qh,layoutRight:ey,layoutAsideHidden:ty,layoutAsideFullHeight:ny,header:oy,headerSticky:ry,headerFixed:sy,headerRelative:iy,headerHideOnScroll:cy,headerElevated:ay,headerTransparent:ly,headerWithFullHeightAside:uy,layoutAsideCollapsed:fy,aside:dy,asideFullHeight:py,asideContent:my,asideContentCollapsed:gy,asideRelative:hy,asideFixed:yy,asideCollapsed:by,asideOverlay:vy,asideOverlayClosing:Ey,asideOverlayBackdrop:xy,asideOverlayBackdropClosing:Sy,asideResizeHandle:wy,asideResizing:Ry,main:Cy,mainPaddingNone:_y,mainPaddingSm:Ty,mainPaddingMd:Oy,mainPaddingLg:Py,mainPaddingXl:Ay,mainFullWidth:Ny,mainWithFullHeightAside:Iy,footer:My,footerRelative:Dy,footerSticky:Ly,footerFixed:ky,footerWithFullHeightAside:Fy},mn=ne.createContext({asidePosition:"left",asideHidden:!1,asideCollapsed:!1,asideFullHeight:!1,headerBehavior:"sticky",scrollY:0,mainRef:null,registerAside:()=>{},registerHeader:()=>{}}),Vy=()=>ne.useContext(mn),jy=(e,t=10)=>{const[n,o]=ne.useState("up"),[r,s]=ne.useState(0),i=ne.useRef(0);return ne.useEffect(()=>{const c=e.current;if(!c)return;const u=()=>{const l=c.scrollTop;s(l),!(Math.abs(l-i.current)<t)&&(o(l>i.current?"down":"up"),i.current=l)};return c.addEventListener("scroll",u,{passive:!0}),()=>c.removeEventListener("scroll",u)},[e,t]),{scrollDirection:n,scrollY:r}},$y=({children:e,className:t="",behavior:n="sticky",scrollThreshold:o=50,elevated:r=!1,transparent:s=!1,height:i})=>{const{scrollY:c,registerHeader:u,asideFullHeight:l}=ne.useContext(mn),[f,d]=ne.useState(!1),[p,m]=ne.useState(s);ne.useEffect(()=>{u(n)},[n,u]),ne.useEffect(()=>{r&&d(c>0),s&&m(c<o)},[c,n,o,r,s]);const g={fixed:me.headerFixed,sticky:me.headerSticky,relative:me.headerRelative,hideOnScroll:me.headerHideOnScroll}[n],h=[me.header,g,f&&me.headerElevated,p&&me.headerTransparent,l&&me.headerWithFullHeightAside,t].filter(Boolean).join(" "),E=i?{"--header-custom-height":typeof i=="number"?`${i}px`:i}:{};return P.jsx("header",{className:h,style:E,children:e})},gl=({children:e,className:t="",collapsed:n=!1,hidden:o=!1,variant:r="relative",width:s,collapsedWidth:i,resizable:c=!1,minWidth:u=200,maxWidth:l=500,onWidthChange:f,overlay:d=!1,onOverlayClose:p,collapsedContent:m,transitionDuration:g=300,fullHeight:h=!1})=>{const{registerAside:E,asidePosition:b}=ne.useContext(mn),[y,x]=ne.useState(null),[v,R]=ne.useState(!1),[_,T]=ne.useState(!1),N=ne.useRef(null);ne.useEffect(()=>{E(n,o,h)},[n,o,h,E]);const F=ne.useCallback(()=>{p&&(T(!0),setTimeout(()=>{T(!1),p()},g))},[p,g]),L=ne.useCallback(C=>{c&&(C.preventDefault(),R(!0))},[c]);if(ne.useEffect(()=>{if(!v)return;const C=D=>{if(!N.current)return;const S=N.current.getBoundingClientRect();let M;b==="right"?M=S.right-D.clientX:M=D.clientX-S.left;const $=Math.min(Math.max(M,u),l);x($),f?.($)},O=()=>{R(!1)};return document.addEventListener("mousemove",C),document.addEventListener("mouseup",O),()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",O)}},[v,u,l,f,b]),o)return null;const k=r==="fixed"?me.asideFixed:me.asideRelative,A=[me.aside,k,n&&me.asideCollapsed,d&&me.asideOverlay,d&&_&&me.asideOverlayClosing,v&&me.asideResizing,h&&me.asideFullHeight,t].filter(Boolean).join(" "),w={...s&&!n&&!y&&{"--aside-width":typeof s=="number"?`${s}px`:s},...i&&n&&{"--aside-collapsed-width":typeof i=="number"?`${i}px`:i},...y&&!n&&{"--aside-width":`${y}px`},"--aside-transition-duration":`${g}ms`},I=[me.asideContent,n&&me.asideContentCollapsed].filter(Boolean).join(" ");return P.jsxs(P.Fragment,{children:[d&&P.jsx("div",{className:`${me.asideOverlayBackdrop} ${_?me.asideOverlayBackdropClosing:""}`,onClick:F,"aria-hidden":"true"}),P.jsxs("aside",{ref:N,className:A,style:w,children:[P.jsx("div",{className:I,children:n&&m?m:e}),c&&!n&&P.jsx("div",{className:me.asideResizeHandle,onMouseDown:L,role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar"})]})]})},By=({children:e,className:t="",maxWidth:n,centered:o=!1,padding:r="lg"})=>{const{asideHidden:s,asideFullHeight:i,mainRef:c}=ne.useContext(mn),u={none:me.mainPaddingNone,sm:me.mainPaddingSm,md:me.mainPaddingMd,lg:me.mainPaddingLg,xl:me.mainPaddingXl}[r],l=[me.main,s&&me.mainFullWidth,i&&me.mainWithFullHeightAside,u,t].filter(Boolean).join(" "),f={...n&&{maxWidth:typeof n=="number"?`${n}px`:n},...o&&{margin:"0 auto"}};return P.jsx("main",{ref:c,className:l,children:n||o?P.jsx("div",{style:f,children:e}):e})},Hy=({children:e,className:t="",variant:n="relative",height:o})=>{const{asideFullHeight:r}=ne.useContext(mn),s={fixed:me.footerFixed,sticky:me.footerSticky,relative:me.footerRelative}[n],i=[me.footer,s,r&&me.footerWithFullHeightAside,t].filter(Boolean).join(" "),c=o?{"--footer-custom-height":typeof o=="number"?`${o}px`:o}:{};return P.jsx("footer",{className:i,style:c,children:e})},zy=({children:e,className:t="",asidePosition:n="left"})=>{const[o,r]=ne.useState(!1),[s,i]=ne.useState(!1),[c,u]=ne.useState(!1),[l,f]=ne.useState("sticky"),d=ne.useRef(null),{scrollY:p}=jy(d),m=ne.useCallback((y,x,v)=>{i(y),r(x),u(v)},[]),g=ne.useCallback(y=>{f(y)},[]);ne.useEffect(()=>{ne.Children.toArray(e).some(x=>ne.isValidElement(x)&&x.type===gl&&!x.props.hidden)||r(!0)},[e]);const h=n==="right"?me.layoutRight:me.layoutLeft,E=[me.layout,h,s&&me.layoutAsideCollapsed,o&&me.layoutAsideHidden,c&&me.layoutAsideFullHeight,t].filter(Boolean).join(" "),b={asidePosition:n,asideHidden:o,asideCollapsed:s,asideFullHeight:c,headerBehavior:l,scrollY:p,mainRef:d,registerAside:m,registerHeader:g};return P.jsx(mn.Provider,{value:b,children:P.jsx("div",{className:E,children:e})})},Uy=Object.assign({Root:zy,Header:$y,Aside:gl,Main:By,Footer:Hy});exports.ALSAccordion=Af;exports.ALSAlertDialog=Mf;exports.ALSAutocomplete=kf;exports.ALSAvatar=jf;exports.ALSButton=sc;exports.ALSCheckbox=Wf;exports.ALSCheckboxGroup=Gf;exports.ALSCollapsible=Zf;exports.ALSCombobox=ed;exports.ALSContextMenu=od;exports.ALSDialog=Sm;exports.ALSField=Cm;exports.ALSFieldset=Om;exports.ALSForm=Nm;exports.ALSInput=oa;exports.ALSMenu=Fm;exports.ALSMenubar=$m;exports.ALSMeter=zm;exports.ALSNavigationMenu=qm;exports.ALSNumberField=Ym;exports.ALSPopover=hg;exports.ALSPopoverArrow=wa;exports.ALSPopoverBackdrop=Ta;exports.ALSPopoverClose=_a;exports.ALSPopoverDescription=Ca;exports.ALSPopoverPopup=Sa;exports.ALSPopoverPortal=Ea;exports.ALSPopoverPositioner=xa;exports.ALSPopoverRoot=ba;exports.ALSPopoverTitle=Ra;exports.ALSPopoverTrigger=va;exports.ALSPreviewCard=vg;exports.ALSProgress=Sg;exports.ALSRadio=Cg;exports.ALSScrollArea=Og;exports.ALSSelect=uh;exports.ALSSeparator=ph;exports.ALSSlider=hh;exports.ALSSwitch=vh;exports.ALSTabs=Sh;exports.ALSToast=jh;exports.ALSToggle=Hh;exports.ALSToggleGroup=Wh;exports.ALSToolbar=Gh;exports.ALSTooltip=Zh;exports.MainLayout=Uy;exports.useLayout=Vy;
|
|
21
|
+
//# sourceMappingURL=als-react-ts-ui.cjs.map
|