downshift
Advanced tools
Comparing version 7.0.5 to 7.1.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Downshift={},e.React)}(this,(function(e,t){"use strict";var n={exports:{}},i={},o="function"==typeof Symbol&&Symbol.for,r=o?Symbol.for("react.element"):60103,s=o?Symbol.for("react.portal"):60106,u=o?Symbol.for("react.fragment"):60107,l=o?Symbol.for("react.strict_mode"):60108,a=o?Symbol.for("react.profiler"):60114,d=o?Symbol.for("react.provider"):60109,c=o?Symbol.for("react.context"):60110,h=o?Symbol.for("react.async_mode"):60111,p=o?Symbol.for("react.concurrent_mode"):60111,g=o?Symbol.for("react.forward_ref"):60112,m=o?Symbol.for("react.suspense"):60113,f=o?Symbol.for("react.suspense_list"):60120,I=o?Symbol.for("react.memo"):60115,y=o?Symbol.for("react.lazy"):60116,v=o?Symbol.for("react.block"):60121,x=o?Symbol.for("react.fundamental"):60117,b=o?Symbol.for("react.responder"):60118,w=o?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case h:case p:case u:case a:case l:case m:return e;default:switch(e=e&&e.$$typeof){case c:case g:case y:case I:case d:return e;default:return t}}case s:return t}}}function C(e){return S(e)===p}i.AsyncMode=h,i.ConcurrentMode=p,i.ContextConsumer=c,i.ContextProvider=d,i.Element=r,i.ForwardRef=g,i.Fragment=u,i.Lazy=y,i.Memo=I,i.Portal=s,i.Profiler=a,i.StrictMode=l,i.Suspense=m,i.isAsyncMode=function(e){return C(e)||S(e)===h},i.isConcurrentMode=C,i.isContextConsumer=function(e){return S(e)===c},i.isContextProvider=function(e){return S(e)===d},i.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},i.isForwardRef=function(e){return S(e)===g},i.isFragment=function(e){return S(e)===u},i.isLazy=function(e){return S(e)===y},i.isMemo=function(e){return S(e)===I},i.isPortal=function(e){return S(e)===s},i.isProfiler=function(e){return S(e)===a},i.isStrictMode=function(e){return S(e)===l},i.isSuspense=function(e){return S(e)===m},i.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===u||e===p||e===a||e===l||e===m||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===I||e.$$typeof===d||e.$$typeof===c||e.$$typeof===g||e.$$typeof===x||e.$$typeof===b||e.$$typeof===w||e.$$typeof===v)},i.typeOf=S;function k(){}function O(){}O.resetWarningCache=k;n.exports=function(){function e(e,t,n,i,o,r){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:O,resetWarningCache:k};return n.PropTypes=n,n}();var M=n.exports,E={},D=60103,P=60106,T=60107,R=60108,H=60114,F=60109,K=60110,V=60112,$=60113,A=60120,N=60115,B=60116,L=60121,_=60122,j=60117,U=60129,W=60131;if("function"==typeof Symbol&&Symbol.for){var z=Symbol.for;D=z("react.element"),P=z("react.portal"),T=z("react.fragment"),R=z("react.strict_mode"),H=z("react.profiler"),F=z("react.provider"),K=z("react.context"),V=z("react.forward_ref"),$=z("react.suspense"),A=z("react.suspense_list"),N=z("react.memo"),B=z("react.lazy"),L=z("react.block"),_=z("react.server.block"),j=z("react.fundamental"),U=z("react.debug_trace_mode"),W=z("react.legacy_hidden")}function q(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case D:switch(e=e.type){case T:case H:case R:case $:case A:return e;default:switch(e=e&&e.$$typeof){case K:case V:case B:case N:case F:return e;default:return t}}case P:return t}}}var Y=F,X=D,G=V,J=T,Q=B,Z=N,ee=P,te=H,ne=R,ie=$;function oe(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function re(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function se(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return re(n.overflowY,t)||re(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function ue(e,t,n,i,o,r,s,u){return r<e&&s>t||r>e&&s<t?0:r<=e&&u<=n||s>=t&&u>=n?r-e-i:s>t&&u<n||r<e&&u>n?s-t+o:0}E.ContextConsumer=K,E.ContextProvider=Y,E.Element=X,E.ForwardRef=G,E.Fragment=J,E.Lazy=Q,E.Memo=Z,E.Portal=ee,E.Profiler=te,E.StrictMode=ne,E.Suspense=ie,E.isAsyncMode=function(){return!1},E.isConcurrentMode=function(){return!1},E.isContextConsumer=function(e){return q(e)===K},E.isContextProvider=function(e){return q(e)===F},E.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===D},E.isForwardRef=function(e){return q(e)===V},E.isFragment=function(e){return q(e)===T},E.isLazy=function(e){return q(e)===B},E.isMemo=function(e){return q(e)===N},E.isPortal=function(e){return q(e)===P},E.isProfiler=function(e){return q(e)===H},E.isStrictMode=function(e){return q(e)===R},E.isSuspense=function(e){return q(e)===$},E.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===T||e===H||e===U||e===R||e===$||e===A||e===W||"object"==typeof e&&null!==e&&(e.$$typeof===B||e.$$typeof===N||e.$$typeof===F||e.$$typeof===K||e.$$typeof===V||e.$$typeof===j||e.$$typeof===L||e[0]===_)},E.typeOf=q;let le=0;function ae(e){return"function"==typeof e?e:de}function de(){}function ce(e,t){if(!e)return;const n=function(e,t){var n=window,i=t.scrollMode,o=t.block,r=t.inline,s=t.boundary,u=t.skipOverflowHiddenElements,l="function"==typeof s?s:function(e){return e!==s};if(!oe(e))throw new TypeError("Invalid target");for(var a,d,c=document.scrollingElement||document.documentElement,h=[],p=e;oe(p)&&l(p);){if((p=null==(d=(a=p).parentElement)?a.getRootNode().host||null:d)===c){h.push(p);break}null!=p&&p===document.body&&se(p)&&!se(document.documentElement)||null!=p&&se(p,u)&&h.push(p)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,m=n.visualViewport?n.visualViewport.height:innerHeight,f=window.scrollX||pageXOffset,I=window.scrollY||pageYOffset,y=e.getBoundingClientRect(),v=y.height,x=y.width,b=y.top,w=y.right,S=y.bottom,C=y.left,k="start"===o||"nearest"===o?b:"end"===o?S:b+v/2,O="center"===r?C+x/2:"end"===r?w:C,M=[],E=0;E<h.length;E++){var D=h[E],P=D.getBoundingClientRect(),T=P.height,R=P.width,H=P.top,F=P.right,K=P.bottom,V=P.left;if("if-needed"===i&&b>=0&&C>=0&&S<=m&&w<=g&&b>=H&&S<=K&&C>=V&&w<=F)return M;var $=getComputedStyle(D),A=parseInt($.borderLeftWidth,10),N=parseInt($.borderTopWidth,10),B=parseInt($.borderRightWidth,10),L=parseInt($.borderBottomWidth,10),_=0,j=0,U="offsetWidth"in D?D.offsetWidth-D.clientWidth-A-B:0,W="offsetHeight"in D?D.offsetHeight-D.clientHeight-N-L:0,z="offsetWidth"in D?0===D.offsetWidth?0:R/D.offsetWidth:0,q="offsetHeight"in D?0===D.offsetHeight?0:T/D.offsetHeight:0;if(c===D)_="start"===o?k:"end"===o?k-m:"nearest"===o?ue(I,I+m,m,N,L,I+k,I+k+v,v):k-m/2,j="start"===r?O:"center"===r?O-g/2:"end"===r?O-g:ue(f,f+g,g,A,B,f+O,f+O+x,x),_=Math.max(0,_+I),j=Math.max(0,j+f);else{_="start"===o?k-H-N:"end"===o?k-K+L+W:"nearest"===o?ue(H,K,T,N,L+W,k,k+v,v):k-(H+T/2)+W/2,j="start"===r?O-V-A:"center"===r?O-(V+R/2)+U/2:"end"===r?O-F+B+U:ue(V,F,R,A,B+U,O,O+x,x);var Y=D.scrollLeft,X=D.scrollTop;k+=X-(_=Math.max(0,Math.min(X+_/q,D.scrollHeight-T/q+W))),O+=Y-(j=Math.max(0,Math.min(Y+j/z,D.scrollWidth-R/z+U)))}M.push({el:D,top:_,left:j})}return M}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((e=>{let{el:t,top:n,left:i}=e;t.scrollTop=n,t.scrollLeft=i}))}function he(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function pe(e,t){let n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,r=new Array(o),s=0;s<o;s++)r[s]=arguments[s];i(),n=setTimeout((()=>{n=null,e(...r)}),t)}return o.cancel=i,o}function ge(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.some((t=>(t&&t(e,...i),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault)))}}function me(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>{t.forEach((t=>{"function"==typeof t?t(e):t&&(t.current=e)}))}}function fe(){return String(le++)}function Ie(e){let{isOpen:t,resultCount:n,previousResultCount:i}=e;return t?n?n!==i?`${n} result${1===n?" is":"s are"} available, use up and down arrow keys to navigate. Press Enter key to select.`:"":"No results are available.":""}function ye(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}const ve=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function xe(e){void 0===e&&(e={});const t={};return ve.forEach((n=>{e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function be(e,t){return Object.keys(e).reduce(((n,i)=>(n[i]=we(t,i)?t[i]:e[i],n)),{})}function we(e,t){return void 0!==e[t]}function Se(e){const{key:t,keyCode:n}=e;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?`Arrow${t}`:t}function Ce(e,t,n,i,o){if(void 0===o&&(o=!0),0===n)return-1;const r=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:r+1);let s=t+e;s<0?s=o?r:0:s>r&&(s=o?0:r);const u=ke(e,s,n,i,o);return-1===u?t>=n?-1:t:u}function ke(e,t,n,i,o){const r=i(t);if(!r||!r.hasAttribute("disabled"))return t;if(e>0){for(let e=t+1;e<n;e++)if(!i(e).hasAttribute("disabled"))return e}else for(let e=t-1;e>=0;e--)if(!i(e).hasAttribute("disabled"))return e;return o?e>0?ke(1,0,n,i,!1):ke(-1,n-1,n,i,!1):-1}function Oe(e,t,n,i){return void 0===i&&(i=!0),t.some((t=>t&&(he(t,e,n)||i&&he(t,n.document.activeElement,n))))}const Me=pe((e=>{De(e).textContent=""}),500);function Ee(e,t){const n=De(t);e&&(n.textContent=e,Me(t))}function De(e){void 0===e&&(e=document);let t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var Pe=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16});const Te=(()=>{class e extends t.Component{constructor(e){var t;super(e),t=this,this.id=this.props.id||`downshift-${fe()}`,this.menuId=this.props.menuId||`${this.id}-menu`,this.labelId=this.props.labelId||`${this.id}-label`,this.inputId=this.props.inputId||`${this.id}-input`,this.getItemId=this.props.getItemId||(e=>`${this.id}-item-${e}`),this.input=null,this.items=[],this.itemCount=null,this.previousResultCount=0,this.timeoutIds=[],this.internalSetTimeout=(e,t)=>{const n=setTimeout((()=>{this.timeoutIds=this.timeoutIds.filter((e=>e!==n)),e()}),t);this.timeoutIds.push(n)},this.setItemCount=e=>{this.itemCount=e},this.unsetItemCount=()=>{this.itemCount=null},this.setHighlightedIndex=function(e,n){void 0===e&&(e=t.props.defaultHighlightedIndex),void 0===n&&(n={}),n=xe(n),t.internalSetState({highlightedIndex:e,...n})},this.clearSelection=e=>{this.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:this.props.defaultHighlightedIndex,isOpen:this.props.defaultIsOpen},e)},this.selectItem=(e,t,n)=>{t=xe(t),this.internalSetState({isOpen:this.props.defaultIsOpen,highlightedIndex:this.props.defaultHighlightedIndex,selectedItem:e,inputValue:this.props.itemToString(e),...t},n)},this.selectItemAtIndex=(e,t,n)=>{const i=this.items[e];null!=i&&this.selectItem(i,t,n)},this.selectHighlightedItem=(e,t)=>this.selectItemAtIndex(this.getState().highlightedIndex,e,t),this.internalSetState=(e,t)=>{let n,i;const o={},r="function"==typeof e;return!r&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,{...this.getStateAndHelpers(),...e}),this.setState((t=>{t=this.getState(t);let s=r?e(t):e;s=this.props.stateReducer(t,s),n=s.hasOwnProperty("selectedItem");const u={};return n&&s.selectedItem!==t.selectedItem&&(i=s.selectedItem),s.type=s.type||0,Object.keys(s).forEach((e=>{t[e]!==s[e]&&(o[e]=s[e]),"type"!==e&&(s[e],we(this.props,e)||(u[e]=s[e]))})),r&&s.hasOwnProperty("inputValue")&&this.props.onInputValueChange(s.inputValue,{...this.getStateAndHelpers(),...s}),u}),(()=>{ae(t)();Object.keys(o).length>1&&this.props.onStateChange(o,this.getStateAndHelpers()),n&&this.props.onSelect(e.selectedItem,this.getStateAndHelpers()),void 0!==i&&this.props.onChange(i,this.getStateAndHelpers()),this.props.onUserAction(o,this.getStateAndHelpers())}))},this.rootRef=e=>this._rootNode=e,this.getRootProps=function(e,n){let{refKey:i="ref",ref:o,...r}=void 0===e?{}:e,{suppressRefError:s=!1}=void 0===n?{}:n;t.getRootProps.called=!0,t.getRootProps.refKey=i,t.getRootProps.suppressRefError=s;const{isOpen:u}=t.getState();return{[i]:me(o,t.rootRef),role:"combobox","aria-expanded":u,"aria-haspopup":"listbox","aria-owns":u?t.menuId:null,"aria-labelledby":t.labelId,...r}},this.keyDownHandlers={ArrowDown(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:4})}else this.internalSetState({isOpen:!0,type:4},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=Ce(1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:4})}}))},ArrowUp(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:3})}else this.internalSetState({isOpen:!0,type:3},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=Ce(-1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:3})}}))},Enter(e){if(229===e.which)return;const{isOpen:t,highlightedIndex:n}=this.getState();if(t&&null!=n){e.preventDefault();const t=this.items[n],i=this.getItemNodeFromIndex(n);if(null==t||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}},Escape(e){e.preventDefault(),this.reset({type:5,...!this.state.isOpen&&{selectedItem:null,inputValue:""}})}},this.buttonKeyDownHandlers={...this.keyDownHandlers," "(e){e.preventDefault(),this.toggleMenu({type:12})}},this.inputKeyDownHandlers={...this.keyDownHandlers,Home(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ke(1,0,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:7})},End(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ke(-1,n-1,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:8})}},this.getToggleButtonProps=function(e){let{onClick:n,onPress:i,onKeyDown:o,onKeyUp:r,onBlur:s,...u}=void 0===e?{}:e;const{isOpen:l}=t.getState(),a={onClick:ge(n,t.buttonHandleClick),onKeyDown:ge(o,t.buttonHandleKeyDown),onKeyUp:ge(r,t.buttonHandleKeyUp),onBlur:ge(s,t.buttonHandleBlur)};return{type:"button",role:"button","aria-label":l?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0,...u.disabled?{}:a,...u}},this.buttonHandleKeyUp=e=>{e.preventDefault()},this.buttonHandleKeyDown=e=>{const t=Se(e);this.buttonKeyDownHandlers[t]&&this.buttonKeyDownHandlers[t].call(this,e)},this.buttonHandleClick=e=>{e.preventDefault(),this.props.environment.document.activeElement===this.props.environment.document.body&&e.target.focus(),this.internalSetTimeout((()=>this.toggleMenu({type:13})))},this.buttonHandleBlur=e=>{const t=e.target;this.internalSetTimeout((()=>{this.isMouseDown||null!=this.props.environment.document.activeElement&&this.props.environment.document.activeElement.id===this.inputId||this.props.environment.document.activeElement===t||this.reset({type:14})}))},this.getLabelProps=e=>({htmlFor:this.inputId,id:this.labelId,...e}),this.getInputProps=function(e){let n,{onKeyDown:i,onBlur:o,onChange:r,onInput:s,onChangeText:u,...l}=void 0===e?{}:e,a={};n="onChange";const{inputValue:d,isOpen:c,highlightedIndex:h}=t.getState();return l.disabled||(a={onChange:ge(r,s,t.inputHandleChange),onKeyDown:ge(i,t.inputHandleKeyDown),onBlur:ge(o,t.inputHandleBlur)}),{"aria-autocomplete":"list","aria-activedescendant":c&&"number"==typeof h&&h>=0?t.getItemId(h):null,"aria-controls":c?t.menuId:null,"aria-labelledby":t.labelId,autoComplete:"off",value:d,id:t.inputId,...a,...l}},this.inputHandleKeyDown=e=>{const t=Se(e);t&&this.inputKeyDownHandlers[t]&&this.inputKeyDownHandlers[t].call(this,e)},this.inputHandleChange=e=>{this.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:this.props.defaultHighlightedIndex})},this.inputHandleBlur=()=>{this.internalSetTimeout((()=>{const e=this.props.environment.document&&!!this.props.environment.document.activeElement&&!!this.props.environment.document.activeElement.dataset&&this.props.environment.document.activeElement.dataset.toggle&&this._rootNode&&this._rootNode.contains(this.props.environment.document.activeElement);this.isMouseDown||e||this.reset({type:10})}))},this.menuRef=e=>{this._menuNode=e},this.getMenuProps=function(e,n){let{refKey:i="ref",ref:o,...r}=void 0===e?{}:e,{suppressRefError:s=!1}=void 0===n?{}:n;return t.getMenuProps.called=!0,t.getMenuProps.refKey=i,t.getMenuProps.suppressRefError=s,{[i]:me(o,t.menuRef),role:"listbox","aria-labelledby":r&&r["aria-label"]?null:t.labelId,id:t.menuId,...r}},this.getItemProps=function(e){let{onMouseMove:n,onMouseDown:i,onClick:o,onPress:r,index:s,item:u,...l}=void 0===e?{}:e;void 0===s?(t.items.push(u),s=t.items.indexOf(u)):t.items[s]=u;const a=o,d={onMouseMove:ge(n,(()=>{s!==t.getState().highlightedIndex&&(t.setHighlightedIndex(s,{type:2}),t.avoidScrolling=!0,t.internalSetTimeout((()=>t.avoidScrolling=!1),250))})),onMouseDown:ge(i,(e=>{e.preventDefault()})),onClick:ge(a,(()=>{t.selectItemAtIndex(s,{type:9})}))},c=l.disabled?{onMouseDown:d.onMouseDown}:d;return{id:t.getItemId(s),role:"option","aria-selected":t.getState().highlightedIndex===s,...c,...l}},this.clearItems=()=>{this.items=[]},this.reset=function(e,n){void 0===e&&(e={}),e=xe(e),t.internalSetState((n=>{let{selectedItem:i}=n;return{isOpen:t.props.defaultIsOpen,highlightedIndex:t.props.defaultHighlightedIndex,inputValue:t.props.itemToString(i),...e}}),n)},this.toggleMenu=function(e,n){void 0===e&&(e={}),e=xe(e),t.internalSetState((n=>{let{isOpen:i}=n;return{isOpen:!i,...i&&{highlightedIndex:t.props.defaultHighlightedIndex},...e}}),(()=>{const{isOpen:i,highlightedIndex:o}=t.getState();i&&t.getItemCount()>0&&"number"==typeof o&&t.setHighlightedIndex(o,e),ae(n)()}))},this.openMenu=e=>{this.internalSetState({isOpen:!0},e)},this.closeMenu=e=>{this.internalSetState({isOpen:!1},e)},this.updateStatus=pe((()=>{const e=this.getState(),t=this.items[e.highlightedIndex],n=this.getItemCount(),i=this.props.getA11yStatusMessage({itemToString:this.props.itemToString,previousResultCount:this.previousResultCount,resultCount:n,highlightedItem:t,...e});this.previousResultCount=n,Ee(i,this.props.environment.document)}),200);const{defaultHighlightedIndex:n,initialHighlightedIndex:i=n,defaultIsOpen:o,initialIsOpen:r=o,initialInputValue:s="",initialSelectedItem:u=null}=this.props,l=this.getState({highlightedIndex:i,isOpen:r,inputValue:s,selectedItem:u});null!=l.selectedItem&&void 0===this.props.initialInputValue&&(l.inputValue=this.props.itemToString(l.selectedItem)),this.state=l}internalClearTimeouts(){this.timeoutIds.forEach((e=>{clearTimeout(e)})),this.timeoutIds=[]}getState(e){return void 0===e&&(e=this.state),be(e,this.props)}getItemCount(){let e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e}getItemNodeFromIndex(e){return this.props.environment.document.getElementById(this.getItemId(e))}scrollHighlightedItemIntoView(){{const e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)}}moveHighlightedIndex(e,t){const n=this.getItemCount(),{highlightedIndex:i}=this.getState();if(n>0){const o=Ce(e,i,n,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(o,t)}}getStateAndHelpers(){const{highlightedIndex:e,inputValue:t,selectedItem:n,isOpen:i}=this.getState(),{itemToString:o}=this.props,{id:r}=this,{getRootProps:s,getToggleButtonProps:u,getLabelProps:l,getMenuProps:a,getInputProps:d,getItemProps:c,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,reset:b,setItemCount:w,unsetItemCount:S,internalSetState:C}=this;return{getRootProps:s,getToggleButtonProps:u,getLabelProps:l,getMenuProps:a,getInputProps:d,getItemProps:c,reset:b,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,setItemCount:w,unsetItemCount:S,setState:C,itemToString:o,id:r,highlightedIndex:e,inputValue:t,isOpen:i,selectedItem:n}}componentDidMount(){{const e=()=>{this.isMouseDown=!0},t=e=>{this.isMouseDown=!1;!Oe(e.target,[this._rootNode,this._menuNode],this.props.environment)&&this.getState().isOpen&&this.reset({type:1},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},n=()=>{this.isTouchMove=!1},i=()=>{this.isTouchMove=!0},o=e=>{const t=Oe(e.target,[this._rootNode,this._menuNode],this.props.environment,!1);this.isTouchMove||t||!this.getState().isOpen||this.reset({type:16},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},{environment:r}=this.props;r.addEventListener("mousedown",e),r.addEventListener("mouseup",t),r.addEventListener("touchstart",n),r.addEventListener("touchmove",i),r.addEventListener("touchend",o),this.cleanup=()=>{this.internalClearTimeouts(),this.updateStatus.cancel(),r.removeEventListener("mousedown",e),r.removeEventListener("mouseup",t),r.removeEventListener("touchstart",n),r.removeEventListener("touchmove",i),r.removeEventListener("touchend",o)}}}shouldScroll(e,t){const{highlightedIndex:n}=void 0===this.props.highlightedIndex?this.getState():this.props,{highlightedIndex:i}=void 0===t.highlightedIndex?e:t;return n&&this.getState().isOpen&&!e.isOpen||n!==i}componentDidUpdate(e,t){we(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()}componentWillUnmount(){this.cleanup()}render(){const e=ye(this.props.children,de);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;const n=ye(e(this.getStateAndHelpers()));return n?this.getRootProps.called||this.props.suppressRefError?n:function(e){return"string"==typeof e.type}(n)?t.cloneElement(n,this.getRootProps(function(e){return e.props}(n))):void 0:null}}return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Ie,itemToString:e=>null==e?"":String(e),onStateChange:de,onInputValueChange:de,onUserAction:de,onChange:de,onSelect:de,onOuterClick:de,selectedItemChanged:(e,t)=>e!==t,environment:"undefined"==typeof window?{}:window,stateReducer:(e,t)=>t,suppressRefError:!1,scrollIntoView:ce},e.stateChangeTypes=Pe,e})();var Re=Te;const He={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Fe(e,t,n){const{props:i,type:o}=e,r={};Object.keys(t).forEach((i=>{!function(e,t,n,i){const{props:o,type:r}=t,s=`on${Ne(e)}Change`;o[s]&&void 0!==i[e]&&i[e]!==n[e]&&o[s]({type:r,...i})}(i,e,t,n),n[i]!==t[i]&&(r[i]=n[i])})),i.onStateChange&&Object.keys(r).length&&i.onStateChange({type:o,...r})}const Ke=pe(((e,t)=>{Ee(e(),t)}),200),Ve="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function $e(e){let{id:n=`downshift-${fe()}`,labelId:i,menuId:o,getItemId:r,toggleButtonId:s,inputId:u}=e;return t.useRef({labelId:i||`${n}-label`,menuId:o||`${n}-menu`,getItemId:r||(e=>`${n}-item-${e}`),toggleButtonId:s||`${n}-toggle-button`,inputId:u||`${n}-input`}).current}function Ae(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function Ne(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Be(e){const n=t.useRef(e);return n.current=e,n}function Le(e,n,i){const o=t.useRef(),r=t.useRef(),s=t.useCallback(((t,n)=>{r.current=n,t=be(t,n.props);const i=e(t,n);return n.props.stateReducer(t,{...n,changes:i})}),[e]),[u,l]=t.useReducer(s,n),a=Be(i),d=t.useCallback((e=>l({props:a.current,...e})),[a]),c=r.current;return t.useEffect((()=>{c&&o.current&&o.current!==u&&Fe(c,be(o.current,c.props),u),o.current=u}),[u,i,c]),[u,d]}function _e(e,t,n){const[i,o]=Le(e,t,n);return[be(i,n),o]}const je={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){const{selectedItem:t,itemToString:n}=e;return t?`${n(t)} has been selected.`:""},scrollIntoView:ce,environment:"undefined"==typeof window?{}:window};function Ue(e,t,n){void 0===n&&(n=He);const i=e[`default${Ne(t)}`];return void 0!==i?i:n[t]}function We(e,t,n){void 0===n&&(n=He);const i=e[t];if(void 0!==i)return i;const o=e[`initial${Ne(t)}`];return void 0!==o?o:Ue(e,t,n)}function ze(e){const t=We(e,"selectedItem"),n=We(e,"isOpen"),i=We(e,"highlightedIndex"),o=We(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function qe(e,t,n){const{items:i,initialHighlightedIndex:o,defaultHighlightedIndex:r}=e,{selectedItem:s,highlightedIndex:u}=t;return 0===i.length?-1:void 0!==o&&u===o?o:void 0!==r?r:s?i.indexOf(s):0===n?-1:n<0?i.length-1:0}function Ye(e,n,i,o){const r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((()=>{const t=()=>{r.current.isMouseDown=!0},s=t=>{r.current.isMouseDown=!1,e&&!Oe(t.target,n.map((e=>e.current)),i)&&o()},u=()=>{r.current.isTouchMove=!1},l=()=>{r.current.isTouchMove=!0},a=t=>{!e||r.current.isTouchMove||Oe(t.target,n.map((e=>e.current)),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",s),i.addEventListener("touchstart",u),i.addEventListener("touchmove",l),i.addEventListener("touchend",a),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",s),i.removeEventListener("touchstart",u),i.removeEventListener("touchmove",l),i.removeEventListener("touchend",a)}}),[e,i]),r}let Xe=()=>de;function Ge(e,n,i){let{isInitialMount:o,highlightedIndex:r,items:s,environment:u,...l}=i;t.useEffect((()=>{o||Ke((()=>e({highlightedIndex:r,highlightedItem:s[r],resultCount:s.length,...l})),u.document)}),n)}function Je(e){let{highlightedIndex:n,isOpen:i,itemRefs:o,getItemNodeFromIndex:r,menuElement:s,scrollIntoView:u}=e;const l=t.useRef(!0);return Ve((()=>{n<0||!i||!Object.keys(o.current).length||(!1===l.current?l.current=!0:u(r(n),s))}),[n]),l}let Qe=de;function Ze(e,t,n){const{type:i,props:o}=t;let r;switch(i){case n.ItemMouseMove:r={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:r={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:r={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:qe(o,e,0)};break;case n.FunctionOpenMenu:r={isOpen:!0,highlightedIndex:qe(o,e,0)};break;case n.FunctionCloseMenu:r={isOpen:!1};break;case n.FunctionSetHighlightedIndex:r={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:r={inputValue:t.inputValue};break;case n.FunctionReset:r={highlightedIndex:Ue(o,"highlightedIndex"),isOpen:Ue(o,"isOpen"),selectedItem:Ue(o,"selectedItem"),inputValue:Ue(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...r}}var et=function(){return et=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},et.apply(this,arguments)};M.array.isRequired,M.func,M.func,M.func,M.number,M.number,M.number,M.bool,M.bool,M.bool,M.any,M.any,M.any,M.string,M.string,M.string,M.func,M.string,M.func,M.func,M.func,M.func,M.func,M.shape({addEventListener:M.func,removeEventListener:M.func,document:M.shape({getElementById:M.func,activeElement:M.any,body:M.any})});var tt=et(et({},je),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?"".concat(n," result").concat(1===n?" is":"s are"," available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select."):"":"No results are available.":""}}),nt=de;var it=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:1,ToggleButtonKeyDownArrowUp:2,ToggleButtonKeyDownCharacter:3,ToggleButtonKeyDownEscape:4,ToggleButtonKeyDownHome:5,ToggleButtonKeyDownEnd:6,ToggleButtonKeyDownEnter:7,ToggleButtonKeyDownSpaceButton:8,ToggleButtonKeyDownPageUp:9,ToggleButtonKeyDownPageDown:10,ToggleButtonBlur:11,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21});function ot(e,t){const{type:n,props:i,altKey:o}=t;let r;switch(n){case 14:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),selectedItem:i.items[t.index]};break;case 3:{const n=t.key,o=`${e.inputValue}${n}`,s=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,r=e.getItemNodeFromIndex,s=t.toLowerCase(),u=0;u<i.length;u++){var l=(u+n+1)%i.length,a=i[l];if(void 0!==a&&o(a).toLowerCase().startsWith(s)){var d=r(l);if(!(null==d?void 0:d.hasAttribute("disabled")))return l}}return n}({keysSoFar:o,highlightedIndex:!e.isOpen&&e.selectedItem?i.items.indexOf(e.selectedItem):e.highlightedIndex,items:i.items,itemToString:i.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});r={inputValue:o,highlightedIndex:s,isOpen:!0}}break;case 1:r={highlightedIndex:e.isOpen?Ce(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):o&&null==e.selectedItem?-1:qe(i,e,1),isOpen:!0};break;case 2:if(e.isOpen&&o)r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};else{r={highlightedIndex:e.isOpen?Ce(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):qe(i,e,-1),isOpen:!0}}break;case 7:case 8:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 5:r={highlightedIndex:ke(1,0,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:r={highlightedIndex:ke(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:r={highlightedIndex:Ce(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 10:r={highlightedIndex:Ce(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:r={isOpen:!1,highlightedIndex:-1};break;case 11:r={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 19:r={selectedItem:t.selectedItem};break;default:return Ze(e,t,it)}return{...e,...r}}function rt(e){void 0===e&&(e={}),nt();const n={...tt,...e},{items:i,scrollIntoView:o,environment:r,itemToString:s,getA11ySelectionMessage:u,getA11yStatusMessage:l}=n,a=ze(n),[d,c]=_e(ot,a,n),{isOpen:h,highlightedIndex:p,selectedItem:g,inputValue:m}=d,f=t.useRef(null),I=t.useRef(null),y=t.useRef({}),v=t.useRef(null),x=$e(n),b=t.useRef(),w=t.useRef(!0),S=Be({state:d,props:n}),C=t.useCallback((e=>y.current[x.getItemId(e)]),[x]);Ge(l,[h,p,m,i],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:r,itemToString:s,...d}),Ge(u,[g],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:r,itemToString:s,...d});const k=Je({menuElement:I.current,highlightedIndex:p,isOpen:h,itemRefs:y,scrollIntoView:o,getItemNodeFromIndex:C});t.useEffect((()=>(v.current=pe((e=>{e({type:20,inputValue:""})}),500),()=>{v.current.cancel()})),[]),t.useEffect((()=>{m&&v.current(c)}),[c,m]),Qe({isInitialMount:w.current,props:n,state:d}),t.useEffect((()=>{w.current||(b.current=i.length)}));const O=Ye(h,[I,f],r,(()=>{c({type:11})})),M=Xe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{h||(y.current={})}),[h]);const E=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),c({type:1,getItemNodeFromIndex:C,altKey:e.altKey})},ArrowUp(e){e.preventDefault(),c({type:2,getItemNodeFromIndex:C,altKey:e.altKey})},Home(e){e.preventDefault(),c({type:5,getItemNodeFromIndex:C})},End(e){e.preventDefault(),c({type:6,getItemNodeFromIndex:C})},Escape(){S.current.state.isOpen&&c({type:4})},Enter(e){e.preventDefault(),c({type:S.current.state.isOpen?7:0})},PageUp(e){S.current.state.isOpen&&(e.preventDefault(),c({type:9,getItemNodeFromIndex:C}))},PageDown(e){S.current.state.isOpen&&(e.preventDefault(),c({type:10,getItemNodeFromIndex:C}))}," "(e){e.preventDefault(),c({type:S.current.state.isOpen?8:0})}})),[c,C,S]),D=t.useCallback((()=>{c({type:15})}),[c]),P=t.useCallback((()=>{c({type:17})}),[c]),T=t.useCallback((()=>{c({type:16})}),[c]),R=t.useCallback((e=>{c({type:18,highlightedIndex:e})}),[c]),H=t.useCallback((e=>{c({type:19,selectedItem:e})}),[c]),F=t.useCallback((()=>{c({type:21})}),[c]),K=t.useCallback((e=>{c({type:20,inputValue:e})}),[c]),V=t.useCallback((e=>({id:x.labelId,htmlFor:x.toggleButtonId,...e})),[x]),$=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",onKeyDown:o,onBlur:r,ref:s,...u}=void 0===e?{}:e,{suppressRefError:l=!1}=void 0===t?{}:t;return M("getMenuProps",l,i,I),{[i]:me(s,(e=>{I.current=e})),id:x.menuId,role:"listbox","aria-labelledby":x.labelId,tabIndex:-1,onMouseLeave:ge(n,(()=>{c({type:12})})),...u}}),[c,M,x]);return{getToggleButtonProps:t.useCallback((function(e,t){let{onBlur:n,onClick:i,onKeyDown:o,refKey:r="ref",ref:s,...u}=void 0===e?{}:e,{suppressRefError:l=!1}=void 0===t?{}:t;const a=S.current.state,d=()=>{c({type:0})},h=e=>{const t=Se(e);t&&E[t]?E[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&c({type:3,key:t,getItemNodeFromIndex:C})},p={[r]:me(s,(e=>{f.current=e})),"aria-activedescendant":a.isOpen&&a.highlightedIndex>-1?x.getItemId(a.highlightedIndex):"","aria-controls":x.menuId,"aria-expanded":S.current.state.isOpen,"aria-haspopup":"listbox","aria-labelledby":`${x.labelId}`,id:x.toggleButtonId,role:"combobox",tabIndex:0,onBlur:ge(n,(()=>{a.isOpen&&!O.current.isMouseDown&&c({type:11})})),...u};return u.disabled||(p.onClick=ge(i,d),p.onKeyDown=ge(o,h)),M("getToggleButtonProps",l,r,f),p}),[S,x,M,c,O,E,C]),getLabelProps:V,getMenuProps:$,getItemProps:t.useCallback((function(e){let{item:t,index:n,onMouseMove:o,onClick:r,refKey:s="ref",ref:u,disabled:l,...a}=void 0===e?{}:e;const{state:d,props:h}=S.current,p=t??i[n],m=Ae(n,p,h.items),f=()=>{c({type:14,index:m})},I=Ae(m,p,h.items);if(I<0)throw new Error("Pass either item or item index in getItemProps!");const v={disabled:l,role:"option","aria-selected":`${p===g}`,id:x.getItemId(I),[s]:me(u,(e=>{e&&(y.current[x.getItemId(I)]=e)})),...a};return l||(v.onClick=ge(r,f)),v.onMouseMove=ge(o,(()=>{m!==d.highlightedIndex&&(k.current=!1,c({type:13,index:m,disabled:l}))})),v}),[S,i,g,x,k,c]),toggleMenu:D,openMenu:T,closeMenu:P,setHighlightedIndex:R,selectItem:H,reset:F,setInputValue:K,highlightedIndex:p,isOpen:h,selectedItem:g,inputValue:m}}rt.stateChangeTypes=it;var st=Object.freeze({__proto__:null,InputKeyDownArrowDown:0,InputKeyDownArrowUp:1,InputKeyDownEscape:2,InputKeyDownHome:3,InputKeyDownEnd:4,InputKeyDownPageUp:5,InputKeyDownPageDown:6,InputKeyDownEnter:7,InputChange:8,InputBlur:9,InputFocus:10,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:13,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:22});M.array.isRequired,M.func,M.func,M.func,M.number,M.number,M.number,M.bool,M.bool,M.bool,M.any,M.any,M.any,M.string,M.string,M.string,M.string,M.string,M.string,M.func,M.string,M.string,M.func,M.func,M.func,M.func,M.func,M.func,M.shape({addEventListener:M.func,removeEventListener:M.func,document:M.shape({getElementById:M.func,activeElement:M.any,body:M.any})});let ut=de;const lt={...je,getA11yStatusMessage:Ie};function at(e,t){const{type:n,props:i,altKey:o}=t;let r;switch(n){case 13:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case 0:r=e.isOpen?{highlightedIndex:Ce(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:o&&null==e.selectedItem?-1:qe(i,e,1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 1:r=e.isOpen?o?{isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}}:{highlightedIndex:Ce(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:qe(i,e,-1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 7:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 2:r={isOpen:!1,highlightedIndex:-1,...!e.isOpen&&{selectedItem:null,inputValue:""}};break;case 5:r={highlightedIndex:Ce(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 6:r={highlightedIndex:Ce(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 3:r={highlightedIndex:ke(1,0,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:r={highlightedIndex:ke(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1)};break;case 9:r={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 8:r={isOpen:!0,highlightedIndex:Ue(i,"highlightedIndex"),inputValue:t.inputValue};break;case 10:r={isOpen:!0,highlightedIndex:qe(i,e,0)};break;case 19:r={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case 22:r={inputValue:t.inputValue};break;default:return Ze(e,t,st)}return{...e,...r}}function dt(e){void 0===e&&(e={}),ut();const n={...lt,...e},{initialIsOpen:i,defaultIsOpen:o,items:r,scrollIntoView:s,environment:u,getA11yStatusMessage:l,getA11ySelectionMessage:a,itemToString:d}=n,c=function(e){const t=ze(e),{selectedItem:n}=t;let{inputValue:i}=t;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),{...t,inputValue:i}}(n),[h,p]=function(e,n,i){const o=t.useRef(),[r,s]=Le(e,n,i);return t.useEffect((()=>{we(i,"selectedItem")&&(o.current!==i.selectedItem&&s({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=r.selectedItem===o.current?i.selectedItem:r.selectedItem)})),[be(r,i),s]}(at,c,n),{isOpen:g,highlightedIndex:m,selectedItem:f,inputValue:I}=h,y=t.useRef(null),v=t.useRef({}),x=t.useRef(null),b=t.useRef(null),w=t.useRef(!0),S=$e(n),C=t.useRef(),k=Be({state:h,props:n}),O=t.useCallback((e=>v.current[S.getItemId(e)]),[S]);Ge(l,[g,m,I,r],{isInitialMount:w.current,previousResultCount:C.current,items:r,environment:u,itemToString:d,...h}),Ge(a,[f],{isInitialMount:w.current,previousResultCount:C.current,items:r,environment:u,itemToString:d,...h});const M=Je({menuElement:y.current,highlightedIndex:m,isOpen:g,itemRefs:v,scrollIntoView:s,getItemNodeFromIndex:O});Qe({isInitialMount:w.current,props:n,state:h}),t.useEffect((()=>{(i||o||g)&&x.current&&x.current.focus()}),[]),t.useEffect((()=>{w.current||(C.current=r.length)}));const E=Ye(g,[x,y,b],u,(()=>{p({type:9,selectItem:!1})})),D=Xe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{g?document.activeElement!==x.current&&x?.current?.focus():v.current={}}),[g]);const P=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),p({type:0,altKey:e.altKey,getItemNodeFromIndex:O})},ArrowUp(e){e.preventDefault(),p({type:1,altKey:e.altKey,getItemNodeFromIndex:O})},Home(e){k.current.state.isOpen&&(e.preventDefault(),p({type:3,getItemNodeFromIndex:O}))},End(e){k.current.state.isOpen&&(e.preventDefault(),p({type:4,getItemNodeFromIndex:O}))},Escape(e){const t=k.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),p({type:2}))},Enter(e){k.current.state.isOpen&&229!==e.which&&(e.preventDefault(),p({type:7,getItemNodeFromIndex:O}))},PageUp(e){k.current.state.isOpen&&(e.preventDefault(),p({type:5,getItemNodeFromIndex:O}))},PageDown(e){k.current.state.isOpen&&(e.preventDefault(),p({type:6,getItemNodeFromIndex:O}))}})),[p,k,O]),T=t.useCallback((e=>({id:S.labelId,htmlFor:S.inputId,...e})),[S]),R=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",ref:o,...r}=void 0===e?{}:e,{suppressRefError:s=!1}=void 0===t?{}:t;return D("getMenuProps",s,i,y),{[i]:me(o,(e=>{y.current=e})),id:S.menuId,role:"listbox","aria-labelledby":S.labelId,onMouseLeave:ge(n,(()=>{p({type:11})})),...r}}),[p,D,S]),H=t.useCallback((function(e){let{item:t,index:n,refKey:i="ref",ref:o,onMouseMove:r,onMouseDown:s,onClick:u,onPress:l,disabled:a,...d}=void 0===e?{}:e;const{props:c,state:h}=k.current,g=Ae(n,t,c.items);if(g<0)throw new Error("Pass either item or item index in getItemProps!");const m=u;return{[i]:me(o,(e=>{e&&(v.current[S.getItemId(g)]=e)})),disabled:a,role:"option","aria-selected":`${g===h.highlightedIndex}`,id:S.getItemId(g),...!a&&{onClick:ge(m,(()=>{p({type:13,index:n})}))},onMouseMove:ge(r,(()=>{n!==h.highlightedIndex&&(M.current=!1,p({type:12,index:n,disabled:a}))})),onMouseDown:ge(s,(e=>e.preventDefault())),...d}}),[p,k,M,S]),F=t.useCallback((function(e){let{onClick:t,onPress:n,refKey:i="ref",ref:o,...r}=void 0===e?{}:e;const s=k.current.state;return{[i]:me(o,(e=>{b.current=e})),"aria-controls":S.menuId,"aria-expanded":s.isOpen,id:S.toggleButtonId,tabIndex:-1,...!r.disabled&&{onClick:ge(t,(()=>{p({type:14})}))},...r}}),[p,k,S]),K=t.useCallback((function(e,t){let{onKeyDown:n,onChange:i,onInput:o,onFocus:r,onBlur:s,onChangeText:u,refKey:l="ref",ref:a,...d}=void 0===e?{}:e,{suppressRefError:c=!1}=void 0===t?{}:t;D("getInputProps",c,l,x);const h=k.current.state,g=e=>{const t=Se(e);t&&P[t]&&P[t](e)},m=e=>{p({type:8,inputValue:e.target.value})},f=()=>{h.isOpen&&!E.current.isMouseDown&&p({type:9,selectItem:!0})},I=()=>{h.isOpen||p({type:10})};let y={};return d.disabled||(y={onChange:ge(i,o,m),onKeyDown:ge(n,g),onBlur:ge(s,f),onFocus:ge(r,I)}),{[l]:me(a,(e=>{x.current=e})),"aria-activedescendant":h.isOpen&&h.highlightedIndex>-1?S.getItemId(h.highlightedIndex):"","aria-autocomplete":"list","aria-controls":S.menuId,"aria-expanded":h.isOpen,"aria-labelledby":S.labelId,autoComplete:"off",id:S.inputId,role:"combobox",value:h.inputValue,...y,...d}}),[p,P,k,E,D,S]),V=t.useCallback((()=>{p({type:15})}),[p]),$=t.useCallback((()=>{p({type:17})}),[p]),A=t.useCallback((()=>{p({type:16})}),[p]),N=t.useCallback((e=>{p({type:18,highlightedIndex:e})}),[p]),B=t.useCallback((e=>{p({type:19,selectedItem:e})}),[p]);return{getItemProps:H,getLabelProps:T,getMenuProps:R,getInputProps:K,getToggleButtonProps:F,toggleMenu:V,openMenu:A,closeMenu:$,setHighlightedIndex:N,setInputValue:t.useCallback((e=>{p({type:20,inputValue:e})}),[p]),selectItem:B,reset:t.useCallback((()=>{p({type:21})}),[p]),highlightedIndex:m,isOpen:g,selectedItem:f,inputValue:I}}dt.stateChangeTypes=st;const ct={activeIndex:-1,selectedItems:[]};function ht(e,t){return We(e,t,ct)}function pt(e,t){return Ue(e,t,ct)}function gt(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;const t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}M.array,M.array,M.array,M.func,M.func,M.func,M.number,M.number,M.number,M.func,M.func,M.string,M.string,M.shape({addEventListener:M.func,removeEventListener:M.func,document:M.shape({getElementById:M.func,activeElement:M.any,body:M.any})});const mt={itemToString:je.itemToString,stateReducer:je.stateReducer,environment:je.environment,getA11yRemovalMessage:function(e){const{removedSelectedItem:t,itemToString:n}=e;return`${n(t)} has been removed.`},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"};let ft=de;var It=Object.freeze({__proto__:null,SelectedItemClick:0,SelectedItemKeyDownDelete:1,SelectedItemKeyDownBackspace:2,SelectedItemKeyDownNavigationNext:3,SelectedItemKeyDownNavigationPrevious:4,DropdownKeyDownNavigationPrevious:5,DropdownKeyDownBackspace:6,DropdownClick:7,FunctionAddSelectedItem:8,FunctionRemoveSelectedItem:9,FunctionSetSelectedItems:10,FunctionSetActiveIndex:11,FunctionReset:12});function yt(e,t){const{type:n,index:i,props:o,selectedItem:r}=t,{activeIndex:s,selectedItems:u}=e;let l;switch(n){case 0:l={activeIndex:i};break;case 4:l={activeIndex:s-1<0?0:s-1};break;case 3:l={activeIndex:s+1>=u.length?-1:s+1};break;case 2:case 1:{let e=s;1===u.length?e=-1:s===u.length-1&&(e=u.length-2),l={selectedItems:[...u.slice(0,s),...u.slice(s+1)],activeIndex:e};break}case 5:l={activeIndex:u.length-1};break;case 6:l={selectedItems:u.slice(0,u.length-1)};break;case 8:l={selectedItems:[...u,r]};break;case 7:l={activeIndex:-1};break;case 9:{let e=s;const t=u.indexOf(r);t>=0&&(1===u.length?e=-1:t===u.length-1&&(e=u.length-2),l={selectedItems:[...u.slice(0,t),...u.slice(t+1)],activeIndex:e});break}case 10:{const{selectedItems:e}=t;l={selectedItems:e};break}case 11:{const{activeIndex:e}=t;l={activeIndex:e};break}case 12:l={activeIndex:pt(o,"activeIndex"),selectedItems:pt(o,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...l}}function vt(e){void 0===e&&(e={}),ft();const n={...mt,...e},{getA11yRemovalMessage:i,itemToString:o,environment:r,keyNavigationNext:s,keyNavigationPrevious:u}=n,[l,a]=_e(yt,function(e){return{activeIndex:ht(e,"activeIndex"),selectedItems:ht(e,"selectedItems")}}(n),n),{activeIndex:d,selectedItems:c}=l,h=t.useRef(!0),p=t.useRef(null),g=t.useRef(c),m=t.useRef();m.current=[];const f=Be({state:l,props:n});t.useEffect((()=>{if(!h.current){if(c.length<g.current.length){const e=g.current.find((e=>c.indexOf(e)<0));Ee(i({itemToString:o,resultCount:c.length,removedSelectedItem:e,activeIndex:d,activeSelectedItem:c[d]}),r.document)}g.current=c}}),[c.length]),t.useEffect((()=>{h.current||(-1===d&&p.current?p.current.focus():m.current[d]&&m.current[d].focus())}),[d]),Qe({isInitialMount:h.current,props:n,state:l});const I=Xe();t.useEffect((()=>(h.current=!1,()=>{h.current=!0})),[]);const y=t.useMemo((()=>({[u](){a({type:4})},[s](){a({type:3})},Delete(){a({type:1})},Backspace(){a({type:2})}})),[a,s,u]),v=t.useMemo((()=>({[u](e){gt(e)&&a({type:5})},Backspace(e){gt(e)&&a({type:6})}})),[a,u]);return{getSelectedItemProps:t.useCallback((function(e){let{refKey:t="ref",ref:n,onClick:i,onKeyDown:o,selectedItem:r,index:s,...u}=void 0===e?{}:e;const{state:l}=f.current;if(Ae(s,r,l.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return{[t]:me(n,(e=>{e&&m.current.push(e)})),tabIndex:s===l.activeIndex?0:-1,onClick:ge(i,(()=>{a({type:0,index:s})})),onKeyDown:ge(o,(e=>{const t=Se(e);t&&y[t]&&y[t](e)})),...u}}),[a,f,y]),getDropdownProps:t.useCallback((function(e,t){let{refKey:n="ref",ref:i,onKeyDown:o,onClick:r,preventKeyAction:s=!1,...u}=void 0===e?{}:e,{suppressRefError:l=!1}=void 0===t?{}:t;return I("getDropdownProps",l,n,p),{[n]:me(i,(e=>{e&&(p.current=e)})),...!s&&{onKeyDown:ge(o,(e=>{const t=Se(e);t&&v[t]&&v[t](e)})),onClick:ge(r,(()=>{a({type:7})}))},...u}}),[a,v,I]),addSelectedItem:t.useCallback((e=>{a({type:8,selectedItem:e})}),[a]),removeSelectedItem:t.useCallback((e=>{a({type:9,selectedItem:e})}),[a]),setSelectedItems:t.useCallback((e=>{a({type:10,selectedItems:e})}),[a]),setActiveIndex:t.useCallback((e=>{a({type:11,activeIndex:e})}),[a]),reset:t.useCallback((()=>{a({type:12})}),[a]),selectedItems:c,activeIndex:d}}vt.stateChangeTypes=It,e.default=Re,e.resetIdCounter=function(){le=0},e.useCombobox=dt,e.useMultipleSelection=vt,e.useSelect=rt,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Downshift={},e.React)}(this,(function(e,t){"use strict";var n={exports:{}},i={},o="function"==typeof Symbol&&Symbol.for,r=o?Symbol.for("react.element"):60103,s=o?Symbol.for("react.portal"):60106,u=o?Symbol.for("react.fragment"):60107,l=o?Symbol.for("react.strict_mode"):60108,a=o?Symbol.for("react.profiler"):60114,d=o?Symbol.for("react.provider"):60109,c=o?Symbol.for("react.context"):60110,h=o?Symbol.for("react.async_mode"):60111,p=o?Symbol.for("react.concurrent_mode"):60111,g=o?Symbol.for("react.forward_ref"):60112,m=o?Symbol.for("react.suspense"):60113,f=o?Symbol.for("react.suspense_list"):60120,I=o?Symbol.for("react.memo"):60115,y=o?Symbol.for("react.lazy"):60116,v=o?Symbol.for("react.block"):60121,x=o?Symbol.for("react.fundamental"):60117,b=o?Symbol.for("react.responder"):60118,w=o?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case h:case p:case u:case a:case l:case m:return e;default:switch(e=e&&e.$$typeof){case c:case g:case y:case I:case d:return e;default:return t}}case s:return t}}}function C(e){return S(e)===p}i.AsyncMode=h,i.ConcurrentMode=p,i.ContextConsumer=c,i.ContextProvider=d,i.Element=r,i.ForwardRef=g,i.Fragment=u,i.Lazy=y,i.Memo=I,i.Portal=s,i.Profiler=a,i.StrictMode=l,i.Suspense=m,i.isAsyncMode=function(e){return C(e)||S(e)===h},i.isConcurrentMode=C,i.isContextConsumer=function(e){return S(e)===c},i.isContextProvider=function(e){return S(e)===d},i.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},i.isForwardRef=function(e){return S(e)===g},i.isFragment=function(e){return S(e)===u},i.isLazy=function(e){return S(e)===y},i.isMemo=function(e){return S(e)===I},i.isPortal=function(e){return S(e)===s},i.isProfiler=function(e){return S(e)===a},i.isStrictMode=function(e){return S(e)===l},i.isSuspense=function(e){return S(e)===m},i.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===u||e===p||e===a||e===l||e===m||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===I||e.$$typeof===d||e.$$typeof===c||e.$$typeof===g||e.$$typeof===x||e.$$typeof===b||e.$$typeof===w||e.$$typeof===v)},i.typeOf=S;function k(){}function O(){}O.resetWarningCache=k;n.exports=function(){function e(e,t,n,i,o,r){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:O,resetWarningCache:k};return n.PropTypes=n,n}();var M=n.exports,E={},D=60103,P=60106,T=60107,R=60108,H=60114,F=60109,K=60110,V=60112,$=60113,A=60120,N=60115,B=60116,L=60121,_=60122,j=60117,U=60129,W=60131;if("function"==typeof Symbol&&Symbol.for){var z=Symbol.for;D=z("react.element"),P=z("react.portal"),T=z("react.fragment"),R=z("react.strict_mode"),H=z("react.profiler"),F=z("react.provider"),K=z("react.context"),V=z("react.forward_ref"),$=z("react.suspense"),A=z("react.suspense_list"),N=z("react.memo"),B=z("react.lazy"),L=z("react.block"),_=z("react.server.block"),j=z("react.fundamental"),U=z("react.debug_trace_mode"),W=z("react.legacy_hidden")}function q(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case D:switch(e=e.type){case T:case H:case R:case $:case A:return e;default:switch(e=e&&e.$$typeof){case K:case V:case B:case N:case F:return e;default:return t}}case P:return t}}}var Y=F,X=D,G=V,J=T,Q=B,Z=N,ee=P,te=H,ne=R,ie=$;function oe(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function re(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function se(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return re(n.overflowY,t)||re(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function ue(e,t,n,i,o,r,s,u){return r<e&&s>t||r>e&&s<t?0:r<=e&&u<=n||s>=t&&u>=n?r-e-i:s>t&&u<n||r<e&&u>n?s-t+o:0}E.ContextConsumer=K,E.ContextProvider=Y,E.Element=X,E.ForwardRef=G,E.Fragment=J,E.Lazy=Q,E.Memo=Z,E.Portal=ee,E.Profiler=te,E.StrictMode=ne,E.Suspense=ie,E.isAsyncMode=function(){return!1},E.isConcurrentMode=function(){return!1},E.isContextConsumer=function(e){return q(e)===K},E.isContextProvider=function(e){return q(e)===F},E.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===D},E.isForwardRef=function(e){return q(e)===V},E.isFragment=function(e){return q(e)===T},E.isLazy=function(e){return q(e)===B},E.isMemo=function(e){return q(e)===N},E.isPortal=function(e){return q(e)===P},E.isProfiler=function(e){return q(e)===H},E.isStrictMode=function(e){return q(e)===R},E.isSuspense=function(e){return q(e)===$},E.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===T||e===H||e===U||e===R||e===$||e===A||e===W||"object"==typeof e&&null!==e&&(e.$$typeof===B||e.$$typeof===N||e.$$typeof===F||e.$$typeof===K||e.$$typeof===V||e.$$typeof===j||e.$$typeof===L||e[0]===_)},E.typeOf=q;let le=0;function ae(e){return"function"==typeof e?e:de}function de(){}function ce(e,t){if(!e)return;const n=function(e,t){var n=window,i=t.scrollMode,o=t.block,r=t.inline,s=t.boundary,u=t.skipOverflowHiddenElements,l="function"==typeof s?s:function(e){return e!==s};if(!oe(e))throw new TypeError("Invalid target");for(var a,d,c=document.scrollingElement||document.documentElement,h=[],p=e;oe(p)&&l(p);){if((p=null==(d=(a=p).parentElement)?a.getRootNode().host||null:d)===c){h.push(p);break}null!=p&&p===document.body&&se(p)&&!se(document.documentElement)||null!=p&&se(p,u)&&h.push(p)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,m=n.visualViewport?n.visualViewport.height:innerHeight,f=window.scrollX||pageXOffset,I=window.scrollY||pageYOffset,y=e.getBoundingClientRect(),v=y.height,x=y.width,b=y.top,w=y.right,S=y.bottom,C=y.left,k="start"===o||"nearest"===o?b:"end"===o?S:b+v/2,O="center"===r?C+x/2:"end"===r?w:C,M=[],E=0;E<h.length;E++){var D=h[E],P=D.getBoundingClientRect(),T=P.height,R=P.width,H=P.top,F=P.right,K=P.bottom,V=P.left;if("if-needed"===i&&b>=0&&C>=0&&S<=m&&w<=g&&b>=H&&S<=K&&C>=V&&w<=F)return M;var $=getComputedStyle(D),A=parseInt($.borderLeftWidth,10),N=parseInt($.borderTopWidth,10),B=parseInt($.borderRightWidth,10),L=parseInt($.borderBottomWidth,10),_=0,j=0,U="offsetWidth"in D?D.offsetWidth-D.clientWidth-A-B:0,W="offsetHeight"in D?D.offsetHeight-D.clientHeight-N-L:0,z="offsetWidth"in D?0===D.offsetWidth?0:R/D.offsetWidth:0,q="offsetHeight"in D?0===D.offsetHeight?0:T/D.offsetHeight:0;if(c===D)_="start"===o?k:"end"===o?k-m:"nearest"===o?ue(I,I+m,m,N,L,I+k,I+k+v,v):k-m/2,j="start"===r?O:"center"===r?O-g/2:"end"===r?O-g:ue(f,f+g,g,A,B,f+O,f+O+x,x),_=Math.max(0,_+I),j=Math.max(0,j+f);else{_="start"===o?k-H-N:"end"===o?k-K+L+W:"nearest"===o?ue(H,K,T,N,L+W,k,k+v,v):k-(H+T/2)+W/2,j="start"===r?O-V-A:"center"===r?O-(V+R/2)+U/2:"end"===r?O-F+B+U:ue(V,F,R,A,B+U,O,O+x,x);var Y=D.scrollLeft,X=D.scrollTop;k+=X-(_=Math.max(0,Math.min(X+_/q,D.scrollHeight-T/q+W))),O+=Y-(j=Math.max(0,Math.min(Y+j/z,D.scrollWidth-R/z+U)))}M.push({el:D,top:_,left:j})}return M}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((e=>{let{el:t,top:n,left:i}=e;t.scrollTop=n,t.scrollLeft=i}))}function he(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function pe(e,t){let n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,r=new Array(o),s=0;s<o;s++)r[s]=arguments[s];i(),n=setTimeout((()=>{n=null,e(...r)}),t)}return o.cancel=i,o}function ge(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.some((t=>(t&&t(e,...i),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault)))}}function me(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>{t.forEach((t=>{"function"==typeof t?t(e):t&&(t.current=e)}))}}function fe(){return String(le++)}function Ie(e){let{isOpen:t,resultCount:n,previousResultCount:i}=e;return t?n?n!==i?`${n} result${1===n?" is":"s are"} available, use up and down arrow keys to navigate. Press Enter key to select.`:"":"No results are available.":""}function ye(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}const ve=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function xe(e){void 0===e&&(e={});const t={};return ve.forEach((n=>{e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function be(e,t){return Object.keys(e).reduce(((n,i)=>(n[i]=we(t,i)?t[i]:e[i],n)),{})}function we(e,t){return void 0!==e[t]}function Se(e){const{key:t,keyCode:n}=e;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?`Arrow${t}`:t}function Ce(e,t,n,i,o){if(void 0===o&&(o=!0),0===n)return-1;const r=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:r+1);let s=t+e;s<0?s=o?r:0:s>r&&(s=o?0:r);const u=ke(e,s,n,i,o);return-1===u?t>=n?-1:t:u}function ke(e,t,n,i,o){const r=i(t);if(!r||!r.hasAttribute("disabled"))return t;if(e>0){for(let e=t+1;e<n;e++)if(!i(e).hasAttribute("disabled"))return e}else for(let e=t-1;e>=0;e--)if(!i(e).hasAttribute("disabled"))return e;return o?e>0?ke(1,0,n,i,!1):ke(-1,n-1,n,i,!1):-1}function Oe(e,t,n,i){return void 0===i&&(i=!0),t.some((t=>t&&(he(t,e,n)||i&&he(t,n.document.activeElement,n))))}const Me=pe((e=>{De(e).textContent=""}),500);function Ee(e,t){const n=De(t);e&&(n.textContent=e,Me(t))}function De(e){void 0===e&&(e=document);let t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var Pe=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16});const Te=(()=>{class e extends t.Component{constructor(e){var t;super(e),t=this,this.id=this.props.id||`downshift-${fe()}`,this.menuId=this.props.menuId||`${this.id}-menu`,this.labelId=this.props.labelId||`${this.id}-label`,this.inputId=this.props.inputId||`${this.id}-input`,this.getItemId=this.props.getItemId||(e=>`${this.id}-item-${e}`),this.input=null,this.items=[],this.itemCount=null,this.previousResultCount=0,this.timeoutIds=[],this.internalSetTimeout=(e,t)=>{const n=setTimeout((()=>{this.timeoutIds=this.timeoutIds.filter((e=>e!==n)),e()}),t);this.timeoutIds.push(n)},this.setItemCount=e=>{this.itemCount=e},this.unsetItemCount=()=>{this.itemCount=null},this.setHighlightedIndex=function(e,n){void 0===e&&(e=t.props.defaultHighlightedIndex),void 0===n&&(n={}),n=xe(n),t.internalSetState({highlightedIndex:e,...n})},this.clearSelection=e=>{this.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:this.props.defaultHighlightedIndex,isOpen:this.props.defaultIsOpen},e)},this.selectItem=(e,t,n)=>{t=xe(t),this.internalSetState({isOpen:this.props.defaultIsOpen,highlightedIndex:this.props.defaultHighlightedIndex,selectedItem:e,inputValue:this.props.itemToString(e),...t},n)},this.selectItemAtIndex=(e,t,n)=>{const i=this.items[e];null!=i&&this.selectItem(i,t,n)},this.selectHighlightedItem=(e,t)=>this.selectItemAtIndex(this.getState().highlightedIndex,e,t),this.internalSetState=(e,t)=>{let n,i;const o={},r="function"==typeof e;return!r&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,{...this.getStateAndHelpers(),...e}),this.setState((t=>{t=this.getState(t);let s=r?e(t):e;s=this.props.stateReducer(t,s),n=s.hasOwnProperty("selectedItem");const u={};return n&&s.selectedItem!==t.selectedItem&&(i=s.selectedItem),s.type=s.type||0,Object.keys(s).forEach((e=>{t[e]!==s[e]&&(o[e]=s[e]),"type"!==e&&(s[e],we(this.props,e)||(u[e]=s[e]))})),r&&s.hasOwnProperty("inputValue")&&this.props.onInputValueChange(s.inputValue,{...this.getStateAndHelpers(),...s}),u}),(()=>{ae(t)();Object.keys(o).length>1&&this.props.onStateChange(o,this.getStateAndHelpers()),n&&this.props.onSelect(e.selectedItem,this.getStateAndHelpers()),void 0!==i&&this.props.onChange(i,this.getStateAndHelpers()),this.props.onUserAction(o,this.getStateAndHelpers())}))},this.rootRef=e=>this._rootNode=e,this.getRootProps=function(e,n){let{refKey:i="ref",ref:o,...r}=void 0===e?{}:e,{suppressRefError:s=!1}=void 0===n?{}:n;t.getRootProps.called=!0,t.getRootProps.refKey=i,t.getRootProps.suppressRefError=s;const{isOpen:u}=t.getState();return{[i]:me(o,t.rootRef),role:"combobox","aria-expanded":u,"aria-haspopup":"listbox","aria-owns":u?t.menuId:null,"aria-labelledby":t.labelId,...r}},this.keyDownHandlers={ArrowDown(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:4})}else this.internalSetState({isOpen:!0,type:4},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=Ce(1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:4})}}))},ArrowUp(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:3})}else this.internalSetState({isOpen:!0,type:3},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=Ce(-1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:3})}}))},Enter(e){if(229===e.which)return;const{isOpen:t,highlightedIndex:n}=this.getState();if(t&&null!=n){e.preventDefault();const t=this.items[n],i=this.getItemNodeFromIndex(n);if(null==t||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}},Escape(e){e.preventDefault(),this.reset({type:5,...!this.state.isOpen&&{selectedItem:null,inputValue:""}})}},this.buttonKeyDownHandlers={...this.keyDownHandlers," "(e){e.preventDefault(),this.toggleMenu({type:12})}},this.inputKeyDownHandlers={...this.keyDownHandlers,Home(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ke(1,0,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:7})},End(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ke(-1,n-1,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:8})}},this.getToggleButtonProps=function(e){let{onClick:n,onPress:i,onKeyDown:o,onKeyUp:r,onBlur:s,...u}=void 0===e?{}:e;const{isOpen:l}=t.getState(),a={onClick:ge(n,t.buttonHandleClick),onKeyDown:ge(o,t.buttonHandleKeyDown),onKeyUp:ge(r,t.buttonHandleKeyUp),onBlur:ge(s,t.buttonHandleBlur)};return{type:"button",role:"button","aria-label":l?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0,...u.disabled?{}:a,...u}},this.buttonHandleKeyUp=e=>{e.preventDefault()},this.buttonHandleKeyDown=e=>{const t=Se(e);this.buttonKeyDownHandlers[t]&&this.buttonKeyDownHandlers[t].call(this,e)},this.buttonHandleClick=e=>{e.preventDefault(),this.props.environment.document.activeElement===this.props.environment.document.body&&e.target.focus(),this.internalSetTimeout((()=>this.toggleMenu({type:13})))},this.buttonHandleBlur=e=>{const t=e.target;this.internalSetTimeout((()=>{this.isMouseDown||null!=this.props.environment.document.activeElement&&this.props.environment.document.activeElement.id===this.inputId||this.props.environment.document.activeElement===t||this.reset({type:14})}))},this.getLabelProps=e=>({htmlFor:this.inputId,id:this.labelId,...e}),this.getInputProps=function(e){let n,{onKeyDown:i,onBlur:o,onChange:r,onInput:s,onChangeText:u,...l}=void 0===e?{}:e,a={};n="onChange";const{inputValue:d,isOpen:c,highlightedIndex:h}=t.getState();return l.disabled||(a={onChange:ge(r,s,t.inputHandleChange),onKeyDown:ge(i,t.inputHandleKeyDown),onBlur:ge(o,t.inputHandleBlur)}),{"aria-autocomplete":"list","aria-activedescendant":c&&"number"==typeof h&&h>=0?t.getItemId(h):null,"aria-controls":c?t.menuId:null,"aria-labelledby":t.labelId,autoComplete:"off",value:d,id:t.inputId,...a,...l}},this.inputHandleKeyDown=e=>{const t=Se(e);t&&this.inputKeyDownHandlers[t]&&this.inputKeyDownHandlers[t].call(this,e)},this.inputHandleChange=e=>{this.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:this.props.defaultHighlightedIndex})},this.inputHandleBlur=()=>{this.internalSetTimeout((()=>{const e=this.props.environment.document&&!!this.props.environment.document.activeElement&&!!this.props.environment.document.activeElement.dataset&&this.props.environment.document.activeElement.dataset.toggle&&this._rootNode&&this._rootNode.contains(this.props.environment.document.activeElement);this.isMouseDown||e||this.reset({type:10})}))},this.menuRef=e=>{this._menuNode=e},this.getMenuProps=function(e,n){let{refKey:i="ref",ref:o,...r}=void 0===e?{}:e,{suppressRefError:s=!1}=void 0===n?{}:n;return t.getMenuProps.called=!0,t.getMenuProps.refKey=i,t.getMenuProps.suppressRefError=s,{[i]:me(o,t.menuRef),role:"listbox","aria-labelledby":r&&r["aria-label"]?null:t.labelId,id:t.menuId,...r}},this.getItemProps=function(e){let{onMouseMove:n,onMouseDown:i,onClick:o,onPress:r,index:s,item:u,...l}=void 0===e?{}:e;void 0===s?(t.items.push(u),s=t.items.indexOf(u)):t.items[s]=u;const a=o,d={onMouseMove:ge(n,(()=>{s!==t.getState().highlightedIndex&&(t.setHighlightedIndex(s,{type:2}),t.avoidScrolling=!0,t.internalSetTimeout((()=>t.avoidScrolling=!1),250))})),onMouseDown:ge(i,(e=>{e.preventDefault()})),onClick:ge(a,(()=>{t.selectItemAtIndex(s,{type:9})}))},c=l.disabled?{onMouseDown:d.onMouseDown}:d;return{id:t.getItemId(s),role:"option","aria-selected":t.getState().highlightedIndex===s,...c,...l}},this.clearItems=()=>{this.items=[]},this.reset=function(e,n){void 0===e&&(e={}),e=xe(e),t.internalSetState((n=>{let{selectedItem:i}=n;return{isOpen:t.props.defaultIsOpen,highlightedIndex:t.props.defaultHighlightedIndex,inputValue:t.props.itemToString(i),...e}}),n)},this.toggleMenu=function(e,n){void 0===e&&(e={}),e=xe(e),t.internalSetState((n=>{let{isOpen:i}=n;return{isOpen:!i,...i&&{highlightedIndex:t.props.defaultHighlightedIndex},...e}}),(()=>{const{isOpen:i,highlightedIndex:o}=t.getState();i&&t.getItemCount()>0&&"number"==typeof o&&t.setHighlightedIndex(o,e),ae(n)()}))},this.openMenu=e=>{this.internalSetState({isOpen:!0},e)},this.closeMenu=e=>{this.internalSetState({isOpen:!1},e)},this.updateStatus=pe((()=>{const e=this.getState(),t=this.items[e.highlightedIndex],n=this.getItemCount(),i=this.props.getA11yStatusMessage({itemToString:this.props.itemToString,previousResultCount:this.previousResultCount,resultCount:n,highlightedItem:t,...e});this.previousResultCount=n,Ee(i,this.props.environment.document)}),200);const{defaultHighlightedIndex:n,initialHighlightedIndex:i=n,defaultIsOpen:o,initialIsOpen:r=o,initialInputValue:s="",initialSelectedItem:u=null}=this.props,l=this.getState({highlightedIndex:i,isOpen:r,inputValue:s,selectedItem:u});null!=l.selectedItem&&void 0===this.props.initialInputValue&&(l.inputValue=this.props.itemToString(l.selectedItem)),this.state=l}internalClearTimeouts(){this.timeoutIds.forEach((e=>{clearTimeout(e)})),this.timeoutIds=[]}getState(e){return void 0===e&&(e=this.state),be(e,this.props)}getItemCount(){let e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e}getItemNodeFromIndex(e){return this.props.environment.document.getElementById(this.getItemId(e))}scrollHighlightedItemIntoView(){{const e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)}}moveHighlightedIndex(e,t){const n=this.getItemCount(),{highlightedIndex:i}=this.getState();if(n>0){const o=Ce(e,i,n,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(o,t)}}getStateAndHelpers(){const{highlightedIndex:e,inputValue:t,selectedItem:n,isOpen:i}=this.getState(),{itemToString:o}=this.props,{id:r}=this,{getRootProps:s,getToggleButtonProps:u,getLabelProps:l,getMenuProps:a,getInputProps:d,getItemProps:c,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,reset:b,setItemCount:w,unsetItemCount:S,internalSetState:C}=this;return{getRootProps:s,getToggleButtonProps:u,getLabelProps:l,getMenuProps:a,getInputProps:d,getItemProps:c,reset:b,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,setItemCount:w,unsetItemCount:S,setState:C,itemToString:o,id:r,highlightedIndex:e,inputValue:t,isOpen:i,selectedItem:n}}componentDidMount(){{const e=()=>{this.isMouseDown=!0},t=e=>{this.isMouseDown=!1;!Oe(e.target,[this._rootNode,this._menuNode],this.props.environment)&&this.getState().isOpen&&this.reset({type:1},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},n=()=>{this.isTouchMove=!1},i=()=>{this.isTouchMove=!0},o=e=>{const t=Oe(e.target,[this._rootNode,this._menuNode],this.props.environment,!1);this.isTouchMove||t||!this.getState().isOpen||this.reset({type:16},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},{environment:r}=this.props;r.addEventListener("mousedown",e),r.addEventListener("mouseup",t),r.addEventListener("touchstart",n),r.addEventListener("touchmove",i),r.addEventListener("touchend",o),this.cleanup=()=>{this.internalClearTimeouts(),this.updateStatus.cancel(),r.removeEventListener("mousedown",e),r.removeEventListener("mouseup",t),r.removeEventListener("touchstart",n),r.removeEventListener("touchmove",i),r.removeEventListener("touchend",o)}}}shouldScroll(e,t){const{highlightedIndex:n}=void 0===this.props.highlightedIndex?this.getState():this.props,{highlightedIndex:i}=void 0===t.highlightedIndex?e:t;return n&&this.getState().isOpen&&!e.isOpen||n!==i}componentDidUpdate(e,t){we(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()}componentWillUnmount(){this.cleanup()}render(){const e=ye(this.props.children,de);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;const n=ye(e(this.getStateAndHelpers()));return n?this.getRootProps.called||this.props.suppressRefError?n:function(e){return"string"==typeof e.type}(n)?t.cloneElement(n,this.getRootProps(function(e){return e.props}(n))):void 0:null}}return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Ie,itemToString:e=>null==e?"":String(e),onStateChange:de,onInputValueChange:de,onUserAction:de,onChange:de,onSelect:de,onOuterClick:de,selectedItemChanged:(e,t)=>e!==t,environment:"undefined"==typeof window?{}:window,stateReducer:(e,t)=>t,suppressRefError:!1,scrollIntoView:ce},e.stateChangeTypes=Pe,e})();var Re=Te;const He={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Fe(e,t,n){const{props:i,type:o}=e,r={};Object.keys(t).forEach((i=>{!function(e,t,n,i){const{props:o,type:r}=t,s=`on${Ne(e)}Change`;o[s]&&void 0!==i[e]&&i[e]!==n[e]&&o[s]({type:r,...i})}(i,e,t,n),n[i]!==t[i]&&(r[i]=n[i])})),i.onStateChange&&Object.keys(r).length&&i.onStateChange({type:o,...r})}const Ke=pe(((e,t)=>{Ee(e(),t)}),200),Ve="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function $e(e){let{id:n=`downshift-${fe()}`,labelId:i,menuId:o,getItemId:r,toggleButtonId:s,inputId:u}=e;return t.useRef({labelId:i||`${n}-label`,menuId:o||`${n}-menu`,getItemId:r||(e=>`${n}-item-${e}`),toggleButtonId:s||`${n}-toggle-button`,inputId:u||`${n}-input`}).current}function Ae(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function Ne(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Be(e){const n=t.useRef(e);return n.current=e,n}function Le(e,n,i){const o=t.useRef(),r=t.useRef(),s=t.useCallback(((t,n)=>{r.current=n,t=be(t,n.props);const i=e(t,n);return n.props.stateReducer(t,{...n,changes:i})}),[e]),[u,l]=t.useReducer(s,n),a=Be(i),d=t.useCallback((e=>l({props:a.current,...e})),[a]),c=r.current;return t.useEffect((()=>{c&&o.current&&o.current!==u&&Fe(c,be(o.current,c.props),u),o.current=u}),[u,i,c]),[u,d]}function _e(e,t,n){const[i,o]=Le(e,t,n);return[be(i,n),o]}const je={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){const{selectedItem:t,itemToString:n}=e;return t?`${n(t)} has been selected.`:""},scrollIntoView:ce,environment:"undefined"==typeof window?{}:window};function Ue(e,t,n){void 0===n&&(n=He);const i=e[`default${Ne(t)}`];return void 0!==i?i:n[t]}function We(e,t,n){void 0===n&&(n=He);const i=e[t];if(void 0!==i)return i;const o=e[`initial${Ne(t)}`];return void 0!==o?o:Ue(e,t,n)}function ze(e){const t=We(e,"selectedItem"),n=We(e,"isOpen"),i=We(e,"highlightedIndex"),o=We(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function qe(e,t,n){const{items:i,initialHighlightedIndex:o,defaultHighlightedIndex:r}=e,{selectedItem:s,highlightedIndex:u}=t;return 0===i.length?-1:void 0!==o&&u===o?o:void 0!==r?r:s?i.indexOf(s):0===n?-1:n<0?i.length-1:0}function Ye(e,n,i,o){const r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((()=>{const t=()=>{r.current.isMouseDown=!0},s=t=>{r.current.isMouseDown=!1,e&&!Oe(t.target,n.map((e=>e.current)),i)&&o()},u=()=>{r.current.isTouchMove=!1},l=()=>{r.current.isTouchMove=!0},a=t=>{!e||r.current.isTouchMove||Oe(t.target,n.map((e=>e.current)),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",s),i.addEventListener("touchstart",u),i.addEventListener("touchmove",l),i.addEventListener("touchend",a),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",s),i.removeEventListener("touchstart",u),i.removeEventListener("touchmove",l),i.removeEventListener("touchend",a)}}),[e,i]),r}let Xe=()=>de;function Ge(e,n,i){let{isInitialMount:o,highlightedIndex:r,items:s,environment:u,...l}=i;t.useEffect((()=>{o||Ke((()=>e({highlightedIndex:r,highlightedItem:s[r],resultCount:s.length,...l})),u.document)}),n)}function Je(e){let{highlightedIndex:n,isOpen:i,itemRefs:o,getItemNodeFromIndex:r,menuElement:s,scrollIntoView:u}=e;const l=t.useRef(!0);return Ve((()=>{n<0||!i||!Object.keys(o.current).length||(!1===l.current?l.current=!0:u(r(n),s))}),[n]),l}let Qe=de;function Ze(e,t,n){const{type:i,props:o}=t;let r;switch(i){case n.ItemMouseMove:r={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:r={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:r={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:qe(o,e,0)};break;case n.FunctionOpenMenu:r={isOpen:!0,highlightedIndex:qe(o,e,0)};break;case n.FunctionCloseMenu:r={isOpen:!1};break;case n.FunctionSetHighlightedIndex:r={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:r={inputValue:t.inputValue};break;case n.FunctionReset:r={highlightedIndex:Ue(o,"highlightedIndex"),isOpen:Ue(o,"isOpen"),selectedItem:Ue(o,"selectedItem"),inputValue:Ue(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...r}}var et=function(){return et=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},et.apply(this,arguments)};M.array.isRequired,M.func,M.func,M.func,M.number,M.number,M.number,M.bool,M.bool,M.bool,M.any,M.any,M.any,M.string,M.string,M.string,M.func,M.string,M.func,M.func,M.func,M.func,M.func,M.shape({addEventListener:M.func,removeEventListener:M.func,document:M.shape({getElementById:M.func,activeElement:M.any,body:M.any})});var tt=et(et({},je),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?"".concat(n," result").concat(1===n?" is":"s are"," available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select."):"":"No results are available.":""}}),nt=de;var it=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:1,ToggleButtonKeyDownArrowUp:2,ToggleButtonKeyDownCharacter:3,ToggleButtonKeyDownEscape:4,ToggleButtonKeyDownHome:5,ToggleButtonKeyDownEnd:6,ToggleButtonKeyDownEnter:7,ToggleButtonKeyDownSpaceButton:8,ToggleButtonKeyDownPageUp:9,ToggleButtonKeyDownPageDown:10,ToggleButtonBlur:11,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21});function ot(e,t){const{type:n,props:i,altKey:o}=t;let r;switch(n){case 14:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),selectedItem:i.items[t.index]};break;case 3:{const n=t.key,o=`${e.inputValue}${n}`,s=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,r=e.getItemNodeFromIndex,s=t.toLowerCase(),u=0;u<i.length;u++){var l=(u+n+(t.length<2?1:0))%i.length,a=i[l];if(void 0!==a&&o(a).toLowerCase().startsWith(s)){var d=r(l);if(!(null==d?void 0:d.hasAttribute("disabled")))return l}}return n}({keysSoFar:o,highlightedIndex:!e.isOpen&&e.selectedItem?i.items.indexOf(e.selectedItem):e.highlightedIndex,items:i.items,itemToString:i.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});r={inputValue:o,highlightedIndex:s,isOpen:!0}}break;case 1:r={highlightedIndex:e.isOpen?Ce(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):o&&null==e.selectedItem?-1:qe(i,e,1),isOpen:!0};break;case 2:if(e.isOpen&&o)r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};else{r={highlightedIndex:e.isOpen?Ce(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):qe(i,e,-1),isOpen:!0}}break;case 7:case 8:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 5:r={highlightedIndex:ke(1,0,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:r={highlightedIndex:ke(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:r={highlightedIndex:Ce(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 10:r={highlightedIndex:Ce(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:r={isOpen:!1,highlightedIndex:-1};break;case 11:r={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 19:r={selectedItem:t.selectedItem};break;default:return Ze(e,t,it)}return{...e,...r}}function rt(e){void 0===e&&(e={}),nt();const n={...tt,...e},{items:i,scrollIntoView:o,environment:r,itemToString:s,getA11ySelectionMessage:u,getA11yStatusMessage:l}=n,a=ze(n),[d,c]=_e(ot,a,n),{isOpen:h,highlightedIndex:p,selectedItem:g,inputValue:m}=d,f=t.useRef(null),I=t.useRef(null),y=t.useRef({}),v=t.useRef(null),x=$e(n),b=t.useRef(),w=t.useRef(!0),S=Be({state:d,props:n}),C=t.useCallback((e=>y.current[x.getItemId(e)]),[x]);Ge(l,[h,p,m,i],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:r,itemToString:s,...d}),Ge(u,[g],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:r,itemToString:s,...d});const k=Je({menuElement:I.current,highlightedIndex:p,isOpen:h,itemRefs:y,scrollIntoView:o,getItemNodeFromIndex:C});t.useEffect((()=>(v.current=pe((e=>{e({type:20,inputValue:""})}),500),()=>{v.current.cancel()})),[]),t.useEffect((()=>{m&&v.current(c)}),[c,m]),Qe({isInitialMount:w.current,props:n,state:d}),t.useEffect((()=>{w.current||(b.current=i.length)}));const O=Ye(h,[I,f],r,(()=>{c({type:11})})),M=Xe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{h||(y.current={})}),[h]);const E=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),c({type:1,getItemNodeFromIndex:C,altKey:e.altKey})},ArrowUp(e){e.preventDefault(),c({type:2,getItemNodeFromIndex:C,altKey:e.altKey})},Home(e){e.preventDefault(),c({type:5,getItemNodeFromIndex:C})},End(e){e.preventDefault(),c({type:6,getItemNodeFromIndex:C})},Escape(){S.current.state.isOpen&&c({type:4})},Enter(e){e.preventDefault(),c({type:S.current.state.isOpen?7:0})},PageUp(e){S.current.state.isOpen&&(e.preventDefault(),c({type:9,getItemNodeFromIndex:C}))},PageDown(e){S.current.state.isOpen&&(e.preventDefault(),c({type:10,getItemNodeFromIndex:C}))}," "(e){e.preventDefault();const t=S.current.state;t.isOpen?t.inputValue?c({type:3,key:" ",getItemNodeFromIndex:C}):c({type:8}):c({type:0})}})),[c,C,S]),D=t.useCallback((()=>{c({type:15})}),[c]),P=t.useCallback((()=>{c({type:17})}),[c]),T=t.useCallback((()=>{c({type:16})}),[c]),R=t.useCallback((e=>{c({type:18,highlightedIndex:e})}),[c]),H=t.useCallback((e=>{c({type:19,selectedItem:e})}),[c]),F=t.useCallback((()=>{c({type:21})}),[c]),K=t.useCallback((e=>{c({type:20,inputValue:e})}),[c]),V=t.useCallback((e=>({id:x.labelId,htmlFor:x.toggleButtonId,...e})),[x]),$=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",onKeyDown:o,onBlur:r,ref:s,...u}=void 0===e?{}:e,{suppressRefError:l=!1}=void 0===t?{}:t;return M("getMenuProps",l,i,I),{[i]:me(s,(e=>{I.current=e})),id:x.menuId,role:"listbox","aria-labelledby":x.labelId,tabIndex:-1,onMouseLeave:ge(n,(()=>{c({type:12})})),...u}}),[c,M,x]);return{getToggleButtonProps:t.useCallback((function(e,t){let{onBlur:n,onClick:i,onKeyDown:o,refKey:r="ref",ref:s,...u}=void 0===e?{}:e,{suppressRefError:l=!1}=void 0===t?{}:t;const a=S.current.state,d=()=>{c({type:0})},h=e=>{const t=Se(e);t&&E[t]?E[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&c({type:3,key:t,getItemNodeFromIndex:C})},p={[r]:me(s,(e=>{f.current=e})),"aria-activedescendant":a.isOpen&&a.highlightedIndex>-1?x.getItemId(a.highlightedIndex):"","aria-controls":x.menuId,"aria-expanded":S.current.state.isOpen,"aria-haspopup":"listbox","aria-labelledby":`${x.labelId}`,id:x.toggleButtonId,role:"combobox",tabIndex:0,onBlur:ge(n,(()=>{a.isOpen&&!O.current.isMouseDown&&c({type:11})})),...u};return u.disabled||(p.onClick=ge(i,d),p.onKeyDown=ge(o,h)),M("getToggleButtonProps",l,r,f),p}),[S,x,M,c,O,E,C]),getLabelProps:V,getMenuProps:$,getItemProps:t.useCallback((function(e){let{item:t,index:n,onMouseMove:o,onClick:r,refKey:s="ref",ref:u,disabled:l,...a}=void 0===e?{}:e;const{state:d,props:h}=S.current,p=t??i[n],m=Ae(n,p,h.items),f=()=>{c({type:14,index:m})},I=Ae(m,p,h.items);if(I<0)throw new Error("Pass either item or item index in getItemProps!");const v={disabled:l,role:"option","aria-selected":`${p===g}`,id:x.getItemId(I),[s]:me(u,(e=>{e&&(y.current[x.getItemId(I)]=e)})),...a};return l||(v.onClick=ge(r,f)),v.onMouseMove=ge(o,(()=>{m!==d.highlightedIndex&&(k.current=!1,c({type:13,index:m,disabled:l}))})),v}),[S,i,g,x,k,c]),toggleMenu:D,openMenu:T,closeMenu:P,setHighlightedIndex:R,selectItem:H,reset:F,setInputValue:K,highlightedIndex:p,isOpen:h,selectedItem:g,inputValue:m}}rt.stateChangeTypes=it;var st=Object.freeze({__proto__:null,InputKeyDownArrowDown:0,InputKeyDownArrowUp:1,InputKeyDownEscape:2,InputKeyDownHome:3,InputKeyDownEnd:4,InputKeyDownPageUp:5,InputKeyDownPageDown:6,InputKeyDownEnter:7,InputChange:8,InputBlur:9,InputFocus:10,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:13,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:22});M.array.isRequired,M.func,M.func,M.func,M.number,M.number,M.number,M.bool,M.bool,M.bool,M.any,M.any,M.any,M.string,M.string,M.string,M.string,M.string,M.string,M.func,M.string,M.string,M.func,M.func,M.func,M.func,M.func,M.func,M.shape({addEventListener:M.func,removeEventListener:M.func,document:M.shape({getElementById:M.func,activeElement:M.any,body:M.any})});let ut=de;const lt={...je,getA11yStatusMessage:Ie};function at(e,t){const{type:n,props:i,altKey:o}=t;let r;switch(n){case 13:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case 0:r=e.isOpen?{highlightedIndex:Ce(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:o&&null==e.selectedItem?-1:qe(i,e,1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 1:r=e.isOpen?o?{isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}}:{highlightedIndex:Ce(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:qe(i,e,-1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 7:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 2:r={isOpen:!1,highlightedIndex:-1,...!e.isOpen&&{selectedItem:null,inputValue:""}};break;case 5:r={highlightedIndex:Ce(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 6:r={highlightedIndex:Ce(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 3:r={highlightedIndex:ke(1,0,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:r={highlightedIndex:ke(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1)};break;case 9:r={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 8:r={isOpen:!0,highlightedIndex:Ue(i,"highlightedIndex"),inputValue:t.inputValue};break;case 10:r={isOpen:!0,highlightedIndex:qe(i,e,0)};break;case 19:r={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case 22:r={inputValue:t.inputValue};break;default:return Ze(e,t,st)}return{...e,...r}}function dt(e){void 0===e&&(e={}),ut();const n={...lt,...e},{initialIsOpen:i,defaultIsOpen:o,items:r,scrollIntoView:s,environment:u,getA11yStatusMessage:l,getA11ySelectionMessage:a,itemToString:d}=n,c=function(e){const t=ze(e),{selectedItem:n}=t;let{inputValue:i}=t;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),{...t,inputValue:i}}(n),[h,p]=function(e,n,i){const o=t.useRef(),[r,s]=Le(e,n,i);return t.useEffect((()=>{we(i,"selectedItem")&&(o.current!==i.selectedItem&&s({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=r.selectedItem===o.current?i.selectedItem:r.selectedItem)})),[be(r,i),s]}(at,c,n),{isOpen:g,highlightedIndex:m,selectedItem:f,inputValue:I}=h,y=t.useRef(null),v=t.useRef({}),x=t.useRef(null),b=t.useRef(null),w=t.useRef(!0),S=$e(n),C=t.useRef(),k=Be({state:h,props:n}),O=t.useCallback((e=>v.current[S.getItemId(e)]),[S]);Ge(l,[g,m,I,r],{isInitialMount:w.current,previousResultCount:C.current,items:r,environment:u,itemToString:d,...h}),Ge(a,[f],{isInitialMount:w.current,previousResultCount:C.current,items:r,environment:u,itemToString:d,...h});const M=Je({menuElement:y.current,highlightedIndex:m,isOpen:g,itemRefs:v,scrollIntoView:s,getItemNodeFromIndex:O});Qe({isInitialMount:w.current,props:n,state:h}),t.useEffect((()=>{(i||o||g)&&x.current&&x.current.focus()}),[]),t.useEffect((()=>{w.current||(C.current=r.length)}));const E=Ye(g,[x,y,b],u,(()=>{p({type:9,selectItem:!1})})),D=Xe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{g?document.activeElement!==x.current&&x?.current?.focus():v.current={}}),[g]);const P=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),p({type:0,altKey:e.altKey,getItemNodeFromIndex:O})},ArrowUp(e){e.preventDefault(),p({type:1,altKey:e.altKey,getItemNodeFromIndex:O})},Home(e){k.current.state.isOpen&&(e.preventDefault(),p({type:3,getItemNodeFromIndex:O}))},End(e){k.current.state.isOpen&&(e.preventDefault(),p({type:4,getItemNodeFromIndex:O}))},Escape(e){const t=k.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),p({type:2}))},Enter(e){k.current.state.isOpen&&229!==e.which&&(e.preventDefault(),p({type:7,getItemNodeFromIndex:O}))},PageUp(e){k.current.state.isOpen&&(e.preventDefault(),p({type:5,getItemNodeFromIndex:O}))},PageDown(e){k.current.state.isOpen&&(e.preventDefault(),p({type:6,getItemNodeFromIndex:O}))}})),[p,k,O]),T=t.useCallback((e=>({id:S.labelId,htmlFor:S.inputId,...e})),[S]),R=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",ref:o,...r}=void 0===e?{}:e,{suppressRefError:s=!1}=void 0===t?{}:t;return D("getMenuProps",s,i,y),{[i]:me(o,(e=>{y.current=e})),id:S.menuId,role:"listbox","aria-labelledby":S.labelId,onMouseLeave:ge(n,(()=>{p({type:11})})),...r}}),[p,D,S]),H=t.useCallback((function(e){let{item:t,index:n,refKey:i="ref",ref:o,onMouseMove:r,onMouseDown:s,onClick:u,onPress:l,disabled:a,...d}=void 0===e?{}:e;const{props:c,state:h}=k.current,g=Ae(n,t,c.items);if(g<0)throw new Error("Pass either item or item index in getItemProps!");const m=u;return{[i]:me(o,(e=>{e&&(v.current[S.getItemId(g)]=e)})),disabled:a,role:"option","aria-selected":`${g===h.highlightedIndex}`,id:S.getItemId(g),...!a&&{onClick:ge(m,(()=>{p({type:13,index:n})}))},onMouseMove:ge(r,(()=>{n!==h.highlightedIndex&&(M.current=!1,p({type:12,index:n,disabled:a}))})),onMouseDown:ge(s,(e=>e.preventDefault())),...d}}),[p,k,M,S]),F=t.useCallback((function(e){let{onClick:t,onPress:n,refKey:i="ref",ref:o,...r}=void 0===e?{}:e;const s=k.current.state;return{[i]:me(o,(e=>{b.current=e})),"aria-controls":S.menuId,"aria-expanded":s.isOpen,id:S.toggleButtonId,tabIndex:-1,...!r.disabled&&{onClick:ge(t,(()=>{p({type:14})}))},...r}}),[p,k,S]),K=t.useCallback((function(e,t){let{onKeyDown:n,onChange:i,onInput:o,onFocus:r,onBlur:s,onChangeText:u,refKey:l="ref",ref:a,...d}=void 0===e?{}:e,{suppressRefError:c=!1}=void 0===t?{}:t;D("getInputProps",c,l,x);const h=k.current.state,g=e=>{const t=Se(e);t&&P[t]&&P[t](e)},m=e=>{p({type:8,inputValue:e.target.value})},f=()=>{h.isOpen&&!E.current.isMouseDown&&p({type:9,selectItem:!0})},I=()=>{h.isOpen||p({type:10})};let y={};return d.disabled||(y={onChange:ge(i,o,m),onKeyDown:ge(n,g),onBlur:ge(s,f),onFocus:ge(r,I)}),{[l]:me(a,(e=>{x.current=e})),"aria-activedescendant":h.isOpen&&h.highlightedIndex>-1?S.getItemId(h.highlightedIndex):"","aria-autocomplete":"list","aria-controls":S.menuId,"aria-expanded":h.isOpen,"aria-labelledby":S.labelId,autoComplete:"off",id:S.inputId,role:"combobox",value:h.inputValue,...y,...d}}),[p,P,k,E,D,S]),V=t.useCallback((()=>{p({type:15})}),[p]),$=t.useCallback((()=>{p({type:17})}),[p]),A=t.useCallback((()=>{p({type:16})}),[p]),N=t.useCallback((e=>{p({type:18,highlightedIndex:e})}),[p]),B=t.useCallback((e=>{p({type:19,selectedItem:e})}),[p]);return{getItemProps:H,getLabelProps:T,getMenuProps:R,getInputProps:K,getToggleButtonProps:F,toggleMenu:V,openMenu:A,closeMenu:$,setHighlightedIndex:N,setInputValue:t.useCallback((e=>{p({type:20,inputValue:e})}),[p]),selectItem:B,reset:t.useCallback((()=>{p({type:21})}),[p]),highlightedIndex:m,isOpen:g,selectedItem:f,inputValue:I}}dt.stateChangeTypes=st;const ct={activeIndex:-1,selectedItems:[]};function ht(e,t){return We(e,t,ct)}function pt(e,t){return Ue(e,t,ct)}function gt(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;const t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}M.array,M.array,M.array,M.func,M.func,M.func,M.number,M.number,M.number,M.func,M.func,M.string,M.string,M.shape({addEventListener:M.func,removeEventListener:M.func,document:M.shape({getElementById:M.func,activeElement:M.any,body:M.any})});const mt={itemToString:je.itemToString,stateReducer:je.stateReducer,environment:je.environment,getA11yRemovalMessage:function(e){const{removedSelectedItem:t,itemToString:n}=e;return`${n(t)} has been removed.`},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"};let ft=de;var It=Object.freeze({__proto__:null,SelectedItemClick:0,SelectedItemKeyDownDelete:1,SelectedItemKeyDownBackspace:2,SelectedItemKeyDownNavigationNext:3,SelectedItemKeyDownNavigationPrevious:4,DropdownKeyDownNavigationPrevious:5,DropdownKeyDownBackspace:6,DropdownClick:7,FunctionAddSelectedItem:8,FunctionRemoveSelectedItem:9,FunctionSetSelectedItems:10,FunctionSetActiveIndex:11,FunctionReset:12});function yt(e,t){const{type:n,index:i,props:o,selectedItem:r}=t,{activeIndex:s,selectedItems:u}=e;let l;switch(n){case 0:l={activeIndex:i};break;case 4:l={activeIndex:s-1<0?0:s-1};break;case 3:l={activeIndex:s+1>=u.length?-1:s+1};break;case 2:case 1:{let e=s;1===u.length?e=-1:s===u.length-1&&(e=u.length-2),l={selectedItems:[...u.slice(0,s),...u.slice(s+1)],activeIndex:e};break}case 5:l={activeIndex:u.length-1};break;case 6:l={selectedItems:u.slice(0,u.length-1)};break;case 8:l={selectedItems:[...u,r]};break;case 7:l={activeIndex:-1};break;case 9:{let e=s;const t=u.indexOf(r);t>=0&&(1===u.length?e=-1:t===u.length-1&&(e=u.length-2),l={selectedItems:[...u.slice(0,t),...u.slice(t+1)],activeIndex:e});break}case 10:{const{selectedItems:e}=t;l={selectedItems:e};break}case 11:{const{activeIndex:e}=t;l={activeIndex:e};break}case 12:l={activeIndex:pt(o,"activeIndex"),selectedItems:pt(o,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...l}}function vt(e){void 0===e&&(e={}),ft();const n={...mt,...e},{getA11yRemovalMessage:i,itemToString:o,environment:r,keyNavigationNext:s,keyNavigationPrevious:u}=n,[l,a]=_e(yt,function(e){return{activeIndex:ht(e,"activeIndex"),selectedItems:ht(e,"selectedItems")}}(n),n),{activeIndex:d,selectedItems:c}=l,h=t.useRef(!0),p=t.useRef(null),g=t.useRef(c),m=t.useRef();m.current=[];const f=Be({state:l,props:n});t.useEffect((()=>{if(!h.current){if(c.length<g.current.length){const e=g.current.find((e=>c.indexOf(e)<0));Ee(i({itemToString:o,resultCount:c.length,removedSelectedItem:e,activeIndex:d,activeSelectedItem:c[d]}),r.document)}g.current=c}}),[c.length]),t.useEffect((()=>{h.current||(-1===d&&p.current?p.current.focus():m.current[d]&&m.current[d].focus())}),[d]),Qe({isInitialMount:h.current,props:n,state:l});const I=Xe();t.useEffect((()=>(h.current=!1,()=>{h.current=!0})),[]);const y=t.useMemo((()=>({[u](){a({type:4})},[s](){a({type:3})},Delete(){a({type:1})},Backspace(){a({type:2})}})),[a,s,u]),v=t.useMemo((()=>({[u](e){gt(e)&&a({type:5})},Backspace(e){gt(e)&&a({type:6})}})),[a,u]);return{getSelectedItemProps:t.useCallback((function(e){let{refKey:t="ref",ref:n,onClick:i,onKeyDown:o,selectedItem:r,index:s,...u}=void 0===e?{}:e;const{state:l}=f.current;if(Ae(s,r,l.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return{[t]:me(n,(e=>{e&&m.current.push(e)})),tabIndex:s===l.activeIndex?0:-1,onClick:ge(i,(()=>{a({type:0,index:s})})),onKeyDown:ge(o,(e=>{const t=Se(e);t&&y[t]&&y[t](e)})),...u}}),[a,f,y]),getDropdownProps:t.useCallback((function(e,t){let{refKey:n="ref",ref:i,onKeyDown:o,onClick:r,preventKeyAction:s=!1,...u}=void 0===e?{}:e,{suppressRefError:l=!1}=void 0===t?{}:t;return I("getDropdownProps",l,n,p),{[n]:me(i,(e=>{e&&(p.current=e)})),...!s&&{onKeyDown:ge(o,(e=>{const t=Se(e);t&&v[t]&&v[t](e)})),onClick:ge(r,(()=>{a({type:7})}))},...u}}),[a,v,I]),addSelectedItem:t.useCallback((e=>{a({type:8,selectedItem:e})}),[a]),removeSelectedItem:t.useCallback((e=>{a({type:9,selectedItem:e})}),[a]),setSelectedItems:t.useCallback((e=>{a({type:10,selectedItems:e})}),[a]),setActiveIndex:t.useCallback((e=>{a({type:11,activeIndex:e})}),[a]),reset:t.useCallback((()=>{a({type:12})}),[a]),selectedItems:c,activeIndex:d}}vt.stateChangeTypes=It,e.default=Re,e.resetIdCounter=function(){le=0},e.useCombobox=dt,e.useMultipleSelection=vt,e.useSelect=rt,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=downshift.umd.min.js.map |
{ | ||
"name": "downshift", | ||
"version": "7.0.5", | ||
"version": "7.1.0", | ||
"description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.", | ||
@@ -5,0 +5,0 @@ "main": "dist/downshift.cjs.js", |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","preact","prop-types"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Downshift={},e.preact,e.PropTypes)}(this,(function(e,t,n){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(n),s={},r=60103,l=60106,u=60107,d=60108,a=60114,c=60109,h=60110,p=60112,g=60113,m=60120,f=60115,I=60116,y=60121,v=60122,x=60117,b=60129,w=60131;if("function"==typeof Symbol&&Symbol.for){var S=Symbol.for;r=S("react.element"),l=S("react.portal"),u=S("react.fragment"),d=S("react.strict_mode"),a=S("react.profiler"),c=S("react.provider"),h=S("react.context"),p=S("react.forward_ref"),g=S("react.suspense"),m=S("react.suspense_list"),f=S("react.memo"),I=S("react.lazy"),y=S("react.block"),v=S("react.server.block"),x=S("react.fundamental"),b=S("react.debug_trace_mode"),w=S("react.legacy_hidden")}function k(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case a:case d:case g:case m:return e;default:switch(e=e&&e.$$typeof){case h:case p:case I:case f:case c:return e;default:return t}}case l:return t}}}var C=c,O=r,M=p,E=u,D=I,P=f,R=l,T=a,H=d,K=g;function F(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function V(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function N(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return V(n.overflowY,t)||V(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function A(e,t,n,i,o,s,r,l){return s<e&&r>t||s>e&&r<t?0:s<=e&&l<=n||r>=t&&l>=n?s-e-i:r>t&&l<n||s<e&&l>n?r-t+o:0}s.ContextConsumer=h,s.ContextProvider=C,s.Element=O,s.ForwardRef=M,s.Fragment=E,s.Lazy=D,s.Memo=P,s.Portal=R,s.Profiler=T,s.StrictMode=H,s.Suspense=K,s.isAsyncMode=function(){return!1},s.isConcurrentMode=function(){return!1},s.isContextConsumer=function(e){return k(e)===h},s.isContextProvider=function(e){return k(e)===c},s.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},s.isForwardRef=function(e){return k(e)===p},s.isFragment=function(e){return k(e)===u},s.isLazy=function(e){return k(e)===I},s.isMemo=function(e){return k(e)===f},s.isPortal=function(e){return k(e)===l},s.isProfiler=function(e){return k(e)===a},s.isStrictMode=function(e){return k(e)===d},s.isSuspense=function(e){return k(e)===g},s.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===u||e===a||e===b||e===d||e===g||e===m||e===w||"object"==typeof e&&null!==e&&(e.$$typeof===I||e.$$typeof===f||e.$$typeof===c||e.$$typeof===h||e.$$typeof===p||e.$$typeof===x||e.$$typeof===y||e[0]===v)},s.typeOf=k;let B=0;function L(e){return"function"==typeof e?e:$}function $(){}function _(e,t){if(!e)return;const n=function(e,t){var n=window,i=t.scrollMode,o=t.block,s=t.inline,r=t.boundary,l=t.skipOverflowHiddenElements,u="function"==typeof r?r:function(e){return e!==r};if(!F(e))throw new TypeError("Invalid target");for(var d,a,c=document.scrollingElement||document.documentElement,h=[],p=e;F(p)&&u(p);){if((p=null==(a=(d=p).parentElement)?d.getRootNode().host||null:a)===c){h.push(p);break}null!=p&&p===document.body&&N(p)&&!N(document.documentElement)||null!=p&&N(p,l)&&h.push(p)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,m=n.visualViewport?n.visualViewport.height:innerHeight,f=window.scrollX||pageXOffset,I=window.scrollY||pageYOffset,y=e.getBoundingClientRect(),v=y.height,x=y.width,b=y.top,w=y.right,S=y.bottom,k=y.left,C="start"===o||"nearest"===o?b:"end"===o?S:b+v/2,O="center"===s?k+x/2:"end"===s?w:k,M=[],E=0;E<h.length;E++){var D=h[E],P=D.getBoundingClientRect(),R=P.height,T=P.width,H=P.top,K=P.right,V=P.bottom,B=P.left;if("if-needed"===i&&b>=0&&k>=0&&S<=m&&w<=g&&b>=H&&S<=V&&k>=B&&w<=K)return M;var L=getComputedStyle(D),$=parseInt(L.borderLeftWidth,10),_=parseInt(L.borderTopWidth,10),U=parseInt(L.borderRightWidth,10),j=parseInt(L.borderBottomWidth,10),W=0,z=0,q="offsetWidth"in D?D.offsetWidth-D.clientWidth-$-U:0,X="offsetHeight"in D?D.offsetHeight-D.clientHeight-_-j:0,Y="offsetWidth"in D?0===D.offsetWidth?0:T/D.offsetWidth:0,G="offsetHeight"in D?0===D.offsetHeight?0:R/D.offsetHeight:0;if(c===D)W="start"===o?C:"end"===o?C-m:"nearest"===o?A(I,I+m,m,_,j,I+C,I+C+v,v):C-m/2,z="start"===s?O:"center"===s?O-g/2:"end"===s?O-g:A(f,f+g,g,$,U,f+O,f+O+x,x),W=Math.max(0,W+I),z=Math.max(0,z+f);else{W="start"===o?C-H-_:"end"===o?C-V+j+X:"nearest"===o?A(H,V,R,_,j+X,C,C+v,v):C-(H+R/2)+X/2,z="start"===s?O-B-$:"center"===s?O-(B+T/2)+q/2:"end"===s?O-K+U+q:A(B,K,T,$,U+q,O,O+x,x);var J=D.scrollLeft,Q=D.scrollTop;C+=Q-(W=Math.max(0,Math.min(Q+W/G,D.scrollHeight-R/G+X))),O+=J-(z=Math.max(0,Math.min(J+z/Y,D.scrollWidth-T/Y+q)))}M.push({el:D,top:W,left:z})}return M}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((e=>{let{el:t,top:n,left:i}=e;t.scrollTop=n,t.scrollLeft=i}))}function U(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function j(e,t){let n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,s=new Array(o),r=0;r<o;r++)s[r]=arguments[r];i(),n=setTimeout((()=>{n=null,e(...s)}),t)}return o.cancel=i,o}function W(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.some((t=>(t&&t(e,...i),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault)))}}function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>{t.forEach((t=>{"function"==typeof t?t(e):t&&(t.current=e)}))}}function q(){return String(B++)}function X(e){let{isOpen:t,resultCount:n,previousResultCount:i}=e;return t?n?n!==i?`${n} result${1===n?" is":"s are"} available, use up and down arrow keys to navigate. Press Enter key to select.`:"":"No results are available.":""}function Y(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}const G=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function J(e){void 0===e&&(e={});const t={};return G.forEach((n=>{e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function Q(e,t){return Object.keys(e).reduce(((n,i)=>(n[i]=Z(t,i)?t[i]:e[i],n)),{})}function Z(e,t){return void 0!==e[t]}function ee(e){const{key:t,keyCode:n}=e;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?`Arrow${t}`:t}function te(e,t,n,i,o){if(void 0===o&&(o=!0),0===n)return-1;const s=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:s+1);let r=t+e;r<0?r=o?s:0:r>s&&(r=o?0:s);const l=ne(e,r,n,i,o);return-1===l?t>=n?-1:t:l}function ne(e,t,n,i,o){const s=i(t);if(!s||!s.hasAttribute("disabled"))return t;if(e>0){for(let e=t+1;e<n;e++)if(!i(e).hasAttribute("disabled"))return e}else for(let e=t-1;e>=0;e--)if(!i(e).hasAttribute("disabled"))return e;return o?e>0?ne(1,0,n,i,!1):ne(-1,n-1,n,i,!1):-1}function ie(e,t,n,i){return void 0===i&&(i=!0),t.some((t=>t&&(U(t,e,n)||i&&U(t,n.document.activeElement,n))))}const oe=j((e=>{re(e).textContent=""}),500);function se(e,t){const n=re(t);e&&(n.textContent=e,oe(t))}function re(e){void 0===e&&(e=document);let t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var le=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16});const ue=(()=>{class e extends t.Component{constructor(e){var t;super(e),t=this,this.id=this.props.id||`downshift-${q()}`,this.menuId=this.props.menuId||`${this.id}-menu`,this.labelId=this.props.labelId||`${this.id}-label`,this.inputId=this.props.inputId||`${this.id}-input`,this.getItemId=this.props.getItemId||(e=>`${this.id}-item-${e}`),this.input=null,this.items=[],this.itemCount=null,this.previousResultCount=0,this.timeoutIds=[],this.internalSetTimeout=(e,t)=>{const n=setTimeout((()=>{this.timeoutIds=this.timeoutIds.filter((e=>e!==n)),e()}),t);this.timeoutIds.push(n)},this.setItemCount=e=>{this.itemCount=e},this.unsetItemCount=()=>{this.itemCount=null},this.setHighlightedIndex=function(e,n){void 0===e&&(e=t.props.defaultHighlightedIndex),void 0===n&&(n={}),n=J(n),t.internalSetState({highlightedIndex:e,...n})},this.clearSelection=e=>{this.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:this.props.defaultHighlightedIndex,isOpen:this.props.defaultIsOpen},e)},this.selectItem=(e,t,n)=>{t=J(t),this.internalSetState({isOpen:this.props.defaultIsOpen,highlightedIndex:this.props.defaultHighlightedIndex,selectedItem:e,inputValue:this.props.itemToString(e),...t},n)},this.selectItemAtIndex=(e,t,n)=>{const i=this.items[e];null!=i&&this.selectItem(i,t,n)},this.selectHighlightedItem=(e,t)=>this.selectItemAtIndex(this.getState().highlightedIndex,e,t),this.internalSetState=(e,t)=>{let n,i;const o={},s="function"==typeof e;return!s&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,{...this.getStateAndHelpers(),...e}),this.setState((t=>{t=this.getState(t);let r=s?e(t):e;r=this.props.stateReducer(t,r),n=r.hasOwnProperty("selectedItem");const l={};return n&&r.selectedItem!==t.selectedItem&&(i=r.selectedItem),r.type=r.type||0,Object.keys(r).forEach((e=>{t[e]!==r[e]&&(o[e]=r[e]),"type"!==e&&(r[e],Z(this.props,e)||(l[e]=r[e]))})),s&&r.hasOwnProperty("inputValue")&&this.props.onInputValueChange(r.inputValue,{...this.getStateAndHelpers(),...r}),l}),(()=>{L(t)();Object.keys(o).length>1&&this.props.onStateChange(o,this.getStateAndHelpers()),n&&this.props.onSelect(e.selectedItem,this.getStateAndHelpers()),void 0!==i&&this.props.onChange(i,this.getStateAndHelpers()),this.props.onUserAction(o,this.getStateAndHelpers())}))},this.rootRef=e=>this._rootNode=e,this.getRootProps=function(e,n){let{refKey:i="ref",ref:o,...s}=void 0===e?{}:e,{suppressRefError:r=!1}=void 0===n?{}:n;t.getRootProps.called=!0,t.getRootProps.refKey=i,t.getRootProps.suppressRefError=r;const{isOpen:l}=t.getState();return{[i]:z(o,t.rootRef),role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-owns":l?t.menuId:null,"aria-labelledby":t.labelId,...s}},this.keyDownHandlers={ArrowDown(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:4})}else this.internalSetState({isOpen:!0,type:4},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=te(1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:4})}}))},ArrowUp(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:3})}else this.internalSetState({isOpen:!0,type:3},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=te(-1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:3})}}))},Enter(e){if(229===e.which)return;const{isOpen:t,highlightedIndex:n}=this.getState();if(t&&null!=n){e.preventDefault();const t=this.items[n],i=this.getItemNodeFromIndex(n);if(null==t||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}},Escape(e){e.preventDefault(),this.reset({type:5,...!this.state.isOpen&&{selectedItem:null,inputValue:""}})}},this.buttonKeyDownHandlers={...this.keyDownHandlers," "(e){e.preventDefault(),this.toggleMenu({type:12})}},this.inputKeyDownHandlers={...this.keyDownHandlers,Home(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ne(1,0,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:7})},End(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ne(-1,n-1,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:8})}},this.getToggleButtonProps=function(e){let{onClick:n,onPress:i,onKeyDown:o,onKeyUp:s,onBlur:r,...l}=void 0===e?{}:e;const{isOpen:u}=t.getState(),d={onClick:W(n,t.buttonHandleClick),onKeyDown:W(o,t.buttonHandleKeyDown),onKeyUp:W(s,t.buttonHandleKeyUp),onBlur:W(r,t.buttonHandleBlur)};return{type:"button",role:"button","aria-label":u?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0,...l.disabled?{}:d,...l}},this.buttonHandleKeyUp=e=>{e.preventDefault()},this.buttonHandleKeyDown=e=>{const t=ee(e);this.buttonKeyDownHandlers[t]&&this.buttonKeyDownHandlers[t].call(this,e)},this.buttonHandleClick=e=>{e.preventDefault(),this.props.environment.document.activeElement===this.props.environment.document.body&&e.target.focus(),this.internalSetTimeout((()=>this.toggleMenu({type:13})))},this.buttonHandleBlur=e=>{const t=e.target;this.internalSetTimeout((()=>{this.isMouseDown||null!=this.props.environment.document.activeElement&&this.props.environment.document.activeElement.id===this.inputId||this.props.environment.document.activeElement===t||this.reset({type:14})}))},this.getLabelProps=e=>({htmlFor:this.inputId,id:this.labelId,...e}),this.getInputProps=function(e){let n,{onKeyDown:i,onBlur:o,onChange:s,onInput:r,onChangeText:l,...u}=void 0===e?{}:e,d={};n="onInput";const{inputValue:a,isOpen:c,highlightedIndex:h}=t.getState();return u.disabled||(d={onInput:W(s,r,t.inputHandleChange),onKeyDown:W(i,t.inputHandleKeyDown),onBlur:W(o,t.inputHandleBlur)}),{"aria-autocomplete":"list","aria-activedescendant":c&&"number"==typeof h&&h>=0?t.getItemId(h):null,"aria-controls":c?t.menuId:null,"aria-labelledby":t.labelId,autoComplete:"off",value:a,id:t.inputId,...d,...u}},this.inputHandleKeyDown=e=>{const t=ee(e);t&&this.inputKeyDownHandlers[t]&&this.inputKeyDownHandlers[t].call(this,e)},this.inputHandleChange=e=>{this.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:this.props.defaultHighlightedIndex})},this.inputHandleBlur=()=>{this.internalSetTimeout((()=>{const e=this.props.environment.document&&!!this.props.environment.document.activeElement&&!!this.props.environment.document.activeElement.dataset&&this.props.environment.document.activeElement.dataset.toggle&&this._rootNode&&this._rootNode.contains(this.props.environment.document.activeElement);this.isMouseDown||e||this.reset({type:10})}))},this.menuRef=e=>{this._menuNode=e},this.getMenuProps=function(e,n){let{refKey:i="ref",ref:o,...s}=void 0===e?{}:e,{suppressRefError:r=!1}=void 0===n?{}:n;return t.getMenuProps.called=!0,t.getMenuProps.refKey=i,t.getMenuProps.suppressRefError=r,{[i]:z(o,t.menuRef),role:"listbox","aria-labelledby":s&&s["aria-label"]?null:t.labelId,id:t.menuId,...s}},this.getItemProps=function(e){let{onMouseMove:n,onMouseDown:i,onClick:o,onPress:s,index:r,item:l,...u}=void 0===e?{}:e;void 0===r?(t.items.push(l),r=t.items.indexOf(l)):t.items[r]=l;const d=o,a={onMouseMove:W(n,(()=>{r!==t.getState().highlightedIndex&&(t.setHighlightedIndex(r,{type:2}),t.avoidScrolling=!0,t.internalSetTimeout((()=>t.avoidScrolling=!1),250))})),onMouseDown:W(i,(e=>{e.preventDefault()})),onClick:W(d,(()=>{t.selectItemAtIndex(r,{type:9})}))},c=u.disabled?{onMouseDown:a.onMouseDown}:a;return{id:t.getItemId(r),role:"option","aria-selected":t.getState().highlightedIndex===r,...c,...u}},this.clearItems=()=>{this.items=[]},this.reset=function(e,n){void 0===e&&(e={}),e=J(e),t.internalSetState((n=>{let{selectedItem:i}=n;return{isOpen:t.props.defaultIsOpen,highlightedIndex:t.props.defaultHighlightedIndex,inputValue:t.props.itemToString(i),...e}}),n)},this.toggleMenu=function(e,n){void 0===e&&(e={}),e=J(e),t.internalSetState((n=>{let{isOpen:i}=n;return{isOpen:!i,...i&&{highlightedIndex:t.props.defaultHighlightedIndex},...e}}),(()=>{const{isOpen:i,highlightedIndex:o}=t.getState();i&&t.getItemCount()>0&&"number"==typeof o&&t.setHighlightedIndex(o,e),L(n)()}))},this.openMenu=e=>{this.internalSetState({isOpen:!0},e)},this.closeMenu=e=>{this.internalSetState({isOpen:!1},e)},this.updateStatus=j((()=>{const e=this.getState(),t=this.items[e.highlightedIndex],n=this.getItemCount(),i=this.props.getA11yStatusMessage({itemToString:this.props.itemToString,previousResultCount:this.previousResultCount,resultCount:n,highlightedItem:t,...e});this.previousResultCount=n,se(i,this.props.environment.document)}),200);const{defaultHighlightedIndex:n,initialHighlightedIndex:i=n,defaultIsOpen:o,initialIsOpen:s=o,initialInputValue:r="",initialSelectedItem:l=null}=this.props,u=this.getState({highlightedIndex:i,isOpen:s,inputValue:r,selectedItem:l});null!=u.selectedItem&&void 0===this.props.initialInputValue&&(u.inputValue=this.props.itemToString(u.selectedItem)),this.state=u}internalClearTimeouts(){this.timeoutIds.forEach((e=>{clearTimeout(e)})),this.timeoutIds=[]}getState(e){return void 0===e&&(e=this.state),Q(e,this.props)}getItemCount(){let e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e}getItemNodeFromIndex(e){return this.props.environment.document.getElementById(this.getItemId(e))}scrollHighlightedItemIntoView(){{const e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)}}moveHighlightedIndex(e,t){const n=this.getItemCount(),{highlightedIndex:i}=this.getState();if(n>0){const o=te(e,i,n,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(o,t)}}getStateAndHelpers(){const{highlightedIndex:e,inputValue:t,selectedItem:n,isOpen:i}=this.getState(),{itemToString:o}=this.props,{id:s}=this,{getRootProps:r,getToggleButtonProps:l,getLabelProps:u,getMenuProps:d,getInputProps:a,getItemProps:c,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,reset:b,setItemCount:w,unsetItemCount:S,internalSetState:k}=this;return{getRootProps:r,getToggleButtonProps:l,getLabelProps:u,getMenuProps:d,getInputProps:a,getItemProps:c,reset:b,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,setItemCount:w,unsetItemCount:S,setState:k,itemToString:o,id:s,highlightedIndex:e,inputValue:t,isOpen:i,selectedItem:n}}componentDidMount(){{const e=()=>{this.isMouseDown=!0},t=e=>{this.isMouseDown=!1;!ie(e.target,[this._rootNode,this._menuNode],this.props.environment)&&this.getState().isOpen&&this.reset({type:1},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},n=()=>{this.isTouchMove=!1},i=()=>{this.isTouchMove=!0},o=e=>{const t=ie(e.target,[this._rootNode,this._menuNode],this.props.environment,!1);this.isTouchMove||t||!this.getState().isOpen||this.reset({type:16},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},{environment:s}=this.props;s.addEventListener("mousedown",e),s.addEventListener("mouseup",t),s.addEventListener("touchstart",n),s.addEventListener("touchmove",i),s.addEventListener("touchend",o),this.cleanup=()=>{this.internalClearTimeouts(),this.updateStatus.cancel(),s.removeEventListener("mousedown",e),s.removeEventListener("mouseup",t),s.removeEventListener("touchstart",n),s.removeEventListener("touchmove",i),s.removeEventListener("touchend",o)}}}shouldScroll(e,t){const{highlightedIndex:n}=void 0===this.props.highlightedIndex?this.getState():this.props,{highlightedIndex:i}=void 0===t.highlightedIndex?e:t;return n&&this.getState().isOpen&&!e.isOpen||n!==i}componentDidUpdate(e,t){Z(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()}componentWillUnmount(){this.cleanup()}render(){const e=Y(this.props.children,$);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;const n=Y(e(this.getStateAndHelpers()));return n?this.getRootProps.called||this.props.suppressRefError?n:function(e){return"string"==typeof e.type||"string"==typeof e.nodeName}(n)?t.cloneElement(n,this.getRootProps(function(e){return e.props||e.attributes}(n))):void 0:null}}return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:X,itemToString:e=>null==e?"":String(e),onStateChange:$,onInputValueChange:$,onUserAction:$,onChange:$,onSelect:$,onOuterClick:$,selectedItemChanged:(e,t)=>e!==t,environment:"undefined"==typeof window?{}:window,stateReducer:(e,t)=>t,suppressRefError:!1,scrollIntoView:_},e.stateChangeTypes=le,e})();var de=ue;const ae={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function ce(e,t,n){const{props:i,type:o}=e,s={};Object.keys(t).forEach((i=>{!function(e,t,n,i){const{props:o,type:s}=t,r=`on${fe(e)}Change`;o[r]&&void 0!==i[e]&&i[e]!==n[e]&&o[r]({type:s,...i})}(i,e,t,n),n[i]!==t[i]&&(s[i]=n[i])})),i.onStateChange&&Object.keys(s).length&&i.onStateChange({type:o,...s})}const he=j(((e,t)=>{se(e(),t)}),200),pe="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function ge(e){let{id:n=`downshift-${q()}`,labelId:i,menuId:o,getItemId:s,toggleButtonId:r,inputId:l}=e;return t.useRef({labelId:i||`${n}-label`,menuId:o||`${n}-menu`,getItemId:s||(e=>`${n}-item-${e}`),toggleButtonId:r||`${n}-toggle-button`,inputId:l||`${n}-input`}).current}function me(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function fe(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Ie(e){const n=t.useRef(e);return n.current=e,n}function ye(e,n,i){const o=t.useRef(),s=t.useRef(),r=t.useCallback(((t,n)=>{s.current=n,t=Q(t,n.props);const i=e(t,n);return n.props.stateReducer(t,{...n,changes:i})}),[e]),[l,u]=t.useReducer(r,n),d=Ie(i),a=t.useCallback((e=>u({props:d.current,...e})),[d]),c=s.current;return t.useEffect((()=>{c&&o.current&&o.current!==l&&ce(c,Q(o.current,c.props),l),o.current=l}),[l,i,c]),[l,a]}function ve(e,t,n){const[i,o]=ye(e,t,n);return[Q(i,n),o]}const xe={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){const{selectedItem:t,itemToString:n}=e;return t?`${n(t)} has been selected.`:""},scrollIntoView:_,environment:"undefined"==typeof window?{}:window};function be(e,t,n){void 0===n&&(n=ae);const i=e[`default${fe(t)}`];return void 0!==i?i:n[t]}function we(e,t,n){void 0===n&&(n=ae);const i=e[t];if(void 0!==i)return i;const o=e[`initial${fe(t)}`];return void 0!==o?o:be(e,t,n)}function Se(e){const t=we(e,"selectedItem"),n=we(e,"isOpen"),i=we(e,"highlightedIndex"),o=we(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function ke(e,t,n){const{items:i,initialHighlightedIndex:o,defaultHighlightedIndex:s}=e,{selectedItem:r,highlightedIndex:l}=t;return 0===i.length?-1:void 0!==o&&l===o?o:void 0!==s?s:r?i.indexOf(r):0===n?-1:n<0?i.length-1:0}function Ce(e,n,i,o){const s=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((()=>{const t=()=>{s.current.isMouseDown=!0},r=t=>{s.current.isMouseDown=!1,e&&!ie(t.target,n.map((e=>e.current)),i)&&o()},l=()=>{s.current.isTouchMove=!1},u=()=>{s.current.isTouchMove=!0},d=t=>{!e||s.current.isTouchMove||ie(t.target,n.map((e=>e.current)),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",r),i.addEventListener("touchstart",l),i.addEventListener("touchmove",u),i.addEventListener("touchend",d),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",r),i.removeEventListener("touchstart",l),i.removeEventListener("touchmove",u),i.removeEventListener("touchend",d)}}),[e,i]),s}let Oe=()=>$;function Me(e,n,i){let{isInitialMount:o,highlightedIndex:s,items:r,environment:l,...u}=i;t.useEffect((()=>{o||he((()=>e({highlightedIndex:s,highlightedItem:r[s],resultCount:r.length,...u})),l.document)}),n)}function Ee(e){let{highlightedIndex:n,isOpen:i,itemRefs:o,getItemNodeFromIndex:s,menuElement:r,scrollIntoView:l}=e;const u=t.useRef(!0);return pe((()=>{n<0||!i||!Object.keys(o.current).length||(!1===u.current?u.current=!0:l(s(n),r))}),[n]),u}let De=$;function Pe(e,t,n){const{type:i,props:o}=t;let s;switch(i){case n.ItemMouseMove:s={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:s={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ke(o,e,0)};break;case n.FunctionOpenMenu:s={isOpen:!0,highlightedIndex:ke(o,e,0)};break;case n.FunctionCloseMenu:s={isOpen:!1};break;case n.FunctionSetHighlightedIndex:s={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:s={inputValue:t.inputValue};break;case n.FunctionReset:s={highlightedIndex:be(o,"highlightedIndex"),isOpen:be(o,"isOpen"),selectedItem:be(o,"selectedItem"),inputValue:be(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...s}}var Re=function(){return Re=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Re.apply(this,arguments)};o.default.array.isRequired,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.bool,o.default.bool,o.default.bool,o.default.any,o.default.any,o.default.any,o.default.string,o.default.string,o.default.string,o.default.func,o.default.string,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});var Te=Re(Re({},xe),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?"".concat(n," result").concat(1===n?" is":"s are"," available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select."):"":"No results are available.":""}}),He=$;var Ke=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:1,ToggleButtonKeyDownArrowUp:2,ToggleButtonKeyDownCharacter:3,ToggleButtonKeyDownEscape:4,ToggleButtonKeyDownHome:5,ToggleButtonKeyDownEnd:6,ToggleButtonKeyDownEnter:7,ToggleButtonKeyDownSpaceButton:8,ToggleButtonKeyDownPageUp:9,ToggleButtonKeyDownPageDown:10,ToggleButtonBlur:11,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21});function Fe(e,t){const{type:n,props:i,altKey:o}=t;let s;switch(n){case 14:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),selectedItem:i.items[t.index]};break;case 3:{const n=t.key,o=`${e.inputValue}${n}`,r=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,s=e.getItemNodeFromIndex,r=t.toLowerCase(),l=0;l<i.length;l++){var u=(l+n+1)%i.length,d=i[u];if(void 0!==d&&o(d).toLowerCase().startsWith(r)){var a=s(u);if(!(null==a?void 0:a.hasAttribute("disabled")))return u}}return n}({keysSoFar:o,highlightedIndex:!e.isOpen&&e.selectedItem?i.items.indexOf(e.selectedItem):e.highlightedIndex,items:i.items,itemToString:i.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});s={inputValue:o,highlightedIndex:r,isOpen:!0}}break;case 1:s={highlightedIndex:e.isOpen?te(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):o&&null==e.selectedItem?-1:ke(i,e,1),isOpen:!0};break;case 2:if(e.isOpen&&o)s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};else{s={highlightedIndex:e.isOpen?te(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):ke(i,e,-1),isOpen:!0}}break;case 7:case 8:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 5:s={highlightedIndex:ne(1,0,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:s={highlightedIndex:ne(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:s={highlightedIndex:te(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 10:s={highlightedIndex:te(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:s={isOpen:!1,highlightedIndex:-1};break;case 11:s={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 19:s={selectedItem:t.selectedItem};break;default:return Pe(e,t,Ke)}return{...e,...s}}function Ve(e){void 0===e&&(e={}),He();const n={...Te,...e},{items:i,scrollIntoView:o,environment:s,itemToString:r,getA11ySelectionMessage:l,getA11yStatusMessage:u}=n,d=Se(n),[a,c]=ve(Fe,d,n),{isOpen:h,highlightedIndex:p,selectedItem:g,inputValue:m}=a,f=t.useRef(null),I=t.useRef(null),y=t.useRef({}),v=t.useRef(null),x=ge(n),b=t.useRef(),w=t.useRef(!0),S=Ie({state:a,props:n}),k=t.useCallback((e=>y.current[x.getItemId(e)]),[x]);Me(u,[h,p,m,i],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:s,itemToString:r,...a}),Me(l,[g],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:s,itemToString:r,...a});const C=Ee({menuElement:I.current,highlightedIndex:p,isOpen:h,itemRefs:y,scrollIntoView:o,getItemNodeFromIndex:k});t.useEffect((()=>(v.current=j((e=>{e({type:20,inputValue:""})}),500),()=>{v.current.cancel()})),[]),t.useEffect((()=>{m&&v.current(c)}),[c,m]),De({isInitialMount:w.current,props:n,state:a}),t.useEffect((()=>{w.current||(b.current=i.length)}));const O=Ce(h,[I,f],s,(()=>{c({type:11})})),M=Oe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{h||(y.current={})}),[h]);const E=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),c({type:1,getItemNodeFromIndex:k,altKey:e.altKey})},ArrowUp(e){e.preventDefault(),c({type:2,getItemNodeFromIndex:k,altKey:e.altKey})},Home(e){e.preventDefault(),c({type:5,getItemNodeFromIndex:k})},End(e){e.preventDefault(),c({type:6,getItemNodeFromIndex:k})},Escape(){S.current.state.isOpen&&c({type:4})},Enter(e){e.preventDefault(),c({type:S.current.state.isOpen?7:0})},PageUp(e){S.current.state.isOpen&&(e.preventDefault(),c({type:9,getItemNodeFromIndex:k}))},PageDown(e){S.current.state.isOpen&&(e.preventDefault(),c({type:10,getItemNodeFromIndex:k}))}," "(e){e.preventDefault(),c({type:S.current.state.isOpen?8:0})}})),[c,k,S]),D=t.useCallback((()=>{c({type:15})}),[c]),P=t.useCallback((()=>{c({type:17})}),[c]),R=t.useCallback((()=>{c({type:16})}),[c]),T=t.useCallback((e=>{c({type:18,highlightedIndex:e})}),[c]),H=t.useCallback((e=>{c({type:19,selectedItem:e})}),[c]),K=t.useCallback((()=>{c({type:21})}),[c]),F=t.useCallback((e=>{c({type:20,inputValue:e})}),[c]),V=t.useCallback((e=>({id:x.labelId,htmlFor:x.toggleButtonId,...e})),[x]),N=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",onKeyDown:o,onBlur:s,ref:r,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;return M("getMenuProps",u,i,I),{[i]:z(r,(e=>{I.current=e})),id:x.menuId,role:"listbox","aria-labelledby":x.labelId,tabIndex:-1,onMouseLeave:W(n,(()=>{c({type:12})})),...l}}),[c,M,x]);return{getToggleButtonProps:t.useCallback((function(e,t){let{onBlur:n,onClick:i,onKeyDown:o,refKey:s="ref",ref:r,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;const d=S.current.state,a=()=>{c({type:0})},h=e=>{const t=ee(e);t&&E[t]?E[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&c({type:3,key:t,getItemNodeFromIndex:k})},p={[s]:z(r,(e=>{f.current=e})),"aria-activedescendant":d.isOpen&&d.highlightedIndex>-1?x.getItemId(d.highlightedIndex):"","aria-controls":x.menuId,"aria-expanded":S.current.state.isOpen,"aria-haspopup":"listbox","aria-labelledby":`${x.labelId}`,id:x.toggleButtonId,role:"combobox",tabIndex:0,onBlur:W(n,(()=>{d.isOpen&&!O.current.isMouseDown&&c({type:11})})),...l};return l.disabled||(p.onClick=W(i,a),p.onKeyDown=W(o,h)),M("getToggleButtonProps",u,s,f),p}),[S,x,M,c,O,E,k]),getLabelProps:V,getMenuProps:N,getItemProps:t.useCallback((function(e){let{item:t,index:n,onMouseMove:o,onClick:s,refKey:r="ref",ref:l,disabled:u,...d}=void 0===e?{}:e;const{state:a,props:h}=S.current,p=t??i[n],m=me(n,p,h.items),f=()=>{c({type:14,index:m})},I=me(m,p,h.items);if(I<0)throw new Error("Pass either item or item index in getItemProps!");const v={disabled:u,role:"option","aria-selected":`${p===g}`,id:x.getItemId(I),[r]:z(l,(e=>{e&&(y.current[x.getItemId(I)]=e)})),...d};return u||(v.onClick=W(s,f)),v.onMouseMove=W(o,(()=>{m!==a.highlightedIndex&&(C.current=!1,c({type:13,index:m,disabled:u}))})),v}),[S,i,g,x,C,c]),toggleMenu:D,openMenu:R,closeMenu:P,setHighlightedIndex:T,selectItem:H,reset:K,setInputValue:F,highlightedIndex:p,isOpen:h,selectedItem:g,inputValue:m}}Ve.stateChangeTypes=Ke;var Ne=Object.freeze({__proto__:null,InputKeyDownArrowDown:0,InputKeyDownArrowUp:1,InputKeyDownEscape:2,InputKeyDownHome:3,InputKeyDownEnd:4,InputKeyDownPageUp:5,InputKeyDownPageDown:6,InputKeyDownEnter:7,InputChange:8,InputBlur:9,InputFocus:10,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:13,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:22});o.default.array.isRequired,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.bool,o.default.bool,o.default.bool,o.default.any,o.default.any,o.default.any,o.default.string,o.default.string,o.default.string,o.default.string,o.default.string,o.default.string,o.default.func,o.default.string,o.default.string,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});let Ae=$;const Be={...xe,getA11yStatusMessage:X};function Le(e,t){const{type:n,props:i,altKey:o}=t;let s;switch(n){case 13:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case 0:s=e.isOpen?{highlightedIndex:te(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:o&&null==e.selectedItem?-1:ke(i,e,1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 1:s=e.isOpen?o?{isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}}:{highlightedIndex:te(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:ke(i,e,-1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 7:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 2:s={isOpen:!1,highlightedIndex:-1,...!e.isOpen&&{selectedItem:null,inputValue:""}};break;case 5:s={highlightedIndex:te(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 6:s={highlightedIndex:te(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 3:s={highlightedIndex:ne(1,0,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:s={highlightedIndex:ne(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1)};break;case 9:s={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 8:s={isOpen:!0,highlightedIndex:be(i,"highlightedIndex"),inputValue:t.inputValue};break;case 10:s={isOpen:!0,highlightedIndex:ke(i,e,0)};break;case 19:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case 22:s={inputValue:t.inputValue};break;default:return Pe(e,t,Ne)}return{...e,...s}}function $e(e){void 0===e&&(e={}),Ae();const n={...Be,...e},{initialIsOpen:i,defaultIsOpen:o,items:s,scrollIntoView:r,environment:l,getA11yStatusMessage:u,getA11ySelectionMessage:d,itemToString:a}=n,c=function(e){const t=Se(e),{selectedItem:n}=t;let{inputValue:i}=t;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),{...t,inputValue:i}}(n),[h,p]=function(e,n,i){const o=t.useRef(),[s,r]=ye(e,n,i);return t.useEffect((()=>{Z(i,"selectedItem")&&(o.current!==i.selectedItem&&r({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=s.selectedItem===o.current?i.selectedItem:s.selectedItem)})),[Q(s,i),r]}(Le,c,n),{isOpen:g,highlightedIndex:m,selectedItem:f,inputValue:I}=h,y=t.useRef(null),v=t.useRef({}),x=t.useRef(null),b=t.useRef(null),w=t.useRef(!0),S=ge(n),k=t.useRef(),C=Ie({state:h,props:n}),O=t.useCallback((e=>v.current[S.getItemId(e)]),[S]);Me(u,[g,m,I,s],{isInitialMount:w.current,previousResultCount:k.current,items:s,environment:l,itemToString:a,...h}),Me(d,[f],{isInitialMount:w.current,previousResultCount:k.current,items:s,environment:l,itemToString:a,...h});const M=Ee({menuElement:y.current,highlightedIndex:m,isOpen:g,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:O});De({isInitialMount:w.current,props:n,state:h}),t.useEffect((()=>{(i||o||g)&&x.current&&x.current.focus()}),[]),t.useEffect((()=>{w.current||(k.current=s.length)}));const E=Ce(g,[x,y,b],l,(()=>{p({type:9,selectItem:!1})})),D=Oe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{g?document.activeElement!==x.current&&x?.current?.focus():v.current={}}),[g]);const P=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),p({type:0,altKey:e.altKey,getItemNodeFromIndex:O})},ArrowUp(e){e.preventDefault(),p({type:1,altKey:e.altKey,getItemNodeFromIndex:O})},Home(e){C.current.state.isOpen&&(e.preventDefault(),p({type:3,getItemNodeFromIndex:O}))},End(e){C.current.state.isOpen&&(e.preventDefault(),p({type:4,getItemNodeFromIndex:O}))},Escape(e){const t=C.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),p({type:2}))},Enter(e){C.current.state.isOpen&&229!==e.which&&(e.preventDefault(),p({type:7,getItemNodeFromIndex:O}))},PageUp(e){C.current.state.isOpen&&(e.preventDefault(),p({type:5,getItemNodeFromIndex:O}))},PageDown(e){C.current.state.isOpen&&(e.preventDefault(),p({type:6,getItemNodeFromIndex:O}))}})),[p,C,O]),R=t.useCallback((e=>({id:S.labelId,htmlFor:S.inputId,...e})),[S]),T=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",ref:o,...s}=void 0===e?{}:e,{suppressRefError:r=!1}=void 0===t?{}:t;return D("getMenuProps",r,i,y),{[i]:z(o,(e=>{y.current=e})),id:S.menuId,role:"listbox","aria-labelledby":S.labelId,onMouseLeave:W(n,(()=>{p({type:11})})),...s}}),[p,D,S]),H=t.useCallback((function(e){let{item:t,index:n,refKey:i="ref",ref:o,onMouseMove:s,onMouseDown:r,onClick:l,onPress:u,disabled:d,...a}=void 0===e?{}:e;const{props:c,state:h}=C.current,g=me(n,t,c.items);if(g<0)throw new Error("Pass either item or item index in getItemProps!");const m=l;return{[i]:z(o,(e=>{e&&(v.current[S.getItemId(g)]=e)})),disabled:d,role:"option","aria-selected":`${g===h.highlightedIndex}`,id:S.getItemId(g),...!d&&{onClick:W(m,(()=>{p({type:13,index:n})}))},onMouseMove:W(s,(()=>{n!==h.highlightedIndex&&(M.current=!1,p({type:12,index:n,disabled:d}))})),onMouseDown:W(r,(e=>e.preventDefault())),...a}}),[p,C,M,S]),K=t.useCallback((function(e){let{onClick:t,onPress:n,refKey:i="ref",ref:o,...s}=void 0===e?{}:e;const r=C.current.state;return{[i]:z(o,(e=>{b.current=e})),"aria-controls":S.menuId,"aria-expanded":r.isOpen,id:S.toggleButtonId,tabIndex:-1,...!s.disabled&&{onClick:W(t,(()=>{p({type:14})}))},...s}}),[p,C,S]),F=t.useCallback((function(e,t){let{onKeyDown:n,onChange:i,onInput:o,onFocus:s,onBlur:r,onChangeText:l,refKey:u="ref",ref:d,...a}=void 0===e?{}:e,{suppressRefError:c=!1}=void 0===t?{}:t;D("getInputProps",c,u,x);const h=C.current.state,g=e=>{const t=ee(e);t&&P[t]&&P[t](e)},m=e=>{p({type:8,inputValue:e.target.value})},f=()=>{h.isOpen&&!E.current.isMouseDown&&p({type:9,selectItem:!0})},I=()=>{h.isOpen||p({type:10})};let y={};return a.disabled||(y={onInput:W(i,o,m),onKeyDown:W(n,g),onBlur:W(r,f),onFocus:W(s,I)}),{[u]:z(d,(e=>{x.current=e})),"aria-activedescendant":h.isOpen&&h.highlightedIndex>-1?S.getItemId(h.highlightedIndex):"","aria-autocomplete":"list","aria-controls":S.menuId,"aria-expanded":h.isOpen,"aria-labelledby":S.labelId,autoComplete:"off",id:S.inputId,role:"combobox",value:h.inputValue,...y,...a}}),[p,P,C,E,D,S]),V=t.useCallback((()=>{p({type:15})}),[p]),N=t.useCallback((()=>{p({type:17})}),[p]),A=t.useCallback((()=>{p({type:16})}),[p]),B=t.useCallback((e=>{p({type:18,highlightedIndex:e})}),[p]),L=t.useCallback((e=>{p({type:19,selectedItem:e})}),[p]);return{getItemProps:H,getLabelProps:R,getMenuProps:T,getInputProps:F,getToggleButtonProps:K,toggleMenu:V,openMenu:A,closeMenu:N,setHighlightedIndex:B,setInputValue:t.useCallback((e=>{p({type:20,inputValue:e})}),[p]),selectItem:L,reset:t.useCallback((()=>{p({type:21})}),[p]),highlightedIndex:m,isOpen:g,selectedItem:f,inputValue:I}}$e.stateChangeTypes=Ne;const _e={activeIndex:-1,selectedItems:[]};function Ue(e,t){return we(e,t,_e)}function je(e,t){return be(e,t,_e)}function We(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;const t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}o.default.array,o.default.array,o.default.array,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.func,o.default.func,o.default.string,o.default.string,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});const ze={itemToString:xe.itemToString,stateReducer:xe.stateReducer,environment:xe.environment,getA11yRemovalMessage:function(e){const{removedSelectedItem:t,itemToString:n}=e;return`${n(t)} has been removed.`},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"};let qe=$;var Xe=Object.freeze({__proto__:null,SelectedItemClick:0,SelectedItemKeyDownDelete:1,SelectedItemKeyDownBackspace:2,SelectedItemKeyDownNavigationNext:3,SelectedItemKeyDownNavigationPrevious:4,DropdownKeyDownNavigationPrevious:5,DropdownKeyDownBackspace:6,DropdownClick:7,FunctionAddSelectedItem:8,FunctionRemoveSelectedItem:9,FunctionSetSelectedItems:10,FunctionSetActiveIndex:11,FunctionReset:12});function Ye(e,t){const{type:n,index:i,props:o,selectedItem:s}=t,{activeIndex:r,selectedItems:l}=e;let u;switch(n){case 0:u={activeIndex:i};break;case 4:u={activeIndex:r-1<0?0:r-1};break;case 3:u={activeIndex:r+1>=l.length?-1:r+1};break;case 2:case 1:{let e=r;1===l.length?e=-1:r===l.length-1&&(e=l.length-2),u={selectedItems:[...l.slice(0,r),...l.slice(r+1)],activeIndex:e};break}case 5:u={activeIndex:l.length-1};break;case 6:u={selectedItems:l.slice(0,l.length-1)};break;case 8:u={selectedItems:[...l,s]};break;case 7:u={activeIndex:-1};break;case 9:{let e=r;const t=l.indexOf(s);t>=0&&(1===l.length?e=-1:t===l.length-1&&(e=l.length-2),u={selectedItems:[...l.slice(0,t),...l.slice(t+1)],activeIndex:e});break}case 10:{const{selectedItems:e}=t;u={selectedItems:e};break}case 11:{const{activeIndex:e}=t;u={activeIndex:e};break}case 12:u={activeIndex:je(o,"activeIndex"),selectedItems:je(o,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...u}}function Ge(e){void 0===e&&(e={}),qe();const n={...ze,...e},{getA11yRemovalMessage:i,itemToString:o,environment:s,keyNavigationNext:r,keyNavigationPrevious:l}=n,[u,d]=ve(Ye,function(e){return{activeIndex:Ue(e,"activeIndex"),selectedItems:Ue(e,"selectedItems")}}(n),n),{activeIndex:a,selectedItems:c}=u,h=t.useRef(!0),p=t.useRef(null),g=t.useRef(c),m=t.useRef();m.current=[];const f=Ie({state:u,props:n});t.useEffect((()=>{if(!h.current){if(c.length<g.current.length){const e=g.current.find((e=>c.indexOf(e)<0));se(i({itemToString:o,resultCount:c.length,removedSelectedItem:e,activeIndex:a,activeSelectedItem:c[a]}),s.document)}g.current=c}}),[c.length]),t.useEffect((()=>{h.current||(-1===a&&p.current?p.current.focus():m.current[a]&&m.current[a].focus())}),[a]),De({isInitialMount:h.current,props:n,state:u});const I=Oe();t.useEffect((()=>(h.current=!1,()=>{h.current=!0})),[]);const y=t.useMemo((()=>({[l](){d({type:4})},[r](){d({type:3})},Delete(){d({type:1})},Backspace(){d({type:2})}})),[d,r,l]),v=t.useMemo((()=>({[l](e){We(e)&&d({type:5})},Backspace(e){We(e)&&d({type:6})}})),[d,l]);return{getSelectedItemProps:t.useCallback((function(e){let{refKey:t="ref",ref:n,onClick:i,onKeyDown:o,selectedItem:s,index:r,...l}=void 0===e?{}:e;const{state:u}=f.current;if(me(r,s,u.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return{[t]:z(n,(e=>{e&&m.current.push(e)})),tabIndex:r===u.activeIndex?0:-1,onClick:W(i,(()=>{d({type:0,index:r})})),onKeyDown:W(o,(e=>{const t=ee(e);t&&y[t]&&y[t](e)})),...l}}),[d,f,y]),getDropdownProps:t.useCallback((function(e,t){let{refKey:n="ref",ref:i,onKeyDown:o,onClick:s,preventKeyAction:r=!1,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;return I("getDropdownProps",u,n,p),{[n]:z(i,(e=>{e&&(p.current=e)})),...!r&&{onKeyDown:W(o,(e=>{const t=ee(e);t&&v[t]&&v[t](e)})),onClick:W(s,(()=>{d({type:7})}))},...l}}),[d,v,I]),addSelectedItem:t.useCallback((e=>{d({type:8,selectedItem:e})}),[d]),removeSelectedItem:t.useCallback((e=>{d({type:9,selectedItem:e})}),[d]),setSelectedItems:t.useCallback((e=>{d({type:10,selectedItems:e})}),[d]),setActiveIndex:t.useCallback((e=>{d({type:11,activeIndex:e})}),[d]),reset:t.useCallback((()=>{d({type:12})}),[d]),selectedItems:c,activeIndex:a}}Ge.stateChangeTypes=Xe,e.default=de,e.resetIdCounter=function(){B=0},e.useCombobox=$e,e.useMultipleSelection=Ge,e.useSelect=Ve,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","preact","prop-types"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Downshift={},e.preact,e.PropTypes)}(this,(function(e,t,n){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(n),s={},r=60103,l=60106,u=60107,d=60108,a=60114,c=60109,h=60110,p=60112,g=60113,m=60120,f=60115,I=60116,y=60121,v=60122,x=60117,b=60129,w=60131;if("function"==typeof Symbol&&Symbol.for){var S=Symbol.for;r=S("react.element"),l=S("react.portal"),u=S("react.fragment"),d=S("react.strict_mode"),a=S("react.profiler"),c=S("react.provider"),h=S("react.context"),p=S("react.forward_ref"),g=S("react.suspense"),m=S("react.suspense_list"),f=S("react.memo"),I=S("react.lazy"),y=S("react.block"),v=S("react.server.block"),x=S("react.fundamental"),b=S("react.debug_trace_mode"),w=S("react.legacy_hidden")}function k(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case a:case d:case g:case m:return e;default:switch(e=e&&e.$$typeof){case h:case p:case I:case f:case c:return e;default:return t}}case l:return t}}}var C=c,O=r,M=p,E=u,D=I,P=f,R=l,T=a,H=d,K=g;function F(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function V(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function N(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return V(n.overflowY,t)||V(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function A(e,t,n,i,o,s,r,l){return s<e&&r>t||s>e&&r<t?0:s<=e&&l<=n||r>=t&&l>=n?s-e-i:r>t&&l<n||s<e&&l>n?r-t+o:0}s.ContextConsumer=h,s.ContextProvider=C,s.Element=O,s.ForwardRef=M,s.Fragment=E,s.Lazy=D,s.Memo=P,s.Portal=R,s.Profiler=T,s.StrictMode=H,s.Suspense=K,s.isAsyncMode=function(){return!1},s.isConcurrentMode=function(){return!1},s.isContextConsumer=function(e){return k(e)===h},s.isContextProvider=function(e){return k(e)===c},s.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},s.isForwardRef=function(e){return k(e)===p},s.isFragment=function(e){return k(e)===u},s.isLazy=function(e){return k(e)===I},s.isMemo=function(e){return k(e)===f},s.isPortal=function(e){return k(e)===l},s.isProfiler=function(e){return k(e)===a},s.isStrictMode=function(e){return k(e)===d},s.isSuspense=function(e){return k(e)===g},s.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===u||e===a||e===b||e===d||e===g||e===m||e===w||"object"==typeof e&&null!==e&&(e.$$typeof===I||e.$$typeof===f||e.$$typeof===c||e.$$typeof===h||e.$$typeof===p||e.$$typeof===x||e.$$typeof===y||e[0]===v)},s.typeOf=k;let B=0;function L(e){return"function"==typeof e?e:$}function $(){}function _(e,t){if(!e)return;const n=function(e,t){var n=window,i=t.scrollMode,o=t.block,s=t.inline,r=t.boundary,l=t.skipOverflowHiddenElements,u="function"==typeof r?r:function(e){return e!==r};if(!F(e))throw new TypeError("Invalid target");for(var d,a,c=document.scrollingElement||document.documentElement,h=[],p=e;F(p)&&u(p);){if((p=null==(a=(d=p).parentElement)?d.getRootNode().host||null:a)===c){h.push(p);break}null!=p&&p===document.body&&N(p)&&!N(document.documentElement)||null!=p&&N(p,l)&&h.push(p)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,m=n.visualViewport?n.visualViewport.height:innerHeight,f=window.scrollX||pageXOffset,I=window.scrollY||pageYOffset,y=e.getBoundingClientRect(),v=y.height,x=y.width,b=y.top,w=y.right,S=y.bottom,k=y.left,C="start"===o||"nearest"===o?b:"end"===o?S:b+v/2,O="center"===s?k+x/2:"end"===s?w:k,M=[],E=0;E<h.length;E++){var D=h[E],P=D.getBoundingClientRect(),R=P.height,T=P.width,H=P.top,K=P.right,V=P.bottom,B=P.left;if("if-needed"===i&&b>=0&&k>=0&&S<=m&&w<=g&&b>=H&&S<=V&&k>=B&&w<=K)return M;var L=getComputedStyle(D),$=parseInt(L.borderLeftWidth,10),_=parseInt(L.borderTopWidth,10),U=parseInt(L.borderRightWidth,10),j=parseInt(L.borderBottomWidth,10),W=0,z=0,q="offsetWidth"in D?D.offsetWidth-D.clientWidth-$-U:0,X="offsetHeight"in D?D.offsetHeight-D.clientHeight-_-j:0,Y="offsetWidth"in D?0===D.offsetWidth?0:T/D.offsetWidth:0,G="offsetHeight"in D?0===D.offsetHeight?0:R/D.offsetHeight:0;if(c===D)W="start"===o?C:"end"===o?C-m:"nearest"===o?A(I,I+m,m,_,j,I+C,I+C+v,v):C-m/2,z="start"===s?O:"center"===s?O-g/2:"end"===s?O-g:A(f,f+g,g,$,U,f+O,f+O+x,x),W=Math.max(0,W+I),z=Math.max(0,z+f);else{W="start"===o?C-H-_:"end"===o?C-V+j+X:"nearest"===o?A(H,V,R,_,j+X,C,C+v,v):C-(H+R/2)+X/2,z="start"===s?O-B-$:"center"===s?O-(B+T/2)+q/2:"end"===s?O-K+U+q:A(B,K,T,$,U+q,O,O+x,x);var J=D.scrollLeft,Q=D.scrollTop;C+=Q-(W=Math.max(0,Math.min(Q+W/G,D.scrollHeight-R/G+X))),O+=J-(z=Math.max(0,Math.min(J+z/Y,D.scrollWidth-T/Y+q)))}M.push({el:D,top:W,left:z})}return M}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((e=>{let{el:t,top:n,left:i}=e;t.scrollTop=n,t.scrollLeft=i}))}function U(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function j(e,t){let n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,s=new Array(o),r=0;r<o;r++)s[r]=arguments[r];i(),n=setTimeout((()=>{n=null,e(...s)}),t)}return o.cancel=i,o}function W(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.some((t=>(t&&t(e,...i),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault)))}}function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>{t.forEach((t=>{"function"==typeof t?t(e):t&&(t.current=e)}))}}function q(){return String(B++)}function X(e){let{isOpen:t,resultCount:n,previousResultCount:i}=e;return t?n?n!==i?`${n} result${1===n?" is":"s are"} available, use up and down arrow keys to navigate. Press Enter key to select.`:"":"No results are available.":""}function Y(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}const G=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function J(e){void 0===e&&(e={});const t={};return G.forEach((n=>{e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function Q(e,t){return Object.keys(e).reduce(((n,i)=>(n[i]=Z(t,i)?t[i]:e[i],n)),{})}function Z(e,t){return void 0!==e[t]}function ee(e){const{key:t,keyCode:n}=e;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?`Arrow${t}`:t}function te(e,t,n,i,o){if(void 0===o&&(o=!0),0===n)return-1;const s=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:s+1);let r=t+e;r<0?r=o?s:0:r>s&&(r=o?0:s);const l=ne(e,r,n,i,o);return-1===l?t>=n?-1:t:l}function ne(e,t,n,i,o){const s=i(t);if(!s||!s.hasAttribute("disabled"))return t;if(e>0){for(let e=t+1;e<n;e++)if(!i(e).hasAttribute("disabled"))return e}else for(let e=t-1;e>=0;e--)if(!i(e).hasAttribute("disabled"))return e;return o?e>0?ne(1,0,n,i,!1):ne(-1,n-1,n,i,!1):-1}function ie(e,t,n,i){return void 0===i&&(i=!0),t.some((t=>t&&(U(t,e,n)||i&&U(t,n.document.activeElement,n))))}const oe=j((e=>{re(e).textContent=""}),500);function se(e,t){const n=re(t);e&&(n.textContent=e,oe(t))}function re(e){void 0===e&&(e=document);let t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var le=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16});const ue=(()=>{class e extends t.Component{constructor(e){var t;super(e),t=this,this.id=this.props.id||`downshift-${q()}`,this.menuId=this.props.menuId||`${this.id}-menu`,this.labelId=this.props.labelId||`${this.id}-label`,this.inputId=this.props.inputId||`${this.id}-input`,this.getItemId=this.props.getItemId||(e=>`${this.id}-item-${e}`),this.input=null,this.items=[],this.itemCount=null,this.previousResultCount=0,this.timeoutIds=[],this.internalSetTimeout=(e,t)=>{const n=setTimeout((()=>{this.timeoutIds=this.timeoutIds.filter((e=>e!==n)),e()}),t);this.timeoutIds.push(n)},this.setItemCount=e=>{this.itemCount=e},this.unsetItemCount=()=>{this.itemCount=null},this.setHighlightedIndex=function(e,n){void 0===e&&(e=t.props.defaultHighlightedIndex),void 0===n&&(n={}),n=J(n),t.internalSetState({highlightedIndex:e,...n})},this.clearSelection=e=>{this.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:this.props.defaultHighlightedIndex,isOpen:this.props.defaultIsOpen},e)},this.selectItem=(e,t,n)=>{t=J(t),this.internalSetState({isOpen:this.props.defaultIsOpen,highlightedIndex:this.props.defaultHighlightedIndex,selectedItem:e,inputValue:this.props.itemToString(e),...t},n)},this.selectItemAtIndex=(e,t,n)=>{const i=this.items[e];null!=i&&this.selectItem(i,t,n)},this.selectHighlightedItem=(e,t)=>this.selectItemAtIndex(this.getState().highlightedIndex,e,t),this.internalSetState=(e,t)=>{let n,i;const o={},s="function"==typeof e;return!s&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,{...this.getStateAndHelpers(),...e}),this.setState((t=>{t=this.getState(t);let r=s?e(t):e;r=this.props.stateReducer(t,r),n=r.hasOwnProperty("selectedItem");const l={};return n&&r.selectedItem!==t.selectedItem&&(i=r.selectedItem),r.type=r.type||0,Object.keys(r).forEach((e=>{t[e]!==r[e]&&(o[e]=r[e]),"type"!==e&&(r[e],Z(this.props,e)||(l[e]=r[e]))})),s&&r.hasOwnProperty("inputValue")&&this.props.onInputValueChange(r.inputValue,{...this.getStateAndHelpers(),...r}),l}),(()=>{L(t)();Object.keys(o).length>1&&this.props.onStateChange(o,this.getStateAndHelpers()),n&&this.props.onSelect(e.selectedItem,this.getStateAndHelpers()),void 0!==i&&this.props.onChange(i,this.getStateAndHelpers()),this.props.onUserAction(o,this.getStateAndHelpers())}))},this.rootRef=e=>this._rootNode=e,this.getRootProps=function(e,n){let{refKey:i="ref",ref:o,...s}=void 0===e?{}:e,{suppressRefError:r=!1}=void 0===n?{}:n;t.getRootProps.called=!0,t.getRootProps.refKey=i,t.getRootProps.suppressRefError=r;const{isOpen:l}=t.getState();return{[i]:z(o,t.rootRef),role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-owns":l?t.menuId:null,"aria-labelledby":t.labelId,...s}},this.keyDownHandlers={ArrowDown(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:4})}else this.internalSetState({isOpen:!0,type:4},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=te(1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:4})}}))},ArrowUp(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:3})}else this.internalSetState({isOpen:!0,type:3},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=te(-1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:3})}}))},Enter(e){if(229===e.which)return;const{isOpen:t,highlightedIndex:n}=this.getState();if(t&&null!=n){e.preventDefault();const t=this.items[n],i=this.getItemNodeFromIndex(n);if(null==t||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}},Escape(e){e.preventDefault(),this.reset({type:5,...!this.state.isOpen&&{selectedItem:null,inputValue:""}})}},this.buttonKeyDownHandlers={...this.keyDownHandlers," "(e){e.preventDefault(),this.toggleMenu({type:12})}},this.inputKeyDownHandlers={...this.keyDownHandlers,Home(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ne(1,0,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:7})},End(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ne(-1,n-1,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:8})}},this.getToggleButtonProps=function(e){let{onClick:n,onPress:i,onKeyDown:o,onKeyUp:s,onBlur:r,...l}=void 0===e?{}:e;const{isOpen:u}=t.getState(),d={onClick:W(n,t.buttonHandleClick),onKeyDown:W(o,t.buttonHandleKeyDown),onKeyUp:W(s,t.buttonHandleKeyUp),onBlur:W(r,t.buttonHandleBlur)};return{type:"button",role:"button","aria-label":u?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0,...l.disabled?{}:d,...l}},this.buttonHandleKeyUp=e=>{e.preventDefault()},this.buttonHandleKeyDown=e=>{const t=ee(e);this.buttonKeyDownHandlers[t]&&this.buttonKeyDownHandlers[t].call(this,e)},this.buttonHandleClick=e=>{e.preventDefault(),this.props.environment.document.activeElement===this.props.environment.document.body&&e.target.focus(),this.internalSetTimeout((()=>this.toggleMenu({type:13})))},this.buttonHandleBlur=e=>{const t=e.target;this.internalSetTimeout((()=>{this.isMouseDown||null!=this.props.environment.document.activeElement&&this.props.environment.document.activeElement.id===this.inputId||this.props.environment.document.activeElement===t||this.reset({type:14})}))},this.getLabelProps=e=>({htmlFor:this.inputId,id:this.labelId,...e}),this.getInputProps=function(e){let n,{onKeyDown:i,onBlur:o,onChange:s,onInput:r,onChangeText:l,...u}=void 0===e?{}:e,d={};n="onInput";const{inputValue:a,isOpen:c,highlightedIndex:h}=t.getState();return u.disabled||(d={onInput:W(s,r,t.inputHandleChange),onKeyDown:W(i,t.inputHandleKeyDown),onBlur:W(o,t.inputHandleBlur)}),{"aria-autocomplete":"list","aria-activedescendant":c&&"number"==typeof h&&h>=0?t.getItemId(h):null,"aria-controls":c?t.menuId:null,"aria-labelledby":t.labelId,autoComplete:"off",value:a,id:t.inputId,...d,...u}},this.inputHandleKeyDown=e=>{const t=ee(e);t&&this.inputKeyDownHandlers[t]&&this.inputKeyDownHandlers[t].call(this,e)},this.inputHandleChange=e=>{this.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:this.props.defaultHighlightedIndex})},this.inputHandleBlur=()=>{this.internalSetTimeout((()=>{const e=this.props.environment.document&&!!this.props.environment.document.activeElement&&!!this.props.environment.document.activeElement.dataset&&this.props.environment.document.activeElement.dataset.toggle&&this._rootNode&&this._rootNode.contains(this.props.environment.document.activeElement);this.isMouseDown||e||this.reset({type:10})}))},this.menuRef=e=>{this._menuNode=e},this.getMenuProps=function(e,n){let{refKey:i="ref",ref:o,...s}=void 0===e?{}:e,{suppressRefError:r=!1}=void 0===n?{}:n;return t.getMenuProps.called=!0,t.getMenuProps.refKey=i,t.getMenuProps.suppressRefError=r,{[i]:z(o,t.menuRef),role:"listbox","aria-labelledby":s&&s["aria-label"]?null:t.labelId,id:t.menuId,...s}},this.getItemProps=function(e){let{onMouseMove:n,onMouseDown:i,onClick:o,onPress:s,index:r,item:l,...u}=void 0===e?{}:e;void 0===r?(t.items.push(l),r=t.items.indexOf(l)):t.items[r]=l;const d=o,a={onMouseMove:W(n,(()=>{r!==t.getState().highlightedIndex&&(t.setHighlightedIndex(r,{type:2}),t.avoidScrolling=!0,t.internalSetTimeout((()=>t.avoidScrolling=!1),250))})),onMouseDown:W(i,(e=>{e.preventDefault()})),onClick:W(d,(()=>{t.selectItemAtIndex(r,{type:9})}))},c=u.disabled?{onMouseDown:a.onMouseDown}:a;return{id:t.getItemId(r),role:"option","aria-selected":t.getState().highlightedIndex===r,...c,...u}},this.clearItems=()=>{this.items=[]},this.reset=function(e,n){void 0===e&&(e={}),e=J(e),t.internalSetState((n=>{let{selectedItem:i}=n;return{isOpen:t.props.defaultIsOpen,highlightedIndex:t.props.defaultHighlightedIndex,inputValue:t.props.itemToString(i),...e}}),n)},this.toggleMenu=function(e,n){void 0===e&&(e={}),e=J(e),t.internalSetState((n=>{let{isOpen:i}=n;return{isOpen:!i,...i&&{highlightedIndex:t.props.defaultHighlightedIndex},...e}}),(()=>{const{isOpen:i,highlightedIndex:o}=t.getState();i&&t.getItemCount()>0&&"number"==typeof o&&t.setHighlightedIndex(o,e),L(n)()}))},this.openMenu=e=>{this.internalSetState({isOpen:!0},e)},this.closeMenu=e=>{this.internalSetState({isOpen:!1},e)},this.updateStatus=j((()=>{const e=this.getState(),t=this.items[e.highlightedIndex],n=this.getItemCount(),i=this.props.getA11yStatusMessage({itemToString:this.props.itemToString,previousResultCount:this.previousResultCount,resultCount:n,highlightedItem:t,...e});this.previousResultCount=n,se(i,this.props.environment.document)}),200);const{defaultHighlightedIndex:n,initialHighlightedIndex:i=n,defaultIsOpen:o,initialIsOpen:s=o,initialInputValue:r="",initialSelectedItem:l=null}=this.props,u=this.getState({highlightedIndex:i,isOpen:s,inputValue:r,selectedItem:l});null!=u.selectedItem&&void 0===this.props.initialInputValue&&(u.inputValue=this.props.itemToString(u.selectedItem)),this.state=u}internalClearTimeouts(){this.timeoutIds.forEach((e=>{clearTimeout(e)})),this.timeoutIds=[]}getState(e){return void 0===e&&(e=this.state),Q(e,this.props)}getItemCount(){let e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e}getItemNodeFromIndex(e){return this.props.environment.document.getElementById(this.getItemId(e))}scrollHighlightedItemIntoView(){{const e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)}}moveHighlightedIndex(e,t){const n=this.getItemCount(),{highlightedIndex:i}=this.getState();if(n>0){const o=te(e,i,n,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(o,t)}}getStateAndHelpers(){const{highlightedIndex:e,inputValue:t,selectedItem:n,isOpen:i}=this.getState(),{itemToString:o}=this.props,{id:s}=this,{getRootProps:r,getToggleButtonProps:l,getLabelProps:u,getMenuProps:d,getInputProps:a,getItemProps:c,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,reset:b,setItemCount:w,unsetItemCount:S,internalSetState:k}=this;return{getRootProps:r,getToggleButtonProps:l,getLabelProps:u,getMenuProps:d,getInputProps:a,getItemProps:c,reset:b,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,setItemCount:w,unsetItemCount:S,setState:k,itemToString:o,id:s,highlightedIndex:e,inputValue:t,isOpen:i,selectedItem:n}}componentDidMount(){{const e=()=>{this.isMouseDown=!0},t=e=>{this.isMouseDown=!1;!ie(e.target,[this._rootNode,this._menuNode],this.props.environment)&&this.getState().isOpen&&this.reset({type:1},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},n=()=>{this.isTouchMove=!1},i=()=>{this.isTouchMove=!0},o=e=>{const t=ie(e.target,[this._rootNode,this._menuNode],this.props.environment,!1);this.isTouchMove||t||!this.getState().isOpen||this.reset({type:16},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},{environment:s}=this.props;s.addEventListener("mousedown",e),s.addEventListener("mouseup",t),s.addEventListener("touchstart",n),s.addEventListener("touchmove",i),s.addEventListener("touchend",o),this.cleanup=()=>{this.internalClearTimeouts(),this.updateStatus.cancel(),s.removeEventListener("mousedown",e),s.removeEventListener("mouseup",t),s.removeEventListener("touchstart",n),s.removeEventListener("touchmove",i),s.removeEventListener("touchend",o)}}}shouldScroll(e,t){const{highlightedIndex:n}=void 0===this.props.highlightedIndex?this.getState():this.props,{highlightedIndex:i}=void 0===t.highlightedIndex?e:t;return n&&this.getState().isOpen&&!e.isOpen||n!==i}componentDidUpdate(e,t){Z(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()}componentWillUnmount(){this.cleanup()}render(){const e=Y(this.props.children,$);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;const n=Y(e(this.getStateAndHelpers()));return n?this.getRootProps.called||this.props.suppressRefError?n:function(e){return"string"==typeof e.type||"string"==typeof e.nodeName}(n)?t.cloneElement(n,this.getRootProps(function(e){return e.props||e.attributes}(n))):void 0:null}}return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:X,itemToString:e=>null==e?"":String(e),onStateChange:$,onInputValueChange:$,onUserAction:$,onChange:$,onSelect:$,onOuterClick:$,selectedItemChanged:(e,t)=>e!==t,environment:"undefined"==typeof window?{}:window,stateReducer:(e,t)=>t,suppressRefError:!1,scrollIntoView:_},e.stateChangeTypes=le,e})();var de=ue;const ae={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function ce(e,t,n){const{props:i,type:o}=e,s={};Object.keys(t).forEach((i=>{!function(e,t,n,i){const{props:o,type:s}=t,r=`on${fe(e)}Change`;o[r]&&void 0!==i[e]&&i[e]!==n[e]&&o[r]({type:s,...i})}(i,e,t,n),n[i]!==t[i]&&(s[i]=n[i])})),i.onStateChange&&Object.keys(s).length&&i.onStateChange({type:o,...s})}const he=j(((e,t)=>{se(e(),t)}),200),pe="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function ge(e){let{id:n=`downshift-${q()}`,labelId:i,menuId:o,getItemId:s,toggleButtonId:r,inputId:l}=e;return t.useRef({labelId:i||`${n}-label`,menuId:o||`${n}-menu`,getItemId:s||(e=>`${n}-item-${e}`),toggleButtonId:r||`${n}-toggle-button`,inputId:l||`${n}-input`}).current}function me(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function fe(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Ie(e){const n=t.useRef(e);return n.current=e,n}function ye(e,n,i){const o=t.useRef(),s=t.useRef(),r=t.useCallback(((t,n)=>{s.current=n,t=Q(t,n.props);const i=e(t,n);return n.props.stateReducer(t,{...n,changes:i})}),[e]),[l,u]=t.useReducer(r,n),d=Ie(i),a=t.useCallback((e=>u({props:d.current,...e})),[d]),c=s.current;return t.useEffect((()=>{c&&o.current&&o.current!==l&&ce(c,Q(o.current,c.props),l),o.current=l}),[l,i,c]),[l,a]}function ve(e,t,n){const[i,o]=ye(e,t,n);return[Q(i,n),o]}const xe={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){const{selectedItem:t,itemToString:n}=e;return t?`${n(t)} has been selected.`:""},scrollIntoView:_,environment:"undefined"==typeof window?{}:window};function be(e,t,n){void 0===n&&(n=ae);const i=e[`default${fe(t)}`];return void 0!==i?i:n[t]}function we(e,t,n){void 0===n&&(n=ae);const i=e[t];if(void 0!==i)return i;const o=e[`initial${fe(t)}`];return void 0!==o?o:be(e,t,n)}function Se(e){const t=we(e,"selectedItem"),n=we(e,"isOpen"),i=we(e,"highlightedIndex"),o=we(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function ke(e,t,n){const{items:i,initialHighlightedIndex:o,defaultHighlightedIndex:s}=e,{selectedItem:r,highlightedIndex:l}=t;return 0===i.length?-1:void 0!==o&&l===o?o:void 0!==s?s:r?i.indexOf(r):0===n?-1:n<0?i.length-1:0}function Ce(e,n,i,o){const s=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((()=>{const t=()=>{s.current.isMouseDown=!0},r=t=>{s.current.isMouseDown=!1,e&&!ie(t.target,n.map((e=>e.current)),i)&&o()},l=()=>{s.current.isTouchMove=!1},u=()=>{s.current.isTouchMove=!0},d=t=>{!e||s.current.isTouchMove||ie(t.target,n.map((e=>e.current)),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",r),i.addEventListener("touchstart",l),i.addEventListener("touchmove",u),i.addEventListener("touchend",d),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",r),i.removeEventListener("touchstart",l),i.removeEventListener("touchmove",u),i.removeEventListener("touchend",d)}}),[e,i]),s}let Oe=()=>$;function Me(e,n,i){let{isInitialMount:o,highlightedIndex:s,items:r,environment:l,...u}=i;t.useEffect((()=>{o||he((()=>e({highlightedIndex:s,highlightedItem:r[s],resultCount:r.length,...u})),l.document)}),n)}function Ee(e){let{highlightedIndex:n,isOpen:i,itemRefs:o,getItemNodeFromIndex:s,menuElement:r,scrollIntoView:l}=e;const u=t.useRef(!0);return pe((()=>{n<0||!i||!Object.keys(o.current).length||(!1===u.current?u.current=!0:l(s(n),r))}),[n]),u}let De=$;function Pe(e,t,n){const{type:i,props:o}=t;let s;switch(i){case n.ItemMouseMove:s={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:s={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ke(o,e,0)};break;case n.FunctionOpenMenu:s={isOpen:!0,highlightedIndex:ke(o,e,0)};break;case n.FunctionCloseMenu:s={isOpen:!1};break;case n.FunctionSetHighlightedIndex:s={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:s={inputValue:t.inputValue};break;case n.FunctionReset:s={highlightedIndex:be(o,"highlightedIndex"),isOpen:be(o,"isOpen"),selectedItem:be(o,"selectedItem"),inputValue:be(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...s}}var Re=function(){return Re=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Re.apply(this,arguments)};o.default.array.isRequired,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.bool,o.default.bool,o.default.bool,o.default.any,o.default.any,o.default.any,o.default.string,o.default.string,o.default.string,o.default.func,o.default.string,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});var Te=Re(Re({},xe),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?"".concat(n," result").concat(1===n?" is":"s are"," available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select."):"":"No results are available.":""}}),He=$;var Ke=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:1,ToggleButtonKeyDownArrowUp:2,ToggleButtonKeyDownCharacter:3,ToggleButtonKeyDownEscape:4,ToggleButtonKeyDownHome:5,ToggleButtonKeyDownEnd:6,ToggleButtonKeyDownEnter:7,ToggleButtonKeyDownSpaceButton:8,ToggleButtonKeyDownPageUp:9,ToggleButtonKeyDownPageDown:10,ToggleButtonBlur:11,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21});function Fe(e,t){const{type:n,props:i,altKey:o}=t;let s;switch(n){case 14:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),selectedItem:i.items[t.index]};break;case 3:{const n=t.key,o=`${e.inputValue}${n}`,r=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,s=e.getItemNodeFromIndex,r=t.toLowerCase(),l=0;l<i.length;l++){var u=(l+n+(t.length<2?1:0))%i.length,d=i[u];if(void 0!==d&&o(d).toLowerCase().startsWith(r)){var a=s(u);if(!(null==a?void 0:a.hasAttribute("disabled")))return u}}return n}({keysSoFar:o,highlightedIndex:!e.isOpen&&e.selectedItem?i.items.indexOf(e.selectedItem):e.highlightedIndex,items:i.items,itemToString:i.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});s={inputValue:o,highlightedIndex:r,isOpen:!0}}break;case 1:s={highlightedIndex:e.isOpen?te(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):o&&null==e.selectedItem?-1:ke(i,e,1),isOpen:!0};break;case 2:if(e.isOpen&&o)s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};else{s={highlightedIndex:e.isOpen?te(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):ke(i,e,-1),isOpen:!0}}break;case 7:case 8:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 5:s={highlightedIndex:ne(1,0,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:s={highlightedIndex:ne(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:s={highlightedIndex:te(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 10:s={highlightedIndex:te(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:s={isOpen:!1,highlightedIndex:-1};break;case 11:s={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 19:s={selectedItem:t.selectedItem};break;default:return Pe(e,t,Ke)}return{...e,...s}}function Ve(e){void 0===e&&(e={}),He();const n={...Te,...e},{items:i,scrollIntoView:o,environment:s,itemToString:r,getA11ySelectionMessage:l,getA11yStatusMessage:u}=n,d=Se(n),[a,c]=ve(Fe,d,n),{isOpen:h,highlightedIndex:p,selectedItem:g,inputValue:m}=a,f=t.useRef(null),I=t.useRef(null),y=t.useRef({}),v=t.useRef(null),x=ge(n),b=t.useRef(),w=t.useRef(!0),S=Ie({state:a,props:n}),k=t.useCallback((e=>y.current[x.getItemId(e)]),[x]);Me(u,[h,p,m,i],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:s,itemToString:r,...a}),Me(l,[g],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:s,itemToString:r,...a});const C=Ee({menuElement:I.current,highlightedIndex:p,isOpen:h,itemRefs:y,scrollIntoView:o,getItemNodeFromIndex:k});t.useEffect((()=>(v.current=j((e=>{e({type:20,inputValue:""})}),500),()=>{v.current.cancel()})),[]),t.useEffect((()=>{m&&v.current(c)}),[c,m]),De({isInitialMount:w.current,props:n,state:a}),t.useEffect((()=>{w.current||(b.current=i.length)}));const O=Ce(h,[I,f],s,(()=>{c({type:11})})),M=Oe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{h||(y.current={})}),[h]);const E=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),c({type:1,getItemNodeFromIndex:k,altKey:e.altKey})},ArrowUp(e){e.preventDefault(),c({type:2,getItemNodeFromIndex:k,altKey:e.altKey})},Home(e){e.preventDefault(),c({type:5,getItemNodeFromIndex:k})},End(e){e.preventDefault(),c({type:6,getItemNodeFromIndex:k})},Escape(){S.current.state.isOpen&&c({type:4})},Enter(e){e.preventDefault(),c({type:S.current.state.isOpen?7:0})},PageUp(e){S.current.state.isOpen&&(e.preventDefault(),c({type:9,getItemNodeFromIndex:k}))},PageDown(e){S.current.state.isOpen&&(e.preventDefault(),c({type:10,getItemNodeFromIndex:k}))}," "(e){e.preventDefault();const t=S.current.state;t.isOpen?t.inputValue?c({type:3,key:" ",getItemNodeFromIndex:k}):c({type:8}):c({type:0})}})),[c,k,S]),D=t.useCallback((()=>{c({type:15})}),[c]),P=t.useCallback((()=>{c({type:17})}),[c]),R=t.useCallback((()=>{c({type:16})}),[c]),T=t.useCallback((e=>{c({type:18,highlightedIndex:e})}),[c]),H=t.useCallback((e=>{c({type:19,selectedItem:e})}),[c]),K=t.useCallback((()=>{c({type:21})}),[c]),F=t.useCallback((e=>{c({type:20,inputValue:e})}),[c]),V=t.useCallback((e=>({id:x.labelId,htmlFor:x.toggleButtonId,...e})),[x]),N=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",onKeyDown:o,onBlur:s,ref:r,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;return M("getMenuProps",u,i,I),{[i]:z(r,(e=>{I.current=e})),id:x.menuId,role:"listbox","aria-labelledby":x.labelId,tabIndex:-1,onMouseLeave:W(n,(()=>{c({type:12})})),...l}}),[c,M,x]);return{getToggleButtonProps:t.useCallback((function(e,t){let{onBlur:n,onClick:i,onKeyDown:o,refKey:s="ref",ref:r,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;const d=S.current.state,a=()=>{c({type:0})},h=e=>{const t=ee(e);t&&E[t]?E[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&c({type:3,key:t,getItemNodeFromIndex:k})},p={[s]:z(r,(e=>{f.current=e})),"aria-activedescendant":d.isOpen&&d.highlightedIndex>-1?x.getItemId(d.highlightedIndex):"","aria-controls":x.menuId,"aria-expanded":S.current.state.isOpen,"aria-haspopup":"listbox","aria-labelledby":`${x.labelId}`,id:x.toggleButtonId,role:"combobox",tabIndex:0,onBlur:W(n,(()=>{d.isOpen&&!O.current.isMouseDown&&c({type:11})})),...l};return l.disabled||(p.onClick=W(i,a),p.onKeyDown=W(o,h)),M("getToggleButtonProps",u,s,f),p}),[S,x,M,c,O,E,k]),getLabelProps:V,getMenuProps:N,getItemProps:t.useCallback((function(e){let{item:t,index:n,onMouseMove:o,onClick:s,refKey:r="ref",ref:l,disabled:u,...d}=void 0===e?{}:e;const{state:a,props:h}=S.current,p=t??i[n],m=me(n,p,h.items),f=()=>{c({type:14,index:m})},I=me(m,p,h.items);if(I<0)throw new Error("Pass either item or item index in getItemProps!");const v={disabled:u,role:"option","aria-selected":`${p===g}`,id:x.getItemId(I),[r]:z(l,(e=>{e&&(y.current[x.getItemId(I)]=e)})),...d};return u||(v.onClick=W(s,f)),v.onMouseMove=W(o,(()=>{m!==a.highlightedIndex&&(C.current=!1,c({type:13,index:m,disabled:u}))})),v}),[S,i,g,x,C,c]),toggleMenu:D,openMenu:R,closeMenu:P,setHighlightedIndex:T,selectItem:H,reset:K,setInputValue:F,highlightedIndex:p,isOpen:h,selectedItem:g,inputValue:m}}Ve.stateChangeTypes=Ke;var Ne=Object.freeze({__proto__:null,InputKeyDownArrowDown:0,InputKeyDownArrowUp:1,InputKeyDownEscape:2,InputKeyDownHome:3,InputKeyDownEnd:4,InputKeyDownPageUp:5,InputKeyDownPageDown:6,InputKeyDownEnter:7,InputChange:8,InputBlur:9,InputFocus:10,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:13,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:22});o.default.array.isRequired,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.bool,o.default.bool,o.default.bool,o.default.any,o.default.any,o.default.any,o.default.string,o.default.string,o.default.string,o.default.string,o.default.string,o.default.string,o.default.func,o.default.string,o.default.string,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});let Ae=$;const Be={...xe,getA11yStatusMessage:X};function Le(e,t){const{type:n,props:i,altKey:o}=t;let s;switch(n){case 13:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case 0:s=e.isOpen?{highlightedIndex:te(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:o&&null==e.selectedItem?-1:ke(i,e,1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 1:s=e.isOpen?o?{isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}}:{highlightedIndex:te(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:ke(i,e,-1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 7:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 2:s={isOpen:!1,highlightedIndex:-1,...!e.isOpen&&{selectedItem:null,inputValue:""}};break;case 5:s={highlightedIndex:te(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 6:s={highlightedIndex:te(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 3:s={highlightedIndex:ne(1,0,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:s={highlightedIndex:ne(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1)};break;case 9:s={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 8:s={isOpen:!0,highlightedIndex:be(i,"highlightedIndex"),inputValue:t.inputValue};break;case 10:s={isOpen:!0,highlightedIndex:ke(i,e,0)};break;case 19:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case 22:s={inputValue:t.inputValue};break;default:return Pe(e,t,Ne)}return{...e,...s}}function $e(e){void 0===e&&(e={}),Ae();const n={...Be,...e},{initialIsOpen:i,defaultIsOpen:o,items:s,scrollIntoView:r,environment:l,getA11yStatusMessage:u,getA11ySelectionMessage:d,itemToString:a}=n,c=function(e){const t=Se(e),{selectedItem:n}=t;let{inputValue:i}=t;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),{...t,inputValue:i}}(n),[h,p]=function(e,n,i){const o=t.useRef(),[s,r]=ye(e,n,i);return t.useEffect((()=>{Z(i,"selectedItem")&&(o.current!==i.selectedItem&&r({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=s.selectedItem===o.current?i.selectedItem:s.selectedItem)})),[Q(s,i),r]}(Le,c,n),{isOpen:g,highlightedIndex:m,selectedItem:f,inputValue:I}=h,y=t.useRef(null),v=t.useRef({}),x=t.useRef(null),b=t.useRef(null),w=t.useRef(!0),S=ge(n),k=t.useRef(),C=Ie({state:h,props:n}),O=t.useCallback((e=>v.current[S.getItemId(e)]),[S]);Me(u,[g,m,I,s],{isInitialMount:w.current,previousResultCount:k.current,items:s,environment:l,itemToString:a,...h}),Me(d,[f],{isInitialMount:w.current,previousResultCount:k.current,items:s,environment:l,itemToString:a,...h});const M=Ee({menuElement:y.current,highlightedIndex:m,isOpen:g,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:O});De({isInitialMount:w.current,props:n,state:h}),t.useEffect((()=>{(i||o||g)&&x.current&&x.current.focus()}),[]),t.useEffect((()=>{w.current||(k.current=s.length)}));const E=Ce(g,[x,y,b],l,(()=>{p({type:9,selectItem:!1})})),D=Oe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{g?document.activeElement!==x.current&&x?.current?.focus():v.current={}}),[g]);const P=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),p({type:0,altKey:e.altKey,getItemNodeFromIndex:O})},ArrowUp(e){e.preventDefault(),p({type:1,altKey:e.altKey,getItemNodeFromIndex:O})},Home(e){C.current.state.isOpen&&(e.preventDefault(),p({type:3,getItemNodeFromIndex:O}))},End(e){C.current.state.isOpen&&(e.preventDefault(),p({type:4,getItemNodeFromIndex:O}))},Escape(e){const t=C.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),p({type:2}))},Enter(e){C.current.state.isOpen&&229!==e.which&&(e.preventDefault(),p({type:7,getItemNodeFromIndex:O}))},PageUp(e){C.current.state.isOpen&&(e.preventDefault(),p({type:5,getItemNodeFromIndex:O}))},PageDown(e){C.current.state.isOpen&&(e.preventDefault(),p({type:6,getItemNodeFromIndex:O}))}})),[p,C,O]),R=t.useCallback((e=>({id:S.labelId,htmlFor:S.inputId,...e})),[S]),T=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",ref:o,...s}=void 0===e?{}:e,{suppressRefError:r=!1}=void 0===t?{}:t;return D("getMenuProps",r,i,y),{[i]:z(o,(e=>{y.current=e})),id:S.menuId,role:"listbox","aria-labelledby":S.labelId,onMouseLeave:W(n,(()=>{p({type:11})})),...s}}),[p,D,S]),H=t.useCallback((function(e){let{item:t,index:n,refKey:i="ref",ref:o,onMouseMove:s,onMouseDown:r,onClick:l,onPress:u,disabled:d,...a}=void 0===e?{}:e;const{props:c,state:h}=C.current,g=me(n,t,c.items);if(g<0)throw new Error("Pass either item or item index in getItemProps!");const m=l;return{[i]:z(o,(e=>{e&&(v.current[S.getItemId(g)]=e)})),disabled:d,role:"option","aria-selected":`${g===h.highlightedIndex}`,id:S.getItemId(g),...!d&&{onClick:W(m,(()=>{p({type:13,index:n})}))},onMouseMove:W(s,(()=>{n!==h.highlightedIndex&&(M.current=!1,p({type:12,index:n,disabled:d}))})),onMouseDown:W(r,(e=>e.preventDefault())),...a}}),[p,C,M,S]),K=t.useCallback((function(e){let{onClick:t,onPress:n,refKey:i="ref",ref:o,...s}=void 0===e?{}:e;const r=C.current.state;return{[i]:z(o,(e=>{b.current=e})),"aria-controls":S.menuId,"aria-expanded":r.isOpen,id:S.toggleButtonId,tabIndex:-1,...!s.disabled&&{onClick:W(t,(()=>{p({type:14})}))},...s}}),[p,C,S]),F=t.useCallback((function(e,t){let{onKeyDown:n,onChange:i,onInput:o,onFocus:s,onBlur:r,onChangeText:l,refKey:u="ref",ref:d,...a}=void 0===e?{}:e,{suppressRefError:c=!1}=void 0===t?{}:t;D("getInputProps",c,u,x);const h=C.current.state,g=e=>{const t=ee(e);t&&P[t]&&P[t](e)},m=e=>{p({type:8,inputValue:e.target.value})},f=()=>{h.isOpen&&!E.current.isMouseDown&&p({type:9,selectItem:!0})},I=()=>{h.isOpen||p({type:10})};let y={};return a.disabled||(y={onInput:W(i,o,m),onKeyDown:W(n,g),onBlur:W(r,f),onFocus:W(s,I)}),{[u]:z(d,(e=>{x.current=e})),"aria-activedescendant":h.isOpen&&h.highlightedIndex>-1?S.getItemId(h.highlightedIndex):"","aria-autocomplete":"list","aria-controls":S.menuId,"aria-expanded":h.isOpen,"aria-labelledby":S.labelId,autoComplete:"off",id:S.inputId,role:"combobox",value:h.inputValue,...y,...a}}),[p,P,C,E,D,S]),V=t.useCallback((()=>{p({type:15})}),[p]),N=t.useCallback((()=>{p({type:17})}),[p]),A=t.useCallback((()=>{p({type:16})}),[p]),B=t.useCallback((e=>{p({type:18,highlightedIndex:e})}),[p]),L=t.useCallback((e=>{p({type:19,selectedItem:e})}),[p]);return{getItemProps:H,getLabelProps:R,getMenuProps:T,getInputProps:F,getToggleButtonProps:K,toggleMenu:V,openMenu:A,closeMenu:N,setHighlightedIndex:B,setInputValue:t.useCallback((e=>{p({type:20,inputValue:e})}),[p]),selectItem:L,reset:t.useCallback((()=>{p({type:21})}),[p]),highlightedIndex:m,isOpen:g,selectedItem:f,inputValue:I}}$e.stateChangeTypes=Ne;const _e={activeIndex:-1,selectedItems:[]};function Ue(e,t){return we(e,t,_e)}function je(e,t){return be(e,t,_e)}function We(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;const t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}o.default.array,o.default.array,o.default.array,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.func,o.default.func,o.default.string,o.default.string,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});const ze={itemToString:xe.itemToString,stateReducer:xe.stateReducer,environment:xe.environment,getA11yRemovalMessage:function(e){const{removedSelectedItem:t,itemToString:n}=e;return`${n(t)} has been removed.`},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"};let qe=$;var Xe=Object.freeze({__proto__:null,SelectedItemClick:0,SelectedItemKeyDownDelete:1,SelectedItemKeyDownBackspace:2,SelectedItemKeyDownNavigationNext:3,SelectedItemKeyDownNavigationPrevious:4,DropdownKeyDownNavigationPrevious:5,DropdownKeyDownBackspace:6,DropdownClick:7,FunctionAddSelectedItem:8,FunctionRemoveSelectedItem:9,FunctionSetSelectedItems:10,FunctionSetActiveIndex:11,FunctionReset:12});function Ye(e,t){const{type:n,index:i,props:o,selectedItem:s}=t,{activeIndex:r,selectedItems:l}=e;let u;switch(n){case 0:u={activeIndex:i};break;case 4:u={activeIndex:r-1<0?0:r-1};break;case 3:u={activeIndex:r+1>=l.length?-1:r+1};break;case 2:case 1:{let e=r;1===l.length?e=-1:r===l.length-1&&(e=l.length-2),u={selectedItems:[...l.slice(0,r),...l.slice(r+1)],activeIndex:e};break}case 5:u={activeIndex:l.length-1};break;case 6:u={selectedItems:l.slice(0,l.length-1)};break;case 8:u={selectedItems:[...l,s]};break;case 7:u={activeIndex:-1};break;case 9:{let e=r;const t=l.indexOf(s);t>=0&&(1===l.length?e=-1:t===l.length-1&&(e=l.length-2),u={selectedItems:[...l.slice(0,t),...l.slice(t+1)],activeIndex:e});break}case 10:{const{selectedItems:e}=t;u={selectedItems:e};break}case 11:{const{activeIndex:e}=t;u={activeIndex:e};break}case 12:u={activeIndex:je(o,"activeIndex"),selectedItems:je(o,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...u}}function Ge(e){void 0===e&&(e={}),qe();const n={...ze,...e},{getA11yRemovalMessage:i,itemToString:o,environment:s,keyNavigationNext:r,keyNavigationPrevious:l}=n,[u,d]=ve(Ye,function(e){return{activeIndex:Ue(e,"activeIndex"),selectedItems:Ue(e,"selectedItems")}}(n),n),{activeIndex:a,selectedItems:c}=u,h=t.useRef(!0),p=t.useRef(null),g=t.useRef(c),m=t.useRef();m.current=[];const f=Ie({state:u,props:n});t.useEffect((()=>{if(!h.current){if(c.length<g.current.length){const e=g.current.find((e=>c.indexOf(e)<0));se(i({itemToString:o,resultCount:c.length,removedSelectedItem:e,activeIndex:a,activeSelectedItem:c[a]}),s.document)}g.current=c}}),[c.length]),t.useEffect((()=>{h.current||(-1===a&&p.current?p.current.focus():m.current[a]&&m.current[a].focus())}),[a]),De({isInitialMount:h.current,props:n,state:u});const I=Oe();t.useEffect((()=>(h.current=!1,()=>{h.current=!0})),[]);const y=t.useMemo((()=>({[l](){d({type:4})},[r](){d({type:3})},Delete(){d({type:1})},Backspace(){d({type:2})}})),[d,r,l]),v=t.useMemo((()=>({[l](e){We(e)&&d({type:5})},Backspace(e){We(e)&&d({type:6})}})),[d,l]);return{getSelectedItemProps:t.useCallback((function(e){let{refKey:t="ref",ref:n,onClick:i,onKeyDown:o,selectedItem:s,index:r,...l}=void 0===e?{}:e;const{state:u}=f.current;if(me(r,s,u.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return{[t]:z(n,(e=>{e&&m.current.push(e)})),tabIndex:r===u.activeIndex?0:-1,onClick:W(i,(()=>{d({type:0,index:r})})),onKeyDown:W(o,(e=>{const t=ee(e);t&&y[t]&&y[t](e)})),...l}}),[d,f,y]),getDropdownProps:t.useCallback((function(e,t){let{refKey:n="ref",ref:i,onKeyDown:o,onClick:s,preventKeyAction:r=!1,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;return I("getDropdownProps",u,n,p),{[n]:z(i,(e=>{e&&(p.current=e)})),...!r&&{onKeyDown:W(o,(e=>{const t=ee(e);t&&v[t]&&v[t](e)})),onClick:W(s,(()=>{d({type:7})}))},...l}}),[d,v,I]),addSelectedItem:t.useCallback((e=>{d({type:8,selectedItem:e})}),[d]),removeSelectedItem:t.useCallback((e=>{d({type:9,selectedItem:e})}),[d]),setSelectedItems:t.useCallback((e=>{d({type:10,selectedItems:e})}),[d]),setActiveIndex:t.useCallback((e=>{d({type:11,activeIndex:e})}),[d]),reset:t.useCallback((()=>{d({type:12})}),[d]),selectedItems:c,activeIndex:a}}Ge.stateChangeTypes=Xe,e.default=de,e.resetIdCounter=function(){B=0},e.useCombobox=$e,e.useMultipleSelection=Ge,e.useSelect=Ve,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=downshift.umd.min.js.map |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2407411
29537
1515