@easygov/web-components 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-R2ZANGUH.js +27 -0
- package/dist/chunk-R2ZANGUH.js.map +1 -0
- package/dist/header.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-XA367GUU.js +0 -27
- package/dist/chunk-XA367GUU.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{a as Ss,b as jt,c as b,d as H,e as Zt,f as ys,g as ie,h as $n,i as vu,j as xu,k as Su,l as yu}from"./chunk-O3IXHDLE.js";var vf=Ss(hf=>{"use strict";var Zo=H();function ax(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var cx=typeof Object.is=="function"?Object.is:ax,lx=Zo.useState,ux=Zo.useEffect,fx=Zo.useLayoutEffect,dx=Zo.useDebugValue;function px(e,t){var n=t(),o=lx({inst:{value:n,getSnapshot:t}}),r=o[0].inst,s=o[1];return fx(function(){r.value=n,r.getSnapshot=t,oc(r)&&s({inst:r})},[e,n,t]),ux(function(){return oc(r)&&s({inst:r}),e(function(){oc(r)&&s({inst:r})})},[e]),dx(n),n}function oc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!cx(e,n)}catch{return!0}}function mx(e,t){return t()}var gx=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?mx:px;hf.useSyncExternalStore=Zo.useSyncExternalStore!==void 0?Zo.useSyncExternalStore:gx});var Hs=Ss((rE,xf)=>{"use strict";xf.exports=vf()});var yf=Ss(Sf=>{"use strict";var Us=H(),hx=Hs();function vx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xx=typeof Object.is=="function"?Object.is:vx,Sx=hx.useSyncExternalStore,yx=Us.useRef,wx=Us.useEffect,Rx=Us.useMemo,bx=Us.useDebugValue;Sf.useSyncExternalStoreWithSelector=function(e,t,n,o,r){var s=yx(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=Rx(function(){function c(d){if(!l){if(l=!0,u=d,d=o(d),r!==void 0&&i.hasValue){var m=i.value;if(r(m,d))return f=m}return f=d}if(m=f,xx(u,d))return m;var g=o(d);return r!==void 0&&r(m,g)?(u=d,m):(u=d,f=g)}var l=!1,u,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,o,r]);var a=Sx(e,s[0],s[1]);return wx(function(){i.hasValue=!0,i.value=a},[a]),bx(a),a}});var Rf=Ss((iE,wf)=>{"use strict";wf.exports=yf()});var wu={name:"@easygov/react-components",version:"0.12.0",private:!1,description:"React 19 component library for EasyGov \u2014 accessible UI components styled with eg-* design tokens.",license:"MIT",author:"easygov",keywords:["easygov","react","components","ui","design-system"],repository:{type:"git",url:"git+https://gitlab.adesso-group.com/229efe07/easygov20-highcode-ui-components.git",directory:"packages/react-components"},sideEffects:["**/*.css"],exports:{".":"./src/index.ts","./icons":"./src/icons/index.ts","./styles.css":{types:"./src/styles/styles-css.d.mts",default:"./dist/easygov.css"},"./fonts.css":"./src/styles/fonts.css","./fonts/noto-sans-latin":{types:"./src/fonts/woff2.d.mts",default:"./src/fonts/NotoSans-latin.woff2"},"./fonts/noto-sans-latin-ext":{types:"./src/fonts/woff2.d.mts",default:"./src/fonts/NotoSans-latin-ext.woff2"},"./fonts/noto-sans-italic-latin":{types:"./src/fonts/woff2.d.mts",default:"./src/fonts/NotoSans-Italic-latin.woff2"},"./fonts/noto-sans-italic-latin-ext":{types:"./src/fonts/woff2.d.mts",default:"./src/fonts/NotoSans-Italic-latin-ext.woff2"}},files:["dist","src/fonts/OFL.txt","src/fonts/woff2.d.mts","src/styles/styles-css.d.mts"],publishConfig:{access:"public",main:"./dist/easygov.mjs",module:"./dist/easygov.mjs",types:"./dist/easygov.d.mts",exports:{".":{types:"./dist/easygov.d.mts",import:"./dist/easygov.mjs"},"./icons":{types:"./dist/icons.d.mts",import:"./dist/icons.mjs"},"./styles.css":{types:"./src/styles/styles-css.d.mts",default:"./dist/easygov.css"},"./fonts.css":"./dist/fonts.css","./fonts/noto-sans-latin":{types:"./src/fonts/woff2.d.mts",default:"./dist/NotoSans-latin.woff2"},"./fonts/noto-sans-latin-ext":{types:"./src/fonts/woff2.d.mts",default:"./dist/NotoSans-latin-ext.woff2"},"./fonts/noto-sans-italic-latin":{types:"./src/fonts/woff2.d.mts",default:"./dist/NotoSans-Italic-latin.woff2"},"./fonts/noto-sans-italic-latin-ext":{types:"./src/fonts/woff2.d.mts",default:"./dist/NotoSans-Italic-latin-ext.woff2"}}},scripts:{lint:"eslint .",build:"tsup","check-types":"tsc --noEmit",test:"vitest run","test:watch":"vitest","generate:logos":"node scripts/generate-logos.mjs",prepublishOnly:"tsup"},peerDependencies:{react:"^19","react-dom":"^19"},devDependencies:{"@easygov/design-tokens":"workspace:*","@easygov/eslint-config":"workspace:*","@easygov/typescript-config":"workspace:*","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@types/node":"^24.0.0","@types/react":"19.3.0","@types/react-dom":"19.3.0","@vitest/coverage-v8":"^4.1.9",eslint:"^9.39.1",jsdom:"^30.0.0",react:"^19.2.0","react-dom":"^19.2.0",tsup:"^8.5.1",typescript:"5.9.3",vitest:"^4.1.9"},dependencies:{"@base-ui/react":"^1.5.0","class-variance-authority":"^0.7.1","oidc-client-ts":"^3.5.0"}};function Rv(e,t){let n=e.indexOf(".");return n===-1?null:`${t}${e.slice(n)}`}function La(e){if(typeof window>"u")return null;let{protocol:t,hostname:n}=window.location,o=Rv(n,e);return o?`${t}//${o}`:null}function _r(){return La("core")}function ws(){return La("info")}function Rs(){return _r()}var bv="/auth/realms/easygov";function Va(){let e=La("auth");return e?`${e}${bv}`:null}function Ev(e){return e==="easygov.swiss"?null:e==="in.easygov.swiss"?"IN":e==="vp.easygov.swiss"?"VP":"DEV"}function Ru(){if(typeof window>"u")return null;let{hostname:e}=window.location,t=e.indexOf(".");return t===-1?"DEV":Ev(e.slice(t+1))}var Eu=wu.version,Pr={libraryVersion:Eu,backendVersion:null,businessModuleVersion:null},Cv={libraryVersion:Eu,backendVersion:null,businessModuleVersion:null},bs=new Set;function Cu(e){return bs.add(e),()=>{bs.delete(e)}}function _u(){return Pr}function Pu(){return Cv}function _v(e){Pr={...Pr,backendVersion:e};for(let t of[...bs])t()}function Pv(e){Pr={...Pr,businessModuleVersion:e};for(let t of[...bs])t()}var bu=!1;function Tu(){if(bu)return;bu=!0;let e=Rs();e&&(async()=>{try{let t=await fetch(`${e}/external/api/v1/version`);if(!t.ok)return;let n=await t.json();if(typeof n.version!="string")return;_v(n.version)}catch{}})()}var Iu={login:"Anmelden",logout:"Abmelden",dashboard:"Dashboard",selectLanguage:"Sprache w\xE4hlen",loginSuccess:"Sie sind jetzt angemeldet.",logoutSuccess:"Sie wurden abgemeldet.",skipToMain:"Zum Hauptinhalt springen",allGovServices:"Alle Beh\xF6rdenleistungen",register:"Registrieren",myFavorites:"Meine Favoriten",settings:"Einstellungen",myCompanies:"Meine Unternehmen",search:"Suchen",testEnvironment:"Testumgebung",errorTitle:"Fehler",errorFallbackMessage:"Beim Laden der Kopfzeilendaten ist ein Fehler aufgetreten.",errorCustomerAccountNotAccessible:"Sie haben keinen Zugriff auf das ausgew\xE4hlte Kundenkonto.",errorReference:"Referenz",errorCloseLabel:"Schliessen",errorDetailsLabel:"Details"};var Ou={login:"Sign In",logout:"Sign Out",dashboard:"Dashboard",selectLanguage:"Select language",loginSuccess:"You are now signed in.",logoutSuccess:"You have been signed out.",skipToMain:"Skip to main content",allGovServices:"All government services",register:"Register",myFavorites:"My favorites",settings:"Settings",myCompanies:"My companies",search:"Search",testEnvironment:"Test environment",errorTitle:"Error",errorFallbackMessage:"An error occurred while loading header data.",errorCustomerAccountNotAccessible:"You do not have access to the selected customer account.",errorReference:"Reference",errorCloseLabel:"Close",errorDetailsLabel:"Details"};var Nu={login:"Se connecter",logout:"Se d\xE9connecter",dashboard:"Tableau de bord",selectLanguage:"Choisir la langue",loginSuccess:"Vous \xEAtes maintenant connect\xE9.",logoutSuccess:"Vous avez \xE9t\xE9 d\xE9connect\xE9.",skipToMain:"Aller au contenu principal",allGovServices:"Toutes les prestations administratives",register:"S'inscrire",myFavorites:"Mes favoris",settings:"Param\xE8tres",myCompanies:"Mes entreprises",search:"Rechercher",testEnvironment:"Environnement de test",errorTitle:"Erreur",errorFallbackMessage:"Une erreur est survenue lors du chargement des donn\xE9es d'en-t\xEAte.",errorCustomerAccountNotAccessible:"Vous n'avez pas acc\xE8s au compte client s\xE9lectionn\xE9.",errorReference:"R\xE9f\xE9rence",errorCloseLabel:"Fermer",errorDetailsLabel:"D\xE9tails"};var Mu={login:"Accedi",logout:"Esci",dashboard:"Dashboard",selectLanguage:"Seleziona la lingua",loginSuccess:"Hai effettuato l'accesso.",logoutSuccess:"Hai effettuato il logout.",skipToMain:"Vai al contenuto principale",allGovServices:"Tutte le prestazioni statali",register:"Registrati",myFavorites:"I miei preferiti",settings:"Impostazioni",myCompanies:"Le mie aziende",search:"Cerca",testEnvironment:"Ambiente di test",errorTitle:"Errore",errorFallbackMessage:"Si \xE8 verificato un errore durante il caricamento dei dati dell'intestazione.",errorCustomerAccountNotAccessible:"Non hai accesso al conto cliente selezionato.",errorReference:"Riferimento",errorCloseLabel:"Chiudi",errorDetailsLabel:"Dettagli"};var ku={de:Iu,en:Ou,fr:Nu,it:Mu};function nt(e,t="de"){return ku[t]?.[e]??ku.en?.[e]??e}var Es=[{value:"de",label:"Deutsch"},{value:"en",label:"English"},{value:"fr",label:"Fran\xE7ais"},{value:"it",label:"Italiano"}];var Fa="eg-display-language",Tv=3600*24*365;function Au(e){if(/^[\d.]+$/.test(e))return null;let t=e.indexOf(".");if(t===-1)return null;let n=e.slice(t+1);return n.includes(".")?`.${n}`:null}function Iv(e){let t=Au(e);if(t===null)return[];let n=[null],o=t.slice(1);for(;;){let r=o.indexOf(".");if(r===-1)break;let s=o.slice(r+1);if(!s.includes("."))break;n.push(`.${s}`),o=s}return n}function Cs(e){return e!=null&&Es.some(t=>t.value===e)}function Ov(e,t,n){let o=[`${Fa}=${e}`,"Path=/",`Max-Age=${Tv}`,"SameSite=Lax"],r=Au(t);return r!==null&&o.push(`Domain=${r}`),n==="https:"&&o.push("Secure"),o.join("; ")}function Nv(e,t){let n=[`${Fa}=`,"Path=/","Max-Age=0","SameSite=Lax"];return e!==null&&n.push(`Domain=${e}`),t==="https:"&&n.push("Secure"),n.join("; ")}function Du(){if(typeof document>"u")return null;let e=`${Fa}=`,t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(e));if(t===void 0)return null;let n=t.slice(e.length);return Cs(n)?n:null}function Lu(e){if(typeof document>"u"||typeof window>"u")return;let{hostname:t,protocol:n}=window.location;for(let o of Iv(t))document.cookie=Nv(o,n);document.cookie=Ov(e,t,n)}var Vu="eg:displaylanguagechange",Fu="de";function Mv(){if(typeof document>"u")return null;let e=typeof navigator>"u"?void 0:navigator.language;if(typeof e!="string")return null;let t=e.slice(0,2).toLowerCase();return Cs(t)?t:null}function Ha(){return Du()??Mv()??Fu}var Ua=null,Ba=new Set,Wa=!1;function kv(){for(let e of[...Ba])e()}function $a(e){e!==Ua&&(Ua=e,kv())}function _s(){$a(Ha())}function Av(e){let t=e.detail,n=typeof t=="object"&&t!==null&&"locale"in t?t.locale:void 0;if(typeof n=="string"&&Cs(n)){$a(n);return}_s()}function Dv(){document.visibilityState==="visible"&&_s()}function Lv(){Wa||typeof window>"u"||(Wa=!0,window.addEventListener(Vu,Av),window.addEventListener("focus",_s),document.addEventListener("visibilitychange",Dv),_s())}function ja(){return Wa?Ua??Ha():Ha()}function Hu(){return Fu}function za(e){Lu(e),$a(e),typeof window<"u"&&window.dispatchEvent(new CustomEvent(Vu,{detail:{locale:e}}))}function qa(e){return Lv(),Ba.add(e),()=>{Ba.delete(e)}}var Te=b(H());var cf=b(H(),1);var Jo=b(H(),1);function Ps(){return typeof window<"u"}function it(e){return Ts(e)?(e.nodeName||"").toLowerCase():"#document"}function Oe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function yn(e){var t;return(t=(Ts(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ts(e){return Ps()?e instanceof Node||e instanceof Oe(e).Node:!1}function Pe(e){return Ps()?e instanceof Element||e instanceof Oe(e).Element:!1}function Ie(e){return Ps()?e instanceof HTMLElement||e instanceof Oe(e).HTMLElement:!1}function xn(e){return!Ps()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Oe(e).ShadowRoot}function Ro(e){let{overflow:t,overflowX:n,overflowY:o,display:r}=pt(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Uu(e){return/^(table|td|th)$/.test(it(e))}function Tr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var Vv=/transform|translate|scale|rotate|perspective|filter/,Fv=/paint|layout|strict|content/,wo=e=>!!e&&e!=="none",Ka;function Is(e){let t=Pe(e)?pt(e):e;return wo(t.transform)||wo(t.translate)||wo(t.scale)||wo(t.rotate)||wo(t.perspective)||!Os()&&(wo(t.backdropFilter)||wo(t.filter))||Vv.test(t.willChange||"")||Fv.test(t.contain||"")}function Bu(e){let t=Sn(e);for(;Ie(t)&&!wn(t);){if(Is(t))return t;if(Tr(t))return null;t=Sn(t)}return null}function Os(){return Ka==null&&(Ka=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ka}function wn(e){return/^(html|body|#document)$/.test(it(e))}function pt(e){return Oe(e).getComputedStyle(e)}function Ir(e){return Pe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sn(e){if(it(e)==="html")return e;let t=e.assignedSlot||e.parentNode||xn(e)&&e.host||yn(e);return xn(t)?t.host:t}function Wu(e){let t=Sn(e);return wn(t)?(e.ownerDocument||e).body:Ie(t)&&Ro(t)?t:Wu(t)}function jn(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Wu(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),i=Oe(r);if(s){let a=Ns(i);return t.concat(i,i.visualViewport||[],Ro(r)?r:[],a&&n?jn(a):[])}else return t.concat(r,jn(r,[],n))}function Ns(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Hv=b(H(),1),Or={...Hv};var ju=b(H(),1),$u={};function He(e,t){let n=ju.useRef($u);return n.current===$u&&(n.current=e(t)),n}var Ga=Or.useInsertionEffect,Uv=Ga&&Ga!==Or.useLayoutEffect?Ga:e=>e();function z(e){let t=He(Bv).current;return t.next=e,Uv(t.effect),t.trampoline}function Bv(){let e={next:void 0,callback:Wv,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Wv(){}var zu=b(H(),1),$v=()=>{},U=typeof document<"u"?zu.useLayoutEffect:$v;function Nr(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var Ya={};function Qt(e,t,n,o,r){if(!n&&!o&&!r&&!e)return Ms(t);let s=Ms(e);return t&&(s=Mr(s,t)),n&&(s=Mr(s,n)),o&&(s=Mr(s,o)),r&&(s=Mr(s,r)),s}function qu(e){if(e.length===0)return Ya;if(e.length===1)return Ms(e[0]);let t=Ms(e[0]);for(let n=1;n<e.length;n+=1)t=Mr(t,e[n]);return t}function Ms(e){return Ja(e)?{...Gu(e,Ya)}:jv(e)}function Mr(e,t){return Ja(t)?Gu(t,e):zv(e,t)}function jv(e){let t={...e};for(let n in t){let o=t[n];Ku(n,o)&&(t[n]=Yu(o))}return t}function zv(e,t){if(!t)return e;for(let n in t){let o=t[n];switch(n){case"style":{e[n]=Nr(e.style,o);break}case"className":{e[n]=Xa(e.className,o);break}default:Ku(n,o)?e[n]=qv(e[n],o):e[n]=o}}return e}function Ku(e,t){let n=e.charCodeAt(0),o=e.charCodeAt(1),r=e.charCodeAt(2);return n===111&&o===110&&r>=65&&r<=90&&(typeof t=="function"||typeof t>"u")}function Ja(e){return typeof e=="function"}function Gu(e,t){return Ja(e)?e(t):e??Ya}function qv(e,t){return t?e?(...n)=>{let o=n[0];if(Ju(o)){let s=o;kr(s);let i=t(...n);return s.baseUIHandlerPrevented||e?.(...n),i}let r=t(...n);return e?.(...n),r}:Yu(t):e}function Yu(e){return e&&((...t)=>{let n=t[0];return Ju(n)&&kr(n),e(...t)})}function kr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Xa(e,t){return t?e?t+" "+e:t:e}function Ju(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Kv(e,t){return function(o,...r){let s=new URL(e);return s.searchParams.set("code",o.toString()),r.forEach(i=>s.searchParams.append("args[]",i)),`${t} error #${o}; visit ${s} for the full message.`}}var Gv=Kv("https://base-ui.com/production-error","Base UI"),Ae=Gv;var ks=b(H(),1),Za=ks.createContext(void 0);function As(e=!1){let t=ks.useContext(Za);if(t===void 0&&!e)throw new Error(Ae(16));return t}var Xu=b(H(),1);function Zu(e){let{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:r=0,isNativeButton:s}=e,i=o&&t!==!1,a=o&&t===!1;return{props:Xu.useMemo(()=>{let l={onKeyDown(u){n&&t&&u.key!=="Tab"&&u.preventDefault()}};return o||(l.tabIndex=r,!s&&n&&(l.tabIndex=t?r:-1)),(s&&(t||i)||!s&&n)&&(l["aria-disabled"]=n),s&&(!t||a)&&(l.disabled=n),l},[o,n,t,i,a,s,r])}}function ve(e){return e?.ownerDocument||document}function Ds(e,t,{detail:n=0}={}){e.dispatchEvent(new(Oe(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function zt(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:o=0,native:r=!0,composite:s}=e,i=Jo.useRef(null),a=As(!0),c=s??a!==void 0,{props:l}=Zu({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:o,isNativeButton:r}),u=Jo.useCallback(()=>{let d=i.current;Qa(d)&&c&&t&&l.disabled===void 0&&d.disabled&&(d.disabled=!1)},[t,l.disabled,c]);U(u,[u]);let f=Jo.useCallback((d={})=>{let{onClick:m,onMouseDown:g,onKeyUp:h,onKeyDown:v,onPointerDown:S,...w}=d;return Qt({onClick(x){if(t){x.preventDefault();return}m?.(x)},onMouseDown(x){t||g?.(x)},onKeyDown(x){if(t||(kr(x),v?.(x),x.baseUIHandlerPrevented))return;let y=x.target===x.currentTarget,R=x.currentTarget,E=Qa(R),_=!r&&Yv(R),P=y&&(r?E:!_),O=x.key==="Enter",T=x.key===" ",D=R.getAttribute("role"),C=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(y&&c&&T){if(x.defaultPrevented&&C)return;x.preventDefault(),(!r||E)&&(x.preventBaseUIHandler(),Ds(R,x));return}if(!P||r||!T&&!O){y&&_&&T&&x.preventDefault();return}x.defaultPrevented||(x.preventDefault(),O&&(x.preventBaseUIHandler(),Ds(R,x)))},onKeyUp(x){if(!t){if(kr(x),h?.(x),x.target===x.currentTarget&&r&&c&&Qa(x.currentTarget)&&x.key===" "){x.preventDefault();return}x.baseUIHandlerPrevented||x.target===x.currentTarget&&!r&&!c&&!x.defaultPrevented&&x.key===" "&&(x.preventBaseUIHandler(),Ds(x.currentTarget,x))}},onPointerDown(x){if(t){x.preventDefault();return}S?.(x)}},r?{type:"button"}:{role:"button"},l,w)},[t,l,c,r]),p=z(d=>{i.current=d,u()});return{getButtonProps:f,buttonRef:p}}function Qa(e){return Ie(e)&&e.tagName==="BUTTON"}function Yv(e){return Ie(e)&&e.tagName==="A"&&!!e.href}var zn=b(H(),1);function en(e,t,n,o){let r=He(ef).current;return Jv(r,e,t,n,o)&&tf(r,[e,t,n,o]),r.callback}function Qu(e){let t=He(ef).current;return Xv(t,e)&&tf(t,e),t.callback}function ef(){return{callback:null,cleanup:null,refs:[]}}function Jv(e,t,n,o,r){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==r}function Xv(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}function tf(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){let o=Array(t.length).fill(null);for(let r=0;r<t.length;r+=1){let s=t[r];if(s!=null)switch(typeof s){case"function":{let i=s(n);typeof i=="function"&&(o[r]=i);break}case"object":{s.current=n;break}default:}}e.cleanup=()=>{for(let r=0;r<t.length;r+=1){let s=t[r];if(s!=null)switch(typeof s){case"function":{let i=o[r];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}default:}}}}}}var of=b(H(),1);var nf=b(H(),1),Zv=parseInt(nf.version,10);function Xo(e){return Zv>=e}function ec(e){if(!of.isValidElement(e))return null;let t=e,n=t.props;return(Xo(19)?n?.ref:t.ref)??null}function Le(){}var St=Object.freeze([]),Ne=Object.freeze({});function rf(e,t){let n={};for(let o in e){let r=e[o];if(t?.hasOwnProperty(o)){let s=t[o](r);s!=null&&Object.assign(n,s);continue}r===!0?n[`data-${o.toLowerCase()}`]="":r&&(n[`data-${o.toLowerCase()}`]=r.toString())}return n}function sf(e,t){return typeof e=="function"?e(t):e}function af(e,t){return typeof e=="function"?e(t):e}var tc=b(H(),1);function ne(e,t,n={}){let o=t.render;n.enabled!==!1&&(o=nx(o));let r=Qv(t,n,o);if(n.enabled===!1)return null;let s=n.state??Ne;return ox(e,o,r,s)}function Qv(e,t,n){let{className:o,style:r}=e,{state:s=Ne,ref:i,props:a,stateAttributesMapping:c,enabled:l=!0}=t,u=l?sf(o,s):void 0,f=l?af(r,s):void 0,p=l?rf(s,c):Ne,d=l&&a?ex(a):void 0,m=l?Nr(p,d)??{}:Ne;return typeof document<"u"&&(l?Array.isArray(i)?m.ref=Qu([m.ref,ec(n),...i]):m.ref=en(m.ref,ec(n),i):en(null,null)),l?(u!==void 0&&(m.className=Xa(m.className,u)),f!==void 0&&(m.style=Nr(m.style,f)),m):Ne}function ex(e){return Array.isArray(e)?qu(e):Qt(void 0,e)}var tx=Symbol.for("react.lazy");function nx(e){if(e?.$$typeof!==tx)return e;let t=zn.Children.toArray(e)[0];return zn.isValidElement(t)?t:e}function ox(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);let r=Qt(n,t.props);return r.ref=n.ref,zn.cloneElement(t,r)}if(e&&typeof e=="string")return rx(e,n);throw new Error(Ae(8))}function rx(e,t){return e==="button"?(0,tc.createElement)("button",{type:"button",...t,key:t.key}):e==="img"?(0,tc.createElement)("img",{alt:"",...t,key:t.key}):zn.createElement(e,t)}var nc=cf.forwardRef(function(t,n){let{render:o,className:r,disabled:s=!1,focusableWhenDisabled:i=!1,nativeButton:a=!0,style:c,...l}=t,{getButtonProps:u,buttonRef:f}=zt({disabled:s,focusableWhenDisabled:i,native:a});return ne("button",t,{state:{disabled:s},ref:[n,f],props:[l,u]})});var lf=b(ie()),sx=ys("eg-button",{variants:{variant:{primary:"eg-button--primary",secondary:"eg-button--secondary",critical:"eg-button--critical",tertiary:"eg-button--tertiary"},size:{s:"eg-button--size-s",m:"eg-button--size-m",l:"eg-button--size-l","icon-s":"eg-button--size-icon-s","icon-m":"eg-button--size-icon-m","icon-l":"eg-button--size-icon-l"}},defaultVariants:{variant:"primary",size:"l"}});function Ls({className:e,variant:t,size:n,...o}){return(0,lf.jsx)(nc,{"data-slot":"button",className:sx({variant:t,size:n,className:e}),...o})}var fn={};jt(fn,{Arrow:()=>Fm,Backdrop:()=>Yp,Group:()=>Gm,GroupLabel:()=>Jm,Icon:()=>jp,Item:()=>km,ItemIndicator:()=>Dm,ItemText:()=>Lm,Label:()=>Vp,List:()=>Nm,Popup:()=>Im,Portal:()=>Kp,Positioner:()=>ym,Root:()=>Np,ScrollDownArrow:()=>Wm,ScrollUpArrow:()=>zm,Separator:()=>Qm,Trigger:()=>Up,Value:()=>Wp});var tt=b(H(),1);var uf={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Vs={...uf,position:"fixed",top:0,left:0},ff={...uf,position:"absolute"};var df=b(H(),1);function pf(e){let t=df.useRef(!0);t.current&&(t.current=!1,e())}var mf=b(H(),1);function gf(e){let[t,n]=mf.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function Fs(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}var bo=b(H(),1);function Ar({controlled:e,default:t,name:n,state:o="value"}){let{current:r}=bo.useRef(e!==void 0),[s,i]=bo.useState(t),a=r&&e!==void 0?e:s,c=bo.useCallback(l=>{r||i(l)},[]);return[a,c]}function Ue(e){let t=He(ix,e).current;return t.next=e,U(t.effect),t}function ix(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Pf=b(H(),1),ac=b(Hs(),1),Tf=b(Rf(),1);var bf=b(H(),1);var rc=[],sc;function Ef(){return sc}function Cf(e){rc.push(e)}function ic(e){let t=(n,o)=>{let r=He(Ex).current,s;try{sc=r;for(let i of rc)i.before(r);s=e(n,o);for(let i of rc)i.after(r);r.didInitialize=!0}finally{sc=void 0}return s};return t.displayName=e.displayName||e.name,t}function _f(e){return bf.forwardRef(ic(e))}function Ex(){return{didInitialize:!1}}var Cx=Xo(19),_x=Cx?Tx:Ix;function Bs(e,t,n,o,r){return _x(e,t,n,o,r)}function Px(e,t,n,o,r){let s=Pf.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return(0,ac.useSyncExternalStore)(e.subscribe,s,s)}Cf({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let o=e.syncHooks[n],r=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,r)||(t=!0,o.value=r)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let r of e.syncHooks)n.add(r.store);let o=[];for(let r of n)o.push(r.subscribe(t));return()=>{for(let r of o)r()}}),(0,ac.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Tx(e,t,n,o,r){let s=Ef();if(!s)return Px(e,t,n,o,r);let i=s.syncIndex;s.syncIndex+=1;let a;return s.didInitialize?(a=s.syncHooks[i],(a.store!==e||a.selector!==t||!Object.is(a.a1,n)||!Object.is(a.a2,o)||!Object.is(a.a3,r))&&(a.store!==e&&(s.didChangeStore=!0),a.store=e,a.selector=t,a.a1=n,a.a2=o,a.a3=r,a.value=t(e.getSnapshot(),n,o,r))):(a={store:e,selector:t,a1:n,a2:o,a3:r,value:t(e.getSnapshot(),n,o,r)},s.syncHooks.push(a)),a.value}function Ix(e,t,n,o,r){return(0,Tf.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}var Ws=class{static create(t){return new this(t)}constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;let n=this.updateTick;for(let o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(let n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){let t={...this.state};this.setState(t)}use(t,n,o,r){return Bs(this,t,n,o,r)}};var Eo=b(H(),1);var Rn=class extends Ws{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}useSyncedValue(t,n){Eo.useDebugValue(t);let o=this;U(()=>{o.state[t]!==n&&o.set(t,n)},[o,t,n])}useSyncedValueWithCleanup(t,n){let o=this;U(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){let n=this,o=Object.values(t);U(()=>{n.update(t)},[n,...o])}useControlledProp(t,n){Eo.useDebugValue(t);let o=this,r=n!==void 0;U(()=>{r&&!Object.is(o.state[t],n)&&o.setState({...o.state,[t]:n})},[o,t,n,r])}select(t,n,o,r){let s=this.selectors[t];return s(this.state,n,o,r)}useState(t,n,o,r){return Eo.useDebugValue(t),Bs(this,this.selectors[t],n,o,r)}useContextCallback(t,n){Eo.useDebugValue(t);let o=z(n??Le);this.context[t]=o}useStateSetter(t){let n=Eo.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{let i=o(s);if(!Object.is(r,i)){let a=r;r=i,n(i,a,this)}})}};function bt(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function xe(e,t,n,o){return e.addEventListener(t,n,o),()=>{e.removeEventListener(t,n,o)}}var If=b(H(),1);function Qo(e){If.useEffect(e,St)}var $s=null,_E=globalThis.requestAnimationFrame,cc=class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;let n=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let r=0;r<n.length;r+=1)n[r]?.(t)};request(t){let n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){let n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}},js=new cc;var tn=class e{static create(){return new e}static request(t){return js.request(t)}static cancel(t){return js.cancel(t)}currentId=$s;request(t){this.cancel(),this.currentId=js.request(()=>{this.currentId=$s,t()})}cancel=()=>{this.currentId!==$s&&(js.cancel(this.currentId),this.currentId=$s)};disposeEffect=()=>this.cancel};function Nt(){let e=He(tn.create).current;return Qo(e.disposeEffect),e}var Dr=0,Lt=class e{static create(){return new e}currentId=Dr;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Dr,n()},t)}isStarted(){return this.currentId!==Dr}clear=()=>{this.currentId!==Dr&&(clearTimeout(this.currentId),this.currentId=Dr)};disposeEffect=()=>this.clear};function et(){let e=He(Lt.create).current;return Qo(e.disposeEffect),e}var Ge={};jt(Ge,{engine:()=>pc,env:()=>gc,mediaQuery:()=>hc,os:()=>fc,screenReader:()=>mc});var fc={};jt(fc,{android:()=>Mf,apple:()=>uc,ios:()=>lc,linux:()=>Ax,mac:()=>kf,windows:()=>kx});function Ox(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Nx,platform:Mx,maxTouchPoints:Of}=Ox(),Co=Nx.toLowerCase(),_o=Mx.toLowerCase();var lc=/^i(os$|p)/.test(_o)||_o==="macintel"&&Of>1,Nf="android",Mf=_o===Nf||Co.includes(Nf),kf=!lc&&_o.startsWith("mac"),kx=_o.startsWith("win"),Ax=!Mf&&/^(linux|chrome os)/.test(_o),uc=kf||lc;var pc={};jt(pc,{blink:()=>Lx,gecko:()=>Dx,webkit:()=>dc});var dc=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Dx=!dc&&Co.includes("firefox"),Lx=!dc&&Co.includes("chrom");var mc={};jt(mc,{voiceOver:()=>Vx});var Vx=uc;var gc={};jt(gc,{jsdom:()=>Fx});var Fx=/jsdom|happydom/.test(Co);var hc={};jt(hc,{iOS:()=>Hx});var Hx="@supports (-webkit-touch-callout: none)";function Et(e){e.preventDefault(),e.stopPropagation()}function Af(e){return"nativeEvent"in e}function qn(e){return e.pointerType===""&&e.isTrusted?!0:Ge.os.android&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function er(e){return Ge.env.jsdom?!1:!Ge.os.android&&e.width===0&&e.height===0||Ge.os.android&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function kn(e,t){let n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Df(e){let t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function mt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Q(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&xn(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Ve(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}var Lr="data-base-ui-focusable";var vc="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Vr="ArrowLeft",Fr="ArrowRight",xc="ArrowUp",zs="ArrowDown";var tr={};jt(tr,{endingStyle:()=>Hr,startingStyle:()=>Po});var Po="data-starting-style",Hr="data-ending-style";var Ux={[Po]:""},Bx={[Hr]:""},Vt={transitionStatus(e){return e==="starting"?Ux:e==="ending"?Bx:null}};var nn={};jt(nn,{align:()=>zx,anchorHidden:()=>wc,closed:()=>yc,endingStyle:()=>$x,open:()=>Sc,side:()=>jx,startingStyle:()=>Wx});var Sc="data-open",yc="data-closed",Wx=Po,$x=Hr,wc="data-anchor-hidden",jx="data-side",zx="data-align";var To={};jt(To,{popupOpen:()=>qs,pressed:()=>Rc});var qs="data-popup-open",Rc="data-pressed";var qx={[qs]:""},Kx={[qs]:"",[Rc]:""},Gx={[Sc]:""},Yx={[yc]:""},Jx={[wc]:""},nr={open(e){return e?qx:null}},Ks={open(e){return e?Kx:null}},qt={open(e){return e?Gx:Yx},anchorHidden(e){return e?Jx:null}},Kn={...qt,...Vt};var qE=To.popupOpen,bc="data-trigger-disabled";function Ur(e,t){if(!Pe(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(bc);for(let[,o]of t.entries())if(Q(o,n))return!o.hasAttribute(bc);return!1}function Gs(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Lf(e){return e.matches("html,body")}function Br(e){return Ie(e)&&e.matches(vc)}function Ec(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${vc}`)!=null}function Wr(e){return e?e.getAttribute("role")==="combobox"&&Br(e):!1}function Io(e){return e?e.hasAttribute(Lr)?e:e.querySelector(`[${Lr}]`)||e:null}function Zx(e,t){return t!=null&&!kn(t)?0:typeof e=="function"?e():e}function $r(e,t,n){let o=Zx(e,n);return typeof o=="number"?o:o?.[t]}function Cc(e){return typeof e=="function"?e():e}function Ys(e,t){return t||e==="click"||e==="mousedown"}function Vf(e){return e?.includes("mouse")&&e!=="mousedown"}var te={};jt(te,{cancelOpen:()=>_S,chipRemovePress:()=>cS,clearPress:()=>aS,closePress:()=>sS,closeWatcher:()=>SS,decrementPress:()=>fS,disabled:()=>TS,drag:()=>bS,escapeKey:()=>xS,focusOut:()=>vS,imperativeAction:()=>NS,incrementPress:()=>uS,initial:()=>OS,inputBlur:()=>mS,inputChange:()=>dS,inputClear:()=>pS,inputPaste:()=>gS,inputPress:()=>hS,itemPress:()=>rS,keyboard:()=>wS,linkPress:()=>iS,listNavigation:()=>yS,missing:()=>IS,none:()=>Qx,outsidePress:()=>oS,pointer:()=>RS,scrub:()=>CS,siblingOpen:()=>PS,swipe:()=>MS,trackPress:()=>lS,triggerFocus:()=>nS,triggerHover:()=>tS,triggerPress:()=>eS,wheel:()=>ES,windowResize:()=>kS});var Qx="none",eS="trigger-press",tS="trigger-hover",nS="trigger-focus",oS="outside-press",rS="item-press",sS="close-press",iS="link-press",aS="clear-press",cS="chip-remove-press",lS="track-press",uS="increment-press",fS="decrement-press",dS="input-change",pS="input-clear",mS="input-blur",gS="input-paste",hS="input-press",vS="focus-out",xS="escape-key",SS="close-watcher",yS="list-navigation",wS="keyboard",RS="pointer",bS="drag",ES="wheel",CS="scrub",_S="cancel-open",PS="sibling-open",TS="disabled",IS="missing",OS="initial",NS="imperative-action",MS="swipe",kS="window-resize";function me(e,t,n,o){let r=!1,s=!1,i=o??Ne;return{reason:e,event:t??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...i}}var _t=b(H(),1);var Js=b(H(),1);var Ff=b(ie(),1),on=Js.forwardRef(function(t,n){let[o,r]=Js.useState();return U(()=>{Ge.screenReader.voiceOver&&Ge.engine.webkit&&r("button")},[]),(0,Ff.jsx)("span",{...t,ref:n,style:Vs,"aria-hidden":o?void 0:!0,...{tabIndex:0,role:o},"data-base-ui-focus-guard":""})});var Gn=Math.min,pn=Math.max,Yn=Math.round,zr=Math.floor,bn=e=>({x:e,y:e}),AS={left:"right",right:"left",bottom:"top",top:"bottom"};function Zs(e,t,n){return pn(e,Gn(t,n))}function En(e,t){return typeof e=="function"?e(t):e}function Ct(e){return e.split("-")[0]}function rn(e){return e.split("-")[1]}function Qs(e){return e==="x"?"y":"x"}function qr(e){return e==="y"?"height":"width"}function Ft(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function Kr(e){return Qs(Ft(e))}function Bf(e,t,n){n===void 0&&(n=!1);let o=rn(e),r=Kr(e),s=qr(r),i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=jr(i)),[i,jr(i)]}function Wf(e){let t=jr(e);return[Xs(e),t,Xs(t)]}function Xs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var Hf=["left","right"],Uf=["right","left"],DS=["top","bottom"],LS=["bottom","top"];function VS(e,t,n){switch(e){case"top":case"bottom":return n?t?Uf:Hf:t?Hf:Uf;case"left":case"right":return t?DS:LS;default:return[]}}function $f(e,t,n,o){let r=rn(e),s=VS(Ct(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(Xs)))),s}function jr(e){let t=Ct(e);return AS[t]+e.slice(t.length)}function FS(e){var t,n,o,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(r=e.left)!=null?r:0}}function ei(e){return typeof e!="number"?FS(e):{top:e,right:e,bottom:e,left:e}}function An(e){let{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Jn(e,t){return t<0||t>=e.length}function Oo(e,t){return sn(e.current,{disabledIndices:t})}function or(e,t){return sn(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function sn(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:r=1}={}){let s=t;do s+=n?-r:r;while(s>=0&&s<=e.length-1&&Dn(e,s,o));return s}function Dn(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!No(r)||r.matches(":disabled")?!0:!n&&(r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"):!1}function HS(e){return e.visibility==="hidden"||e.visibility==="collapse"}function No(e,t=e?pt(e):null){return!e||!e.isConnected||!t||HS(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}var US='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function BS(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return xn(n)?n.host:null}function Pc(e){for(let t of Array.from(e.children))if(it(t)==="summary")return t;return null}function WS(e,t){let n=Pc(t);return!!n&&(e===n||Q(n,e))}function jf(e){let t=e?it(e):"";return e!=null&&e.matches(US)&&(t!=="summary"||e.parentElement!=null&&it(e.parentElement)==="details"&&Pc(e.parentElement)===e)&&(t!=="details"||Pc(e)==null)&&(t!=="input"||e.type!=="hidden")}function zf(e){if(!jf(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=BS(t)){let n=t!==e,o=it(t)==="slot";if(t.hasAttribute("inert")||n&&it(t)==="details"&&!t.open&&!WS(e,t)||t.hasAttribute("hidden")||!o&&!$S(t,n))return!1}return!0}function $S(e,t){let n=pt(e);return t?n.display!=="none":No(e,n)}function qf(e){let t=e.tabIndex;if(t<0){let n=it(e);if(n==="details"||n==="audio"||n==="video"||Ie(e)&&e.isContentEditable)return 0}return t}function _c(e){if(it(e)!=="input")return null;let t=e;return t.type==="radio"&&t.name!==""?t:null}function jS(e,t){let n=_c(e);if(!n)return!0;let o=t.find(r=>{let s=_c(r);return s?.name===n.name&&s.form===n.form&&s.checked});return o?o===n:t.find(r=>{let s=_c(r);return s?.name===n.name&&s.form===n.form})===n}function Kf(e){if(Ie(e)&&it(e)==="slot"){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ie(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Gf(e,t){Kf(e).forEach(n=>{jf(n)&&t.push(n),Gf(n,t)})}function Yf(e,t,n){Kf(e).forEach(o=>{Ie(o)&&o.matches(t)&&n.push(o),Yf(o,t,n)})}function ti(e){return zf(e)&&qf(e)>=0}function Tc(e){let t=[];return Gf(e,t),t.filter(zf)}function rr(e){let t=Tc(e);return t.filter(n=>qf(n)>=0&&jS(n,t))}function Jf(e,t){let n=rr(e),o=n.length;if(o===0)return;let r=mt(ve(e)),s=n.indexOf(r),i=s===-1?t===1?0:o-1:s+t;return n[i]}function Xn(e){return Jf(ve(e).body,1)||e}function Zn(e){return Jf(ve(e).body,-1)||e}function zS(e,t){if(!e)return null;let n=rr(ve(e).body),o=n.length;if(o===0)return null;let r=n.indexOf(e);if(r===-1)return null;let s=(r+t+o)%o;return n[s]}function Xf(e){return zS(e,1)}function Mt(e,t){let n=t||e.currentTarget,o=e.relatedTarget;return!o||!Q(n,o)}function ni(e){rr(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Gr(e){let t=[];Yf(e,"[data-tabindex]",t),t.forEach(n=>{let o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}function Ht(e,t,n=!0){return e.filter(r=>r.parentId===t).flatMap(r=>[...!n||r.context?.open?[r]:[],...Ht(e,r.id,n)])}function Ic(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){let r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function Mo(e){return`data-base-ui-${e}`}var oi=0;function sr(e,t={}){let{preventScroll:n=!1,sync:o=!1,shouldFocus:r}=t;cancelAnimationFrame(oi);function s(){r&&!r()||e?.focus({preventScroll:n})}if(o)return s(),Le;let i=requestAnimationFrame(s);return oi=i,()=>{oi===i&&(cancelAnimationFrame(i),oi=0)}}var Oc={inert:new WeakMap,"aria-hidden":new WeakMap},Zf="data-base-ui-inert",Mc={inert:new WeakSet,"aria-hidden":new WeakSet},Yr=new WeakMap,Nc=0;function qS(e){return Mc[e]}function nd(e){return e?xn(e)?e.host:nd(e.parentNode):null}var Qf=(e,t)=>t.map(n=>{if(e.contains(n))return n;let o=nd(n);return e.contains(o)?o:null}).filter(n=>n!=null),ed=e=>{let t=new Set;return e.forEach(n=>{let o=n;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},td=(e,t,n)=>{let o=[],r=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{it(i)!=="script"&&(t.has(i)?r(i):o.push(i))})};return r(e),o};function KS(e,t,n,o,{mark:r=!0}){let s=null;o?s="inert":n&&(s="aria-hidden");let i=null,a=null,c=Qf(t,e),l=r?td(t,ed(c),new Set(c)):[],u=[],f=[];if(s){let p=Oc[s],d=qS(s);a=d,i=p;let m=Qf(t,Array.from(t.querySelectorAll("[aria-live]"))),g=c.concat(m);td(t,ed(g),new Set(g)).forEach(v=>{let S=v.getAttribute(s),w=S!==null&&S!=="false",x=(p.get(v)||0)+1;p.set(v,x),u.push(v),x===1&&w&&d.add(v),w||v.setAttribute(s,s==="inert"?"":"true")})}return r&&l.forEach(p=>{let d=(Yr.get(p)||0)+1;Yr.set(p,d),f.push(p),d===1&&p.setAttribute(Zf,"")}),Nc+=1,()=>{i&&u.forEach(p=>{let m=(i.get(p)||0)-1;i.set(p,m),m||(!a?.has(p)&&s&&p.removeAttribute(s),a?.delete(p))}),r&&f.forEach(p=>{let d=(Yr.get(p)||0)-1;Yr.set(p,d),d||p.removeAttribute(Zf)}),Nc-=1,Nc||(Oc.inert=new WeakMap,Oc["aria-hidden"]=new WeakMap,Mc.inert=new WeakSet,Mc["aria-hidden"]=new WeakSet,Yr=new WeakMap)}}function kc(e,t={}){let{ariaHidden:n=!1,inert:o=!1,mark:r=!0}=t,s=ve(e[0]).body;return KS(e,s,n,o,{mark:r})}var Ye=b(H(),1),Ac=b($n(),1);var ri=b(H(),1);var od=0;function GS(e,t="mui"){let[n,o]=ri.useState(e),r=e||n;return ri.useEffect(()=>{n==null&&(od+=1,o(`${t}-${od}`))},[n,t]),r}var rd=Or.useId;function an(e,t){if(rd!==void 0){let n=rd();return e??(t?`${t}-${n}`:n)}return GS(e,t)}var sd={style:{transition:"none"}},si="data-base-ui-click-trigger",YS="data-base-ui-swipe-ignore",JS="data-swipe-ignore",EC=`[${YS}]`,CC=`[${JS}]`,ii={fallbackAxisSide:"none"},id={fallbackAxisSide:"end"},ai={clipPath:"inset(50%)",position:"fixed",top:0,left:0};var ko=b(ie(),1),ad=Ye.createContext(null),Dc=()=>Ye.useContext(ad),XS=Mo("portal");function cd(e={}){let{ref:t,container:n,componentProps:o=Ne,elementProps:r}=e,s=an(),a=Dc()?.portalNode,[c,l]=Ye.useState(null),[u,f]=Ye.useState(null),p=z(h=>{h!==null&&f(h)}),d=Ye.useRef(null);U(()=>{if(n===null){d.current&&(d.current=null,f(null),l(null));return}let h=(n&&(Ts(n)?n:n.current))??a??document.body;if(h==null){d.current&&(d.current=null,f(null),l(null));return}d.current!==h&&(d.current=h,f(null),l(h))},[n,a]);let m=ne("div",o,{ref:[t,p],props:[{id:s,[XS]:""},r]}),g=c&&m?Ac.createPortal(m,c):null;return{node:u,nodeId:Ye.isValidElement(m)?m.props.id:void 0,subtree:g}}var Ao=Ye.forwardRef(function(t,n){let{render:o,className:r,style:s,children:i,container:a,portalOwnerRole:c,...l}=t,{node:u,nodeId:f,subtree:p}=cd({container:a,ref:n,componentProps:t,elementProps:l}),d=Ye.useRef(null),m=Ye.useRef(null),g=Ye.useRef(null),h=Ye.useRef(null),[v,S]=Ye.useState(null),w=Ye.useRef(!1),x=v?.modal,y=v?.open,R=!!v&&!v.modal&&v.open&&!!u;Ye.useEffect(()=>{if(!u||x)return;function _(P){u&&P.relatedTarget&&Mt(P)&&(P.type==="focusin"?w.current&&(Gr(u),w.current=!1):(ni(u),w.current=!0))}return bt(xe(u,"focusin",_,!0),xe(u,"focusout",_,!0))},[u,x]),U(()=>{!u||y!==!0||!w.current||(Gr(u),w.current=!1)},[y,u]);let E=Ye.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:m,beforeInsideRef:g,afterInsideRef:h,portalNode:u,setFocusManagerState:S}),[u]);return(0,ko.jsxs)(Ye.Fragment,{children:[p,(0,ko.jsxs)(ad.Provider,{value:E,children:[R&&u&&(0,ko.jsx)(on,{"data-type":"outside",ref:d,onFocus:_=>{if(Mt(_,u))g.current?.focus();else{let P=v?v.domReference:null;Zn(P)?.focus()}}}),R&&u&&(0,ko.jsx)("span",{role:c,"aria-owns":f,style:ai}),u&&Ac.createPortal(i,u),R&&u&&(0,ko.jsx)(on,{"data-type":"outside",ref:m,onFocus:_=>{if(Mt(_,u))h.current?.focus();else{let P=v?v.domReference:null;Xn(P)?.focus(),v?.closeOnFocusOut&&v?.onOpenChange(!1,me(te.focusOut,_.nativeEvent))}}})]})]})});var Qn=b(H(),1);function ci(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var li=class{nodesRef={current:[]};events=ci();addNode(t){this.nodesRef.current.push(t)}removeNode(t){let n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}};var Lc=b(ie(),1),ld=Qn.createContext(null),ud=Qn.createContext(null),Kt=()=>Qn.useContext(ld)?.id||null,gt=e=>{let t=Qn.useContext(ud);return e??t};function Vc(e){let t=an(),n=gt(e),o=Kt();return U(()=>{if(!t)return;let r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function Jr(e){let{children:t,id:n}=e,o=Kt();return(0,Lc.jsx)(ld.Provider,{value:Qn.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function Fc(e){let{children:t,externalTree:n}=e,o=He(()=>n??new li).current;return(0,Lc.jsx)(ud.Provider,{value:o,children:t})}function mn(e){return e==null?e:"current"in e?e.current:e}var Xr=b(ie(),1);function ZS(e,t){let n=Oe(Ve(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}var fd=20,eo=[];function Hc(){eo=eo.filter(e=>e.deref()?.isConnected)}function dd(e){Hc(),e&&it(e)!=="body"&&(eo.push(new WeakRef(e)),eo.length>fd&&(eo=eo.slice(-fd)))}function pd(){return Hc(),eo[eo.length-1]?.deref()}function QS(e){return e?ti(e)?e:rr(e)[0]||e:null}function md(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;let n=Tc(e).filter(r=>{let s=r.getAttribute("data-tabindex")||"";return ti(r)||r.hasAttribute("data-tabindex")&&!s.startsWith("-")}),o=e.getAttribute("tabindex");n.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Zr(e){let{context:t,children:n,disabled:o=!1,initialFocus:r=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:c=!0,openInteractionType:l="",nextFocusableElement:u,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:d,getInsideElements:m}=e,g="rootStore"in t?t.rootStore:t,h=g.useState("open"),v=g.useState("domReferenceElement"),S=g.useState("floatingElement"),{events:w,dataRef:x}=g.context,y=z(()=>x.current.floatingContext?.nodeId),R=r===!1,E=Wr(v)&&R,_=Ue(r),P=Ue(s),O=Ue(l),T=Ue(h),D=gt(d),C=Dc(),M=_t.useRef(!1),I=_t.useRef(!1),A=_t.useRef(!1),L=_t.useRef(null),N=_t.useRef(""),$=_t.useRef(""),k=_t.useRef(null),q=_t.useRef(null),B=en(k,p,C?.beforeInsideRef),j=en(q,C?.afterInsideRef),V=et(),X=et(),Y=Nt(),ge=C!=null,Z=Io(S),de=z((W=Z)=>W?rr(W):[]),ce=z(()=>m?.().filter(W=>W!=null)??[]);_t.useEffect(()=>{if(o||!a)return;function W(ue){ue.key==="Tab"&&Q(Z,mt(ve(Z)))&&de().length===0&&!E&&Et(ue)}let se=ve(Z);return xe(se,"keydown",W)},[o,Z,a,E,de]),_t.useEffect(()=>{if(o||!h)return;let W=ve(Z);function se(){A.current=!1}function ue(De){let oe=Ve(De),we=ce(),re=Q(S,oe)||Q(v,oe)||Q(C?.portalNode,oe)||we.some(Ce=>Ce===oe||Q(Ce,oe));A.current=!re,$.current=De.pointerType||"keyboard",oe?.closest(`[${si}]`)&&(I.current=!0,X.start(0,()=>{I.current=!1}))}function he(){$.current="keyboard"}return bt(xe(W,"pointerdown",ue,!0),xe(W,"pointerup",se,!0),xe(W,"pointercancel",se,!0),xe(W,"keydown",he,!0),se)},[o,S,v,Z,h,C,X,ce]),_t.useEffect(()=>{if(o||!c)return;let W=ve(Z);function se(){I.current=!0,X.start(0,()=>{I.current=!1})}function ue(we){let re=Ve(we);ti(re)&&(L.current=re)}function he(we){let re=we.relatedTarget,Ce=we.currentTarget,be=Ve(we);a&&re==null&&be!=null&&Q(S,be)&&dd(be),queueMicrotask(()=>{let _e=y(),We=g.context.triggerElements,G=ce(),ee=re?.hasAttribute(Mo("focus-guard"))&&[k.current,q.current,C?.beforeInsideRef.current,C?.afterInsideRef.current,C?.beforeOutsideRef.current,C?.afterOutsideRef.current,mn(f),mn(u)].includes(re),K=!(Q(v,re)||Q(S,re)||Q(re,S)||Q(C?.portalNode,re)||G.some(F=>F===re||Q(F,re))||We.hasMatchingElement(F=>Q(F,re))||ee||D&&(Ht(D.nodesRef.current,_e).find(F=>Q(F.context?.elements.floating,re)||Q(F.context?.elements.domReference,re))||Ic(D.nodesRef.current,_e).find(F=>[F.context?.elements.floating,Io(F.context?.elements.floating)].includes(re)||F.context?.elements.domReference===re)));if(Ce===v&&Z&&md(Z),i&&Ce!==v&&!No(be)&&mt(W)===W.body){if(Ie(Z)&&(Z.focus(),i==="popup")){Y.request(()=>{Z.focus()});return}let F=de(),fe=L.current,Me=(fe&&F.includes(fe)?fe:null)||F[F.length-1]||Z;Ie(Me)&&Me.focus()}if(x.current.insideReactTree){x.current.insideReactTree=!1;return}(E||!a)&&re&&K&&!I.current&&(E||re!==pd())&&(M.current=!0,g.setOpen(!1,me(te.focusOut,we)))})}function De(){A.current||(x.current.insideReactTree=!0,V.start(0,()=>{x.current.insideReactTree=!1}))}let oe=Ie(v)?v:null;if(!(!S&&!oe))return bt(oe&&xe(oe,"focusout",he),oe&&xe(oe,"pointerdown",se),S&&xe(S,"focusin",ue),S&&xe(S,"focusout",he),S&&C&&xe(S,"focusout",De,!0))},[o,v,S,Z,a,D,C,g,c,i,de,E,y,x,V,X,Y,u,f,ce]),_t.useEffect(()=>{if(o||!S||!h)return;let W=Array.from(C?.portalNode?.querySelectorAll(`[${Mo("portal")}]`)||[]),ue=(D?Ic(D.nodesRef.current,y()):[]).find(Ce=>Wr(Ce.context?.elements.domReference||null))?.context?.elements.domReference,De=[...[S,...W,k.current,q.current,C?.beforeOutsideRef.current,C?.afterOutsideRef.current,...ce()],ue,mn(f),mn(u),E?v:null].filter(Ce=>Ce!=null),oe=kc(De,{ariaHidden:a||E,mark:!1}),we=[S,...W].filter(Ce=>Ce!=null),re=kc(we);return()=>{re(),oe()}},[h,o,v,S,a,C,E,D,y,u,f,ce]),U(()=>{if(!h||o||!Ie(Z))return;N.current="",$.current="";let W=ve(Z),se=mt(W);queueMicrotask(()=>{let ue=_.current,he=typeof ue=="function"?ue(O.current||""):ue;if(he===void 0||he===!1||Q(Z,se))return;let oe=null,we=()=>(oe==null&&(oe=de(Z)),oe[0]||Z),re;he===!0||he===null?re=we():re=mn(he),re=re||we();let Ce=Q(Z,mt(W));sr(re,{preventScroll:re===Z,shouldFocus(){if(!T.current)return!1;if(Ce)return!0;let be=mt(W);return!(be!==re&&Q(Z,be))}})})},[o,h,Z,de,_,O,T]),U(()=>{if(o||!Z)return;let W=ve(Z),se=mt(W),ue=O.current==null;dd(se);function he(oe){if(oe.open||(N.current=ZS(oe.nativeEvent,$.current)),oe.reason===te.triggerHover&&oe.nativeEvent.type==="mouseleave"&&(M.current=!0),oe.reason===te.outsidePress)if(oe.nested)M.current=!1;else if(qn(oe.nativeEvent)||er(oe.nativeEvent))M.current=!1;else{let we=!1;ve(Z).createElement("div").focus({get preventScroll(){return we=!0,!1}}),we?M.current=!1:M.current=!0}}w.on("openchange",he);function De(oe){let we=P.current,re=typeof we=="function"?we(oe):we;if(re===void 0||re===!1)return null;re===null&&(re=!0);let Ce=v?.isConnected?v:null,be=se?.isConnected&&it(se)!=="body"?se:null,_e=ue?be||Ce:Ce||be;return _e||(_e=pd()||null),typeof re=="boolean"?_e:mn(re)||_e||null}return()=>{w.off("openchange",he);let oe=mt(W),we=ce(),re=Q(S,oe)||we.some(We=>We===oe||Q(We,oe))||D&&Ht(D.nodesRef.current,y(),!1).some(We=>Q(We.context?.elements.floating,oe)),Ce=P.current,be=N.current,_e=De(be);queueMicrotask(()=>{let We=QS(_e),G=typeof Ce!="boolean";if(Ce&&!M.current&&Ie(We)&&(!(!G&&We!==oe&&oe!==W.body)||re)){let ee={preventScroll:!0};be==="keyboard"&&(ee.focusVisible=!0),We.focus(ee)}M.current=!1})}},[o,S,Z,P,O,w,D,v,y,ce]),U(()=>{if(!Ge.engine.webkit||h||!S)return;let W=mt(ve(S));!Ie(W)||!Br(W)||Q(S,W)&&W.blur()},[h,S]),U(()=>{if(!(o||!C))return C.setFocusManagerState({modal:a,closeOnFocusOut:c,open:h,onOpenChange:g.setOpen,domReference:v}),()=>{C.setFocusManagerState(null)}},[o,C,a,h,g,c,v]),U(()=>{if(!(o||!Z))return md(Z),()=>{queueMicrotask(Hc)}},[o,Z]);let le=!o&&(a?!E:!0)&&(ge||a);return(0,Xr.jsxs)(_t.Fragment,{children:[le&&(0,Xr.jsx)(on,{"data-type":"inside",ref:B,onFocus:W=>{if(a){let se=de();sr(se[se.length-1])}else C?.portalNode&&(M.current=!1,Mt(W,C.portalNode)?Xn(v)?.focus():mn(f??C.beforeOutsideRef)?.focus())}}),n,le&&(0,Xr.jsx)(on,{"data-type":"inside",ref:j,onFocus:W=>{a?sr(de()[0]):C?.portalNode&&(c&&(M.current=!0),Mt(W,C.portalNode)?Zn(v)?.focus():mn(u??C.afterOutsideRef)?.focus())}})]})}var Qr=b(H(),1);function Do(e,t={}){let{enabled:n=!0,event:o="click",toggle:r=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:a=0,reason:c=te.triggerPress}=t,l="rootStore"in e?e.rootStore:e,u=l.context.dataRef,f=Qr.useRef(void 0),p=Nt(),d=et(),m=Qr.useMemo(()=>{function g(v,S,w,x){let y=me(c,S,w);v&&x==="touch"&&a>0?d.start(a,()=>{l.setOpen(!0,y)}):l.setOpen(v,y)}function h(v,S,w){let x=u.current.openEvent,y=l.select("domReferenceElement")!==S;return v&&y||!v||!r?!0:x&&i?!w(x.type):!1}return{onPointerDown(v){f.current=kn(v.pointerType,!0)&&er(v.nativeEvent)?"virtual":v.pointerType},onMouseDown(v){let S=f.current,w=v.nativeEvent,x=l.select("open");if(v.button!==0||o==="click"||kn(S,!0)&&s)return;let y=h(x,v.currentTarget,_=>_==="click"||_==="mousedown"),R=Ve(w);if(Br(R)){g(y,w,R,S);return}let E=v.currentTarget;p.request(()=>{g(y,w,E,S)})},onClick(v){if(o==="mousedown-only")return;let S=f.current;if(o==="mousedown"&&S){f.current=void 0;return}if(kn(S,!0)&&s)return;let w=l.select("open"),x=h(w,v.currentTarget,y=>y==="click"||y==="mousedown"||y==="keydown"||y==="keyup");g(x,v.nativeEvent,v.currentTarget,S)},onKeyDown(){f.current=void 0}}},[u,o,s,c,l,i,r,p,d,a]);return Qr.useMemo(()=>n?{reference:m}:Ne,[n,m])}var kt=b(H(),1);function ey(){return!1}function ty(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Lo(e,t={}){let{enabled:n=!0,escapeKey:o=!0,outsidePress:r=!0,outsidePressEvent:s="sloppy",referencePress:i=ey,bubbles:a,externalTree:c}=t,l="rootStore"in e?e.rootStore:e,u=l.useState("open"),f=l.useState("floatingElement"),{dataRef:p,events:d}=l.context,m=gt(c),g=z(typeof r=="function"?r:()=>!1),h=typeof r=="function"?g:r,v=h!==!1,S=z(()=>s),{escapeKey:w,outsidePress:x}=ty(a),y=kt.useRef(!1),R=kt.useRef(!1),E=kt.useRef(!1),_=kt.useRef(!1),P=kt.useRef(!1),O=kt.useRef(""),T=kt.useRef(null),D=et(),C=et(),M=z(()=>{C.clear(),p.current.insideReactTree=!1}),I=z(V=>{let X=p.current.floatingContext?.nodeId;return(m?Ht(m.nodesRef.current,X):[]).some(ge=>ge.context?.open&&!ge.context.dataRef.current[V])}),A=z(V=>Gs(V,l.select("floatingElement"))||Gs(V,l.select("domReferenceElement"))),L=z(V=>{i()&&l.setOpen(!1,me(te.triggerPress,V.nativeEvent))}),N=z(V=>{if(!u||!n||!o||V.key!=="Escape"||P.current||!w&&I("__escapeKeyBubbles"))return;let X=Af(V)?V.nativeEvent:V,Y=me(te.escapeKey,X);l.setOpen(!1,Y),Y.isCanceled||V.preventDefault(),!w&&!Y.isPropagationAllowed&&V.stopPropagation()}),$=z(()=>{p.current.insideReactTree=!0,C.start(0,M)}),k=z(V=>{if(!u||!n||V.button!==0)return;let X=Ve(V.nativeEvent);Q(l.select("floatingElement"),X)&&(y.current||(y.current=!0,R.current=!1))}),q=z(V=>{!u||!n||(V.defaultPrevented||V.nativeEvent.defaultPrevented)&&y.current&&(R.current=!0)});kt.useEffect(()=>{function V(X){X.open||(_.current=!1)}return d.on("openchange",V),()=>{d.off("openchange",V)}},[d]),kt.useEffect(()=>{if(!u||!n)return u||(_.current=!1),M;p.current.__escapeKeyBubbles=w,p.current.__outsidePressBubbles=x;let V=new Lt,X=new Lt,Y=ve(f);function ge(){V.clear(),P.current=!0}function Z(){V.start(Ge.engine.webkit?5:0,()=>{P.current=!1})}function de(){E.current=!0,X.start(0,()=>{E.current=!1})}function ce(){y.current=!1,R.current=!1}function le(){let K=O.current,F=K==="pen"||!K?"mouse":K,fe=S(),Me=typeof fe=="function"?fe():fe;return typeof Me=="string"?Me:Me[F]}function W(K){let F=le();return F==="intentional"&&K.type!=="click"||F==="sloppy"&&K.type==="click"}function se(K){let F=p.current.floatingContext?.nodeId,fe=m&&Ht(m.nodesRef.current,F).some(Me=>Gs(K,Me.context?.elements.floating));return A(K)||fe}function ue(K){if(W(K)){K.type!=="click"&&!A(K)&&(X.clear(),E.current=!1),M();return}if(p.current.insideReactTree){M();return}let F=Ve(K),fe=`[${Mo("inert")}]`,Me=Pe(F)?F.getRootNode():null,Ke=Array.from((xn(Me)?Me:ve(l.select("floatingElement"))).querySelectorAll(fe)),$e=l.context.triggerElements;if(F&&($e.hasElement(F)||$e.hasMatchingElement(Qe=>Q(Qe,F))))return;let Ze=Pe(F)?F:null;for(;Ze&&!wn(Ze);){let Qe=Sn(Ze);if(wn(Qe)||!Pe(Qe))break;Ze=Qe}if(!(Ke.length&&Pe(F)&&!Lf(F)&&!Q(F,l.select("floatingElement"))&&Ke.every(Qe=>!Q(Ze,Qe)))){if(Ie(F)&&!("touches"in K)){let Qe=wn(F),It=pt(F),vt=/auto|scroll/,xt=Qe||vt.test(It.overflowX),Dt=Qe||vt.test(It.overflowY),Xt=xt&&F.clientWidth>0&&F.scrollWidth>F.clientWidth,dn=Dt&&F.clientHeight>0&&F.scrollHeight>F.clientHeight,Rt=It.direction==="rtl",ft=dn&&(Rt?K.offsetX<=F.offsetWidth-F.clientWidth:K.offsetX>F.clientWidth),Se=Xt&&K.offsetY>F.clientHeight;if(ft||Se)return}if(!se(K)){if(le()==="intentional"){if(K.detail!==0&&!qn(K)&&!_.current)return;if(E.current){X.clear(),E.current=!1;return}}typeof h=="function"&&!h(K)||I("__outsidePressBubbles")||(l.setOpen(!1,me(te.outsidePress,K)),M())}}}function he(K){le()!=="sloppy"||K.pointerType==="touch"||!l.select("open")||!n||A(K)||ue(K)}function De(K){if(le()!=="sloppy"||!l.select("open")||!n||A(K))return;let F=K.touches[0];F&&(T.current={startTime:Date.now(),startX:F.clientX,startY:F.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function oe(K,F){let fe=Ve(K);if(!fe)return;let Me=xe(fe,K.type,()=>{F(K),Me()})}function we(K){O.current="touch",oe(K,De)}function re(K){D.clear(),K.type==="pointerdown"&&(K.button===0&&(_.current=!0),O.current=K.pointerType),!(K.type==="mousedown"&&T.current&&!T.current.dismissOnMouseDown)&&oe(K,F=>{F.type==="pointerdown"?he(F):ue(F)})}function Ce(K){if(K.type==="pointercancel"&&(_.current=!1),!y.current)return;let F=R.current;if(ce(),le()==="intentional"){if(K.type==="pointercancel"){F&&de();return}if(!se(K)){if(F){de();return}typeof h=="function"&&!h(K)||(X.clear(),E.current=!0,M())}}}function be(K){if(le()!=="sloppy"||!T.current||A(K))return;let F=K.touches[0];if(!F)return;let fe=Math.abs(F.clientX-T.current.startX),Me=Math.abs(F.clientY-T.current.startY),Ke=Math.sqrt(fe*fe+Me*Me);Ke>5&&(T.current.dismissOnTouchEnd=!0),Ke>10&&(ue(K),D.clear(),T.current=null)}function _e(K){oe(K,be)}function We(K){le()!=="sloppy"||!T.current||A(K)||(T.current.dismissOnTouchEnd&&ue(K),D.clear(),T.current=null)}function G(K){oe(K,We)}let ee=bt(o&&bt(xe(Y,"keydown",N),xe(Y,"compositionstart",ge),xe(Y,"compositionend",Z)),v&&bt(xe(Y,"click",re,!0),xe(Y,"pointerdown",re,!0),xe(Y,"pointerup",Ce,!0),xe(Y,"pointercancel",Ce,!0),xe(Y,"mousedown",re,!0),xe(Y,"mouseup",Ce,!0),xe(Y,"touchstart",we,{capture:!0,passive:!0}),xe(Y,"touchmove",_e,{capture:!0,passive:!0}),xe(Y,"touchend",G,{capture:!0,passive:!0})));return()=>{ee(),V.clear(),X.clear(),ce(),E.current=!1,M()}},[p,f,o,v,h,u,n,w,x,N,M,S,I,A,m,l,D]);let B=kt.useMemo(()=>({onKeyDown:N,onPointerDown:L,onClick:L}),[N,L]),j=kt.useMemo(()=>({onKeyDown:N,onPointerDown:q,onMouseDown:q,onClickCapture:$,onMouseDownCapture(V){$(),k(V)},onPointerDownCapture(V){$(),k(V)},onMouseUpCapture:$,onTouchEndCapture:$,onTouchMoveCapture:$}),[N,$,k,q]);return kt.useMemo(()=>n?{reference:B,floating:j,trigger:B}:{},[n,B,j])}var Pt=b(H(),1);function gd(e,t,n){let{reference:o,floating:r}=e,s=Ft(t),i=Kr(t),a=qr(i),c=Ct(t),l=s==="y",u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,p=o[a]/2-r[a]/2,d;switch(c){case"top":d={x:u,y:o.y-r.height};break;case"bottom":d={x:u,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:f};break;case"left":d={x:o.x-r.width,y:f};break;default:d={x:o.x,y:o.y}}let m=rn(t);return m&&(d[i]+=p*(m==="end"?1:-1)*(n&&l?-1:1)),d}async function hd(e,t){var n;t===void 0&&(t={});let{x:o,y:r,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=En(t,e),m=ei(d),h=a[p?f==="floating"?"reference":"floating":f],v=An(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(h)))==null||n?h:h.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),S=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),x=await(s.isElement==null?void 0:s.isElement(w))&&await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1},y=An(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:S,offsetParent:w,strategy:c}):S);return{top:(v.top-y.top+m.top)/x.y,bottom:(y.bottom-v.bottom+m.bottom)/x.y,left:(v.left-y.left+m.left)/x.x,right:(y.right-v.right+m.right)/x.x}}var ny=50,vd=async(e,t,n)=>{let{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:hd},c=await(i.isRTL==null?void 0:i.isRTL(t)),l=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:f}=gd(l,o,c),p=o,d=0,m={};for(let g=0;g<s.length;g++){let h=s[g];if(!h)continue;let{name:v,fn:S}=h,{x:w,y:x,data:y,reset:R}=await S({x:u,y:f,initialPlacement:o,placement:p,strategy:r,middlewareData:m,rects:l,platform:a,elements:{reference:e,floating:t}});u=w??u,f=x??f,m[v]={...m[v],...y},R&&d<ny&&(d++,typeof R=="object"&&(R.placement&&(p=R.placement),R.rects&&(l=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):R.rects),{x:u,y:f}=gd(l,p,c)),g=-1)}return{x:u,y:f,placement:p,strategy:r,middlewareData:m}};var xd=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;let{placement:r,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...h}=En(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};let v=Ct(r),S=Ft(a),w=Ct(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(l.floating)),y=p||(w||!g?[jr(a)]:Wf(a)),R=m!=="none";!p&&R&&y.push(...$f(a,g,m,x));let E=[a,...y],_=await c.detectOverflow(t,h),P=[],O=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&P.push(_[v]),f){let M=Bf(r,i,x);P.push(_[M[0]],_[M[1]])}if(O=[...O,{placement:r,overflows:P}],!P.every(M=>M<=0)){var T,D;let M=(((T=s.flip)==null?void 0:T.index)||0)+1,I=E[M];if(I&&(!(f==="alignment"?S!==Ft(I):!1)||O.every(N=>Ft(N.placement)===S?N.overflows[0]>0:!0)))return{data:{index:M,overflows:O},reset:{placement:I}};let A=(D=O.filter(L=>L.overflows[0]<=0).sort((L,N)=>L.overflows[1]-N.overflows[1])[0])==null?void 0:D.placement;if(!A)switch(d){case"bestFit":{var C;let L=(C=O.filter(N=>{if(R){let $=Ft(N.placement);return $===S||$==="y"}return!0}).map(N=>[N.placement,N.overflows.filter($=>$>0).reduce(($,k)=>$+k,0)]).sort((N,$)=>N[1]-$[1])[0])==null?void 0:C[0];L&&(A=L);break}case"initialPlacement":A=a;break}if(r!==A)return{reset:{placement:A}}}return{}}}};var Sd=new Set(["left","top"]);async function oy(e,t){let{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=Ct(n),a=rn(n),c=Ft(n)==="y",l=Sd.has(i)?-1:1,u=s&&c?-1:1,f=En(t,e),{mainAxis:p,crossAxis:d,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(d=a==="end"?m*-1:m),c?{x:d*u,y:p*l}:{x:p*l,y:d*u}}var yd=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;let{x:r,y:s,placement:i,middlewareData:a}=t,c=await oy(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:i}}}}},wd=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:S=>{let{x:w,y:x}=S;return{x:w,y:x}}},...l}=En(e,t),u={x:n,y:o},f=await s.detectOverflow(t,l),p=Ft(r),d=Qs(p),m=u[d],g=u[p],h=(S,w)=>Zs(w+f[S==="y"?"top":"left"],w,w-f[S==="y"?"bottom":"right"]);i&&(m=h(d,m)),a&&(g=h(p,g));let v=c.fn({...t,[d]:m,[p]:g});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[d]:i,[p]:a}}}}}},Rd=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,o;let{x:r,y:s,placement:i,rects:a,middlewareData:c}=t,{offset:l=0,mainAxis:u=!0,crossAxis:f=!0}=En(e,t),p={x:r,y:s},d=Ft(i),m=Qs(d),g=p[m],h=p[d],v=En(l,t),S=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(o=v.crossAxis)!=null?o:0};if(u){let y=m==="y"?"height":"width",R=a.reference[m]-a.floating[y]+S.mainAxis,E=a.reference[m]+a.reference[y]-S.mainAxis;g<R?g=R:g>E&&(g=E)}if(f){var w,x;let y=m==="y"?"width":"height",R=Sd.has(Ct(i)),E=a.reference[d]-a.floating[y]+(R&&((w=c.offset)==null?void 0:w[d])||0)+(R?0:S.crossAxis),_=a.reference[d]+a.reference[y]+(R?0:((x=c.offset)==null?void 0:x[d])||0)-(R?S.crossAxis:0);h<E?h=E:h>_&&(h=_)}return{[m]:g,[d]:h}}}},bd=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:n,rects:o,platform:r,elements:s}=t,{apply:i=()=>{},...a}=En(e,t),c=await r.detectOverflow(t,a),l=Ct(n),u=rn(n),f=Ft(n)==="y",{width:p,height:d}=o.floating,m,g;l==="top"||l==="bottom"?(m=l,g=u===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(g=l,m=u==="end"?"top":"bottom");let h=d-c.top-c.bottom,v=p-c.left-c.right,S=Gn(d-c[m],h),w=Gn(p-c[g],v),x=t.middlewareData.shift,y=!x,R=S,E=w;x!=null&&x.enabled.x&&(E=v),x!=null&&x.enabled.y&&(R=h),y&&!u&&(f?E=p-2*pn(c.left,c.right):R=d-2*pn(c.top,c.bottom)),await i({...t,availableWidth:E,availableHeight:R});let _=await r.getDimensions(s.floating);return p!==_.width||d!==_.height?{reset:{rects:!0}}:{}}}};function _d(e){let t=pt(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,r=Ie(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,a=Yn(n)!==s||Yn(o)!==i;return a&&(n=s,o=i),{width:n,height:o,$:a}}function Bc(e){return Pe(e)?e:e.contextElement}function ir(e){let t=Bc(e);if(!Ie(t))return bn(1);let n=t.getBoundingClientRect(),{width:o,height:r,$:s}=_d(t),i=(s?Yn(n.width):n.width)/o,a=(s?Yn(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}var ry=bn(0);function Pd(e){let t=Oe(e);return!Os()||!t.visualViewport?ry:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sy(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Oe(e)}function Vo(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);let r=e.getBoundingClientRect(),s=Bc(e),i=bn(1);t&&(o?Pe(o)&&(i=ir(o)):i=ir(e));let a=sy(s,n,o)?Pd(s):bn(0),c=(r.left+a.x)/i.x,l=(r.top+a.y)/i.y,u=r.width/i.x,f=r.height/i.y;if(s&&o){let p=Oe(s),d=Pe(o)?Oe(o):o,m=p,g=Ns(m);for(;g&&d!==m;){let h=ir(g),v=g.getBoundingClientRect(),S=pt(g),w=v.left+(g.clientLeft+parseFloat(S.paddingLeft))*h.x,x=v.top+(g.clientTop+parseFloat(S.paddingTop))*h.y;c*=h.x,l*=h.y,u*=h.x,f*=h.y,c+=w,l+=x,m=Oe(g),g=Ns(m)}}return An({width:u,height:f,x:c,y:l})}function ui(e,t){let n=Ir(e).scrollLeft;return t?t.left+n:Vo(yn(e)).left+n}function Td(e,t){let n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-ui(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function iy(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e,s=r==="fixed",i=yn(o),a=t?Tr(t.floating):!1;if(o===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=bn(1),u=bn(0),f=Ie(o);if((f||!s)&&((it(o)!=="body"||Ro(i))&&(c=Ir(o)),f)){let d=Vo(o);l=ir(o),u.x=d.x+o.clientLeft,u.y=d.y+o.clientTop}let p=i&&!f&&!s?Td(i,c):bn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+p.x,y:n.y*l.y-c.scrollTop*l.y+u.y+p.y}}function ay(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function cy(e){let t=Ir(e),n=e.ownerDocument.body,o=pn(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=pn(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),s=-t.scrollLeft+ui(e),i=-t.scrollTop;return pt(n).direction==="rtl"&&(s+=pn(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:s,y:i}}var ly=25;function uy(e,t,n){n===void 0&&(n="viewport");let o=n==="layoutViewport",r=Oe(e),s=yn(e),i=r.visualViewport,a=s.clientWidth,c=s.clientHeight,l=0,u=0;if(i){let p=!Os()||t==="fixed";o?p||(l=-i.offsetLeft,u=-i.offsetTop):(a=i.width,c=i.height,p&&(l=i.offsetLeft,u=i.offsetTop))}if(ui(s)<=0){let p=s.ownerDocument,d=p.body,m=getComputedStyle(d),g=p.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(s.clientWidth-d.clientWidth-g),v=getComputedStyle(s).scrollbarGutter==="stable both-edges"?h/2:h;v<=ly&&(a-=v)}return{width:a,height:c,x:l,y:u}}function fy(e,t){let n=Vo(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=ir(e),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=r*s.x,l=o*s.y;return{width:i,height:a,x:c,y:l}}function Ed(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=uy(e,n,t);else if(t==="document")o=cy(yn(e));else if(Pe(t))o=fy(t,n);else{let r=Pd(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return An(o)}function dy(e,t){let n=t.get(e);if(n)return n;let o=jn(e,[],!1).filter(a=>Pe(a)&&it(a)!=="body"),r=null,s=pt(e).position==="fixed",i=s?Sn(e):e;for(;Pe(i)&&!wn(i);){let a=pt(i),c=Is(i),l=r?r.position:s?"fixed":"";!c&&(l==="fixed"||l==="absolute"&&a.position==="static")?o=o.filter(f=>f!==i):r=a,i=Sn(i)}return t.set(e,o),o}function py(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e,i=[...n==="clippingAncestors"?Tr(t)?[]:dy(t,this._c):[].concat(n),o],a=Ed(t,i[0],r),c=a.top,l=a.right,u=a.bottom,f=a.left;for(let p=1;p<i.length;p++){let d=Ed(t,i[p],r);c=pn(d.top,c),l=Gn(d.right,l),u=Gn(d.bottom,u),f=pn(d.left,f)}return{width:l-f,height:u-c,x:f,y:c}}function my(e){let{width:t,height:n}=_d(e);return{width:t,height:n}}function gy(e,t,n){let o=Ie(t),r=yn(t),s=n==="fixed",i=Vo(e,!0,s,t),a={scrollLeft:0,scrollTop:0},c=bn(0);if((o||!s)&&((it(t)!=="body"||Ro(r))&&(a=Ir(t)),o)){let p=Vo(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}!o&&r&&(c.x=ui(r));let l=r&&!o&&!s?Td(r,a):bn(0),u=i.left+a.scrollLeft-c.x-l.x,f=i.top+a.scrollTop-c.y-l.y;return{x:u,y:f,width:i.width,height:i.height}}function Uc(e){return pt(e).position==="static"}function Cd(e,t){if(!Ie(e)||pt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return yn(e)===n&&(n=n.ownerDocument.body),n}function Id(e,t){let n=Oe(e);if(Tr(e))return n;if(!Ie(e)){let r=Sn(e);for(;r&&!wn(r);){if(Pe(r)&&!Uc(r))return r;r=Sn(r)}return n}let o=Cd(e,t);for(;o&&Uu(o)&&Uc(o);)o=Cd(o,t);return o&&wn(o)&&Uc(o)&&!Is(o)?n:o||Bu(e)||n}var hy=async function(e){let t=this.getOffsetParent||Id,n=this.getDimensions,o=await n(e.floating);return{reference:gy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function vy(e){return pt(e).direction==="rtl"}var es={convertOffsetParentRelativeRectToViewportRelativeRect:iy,getDocumentElement:yn,getClippingRect:py,getOffsetParent:Id,getElementRects:hy,getClientRects:ay,getDimensions:my,getScale:ir,isElement:Pe,isRTL:vy};function Od(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xy(e,t,n){let o=null,r,s=yn(e);function i(){var u;clearTimeout(r),(u=o)==null||u.disconnect(),o=null}function a(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),i();let p=e.getBoundingClientRect(),{left:d,top:m,width:g,height:h}=p;if(u||t(),!g||!h)return;let v=zr(m),S=zr(s.clientWidth-(d+g)),w=zr(s.clientHeight-(m+h)),x=zr(d),R={rootMargin:-v+"px "+-S+"px "+-w+"px "+-x+"px",threshold:pn(0,Gn(1,f))||1},E=!0;function _(P){let O=P[0].intersectionRatio;if(!Od(p,e.getBoundingClientRect()))return a();if(O!==f){if(!E)return a();O?a(!1,O):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{o=new IntersectionObserver(_,{...R,root:s.ownerDocument})}catch{o=new IntersectionObserver(_,R)}o.observe(e)}let c=Oe(e),l=()=>a(n);return c.addEventListener("resize",l),a(!0),()=>{c.removeEventListener("resize",l),i()}}function ts(e,t,n,o){o===void 0&&(o={});let{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,l=Bc(e),u=r||s?[...l?jn(l):[],...t?jn(t):[]]:[];u.forEach(v=>{r&&v.addEventListener("scroll",n),s&&v.addEventListener("resize",n)});let f=l&&a?xy(l,n,s):null,p=-1,d=null;i&&(d=new ResizeObserver(v=>{let[S]=v;S&&S.target===l&&d&&t&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=d)==null||w.observe(t)})),n()}),l&&!c&&d.observe(l),t&&d.observe(t));let m,g=c?Vo(e):null;c&&h();function h(){let v=Vo(e);g&&!Od(g,v)&&n(),g=v,m=requestAnimationFrame(h)}return n(),()=>{var v;u.forEach(S=>{r&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),f?.(),(v=d)==null||v.disconnect(),d=null,c&&cancelAnimationFrame(m)}}var Nd=yd;var Md=wd,kd=xd,Ad=bd;var Dd=Rd,fi=(e,t,n)=>{let o=new Map,r=n??{},s={...es,...r.platform,_c:o};return vd(e,t,{...r,platform:s})};var ct=b(H(),1),Vd=b(H(),1),Fd=b($n(),1),yy=typeof document<"u",wy=function(){},di=yy?Vd.useLayoutEffect:wy;function pi(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!pi(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){let s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!pi(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Hd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ld(e,t){let n=Hd(e);return Math.round(t*n)/n}function Wc(e){let t=ct.useRef(e);return di(()=>{t.current=e}),t}function Ud(e){e===void 0&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:l}=e,[u,f]=ct.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=ct.useState(o);pi(p,o)||d(o);let[m,g]=ct.useState(null),[h,v]=ct.useState(null),S=ct.useCallback(N=>{N!==R.current&&(R.current=N,g(N))},[]),w=ct.useCallback(N=>{N!==E.current&&(E.current=N,v(N))},[]),x=s||m,y=i||h,R=ct.useRef(null),E=ct.useRef(null),_=ct.useRef(u),P=c!=null,O=Wc(c),T=Wc(r),D=Wc(l),C=ct.useCallback(()=>{if(!R.current||!E.current)return;let N={placement:t,strategy:n,middleware:p};T.current&&(N.platform=T.current),fi(R.current,E.current,N).then($=>{let k={...$,isPositioned:D.current!==!1};M.current&&!pi(_.current,k)&&(_.current=k,Fd.flushSync(()=>{f(k)}))})},[p,t,n,T,D]);di(()=>{l===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,f(N=>({...N,isPositioned:!1})))},[l]);let M=ct.useRef(!1);di(()=>(M.current=!0,()=>{M.current=!1}),[]),di(()=>{if(x&&(R.current=x),y&&(E.current=y),x&&y){if(O.current)return O.current(x,y,C);C()}},[x,y,C,O,P]);let I=ct.useMemo(()=>({reference:R,floating:E,setReference:S,setFloating:w}),[S,w]),A=ct.useMemo(()=>({reference:x,floating:y}),[x,y]),L=ct.useMemo(()=>{let N={position:n,left:0,top:0};if(!A.floating)return N;let $=Ld(A.floating,u.x),k=Ld(A.floating,u.y);return a?{...N,transform:"translate("+$+"px, "+k+"px)",...Hd(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:k}},[n,a,A.floating,u.x,u.y]);return ct.useMemo(()=>({...u,update:C,refs:I,elements:A,floatingStyles:L}),[u,C,I,A,L])}var $c=(e,t)=>{let n=Nd(e);return{name:n.name,fn:n.fn,options:[e,t]}},jc=(e,t)=>{let n=Md(e);return{name:n.name,fn:n.fn,options:[e,t]}},zc=(e,t)=>({fn:Dd(e).fn,options:[e,t]}),qc=(e,t)=>{let n=kd(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kc=(e,t)=>{let n=Ad(e);return{name:n.name,fn:n.fn,options:[e,t]}};var mi=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(t,n,o=!0){this.fallbackStore=t,this.componentName=n,this.throwOnMissingTrigger=o}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){return this.attachedStores.push(t),this.setActiveStore(t),()=>{let n=this.attachedStores.lastIndexOf(t);n!==-1&&this.attachedStores.splice(n,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(n=>{n()}))}openByTrigger(t){let n=this.attachedStore;if(n===null)return;let o;if(t){for(let r=this.attachedStores.length-1;r>=0&&!o;r-=1)o=this.attachedStores[r].context.triggerElements.getById(t);o??=this.fallbackStore.context.triggerElements.getById(t)}if(t&&!o&&this.throwOnMissingTrigger)throw new Error(Ae(99,this.componentName,t,this.componentName));n.setOpen(!0,me(te.imperativeAction,void 0,o))}closePopup(){let t=this.attachedStore;t!==null&&t.setOpen(!1,me(te.imperativeAction))}};var Jc=b(H(),1),Ey=b($n(),1);var Bd=b(H(),1);var Ry={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},Cn=class extends Rn{constructor(t){let{syncOnly:n,nested:o,onOpenChange:r,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:ci(),nested:o,triggerElements:s},Ry),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&Df(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);let o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}};function Wd(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:o,floatingId:r,nested:s,onOpenChange:i}=e,a=t.useState("open"),c=t.useState("activeTriggerElement"),l=t.useState(n?"popupElement":"positionerElement"),u=t.context.triggerElements,f=i,p=Bd.useRef(null);o===void 0&&p.current===null&&(p.current=new Cn({open:a,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:f,floatingId:r,syncOnly:!0,nested:s}));let d=o??p.current;return t.useSyncedValue("floatingId",r),U(()=>{let m={open:a,floatingId:r,referenceElement:c,floatingElement:l};Pe(c)&&(m.domReferenceElement=c),d.state.positionReference===d.state.referenceElement&&(m.positionReference=c),d.update(m)},[a,r,c,l,d]),d.context.onOpenChange=f,d.context.nested=s,d}var Gc=b(H(),1);function cn(e,t=!1,n=!1,o=!1){let[r,s]=Gc.useState(e&&t?"idle":void 0),[i,a]=Gc.useState(e&&!o);return e&&!i&&(a(!0),s("starting")),!e&&i&&r!=="ending"&&!n&&s("ending"),!e&&!i&&r==="ending"&&s(void 0),U(()=>{if(!e&&i&&r!=="ending"&&n){let c=tn.request(()=>{s("ending")});return()=>{tn.cancel(c)}}},[e,i,r,n]),U(()=>{if(!e||t)return;let c=tn.request(()=>{s(void 0)});return()=>{tn.cancel(c)}},[t,e]),U(()=>{if(!e||!t)return;e&&i&&r!=="idle"&&s("starting");let c=tn.request(()=>{s("idle")});return()=>{tn.cancel(c)}},[t,e,i,r]),{mounted:i,setMounted:a,transitionStatus:r}}var $d=b(H(),1);var Yc=b($n(),1);var gi=null;function by(e){if(!gi){let t=[];gi=t,queueMicrotask(()=>{gi=null,Yc.flushSync(()=>{for(let n of t)n()})})}gi.push(e)}function hi(e,t=!1,n=!1){let o=Nt();return z((r,s=null)=>{o.cancel();let i=mn(e);if(i==null)return;let a=i,c=()=>{if(!n){Yc.flushSync(r);return}by(()=>{s?.aborted||r()})};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function l(){Promise.all(a.getAnimations().map(u=>u.finished)).then(()=>{s?.aborted||c()},()=>{if(s?.aborted)return;if(a.getAnimations().some(f=>f.pending||f.playState!=="finished")){l();return}c()})}if(t){let u=Po;if(!a.hasAttribute(u)){o.request(l);return}let f=new MutationObserver(()=>{a.hasAttribute(u)||(f.disconnect(),l())});f.observe(a,{attributes:!0,attributeFilter:[u]}),s?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}o.request(l)})}function yt(e){let{enabled:t=!0,open:n,ref:o,batch:r=!1,onComplete:s}=e,i=z(s),a=hi(o,n,r);$d.useEffect(()=>{if(!t)return;let c=new AbortController;return a(i,c.signal),()=>{c.abort()}},[t,n,i,a])}var vi={tabIndex:-1,[Lr]:""};function zd(e){return t=>t==="touch"?e.current:!0}function qd(e,t=!1){let n=an(),o=Kt()!=null,r=He(()=>e(n,o)).current;return Wd({popupStore:r,treatPopupAsFloatingElement:t,floatingRootContext:r.state.floatingRootContext,floatingId:n,nested:o,onOpenChange:r.setOpen}),r}function Kd({handle:e,store:t}){return U(()=>e.attachStore(t),[e,t]),null}function jd(e){let t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function Cy(e,t){let n=Jc.useRef(null);return z(o=>{let r=n.current;if(r!==null){if(r.element===o&&r.store===t&&r.id===e)return;n.current=null;let s=r.store;s.context.triggerElements.getById(r.id)===r.element&&(s.context.triggerElements.delete(r.id),jd(s))}o!==null&&e!==void 0&&(n.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),jd(t))})}function Gd(e,t,n,o=!1){let r=e.preventUnmountingOnClose;t?r=!1:o&&(r=!0);let s=n?.id??null,i=e.activeTriggerId,a=e.activeTriggerElement;return(s||t)&&(i=s,a=n??null),{open:t,preventUnmountingOnClose:r,activeTriggerId:i,activeTriggerElement:a}}function Yd(e,t,n,o){let r=n.useState("isMountedByTrigger",e),s=Cy(e,n),i=z(c=>{let l=n.select("open"),u=n.select("activeTriggerId");if(u===e){let f={activeTriggerElement:c,...l?o:null};n.update(f);return}if(u==null&&l){let f={activeTriggerId:e??null,activeTriggerElement:c,...o};n.update(f)}}),a=z(c=>{s(c),c&&i(c)});return U(()=>(a(t.current),()=>a(null)),[a,t,n,e]),U(()=>{if(r){let c={activeTriggerElement:t.current,...o};n.update(c)}},[r,n,t,...Object.values(o)]),{registerTrigger:a,isMountedByThisTrigger:r}}function Jd(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,o=Jc.useRef(null),r=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),a=e.useState("activeTriggerElement");U(()=>{if(!r){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}let c=e.context.triggerElements.size,l={};e.state.triggerCount!==c&&(l.triggerCount=c);let u=e.select("activeTriggerId"),f=null;if(u){let p=e.context.triggerElements.getById(u);if(p)o.current=u,p!==e.state.activeTriggerElement&&(l.activeTriggerElement=p);else{for(let[d,m]of e.context.triggerElements.entries())if(m===e.state.activeTriggerElement){l.activeTriggerId=d,l.activeTriggerElement=m,o.current=d;break}l.activeTriggerId===void 0&&(o.current===u?f=u:o.current=null)}}else o.current=null;if(!f&&!u&&c===1){let p=e.context.triggerElements.entries().next();if(!p.done){let[d,m]=p.value;l.activeTriggerId=d,l.activeTriggerElement=m,o.current=d}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0||l.activeTriggerElement!==void 0)&&e.update(l),f&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===f&&!e.context.triggerElements.getById(f)){let p=me(te.none);e.setOpen(!1,p),p.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,i,a,n])}function Xd(e,t,n,o){let{mounted:r,setMounted:s,transitionStatus:i}=cn(e,!1,!1,o),a=t.useState("preventUnmountingOnClose"),c=e?!1:a;t.useSyncedValues({mounted:r,transitionStatus:i,preventUnmountingOnClose:c});let l=z(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return yt({enabled:r&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:i}}function Zd(e,t){e.useSyncedValues(t),U(()=>()=>{e.update({activeTriggerProps:Ne,inactiveTriggerProps:Ne,popupProps:Ne})},[e])}function Qd(e,t){U(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),U(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}var Ln=class{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(let n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(let n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function tp(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Cn({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Ne,inactiveTriggerProps:Ne,popupProps:Ne}}var ns=e=>e.triggerIdProp??e.activeTriggerId,Xc=e=>e.openProp??e.open,ep=e=>(e.popupElement?.id??e.floatingId)||void 0;function np(e,t){return t!==void 0&&Xc(e)&&ns(e)===t}function _y(e,t){return np(e,t)?!0:t!==void 0&&Xc(e)&&ns(e)==null&&e.triggerCount===1}var op={open:Xc,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:ns,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:ep,isTriggerActive:(e,t)=>t!==void 0&&ns(e)===t,isOpenedByTrigger:(e,t)=>np(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&ns(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>_y(e,t)?ep(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};var Zc=b(H(),1),rp=b(Hs(),1);function sp(e){let t=Zc.useCallback(o=>e===void 0?Le:e.subscribeStore(o),[e]),n=Zc.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,rp.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Fo(e){let{open:t=!1,onOpenChange:n,elements:o={}}=e,r=an(),s=Kt()!=null,i=He(()=>new Cn({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Ln,floatingId:r,syncOnly:!1,nested:s})).current;return U(()=>{let a={open:t,floatingId:r};o.reference!==void 0&&(a.referenceElement=o.reference,a.domReferenceElement=Pe(o.reference)?o.reference:null),o.floating!==void 0&&(a.floatingElement=o.floating),i.update(a)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function ip(e={}){let t=Fo(e),n=e.rootContext||t;return cp(e,n)}function ap(e){return cp(e,e.rootContext)}function cp(e,t){let{nodeId:n,externalTree:o}=e,r=t.useState("referenceElement"),s=t.useState("floatingElement"),i=t.useState("domReferenceElement"),a=t.useState("open"),c=t.useState("floatingId"),[l,u]=Pt.useState(null),[f,p]=Pt.useState(void 0),[d,m]=Pt.useState(void 0),g=Pt.useRef(null),h=gt(o),v=Pt.useMemo(()=>({reference:r,floating:s,domReference:i}),[r,s,i]),S=Ud({...e,elements:{...v,...l&&{reference:l}}}),w=Pe(f)?f:null,x=d===void 0?t.state.floatingElement:d;t.useSyncedValue("referenceElement",f??null),t.useSyncedValue("domReferenceElement",f===void 0?i:w),t.useSyncedValue("floatingElement",x);let y=Pt.useCallback(T=>{let D=Pe(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;u(D),S.refs.setReference(D)},[S.refs]),R=Pt.useCallback(T=>{(Pe(T)||T===null)&&(g.current=T,p(T)),(Pe(S.refs.reference.current)||S.refs.reference.current===null||T!==null&&!Pe(T))&&S.refs.setReference(T)},[S.refs,p]),E=Pt.useCallback(T=>{m(T),S.refs.setFloating(T)},[S.refs]),_=Pt.useMemo(()=>({...S.refs,setReference:R,setFloating:E,setPositionReference:y,domReference:g}),[S.refs,R,E,y]),P=Pt.useMemo(()=>({...S.elements,domReference:i}),[S.elements,i]),O=Pt.useMemo(()=>({...S,dataRef:t.context.dataRef,open:a,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:_,elements:P,nodeId:n,rootStore:t}),[S,_,P,n,t,a,c]);return U(()=>{i&&(g.current=i)},[i]),U(()=>{t.context.dataRef.current.floatingContext=O;let T=h?.nodesRef.current.find(D=>D.id===n);T&&(T.context=O)}),Pt.useMemo(()=>({...S,context:O,refs:_,elements:P,rootStore:t}),[S,_,P,O,t])}var el=b(H(),1);var Qc=class e{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 Lt,this.restTimeout=new Lt,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},xi=new WeakMap;function _n(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&xi.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),xi.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function ar(e,t){let{scopeElement:n,referenceElement:o,floatingElement:r}=t,s=xi.get(n);s&&s!==e&&_n(s),_n(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=r,xi.set(n,e),n.style.pointerEvents="none",o.style.pointerEvents="auto",r.style.pointerEvents="auto"}function cr(e){let t=e.context.dataRef.current,n=He(()=>t.hoverInteractionState??Qc.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),Qo(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function tl(e,t={}){let{enabled:n=!0,closeDelay:o=0,nodeId:r}=t,s="rootStore"in e?e.rootStore:e,i=s.useState("open"),a=s.useState("floatingElement"),c=s.useState("domReferenceElement"),{dataRef:l}=s.context,u=gt(),f=Kt(),p=cr(s),d=et(),m=z(()=>Ys(l.current.openEvent?.type,p.interactedInside)),g=z(()=>Vf(l.current.openEvent?.type)),h=z(()=>{_n(p)});U(()=>{i||(p.pointerType=void 0,p.restTimeoutPending=!1,p.interactedInside=!1,h())},[i,p,h]),el.useEffect(()=>h,[h]),U(()=>{if(n&&i&&p.handleCloseOptions?.blockPointerEvents&&g()&&Pe(c)&&a){let v=c,S=a,w=ve(a),x=u?.nodesRef.current.find(_=>_.id===f)?.context?.elements.floating;x&&(x.style.pointerEvents="");let y=p.pointerEventsScopeElement!==S?p.pointerEventsScopeElement:null,R=x!==S?x:null,E=p.handleCloseOptions?.getScope?.()??y??R??v.closest("[data-rootownerid]")??w.body;return ar(p,{scopeElement:E,referenceElement:v,floatingElement:S}),()=>{h()}}},[n,i,c,a,p,g,u,f,h]),el.useEffect(()=>{if(!n)return;function v(){return!!(u&&f&&Ht(u.nodesRef.current,f).length>0)}function S(_){let P=$r(o,"close",p.pointerType),O=()=>{s.setOpen(!1,me(te.triggerHover,_)),u?.events.emit("floating.closed",_)};P?p.openChangeTimeout.start(P,O):(p.openChangeTimeout.clear(),O())}function w(_){let P=Ve(_);if(!Ec(P)){p.interactedInside=!1;return}p.interactedInside=P?.closest("[aria-haspopup]")!=null}function x(){p.openChangeTimeout.clear(),d.clear(),u?.events.off("floating.closed",R),h()}function y(_){if(v()&&u){u.events.on("floating.closed",R);return}if(Ur(_.relatedTarget,s.context.triggerElements))return;let P=l.current.floatingContext?.nodeId??r,O=_.relatedTarget;if(!(u&&P&&Pe(O)&&Ht(u.nodesRef.current,P,!1).some(D=>Q(D.context?.elements.floating,O)))){if(p.handler){p.handler(_);return}h(),g()&&!m()&&S(_)}}function R(_){!u||!f||v()||d.start(0,()=>{u.events.off("floating.closed",R),s.setOpen(!1,me(te.triggerHover,_)),u.events.emit("floating.closed",_)})}let E=a;return bt(E&&xe(E,"mouseenter",x),E&&xe(E,"mouseleave",y),E&&xe(E,"pointerdown",w,!0),()=>{u?.events.off("floating.closed",R)})},[n,a,s,l,o,r,g,m,h,p,u,f,d])}var to=b(H(),1),lp=b($n(),1);var Py={current:null};function nl(e,t={}){let{enabled:n=!0,delay:o=0,handleClose:r=null,mouseOnly:s=!1,restMs:i=0,move:a=!0,triggerElementRef:c=Py,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:d,guardStaleOpen:m=!1}=t,g="rootStore"in e?e.rootStore:e,{dataRef:h,events:v}=g.context,S=gt(l),w=cr(g),x=to.useRef(!1),y=Ue(r),R=Ue(o),E=Ue(i),_=Ue(n),P=Ue(d),O=Ue(p),T=z(()=>Ys(h.current.openEvent?.type,w.interactedInside)),D=z(()=>P.current?.()!==!1),C=z((A,L,N)=>{let $=g.context.triggerElements;if($.hasElement(L))return!A||!Q(A,L);if(!Pe(N))return!1;let k=N;return $.hasMatchingElement(q=>Q(q,k))&&(!A||!Q(A,k))}),M=z(()=>{if(!w.handler)return;ve(g.select("domReferenceElement")).removeEventListener("mousemove",w.handler),w.handler=void 0}),I=z(()=>{_n(w)});return u&&(w.handleCloseOptions=r?.__options),to.useEffect(()=>M,[M]),to.useEffect(()=>{if(!n)return;function A(L){L.open?x.current=!1:(x.current=L.reason===te.triggerHover,M(),w.openChangeTimeout.clear(),w.restTimeout.clear(),w.blockMouseMove=!0,w.restTimeoutPending=!1)}return v.on("openchange",A),()=>{v.off("openchange",A)}},[n,v,w,M]),to.useEffect(()=>{if(!n)return;function A(B,j=!0){let V=$r(R.current,"close",w.pointerType);V?w.openChangeTimeout.start(V,()=>{g.setOpen(!1,me(te.triggerHover,B)),S?.events.emit("floating.closed",B)}):j&&(w.openChangeTimeout.clear(),g.setOpen(!1,me(te.triggerHover,B)),S?.events.emit("floating.closed",B))}let L=c.current??(u?g.select("domReferenceElement"):null);if(!Pe(L))return;function N(B){if(w.openChangeTimeout.clear(),w.blockMouseMove=!1,s&&!kn(w.pointerType))return;let j=Cc(E.current),V=$r(R.current,"open",w.pointerType),X=Ve(B),Y=B.currentTarget??null,ge=g.select("domReferenceElement"),Z=Y;if(Pe(X)&&!g.context.triggerElements.hasElement(X)){for(let oe of g.context.triggerElements.elements())if(Q(oe,X)){Z=oe;break}}Pe(Y)&&Pe(ge)&&!g.context.triggerElements.hasElement(Y)&&Q(Y,ge)&&(Z=ge);let de=Z==null?!1:C(ge,Z,X),ce=g.select("open"),le=O.current?.()??g.select("transitionStatus")==="ending",W=!ce&&le&&x.current,se=!de&&Pe(Z)&&Pe(ge)&&Q(ge,Z)&&W,ue=j>0&&!V,he=de&&(ce||W)||se,De=!ce||de;if(he){D()&&g.setOpen(!0,me(te.triggerHover,B,Z));return}ue||(V?w.openChangeTimeout.start(V,()=>{De&&D()&&g.setOpen(!0,me(te.triggerHover,B,Z))}):De&&D()&&g.setOpen(!0,me(te.triggerHover,B,Z)))}function $(B){if(T()){I();return}M();let j=g.select("domReferenceElement"),V=ve(j);w.restTimeout.clear(),w.restTimeoutPending=!1;let X=h.current.floatingContext??f?.();if(Ur(B.relatedTarget,g.context.triggerElements))return;if(y.current&&X){g.select("open")||w.openChangeTimeout.clear();let ge=c.current;w.handler=y.current({...X,tree:S,x:B.clientX,y:B.clientY,onClose(){I(),M(),_.current&&!T()&&ge===g.select("domReferenceElement")&&A(B,!0)}}),V.addEventListener("mousemove",w.handler),w.handler(B);return}(w.pointerType!=="touch"||!Q(g.select("floatingElement"),B.relatedTarget))&&A(B)}function k(B){Q(L,B.relatedTarget)||(w.openChangeTimeout.clear(),w.restTimeout.clear(),w.restTimeoutPending=!1)}let q=m?xe(L,"mouseout",k):void 0;return a?bt(xe(L,"mousemove",N,{once:!0}),xe(L,"mouseenter",N),xe(L,"mouseleave",$),q):bt(xe(L,"mouseenter",N),xe(L,"mouseleave",$),q)},[M,I,h,R,g,n,y,w,u,C,T,s,a,E,c,S,_,f,O,D,m]),to.useMemo(()=>{if(!n)return;function A(L){w.pointerType=L.pointerType}return{onPointerDown:A,onPointerEnter:A,onMouseMove(L){let{nativeEvent:N}=L,$=L.currentTarget,k=g.select("domReferenceElement"),q=g.select("open"),B=C(k,$,L.target);if(s&&!kn(w.pointerType))return;if(q&&B&&w.handleCloseOptions?.blockPointerEvents){let X=g.select("floatingElement");if(X){let Y=w.handleCloseOptions?.getScope?.()??$.ownerDocument.body;ar(w,{scopeElement:Y,referenceElement:$,floatingElement:X})}}let j=Cc(E.current);if(q&&!B||j===0||!B&&w.restTimeoutPending&&L.movementX**2+L.movementY**2<2)return;w.restTimeout.clear();function V(){if(w.restTimeoutPending=!1,T())return;let X=g.select("open");!w.blockMouseMove&&(!X||B)&&D()&&g.setOpen(!0,me(te.triggerHover,N,$))}w.pointerType==="touch"?lp.flushSync(()=>{V()}):B&&q?V():(w.restTimeoutPending=!0,w.restTimeout.start(j,V))}}},[n,w,T,C,s,g,E,D])}var wt=b(H(),1);var Ty="Escape";function up(e){return Ge.engine.webkit&&e.movementX===0&&e.movementY===0}function yi(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Si(e,t){return yi(t,e===xc||e===zs,e===Vr||e===Fr)}function ol(e,t,n){return yi(t,e===zs,n?e===Vr:e===Fr)||e==="Enter"||e===" "||e===""}function Iy(e,t,n){return yi(t,n?e===Vr:e===Fr,e===zs)}function Oy(e,t,n,o){let r=n?e===Fr:e===Vr,s=e===xc;return t==="both"||t==="horizontal"&&o?e===Ty:yi(t,r,s)}function rl(e,t){let{listRef:n,activeIndex:o,onNavigate:r=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:a=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:f=!1,focusItemOnOpen:p="auto",focusItemOnHover:d=!0,openOnArrowKeyDown:m=!0,disabledIndices:g=void 0,orientation:h="vertical",parentOrientation:v,id:S,resetOnPointerLeave:w=!0,externalTree:x,grid:y}=t,R=y!=null,E="rootStore"in e?e.rootStore:e,_=E.useState("open"),P=E.useState("floatingElement"),O=E.useState("domReferenceElement"),T=E.context.dataRef,D=Io(P),C=Wr(O),M=Ue(D),I=Kt(),A=gt(x),L=wt.useRef(p),N=wt.useRef(i??-1),$=wt.useRef(null),k=wt.useRef(!0),q=z(G=>{r(N.current===-1?null:N.current,G)}),B=wt.useRef(!!P),j=wt.useRef(_),V=wt.useRef(!1),X=wt.useRef(!1),Y=wt.useRef(null),ge=Ue(g),Z=Ue(_),de=Ue(i),ce=Ue(w),le=Nt(),W=Nt(),se=z(()=>{function G(fe){f?A?.events.emit("virtualfocus",fe):Y.current=sr(fe,{sync:V.current,preventScroll:!0})}let ee=n.current[N.current],K=X.current;ee&&G(ee),(V.current?fe=>fe():fe=>le.request(fe))(()=>{let fe=n.current[N.current]||ee;if(!fe)return;ee||G(fe),re&&(K||!k.current)&&fe.scrollIntoView?.({block:"nearest",inline:"nearest"})})});U(()=>{T.current.orientation=h},[T,h]),U(()=>{s&&(_&&P?(N.current=i??-1,L.current&&i!=null&&(X.current=!0,q())):B.current&&(N.current=-1,q()))},[s,_,P,i,q]),U(()=>{if(s){if(!_){V.current=!1;return}if(P)if(o==null){if(V.current=!1,de.current!=null)return;if(B.current&&(N.current=-1,se()),(!j.current||!B.current)&&L.current&&($.current!=null||L.current===!0&&$.current==null)){let G=0,ee=()=>{n.current[0]==null?(G<2&&(G?F=>W.request(F):queueMicrotask)(ee),G+=1):(N.current=$.current==null||ol($.current,h,u)||l?Oo(n):or(n),$.current=null,q())};ee()}}else Jn(n.current,o)||(N.current=o,se(),X.current=!1)}},[s,_,P,o,de,l,n,h,u,q,se,W]),U(()=>{if(!s||P||!A||f||!B.current)return;let G=A.nodesRef.current,ee=G.find(fe=>fe.id===I)?.context?.elements.floating,K=mt(ve(O??ee??null)),F=G.some(fe=>fe.context&&Q(fe.context.elements.floating,K));ee&&!F&&k.current&&ee.focus({preventScroll:!0})},[s,P,O,A,I,f]),U(()=>{j.current=_,B.current=!!P}),U(()=>{_||($.current=null,L.current=p)},[_,p]);let ue=o!=null,he=z(G=>{if(!Z.current)return;let ee=n.current.indexOf(G.currentTarget);ee!==-1&&(N.current!==ee||o!==ee)&&(N.current=ee,q(G))}),De=z(()=>v??A?.nodesRef.current.find(G=>G.id===I)?.context?.dataRef?.current.orientation),oe=z(()=>Oo(n,ge.current)),we=z(G=>{if(k.current=!1,V.current=!0,G.which===229||!Z.current&&G.currentTarget===M.current)return;if(l&&Oy(G.key,h,u,R)){Si(G.key,De())||Et(G),E.setOpen(!1,me(te.listNavigation,G.nativeEvent)),Ie(O)&&(f?A?.events.emit("virtualfocus",O):O.focus());return}let ee=N.current,K=Oo(n,g),F=or(n,g);if(C||(G.key==="Home"&&(Et(G),N.current=K,q(G)),G.key==="End"&&(Et(G),N.current=F,q(G))),y!=null){let fe=y(G,N.current,n,h,c,u,g,K,F);if(fe!=null&&(N.current=fe,q(G)),h==="both")return}if(Si(G.key,h)){if(Et(G),_&&!f&&mt(G.currentTarget.ownerDocument)===G.currentTarget){N.current=ol(G.key,h,u)?K:F,q(G);return}ol(G.key,h,u)?c?ee>=F?a&&ee!==n.current.length?N.current=-1:(V.current=!1,N.current=K):N.current=sn(n.current,{startingIndex:ee,disabledIndices:g}):N.current=Math.min(F,sn(n.current,{startingIndex:ee,disabledIndices:g})):c?ee<=K?a&&ee!==-1?N.current=n.current.length:(V.current=!1,N.current=F):N.current=sn(n.current,{startingIndex:ee,decrement:!0,disabledIndices:g}):N.current=Math.max(K,sn(n.current,{startingIndex:ee,decrement:!0,disabledIndices:g})),Jn(n.current,N.current)&&(N.current=-1),q(G)}}),re=wt.useMemo(()=>({onFocus(ee){V.current=!0,he(ee)},onClick:({currentTarget:ee})=>ee.focus({preventScroll:!0}),onMouseMove(ee){up(ee)||(V.current=!0,X.current=!1,d&&he(ee))},onPointerLeave(ee){if(!Z.current||!k.current||ee.pointerType==="touch")return;V.current=!0;let K=ee.relatedTarget;if(!(!d||n.current.includes(K))&&ce.current&&(Y.current?.(),Y.current=null,N.current=-1,q(ee),!f)){let F=M.current,fe=mt(ve(F));F&&Q(F,fe)&&F.focus({preventScroll:!0})}}}),[he,Z,M,d,n,q,ce,f]),Ce=wt.useMemo(()=>f&&_&&ue&&{"aria-activedescendant":`${S}-${o}`},[f,_,ue,S,o]),be=wt.useMemo(()=>({...C?{}:Ce,onKeyDown(G){if(G.key==="Tab"&&G.shiftKey&&_&&!f){let ee=Ve(G.nativeEvent);if(ee&&!Q(M.current,ee))return;Et(G),E.setOpen(!1,me(te.focusOut,G.nativeEvent)),Ie(O)&&O.focus();return}we(G)},onPointerMove(G){up(G)||(k.current=!0)}}),[Ce,we,M,C,E,_,f,O]),_e=wt.useMemo(()=>{function G(F){E.setOpen(!0,me(te.listNavigation,F.nativeEvent,F.currentTarget))}function ee(F){p==="auto"&&qn(F.nativeEvent)&&(L.current=!f)}function K(F){L.current=p,p==="auto"&&er(F.nativeEvent)&&(L.current=!0)}return{onKeyDown(F){let fe=E.select("open");k.current=!1;let Me=F.key.startsWith("Arrow"),Ke=Iy(F.key,De(),u),$e=Si(F.key,h),Ze=(l?Ke:$e)||F.key==="Enter"||F.key.trim()==="";if(f&&fe)return we(F);if(!(!fe&&!m&&Me)){if(Ze){let Qe=Si(F.key,De());$.current=l&&Qe?null:F.key}if(l){Ke&&(Et(F),fe?(N.current=oe(),q(F)):G(F));return}$e&&(de.current!=null&&(N.current=de.current),Et(F),!fe&&m?G(F):we(F),fe&&q(F))}},onFocus(F){E.select("open")&&!f&&(N.current=-1,q(F))},onPointerDown:K,onPointerEnter:K,onMouseDown:ee,onClick:ee}},[we,p,oe,l,q,E,m,h,De,u,de,f]),We=wt.useMemo(()=>({...Ce,..._e}),[Ce,_e]);return wt.useMemo(()=>s?{reference:We,floating:be,item:re,trigger:_e}:{},[s,We,be,_e,re])}var Ho=b(H(),1);function sl(e,t){let{listRef:n,elementsRef:o,activeIndex:r,onMatch:s,disabledIndices:i,onTyping:a,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,f="rootStore"in e?e.rootStore:e,p=f.useState("open"),d=et(),m=Ho.useRef(""),g=Ho.useRef(u??r??-1),h=Ho.useRef(null),v=z(x=>{function y(M){return o?.current[M]}function R(M){let I=y(M);return I&&!No(I)||I?.matches(":disabled")?!1:i==null||!Dn(St,M,i)}function E(M,I,A=0){if(M.length===0)return-1;let L=(A%M.length+M.length)%M.length,N=I.toLowerCase();for(let $=0;$<M.length;$+=1){let k=(L+$)%M.length;if(!(!M[k]?.toLowerCase().startsWith(N)||!R(k)))return k}return-1}let _=n.current;if(m.current.length>0&&x.key===" "&&(Et(x),a?.(!0)),m.current.length>0&&m.current[0]!==" "&&E(_,m.current)===-1&&x.key!==" "&&a?.(!1),_==null||x.key.length!==1||x.ctrlKey||x.metaKey||x.altKey)return;p&&x.key!==" "&&(Et(x),a?.(!0));let P=m.current==="";P&&(g.current=u??r??-1),_.every((M,I)=>M&&R(I)?M[0]?.toLowerCase()!==M[1]?.toLowerCase():!0)&&m.current===x.key&&(m.current="",g.current=h.current),m.current+=x.key,d.start(l,()=>{m.current="",g.current=h.current,a?.(!1)});let D=((P?u??r??-1:g.current)??0)+1,C=E(_,m.current,D);C!==-1?(s?.(C),h.current=C):x.key!==" "&&(m.current="",a?.(!1))}),S=z(x=>{let y=x.relatedTarget,R=f.select("domReferenceElement"),E=f.select("floatingElement");Q(R,y)||Q(E,y)||(d.clear(),m.current="",g.current=h.current,a?.(!1))});U(()=>{!p&&u!==null||(d.clear(),h.current=null,m.current!==""&&(m.current=""))},[p,u,d]);let w=Ho.useMemo(()=>({onKeyDown:v,onBlur:S}),[v,S]);return Ho.useMemo(()=>c?{reference:w,floating:w}:{},[c,w])}var fp=.1,Ny=fp*fp,Be=.5;function wi(e,t,n,o,r,s){return o>=t!=s>=t&&e<=(r-n)*(t-o)/(s-o)+n}function Ri(e,t,n,o,r,s,i,a,c,l){let u=!1;return wi(e,t,n,o,r,s)&&(u=!u),wi(e,t,r,s,i,a)&&(u=!u),wi(e,t,i,a,c,l)&&(u=!u),wi(e,t,c,l,n,o)&&(u=!u),u}function My(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function bi(e,t,n,o,r,s){let i=Math.min(n,r),a=Math.max(n,r),c=Math.min(o,s),l=Math.max(o,s);return e>=i&&e<=a&&t>=c&&t<=l}function il(e={}){let{blockPointerEvents:t=!1}=e,n=new Lt,o=({x:r,y:s,placement:i,elements:a,onClose:c,nodeId:l,tree:u})=>{let f=i?.split("-")[0],p=!1,d=null,m=null,g=typeof performance<"u"?performance.now():0;function h(S,w){let x=performance.now(),y=x-g;if(d===null||m===null||y===0)return d=S,m=w,g=x,!1;let R=S-d,E=w-m,_=R*R+E*E,P=y*y*Ny;return d=S,m=w,g=x,_<P}function v(){n.clear(),c()}return function(w){n.clear();let x=a.domReference,y=a.floating;if(!x||!y||f==null||r==null||s==null)return;let{clientX:R,clientY:E}=w,_=Ve(w),P=w.type==="mouseleave",O=Q(y,_),T=Q(x,_);if(O&&(p=!0,!P))return;if(T&&(p=!1,!P)){p=!0;return}if(P&&Pe(w.relatedTarget)&&Q(y,w.relatedTarget))return;function D(){return!!(u&&Ht(u.nodesRef.current,l).length>0)}function C(){D()||v()}if(D())return;let M=x.getBoundingClientRect(),I=y.getBoundingClientRect(),A=r>I.right-I.width/2,L=s>I.bottom-I.height/2,N=I.width>M.width,$=I.height>M.height,k=(N?M:I).left,q=(N?M:I).right,B=($?M:I).top,j=($?M:I).bottom;if(f==="top"&&s>=M.bottom-1||f==="bottom"&&s<=M.top+1||f==="left"&&r>=M.right-1||f==="right"&&r<=M.left+1){C();return}let V=!1;switch(f){case"top":V=bi(R,E,k,M.top+1,q,I.bottom-1);break;case"bottom":V=bi(R,E,k,I.top+1,q,M.bottom-1);break;case"left":V=bi(R,E,I.right-1,j,M.left+1,B);break;case"right":V=bi(R,E,M.right-1,j,I.left+1,B);break;default:}if(V)return;if(p&&!My(R,E,M)){C();return}if(!P&&h(R,E)){C();return}let X=!1;switch(f){case"top":{let Y=N?Be/2:Be*4,ge=N||A?r+Y:r-Y,Z=N?r-Y:A?r+Y:r-Y,de=s+Be+1,ce=A||N?I.bottom-Be:I.top,le=A?N?I.bottom-Be:I.top:I.bottom-Be;X=Ri(R,E,ge,de,Z,de,I.left,ce,I.right,le);break}case"bottom":{let Y=N?Be/2:Be*4,ge=N||A?r+Y:r-Y,Z=N?r-Y:A?r+Y:r-Y,de=s-Be,ce=A||N?I.top+Be:I.bottom,le=A?N?I.top+Be:I.bottom:I.top+Be;X=Ri(R,E,ge,de,Z,de,I.left,ce,I.right,le);break}case"left":{let Y=$?Be/2:Be*4,ge=$||L?s+Y:s-Y,Z=$?s-Y:L?s+Y:s-Y,de=r+Be+1,ce=L||$?I.right-Be:I.left,le=L?$?I.right-Be:I.left:I.right-Be;X=Ri(R,E,ce,I.top,le,I.bottom,de,ge,de,Z);break}case"right":{let Y=$?Be/2:Be*4,ge=$||L?s+Y:s-Y,Z=$?s-Y:L?s+Y:s-Y,de=r-Be,ce=L||$?I.left+Be:I.right,le=L?$?I.left+Be:I.right:I.left+Be;X=Ri(R,E,de,ge,de,Z,ce,I.top,le,I.bottom);break}default:}X?p||n.start(40,C):C()}};return o.__options={...e,blockPointerEvents:t},o}var no=b(H(),1),al=no.createContext(void 0),cl=no.createContext(void 0),ll=no.createContext(void 0);function je(){let e=no.useContext(al);if(e===void 0)throw new Error(Ae(60));return e}function oo(){let e=no.useContext(cl);if(e===void 0)throw new Error(Ae(101));return e}function Ei(){let e=no.useContext(ll);if(e===void 0)throw new Error(Ae(61));return e}var _i=b(H(),1);var dp="data-valid",pp="data-invalid";var mp={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ay={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},gp={disabled:!1,...Ay},Ci={valid(e){return e===null?null:e?{[dp]:""}:{[pp]:""}}};var Dy={invalid:void 0,name:void 0,validityData:{state:mp,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,setTouched:Le,setDirty:Le,setFilled:Le,setFocused:Le,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:gp,registerFieldControl:Le,validation:{getValidationProps:(e,t=Ne)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Le,getInputControl:()=>null,commit:async()=>{},change:Le}},Ly=_i.createContext(Dy);function ro(e=!0){let t=_i.useContext(Ly);if(t.setValidityData===Le&&!e)throw new Error(Ae(28));return t}function hp(e,t,n,o,r=!0,s){let{registerFieldControl:i}=ro(),a=He(()=>Symbol());U(()=>{let c=a.current;if(!r){i(c,void 0);return}i(c,{controlRef:e,getValue:o,id:t,name:s,value:n})},[e,r,o,t,s,i,a,n]),U(()=>{let c=a.current;return()=>{i(c,void 0)}},[i,a])}var ul=b(H(),1);function Tt(e){return an(e,"base-ui")}var Pi=b(H(),1);var Vy=Pi.createContext({controlId:void 0,registerControlId:Le,resetControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function lr(){return Pi.useContext(Vy)}function Ti(e={}){let{id:t,enabled:n=!0}=e,{controlId:o,registerControlId:r,resetControlId:s}=lr(),i=Tt(),a=He(()=>Symbol()),c=ul.useRef(!1),l=ul.useRef(!1),u=z(()=>{!c.current||r===Le||(c.current=!1,r(a.current,void 0))});return U(()=>{if(!n||r===Le){u();return}let f;if(t!==void 0)l.current=!0,f=t;else if(l.current)f=i;else{s();return}if(f===void 0){u();return}c.current=!0,r(a.current,f)},[t,n,r,s,i,a,u]),U(()=>u,[u]),(n?o:void 0)??t??i}function vp(e,t,n=Object.is){let{length:o}=e;if(o!==t.length)return!1;for(let r=0;r<o;r+=1)if(!n(e[r],t[r]))return!1;return!0}var dl=(e,t)=>Object.is(e,t);function Vn(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function xp(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!vp(e,t,(o,r)=>Vn(o,r,n)):e!==t}function fl(e,t,n){return e?e.some(o=>o===void 0?!1:Vn(t,o,n)):!1}function os(e,t,n){return e?e.findIndex(o=>o===void 0?!1:Vn(o,t,n)):-1}function Fy(e,t){if(t!==dl)return o=>fl(e,o,t);let n=new Set(e);return n.delete(void 0),o=>n.has(o)&&(o!==0||e.some(r=>Object.is(o,r)))}function pl(e,t,n,o){let r=o&&Array.isArray(t)?e.findIndex(Fy(t,n)):os(e,t,n);return r===-1?null:r}function Sp(e,t,n,o,r,s){return fl(o,t,r)?s!=null&&e>s&&fl(o,n[s],r)?s:e:e===s?pl(n,o,r,!0):s}function yp(e,t,n){return e.filter(o=>!Vn(t,o,n))}var wp=b(H(),1);function Ii(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}var Rp=b(ie(),1);function Hy(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function bp(e){return Hy(e?.[0])}function Uy(e){return bp(e)?e.flatMap(t=>t.items):e}function Ep(e){if(!Array.isArray(e))return e!=null&&"null"in e;let t=e;if(bp(t)){for(let n of t)for(let o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(let n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function ml(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Ii(e)}function so(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Ii(e.value):Ii(e)}function gl(e,t,n){function o(){return ml(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){let s=Uy(t);if(e==null||typeof e!="object"){let i=s.find(a=>a.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){let i=s.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function Cp(e,t,n){return e.reduce((o,r,s)=>(s>0&&o.push(", "),o.push((0,Rp.jsx)(wp.Fragment,{children:gl(r,t,n)},s)),o),[])}var _p={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:so(t,o)!==""},hasNullItemLabel:(e,t)=>t?Ep(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(r=>Vn(t,r,n)):Vn(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};var Oi=b(H(),1);var By=Oi.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitCountRef:{current:0}});function Pp(){return Oi.useContext(By)}var Tp=b(H(),1);function Ni(e,t){let n=Tp.useRef(e),o=z(t);U(()=>{n.current!==e&&o(n.current),n.current=e},[e,o])}var ss=b(H(),1);var rs=b(H(),1);function Ip(e){let t=rs.useRef(""),n=rs.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:rs.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r?e(r,r.pointerType):e(r,t.current),t.current=""},[e]),onPointerDown:n}}function hl(e,t){let n=z((s,i)=>{(typeof e=="function"?e():e)||t(i||(Ge.os.ios?"touch":""))}),{onClick:o,onPointerDown:r}=Ip(n);return ss.useMemo(()=>({onClick:o,onPointerDown:r}),[o,r])}function Op(e){let[t,n]=ss.useState(null),o=hl(e,n);return Ni(e,r=>{r&&!e&&n(null)}),ss.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}function Uo(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}var Gt=1;function ur(e,t){return Math.max(0,e-t)}function fr(e,t){if(t<=0)return 0;let n=Uo(e,0,t),o=n,r=t-n,s=o<=Gt,i=r<=Gt;return s&&i?o<=r?0:t:s?0:i?t:n}var Bo=b(ie(),1);function Np(e){let{id:t,value:n,defaultValue:o=null,onValueChange:r,open:s,defaultOpen:i=!1,onOpenChange:a,name:c,form:l,autoComplete:u,disabled:f=!1,readOnly:p=!1,required:d=!1,modal:m=!0,actionsRef:g,inputRef:h,onOpenChangeComplete:v,items:S,multiple:w=!1,itemToStringLabel:x,itemToStringValue:y,isItemEqualToValue:R=dl,highlightItemOnHover:E=!0,children:_}=e,{clearErrors:P}=Pp(),{setDirty:O,setTouched:T,setFocused:D,validityData:C,setFilled:M,name:I,disabled:A,validation:L,validationMode:N}=ro(),$=Ti({id:t}),k=A||f,q=I??c,[B,j]=Ar({controlled:n,default:w?o??St:o,name:"Select",state:"value"}),[V,X]=Ar({controlled:s,default:i,name:"Select",state:"open"}),Y=tt.useRef([]),ge=tt.useRef([]),Z=tt.useRef(null),de=tt.useRef(null),ce=tt.useRef(0),le=tt.useRef(null),W=tt.useRef([]),se=tt.useRef(!1),ue=tt.useRef(null),he=tt.useRef(null),De=tt.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),oe=tt.useRef(!1),we=tt.useRef(B),{mounted:re,setMounted:Ce,transitionStatus:be}=cn(V),{openMethod:_e,triggerProps:We}=Op(V),G=He(()=>new Rn({id:$,labelId:void 0,modal:m,multiple:w,itemToStringLabel:x,itemToStringValue:y,isItemEqualToValue:R,value:B,open:V,mounted:re,transitionStatus:be,items:S,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Ne,triggerProps:Ne,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:Le,setOpen:Le,handleScrollArrowVisibility:Le,onOpenChangeComplete:Le,listRef:Y,popupRef:Z,scrollHandlerRef:de,scrollArrowsMountedCountRef:ce,valueRef:le,valuesRef:W,labelsRef:ge,typingRef:se,selectionRef:De,firstItemTextRef:ue,selectedItemTextRef:he,alignItemWithTriggerActiveRef:oe,initialValueRef:we},_p)).current,ee=G.useState("activeIndex"),K=G.useState("selectedIndex"),F=G.useState("triggerElement"),fe=G.useState("positionerElement"),Me=gf(_e),Ke=_e??Me,$e=tt.useMemo(()=>w?"":so(B,y),[w,B,y]),Ze=tt.useMemo(()=>w&&Array.isArray(B)?B.map(ye=>so(ye,y)):so(B,y),[w,B,y]),Qe=Ue(F),It=z(()=>Ze);hp(Qe,$,B,It,!k,c);let vt=w?Array.isArray(B)&&B.length>0:B!=null&&$e!=="";U(()=>{M(vt)},[vt,M]),U(function(){let Fe=pl(W.current,B,R,w);Fe===null&&(he.current=null),!V&&G.set("selectedIndex",Fe)},[w,V,B,R,G]),Ni(B,()=>{P(q),O(xp(B,C.initialValue,R)),L.change(B)});let xt=z((ye,Fe)=>{a?.(ye,Fe),!Fe.isCanceled&&(X(ye),!ye&&(Fe.reason===te.focusOut||Fe.reason===te.outsidePress)&&(T(!0),D(!1),N==="onBlur"&&L.commit(B)))}),Dt=z(()=>{Ce(!1),G.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),v?.(!1)});yt({enabled:!g,open:V,ref:Z,onComplete(){V||Dt()}}),tt.useImperativeHandle(g,()=>({unmount:Dt}),[Dt]);let Xt=z((ye,Fe)=>{r?.(ye,Fe),!Fe.isCanceled&&j(ye)}),dn=z(ye=>{let Fe=ur(ye.scrollHeight,ye.clientHeight),Ot=fr(ye.scrollTop,Fe),$t=Ot>0,yo=Ot<Fe;G.set("scrollUpArrowVisible",$t),G.set("scrollDownArrowVisible",yo)}),Rt=Fo({open:V,onOpenChange:xt,elements:{reference:F,floating:fe}}),ft=Do(Rt,{enabled:!k,event:"mousedown"}),Se=Lo(Rt),Je=rl(Rt,{enabled:!k,listRef:Y,activeIndex:ee,selectedIndex:K,disabledIndices:St,onNavigate(ye){ye===null&&!V||G.set("activeIndex",ye)},focusItemOnHover:E}),rt=sl(Rt,{enabled:!k&&(V||!p&&!w),listRef:ge,activeIndex:ee,selectedIndex:K,disabledIndices:ye=>Fs(Y.current[ye]),onMatch(ye){V?G.set("activeIndex",ye):Xt(W.current[ye],me(te.none))},onTyping(ye){se.current=ye}}),dt=tt.useMemo(()=>Qt(rt.reference,Je.reference,Se.reference,ft.reference,We),[ft.reference,rt.reference,Je.reference,Se.reference,We]),Wt=tt.useMemo(()=>Qt(vi,rt.floating,Je.floating,Se.floating),[rt.floating,Je.floating,Se.floating]),st=Je.item??Ne;G.useContextCallback("setValue",Xt),G.useContextCallback("setOpen",xt),G.useContextCallback("handleScrollArrowVisibility",dn),G.useContextCallback("onOpenChangeComplete",v),pf(()=>{G.update({popupProps:Wt,triggerProps:dt})}),G.useSyncedValues({id:$,modal:m,multiple:w,value:B,open:V,mounted:re,transitionStatus:be,popupProps:Wt,triggerProps:dt,items:S,itemToStringLabel:x,itemToStringValue:y,isItemEqualToValue:R,openMethod:Ke});let J=tt.useMemo(()=>({disabled:k,readOnly:p,required:d,multiple:w,highlightItemOnHover:E,itemProps:st}),[k,p,d,w,E,st]),pe=en(h,L.inputRef),Re=w?void 0:q,Ee=tt.useMemo(()=>!w||!Array.isArray(B)||!q?null:B.map(ye=>{let Fe=so(ye,y);return(0,Bo.jsx)("input",{type:"hidden",form:l,name:q,value:Fe,disabled:k},Fe)}),[w,B,l,q,y,k]);return(0,Bo.jsxs)(al.Provider,{value:G,children:[(0,Bo.jsx)(cl.Provider,{value:J,children:(0,Bo.jsx)(ll.Provider,{value:Rt,children:_})}),(0,Bo.jsx)("input",{...L.getValidationProps(k,{onFocus(){G.state.triggerElement?.focus({focusVisible:!0})},onChange(ye){if(ye.nativeEvent.defaultPrevented||k||p)return;let Fe=ye.currentTarget.value,Ot=me(te.none,ye.nativeEvent);function $t(){if(w)return;let yo=Fe.toLowerCase(),Cr=W.current.findIndex(Da=>so(Da,y).toLowerCase()===yo||ml(Da,x).toLowerCase()===yo);Cr===-1&&(Cr=W.current.findIndex((Da,yv)=>{let hu=ge.current[yv];return hu!=null&&hu.toLowerCase()===yo}));let gu=W.current[Cr];gu!=null&&Xt(gu,Ot)}G.set("forceMount",!0),queueMicrotask($t)}}),id:$&&Re==null?`${$}-hidden-input`:void 0,form:l,name:Re,autoComplete:u,value:$e,disabled:k,required:d&&!(w&&vt),readOnly:p,ref:pe,style:q?ff:Vs,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ee]})}var Lp=b(H(),1);function Mp(e,t){let n=Tt(e);return U(()=>(t(n),()=>{t(o=>o===n?void 0:o)}),[n,t]),n}function kp(e={}){let{id:t,fallbackControlId:n,native:o=!1,setLabelId:r,focusControl:s}=e,{controlId:i,setLabelId:a}=lr(),c=z(d=>{a(d),r?.(d)}),l=Mp(t,c),u=i??n;function f(d){if(s){s(d,u);return}if(!u)return;let m=ve(d.currentTarget).getElementById(u);Ie(m)&&Wy(m)}function p(d){Ve(d.nativeEvent)?.closest("button,input,select,textarea")||(!d.defaultPrevented&&d.detail>1&&d.preventDefault(),!o&&f(d))}return o?{id:l,htmlFor:u,onMouseDown:p}:{id:l,onClick:p,onPointerDown(d){d.preventDefault()}}}function Wy(e){e.focus({focusVisible:!0})}function Ap(e){return e==null?void 0:`${e}-label`}function Dp(e,t){return e??t}var Vp=Lp.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=i;delete a.id;let c=ro(),l=je(),u=l.useState("triggerElement"),f=l.useState("id"),p=Ap(f),d=kp({id:p,fallbackControlId:u?.id??f,setLabelId(m){let g=typeof m=="function"?m(l.state.labelId):m;l.set("labelId",g)}});return ne("div",t,{ref:n,state:c.state,props:[d,i],stateAttributesMapping:Ci})});var dr=b(H(),1);var Mi=5;function Fp(e,t){let n=$y(t);return e.clientX>=n.left-Mi&&e.clientX<=n.right+Mi&&e.clientY>=n.top-Mi&&e.clientY<=n.bottom+Mi}function $y(e){let t=e.getBoundingClientRect(),n=Oe(e);if(Ge.env.jsdom)return t;let o=n.getComputedStyle(e,"::before"),r=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||r.content!=="none"))return t;let i=parseFloat(o.width)||0,a=parseFloat(o.height)||0,c=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,i,c),f=Math.max(t.height,a,l),p=u-t.width,d=f-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-d/2,bottom:t.bottom+d/2}}var LI=To.popupOpen,VI=To.pressed;var Hp="data-popup-side";var zy=400,qy={...Ks,...Ci,popupSide:e=>e?{[Hp]:e}:null,value:()=>null},Up=dr.forwardRef(function(t,n){let{render:o,className:r,id:s,disabled:i=!1,nativeButton:a=!0,style:c,...l}=t,{setTouched:u,setFocused:f,validationMode:p,validation:d,state:m,disabled:g}=ro(),{labelId:h}=lr(),v=je(),{readOnly:S,required:w,disabled:x}=oo(),y=g||x||i,R=v.useState("open"),E=v.useState("mounted"),_=v.useState("value"),P=v.useState("triggerProps"),O=v.useState("positionerElement"),T=v.useState("listElement"),D=v.useState("popupSide"),C=v.useState("id"),M=v.useState("labelId"),I=v.useState("hasSelectedValue"),A=E&&O?D:null,L=s??C,N=Dp(h,M);Ti({id:s});let $=Ue(O),k=dr.useRef(null),{getButtonProps:q,buttonRef:B}=zt({disabled:y,native:a}),j=v.useStateSetter("triggerElement"),V=et(),X=et(),Y=et();dr.useEffect(()=>{if(R)return Y.start(zy,()=>{v.context.selectionRef.current.allowUnselectedMouseUp=!0,v.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{Y.clear()};v.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},X.clear()},[R,v,X,Y]);let ge=Qt(P,{id:L,role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":R?T?.id??Io(O)?.id:void 0,"aria-labelledby":N,"aria-readonly":S||void 0,"aria-required":w||void 0,tabIndex:y?-1:0,onFocus(ce){f(!0),R&&v.context.alignItemWithTriggerActiveRef.current&&v.context.setOpen(!1,me(te.none,ce.nativeEvent)),V.start(0,()=>{v.set("forceMount",!0)})},onBlur(ce){Q(O,ce.relatedTarget)||(u(!0),f(!1),p==="onBlur"&&d.commit(_))},onMouseDown(ce){if(R)return;let le=ve(ce.currentTarget);function W(se){if(!k.current)return;let ue=se.target;Q(k.current,ue)||Q($.current,ue)||Fp(se,k.current)||v.context.setOpen(!1,me(te.cancelOpen,se))}X.start(0,()=>{le.addEventListener("mouseup",W,{once:!0})})}},l,q),Z=d.getValidationProps(y,ge);Z.role="combobox";let de={...m,open:R,disabled:y,value:_,readOnly:S,popupSide:A,placeholder:!I};return ne("button",t,{ref:[n,k,B,j],state:de,stateAttributesMapping:qy,props:Z})});var Bp=b(H(),1);var Ky={value:()=>null},Wp=Bp.forwardRef(function(t,n){let{className:o,render:r,children:s,placeholder:i,style:a,...c}=t,l=je(),u=l.useState("value"),f=l.useState("items"),p=l.useState("itemToStringLabel"),d=l.useState("hasSelectedValue"),m=!d&&i!=null&&s==null,g=l.useState("hasNullItemLabel",m),h={value:u,placeholder:!d},v=null;return typeof s=="function"?v=s(u):s!=null?v=s:m&&!g?v=i:Array.isArray(u)?v=Cp(u,f,p):v=gl(u,f,p),ne("span",t,{state:h,ref:[n,l.context.valueRef],props:[{children:v},c],stateAttributesMapping:Ky})});var $p=b(H(),1);var jp=$p.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,l={open:je().useState("open")};return ne("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"\u25BC"},i],stateAttributesMapping:nr})});var zp=b(H(),1);var qp=b(ie(),1),Kp=zp.forwardRef(function(t,n){let o=je(),r=o.useState("mounted"),s=o.useState("forceMount");return r||s?(0,qp.jsx)(Ao,{ref:n,...t}):null});var Gp=b(H(),1);var Gy={...qt,...Vt},Yp=Gp.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=je(),c=a.useState("open"),l=a.useState("mounted"),u=a.useState("transitionStatus");return ne("div",t,{state:{open:c,transitionStatus:u},ref:n,props:[{role:"presentation",hidden:!l,style:{userSelect:"none",WebkitUserSelect:"none"}},i],stateAttributesMapping:Gy})});var ln=b(H(),1);function io(e){return Xo(19)?e:e?"true":void 0}var Fn=b(H(),1);var ki=b(H(),1),vl=ki.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Jp(){return ki.useContext(vl)}var Xp=b(ie(),1);function Ai(e){let{children:t,elementsRef:n,labelsRef:o,onMapChange:r}=e,s=z(r),[,i]=Fn.useState(!1),a=He(Jy).current,c=He(Yy).current,l=Fn.useRef(0),u=Fn.useRef(!0),f=Fn.useRef(null),p=Fn.useRef(null),d=z(()=>{u.current||(u.current=!0,i(y=>!y))}),m=z((y,R)=>{c.set(y,R),d()}),g=z(y=>{c.delete(y),d()}),h=z(y=>{let R=new Map;return n.current.length=0,o&&(o.current.length=0),y.forEach(E=>{R.set(E.element,{...E.registration.metadata??{},index:E.index}),n.current[E.index]=E.element,o&&(o.current[E.index]=E.registration.label!==void 0?E.registration.label:E.registration.textRef?.current?.textContent??E.element.textContent)}),l.current=n.current.length,R});function v(y){if(p.current?.disconnect(),p.current=null,typeof MutationObserver!="function"||y.length<2)return;let R=new MutationObserver(_=>{if(!Qy(_))return;let P=null;for(let O of y)if(O.isConnected){if(P&&Zp(P,O)>0){R.disconnect(),d();return}P=O}});p.current=R;let E=new Set;for(let _=1;_<y.length;_+=1){let P=Zy(y[_-1],y[_]);P&&E.add(P)}E.forEach(_=>R.observe(_,{childList:!0}))}let S=z(()=>{let[y,R]=Xy(c),E=h(y),_=f.current,P=!_||_.length!==y.length||y.some((O,T)=>{let D=_[T];return O.index!==D.index||O.element!==D.element||O.registration.index!==D.registration.index||O.registration.metadata!==D.registration.metadata});v(R),f.current=y,u.current=!1,P&&(a.forEach(O=>O(E)),s(E))});U(()=>(!u.current&&f.current&&h(f.current),()=>{n.current=[],o&&(o.current=[])}),[n,o,h]),U(()=>{u.current&&S()}),U(()=>()=>{p.current?.disconnect(),u.current=!0},[]);let w=z(y=>(a.add(y),()=>{a.delete(y)})),x=Fn.useMemo(()=>({register:m,unregister:g,subscribeMapChange:w,nextIndexRef:l}),[m,g,w,l]);return(0,Xp.jsx)(vl.Provider,{value:x,children:t})}function Yy(){return new Map}function Jy(){return new Set}function Xy(e){let t=new Set,n=[],o=[];e.forEach((s,i)=>{if(!i.isConnected)return;let a=s.index,c={index:a??-1,element:i,registration:s};a===null?o.push(c):a>=0&&(t.add(a),n.push(c))});let r=0;return o.sort((s,i)=>Zp(s.element,i.element)),o.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,i)=>s.index-i.index),[n,o.map(s=>s.element)]}function Zy(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Qy(e){for(let t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function Zp(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var Yt=b(H(),1);var Di=b(H(),1),ew=Di.createContext(void 0);function Pn(){return Di.useContext(ew)?.direction??"ltr"}var tw=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:o,placement:r,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:f="real"}=En(e,t)||{};if(l==null)return{};let p=ei(u),d={x:n,y:o},m=Kr(r),g=qr(m),h=await i.getDimensions(l),v=m==="y",S=v?"top":"left",w=v?"bottom":"right",x=v?"clientHeight":"clientWidth",y=s.reference[g]+s.reference[m]-d[m]-s.floating[g],R=d[m]-s.reference[m],E=f==="real"?await i.getOffsetParent?.(l):a.floating,_=a.floating[x]||s.floating[g];(!_||!await i.isElement?.(E))&&(_=a.floating[x]||s.floating[g]);let P=y/2-R/2,O=_/2-h[g]/2-1,T=Math.min(p[S],O),D=Math.min(p[w],O),C=T,M=_-h[g]-D,I=_/2-h[g]/2+P,A=Zs(C,I,M),L=!c.arrow&&rn(r)!=null&&I!==A&&s.reference[g]/2-(I<C?T:D)-h[g]/2<0,N=L?I<C?I-C:I-M:0;return{[m]:d[m]+N,data:{[m]:A,centerOffset:I-A-N,...L&&{alignmentOffset:N}},reset:L}}}),Qp=(e,t)=>{let{name:n,fn:o}=tw(e);return{name:n,fn:o,options:[e,t]}};var em={name:"hide",async fn(e){let{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}};var pr={sideX:"left",sideY:"top"};var tm="--available-width",nm="--available-height",om="--anchor-width",rm="--anchor-height",sm="--transform-origin";var im=tm,am=nm;function um(e,t,n){let o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function cm(e,t,n){let{rects:o,placement:r}=e;return{side:um(t,Ct(r),n),align:rn(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function fm(e){return xl(e,ap)}function xl(e,t){let{anchor:n,positionMethod:o="absolute",side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:f=5,disableAnchorTracking:p=!1,inline:d,keepMounted:m=!1,floatingRootContext:g,mounted:h,collisionAvoidance:v,shift:S,nodeId:w,adaptiveOrigin:x,lazyFlip:y=!1,externalTree:R}=e,[E,_]=Yt.useState(null);!h&&E!==null&&_(null);let P=v.side||"flip",O=v.align||"flip",T=v.fallbackAxisSide||"end",D=S?.crossAxis??!1,C=S?.rootBoundary,M=typeof n=="function"?n:void 0,I=z(M),A=M?I:n,L=Ue(n),N=Ue(h),k=Pn()==="rtl",q=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":k?"left":"right","inline-start":k?"right":"left"}[r],B=i==="center"?q:`${q}-${i}`,j=l;typeof j=="number"?j={top:j,right:j,bottom:j,left:j}:j&&(j={top:j.top||0,right:j.right||0,bottom:j.bottom||0,left:j.left||0});let V=1,X=r==="bottom"?V:0,Y=r==="top"?V:0,ge=r==="right"?V:0,Z=r==="left"?V:0,de={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:j},ce=Yt.useRef(null),le=Ue(s),W=Ue(a),se=typeof s!="function"?s:0,ue=typeof a!="function"?a:0,he=[];d&&he.push(d),he.push($c(Se=>{let Je=cm(Se,r,k),rt=typeof le.current=="function"?le.current(Je):le.current,dt=typeof W.current=="function"?W.current(Je):W.current;return{mainAxis:rt,crossAxis:dt,alignmentAxis:dt}},[se,ue,k,r]));let De=O==="none"&&P!=="shift",oe=!De&&(u||D||P==="shift"),we=P==="none"?null:qc({...de,padding:{top:j.top+V+X,right:j.right+V+Z,bottom:j.bottom+V+Y,left:j.left+V+ge},mainAxis:!D&&P==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:T}),re=De?null:jc({...de,rootBoundary:C,mainAxis:O!=="none",crossAxis:oe,limiter:u||D?void 0:zc(Se=>{if(!ce.current)return{};let{width:Je,height:rt}=ce.current.getBoundingClientRect(),dt=Ft(Ct(Se.placement)),Wt=dt==="y"?Je:rt,st=dt==="y"?j.left+j.right:j.top+j.bottom;return{offset:Wt/2+st/2}})},[de,u,D,C,j,O]);P==="shift"||O==="shift"||i==="center"?he.push(re,we):he.push(we,re),he.push(Kc({...de,apply({elements:{floating:Se},availableWidth:Je,availableHeight:rt,rects:dt}){if(!N.current)return;let Wt=Se.style;Wt.setProperty(im,`${Je}px`),Wt.setProperty(am,`${rt}px`);let st=Oe(Se).devicePixelRatio||1,{x:J,y:pe,width:Re,height:Ee}=dt.reference,ye=(Math.round((J+Re)*st)-Math.round(J*st))/st,Fe=(Math.round((pe+Ee)*st)-Math.round(pe*st))/st;Wt.setProperty(om,`${ye}px`),Wt.setProperty(rm,`${Fe}px`)}}),Qp(Se=>({element:ce.current||ve(Se.elements.floating).createElement("div"),padding:ce.current?f:0,offsetParent:"floating"}),[f]),{name:"transformOrigin",fn(Se){let{elements:{floating:Je},middlewareData:rt,placement:dt,platform:Wt,rects:st,y:J}=Se,pe=Ct(dt),Re=rn(dt),Ee=Ft(pe)==="y",ye=ce.current,Fe=typeof s=="function"?s(cm(Se,r,k)):s,Ot;if(!ye&&Re&&Math.abs(Ee?rt.shift?.x||0:rt.shift?.y||0)<=1)Ot=Re==="start"===(Ee&&Wt.isRTL?.(Je)===!0)?"100%":"0%";else{let yo=Ee?rt.arrow?.x||0:rt.arrow?.y||0,Cr=Ee?ye?.clientWidth||0:ye?.clientHeight||0;Ot=`${yo+Cr/2}px`}let $t=pe==="top"||pe==="left"?`calc(100% + ${Fe}px)`:`${-Fe}px`;return oe&&Ee&&Math.abs(rt.shift?.y||0)>Fe&&($t=`${st.reference.y+st.reference.height/2-J}px`),Je.style.setProperty(sm,Ee?`${Ot} ${$t}`:`${$t} ${Ot}`),{}}},em,x),U(()=>{!h&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,g]);let Ce=Yt.useMemo(()=>({ancestorScroll:!p,elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:be,elements:_e,x:We,y:G,middlewareData:ee,update:K,placement:F,context:fe,isPositioned:Me,floatingStyles:Ke}=t({rootContext:g,open:m?h:void 0,placement:B,middleware:he,strategy:o,whileElementsMounted:m?void 0:(...Se)=>ts(...Se,Ce),nodeId:w,externalTree:R}),{sideX:$e,sideY:Ze}=ee.adaptiveOrigin||pr,Qe=Me?o:"fixed",It=Yt.useMemo(()=>{let Se;return Me?x?Se={position:Qe,[$e]:We,[Ze]:G}:Se={...Ke,position:Qe}:Se={position:Qe,top:0,left:0},Se[im]="100vw",Se[am]="100vh",Me||(Se.opacity=0),Se},[x,Qe,$e,We,Ze,G,Ke,Me]),vt=Yt.useRef(null);U(()=>{if(!h)return;let Se=L.current,Je=typeof Se=="function"?Se():Se,dt=(lm(Je)?Je.current:Je)||null||null;dt!==vt.current&&(be.setPositionReference(dt),vt.current=dt)},[h,be,A,L]),Yt.useEffect(()=>{if(!h)return;let Se=L.current;typeof Se!="function"&&lm(Se)&&Se.current!==vt.current&&(be.setPositionReference(Se.current),vt.current=Se.current)},[h,be,A,L]),Yt.useEffect(()=>{if(m&&h&&_e.reference&&_e.floating)return ts(_e.reference,_e.floating,K,Ce)},[m,h,_e,K,Ce]);let xt=Ct(F),Dt=um(r,xt,k),Xt=rn(F)||"center",dn=!!ee.hide?.referenceHidden;U(()=>{y&&h&&Me&&xt!==q&&_(xt)},[y,h,Me,xt,q]);let Rt=Yt.useMemo(()=>({position:"absolute",top:ee.arrow?.y,left:ee.arrow?.x}),[ee.arrow]),ft=ee.arrow?.centerOffset!==0;return Yt.useMemo(()=>({positionerStyles:It,arrowStyles:Rt,arrowRef:ce,arrowUncentered:ft,side:Dt,align:Xt,physicalSide:xt,anchorHidden:dn,refs:be,context:fe,isPositioned:Me,update:K}),[It,Rt,ce,ft,Dt,Xt,xt,dn,be,fe,Me,K])}function lm(e){return e!=null&&"current"in e}var Li=b(H(),1),Sl=Li.createContext(void 0);function ao(){let e=Li.useContext(Sl);if(!e)throw new Error(Ae(59));return e}var dm=b(H(),1),pm=b(ie(),1),Vi=dm.forwardRef(function(t,n){let{cutout:o,...r}=t,s;if(o){let i=o.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return(0,pm.jsx)("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});function mr(e,t){e&&Object.assign(e.style,t)}var Fi={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};function co(e){return e==="starting"?sd:Ne}function Hi(e,t,{styles:n,transitionStatus:o,props:r,refs:s,hidden:i,inert:a=!1}){let c={...n};return a&&(c.pointerEvents="none"),ne("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:c},co(o),r],stateAttributesMapping:qt})}var xm=b(H(),1);var mm={},gm={},hm="";function Ui(e,t){return Ro(e)?e:t}function vm(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Ui(t,n)).overflowY)}function ow(e){if(typeof document>"u")return!1;let t=ve(e);return Oe(t).innerWidth-t.documentElement.clientWidth>0}function rw(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;let n=ve(e),o=n.documentElement,r=n.body,s=Ui(o,r),i=s.style.overflowY,a=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",s.style.overflowY="scroll";let c=s.offsetWidth;s.style.overflowY="hidden";let l=s.offsetWidth;return s.style.overflowY=i,o.style.scrollbarGutter=a,c===l}function sw(e){let t=ve(e),n=t.documentElement,o=t.body,r=Ui(n,o),s={overflowY:r.style.overflowY,overflowX:r.style.overflowX};return Object.assign(r.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(r.style,s)}}function iw(e){let t=ve(e),n=t.documentElement,o=t.body,r=Oe(n),s=0,i=0,a=!1,c=tn.create();if(Ge.engine.webkit&&(r.visualViewport?.scale??1)!==1)return()=>{};function l(){let d=r.getComputedStyle(n),m=r.getComputedStyle(o),v=(d.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,mm={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},hm=n.style.scrollBehavior,gm={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};let S=n.scrollHeight>n.clientHeight,w=n.scrollWidth>n.clientWidth,x=d.overflowY==="scroll"||m.overflowY==="scroll",y=d.overflowX==="scroll"||m.overflowX==="scroll",R=Math.max(0,r.innerWidth-o.clientWidth),E=Math.max(0,r.innerHeight-o.clientHeight),_=parseFloat(m.marginTop)+parseFloat(m.marginBottom),P=parseFloat(m.marginLeft)+parseFloat(m.marginRight),O=Ui(n,o);if(a=rw(e),a){n.style.scrollbarGutter=v,O.style.overflowY="hidden",O.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(S||x)&&(n.style.overflowY="scroll"),(w||y)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:_||E?`calc(100dvh - ${_+E}px)`:"100dvh",width:P||R?`calc(100vw - ${P+R}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,mm),Object.assign(o.style,gm),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=hm)}function f(){u(),c.request(l)}l();let p=xe(r,"resize",f);return()=>{c.cancel(),u(),typeof r.removeEventListener=="function"&&p()}}var yl=class{lockCount=0;restore=null;timeoutLock=Lt.create();timeoutUnlock=Lt.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;let n=ve(t),o=n.documentElement,r=n.body,s=Oe(o);if(vm(s,o,r)){let a=new s.MutationObserver(()=>{vm(s,o,r)||(a.disconnect(),this.restore=null,this.lock(t))}),c={attributes:!0};a.observe(o,c),a.observe(r,c),this.restore=()=>a.disconnect();return}let i=Ge.os.ios||!ow(t);this.restore=i?sw(t):iw(t)}},aw=new yl;function Bi(e=!0,t=null){U(()=>{if(e)return aw.acquire(t)},[e,t])}var cw=20;function Sm(e,t,n,o){let[r,s]=xm.useState(!1);U(()=>{if(!e||!t||n==null){s(!1);return}let i=ve(n).documentElement.clientWidth,a=n.offsetWidth;s(i>0&&a>0&&a>=i-cw)},[e,t,n]),Bi(e&&(!t||r),o)}var is=b(ie(),1),lw={position:"fixed"},ym=ln.forwardRef(function(t,n){let{anchor:o,className:r,render:s,positionMethod:i,side:a,align:c,sideOffset:l,alignOffset:u,collisionBoundary:f="clipping-ancestors",collisionPadding:p,arrowPadding:d,sticky:m,disableAnchorTracking:g,alignItemWithTrigger:h=!0,collisionAvoidance:v=ii,style:S,...w}=t,x=je(),y=Ei(),R=x.useState("open"),E=x.useState("mounted"),_=x.useState("modal"),P=x.useState("value"),O=x.useState("openMethod"),T=x.useState("positionerElement"),D=x.useState("triggerElement"),C=x.useState("isItemEqualToValue"),M=x.useState("transitionStatus"),I=ln.useRef(null),A=ln.useRef(null),[L,N]=ln.useState(h),$=E&&L&&O!=="touch";!E&&L!==h&&N(h),ln.useImperativeHandle(x.context.alignItemWithTriggerActiveRef,()=>$),Sm(($||_)&&R,O==="touch",T,D);let k=fm({anchor:o,floatingRootContext:y,positionMethod:i,mounted:E,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,disableAnchorTracking:g??$,collisionAvoidance:v,keepMounted:!0}),q=$?"none":k.side,B=$?lw:k.positionerStyles,j={open:R,side:q,align:k.align,anchorHidden:k.anchorHidden};U(()=>{x.set("popupSide",k.side)},[x,k.side]);let V=x.useStateSetter("positionerElement"),X=Hi(t,j,{styles:B,transitionStatus:M,props:w,refs:[n,V],hidden:!E,inert:!R}),Y=ln.useRef(0),ge=z(de=>{if(x.context.valuesRef.current.length===0)return;let ce=Y.current;Y.current=de.size;let le=me(te.none);if(ce!==0&&!x.state.multiple&&P!==null&&os(x.context.valuesRef.current,P,C)===-1){let se=x.context.initialValueRef.current,he=se!=null&&os(x.context.valuesRef.current,se,C)!==-1?se:null;x.context.setValue(he,le),he===null&&(x.set("selectedIndex",null),x.context.selectedItemTextRef.current=null)}if(ce!==0&&x.state.multiple&&Array.isArray(P)){let W=P.filter(se=>os(x.context.valuesRef.current,se,C)!==-1);W.length!==P.length&&(x.context.setValue(W,le),W.length===0&&(x.set("selectedIndex",null),x.context.selectedItemTextRef.current=null))}if(R&&$){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let W={height:""};mr(T,W),mr(x.context.popupRef.current,W)}}),Z=ln.useMemo(()=>({...k,side:q,alignItemWithTriggerActive:$,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:I,scrollDownArrowRef:A}),[k,q,$,N]);return(0,is.jsx)(Ai,{elementsRef:x.context.listRef,labelsRef:x.context.labelsRef,onMapChange:ge,children:(0,is.jsxs)(Sl.Provider,{value:Z,children:[E&&_&&(0,is.jsx)(Vi,{inert:io(!R),cutout:D}),X]})})});var un=b(H(),1);var wm=b(ie(),1),Wi="base-ui-disable-scrollbar",as={className:Wi,getElement(e){return(0,wm.jsx)("style",{nonce:e,href:Wi,precedence:"base-ui:low",children:`.${Wi}{scrollbar-width:none}.${Wi}::-webkit-scrollbar{display:none}`})}};var $i=b(H(),1),uw=$i.createContext(void 0);function Rm(e){let t=$i.useContext(uw);if(t===void 0&&!e)throw new Error(Ae(69));return t}var zi="ArrowUp",qi="ArrowDown",Ki="ArrowLeft",Gi="ArrowRight",Yi="Home",Ji="End";var gr=new Set([zi,qi,Ki,Gi,Yi,Ji]),fw="Shift",Em=[fw,"Control","Alt","Meta"];function dw(e){return Ie(e)&&e.tagName==="INPUT"}function wl(e){return!!(dw(e)&&e.selectionStart!=null||Ie(e)&&e.tagName==="TEXTAREA")}function Rl(e,t,n,o){if(!e||!t||!t.scrollTo)return;let r=e.scrollLeft,s=e.scrollTop,i=e.clientWidth<e.scrollWidth,a=e.clientHeight<e.scrollHeight;if(i&&o!=="vertical"){let c=bm(e,t,"left"),l=ji(e),u=ji(t);n==="ltr"&&(c+t.offsetWidth+u.scrollMarginRight>e.scrollLeft+e.clientWidth-l.scrollPaddingRight?r=c+t.offsetWidth+u.scrollMarginRight-e.clientWidth+l.scrollPaddingRight:c-u.scrollMarginLeft<e.scrollLeft+l.scrollPaddingLeft&&(r=c-u.scrollMarginLeft-l.scrollPaddingLeft)),n==="rtl"&&(c-u.scrollMarginLeft<e.scrollLeft+l.scrollPaddingLeft?r=c-u.scrollMarginLeft-l.scrollPaddingLeft:c+t.offsetWidth+u.scrollMarginRight>e.scrollLeft+e.clientWidth-l.scrollPaddingRight&&(r=c+t.offsetWidth+u.scrollMarginRight-e.clientWidth+l.scrollPaddingRight))}if(a&&o!=="horizontal"){let c=bm(e,t,"top"),l=ji(e),u=ji(t);c-u.scrollMarginTop<e.scrollTop+l.scrollPaddingTop?s=c-u.scrollMarginTop-l.scrollPaddingTop:c+t.offsetHeight+u.scrollMarginBottom>e.scrollTop+e.clientHeight-l.scrollPaddingBottom&&(s=c+t.offsetHeight+u.scrollMarginBottom-e.clientHeight+l.scrollPaddingBottom)}e.scrollTo({left:r,top:s,behavior:"auto"})}function bm(e,t,n){let o=n==="left"?"offsetLeft":"offsetTop",r=0;for(;t.offsetParent&&(r+=t[o],t.offsetParent!==e);)t=t.offsetParent;return r}function ji(e){let 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}}var Xi=b(H(),1),pw=Xi.createContext(void 0),mw={disableStyleElements:!1};function Cm(){return Xi.useContext(pw)??mw}var bl="--transform-origin";var ea=b(ie(),1),hw={...qt,...Vt},Im=un.forwardRef(function(t,n){let{render:o,className:r,style:s,finalFocus:i,...a}=t,c=je(),{multiple:l,readOnly:u,highlightItemOnHover:f}=oo(),p=Ei(),{side:d,align:m,alignItemWithTriggerActive:g,isPositioned:h,setControlledAlignItemWithTrigger:v}=ao(),S=Rm(!0)!=null,w=Pn(),{nonce:x,disableStyleElements:y}=Cm(),R=c.useState("id"),E=c.useState("open"),_=c.useState("openMethod"),P=c.useState("mounted"),O=c.useState("popupProps"),T=c.useState("transitionStatus"),D=c.useState("triggerElement"),C=c.useState("positionerElement"),M=c.useState("listElement"),I=un.useRef(!1),A=un.useRef(!1),L=un.useRef({}),N=Nt(),$=z(j=>{if(!C||!c.context.popupRef.current||!A.current)return;let V=C.style.top==="0px",X=C.style.bottom==="0px";if(I.current||!g||!V&&!X){c.context.handleScrollArrowVisibility(j);return}let Y=Pm(C),ge=cs(C.getBoundingClientRect().height,"y",Y),Z=ve(C),de=Oe(C),ce=de.getComputedStyle(C),le=parseFloat(ce.marginTop),W=parseFloat(ce.marginBottom),se=_m(de.getComputedStyle(c.context.popupRef.current)),ue=Math.min(Z.documentElement.clientHeight-le-W,se),he=j.scrollTop,De=Zi(j),oe=null,we=_e=>{C.style.height=`${_e}px`},re=V?De-he:he,Ce=Math.min(ge+re,ue);if(re<=Gt){let _e=Uo(re,0,ue-ge);_e>0&&we(ge+_e),j.scrollTop=V?De:0,ue-(ge+_e)<=Gt&&(I.current=!0),c.context.handleScrollArrowVisibility(j);return}if(ue-Ce>Gt)oe=V?1/0:0;else if(X&&he<De){let _e=ge+re-ue;oe=he-(re-_e)}let be=Math.ceil(Ce);if(be!==0&&we(be),oe!=null){let _e=Uo(oe,0,Zi(j));Math.abs(j.scrollTop-_e)>Gt&&(j.scrollTop=_e)}be>=ue-Gt&&(I.current=!0),c.context.handleScrollArrowVisibility(j)});un.useImperativeHandle(c.context.scrollHandlerRef,()=>$,[$]),yt({open:E,ref:c.context.popupRef,onComplete(){E&&c.context.onOpenChangeComplete(!0)}});let k={open:E,transitionStatus:T,side:d,align:m};U(()=>{!C||!c.context.popupRef.current||Object.keys(L.current).length||(L.current={top:C.style.top||"0",left:C.style.left||"0",right:C.style.right,height:C.style.height,bottom:C.style.bottom,minHeight:C.style.minHeight,maxHeight:C.style.maxHeight,marginTop:C.style.marginTop,marginBottom:C.style.marginBottom})},[c,C]),U(()=>{E||g||(A.current=!1,I.current=!1,mr(C,L.current))},[E,g,C]),U(()=>{let j=c.context.popupRef.current;if(!E||!D||!C||!j||g&&!h||c.state.transitionStatus==="ending")return;if(A.current=!0,j.style.removeProperty(bl),!g){N.request(()=>c.context.handleScrollArrowVisibility(M||j));return}let V=vw(j);try{let X=c.context.selectedItemTextRef.current;X?.isConnected||(X=!c.select("hasSelectedValue")&&c.context.firstItemTextRef.current?.isConnected?c.context.firstItemTextRef.current:null);let Y=c.context.valueRef.current,ge=Oe(C),Z=ge.getComputedStyle(C),de=ge.getComputedStyle(j),ce=ve(D),le=Pm(D),W=Qi(D.getBoundingClientRect(),le),se=Qi(C.getBoundingClientRect(),le),ue=W.height,he=M||j,De=he.scrollHeight,oe=parseFloat(de.borderBottomWidth),we=parseFloat(Z.marginTop)||10,re=parseFloat(Z.marginBottom)||10,Ce=parseFloat(Z.minHeight)||100,be=_m(de),_e=5,We=5,G=20,ee=ce.documentElement.clientHeight-we-re,K=ce.documentElement.clientWidth,F=ee-W.bottom+ue,fe,Me=w==="rtl"?W.right-se.width:W.left,Ke=0;if(X&&Y){let ft=Qi(Y.getBoundingClientRect(),le);fe=Qi(X.getBoundingClientRect(),le),Me=se.left+(w==="rtl"?ft.right-fe.right:ft.left-fe.left);let Se=ft.top-W.top+ft.height/2;Ke=fe.top-se.top+fe.height/2-Se}let $e=F+Ke+re+oe,Ze=Math.min(ee,$e),Qe=ee-we-re,It=$e-Ze,vt=K-We;C.style.left=`${Uo(Me,_e,vt-se.width)}px`,C.style.height=`${Ze}px`,C.style.maxHeight="none",C.style.marginTop=`${we}px`,C.style.marginBottom=`${re}px`,j.style.height="100%";let xt=Zi(he),Dt=It>=xt-Gt;Dt&&(Ze=Math.min(ee,se.height)-(It-xt));let Xt=W.top<G||W.bottom>ee-G||Math.ceil(Ze)+Gt<Math.min(De,Ce),dn=(ge.visualViewport?.scale??1)!==1&&Ge.engine.webkit;if(Xt||dn){mr(C,L.current),v(!1);return}let Rt=Math.max(Ce,Ze);if(Dt){let ft=Math.max(0,ee-$e);C.style.top=se.height>=Qe?"0":`${ft}px`,C.style.height=`${Ze}px`,he.scrollTop=Zi(he)}else C.style.bottom="0",he.scrollTop=It;if(fe){let ft=se.top,Se=se.height,Je=fe.top+fe.height/2,rt=Uo(Se>0?(Je-ft)/Se*100:50,0,100);j.style.setProperty(bl,`50% ${rt}%`)}(Rt===ee||Ze>=be)&&(I.current=!0),c.context.handleScrollArrowVisibility(he),f&&c.state.selectedIndex===null&&c.state.activeIndex===null&&c.context.listRef.current[0]!=null&&c.set("activeIndex",0)}finally{V()}},[c,E,C,D,g,v,N,M,f,w,h]),un.useEffect(()=>{if(!g||!C||!E)return;let j=Oe(C);function V(X){c.context.setOpen(!1,me(te.windowResize,X))}return xe(j,"resize",V)},[c,g,C,E]);let q={...M?{role:"presentation"}:{role:"listbox","aria-multiselectable":l||void 0,"aria-readonly":u||void 0,id:`${R}-list`},onKeyDown(j){S&&gr.has(j.key)&&j.stopPropagation()},onScroll(j){M||$(j.currentTarget)},...g&&{style:M?{height:"100%"}:Fi},className:!M&&g?as.className:void 0},B=ne("div",t,{ref:[n,c.context.popupRef],state:k,stateAttributesMapping:hw,props:[O,q,co(T),a]});return(0,ea.jsxs)(un.Fragment,{children:[!y&&as.getElement(x),(0,ea.jsx)(Zr,{context:p,modal:!1,disabled:!P,openInteractionType:_,returnFocus:i,restoreFocus:!0,children:B})]})});function _m(e){let t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Zi(e){return ur(e.scrollHeight,e.clientHeight)}function Pm(e){return es.getScale(e)}function cs(e,t,n){return e/n[t]}function Qi(e,t){return An({x:cs(e.x,"x",t),y:cs(e.y,"y",t),width:cs(e.width,"x",t),height:cs(e.height,"y",t)})}var Tm=[["transform","none"],["scale","1"],["translate","0 0"]];function vw(e){let{style:t}=e,n={};for(let[o,r]of Tm)n[o]=t.getPropertyValue(o),t.setProperty(o,r,"important");return()=>{for(let[o]of Tm){let r=n[o];r?t.setProperty(o,r):t.removeProperty(o)}}}var Om=b(H(),1);var Nm=Om.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=je(),{multiple:c,readOnly:l}=oo(),{alignItemWithTriggerActive:u}=ao(),f=a.useState("hasScrollArrows"),p=a.useState("openMethod"),m={id:`${a.useState("id")}-list`,role:"listbox","aria-multiselectable":c||void 0,"aria-readonly":l||void 0,onScroll(h){a.context.scrollHandlerRef.current?.(h.currentTarget)},...u&&{style:Fi},className:f&&p!=="touch"?as.className:void 0},g=a.useStateSetter("listElement");return ne("div",t,{ref:[n,g],props:[m,i]})});var gn=b(H(),1);var Wo=b(H(),1);function ta(e={}){let{guess:t,label:n,metadata:o,textRef:r,index:s}=e,{register:i,unregister:a,subscribeMapChange:c,nextIndexRef:l}=Jp(),u=Wo.useRef(-1),[f,p]=Wo.useState(s==null&&t?()=>{if(u.current===-1){let h=l.current;l.current+=1,u.current=h}return u.current}:-1),d=s??f,m=Wo.useRef(null),g=Wo.useCallback(h=>{let v=m.current;v&&a(v),m.current=h,h&&i(h,{metadata:o??null,index:s??null,label:n,textRef:r})},[s,i,a,o,n,r]);return U(()=>{if(s==null)return c(h=>{let v=m.current?h.get(m.current)?.index:null;v!=null&&p(v)})},[s,c]),{ref:g,index:d}}var na=b(H(),1),El=na.createContext(void 0);function ls(){let e=na.useContext(El);if(!e)throw new Error(Ae(57));return e}var Mm=b(ie(),1),km=gn.memo(gn.forwardRef(function(t,n){let{render:o,className:r,style:s,value:i=null,label:a,disabled:c=!1,nativeButton:l=!1,...u}=t,f=gn.useRef(null),p=ta({guess:!0,label:a,textRef:f}),d=je(),{itemProps:m,multiple:g,disabled:h,readOnly:v}=oo(),S=h||c,w=d.useState("isActive",p.index),x=d.useState("open"),y=d.useState("isSelected",i),R=d.useState("isSelectedByFocus",p.index),E=d.useState("isItemEqualToValue"),_=p.index,P=gn.useRef(null);U(()=>{let k=d.context.valuesRef.current;return k[_]=i,()=>{delete k[_]}},[_,i,d]),U(()=>{let k=d.state.value,q=d.state.selectedIndex,B=q,j;g&&Array.isArray(k)?(B=Sp(_,i,d.context.valuesRef.current,k,E,q),j=B===_,_===q&&!j&&(d.context.selectedItemTextRef.current=null)):(j=k!==void 0&&Vn(i,k,E),j&&(B=_)),d.set("selectedIndex",B),j&&f.current&&(d.context.selectedItemTextRef.current=f.current)},[_,g,E,d,i]);let O=gn.useRef("mouse"),T=gn.useRef(!1),{getButtonProps:D,buttonRef:C}=zt({disabled:S,focusableWhenDisabled:!0,native:l,composite:!0}),M={disabled:S,selected:y,highlighted:w};function I(k){if(h||v)return;let q=d.state.value;if(g){let B=Array.isArray(q)?q:[],j=y?yp(B,i,E):[...B,i];d.context.setValue(j,me(te.itemPress,k))}else d.context.setValue(i,me(te.itemPress,k)),d.context.setOpen(!1,me(te.itemPress,k))}function A(){d.context.selectionRef.current.dragY=0}let L={role:"option","aria-selected":y,tabIndex:x&&w?0:-1,onKeyDown(k){d.set("activeIndex",_),k.key===" "&&d.context.typingRef.current&&k.preventDefault()},onClick(k){let q=O.current!=="touch",B=k.nativeEvent.pointerType,j=q&&qn(k.nativeEvent)&&(B!==void 0||w),V=q&&!j&&!T.current;T.current=!1,!(S||V)&&I(k.nativeEvent)},onPointerEnter(k){O.current=k.pointerType},onPointerMove(k){if(k.pointerType==="mouse"&&k.buttons===1){let q=d.context.selectionRef.current;q.dragY+=k.movementY,q.dragY**2>=64&&(q.allowUnselectedMouseUp=!0)}},onPointerDown(k){O.current=k.pointerType,T.current=!0,A()},onMouseUp(){if(A(),S||O.current==="touch"||T.current)return;let k=!d.context.selectionRef.current.allowSelectedMouseUp&&y,q=!d.context.selectionRef.current.allowUnselectedMouseUp&&!y;k||q||(T.current=!0,P.current?.click(),T.current=!1)}},N=ne("div",t,{ref:[C,n,p.ref,P],state:M,props:[m,L,u,D]}),$=gn.useMemo(()=>({selected:y,index:_,textRef:f,selectedByFocus:R}),[y,_,f,R]);return(0,Mm.jsx)(El.Provider,{value:$,children:N})}));var $o=b(H(),1);var Am=b(ie(),1),Dm=$o.forwardRef(function(t,n){let{selected:o}=ls();return t.keepMounted||o?(0,Am.jsx)(xw,{...t,ref:n}):null}),xw=$o.memo($o.forwardRef((e,t)=>{let{render:n,className:o,style:r,keepMounted:s,...i}=e,{selected:a}=ls(),c=$o.useRef(null),{transitionStatus:l,setMounted:u}=cn(a),p=ne("span",e,{ref:[t,c],state:{selected:a,transitionStatus:l},props:[{"aria-hidden":!0,children:"\u2714\uFE0F"},i],stateAttributesMapping:Vt});return yt({batch:!0,enabled:!a,open:a,ref:c,onComplete(){a||u(!1)}}),p}));var hr=b(H(),1);var Lm=hr.memo(hr.forwardRef(function(t,n){let{index:o,textRef:r,selectedByFocus:s}=ls(),i=je(),{render:a,className:c,style:l,...u}=t,f=hr.useCallback(d=>{d&&(o===0&&(i.context.firstItemTextRef.current=d),s&&(i.context.selectedItemTextRef.current=d))},[i,o,s]);return ne("div",t,{ref:[f,n,r],props:u})}));var Vm=b(H(),1);var Fm=Vm.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=je(),{side:c,align:l,arrowRef:u,arrowStyles:f,arrowUncentered:p,alignItemWithTriggerActive:d}=ao(),g={open:a.useState("open"),side:c,align:l,uncentered:p},h=ne("div",t,{state:g,ref:[u,n],props:[{style:f,"aria-hidden":!0},i],stateAttributesMapping:Kn});return d?null:h});var Um=b(H(),1);var Hm=b(H(),1);var oa=Hm.forwardRef(function(t,n){let{render:o,className:r,style:s,direction:i,keepMounted:a,...c}=t,l=i==="up",u=je(),{side:f,scrollDownArrowRef:p,scrollUpArrowRef:d}=ao(),m=l?"scrollUpArrowVisible":"scrollDownArrowVisible",g=u.useState(m),h=u.useState("openMethod"),v=g&&h!=="touch",S=et(),w=l?d:p,{mounted:x,transitionStatus:y,setMounted:R}=cn(v);U(()=>(u.context.scrollArrowsMountedCountRef.current+=1,u.set("hasScrollArrows",!0),()=>{u.context.scrollArrowsMountedCountRef.current=Math.max(0,u.context.scrollArrowsMountedCountRef.current-1),u.context.scrollArrowsMountedCountRef.current===0&&u.set("hasScrollArrows",!1)}),[u]),yt({open:v,ref:w,onComplete(){v||R(!1)}});let P=ne("div",t,{ref:[n,w],state:{direction:i,visible:v,side:f,transitionStatus:y},props:[{"aria-hidden":!0,children:l?"\u25B2":"\u25BC",style:{position:"absolute"},onMouseMove(T){if(T.movementX===0&&T.movementY===0||S.isStarted())return;u.set("activeIndex",null);function D(){let C=u.state.listElement??u.context.popupRef.current;if(!C)return;u.set("activeIndex",null),u.context.handleScrollArrowVisibility(C);let M=ur(C.scrollHeight,C.clientHeight),I=fr(C.scrollTop,M),A=I===(l?0:M),L=u.context.listRef.current;if(I!==C.scrollTop&&(C.scrollTop=I),A){S.clear();return}if(L.length>0){let N=w.current?.offsetHeight||0;C.scrollTop=Sw(L,l,I,C.clientHeight,N,M)}S.start(40,D)}S.start(40,D)},onMouseLeave(){S.clear()}},c],stateAttributesMapping:Vt});return x||a?P:null});function Sw(e,t,n,o,r,s){if(t){let u=0,f=n+r-Gt;for(let m=0;m<e.length;m+=1){let g=e[m];if(g&&g.offsetTop>=f){u=m;break}}let p=Math.max(0,u-1),d=e[p];return p<u&&d?fr(d.offsetTop-r,s):0}let i=e.length-1,a=n+o-r+Gt;for(let u=0;u<e.length;u+=1){let f=e[u];if(f&&f.offsetTop+f.offsetHeight>a){i=Math.max(0,u-1);break}}let c=Math.min(e.length-1,i+1),l=e[c];return c>i&&l?fr(l.offsetTop+l.offsetHeight-o+r,s):s}var Bm=b(ie(),1),Wm=Um.forwardRef(function(t,n){return(0,Bm.jsx)(oa,{...t,ref:n,direction:"down"})});var $m=b(H(),1);var jm=b(ie(),1),zm=$m.forwardRef(function(t,n){return(0,jm.jsx)(oa,{...t,ref:n,direction:"up"})});var vr=b(H(),1);var ra=b(H(),1),Cl=ra.createContext(void 0);function qm(){let e=ra.useContext(Cl);if(e===void 0)throw new Error(Ae(56));return e}var Km=b(ie(),1),Gm=vr.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,[a,c]=vr.useState(),l=vr.useMemo(()=>({labelId:a,setLabelId:c}),[a,c]),u=ne("div",t,{ref:n,props:[{role:"group","aria-labelledby":a},i]});return(0,Km.jsx)(Cl.Provider,{value:l,children:u})});var Ym=b(H(),1);var Jm=Ym.forwardRef(function(t,n){let{render:o,className:r,style:s,id:i,...a}=t,{setLabelId:c}=qm(),l=Tt(i);return U(()=>(c(l),()=>{c(f=>f===l?void 0:f)}),[l,c]),ne("div",t,{ref:n,props:[{id:l,"aria-hidden":!0},a]})});var Xm=b(H(),1);var Zm=Xm.forwardRef(function(t,n){let{className:o,render:r,orientation:s="horizontal",style:i,...a}=t;return ne("div",t,{state:{orientation:s},ref:n,props:[{role:"presentation"},a]})});var Qm=Zm;var eg=b(ie()),yw=ys("eg-icon",{variants:{size:{s:"eg-icon--size-s",m:"eg-icon--size-m",l:"eg-icon--size-l"}},defaultVariants:{size:"m"}});function lt({size:e,className:t,color:n,style:o,children:r,...s}){return(0,eg.jsx)("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",focusable:"false",className:yw({size:e,className:t}),style:n?{...o,color:n}:o,...s,children:r})}var _l=b(ie());function sa(e){return(0,_l.jsx)(lt,{...e,children:(0,_l.jsx)("path",{d:"M8 11L3 5.99999L3.7 5.29999L8 9.59999L12.3 5.29999L13 5.99999L8 11Z"})})}var At=b(ie());function tg(e){return(0,At.jsx)(fn.Root,{"data-slot":"select",...e})}function ng({className:e,placeholder:t,leadingIcon:n,renderValue:o,...r}){return(0,At.jsxs)(fn.Trigger,{"data-slot":"select-trigger",className:Zt("eg-select-trigger",e),...r,children:[n!=null&&(0,At.jsx)("span",{className:"eg-select-trigger__icon","aria-hidden":"true",children:n}),(0,At.jsx)(fn.Value,{className:"eg-select-value",placeholder:t,children:o}),(0,At.jsx)("span",{className:"eg-select-trigger__chevron","aria-hidden":"true",children:(0,At.jsx)(sa,{})})]})}function og({className:e,children:t,sideOffset:n=0,alignItemWithTrigger:o=!0,container:r,...s}){return(0,At.jsx)(fn.Portal,{...r!=null?{container:r}:{},children:(0,At.jsx)(fn.Positioner,{sideOffset:n,alignItemWithTrigger:o,children:(0,At.jsx)(fn.Popup,{"data-slot":"select-popup",className:Zt("eg-select-popup",e),...s,children:(0,At.jsx)(fn.List,{className:"eg-select-list",children:t})})})})}function rg({className:e,children:t,leadingIcon:n,...o}){return(0,At.jsxs)(fn.Item,{"data-slot":"select-item",className:Zt("eg-select-item",e),...o,children:[n!=null&&(0,At.jsx)("span",{className:"eg-select-item__icon","aria-hidden":"true",children:n}),(0,At.jsx)(fn.ItemText,{className:"eg-select-item__text",children:t})]})}var Ag=b(H());var hn={};jt(hn,{Backdrop:()=>ig,Close:()=>cg,Description:()=>ug,Handle:()=>ds,Popup:()=>gg,Portal:()=>vg,Root:()=>Cg,Title:()=>Ig,Trigger:()=>Ng,Viewport:()=>Pg,createHandle:()=>Mg});var sg=b(H(),1);var ia=b(H(),1),Pl=ia.createContext(void 0);function ht(e){let t=ia.useContext(Pl);if(!e&&t===void 0)throw new Error(Ae(27));return t}var ig=sg.forwardRef(function(t,n){let{render:o,className:r,style:s,forceRender:i=!1,...a}=t,c=ht(),l=c.useState("open"),u=c.useState("nested"),f=c.useState("mounted"),p=c.useState("transitionStatus");return ne("div",t,{state:{open:l,transitionStatus:p},ref:[c.context.backdropRef,n],stateAttributesMapping:Kn,props:[{role:"presentation",hidden:!f,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!u})});var ag=b(H(),1);var cg=ag.forwardRef(function(t,n){let{render:o,className:r,style:s,disabled:i=!1,nativeButton:a=!0,...c}=t,l=ht(),u=l.useState("open"),{getButtonProps:f,buttonRef:p}=zt({disabled:i,native:a}),d={disabled:i};function m(g){u&&l.setOpen(!1,me(te.closePress,g.nativeEvent))}return ne("button",t,{state:d,ref:[n,p],props:[{onClick:m},c,f]})});var lg=b(H(),1);var ug=lg.forwardRef(function(t,n){let{render:o,className:r,style:s,id:i,...a}=t,c=ht(),l=Tt(i);return c.useSyncedValueWithCleanup("descriptionElementId",l),ne("p",t,{ref:n,props:[{id:l},a]})});var pg=b(H(),1);var aa=b(H(),1),Tl=aa.createContext(void 0);function ca(){let e=aa.useContext(Tl);if(e===void 0)throw new Error(Ae(26));return e}var fg="--nested-dialogs";var fk=nn.open,dk=nn.closed,pk=nn.startingStyle,mk=nn.endingStyle;var dg="data-nested-dialog-open";var la={...qt,...Vt,nestedDialogOpen(e){return e?{[dg]:""}:null}};var mg=b(ie(),1),gg=pg.forwardRef(function(t,n){let{render:o,className:r,style:s,finalFocus:i,initialFocus:a,...c}=t,l=ht(),u=l.useState("descriptionElementId"),f=l.useState("disablePointerDismissal"),p=l.useState("floatingRootContext"),d=l.useState("popupProps"),m=l.useState("modal"),g=l.useState("mounted"),h=l.useState("nested"),v=l.useState("nestedOpenDialogCount"),S=l.useState("open"),w=l.useState("openMethod"),x=l.useState("titleElementId"),y=l.useState("transitionStatus"),R=l.useState("role"),E=p.useState("floatingId");ca(),yt({open:S,ref:l.context.popupRef,onComplete(){S&&l.context.onOpenChangeComplete?.(!0)}});let _=a===void 0?zd(l.context.popupRef):a,P=v>0,O=l.useStateSetter("popupElement"),D=ne("div",t,{state:{open:S,nested:h,transitionStatus:y,nestedDialogOpen:P},props:[d,{id:E,"aria-labelledby":x,"aria-describedby":u,role:R,...vi,hidden:!g,onKeyDown(C){gr.has(C.key)&&C.stopPropagation()},style:{[fg]:v}},c],ref:[n,l.context.popupRef,O],stateAttributesMapping:la});return(0,mg.jsx)(Zr,{context:p,openInteractionType:w,disabled:!g,closeOnFocusOut:!f,initialFocus:_,returnFocus:i,modal:m!==!1,restoreFocus:"popup",children:D})});var hg=b(H(),1);var us=b(ie(),1),vg=hg.forwardRef(function(t,n){let{keepMounted:o=!1,...r}=t,s=ht(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||o?(0,us.jsx)(Tl.Provider,{value:o,children:(0,us.jsxs)(Ao,{ref:n,...r,children:[i&&a===!0&&(0,us.jsx)(Vi,{ref:s.context.internalBackdropRef,inert:io(!c)}),t.children]})}):null});var bg=b(H(),1);var Il=b(H(),1);function xg({store:e,parentContext:t,isDrawer:n}){let o=e.useState("open"),r=e.useState("disablePointerDismissal"),s=e.useState("modal"),i=e.useState("popupElement"),a=e.useState("floatingRootContext"),[c,l]=Il.useState(0),[u,f]=Il.useState(0),p=c===0,d=Lo(a,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(m){if(!e.context.outsidePressEnabledRef.current||"button"in m&&m.button!==0)return!1;if("touches"in m){if(m.type==="touchend"){if(m.changedTouches.length!==1||m.touches.length!==0)return!1}else if(m.touches.length!==1)return!1}let g=Ve(m);if(p&&!r){if(s){let h=e.context.internalBackdropRef.current,v=e.context.backdropRef.current;return h||v?h===g||v===g||Q(g,i)&&!g?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:p});return Bi(o&&s===!0,i),e.useContextCallback("onNestedDialogOpen",(m,g)=>{l(m),f(g)}),U(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(c+1,u+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[n,o,c,u,t]),Zd(e,{activeTriggerProps:d.reference,inactiveTriggerProps:d.trigger,popupProps:d.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var fa=b(H(),1);var ua=class extends Rn{setState(t){}update(t){}set(t,n){}notifyAll(){}};var Sg={...op,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},da=class extends Rn{constructor(t,n,o){let r=new Ln,s=wg(t,r,n,o);super(s,Rg(r),Sg)}setOpen=(t,n)=>{n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),!n.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(t,n),this.update(Gd(this.state,t,n.trigger)))}};function yg(){let e=new Ln;return new ua(Object.freeze(wg(void 0,e)),Object.freeze(Rg(e)),Sg)}function wg(e,t,n,o=!1){return{...tp(t,n,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function Rg(e){return{popupRef:fa.createRef(),backdropRef:fa.createRef(),internalBackdropRef:fa.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}var fs=b(ie(),1);function Eg(e,t){let{children:n,open:o,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:i,disablePointerDismissal:a=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:f,defaultTriggerId:p=null}=t,d=e==="drawer",m=e==="alert-dialog",g=m?!0:c,h=m||a,v=m?"alertdialog":"dialog",S=ht(!0),w=S!=null,x={modal:g,disablePointerDismissal:h,nested:w,role:v},y=qd((T,D)=>new da({open:r,openProp:o,activeTriggerId:p,triggerIdProp:f,...x},T,D),!0);y.useControlledProp("openProp",o),y.useControlledProp("triggerIdProp",f),y.useSyncedValues(x),y.useContextCallback("onOpenChange",s),y.useContextCallback("onOpenChangeComplete",i);let R=y.useState("open"),E=y.useState("mounted"),_=y.useState("payload");Qd(y,R),Jd(y);let{forceUnmount:P}=Xd(R,y);bg.useImperativeHandle(l,()=>({unmount:P,close:()=>y.setOpen(!1,me(te.imperativeAction))}),[P,y]);let O=R||E;return(0,fs.jsxs)(Pl.Provider,{value:y,children:[u&&(0,fs.jsx)(Kd,{handle:u,store:y}),O&&(0,fs.jsx)(xg,{store:y,parentContext:S?.context,isDrawer:d}),typeof n=="function"?n({payload:_}):n]})}var Cg=ic(function(t){return Eg("dialog",t)});var _g=b(H(),1);var Pg=_g.forwardRef(function(t,n){let{render:o,className:r,style:s,children:i,...a}=t,c=ca(),l=ht(),u=l.useState("open"),f=l.useState("nested"),p=l.useState("transitionStatus"),d=l.useState("nestedOpenDialogCount"),m=l.useState("mounted"),g=l.useStateSetter("viewportElement"),h=d>0;return ne("div",t,{enabled:c||m,state:{open:u,nested:f,transitionStatus:p,nestedDialogOpen:h},ref:[n,g],stateAttributesMapping:la,props:[{role:"presentation",hidden:!m,style:{pointerEvents:u?void 0:"none"},children:i},a]})});var Tg=b(H(),1);var Ig=Tg.forwardRef(function(t,n){let{render:o,className:r,style:s,id:i,...a}=t,c=ht(),l=Tt(i);return c.useSyncedValueWithCleanup("titleElementId",l),ne("h2",t,{ref:n,props:[{id:l},a]})});var Og=b(H(),1);var Ng=_f(function(t,n){let{render:o,className:r,style:s,disabled:i=!1,nativeButton:a=!0,id:c,payload:l,handle:u,...f}=t,p=ht(!0),m=sp(u)??p;if(!m)throw new Error(Ae(79));let g=Tt(c),h=m.useState("floatingRootContext"),v=m.useState("isOpenedByTrigger",g),S=m.useState("triggerPopupId",g),w=Og.useRef(null),{registerTrigger:x,isMountedByThisTrigger:y}=Yd(g,w,m,{payload:l}),{getButtonProps:R,buttonRef:E}=zt({disabled:i,native:a}),_=Do(h),P=hl(()=>m.select("open"),D=>{m.set("openMethod",D)}),O={disabled:i,open:v},T=m.useState("triggerProps",y);return ne("button",t,{state:O,ref:[E,n,x,w],props:[_.reference,T,P,{[si]:"",id:g,"aria-haspopup":"dialog","aria-expanded":v,"aria-controls":S},f,R],stateAttributesMapping:nr})});var ds=class extends mi{constructor(){super(yg(),"Dialog",!1)}open(t){this.openByTrigger(t)}openWithPayload(t){let n=this.attachedStore;n!==null&&(n.set("payload",t),n.setOpen(!0,me(te.imperativeAction)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}};function Mg(){return new ds}var Ol=b(ie());function kg(e){return(0,Ol.jsx)(lt,{...e,children:(0,Ol.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14ZM8.5 4H7.5V9.5H8.5V4ZM7.58332 11.1264C7.70666 11.044 7.85166 11 8 11C8.19891 11 8.38968 11.079 8.53033 11.2197C8.67098 11.3603 8.75 11.5511 8.75 11.75C8.75 11.8983 8.70601 12.0433 8.6236 12.1667C8.54119 12.29 8.42406 12.3861 8.28701 12.4429C8.14997 12.4997 7.99917 12.5145 7.85368 12.4856C7.7082 12.4566 7.57456 12.3852 7.46967 12.2803C7.36478 12.1754 7.29335 12.0418 7.26441 11.8963C7.23547 11.7508 7.25033 11.6 7.30709 11.463C7.36386 11.3259 7.45999 11.2088 7.58332 11.1264Z"})})}var at=b(ie());function bw(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function Dg({open:e,onClose:t,title:n,message:o,reference:r,details:s,closeLabel:i="Schliessen",detailsLabel:a="Details"}){let c=s?Object.entries(s):[];return(0,at.jsx)(hn.Root,{open:e,onOpenChange:l=>{l||t()},children:(0,at.jsxs)(hn.Portal,{children:[(0,at.jsx)(hn.Backdrop,{"data-slot":"error-dialog-backdrop",className:"eg-error-dialog__backdrop"}),(0,at.jsx)(hn.Viewport,{className:"eg-error-dialog__viewport",children:(0,at.jsxs)(hn.Popup,{"data-slot":"error-dialog",className:"eg-error-dialog",role:"alertdialog",children:[(0,at.jsxs)("div",{className:"eg-error-dialog__header",children:[(0,at.jsx)(kg,{className:"eg-error-dialog__icon"}),(0,at.jsx)(hn.Title,{"data-slot":"error-dialog-title",className:"eg-error-dialog__title",children:n})]}),(0,at.jsx)(hn.Description,{"data-slot":"error-dialog-message",className:"eg-error-dialog__message",children:o}),r&&(0,at.jsx)("p",{"data-slot":"error-dialog-reference",className:"eg-error-dialog__reference",children:r}),c.length>0&&(0,at.jsxs)("details",{"data-slot":"error-dialog-details",className:"eg-error-dialog__details",children:[(0,at.jsx)("summary",{"data-slot":"error-dialog-details-toggle",className:"eg-error-dialog__details-summary",children:a}),(0,at.jsx)("dl",{className:"eg-error-dialog__details-list",children:c.map(([l,u])=>(0,at.jsxs)(Ag.Fragment,{children:[(0,at.jsx)("dt",{className:"eg-error-dialog__details-key",children:l}),(0,at.jsx)("dd",{className:"eg-error-dialog__details-value",children:bw(u)})]},l))})]}),(0,at.jsx)("div",{className:"eg-error-dialog__footer",children:(0,at.jsx)(hn.Close,{render:(0,at.jsx)(Ls,{variant:"secondary",size:"m","data-slot":"error-dialog-close",children:i})})})]})})]})})}var Ut={};jt(Ut,{Arrow:()=>ph,Backdrop:()=>lh,Content:()=>Kg,Icon:()=>xh,Item:()=>$g,Link:()=>hh,List:()=>Bg,Popup:()=>fh,Portal:()=>eh,Positioner:()=>sh,Root:()=>Vg,Trigger:()=>Xg,Viewport:()=>ah});var qe=b(H(),1);var xr=b(H(),1),Nl=xr.createContext(void 0);function ze(e){let t=xr.useContext(Nl);if(t===void 0&&!e)throw new Error(Ae(41));return t}var Ml=xr.createContext(void 0);function Tn(){return xr.useContext(Ml)}var lo="--positioner-width",uo="--positioner-height";var fo="--popup-width",po="--popup-height";function Sr(e,t,n,o){e.style.setProperty(fo,`${n}px`),e.style.setProperty(po,`${o}px`),t.style.setProperty(lo,`${n}px`),t.style.setProperty(uo,`${o}px`)}var yr=b(ie(),1),Ew=new Set([te.triggerHover,te.outsidePress,te.focusOut]);function Cw(e){let t=parseFloat(e.style.getPropertyValue(lo))||0,n=parseFloat(e.style.getPropertyValue(uo))||0;return t<=0||n<=0?null:{width:t,height:n}}var Vg=qe.forwardRef(function(t,n){let{defaultValue:o=null,value:r,onValueChange:s,actionsRef:i,delay:a=50,closeDelay:c=50,orientation:l="horizontal",onOpenChangeComplete:u}=t,f=Kt()!=null,p=ze(!0),[d,m]=Ar({controlled:r,default:o,name:"NavigationMenu",state:"value"}),g=d!=null,h=qe.useRef(void 0),v=qe.useRef(null),[S,w]=qe.useState(null),[x,y]=qe.useState(null),[R,E]=qe.useState(null),[_,P]=qe.useState(null),[O,T]=qe.useState(null),[D,C]=qe.useState(void 0),[M,I]=qe.useState(!1),A=qe.useRef(null),L=qe.useRef(null),N=qe.useRef(null),$=qe.useRef(null),k=qe.useRef(null),q=qe.useRef(null),B=qe.useRef({abortController:null,owner:null}),{mounted:j,setMounted:V,transitionStatus:X}=cn(g);U(()=>{if(g||!S||!x)return;let le=Cw(S);le&&Sr(x,S,le.width,le.height)},[g,x,S]),qe.useEffect(()=>{I(!1)},[d]);let Y=z((le,W)=>{le==null&&(h.current=W.reason),le!==d&&s?.(le,W),!W.isCanceled&&(le==null&&(T(null),C(void 0)),m(le),f&&le==null&&W.reason===te.linkPress&&p&&p.setValue(null,W))}),ge=z(()=>{let le=ve(v.current),W=mt(le);!(h.current&&Ew.has(h.current))&&Ie(A.current)&&(W===ve(x).body||Q(x,W))&&x&&(A.current.focus({preventScroll:!0}),A.current=void 0),V(!1),u?.(!1),T(null),C(void 0),L.current=null,h.current=void 0});qe.useImperativeHandle(i,()=>({unmount:ge}),[ge]),yt({enabled:!i,open:g,ref:{current:x},onComplete(){g||ge()}}),yt({enabled:!i,open:g,ref:{current:_},onComplete(){g||ge()}});let Z=g?O:null,de=qe.useMemo(()=>({open:g,value:d,setValue:Y,mounted:j,transitionStatus:X,positionerElement:S,setPositionerElement:w,popupElement:x,setPopupElement:y,viewportElement:R,setViewportElement:E,viewportTargetElement:_,setViewportTargetElement:P,activationDirection:Z,setActivationDirection:T,floatingRootContext:D,setFloatingRootContext:C,currentContentRef:L,nested:f,rootRef:v,beforeInsideRef:N,afterInsideRef:$,beforeOutsideRef:k,afterOutsideRef:q,prevTriggerElementRef:A,popupAutoSizeResetRef:B,delay:a,closeDelay:c,orientation:l,viewportInert:M,setViewportInert:I}),[g,d,Y,j,X,S,x,R,_,Z,D,f,a,c,l,M]),ce=(0,yr.jsx)(Nl.Provider,{value:de,children:(0,yr.jsx)(_w,{componentProps:t,forwardedRef:n,children:t.children})});return f?ce:(0,yr.jsx)(Fc,{children:ce})});function _w(e){let{className:t,render:n,defaultValue:o,value:r,onValueChange:s,actionsRef:i,delay:a,closeDelay:c,orientation:l,onOpenChangeComplete:u,style:f,...p}=e.componentProps,d=Vc(),{rootRef:m,nested:g,open:h}=ze(),v={open:h,nested:g},S=ne(g?"div":"nav",e.componentProps,{state:v,ref:[e.forwardedRef,m],props:p});return(0,yr.jsx)(Ml.Provider,{value:d,children:(0,yr.jsx)(Jr,{id:d,children:S})})}var va=b(H(),1);var Hg=b(H(),1);var jo=b(H(),1);var Al="data-composite-item-active";function Fg(e){let{loopFocus:t=!0,orientation:n="both",grid:o,onLoop:r,direction:s,highlightedIndex:i,onHighlightedIndexChange:a,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:f,modifierKeys:p=St}=e,[d,m]=jo.useState(0),g=o!=null,h=jo.useRef(null),v=en(h,c),S=jo.useRef([]),w=jo.useRef(!1),x=jo.useRef(null),y=i??d,R=z((T,D=!1)=>{if(x.current=S.current[T]??null,(a??m)(T),D){let C=S.current[T];Rl(h.current,C,s,n)}}),E=z(T=>{if(T.size===0)return;if(w.current){let I=S.current,A=I.indexOf(x.current);if(A===-1){let L=I[y];!L||Dn(I,y,f)?R(Pw(I,f)):x.current=L}else A!==y&&R(A);return}w.current=!0;let D=Array.from(T.keys()),C=D.find(I=>I?.hasAttribute(Al))??null,M=C?T.get(C)?.index??-1:-1;if(M!==-1)R(M);else if(Dn(D,y,f)){let I=sn(D,{disabledIndices:f});Jn(D,I)||R(I)}Rl(h.current,C,s,n)});U(()=>{if(f==null||i!=null||!w.current)return;let T=S.current;if(Dn(T,y,f)){let D=sn(T,{disabledIndices:f});Jn(T,D)||R(D)}},[f,i,y,S,R]);let _=z((T,D,C)=>r?r(T,D,C,S):C),P=z(T=>{let D=T.key===Yi||T.key===Ji;if(!gr.has(T.key)||!l&&D||Tw(T,p)||!h.current)return;let M=s==="rtl",I=M?Ki:Gi,A=M?Gi:Ki,L=n==="vertical"?qi:I,N=n==="vertical"?zi:A,$=Ve(T.nativeEvent);if($!=null&&wl($)&&!Fs($)){let X=$.selectionStart,Y=$.selectionEnd,ge=$.value;if(X==null||T.shiftKey||X!==Y||T.key!==N&&X<ge.length||T.key!==L&&X>0)return}let k=y,q=Oo(S,f),B=or(S,f);o!=null&&(k=o({disabledIndices:f,elementsRef:S,event:T,highlightedIndex:y,loopFocus:t,maxIndex:B,minIndex:q,onLoop:_,orientation:n,rtl:M}));let j=n!=="vertical"&&T.key===I||n!=="horizontal"&&T.key===qi,V=n!=="vertical"&&T.key===A||n!=="horizontal"&&T.key===zi;l&&(T.key===Yi?k=q:T.key===Ji&&(k=B)),k===y&&(j||V)&&(t&&k===B&&j?(k=q,r&&(k=r(T,y,k,S))):t&&k===q&&V?(k=B,r&&(k=r(T,y,k,S))):k=sn(S.current,{startingIndex:k,decrement:V,disabledIndices:f})),k!==y&&!Jn(S.current,k)&&(u&&T.stopPropagation(),(g||D||j||V)&&T.preventDefault(),R(k,!0),queueMicrotask(()=>{S.current[k]?.focus()}))});return{props:{ref:v,onFocus(T){let D=h.current,C=Ve(T.nativeEvent);!D||C==null||!wl(C)||C.setSelectionRange(0,C.value.length)},onKeyDown:P},highlightedIndex:y,onHighlightedIndexChange:R,elementsRef:S,onMapChange:E,relayKeyboardEvent:P}}function Pw(e,t){let n=-1;for(let o=0;o<e.length;o+=1){let r=e[o];if(!(!r||Dn(e,o,t))){if(r.hasAttribute(Al))return o;n===-1&&(n=o)}}return Math.max(n,0)}function Tw(e,t){for(let n of Em)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var Dl=b(ie(),1);function ps(e){let{render:t,className:n,style:o,refs:r=St,props:s=St,state:i=Ne,stateAttributesMapping:a,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:f,loopFocus:p,onLoop:d,enableHomeAndEndKeys:m,onMapChange:g,stopEventPropagation:h=!0,rootRef:v,disabledIndices:S,modifierKeys:w,highlightItemOnHover:x=!1,tag:y="div",...R}=e,E=Pn(),{props:_,highlightedIndex:P,onHighlightedIndexChange:O,elementsRef:T,onMapChange:D,relayKeyboardEvent:C}=Fg({grid:f,loopFocus:p,onLoop:d,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:v,stopEventPropagation:h,enableHomeAndEndKeys:m,direction:E,disabledIndices:S,modifierKeys:w}),M=ne(y,e,{state:i,ref:r,props:[_,...s,R],stateAttributesMapping:a}),I=Hg.useMemo(()=>({highlightedIndex:P,onHighlightedIndexChange:O,highlightItemOnHover:x,relayKeyboardEvent:C}),[P,O,x,C]);return(0,Dl.jsx)(Za.Provider,{value:I,children:(0,Dl.jsx)(Ai,{elementsRef:T,onMapChange:A=>{g?.(A),D(A)},children:M})})}var pa="data-base-ui-navigation-menu-trigger";var ma=b(H(),1),ga=ma.createContext(void 0);function Ug(){return ma.useContext(ga)}function wr(){return new Cn({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ln,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}var ha=b(ie(),1),Bg=va.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=Tn(),{orientation:c,open:l,floatingRootContext:u,positionerElement:f,value:p,closeDelay:d,viewportElement:m,nested:g}=ze(),h=va.useMemo(()=>wr(),[]),v=u||h,S=f!=null||p==null,w=f!=null||m!=null||p==null;tl(v,{enabled:!!u&&w,closeDelay:d,nodeId:a});let x=Lo(v,{enabled:S,outsidePressEvent:"intentional",outsidePress(O){return Ve(O)?.closest(`[${pa}]`)===null}}),y=u?x:void 0,R={open:l},E=g?Ne:{onKeyDown(O){(c==="horizontal"&&(O.key==="ArrowLeft"||O.key==="ArrowRight")||c==="vertical"&&(O.key==="ArrowUp"||O.key==="ArrowDown"))&&O.stopPropagation()}},_=[y?.floating||Ne,E,i],P=ne("ul",t,{state:R,ref:n,props:_,enabled:g});return g?(0,ha.jsx)(ga.Provider,{value:y,children:P}):(0,ha.jsx)(ga.Provider,{value:y,children:(0,ha.jsx)(ps,{render:o,className:r,style:s,state:R,refs:[n],props:_,loopFocus:!1,orientation:c,tag:"ul"})})});var Sa=b(H(),1);var xa=b(H(),1),Ll=xa.createContext(void 0);function Rr(){let e=xa.useContext(Ll);if(!e)throw new Error(Ae(39));return e}var Wg=b(ie(),1),$g=Sa.forwardRef(function(t,n){let{render:o,className:r,style:s,value:i,...a}=t,c=Tt(),l=i??c,u=ne("li",t,{ref:n,props:a}),f=Sa.useMemo(()=>({value:l}),[l]);return(0,Wg.jsx)(Ll.Provider,{value:f,children:u})});var zo=b(H(),1),qg=b($n(),1);var qA=nn.open,KA=nn.closed,GA=nn.startingStyle,YA=nn.endingStyle,jg="data-activation-direction";var ya=b(ie(),1),zg={...qt,...Vt,activationDirection(e){return e?{[jg]:e}:null}},Kg=zo.forwardRef(function(t,n){let{render:o,className:r,style:s,keepMounted:i=!1,...a}=t,{mounted:c,viewportElement:l,value:u,activationDirection:f,currentContentRef:p,viewportTargetElement:d}=ze(),{value:m}=Rr(),g=Tn(),h=c&&u===m,v=zo.useRef(null),[S,w]=zo.useState(!1),[x,y]=zo.useState(!1),{mounted:R,setMounted:E,transitionStatus:_}=cn(h);R&&!c&&E(!1),yt({ref:v,open:h,onComplete(){h||E(!1)}}),U(()=>{h&&v.current&&(p.current=v.current)},[h,p]);let P={open:h,transitionStatus:_,activationDirection:f},O=z(A=>{A&&h&&(p.current=A)}),T={onFocus(A){Ve(A.nativeEvent)?.hasAttribute("data-base-ui-focus-guard")||y(!0)},onBlur(A){Q(A.currentTarget,A.relatedTarget)||y(!1)}},D=!h&&R?{style:{position:"absolute",top:0,left:0},inert:io(!x),...T}:T,C=d||l,M=i&&!R,I=i&&!C&&!S;return i&&C&&!S&&w(!0),I?(0,ya.jsx)(ps,{render:o,className:r,style:s,state:P,refs:[n],props:[D,{hidden:!0},a],stateAttributesMapping:zg}):!C||!R&&!i?null:qg.createPortal((0,ya.jsx)(Jr,{id:g,children:(0,ya.jsx)(ps,{render:o,className:r,style:s,state:P,refs:[n,v,O],props:[D,M?{hidden:!0}:Ne,a],stateAttributesMapping:zg})}),C)});var Xe=b(H(),1),ba=b($n(),1);function wa({currentTarget:e,relatedTarget:t},n){let{popupElement:o,rootRef:r,tree:s,nodeId:i}=n,a=s?Ht(s.nodesRef.current,i).some(c=>Q(c.context?.elements.floating,t)):!1;return o?!Q(o,e)&&!Q(o,t)&&!Q(r.current,t)&&!a:!Q(r.current,t)&&!a}var Gg=b(H(),1);function Yg(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:o}=As(),{ref:r,index:s}=ta(e),i=n===s,a=Gg.useRef(null),c=en(r,a);return{compositeProps:{tabIndex:i?0:-1,onFocus(){o(s)},onMouseMove(){let u=a.current;if(!t||!u)return;let f=u.hasAttribute("disabled")||u.ariaDisabled==="true";!i&&!f&&u.focus()}},compositeRef:c,index:s}}function Ra(e){let{render:t,className:n,style:o,state:r=Ne,props:s=St,refs:i=St,metadata:a,stateAttributesMapping:c,tag:l="div",...u}=e,{compositeProps:f,compositeRef:p}=Yg({metadata:a});return ne(l,e,{state:r,ref:[p,...i],props:[f,...s,u],stateAttributesMapping:c})}function br(e){let t=pt(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,r=Ie(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o;return(Yn(n)!==s||Yn(o)!==i)&&(n=s,o=i),{width:n,height:o}}var mo=b(ie(),1),Jg={width:0,height:0},Xg=Xe.forwardRef(function(t,n){let{render:o,className:r,style:s,nativeButton:i=!0,disabled:a=!1,...c}=t,{value:l,setValue:u,mounted:f,open:p,positionerElement:d,setActivationDirection:m,setFloatingRootContext:g,popupElement:h,viewportElement:v,transitionStatus:S,rootRef:w,beforeOutsideRef:x,afterOutsideRef:y,afterInsideRef:R,beforeInsideRef:E,prevTriggerElementRef:_,popupAutoSizeResetRef:P,currentContentRef:O,delay:T,closeDelay:D,orientation:C,setViewportInert:M,nested:I}=ze(),{value:A}=Rr(),L=Tn(),N=gt(),$=Ug(),k=Pn(),q=et(),B=Nt(),j=Nt(),V=Nt(),[X,Y]=Xe.useState(null),[ge,Z]=Xe.useState(!0),[de,ce]=Xe.useState(""),le=Xe.useRef(null),W=Xe.useRef(Jg),se=Xe.useRef(!1),ue=p&&l===A,he=Ue(ue),De=(d!=null||l==null)&&!a,oe=d||v,we=(oe!=null||l==null)&&!a,re=hi(h),Ce=Xe.useCallback(J=>{le.current=J,Y(J)},[]),be=z((J=!1)=>{!J&&P.current.owner!==A||(P.current.abortController?.abort(),P.current.abortController=null,P.current.owner=null)});U(()=>{ue||(B.cancel(),V.cancel(),be())},[ue,B,V,be]);function _e(J){J.style.setProperty(fo,"auto"),J.style.setProperty(po,"auto")}function We(J,pe){J.style.removeProperty(fo),J.style.removeProperty(po),pe.style.removeProperty(lo),pe.style.removeProperty(uo)}function G(J){be(!0);let pe=new AbortController;P.current.abortController=pe,P.current.owner=A,re(()=>{P.current.abortController=null,P.current.owner=null,_e(J)},pe.signal)}let ee=z((J,pe,Re,Ee)=>{be(!0),We(J,pe);let{width:ye,height:Fe}=br(J),Ot=ye||W.current.width,$t=Fe||W.current.height;(Ee===0||Re===0)&&(Re=Ot,Ee=$t),J.style.setProperty(fo,`${Re}px`),J.style.setProperty(po,`${Ee}px`),pe.style.setProperty(lo,`${Ot}px`),pe.style.setProperty(uo,`${$t}px`),V.request(()=>{he.current&&(J.style.setProperty(fo,`${Ot}px`),J.style.setProperty(po,`${$t}px`),G(J))})}),K=z((J,pe,Re,Ee)=>{V.cancel(),B.cancel(),be(!0),!(Re===0||Ee===0)&&(Sr(J,pe,Re,Ee),B.request(()=>{B.request(()=>{We(J,pe);let{width:ye,height:Fe}=br(J),Ot=ye||Re,$t=Fe||Ee;Sr(J,pe,Re,Ee),V.request(()=>{he.current&&(Sr(J,pe,Ot,$t),G(J))})})}))}),F=z((J,pe)=>{V.cancel(),be(!0),We(J,pe);let{width:Re,height:Ee}=br(J);Re===0||Ee===0||(W.current={width:Re,height:Ee},_e(J),pe.style.setProperty(lo,`${Re}px`),pe.style.setProperty(uo,`${Ee}px`))}),fe=z(J=>{let pe=J.style.getPropertyValue(fo),Re=J.style.getPropertyValue(po);return pe!==""&&pe!=="auto"&&Re!==""&&Re!=="auto"?{size:{width:J.offsetWidth||W.current.width,height:J.offsetHeight||W.current.height},syncPositioner:!0}:{size:W.current,syncPositioner:!1}});Xe.useEffect(()=>{p||(q.clear(),B.cancel(),j.cancel(),V.cancel(),be(!0),se.current=!1,ce(""))},[q,p,B,j,V,be]),Xe.useEffect(()=>{f||(W.current=Jg)},[f]),U(()=>{if(!h||typeof ResizeObserver!="function")return;let J=new ResizeObserver(()=>{W.current={width:h.offsetWidth,height:h.offsetHeight}});return J.observe(h),()=>{J.disconnect()}},[h]),Xe.useEffect(()=>{if(!p||!ue||!h||!d)return;let J=h,pe=d,Re=Oe(pe);function Ee(){j.cancel(),j.request(()=>F(J,pe))}let ye=xe(Re,"resize",Ee);return()=>{j.cancel(),ye()}},[p,ue,h,d,j,F]),Xe.useEffect(()=>{let J=O.current;if(!J||!h||!d||!ue||typeof MutationObserver!="function")return;let pe=new MutationObserver(()=>{if(S==="starting"||h.hasAttribute(tr.startingStyle)){F(h,d);return}let{size:Re,syncPositioner:Ee}=fe(h);if(Ee){K(h,d,Re.width,Re.height);return}ee(h,d,Re.width,Re.height)});return pe.observe(J,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["hidden"]}),()=>{pe.disconnect()}},[O,h,d,ue,S,fe,K,ee,F]),U(()=>{if(he.current&&p&&h&&d){if(se.current){se.current=!1;return}let{width:J,height:pe}=br(h);ee(h,d,J,pe)}},[O,ee,he,p,h,d,S]);function Me(J,pe){let Re=pe.reason===te.triggerHover;if(!De||de==="touch"&&Re||!J&&l!==A)return;function Ee(){Re&&(Z(!0),q.clear(),q.start(500,()=>{Z(!1)})),J?u(A,pe):(u(null,pe),ce(""))}Re?ba.flushSync(Ee):Ee()}let Ke=Fo({open:p,onOpenChange:Me,elements:{reference:X,floating:oe}}),$e=cr(Ke),Ze=de!=="touch";Xe.useEffect(()=>(p||(Ke.context.dataRef.current.openEvent=void 0,$e.pointerType=void 0,$e.interactedInside=!1,$e.restTimeoutPending=!1,$e.openChangeTimeout.clear(),$e.restTimeout.clear()),()=>{_n($e)}),[Ke,$e,p]);let Qe=z(()=>!I||d||!le.current||!oe?null:Mw(le.current,oe,L));function It(){return I&&d?null:le.current?.closest("ul")??null}let vt=nl(Ke,{enabled:we,move:!1,handleClose:il({blockPointerEvents:Ze,getScope:It}),restMs:f&&d?0:T,delay:{close:D},triggerElementRef:le,getHandleCloseContext:Qe}),xt=Xe.useMemo(()=>vt?{reference:vt}:void 0,[vt]),Dt=Do(Ke,{enabled:De,stickIfOpen:ge,toggle:ue}),Xt=Xe.useMemo(()=>Qt(Dt.reference,xt?.reference),[Dt.reference,xt]);U(()=>{ue&&(g(Ke),_.current=X)},[ue,Ke,g,_,X]);function dn(J){ba.flushSync(()=>{let pe=J.currentTarget,Re=_.current?.getBoundingClientRect();if(f&&Re&&X){let Ee=X.getBoundingClientRect(),ye=Ee.left>Re.left,Fe=Ee.top>Re.top;C==="horizontal"&&Ee.left!==Re.left?m(ye?"right":"left"):C==="vertical"&&Ee.top!==Re.top&&m(Fe?"down":"up")}if(J.type!=="click"&&l!=null&&(Ke.context.dataRef.current.openEvent=void 0),!(de==="touch"&&J.type!=="click")&&(l!=null&&J.type!=="keydown"&&u(A,me(J.type==="mouseenter"?te.triggerHover:te.triggerPress,J.nativeEvent)),J.type==="mouseenter"&&Ze&&(!I||!d)&&oe)){let Ee=()=>{let ye=It()??pe.ownerDocument.body;ar($e,{scopeElement:ye,referenceElement:pe,floatingElement:oe})};l!=null&&l!==A?queueMicrotask(Ee):Ee()}})}let Rt=z(J=>{if(a)return;if(!h||!d){dn(J);return}let{width:pe,height:Re}=br(h),Ee=l!=null&&l!==A&&(J.type==="click"||de!=="touch");dn(J),Ee&&(se.current=!0),ee(h,d,pe,Re)}),ft={open:ue,disabled:a};function Se(J){ce(J.pointerType)}function Je(J){Se(J),_n($e)}let rt={tabIndex:0,onMouseEnter:Rt,onClick:Rt,onPointerEnter:Se,onPointerDown:Je,"aria-expanded":ue,"aria-controls":ue?h?.id:void 0,[pa]:"",onFocus(){ue&&M(!1)},onMouseLeave(){l==null&&_n($e)},onKeyDown(J){if(I)return;let pe=k==="rtl"?"ArrowLeft":"ArrowRight",Re=C==="horizontal"&&J.key==="ArrowDown",Ee=C==="vertical"&&J.key===pe;(Re||Ee)&&(u(A,me(te.listNavigation,J.nativeEvent)),Rt(J),Et(J))},onBlur(J){d&&h&&wa({currentTarget:J.currentTarget,relatedTarget:J.relatedTarget},{popupElement:h,rootRef:w,tree:N,nodeId:L})&&u(null,me(te.focusOut,J.nativeEvent))}},{getButtonProps:dt,buttonRef:Wt}=zt({disabled:a,focusableWhenDisabled:!0,native:i}),st=oe;return(0,mo.jsxs)(Xe.Fragment,{children:[(0,mo.jsx)(Ra,{tag:"button",render:o,className:r,style:s,state:ft,stateAttributesMapping:Ks,refs:[n,Ce,Wt],props:[Xt,$?.reference||St,rt,c,dt]}),ue&&(0,mo.jsxs)(Xe.Fragment,{children:[(0,mo.jsx)(on,{ref:x,onFocus:J=>{st&&Mt(J,st)?E.current?.focus():Zn(X)?.focus()}}),(0,mo.jsx)("span",{"aria-owns":v?.id,style:ai}),(0,mo.jsx)(on,{ref:y,onFocus:J=>{if(st&&Mt(J,st))ba.flushSync(()=>{M(!1)}),(R.current||X)?.focus();else{let pe=Xn(X);I&&!d&&st&&pe&&Q(st,pe)&&(pe=Xf(R.current)),pe?.focus(),(!I||d)&&!Q(w.current,pe)&&u(null,me(te.focusOut,J.nativeEvent))}}})]})]})});function Nw(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.left+n.width/2,s=n.top+n.height/2,i=o.left+o.width/2,a=o.top+o.height/2,c=i-r,l=a-s;return Math.abs(c)>=Math.abs(l)?c>=0?"right":"left":l>=0?"bottom":"top"}function Mw(e,t,n){return{placement:Nw(e,t),elements:{domReference:e,floating:t},nodeId:n}}var Qg=b(H(),1);var Ea=b(H(),1),Vl=Ea.createContext(void 0);function Zg(){let e=Ea.useContext(Vl);if(e===void 0)throw new Error(Ae(40));return e}var Fl=b(ie(),1),eh=Qg.forwardRef(function(t,n){let{keepMounted:o=!1,...r}=t,{mounted:s}=ze();return s||o?(0,Fl.jsx)(Vl.Provider,{value:o,children:(0,Fl.jsx)(Ao,{ref:n,...r})}):null});var Hn=b(H(),1),oh=b($n(),1);function th(e){return xl(e,ip)}var Ca=b(H(),1),Hl=Ca.createContext(void 0);function qo(e=!1){let t=Ca.useContext(Hl);if(!t&&!e)throw new Error(Ae(42));return t}var nh={name:"adaptiveOrigin",async fn(e){let{x:t,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:a}=e,c=Oe(r),l=c.getComputedStyle(r);if(!(l.transitionDuration!=="0s"&&l.transitionDuration!==""))return{x:t,y:n,data:pr};let f=await s.getOffsetParent?.(r),p={width:0,height:0};if(i==="fixed"&&c?.visualViewport)p={width:c.visualViewport.width,height:c.visualViewport.height};else if(f===c){let S=ve(r);p={width:S.documentElement.clientWidth,height:S.documentElement.clientHeight}}else await s.isElement?.(f)&&(p=await s.getDimensions(f));let d=Ct(a),m=t,g=n;d==="left"&&(m=p.width-(t+o.width)),d==="top"&&(g=p.height-(n+o.height));let h=d==="left"?"right":pr.sideX,v=d==="top"?"bottom":pr.sideY;return{x:m,y:g,data:{sideX:h,sideY:v}}}};var rh=b(ie(),1),kw=wr(),sh=Hn.forwardRef(function(t,n){let{open:o,mounted:r,positionerElement:s,setPositionerElement:i,floatingRootContext:a,nested:c,transitionStatus:l}=ze(),{className:u,render:f,anchor:p,positionMethod:d="absolute",side:m="bottom",align:g="center",sideOffset:h=0,alignOffset:v=0,collisionBoundary:S="clipping-ancestors",collisionPadding:w=5,collisionAvoidance:x=c?id:ii,arrowPadding:y=5,sticky:R=!1,disableAnchorTracking:E=!1,style:_,...P}=t,O=Zg(),T=Tn(),D=et(),C=et(),[M,I]=Hn.useState(o),A=Hn.useRef(o);Hn.useEffect(()=>{if(!s)return;function q(B){s&&Mt(B)&&(B.type==="focusin"?Gr:ni)(s)}return bt(xe(s,"focusin",q,!0),xe(s,"focusout",q,!0))},[s]);let L=(a||kw).useState("domReferenceElement"),N=th({anchor:p??L,positionMethod:d,mounted:r,side:m,sideOffset:h,align:g,alignOffset:v,arrowPadding:y,collisionBoundary:S,collisionPadding:w,sticky:R,disableAnchorTracking:E,keepMounted:O,floatingRootContext:a,collisionAvoidance:x,shift:{rootBoundary:"layoutViewport"},nodeId:T,adaptiveOrigin:nh}),$={open:o,side:N.side,align:N.align,anchorHidden:N.anchorHidden,instant:M};Hn.useEffect(()=>{if(!o)return;A.current&&D.start(0,()=>{A.current=!1,C.isStarted()||I(!1)});function q(){oh.flushSync(()=>{I(!0)}),C.start(100,()=>{I(!1)})}let B=Oe(s);return xe(B,"resize",q)},[o,D,C,s]);let k=Hi(t,$,{styles:N.positionerStyles,transitionStatus:l,props:P,refs:[n,i],hidden:!r,inert:!o});return(0,rh.jsx)(Hl.Provider,{value:N,children:k})});var _a=b(H(),1);var go=b(ie(),1),Aw=wr();function ih({children:e}){let{beforeInsideRef:t,beforeOutsideRef:n,afterInsideRef:o,afterOutsideRef:r,positionerElement:s,viewportElement:i,floatingRootContext:a}=ze(),c=!!qo(!0),l=s||i;return!a&&!c?e:(0,go.jsxs)(_a.Fragment,{children:[(0,go.jsx)(on,{ref:t,onFocus:u=>{l&&Mt(u,l)?Xn(l)?.focus():n.current?.focus()}}),e,(0,go.jsx)(on,{ref:o,onFocus:u=>{l&&Mt(u,l)?Zn(l)?.focus():r.current?.focus()}})]})}var ah=_a.forwardRef(function(t,n){let{render:o,className:r,style:s,children:i,id:a,...c}=t,l=an(a),{setViewportElement:u,setViewportTargetElement:f,floatingRootContext:p,prevTriggerElementRef:d,viewportInert:m,setViewportInert:g}=ze(),v=!!qo(!0),S=(p||Aw).useState("domReferenceElement");U(()=>{S&&(d.current=S)},[S,d]);let w=ne("div",t,{ref:[n,u],props:[{id:l,onBlur(x){let y=x.relatedTarget,R=x.currentTarget;y&&!Q(R,y)&&y!==S&&g(!0)},...!v&&m&&{inert:io(!0)},children:v?i:(0,go.jsx)(ih,{children:(0,go.jsx)("div",{ref:f,children:i})})},c]});return v?(0,go.jsx)(ih,{children:w}):w});var ch=b(H(),1);var lh=ch.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,{open:a,mounted:c,transitionStatus:l}=ze();return ne("div",t,{state:{open:a,transitionStatus:l},ref:n,props:[{role:"presentation",hidden:!c,style:{userSelect:"none",WebkitUserSelect:"none"}},i],stateAttributesMapping:Kn})});var uh=b(H(),1);var fh=uh.forwardRef(function(t,n){let{render:o,className:r,style:s,id:i,...a}=t,{open:c,transitionStatus:l,setPopupElement:u}=ze(),f=qo(),p=Pn(),d=Tt(i),m={open:c,transitionStatus:l,side:f.side,align:f.align,anchorHidden:f.anchorHidden},g=f.side==="left";p==="rtl"?g=g||f.side==="inline-end":g=g||f.side==="inline-start";let h=f.side==="top"||g;return ne("nav",t,{state:m,ref:[n,u],props:[{id:d,tabIndex:-1,style:h?{position:"absolute",[f.side==="top"?"bottom":"top"]:"0",[g?"right":"left"]:"0"}:{}},co(l),a],stateAttributesMapping:Kn})});var dh=b(H(),1);var ph=dh.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,{open:a,transitionStatus:c}=ze(),{arrowRef:l,side:u,align:f,arrowUncentered:p,arrowStyles:d}=qo();return ne("div",t,{state:{open:a,side:u,align:f,uncentered:p},ref:[n,l],props:[{style:d,"aria-hidden":!0},co(c),i],stateAttributesMapping:qt})});var mh=b(H(),1);var gh=b(ie(),1),hh=mh.forwardRef(function(t,n){let{className:o,render:r,active:s=!1,closeOnClick:i=!1,style:a,...c}=t,{setValue:l,popupElement:u,positionerElement:f,rootRef:p}=ze(),d=Tn(),m=gt();return(0,gh.jsx)(Ra,{tag:"a",render:r,className:o,style:a,state:{active:s},refs:[n],props:[{"aria-current":s?"page":void 0,tabIndex:void 0,onClick(v){i&&l(null,me(te.linkPress,v.nativeEvent))},onBlur(v){f&&u&&wa({currentTarget:v.currentTarget,relatedTarget:v.relatedTarget},{popupElement:u,rootRef:p,tree:m,nodeId:d})&&l(null,me(te.focusOut,v.nativeEvent))}},c]})});var vh=b(H(),1);var xh=vh.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,{value:a}=Rr(),{open:c,value:l}=ze();return ne("span",t,{state:{open:c&&l===a},ref:n,props:[{"aria-hidden":!0,children:"\u25BC"},i],stateAttributesMapping:nr})});var ot=b(ie());function Ul({className:e,children:t,positionerProps:n,container:o,...r}){return(0,ot.jsxs)(Ut.Root,{"data-slot":"navigation-menu",className:Zt("eg-nav-menu",e),...r,children:[t,(0,ot.jsx)(Ut.Portal,{...o!=null?{container:o}:{},children:(0,ot.jsx)(Ut.Positioner,{className:"eg-nav-menu__positioner",sideOffset:4,...n,children:(0,ot.jsx)(Ut.Popup,{className:"eg-nav-menu__popup",children:(0,ot.jsx)(Ut.Viewport,{className:"eg-nav-menu__viewport"})})})})]})}function Bl({className:e,...t}){return(0,ot.jsx)(Ut.List,{"data-slot":"navigation-menu-list",className:Zt("eg-nav-menu__list",e),...t})}function Un({className:e,...t}){return(0,ot.jsx)(Ut.Item,{"data-slot":"navigation-menu-item",className:Zt("eg-nav-menu__item",e),...t})}function Wl({className:e,leadingIcon:t,badge:n,disabled:o,children:r,...s}){return(0,ot.jsxs)(Ut.Trigger,{"data-slot":"navigation-menu-trigger","data-disabled":o||void 0,disabled:o,className:Zt("eg-nav-menu__trigger",e),...s,children:[t!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-icon","aria-hidden":"true",children:t}),(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-label",children:r}),(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-chevron","aria-hidden":"true",children:(0,ot.jsx)(sa,{})}),n!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__badge","aria-label":`${n} notifications`,children:n})]})}function Ko({className:e,leadingIcon:t,children:n,...o}){return(0,ot.jsxs)(Ut.Link,{"data-slot":"navigation-menu-anchor",className:Zt("eg-nav-menu__trigger","eg-nav-menu__anchor",e),...o,children:[t!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-icon","aria-hidden":"true",children:t}),(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-label",children:n})]})}function $l({className:e,...t}){return(0,ot.jsx)(Ut.Content,{"data-slot":"navigation-menu-content",className:Zt("eg-nav-menu__content",e),...t})}function Pa({className:e,leadingIcon:t,trailingIcon:n,active:o,children:r,...s}){return(0,ot.jsxs)(Ut.Link,{"data-slot":"navigation-menu-link",className:Zt("eg-nav-menu__link",o&&"eg-nav-menu__link--active",e),...s,children:[t!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__link-icon","aria-hidden":"true",children:t}),r,n!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__link-icon","aria-hidden":"true",children:n})]})}var jl=b(ie());function zl(e){return(0,jl.jsx)(lt,{...e,children:(0,jl.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.85 4.65L9.35 1.15C9.25 1.05 9.15 1 9 1H4C3.45 1 3 1.45 3 2V14C3 14.55 3.45 15 4 15H12C12.55 15 13 14.55 13 14V5C13 4.85 12.95 4.75 12.85 4.65ZM9 2.2L11.8 5H9V2.2ZM12 14H4V2H8V5C8 5.55 8.45 6 9 6H12V14ZM5 11V12H11V11H5ZM5 9V8H11V9H5Z"})})}var ql=b(ie());function Sh(e){return(0,ql.jsx)(lt,{...e,children:(0,ql.jsx)("path",{d:"M14.5 13.7929L10.7239 10.0169C11.6313 8.92758 12.0838 7.53038 11.9872 6.11596C11.8907 4.70153 11.2525 3.37879 10.2055 2.42288C9.15855 1.46698 7.78335 0.951515 6.366 0.983723C4.94865 1.01593 3.59828 1.59333 2.59581 2.59581C1.59333 3.59828 1.01593 4.94865 0.983723 6.366C0.951515 7.78335 1.46698 9.15855 2.42288 10.2055C3.37879 11.2525 4.70153 11.8907 6.11596 11.9872C7.53038 12.0838 8.92758 11.6313 10.0169 10.7239L13.7929 14.5L14.5 13.7929ZM2 6.5C2 5.60998 2.26392 4.73995 2.75838 3.99993C3.25285 3.25991 3.95565 2.68313 4.77792 2.34254C5.60019 2.00194 6.50499 1.91283 7.3779 2.08646C8.25082 2.2601 9.05264 2.68868 9.68198 3.31802C10.3113 3.94735 10.7399 4.74918 10.9135 5.62209C11.0872 6.495 10.998 7.3998 10.6575 8.22207C10.3169 9.04434 9.74008 9.74714 9.00006 10.2416C8.26004 10.7361 7.39001 11 6.5 11C5.30693 10.9987 4.1631 10.5241 3.31948 9.68052C2.47585 8.83689 2.00132 7.69306 2 6.5Z"})})}var Kl=b(ie());function yh(e){return(0,Kl.jsx)(lt,{...e,children:(0,Kl.jsx)("path",{d:"M13.725 7.555L2.725 2.055C2.63879 2.01189 2.54195 1.99461 2.44614 2.00526C2.35034 2.0159 2.25965 2.05401 2.185 2.115C2.11372 2.17475 2.06051 2.2532 2.03136 2.34153C2.00221 2.42985 1.99828 2.52456 2.02 2.615L3.5 8L2 13.37C1.97962 13.4455 1.97724 13.5248 1.99306 13.6014C2.00887 13.678 2.04245 13.7499 2.09108 13.8111C2.13972 13.8724 2.20205 13.9214 2.27307 13.9542C2.34409 13.987 2.42182 14.0027 2.5 14C2.57827 13.9995 2.65534 13.9807 2.725 13.945L13.725 8.445C13.8069 8.40304 13.8756 8.3393 13.9236 8.26078C13.9716 8.18226 13.997 8.09203 13.997 8C13.997 7.90798 13.9716 7.81774 13.9236 7.73923C13.8756 7.66071 13.8069 7.59696 13.725 7.555ZM3.275 12.555L4.38 8.5H9V7.5H4.38L3.275 3.445L12.38 8L3.275 12.555Z"})})}var Gl=b(ie());function wh(e){return(0,Gl.jsx)(lt,{...e,children:(0,Gl.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.5 7.99996V8.37996L14.445 9.24496C14.6194 9.3979 14.7353 9.60672 14.7727 9.83568C14.8101 10.0646 14.7667 10.2995 14.65 10.5L13.51 12.5C13.4223 12.6518 13.2962 12.778 13.1444 12.8657C12.9926 12.9535 12.8204 12.9998 12.645 13C12.5363 13.0008 12.4282 12.9839 12.325 12.95L11.115 12.54C10.9035 12.6794 10.683 12.8047 10.455 12.915L10.2 14.175C10.1543 14.4052 10.029 14.6119 9.84623 14.7591C9.66341 14.9063 9.43466 14.9845 9.2 14.98H6.84C6.60535 14.9845 6.3766 14.9063 6.19378 14.7591C6.01096 14.6119 5.88573 14.4052 5.84 14.175L5.585 12.915C5.35859 12.8046 5.13977 12.6794 4.93 12.54L3.715 12.95C3.61176 12.9839 3.50368 13.0008 3.395 13C3.21964 12.9998 3.04741 12.9535 2.89559 12.8657C2.74376 12.778 2.61769 12.6518 2.53 12.5L1.35 10.5C1.22795 10.2975 1.18158 10.0583 1.2191 9.82493C1.25663 9.59152 1.37564 9.37896 1.555 9.22496L2.5 8.38496V7.99996V7.61996L1.555 6.75496C1.38057 6.60202 1.26473 6.39319 1.22733 6.16424C1.18993 5.93529 1.2333 5.70045 1.35 5.49996L2.53 3.49996C2.61769 3.34809 2.74376 3.22195 2.89559 3.13419C3.04741 3.04643 3.21964 3.00014 3.395 2.99996C3.50259 2.99264 3.61065 3.00277 3.715 3.02996L4.905 3.45996C5.11649 3.32053 5.33697 3.19526 5.565 3.08496L5.82 1.82496C5.86573 1.59476 5.99096 1.38798 6.17378 1.24081C6.3566 1.09364 6.58535 1.01546 6.82 1.01996H9.16C9.39466 1.01546 9.62341 1.09364 9.80623 1.24081C9.98905 1.38798 10.1143 1.59476 10.16 1.82496L10.415 3.08496C10.6414 3.19529 10.8602 3.32056 11.07 3.45996L12.285 3.04996C12.3882 3.01601 12.4963 2.99913 12.605 2.99996C12.7804 3.00014 12.9526 3.04643 13.1044 3.13419C13.2562 3.22195 13.3823 3.34809 13.47 3.49996L14.65 5.49996C14.7738 5.70075 14.8226 5.93885 14.7879 6.17216C14.7531 6.40547 14.637 6.61898 14.46 6.77496L13.5 7.61496V7.99996ZM10.89 11.42L12.605 12L13.785 9.99996L12.425 8.76496C12.5175 8.24739 12.5175 7.71753 12.425 7.19996L13.785 5.99996L12.605 3.99996L10.885 4.55996C10.4821 4.22453 10.0258 3.95917 9.535 3.77496L9.18 1.99996H6.82L6.465 3.79496C5.97031 3.97409 5.51147 4.23991 5.11 4.57996L3.395 3.99996L2.215 5.99996L3.575 7.23496C3.48255 7.75253 3.48255 8.28239 3.575 8.79996L2.215 9.99996L3.395 12L5.115 11.44C5.51786 11.7754 5.97422 12.0407 6.465 12.225L6.82 14H9.18L9.535 12.205C10.0297 12.0258 10.4885 11.76 10.89 11.42ZM6.33329 10.4944C6.82664 10.8241 7.40666 11 8 11C8.39508 11.004 8.78699 10.9292 9.15278 10.7798C9.51857 10.6305 9.85088 10.4096 10.1303 10.1303C10.4096 9.85088 10.6305 9.51857 10.7798 9.15278C10.9292 8.78699 11.004 8.39508 11 8C11 7.40666 10.8241 6.82664 10.4944 6.33329C10.1648 5.83994 9.69623 5.45543 9.14805 5.22836C8.59987 5.0013 7.99667 4.94189 7.41473 5.05765C6.83279 5.1734 6.29824 5.45912 5.87868 5.87868C5.45912 6.29824 5.1734 6.83279 5.05765 7.41473C4.94189 7.99667 5.0013 8.59987 5.22836 9.14805C5.45543 9.69623 5.83994 10.1648 6.33329 10.4944ZM7.22741 6.1397C7.47284 6.04137 7.73567 5.99384 8 6C8.26433 5.99384 8.52716 6.04137 8.77259 6.1397C9.01803 6.23803 9.24097 6.38512 9.42793 6.57208C9.61488 6.75904 9.76198 6.98197 9.86031 7.22741C9.95864 7.47284 10.0062 7.73567 10 8C10.0062 8.26433 9.95864 8.52716 9.86031 8.77259C9.76198 9.01803 9.61488 9.24097 9.42793 9.42793C9.24097 9.61488 9.01803 9.76198 8.77259 9.86031C8.52716 9.95864 8.26433 10.0062 8 10C7.73567 10.0062 7.47284 9.95864 7.22741 9.86031C6.98197 9.76198 6.75904 9.61488 6.57208 9.42793C6.38512 9.24097 6.23803 9.01803 6.1397 8.77259C6.04137 8.52716 5.99384 8.26433 6 8C5.99384 7.73567 6.04137 7.47284 6.1397 7.22741C6.23803 6.98197 6.38512 6.75904 6.57208 6.57208C6.75904 6.38512 6.98197 6.23803 7.22741 6.1397Z"})})}var Yl=b(ie());function Rh(e){return(0,Yl.jsx)(lt,{...e,children:(0,Yl.jsx)("path",{d:"M8.00001 3.26L9.38001 6.05L9.61001 6.55L10.11 6.625L13.19 7.07L11 9.22L10.625 9.585L10.715 10.085L11.24 13.15L8.48501 11.705L8.00001 11.5L7.53501 11.745L4.78001 13.17L5.28001 10.105L5.37001 9.605L5.00001 9.22L2.79001 7.045L5.87001 6.6L6.37001 6.525L6.60001 6.025L8.00001 3.26ZM8.00001 1L5.72501 5.61L0.640015 6.345L4.32001 9.935L3.45001 15L8.00001 12.61L12.55 15L11.68 9.935L15.36 6.35L10.275 5.61L8.00001 1Z"})})}var Jl=b(ie());function bh(e){return(0,Jl.jsx)(lt,{...e,children:(0,Jl.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2C6.49445 2 6.9778 2.14662 7.38893 2.42133C7.80005 2.69603 8.12048 3.08648 8.3097 3.54329C8.49892 4.00011 8.54843 4.50277 8.45196 4.98773C8.3555 5.47268 8.1174 5.91814 7.76777 6.26777C7.41814 6.6174 6.97268 6.8555 6.48773 6.95196C6.00278 7.04843 5.50011 6.99892 5.04329 6.8097C4.58648 6.62048 4.19603 6.30005 3.92133 5.88893C3.64662 5.4778 3.5 4.99445 3.5 4.5C3.5 3.83696 3.76339 3.20107 4.23223 2.73223C4.70108 2.26339 5.33696 2 6 2ZM6 1C5.30777 1 4.63108 1.20527 4.05551 1.58986C3.47993 1.97444 3.03133 2.52107 2.76642 3.16061C2.50152 3.80015 2.4322 4.50388 2.56725 5.18282C2.7023 5.86175 3.03564 6.48539 3.52513 6.97487C4.01461 7.46436 4.63825 7.7977 5.31719 7.93275C5.99612 8.0678 6.69985 7.99848 7.33939 7.73358C7.97894 7.46867 8.52556 7.02007 8.91015 6.4445C9.29473 5.86892 9.5 5.19223 9.5 4.5C9.5 3.57174 9.13125 2.6815 8.47487 2.02513C7.8185 1.36875 6.92826 1 6 1ZM16 7H14V5H13V7H11V8H13V10H14V8H16V7ZM10 15H11V12.5C11 11.5717 10.6313 10.6815 9.97487 10.0251C9.3185 9.36875 8.42826 9 7.5 9H4.5C3.57174 9 2.6815 9.36875 2.02513 10.0251C1.36875 10.6815 1 11.5717 1 12.5V15H2V12.5C2 11.837 2.26339 11.2011 2.73223 10.7322C3.20107 10.2634 3.83696 10 4.5 10H7.5C8.16304 10 8.79893 10.2634 9.26777 10.7322C9.73661 11.2011 10 11.837 10 12.5V15Z"})})}var Xl=b(ie());function Eh(e){return(0,Xl.jsx)(lt,{...e,children:(0,Xl.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 15H13C13.2652 15 13.5196 14.8946 13.7071 14.7071C13.8946 14.5196 14 14.2652 14 14V2C14 1.73478 13.8946 1.48043 13.7071 1.29289C13.5196 1.10536 13.2652 1 13 1H7C6.73478 1 6.48043 1.10536 6.29289 1.29289C6.10536 1.48043 6 1.73478 6 2V3.5H7V2H13V14H7V12.5H6V14C6 14.2652 6.10536 14.5196 6.29289 14.7071C6.48043 14.8946 6.73478 15 7 15ZM9.085 8.5L7.295 10.295L8 11L11 8L8 5L7.295 5.705L9.085 7.5H2V8.5H9.085Z"})})}var Zl=b(ie());function Ch(e){return(0,Zl.jsx)(lt,{...e,children:(0,Zl.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 15H3C2.73488 14.9997 2.4807 14.8942 2.29323 14.7068C2.10576 14.5193 2.0003 14.2651 2 14V2C2.0003 1.73488 2.10576 1.4807 2.29323 1.29323C2.4807 1.10576 2.73488 1.0003 3 1H9C9.26512 1.0003 9.5193 1.10576 9.70677 1.29323C9.89424 1.4807 9.9997 1.73488 10 2V3.5H9V2H3V14H9V12.5H10V14C9.9997 14.2651 9.89424 14.5193 9.70677 14.7068C9.5193 14.8942 9.26512 14.9997 9 15ZM12.086 8.5L10.293 10.293L11 11L14 8L11 5L10.293 5.707L12.086 7.5H5V8.5H12.086Z"})})}var _h=b(H());var Bt=b(ie());function Ph(e){let t=(0,_h.useId)();return(0,Bt.jsxs)(Su,{viewBox:"0 0 356 86",...e,children:[(0,Bt.jsxs)("g",{clipPath:`url(#${t}c0)`,children:[(0,Bt.jsx)("path",{d:"M33.6 36.5151C33.4 30.13 29.4 26.5383 24 26.5383C17.8 26.5383 13.6 30.3295 12.6 36.5151H33.6ZM24.4 17.3596C38.2 17.3596 45.6 27.3364 45.6 40.1068C45.6 41.5035 45.4 44.6961 45.4 44.6961H12.2C13 53.0766 19.4 57.4664 26.6 57.4664C34.4 57.4664 40.4 52.2784 40.4 52.2784L45 60.8585C45 60.8585 37.6 67.6427 25.8 67.6427C9.8 67.4432 0 55.8701 0 42.3016C0 27.536 10 17.3596 24.4 17.3596Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M69.8 58.065C76.2 58.065 80.6 51.2808 80.6 45.4942V44.297H78.6C72.4 44.297 62.6 45.0951 62.6 51.8794C62.6 55.0719 65 58.065 69.8 58.065ZM79 36.3156H80.6V35.717C80.6 29.3318 76.6 27.3364 71.4 27.3364C64.6 27.3364 58.2 31.9258 58.2 31.9258L53.6 23.3457C53.6 23.3457 61 17.3596 72.4 17.3596C85 17.3596 92.4 24.3434 92.4 36.5151V66.4455H81.4V62.4548C81.4 60.659 81.6 59.0627 81.6 59.0627H81.4C81.4 59.0627 77.8 67.4432 66.8 67.4432C58.2 67.4432 50.6 62.0557 50.6 52.478C50.6 37.3132 71.2 36.3156 79 36.3156Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M105.4 52.0789C105.4 52.0789 110.6 57.2668 118.4 57.2668C121.8 57.2668 124.8 55.6705 124.8 52.877C124.8 45.6937 101.4 46.6914 101.4 31.3271C101.4 22.348 109.4 17.1601 119.8 17.1601C130.6 17.1601 135.8 22.5476 135.8 22.5476L131.4 31.3271C131.4 31.3271 127 27.1369 119.6 27.1369C116.4 27.1369 113.4 28.5336 113.4 31.5267C113.4 38.3109 136.8 37.5128 136.8 52.877C136.8 60.8585 129.8 67.2436 118.4 67.2436C106.4 67.2436 99.8 60.2599 99.8 60.2599L105.4 52.0789Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M143 74.0278C143 74.0278 145.6 76.0232 148.4 76.0232C151.6 76.0232 154.8 74.0278 156.6 69.8376L158.4 65.6473L138.2 18.3573H151.6L161.6 45.8933C162.6 48.4872 163.4 52.2784 163.4 52.2784H163.6C163.6 52.2784 164.4 48.4872 165.2 45.8933L174.6 18.1578H187.6L166.2 73.4292C162.8 82.2088 156.2 86 148.8 86C143 86 138.8 82.8074 138.8 82.8074L143 74.0278Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M225.6 41.3039C225.6 30.3295 220.2 27.536 213.8 27.536C206.6 27.536 202.6 32.7239 202.6 40.9049C202.6 49.2854 207 55.471 214.6 55.471C220.2 55.2715 225.6 52.0789 225.6 41.3039ZM211.8 75.8237C219.2 75.8237 225.4 72.6311 225.4 64.2506V61.4571C225.4 60.2599 225.6 58.8631 225.6 58.8631H225.4C222.6 63.0534 218.4 65.2483 212 65.2483C198.2 65.2483 190.4 54.0742 190.4 41.1044C190.4 27.935 197.8 17.1601 211.6 17.1601C222 17.1601 225.8 23.3457 225.8 23.3457H226C226 23.3457 226 22.7471 226 21.949V18.3573H237.2V63.2529C237.2 79.6148 224.4 85.8005 211.8 85.8005C205.8 85.8005 199.4 84.2042 194.8 81.6102L198.4 72.4316C198.4 72.8306 204.6 75.8237 211.8 75.8237Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M272.4 57.2668C280.2 57.2668 286.6 51.2808 286.6 42.3016C286.6 33.5221 280.2 27.3364 272.4 27.3364C264.6 27.3364 258 33.5221 258 42.3016C258 51.2808 264.6 57.2668 272.4 57.2668ZM272.2 17.3596C286.8 17.3596 298.6 27.7355 298.6 42.5012C298.6 57.2668 286.8 67.6427 272.2 67.6427C257.6 67.6427 245.8 57.2668 245.8 42.5012C246 27.7355 257.6 17.3596 272.2 17.3596Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M300.8 18.3573H313.4L323.4 48.0882C324.4 50.8817 325 55.2715 325 55.2715H325.2C325.2 55.2715 326 50.8817 326.8 48.0882L342.8 0H355.4L332.2 66.2459H318L300.8 18.3573Z",fill:"#FF2D16"})]}),(0,Bt.jsx)("defs",{children:(0,Bt.jsx)("clipPath",{id:`${t}c0`,children:(0,Bt.jsx)("rect",{width:"356",height:"86",fill:"white"})})})]})}var Go=class extends Error{};Go.prototype.name="InvalidTokenError";function Dw(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function Lw(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Dw(t)}catch{return atob(t)}}function Th(e,t){if(typeof e!="string")throw new Go("Invalid token specified: must be a string");t||(t={});let n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new Go(`Invalid token specified: missing part #${n+1}`);let r;try{r=Lw(o)}catch(s){throw new Go(`Invalid token specified: invalid base64 for part #${n+1} (${s.message})`)}try{return JSON.parse(r)}catch(s){throw new Go(`Invalid token specified: invalid json for part #${n+1} (${s.message})`)}}var Vw={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},On,Nn,Ia=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(Ia||{});(e=>{function t(){On=3,Nn=Vw}e.reset=t;function n(r){if(!(0<=r&&r<=4))throw new Error("Invalid log level");On=r}e.setLevel=n;function o(r){Nn=r}e.setLogger=o})(Ia||(Ia={}));var ke=class In{constructor(t){this._name=t}debug(...t){On>=4&&Nn.debug(In._format(this._name,this._method),...t)}info(...t){On>=3&&Nn.info(In._format(this._name,this._method),...t)}warn(...t){On>=2&&Nn.warn(In._format(this._name,this._method),...t)}error(...t){On>=1&&Nn.error(In._format(this._name,this._method),...t)}throw(t){throw this.error(t),t}create(t){let n=Object.create(this);return n._method=t,n.debug("begin"),n}static createStatic(t,n){let o=new In(`${t}.${n}`);return o.debug("begin"),o}static _format(t,n){let o=`[${t}]`;return n?`${o} ${n}:`:o}static debug(t,...n){On>=4&&Nn.debug(In._format(t),...n)}static info(t,...n){On>=3&&Nn.info(In._format(t),...n)}static warn(t,...n){On>=2&&Nn.warn(In._format(t),...n)}static error(t,...n){On>=1&&Nn.error(In._format(t),...n)}};Ia.reset();var ms=class{static decode(e){try{return Th(e)}catch(t){throw ke.error("JwtUtils.decode",t),t}}static async generateSignedJwt(e,t,n){let o=ut.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))),r=ut.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))),s=`${o}.${r}`,i=await window.crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},n,new TextEncoder().encode(s)),a=ut.encodeBase64Url(new Uint8Array(i));return`${s}.${a}`}static async generateSignedJwtWithHmac(e,t,n){let o=ut.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))),r=ut.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))),s=`${o}.${r}`,i=await window.crypto.subtle.sign("HMAC",n,new TextEncoder().encode(s)),a=ut.encodeBase64Url(new Uint8Array(i));return`${s}.${a}`}},Fw="10000000-1000-4000-8000-100000000000",tu=e=>btoa([...new Uint8Array(e)].map(t=>String.fromCharCode(t)).join("")),kh=class vn{static _randomWord(){let t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]}static generateUUIDv4(){return Fw.replace(/[018]/g,n=>(+n^vn._randomWord()&15>>+n/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return vn.generateUUIDv4()+vn.generateUUIDv4()+vn.generateUUIDv4()}static async generateCodeChallenge(t){if(!crypto.subtle)throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");try{let o=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",o);return tu(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(n){throw ke.error("CryptoUtils.generateCodeChallenge",n),n}}static generateBasicAuth(t,n){let r=new TextEncoder().encode([t,n].join(":"));return tu(r)}static async hash(t,n){let o=new TextEncoder().encode(n),r=await crypto.subtle.digest(t,o);return new Uint8Array(r)}static async customCalculateJwkThumbprint(t){let n;switch(t.kty){case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"oct":n={crv:t.k,kty:t.kty};break;default:throw new Error("Unknown jwk type")}let o=await vn.hash("SHA-256",JSON.stringify(n));return vn.encodeBase64Url(o)}static async generateDPoPProof({url:t,accessToken:n,httpMethod:o,keyPair:r,nonce:s}){let i,a,c={jti:window.crypto.randomUUID(),htm:o??"GET",htu:t,iat:Math.floor(Date.now()/1e3)};n&&(i=await vn.hash("SHA-256",n),a=vn.encodeBase64Url(i),c.ath=a),s&&(c.nonce=s);try{let l=await crypto.subtle.exportKey("jwk",r.publicKey),u={alg:"ES256",typ:"dpop+jwt",jwk:{crv:l.crv,kty:l.kty,x:l.x,y:l.y}};return await ms.generateSignedJwt(u,c,r.privateKey)}catch(l){throw l instanceof TypeError?new Error(`Error exporting dpop public key: ${l.message}`):l}}static async generateDPoPJkt(t){try{let n=await crypto.subtle.exportKey("jwk",t.publicKey);return await vn.customCalculateJwkThumbprint(n)}catch(n){throw n instanceof TypeError?new Error(`Could not retrieve dpop keys from storage: ${n.message}`):n}}static async generateDPoPKeys(){return await window.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"])}static async generateClientAssertionJwt(t,n,o,r="HS256"){let s=Math.floor(Date.now()/1e3),i={alg:r,typ:"JWT"},a={iss:t,sub:t,aud:o,jti:vn.generateUUIDv4(),exp:s+300,iat:s},l={HS256:"SHA-256",HS384:"SHA-384",HS512:"SHA-512"}[r];if(!l)throw new Error(`Unsupported algorithm: ${r}. Supported algorithms are: HS256, HS384, HS512`);let u=new TextEncoder,f=await crypto.subtle.importKey("raw",u.encode(n),{name:"HMAC",hash:l},!1,["sign"]);return await ms.generateSignedJwtWithHmac(i,a,f)}};kh.encodeBase64Url=e=>tu(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");var ut=kh,ho=class{constructor(e){this._name=e,this._callbacks=[],this._logger=new ke(`Event('${this._name}')`)}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){let t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}async raise(...e){this._logger.debug("raise:",...e);for(let t of this._callbacks)await t(...e)}},Ih=class{static center({...e}){var t,n,o;return e.width==null&&(e.width=(t=[800,720,600,480].find(r=>r<=window.outerWidth/1.618))!=null?t:360),(n=e.left)!=null||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),e.height!=null&&((o=e.top)!=null||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}=${typeof n!="boolean"?n:n?"yes":"no"}`).join(",")}},Bn=class Ta extends ho{constructor(){super(...arguments),this._logger=new ke(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{let t=this._expiration-Ta.getEpochTime();this._logger.debug("timer completes in",t),this._expiration<=Ta.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(t){let n=this._logger.create("init");t=Math.max(Math.floor(t),1);let o=Ta.getEpochTime()+t;if(this.expiration===o&&this._timerHandle){n.debug("skipping since already initialized for expiration at",this.expiration);return}this.cancel(),n.debug("using duration",t),this._expiration=o;let r=Math.min(t,5);this._timerHandle=setInterval(this._callback,r*1e3)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},nu=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");let o=new URL(e,"http://127.0.0.1")[t==="fragment"?"hash":"search"];return new URLSearchParams(o.slice(1))}},Er=";",Yo=class extends Error{constructor(e,t){var n,o,r;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw ke.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=(n=e.error_description)!=null?n:null,this.error_uri=(o=e.error_uri)!=null?o:null,this.state=e.userState,this.session_state=(r=e.session_state)!=null?r:null,this.url_state=e.url_state}},au=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},Hw=class{constructor(e){this._logger=new ke("AccessTokenEvents"),this._expiringTimer=new Bn("Access token expiring"),this._expiredTimer=new Bn("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}async load(e){let t=this._logger.create("load");if(e.access_token&&e.expires_in!==void 0){let n=e.expires_in;if(t.debug("access token present, remaining duration:",n),n>0){let r=n-this._expiringNotificationTimeInSeconds;r<=0&&(r=1),t.debug("registering expiring timer, raising in",r,"seconds"),this._expiringTimer.init(r)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();let o=n+1;t.debug("registering expired timer, raising in",o,"seconds"),this._expiredTimer.init(o)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}async unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},Uw=class{constructor(e,t,n,o,r){this._callback=e,this._client_id=t,this._intervalInSeconds=o,this._stopOnError=r,this._logger=new ke("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=i=>{i.origin===this._frame_origin&&i.source===this._frame.contentWindow&&(i.data==="error"?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):i.data==="changed"?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(i.data+" message from check session op iframe"))};let s=new URL(n);this._frame_origin=s.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=s.href}load(){return new Promise(e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;let t=()=>{!this._frame.contentWindow||!this._session_state||this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,this._intervalInSeconds*1e3)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},Na=class{constructor(){this._logger=new ke("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},ou=class extends Error{constructor(e,t){super(t),this.name="ErrorDPoPNonce",this.nonce=e}},cu=class{constructor(e=[],t=null,n={}){this._jwtHandler=t,this._extraHeaders=n,this._logger=new ke("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){let{timeoutInSeconds:n,...o}=t;if(!n)return await fetch(e,o);let r=new AbortController,s=setTimeout(()=>r.abort(),n*1e3);try{return await fetch(e,{...t,signal:r.signal})}catch(i){throw i instanceof DOMException&&i.name==="AbortError"?new au("Network timed out"):i}finally{clearTimeout(s)}}async getJson(e,{token:t,credentials:n,timeoutInSeconds:o}={}){let r=this._logger.create("getJson"),s={Accept:this._contentTypes.join(", ")};t&&(r.debug("token passed, setting Authorization header"),s.Authorization="Bearer "+t),this._appendExtraHeaders(s);let i;try{r.debug("url:",e),i=await this.fetchWithTimeout(e,{method:"GET",headers:s,timeoutInSeconds:o,credentials:n})}catch(l){throw r.error("Network Error"),l}r.debug("HTTP response received, status",i.status);let a=i.headers.get("Content-Type");if(a&&!this._contentTypes.find(l=>a.startsWith(l))&&r.throw(new Error(`Invalid response Content-Type: ${a??"undefined"}, from URL: ${e}`)),i.ok&&this._jwtHandler&&a?.startsWith("application/jwt"))return await this._jwtHandler(await i.text());let c;try{c=await i.json()}catch(l){throw r.error("Error parsing JSON response",l),i.ok?l:new Error(`${i.statusText} (${i.status})`)}if(!i.ok)throw r.error("Error from server:",c),c.error?new Yo(c):new Error(`${i.statusText} (${i.status}): ${JSON.stringify(c)}`);return c}async postForm(e,{body:t,basicAuth:n,timeoutInSeconds:o,initCredentials:r,extraHeaders:s}){let i=this._logger.create("postForm"),a={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded",...s};n!==void 0&&(a.Authorization="Basic "+n),this._appendExtraHeaders(a);let c;try{i.debug("url:",e),c=await this.fetchWithTimeout(e,{method:"POST",headers:a,body:t,timeoutInSeconds:o,credentials:r})}catch(p){throw i.error("Network error"),p}i.debug("HTTP response received, status",c.status);let l=c.headers.get("Content-Type");if(l&&!this._contentTypes.find(p=>l.startsWith(p)))throw new Error(`Invalid response Content-Type: ${l??"undefined"}, from URL: ${e}`);let u=await c.text(),f={};if(u)try{f=JSON.parse(u)}catch(p){throw i.error("Error parsing JSON response",p),c.ok?p:new Error(`${c.statusText} (${c.status})`)}if(!c.ok){if(i.error("Error from server:",f),c.headers.has("dpop-nonce")){let p=c.headers.get("dpop-nonce");throw new ou(p,`${JSON.stringify(f)}`)}throw f.error?new Yo(f,t):new Error(`${c.statusText} (${c.status}): ${JSON.stringify(f)}`)}return f}_appendExtraHeaders(e){let t=this._logger.create("appendExtraHeaders"),n=Object.keys(this._extraHeaders),o=["accept","content-type"],r=["authorization"];n.length!==0&&n.forEach(s=>{if(o.includes(s.toLocaleLowerCase())){t.warn("Protected header could not be set",s,o);return}if(r.includes(s.toLocaleLowerCase())&&Object.keys(e).includes(s)){t.warn("Header could not be overridden",s,r);return}let i=typeof this._extraHeaders[s]=="function"?this._extraHeaders[s]():this._extraHeaders[s];i&&i!==""&&(e[s]=i)})}},Bw=class{constructor(e){this._settings=e,this._logger=new ke("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new cu(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){let e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);let t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},t,this._settings.metadataSeed),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){let n=this._logger.create(`_getMetadataProperty('${e}')`),o=await this.getMetadata();if(n.debug("resolved"),o[e]===void 0){if(t===!0){n.warn("Metadata does not contain optional property");return}n.throw(new Error("Metadata does not contain property "+e))}return o[e]}async getSigningKeys(){let e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;let t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);let n=await this._jsonService.getJson(t,{timeoutInSeconds:this._settings.requestTimeoutInSeconds});if(e.debug("got key set",n),!Array.isArray(n.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=n.keys,this._signingKeys}},Ma=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new ke("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){return this._logger.create(`get('${e}')`),e=this._prefix+e,await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;let t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");let e=await this._store.length,t=[];for(let n=0;n<e;n++){let o=await this._store.key(n);o&&o.indexOf(this._prefix)===0&&t.push(o.substr(this._prefix.length))}return t}},Ww="code",$w="openid",jw="client_secret_post",zw=900,ru=class{constructor({authority:e,metadataUrl:t,metadata:n,signingKeys:o,metadataSeed:r,client_id:s,client_secret:i,response_type:a=Ww,scope:c=$w,redirect_uri:l,post_logout_redirect_uri:u,client_authentication:f=jw,token_endpoint_auth_signing_alg:p="HS256",prompt:d,display:m,max_age:g,ui_locales:h,acr_values:v,resource:S,response_mode:w,filterProtocolClaims:x=!0,loadUserInfo:y=!1,requestTimeoutInSeconds:R,staleStateAgeInSeconds:E=zw,mergeClaimsStrategy:_={array:"replace"},disablePKCE:P=!1,stateStore:O,revokeTokenAdditionalContentTypes:T,fetchRequestCredentials:D,refreshTokenAllowedScope:C,extraQueryParams:M={},extraTokenParams:I={},extraHeaders:A={},dpop:L,omitScopeWhenRequesting:N=!1}){var $;if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=n,this.metadataSeed=r,this.signingKeys=o,this.client_id=s,this.client_secret=i,this.response_type=a,this.scope=c,this.redirect_uri=l,this.post_logout_redirect_uri=u,this.client_authentication=f,this.token_endpoint_auth_signing_alg=p,this.prompt=d,this.display=m,this.max_age=g,this.ui_locales=h,this.acr_values=v,this.resource=S,this.response_mode=w,this.filterProtocolClaims=x??!0,this.loadUserInfo=!!y,this.staleStateAgeInSeconds=E,this.mergeClaimsStrategy=_,this.omitScopeWhenRequesting=N,this.disablePKCE=!!P,this.revokeTokenAdditionalContentTypes=T,this.fetchRequestCredentials=D||"same-origin",this.requestTimeoutInSeconds=R,O)this.stateStore=O;else{let k=typeof window<"u"?window.localStorage:new Na;this.stateStore=new Ma({store:k})}if(this.refreshTokenAllowedScope=C,this.extraQueryParams=M,this.extraTokenParams=I,this.extraHeaders=A,this.dpop=L,this.dpop&&!(($=this.dpop)!=null&&$.store))throw new Error("A DPoPStore is required when dpop is enabled")}},qw=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new ke("UserInfoService"),this._getClaimsFromJwt=async n=>{let o=this._logger.create("_getClaimsFromJwt");try{let r=ms.decode(n);return o.debug("JWT decoding successful"),r}catch(r){throw o.error("Error parsing JWT response"),r}},this._jsonService=new cu(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){let t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));let n=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",n);let o=await this._jsonService.getJson(n,{token:e,credentials:this._settings.fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return t.debug("got claims",o),o}},Ah=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new ke("TokenClient"),this._jsonService=new cu(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:n=this._settings.client_id,client_secret:o=this._settings.client_secret,extraHeaders:r,...s}){let i=this._logger.create("exchangeCode");n||i.throw(new Error("A client_id is required")),t||i.throw(new Error("A redirect_uri is required")),s.code||i.throw(new Error("A code is required"));let a=new URLSearchParams({grant_type:e,redirect_uri:t});for(let[f,p]of Object.entries(s))p!=null&&a.set(f,p);if((this._settings.client_authentication==="client_secret_basic"||this._settings.client_authentication==="client_secret_jwt")&&o==null)throw i.throw(new Error("A client_secret is required")),null;let c,l=await this._metadataService.getTokenEndpoint(!1);switch(this._settings.client_authentication){case"client_secret_basic":c=ut.generateBasicAuth(n,o);break;case"client_secret_post":a.append("client_id",n),o&&a.append("client_secret",o);break;case"client_secret_jwt":{let f=await ut.generateClientAssertionJwt(n,o,l,this._settings.token_endpoint_auth_signing_alg);a.append("client_id",n),a.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),a.append("client_assertion",f);break}}i.debug("got token endpoint");let u=await this._jsonService.postForm(l,{body:a,basicAuth:c,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return i.debug("got response"),u}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,scope:o=this._settings.scope,...r}){let s=this._logger.create("exchangeCredentials");t||s.throw(new Error("A client_id is required"));let i=new URLSearchParams({grant_type:e});this._settings.omitScopeWhenRequesting||i.set("scope",o);for(let[u,f]of Object.entries(r))f!=null&&i.set(u,f);if((this._settings.client_authentication==="client_secret_basic"||this._settings.client_authentication==="client_secret_jwt")&&n==null)throw s.throw(new Error("A client_secret is required")),null;let a,c=await this._metadataService.getTokenEndpoint(!1);switch(this._settings.client_authentication){case"client_secret_basic":a=ut.generateBasicAuth(t,n);break;case"client_secret_post":i.append("client_id",t),n&&i.append("client_secret",n);break;case"client_secret_jwt":{let u=await ut.generateClientAssertionJwt(t,n,c,this._settings.token_endpoint_auth_signing_alg);i.append("client_id",t),i.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.append("client_assertion",u);break}}s.debug("got token endpoint");let l=await this._jsonService.postForm(c,{body:i,basicAuth:a,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials});return s.debug("got response"),l}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,timeoutInSeconds:o,extraHeaders:r,...s}){let i=this._logger.create("exchangeRefreshToken");t||i.throw(new Error("A client_id is required")),s.refresh_token||i.throw(new Error("A refresh_token is required"));let a=new URLSearchParams({grant_type:e});for(let[f,p]of Object.entries(s))Array.isArray(p)?p.forEach(d=>a.append(f,d)):p!=null&&a.set(f,p);if((this._settings.client_authentication==="client_secret_basic"||this._settings.client_authentication==="client_secret_jwt")&&n==null)throw i.throw(new Error("A client_secret is required")),null;let c,l=await this._metadataService.getTokenEndpoint(!1);switch(this._settings.client_authentication){case"client_secret_basic":c=ut.generateBasicAuth(t,n);break;case"client_secret_post":a.append("client_id",t),n&&a.append("client_secret",n);break;case"client_secret_jwt":{let f=await ut.generateClientAssertionJwt(t,n,l,this._settings.token_endpoint_auth_signing_alg);a.append("client_id",t),a.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),a.append("client_assertion",f);break}}i.debug("got token endpoint");let u=await this._jsonService.postForm(l,{body:a,basicAuth:c,timeoutInSeconds:o,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return i.debug("got response"),u}async revoke(e){var t;let n=this._logger.create("revoke");e.token||n.throw(new Error("A token is required"));let o=await this._metadataService.getRevocationEndpoint(!1);n.debug(`got revocation endpoint, revoking ${(t=e.token_type_hint)!=null?t:"default token type"}`);let r=new URLSearchParams;for(let[s,i]of Object.entries(e))i!=null&&r.set(s,i);r.set("client_id",this._settings.client_id),this._settings.client_secret&&r.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(o,{body:r,timeoutInSeconds:this._settings.requestTimeoutInSeconds}),n.debug("got response")}},Kw=class{constructor(e,t,n){this._settings=e,this._metadataService=t,this._claimsService=n,this._logger=new ke("ResponseValidator"),this._userInfoService=new qw(this._settings,this._metadataService),this._tokenClient=new Ah(this._settings,this._metadataService)}async validateSigninResponse(e,t,n){let o=this._logger.create("validateSigninResponse");this._processSigninState(e,t),o.debug("state processed"),await this._processCode(e,t,n),o.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e,"",t.nonce),o.debug("tokens validated"),await this._processClaims(e,t?.skipUserInfo,e.isOpenId),o.debug("claims processed")}async validateCredentialsResponse(e,t){let n=this._logger.create("validateCredentialsResponse"),o=e.isOpenId&&!!e.id_token;o&&this._validateIdTokenAttributes(e),n.debug("tokens validated"),await this._processClaims(e,t,o),n.debug("claims processed")}async validateRefreshResponse(e,t){var n,o;let r=this._logger.create("validateRefreshResponse");e.userState=t.data,(n=e.session_state)!=null||(e.session_state=t.session_state),(o=e.scope)!=null||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),r.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);let s=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,s),r.debug("claims processed")}validateSignoutResponse(e,t){let n=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&n.throw(new Error("State does not match")),n.debug("state validated"),e.userState=t.data,e.error)throw n.warn("Response was error",e.error),new Yo(e)}_processSigninState(e,t){var n;let o=this._logger.create("_processSigninState");if(t.id!==e.state&&o.throw(new Error("State does not match")),t.client_id||o.throw(new Error("No client_id on state")),t.authority||o.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&o.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&o.throw(new Error("client_id mismatch on settings vs. signin state")),o.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,(n=e.scope)!=null||(e.scope=t.scope),e.error)throw o.warn("Response was error",e.error),new Yo(e);t.code_verifier&&!e.code&&o.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,n=!0){let o=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token){o.debug("not loading user info");return}o.debug("loading user info");let r=await this._userInfoService.getClaims(e.access_token);o.debug("user info claims received from user info endpoint"),n&&r.sub!==e.profile.sub&&o.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(r)),o.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t,n){let o=this._logger.create("_processCode");if(e.code){o.debug("Validating code");let r=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,extraHeaders:n,...t.extraTokenParams});Object.assign(e,r)}else o.debug("No code to process")}_validateIdTokenAttributes(e,t,n){var o;let r=this._logger.create("_validateIdTokenAttributes");r.debug("decoding ID Token JWT");let s=ms.decode((o=e.id_token)!=null?o:"");if(s.sub||r.throw(new Error("ID Token is missing a subject claim")),n&&s.nonce!==n&&r.throw(new Error("nonce in id_token does not match nonce in client storage")),t){let i=ms.decode(t);s.sub!==i.sub&&r.throw(new Error("sub in id_token does not match current sub")),s.auth_time&&s.auth_time!==i.auth_time&&r.throw(new Error("auth_time in id_token does not match original auth_time")),s.azp&&s.azp!==i.azp&&r.throw(new Error("azp in id_token does not match original azp")),!s.azp&&i.azp&&r.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=s}},Oa=class su{constructor(t){this.id=t.id||ut.generateUUIDv4(),this.data=t.data,t.created&&t.created>0?this.created=t.created:this.created=Bn.getEpochTime(),this.request_type=t.request_type,this.url_state=t.url_state}toStorageString(){return new ke("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(t){return ke.createStatic("State","fromStorageString"),Promise.resolve(new su(JSON.parse(t)))}static async clearStaleState(t,n){let o=ke.createStatic("State","clearStaleState"),r=Bn.getEpochTime()-n,s=await t.getAllKeys();o.debug("got keys",s);for(let i=0;i<s.length;i++){let a=s[i],c=await t.get(a),l=!1;if(c)try{let u=await su.fromStorageString(c);o.debug("got item from key:",a,u.created),u.created<=r&&(l=!0)}catch(u){o.error("Error parsing state for key:",a,u),l=!0}else o.debug("no item in storage for key:",a),l=!0;l&&(o.debug("removed item for key:",a),t.remove(a))}}},Dh=class iu extends Oa{constructor(t){super(t),this.code_verifier=t.code_verifier,this.code_challenge=t.code_challenge,this.authority=t.authority,this.client_id=t.client_id,this.redirect_uri=t.redirect_uri,this.scope=t.scope,this.client_secret=t.client_secret,this.extraTokenParams=t.extraTokenParams,this.response_mode=t.response_mode,this.skipUserInfo=t.skipUserInfo,this.nonce=t.nonce}static async create(t){let n=t.code_verifier===!0?ut.generateCodeVerifier():t.code_verifier||void 0,o=n?await ut.generateCodeChallenge(n):void 0;return new iu({...t,code_verifier:n,code_challenge:o})}toStorageString(){return new ke("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo,nonce:this.nonce})}static fromStorageString(t){ke.createStatic("SigninState","fromStorageString");let n=JSON.parse(t);return iu.create(n)}},Lh=class Vh{constructor(t){this.url=t.url,this.state=t.state}static async create({url:t,authority:n,client_id:o,redirect_uri:r,response_type:s,scope:i,state_data:a,response_mode:c,request_type:l,client_secret:u,nonce:f,url_state:p,resource:d,skipUserInfo:m,extraQueryParams:g,extraTokenParams:h,disablePKCE:v,dpopJkt:S,omitScopeWhenRequesting:w,...x}){if(!t)throw this._logger.error("create: No url passed"),new Error("url");if(!o)throw this._logger.error("create: No client_id passed"),new Error("client_id");if(!r)throw this._logger.error("create: No redirect_uri passed"),new Error("redirect_uri");if(!s)throw this._logger.error("create: No response_type passed"),new Error("response_type");if(!i)throw this._logger.error("create: No scope passed"),new Error("scope");if(!n)throw this._logger.error("create: No authority passed"),new Error("authority");let y=await Dh.create({data:a,request_type:l,url_state:p,code_verifier:!v,client_id:o,authority:n,redirect_uri:r,response_mode:c,client_secret:u,scope:i,extraTokenParams:h,skipUserInfo:m,nonce:f}),R=new URL(t);R.searchParams.append("client_id",o),R.searchParams.append("redirect_uri",r),R.searchParams.append("response_type",s),w||R.searchParams.append("scope",i),f&&R.searchParams.append("nonce",f),S&&R.searchParams.append("dpop_jkt",S);let E=y.id;p&&(E=`${E}${Er}${p}`),R.searchParams.append("state",E),y.code_challenge&&(R.searchParams.append("code_challenge",y.code_challenge),R.searchParams.append("code_challenge_method","S256")),d&&(Array.isArray(d)?d:[d]).forEach(P=>R.searchParams.append("resource",P));for(let[_,P]of Object.entries({response_mode:c,...x,...g}))P!=null&&R.searchParams.append(_,P.toString());return new Vh({url:R.href,state:y})}};Lh._logger=new ke("SigninRequest");var Gw=Lh,Yw="openid",Ql=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){let t=decodeURIComponent(this.state).split(Er);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(Er))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-Bn.getEpochTime()}set expires_in(e){typeof e=="string"&&(e=Number(e)),e!==void 0&&e>=0&&(this.expires_at=Math.floor(e)+Bn.getEpochTime())}get isOpenId(){var e;return((e=this.scope)==null?void 0:e.split(" ").includes(Yw))||!!this.id_token}},Jw=class{constructor({url:e,state_data:t,id_token_hint:n,post_logout_redirect_uri:o,extraQueryParams:r,request_type:s,client_id:i,url_state:a}){if(this._logger=new ke("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");let c=new URL(e);if(n&&c.searchParams.append("id_token_hint",n),i&&c.searchParams.append("client_id",i),o&&(c.searchParams.append("post_logout_redirect_uri",o),t||a)){this.state=new Oa({data:t,request_type:s,url_state:a});let l=this.state.id;a&&(l=`${l}${Er}${a}`),c.searchParams.append("state",l)}for(let[l,u]of Object.entries({...r}))u!=null&&c.searchParams.append(l,u.toString());this.url=c.href}},Xw=class{constructor(e){if(this.state=e.get("state"),this.state){let t=decodeURIComponent(this.state).split(Er);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(Er))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},Zw=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],Qw=["sub","iss","aud","exp","iat"],eR=class{constructor(e){this._settings=e,this._logger=new ke("ClaimsService")}filterProtocolClaims(e){let t={...e};if(this._settings.filterProtocolClaims){let n;Array.isArray(this._settings.filterProtocolClaims)?n=this._settings.filterProtocolClaims:n=Zw;for(let o of n)Qw.includes(o)||delete t[o]}return t}mergeClaims(e,t){let n={...e};for(let[o,r]of Object.entries(t))if(n[o]!==r)if(Array.isArray(n[o])||Array.isArray(r))if(this._settings.mergeClaimsStrategy.array=="replace")n[o]=r;else{let s=Array.isArray(n[o])?n[o]:[n[o]];for(let i of Array.isArray(r)?r:[r])s.includes(i)||s.push(i);n[o]=s}else typeof n[o]=="object"&&typeof r=="object"?n[o]=this.mergeClaims(n[o],r):n[o]=r;return n}},Fh=class{constructor(e,t){this.keys=e,this.nonce=t}},tR=class{constructor(e,t){this._logger=new ke("OidcClient"),this.settings=e instanceof ru?e:new ru(e),this.metadataService=t??new Bw(this.settings),this._claimsService=new eR(this.settings),this._validator=new Kw(this.settings,this.metadataService,this._claimsService),this._tokenClient=new Ah(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:n,request_type:o,id_token_hint:r,login_hint:s,skipUserInfo:i,nonce:a,url_state:c,response_type:l=this.settings.response_type,scope:u=this.settings.scope,redirect_uri:f=this.settings.redirect_uri,prompt:p=this.settings.prompt,display:d=this.settings.display,max_age:m=this.settings.max_age,ui_locales:g=this.settings.ui_locales,acr_values:h=this.settings.acr_values,resource:v=this.settings.resource,response_mode:S=this.settings.response_mode,extraQueryParams:w=this.settings.extraQueryParams,extraTokenParams:x=this.settings.extraTokenParams,dpopJkt:y,omitScopeWhenRequesting:R=this.settings.omitScopeWhenRequesting}){let E=this._logger.create("createSigninRequest");if(l!=="code")throw new Error("Only the Authorization Code flow (with PKCE) is supported");let _=await this.metadataService.getAuthorizationEndpoint();E.debug("Received authorization endpoint",_);let P=await Gw.create({url:_,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:f,response_type:l,scope:u,state_data:e,url_state:c,prompt:p,display:d,max_age:m,ui_locales:g,id_token_hint:r,login_hint:s,acr_values:h,dpopJkt:y,resource:v,request:t,request_uri:n,extraQueryParams:w,extraTokenParams:x,request_type:o,response_mode:S,client_secret:this.settings.client_secret,skipUserInfo:i,nonce:a,disablePKCE:this.settings.disablePKCE,omitScopeWhenRequesting:R});await this.clearStaleState();let O=P.state;return await this.settings.stateStore.set(O.id,O.toStorageString()),P}async readSigninResponseState(e,t=!1){let n=this._logger.create("readSigninResponseState"),o=new Ql(nu.readParams(e,this.settings.response_mode));if(!o.state)throw n.throw(new Error("No state in response")),null;let r=await this.settings.stateStore[t?"remove":"get"](o.state);if(!r)throw n.throw(new Error("No matching state found in storage")),null;return{state:await Dh.fromStorageString(r),response:o}}async processSigninResponse(e,t,n=!0){let o=this._logger.create("processSigninResponse"),{state:r,response:s}=await this.readSigninResponseState(e,n);if(o.debug("received state from storage; validating response"),this.settings.dpop&&this.settings.dpop.store){let i=await this.getDpopProof(this.settings.dpop.store);t={...t,DPoP:i}}try{await this._validator.validateSigninResponse(s,r,t)}catch(i){if(i instanceof ou&&this.settings.dpop){let a=await this.getDpopProof(this.settings.dpop.store,i.nonce);t.DPoP=a,await this._validator.validateSigninResponse(s,r,t)}else throw i}return s}async getDpopProof(e,t){let n,o;return(await e.getAllKeys()).includes(this.settings.client_id)?(o=await e.get(this.settings.client_id),o.nonce!==t&&t&&(o.nonce=t,await e.set(this.settings.client_id,o))):(n=await ut.generateDPoPKeys(),o=new Fh(n,t),await e.set(this.settings.client_id,o)),await ut.generateDPoPProof({url:await this.metadataService.getTokenEndpoint(!1),httpMethod:"POST",keyPair:o.keys,nonce:o.nonce})}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n=!1,extraTokenParams:o={}}){let r=await this._tokenClient.exchangeCredentials({username:e,password:t,...o}),s=new Ql(new URLSearchParams);return Object.assign(s,r),await this._validator.validateCredentialsResponse(s,n),s}async useRefreshToken({state:e,redirect_uri:t,resource:n,timeoutInSeconds:o,extraHeaders:r,extraTokenParams:s}){var i;let a=this._logger.create("useRefreshToken"),c;if(this.settings.refreshTokenAllowedScope===void 0)c=e.scope;else{let f=this.settings.refreshTokenAllowedScope.split(" ");c=(((i=e.scope)==null?void 0:i.split(" "))||[]).filter(d=>f.includes(d)).join(" ")}if(this.settings.dpop&&this.settings.dpop.store){let f=await this.getDpopProof(this.settings.dpop.store);r={...r,DPoP:f}}let l;try{l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:c,redirect_uri:t,resource:n,timeoutInSeconds:o,extraHeaders:r,...s})}catch(f){if(f instanceof ou&&this.settings.dpop)r.DPoP=await this.getDpopProof(this.settings.dpop.store,f.nonce),l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:c,redirect_uri:t,resource:n,timeoutInSeconds:o,extraHeaders:r,...s});else throw f}let u=new Ql(new URLSearchParams);return Object.assign(u,l),a.debug("validating response",u),await this._validator.validateRefreshResponse(u,{...e,scope:c}),u}async createSignoutRequest({state:e,id_token_hint:t,client_id:n,request_type:o,url_state:r,post_logout_redirect_uri:s=this.settings.post_logout_redirect_uri,extraQueryParams:i=this.settings.extraQueryParams}={}){let a=this._logger.create("createSignoutRequest"),c=await this.metadataService.getEndSessionEndpoint();if(!c)throw a.throw(new Error("No end session endpoint")),null;a.debug("Received end session endpoint",c),!n&&s&&!t&&(n=this.settings.client_id);let l=new Jw({url:c,id_token_hint:t,client_id:n,post_logout_redirect_uri:s,state_data:e,extraQueryParams:i,request_type:o,url_state:r});await this.clearStaleState();let u=l.state;return u&&(a.debug("Signout request has state to persist"),await this.settings.stateStore.set(u.id,u.toStorageString())),l}async readSignoutResponseState(e,t=!1){let n=this._logger.create("readSignoutResponseState"),o=new Xw(nu.readParams(e,this.settings.response_mode));if(!o.state){if(n.debug("No state in response"),o.error)throw n.warn("Response was error:",o.error),new Yo(o);return{state:void 0,response:o}}let r=await this.settings.stateStore[t?"remove":"get"](o.state);if(!r)throw n.throw(new Error("No matching state found in storage")),null;return{state:await Oa.fromStorageString(r),response:o}}async processSignoutResponse(e){let t=this._logger.create("processSignoutResponse"),{state:n,response:o}=await this.readSignoutResponseState(e,!0);return n?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(o,n)):t.debug("No state from storage; skipping response validation"),o}clearStaleState(){return this._logger.create("clearStaleState"),Oa.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},nR=class{constructor(e){this._userManager=e,this._logger=new ke("SessionMonitor"),this._start=async t=>{let n=t.session_state;if(!n)return;let o=this._logger.create("_start");if(t.profile?(this._sub=t.profile.sub,o.debug("session_state",n,", sub",this._sub)):(this._sub=void 0,o.debug("session_state",n,", anonymous user")),this._checkSessionIFrame){this._checkSessionIFrame.start(n);return}try{let r=await this._userManager.metadataService.getCheckSessionIframe();if(r){o.debug("initializing check session iframe");let s=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,a=this._userManager.settings.stopCheckSessionOnError,c=new Uw(this._callback,s,r,i,a);await c.load(),this._checkSessionIFrame=c,c.start(n)}else o.warn("no check session iframe found in the metadata")}catch(r){o.error("Error from getCheckSessionIframe:",r instanceof Error?r.message:r)}},this._stop=()=>{let t=this._logger.create("_stop");if(this._sub=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){let n=setInterval(async()=>{clearInterval(n);try{let o=await this._userManager.querySessionStatus();if(o){let r={session_state:o.session_state,profile:o.sub?{sub:o.sub}:null};this._start(r)}}catch(o){t.error("error from querySessionStatus",o instanceof Error?o.message:o)}},1e3)}},this._callback=async()=>{let t=this._logger.create("_callback");try{let n=await this._userManager.querySessionStatus(),o=!0;n&&this._checkSessionIFrame?n.sub===this._sub?(o=!1,this._checkSessionIFrame.start(n.session_state),t.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",n.session_state),await this._userManager.events._raiseUserSessionChanged()):t.debug("different subject signed into OP",n.sub):t.debug("subject no longer signed into OP"),o?this._sub?await this._userManager.events._raiseUserSignedOut():await this._userManager.events._raiseUserSignedIn():t.debug("no change in session detected, no event to raise")}catch(n){this._sub&&(t.debug("Error calling queryCurrentSigninSession; raising signed out event",n),await this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch(t=>{this._logger.error(t)})}async _init(){this._logger.create("_init");let e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){let t=await this._userManager.querySessionStatus();if(t){let n={session_state:t.session_state,profile:t.sub?{sub:t.sub}:null};this._start(n)}}}},eu=class Hh{constructor(t){var n;this.id_token=t.id_token,this.session_state=(n=t.session_state)!=null?n:null,this.access_token=t.access_token,this.refresh_token=t.refresh_token,this.token_type=t.token_type,this.scope=t.scope,this.profile=t.profile,this.expires_at=t.expires_at,this.state=t.userState,this.url_state=t.url_state}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-Bn.getEpochTime()}set expires_in(t){t!==void 0&&(this.expires_at=Math.floor(t)+Bn.getEpochTime())}get expired(){let t=this.expires_in;if(t!==void 0)return t<=0}get scopes(){var t,n;return(n=(t=this.scope)==null?void 0:t.split(" "))!=null?n:[]}toStorageString(){return new ke("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(t){return ke.createStatic("User","fromStorageString"),new Hh(JSON.parse(t))}},Oh="oidc-client",Uh=class{constructor(){this._abort=new ho("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){let t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);let{url:n,keepOpen:o}=await new Promise((r,s)=>{let i=c=>{var l;let u=c.data,f=(l=e.scriptOrigin)!=null?l:window.location.origin;if(!(c.origin!==f||u?.source!==Oh)){try{let p=nu.readParams(u.url,e.response_mode).get("state");if(p||t.warn("no state found in response url"),c.source!==this._window&&p!==e.state)return}catch{this._dispose(),s(new Error("Invalid response from window"))}r(u)}};window.addEventListener("message",i,!1),this._disposeHandlers.add(()=>window.removeEventListener("message",i,!1));let a=new BroadcastChannel(`oidc-client-popup-${e.state}`);a.addEventListener("message",i,!1),this._disposeHandlers.add(()=>a.close()),this._disposeHandlers.add(this._abort.addHandler(c=>{this._dispose(),s(c)}))});return t.debug("got response from window"),this._dispose(),o||this.close(),{url:n}}_dispose(){this._logger.create("_dispose");for(let e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,n=!1,o=window.location.origin){let r={source:Oh,url:t,keepOpen:n},s=new ke("_notifyParent");if(e)s.debug("With parent. Using parent.postMessage."),e.postMessage(r,o);else{s.debug("No parent. Using BroadcastChannel.");let i=new URL(t).searchParams.get("state");if(!i)throw new Error("No parent and no state in URL. Can't complete notification.");let a=new BroadcastChannel(`oidc-client-popup-${i}`);a.postMessage(r),a.close()}}},Bh={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},Wh="_blank",oR=60,rR=2,$h=10,sR=class extends ru{constructor(e){let{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:n=e.post_logout_redirect_uri,popupWindowFeatures:o=Bh,popupWindowTarget:r=Wh,redirectMethod:s="assign",redirectTarget:i="self",iframeNotifyParentOrigin:a=e.iframeNotifyParentOrigin,iframeScriptOrigin:c=e.iframeScriptOrigin,requestTimeoutInSeconds:l,silent_redirect_uri:u=e.redirect_uri,silentRequestTimeoutInSeconds:f,automaticSilentRenew:p=!0,validateSubOnSilentRenew:d=!0,includeIdTokenInSilentRenew:m=!1,monitorSession:g=!1,monitorAnonymousSession:h=!1,checkSessionIntervalInSeconds:v=rR,query_status_response_type:S="code",stopCheckSessionOnError:w=!0,revokeTokenTypes:x=["access_token","refresh_token"],revokeTokensOnSignout:y=!1,includeIdTokenInSilentSignout:R=!1,accessTokenExpiringNotificationTimeInSeconds:E=oR,maxSilentRenewTimeoutRetries:_,userStore:P}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=n,this.popupWindowFeatures=o,this.popupWindowTarget=r,this.redirectMethod=s,this.redirectTarget=i,this.iframeNotifyParentOrigin=a,this.iframeScriptOrigin=c,this.silent_redirect_uri=u,this.silentRequestTimeoutInSeconds=f||l||$h,this.automaticSilentRenew=p,this.validateSubOnSilentRenew=d,this.includeIdTokenInSilentRenew=m,this.monitorSession=g,this.monitorAnonymousSession=h,this.checkSessionIntervalInSeconds=v,this.stopCheckSessionOnError=w,this.query_status_response_type=S,this.revokeTokenTypes=x,this.revokeTokensOnSignout=y,this.includeIdTokenInSilentSignout=R,this.accessTokenExpiringNotificationTimeInSeconds=E,this.maxSilentRenewTimeoutRetries=_,P)this.userStore=P;else{let O=typeof window<"u"?window.sessionStorage:new Na;this.userStore=new Ma({store:O})}}},Nh=class jh extends Uh{constructor({silentRequestTimeoutInSeconds:t=$h}){super(),this._logger=new ke("IFrameWindow"),this._timeoutInSeconds=t,this._frame=jh.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){let t=window.document.createElement("iframe");return t.style.visibility="hidden",t.style.position="fixed",t.style.left="-1000px",t.style.top="0",t.width="0",t.height="0",window.document.body.appendChild(t),t}async navigate(t){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);let n=setTimeout(()=>{this._abort.raise(new au("IFrame timed out without a response"))},this._timeoutInSeconds*1e3);return this._disposeHandlers.add(()=>clearTimeout(n)),await super.navigate(t)}close(){var t;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",n=>{var o;let r=n.target;(o=r.parentNode)==null||o.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))},!0),(t=this._frame.contentWindow)==null||t.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(t,n){return super._notifyParent(window.parent,t,!1,n)}},iR=class{constructor(e){this._settings=e,this._logger=new ke("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new Nh({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),Nh.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},aR=500,cR=1e3,Mh=class extends Uh{constructor({popupWindowTarget:e=Wh,popupWindowFeatures:t={},popupSignal:n,popupAbortOnClose:o}){super(),this._logger=new ke("PopupWindow");let r=Ih.center({...Bh,...t});this._window=window.open(void 0,e,Ih.serialize(r)),this.abortOnClose=!!o,n&&n.addEventListener("abort",()=>{var s;this._abort.raise(new Error((s=n.reason)!=null?s:"Popup aborted"))}),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{if(!this._window||typeof this._window.closed!="boolean"||this._window.closed){this._abort.raise(new Error("Popup blocked by user"));return}this.close()},t.closePopupWindowAfterInSeconds*cR)}async navigate(e){var t;(t=this._window)==null||t.focus();let n=setInterval(()=>{(!this._window||this._window.closed)&&(this._logger.debug("Popup closed by user or isolated by redirect"),o(),this._disposeHandlers.delete(o),this.abortOnClose&&this._abort.raise(new Error("Popup closed by user")))},aR),o=()=>clearInterval(n);return this._disposeHandlers.add(o),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){super._notifyParent(window.opener,e,t),!t&&!window.opener&&window.close()}},lR=class{constructor(e){this._settings=e,this._logger=new ke("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget,popupSignal:n,popupAbortOnClose:o}){return new Mh({popupWindowFeatures:e,popupWindowTarget:t,popupSignal:n,popupAbortOnClose:o})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),Mh.notifyOpener(e,t)}},uR=class{constructor(e){this._settings=e,this._logger=new ke("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var n;this._logger.create("prepare");let o=window.self;t==="top"&&(o=(n=window.top)!=null?n:window.self);let r=o.location[e].bind(o.location),s;return{navigate:async i=>(this._logger.create("navigate"),await new Promise((c,l)=>{s=l,window.addEventListener("pageshow",()=>c(window.location.href)),r(i.url)})),close:()=>{this._logger.create("close"),s?.(new Error("Redirect aborted")),o.stop()}}}async callback(){}},fR=class extends Hw{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new ke("UserManagerEvents"),this._userLoaded=new ho("User loaded"),this._userUnloaded=new ho("User unloaded"),this._silentRenewError=new ho("Silent renew error"),this._userSignedIn=new ho("User signed in"),this._userSignedOut=new ho("User signed out"),this._userSessionChanged=new ho("User session changed")}async load(e,t=!0){await super.load(e),t&&await this._userLoaded.raise(e)}async unload(){await super.unload(),await this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}async _raiseSilentRenewError(e){await this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}async _raiseUserSignedIn(){await this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}async _raiseUserSignedOut(){await this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}async _raiseUserSessionChanged(){await this._userSessionChanged.raise()}},dR=class{constructor(e){this._userManager=e,this._logger=new ke("SilentRenewService"),this._isStarted=!1,this._retryTimer=new Bn("Retry Silent Renew"),this._timeoutRetryCount=0,this._tokenExpiring=async()=>{let t=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),this._timeoutRetryCount=0,t.debug("silent token renewal successful")}catch(n){if(n instanceof au){this._timeoutRetryCount++;let o=this._userManager.settings.maxSilentRenewTimeoutRetries;if(o!==void 0&&this._timeoutRetryCount>o){t.error(`Timeout retry limit reached (${this._timeoutRetryCount} > ${o}), raising silentRenewError:`,n),this._timeoutRetryCount=0,await this._userManager.events._raiseSilentRenewError(n);return}t.warn(`ErrorTimeout from signinSilent (attempt ${this._timeoutRetryCount}), retry in 5s:`,n),this._retryTimer.init(5);return}t.error("Error from signinSilent:",n),this._timeoutRetryCount=0,await this._userManager.events._raiseSilentRenewError(n)}}}async start(){let e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},pR=class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}},zh=class{constructor(e,t,n,o){this._logger=new ke("UserManager"),this.settings=new sR(e),this._client=new tR(e),this._redirectNavigator=t??new uR(this.settings),this._popupNavigator=n??new lR(this.settings),this._iframeNavigator=o??new iR(this.settings),this._events=new fR(this.settings),this._silentRenewService=new dR(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new nR(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(e=!1){let t=this._logger.create("getUser"),n=await this._loadUser();return n?(t.info("user loaded"),await this._events.load(n,e),n):(t.info("user not found in storage"),null)}async removeUser(){let e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),await this._events.unload()}async signinRedirect(e={}){var t;this._logger.create("signinRedirect");let{redirectMethod:n,...o}=e,r;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(r=await this.generateDPoPJkt(this.settings.dpop));let s=await this._redirectNavigator.prepare({redirectMethod:n});await this._signinStart({request_type:"si:r",dpopJkt:r,...o},s)}async signinRedirectCallback(e=window.location.href){let t=this._logger.create("signinRedirectCallback"),n=await this._signinEnd(e);return n.profile&&n.profile.sub?t.info("success, signed in subject",n.profile.sub):t.info("no subject"),n}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:n=!1}){let o=this._logger.create("signinResourceOwnerCredential"),r=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n,extraTokenParams:this.settings.extraTokenParams});o.debug("got signin response");let s=await this._buildUser(r);return s.profile&&s.profile.sub?o.info("success, signed in subject",s.profile.sub):o.info("no subject"),s}async signinPopup(e={}){var t;let n=this._logger.create("signinPopup"),o;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(o=await this.generateDPoPJkt(this.settings.dpop));let{popupWindowFeatures:r,popupWindowTarget:s,popupSignal:i,popupAbortOnClose:a,...c}=e,l=this.settings.popup_redirect_uri;l||n.throw(new Error("No popup_redirect_uri configured"));let u=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:s,popupSignal:i,popupAbortOnClose:a}),f=await this._signin({request_type:"si:p",redirect_uri:l,display:"popup",dpopJkt:o,...c},u);return f&&(f.profile&&f.profile.sub?n.info("success, signed in subject",f.profile.sub):n.info("no subject")),f}async signinPopupCallback(e=window.location.href,t=!1){let n=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async signinSilent(e={}){var t,n;let o=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:r,...s}=e,i=await this._loadUser();if(!e.forceIframeAuth&&i?.refresh_token){o.debug("using refresh token");let f=new pR(i);return await this._useRefreshToken({state:f,redirect_uri:s.redirect_uri,resource:s.resource,extraTokenParams:s.extraTokenParams,timeoutInSeconds:r})}let a;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(a=await this.generateDPoPJkt(this.settings.dpop));let c=this.settings.silent_redirect_uri;c||o.throw(new Error("No silent_redirect_uri configured"));let l;i&&this.settings.validateSubOnSilentRenew&&(o.debug("subject prior to silent renew:",i.profile.sub),l=i.profile.sub);let u=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r});return i=await this._signin({request_type:"si:s",redirect_uri:c,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?i?.id_token:void 0,dpopJkt:a,...s},u,l),i&&((n=i.profile)!=null&&n.sub?o.info("success, signed in subject",i.profile.sub):o.info("no subject")),i}async _useRefreshToken(e){let t=await this._client.useRefreshToken({timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds,...e}),n=new eu({...e.state,...t});return await this.storeUser(n),await this._events.load(n),n}async signinSilentCallback(e=window.location.href){let t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){let{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":await this.signinPopupCallback(e);break;case"si:s":await this.signinSilentCallback(e);break;default:throw new Error("invalid request_type in state")}}async signoutCallback(e=window.location.href,t=!1){let{state:n}=await this._client.readSignoutResponseState(e);if(n)switch(n.request_type){case"so:r":return await this.signoutRedirectCallback(e);case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid request_type in state")}}async querySessionStatus(e={}){let t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:n,...o}=e,r=this.settings.silent_redirect_uri;r||t.throw(new Error("No silent_redirect_uri configured"));let s=await this._loadUser(),i=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n}),a=await this._signinStart({request_type:"si:s",redirect_uri:r,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?s?.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...o},i);try{let c={},l=await this._client.processSigninResponse(a.url,c);return t.debug("got signin response"),l.session_state&&l.profile.sub?(t.info("success for subject",l.profile.sub),{session_state:l.session_state,sub:l.profile.sub}):(t.info("success, user not authenticated"),null)}catch(c){if(this.settings.monitorAnonymousSession&&c instanceof Yo)switch(c.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:c.session_state}}throw c}}async _signin(e,t,n){let o=await this._signinStart(e,t);return await this._signinEnd(o.url,n)}async _signinStart(e,t){let n=this._logger.create("_signinStart");try{let o=await this._client.createSigninRequest(e);return n.debug("got signin request"),await t.navigate({url:o.url,state:o.state.id,response_mode:o.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(o){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),o}}async _signinEnd(e,t){let n=this._logger.create("_signinEnd"),o={},r=await this._client.processSigninResponse(e,o);return n.debug("got signin response"),await this._buildUser(r,t)}async _buildUser(e,t){let n=this._logger.create("_buildUser"),o=new eu(e);if(t){if(t!==o.profile.sub)throw n.debug("current user does not match user returned from signin. sub from signin:",o.profile.sub),new Yo({...e,error:"login_required"});n.debug("current user matches user returned from signin")}return await this.storeUser(o),n.debug("user stored"),await this._events.load(o),o}async signoutRedirect(e={}){let t=this._logger.create("signoutRedirect"),{redirectMethod:n,...o}=e,r=await this._redirectNavigator.prepare({redirectMethod:n});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...o},r),t.info("success")}async signoutRedirectCallback(e=window.location.href){let t=this._logger.create("signoutRedirectCallback"),n=await this._signoutEnd(e);return t.info("success"),n}async signoutPopup(e={}){let t=this._logger.create("signoutPopup"),{popupWindowFeatures:n,popupWindowTarget:o,popupSignal:r,...s}=e,i=this.settings.popup_post_logout_redirect_uri,a=await this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:o,popupSignal:r});await this._signout({request_type:"so:p",post_logout_redirect_uri:i,state:i==null?void 0:{},...s},a),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){let n=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async _signout(e,t){let n=await this._signoutStart(e,t);return await this._signoutEnd(n.url)}async _signoutStart(e={},t){var n;let o=this._logger.create("_signoutStart");try{let r=await this._loadUser();o.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(r);let s=e.id_token_hint||r&&r.id_token;s&&(o.debug("setting id_token_hint in signout request"),e.id_token_hint=s),await this.removeUser(),o.debug("user removed, creating signout request");let i=await this._client.createSignoutRequest(e);return o.debug("got signout request"),await t.navigate({url:i.url,state:(n=i.state)==null?void 0:n.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(r){throw o.debug("error after preparing navigator, closing navigator window"),t.close(),r}}async _signoutEnd(e){let t=this._logger.create("_signoutEnd"),n=await this._client.processSignoutResponse(e);return t.debug("got signout response"),n}async signoutSilent(e={}){var t;let n=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:o,...r}=e,s=this.settings.includeIdTokenInSilentSignout?(t=await this._loadUser())==null?void 0:t.id_token:void 0,i=this.settings.popup_post_logout_redirect_uri,a=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:o});await this._signout({request_type:"so:s",post_logout_redirect_uri:i,id_token_hint:s,...r},a),n.info("success")}async signoutSilentCallback(e=window.location.href){let t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){let t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){let n=this._logger.create("_revokeInternal");if(!e)return;let o=t.filter(r=>typeof e[r]=="string");if(!o.length){n.debug("no need to revoke due to no token(s)");return}for(let r of o)await this._client.revokeToken(e[r],r),n.info(`${r} revoked successfully`),r!=="access_token"&&(e[r]=null);await this.storeUser(e),n.debug("user stored"),await this._events.load(e)}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){let e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),eu.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){let t=this._logger.create("storeUser");if(e){t.debug("storing user");let n=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,n)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey),this.settings.dpop&&await this.settings.dpop.store.remove(this.settings.client_id)}async clearStaleState(){await this._client.clearStaleState()}async dpopProof(e,t,n,o){var r,s;let i=await((s=(r=this.settings.dpop)==null?void 0:r.store)==null?void 0:s.get(this.settings.client_id));if(i)return await ut.generateDPoPProof({url:e,accessToken:t?.access_token,httpMethod:n,keyPair:i.keys,nonce:o})}async generateDPoPJkt(e){let t=await e.store.get(this.settings.client_id);if(!t){let n=await ut.generateDPoPKeys();t=new Fh(n),await e.store.set(this.settings.client_id,t)}return await ut.generateDPoPJkt(t.keys)}};typeof window<"u"&&window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason.message:"";e.reason instanceof TypeError&&(t==="Load failed"||t==="Failed to fetch")&&(e.preventDefault(),console.info("[easygov-header] suppressed background OIDC fetch error:",t))});var mR="core",Wn=null,ka=!1,xo="initializing",uu=new Set,Jt=null,Gh=!1;function gs(){for(let e of[...uu])e(Wn)}function vo(e){xo!==e&&(xo=e,gs())}function lu(e){if(e===null||e.expired===!0){Wn!==null&&(Wn=null,gs());return}let t=e.profile,n=t.sub??"",o=t.name??t.preferred_username??"(unknown)";Wn={user:{sub:n,name:o},accessToken:e.access_token},xo="authenticated",gs()}function gR(){let e=Va()??"",t=_r()??"",n=typeof window<"u"?window.location.origin+window.location.pathname:"",o=e?{authorization_endpoint:`${e}/protocol/openid-connect/auth`,token_endpoint:`${e}/protocol/openid-connect/token`,end_session_endpoint:`${e}/protocol/openid-connect/logout`,userinfo_endpoint:`${e}/protocol/openid-connect/userinfo`,check_session_iframe:`${e}/protocol/openid-connect/login-status-iframe.html`,jwks_uri:`${e}/protocol/openid-connect/certs`}:void 0;return{authority:e,client_id:mR,redirect_uri:n,silent_redirect_uri:`${t}/oidc-silent.html`,iframeScriptOrigin:t,post_logout_redirect_uri:ws()??n,scope:"openid profile email",automaticSilentRenew:!0,monitorSession:!0,metadata:o,userStore:new Ma({store:new Na})}}var hR=["code","state","session_state","iss","error","error_description","error_uri"];function vR(e){return/[?&](code|error)=/.test(e)}function qh(){if(typeof window>"u")return;let e=new URL(window.location.href),t=!1;for(let n of hR)e.searchParams.has(n)&&(e.searchParams.delete(n),t=!0);t&&window.history.replaceState({},document.title,e.pathname+e.search+e.hash)}function xR(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}function Kh(){Gh=!0,ka=!0,vo("no-auth")}async function Yh(){if(Jt!==null||Gh)return;if(!Va()){Kh();return}if(typeof window<"u"&&xR()&&vR(window.location.search))return;try{Jt=new zh(gR())}catch{Kh();return}Jt.events.addUserLoaded(n=>lu(n)),Jt.events.addUserUnloaded(()=>{xo!=="signing-out"&&vo("unauthenticated"),lu(null)}),Jt.events.addAccessTokenExpired(()=>vo("renewing")),Jt.events.addSilentRenewError(()=>vo("renewing")),Jt.events.addUserSignedOut(()=>{vo("unauthenticated"),lu(null)});let e=typeof window<"u"?window.location.search:"";if(typeof window<"u"&&/[?&]code=/.test(e)&&/[?&]state=/.test(e)){try{await Jt.signinCallback()}catch{}qh(),ka=!0,xo=Wn!==null?"authenticated":"unauthenticated",gs();return}let t=!1;if(typeof window<"u"&&/[?&]error=/.test(e)&&(t=!0,qh()),!t)try{await Jt.signinSilent()}catch{}ka=!0,xo=Wn!==null?"authenticated":"unauthenticated",gs()}function Jh(){return ka}function fu(){return Wn?.accessToken??null}function Xh(){return Wn?.user??null}function Zh(e){return uu.add(e),()=>{uu.delete(e)}}function Qh(){Jt!==null&&(vo("signing-in"),Jt.signinRedirect())}function ev(){Jt!==null&&(vo("signing-out"),Jt.signoutRedirect())}typeof window<"u"&&window.addEventListener("pageshow",e=>{e.persisted&&(xo==="signing-in"||xo==="signing-out")&&vo(Wn!==null?"authenticated":"unauthenticated")});var SR=new Set(["customer","process","parentprocess"]);function yR(){return typeof window>"u"?[]:window.location.pathname.split("/").filter(Boolean)}function rv(){let e=yR(),t=e.findIndex(o=>SR.has(o)),n=t===-1?void 0:e[t+1];return n?{type:e[t],id:decodeURIComponent(n)}:null}var tv=null,Aa=null;function wR(e,t){return e===null||t===null?e===t:e.type===t.type&&e.id===t.id}function sv(){let e=typeof window>"u"?"":window.location.pathname;if(e===tv)return Aa;tv=e;let t=rv();return wR(t,Aa)||(Aa=t),Aa}function iv(){return null}function av(){return typeof window>"u"?"":window.location.pathname}function cv(){return""}var hs=new Set,nv=!1,du=!1;function RR(){if(du=!1,hs.size!==0)for(let e of[...hs])e()}function ov(){du||hs.size===0||(du=!0,queueMicrotask(RR))}function bR(){if(!nv){nv=!0;for(let e of["pushState","replaceState"]){let t=window.history[e].bind(window.history);window.history[e]=(n,o,r)=>{t(n,o,r),ov()}}window.addEventListener("popstate",ov)}}function pu(e){return bR(),hs.add(e),()=>{hs.delete(e)}}var uv={contextJwt:null,claims:null},lv=uv,ER=new Set;function fv(e,t){if(e!==lv.contextJwt){lv=e===null?uv:{contextJwt:e,claims:t};for(let n of[...ER])n()}}var CR=new Set(["type","title","status","detail","instance","errorCode","traceId","timestamp"]);async function dv(e){try{let t=await e.json();return typeof t!="object"||t===null||Array.isArray(t)?null:t}catch{return null}}function pv(e,t){let n=typeof e?.traceId=="string"&&e.traceId!==""?e.traceId:void 0,o=typeof e?.errorCode=="string"&&e.errorCode!==""?e.errorCode:void 0,r=o==="customer-account-not-accessible"?nt("errorCustomerAccountNotAccessible",t):nt("errorFallbackMessage",t),s=n!==void 0?`${nt("errorReference",t)}: ${n}${o!==void 0?` (${o})`:""}`:void 0,i=e?Object.fromEntries(Object.entries(e).filter(([c])=>!CR.has(c))):{},a=Object.keys(i).length>0?i:void 0;return{title:nt("errorTitle",t),message:r,reference:s,details:a}}var ae=b(ie()),mu=()=>()=>{};function vs(e){let t=(0,Te.useRef)(e);return(0,Te.useEffect)(()=>{t.current=e},[e]),t}var gv={user:null,accessToken:null},xs=gv;function _R(){let e=Xh(),t=fu();return e===xs.user&&t===xs.accessToken||(xs={user:e,accessToken:t}),xs}function hv(e){return Zh(()=>e())}function vv(){return(0,Te.useSyncExternalStore)(hv,_R,()=>gv)}function xv(){return(0,Te.useSyncExternalStore)(qa,ja,Hu)}function Sv(){return(0,Te.useSyncExternalStore)(Cu,_u,Pu)}function PR(){return(0,Te.useSyncExternalStore)(pu,sv,iv)}function TR(){return(0,Te.useSyncExternalStore)(pu,av,cv)}function mv(e){try{let t=e.split(".")[1];if(!t)return null;let n=t.replace(/-/g,"+").replace(/_/g,"/"),o=n+"=".repeat((4-n.length%4)%4),r=atob(o),s=Uint8Array.from(r,a=>a.charCodeAt(0)),i=new TextDecoder().decode(s);return JSON.parse(i)}catch{return null}}function IR(e,t){let[n,o]=(0,Te.useState)(null),[r,s]=(0,Te.useState)(0),[i,a]=(0,Te.useState)(null),c=e.user?.sub??null;(0,Te.useEffect)(()=>{if(c===null){o(null),s(0),a(null);return}let f=fu(),p=Rs();if(!f||!p)return;let d=new AbortController;return(async()=>{try{let m=`${window.location.origin}${t}`,g=await fetch(`${p}/external/bff/api/v1/header-context`,{method:"POST",headers:{Authorization:`Bearer ${f}`,Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({screenUrl:m}),signal:d.signal});if(d.signal.aborted)return;if(!g.ok){console.warn(`[easygov-header] getHeaderContext returned ${g.status}`);let S=await dv(g);if(d.signal.aborted)return;a({problem:S});return}let h=await g.json();if(d.signal.aborted)return;if(mv(h.contextJwt)===null){console.warn("[easygov-header] failed to decode contextJwt payload"),a({problem:null});return}o(h.contextJwt),s(h.accessibleAccountCount),a(null)}catch(m){m.name!=="AbortError"&&(console.error("[easygov-header] getHeaderContext failed",m),a({problem:null}))}})(),()=>d.abort()},[c,t]);let l=(0,Te.useMemo)(()=>n!==null?mv(n):null,[n]),u=(0,Te.useCallback)(()=>a(null),[]);return{claims:l,contextJwt:n,accessibleAccountCount:r,contextError:i,dismissContextError:u}}function Mn(e,t){return`${e?.replace(/\/+$/,"")??""}${t}`}function So(e,t){return n=>{e(t)&&n.preventDefault()}}function OR({initializing:e,user:t,onLogin:n,onLogout:o,dashboardPath:r,favoritesPath:s,companyPath:i,servicesPath:a,profilePath:c,coreOrigin:l,infoOrigin:u,infoHomePath:f,versionsInfoText:p,environmentStage:d,userDisplayName:m,companyLabel:g,accessibleAccountCount:h,onNavigate:v,locale:S,onLocaleChange:w,portalContainer:x,headerRef:y,announcement:R}){let[E,_]=(0,Te.useState)(!1),[P,O]=(0,Te.useState)(!1);(0,Te.useEffect)(()=>{let L=N=>{N.persisted&&(_(!1),O(!1))};return window.addEventListener("pageshow",L),()=>window.removeEventListener("pageshow",L)},[]);let T=()=>{_(!0),n()},D=()=>{O(!0),o()},C=t!==null,M=C?Ch:Eh,I=nt(C?"logout":"login",S),A=`/select-account?returnTo=${encodeURIComponent(Mn(l,"/dashboard"))}`;return(0,ae.jsxs)("header",{ref:y,className:"eg-header",role:"banner","data-slot":"header",children:[(0,ae.jsx)("a",{href:"#main-content",className:"eg-header__skip-link",children:nt("skipToMain",S)}),(0,ae.jsx)(vu,{className:"eg-header__grid",children:(0,ae.jsxs)(xu,{className:"eg-header__content",children:[(0,ae.jsxs)("div",{className:"eg-header__left",children:[(0,ae.jsxs)("div",{className:"eg-header__brand-group",children:[(0,ae.jsx)("div",{className:"eg-header__brand-clip",children:(0,ae.jsx)("a",{href:Mn(u,f),className:"eg-header__brand","aria-label":"EasyGov",title:p,"data-slot":"header-logo",children:(0,ae.jsx)(Ph,{height:24})})}),d!==null&&(0,ae.jsxs)("span",{className:"eg-header__env-badge","data-slot":"header-environment-badge",title:p,children:[nt("testEnvironment",S),": ",d]})]}),(0,ae.jsx)("nav",{className:"eg-header__nav","aria-label":"Main navigation",children:(0,ae.jsx)(Ul,{container:x,children:(0,ae.jsxs)(Bl,{children:[C&&h>0&&(0,ae.jsx)(Un,{value:"dashboard",children:(0,ae.jsx)(Ko,{href:Mn(l,r),onClick:So(v,r),leadingIcon:(0,ae.jsx)(yh,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-dashboard",children:nt("dashboard",S)})}),C&&h>0&&(0,ae.jsx)(Un,{value:"favorites",children:(0,ae.jsx)(Ko,{href:Mn(l,s),onClick:So(v,s),leadingIcon:(0,ae.jsx)(Rh,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-favorites",children:nt("myFavorites",S)})}),C&&(0,ae.jsx)(Un,{value:"all-services",children:(0,ae.jsx)(Ko,{href:Mn(l,a),onClick:So(v,a),leadingIcon:(0,ae.jsx)(zl,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-services",children:nt("allGovServices",S)})})]})})})]}),(0,ae.jsxs)("div",{className:"eg-header__right",children:[(0,ae.jsx)("nav",{className:"eg-header__nav","aria-label":"Account navigation",children:(0,ae.jsx)(Ul,{container:x,children:(0,ae.jsxs)(Bl,{children:[C&&h>1&&g!==null&&(0,ae.jsxs)(Un,{value:"company-switcher",children:[(0,ae.jsx)(Wl,{"data-slot":"header-company-switcher-trigger",children:g}),(0,ae.jsx)($l,{children:(0,ae.jsx)(Pa,{href:Mn(l,A),onClick:So(v,A),closeOnClick:!0,"data-slot":"header-company-switcher-select-account",children:nt("myCompanies",S)})})]}),e?(0,ae.jsx)("div",{className:"eg-header__skeleton eg-header__skeleton--services","aria-hidden":"true"}):!C&&(0,ae.jsx)(Un,{value:"all-services-logged-out",children:(0,ae.jsx)(Ko,{href:Mn(l,"/services"),onClick:So(v,"/services"),leadingIcon:(0,ae.jsx)(zl,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-services",children:nt("allGovServices",S)})}),e?(0,ae.jsx)("div",{className:"eg-header__skeleton eg-header__skeleton--register","aria-hidden":"true"}):!C&&(0,ae.jsx)(Un,{value:"register",children:(0,ae.jsx)(Ko,{href:Mn(l,"/register"),onClick:So(v,"/register"),leadingIcon:(0,ae.jsx)(bh,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-register",children:nt("register",S)})}),C&&(0,ae.jsxs)(Un,{value:"settings",children:[(0,ae.jsx)(Wl,{leadingIcon:(0,ae.jsx)(wh,{size:"s","aria-hidden":"true"}),"data-slot":"header-settings-trigger",children:nt("settings",S)}),(0,ae.jsxs)($l,{children:[(0,ae.jsx)(Pa,{href:Mn(l,c),onClick:So(v,c),closeOnClick:!0,"data-slot":"header-settings-profile",children:m}),g!==null&&(0,ae.jsx)(Pa,{href:Mn(l,i),onClick:So(v,i),closeOnClick:!0,"data-slot":"header-settings-company",children:g})]})]}),e?(0,ae.jsx)("div",{className:"eg-header__skeleton eg-header__skeleton--auth","aria-hidden":"true"}):(0,ae.jsx)(Un,{value:"auth",children:(0,ae.jsx)(Ko,{href:"#","aria-disabled":C?P:E,onClick:L=>{L.preventDefault(),!(C?P:E)&&(C?D():T())},leadingIcon:(0,ae.jsx)(M,{size:"s","aria-hidden":"true"}),"data-slot":C?"header-nav-logout":"header-nav-login",children:I})})]})})}),(0,ae.jsxs)("div",{className:"eg-header__right-menu",children:[(0,ae.jsxs)(tg,{value:S,onValueChange:L=>L!=null&&w(L),children:[(0,ae.jsx)(ng,{"aria-label":nt("selectLanguage",S),renderValue:L=>typeof L=="string"?L.toUpperCase():null}),(0,ae.jsx)(og,{container:x,alignItemWithTrigger:!1,children:Es.map(L=>(0,ae.jsx)(rg,{value:L.value,"data-slot":`language-option-${L.value}`,children:L.label},L.value))})]}),(0,ae.jsx)(Ls,{variant:"tertiary",size:"icon-s",onClick:()=>console.info("[easygov-header] search clicked"),"aria-label":nt("search",S),"data-slot":"header-search-button",children:(0,ae.jsx)(Sh,{size:"s","aria-hidden":"true"})})]}),(0,ae.jsx)(yu,{height:31,className:"eg-header__swiss-logo"})]})]})}),(0,ae.jsx)("div",{className:"eg-header__sr-only","aria-live":"polite","aria-atomic":"true",children:R})]})}function NR({onLanguageChange:e,onNavigate:t,onContextChange:n,onLogout:o}){let r=(0,Te.useRef)(!1);(0,Te.useEffect)(()=>{r.current||(r.current=!0,Yh())},[]),(0,Te.useEffect)(()=>{Tu()},[]);let s=Sv(),i=(0,Te.useSyncExternalStore)(hv,Jh,()=>!0),a=vv(),c=PR(),l=TR(),u=c?.type==="customer"?c.id:null,{claims:f,contextJwt:p,accessibleAccountCount:d,contextError:m,dismissContextError:g}=IR(a,l),h=(0,Te.useRef)(null),v=(0,Te.useRef)(null),[S,w]=(0,Te.useState)(""),x=xv(),y=(0,Te.useMemo)(()=>m!==null?pv(m.problem,x):null,[m,x]),R=vs(x),E=vs(o);(0,Te.useEffect)(()=>{let W=a.user?.sub??null,se=v.current;if(v.current=W,W!==se){if(h.current?.dispatchEvent(new CustomEvent("sessionchange",{bubbles:!0,composed:!0,detail:{user:a.user}})),W!==null&&se===null){let ue=nt("loginSuccess",R.current);w(ue),setTimeout(()=>w(""),3e3)}else if(W===null&&se!==null){let ue=nt("logoutSuccess",R.current);w(ue),setTimeout(()=>w(""),3e3),E.current?.()}}},[a.user,R,E]);let _=vs(e);(0,Te.useEffect)(()=>{_.current?.(x),h.current?.dispatchEvent(new CustomEvent("languagechange",{bubbles:!0,composed:!0,detail:{locale:x}})),typeof document<"u"&&(document.documentElement.lang=x)},[x,_]);let P=vs(n);(0,Te.useEffect)(()=>{fv(p,f),!(p===null||f===null)&&(P.current?.(p,f),h.current?.dispatchEvent(new CustomEvent("contextchange",{bubbles:!0,composed:!0,detail:{contextJwt:p,claims:f}})))},[p,f,P]);let O=(0,Te.useCallback)(W=>{za(W)},[]),[T,D]=(0,Te.useState)(null);(0,Te.useLayoutEffect)(()=>{let W=h.current?.getRootNode();W instanceof ShadowRoot&&D(W)},[]);let C=(0,Te.useSyncExternalStore)(mu,_r,()=>null),M=(0,Te.useSyncExternalStore)(mu,ws,()=>null),I=(0,Te.useSyncExternalStore)(mu,Ru,()=>null),A=vs(t),L=(0,Te.useCallback)(W=>(h.current?.dispatchEvent(new CustomEvent("navigate",{bubbles:!0,composed:!0,detail:{path:W}})),A.current?(A.current(W),!0):!1),[A]),N=a.user===null?null:{name:a.user.name},$=`${f?.currentUser.firstName??""} ${f?.currentUser.lastName??""}`.trim(),k=f?.customerAccount?.id??u,q=k!==null?`/customer/${k}`:null,B=a.user!==null?q:null,j=W=>B!==null?`${W}${B}`:W,V=j("/dashboard"),X=j("/favorites"),Y=j("/company"),ge=j("/services"),Z=j("/profile"),de=M!==null&&B!==null?B:"/",ce=[`UI-Version: ${s.libraryVersion}`];s.backendVersion!==null&&ce.push(`Backend-Version: ${s.backendVersion}`),s.businessModuleVersion!==null&&ce.push(`Business-Module-Version: ${s.businessModuleVersion}`);let le=ce.join(`
|
|
2
|
+
`);return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(OR,{headerRef:h,initializing:!i,user:N,onLogin:()=>Qh(),onLogout:()=>ev(),dashboardPath:V,favoritesPath:X,companyPath:Y,servicesPath:ge,profilePath:Z,coreOrigin:C,infoOrigin:M,infoHomePath:de,versionsInfoText:le,environmentStage:I,userDisplayName:$!==""?$:N?.name??"",companyLabel:f?.customerAccount?.label??null,accessibleAccountCount:d,onNavigate:L,locale:x,onLocaleChange:O,portalContainer:T,announcement:S}),(0,ae.jsx)(Dg,{open:y!==null,onClose:g,title:y?.title??"",message:y?.message??"",reference:y?.reference,details:y?.details,closeLabel:nt("errorCloseLabel",x),detailsLabel:nt("errorDetailsLabel",x)})]})}export{Pv as a,ja as b,za as c,qa as d,NR as e};
|
|
3
|
+
/*! Bundled license information:
|
|
4
|
+
|
|
5
|
+
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
|
6
|
+
(**
|
|
7
|
+
* @license React
|
|
8
|
+
* use-sync-external-store-shim.production.js
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*)
|
|
15
|
+
|
|
16
|
+
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js:
|
|
17
|
+
(**
|
|
18
|
+
* @license React
|
|
19
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*)
|
|
26
|
+
*/
|
|
27
|
+
//# sourceMappingURL=chunk-R2ZANGUH.js.map
|