import{$ as e,A as t,At as n,B as r,Bt as i,C as a,D as o,Dt as s,E as c,G as l,H as u,It as d,J as f,K as p,L as m,Mt as h,Nt as g,Pt as _,Q as v,Rt as y,S as b,St as x,T as S,V as ee,W as C,Wt as w,b as T,ct as E,d as te,dt as ne,et as re,ft as D,g as ie,ht as ae,it as O,jt as k,k as A,kt as j,mt as M,o as N,pt as P,st as F,u as I,ut as L,vt as oe,w as se,zt as R}from"./branding-LaiyPpEP.js";import{n as z,t as B}from"./reselect-DU3bT3Sd.js";import{a as V,d as ce,f as H,i as U,l as W,n as G,s as le,t as ue,u as de}from"./useValueChanged-C6KOvSqm.js";var fe=0,pe=class e{static create(){return new e}currentId=fe;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=fe,t()},e)}isStarted(){return this.currentId!==fe}clear=()=>{this.currentId!==fe&&(clearTimeout(this.currentId),this.currentId=fe)};disposeEffect=()=>this.clear};function me(){let e=g(pe.create).current;return H(e.disposeEffect),e}function he(e,t,n=!0){return e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...he(e,t.id,n)])}function ge(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function _e(e){e.preventDefault(),e.stopPropagation()}function K(e){return`nativeEvent`in e}function ve(e){return e.pointerType===``&&e.isTrusted?!0:r&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function ye(e){return u?!1:!r&&e.width===0&&e.height===0||r&&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 q(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function J(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var be=[`top`,`right`,`bottom`,`left`],xe=Math.min,Se=Math.max,Ce=Math.round,we=Math.floor,Te=e=>({x:e,y:e}),Ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function De(e,t,n){return Se(e,xe(t,n))}function Oe(e,t){return typeof e==`function`?e(t):e}function ke(e){return e.split(`-`)[0]}function Ae(e){return e.split(`-`)[1]}function je(e){return e===`x`?`y`:`x`}function Me(e){return e===`y`?`height`:`width`}function Ne(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Pe(e){return je(Ne(e))}function Fe(e,t,n){n===void 0&&(n=!1);let r=Ae(e),i=Pe(e),a=Me(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=We(o)),[o,We(o)]}function Ie(e){let t=We(e);return[Le(e),t,Le(t)]}function Le(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Re=[`left`,`right`],ze=[`right`,`left`],Be=[`top`,`bottom`],Ve=[`bottom`,`top`];function He(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ze:Re:t?Re:ze;case`left`:case`right`:return t?Be:Ve;default:return[]}}function Ue(e,t,n,r){let i=Ae(e),a=He(ke(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Le)))),a}function We(e){let t=ke(e);return Ee[t]+e.slice(t.length)}function Ge(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ke(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ge(e)}function qe(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Je(e,t,n){return Math.floor(e/t)!==n}function Ye(e,t){return t<0||t>=e.current.length}function Xe(e,t){return Y(e,{disabledIndices:t})}function Ze(e,t){return Y(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Y(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.current.length-1&&nt(e,a,r));return a}function Qe(e,{event:t,orientation:n,loopFocus:r,rtl:i,cols:a,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:l,stopEvent:u=!1}){let d=l,f;if(t.key===`ArrowUp`?f=`up`:t.key===`ArrowDown`&&(f=`down`),f){let n=[],i=[],p=!1,m=0;{let t=null,r=-1;e.current.forEach((e,a)=>{if(e==null)return;m+=1;let o=e.closest(`[role="row"]`);o&&(p=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(a),i[a]=r})}let h=!1,g=0;if(p)for(let e of n){let t=e.length;t>g&&(g=t),t!==a&&(h=!0)}let _=h&&m<e.current.length,v=g||a,y=t=>{if(!h||l===-1)return;let a=i[l];if(a==null)return;let s=n[a].indexOf(l),c=t===`up`?-1:1;for(let t=a+c,i=0;i<n.length;i+=1,t+=c){if(t<0||t>=n.length){if(!r||_)return;t=t<0?n.length-1:0}let i=n[t];for(let t=Math.min(s,i.length-1);t>=0;--t){let n=i[t];if(!nt(e,n,o))return n}}},b=t=>{if(!_||l===-1)return;let n=l%v,i=t===`up`?-v:v,a=c-c%v,s=we(c/v)+1;for(let t=l-n+i,u=0;u<s;u+=1,t+=i){if(t<0||t>c){if(!r)return;t=t<0?a:0}let i=Math.min(t+v-1,c);for(let r=Math.min(t+n,i);r>=t;--r)if(!nt(e,r,o))return r}};u&&_e(t);let x=y(f)??b(f);if(x!==void 0)d=x;else if(l===-1)d=f===`up`?c:s;else if(d=Y(e,{startingIndex:l,amount:v,decrement:f===`up`,disabledIndices:o}),r){if(f===`up`&&(l-v<s||d<0)){let e=l%v,t=c%v,n=c-(t-e);d=t===e?c:t>e?n:n-v}f===`down`&&l+v>c&&(d=Y(e,{startingIndex:l%v-v,amount:v,disabledIndices:o}))}Ye(e,d)&&(d=l)}if(n===`both`){let n=we(l/a);t.key===(i?`ArrowLeft`:`ArrowRight`)&&(u&&_e(t),l%a===a-1?r&&(d=Y(e,{startingIndex:l-l%a-1,disabledIndices:o})):(d=Y(e,{startingIndex:l,disabledIndices:o}),r&&Je(d,a,n)&&(d=Y(e,{startingIndex:l-l%a-1,disabledIndices:o}))),Je(d,a,n)&&(d=l)),t.key===(i?`ArrowRight`:`ArrowLeft`)&&(u&&_e(t),l%a===0?r&&(d=Y(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o})):(d=Y(e,{startingIndex:l,decrement:!0,disabledIndices:o}),r&&Je(d,a,n)&&(d=Y(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o}))),Je(d,a,n)&&(d=l));let s=we(c/a)===n;Ye(e,d)&&(d=r&&s?t.key===(i?`ArrowRight`:`ArrowLeft`)?c:Y(e,{startingIndex:l-l%a-1,disabledIndices:o}):l)}return d}function $e(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function et(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function tt(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function nt(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e.current[t];return r?rt(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function rt(e){return re(e).display!==`none`}var it=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`].join(`,`),at=typeof Element>`u`,ot=at?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,st=!at&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},ct=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):ct(e.parentNode))},lt=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},ut=function(e,t,n){if(ct(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(it));return t&&ot.call(e,it)&&r.unshift(e),r=r.filter(n),r},dt=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!ct(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=dt(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{ot.call(a,it)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!ct(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=dt(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},ft=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},pt=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||lt(e))&&!ft(e)?0:e.tabIndex},mt=function(e,t){var n=pt(e);return n<0&&t&&!ft(e)?0:n},ht=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},gt=function(e){return e.tagName===`INPUT`},_t=function(e){return gt(e)&&e.type===`hidden`},vt=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},yt=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},bt=function(e){if(!e.name)return!0;var t=e.form||st(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){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`,e.message),!1}var i=yt(r,e.form);return!i||i===e},xt=function(e){return gt(e)&&e.type===`radio`},St=function(e){return xt(e)&&!bt(e)},Ct=function(e){var t=e&&st(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=st(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},wt=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},Tt=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if(getComputedStyle(e).visibility===`hidden`)return!0;var i=ot.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(ot.call(i,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var a=e;e;){var o=e.parentElement,s=st(e);if(o&&!o.shadowRoot&&r(o)===!0)return wt(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if(Ct(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return wt(e);return!1},Et=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return ot.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},Dt=function(e,t){return!(t.disabled||_t(t)||Tt(t,e)||vt(t)||Et(t))},Ot=function(e,t){return!(St(t)||pt(t)<0||!Dt(e,t))},kt=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},At=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=mt(a,i),s=i?At(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(ht).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},jt=function(e,t){return t||={},At(t.getShadowRoot?dt([e],t.includeContainer,{filter:Ot.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:kt}):ut(e,t.includeContainer,Ot.bind(null,t)))},Mt=function(e,t){return t||={},t.getShadowRoot?dt([e],t.includeContainer,{filter:Dt.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):ut(e,t.includeContainer,Dt.bind(null,t))},Nt=function(e,t){if(t||={},!e)throw Error(`No node provided`);return ot.call(e,it)===!1?!1:Ot(t,e)},Pt=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function Ft(e,t){let n=jt(e,Pt()),r=n.length;if(r===0)return;let i=b(p(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function It(e){return Ft(p(e).body,1)||e}function Lt(e){return Ft(p(e).body,-1)||e}function Rt(e,t){if(!e)return null;let n=jt(p(e).body,Pt()),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function zt(e){return Rt(e,1)}function Bt(e){return Rt(e,-1)}function Vt(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!a(n,r)}function Ht(e){jt(e,Pt()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Ut(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Wt=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=le.startingStyle]=`startingStyle`,e[e.endingStyle=le.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),Gt=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Kt={[Gt.popupOpen]:``},qt={[Gt.popupOpen]:``,[Gt.pressed]:``},Jt={[Wt.open]:``},Yt={[Wt.closed]:``},Xt={[Wt.anchorHidden]:``},Zt={open(e){return e?Kt:null}},Qt={open(e){return e?qt:null}},$t={open(e){return e?Jt:Yt},anchorHidden(e){return e?Xt:null}};function en(e){let t=g(tn,e).current;return t.next=e,v(t.effect),t}function tn(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var X=w(R()),Z=d(),nn=X.forwardRef(function(e,t){let[n,r]=X.useState();v(()=>{C&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Z.jsx)(`span`,{...e,ref:t,style:G,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})});function rn(e){return`data-base-ui-${e}`}var an=0;function on(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(an);let a=()=>e?.focus({preventScroll:n});i?a():an=requestAnimationFrame(a)}var sn={inert:new WeakMap,"aria-hidden":new WeakMap},cn=`data-base-ui-inert`,ln={inert:new WeakSet,"aria-hidden":new WeakSet},un=new WeakMap,dn=0;function fn(e){return ln[e]}function pn(e){return e?ae(e)?e.host:pn(e.parentNode):null}var mn=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=pn(t);return e.contains(n)?n:null}).filter(e=>e!=null),hn=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},gn=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{O(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function _n(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=mn(t,e),u=i?mn(t,a):[],d=new Set(u),f=i?gn(t,hn(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=sn[o],n=fn(o);c=n,s=e;let r=mn(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);gn(t,hn(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(un.get(e)||0)+1;un.set(e,t),m.push(e),t===1&&e.setAttribute(cn,``)}),dn+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(un.get(e)||0)-1;un.set(e,t),t||e.removeAttribute(cn)}),--dn,dn||(sn.inert=new WeakMap,sn[`aria-hidden`]=new WeakMap,ln.inert=new WeakSet,ln[`aria-hidden`]=new WeakSet,un=new WeakMap)}}function vn(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=p(e[0]).body;return _n(e,o,n,r,{mark:i,markerIgnoreElements:a})}var yn=w(y()),bn=X.createContext(null),xn=()=>X.useContext(bn),Sn=rn(`portal`);function Cn(t={}){let{ref:n,container:r,componentProps:i=j,elementProps:a}=t,o=f(),s=xn()?.portalNode,[c,l]=X.useState(null),[u,d]=X.useState(null),p=e(e=>{e!==null&&d(e)}),m=X.useRef(null);v(()=>{if(r===null){m.current&&(m.current=null,d(null),l(null));return}if(o==null)return;let e=(r&&(P(r)?r:r.current))??s??document.body;if(e==null){m.current&&(m.current=null,d(null),l(null));return}m.current!==e&&(m.current=e,d(null),l(e))},[r,s,o]);let h=x(`div`,i,{ref:[n,p],props:[{id:o,[Sn]:``},a]});return{portalNode:u,portalSubtree:c&&h?yn.createPortal(h,c):null}}var wn=X.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,...c}=e,{portalNode:l,portalSubtree:u}=Cn({container:r,ref:t,componentProps:e,elementProps:c}),d=X.useRef(null),f=X.useRef(null),p=X.useRef(null),m=X.useRef(null),[h,g]=X.useState(null),_=h?.modal,v=h?.open,y=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;X.useEffect(()=>{if(!l||_)return;function e(e){l&&e.relatedTarget&&Vt(e)&&(e.type===`focusin`?Ut:Ht)(l)}return l.addEventListener(`focusin`,e,!0),l.addEventListener(`focusout`,e,!0),()=>{l.removeEventListener(`focusin`,e,!0),l.removeEventListener(`focusout`,e,!0)}},[l,_]),X.useEffect(()=>{!l||v||Ut(l)},[v,l]);let b=X.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,Z.jsxs)(X.Fragment,{children:[u,(0,Z.jsxs)(bn.Provider,{value:b,children:[y&&l&&(0,Z.jsx)(nn,{"data-type":`outside`,ref:d,onFocus:e=>{Vt(e,l)?p.current?.focus():Lt(h?h.domReference:null)?.focus()}}),y&&l&&(0,Z.jsx)(`span`,{"aria-owns":l.id,style:s}),l&&yn.createPortal(n,l),y&&l&&(0,Z.jsx)(nn,{"data-type":`outside`,ref:f,onFocus:e=>{Vt(e,l)?m.current?.focus():(It(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,N(`focus-out`,e.nativeEvent)))}})]})]})});function Tn(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(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)}}}var En=class{nodesRef={current:[]};events=Tn();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Dn=X.createContext(null),On=X.createContext(null),kn=()=>X.useContext(Dn)?.id||null,An=e=>{let t=X.useContext(On);return e??t};function jn(e){let t=f(),n=An(e),r=kn();return v(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Mn(e){let{children:t,id:n}=e,r=kn();return(0,Z.jsx)(Dn.Provider,{value:X.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Nn(e){let{children:t,externalTree:n}=e,r=g(()=>n??new En).current;return(0,Z.jsx)(On.Provider,{value:r,children:t})}function Pn(e,t){let n=E(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`):``}var Fn=20,Q=[];function In(){Q=Q.filter(e=>e.deref()?.isConnected)}function Ln(e){In(),e&&O(e)!==`body`&&(Q.push(new WeakRef(e)),Q.length>Fn&&(Q=Q.slice(-Fn)))}function Rn(){return In(),Q[Q.length-1]?.deref()}function zn(e){if(!e)return null;let t=Pt();return Nt(e,t)?e:jt(e,t)[0]||e}function Bn(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():rt(e)}function Vn(e,t){if(!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=Pt(),r=Mt(e,n).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Nt(e,n)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),i=e.getAttribute(`tabindex`);t.current.includes(`floating`)||r.length===0?i!==`0`&&e.setAttribute(`tabindex`,`0`):(i!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Hn(n){let{context:r,children:i,disabled:o=!1,initialFocus:s=!0,returnFocus:c=!0,restoreFocus:u=!1,modal:d=!0,closeOnFocusOut:f=!0,openInteractionType:m=``,nextFocusableElement:g,previousFocusableElement:_,beforeContentFocusGuardRef:y,externalTree:x,getInsideElements:ee}=n,C=`rootStore`in r?r.rootStore:r,w=C.useState(`open`),T=C.useState(`domReferenceElement`),E=C.useState(`floatingElement`),{events:re,dataRef:D}=C.context,ie=e(()=>D.current.floatingContext?.nodeId),ae=s===!1,O=A(T)&&ae,k=X.useRef([`content`]),j=en(s),M=en(c),P=en(m),F=An(x),I=xn(),L=X.useRef(!1),oe=X.useRef(!1),R=X.useRef(!1),z=X.useRef(-1),B=X.useRef(``),V=X.useRef(``),H=X.useRef(null),U=X.useRef(null),G=h(H,y,I?.beforeInsideRef),le=h(U,I?.afterInsideRef),ue=me(),de=me(),fe=ce(),pe=I!=null,K=se(E),q=e((e=K)=>e?jt(e,Pt()):[]),J=e(()=>ee?.().filter(e=>e!=null)??[]),be=e(e=>{let t=q(e);return k.current.map(()=>t).filter(Boolean).flat()});X.useEffect(()=>{if(o||!d)return;function e(e){e.key===`Tab`&&a(K,b(p(K)))&&q().length===0&&!O&&_e(e)}let t=p(K);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[o,T,K,d,k,O,q,be]),X.useEffect(()=>{if(o||!w)return;let e=p(K);function t(){R.current=!1}function n(e){let t=S(e),n=J();R.current=!(a(E,t)||a(T,t)||a(I?.portalNode,t)||n.some(e=>e===t||a(e,t))),V.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(oe.current=!0)}function r(){V.current=`keyboard`}return e.addEventListener(`pointerdown`,n,!0),e.addEventListener(`pointerup`,t,!0),e.addEventListener(`pointercancel`,t,!0),e.addEventListener(`keydown`,r,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),e.removeEventListener(`pointerup`,t,!0),e.removeEventListener(`pointercancel`,t,!0),e.removeEventListener(`keydown`,r,!0)}},[o,E,T,K,w,I,J]),X.useEffect(()=>{if(o||!f)return;let e=p(K);function t(){oe.current=!0,de.start(0,()=>{oe.current=!1})}function n(e){let t=S(e),n=q().indexOf(t);n!==-1&&(z.current=n)}function r(t){let n=t.relatedTarget,r=t.currentTarget,i=S(t);queueMicrotask(()=>{let o=ie(),s=C.context.triggerElements,c=J(),l=n?.hasAttribute(rn(`focus-guard`))&&[H.current,U.current,I?.beforeInsideRef.current,I?.afterInsideRef.current,I?.beforeOutsideRef.current,I?.afterOutsideRef.current,W(_),W(g)].includes(n),f=!(a(T,n)||a(E,n)||a(n,E)||a(I?.portalNode,n)||c.some(e=>e===n||a(e,n))||n!=null&&s.hasElement(n)||s.hasMatchingElement(e=>a(e,n))||l||F&&(he(F.nodesRef.current,o).find(e=>a(e.context?.elements.floating,n)||a(e.context?.elements.domReference,n))||ge(F.nodesRef.current,o).find(e=>[e.context?.elements.floating,se(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===T&&K&&Vn(K,k),u&&r!==T&&!Bn(i)&&b(e)===e.body){if(ne(K)&&(K.focus(),u===`popup`)){fe.request(()=>{K.focus()});return}let e=z.current,t=q(),n=t[e]||t[t.length-1]||K;ne(n)&&n.focus()}if(D.current.insideReactTree){D.current.insideReactTree=!1;return}(O||!d)&&n&&f&&!oe.current&&(O||n!==Rn())&&(L.current=!0,C.setOpen(!1,N(te,t)))})}function i(){R.current||(D.current.insideReactTree=!0,ue.start(0,()=>{D.current.insideReactTree=!1}))}let s=ne(T)?T:null,c=[];if(!(!E&&!s))return s&&(s.addEventListener(`focusout`,r),s.addEventListener(`pointerdown`,t),c.push(()=>{s.removeEventListener(`focusout`,r),s.removeEventListener(`pointerdown`,t)})),E&&(E.addEventListener(`focusin`,n),E.addEventListener(`focusout`,r),I&&(E.addEventListener(`focusout`,i,!0),c.push(()=>{E.removeEventListener(`focusout`,i,!0)})),c.push(()=>{E.removeEventListener(`focusin`,n),E.removeEventListener(`focusout`,r)})),()=>{c.forEach(e=>{e()})}},[o,T,E,K,d,F,I,C,f,u,q,O,ie,k,D,ue,de,fe,g,_,J]),X.useEffect(()=>{if(o||!E||!w)return;let e=Array.from(I?.portalNode?.querySelectorAll(`[${rn(`portal`)}]`)||[]),t=(F?ge(F.nodesRef.current,ie()):[]).find(e=>A(e.context?.elements.domReference||null))?.context?.elements.domReference,n=vn([...[E,...e,H.current,U.current,I?.beforeOutsideRef.current,I?.afterOutsideRef.current,...J()],t,W(_),W(g),O?T:null].filter(e=>e!=null),{ariaHidden:d||O,mark:!1}),r=vn([E,...e].filter(e=>e!=null));return()=>{r(),n()}},[w,o,T,E,d,k,I,O,F,ie,g,_,J]),v(()=>{if(!w||o||!ne(K))return;let e=b(p(K));queueMicrotask(()=>{let t=be(K),n=j.current,r=typeof n==`function`?n(P.current||``):n;if(r===void 0||r===!1)return;let i;i=r===!0||r===null?t[0]||K:W(r),i=i||t[0]||K,!a(K,e)&&on(i,{preventScroll:i===K})})},[o,w,K,ae,be,j,P]),v(()=>{if(o||!K)return;let e=p(K);Ln(b(e));function t(e){if(e.open||(B.current=Pn(e.nativeEvent,V.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(L.current=!0),e.reason===`outside-press`)if(e.nested)L.current=!1;else if(ve(e.nativeEvent)||ye(e.nativeEvent))L.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?L.current=!1:L.current=!0}}re.on(`openchange`,t);function n(){let e=M.current,t=typeof e==`function`?e(B.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=T||Rn();return e&&e.isConnected?e:null}let n=T||Rn();return W(t)||n||null}return()=>{re.off(`openchange`,t);let r=b(e),i=J(),o=a(E,r)||i.some(e=>e===r||a(e,r))||F&&he(F.nodesRef.current,ie(),!1).some(e=>a(e.context?.elements.floating,r)),s=n();queueMicrotask(()=>{let t=zn(s),n=typeof M.current!=`boolean`;M.current&&!L.current&&ne(t)&&(!(!n&&t!==r&&r!==e.body)||o)&&t.focus({preventScroll:!0}),L.current=!1})}},[o,E,K,M,D,re,F,T,ie,J]),v(()=>{if(!l||w||!E)return;let e=b(p(E));!ne(e)||!t(e)||a(E,e)&&e.blur()},[w,E]),v(()=>{if(!(o||!I))return I.setFocusManagerState({modal:d,closeOnFocusOut:f,open:w,onOpenChange:C.setOpen,domReference:T}),()=>{I.setFocusManagerState(null)}},[o,I,d,w,C,f,T]),v(()=>{if(!(o||!K))return Vn(K,k),()=>{queueMicrotask(In)}},[o,K,k]);let xe=!o&&(d?!O:!0)&&(pe||d);return(0,Z.jsxs)(X.Fragment,{children:[xe&&(0,Z.jsx)(nn,{"data-type":`inside`,ref:G,onFocus:e=>{if(d){let e=be();on(e[e.length-1])}else I?.portalNode&&(L.current=!1,Vt(e,I.portalNode)?It(T)?.focus():W(_??I.beforeOutsideRef)?.focus())}}),i,xe&&(0,Z.jsx)(nn,{"data-type":`inside`,ref:le,onFocus:e=>{d?on(be()[0]):I?.portalNode&&(f&&(L.current=!0),Vt(e,I.portalNode)?Lt(T)?.focus():W(g??I.afterOutsideRef)?.focus())}})]})}function Un(e,n={}){let r=`rootStore`in e?e.rootStore:e,i=r.context.dataRef,{enabled:a=!0,event:o=`click`,toggle:s=!0,ignoreMouse:c=!1,stickIfOpen:l=!0,touchOpenDelay:u=0,reason:d=T}=n,f=X.useRef(void 0),p=ce(),m=me(),h=X.useMemo(()=>({onPointerDown(e){f.current=e.pointerType},onMouseDown(e){let n=f.current,a=e.nativeEvent,h=r.select(`open`);if(e.button!==0||o===`click`||q(n,!0)&&c)return;let g=i.current.openEvent,_=g?.type,v=r.select(`domReferenceElement`)!==e.currentTarget,y=h&&v||!(h&&s&&(!(g&&l)||_===`click`||_===`mousedown`));if(t(a.target)){let e=N(d,a,a.target);y&&n===`touch`&&u>0?m.start(u,()=>{r.setOpen(!0,e)}):r.setOpen(y,e);return}let b=e.currentTarget;p.request(()=>{let e=N(d,a,b);y&&n===`touch`&&u>0?m.start(u,()=>{r.setOpen(!0,e)}):r.setOpen(y,e)})},onClick(e){if(o===`mousedown-only`)return;let t=f.current;if(o===`mousedown`&&t){f.current=void 0;return}if(q(t,!0)&&c)return;let n=r.select(`open`),a=i.current.openEvent,p=r.select(`domReferenceElement`)!==e.currentTarget,h=n&&p||!(n&&s&&(!(a&&l)||J(a))),g=N(d,e.nativeEvent,e.currentTarget);h&&t===`touch`&&u>0?m.start(u,()=>{r.setOpen(!0,g)}):r.setOpen(h,g)},onKeyDown(){f.current=void 0}}),[i,o,c,r,l,s,p,m,u,d]);return X.useMemo(()=>a?{reference:h}:j,[a,h])}var Wn={intentional:`onClick`,sloppy:`onPointerDown`};function Gn(){return!1}function Kn(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function qn(t,n={}){let r=`rootStore`in t?t.rootStore:t,i=r.useState(`open`),s=r.useState(`floatingElement`),{dataRef:l}=r.context,{enabled:u=!0,escapeKey:d=!0,outsidePress:f=!0,outsidePressEvent:m=`sloppy`,referencePress:h=Gn,referencePressEvent:g=`sloppy`,bubbles:_,externalTree:v}=n,y=An(v),b=e(typeof f==`function`?f:()=>!1),x=typeof f==`function`?b:f,ee=x!==!1,C=e(()=>m),w=X.useRef(!1),E=X.useRef(!1),te=X.useRef(!1),{escapeKey:O,outsidePress:k}=Kn(_),A=X.useRef(null),j=me(),M=me(),P=e(()=>{M.clear(),l.current.insideReactTree=!1}),se=X.useRef(!1),R=X.useRef(``),z=e(h),B=e(e=>{if(!i||!u||!d||e.key!==`Escape`||se.current)return;let t=l.current.floatingContext?.nodeId,n=y?he(y.nodesRef.current,t):[];if(!O&&n.length>0){let e=!0;if(n.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let a=N(I,K(e)?e.nativeEvent:e);r.setOpen(!1,a),!O&&!a.isPropagationAllowed&&e.stopPropagation()}),V=e(()=>{l.current.insideReactTree=!0,M.start(0,P)});X.useEffect(()=>{if(!i||!u)return;l.current.__escapeKeyBubbles=O,l.current.__outsidePressBubbles=k;let e=new pe,t=new pe;function n(){e.clear(),se.current=!0}function f(){e.start(oe()?5:0,()=>{se.current=!1})}function m(){te.current=!0,t.start(0,()=>{te.current=!1})}function h(){w.current=!1,E.current=!1}function g(){let e=R.current,t=e===`pen`||!e?`mouse`:e,n=C(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function _(e){let t=g();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function v(e){let t=l.current.floatingContext?.nodeId,n=y&&he(y.nodesRef.current,t).some(t=>c(e,t.context?.elements.floating));return c(e,r.select(`floatingElement`))||c(e,r.select(`domReferenceElement`))||n}function b(e){if(_(e)){P();return}if(l.current.insideReactTree){P();return}let n=S(e),i=`[${rn(`inert`)}]`,s=Array.from(p(r.select(`floatingElement`)).querySelectorAll(i)),c=L(n)?n.getRootNode():null;ae(c)&&(s=s.concat(Array.from(c.querySelectorAll(i))));let u=r.context.triggerElements;if(n&&(u.hasElement(n)||u.hasMatchingElement(e=>a(e,n))))return;let d=L(n)?n:null;for(;d&&!D(d);){let e=F(d);if(D(e)||!L(e))break;d=e}if(s.length&&L(n)&&!o(n)&&!a(n,r.select(`floatingElement`))&&s.every(e=>!a(d,e)))return;if(ne(n)&&!(`touches`in e)){let t=D(n),r=re(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(v(e))return;if(g()===`intentional`&&te.current){t.clear(),te.current=!1;return}if(typeof x==`function`&&!x(e))return;let f=l.current.floatingContext?.nodeId,m=y?he(y.nodesRef.current,f):[];if(m.length>0){let e=!0;if(m.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}r.setOpen(!1,N(ie,e)),P()}function T(e){g()!==`sloppy`||e.pointerType===`touch`||!r.select(`open`)||!u||c(e,r.select(`floatingElement`))||c(e,r.select(`domReferenceElement`))||b(e)}function M(e){if(g()!==`sloppy`||!r.select(`open`)||!u||c(e,r.select(`floatingElement`))||c(e,r.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(A.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{A.current&&(A.current.dismissOnTouchEnd=!1,A.current.dismissOnMouseDown=!1)}))}function I(e){R.current=`touch`;let t=S(e);function n(){M(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}function z(e){if(j.clear(),e.type===`pointerdown`&&(R.current=e.pointerType),e.type===`mousedown`&&A.current&&!A.current.dismissOnMouseDown)return;let t=S(e);function n(){e.type===`pointerdown`?T(e):b(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}function V(e){if(!w.current)return;let n=E.current;if(h(),g()===`intentional`){if(e.type===`pointercancel`){n&&m();return}if(!v(e)){if(n){m();return}typeof x==`function`&&!x(e)||(t.clear(),te.current=!0,P())}}}function ce(e){if(g()!==`sloppy`||!A.current||c(e,r.select(`floatingElement`))||c(e,r.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-A.current.startX),i=Math.abs(t.clientY-A.current.startY),a=Math.sqrt(n*n+i*i);a>5&&(A.current.dismissOnTouchEnd=!0),a>10&&(b(e),j.clear(),A.current=null)}function H(e){let t=S(e);function n(){ce(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}function U(e){g()!==`sloppy`||!A.current||c(e,r.select(`floatingElement`))||c(e,r.select(`domReferenceElement`))||(A.current.dismissOnTouchEnd&&b(e),j.clear(),A.current=null)}function W(e){let t=S(e);function n(){U(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}let G=p(s);return d&&(G.addEventListener(`keydown`,B),G.addEventListener(`compositionstart`,n),G.addEventListener(`compositionend`,f)),ee&&(G.addEventListener(`click`,z,!0),G.addEventListener(`pointerdown`,z,!0),G.addEventListener(`pointerup`,V,!0),G.addEventListener(`pointercancel`,V,!0),G.addEventListener(`mousedown`,z,!0),G.addEventListener(`mouseup`,V,!0),G.addEventListener(`touchstart`,I,!0),G.addEventListener(`touchmove`,H,!0),G.addEventListener(`touchend`,W,!0)),()=>{d&&(G.removeEventListener(`keydown`,B),G.removeEventListener(`compositionstart`,n),G.removeEventListener(`compositionend`,f)),ee&&(G.removeEventListener(`click`,z,!0),G.removeEventListener(`pointerdown`,z,!0),G.removeEventListener(`pointerup`,V,!0),G.removeEventListener(`pointercancel`,V,!0),G.removeEventListener(`mousedown`,z,!0),G.removeEventListener(`mouseup`,V,!0),G.removeEventListener(`touchstart`,I,!0),G.removeEventListener(`touchmove`,H,!0),G.removeEventListener(`touchend`,W,!0)),e.clear(),t.clear(),h(),te.current=!1}},[l,s,d,ee,x,i,u,O,k,B,P,C,y,r,j]),X.useEffect(P,[x,P]);let ce=X.useMemo(()=>({onKeyDown:B,[Wn[g]]:e=>{z()&&r.setOpen(!1,N(T,e.nativeEvent))},...g!==`intentional`&&{onClick(e){z()&&r.setOpen(!1,N(`trigger-press`,e.nativeEvent))}}}),[B,r,g,z]),H=e(e=>{if(!i||!u||e.button!==0)return;let t=S(e.nativeEvent);a(r.select(`floatingElement`),t)&&(w.current||(w.current=!0,E.current=!1))}),U=e(e=>{!i||!u||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&w.current&&(E.current=!0)}),W=X.useMemo(()=>({onKeyDown:B,onPointerDown:U,onMouseDown:U,onClickCapture:V,onMouseDownCapture(e){V(),H(e)},onPointerDownCapture(e){V(),H(e)},onMouseUpCapture:V,onTouchEndCapture:V,onTouchMoveCapture:V}),[B,V,H,U]);return X.useMemo(()=>u?{reference:ce,floating:W,trigger:ce}:{},[u,ce,W])}B({memoize:z,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});var $=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(_(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},Jn=i((e=>{var t=R();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Yn=i(((e,t)=>{t.exports=Jn()})),Xn=i((e=>{var t=R(),n=Yn();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Zn=i(((e,t)=>{t.exports=Xn()})),Qn=[],$n=void 0;function er(){return $n}function tr(e){Qn.push(e)}function nr(e){let t=(t,n)=>{let r=g(ir).current,i;try{$n=r;for(let e of Qn)e.before(r);i=e(t,n);for(let e of Qn)e.after(r);r.didInitialize=!0}finally{$n=void 0}return i};return t.displayName=e.displayName||e.name,t}function rr(e){return X.forwardRef(nr(e))}function ir(){return{didInitialize:!1}}var ar=Yn(),or=Zn(),sr=k(19)?ur:dr;function cr(e,t,n,r,i){return sr(e,t,n,r,i)}function lr(e,t,n,r,i){let a=X.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,ar.useSyncExternalStore)(e.subscribe,a,a)}tr({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,ar.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function ur(e,t,n,r,i){let a=er();if(!a)return lr(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function dr(e,t,n,r,i){return(0,or.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var fr=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return cr(this,e,t,n,r)}},pr=class extends fr{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){X.useDebugValue(e),v(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;v(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;v(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){X.useDebugValue(e);let n=t!==void 0;v(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return X.useDebugValue(e),cr(this,this.selectors[e],t,n,r)}useContextCallback(t,r){X.useDebugValue(t);let i=e(r??n);this.context[t]=i}useStateSetter(e){let t=X.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},mr={open:$(e=>e.open),domReferenceElement:$(e=>e.domReferenceElement),referenceElement:$(e=>e.positionReference??e.referenceElement),floatingElement:$(e=>e.floatingElement),floatingId:$(e=>e.floatingId)},hr=class extends pr{constructor(e){let{nested:t,noEmit:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Tn(),nested:t,noEmit:n,triggerElements:i},mr)}setOpen=(e,t)=>{if((!e||!this.state.open||J(t.event))&&(this.context.dataRef.current.openEvent=e?t.event:void 0),!this.context.noEmit){let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)}this.context.onOpenChange?.(e,t)}};function gr(e,t){let n=X.useRef(null),r=X.useRef(null);return X.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function _r(t,n,r,i){let a=r.useState(`isMountedByTrigger`,t),o=gr(t,r),s=e(e=>{if(o(e),!e||!r.select(`open`))return;let n=r.select(`activeTriggerId`);if(n===t){r.update({activeTriggerElement:e,...i});return}n??r.update({activeTriggerId:t,activeTriggerElement:e,...i})});return v(()=>{a&&r.update({activeTriggerElement:n.current,...i})},[a,r,n,...Object.values(i)]),{registerTrigger:s,isMountedByThisTrigger:a}}function vr(e){let t=e.useState(`open`);v(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function yr(t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=U(t);n.useSyncedValues({mounted:i,transitionStatus:o});let s=e(()=>{a(!1),n.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),r?.(),n.context.onOpenChangeComplete?.(!1)});return V({enabled:!n.useState(`preventUnmountingOnClose`),open:t,ref:n.context.popupRef,onComplete(){t||s()}}),{forceUnmount:s,transitionStatus:o}}var br=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function xr(){return new hr({open:!1,floatingElement:null,referenceElement:null,triggerElements:new br,floatingId:``,nested:!1,noEmit:!1,onOpenChange:void 0})}function Sr(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:`idle`,floatingRootContext:xr(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:j,inactiveTriggerProps:j,popupProps:j}}var Cr=$(e=>e.triggerIdProp??e.activeTriggerId),wr={open:$(e=>e.openProp??e.open),mounted:$(e=>e.mounted),transitionStatus:$(e=>e.transitionStatus),floatingRootContext:$(e=>e.floatingRootContext),preventUnmountingOnClose:$(e=>e.preventUnmountingOnClose),payload:$(e=>e.payload),activeTriggerId:Cr,activeTriggerElement:$(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:$((e,t)=>t!==void 0&&Cr(e)===t),isOpenedByTrigger:$((e,t)=>t!==void 0&&Cr(e)===t&&e.open),isMountedByTrigger:$((e,t)=>t!==void 0&&Cr(e)===t&&e.mounted),triggerProps:$((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:$(e=>e.popupProps),popupElement:$(e=>e.popupElement),positionerElement:$(e=>e.positionerElement)};function Tr(e){let{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=e,a=f(),o=kn()!=null,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(r?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=g(()=>new hr({open:s,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:i,floatingId:a,nested:o,noEmit:n})).current;return v(()=>{let e={open:s,floatingId:a,referenceElement:c,floatingElement:l};L(c)&&(e.domReferenceElement=c),d.state.positionReference===d.state.referenceElement&&(e.positionReference=c),d.update(e)},[s,a,c,l,d]),d.context.onOpenChange=i,d.context.nested=o,d.context.noEmit=n,d}function Er(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=X.useCallback(t=>Dr(t,e,`reference`),t),o=X.useCallback(t=>Dr(t,e,`floating`),n),s=X.useCallback(t=>Dr(t,e,`item`),r),c=X.useCallback(t=>Dr(t,e,`trigger`),i);return X.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function Dr(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[m]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&Or(a,s,i,r)}return Or(a,e,i,r),a}function Or(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var kr=`ArrowUp`,Ar=`ArrowDown`,jr=`ArrowLeft`,Mr=`ArrowRight`,Nr=`Home`,Pr=new Set([jr,Mr]),Fr=new Set([kr,Ar]),Ir=new Set([...Pr,...Fr]);new Set([...Ir,Nr,`End`]);var Lr=new Set([kr,Ar,jr,Mr,Nr,`End`]);function Rr(e){return k(19)?e:e?`true`:void 0}var zr=X.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n?.getBoundingClientRect();i=`polygon(
0% 0%,
100% 0%,
100% 100%,
0% 100%,
0% 0%,
${e.left}px ${e.top}px,
${e.left}px ${e.bottom}px,
${e.right}px ${e.bottom}px,
${e.right}px ${e.top}px,
${e.left}px ${e.top}px
)`}return(0,Z.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function Br(e){let t=X.useRef(!0);t.current&&(t.current=!1,e())}var Vr={},Hr={},Ur=``;function Wr(e){if(typeof document>`u`)return!1;let t=p(e);return E(t).innerWidth-t.documentElement.clientWidth>0}function Gr(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=p(e),n=t.documentElement,r=t.body,i=M(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Kr(e){let t=p(e),n=t.documentElement,r=t.body,i=M(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function qr(e){let t=p(e),n=t.documentElement,r=t.body,i=E(n),a=0,o=0,s=!1,c=de.create();if(l&&(i.visualViewport?.scale??1)!==1)return()=>{};function u(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Vr={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ur=n.style.scrollBehavior,Hr={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=M(n)?n:r;if(s=Gr(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function d(){Object.assign(n.style,Vr),Object.assign(r.style,Hr),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Ur)}function f(){d(),c.request(u)}return u(),i.addEventListener(`resize`,f),()=>{c.cancel(),d(),typeof i.removeEventListener==`function`&&i.removeEventListener(`resize`,f)}}var Jr=new class{lockCount=0;restore=null;timeoutLock=pe.create();timeoutUnlock=pe.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=p(e).documentElement,r=E(t).getComputedStyle(t).overflowY;if(r===`hidden`||r===`clip`){this.restore=n;return}this.restore=ee||!Wr(e)?Kr(e):qr(e)}};function Yr(e=!0,t=null){v(()=>{if(e)return Jr.acquire(t)},[e,t])}function Xr(e){let t=X.useRef(``),n=X.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:X.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Zr(t){let[n,r]=X.useState(null),i=e((e,n)=>{t||r(n||(ee?`touch`:``))});ue(t,e=>{e&&!t&&r(null)});let{onClick:a,onPointerDown:o}=Xr(i);return X.useMemo(()=>({openMethod:n,triggerProps:{onClick:a,onPointerDown:o}}),[n,a,o])}export{Xe as $,An as A,$t as B,qn as C,q as Ct,Nn as D,he as Dt,Mn as E,_e as Et,rn as F,Bt as G,Zt as H,nn as I,Y as J,Vt as K,en as L,wn as M,Cn as N,jn as O,pe as Ot,on as P,Ze as Q,Wt as R,$ as S,be as St,Hn as T,ye as Tt,It as U,Qt as V,zt as W,tt as X,et as Y,Qe as Z,fr as _,Ne as _t,Rr as a,Oe as at,rr as b,qe as bt,Tr as c,Pe as ct,br as d,Ie as dt,rt as et,vr as f,je as ft,pr as g,ke as gt,hr as h,Ke as ht,zr as i,Te as it,En as j,kn as k,me as kt,Sr as l,Fe as lt,_r as m,We as mt,Yr as n,nt,Lr as o,we as ot,yr as p,Ue as pt,$e as q,Br as r,De as rt,Er as s,Ae as st,Zr as t,Ye as tt,wr as u,Me as ut,cr as v,Se as vt,Un as w,ve as wt,Zn as x,Ce as xt,nr as y,xe as yt,Gt as z};