import{r as e,b as t,j as n,a as r,w as o,s}from"./vendor-react-RSDKEZ60.js";import{i,a,b as l,g as u,f as c,c as d,d as f,e as p,h as m,j as g,k as h,u as v,l as b,m as y,n as x,o as w,p as R,q as C,r as S,s as k,t as E,v as I,w as M,x as P,y as T,z as O,A,B as D}from"./vendor-radix-qP6Vhe7Y.js";const F=(V="https://base-ui.com/production-error",N="Base UI",function(e,...t){const n=new URL(V);return n.searchParams.set("code",e.toString()),t.forEach(e=>n.searchParams.append("args[]",e)),`${N} error #${e}; visit ${n} for the full message.`});var V,N;const j={};function B(t,n){const r=e.useRef(j);return r.current===j&&(r.current=t(n)),r}function H(e,t,n,r){const o=B(z).current;return function(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}(o,e,t,n,r)&&L(o,[e,t,n,r]),o.callback}function z(){return{callback:null,cleanup:null,refs:[]}}function L(e,t){e.refs=t,t.every(e=>null==e)?e.callback=null:e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),null!=n){const r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){const o=t[e];if(null!=o)switch(typeof o){case"function":{const t=o(n);"function"==typeof t&&(r[e]=t);break}case"object":o.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){const n=t[e];if(null!=n)switch(typeof n){case"function":{const t=r[e];"function"==typeof t?t():n(null);break}case"object":n.current=null}}}}}}const W=parseInt(e.version,10);function q(e){return W>=e}function K(t){if(!e.isValidElement(t))return null;const n=t,r=n.props;return(q(19)?r?.ref:n.ref)??null}function $(e,t){return e&&!t?e:!e&&t?t:e||t?{...e,...t}:void 0}function U(){}const G=Object.freeze([]),Y=Object.freeze({});const X={};function _(e,t,n,r,o){if(!n&&!r&&!e)return J(t);let s=J(e);return t&&(s=Q(s,t)),n&&(s=Q(s,n)),r&&(s=Q(s,r)),s}function J(e){return ee(e)?{...te(e,X)}:function(e){const t={...e};for(const n in t){const e=t[n];Z(n,e)&&(t[n]=re(e))}return t}(e)}function Q(e,t){return ee(t)?te(t,e):function(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":e[n]=$(e.style,r);break;case"className":e[n]=se(e.className,r);break;default:Z(n,r)?e[n]=ne(e[n],r):e[n]=r}}return e}(e,t)}function Z(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return 111===n&&110===r&&o>=65&&o<=90&&("function"==typeof t||void 0===t)}function ee(e){return"function"==typeof e}function te(e,t){return ee(e)?e(t):e??X}function ne(e,t){return t?e?(...n)=>{const r=n[0];if(ie(r)){const o=r;oe(o);const s=t(...n);return o.baseUIHandlerPrevented||e?.(...n),s}const o=t(...n);return e?.(...n),o}:re(t):e}function re(e){return e?(...t)=>{const n=t[0];return ie(n)&&oe(n),e(...t)}:e}function oe(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function se(e,t){return t?e?t+" "+e:t:e}function ie(e){return null!=e&&"object"==typeof e&&"nativeEvent"in e}function ae(t,n,r={}){const o=n.render,s=function(e,t={}){const{className:n,style:r,render:o}=e,{state:s=Y,ref:i,props:a,stateAttributesMapping:l,enabled:u=!0}=t,c=u?function(e,t){return"function"==typeof e?e(t):e}(n,s):void 0,d=u?function(e,t){return"function"==typeof e?e(t):e}(r,s):void 0,f=u?function(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const e=t[r](o);null!=e&&Object.assign(n,e);continue}!0===o?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}(s,l):Y,p=u&&a?function(e){if(Array.isArray(e))return function(e){if(0===e.length)return X;if(1===e.length)return J(e[0]);let t=J(e[0]);for(let n=1;n<e.length;n+=1)t=Q(t,e[n]);return t}(e);return _(void 0,e)}(a):void 0,m=u?$(f,p)??{}:Y;"undefined"!=typeof document&&(u?Array.isArray(i)?m.ref=function(e){const t=B(z).current;return function(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}(t,e)&&L(t,e),t.callback}([m.ref,K(o),...i]):m.ref=H(m.ref,K(o),i):H(null,null));if(!u)return Y;void 0!==c&&(m.className=se(m.className,c));void 0!==d&&(m.style=$(m.style,d));return m}(n,r);if(!1===r.enabled)return null;return function(t,n,r,o){if(n){if("function"==typeof n)return n(r,o);const t=_(r,n.props);t.ref=r.ref;let s=n;if(s?.$$typeof===le){s=e.Children.toArray(n)[0]}return e.cloneElement(s,t)}if(t&&"string"==typeof t)return function(t,n){if("button"===t)return e.createElement("button",{type:"button",...n,key:n.key});if("img"===t)return e.createElement("img",{alt:"",...n,key:n.key});return e.createElement(t,n)}(t,r);throw new Error(F(8))}(t,o,s,r.state??Y)}const le=Symbol.for("react.lazy");function ue(e){return ae(e.defaultTagName??"div",e,e)}const ce=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),de="-",fe=[],pe=e=>{const t=he(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return ge(e);const n=e.split(de),r=""===n[0]&&n.length>1?1:0;return me(n,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=r[e],o=n[e];return t?o?((e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n})(o,t):t:o||fe}return n[e]||fe}}},me=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const n=me(e,t+1,o);if(n)return n}const s=n.validators;if(null===s)return;const i=0===t?e.join(de):e.slice(t).join(de),a=s.length;for(let l=0;l<a;l++){const e=s[l];if(e.validator(i))return e.classGroupId}},ge=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?"arbitrary.."+r:void 0})(),he=e=>{const{theme:t,classGroups:n}=e;return ve(n,t)},ve=(e,t)=>{const n=ce();for(const r in e){const o=e[r];be(o,n,r,t)}return n},be=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const o=e[s];ye(o,t,n,r)}},ye=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?Re(e,t,n,r):we(e,t,n,r):xe(e,t,n)},xe=(e,t,n)=>{(""===e?t:Ce(t,e)).classGroupId=n},we=(e,t,n,r)=>{Se(e)?be(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},Re=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[e,s]=o[i];be(s,Ce(t,e),n,r)}},Ce=(e,t)=>{let n=e;const r=t.split(de),o=r.length;for(let s=0;s<o;s++){const e=r[s];let t=n.nextPart.get(e);t||(t=ce(),n.nextPart.set(e,t)),n=t}return n},Se=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,ke=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(o,s)=>{n[o]=s,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(o(e,t),t):void 0},set(e,t){e in n?n[e]=t:o(e,t)}}},Ee=[],Ie=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),Me=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,o=0,s=0;const i=e.length;for(let c=0;c<i;c++){const i=e[c];if(0===r&&0===o){if(":"===i){t.push(e.slice(s,c)),s=c+1;continue}if("/"===i){n=c;continue}}"["===i?r++:"]"===i?r--:"("===i?o++:")"===i&&o--}const a=0===t.length?e:e.slice(s);let l=a,u=!1;a.endsWith("!")?(l=a.slice(0,-1),u=!0):a.startsWith("!")&&(l=a.slice(1),u=!0);return Ie(t,u,l,n&&n>s?n-s:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ie(Ee,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},Pe=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let r=[];for(let o=0;o<e.length;o++){const s=e[o],i="["===s[0],a=t.has(s);i||a?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(s)):r.push(s)}return r.length>0&&(r.sort(),n.push(...r)),n}},Te=/\s+/,Oe=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Oe(e[r]))&&(n&&(n+=" "),n+=t);return n},Ae=(e,...t)=>{let n,r,o,s;const i=e=>{const t=r(e);if(t)return t;const s=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],a=e.trim().split(Te);let l="";for(let u=a.length-1;u>=0;u-=1){const e=a[u],{isExternal:t,modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let m=!!p,g=r(m?f.substring(0,p):f);if(!g){if(!m){l=e+(l.length>0?" "+l:l);continue}if(g=r(f),!g){l=e+(l.length>0?" "+l:l);continue}m=!1}const h=0===c.length?"":1===c.length?c[0]:s(c).join(":"),v=d?h+"!":h,b=v+g;if(i.indexOf(b)>-1)continue;i.push(b);const y=o(g,m);for(let n=0;n<y.length;++n){const e=y[n];i.push(v+e)}l=e+(l.length>0?" "+l:l)}return l})(e,n);return o(e,s),s};return s=a=>{const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:ke(e.cacheSize),parseClassName:Me(e),sortModifiers:Pe(e),...pe(e)}))(l),r=n.cache.get,o=n.cache.set,s=i,i(a)},(...e)=>s(((...e)=>{let t,n,r=0,o="";for(;r<e.length;)(t=e[r++])&&(n=Oe(t))&&(o&&(o+=" "),o+=n);return o})(...e))},De=[],Fe=e=>{const t=t=>t[e]||De;return t.isThemeGetter=!0,t},Ve=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ne=/^\((?:(\w[\w-]*):)?(.+)\)$/i,je=/^\d+\/\d+$/,Be=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,He=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ze=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Le=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,We=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qe=e=>je.test(e),Ke=e=>!!e&&!Number.isNaN(Number(e)),$e=e=>!!e&&Number.isInteger(Number(e)),Ue=e=>e.endsWith("%")&&Ke(e.slice(0,-1)),Ge=e=>Be.test(e),Ye=()=>!0,Xe=e=>He.test(e)&&!ze.test(e),_e=()=>!1,Je=e=>Le.test(e),Qe=e=>We.test(e),Ze=e=>!tt(e)&&!at(e),et=e=>mt(e,bt,_e),tt=e=>Ve.test(e),nt=e=>mt(e,yt,Xe),rt=e=>mt(e,xt,Ke),ot=e=>mt(e,ht,_e),st=e=>mt(e,vt,Qe),it=e=>mt(e,Rt,Je),at=e=>Ne.test(e),lt=e=>gt(e,yt),ut=e=>gt(e,wt),ct=e=>gt(e,ht),dt=e=>gt(e,bt),ft=e=>gt(e,vt),pt=e=>gt(e,Rt,!0),mt=(e,t,n)=>{const r=Ve.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},gt=(e,t,n=!1)=>{const r=Ne.exec(e);return!!r&&(r[1]?t(r[1]):n)},ht=e=>"position"===e||"percentage"===e,vt=e=>"image"===e||"url"===e,bt=e=>"length"===e||"size"===e||"bg-size"===e,yt=e=>"length"===e,xt=e=>"number"===e,wt=e=>"family-name"===e,Rt=e=>"shadow"===e,Ct=()=>{const e=Fe("color"),t=Fe("font"),n=Fe("text"),r=Fe("font-weight"),o=Fe("tracking"),s=Fe("leading"),i=Fe("breakpoint"),a=Fe("container"),l=Fe("spacing"),u=Fe("radius"),c=Fe("shadow"),d=Fe("inset-shadow"),f=Fe("text-shadow"),p=Fe("drop-shadow"),m=Fe("blur"),g=Fe("perspective"),h=Fe("aspect"),v=Fe("ease"),b=Fe("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",at,tt],x=()=>[at,tt,l],w=()=>[qe,"full","auto",...x()],R=()=>[$e,"none","subgrid",at,tt],C=()=>["auto",{span:["full",$e,at,tt]},$e,at,tt],S=()=>[$e,"auto",at,tt],k=()=>["auto","min","max","fr",at,tt],E=()=>["auto",...x()],I=()=>[qe,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],M=()=>[e,at,tt],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ct,ot,{position:[at,tt]}],T=()=>["auto","cover","contain",dt,et,{size:[at,tt]}],O=()=>[Ue,lt,nt],A=()=>["","none","full",u,at,tt],D=()=>["",Ke,lt,nt],F=()=>[Ke,Ue,ct,ot],V=()=>["","none",m,at,tt],N=()=>["none",Ke,at,tt],j=()=>["none",Ke,at,tt],B=()=>[Ke,at,tt],H=()=>[qe,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ge],breakpoint:[Ge],color:[Ye],container:[Ge],"drop-shadow":[Ge],ease:["in","out","in-out"],font:[Ze],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ge],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ge],shadow:[Ge],spacing:["px",Ke],text:[Ge],"text-shadow":[Ge],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qe,tt,at,h]}],container:["container"],columns:[{columns:[Ke,tt,at,a]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[$e,"auto",at,tt]}],basis:[{basis:[qe,"full","auto",a,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ke,qe,"auto","initial","none",tt]}],grow:[{grow:["",Ke,at,tt]}],shrink:[{shrink:["",Ke,at,tt]}],order:[{order:[$e,"first","last","none",at,tt]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],w:[{w:[a,"screen",...I()]}],"min-w":[{"min-w":[a,"screen","none",...I()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,lt,nt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,at,rt]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ue,tt]}],"font-family":[{font:[ut,tt,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,at,tt]}],"line-clamp":[{"line-clamp":[Ke,"none",at,rt]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",at,tt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",at,tt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Ke,"from-font","auto",at,nt]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Ke,"auto",at,tt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",at,tt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",at,tt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$e,at,tt],radial:["",at,tt],conic:[$e,at,tt]},ft,st]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:O()}],"gradient-via-pos":[{via:O()}],"gradient-to-pos":[{to:O()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Ke,at,tt]}],"outline-w":[{outline:["",Ke,lt,nt]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",c,pt,it]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",d,pt,it]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Ke,nt]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",f,pt,it]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Ke,at,tt]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[at,tt]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",at,tt]}],filter:[{filter:["","none",at,tt]}],blur:[{blur:V()}],brightness:[{brightness:[Ke,at,tt]}],contrast:[{contrast:[Ke,at,tt]}],"drop-shadow":[{"drop-shadow":["","none",p,pt,it]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Ke,at,tt]}],"hue-rotate":[{"hue-rotate":[Ke,at,tt]}],invert:[{invert:["",Ke,at,tt]}],saturate:[{saturate:[Ke,at,tt]}],sepia:[{sepia:["",Ke,at,tt]}],"backdrop-filter":[{"backdrop-filter":["","none",at,tt]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[Ke,at,tt]}],"backdrop-contrast":[{"backdrop-contrast":[Ke,at,tt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ke,at,tt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ke,at,tt]}],"backdrop-invert":[{"backdrop-invert":["",Ke,at,tt]}],"backdrop-opacity":[{"backdrop-opacity":[Ke,at,tt]}],"backdrop-saturate":[{"backdrop-saturate":[Ke,at,tt]}],"backdrop-sepia":[{"backdrop-sepia":["",Ke,at,tt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",at,tt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ke,"initial",at,tt]}],ease:[{ease:["linear","initial",v,at,tt]}],delay:[{delay:[Ke,at,tt]}],animate:[{animate:["none",b,at,tt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,at,tt]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:N()}],"rotate-x":[{"rotate-x":N()}],"rotate-y":[{"rotate-y":N()}],"rotate-z":[{"rotate-z":N()}],scale:[{scale:j()}],"scale-x":[{"scale-x":j()}],"scale-y":[{"scale-y":j()}],"scale-z":[{"scale-z":j()}],"scale-3d":["scale-3d"],skew:[{skew:B()}],"skew-x":[{"skew-x":B()}],"skew-y":[{"skew-y":B()}],transform:[{transform:[at,tt,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:H()}],"translate-x":[{"translate-x":H()}],"translate-y":[{"translate-y":H()}],"translate-z":[{"translate-z":H()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",at,tt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",at,tt]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Ke,lt,nt,rt]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},St=(e,t,n)=>{void 0!==n&&(e[t]=n)},kt=(e,t)=>{if(t)for(const n in t)St(e,n,t[n])},Et=(e,t)=>{if(t)for(const n in t)It(e,t,n)},It=(e,t,n)=>{const r=t[n];void 0!==r&&(e[n]=e[n]?e[n].concat(r):r)},Mt=(e,...t)=>"function"==typeof e?Ae(Ct,e,...t):Ae(()=>((e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:o={},override:s={}})=>(St(e,"cacheSize",t),St(e,"prefix",n),St(e,"experimentalParseClassName",r),kt(e.theme,s.theme),kt(e.classGroups,s.classGroups),kt(e.conflictingClassGroups,s.conflictingClassGroups),kt(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),St(e,"orderSensitiveModifiers",s.orderSensitiveModifiers),Et(e.theme,o.theme),Et(e.classGroups,o.classGroups),Et(e.conflictingClassGroups,o.conflictingClassGroups),Et(e.conflictingClassGroupModifiers,o.conflictingClassGroupModifiers),It(e,o,"orderSensitiveModifiers"),e))(Ct(),e),...t),Pt=Ae(Ct);function Tt({controlled:t,default:n,name:r,state:o="value"}){const{current:s}=e.useRef(void 0!==t),[i,a]=e.useState(n);return[s?t:i,e.useCallback(e=>{s||a(e)},[])]}const Ot=t[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],At=Ot&&Ot!==e.useLayoutEffect?Ot:e=>e();function Dt(e){const t=B(Ft).current;return t.next=e,At(t.effect),t.trampoline}function Ft(){const e={next:void 0,callback:Vt,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Vt(){}const Nt="undefined"!=typeof document?e.useLayoutEffect:()=>{},jt=e.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Bt(t){const{children:r,elementsRef:o,labelsRef:s,onMapChange:i}=t,a=Dt(i),l=e.useRef(0),u=B(zt).current,c=B(Ht).current,[d,f]=e.useState(0),p=e.useRef(d),m=Dt((e,t)=>{c.set(e,t??null),p.current+=1,f(p.current)}),g=Dt(e=>{c.delete(e),p.current+=1,f(p.current)}),h=e.useMemo(()=>{const e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(Lt).forEach((t,n)=>{const r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,d]);Nt(()=>{if("function"!=typeof MutationObserver||0===h.size)return;const e=new MutationObserver(e=>{const t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),0===t.size&&(p.current+=1,f(p.current))});return h.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[h]),Nt(()=>{p.current===d&&(o.current.length!==h.size&&(o.current.length=h.size),s&&s.current.length!==h.size&&(s.current.length=h.size),l.current=h.size),a(h)},[a,h,o,s,d]),Nt(()=>()=>{o.current=[]},[o]),Nt(()=>()=>{s&&(s.current=[])},[s]);const v=Dt(e=>(u.add(e),()=>{u.delete(e)}));Nt(()=>{u.forEach(e=>e(h))},[u,h]);const b=e.useMemo(()=>({register:m,unregister:g,subscribeMapChange:v,elementsRef:o,labelsRef:s,nextIndexRef:l}),[m,g,v,o,s,l]);return n.jsx(jt.Provider,{value:b,children:r})}function Ht(){return new Map}function zt(){return new Set}function Lt(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 Wt=e.createContext(void 0);function qt(){const t=e.useContext(Wt);return t?.direction??"ltr"}const Kt=e.createContext(void 0);function $t(){const t=e.useContext(Kt);if(void 0===t)throw new Error(F(10));return t}const Ut="none",Gt="trigger-press",Yt="trigger-hover",Xt="trigger-focus",_t="outside-press",Jt="item-press",Qt="close-press",Zt="clear-press",en="track-press",tn="input-change",nn="input-clear",rn="input-press",on="focus-out",sn="escape-key",an="list-navigation",ln="cancel-open",un="sibling-open",cn="imperative-action";function dn(e,t,n,r){let o=!1,s=!1;const i=r??Y;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}function fn(e,t,n){const r=n??Y;return{reason:e,event:t??new Event("base-ui"),...r}}const pn={value:()=>null},mn=e.forwardRef(function(t,r){const{render:o,className:s,disabled:i=!1,hiddenUntilFound:a,keepMounted:l,loopFocus:u=!0,onValueChange:c,multiple:d=!1,orientation:f="vertical",value:p,defaultValue:m,style:g,...h}=t,v=qt(),b=e.useMemo(()=>{if(void 0===p)return m??[]},[p,m]),y=Dt(c),x=e.useRef([]),[w,R]=Tt({controlled:p,default:b,name:"Accordion",state:"value"}),C=Dt((e,t)=>{const n=dn(Ut);if(d)if(t){const t=w.slice();if(t.push(e),y(t,n),n.isCanceled)return;R(t)}else{const t=w.filter(t=>t!==e);if(y(t,n),n.isCanceled)return;R(t)}else{const t=w[0]===e?[]:[e];if(y(t,n),n.isCanceled)return;R(t)}}),S=e.useMemo(()=>({value:w,disabled:i,orientation:f}),[w,i,f]),k=e.useMemo(()=>({accordionItemRefs:x,direction:v,disabled:i,handleValueChange:C,hiddenUntilFound:a??!1,keepMounted:l??!1,loopFocus:u,orientation:f,state:S,value:w}),[v,i,C,a,l,u,f,S,w]),E=ae("div",t,{state:S,ref:r,props:[{dir:v,role:"region"},h],stateAttributesMapping:pn});return n.jsx(Kt.Provider,{value:k,children:n.jsx(Bt,{elementsRef:x,children:E})})}),gn={...t};let hn=0;const vn=gn.useId;function bn(t,n){if(void 0!==vn){const e=vn();return t??(n?`${n}-${e}`:e)}return function(t,n="mui"){const[r,o]=e.useState(t),s=t||r;return e.useEffect(()=>{null==r&&(hn+=1,o(`${n}-${hn}`))},[r,n]),s}(t,n)}function yn(e){return bn(e,"base-ui")}const xn=[];function wn(t){e.useEffect(t,xn)}const Rn=null;const Cn=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;const t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let r=0;r<t.length;r+=1)t[r]?.(e)};request(e){const t=this.nextId;this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1;return this.isScheduled||(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(e){const t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}};class Sn{static create(){return new Sn}static request(e){return Cn.request(e)}static cancel(e){return Cn.cancel(e)}currentId=Rn;request(e){this.cancel(),this.currentId=Cn.request(()=>{this.currentId=Rn,e()})}cancel=()=>{this.currentId!==Rn&&(Cn.cancel(this.currentId),this.currentId=Rn)};disposeEffect=()=>this.cancel}function kn(){const e=B(Sn.create).current;return wn(e.disposeEffect),e}function En(e){return null==e?e:"current"in e?e.current:e}let In=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const Mn={[In.startingStyle]:""},Pn={[In.endingStyle]:""},Tn={transitionStatus:e=>"starting"===e?Mn:"ending"===e?Pn:null};function On(e,t=!1,n=!0){const o=kn();return Dt((s,i=null)=>{o.cancel();const a=En(e);if(null==a)return;const l=a,u=()=>{r.flushSync(s)};if("function"!=typeof l.getAnimations||globalThis.BASE_UI_ANIMATIONS_DISABLED)s();else{if(t){const e=In.startingStyle;if(!l.hasAttribute(e))return void o.request(c);const t=new MutationObserver(()=>{l.hasAttribute(e)||(t.disconnect(),c())});return t.observe(l,{attributes:!0,attributeFilter:[e]}),void i?.addEventListener("abort",()=>t.disconnect(),{once:!0})}o.request(c)}function c(){Promise.all(l.getAnimations().map(e=>e.finished)).then(()=>{i?.aborted||u()}).catch(()=>{if(n)return void(i?.aborted||u());const e=l.getAnimations();!i?.aborted&&e.length>0&&e.some(e=>e.pending||"finished"!==e.playState)&&c()})}})}function An(t,n=!1,r=!1){const[o,s]=e.useState(t&&n?"idle":void 0),[i,a]=e.useState(t);return t&&!i&&(a(!0),s("starting")),t||!i||"ending"===o||r||s("ending"),t||i||"ending"!==o||s(void 0),Nt(()=>{if(!t&&i&&"ending"!==o&&r){const e=Sn.request(()=>{s("ending")});return()=>{Sn.cancel(e)}}},[t,i,o,r]),Nt(()=>{if(!t||n)return;const e=Sn.request(()=>{s(void 0)});return()=>{Sn.cancel(e)}},[n,t]),Nt(()=>{if(!t||!n)return;t&&i&&"idle"!==o&&s("starting");const e=Sn.request(()=>{s("idle")});return()=>{Sn.cancel(e)}},[n,t,i,o]),{mounted:i,setMounted:a,transitionStatus:o}}function Dn(t){const{open:n,defaultOpen:r,onOpenChange:o,disabled:s}=t,i=void 0!==n,[a,l]=Tt({controlled:n,default:r,name:"Collapsible",state:"open"}),{mounted:u,setMounted:c,transitionStatus:d}=An(a,!0,!0),[f,p]=e.useState(a),[{height:m,width:g},h]=e.useState({height:void 0,width:void 0}),v=yn(),[b,y]=e.useState(),x=b??v,[w,R]=e.useState(!1),[C,S]=e.useState(!1),k=e.useRef(null),E=e.useRef(null),I=e.useRef(null),M=e.useRef(null),P=On(M,!1),T=Dt(e=>{const t=!a,n=dn(Gt,e.nativeEvent);if(o(t,n),n.isCanceled)return;const r=M.current;"css-animation"===E.current&&null!=r&&r.style.removeProperty("animation-name"),w||C||(null!=E.current&&"css-animation"!==E.current&&!u&&t&&c(!0),"css-animation"===E.current&&(!f&&t&&p(!0),!u&&t&&c(!0))),l(t),"none"===E.current&&u&&!t&&c(!1)});return Nt(()=>{i&&"none"===E.current&&!a&&c(!1)},[i,a,n,c]),e.useMemo(()=>({abortControllerRef:k,animationTypeRef:E,disabled:s,handleTrigger:T,height:m,mounted:u,open:a,panelId:x,panelRef:M,runOnceAnimationsFinish:P,setDimensions:h,setHiddenUntilFound:R,setKeepMounted:S,setMounted:c,setOpen:l,setPanelIdState:y,setVisible:p,transitionDimensionRef:I,transitionStatus:d,visible:f,width:g}),[k,E,s,T,m,u,a,x,M,P,h,R,S,c,l,p,I,d,f,g])}const Fn=e.createContext(void 0);function Vn(){const t=e.useContext(Fn);if(void 0===t)throw new Error(F(15));return t}let Nn=function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e}({});function jn(t={}){const{label:n,metadata:r,textRef:o,indexGuessBehavior:s,index:i}=t,{register:a,unregister:l,subscribeMapChange:u,elementsRef:c,labelsRef:d,nextIndexRef:f}=e.useContext(jt),p=e.useRef(-1),[m,g]=e.useState(i??(s===Nn.GuessFromOrder?()=>{if(-1===p.current){const e=f.current;f.current+=1,p.current=e}return p.current}:-1)),h=e.useRef(null),v=e.useCallback(e=>{if(h.current=e,-1!==m&&null!==e&&(c.current[m]=e,d)){const t=void 0!==n;d.current[m]=t?n:o?.current?.textContent??e.textContent}},[m,c,d,n,o]);return Nt(()=>{if(null!=i)return;const e=h.current;return e?(a(e,r),()=>{l(e)}):void 0},[i,a,l,r]),Nt(()=>{if(null==i)return u(e=>{const t=h.current?e.get(h.current)?.index:null;null!=t&&g(t)})},[i,u,g]),e.useMemo(()=>({ref:v,index:m}),[m,v])}const Bn=e.createContext(void 0);function Hn(){const t=e.useContext(Bn);if(void 0===t)throw new Error(F(9));return t}let zn=((Ln={}).open="data-open",Ln.closed="data-closed",Ln[Ln.startingStyle=In.startingStyle]="startingStyle",Ln[Ln.endingStyle=In.endingStyle]="endingStyle",Ln);var Ln;let Wn=function(e){return e.panelOpen="data-panel-open",e}({});const qn={[zn.open]:""},Kn={[zn.closed]:""},$n={open:e=>e?{[Wn.panelOpen]:""}:null},Un={open:e=>e?qn:Kn};let Gn=function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e}({});const Yn={...Un,index:e=>Number.isInteger(e)?{[Gn.index]:String(e)}:null,...Tn,value:()=>null},Xn=e.forwardRef(function(t,r){const{className:o,disabled:s=!1,onOpenChange:i,render:a,value:l,style:u,...c}=t,{ref:d,index:f}=jn(),p=H(r,d),{disabled:m,handleValueChange:g,state:h,value:v}=$t(),b=yn(),y=l??b,x=s||m,w=e.useMemo(()=>{if(!v)return!1;for(let e=0;e<v.length;e+=1)if(v[e]===y)return!0;return!1},[v,y]),R=Dt((e,t)=>{i?.(e,t),t.isCanceled||g(y,e)}),C=Dn({open:w,onOpenChange:R,disabled:x}),S=e.useMemo(()=>({open:C.open,disabled:C.disabled,hidden:!C.mounted,transitionStatus:C.transitionStatus}),[C.open,C.disabled,C.mounted,C.transitionStatus]),k=e.useMemo(()=>({...C,onOpenChange:R,state:S}),[C,S,R]),E=e.useMemo(()=>({...h,index:f,disabled:x,open:w}),[x,f,w,h]),[I,M]=e.useState(yn()),P=e.useMemo(()=>({open:w,state:E,setTriggerId:M,triggerId:I}),[w,E,M,I]),T=ae("div",t,{state:E,ref:p,props:c,stateAttributesMapping:Yn});return n.jsx(Fn.Provider,{value:k,children:n.jsx(Bn.Provider,{value:P,children:T})})}),_n=e.forwardRef(function(e,t){const{render:n,className:r,style:o,...s}=e,{state:i}=Hn();return ae("h3",e,{state:i,ref:t,props:s,stateAttributesMapping:Yn})});function Jn(e){return null==e||e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled")}const Qn=e.createContext(void 0);function Zn(t=!1){const n=e.useContext(Qn);if(void 0===n&&!t)throw new Error(F(16));return n}function er(t={}){const{disabled:n=!1,focusableWhenDisabled:r,tabIndex:o=0,native:s=!0,composite:i}=t,a=e.useRef(null),l=Zn(!0),u=i??void 0!==l,{props:c}=function(t){const{focusableWhenDisabled:n,disabled:r,composite:o=!1,tabIndex:s=0,isNativeButton:i}=t,a=o&&!1!==n,l=o&&!1===n;return{props:e.useMemo(()=>{const e={onKeyDown(e){r&&n&&"Tab"!==e.key&&e.preventDefault()}};return o||(e.tabIndex=s,!i&&r&&(e.tabIndex=n?s:-1)),(i&&(n||a)||!i&&r)&&(e["aria-disabled"]=r),!i||n&&!l||(e.disabled=r),e},[o,r,n,a,l,i,s])}}({focusableWhenDisabled:r,disabled:n,composite:u,tabIndex:o,isNativeButton:s}),d=e.useCallback(()=>{const e=a.current;tr(e)&&u&&n&&void 0===c.disabled&&e.disabled&&(e.disabled=!1)},[n,c.disabled,u]);Nt(d,[d]);return{getButtonProps:e.useCallback((e={})=>{const{onClick:t,onMouseDown:r,onKeyUp:o,onKeyDown:i,onPointerDown:a,...l}=e;return _({type:s?"button":void 0,onClick(e){n?e.preventDefault():t?.(e)},onMouseDown(e){n||r?.(e)},onKeyDown(e){if(n)return;if(oe(e),i?.(e),e.baseUIHandlerPrevented)return;const r=e.target===e.currentTarget,o=e.currentTarget,a=tr(o),l=!s&&(c=o,Boolean("A"===c?.tagName&&c?.href));var c;const d=r&&(s?a:!l),f="Enter"===e.key,p=" "===e.key,m=o.getAttribute("role"),g=m?.startsWith("menuitem")||"option"===m||"gridcell"===m;if(r&&u&&p){if(e.defaultPrevented&&g)return;return e.preventDefault(),void(l||s&&a?(o.click(),e.preventBaseUIHandler()):d&&(t?.(e),e.preventBaseUIHandler()))}d&&(s||!p&&!f||e.preventDefault(),!s&&f&&t?.(e))},onKeyUp(e){n||(oe(e),o?.(e),e.target===e.currentTarget&&s&&u&&tr(e.currentTarget)&&" "===e.key?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||s||u||" "!==e.key||t?.(e))},onPointerDown(e){n?e.preventDefault():a?.(e)}},s?void 0:{role:"button"},c,l)},[n,c,u,s]),buttonRef:Dt(e=>{a.current=e,d()})}}function tr(e){return i(e)&&"BUTTON"===e.tagName}const nr="undefined"!=typeof navigator,rr=function(){if(!nr)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;if(e?.platform)return{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints};return{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}(),or=function(){if(!nr)return"";const e=navigator.userAgentData;if(e?.platform)return e.platform;return navigator.platform??""}(),sr=function(){if(!nr)return"";const e=navigator.userAgentData;if(e&&Array.isArray(e.brands))return e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(" ");return navigator.userAgent}(),ir=!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter:none"),ar="MacIntel"===rr.platform&&rr.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(rr.platform),lr=nr&&/firefox/i.test(sr),ur=nr&&/apple/i.test(navigator.vendor),cr=nr&&/android/i.test(or)||/android/i.test(sr),dr=nr&&or.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,fr=sr.includes("jsdom/");const pr="data-base-ui-focusable",mr="active",gr="selected",hr="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",vr="ArrowLeft",br="ArrowRight",yr="ArrowUp",xr="ArrowDown";function wr(e){let t=e.activeElement;for(;null!=t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function Rr(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&a(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Cr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Sr(e,t){if(!l(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(Rr(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function kr(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function Er(e){return i(e)&&e.matches(hr)}function Ir(e){return null!=e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${hr}`)}function Mr(e){return!!e&&("combobox"===e.getAttribute("role")&&Er(e))}function Pr(e){if(!e||fr)return!0;try{return e.matches(":focus-visible")}catch(t){return!0}}function Tr(e){return e?e.hasAttribute(pr)?e:e.querySelector(`[${pr}]`)||e:null}function Or(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Or(e,t.id,n)])}function Ar(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){const t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Dr(e){e.preventDefault(),e.stopPropagation()}function Fr(e){return!(""!==e.pointerType||!e.isTrusted)||(cr&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function Vr(e){return!fr&&(!cr&&0===e.width&&0===e.height||cr&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function Nr(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function jr(e){const t=e.type;return"click"===t||"mousedown"===t||"keydown"===t||"keyup"===t}function Br(e,t,n){return Math.floor(e/t)!==n}function Hr(e,t){return t<0||t>=e.length}function zr(e,t){return Wr(e.current,{disabledIndices:t})}function Lr(e,t){return Wr(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Wr(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do{s+=n?-o:o}while(s>=0&&s<=e.length-1&&Gr(e,s,r));return s}function qr(e,{event:t,orientation:n,loopFocus:r,onLoop:o,rtl:s,cols:i,disabledIndices:a,minIndex:l,maxIndex:u,prevIndex:d,stopEvent:f=!1}){let p,m=d;if(t.key===yr?p="up":t.key===xr&&(p="down"),p){const n=[],s=[];let g=!1,h=0;{let t=null,r=-1;e.forEach((e,o)=>{if(null==e)return;h+=1;const i=e.closest('[role="row"]');i&&(g=!0),i===t&&-1!==r||(t=i,r+=1,n[r]=[]),n[r].push(o),s[o]=r})}let v=!1,b=0;if(g)for(const e of n){const t=e.length;t>b&&(b=t),t!==i&&(v=!0)}const y=v&&h<e.length,x=b||i,w=i=>{if(!v||-1===d)return;const l=s[d];if(null==l)return;const u=n[l].indexOf(d),c="up"===i?-1:1;for(let f=l+c,p=0;p<n.length;p+=1,f+=c){if(f<0||f>=n.length){if(!r||y)return;if(f=f<0?n.length-1:0,o){const e=Math.min(u,n[f].length-1),r=n[f][e]??n[f][0],i=o(t,d,r);f=s[i]??f}}const i=n[f];for(let t=Math.min(u,i.length-1);t>=0;t-=1){const n=i[t];if(!Gr(e,n,a))return n}}},R=t=>{if(!y||-1===d)return;const n=d%x,o="up"===t?-x:x,s=u-u%x,i=c(u/x)+1;for(let l=d-n+o,c=0;c<i;c+=1,l+=o){if(l<0||l>u){if(!r)return;l=l<0?s:0}const t=Math.min(l+x-1,u);for(let r=Math.min(l+n,t);r>=l;r-=1)if(!Gr(e,r,a))return r}};f&&Dr(t);const C=w(p)??R(p);if(void 0!==C)m=C;else if(-1===d)m="up"===p?u:l;else if(m=Wr(e,{startingIndex:d,amount:x,decrement:"up"===p,disabledIndices:a}),r){if("up"===p&&(d-x<l||m<0)){const e=d%x,n=u%x,r=u-(n-e);m=n===e?u:n>e?r:r-x,o&&(m=o(t,d,m))}"down"===p&&d+x>u&&(m=Wr(e,{startingIndex:d%x-x,amount:x,disabledIndices:a}),o&&(m=o(t,d,m)))}Hr(e,m)&&(m=d)}if("both"===n){const n=c(d/i);t.key===(s?vr:br)&&(f&&Dr(t),d%i!==i-1?(m=Wr(e,{startingIndex:d,disabledIndices:a}),r&&Br(m,i,n)&&(m=Wr(e,{startingIndex:d-d%i-1,disabledIndices:a}),o&&(m=o(t,d,m)))):r&&(m=Wr(e,{startingIndex:d-d%i-1,disabledIndices:a}),o&&(m=o(t,d,m))),Br(m,i,n)&&(m=d)),t.key===(s?br:vr)&&(f&&Dr(t),d%i!==0?(m=Wr(e,{startingIndex:d,decrement:!0,disabledIndices:a}),r&&Br(m,i,n)&&(m=Wr(e,{startingIndex:d+(i-d%i),decrement:!0,disabledIndices:a}),o&&(m=o(t,d,m)))):r&&(m=Wr(e,{startingIndex:d+(i-d%i),decrement:!0,disabledIndices:a}),o&&(m=o(t,d,m))),Br(m,i,n)&&(m=d));const l=c(u/i)===n;Hr(e,m)&&(r&&l?(m=t.key===(s?br:vr)?u:Wr(e,{startingIndex:d-d%i-1,disabledIndices:a}),o&&(m=o(t,d,m))):m=d)}return m}function Kr(e,t,n){const r=[];let o=0;return e.forEach(({width:e,height:s},i)=>{let a=!1;for(n&&(o=0);!a;){const n=[];for(let r=0;r<e;r+=1)for(let e=0;e<s;e+=1)n.push(o+r+e*t);o%t+e<=t&&n.every(e=>null==r[e])?(n.forEach(e=>{r[e]=i}),a=!0):o+=1}}),[...r]}function $r(e,t,n,r,o){if(-1===e)return-1;const s=n.indexOf(e),i=t[e];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function Ur(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Gr(e,t,n){if("function"==typeof n?n(t):n?.includes(t)??!1)return!0;const r=e[t];return!!r&&(!Yr(r)||!n&&(r.hasAttribute("disabled")||"true"===r.getAttribute("aria-disabled")))}function Yr(e,t=(e?u(e):null)){return!(!(e&&e.isConnected&&t)||function(e){return"hidden"===e.visibility||"collapse"===e.visibility}(t))&&("function"==typeof e.checkVisibility?e.checkVisibility():"none"!==t.display&&"contents"!==t.display)}function Xr(e){return e?.ownerDocument||document}function _r(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return a(n)?n.host:null}function Jr(e){for(const t of Array.from(e.children))if("summary"===d(t))return t;return null}function Qr(e,t){const n=Jr(t);return!!n&&(e===n||Rr(n,e))}function Zr(e){const t=e?d(e):"";return null!=e&&e.matches('a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]')&&("summary"!==t||null!=e.parentElement&&"details"===d(e.parentElement)&&Jr(e.parentElement)===e)&&("details"!==t||null==Jr(e))&&("input"!==t||"hidden"!==e.type)}function eo(e){if(!Zr(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=_r(t)){const n=t!==e,r="slot"===d(t);if(t.hasAttribute("inert"))return!1;if(n&&"details"===d(t)&&!t.open&&!Qr(e,t)||t.hasAttribute("hidden")||!r&&!to(t,n))return!1}return!0}function to(e,t){const n=u(e);return t?"none"!==n.display:Yr(e,n)}function no(e){const t=e.tabIndex;if(t<0){const t=d(e);if("details"===t||"audio"===t||"video"===t||i(e)&&e.isContentEditable)return 0}return t}function ro(e){if("input"!==d(e))return null;const t=e;return"radio"===t.type&&""!==t.name?t:null}function oo(e){if(i(e)&&"slot"===d(e)){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return i(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function so(e,t){oo(e).forEach(e=>{Zr(e)&&t.push(e),so(e,t)})}function io(e,t,n){oo(e).forEach(e=>{i(e)&&e.matches(t)&&n.push(e),io(e,t,n)})}function ao(e){return eo(e)&&no(e)>=0}function lo(e){const t=[];return so(e,t),t.filter(eo)}function uo(e){const t=lo(e);return t.filter(e=>no(e)>=0&&function(e,t){const n=ro(e);if(!n)return!0;const r=t.find(e=>{const t=ro(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{const t=ro(e);return t?.name===n.name&&t.form===n.form})===n}(e,t))}function co(e,t){const n=uo(e),r=n.length;if(0===r)return;const o=wr(Xr(e)),s=n.indexOf(o);return n[-1===s?1===t?0:r-1:s+t]}function fo(e){return co(Xr(e).body,1)||e}function po(e){return co(Xr(e).body,-1)||e}function mo(e,t){if(!e)return null;const n=uo(Xr(e).body),r=n.length;if(0===r)return null;const o=n.indexOf(e);if(-1===o)return null;return n[(o+t+r)%r]}function go(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Rr(n,r)}function ho(e){const t=[];io(e,"[data-tabindex]",t),t.forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}const vo="ArrowUp",bo="ArrowDown",yo="ArrowLeft",xo="ArrowRight",wo="Home",Ro="End",Co="PageUp",So="PageDown",ko=new Set([yo,xo]),Eo=new Set([yo,xo,wo,Ro]),Io=new Set([vo,bo]),Mo=new Set([vo,bo,wo,Ro]),Po=new Set([...ko,...Io]),To=new Set([...Po,wo,Ro]),Oo=new Set([vo,bo,yo,xo,wo,Ro]),Ao="Shift",Do=new Set([Ao,"Control","Alt","Meta"]);function Fo(e){return!(!function(e){return i(e)&&"INPUT"===e.tagName}(e)||null==e.selectionStart)||!(!i(e)||"TEXTAREA"!==e.tagName)}function Vo(e,t,n,r){if(!e||!t||!t.scrollTo)return;let o=e.scrollLeft,s=e.scrollTop;const i=e.clientWidth<e.scrollWidth,a=e.clientHeight<e.scrollHeight;if(i&&"vertical"!==r){const r=No(e,t,"left"),s=jo(e),i=jo(t);"ltr"===n&&(r+t.offsetWidth+i.scrollMarginRight>e.scrollLeft+e.clientWidth-s.scrollPaddingRight?o=r+t.offsetWidth+i.scrollMarginRight-e.clientWidth+s.scrollPaddingRight:r-i.scrollMarginLeft<e.scrollLeft+s.scrollPaddingLeft&&(o=r-i.scrollMarginLeft-s.scrollPaddingLeft)),"rtl"===n&&(r-i.scrollMarginRight<e.scrollLeft+s.scrollPaddingLeft?o=r-i.scrollMarginLeft-s.scrollPaddingLeft:r+t.offsetWidth+i.scrollMarginRight>e.scrollLeft+e.clientWidth-s.scrollPaddingRight&&(o=r+t.offsetWidth+i.scrollMarginRight-e.clientWidth+s.scrollPaddingRight))}if(a&&"horizontal"!==r){const n=No(e,t,"top"),r=jo(e),o=jo(t);n-o.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?s=n-o.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+o.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(s=n+t.offsetHeight+o.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:o,top:s,behavior:"auto"})}function No(e,t,n){const r="left"===n?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);)t=t.offsetParent;return o}function jo(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const Bo=new Set([bo,vo,xo,yo,wo,Ro]);const Ho=e.forwardRef(function(t,n){const{disabled:r,className:o,id:s,render:i,nativeButton:a=!0,style:l,...u}=t,{panelId:c,open:d,handleTrigger:f,disabled:p}=Vn(),m=r??p,{getButtonProps:g,buttonRef:h}=er({disabled:m,focusableWhenDisabled:!0,native:a,composite:!0}),{accordionItemRefs:v,direction:b,loopFocus:y,orientation:x}=$t(),w="rtl"===b,R="horizontal"===x,{state:C,setTriggerId:S,triggerId:k}=Hn();Nt(()=>(s&&S(s),()=>{S(void 0)}),[s,S]);return ae("button",t,{state:C,ref:[n,h],props:[e.useMemo(()=>({"aria-controls":d?c:void 0,"aria-expanded":d,id:k,tabIndex:0,onClick:f,onKeyDown(e){if(!Bo.has(e.key))return;Dr(e);const t=function(e){const{current:t}=e,n=[];for(let r=0;r<t.length;r+=1){const e=t[r];if(!Jn(e)){const t=e?.querySelector('[type="button"], [role="button"]');t&&!Jn(t)&&n.push(t)}}return n}(v),n=t.length-1;let r=-1;const o=t.indexOf(e.currentTarget);function s(){r=y?o+1>n?0:o+1:Math.min(o+1,n)}function i(){r=y&&0===o?n:o-1}switch(e.key){case bo:R||s();break;case vo:R||i();break;case xo:R&&(w?i():s());break;case yo:R&&(w?s():i());break;case"Home":r=0;break;case"End":r=n}r>-1&&t[r].focus()}}),[v,f,k,R,w,y,d,c]),u,g],stateAttributesMapping:$n})});function zo(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}let Lo=function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e}({});function Wo(t){const{abortControllerRef:n,animationTypeRef:r,externalRef:o,height:s,hiddenUntilFound:i,keepMounted:a,id:l,mounted:u,onOpenChange:c,open:d,panelRef:f,runOnceAnimationsFinish:p,setDimensions:m,setMounted:g,setOpen:h,setVisible:v,transitionDimensionRef:b,visible:y,width:x}=t,w=e.useRef(!1),R=e.useRef(null),C=e.useRef(d),S=e.useRef(d),k=kn(),E=e.useMemo(()=>"css-animation"===r.current?!y:!d&&!u,[d,u,y,r]),I=Dt(e=>{if(!e)return;if(null==r.current||null==b.current){const t=getComputedStyle(e),n="none"!==t.animationName&&""!==t.animationName,o="0s"!==t.transitionDuration&&""!==t.transitionDuration;n&&o||("none"===t.animationName&&"0s"!==t.transitionDuration?r.current="css-transition":"none"!==t.animationName&&"0s"===t.transitionDuration?r.current="css-animation":r.current="none"),"horizontal"===e.getAttribute(Lo.orientation)||t.transitionProperty.indexOf("width")>-1?b.current="width":b.current="height"}if("css-transition"!==r.current)return;void 0!==s&&void 0!==x||(m({height:e.scrollHeight,width:e.scrollWidth}),S.current&&e.style.setProperty("transition-duration","0s"));let t=-1,n=-1;return t=Sn.request(()=>{S.current=!1,n=Sn.request(()=>{setTimeout(()=>{e.style.removeProperty("transition-duration")})})}),()=>{Sn.cancel(t),Sn.cancel(n)}}),M=H(o,f,I);return Nt(()=>{if("css-transition"!==r.current)return;const e=f.current;if(!e)return;let t=-1;if(null!=n.current&&(n.current.abort(),n.current=null),!d){if(0===e.scrollHeight&&0===e.scrollWidth)return;m({height:e.scrollHeight,width:e.scrollWidth});const t=new AbortController;n.current=t;const r=t.signal;let o=null;const s=zn.endingStyle;return o=new MutationObserver(i=>{i.some(e=>"attributes"===e.type&&e.attributeName===s)&&(o?.disconnect(),o=null,p(()=>{m({height:0,width:0}),e.style.removeProperty("content-visibility"),g(!1),n.current===t&&(n.current=null)},r))}),o.observe(e,{attributes:!0,attributeFilter:[s]}),()=>{o?.disconnect(),k.cancel(),n.current===t&&(t.abort(),n.current=null)}}{const n={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(n).forEach(t=>{e.style.setProperty(t,"initial","important")}),S.current||a||e.setAttribute(zn.startingStyle,""),m({height:e.scrollHeight,width:e.scrollWidth}),t=Sn.request(()=>{Object.entries(n).forEach(([t,n])=>{""===n?e.style.removeProperty(t):e.style.setProperty(t,n)})})}return()=>{Sn.cancel(t)}},[n,r,k,i,a,u,d,f,p,m,g]),Nt(()=>{if("css-animation"!==r.current)return;const e=f.current;e&&(R.current=e.style.animationName||R.current,e.style.setProperty("animation-name","none"),m({height:e.scrollHeight,width:e.scrollWidth}),C.current||w.current||e.style.removeProperty("animation-name"),d?(null!=n.current&&(n.current.abort(),n.current=null),g(!0),v(!0)):(n.current=new AbortController,p(()=>{g(!1),v(!1),n.current=null},n.current.signal)))},[n,r,d,f,p,m,g,v,y]),wn(()=>{const e=Sn.request(()=>{C.current=!1});return()=>Sn.cancel(e)}),Nt(()=>{if(!i)return;const e=f.current;if(!e)return;let t=-1,n=-1;return d&&w.current&&(e.style.transitionDuration="0s",m({height:e.scrollHeight,width:e.scrollWidth}),t=Sn.request(()=>{w.current=!1,n=Sn.request(()=>{setTimeout(()=>{e.style.removeProperty("transition-duration")})})})),()=>{Sn.cancel(t),Sn.cancel(n)}},[i,d,f,m]),Nt(()=>{const e=f.current;e&&i&&E&&(e.setAttribute("hidden","until-found"),"css-transition"===r.current&&e.setAttribute(zn.startingStyle,""))},[i,E,r,f]),e.useEffect(function(){const e=f.current;if(e)return zo(e,"beforematch",function(e){w.current=!0,h(!0),c(!0,dn(Ut,e))})},[c,f,h]),e.useMemo(()=>({props:{hidden:E,id:l,ref:M}}),[E,l,M])}let qo=function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e}({});function Ko(t){const{enabled:n=!0,open:r,ref:o,onComplete:s}=t,i=Dt(s),a=On(o,r,!1);e.useEffect(()=>{if(!n)return;const e=new AbortController;return a(i,e.signal),()=>{e.abort()}},[n,r,i,a])}const $o=e.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,id:i,render:a,style:l,...u}=t,{hiddenUntilFound:c,keepMounted:d}=$t(),{abortControllerRef:f,animationTypeRef:p,height:m,mounted:g,onOpenChange:h,open:v,panelId:b,panelRef:y,runOnceAnimationsFinish:x,setDimensions:w,setHiddenUntilFound:R,setKeepMounted:C,setMounted:S,setOpen:k,setVisible:E,transitionDimensionRef:I,visible:M,width:P,setPanelIdState:T,transitionStatus:O}=Vn(),A=o??c,D=s??d;Nt(()=>{if(i)return T(i),()=>{T(void 0)}},[i,T]),Nt(()=>{R(A)},[R,A]),Nt(()=>{C(D)},[C,D]),Ko({open:v&&"idle"===O,ref:y,onComplete(){v&&w({width:void 0,height:void 0})}});const{props:F}=Wo({abortControllerRef:f,animationTypeRef:p,externalRef:n,height:m,hiddenUntilFound:A,id:i??b,keepMounted:D,mounted:g,onOpenChange:h,open:v,panelRef:y,runOnceAnimationsFinish:x,setDimensions:w,setMounted:S,setOpen:k,setVisible:E,transitionDimensionRef:I,visible:M,width:P}),{state:V,triggerId:N}=Hn(),j=ae("div",t,{state:e.useMemo(()=>({...V,transitionStatus:O}),[V,O]),ref:[n,y],props:[F,{"aria-labelledby":N,role:"region",style:{[qo.accordionPanelHeight]:void 0===m?"auto":`${m}px`,[qo.accordionPanelWidth]:void 0===P?"auto":`${P}px`}},u],stateAttributesMapping:Yn});return D||A||g?j:null}),Uo=[];let Go;function Yo(e){const t=(t,n)=>{const r=B(_o).current;let o;try{Go=r;for(const e of Uo)e.before(r);o=e(t,n);for(const e of Uo)e.after(r);r.didInitialize=!0}finally{Go=void 0}return o};return t.displayName=e.displayName||e.name,t}function Xo(t){return e.forwardRef(Yo(t))}function _o(){return{didInitialize:!1}}function Jo(t){const n=e.useRef(!0);n.current&&(n.current=!1,t())}const Qo=e.createContext(void 0);function Zo(t){const n=e.useContext(Qo);if(void 0===n&&!t)throw new Error(F(72));return n}class es{static create(){return new es}currentId=0;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=0,t()},e)}isStarted(){return 0!==this.currentId}clear=()=>{0!==this.currentId&&(clearTimeout(this.currentId),this.currentId=0)};disposeEffect=()=>this.clear}function ts(){const e=B(es.create).current;return wn(e.disposeEffect),e}function ns(e,t,n){const r=function(e,t){return null==t||Nr(t)?"function"==typeof e?e():e:0}(e,n);return"number"==typeof r?r:r?.[t]}function rs(e){return"function"==typeof e?e():e}function os(e,t){return t||"click"===e||"mousedown"===e}const ss=e.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new es,currentIdRef:{current:null},currentContextRef:{current:null}});function is(t){const{children:r,delay:o,timeoutMs:s=0}=t,i=e.useRef(o),a=e.useRef(o),l=e.useRef(null),u=e.useRef(null),c=ts();return n.jsx(ss.Provider,{value:e.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:l,timeoutMs:s,currentContextRef:u,timeout:c}),[s,c]),children:r})}function as(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function ls(e){const t=B(us,e).current;return t.next=e,Nt(t.effect),t}function us(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const cs={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},ds={...cs,position:"fixed",top:0,left:0},fs={...cs,position:"absolute"},ps=e.forwardRef(function(t,r){const[o,s]=e.useState();Nt(()=>{ur&&s("button")},[]);const i={tabIndex:0,role:o};return n.jsx("span",{...t,ref:r,style:ds,"aria-hidden":!o||void 0,...i,"data-base-ui-focus-guard":""})});function ms(e){return`data-base-ui-${e}`}let gs=0;function hs(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(gs);const s=()=>e?.focus({preventScroll:n});if(o)return s(),U;const i=requestAnimationFrame(s);return gs=i,()=>{gs===i&&(cancelAnimationFrame(i),gs=0)}}const vs={inert:new WeakMap,"aria-hidden":new WeakMap},bs="data-base-ui-inert",ys={inert:new WeakSet,"aria-hidden":new WeakSet};let xs=new WeakMap,ws=0;function Rs(e){return e?a(e)?e.host:Rs(e.parentNode):null}const Cs=(e,t)=>t.map(t=>{if(e.contains(t))return t;const n=Rs(t);return e.contains(n)?n:null}).filter(e=>null!=e),Ss=e=>{const t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},ks=(e,t,n)=>{const r=[],o=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{"script"!==d(e)&&(t.has(e)?o(e):r.push(e))})};return o(e),r};function Es(e,t,n,r,{mark:o=!0,markerIgnoreElements:s=[]}){const i=r?"inert":n?"aria-hidden":null;let a=null,l=null;const u=Cs(t,e),c=o?Cs(t,s):[],d=new Set(c),f=o?ks(t,Ss(u),new Set(u)).filter(e=>!d.has(e)):[],p=[],m=[];if(i){const e=vs[i],n=function(e){return ys[e]}(i);l=n,a=e;const r=Cs(t,Array.from(t.querySelectorAll("[aria-live]"))),o=u.concat(r);ks(t,Ss(o),new Set(o)).forEach(t=>{const r=t.getAttribute(i),o=null!==r&&"false"!==r,s=(e.get(t)||0)+1;e.set(t,s),p.push(t),1===s&&o&&n.add(t),o||t.setAttribute(i,"inert"===i?"":"true")})}return o&&f.forEach(e=>{const t=(xs.get(e)||0)+1;xs.set(e,t),m.push(e),1===t&&e.setAttribute(bs,"")}),ws+=1,()=>{a&&p.forEach(e=>{const t=(a.get(e)||0)-1;a.set(e,t),t||(!l?.has(e)&&i&&e.removeAttribute(i),l?.delete(e))}),o&&m.forEach(e=>{const t=(xs.get(e)||0)-1;xs.set(e,t),t||e.removeAttribute(bs)}),ws-=1,ws||(vs.inert=new WeakMap,vs["aria-hidden"]=new WeakMap,ys.inert=new WeakSet,ys["aria-hidden"]=new WeakSet,xs=new WeakMap)}}function Is(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0,markerIgnoreElements:s=[]}=t;return Es(e,Xr(e[0]).body,n,r,{mark:o,markerIgnoreElements:s})}const Ms={style:{transition:"none"}},Ps="data-base-ui-click-trigger",Ts={fallbackAxisSide:"none"},Os={fallbackAxisSide:"end"},As={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Ds=e.createContext(null),Fs=()=>e.useContext(Ds),Vs=ms("portal");function Ns(t={}){const{ref:n,container:o,componentProps:s=Y,elementProps:i}=t,a=bn(),l=Fs(),u=l?.portalNode,[c,d]=e.useState(null),[p,m]=e.useState(null),g=Dt(e=>{null!==e&&m(e)}),h=e.useRef(null);Nt(()=>{if(null===o)return void(h.current&&(h.current=null,m(null),d(null)));if(null==a)return;const e=(o&&(f(o)?o:o.current))??u??document.body;null!=e?h.current!==e&&(h.current=e,m(null),d(e)):h.current&&(h.current=null,m(null),d(null))},[o,u,a]);const v=ae("div",s,{ref:[n,g],props:[{id:a,[Vs]:""},i]});return{portalNode:p,portalSubtree:c&&v?r.createPortal(v,c):null}}const js=e.forwardRef(function(t,o){const{children:s,container:i,className:a,render:l,renderGuards:u,style:c,...d}=t,{portalNode:f,portalSubtree:p}=Ns({container:i,ref:o,componentProps:t,elementProps:d}),m=e.useRef(null),g=e.useRef(null),h=e.useRef(null),v=e.useRef(null),[b,y]=e.useState(null),x=e.useRef(!1),w=b?.modal,R=b?.open,C="boolean"==typeof u?u:!!b&&!b.modal&&b.open&&!!f;e.useEffect(()=>{if(f&&!w)return as(zo(f,"focusin",e,!0),zo(f,"focusout",e,!0));function e(e){f&&e.relatedTarget&&go(e)&&("focusin"===e.type?x.current&&(ho(f),x.current=!1):(!function(e){uo(e).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}(f),x.current=!0))}},[f,w]),e.useEffect(()=>{f&&!1===R&&(ho(f),x.current=!1)},[R,f]);const S=e.useMemo(()=>({beforeOutsideRef:m,afterOutsideRef:g,beforeInsideRef:h,afterInsideRef:v,portalNode:f,setFocusManagerState:y}),[f]);return n.jsxs(e.Fragment,{children:[p,n.jsxs(Ds.Provider,{value:S,children:[C&&f&&n.jsx(ps,{"data-type":"outside",ref:m,onFocus:e=>{if(go(e,f))h.current?.focus();else{const e=po(b?b.domReference:null);e?.focus()}}}),C&&f&&n.jsx("span",{"aria-owns":f.id,style:As}),f&&r.createPortal(s,f),C&&f&&n.jsx(ps,{"data-type":"outside",ref:g,onFocus:e=>{if(go(e,f))v.current?.focus();else{const t=fo(b?b.domReference:null);t?.focus(),b?.closeOnFocusOut&&b?.onOpenChange(!1,dn(on,e.nativeEvent))}}})]})]})});function Bs(){const 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)}}}class Hs{nodesRef={current:[]};events=Bs();addNode(e){this.nodesRef.current.push(e)}removeNode(e){const t=this.nodesRef.current.findIndex(t=>t===e);-1!==t&&this.nodesRef.current.splice(t,1)}}const zs=e.createContext(null),Ls=e.createContext(null),Ws=()=>e.useContext(zs)?.id||null,qs=t=>{const n=e.useContext(Ls);return t??n};function Ks(e){const t=bn(),n=qs(e),r=Ws();return Nt(()=>{if(!t)return;const e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function $s(t){const{children:r,id:o}=t,s=Ws();return n.jsx(zs.Provider,{value:e.useMemo(()=>({id:o,parentId:s}),[o,s]),children:r})}function Us(e){const{children:t,externalTree:r}=e,o=B(()=>r??new Hs).current;return n.jsx(Ls.Provider,{value:o,children:t})}let Gs=[];function Ys(){Gs=Gs.filter(e=>e.deref()?.isConnected)}function Xs(){return Ys(),Gs[Gs.length-1]?.deref()}function _s(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex"))return;if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=lo(e).filter(e=>{const t=e.getAttribute("data-tabindex")||"";return ao(e)||e.hasAttribute("data-tabindex")&&!t.startsWith("-")}),r=e.getAttribute("tabindex");t.current.includes("floating")||0===n.length?"0"!==r&&e.setAttribute("tabindex","0"):("-1"!==r||e.hasAttribute("data-tabindex")&&"-1"!==e.getAttribute("data-tabindex"))&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Js(t){const{context:r,children:o,disabled:s=!1,initialFocus:a=!0,returnFocus:l=!0,restoreFocus:u=!1,modal:c=!0,closeOnFocusOut:f=!0,openInteractionType:m="",nextFocusableElement:g,previousFocusableElement:h,beforeContentFocusGuardRef:v,externalTree:b,getInsideElements:y}=t,x="rootStore"in r?r.rootStore:r,w=x.useState("open"),R=x.useState("domReferenceElement"),C=x.useState("floatingElement"),{events:S,dataRef:k}=x.context,E=Dt(()=>k.current.floatingContext?.nodeId),I=!1===a,M=Mr(R)&&I,P=e.useRef(["content"]),T=ls(a),O=ls(l),A=ls(m),D=qs(b),F=Fs(),V=e.useRef(!1),N=e.useRef(!1),j=e.useRef(!1),B=e.useRef(null),z=e.useRef(""),L=e.useRef(""),W=e.useRef(null),q=e.useRef(null),K=H(W,v,F?.beforeInsideRef),$=H(q,F?.afterInsideRef),U=ts(),G=ts(),Y=kn(),X=null!=F,_=Tr(C),J=Dt((e=_)=>e?uo(e):[]),Q=Dt(()=>y?.().filter(e=>null!=e)??[]);e.useEffect(()=>{if(s||!c)return;return zo(Xr(_),"keydown",function(e){"Tab"===e.key&&Rr(_,wr(Xr(_)))&&0===J().length&&!M&&Dr(e)})},[s,R,_,c,P,M,J]),e.useEffect(()=>{if(s||!w)return;const e=Xr(_);function t(){j.current=!1}return as(zo(e,"pointerdown",function(e){const t=Cr(e),n=Q(),r=Rr(C,t)||Rr(R,t)||Rr(F?.portalNode,t)||n.some(e=>e===t||Rr(e,t));j.current=!r,L.current=e.pointerType||"keyboard",t?.closest(`[${Ps}]`)&&(N.current=!0)},!0),zo(e,"pointerup",t,!0),zo(e,"pointercancel",t,!0),zo(e,"keydown",function(){L.current="keyboard"},!0))},[s,C,R,_,w,F,Q]),e.useEffect(()=>{if(s||!f)return;const e=Xr(_);function t(t){const n=t.relatedTarget,r=t.currentTarget,o=Cr(t);queueMicrotask(()=>{const s=E(),a=x.context.triggerElements,l=Q(),d=n?.hasAttribute(ms("focus-guard"))&&[W.current,q.current,F?.beforeInsideRef.current,F?.afterInsideRef.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,En(h),En(g)].includes(n),f=!(Rr(R,n)||Rr(C,n)||Rr(n,C)||Rr(F?.portalNode,n)||l.some(e=>e===n||Rr(e,n))||null!=n&&a.hasElement(n)||a.hasMatchingElement(e=>Rr(e,n))||d||D&&(Or(D.nodesRef.current,s).find(e=>Rr(e.context?.elements.floating,n)||Rr(e.context?.elements.domReference,n))||Ar(D.nodesRef.current,s).find(e=>[e.context?.elements.floating,Tr(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===R&&_&&_s(_,P),u&&r!==R&&!Yr(o)&&wr(e)===e.body){if(i(_)&&(_.focus(),"popup"===u))return void Y.request(()=>{_.focus()});const e=J(),t=B.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||_;i(n)&&n.focus()}k.current.insideReactTree?k.current.insideReactTree=!1:!M&&c||!n||!f||N.current||!M&&n===Xs()||(V.current=!0,x.setOpen(!1,dn(on,t)))})}const n=i(R)?R:null;return C||n?as(n&&zo(n,"focusout",t),n&&zo(n,"pointerdown",function(){N.current=!0,G.start(0,()=>{N.current=!1})}),C&&zo(C,"focusin",function(e){const t=Cr(e);ao(t)&&(B.current=t)}),C&&zo(C,"focusout",t),C&&F&&zo(C,"focusout",function(){j.current||(k.current.insideReactTree=!0,U.start(0,()=>{k.current.insideReactTree=!1}))},!0)):void 0},[s,R,C,_,c,D,F,x,f,u,J,M,E,P,k,U,G,Y,g,h,Q]),e.useEffect(()=>{if(s||!C||!w)return;const e=Array.from(F?.portalNode?.querySelectorAll(`[${ms("portal")}]`)||[]),t=D?Ar(D.nodesRef.current,E()):[],n=t.find(e=>Mr(e.context?.elements.domReference||null))?.context?.elements.domReference,r=Is([...[C,...e,W.current,q.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,...Q()],n,En(h),En(g),M?R:null].filter(e=>null!=e),{ariaHidden:c||M,mark:!1}),o=Is([C,...e].filter(e=>null!=e));return()=>{o(),r()}},[w,s,R,C,c,P,F,M,D,E,g,h,Q]),Nt(()=>{if(!w||s||!i(_))return;const e=wr(Xr(_));queueMicrotask(()=>{const t=T.current,n="function"==typeof t?t(A.current||""):t;if(void 0===n||!1===n)return;if(Rr(_,e))return;let r=null;const o=()=>(null==r&&(r=J(_)),r[0]||_);let s;s=!0===n||null===n?o():En(n),s=s||o(),hs(s,{preventScroll:s===_})})},[s,w,_,I,J,T,A]),Nt(()=>{if(s||!_)return;const e=Xr(_),t=wr(e);var n;function r(e){if(e.open||(z.current=function(e,t){const n=p(Cr(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(0===e.detail?"keyboard":"mouse"):""}(e.nativeEvent,L.current)),e.reason===Yt&&"mouseleave"===e.nativeEvent.type&&(V.current=!0),e.reason===_t)if(e.nested)V.current=!1;else if(Fr(e.nativeEvent)||Vr(e.nativeEvent))V.current=!1;else{let e=!1;Xr(_).createElement("div").focus({get preventScroll(){return e=!0,!1}}),V.current=!e}}return n=t,Ys(),n&&"body"!==d(n)&&(Gs.push(new WeakRef(n)),Gs.length>20&&(Gs=Gs.slice(-20))),S.on("openchange",r),()=>{S.off("openchange",r);const t=wr(e),n=Q(),o=Rr(C,t)||n.some(e=>e===t||Rr(e,t))||D&&Or(D.nodesRef.current,E(),!1).some(e=>Rr(e.context?.elements.floating,t)),s=O.current,a=function(){const e=O.current;let t="function"==typeof e?e(z.current):e;if(void 0===t||!1===t)return null;if(null===t&&(t=!0),"boolean"==typeof t){const e=R||Xs();return e&&e.isConnected?e:null}const n=R||Xs();return En(t)||n||null}();queueMicrotask(()=>{const n=(r=a)?ao(r)?r:uo(r)[0]||r:null;var r;const l="boolean"!=typeof s;s&&!V.current&&i(n)&&(l||n===t||t===e.body||o)&&n.focus({preventScroll:!0}),V.current=!1})}},[s,C,_,O,k,S,D,R,E,Q]),Nt(()=>{if(!ir||w||!C)return;const e=wr(Xr(C));i(e)&&Er(e)&&Rr(C,e)&&e.blur()},[w,C]),Nt(()=>{if(!s&&F)return F.setFocusManagerState({modal:c,closeOnFocusOut:f,open:w,onOpenChange:x.setOpen,domReference:R}),()=>{F.setFocusManagerState(null)}},[s,F,c,w,x,f,R]),Nt(()=>{if(!s&&_)return _s(_,P),()=>{queueMicrotask(Ys)}},[s,_,P]);const Z=!s&&(!c||!M)&&(X||c);return n.jsxs(e.Fragment,{children:[Z&&n.jsx(ps,{"data-type":"inside",ref:K,onFocus:e=>{if(c){const e=J();hs(e[e.length-1])}else if(F?.portalNode)if(V.current=!1,go(e,F.portalNode)){const e=fo(R);e?.focus()}else En(h??F.beforeOutsideRef)?.focus()}}),o,Z&&n.jsx(ps,{"data-type":"inside",ref:$,onFocus:e=>{if(c)hs(J()[0]);else if(F?.portalNode)if(f&&(V.current=!0),go(e,F.portalNode)){const e=po(R);e?.focus()}else En(g??F.afterOutsideRef)?.focus()}})]})}function Qs(t,n={}){const r="rootStore"in t?t.rootStore:t,o=r.context.dataRef,{enabled:s=!0,event:i="click",toggle:a=!0,ignoreMouse:l=!1,stickIfOpen:u=!0,touchOpenDelay:c=0,reason:d=Gt}=n,f=e.useRef(void 0),p=kn(),m=ts(),g=e.useMemo(()=>({onPointerDown(e){f.current=e.pointerType},onMouseDown(e){const t=f.current,n=e.nativeEvent,s=r.select("open");if(0!==e.button||"click"===i||Nr(t,!0)&&l)return;const g=o.current.openEvent,h=g?.type,v=r.select("domReferenceElement")!==e.currentTarget,b=s&&v||!(s&&a&&(!g||!u||("click"===h||"mousedown"===h))),y=Cr(n);if(Er(y)){const e=dn(d,n,y);return void(b&&"touch"===t&&c>0?m.start(c,()=>{r.setOpen(!0,e)}):r.setOpen(b,e))}const x=e.currentTarget;p.request(()=>{const e=dn(d,n,x);b&&"touch"===t&&c>0?m.start(c,()=>{r.setOpen(!0,e)}):r.setOpen(b,e)})},onClick(e){if("mousedown-only"===i)return;const t=f.current;if("mousedown"===i&&t)return void(f.current=void 0);if(Nr(t,!0)&&l)return;const n=r.select("open"),s=o.current.openEvent,p=r.select("domReferenceElement")!==e.currentTarget,g=n&&p||!(n&&a&&(!s||!u||jr(s))),h=dn(d,e.nativeEvent,e.currentTarget);g&&"touch"===t&&c>0?m.start(c,()=>{r.setOpen(!0,h)}):r.setOpen(g,h)},onKeyDown(){f.current=void 0}}),[o,i,l,r,u,a,p,m,c,d]);return e.useMemo(()=>s?{reference:g}:Y,[s,g])}function Zs(e){return null!=e&&null!=e.clientX}const ei={intentional:"onClick",sloppy:"onPointerDown"};function ti(){return!1}function ni(t,n={}){const r="rootStore"in t?t.rootStore:t,o=r.useState("open"),s=r.useState("floatingElement"),{dataRef:c}=r.context,{enabled:d=!0,escapeKey:f=!0,outsidePress:p=!0,outsidePressEvent:v="sloppy",referencePress:b=ti,referencePressEvent:y="sloppy",bubbles:x,externalTree:w}=n,R=qs(w),C=Dt("function"==typeof p?p:()=>!1),S="function"==typeof p?C:p,k=!1!==S,E=Dt(()=>v),I=e.useRef(!1),M=e.useRef(!1),P=e.useRef(!1),{escapeKey:T,outsidePress:O}={escapeKey:"boolean"==typeof(A=x)?A:A?.escapeKey??!1,outsidePress:"boolean"==typeof A?A:A?.outsidePress??!0};var A;const D=e.useRef(null),F=ts(),V=ts(),N=Dt(()=>{V.clear(),c.current.insideReactTree=!1}),j=e.useRef(!1),B=e.useRef(""),H=Dt(b),z=Dt(e=>{if(!o||!d||!f||"Escape"!==e.key)return;if(j.current)return;const t=c.current.floatingContext?.nodeId,n=R?Or(R.nodesRef.current,t):[];if(!T&&n.length>0){let e=!0;if(n.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}const s=function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,i=dn(sn,s);r.setOpen(!1,i),T||i.isPropagationAllowed||e.stopPropagation()}),L=Dt(()=>{c.current.insideReactTree=!0,V.start(0,N)});e.useEffect(()=>{if(!o||!d)return;c.current.__escapeKeyBubbles=T,c.current.__outsidePressBubbles=O;const e=new es,t=new es;function n(){P.current=!0,t.start(0,()=>{P.current=!1})}function p(){I.current=!1,M.current=!1}function v(){const e=B.current,t="pen"!==e&&e?e:"mouse",n=E(),r="function"==typeof n?n():n;return"string"==typeof r?r:r[t]}function b(e){const t=c.current.floatingContext?.nodeId,n=R&&Or(R.nodesRef.current,t).some(t=>kr(e,t.context?.elements.floating));return kr(e,r.select("floatingElement"))||kr(e,r.select("domReferenceElement"))||n}function y(e){if(function(e){const t=v();return"intentional"===t&&"click"!==e.type||"sloppy"===t&&"click"===e.type}(e))return void N();if(c.current.insideReactTree)return void N();const n=Cr(e),o=`[${ms("inert")}]`,s=l(n)?n.getRootNode():null,d=Array.from((a(s)?s:Xr(r.select("floatingElement"))).querySelectorAll(o)),f=r.context.triggerElements;if(n&&(f.hasElement(n)||f.hasMatchingElement(e=>Rr(e,n))))return;let p=l(n)?n:null;for(;p&&!g(p);){const e=h(p);if(g(e)||!l(e))break;p=e}if(d.length&&l(n)&&!n.matches("html,body")&&!Rr(n,r.select("floatingElement"))&&d.every(e=>!Rr(p,e)))return;if(i(n)&&!("touches"in e)){const t=g(n),r=u(n),o=/auto|scroll/,s=t||o.test(r.overflowX),i=t||o.test(r.overflowY),a=s&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,l=i&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,c="rtl"===r.direction,d=l&&(c?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),f=a&&e.offsetY>n.clientHeight;if(d||f)return}if(b(e))return;if("intentional"===v()&&P.current)return t.clear(),void(P.current=!1);if("function"==typeof S&&!S(e))return;const m=c.current.floatingContext?.nodeId,y=R?Or(R.nodesRef.current,m):[];if(y.length>0){let e=!0;if(y.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}r.setOpen(!1,dn(_t,e)),N()}function x(e){if("sloppy"!==v()||!r.select("open")||!d||kr(e,r.select("floatingElement"))||kr(e,r.select("domReferenceElement")))return;const t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},F.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function w(e,t){const n=Cr(e);if(!n)return;const r=zo(n,e.type,()=>{t(e),r()})}function C(e){F.clear(),"pointerdown"===e.type&&(B.current=e.pointerType),"mousedown"===e.type&&D.current&&!D.current.dismissOnMouseDown||w(e,e=>{"pointerdown"===e.type?function(e){"sloppy"===v()&&"touch"!==e.pointerType&&r.select("open")&&d&&!kr(e,r.select("floatingElement"))&&!kr(e,r.select("domReferenceElement"))&&y(e)}(e):y(e)})}function A(e){if(!I.current)return;const r=M.current;p(),"intentional"===v()&&("pointercancel"!==e.type?b(e)||(r?n():("function"!=typeof S||S(e))&&(t.clear(),P.current=!0,N())):r&&n())}function V(e){if("sloppy"!==v()||!D.current||kr(e,r.select("floatingElement"))||kr(e,r.select("domReferenceElement")))return;const t=e.touches[0];if(!t)return;const n=Math.abs(t.clientX-D.current.startX),o=Math.abs(t.clientY-D.current.startY),s=Math.sqrt(n*n+o*o);s>5&&(D.current.dismissOnTouchEnd=!0),s>10&&(y(e),F.clear(),D.current=null)}function H(e){"sloppy"!==v()||!D.current||kr(e,r.select("floatingElement"))||kr(e,r.select("domReferenceElement"))||(D.current.dismissOnTouchEnd&&y(e),F.clear(),D.current=null)}const L=Xr(s),W=as(f&&as(zo(L,"keydown",z),zo(L,"compositionstart",function(){e.clear(),j.current=!0}),zo(L,"compositionend",function(){e.start(m()?5:0,()=>{j.current=!1})})),k&&as(zo(L,"click",C,!0),zo(L,"pointerdown",C,!0),zo(L,"pointerup",A,!0),zo(L,"pointercancel",A,!0),zo(L,"mousedown",C,!0),zo(L,"mouseup",A,!0),zo(L,"touchstart",function(e){B.current="touch",w(e,x)},!0),zo(L,"touchmove",function(e){w(e,V)},!0),zo(L,"touchend",function(e){w(e,H)},!0)));return()=>{W(),e.clear(),t.clear(),p(),P.current=!1}},[c,s,f,k,S,o,d,T,O,z,N,E,R,r,F]),e.useEffect(N,[S,N]);const W=e.useMemo(()=>({onKeyDown:z,[ei[y]]:e=>{H()&&r.setOpen(!1,dn(Gt,e.nativeEvent))},..."intentional"!==y&&{onClick(e){H()&&r.setOpen(!1,dn(Gt,e.nativeEvent))}}}),[z,r,y,H]),q=Dt(e=>{if(!o||!d||0!==e.button)return;const t=Cr(e.nativeEvent);Rr(r.select("floatingElement"),t)&&(I.current||(I.current=!0,M.current=!1))}),K=Dt(e=>{o&&d&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&I.current&&(M.current=!0)}),$=e.useMemo(()=>({onKeyDown:z,onPointerDown:K,onMouseDown:K,onClickCapture:L,onMouseDownCapture(e){L(),q(e)},onPointerDownCapture(e){L(),q(e)},onMouseUpCapture:L,onTouchEndCapture:L,onTouchMoveCapture:L}),[z,L,q,K]);return e.useMemo(()=>d?{reference:W,floating:$,trigger:W}:{},[d,W,$])}const ri=(e,t,n,r,o,s,...i)=>{if(i.length>0)throw new Error(F(1));let a;if(e&&t&&n&&r&&o&&s)a=(i,a,l,u)=>{const c=e(i,a,l,u),d=t(i,a,l,u),f=n(i,a,l,u),p=r(i,a,l,u),m=o(i,a,l,u);return s(c,d,f,p,m,a,l,u)};else if(e&&t&&n&&r&&o)a=(s,i,a,l)=>{const u=e(s,i,a,l),c=t(s,i,a,l),d=n(s,i,a,l),f=r(s,i,a,l);return o(u,c,d,f,i,a,l)};else if(e&&t&&n&&r)a=(o,s,i,a)=>{const l=e(o,s,i,a),u=t(o,s,i,a),c=n(o,s,i,a);return r(l,u,c,s,i,a)};else if(e&&t&&n)a=(r,o,s,i)=>{const a=e(r,o,s,i),l=t(r,o,s,i);return n(a,l,o,s,i)};else if(e&&t)a=(n,r,o,s)=>{const i=e(n,r,o,s);return t(i,r,o,s)};else{if(!e)throw new Error("Missing arguments");a=e}return a};var oi=Symbol("NOT_FOUND");var si=e=>Array.isArray(e)?e:[e];function ii(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){const n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}var ai=(e,t)=>e===t;var li="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function ui(){return{s:0,v:void 0,o:null,p:null}}function ci(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let o,s=0;function i(){let t=n;const{length:i}=arguments;for(let e=0,n=i;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=ui(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=ui(),e.set(n,t)):t=r}}const a=t;let l;if(1===t.s)l=t.v;else if(l=e.apply(null,arguments),s++,r){const e=o?.deref?.()??o;null!=e&&r(e,l)&&(l=e,0!==s&&s--);o="object"==typeof l&&null!==l||"function"==typeof l?new li(l):l}return a.s=1,a.v=l,l}return i.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function di(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,s={},i=e.pop();"object"==typeof i&&(s=i,i=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(i,`createSelector expects an output function after the inputs, but received: [${typeof i}]`);const a={...n,...s},{memoize:l,memoizeOptions:u=[],argsMemoize:c=ci,argsMemoizeOptions:d=[]}=a,f=si(u),p=si(d),m=ii(e),g=l(function(){return r++,i.apply(null,arguments)},...f),h=c(function(){o++;const e=function(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}(m,arguments);return t=g.apply(null,e),t},...p);return Object.assign(h,{resultFunc:i,memoizedResultFunc:g,dependencies:m,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:l,argsMemoize:c})};return Object.assign(r,{withTypes:()=>r}),r}var fi=di(ci),pi=Object.assign((e,t=fi)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(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);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>pi});const mi=di({memoize:function(e,t){const n="object"==typeof t?t:{equalityCheck:t},{equalityCheck:r=ai,maxSize:o=1,resultEqualityCheck:s}=n,i=function(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;const{length:r}=t;for(let o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}}(r);let a=0;const l=o<=1?function(e){let t;return{get:n=>t&&e(t.key,n)?t.value:oi,put(e,n){t={key:e,value:n}},getEntries:()=>t?[t]:[],clear(){t=void 0}}}(i):function(e,t){let n=[];function r(e){const r=n.findIndex(n=>t(e,n.key));if(r>-1){const e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return oi}return{get:r,put:function(t,o){r(t)===oi&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(o,i);function u(){let t=l.get(arguments);if(t===oi){if(t=e.apply(null,arguments),a++,s){const e=l.getEntries().find(e=>s(e.value,t));e&&(t=e.value,0!==a&&a--)}l.put(arguments,t)}return t}return u.clearCache=()=>{l.clear(),u.resetResultsCount()},u.resultsCount=()=>a,u.resetResultsCount=()=>{a=0},u},memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),gi=q(19)?function(t,n,r,o,i){const a=Go;if(!a)return function(t,n,r,o,i){const a=e.useCallback(()=>n(t.getSnapshot(),r,o,i),[t,n,r,o,i]);return s.useSyncExternalStore(t.subscribe,a,a)}(t,n,r,o,i);const l=a.syncIndex;let u;a.syncIndex+=1,a.didInitialize?(u=a.syncHooks[l],u.store===t&&u.selector===n&&Object.is(u.a1,r)&&Object.is(u.a2,o)&&Object.is(u.a3,i)||(u.store!==t&&(a.didChangeStore=!0),u.store=t,u.selector=n,u.a1=r,u.a2=o,u.a3=i,u.didChange=!0)):(u={store:t,selector:n,a1:r,a2:o,a3:i,value:n(t.getSnapshot(),r,o,i),didChange:!1},a.syncHooks.push(u));return u.value}:function(e,t,n,r,s){return o.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,s))};function hi(e,t,n,r,o){return gi(e,t,n,r,o)}var vi;vi={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){const r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);!r.didChange&&Object.is(r.value,o)||(t=!0,r.value=o,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const o of e.syncHooks)n.add(o.store);const r=[];for(const e of n)r.push(e.subscribe(t));return()=>{for(const e of r)e()}}),s.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}},Uo.push(vi);class bi{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;const t=this.updateTick;for(const n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(const t in e)if(!Object.is(this.state[t],e[t]))return void this.setState({...this.state,...e})}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){const e={...this.state};this.setState(e)}use(e,t,n,r){return hi(this,e,t,n,r)}}class yi extends bi{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(t,n){e.useDebugValue(t),Nt(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(e,t){const n=this;Nt(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){const t=this,n=Object.values(e);Nt(()=>{t.update(e)},[t,...n])}useControlledProp(t,n){e.useDebugValue(t);const r=void 0!==n;Nt(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r])}select(e,t,n,r){return(0,this.selectors[e])(this.state,t,n,r)}useState(t,n,r,o){return e.useDebugValue(t),hi(this,this.selectors[t],n,r,o)}useContextCallback(t,n){e.useDebugValue(t);const r=Dt(n??U);this.context[t]=r}useStateSetter(t){const n=e.useRef(void 0);return void 0===n.current&&(n.current=e=>{this.set(t,e)}),n.current}observe(e,t){let n;n="function"==typeof e?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{const o=n(e);if(!Object.is(r,o)){const e=r;r=o,t(o,e,this)}})}}const xi={open:ri(e=>e.open),transitionStatus:ri(e=>e.transitionStatus),domReferenceElement:ri(e=>e.domReferenceElement),referenceElement:ri(e=>e.positionReference??e.referenceElement),floatingElement:ri(e=>e.floatingElement),floatingId:ri(e=>e.floatingId)};class wi extends yi{constructor(e){const{syncOnly:t,nested:n,onOpenChange:r,triggerElements:o,...s}=e;super({...s,positionReference:s.referenceElement,domReferenceElement:s.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Bs(),nested:n,triggerElements:o},xi),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||null!=t&&jr(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);const n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit("openchange",n)};setOpen=(e,t)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}}function Ri(t,n){const r=e.useRef(null),o=e.useRef(null);return e.useCallback(e=>{if(void 0!==t){if(null!==r.current){const e=r.current,t=o.current,s=n.context.triggerElements.getById(e);t&&s===t&&n.context.triggerElements.delete(e),r.current=null,o.current=null}null!==e&&(r.current=t,o.current=e,n.context.triggerElements.add(t,e))}},[n,t])}function Ci(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=Ri(e,n),i=Dt(t=>{if(s(t),!t||!n.select("open"))return;const o=n.select("activeTriggerId");o!==e?null==o&&n.update({activeTriggerId:e,activeTriggerElement:t,...r}):n.update({activeTriggerElement:t,...r})});return Nt(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function Si(e){const t=e.useState("open");Nt(()=>{if(t&&!e.select("activeTriggerId")&&1===e.context.triggerElements.size){const t=e.context.triggerElements.entries().next();if(!t.done){const[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function ki(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=An(e);t.useSyncedValues({mounted:r,transitionStatus:s});const i=Dt(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Ko({enabled:!t.useState("preventUnmountingOnClose"),open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class Ei{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){const n=this.idMap.get(e);n!==t&&(void 0!==n&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){const t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(const 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 Ii(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new wi({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ei,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0}),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Y,inactiveTriggerProps:Y,popupProps:Y}}const Mi=ri(e=>e.triggerIdProp??e.activeTriggerId),Pi={open:ri(e=>e.openProp??e.open),mounted:ri(e=>e.mounted),transitionStatus:ri(e=>e.transitionStatus),floatingRootContext:ri(e=>e.floatingRootContext),preventUnmountingOnClose:ri(e=>e.preventUnmountingOnClose),payload:ri(e=>e.payload),activeTriggerId:Mi,activeTriggerElement:ri(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:ri((e,t)=>void 0!==t&&Mi(e)===t),isOpenedByTrigger:ri((e,t)=>void 0!==t&&Mi(e)===t&&e.open),isMountedByTrigger:ri((e,t)=>void 0!==t&&Mi(e)===t&&e.mounted),triggerProps:ri((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:ri(e=>e.popupProps),popupElement:ri(e=>e.popupElement),positionerElement:ri(e=>e.positionerElement)};function Ti(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=bn(),s=null!=Ws(),i=B(()=>new wi({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ei,floatingId:o,syncOnly:!1,nested:s})).current;return Nt(()=>{const e={open:t,floatingId:o};void 0!==r.reference&&(e.referenceElement=r.reference,e.domReferenceElement=l(r.reference)?r.reference:null),void 0!==r.floating&&(e.floatingElement=r.floating),i.update(e)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function Oi(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,o=bn(),s=null!=Ws(),i=t.useState("open"),a=t.useState("activeTriggerElement"),u=t.useState(n?"popupElement":"positionerElement"),c=t.context.triggerElements,d=B(()=>new wi({open:i,transitionStatus:void 0,referenceElement:a,floatingElement:u,triggerElements:c,onOpenChange:r,floatingId:o,syncOnly:!0,nested:s})).current;return Nt(()=>{const e={open:i,floatingId:o,referenceElement:a,floatingElement:u};l(a)&&(e.domReferenceElement=a),d.state.positionReference===d.state.referenceElement&&(e.positionReference=a),d.update(e)},[i,o,a,u,d]),d.context.onOpenChange=r,d.context.nested=s,d}const Ai=dr&&ur;function Di(t,n={}){const r="rootStore"in t?t.rootStore:t,{events:o,dataRef:s}=r.context,{enabled:a=!0,delay:u}=n,c=e.useRef(!1),d=e.useRef(null),f=ts(),m=e.useRef(!0);e.useEffect(()=>{const e=r.select("domReferenceElement");if(!a)return;const t=p(e);return as(zo(t,"blur",function(){const e=r.select("domReferenceElement");!r.select("open")&&i(e)&&e===wr(Xr(e))&&(c.current=!0)}),Ai&&zo(t,"keydown",function(){m.current=!0},!0),Ai&&zo(t,"pointerdown",function(){m.current=!1},!0))},[r,a]),e.useEffect(()=>{if(a)return o.on("openchange",e),()=>{o.off("openchange",e)};function e(e){if(e.reason===Gt||e.reason===sn){const e=r.select("domReferenceElement");l(e)&&(d.current=e,c.current=!0)}}},[o,a,r]);const g=e.useMemo(()=>({onMouseLeave(){c.current=!1,d.current=null},onFocus(e){const t=e.currentTarget;if(c.current){if(d.current===t)return;c.current=!1,d.current=null}const n=Cr(e.nativeEvent);if(l(n))if(Ai&&!e.relatedTarget){if(!m.current&&!Er(n))return}else if(!Pr(n))return;const o=Sr(e.relatedTarget,r.context.triggerElements),{nativeEvent:s,currentTarget:i}=e,a="function"==typeof u?u():u;r.select("open")&&o||0===a||void 0===a?r.setOpen(!0,dn(Xt,s,i)):f.start(a,()=>{c.current||r.setOpen(!0,dn(Xt,s,i))})},onBlur(e){c.current=!1,d.current=null;const t=e.relatedTarget,n=e.nativeEvent,o=l(t)&&t.hasAttribute(ms("focus-guard"))&&"outside"===t.getAttribute("data-type");f.start(0,()=>{const e=r.select("domReferenceElement"),i=wr(Xr(e));if(!t&&i===e)return;if(Rr(s.current.floatingContext?.refs.floating.current,i)||Rr(e,i)||o)return;Sr(t??i,r.context.triggerElements)||r.setOpen(!1,dn(Xt,n))})}}),[s,r,f,u]);return e.useMemo(()=>a?{reference:g,trigger:g}:{},[a,g])}class Fi{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new es,this.restTimeout=new es,this.handleCloseOptions=void 0}static create(){return new Fi}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Vi=new WeakMap;function Ni(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Vi.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Vi.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function ji(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=Vi.get(n);s&&s!==e&&Ni(s),Ni(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Vi.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function Bi(e){const t=B(Fi.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),wn(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Hi(t,n={}){const r="rootStore"in t?t.rootStore:t,o=r.useState("open"),s=r.useState("floatingElement"),i=r.useState("domReferenceElement"),{dataRef:a}=r.context,{enabled:u=!0,closeDelay:c=0,nodeId:d}=n,f=Bi(r),p=qs(),m=Ws(),g=Dt(()=>os(a.current.openEvent?.type,f.interactedInside)),h=Dt(()=>{const e=a.current.openEvent?.type;return e?.includes("mouse")&&"mousedown"!==e}),v=Dt(e=>Sr(e,r.context.triggerElements)),b=e.useCallback(e=>{const t=ns(c,"close",f.pointerType),n=()=>{r.setOpen(!1,dn(Yt,e)),p?.events.emit("floating.closed",e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())},[c,r,f,p]),y=Dt(()=>{Ni(f)}),x=Dt(e=>{const t=Cr(e);Ir(t)?f.interactedInside=null!=t?.closest("[aria-haspopup]"):f.interactedInside=!1});Nt(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,y())},[o,f,y]),e.useEffect(()=>y,[y]),Nt(()=>{if(u&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&l(i)&&s){const e=i,t=s,n=Xr(s),r=p?.nodesRef.current.find(e=>e.id===m)?.context?.elements.floating;r&&(r.style.pointerEvents="");const o=f.handleCloseOptions?.getScope?.()??f.pointerEventsScopeElement??r??e.closest("[data-rootownerid]")??n.body;return ji(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{y()}}},[u,o,i,s,f,h,p,m,y]);const w=ts();e.useEffect(()=>{if(!u)return;function e(t){!p||!m||Or(p.nodesRef.current,m).length>0||w.start(0,()=>{p.events.off("floating.closed",e),r.setOpen(!1,dn(Yt,t)),p.events.emit("floating.closed",t)})}const t=s;return as(t&&zo(t,"mouseenter",function(){f.openChangeTimeout.clear(),w.clear(),p?.events.off("floating.closed",e),y()}),t&&zo(t,"mouseleave",function(t){if(p&&m&&Or(p.nodesRef.current,m).length>0)return void p.events.on("floating.closed",e);if(v(t.relatedTarget))return;const n=a.current.floatingContext?.nodeId??d,r=t.relatedTarget;p&&n&&l(r)&&Or(p.nodesRef.current,n,!1).some(e=>Rr(e.context?.elements.floating,r))||(f.handler?f.handler(t):(y(),g()||b(t)))}),t&&zo(t,"pointerdown",x,!0),()=>{p?.events.off("floating.closed",e)})},[u,s,r,a,d,g,v,b,y,x,f,p,m,w])}const zi={current:null};function Li(t,n={}){const o="rootStore"in t?t.rootStore:t,{dataRef:s,events:i}=o.context,{enabled:a=!0,delay:u=0,handleClose:c=null,mouseOnly:d=!1,restMs:f=0,move:p=!0,triggerElementRef:m=zi,externalTree:g,isActiveTrigger:h=!0,getHandleCloseContext:v,isClosing:b}=n,y=qs(g),x=Bi(o),w=e.useRef(!1),R=ls(c),C=ls(u),S=ls(f),k=ls(a),E=ls(b);h&&(x.handleCloseOptions=R.current?.__options);const I=Dt(()=>os(s.current.openEvent?.type,x.interactedInside)),M=Dt(e=>Sr(e,o.context.triggerElements)),P=Dt((e,t,n)=>{const r=o.context.triggerElements;if(r.hasElement(t))return!e||!Rr(e,t);if(!l(n))return!1;const s=n;return r.hasMatchingElement(e=>Rr(e,s))&&(!e||!Rr(e,s))}),T=Dt((e,t=!0)=>{const n=ns(C.current,"close",x.pointerType);n?x.openChangeTimeout.start(n,()=>{o.setOpen(!1,dn(Yt,e)),y?.events.emit("floating.closed",e)}):t&&(x.openChangeTimeout.clear(),o.setOpen(!1,dn(Yt,e)),y?.events.emit("floating.closed",e))}),O=Dt(()=>{if(!x.handler)return;Xr(o.select("domReferenceElement")).removeEventListener("mousemove",x.handler),x.handler=void 0}),A=Dt(()=>{Ni(x)});return e.useEffect(()=>O,[O]),e.useEffect(()=>{if(a)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){e.open?w.current=!1:(w.current=e.reason===Yt,O(),x.openChangeTimeout.clear(),x.restTimeout.clear(),x.blockMouseMove=!0,x.restTimeoutPending=!1)}},[a,i,x,O]),e.useEffect(()=>{if(!a)return;const e=m.current??(h?o.select("domReferenceElement"):null);if(l(e))return p?as(zo(e,"mousemove",t,{once:!0}),zo(e,"mouseenter",t),zo(e,"mouseleave",n)):as(zo(e,"mouseenter",t),zo(e,"mouseleave",n));function t(e){if(x.openChangeTimeout.clear(),x.blockMouseMove=!1,d&&!Nr(x.pointerType))return;const t=rs(S.current),n=ns(C.current,"open",x.pointerType),r=Cr(e),s=e.currentTarget??null,i=o.select("domReferenceElement");let a=s;if(l(r)&&!o.context.triggerElements.hasElement(r))for(const l of o.context.triggerElements.elements())if(Rr(l,r)){a=l;break}l(s)&&l(i)&&!o.context.triggerElements.hasElement(s)&&Rr(s,i)&&(a=i);const u=null!=a&&P(i,a,r),c=o.select("open"),f=E.current?.()??"ending"===o.select("transitionStatus"),p=!c&&f&&w.current,m=!u&&l(a)&&l(i)&&Rr(i,a)&&p,g=t>0&&!n,h=!c||u;u&&(c||p)||m?o.setOpen(!0,dn(Yt,e,a)):g||(n?x.openChangeTimeout.start(n,()=>{h&&o.setOpen(!0,dn(Yt,e,a))}):h&&o.setOpen(!0,dn(Yt,e,a)))}function n(e){if(I())return void A();O();const t=Xr(o.select("domReferenceElement"));x.restTimeout.clear(),x.restTimeoutPending=!1;const n=s.current.floatingContext??v?.();if(M(e.relatedTarget))return;if(R.current&&n){o.select("open")||x.openChangeTimeout.clear();const r=m.current;return x.handler=R.current({...n,tree:y,x:e.clientX,y:e.clientY,onClose(){A(),O(),k.current&&!I()&&r===o.select("domReferenceElement")&&T(e,!0)}}),t.addEventListener("mousemove",x.handler),void x.handler(e)}("touch"!==x.pointerType||!Rr(o.select("floatingElement"),e.relatedTarget))&&T(e)}},[O,A,s,C,T,o,a,R,x,h,P,I,M,d,p,S,m,y,k,v,E]),e.useMemo(()=>{if(a)return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e,n=e.currentTarget,s=o.select("domReferenceElement"),i=o.select("open"),a=P(s,n,e.target);if(d&&!Nr(x.pointerType))return;if(i&&a&&x.handleCloseOptions?.blockPointerEvents){const e=o.select("floatingElement");if(e){const t=x.handleCloseOptions?.getScope?.()??n.ownerDocument.body;ji(x,{scopeElement:t,referenceElement:n,floatingElement:e})}}const l=rs(S.current);function u(){if(x.restTimeoutPending=!1,I())return;const e=o.select("open");x.blockMouseMove||e&&!a||o.setOpen(!0,dn(Yt,t,n))}i&&!a||0===l||!a&&x.restTimeoutPending&&e.movementX**2+e.movementY**2<2||(x.restTimeout.clear(),"touch"===x.pointerType?r.flushSync(()=>{u()}):a&&i?u():(x.restTimeoutPending=!0,x.restTimeout.start(l,u)))}};function e(e){x.pointerType=e.pointerType}},[a,x,I,P,d,o,S])}function Wi(t=[]){const n=t.map(e=>e?.reference),r=t.map(e=>e?.floating),o=t.map(e=>e?.item),s=t.map(e=>e?.trigger),i=e.useCallback(e=>qi(e,t,"reference"),n),a=e.useCallback(e=>qi(e,t,"floating"),r),l=e.useCallback(e=>qi(e,t,"item"),o),u=e.useCallback(e=>qi(e,t,"trigger"),s);return e.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:l,getTriggerProps:u}),[i,a,l,u])}function qi(e,t,n){const r=new Map,o="item"===n,s={};"floating"===n&&(s.tabIndex=-1,s[pr]="");for(const i in e)o&&e&&(i===mr||i===gr)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const l=t[i]?.[n];a="function"==typeof l?e?l(e):null:l,a&&Ki(s,a,o,r)}return Ki(s,e,o,r),s}function Ki(e,t,n,r){for(const o in t){const s=t[o];(!n||o!==mr&&o!==gr)&&(o.startsWith("on")?(r.has(o)||r.set(o,[]),"function"==typeof s&&(r.get(o)?.push(s),e[o]=(...e)=>r.get(o)?.map(t=>t(...e)).find(e=>void 0!==e))):e[o]=s)}}function $i(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ui(e,t){return $i(t,e===yr||e===xr,e===vr||e===br)}function Gi(e,t,n){return $i(t,e===xr,n?e===vr:e===br)||"Enter"===e||" "===e||""===e}function Yi(t,n){const r="rootStore"in t?t.rootStore:t,o=r.useState("open"),s=r.useState("floatingElement"),a=r.useState("domReferenceElement"),l=r.context.dataRef,{listRef:u,activeIndex:c,onNavigate:d=()=>{},enabled:f=!0,selectedIndex:p=null,allowEscape:m=!1,loopFocus:g=!1,nested:h=!1,rtl:v=!1,virtual:b=!1,focusItemOnOpen:y="auto",focusItemOnHover:x=!0,openOnArrowKeyDown:w=!0,disabledIndices:R,orientation:C="vertical",parentOrientation:S,cols:k=1,id:E,resetOnPointerLeave:I=!0,externalTree:M}=n,P=ls(Tr(s)),T=Ws(),O=qs(M);Nt(()=>{l.current.orientation=C},[l,C]);const A=Mr(a),D=e.useRef(y),F=e.useRef(p??-1),V=e.useRef(null),N=e.useRef(!0),j=Dt(e=>{d(-1===F.current?null:F.current,e)}),B=e.useRef(j),H=e.useRef(!!s),z=e.useRef(o),L=e.useRef(!1),W=e.useRef(!1),q=e.useRef(null),K=ls(R),$=ls(o),U=ls(p),G=ls(I),Y=Dt(()=>{function e(e){b?O?.events.emit("virtualfocus",e):q.current=hs(e,{sync:L.current,preventScroll:!0})}const t=u.current[F.current],n=W.current;t&&e(t);(L.current?e=>e():requestAnimationFrame)(()=>{const r=u.current[F.current]||t;if(!r)return;t||e(r);J&&(n||!N.current)&&r.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Nt(()=>{f&&(o&&s?(F.current=p??-1,D.current&&null!=p&&(W.current=!0,j())):H.current&&(F.current=-1,B.current()))},[f,o,s,p,j]),Nt(()=>{if(f)if(o){if(s)if(null==c){if(L.current=!1,null!=U.current)return;if(H.current&&(F.current=-1,Y()),(!z.current||!H.current)&&D.current&&(null!=V.current||!0===D.current&&null==V.current)){let e=0;const t=()=>{if(null==u.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e+=1}else F.current=null==V.current||Gi(V.current,C,v)||h?zr(u):Lr(u),V.current=null,j()};t()}}else Hr(u.current,c)||(F.current=c,Y(),W.current=!1)}else L.current=!1},[f,o,s,c,U,h,u,C,v,j,Y,K]),Nt(()=>{if(!f||s||!O||b||!H.current)return;const e=O.nodesRef.current,t=e.find(e=>e.id===T)?.context?.elements.floating,n=wr(Xr(s)),r=e.some(e=>e.context&&Rr(e.context.elements.floating,n));t&&!r&&N.current&&t.focus({preventScroll:!0})},[f,s,O,T,b]),Nt(()=>{B.current=j,z.current=o,H.current=!!s}),Nt(()=>{o||(V.current=null,D.current=y)},[o,y]);const X=null!=c,_=Dt(e=>{if(!$.current)return;const t=u.current.indexOf(e.currentTarget);-1===t||F.current===t&&c===t||(F.current=t,j(e))}),J=e.useMemo(()=>({onFocus(e){L.current=!0,_(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){L.current=!0,W.current=!1,x&&_(e)},onPointerLeave(e){if(!$.current||!N.current||"touch"===e.pointerType)return;L.current=!0;const t=e.relatedTarget;if(x&&!u.current.includes(t)&&G.current&&(q.current?.(),q.current=null,F.current=-1,j(e),!b)){const e=P.current,t=wr(Xr(e));e&&Rr(e,t)&&e.focus({preventScroll:!0})}}}),[_,$,P,x,u,j,G,b]),Q=e.useCallback(()=>S??O?.nodesRef.current.find(e=>e.id===T)?.context?.dataRef?.current.orientation,[T,O,S]),Z=Dt(e=>{if(N.current=!1,L.current=!0,229===e.which)return;if(!$.current&&e.currentTarget===P.current)return;if(h&&function(e,t,n,r){return"both"===t||"horizontal"===t&&r&&r>1?"Escape"===e:$i(t,n?e===br:e===vr,e===yr)}(e.key,C,v,k))return Ui(e.key,Q())||Dr(e),r.setOpen(!1,dn(an,e.nativeEvent)),void(i(a)&&(b?O?.events.emit("virtualfocus",a):a.focus()));const t=F.current,n=zr(u,R),s=Lr(u,R);if(A||("Home"===e.key&&(Dr(e),F.current=n,j(e)),"End"===e.key&&(Dr(e),F.current=s,j(e))),k>1){const t=Array.from({length:u.current.length},()=>({width:1,height:1})),r=Kr(t,k,!1),o=r.findIndex(e=>null!=e&&!Gr(u.current,e,R)),i=r.reduce((e,t,n)=>null==t||Gr(u.current,t,R)?e:n,-1),a=r[qr(r.map(e=>null!=e?u.current[e]:null),{event:e,orientation:C,loopFocus:g,rtl:v,cols:k,disabledIndices:Ur([...("function"!=typeof R?R:null)||u.current.map((e,t)=>Gr(u.current,t,R)?t:void 0),void 0],r),minIndex:o,maxIndex:i,prevIndex:$r(F.current>s?n:F.current,t,r,k,e.key===xr?"bl":e.key===(v?vr:br)?"tr":"tl"),stopEvent:!0})];if(null!=a&&(F.current=a,j(e)),"both"===C)return}if(Ui(e.key,C)){if(Dr(e),o&&!b&&wr(e.currentTarget.ownerDocument)===e.currentTarget)return F.current=Gi(e.key,C,v)?n:s,void j(e);Gi(e.key,C,v)?g?t>=s?m&&t!==u.current.length?F.current=-1:(L.current=!1,F.current=n):F.current=Wr(u.current,{startingIndex:t,disabledIndices:R}):F.current=Math.min(s,Wr(u.current,{startingIndex:t,disabledIndices:R})):g?t<=n?m&&-1!==t?F.current=u.current.length:(L.current=!1,F.current=s):F.current=Wr(u.current,{startingIndex:t,decrement:!0,disabledIndices:R}):F.current=Math.max(n,Wr(u.current,{startingIndex:t,decrement:!0,disabledIndices:R})),Hr(u.current,F.current)&&(F.current=-1),j(e)}}),ee=e.useMemo(()=>b&&o&&X&&{"aria-activedescendant":`${E}-${c}`},[b,o,X,E,c]),te=e.useMemo(()=>({"aria-orientation":"both"===C?void 0:C,...A?{}:ee,onKeyDown(e){if("Tab"===e.key&&e.shiftKey&&o&&!b){const t=Cr(e.nativeEvent);if(t&&!Rr(P.current,t))return;return Dr(e),r.setOpen(!1,dn(on,e.nativeEvent)),void(i(a)&&a.focus())}Z(e)},onPointerMove(){N.current=!0}}),[ee,Z,P,C,A,r,o,b,a]),ne=e.useMemo(()=>{function e(e){"auto"===y&&Fr(e.nativeEvent)&&(D.current=!b)}function t(e){D.current=y,"auto"===y&&Vr(e.nativeEvent)&&(D.current=!0)}return{onKeyDown(e){const t=r.select("open");N.current=!1;const n=e.key.startsWith("Arrow"),o=function(e,t,n){return $i(t,n?e===vr:e===br,e===xr)}(e.key,Q(),v),s=Ui(e.key,C),i=(h?o:s)||"Enter"===e.key||""===e.key.trim();if(b&&t)return Z(e);if(t||w||!n){if(i){const t=Ui(e.key,Q());V.current=h&&t?null:e.key}h?o&&(Dr(e),t?(F.current=zr(u,K.current),j(e)):r.setOpen(!0,dn(an,e.nativeEvent,e.currentTarget))):s&&(null!=U.current&&(F.current=U.current),Dr(e),!t&&w?r.setOpen(!0,dn(an,e.nativeEvent,e.currentTarget)):Z(e),t&&j(e))}},onFocus(e){r.select("open")&&!b&&(F.current=-1,j(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[Z,K,y,u,h,j,r,w,C,Q,v,U,b]),re=e.useMemo(()=>({...ee,...ne}),[ee,ne]);return e.useMemo(()=>f?{reference:re,floating:te,item:J,trigger:ne}:{},[f,re,te,ne,J])}const Xi=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function _i(t,n={}){const r="rootStore"in t?t.rootStore:t,o=r.useState("open"),s=r.useState("floatingId"),i=r.useState("domReferenceElement"),a=r.useState("floatingElement"),{role:l="dialog"}=n,u=bn(),c=i?.id||u,d=e.useMemo(()=>Tr(a)?.id||s,[a,s]),f=Xi.get(l)??l,p=null!=Ws(),m=e.useMemo(()=>"tooltip"===f||"label"===l?Y:{"aria-haspopup":"alertdialog"===f?"dialog":f,"aria-expanded":"false",..."listbox"===f&&{role:"combobox"},..."menu"===f&&p&&{role:"menuitem"},..."select"===l&&{"aria-autocomplete":"none"},..."combobox"===l&&{"aria-autocomplete":"list"}},[f,p,l]),g=e.useMemo(()=>{if("tooltip"===f||"label"===l)return{["aria-"+("label"===l?"labelledby":"describedby")]:o?d:void 0};return{...m,"aria-expanded":o?"true":"false","aria-controls":o?d:void 0,..."menu"===f&&{id:c}}},[f,d,o,c,l,m]),h=e.useMemo(()=>{const e={id:d,...f&&{role:f}};return"tooltip"===f||"label"===l?e:{...e,..."menu"===f&&{"aria-labelledby":c}}},[f,d,c,l]),v=e.useCallback(({active:e,selected:t})=>{const n={role:"option",...e&&{id:`${d}-fui-option`}};switch(l){case"select":case"combobox":return{...n,"aria-selected":t}}return{}},[d,l]);return e.useMemo(()=>({reference:g,floating:h,item:v,trigger:m}),[g,h,m,v])}function Ji(t,n){const r="rootStore"in t?t.rootStore:t,o=r.context.dataRef,s=r.useState("open"),{listRef:i,elementsRef:a,activeIndex:l,onMatch:u,onTypingChange:c,enabled:d=!0,resetMs:f=750,selectedIndex:p=null}=n,m=ts(),g=e.useRef(""),h=e.useRef(p??l??-1),v=e.useRef(null);Nt(()=>{(s||null===p)&&(m.clear(),v.current=null,""!==g.current&&(g.current=""))},[s,p,m]),Nt(()=>{s&&""===g.current&&(h.current=p??l??-1)},[s,p,l]);const b=Dt(e=>{e?o.current.typing||(o.current.typing=e,c?.(e)):o.current.typing&&(o.current.typing=e,c?.(e))}),y=Dt(e=>{function t(e){const t=a?.current[e];return!t||Yr(t)}function n(e,n,r=0){if(0===e.length)return-1;const o=(r%e.length+e.length)%e.length,s=n.toLocaleLowerCase();for(let i=0;i<e.length;i+=1){const n=(o+i)%e.length,r=e[n];if(r?.toLocaleLowerCase().startsWith(s)&&t(n))return n}return-1}const r=i.current;if(g.current.length>0&&" "===e.key&&(Dr(e),b(!0)),g.current.length>0&&" "!==g.current[0]&&-1===n(r,g.current)&&" "!==e.key&&b(!1),null==r||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;s&&" "!==e.key&&(Dr(e),b(!0));const o=""===g.current;o&&(h.current=p??l??-1);r.every(e=>!e||e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase())&&g.current===e.key&&(g.current="",h.current=v.current),g.current+=e.key,m.start(f,()=>{g.current="",h.current=v.current,b(!1)});const c=((o?p??l??-1:h.current)??0)+1,d=n(r,g.current,c);-1!==d?(u?.(d),v.current=d):" "!==e.key&&(g.current="",b(!1))}),x=Dt(e=>{const t=e.relatedTarget,n=r.select("domReferenceElement"),o=r.select("floatingElement"),s=Rr(n,t),i=Rr(o,t);s||i||(m.clear(),g.current="",h.current=v.current,b(!1))}),w=e.useMemo(()=>({onKeyDown:y,onBlur:x}),[y,x]),R=e.useMemo(()=>({onKeyDown:y,onBlur:x}),[y,x]);return e.useMemo(()=>d?{reference:w,floating:R}:{},[d,w,R])}const Qi=.1*.1,Zi=.5;function ea(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function ta(e,t,n,r,o,s,i,a,l,u){let c=!1;return ea(e,t,n,r,o,s)&&(c=!c),ea(e,t,o,s,i,a)&&(c=!c),ea(e,t,i,a,l,u)&&(c=!c),ea(e,t,l,u,n,r)&&(c=!c),c}function na(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),l=Math.min(r,s),u=Math.max(r,s);return e>=i&&e<=a&&t>=l&&t<=u}function ra(e={}){const{blockPointerEvents:t=!1}=e,n=new es,r=({x:e,y:t,placement:r,elements:o,onClose:s,nodeId:i,tree:a})=>{const u=r?.split("-")[0];let c=!1,d=null,f=null,p="undefined"!=typeof performance?performance.now():0;return function(r){n.clear();const m=o.domReference,g=o.floating;if(!m||!g||null==u||null==e||null==t)return;const{clientX:h,clientY:v}=r,b=Cr(r),y="mouseleave"===r.type,x=Rr(g,b),w=Rr(m,b);if(x&&(c=!0,!y))return;if(w&&(c=!1,!y))return void(c=!0);if(y&&l(r.relatedTarget)&&Rr(g,r.relatedTarget))return;function R(){return Boolean(a&&Or(a.nodesRef.current,i).length>0)}function C(){R()||(n.clear(),s())}if(R())return;const S=m.getBoundingClientRect(),k=g.getBoundingClientRect(),E=e>k.right-k.width/2,I=t>k.bottom-k.height/2,M=k.width>S.width,P=k.height>S.height,T=(M?S:k).left,O=(M?S:k).right,A=(P?S:k).top,D=(P?S:k).bottom;if("top"===u&&t>=S.bottom-1||"bottom"===u&&t<=S.top+1||"left"===u&&e>=S.right-1||"right"===u&&e<=S.left+1)return void C();let F=!1;switch(u){case"top":F=na(h,v,T,S.top+1,O,k.bottom-1);break;case"bottom":F=na(h,v,T,k.top+1,O,S.bottom-1);break;case"left":F=na(h,v,k.right-1,D,S.left+1,A);break;case"right":F=na(h,v,S.right-1,D,k.left+1,A)}if(F)return;if(c&&!function(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}(h,v,S))return void C();if(!y&&function(e,t){const n=performance.now(),r=n-p;if(null===d||null===f||0===r)return d=e,f=t,p=n,!1;const o=e-d,s=t-f;return d=e,f=t,p=n,o*o+s*s<r*r*Qi}(h,v))return void C();let V=!1;switch(u){case"top":{const n=M?.25:2,r=M||E?e+n:e-n,o=M?e-n:E?e+n:e-n,s=t+Zi+1,i=E||M?k.bottom-Zi:k.top,a=E?M?k.bottom-Zi:k.top:k.bottom-Zi;V=ta(h,v,r,s,o,s,k.left,i,k.right,a);break}case"bottom":{const n=M?.25:2,r=M||E?e+n:e-n,o=M?e-n:E?e+n:e-n,s=t-Zi,i=E||M?k.top+Zi:k.bottom,a=E?M?k.top+Zi:k.bottom:k.top+Zi;V=ta(h,v,r,s,o,s,k.left,i,k.right,a);break}case"left":{const n=P?.25:2,r=P||I?t+n:t-n,o=P?t-n:I?t+n:t-n,s=e+Zi+1,i=I||P?k.right-Zi:k.left,a=I?P?k.right-Zi:k.left:k.right-Zi;V=ta(h,v,i,k.top,a,k.bottom,s,r,s,o);break}case"right":{const n=P?.25:2,r=P||I?t+n:t-n,o=P?t-n:I?t+n:t-n,s=e-Zi,i=I||P?k.left+Zi:k.right,a=I?P?k.left+Zi:k.right:k.left+Zi;V=ta(h,v,s,r,s,o,i,k.top,a,k.bottom);break}}V?c||n.start(40,C):C()}};return r.__options={...e,blockPointerEvents:t},r}const oa={...Pi,disabled:ri(e=>e.disabled),instantType:ri(e=>e.instantType),isInstantPhase:ri(e=>e.isInstantPhase),trackCursorAxis:ri(e=>e.trackCursorAxis),disableHoverablePopup:ri(e=>e.disableHoverablePopup),lastOpenChangeReason:ri(e=>e.openChangeReason),closeOnClick:ri(e=>e.closeOnClick),closeDelay:ri(e=>e.closeDelay),hasViewport:ri(e=>e.hasViewport)};class sa extends yi{constructor(t){super({...{...Ii(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1},...t},{popupRef:e.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Ei},oa)}setOpen=(e,t)=>{const n=t.reason,o=n===Yt,s=e&&n===Xt,i=!e&&(n===Gt||n===sn);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);const a=()=>{const r={open:e,openChangeReason:n};s?r.instantType="focus":i?r.instantType="dismiss":n===Yt&&(r.instantType=void 0);const o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};o?r.flushSync(a):a()};static useStore(e,t){const n=B(()=>new sa(t)).current,r=e??n,o=Oi({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=o,r}}const ia=Yo(function(t){const{disabled:r=!1,defaultOpen:o=!1,open:s,disableHoverablePopup:i=!1,trackCursorAxis:a="none",actionsRef:l,onOpenChange:u,onOpenChangeComplete:c,handle:d,triggerId:f,defaultTriggerId:m=null,children:g}=t,h=sa.useStore(d?.store,{open:o,openProp:s,activeTriggerId:m,triggerIdProp:f});Jo(()=>{void 0===s&&!1===h.state.open&&!0===o&&h.update({open:!0,activeTriggerId:m})}),h.useControlledProp("openProp",s),h.useControlledProp("triggerIdProp",f),h.useContextCallback("onOpenChange",u),h.useContextCallback("onOpenChangeComplete",c);const v=h.useState("open"),b=!r&&v,y=h.useState("activeTriggerId"),x=h.useState("payload");h.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),Nt(()=>{v&&r&&h.setOpen(!1,dn("disabled"))},[v,r,h]),h.useSyncedValue("disabled",r),Si(h);const{forceUnmount:w,transitionStatus:R}=ki(b,h),C=h.select("floatingRootContext"),S=h.useState("isInstantPhase"),k=h.useState("instantType"),E=h.useState("lastOpenChangeReason"),I=e.useRef(null);Nt(()=>{"ending"===R&&E===Ut||"ending"!==R&&S?("delay"!==k&&(I.current=k),h.set("instantType","delay")):null!==I.current&&(h.set("instantType",I.current),I.current=null)},[R,S,E,k,h]),Nt(()=>{b&&null==y&&h.set("payload",void 0)},[h,y,b]);const M=e.useCallback(()=>{h.setOpen(!1,dn(cn))},[h]);e.useImperativeHandle(l,()=>({unmount:w,close:M}),[w,M]);const P=ni(C,{enabled:!r,referencePress:()=>h.select("closeOnClick")}),T=function(t,n={}){const r="rootStore"in t?t.rootStore:t,o=r.useState("open"),s=r.useState("floatingElement"),i=r.useState("domReferenceElement"),a=r.context.dataRef,{enabled:l=!0,axis:u="both"}=n,c=e.useRef(!1),d=e.useRef(null),[f,m]=e.useState(),[g,h]=e.useState([]),v=Dt((e,t,n)=>{c.current||a.current.openEvent&&!Zs(a.current.openEvent)||r.set("positionReference",function(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){const s=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i="x"===t.axis||"both"===t.axis,a="y"===t.axis||"both"===t.axis,l=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&"touch"!==t.pointerType;let u=s.width,c=s.height,d=s.x,f=s.y;return null==n&&t.x&&i&&(n=s.x-t.x),null==r&&t.y&&a&&(r=s.y-t.y),d-=n||0,f-=r||0,u=0,c=0,!o||l?(u="y"===t.axis?s.width:0,c="x"===t.axis?s.height:0,d=i&&null!=t.x?t.x:d,f=a&&null!=t.y?t.y:f):o&&!l&&(c="x"===t.axis?s.height:c,u="y"===t.axis?s.width:u),o=!0,{width:u,height:c,x:d,y:f,top:f,right:d+u,bottom:f+c,left:d}}}}(n??i,{x:e,y:t,axis:u,dataRef:a,pointerType:f}))}),b=Dt(e=>{o?d.current||h([]):v(e.clientX,e.clientY,e.currentTarget)}),y=Nr(f)?s:o,x=e.useCallback(()=>{if(!y||!l)return;const e=p(s);if(!a.current.openEvent||Zs(a.current.openEvent)){const t=()=>{d.current?.(),d.current=null};return d.current=zo(e,"mousemove",function(e){const t=Cr(e);Rr(s,t)?(d.current?.(),d.current=null):v(e.clientX,e.clientY)}),t}r.set("positionReference",i)},[y,l,s,a,i,r,v]);e.useEffect(()=>x(),[x,g]),e.useEffect(()=>{l&&!s&&(c.current=!1)},[l,s]),e.useEffect(()=>{!l&&o&&(c.current=!0)},[l,o]);const w=e.useMemo(()=>{function e(e){m(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:b,onMouseEnter:b}},[b]);return e.useMemo(()=>l?{reference:w,trigger:w}:{},[l,w])}(C,{enabled:!r&&"none"!==a,axis:"none"===a?void 0:a}),{getReferenceProps:O,getFloatingProps:A,getTriggerProps:D}=Wi([P,T]),F=e.useMemo(()=>O(),[O]),V=e.useMemo(()=>D(),[D]),N=e.useMemo(()=>A(),[A]);return h.useSyncedValues({activeTriggerProps:F,inactiveTriggerProps:V,popupProps:N}),n.jsx(Qo.Provider,{value:h,children:"function"==typeof g?g({payload:x}):g})});let aa=((la={}).open="data-open",la.closed="data-closed",la[la.startingStyle=In.startingStyle]="startingStyle",la[la.endingStyle=In.endingStyle]="endingStyle",la.anchorHidden="data-anchor-hidden",la.side="data-side",la.align="data-align",la);var la;let ua=function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e}({});const ca={[ua.popupOpen]:""},da={[ua.popupOpen]:"",[ua.pressed]:""},fa={[aa.open]:""},pa={[aa.closed]:""},ma={[aa.anchorHidden]:""},ga={open:e=>e?ca:null},ha={open:e=>e?da:null},va={open:e=>e?fa:pa,anchorHidden:e=>e?ma:null},ba=e.createContext(void 0);let ya=((xa={})[xa.popupOpen=ua.popupOpen]="popupOpen",xa.triggerDisabled="data-trigger-disabled",xa);var xa;const wa=Xo(function(t,n){const{className:r,render:o,handle:s,payload:i,disabled:a,delay:l,closeOnClick:u=!0,closeDelay:c,id:d,style:f,...p}=t,m=Zo(!0),g=s?.store??m;if(!g)throw new Error(F(82));const h=yn(d),v=g.useState("isTriggerActive",h),b=g.useState("isOpenedByTrigger",h),y=g.useState("floatingRootContext"),x=e.useRef(null),w=l??600,R=c??0,{registerTrigger:C,isMountedByThisTrigger:S}=Ci(h,x,g,{payload:i,closeOnClick:u,closeDelay:R}),k=e.useContext(ba),{delayRef:E,isInstantPhase:I,hasProvider:M}=function(t,n={open:!1}){const r="rootStore"in t?t.rootStore:t,o=r.useState("floatingId"),{open:s}=n,i=e.useContext(ss),{currentIdRef:a,delayRef:l,timeoutMs:u,initialDelayRef:c,currentContextRef:d,hasProvider:f,timeout:p}=i,[m,g]=e.useState(!1);return Nt(()=>{function e(){g(!1),d.current?.setIsInstantPhase(!1),a.current=null,d.current=null,l.current=c.current}if(a.current&&!s&&a.current===o){if(g(!1),u){const t=o;return p.start(u,()=>{r.select("open")||a.current&&a.current!==t||e()}),()=>{p.clear()}}e()}},[s,o,a,l,u,c,d,p,r]),Nt(()=>{if(!s)return;const e=d.current,t=a.current;p.clear(),d.current={onOpenChange:r.setOpen,setIsInstantPhase:g},a.current=o,l.current={open:0,close:ns(c.current,"close")},null!==t&&t!==o?(g(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,dn(Ut))):(g(!1),e?.setIsInstantPhase(!1))},[s,o,r,a,l,u,c,d,p]),Nt(()=>()=>{d.current=null},[d]),e.useMemo(()=>({hasProvider:f,delayRef:l,isInstantPhase:m}),[f,l,m])}(y,{open:b});g.useSyncedValue("isInstantPhase",I);const P=g.useState("disabled"),T=a??P,O=g.useState("trackCursorAxis");return ae("button",t,{state:{open:b},ref:[n,C,x],props:[Li(y,{enabled:!T,mouseOnly:!0,move:!1,handleClose:g.useState("disableHoverablePopup")||"both"===O?null:ra(),restMs(){const e=k?.delay,t="object"==typeof E.current?E.current.open:void 0;let n=w;return M&&(n=0!==t?l??e??w:0),n},delay(){const e="object"==typeof E.current?E.current.close:void 0;let t=R;return null==c&&M&&(t=e),{close:t}},triggerElementRef:x,isActiveTrigger:v,isClosing:()=>"ending"===g.select("transitionStatus")}),Di(y,{enabled:!T}).reference,g.useState("triggerProps",S),{onPointerDown(){g.set("closeOnClick",u)},id:h,[ya.triggerDisabled]:T?"":void 0},p],stateAttributesMapping:ga})}),Ra=e.createContext(void 0);const Ca=e.forwardRef(function(t,o){const{children:s,container:i,className:a,render:l,style:u,...c}=t,{portalNode:d,portalSubtree:f}=Ns({container:i,ref:o,componentProps:t,elementProps:c});return f||d?n.jsxs(e.Fragment,{children:[f,d&&r.createPortal(s,d)]}):null}),Sa=e.forwardRef(function(e,t){const{keepMounted:r=!1,...o}=e;return Zo().useState("mounted")||r?n.jsx(Ra.Provider,{value:r,children:n.jsx(Ca,{ref:t,...o})}):null}),ka=e.createContext(void 0);const Ea=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:u,padding:c=0,offsetParent:d="real"}=b(e,t)||{};if(null==u)return{};const f=y(c),p={x:n,y:r},m=x(o),g=R(m),h=await i.getDimensions(u),v="y"===m,S=v?"top":"left",k=v?"bottom":"right",E=v?"clientHeight":"clientWidth",I=s.reference[g]+s.reference[m]-p[m]-s.floating[g],M=p[m]-s.reference[m],P="real"===d?await(i.getOffsetParent?.(u)):a.floating;let T=a.floating[E]||s.floating[g];T&&await(i.isElement?.(P))||(T=a.floating[E]||s.floating[g]);const O=I/2-M/2,A=T/2-h[g]/2-1,D=Math.min(f[S],A),F=Math.min(f[k],A),V=D,N=T-h[g]-F,j=T/2-h[g]/2+O,B=C(V,j,N),H=!l.arrow&&null!=w(o)&&j!==B&&s.reference[g]/2-(j<V?D:F)-h[g]/2<0,z=H?j<V?j-V:j-N:0;return{[m]:p[m]+z,data:{[m]:B,centerOffset:j-B-z,...H&&{alignmentOffset:z}},reset:H}}}),Ia={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=0===t&&0===n&&0===r&&0===o,i=await S().fn(e);return{data:{referenceHidden:i.data?.referenceHidden||s}}}},Ma={sideX:"left",sideY:"top"},Pa={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=e,l=p(o),u=l.getComputedStyle(o);if(!("0s"!==u.transitionDuration&&""!==u.transitionDuration))return{x:t,y:n,data:Ma};const c=await(s.getOffsetParent?.(o));let d={width:0,height:0};if("fixed"===i&&l?.visualViewport)d={width:l.visualViewport.width,height:l.visualViewport.height};else if(c===l){const e=Xr(o);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await(s.isElement?.(c))&&(d=await s.getDimensions(c));const f=k(a);let m=t,g=n;"left"===f&&(m=d.width-(t+r.width)),"top"===f&&(g=d.height-(n+r.height));return{x:m,y:g,data:{sideX:"left"===f?"right":Ma.sideX,sideY:"top"===f?"bottom":Ma.sideY}}}};function Ta(e,t,n){const r="inline-start"===e||"inline-end"===e;return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Oa(e,t,n){const{rects:r,placement:o}=e;return{side:Ta(t,k(o),n),align:w(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Aa(t){const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,collisionBoundary:u,collisionPadding:c=5,sticky:d=!1,arrowPadding:f=5,disableAnchorTracking:m=!1,keepMounted:g=!1,floatingRootContext:h,mounted:b,collisionAvoidance:y,shiftCrossAxis:x=!1,nodeId:R,adaptiveOrigin:C,lazyFlip:S=!1,externalTree:D}=t,[F,V]=e.useState(null);b||null===F||V(null);const N=y.side||"flip",j=y.align||"flip",B=y.fallbackAxisSide||"end",H="function"==typeof n?n:void 0,z=Dt(H),L=H?z:n,W=ls(n),q=ls(b),K="rtl"===qt(),$=F||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":K?"left":"right","inline-start":K?"right":"left"}[o],U="center"===i?$:`${$}-${i}`;let G=c;const Y="bottom"===o?1:0,X="top"===o?1:0,_="right"===o?1:0,J="left"===o?1:0;"number"==typeof G?G={top:G+Y,right:G+J,bottom:G+X,left:G+_}:G&&(G={top:(G.top||0)+Y,right:(G.right||0)+J,bottom:(G.bottom||0)+X,left:(G.left||0)+_});const Q={boundary:"clipping-ancestors"===u?"clippingAncestors":u,padding:G},Z=e.useRef(null),ee=ls(s),te=ls(a),ne=[T(e=>{const t=Oa(e,o,K),n="function"==typeof ee.current?ee.current(t):ee.current,r="function"==typeof te.current?te.current(t):te.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},["function"!=typeof s?s:0,"function"!=typeof a?a:0,K,o])],re="none"===j&&"shift"!==N,oe=!re&&(d||x||"shift"===N),se="none"===N?null:E({...Q,padding:{top:G.top+1,right:G.right+1,bottom:G.bottom+1,left:G.left+1},mainAxis:!x&&"flip"===N,crossAxis:"flip"===j&&"alignment",fallbackAxisSideDirection:B}),ie=re?null:O(e=>{const t=Xr(e.elements.floating).documentElement;return{...Q,rootBoundary:x?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:"none"!==j,crossAxis:oe,limiter:d||x?void 0:A(e=>{if(!Z.current)return{};const{width:t,height:n}=Z.current.getBoundingClientRect(),r=M(k(e.placement));return{offset:("y"===r?t:n)/2+("y"===r?G.left+G.right:G.top+G.bottom)/2}})}},[Q,d,x,G,j]);var ae,le;"shift"===N||"shift"===j||"center"===i?ne.push(ie,se):ne.push(se,ie),ne.push(I({...Q,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!q.current)return;const o=e.style;o.setProperty("--available-width",`${t}px`),o.setProperty("--available-height",`${n}px`);const s=p(e).devicePixelRatio||1,{x:i,y:a,width:l,height:u}=r.reference,c=(Math.round((i+l)*s)-Math.round(i*s))/s,d=(Math.round((a+u)*s)-Math.round(a*s))/s;o.setProperty("--anchor-width",`${c}px`),o.setProperty("--anchor-height",`${d}px`)}}),(le=[f],{...Ea(ae=()=>({element:Z.current||Xr(Z.current).createElement("div"),padding:f,offsetParent:"floating"})),options:[ae,le]}),{name:"transformOrigin",fn(e){const{elements:t,middlewareData:n,placement:r,rects:i,y:a}=e,l=k(r),u=M(l),c=Z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=d+(c?.clientWidth||0)/2,m=f+(c?.clientHeight||0)/2,g=Math.abs(n.shift?.y||0),h=i.reference.height/2,v="function"==typeof s?s(Oa(e,o,K)):s,b=g>v,y={top:`${p}px calc(100% + ${v}px)`,bottom:`${p}px ${-v}px`,left:`calc(100% + ${v}px) ${m}px`,right:`${-v}px ${m}px`}[l],x=`${p}px ${i.reference.y+h-a}px`;return t.floating.style.setProperty("--transform-origin",oe&&"y"===u&&b?x:y),{}}},Ia,C),Nt(()=>{!b&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[b,h]);const ue=e.useMemo(()=>({elementResize:!m&&"undefined"!=typeof ResizeObserver,layoutShift:!m&&"undefined"!=typeof IntersectionObserver}),[m]),{refs:ce,elements:de,x:fe,y:pe,middlewareData:me,update:ge,placement:he,context:ve,isPositioned:be,floatingStyles:ye}=function(t={}){const{nodeId:n,externalTree:r}=t,o=Ti(t),s=t.rootContext||o,i={reference:s.useState("referenceElement"),floating:s.useState("floatingElement"),domReference:s.useState("domReferenceElement")},[a,u]=e.useState(null),c=e.useRef(null),d=qs(r);Nt(()=>{i.domReference&&(c.current=i.domReference)},[i.domReference]);const f=v({...t,elements:{...i,...a&&{reference:a}}}),p=e.useCallback(e=>{const t=l(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),f.refs.setReference(t)},[f.refs]),[m,g]=e.useState(void 0),[h,b]=e.useState(null);s.useSyncedValue("referenceElement",m??null);const y=l(m)?m:null;s.useSyncedValue("domReferenceElement",void 0===m?i.domReference:y),s.useSyncedValue("floatingElement",h);const x=e.useCallback(e=>{(l(e)||null===e)&&(c.current=e,g(e)),(l(f.refs.reference.current)||null===f.refs.reference.current||null!==e&&!l(e))&&f.refs.setReference(e)},[f.refs,g]),w=e.useCallback(e=>{b(e),f.refs.setFloating(e)},[f.refs]),R=e.useMemo(()=>({...f.refs,setReference:x,setFloating:w,setPositionReference:p,domReference:c}),[f.refs,x,w,p]),C=e.useMemo(()=>({...f.elements,domReference:i.domReference}),[f.elements,i.domReference]),S=s.useState("open"),k=s.useState("floatingId"),E=e.useMemo(()=>({...f,dataRef:s.context.dataRef,open:S,onOpenChange:s.setOpen,events:s.context.events,floatingId:k,refs:R,elements:C,nodeId:n,rootStore:s}),[f,R,C,n,s,S,k]);return Nt(()=>{s.context.dataRef.current.floatingContext=E;const e=d?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),e.useMemo(()=>({...f,context:E,refs:R,elements:C,rootStore:s}),[f,R,C,E,s])}({rootContext:h,open:g?b:void 0,placement:U,middleware:ne,strategy:r,whileElementsMounted:g?void 0:(...e)=>P(...e,ue),nodeId:R,externalTree:D}),{sideX:xe,sideY:we}=me.adaptiveOrigin||Ma,Re=be?r:"fixed",Ce=e.useMemo(()=>{const e=C?{position:Re,[xe]:fe,[we]:pe}:{position:Re,...ye};return be||(e.opacity=0),e},[C,Re,xe,fe,we,pe,ye,be]),Se=e.useRef(null);Nt(()=>{if(!b)return;const e=W.current,t="function"==typeof e?e():e,n=(Da(t)?t.current:t)||null||null;n!==Se.current&&(ce.setPositionReference(n),Se.current=n)},[b,ce,L,W]),e.useEffect(()=>{if(!b)return;const e=W.current;"function"!=typeof e&&Da(e)&&e.current!==Se.current&&(ce.setPositionReference(e.current),Se.current=e.current)},[b,ce,L,W]),e.useEffect(()=>{if(g&&b&&de.domReference&&de.floating)return P(de.domReference,de.floating,ge,ue)},[g,b,de,ge,ue]);const ke=k(he),Ee=Ta(o,ke,K),Ie=w(he)||"center",Me=Boolean(me.hide?.referenceHidden);Nt(()=>{S&&b&&be&&V(ke)},[S,b,be,ke]);const Pe=e.useMemo(()=>({position:"absolute",top:me.arrow?.y,left:me.arrow?.x}),[me.arrow]),Te=0!==me.arrow?.centerOffset;return e.useMemo(()=>({positionerStyles:Ce,arrowStyles:Pe,arrowRef:Z,arrowUncentered:Te,side:Ee,align:Ie,physicalSide:ke,anchorHidden:Me,refs:ce,context:ve,isPositioned:be,update:ge}),[Ce,Pe,Z,Te,Ee,Ie,ke,Me,ce,ve,be,ge])}function Da(e){return null!=e&&"current"in e}function Fa(e){return"starting"===e?Ms:Y}function Va(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:a=!1}){const l={...n};return a&&(l.pointerEvents="none"),ae("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:l},Fa(r),o],stateAttributesMapping:va})}const Na=e.forwardRef(function(t,r){const{render:o,className:s,anchor:i,positionMethod:a="absolute",side:l="top",align:u="center",sideOffset:c=0,alignOffset:d=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:v=Os,style:b,...y}=t,x=Zo(),w=function(){const t=e.useContext(Ra);if(void 0===t)throw new Error(F(70));return t}(),R=x.useState("open"),C=x.useState("mounted"),S=x.useState("trackCursorAxis"),k=x.useState("disableHoverablePopup"),E=x.useState("floatingRootContext"),I=x.useState("instantType"),M=x.useState("transitionStatus"),P=Aa({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:l,sideOffset:c,align:u,alignOffset:d,collisionBoundary:f,collisionPadding:p,sticky:g,arrowPadding:m,disableAnchorTracking:h,keepMounted:w,collisionAvoidance:v,adaptiveOrigin:x.useState("hasViewport")?Pa:void 0}),T=Va(t,e.useMemo(()=>({open:R,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:"none"!==S?"tracking-cursor":I}),[R,P.side,P.align,P.anchorHidden,S,I]),{styles:P.positionerStyles,transitionStatus:M,props:y,refs:[r,x.useStateSetter("positionerElement")],hidden:!C,inert:!R||"both"===S||k});return n.jsx(ka.Provider,{value:P,children:T})}),ja={...va,...Tn},Ba=e.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,a=Zo(),{side:l,align:u}=function(){const t=e.useContext(ka);if(void 0===t)throw new Error(F(71));return t}(),c=a.useState("open"),d=a.useState("instantType"),f=a.useState("transitionStatus"),p=a.useState("popupProps"),m=a.useState("floatingRootContext");Ko({open:c,ref:a.context.popupRef,onComplete(){c&&a.context.onOpenChangeComplete?.(!0)}});Hi(m,{enabled:!a.useState("disabled"),closeDelay:a.useState("closeDelay")});return ae("div",t,{state:{open:c,side:l,align:u,instant:d,transitionStatus:f},ref:[n,a.context.popupRef,a.useStateSetter("popupElement")],props:[p,Fa(f),i],stateAttributesMapping:ja})}),Ha=function(t){const{delay:r,closeDelay:o,timeout:s=400}=t,i=e.useMemo(()=>({delay:r,closeDelay:o}),[r,o]),a=e.useMemo(()=>({open:r,close:o}),[r,o]);return n.jsx(ba.Provider,{value:i,children:n.jsx(is,{delay:a,timeoutMs:s,children:t.children})})};function za(e){return q(19)?e:e?"true":void 0}class La{constructor(){this.store=new sa}open(e){const t=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!t)throw new Error(F(81,e));this.store.setOpen(!0,dn(cn,void 0,t))}close(){this.store.setOpen(!1,dn(cn,void 0,void 0))}get isOpen(){return this.store.state.open}}function Wa(){return new La}const qa={...Un,...Tn},Ka=e.forwardRef(function(t,r){const{render:o,className:s,defaultOpen:i=!1,disabled:a=!1,onOpenChange:l,open:u,style:c,...d}=t,f=Dt(l),p=Dn({open:u,defaultOpen:i,onOpenChange:f,disabled:a}),m=e.useMemo(()=>({open:p.open,disabled:p.disabled,transitionStatus:p.transitionStatus}),[p.open,p.disabled,p.transitionStatus]),g=e.useMemo(()=>({...p,onOpenChange:f,state:m}),[p,f,m]),h=ae("div",t,{state:m,ref:r,props:d,stateAttributesMapping:qa});return n.jsx(Fn.Provider,{value:g,children:h})}),$a={...$n,...Tn},Ua=e.forwardRef(function(t,n){const{panelId:r,open:o,handleTrigger:s,state:i,disabled:a}=Vn(),{className:l,disabled:u=a,id:c,render:d,nativeButton:f=!0,style:p,...m}=t,{getButtonProps:g,buttonRef:h}=er({disabled:u,focusableWhenDisabled:!0,native:f});return ae("button",t,{state:i,ref:[n,h],props:[e.useMemo(()=>({"aria-controls":o?r:void 0,"aria-expanded":o,onClick:s}),[r,o,s]),m,g],stateAttributesMapping:$a})});let Ga=function(e){return e.collapsiblePanelHeight="--collapsible-panel-height",e.collapsiblePanelWidth="--collapsible-panel-width",e}({});const Ya=e.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,render:i,id:a,style:l,...u}=t,{abortControllerRef:c,animationTypeRef:d,height:f,mounted:p,onOpenChange:m,open:g,panelId:h,panelRef:v,runOnceAnimationsFinish:b,setDimensions:y,setHiddenUntilFound:x,setKeepMounted:w,setMounted:R,setPanelIdState:C,setOpen:S,setVisible:k,state:E,transitionDimensionRef:I,visible:M,width:P,transitionStatus:T}=Vn(),O=o??!1,A=s??!1;Nt(()=>{if(a)return C(a),()=>{C(void 0)}},[a,C]),Nt(()=>{x(O)},[x,O]),Nt(()=>{w(A)},[w,A]);const{props:D}=Wo({abortControllerRef:c,animationTypeRef:d,externalRef:n,height:f,hiddenUntilFound:O,id:h,keepMounted:A,mounted:p,onOpenChange:m,open:g,panelRef:v,runOnceAnimationsFinish:b,setDimensions:y,setMounted:R,setOpen:S,setVisible:k,transitionDimensionRef:I,visible:M,width:P});Ko({open:g&&"idle"===T,ref:v,onComplete(){g&&y({height:void 0,width:void 0})}});const F=ae("div",t,{state:e.useMemo(()=>({...E,transitionStatus:T}),[E,T]),ref:[n,v],props:[D,{style:{[Ga.collapsiblePanelHeight]:void 0===f?"auto":`${f}px`,[Ga.collapsiblePanelWidth]:void 0===P?"auto":`${P}px`}},u],stateAttributesMapping:qa});return A||O||p?F:null});let Xa=function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.indeterminate="data-indeterminate",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({}),_a=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 Ja={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Qa={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Za={disabled:!1,...Qa},el={valid:e=>null===e?null:e?{[_a.valid]:""}:{[_a.invalid]:""}};function tl(t){return e.useMemo(()=>({checked:e=>t.indeterminate?{}:e?{[Xa.checked]:""}:{[Xa.unchecked]:""},...el}),[t.indeterminate])}const nl=e.createContext({invalid:void 0,name:void 0,validityData:{state:Ja,errors:[],error:"",value:"",initialValue:null},setValidityData:U,disabled:void 0,touched:Qa.touched,setTouched:U,dirty:Qa.dirty,setDirty:U,filled:Qa.filled,setFilled:U,focused:Qa.focused,setFocused:U,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Za,markedDirtyRef:{current:!1},registerFieldControl:U,validation:{getValidationProps:(e=Y)=>e,getInputValidationProps:(e=Y)=>e,inputRef:{current:null},commit:async()=>{}}});function rl(t=!0){const n=e.useContext(nl);if(n.setValidityData===U&&!t)throw new Error(F(28));return n}function ol(t,n){const{enabled:r=!0,getValue:o,id:s,value:i}=n,{registerFieldControl:a}=rl(),l=e.useRef(null);l.current||(l.current=Symbol()),Nt(()=>{const e=l.current;if(e&&r)return a(e,{controlRef:t,getValue:o,id:s,value:i}),()=>{a(e,void 0)}},[t,r,o,s,a,i])}const sl=e.createContext({disabled:!1});function il(){return e.useContext(sl)}const al=e.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:U,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function ll(){return e.useContext(al)}const ul=e.createContext({controlId:void 0,registerControlId:U,labelId:void 0,setLabelId:U,messageIds:[],setMessageIds:U,getDescriptionProps:e=>e});function cl(){return e.useContext(ul)}function dl(t,n,r,o=!0,s){const[i,a]=e.useState(),l=yn(s?`${s}-label`:void 0),u=t??n??i;return Nt(()=>{const e=t||n||!o?void 0:function(e,t){const n=function(e){if(!e)return;const t=e.parentElement;if(t&&"LABEL"===t.tagName)return t;const n=e.id;if(n){const t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}const r=e.labels;return r&&r[0]}(e);if(!n)return;!n.id&&t&&(n.id=t);return n.id||void 0}(r.current,l);i!==e&&a(e)}),u}const fl=e.createContext(void 0);const pl=e.createContext(void 0);function ml(t,n){const r=e.useRef(t),o=Dt(n);Nt(()=>{r.current!==t&&o(r.current)},[t,o]),Nt(()=>{r.current=t},[t])}const gl="data-parent",hl=e.forwardRef(function(t,r){const{checked:o,className:s,defaultChecked:i=!1,"aria-labelledby":a,disabled:l=!1,form:u,id:c,indeterminate:d=!1,inputRef:f,name:p,onCheckedChange:m,parent:g=!1,readOnly:h=!1,render:v,required:b=!1,uncheckedValue:y,value:x,nativeButton:w=!1,style:R,...C}=t,{clearErrors:S}=ll(),{disabled:k,name:E,setDirty:I,setFilled:M,setFocused:P,setTouched:T,state:O,validationMode:A,validityData:D,shouldValidateOnChange:V,validation:N}=rl(),j=il(),{labelId:z,controlId:L,registerControlId:W,getDescriptionProps:q}=cl(),K=function(t=!0){const n=e.useContext(fl);if(void 0===n&&!t)throw new Error(F(3));return n}(),$=K?.parent,G=$&&K.allValues,X=k||j.disabled||K?.disabled||l,J=E??p,Q=x??J,Z=yn(),ee=yn();let te=L;G?te=g?ee:`${$.id}-${Q}`:c&&(te=c);let ne={};G&&(g?ne=K.parent.getParentProps():Q&&(ne=K.parent.getChildProps(Q)));const re=Dt(m),{checked:oe=o,indeterminate:se=d,onCheckedChange:ie,...le}=ne,ue=K?.value,ce=K?.setValue,de=K?.defaultValue,fe=e.useRef(null),pe=B(()=>Symbol("checkbox-control")),me=e.useRef(!1),{getButtonProps:ge,buttonRef:he}=er({disabled:X,native:w}),ve=K?.validation??N,[be,ye]=Tt({controlled:Q&&ue&&!g?ue.includes(Q):oe,default:Q&&de&&!g?de.includes(Q):i,name:"Checkbox",state:"checked"});Nt(()=>{W!==U&&(me.current=!0,W(pe.current,te))},[te,K,W,g,pe]),e.useEffect(()=>{const e=pe.current;return()=>{me.current&&W!==U&&(me.current=!1,W(e,void 0))}},[W,pe]),ol(fe,{enabled:!K,id:Z,value:be});const xe=e.useRef(null),we=H(f,xe,ve.inputRef),Re=dl(a,z,xe,!w,te??void 0);Nt(()=>{xe.current&&(xe.current.indeterminate=se,be&&M(!0))},[be,se,M]),ml(be,()=>{K&&!g||(S(J),M(be),I(be!==D.initialValue),V()?ve.commit(be):ve.commit(be,!0))});const Ce=_({checked:be,disabled:X,form:u,name:g?void 0:J,id:w?void 0:te??void 0,required:b,ref:we,style:J?fs:ds,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(h)return void e.preventDefault();const t=e.currentTarget.checked,n=dn(Ut,e.nativeEvent);if(ie?.(t,n),re(t,n),!n.isCanceled&&(ye(t),Q&&ue&&ce&&!g&&!G)){const e=t?[...ue,Q]:ue.filter(e=>e!==Q);ce(e,n)}},onFocus(){fe.current?.focus()}},void 0!==x?{value:(K?be&&x:x)||""}:Y,q,K?ve.getValidationProps:ve.getInputValidationProps),Se=G?Boolean(oe):be,ke=G&&se||d;e.useEffect(()=>{if(!$||!Q)return;const e=$.disabledStatesRef.current;return e.set(Q,X),()=>{e.delete(Q)}},[$,X,Q]);const Ee=e.useMemo(()=>({...O,checked:Se,disabled:X,readOnly:h,required:b,indeterminate:ke}),[O,Se,X,h,b,ke]),Ie=tl(Ee),Me=ae("span",t,{state:Ee,ref:[he,fe,r,K?.registerControlRef],props:[{id:w?te??void 0:Z,role:"checkbox","aria-checked":se?"mixed":be,"aria-readonly":h||void 0,"aria-required":b||void 0,"aria-labelledby":Re,[gl]:g?"":void 0,onFocus(){P(!0)},onBlur(){const e=xe.current;e&&(T(!0),P(!1),"onBlur"===A&&ve.commit(K?ue:e.checked))},onClick(e){h||X||(e.preventDefault(),xe.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},q,ve.getValidationProps,C,le,ge],stateAttributesMapping:Ie});return n.jsxs(pl.Provider,{value:Ee,children:[Me,!be&&!K&&J&&!g&&void 0!==y&&n.jsx("input",{type:"hidden",form:u,name:J,value:y}),n.jsx("input",{...Ce,suppressHydrationWarning:!0})]})}),vl=e.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,l=function(){const t=e.useContext(pl);if(void 0===t)throw new Error(F(14));return t}(),u=l.checked||l.indeterminate,{mounted:c,transitionStatus:d,setMounted:f}=An(u),p=e.useRef(null),m={...l,transitionStatus:d};Ko({open:u,ref:p,onComplete(){u||f(!1)}});const g=tl(l),h=i||c,v=ae("span",t,{ref:[n,p],state:m,stateAttributesMapping:e.useMemo(()=>({...g,...Tn,...el}),[g]),props:a});return h?v:null}),bl=e.createContext(void 0),yl=e.createContext(void 0),xl=e.createContext(void 0),wl=e.createContext("");function Rl(){const t=e.useContext(bl);if(!t)throw new Error(F(22));return t}function Cl(){const t=e.useContext(yl);if(!t)throw new Error(F(23));return t}function Sl(){const t=e.useContext(xl);if(!t)throw new Error(F(24));return t}function kl(){return e.useContext(wl)}const El=(e,t)=>Object.is(e,t);function Il(e,t,n){return null==e||null==t?Object.is(e,t):n(e,t)}function Ml(e,t,n){return e&&0!==e.length?e.findIndex(e=>void 0!==e&&Il(e,t,n)):-1}function Pl(e){if(null==e)return"";if("string"==typeof e)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tl(e){return null!=e&&e.length>0&&"object"==typeof e[0]&&null!=e[0]&&"items"in e[0]}function Ol(e,t){if(t&&null!=e)return t(e)??"";if(e&&"object"==typeof e){if("label"in e&&null!=e.label)return String(e.label);if("value"in e)return String(e.value)}return Pl(e)}function Al(e,t){return t&&null!=e?t(e)??"":Pl(e&&"object"==typeof e&&"value"in e&&"label"in e?e.value:e)}function Dl(e,t,n){function r(){return Ol(e,n)}if(n&&null!=e)return n(e);if(e&&"object"==typeof e&&"label"in e&&null!=e.label)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const n=t,o=Tl(n)?n.flatMap(e=>e.items):n;if(null==e||"object"!=typeof e){const t=o.find(t=>t.value===e);return t&&null!=t.label?t.label:r()}if("value"in e){const t=o.find(t=>t&&t.value===e.value);if(t&&null!=t.label)return t.label}}return r()}const Fl={id:ri(e=>e.id),labelId:ri(e=>e.labelId),items:ri(e=>e.items),selectedValue:ri(e=>e.selectedValue),hasSelectionChips:ri(e=>{const t=e.selectedValue;return Array.isArray(t)&&t.length>0}),hasSelectedValue:ri(e=>{const{selectedValue:t,selectionMode:n}=e;return null!=t&&("multiple"!==n||!Array.isArray(t)||t.length>0)}),hasNullItemLabel:ri((e,t)=>!!t&&function(e){if(!Array.isArray(e))return null!=e&&"null"in e;const t=e;if(Tl(t)){for(const e of t)for(const t of e.items)if(t&&null==t.value&&null!=t.label)return!0;return!1}for(const n of t)if(n&&null==n.value&&null!=n.label)return!0;return!1}(e.items)),open:ri(e=>e.open),mounted:ri(e=>e.mounted),forceMounted:ri(e=>e.forceMounted),inline:ri(e=>e.inline),activeIndex:ri(e=>e.activeIndex),selectedIndex:ri(e=>e.selectedIndex),isActive:ri((e,t)=>e.activeIndex===t),isSelected:ri((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>Il(t,e,n)):Il(t,r,n)}),transitionStatus:ri(e=>e.transitionStatus),popupProps:ri(e=>e.popupProps),inputProps:ri(e=>e.inputProps),triggerProps:ri(e=>e.triggerProps),getItemProps:ri(e=>e.getItemProps),positionerElement:ri(e=>e.positionerElement),listElement:ri(e=>e.listElement),triggerElement:ri(e=>e.triggerElement),inputElement:ri(e=>e.inputElement),inputGroupElement:ri(e=>e.inputGroupElement),popupSide:ri(e=>e.popupSide),openMethod:ri(e=>e.openMethod),inputInsidePopup:ri(e=>e.inputInsidePopup),selectionMode:ri(e=>e.selectionMode),name:ri(e=>e.name),form:ri(e=>e.form),disabled:ri(e=>e.disabled),readOnly:ri(e=>e.readOnly),required:ri(e=>e.required),grid:ri(e=>e.grid),virtualized:ri(e=>e.virtualized),itemToStringLabel:ri(e=>e.itemToStringLabel),isItemEqualToValue:ri(e=>e.isItemEqualToValue),modal:ri(e=>e.modal),autoHighlight:ri(e=>e.autoHighlight),submitOnItemClick:ri(e=>e.submitOnItemClick)};function Vl(t={}){const{id:n,implicit:r=!1,controlRef:o}=t,{controlId:s,registerControlId:i}=cl(),a=yn(n),u=r?s:void 0,c=B(()=>Symbol("labelable-control")),d=e.useRef(!1),f=e.useRef(null!=n),p=Dt(()=>{d.current&&i!==U&&(d.current=!1,i(c.current,void 0))});return Nt(()=>{if(i===U)return;let e;if(r){const t=o?.current;e=l(t)&&null!=t.closest("label")?n??null:u??a}else if(null!=n)f.current=!0,e=n;else{if(!f.current)return void p();e=a}void 0!==e?(d.current=!0,i(c.current,e)):p()},[n,o,u,i,r,a,c,p]),e.useEffect(()=>p,[p]),s??a}const Nl=new Map;function jl(e){return Array.isArray(e)?e.map(e=>jl(e)).join(","):null==e?"":String(e)}const Bl=function(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${jl(e.locale)}|${JSON.stringify(t)}`,r=Nl.get(n);if(r)return r;const o=new Intl.Collator(e.locale,t),s={contains(e,t,n){if(!t)return!0;const r=Ol(e,n);for(let s=0;s<=r.length-t.length;s+=1)if(0===o.compare(r.slice(s,s+t.length),t))return!0;return!1},startsWith(e,t,n){if(!t)return!0;const r=Ol(e,n);return 0===o.compare(r.slice(0,t.length),t)},endsWith(e,t,n){if(!t)return!0;const r=Ol(e,n),s=t.length;return r.length>=s&&0===o.compare(r.slice(r.length-s),t)}};return Nl.set(n,s),s};function Hl(t){const[n,r]=e.useState(null),o=Dt((e,n)=>{t||r(n||(ar?"touch":""))});ml(t,e=>{e&&!t&&r(null)});const{onClick:s,onPointerDown:i}=function(t){const n=e.useRef(""),r=e.useCallback(e=>{e.defaultPrevented||(n.current=e.pointerType,t(e,e.pointerType))},[t]);return{onClick:e.useCallback(e=>{0!==e.detail?(t(e,"pointerType"in e?e.pointerType:n.current),n.current=""):t(e,"keyboard")},[t]),onPointerDown:r}}(o);return e.useMemo(()=>({openMethod:n,triggerProps:{onClick:s,onPointerDown:i}}),[n,s,i])}const zl=Symbol("none"),Ll={value:zl,index:-1};function Wl(t){const{id:r,onOpenChangeComplete:o,defaultSelectedValue:s=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:l,inputValue:u,open:c,defaultOpen:d=!1,selectionMode:f="none",onItemHighlighted:p,name:m,form:g,disabled:h=!1,readOnly:v=!1,required:b=!1,inputRef:y,grid:x=!1,items:w,filteredItems:R,filter:C,openOnInputClick:S=!0,autoHighlight:k=!1,keepHighlight:E=!1,highlightItemOnHover:I=!0,loopFocus:M=!0,itemToStringLabel:P,itemToStringValue:T,isItemEqualToValue:O=El,virtualized:A=!1,inline:D=!1,fillInputOnItemPress:F=!0,modal:V=!1,limit:N=-1,autoComplete:j="list",formAutoComplete:z,locale:L,submitOnItemClick:W=!1}=t,{clearErrors:q}=ll(),{setDirty:K,validityData:$,shouldValidateOnChange:X,setFilled:_,name:J,disabled:Q,setTouched:Z,setFocused:ee,validationMode:te,validation:ne}=rl(),re=Vl({id:r}),oe=Bl({locale:L}),[se,ie]=e.useState(!1),[ae,le]=e.useState(null),ue=e.useRef([]),ce=e.useRef([]),de=e.useRef(null),fe=e.useRef(null),pe=e.useRef(null),me=e.useRef(null),ge=e.useRef(null),he=e.useRef(!0),ve=e.useRef(!1),be=e.useRef(null),ye=e.useRef(null),xe=e.useRef(null),we=e.useRef(Ll),Re=e.useRef(null),Ce=e.useRef([]),Se=e.useRef([]),ke=Q||h,Ee=J??m,Ie="multiple"===f,Me="single"===f,Pe=void 0!==u||void 0!==l,Te=void 0!==w,Oe=void 0!==R;let Ae;Ae="always"===k?"always":!!k&&"input-change";const[De,Fe]=Tt({controlled:i,default:Ie?s??G:s,name:"Combobox",state:"selectedValue"}),Ve=e.useMemo(()=>null===C?()=>!0:void 0!==C?C:Me&&!se?function(e,t,n){return(r,o)=>{if(null==r)return!1;if(!o)return!0;const s=Ol(r,t),i=null!=n?Ol(n,t):"";return!(!i||!e.contains(i,o)||i.length!==o.length)||e.contains(s,o)}}(oe,P,De):function(e,t){return(n,r)=>{if(null==n)return!1;const o=Ol(n,t);return e.contains(o,r)}}(oe,P),[C,Me,De,se,oe,P]),Ne=B(()=>Pe?l??"":Me?Ol(De,P):"").current,[je,Be]=Tt({controlled:u,default:Ne,name:"Combobox",state:"inputValue"}),[He,ze]=Tt({controlled:c,default:d,name:"Combobox",state:"open"}),Le=Tl(w),We=ae??(""===je?"":String(je).trim()),qe=Me?Ol(De,P):"",Ke=Me&&!se&&""!==We&&""!==qe&&qe.length===We.length&&oe.contains(qe,We),$e=Ke?"":We,Ue=Te&&Oe&&Ke,Ge=e.useMemo(()=>w?Le?w.flatMap(e=>e.items):w:G,[w,Le]),Ye=e.useMemo(()=>{if(R&&!Ue)return R;if(!w)return G;if(Le){const e=w,t=[];let n=0;for(const r of e){if(N>-1&&n>=N)break;const e=""===$e?r.items:r.items.filter(e=>Ve(e,$e,P));if(0===e.length)continue;const o=N>-1?N-n:1/0,s=e.slice(0,o);if(s.length>0){const e={...r,items:s};t.push(e),n+=s.length}}return t}if(""===$e)return N>-1?Ge.slice(0,N):Ge;const e=[];for(const t of Ge){if(N>-1&&e.length>=N)break;Ve(t,$e,P)&&e.push(t)}return e},[R,Ue,w,Le,$e,N,Ve,P,Ge]),Xe=e.useMemo(()=>{if(Le){return Ye.flatMap(e=>e.items)}return Ye},[Ye,Le]),_e=B(()=>new bi({id:re,labelId:void 0,selectedValue:De,open:He,filter:Ve,query:We,items:w,selectionMode:f,listRef:ue,labelsRef:ce,popupRef:de,emptyRef:ge,inputRef:fe,startDismissRef:pe,endDismissRef:me,keyboardActiveRef:he,chipsContainerRef:be,clearRef:ye,valuesRef:Ce,allValuesRef:Se,selectionEventRef:xe,name:Ee,form:g,disabled:ke,readOnly:v,required:b,grid:x,isGrouped:Le,virtualized:A,openOnInputClick:S,itemToStringLabel:P,isItemEqualToValue:O,modal:V,autoHighlight:Ae,submitOnItemClick:W,hasInputValue:Pe,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:D,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:o||U,setOpen:U,setInputValue:U,setSelectedValue:U,setIndices:U,onItemHighlighted:U,handleSelection:U,getItemProps:()=>Y,forceMount:U,requestSubmit:U})).current,Je="none"===f?je:De,Qe=e.useMemo(()=>"none"===f?Je:Array.isArray(De)?De.map(e=>Al(e,T)):Al(De,T),[Je,T,f,De]),Ze=Dt(p),et=Dt(o),tt=hi(_e,Fl.activeIndex),nt=hi(_e,Fl.selectedIndex),rt=hi(_e,Fl.positionerElement),ot=hi(_e,Fl.listElement),st=hi(_e,Fl.triggerElement),it=hi(_e,Fl.inputElement),at=hi(_e,Fl.inputGroupElement),lt=hi(_e,Fl.inline),ut=hi(_e,Fl.inputInsidePopup),ct=ls(st),{mounted:dt,setMounted:ft,transitionStatus:pt}=An(He),{openMethod:mt,triggerProps:gt}=Hl(He),ht=Dt(()=>Qe);ol(ut?ct:fe,{id:re,value:Je,getValue:ht});const vt=Dt(()=>{w?ce.current=Xe.map(e=>Ol(e,P)):_e.set("forceMounted",!0)}),bt=e.useRef(De);Nt(()=>{De!==bt.current&&vt()},[vt,De]);const yt=Dt(e=>{_e.update(e);const t=e.type||"none";if(void 0!==e.activeIndex)if(null===e.activeIndex)we.current!==Ll&&(we.current=Ll,Ze(void 0,fn(t,void 0,{index:-1})));else{const n=Ce.current[e.activeIndex];we.current={value:n,index:e.activeIndex},Ze(n,fn(t,void 0,{index:e.activeIndex}))}}),xt=Dt((e,n)=>{if(ve.current=n.reason===nn,t.onInputValueChange?.(e,n),!n.isCanceled){if(n.reason===tn){const t=n.event,r=t.inputType;if("compositionend"===t.type||null!=r&&""!==r&&"insertReplacementText"!==r){const t=""!==e.trim();t&&ie(!0),Re.current={hasQuery:t},t&&Ae&&null==_e.state.activeIndex&&_e.set("activeIndex",0)}}Be(e)}}),wt=Dt((e,n)=>{if(He!==e&&("escape-key"===n.reason&&Te&&0===Xe.length&&!_e.state.emptyRef.current&&n.allowPropagation(),t.onOpenChange?.(e,n),!n.isCanceled&&(!e&&se&&(Me?(lt||le(We),""===We&&ie(!1)):Ie&&(lt||ut?yt({activeIndex:null}):le(We),xt("",dn(nn,n.event)))),ze(e),!e&&ut&&(n.reason===on||n.reason===_t)&&(Z(!0),ee(!1),"onBlur"===te)))){const e="none"===f?je:De;ne.commit(e)}}),Rt=Dt((e,t)=>{if(a?.(e,t),t.isCanceled)return;Fe(e);("none"===f&&de.current&&F||Me&&!_e.state.inputInsidePopup)&&xt(Ol(e,P),dn(t.reason,t.event)),Me&&null!=e&&t.reason!==tn&&se&&!lt&&le(We)}),Ct=Dt((e,t)=>{let n=t;if(void 0===n){if(null===tt)return;n=Ce.current[tt]}const r=Cr(e),o=xe.current??e;xe.current=null;const s=dn(Jt,o),i=r?.closest("a")?.getAttribute("href");if(i)i.startsWith("#")&&wt(!1,s);else if(Ie){const e=Array.isArray(De)?De:[],t=function(e,t,n){return!(!e||0===e.length)&&e.some(e=>void 0!==e&&Il(t,e,n))}(e,n,_e.state.isItemEqualToValue),r=t?function(e,t,n){return e.filter(e=>!Il(t,e,n))}(e,n,_e.state.isItemEqualToValue):[...e,n];Rt(r,s);if(!(!!fe.current&&""!==fe.current.value.trim()))return;_e.state.inputInsidePopup?xt("",dn(nn,s.event)):wt(!1,s)}else Rt(n,s),wt(!1,s)}),St=Dt(()=>{if(!_e.state.submitOnItemClick)return;const e=ne.inputRef.current?.form??_e.state.inputElement?.form;e&&"function"==typeof e.requestSubmit&&e.requestSubmit()}),kt=Dt(()=>{if(ft(!1),et?.(!1),ie(!1),le(null),yt("none"===f?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ie&&fe.current&&""!==fe.current.value&&!ve.current&&xt("",dn(nn)),Me)if(_e.state.inputInsidePopup)fe.current&&""!==fe.current.value&&xt("",dn(nn));else{const e=Ol(De,P);if(fe.current&&fe.current.value!==e){xt(e,dn(""===e?nn:Ut))}}}),Et=e.useMemo(()=>lt&&rt?{current:rt.closest('[role="dialog"]')}:de,[lt,rt]);Ko({enabled:!t.actionsRef,open:He,ref:Et,onComplete(){He||kt()}}),e.useImperativeHandle(t.actionsRef,()=>({unmount:kt}),[kt]),Nt(function(){if(He||"none"===f)return;const e=w?Ge:Se.current;if(Ie){const t=Array.isArray(De)?De:[],n=Ml(e,t[t.length-1],O);yt({selectedIndex:-1===n?null:n})}else{const t=Ml(e,De,O);yt({selectedIndex:-1===t?null:t})}},[He,De,w,f,Ge,Ie,O,yt]),Nt(()=>{w&&(Ce.current=Xe,ue.current.length=Xe.length)},[w,Xe]),Nt(()=>{const e=Re.current;if(e&&(e.hasQuery?Ae&&_e.set("activeIndex",0):"always"===Ae&&_e.set("activeIndex",0),Re.current=null),!He&&!lt)return;const t=Te||Oe?Xe:Ce.current,n=_e.state.activeIndex;if(null==n)return"always"===Ae&&t.length>0?void _e.set("activeIndex",0):void(we.current!==Ll&&(we.current=Ll,_e.state.onItemHighlighted(void 0,fn(Ut,void 0,{index:-1}))));if(n>=t.length)return we.current!==Ll&&(we.current=Ll,_e.state.onItemHighlighted(void 0,fn(Ut,void 0,{index:-1}))),void _e.set("activeIndex",null);const r=t[n],o=we.current.value,s=o!==zl&&Il(r,o,_e.state.isItemEqualToValue);we.current.index===n&&s||(we.current={value:r,index:n},_e.state.onItemHighlighted(r,fn(Ut,void 0,{index:n})))},[tt,Ae,Oe,Te,Xe,lt,He,_e]),Nt(()=>{_("none"!==f?Ie?Array.isArray(De)&&De.length>0:null!=De:""!==String(je))},[_,f,je,De,Ie]),e.useEffect(()=>{Te&&Ae&&0===Xe.length&&yt({activeIndex:null})},[Te,Ae,Xe.length,yt]),ml(We,()=>{He&&""!==We&&We!==String(Ne)&&ie(!0)}),ml(De,()=>{if("none"!==f&&(q(Ee),K(De!==$.initialValue),X()?ne.commit(De):ne.commit(De,!0),Me&&!Pe&&!ut)){const e=Ol(De,P);je!==e&&xt(e,dn(Ut))}}),ml(je,()=>{"none"===f&&(q(Ee),K(je!==$.initialValue),X()?ne.commit(je):ne.commit(je,!0))}),ml(w,()=>{if(!Me||Pe||ut||se)return;const e=Ol(De,P);je!==e&&xt(e,dn(Ut))});const It=Ti({open:!!lt||He,onOpenChange:wt,elements:{reference:ut?st:it,floating:rt}});let Mt,Pt;lt||(Mt=x?"grid":"listbox",Pt=He?"true":"false");const Ot=e.useMemo(()=>{const e=null==it||"INPUT"===it?.tagName,t=e?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return(e||He)&&(t.role="combobox",t["aria-expanded"]=Pt,t["aria-haspopup"]=Mt,t["aria-controls"]=He?ot?.id:void 0,t["aria-autocomplete"]=j),{reference:t,floating:{role:"presentation"}}},[it,He,Pt,Mt,ot?.id,j]),At=Qs(It,{enabled:!v&&!ke&&S,event:"mousedown-only",toggle:!1,touchOpenDelay:ut?0:100,reason:rn}),Ft=ni(It,{enabled:!v&&!ke&&!lt,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:!!lt||void 0,outsidePress(e){const t=Cr(e);return!(Rr(st,t)||Rr(ye.current,t)||Rr(be.current,t)||Rr(at,t))}}),Vt=Yi(It,{enabled:!v&&!ke,id:re,listRef:ue,activeIndex:tt,selectedIndex:nt,virtual:!0,loopFocus:M,allowEscape:M&&!Ae,focusItemOnOpen:!(se||"none"===f&&!Ae)&&"auto",focusItemOnHover:I,resetOnPointerLeave:!E,cols:x?2:1,orientation:x?"horizontal":void 0,disabledIndices:G,onNavigate(e,t){(t||He)&&"ending"!==pt&&yt(t?{activeIndex:e,type:he.current?"keyboard":"pointer"}:{activeIndex:e})}}),{getReferenceProps:jt,getFloatingProps:Bt,getItemProps:Ht}=Wi([Ot,At,Ft,Vt]);Jo(()=>{_e.update({inline:D,popupProps:Bt(),inputProps:jt(),triggerProps:gt,getItemProps:Ht,setOpen:wt,setInputValue:xt,setSelectedValue:Rt,setIndices:yt,onItemHighlighted:Ze,handleSelection:Ct,forceMount:vt,requestSubmit:St})}),Nt(()=>{_e.update({id:re,selectedValue:De,open:He,mounted:dt,transitionStatus:pt,items:w,inline:D,popupProps:Bt(),inputProps:jt(),triggerProps:gt,openMethod:mt,getItemProps:Ht,selectionMode:f,name:Ee,form:g,disabled:ke,readOnly:v,required:b,grid:x,isGrouped:Le,virtualized:A,onOpenChangeComplete:et,openOnInputClick:S,itemToStringLabel:P,modal:V,autoHighlight:Ae,isItemEqualToValue:O,submitOnItemClick:W,hasInputValue:Pe,requestSubmit:St})},[_e,re,De,He,dt,pt,w,Bt,jt,Ht,mt,gt,f,Ee,ke,v,b,ne,x,Le,A,et,S,P,V,O,W,Pe,D,St,Ae,g]);const zt=H(y,ne.inputRef),Lt=e.useMemo(()=>({query:We,hasItems:Te,filteredItems:Ye,flatFilteredItems:Xe}),[We,Te,Ye,Xe]),Wt=e.useMemo(()=>Array.isArray(Je)?"":Al(Je,T),[Je,T]),qt=Ie&&Array.isArray(De)&&De.length>0,Kt=Ie||"none"===f?void 0:Ee,$t=e.useMemo(()=>Ie&&Array.isArray(De)&&Ee?De.map(e=>{const t=Al(e,T);return n.jsx("input",{type:"hidden",form:g,name:Ee,value:t},t)}):null,[Ie,De,g,Ee,T]),Gt=n.jsxs(e.Fragment,{children:[t.children,n.jsx("input",{...ne.getInputValidationProps({onFocus(){ut?st?.focus():(fe.current||st)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented)return;const t=e.currentTarget.value,n=dn(Ut,e.nativeEvent);function r(){if(Ie)return;if("none"===f)return K(t!==$.initialValue),xt(t,n),void(X()&&ne.commit(t));const e=Ce.current.find(e=>{if(Al(e,T).toLowerCase()===t.toLowerCase())return!0;return Ol(e,P).toLowerCase()===t.toLowerCase()});null!=e&&(K(e!==$.initialValue),Rt?.(e,n),X()&&ne.commit(e))}w?r():(vt(),queueMicrotask(r))}}),id:re&&null==Kt?`${re}-hidden-input`:void 0,form:g,name:Kt,autoComplete:z,disabled:ke,required:b&&!qt,readOnly:v,value:Wt,ref:zt,style:Kt?fs:ds,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),$t]});return n.jsx(bl.Provider,{value:_e,children:n.jsx(yl.Provider,{value:It,children:n.jsx(xl.Provider,{value:Lt,children:n.jsx(wl.Provider,{value:je,children:Gt})})})})}function ql(e){const{multiple:t=!1,defaultValue:r,value:o,onValueChange:s,autoComplete:i,...a}=e;return n.jsx(Wl,{...a,selectionMode:t?"multiple":"single",selectedValue:o,defaultSelectedValue:r,onSelectedValueChange:s,formAutoComplete:i})}function Kl(e={}){const{id:t,fallbackControlId:n,native:r=!1,setLabelId:o,focusControl:s}=e,{controlId:a,setLabelId:l}=cl(),u=function(e,t){const n=yn(e);return Nt(()=>(t(n),()=>{t(void 0)}),[n,t]),n}(t,Dt(e=>{l(e),o?.(e)})),c=a??n;function d(e){const t=Cr(e.nativeEvent);t?.closest("button,input,select,textarea")||(!e.defaultPrevented&&e.detail>1&&e.preventDefault(),r||function(e){if(s)return void s(e,c);if(!c)return;const t=Xr(e.currentTarget).getElementById(c);i(t)&&t.focus({focusVisible:!0})}(e))}return r?{id:u,htmlFor:c??void 0,onMouseDown:d}:{id:u,onClick:d,onPointerDown(e){e.preventDefault()}}}function $l(e,t){return e??t}function Ul(t){const{children:r,placeholder:o}=t,s=Rl(),i=hi(s,Fl.itemToStringLabel),a=hi(s,Fl.selectedValue),l=hi(s,Fl.items),u="multiple"===hi(s,Fl.selectionMode),c=hi(s,Fl.hasSelectedValue),d=hi(s,Fl.hasNullItemLabel,!c&&null!=o&&null==r);let f=null;return f="function"==typeof r?r(a):null!=r?r:c||null==o||d?u&&Array.isArray(a)?function(t,r,o){return t.reduce((t,s,i)=>(i>0&&t.push(", "),t.push(n.jsx(e.Fragment,{children:Dl(s,r,o)},i)),t),[])}(a,l,i):Dl(a,l,i):o,n.jsx(e.Fragment,{children:f})}const Gl={...ha,...el,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},Yl=e.createContext(void 0);function Xl(){return e.useContext(Yl)}const _l=e.createContext(void 0);function Jl(t){const n=e.useContext(_l);if(void 0===n&&!t)throw new Error(F(21));return n}const Ql=e.forwardRef(function(e,t){const r=Rl(),{buttonRef:o,getButtonProps:s}=er({native:!1}),i=H(t,o),a=s({onClick:Dt(e=>{r.state.setOpen(!1,dn(Qt,e.nativeEvent,e.currentTarget))})});return n.jsx("span",{ref:i,...a,"aria-label":"Dismiss",tabIndex:void 0,style:fs})}),Zl=e.forwardRef(function(t,r){const{render:o,className:s,disabled:i=!1,id:a,style:l,...u}=t,{state:c,disabled:d,setTouched:f,setFocused:p,validationMode:m,validation:g}=rl(),{labelId:h}=cl(),v=Xl(),b=Jl(!0),y=Boolean(b),x=Rl(),{filteredItems:w}=Sl(),R=kl(),C=qt(),S=hi(x,Fl.required),k=hi(x,Fl.disabled),E=hi(x,Fl.readOnly),I=hi(x,Fl.name),M=hi(x,Fl.form),P=hi(x,Fl.selectionMode),T=hi(x,Fl.autoHighlight),O=hi(x,Fl.inputProps),A=hi(x,Fl.triggerProps),D=hi(x,Fl.open),F=hi(x,Fl.mounted),V=hi(x,Fl.selectedValue),N=hi(x,Fl.popupSide),j=hi(x,Fl.positionerElement),B=hi(x,Fl.id),H=hi(x,Fl.inline),z=hi(x,Fl.modal),L=Boolean(T),W=F&&j?N:null,q=d||k||i,K=0===w.length,$=y||H,U=!$||z,G=yn(a??($?void 0:B)),Y=$l(h,void 0),X=y?Qa:c,[_,J]=e.useState(null),Q=e.useRef(!1),Z=e.useRef(null),ee=e.useRef(!1),te=Dt(e=>{const t=y||x.state.inline;t&&!x.state.hasInputValue&&x.state.setInputValue("",dn(Ut)),x.update({inputElement:e,inputInsidePopup:t})}),ne=y||!g?u:g.getValidationProps(u);const re=ae("input",t,{state:{...X,open:D,disabled:q,readOnly:E,popupSide:W,listEmpty:K},ref:[r,x.state.inputRef,te],props:[O,A,{type:"text",value:t.value??_??R,"aria-readonly":E||void 0,"aria-required":S||void 0,"aria-labelledby":Y,disabled:q,readOnly:E,required:"none"===P?S:void 0,form:M,..."none"===P&&I&&{name:I},id:G,onFocus(){if(p(!0),!H||!ee.current)return;ee.current=!1;const e=Z.current;null!=e&&Object.hasOwn(x.state.valuesRef.current,e)&&x.state.setIndices({activeIndex:e})},onBlur(){f(!0),p(!1);const e=x.state.activeIndex;if(H&&null!==e&&"always"!==T&&(Z.current=e,ee.current=!0,x.state.setIndices({activeIndex:null})),"onBlur"===m){const e="none"===P?R:V;g.commit(e)}},onCompositionStart(e){cr||(Q.current=!0,J(e.currentTarget.value))},onCompositionEnd(e){Q.current=!1;const t=e.currentTarget.value;J(null),x.state.setInputValue(t,dn(tn,e.nativeEvent))},onChange(e){const t=e.nativeEvent.inputType,n=!t||"insertReplacementText"===t,r=Q.current||!n;if(Q.current){const t=e.currentTarget.value;J(t),""!==t||x.state.openOnInputClick||x.state.inputInsidePopup||x.state.setOpen(!1,dn(nn,e.nativeEvent));const n=t.trim(),o=L&&""!==n;return E||q||!n||r&&(x.state.setOpen(!0,dn(tn,e.nativeEvent)),L||x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?"keyboard":"pointer"})),void(D&&null!==x.state.activeIndex&&!o&&x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?"keyboard":"pointer"}))}x.state.setInputValue(e.currentTarget.value,dn(tn,e.nativeEvent));const o=""===e.currentTarget.value,s=dn(nn,e.nativeEvent);o&&!x.state.inputInsidePopup&&("single"===P&&x.state.setSelectedValue(null,s),x.state.openOnInputClick||x.state.setOpen(!1,s));const i=e.currentTarget.value.trim();E||q||!i||r&&(x.state.setOpen(!0,dn(tn,e.nativeEvent)),L||x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?"keyboard":"pointer"})),D&&null!==x.state.activeIndex&&!L&&x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(e){if(q||E)return;if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;x.state.keyboardActiveRef.current=!0;const t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r="rtl"===C;if("Home"===e.key){Dr(e);const n=lr&&r?t.value.length:0;return t.setSelectionRange(n,n),void(t.scrollLeft=0)}if("End"===e.key){Dr(e);const o=lr&&r?0:t.value.length;return t.setSelectionRange(o,o),void(t.scrollLeft=r?-n:n)}if(!F&&"Escape"===e.key){const t="multiple"===P&&Array.isArray(V)?0===V.length:null===V,n=dn(sn,e.nativeEvent),r="multiple"===P?[]:null;return x.state.setInputValue("",n),x.state.setSelectedValue(r,n),void(t||x.state.inline||n.isPropagationAllowed||e.stopPropagation())}if(v&&"Backspace"===e.key&&""===t.value&&void 0===v.highlightedChipIndex&&Array.isArray(V)&&V.length>0){const t=v.chipsRef.current.length,n=t>0?t-1:V.length-1,r=V.filter((e,t)=>t!==n);return x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?"keyboard":"pointer"}),void x.state.setSelectedValue(r,dn(Ut,e.nativeEvent))}const o=void 0!==v?.highlightedChipIndex,s=function(e){if(!v)return;let t;const{highlightedChipIndex:n}=v,r=v.chipsRef.current.length;if(void 0!==n){if("ArrowLeft"===e.key)e.preventDefault(),t=n>0?n-1:void 0;else if("ArrowRight"===e.key)e.preventDefault(),t=n<r-1?n+1:void 0;else if("Backspace"===e.key||"Delete"===e.key){e.preventDefault();const r=n>=V.length-1?V.length-2:n;t=r>=0?r:void 0,x.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return t}return"ArrowLeft"===e.key&&0===(e.currentTarget.selectionStart??0)&&V.length>0?(e.preventDefault(),t=r>0?r-1:void 0):"Backspace"===e.key&&""===e.currentTarget.value&&V.length>0&&(x.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),e.preventDefault()),t}(e);if(v?.setHighlightedChipIndex(s),void 0!==s?v?.chipsRef.current[s]?.focus():o&&x.state.inputRef.current?.focus(),229!==e.which&&"Enter"===e.key&&D){const t=x.state.activeIndex,n=e.nativeEvent;if(null===t){if(H)return;return void x.state.setOpen(!1,dn(Ut,n))}Dr(e);const r=x.state.listRef.current[t];r&&(x.state.selectionEventRef.current=n,r.click(),x.state.selectionEventRef.current=null)}},onPointerMove(){x.state.keyboardActiveRef.current=!1},onPointerDown(){x.state.keyboardActiveRef.current=!1}},ne],stateAttributesMapping:Gl});return n.jsxs(e.Fragment,{children:[D&&U&&n.jsx(Ql,{ref:x.state.startDismissRef}),re]})});function eu(e){const t=e.getBoundingClientRect(),n=p(e),r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!("none"!==r.content||"none"!==o.content))return t;const s=parseFloat(r.width)||0,i=parseFloat(r.height)||0,a=parseFloat(o.width)||0,l=parseFloat(o.height)||0,u=Math.max(t.width,s,a),c=Math.max(t.height,i,l),d=u-t.width,f=c-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}const tu=e.forwardRef(function(t,n){const{render:r,className:o,nativeButton:s=!0,disabled:i=!1,id:a,style:l,...u}=t,{state:c,disabled:d,setTouched:f,setFocused:p,validationMode:m,validation:g}=rl(),{labelId:h}=cl(),v=Rl(),{filteredItems:b}=Sl(),y=hi(v,Fl.selectionMode),x=hi(v,Fl.disabled),w=hi(v,Fl.readOnly),R=hi(v,Fl.required),C=hi(v,Fl.mounted),S=hi(v,Fl.popupSide),k=hi(v,Fl.positionerElement),E=hi(v,Fl.listElement),I=hi(v,Fl.triggerProps),M=hi(v,Fl.triggerElement),P=hi(v,Fl.inputInsidePopup),T=hi(v,Fl.id),O=hi(v,Fl.labelId),A=hi(v,Fl.open),D=hi(v,Fl.selectedValue),F=hi(v,Fl.activeIndex),V=hi(v,Fl.selectedIndex),N=hi(v,Fl.hasSelectedValue),j=Cl(),B=kl(),H=ts(),z=d||x||i,L=0===b.length,W=C&&k?S:null;Vl({id:P?a:void 0});const q=P?a??T:a,K=$l(h,O),$=e.useRef("");function U(e){$.current=e.pointerType}const G=j.useState("domReferenceElement");e.useEffect(()=>{P&&M&&M!==G&&j.set("domReferenceElement",M)},[M,G,j,P]);const{reference:Y}=Ji(j,{enabled:!A&&!w&&!x&&"single"===y,listRef:v.state.labelsRef,activeIndex:F,selectedIndex:V,onMatch(e){const t=v.state.valuesRef.current[e];void 0!==t&&v.state.setSelectedValue(t,dn("none"))}}),{reference:X}=Qs(j,{enabled:!w&&!x,event:"mousedown"}),{buttonRef:_,getButtonProps:J}=er({native:s,disabled:z}),Q={...c,open:A,disabled:z,popupSide:W,listEmpty:L,placeholder:"none"!==y&&!N};return ae("button",t,{ref:[n,_,Dt(e=>{v.set("triggerElement",e)})],state:Q,props:[I,X,Y,{id:q,tabIndex:P?0:-1,role:P?"combobox":void 0,"aria-expanded":A?"true":"false","aria-haspopup":P?"dialog":"listbox","aria-controls":A?E?.id:void 0,"aria-required":P&&R||void 0,"aria-labelledby":K,onPointerDown:U,onPointerEnter:U,onFocus(){p(!0),z||w||H.start(0,v.state.forceMount)},onBlur(e){if(!Rr(k,e.relatedTarget)&&(f(!0),p(!1),"onBlur"===m)){const e="none"===y?B:D;g.commit(e)}},onMouseDown(e){if(z||w)return;if(P||j.set("domReferenceElement",e.currentTarget),v.state.forceMount(),"touch"!==$.current&&(v.state.inputRef.current?.focus(),P||e.preventDefault()),A)return;const t=Xr(e.currentTarget);P&&t.addEventListener("mouseup",function(e){if(!M)return;const t=Cr(e),n=v.state.positionerElement,r=v.state.listElement;if(Rr(M,t)||Rr(n,t)||Rr(r,t)||t===M)return;const o=eu(M),s=e.clientX>=o.left-2&&e.clientX<=o.right+2,i=e.clientY>=o.top-2&&e.clientY<=o.bottom+2;s&&i||v.state.setOpen(!1,dn("cancel-open",e))},{once:!0})},onKeyDown(e){z||w||"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(Dr(e),v.state.setOpen(!0,dn(an,e.nativeEvent)),v.state.inputRef.current?.focus())}},g?g.getValidationProps(u):u,J],stateAttributesMapping:Gl})}),nu=e.createContext(null);function ru(t){const{children:r,items:o}=t,s=e.useMemo(()=>({items:o}),[o]);return n.jsx(nu.Provider,{value:s,children:r})}function ou(t){const{children:r}=t,{filteredItems:o}=Sl(),s=e.useContext(nu),i=s?s.items:o;return i?n.jsx(e.Fragment,{children:i.map(r)}):null}const su=e.forwardRef(function(t,r){var o;const{render:s,className:i,style:a,children:l,...u}=t,c=Rl(),d=Cl(),f=Boolean(Jl(!0)),{filteredItems:p,hasItems:m}=Sl(),g=hi(c,Fl.selectionMode),h=hi(c,Fl.grid),v=hi(c,Fl.popupProps),b=hi(c,Fl.virtualized),y="multiple"===g,x=0===p.length,w=Dt(e=>{c.set("positionerElement",e)}),R=ae("div",t,{state:{empty:x},ref:[r,Dt(e=>{c.set("listElement",e)}),f?null:w],props:[v,{children:e.useMemo(()=>"function"==typeof l?o||(o=n.jsx(ou,{children:l})):l,[l]),tabIndex:-1,id:d.useState("floatingId"),role:h?"grid":"listbox","aria-multiselectable":y?"true":void 0,onKeyDown(e){if(!c.state.disabled&&!c.state.readOnly&&"Enter"===e.key){const t=c.state.activeIndex;if(null==t)return;Dr(e);const n=e.nativeEvent,r=c.state.listRef.current[t];r&&(c.state.selectionEventRef.current=n,r.click(),c.state.selectionEventRef.current=null)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},u]});return b?R:n.jsx(Bt,{elementsRef:c.state.listRef,labelsRef:m?void 0:c.state.labelsRef,children:R})});function iu(){const t=ts(),n=e.useRef(null);return e.useEffect(()=>{if(ar)return;const e=n.current;if(null==e)return;const r=function(e){const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let n=null;for(;t.nextNode();){const e=t.currentNode;""!==e.nodeValue&&(n=e)}return n}(e);if(null==r)return;const o=r.nodeValue??"",s=`${o}\u2060`;return r.nodeValue=s,t.start(200,()=>{r.nodeValue===s&&(r.nodeValue=o)}),()=>{t.clear(),r.nodeValue===s&&(r.nodeValue=o)}},[n,t]),n}const au=e.createContext(void 0);const lu=e.forwardRef(function(e,t){const{keepMounted:r=!1,...o}=e,s=Rl(),i=hi(s,Fl.mounted),a=hi(s,Fl.forceMounted);return i||r||a?n.jsx(au.Provider,{value:r,children:n.jsx(js,{ref:t,...o})}):null}),uu=e.forwardRef(function(e,t){const{cutout:r,...o}=e;let s;if(r){const e=r.getBoundingClientRect();s=`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 n.jsx("div",{ref:t,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});let cu={},du={},fu="";function pu(e){const t=Xr(e),n=t.documentElement,r=t.body,o=p(n);let s=0,i=0,a=!1;const l=Sn.create();if(ir&&1!==(o.visualViewport?.scale??1))return()=>{};function u(){const t=o.getComputedStyle(n),l=o.getComputedStyle(r),u=(t.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,cu={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},fu=n.style.scrollBehavior,du={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const c=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f="scroll"===t.overflowY||"scroll"===l.overflowY,p="scroll"===t.overflowX||"scroll"===l.overflowX,m=Math.max(0,o.innerWidth-r.clientWidth),g=Math.max(0,o.innerHeight-r.clientHeight),h=parseFloat(l.marginTop)+parseFloat(l.marginBottom),v=parseFloat(l.marginLeft)+parseFloat(l.marginRight),b=D(n)?n:r;if(a=function(e){if("undefined"==typeof CSS||!CSS.supports||!CSS.supports("scrollbar-gutter","stable")||"undefined"==typeof document)return!1;const t=Xr(e),n=t.documentElement,r=t.body,o=D(n)?n:r,s=o.style.overflowY,i=n.style.scrollbarGutter;n.style.scrollbarGutter="stable",o.style.overflowY="scroll";const a=o.offsetWidth;o.style.overflowY="hidden";const l=o.offsetWidth;return o.style.overflowY=s,n.style.scrollbarGutter=i,a===l}(e),a)return n.style.scrollbarGutter=u,b.style.overflowY="hidden",void(b.style.overflowX="hidden");Object.assign(n.style,{scrollbarGutter:u,overflowY:"hidden",overflowX:"hidden"}),(c||f)&&(n.style.overflowY="scroll"),(d||p)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:h||g?`calc(100dvh - ${h+g}px)`:"100dvh",width:v||m?`calc(100vw - ${v+m}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function c(){Object.assign(n.style,cu),Object.assign(r.style,du),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=fu)}u();const d=zo(o,"resize",function(){c(),l.request(u)});return()=>{l.cancel(),c(),"function"==typeof o.removeEventListener&&d()}}const mu=new class{lockCount=0;restore=null;timeoutLock=es.create();timeoutUnlock=es.create();acquire(e){return this.lockCount+=1,1===this.lockCount&&null===this.restore&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{this.lockCount-=1,0===this.lockCount&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{0===this.lockCount&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(0===this.lockCount||null!==this.restore)return;const t=Xr(e).documentElement,n=p(t).getComputedStyle(t).overflowY;if("hidden"===n||"clip"===n)return void(this.restore=U);const r=ar||!function(e){if("undefined"==typeof document)return!1;const t=Xr(e);return p(t).innerWidth-t.documentElement.clientWidth>0}(e);this.restore=r?function(e){const t=Xr(e),n=t.documentElement,r=t.body,o=D(n)?n:r,s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}(e):pu(e)}};function gu(e=!0,t=null){Nt(()=>{if(e)return mu.acquire(t)},[e,t])}function hu(t,n,r,o){const[s,i]=e.useState(!1);Nt(()=>{if(!t||!n||null==r)return void i(!1);const e=Xr(r).documentElement.clientWidth,o=r.offsetWidth;i(e>0&&o>0&&o>=e-20)},[t,n,r]),gu(t&&(!n||s),o)}const vu=e.forwardRef(function(t,r){const{render:o,className:s,anchor:i,positionMethod:a="absolute",side:l="bottom",align:u="center",sideOffset:c=0,alignOffset:d=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:v=Ts,style:b,...y}=t,x=Rl(),{filteredItems:w}=Sl(),R=Cl(),C=function(){const t=e.useContext(au);if(void 0===t)throw new Error(F(20));return t}(),S=hi(x,Fl.modal),k=hi(x,Fl.open),E=hi(x,Fl.mounted),I=hi(x,Fl.openMethod),M=hi(x,Fl.positionerElement),P=hi(x,Fl.triggerElement),T=hi(x,Fl.inputElement),O=hi(x,Fl.inputGroupElement),A=hi(x,Fl.inputInsidePopup),D=hi(x,Fl.transitionStatus),V=0===w.length,N=Aa({anchor:i??(A?P:O??T),floatingRootContext:R,positionMethod:a,mounted:E,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:g,disableAnchorTracking:h,keepMounted:C,collisionAvoidance:v,lazyFlip:!0});hu(k&&S,"touch"===I,M,P);const j={open:k,side:N.side,align:N.align,anchorHidden:N.anchorHidden,empty:V};Nt(()=>{x.set("popupSide",N.side)},[x,N.side]);const B=Dt(e=>{x.set("positionerElement",e)}),H=Va(t,j,{styles:N.positionerStyles,transitionStatus:D,props:y,refs:[r,B],hidden:!E,inert:!k});return n.jsxs(_l.Provider,{value:N,children:[E&&S&&n.jsx(uu,{inert:za(!k),cutout:O??T??P}),H]})}),bu={...va,...Tn},yu=e.forwardRef(function(t,r){const{render:o,className:s,style:i,initialFocus:a,finalFocus:l,...u}=t,c=Rl(),d=Jl(),f=Cl(),{filteredItems:p}=Sl(),m=hi(c,Fl.mounted),g=hi(c,Fl.open),h=hi(c,Fl.openMethod),v=hi(c,Fl.transitionStatus),b=hi(c,Fl.inputInsidePopup),y=hi(c,Fl.inputElement),x=hi(c,Fl.modal),w=0===p.length;Ko({open:g,ref:c.state.popupRef,onComplete(){g&&c.state.onOpenChangeComplete(!0)}});const R=ae("div",t,{state:{open:g,side:d.side,align:d.align,anchorHidden:d.anchorHidden,transitionStatus:v,empty:w},ref:[r,c.state.popupRef],props:[{role:b?"dialog":"presentation",tabIndex:-1,onFocus(e){const t=Cr(e.nativeEvent);"touch"===h||!Rr(c.state.listElement,t)&&t!==e.currentTarget||c.state.inputRef.current?.focus()}},Fa(v),u],stateAttributesMapping:bu}),C=void 0===a?!!b&&(e=>"touch"===e?c.state.popupRef.current:y):a;let S;S=null!=l?l:!!b&&void 0;const k=!b||x;return n.jsx(Js,{context:f,disabled:!m,modal:k,openInteractionType:h,initialFocus:C,returnFocus:S,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:n.jsxs(e.Fragment,{children:[R,k&&n.jsx(Ql,{ref:c.state.endDismissRef})]})})}),xu=e.createContext(void 0);const wu=e.forwardRef(function(t,r){const{render:o,className:s,style:i,items:a,...l}=t,[u,c]=e.useState(),d=e.useMemo(()=>({labelId:u,setLabelId:c,items:a}),[u,c,a]),f=ae("div",t,{ref:r,props:[{role:"group","aria-labelledby":u},l]}),p=n.jsx(xu.Provider,{value:d,children:f});return a?n.jsx(ru,{items:a,children:p}):p}),Ru=e.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,{setLabelId:l}=function(){const t=e.useContext(xu);if(void 0===t)throw new Error(F(18));return t}(),u=yn(i);Nt(()=>(l(u),()=>{l(void 0)}),[u,l]);return ae("div",t,{ref:n,props:[{id:u},a]})}),Cu=e.createContext(void 0);function Su(){const t=e.useContext(Cu);if(!t)throw new Error(F(19));return t}const ku=e.createContext(!1);const Eu=e.memo(e.forwardRef(function(t,o){const{render:s,className:i,value:a=null,index:l,disabled:u=!1,nativeButton:c=!1,style:d,...f}=t,p=e.useRef(!1),m=e.useRef(null),g=jn({index:l,textRef:m,indexGuessBehavior:Nn.GuessFromOrder}),h=Rl(),v=e.useContext(ku),{flatFilteredItems:b,hasItems:y}=Sl(),x=hi(h,Fl.open),w=hi(h,Fl.selectionMode),R=hi(h,Fl.readOnly),C=hi(h,Fl.virtualized),S=hi(h,Fl.isItemEqualToValue),k="none"!==w,E=l??(C?Ml(b,a,S):g.index),I=-1!==g.index,M=hi(h,Fl.id),P=hi(h,Fl.isActive,E),T=hi(h,Fl.isSelected,a),O=hi(h,Fl.getItemProps),A=e.useRef(null),D=null!=M&&I?`${M}-${E}`:void 0,F=T&&k;Nt(()=>{if(!(I&&(C||null!=l)))return;const e=h.state.listRef.current;return e[E]=A.current,()=>{delete e[E]}},[I,C,E,l,h]),Nt(()=>{if(!I||y)return;const e=h.state.valuesRef.current;return e[E]=a,"none"!==w&&h.state.allValuesRef.current.push(a),()=>{delete e[E]}},[I,y,E,a,h,w]),Nt(()=>{if(!x)return void(p.current=!1);if(!I||y)return;const e=h.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;Il(a,t,S)&&h.set("selectedIndex",E)},[I,y,x,h,E,a,S]);const V={disabled:u,selected:F,highlighted:P},N=O({active:P,selected:F});N.id=void 0,N.onFocus=void 0;const{getButtonProps:j,buttonRef:B}=er({disabled:u,focusableWhenDisabled:!0,native:c,composite:!0});function H(e){function t(){h.state.handleSelection(e,a)}h.state.submitOnItemClick?(r.flushSync(t),h.state.requestSubmit()):t()}const z={id:D,role:v?"gridcell":"option","aria-selected":k?F:void 0,tabIndex:void 0,onPointerDownCapture(e){p.current=!0,e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){u||R||H(e.nativeEvent)},onMouseUp(e){const t=p.current;p.current=!1,u||R||0!==e.button||t||!P||H(e.nativeEvent)}},L=ae("div",t,{ref:[B,o,g.ref,A],state:V,props:[N,z,f,j]}),W=e.useMemo(()=>({selected:F,textRef:m}),[F,m]);return n.jsx(Cu.Provider,{value:W,children:L})})),Iu=e.forwardRef(function(e,t){const r=e.keepMounted??!1,{selected:o}=Su();return r||o?n.jsx(Mu,{...e,ref:t}):null}),Mu=e.memo(e.forwardRef((t,n)=>{const{render:r,className:o,style:s,keepMounted:i,...a}=t,{selected:l}=Su(),u=e.useRef(null),{transitionStatus:c,setMounted:d}=An(l),f=ae("span",t,{ref:[n,u],state:{selected:l,transitionStatus:c},props:[{"aria-hidden":!0,children:"\u2714\ufe0f"},a],stateAttributesMapping:Tn});return Ko({open:l,ref:u,onComplete(){l||d(!1)}}),f})),Pu=e.forwardRef(function(t,r){const{render:o,className:s,style:i,...a}=t,u=Rl(),c=hi(u,Fl.open),d=hi(u,Fl.hasSelectionChips),[f,p]=e.useState(void 0);c&&void 0!==f&&p(void 0);const m=e.useRef([]),g=ae("div",t,{ref:[r,u.state.chipsContainerRef],props:[d?{role:"toolbar"}:Y,{onMouseDown(e){!function(e,t,n,r){if(e.baseUIHandlerPrevented||r)return;const o=Cr(e.nativeEvent),s=l(o)?o:null;s!==e.currentTarget&&Ir(s)||(e.preventDefault(),n||(t.state.inputRef.current?.focus(),t.state.openOnInputClick&&t.state.setOpen(!0,dn(rn,e.nativeEvent))))}(e,u,u.state.disabled,u.state.readOnly)}},a]}),h=e.useMemo(()=>({highlightedChipIndex:f,setHighlightedChipIndex:p,chipsRef:m}),[f,p,m]);return n.jsx(Yl.Provider,{value:h,children:n.jsx(Bt,{elementsRef:m,children:g})})}),Tu=e.createContext(void 0);const Ou=e.forwardRef(function(t,o){const{render:s,className:i,style:a,...l}=t,u=Rl(),{setHighlightedChipIndex:c,chipsRef:d}=Xl(),f=hi(u,Fl.disabled),p=hi(u,Fl.readOnly),m=hi(u,Fl.selectedValue),{ref:g,index:h}=jn();const v=ae("div",t,{ref:[o,g],state:{disabled:f},props:[{tabIndex:-1,"aria-disabled":f||void 0,"aria-readonly":p||void 0,onKeyDown(e){if(f||p)return;const t=function(e){let t=h;if("ArrowLeft"===e.key)e.preventDefault(),t=h>0?h-1:void 0;else if("ArrowRight"===e.key)e.preventDefault(),t=h<d.current.length-1?h+1:void 0;else if("Backspace"===e.key||"Delete"===e.key){const n=h>=m.length-1?m.length-2:h;t=n>=0?n:void 0,Dr(e),u.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),u.state.setSelectedValue(m.filter((e,t)=>t!==h),dn(Ut,e.nativeEvent))}else"Enter"===e.key||" "===e.key?(Dr(e),t=void 0):"ArrowDown"===e.key||"ArrowUp"===e.key?(Dr(e),u.state.setOpen(!0,dn(an,e.nativeEvent)),t=void 0):1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey||(t=void 0);return t}(e);r.flushSync(()=>{c(t)}),void 0===t?u.state.inputRef.current?.focus():d.current[t]?.focus()}},l]}),b=e.useMemo(()=>({index:h}),[h]);return n.jsx(Tu.Provider,{value:b,children:v})}),Au=e.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,style:a,...l}=t,u=Rl(),{index:c}=function(){const t=e.useContext(Tu);if(!t)throw new Error(F(17));return t}(),d=hi(u,Fl.disabled),f=hi(u,Fl.readOnly),p=hi(u,Fl.selectedValue),m=hi(u,Fl.isItemEqualToValue),g=d||s,{buttonRef:h,getButtonProps:v}=er({native:i,disabled:g||f,focusableWhenDisabled:!0});function b(e){const t=dn("chip-remove-press",e.nativeEvent);return function(e){const t=u.state.activeIndex;if(null==t)return;const n=Ml(u.state.valuesRef.current,e,m);-1!==n&&t===n&&u.state.setIndices({activeIndex:null,type:u.state.keyboardActiveRef.current?"keyboard":"pointer"})}(p[c]),u.state.setSelectedValue(p.filter((e,t)=>t!==c),t),u.state.inputRef.current?.focus(),t}return ae("button",t,{ref:[n,h],state:{disabled:g},props:[{tabIndex:-1,onMouseDown(e){e.preventDefault()},onClick(e){if(g||f)return;b(e).isPropagationAllowed||e.stopPropagation()},onKeyDown(e){if(!(g||f||"Enter"!==e.key&&" "!==e.key)){b(e).isPropagationAllowed||Dr(e)}}},l,v]})}),Du=e.forwardRef(function(e,t){const{render:n,className:r,style:o,children:s,...i}=e,{filteredItems:a}=Sl(),l=Rl(),u=iu(),c=0===a.length?s:null;return ae("div",e,{ref:[t,l.state.emptyRef,u],props:[{children:c,role:"status","aria-live":"polite","aria-atomic":!0},i]})}),Fu={...Tn,...ga},Vu=e.forwardRef(function(e,t){const{render:n,className:r,disabled:o=!1,nativeButton:s=!0,keepMounted:i=!1,style:a,...l}=e,{disabled:u}=rl(),c=Rl(),d=hi(c,Fl.selectionMode),f=hi(c,Fl.disabled),p=hi(c,Fl.readOnly),m=hi(c,Fl.open),g=hi(c,Fl.selectedValue),h=hi(c,Fl.hasSelectionChips),v=kl();let b=!1;b="none"===d?""!==v:"single"===d?null!=g:h;const y=u||f||o,{buttonRef:x,getButtonProps:w}=er({native:s,disabled:y}),{mounted:R,transitionStatus:C,setMounted:S}=An(b),k={disabled:y,open:m,transitionStatus:C};Ko({open:b,ref:c.state.clearRef,onComplete(){b||S(!1)}});const E=ae("button",e,{state:k,ref:[t,x,c.state.clearRef],props:[{tabIndex:-1,children:"x",onMouseDown(e){e.preventDefault()},onClick(e){if(y||p)return;const t=c.state.keyboardActiveRef;c.state.setInputValue("",dn(Zt,e.nativeEvent)),"none"!==d?(c.state.setSelectedValue(Array.isArray(g)?[]:null,dn(Zt,e.nativeEvent)),c.state.setIndices({activeIndex:null,selectedIndex:null,type:t.current?"keyboard":"pointer"})):c.state.setIndices({activeIndex:null,type:t.current?"keyboard":"pointer"}),c.state.inputRef.current?.focus()}},l,w],stateAttributesMapping:Fu});return i||R?E:null}),Nu=e.forwardRef(function(e,t){const{className:n,render:r,orientation:o="horizontal",style:s,...i}=e;return ae("div",e,{state:{orientation:o},ref:t,props:[{role:"separator","aria-orientation":o},i]})}),ju=e.createContext(void 0);function Bu(t=!0){const n=e.useContext(ju);if(void 0===n&&!t)throw new Error(F(25));return n}const Hu=e.createContext(void 0);function zu(t){const n=e.useContext(Hu);if(void 0===n&&!t)throw new Error(F(33));return n}const Lu=e.createContext(void 0);function Wu(t){const n=e.useContext(Lu);if(void 0===n&&!t)throw new Error(F(36));return n}const qu=e.createContext(void 0);const Ku={type:"regular-item"};function $u(t){const{closeOnClick:n,disabled:r=!1,highlighted:o,id:s,store:i,typingRef:a=i.context.typingRef,nativeButton:l,itemMetadata:u,nodeId:c}=t,d=e.useRef(null),{getButtonProps:f,buttonRef:p}=er({disabled:r,focusableWhenDisabled:!0,native:l,composite:!0}),m=function(t){const{closeOnClick:n,highlighted:r,id:o,nodeId:s,store:i,typingRef:a,itemRef:l,itemMetadata:u}=t,{events:c}=i.useState("floatingTreeRoot"),d=Bu(!0),f=void 0!==d;return e.useMemo(()=>({id:o,role:"menuitem",tabIndex:r?0:-1,onKeyDown(e){" "===e.key&&a?.current&&e.preventDefault()},onMouseMove(e){s&&c.emit("itemhover",{nodeId:s,target:e.currentTarget})},onClick(e){n&&c.emit("close",{domEvent:e,reason:Jt})},onMouseUp(e){if(d){const t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1)return;if(f&&!dr&&2===e.button)return}!l.current||!i.context.allowMouseUpTriggerRef.current||f&&2!==e.button||u&&"regular-item"!==u.type||l.current.click()}}),[n,r,o,c,s,i,a,l,d,f,u])}({closeOnClick:n,highlighted:o,id:s,nodeId:c,store:i,typingRef:a,itemRef:d,itemMetadata:u}),g=e.useCallback(e=>_(m,{onMouseEnter(){"submenu-trigger"===u.type&&u.setActive()}},e,f),[m,f,u]),h=H(d,p);return e.useMemo(()=>({getItemProps:g,itemRef:h}),[g,h])}let Uu=function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e}({});const Gu={checked:e=>e?{[Uu.checked]:""}:{[Uu.unchecked]:""},...Tn},Yu=e.forwardRef(function(t,r){const{render:o,className:s,id:i,label:a,nativeButton:l=!1,disabled:u=!1,closeOnClick:c=!1,checked:d,defaultChecked:f,onCheckedChange:p,style:m,...g}=t,h=jn({label:a}),v=zu(!0),b=yn(i),{store:y}=Wu(),x=y.useState("isActive",h.index),w=y.useState("itemProps"),[R,C]=Tt({controlled:d,default:f??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:S,itemRef:k}=$u({closeOnClick:c,disabled:u,highlighted:x,id:b,store:y,nativeButton:l,nodeId:v?.context.nodeId,itemMetadata:Ku}),E=e.useMemo(()=>({disabled:u,highlighted:x,checked:R}),[u,x,R]),I=Dt(e=>{const t={...dn(Jt,e.nativeEvent),preventUnmountOnClose:()=>{}};p?.(!R,t),t.isCanceled||C(e=>!e)}),M=ae("div",t,{state:E,stateAttributesMapping:Gu,props:[w,{role:"menuitemcheckbox","aria-checked":R,onClick:I},g,S],ref:[k,r,h.ref]});return n.jsx(qu.Provider,{value:E,children:M})}),Xu=e.createContext(void 0);const _u=e.forwardRef(function(t,r){const{render:o,className:s,style:i,...a}=t,[l,u]=e.useState(void 0),c=e.useMemo(()=>({setLabelId:u}),[u]),d=ae("div",t,{ref:r,props:{role:"group","aria-labelledby":l,...a}});return n.jsx(Xu.Provider,{value:c,children:d})}),Ju=e.forwardRef(function(t,n){const{className:r,render:o,id:s,style:i,...a}=t,l=yn(s),{setLabelId:u}=function(){const t=e.useContext(Xu);if(void 0===t)throw new Error(F(31));return t}();return Nt(()=>(u(l),()=>{u(void 0)}),[u,l]),ae("div",t,{ref:n,props:{id:l,role:"presentation",...a}})}),Qu=e.forwardRef(function(e,t){const{render:n,className:r,id:o,label:s,nativeButton:i=!1,disabled:a=!1,closeOnClick:l=!0,style:u,...c}=e,d=jn({label:s}),f=zu(!0),p=yn(o),{store:m}=Wu(),g=m.useState("isActive",d.index),h=m.useState("itemProps"),{getItemProps:v,itemRef:b}=$u({closeOnClick:l,disabled:a,highlighted:g,id:p,store:m,nativeButton:i,nodeId:f?.context.nodeId,itemMetadata:Ku});return ae("div",e,{state:{disabled:a,highlighted:g},props:[h,c,v],ref:[b,t,d.ref]})}),Zu=e.createContext(void 0);function ec(t){return e.useContext(Zu)}const tc={...va,...Tn},nc=e.forwardRef(function(t,r){const{render:o,className:s,style:i,finalFocus:a,...l}=t,{store:u}=Wu(),{side:c,align:d}=zu(),f=null!=ec(),p=u.useState("open"),m=u.useState("transitionStatus"),g=u.useState("popupProps"),h=u.useState("mounted"),v=u.useState("instantType"),b=u.useState("activeTriggerElement"),y=u.useState("parent"),x=u.useState("lastOpenChangeReason"),w=u.useState("rootId"),R=u.useState("floatingRootContext"),C=u.useState("floatingTreeRoot"),S=u.useState("closeDelay"),k=u.useState("activeTriggerElement"),E="context-menu"===y.type;Ko({open:p,ref:u.context.popupRef,onComplete(){p&&u.context.onOpenChangeComplete?.(!0)}}),e.useEffect(()=>{function e(e){u.setOpen(!1,dn(e.reason,e.domEvent))}return C.events.on("close",e),()=>{C.events.off("close",e)}},[C.events,u]);const I=u.useState("hoverEnabled"),M=u.useState("disabled");Hi(R,{enabled:I&&!M&&!E&&"menubar"!==y.type,closeDelay:S});const P={transitionStatus:m,side:c,align:d,open:p,nested:"menu"===y.type,instant:v},T=e.useCallback(e=>{u.set("popupElement",e)},[u]),O=ae("div",t,{state:P,ref:[r,u.context.popupRef,T],stateAttributesMapping:tc,props:[g,{onKeyDown(e){f&&Oo.has(e.key)&&e.stopPropagation()}},Fa(m),l,{"data-rootownerid":w}]});let A=void 0===y.type||E;return(b||"menubar"===y.type&&x!==_t)&&(A=!0),n.jsx(Js,{context:R,modal:E,disabled:!h,returnFocus:void 0===a?A:a,initialFocus:"menu"!==y.type,restoreFocus:!0,externalTree:"menubar"!==y.type?C:void 0,previousFocusableElement:k,nextFocusableElement:void 0===y.type?u.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:void 0===y.type?u.context.beforeContentFocusGuardRef:void 0,children:O})}),rc=e.createContext(void 0);const oc=e.forwardRef(function(e,t){const{keepMounted:r=!1,...o}=e,{store:s}=Wu();return s.useState("mounted")||r?n.jsx(rc.Provider,{value:r,children:n.jsx(js,{ref:t,...o})}):null}),sc=e.forwardRef(function(t,r){const{anchor:o,positionMethod:s="absolute",className:i,render:a,side:l,align:u,sideOffset:c=0,alignOffset:d=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:v=Ts,style:b,...y}=t,{store:x}=Wu(),w=function(){const t=e.useContext(rc);if(void 0===t)throw new Error(F(32));return t}(),R=Bu(!0),C=x.useState("parent"),S=x.useState("floatingRootContext"),k=x.useState("floatingTreeRoot"),E=x.useState("mounted"),I=x.useState("open"),M=x.useState("modal"),P=x.useState("openMethod"),T=x.useState("activeTriggerElement"),O=x.useState("transitionStatus"),A=x.useState("positionerElement"),D=x.useState("instantType"),V=x.useState("hasViewport"),N=x.useState("lastOpenChangeReason"),j=x.useState("floatingNodeId"),B=x.useState("floatingParentNodeId"),H=S.useState("domReferenceElement"),z=e.useRef(null),L=On(A,!1,!1);let W=o,q=c,K=d,$=u,U=v;"context-menu"===C.type&&(W=o??C.context?.anchor,$=$??"start",l||"center"===$||(K=t.alignOffset??2,q=t.sideOffset??-5));let G=l,Y=$;"menu"===C.type?(G=G??"inline-end",Y=Y??"start",U=t.collisionAvoidance??Os):"menubar"===C.type&&(G=G??"bottom",Y=Y??"start");const X="context-menu"===C.type,_=Aa({anchor:W,floatingRootContext:S,positionMethod:R?"fixed":s,mounted:E,side:G,sideOffset:q,align:Y,alignOffset:K,arrowPadding:X?0:m,collisionBoundary:f,collisionPadding:p,sticky:g,nodeId:j,keepMounted:w,disableAnchorTracking:h,collisionAvoidance:U,shiftCrossAxis:X&&!("side"in U&&"flip"===U.side),externalTree:k,adaptiveOrigin:V?Pa:void 0});e.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===j&&x.set("hoverEnabled",!1),e.nodeId!==j&&e.parentNodeId===x.select("floatingParentNodeId")&&x.setOpen(!1,dn(un)))}return k.events.on("menuopenchange",e),()=>{k.events.off("menuopenchange",e)}},[x,k.events,j]),e.useEffect(()=>{if(null!=x.select("floatingParentNodeId"))return k.events.on("menuopenchange",e),()=>{k.events.off("menuopenchange",e)};function e(e){if(e.open||e.nodeId!==x.select("floatingParentNodeId"))return;const t=e.reason??un;x.setOpen(!1,dn(t))}},[k.events,x]);const J=ts();e.useEffect(()=>{I||J.clear()},[I,J]),e.useEffect(()=>{function e(e){if(I&&e.nodeId===x.select("floatingParentNodeId"))if(e.target&&T&&T!==e.target){const e=x.select("closeDelay");e>0?J.isStarted()||J.start(e,()=>{x.setOpen(!1,dn(un))}):x.setOpen(!1,dn(un))}else J.clear()}return k.events.on("itemhover",e),()=>{k.events.off("itemhover",e)}},[k.events,I,T,x,J]),e.useEffect(()=>{const e={open:I,nodeId:j,parentNodeId:B,reason:x.select("lastOpenChangeReason")};k.events.emit("menuopenchange",e)},[k.events,I,x,j,B]),Nt(()=>{const e=H,t=z.current;if(e&&(z.current=e),t&&e&&e!==t){x.set("instantType",void 0);const e=new AbortController;return L(()=>{x.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[H,L,x]);const Q={open:I,side:_.side,align:_.align,anchorHidden:_.anchorHidden,nested:"menu"===C.type,instant:D},Z="menubar"===C.type&&C.context.modal;hu(I&&(Z||M&&N!==Yt),"touch"===P,A,T);const ee=Va(t,Q,{styles:_.positionerStyles,transitionStatus:O,props:y,refs:[r,x.useStateSetter("positionerElement")],hidden:!E,inert:!I}),te=E&&"menu"!==C.type&&("menubar"!==C.type&&M&&N!==Yt||"menubar"===C.type&&C.context.modal);let ne=null;return"menubar"===C.type?ne=C.context.contentElement:void 0===C.type&&(ne=T),n.jsxs(Hu.Provider,{value:_,children:[te&&n.jsx(uu,{ref:"context-menu"===C.type||"nested-context-menu"===C.type?C.context.internalBackdropRef:null,inert:za(!I),cutout:ne}),n.jsx($s,{id:j,children:n.jsx(Bt,{elementsRef:x.context.itemDomElements,labelsRef:x.context.itemLabels,children:ee})})]})}),ic=e.createContext(null);function ac(t){return e.useContext(ic)}const lc={...Pi,disabled:ri(e=>"menubar"===e.parent.type&&e.parent.context.disabled||e.disabled),modal:ri(e=>(void 0===e.parent.type||"context-menu"===e.parent.type)&&(e.modal??!0)),openMethod:ri(e=>e.openMethod),allowMouseEnter:ri(e=>e.allowMouseEnter),stickIfOpen:ri(e=>e.stickIfOpen),parent:ri(e=>e.parent),rootId:ri(e=>"menu"===e.parent.type?e.parent.store.select("rootId"):void 0!==e.parent.type?e.parent.context.rootId:e.rootId),activeIndex:ri(e=>e.activeIndex),isActive:ri((e,t)=>e.activeIndex===t),hoverEnabled:ri(e=>e.hoverEnabled),instantType:ri(e=>e.instantType),lastOpenChangeReason:ri(e=>e.openChangeReason),floatingTreeRoot:ri(e=>"menu"===e.parent.type?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:ri(e=>e.floatingNodeId),floatingParentNodeId:ri(e=>e.floatingParentNodeId),itemProps:ri(e=>e.itemProps),closeDelay:ri(e=>e.closeDelay),hasViewport:ri(e=>e.hasViewport),keyboardEventRelay:ri(e=>e.keyboardEventRelay?e.keyboardEventRelay:"menu"===e.parent.type?e.parent.store.select("keyboardEventRelay"):void 0)};class uc extends yi{constructor(t){super({...{...Ii(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Hs,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Y,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1},...t},{positionerRef:e.createRef(),popupRef:e.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:e.createRef(),beforeContentFocusGuardRef:e.createRef(),onOpenChangeComplete:void 0,triggerElements:new Ei},lc),this.unsubscribeParentListener=this.observe("parent",e=>{if(this.unsubscribeParentListener?.(),"menu"===e.type){let t=e.store.select("rootId"),n=e.store.select("floatingTreeRoot"),r=e.store.select("keyboardEventRelay");return this.unsubscribeParentListener=e.store.subscribe(()=>{const o=e.store.select("rootId"),s=e.store.select("floatingTreeRoot"),i=e.store.select("keyboardEventRelay");t===o&&n===s&&r===i||(t=o,n=s,r=i,this.notifyAll())}),void(this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef)}void 0!==e.type&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:t})}static useStore(e,t){const n=B(()=>new uc(t)).current;return e??n}unsubscribeParentListener=null}const cc=e.createContext(void 0);function dc(){return e.useContext(cc)}const fc=Yo(function(t){const{children:r,open:o,onOpenChange:s,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:l=!1,modal:u,loopFocus:c=!0,orientation:d="vertical",actionsRef:f,closeParentOnEsc:p=!1,handle:m,triggerId:g,defaultTriggerId:h=null,highlightItemOnHover:v=!0}=t,b=Bu(!0),y=Wu(!0),x=ac(),w=dc(),R=e.useMemo(()=>w&&y?{type:"menu",store:y.store}:x?{type:"menubar",context:x}:b&&!y?{type:"context-menu",context:b}:{type:void 0},[b,y,x,w]),C=uc.useStore(m?.store,{open:a,openProp:o,activeTriggerId:h,triggerIdProp:g,parent:R});Jo(()=>{void 0===o&&!1===C.state.open&&!0===a&&C.update({open:!0,activeTriggerId:h})}),C.useControlledProp("openProp",o),C.useControlledProp("triggerIdProp",g),C.useContextCallback("onOpenChangeComplete",i);const S=C.useState("floatingTreeRoot"),k=Ks(S),E=Ws();Nt(()=>{b&&!y?C.update({parent:{type:"context-menu",context:b},floatingNodeId:k,floatingParentNodeId:E}):y&&C.update({floatingNodeId:k,floatingParentNodeId:E})},[b,y,k,E,C]);const I=C.useState("open"),M=C.useState("activeTriggerElement"),P=C.useState("positionerElement"),T=C.useState("hoverEnabled"),O=C.useState("disabled"),A=C.useState("lastOpenChangeReason"),D=C.useState("parent"),F=C.useState("activeIndex"),V=C.useState("payload"),N=C.useState("floatingParentNodeId"),j=e.useRef(null),B=null!=N;const{openMethod:H,triggerProps:z}=Hl(I);C.useSyncedValues({disabled:l,modal:void 0===D.type?u:void 0,openMethod:H,rootId:bn()}),Si(C);const{forceUnmount:L}=ki(I,C,()=>{C.update({allowMouseEnter:!1,stickIfOpen:!0})}),W=e.useRef("context-menu"!==D.type),q=ts();e.useEffect(()=>{if(I||(j.current=null),"context-menu"===D.type)return I?void q.start(500,()=>{W.current=!0}):(q.clear(),void(W.current=!1))},[q,I,D.type]),Nt(()=>{I||T||C.set("hoverEnabled",!0)},[I,T,C]);const K=e.useRef(!0),$=ts(),U=Dt((e,t)=>{const n=t.reason;if(I===e&&t.trigger===M&&A===n)return;if(t.preventUnmountOnClose=()=>{C.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||(t.trigger=M??void 0),s?.(e,t),t.isCanceled)return;C.state.floatingRootContext.dispatchOpenChange(e,t);const r=t.event;if(!1===e&&"click"===r?.type&&"touch"===r.pointerType&&!K.current)return;if(!e&&null!==F){const e=C.context.itemDomElements.current[F];queueMicrotask(()=>{e?.setAttribute("tabindex","-1")})}e&&n===Xt?(K.current=!1,$.start(300,()=>{K.current=!0})):(K.current=!0,$.clear());const o=(n===Gt||n===Jt)&&0===r.detail&&r?.isTrusted,i=!e&&(n===sn||null==n),a={open:e,openChangeReason:n};j.current=t.event??null;const l=t.trigger?.id??null;(l||e)&&(a.activeTriggerId=l,a.activeTriggerElement=t.trigger??null),C.update(a),"menubar"!==D.type||n!==Xt&&n!==on&&n!==Yt&&n!==an&&n!==un?o||i?C.set("instantType",o?"click":"dismiss"):C.set("instantType",void 0):C.set("instantType","group")}),Y=e.useCallback(()=>{C.setOpen(!1,dn(cn))},[C]);let X;e.useImperativeHandle(f,()=>({unmount:L,close:Y}),[L,Y]),"context-menu"===D.type&&(X=D.context),e.useImperativeHandle(X?.positionerRef,()=>P,[P]),e.useImperativeHandle(X?.actionsRef,()=>({setOpen:U}),[U]);const J=Oi({popupStore:C,onOpenChange:U}),Q=J.context.events;e.useEffect(()=>{const e=({open:e,eventDetails:t})=>U(e,t);return Q.on("setOpen",e),()=>{Q?.off("setOpen",e)}},[Q,U]);const Z=ni(J,{enabled:!O,bubbles:{escapeKey:p&&"menu"===D.type},outsidePress:()=>"context-menu"!==D.type||"contextmenu"===j.current?.type||W.current,externalTree:B?S:void 0}),ee=_i(J,{role:"menu"}),te=qt(),ne=e.useCallback(e=>{C.select("activeIndex")!==e&&C.set("activeIndex",e)},[C]),re=Yi(J,{enabled:!O,listRef:C.context.itemDomElements,activeIndex:F,nested:void 0!==D.type,loopFocus:c,orientation:d,parentOrientation:"menubar"===D.type?D.context.orientation:void 0,rtl:"rtl"===te,disabledIndices:G,onNavigate:ne,openOnArrowKeyDown:"context-menu"!==D.type,externalTree:B?S:void 0,focusItemOnHover:v}),oe=e.useCallback(e=>{C.context.typingRef.current=e},[C]),se=Ji(J,{listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:F,resetMs:500,onMatch:e=>{I&&e!==F&&C.set("activeIndex",e)},onTypingChange:oe}),{getReferenceProps:ie,getFloatingProps:ae,getItemProps:le,getTriggerProps:ue}=Wi([Z,ee,re,se]),ce=e.useMemo(()=>{const e=_(ie(),{onMouseMove(){C.set("allowMouseEnter",!0)}},z);return delete e.role,e},[ie,C,z]),de=e.useMemo(()=>{const e=ue();if(!e)return e;const t=_(e,z);return delete t.role,delete t["aria-controls"],t},[ue,z]),fe=e.useMemo(()=>ae({onMouseMove(){C.set("allowMouseEnter",!0),"menu"===D.type&&C.set("hoverEnabled",!1)},onClick(){C.select("hoverEnabled")&&C.set("hoverEnabled",!1)},onKeyDown(e){const t=C.select("keyboardEventRelay");t&&!e.isPropagationStopped()&&t(e)}}),[ae,D.type,C]),pe=e.useMemo(()=>le(),[le]);C.useSyncedValues({floatingRootContext:J,activeTriggerProps:ce,inactiveTriggerProps:de,popupProps:fe,itemProps:pe});const me=e.useMemo(()=>({store:C,parent:R}),[C,R]),ge=n.jsx(Lu.Provider,{value:me,children:"function"==typeof r?r({payload:V}):r});return void 0===D.type||"context-menu"===D.type?n.jsx(Us,{externalTree:S,children:ge}):ge});function pc(t){const r=Wu().store,o=e.useMemo(()=>({parentMenu:r}),[r]);return n.jsx(cc.Provider,{value:o,children:n.jsx(fc,{...t})})}function mc(t={}){const{highlightItemOnHover:n,highlightedIndex:r,onHighlightedIndexChange:o}=Zn(),{ref:s,index:i}=jn(t),a=r===i,l=e.useRef(null),u=H(s,l);return{compositeProps:e.useMemo(()=>({tabIndex:a?0:-1,onFocus(){o(i)},onMouseMove(){const e=l.current;if(!n||!e)return;const t=e.hasAttribute("disabled")||"true"===e.ariaDisabled;a||t||e.focus()}}),[a,o,i,n]),compositeRef:u,index:i}}function gc(e){const{render:t,className:n,style:r,state:o=Y,props:s=G,refs:i=G,metadata:a,stateAttributesMapping:l,tag:u="div",...c}=e,{compositeProps:d,compositeRef:f}=mc({metadata:a});return ae(u,e,{state:o,ref:[...i,f],props:[d,...s,c],stateAttributesMapping:l})}function hc(e){return i(e)&&e.hasAttribute("data-rootownerid")?e.getAttribute("data-rootownerid")??void 0:g(e)?void 0:hc(h(e))}function vc(t,n){const o=e.useRef(null),s=Dt(e=>{r.flushSync(()=>{t.setOpen(!1,dn(on,e.nativeEvent,e.currentTarget))});const n=mo(o.current,-1);n?.focus()}),i=Dt(e=>{const o=t.select("positionerElement");if(o&&go(e,o))t.context.beforeContentFocusGuardRef.current?.focus();else{r.flushSync(()=>{t.setOpen(!1,dn(on,e.nativeEvent,e.currentTarget))});let s=mo(t.context.triggerFocusTargetRef.current||n.current,1);for(;null!==s&&Rr(o,s);){const e=s;if(s=fo(s),s===e)break}s?.focus()}});return{preFocusGuardRef:o,handlePreFocusGuardFocus:s,handleFocusTargetFocus:i}}const bc=Xo(function(t,r){const{render:o,className:s,disabled:i=!1,nativeButton:a=!0,id:l,openOnHover:u,delay:c=100,closeDelay:d=0,handle:f,payload:p,style:m,...g}=t,h=Wu(!0),v=f?.store??h?.store;if(!v)throw new Error(F(85));const b=yn(l),y=v.useState("isTriggerActive",b),x=v.useState("floatingRootContext"),w=v.useState("isOpenedByTrigger",b),R=e.useRef(null),C=function(){const t=Bu(!0),n=Wu(!0),r=ac(),o=e.useMemo(()=>r?{type:"menubar",context:r}:t&&!n?{type:"context-menu",context:t}:{type:void 0},[t,n,r]);return o}(),S=Zn(!0),k=qs(),E=e.useMemo(()=>k??new Hs,[k]),I=Ks(E),M=Ws(),{registerTrigger:P,isMountedByThisTrigger:T}=Ci(b,R,v,{payload:p,closeDelay:d,parent:C,floatingTreeRoot:E,floatingNodeId:I,floatingParentNodeId:M,keyboardEventRelay:S?.relayKeyboardEvent}),O="menubar"===C.type,A=v.useState("disabled"),D=i||A||O&&C.context.disabled,{getButtonProps:V,buttonRef:N}=er({disabled:D,native:a});e.useEffect(()=>{w||void 0!==C.type||(v.context.allowMouseUpTriggerRef.current=!1)},[v,w,C.type]);const j=e.useRef(null),B=ts(),H=Dt(e=>{if(!j.current)return;B.clear(),v.context.allowMouseUpTriggerRef.current=!1;const t=e.target;if(Rr(j.current,t)||Rr(v.select("positionerElement"),t)||t===j.current)return;if(null!=t&&hc(t)===v.select("rootId"))return;const n=eu(j.current);e.clientX>=n.left-2&&e.clientX<=n.right+2&&e.clientY>=n.top-2&&e.clientY<=n.bottom+2||E.events.emit("close",{domEvent:e,reason:ln})});e.useEffect(()=>{if(w&&v.select("lastOpenChangeReason")===Yt){Xr(j.current).addEventListener("mouseup",H,{once:!0})}},[w,H,v]);const z=O&&C.context.hasSubmenuOpen,L=Li(x,{enabled:(u??z)&&!D&&"context-menu"!==C.type&&(!O||z&&!T),handleClose:ra({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:void 0===C.type?c:void 0,delay:{close:d},triggerElementRef:R,externalTree:E,isActiveTrigger:y,isClosing:()=>"ending"===v.select("transitionStatus")}),W=function(t,n){const r=ts(),[o,s]=e.useState(!1);return Nt(()=>{t&&"trigger-hover"===n?(s(!0),r.start(500,()=>{s(!1)})):t||(r.clear(),s(!1))},[t,n,r]),o}(w,v.select("lastOpenChangeReason")),q=Qs(x,{enabled:!D&&"context-menu"!==C.type,event:w&&O?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:void 0===C.type&&W}),K=Di(x,{enabled:!D&&z}),$=function(t){const{enabled:n=!0,mouseDownAction:r,open:o}=t,s=e.useRef(!1);return e.useMemo(()=>n?{onMouseDown:e=>{("open"===r&&!o||"close"===r&&o)&&(s.current=!0,Xr(e.currentTarget).addEventListener("click",()=>{s.current=!1},{once:!0}))},onClick:e=>{s.current&&(s.current=!1,e.preventBaseUIHandler())}}:Y,[n,r,o])}({open:w,enabled:O,mouseDownAction:"open"}),U=Wi([q,K]),G={disabled:D,open:w},X=v.useState("triggerProps",T),_=[j,r,N,P,R],J=[U.getReferenceProps(),L??Y,X,{"aria-haspopup":"menu",id:b,onMouseDown:e=>{if(v.select("open"))return;B.start(200,()=>{v.context.allowMouseUpTriggerRef.current=!0});Xr(e.currentTarget).addEventListener("mouseup",H,{once:!0})}},O?{role:"menuitem"}:{},$,g,V],{preFocusGuardRef:Q,handlePreFocusGuardFocus:Z,handleFocusTargetFocus:ee}=vc(v,R),te=ae("button",t,{enabled:!O,stateAttributesMapping:ha,state:G,ref:_,props:J});return O?n.jsx(gc,{tag:"button",render:o,className:s,style:m,state:G,refs:_,props:J,stateAttributesMapping:ha}):w?n.jsxs(e.Fragment,{children:[n.jsx(ps,{ref:Q,onFocus:Z},`${b}-pre-focus-guard`),n.jsx(e.Fragment,{children:te},b),n.jsx(ps,{ref:v.context.triggerFocusTargetRef,onFocus:ee},`${b}-post-focus-guard`)]}):n.jsx(e.Fragment,{children:te},b)});const yc=e.forwardRef(function(t,n){const{render:r,className:o,label:s,id:i,nativeButton:a=!1,openOnHover:l=!0,delay:u=100,closeDelay:c=0,disabled:d=!1,style:f,...p}=t,m=jn(),g=zu(),{store:h}=Wu(),v=yn(i),b=h.useState("open"),y=h.useState("floatingRootContext"),x=h.useState("floatingTreeRoot"),w=Ri(v,h),R=e.useCallback(e=>{const t=w(e);return null!==e&&h.select("open")&&null==h.select("activeTriggerId")&&h.update({activeTriggerId:v,activeTriggerElement:e,closeDelay:c}),t},[w,c,h,v]),C=e.useRef(null),S=e.useCallback(e=>{C.current=e,h.set("activeTriggerElement",e)},[h]),k=dc();if(!k?.parentMenu)throw new Error(F(37));h.useSyncedValue("closeDelay",c);const E=k.parentMenu,I=E.useState("itemProps"),M=E.useState("isActive",m.index),P=e.useMemo(()=>({type:"submenu-trigger",setActive(){E.set("activeIndex",m.index)}}),[E,m.index]),T=h.useState("disabled"),O=d||T,{getItemProps:A,itemRef:D}=$u({closeOnClick:!1,disabled:O,highlighted:M,id:v,store:h,typingRef:E.context.typingRef,nativeButton:a,itemMetadata:P,nodeId:g?.context.nodeId}),V=h.useState("hoverEnabled"),N=E.useState("allowMouseEnter"),j=Li(y,{enabled:V&&l&&!O,handleClose:ra({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:u,delay:N?{open:u,close:c}:0,triggerElementRef:C,externalTree:x,isClosing:()=>"ending"===h.select("transitionStatus")}),B=Wi([Qs(y,{enabled:!O,event:"mousedown",toggle:!l,ignoreMouse:l,stickIfOpen:!1})]),H=h.useState("triggerProps",!0);delete H.id;return ae("div",t,{state:{disabled:O,highlighted:M,open:b},stateAttributesMapping:ga,props:[B.getReferenceProps(),j,H,I,{tabIndex:b||M?0:-1,onBlur(){M&&E.set("activeIndex",null)}},p,A],ref:[n,m.ref,D,R,S]})});function xc(t){const[r,o]=e.useState({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,x:0,y:0})}),s=e.useRef(null),i=e.useRef(null),a=e.useRef(null),l=e.useRef(null),u=e.useRef(!0),c=e.useRef(null),d=bn(),f=e.useMemo(()=>({anchor:r,setAnchor:o,actionsRef:a,backdropRef:s,internalBackdropRef:i,positionerRef:l,allowMouseUpTriggerRef:u,initialCursorPointRef:c,rootId:d}),[r,d]);return n.jsx(ju.Provider,{value:f,children:n.jsx(Lu.Provider,{value:void 0,children:n.jsx(fc,{...t})})})}const wc=e.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{setAnchor:a,actionsRef:l,internalBackdropRef:u,backdropRef:c,positionerRef:d,allowMouseUpTriggerRef:f,initialCursorPointRef:p,rootId:m}=Bu(!1),{store:g}=Wu(!1),h=g.useState("open"),v=g.useState("disabled"),b=e.useRef(null),y=e.useRef(null),x=ts(),w=ts(),R=e.useRef(!1);function C(e,t,n){const r=n.type.startsWith("touch");p.current={x:e,y:t},a({getBoundingClientRect:()=>DOMRect.fromRect({width:r?10:0,height:r?10:0,x:e,y:t})}),R.current=!1,l.current?.setOpen(!0,dn(Gt,n)),w.start(500,()=>{R.current=!0})}function S(){x.clear(),y.current=null}e.useEffect(()=>zo(Xr(b.current),"contextmenu",function(e){if(v)return;const t=Cr(e);(Rr(b.current,t)||Rr(u.current,t)||Rr(c.current,t))&&e.preventDefault()}),[c,v,u]);return ae("div",t,{state:{open:h},ref:[b,n],props:[{onContextMenu:function(e){if(v)return;f.current=!0,Dr(e),C(e.clientX,e.clientY,e.nativeEvent),zo(Xr(b.current),"mouseup",e=>{if(f.current=!1,!R.current)return;w.clear(),R.current=!1;const t=Cr(e);Rr(d.current,t)||m&&t&&hc(t)===m||l.current?.setOpen(!1,dn(ln,e))},{once:!0})},onTouchStart:function(e){if(!v&&(f.current=!1,1===e.touches.length)){e.stopPropagation();const t=e.touches[0];y.current={x:t.clientX,y:t.clientY},x.start(500,()=>{y.current&&C(y.current.x,y.current.y,e.nativeEvent)})}},onTouchMove:function(e){if(x.isStarted()&&y.current&&1===e.touches.length){const t=e.touches[0],n=10,r=Math.abs(t.clientX-y.current.x),o=Math.abs(t.clientY-y.current.y);(r>n||o>n)&&x.clear()}},onTouchEnd:S,onTouchCancel:S,style:{WebkitTouchCallout:"none"}},i],stateAttributesMapping:ha})});function Rc(t){const{store:n,parentContext:r,actionsRef:o,isDrawer:s}=t,i=n.useState("open"),a=n.useState("disablePointerDismissal"),l=n.useState("modal"),u=n.useState("popupElement"),{openMethod:c,triggerProps:d}=Hl(i);Si(n);const{forceUnmount:f}=ki(i,n),p=e.useCallback(()=>{n.setOpen(!1,dn(cn))},[n]);e.useImperativeHandle(o,()=>({unmount:f,close:p}),[f,p]);const m=Oi({popupStore:n,onOpenChange:n.setOpen,treatPopupAsFloatingElement:!0}),[g,h]=e.useState(0),[v,b]=e.useState(0),y=0===g,x=_i(m),w=ni(m,{outsidePressEvent:()=>n.context.internalBackdropRef.current||n.context.backdropRef.current?"intentional":{mouse:"trap-focus"===l?"sloppy":"intentional",touch:"sloppy"},outsidePress(e){if(!n.context.outsidePressEnabledRef.current)return!1;if("button"in e&&0!==e.button)return!1;if("touches"in e&&1!==e.touches.length)return!1;const t=Cr(e);if(y&&!a){const e=t;return!l||(!n.context.internalBackdropRef.current&&!n.context.backdropRef.current||(n.context.internalBackdropRef.current===e||n.context.backdropRef.current===e||Rr(e,u)&&!e?.hasAttribute("data-base-ui-portal")))}return!1},escapeKey:y});gu(i&&!0===l,u);const{getReferenceProps:R,getFloatingProps:C,getTriggerProps:S}=Wi([x,w]);n.useContextCallback("onNestedDialogOpen",(e,t)=>{h(e),b(t)}),n.useContextCallback("onNestedDialogClose",()=>{h(0),b(0)}),e.useEffect(()=>(r?.onNestedDialogOpen&&i&&r.onNestedDialogOpen(g+1,v+(s?1:0)),r?.onNestedDialogClose&&!i&&r.onNestedDialogClose(),()=>{r?.onNestedDialogClose&&i&&r.onNestedDialogClose()}),[s,i,g,v,r]);const k=e.useMemo(()=>R(d),[R,d]),E=e.useMemo(()=>S(d),[S,d]),I=e.useMemo(()=>C(),[C]);n.useSyncedValues({openMethod:c,activeTriggerProps:k,inactiveTriggerProps:E,popupProps:I,floatingRootContext:m,nestedOpenDialogCount:g,nestedOpenDrawerCount:v})}const Cc=e.createContext(void 0);function Sc(t){const n=e.useContext(Cc);if(!1===t&&void 0===n)throw new Error(F(27));return n}const kc={...Pi,modal:ri(e=>e.modal),nested:ri(e=>e.nested),nestedOpenDialogCount:ri(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:ri(e=>e.nestedOpenDrawerCount),disablePointerDismissal:ri(e=>e.disablePointerDismissal),openMethod:ri(e=>e.openMethod),descriptionElementId:ri(e=>e.descriptionElementId),titleElementId:ri(e=>e.titleElementId),viewportElement:ri(e=>e.viewportElement),role:ri(e=>e.role)};class Ec extends yi{constructor(t){super(function(e={}){return{...Ii(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}(t),{popupRef:e.createRef(),backdropRef:e.createRef(),internalBackdropRef:e.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Ei,onOpenChange:void 0,onOpenChangeComplete:void 0},kc)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||null==this.state.activeTriggerId||(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);const n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(e,t){const n=B(()=>new Ec(t)).current;return e??n}}const Ic=e.createContext(!1);function Mc(t){const{children:r,open:o,defaultOpen:s=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:l=!1,modal:u=!0,actionsRef:c,handle:d,triggerId:f,defaultTriggerId:p=null}=t,m=Sc(!0),g=e.useContext(Ic),h=Boolean(m),v=Ec.useStore(d?.store,{open:s,openProp:o,activeTriggerId:p,triggerIdProp:f,modal:u,disablePointerDismissal:l,nested:h});Jo(()=>{void 0===o&&!1===v.state.open&&!0===s&&v.update({open:!0,activeTriggerId:p})}),v.useControlledProp("openProp",o),v.useControlledProp("triggerIdProp",f),v.useSyncedValues({disablePointerDismissal:l,nested:h,modal:u}),v.useContextCallback("onOpenChange",i),v.useContextCallback("onOpenChangeComplete",a);const b=v.useState("payload");Rc({store:v,actionsRef:c,parentContext:m?.store.context,isDrawer:g});const y=e.useMemo(()=>({store:v}),[v]);return n.jsx(Ic.Provider,{value:!1,children:n.jsx(Cc.Provider,{value:y,children:"function"==typeof r?r({payload:b}):r})})}function Pc(t){const{children:r,open:o,defaultOpen:s=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:l,handle:u,triggerId:c,defaultTriggerId:d=null}=t,f=Sc(!0),p=Boolean(f),m=Ec.useStore(u?.store,{open:s,openProp:o,activeTriggerId:d,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:p,role:"alertdialog"});m.useControlledProp("openProp",o),m.useControlledProp("triggerIdProp",c),m.useSyncedValue("nested",p),m.useContextCallback("onOpenChange",i),m.useContextCallback("onOpenChangeComplete",a);const g=m.useState("payload");Rc({store:m,actionsRef:l,parentContext:f?.store.context,isDrawer:!1});const h=e.useMemo(()=>({store:m}),[m]);return n.jsx(Ic.Provider,{value:!1,children:n.jsx(Cc.Provider,{value:h,children:"function"==typeof r?r({payload:g}):r})})}const Tc={...va,...Tn},Oc=e.forwardRef(function(e,t){const{render:n,className:r,style:o,forceRender:s=!1,...i}=e,{store:a}=Sc(),l=a.useState("open"),u=a.useState("nested"),c=a.useState("mounted");return ae("div",e,{state:{open:l,transitionStatus:a.useState("transitionStatus")},ref:[a.context.backdropRef,t],stateAttributesMapping:Tc,props:[{role:"presentation",hidden:!c,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:s||!u})}),Ac=e.forwardRef(function(e,t){const{render:n,className:r,disabled:o=!1,nativeButton:s=!0,style:i,...a}=e,{store:l}=Sc(),u=l.useState("open");const{getButtonProps:c,buttonRef:d}=er({disabled:o,native:s});return ae("button",e,{state:{disabled:o},ref:[t,d],props:[{onClick:function(e){u&&l.setOpen(!1,dn(Qt,e.nativeEvent))}},a,c]})}),Dc=e.forwardRef(function(e,t){const{render:n,className:r,style:o,id:s,...i}=e,{store:a}=Sc(),l=yn(s);return a.useSyncedValueWithCleanup("descriptionElementId",l),ae("p",e,{ref:t,props:[{id:l},i]})});let Fc=function(e){return e.nestedDialogs="--nested-dialogs",e}({}),Vc=((Nc={})[Nc.open=aa.open]="open",Nc[Nc.closed=aa.closed]="closed",Nc[Nc.startingStyle=aa.startingStyle]="startingStyle",Nc[Nc.endingStyle=aa.endingStyle]="endingStyle",Nc.nested="data-nested",Nc.nestedDialogOpen="data-nested-dialog-open",Nc);var Nc;const jc=e.createContext(void 0);const Bc={...va,...Tn,nestedDialogOpen:e=>e?{[Vc.nestedDialogOpen]:""}:null},Hc=e.forwardRef(function(t,r){const{className:o,finalFocus:s,initialFocus:i,render:a,style:l,...u}=t,{store:c}=Sc(),d=c.useState("descriptionElementId"),f=c.useState("disablePointerDismissal"),p=c.useState("floatingRootContext"),m=c.useState("popupProps"),g=c.useState("modal"),h=c.useState("mounted"),v=c.useState("nested"),b=c.useState("nestedOpenDialogCount"),y=c.useState("open"),x=c.useState("openMethod"),w=c.useState("titleElementId"),R=c.useState("transitionStatus"),C=c.useState("role");!function(){const t=e.useContext(jc);if(void 0===t)throw new Error(F(26))}(),Ko({open:y,ref:c.context.popupRef,onComplete(){y&&c.context.onOpenChangeComplete?.(!0)}});const S=void 0===i?function(e){return"touch"!==e||c.context.popupRef.current}:i,k=ae("div",t,{state:{open:y,nested:v,transitionStatus:R,nestedDialogOpen:b>0},props:[m,{"aria-labelledby":w??void 0,"aria-describedby":d??void 0,role:C,tabIndex:-1,hidden:!h,onKeyDown(e){Oo.has(e.key)&&e.stopPropagation()},style:{[Fc.nestedDialogs]:b}},u],ref:[r,c.context.popupRef,c.useStateSetter("popupElement")],stateAttributesMapping:Bc});return n.jsx(Js,{context:p,openInteractionType:x,disabled:!h,closeOnFocusOut:!f,initialFocus:S,returnFocus:s,modal:!1!==g,restoreFocus:"popup",children:k})}),zc=e.forwardRef(function(e,t){const{keepMounted:r=!1,...o}=e,{store:s}=Sc(),i=s.useState("mounted"),a=s.useState("modal"),l=s.useState("open");return i||r?n.jsx(jc.Provider,{value:r,children:n.jsxs(js,{ref:t,...o,children:[i&&!0===a&&n.jsx(uu,{ref:s.context.internalBackdropRef,inert:za(!l)}),e.children]})}):null}),Lc=e.forwardRef(function(e,t){const{render:n,className:r,style:o,id:s,...i}=e,{store:a}=Sc(),l=yn(s);return a.useSyncedValueWithCleanup("titleElementId",l),ae("h2",e,{ref:t,props:[{id:l},i]})}),Wc=e.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0});function qc(t=!1){const n=e.useContext(Wc);if(!n&&!t)throw new Error(F(86));return n}const Kc=function(t){const r=yn(),o=void 0===t.controlId?r:t.controlId,[s,i]=e.useState(o),[a,l]=e.useState(t.labelId),[u,c]=e.useState([]),d=B(()=>new Map),{messageIds:f}=cl(),p=Dt((e,t)=>{const n=d.current;void 0!==t?(n.set(e,t),i(e=>{if(0===n.size)return;let t;for(const r of n.values()){if(void 0!==e&&r===e)return e;void 0===t&&(t=r)}return t})):n.delete(e)}),m=e.useCallback(e=>_({"aria-describedby":f.concat(u).join(" ")||void 0},e),[f,u]),g=e.useMemo(()=>({controlId:s,registerControlId:p,labelId:a,setLabelId:l,messageIds:u,setMessageIds:c,getDescriptionProps:m}),[s,p,a,l,u,c,m]);return n.jsx(ul.Provider,{value:g,children:t.children})};function $c(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const Uc=Object.keys(Ja);function Gc(t){const{formRef:n,clearErrors:r}=ll(),{setValidityData:o,validate:s,validityData:i,validationDebounceTime:a,invalid:l,markedDirtyRef:u,state:c,name:d,shouldValidateOnChange:f}=t,{controlId:p,getDescriptionProps:m}=cl(),g=ts(),h=e.useRef(null),v=Dt(async(e,t=!1)=>{const r=h.current;if(!r)return;if(t){if(!1!==c.valid)return;const t=r.validity;if(!t.valueMissing){const t={value:e,state:{...Ja,valid:!0},error:"",errors:[],initialValue:i.initialValue};if(r.setCustomValidity(""),p){const e=n.current.fields.get(p);e&&n.current.fields.set(p,{...e,...$c(t,!1)})}return void o(t)}const s=Uc.reduce((e,n)=>(e[n]=t[n],e),{});if(!s.valid&&!function(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(const n of Uc)"valid"!==n&&("valueMissing"===n&&(t=e[n]),e[n]&&(t=!1));return t}(s))return}g.clear();let a=null,d=[];const m=function(e){const t=Uc.reduce((t,n)=>(t[n]=e.validity[n],t),{});let n=!1;for(const r of Uc)if("valid"!==r)if("valueMissing"===r&&t[r])n=!0;else if(t[r])return t;return n&&!u.current&&(t.valid=!0,t.valueMissing=!1),t}(r);let v;const b=f();if(r.validationMessage&&!b)v=r.validationMessage,d=[r.validationMessage];else{const t=Array.from(n.current.fields.values()).reduce((e,t)=>(t.name&&(e[t.name]=t.getValue()),e),{}),o=s(e,t);a="object"==typeof o&&null!==o&&"then"in o?await o:o,null!==a?(m.valid=!1,m.customError=!0,Array.isArray(a)?(d=a,r.setCustomValidity(a.join("\n"))):a&&(d=[a],r.setCustomValidity(a))):b&&(r.setCustomValidity(""),m.customError=!1,r.validationMessage?(v=r.validationMessage,d=[r.validationMessage]):r.validity.valid&&!m.valid&&(m.valid=!0))}const y={value:e,state:m,error:v??(Array.isArray(a)?a[0]:a??""),errors:d,initialValue:i.initialValue};if(p){const e=n.current.fields.get(p);e&&n.current.fields.set(p,{...e,...$c(y,l)})}o(y)}),b=e.useCallback((e={})=>_(m,!1===c.valid?{"aria-invalid":!0}:Y,e),[m,c.valid]),y=e.useCallback((e={})=>_({onChange(e){if(e.nativeEvent.defaultPrevented)return;if(r(d),!f())return void v(e.currentTarget.value,!0);const t=e.currentTarget;""!==t.value?(g.clear(),a?g.start(a,()=>{v(t.value)}):v(t.value)):v(t.value)}},b(e)),[b,r,d,g,v,a,f]);return e.useMemo(()=>({getValidationProps:b,getInputValidationProps:y,inputRef:h,commit:v}),[b,y,v])}function Yc(t){const{commit:n,invalid:o,markedDirtyRef:s,name:i,setValidityData:a,validityData:l}=t,{formRef:u}=ll(),c=e.useRef(null),d=e.useRef(null),f=e.useRef(null),p=Dt(()=>{const e=d.current;if(e)return e.getValue?e.getValue():e.value}),m=Dt((e=!0)=>{const t=d.current;if(!t)return;let o=t.value;void 0===o&&(o=p()),s.current=!0,e?r.flushSync(()=>n(o)):n(o)});function g(e=d.current?.id){e&&u.current.fields.delete(e)}return Nt(()=>{const e=d.current;e&&e.id&&u.current.fields.set(e.id,{getValue:p,name:i,controlRef:e.controlRef??f,validityData:$c(l,o),validate:m})},[u,p,o,i,m,l]),Nt(()=>{const e=u.current.fields;return()=>{const t=d.current?.id;t&&e.delete(t)}},[u]),Dt((e,t)=>{if(!t)return void(c.current===e&&(c.current=null,g(),d.current=null));const n=d.current?.id;c.current=e,d.current=t,n&&n!==t.id&&g(n),function(){const e=d.current;if(!e)return;let t=e.value;void 0===t&&(t=p()),null===l.initialValue&&null!==t&&a(e=>({...e,initialValue:t}))}(),function(){const e=d.current;e&&e.id&&u.current.fields.set(e.id,{getValue:p,name:i,controlRef:e.controlRef??f,validityData:$c(l,o),validate:m})}()})}const Xc=e.forwardRef(function(t,r){const{errors:o,validationMode:s,submitAttemptedRef:i}=ll(),{render:a,className:l,validate:u,validationDebounceTime:c=0,validationMode:d=s,name:f,disabled:p=!1,invalid:m,dirty:g,touched:h,actionsRef:v,style:b,...y}=t,{disabled:x}=qc(),w=Dt(u||(()=>null)),R=x||p,[C,S]=e.useState(!1),[k,E]=e.useState(!1),[I,M]=e.useState(!1),[P,T]=e.useState(!1),O=g??k,A=h??C,D=e.useRef(!1),F=Dt(e=>{void 0===g&&(e&&(D.current=!0),E(e))}),V=Dt(e=>{void 0===h&&S(e)}),N=Dt(()=>"onChange"===d||"onSubmit"===d&&i.current),j=!!f&&Object.hasOwn(o,f)&&void 0!==o[f],B=!0===m||j,[H,z]=e.useState({state:Ja,error:"",errors:[],value:null,initialValue:null}),L=!B&&H.state.valid,W=e.useMemo(()=>({disabled:R,touched:A,dirty:O,valid:L,filled:I,focused:P}),[R,A,O,L,I,P]),q=Gc({setValidityData:z,validate:w,validityData:H,validationDebounceTime:c,invalid:B,markedDirtyRef:D,state:W,name:f,shouldValidateOnChange:N}),K=e.useCallback(()=>{D.current=!0,q.commit(H.value)},[q,H]),$=Yc({commit:q.commit,invalid:B,markedDirtyRef:D,name:f,setValidityData:z,validityData:H});e.useImperativeHandle(v,()=>({validate:K}),[K]);const U=e.useMemo(()=>({invalid:B,name:f,validityData:H,setValidityData:z,disabled:R,touched:A,setTouched:V,dirty:O,setDirty:F,filled:I,setFilled:M,focused:P,setFocused:T,validate:w,validationMode:d,validationDebounceTime:c,shouldValidateOnChange:N,state:W,markedDirtyRef:D,registerFieldControl:$,validation:q}),[B,f,H,R,A,V,O,F,I,M,P,T,w,d,c,N,W,$,q]),G=ae("div",t,{ref:r,state:W,props:y,stateAttributesMapping:el});return n.jsx(nl.Provider,{value:U,children:G})}),_c=e.forwardRef(function(e,t){return n.jsx(Kc,{children:n.jsx(Xc,{...e,ref:t})})}),Jc=e.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,nativeLabel:a=!0,...l}=t,u=rl(!1),{labelId:c}=cl(),d=e.useRef(null),f=Kl({id:c??i,native:a});return ae("label",t,{ref:[n,d],state:u.state,props:[f,l],stateAttributesMapping:el})}),Qc={...el,...Tn},Zc=e.forwardRef(function(t,r){const{render:o,id:s,className:i,match:a,style:l,...u}=t,c=yn(s),{validityData:d,state:f,name:p}=rl(!1),{setMessageIds:m}=cl(),{errors:g}=ll(),h=p?g[p]:null,v="string"==typeof a;let b=!1;b=!0===a||(v?Boolean(d.state[a]):Boolean(h)||!1===d.state.valid);const{mounted:y,transitionStatus:x,setMounted:w}=An(b);Nt(()=>{if(b&&c)return m(e=>e.concat(c)),()=>{m(e=>e.filter(e=>e!==c))}},[b,c,m]);const R=e.useRef(null),[C,S]=e.useState(null),[k,E]=e.useState(null),I=d.errors.length>1?n.jsx("ul",{children:d.errors.map(e=>n.jsx("li",{children:e},e))}):d.error,M=v?I:h||I;let P=d.error;null!=h?P=Array.isArray(h)?JSON.stringify(h):h:d.errors.length>1&&(P=JSON.stringify(d.errors)),b&&P!==k&&(E(P),S(M)),Ko({open:b,ref:R,onComplete(){b||w(!1)}});const T=ae("div",t,{ref:[r,R],state:{...f,transitionStatus:x},props:[{id:c,children:b?M:C},u],stateAttributesMapping:Qc,enabled:y});return y?T:null}),ed=e.forwardRef(function(e,t){const{render:n,id:r,className:o,style:s,...i}=e,a=yn(r),l=rl(!1),{setMessageIds:u}=cl();Nt(()=>{if(a)return u(e=>e.concat(a)),()=>{u(e=>e.filter(e=>e!==a))}},[a,u]);return ae("p",e,{ref:t,state:l.state,props:[{id:a},i],stateAttributesMapping:el})}),td=e.forwardRef(function(t,n){const{render:r,className:o,id:s,name:i,value:a,disabled:l=!1,onValueChange:u,defaultValue:c,autoFocus:d=!1,style:f,...p}=t,{state:m,name:g,disabled:h,setTouched:v,setDirty:b,validityData:y,setFocused:x,setFilled:w,validationMode:R,validation:C}=rl(),S=h||l,k=g??i,E={...m,disabled:S},{labelId:I}=cl(),M=Vl({id:s});Nt(()=>{const e=null!=a;C.inputRef.current?.value||e&&""!==a?w(!0):e&&""===a&&w(!1)},[C.inputRef,w,a]);const P=e.useRef(null);Nt(()=>{d&&P.current===wr(Xr(P.current))&&x(!0)},[d,x]);const[T]=Tt({controlled:a,default:c,name:"FieldControl",state:"value"}),O=void 0!==a,A=O?T:void 0,D=Dt(()=>C.inputRef.current?.value);ol(C.inputRef,{id:M,value:A,getValue:D});return ae("input",t,{ref:[n,P],state:E,props:[{id:M,disabled:S,name:k,ref:C.inputRef,"aria-labelledby":I,autoFocus:d,...O?{value:A}:{defaultValue:c},onChange(e){const t=e.currentTarget.value;u?.(t,dn(Ut,e.nativeEvent)),b(t!==y.initialValue),w(""!==t)},onFocus(){x(!0)},onBlur(e){v(!0),x(!1),"onBlur"===R&&C.commit(e.currentTarget.value)},onKeyDown(e){"INPUT"===e.currentTarget.tagName&&"Enter"===e.key&&(v(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),p],stateAttributesMapping:el})}),nd=new Map;function rd(e,t,n){return null==e?"":function(e,t){const n=JSON.stringify({locale:e,options:t}),r=nd.get(n);if(r)return r;const o=new Intl.NumberFormat(e,t);return nd.set(n,o),o}(t,n).format(e)}function od(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const sd=e.forwardRef(function(t,r){const{render:o,className:s,validationMode:i="onSubmit",errors:a,onSubmit:l,onFormSubmit:u,actionsRef:c,style:d,...f}=t,p=e.useRef({fields:new Map}),m=e.useRef(!1),g=e.useRef(!1),h=Dt(e=>{e&&(e.focus(),"INPUT"===e.tagName&&e.select())}),[v,b]=e.useState(a);ml(a,()=>{b(a)}),e.useEffect(()=>{if(!m.current)return;m.current=!1;const e=Array.from(p.current.fields.values()).filter(e=>!1===e.validityData.state.valid);e.length&&h(e[0].controlRef.current)},[v,h]);const y=e.useCallback(e=>{const t=Array.from(p.current.fields.values());if(e){const n=t.find(t=>t.name===e);n&&n.validate(!1)}else t.forEach(e=>{e.validate(!1)})},[]);e.useImperativeHandle(c,()=>({validate:y}),[y]);const x=ae("form",t,{ref:r,props:[{noValidate:!0,onSubmit(e){g.current=!0;let t=Array.from(p.current.fields.values());t.forEach(e=>{e.validate()}),t=Array.from(p.current.fields.values());const n=t.filter(e=>!1===e.validityData.state.valid);if(n.length)e.preventDefault(),h(n[0].controlRef.current);else if(m.current=!0,l?.(e),u){e.preventDefault();const n=t.reduce((e,t)=>(t.name&&(e[t.name]=t.getValue()),e),{});u(n,fn(Ut,e.nativeEvent))}}},f]}),w=Dt(e=>{if(e&&v&&Y.hasOwnProperty.call(v,e)){const t={...v};delete t[e],b(t)}}),R=e.useMemo(()=>({formRef:p,validationMode:i,errors:v??Y,clearErrors:w,submitAttemptedRef:g}),[p,i,v,w]);return n.jsx(al.Provider,{value:R,children:x})}),id=e.createContext(void 0);function ad(t){const n=e.useContext(id);if(void 0===n&&!t)throw new Error(F(47));return n}const ld={...Pi,disabled:ri(e=>e.disabled),instantType:ri(e=>e.instantType),openMethod:ri(e=>e.openMethod),openChangeReason:ri(e=>e.openChangeReason),modal:ri(e=>e.modal),focusManagerModal:ri(e=>e.focusManagerModal),stickIfOpen:ri(e=>e.stickIfOpen),titleElementId:ri(e=>e.titleElementId),descriptionElementId:ri(e=>e.descriptionElementId),openOnHover:ri(e=>e.openOnHover),closeDelay:ri(e=>e.closeDelay),hasViewport:ri(e=>e.hasViewport)};class ud extends yi{constructor(t){const n={...{...Ii(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1},...t};n.open&&void 0===t?.mounted&&(n.mounted=!0),super(n,{popupRef:e.createRef(),backdropRef:e.createRef(),internalBackdropRef:e.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:e.createRef(),beforeContentFocusGuardRef:e.createRef(),stickIfOpenTimeout:new es,triggerElements:new Ei},ld)}setOpen=(e,t)=>{const n=t.reason===Yt,o=t.reason===Gt&&0===t.event.detail,s=!e&&(t.reason===sn||null==t.reason);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);const i=()=>{const n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set("stickIfOpen",!1)}),r.flushSync(i)):i(),o||s?this.set("instantType",o?"click":"dismiss"):t.reason===on?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,t){const n=B(()=>new ud(t)).current,r=e??n;return wn(n.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function cd({props:t}){const{children:r,open:o,defaultOpen:s=!1,onOpenChange:i,onOpenChangeComplete:a,modal:l=!1,handle:u,triggerId:c,defaultTriggerId:d=null}=t,f=ud.useStore(u?.store,{modal:l,open:s,openProp:o,activeTriggerId:d,triggerIdProp:c});Jo(()=>{void 0===o&&!1===f.state.open&&!0===s&&f.update({open:!0,activeTriggerId:d})}),f.useControlledProp("openProp",o),f.useControlledProp("triggerIdProp",c);const p=f.useState("open"),m=f.useState("payload");f.useContextCallback("onOpenChange",i),f.useContextCallback("onOpenChangeComplete",a);const{openMethod:g,triggerProps:h}=Hl(p);Si(f);const{forceUnmount:v}=ki(p,f,()=>{f.update({stickIfOpen:!0,openChangeReason:null})});e.useEffect(()=>{p||f.context.stickIfOpenTimeout.clear()},[f,p]);const b=e.useCallback(()=>{f.setOpen(!1,dn(cn))},[f]);e.useImperativeHandle(t.actionsRef,()=>({unmount:v,close:b}),[v,b]);const y=Oi({popupStore:f,onOpenChange:f.setOpen}),x=ni(y,{outsidePressEvent:{mouse:"trap-focus"===l?"sloppy":"intentional",touch:"sloppy"}}),w=_i(y),{getReferenceProps:R,getFloatingProps:C,getTriggerProps:S}=Wi([x,w]),k=e.useMemo(()=>R(h),[R,h]),E=e.useMemo(()=>S(h),[S,h]),I=e.useMemo(()=>C(),[C]);f.useSyncedValues({modal:l,openMethod:g,activeTriggerProps:k,inactiveTriggerProps:E,popupProps:I,floatingRootContext:y,nested:null!=Ws()});const M=e.useMemo(()=>({store:f}),[f]);return n.jsx(id.Provider,{value:M,children:"function"==typeof r?r({payload:m}):r})}function dd(e){return ad(!0)?n.jsx(cd,{props:e}):n.jsx(Us,{children:n.jsx(cd,{props:e})})}const fd=300,pd=e.forwardRef(function(t,r){const{render:o,className:s,disabled:i=!1,nativeButton:a=!0,handle:l,payload:u,openOnHover:c=!1,delay:d=fd,closeDelay:f=0,id:p,style:m,...g}=t,h=ad(!0),v=l?.store??h?.store;if(!v)throw new Error(F(74));const b=yn(p),y=v.useState("isTriggerActive",b),x=v.useState("floatingRootContext"),w=v.useState("isOpenedByTrigger",b),R=e.useRef(null),{registerTrigger:C,isMountedByThisTrigger:S}=Ci(b,R,v,{payload:u,disabled:i,openOnHover:c,closeDelay:f}),k=v.useState("openChangeReason"),E=v.useState("stickIfOpen"),I=v.useState("openMethod"),M=v.useState("focusManagerModal"),P=Li(x,{enabled:null!=x&&c&&("touch"!==I||k!==Gt),mouseOnly:!0,move:!1,handleClose:ra(),restMs:d,delay:{close:f},triggerElementRef:R,isActiveTrigger:y,isClosing:()=>"ending"===v.select("transitionStatus")}),T=Wi([Qs(x,{enabled:null!=x,stickIfOpen:E})]),O=v.useState("triggerProps",S),A={disabled:i,open:w},{getButtonProps:D,buttonRef:V}=er({disabled:i,native:a}),N=e.useMemo(()=>({open:e=>e&&k===Gt?ha.open(e):ga.open(e)}),[k]),j=ae("button",t,{state:A,ref:[V,r,C,R],props:[T.getReferenceProps(),P,O,{[Ps]:"",id:b},g,D],stateAttributesMapping:N}),{preFocusGuardRef:B,handlePreFocusGuardFocus:H,handleFocusTargetFocus:z}=vc(v,R);return y&&!M?n.jsxs(e.Fragment,{children:[n.jsx(ps,{ref:B,onFocus:H}),n.jsx(e.Fragment,{children:j},b),n.jsx(ps,{ref:v.context.triggerFocusTargetRef,onFocus:z})]}):n.jsx(e.Fragment,{children:j},b)}),md=e.createContext(void 0);const gd=e.forwardRef(function(e,t){const{keepMounted:r=!1,...o}=e,{store:s}=ad();return s.useState("mounted")||r?n.jsx(md.Provider,{value:r,children:n.jsx(js,{ref:t,...o})}):null}),hd=e.createContext(void 0);function vd(){const t=e.useContext(hd);if(!t)throw new Error(F(46));return t}const bd=e.forwardRef(function(t,r){const{render:o,className:s,anchor:i,positionMethod:a="absolute",side:l="bottom",align:u="center",sideOffset:c=0,alignOffset:d=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:v=Os,style:b,...y}=t,{store:x}=ad(),w=function(){const t=e.useContext(md);if(void 0===t)throw new Error(F(45));return t}(),R=Ks(),C=x.useState("floatingRootContext"),S=x.useState("mounted"),k=x.useState("open"),E=x.useState("openChangeReason"),I=x.useState("activeTriggerElement"),M=x.useState("modal"),P=x.useState("openMethod"),T=x.useState("positionerElement"),O=x.useState("instantType"),A=x.useState("transitionStatus"),D=x.useState("hasViewport"),V=e.useRef(null),N=On(T,!1,!1),j=Aa({anchor:i,floatingRootContext:C,positionMethod:a,mounted:S,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:g,disableAnchorTracking:h,keepMounted:w,nodeId:R,collisionAvoidance:v,adaptiveOrigin:D?Pa:void 0}),B=C.useState("domReferenceElement");Nt(()=>{const e=B,t=V.current;if(e&&(V.current=e),t&&e&&e!==t){x.set("instantType",void 0);const e=new AbortController;return N(()=>{x.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[B,N,x]);const H={open:k,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:O};hu(k&&!0===M&&E!==Yt,"touch"===P,T,I);const z=e.useCallback(e=>{x.set("positionerElement",e)},[x]),L=Va(t,H,{styles:j.positionerStyles,transitionStatus:A,props:y,refs:[r,z],hidden:!S,inert:!k});return n.jsxs(hd.Provider,{value:j,children:[S&&!0===M&&E!==Yt&&n.jsx(uu,{ref:x.context.internalBackdropRef,inert:za(!k),cutout:I}),n.jsx($s,{id:R,children:L})]})}),yd=e.createContext(void 0);function xd(e){const{value:t,children:r}=e;return n.jsx(yd.Provider,{value:t,children:r})}const wd={...va,...Tn},Rd=e.forwardRef(function(t,r){const{className:o,render:s,initialFocus:a,finalFocus:l,style:u,...c}=t,{store:d}=ad(),f=vd(),p=null!=ec(),{context:m,hasClosePart:g}=function(){const[t,n]=e.useState(0),r=Dt(()=>(n(e=>e+1),()=>{n(e=>Math.max(0,e-1))}));return{context:e.useMemo(()=>({register:r}),[r]),hasClosePart:t>0}}(),h=d.useState("open"),v=d.useState("openMethod"),b=d.useState("instantType"),y=d.useState("transitionStatus"),x=d.useState("popupProps"),w=d.useState("titleElementId"),R=d.useState("descriptionElementId"),C=d.useState("modal"),S=d.useState("mounted"),k=d.useState("openChangeReason"),E=d.useState("activeTriggerElement"),I=d.useState("floatingRootContext");Ko({open:h,ref:d.context.popupRef,onComplete(){h&&d.context.onOpenChangeComplete?.(!0)}});const M=d.useState("disabled");Hi(I,{enabled:d.useState("openOnHover")&&!M,closeDelay:d.useState("closeDelay")});const P=void 0===a?function(e){return"touch"!==e||d.context.popupRef.current}:a,T={open:h,side:f.side,align:f.align,instant:b,transitionStatus:y},O=!1!==C&&g;d.useSyncedValue("focusManagerModal",O);const A=e.useCallback(e=>{d.set("popupElement",e)},[d]),D=ae("div",t,{state:T,ref:[r,d.context.popupRef,A],props:[x,{"aria-labelledby":w,"aria-describedby":R,onKeyDown(e){p&&Oo.has(e.key)&&e.stopPropagation()}},Fa(y),c],stateAttributesMapping:wd});return n.jsx(Js,{context:I,openInteractionType:v,modal:O,disabled:!S||k===Yt,initialFocus:P,returnFocus:l,restoreFocus:"popup",previousFocusableElement:i(E)?E:void 0,nextFocusableElement:d.context.triggerFocusTargetRef,beforeContentFocusGuardRef:d.context.beforeContentFocusGuardRef,children:n.jsx(xd,{value:m,children:D})})}),Cd=e.forwardRef(function(e,t){const{className:n,render:r,style:o,...s}=e,{store:i}=ad(),a=i.useState("open"),{arrowRef:l,side:u,align:c,arrowUncentered:d,arrowStyles:f}=vd();return ae("div",e,{state:{open:a,side:u,align:c,uncentered:d},ref:[t,l],props:[{style:f,"aria-hidden":!0},s],stateAttributesMapping:va})}),Sd=e.forwardRef(function(e,t){const{render:n,className:r,style:o,...s}=e,{store:i}=ad(),a=yn(s.id);Nt(()=>(i.set("titleElementId",a),()=>{i.set("titleElementId",void 0)}),[i,a]);return ae("h2",e,{ref:t,props:[{id:a},s]})}),kd=e.forwardRef(function(e,t){const{render:n,className:r,style:o,...s}=e,{store:i}=ad(),a=yn(s.id);Nt(()=>(i.set("descriptionElementId",a),()=>{i.set("descriptionElementId",void 0)}),[i,a]);return ae("p",e,{ref:t,props:[{id:a},s]})}),Ed=e.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,style:a,...l}=t,{buttonRef:u,getButtonProps:c}=er({disabled:s,focusableWhenDisabled:!1,native:i}),{store:d}=ad();!function(){const t=e.useContext(yd);Nt(()=>t?.register(),[t])}();return ae("button",t,{ref:[n,u],props:[{onClick(e){d.setOpen(!1,dn(Qt,e.nativeEvent,e.currentTarget))}},l,c]})});let Id=function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const Md={checked:e=>e?{[Id.checked]:""}:{[Id.unchecked]:""},...Tn,...el},Pd="data-composite-item-active",Td=e.createContext(void 0);const Od=e.createContext(void 0);const Ad=e.forwardRef(function(t,r){const{render:o,className:s,disabled:i=!1,readOnly:a=!1,required:l=!1,"aria-labelledby":u,value:c,inputRef:d,nativeButton:f=!1,id:p,style:m,...g}=t,h=e.useContext(Td),{disabled:v,readOnly:b,required:y,form:x,checkedValue:w,touched:R=!1,validation:C,name:S}=h??{},k=h?.setCheckedValue??U,E=h?.setTouched??U,I=h?.registerControlRef??U,M=h?.registerInputRef??U,{setDirty:P,validityData:T,setTouched:O,setFilled:A,state:D,disabled:F}=rl(),V=il(),{labelId:N,getDescriptionProps:j}=cl(),B=F||V.disabled||v||i,z=b||a,L=y||l,W=x,q=h?w===c:""===c,K=e.useMemo(()=>Pl(c),[c]),$=e.useRef(null),G=e.useRef(null),X=Dt(e=>{e&&I(e,B)}),_=H(d,G,M);Nt(()=>{G.current?.checked&&A(!0)},[A]),Nt(()=>{G.current&&(B&&q?M(null):($.current&&I($.current,B),M(G.current)))},[q,B,I,M]);const J=yn(),Q=Vl({id:p,implicit:!1,controlRef:$}),Z=f?void 0:Q,ee=dl(u,N,G,!f,Z),te={role:"radio","aria-checked":q,"aria-required":L||void 0,"aria-readonly":z||void 0,"aria-labelledby":ee,[Pd]:q?"":void 0,id:f?Q:J,onKeyDown(e){"Enter"===e.key&&e.preventDefault()},onClick(e){e.defaultPrevented||B||z||(e.preventDefault(),G.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))},onFocus(e){e.defaultPrevented||B||z||!R||(G.current?.click(),E(!1))}},{getButtonProps:ne,buttonRef:re}=er({disabled:B,native:f}),oe={type:"radio",ref:_,form:W,id:Z,name:S,tabIndex:-1,style:S?fs:ds,"aria-hidden":!0,...void 0!==c?{value:K}:Y,disabled:B,checked:q,required:L,readOnly:z,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(B||z||void 0===c)return;const t=dn(Ut,e.nativeEvent);t.isCanceled||(O(!0),P(c!==T.initialValue),A(!0),k(c,t))},onFocus(){$.current?.focus()}},se=e.useMemo(()=>({...D,required:L,disabled:B,readOnly:z,checked:q}),[D,B,z,q,L]),ie=se,le=void 0!==h,ue=[r,$,re,X],ce=[te,j,C?.getValidationProps??Y,g,ne],de=ae("span",t,{enabled:!le,state:se,ref:ue,props:ce,stateAttributesMapping:Md});return n.jsxs(Od.Provider,{value:ie,children:[le?n.jsx(gc,{tag:"span",render:o,className:s,style:m,state:se,refs:ue,props:ce,stateAttributesMapping:Md}):de,n.jsx("input",{...oe,suppressHydrationWarning:!0})]})}),Dd=e.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,l=function(){const t=e.useContext(Od);if(void 0===t)throw new Error(F(52));return t}(),u=l.checked,{mounted:c,transitionStatus:d,setMounted:f}=An(u),p={...l,transitionStatus:d},m=e.useRef(null),g=i||c,h=ae("span",t,{ref:[n,m],state:p,props:a,stateAttributesMapping:Md});return Ko({open:u,ref:m,onComplete(){u||f(!1)}}),g?h:null}),Fd=[];function Vd(t){const{itemSizes:n,cols:r=1,loopFocus:o=!0,onLoop:s,dense:i=!1,orientation:a="both",direction:l,highlightedIndex:u,onHighlightedIndexChange:c,rootRef:d,enableHomeAndEndKeys:f=!1,stopEventPropagation:p=!1,disabledIndices:m,modifierKeys:g=Fd}=t,[h,v]=e.useState(0),b=r>1,y=e.useRef(null),x=H(y,d),w=e.useRef([]),R=e.useRef(!1),C=u??h,S=Dt((e,t=!1)=>{if((c??v)(e),t){const t=w.current[e];Vo(y.current,t,l,a)}}),k=Dt(e=>{if(0===e.size||R.current)return;R.current=!0;const t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(Pd))??null,r=n?t.indexOf(n):-1;-1!==r&&S(r),Vo(y.current,n,l,a)}),E=Dt((e,t,n)=>s?s?.(e,t,n,w):n),I=e.useMemo(()=>({"aria-orientation":"both"===a?void 0:a,ref:x,onFocus(e){const t=y.current,n=Cr(e.nativeEvent);t&&null!=n&&Fo(n)&&n.setSelectionRange(0,n.value.length??0)},onKeyDown(e){const t=f?To:Po;if(!t.has(e.key))return;if(function(e,t){for(const n of Do.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}(e,g))return;if(!y.current)return;const u="rtl"===l,c=u?yo:xo,d={horizontal:c,vertical:bo,both:c}[a],h=u?xo:yo,v={horizontal:h,vertical:vo,both:h}[a],x=Cr(e.nativeEvent);if(null!=x&&Fo(x)&&!Jn(x)){const t=x.selectionStart,n=x.selectionEnd,r=x.value??"";if(null==t||e.shiftKey||t!==n)return;if(e.key!==v&&t<r.length)return;if(e.key!==d&&t>0)return}let R=C;const k=zr(w,m),I=Lr(w,m);if(b){const t=n||Array.from({length:w.current.length},()=>({width:1,height:1})),s=Kr(t,r,i),l=s.findIndex(e=>null!=e&&!Gr(w.current,e,m)),c=s.reduce((e,t,n)=>null==t||Gr(w.current,t,m)?e:n,-1);R=s[qr(s.map(e=>null!=e?w.current[e]:null),{event:e,orientation:a,loopFocus:o,onLoop:E,cols:r,disabledIndices:Ur([...m||w.current.map((e,t)=>Gr(w.current,t)?t:void 0),void 0],s),minIndex:l,maxIndex:c,prevIndex:$r(C>I?k:C,t,s,r,e.key===bo?"bl":e.key===xo?"tr":"tl"),rtl:u})]}const M={horizontal:[c],vertical:[bo],both:[c,bo]}[a],P={horizontal:[h],vertical:[vo],both:[h,vo]}[a],T=b?t:{horizontal:f?Eo:ko,vertical:f?Mo:Io,both:t}[a];f&&(e.key===wo?R=k:e.key===Ro&&(R=I)),R===C&&(M.includes(e.key)||P.includes(e.key))&&(o&&R===I&&M.includes(e.key)?(R=k,s&&(R=s(e,C,R,w))):o&&R===k&&P.includes(e.key)?(R=I,s&&(R=s(e,C,R,w))):R=Wr(w.current,{startingIndex:R,decrement:P.includes(e.key),disabledIndices:m})),R===C||Hr(w.current,R)||(p&&e.stopPropagation(),T.has(e.key)&&e.preventDefault(),S(R,!0),queueMicrotask(()=>{w.current[R]?.focus()}))}}),[r,i,l,m,w,f,C,b,n,o,s,E,x,g,S,a,p]);return e.useMemo(()=>({props:I,highlightedIndex:C,onHighlightedIndexChange:S,elementsRef:w,disabledIndices:m,onMapChange:k,relayKeyboardEvent:I.onKeyDown}),[I,C,S,w,m,k])}function Nd(t){const{render:r,className:o,style:s,refs:i=G,props:a=G,state:l=Y,stateAttributesMapping:u,highlightedIndex:c,onHighlightedIndexChange:d,orientation:f,dense:p,itemSizes:m,loopFocus:g,onLoop:h,cols:v,enableHomeAndEndKeys:b,onMapChange:y,stopEventPropagation:x=!0,rootRef:w,disabledIndices:R,modifierKeys:C,highlightItemOnHover:S=!1,tag:k="div",...E}=t,I=qt(),{props:M,highlightedIndex:P,onHighlightedIndexChange:T,elementsRef:O,onMapChange:A,relayKeyboardEvent:D}=Vd({itemSizes:m,cols:v,loopFocus:g,onLoop:h,dense:p,orientation:f,highlightedIndex:c,onHighlightedIndexChange:d,rootRef:w,stopEventPropagation:x,enableHomeAndEndKeys:b,direction:I,disabledIndices:R,modifierKeys:C}),F=ae(k,t,{state:l,ref:i,props:[M,...a,E],stateAttributesMapping:u}),V=e.useMemo(()=>({highlightedIndex:P,onHighlightedIndexChange:T,highlightItemOnHover:S,relayKeyboardEvent:D}),[P,T,S,D]);return n.jsx(Qn.Provider,{value:V,children:n.jsx(Bt,{elementsRef:O,onMapChange:e=>{y?.(e),A(e)},children:F})})}const jd=[Ao],Bd=e.forwardRef(function(t,r){const{render:o,className:s,disabled:i,readOnly:a,required:l,onValueChange:u,value:c,defaultValue:d,form:f,name:p,inputRef:m,id:g,style:h,...v}=t,{setTouched:b,setFocused:y,shouldValidateOnChange:x,validationMode:w,name:R,disabled:C,state:S,validation:k,setDirty:E,setFilled:I,validityData:M}=rl(),{labelId:P}=cl(),{clearErrors:T}=ll(),O=qc(!0),A=C||i,D=R??p,F=yn(g),[V,N]=Tt({controlled:c,default:d,name:"RadioGroup",state:"value"}),j=Dt(u),B=Dt((e,t)=>{j(e,t),t.isCanceled||N(e)}),H=e.useRef(null),z=e.useRef(null),L=e.useRef(null);function W(e){let t;return m&&("function"==typeof m?t=m(e):m.current=e),z.current=e,k.inputRef.current=e,t}const q=Dt((e,t=!1)=>{e&&(t?H.current===e&&(H.current=null):null==H.current&&(H.current=e))}),K=Dt(e=>{if(!e||e.disabled)return;L.current||(L.current=e);const t=z.current;return e.checked||null==t||t.disabled?W(e):void 0}),$=Dt(()=>V??null);ol(H,{id:F,value:V,getValue:$}),ml(V,()=>{T(D),E(V!==M.initialValue),I(null!=V),x()?k.commit(V):k.commit(V,!0);const e=L.current;null==V&&e&&!e.disabled&&W(e)});const[U,G]=e.useState(!1),Y=v["aria-labelledby"]??P??O?.legendId,X={...S,disabled:A??!1,required:l??!1,readOnly:a??!1},_=e.useMemo(()=>({...S,checkedValue:V,disabled:A,form:f,validation:k,name:D,onValueChange:j,readOnly:a,registerControlRef:q,registerInputRef:K,required:l,setCheckedValue:B,setTouched:G,touched:U}),[V,A,f,k,S,D,j,a,q,K,l,B,G,U]),J={role:"radiogroup","aria-required":l||void 0,"aria-disabled":A||void 0,"aria-readonly":a||void 0,"aria-labelledby":Y,onFocus(){y(!0)},onBlur(e){Rr(e.currentTarget,e.relatedTarget)||(b(!0),y(!1),"onBlur"===w&&k.commit(V))},onKeyDownCapture(e){e.key.startsWith("Arrow")&&(b(!0),G(!0),y(!0))}};return n.jsx(Td.Provider,{value:_,children:n.jsx(Nd,{render:o,className:s,style:h,state:X,props:[J,k.getValidationProps,v],refs:[r],stateAttributesMapping:el,enableHomeAndEndKeys:!1,modifierKeys:jd})})}),Hd=e.createContext(void 0);let zd=function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const Ld={...el,checked:e=>e?{[zd.checked]:""}:{[zd.unchecked]:""}},Wd=e.forwardRef(function(t,r){const{checked:o,className:s,defaultChecked:i,"aria-labelledby":a,form:l,id:u,inputRef:c,name:d,nativeButton:f=!1,onCheckedChange:p,readOnly:m=!1,required:g=!1,disabled:h=!1,render:v,uncheckedValue:b,value:y,style:x,...w}=t,{clearErrors:R}=ll(),{state:C,setTouched:S,setDirty:k,validityData:E,setFilled:I,setFocused:M,shouldValidateOnChange:P,validationMode:T,disabled:O,name:A,validation:D}=rl(),{labelId:F}=cl(),V=O||h,N=A??d,j=Dt(p),B=e.useRef(null),z=H(B,c,D.inputRef),L=e.useRef(null),W=yn(),q=Vl({id:u,implicit:!1,controlRef:L}),K=f?void 0:q,[$,U]=Tt({controlled:o,default:Boolean(i),name:"Switch",state:"checked"});ol(L,{id:W,value:$}),Nt(()=>{B.current&&I(B.current.checked)},[B,I]),ml($,()=>{R(N),k($!==E.initialValue),I($),P()?D.commit($):D.commit($,!0)});const{getButtonProps:G,buttonRef:X}=er({disabled:V,native:f}),J=dl(a,F,B,!f,K),Q={id:f?q:W,role:"switch","aria-checked":$,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":J,onFocus(){V||M(!0)},onBlur(){const e=B.current;e&&!V&&(S(!0),M(!1),"onBlur"===T&&D.commit(e.checked))},onClick(e){m||V||(e.preventDefault(),B.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},Z=e.useMemo(()=>_({checked:$,disabled:V,form:l,id:K,name:N,required:g,style:N?fs:ds,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:z,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m)return void e.preventDefault();const t=e.currentTarget.checked,n=dn(Ut,e.nativeEvent);j?.(t,n),n.isCanceled||U(t)},onFocus(){L.current?.focus()}},D.getInputValidationProps,void 0!==y?{value:y}:Y),[$,V,l,z,K,N,j,m,g,U,D,y]),ee=e.useMemo(()=>({...C,checked:$,disabled:V,readOnly:m,required:g}),[C,$,V,m,g]),te=ae("span",t,{state:ee,ref:[r,L,X],props:[Q,D.getValidationProps,w,G],stateAttributesMapping:Ld});return n.jsxs(Hd.Provider,{value:ee,children:[te,!$&&N&&void 0!==b&&n.jsx("input",{type:"hidden",form:l,name:N,value:b}),n.jsx("input",{...Z,suppressHydrationWarning:!0})]})}),qd=e.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{state:a}=rl();return ae("span",t,{state:{...a,...function(){const t=e.useContext(Hd);if(void 0===t)throw new Error(F(63));return t}()},ref:n,stateAttributesMapping:Ld,props:i})}),Kd=e.createContext(void 0);function $d(){const t=e.useContext(Kd);if(void 0===t)throw new Error(F(64));return t}let Ud=function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e}({});const Gd={tabActivationDirection:e=>({[Ud.activationDirection]:e})},Yd=e.forwardRef(function(t,r){const{className:o,defaultValue:s=0,onValueChange:i,orientation:a="horizontal",render:l,value:u,style:c,...d}=t,f=Object.hasOwn(t,"defaultValue"),p=e.useRef([]),[m,g]=e.useState(()=>new Map),[h,v]=Tt({controlled:u,default:s,name:"Tabs",state:"value"}),b=void 0!==u,[y,x]=e.useState(()=>new Map),w=e.useCallback(e=>{if(void 0===e)return null;for(const[t,n]of y.entries())if(null!=n&&e===(n.value??n.index))return t;return null},[y]),[R,C]=e.useState(()=>({previousValue:h,tabActivationDirection:"none"})),{previousValue:S,tabActivationDirection:k}=R;let E=k,I=!1;S!==h&&(E=Xd(S,h,a,y),I=null!=S&&null!=h&&null==w(h));const M=I?S:h,P=S!==M||k!==E;Nt(()=>{P&&C({previousValue:M,tabActivationDirection:E})},[M,P,E]);const T=Dt((e,t)=>{const n=Xd(h,e,a,y);t.activationDirection=n,i?.(e,t),t.isCanceled||v(e)}),O=Dt((e,t)=>{g(n=>{if(n.get(e)===t)return n;const r=new Map(n);return r.set(e,t),r})}),A=Dt((e,t)=>{g(n=>{if(!n.has(e)||n.get(e)!==t)return n;const r=new Map(n);return r.delete(e),r})}),D=e.useCallback(e=>m.get(e),[m]),F=e.useCallback(e=>{for(const t of y.values())if(e===t?.value)return t?.id},[y]),V=e.useMemo(()=>({getTabElementBySelectedValue:w,getTabIdByPanelValue:F,getTabPanelIdByValue:D,onValueChange:T,orientation:a,registerMountedTabPanel:O,setTabMap:x,unregisterMountedTabPanel:A,tabActivationDirection:E,value:h}),[w,F,D,T,a,O,x,A,E,h]),N=e.useMemo(()=>{for(const e of y.values())if(null!=e&&e.value===h)return e},[y,h]),j=e.useMemo(()=>{for(const e of y.values())if(null!=e&&!e.disabled)return e.value},[y]);Nt(()=>{if(b||0===y.size)return;const e=N?.disabled;if(f&&e&&h===s)return;if(!e&&!(null==N&&null!==h))return;const t=j??null;h!==t&&(v(t),C(e=>"none"===e.tabActivationDirection?e:{...e,tabActivationDirection:"none"}))},[s,j,f,b,N,v,y,h]);const B=ae("div",t,{state:{orientation:a,tabActivationDirection:E},ref:r,props:d,stateAttributesMapping:Gd});return n.jsx(Kd.Provider,{value:V,children:n.jsx(Bt,{elementsRef:p,children:B})})});function Xd(e,t,n,r){if(null==e||null==t)return"none";let o=null,s=null;for(const[l,u]of r.entries()){if(null==u)continue;const n=u.value??u.index;if(e===n&&(o=l),t===n&&(s=l),null!=o&&null!=s)break}if(null==o||null==s)return o===s||"number"!=typeof e&&"string"!=typeof e||typeof e!=typeof t?"none":"horizontal"===n?t>e?"right":"left":t>e?"down":"up";const i=o.getBoundingClientRect(),a=s.getBoundingClientRect();if("horizontal"===n){if(a.left<i.left)return"left";if(a.left>i.left)return"right"}else{if(a.top<i.top)return"up";if(a.top>i.top)return"down"}return"none"}const _d=e.createContext(void 0);const Jd=e.forwardRef(function(t,n){const{className:r,disabled:o=!1,render:s,value:i,id:a,nativeButton:l=!0,style:u,...c}=t,{value:d,getTabPanelIdByValue:f,orientation:p}=$d(),{activateOnFocus:m,highlightedTabIndex:g,onTabActivation:h,registerTabResizeObserverElement:v,setHighlightedTabIndex:b,tabsListElement:y}=function(){const t=e.useContext(_d);if(void 0===t)throw new Error(F(65));return t}(),x=yn(a),w=e.useMemo(()=>({disabled:o,id:x,value:i}),[o,x,i]),{compositeProps:R,compositeRef:C,index:S}=mc({metadata:w}),k=i===d,E=e.useRef(!1),I=e.useRef(null);e.useEffect(()=>{const e=I.current;if(e)return v(e)},[v]),Nt(()=>{if(E.current)return void(E.current=!1);if(!(k&&S>-1&&g!==S))return;const e=y;if(null!=e){const t=wr(Xr(e));if(t&&Rr(e,t))return}o||b(S)},[k,S,g,b,o,y]);const{getButtonProps:M,buttonRef:P}=er({disabled:o,native:l,focusableWhenDisabled:!0}),T=f(i),O=e.useRef(!1),A=e.useRef(!1);return ae("button",t,{state:{disabled:o,active:k,orientation:p},ref:[n,P,C,I],props:[R,{role:"tab","aria-controls":T,"aria-selected":k,id:x,onClick:function(e){k||o||h(i,dn(Ut,e.nativeEvent,void 0,{activationDirection:"none"}))},onFocus:function(e){k||(S>-1&&!o&&b(S),o||m&&(!O.current||O.current&&A.current)&&h(i,dn(Ut,e.nativeEvent,void 0,{activationDirection:"none"})))},onPointerDown:function(e){if(!k&&!o&&(O.current=!0,!e.button||0===e.button)){A.current=!0;Xr(e.currentTarget).addEventListener("pointerup",function(){O.current=!1,A.current=!1},{once:!0})}},[Pd]:k?"":void 0,onKeyDownCapture(){E.current=!0}},c,M]})});function Qd(){return U}function Zd(){return!1}function ef(){return!0}const tf=e.createContext(void 0),nf={disableStyleElements:!1};let rf=((of={}).index="data-index",of.activationDirection="data-activation-direction",of.orientation="data-orientation",of.hidden="data-hidden",of[of.startingStyle=In.startingStyle]="startingStyle",of[of.endingStyle=In.endingStyle]="endingStyle",of);var of;const sf={...Gd,...Tn},af=e.forwardRef(function(t,n){const{className:r,value:o,render:s,keepMounted:i=!1,style:a,...l}=t,{value:u,getTabIdByPanelValue:c,orientation:d,tabActivationDirection:f,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=$d(),g=yn(),h=e.useMemo(()=>({id:g,value:o}),[g,o]),{ref:v,index:b}=jn({metadata:h}),y=o===u,{mounted:x,transitionStatus:w,setMounted:R}=An(y),C=!x,S=c(o),k={hidden:C,orientation:d,tabActivationDirection:f,transitionStatus:w},E=e.useRef(null),I=ae("div",t,{state:k,ref:[n,v,E],props:[{"aria-labelledby":S,hidden:C,id:g,role:"tabpanel",tabIndex:y?0:-1,inert:za(!y),[rf.index]:b},l],stateAttributesMapping:sf});Ko({open:y,ref:E,onComplete(){y||R(!1)}}),Nt(()=>{if((!C||i)&&null!=g)return p(o,g),()=>{m(o,g)}},[C,i,o,g,p,m]);return i||x?I:null}),lf=e.forwardRef(function(t,r){const{activateOnFocus:o=!1,className:s,loopFocus:i=!0,render:a,style:l,...u}=t,{onValueChange:c,orientation:d,value:f,setTabMap:p,tabActivationDirection:m}=$d(),[g,h]=e.useState(0),[v,b]=e.useState(null),y=e.useRef(new Set),x=e.useRef(new Set),w=e.useRef(null),R=Dt(()=>{y.current.forEach(e=>{e()})});e.useEffect(()=>{if("undefined"==typeof ResizeObserver)return;const e=new ResizeObserver(()=>{y.current.size&&R()});return w.current=e,v&&e.observe(v),x.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),w.current=null}},[v,R]);const C=Dt(e=>(y.current.add(e),()=>{y.current.delete(e)})),S=Dt(e=>(x.current.add(e),w.current?.observe(e),()=>{x.current.delete(e),w.current?.unobserve(e)})),k=Dt((e,t)=>{e!==f&&c(e,t)}),E={orientation:d,tabActivationDirection:m},I={"aria-orientation":"vertical"===d?"vertical":void 0,role:"tablist"},M=e.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:g,registerIndicatorUpdateListener:C,registerTabResizeObserverElement:S,onTabActivation:k,setHighlightedTabIndex:h,tabsListElement:v}),[o,g,C,S,k,h,v]);return n.jsx(_d.Provider,{value:M,children:n.jsx(Nd,{render:a,className:s,style:l,state:E,refs:[r,b],props:[I,u],stateAttributesMapping:Gd,highlightedIndex:g,enableHomeAndEndKeys:!0,loopFocus:i,orientation:d,onHighlightedIndexChange:h,onMapChange:p,disabledIndices:G})})}),uf=e.forwardRef(function(e,t){const{render:n,className:r,disabled:o=!1,focusableWhenDisabled:s=!1,nativeButton:i=!0,style:a,...l}=e,{getButtonProps:u,buttonRef:c}=er({disabled:o,focusableWhenDisabled:s,native:i});return ae("button",e,{state:{disabled:o},ref:[t,c],props:[l,u]})}),cf=e.createContext(void 0);function df(){const t=e.useContext(cf);if(!t)throw new Error(F(73));return t}let ff=0;function pf(e,t){if("string"==typeof e)return{description:e};if("function"==typeof e){const n=e(t);return"string"==typeof n?{description:n}:n}return e}const mf=((...e)=>{const t=new WeakMap;let n=1;const r=e[e.length-1],o=e.length-1||1,s=r.length-o;if(s>3)throw new Error(F(2));return(o,i,a,l)=>{let u=o.__cacheKey__;u||(u={id:n},o.__cacheKey__=u,n+=1);let c=t.get(u);if(!c){let n=e;const o=[void 0,void 0,void 0];switch(s){case 0:break;case 1:n=[...e.slice(0,-1),()=>o[0],r];break;case 2:n=[...e.slice(0,-1),()=>o[0],()=>o[1],r];break;case 3:n=[...e.slice(0,-1),()=>o[0],()=>o[1],()=>o[2],r];break;default:throw new Error(F(2))}c=mi(...n),c.selectorArgs=o,t.set(u,c)}switch(c.selectorArgs[0]=i,c.selectorArgs[1]=a,c.selectorArgs[2]=l,s){case 0:return c(o);case 1:return c(o,i);case 2:return c(o,i,a);case 3:return c(o,i,a,l);default:throw new Error("unreachable")}}})(e=>e.toasts,e=>{const t=new Map;let n=0,r=0;return e.forEach((e,o)=>{const s="ending"===e.transitionStatus;t.set(e.id,{value:e,domIndex:o,visibleIndex:s?-1:n,offsetY:r}),r+=e.height||0,s||(n+=1)}),t}),gf={toasts:ri(e=>e.toasts),isEmpty:ri(e=>0===e.toasts.length),toast:ri(mf,(e,t)=>e.get(t)?.value),toastIndex:ri(mf,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:ri(mf,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:ri(mf,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:ri(e=>e.hovering),focused:ri(e=>e.focused),expanded:ri(e=>e.hovering||e.focused),expandedOrOutOfFocus:ri(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:ri(e=>e.prevFocusElement)};class hf extends yi{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},gf)}setFocused(e){this.set("focused",e)}setHovering(e){this.set("hovering",e)}setIsWindowFocused(e){this.set("isWindowFocused",e)}setPrevFocusElement(e){this.set("prevFocusElement",e)}setViewport=e=>{this.set("viewport",e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,t={}){const n=gf.toastIndex(this.state,e);if(-1===n)return;const r=this.state.toasts[n];t.skipOnRemove||r?.onRemove?.();const o=[...this.state.toasts];o.splice(n,1),this.setToasts(o)}addToast=e=>{const{timeout:t,limit:n}=this.state,r=e.id||function(e){return ff+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${ff}`}("toast");if(e.id){const t=gf.toast(this.state,e.id);if(t){if("ending"!==t.transitionStatus){const{id:t,transitionStatus:n,...r}=e;return this.updateToastInternal(e.id,r,{resetTimer:!0,markUpdated:!0}),e.id}this.removeToast(e.id,{skipOnRemove:!0})}}const o={...e,id:r,updateKey:0,transitionStatus:"starting"},s=[o,...this.state.toasts],i=s.filter(e=>"ending"!==e.transitionStatus);if(i.length>n){const e=i.length-n,t=i.slice(-e),r=new Set(t.map(e=>e.id));this.setToasts(s.map(e=>{const t=r.has(e.id);return e.limited!==t?{...e,limited:t}:e}))}else this.setToasts(s.map(e=>e.limited?{...e,limited:!1}:e));const a=o.timeout??t;return"loading"!==o.type&&a>0&&this.scheduleTimer(r,a,()=>this.closeToast(r)),gf.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,t)=>{this.updateToastInternal(e,t,{markUpdated:!0})};updateToastInternal=(e,t,n={})=>{const{timeout:r,toasts:o}=this.state,s=gf.toast(this.state,e)??null;if(!s)return;if("ending"===s.transitionStatus)return;const i={...s,...t,...n.markUpdated&&{updateKey:(s.updateKey??0)+1}};this.setToasts(o.map(t=>t.id===e?i:t));const a=i.timeout??r,l=s?.timeout??r,u=Object.hasOwn(t,"timeout"),c="ending"!==i.transitionStatus&&"loading"!==i.type&&a>0,d=this.timers.has(e),f=l!==a,p="loading"===s?.type;if(!c&&d){const t=this.timers.get(e);return t?.timeout?.clear(),void this.timers.delete(e)}if(c&&(!d||f||u||p||n.resetTimer)){const t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,a,()=>this.closeToast(e)),gf.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{const t=void 0===e,{limit:n,toasts:r}=this.state;let o;if(t)o=r,this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear();else{const t=gf.toast(this.state,e);if(!t)return;o=[t];const n=this.timers.get(e);n?.timeout&&(n.timeout.clear(),this.timers.delete(e))}let s=0;const i={toasts:r.map(r=>{if(t||r.id===e)return{...r,transitionStatus:"ending",height:0};if("ending"===r.transitionStatus)return r;const o=s>=n;return s+=1,r.limited!==o?{...r,limited:o}:r})};(t||1===r.length)&&(i.hovering=!1,i.focused=!1),this.update(i),o.forEach(e=>{"ending"!==e.transitionStatus&&e.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,t)=>{const n=pf(t.loading),r=this.addToast({...n,type:"loading"}),o=e.then(e=>{const n=pf(t.success,e);return this.updateToast(r,{...n,type:"success",timeout:n.timeout}),e}).catch(e=>{const n=pf(t.error,e);return this.updateToast(r,{...n,type:"error",timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,"setPromise")&&t.setPromise(o),o};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();const t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=es.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if("touch"!==e.pointerType)return;const t=Cr(e);Rr(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){const r=Date.now(),o=!gf.expandedOrOutOfFocus(this.state),s=o?es.create():void 0;s?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:s,start:o?r:0,delay:t,remaining:t,callback:n})}setToasts(e){const t={toasts:e};0===e.length&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){const t=wr(Xr(this.state.viewport));if(!this.state.viewport||!Rr(this.state.viewport,t)||!Pr(t))return;if(void 0===e)return void this.restoreFocusToPrevElement();const n=gf.toasts(this.state),r=gf.toastIndex(this.state,e);let o=null,s=r+1;for(;s<n.length;){if("ending"!==n[s].transitionStatus){o=n[s];break}s+=1}if(!o)for(s=r-1;s>=0;){if("ending"!==n[s].transitionStatus){o=n[s];break}s-=1}o?o.ref?.current?.focus():this.restoreFocusToPrevElement()}}const vf=function(t){const{children:r,timeout:o=5e3,limit:s=3,toastManager:i}=t,a=B(()=>new hf({timeout:o,limit:s,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return wn(a.disposeEffect),e.useEffect(function(){if(!i)return;return i[" subscribe"](({action:e,options:t})=>{const n=t.id;"promise"===e&&t.promise?a.promiseToast(t.promise,t):"update"===e&&n?a.updateToast(n,t):"close"===e?a.closeToast(n):a.addToast(t)})},[a,o,i]),a.useSyncedValues({timeout:o,limit:s}),n.jsx(cf.Provider,{value:a,children:r})};let bf=function(e){return e.frontmostHeight="--toast-frontmost-height",e}({});const yf=e.forwardRef(function(t,r){const{render:o,className:s,style:i,children:a,...l}=t,u=df(),c=ts(),d=e.useRef(!1),f=e.useRef(!1),m=e.useRef(!1),g=u.useState("isEmpty"),h=u.useState("toasts"),v=u.useState("focused"),b=u.useState("expanded"),y=u.useState("prevFocusElement"),x=h[0]?.height??0,w=e.useMemo(()=>h.some(e=>"ending"===e.transitionStatus),[h]);function R(e){const t=u.state.viewport;t&&(d.current=!0,e.relatedTarget===t?h[0]?.ref?.current?.focus():u.restoreFocusToPrevElement())}function C(){const e=u.state.toasts.some(e=>"ending"===e.transitionStatus);u.state.isWindowFocused&&!e&&!m.current&&f.current&&(u.resumeTimers(),u.setHovering(!1),f.current=!1)}function S(){u.pauseTimers(),u.setHovering(!0),f.current=!1}function k(e){"touch"===e.pointerType&&(m.current=!1,C())}function E(){d.current?d.current=!1:v||Pr(wr(Xr(u.state.viewport)))&&(u.setFocused(!0),u.pauseTimers())}e.useEffect(()=>{const e=u.state.viewport;if(!e)return;return zo(p(e),"keydown",function(t){g||"F6"===t.key&&Cr(t)!==e&&(t.preventDefault(),u.setPrevFocusElement(wr(Xr(e))),e?.focus({preventScroll:!0}),u.pauseTimers(),u.setFocused(!0))})},[u,g]),e.useEffect(()=>{const e=u.state.viewport;if(!e||g)return;const t=p(e);return as(zo(t,"blur",function(e){Cr(e)===t&&(u.setIsWindowFocused(!1),u.pauseTimers())},!0),zo(t,"focus",function(n){if(n.relatedTarget)return;const r=Cr(n),o=wr(Xr(e));r!==t&&Rr(e,r)&&Pr(o)||u.resumeTimers(),c.start(0,()=>u.setIsWindowFocused(!0))},!0))},[u,c,g]),e.useEffect(()=>{const e=u.state.viewport;if(!e||g)return;return zo(Xr(e),"pointerdown",u.handleDocumentPointerDown,!0)},[g,u]),e.useEffect(C,[w,u]);const I={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:S,onMouseMove:S,onMouseLeave:function(){w||m.current?f.current=!0:(u.resumeTimers(),u.setHovering(!1))},onFocus:E,onBlur:function(e){v&&!Rr(u.state.viewport,e.relatedTarget)&&(u.setFocused(!1),u.resumeTimers())},onKeyDown:function(e){"Tab"===e.key&&e.shiftKey&&Cr(e.nativeEvent)===u.state.viewport&&(e.preventDefault(),u.restoreFocusToPrevElement(),u.resumeTimers())},onClick:E,onPointerDown:function(e){"touch"===e.pointerType&&(m.current=!0)},onPointerUp:k,onPointerCancel:k},M={expanded:b},P=ae("div",t,{ref:[r,u.setViewport],state:M,props:[I,{style:{[bf.frontmostHeight]:x?`${x}px`:void 0}},l,{children:n.jsxs(e.Fragment,{children:[!g&&y&&n.jsx(ps,{onFocus:R}),a,!g&&y&&n.jsx(ps,{onFocus:R})]})}]}),T=e.useMemo(()=>h.filter(e=>"high"===e.priority),[h]);return n.jsxs(e.Fragment,{children:[!g&&y&&n.jsx(ps,{onFocus:R}),P,!v&&T.length>0&&n.jsx("div",{style:ds,children:T.map(e=>n.jsxs("div",{role:"alert","aria-atomic":!0,children:[n.jsx("div",{children:e.title}),n.jsx("div",{children:e.description})]},e.id))})]})}),xf=e.createContext(void 0);function wf(){const t=e.useContext(xf);if(!t)throw new Error(F(66));return t}let Rf=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 Cf={...Tn,swipeDirection:e=>e?{"data-swipe-direction":e}:null},Sf=.5;function kf(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}const Ef=e.forwardRef(function(t,o){const{toast:s,render:i,className:a,swipeDirection:l=["down","right"],style:u,...c}=t,d=void 0!==s.positionerProps?.anchor;let f=[];d||(f=Array.isArray(l)?l:[l]);const m=f.length>0,g=df(),[h,v]=e.useState(void 0),[b,y]=e.useState(!1),[x,w]=e.useState(!1),[R,C]=e.useState(!1),[S,k]=e.useState({x:0,y:0}),[E,I]=e.useState({x:0,y:0,scale:1}),[M,P]=e.useState(),[T,O]=e.useState(),[A,D]=e.useState(null),F=e.useRef(null),V=e.useRef({x:0,y:0}),N=e.useRef({x:0,y:0,scale:1}),j=e.useRef(void 0),B=e.useRef(0),H=e.useRef(!1),z=e.useRef({x:0,y:0}),L=e.useRef(!1),W=g.useState("toastIndex",s.id),q=g.useState("toastVisibleIndex",s.id),K=g.useState("toastOffsetY",s.id),$=g.useState("focused"),U=g.useState("expanded");Ko({open:"ending"!==s.transitionStatus,ref:F,onComplete(){"ending"===s.transitionStatus&&g.removeToast(s.id)}});const G=Dt((e=!1)=>{const t=F.current;if(!t)return;const n=t.style.height;t.style.height="auto";const o=t.offsetHeight;function i(){g.updateToastInternal(s.id,{ref:F,height:o,..."starting"===s.transitionStatus?{transitionStatus:void 0}:{}})}t.style.height=n,e?r.flushSync(i):i()});Nt(G,[G]),e.useEffect(()=>{if(!m)return;const e=F.current;if(e)return zo(e,"touchmove",function(t){Rr(e,Cr(t))&&t.preventDefault()},{passive:!1})},[m]);const Y="high"===s.priority,X={role:Y?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":M,"aria-describedby":T,"aria-hidden":!(!Y||$)||void 0,onPointerDown:m?function(e){if(0!==e.button)return;"touch"===e.pointerType&&g.pauseTimers();const t=Cr(e.nativeEvent);if(!(!!t&&t.closest('button,a,input,textarea,[role="button"],[data-base-ui-swipe-ignore],[data-swipe-ignore]'))){if(H.current=!1,j.current=void 0,B.current=0,V.current={x:e.clientX,y:e.clientY},z.current=V.current,F.current){const e=function(e){const t=p(e).getComputedStyle(e).transform;let n=0,r=0,o=1;if(t&&"none"!==t){const e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){const t=e[1].split(", ").map(parseFloat);6===t.length?(n=t[4],r=t[5],o=Math.sqrt(t[0]*t[0]+t[1]*t[1])):16===t.length&&(n=t[12],r=t[13],o=t[0])}}return{x:n,y:r,scale:o}}(F.current);N.current=e,I(e),k({x:e.x,y:e.y})}g.setHovering(!0),y(!0),w(!1),D(null),L.current=!0,F.current?.setPointerCapture(e.pointerId)}}:void 0,onPointerMove:m?function(e){if(!b)return;e.preventDefault(),L.current&&(V.current={x:e.clientX,y:e.clientY},L.current=!1);const{clientY:t,clientX:n,movementX:r,movementY:o}=e;(o<0&&t>z.current.y||o>0&&t<z.current.y)&&(z.current={x:z.current.x,y:t}),(r<0&&n>z.current.x||r>0&&n<z.current.x)&&(z.current={x:n,y:z.current.y});const s=n-V.current.x,i=t-V.current.y,a=t-z.current.y,l=n-z.current.x;if(!x){if(Math.sqrt(s*s+i*i)>=1&&(w(!0),null===A)){const e=f.includes("left")||f.includes("right"),t=f.includes("up")||f.includes("down");if(e&&t){const e=Math.abs(s),t=Math.abs(i);D(e>t?"horizontal":"vertical")}}}let u;if(j.current){const e=j.current,t=kf(e,l,a);t>40?(H.current=!1,v(e)):f.includes("left")&&f.includes("right")||f.includes("up")&&f.includes("down")||!(B.current-t>=10)||(H.current=!0)}else"vertical"===A?i>0?u="down":i<0&&(u="up"):"horizontal"===A?s>0?u="right":s<0&&(u="left"):u=Math.abs(s)>=Math.abs(i)?s>0?"right":"left":i>0?"down":"up",u&&f.includes(u)&&(j.current=u,B.current=kf(u,s,i),v(u));const c=function(e,t){let n=e,r=t;return f.includes("left")||f.includes("right")?(!f.includes("right")&&e>0&&(n=e**Sf),!f.includes("left")&&e<0&&(n=-(Math.abs(e)**Sf))):n=e>0?e**Sf:-(Math.abs(e)**Sf),f.includes("up")||f.includes("down")?(!f.includes("down")&&t>0&&(r=t**Sf),!f.includes("up")&&t<0&&(r=-(Math.abs(t)**Sf))):r=t>0?t**Sf:-(Math.abs(t)**Sf),{x:n,y:r}}(s,i);let d=N.current.x,p=N.current.y;"horizontal"===A?(f.includes("left")||f.includes("right"))&&(d+=c.x):("vertical"===A||(f.includes("left")||f.includes("right"))&&(d+=c.x),(f.includes("up")||f.includes("down"))&&(p+=c.y)),k({x:d,y:p})}:void 0,onPointerUp:m?function(e){if(!b)return;if(y(!1),w(!1),D(null),F.current?.releasePointerCapture(e.pointerId),H.current)return k({x:E.x,y:E.y}),void v(void 0);let t=!1;const n=S.x-E.x,r=S.y-E.y;let o;for(const s of f){switch(s){case"right":n>40&&(t=!0,o="right");break;case"left":n<-40&&(t=!0,o="left");break;case"down":r>40&&(t=!0,o="down");break;case"up":r<-40&&(t=!0,o="up")}if(t)break}t?(v(o),C(!0),g.closeToast(s.id)):(k({x:E.x,y:E.y}),v(void 0))}:void 0,onPointerCancel:m?function(){b&&(y(!1),w(!1),D(null),k({x:E.x,y:E.y}),v(void 0))}:void 0,onKeyDown:function(e){if("Escape"===e.key){if(!F.current||!Rr(F.current,wr(Xr(F.current))))return;g.closeToast(s.id)}},inert:za(s.limited),style:{...function(){if(!b&&S.x===E.x&&S.y===E.y&&!R)return{[Rf.swipeMovementX]:"0px",[Rf.swipeMovementY]:"0px"};const e=S.x-E.x,t=S.y-E.y;return{transition:b?"none":void 0,transform:b?`translateX(${S.x}px) translateY(${S.y}px) scale(${E.scale})`:void 0,[Rf.swipeMovementX]:`${e}px`,[Rf.swipeMovementY]:`${t}px`}}(),[Rf.index]:"ending"===s.transitionStatus?W:q,[Rf.offsetY]:`${K}px`,[Rf.height]:s.height?`${s.height}px`:void 0}},_=e.useMemo(()=>({rootRef:F,toast:s,titleId:M,setTitleId:P,descriptionId:T,setDescriptionId:O,swiping:b,swipeDirection:h,recalculateHeight:G,index:W,visibleIndex:q,expanded:U}),[s,M,T,b,h,G,W,q,U]),J={transitionStatus:s.transitionStatus,expanded:U,limited:s.limited||!1,type:s.type,swiping:_.swiping,swipeDirection:_.swipeDirection},Q=ae("div",t,{ref:[o,_.rootRef],state:J,stateAttributesMapping:Cf,props:[X,c]});return n.jsx(xf.Provider,{value:_,children:Q})}),If=e.forwardRef(function(e,t){const{render:n,className:r,style:o,id:s,children:i,...a}=e,{toast:l,setDescriptionId:u}=wf(),c=i??l.description,d=Boolean(c),f=bn(s);Nt(()=>{if(d)return u(f),()=>{u(void 0)}},[d,f,u]);const p=ae("p",e,{ref:t,state:{type:l.type},props:{...a,id:f,children:c}});return d?p:null}),Mf=e.forwardRef(function(e,t){const{render:n,className:r,style:o,id:s,children:i,...a}=e,{toast:l,setTitleId:u}=wf(),c=i??l.title,d=Boolean(c),f=bn(s);Nt(()=>{if(d)return u(f),()=>{u(void 0)}},[d,f,u]);const p=ae("h2",e,{ref:t,state:{type:l.type},props:{...a,id:f,children:c}});return d?p:null}),Pf=e.forwardRef(function(t,n){const{render:r,className:o,style:s,disabled:i,nativeButton:a=!0,...l}=t,u=df(),{toast:c}=wf(),d=u.useState("expanded"),[f,p]=e.useState(!1),{getButtonProps:m,buttonRef:g}=er({disabled:i,native:a});return ae("button",t,{ref:[n,g],state:{type:c.type},props:[{"aria-hidden":!d&&!f,onClick(){u.closeToast(c.id)},onFocus(){p(!0)},onBlur(){p(!1)}},l,m]})}),Tf=Ca;function Of(){const t=e.useContext(cf);if(!t)throw new Error(F(73));const n=t.useState("toasts");return e.useMemo(()=>({toasts:n,add:t.addToast,close:t.closeToast,update:t.updateToast,promise:t.promiseToast}),[n,t])}const Af=e.createContext(void 0);function Df(t){const n=e.useContext(Af);if(void 0===n&&!t)throw new Error(F(50));return n}const Ff={...Pi,instantType:ri(e=>e.instantType),hasViewport:ri(e=>e.hasViewport)};class Vf extends yi{constructor(t){super({...{...Ii(),instantType:void 0,hasViewport:!1},...t},{popupRef:e.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Ei,closeDelayRef:{current:300}},Ff)}setOpen=(e,t)=>{const n=t.reason,o=n===Yt,s=e&&n===Xt,i=!e&&(n===Gt||n===sn);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);const a=()=>{const r={open:e};s?r.instantType="focus":i?r.instantType="dismiss":n===Yt&&(r.instantType=void 0);const o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};o?r.flushSync(a):a()};static useStore(e,t){const n=B(()=>new Vf(t)).current,r=e??n,o=Oi({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=o,r}}function Nf(t){const{open:r,defaultOpen:o=!1,onOpenChange:s,onOpenChangeComplete:i,actionsRef:a,handle:l,triggerId:u,defaultTriggerId:c=null,children:d}=t,f=Vf.useStore(l?.store,{open:o,openProp:r,activeTriggerId:c,triggerIdProp:u});Jo(()=>{void 0===r&&!1===f.state.open&&!0===o&&f.update({open:!0,activeTriggerId:c})}),f.useControlledProp("openProp",r),f.useControlledProp("triggerIdProp",u),f.useContextCallback("onOpenChange",s),f.useContextCallback("onOpenChangeComplete",i);const p=f.useState("open"),m=f.select("floatingRootContext"),g=f.useState("activeTriggerId"),h=f.useState("payload");Si(f);const{forceUnmount:v}=ki(p,f);Nt(()=>{p&&null==g&&f.set("payload",void 0)},[f,g,p]);const b=e.useCallback(()=>{f.setOpen(!1,dn(cn))},[f]);e.useImperativeHandle(a,()=>({unmount:v,close:b}),[v,b]);const y=ni(m),{getReferenceProps:x,getTriggerProps:w,getFloatingProps:R}=Wi([y]),C=e.useMemo(()=>x(),[x]),S=e.useMemo(()=>w(),[w]),k=e.useMemo(()=>R(),[R]);return f.useSyncedValues({activeTriggerProps:C,inactiveTriggerProps:S,popupProps:k}),n.jsx(Af.Provider,{value:f,children:"function"==typeof d?d({payload:h}):d})}function jf(e){return Df(!0)?n.jsx(Nf,{...e}):n.jsx(Us,{children:n.jsx(Nf,{...e})})}const Bf=e.createContext(void 0);const Hf=e.forwardRef(function(e,t){const{keepMounted:r=!1,...o}=e;return Df().useState("mounted")||r?n.jsx(Bf.Provider,{value:r,children:n.jsx(Ca,{ref:t,...o})}):null}),zf=e.forwardRef(function(t,n){const{render:r,className:o,delay:s,closeDelay:i,id:a,payload:l,handle:u,style:c,...d}=t,f=Df(!0),p=u?.store??f;if(!p)throw new Error(F(89));const m=yn(a),g=p.useState("isTriggerActive",m),h=p.useState("isOpenedByTrigger",m),v=p.useState("floatingRootContext"),b=e.useRef(null),y=s??600,x=i??300,{registerTrigger:w,isMountedByThisTrigger:R}=Ci(m,b,p,{payload:l});Nt(()=>{R&&(p.context.closeDelayRef.current=x)},[p,R,x]);const C=Li(v,{mouseOnly:!0,move:!1,handleClose:ra(),delay:()=>({open:y,close:x}),triggerElementRef:b,isActiveTrigger:g,isClosing:()=>"ending"===p.select("transitionStatus")}),S=Di(v,{delay:y}),k={open:h},E=p.useState("triggerProps",R);return ae("a",t,{state:k,ref:[n,w,b],props:[C,S.reference,E,{id:m},d],stateAttributesMapping:ga})}),Lf=e.createContext(void 0);const Wf=e.forwardRef(function(t,r){const{render:o,className:s,anchor:i,positionMethod:a="absolute",side:l="bottom",align:u="center",sideOffset:c=0,alignOffset:d=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:v=Os,style:b,...y}=t,x=Df(),w=function(){const t=e.useContext(Bf);if(void 0===t)throw new Error(F(48));return t}(),R=Ks(),C=x.useState("open"),S=x.useState("mounted"),k=x.useState("floatingRootContext"),E=x.useState("instantType"),I=x.useState("transitionStatus"),M=Aa({anchor:i,floatingRootContext:k,positionMethod:a,mounted:S,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:g,disableAnchorTracking:h,keepMounted:w,nodeId:R,collisionAvoidance:v,adaptiveOrigin:x.useState("hasViewport")?Pa:void 0}),P=Va(t,{open:C,side:M.side,align:M.align,anchorHidden:M.anchorHidden,instant:E},{styles:M.positionerStyles,transitionStatus:I,props:y,refs:[r,x.useStateSetter("positionerElement")],hidden:!S,inert:!C});return n.jsx(Lf.Provider,{value:M,children:n.jsx($s,{id:R,children:P})})}),qf={...va,...Tn},Kf=e.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,a=Df(),{side:l,align:u}=function(){const t=e.useContext(Lf);if(void 0===t)throw new Error(F(49));return t}(),c=a.useState("open"),d=a.useState("instantType"),f=a.useState("transitionStatus"),p=a.useState("popupProps"),m=a.useState("floatingRootContext");Ko({open:c,ref:a.context.popupRef,onComplete(){c&&a.context.onOpenChangeComplete?.(!0)}});Hi(m,{closeDelay:Dt(()=>a.context.closeDelayRef.current)});return ae("div",t,{state:{open:c,side:l,align:u,instant:d,transitionStatus:f},ref:[n,a.context.popupRef,a.useStateSetter("popupElement")],props:[p,Fa(f),i],stateAttributesMapping:qf})});class $f{constructor(){this.store=new Vf}open(e){const t=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!t)throw new Error(F(88,e));this.store.setOpen(!0,dn(cn,void 0,t))}close(){this.store.setOpen(!1,dn(cn,void 0,void 0))}get isOpen(){return this.store.state.open}}function Uf(){return new $f}const Gf=e.createContext(void 0);const Yf=e.forwardRef(function(t,r){const{className:o,defaultPressed:s=!1,disabled:i=!1,form:a,onPressedChange:l,pressed:u,render:c,type:d,value:f,nativeButton:p=!0,style:m,...g}=t,h=yn(f||void 0),v=function(t=!0){const n=e.useContext(Gf);if(void 0===n&&!t)throw new Error(F(7));return n}(),b=v?.value??[],y=v?void 0:s,x=(i||v?.disabled)??!1,[w,R]=Tt({controlled:v?void 0!==h&&b.indexOf(h)>-1:u,default:y,name:"Toggle",state:"pressed"}),C=Dt((e,t)=>{h&&v?.setGroupValue?.(h,e,t),l?.(e,t)}),{getButtonProps:S,buttonRef:k}=er({disabled:x,native:p}),E={disabled:x,pressed:w},I=[k,r],M=[{"aria-pressed":w,onClick(e){const t=!w,n=dn(Ut,e.nativeEvent);C(t,n),n.isCanceled||R(t)}},g,S],P=ae("button",t,{enabled:!v,state:E,ref:I,props:M});return v?n.jsx(gc,{tag:"button",render:c,className:o,style:m,state:E,refs:I,props:M}):P});let Xf=function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e}({});const _f={multiple:e=>e?{[Xf.multiple]:""}:null},Jf=e.forwardRef(function(t,r){const{defaultValue:o,disabled:s=!1,loopFocus:i=!0,onValueChange:a,orientation:l="horizontal",multiple:u=!1,value:c,className:d,render:f,style:p,...m}=t,g=ec(),h=e.useMemo(()=>{if(void 0===c)return o??[]},[c,o]),v=e.useMemo(()=>void 0!==c||void 0!==o,[c,o]),b=(g?.disabled??!1)||s,[y,x]=Tt({controlled:c,default:h,name:"ToggleGroup",state:"value"}),w=Dt((e,t,n)=>{let r;if(u?(r=y.slice(),t?r.push(e):r.splice(y.indexOf(e),1)):r=t?[e]:[],Array.isArray(r)){if(a?.(r,n),n.isCanceled)return;x(r)}}),R={disabled:b,multiple:u,orientation:l},C=e.useMemo(()=>({disabled:b,orientation:l,setGroupValue:w,value:y,isValueInitialized:v}),[b,l,w,y,v]),S={role:"group"},k=ae("div",t,{enabled:Boolean(g),state:R,ref:r,props:[S,m],stateAttributesMapping:_f});return n.jsx(Gf.Provider,{value:C,children:g?k:n.jsx(Nd,{render:f,className:d,style:p,state:R,refs:[r],props:[S,m],stateAttributesMapping:_f,loopFocus:i,enableHomeAndEndKeys:!0,orientation:l})})});function Qf(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Zf(e,t){return e-t}function ep(e,t,n,r,o,s){let i=e;return i=od(i,n,r),o&&(i=function(e,t,n){const r=e.slice();return r[t]=n,r.sort(Zf)}(s,t,od(i,s[t-1]||-1/0,s[t+1]||1/0))),i}function tp(e,t,n){if(!Array.isArray(e))return!0;const r=e.reduce((e,t,n,r)=>(n===r.length-1||e.push(Math.abs(t-r[n+1])),e),[]);return Math.min(...r)>=t*n}const np={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null,...el},rp=e.createContext(void 0);function op(){const t=e.useContext(rp);if(void 0===t)throw new Error(F(62));return t}const sp=e.forwardRef(function(t,r){const{"aria-labelledby":o,className:s,defaultValue:i,disabled:a=!1,id:l,format:u,largeStep:c=10,locale:d,render:f,max:p=100,min:m=0,minStepsBetweenValues:g=0,form:h,name:v,onValueChange:b,onValueCommitted:y,orientation:x="horizontal",step:w=1,thumbCollisionBehavior:R="push",thumbAlignment:C="center",value:S,style:k,...E}=t,I=yn(l),M=function(e){return null==e?void 0:`${e}-label`}(I),P=Dt(b),T=Dt(y),{clearErrors:O}=ll(),{state:A,disabled:D,name:F,setTouched:V,setDirty:N,validityData:j,shouldValidateOnChange:B,validation:H}=rl(),{labelId:z}=cl(),[L,W]=e.useState(),q=o??$l(z,L),K=D||a,$=F??v,[U,G]=Tt({controlled:S,default:i??m,name:"Slider"}),Y=e.useRef(null),X=e.useRef(null),_=e.useRef([]),J=e.useRef(null),Q=e.useRef(null),Z=e.useRef(-1),ee=e.useRef(null),te=e.useRef(null),ne=e.useRef("none"),re=ls(u),[oe,se]=e.useState(-1),[ie,le]=e.useState(-1),[ue,ce]=e.useState(!1),[de,fe]=e.useState(()=>new Map),[pe,me]=e.useState([void 0,void 0]),ge=Dt(e=>{se(e),-1!==e&&le(e)});ol(X,{id:I,value:U}),ml(U,()=>{O($),B()?H.commit(U):H.commit(U,!0);const e=j.initialValue;let t;t=Array.isArray(U)&&Array.isArray(e)?!Qf(U,e):U!==e,N(t)});const he=Dt(e=>{e&&(X.current=e)}),ve=Array.isArray(U),be=e.useMemo(()=>ve?U.slice().sort(Zf):[od(U,m,p)],[p,m,ve,U]),ye=Dt((e,t)=>{if(Number.isNaN(e)||function(e,t){return"number"==typeof e&&"number"==typeof t?e===t:!(!Array.isArray(e)||!Array.isArray(t))&&Qf(e,t)}(e,U))return;const n=t??dn(Ut,void 0,void 0,{activeThumbIndex:-1});ne.current=n.reason;const r=n.event,o=new(r.constructor??Event)(r.type,r);Object.defineProperty(o,"target",{writable:!0,value:{value:e,name:$}}),n.event=o,te.current=e,P(e,n),n.isCanceled||G(e)}),xe=Dt((e,t,n)=>{const r=ep(e,t,m,p,ve,be);if(tp(r,w,g)){const e=function(e){return"key"in e?"keyboard":tn}(n);ye(r,dn(e,n.nativeEvent,void 0,{activeThumbIndex:t})),V(!0);const o=te.current??r;T(o,fn(e,n.nativeEvent))}});Nt(()=>{const e=wr(Xr(Y.current));K&&Rr(Y.current,e)&&e.blur()},[K]),K&&-1!==oe&&ge(-1);const we=e.useMemo(()=>({...A,activeThumbIndex:oe,disabled:K,dragging:ue,orientation:x,max:p,min:m,minStepsBetweenValues:g,step:w,values:be}),[A,oe,K,ue,p,m,g,x,w,be]),Re=e.useMemo(()=>({active:oe,controlRef:X,disabled:K,dragging:ue,validation:H,formatOptionsRef:re,handleInputChange:xe,indicatorPosition:pe,inset:"center"!==C,labelId:q,rootLabelId:M,largeStep:c,lastUsedThumbIndex:ie,lastChangedValueRef:te,lastChangeReasonRef:ne,form:h,locale:d,max:p,min:m,minStepsBetweenValues:g,name:$,onValueCommitted:T,orientation:x,pressedInputRef:J,pressedThumbCenterOffsetRef:Q,pressedThumbIndexRef:Z,pressedValuesRef:ee,registerFieldControlRef:he,renderBeforeHydration:"edge"===C,setActive:ge,setDragging:ce,setIndicatorPosition:me,setLabelId:W,setValue:ye,state:we,step:w,thumbCollisionBehavior:R,thumbMap:de,thumbRefs:_,values:be}),[oe,X,q,M,K,ue,H,re,xe,pe,c,ie,te,ne,h,d,p,m,g,$,T,x,J,Q,Z,ee,he,ge,ce,me,W,ye,we,w,R,C,de,_,be]),Ce=ae("div",t,{state:we,ref:[r,Y],props:[{"aria-labelledby":q,id:I,role:"group"},H.getValidationProps,E],stateAttributesMapping:np});return n.jsx(rp.Provider,{value:Re,children:n.jsx(Bt,{elementsRef:_,onMapChange:fe,children:Ce})})});function ip(e){const t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function ap(e){if(0===e)return 0;if(Math.abs(e)<1){const t=e.toExponential().split("e-"),n=t[0].split(".")[1];return(n?n.length:0)+parseInt(t[1],10)}const t=e.toString().split(".")[1];return t?t.length:0}function lp(e,t,n){const r=Math.round((e-n)/t)*t+n;return Number(r.toFixed(Math.max(ap(t),ap(n))))}function up({values:e,index:t,nextValue:n,min:r,max:o,step:s,minStepsBetweenValues:i,initialValues:a}){if(0===e.length)return[];const l=e.slice(),u=s*i,c=l.length-1,d=a??e,f=r+t*u,p=o-(c-t)*u;l[t]=od(n,f,p);for(let m=t+1;m<=c;m+=1){const e=l[m-1]+u,t=o-(c-m)*u,n=d[m]??l[m];let r=Math.max(l[m],e);n<r&&(r=Math.max(n,e)),l[m]=od(r,e,t)}for(let m=t-1;m>=0;m-=1){const e=l[m+1]-u,t=r+m*u,n=d[m]??l[m];let o=Math.min(l[m],e);n>o&&(o=Math.min(n,e)),l[m]=od(o,t,e)}for(let m=0;m<=c;m+=1)l[m]=Number(l[m].toFixed(12));return l}function cp(e,t){if(null!=t.current&&e.changedTouches){const n=e;for(let e=0;e<n.changedTouches.length;e+=1){const r=n.changedTouches[e];if(r.identifier===t.current)return{x:r.clientX,y:r.clientY}}return null}return{x:e.clientX,y:e.clientY}}const dp=e.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{disabled:a,dragging:u,inset:c,lastChangedValueRef:d,lastChangeReasonRef:f,max:p,min:m,minStepsBetweenValues:g,onValueCommitted:h,orientation:v,pressedInputRef:b,pressedThumbCenterOffsetRef:y,pressedThumbIndexRef:x,pressedValuesRef:w,registerFieldControlRef:R,renderBeforeHydration:C,setActive:S,setDragging:k,setValue:E,state:I,step:M,thumbCollisionBehavior:P,thumbRefs:T,values:O}=op(),A=qt(),D=O.length>1,F="vertical"===v,V=e.useRef(null),N=e.useRef(null),j=Dt(e=>{e&&null==N.current&&null==N.current&&(N.current=getComputedStyle(e))}),B=e.useRef(null),H=e.useRef(0),z=e.useRef(0),L=ls(O),W=Dt(e=>{x.current!==e&&(x.current=e);const t=T.current[e];if(!t)return y.current=null,void(b.current=null);b.current=t.querySelector('input[type="range"]')}),q=Dt(e=>{const t=V.current;if(!t)return null;const{width:n,height:r,bottom:o,left:s,right:i}=t.getBoundingClientRect(),a=function(e,t){if(!e)return{start:0,end:0};function n(e){const t=null!=e?parseFloat(e):0;return Number.isNaN(t)?0:t}const r=t?"Top":"InlineStart",o=t?"Bottom":"InlineEnd";return{start:n(e[`border${r}Width`])+n(e[`padding${r}`]),end:n(e[`border${o}Width`])+n(e[`padding${o}`])}}(N.current,F),l=z.current,u=(F?r:n)-a.start-a.end-2*l,c=y.current??0,d=e.x-c,f=e.y-c,h=od(((F?o-f-a.end:("rtl"===A?i-d:d-s)-a.start)-l)/u,0,1);let v=(p-m)*h+m;if(v=lp(v,M,m),v=od(v,m,p),!D)return{value:v,thumbIndex:0,didSwap:!1};const b=x.current;if(b<0)return null;const R=function({behavior:e,values:t,currentValues:n,initialValues:r,pressedIndex:o,nextValue:s,min:i,max:a,step:l,minStepsBetweenValues:u}){const c=n??t,d=r??t;if(!(c.length>1))return{value:s,thumbIndex:0,didSwap:!1};const f=l*u;switch(e){case"swap":{const e=c[o],t=1e-7,n=c.slice(),r=n[o-1],p=n[o+1],m=od(s,null!=r?r+f:i,null!=p?p-f:a),g=Number(m.toFixed(12));n[o]=g;const h=s>e&&null!=p&&s>=p-t;if(!(h||s<e&&null!=r&&s<=r+t))return{value:n,thumbIndex:o,didSwap:!1};const v=h?o+1:o-1,b=n.map((e,t)=>{if(t===o)return g;const n=d[t];return null!=n?n:c[t]});let y=s;y=h?Math.max(s,n[v]):Math.min(s,n[v]);const x=up({values:n,index:v,nextValue:y,min:i,max:a,step:l,minStepsBetweenValues:u,initialValues:b}),w=h?v-1:v+1;if(w>=0&&w<x.length){const e=x[w-1],t=x[w+1];let n=null!=e?e+f:i;n=Math.max(n,i+w*f);let r=null!=t?t-f:a;r=Math.min(r,a-(x.length-1-w)*f);const o=od(g,n,r);x[w]=Number(o.toFixed(12))}return{value:x,thumbIndex:v,didSwap:!0}}case"push":return{value:up({values:c,index:o,nextValue:s,min:i,max:a,step:l,minStepsBetweenValues:u}),thumbIndex:o,didSwap:!1};default:{const e=c.slice(),t=e[o-1],n=e[o+1],r=od(s,null!=t?t+f:i,null!=n?n-f:a);return e[o]=Number(r.toFixed(12)),{value:e,thumbIndex:o,didSwap:!1}}}}({behavior:P,values:O,currentValues:L.current??O,initialValues:w.current,pressedIndex:b,nextValue:v,min:m,max:p,step:M,minStepsBetweenValues:g});return"swap"===P&&R.didSwap?W(R.thumbIndex):x.current=R.thumbIndex,R}),K=Dt(e=>{w.current=D?O.slice():null,L.current=O;const t=x.current;let n=t;if(t>-1&&t<O.length){if(O[t]===p){let e=t;for(;e>0&&O[e-1]===p;)e-=1;n=e}}else{const t=F?"y":"x";let r;n=-1;for(let o=0;o<T.current.length;o+=1){const s=T.current[o];if(l(s)){const i=ip(s),a=Math.abs(e[t]-i[t]);(void 0===r||a<=r)&&(n=o,r=a)}}}if(n>-1&&n!==t&&W(n),c){const e=T.current[n];if(l(e)){const t=e.getBoundingClientRect(),n=F?"height":"width";z.current=t[n]/2}}}),$=Dt(e=>{const t=T.current?.[e]?.querySelector('input[type="range"]');t&&t.focus({preventScroll:!0,focusVisible:!1})}),U=Dt(e=>{const t=cp(e,B);if(null==t)return;if(H.current+=1,"pointermove"===e.type&&0===e.buttons)return void G(e);const n=q(t);null!=n&&tp(n.value,M,g)&&(!u&&H.current>2&&k(!0),E(n.value,dn("drag",e,void 0,{activeThumbIndex:n.thumbIndex})),L.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&$(n.thumbIndex))});function G(e){S(-1),k(!1),b.current=null,y.current=null;const t=cp(e,B),n=null!=t?q(t):null;if(null!=n){const t=f.current;h(d.current??n.value,fn(t,e))}"pointerType"in e&&V.current?.hasPointerCapture(e.pointerId)&&V.current?.releasePointerCapture(e.pointerId),x.current=-1,B.current=null,w.current=null,X()}const Y=Dt(e=>{if(a)return;const t=e.changedTouches[0];null!=t&&(B.current=t.identifier);const n=cp(e,B);if(null!=n){K(n);const t=q(n);if(null==t)return;$(t.thumbIndex),E(t.value,dn(en,e,void 0,{activeThumbIndex:t.thumbIndex})),L.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&$(t.thumbIndex)}H.current=0;const r=Xr(V.current);r.addEventListener("touchmove",U,{passive:!0}),r.addEventListener("touchend",G,{passive:!0})}),X=Dt(()=>{const e=Xr(V.current);e.removeEventListener("pointermove",U),e.removeEventListener("pointerup",G),e.removeEventListener("touchmove",U),e.removeEventListener("touchend",G),w.current=null}),_=kn();e.useEffect(()=>{const e=V.current;if(!e)return()=>X();const t=zo(e,"touchstart",Y,{passive:!0});return()=>{t(),_.cancel(),X()}},[X,Y,V,_]),e.useEffect(()=>{a&&X()},[a,X]);return ae("div",t,{state:I,ref:[n,R,V,j],props:[{"data-base-ui-slider-control":C?"":void 0,onPointerDown(e){const t=V.current,n=Cr(e.nativeEvent);if(!t||a||e.defaultPrevented||!l(n)||0!==e.button)return;const r=cp(e,B);if(null!=r){K(r);const n=q(r);if(null==n)return;Rr(T.current[n.thumbIndex],wr(Xr(t)))?e.preventDefault():_.request(()=>{$(n.thumbIndex)}),k(!0);null!=y.current||(E(n.value,dn(en,e.nativeEvent,void 0,{activeThumbIndex:n.thumbIndex})),L.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&$(n.thumbIndex))}e.nativeEvent.pointerId&&t.setPointerCapture(e.nativeEvent.pointerId),H.current=0;const o=Xr(V.current);o.addEventListener("pointermove",U,{passive:!0}),o.addEventListener("pointerup",G,{once:!0})}},i],stateAttributesMapping:np})}),fp=e.forwardRef(function(e,t){const{render:n,className:r,style:o,...s}=e,{state:i}=op();return ae("div",e,{state:i,ref:t,props:[{style:{position:"relative"}},s],stateAttributesMapping:np})});let pp=function(e){return e.index="data-index",e.dragging="data-dragging",e.orientation="data-orientation",e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.focused="data-focused",e}({});const mp=new Set([vo,bo,yo,xo,wo,Ro,Co,So]);function gp(e,t,n,r){if(!(t<0))return 2===e.length?0===t?`${rd(e[t],r,n)} start range`:`${rd(e[t],r,n)} end range`:n?rd(e[t],r,n):void 0}function hp(e,t,n,r,o){return od(Number((1===n?e+t:e-t).toFixed(Math.max(ap(e),ap(t),ap(r)))),r,o)}const vp=e.forwardRef(function(t,r){const{render:o,children:i,className:a,"aria-describedby":l,"aria-label":u,"aria-labelledby":c,disabled:d=!1,getAriaLabel:f,getAriaValueText:p,id:m,index:g,inputRef:h,onBlur:v,onFocus:b,onKeyDown:y,tabIndex:x,style:w,...R}=t,{nonce:C}=e.useContext(tf)??nf,S=yn(m),{active:k,lastUsedThumbIndex:E,controlRef:I,disabled:M,validation:P,formatOptionsRef:T,handleInputChange:O,inset:A,labelId:D,largeStep:F,locale:V,max:N,min:j,minStepsBetweenValues:B,form:z,name:L,orientation:W,pressedInputRef:q,pressedThumbCenterOffsetRef:K,pressedThumbIndexRef:$,renderBeforeHydration:U,setActive:G,setIndicatorPosition:Y,state:X,step:J,values:Q}=op(),Z=qt(),ee=d||M,te=Q.length>1,ne="vertical"===W,re="rtl"===Z,{setTouched:oe,setFocused:se,validationMode:ie}=rl(),le=e.useRef(null),ue=e.useRef(null),ce=e.useRef(!1),de=yn(),fe=Vl(),pe=te?de:fe,me=e.useMemo(()=>({inputId:pe}),[pe]),{ref:ge,index:he}=jn({metadata:me}),ve=te?g??he:0,be=ve===Q.length-1,ye=Q[ve],xe=function(e,t,n){return 100*(e-t)/(n-t)}(ye,j,N),[we,Re]=e.useState(),Ce=s.useSyncExternalStore(Qd,Zd,ef),Se=E>=0&&E<Q.length?E:-1,ke=Dt(()=>{const e=I.current,t=le.current;if(!e||!t)return;const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=ne?"height":"width",s=r[o]-n[o],i=(n[o]/2+s*xe/100)/r[o]*100,a=Number.isFinite(i)?i:void 0;Re(a),0===ve?Y(e=>[a,e[1]]):be&&Y(e=>[e[0],a])});Nt(()=>{A&&queueMicrotask(ke)},[ke,A]),Nt(()=>{A&&ke()},[ke,A,xe]),Nt(()=>{if(!A||"function"!=typeof ResizeObserver)return;const e=I.current,t=le.current;if(!e||!t)return;const n=new ResizeObserver(ke);return n.observe(e),n.observe(t),()=>{n.disconnect()}},[I,ke,A]);const Ee=e.useCallback(()=>{const e=ne?"bottom":"insetInlineStart",t=ne?"left":"top";let n;return te?k===ve?n=2:Se===ve&&(n=1):k===ve&&(n=1),A?{"--position":`${we??0}%`,visibility:U&&Ce||void 0===we?"hidden":void 0,position:"absolute",[e]:"var(--position)",[t]:"50%",translate:`${50*(ne||!re?-1:1)}% ${50*(ne?1:-1)}%`,zIndex:n}:Number.isFinite(xe)?{position:"absolute",[e]:`${xe}%`,[t]:"50%",translate:`${50*(ne||!re?-1:1)}% ${50*(ne?1:-1)}%`,zIndex:n}:ds},[k,ve,A,Ce,we,te,U,re,Se,xe,ne]);let Ie;"vertical"===W&&(Ie=re?"vertical-rl":"vertical-lr");const Me="function"==typeof f?f(ve):u,Pe=_({"aria-label":Me,"aria-labelledby":c??(null==Me?D:void 0),"aria-describedby":l,"aria-orientation":W,"aria-valuenow":ye,"aria-valuetext":"function"==typeof p?p(rd(ye,V,T.current??void 0),ye,ve):gp(Q,ve,T.current??void 0,V),disabled:ee,form:z,id:pe,max:N,min:j,name:L,onChange(e){O(e.currentTarget.valueAsNumber,ve,e)},onFocus(e){const t=ce.current;ce.current=!1,G(ve),se(!0),t&&e.stopPropagation()},onBlur(e){ce.current?e.stopPropagation():le.current&&(G(-1),oe(!0),se(!1),"onBlur"===ie&&P.commit(ep(ye,ve,j,N,te,Q)))},onKeyDown(e){if(!mp.has(e.key))return;Oo.has(e.key)&&e.stopPropagation();let t=null;const n=lp(ye,J,j);switch(e.key){case vo:t=hp(n,e.shiftKey?F:J,1,j,N);break;case xo:t=hp(n,e.shiftKey?F:J,re?-1:1,j,N);break;case bo:t=hp(n,e.shiftKey?F:J,-1,j,N);break;case yo:t=hp(n,e.shiftKey?F:J,re?1:-1,j,N);break;case Co:t=hp(n,F,1,j,N);break;case So:t=hp(n,F,-1,j,N);break;case Ro:t=N,te&&(t=Number.isFinite(Q[ve+1])?Q[ve+1]-J*B:N);break;case wo:t=j,te&&(t=Number.isFinite(Q[ve-1])?Q[ve-1]+J*B:j)}if(null!==t){const n=e.currentTarget;Pr(n)||(ce.current=!0,n.blur(),n.focus({preventScroll:!0,focusVisible:!0})),O(t,ve,e),e.preventDefault()}},step:J,style:{...ds,width:"100%",height:"100%",writingMode:Ie},tabIndex:x??void 0,type:"range",value:ye??""},P.getInputValidationProps),Te=H(ue,P.inputRef,h);return ae("div",t,{state:X,ref:[r,ge,le],props:[{[pp.index]:ve,children:n.jsxs(e.Fragment,{children:[i,n.jsx("input",{ref:Te,...Pe,suppressHydrationWarning:!0}),A&&Ce&&U&&be&&n.jsx("script",{nonce:C,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:S,onBlur:v,onFocus:b,onPointerDown(e){if($.current=ve,null!=le.current){const t="horizontal"===W?"x":"y",n=ip(le.current),r=("horizontal"===W?e.clientX:e.clientY)-n[t];K.current=r}null!=ue.current&&q.current!==ue.current&&(q.current=ue.current)},style:Ee(),suppressHydrationWarning:U||void 0},R],stateAttributesMapping:np})});export{ed as $,bc as A,xc as B,hl as C,wc as D,oc as E,fc as F,yc as G,pc as H,Ju as I,Qu as J,Yu as K,sc as L,_u as M,nc as N,Ac as O,Pc as P,zc as Q,Oc as R,Nu as S,ia as T,Hc as U,Lc as V,Dc as W,Mc as X,td as Y,_c as Z,Jc as _,Sa as a,Zc as a0,dd as a1,gd as a2,bd as a3,Rd as a4,Cd as a5,Sd as a6,Ed as a7,pd as a8,kd as a9,zf as aA,Hf as aB,Wf as aC,Kf as aD,mn as aE,Xn as aF,_n as aG,Ho as aH,$o as aI,af as aJ,uf as aK,Ka as aL,Ua as aM,Ya as aN,Uf as aO,Wd as aa,qd as ab,Pt as ac,Ad as ad,Bd as ae,Dd as af,sp as ag,dp as ah,fp as ai,vp as aj,Yd as ak,lf as al,Jd as am,Jf as an,Yf as ao,sd as ap,vf as aq,Of as ar,Tf as as,yf as at,Ef as au,Mf as av,If as aw,Pf as ax,Wa as ay,jf as az,Na as b,Ba as c,Ha as d,Mt as e,wa as f,vl as g,ou as h,wu as i,ql as j,Pu as k,Ou as l,Au as m,Zl as n,tu as o,lu as p,Ru as q,Iu as r,Eu as s,Du as t,ue as u,su as v,vu as w,yu as x,Vu as y,Ul as z};
