@oncehub/ui-react 1.4.22-beta.1.2 → 1.4.22-beta.1.3
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/ui-react.umd.js
CHANGED
|
@@ -29,5 +29,5 @@ Check the top-level render call using <`+I+">.")}return y}}function po(l,y){{if(
|
|
|
29
29
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Ee={Mobile:"mobile",Tablet:"tablet",SmartTv:"smarttv",Console:"console",Wearable:"wearable",Embedded:"embedded",Browser:void 0},je={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},dt={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},Mo={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},Ro=function(t){switch(t){case Ee.Mobile:return{isMobile:!0};case Ee.Tablet:return{isTablet:!0};case Ee.SmartTv:return{isSmartTV:!0};case Ee.Console:return{isConsole:!0};case Ee.Wearable:return{isWearable:!0};case Ee.Browser:return{isBrowser:!0};case Ee.Embedded:return{isEmbedded:!0};default:return Mo}},Wo=function(t){return jn(t)},N=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none";return t||n},on=function(){return typeof window<"u"&&(window.navigator||navigator)?window.navigator||navigator:!1},an=function(t){var n=on();return n&&n.platform&&(n.platform.indexOf(t)!==-1||n.platform==="MacIntel"&&n.maxTouchPoints>1&&!window.MSStream)},Vo=function(t,n,r,o,c){return{isBrowser:t,browserMajorVersion:N(n.major),browserFullVersion:N(n.version),browserName:N(n.name),engineName:N(r.name),engineVersion:N(r.version),osName:N(o.name),osVersion:N(o.version),userAgent:N(c)}},Mn=function(t,n,r,o){return Eo({},t,{vendor:N(n.vendor),model:N(n.model),os:N(r.name),osVersion:N(r.version),ua:N(o)})},Bo=function(t,n,r,o){return{isSmartTV:t,engineName:N(n.name),engineVersion:N(n.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(o)}},Uo=function(t,n,r,o){return{isConsole:t,engineName:N(n.name),engineVersion:N(n.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(o)}},Ho=function(t,n,r,o){return{isWearable:t,engineName:N(n.name),engineVersion:N(n.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(o)}},qo=function(t,n,r,o,c){return{isEmbedded:t,vendor:N(n.vendor),model:N(n.model),engineName:N(r.name),engineVersion:N(r.version),osName:N(o.name),osVersion:N(o.version),userAgent:N(c)}};function zo(e){var t=e?yt(e):Fn,n=t.device,r=t.browser,o=t.engine,c=t.os,i=t.ua,p=Ro(n.type),v=p.isBrowser,m=p.isMobile,h=p.isTablet,g=p.isSmartTV,s=p.isConsole,f=p.isWearable,a=p.isEmbedded;if(v)return Vo(v,r,o,c,i);if(g)return Bo(g,o,c,i);if(s)return Uo(s,o,c,i);if(m||h)return Mn(p,n,c,i);if(f)return Ho(f,o,c,i);if(a)return qo(a,n,o,c,i)}var Rn=function(t){var n=t.type;return n===Ee.Mobile},Wn=function(t){var n=t.type;return n===Ee.Tablet},Vn=function(t){var n=t.type;return n===Ee.Mobile||n===Ee.Tablet},Bn=function(t){var n=t.type;return n===Ee.SmartTv},Ft=function(t){var n=t.type;return n===Ee.Browser},Un=function(t){var n=t.type;return n===Ee.Wearable},Hn=function(t){var n=t.type;return n===Ee.Console},qn=function(t){var n=t.type;return n===Ee.Embedded},zn=function(t){var n=t.vendor;return N(n)},Yn=function(t){var n=t.model;return N(n)},Kn=function(t){var n=t.type;return N(n,"browser")},Gn=function(t){var n=t.name;return n===dt.Android},Qn=function(t){var n=t.name;return n===dt.Windows},Jn=function(t){var n=t.name;return n===dt.MAC_OS},Xn=function(t){var n=t.name;return n===dt.WindowsPhone},Zn=function(t){var n=t.name;return n===dt.IOS},$n=function(t){var n=t.version;return N(n)},er=function(t){var n=t.name;return N(n)},tr=function(t){var n=t.name;return n===je.Chrome},nr=function(t){var n=t.name;return n===je.Firefox},rr=function(t){var n=t.name;return n===je.Chromium},Dt=function(t){var n=t.name;return n===je.Edge},or=function(t){var n=t.name;return n===je.Yandex},ir=function(t){var n=t.name;return n===je.Safari||n===je.MobileSafari},ar=function(t){var n=t.name;return n===je.MobileSafari},sr=function(t){var n=t.name;return n===je.Opera},lr=function(t){var n=t.name;return n===je.InternetExplorer||n===je.Ie},ur=function(t){var n=t.name;return n===je.MIUI},cr=function(t){var n=t.name;return n===je.SamsungBrowser},dr=function(t){var n=t.version;return N(n)},fr=function(t){var n=t.major;return N(n)},pr=function(t){var n=t.name;return N(n)},br=function(t){var n=t.name;return N(n)},vr=function(t){var n=t.version;return N(n)},mr=function(){var t=on(),n=t&&t.userAgent&&t.userAgent.toLowerCase();return typeof n=="string"?/electron/.test(n):!1},ft=function(t){return typeof t=="string"&&t.indexOf("Edg/")!==-1},hr=function(){var t=on();return t&&(/iPad|iPhone|iPod/.test(t.platform)||t.platform==="MacIntel"&&t.maxTouchPoints>1)&&!window.MSStream},Qe=function(){return an("iPad")},gr=function(){return an("iPhone")},wr=function(){return an("iPod")},xr=function(t){return N(t)};function yr(e){var t=e||Fn,n=t.device,r=t.browser,o=t.os,c=t.engine,i=t.ua;return{isSmartTV:Bn(n),isConsole:Hn(n),isWearable:Un(n),isEmbedded:qn(n),isMobileSafari:ar(r)||Qe(),isChromium:rr(r),isMobile:Vn(n)||Qe(),isMobileOnly:Rn(n),isTablet:Wn(n)||Qe(),isBrowser:Ft(n),isDesktop:Ft(n),isAndroid:Gn(o),isWinPhone:Xn(o),isIOS:Zn(o)||Qe(),isChrome:tr(r),isFirefox:nr(r),isSafari:ir(r),isOpera:sr(r),isIE:lr(r),osVersion:$n(o),osName:er(o),fullBrowserVersion:dr(r),browserVersion:fr(r),browserName:pr(r),mobileVendor:zn(n),mobileModel:Yn(n),engineName:br(c),engineVersion:vr(c),getUA:xr(i),isEdge:Dt(r)||ft(i),isYandex:or(r),deviceType:Kn(n),isIOS13:hr(),isIPad13:Qe(),isIPhone13:gr(),isIPod13:wr(),isElectron:mr(),isEdgeChromium:ft(i),isLegacyEdge:Dt(r)&&!ft(i),isWindows:Qn(o),isMacOs:Jn(o),isMIUI:ur(r),isSamsungBrowser:cr(r)}}var kr=Bn(Ae),Or=Hn(Ae),Sr=Un(Ae),Yo=qn(Ae),Ko=ar(Se)||Qe(),Go=rr(Se),At=Vn(Ae)||Qe(),Er=Rn(Ae),_r=Wn(Ae)||Qe(),Tr=Ft(Ae),Qo=Ft(Ae),Cr=Gn(it),Ir=Xn(it),Pr=Zn(it)||Qe(),Jo=tr(Se),Xo=nr(Se),Zo=ir(Se),$o=sr(Se),Lr=lr(Se),ei=$n(it),ti=er(it),ni=dr(Se),ri=fr(Se),oi=pr(Se),ii=zn(Ae),ai=Yn(Ae),si=br(en),li=vr(en),ui=xr(xt),ci=Dt(Se)||ft(xt),di=or(Se),fi=Kn(Ae),pi=hr(),bi=Qe(),vi=gr(),mi=wr(),hi=mr(),gi=ft(xt),wi=Dt(Se)&&!ft(xt),xi=Qn(it),yi=Jn(it),ki=ur(Se),Oi=cr(Se),Si=function(t){if(!t||typeof t!="string"){console.error("No valid user agent string was provided");return}var n=yt(t),r=n.device,o=n.browser,c=n.os,i=n.engine,p=n.ua;return yr({device:r,browser:o,os:c,engine:i,ua:p})},Ei=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return Cr?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},_i=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return Tr?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},Ti=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return Lr?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},Ci=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return Pr?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},Ii=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return At?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},Pi=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return _r?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},Li=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return Ir?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},ji=function(t){var n=t.renderWithFragment,r=t.children;t.viewClassName,t.style;var o=Re(t,["renderWithFragment","children","viewClassName","style"]);return Er?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},Fi=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return kr?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},Di=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return Or?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},Ai=function(t){var n=t.renderWithFragment,r=t.children,o=Re(t,["renderWithFragment","children"]);return Sr?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",o,r):null},Ni=function(t){var n=t.renderWithFragment,r=t.children;t.viewClassName,t.style;var o=t.condition,c=Re(t,["renderWithFragment","children","viewClassName","style","condition"]);return o?n?ae.createElement(Oe.Fragment,null,r):ae.createElement("div",c,r):null};function Mi(e){return function(t){Io(n,t);function n(r){var o;return _o(this,n),o=Lo(this,nn(n).call(this,r)),o.isEventListenerAdded=!1,o.handleOrientationChange=o.handleOrientationChange.bind(jt(o)),o.onOrientationChange=o.onOrientationChange.bind(jt(o)),o.onPageLoad=o.onPageLoad.bind(jt(o)),o.state={isLandscape:!1,isPortrait:!1},o}return To(n,[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var o=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:o===0,isLandscape:o===90})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){(typeof window>"u"?"undefined":kt(window))!==void 0&&At&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return ae.createElement(e,tn({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}]),n}(ae.Component)}function Ri(){var e=Oe.useState(function(){var c=window.innerWidth>window.innerHeight?90:0;return{isPortrait:c===0,isLandscape:c===90,orientation:c===0?"portrait":"landscape"}}),t=jo(e,2),n=t[0],r=t[1],o=Oe.useCallback(function(){var c=window.innerWidth>window.innerHeight?90:0,i={isPortrait:c===0,isLandscape:c===90,orientation:c===0?"portrait":"landscape"};n.orientation!==i.orientation&&r(i)},[n.orientation]);return Oe.useEffect(function(){return(typeof window>"u"?"undefined":kt(window))!==void 0&&At&&(o(),window.addEventListener("load",o,!1),window.addEventListener("resize",o,!1)),function(){window.removeEventListener("resize",o,!1),window.removeEventListener("load",o,!1)}},[o]),n}function jr(e){var t=e||window.navigator.userAgent;return yt(t)}function Wi(e){var t=e||window.navigator.userAgent,n=jr(t),r=yr(n);return[r,n]}L.AndroidView=Ei,L.BrowserTypes=je,L.BrowserView=_i,L.ConsoleView=Di,L.CustomView=Ni,L.IEView=Ti,L.IOSView=Ci,L.MobileOnlyView=ji,L.MobileView=Ii,L.OsTypes=dt,L.SmartTVView=Fi,L.TabletView=Pi,L.WearableView=Ai,L.WinPhoneView=Li,L.browserName=oi,L.browserVersion=ri,L.deviceDetect=zo,L.deviceType=fi,L.engineName=si,L.engineVersion=li,L.fullBrowserVersion=ni,L.getSelectorsByUserAgent=Si,L.getUA=ui,L.isAndroid=Cr,L.isBrowser=Tr,L.isChrome=Jo,L.isChromium=Go,L.isConsole=Or,L.isDesktop=Qo,L.isEdge=ci,L.isEdgeChromium=gi,L.isElectron=hi,L.isEmbedded=Yo,L.isFirefox=Xo,L.isIE=Lr,L.isIOS=Pr,L.isIOS13=pi,L.isIPad13=bi,L.isIPhone13=vi,L.isIPod13=mi,L.isLegacyEdge=wi,L.isMIUI=ki,L.isMacOs=yi;var Vi=L.isMobile=At;L.isMobileOnly=Er,L.isMobileSafari=Ko,L.isOpera=$o,L.isSafari=Zo,L.isSamsungBrowser=Oi,L.isSmartTV=kr,L.isTablet=_r,L.isWearable=Sr,L.isWinPhone=Ir,L.isWindows=xi,L.isYandex=di,L.mobileModel=ai,L.mobileVendor=ii,L.osName=ti,L.osVersion=ei,L.parseUserAgent=yt,L.setUserAgent=Wo,L.useDeviceData=jr,L.useDeviceSelectors=Wi,L.useMobileOrientation=Ri,L.withOrientationChange=Mi;const Bi=u.memo(u.forwardRef(({themeColor:e="",onSubmit:t,style:n={},className:r="",onInput:o,onFocus:c,onBlur:i,...p},v)=>{const[m,h]=u.useState(!0),[g,s]=u.useState(!1);e=He.convert3HexTo6(e),u.useEffect(()=>{h(Vi)},[]);const f=k=>{!m&&k.key==="Enter"&&!k.shiftKey&&t&&(k.preventDefault(),t())},a=k=>{o?.(k),k.target.style.height="40px",k.target.style.height=2+k.target.scrollHeight+"px"};let d={};const b=[Pn.textInput,r].filter(Boolean).join(" "),w=()=>{s(!0)},T=()=>{s(!1)};return d={borderBottomColor:g?e!=="#ffffff"?e:"#c8c8c8":""},O.jsx("div",{className:Pn.textInputWrapper,children:O.jsx("textarea",{"data-testid":"textbox-input",ref:v,className:b,style:{...d,...n},onFocus:w,onBlur:T,onInput:k=>a(k),onKeyDown:f,...p})})})),ye={multiSelectContainer:"_multiSelectContainer_lh9wi_1",listOptionsWrap:"_listOptionsWrap_lh9wi_4",selectedValuesWrap:"_selectedValuesWrap_lh9wi_7",selectedValues:"_selectedValues_lh9wi_7",focused:"_focused_lh9wi_13",placeholder:"_placeholder_lh9wi_16",dropDownIcon:"_dropDownIcon_lh9wi_19",optionsListContainer:"_optionsListContainer_lh9wi_23",top:"_top_lh9wi_26",optionsListWrap:"_optionsListWrap_lh9wi_29",searchInputWrap:"_searchInputWrap_lh9wi_32",searchInput:"_searchInput_lh9wi_32",optionsList:"_optionsList_lh9wi_23",btnContainer:"_btnContainer_lh9wi_54",hiddenButton:"_hiddenButton_lh9wi_57",announcement:"_announcement_lh9wi_70"},Ot={pseudoCheckbox:"_pseudoCheckbox_z8j4c_1",checkboxCheckMark:"_checkboxCheckMark_z8j4c_4",checkboxCheckMarkPath:"_checkboxCheckMarkPath_z8j4c_7",checked:"_checked_z8j4c_12",checkboxUncheckedChecked:"_checkboxUncheckedChecked_z8j4c_1",checkboxDisabled:"_checkboxDisabled_z8j4c_22"},Fr=({checked:e=!1,themeColor:t="",disabled:n=!1})=>{let r={},o="#006bb1",c=n?"#9b9b9b":"#ffffff";const i=n?Ot.checkboxDisabled:"",p=e?Ot.checked:"",v=[Ot.pseudoCheckbox,p,i].filter(Boolean).join(" ");let m;if(t){const h=rt(t);t=He.convert3HexTo6(t),h==="dark"||h==="light"?(n?c=e?"#9b9b9b":"#f9f9f9":c=h=="light"?"#333333":"#ffffff",o=n?"#f9f9f9":e?t:"#ffffff",m=n?"#e4e4e4":t==="#ffffff"?"#333333":t,e&&(r={backgroundColor:o,borderColor:m,outlineColor:m})):c="#9b9b9b"}return O.jsx("div",{style:r,className:v,role:"checkbox","aria-checked":e,"aria-hidden":"true",tabIndex:-1,"data-testid":"checkbox-input",children:O.jsx("svg",{version:"1.1",focusable:"false",className:Ot.checkboxCheckMark,viewBox:"0 0 24 24",children:O.jsx("path",{className:Ot.checkboxCheckMarkPath,fill:"none",stroke:c,d:"M4.1,12.7 9,17.6 20.3,6.3"})})})};Fr.displayName="Checkbox";const Ui=({options:e,checkedValue:t,onSelectionChange:n,maxOptions:r,themeColor:o,className:c="",style:i={}})=>{const p=u.useRef(e),[v,m]=u.useState(t),[h,g]=u.useState(""),[s,f]=u.useState(!1),[a,d]=u.useState(!1),b=u.useRef(null),w=u.useRef(null),T=u.useRef(null),k=u.useRef(null),S=u.useRef(null),W=u.useRef(null),[_,H]=u.useState(-1),V=u.useRef(0),P=u.useRef(0),[K,se]=u.useState(!1);let re={};const[x,z]=u.useState({left:0,top:0}),[te,ce]=u.useState(null),U=u.useRef(!1),de=u.useRef(null),ne=()=>{setTimeout(()=>{(b.current?.children[0]).focus()},0)};u.useEffect(()=>{const E=B=>{w.current&&!w.current.contains(B.target)&&(f(!1),g(""),ne())};return document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E)}},[]);const ee=()=>{V.current=window.innerHeight,P.current=document.body.scrollHeight,se(!0)};u.useEffect(()=>(ee(),window.addEventListener("resize",ee),()=>{window.addEventListener("resize",ee)}),[]);const le=E=>{const B=document.getElementById("announcement");B&&(B.textContent=E,B.setAttribute("aria-live","assertive"),setTimeout(()=>{B.textContent="",B.setAttribute("aria-live","off")},1e3))};u.useEffect(()=>{const E=e.filter(B=>B.label.toLowerCase().includes(h.toLowerCase()));p.current=E},[e,h]);const me=v.length>0?v.map(E=>{const B=e.find(pe=>pe.value===E);return B?.label!==null?B?.label:""}).filter(E=>E!=="").join(", "):"Select your option",fe=E=>{const B=e.find(pe=>pe.value===E);if(B&&!B.disable&&(r===void 0||v.length<=r)){const ge=v.includes(E)?v.filter(De=>De!==E):[...v,E];(r===void 0||ge.length<=r)&&s&&(m(ge),n(ge),le(`${B?.label} ${ge.includes(E)?"selected":"not selected"}`))}},C=E=>{R(),f(E),setTimeout(()=>{T.current?T.current?.focus():k.current?.focus(),le("use up and down arrow keys to navigate")},0)},j=()=>P.current-(V.current+window.scrollY),R=()=>{if(b.current){const E=b.current.getBoundingClientRect();setTimeout(()=>{const B=w?.current?.getBoundingClientRect(),pe=j(),ge=V.current-E.bottom;let Ce;if(B){const De=E.height,Ze=E.top,Ie=B.height,ct=Ie>Ze+window.scrollY;Ze<Ie&&(ct||ct&&ge<Ie||pe>Ie||ge>Ie)||Ze>Ie&&ge>Ie?Ce=E.y+De:Ce=E.y-Ie,z({left:E.left,top:Ce??E.top})}},0)}};u.useEffect(()=>(window.addEventListener("scroll",R),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R),window.removeEventListener("resize",R)}),[s]);const xe=E=>{E.preventDefault(),E.key==="Shift"?U.current=!0:E.shiftKey&&U.current&&E.key==="Tab"||E.key==="Tab"?(setTimeout(()=>{T.current?T.current?.focus():k.current?.focus()},0),U.current=!1):E.key==="Escape"||E.key==="Enter"||E.key==="Space"||E.key===" "?(C(!1),ne()):U.current=!1},_e=E=>{const{key:B}=E;if(B==="Tab"||E.shiftKey&&B==="Tab")setTimeout(()=>{S.current?.focus()},0);else if(B==="ArrowDown"||B==="ArrowUp"){E.preventDefault(),setTimeout(()=>{k.current?.focus()},0);let pe=_;if(B==="ArrowDown"?pe=Math.min(_+1,p.current.length-1):B==="ArrowUp"&&(pe=Math.max(_-1,0)),_===0&&E.key==="ArrowUp"?pe=p.current.length-1:_===p.current.length-1&&E.key==="ArrowDown"&&(pe=0),H(pe),W.current&&pe>=0){const ge=W.current.querySelectorAll(`.${ye.optionsList}`)[pe],Ce=ge.children[0].getAttribute("aria-checked"),De=`${ge.textContent} ${Ce==="true"?"selected":"not selected"} ${pe+1} out of ${p.current.length}`;le(De),ge&&ge.scrollIntoView({block:"nearest",inline:"nearest"})}}else B==="Enter"||B==="Space"||B===" "?_!==-1&&fe(p.current[_].value):B==="Escape"&&(C(!1),ne())};u.useEffect(()=>{te&&clearTimeout(te);const E=setTimeout(()=>{const B=p.current.length?`${p.current.length} results are available, use up and down arrow keys to navigate`:"No results available";s&&le(B)},500);ce(E)},[h]);const Ye=()=>{d(!0)},Ve=()=>{d(!1)};if(u.useEffect(()=>{const E=de.current;return E&&(E.addEventListener("focus",Ye),E.addEventListener("blur",Ve)),()=>{E&&(E.removeEventListener("focus",Ye),E.removeEventListener("blur",Ve))}},[Ye,Ve]),o){const E=rt(o);o=He.convert3HexTo6(o),(E==="dark"||E==="light")&&(re={borderBottomColor:o==="#ffffff"?"#c8c8c8":a||s?o:"#333333"})}const It=()=>{f(!1)};return O.jsx("div",{className:ye.multiSelectContainer,children:O.jsxs("div",{className:ye.listOptionsWrap,children:[O.jsxs("div",{className:`${c} ${ye.selectedValuesWrap}`,ref:b,children:[O.jsx("div",{className:`${ye.selectedValues} ${s?ye.focused:""} ${v.length===0?ye.placeholder:""}`,ref:de,onFocus:Ye,onBlur:Ve,onClick:()=>C(!s),onKeyPress:E=>{(E.key===" "||E.code==="Space"||E.code==="Enter")&&(E.preventDefault(),C(!s))},tabIndex:0,"data-testid":"selected-input",style:{...re,...i},"aria-expanded":s,"aria-haspopup":"listbox","aria-multiselectable":"true","aria-autocomplete":"list",role:"combobox",children:me}),O.jsx("span",{className:ye.dropDownIcon,onClick:()=>C(!s),"data-testid":"arrow-button",children:O.jsx("svg",{width:"12px",height:"7px",viewBox:"0 0 12 7",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:O.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:O.jsx("g",{transform:"translate(-2360.000000, -295.000000)",fill:"#666666",children:O.jsx("g",{transform:"translate(2006.000000, 248.000000)",children:O.jsx("path",{d:"M358.027356,44.3431458 L358.027146,50.6581458 L364.343146,50.6589352 L364.343146,52.3431458 L358.027146,52.3421458 L358.027356,52.3431458 L356.343146,52.3431458 L356.343146,44.3431458 L358.027356,44.3431458 Z",transform:"translate(360.343146, 48.343146) scale(-1, -1) rotate(-225.000000) translate(-360.343146, -48.343146)"})})})})})})]}),O.jsx("div",{id:"announcement","aria-live":"assertive",role:"alert",className:ye.announcement}),K?Qt.createPortal(O.jsx(O.Fragment,{children:s&&b&&O.jsx("div",{onClick:It,style:{position:"fixed",inset:0,backgroundColor:"rgba(255,255,255,0)",zIndex:1e3},children:O.jsxs("div",{className:`${ye.optionsListContainer}`,ref:w,onClick:E=>E.stopPropagation(),style:{opacity:x.left?1:0,width:b.current?b.current.clientWidth:"auto",left:x.left,top:x.top},children:[O.jsxs("div",{className:ye.optionsListWrap,children:[e.length>=6&&O.jsx("div",{className:ye.searchInputWrap,children:O.jsx("input",{type:"text",ref:T,placeholder:"Type to filter",className:ye.searchInput,value:h,onChange:E=>g(E.target.value),"data-testid":"search-input",onKeyDown:E=>{_e(E)}})}),O.jsx("ul",{ref:W,role:"listbox",children:p.current.map((E,B)=>O.jsxs("li",{className:`${ye.optionsList} ${B===_?ye.focused:""}`,onClick:()=>fe(E.value),"aria-selected":B===_,role:"option",children:[O.jsx(Fr,{themeColor:o,checked:v.includes(E.value),disabled:E.disable||r!==void 0&&v.length>=r&&!v.includes(E.value)}),O.jsx("span",{children:E.label})]},E.value))})]}),O.jsxs("div",{className:ye.btnContainer,children:[O.jsx("input",{ref:k,onKeyDown:E=>{_e(E)},className:ye.hiddenButton}),O.jsx(Xt,{themeColor:o,variant:"primary",size:"medium",onClick:()=>{f(!1),g(""),ne(),n(v)},"data-testid":"done-button",onKeyDown:E=>{xe(E)},ref:S,children:"Done"})]})]})})}),document.body):null]})})},Nt={multiSelectContainer:"_multiSelectContainer_1nq57_1",quickOptionsWrap:"_quickOptionsWrap_1nq57_4",selected:"_selected_1nq57_11",disabled:"_disabled_1nq57_17"},Hi=({options:e,checkedValue:t,onSelectionChange:n,maxOptions:r,themeColor:o,className:c="",style:i={},id:p=""})=>{const[v,m]=u.useState(t),h=u.useRef({});let g={},s;const f=a=>{const d=e.find(S=>S.value===a);if(!d||d.disable)return;h.current[a]?.click();const T=v.includes(a)?v.filter(S=>S!==a):[...v,a];(r===void 0||T.length<=r)&&(m(T),n(T))};if(o){s=rt(o),o=He.convert3HexTo6(o);const a=o==="#ffffff"?"#333333":o;(s==="dark"||s==="light")&&(g={outlineColor:a,borderColor:a,color:o==="#ffffff"||s==="light"?"#333333":o})}return O.jsx("div",{className:Nt.multiSelectContainer,role:"group",children:O.jsx("ul",{className:Nt.quickOptionsWrap,id:p,children:e.map(a=>O.jsx("li",{style:{...g,...i},className:`${c} ${a.disable||r!==void 0&&v.length>=r&&!v.includes(a.value)?Nt.disabled:""} ${v.includes(a.value)?Nt.selected:""}`,tabIndex:a.disable?-1:0,onClick:()=>f(a.value),onKeyPress:d=>{(d.key===" "||d.code==="Space")&&(d.preventDefault(),f(a.value))},"data-testid":"option-box",children:O.jsx(Zt,{id:a.value,checkboxSize:"large",tabIndex:-1,themeColor:o,ref:d=>{h.current[a.value]=d},checked:v.includes(a.value),disabled:a.disable||r!==void 0&&v.length>=r&&!v.includes(a.value),children:O.jsx("span",{style:{color:o&&(o==="#ffffff"||s==="light")||a.disable||r!==void 0&&v.length>=r&&!v.includes(a.value)?"#333333":o&&(o!=="#ffffff"||s!=="light")?o:"#006bb1"},children:a.label})})},a.value))})})},Je={singleSelectWrapper:"_singleSelectWrapper_j8hf5_1",quickOption:"_quickOption_j8hf5_4",selected:"_selected_j8hf5_10",triangle:"_triangle_j8hf5_16",loader:"_loader_j8hf5_19","tw-spin":"_tw-spin_j8hf5_1",checkmarkWrap:"_checkmarkWrap_j8hf5_22",checkmark:"_checkmark_j8hf5_22",fill:"_fill_j8hf5_1",scale:"_scale_j8hf5_1",checkmarkCheck:"_checkmarkCheck_j8hf5_29",stroke:"_stroke_j8hf5_1",disabled:"_disabled_j8hf5_34"},qi=({options:e,onSelect:t,selected:n,themeColor:r,className:o="",style:c={},showLoader:i=!1,id:p=""})=>{const[v,m]=u.useState(n);let h={},g={},s="#ffffff";const f=a=>{if(v?.value===a?.value){m(void 0),t(void 0);return}t(a),m(a)};if(r){const a=rt(r);r=He.convert3HexTo6(r);const d=r==="#ffffff"?"#333333":r;(a==="dark"||a==="light")&&(s=r==="#ffffff"||a==="dark"?"#ffffff":"#333333",h={outlineColor:d,borderColor:d,color:r==="#ffffff"||a==="light"?"#333333":r},g={borderRightColor:d,borderTopColor:d})}return O.jsx("div",{className:Je.singleSelectWrapper,children:O.jsx("div",{className:Je.quickOption,children:O.jsx("ul",{className:Je.quickOption,role:"radiogroup",id:p,children:e.map(a=>O.jsxs("li",{tabIndex:a.disable?-1:0,className:`${o} ${v?.value===a.value?Je.selected:""} ${a.disable?Je.disabled:""}`,style:{...h,...c},onClick:()=>f(a),onKeyPress:d=>{(d.key===" "||d.code==="Space")&&(d.preventDefault(),f(a))},"data-testid":"checkbox-input",role:"radio","aria-checked":v?.value===a.value,children:[a.label,v?.value===a.value&&!a.disable&&O.jsxs("div",{className:Je.triangle,style:{...g},children:[i&&O.jsx("div",{className:Je.loader,style:{borderRightColor:r??"#006bb1"}}),!i&&O.jsx("div",{className:Je.checkmarkWrap,children:O.jsx("svg",{className:Je.checkmark,xmlns:"http://www.w3.org/2000/svg",width:"11",height:"9",viewBox:"0 0 11 9",fill:"none",children:O.jsx("path",{className:Je.checkmarkCheck,stroke:s,d:"M2.1 4.34286L4.12857 6.40001L8.9 1.60001",strokeWidth:"2"})})})]})]},a.value))})})})},zi={scrollbarContainer:"_scrollbarContainer_40vsr_1"},Dr=u.forwardRef(({children:e,className:t="",style:n={},...r},o)=>{const c=[zi.scrollbarContainer,t].filter(Boolean).join(" ");return O.jsx(O.Fragment,{children:O.jsx("div",{ref:o,style:{...n},className:c,...r,children:e})})});Dr.displayName="Scrollbar";var Yi=Object.defineProperty,Ki=(e,t,n)=>t in e?Yi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sn=(e,t,n)=>(Ki(e,typeof t!="symbol"?t+"":t,n),n);let Gi=class{constructor(){sn(this,"current",this.detect()),sn(this,"handoffState","pending"),sn(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},ut=new Gi,ve=(e,t)=>{ut.isServer?u.useEffect(e,t):u.useLayoutEffect(e,t)};function qe(e){let t=u.useRef(e);return ve(()=>{t.current=e},[e]),t}function St(e,t){let[n,r]=u.useState(e),o=qe(e);return ve(()=>r(o.current),[o,r,...t]),n}function Qi(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Xe(){let e=[],t={addEventListener(n,r,o,c){return n.addEventListener(r,o,c),t.add(()=>n.removeEventListener(r,o,c))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Qi(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let c=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:c})})},group(n){let r=Xe();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function et(){let[e]=u.useState(Xe);return u.useEffect(()=>()=>e.dispose(),[e]),e}let F=function(e){let t=qe(e);return u.useCallback((...n)=>t.current(...n),[t])};function Ji(){let e=typeof document>"u";return"useSyncExternalStore"in $e?(t=>t.useSyncExternalStore)($e)(()=>()=>{},()=>!1,()=>!e):!1}function ln(){let e=Ji(),[t,n]=$e.useState(ut.isHandoffComplete);return t&&ut.isHandoffComplete===!1&&n(!1),$e.useEffect(()=>{t!==!0&&n(!0)},[t]),$e.useEffect(()=>ut.handoff(),[]),e?!1:t}var Ar;let tt=(Ar=u.useId)!=null?Ar:function(){let e=ln(),[t,n]=u.useState(e?()=>ut.nextId():null);return ve(()=>{t===null&&n(ut.nextId())},[t]),t!=null?""+t:void 0};function ue(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ue),r}function Mt(e){return ut.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Nr=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Xi=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(Xi||{}),Zi=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Zi||{}),$i=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))($i||{}),un=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(un||{});function Mr(e,t=0){var n;return e===((n=Mt(e))==null?void 0:n.body)?!1:ue(t,{0(){return e.matches(Nr)},1(){let r=e;for(;r!==null;){if(r.matches(Nr))return!0;r=r.parentElement}return!1}})}var ea=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(ea||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Rr(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),c=t(r);if(o===null||c===null)return 0;let i=o.compareDocumentPosition(c);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Rt(e,t,n){let r=qe(t);u.useEffect(()=>{function o(c){r.current(c)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function ta(e,t,n){let r=qe(t);u.useEffect(()=>{function o(c){r.current(c)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}function Wr(e,t,n=!0){let r=u.useRef(!1);u.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(i,p){if(!r.current||i.defaultPrevented)return;let v=p(i);if(v===null||!v.getRootNode().contains(v)||!v.isConnected)return;let m=function h(g){return typeof g=="function"?h(g()):Array.isArray(g)||g instanceof Set?g:[g]}(e);for(let h of m){if(h===null)continue;let g=h instanceof HTMLElement?h:h.current;if(g!=null&&g.contains(v)||i.composed&&i.composedPath().includes(g))return}return!Mr(v,un.Loose)&&v.tabIndex!==-1&&i.preventDefault(),t(i,v)}let c=u.useRef(null);Rt("pointerdown",i=>{var p,v;r.current&&(c.current=((v=(p=i.composedPath)==null?void 0:p.call(i))==null?void 0:v[0])||i.target)},!0),Rt("mousedown",i=>{var p,v;r.current&&(c.current=((v=(p=i.composedPath)==null?void 0:p.call(i))==null?void 0:v[0])||i.target)},!0),Rt("click",i=>{c.current&&(o(i,()=>c.current),c.current=null)},!0),Rt("touchend",i=>o(i,()=>i.target instanceof HTMLElement?i.target:null),!0),ta("blur",i=>o(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Vr(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function Br(e,t){let[n,r]=u.useState(()=>Vr(e));return ve(()=>{r(Vr(e))},[e.type,e.as]),ve(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let na=Symbol();function We(...e){let t=u.useRef(e);u.useEffect(()=>{t.current=e},[e]);let n=F(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||r?.[na])?void 0:n}function ra({container:e,accept:t,walk:n,enabled:r=!0}){let o=u.useRef(t),c=u.useRef(n);u.useEffect(()=>{o.current=t,c.current=n},[t,n]),ve(()=>{if(!e||!r)return;let i=Mt(e);if(!i)return;let p=o.current,v=c.current,m=Object.assign(g=>p(g),{acceptNode:p}),h=i.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,m,!1);for(;h.nextNode();)v(h.currentNode)},[e,r,o,c])}function oa(e){throw new Error("Unexpected object: "+e)}var Z=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Z||{});function Ur(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1,c=(()=>{switch(e.focus){case 0:return n.findIndex(i=>!t.resolveDisabled(i));case 1:{let i=n.slice().reverse().findIndex((p,v,m)=>o!==-1&&m.length-v-1>=o?!1:!t.resolveDisabled(p));return i===-1?i:n.length-1-i}case 2:return n.findIndex((i,p)=>p<=o?!1:!t.resolveDisabled(i));case 3:{let i=n.slice().reverse().findIndex(p=>!t.resolveDisabled(p));return i===-1?i:n.length-1-i}case 4:return n.findIndex(i=>t.resolveId(i)===e.id);case 5:return null;default:oa(e)}})();return c===-1?r:c}function Wt(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var pt=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(pt||{}),at=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(at||{});function Fe({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:c=!0,name:i}){let p=Hr(t,e);if(c)return Vt(p,n,r,i);let v=o??0;if(v&2){let{static:m=!1,...h}=p;if(m)return Vt(h,n,r,i)}if(v&1){let{unmount:m=!0,...h}=p;return ue(m?0:1,{0(){return null},1(){return Vt({...h,hidden:!0,style:{display:"none"}},n,r,i)}})}return Vt(p,n,r,i)}function Vt(e,t={},n,r){let{as:o=n,children:c,refName:i="ref",...p}=cn(e,["unmount","static"]),v=e.ref!==void 0?{[i]:e.ref}:{},m=typeof c=="function"?c(t):c;"className"in p&&p.className&&typeof p.className=="function"&&(p.className=p.className(t));let h={};if(t){let g=!1,s=[];for(let[f,a]of Object.entries(t))typeof a=="boolean"&&(g=!0),a===!0&&s.push(f);g&&(h["data-headlessui-state"]=s.join(" "))}if(o===u.Fragment&&Object.keys(Bt(p)).length>0){if(!u.isValidElement(m)||Array.isArray(m)&&m.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(p).map(a=>` - ${a}`).join(`
|
|
30
30
|
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(a=>` - ${a}`).join(`
|
|
31
31
|
`)].join(`
|
|
32
|
-
`));let g=m.props,s=typeof g?.className=="function"?(...a)=>Wt(g?.className(...a),p.className):Wt(g?.className,p.className),f=s?{className:s}:{};return u.cloneElement(m,Object.assign({},Hr(m.props,Bt(cn(p,["ref"]))),h,v,ia(m.ref,v.ref),f))}return u.createElement(o,Object.assign({},cn(p,["ref"]),o!==u.Fragment&&v,o!==u.Fragment&&h),m)}function ia(...e){return{ref:e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}}function Hr(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...c){let i=n[r];for(let p of i){if((o instanceof Event||o?.nativeEvent instanceof Event)&&o.defaultPrevented)return;p(o,...c)}}});return t}function Te(e){var t;return Object.assign(u.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Bt(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function cn(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function qr(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=t?.getAttribute("disabled")==="";return r&&aa(n)?!1:r}function aa(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function dn(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Yr(n,zr(t,r),o);return n}function zr(e,t){return e?e+"["+t+"]":t}function Yr(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Yr(e,zr(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):dn(n,t,e)}let sa="div";var fn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(fn||{});function la(e,t){let{features:n=1,...r}=e,o={ref:t,"aria-hidden":(n&2)===2?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return Fe({ourProps:o,theirProps:r,slot:{},defaultTag:sa,name:"Hidden"})}let Kr=Te(la),pn=u.createContext(null);pn.displayName="OpenClosedContext";var ke=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ke||{});function Ut(){return u.useContext(pn)}function bn({value:e,children:t}){return u.createElement(pn.Provider,{value:e},t)}var $=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))($||{});function Gr(e,t,n){let[r,o]=u.useState(n),c=e!==void 0,i=u.useRef(c),p=u.useRef(!1),v=u.useRef(!1);return c&&!i.current&&!p.current?(p.current=!0,i.current=c,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!c&&i.current&&!v.current&&(v.current=!0,i.current=c,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[c?e:r,F(m=>(c||o(m),t?.(m)))]}function Qr(e,t){let n=u.useRef([]),r=F(e);u.useEffect(()=>{let o=[...n.current];for(let[c,i]of t.entries())if(n.current[c]!==i){let p=r(t,o);return n.current=t,p}},[r,...t])}function Jr(e){return[e.screenX,e.screenY]}function Xr(){let e=u.useRef([-1,-1]);return{wasMoved(t){let n=Jr(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Jr(t)}}}function ua(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function ca(){return/Android/gi.test(window.navigator.userAgent)}function da(){return ua()||ca()}function fa(...e){return u.useMemo(()=>Mt(...e),[...e])}var pa=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(pa||{}),ba=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(ba||{}),va=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(va||{}),ma=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e))(ma||{});function vn(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Rr(t(e.options.slice()),c=>c.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let ha={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;let n=e.activeOptionIndex;if(e.dataRef.current){let{isSelected:r}=e.dataRef.current,o=e.options.findIndex(c=>r(c.dataRef.current.value));o!==-1&&(n=o)}return{...e,comboboxState:0,activeOptionIndex:n}},2(e,t){var n,r,o,c;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;let i=vn(e);if(i.activeOptionIndex===null){let v=i.options.findIndex(m=>!m.dataRef.current.disabled);v!==-1&&(i.activeOptionIndex=v)}let p=Ur(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:v=>v.id,resolveDisabled:v=>v.dataRef.current.disabled});return{...e,...i,activeOptionIndex:p,activationTrigger:(c=t.trigger)!=null?c:1}},3:(e,t)=>{var n,r;let o={id:t.id,dataRef:t.dataRef},c=vn(e,p=>[...p,o]);e.activeOptionIndex===null&&(n=e.dataRef.current)!=null&&n.isSelected(t.dataRef.current.value)&&(c.activeOptionIndex=c.options.indexOf(o));let i={...e,...c,activationTrigger:1};return(r=e.dataRef.current)!=null&&r.__demoMode&&e.dataRef.current.value===void 0&&(i.activeOptionIndex=0),i},4:(e,t)=>{let n=vn(e,r=>{let o=r.findIndex(c=>c.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...n,activationTrigger:1}},5:(e,t)=>({...e,labelId:t.id})},mn=u.createContext(null);mn.displayName="ComboboxActionsContext";function Et(e){let t=u.useContext(mn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Et),n}return t}let hn=u.createContext(null);hn.displayName="ComboboxDataContext";function bt(e){let t=u.useContext(hn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,bt),n}return t}function ga(e,t){return ue(t.type,ha,e,t)}let wa=u.Fragment;function xa(e,t){let{value:n,defaultValue:r,onChange:o,form:c,name:i,by:p=(C,j)=>C===j,disabled:v=!1,__demoMode:m=!1,nullable:h=!1,multiple:g=!1,...s}=e,[f=g?[]:void 0,a]=Gr(n,o,r),[d,b]=u.useReducer(ga,{dataRef:u.createRef(),comboboxState:m?0:1,options:[],activeOptionIndex:null,activationTrigger:1,labelId:null}),w=u.useRef(!1),T=u.useRef({static:!1,hold:!1}),k=u.useRef(null),S=u.useRef(null),W=u.useRef(null),_=u.useRef(null),H=F(typeof p=="string"?(C,j)=>{let R=p;return C?.[R]===j?.[R]}:p),V=u.useCallback(C=>ue(P.mode,{1:()=>f.some(j=>H(j,C)),0:()=>H(f,C)}),[f]),P=u.useMemo(()=>({...d,optionsPropsRef:T,labelRef:k,inputRef:S,buttonRef:W,optionsRef:_,value:f,defaultValue:r,disabled:v,mode:g?1:0,get activeOptionIndex(){if(w.current&&d.activeOptionIndex===null&&d.options.length>0){let C=d.options.findIndex(j=>!j.dataRef.current.disabled);if(C!==-1)return C}return d.activeOptionIndex},compare:H,isSelected:V,nullable:h,__demoMode:m}),[f,r,v,g,h,m,d]),K=u.useRef(P.activeOptionIndex!==null?P.options[P.activeOptionIndex]:null);u.useEffect(()=>{let C=P.activeOptionIndex!==null?P.options[P.activeOptionIndex]:null;K.current!==C&&(K.current=C)}),ve(()=>{d.dataRef.current=P},[P]),Wr([P.buttonRef,P.inputRef,P.optionsRef],()=>ee.closeCombobox(),P.comboboxState===0);let se=u.useMemo(()=>({open:P.comboboxState===0,disabled:v,activeIndex:P.activeOptionIndex,activeOption:P.activeOptionIndex===null?null:P.options[P.activeOptionIndex].dataRef.current.value,value:f}),[P,v,f]),re=F(C=>{let j=P.options.find(R=>R.id===C);j&&ne(j.dataRef.current.value)}),x=F(()=>{if(P.activeOptionIndex!==null){let{dataRef:C,id:j}=P.options[P.activeOptionIndex];ne(C.current.value),ee.goToOption(Z.Specific,j)}}),z=F(()=>{b({type:0}),w.current=!0}),te=F(()=>{b({type:1}),w.current=!1}),ce=F((C,j,R)=>(w.current=!1,C===Z.Specific?b({type:2,focus:Z.Specific,id:j,trigger:R}):b({type:2,focus:C,trigger:R}))),U=F((C,j)=>(b({type:3,id:C,dataRef:j}),()=>{var R;((R=K.current)==null?void 0:R.id)===C&&(w.current=!0),b({type:4,id:C})})),de=F(C=>(b({type:5,id:C}),()=>b({type:5,id:null}))),ne=F(C=>ue(P.mode,{0(){return a?.(C)},1(){let j=P.value.slice(),R=j.findIndex(xe=>H(xe,C));return R===-1?j.push(C):j.splice(R,1),a?.(j)}})),ee=u.useMemo(()=>({onChange:ne,registerOption:U,registerLabel:de,goToOption:ce,closeCombobox:te,openCombobox:z,selectActiveOption:x,selectOption:re}),[]),le=t===null?{}:{ref:t},me=u.useRef(null),fe=et();return u.useEffect(()=>{me.current&&r!==void 0&&fe.addEventListener(me.current,"reset",()=>{a?.(r)})},[me,a]),u.createElement(mn.Provider,{value:ee},u.createElement(hn.Provider,{value:P},u.createElement(bn,{value:ue(P.comboboxState,{0:ke.Open,1:ke.Closed})},i!=null&&f!=null&&dn({[i]:f}).map(([C,j],R)=>u.createElement(Kr,{features:fn.Hidden,ref:R===0?xe=>{var _e;me.current=(_e=xe?.closest("form"))!=null?_e:null}:void 0,...Bt({key:C,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:c,name:C,value:j})})),Fe({ourProps:le,theirProps:s,slot:se,defaultTag:wa,name:"Combobox"}))))}let ya="input";function ka(e,t){var n,r,o,c;let i=tt(),{id:p=`headlessui-combobox-input-${i}`,onChange:v,displayValue:m,type:h="text",...g}=e,s=bt("Combobox.Input"),f=Et("Combobox.Input"),a=We(s.inputRef,t),d=fa(s.inputRef),b=u.useRef(!1),w=et(),T=F(()=>{f.onChange(null),s.optionsRef.current&&(s.optionsRef.current.scrollTop=0),f.goToOption(Z.Nothing)}),k=function(){var x;return typeof m=="function"&&s.value!==void 0?(x=m(s.value))!=null?x:"":typeof s.value=="string"?s.value:""}();Qr(([x,z],[te,ce])=>{if(b.current)return;let U=s.inputRef.current;U&&((ce===0&&z===1||x!==te)&&(U.value=x),requestAnimationFrame(()=>{if(b.current||!U||d?.activeElement!==U)return;let{selectionStart:de,selectionEnd:ne}=U;Math.abs((ne??0)-(de??0))===0&&de===0&&U.setSelectionRange(U.value.length,U.value.length)}))},[k,s.comboboxState,d]),Qr(([x],[z])=>{if(x===0&&z===1){if(b.current)return;let te=s.inputRef.current;if(!te)return;let ce=te.value,{selectionStart:U,selectionEnd:de,selectionDirection:ne}=te;te.value="",te.value=ce,ne!==null?te.setSelectionRange(U,de,ne):te.setSelectionRange(U,de)}},[s.comboboxState]);let S=u.useRef(!1),W=F(()=>{S.current=!0}),_=F(()=>{w.nextFrame(()=>{S.current=!1})}),H=F(x=>{switch(b.current=!0,x.key){case $.Enter:if(b.current=!1,s.comboboxState!==0||S.current)return;if(x.preventDefault(),x.stopPropagation(),s.activeOptionIndex===null){f.closeCombobox();return}f.selectActiveOption(),s.mode===0&&f.closeCombobox();break;case $.ArrowDown:return b.current=!1,x.preventDefault(),x.stopPropagation(),ue(s.comboboxState,{0:()=>{f.goToOption(Z.Next)},1:()=>{f.openCombobox()}});case $.ArrowUp:return b.current=!1,x.preventDefault(),x.stopPropagation(),ue(s.comboboxState,{0:()=>{f.goToOption(Z.Previous)},1:()=>{f.openCombobox(),w.nextFrame(()=>{s.value||f.goToOption(Z.Last)})}});case $.Home:if(x.shiftKey)break;return b.current=!1,x.preventDefault(),x.stopPropagation(),f.goToOption(Z.First);case $.PageUp:return b.current=!1,x.preventDefault(),x.stopPropagation(),f.goToOption(Z.First);case $.End:if(x.shiftKey)break;return b.current=!1,x.preventDefault(),x.stopPropagation(),f.goToOption(Z.Last);case $.PageDown:return b.current=!1,x.preventDefault(),x.stopPropagation(),f.goToOption(Z.Last);case $.Escape:return b.current=!1,s.comboboxState!==0?void 0:(x.preventDefault(),s.optionsRef.current&&!s.optionsPropsRef.current.static&&x.stopPropagation(),s.nullable&&s.mode===0&&s.value===null&&T(),f.closeCombobox());case $.Tab:if(b.current=!1,s.comboboxState!==0)return;s.mode===0&&f.selectActiveOption(),f.closeCombobox();break}}),V=F(x=>{v?.(x),s.nullable&&s.mode===0&&x.target.value===""&&T(),f.openCombobox()}),P=F(()=>{b.current=!1}),K=St(()=>{if(s.labelId)return[s.labelId].join(" ")},[s.labelId]),se=u.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled}),[s]),re={ref:a,id:p,role:"combobox",type:h,"aria-controls":(n=s.optionsRef.current)==null?void 0:n.id,"aria-expanded":s.comboboxState===0,"aria-activedescendant":s.activeOptionIndex===null||(r=s.options[s.activeOptionIndex])==null?void 0:r.id,"aria-labelledby":K,"aria-autocomplete":"list",defaultValue:(c=(o=e.defaultValue)!=null?o:s.defaultValue!==void 0?m?.(s.defaultValue):null)!=null?c:s.defaultValue,disabled:s.disabled,onCompositionStart:W,onCompositionEnd:_,onKeyDown:H,onChange:V,onBlur:P};return Fe({ourProps:re,theirProps:g,slot:se,defaultTag:ya,name:"Combobox.Input"})}let Oa="button";function Sa(e,t){var n;let r=bt("Combobox.Button"),o=Et("Combobox.Button"),c=We(r.buttonRef,t),i=tt(),{id:p=`headlessui-combobox-button-${i}`,...v}=e,m=et(),h=F(d=>{switch(d.key){case $.ArrowDown:return d.preventDefault(),d.stopPropagation(),r.comboboxState===1&&o.openCombobox(),m.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case $.ArrowUp:return d.preventDefault(),d.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),m.nextFrame(()=>{r.value||o.goToOption(Z.Last)})),m.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case $.Escape:return r.comboboxState!==0?void 0:(d.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&d.stopPropagation(),o.closeCombobox(),m.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})}));default:return}}),g=F(d=>{if(qr(d.currentTarget))return d.preventDefault();r.comboboxState===0?o.closeCombobox():(d.preventDefault(),o.openCombobox()),m.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})})}),s=St(()=>{if(r.labelId)return[r.labelId,p].join(" ")},[r.labelId,p]),f=u.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),a={ref:c,id:p,type:Br(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":s,disabled:r.disabled,onClick:g,onKeyDown:h};return Fe({ourProps:a,theirProps:v,slot:f,defaultTag:Oa,name:"Combobox.Button"})}let Ea="label";function _a(e,t){let n=tt(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,c=bt("Combobox.Label"),i=Et("Combobox.Label"),p=We(c.labelRef,t);ve(()=>i.registerLabel(r),[r]);let v=F(()=>{var h;return(h=c.inputRef.current)==null?void 0:h.focus({preventScroll:!0})}),m=u.useMemo(()=>({open:c.comboboxState===0,disabled:c.disabled}),[c]);return Fe({ourProps:{ref:p,id:r,onClick:v},theirProps:o,slot:m,defaultTag:Ea,name:"Combobox.Label"})}let Ta="ul",Ca=pt.RenderStrategy|pt.Static;function Ia(e,t){let n=tt(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...c}=e,i=bt("Combobox.Options"),p=We(i.optionsRef,t),v=Ut(),m=(()=>v!==null?(v&ke.Open)===ke.Open:i.comboboxState===0)();ve(()=>{var f;i.optionsPropsRef.current.static=(f=e.static)!=null?f:!1},[i.optionsPropsRef,e.static]),ve(()=>{i.optionsPropsRef.current.hold=o},[i.optionsPropsRef,o]),ra({container:i.optionsRef.current,enabled:i.comboboxState===0,accept(f){return f.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:f.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(f){f.setAttribute("role","none")}});let h=St(()=>{var f,a;return(a=i.labelId)!=null?a:(f=i.buttonRef.current)==null?void 0:f.id},[i.labelId,i.buttonRef.current]),g=u.useMemo(()=>({open:i.comboboxState===0}),[i]),s={"aria-labelledby":h,role:"listbox","aria-multiselectable":i.mode===1?!0:void 0,id:r,ref:p};return Fe({ourProps:s,theirProps:c,slot:g,defaultTag:Ta,features:Ca,visible:m,name:"Combobox.Options"})}let Pa="li";function La(e,t){var n,r;let o=tt(),{id:c=`headlessui-combobox-option-${o}`,disabled:i=!1,value:p,...v}=e,m=bt("Combobox.Option"),h=Et("Combobox.Option"),g=m.activeOptionIndex!==null?m.options[m.activeOptionIndex].id===c:!1,s=m.isSelected(p),f=u.useRef(null),a=qe({disabled:i,value:p,domRef:f,textValue:(r=(n=f.current)==null?void 0:n.textContent)==null?void 0:r.toLowerCase()}),d=We(t,f),b=F(()=>h.selectOption(c));ve(()=>h.registerOption(c,a),[a,c]);let w=u.useRef(!m.__demoMode);ve(()=>{if(!m.__demoMode)return;let P=Xe();return P.requestAnimationFrame(()=>{w.current=!0}),P.dispose},[]),ve(()=>{if(m.comboboxState!==0||!g||!w.current||m.activationTrigger===0)return;let P=Xe();return P.requestAnimationFrame(()=>{var K,se;(se=(K=f.current)==null?void 0:K.scrollIntoView)==null||se.call(K,{block:"nearest"})}),P.dispose},[f,g,m.comboboxState,m.activationTrigger,m.activeOptionIndex]);let T=F(P=>{if(i)return P.preventDefault();b(),m.mode===0&&h.closeCombobox(),da()||requestAnimationFrame(()=>{var K;return(K=m.inputRef.current)==null?void 0:K.focus()})}),k=F(()=>{if(i)return h.goToOption(Z.Nothing);h.goToOption(Z.Specific,c)}),S=Xr(),W=F(P=>S.update(P)),_=F(P=>{S.wasMoved(P)&&(i||g||h.goToOption(Z.Specific,c,0))}),H=F(P=>{S.wasMoved(P)&&(i||g&&(m.optionsPropsRef.current.hold||h.goToOption(Z.Nothing)))}),V=u.useMemo(()=>({active:g,selected:s,disabled:i}),[g,s,i]);return Fe({ourProps:{id:c,ref:d,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":s,disabled:void 0,onClick:T,onFocus:k,onPointerEnter:W,onMouseEnter:W,onPointerMove:_,onMouseMove:_,onPointerLeave:H,onMouseLeave:H},theirProps:v,slot:V,defaultTag:Pa,name:"Combobox.Option"})}let ja=Te(xa),Fa=Te(Sa),Da=Te(ka),Aa=Te(_a),Na=Te(Ia),Ma=Te(La),_t=Object.assign(ja,{Input:Da,Button:Fa,Label:Aa,Options:Na,Option:Ma});function gn(){let e=u.useRef(!1);return ve(()=>(e.current=!0,()=>{e.current=!1}),[]),e}let Zr=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function $r(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!(o instanceof HTMLElement))return r;let c=!1;for(let p of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))p.remove(),c=!0;let i=c?(n=o.innerText)!=null?n:"":r;return Zr.test(i)&&(i=i.replace(Zr,"")),i}function Ra(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let c=document.getElementById(o);if(c){let i=c.getAttribute("aria-label");return typeof i=="string"?i.trim():$r(c).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return $r(e).trim()}function Wa(e){let t=u.useRef(""),n=u.useRef("");return F(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let c=Ra(r).trim().toLowerCase();return t.current=o,n.current=c,c})}var Va=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Va||{}),Ba=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ba||{}),Ua=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ua||{}),Ha=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.RegisterLabel=7]="RegisterLabel",e))(Ha||{});function wn(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Rr(t(e.options.slice()),c=>c.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let qa={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,r=e.options.findIndex(o=>n(o.dataRef.current.value));return r!==-1&&(t=r),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=wn(e),o=Ur(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:o,activationTrigger:(n=t.trigger)!=null?n:1}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var p;return!i.dataRef.current.disabled&&((p=i.dataRef.current.textValue)==null?void 0:p.startsWith(r))}),c=o?e.options.indexOf(o):-1;return c===-1||c===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:c,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},r=wn(e,o=>[...o,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(n)),{...e,...r}},6:(e,t)=>{let n=wn(e,r=>{let o=r.findIndex(c=>c.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},xn=u.createContext(null);xn.displayName="ListboxActionsContext";function Tt(e){let t=u.useContext(xn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Tt),n}return t}let yn=u.createContext(null);yn.displayName="ListboxDataContext";function Ct(e){let t=u.useContext(yn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ct),n}return t}function za(e,t){return ue(t.type,qa,e,t)}let Ya=u.Fragment;function Ka(e,t){let{value:n,defaultValue:r,form:o,name:c,onChange:i,by:p=(C,j)=>C===j,disabled:v=!1,horizontal:m=!1,multiple:h=!1,...g}=e;const s=m?"horizontal":"vertical";let f=We(t),[a=h?[]:void 0,d]=Gr(n,i,r),[b,w]=u.useReducer(za,{dataRef:u.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),T=u.useRef({static:!1,hold:!1}),k=u.useRef(null),S=u.useRef(null),W=u.useRef(null),_=F(typeof p=="string"?(C,j)=>{let R=p;return C?.[R]===j?.[R]}:p),H=u.useCallback(C=>ue(V.mode,{1:()=>a.some(j=>_(j,C)),0:()=>_(a,C)}),[a]),V=u.useMemo(()=>({...b,value:a,disabled:v,mode:h?1:0,orientation:s,compare:_,isSelected:H,optionsPropsRef:T,labelRef:k,buttonRef:S,optionsRef:W}),[a,v,h,b]);ve(()=>{b.dataRef.current=V},[V]),Wr([V.buttonRef,V.optionsRef],(C,j)=>{var R;w({type:1}),Mr(j,un.Loose)||(C.preventDefault(),(R=V.buttonRef.current)==null||R.focus())},V.listboxState===0);let P=u.useMemo(()=>({open:V.listboxState===0,disabled:v,value:a}),[V,v,a]),K=F(C=>{let j=V.options.find(R=>R.id===C);j&&U(j.dataRef.current.value)}),se=F(()=>{if(V.activeOptionIndex!==null){let{dataRef:C,id:j}=V.options[V.activeOptionIndex];U(C.current.value),w({type:2,focus:Z.Specific,id:j})}}),re=F(()=>w({type:0})),x=F(()=>w({type:1})),z=F((C,j,R)=>C===Z.Specific?w({type:2,focus:Z.Specific,id:j,trigger:R}):w({type:2,focus:C,trigger:R})),te=F((C,j)=>(w({type:5,id:C,dataRef:j}),()=>w({type:6,id:C}))),ce=F(C=>(w({type:7,id:C}),()=>w({type:7,id:null}))),U=F(C=>ue(V.mode,{0(){return d?.(C)},1(){let j=V.value.slice(),R=j.findIndex(xe=>_(xe,C));return R===-1?j.push(C):j.splice(R,1),d?.(j)}})),de=F(C=>w({type:3,value:C})),ne=F(()=>w({type:4})),ee=u.useMemo(()=>({onChange:U,registerOption:te,registerLabel:ce,goToOption:z,closeListbox:x,openListbox:re,selectActiveOption:se,selectOption:K,search:de,clearSearch:ne}),[]),le={ref:f},me=u.useRef(null),fe=et();return u.useEffect(()=>{me.current&&r!==void 0&&fe.addEventListener(me.current,"reset",()=>{d?.(r)})},[me,d]),u.createElement(xn.Provider,{value:ee},u.createElement(yn.Provider,{value:V},u.createElement(bn,{value:ue(V.listboxState,{0:ke.Open,1:ke.Closed})},c!=null&&a!=null&&dn({[c]:a}).map(([C,j],R)=>u.createElement(Kr,{features:fn.Hidden,ref:R===0?xe=>{var _e;me.current=(_e=xe?.closest("form"))!=null?_e:null}:void 0,...Bt({key:C,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,name:C,value:j})})),Fe({ourProps:le,theirProps:g,slot:P,defaultTag:Ya,name:"Listbox"}))))}let Ga="button";function Qa(e,t){var n;let r=tt(),{id:o=`headlessui-listbox-button-${r}`,...c}=e,i=Ct("Listbox.Button"),p=Tt("Listbox.Button"),v=We(i.buttonRef,t),m=et(),h=F(b=>{switch(b.key){case $.Space:case $.Enter:case $.ArrowDown:b.preventDefault(),p.openListbox(),m.nextFrame(()=>{i.value||p.goToOption(Z.First)});break;case $.ArrowUp:b.preventDefault(),p.openListbox(),m.nextFrame(()=>{i.value||p.goToOption(Z.Last)});break}}),g=F(b=>{switch(b.key){case $.Space:b.preventDefault();break}}),s=F(b=>{if(qr(b.currentTarget))return b.preventDefault();i.listboxState===0?(p.closeListbox(),m.nextFrame(()=>{var w;return(w=i.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})})):(b.preventDefault(),p.openListbox())}),f=St(()=>{if(i.labelId)return[i.labelId,o].join(" ")},[i.labelId,o]),a=u.useMemo(()=>({open:i.listboxState===0,disabled:i.disabled,value:i.value}),[i]),d={ref:v,id:o,type:Br(e,i.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=i.optionsRef.current)==null?void 0:n.id,"aria-expanded":i.listboxState===0,"aria-labelledby":f,disabled:i.disabled,onKeyDown:h,onKeyUp:g,onClick:s};return Fe({ourProps:d,theirProps:c,slot:a,defaultTag:Ga,name:"Listbox.Button"})}let Ja="label";function Xa(e,t){let n=tt(),{id:r=`headlessui-listbox-label-${n}`,...o}=e,c=Ct("Listbox.Label"),i=Tt("Listbox.Label"),p=We(c.labelRef,t);ve(()=>i.registerLabel(r),[r]);let v=F(()=>{var h;return(h=c.buttonRef.current)==null?void 0:h.focus({preventScroll:!0})}),m=u.useMemo(()=>({open:c.listboxState===0,disabled:c.disabled}),[c]);return Fe({ourProps:{ref:p,id:r,onClick:v},theirProps:o,slot:m,defaultTag:Ja,name:"Listbox.Label"})}let Za="ul",$a=pt.RenderStrategy|pt.Static;function es(e,t){var n;let r=tt(),{id:o=`headlessui-listbox-options-${r}`,...c}=e,i=Ct("Listbox.Options"),p=Tt("Listbox.Options"),v=We(i.optionsRef,t),m=et(),h=et(),g=Ut(),s=(()=>g!==null?(g&ke.Open)===ke.Open:i.listboxState===0)();u.useEffect(()=>{var w;let T=i.optionsRef.current;T&&i.listboxState===0&&T!==((w=Mt(T))==null?void 0:w.activeElement)&&T.focus({preventScroll:!0})},[i.listboxState,i.optionsRef]);let f=F(w=>{switch(h.dispose(),w.key){case $.Space:if(i.searchQuery!=="")return w.preventDefault(),w.stopPropagation(),p.search(w.key);case $.Enter:if(w.preventDefault(),w.stopPropagation(),i.activeOptionIndex!==null){let{dataRef:T}=i.options[i.activeOptionIndex];p.onChange(T.current.value)}i.mode===0&&(p.closeListbox(),Xe().nextFrame(()=>{var T;return(T=i.buttonRef.current)==null?void 0:T.focus({preventScroll:!0})}));break;case ue(i.orientation,{vertical:$.ArrowDown,horizontal:$.ArrowRight}):return w.preventDefault(),w.stopPropagation(),p.goToOption(Z.Next);case ue(i.orientation,{vertical:$.ArrowUp,horizontal:$.ArrowLeft}):return w.preventDefault(),w.stopPropagation(),p.goToOption(Z.Previous);case $.Home:case $.PageUp:return w.preventDefault(),w.stopPropagation(),p.goToOption(Z.First);case $.End:case $.PageDown:return w.preventDefault(),w.stopPropagation(),p.goToOption(Z.Last);case $.Escape:return w.preventDefault(),w.stopPropagation(),p.closeListbox(),m.nextFrame(()=>{var T;return(T=i.buttonRef.current)==null?void 0:T.focus({preventScroll:!0})});case $.Tab:w.preventDefault(),w.stopPropagation();break;default:w.key.length===1&&(p.search(w.key),h.setTimeout(()=>p.clearSearch(),350));break}}),a=St(()=>{var w,T,k;return(k=(w=i.labelRef.current)==null?void 0:w.id)!=null?k:(T=i.buttonRef.current)==null?void 0:T.id},[i.labelRef.current,i.buttonRef.current]),d=u.useMemo(()=>({open:i.listboxState===0}),[i]),b={"aria-activedescendant":i.activeOptionIndex===null||(n=i.options[i.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":i.mode===1?!0:void 0,"aria-labelledby":a,"aria-orientation":i.orientation,id:o,onKeyDown:f,role:"listbox",tabIndex:0,ref:v};return Fe({ourProps:b,theirProps:c,slot:d,defaultTag:Za,features:$a,visible:s,name:"Listbox.Options"})}let ts="li";function ns(e,t){let n=tt(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:c,...i}=e,p=Ct("Listbox.Option"),v=Tt("Listbox.Option"),m=p.activeOptionIndex!==null?p.options[p.activeOptionIndex].id===r:!1,h=p.isSelected(c),g=u.useRef(null),s=Wa(g),f=qe({disabled:o,value:c,domRef:g,get textValue(){return s()}}),a=We(t,g);ve(()=>{if(p.listboxState!==0||!m||p.activationTrigger===0)return;let _=Xe();return _.requestAnimationFrame(()=>{var H,V;(V=(H=g.current)==null?void 0:H.scrollIntoView)==null||V.call(H,{block:"nearest"})}),_.dispose},[g,m,p.listboxState,p.activationTrigger,p.activeOptionIndex]),ve(()=>v.registerOption(r,f),[f,r]);let d=F(_=>{if(o)return _.preventDefault();v.onChange(c),p.mode===0&&(v.closeListbox(),Xe().nextFrame(()=>{var H;return(H=p.buttonRef.current)==null?void 0:H.focus({preventScroll:!0})}))}),b=F(()=>{if(o)return v.goToOption(Z.Nothing);v.goToOption(Z.Specific,r)}),w=Xr(),T=F(_=>w.update(_)),k=F(_=>{w.wasMoved(_)&&(o||m||v.goToOption(Z.Specific,r,0))}),S=F(_=>{w.wasMoved(_)&&(o||m&&v.goToOption(Z.Nothing))}),W=u.useMemo(()=>({active:m,selected:h,disabled:o}),[m,h,o]);return Fe({ourProps:{id:r,ref:a,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":h,disabled:void 0,onClick:d,onFocus:b,onPointerEnter:T,onMouseEnter:T,onPointerMove:k,onMouseMove:k,onPointerLeave:S,onMouseLeave:S},theirProps:i,slot:W,defaultTag:ts,name:"Listbox.Option"})}let rs=Te(Ka),os=Te(Qa),is=Te(Xa),as=Te(es),ss=Te(ns),Ht=Object.assign(rs,{Button:os,Label:is,Options:as,Option:ss});function ls(e=0){let[t,n]=u.useState(e),r=gn(),o=u.useCallback(v=>{r.current&&n(m=>m|v)},[t,r]),c=u.useCallback(v=>!!(t&v),[t]),i=u.useCallback(v=>{r.current&&n(m=>m&~v)},[n,r]),p=u.useCallback(v=>{r.current&&n(m=>m^v)},[n]);return{flags:t,addFlag:o,hasFlag:c,removeFlag:i,toggleFlag:p}}function us(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function kn(e,...t){e&&t.length>0&&e.classList.add(...t)}function On(e,...t){e&&t.length>0&&e.classList.remove(...t)}function cs(e,t){let n=Xe();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[c,i]=[r,o].map(v=>{let[m=0]=v.split(",").filter(Boolean).map(h=>h.includes("ms")?parseFloat(h):parseFloat(h)*1e3).sort((h,g)=>g-h);return m}),p=c+i;if(p!==0){n.group(m=>{m.setTimeout(()=>{t(),m.dispose()},p),m.addEventListener(e,"transitionrun",h=>{h.target===h.currentTarget&&m.dispose()})});let v=n.addEventListener(e,"transitionend",m=>{m.target===m.currentTarget&&(t(),v())})}else t();return n.add(()=>t()),n.dispose}function ds(e,t,n,r){let o=n?"enter":"leave",c=Xe(),i=r!==void 0?us(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let p=ue(o,{enter:()=>t.enter,leave:()=>t.leave}),v=ue(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),m=ue(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return On(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),kn(e,...t.base,...p,...m),c.nextFrame(()=>{On(e,...t.base,...p,...m),kn(e,...t.base,...p,...v),cs(e,()=>(On(e,...t.base,...p),kn(e,...t.base,...t.entered),i()))}),c.dispose}function fs({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:c}){let i=gn(),p=et(),v=qe(n);ve(()=>{e&&(v.current="enter")},[e]),ve(()=>{let m=Xe();p.add(m.dispose);let h=t.current;if(h&&v.current!=="idle"&&i.current)return m.dispose(),o.current(v.current),m.add(ds(h,r.current,v.current==="enter",()=>{m.dispose(),c.current(v.current)})),m.dispose},[n])}function st(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let qt=u.createContext(null);qt.displayName="TransitionContext";var ps=(e=>(e.Visible="visible",e.Hidden="hidden",e))(ps||{});function bs(){let e=u.useContext(qt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function vs(){let e=u.useContext(zt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let zt=u.createContext(null);zt.displayName="NestingContext";function Yt(e){return"children"in e?Yt(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function eo(e,t){let n=qe(e),r=u.useRef([]),o=gn(),c=et(),i=F((f,a=at.Hidden)=>{let d=r.current.findIndex(({el:b})=>b===f);d!==-1&&(ue(a,{[at.Unmount](){r.current.splice(d,1)},[at.Hidden](){r.current[d].state="hidden"}}),c.microTask(()=>{var b;!Yt(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),p=F(f=>{let a=r.current.find(({el:d})=>d===f);return a?a.state!=="visible"&&(a.state="visible"):r.current.push({el:f,state:"visible"}),()=>i(f,at.Unmount)}),v=u.useRef([]),m=u.useRef(Promise.resolve()),h=u.useRef({enter:[],leave:[],idle:[]}),g=F((f,a,d)=>{v.current.splice(0),t&&(t.chains.current[a]=t.chains.current[a].filter(([b])=>b!==f)),t?.chains.current[a].push([f,new Promise(b=>{v.current.push(b)})]),t?.chains.current[a].push([f,new Promise(b=>{Promise.all(h.current[a].map(([w,T])=>T)).then(()=>b())})]),a==="enter"?m.current=m.current.then(()=>t?.wait.current).then(()=>d(a)):d(a)}),s=F((f,a,d)=>{Promise.all(h.current[a].splice(0).map(([b,w])=>w)).then(()=>{var b;(b=v.current.shift())==null||b()}).then(()=>d(a))});return u.useMemo(()=>({children:r,register:p,unregister:i,onStart:g,onStop:s,wait:m,chains:h}),[p,i,r,g,s,h,m])}function ms(){}let hs=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function to(e){var t;let n={};for(let r of hs)n[r]=(t=e[r])!=null?t:ms;return n}function gs(e){let t=u.useRef(to(e));return u.useEffect(()=>{t.current=to(e)},[e]),t}let ws="div",no=pt.RenderStrategy;function xs(e,t){var n,r;let{beforeEnter:o,afterEnter:c,beforeLeave:i,afterLeave:p,enter:v,enterFrom:m,enterTo:h,entered:g,leave:s,leaveFrom:f,leaveTo:a,...d}=e,b=u.useRef(null),w=We(b,t),T=(n=d.unmount)==null||n?at.Unmount:at.Hidden,{show:k,appear:S,initial:W}=bs(),[_,H]=u.useState(k?"visible":"hidden"),V=vs(),{register:P,unregister:K}=V;u.useEffect(()=>P(b),[P,b]),u.useEffect(()=>{if(T===at.Hidden&&b.current){if(k&&_!=="visible"){H("visible");return}return ue(_,{hidden:()=>K(b),visible:()=>P(b)})}},[_,b,P,K,k,T]);let se=qe({base:st(d.className),enter:st(v),enterFrom:st(m),enterTo:st(h),entered:st(g),leave:st(s),leaveFrom:st(f),leaveTo:st(a)}),re=gs({beforeEnter:o,afterEnter:c,beforeLeave:i,afterLeave:p}),x=ln();u.useEffect(()=>{if(x&&_==="visible"&&b.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[b,_,x]);let z=W&&!S,te=S&&k&&W,ce=(()=>!x||z?"idle":k?"enter":"leave")(),U=ls(0),de=F(fe=>ue(fe,{enter:()=>{U.addFlag(ke.Opening),re.current.beforeEnter()},leave:()=>{U.addFlag(ke.Closing),re.current.beforeLeave()},idle:()=>{}})),ne=F(fe=>ue(fe,{enter:()=>{U.removeFlag(ke.Opening),re.current.afterEnter()},leave:()=>{U.removeFlag(ke.Closing),re.current.afterLeave()},idle:()=>{}})),ee=eo(()=>{H("hidden"),K(b)},V);fs({immediate:te,container:b,classes:se,direction:ce,onStart:qe(fe=>{ee.onStart(b,fe,de)}),onStop:qe(fe=>{ee.onStop(b,fe,ne),fe==="leave"&&!Yt(ee)&&(H("hidden"),K(b))})});let le=d,me={ref:w};return te?le={...le,className:Wt(d.className,...se.current.enter,...se.current.enterFrom)}:(le.className=Wt(d.className,(r=b.current)==null?void 0:r.className),le.className===""&&delete le.className),u.createElement(zt.Provider,{value:ee},u.createElement(bn,{value:ue(_,{visible:ke.Open,hidden:ke.Closed})|U.flags},Fe({ourProps:me,theirProps:le,defaultTag:ws,features:no,visible:_==="visible",name:"Transition.Child"})))}function ys(e,t){let{show:n,appear:r=!1,unmount:o=!0,...c}=e,i=u.useRef(null),p=We(i,t);ln();let v=Ut();if(n===void 0&&v!==null&&(n=(v&ke.Open)===ke.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[m,h]=u.useState(n?"visible":"hidden"),g=eo(()=>{h("hidden")}),[s,f]=u.useState(!0),a=u.useRef([n]);ve(()=>{s!==!1&&a.current[a.current.length-1]!==n&&(a.current.push(n),f(!1))},[a,n]);let d=u.useMemo(()=>({show:n,appear:r,initial:s}),[n,r,s]);u.useEffect(()=>{if(n)h("visible");else if(!Yt(g))h("hidden");else{let k=i.current;if(!k)return;let S=k.getBoundingClientRect();S.x===0&&S.y===0&&S.width===0&&S.height===0&&h("hidden")}},[n,g]);let b={unmount:o},w=F(()=>{var k;s&&f(!1),(k=e.beforeEnter)==null||k.call(e)}),T=F(()=>{var k;s&&f(!1),(k=e.beforeLeave)==null||k.call(e)});return u.createElement(zt.Provider,{value:g},u.createElement(qt.Provider,{value:d},Fe({ourProps:{...b,as:u.Fragment,children:u.createElement(ro,{ref:p,...b,...c,beforeEnter:w,beforeLeave:T})},theirProps:{},defaultTag:u.Fragment,features:no,visible:m==="visible",name:"Transition"})))}function ks(e,t){let n=u.useContext(qt)!==null,r=Ut()!==null;return u.createElement(u.Fragment,null,!n&&r?u.createElement(Sn,{ref:t,...e}):u.createElement(ro,{ref:t,...e}))}let Sn=Te(ys),ro=Te(xs),Os=Te(ks),oo=Object.assign(Sn,{Child:Os,Root:Sn});function Ss({title:e,titleId:t,...n},r){return $e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?$e.createElement("title",{id:t},e):null,$e.createElement("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"}))}const io=$e.forwardRef(Ss),Ne={select:"_select_12thw_1",selectContainer:"_selectContainer_12thw_4",selectButton:"_selectButton_12thw_7",open:"_open_12thw_13",selectValue:"_selectValue_12thw_16",seletIcon:"_seletIcon_12thw_19",selectText:"_selectText_12thw_22",chevronDownIconSpan:"_chevronDownIconSpan_12thw_25",chevronDownIcon:"_chevronDownIcon_12thw_25",leave:"_leave_12thw_32",leaveFrom:"_leaveFrom_12thw_36",leaveTo:"_leaveTo_12thw_40",selectOptions:"_selectOptions_12thw_44"},Es=({children:e,selected:t,onSelect:n,themeColor:r})=>{const[o,c]=u.useState(!1),[i,p]=u.useState(!1),v=u.useRef(null),m=u.useRef(null),h=u.useRef(null),[g,s]=u.useState({left:0,top:0}),f=u.useRef(0),a=u.useRef(0);let d="#333333";const b=_=>{n(_)},w=()=>{c(!0)},T=()=>{c(!1)};u.useEffect(()=>{const _=m.current;return _&&(_.addEventListener("focus",w),_.addEventListener("blur",T)),()=>{_&&(_.removeEventListener("focus",w),_.removeEventListener("blur",T))}},[w,T]);const k=()=>{f.current=window.innerHeight,a.current=document.body.scrollHeight,p(!0)};u.useEffect(()=>(k(),window.addEventListener("resize",k),()=>{window.addEventListener("resize",k)}),[]);const S=()=>a.current-(f.current+window.scrollY),W=()=>{if(v.current){const _=v.current.getBoundingClientRect();setTimeout(()=>{const H=h?.current?.getBoundingClientRect(),V=S(),P=f.current-_.bottom;let K;if(H){const se=_.height,re=_.top,x=H.height,z=x>=re+window.scrollY;x>=re&&(z||z&&P<=x||V>=x||P>=x)||re>=x&&P>=x?K=_.y+se:K=_.y-x,s({left:_.left,top:K??_.top})}},0)}};if(u.useEffect(()=>(window.addEventListener("scroll",W),window.addEventListener("resize",W),()=>{window.removeEventListener("scroll",W),window.removeEventListener("resize",W)}),[]),r){r=He.convert3HexTo6(r);const _=rt(r);(_==="dark"||_==="light")&&(d=r==="#ffffff"?"#c8c8c8":r)}return O.jsx(Ht,{value:t,onChange:b,children:({open:_})=>O.jsxs("div",{className:Ne.select,children:[O.jsx("div",{className:Ne.selectContainer,ref:v,children:O.jsxs(Ht.Button,{"data-testid":"select-options",ref:m,onFocus:w,onBlur:T,onClick:W,onKeyDown:H=>{(H.key===" "||H.code==="Space"||H.code==="Enter")&&W()},style:{borderBottomColor:r&&(o||_)?d:""},className:`${Ne.selectButton} ${_?Ne.open:""}`,children:[t&&O.jsxs("span",{className:Ne.selectValue,children:[t.avatar&&O.jsx("img",{src:t.avatar,alt:"",className:Ne.seletIcon}),O.jsx("span",{className:Ne.selectText,children:t.label})]}),O.jsx("span",{className:Ne.chevronDownIconSpan,children:O.jsx(io,{className:Ne.chevronDownIcon,"aria-hidden":"true"})})]})}),i?Qt.createPortal(O.jsx(O.Fragment,{children:_&&O.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(255,255,255,0)",zIndex:1e3},children:O.jsx("div",{ref:h,style:{position:"absolute",opacity:g.left?1:0,width:v.current?v.current.clientWidth:"auto",left:g.left,top:g.top},children:e})})}),document.body):null]})})},_s=({children:e,setQuery:t})=>O.jsx(oo,{as:u.Fragment,leave:Ne.leave,leaveFrom:Ne.leaveFrom,leaveTo:Ne.leaveTo,afterLeave:()=>t(""),children:O.jsx(Ht.Options,{className:Ne.selectOptions,children:e})}),ao=u.forwardRef((e,t)=>O.jsx(Ht.Option,{ref:t,className:e.className,value:e.value,disabled:e.disable,children:e.children}));ao.displayName="SelectOption";const ze={autocomplete:"_autocomplete_1ue23_1",autocompleteContainer:"_autocompleteContainer_1ue23_4",disable:"_disable_1ue23_7",autocompleteInput:"_autocompleteInput_1ue23_16",autocompleteButton:"_autocompleteButton_1ue23_25",chevronDownIcon:"_chevronDownIcon_1ue23_28",leave:"_leave_1ue23_35",leaveFrom:"_leaveFrom_1ue23_39",leaveTo:"_leaveTo_1ue23_43",autocompleteOptions:"_autocompleteOptions_1ue23_47"},Ts=({children:e,selected:t,onSelect:n,setQuery:r,disable:o,clearSearch:c=!1,themeColor:i})=>{const p=u.useRef(null),v=u.useRef(null),[m,h]=u.useState(!1),[g,s]=u.useState(!1),f=u.useRef(null),a=u.useRef(null),[d,b]=u.useState({left:0,top:0}),w=u.useRef(0),T=u.useRef(0);let k={};u.useEffect(()=>{p.current&&t&&(p.current.value=t.label||"")},[t]);const S=()=>{w.current=window.innerHeight,T.current=document.body.scrollHeight,s(!0)};u.useEffect(()=>(S(),window.addEventListener("resize",S),()=>{window.addEventListener("resize",S)}),[]);const W=()=>T.current-(w.current+window.scrollY),_=()=>{if(f.current){const x=f.current.getBoundingClientRect();setTimeout(()=>{const z=a?.current?.getBoundingClientRect(),te=W(),ce=w.current-x.bottom;let U;if(z){const de=x.height,ne=x.top,ee=z.height,le=ee>ne+window.scrollY;ne<ee&&(le||le&&ce<ee||te>ee||ce>ee)||ne>ee&&ce>ee?U=x.y+de:U=x.y-ee,b({left:x.left,top:U??x.top})}},0)}};u.useEffect(()=>(window.addEventListener("scroll",_),window.addEventListener("resize",_),()=>{window.removeEventListener("scroll",_),window.removeEventListener("resize",_)}),[]);const H=x=>{n(x),K()},V=()=>{_(),h(!0),p.current&&t&&(p.current.value=t.label||""),p.current&&v.current&&(c&&(p.current.value="",r("")),v.current.click())},P=x=>x?.label,K=()=>{const x=p.current;x&&x.setSelectionRange(x.value.length,x.value.length)},se=()=>{h(!0)},re=()=>{h(!1)};if(u.useEffect(()=>{const x=p.current;return x&&(x.addEventListener("focus",se),x.addEventListener("blur",re)),()=>{x&&(x.removeEventListener("focus",se),x.removeEventListener("blur",re))}},[se,re]),i){const x=rt(i);i=He.convert3HexTo6(i),(x==="dark"||x==="light")&&(k={borderBottomColor:i==="#ffffff"?"#c8c8c8":m?i:"#333333"})}return O.jsx(_t,{value:t,onChange:H,disabled:o,children:({open:x})=>O.jsxs("div",{className:ze.autocomplete,children:[O.jsxs("div",{ref:f,className:`${ze.autocompleteContainer} ${o?ze.disable:""}`,children:[O.jsx(_t.Input,{ref:p,"data-testid":"select-input",className:ze.autocompleteInput,displayValue:P,onChange:z=>{r(z.target.value),_()},onClick:V,onFocus:se,onBlur:re,onKeyDown:z=>{(z.key===" "||z.code==="Space")&&_()},style:{...k},placeholder:"Select your option",autoComplete:"off"}),O.jsx(_t.Button,{className:ze.autocompleteButton,"data-testid":"select-button",ref:v,onClick:_,children:O.jsx(io,{className:`${ze.chevronDownIcon} ${o?ze.disable:""}`,"aria-hidden":"true"})})]}),g?Qt.createPortal(O.jsx(O.Fragment,{children:x&&O.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(255,255,255,0)",zIndex:1e3},children:O.jsx("div",{ref:a,style:{position:"absolute",opacity:d.left?1:0,width:f.current?f.current.clientWidth:"auto",left:d.left,top:d.top},children:e})})}),document.body):null]})})},Cs=({children:e,setQuery:t})=>O.jsx(oo,{as:u.Fragment,leave:ze.leave,leaveFrom:ze.leaveFrom,leaveTo:ze.leaveTo,afterLeave:()=>t(""),children:O.jsx(_t.Options,{className:ze.autocompleteOptions,children:e})}),so=u.forwardRef((e,t)=>O.jsx(_t.Option,{ref:t,className:e.className,value:e.value,disabled:e.disable,children:e.children}));so.displayName="AutoCompleteOption";const lo={textInputWrapper:"_textInputWrapper_gym4n_1",textInput:"_textInput_gym4n_1"},Is=u.memo(u.forwardRef(({themeColor:e="",style:t={},className:n="",onFocus:r,onBlur:o,...c},i)=>{const[p,v]=u.useState(!1);let m={};const h=[lo.textInput,n].filter(Boolean).join(" ");e=He.convert3HexTo6(e);const g=()=>{v(!0)},s=()=>{v(!1)};return m={borderBottomColor:p?e!=="#ffffff"?e:"#c8c8c8":""},O.jsx("div",{className:lo.textInputWrapper,children:O.jsx("input",{type:"text","data-testid":"textbox-input",ref:i,className:h,onFocus:g,onBlur:s,style:{...m,...t},...c})})}));be.AutoComplete=Ts,be.AutoCompleteOption=so,be.AutoCompleteOptions=Cs,be.Button=Xt,be.Checkbox=Zt,be.ColorsService=He,be.MultiLineInput=Bi,be.MultiSelect=Ui,be.QuickMultiSelect=Hi,be.QuickSelect=qi,be.Scrollbar=Dr,be.Select=Es,be.SelectOption=ao,be.SelectOptions=_s,be.SingleLineInput=Is,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})});
|
|
32
|
+
`));let g=m.props,s=typeof g?.className=="function"?(...a)=>Wt(g?.className(...a),p.className):Wt(g?.className,p.className),f=s?{className:s}:{};return u.cloneElement(m,Object.assign({},Hr(m.props,Bt(cn(p,["ref"]))),h,v,ia(m.ref,v.ref),f))}return u.createElement(o,Object.assign({},cn(p,["ref"]),o!==u.Fragment&&v,o!==u.Fragment&&h),m)}function ia(...e){return{ref:e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}}function Hr(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...c){let i=n[r];for(let p of i){if((o instanceof Event||o?.nativeEvent instanceof Event)&&o.defaultPrevented)return;p(o,...c)}}});return t}function Te(e){var t;return Object.assign(u.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Bt(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function cn(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function qr(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=t?.getAttribute("disabled")==="";return r&&aa(n)?!1:r}function aa(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function dn(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Yr(n,zr(t,r),o);return n}function zr(e,t){return e?e+"["+t+"]":t}function Yr(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Yr(e,zr(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):dn(n,t,e)}let sa="div";var fn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(fn||{});function la(e,t){let{features:n=1,...r}=e,o={ref:t,"aria-hidden":(n&2)===2?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return Fe({ourProps:o,theirProps:r,slot:{},defaultTag:sa,name:"Hidden"})}let Kr=Te(la),pn=u.createContext(null);pn.displayName="OpenClosedContext";var ke=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ke||{});function Ut(){return u.useContext(pn)}function bn({value:e,children:t}){return u.createElement(pn.Provider,{value:e},t)}var $=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))($||{});function Gr(e,t,n){let[r,o]=u.useState(n),c=e!==void 0,i=u.useRef(c),p=u.useRef(!1),v=u.useRef(!1);return c&&!i.current&&!p.current?(p.current=!0,i.current=c,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!c&&i.current&&!v.current&&(v.current=!0,i.current=c,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[c?e:r,F(m=>(c||o(m),t?.(m)))]}function Qr(e,t){let n=u.useRef([]),r=F(e);u.useEffect(()=>{let o=[...n.current];for(let[c,i]of t.entries())if(n.current[c]!==i){let p=r(t,o);return n.current=t,p}},[r,...t])}function Jr(e){return[e.screenX,e.screenY]}function Xr(){let e=u.useRef([-1,-1]);return{wasMoved(t){let n=Jr(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Jr(t)}}}function ua(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function ca(){return/Android/gi.test(window.navigator.userAgent)}function da(){return ua()||ca()}function fa(...e){return u.useMemo(()=>Mt(...e),[...e])}var pa=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(pa||{}),ba=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(ba||{}),va=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(va||{}),ma=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e))(ma||{});function vn(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Rr(t(e.options.slice()),c=>c.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let ha={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;let n=e.activeOptionIndex;if(e.dataRef.current){let{isSelected:r}=e.dataRef.current,o=e.options.findIndex(c=>r(c.dataRef.current.value));o!==-1&&(n=o)}return{...e,comboboxState:0,activeOptionIndex:n}},2(e,t){var n,r,o,c;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;let i=vn(e);if(i.activeOptionIndex===null){let v=i.options.findIndex(m=>!m.dataRef.current.disabled);v!==-1&&(i.activeOptionIndex=v)}let p=Ur(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:v=>v.id,resolveDisabled:v=>v.dataRef.current.disabled});return{...e,...i,activeOptionIndex:p,activationTrigger:(c=t.trigger)!=null?c:1}},3:(e,t)=>{var n,r;let o={id:t.id,dataRef:t.dataRef},c=vn(e,p=>[...p,o]);e.activeOptionIndex===null&&(n=e.dataRef.current)!=null&&n.isSelected(t.dataRef.current.value)&&(c.activeOptionIndex=c.options.indexOf(o));let i={...e,...c,activationTrigger:1};return(r=e.dataRef.current)!=null&&r.__demoMode&&e.dataRef.current.value===void 0&&(i.activeOptionIndex=0),i},4:(e,t)=>{let n=vn(e,r=>{let o=r.findIndex(c=>c.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...n,activationTrigger:1}},5:(e,t)=>({...e,labelId:t.id})},mn=u.createContext(null);mn.displayName="ComboboxActionsContext";function Et(e){let t=u.useContext(mn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Et),n}return t}let hn=u.createContext(null);hn.displayName="ComboboxDataContext";function bt(e){let t=u.useContext(hn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,bt),n}return t}function ga(e,t){return ue(t.type,ha,e,t)}let wa=u.Fragment;function xa(e,t){let{value:n,defaultValue:r,onChange:o,form:c,name:i,by:p=(C,j)=>C===j,disabled:v=!1,__demoMode:m=!1,nullable:h=!1,multiple:g=!1,...s}=e,[f=g?[]:void 0,a]=Gr(n,o,r),[d,b]=u.useReducer(ga,{dataRef:u.createRef(),comboboxState:m?0:1,options:[],activeOptionIndex:null,activationTrigger:1,labelId:null}),w=u.useRef(!1),T=u.useRef({static:!1,hold:!1}),k=u.useRef(null),S=u.useRef(null),W=u.useRef(null),_=u.useRef(null),H=F(typeof p=="string"?(C,j)=>{let R=p;return C?.[R]===j?.[R]}:p),V=u.useCallback(C=>ue(P.mode,{1:()=>f.some(j=>H(j,C)),0:()=>H(f,C)}),[f]),P=u.useMemo(()=>({...d,optionsPropsRef:T,labelRef:k,inputRef:S,buttonRef:W,optionsRef:_,value:f,defaultValue:r,disabled:v,mode:g?1:0,get activeOptionIndex(){if(w.current&&d.activeOptionIndex===null&&d.options.length>0){let C=d.options.findIndex(j=>!j.dataRef.current.disabled);if(C!==-1)return C}return d.activeOptionIndex},compare:H,isSelected:V,nullable:h,__demoMode:m}),[f,r,v,g,h,m,d]),K=u.useRef(P.activeOptionIndex!==null?P.options[P.activeOptionIndex]:null);u.useEffect(()=>{let C=P.activeOptionIndex!==null?P.options[P.activeOptionIndex]:null;K.current!==C&&(K.current=C)}),ve(()=>{d.dataRef.current=P},[P]),Wr([P.buttonRef,P.inputRef,P.optionsRef],()=>ee.closeCombobox(),P.comboboxState===0);let se=u.useMemo(()=>({open:P.comboboxState===0,disabled:v,activeIndex:P.activeOptionIndex,activeOption:P.activeOptionIndex===null?null:P.options[P.activeOptionIndex].dataRef.current.value,value:f}),[P,v,f]),re=F(C=>{let j=P.options.find(R=>R.id===C);j&&ne(j.dataRef.current.value)}),x=F(()=>{if(P.activeOptionIndex!==null){let{dataRef:C,id:j}=P.options[P.activeOptionIndex];ne(C.current.value),ee.goToOption(Z.Specific,j)}}),z=F(()=>{b({type:0}),w.current=!0}),te=F(()=>{b({type:1}),w.current=!1}),ce=F((C,j,R)=>(w.current=!1,C===Z.Specific?b({type:2,focus:Z.Specific,id:j,trigger:R}):b({type:2,focus:C,trigger:R}))),U=F((C,j)=>(b({type:3,id:C,dataRef:j}),()=>{var R;((R=K.current)==null?void 0:R.id)===C&&(w.current=!0),b({type:4,id:C})})),de=F(C=>(b({type:5,id:C}),()=>b({type:5,id:null}))),ne=F(C=>ue(P.mode,{0(){return a?.(C)},1(){let j=P.value.slice(),R=j.findIndex(xe=>H(xe,C));return R===-1?j.push(C):j.splice(R,1),a?.(j)}})),ee=u.useMemo(()=>({onChange:ne,registerOption:U,registerLabel:de,goToOption:ce,closeCombobox:te,openCombobox:z,selectActiveOption:x,selectOption:re}),[]),le=t===null?{}:{ref:t},me=u.useRef(null),fe=et();return u.useEffect(()=>{me.current&&r!==void 0&&fe.addEventListener(me.current,"reset",()=>{a?.(r)})},[me,a]),u.createElement(mn.Provider,{value:ee},u.createElement(hn.Provider,{value:P},u.createElement(bn,{value:ue(P.comboboxState,{0:ke.Open,1:ke.Closed})},i!=null&&f!=null&&dn({[i]:f}).map(([C,j],R)=>u.createElement(Kr,{features:fn.Hidden,ref:R===0?xe=>{var _e;me.current=(_e=xe?.closest("form"))!=null?_e:null}:void 0,...Bt({key:C,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:c,name:C,value:j})})),Fe({ourProps:le,theirProps:s,slot:se,defaultTag:wa,name:"Combobox"}))))}let ya="input";function ka(e,t){var n,r,o,c;let i=tt(),{id:p=`headlessui-combobox-input-${i}`,onChange:v,displayValue:m,type:h="text",...g}=e,s=bt("Combobox.Input"),f=Et("Combobox.Input"),a=We(s.inputRef,t),d=fa(s.inputRef),b=u.useRef(!1),w=et(),T=F(()=>{f.onChange(null),s.optionsRef.current&&(s.optionsRef.current.scrollTop=0),f.goToOption(Z.Nothing)}),k=function(){var x;return typeof m=="function"&&s.value!==void 0?(x=m(s.value))!=null?x:"":typeof s.value=="string"?s.value:""}();Qr(([x,z],[te,ce])=>{if(b.current)return;let U=s.inputRef.current;U&&((ce===0&&z===1||x!==te)&&(U.value=x),requestAnimationFrame(()=>{if(b.current||!U||d?.activeElement!==U)return;let{selectionStart:de,selectionEnd:ne}=U;Math.abs((ne??0)-(de??0))===0&&de===0&&U.setSelectionRange(U.value.length,U.value.length)}))},[k,s.comboboxState,d]),Qr(([x],[z])=>{if(x===0&&z===1){if(b.current)return;let te=s.inputRef.current;if(!te)return;let ce=te.value,{selectionStart:U,selectionEnd:de,selectionDirection:ne}=te;te.value="",te.value=ce,ne!==null?te.setSelectionRange(U,de,ne):te.setSelectionRange(U,de)}},[s.comboboxState]);let S=u.useRef(!1),W=F(()=>{S.current=!0}),_=F(()=>{w.nextFrame(()=>{S.current=!1})}),H=F(x=>{switch(b.current=!0,x.key){case $.Enter:if(b.current=!1,s.comboboxState!==0||S.current)return;if(x.preventDefault(),x.stopPropagation(),s.activeOptionIndex===null){f.closeCombobox();return}f.selectActiveOption(),s.mode===0&&f.closeCombobox();break;case $.ArrowDown:return b.current=!1,x.preventDefault(),x.stopPropagation(),ue(s.comboboxState,{0:()=>{f.goToOption(Z.Next)},1:()=>{f.openCombobox()}});case $.ArrowUp:return b.current=!1,x.preventDefault(),x.stopPropagation(),ue(s.comboboxState,{0:()=>{f.goToOption(Z.Previous)},1:()=>{f.openCombobox(),w.nextFrame(()=>{s.value||f.goToOption(Z.Last)})}});case $.Home:if(x.shiftKey)break;return b.current=!1,x.preventDefault(),x.stopPropagation(),f.goToOption(Z.First);case $.PageUp:return b.current=!1,x.preventDefault(),x.stopPropagation(),f.goToOption(Z.First);case $.End:if(x.shiftKey)break;return b.current=!1,x.preventDefault(),x.stopPropagation(),f.goToOption(Z.Last);case $.PageDown:return b.current=!1,x.preventDefault(),x.stopPropagation(),f.goToOption(Z.Last);case $.Escape:return b.current=!1,s.comboboxState!==0?void 0:(x.preventDefault(),s.optionsRef.current&&!s.optionsPropsRef.current.static&&x.stopPropagation(),s.nullable&&s.mode===0&&s.value===null&&T(),f.closeCombobox());case $.Tab:if(b.current=!1,s.comboboxState!==0)return;s.mode===0&&f.selectActiveOption(),f.closeCombobox();break}}),V=F(x=>{v?.(x),s.nullable&&s.mode===0&&x.target.value===""&&T(),f.openCombobox()}),P=F(()=>{b.current=!1}),K=St(()=>{if(s.labelId)return[s.labelId].join(" ")},[s.labelId]),se=u.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled}),[s]),re={ref:a,id:p,role:"combobox",type:h,"aria-controls":(n=s.optionsRef.current)==null?void 0:n.id,"aria-expanded":s.comboboxState===0,"aria-activedescendant":s.activeOptionIndex===null||(r=s.options[s.activeOptionIndex])==null?void 0:r.id,"aria-labelledby":K,"aria-autocomplete":"list",defaultValue:(c=(o=e.defaultValue)!=null?o:s.defaultValue!==void 0?m?.(s.defaultValue):null)!=null?c:s.defaultValue,disabled:s.disabled,onCompositionStart:W,onCompositionEnd:_,onKeyDown:H,onChange:V,onBlur:P};return Fe({ourProps:re,theirProps:g,slot:se,defaultTag:ya,name:"Combobox.Input"})}let Oa="button";function Sa(e,t){var n;let r=bt("Combobox.Button"),o=Et("Combobox.Button"),c=We(r.buttonRef,t),i=tt(),{id:p=`headlessui-combobox-button-${i}`,...v}=e,m=et(),h=F(d=>{switch(d.key){case $.ArrowDown:return d.preventDefault(),d.stopPropagation(),r.comboboxState===1&&o.openCombobox(),m.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case $.ArrowUp:return d.preventDefault(),d.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),m.nextFrame(()=>{r.value||o.goToOption(Z.Last)})),m.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case $.Escape:return r.comboboxState!==0?void 0:(d.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&d.stopPropagation(),o.closeCombobox(),m.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})}));default:return}}),g=F(d=>{if(qr(d.currentTarget))return d.preventDefault();r.comboboxState===0?o.closeCombobox():(d.preventDefault(),o.openCombobox()),m.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})})}),s=St(()=>{if(r.labelId)return[r.labelId,p].join(" ")},[r.labelId,p]),f=u.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),a={ref:c,id:p,type:Br(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":s,disabled:r.disabled,onClick:g,onKeyDown:h};return Fe({ourProps:a,theirProps:v,slot:f,defaultTag:Oa,name:"Combobox.Button"})}let Ea="label";function _a(e,t){let n=tt(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,c=bt("Combobox.Label"),i=Et("Combobox.Label"),p=We(c.labelRef,t);ve(()=>i.registerLabel(r),[r]);let v=F(()=>{var h;return(h=c.inputRef.current)==null?void 0:h.focus({preventScroll:!0})}),m=u.useMemo(()=>({open:c.comboboxState===0,disabled:c.disabled}),[c]);return Fe({ourProps:{ref:p,id:r,onClick:v},theirProps:o,slot:m,defaultTag:Ea,name:"Combobox.Label"})}let Ta="ul",Ca=pt.RenderStrategy|pt.Static;function Ia(e,t){let n=tt(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...c}=e,i=bt("Combobox.Options"),p=We(i.optionsRef,t),v=Ut(),m=(()=>v!==null?(v&ke.Open)===ke.Open:i.comboboxState===0)();ve(()=>{var f;i.optionsPropsRef.current.static=(f=e.static)!=null?f:!1},[i.optionsPropsRef,e.static]),ve(()=>{i.optionsPropsRef.current.hold=o},[i.optionsPropsRef,o]),ra({container:i.optionsRef.current,enabled:i.comboboxState===0,accept(f){return f.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:f.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(f){f.setAttribute("role","none")}});let h=St(()=>{var f,a;return(a=i.labelId)!=null?a:(f=i.buttonRef.current)==null?void 0:f.id},[i.labelId,i.buttonRef.current]),g=u.useMemo(()=>({open:i.comboboxState===0}),[i]),s={"aria-labelledby":h,role:"listbox","aria-multiselectable":i.mode===1?!0:void 0,id:r,ref:p};return Fe({ourProps:s,theirProps:c,slot:g,defaultTag:Ta,features:Ca,visible:m,name:"Combobox.Options"})}let Pa="li";function La(e,t){var n,r;let o=tt(),{id:c=`headlessui-combobox-option-${o}`,disabled:i=!1,value:p,...v}=e,m=bt("Combobox.Option"),h=Et("Combobox.Option"),g=m.activeOptionIndex!==null?m.options[m.activeOptionIndex].id===c:!1,s=m.isSelected(p),f=u.useRef(null),a=qe({disabled:i,value:p,domRef:f,textValue:(r=(n=f.current)==null?void 0:n.textContent)==null?void 0:r.toLowerCase()}),d=We(t,f),b=F(()=>h.selectOption(c));ve(()=>h.registerOption(c,a),[a,c]);let w=u.useRef(!m.__demoMode);ve(()=>{if(!m.__demoMode)return;let P=Xe();return P.requestAnimationFrame(()=>{w.current=!0}),P.dispose},[]),ve(()=>{if(m.comboboxState!==0||!g||!w.current||m.activationTrigger===0)return;let P=Xe();return P.requestAnimationFrame(()=>{var K,se;(se=(K=f.current)==null?void 0:K.scrollIntoView)==null||se.call(K,{block:"nearest"})}),P.dispose},[f,g,m.comboboxState,m.activationTrigger,m.activeOptionIndex]);let T=F(P=>{if(i)return P.preventDefault();b(),m.mode===0&&h.closeCombobox(),da()||requestAnimationFrame(()=>{var K;return(K=m.inputRef.current)==null?void 0:K.focus()})}),k=F(()=>{if(i)return h.goToOption(Z.Nothing);h.goToOption(Z.Specific,c)}),S=Xr(),W=F(P=>S.update(P)),_=F(P=>{S.wasMoved(P)&&(i||g||h.goToOption(Z.Specific,c,0))}),H=F(P=>{S.wasMoved(P)&&(i||g&&(m.optionsPropsRef.current.hold||h.goToOption(Z.Nothing)))}),V=u.useMemo(()=>({active:g,selected:s,disabled:i}),[g,s,i]);return Fe({ourProps:{id:c,ref:d,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":s,disabled:void 0,onClick:T,onFocus:k,onPointerEnter:W,onMouseEnter:W,onPointerMove:_,onMouseMove:_,onPointerLeave:H,onMouseLeave:H},theirProps:v,slot:V,defaultTag:Pa,name:"Combobox.Option"})}let ja=Te(xa),Fa=Te(Sa),Da=Te(ka),Aa=Te(_a),Na=Te(Ia),Ma=Te(La),_t=Object.assign(ja,{Input:Da,Button:Fa,Label:Aa,Options:Na,Option:Ma});function gn(){let e=u.useRef(!1);return ve(()=>(e.current=!0,()=>{e.current=!1}),[]),e}let Zr=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function $r(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!(o instanceof HTMLElement))return r;let c=!1;for(let p of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))p.remove(),c=!0;let i=c?(n=o.innerText)!=null?n:"":r;return Zr.test(i)&&(i=i.replace(Zr,"")),i}function Ra(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let c=document.getElementById(o);if(c){let i=c.getAttribute("aria-label");return typeof i=="string"?i.trim():$r(c).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return $r(e).trim()}function Wa(e){let t=u.useRef(""),n=u.useRef("");return F(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let c=Ra(r).trim().toLowerCase();return t.current=o,n.current=c,c})}var Va=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Va||{}),Ba=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ba||{}),Ua=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ua||{}),Ha=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.RegisterLabel=7]="RegisterLabel",e))(Ha||{});function wn(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Rr(t(e.options.slice()),c=>c.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let qa={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,r=e.options.findIndex(o=>n(o.dataRef.current.value));return r!==-1&&(t=r),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=wn(e),o=Ur(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:o,activationTrigger:(n=t.trigger)!=null?n:1}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var p;return!i.dataRef.current.disabled&&((p=i.dataRef.current.textValue)==null?void 0:p.startsWith(r))}),c=o?e.options.indexOf(o):-1;return c===-1||c===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:c,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},r=wn(e,o=>[...o,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(n)),{...e,...r}},6:(e,t)=>{let n=wn(e,r=>{let o=r.findIndex(c=>c.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},xn=u.createContext(null);xn.displayName="ListboxActionsContext";function Tt(e){let t=u.useContext(xn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Tt),n}return t}let yn=u.createContext(null);yn.displayName="ListboxDataContext";function Ct(e){let t=u.useContext(yn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ct),n}return t}function za(e,t){return ue(t.type,qa,e,t)}let Ya=u.Fragment;function Ka(e,t){let{value:n,defaultValue:r,form:o,name:c,onChange:i,by:p=(C,j)=>C===j,disabled:v=!1,horizontal:m=!1,multiple:h=!1,...g}=e;const s=m?"horizontal":"vertical";let f=We(t),[a=h?[]:void 0,d]=Gr(n,i,r),[b,w]=u.useReducer(za,{dataRef:u.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),T=u.useRef({static:!1,hold:!1}),k=u.useRef(null),S=u.useRef(null),W=u.useRef(null),_=F(typeof p=="string"?(C,j)=>{let R=p;return C?.[R]===j?.[R]}:p),H=u.useCallback(C=>ue(V.mode,{1:()=>a.some(j=>_(j,C)),0:()=>_(a,C)}),[a]),V=u.useMemo(()=>({...b,value:a,disabled:v,mode:h?1:0,orientation:s,compare:_,isSelected:H,optionsPropsRef:T,labelRef:k,buttonRef:S,optionsRef:W}),[a,v,h,b]);ve(()=>{b.dataRef.current=V},[V]),Wr([V.buttonRef,V.optionsRef],(C,j)=>{var R;w({type:1}),Mr(j,un.Loose)||(C.preventDefault(),(R=V.buttonRef.current)==null||R.focus())},V.listboxState===0);let P=u.useMemo(()=>({open:V.listboxState===0,disabled:v,value:a}),[V,v,a]),K=F(C=>{let j=V.options.find(R=>R.id===C);j&&U(j.dataRef.current.value)}),se=F(()=>{if(V.activeOptionIndex!==null){let{dataRef:C,id:j}=V.options[V.activeOptionIndex];U(C.current.value),w({type:2,focus:Z.Specific,id:j})}}),re=F(()=>w({type:0})),x=F(()=>w({type:1})),z=F((C,j,R)=>C===Z.Specific?w({type:2,focus:Z.Specific,id:j,trigger:R}):w({type:2,focus:C,trigger:R})),te=F((C,j)=>(w({type:5,id:C,dataRef:j}),()=>w({type:6,id:C}))),ce=F(C=>(w({type:7,id:C}),()=>w({type:7,id:null}))),U=F(C=>ue(V.mode,{0(){return d?.(C)},1(){let j=V.value.slice(),R=j.findIndex(xe=>_(xe,C));return R===-1?j.push(C):j.splice(R,1),d?.(j)}})),de=F(C=>w({type:3,value:C})),ne=F(()=>w({type:4})),ee=u.useMemo(()=>({onChange:U,registerOption:te,registerLabel:ce,goToOption:z,closeListbox:x,openListbox:re,selectActiveOption:se,selectOption:K,search:de,clearSearch:ne}),[]),le={ref:f},me=u.useRef(null),fe=et();return u.useEffect(()=>{me.current&&r!==void 0&&fe.addEventListener(me.current,"reset",()=>{d?.(r)})},[me,d]),u.createElement(xn.Provider,{value:ee},u.createElement(yn.Provider,{value:V},u.createElement(bn,{value:ue(V.listboxState,{0:ke.Open,1:ke.Closed})},c!=null&&a!=null&&dn({[c]:a}).map(([C,j],R)=>u.createElement(Kr,{features:fn.Hidden,ref:R===0?xe=>{var _e;me.current=(_e=xe?.closest("form"))!=null?_e:null}:void 0,...Bt({key:C,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,name:C,value:j})})),Fe({ourProps:le,theirProps:g,slot:P,defaultTag:Ya,name:"Listbox"}))))}let Ga="button";function Qa(e,t){var n;let r=tt(),{id:o=`headlessui-listbox-button-${r}`,...c}=e,i=Ct("Listbox.Button"),p=Tt("Listbox.Button"),v=We(i.buttonRef,t),m=et(),h=F(b=>{switch(b.key){case $.Space:case $.Enter:case $.ArrowDown:b.preventDefault(),p.openListbox(),m.nextFrame(()=>{i.value||p.goToOption(Z.First)});break;case $.ArrowUp:b.preventDefault(),p.openListbox(),m.nextFrame(()=>{i.value||p.goToOption(Z.Last)});break}}),g=F(b=>{switch(b.key){case $.Space:b.preventDefault();break}}),s=F(b=>{if(qr(b.currentTarget))return b.preventDefault();i.listboxState===0?(p.closeListbox(),m.nextFrame(()=>{var w;return(w=i.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})})):(b.preventDefault(),p.openListbox())}),f=St(()=>{if(i.labelId)return[i.labelId,o].join(" ")},[i.labelId,o]),a=u.useMemo(()=>({open:i.listboxState===0,disabled:i.disabled,value:i.value}),[i]),d={ref:v,id:o,type:Br(e,i.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=i.optionsRef.current)==null?void 0:n.id,"aria-expanded":i.listboxState===0,"aria-labelledby":f,disabled:i.disabled,onKeyDown:h,onKeyUp:g,onClick:s};return Fe({ourProps:d,theirProps:c,slot:a,defaultTag:Ga,name:"Listbox.Button"})}let Ja="label";function Xa(e,t){let n=tt(),{id:r=`headlessui-listbox-label-${n}`,...o}=e,c=Ct("Listbox.Label"),i=Tt("Listbox.Label"),p=We(c.labelRef,t);ve(()=>i.registerLabel(r),[r]);let v=F(()=>{var h;return(h=c.buttonRef.current)==null?void 0:h.focus({preventScroll:!0})}),m=u.useMemo(()=>({open:c.listboxState===0,disabled:c.disabled}),[c]);return Fe({ourProps:{ref:p,id:r,onClick:v},theirProps:o,slot:m,defaultTag:Ja,name:"Listbox.Label"})}let Za="ul",$a=pt.RenderStrategy|pt.Static;function es(e,t){var n;let r=tt(),{id:o=`headlessui-listbox-options-${r}`,...c}=e,i=Ct("Listbox.Options"),p=Tt("Listbox.Options"),v=We(i.optionsRef,t),m=et(),h=et(),g=Ut(),s=(()=>g!==null?(g&ke.Open)===ke.Open:i.listboxState===0)();u.useEffect(()=>{var w;let T=i.optionsRef.current;T&&i.listboxState===0&&T!==((w=Mt(T))==null?void 0:w.activeElement)&&T.focus({preventScroll:!0})},[i.listboxState,i.optionsRef]);let f=F(w=>{switch(h.dispose(),w.key){case $.Space:if(i.searchQuery!=="")return w.preventDefault(),w.stopPropagation(),p.search(w.key);case $.Enter:if(w.preventDefault(),w.stopPropagation(),i.activeOptionIndex!==null){let{dataRef:T}=i.options[i.activeOptionIndex];p.onChange(T.current.value)}i.mode===0&&(p.closeListbox(),Xe().nextFrame(()=>{var T;return(T=i.buttonRef.current)==null?void 0:T.focus({preventScroll:!0})}));break;case ue(i.orientation,{vertical:$.ArrowDown,horizontal:$.ArrowRight}):return w.preventDefault(),w.stopPropagation(),p.goToOption(Z.Next);case ue(i.orientation,{vertical:$.ArrowUp,horizontal:$.ArrowLeft}):return w.preventDefault(),w.stopPropagation(),p.goToOption(Z.Previous);case $.Home:case $.PageUp:return w.preventDefault(),w.stopPropagation(),p.goToOption(Z.First);case $.End:case $.PageDown:return w.preventDefault(),w.stopPropagation(),p.goToOption(Z.Last);case $.Escape:return w.preventDefault(),w.stopPropagation(),p.closeListbox(),m.nextFrame(()=>{var T;return(T=i.buttonRef.current)==null?void 0:T.focus({preventScroll:!0})});case $.Tab:w.preventDefault(),w.stopPropagation();break;default:w.key.length===1&&(p.search(w.key),h.setTimeout(()=>p.clearSearch(),350));break}}),a=St(()=>{var w,T,k;return(k=(w=i.labelRef.current)==null?void 0:w.id)!=null?k:(T=i.buttonRef.current)==null?void 0:T.id},[i.labelRef.current,i.buttonRef.current]),d=u.useMemo(()=>({open:i.listboxState===0}),[i]),b={"aria-activedescendant":i.activeOptionIndex===null||(n=i.options[i.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":i.mode===1?!0:void 0,"aria-labelledby":a,"aria-orientation":i.orientation,id:o,onKeyDown:f,role:"listbox",tabIndex:0,ref:v};return Fe({ourProps:b,theirProps:c,slot:d,defaultTag:Za,features:$a,visible:s,name:"Listbox.Options"})}let ts="li";function ns(e,t){let n=tt(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:c,...i}=e,p=Ct("Listbox.Option"),v=Tt("Listbox.Option"),m=p.activeOptionIndex!==null?p.options[p.activeOptionIndex].id===r:!1,h=p.isSelected(c),g=u.useRef(null),s=Wa(g),f=qe({disabled:o,value:c,domRef:g,get textValue(){return s()}}),a=We(t,g);ve(()=>{if(p.listboxState!==0||!m||p.activationTrigger===0)return;let _=Xe();return _.requestAnimationFrame(()=>{var H,V;(V=(H=g.current)==null?void 0:H.scrollIntoView)==null||V.call(H,{block:"nearest"})}),_.dispose},[g,m,p.listboxState,p.activationTrigger,p.activeOptionIndex]),ve(()=>v.registerOption(r,f),[f,r]);let d=F(_=>{if(o)return _.preventDefault();v.onChange(c),p.mode===0&&(v.closeListbox(),Xe().nextFrame(()=>{var H;return(H=p.buttonRef.current)==null?void 0:H.focus({preventScroll:!0})}))}),b=F(()=>{if(o)return v.goToOption(Z.Nothing);v.goToOption(Z.Specific,r)}),w=Xr(),T=F(_=>w.update(_)),k=F(_=>{w.wasMoved(_)&&(o||m||v.goToOption(Z.Specific,r,0))}),S=F(_=>{w.wasMoved(_)&&(o||m&&v.goToOption(Z.Nothing))}),W=u.useMemo(()=>({active:m,selected:h,disabled:o}),[m,h,o]);return Fe({ourProps:{id:r,ref:a,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":h,disabled:void 0,onClick:d,onFocus:b,onPointerEnter:T,onMouseEnter:T,onPointerMove:k,onMouseMove:k,onPointerLeave:S,onMouseLeave:S},theirProps:i,slot:W,defaultTag:ts,name:"Listbox.Option"})}let rs=Te(Ka),os=Te(Qa),is=Te(Xa),as=Te(es),ss=Te(ns),Ht=Object.assign(rs,{Button:os,Label:is,Options:as,Option:ss});function ls(e=0){let[t,n]=u.useState(e),r=gn(),o=u.useCallback(v=>{r.current&&n(m=>m|v)},[t,r]),c=u.useCallback(v=>!!(t&v),[t]),i=u.useCallback(v=>{r.current&&n(m=>m&~v)},[n,r]),p=u.useCallback(v=>{r.current&&n(m=>m^v)},[n]);return{flags:t,addFlag:o,hasFlag:c,removeFlag:i,toggleFlag:p}}function us(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function kn(e,...t){e&&t.length>0&&e.classList.add(...t)}function On(e,...t){e&&t.length>0&&e.classList.remove(...t)}function cs(e,t){let n=Xe();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[c,i]=[r,o].map(v=>{let[m=0]=v.split(",").filter(Boolean).map(h=>h.includes("ms")?parseFloat(h):parseFloat(h)*1e3).sort((h,g)=>g-h);return m}),p=c+i;if(p!==0){n.group(m=>{m.setTimeout(()=>{t(),m.dispose()},p),m.addEventListener(e,"transitionrun",h=>{h.target===h.currentTarget&&m.dispose()})});let v=n.addEventListener(e,"transitionend",m=>{m.target===m.currentTarget&&(t(),v())})}else t();return n.add(()=>t()),n.dispose}function ds(e,t,n,r){let o=n?"enter":"leave",c=Xe(),i=r!==void 0?us(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let p=ue(o,{enter:()=>t.enter,leave:()=>t.leave}),v=ue(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),m=ue(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return On(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),kn(e,...t.base,...p,...m),c.nextFrame(()=>{On(e,...t.base,...p,...m),kn(e,...t.base,...p,...v),cs(e,()=>(On(e,...t.base,...p),kn(e,...t.base,...t.entered),i()))}),c.dispose}function fs({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:c}){let i=gn(),p=et(),v=qe(n);ve(()=>{e&&(v.current="enter")},[e]),ve(()=>{let m=Xe();p.add(m.dispose);let h=t.current;if(h&&v.current!=="idle"&&i.current)return m.dispose(),o.current(v.current),m.add(ds(h,r.current,v.current==="enter",()=>{m.dispose(),c.current(v.current)})),m.dispose},[n])}function st(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let qt=u.createContext(null);qt.displayName="TransitionContext";var ps=(e=>(e.Visible="visible",e.Hidden="hidden",e))(ps||{});function bs(){let e=u.useContext(qt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function vs(){let e=u.useContext(zt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let zt=u.createContext(null);zt.displayName="NestingContext";function Yt(e){return"children"in e?Yt(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function eo(e,t){let n=qe(e),r=u.useRef([]),o=gn(),c=et(),i=F((f,a=at.Hidden)=>{let d=r.current.findIndex(({el:b})=>b===f);d!==-1&&(ue(a,{[at.Unmount](){r.current.splice(d,1)},[at.Hidden](){r.current[d].state="hidden"}}),c.microTask(()=>{var b;!Yt(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),p=F(f=>{let a=r.current.find(({el:d})=>d===f);return a?a.state!=="visible"&&(a.state="visible"):r.current.push({el:f,state:"visible"}),()=>i(f,at.Unmount)}),v=u.useRef([]),m=u.useRef(Promise.resolve()),h=u.useRef({enter:[],leave:[],idle:[]}),g=F((f,a,d)=>{v.current.splice(0),t&&(t.chains.current[a]=t.chains.current[a].filter(([b])=>b!==f)),t?.chains.current[a].push([f,new Promise(b=>{v.current.push(b)})]),t?.chains.current[a].push([f,new Promise(b=>{Promise.all(h.current[a].map(([w,T])=>T)).then(()=>b())})]),a==="enter"?m.current=m.current.then(()=>t?.wait.current).then(()=>d(a)):d(a)}),s=F((f,a,d)=>{Promise.all(h.current[a].splice(0).map(([b,w])=>w)).then(()=>{var b;(b=v.current.shift())==null||b()}).then(()=>d(a))});return u.useMemo(()=>({children:r,register:p,unregister:i,onStart:g,onStop:s,wait:m,chains:h}),[p,i,r,g,s,h,m])}function ms(){}let hs=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function to(e){var t;let n={};for(let r of hs)n[r]=(t=e[r])!=null?t:ms;return n}function gs(e){let t=u.useRef(to(e));return u.useEffect(()=>{t.current=to(e)},[e]),t}let ws="div",no=pt.RenderStrategy;function xs(e,t){var n,r;let{beforeEnter:o,afterEnter:c,beforeLeave:i,afterLeave:p,enter:v,enterFrom:m,enterTo:h,entered:g,leave:s,leaveFrom:f,leaveTo:a,...d}=e,b=u.useRef(null),w=We(b,t),T=(n=d.unmount)==null||n?at.Unmount:at.Hidden,{show:k,appear:S,initial:W}=bs(),[_,H]=u.useState(k?"visible":"hidden"),V=vs(),{register:P,unregister:K}=V;u.useEffect(()=>P(b),[P,b]),u.useEffect(()=>{if(T===at.Hidden&&b.current){if(k&&_!=="visible"){H("visible");return}return ue(_,{hidden:()=>K(b),visible:()=>P(b)})}},[_,b,P,K,k,T]);let se=qe({base:st(d.className),enter:st(v),enterFrom:st(m),enterTo:st(h),entered:st(g),leave:st(s),leaveFrom:st(f),leaveTo:st(a)}),re=gs({beforeEnter:o,afterEnter:c,beforeLeave:i,afterLeave:p}),x=ln();u.useEffect(()=>{if(x&&_==="visible"&&b.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[b,_,x]);let z=W&&!S,te=S&&k&&W,ce=(()=>!x||z?"idle":k?"enter":"leave")(),U=ls(0),de=F(fe=>ue(fe,{enter:()=>{U.addFlag(ke.Opening),re.current.beforeEnter()},leave:()=>{U.addFlag(ke.Closing),re.current.beforeLeave()},idle:()=>{}})),ne=F(fe=>ue(fe,{enter:()=>{U.removeFlag(ke.Opening),re.current.afterEnter()},leave:()=>{U.removeFlag(ke.Closing),re.current.afterLeave()},idle:()=>{}})),ee=eo(()=>{H("hidden"),K(b)},V);fs({immediate:te,container:b,classes:se,direction:ce,onStart:qe(fe=>{ee.onStart(b,fe,de)}),onStop:qe(fe=>{ee.onStop(b,fe,ne),fe==="leave"&&!Yt(ee)&&(H("hidden"),K(b))})});let le=d,me={ref:w};return te?le={...le,className:Wt(d.className,...se.current.enter,...se.current.enterFrom)}:(le.className=Wt(d.className,(r=b.current)==null?void 0:r.className),le.className===""&&delete le.className),u.createElement(zt.Provider,{value:ee},u.createElement(bn,{value:ue(_,{visible:ke.Open,hidden:ke.Closed})|U.flags},Fe({ourProps:me,theirProps:le,defaultTag:ws,features:no,visible:_==="visible",name:"Transition.Child"})))}function ys(e,t){let{show:n,appear:r=!1,unmount:o=!0,...c}=e,i=u.useRef(null),p=We(i,t);ln();let v=Ut();if(n===void 0&&v!==null&&(n=(v&ke.Open)===ke.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[m,h]=u.useState(n?"visible":"hidden"),g=eo(()=>{h("hidden")}),[s,f]=u.useState(!0),a=u.useRef([n]);ve(()=>{s!==!1&&a.current[a.current.length-1]!==n&&(a.current.push(n),f(!1))},[a,n]);let d=u.useMemo(()=>({show:n,appear:r,initial:s}),[n,r,s]);u.useEffect(()=>{if(n)h("visible");else if(!Yt(g))h("hidden");else{let k=i.current;if(!k)return;let S=k.getBoundingClientRect();S.x===0&&S.y===0&&S.width===0&&S.height===0&&h("hidden")}},[n,g]);let b={unmount:o},w=F(()=>{var k;s&&f(!1),(k=e.beforeEnter)==null||k.call(e)}),T=F(()=>{var k;s&&f(!1),(k=e.beforeLeave)==null||k.call(e)});return u.createElement(zt.Provider,{value:g},u.createElement(qt.Provider,{value:d},Fe({ourProps:{...b,as:u.Fragment,children:u.createElement(ro,{ref:p,...b,...c,beforeEnter:w,beforeLeave:T})},theirProps:{},defaultTag:u.Fragment,features:no,visible:m==="visible",name:"Transition"})))}function ks(e,t){let n=u.useContext(qt)!==null,r=Ut()!==null;return u.createElement(u.Fragment,null,!n&&r?u.createElement(Sn,{ref:t,...e}):u.createElement(ro,{ref:t,...e}))}let Sn=Te(ys),ro=Te(xs),Os=Te(ks),oo=Object.assign(Sn,{Child:Os,Root:Sn});function Ss({title:e,titleId:t,...n},r){return $e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?$e.createElement("title",{id:t},e):null,$e.createElement("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"}))}const io=$e.forwardRef(Ss),Ne={select:"_select_12thw_1",selectContainer:"_selectContainer_12thw_4",selectButton:"_selectButton_12thw_7",open:"_open_12thw_13",selectValue:"_selectValue_12thw_16",seletIcon:"_seletIcon_12thw_19",selectText:"_selectText_12thw_22",chevronDownIconSpan:"_chevronDownIconSpan_12thw_25",chevronDownIcon:"_chevronDownIcon_12thw_25",leave:"_leave_12thw_32",leaveFrom:"_leaveFrom_12thw_36",leaveTo:"_leaveTo_12thw_40",selectOptions:"_selectOptions_12thw_44"},Es=({children:e,selected:t,onSelect:n,themeColor:r})=>{const[o,c]=u.useState(!1),[i,p]=u.useState(!1),v=u.useRef(null),m=u.useRef(null),h=u.useRef(null),[g,s]=u.useState({left:0,top:0}),f=u.useRef(0),a=u.useRef(0);let d="#333333";const b=_=>{n(_)},w=()=>{c(!0)},T=()=>{c(!1)};u.useEffect(()=>{const _=m.current;return _&&(_.addEventListener("focus",w),_.addEventListener("blur",T)),()=>{_&&(_.removeEventListener("focus",w),_.removeEventListener("blur",T))}},[w,T]);const k=()=>{f.current=window.innerHeight,a.current=document.body.scrollHeight,p(!0)};u.useEffect(()=>(k(),window.addEventListener("resize",k),()=>{window.addEventListener("resize",k)}),[]);const S=()=>a.current-(f.current+window.scrollY),W=()=>{if(v.current){const _=v.current.getBoundingClientRect();setTimeout(()=>{const H=h?.current?.getBoundingClientRect(),V=S(),P=f.current-_.bottom;let K;if(H){const se=_.height,re=_.top,x=H.height,z=x>=re+window.scrollY;x>=re&&(z||z&&P<=x||V>=x||P>=x)||re>=x&&P>=x?K=_.y+se:K=_.y-x,s({left:_.left,top:K??_.top})}},0)}};if(u.useEffect(()=>(window.addEventListener("scroll",W),window.addEventListener("resize",W),()=>{window.removeEventListener("scroll",W),window.removeEventListener("resize",W)}),[]),r){r=He.convert3HexTo6(r);const _=rt(r);(_==="dark"||_==="light")&&(d=r==="#ffffff"?"#c8c8c8":r)}return O.jsx(Ht,{value:t,onChange:b,children:({open:_})=>O.jsxs("div",{className:Ne.select,children:[O.jsx("div",{className:Ne.selectContainer,ref:v,children:O.jsxs(Ht.Button,{"data-testid":"select-options",ref:m,onFocus:w,onBlur:T,onClick:W,onKeyDown:H=>{(H.key===" "||H.code==="Space"||H.code==="Enter")&&W()},style:{borderBottomColor:r&&(o||_)?d:""},className:`${Ne.selectButton} ${_?Ne.open:""}`,tabIndex:0,children:[t&&O.jsxs("span",{className:Ne.selectValue,children:[t.avatar&&O.jsx("img",{src:t.avatar,alt:"",className:Ne.seletIcon}),O.jsx("span",{className:Ne.selectText,children:t.label})]}),O.jsx("span",{className:Ne.chevronDownIconSpan,children:O.jsx(io,{className:Ne.chevronDownIcon,"aria-hidden":"true"})})]})}),i?Qt.createPortal(O.jsx(O.Fragment,{children:_&&O.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(255,255,255,0)",zIndex:1e3},children:O.jsx("div",{ref:h,style:{position:"absolute",opacity:g.left?1:0,width:v.current?v.current.clientWidth:"auto",left:g.left,top:g.top},children:e})})}),document.body):null]})})},_s=({children:e,setQuery:t})=>O.jsx(oo,{as:u.Fragment,leave:Ne.leave,leaveFrom:Ne.leaveFrom,leaveTo:Ne.leaveTo,afterLeave:()=>t(""),children:O.jsx(Ht.Options,{className:Ne.selectOptions,children:e})}),ao=u.forwardRef((e,t)=>O.jsx(Ht.Option,{ref:t,className:e.className,value:e.value,disabled:e.disable,children:e.children}));ao.displayName="SelectOption";const ze={autocomplete:"_autocomplete_1ue23_1",autocompleteContainer:"_autocompleteContainer_1ue23_4",disable:"_disable_1ue23_7",autocompleteInput:"_autocompleteInput_1ue23_16",autocompleteButton:"_autocompleteButton_1ue23_25",chevronDownIcon:"_chevronDownIcon_1ue23_28",leave:"_leave_1ue23_35",leaveFrom:"_leaveFrom_1ue23_39",leaveTo:"_leaveTo_1ue23_43",autocompleteOptions:"_autocompleteOptions_1ue23_47"},Ts=({children:e,selected:t,onSelect:n,setQuery:r,disable:o,clearSearch:c=!1,themeColor:i})=>{const p=u.useRef(null),v=u.useRef(null),[m,h]=u.useState(!1),[g,s]=u.useState(!1),f=u.useRef(null),a=u.useRef(null),[d,b]=u.useState({left:0,top:0}),w=u.useRef(0),T=u.useRef(0);let k={};u.useEffect(()=>{p.current&&t&&(p.current.value=t.label||"")},[t]);const S=()=>{w.current=window.innerHeight,T.current=document.body.scrollHeight,s(!0)};u.useEffect(()=>(S(),window.addEventListener("resize",S),()=>{window.addEventListener("resize",S)}),[]);const W=()=>T.current-(w.current+window.scrollY),_=()=>{if(f.current){const x=f.current.getBoundingClientRect();setTimeout(()=>{const z=a?.current?.getBoundingClientRect(),te=W(),ce=w.current-x.bottom;let U;if(z){const de=x.height,ne=x.top,ee=z.height,le=ee>ne+window.scrollY;ne<ee&&(le||le&&ce<ee||te>ee||ce>ee)||ne>ee&&ce>ee?U=x.y+de:U=x.y-ee,b({left:x.left,top:U??x.top})}},0)}};u.useEffect(()=>(window.addEventListener("scroll",_),window.addEventListener("resize",_),()=>{window.removeEventListener("scroll",_),window.removeEventListener("resize",_)}),[]);const H=x=>{n(x),K()},V=()=>{_(),h(!0),p.current&&t&&(p.current.value=t.label||""),p.current&&v.current&&(c&&(p.current.value="",r("")),v.current.click())},P=x=>x?.label,K=()=>{const x=p.current;x&&x.setSelectionRange(x.value.length,x.value.length)},se=()=>{h(!0)},re=()=>{h(!1)};if(u.useEffect(()=>{const x=p.current;return x&&(x.addEventListener("focus",se),x.addEventListener("blur",re)),()=>{x&&(x.removeEventListener("focus",se),x.removeEventListener("blur",re))}},[se,re]),i){const x=rt(i);i=He.convert3HexTo6(i),(x==="dark"||x==="light")&&(k={borderBottomColor:i==="#ffffff"?"#c8c8c8":m?i:"#333333"})}return O.jsx(_t,{value:t,onChange:H,disabled:o,children:({open:x})=>O.jsxs("div",{className:ze.autocomplete,children:[O.jsxs("div",{ref:f,className:`${ze.autocompleteContainer} ${o?ze.disable:""}`,children:[O.jsx(_t.Input,{ref:p,"data-testid":"select-input",className:ze.autocompleteInput,displayValue:P,onChange:z=>{r(z.target.value),_()},onClick:V,onFocus:se,onBlur:re,onKeyDown:z=>{(z.key===" "||z.code==="Space")&&_()},style:{...k},placeholder:"Select your option",autoComplete:"off"}),O.jsx(_t.Button,{className:ze.autocompleteButton,"data-testid":"select-button",ref:v,onClick:_,children:O.jsx(io,{className:`${ze.chevronDownIcon} ${o?ze.disable:""}`,"aria-hidden":"true"})})]}),g?Qt.createPortal(O.jsx(O.Fragment,{children:x&&O.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(255,255,255,0)",zIndex:1e3},children:O.jsx("div",{ref:a,style:{position:"absolute",opacity:d.left?1:0,width:f.current?f.current.clientWidth:"auto",left:d.left,top:d.top},children:e})})}),document.body):null]})})},Cs=({children:e,setQuery:t})=>O.jsx(oo,{as:u.Fragment,leave:ze.leave,leaveFrom:ze.leaveFrom,leaveTo:ze.leaveTo,afterLeave:()=>t(""),children:O.jsx(_t.Options,{className:ze.autocompleteOptions,children:e})}),so=u.forwardRef((e,t)=>O.jsx(_t.Option,{ref:t,className:e.className,value:e.value,disabled:e.disable,children:e.children}));so.displayName="AutoCompleteOption";const lo={textInputWrapper:"_textInputWrapper_gym4n_1",textInput:"_textInput_gym4n_1"},Is=u.memo(u.forwardRef(({themeColor:e="",style:t={},className:n="",onFocus:r,onBlur:o,...c},i)=>{const[p,v]=u.useState(!1);let m={};const h=[lo.textInput,n].filter(Boolean).join(" ");e=He.convert3HexTo6(e);const g=()=>{v(!0)},s=()=>{v(!1)};return m={borderBottomColor:p?e!=="#ffffff"?e:"#c8c8c8":""},O.jsx("div",{className:lo.textInputWrapper,children:O.jsx("input",{type:"text","data-testid":"textbox-input",ref:i,className:h,onFocus:g,onBlur:s,style:{...m,...t},...c})})}));be.AutoComplete=Ts,be.AutoCompleteOption=so,be.AutoCompleteOptions=Cs,be.Button=Xt,be.Checkbox=Zt,be.ColorsService=He,be.MultiLineInput=Bi,be.MultiSelect=Ui,be.QuickMultiSelect=Hi,be.QuickSelect=qi,be.Scrollbar=Dr,be.Select=Es,be.SelectOption=ao,be.SelectOptions=_s,be.SingleLineInput=Is,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})});
|
|
33
33
|
//# sourceMappingURL=ui-react.umd.js.map
|